Advertisement
Guest User

Untitled

a guest
Oct 5th, 2014
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.68 KB | None | 0 0
  1. VOID Lock( MHS_ADDRESS aAddress, INT iItemSize ) {
  2.     // the following is the declaration for the HP of all the possible ships
  3.     float maxHP[59] = {
  4.         12000,110,72000,150,6000,16000,300,17600,8000,1700,90000,325,160,15000,900,160,110,1800,42000,
  5.         160000,1400,800,800,1200,7500,10800,13600,1500,4500,44000,16000,-1,38,450000,18000,225,12400,
  6.         1400,96000,1100,550,7000,112000,15200,400,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  7.         };
  8.     // the following is the declaration for the fuel of all the possible ships
  9.     float maxFuel[59] = {
  10.         0,14000,0,10000,0,0,12000,0,0,20000,0,14000,14000,0,20000,8000,14000,20000,0,0,20000,0,0,0,0,0,
  11.         0,20000,0,0,0,-1,1600000,0,0,30000,0,30000,0,30000,4000,0,0,0,4000,-1,-1,-1,-1,-1,-1,-1,-1,-1,
  12.         -1,-1,-1,-1,-1
  13.         };
  14.    
  15.     // the offset of the ship Linked List
  16.     int shipListPtr = 0x008B9444;
  17.            
  18.     // begin the processing of each entity in the linked list
  19.     extern int firstNodePtr = { "",  shipListPtr };
  20.     int curNodePtr = firstNodePtr;
  21.    
  22.     // enter the loop, and continue with it so long as the current node pointer is not null
  23.     while (curNodePtr != 0) {
  24.         // get the pointer to the next node in the list
  25.         extern int nextNodePtr = { "", curNodePtr + 0x0 };
  26.         // get the object type
  27.         extern int objtype = { "", curNodePtr + 0x10 };
  28.         // check the object type, if it's a ship, then continue
  29.         if (objtype == 0) {
  30.             // the object is a ship, now we need to check if the ship belongs to the player
  31.             extern int playerownerPtr = { "", curNodePtr + 0x2C0 };
  32.             // get the AI pointer, if it's null, then it should be a player ship
  33.             extern int aiPlayerPtr = { "", playerownerPtr + 0x10 };
  34.             // if the aiPlayerPtr == 0 then proceed
  35.             if (aiPlayerPtr == 0) {
  36.                 // get the ship's health and fuel
  37.                 extern float health = { "", curNodePtr + 0x14C };
  38.                 extern float fuel = { "", curNodePtr + 0x2C8 };
  39.                 extern int shipType = { "", curNodePtr + 0x244 };
  40.                
  41.                 float newHealth = maxHP[shipType];
  42.                 float newFuel = maxFuel[shipType];
  43.                
  44.                 // if  newHealth != -1 then set it
  45.                 if (newHealth != -1) {
  46.                     health = newHealth;
  47.                 }
  48.                 // if newFuel != -1 then set it
  49.                 if (newFuel != -1) {
  50.                     fuel = newFuel;
  51.                 }
  52.             }
  53.            
  54.         }        
  55.                
  56.         // advance to the next node in the list
  57.         curNodePtr = nextNodePtr;
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement