the cutting room mirror

276

This article has a talk page!
view on tcrf.net

This is a sub-page of Ultima Underworld: The Stygian Abyss (DOS)/Conversations.

// cnvdasm - ultima underworld conversation script disassembler / decompiler
// 
// loading game strings
// 
// conversation #276
// string block 0x0f14 (3860), critter #20, mountainman
// 
// 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[195];

   private[5] = get_quest( 1, &locals[1] );
   locals[1] = 4;
   private[2] = 1;
   private[3] = 1;
   private[4] = 1;
   if ( private[0] ) {

      say( "Greetings to ye, @GS8.  What brings ye here?" );
   } else {

      say( "Ah, ye must be @GS8 of whom I've heard.  What can I do for ye?" );
   } // end if

   locals[2] = 3; // "I am searching for a kidnapped girl."
   locals[3] = 4; // "I am questing to eradicate evil in the Abyss."
   locals[4] = 5; // "I seek information."
   locals[5] = 6; // "I wish to barter with thee."
   locals[6] = 0; // ""
   locals[23] = babl_menu( 0, &locals[2] );
   switch ( locals[23] ) {

   case 1:

      goto label_0335;

   break;

   case 2:

      goto label_03c7;

   break;

   case 3:

      goto label_04f2;

   break;

   case 4:

      goto label_0584;

   break;

   } // end switch

   label_0335:;

   label_0335:;

   label_0335:;

   label_0335:;

   private[2] = 0;
   say( "Terrible, ain't it?  I hear a troll carried her below.  I hope all turns out well for ye.  Up here, we have enough problems of our own." );
   locals[45] = private[3];
   locals[24] = 8; // "What problems?"
   locals[46] = private[4];
   locals[25] = 9; // "Is there any way that thou canst help me?"
   locals[47] = 1;
   locals[26] = 10; // "Wouldst thou care to exchange items?"
   locals[48] = 1;
   locals[27] = 11; // "I thank thee for thy time."
   locals[28] = 0; // ""
   locals[66] = babl_fmenu( 0, &locals[24], &locals[45] );
   switch ( locals[66] ) {

   case 8:

      goto label_03c7;

   break;

   case 9:

      goto label_04f2;

   break;

   case 10:

      goto label_0584;

   break;

   case 11:

      func_00e0();
   break;

   } // end switch

   label_03c7:;

   label_03c7:;

   label_03c7:;

   private[3] = 0;
   if ( private[5] ) {

   } else {

      say( "Maybe ye can help us.  Our mines in the southeast have been invaded by a fearsome beast, floating in the air with many tentacles.  If ye can defeat it, all Mountainfolk would be eternally grateful." );
      locals[88] = 1;
      locals[67] = 13; // "I will go and slay it.  Farewell."
      locals[89] = private[2];
      locals[68] = 14; // "And hast thou heard aught of a kidnapped girl?"
      locals[90] = private[4];
      locals[69] = 15; // "Can any one of you help me with this task?"
      locals[91] = 1;
      locals[70] = 16; // "I would like to trade with thee first."
      locals[71] = 0; // ""
      locals[109] = babl_fmenu( 0, &locals[67], &locals[88] );
      switch ( locals[109] ) {

      case 13:

         func_00e0();
      break;

      case 14:

         goto label_0335;

      break;

      case 15:

         goto label_04f2;

      break;

      case 16:

         goto label_0584;

      } // end if

   break;

   } // end switch

   npc_attitude = 3;
   say( "Well, we've one less trouble now that ye've gone and slain that nasty beast.  Quite a valorous act it was.  If ye need our help, ye just let us know." );
   locals[131] = private[2];
   locals[110] = 18; // "Hast thou news of a girl who was kidnapped?"
   locals[132] = private[4];
   locals[111] = 19; // "I could use some general information."
   locals[133] = 1;
   locals[112] = 20; // "Perhaps we could trade with each other."
   locals[134] = 1;
   locals[113] = 21; // "Thank thee for thy kindness, and farewell."
   locals[114] = 0; // ""
   locals[152] = babl_fmenu( 0, &locals[110], &locals[131] );
   switch ( locals[152] ) {

   case 18:

      goto label_0335;

   break;

   case 19:

      goto label_04f2;

   break;

   case 20:

      goto label_0584;

   break;

   case 21:

      func_00e0();
   break;

   } // end switch

   label_04f2:;

   label_04f2:;

   label_04f2:;

   label_04f2:;

   private[4] = 0;
   say( "Ah, Shak may be the one ye want.  A smith he is, and knowledgable in the ways and workings of his trade and the world.  King Goldthirst ye should seek out too, if ye wish to gain his favor." );
   locals[174] = private[2];
   locals[153] = 23; // "Perhaps one of them knows of a kidnapped girl."
   locals[175] = private[3];
   locals[154] = 24; // "I may be able to offer my services in return."
   locals[176] = 1;
   locals[155] = 25; // "Shall we trade some items first?"
   locals[177] = 1;
   locals[156] = 26; // "I will do so.  I thank thee."
   locals[157] = 0; // ""
   locals[195] = babl_fmenu( 0, &locals[153], &locals[174] );
   switch ( locals[195] ) {

   case 23:

      goto label_0335;

   break;

   case 24:

      goto label_03c7;

   break;

   case 25:

      goto label_0584;

   break;

   case 26:

      func_00e0();
   break;

   } // end switch

   label_0584:;

   label_0584:;

   label_0584:;

   label_0584:;

   label_0584:;

   say( "Very well, let's see what ye got." );
   func_066e();
   say( "Goodbye, and good luck to ye." );
   func_00e0();
} // end func

