Ultima Underworld/technical/conversations/295
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 #295 // string block 0x0f27 (3879), critter #39, mage // // 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_0293(); 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_goal = 6; func_0012(); } // end func void func_0072() { npc_goal = 1; func_0012(); } // end func void func_0081() { npc_gtarg = 1; npc_goal = 5; npc_attitude = 1; func_0012(); } // end func void func_009a() { npc_attitude = 6; } // end func void func_00a7() { npc_attitude = param1[0]global[0]; func_0012(); } // end func void func_00b8() { npc_attitude = 2; func_0012(); } // end func void func_00c7() { npc_attitude = 1; func_0012(); } // end func void func_00d6() { func_0012(); } // end func void func_00e0() { param1[1] = game_days; param1[2] = game_mins; } // end func void func_00fc() { 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_0185() { 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_0239() { 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_0293() { int locals[4]; if ( private[0] == 1 ) { func_00c7(); } // end if locals[2] = 0; while ( !locals[2] ) { locals[1] = random( 1, &locals[3] ); locals[3] = 4; locals[4] = locals[1]; if ( 1 == locals[4] ) { if ( global[12][0] ) { } // end if say( "Out of my way, benighted adventurer!" ); global[12][0] = 1; global[17] = global[17] + 1; } else { if ( 2 == locals[4] ) { if ( global[12][0] ) { } // end if say( "Excuse me, please, I am in haste!" ); global[12][0] = 1; global[17] = global[17] + 1; } else { if ( 3 == locals[4] ) { if ( global[12][0] ) { } // end if say( "Sorry! No time to talk!" ); global[12][0] = 1; global[17] = global[17] + 1; } else { if ( 4 == locals[4] ) { if ( global[12][0] ) { } // end if say( "What is it? I haven't time to chat!" ); global[12][0] = 1; global[17] = global[17] + 1; } else { } // while } // end if } // end if } // end if } // end if } // end func void func_0373() { int locals[22]; locals[1] = 5; // "Aroint thee, longbeard!" locals[2] = 6; // "I beg thy pardon, learned sir." locals[3] = 7; // "Good riddance!" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0435(); break; case 2: func_03cc(); break; case 3: func_00b8(); break; } // end switch } // end func void func_03cc() { int locals[22]; say( "I have no time for thee. Speak to Morlock, the Guildmaster." ); locals[1] = 9; // "Where is the Guildmaster?" locals[2] = 10; // "What's your hurry?" locals[3] = 11; // "All right. Be that way." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0428(); break; case 2: func_0442(); break; case 3: func_00b8(); break; } // end switch } // end func void func_0428() { say( "Pass He Who Dwells on the Threshold. Now excuse me!" ); func_00c7(); } // end func void func_0435() { say( "Ah, perhaps I do have time to squash an annoyance like yourself." ); func_0081(); } // end func void func_0442() { int locals[4]; if ( global[11] == 10 ) { say( "I know nothing." ); } else { locals[2] = 0; } // end if if ( !locals[2] ) { locals[1] = random( 1, &locals[3] ); locals[3] = 10; locals[4] = locals[1]; if ( 1 == locals[4] ) { if ( global[0][0] ) { } // end if say( "A Troll has been sighted, carrying a virgin for sacrifice!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { if ( 2 == locals[4] ) { if ( global[0][0] ) { } // end if say( "Magical fluxes suggest that some disaster threatens!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { if ( 3 == locals[4] ) { if ( global[0][0] ) { } // end if say( "Some mysterious force is draining away all the magic on a deep level of the Abyss!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { if ( 4 == locals[4] ) { if ( global[0][0] ) { } // end if say( "Oh, talk to a door if thou wishest to learn!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { if ( 5 == locals[4] ) { if ( global[0][0] ) { } // end if say( "Speak to Dr. Owl! He may help thee!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { if ( 6 == locals[4] ) { if ( global[0][0] ) { } // end if say( "There is disturbance in the aethyr! Travellers from other worlds may be about!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { if ( 7 == locals[4] ) { if ( global[0][0] ) { } // end if say( "The Mad Mage is causing troubles again!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { if ( 8 == locals[4] ) { if ( global[0][0] ) { } // end if say( "Garamon is dead!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { if ( 9 == locals[4] ) { if ( global[0][0] ) { } // end if say( "I must find a privy!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { if ( 10 == locals[4] ) { if ( global[0][0] ) { } // end if say( "Be Just and Fear Not!" ); global[0][0] = 1; global[11] = global[11] + 1; } else { } else { } // end if } // end if } // end if } // end if } // end if } // end if } // end if } // end if } // end if } // end if } // end if } // end func