Ultima Underworld/technical/conversations/144
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 #144 // string block 0x0e90 (3728), name Rawstag // // 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[45]; if ( private[0] == 0 ) { say( "Who are you? I not seen you before." ); locals[1] = 2; // "I am @GS8." locals[2] = 3; // "I am an adventurer." locals[3] = 4; // "I am your doom!" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: break; case 3: break; } // end switch say( "All sounds very confusing. Mind I call you Rodriguez?" ); locals[23] = 6; // "I do mind! My name is @GS8." locals[24] = 7; // "Not at all, Rodriguez is a fine name." locals[25] = 8; // "If thou dost insist." locals[26] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); switch ( locals[44] ) { case 1: break; case 2: if ( npc_attitude < 3 ) { npc_attitude = npc_attitude + 1; } // end if break; case 3: break; } // end switch say( "Whatever you say, Rodriguez." ); } else { say( "Hey, I seen you 'fore. Hi Rodriguez!" ); } // end if if ( private[3] ) { func_06ca(); } else { if ( private[2] == 0 ) { func_0382(); } else { locals[45] = 1; func_0521( &locals[45] ); } // end if } // end if } // end func void func_0382() { int locals[33]; while ( 1 ) { say( "What I do for you?" ); locals[2] = 12; // "Canst thou let me through thy door?" locals[3] = 13; // "Other..." locals[4] = 14; // "Nothing, thank you. Farewell." locals[5] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: func_04c8(); break; case 2: break; case 3: func_00e0(); break; } // end switch locals[1] = babl_ask( 0 ); say( "\1@SS1\0" ); locals[24] = 16; (contains( 2, &locals[1], &locals[24] ) || contains( 2, &locals[1], &locals[25] )); // expr. has value on stack! if ( locals[25] = 17 ) { func_04c8(); } else { locals[26] = 18; if ( contains( 2, &locals[1], &locals[26] ) ) { say( "Oh... I help if I can, I think." ); } else { locals[27] = 20; if ( contains( 2, &locals[1], &locals[27] ) ) { say( "I would rather stay here by my door. It safer then going out near the knights." ); } else { locals[28] = 22; if ( contains( 2, &locals[1], &locals[28] ) ) { say( "Lava real hot. Me no go near." ); } else { locals[29] = 24; if ( contains( 2, &locals[1], &locals[29] ) ) { say( "Oh, I no good with bridge, it collapse and I hurt meself." ); } else { locals[30] = 26; (compare( 2, &locals[1], &locals[30] ) || (contains( 2, &locals[1], &locals[31] ) || contains( 2, &locals[1], &locals[32] ))); // expr. has value on stack! locals[31] = 27; if ( locals[32] = 28 ) { say( "Goodbye, Rodriguez." ); locals[33] = 2; func_00b1( &locals[33] ); } // end if say( "I no understand you, Rodriguez." ); } // end if } // end if } // end if } // end if } // end if } // while } // end func void func_04c8() { int locals[23]; say( "I open door? Yes, I could. You want me to?" ); locals[1] = 32; // "Yes, please." locals[2] = 33; // "No, I was just wondering." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: func_00c2(); break; } // end switch say( "Maybe I open door if you give me something." ); private[2] = 1; locals[23] = 0; func_0521( &locals[23] ); } // end func void func_0521() { int locals[23]; if ( param1[0]play_hunger ) { say( "Did you bring me something? What is it? I want see!" ); } // end if locals[1] = 0; while ( 1 ) { locals[2] = 36; // "I demand thou dost open the door!" locals[3] = 37; // "Here it is." locals[4] = 38; // "I have nothing for thee." locals[5] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: func_0596( &locals[1] ); break; case 2: func_0610(); break; case 3: say( "Find something, come back with it. I may like." ); func_00e0(); break; } // end switch } // while func_00e0(); } // end func void func_0596() { int locals[22]; if ( param1[0]play_hunger < 2 ) { play_hunger = param1[0]play_hunger + 1; say( "I no like you demand, Rodriguez." ); } else { if ( npc_attitude > 1 ) { npc_attitude = npc_attitude - 1; say( "You be careful, friend Rodriguez." ); } else { say( "You no make demand anymore!" ); func_008b(); } // end if } // end if locals[1] = 43; // "Open the door, or I shall kill thee!" locals[2] = 44; // "I'm sorry. I did not mean to offend thee." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_008b(); break; case 2: break; } // end switch say( "I get. I once wait for friend so long, I hurl him off cliff by mistake, I so upset." ); } // end func void func_0610() { int locals[20]; locals[14] = show_inv( 2, &locals[6], &locals[1] ); if ( locals[14] == 0 ) { say( "You no show me nothing. I no impressed....\p" ); say( "You try fool me, Rodriguez? No luck, I too smart." ); } else { locals[11] = find_barter( 1, &locals[15] ); locals[15] = 162; switch ( locals[11] ) { case 0: locals[11] = find_barter( 1, &locals[16] ); locals[16] = 163; break; case 0: say( "Nice. But me no want. Some other?" ); break; } // end switch locals[17] = -1; give_ptr_npc( 2, &locals[17], &locals[11] ); say( "Oh, I like! Thank you!" ); locals[13] = gronk_door( 3, &locals[20], &locals[19], &locals[18] ); locals[18] = 61; locals[19] = 5; locals[20] = 0; if ( locals[13] ) { say( "Door open now. You happy?" ); } else { say( "Hey. Who break door?" ); } // end if private[3] = 1; if ( npc_attitude < 2 ) { npc_attitude = 2; } // end if func_00e0(); } // end if } // end func void func_06ca() { int locals[22]; locals[1] = 52; // "Greetings, Rawstag. It is a pleasure to see thee again." locals[2] = 53; // "What lies beyond this door?" locals[3] = 54; // "Canst thou tell me of the Knights?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: break; case 3: break; } // end switch say( "Sorry, Rodriguez, I no have time for chitchat. I have nice red gem I must play with. You have fun!" ); } // end func