void func_0591() {

   private[6][1] = 1001;
   private[6][2] = 1002;
   private[6][3] = 1003;
   private[6][4] = 1010;
   private[6][5] = 1016;
   private[6][6] = 1000;
   private[6][7] = -1;
   private[27][1] = 1019;
   private[27][2] = 1011;
   private[27][3] = 291;
   private[27][4] = 32;
   private[27][5] = 35;
   private[27][6] = 38;
   private[27][7] = 44;
   private[27][8] = -1;
   set_likes_dislikes( 2, 58, 37 );
} // end func

void func_061e() {

   int locals[22];

   if ( !func_0020() ) {

   } else {

      say( "Would ye like to trade items?" );
      locals[1] = 30; // "Yes."
      locals[2] = 31; // "No."
      locals[3] = 0; // ""
      locals[22] = babl_menu( 0, &locals[1] );
      switch ( locals[22] ) {

      case 1:

         func_066e();
      break;

      case 2:

         return;

      } // end if

   break;

   } // end switch

} // end func

void func_066e() {

   int locals[44];

   setup_to_barter( 0 );
   while ( !private[1] ) {

      locals[1] = 32; // "I make thee this offer."
      locals[2] = 33; // "I demand that thou givest me these items."
      locals[3] = 34; // "Excuse me, I must think about this deal."
      locals[4] = 35; // "I do not wish to barter any further."
      locals[5] = 0; // ""
      locals[22] = babl_menu( 0, &locals[1] );
      switch ( locals[22] ) {

      case 1:

         func_071f();
      break;

      case 2:

         func_0761();
      break;

      case 3:

         do_judgement( 0 );
      break;

      case 4:

         do_decline( 0 );
         private[1] = 1;
      break;

      } // end switch

   } // while

   locals[23] = 36; // "Farewell."
   locals[24] = 0; // ""
   locals[44] = babl_menu( 0, &locals[23] );
   if ( locals[44] == 1 ) {

      private[1] = 1;
   } // end if

} // end func

void func_071f() {

   int locals[5];

   locals[1] = 37; // "I accept your offer."
   locals[2] = 38; // "No, I do not like this deal."
   locals[3] = 39; // "Do ye take me for a fool?"
   locals[4] = 40; // "I am weary of this haggling."
   locals[5] = 41; // "Are ye joking with me?"
   if ( do_offer( 5, &locals[5], &locals[4], &locals[3], &locals[2], &locals[1] ) ) {

      private[1] = 1;
   } // end if

} // end func

void func_0761() {

   int locals[24];

   say( "Do ye intend to rob me?" );
   locals[1] = 43; // "Yes, I must."
   locals[2] = 44; // "No, thou dost misunderstand me."
   locals[3] = 0; // ""
   locals[22] = babl_menu( 0, &locals[1] );
   switch ( locals[22] ) {

   case 1:

   break;

   case 2:

      return;

   break;

   } // end switch

   locals[23] = 45; // "If ye insist, ye can have them."
   locals[24] = 46; // "No! Ye shall not take them!"
   if ( do_demand( 2, &locals[24], &locals[23] ) ) {

      private[1] = 1;
   } else {

      func_008b();
   } // end if

} // end func