Ultima Underworld/technical/conversations/10
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 #10 // string block 0x0e0a (3594), name Lanugo // // 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[22]; if ( private[0] == 1 ) { func_0562(); } else { private[2] = 0; say( "Tha be not bodderin' da boss, aye?" ); locals[1] = 2; // "No." locals[2] = 3; // "Yes." locals[3] = 4; // "Why dost thou not ask him thyself?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_030a(); break; case 2: func_035e(); break; case 3: func_03aa(); } // end if break; } // end switch } // end func void func_030a() { int locals[23]; say( "Good. It be not healty ta bodder a guy like da boss." ); locals[1] = 6; // "Well, I'll just be going." locals[2] = 8; // "Perhaps thou couldst ask thy boss if he could see me?" locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: say( "Dat's okay den. Hey, I better tend to my stew. You come back if you want some." ); locals[23] = 2; func_00b1( &locals[23] ); break; case 2: func_03aa(); break; } // end switch } // end func void func_035e() { int locals[7]; locals[1] = sex( 2, &locals[4], &locals[3] ); locals[3] = 9; locals[4] = 10; locals[2] = sex( 2, &locals[6], &locals[5] ); locals[5] = 11; locals[6] = 12; say( "Oh, a smart one, eh? One a' dem Sages. Thinks @SS1 too smart for me, eh? Maybe too smart for @SS2, more like. Fine - I'm busy making dinner. This stew takes work, you know." ); locals[7] = 1; func_00b1( &locals[7] ); } // end func void func_03aa() { int locals[22]; say( "Yeah, well, I could do dat. But da boss don' like to be boddered wid, like, practical stuff. His mind is on, uh higher tings." ); locals[1] = 15; // "Thy advice is well taken." locals[2] = 16; // "Perhaps I could give thee a small gift to show my appreciation." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_051a(); break; case 2: func_03f2(); break; } // end switch } // end func void func_03f2() { int locals[62]; locals[16] = show_inv( 2, &locals[6], &locals[1] ); locals[18] = 0; while ( locals[16] > 0 ) { locals[17] = 1; if ( locals[17] <= locals[16] ) { if ( (locals[0] == 160 || locals[0] == 161) ) { locals[18] = locals[18] + 1; locals[10] = locals[5]; } // end if locals[17] = locals[17] + 1; } // while } // end if if ( locals[18] > 0 ) { give_to_npc( 2, &locals[11], &locals[18] ); private[2] = 0; say( "Tanks! Th'art right enough, fer a yuman. Tell tha what -- if tha talks to da boss, be real, like complimennary. He likes dat." ); locals[19] = 18; // "I'll take that under advisement." locals[20] = 19; // "I thank thee kindly." locals[21] = 0; // "" locals[40] = babl_menu( 0, &locals[19] ); switch ( locals[40] ) { case 1: func_051a(); break; case 2: func_051a(); } // end if } else { break; } // end switch if ( locals[16] == 0 ) { say( "I don' see no gift!" ); } else { say( "Dontcha have any gold or something?" ); } // end if locals[41] = 22; // "Ah, here is a gift for thee." locals[42] = 23; // "I'm afraid that thou didst misunderstood me." locals[43] = 0; // "" locals[62] = babl_menu( 0, &locals[41] ); switch ( locals[62] ) { case 1: func_03f2(); break; case 2: func_0504(); break; } // end switch } // end func void func_0504() { int locals[1]; say( "Y'got plenny t'learn in da ways of courtly manners, I'd say. Okay by me - I got my stew to tend to." ); locals[1] = 1; func_00b1( &locals[1] ); } // end func void func_051a() { int locals[22]; say( "Sure ting. Hey, gotta go. Time fer me ta start dinner. Y'wanna stay? S'worm stew, tonight. Me speciality." ); locals[1] = 26; // "Worm stew?" locals[2] = 27; // "Uh.... no, thank thee most kindly." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_05c6(); break; case 2: func_00e0(); break; } // end switch } // end func void func_0562() { int locals[22]; if ( private[2] ) { say( "Oh, this guy again. What it be now?" ); } // end if say( "Come back for me stew, have tha? Smell brought tha? Don't blame tha, 'tis a good stew." ); locals[1] = 30; // "What kind of stew?" locals[2] = 31; // "Ah, no thank thee." locals[3] = 32; // "I'd rather that thou obtain an audience with thy lord for me." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_05c6(); break; case 2: func_00e0(); break; case 3: func_03aa(); break; } // end switch } // end func void func_05c6() { int locals[25]; say( "Aye, me modder used ta make it. Tha takes a rotworm, chops it up fine, and marinates it in port wiv mushrooms." ); locals[1] = take_from_npc( 1, &locals[2] ); locals[2] = 1019; locals[3] = locals[1]; if ( 2 == locals[3] ) { say( "I'll leave this recipe on the floor for tha." ); } else { if ( 1 == locals[3] ) { say( "Here. 'Tis all writ down on this." ); } else { if ( 0 == locals[3] ) { say( "Tha knowest, just like the recipe I gave tha." ); } // end if } // end if } // end if locals[4] = 37; // "I thank thee kindly." locals[5] = 38; // "I must leave now." locals[6] = 0; // "" locals[25] = babl_menu( 0, &locals[4] ); switch ( locals[25] ) { case 1: func_00e0(); break; case 2: func_00c2(); break; } // end switch } // end func void func_064e() { int locals[44]; setup_to_barter( 0 ); while ( !private[1] ) { locals[1] = 39; // "I make thee this offer." locals[2] = 40; // "I demand thou givest me these items." locals[3] = 41; // "Excuse me, I must think about this deal." locals[4] = 42; // "I do not wish to barter any further." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_06ff(); break; case 2: func_0759(); break; case 3: do_judgement( 0 ); break; case 4: do_decline( 0 ); private[1] = 1; break; } // end switch } // while locals[23] = 43; // "Farewell." locals[24] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); if ( locals[44] == 1 ) { private[1] = 1; } // end if } // end func void func_06ff() { int locals[15]; locals[0] = -1; locals[6] = -1; locals[11] = 44; // "I accept thy offer." locals[12] = 45; // "No, I do not like this deal." locals[13] = 46; // "Dost thou take me for a fool?" locals[14] = 47; // "I am weary of this haggling." locals[15] = 48; // "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_0759() { int locals[24]; say( "Dost thou intend to rob me?" ); locals[1] = 50; // "Yes, I must." locals[2] = 51; // "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] = 52; // "If thou dost insist, thou canst have them." locals[24] = 53; // "No! Thou shalt not take them!" if ( do_demand( 2, &locals[24], &locals[23] ) ) { private[1] = 1; } else { func_008b(); } // end if } // end func