Script Function: Q5S4

From Ultima Online: The Second Age
Jump to: navigation, search
 function int Q5S4(obj ship, int Q5M5, obj Q62O)
 {
   int Q4ID = Q5SM(ship, Q5M5);
   int Q58G = getMultiType(ship);
   loc Q4OI;
   loc Q4OJ;
   int Q5NC = getMultiExtents(Q58G, Q4OI, Q4OJ);
   int Q44G = getX(Q4OJ) - getX(Q4OI) + 0x01;
   int Q44I = getY(Q4OJ) - getY(Q4OI) + 0x01;
   loc Q5CP = getLocation(ship);
   int Q5EE = 0x00;
   int Q5EF = 0x00;
   switch (Q4ID)
   {
   case 0x00
   case 0x04
     Q5EF = Q44I;
     break;
   case 0x01
   case 0x03
   case 0x05
   case 0x07
     Q5EE = Q44G;
     Q5EF = Q44I;
     break;
   case 0x02
   case 0x06
     Q5EE = Q44G;
     break;
   default
     Q5EE = Q44G;
     Q5EF = Q44I;
     break;
   }
   int Q44F = 0x00;
   int Q44H = 0x00;
   switch (Q4ID)
   {
   case 0x00
     Q44H = 0x00;
     break;
   case 0x01
     Q44F = 0x02;
     Q44H = 0x00;
     break;
   case 0x02
     Q44F = 0x02;
     break;
   case 0x03
     Q44F = 0x02;
     Q44H = 0x04;
     break;
   case 0x04
     Q44H = 0x04;
     break;
   case 0x05
     Q44F = 0x06;
     Q44H = 0x04;
     break;
   case 0x06
     Q44F = 0x06;
     break;
   case 0x07
     Q44F = 0x06;
     Q44H = 0x00;
     break;
   default
     break;
   }
   for(; Q5EE > 0x00; Q5EE--)
   {
     moveDir(Q5CP, Q44F);
   }
   for(; Q5EF > 0x00; Q5EF--)
   {
     moveDir(Q5CP, Q44H);
   }
   if (isInMap(Q5CP))
   {
     if (hasObjVar(Q62O, "oldshipcommand"))
     {
       removeObjVar(Q62O, "oldshipcommand");
     }
     int Q5ND = moveMultiCheck(ship, Q5CP, Q43W);
     Q65T = 0x01;
     return (Q5ND);
   }
   Q5RY(ship);
   return (moveMultiMapSwitch(ship, Q5CP, Q43W));
 }