the cutting room mirror

11

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 #11
// string block 0x0e0b (3595), name Thorlson
// 
// 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[22];

   if ( private[0] == 1 ) {

      func_0474();
   } else {

      say( "Greetings.  I am Thorlson." );
      locals[1] = 2; // "Well met, Thorlson."
      locals[2] = 3; // "Why dost thou bother me, Thorlson?"
      locals[3] = 4; // "Good day.  What can I do for thee?"
      locals[4] = 0; // ""
      locals[22] = babl_menu( 0, &locals[1] );
      switch ( locals[22] ) {

      case 1:

         func_02fd();
      break;

      case 2:

         func_0408();
      break;

      case 3:

         func_03ac();
      } // end if

   break;

   } // end switch

} // end func

void func_02fd() {

   int locals[22];

   say( "Well met indeed.  Thou'rt a courteous one.  May I ask a favor of thee?" );
   locals[1] = 6; // "Ask, and it shall be granted."
   locals[2] = 7; // "If it be in my power, and not against mine oaths."
   locals[3] = 8; // "Nay.  I am too busy to help thee."
   locals[4] = 0; // ""
   locals[22] = babl_menu( 0, &locals[1] );
   switch ( locals[22] ) {

   case 1:

      func_0359();
   break;

   case 2:

      func_03ac();
   break;

   case 3:

      func_0408();
   break;

   } // end switch

} // end func

void func_0359() {

   int locals[22];

   say( "Any favor at all?" );
   locals[1] = 10; // "Of course."
   locals[2] = 11; // "If it be in my power, and not against mine oaths."
   locals[3] = 0; // ""
   locals[22] = babl_menu( 0, &locals[1] );
   switch ( locals[22] ) {

   case 1:

      func_03a1();
   break;

   case 2:

      func_03ac();
   break;

   } // end switch

} // end func

void func_03a1() {

   say( "Then slay me, for I hunger for death in battle." );
} // end func

void func_03ac() {

   int locals[22];

   say( "My death approaches, and dying in bed is dying accursed. Wilt fight me, that I may die honorably in battle?" );
   locals[1] = 14; // "Assuredly, if that be thy wish."
   locals[2] = 15; // "Nay.  Though it be thy will, I cannot grant it."
   locals[3] = 16; // "By mine oaths, I may not slay thee out of hand."
   locals[4] = 0; // ""
   locals[22] = babl_menu( 0, &locals[1] );
   switch ( locals[22] ) {

   case 1:

      func_03a1();
   break;

   case 2:

      func_0408();
   break;

   case 3:

      func_0415();
   break;

   } // end switch

} // end func

void func_0408() {

   say( "Thou fool!" );
   func_00c7();
} // end func

void func_0415() {

   int locals[22];

   say( "Perhaps thou canst help me find honorable death in some other manner?" );
   locals[1] = 19; // "Certainly.  Follow me and thou shalt have all the peril thou should want."
   locals[2] = 20; // "Begone from my sight, old fool!"
   locals[3] = 21; // "Nay.  I simply cannot help thee."
   locals[4] = 0; // ""
   locals[22] = babl_menu( 0, &locals[1] );
   switch ( locals[22] ) {

   case 1:

      func_009a();
   break;

   case 2:

      func_0408();
   break;

   case 3:

      say( "Then I am lost!" );
      func_0063();
   break;

   } // end switch

} // end func

void func_0474() {

   int locals[24];

   locals[1] = npc_attitude + 1;
   if ( locals[1] > 3 ) {

      locals[1] = 3;
   } // end if

   locals[2] = locals[1];
   if ( 1 == locals[2] ) {

      say( "What dost thou here?  Dost mean to insult me again?" );
   } else {

      if ( 2 == locals[2] ) {

         say( "Hast thou reconsidered?  Wilt thou slay me after all?" );
      } else {

         if ( 3 == locals[2] ) {

            say( "What is it, my friend?" );
         } // end if

      } // end if

   } // end if

   locals[3] = 26; // "But follow me and battle-death shall be thine."
   locals[4] = 27; // "It is not my place to kill you, old man."
   locals[5] = 28; // "Thou art a fool to waste thy life, twice so to pester me! "
   locals[6] = 30; // "Aye.  I shall slay thee."
   locals[7] = 0; // ""
   locals[24] = babl_menu( 0, &locals[3] );
   switch ( locals[24] ) {

   case 1:

      func_009a();
   break;

   case 2:

      func_0408();
   break;

   case 3:

      say( "Goodbye." );
      func_00b8();
   break;

   case 4:

      func_0081();
   break;

   } // end switch

} // end func