Ultima Underworld/technical/conversations/314

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 #314 // string block 0x0f3a (3898), critter #58, wisp // // 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[110]; if ( private[0] ) { } else { say( "A human it is. We have been watching you. A fine race you are, but somewhat unknowledgable. To divide all your intelligence amongst yourselves as you do - it does not seem correct. And your bodies must be so hard to maintain. Still, we are impressed that you do as well as you do." ); locals[1] = 2; // "Do you not miss having bodies?" locals[2] = 3; // "Is it not equally difficult to consist only of globes of light?" locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: goto label_02e9; break; case 2: goto label_02e9; break; } // end switch label_02e9:; label_02e9:; say( "Surely it is not so. Having no bodies to hamper us, we have no worries or cares. We can devote our whole being to our sole quest - the gathering of information." ); locals[23] = 5; // "And what information have you gathered?" locals[24] = 6; // "I must know very little compared to you." locals[25] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); switch ( locals[44] ) { case 1: goto label_0329; break; case 2: goto label_0329; break; } // end switch label_0329:; label_0329:; say( "Indeed, most of the things we know are on such a high plane that it is doubtful a human would be able to understand them." ); locals[45] = 8; // "I doubt it." locals[46] = 9; // "Such as what?" locals[47] = 0; // "" locals[66] = babl_menu( 0, &locals[45] ); switch ( locals[66] ) { case 1: goto label_0369; break; case 2: goto label_0369; break; } // end switch label_0369:; label_0369:; say( "Ah, so you would know information so advanced it is more dangerous than you can imagine? Very well, here is a piece for you: the spell Vas Kal Corp will bring an end to life as you know it, although higher beings such as we will continue to exist in our own way. There. We are eager to see to what use you will put this information." ); locals[67] = 11; // "Thank thee. I will try it out." locals[68] = 13; // "This information is useless to me." locals[69] = 0; // "" locals[88] = babl_menu( 0, &locals[67] ); switch ( locals[88] ) { case 1: say( "Perhaps you are not as intelligent as we first thought." ); break; case 2: say( "And that itself is something it is good you should know." ); break; } // end switch func_00e0(); } // end if say( "So you have decided not to use the information we have given you?" ); locals[89] = 16; // "Yes. It is too dangerous." locals[90] = 18; // "I will shortly." locals[91] = 0; // "" locals[110] = babl_menu( 0, &locals[89] ); switch ( locals[110] ) { case 1: say( "If you have learned that not all information is beneficial, you have indeed learned some beneficial information." ); break; case 2: say( "Indeed! That will be an interesting sight." ); break; } // end switch func_00e0(); } // end func