Ultima Underworld/technical/conversations/65

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 #65 // string block 0x0e41 (3649), name Eb // // 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[212]; if ( private[0] ) { } else { private[2] = 0; private[3] = 0; private[4] = 0; say( "So! Who go there?" ); locals[3] = 2; // "I am on urgent business from the Green Goblins." locals[4] = 3; // "I must speak with thy leader." locals[5] = 4; // "My name is @GS8." locals[6] = 0; // "" locals[24] = babl_menu( 0, &locals[3] ); switch ( locals[24] ) { case 1: goto label_030c; break; case 2: goto label_031f; break; case 3: goto label_0377; break; } // end switch label_030c:; private[3] = 1; say( "Ha! I thought so! You get gone from here!" ); locals[25] = 1; func_00b1( &locals[25] ); label_031f:; label_031f:; label_031f:; if ( private[2] ) { say( "Speak with King Ketchaval, hm?" ); } else { say( "And who you, who wants talk with King Ketchaval?" ); locals[26] = 8; // "My name is @GS8." locals[27] = 9; // "That is not thy business." locals[28] = 0; // "" locals[47] = babl_menu( 0, &locals[26] ); switch ( locals[47] ) { case 1: goto label_0377; break; case 2: goto label_0369; break; } // end switch label_0369:; label_0369:; say( "Well then! You not our business neither!" ); locals[48] = 1; func_00b1( &locals[48] ); label_0377:; label_0377:; private[2] = 1; say( "@GS8, eh? I think I heard of you. You new here, eh? You come to right place. Gray Goblins the most powerful group here." ); } // end if locals[1] = npc_attitude; locals[49] = locals[1]; if ( 0 == locals[49] ) { } else { if ( 1 == locals[49] ) { } else { if ( 2 == locals[49] ) { } else { if ( 3 == locals[49] ) { goto label_0423; } // end if } // end if } // end if private[4] = 1; say( "You be careful, though, you mind your manners. Not all of us like strange people like you. You act nice." ); locals[50] = 47; locals[51] = 51; locals[52] = 0; gronk_door( 3, &locals[52], &locals[51], &locals[50] ); locals[53] = 13; // "Thank thee, I will." locals[54] = 14; // "I shall do my best." locals[55] = 0; // "" locals[74] = babl_menu( 0, &locals[53] ); switch ( locals[74] ) { case 1: func_00e0(); break; case 2: func_00e0(); } // end if break; } // end switch label_0423:; private[4] = 1; say( "Good idea speak with King Ketchaval. He very wise and strong. Maybe you best talk to Queen Retichall first, though. On you go, now." ); locals[75] = 47; locals[76] = 51; locals[77] = 0; gronk_door( 3, &locals[77], &locals[76], &locals[75] ); locals[78] = 16; // "Thank thee for the advice." locals[79] = 17; // "Farewell." locals[80] = 0; // "" locals[99] = babl_menu( 0, &locals[78] ); switch ( locals[99] ) { case 1: func_00e0(); break; case 2: func_00e0(); } // end if break; } // end switch if ( private[3] ) { } else { if ( private[2] ) { say( "Ho, @GS8! Why you here again?" ); } else { say( "Hey, it you again! What you want?" ); } // end if locals[2] = !private[4]; locals[121] = 1; locals[100] = 20; // "I am merely wandering about." locals[122] = 1; locals[101] = 22; // "I am continuing my journey." locals[123] = locals[2]; locals[102] = 24; // "I seek thy leader." locals[124] = 1; locals[103] = 25; // "Canst thou open this portcullis?" locals[104] = 0; // "" locals[142] = babl_fmenu( 0, &locals[100], &locals[121] ); switch ( locals[142] ) { case 20: say( "You be careful then. Not everywhere safe to wander." ); func_00e0(); break; case 22: say( "You have nice journey then." ); func_00e0(); break; case 24: goto label_031f; break; case 25: goto label_05d9; } // end if break; } // end switch say( "Aha! Green Goblin friend! You still like them?" ); locals[143] = 27; // "No, I have tired of them." locals[144] = 28; // "I never did, to be honest." locals[145] = 29; // "Yes, I enjoy their company greatly." locals[146] = 0; // "" locals[164] = babl_menu( 0, &locals[143] ); switch ( locals[164] ) { case 1: goto label_0594; break; case 2: goto label_0594; break; case 3: goto label_0586; break; } // end switch label_0586:; say( "Ha, I think as much! You not welcome here then!" ); locals[165] = 1; func_00b1( &locals[165] ); label_0594:; label_0594:; private[3] = 0; say( "Yeah? What you want here then?" ); locals[166] = 32; // "I wish to speak with thy leader." locals[167] = 33; // "I have no business with thee." locals[168] = 0; // "" locals[187] = babl_menu( 0, &locals[166] ); switch ( locals[187] ) { case 1: goto label_031f; break; case 2: goto label_0369; break; } // end switch label_05d9:; say( "Well, you be careful, mind your manners. On you go." ); locals[188] = 47; locals[189] = 51; locals[190] = 0; gronk_door( 3, &locals[190], &locals[189], &locals[188] ); locals[191] = 35; // "Thank thee for the advice." locals[192] = 36; // "Farewell." locals[193] = 0; // "" locals[212] = babl_menu( 0, &locals[191] ); switch ( locals[212] ) { case 1: func_00e0(); break; case 2: func_00e0(); break; } // end switch } // end func