Ultima Underworld/technical/conversations/277
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 #277 // string block 0x0f15 (3861), critter #21, green lizardman // // 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] ) { global[0] = 0; } // end if if ( global[0] == 1 ) { func_06a1(); } // end if say( "Bica, sor'click." ); locals[1] = 2; // "Bica to thee also." locals[2] = 3; // "Greetings, Lizardman." locals[3] = 4; // "What?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_030e(); break; case 2: func_036a(); break; case 3: func_0565(); break; } // end switch } // end func void func_030e() { int locals[22]; say( "Tosa yeshor'click Thepa?" ); locals[1] = 6; // "Yes." locals[2] = 7; // "No." locals[3] = 8; // "What?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_03da(); break; case 2: func_0506(); break; case 3: func_0565(); break; } // end switch } // end func void func_036a() { int locals[22]; say( "Tosa 'click yeshor'click. Tosa sorr?" ); locals[1] = 10; // "Yes." locals[2] = 11; // "No." locals[3] = 12; // "Maybe." locals[4] = 13; // "Huh?" locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0506(); break; case 2: func_0436(); break; case 3: func_0506(); break; case 4: func_0565(); break; } // end switch } // end func void func_03da() { int locals[22]; say( "Tosa yeshor'click Sseetharee?" ); locals[1] = 15; // "I guess so." locals[2] = 16; // "No, I'm not." locals[3] = 17; // "Who is that?" locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0436(); break; case 2: func_04a2(); break; case 3: func_036a(); break; } // end switch } // end func void func_0436() { int locals[22]; say( "Isili yeshor'click Sseetharee!" ); locals[1] = 19; // "Good! Wouldst thou like to barter?" locals[2] = 20; // "That's nice. Excuse me, please." locals[3] = 21; // "Goodbye." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: global[0] = 1; func_072d(); break; case 2: func_00b1( 22 ); break; case 3: func_00b1( 22 ); break; } // end switch func_00b1( 22 ); } // end func void func_04a2() { int locals[22]; say( "Tosa sorr Sseetharee?" ); locals[1] = 23; // "No." locals[2] = 24; // "Yes." locals[3] = 25; // "Goodbye." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: global[0] = 1; func_072d(); break; case 2: func_059c(); break; case 3: break; } // end switch func_00b1( 22 ); } // end func void func_0506() { int locals[24]; say( "Sorr Thepa! Isili yethe tosa!" ); locals[1] = 27; // "The lizardman growls menacingly." print( 1, &locals[1] ); locals[2] = 28; // "I did not mean to upset thee. I will leave now." locals[3] = 29; // "If thou dost want a fight, I will be happy to oblige!" locals[4] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: locals[24] = 1; func_00b1( &locals[24] ); break; case 2: break; } // end switch func_008b(); } // end func void func_0565() { int locals[22]; say( "Tosa thit eppa Urgo. Thit eppa Sseetharee." ); locals[1] = 31; // "I do not understand. Goodbye." locals[2] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); if ( locals[22] == 1 ) { } // end if func_00b1( 22 ); } // end func void func_059c() { int locals[44]; say( "Tosa yethe Sseetharee?" ); locals[1] = 33; // "Yes." locals[2] = 34; // "No." locals[3] = 35; // "I don't know." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0506(); break; case 2: break; case 3: func_0565(); break; } // end switch say( "Tosa sstresh Sseetharee?" ); locals[23] = 37; // "I did." locals[24] = 38; // "Sorry. I did not." locals[25] = 39; // "Please excuse me. Goodbye." locals[26] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); switch ( locals[44] ) { case 1: func_0436(); break; case 2: func_064d(); break; case 3: func_00b1( 22 ); break; } // end switch } // end func void func_064d() { int locals[23]; say( "Tosa 'click sstresh Seetharee? Tosa 'click yeshor'click. Bica." ); locals[1] = 41; // "Bica." locals[2] = 42; // "Goodbye." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: locals[23] = 3; func_00b1( &locals[23] ); break; case 2: func_00b1( 22 ); break; } // end switch } // end func void func_06a1() { int locals[44]; say( "Bica, yeshor'click." ); locals[1] = 44; // "Bica, friend." locals[2] = 45; // "Bica. I must be going." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: func_00b1( 22 ); break; } // end switch say( "Tosa thit sstresh?" ); locals[23] = 47; // "Yes. Wouldst thou like to trade?" locals[24] = 48; // "No. Bica, my friend." locals[25] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); switch ( locals[44] ) { case 1: func_072d(); break; case 2: break; } // end switch func_00b1( 22 ); } // end func void func_072d() { int locals[22]; if ( !func_0020() ) { } else { say( "Sel'a?" ); locals[1] = 50; // "Yes." locals[2] = 51; // "No." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_077d(); break; case 2: return; } // end if break; } // end switch } // end func void func_077d() { int locals[44]; setup_to_barter( 0 ); while ( !private[1] ) { locals[1] = 52; // "I make thee this offer." locals[2] = 53; // "I demand that thou givest me these items." locals[3] = 54; // "I must think about this offer." locals[4] = 55; // "I do not wish to barter any further." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_082e(); break; case 2: func_0870(); break; case 3: do_judgement( 0 ); break; case 4: do_decline( 0 ); private[1] = 1; break; } // end switch } // while locals[23] = 56; // "Farewell." locals[24] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); if ( locals[44] == 1 ) { private[1] = 1; } // end if } // end func void func_082e() { int locals[5]; locals[1] = 57; // "Sseth." locals[2] = 58; // "'Click." locals[3] = 59; // "Sorr." locals[4] = 60; // "'Click, 'click. Bica." locals[5] = 61; // "Tosa ssil?" if ( do_offer( 5, &locals[5], &locals[4], &locals[3], &locals[2], &locals[1] ) ) { private[1] = 1; } // end if } // end func void func_0870() { int locals[24]; say( "sorr?" ); locals[1] = 63; // "Yes." locals[2] = 64; // "No." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: break; case 2: return; break; } // end switch locals[23] = 65; // "Sseth, sorr." locals[24] = 66; // "'DCclick yethe!" if ( do_demand( 2, &locals[24], &locals[23] ) ) { private[1] = 1; } else { func_008b(); } // end if } // end func