Ultima Underworld/technical/conversations/281
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 #281 // string block 0x0f19 (3865), critter #25, gray lizardman // // 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[65]; if ( !private[0] ) { private[2] = 1; } // end if if ( npc_attitude != 3 ) { say( "Stranger, greetings." ); } else { say( "Friend, greetings!" ); } // end if locals[22] = 1; locals[1] = 3; // "Bica." locals[23] = 1; locals[2] = 4; // "Greetings, Lizardman." locals[24] = private[2]; locals[3] = 5; // "Thou dost speak my language!" locals[25] = 1; locals[4] = 6; // "I'm sorry, I must be going." locals[5] = 0; // "" locals[43] = babl_fmenu( 0, &locals[1], &locals[22] ); switch ( locals[43] ) { case 3: func_055e(); break; case 4: break; case 5: func_0436(); break; case 6: func_00b1( 21 ); break; } // end switch say( "How can you me help?" ); locals[44] = 8; // "Who is thy leader?" locals[45] = 9; // "Dost thou wish to trade?" locals[46] = 10; // "Other...." locals[47] = 0; // "" locals[65] = babl_menu( 0, &locals[44] ); switch ( locals[65] ) { case 1: func_0446(); break; case 2: func_054f(); break; case 3: func_039e(); break; } // end switch } // end func void func_039e() { int locals[27]; locals[1] = babl_ask( 0 ); locals[2] = 11; if ( contains( 2, &locals[1], &locals[2] ) ) { func_0491(); } // end if locals[3] = 12; if ( contains( 2, &locals[1], &locals[3] ) ) { func_04f0(); } // end if locals[4] = 13; if ( contains( 2, &locals[1], &locals[4] ) ) { func_054f(); } // end if locals[5] = 14; if ( contains( 2, &locals[1], &locals[5] ) ) { func_054f(); } // end if say( "Sorry. You cannot I help." ); locals[6] = 16; // "Goodbye." locals[7] = 0; // "" locals[27] = babl_menu( 0, &locals[6] ); if ( locals[27] == 1 ) { } // end if func_00b1( 21 ); } // end func void func_0436() { say( "Yes. Very well not though." ); private[2] = 0; } // end func void func_0446() { int locals[22]; say( "Of Iss'leek you seek. Look in east of our dwellings." ); locals[1] = 19; // "Thank thee. I must leave now." locals[2] = 20; // "Wait. What about..." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_00b1( 21 ); break; case 2: func_039e(); break; } // end switch } // end func void func_0491() { int locals[22]; say( "Of this I little know. However, our leader has more knowing on this." ); locals[1] = 22; // "Thank thee. I must go now." locals[2] = 23; // "Thy leader? Who is that?" locals[3] = 24; // "Other..." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_00b1( 21 ); break; case 2: func_0446(); break; case 3: func_039e(); break; } // end switch } // end func void func_04f0() { int locals[22]; say( "The green ones keep him, I believe. Ask there." ); locals[1] = 26; // "Oh! Thank thee! Goodbye." locals[2] = 27; // "Thank thee! Dost thou wish to trade?" locals[3] = 28; // "Other..." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_00b1( 21 ); break; case 2: func_054f(); break; case 3: func_039e(); break; } // end switch } // end func void func_054f() { func_05b2(); func_00b1( 21 ); } // end func void func_055e() { int locals[23]; npc_attitude = 3; say( "You speak Lizardman tongue. Very good. Many Lizardmans will be your friends then!" ); locals[1] = 30; // "Thank thee. I try my best." locals[2] = 31; // "Thank thee. I must go now." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: locals[23] = 3; func_00b1( &locals[23] ); break; } // end switch } // end func void func_05b2() { int locals[22]; if ( !func_0020() ) { } else { say( "Sel'a?" ); locals[1] = 33; // "Yes." locals[2] = 34; // "No." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0602(); break; case 2: return; } // end if break; } // end switch } // end func void func_0602() { int locals[44]; setup_to_barter( 0 ); while ( !private[1] ) { locals[1] = 35; // "I make thee this offer." locals[2] = 36; // "I demand that thou givest me these items." locals[3] = 37; // "I must think about this offer." locals[4] = 38; // "I do not wish to barter any further." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_06b3(); break; case 2: func_06f5(); break; case 3: do_judgement( 0 ); break; case 4: do_decline( 0 ); private[1] = 1; break; } // end switch } // while locals[23] = 39; // "Farewell." locals[24] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); if ( locals[44] == 1 ) { private[1] = 1; } // end if } // end func void func_06b3() { int locals[5]; locals[1] = 40; // "Sseth." locals[2] = 41; // "'Click." locals[3] = 42; // "Sorr." locals[4] = 43; // "'Click, 'click. Bica." locals[5] = 44; // "Tosa ssil?" if ( do_offer( 5, &locals[5], &locals[4], &locals[3], &locals[2], &locals[1] ) ) { private[1] = 1; } // end if } // end func void func_06f5() { int locals[24]; say( "sorr?" ); locals[1] = 46; // "Yes." locals[2] = 47; // "No." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: return; break; } // end switch locals[23] = 48; // "Sseth, sorr." locals[24] = 49; // "'DCclick yethe!" if ( do_demand( 2, &locals[24], &locals[23] ) ) { private[1] = 1; } else { func_008b(); } // end if } // end func