Ultima Underworld/technical/conversations/23
Technical Details Warning |
While the encyclopedic nature of the codex means that many articles will have information that could spoil some minor aspects of the game for newer players, this article is known to contain technical information about the game, game engine, data files, logic, etc. This information is not generally useful to the typical game players.
Continue reading at your own discretion. |
This page contains decompiled conversation code from Ultima Underworld. The original files came from Paul Carr and are currently archived here.
This file has been modified from that source (by Sir Robin) in the following ways:
- local variables holding pointers to string text have had that string text specified in a comment on that same line. This should make the conversation code easier to read.
- strings (both dereferenced ones in the code and also the ones added to comments as specified above) have been highlighted for easier reading
- function definitions have been anchored and function calls have been linked, to make it easier to follow the flow of the code
Start viewing the flow at main
// cnvdasm - ultima underworld conversation script disassembler / decompiler // // loading game strings // // conversation #23 // string block 0x0e17 (3607), name Judy // // converting to graph // searching functions // replacing expression opcodes // folding expressions // adding control structures // fixing up functions extern int private[31]; void main() { private[1] = 0; func_029d(); func_0012(); } // end func void func_0012() { private[0] = 1; } // end func void func_0020() { int locals[1]; if ( (((npc_goal == 5 || npc_goal == 6) || npc_goal == 9) && npc_gtarg == 1 || npc_attitude == 0) ) { locals[1] = 0; } else { locals[1] = 1; } // end if return locals[1]; } // end func void func_0063() { npc_gtarg = 1; npc_attitude = 1; npc_goal = 6; func_0012(); } // end func void func_007c() { npc_goal = 1; func_0012(); } // end func void func_008b() { npc_gtarg = 1; npc_goal = 5; npc_attitude = 1; func_0012(); } // end func void func_00a4() { npc_attitude = 6; } // end func void func_00b1() { npc_attitude = param1[0]play_hunger; func_0012(); } // end func void func_00c2() { npc_attitude = 2; func_0012(); } // end func void func_00d1() { npc_attitude = 1; func_0012(); } // end func void func_00e0() { func_0012(); } // end func void func_00ea() { param1[1] = game_days; param1[2] = game_mins; } // end func void func_0106() { int locals[4]; locals[2] = game_days - param2[1]; locals[3] = game_mins - param2[2]; if ( locals[3] < 0 ) { locals[3] = locals[3] + 1440; locals[2] = locals[2] - 1; } // end if if ( locals[2] >= param1[1] && locals[3] >= param1[2] ) { locals[1] = 1; } else { locals[1] = 0; } // end if return locals[1]; } // end func void func_018f() { param1[1] = game_days - param3[1]; param1[2] = game_mins - param3[2]; if ( param1[2] < 0 ) { param1[2] = param1[2] + 1440; param1[1] = param1[1] - 1; } // end if param1[1] = param2[1] - param1[1]; param1[2] = param2[2] - param1[2]; if ( param1[2] < 0 ) { param1[2] = param1[2] + 1440; param1[1] = param1[1] - 1; } // end if } // end func void func_0243() { param1[1] = game_days - param2[1]; param1[2] = game_mins - param2[2]; if ( param1[2] < 0 ) { param1[2] = param1[2] + 1440; param1[1] = param1[1] - 1; } // end if } // end func void func_029d() { int locals[2]; locals[1] = 272; locals[2] = 1; if ( find_inv( 2, &locals[2], &locals[1] ) ) { private[2] = 1; } else { private[2] = 0; } // end if if ( private[0] ) { func_079e(); } else { private[3] = 0; private[4] = 0; private[5] = 0; private[6] = 0; func_02ea(); } // end if } // end func void func_02ea() { int locals[46]; locals[1] = !private[3]; if ( !private[3] ) { locals[2] = 1; // "As you approach, the old woman looks up and squints. She is obviously near-sighted.\n "Tom?" she says, "Is it thee?"\n The hope in her eyes dies as she sees your face." print( 1, &locals[2] ); private[3] = 1; } else { say( "Yes, for a moment I got m' hopes up, thinking ye were me Tommy-boy returning at last." ); } // end if locals[24] = 1; locals[3] = 3; // "Good day to thee, old mother." locals[25] = 1; locals[4] = 4; // "I'm sorry. I am @GS8. Who is Tom?" locals[26] = locals[1]; locals[5] = 5; // "Of what foolishness dost thou speak?" locals[27] = 1; locals[6] = 6; // "Sorry, I must be going." locals[7] = 0; // "" locals[45] = babl_fmenu( 0, &locals[3], &locals[24] ); switch ( locals[45] ) { case 3: func_03a9(); break; case 4: func_0441(); break; case 5: func_04f5(); break; case 6: locals[46] = 2; func_00b1( &locals[46] ); break; } // end switch } // end func void func_03a9() { int locals[45]; locals[1] = !private[4]; if ( !private[4] ) { say( "Forgive me. I jus' be an old fool." ); private[4] = 1; } else { say( "Oh yes. I'm sorry. The years ha' made me over eager to see me Tom again." ); } // end if locals[23] = 1; locals[2] = 9; // "Who is Tom?" locals[24] = locals[1]; locals[3] = 10; // "Indeed thou art!" locals[25] = 1; locals[4] = 11; // "'Tis all right. I shall leave thee to thy grief." locals[5] = 0; // "" locals[44] = babl_fmenu( 0, &locals[2], &locals[23] ); switch ( locals[44] ) { case 9: func_0441(); break; case 10: func_04f5(); break; case 11: locals[45] = 2; func_00b1( &locals[45] ); break; } // end switch } // end func void func_0441() { int locals[45]; locals[1] = !private[5]; if ( !private[5] ) { say( "Ah, Tom, he was me Tommy-boy. Gone he is and now only I am left. Nevermore shall I see his face this side of Paradise. Nor am I even able to remember it, not a'tall." ); private[5] = 1; } else { say( "Yea, the years wi' out my Tommy have been long, and I canna remember his face, e'en though I ha' looked upon it many a time." ); } // end if locals[23] = 1; locals[2] = 14; // "Hast thou nothing to remember him by?" locals[24] = 1; locals[3] = 15; // "What happened to Tom, that thou dost wait here?" locals[25] = locals[1]; locals[4] = 16; // "Art thou a fool? Unable to remember a face?" locals[26] = 1; locals[5] = 17; // "I am sorry I cannot help thee." locals[6] = 0; // "" locals[44] = babl_fmenu( 0, &locals[2], &locals[23] ); switch ( locals[44] ) { case 14: func_071d(); break; case 15: func_067f(); break; case 16: func_04f5(); break; case 17: locals[45] = 2; func_00b1( &locals[45] ); break; } // end switch } // end func void func_04f5() { int locals[28]; locals[1] = random( 1, &locals[2] ); locals[2] = 2; if ( !private[7] ) { locals[3] = locals[1]; if ( 1 == locals[3] ) { say( "My, but thou'rt rude indeed! I ha' done no wrong t' thee, but thou dost interrupt me with unkind words. I would tha' thou speak kindly or not at all!" ); } else { if ( 2 == locals[3] ) { say( "Such harsh words from a stranger! And thou did seem so friendly at first." ); } else { if ( 3 == locals[3] ) { say( "Ah, I mus' be thinking wrongly. For a moment, ye reminded me of Tom, but me Tommy-boy would never be as rude as thee." ); } // end if } // end if } // end if locals[4] = 21; // "I do beg thy pardon. I spoke too harshly. Forgive me." locals[5] = 22; // "Thou thin-skinned old fool! Hast time eaten thy mind?" locals[6] = 23; // "I must be leaving now." locals[7] = 0; // "" locals[25] = babl_menu( 0, &locals[4] ); switch ( locals[25] ) { case 1: func_05cb(); break; case 2: func_0669(); break; case 3: locals[26] = 2; func_00b1( &locals[26] ); } // end if } else { break; } // end switch locals[27] = locals[1]; if ( 1 == locals[27] ) { say( "Again thou dost sneer at a grieving wife! Goodbye!" ); } else { if ( 2 == locals[27] ) { say( "So! Thou art a vicious heel after all. Goodbye!" ); } // end if } // end if locals[28] = 1; func_00b1( &locals[28] ); } // end func void func_05cb() { int locals[44]; say( "Well, that's better. I dinna think thou wert a ruffian. Now wha' were we speakin' of?" ); locals[22] = 1; locals[1] = 27; // "Thou mistook me for one named Tom." locals[23] = private[4]; locals[2] = 28; // "Thou spoke of being a fool." locals[24] = private[5]; locals[3] = 29; // "Thou said that Tom's face fades from thy heart." locals[25] = 1; locals[4] = 30; // "Excuse me, but I must leave." locals[5] = 0; // "" locals[43] = babl_fmenu( 0, &locals[1], &locals[22] ); switch ( locals[43] ) { case 27: func_02ea(); break; case 28: func_03a9(); break; case 29: func_0441(); break; case 30: locals[44] = 2; func_00b1( &locals[44] ); break; } // end switch } // end func void func_0669() { int locals[1]; say( "Thou be a heartless oaf! I shall speak t' thee no more!" ); locals[1] = 1; func_00b1( &locals[1] ); } // end func void func_067f() { int locals[22]; say( "He and I were walking here, down by the lava. Tom was t' ask his master, Lord Cabirus, t'bless our marriage. He just gave me this ring, "A hole of gold," he says to me, "with a plug of fair flesh."\n" " An' then one o' them headless creatures came runnin' in, and brave Tom WOULD fight wi' it. The both of them went into the lava! Ah, me Tom! And I have sat here these long years. Some o' the folk nearby take pity on me, bring me things to eat. But nary one will stay and watch wi' me for my Tom." ); private[6] = 1; locals[1] = 33; // "Isn't it unlikely that he will return from the lava?" locals[2] = 34; // "I will sit with thee." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_06cc(); break; case 2: func_08d3(); break; } // end switch } // end func void func_06cc() { int locals[23]; say( "Ah, that's me Tom. Always worrying me. Ah, Tom, come up, thou'rt worrying thy Judy! Ah, me, I canna e'en recall his face, he's so long lost t' me!" ); locals[1] = 36; // "Hast thou naught else to remember him by?" locals[2] = 37; // "I'm sorry to hear of it. Goodbye, now." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_071d(); break; case 2: locals[23] = 2; func_00b1( &locals[23] ); break; } // end switch } // end func void func_071d() { int locals[44]; say( "I had me a picture once, but 'tis lost now. Ah, me Tom! Such a bonny lad I never knew." ); locals[22] = 1; locals[1] = 39; // "Well, if I should find it, I shall return it thee." locals[23] = private[2]; locals[2] = 40; // "Didst thou? I found a picture. Perhaps it is yours." locals[24] = 1; locals[3] = 41; // "Ah, well, I must be away." locals[4] = 0; // "" locals[43] = babl_fmenu( 0, &locals[1], &locals[22] ); switch ( locals[43] ) { case 39: func_081f(); break; case 40: func_0924(); break; case 41: locals[44] = 2; func_00b1( &locals[44] ); break; } // end switch } // end func void func_079e() { int locals[44]; say( "Ah, dost bring word o' my Tom?" ); locals[22] = private[2]; locals[1] = 43; // "I have found a picture." locals[23] = 1; locals[2] = 44; // "Tom is dead, thou old fool!" locals[24] = 1; locals[3] = 45; // "Nay, I am sorry." locals[4] = 0; // "" locals[43] = babl_fmenu( 0, &locals[1], &locals[22] ); switch ( locals[43] ) { case 43: func_0924(); break; case 44: func_0879(); break; case 45: locals[44] = 2; func_00b1( &locals[44] ); break; } // end switch } // end func void func_081f() { int locals[24]; say( "Wouldst thou? Ah, thou art very kind. Bless thee." ); locals[1] = 47; // "Blessings upon thee also, old mother." locals[2] = 48; // "Goodbye." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: locals[23] = 3; func_00b1( &locals[23] ); break; case 2: locals[24] = 3; func_00b1( &locals[24] ); break; } // end switch } // end func void func_0879() { int locals[24]; say( "Nay! He but hides from me. 'Tis a game he plays. Tom! Tom, come up now, me lad, thou'rt bringing me a fright!" ); locals[1] = 50; // "Excuse me, I must be going. " locals[2] = 51; // "Good luck with thy vigil, and farewell." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: locals[23] = 2; func_00b1( &locals[23] ); break; case 2: locals[24] = 2; func_00b1( &locals[24] ); break; } // end switch } // end func void func_08d3() { int locals[23]; say( "Ah, nay, thou'rt very kind, but I'm sure an important person such as yerself has better to do with thy time. If it's helping me thou wouldst like, bring me word of me bonny Tom." ); locals[1] = 53; // "Very well. Good day to thee." locals[2] = 54; // "I think thou art doomed to disappointment. Thy Tom is surely dead." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: locals[23] = 2; func_00b1( &locals[23] ); break; case 2: func_0879(); break; } // end switch } // end func void func_0924() { int locals[22]; say( "A picture! May I see it?" ); locals[1] = 56; // "Certainly. Here it is." locals[2] = 57; // "No." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_09e5(); break; case 2: func_096c(); break; } // end switch } // end func void func_096c() { int locals[25]; locals[1] = sex( 2, &locals[3], &locals[2] ); locals[2] = 58; locals[3] = 59; say( "O thou'rt a cruel @SS1 indeed! Hast thou no compassion for a poor, pining old woman?" ); locals[4] = 61; // "I am sorry. Here is the picture." locals[5] = 62; // "No." locals[6] = 0; // "" locals[25] = babl_menu( 0, &locals[4] ); switch ( locals[25] ) { case 1: func_09e5(); break; case 2: func_09cf(); break; } // end switch } // end func void func_09cf() { int locals[1]; say( "Truly thou hast a heart of stone. Leave me t' my grief! Taunt me no more!" ); locals[1] = 1; func_00b1( &locals[1] ); } // end func void func_09e5() { int locals[31]; label_09ea:; locals[2] = find_barter( 1, &locals[3] ); locals[3] = 272; if ( locals[2] == 0 ) { say( "That's no picture of me Tom!" ); locals[4] = 65; // "I'm sorry, here it is." locals[5] = 66; // "I don't have the picture." locals[6] = 0; // "" locals[25] = babl_menu( 0, &locals[4] ); switch ( locals[25] ) { case 1: goto label_09ea; break; case 2: say( "Cruel ye are to taunt me thus. Begone!" ); locals[26] = 1; func_00b1( &locals[26] ); } // end if } else { break; } // end switch say( "Aye, that's me Tom! Ah, Tom, Tom, ye're gone from me so long!" ); locals[27] = 69; // "She begins weeping profusely, and a tear falls into the lava. After it strikes the surface, a gold key appears in its place." print( 1, &locals[27] ); locals[28] = -1; give_ptr_npc( 2, &locals[28], &locals[2] ); locals[1] = do_inv_create( 1, &locals[29] ); locals[29] = 226; locals[30] = 33; locals[31] = 8; place_object( 3, &locals[31], &locals[30], &locals[1] ); } // end func