Ultima Underworld/technical/conversations/64

From Ultima Codex
Jump to navigation Jump to search

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 #64 // string block 0x0e40 (3648), name Jaacar // // 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[183]; if ( private[0] ) { } else { say( "Hey! Who this? What you do?" ); locals[1] = 2; // "I am a friend of all Goblins." locals[2] = 3; // "I have come to admire the architectural splendor of thy people's settlement." locals[3] = 4; // "I am simply exploring." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: goto label_02fd; break; case 2: goto label_038b; break; case 3: goto label_038b; break; } // end switch label_02fd:; say( "Ha! Not Green Goblin-friend I hope!" ); locals[23] = 6; // "Of course not. I did not mean to include them." locals[24] = 7; // "Certainly. They are as deserving of my friendship as any." locals[25] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); switch ( locals[44] ) { case 1: goto label_034b; break; case 2: goto label_033d; break; } // end switch label_033d:; say( "So then! Maybe you better off with them!" ); locals[45] = 1; func_00b1( &locals[45] ); label_034b:; say( "Yes yes, a foul race they are. Jump into their privies on purpose, I bet, harhar!" ); locals[46] = 10; // "Yes, I suppose they do." locals[47] = 11; // "Why would anyone do that?" locals[48] = 0; // "" locals[67] = babl_menu( 0, &locals[46] ); switch ( locals[67] ) { case 1: goto label_03cb; break; case 2: goto label_03cb; break; } // end switch label_038b:; label_038b:; say( "What you say? You like to explore, walk around? Don't explore too careful, could end up someplace you not want to be. I seen that happen, heehee!" ); locals[68] = 13; // "Is this area dangerous, then?" locals[69] = 14; // "What dost thou mean?" locals[70] = 0; // "" locals[89] = babl_menu( 0, &locals[68] ); switch ( locals[89] ) { case 1: goto label_03cb; break; case 2: goto label_03cb; break; } // end switch label_03cb:; label_03cb:; label_03cb:; label_03cb:; say( "Us Grays, we never do it on purpose -- haha -- but in night, I hear sometimes scream and then splash, sometimes splash and then scream. Then in morning one of us not here. Dangerous privy it is there. I watch out if I you. Heehee." ); locals[90] = 16; // "Well, I will be careful." locals[91] = 17; // "And they are never heard from again?" locals[92] = 0; // "" locals[111] = babl_menu( 0, &locals[90] ); switch ( locals[111] ) { case 1: goto label_040b; break; case 2: goto label_045d; break; } // end switch label_040b:; say( "Yes, that good idea. Don't look out, and Splash! Aiiieeee! Gone gone gone. Hee hee. Yes, you be careful. If any still alive from splash, I bet they not be too happy. You be on your toes." ); locals[112] = 19; // "Thank you, I will be." locals[113] = 20; // "Don't worry about me." locals[114] = 0; // "" locals[133] = babl_menu( 0, &locals[112] ); switch ( locals[133] ) { case 1: locals[134] = 2; func_00b1( &locals[134] ); break; case 2: locals[135] = 2; func_00b1( &locals[135] ); break; } // end switch label_045d:; say( "That right. Heehee. Splash! Aiiieeee! Gone gone gone. Hee hee. You be careful, you. If any still alive from splash, I bet they not be too happy. You be on your toes." ); locals[136] = 22; // "Thank you, I will be." locals[137] = 23; // "Don't worry about me." locals[138] = 0; // "" locals[157] = babl_menu( 0, &locals[136] ); switch ( locals[157] ) { case 1: locals[158] = 2; func_00b1( &locals[158] ); break; case 2: locals[159] = 2; func_00b1( &locals[159] ); } // end if break; } // end switch say( "Hey, you still here! Being careful, yes? No splash?" ); locals[160] = 25; // "Yes, I am following thy advice." locals[161] = 26; // "Yes, I have no trouble watching where I'm going." locals[162] = 0; // "" locals[181] = babl_menu( 0, &locals[160] ); switch ( locals[181] ) { case 1: locals[182] = 2; func_00b1( &locals[182] ); break; case 2: locals[183] = 2; func_00b1( &locals[183] ); break; } // end switch } // end func