Ultima Underworld/technical/conversations/15

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 #15 // string block 0x0e0f (3599), name Sseetharee // // 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] == 0 ) { private[2] = -1; private[3] = -1; } // end if if ( private[0] == 1 ) { locals[1] = 0; if ( get_quest( 1, &locals[1] ) == 1 ) { func_0b03(); } // end if func_0429(); } else { say( "Bica, sor'click." ); locals[2] = 2; // "Bica, yourself." locals[3] = 3; // "Uh... Greetings." locals[4] = 4; // "I'm sorry, what did you say?" locals[5] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: func_032f(); break; case 2: func_032f(); break; case 3: func_049e(); } // end if break; } // end switch } // end func void func_032f() { int locals[23]; say( "Tosa yeshor'click? Tosa sorr?" ); locals[1] = 6; // "I'm sorry, I can't understand thee." locals[2] = 7; // "Dost speak my language?" locals[3] = 8; // "Sorr." locals[4] = 9; // "Yeshor'click." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_049e(); break; case 2: func_03ac(); break; case 3: locals[23] = npc_attitude - 1; func_00b1( &locals[23] ); break; case 4: func_051a(); break; } // end switch } // end func void func_03ac() { int locals[23]; say( "'click." ); locals[1] = 11; // "Dost "'click" mean "yes?"" locals[2] = 12; // "Dost "'click" mean "no?" " locals[3] = 13; // "Excuse me, I must be going." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0413(); break; case 2: func_041e(); break; case 3: locals[23] = 3; func_00b1( &locals[23] ); break; } // end switch func_032f(); } // end func void func_0413() { say( "'click." ); } // end func void func_041e() { say( "Sseth." ); } // end func void func_0429() { int locals[22]; if ( private[3] == 1 ) { func_0911(); } // end if if ( private[2] == 1 ) { func_0871(); } else { say( "Bica." ); locals[1] = 17; // "Oh, not that again!" locals[2] = 18; // "Bica." locals[3] = 19; // "Never mind! I am leaving." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_049e(); break; case 2: func_032f(); break; case 3: func_00b1( 21 ); } // end if break; } // end switch } // end func void func_049e() { int locals[25]; say( "Tosa thit sstresh. Tosa eppa Urgo.\n" "" ); locals[1] = 21; // "He points to the figure moving behind the bars." print( 1, &locals[1] ); locals[2] = 22; // "If thou sayst so." locals[3] = 23; // "Sorry, I cannot understand thee. Farewell." locals[4] = 24; // "What dost thou want?" locals[5] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: locals[24] = 3; func_00b1( &locals[24] ); break; case 2: locals[25] = 3; func_00b1( &locals[25] ); break; case 3: func_051a(); break; } // end switch } // end func void func_051a() { int locals[22]; say( "Tosa eppa Urgo? Urgo sstresh tosa? Urgo sorr. Tosa sorr?" ); locals[1] = 26; // "No, I'm not." locals[2] = 27; // "If thou sayst so." locals[3] = 28; // "Why?" locals[4] = 29; // "Why not?" locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_058a(); break; case 2: func_060c(); break; case 3: func_0666(); break; case 4: func_ffff(); break; } // end switch } // end func void func_058a() { int locals[24]; say( "Tosa yeshor'click! Isili Sseetharee. Sseetharee yeshor'click. Isili sstresh tosa, sseth?" ); locals[1] = 31; // "Yes!" locals[2] = 32; // "No!" locals[3] = 33; // "I'm glad. Farewell, for now." locals[4] = 34; // "Bica, friend Sseetharee." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0666(); break; case 2: func_060c(); break; case 3: locals[23] = 2; func_00b1( &locals[23] ); break; case 4: locals[24] = 3; func_00b1( &locals[24] ); break; } // end switch } // end func void func_060c() { int locals[24]; say( "Tosa sorr! Tosa 'click eppa! Tosa eppa, isili yethe tosa!" ); locals[1] = 36; // "I'm glad. Farewell, for now." locals[2] = 37; // "I'm sorry, I don't understand thee. Goodbye." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: locals[23] = 1; func_00b1( &locals[23] ); break; case 2: locals[24] = 3; func_00b1( &locals[24] ); break; } // end switch } // end func void func_0666() { int locals[23]; say( "Urgo sorr. Urgo sorra zekka, thes'click Thepa. Thepa yethe Urgo." ); locals[1] = 39; // "No, please don't!" locals[2] = 40; // "Yes, you must!." locals[3] = 41; // "Too confusing. Goodbye." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_06cb(); break; case 2: func_0730(); break; case 3: locals[23] = 1; func_00b1( &locals[23] ); break; } // end switch } // end func void func_06cb() { int locals[23]; say( "Tosa sel'a zekka isili - isili sel'a Urgo tosa." ); locals[1] = 43; // "Yes, I will." locals[2] = 44; // "No, I won't." locals[3] = 45; // "I have some right here." locals[4] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_080d(); break; case 2: locals[23] = 1; func_00b1( &locals[23] ); break; case 3: func_0959(); break; } // end switch } // end func void func_0730() { int locals[22]; say( "Isili thesh tosa. Tosa thesh yethe Urgo?" ); locals[1] = 47; // "Sure." locals[2] = 48; // "No." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0778(); break; case 2: func_06cb(); break; } // end switch } // end func void func_0778() { int locals[25]; say( "Tosa yethe sorr Urgo, tosa eppa Isili." ); private[3] = 1; locals[1] = 50; // "Oh. Goodbye." locals[2] = 51; // "Thank thee." locals[3] = 52; // "Next door down the hall?" locals[4] = 53; // "I cannot. I simply cannot." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: locals[23] = 2; func_00b1( &locals[23] ); break; case 2: locals[24] = 3; func_00b1( &locals[24] ); break; case 3: locals[25] = 1; func_00b1( &locals[25] ); break; case 4: func_080d(); private[3] = 0; break; } // end switch } // end func void func_080d() { int locals[24]; say( "Tosa yeshor'click. Tosa eppa isili, sel'a isili zekka, isili sstresh Urgo." ); private[2] = 1; private[3] = 0; locals[1] = 55; // "Very well. It shall be done." locals[2] = 56; // "We'll see." 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: locals[24] = 1; func_00b1( &locals[24] ); break; } // end switch } // end func void func_0871() { int locals[47]; say( "Tosa sel'a zekka?" ); locals[1] = 58; // "Here it is." locals[2] = 59; // "I was unable to find any." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0959(); break; case 2: locals[23] = 1; func_00b1( &locals[23] ); break; } // end switch locals[24] = 60; // "Sorry. I shall return." locals[25] = 61; // "Goodbye." locals[26] = 0; // "" locals[45] = babl_menu( 0, &locals[24] ); switch ( locals[45] ) { case 1: locals[46] = 2; func_00b1( &locals[46] ); break; case 2: locals[47] = 1; func_00b1( &locals[47] ); break; } // end switch } // end func void func_0911() { int locals[22]; say( "Tosa yethe Urgo?" ); locals[1] = 63; // "No, I cannot. It is against my oaths." locals[2] = 64; // "Yes." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_080d(); break; case 2: func_0ab8(); break; } // end switch } // end func void func_0959() { int locals[69]; label_095e:; locals[16] = show_inv( 2, &locals[6], &locals[1] ); locals[18] = 0; locals[19] = 0; while ( locals[16] != 0 ) { locals[17] = locals[0]; if ( ((((((locals[17] == 176 || locals[17] == 177) || locals[17] == 178) || locals[17] == 179) || locals[17] == 180) || locals[17] == 181) || locals[17] == 182) ) { locals[18] = locals[18] + count_inv( 1, &locals[5] ); locals[19] = locals[19] + 1; locals[10] = locals[5]; } // end if locals[16] = locals[16] - 1; } // while if ( locals[18] > 4 ) { give_to_npc( 2, &locals[11], &locals[19] ); locals[20] = 27; locals[21] = 22; locals[22] = 0; gronk_door( 3, &locals[22], &locals[21], &locals[20] ); locals[23] = 0; locals[24] = 1; set_quest( 2, &locals[24], &locals[23] ); say( "Isili thesh tosa! Tosa yeshor'click! Tosa eppa isili!" ); locals[25] = 66; // "Thank you. Good bye." locals[26] = 0; // "" locals[46] = babl_menu( 0, &locals[25] ); if ( locals[46] == 1 ) { } // end if locals[47] = 3; func_00b1( &locals[47] ); } else { say( "Tosa 'click sel'a ossli. Isili 'click sstresh Urgo." ); locals[48] = 68; // "Oh.... goodbye." locals[49] = 69; // "Sorry. Here is more." locals[50] = 0; // "" locals[69] = babl_menu( 0, &locals[48] ); switch ( locals[69] ) { case 1: break; case 2: goto label_095e; break; } // end switch func_00b1( 21 ); } // end if } // end func void func_0ab8() { int locals[5]; locals[1] = get_quest( 1, &locals[2] ); locals[2] = 6; if ( locals[1] ) { locals[3] = 3; set_race_attitude( 1, &locals[3] ); say( "Tosa yeshor'click! Tosa thes'click sorr! Tosa eppa isili!" ); locals[4] = 3; func_00b1( &locals[4] ); } else { say( "Tosa sorr. Isili 'click sstresh tosa." ); locals[5] = 1; func_00b1( &locals[5] ); } // end if } // end func void func_0b03() { int locals[26]; say( "Tosa yeshor'click. Eppa Ishtass sstresh." ); locals[2] = 73; // "Thank you. Goodbye." locals[3] = 74; // "Other..." locals[4] = 0; // "" locals[23] = babl_menu( 0, &locals[2] ); switch ( locals[23] ) { case 1: func_00b1( 21 ); break; case 2: break; } // end switch locals[1] = babl_ask( 0 ); locals[24] = 75; if ( contains( 2, &locals[1], &locals[24] ) ) { say( "Sel'a tosa sstresh. Yisa Toosa." ); locals[25] = 77; // "He motions to the south." print( 1, &locals[25] ); } else { locals[26] = 78; if ( contains( 2, &locals[1], &locals[26] ) ) { say( "Tosa sstresh Urgo." ); } else { say( "Isili 'click sstresh." ); } // end if } // end if func_00b1( 21 ); } // end func void func_0b9d() { int locals[22]; if ( !func_0020() ) { } else { say( "Sel'a?" ); locals[1] = 82; // "Yes." locals[2] = 83; // "No." locals[3] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0bed(); break; case 2: return; } // end if break; } // end switch } // end func void func_0bed() { int locals[44]; setup_to_barter( 0 ); while ( !private[1] ) { locals[1] = 84; // "I make thee this offer." locals[2] = 85; // "I demand that thou givest me these items." locals[3] = 86; // "I must think about this offer." locals[4] = 87; // "I do not wish to barter any further." locals[5] = 0; // "" locals[22] = babl_menu( 0, &locals[1] ); switch ( locals[22] ) { case 1: func_0c9e(); break; case 2: func_0ce0(); break; case 3: do_judgement( 0 ); break; case 4: do_decline( 0 ); private[1] = 1; break; } // end switch } // while locals[23] = 88; // "Farewell." locals[24] = 0; // "" locals[44] = babl_menu( 0, &locals[23] ); if ( locals[44] == 1 ) { private[1] = 1; } // end if } // end func void func_0c9e() { int locals[5]; locals[1] = 89; // "Sseth." locals[2] = 90; // "'Click." locals[3] = 91; // "Sorr." locals[4] = 92; // "'Click, 'click. Bica." locals[5] = 93; // "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_0ce0() { int locals[24]; say( "sorr?" ); locals[1] = 95; // "Yes." locals[2] = 96; // "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] = 97; // "Sseth, sorr." locals[24] = 98; // "'DCclick yethe!" if ( do_demand( 2, &locals[24], &locals[23] ) ) { private[1] = 1; } else { func_008b(); } // end if } // end func