Ultima Underworld/technical/conversations/210

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 #210 // string block 0x0ed2 (3794), name Naruto // // 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]global[0]; 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_05f3(); } else { global[1] = 1; global[2] = 1; global[0] = 0; say( "What brings thee here?" ); locals[1] = 2; // "I seek to free a kidnapped girl." locals[2] = 3; // "I must defeat the wizard Tyball." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0300(); break; case 2: func_0300(); } // end if break; } // end switch } // end func void func_0300() { int locals[22]; global[1] = 0; say( "Well, watch thyself. There are nasty spiders all around. My friend was just killed by one, some distance to the north. He had a key that would allow one to enter a place of some importance. There one might find an item that allows the owner to get through Tyball's maze." ); locals[1] = 5; // "What place does the key allow one to enter?" locals[2] = 6; // "I thank thee. What else canst thou tell me of the area?" locals[3] = 7; // "Dost thou know why my magic powers have been drained?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0361(); break; case 2: func_0422(); break; case 3: func_0422(); break; } // end switch } // end func void func_0361() { int locals[22]; say( "I said, 'twas a key that allowed one to enter a secret place. There lies an item that permits one to pass through Tyball's maze. Wert thou not listening? The entrance is in the chasm of fire." ); locals[1] = 9; // "I will go kill the spider and get this key." locals[2] = 10; // "What else canst thou tell me of this area?" locals[3] = 11; // "Dost thou know why my magic powers have been drained?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_03bd(); break; case 2: func_0422(); break; case 3: func_0422(); break; } // end switch } // end func void func_03bd() { int locals[23]; say( "Wait! I have more information that may prove of use." ); locals[1] = 13; // "Well?" locals[2] = 14; // "What information is this?" locals[3] = 15; // "I need not thy help. Farewell." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0422(); break; case 2: func_0422(); break; case 3: locals[23] = 1; func_00b1( &locals[23] ); break; } // end switch } // end func void func_0422() { int locals[22]; global[2] = 0; say( "A mysterious Orb drains the magic from every living creature on this level." ); locals[1] = 17; // "And that why I cannot cast spells?" locals[2] = 18; // "I thank thee for thy advice. Farewell." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_046f(); break; case 2: func_04a3(); break; } // end switch } // end func void func_046f() { int locals[22]; say( "Indeed. The Orb drains thy power and transfers it -- somewhere -- where it is put to some foul purpose." ); locals[1] = 20; // "Dost thou know who is behind this?" locals[2] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); if ( locals[22] == 1 ) { func_04b0(); } // end if } // end func void func_04a3() { say( "Farewell." ); func_00e0(); } // end func void func_04b0() { int locals[22]; say( "I know only that one mage, Tyball by name, seems immune to its effects." ); locals[1] = 23; // "The conclusion seems obvious." locals[2] = 24; // "I know this Tyball. He is evil itself." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_04f8(); break; case 2: func_04f8(); break; } // end switch } // end func void func_04f8() { int locals[22]; say( "Indeed. However, if thou dost wish to break the Orb's grasp on this area, best thou prepare thyself with means other than spells." ); locals[1] = 26; // "How can such a thing be accomplished?" locals[2] = 27; // "Very well. I thank thee. Farewell." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0540(); break; case 2: func_04a3(); break; } // end switch } // end func void func_0540() { int locals[22]; say( "All I can think is, if thou canst discover whence came the Orb, and obtain from its place of origin a fragment of its substance, thou mayst be able to destroy it with that." ); locals[1] = 29; // "This sounds an excellent idea! But who knows whence it came?" locals[2] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); if ( locals[22] == 1 ) { func_0574(); } // end if } // end func void func_0574() { int locals[22]; say( "I know not, but I think some friends of mine, who languish in prison, discovered its secret before they were captured by Tyball. If thou canst talk to them, perhaps they can help thee." ); locals[1] = 31; // "Very well. I thank thee for thy help." locals[2] = 32; // "I will go talk to them." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_05bf(); break; case 2: say( "Good luck." ); func_00e0(); break; } // end switch } // end func void func_05bf() { int locals[22]; say( "Thou art welcome. Farewell." ); locals[1] = 35; // "Farewell." locals[2] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); if ( locals[22] == 1 ) { func_00e0(); } // end if } // end func void func_05f3() { int locals[45]; if ( global[2] ) { say( "Thou hast decided to talk to me after all?" ); locals[1] = 37; // "Yes, what canst thou tell me of this area?" locals[2] = 38; // "No, I think not." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0422(); break; case 2: locals[23] = 1; func_00b1( &locals[23] ); } // end if } else { break; } // end switch say( "I am sorry, but I have told thee all I can. Perhaps my friends in the prisons can tell thee more of the Orb and the rocks made of the same substance." ); locals[24] = 40; // "I will talk to them." locals[25] = 41; // "Thank thee and farewell." locals[26] = 0; // "" locals[45] = babl_menu( 0, &locals[24] ); switch ( locals[45] ) { case 1: break; case 2: break; } // end switch func_00e0(); } // end func