Ultima Underworld/technical/conversations/14
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 #14 // string block 0x0e0e (3598), name Dr. Owl // // 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]global[0]; 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[23]; if ( private[0] == 0 ) { global[0] = 0; global[1] = 0; global[2] = 0; } // end if locals[1] = 0; if ( get_quest( 1, &locals[1] ) ) { if ( global[1] ) { if ( global[0] ) { func_0a8f(); } else { func_0a27(); } // end if } else { func_0a1a(); } // end if } else { if ( private[0] ) { if ( global[2] ) { func_0920(); } else { func_0992(); } // end if } else { say( "Bah! Another steals the precious time of Dr. Owl! What dost THOU want?" ); locals[2] = 2; // "I need thy help." locals[3] = 3; // "I am in trouble, and only the wise Dr. Owl can assist me." locals[4] = 4; // "Nothing in particular. I merely came to enjoy thy company." locals[5] = 5; // "I came here to learn courtesy from a master." locals[6] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: func_07cc(); break; case 2: func_07b6(); break; case 3: func_07cc(); break; case 4: func_035d(); } // end if } // end if break; } // end switch } // end func void func_035d() { int locals[22]; say( "Ah! Sarcasm! Very well, thou hast made thy point! Now, quickly, what dost thou need?" ); locals[1] = 7; // "Canst tell me of the Talismans of Sir Cabirus?" locals[2] = 8; // "I seek some missing runestones." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0689(); break; case 2: func_03a5(); break; } // end switch } // end func void func_03a5() { int locals[23]; if ( global[0] ) { say( "I have no more runestones for thee! Perhaps thou shouldst learn to use the ones thou hast." ); locals[1] = 2; func_00b1( &locals[1] ); } else { say( "Perhaps I can help thee after all, but first I will need to see thy runebag." ); locals[2] = 11; // "Certainly. Here it is." locals[3] = 12; // "No, I am sorry. I dare not let this out of my hands." locals[4] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: func_0402(); break; case 2: func_0751(); } // end if break; } // end switch } // end func void func_0402() { int locals[59]; locals[15] = 0; locals[13] = show_inv( 2, &locals[6], &locals[1] ); while ( locals[13] > 0 ) { locals[14] = 1; if ( locals[14] <= locals[13] ) { if ( locals[0] == 143 ) { locals[15] = locals[14]; locals[11] = locals[5]; } // end if locals[14] = locals[14] + 1; } // while } // end if if ( locals[15] > 0 ) { say( "Ah, yes. A budding mage indeed. I suppose thou wouldst like to have a Flam runestone?" ); locals[16] = 14; // "Surely." locals[17] = 15; // "Thank thee, but no." locals[18] = 0; // "" locals[37] = babl_menu( 0, &locals[16] ); switch ( locals[37] ) { case 1: func_04e8(); break; case 2: func_0751(); } // end if } else { break; } // end switch say( "Yes?" ); locals[38] = 17; // "Yes, here is my runebag." locals[39] = 18; // "No, I dare not part with it." locals[40] = 0; // "" locals[59] = babl_menu( 0, &locals[38] ); switch ( locals[59] ) { case 1: func_0402(); break; case 2: func_0751(); break; } // end switch } // end func void func_04e8() { int locals[25]; global[0] = take_from_npc( 1, &locals[1] ); locals[1] = 237; if ( (global[0] == 1 || global[0] == 2) ) { if ( global[1] ) { say( "Here thou art. I wish thee luck in using it." ); func_0588(); } // end if say( "Here thou art. Now, do not expect me to teach thee to use it. That is not my job! Was there anything else, or may I return to my work in peace?" ); locals[2] = 21; // "No, but thank thee." locals[3] = 22; // "Yes. Canst thou tell me of the Talismans of Sir Cabirus?" locals[4] = 23; // "What work art thou doing?" locals[5] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: locals[24] = 2; func_00b1( &locals[24] ); break; case 2: func_0689(); break; case 3: func_05d7(); } // end if } else { break; } // end switch say( "Where is that accursed stone? I must have lost it." ); locals[25] = 2; func_00b1( &locals[25] ); } // end func void func_0588() { int locals[23]; locals[1] = 25; // "I thank thee kindly, Dr. Owl." locals[2] = 26; // "I will use it well." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: break; } // end switch say( "Very well, very well. Now get on with thee!" ); locals[23] = 3; func_00b1( &locals[23] ); } // end func void func_05d7() { int locals[22]; global[2] = 1; say( "I am divining. I seek my mute servant, Murgo, who is missing." ); locals[1] = 29; // "Perhaps I might find him for thee." locals[2] = 30; // "I am sorry to hear it." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_06da(); break; case 2: func_06da(); break; } // end switch } // end func void func_0624() { int locals[23]; say( "Bah! What is it THIS time?" ); locals[1] = 32; // "Canst thou tell me of the Talismans of Sir Cabirus?" locals[2] = 33; // "I seek some missing runestones." locals[3] = 34; // "I beg thy pardon, I thought thou wert another." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0689(); break; case 2: func_03a5(); break; case 3: locals[23] = 2; func_00b1( &locals[23] ); break; } // end switch } // end func void func_0689() { int locals[23]; say( "I know where there is a bottle of the so-called Wine of Compassion! Bah! Such foolishness. Only babes and fools believe in such fairy-stories." ); locals[1] = 36; // "Wilt thou tell me where to find it?" locals[2] = 37; // "Thou'rt probably right. Sorry to have bothered thee." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_06da(); break; case 2: locals[23] = 2; func_00b1( &locals[23] ); break; } // end switch } // end func void func_06da() { int locals[25]; say( "If thou canst locate and return my missing servant Murgo, I shall tell thee where to find the Wine of Compassion." ); locals[1] = 39; // "Then I shall find him and return him." locals[2] = 40; // "Never mind. Thou art too much trouble." locals[3] = 41; // "If I see him I shall let thee know." locals[4] = 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] = 2; func_00b1( &locals[24] ); break; case 3: locals[25] = 3; func_00b1( &locals[25] ); break; } // end switch } // end func void func_0751() { int locals[23]; say( "Very well, have it thy way! Was there anything else, or may I return to my work in peace?" ); locals[1] = 43; // "No, but thank thee." locals[2] = 44; // "Yes. Canst thou tell me of the talismans of Sir Cabirus?" locals[3] = 45; // "What work art thou doing?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: locals[23] = 3; func_00b1( &locals[23] ); break; case 2: func_0689(); break; case 3: func_05d7(); break; } // end switch } // end func void func_07b6() { int locals[1]; say( "I have no time for idle chit-chat! Be off with thee!" ); locals[1] = 2; func_00b1( &locals[1] ); } // end func void func_07cc() { int locals[23]; say( "Bah! Nonsense! Get thyself gone from here, or I shall make thee wish thou had!" ); locals[1] = 48; // "Very well, then. Goodbye!" locals[2] = 49; // "No! Wait! My need is great." 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_081d(); break; } // end switch } // end func void func_081d() { int locals[23]; say( "A pity, then, that thou art not more civil to thy betters. What will it take to get thee to leave me in peace?" ); locals[1] = 51; // "Canst tell me of the Talismans of Sir Cabirus?" locals[2] = 52; // "I seek some missing runestones." locals[3] = 53; // "Nothing. I'll not bother thee again." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0689(); break; case 2: func_03a5(); break; case 3: locals[23] = 2; func_00b1( &locals[23] ); break; } // end switch } // end func void func_0882() { int locals[22]; say( "Well? Hast thou news of my servant?" ); locals[1] = 55; // "Yes. Murgo lies above in the dungeons of the Lizardmen." locals[2] = 56; // "Nay. I have seen him not." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_08ca(); break; case 2: func_07cc(); break; } // end switch } // end func void func_08ca() { int locals[23]; global[1] = 1; say( "Thou canst find the Wine of Compassion in the checkerboard room to the east of the meeting hall of the Academy. Lift the southeastern floor tile and the Wine shall be revealed." ); locals[1] = 58; // "Thank thee, and farewell." locals[2] = 59; // "While I am here, dost thou know of any runestones I can find?" 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: func_03a5(); break; } // end switch } // end func void func_0920() { int locals[22]; say( "'Tis thee again. I note that Murgo has not been returned to me. Wert thou not going to find him in return for directions to the Wine of Compassion?" ); locals[1] = 61; // "Yes, I am still looking." locals[2] = 62; // "I shall endeavor to bring him back promptly." locals[3] = 63; // "Perhaps later." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_097c(); break; case 2: func_097c(); break; case 3: func_097c(); break; } // end switch } // end func void func_097c() { int locals[1]; say( "Obviously thou'rt not a great adventurer. A great adventurer would surely have succeeded in thy quest by now!" ); locals[1] = 1; func_00b1( &locals[1] ); } // end func void func_0992() { int locals[45]; locals[1] = !global[0]; say( "'Tis thee again. What dost thou want?" ); locals[23] = 1; locals[2] = 66; // "Nothing, I was just leaving." locals[24] = 1; locals[3] = 67; // "What art thou so busy with?" locals[25] = locals[1]; locals[4] = 68; // "I seek new runestones." locals[5] = 0; // "" locals[44] = babl_fmenu( 0, &locals[2], &locals[23] ); switch ( locals[44] ) { case 66: locals[45] = 2; func_00b1( &locals[45] ); break; case 67: func_05d7(); break; case 68: func_03a5(); break; } // end switch } // end func void func_0a1a() { say( "Ah, it is the one who hast freed my servant Murgo! Thou'rt more compassionate towards thy fellows than I might expect. Thy reward shall be fitting." ); func_08ca(); } // end func void func_0a27() { int locals[23]; say( "Greetings, @GS11. What dost thou want? I warn thee, I am quite busy." ); locals[1] = 71; // "I cannot seem to find the Wine of Compassion." locals[2] = 73; // "Canst thou direct me to more runestones?" locals[3] = 74; // "I'm sorry, I did not mean to bother thee." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: say( "It's quite simple." ); func_08ca(); break; case 2: func_03a5(); break; case 3: locals[23] = 2; func_00b1( &locals[23] ); break; } // end switch } // end func void func_0a8f() { func_0a27(); } // end func