Ultima Underworld/technical/conversations/114
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 #114 // string block 0x0e72 (3698), name Iss'leek // // 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[23]; if ( !private[0] ) { private[2] = 0; } // end if if ( private[0] == 1 ) { if ( private[2] == 0 ) { func_0315(); } else { func_045b(); } // end if } else { say( "Bica. Tosa yeshor'click?" ); locals[1] = 2; // "Sseth." locals[2] = 3; // "'click." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_03a7(); break; case 2: locals[23] = npc_attitude - 1; func_00b1( &locals[23] ); } // end if break; } // end switch } // end func void func_0315() { int locals[45]; say( "Bica. Tosa sorr. Isili yethe tosa?" ); locals[1] = 5; // "Sseth." locals[2] = 6; // "'click." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: locals[23] = 0; func_00b1( &locals[23] ); break; case 2: break; } // end switch say( "Tosa sor'click. Tosa sstresh isili?" ); locals[24] = 8; // "Sseth." locals[25] = 9; // "'click." locals[26] = 0; // "" locals[45] = babl_menu( 0, &locals[24] ); switch ( locals[45] ) { case 1: func_03a7(); break; case 2: func_00b1( 21 ); break; } // end switch } // end func void func_03a7() { int locals[24]; say( "Isili sel'a tosa sstresh." ); locals[2] = 11; // "He shows you a scroll which reads:\n Wanderer\n Iss'leek name is. Please red ruby find. If red ruby find, Thepa rune-spell will be told.\n Translated by Quiet Ones" print( 1, &locals[2] ); private[2] = 1; locals[3] = 12; // "Thank thee. I will do it." locals[4] = 13; // "I cannot do this now. Goodbye." locals[5] = 14; // "I have a red ruby here for thee." locals[6] = 0; // "" locals[24] = babl_menu( 0, &locals[3] ); switch ( locals[24] ) { case 1: func_0419(); break; case 2: func_00b1( 21 ); break; case 3: func_04ba(); break; } // end switch } // end func void func_0419() { int locals[23]; say( "Tosa yeshor'click. Isili thesh tosa!" ); private[2] = 2; locals[1] = 16; // "Thank thee. I will return." locals[2] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); if ( locals[22] == 1 ) { } // end if locals[23] = 3; func_00b1( &locals[23] ); } // end func void func_045b() { int locals[22]; if ( private[2] == 1 ) { func_057e(); } // end if if ( private[2] == 3 ) { func_05c9(); } // end if say( "Bica, yeshor'click. Tosa sel'a isila sstresh?" ); locals[1] = 18; // "Here is a red ruby." locals[2] = 19; // "Sorry. I do not have it yet." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: func_00b1( 21 ); break; } // end switch func_04ba(); } // end func void func_04ba() { int locals[58]; locals[11] = show_inv( 2, &locals[1], &locals[6] ); while ( locals[11] != 0 ) { if ( locals[5] == 162 ) { } else { locals[11] = locals[11] - 1; } // while say( "Tosa 'click sel'a sstresh. Bica." ); locals[12] = 21; // "Bica. I will try again." locals[13] = 0; // "" locals[33] = babl_menu( 0, &locals[12] ); if ( locals[33] == 1 ) { func_00b1( 21 ); } // end if } // end if private[2] = 3; locals[34] = 1; give_ptr_npc( 2, &locals[34], &locals[0] ); locals[35] = 1019; take_from_npc( 1, &locals[35] ); say( "Tosa yeshor'click!" ); locals[36] = 23; // "Bica. Thank thee." locals[37] = 0; // "" locals[57] = babl_menu( 0, &locals[36] ); if ( locals[57] == 1 ) { locals[58] = 3; func_00b1( &locals[58] ); } // end if } // end func void func_057e() { int locals[22]; say( "Tosa sel'a sstresh?" ); locals[1] = 25; // "Yes. I will find a red ruby." locals[2] = 26; // "No. Sorry. Goodbye." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: func_00b1( 21 ); break; } // end switch func_0419(); } // end func void func_05c9() { int locals[44]; say( "Bica. Tosa Iss'leek yeshor'click. Isili thesh tosa." ); locals[1] = 28; // "Bica. Thou art my friend too." locals[2] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); if ( locals[22] == 1 ) { } // end if say( "'Click thit sstresh. Bica." ); locals[23] = 30; // "Goodbye." locals[24] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); if ( locals[44] == 1 ) { func_00b1( 21 ); } // end if } // end func