Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VOID Lock( MHS_ADDRESS aAddress, INT iItemSize ) {
- // the following is the declaration for the HP of all the possible ships
- float maxHP[59] = {
- 12000,110,72000,150,6000,16000,300,17600,8000,1700,90000,325,160,15000,900,160,110,1800,42000,
- 160000,1400,800,800,1200,7500,10800,13600,1500,4500,44000,16000,-1,38,450000,18000,225,12400,
- 1400,96000,1100,550,7000,112000,15200,400,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
- };
- // the following is the declaration for the fuel of all the possible ships
- float maxFuel[59] = {
- 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,
- 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,
- -1,-1,-1,-1,-1
- };
- // the offset of the ship Linked List
- int shipListPtr = 0x008B9444;
- // begin the processing of each entity in the linked list
- extern int firstNodePtr = { "", shipListPtr };
- int curNodePtr = firstNodePtr;
- // enter the loop, and continue with it so long as the current node pointer is not null
- while (curNodePtr != 0) {
- // get the pointer to the next node in the list
- extern int nextNodePtr = { "", curNodePtr + 0x0 };
- // get the object type
- extern int objtype = { "", curNodePtr + 0x10 };
- // check the object type, if it's a ship, then continue
- if (objtype == 0) {
- // the object is a ship, now we need to check if the ship belongs to the player
- extern int playerownerPtr = { "", curNodePtr + 0x2C0 };
- // get the AI pointer, if it's null, then it should be a player ship
- extern int aiPlayerPtr = { "", playerownerPtr + 0x10 };
- // if the aiPlayerPtr == 0 then proceed
- if (aiPlayerPtr == 0) {
- // get the ship's health and fuel
- extern float health = { "", curNodePtr + 0x14C };
- extern float fuel = { "", curNodePtr + 0x2C8 };
- extern int shipType = { "", curNodePtr + 0x244 };
- float newHealth = maxHP[shipType];
- float newFuel = maxFuel[shipType];
- // if newHealth != -1 then set it
- if (newHealth != -1) {
- health = newHealth;
- }
- // if newFuel != -1 then set it
- if (newFuel != -1) {
- fuel = newFuel;
- }
- }
- }
- // advance to the next node in the list
- curNodePtr = nextNodePtr;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement