the cutting room mirror

186

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 #186
// string block 0x0eba (3770), name Folina
// 
// 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_0293();
   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_goal = 6;
   func_0012();
} // end func

void func_0072() {

   npc_goal = 1;
   func_0012();
} // end func

void func_0081() {

   npc_gtarg = 1;
   npc_goal = 5;
   npc_attitude = 1;
   func_0012();
} // end func

void func_009a() {

   npc_attitude = 6;
} // end func

void func_00a7() {

   npc_attitude = param1[0]play_hunger;
   func_0012();
} // end func

void func_00b8() {

   npc_attitude = 2;
   func_0012();
} // end func

void func_00c7() {

   npc_attitude = 1;
   func_0012();
} // end func

void func_00d6() {

   func_0012();
} // end func

void func_00e0() {

   param1[1] = game_days;
   param1[2] = game_mins;
} // end func

void func_00fc() {

   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_0185() {

   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_0239() {

   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_0293() {

   int locals[23];

   if ( private[0] ) {

      func_0485();
   } else {

      private[2] = 0;
      private[3] = 0;
      private[4] = 0;
      say( "Hello, adventurer.  I don't suppose thou canst help me." );
      locals[1] = 2; // "Well, what is thy problem?"
      locals[2] = 3; // "No, I probably can't."
      locals[3] = 0; // ""
      locals[22] = babl_menu( 0, &locals[1] );
      switch ( locals[22] ) {

      case 1:

         func_02fc();
      break;

      case 2:

         locals[23] = 1;
         func_00a7( &locals[23] );
      } // end if

   break;

   } // end switch

} // end func

void func_02fc() {

   int locals[22];

   private[3] = 1;
   say( "I've lost the ability to levitate, so I can no longer cross lava with ease.  I need to cross some lava, and the only thing that could now help me would be a pair of dragonskin boots.  Canst thou help me?" );
   locals[1] = 5; // "Certainly, here you go."
   locals[2] = 6; // "Sorry, I can't help you."
   locals[3] = 7; // "I don't know what you're talking about."
   locals[4] = 0; // ""
   locals[22] = babl_menu( 0, &locals[1] );
   switch ( locals[22] ) {

   case 1:

      func_035d();
   break;

   case 2:

      func_0427();
   break;

   case 3:

      func_043d();
   break;

   } // end switch

} // end func

void func_035d() {

   int locals[39];

   locals[15] = 0;
   locals[13] = show_inv( 2, &locals[6], &locals[1] );
   while ( locals[13] > 0 ) {

      locals[14] = 1;
      if ( locals[14] <= locals[13] ) {

         if ( locals[0] == 47 ) {

            locals[15] = locals[14];
            locals[11] = locals[5];
         } // end if

         locals[14] = locals[14] + 1;
      } // while

   } // end if

   if ( locals[15] > 0 ) {

      locals[16] = 1;
      give_to_npc( 2, &locals[11], &locals[16] );
      private[2] = 1;
      say( "I thank thee kindly!" );
      locals[17] = 3;
      func_00a7( &locals[17] );
   } else {

      say( "I'm sorry, but those don't look like dragonskin boots to me." );
      locals[18] = 10; // "Oh, here they are."
      locals[19] = 11; // "Sorry, I don't have any."
      locals[20] = 0; // ""
      locals[39] = babl_menu( 0, &locals[18] );
      switch ( locals[39] ) {

      case 1:

         func_035d();
      break;

      case 2:

         func_0427();
      } // end if

   break;

   } // end switch

} // end func

void func_0427() {

   int locals[1];

   say( "That's too bad.  I could really use a pair." );
   locals[1] = 1;
   func_00a7( &locals[1] );
} // end func

void func_043d() {

   int locals[22];

   say( "It is said that dragonskin boots allow the wearer to walk over lava without pain.  Do you have a pair that you can spare?" );
   locals[1] = 14; // "Yes I do, here they are."
   locals[2] = 15; // "No, I'm sorry."
   locals[3] = 0; // ""
   locals[22] = babl_menu( 0, &locals[1] );
   switch ( locals[22] ) {

   case 1:

      func_035d();
   break;

   case 2:

      func_0427();
   break;

   } // end switch

} // end func

void func_0485() {

   int locals[66];

   if ( private[2] ) {

      say( "Hello again!  Again, I thank thee kindly for the boots!  Good luck in your travels." );
      locals[1] = 17; // "I thank thee for thy kind wishes."
      locals[2] = 18; // "Thou art welcome, but now I need the boots myself."
      locals[3] = 0; // ""
      locals[22] = babl_menu( 0, &locals[1] );
      switch ( locals[22] ) {

      case 1:

         locals[23] = 3;
         func_00a7( &locals[23] );
      break;

      case 2:

         func_054d();
      } // end if

   } else {

   break;

   } // end switch

   say( "Hello, @GS8!  Hast thou decided to help me?" );
   locals[45] = 1;
   locals[24] = 20; // "What was the help thou wert seeking?"
   locals[46] = private[3];
   locals[25] = 21; // "Yes, here are the boots thou seekest."
   locals[47] = 1;
   locals[26] = 22; // "No, I still cannot."
   locals[27] = 0; // ""
   locals[66] = babl_fmenu( 0, &locals[24], &locals[45] );
   switch ( locals[66] ) {

   case 20:

      func_02fc();
   break;

   case 21:

      func_035d();
   break;

   case 22:

      func_0427();
   break;

   } // end switch

} // end func

void func_054d() {

   int locals[23];

   say( "But I still have need of them!  I will give them back to thee when I am done with them." );
   locals[1] = 24; // "Very well."
   locals[2] = 25; // "How long will you be needing them?"
   locals[3] = 0; // ""
   locals[22] = babl_menu( 0, &locals[1] );
   switch ( locals[22] ) {

   case 1:

      locals[23] = 3;
      func_00a7( &locals[23] );
   break;

   case 2:

      func_059e();
   break;

   } // end switch

} // end func

void func_059e() {

   int locals[1];

   say( "Not more than two or three months.  I thank thee again!" );
   locals[1] = 3;
   func_00a7( &locals[1] );
} // end func

void func_05b4() {

   int locals[44];

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

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

      case 1:

         func_0665();
      break;

      case 2:

         func_06b6();
      break;

      case 3:

         do_judgement( 0 );
      break;

      case 4:

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

      } // end switch

   } // while

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

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

} // end func

void func_0665() {

   int locals[14];

   locals[0] = -1;
   locals[6] = -1;
   locals[11] = 32; // "I accept thy offer."
   locals[12] = 33; // "No, I do not like this deal."
   locals[13] = 34; // "Dost thou take me for a fool?"
   locals[14] = 35; // "I am weary of this haggling."
   if ( do_offer( 6, &locals[14], &locals[13], &locals[12], &locals[11], &locals[6], &locals[1] ) ) {

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

} // end func

void func_06b6() {

   int locals[24];

   say( "Dost thou intend to rob me?" );
   locals[1] = 37; // "Yes, I must."
   locals[2] = 38; // "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] = 39; // "If thou dost insist, thou canst have them."
   locals[24] = 40; // "No! Thou shalt not take them!"
   if ( do_demand( 2, &locals[24], &locals[23] ) ) {

      private[1] = 1;
   } else {

      func_0081();
   } // end if

} // end func