Ultima Underworld/technical/conversations/187
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 #187 // string block 0x0ebb (3771), name Illomo // // 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[24]; if ( private[0] ) { if ( private[4] ) { func_0850(); } else { func_06a0(); } // end if } else { private[3] = 0; private[2] = 0; private[4] = 0; locals[1] = 9; locals[2] = 1; set_quest( 2, &locals[2], &locals[1] ); say( "Hello, adventurer. Hast thou seen my friend Gurstang?" ); locals[3] = 2; // "Yes." locals[4] = 3; // "No." locals[5] = 4; // "Who?" locals[6] = 0; // "" locals[24] = babl_menu( 0, &locals[3] ); switch ( locals[24] ) { case 1: func_0331(); break; case 2: func_05e5(); break; case 3: func_05fb(); } // end if break; } // end switch } // end func void func_0331() { int locals[22]; say( "I am glad to hear it! He must have told thee the code word he was searching for, then!" ); locals[1] = 6; // "I'm afraid not." locals[2] = 7; // "Indeed he did." locals[3] = 8; // "I may have been mistaken. Perhaps I did not meet this Gurstang." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_038d(); break; case 2: func_03a3(); break; case 3: func_05e5(); break; } // end switch } // end func void func_038d() { int locals[1]; say( "That seems quite unlikely. Perhaps thou mistook another mage for my friend Gurstang. If thou truly findest Gurstang, please let me know!" ); locals[1] = 1; func_00b1( &locals[1] ); } // end func void func_03a3() { int locals[23]; say( "Yes? And what was it?" ); locals[2] = 11; // "Other..." locals[3] = 12; // "I don't think I should tell thee." locals[4] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: func_0449(); break; case 2: func_03eb(); break; } // end switch } // end func void func_03eb() { int locals[22]; say( "I may be able to help thee if thou tellst me the word." ); locals[1] = 14; // "Well then, it was..." locals[2] = 15; // "Nay, I will not tell it to thee." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0449(); break; case 2: func_0433(); break; } // end switch } // end func void func_0433() { int locals[1]; say( "Hmm. I begin to think that perhaps thou hast not met Gurstang after all. I hope that thou wilt tell me the word he gives thee if thou dost see him." ); locals[1] = 1; func_00b1( &locals[1] ); } // end func void func_0449() { int locals[2]; locals[1] = babl_ask( 0 ); locals[2] = 17; if ( contains( 2, &locals[1], &locals[2] ) ) { func_04ec( &locals[1] ); } else { func_047a( &locals[1] ); } // end if } // end func void func_047a() { int locals[22]; say( "Hmm... @PS-2, thou sayest. No, that doesn't seem quite right. Art thou quite sure that was the word?" ); locals[1] = 19; // "Maybe not. Perhaps the word was..." locals[2] = 20; // "I thought it was." locals[3] = 21; // "I may be mistaken." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0449(); break; case 2: func_04d6(); break; case 3: func_04d6(); break; } // end switch } // end func void func_04d6() { int locals[1]; say( "I would suggest that thou dost find Gurstang again and make sure of the code word this time." ); locals[1] = 1; func_00b1( &locals[1] ); } // end func void func_04ec() { int locals[23]; private[3] = 1; say( "Hmm... Folanae, thou sayest...\p perhaps...\p Yes, that must be it! The puzzle is becoming clearer!" ); locals[1] = 24; // "What puzzle?" locals[2] = 25; // "That's great. Now, I must be going." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0542(); break; case 2: locals[23] = 2; func_00b1( &locals[23] ); break; } // end switch } // end func void func_0542() { int locals[22]; say( "Gurstang was searching for clues to the Key of Truth, a fabled object which has long been lost. Apparently, it is no longer in this world, so Gurstang and I looked for possible ways to bring it here from whatever world it is now in. The word that Gurstang found is an important clue." ); locals[1] = 27; // "What is its meaning?" locals[2] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); if ( locals[22] == 1 ) { func_0576(); } // end if } // end func void func_0576() { int locals[23]; private[2] = 1; say( "We were of the opinion that praying at a shrine might bring it back. I would guess that the library might contain information regarding which shrine must be used. I suspect that any tome mentioning Gurstang's word, "Folanae," would hold the final clue to regaining the key." ); locals[1] = 29; // "I will seek out this information." locals[2] = 31; // "Where is this library?" locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: say( "Good luck!" ); locals[23] = 3; func_00b1( &locals[23] ); break; case 2: func_05cf(); break; } // end switch } // end func void func_05cf() { int locals[1]; say( "It is located in the old Academy, in the northwest. Enter the Academy's main hall and head west; it should be on thy left. Good luck!" ); locals[1] = 3; func_00b1( &locals[1] ); } // end func void func_05e5() { int locals[1]; say( "That's too bad. I wonder what happened to him. I hope that he has not been killed, or worse!" ); locals[1] = 2; func_00b1( &locals[1] ); } // end func void func_05fb() { int locals[22]; say( "My friend Gurstang, a fellow Seer. He went downstairs a few months ago and I haven't seen him since." ); locals[1] = 35; // "Oh, that Gurstang! I just ran into him." locals[2] = 36; // "That's terrible! I haven't seen him." locals[3] = 37; // "What was he doing down there?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0331(); break; case 2: func_05e5(); break; case 3: func_0657(); break; } // end switch } // end func void func_0657() { int locals[22]; say( "He was on a search for the fabled Key of Truth. He must have fallen into the hands of Tyball, the wizard below." ); locals[1] = 39; // "I believe I have seen him." locals[2] = 40; // "I shall let thee know if I find him." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0331(); break; case 2: say( "Please do. I fear for his safety." ); break; } // end switch } // end func void func_06a0() { int locals[67]; if ( private[2] ) { say( "Hello, @GS8! Hast thou found the Key of Truth?" ); locals[1] = 43; // "Yes, I have found it." locals[2] = 44; // "Not yet." locals[3] = 45; // "Canst thou repeat what thou said earlier of it?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0793(); break; case 2: func_07ae(); break; case 3: func_07ff(); } // end if } else { break; } // end switch if ( private[3] ) { say( "Hello, @GS8! Art thou not interested to learn the significance of the word Gurstang gave thee?" ); locals[23] = 47; // "Yes, please tell me." locals[24] = 48; // "Not particularly." locals[25] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); switch ( locals[44] ) { case 1: func_0542(); break; case 2: locals[45] = 2; func_00b1( &locals[45] ); } // end if } else { break; } // end switch say( "Hello, @GS8! Hast thou found my friend Gurstang?" ); locals[46] = 50; // "Yes, I have discovered him." locals[47] = 51; // "I'm afraid not." locals[48] = 0; // "" locals[67] = babl_menu( 0, &locals[46] ); switch ( locals[67] ) { case 1: func_0331(); break; case 2: func_05e5(); break; } // end switch } // end func void func_0793() { int locals[1]; private[4] = 1; say( "I knew it could be found! I hope that the Key aids thee in thy quest." ); locals[1] = 3; func_00b1( &locals[1] ); } // end func void func_07ae() { int locals[23]; say( "I wish thee luck and speed in finding it." ); locals[1] = 54; // "Thank thee, I will continue on my quest to find it." locals[2] = 55; // "How didst thou say it could be found?" 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_07ff(); break; } // end switch } // end func void func_07ff() { int locals[23]; say( "I think that praying at a shrine must have something to do with it. I would look in the library for a book that contains "Folanae," the word that Gurstang discovered, for a clue." ); locals[1] = 57; // "I will look there. Thank thee!" locals[2] = 58; // "Where is this library again?" 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_05cf(); break; } // end switch } // end func void func_0850() { int locals[1]; say( "Congratulations on finding the Key of Truth! I hope that it will prove an aid to thee." ); locals[1] = 3; func_00b1( &locals[1] ); } // end func void func_0866() { int locals[44]; setup_to_barter( 0 ); while ( !private[1] ) { locals[1] = 60; // "I make thee this offer." locals[2] = 61; // "I demand thou givest me these items." locals[3] = 62; // "Excuse me, I must think about this deal." locals[4] = 63; // "I do not wish to barter any further." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0917(); break; case 2: func_0971(); break; case 3: do_judgement( 0 ); break; case 4: do_decline( 0 ); private[1] = 1; break; } // end switch } // while locals[23] = 64; // "Farewell." locals[24] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); if ( locals[44] == 1 ) { private[1] = 1; } // end if } // end func void func_0917() { int locals[15]; locals[0] = -1; locals[6] = -1; locals[11] = 65; // "I accept thy offer." locals[12] = 66; // "No, I do not like this deal." locals[13] = 67; // "Dost thou take me for a fool?" locals[14] = 68; // "I am weary of this haggling." locals[15] = 69; // "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_0971() { int locals[24]; say( "Dost thou intend to rob me?" ); locals[1] = 71; // "Yes, I must." locals[2] = 72; // "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] = 73; // "If thou dost insist, thou canst have them." locals[24] = 74; // "No! Thou shalt not take them!" if ( do_demand( 2, &locals[24], &locals[23] ) ) { private[1] = 1; } else { func_008b(); } // end if } // end func