Ultima Underworld/technical/conversations/147
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 #147 // string block 0x0e93 (3731), name Kyle // // 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]; private[3] = get_quest( 1, &locals[1] ); locals[1] = 32; locals[2] = private[3]; if ( 0 == locals[2] ) { if ( private[0] == 1 ) { func_03d2(); } else { func_0362(); } // end if } else { if ( 1 == locals[2] ) { func_0306(); } else { if ( 2 == locals[2] ) { func_054e(); } else { if ( 3 == locals[2] ) { func_0687(); } else { if ( 4 == locals[2] ) { func_04c3(); } // end if } // end if } // end if } // end if } // end if } // end func void func_0306() { int locals[22]; if ( (npc_whoami == 146 || npc_whoami == 147) ) { say( "If thou wishest to become a Knight, thou shouldst go to the south of our domain and talk to Dorna, our leader. Trust him during thy initiation, and all should be fine. Join our order and help us in our quest for honor." ); } else { say( "If thou wishest to become a Knight, thou shouldst talk to Dorna, our leader. He resides in this room. Trust him during thy initiation and all should be fine. Join our order and help us in our quest for honor." ); } // end if locals[1] = 3; // "I shall seek him out. Farewell." locals[2] = 4; // "Thank thee, and goodbye." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_00e0(); break; case 2: func_00e0(); break; } // end switch } // end func void func_0362() { int locals[22]; say( "Hail, stranger. Be thou a warrior?" ); locals[1] = 6; // "Aye." locals[2] = 7; // "Nay. My skills are of another sort." locals[3] = 8; // "Sometimes. When I needs must be." locals[4] = 9; // "Why dost thou ask?" locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_073f(); break; case 2: func_07af(); break; case 3: func_07f7(); break; case 4: func_08cc(); break; } // end switch } // end func void func_03d2() { int locals[46]; say( "Thou hast returned. How may I help thee?" ); if ( private[2] ) { } else { locals[1] = 11; // "I wish to become a Knight of the Crux Ansata." locals[2] = 12; // "Where can I find thy leader?" locals[3] = 13; // "Excuse me, I did not mean to intrude upon thee." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_073f(); break; case 2: func_04a2(); break; case 3: func_00e0(); } // end if break; } // end switch locals[23] = 14; // "Excuse me, I did not mean to intrude upon thee." locals[24] = 15; // "I have reconsidered, and now wish to become a Knight." locals[25] = 16; // "Where can I find thy leader?" locals[26] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); switch ( locals[44] ) { case 1: func_00e0(); break; case 2: break; case 3: func_04a2(); break; } // end switch locals[45] = 32; locals[46] = 1; set_quest( 2, &locals[46], &locals[45] ); private[2] = 1; func_0306(); } // end func void func_04a2() { if ( (npc_whoami == 146 || npc_whoami == 147) ) { say( "Dorna Ironfist can be found in the south area of our domain." ); } else { say( "Thou art in luck! Dorna Ironfist resides in this very room." ); } // end if func_00e0(); } // end func void func_04c3() { int locals[25]; locals[1] = sex( 2, &locals[3], &locals[2] ); locals[2] = 19; locals[3] = 20; say( "Hail, @SS1 @GS8. Thy many accomplishments have surely proven thee to be a true Knight of the Order of the Crux Ansata." ); locals[4] = 22; // "I was spurred on in my quests by thy shining example." locals[5] = 23; // "Canst thou help me in my continuing quest for virtue?" locals[6] = 24; // "Wouldst thou care to exchange items?" locals[7] = 0; // "" locals[25] = babl_menu( 0, &locals[4] ); switch ( locals[25] ) { case 1: func_00e0(); break; case 2: func_05aa(); break; case 3: func_053c(); break; } // end switch func_00e0(); } // end func void func_053c() { say( "Certainly." ); func_0928(); say( "Farewell, @GS8." ); func_00e0(); } // end func void func_054e() { int locals[22]; say( "Welcome, Squire @GS8. I am pleased to see that thou art striving to become one of us. How can I help thee?" ); locals[1] = 28; // "Hast thou any knowledge that would aid me in my journey towards Knighthood?" locals[2] = 29; // "Thy kind words are help enough." locals[3] = 30; // "Hast thou any information about the writ of Lorne?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_05aa(); break; case 2: func_00e0(); break; case 3: func_063c(); break; } // end switch } // end func void func_05aa() { int locals[23]; if ( private[4] ) { say( "I believe I have already given thee this information, but I would be happy to repeat it." ); } else { say( "As a fellow Knight, I would be happy to help thee." ); } // end if locals[1] = npc_whoami; if ( 146 == locals[1] ) { say( "Use the mantra AMO to increase thy swordfighting ability." ); } else { if ( 147 == locals[1] ) { say( "The mantra GAR will allow thee to wield an axe with greater skill." ); } else { if ( 148 == locals[1] ) { say( "If thou dost use blunt weapons, the mantra KOH will be of use." ); } else { if ( 149 == locals[1] ) { say( "Chanting the mantra FAHM will make thy arrows fly true." ); } // end if } // end if } // end if } // end if private[4] = 1; locals[2] = 37; // "I thank thee for thy help." locals[3] = 38; // "I will try this mantra at the earliest opportunity." locals[4] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: func_00e0(); break; case 2: func_00e0(); break; } // end switch } // end func void func_063c() { int locals[22]; say( "I hear that it lies in the area of the Trolls." ); locals[1] = 40; // "Thank thee. I will seek it there." locals[2] = 41; // "I have looked everywhere, but have not found it." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_00e0(); break; case 2: break; } // end switch say( "If 'twere easy to find, 'twould not be a proper quest for a Knight." ); func_00e0(); } // end func void func_0687() { int locals[22]; say( "It is a pleasure to see thee again, Knight @GS8. How goes thy quest?" ); locals[1] = 44; // "I could use some help with my fighting skill." locals[2] = 45; // "It proceeds. Now I must continue on it." locals[3] = 46; // "Canst thou help me to find the plate?" locals[4] = 47; // "Wouldst thou care to barter?" locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_05aa(); break; case 2: func_00e0(); break; case 3: func_06f7(); break; case 4: func_053c(); break; } // end switch } // end func void func_06f7() { int locals[22]; say( "It is said that Rodrick, the dreaded Chaos Knight, holds a key thou needst. Behind him lies a maze with many secret places." ); locals[1] = 49; // "I will take thy advice under consideration. Farewell." locals[2] = 50; // "Thank thee for thy help." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_00e0(); break; case 2: func_00e0(); break; } // end switch } // end func void func_073f() { int locals[22]; say( "Indeed! And why dost thou fight?" ); locals[1] = 52; // "I take joy in spilling my opponents' blood." locals[2] = 53; // "Evil must be fought wherever it is found." locals[3] = 54; // "I must defend my honor at all costs." locals[4] = 55; // "I fight only to uphold the principles of Virtue." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_085b(); break; case 2: func_07f7(); break; case 3: func_085b(); break; case 4: func_07f7(); break; } // end switch } // end func void func_07af() { int locals[22]; say( "Thou art not suited to the Order of the Knights of the Crux Ansata, then." ); locals[1] = 57; // "Thou art probably right. Farewell." locals[2] = 58; // "My fighting skill is not so bad as that." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_00e0(); break; case 2: func_073f(); break; } // end switch } // end func void func_07f7() { int locals[24]; private[2] = 1; say( "Assuredly thou art a kindred spirit. An' thou prove valorous, I shall bid thee join my order." ); locals[1] = 60; // "Thank thee, I accept." locals[2] = 61; // "No thank thee, fair knight." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: func_0868(); break; } // end switch locals[23] = 32; locals[24] = 1; set_quest( 2, &locals[24], &locals[23] ); func_0306(); } // end func void func_085b() { say( "We do not seem to share the same principles. Farewell." ); func_00e0(); } // end func void func_0868() { int locals[24]; say( "It is too bad, for thou dost seem well suited to our order. Please reconsider, and if thou dost decide thou wishest to join, return and speak with me." ); locals[1] = 64; // "Yes, I do wish to become a knight." locals[2] = 65; // "Farewell then." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: func_00e0(); break; } // end switch locals[23] = 32; locals[24] = 1; set_quest( 2, &locals[24], &locals[23] ); private[2] = 1; func_0306(); } // end func void func_08cc() { int locals[22]; say( "In sooth, a warrior's valor be the noblest expression of Virtue." ); locals[1] = 67; // "I am such a warrior." locals[2] = 68; // "I try to avoid combat when I can." locals[3] = 69; // "I fight when I must." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_073f(); break; case 2: func_07af(); break; case 3: func_07f7(); break; } // end switch } // end func void func_0928() { int locals[44]; setup_to_barter( 0 ); while ( !private[1] ) { locals[1] = 70; // "I make thee this offer." locals[2] = 71; // "I demand thou givest me these items." locals[3] = 72; // "Excuse me, I must think about this deal." locals[4] = 73; // "I do not wish to barter any further." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_09d9(); break; case 2: func_0a33(); break; case 3: do_judgement( 0 ); break; case 4: do_decline( 0 ); private[1] = 1; break; } // end switch } // while locals[23] = 74; // "Farewell." locals[24] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); if ( locals[44] == 1 ) { private[1] = 1; } // end if } // end func void func_09d9() { int locals[15]; locals[0] = -1; locals[6] = -1; locals[11] = 75; // "I accept thy offer." locals[12] = 76; // "No, I do not like this deal." locals[13] = 77; // "Dost thou take me for a fool?" locals[14] = 78; // "I am weary of this haggling." locals[15] = 79; // "Surely thou art joking." if ( do_offer( 7, &locals[15], &locals[14], &locals[13], &locals[12], &locals[11], &locals[6], &locals[1] ) ) { private[1] = 1; } // end if } // end func void func_0a33() { int locals[24]; say( "Dost thou intend to rob me?" ); locals[1] = 81; // "Yes, I must." locals[2] = 82; // "No, thou dost misunderstand me." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: return; break; } // end switch locals[23] = 83; // "If thou dost insist, thou canst have them." locals[24] = 84; // "No! Thou shalt not take them!" if ( do_demand( 2, &locals[24], &locals[23] ) ) { private[1] = 1; } else { func_008b(); } // end if } // end func