Ultima Underworld/technical/conversations/162
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 #162 // string block 0x0ea2 (3746), name Kneenibble // // 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[321]; if ( private[0] ) { if ( private[2] ) { } else { if ( private[3] ) { } // end if } else { private[2] = 0; private[3] = 0; private[4] = 0; goto label_02ca; label_02ca:; label_02ca:; if ( (private[4] || private[0]) ) { say( "So what you do here again?" ); } else { say( "Hey, human. What you do here, far from home?" ); } // end if locals[3] = 3; // "I am travelling the depths of the Abyss." locals[4] = 4; // "I could ask thee the same question." locals[5] = 5; // "None of thy business!" locals[6] = 0; // "" locals[24] = babl_menu( 0, &locals[3] ); switch ( locals[24] ) { case 1: goto label_032c; break; case 2: goto label_051a; break; case 3: goto label_059a; break; } // end switch label_032c:; say( "Should no bother exploring Abyss. Not much to see now - just people try to survive. Used to be lot going on, before collapse." ); locals[25] = 7; // "What went on here before the collapse?" locals[26] = 8; // "What didst thou do before the collapse?" locals[27] = 0; // "" locals[46] = babl_menu( 0, &locals[25] ); switch ( locals[46] ) { case 1: goto label_036c; break; case 2: goto label_03ac; break; } // end switch label_036c:; say( "No one lived here, but they come to state chamber, tombs, and mines. Diplomats and visitors use state chamber for talks, funerals here, too. Important people buried in tombs. Me used to work in mines." ); locals[47] = 10; // "What was thy job?" locals[48] = 11; // "Where are the mines?" locals[49] = 0; // "" locals[68] = babl_menu( 0, &locals[47] ); switch ( locals[68] ) { case 1: goto label_03ac; break; case 2: goto label_03ec; break; } // end switch label_03ac:; label_03ac:; label_03ac:; label_03ac:; say( "Me have important job before collapse. Me operator of mine dispatch chamber. Only one who know combination for dispatch unit." ); locals[69] = 13; // "What didst thou do as operator?" locals[70] = 14; // "What does the combination do?" locals[71] = 0; // "" locals[90] = babl_menu( 0, &locals[69] ); switch ( locals[90] ) { case 1: goto label_042c; break; case 2: goto label_046c; break; } // end switch label_03ec:; label_03ec:; say( "Mines in southwest. But only way get to them is through mine dispatch chamber." ); locals[91] = 16; // "What is the mine dispatch chamber?" locals[92] = 17; // "How does one use this chamber?" locals[93] = 0; // "" locals[112] = babl_menu( 0, &locals[91] ); switch ( locals[112] ) { case 1: goto label_042c; break; case 2: goto label_046c; break; } // end switch label_042c:; label_042c:; say( "Mine dispatch chamber room where miners go be sent to work in mines. Me send miners to work by sending them to teleport room. Get put in part of mine from there." ); locals[113] = 19; // "How does the chamber operate?" locals[114] = 20; // "Canst thou help me use the chamber?" locals[115] = 0; // "" locals[134] = babl_menu( 0, &locals[113] ); switch ( locals[134] ) { case 1: goto label_046c; break; case 2: goto label_046c; break; } // end switch label_046c:; label_046c:; label_046c:; label_046c:; say( "Need combination to use chamber. Why would me give you combination to chamber?" ); locals[135] = 22; // "Because I asked thee." locals[136] = 23; // "What dost thou want?" locals[137] = 0; // "" locals[156] = babl_menu( 0, &locals[135] ); switch ( locals[156] ) { case 1: goto label_06dd; break; case 2: goto label_04ac; break; } // end switch label_04ac:; private[3] = 1; say( "Me want fish. Bring me ten fish, me tell you combination." ); locals[157] = 25; // "I happen to have some fish here." locals[158] = 26; // "I shall return with fish. Farewell." locals[159] = 27; // "Never mind. Farewell." locals[160] = 0; // "" locals[178] = babl_menu( 0, &locals[157] ); switch ( locals[178] ) { case 1: goto label_05fd; break; case 2: locals[179] = 2; func_00b1( &locals[179] ); break; case 3: say( "No fish, no combination." ); locals[180] = 2; func_00b1( &locals[180] ); break; } // end switch label_051a:; say( "Me live here with rest of Ghouls because me no can work any more. Me work before great collapse." ); locals[181] = 30; // "What was thy job before the collapse?" locals[182] = 31; // "Why canst thou no longer work?" locals[183] = 0; // "" locals[202] = babl_menu( 0, &locals[181] ); switch ( locals[202] ) { case 1: goto label_03ac; break; case 2: goto label_055a; break; } // end switch label_055a:; say( "Me used to work in mines. After collapse, mines no running, so me out of job." ); locals[203] = 33; // "What was thy job?" locals[204] = 34; // "Where are the mines?" locals[205] = 0; // "" locals[224] = babl_menu( 0, &locals[203] ); switch ( locals[224] ) { case 1: goto label_03ac; break; case 2: goto label_03ec; break; } // end switch label_059a:; if ( private[4] ) { say( "Never mind! Me no talk to you!" ); locals[225] = 1; func_00b1( &locals[225] ); } else { say( "You sore human! Me no talk to you neither!" ); } // end if private[4] = 1; locals[226] = 37; // "Oh, sorry. I didn't mean it." locals[227] = 38; // "Then good-bye!" locals[228] = 0; // "" locals[247] = babl_menu( 0, &locals[226] ); switch ( locals[247] ) { case 1: goto label_02ca; break; case 2: locals[248] = 1; func_00b1( &locals[248] ); } // end if break; } // end switch label_05fd:; label_05fd:; say( "You got fish for me?" ); } // end if } // end if locals[249] = 40; // "Yes. Here thou art." locals[250] = 41; // "No, I do not." locals[251] = 0; // "" locals[270] = babl_menu( 0, &locals[249] ); switch ( locals[270] ) { case 1: break; case 2: say( "Come back with fish!" ); locals[271] = 2; func_00b1( &locals[271] ); break; } // end switch locals[272] = 182; find_barter_total( 4, 37, 38, 36, &locals[272] ); if ( private[6] == 0 ) { say( "Me no see any fish there! You got fish?" ); } else { if ( private[6] < 10 ) { say( "Me only see @GI37 fish! You got ten?" ); } else { give_to_npc( 2, 38, 36 ); private[2] = 1; say( "Thanks. People scarce recently, fish good substitute." ); say( "There three dials on wall, each goes from zero to seven. Zero straight up, increases clockwise. Set dials to 7-2-6 from left to right. Then pull lever. Gate to teleport room then open. Walk in there, teleport to mine." ); locals[273] = 47; // "I thank thee kindly. Farewell." locals[274] = 48; // "Goodbye." locals[275] = 0; // "" locals[294] = babl_menu( 0, &locals[273] ); switch ( locals[294] ) { case 1: locals[295] = 3; func_00b1( &locals[295] ); break; case 2: locals[296] = 3; func_00b1( &locals[296] ); break; } // end switch label_06dd:; say( "No way. Me no give you combination for free. Me want fish. Give me ten fish and me give you combination." ); locals[297] = 50; // "Very well, I have some fish." locals[298] = 51; // "I shall return with fish." locals[299] = 52; // "Fine. Farewell." locals[300] = 0; // "" locals[318] = babl_menu( 0, &locals[297] ); switch ( locals[318] ) { case 1: goto label_05fd; break; case 2: locals[319] = 2; func_00b1( &locals[319] ); break; case 3: locals[320] = 2; func_00b1( &locals[320] ); } // end if break; } // end switch say( "Thanks for fish again. Sorry, but me have to go. So long." ); locals[321] = 3; func_00b1( &locals[321] ); } // end func