diff --git a/TR5Main/Game/Box.h b/TR5Main/Game/Box.h index feece72b5..1b1d95d7c 100644 --- a/TR5Main/Game/Box.h +++ b/TR5Main/Game/Box.h @@ -1,12 +1,175 @@ #pragma once +#include "phd_global.h" +#include "items.h" +#include "level.h" -#include "..\Global\global.h" +typedef enum MOOD_TYPE +{ + BORED_MOOD, + ATTACK_MOOD, + ESCAPE_MOOD, + STALK_MOOD +}; + +typedef enum TARGET_TYPE +{ + NO_TARGET, + PRIME_TARGET, + SECONDARY_TARGET +}; + +typedef enum ZONE_TYPE +{ + ZONE_NULL = -1, // default zone + ZONE_SKELLY = 0, + ZONE_BASIC, + ZONE_FLYER, + ZONE_HUMAN_CLASSIC, + ZONE_WATER, + ZONE_MAX, + /// custom zone (using zone above for LOT.zone): + ZONE_HUMAN_JUMP_AND_MONKEY, + ZONE_HUMAN_JUMP, + ZONE_SPIDER, + ZONE_BLOCKABLE, // for trex, shiva, etc.. + ZONE_SOPHIALEE, // dont want sophia to go down again ! + ZONE_APE, // only 2 click climb +}; + +typedef struct BOX_NODE +{ + short exitBox; + unsigned short searchNumber; + short nextExpansion; + short boxNumber; +}; + +typedef struct BOX_INFO +{ + unsigned char left; + unsigned char right; + unsigned char top; + unsigned char bottom; + short height; + short overlapIndex; +}; + +typedef struct AI_INFO +{ + short zoneNumber; + short enemyZone; + int distance; + int ahead; + int bite; + short angle; + short xAngle; + short enemyFacing; +}; + +typedef struct BITE_INFO +{ + int x; + int y; + int z; + int meshNum; +}; + +typedef struct LOT_INFO +{ + BOX_NODE* node; + short head; + short tail; + unsigned short searchNumber; + unsigned short blockMask; + short step; + short drop; + short zoneCount; + short targetBox; + short requiredBox; + short fly; + bool canJump; + bool canMonkey; + bool isAmphibious; + bool isJumping; + bool isMonkeying; + PHD_VECTOR target; + ZONE_TYPE zone; +}; + +typedef struct CREATURE_INFO +{ + short jointRotation[4]; + short maximumTurn; + short flags; + bool alerted; + bool headLeft; + bool headRight; + bool reachedGoal; + bool hurtByLara; + bool patrol2; + bool jumpAhead; + bool monkeyAhead; + MOOD_TYPE mood; + ITEM_INFO* enemy; + ITEM_INFO aiTarget; + short pad; + short itemNum; + PHD_VECTOR target; + LOT_INFO LOT; +}; + +#define CreatureEffectFunction short(int x, int y, int z, short speed, short yRot, short roomNumber) +#define XZ_GET_SECTOR(room, x, z) (room->floor[((z) >> WALL_SHIFT) + ((x) >> WALL_SHIFT) * room->xSize]) + +constexpr auto UNIT_SHADOW = 256; +constexpr auto NO_SHADOW = 0; +constexpr auto DEFAULT_RADIUS = 10; +constexpr auto ROT_X = 0x0004; +constexpr auto ROT_Y = 0x0008; +constexpr auto ROT_Z = 0x0010; +constexpr auto BOX_BLOCKED = (1 << 14); // unpassable for other enemies, always set for movable blocks & closed doors +constexpr auto BOX_LAST = (1 << 15); // unpassable by large enemies (T-Rex, Centaur, etc), always set behind doors +constexpr auto TIMID = 0; +constexpr auto VIOLENT = 1; +constexpr auto ONESHOT = 0x100; +constexpr auto DATA_TYPE = 0x1F; +constexpr auto DATA_TILT = 0xF; // tile type (FLOOR_TYPE enum) +constexpr auto DATA_STATIC = 0xFF; // probably add static collision +constexpr auto END_BIT = 0x8000; +constexpr auto VALUE_BITS = 0x3FF; +constexpr auto CODE_BITS = 0x3E00; +constexpr auto REVERSE = 0x4000; +constexpr auto SWONESHOT = 0x40; +constexpr auto ATONESHOT = 0x80; +constexpr auto BLOCKABLE = 0x8000; +constexpr auto BLOCKED = 0x4000; +constexpr auto OVERLAP_INDEX = 0x3FFF; +constexpr auto SEARCH_NUMBER = 0x7FFF; +constexpr auto BLOCKED_SEARCH = 0x8000; +constexpr auto NO_BOX = 0x7FF; +constexpr auto BOX_JUMP = 0x800; +constexpr auto BOX_MONKEY = 0x2000; +constexpr auto BOX_NUMBER = 0x7FF; +constexpr auto BOX_END_BIT = 0x8000; +constexpr auto EXPAND_LEFT = 0x1; +constexpr auto EXPAND_RIGHT = 0x2; +constexpr auto EXPAND_TOP = 0x4; +constexpr auto EXPAND_BOTTOM = 0x8; +constexpr auto NO_FLYING = 0; +constexpr auto FLY_ZONE = 0x2000; +constexpr auto CLIP_LEFT = 0x1; +constexpr auto CLIP_RIGHT = 0x2; +constexpr auto CLIP_TOP = 0x4; +constexpr auto CLIP_BOTTOM = 0x8; +constexpr auto SECONDARY_CLIP = 0x10; +constexpr auto ALL_CLIP = (CLIP_LEFT | CLIP_RIGHT | CLIP_TOP | CLIP_BOTTOM); +constexpr auto SLOPE_DIF = 60; extern int NumberBoxes; extern BOX_INFO* Boxes; extern int NumberOverlaps; extern short* Overlaps; -extern short* Zones[5][2]; +extern short* Zones[ZONE_MAX][2]; void GetCreatureMood(ITEM_INFO* item, AI_INFO* info, int violent); void CreatureMood(ITEM_INFO* item, AI_INFO* info, int violent); @@ -22,8 +185,8 @@ short AIGuard(CREATURE_INFO* creature); void AlertNearbyGuards(ITEM_INFO* item); void AlertAllGuards(short itemNumber); void CreatureKill(ITEM_INFO* item, int killAnim, int killState, short laraAnim); -short CreatureEffect2(ITEM_INFO* item, BITE_INFO* bite, short damage, short angle, short (*generate)(int x, int y, int z, short speed, short yrot, short roomNumber)); -short CreatureEffect(ITEM_INFO* item, BITE_INFO* bite, short(*generate)(int x, int y, int z, short speed, short yrot, short roomNumber)); +short CreatureEffect2(ITEM_INFO* item, BITE_INFO* bite, short damage, short angle, function func); +short CreatureEffect(ITEM_INFO* item, BITE_INFO* bite, function func); void CreatureUnderwater(ITEM_INFO* item, int depth); void CreatureFloat(short itemNumber); void CreatureJoint(ITEM_INFO* item, short joint, short required); diff --git a/TR5Main/Game/box.cpp b/TR5Main/Game/box.cpp index 03e01c4ed..3be3bdbee 100644 --- a/TR5Main/Game/box.cpp +++ b/TR5Main/Game/box.cpp @@ -1,34 +1,33 @@ +#include "framework.h" #include "box.h" -#include "..\Global\global.h" -#include "items.h" #include "tomb4fx.h" #include "lot.h" -#include "deltapak.h" -#include "items.h" #include "Lara.h" #include "draw.h" #include "sphere.h" #include "misc.h" #include "camera.h" #include "control.h" -#include "../Specific/setup.h" -#include "../Specific/level.h" +#include "setup.h" +#include "trmath.h" +#include "objectslist.h" int NumberBoxes; BOX_INFO* Boxes; int NumberOverlaps; short* Overlaps; -short* Zones[5][2]; +short* Zones[ZONE_MAX][2]; -#define ESCAPE_DIST (WALL_SIZE*5) -#define STALK_DIST (WALL_SIZE*3) +#define CHECK_CLICK(x) CLICK(x) / 2 +#define ESCAPE_DIST SECTOR(5) +#define STALK_DIST SECTOR(3) #define REACHED_GOAL_RADIUS 640 -#define ATTACK_RANGE SQUARE(WALL_SIZE*3) +#define ATTACK_RANGE SQUARE(SECTOR(3)) #define ESCAPE_CHANCE 0x800 #define RECOVER_CHANCE 0x100 #define BIFF_AVOID_TURN 1536 #define FEELER_DISTANCE 512 -#define FEELER_ANGLE ANGLE(45) +#define FEELER_ANGLE ANGLE(45.0f) void DropBaddyPickups(ITEM_INFO* item) { @@ -124,7 +123,7 @@ short SameZone(CREATURE_INFO* creature, ITEM_INFO* targetItem) targetItem->boxNumber = XZ_GET_SECTOR(r, targetItem->pos.xPos - r->x, targetItem->pos.zPos - r->z).box; zone = Zones[creature->LOT.zone][FlipStatus]; - return (zone[item->boxNumber] == zone[targetItem->boxNumber]); + return zone[item->boxNumber] == zone[targetItem->boxNumber]; } short AIGuard(CREATURE_INFO* creature) @@ -160,7 +159,7 @@ short AIGuard(CREATURE_INFO* creature) if (creature->headRight) return 0; - return -ANGLE(90); + return -ANGLE(90.0f); } void AlertNearbyGuards(ITEM_INFO* item) @@ -249,9 +248,9 @@ void CreatureKill(ITEM_INFO* item, int killAnim, int killState, short laraKillSt Camera.pos.roomNumber = LaraItem->roomNumber; Camera.type = CHASE_CAMERA; - Camera.flags = FOLLOW_CENTRE; - Camera.targetAngle = ANGLE(170); - Camera.targetElevation = -ANGLE(25); + Camera.flags = CF_FOLLOW_CENTER; + Camera.targetAngle = ANGLE(170.0f); + Camera.targetElevation = -ANGLE(25.0f); // TODO: exist in TR5 but just commented in case. /* @@ -263,24 +262,24 @@ void CreatureKill(ITEM_INFO* item, int killAnim, int killState, short laraKillSt */ } -short CreatureEffect2(ITEM_INFO* item, BITE_INFO* bite, short damage, short angle, short (*generate)(int x, int y, int z, short speed, short yrot, short roomNumber)) +short CreatureEffect2(ITEM_INFO* item, BITE_INFO* bite, short damage, short angle, function func) { PHD_VECTOR pos; pos.x = bite->x; pos.y = bite->y; pos.z = bite->z; GetJointAbsPosition(item, &pos, bite->meshNum); - return generate(pos.x, pos.y, pos.z, damage, angle, item->roomNumber); + return func(pos.x, pos.y, pos.z, damage, angle, item->roomNumber); } -short CreatureEffect(ITEM_INFO* item, BITE_INFO* bite, short(*generate)(int x, int y, int z, short speed, short yrot, short roomNumber)) +short CreatureEffect(ITEM_INFO* item, BITE_INFO* bite, function func) { PHD_VECTOR pos; pos.x = bite->x; pos.y = bite->y; pos.z = bite->z; GetJointAbsPosition(item, &pos, bite->meshNum); - return generate(pos.x, pos.y, pos.z, item->speed, item->pos.yRot, item->roomNumber); + return func(pos.x, pos.y, pos.z, item->speed, item->pos.yRot, item->roomNumber); } void CreatureUnderwater(ITEM_INFO* item, int depth) @@ -334,7 +333,7 @@ void CreatureFloat(short itemNumber) short roomNumber; item = &Items[itemNumber]; - item->hitPoints = -16384; + item->hitPoints = NOT_TARGETABLE; item->pos.xRot = 0; waterLevel = GetWaterHeight(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber); @@ -360,7 +359,7 @@ void CreatureFloat(short itemNumber) { item->pos.yPos = waterLevel; item->collidable = false; - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; DisableBaddieAI(itemNumber); RemoveActiveItem(itemNumber); item->afterDeath = 1; @@ -536,7 +535,7 @@ int CreatureAnimation(short itemNumber, short angle, short tilt) } AnimateItem(item); - if (item->status == ITEM_DEACTIVATED) + if (item->status == ITEM_DESACTIVATED) { CreatureDie(itemNumber, FALSE); return FALSE; diff --git a/TR5Main/Game/bubble.cpp b/TR5Main/Game/bubble.cpp index aec3e5e18..2fd65c839 100644 --- a/TR5Main/Game/bubble.cpp +++ b/TR5Main/Game/bubble.cpp @@ -1,8 +1,9 @@ +#include "framework.h" #include "bubble.h" -#include "../Specific/level.h" +#include "level.h" #include "control.h" - -using namespace std; +#include "trmath.h" +#include "objectslist.h" extern vector Bubbles = vector(MAX_BUBBLES); @@ -57,16 +58,19 @@ int GetFreeBubble() //8BEAC(<), 8DEF0(<) (F) { int oldestAgeIndex = 0; int oldestAge = 0; - for (int i = 0; i < MAX_BUBBLES; i++) { + for (int i = 0; i < MAX_BUBBLES; i++) + { BUBBLE_STRUCT* bub = &Bubbles[i]; - if (!bub->active) { + if (!bub->active) return i; - } - if (oldestAge < bub->age) { + + if (oldestAge < bub->age) + { oldestAge = bub->age; oldestAgeIndex = i; } } + //incase we dont find any non-active bubble, take the one with the oldest age return oldestAgeIndex; } diff --git a/TR5Main/Game/bubble.h b/TR5Main/Game/bubble.h index 019fa6241..7d0e86320 100644 --- a/TR5Main/Game/bubble.h +++ b/TR5Main/Game/bubble.h @@ -1,9 +1,4 @@ #pragma once -#include -#include -#include -#include "../Global/types.h" -#include "../Global/constants.h" #include "effect2.h" constexpr float MAX_BUBBLES = 256; @@ -13,14 +8,14 @@ constexpr int BUBBLE_FLAG_HIGH_AMPLITUDE = 0x4; struct BUBBLE_STRUCT { - DirectX::SimpleMath::Vector4 color; - DirectX::SimpleMath::Vector4 sourceColor; - DirectX::SimpleMath::Vector4 destinationColor; - DirectX::SimpleMath::Vector3 worldPositionCenter; // goes straight up - DirectX::SimpleMath::Vector3 worldPosition; // actual position with wave motion - DirectX::SimpleMath::Vector3 amplitude; - DirectX::SimpleMath::Vector3 wavePeriod; - DirectX::SimpleMath::Vector3 waveSpeed; + Vector4 color; + Vector4 sourceColor; + Vector4 destinationColor; + Vector3 worldPositionCenter; // goes straight up + Vector3 worldPosition; // actual position with wave motion + Vector3 amplitude; + Vector3 wavePeriod; + Vector3 waveSpeed; float speed; float size; float destinationSize; diff --git a/TR5Main/Game/camera.cpp b/TR5Main/Game/camera.cpp index d17b57c8e..8a5add292 100644 --- a/TR5Main/Game/camera.cpp +++ b/TR5Main/Game/camera.cpp @@ -1,20 +1,19 @@ -#include "Camera.h" -#include -#include +#include "framework.h" +#include "camera.h" #include "draw.h" #include "lara.h" -#include "effects.h" +#include "effect.h" #include "effect2.h" #include "debris.h" #include "larafire.h" #include "lara.h" #include "flmtorch.h" #include "sphere.h" -#include "../Specific/level.h" +#include "level.h" #include "collide.h" #include "sound.h" #include "savegame.h" -#include "../Specific/input.h" +#include "input.h" struct OLD_CAMERA { @@ -1097,7 +1096,7 @@ void LookCamera(ITEM_INFO* item) c = GetCeiling(floor, x, y, z); if ((Rooms[roomNumber].flags & ENV_FLAG_SWAMP)) Camera.pos.y = Rooms[roomNumber].y - 256; - else if (y < c || y > h || c >= h || h == NO_HEIGHT || c == NO_HEIGHT) + else if (y < c || y > h || c >= h || h == NO_HEIGHT || c == NO_HEIGHT) mgLOS(&Camera.target, &Camera.pos, 0); x = Camera.pos.x; @@ -1492,7 +1491,7 @@ void ConfirmCameraTargetPos() pos.y = 0; pos.z = 0; - GetLaraJointPosition(&pos, LM_LHAND); + GetLaraJointPosition(&pos, LM_TORSO); if (Camera.laraNode != -1) { @@ -1699,7 +1698,7 @@ void CalculateCamera() Camera.target.y = y; if (Camera.type - && Camera.flags != CHASE_OBJECT + && Camera.flags != CF_CHASE_OBJECT && (Camera.number != -1 &&(SniperCamActive = Camera.fixed[Camera.number].flags & 3, Camera.fixed[Camera.number].flags & 2))) { PHD_VECTOR pos; @@ -1772,7 +1771,7 @@ void CalculateCamera() Camera.target.z = LastTarget.z; } - if (Camera.type && Camera.flags != CHASE_OBJECT) + if (Camera.type && Camera.flags != CF_CHASE_OBJECT) FixedCamera(item); else ChaseCamera(item); diff --git a/TR5Main/Game/camera.h b/TR5Main/Game/camera.h index 3edc7017f..bb79c1a23 100644 --- a/TR5Main/Game/camera.h +++ b/TR5Main/Game/camera.h @@ -1,7 +1,57 @@ #pragma once +#include "phd_global.h" +#include "items.h" -#include "..\Global\global.h" -#include +typedef enum CAMERA_TYPE +{ + CHASE_CAMERA, + FIXED_CAMERA, + LOOK_CAMERA, + COMBAT_CAMERA, + CINEMATIC_CAMERA, + HEAVY_CAMERA +}; + +typedef struct CAMERA_INFO +{ + GAME_VECTOR pos; // size=16, offset=0 + GAME_VECTOR target; // size=16, offset=16 + CAMERA_TYPE type; // size=4, offset=32 + CAMERA_TYPE oldType; // size=4, offset=36 + int shift; // size=0, offset=40 + int flags; // size=0, offset=44 + int fixedCamera; // size=0, offset=48 + int numberFrames; // size=0, offset=52 + int bounce; // size=0, offset=56 + int underwater; // size=0, offset=60 + int targetDistance; // size=0, offset=64 + short targetAngle; // size=0, offset=68 + short targetElevation; // size=0, offset=70 + short actualElevation; // size=0, offset=72 + short actualAngle; // size=0, offset=74 + short laraNode; // size=0, offset=76 + short box; // size=0, offset=78 + short number; // size=0, offset=80 + short last; // size=0, offset=82 + short timer; // size=0, offset=84 + short speed; // size=0, offset=86 + short targetspeed; // size=0, offset=88 + ITEM_INFO* item; // size=144, offset=92 + ITEM_INFO* lastItem; // size=144, offset=96 + OBJECT_VECTOR* fixed; // size=16, offset=100 + int mikeAtLara; // size=0, offset=104 + PHD_VECTOR mikePos; // size=12, offset=108 +}; + +enum CAMERA_FLAGS +{ + CF_FOLLOW_CENTER = 1, + CF_NO_CHUNKY = 2, + CF_CHASE_OBJECT = 3, +}; + +constexpr auto MAX_CAMERA = 18; +constexpr auto NO_MINY = 0xFFFFFF; extern PHD_VECTOR CurrentCameraPosition; extern CAMERA_INFO Camera; diff --git a/TR5Main/Game/collide.cpp b/TR5Main/Game/collide.cpp index 34deb4e43..944a062c9 100644 --- a/TR5Main/Game/collide.cpp +++ b/TR5Main/Game/collide.cpp @@ -1,34 +1,32 @@ +#include "framework.h" #include "collide.h" #include "draw.h" #include "Lara.h" - -#include "..\Global\global.h" - -#include #include "items.h" -#include "effects.h" +#include "effect.h" #include "sphere.h" #include "misc.h" -#include "../Specific/setup.h" -#include "../Specific/level.h" +#include "setup.h" #include "sound.h" +#include "trmath.h" -char LM[] = { - LJ_HIPS, - LJ_LTHIGH, - LJ_LSHIN, - LJ_LFOOT, - LJ_RTHIGH, - LJ_RSHIN, - LJ_RFOOT, - LJ_TORSO, - LJ_RINARM, - LJ_ROUTARM, - LJ_RHAND, - LJ_LINARM, - LJ_LOUTARM, - LJ_LHAND, - LJ_HEAD, +char LM[] = +{ + LM_HIPS, + LM_LTHIGH, + LM_LSHIN, + LM_LFOOT, + LM_RTHIGH, + LM_RSHIN, + LM_RFOOT, + LM_TORSO, + LM_RINARM, + LM_ROUTARM, + LM_RHAND, + LM_LINARM, + LM_LOUTARM, + LM_LHAND, + LM_HEAD, }; int XFront, ZFront; @@ -66,7 +64,7 @@ int CollideStaticObjects(COLL_INFO* coll, int x, int y, int z, short roomNumber, for (int j = room->numMeshes; j > 0; j--, mesh++) { - STATIC_INFO* sInfo = &StaticObjects[mesh->staticNumber]; + StaticInfo* sInfo = &StaticObjects[mesh->staticNumber]; if ((sInfo->flags & 1)) // No collision continue; @@ -141,7 +139,7 @@ int GetCollidedObjects(ITEM_INFO* collidingItem, int radius, int onlyVisible, IT for (int j = 0; j < room->numMeshes; j++) { MESH_INFO* mesh = &room->mesh[j]; - STATIC_INFO* staticMesh = &StaticObjects[mesh->staticNumber]; + StaticInfo* staticMesh = &StaticObjects[mesh->staticNumber]; if (mesh->Flags & 1) { @@ -1407,14 +1405,14 @@ void LaraBaddieCollision(ITEM_INFO* l, COLL_INFO* coll) if (item->collidable && item->status != ITEM_INVISIBLE) { obj = &Objects[item->objectNumber]; - if (obj->collision) + if (obj->collision != nullptr) { int x = l->pos.xPos - item->pos.xPos; int y = l->pos.yPos - item->pos.yPos; int z = l->pos.zPos - item->pos.zPos; if (x > -3072 && x < 3072 && z > -3072 && z < 3072 && y > -3072 && y < 3072) - (*obj->collision)(itemNumber, l, coll); + obj->collision(itemNumber, l, coll); } } itemNumber = item->nextItem; diff --git a/TR5Main/Game/collide.h b/TR5Main/Game/collide.h index 9df1caa46..0a8b1762d 100644 --- a/TR5Main/Game/collide.h +++ b/TR5Main/Game/collide.h @@ -1,15 +1,106 @@ #pragma once - -#include "..\Global\global.h" +#include "phd_global.h" +#include "level.h" // used by coll->badPos #define NO_BAD_POS (-NO_HEIGHT) // used by coll->badNeg #define NO_BAD_NEG NO_HEIGHT +struct BOUNDING_BOX +{ + short X1; + short X2; + short Y1; + short Y2; + short Z1; + short Z2; +}; + +struct COLL_FLOOR +{ + int floor; + int ceiling; + int type; + int splitFloor; + int splitCeiling; +}; + +struct COLL_INFO +{ + /* + COLL_FLOOR middle; // mid + COLL_FLOOR middle_left; // left + COLL_FLOOR middle_right; // right + COLL_FLOOR front; // front + COLL_FLOOR front_left; // left2 + COLL_FLOOR front_right; // right2 + */ + int midFloor; + int midCeiling; + int midType; + int midSplitFloor; + int midSplitCeil; + + int frontFloor; + int frontCeiling; + int frontType; + int frontSplitFloor; + int frontSplitCeil; + + int leftFloor; + int leftCeiling; + int leftType; + int leftSplitFloor; + int leftSplitCeil; + + int rightFloor; + int rightCeiling; + int rightType; + int rightSplitFloor; + int rightSplitCeil; + + int leftFloor2; + int leftCeiling2; + int leftType2; + int leftSplitFloor2; + int leftSplitCeil2; + + int rightFloor2; + int rightCeiling2; + int rightType2; + int rightSplitFloor2; + int rightSplitCeil2; + + int radius; + int badPos; + int badNeg; + int badCeiling; + PHD_VECTOR shift; + PHD_VECTOR old; + short oldAnimState; + short oldAnimNumber; + short oldFrameNumber; + short facing; + short quadrant; + short collType; // CT_enum + short* trigger; + signed char tiltX; + signed char tiltZ; + bool hitByBaddie; + bool hitStatic; + bool slopesAreWalls; + bool slopesArePits; + bool lavaIsPit; + bool enableBaddiePush; + bool enableSpaz; + bool hitCeiling; +}; + extern BOUNDING_BOX GlobalCollisionBounds; -extern ITEM_INFO* CollidedItems[1024]; -extern MESH_INFO* CollidedMeshes[1024]; +constexpr auto MAX_ITEMS = 1024; +extern ITEM_INFO* CollidedItems[MAX_ITEMS]; +extern MESH_INFO* CollidedMeshes[MAX_ITEMS]; void GenericSphereBoxCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); int CollideStaticObjects(COLL_INFO* coll, int x, int y, int z, short roomNumber, int hite); diff --git a/TR5Main/Game/control.cpp b/TR5Main/Game/control.cpp index 5d0c8f59b..ac268a41e 100644 --- a/TR5Main/Game/control.cpp +++ b/TR5Main/Game/control.cpp @@ -1,9 +1,9 @@ +#include "framework.h" +#include "collide.h" #include "control.h" -#include "..\Global\global.h" - #include "pickup.h" -#include "Camera.h" +#include "camera.h" #include "Lara.h" #include "hair.h" #include "items.h" @@ -14,7 +14,7 @@ #include "lot.h" #include "pickup.h" #include "draw.h" -#include "healt.h" +#include "health.h" #include "savegame.h" #include "sound.h" #include "spotcam.h" @@ -25,23 +25,20 @@ #include "rope.h" #include "tomb4fx.h" #include "traps.h" -#include "effects.h" +#include "effect.h" #include "sphere.h" #include "debris.h" #include "larafire.h" -#include "..\Objects\oldobjects.h" - #include "footprint.h" -#include "..\Specific\level.h" -#include "..\Specific\input.h" -#include "..\Specific\init.h" -#include "..\Specific\winmain.h" -#include "../Specific/input.h" - -#include -#include -#include "..\Renderer\Renderer11.h" -#include "../Specific/setup.h" +#include "level.h" +#include "input.h" +#include "init.h" +#include "winmain.h" +#include "Renderer11.h" +#include "setup.h" +#include "tr5_rats_emitter.h" +#include "tr5_bats_emitter.h" +#include "tr5_spider_emitter.h" short ShatterSounds[18][10] = { @@ -77,8 +74,8 @@ int RumbleTimer = 0; int InGameCnt = 0; byte IsAtmospherePlaying = 0; byte FlipStatus = 0; -int FlipStats[255]; -int FlipMap[255]; +int FlipStats[MAX_FLIPMAP]; +int FlipMap[MAX_FLIPMAP]; bool InItemControlLoop; short ItemNewRoomNo; short ItemNewRooms[512]; @@ -114,7 +111,7 @@ int InitialiseGame; int RequiredStartPos; int WeaponDelay; int WeaponEnemyTimer; -int HeightType; +HEIGHT_TYPES HeightType; int HeavyTriggered; short SkyPos1; short SkyPos2; @@ -126,9 +123,9 @@ int CutSeqNum; int CutSeqTriggered; int GlobalPlayingCutscene; int CurrentLevel; -int SoundActive; -int DoTheGame; -int Unk_876C48; +bool SoundActive; +bool DoTheGame; +bool ThreadEnded; int OnFloor; int SmokeWindX; int SmokeWindZ; @@ -532,9 +529,8 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode) return GAME_STATUS_NONE; } -unsigned __stdcall GameMain(void*) +unsigned CALLBACK GameMain(void*) { - //DB_Log(2, "GameMain - DLL"); printf("GameMain\n"); // Initialise legacy memory buffer and game timer @@ -550,10 +546,10 @@ unsigned __stdcall GameMain(void*) DoTheGame = false; // Finish the thread - PostMessageA((HWND)WindowsHandle, 0x10u, 0, 0); - _endthreadex(1); + PostMessage(WindowsHandle, WM_CLOSE, NULL, NULL); + EndThread(); - return 1; + return TRUE; } GAME_STATUS DoTitle(int index) @@ -1020,7 +1016,7 @@ void TestTriggers(short* data, int heavy, int HeavyFlags) if (item->active && Objects[item->objectNumber].intelligent) { - item->hitPoints = -16384; + item->hitPoints = NOT_TARGETABLE; DisableBaddieAI(value); KillItem(value); } @@ -1041,7 +1037,7 @@ void TestTriggers(short* data, int heavy, int HeavyFlags) { if (Objects[item->objectNumber].intelligent) { - if (item->status != ITEM_INACTIVE) + if (item->status != ITEM_NOT_ACTIVE) { if (item->status == ITEM_INVISIBLE) { @@ -2138,7 +2134,6 @@ int GetTargetOnLOS(GAME_VECTOR* src, GAME_VECTOR* dest, int DrawTarget, int firi flag = 0; itemNumber = ObjectOnLOS2(src, dest, &vector, &mesh); - if (itemNumber != 999) { target.x = vector.x - (vector.x - src->x >> 5); @@ -2280,7 +2275,7 @@ int GetTargetOnLOS(GAME_VECTOR* src, GAME_VECTOR* dest, int DrawTarget, int firi } } } - if (item->status != ITEM_DEACTIVATED) + if (item->status != ITEM_DESACTIVATED) { AddActiveItem(itemNumber); item->status = ITEM_ACTIVE; @@ -2388,7 +2383,7 @@ int ObjectOnLOS2(GAME_VECTOR* start, GAME_VECTOR* end, PHD_VECTOR* vec, MESH_INF { item = &Items[linknum]; - if (item->status != ITEM_DEACTIVATED + if (item->status != ITEM_DESACTIVATED && item->status != ITEM_INVISIBLE && (item->objectNumber != ID_LARA && Objects[item->objectNumber].collision != NULL || item->objectNumber == ID_LARA && GetLaraOnLOS)) @@ -2781,7 +2776,7 @@ void AnimateItem(ITEM_INFO* item) case COMMAND_DEACTIVATE: if (Objects[item->objectNumber].intelligent && !item->afterDeath) item->afterDeath = 1; - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; break; case COMMAND_SOUND_FX: case COMMAND_EFFECT: @@ -2983,10 +2978,7 @@ void RemoveRoomFlipItems(ROOM_INFO* r) { ITEM_INFO* item = &Items[linkNum]; - if (item->flags & 0x100 - && Objects[item->objectNumber].intelligent - && item->hitPoints <= 0 - && item->hitPoints != -16384) + if (item->flags & 0x100 && Objects[item->objectNumber].intelligent && item->hitPoints <= 0 && item->hitPoints != NOT_TARGETABLE) { KillItem(linkNum); } @@ -3090,7 +3082,7 @@ int ExplodeItemNode(ITEM_INFO* item, int Node, int NoXZVel, int bits) if (1 << Node & item->meshBits) { Num = bits; - if (item->objectNumber == ID_SHOOT_SWITCH1 && (CurrentLevel == 4 || CurrentLevel == 7)) + if (item->objectNumber == ID_SHOOT_SWITCH1 && (CurrentLevel == 4 || CurrentLevel == 7)) // TODO: remove hardcoded think ! { SoundEffect(SFX_SMASH_METAL, &item->pos, 0); } @@ -3105,7 +3097,7 @@ int ExplodeItemNode(ITEM_INFO* item, int Node, int NoXZVel, int bits) ShatterItem.sphere.x = CreatureSpheres[Node].x; ShatterItem.sphere.y = CreatureSpheres[Node].y; ShatterItem.sphere.z = CreatureSpheres[Node].z; - ShatterItem.il = (ITEM_LIGHT *) &item->legacyLightData; // TODO: remove it or at last change it with the new renderer light... + ShatterItem.il = (ITEM_LIGHT*) &item->legacyLightData; // TODO: remove it or at last change it with the new renderer light... ShatterItem.flags = item->objectNumber == ID_CROSSBOW_BOLT ? 0x400 : 0; ShatterImpactData.impactDirection = Vector3(0, -1, 0); ShatterImpactData.impactLocation = { (float)ShatterItem.sphere.x,(float)ShatterItem.sphere.y,(float)ShatterItem.sphere.z }; @@ -3262,13 +3254,10 @@ void InterpolateAngle(short angle, short* rotation, short* outAngle, int shift) *rotation += deltaAngle >> shift; } -#define OutsideRoomTable VAR_U_(0x00EEF4AC, unsigned char*) -#define OutsideRoomOffsets ARRAY_(0x00EEF040, short, [27 * 27]) - int IsRoomOutside(int x, int y, int z) { return 0; - + /* short offset = OutsideRoomOffsets[((x >> 12) * 27) + (z >> 12)]; if (offset == -1) return -2; @@ -3329,5 +3318,5 @@ int IsRoomOutside(int x, int y, int z) s++; } return -2; - } + }*/ } diff --git a/TR5Main/Game/control.h b/TR5Main/Game/control.h index 30a53eba9..ae84fa185 100644 --- a/TR5Main/Game/control.h +++ b/TR5Main/Game/control.h @@ -1,14 +1,69 @@ #pragma once +#include "phd_global.h" +#include "items.h" +#include "room.h" -#include "..\Global\global.h" +enum GAME_STATUS +{ + GAME_STATUS_NONE, + GAME_STATUS_NEW_GAME, + GAME_STATUS_LOAD_GAME, + GAME_STATUS_SAVE_GAME, + GAME_STATUS_EXIT_TO_TITLE, + GAME_STATUS_EXIT_GAME, + GAME_STATUS_LARA_DEAD, + GAME_STATUS_LEVEL_COMPLETED +}; -#define TRIG_BITS(T) ((T & 0x3fff) >> 10) +enum COLL_TYPE +{ + CT_NONE = 0, // 0x00 + CT_FRONT = (1 << 0), // 0x01 + CT_LEFT = (1 << 1), // 0x02 + CT_RIGHT = (1 << 2), // 0x04 + CT_TOP = (1 << 3), // 0x08 + CT_TOP_FRONT = (1 << 4), // 0x10 + CT_CLAMP = (1 << 5) // 0x20 +}; + +enum HEIGHT_TYPES +{ + WALL, + SMALL_SLOPE, + BIG_SLOPE, + DIAGONAL, + SPLIT_TRI +}; + +enum HEADINGS +{ + NORTH, + EAST, + SOUTH, + WEST +}; + +enum COMMAND_TYPES +{ + COMMAND_NULL = 0, + COMMAND_MOVE_ORIGIN, + COMMAND_JUMP_VELOCITY, + COMMAND_ATTACK_READY, + COMMAND_DEACTIVATE, + COMMAND_SOUND_FX, + COMMAND_EFFECT +}; + +#define TRIG_BITS(T) ((T & 0x3FFF) >> 10) extern int KeyTriggerActive; extern byte IsAtmospherePlaying; extern byte FlipStatus; -extern int FlipStats[255]; -extern int FlipMap[255]; + +constexpr auto MAX_FLIPMAP = 255; +extern int FlipStats[MAX_FLIPMAP]; +extern int FlipMap[MAX_FLIPMAP]; + extern bool InItemControlLoop; extern short ItemNewRoomNo; extern short ItemNewRooms[512]; @@ -42,7 +97,7 @@ extern int InitialiseGame; extern int RequiredStartPos; extern int WeaponDelay; extern int WeaponEnemyTimer; -extern int HeightType; +extern HEIGHT_TYPES HeightType; extern int HeavyTriggered; extern short SkyPos1; extern short SkyPos2; @@ -54,9 +109,9 @@ extern int CutSeqNum; extern int CutSeqTriggered; extern int GlobalPlayingCutscene; extern int CurrentLevel; -extern int SoundActive; -extern int DoTheGame; -extern int Unk_876C48; +extern bool SoundActive; +extern bool DoTheGame; +extern bool ThreadEnded; extern int OnFloor; extern int SmokeWindX; extern int SmokeWindZ; @@ -122,4 +177,4 @@ int is_object_in_room(short roomNumber, short objectNumber); void InterpolateAngle(short angle, short* rotation, short* outAngle, int shift); int IsRoomOutside(int x, int y, int z); -unsigned __stdcall GameMain(void*); \ No newline at end of file +unsigned CALLBACK GameMain(void*); \ No newline at end of file diff --git a/TR5Main/Game/debris.cpp b/TR5Main/Game/debris.cpp index 1d62457bb..ad27b90c5 100644 --- a/TR5Main/Game/debris.cpp +++ b/TR5Main/Game/debris.cpp @@ -1,13 +1,16 @@ +#include "framework.h" #include "debris.h" -#include "../Specific/level.h" -#include "../Specific/setup.h" +#include "level.h" +#include "setup.h" #include "control.h" +#include "trmath.h" ShatterImpactInfo ShatterImpactData; SHATTER_ITEM ShatterItem; short SmashedMeshCount; MESH_INFO* SmashedMesh[32]; short SmashedMeshRoom[32]; +vector DebrisFragments = vector(MAX_DEBRIS); DebrisFragment* GetFreeDebrisFragment() { @@ -80,9 +83,8 @@ void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num,short roomNumber } } -vector DebrisFragments = vector(MAX_DEBRIS); -DirectX::SimpleMath::Vector3 CalculateFragmentImpactVelocity(Vector3 fragmentWorldPosition, Vector3 impactDirection, Vector3 impactLocation) +Vector3 CalculateFragmentImpactVelocity(Vector3 fragmentWorldPosition, Vector3 impactDirection, Vector3 impactLocation) { Vector3 radiusVector = (fragmentWorldPosition - impactLocation); Vector3 radiusNormVec = radiusVector; @@ -98,26 +100,36 @@ DirectX::SimpleMath::Vector3 CalculateFragmentImpactVelocity(Vector3 fragmentWor void UpdateDebris() { - for (auto deb = DebrisFragments.begin(); deb != DebrisFragments.end(); deb++) { - if (deb->active) { + for (auto deb = DebrisFragments.begin(); deb != DebrisFragments.end(); deb++) + { + if (deb->active) + { + FLOOR_INFO* floor; + short roomNumber; + deb->velocity *= deb->linearDrag; deb->velocity += deb->gravity; deb->velocity = XMVector3ClampLength(deb->velocity, 0, deb->terminalVelocity); deb->rotation *= Quaternion::CreateFromYawPitchRoll(deb->angularVelocity.x,deb->angularVelocity.y,deb->angularVelocity.z); deb->worldPosition += deb->velocity; deb->angularVelocity *= deb->angularDrag; - short room = deb->roomNumber; - const FLOOR_INFO* const floor = GetFloor(deb->worldPosition.x, deb->worldPosition.y, deb->worldPosition.z,&room); - if (deb->worldPosition.y < floor->ceiling) { - if (floor->skyRoom != NO_ROOM) { + + roomNumber = deb->roomNumber; + floor = GetFloor(deb->worldPosition.x, deb->worldPosition.y, deb->worldPosition.z,&roomNumber); + + if (deb->worldPosition.y < floor->ceiling) + { + if (floor->skyRoom != NO_ROOM) deb->roomNumber = floor->skyRoom; - } } - if (deb->worldPosition.y > floor->floor) { - if (floor->pitRoom != NO_ROOM) { + + if (deb->worldPosition.y > floor->floor) + { + if (floor->pitRoom != NO_ROOM) deb->roomNumber = floor->pitRoom; - } - if (deb->numBounces > 3) { + + if (deb->numBounces > 3) + { deb->active = false; continue; } diff --git a/TR5Main/Game/debris.h b/TR5Main/Game/debris.h index d3480f72a..2025aa4c3 100644 --- a/TR5Main/Game/debris.h +++ b/TR5Main/Game/debris.h @@ -1,18 +1,50 @@ #pragma once +#include "sphere.h" +#include "Renderer11.h" -#include "..\Global\global.h" +#define MAX_DEBRIS 256 -struct ShatterImpactInfo { +typedef struct ILIGHT +{ + short x; + short y; + short z; + short pad1; + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char pad; +}; + +typedef struct ITEM_LIGHT +{ + ILIGHT light[4]; +}; + +typedef struct SHATTER_ITEM +{ + SPHERE sphere; + ITEM_LIGHT* il; + short* meshp; + int bit; + short yRot; + short flags; +}; + +typedef struct ShatterImpactInfo +{ Vector3 impactDirection; Vector3 impactLocation; }; -struct DebrisMesh { +typedef struct DebrisMesh +{ RENDERER_BUCKETS bucket; array vertices; }; -struct DebrisFragment { +typedef struct DebrisFragment +{ DebrisMesh mesh; Quaternion rotation; Vector3 angularVelocity; @@ -29,6 +61,29 @@ struct DebrisFragment { bool active; }; +typedef struct DEBRIS_STRUCT +{ + void* textInfo; + int x; + int y; + int z; + short xyzOffsets1[3]; + short dir; + short xyzOffsets2[3]; + short speed; + short xyzOffsets3[3]; + short yVel; + short gravity; + short roomNumber; + byte on; + byte xRot; + byte yRot; + byte r; + byte g; + byte b; + byte pad[22]; +}; + extern SHATTER_ITEM ShatterItem; extern vector DebrisFragments; extern ShatterImpactInfo ShatterImpactData; diff --git a/TR5Main/Game/deltapak.cpp b/TR5Main/Game/deltapak.cpp deleted file mode 100644 index e2d42c837..000000000 --- a/TR5Main/Game/deltapak.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "deltapak.h" -#include "..\Global\global.h" -#include -#include "../Specific/level.h" - -ITEM_INFO* FindItem(short objectNumber) -{ -#ifdef _DEBUG - printf("Called FindItem()\n"); -#endif - - //DB_Log(0, "FindItem - DLL"); - - if (LevelItems > 0) - { - for (int i = 0; i < LevelItems; i++) - { - if (Items[i].objectNumber == objectNumber) - return &Items[i]; - } - } - - return NULL; -} diff --git a/TR5Main/Game/deltapak.h b/TR5Main/Game/deltapak.h deleted file mode 100644 index a0249809b..000000000 --- a/TR5Main/Game/deltapak.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include "..\Global\global.h" diff --git a/TR5Main/Game/door.cpp b/TR5Main/Game/door.cpp index 0661acdc4..713c5f3ec 100644 --- a/TR5Main/Game/door.cpp +++ b/TR5Main/Game/door.cpp @@ -1,25 +1,26 @@ +#include "framework.h" #include "door.h" #include "items.h" #include "lot.h" #include "objects.h" -#include "collide.h" #include "Lara.h" #include "inventory.h" #include "draw.h" #include "sphere.h" #include "switch.h" #include "misc.h" -#include "Box.h" -#include "../Specific/level.h" -#include "../Specific/input.h" +#include "box.h" +#include "level.h" +#include "input.h" #include "sound.h" +#include "trmath.h" -PHD_VECTOR DoubleDoorPos = { 0, 0, 220 }; -PHD_VECTOR PullDoorPos = { -201, 0, 322 }; -PHD_VECTOR PushDoorPos = { 201, 0, -702 }; -PHD_VECTOR KickDoorPos = { 0, 0, -917 }; -PHD_VECTOR UnderwaterDoorPos = { -251, -540, -46 }; -PHD_VECTOR CrowbarDoorPos = { -412, 0, 256 }; +PHD_VECTOR DoubleDoorPos(0, 0, 220); +PHD_VECTOR PullDoorPos(-201, 0, 322); +PHD_VECTOR PushDoorPos(201, 0, -702); +PHD_VECTOR KickDoorPos(0, 0, -917); +PHD_VECTOR UnderwaterDoorPos(-251, -540, -46); +PHD_VECTOR CrowbarDoorPos(-412, 0, 256); static short PushPullKickDoorBounds[12] = { @@ -109,7 +110,7 @@ void UnderwaterDoorCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) && !Lara.gunStatus || Lara.isMoving && Lara.generalPtr == (void*)itemNum) { - l->pos.yRot ^= ANGLE(180); + l->pos.yRot ^= ANGLE(180.0f); if (TestLaraPosition(UnderwaterDoorBounds, item, l)) { @@ -330,7 +331,7 @@ void DoorCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) ITEM_INFO* item = &Items[itemNum]; if (item->triggerFlags == 2 - && item->status == ITEM_INACTIVE && !item->gravityStatus // CHECK + && item->status == ITEM_NOT_ACTIVE && !item->gravityStatus // CHECK && ((TrInput & IN_ACTION || g_Inventory->GetSelectedObject() == ID_CROWBAR_ITEM) && l->currentAnimState == STATE_LARA_STOP && l->animNumber == ANIMATION_LARA_STAY_IDLE diff --git a/TR5Main/Game/door.h b/TR5Main/Game/door.h index 5f55703fe..0fa9faeaa 100644 --- a/TR5Main/Game/door.h +++ b/TR5Main/Game/door.h @@ -1,6 +1,32 @@ #pragma once +#include "items.h" +#include "collide.h" +#include "room.h" -#include "..\Global\global.h" +typedef struct DOORPOS_DATA +{ + FLOOR_INFO* floor; + FLOOR_INFO data; + short block; +}; + +typedef struct DOOR_DATA +{ + DOORPOS_DATA d1; + DOORPOS_DATA d1flip; + DOORPOS_DATA d2; + DOORPOS_DATA d2flip; + short opened; + short* dptr1; + short* dptr2; + short* dptr3; + short* dptr4; + byte dn1; + byte dn2; + byte dn3; + byte dn4; + ITEM_INFO* item; +}; void SequenceDoorControl(short itemNumber); void UnderwaterDoorCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); diff --git a/TR5Main/Game/draw.cpp b/TR5Main/Game/draw.cpp index 745887242..4bf8ccd9f 100644 --- a/TR5Main/Game/draw.cpp +++ b/TR5Main/Game/draw.cpp @@ -1,8 +1,9 @@ +#include "framework.h" #include "draw.h" #include "Lara.h" -#include "..\Renderer\Renderer11.h" #include "camera.h" -#include "../Specific/level.h" +#include "level.h" +#include "Renderer11.h" BITE_INFO EnemyBites[9] = { @@ -17,8 +18,6 @@ BITE_INFO EnemyBites[9] = { 0xA, 0xFFFFFFC4, 0xC8, 0xD } }; -Renderer11* g_Renderer; - int LightningCount; int LightningRand; int StormTimer; @@ -129,27 +128,20 @@ int GetFrame_D2(ITEM_INFO* item, short* framePtr[], int* rate) bool TIME_Reset() { LARGE_INTEGER fq; - QueryPerformanceCounter(&fq); - LdSync = (double)fq.LowPart + (double)fq.HighPart * (double)0xffffffff; LdSync /= LdFreq; - return true; } bool TIME_Init() { LARGE_INTEGER fq; - if (!QueryPerformanceFrequency(&fq)) return false; - LdFreq = (double)fq.LowPart + (double)fq.HighPart * (double)0xFFFFFFFF; LdFreq /= 60.0; - TIME_Reset(); - return true; } @@ -157,16 +149,11 @@ int Sync() { LARGE_INTEGER ct; double dCounter; - QueryPerformanceCounter(&ct); - dCounter = (double)ct.LowPart + (double)ct.HighPart * (double)0xFFFFFFFF; dCounter /= LdFreq; - long nFrames = long(dCounter) - long(LdSync); - LdSync = dCounter; - return nFrames; } @@ -176,13 +163,13 @@ void DrawAnimatingItem(ITEM_INFO* item) // Empty stub because actually we disable items drawing when drawRoutine pointer is NULL in ObjectInfo } -void GetLaraJointPosition(PHD_VECTOR* pos, int joint) +void GetLaraJointPosition(PHD_VECTOR* pos, int LM_enum) { - if (joint > 14) - joint = 14; + if (LM_enum >= NUM_LARA_MESHES) + LM_enum = LM_HEAD; Vector3 p = Vector3(pos->x, pos->y, pos->z); - g_Renderer->GetLaraAbsBonePosition(&p, joint); + g_Renderer->GetLaraAbsBonePosition(&p, LM_enum); pos->x = p.x; pos->y = p.y; diff --git a/TR5Main/Game/draw.h b/TR5Main/Game/draw.h index e3c57a767..0e3937cff 100644 --- a/TR5Main/Game/draw.h +++ b/TR5Main/Game/draw.h @@ -1,8 +1,20 @@ #pragma once +#include "box.h" -#include "..\Global\global.h" +struct ANIM_FRAME +{ + short MinX; + short MaxX; + short MinY; + short MaxY; + short MinZ; + short MaxZ; + short OffsetX; + short OffsetY; + short OffsetZ; + unsigned short AngleSets[]; // Variable size +}; -extern Renderer11* g_Renderer; extern BITE_INFO EnemyBites[9]; extern int LightningCount; extern int LightningRand; @@ -21,4 +33,4 @@ int Sync(); bool TIME_Init(); bool TIME_Reset(); void DrawAnimatingItem(ITEM_INFO* item); -void GetLaraJointPosition(PHD_VECTOR* pos, int joint); \ No newline at end of file +void GetLaraJointPosition(PHD_VECTOR* pos, int LM_enum); diff --git a/TR5Main/Game/effects.cpp b/TR5Main/Game/effect.cpp similarity index 92% rename from TR5Main/Game/effects.cpp rename to TR5Main/Game/effect.cpp index 9ca94ea96..3819a44dd 100644 --- a/TR5Main/Game/effects.cpp +++ b/TR5Main/Game/effect.cpp @@ -1,5 +1,6 @@ -#include "effects.h" -#include "..\Global\global.h" +#include "framework.h" +#include "effect.h" + #include "Lara.h" #include "items.h" #include "lot.h" @@ -9,13 +10,16 @@ #include "draw.h" #include "sphere.h" #include "footprint.h" -#include "..\Objects\oldobjects.h" -#include "..\Specific\level.h" +#include "oldobjects.h" +#include "level.h" #include "debris.h" -#include "../Specific/setup.h" +#include "setup.h" #include "camera.h" #include "savegame.h" #include "sound.h" +#include "tr5_rats_emitter.h" +#include "tr5_bats_emitter.h" +#include "tr5_spider_emitter.h" int wf = 256; extern std::deque footprints; @@ -57,8 +61,8 @@ void(*effect_routines[59])(ITEM_INFO* item) = void_effect, LaraLocation, ClearSpidersPatch, - AddFootprint, /*AddFootprint*/ - void_effect /*ResetTest*/, + AddFootprint, + void_effect, // resettest void_effect, void_effect, void_effect, @@ -96,16 +100,21 @@ void TL_1(ITEM_INFO* item) } } -void AddFootprint(ITEM_INFO* item) { - if (item != LaraItem) { +// TODO: here are sound for lara footstep too ! +void AddFootprint(ITEM_INFO* item) +{ + if (item != LaraItem) return; - } + + FOOTPRINT_STRUCT footprint; PHD_3DPOS footprintPosition; - if (CheckFootOnFloor(*item, LM_LFOOT, footprintPosition)) { - if (footprints.size() >= MAX_FOOTPRINTS) { + + if (CheckFootOnFloor(*item, LM_LFOOT, footprintPosition)) + { + if (footprints.size() >= MAX_FOOTPRINTS) footprints.pop_back(); - } - FOOTPRINT_STRUCT footprint; + + memset(&footprint, 0, sizeof(FOOTPRINT_STRUCT)); footprint.pos = footprintPosition; footprint.lifeStartFading = 30 * 10; footprint.startOpacity = 64; @@ -113,11 +122,13 @@ void AddFootprint(ITEM_INFO* item) { footprint.active = true; footprints.push_front(footprint); } - if (CheckFootOnFloor(*item, LM_RFOOT, footprintPosition)) { - if (footprints.size() >= MAX_FOOTPRINTS) { + + if (CheckFootOnFloor(*item, LM_RFOOT, footprintPosition)) + { + if (footprints.size() >= MAX_FOOTPRINTS) footprints.pop_back(); - } - FOOTPRINT_STRUCT footprint; + + memset(&footprint, 0, sizeof(FOOTPRINT_STRUCT)); footprint.pos = footprintPosition; footprint.lifeStartFading = 30*10; footprint.startOpacity = 64; @@ -125,7 +136,6 @@ void AddFootprint(ITEM_INFO* item) { footprint.active = true; footprints.push_front(footprint); } - } void TL_2(ITEM_INFO* item) @@ -392,7 +402,7 @@ void PoseidonSFX(ITEM_INFO* item)//395E0(<), 39AE0(<) (F) void RubbleFX(ITEM_INFO* item)//39534(<), 39A34(<) (F) { - int itemNumber = FindItem(ID_EARTHQUAKE); + int itemNumber = FindItemNumber(ID_EARTHQUAKE); if (itemNumber != NO_ITEM) { diff --git a/TR5Main/Game/effects.h b/TR5Main/Game/effect.h similarity index 83% rename from TR5Main/Game/effects.h rename to TR5Main/Game/effect.h index ce9191bb9..a23e6a8c1 100644 --- a/TR5Main/Game/effects.h +++ b/TR5Main/Game/effect.h @@ -1,49 +1,62 @@ -#pragma once - -#include "..\Global\global.h" -#include "control.h" - -extern FX_INFO* Effects; - -int ItemNearLara(PHD_3DPOS* pos, int radius); -void StopSoundEffect(short sampleIndex); -short DoBloodSplat(int x, int y, int z, short a4, short a5, short roomNumber); -//void SoundEffects(); -void AddFootprint(ITEM_INFO* item); -void ControlWaterfallMist(short itemNumber); -void void_effect(ITEM_INFO* item); -void finish_level_effect(ITEM_INFO* item); -void turn180_effect(ITEM_INFO* item); -void floor_shake_effect(ITEM_INFO* item); -void SoundFlipEffect(ITEM_INFO* item); -void RubbleFX(ITEM_INFO* item); -void PoseidonSFX(ITEM_INFO* item); -void ActivateCamera(ITEM_INFO* item); -void ActivateKey(ITEM_INFO* item); -void SwapCrowbar(ITEM_INFO* item); -void ExplosionFX(ITEM_INFO* item); -void LaraLocation(ITEM_INFO* item); -void LaraLocationPad(ITEM_INFO* item); -void ResetTest(ITEM_INFO* item); -void KillActiveBaddies(ITEM_INFO* item); -void lara_hands_free(ITEM_INFO* item); -void shoot_right_gun(ITEM_INFO* item); -void shoot_left_gun(ITEM_INFO* item); -void SetFog(ITEM_INFO* item); -void invisibility_on(ITEM_INFO* item); -void invisibility_off(ITEM_INFO* item); -void reset_hair(ITEM_INFO* item); -void TL_1(ITEM_INFO* item); -void TL_2(ITEM_INFO* item); -void TL_3(ITEM_INFO* item); -void TL_4(ITEM_INFO* item); -void TL_5(ITEM_INFO* item); -void TL_6(ITEM_INFO* item); -void TL_7(ITEM_INFO* item); -void TL_8(ITEM_INFO* item); -void TL_9(ITEM_INFO* item); -void TL_10(ITEM_INFO* item); -void TL_11(ITEM_INFO* item); -void TL_12(ITEM_INFO* item); -void Richochet(PHD_3DPOS* pos); -void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count); +#pragma once +#include "control.h" + +struct FX_INFO +{ + PHD_3DPOS pos; + short roomNumber; + short objectNumber; + short nextFx; + short nextActive; + short speed; + short fallspeed; + short frameNumber; + short counter; + short shade; + short flag1; + short flag2; +}; +extern FX_INFO* Effects; + +int ItemNearLara(PHD_3DPOS* pos, int radius); +void StopSoundEffect(short sampleIndex); +short DoBloodSplat(int x, int y, int z, short speed, short yRot, short roomNumber); +//void SoundEffects(); +void AddFootprint(ITEM_INFO* item); +void ControlWaterfallMist(short itemNumber); +void void_effect(ITEM_INFO* item); +void finish_level_effect(ITEM_INFO* item); +void turn180_effect(ITEM_INFO* item); +void floor_shake_effect(ITEM_INFO* item); +void SoundFlipEffect(ITEM_INFO* item); +void RubbleFX(ITEM_INFO* item); +void PoseidonSFX(ITEM_INFO* item); +void ActivateCamera(ITEM_INFO* item); +void ActivateKey(ITEM_INFO* item); +void SwapCrowbar(ITEM_INFO* item); +void ExplosionFX(ITEM_INFO* item); +void LaraLocation(ITEM_INFO* item); +void LaraLocationPad(ITEM_INFO* item); +void ResetTest(ITEM_INFO* item); +void KillActiveBaddies(ITEM_INFO* item); +void lara_hands_free(ITEM_INFO* item); +void shoot_right_gun(ITEM_INFO* item); +void shoot_left_gun(ITEM_INFO* item); +void SetFog(ITEM_INFO* item); +void invisibility_on(ITEM_INFO* item); +void invisibility_off(ITEM_INFO* item); +void reset_hair(ITEM_INFO* item); +void TL_1(ITEM_INFO* item); +void TL_2(ITEM_INFO* item); +void TL_3(ITEM_INFO* item); +void TL_4(ITEM_INFO* item); +void TL_5(ITEM_INFO* item); +void TL_6(ITEM_INFO* item); +void TL_7(ITEM_INFO* item); +void TL_8(ITEM_INFO* item); +void TL_9(ITEM_INFO* item); +void TL_10(ITEM_INFO* item); +void TL_11(ITEM_INFO* item); +void TL_12(ITEM_INFO* item); +void Richochet(PHD_3DPOS* pos); +void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count); diff --git a/TR5Main/Game/effect2.cpp b/TR5Main/Game/effect2.cpp index e2a489ca6..362dfde15 100644 --- a/TR5Main/Game/effect2.cpp +++ b/TR5Main/Game/effect2.cpp @@ -1,38 +1,35 @@ +#include "framework.h" #include "effect2.h" #include "draw.h" +#include "effect.h" +#include "lara.h" #include "tomb4fx.h" #include "traps.h" -#include "math.h" -#include "lara.h" -#include "effects.h" +#include "trmath.h" #include "sound.h" -#include "..\Scripting\GameFlowScript.h" -#include "../Specific/setup.h" -#include "../Specific/level.h" - -//long wibble; -//long SplashCount; -//long KillEverythingFlag; -int NextSpark; +#include "setup.h" +#include "level.h" +#include "objectslist.h" +#include "GameFlowScript.h" unsigned char TES_extra_tab[] = { 0x00, 0x04, 0x07, 0x0A, 0x00, 0x00 }; -extern SMOKE_SPARKS SmokeSparks[MAX_SPARKS_SMOKE]; + +int NextSpark; int DeadlyBounds[6]; -SPLASH_STRUCT Splashes[MAX_SPLASH]; +SPLASH_SETUP SplashSetup; +SPLASH_STRUCT Splashes[MAX_SPLASHES]; RIPPLE_STRUCT Ripples[MAX_RIPPLES]; DYNAMIC Dynamics[MAX_DYNAMICS]; -SPLASH_SETUP SplashSetup; -SP_DYNAMIC SparkDynamics[8]; -int SmokeWeapon; -int SmokeCountL; -int SmokeCountR; -//int SmokeWindX; -//int SmokeWindZ; -int SplashCount = 0; SPARKS Sparks[MAX_SPARKS]; +SP_DYNAMIC SparkDynamics[MAX_SPARKS_DYNAMICS]; +int SmokeWeapon; +byte SmokeCountL; +byte SmokeCountR; +int SplashCount = 0; + PHD_VECTOR NodeVectors[MAX_NODE]; NODEOFFSET_INFO NodeOffsets[MAX_NODE] = { { -16, 40, 160, -14, false }, // TR5 offset 0 @@ -62,46 +59,48 @@ NODEOFFSET_INFO NodeOffsets[MAX_NODE] = { extern GameFlow* g_GameFlow; -void DetatchSpark(int num, int type)// (F) (D) +void DetatchSpark(int num, SpriteEnumFlag type)// (F) (D) { FX_INFO* fx; ITEM_INFO* item; SPARKS* sptr; + int lp; sptr = &Sparks[0]; - for (int lp = 0; lp < MAX_SPARKS; lp++, sptr++) + for (lp = 0; lp < MAX_SPARKS; lp++, sptr++) { if (sptr->on && (sptr->flags & type) && sptr->fxObj == num) { - if (type == SP_FX) + switch (type) { - if (sptr->flags & SP_USEFXOBJPOS) - { - sptr->on = FALSE; - } - else - { - fx = &Effects[num]; - sptr->x += fx->pos.xPos; - sptr->y += fx->pos.yPos; - sptr->z += fx->pos.zPos; - sptr->flags &= ~SP_FX; - } - } - else if (type == SP_ITEM) - { - if (sptr->flags & SP_USEFXOBJPOS) - { - sptr->on = FALSE; - } - else - { - item = &Items[num]; - sptr->x += item->pos.xPos; - sptr->y += item->pos.yPos; - sptr->z += item->pos.zPos; - sptr->flags &= ~SP_ITEM; - } + case SP_FX: + if (sptr->flags & SP_USEFXOBJPOS) + { + sptr->on = FALSE; + } + else + { + fx = &Effects[num]; + sptr->x += fx->pos.xPos; + sptr->y += fx->pos.yPos; + sptr->z += fx->pos.zPos; + sptr->flags &= ~SP_FX; + } + break; + case SP_ITEM: + if (sptr->flags & SP_USEFXOBJPOS) + { + sptr->on = FALSE; + } + else + { + item = &Items[num]; + sptr->x += item->pos.xPos; + sptr->y += item->pos.yPos; + sptr->z += item->pos.zPos; + sptr->flags &= ~SP_ITEM; + } + break; } } } @@ -404,7 +403,7 @@ void TriggerRicochetSpark(GAME_VECTOR* pos, short angle, int num, int unk) spark->fadeToBlack = 4; spark->life = 9; spark->sLife = 9; - spark->transType = 2; + spark->transType = COLADD; spark->x = pos->x; spark->y = pos->y; spark->z = pos->z; @@ -414,7 +413,7 @@ void TriggerRicochetSpark(GAME_VECTOR* pos, short angle, int num, int unk) spark->zVel = rcossin_tbl[2 * ang + 1] >> 2; spark->gravity = (random >> 7) & 0x1F; spark->friction = 34; - spark->flags = 0; + spark->flags = SP_NONE; spark->maxYvel = 0; } @@ -432,7 +431,7 @@ void TriggerRicochetSpark(GAME_VECTOR* pos, short angle, int num, int unk) spark->fadeToBlack = 0; spark->life = 4; spark->sLife = 4; - spark->transType = 2; + spark->transType = COLADD; spark->x = pos->x; spark->y = pos->y; spark->z = pos->z; @@ -490,7 +489,7 @@ void TriggerRicochetSpark(GAME_VECTOR* pos, short angle, int num, int unk) spark->xVel = 0; spark->zVel = 0; } - spark->transType = 2; + spark->transType = COLADD; spark->friction = 0; spark->flags = 26; spark->rotAng = random >> 3; @@ -528,13 +527,13 @@ void TriggerCyborgSpark(int x, int y, int z, short xv, short yv, short zv) spark->dB = -64 - ((random & 0x7F) + 64); spark->life = 10; spark->sLife = 10; - spark->transType = 2; + spark->transType = COLADD; spark->friction = 34; spark->scalar = 1; spark->x = (random & 7) + x - 3; spark->y = ((random >> 3) & 7) + y - 3; spark->z = ((random >> 6) & 7) + z - 3; - spark->flags = 2; + spark->flags = SP_SCALE; spark->xVel = (random >> 2) + xv - 128; spark->yVel = (random >> 4) + yv - 128; spark->zVel = (random >> 6) + zv - 128; @@ -571,7 +570,7 @@ void TriggerExplosionSparks(int x, int y, int z, int extraTrig, int dynamic, int spark->colFadeSpeed = 7; spark->dG = (GetRandomControl() & 0x1F) + 64; spark->fadeToBlack = 8; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 7) + 16; spark->roomNumber = roomNumber; } @@ -584,7 +583,7 @@ void TriggerExplosionSparks(int x, int y, int z, int extraTrig, int dynamic, int spark->colFadeSpeed = 8; spark->dG = (GetRandomControl() & 0x3F) + -128; spark->fadeToBlack = 16; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 7) + 24; } spark->extras = extraTrig | 8 * (TES_extra_tab[extraTrig] + (GetRandomControl() & 7) + 28); @@ -998,7 +997,7 @@ void TriggerSuperJetFlame(ITEM_INFO* item, int yvel, int deadly)//32EAC, 333AC ( sptr->dB = 32; sptr->colFadeSpeed = 8; sptr->fadeToBlack = 8; - sptr->transType = 2; + sptr->transType = COLADD; sptr->life = sptr->sLife = (size >> 9) + (GetRandomControl() & 7) + 16; sptr->x = (GetRandomControl() & 0x1F) + item->pos.xPos - 16; sptr->y = (GetRandomControl() & 0x1F) + item->pos.yPos - 16; @@ -1052,7 +1051,7 @@ void SetupSplash(const SPLASH_SETUP* const setup) constexpr size_t NUM_SPLASHES = 4; int numSplashesSetup = 0; float splashVelocity; - for (int i = 0; i < MAX_SPLASH; i++) + for (int i = 0; i < MAX_SPLASHES; i++) { SPLASH_STRUCT& splash = Splashes[i]; if (!splash.isActive) @@ -1128,7 +1127,7 @@ void SetupSplash(const SPLASH_SETUP* const setup) void UpdateSplashes() { - for (int i = 0; i < MAX_SPLASH; i++) + for (int i = 0; i < MAX_SPLASHES; i++) { SPLASH_STRUCT& splash = Splashes[i]; if (splash.isActive) { @@ -1268,7 +1267,7 @@ void TriggerWaterfallMist(int x, int y, int z, int angle) spark->dG = 64; spark->dB = 64; spark->colFadeSpeed = 1; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 3) + 6; spark->fadeToBlack = spark->life - 4; dl = ((dh + (GlobalCounter << 6)) % 1536) + (GetRandomControl() & 0x3F) - 32; @@ -1302,7 +1301,7 @@ void TriggerWaterfallMist(int x, int y, int z, int angle) spark->dG = 96; spark->dB = 96; spark->colFadeSpeed = 1; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 3) + 6; spark->fadeToBlack = spark->life - 1; dl = GetRandomControl() % 1408 + 64; @@ -1340,7 +1339,7 @@ void TriggerDartSmoke(int x, int y, int z, int xv, int zv, int hit) spark->dB = 32; spark->colFadeSpeed = 8; spark->fadeToBlack = 4; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 3) + 32; spark->x = (GetRandomControl() & 0x1F) + x - 16; spark->y = (GetRandomControl() & 0x1F) + y - 16; @@ -1502,7 +1501,7 @@ void TriggerRocketFlame(int x, int y, int z, int xv, int yv, int zv, int itemNum sptr->colFadeSpeed = 12 + (GetRandomControl() & 3); sptr->fadeToBlack = 12; sptr->sLife = sptr->life = (GetRandomControl() & 3) + 28; - sptr->transType = 2; + sptr->transType = COLADD; sptr->extras = 0; sptr->dynamic = -1; @@ -1558,7 +1557,7 @@ void TriggerRocketSmoke(int x, int y, int z, int bodyPart) sptr->colFadeSpeed = 4 + (GetRandomControl() & 3); sptr->fadeToBlack = 12; sptr->sLife = sptr->life = (GetRandomControl() & 3) + 20; - sptr->transType = 2; + sptr->transType = COLADD; sptr->extras = 0; sptr->dynamic = -1; @@ -1611,7 +1610,7 @@ void GrenadeExplosionEffects(int x, int y, int z, short roomNumber) spark->dShade = -128; spark->colFadeSpeed = 4; spark->fadeToBlack = 16; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 0xF) + 64; spark->x = (GetRandomControl() & 0x1F) + x - 16; spark->y = (GetRandomControl() & 0x1F) + y - 16; @@ -1717,7 +1716,7 @@ void GrenadeLauncherSpecialEffect1(int x, int y, int z, int flag1, int flag2) spark->life = spark->sLife = (GetRandomControl() & 3) + 28; } - spark->transType = 2; + spark->transType = COLADD; if (flag1 != -1) { @@ -1908,7 +1907,7 @@ void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, int additio spark->colFadeSpeed = 3; spark->fadeToBlack = 5; spark->y = ((r >> 3) & 7) + y - 3; - spark->transType = 2; + spark->transType = COLADD; spark->friction = 34; spark->scalar = 1; spark->z = ((r >> 6) & 7) + z - 3; @@ -1930,7 +1929,7 @@ void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, int additio spark->sR = spark->dR >> 1; spark->sG = spark->dG >> 1; spark->fadeToBlack = 4; - spark->transType = 2; + spark->transType = COLADD; spark->colFadeSpeed = (r & 3) + 8; spark->sB = spark->dB >> 1; spark->dR = 32; diff --git a/TR5Main/Game/effect2.h b/TR5Main/Game/effect2.h index 43523791a..135b81723 100644 --- a/TR5Main/Game/effect2.h +++ b/TR5Main/Game/effect2.h @@ -1,14 +1,63 @@ #pragma once -#include -#include "..\Global\global.h" +#include "phd_global.h" +#include "items.h" -#define MAX_NODE 23 -#define RIPPLE_FLAG_BLOOD 0x80 -#define RIPPLE_FLAG_RAND_POS 0x40 -#define RIPPLE_FLAG_RAND_ROT 0x20 -#define RIPPLE_FLAG_SHORT_LIFE 0x01 +enum RIPPLE_TYPE +{ + RIPPLE_FLAG_NONE = 0x0, + RIPPLE_FLAG_SHORT_LIFE = 0x1, + RIPPLE_FLAG_RAND_ROT = 0x20, + RIPPLE_FLAG_RAND_POS = 0x40, + RIPPLE_FLAG_BLOOD = 0x80 +}; -struct RIPPLE_STRUCT +enum SpriteEnumFlag +{ + SP_NONE = 0x0000, + SP_FLAT = 0x0001, + SP_SCALE = 0x0002, + SP_BLOOD = 0x0004, + SP_DEF = 0x0008, + SP_ROTATE = 0x0010, + SP_EXPLOSION = 0x0020, + SP_FX = 0x0040, + SP_ITEM = 0x0080, + SP_WIND = 0x0100, + SP_EXPDEF = 0x0200, + SP_USEFXOBJPOS = 0x0400, + SP_UNDERWEXP = 0x0800, + SP_NODEATTACH = 0x1000, + SP_PLASMAEXP = 0x2000 +}; + +enum TransTypeEnum +{ + NOTRANS, + SEMITRANS, + COLADD, + COLSUB, + WEIRD +}; + +struct NODEOFFSET_INFO +{ + short x; + short y; + short z; + char meshNum; + unsigned char gotIt; +}; + +typedef struct SPLASH_SETUP +{ + float x; + float y; + float z; + float splashPower; + float innerRadius; +}; + +typedef struct RIPPLE_STRUCT { Vector4 currentColor; Vector4 initialColor; @@ -24,27 +73,120 @@ struct RIPPLE_STRUCT bool isBillboard; //used for Blood }; -struct SPLASH_SETUP +typedef struct SPARKS +{ + int x; + int y; + int z; + short xVel; + short yVel; + short zVel; + short gravity; + short rotAng; + unsigned short flags; // SP_enum + unsigned char sSize; + unsigned char dSize; + unsigned char size; + unsigned char friction; + unsigned char scalar; + unsigned char def; + signed char rotAdd; + signed char maxYvel; + bool on; + byte sR; + byte sG; + byte sB; + byte dR; + byte dG; + byte dB; + byte r; + byte g; + byte b; + unsigned char colFadeSpeed; + unsigned char fadeToBlack; + unsigned char sLife; + unsigned char life; + TransTypeEnum transType; + unsigned char extras; + signed char dynamic; + unsigned char fxObj; + unsigned char roomNumber; + unsigned char nodeNumber; +}; + +typedef struct SPLASH_STRUCT { float x; float y; float z; - float splashPower; - float innerRadius; + float innerRad; + float innerRadVel; + float heightVel; + float heightSpeed; + float height; + float outerRad; + float outerRadVel; + float animationSpeed; + float animationPhase; + short spriteSequenceStart; + short spriteSequenceEnd; + unsigned short life; + bool isRipple; + bool isActive; }; -extern SPLASH_STRUCT Splashes[MAX_SPLASH]; -extern RIPPLE_STRUCT Ripples[32]; + +typedef struct DYNAMIC +{ + int x; + int y; + int z; + byte on; + byte r; + byte g; + byte b; + short falloff; + byte used; + byte pad1[1]; + int FalloffScale; +}; + +typedef struct SP_DYNAMIC +{ + byte On; + byte Falloff; + byte R; + byte G; + byte B; + byte Flags; + byte Pad[2]; +}; + +constexpr auto SD_EXPLOSION = 1; +constexpr auto SD_UWEXPLOSION = 2; + +#define MAX_NODE 23 +#define MAX_DYNAMICS 64 +#define MAX_SPARKS 1024 +#define MAX_RIPPLES 32 +#define MAX_SPLASHES 8 +#define MAX_SPARKS_DYNAMICS 8 + +extern int NextSpark; extern int DeadlyBounds[6]; -extern SPARKS Sparks[1024]; -extern SP_DYNAMIC SparkDynamics[8]; extern SPLASH_SETUP SplashSetup; +extern SPLASH_STRUCT Splashes[MAX_SPLASHES]; +extern RIPPLE_STRUCT Ripples[MAX_RIPPLES]; +extern DYNAMIC Dynamics[MAX_DYNAMICS]; +extern SPARKS Sparks[MAX_SPARKS]; +extern SP_DYNAMIC SparkDynamics[MAX_SPARKS_DYNAMICS]; extern int SmokeWeapon; -extern int SmokeCountL; -extern int SmokeCountR; +extern byte SmokeCountL; +extern byte SmokeCountR; +extern int SplashCount; extern PHD_VECTOR NodeVectors[MAX_NODE]; extern NODEOFFSET_INFO NodeOffsets[MAX_NODE]; -void DetatchSpark(int num, int type); +void DetatchSpark(int num, SpriteEnumFlag type); int GetFreeSpark(); void UpdateSparks(); void TriggerRicochetSpark(GAME_VECTOR* pos, short angle, int num, int unk); diff --git a/TR5Main/Game/flmtorch.cpp b/TR5Main/Game/flmtorch.cpp index 51d589475..4b7f11065 100644 --- a/TR5Main/Game/flmtorch.cpp +++ b/TR5Main/Game/flmtorch.cpp @@ -1,25 +1,25 @@ +#include "framework.h" #include "flmtorch.h" -#include "..\Global\global.h" + #include "effect2.h" #include "laraflar.h" #include "lara.h" #include "larafire.h" -#include "collide.h" #include "laramisc.h" #include "switch.h" #include "draw.h" #include "items.h" -#include "..\Specific\level.h" -#include "../Specific/setup.h" -#include "../Specific/input.h" +#include "level.h" +#include "setup.h" +#include "input.h" #include "sound.h" +#include "snowmobile.h" short FireBounds[12] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0xF8E4, 0x071C }; - void TriggerTorchFlame(char fxObj, char node) { SPARKS* spark = &Sparks[GetFreeSpark()]; @@ -32,7 +32,7 @@ void TriggerTorchFlame(char fxObj, char node) spark->dG = (GetRandomControl() & 0x3F) + -128; spark->fadeToBlack = 8; spark->colFadeSpeed = (GetRandomControl() & 3) + 12; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 7) + 24; spark->y = 0; spark->x = (GetRandomControl() & 0xF) - 8; @@ -80,7 +80,7 @@ void DoFlameTorch() // (F) (D) && LaraItem->currentAnimState != STATE_LARA_JUMP_RIGHT || Lara.waterStatus == LW_UNDERWATER) { - Lara.leftArm.lock = 1; + Lara.leftArm.lock = true; Lara.leftArm.frameNumber = 1; Lara.leftArm.animNumber = Objects[ID_LARA_TORCH_ANIM].animIndex + 1; if (Lara.waterStatus == LW_UNDERWATER) @@ -92,7 +92,7 @@ void DoFlameTorch() // (F) (D) case 1: if (Lara.leftArm.frameNumber < 12 && LaraItem->gravityStatus) { - Lara.leftArm.lock = 0; + Lara.leftArm.lock = false; Lara.leftArm.frameNumber = 0; Lara.leftArm.animNumber = Objects[ID_LARA_TORCH_ANIM].animIndex; } @@ -103,7 +103,7 @@ void DoFlameTorch() // (F) (D) { Lara.litTorch = false; Lara.flareControlLeft = false; - Lara.leftArm.lock = 0; + Lara.leftArm.lock = false; Lara.gunType = Lara.lastGunType; Lara.requestGunType = WEAPON_NONE; Lara.gunStatus = LG_NO_ARMS; @@ -123,7 +123,7 @@ void DoFlameTorch() // (F) (D) { Lara.litTorch = false; Lara.flareControlLeft = false; - Lara.leftArm.lock = 0; + Lara.leftArm.lock = false; Lara.lastGunType = WEAPON_NONE; Lara.gunType = WEAPON_NONE; Lara.gunStatus = LG_NO_ARMS; @@ -137,7 +137,7 @@ void DoFlameTorch() // (F) (D) case 3: if (LaraItem->currentAnimState != STATE_LARA_MISC_CONTROL) { - Lara.leftArm.lock = 0; + Lara.leftArm.lock = false; Lara.leftArm.frameNumber = 0; Lara.flareControlLeft = true; Lara.litTorch = LaraItem->itemFlags[3] & 1; @@ -184,7 +184,7 @@ void GetFlameTorch() // (F) (D) Lara.flareControlLeft = true; Lara.leftArm.animNumber = Objects[ID_LARA_TORCH_ANIM].animIndex; Lara.gunStatus = LG_READY; - Lara.leftArm.lock = 0; + Lara.leftArm.lock = false; Lara.leftArm.frameNumber = 0; Lara.leftArm.frameBase = Anims[Lara.leftArm.animNumber].framePtr; LARA_MESHES(ID_LARA_TORCH_ANIM, LM_LHAND); @@ -237,7 +237,7 @@ void TorchControl(short itemNumber) // (F) (D) } else { - STATIC_INFO* sobj = &StaticObjects[CollidedMeshes[0]->staticNumber]; + StaticInfo* sobj = &StaticObjects[CollidedMeshes[0]->staticNumber]; PHD_3DPOS pos; pos.xPos = CollidedMeshes[0]->x; pos.yPos = CollidedMeshes[0]->y; diff --git a/TR5Main/Game/flmtorch.h b/TR5Main/Game/flmtorch.h index 16b1fd46e..935ebe0c9 100644 --- a/TR5Main/Game/flmtorch.h +++ b/TR5Main/Game/flmtorch.h @@ -1,5 +1,6 @@ #pragma once -#include "..\Global\global.h" + +#include "collide.h" void TriggerTorchFlame(char fxObj, char node); void DoFlameTorch(); diff --git a/TR5Main/Game/footprint.cpp b/TR5Main/Game/footprint.cpp index e03a583ff..842c27671 100644 --- a/TR5Main/Game/footprint.cpp +++ b/TR5Main/Game/footprint.cpp @@ -1,13 +1,14 @@ +#include "framework.h" #include "footprint.h" #include "control.h" #include "lara.h" #include "draw.h" #include "groundfx.h" -#include "../Specific/level.h" +#include "level.h" std::deque footprints = deque(); -bool CheckFootOnFloor(ITEM_INFO& const item, int mesh, PHD_3DPOS& outFootprintPosition){ +bool CheckFootOnFloor(ITEM_INFO& const item, int joint, PHD_3DPOS& outFootprintPosition){ int x = item.pos.xPos; int y = item.pos.yPos; int z = item.pos.zPos; @@ -21,12 +22,12 @@ bool CheckFootOnFloor(ITEM_INFO& const item, int mesh, PHD_3DPOS& outFootprintPo PHD_VECTOR pos; pos.x = pos.z = 0; pos.y = FOOT_HEIGHT_OFFSET; - GetLaraJointPosition(&pos, mesh); + GetLaraJointPosition(&pos, joint); outFootprintPosition.xPos = pos.x; outFootprintPosition.zPos = pos.z; outFootprintPosition.yPos = height-1; outFootprintPosition.yRot = item.pos.yRot; - return abs(pos.y - height) < 32; + return abs(pos.y - height) < 32; } void updateFootprints() diff --git a/TR5Main/Game/footprint.h b/TR5Main/Game/footprint.h index 81dd9b9a9..7f5570f56 100644 --- a/TR5Main/Game/footprint.h +++ b/TR5Main/Game/footprint.h @@ -1,7 +1,6 @@ -#include "../Global/types.h" -#include "math.h" -#include #pragma once +#include "items.h" +#include "trmath.h" constexpr size_t MAX_FOOTPRINTS = 20; typedef struct footprint_t { @@ -14,5 +13,5 @@ typedef struct footprint_t { } FOOTPRINT_STRUCT; constexpr int FOOT_HEIGHT_OFFSET = 64; -bool CheckFootOnFloor(ITEM_INFO& const item, int mesh, PHD_3DPOS& outFootprintPosition); +bool CheckFootOnFloor(ITEM_INFO& const item, int joint, PHD_3DPOS& outFootprintPosition); void updateFootprints(); \ No newline at end of file diff --git a/TR5Main/Game/gameflow.cpp b/TR5Main/Game/gameflow.cpp index 3f02807dc..e2c221463 100644 --- a/TR5Main/Game/gameflow.cpp +++ b/TR5Main/Game/gameflow.cpp @@ -1,14 +1,10 @@ +#include "framework.h" #include "gameflow.h" #include "draw.h" #include "savegame.h" +#include "input.h" -#include "..\Specific\input.h" -#include "..\Global\global.h" -#include "../Specific/level.h" - -#include - -using namespace std; +#include "level.h" SavegameInfo g_SavegameInfos[MAX_SAVEGAMES]; SaveGameHeader g_NewSavegameInfos[MAX_SAVEGAMES]; diff --git a/TR5Main/Game/gameflow.h b/TR5Main/Game/gameflow.h index f8d697406..1e0af80cc 100644 --- a/TR5Main/Game/gameflow.h +++ b/TR5Main/Game/gameflow.h @@ -1,12 +1,8 @@ #pragma once - -#include -#include #include "savegame.h" -using namespace std; - -typedef struct SavegameInfo { +typedef struct SavegameInfo +{ bool present; char levelName[75]; int saveNumber; @@ -19,6 +15,24 @@ typedef struct SavegameInfo { #define MAX_SAVEGAMES 16 +struct GAMEFLOW +{ + unsigned int CheatEnabled : 1; + unsigned int LoadSaveEnabled : 1; + unsigned int TitleEnabled : 1; + unsigned int PlayAnyLevel : 1; + unsigned int Language : 3; + unsigned int DemoDisc : 1; + unsigned int Unused : 24; + unsigned int InputTimeout; + unsigned char SecurityTag; + unsigned char nLevels; + unsigned char nFileNames; + unsigned char Pad; + unsigned short FileNameLen; + unsigned short ScriptLen; +}; + extern SavegameInfo g_SavegameInfos[MAX_SAVEGAMES]; extern vector g_NewStrings; extern SaveGameHeader g_NewSavegameInfos[MAX_SAVEGAMES]; diff --git a/TR5Main/Game/groundfx.h b/TR5Main/Game/groundfx.h index 98181444c..d331b08ce 100644 --- a/TR5Main/Game/groundfx.h +++ b/TR5Main/Game/groundfx.h @@ -1,5 +1,6 @@ #pragma once -enum GroundMaterial : unsigned char { +enum GroundMaterial : unsigned char +{ Mud = 0, Snow = 1, Sand = 2, diff --git a/TR5Main/Game/hair.cpp b/TR5Main/Game/hair.cpp index 34a187d4e..69c87c63e 100644 --- a/TR5Main/Game/hair.cpp +++ b/TR5Main/Game/hair.cpp @@ -1,16 +1,17 @@ +#include "framework.h" #include "hair.h" -#include "..\Global\global.h" + #include "draw.h" #include "laramisc.h" #include "lara.h" #include "control.h" -#include "..\Scripting\GameFlowScript.h" -#include "../Specific/setup.h" +#include "GameFlowScript.h" +#include "setup.h" #include "sphere.h" -#include "../Specific/level.h" +#include "level.h" -int FirstHair[2]; -HAIR_STRUCT Hairs[2][7]; +int FirstHair[HAIR_MAX]; +HAIR_STRUCT Hairs[HAIR_MAX][HAIR_SEGMENTS]; int WindAngle; int DWindAngle; int Wind; @@ -19,11 +20,11 @@ extern GameFlow* g_GameFlow; void InitialiseHair() { - for (int h = 0; h < 2; h++) + for (int h = 0; h < HAIR_MAX; h++) { FirstHair[h] = 1; - int* bone = Bones + Objects[ID_LARA_HAIR].boneIndex; + int* bone = &Bones[Objects[ID_LARA_HAIR].boneIndex]; Hairs[h][0].pos.yRot = 0; Hairs[h][0].pos.xRot = -0x4000; @@ -44,7 +45,7 @@ void InitialiseHair() void HairControl(int cutscene, int ponytail, short* framePtr) { - SPHERE sphere[5]; + SPHERE sphere[HAIR_SPHERE]; ObjectInfo* object = &Objects[ID_LARA]; short* frame; int spaz; @@ -105,7 +106,7 @@ void HairControl(int cutscene, int ponytail, short* framePtr) sphere[0].x = pos.x; sphere[0].y = pos.y; sphere[0].z = pos.z; - sphere[0].r = (int) *(objptr + 3); + sphere[0].r = (int) * (objptr + 3); objptr = Lara.meshPtrs[LM_TORSO]; pos = { objptr[0], objptr[1], objptr[2] }; @@ -168,7 +169,7 @@ void HairControl(int cutscene, int ponytail, short* framePtr) pos.y = world.Translation().y; pos.z = world.Translation().z; - int* bone = Bones + Objects[ID_LARA_HAIR].boneIndex; + int* bone = &Bones[Objects[ID_LARA_HAIR].boneIndex]; if (FirstHair[ponytail]) { @@ -202,7 +203,9 @@ void HairControl(int cutscene, int ponytail, short* framePtr) int wh; if (cutscene) + { wh = NO_HEIGHT; + } else { int x = LaraItem->pos.xPos + (frame[0] + frame[1]) / 2; @@ -246,7 +249,9 @@ void HairControl(int cutscene, int ponytail, short* framePtr) height = GetFloorHeight(floor, Hairs[ponytail][i].pos.xPos, Hairs[ponytail][i].pos.yPos, Hairs[ponytail][i].pos.zPos); } else + { height = 32767; + } Hairs[ponytail][i].pos.xPos += Hairs[ponytail][i].hvel.x * 3 / 4; Hairs[ponytail][i].pos.yPos += Hairs[ponytail][i].hvel.y * 3 / 4; @@ -263,7 +268,9 @@ void HairControl(int cutscene, int ponytail, short* framePtr) case LW_ABOVE_WATER: Hairs[ponytail][i].pos.yPos += 10; if (wh != NO_HEIGHT && Hairs[ponytail][i].pos.yPos > wh) + { Hairs[ponytail][i].pos.yPos = wh; + } else if (Hairs[ponytail][i].pos.yPos > height) { Hairs[ponytail][i].pos.xPos = Hairs[ponytail][0].hvel.x; @@ -281,7 +288,7 @@ void HairControl(int cutscene, int ponytail, short* framePtr) break; } - for (int j = 0; j < 5; j++) + for (int j = 0; j < HAIR_SPHERE; j++) { int x = Hairs[ponytail][i].pos.xPos - sphere[j].x; int y = Hairs[ponytail][i].pos.yPos - sphere[j].y; diff --git a/TR5Main/Game/hair.h b/TR5Main/Game/hair.h index 1b5508d78..5f6b692e9 100644 --- a/TR5Main/Game/hair.h +++ b/TR5Main/Game/hair.h @@ -1,8 +1,18 @@ #pragma once -#include "..\Global\global.h" +#include "phd_global.h" -extern HAIR_STRUCT Hairs[2][7]; +constexpr auto HAIR_MAX = 2; // HAIR_NORMAL = 0, HAIR_YOUNG = 1 +constexpr auto HAIR_SEGMENTS = 7; // classic = 7, young = 14 +constexpr auto HAIR_SPHERE = 5; // current hair max collision + +struct HAIR_STRUCT +{ + PHD_3DPOS pos; + PHD_VECTOR hvel; + PHD_VECTOR unknown; +}; +extern HAIR_STRUCT Hairs[HAIR_MAX][HAIR_SEGMENTS]; void InitialiseHair(); void HairControl(int cutscene, int ponytail, short* framePtr); diff --git a/TR5Main/Game/healt.cpp b/TR5Main/Game/health.cpp similarity index 93% rename from TR5Main/Game/healt.cpp rename to TR5Main/Game/health.cpp index ab1b209a4..225f0d04e 100644 --- a/TR5Main/Game/healt.cpp +++ b/TR5Main/Game/health.cpp @@ -1,251 +1,252 @@ -#include "healt.h" -#include "draw.h" -#include "pickup.h" -#include "lara.h" -#include "camera.h" -#include "../Specific/level.h" -#include "control.h" - -short PickupX; -short PickupY; -short CurrentPickup; -DISPLAY_PICKUP Pickups[MAX_COLLECTED_PICKUPS]; -short PickupVel; -int OldHitPoints = 1000; -int HealtBarTimer = 40; -int FlashState = 0; -int FlashCount = 0; -int PoisonFlag = 0; -int DashTimer = 0; -extern RendererHUDBar* g_HealthBar; -extern RendererHUDBar* g_DashBar; -extern RendererHUDBar* g_AirBar; - -void DrawHealthBarOverlay(int value) -{ - if (CurrentLevel) - { - int color2 = 0; - if (Lara.poisoned || Lara.gassed) - color2 = 0xA0A000; - else - color2 = 0xA00000; - g_Renderer->DrawBar(value, g_HealthBar); - } -} - -void DrawHealthBar(float value) -{ - if (CurrentLevel) - { - //int color2; - //if (Lara.poisoned || Lara.gassed) - // color2 = 0xA0A000; - //else - // color2 = 0xA00000; - g_Renderer->DrawBar(value,g_HealthBar); - } -} - -void UpdateHealtBar(int flash) -{ - int hitPoints = LaraItem->hitPoints; - - if (hitPoints < 0) - hitPoints = 0; - else if (hitPoints > 1000) - hitPoints = 1000; - - if (OldHitPoints != hitPoints) - { - OldHitPoints = hitPoints; - HealtBarTimer = 40; - } - - if (HealtBarTimer < 0) - HealtBarTimer = 0; - - if (hitPoints <= 1000 / 4) - { - if (!BinocularRange) - { - if (flash) - DrawHealthBar(hitPoints / 1000.0f); - else - DrawHealthBar(0); - } - else - { - if (flash) - DrawHealthBarOverlay(hitPoints / 1000.0f); - else - DrawHealthBarOverlay(0); - } - } - else if ((HealtBarTimer > 0) - || (hitPoints <= 0) - || (Lara.gunStatus == LG_READY && Lara.gunType != WEAPON_TORCH) - || (Lara.poisoned >= 256)) - { - if (!BinocularRange && !SniperOverlay) - { - DrawHealthBar(hitPoints / 1000.0f); - } - else - { - DrawHealthBarOverlay(hitPoints / 1000.0f); - } - } - - if (PoisonFlag) - PoisonFlag--; -} - -void DrawAirBar(float value) -{ - if (CurrentLevel) - { - g_Renderer->DrawBar(value, g_AirBar); - } -} - -void UpdateAirBar(int flash) -{ - if (Lara.air == 1800 || LaraItem->hitPoints <= 0) - return; - - if ((Lara.Vehicle == NO_ITEM) - || (Items[Lara.Vehicle].objectNumber != ID_UPV)) - { - if ((Lara.waterStatus != LW_UNDERWATER) - && (Lara.waterStatus != LW_SURFACE) - && (!((Rooms[LaraItem->roomNumber].flags & ENV_FLAG_SWAMP) - && (Lara.waterSurfaceDist < -775)))) - return; - } - - int air = Lara.air; - if (air < 0) - air = 0; - else if (air > 1800) - air = 1800; - if (air <= 450) - { - if (flash) - DrawAirBar(air/ 1800.0f); - else - DrawAirBar(0); - } - else - DrawAirBar(air / 1800.0f); - - if (Lara.gassed) - { - if (Lara.dpoisoned < 2048) - Lara.dpoisoned += 2; - Lara.gassed = false; - } -} - -void DrawDashBar(int value) -{ - if (CurrentLevel) - { - g_Renderer->DrawBar(value, g_DashBar); - } -} - -int DrawAllPickups() -{ - if (Pickups[CurrentPickup].life > 0) - { - if (PickupX > 0) - { - PickupX += -PickupX >> 5; - return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); - } - else - { - Pickups[CurrentPickup].life--; - return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); - } - } - else if (Pickups[CurrentPickup].life == 0) - { - if (PickupX < 128) - { - if (PickupVel < 16) - PickupVel++; - PickupX += PickupVel >> 2; - return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); - } - else - { - Pickups[CurrentPickup].life = -1; - PickupVel = 0; - return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); - } - } - - int pickupIndex = CurrentPickup; - int i; - for (i = 0; i < MAX_COLLECTED_PICKUPS; ++i) - { - if (Pickups[pickupIndex].life > 0) - break; - pickupIndex = pickupIndex + 1 & MAX_COLLECTED_PICKUPS - 1; - } - - CurrentPickup = pickupIndex; - if (i != MAX_COLLECTED_PICKUPS) - return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); - - CurrentPickup = 0; - - return 0; -} - - -void AddDisplayPickup(short objectNumber) -{ - for (int i = 0; i < MAX_COLLECTED_PICKUPS; i++) - { - DISPLAY_PICKUP* pickup = &Pickups[i]; - if (pickup->life < 0) - { - pickup->life = 45; - pickup->objectNumber = objectNumber; - PickedUpObject(objectNumber); - return; - } - } - - // No free slot found, so just pickup the object ithout displaying it - PickedUpObject(objectNumber); -} - -void InitialisePickupDisplay() -{ - for (int i = 0; i < MAX_COLLECTED_PICKUPS; i++) - { - DISPLAY_PICKUP* pickup = &Pickups[i]; - pickup->life = -1; - } - - PickupX = 128; - PickupY = 128; - PickupVel = 0; - CurrentPickup = 0; -} - -int FlashIt() -{ - if (FlashCount) - FlashCount--; - else - { - FlashState ^= 1; - FlashCount = 5; - } - return FlashState; -} +#include "framework.h" +#include "health.h" +#include "draw.h" +#include "pickup.h" +#include "lara.h" +#include "camera.h" +#include "level.h" +#include "control.h" + +short PickupX; +short PickupY; +short CurrentPickup; +DISPLAY_PICKUP Pickups[MAX_COLLECTED_PICKUPS]; +short PickupVel; +int OldHitPoints = 1000; +int HealtBarTimer = 40; +int FlashState = 0; +int FlashCount = 0; +int PoisonFlag = 0; +int DashTimer = 0; +extern RendererHUDBar* g_HealthBar; +extern RendererHUDBar* g_DashBar; +extern RendererHUDBar* g_AirBar; + +void DrawHealthBarOverlay(int value) +{ + if (CurrentLevel) + { + int color2 = 0; + if (Lara.poisoned || Lara.gassed) + color2 = 0xA0A000; + else + color2 = 0xA00000; + g_Renderer->DrawBar(value, g_HealthBar); + } +} + +void DrawHealthBar(float value) +{ + if (CurrentLevel) + { + //int color2; + //if (Lara.poisoned || Lara.gassed) + // color2 = 0xA0A000; + //else + // color2 = 0xA00000; + g_Renderer->DrawBar(value,g_HealthBar); + } +} + +void UpdateHealtBar(int flash) +{ + int hitPoints = LaraItem->hitPoints; + + if (hitPoints < 0) + hitPoints = 0; + else if (hitPoints > 1000) + hitPoints = 1000; + + if (OldHitPoints != hitPoints) + { + OldHitPoints = hitPoints; + HealtBarTimer = 40; + } + + if (HealtBarTimer < 0) + HealtBarTimer = 0; + + if (hitPoints <= 1000 / 4) + { + if (!BinocularRange) + { + if (flash) + DrawHealthBar(hitPoints / 1000.0f); + else + DrawHealthBar(0); + } + else + { + if (flash) + DrawHealthBarOverlay(hitPoints / 1000.0f); + else + DrawHealthBarOverlay(0); + } + } + else if ((HealtBarTimer > 0) + || (hitPoints <= 0) + || (Lara.gunStatus == LG_READY && Lara.gunType != WEAPON_TORCH) + || (Lara.poisoned >= 256)) + { + if (!BinocularRange && !SniperOverlay) + { + DrawHealthBar(hitPoints / 1000.0f); + } + else + { + DrawHealthBarOverlay(hitPoints / 1000.0f); + } + } + + if (PoisonFlag) + PoisonFlag--; +} + +void DrawAirBar(float value) +{ + if (CurrentLevel) + { + g_Renderer->DrawBar(value, g_AirBar); + } +} + +void UpdateAirBar(int flash) +{ + if (Lara.air == 1800 || LaraItem->hitPoints <= 0) + return; + + if ((Lara.Vehicle == NO_ITEM) + || (Items[Lara.Vehicle].objectNumber != ID_UPV)) + { + if ((Lara.waterStatus != LW_UNDERWATER) + && (Lara.waterStatus != LW_SURFACE) + && (!((Rooms[LaraItem->roomNumber].flags & ENV_FLAG_SWAMP) + && (Lara.waterSurfaceDist < -775)))) + return; + } + + int air = Lara.air; + if (air < 0) + air = 0; + else if (air > 1800) + air = 1800; + if (air <= 450) + { + if (flash) + DrawAirBar(air/ 1800.0f); + else + DrawAirBar(0); + } + else + DrawAirBar(air / 1800.0f); + + if (Lara.gassed) + { + if (Lara.dpoisoned < 2048) + Lara.dpoisoned += 2; + Lara.gassed = false; + } +} + +void DrawDashBar(int value) +{ + if (CurrentLevel) + { + g_Renderer->DrawBar(value, g_DashBar); + } +} + +int DrawAllPickups() +{ + if (Pickups[CurrentPickup].life > 0) + { + if (PickupX > 0) + { + PickupX += -PickupX >> 5; + return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); + } + else + { + Pickups[CurrentPickup].life--; + return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); + } + } + else if (Pickups[CurrentPickup].life == 0) + { + if (PickupX < 128) + { + if (PickupVel < 16) + PickupVel++; + PickupX += PickupVel >> 2; + return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); + } + else + { + Pickups[CurrentPickup].life = -1; + PickupVel = 0; + return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); + } + } + + int pickupIndex = CurrentPickup; + int i; + for (i = 0; i < MAX_COLLECTED_PICKUPS; ++i) + { + if (Pickups[pickupIndex].life > 0) + break; + pickupIndex = pickupIndex + 1 & MAX_COLLECTED_PICKUPS - 1; + } + + CurrentPickup = pickupIndex; + if (i != MAX_COLLECTED_PICKUPS) + return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber); + + CurrentPickup = 0; + + return 0; +} + + +void AddDisplayPickup(short objectNumber) +{ + for (int i = 0; i < MAX_COLLECTED_PICKUPS; i++) + { + DISPLAY_PICKUP* pickup = &Pickups[i]; + if (pickup->life < 0) + { + pickup->life = 45; + pickup->objectNumber = objectNumber; + PickedUpObject(objectNumber); + return; + } + } + + // No free slot found, so just pickup the object ithout displaying it + PickedUpObject(objectNumber); +} + +void InitialisePickupDisplay() +{ + for (int i = 0; i < MAX_COLLECTED_PICKUPS; i++) + { + DISPLAY_PICKUP* pickup = &Pickups[i]; + pickup->life = -1; + } + + PickupX = 128; + PickupY = 128; + PickupVel = 0; + CurrentPickup = 0; +} + +int FlashIt() +{ + if (FlashCount) + FlashCount--; + else + { + FlashState ^= 1; + FlashCount = 5; + } + return FlashState; +} diff --git a/TR5Main/Game/healt.h b/TR5Main/Game/health.h similarity index 90% rename from TR5Main/Game/healt.h rename to TR5Main/Game/health.h index 63be9a48c..87f49aa6d 100644 --- a/TR5Main/Game/healt.h +++ b/TR5Main/Game/health.h @@ -1,27 +1,30 @@ -#pragma once - -#include "..\Global\global.h" - -#define MAX_COLLECTED_PICKUPS 32 - -void DrawHealthBarOverlay(int value); -void DrawHealthBar(float value); -void UpdateHealtBar(int flash); -void DrawAirBar(float value); -void UpdateAirBar(int flash); -void DrawDashBar(int value); -void AddDisplayPickup(short objectNumber); -int DrawAllPickups(); -void InitialisePickupDisplay(); -int FlashIt(); - -extern short PickupX; -extern short PickupY; -extern short CurrentPickup; -extern DISPLAY_PICKUP Pickups[MAX_COLLECTED_PICKUPS]; -extern short PickupVel; -extern int OldHitPoints; -extern int HealtBarTimer; -extern int FlashState; -extern int PoisonFlag; -extern int DashTimer; +#pragma once +#define MAX_COLLECTED_PICKUPS 32 + +typedef struct DISPLAY_PICKUP +{ + short life; + short objectNumber; +}; + +void DrawHealthBarOverlay(int value); +void DrawHealthBar(float value); +void UpdateHealtBar(int flash); +void DrawAirBar(float value); +void UpdateAirBar(int flash); +void DrawDashBar(int value); +void AddDisplayPickup(short objectNumber); +int DrawAllPickups(); +void InitialisePickupDisplay(); +int FlashIt(); + +extern short PickupX; +extern short PickupY; +extern short CurrentPickup; +extern DISPLAY_PICKUP Pickups[MAX_COLLECTED_PICKUPS]; +extern short PickupVel; +extern int OldHitPoints; +extern int HealtBarTimer; +extern int FlashState; +extern int PoisonFlag; +extern int DashTimer; diff --git a/TR5Main/Game/inventory.cpp b/TR5Main/Game/inventory.cpp index cfb00c30e..d407c40b1 100644 --- a/TR5Main/Game/inventory.cpp +++ b/TR5Main/Game/inventory.cpp @@ -1,21 +1,21 @@ +#include "framework.h" #include "inventory.h" #include "draw.h" #include "control.h" #include "larafire.h" -#include "sound.h" #include "gameflow.h" #include "sound.h" #include "savegame.h" #include "Lara.h" #include "camera.h" #include "spotcam.h" -#include "..\Global\global.h" -#include "..\Specific\input.h" -#include "..\Specific\configuration.h" + +#include "input.h" +#include "configuration.h" #include "lara1gun.h" #include "lara2gun.h" -#include "../Specific/level.h" -#include "../Specific/input.h" +#include "level.h" +#include "input.h" Inventory* g_Inventory; extern GameFlow* g_GameFlow; @@ -261,7 +261,7 @@ void Inventory::LoadObjects(bool isReload) for (int j = 0; j < NUM_INVENTORY_OBJECTS_PER_RING; j++) { - m_rings[i].objects[j].inventoryObject = -1; + m_rings[i].objects[j].inventoryObject = NO_ITEM; m_rings[i].objects[j].rotation = 0; m_rings[i].objects[j].scale = INV_OBJECTS_SCALE; } diff --git a/TR5Main/Game/inventory.h b/TR5Main/Game/inventory.h index 4a01a108c..bc25467b6 100644 --- a/TR5Main/Game/inventory.h +++ b/TR5Main/Game/inventory.h @@ -1,9 +1,5 @@ #pragma once - -#include "..\Specific\configuration.h" -#include - -using namespace std; +#include "configuration.h" // New inventory #define NUM_INVENTORY_OBJECTS_PER_RING 120 @@ -165,6 +161,19 @@ enum INVENTORY_OBJECTS { INVENTORY_TABLE_SIZE }; +typedef struct INVOBJ +{ + short objectNumber; + short yOff; + short scale1; + short yRot; + short xRot; + short zRot; + short flags; + short objectName; + int meshBits; +}; + // Focus state #define INV_FOCUS_STATE_NONE 0 #define INV_FOCUS_STATE_POPUP 1 @@ -247,13 +256,15 @@ enum INVENTORY_OBJECTS { #define INV_NUM_COMBINATIONS 22 -struct InventoryObject { +struct InventoryObject +{ int inventoryObject; int rotation; float scale; }; -struct InventoryRing { +struct InventoryRing +{ InventoryObject objects[NUM_INVENTORY_OBJECTS_PER_RING]; int numObjects; int currentObject; @@ -277,7 +288,8 @@ struct InventoryRing { int numActions = 3; }; -struct InventoryObjectDefinition { +struct InventoryObjectDefinition +{ short objectNumber; short objectName; int meshBits; @@ -297,7 +309,8 @@ struct InventoryObjectDefinition { } }; -struct InventoryObjectCombination { +struct InventoryObjectCombination +{ short piece1; short piece2; short combinedObject; diff --git a/TR5Main/Game/items.cpp b/TR5Main/Game/items.cpp index 9699a412d..eadd5ec3b 100644 --- a/TR5Main/Game/items.cpp +++ b/TR5Main/Game/items.cpp @@ -1,11 +1,10 @@ +#include "framework.h" #include "items.h" -#include "..\Global\global.h" #include "effect2.h" -#include -#include "../Specific/setup.h" -#include "../Specific/level.h" +#include "setup.h" +#include "level.h" #include "lara.h" -#include "effects.h" +#include "effect.h" void ClearItem(short itemNum) { @@ -30,7 +29,7 @@ void KillItem(short itemNum) { ITEM_INFO* item = &Items[itemNum]; - DetatchSpark(itemNum, 128); + DetatchSpark(itemNum, SP_ITEM); item->active = false; item->reallyActive = false; @@ -52,7 +51,7 @@ void KillItem(short itemNum) } } - if (item->roomNumber != 255) + if (item->roomNumber != NO_ROOM) { if (Rooms[item->roomNumber].itemNumber == itemNum) { @@ -99,7 +98,7 @@ void RemoveAllItemsInRoom(short roomNumber, short objectNumber) if (item->objectNumber == objectNumber) { RemoveActiveItem(currentItemNum); - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; item->flags &= 0xC1; } @@ -115,7 +114,7 @@ void AddActiveItem(short itemNumber) if (Objects[item->objectNumber].control == NULL) { - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; return; } @@ -212,8 +211,7 @@ void KillEffect(short fxNumber) else { FX_INFO* fx = &Effects[fxNumber]; - - DetatchSpark(fxNumber, 128); // TODO: SP_FX have the value 64 but there it's 128 !! + DetatchSpark(fxNumber, SP_FX); if (NextFxActive == fxNumber) { @@ -355,7 +353,7 @@ void InitialiseItem(short itemNum) item->itemFlags[0] = 0; item->active = false; - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; item->gravityStatus = false; item->hitStatus = false; item->collidable = true; @@ -467,7 +465,7 @@ short SpawnItem(ITEM_INFO* item, short objectNumber) InitialiseItem(itemNumber); - spawn->status = ITEM_INACTIVE; + spawn->status = ITEM_NOT_ACTIVE; spawn->shade = 0x4210; } @@ -495,11 +493,11 @@ int GlobalItemReplace(short search, short replace) ITEM_INFO* find_a_fucking_item(short objectNum) { - int itemNumber = FindItem(objectNum); + int itemNumber = FindItemNumber(objectNum); return (itemNumber != NO_ITEM ? &Items[itemNumber] : NULL); } -int FindItem(short objectNum) +int FindItemNumber(short objectNum) { for (int i = 0; i < LevelItems; i++) { @@ -510,3 +508,21 @@ int FindItem(short objectNum) return NO_ITEM; } + +ITEM_INFO* FindItem(short objectNumber) +{ +#ifdef _DEBUG + printf("Called FindItem()\n"); +#endif + + if (LevelItems > 0) + { + for (int i = 0; i < LevelItems; i++) + { + if (Items[i].objectNumber == objectNumber) + return &Items[i]; + } + } + + return NULL; +} \ No newline at end of file diff --git a/TR5Main/Game/items.h b/TR5Main/Game/items.h index 6a95c8a8b..773a24a10 100644 --- a/TR5Main/Game/items.h +++ b/TR5Main/Game/items.h @@ -1,7 +1,89 @@ #pragma once -#include "..\Global\global.h" -#include "control.h" +#include "phd_global.h" +typedef enum AIObjectType +{ + NO_AI = 0x0000, + GUARD = 0x0001, + AMBUSH = 0x0002, + PATROL1 = 0x0004, + MODIFY = 0x0008, + FOLLOW = 0x0010, + PATROL2 = 0x0020, + ALL_AIOBJ = (GUARD | AMBUSH | PATROL1 | MODIFY | FOLLOW | PATROL2) +}; + +typedef enum ItemStatus +{ + ITEM_ACTIVE, + ITEM_NOT_ACTIVE, + ITEM_DESACTIVATED, + ITEM_INVISIBLE +}; + +typedef enum ItemFlags +{ + IFLAG_CLEAR_BODY = (1 << 7), // 0x0080 + IFLAG_INVISIBLE = (1 << 8), // 0x0100 + IFLAG_REVERSE = (1 << 14), // 0x4000 + IFLAG_KILLED = (1 << 15), // 0x8000 + IFLAG_ACTIVATION_MASK = 0x3E00 // bits 9-13 +}; + +typedef struct ITEM_INFO +{ + int floor; + DWORD touchBits; + DWORD meshBits; + short objectNumber; + short currentAnimState; + short goalAnimState; + short requiredAnimState; + short animNumber; + short frameNumber; + short roomNumber; + short nextItem; + short nextActive; + short speed; + short fallspeed; + short hitPoints; + unsigned short boxNumber; + short timer; + unsigned short flags; // ItemFlags enum + short shade; + short triggerFlags; + short carriedItem; + short afterDeath; + short firedWeapon; + short itemFlags[4]; + void* data; + PHD_3DPOS pos; + byte legacyLightData[5528]; + bool active; + short status; // ItemStatus enum + bool gravityStatus; + bool hitStatus; + bool collidable; + bool lookedAt; + bool dynamicLight; + bool poisoned; + byte aiBits; // AIObjectType enum + bool reallyActive; + bool inDrawRoom; + int swapMeshFlags; + short drawRoom; + short TOSSPAD; +}; + +// used by fx->shade ! +#define RGB555(r, g, b) ((r << 7) & 0x7C00 | (g << 2) & 0x3E0 | (b >> 3) & 0x1F) +#define WHITE555 RGB555(255, 255, 255) +#define GRAY555 RGB555(128, 128, 128) +#define BLACK555 RGB555( 0, 0, 0) + +constexpr auto NO_ITEM = -1; +constexpr auto ALL_MESHBITS = -1; +constexpr auto NOT_TARGETABLE = -16384; #define NUM_ITEMS 1024 #define NUM_EFFECTS 1024 @@ -20,4 +102,5 @@ void InitialiseItem(short itemNum); void InitialiseItemArray(int numitems); void KillItem(short itemNum); ITEM_INFO* find_a_fucking_item(short objectNum); -int FindItem(short objectNum); +int FindItemNumber(short objectNumber); +ITEM_INFO* FindItem(short objectNumber); diff --git a/TR5Main/Game/lara.cpp b/TR5Main/Game/lara.cpp index bd1e60685..4d2f8fe95 100644 --- a/TR5Main/Game/lara.cpp +++ b/TR5Main/Game/lara.cpp @@ -1,14 +1,13 @@ +#include "framework.h" #include "Lara.h" - #include "control.h" #include "items.h" -#include "collide.h" #include "inventory.h" #include "larafire.h" #include "misc.h" #include "draw.h" #include "sphere.h" -#include "Camera.h" +#include "camera.h" #include "larasurf.h" #include "laraswim.h" #include "lara1gun.h" @@ -17,15 +16,21 @@ #include "laramisc.h" #include "laraclmb.h" #include "rope.h" -#include "healt.h" - -#include "..\Objects\newobjects.h" -#include "..\Global\global.h" -#include "../Specific/level.h" -#include "../Specific/input.h" +#include "health.h" +#include "level.h" +#include "input.h" #include "sound.h" +#include "setup.h" -#include +#include "motorbike.h" +#include "cannon.h" +#include "quad.h" +#include "snowmobile.h" +#include "jeep.h" +#include "boat.h" +#include "upv.h" +#include "kayak.h" +#include "minecart.h" static short LeftClimbTab[4] = // offset 0xA0638 { @@ -45,12 +50,11 @@ short OldAngle = 1; int RopeSwing = 0; LaraInfo Lara; ITEM_INFO* LaraItem; -byte LaraNodeUnderwater[15]; +byte LaraNodeUnderwater[NUM_LARA_MESHES]; bool EnableCrouchRoll, EnableFeetHang, EnableMonkeyVault, EnableMonkeyRoll, EnableCrawlFlex1click, EnableCrawlFlex2click, EnableCrawlFlex3click; bool EnableCrawlFlex1clickE, EnableCrawlFlex2clickE, EnableCrawlFlex1clickup, EnableCrawlFlex1clickdown; -void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll) = -{ +function lara_control_routines[NUM_LARA_STATES + 1] = { lara_as_walk, lara_as_run, lara_as_stop, @@ -198,9 +202,7 @@ void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* co lara_as_hang_feet_outRcorner, lara_as_hang_feet_outLcorner, }; - -void(*lara_collision_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll) = -{ +function lara_collision_routines[NUM_LARA_STATES + 1] = { lara_col_walk, lara_col_run, lara_col_stop, @@ -347,8 +349,10 @@ void(*lara_collision_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* lara_default_col, lara_default_col, lara_default_col, - }; +/*function lara_camera_routines[NUM_LARA_STATES + 1] = { + +};*/ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) { @@ -366,7 +370,7 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) coll->radius = LARA_RAD; coll->trigger = NULL; - if ((TrInput & IN_LOOK) && Lara.ExtraAnim == 0 && Lara.look) + if ((TrInput & IN_LOOK) && Lara.ExtraAnim == NO_ITEM && Lara.look) LookLeftRight(); else ResetLook(); @@ -403,6 +407,16 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) return; break; + //case ID_SPEEDBOAT: + // if (BoatControl()) + // return; + // break; + + //case ID_RUBBERBOAT: + // if (RubberBoatControl()) + // return; + // break; + //case ID_UPV: // if (SubControl()) // return; @@ -419,7 +433,7 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) } // Handle current Lara status - (*lara_control_routines[item->currentAnimState])(item, coll); + lara_control_routines[item->currentAnimState](item, coll); if (item->pos.zRot >= -ANGLE(1.0f) && item->pos.zRot <= ANGLE(1.0f)) item->pos.zRot = 0; @@ -439,14 +453,14 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) // Animate Lara AnimateLara(item); - if (Lara.ExtraAnim == 0) + if (Lara.ExtraAnim == NO_ITEM) { // Check for collision with items LaraBaddieCollision(item, coll); // Handle Lara collision if (Lara.Vehicle == NO_ITEM) - (*lara_collision_routines[item->currentAnimState])(item, coll); + lara_collision_routines[item->currentAnimState](item, coll); } UpdateLaraRoom(item, -LARA_HITE/2); @@ -1783,13 +1797,13 @@ void lara_as_pulley(ITEM_INFO* item, COLL_INFO* coll)//1B288, 1B3BC (F) if (p->itemFlags[2]) { p->itemFlags[2] = 0; - p->status = ITEM_DEACTIVATED; + p->status = ITEM_DESACTIVATED; } } else { if (!p->itemFlags[1]) - p->status = ITEM_DEACTIVATED; + p->status = ITEM_DESACTIVATED; p->itemFlags[2] = 1; diff --git a/TR5Main/Game/lara.h b/TR5Main/Game/lara.h index d0a002487..13778db62 100644 --- a/TR5Main/Game/lara.h +++ b/TR5Main/Game/lara.h @@ -1,154 +1,32 @@ -#pragma once +#pragma once +#include "lara_struct.h" -#include "..\Global\global.h" -#include "..\Renderer\Renderer11.h" +#define FRONT_ARC ANGLE(90.0f) +#define LARA_LEAN_RATE ANGLE(1.5f) +#define LARA_LEAN_MAX ANGLE(11.0f) +#define LARA_TURN_RATE ANGLE(2.25f) +#define LARA_JUMP_TURN ANGLE(3.0f) +#define LARA_SLOW_TURN ANGLE(4.0f) +#define LARA_MED_TURN ANGLE(6.0f) +#define LARA_FAST_TURN ANGLE(8.0f) -typedef struct CarriedWeaponInfo { - bool Present; - short Ammo[3]; - byte SelectedAmmo; - bool HasLasersight; - bool HasSilencer; -}; - -typedef struct DiaryInfo { - bool Present; -}; - -struct WaterskinInfo { - bool Present; - int Quantity; -}; - -struct LaraInfo { - short itemNumber; - short gunStatus; - short gunType; - short requestGunType; - short lastGunType; - short calcFallSpeed; - short waterStatus; - short climbStatus; - short poseCount; - short hitFrame; - short hitDirection; - short air; - short diveCount; - short deathCount; - short currentActive; - short currentXvel; - short currentYvel; - short currentZvel; - short spazEffectCount; - short flareAge; - short burnCount; - short weaponItem; - short backGun; - short flareFrame; - short poisoned; - short dpoisoned; - byte anxiety; - byte wet[15]; - bool flareControlLeft; - bool unused1; - bool look; - bool burn; - bool keepDucked; - bool isMoving; - bool canMonkeySwing; - byte burnBlue; - bool gassed; - bool burnSmoke; - bool isDucked; - bool hasFired; - bool busy; - bool litTorch; - bool isClimbing; - bool fired; - int waterSurfaceDist; - PHD_VECTOR lastPos; - FX_INFO* spazEffect; - int meshEffects; - short* meshPtrs[15]; - ITEM_INFO* target; - short targetAngles[2]; - short turnRate; - short moveAngle; - short headYrot; - short headXrot; - short headZrot; - short torsoYrot; - short torsoXrot; - short torsoZrot; - LARA_ARM leftArm; - LARA_ARM rightArm; - unsigned short holster; - CREATURE_INFO* creature; - int cornerX; - int cornerZ; - byte ropeSegment; - byte ropeDirection; - short ropeArcFront; - short ropeArcBack; - short ropeLastX; - short ropeMaxXForward; - short ropeMaxXBackward; - int ropeDFrame; - int ropeFrame; - unsigned short ropeFrameRate; - unsigned short ropeY; - int ropePtr; - void* generalPtr; - int ropeOffset; - int ropeDownVel; - byte ropeFlag; - byte moveCount; - int ropeCount; - byte skelebob; - byte wetcloth; - byte bottle; - byte location; - byte highestLocation; - byte locationPad; - byte tightRopeOnCount; - byte tightRopeOff; - byte tightRopeFall; - byte chaffTimer; - - short Vehicle; - short ExtraAnim; - bool mineL; - bool mineR; - CarriedWeaponInfo Weapons[NUM_WEAPONS]; - DiaryInfo Diary; - WaterskinInfo Waterskin1; - WaterskinInfo Waterskin2; - RendererMesh* MeshesPointers[15]; - int Puzzles[NUM_PUZZLES]; - int Keys[NUM_KEYS]; - int Pickups[NUM_PICKUPS]; - int Examines[NUM_EXAMINES]; - int PuzzlesCombo[NUM_PUZZLES * 2]; - int KeysCombo[NUM_KEYS * 2]; - int PickupsCombo[NUM_PICKUPS * 2]; - int ExaminesCombo[NUM_EXAMINES * 2]; - int Secrets; - bool Lasersight; - bool Crowbar; - bool Torch; - bool Silencer; - bool Binoculars; - int NumSmallMedipacks; - int NumLargeMedipacks; - int NumFlares; -}; +constexpr auto LARA_HITE = 762; // the size of lara (from the floor to the top of the head) +constexpr auto LARA_FREEFALL_SPEED = 131; +constexpr auto LARA_RAD = 100; +constexpr auto LARA_VELOCITY = 12; extern LaraInfo Lara; extern ITEM_INFO* LaraItem; -extern byte LaraNodeUnderwater[15]; +extern byte LaraNodeUnderwater[NUM_LARA_MESHES]; -extern void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll); -extern void(*lara_collision_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll); +#define LARA_MESHES(slot, mesh) Lara.meshPtrs[mesh] = MESHES(slot, mesh) +#define CHECK_LARA_MESHES(slot, mesh) Lara.meshPtrs[mesh] == MESHES(slot, mesh) +#define INIT_LARA_MESHES(mesh, to, from) Lara.meshPtrs[mesh] = LARA_MESHES(to, mesh) = LARA_MESHES(from, mesh) + +#define LaraRoutineFunction void(ITEM_INFO* item, COLL_INFO* coll) +extern function lara_control_routines[NUM_LARA_STATES + 1]; +extern function lara_collision_routines[NUM_LARA_STATES + 1]; +///extern function lara_camera_routines[NUM_LARA_STATES + 1]; void lara_as_pbleapoff(ITEM_INFO* item, COLL_INFO* coll); void lara_as_parallelbars(ITEM_INFO* item, COLL_INFO* coll); diff --git a/TR5Main/Game/lara1gun.cpp b/TR5Main/Game/lara1gun.cpp index e99deb57f..c71460060 100644 --- a/TR5Main/Game/lara1gun.cpp +++ b/TR5Main/Game/lara1gun.cpp @@ -1,11 +1,12 @@ +#include "framework.h" #include "lara1gun.h" #include "items.h" #include "Lara.h" #include "larafire.h" #include "draw.h" -#include "Box.h" +#include "box.h" #include "control.h" -#include "effects.h" +#include "effect.h" #include "effect2.h" #include "tomb4fx.h" #include "lot.h" @@ -17,15 +18,12 @@ #include "sphere.h" #include "traps.h" #include "camera.h" - -#include "..\Global\global.h" -#include "..\Scripting\GameFlowScript.h" -#include "..\Specific\level.h" -#include "../Specific/setup.h" -#include "../Specific/input.h" +#include "GameFlowScript.h" +#include "level.h" +#include "setup.h" +#include "input.h" #include "savegame.h" #include "sound.h" - #include "bubble.h" extern GameFlow* g_GameFlow; @@ -58,7 +56,7 @@ void FireHarpoon() pos.z = dxPos.z = 77; g_Renderer->GetLaraBonePosition(&dxPos, LM_RHAND); - GetLaraJointPosition((PHD_VECTOR*)&pos, LM_RHAND); + GetLaraJointPosition(&PHD_VECTOR(pos.x, pos.y, pos.z), LM_RHAND); /*item->pos.xPos = pos.x = dxPos.x; item->pos.yPos = pos.y = dxPos.y; @@ -340,6 +338,15 @@ void FireGrenade() } } +enum GRENADE_TYPE +{ + GRENADE_NORMAL, + GRENADE_SUPER, + GRENADE_FLASH, + GRENADE_ULTRA, + GRENADE_FLAGS +}; + void ControlGrenade(short itemNumber) { ITEM_INFO* item = &Items[itemNumber]; @@ -524,7 +531,7 @@ void ControlGrenade(short itemNumber) int ceiling; short roomNumber; - if (item->itemFlags[0] == WEAPON_AMMO4) + if (item->itemFlags[0] == GRENADE_ULTRA) { roomNumber = item->roomNumber; @@ -575,7 +582,7 @@ void ControlGrenade(short itemNumber) item->hitPoints = 1;*/ } - if (item->itemFlags[0] == WEAPON_AMMO4) + if (item->itemFlags[0] == GRENADE_ULTRA) GrenadeLauncherSpecialEffect1(item->pos.xPos, item->pos.yPos, item->pos.zPos, -1, 1); // Time to explode? @@ -600,7 +607,7 @@ void ControlGrenade(short itemNumber) } } - if (!(item->itemFlags[0] == WEAPON_AMMO3 && explode)) + if (!(item->itemFlags[0] == GRENADE_FLASH && explode)) { int n = 0; bool foundCollidedObjects = false; @@ -616,7 +623,7 @@ void ControlGrenade(short itemNumber) foundCollidedObjects = true; - if (item->itemFlags[0] != WEAPON_AMMO3 || explode) + if (item->itemFlags[0] != GRENADE_FLASH || explode) { if (CollidedItems[0]) { @@ -724,9 +731,9 @@ void ControlGrenade(short itemNumber) } while (n < 2); } - if (explode || (item->itemFlags[0] == WEAPON_AMMO3 && explode)) + if (explode || (item->itemFlags[0] == GRENADE_FLASH && explode)) { - if (item->itemFlags[0] == WEAPON_AMMO3) + if (item->itemFlags[0] == GRENADE_FLASH) { FlashFader = 32; FlashFadeR = 255; @@ -762,10 +769,10 @@ void ControlGrenade(short itemNumber) SoundEffect(105, &item->pos, PITCH_SHIFT | 0x1800000); SoundEffect(106, &item->pos, 0); - if (item->itemFlags[0] != WEAPON_AMMO1 && item->itemFlags[0] != 4) + if (item->itemFlags[0] != GRENADE_NORMAL && item->itemFlags[0] != 4) { item->meshBits = 0; - item->itemFlags[1] = (item->itemFlags[0] != WEAPON_AMMO2 ? 16 : 4); + item->itemFlags[1] = (item->itemFlags[0] != GRENADE_SUPER ? 16 : 4); return; } @@ -1063,6 +1070,13 @@ void AnimateShotgun(int weaponType) Lara.leftArm.animNumber = Lara.rightArm.animNumber = item->animNumber; } +enum CROSSBOW_TYPE +{ + CROSSBOW_NORMAL, + CROSSBOW_POISON, + CROSSBOW_EXPLODE +}; + void ControlCrossbowBolt(short itemNumber) { ITEM_INFO* item = &Items[itemNumber]; @@ -1080,7 +1094,7 @@ void ControlCrossbowBolt(short itemNumber) if (item->speed > 64) item->speed -= (item->speed >> 4); if (GlobalCounter & 1) - CreateBubble((PHD_VECTOR*)&item->pos, roomNumber, 4, 7, 0, 0, 0, 0); + CreateBubble(&PHD_VECTOR(item->pos.xPos, item->pos.yPos, item->pos.zPos), roomNumber, 4, 7, 0, 0, 0, 0); } else { @@ -1103,15 +1117,17 @@ void ControlCrossbowBolt(short itemNumber) item->pos.zPos = oldZ; // If ammos are normal, then just shatter the bolt and quit - if (item->itemFlags[0] != WEAPON_AMMO3) + if (item->itemFlags[0] != CROSSBOW_EXPLODE) { - ExplodeItemNode(item, 0, 0, 256); + ExplodeItemNode(item, 0, 0, EXPLODE_NORMAL); KillItem(itemNumber); return; } - - // Otherwise, bolt must explode - explode = true; + else + { + // Otherwise, bolt must explode + explode = true; + } } // Has bolt changed room? @@ -1140,7 +1156,7 @@ void ControlCrossbowBolt(short itemNumber) foundCollidedObjects = true; - if (item->itemFlags[0] != WEAPON_AMMO3 || explode) + if (item->itemFlags[0] != CROSSBOW_EXPLODE || explode) { if (CollidedItems[0]) { @@ -1155,16 +1171,14 @@ void ControlCrossbowBolt(short itemNumber) if (item->objectNumber < ID_SMASH_OBJECT1 || item->objectNumber > ID_SMASH_OBJECT8) { if (currentItem->objectNumber == ID_SHOOT_SWITCH1 || currentItem->objectNumber == ID_SHOOT_SWITCH2) - CrossbowHitSwitchType78(item, currentItem, 0); + DoCrossbowDamage(item, currentItem, 0); else if (Objects[item->objectNumber].hitEffect) DoGrenadeDamageOnBaddie(currentItem, item); } else { TriggerExplosionSparks(currentItem->pos.xPos, currentItem->pos.yPos, currentItem->pos.zPos, 3, -2, 0, currentItem->roomNumber); - currentItem->pos.yPos -= 128; - TriggerShockwave(¤tItem->pos, 48, 304, 96, 0, 96, 128, 24, 0, 0); - currentItem->pos.yPos += 128; + TriggerShockwave(&PHD_3DPOS(currentItem->pos.xPos, currentItem->pos.yPos - 128, currentItem->pos.zPos), 48, 304, 96, 0, 96, 128, 24, 0, 0); ExplodeItemNode(currentItem, 0, 0, 128); short currentItemNumber = (currentItem - CollidedItems[0]); SmashObject(currentItemNumber); @@ -1174,14 +1188,14 @@ void ControlCrossbowBolt(short itemNumber) else if (currentItem->objectNumber == ID_SHOOT_SWITCH1 || currentItem->objectNumber == ID_SHOOT_SWITCH2) { // Special case for ID_SWITCH_TYPE7 and ID_SWITCH_TYPE8 - CrossbowHitSwitchType78(item, currentItem, 1); + DoCrossbowDamage(item, currentItem, 1); } else if (Objects[currentItem->objectNumber].hitEffect) { - HitTarget(currentItem, (GAME_VECTOR*)&item->pos, Weapons[WEAPON_CROSSBOW].damage, 0); + HitTarget(currentItem, &GAME_VECTOR(item->pos.xPos, item->pos.yPos, item->pos.zPos), Weapons[WEAPON_CROSSBOW].damage, 0); // Poisoned ammos - if (item->itemFlags[0] == WEAPON_AMMO2 && !Objects[currentItem->objectNumber].explodableMeshbits) + if (item->itemFlags[0] == CROSSBOW_POISON && !Objects[currentItem->objectNumber].explodableMeshbits) item->poisoned = true; } @@ -1198,16 +1212,14 @@ void ControlCrossbowBolt(short itemNumber) do { - if (currentMesh->staticNumber >= 50 && currentMesh->staticNumber < 58) + if (currentMesh->staticNumber >= 50 && currentMesh->staticNumber < 58) // SHATTER { if (explode) { TriggerExplosionSparks(currentMesh->x, currentMesh->y, currentMesh->z, 3, -2, 0, item->roomNumber); - currentMesh->y -= 128; - TriggerShockwave((PHD_3DPOS*)¤tMesh, 40, 176, 64, 0, 96, 128, 16, 0, 0); - currentMesh->y += 128; + TriggerShockwave(&PHD_3DPOS(currentMesh->x, currentMesh->y - 128, currentMesh->z, 0, currentMesh->yRot, 0), 40, 176, 64, 0, 96, 128, 16, 0, 0); } - ShatterObject((SHATTER_ITEM*)item, NULL, -128, item->roomNumber, 0); + ShatterObject((SHATTER_ITEM*)item, NULL, -128, item->roomNumber, 0); // TODO: this wont work !! SmashedMeshRoom[SmashedMeshCount] = item->roomNumber; SmashedMesh[SmashedMeshCount] = currentMesh; SmashedMeshCount++; @@ -1232,16 +1244,17 @@ void ControlCrossbowBolt(short itemNumber) { if (foundCollidedObjects) { - ExplodeItemNode(item, 0, 0, 256); + ExplodeItemNode(item, 0, 0, EXPLODE_NORMAL); KillItem(itemNumber); } return; } // At this point, for sure bolt must explode - if (Rooms[item->roomNumber].flags & ENV_FLAG_WATER) + { TriggerUnderwaterExplosion(item); + } else { TriggerShockwave(&item->pos, 48, 304, 96, 0, 96, 128, 24, 0, 0); @@ -1253,12 +1266,12 @@ void ControlCrossbowBolt(short itemNumber) AlertNearbyGuards(item); - SoundEffect(105, &item->pos, PITCH_SHIFT | 0x1800000); - SoundEffect(106, &item->pos, 0); + SoundEffect(SFX_EXPLOSION1, &item->pos, PITCH_SHIFT | 0x1800000); + SoundEffect(SFX_EXPLOSION2, &item->pos, 0); if (foundCollidedObjects || explode) { - ExplodeItemNode(item, 0, 0, 256); + ExplodeItemNode(item, 0, 0, EXPLODE_NORMAL); KillItem(itemNumber); } @@ -1477,12 +1490,12 @@ void undraw_shotgun(int weapon) AnimateItem(item); - if (item->status == ITEM_DEACTIVATED) + if (item->status == ITEM_DESACTIVATED) { Lara.gunStatus = LG_NO_ARMS; Lara.target = NULL; - Lara.rightArm.lock = 0; - Lara.leftArm.lock = 0; + Lara.rightArm.lock = false; + Lara.leftArm.lock = false; KillItem(Lara.weaponItem); @@ -1515,7 +1528,7 @@ void draw_shotgun_meshes(int weaponType) LARA_MESHES(WeaponObjectMesh(weaponType), LM_RHAND); } -void CrossbowHitSwitchType78(ITEM_INFO* item1, ITEM_INFO* item2, signed int search) +void DoCrossbowDamage(ITEM_INFO* item1, ITEM_INFO* item2, signed int search) { /*v4 = item2; if (!(item2->flags & 0x40)) @@ -1675,10 +1688,10 @@ void FireShotgun() for (int i = 0; i < 6; i++) { - loopAngles[0] = angles[0] + value * (GetRandomControl() - ANGLE(90)) / 0x10000; - loopAngles[1] = angles[1] + value * (GetRandomControl() - ANGLE(90)) / 0x10000; + loopAngles[0] = angles[0] + value * (GetRandomControl() - 0x4000) / 0x10000; + loopAngles[1] = angles[1] + value * (GetRandomControl() - 0x4000) / 0x10000; - if (FireWeapon(WEAPON_SHOTGUN, Lara.target, LaraItem, loopAngles)) + if (FireWeapon(WEAPON_SHOTGUN, Lara.target, LaraItem, loopAngles) == FW_MAYBEHIT) fired = true; } @@ -1707,12 +1720,10 @@ void FireShotgun() SmokeCountL = 32; SmokeWeapon = WEAPON_SHOTGUN; - if (LaraItem->meshBits) + if (LaraItem->meshBits != 0) { for (int i = 0; i < 7; i++) - { - TriggerGunSmoke(pos2.x, pos2.y, pos2.z, pos.x - pos2.x, pos.y - pos2.y, pos.z - pos2.z, 1, SmokeWeapon, 32); - } + TriggerGunSmoke(pos2.x, pos2.y, pos2.z, pos.x - pos2.x, pos.y - pos2.y, pos.z - pos2.z, 1, SmokeWeapon, SmokeCountL); } Lara.rightArm.flash_gun = Weapons[WEAPON_SHOTGUN].flashTime; diff --git a/TR5Main/Game/lara1gun.h b/TR5Main/Game/lara1gun.h index 1734ad39c..2de8ce144 100644 --- a/TR5Main/Game/lara1gun.h +++ b/TR5Main/Game/lara1gun.h @@ -1,26 +1,24 @@ #pragma once +#include "items.h" +#include "trmath.h" -#include "..\Global\global.h" - -#define HARPOON_DRAW_ANIM 1 -#define ROCKET_DRAW_ANIM 0 - -#define PELLET_SCATTER ANGLE(20) -#define HARPOON_SPEED 256 -#define HARPOON_TIME 256 -#define ROCKET_SPEED 512 -#define GRENADE_SPEED 128 -#define MAX_GRENADE_FALLSPEED 128 -#define GRENADE_YOFF 180 -#define GRENADE_ZOFF 80 -#define GRENADE_BLAST_RADIUS (WALL_SIZE * 2) -#define CROSSBOW_DAMAGE 5 -#define CROSSBOW_AMMO1 1 -#define CROSSBOW_AMMO2 2 -#define CROSSBOW_AMMO3 2 -#define CROSSBOW_HIT_RADIUS 128 -#define CROSSBOW_EXPLODE_RADIUS 2048 -#define GRENADE_EXPLODE_RADIUS 2048 +#define PELLET_SCATTER ANGLE(20.0f) +constexpr auto HARPOON_DRAW_ANIM = 1; +constexpr auto ROCKET_DRAW_ANIM = 0; +constexpr auto HARPOON_SPEED = 256; +constexpr auto HARPOON_TIME = 256; +constexpr auto ROCKET_SPEED = 512; +constexpr auto GRENADE_SPEED = 128; +constexpr auto MAX_GRENADE_FALLSPEED = 128; +constexpr auto GRENADE_YOFF = 180; +constexpr auto GRENADE_ZOFF = 80; +constexpr auto CROSSBOW_DAMAGE = 5; +constexpr auto CROSSBOW_AMMO1 = 1; +constexpr auto CROSSBOW_AMMO2 = 2; +constexpr auto CROSSBOW_AMMO3 = 2; +constexpr auto CROSSBOW_HIT_RADIUS = 128; +constexpr auto CROSSBOW_EXPLODE_RADIUS = SECTOR(2); +constexpr auto GRENADE_EXPLODE_RADIUS = SECTOR(2); void FireGrenade(); void ControlGrenade(short itemNumber); @@ -39,5 +37,5 @@ void undraw_shotgun(int weapon); void draw_shotgun_meshes(int weaponType); void FireHK(int mode); void FireShotgun(); -void CrossbowHitSwitchType78(ITEM_INFO* item1, ITEM_INFO* item2, signed int search); +void DoCrossbowDamage(ITEM_INFO* item1, ITEM_INFO* item2, signed int search); void ready_shotgun(int weaponType); diff --git a/TR5Main/Game/lara2gun.cpp b/TR5Main/Game/lara2gun.cpp index 964779fcd..dfb79ff8e 100644 --- a/TR5Main/Game/lara2gun.cpp +++ b/TR5Main/Game/lara2gun.cpp @@ -1,17 +1,25 @@ +#include "framework.h" #include "lara2gun.h" -#include "..\Global\global.h" #include "larafire.h" #include "lara.h" #include "effect2.h" #include "draw.h" #include "tomb4fx.h" -#include "..\Specific\level.h" -#include "..\Specific\setup.h" +#include "level.h" +#include "setup.h" #include "camera.h" -#include "../Specific/input.h" +#include "input.h" #include "sound.h" #include "savegame.h" +struct PISTOL_DEF +{ + short objectNum; + char draw1Anim2; + char draw1Anim; + char draw2Anim; + char recoilAnim; +}; PISTOL_DEF PistolsTable[4] = { { ID_LARA, 0, 0, 0, 0 }, @@ -56,7 +64,7 @@ void AnimatePistols(int weaponType) } GetLaraJointPosition(&pos, LM_LHAND); - TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, (byte)0, SmokeWeapon, SmokeCountL); + TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, 0, SmokeWeapon, SmokeCountL); } if (SmokeCountR) @@ -83,7 +91,7 @@ void AnimatePistols(int weaponType) } GetLaraJointPosition(&pos, LM_RHAND); - TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, (byte)0, SmokeWeapon, SmokeCountR); + TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, 0, SmokeWeapon, SmokeCountR); } } @@ -103,7 +111,7 @@ void AnimatePistols(int weaponType) angleRight[0] = Lara.rightArm.yRot + LaraItem->pos.yRot; angleRight[1] = Lara.rightArm.xRot; - if (FireWeapon(weaponType, Lara.target, LaraItem, angleRight)) + if (FireWeapon(weaponType, Lara.target, LaraItem, angleRight) != FW_NOAMMO) { SmokeCountR = 28; SmokeWeapon = weaponType; @@ -173,7 +181,7 @@ void AnimatePistols(int weaponType) angleLeft[0] = Lara.leftArm.yRot + LaraItem->pos.yRot; angleLeft[1] = Lara.leftArm.xRot; - if (FireWeapon(weaponType, Lara.target, LaraItem, angleLeft)) + if (FireWeapon(weaponType, Lara.target, LaraItem, angleLeft) != FW_NOAMMO) { if (weaponType == WEAPON_REVOLVER) { @@ -367,8 +375,8 @@ void ready_pistols(int weaponType) Lara.rightArm.frameNumber = 0; Lara.leftArm.frameNumber = 0; Lara.target = NULL; - Lara.rightArm.lock = 0; - Lara.leftArm.lock = 0; + Lara.rightArm.lock = false; + Lara.leftArm.lock = false; Lara.rightArm.frameBase = Objects[WeaponObject(weaponType)].frameBase; Lara.leftArm.frameBase = Objects[WeaponObject(weaponType)].frameBase; } @@ -443,8 +451,8 @@ void undraw_pistols(int weaponType) Lara.leftArm.frameNumber = 0; Lara.rightArm.frameNumber = 0; Lara.target = NULL; - Lara.rightArm.lock = 0; - Lara.leftArm.lock = 0; + Lara.rightArm.lock = false; + Lara.leftArm.lock = false; } if (!(TrInput & IN_LOOK)) diff --git a/TR5Main/Game/lara2gun.h b/TR5Main/Game/lara2gun.h index c314a30b6..0f161a6c1 100644 --- a/TR5Main/Game/lara2gun.h +++ b/TR5Main/Game/lara2gun.h @@ -1,5 +1,5 @@ #pragma once -#include "..\Global\global.h" +#include "lara_struct.h" void AnimatePistols(int weaponType); void PistolHandler(int weaponType); diff --git a/TR5Main/Global/enums.h b/TR5Main/Game/lara_struct.h similarity index 90% rename from TR5Main/Global/enums.h rename to TR5Main/Game/lara_struct.h index 252c3db90..8ecc77da1 100644 --- a/TR5Main/Global/enums.h +++ b/TR5Main/Game/lara_struct.h @@ -1,1040 +1,909 @@ -#pragma once - -enum SPRITE_TYPES -{ - SPR_FIRE0, - SPR_FIRE1, - SPR_FIRE2, - SPR_FIRE3, - SPR_SPLASH1, - SPR_SPLASH2, - SPR_SPLASH3, - SPR_SPLASH4, - SPR_SPLASH, - SPR_RIPPLES, - SPR_LENSFLARE, - SPR_LENSFLARE_LIGHT, - SPR_BULLETIMPACT, - SPR_BUBBLES, - SPR_UNDERWATERDUST, - SPR_BLOOD, - SPR_EMPTY1, - SPR_UNKNOWN1, - SPR_EMPTY2, - SPR_BACKGROUND, - SPR_GUI_UPLEFT, - SPR_GUI_UPRIGHT, - SPR_GUI_DOWNLEFT, - SPR_GUI_DOWNRIGHT, - SPR_GUI_DOWN, - SPR_GUI_UP, - SPR_GUI_LEFT, - SPR_GUI_RIGHT, - SPR_LIGHTHING -}; - -enum TYPE_ZONE -{ - ZONE_NULL = -1, // default zone - ZONE_SKELLY = 0, - ZONE_BASIC, - ZONE_FLYER, - ZONE_HUMAN_CLASSIC, - ZONE_WATER, - ZONE_HUMAN_JUMP_AND_MONKEY, - ZONE_HUMAN_JUMP, - ZONE_SPIDER, - ZONE_BLOCKABLE, // for trex, shiva, etc.. - ZONE_SOPHIALEE, // dont want sophia to go down again ! - ZONE_APE, // only 2 click climb -}; - -enum FLOOR_TYPES -{ - FLOOR_TYPE, - DOOR_TYPE, - TILT_TYPE, - ROOF_TYPE, - TRIGGER_TYPE, - LAVA_TYPE, - CLIMB_TYPE, - SPLIT1, - SPLIT2, - SPLIT3, - SPLIT4, - NOCOLF1T, - NOCOLF1B, - NOCOLF2T, - NOCOLF2B, - NOCOLC1T, - NOCOLC1B, - NOCOLC2T, - NOCOLC2B, - MONKEY_TYPE, - TRIGTRIGGER_TYPE, - MINER_TYPE -}; - -enum TRIGGER_TYPES -{ - TRIGGER, - PAD, - SWITCH, - KEY, - PICKUP, - HEAVY, - ANTIPAD, - COMBAT, - DUMMY, - ANTITRIGGER, - HEAVYSWITCH, - HEAVYANTITRIGGER, - MONKEY, - SKELETON_T, - TIGHTROPE_T, - CRAWLDUCK_T, - CLIMB_T, -}; - -enum TRIGOBJECTS_TYPES -{ - TO_OBJECT, - TO_CAMERA, - TO_SINK, - TO_FLIPMAP, - TO_FLIPON, - TO_FLIPOFF, - TO_TARGET, - TO_FINISH, - TO_CD, - TO_FLIPEFFECT, - TO_SECRET, - TO_LUA_SCRIPT, - TO_FLYBY, - TO_CUTSCENE -}; - -enum FLOORDATA_MASKS -{ - FD_MASK_FUNCTION = 0x1F, - FD_MASK_SUBFUNCTION = 0x7F00, - FD_MASK_END_DATA = 0x8000 -}; - -enum MOOD_TYPE -{ - BORED_MOOD, - ATTACK_MOOD, - ESCAPE_MOOD, - STALK_MOOD -}; - -enum TARGET_TYPE -{ - NO_TARGET, - PRIME_TARGET, - SECONDARY_TARGET -}; - -enum ITEM_STATUS -{ - ITEM_INACTIVE, - ITEM_ACTIVE, - ITEM_DEACTIVATED, - ITEM_INVISIBLE -}; - -enum ITEM_FLAGS -{ - IFLAG_CLEAR_BODY = (1 << 7), // 0x0080 - IFLAG_INVISIBLE = (1 << 8), // 0x0100 - IFLAG_REVERSE = (1 << 14), // 0x4000 - IFLAG_KILLED = (1 << 15), // 0x8000 - IFLAG_ACTIVATION_MASK = 0x3E00 // bits 9-13 -}; - -enum CAMERA_TYPE -{ - CHASE_CAMERA, - FIXED_CAMERA, - LOOK_CAMERA, - COMBAT_CAMERA, - CINEMATIC_CAMERA, - HEAVY_CAMERA -}; - -enum LARA_DRAW_TYPE -{ - LARA_NORMAL = 1, - LARA_YOUNG = 2, - LARA_BUNHEAD = 3, - LARA_CATSUIT = 4, - LARA_DIVESUIT = 5, - LARA_INVISIBLE = 7 -}; - -enum LARA_WATER_STATUS -{ - LW_ABOVE_WATER, - LW_UNDERWATER, - LW_SURFACE, - LW_FLYCHEAT, - LW_WADE -}; - -enum LARA_GUN_STATUS -{ - LG_NO_ARMS, - LG_HANDS_BUSY, - LG_DRAW_GUNS, - LG_UNDRAW_GUNS, - LG_READY, - LG_SPECIAL -}; - -enum INPUT_BUTTONS -{ - IN_NONE = 0, // 0x00000000 - IN_FORWARD = (1 << 0), // 0x00000001 - IN_BACK = (1 << 1), // 0x00000002 - IN_LEFT = (1 << 2), // 0x00000004 - IN_RIGHT = (1 << 3), // 0x00000008 - IN_JUMP = (1 << 4), // 0x00000010 - IN_DRAW = (1 << 5), // Space / Triangle // 0x00000020 - IN_ACTION = (1 << 6), // Ctrl / X // 0x00000040 - IN_WALK = (1 << 7), // Shift / R1 // 0x00000080 - IN_OPTION = (1 << 8), // 0x00000100 - IN_LOOK = (1 << 9), // 0x00000200 - IN_LSTEP = (1 << 10), // 0x00000400 - IN_RSTEP = (1 << 11), // 0x00000800 - IN_ROLL = (1 << 12), // End / O // 0x00001000 - IN_PAUSE = (1 << 13), // 0x00002000 - IN_A = (1 << 14), // 0x00004000 - IN_B = (1 << 15), // 0x00008000 - IN_CHEAT = (1 << 16), // 0x00010000 - IN_D = (1 << 17), // 0x00020000 - IN_E = (1 << 18), // 0x00040000 - IN_FLARE = (1 << 19), // 0x00080000 - IN_SELECT = (1 << 20), // 0x00100000 - IN_DESELECT = (1 << 21), // 0x00200000 - IN_SAVE = (1 << 22), // F5 // 0x00400000 - IN_LOAD = (1 << 23), // F6 // 0x00800000 - IN_STEPSHIFT = (1 << 24), // 0x01000000 - IN_LOOKLEFT = (1 << 25), // 0x02000000 - IN_LOOKRIGHT = (1 << 26), // 0x04000000 - IN_LOOKFORWARD = (1 << 27), // 0x08000000 - IN_LOOKBACK = (1 << 28), // 0x10000000 - IN_DUCK = (1 << 29), // 0x20000000 - IN_SPRINT = (1 << 30), // 0x40000000 - IN_LOOKSWITCH = (1 << 31), // 0x80000000 - IN_ALL = ~0, // 0xFFFFFFFF (-1) -}; - - -enum LARA_STATE -{ - STATE_LARA_WALK_FORWARD = 0, - STATE_LARA_RUN_FORWARD = 1, - STATE_LARA_STOP = 2, - STATE_LARA_JUMP_FORWARD = 3, - STATE_LARA_POSE = 4, - STATE_LARA_RUN_BACK = 5, - STATE_LARA_TURN_RIGHT_SLOW = 6, - STATE_LARA_TURN_LEFT_SLOW = 7, - STATE_LARA_DEATH = 8, - STATE_LARA_FREEFALL = 9, - STATE_LARA_HANG = 10, - STATE_LARA_REACH = 11, - STATE_LARA_SPLAT = 12, - STATE_LARA_UNDERWATER_STOP = 13, - STATE_LARA_GRAB_TO_FALL = 14, - STATE_LARA_JUMP_PREPARE = 15, - STATE_LARA_WALK_BACK = 16, - STATE_LARA_UNDERWATER_FORWARD = 17, - STATE_LARA_UNDERWATER_INERTIA = 18, - STATE_LARA_GRABBING = 19, - STATE_LARA_TURN_FAST = 20, - STATE_LARA_WALK_RIGHT = 21, - STATE_LARA_WALK_LEFT = 22, - STATE_LARA_ROLL_BACKWARD = 23, - STATE_LARA_SLIDE_FORWARD = 24, - STATE_LARA_JUMP_BACK = 25, - STATE_LARA_JUMP_LEFT = 26, - STATE_LARA_JUMP_RIGHT = 27, - STATE_LARA_JUMP_UP = 28, - STATE_LARA_FALL_BACKWARD = 29, - STATE_LARA_SHIMMY_LEFT = 30, - STATE_LARA_SHIMMY_RIGHT = 31, - STATE_LARA_SLIDE_BACK = 32, - STATE_LARA_ONWATER_STOP = 33, - STATE_LARA_ONWATER_FORWARD = 34, - STATE_LARA_UNDERWATER_DIVING = 35, - STATE_LARA_PUSHABLE_PUSH = 36, - STATE_LARA_PUSHABLE_PULL = 37, - STATE_LARA_PUSHABLE_GRAB = 38, - STATE_LARA_PICKUP = 39, - STATE_LARA_SWITCH_DOWN = 40, - STATE_LARA_SWITCH_UP = 41, - STATE_LARA_INSERT_KEY = 42, - STATE_LARA_INSERT_PUZZLE = 43, - STATE_LARA_WATER_DEATH = 44, - STATE_LARA_ROLL_FORWARD = 45, - STATE_LARA_BOULDER_DEATH = 46, - STATE_LARA_ONWATER_BACK = 47, - STATE_LARA_ONWATER_LEFT = 48, - STATE_LARA_ONWATER_RIGHT = 49, - STATE_LARA_USE_MIDAS = 50, - STATE_LARA_DIE_MIDAS = 51, - STATE_LARA_SWANDIVE_BEGIN = 52, - STATE_LARA_SWANDIVE_END = 53, - STATE_LARA_HANDSTAND = 54, - STATE_LARA_ONWATER_EXIT = 55, - STATE_LARA_LADDER_IDLE = 56, - STATE_LARA_LADDER_UP = 57, - STATE_LARA_LADDER_LEFT = 58, - STATE_LARA_LADDER_END = 59, - STATE_LARA_LADDER_RIGHT = 60, - STATE_LARA_LADDER_DOWN = 61, - STATE_LARA_NULL_62 = 62, - STATE_LARA_NULL_63 = 63, - STATE_LARA_NULL_64 = 64, - STATE_LARA_WADE_FORWARD = 65, - STATE_LARA_UNDERWATER_TURNAROUND = 66, - STATE_LARA_FLARE_PICKUP = 67, - STATE_LARA_JUMP_ROLL = 68, - STATE_LARA_NULL_69 = 69, - STATE_LARA_ZIPLINE_RIDE = 70, - STATE_LARA_CROUCH_IDLE = 71, - STATE_LARA_CROUCH_ROLL = 72, - STATE_LARA_SPRINT = 73, - STATE_LARA_SPRINT_ROLL = 74, - STATE_LARA_MONKEYSWING_IDLE = 75, - STATE_LARA_MONKEYSWING_FORWARD = 76, - STATE_LARA_MONKEYSWING_LEFT = 77, - STATE_LARA_MONKEYSWING_RIGHT = 78, - STATE_LARA_MONKEYSWING_TURNAROUND = 79, - STATE_LARA_CRAWL_IDLE = 80, - STATE_LARA_CRAWL_FORWARD = 81, - STATE_LARA_MONKEYSWING_TURN_LEFT = 82, - STATE_LARA_MONKEYSWING_TURN_RIGHT = 83, - STATE_LARA_CRAWL_TURN_LEFT = 84, - STATE_LARA_CRAWL_TURN_RIGHT = 85, - STATE_LARA_CRAWL_BACK = 86, - STATE_LARA_CLIMB_TO_CRAWL = 87, - STATE_LARA_CRAWL_TO_CLIMB = 88, - STATE_LARA_MISC_CONTROL = 89, - STATE_LARA_ROPE_TURN_LEFT = 90, - STATE_LARA_ROPE_TURN_RIGHT = 91, - STATE_LARA_GIANT_BUTTON_PUSH = 92, - STATE_LARA_TRAPDOOR_FLOOR_OPEN = 93, - STATE_LARA_FREEFALL_BIS = 94, - STATE_LARA_ROUND_HANDLE = 95, - STATE_LARA_COGWHEEL = 96, - STATE_LARA_LEVERSWITCH_PUSH = 97, - STATE_LARA_HOLE = 98, - STATE_LARA_POLE_IDLE = 99, - STATE_LARA_POLE_UP = 100, - STATE_LARA_POLE_DOWN = 101, - STATE_LARA_POLE_TURN_LEFT = 102, - STATE_LARA_POLE_TURN_RIGHT = 103, - STATE_LARA_PULLEY = 104, - STATE_LARA_CROUCH_TURN_LEFT = 105, - STATE_LARA_CROUCH_TURN_RIGHT = 106, - STATE_LARA_CLIMB_CORNER_LEFT_OUTER = 107, - STATE_LARA_CLIMB_CORNER_RIGHT_OUTER = 108, - STATE_LARA_CLIMB_CORNER_LEFT_INNER = 109, - STATE_LARA_CLIMB_CORNER_RIGHT_INNER = 110, - STATE_LARA_ROPE_IDLE = 111, - STATE_LARA_ROPE_CLIMB_UP = 112, - STATE_LARA_ROPE_CLIMB_DOWN = 113, - STATE_LARA_ROPE_SWING = 114, - STATE_LARA_LADDER_TO_HANDS = 115, - STATE_LARA_POSITION_CORRECTOR = 116, - STATE_LARA_DOUBLEDOORS_PUSH = 117, - STATE_LARA_DOZY = 118, - STATE_LARA_TIGHTROPE_IDLE = 119, - STATE_LARA_TIGHTROPE_TURNAROUND = 120, - STATE_LARA_TIGHTROPE_FORWARD = 121, - STATE_LARA_TIGHTROPE_BALANCING_LEFT = 122, - STATE_LARA_TIGHTROPE_BALANCING_RIGHT = 123, - STATE_LARA_TIGHTROPE_ENTER = 124, - STATE_LARA_TIGHTROPE_EXIT = 125, - STATE_LARA_DOVESWITCH = 126, - STATE_LARA_TIGHTROPE_RESTORE_BALANCE = 127, - STATE_LARA_BARS_SWING = 128, - STATE_LARA_BARS_JUMP = 129, - STATE_LARA_UNKNOWN_130 = 130, - STATE_LARA_RADIO_LISTENING = 131, - STATE_LARA_RADIO_OFF = 132, - STATE_LARA_UNKNOWN_133 = 133, - STATE_LARA_UNKNOWN_134 = 134, - STATE_LARA_UNKNOWN_135 = 135, - STATE_LARA_UNUSED16 = 136, - STATE_LARA_PICKUP_FROM_CHEST = 137, - STATE_LARA_UNKNOWN_138 = 138, - STATE_LARA_HANG_FEET = 139, - STATE_LARA_HANG_FEET_SHIMMYR = 140, - STATE_LARA_HANG_FEET_SHIMMYL = 141, - STATE_LARA_HANG_FEET_INCORNERR = 142, - STATE_LARA_HANG_FEET_INCORNERL = 143, - STATE_LARA_HANG_FEET_OUTCORNERR= 144, - STATE_LARA_HANG_FEET_OUTCORNERL = 145, - - NUM_LARA_STATES -}; - -enum LARA_ANIM -{ - ANIMATION_LARA_RUN = 0, // Run - ANIMATION_LARA_WALK_FORWARD = 1, // Walk - ANIMATION_LARA_END_WALK_RIGHT = 2, // Walk > stand (right foot moved first) - ANIMATION_LARA_END_WALK_LEFT = 3, // Walk > stand (left foot moved first) - ANIMATION_LARA_WALK_TO_RUN_RIGHT = 4, // Walk > Run (right foot moved first) - ANIMATION_LARA_WALK_TO_RUN_LEFT = 5, // Walk > Run (left foot moved first) - ANIMATION_LARA_STAY_TO_RUN = 6, // Stand > run - ANIMATION_LARA_RUN_TO_WALK_RIGHT = 7, // Run > walk (left foot first) - ANIMATION_LARA_RUN_TO_STAY_LEFT = 8, // Run > stand (left food first) - ANIMATION_LARA_RUN_TO_WALK_LEFT = 9, // Run > walk (right foot first) - ANIMATION_LARA_RUN_TO_STAY_RIGHT = 10, // Run > stand (right foot first) - ANIMATION_LARA_STAY_SOLID = 11, // Stand still (used as a link between many standing animations) - ANIMATION_LARA_TURN_RIGHT_SLOW = 12, // Turn right on the spot, small turn - ANIMATION_LARA_TURN_LEFT_SLOW = 13, // Turn left on the spot, small turn - ANIMATION_LARA_LANDING_FORWARD_BOTH = 14, // Forward jump/fall (less than 7 clicks high) > land (to a standstill), first part > ANIMATION_LARA_LANDING_FORWARD_BOTH_CONTINUE - ANIMATION_LARA_LANDING_FORWARD_BOTH_CONTINUE = 15, // Land (after jump/fall less that 7 clicks high), second part > stand still (from ANIMATION_LARA_LANDING_FORWARD_BOTH) - ANIMATION_LARA_JUMPING_FORWARD_RIGHT = 16, // Run > take off for forward jump (right foot first) > ANIMATION_LARA_START_FLY_FORWARD_RIGHT - ANIMATION_LARA_START_FLY_FORWARD_RIGHT = 17, // Running take off for forward jump (left foot first) > forward jump - ANIMATION_LARA_JUMPING_FORWARD_LEFT = 18, // Run > take off for forward jump (left foot first) > ANIMATION_LARA_START_FLY_FORWARD_LEFT - ANIMATION_LARA_START_FLY_FORWARD_LEFT = 19, // Running take off for forward jump (right foot first) > forward jump - ANIMATION_LARA_WALK_FORWARD_BEGIN = 20, // Stand > walk forwards, first part > ANIMATION_LARA_WALK_FORWARD_BEGIN_CONTINUE - ANIMATION_LARA_WALK_FORWARD_BEGIN_CONTINUE = 21, // Walk forwards, second part > walk (from ANIMATION_LARA_WALK_FORWARD_BEGIN) - ANIMATION_LARA_START_FREE_FALL = 22, // Jump > fall - ANIMATION_LARA_FREE_FALL_LONG = 23, // Fall - ANIMATION_LARA_LANDING_HARD = 24, // Jump/fall (more than 7 clicks) > crouching landing > stand - ANIMATION_LARA_LANDING_DEATH = 25, // Fall > die (break neck) - ANIMATION_LARA_STAY_TO_GRAB = 26, // Stand > take off for upward jump to grab - ANIMATION_LARA_STAY_TO_GRAB_CONTINUE = 27, // Jump upwards to grab - ANIMATION_LARA_TRY_HANG_VERTICAL = 28, // Jump upwards - ANIMATION_LARA_BEGIN_HANGING_VERTICAL = 29, // Grab (after upward jump to grab) > hang by the hands - ANIMATION_LARA_STOP_HANG_VERTICAL = 30, // Hang by the hands > fall - ANIMATION_LARA_LANDING_LIGHT = 31, // Land after upward jump > stand - ANIMATION_LARA_SMASH_JUMP = 32, // Jump > hit something while in the air, first part > ANIMATION_LARA_SMASH_JUMP_CONTINUE - ANIMATION_LARA_SMASH_JUMP_CONTINUE = 33, // Hit something while in the air, second part > fall (from ANIMATION_LARA_SMASH_JUMP) - ANIMATION_LARA_FREE_FALL_FORWARD = 34, // Downward curve during long jump, first part (not used?) > ANIMATION_LARA_FREE_FALL_MIDDLE - ANIMATION_LARA_FREE_FALL_MIDDLE = 35, // Downward curve during long jump, second part (not used?) (from ANIMATION_LARA_FREE_FALL_FORWARD) - ANIMATION_LARA_FREE_FALL_LONG_NO_HURT = 36, // Downward curve during long jump > fall - ANIMATION_LARA_HANG_TO_RELEASE = 37, // Hang by the hands > fall (great fall) (not used?) - ANIMATION_LARA_STOP_WALK_BACK_RIGHT = 38, // Walk backwards > stand (right foot moved first) - ANIMATION_LARA_STOP_WALK_BACK_LEFT = 39, // Walk backwards > stand (left foot moved first) - ANIMATION_LARA_WALK_BACK = 40, // Walk backwards - ANIMATION_LARA_START_WALK_BACK = 41, // Stand > walk backwards - ANIMATION_LARA_CLIMB_3CLICK = 42, // Climb block (3 clicks high) - ANIMATION_LARA_CLIMB_3CLICK_END_RUNNING = 43, // Stand (after jumping to a higher point) > run (not used?) - ANIMATION_LARA_ROTATE_RIGHT = 44, // Turn right on the spot, large turn - ANIMATION_LARA_JUMPING_FORWARD_TO_FREEFALL = 45, // Jump forwards > fall (?) - ANIMATION_LARA_FLY_FORWARD_TRY_TO_HANG = 46, // Forward jump trying to grab > land (not used?) - ANIMATION_LARA_ROLL_ALTERNATE = 47, // Roll (not used?) - ANIMATION_LARA_ROLL_END_ALTERNATE = 48, // Roll > stand (not used?) - ANIMATION_LARA_FREE_FALL_NO_HURT = 49, // Jump forwards > fall (at earlier stage of jump) (not used?) - ANIMATION_LARA_CLIMB_2CLICK = 50, // Climb block (2 clicks high) - ANIMATION_LARA_CLIMB_2CLICK_END = 51, // Climb block (2 clicks high) > stand - ANIMATION_LARA_CLIMB_2CLICK_END_RUNNING = 52, // Stand (after climbing block 2 clicks high) > run - ANIMATION_LARA_WALL_SMASH_LEFT = 53, // Run > hit wall (left foot first) > stand - ANIMATION_LARA_WALL_SMASH_RIGHT = 54, // Run > hit wall (right foot first) > stand - ANIMATION_LARA_RUN_UP_STEP_RIGHT = 55, // Ascend block (1 click high) running (left foot first) - ANIMATION_LARA_RUN_UP_STEP_LEFT = 56, // Ascend block (1 click high) running (right foot first) - ANIMATION_LARA_WALK_UP_STEP_RIGHT = 57, // Ascend block (1 click high) walking (left foot first) - ANIMATION_LARA_WALK_UP_STEP_LEFT = 58, // Ascend block (1 click high) walking (right foot first) - ANIMATION_LARA_WALK_DOWN_LEFT = 59, // Descend block (1 click high) walking (right foot moved first) - ANIMATION_LARA_WALK_DOWN_RIGHT = 60, // Descend block (1 click high) walking (left foot moved first) - ANIMATION_LARA_WALK_DOWN_BACK_LEFT = 61, // Descend block (1 click high) walking backwards (left foot moved first) - ANIMATION_LARA_WALK_DOWN_BACK_RIGHT = 62, // Descend block (1 click high) walking backwards (right foot moved first) - ANIMATION_LARA_PULL_SWITCH_DOWN = 63, // Activate (lower) horizontal switch - ANIMATION_LARA_PULL_SWITCH_UP = 64, // Deactivate (raise) horizontal switch - ANIMATION_LARA_WALK_LEFT = 65, // Sidestep left - ANIMATION_LARA_WALK_LEFT_END = 66, // Sidestep left > stand - ANIMATION_LARA_WALK_RIGHT = 67, // Sidestep right - ANIMATION_LARA_WALK_RIGHT_END = 68, // Sidestep right > stand - ANIMATION_LARA_ROTATE_LEFT = 69, // Turn left on the spot, large turn - ANIMATION_LARA_SLIDE_FORWARD = 70, // Slide forwards down steep slope (3 clicks high) - ANIMATION_LARA_SLIDE_FORWARD_END = 71, // Slide forwards down steep slope (3 clicks high) > stumbling landing, first part > ANIMATION_LARA_SLIDE_FORWARD_STOP - ANIMATION_LARA_SLIDE_FORWARD_STOP = 72, // Stumbling landing (after sliding forwards down slope), second part > stand (from ANIMATION_LARA_SLIDE_FORWARD_END) - ANIMATION_LARA_STAY_JUMP_SIDES = 73, // Stand > take off for jump in all directions - ANIMATION_LARA_JUMP_BACK_BEGIN = 74, // Take off for backward jump - ANIMATION_LARA_JUMP_BACK = 75, // Jump backwards - ANIMATION_LARA_JUMP_FORWARD_BEGIN = 76, // Standing take off for forward jump - ANIMATION_LARA_CONTINUE_FLY_FORWARD = 77, // Jump forwards - ANIMATION_LARA_JUMP_LEFT_BEGIN = 78, // Take off for sideways jump left - ANIMATION_LARA_JUMP_LEFT = 79, // Jump sideways left - ANIMATION_LARA_JUMP_RIGHT_BEGIN = 80, // Take off for sideways jump right - ANIMATION_LARA_JUMP_RIGHT = 81, // Jump sideways right - ANIMATION_LARA_LANDING_MIDDLE = 82, // Crouching landing after jump in all directions > stand - ANIMATION_LARA_FORWARD_TO_FREE_FALL = 83, // Jump backwards > fall - ANIMATION_LARA_LEFT_TO_FREE_FALL = 84, // Jump sideways left > fall - ANIMATION_LARA_RIGHT_TO_FREE_FALL = 85, // Jump sideways right > fall - ANIMATION_LARA_UNDERWATER_SWIM_FORWARD = 86, // Float-swim in deepsea suit (Deepsea Dive) - ANIMATION_LARA_UNDERWATER_SWIM_SOLID = 87, // Motionless underwater (driven only by momentum) in deepsea suit (used as a link between swimming animations) (Deepsea Dive) - ANIMATION_LARA_RUN_BACK_BEGIN = 88, // Stand > take off for backward hop - ANIMATION_LARA_RUN_BACK = 89, // Hop backwards - ANIMATION_LARA_RUN_BACK_END = 90, // Hop backwards > stand - ANIMATION_LARA_TRY_HANG_VERTICAL_BEGIN = 91, // Take off for upward jump - ANIMATION_LARA_LANDING_FROM_RUN = 92, // Jump forwards > running landing > run - ANIMATION_LARA_FREE_FALL_BACK = 93, // Downward curve during long jump, second part (with less momentum than ANIMATION_LARA_FREE_FALL_MIDDLE?) - not used? - ANIMATION_LARA_FLY_FORWARD_TRY_HANG = 94, // Jump forwards (at late stage during jump) > grab - ANIMATION_LARA_TRY_HANG_SOLID = 95, // Grab during forward jump - ANIMATION_LARA_HANG_IDLE = 96, // Grab in mid-air > hang by the hands at wall - ANIMATION_LARA_CLIMB_ON = 97, // Hang by the hands > pull up > stand - ANIMATION_LARA_FREE_FALL_TO_LONG = 98, // Failed attempt to grab during forward jump > fall - ANIMATION_LARA_FALL_CROUCHING_LANDING = 99, // Fall > crouching landing - ANIMATION_LARA_FREE_FALL_TO_SIDE_LANDING = 100, // Downward curve during long jump > grab~ - ANIMATION_LARA_FREE_FALL_TO_SIDE_LANDING_ALTERNATE = 101, // Downward curve during long jump (with less momentum than ANIMATION_LARA_FREE_FALL_TO_SIDE_LANDING) > grab (not used?) - ANIMATION_LARA_CLIMB_ON_END = 102, // Pull up (after hanging by the hands) > stand - ANIMATION_LARA_STAY_IDLE = 103, // Stand still (breathing) - ANIMATION_LARA_START_SLIDE_BACKWARD = 104, // Land on steep slope (3 clicks high) > slide backwards down - ANIMATION_LARA_SLIDE_BACKWARD = 105, // Slide backwards down steep slope (3 clicks high) - ANIMATION_LARA_SLIDE_BACKWARD_END = 106, // Slide backwards down steep slope (3 clicks high) > stumbling landing > stand - ANIMATION_LARA_UNDERWATER_SWIM_TO_IDLE = 107, // Stop swimming underwater in deepsea suit (at start or end of float-swimming animation) > drift underwater (Deepsea Dive) - ANIMATION_LARA_UNDERWATER_IDLE = 108, // Drift underwater in deepsea suit (Deepsea Dive) - ANIMATION_LARA_UNDERWARER_IDLE_TO_SWIM = 109, // Drift underwater in deepsea suit > swim underwater (Deepsea Dive) - ANIMATION_LARA_ONWATER_IDLE = 110, // Tread water on water surface - ANIMATION_LARA_CLIMB_OUT_OF_WATER = 111, // Pull out of water (onto ledge 1 click above the water surface) > stand - ANIMATION_LARA_FREE_FALL_TO_UNDERWATER = 112, // Fall/jump into water > swim underwater - ANIMATION_LARA_ONWATER_DIVE_ALTERNATE = 113, // Tread water on water surface > dive > swim underwater (not used?) - ANIMATION_LARA_UNDERWATER_TO_ONWATER = 114, // Swim underwater > break water surface > tread water on water surface (?) - ANIMATION_LARA_ONWATER_DIVE = 115, // Swim forwards on water surface > dive > swim underwater - ANIMATION_LARA_ONWATER_SWIM_FORWARD = 116, // Swim forwards on water surface - ANIMATION_LARA_ONWATER_SWIM_FORWARD_TO_IDLE = 117, // Swim forwards on water surface > tread water on water surface - ANIMATION_LARA_ONWATER_IDLE_TO_SWIM = 118, // Tread water on water surface > swim forwards on water surface - ANIMATION_LARA_FREE_FALL_TO_UNDERWATER_ALTERNATE = 119, // Fall/jump into water > swim underwater (not used?) - ANIMATION_LARA_START_OBJECT_MOVING = 120, // Stand > ready to push/pull pushable - ANIMATION_LARA_STOP_OBJECT_MOVING = 121, // Ready to push/pull pushable > stand - ANIMATION_LARA_OBJECT_PULL = 122, // Pull pushable - ANIMATION_LARA_OBJECT_PUSH = 123, // Push pushable - ANIMATION_LARA_UNDERWATER_DEATH = 124, // Drown/die underwater – with convulsions (Deepsea Dive) - ANIMATION_LARA_AH_FORWARD = 125, // Jerk backwards hurt (standing) - ANIMATION_LARA_AH_BACKWARD = 126, // Jerk forwards hurt (standing) - ANIMATION_LARA_AH_LEFT = 127, // Jerk right hurt (standing) - ANIMATION_LARA_AH_RIGHT = 128, // Jerk left hurt (standing) - ANIMATION_LARA_UNDERWATER_SWITCH = 129, // Pull underwater switch at wall - ANIMATION_LARA_UNDERWATER_PICKUP = 130, // Swimming pickup in deepsea suit (right hand) (Deepsea Dive) - ANIMATION_LARA_USE_KEY = 131, // Use key - ANIMATION_LARA_ONWATER_DEATH = 132, // Die on the water surface (less dramatic than ANIMATION_LARA_UNDERWATER_DEATH) - ANIMATION_LARA_RUN_TO_DIE = 133, // Run > die - ANIMATION_LARA_USE_PUZZLE = 134, // Insert puzzle item - ANIMATION_LARA_PICKUP = 135, // Standing pickup from floor (right hand) - ANIMATION_LARA_CLIMB_LEFT = 136, // Shimmy left - ANIMATION_LARA_CLIMB_RIGHT = 137, // Shimmy right - ANIMATION_LARA_STAY_TO_DEATH = 138, // Stand > die - ANIMATION_LARA_SQUASH_BOULDER = 139, // Crushed by boulder - ANIMATION_LARA_ONWATER_IDLE_TO_SWIM_BACK = 140, // Tread water on water surface > swim backwards on water surface - ANIMATION_LARA_ONWATER_SWIM_BACK = 141, // Swim backwards on water surface - ANIMATION_LARA_ONWATER_SWIM_BACK_TO_IDLE = 142, // Swim backwards on water surface > tread water on water surface - ANIMATION_LARA_ONWATER_SWIM_LEFT = 143, // Swim sideways left on water surface - ANIMATION_LARA_ONWATER_SWIM_RIGHT = 144, // Swim sideways right on water surface - ANIMATION_LARA_JUMP_TO_DEATH = 145, // Land after jump/fall > die (?) - ANIMATION_LARA_ROLL_BEGIN = 146, // Stand > roll, first part > ANIMATION_LARA_ROLL_CONTINUE - ANIMATION_LARA_ROLL_CONTINUE = 147, // Roll, second part (from ANIMATION_LARA_ROLL_BEGIN) > ANIMATION_LARA_ROLL_END - ANIMATION_LARA_ROLL_END = 148, // Roll, third part > stand (from ANIMATION_LARA_ROLL_CONTINUE) - ANIMATION_LARA_SPIKED = 149, // Impaled on spikes - ANIMATION_LARA_OSCILLATE_HANG_ON = 150, // Grab in mid-air > hang by the hands in free air (swinging forth and back) - ANIMATION_LARA_LANDING_ROLL = 151, // Swan dive > rolling landing - ANIMATION_LARA_FISH_TO_UNDERWATER1 = 152, // Swan dive > shoot through water at sloped angle (at early stage in swan dive) - ANIMATION_LARA_FREE_FALL_FISH = 153, // Swan dive > dive headfirst - ANIMATION_LARA_FISH_TO_UNDERWATER2 = 154, // Swan dive > shoot through water vertically (at later stage in swan dive) - ANIMATION_LARA_FREE_FALL_FISH_TO_DEATH = 155, // Swan dive > die (break neck) - ANIMATION_LARA_START_FLY_LIKE_FISH_LEFT = 156, // Run > swan dive (right foot first) - ANIMATION_LARA_START_FLY_LIKE_FISH_RIGHT = 157, // Run > swan dive (left foot first) - ANIMATION_LARA_FREE_FALL_FISH_START = 158, // Swan dive - ANIMATION_LARA_CLIMB_ON2 = 159, // Hang by the hands > hand stand > stand - ANIMATION_LARA_STAND_TO_LADDER = 160, // Stand in water or under low ceiling > ascend ladder (without the jump and grab) - ANIMATION_LARA_LADDER_UP = 161, // Ascend ladder - ANIMATION_LARA_LADDER_UP_STOP_RIGHT = 162, // Ascend ladder > hang still on ladder (right foot higher) - ANIMATION_LARA_LADDER_UP_STOP_LEFT = 163, // Ascend ladder > hang still on ladder (left foot higher) - ANIMATION_LARA_LADDER_IDLE = 164, // Hang still on ladder - ANIMATION_LARA_LADDER_UP_START = 165, // Hang still on ladder > ascend ladder - ANIMATION_LARA_LADDER_DOWN_STOP_LEFT = 166, // Descend ladder > hang still on ladder (left foot higher) - ANIMATION_LARA_LADDER_DOWN_STOP_RIGHT = 167, // Descend ladder > hang still on ladder (right foot higher) - ANIMATION_LARA_LADDER_DOWN = 168, // Descend ladder - ANIMATION_LARA_LADDER_DOWN_START = 169, // Hang still on ladder > descend ladder - ANIMATION_LARA_LADDER_RIGHT = 170, // Climb sideways right on ladder - ANIMATION_LARA_LADDER_LEFT = 171, // Climb sideways left on ladder - ANIMATION_LARA_LADDER_HANG = 172, // Hang by the hands on ladder - ANIMATION_LARA_LADDER_HANG_TO_IDLE = 173, // Hang by the hands on ladder > gain footing on ladder - ANIMATION_LARA_LADDER_TO_STAND = 174, // Hang still on ladder > pull up > stand - ANIMATION_LARA_UNKNOWN_175 = 175, // ??? > stand still - ANIMATION_LARA_ONWATER_TO_WADE_SHALLOW = 176, // Swim forwards on water surface > wade (the depth change is very small) (?) - ANIMATION_LARA_WADE = 177, // Wade - ANIMATION_LARA_RUN_TO_WADE_LEFT = 178, // Run > wade (left foot first) - ANIMATION_LARA_RUN_TO_WADE_RIGHT = 179, // Run > wade (right foot first) - ANIMATION_LARA_WADE_TO_RUN_LEFT = 180, // Wade > run (left foot first) - ANIMATION_LARA_WADE_TO_RUN_RIGHT = 181, // Wade > run (right foot first) - ANIMATION_LARA_LADDER_BACKFLIP_START = 182, // Hang still on ladder > jump backwards off ladder, first part > ANIMATION_LARA_LADDER_BACKFLIP_END - ANIMATION_LARA_LADDER_BACKFLIP_END = 183, // Jump backwards off ladder, second part > jump backwards (from ANIMATION_LARA_LADDER_BACKFLIP_START) - ANIMATION_LARA_WADE_TO_STAY_RIGHT = 184, // Wade > stand (right foot first) - ANIMATION_LARA_WADE_TO_STAY_LEFT = 185, // Wade > stand (left foot first) - ANIMATION_LARA_STAY_TO_WADE = 186, // Stand > wade - ANIMATION_LARA_LADDER_UP_HANDS = 187, // Hang by the hands on ladder > ascend ladder with the the hands only - ANIMATION_LARA_LADDER_DOWN_HANDS = 188, // Hang by the hands on ladder > descend ladder with the hands only - ANIMATION_LARA_FLARE_THROW = 189, // Throw flare away (standing) - ANIMATION_LARA_ONWATER_TO_WADE_DEEP = 190, // Swim forwards on water surface > wade (the depth transition is greater) (?) - ANIMATION_LARA_ONWATER_TO_LAND_LOW = 191, // Pull out of water (onto ledge even with the water surface) > stand - ANIMATION_LARA_UNDERWATER_TO_WADE = 192, // Swim underwater > stand in shallow water - ANIMATION_LARA_ONWATER_TO_WADE = 193, // Tread water on water surface > stand in shallow water - ANIMATION_LARA_LADDER_TO_HANDS_DOWN = 194, // Hang still on ladder > descend ladder > hang by the hands - ANIMATION_LARA_SWITCH_SMALL_DOWN = 195, // Activate horizontal lever switch (electrical switch) - ANIMATION_LARA_SWITCH_SMALL_UP = 196, // Deactivate horizontal lever switch (electrical switch) - ANIMATION_LARA_BUTTON_PUSH = 197, // Push small button - ANIMATION_LARA_UNDERWATER_SWIM_TO_STILL_HUDDLE = 198, // Stop swimming underwater in deepsea suit (in middle stage of float-swimming animation) > drift underwater (Deepsea Dive) - ANIMATION_LARA_UNDERWATER_SWIM_TO_STILL_SPRAWL = 199, // Stop swimming underwater in deepsea suit (in late stage of float-swimming animation) > drift underwater (Deepsea Dive) - ANIMATION_LARA_UNDERWATER_SWIM_TO_STILL_MEDIUM = 200, // Stop swimming underwater in deepsea suit (in early stage of float-swimming animation) > drift underwater (Deepsea Dive) - ANIMATION_LARA_LADDER_TO_HANDS_RIGHT = 201, // Climb sideways right on ladder > hang by the hands - ANIMATION_LARA_LADDER_TO_HANDS_LEFT = 202, // Climb sideways left on ladder > hang by the hands - ANIMATION_LARA_UNDERWATER_ROLL_BEGIN = 203, // Roll underwater, first part > ANIMATION_LARA_UNDERWATER_ROLL_END - ANIMATION_LARA_FLARE_PICKUP = 204, // Pick up flare from floor while standing (left hand) - ANIMATION_LARA_UNDERWATER_ROLL_END = 205, // Roll underwater, second part > drift underwater (from ANIMATION_LARA_UNDERWATER_ROLL_BEGIN) - ANIMATION_LARA_UNDERWATER_FLARE_PICKUP = 206, // Pick up flare while swimming in deepsea suit (left hand) (Russia-levels) - ANIMATION_LARA_RUNNING_JUMP_ROLL_BEGIN = 207, // Jump forwards with backtwist (after running takeoff), first part > ANIMATION_LARA_RUNNING_JUMP_ROLL_END - ANIMATION_LARA_SOMERSAULT = 208, // Somersault during swan dive - ANIMATION_LARA_RUNNING_JUMP_ROLL_END = 209, // Jump forwards with backtwist (after running takeoff), second part (from ANIMATION_LARA_RUNNING_JUMP_ROLL_BEGIN) - ANIMATION_LARA_STANDING_JUMP_ROLL_BEGIN = 210, // Jump forwards with backtwist (after standing takeoff), first part > ANIMATION_LARA_STANDING_JUMP_ROLL_END - ANIMATION_LARA_STANDING_JUMP_ROLL_END = 211, // Jump forwards with backtwist (after standing takeoff), second part (from ANIMATION_LARA_STANDING_JUMP_ROLL_BEGIN) - ANIMATION_LARA_BACKWARDS_JUMP_ROLL_BEGIN = 212, // Jump backwards with forward twist, first part > ANIMATION_LARA_BACKWARDS_JUMP_ROLL_END - ANIMATION_LARA_BACKWARDS_JUMP_ROLL_END = 213, // Jump backwards with forward twist, second part (from ANIMATION_LARA_BACKWARDS_JUMP_ROLL_BEGIN) - ANIMATION_LARA_TR345_ZIPLINE_GRAB = 214, // Stand > grab zipline - ANIMATION_LARA_TR345_ZIPLINE_RIDE = 215, // Ride zipline - ANIMATION_LARA_TR345_ZIPLINE_FALL = 216, // Fall off zipline - ANIMATION_LARA_TR345_STAND_TO_CROUCH = 217, // Stand > crouch - ANIMATION_LARA_CROUCH_ROLL_FORWARD_BEGIN = 218, // Crouch with right elbow on knee > take off for crouched roll (not used) - ANIMATION_LARA_CROUCH_ROLL_FORWARD_CONTINUE = 219, // Crouched roll (not used) - ANIMATION_LARA_CROUCH_ROLL_FORWARD_END = 220, // Crouched roll > crouch - ANIMATION_LARA_CROUCH_TO_STAND = 221, // Crouch > stand - ANIMATION_LARA_CROUCH_IDLE = 222, // Crouch - ANIMATION_LARA_SPRINT = 223, // Sprint - ANIMATION_LARA_RUN_TO_SPRINT_LEFT = 224, // Run > sprint (left foot first) - ANIMATION_LARA_RUN_TO_SPRINT_RIGHT = 225, // Run > sprint (right foot first) - ANIMATION_LARA_SPRINT_SLIDE_STAND_RIGHT = 226, // Sprint > skidding halt > stand (right foot first) - ANIMATION_LARA_SPRINT_SLIDE_STAND_RIGHT_BETA = 227, // ??? > stand (right foot first) (not used) - ANIMATION_LARA_SPRINT_SLIDE_STAND_LEFT = 228, // Sprint > skidding halt > stand (left foot first) - ANIMATION_LARA_SPRINT_SLIDE_STAND_LEFT_BETA = 229, // ??? > stand (left foot first) (not used) - ANIMATION_LARA_SPRINT_TO_ROLL_LEFT = 230, // Sprint > take off for sprinting roll (left foot first) > ANIMATION_LARA_SPRINT_ROLL_LEFT_TO_RUN - ANIMATION_LARA_SPRINT_TO_ROLL_LEFT_BETA = 231, // Stumbling takeoff for sprinting roll (not used) (?) - ANIMATION_LARA_SPRINT_ROLL_LEFT_TO_RUN = 232, // Sprinting roll > run (from ANIMATION_LARA_SPRINT_TO_ROLL_LEFT) - ANIMATION_LARA_MONKEY_GRAB = 233, // Grab monkey-bars during jump - ANIMATION_LARA_MONKEY_IDLE = 234, // Hang still by the hands in free air (from monkey-bars or wafer thin ledge) - ANIMATION_LARA_MONKEY_FALL = 235, // Hang still by the hands in free air (from monkey-bars or wafer thin ledge) > fall - ANIMATION_LARA_MONKEY_FORWARD = 236, // Monkey-swing forwards - ANIMATION_LARA_MONKEY_STOP_LEFT = 237, // Monkey-swing forwards > hang still from monkey-bars (left hand first) - ANIMATION_LARA_MONKEY_STOP_RIGHT = 238, // Monkey-swing forwards > hang still from monkey-bars (right hand first) - ANIMATION_LARA_MONKEY_IDLE_TO_FORWARD_LEFT = 239, // Hang still from monkey-bars > monkey-swing forwards (left hand moved first) - ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_BEGIN = 240, // Sprint > take off for sprinting roll, first part (not used) (?) > ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_CONTINUE - ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_CONTINUE = 241, // Take off for sprinting roll, second part (not used) (?) (from ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_BEGIN) > ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_END - ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_END = 242, // Sprinting roll > run (not used) (?) - ANIMATION_LARA_SPRINT_TO_RUN_LEFT = 243, // Sprint > run (left foot first) - ANIMATION_LARA_SPRINT_TO_RUN_RIGHT = 244, // Sprint > run (right foot first) - ANIMATION_LARA_CROUCH_PREPARE = 245, // 'Springy' crouch (used as a link to and from crouching animations) - ANIMATION_LARA_SLIDE_FORWARD_TO_RUN = 246, // Slide forwards down steep slope (3 clicks high) > stumbling landing > run - ANIMATION_LARA_CROUCH_ROLL_FORWARD_BEGIN_ALTERNATE = 247, // Crouch > take off for crouching roll (not used) - ANIMATION_LARA_JUMP_FORWARD_BEGIN_TO_GRAB = 248, // Jump forwards > grab (at early stage during jump) - ANIMATION_LARA_JUMP_FORWARD_END_TO_GRAB = 249, // Jump forwards > grab (at middle stage during jump) - ANIMATION_LARA_RUN_TO_GRAB_RIGHT = 250, // Grab during running takeoff (right foot first) (?) - ANIMATION_LARA_RUN_TO_GRAB_LEFT = 251, // Grab during running takeoff (left foot first) (?) - ANIMATION_LARA_MONKEY_IDLE_TO_FORWARD_RIGHT = 252, // Hang still from monkey-bars > monkey-swing forwards (right hand moved first) - ANIMATION_LARA_MONKEY_STRAFE_LEFT = 253, // Shimmy left - ANIMATION_LARA_MONKEY_STRAFE_LEFT_END = 254, // Shimmy (left) > hang still by the hands (?) - ANIMATION_LARA_MONKEY_STRAFE_RIGHT = 255, // Shimmy right - ANIMATION_LARA_MONKEY_STRAFE_RIGHT_END = 256, // Shimmy (right) > hang still by the hands (not used) (?) - ANIMATION_LARA_MONKEY_TURN_AROUND = 257, // Turn around at the spot while hanging from monkey-bars (not used) (?) - ANIMATION_LARA_CROUCH_TO_CRAWL_BEGIN = 258, // Crouch > crawl position, first part > ANIMATION_LARA_CROUCH_TO_CRAWL_CONTINUE - ANIMATION_LARA_CRAWL_TO_CROUCH_BEGIN = 259, // Crawl position > crouch, first part > ANIMATION_LARA_CRAWL_TO_CROUCH_END - ANIMATION_LARA_CRAWL_FORWARD = 260, // Crawl forwards - ANIMATION_LARA_CRAWL_IDLE_TO_FORWARD = 261, // Crawl position > crawl forwards - ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_BEGIN_RIGHT = 262, // Crawl forwards > crawl position, first part (right foot first) > ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_END_RIGHT - ANIMATION_LARA_CRAWL_IDLE = 263, // Crawl position - ANIMATION_LARA_CROUCH_TO_CRAWL_END = 264, // Crouch > crawl position, third part (from ANIMATION_LARA_CROUCH_TO_CRAWL_CONTINUE) - ANIMATION_LARA_CROUCH_IDLE_SMASH = 265, // 'Slightly springy' crouch (not used?) - ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_END_RIGHT = 266, // Crawl forwards > crawl position, second part (from ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_BEGIN_RIGHT) - ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_BEGIN_LEFT = 267, // Crawl forwards > crawl position, first part (left foot first) > ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_END_LEFT - ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_END_LEFT = 268, // Crawl forwards > crawl positon, second part (from ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_BEGIN_LEFT) - ANIMATION_LARA_CRAWL_TURN_LEFT = 269, // Crawl position > turn left crawling - ANIMATION_LARA_CRAWL_TURN_RIGHT = 270, // Crawl position > turn right crawling - ANIMATION_LARA_MONKEY_TURN_LEFT = 271, // Hang still from monkey-bars > turn left hanging from monkey-bars - ANIMATION_LARA_MONKEY_TURN_RIGHT = 272, // Hang still from monkey-bars > turn right hanging from monkey-bars - ANIMATION_LARA_CROUCH_TO_CRAWL_CONTINUE = 273, // Crouch > crawl position, second part (from ANIMATION_LARA_CROUCH_TO_CRAWL_BEGIN) > ANIMATION_LARA_CROUCH_TO_CRAWL_END - ANIMATION_LARA_CRAWL_TO_CROUCH_END = 274, // Crawl position > crouch, second part (from ANIMATION_LARA_CRAWL_TO_CROUCH_BEGIN) - ANIMATION_LARA_CRAWL_IDLE_TO_BACKWARD = 275, // Crawl > crawl backwards - ANIMATION_LARA_CRAWL_BACKWARD = 276, // Crawl backwards - ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_BEGIN_RIGHT = 277, // Crawl backwards > crawl position, first part (right foot moved first) > ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_END_RIGHT - ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_END_RIGHT = 278, // Crawl backwards > crawl position, second part (from ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_BEGIN_RIGHT) - ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_BEGIN_LEFT = 279, // Crawl backwards > crawl position, first part (left foot moved first) > ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_END_LEFT - ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_END_LEFT = 280, // Crawl backwards > crawl position, second part (from ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_BEGIN_LEFT) - ANIMATION_LARA_CRAWL_TURN_LEFT_END = 281, // Turn left crawling > crawl position - ANIMATION_LARA_CRAWL_TURN_RIGHT_END = 282, // Turn right crawling > crawl position - ANIMATION_LARA_MONKEY_TURN_LEFT_EARLY_END = 283, // Turn left hanging from monkey-bars > hang still from monkey-bars (at early stage during turn) - ANIMATION_LARA_MONKEY_TURN_LEFT_LATE_END = 284, // Turn left hanging from monkey-bars > hang still from monkey-bars (at late stage during turn) - ANIMATION_LARA_MONKEY_TURN_RIGHT_EARLY_END = 285, // Turn right hanging from monkey-bars > hang still from monkey-bars (early stage during turn) - ANIMATION_LARA_MONKEY_TURN_RIGHT_LATE_END = 286, // Turn right hanging from monkey-bars > hang still from monkey-bars (at late stage during turn) - ANIMATION_LARA_HANG_TO_CROUCH_BEGIN = 287, // Hang by the hands > pull up > crouch, first part > ANIMATION_LARA_HANG_TO_CROUCH_END - ANIMATION_LARA_HANG_TO_CROUCH_END = 288, // Crouch, second part (after pulling up from hanging by the hands) (from ANIMATION_LARA_HANG_TO_CROUCH_BEGIN) - ANIMATION_LARA_CRAWL_TO_HANG_BEGIN = 289, // Crawl position > climb down > hang by the hands, first part >ANIMATION_LARA_CRAWL_TO_HANG_CONTINUE - ANIMATION_LARA_CRAWL_TO_HANG_CONTINUE = 290, // Hang by the hands, second part (after climbing down from crawl position) (from ANIMATION_LARA_CRAWL_TO_HANG_BEGIN) > ANIMATION_LARA_CRAWL_TO_HANG_END - ANIMATION_LARA_CROUCH_PICKUP = 291, // Crouching pickup (right hand) - ANIMATION_LARA_CRAWL_PICKUP = 292, // Crawling pickup (not used) - ANIMATION_LARA_CROUCH_SMASH_FORWARD = 293, // Jerk forwards hurt (chrouching) - ANIMATION_LARA_CROUCH_SMASH_BACKWARD = 294, // Jerk backwards hurt (chrouching) - ANIMATION_LARA_CROUCH_SMASH_RIGHT = 295, // Jerk right hurt (chrouching) - ANIMATION_LARA_CROUCH_SMASH_LEFT = 296, // Jerk left hurt (chrouching) - ANIMATION_LARA_CRAWL_SMASH_FORWARD = 297, // Jerk forwards hurt (crawling) - ANIMATION_LARA_CRAWL_SMASH_BACKWARD = 298, // Jerk backwards hurt (crawling) - ANIMATION_LARA_CRAWL_SMASH_RIGHT = 299, // Jerk right hurt (crawling) - ANIMATION_LARA_CRAWL_SMASH_LEFT = 300, // Jerk left hurt (crawling) - ANIMATION_LARA_CRAWL_DEATH = 301, // Crawl > die - ANIMATION_LARA_CRAWL_TO_HANG_END = 302, // Hang by the hands (after climbing down from crawl position), third part (from ANIMATION_LARA_CRAWL_TO_HANG_CONTINUE) - ANIMATION_LARA_CROUCH_ABORT = 303, // About to crouch > stand (cancelling a stand > crouch command) - ANIMATION_LARA_RUN_TO_CROUCH_LEFT_BEGIN = 304, // Run > crouch, first part (left foot first) > ANIMATION_LARA_RUN_TO_CROUCH_LEFT_END - ANIMATION_LARA_RUN_TO_CROUCH_RIGHT_BEGIN = 305, // Run > crouch, first part (right foot first) > ANIMATION_LARA_RUN_TO_CROUCH_RIGHT_END - ANIMATION_LARA_RUN_TO_CROUCH_LEFT_END = 306, // Crouch, second part (after running) > crouch (from ANIMATION_LARA_RUN_TO_CROUCH_LEFT_BEGIN) - ANIMATION_LARA_RUN_TO_CROUCH_RIGHT_END = 307, // Crouch, second part (after running) > crouch (from ANIMATION_LARA_RUN_TO_CROUCH_RIGHT_BEGIN) - ANIMATION_LARA_SPRINT_TO_ROLL_RIGHT = 308, // Sprint > take off for sprinting roll (right foot first) > ANIMATION_LARA_SPRINT_ROLL_RIGHT_TO_RUN - ANIMATION_LARA_SPRINT_ROLL_RIGHT_TO_RUN = 309, // Sprinting roll > run (from ANIMATION_LARA_SPRINT_TO_ROLL_RIGHT) - ANIMATION_LARA_SPRINT_TO_CROUCH_LEFT = 310, // Sprint > small roll > crouch (left foot first) - ANIMATION_LARA_SPRINT_TO_CROUCH_RIGHT = 311, // Sprint > small roll > crouch (right foot first) - ANIMATION_LARA_CROUCH_PICKUP_FLARE = 312, // Pick up flare while crouching (left hand) - ANIMATION_LARA_DOOR_OPEN_FORWARD = 313, // Use doorknob to open door and push it open - ANIMATION_LARA_DOOR_OPEN_BACK = 314, // Use doorknob to open door and pull it open - ANIMATION_LARA_DOOR_KICK = 315, // Kick door open - ANIMATION_LARA_GIANT_BUTTON_PUSH = 316, // Push Sequence button - ANIMATION_LARA_FLOOR_TRAPDOOR_OPEN = 317, // Open trapdoor in floor - ANIMATION_LARA_CEILING_TRAPDOOR_OPEN = 318, // Grab (after upward jump) and open trapdoor in ceiling* - ANIMATION_LARA_ROUND_HANDLE_GRAB_CLOCKWISE = 319, // Stand > grab turn handle (clockwise) - ANIMATION_LARA_ROUND_HANDLE_GRAB_COUNTERCLOCKWISE = 320, // Stand > grab turn handle (counter-clockwise) - ANIMATION_LARA_COGWHEEL_PULL = 321, // Pull cog wheel - ANIMATION_LARA_COGWHEEL_GRAB = 322, // Stand > grab cog wheel - ANIMATION_LARA_COGWHEEL_UNGRAB = 323, // Let go of cog wheel > stand - ANIMATION_LARA_LEVERSWITCH_PUSH = 324, // Use lever switch - ANIMATION_LARA_HOLE_GRAB = 325, // Use hole-in-wall switch/pickup - ANIMATION_LARA_STAY_TO_POLE_GRAB = 326, // Stand > climb onto vertical pole - ANIMATION_LARA_POLE_JUMP = 327, // Jump off vertical pole - ANIMATION_LARA_POLE_IDLE = 328, // Hang still on vertical pole - ANIMATION_LARA_POLE_CLIMB_UP = 329, // Climb vertical pole - ANIMATION_LARA_POLE_FALL = 330, // Hang still on vertical pole > fall - ANIMATION_LARA_JUMP_FORWARD_TO_POLE_GRAB = 331, // Jump forwards > grab and climb onto vertical pole - ANIMATION_LARA_POLE_TURN_LEFT_BEGIN = 332, // Hang still on vertical pole > turn clockwise on vertical pole - ANIMATION_LARA_POLE_TURN_RIGHT_BEGIN = 333, // Hang still on vertical pole > turn counter-clockwise on vertical pole - ANIMATION_LARA_POLE_IDLE_TO_CLIMB_DOWN = 334, // Hang still on vertical pole > slide down vertical pole - ANIMATION_LARA_POLE_CLIMB_DOWN = 335, // Slide down vertical pole - ANIMATION_LARA_POLE_CLIMB_DOWN_TO_IDLE = 336, // Slide down vertical pole > hang still on vertical pole - ANIMATION_LARA_JUMP_UP_TO_POLE_GRAB = 337, // Jump upwards > grab and climb onto vertical pole - ANIMATION_LARA_POLE_CLIMB_UP_INBETWEEN = 338, // Climb vertical pole > hang still on vertical pole - ANIMATION_LARA_PULLEY_GRAB = 339, // Stand > grab pulley - ANIMATION_LARA_PULLEY_PULL = 340, // Pull pulley - ANIMATION_LARA_PULLEY_UNGRAB = 341, // Let go of pulley - ANIMATION_LARA_POLE_GRAB_TO_STAY = 342, // Hang still on vertical pole > put feet on floor > stand - ANIMATION_LARA_POLE_TURN_LEFT = 343, // Turn clockwise on vertical pole (not used?) - ANIMATION_LARA_POLE_TURN_LEFT_END = 344, // Turn clockwise on vertical pole > hang still on vertical pole - ANIMATION_LARA_POLE_TURN_RIGHT = 345, // Turn counter-clockwise on vertical pole (not used?) - ANIMATION_LARA_POLE_TURN_RIGHT_END = 346, // Turn counter-clockwise on vertical pole > hang still on vertical pole - ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_BEGIN = 347, // Push turn handle (clockwise), first part > ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_CONTINUE - ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_CONTINUE = 348, // Push turn handle (clockwise), second part (from ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_BEGIN) - ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_END = 349, // Push turn handle (clockwise) > stand - ANIMATION_LARA_ROUND_HANDLE_PUSH_LEFT_BEGIN = 350, // Push turn handle (counter-clockwise), first part > ANIMATION_LARA_ROUND_HANDLE_PUSH_LEFT_BEGIN - ANIMATION_LARA_ROUND_HANDLE_PUSH_LEFT_CONTINUE = 351, // Push turn handle (counter-clockwise), second part (from ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_END) - ANIMATION_LARA_ROUND_HANDLE_PUSH_LEFT_END = 352, // Push turn handle (counter-clockwise) > stand - ANIMATION_LARA_CROUCH_TURN_LEFT = 353, // Crouch > turn left crouching - ANIMATION_LARA_CROUCH_TURN_RIGHT = 354, // Crouch > turn right crouching - ANIMATION_LARA_HANG_AROUND_LEFT_OUTER_BEGIN = 355, // Shimmy around left outer corner, first part > ANIMATION_LARA_HANG_AROUND_LEFT_OUTER_END - ANIMATION_LARA_HANG_AROUND_LEFT_OUTER_END = 356, // Shimmy around left outer corner, second part (from ANIMATION_LARA_HANG_AROUND_LEFT_OUTER_BEGIN) - ANIMATION_LARA_HANG_AROUND_RIGHT_OUTER_BEGIN = 357, // Shimmy around right outer corner, first part > ANIMATION_LARA_HANG_AROUND_RIGHT_OUTER_END - ANIMATION_LARA_HANG_AROUND_RIGHT_OUTER_END = 358, // Shimmy around right outer corner, second part (from ANIMATION_LARA_HANG_AROUND_RIGHT_OUTER_BEGIN) - ANIMATION_LARA_HANG_AROUND_LEFT_INNER_BEGIN = 359, // Shimmy around left inner corner, first part > ANIMATION_LARA_HANG_AROUND_LEFT_INNER_END - ANIMATION_LARA_HANG_AROUND_LEFT_INNER_END = 360, // Shimmy around left inner corner, second part (from ANIMATION_LARA_HANG_AROUND_LEFT_INNER_BEGIN) - ANIMATION_LARA_HANG_AROUND_RIGHT_INNER_BEGIN = 361, // Shimmy around right inner corner, first part > ANIMATION_LARA_HANG_AROUND_RIGHT_INNER_END - ANIMATION_LARA_HANG_AROUND_RIGHT_INNER_END = 362, // Shimmy around right inner corner, second part (from ANIMATION_LARA_HANG_AROUND_RIGHT_INNER_BEGIN) - ANIMATION_LARA_LADDER_AROUND_LEFT_OUTER_BEGIN = 363, // Climb sideways on ladder around left outer corner, first part > ANIMATION_LARA_LADDER_AROUND_LEFT_OUTER_END - ANIMATION_LARA_LADDER_AROUND_LEFT_OUTER_END = 364, // Climb sideways on ladder around left outer corner, second part (from ANIMATION_LARA_LADDER_AROUND_LEFT_OUTER_BEGIN) - ANIMATION_LARA_LADDER_AROUND_RIGHT_OUTER_BEGIN = 365, // Climb sideways on ladder around right outer corner, first part > ANIMATION_LARA_LADDER_AROUND_RIGHT_OUTER_END - ANIMATION_LARA_LADDER_AROUND_RIGHT_OUTER_END = 366, // Climb sideways on ladder around right outer corner, second part (from ANIMATION_LARA_LADDER_AROUND_RIGHT_OUTER_BEGIN) - ANIMATION_LARA_LADDER_AROUND_LEFT_INNER_BEGIN = 367, // Climb sideways on ladder around left inner corner, first part > ANIMATION_LARA_LADDER_AROUND_LEFT_INNER_END - ANIMATION_LARA_LADDER_AROUND_LEFT_INNER_END = 368, // Climb sideways on ladder around left inner corner, second part (from ANIMATION_LARA_LADDER_AROUND_LEFT_INNER_BEGIN) - ANIMATION_LARA_LADDER_AROUND_RIGHT_INNER_BEGIN = 369, // Climb sideways on ladder around right inner corner, first part > ANIMATION_LARA_LADDER_AROUND_RIGHT_INNER_END - ANIMATION_LARA_LADDER_AROUND_RIGHT_INNER_END = 370, // Climb sideways on ladder around right inner corner, second part (from ANIMATION_LARA_LADDER_AROUND_RIGHT_INNER_BEGIN) - ANIMATION_LARA_MONKEY_TO_ROPE_BEGIN = 371, // Hang from monkey-bars/jump upwards > grab rope (?) - ANIMATION_LARA_TRAIN_DEATH = 372, // Fall off train > die - ANIMATION_LARA_MONKEY_TO_ROPE_END = 373, // Loose momentum on rope > wrap legs around rope > hang still on rope - ANIMATION_LARA_ROPE_IDLE = 374, // Hang still on rope - ANIMATION_LARA_ROPE_DOWN_BEGIN = 375, // Hang still on rope > slide down rope - ANIMATION_LARA_ROPE_UP = 376, // Climb rope - ANIMATION_LARA_ROPE_IDLE_TO_SWING_SOFT = 377, // Hang still on rope > begin to swing with still some momentum left (no kick necessary)(?) - ANIMATION_LARA_ROPE_GRAB_TO_FALL = 378, // Have just grabbed rope > fall (?) - ANIMATION_LARA_ROPE_JUMP_TO_GRAB = 379, // Jump forwards > grab rope - ANIMATION_LARA_ROPE_IDLE_TO_BACKFLIP = 380, // Somersault from rope to ledge? (not used) - ANIMATION_LARA_ROPE_SWING_TO_FALL_SEMIFRONT = 381, // Swing on rope > fall (when Lara is in the fore end of the swing - haft past four o'clock)(?) - ANIMATION_LARA_ROPE_SWING_TO_FALL_MIDDLE = 382, // Swing on rope> fall (when Lara is in the middle of the swing) (?) - ANIMATION_LARA_ROPE_SWING_TO_FALL_BACK = 383, // Swing on rope > fall (when Lara is in the back end of the swing) (?) - ANIMATION_LARA_ROPE_DOWN = 384, // Slide down rope - ANIMATION_LARA_ROPE_DOWN_TO_IDLE = 385, // Slide down rope > hang still on rope - ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_BACK = 386, // Swing on rope > jump off to grab ledge (when Lara is in the back end of the swing) - ANIMATION_LARA_ROPE_IDLE_TO_SWING = 387, // Hang still on rope > give a kick to gain momentum to swing (begin to swing) - ANIMATION_LARA_ROPE_IDLE_TO_SWING_SEMIMIDDLE = 388, // Swing on rope> fall (when Lara is just before the middle of the swing - 7 o'clock) (?) - ANIMATION_LARA_ROPE_IDLE_TO_SWING_HALFMIDDLE = 389, // Swing on rope> fall (when Lara is just before the middle of the swing - half past six o'clock) (?) - ANIMATION_LARA_ROPE_SWING_TO_FALL_FRONT = 390, // Swing on rope > fall (when Lara is in the fore end of the swing - 5 o'clock) (?) - ANIMATION_LARA_ROPE_GRAB_TO_FALL_ALTERNATE = 391, // Have just grabbed rope > fall (same animation as ANIMATION_LARA_ROPE_GRAB_TO_FALL?) (?) - ANIMATION_LARA_ROPE_TURN_CLOCKWISE = 392, // Turn clockwise on rope - ANIMATION_LARA_ROPE_TURN_COUNTER_CLOCKWISE = 393, // Turn counter-clockwise on rope - ANIMATION_LARA_ROPE_SWING_FORWARD_SEMIHARD = 394, // Swing forwards on rope with much momentum - ANIMATION_LARA_ROPE_LADDER_TO_HANDS_DOWN_ALTERNATE = 395, // Hang still on ladder > abandon footing > hang by the hands alone (not used) (?) - ANIMATION_LARA_ROPE_SWING_BACK_CONTINUE = 396, // Swing backwards on rope, second part (from ANIMATION_LARA_ROPE_SWING_BACK_BEGIN) > ANIMATION_LARA_ROPE_SWING_BACK_END - ANIMATION_LARA_ROPE_SWING_BACK_END = 397, // Swing backwards on rope, third part (from ANIMATION_LARA_ROPE_SWING_BACK_CONTINUE) - ANIMATION_LARA_ROPE_SWING_BACK_BEGIN = 398, // Swing backwards on rope, first part > ANIMATION_LARA_ROPE_SWING_BACK_CONTINUE - ANIMATION_LARA_ROPE_SWING_FORWARD_SOFT = 399, // Swing forwards on rope with little momentum (?) - ANIMATION_LARA_WATERSKIN_EMPTY = 400, // Empty waterskin - ANIMATION_LARA_WATERSKIN_FILL = 401, // Fill waterskin - ANIMATION_LARA_WATERSKIN_POUR_ON_SCALE = 402, // Pour waterskin on scale - ANIMATION_LARA_DOOR_OPEN_CROWBAR = 403, // Open door with crowbar - ANIMATION_LARA_ROPE_SWING_FORWARD_HARD = 404, // Reach fore end of swing on rope with very much momentum - ANIMATION_LARA_ROPE_CHANGE_ROPE = 405, // Swing on rope and grab a new rope? (not used?) - ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_FRONT2 = 406, // Swing on rope > jump off to grab ledge (when Lara is in the fore end of the swing - 4 o'clock) - ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_MIDDLE = 407, // Swing on rope > jump off to grab ledge (when Lara is right in the middle of the swing) - ANIMATION_LARA_ROPE_SWING_BLOCK = 408, // Swing forth and back with almost no momentum (Lara is too high on the rope?) - ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_SEMIMIDDLE = 409, // Swing on rope > jump off to grab ledge (when Lara is just before the middle of the swing) - ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_FRONT3 = 410, // Swing on rope > jump off to grab ledge (when Lara is in the fore end of the swing - 5 o'clock) - ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_FRONT1 = 411, // Swing on rope > jump off to grab ledge (when Lara is in the fore end of the swing - 3 o'clock) - ANIMATION_LARA_DOUBLEDOORS_PUSH = 412, // Push double doors - ANIMATION_LARA_BIG_BUTTON_PUSH = 413, // Push big button - ANIMATION_LARA_JUMPSWITCH = 414, // Pull jumpswitch - ANIMATION_LARA_UNDERWATER_PULLEY = 415, // Pull underwater switch in the ceiling - ANIMATION_LARA_UNDERWATER_DOOR_OPEN = 416, // Open underwater_door - ANIMATION_LARA_PUSHABLE_PUSH_TO_STAND = 417, // Push pushable > stand - ANIMATION_LARA_PUSHABLE_PULL_TO_STAND = 418, // Pull pushable > stand - ANIMATION_LARA_CROWBAR_USE_ON_WALL = 419, // Use crowbar to get puzzle item from wall - ANIMATION_LARA_CROWBAR_USE_ON_FLOOR = 420, // Use crowbar to activate broken leverswitch (Desert Railroad) - ANIMATION_LARA_CRAWL_JUMP_DOWN = 421, // Roll forwards out of crawlspace (not used) - ANIMATION_LARA_HARP_PLAY = 422, // Play harp (The Lost Library) - ANIMATION_LARA_PUT_TRIDENT = 423, // Place trident on Poseidon statue (Temple of Poseidon) - ANIMATION_LARA_PICKUP_PEDESTAL_HIGH = 424, // Standing pickup from high pedestal (Lara's height) - ANIMATION_LARA_PICKUP_PEDESTAL_LOW = 425, // Standing pickup from low pedestal (waist-height) - ANIMATION_LARA_ROTATE_SENET = 426, // Play game of senet (Tomb of Semerkhet) - ANIMATION_LARA_TORCH_LIGHT_1 = 427, // Light torch with flame 0-1 clicks high - ANIMATION_LARA_TORCH_LIGHT_2 = 428, // Light torch with flame 2-3 clicks high - ANIMATION_LARA_TORCH_LIGHT_3 = 429, // Light torch with flame 4-5 clicks high - ANIMATION_LARA_TORCH_LIGHT_4 = 430, // Light torch with flame 6-7 clicks high - ANIMATION_LARA_TORCH_LIGHT_5 = 431, // Light torch with flame higher than 7 clicks - ANIMATION_LARA_DETONATOR_USE = 432, // use mine detector - ANIMATION_LARA_CORRECT_POSITION_FRONT = 433, // Small steps forward to correct Lara's position (hardcoded, used to put line up Lara in front of switches and puzzles) - ANIMATION_LARA_CORRECT_POSITION_LEFT = 434, // Small steps to the left to corrcts Lara's position - ANIMATION_LARA_CORRECT_POSITION_RIGHT = 435, // Small steps to the right to correct Lara's position - ANIMATION_LARA_CROWBAR_USE_ON_FLOOR_FAIL = 436, // Use crowbar to break train link? (not used) - ANIMATION_LARA_USE_KEYCARD = 437, // Use swipe card - ANIMATION_LARA_DEATH_BLOWUP = 438, // Blown up by mine - ANIMATION_LARA_PICKUP_SARCOPHAGUS = 439, // Pickup from sarcophagus - ANIMATION_LARA_DRAG = 440, // Dragging dead body (City of the Dead) - ANIMATION_LARA_BINOCULARS = 441, // Look through binoculars (not used) - ANIMATION_LARA_DEATH_BIG_SCORPION = 442, // Picked up and tossed away by big scorpion - ANIMATION_LARA_ELEVATOR_RECOVER = 443, // Lara painfully gets to her feet after fall in elevator (VCI-levels) - ANIMATION_LARA_BEETLE_PUT = 444, // Wind up beetle > put beetle on floor - ANIMATION_LARA_DOZY = 445, // DOZY Animation - ANIMATION_LARA_TIGHTROPE_WALK = 446, // Walk on tightrope - ANIMATION_LARA_TIGHTROPE_WALK_TO_STAND = 447, // Walk on tightrope > stand on tightrope - ANIMATION_LARA_TIGHTROPE_STAND = 448, // Stand on tightrope - ANIMATION_LARA_TIGHTROPE_WALK_TO_STAND_CAREFUL = 449, // Walk on tightrope > tread carefully > stand on tightrope - ANIMATION_LARA_TIGHTROPE_STAND_TO_WALK = 450, // Stand on tightrope > walk on tightrope - ANIMATION_LARA_TIGHTROPE_TURN = 451, // Turn around on tightrope - ANIMATION_LARA_TIGHTROPE_LOOSE_LEFT = 452, // Stand on tightrope > loose balance and lean left - ANIMATION_LARA_TIGHTROPE_RECOVER_LEFT = 453, // Lean left on tightrope > regain balance and stand on tightrope - ANIMATION_LARA_TIGHTROPE_FALL_LEFT = 454, // Fall off tightrope (to the left) - ANIMATION_LARA_TIGHTROPE_LOOSE_RIGHT = 455, // Stand on tightrope > loose balance and lean right - ANIMATION_LARA_TIGHTROPE_RECOVER_RIGHT = 456, // Lean right on tightrope > regain balance and stand on tightrope - ANIMATION_LARA_TIGHTROPE_FALL_RIGHT = 457, // Fall off tightrope (to the right) - ANIMATION_LARA_TIGHTROPE_START = 458, // Stand > walk out on tightrope - ANIMATION_LARA_TIGHTROPE_FINISH = 459, // Walk off tightrope > stand - ANIMATION_LARA_DOVESWITCH_TURN = 460, // Examine and turn doveswitch (Rome-levels) - ANIMATION_LARA_BARS_GRAB = 461, // Jump forwards > grab horizontal pole - ANIMATION_LARA_BARS_SWING = 462, // Swing around horizontal pole - ANIMATION_LARA_BARS_JUMP = 463, // Jump off horizontal pole - ANIMATION_LARA_LOOT_CABINET = 464, // Open cabinet and search it - ANIMATION_LARA_LOOT_DRAWER = 465, // Open drawer and search it - ANIMATION_LARA_LOOT_SHELF = 466, // Search shelves - ANIMATION_LARA_RADIO_BEGIN = 467, // Stand > put hand to headgear to listen (VCI-levels) - ANIMATION_LARA_RADIO_IDLE = 468, // Hold hand on headgear and listen (VCI-levels) - ANIMATION_LARA_RADIO_END = 469, // Remove hand from headgear > stand (VCI-levels) - ANIMATION_LARA_VALVE_TURN = 470, // Turn valve wheel - ANIMATION_LARA_CROWBAR_USE_ON_WALL2 = 471, // Pull object off wall (to use as crowbar) - ANIMATION_LARA_LOOT_CHEST = 472, // Kneel to open box and pick up item (VCI-levels) - ANIMATION_LARA_LADDER_TO_CROUCH = 473, // Climb wall > pull up in crawlspace - ANIMATION_LARA_1CLICK_CRAWL_VAULT = 474, // 1 click crawlspace vault - ANIMATION_LARA_2CLICK_CRAWL_VAULT = 475, // 2 click crawlspace vault - ANIMATION_LARA_3CLICK_CRAWL_VAULT = 476, // 3 click crawlspace vault - ANIMATION_LARA_1CLICK_CRAWL_EXIT = 477, // 1 click crawlspace exit - ANIMATION_LARA_2CLICK_CRAWL_EXIT = 478, // 2 click crawlspace exit - ANIMATION_LARA_1CLICK_CRAWL_TO_CRAWL_UP = 479, // maneuver up 1 click in crawlspace - ANIMATION_LARA_1CLICK_CRAWL_TO_CRAWL_DOWN = 480, // maneuver down 1 click in crawlspace - ANIMATION_LARA_CLIMB_OUT_OF_WATER_TO_2CLICK = 481, // climb out of water to 2click crawlspace - ANIMATION_LARA_ONWATER_TO_LAND_LOW_TO_2CLICK = 482, // climb out of onwater to 2click crawlspace - ANIMATION_LARA_WATER_TO_SUBMERGED_CRAWL = 483, // wade out of water to submerged crawlspace - ANIMATION_LARA_HANG_FEET = 484, // hang with feet supporting her - ANIMATION_LARA_HANG_FEET_SHIMMYR = 485, // shimmy right with feet on wall - ANIMATION_LARA_HANG_FEET_SHIMMYL = 486, // shimmy left with feet on wall - ANIMATION_LARA_HANG_FEET_CLIMB = 487, // feet hang -> climb - ANIMATION_LARA_HANG_FEET_IDLE = 488, // hang feet idle anim for shimmies/climbups - ANIMATION_LARA_HANG_FEET_CLIMB_TO_CROUCH = 489, // hang feet crouch climb - ANIMATION_LARA_HANG_FEET_IN_RCORNER = 490, // hang feet shimmy around inner right corner - ANIMATION_LARA_HANG_FEET_IN_LCORNER = 491, // hang feet shimmy around inner left corner - ANIMATION_LARA_HANG_FEET_OUT_RCORNER = 492, // hang feet shimmy around outer right corner - ANIMATION_LARA_HANG_FEET_OUT_LCORNER = 493, // hang feet shimmy around outer left corner - - NUM_LARA_ANIMS -}; - -enum LARA_MESHES -{ - LM_HIPS, - LM_LTHIGH, - LM_LSHIN, - LM_LFOOT, - LM_RTHIGH, - LM_RSHIN, - LM_RFOOT, - LM_TORSO, - LM_RINARM, - LM_ROUTARM, - LM_RHAND, - LM_LINARM, - LM_LOUTARM, - LM_LHAND, - LM_HEAD, - - NUM_LARA_MESHES -}; - -enum LARA_WEAPON_TYPE -{ - WEAPON_NONE, - WEAPON_PISTOLS, - WEAPON_REVOLVER, - WEAPON_UZI, - WEAPON_SHOTGUN, - WEAPON_HK, - WEAPON_CROSSBOW, - WEAPON_FLARE, - WEAPON_TORCH, - WEAPON_GRENADE_LAUNCHER, - WEAPON_HARPOON_GUN, - WEAPON_ROCKET_LAUNCHER, - WEAPON_SNOWMOBILE, - NUM_WEAPONS -}; - -enum LARA_WEAPON_TYPE_CARRIED -{ - WTYPE_MISSING = 0x0, - WTYPE_PRESENT = 0x1, - WTYPE_SILENCER = 0x2, - WTYPE_LASERSIGHT = 0x4, - WTYPE_AMMO_1 = 0x8, - WTYPE_AMMO_2 = 0x10, - WTYPE_AMMO_3 = 0x20, - WTYPE_MASK_AMMO = WTYPE_AMMO_1 | WTYPE_AMMO_2 | WTYPE_AMMO_3, -}; - -enum LARA_CLOTH_TYPES -{ - CLOTH_MISSING, - CLOTH_DRY, - CLOTH_WET -}; - -enum WEATHER_TYPES -{ - WEATHER_NORMAL, - WEATHER_RAIN, - WEATHER_SNOW -}; - -enum GAME_STATUS -{ - GAME_STATUS_NONE, - GAME_STATUS_NEW_GAME, - GAME_STATUS_LOAD_GAME, - GAME_STATUS_SAVE_GAME, - GAME_STATUS_EXIT_TO_TITLE, - GAME_STATUS_EXIT_GAME, - GAME_STATUS_LARA_DEAD, - GAME_STATUS_LEVEL_COMPLETED -}; - -enum MATRIX_ARRAY_VALUE -{ - M00, M01, M02, M03, - M10, M11, M12, M13, - M20, M21, M22, M23 -}; - -enum COLL_TYPE -{ - CT_NONE = 0, // 0x00 - CT_FRONT = (1 << 0), // 0x01 - CT_LEFT = (1 << 1), // 0x02 - CT_RIGHT = (1 << 2), // 0x04 - CT_TOP = (1 << 3), // 0x08 - CT_TOP_FRONT = (1 << 4), // 0x10 - CT_CLAMP = (1 << 5) // 0x20 -}; - -enum HEIGHT_TYPES -{ - WALL, - SMALL_SLOPE, - BIG_SLOPE, - DIAGONAL, - SPLIT_TRI -}; - -enum HEADINGS -{ - NORTH, - EAST, - SOUTH, - WEST -}; - -enum CAMERA_FLAGS -{ - CF_FOLLOW_CENTER = 1, - CF_UNKNOWN_2 = 2, - CF_CHASE_OBJECT = 3, -}; - -enum LARA_JOINT -{ - LJ_HIPS = 0, // 0 - LJ_LTHIGH = 1, // 1 - LJ_LSHIN = 2, // 2 - LJ_LFOOT = 3, // 3 - LJ_RTHIGH = 4, // 4 - LJ_RSHIN = 5, // 5 - LJ_RFOOT = 6, // 6 - LJ_TORSO = 7, // 7 - LJ_RINARM = 9, // 8 - LJ_ROUTARM = 10, // 9 - LJ_RHAND = 11, // 10 - LJ_LINARM = 12, // 11 - LJ_LOUTARM = 13, // 12 - LJ_LHAND = 14, // 13 - LJ_HEAD = 8, // 14 -}; - -enum COMMAND_TYPES -{ - COMMAND_NULL = 0, - COMMAND_MOVE_ORIGIN, - COMMAND_JUMP_VELOCITY, - COMMAND_ATTACK_READY, - COMMAND_DEACTIVATE, - COMMAND_SOUND_FX, - COMMAND_EFFECT -}; - -enum SFX_TYPES -{ - SFX_LANDANDWATER = 0, - SFX_LANDONLY = (1 << 14), - SFX_WATERONLY = (2 << 14) +#pragma once +#include "box.h" +#include "collide.h" +#include "effect.h" +#include "objectslist.h" +#include "trmath.h" +#include "Renderer11.h" + +#define NUM_PUZZLES (ID_PUZZLE_ITEM16 - ID_PUZZLE_ITEM1 + 1) +#define NUM_KEYS (ID_KEY_ITEM16 - ID_KEY_ITEM1 + 1) +#define NUM_PICKUPS (ID_PICKUP_ITEM16 - ID_PICKUP_ITEM1 + 1) +#define NUM_EXAMINES (ID_EXAMINE8 - ID_EXAMINE1 + 1) + +#pragma region state_and_animation +enum LARA_STATE +{ + STATE_LARA_WALK_FORWARD = 0, + STATE_LARA_RUN_FORWARD = 1, + STATE_LARA_STOP = 2, + STATE_LARA_JUMP_FORWARD = 3, + STATE_LARA_POSE = 4, + STATE_LARA_RUN_BACK = 5, + STATE_LARA_TURN_RIGHT_SLOW = 6, + STATE_LARA_TURN_LEFT_SLOW = 7, + STATE_LARA_DEATH = 8, + STATE_LARA_FREEFALL = 9, + STATE_LARA_HANG = 10, + STATE_LARA_REACH = 11, + STATE_LARA_SPLAT = 12, + STATE_LARA_UNDERWATER_STOP = 13, + STATE_LARA_GRAB_TO_FALL = 14, + STATE_LARA_JUMP_PREPARE = 15, + STATE_LARA_WALK_BACK = 16, + STATE_LARA_UNDERWATER_FORWARD = 17, + STATE_LARA_UNDERWATER_INERTIA = 18, + STATE_LARA_GRABBING = 19, + STATE_LARA_TURN_FAST = 20, + STATE_LARA_WALK_RIGHT = 21, + STATE_LARA_WALK_LEFT = 22, + STATE_LARA_ROLL_BACKWARD = 23, + STATE_LARA_SLIDE_FORWARD = 24, + STATE_LARA_JUMP_BACK = 25, + STATE_LARA_JUMP_LEFT = 26, + STATE_LARA_JUMP_RIGHT = 27, + STATE_LARA_JUMP_UP = 28, + STATE_LARA_FALL_BACKWARD = 29, + STATE_LARA_SHIMMY_LEFT = 30, + STATE_LARA_SHIMMY_RIGHT = 31, + STATE_LARA_SLIDE_BACK = 32, + STATE_LARA_ONWATER_STOP = 33, + STATE_LARA_ONWATER_FORWARD = 34, + STATE_LARA_UNDERWATER_DIVING = 35, + STATE_LARA_PUSHABLE_PUSH = 36, + STATE_LARA_PUSHABLE_PULL = 37, + STATE_LARA_PUSHABLE_GRAB = 38, + STATE_LARA_PICKUP = 39, + STATE_LARA_SWITCH_DOWN = 40, + STATE_LARA_SWITCH_UP = 41, + STATE_LARA_INSERT_KEY = 42, + STATE_LARA_INSERT_PUZZLE = 43, + STATE_LARA_WATER_DEATH = 44, + STATE_LARA_ROLL_FORWARD = 45, + STATE_LARA_BOULDER_DEATH = 46, + STATE_LARA_ONWATER_BACK = 47, + STATE_LARA_ONWATER_LEFT = 48, + STATE_LARA_ONWATER_RIGHT = 49, + STATE_LARA_USE_MIDAS = 50, + STATE_LARA_DIE_MIDAS = 51, + STATE_LARA_SWANDIVE_BEGIN = 52, + STATE_LARA_SWANDIVE_END = 53, + STATE_LARA_HANDSTAND = 54, + STATE_LARA_ONWATER_EXIT = 55, + STATE_LARA_LADDER_IDLE = 56, + STATE_LARA_LADDER_UP = 57, + STATE_LARA_LADDER_LEFT = 58, + STATE_LARA_LADDER_END = 59, + STATE_LARA_LADDER_RIGHT = 60, + STATE_LARA_LADDER_DOWN = 61, + STATE_LARA_NULL_62 = 62, + STATE_LARA_NULL_63 = 63, + STATE_LARA_NULL_64 = 64, + STATE_LARA_WADE_FORWARD = 65, + STATE_LARA_UNDERWATER_TURNAROUND = 66, + STATE_LARA_FLARE_PICKUP = 67, + STATE_LARA_JUMP_ROLL = 68, + STATE_LARA_NULL_69 = 69, + STATE_LARA_ZIPLINE_RIDE = 70, + STATE_LARA_CROUCH_IDLE = 71, + STATE_LARA_CROUCH_ROLL = 72, + STATE_LARA_SPRINT = 73, + STATE_LARA_SPRINT_ROLL = 74, + STATE_LARA_MONKEYSWING_IDLE = 75, + STATE_LARA_MONKEYSWING_FORWARD = 76, + STATE_LARA_MONKEYSWING_LEFT = 77, + STATE_LARA_MONKEYSWING_RIGHT = 78, + STATE_LARA_MONKEYSWING_TURNAROUND = 79, + STATE_LARA_CRAWL_IDLE = 80, + STATE_LARA_CRAWL_FORWARD = 81, + STATE_LARA_MONKEYSWING_TURN_LEFT = 82, + STATE_LARA_MONKEYSWING_TURN_RIGHT = 83, + STATE_LARA_CRAWL_TURN_LEFT = 84, + STATE_LARA_CRAWL_TURN_RIGHT = 85, + STATE_LARA_CRAWL_BACK = 86, + STATE_LARA_CLIMB_TO_CRAWL = 87, + STATE_LARA_CRAWL_TO_CLIMB = 88, + STATE_LARA_MISC_CONTROL = 89, + STATE_LARA_ROPE_TURN_LEFT = 90, + STATE_LARA_ROPE_TURN_RIGHT = 91, + STATE_LARA_GIANT_BUTTON_PUSH = 92, + STATE_LARA_TRAPDOOR_FLOOR_OPEN = 93, + STATE_LARA_FREEFALL_BIS = 94, + STATE_LARA_ROUND_HANDLE = 95, + STATE_LARA_COGWHEEL = 96, + STATE_LARA_LEVERSWITCH_PUSH = 97, + STATE_LARA_HOLE = 98, + STATE_LARA_POLE_IDLE = 99, + STATE_LARA_POLE_UP = 100, + STATE_LARA_POLE_DOWN = 101, + STATE_LARA_POLE_TURN_LEFT = 102, + STATE_LARA_POLE_TURN_RIGHT = 103, + STATE_LARA_PULLEY = 104, + STATE_LARA_CROUCH_TURN_LEFT = 105, + STATE_LARA_CROUCH_TURN_RIGHT = 106, + STATE_LARA_CLIMB_CORNER_LEFT_OUTER = 107, + STATE_LARA_CLIMB_CORNER_RIGHT_OUTER = 108, + STATE_LARA_CLIMB_CORNER_LEFT_INNER = 109, + STATE_LARA_CLIMB_CORNER_RIGHT_INNER = 110, + STATE_LARA_ROPE_IDLE = 111, + STATE_LARA_ROPE_CLIMB_UP = 112, + STATE_LARA_ROPE_CLIMB_DOWN = 113, + STATE_LARA_ROPE_SWING = 114, + STATE_LARA_LADDER_TO_HANDS = 115, + STATE_LARA_POSITION_CORRECTOR = 116, + STATE_LARA_DOUBLEDOORS_PUSH = 117, + STATE_LARA_DOZY = 118, + STATE_LARA_TIGHTROPE_IDLE = 119, + STATE_LARA_TIGHTROPE_TURNAROUND = 120, + STATE_LARA_TIGHTROPE_FORWARD = 121, + STATE_LARA_TIGHTROPE_BALANCING_LEFT = 122, + STATE_LARA_TIGHTROPE_BALANCING_RIGHT = 123, + STATE_LARA_TIGHTROPE_ENTER = 124, + STATE_LARA_TIGHTROPE_EXIT = 125, + STATE_LARA_DOVESWITCH = 126, + STATE_LARA_TIGHTROPE_RESTORE_BALANCE = 127, + STATE_LARA_BARS_SWING = 128, + STATE_LARA_BARS_JUMP = 129, + STATE_LARA_UNKNOWN_130 = 130, + STATE_LARA_RADIO_LISTENING = 131, + STATE_LARA_RADIO_OFF = 132, + STATE_LARA_UNKNOWN_133 = 133, + STATE_LARA_UNKNOWN_134 = 134, + STATE_LARA_UNKNOWN_135 = 135, + STATE_LARA_UNUSED16 = 136, + STATE_LARA_PICKUP_FROM_CHEST = 137, + STATE_LARA_UNKNOWN_138 = 138, + STATE_LARA_HANG_FEET = 139, + STATE_LARA_HANG_FEET_SHIMMYR = 140, + STATE_LARA_HANG_FEET_SHIMMYL = 141, + STATE_LARA_HANG_FEET_INCORNERR = 142, + STATE_LARA_HANG_FEET_INCORNERL = 143, + STATE_LARA_HANG_FEET_OUTCORNERR = 144, + STATE_LARA_HANG_FEET_OUTCORNERL = 145, + + NUM_LARA_STATES +}; + +enum LARA_ANIM +{ + ANIMATION_LARA_RUN = 0, // Run + ANIMATION_LARA_WALK_FORWARD = 1, // Walk + ANIMATION_LARA_END_WALK_RIGHT = 2, // Walk > stand (right foot moved first) + ANIMATION_LARA_END_WALK_LEFT = 3, // Walk > stand (left foot moved first) + ANIMATION_LARA_WALK_TO_RUN_RIGHT = 4, // Walk > Run (right foot moved first) + ANIMATION_LARA_WALK_TO_RUN_LEFT = 5, // Walk > Run (left foot moved first) + ANIMATION_LARA_STAY_TO_RUN = 6, // Stand > run + ANIMATION_LARA_RUN_TO_WALK_RIGHT = 7, // Run > walk (left foot first) + ANIMATION_LARA_RUN_TO_STAY_LEFT = 8, // Run > stand (left food first) + ANIMATION_LARA_RUN_TO_WALK_LEFT = 9, // Run > walk (right foot first) + ANIMATION_LARA_RUN_TO_STAY_RIGHT = 10, // Run > stand (right foot first) + ANIMATION_LARA_STAY_SOLID = 11, // Stand still (used as a link between many standing animations) + ANIMATION_LARA_TURN_RIGHT_SLOW = 12, // Turn right on the spot, small turn + ANIMATION_LARA_TURN_LEFT_SLOW = 13, // Turn left on the spot, small turn + ANIMATION_LARA_LANDING_FORWARD_BOTH = 14, // Forward jump/fall (less than 7 clicks high) > land (to a standstill), first part > ANIMATION_LARA_LANDING_FORWARD_BOTH_CONTINUE + ANIMATION_LARA_LANDING_FORWARD_BOTH_CONTINUE = 15, // Land (after jump/fall less that 7 clicks high), second part > stand still (from ANIMATION_LARA_LANDING_FORWARD_BOTH) + ANIMATION_LARA_JUMPING_FORWARD_RIGHT = 16, // Run > take off for forward jump (right foot first) > ANIMATION_LARA_START_FLY_FORWARD_RIGHT + ANIMATION_LARA_START_FLY_FORWARD_RIGHT = 17, // Running take off for forward jump (left foot first) > forward jump + ANIMATION_LARA_JUMPING_FORWARD_LEFT = 18, // Run > take off for forward jump (left foot first) > ANIMATION_LARA_START_FLY_FORWARD_LEFT + ANIMATION_LARA_START_FLY_FORWARD_LEFT = 19, // Running take off for forward jump (right foot first) > forward jump + ANIMATION_LARA_WALK_FORWARD_BEGIN = 20, // Stand > walk forwards, first part > ANIMATION_LARA_WALK_FORWARD_BEGIN_CONTINUE + ANIMATION_LARA_WALK_FORWARD_BEGIN_CONTINUE = 21, // Walk forwards, second part > walk (from ANIMATION_LARA_WALK_FORWARD_BEGIN) + ANIMATION_LARA_START_FREE_FALL = 22, // Jump > fall + ANIMATION_LARA_FREE_FALL_LONG = 23, // Fall + ANIMATION_LARA_LANDING_HARD = 24, // Jump/fall (more than 7 clicks) > crouching landing > stand + ANIMATION_LARA_LANDING_DEATH = 25, // Fall > die (break neck) + ANIMATION_LARA_STAY_TO_GRAB = 26, // Stand > take off for upward jump to grab + ANIMATION_LARA_STAY_TO_GRAB_CONTINUE = 27, // Jump upwards to grab + ANIMATION_LARA_TRY_HANG_VERTICAL = 28, // Jump upwards + ANIMATION_LARA_BEGIN_HANGING_VERTICAL = 29, // Grab (after upward jump to grab) > hang by the hands + ANIMATION_LARA_STOP_HANG_VERTICAL = 30, // Hang by the hands > fall + ANIMATION_LARA_LANDING_LIGHT = 31, // Land after upward jump > stand + ANIMATION_LARA_SMASH_JUMP = 32, // Jump > hit something while in the air, first part > ANIMATION_LARA_SMASH_JUMP_CONTINUE + ANIMATION_LARA_SMASH_JUMP_CONTINUE = 33, // Hit something while in the air, second part > fall (from ANIMATION_LARA_SMASH_JUMP) + ANIMATION_LARA_FREE_FALL_FORWARD = 34, // Downward curve during long jump, first part (not used?) > ANIMATION_LARA_FREE_FALL_MIDDLE + ANIMATION_LARA_FREE_FALL_MIDDLE = 35, // Downward curve during long jump, second part (not used?) (from ANIMATION_LARA_FREE_FALL_FORWARD) + ANIMATION_LARA_FREE_FALL_LONG_NO_HURT = 36, // Downward curve during long jump > fall + ANIMATION_LARA_HANG_TO_RELEASE = 37, // Hang by the hands > fall (great fall) (not used?) + ANIMATION_LARA_STOP_WALK_BACK_RIGHT = 38, // Walk backwards > stand (right foot moved first) + ANIMATION_LARA_STOP_WALK_BACK_LEFT = 39, // Walk backwards > stand (left foot moved first) + ANIMATION_LARA_WALK_BACK = 40, // Walk backwards + ANIMATION_LARA_START_WALK_BACK = 41, // Stand > walk backwards + ANIMATION_LARA_CLIMB_3CLICK = 42, // Climb block (3 clicks high) + ANIMATION_LARA_CLIMB_3CLICK_END_RUNNING = 43, // Stand (after jumping to a higher point) > run (not used?) + ANIMATION_LARA_ROTATE_RIGHT = 44, // Turn right on the spot, large turn + ANIMATION_LARA_JUMPING_FORWARD_TO_FREEFALL = 45, // Jump forwards > fall (?) + ANIMATION_LARA_FLY_FORWARD_TRY_TO_HANG = 46, // Forward jump trying to grab > land (not used?) + ANIMATION_LARA_ROLL_ALTERNATE = 47, // Roll (not used?) + ANIMATION_LARA_ROLL_END_ALTERNATE = 48, // Roll > stand (not used?) + ANIMATION_LARA_FREE_FALL_NO_HURT = 49, // Jump forwards > fall (at earlier stage of jump) (not used?) + ANIMATION_LARA_CLIMB_2CLICK = 50, // Climb block (2 clicks high) + ANIMATION_LARA_CLIMB_2CLICK_END = 51, // Climb block (2 clicks high) > stand + ANIMATION_LARA_CLIMB_2CLICK_END_RUNNING = 52, // Stand (after climbing block 2 clicks high) > run + ANIMATION_LARA_WALL_SMASH_LEFT = 53, // Run > hit wall (left foot first) > stand + ANIMATION_LARA_WALL_SMASH_RIGHT = 54, // Run > hit wall (right foot first) > stand + ANIMATION_LARA_RUN_UP_STEP_RIGHT = 55, // Ascend block (1 click high) running (left foot first) + ANIMATION_LARA_RUN_UP_STEP_LEFT = 56, // Ascend block (1 click high) running (right foot first) + ANIMATION_LARA_WALK_UP_STEP_RIGHT = 57, // Ascend block (1 click high) walking (left foot first) + ANIMATION_LARA_WALK_UP_STEP_LEFT = 58, // Ascend block (1 click high) walking (right foot first) + ANIMATION_LARA_WALK_DOWN_LEFT = 59, // Descend block (1 click high) walking (right foot moved first) + ANIMATION_LARA_WALK_DOWN_RIGHT = 60, // Descend block (1 click high) walking (left foot moved first) + ANIMATION_LARA_WALK_DOWN_BACK_LEFT = 61, // Descend block (1 click high) walking backwards (left foot moved first) + ANIMATION_LARA_WALK_DOWN_BACK_RIGHT = 62, // Descend block (1 click high) walking backwards (right foot moved first) + ANIMATION_LARA_PULL_SWITCH_DOWN = 63, // Activate (lower) horizontal switch + ANIMATION_LARA_PULL_SWITCH_UP = 64, // Deactivate (raise) horizontal switch + ANIMATION_LARA_WALK_LEFT = 65, // Sidestep left + ANIMATION_LARA_WALK_LEFT_END = 66, // Sidestep left > stand + ANIMATION_LARA_WALK_RIGHT = 67, // Sidestep right + ANIMATION_LARA_WALK_RIGHT_END = 68, // Sidestep right > stand + ANIMATION_LARA_ROTATE_LEFT = 69, // Turn left on the spot, large turn + ANIMATION_LARA_SLIDE_FORWARD = 70, // Slide forwards down steep slope (3 clicks high) + ANIMATION_LARA_SLIDE_FORWARD_END = 71, // Slide forwards down steep slope (3 clicks high) > stumbling landing, first part > ANIMATION_LARA_SLIDE_FORWARD_STOP + ANIMATION_LARA_SLIDE_FORWARD_STOP = 72, // Stumbling landing (after sliding forwards down slope), second part > stand (from ANIMATION_LARA_SLIDE_FORWARD_END) + ANIMATION_LARA_STAY_JUMP_SIDES = 73, // Stand > take off for jump in all directions + ANIMATION_LARA_JUMP_BACK_BEGIN = 74, // Take off for backward jump + ANIMATION_LARA_JUMP_BACK = 75, // Jump backwards + ANIMATION_LARA_JUMP_FORWARD_BEGIN = 76, // Standing take off for forward jump + ANIMATION_LARA_CONTINUE_FLY_FORWARD = 77, // Jump forwards + ANIMATION_LARA_JUMP_LEFT_BEGIN = 78, // Take off for sideways jump left + ANIMATION_LARA_JUMP_LEFT = 79, // Jump sideways left + ANIMATION_LARA_JUMP_RIGHT_BEGIN = 80, // Take off for sideways jump right + ANIMATION_LARA_JUMP_RIGHT = 81, // Jump sideways right + ANIMATION_LARA_LANDING_MIDDLE = 82, // Crouching landing after jump in all directions > stand + ANIMATION_LARA_FORWARD_TO_FREE_FALL = 83, // Jump backwards > fall + ANIMATION_LARA_LEFT_TO_FREE_FALL = 84, // Jump sideways left > fall + ANIMATION_LARA_RIGHT_TO_FREE_FALL = 85, // Jump sideways right > fall + ANIMATION_LARA_UNDERWATER_SWIM_FORWARD = 86, // Float-swim in deepsea suit (Deepsea Dive) + ANIMATION_LARA_UNDERWATER_SWIM_SOLID = 87, // Motionless underwater (driven only by momentum) in deepsea suit (used as a link between swimming animations) (Deepsea Dive) + ANIMATION_LARA_RUN_BACK_BEGIN = 88, // Stand > take off for backward hop + ANIMATION_LARA_RUN_BACK = 89, // Hop backwards + ANIMATION_LARA_RUN_BACK_END = 90, // Hop backwards > stand + ANIMATION_LARA_TRY_HANG_VERTICAL_BEGIN = 91, // Take off for upward jump + ANIMATION_LARA_LANDING_FROM_RUN = 92, // Jump forwards > running landing > run + ANIMATION_LARA_FREE_FALL_BACK = 93, // Downward curve during long jump, second part (with less momentum than ANIMATION_LARA_FREE_FALL_MIDDLE?) - not used? + ANIMATION_LARA_FLY_FORWARD_TRY_HANG = 94, // Jump forwards (at late stage during jump) > grab + ANIMATION_LARA_TRY_HANG_SOLID = 95, // Grab during forward jump + ANIMATION_LARA_HANG_IDLE = 96, // Grab in mid-air > hang by the hands at wall + ANIMATION_LARA_CLIMB_ON = 97, // Hang by the hands > pull up > stand + ANIMATION_LARA_FREE_FALL_TO_LONG = 98, // Failed attempt to grab during forward jump > fall + ANIMATION_LARA_FALL_CROUCHING_LANDING = 99, // Fall > crouching landing + ANIMATION_LARA_FREE_FALL_TO_SIDE_LANDING = 100, // Downward curve during long jump > grab~ + ANIMATION_LARA_FREE_FALL_TO_SIDE_LANDING_ALTERNATE = 101, // Downward curve during long jump (with less momentum than ANIMATION_LARA_FREE_FALL_TO_SIDE_LANDING) > grab (not used?) + ANIMATION_LARA_CLIMB_ON_END = 102, // Pull up (after hanging by the hands) > stand + ANIMATION_LARA_STAY_IDLE = 103, // Stand still (breathing) + ANIMATION_LARA_START_SLIDE_BACKWARD = 104, // Land on steep slope (3 clicks high) > slide backwards down + ANIMATION_LARA_SLIDE_BACKWARD = 105, // Slide backwards down steep slope (3 clicks high) + ANIMATION_LARA_SLIDE_BACKWARD_END = 106, // Slide backwards down steep slope (3 clicks high) > stumbling landing > stand + ANIMATION_LARA_UNDERWATER_SWIM_TO_IDLE = 107, // Stop swimming underwater in deepsea suit (at start or end of float-swimming animation) > drift underwater (Deepsea Dive) + ANIMATION_LARA_UNDERWATER_IDLE = 108, // Drift underwater in deepsea suit (Deepsea Dive) + ANIMATION_LARA_UNDERWARER_IDLE_TO_SWIM = 109, // Drift underwater in deepsea suit > swim underwater (Deepsea Dive) + ANIMATION_LARA_ONWATER_IDLE = 110, // Tread water on water surface + ANIMATION_LARA_CLIMB_OUT_OF_WATER = 111, // Pull out of water (onto ledge 1 click above the water surface) > stand + ANIMATION_LARA_FREE_FALL_TO_UNDERWATER = 112, // Fall/jump into water > swim underwater + ANIMATION_LARA_ONWATER_DIVE_ALTERNATE = 113, // Tread water on water surface > dive > swim underwater (not used?) + ANIMATION_LARA_UNDERWATER_TO_ONWATER = 114, // Swim underwater > break water surface > tread water on water surface (?) + ANIMATION_LARA_ONWATER_DIVE = 115, // Swim forwards on water surface > dive > swim underwater + ANIMATION_LARA_ONWATER_SWIM_FORWARD = 116, // Swim forwards on water surface + ANIMATION_LARA_ONWATER_SWIM_FORWARD_TO_IDLE = 117, // Swim forwards on water surface > tread water on water surface + ANIMATION_LARA_ONWATER_IDLE_TO_SWIM = 118, // Tread water on water surface > swim forwards on water surface + ANIMATION_LARA_FREE_FALL_TO_UNDERWATER_ALTERNATE = 119, // Fall/jump into water > swim underwater (not used?) + ANIMATION_LARA_START_OBJECT_MOVING = 120, // Stand > ready to push/pull pushable + ANIMATION_LARA_STOP_OBJECT_MOVING = 121, // Ready to push/pull pushable > stand + ANIMATION_LARA_OBJECT_PULL = 122, // Pull pushable + ANIMATION_LARA_OBJECT_PUSH = 123, // Push pushable + ANIMATION_LARA_UNDERWATER_DEATH = 124, // Drown/die underwater – with convulsions (Deepsea Dive) + ANIMATION_LARA_AH_FORWARD = 125, // Jerk backwards hurt (standing) + ANIMATION_LARA_AH_BACKWARD = 126, // Jerk forwards hurt (standing) + ANIMATION_LARA_AH_LEFT = 127, // Jerk right hurt (standing) + ANIMATION_LARA_AH_RIGHT = 128, // Jerk left hurt (standing) + ANIMATION_LARA_UNDERWATER_SWITCH = 129, // Pull underwater switch at wall + ANIMATION_LARA_UNDERWATER_PICKUP = 130, // Swimming pickup in deepsea suit (right hand) (Deepsea Dive) + ANIMATION_LARA_USE_KEY = 131, // Use key + ANIMATION_LARA_ONWATER_DEATH = 132, // Die on the water surface (less dramatic than ANIMATION_LARA_UNDERWATER_DEATH) + ANIMATION_LARA_RUN_TO_DIE = 133, // Run > die + ANIMATION_LARA_USE_PUZZLE = 134, // Insert puzzle item + ANIMATION_LARA_PICKUP = 135, // Standing pickup from floor (right hand) + ANIMATION_LARA_CLIMB_LEFT = 136, // Shimmy left + ANIMATION_LARA_CLIMB_RIGHT = 137, // Shimmy right + ANIMATION_LARA_STAY_TO_DEATH = 138, // Stand > die + ANIMATION_LARA_SQUASH_BOULDER = 139, // Crushed by boulder + ANIMATION_LARA_ONWATER_IDLE_TO_SWIM_BACK = 140, // Tread water on water surface > swim backwards on water surface + ANIMATION_LARA_ONWATER_SWIM_BACK = 141, // Swim backwards on water surface + ANIMATION_LARA_ONWATER_SWIM_BACK_TO_IDLE = 142, // Swim backwards on water surface > tread water on water surface + ANIMATION_LARA_ONWATER_SWIM_LEFT = 143, // Swim sideways left on water surface + ANIMATION_LARA_ONWATER_SWIM_RIGHT = 144, // Swim sideways right on water surface + ANIMATION_LARA_JUMP_TO_DEATH = 145, // Land after jump/fall > die (?) + ANIMATION_LARA_ROLL_BEGIN = 146, // Stand > roll, first part > ANIMATION_LARA_ROLL_CONTINUE + ANIMATION_LARA_ROLL_CONTINUE = 147, // Roll, second part (from ANIMATION_LARA_ROLL_BEGIN) > ANIMATION_LARA_ROLL_END + ANIMATION_LARA_ROLL_END = 148, // Roll, third part > stand (from ANIMATION_LARA_ROLL_CONTINUE) + ANIMATION_LARA_SPIKED = 149, // Impaled on spikes + ANIMATION_LARA_OSCILLATE_HANG_ON = 150, // Grab in mid-air > hang by the hands in free air (swinging forth and back) + ANIMATION_LARA_LANDING_ROLL = 151, // Swan dive > rolling landing + ANIMATION_LARA_FISH_TO_UNDERWATER1 = 152, // Swan dive > shoot through water at sloped angle (at early stage in swan dive) + ANIMATION_LARA_FREE_FALL_FISH = 153, // Swan dive > dive headfirst + ANIMATION_LARA_FISH_TO_UNDERWATER2 = 154, // Swan dive > shoot through water vertically (at later stage in swan dive) + ANIMATION_LARA_FREE_FALL_FISH_TO_DEATH = 155, // Swan dive > die (break neck) + ANIMATION_LARA_START_FLY_LIKE_FISH_LEFT = 156, // Run > swan dive (right foot first) + ANIMATION_LARA_START_FLY_LIKE_FISH_RIGHT = 157, // Run > swan dive (left foot first) + ANIMATION_LARA_FREE_FALL_FISH_START = 158, // Swan dive + ANIMATION_LARA_CLIMB_ON2 = 159, // Hang by the hands > hand stand > stand + ANIMATION_LARA_STAND_TO_LADDER = 160, // Stand in water or under low ceiling > ascend ladder (without the jump and grab) + ANIMATION_LARA_LADDER_UP = 161, // Ascend ladder + ANIMATION_LARA_LADDER_UP_STOP_RIGHT = 162, // Ascend ladder > hang still on ladder (right foot higher) + ANIMATION_LARA_LADDER_UP_STOP_LEFT = 163, // Ascend ladder > hang still on ladder (left foot higher) + ANIMATION_LARA_LADDER_IDLE = 164, // Hang still on ladder + ANIMATION_LARA_LADDER_UP_START = 165, // Hang still on ladder > ascend ladder + ANIMATION_LARA_LADDER_DOWN_STOP_LEFT = 166, // Descend ladder > hang still on ladder (left foot higher) + ANIMATION_LARA_LADDER_DOWN_STOP_RIGHT = 167, // Descend ladder > hang still on ladder (right foot higher) + ANIMATION_LARA_LADDER_DOWN = 168, // Descend ladder + ANIMATION_LARA_LADDER_DOWN_START = 169, // Hang still on ladder > descend ladder + ANIMATION_LARA_LADDER_RIGHT = 170, // Climb sideways right on ladder + ANIMATION_LARA_LADDER_LEFT = 171, // Climb sideways left on ladder + ANIMATION_LARA_LADDER_HANG = 172, // Hang by the hands on ladder + ANIMATION_LARA_LADDER_HANG_TO_IDLE = 173, // Hang by the hands on ladder > gain footing on ladder + ANIMATION_LARA_LADDER_TO_STAND = 174, // Hang still on ladder > pull up > stand + ANIMATION_LARA_UNKNOWN_175 = 175, // ??? > stand still + ANIMATION_LARA_ONWATER_TO_WADE_SHALLOW = 176, // Swim forwards on water surface > wade (the depth change is very small) (?) + ANIMATION_LARA_WADE = 177, // Wade + ANIMATION_LARA_RUN_TO_WADE_LEFT = 178, // Run > wade (left foot first) + ANIMATION_LARA_RUN_TO_WADE_RIGHT = 179, // Run > wade (right foot first) + ANIMATION_LARA_WADE_TO_RUN_LEFT = 180, // Wade > run (left foot first) + ANIMATION_LARA_WADE_TO_RUN_RIGHT = 181, // Wade > run (right foot first) + ANIMATION_LARA_LADDER_BACKFLIP_START = 182, // Hang still on ladder > jump backwards off ladder, first part > ANIMATION_LARA_LADDER_BACKFLIP_END + ANIMATION_LARA_LADDER_BACKFLIP_END = 183, // Jump backwards off ladder, second part > jump backwards (from ANIMATION_LARA_LADDER_BACKFLIP_START) + ANIMATION_LARA_WADE_TO_STAY_RIGHT = 184, // Wade > stand (right foot first) + ANIMATION_LARA_WADE_TO_STAY_LEFT = 185, // Wade > stand (left foot first) + ANIMATION_LARA_STAY_TO_WADE = 186, // Stand > wade + ANIMATION_LARA_LADDER_UP_HANDS = 187, // Hang by the hands on ladder > ascend ladder with the the hands only + ANIMATION_LARA_LADDER_DOWN_HANDS = 188, // Hang by the hands on ladder > descend ladder with the hands only + ANIMATION_LARA_FLARE_THROW = 189, // Throw flare away (standing) + ANIMATION_LARA_ONWATER_TO_WADE_DEEP = 190, // Swim forwards on water surface > wade (the depth transition is greater) (?) + ANIMATION_LARA_ONWATER_TO_LAND_LOW = 191, // Pull out of water (onto ledge even with the water surface) > stand + ANIMATION_LARA_UNDERWATER_TO_WADE = 192, // Swim underwater > stand in shallow water + ANIMATION_LARA_ONWATER_TO_WADE = 193, // Tread water on water surface > stand in shallow water + ANIMATION_LARA_LADDER_TO_HANDS_DOWN = 194, // Hang still on ladder > descend ladder > hang by the hands + ANIMATION_LARA_SWITCH_SMALL_DOWN = 195, // Activate horizontal lever switch (electrical switch) + ANIMATION_LARA_SWITCH_SMALL_UP = 196, // Deactivate horizontal lever switch (electrical switch) + ANIMATION_LARA_BUTTON_PUSH = 197, // Push small button + ANIMATION_LARA_UNDERWATER_SWIM_TO_STILL_HUDDLE = 198, // Stop swimming underwater in deepsea suit (in middle stage of float-swimming animation) > drift underwater (Deepsea Dive) + ANIMATION_LARA_UNDERWATER_SWIM_TO_STILL_SPRAWL = 199, // Stop swimming underwater in deepsea suit (in late stage of float-swimming animation) > drift underwater (Deepsea Dive) + ANIMATION_LARA_UNDERWATER_SWIM_TO_STILL_MEDIUM = 200, // Stop swimming underwater in deepsea suit (in early stage of float-swimming animation) > drift underwater (Deepsea Dive) + ANIMATION_LARA_LADDER_TO_HANDS_RIGHT = 201, // Climb sideways right on ladder > hang by the hands + ANIMATION_LARA_LADDER_TO_HANDS_LEFT = 202, // Climb sideways left on ladder > hang by the hands + ANIMATION_LARA_UNDERWATER_ROLL_BEGIN = 203, // Roll underwater, first part > ANIMATION_LARA_UNDERWATER_ROLL_END + ANIMATION_LARA_FLARE_PICKUP = 204, // Pick up flare from floor while standing (left hand) + ANIMATION_LARA_UNDERWATER_ROLL_END = 205, // Roll underwater, second part > drift underwater (from ANIMATION_LARA_UNDERWATER_ROLL_BEGIN) + ANIMATION_LARA_UNDERWATER_FLARE_PICKUP = 206, // Pick up flare while swimming in deepsea suit (left hand) (Russia-levels) + ANIMATION_LARA_RUNNING_JUMP_ROLL_BEGIN = 207, // Jump forwards with backtwist (after running takeoff), first part > ANIMATION_LARA_RUNNING_JUMP_ROLL_END + ANIMATION_LARA_SOMERSAULT = 208, // Somersault during swan dive + ANIMATION_LARA_RUNNING_JUMP_ROLL_END = 209, // Jump forwards with backtwist (after running takeoff), second part (from ANIMATION_LARA_RUNNING_JUMP_ROLL_BEGIN) + ANIMATION_LARA_STANDING_JUMP_ROLL_BEGIN = 210, // Jump forwards with backtwist (after standing takeoff), first part > ANIMATION_LARA_STANDING_JUMP_ROLL_END + ANIMATION_LARA_STANDING_JUMP_ROLL_END = 211, // Jump forwards with backtwist (after standing takeoff), second part (from ANIMATION_LARA_STANDING_JUMP_ROLL_BEGIN) + ANIMATION_LARA_BACKWARDS_JUMP_ROLL_BEGIN = 212, // Jump backwards with forward twist, first part > ANIMATION_LARA_BACKWARDS_JUMP_ROLL_END + ANIMATION_LARA_BACKWARDS_JUMP_ROLL_END = 213, // Jump backwards with forward twist, second part (from ANIMATION_LARA_BACKWARDS_JUMP_ROLL_BEGIN) + ANIMATION_LARA_TR345_ZIPLINE_GRAB = 214, // Stand > grab zipline + ANIMATION_LARA_TR345_ZIPLINE_RIDE = 215, // Ride zipline + ANIMATION_LARA_TR345_ZIPLINE_FALL = 216, // Fall off zipline + ANIMATION_LARA_TR345_STAND_TO_CROUCH = 217, // Stand > crouch + ANIMATION_LARA_CROUCH_ROLL_FORWARD_BEGIN = 218, // Crouch with right elbow on knee > take off for crouched roll (not used) + ANIMATION_LARA_CROUCH_ROLL_FORWARD_CONTINUE = 219, // Crouched roll (not used) + ANIMATION_LARA_CROUCH_ROLL_FORWARD_END = 220, // Crouched roll > crouch + ANIMATION_LARA_CROUCH_TO_STAND = 221, // Crouch > stand + ANIMATION_LARA_CROUCH_IDLE = 222, // Crouch + ANIMATION_LARA_SPRINT = 223, // Sprint + ANIMATION_LARA_RUN_TO_SPRINT_LEFT = 224, // Run > sprint (left foot first) + ANIMATION_LARA_RUN_TO_SPRINT_RIGHT = 225, // Run > sprint (right foot first) + ANIMATION_LARA_SPRINT_SLIDE_STAND_RIGHT = 226, // Sprint > skidding halt > stand (right foot first) + ANIMATION_LARA_SPRINT_SLIDE_STAND_RIGHT_BETA = 227, // ??? > stand (right foot first) (not used) + ANIMATION_LARA_SPRINT_SLIDE_STAND_LEFT = 228, // Sprint > skidding halt > stand (left foot first) + ANIMATION_LARA_SPRINT_SLIDE_STAND_LEFT_BETA = 229, // ??? > stand (left foot first) (not used) + ANIMATION_LARA_SPRINT_TO_ROLL_LEFT = 230, // Sprint > take off for sprinting roll (left foot first) > ANIMATION_LARA_SPRINT_ROLL_LEFT_TO_RUN + ANIMATION_LARA_SPRINT_TO_ROLL_LEFT_BETA = 231, // Stumbling takeoff for sprinting roll (not used) (?) + ANIMATION_LARA_SPRINT_ROLL_LEFT_TO_RUN = 232, // Sprinting roll > run (from ANIMATION_LARA_SPRINT_TO_ROLL_LEFT) + ANIMATION_LARA_MONKEY_GRAB = 233, // Grab monkey-bars during jump + ANIMATION_LARA_MONKEY_IDLE = 234, // Hang still by the hands in free air (from monkey-bars or wafer thin ledge) + ANIMATION_LARA_MONKEY_FALL = 235, // Hang still by the hands in free air (from monkey-bars or wafer thin ledge) > fall + ANIMATION_LARA_MONKEY_FORWARD = 236, // Monkey-swing forwards + ANIMATION_LARA_MONKEY_STOP_LEFT = 237, // Monkey-swing forwards > hang still from monkey-bars (left hand first) + ANIMATION_LARA_MONKEY_STOP_RIGHT = 238, // Monkey-swing forwards > hang still from monkey-bars (right hand first) + ANIMATION_LARA_MONKEY_IDLE_TO_FORWARD_LEFT = 239, // Hang still from monkey-bars > monkey-swing forwards (left hand moved first) + ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_BEGIN = 240, // Sprint > take off for sprinting roll, first part (not used) (?) > ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_CONTINUE + ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_CONTINUE = 241, // Take off for sprinting roll, second part (not used) (?) (from ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_BEGIN) > ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_END + ANIMATION_LARA_SPRINT_TO_ROLL_ALTERNATE_END = 242, // Sprinting roll > run (not used) (?) + ANIMATION_LARA_SPRINT_TO_RUN_LEFT = 243, // Sprint > run (left foot first) + ANIMATION_LARA_SPRINT_TO_RUN_RIGHT = 244, // Sprint > run (right foot first) + ANIMATION_LARA_CROUCH_PREPARE = 245, // 'Springy' crouch (used as a link to and from crouching animations) + ANIMATION_LARA_SLIDE_FORWARD_TO_RUN = 246, // Slide forwards down steep slope (3 clicks high) > stumbling landing > run + ANIMATION_LARA_CROUCH_ROLL_FORWARD_BEGIN_ALTERNATE = 247, // Crouch > take off for crouching roll (not used) + ANIMATION_LARA_JUMP_FORWARD_BEGIN_TO_GRAB = 248, // Jump forwards > grab (at early stage during jump) + ANIMATION_LARA_JUMP_FORWARD_END_TO_GRAB = 249, // Jump forwards > grab (at middle stage during jump) + ANIMATION_LARA_RUN_TO_GRAB_RIGHT = 250, // Grab during running takeoff (right foot first) (?) + ANIMATION_LARA_RUN_TO_GRAB_LEFT = 251, // Grab during running takeoff (left foot first) (?) + ANIMATION_LARA_MONKEY_IDLE_TO_FORWARD_RIGHT = 252, // Hang still from monkey-bars > monkey-swing forwards (right hand moved first) + ANIMATION_LARA_MONKEY_STRAFE_LEFT = 253, // Shimmy left + ANIMATION_LARA_MONKEY_STRAFE_LEFT_END = 254, // Shimmy (left) > hang still by the hands (?) + ANIMATION_LARA_MONKEY_STRAFE_RIGHT = 255, // Shimmy right + ANIMATION_LARA_MONKEY_STRAFE_RIGHT_END = 256, // Shimmy (right) > hang still by the hands (not used) (?) + ANIMATION_LARA_MONKEY_TURN_AROUND = 257, // Turn around at the spot while hanging from monkey-bars (not used) (?) + ANIMATION_LARA_CROUCH_TO_CRAWL_BEGIN = 258, // Crouch > crawl position, first part > ANIMATION_LARA_CROUCH_TO_CRAWL_CONTINUE + ANIMATION_LARA_CRAWL_TO_CROUCH_BEGIN = 259, // Crawl position > crouch, first part > ANIMATION_LARA_CRAWL_TO_CROUCH_END + ANIMATION_LARA_CRAWL_FORWARD = 260, // Crawl forwards + ANIMATION_LARA_CRAWL_IDLE_TO_FORWARD = 261, // Crawl position > crawl forwards + ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_BEGIN_RIGHT = 262, // Crawl forwards > crawl position, first part (right foot first) > ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_END_RIGHT + ANIMATION_LARA_CRAWL_IDLE = 263, // Crawl position + ANIMATION_LARA_CROUCH_TO_CRAWL_END = 264, // Crouch > crawl position, third part (from ANIMATION_LARA_CROUCH_TO_CRAWL_CONTINUE) + ANIMATION_LARA_CROUCH_IDLE_SMASH = 265, // 'Slightly springy' crouch (not used?) + ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_END_RIGHT = 266, // Crawl forwards > crawl position, second part (from ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_BEGIN_RIGHT) + ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_BEGIN_LEFT = 267, // Crawl forwards > crawl position, first part (left foot first) > ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_END_LEFT + ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_END_LEFT = 268, // Crawl forwards > crawl positon, second part (from ANIMATION_LARA_CRAWL_FORWARD_TO_IDLE_BEGIN_LEFT) + ANIMATION_LARA_CRAWL_TURN_LEFT = 269, // Crawl position > turn left crawling + ANIMATION_LARA_CRAWL_TURN_RIGHT = 270, // Crawl position > turn right crawling + ANIMATION_LARA_MONKEY_TURN_LEFT = 271, // Hang still from monkey-bars > turn left hanging from monkey-bars + ANIMATION_LARA_MONKEY_TURN_RIGHT = 272, // Hang still from monkey-bars > turn right hanging from monkey-bars + ANIMATION_LARA_CROUCH_TO_CRAWL_CONTINUE = 273, // Crouch > crawl position, second part (from ANIMATION_LARA_CROUCH_TO_CRAWL_BEGIN) > ANIMATION_LARA_CROUCH_TO_CRAWL_END + ANIMATION_LARA_CRAWL_TO_CROUCH_END = 274, // Crawl position > crouch, second part (from ANIMATION_LARA_CRAWL_TO_CROUCH_BEGIN) + ANIMATION_LARA_CRAWL_IDLE_TO_BACKWARD = 275, // Crawl > crawl backwards + ANIMATION_LARA_CRAWL_BACKWARD = 276, // Crawl backwards + ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_BEGIN_RIGHT = 277, // Crawl backwards > crawl position, first part (right foot moved first) > ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_END_RIGHT + ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_END_RIGHT = 278, // Crawl backwards > crawl position, second part (from ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_BEGIN_RIGHT) + ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_BEGIN_LEFT = 279, // Crawl backwards > crawl position, first part (left foot moved first) > ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_END_LEFT + ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_END_LEFT = 280, // Crawl backwards > crawl position, second part (from ANIMATION_LARA_CRAWL_BACKWARD_TO_IDLE_BEGIN_LEFT) + ANIMATION_LARA_CRAWL_TURN_LEFT_END = 281, // Turn left crawling > crawl position + ANIMATION_LARA_CRAWL_TURN_RIGHT_END = 282, // Turn right crawling > crawl position + ANIMATION_LARA_MONKEY_TURN_LEFT_EARLY_END = 283, // Turn left hanging from monkey-bars > hang still from monkey-bars (at early stage during turn) + ANIMATION_LARA_MONKEY_TURN_LEFT_LATE_END = 284, // Turn left hanging from monkey-bars > hang still from monkey-bars (at late stage during turn) + ANIMATION_LARA_MONKEY_TURN_RIGHT_EARLY_END = 285, // Turn right hanging from monkey-bars > hang still from monkey-bars (early stage during turn) + ANIMATION_LARA_MONKEY_TURN_RIGHT_LATE_END = 286, // Turn right hanging from monkey-bars > hang still from monkey-bars (at late stage during turn) + ANIMATION_LARA_HANG_TO_CROUCH_BEGIN = 287, // Hang by the hands > pull up > crouch, first part > ANIMATION_LARA_HANG_TO_CROUCH_END + ANIMATION_LARA_HANG_TO_CROUCH_END = 288, // Crouch, second part (after pulling up from hanging by the hands) (from ANIMATION_LARA_HANG_TO_CROUCH_BEGIN) + ANIMATION_LARA_CRAWL_TO_HANG_BEGIN = 289, // Crawl position > climb down > hang by the hands, first part >ANIMATION_LARA_CRAWL_TO_HANG_CONTINUE + ANIMATION_LARA_CRAWL_TO_HANG_CONTINUE = 290, // Hang by the hands, second part (after climbing down from crawl position) (from ANIMATION_LARA_CRAWL_TO_HANG_BEGIN) > ANIMATION_LARA_CRAWL_TO_HANG_END + ANIMATION_LARA_CROUCH_PICKUP = 291, // Crouching pickup (right hand) + ANIMATION_LARA_CRAWL_PICKUP = 292, // Crawling pickup (not used) + ANIMATION_LARA_CROUCH_SMASH_FORWARD = 293, // Jerk forwards hurt (chrouching) + ANIMATION_LARA_CROUCH_SMASH_BACKWARD = 294, // Jerk backwards hurt (chrouching) + ANIMATION_LARA_CROUCH_SMASH_RIGHT = 295, // Jerk right hurt (chrouching) + ANIMATION_LARA_CROUCH_SMASH_LEFT = 296, // Jerk left hurt (chrouching) + ANIMATION_LARA_CRAWL_SMASH_FORWARD = 297, // Jerk forwards hurt (crawling) + ANIMATION_LARA_CRAWL_SMASH_BACKWARD = 298, // Jerk backwards hurt (crawling) + ANIMATION_LARA_CRAWL_SMASH_RIGHT = 299, // Jerk right hurt (crawling) + ANIMATION_LARA_CRAWL_SMASH_LEFT = 300, // Jerk left hurt (crawling) + ANIMATION_LARA_CRAWL_DEATH = 301, // Crawl > die + ANIMATION_LARA_CRAWL_TO_HANG_END = 302, // Hang by the hands (after climbing down from crawl position), third part (from ANIMATION_LARA_CRAWL_TO_HANG_CONTINUE) + ANIMATION_LARA_CROUCH_ABORT = 303, // About to crouch > stand (cancelling a stand > crouch command) + ANIMATION_LARA_RUN_TO_CROUCH_LEFT_BEGIN = 304, // Run > crouch, first part (left foot first) > ANIMATION_LARA_RUN_TO_CROUCH_LEFT_END + ANIMATION_LARA_RUN_TO_CROUCH_RIGHT_BEGIN = 305, // Run > crouch, first part (right foot first) > ANIMATION_LARA_RUN_TO_CROUCH_RIGHT_END + ANIMATION_LARA_RUN_TO_CROUCH_LEFT_END = 306, // Crouch, second part (after running) > crouch (from ANIMATION_LARA_RUN_TO_CROUCH_LEFT_BEGIN) + ANIMATION_LARA_RUN_TO_CROUCH_RIGHT_END = 307, // Crouch, second part (after running) > crouch (from ANIMATION_LARA_RUN_TO_CROUCH_RIGHT_BEGIN) + ANIMATION_LARA_SPRINT_TO_ROLL_RIGHT = 308, // Sprint > take off for sprinting roll (right foot first) > ANIMATION_LARA_SPRINT_ROLL_RIGHT_TO_RUN + ANIMATION_LARA_SPRINT_ROLL_RIGHT_TO_RUN = 309, // Sprinting roll > run (from ANIMATION_LARA_SPRINT_TO_ROLL_RIGHT) + ANIMATION_LARA_SPRINT_TO_CROUCH_LEFT = 310, // Sprint > small roll > crouch (left foot first) + ANIMATION_LARA_SPRINT_TO_CROUCH_RIGHT = 311, // Sprint > small roll > crouch (right foot first) + ANIMATION_LARA_CROUCH_PICKUP_FLARE = 312, // Pick up flare while crouching (left hand) + ANIMATION_LARA_DOOR_OPEN_FORWARD = 313, // Use doorknob to open door and push it open + ANIMATION_LARA_DOOR_OPEN_BACK = 314, // Use doorknob to open door and pull it open + ANIMATION_LARA_DOOR_KICK = 315, // Kick door open + ANIMATION_LARA_GIANT_BUTTON_PUSH = 316, // Push Sequence button + ANIMATION_LARA_FLOOR_TRAPDOOR_OPEN = 317, // Open trapdoor in floor + ANIMATION_LARA_CEILING_TRAPDOOR_OPEN = 318, // Grab (after upward jump) and open trapdoor in ceiling* + ANIMATION_LARA_ROUND_HANDLE_GRAB_CLOCKWISE = 319, // Stand > grab turn handle (clockwise) + ANIMATION_LARA_ROUND_HANDLE_GRAB_COUNTERCLOCKWISE = 320, // Stand > grab turn handle (counter-clockwise) + ANIMATION_LARA_COGWHEEL_PULL = 321, // Pull cog wheel + ANIMATION_LARA_COGWHEEL_GRAB = 322, // Stand > grab cog wheel + ANIMATION_LARA_COGWHEEL_UNGRAB = 323, // Let go of cog wheel > stand + ANIMATION_LARA_LEVERSWITCH_PUSH = 324, // Use lever switch + ANIMATION_LARA_HOLE_GRAB = 325, // Use hole-in-wall switch/pickup + ANIMATION_LARA_STAY_TO_POLE_GRAB = 326, // Stand > climb onto vertical pole + ANIMATION_LARA_POLE_JUMP = 327, // Jump off vertical pole + ANIMATION_LARA_POLE_IDLE = 328, // Hang still on vertical pole + ANIMATION_LARA_POLE_CLIMB_UP = 329, // Climb vertical pole + ANIMATION_LARA_POLE_FALL = 330, // Hang still on vertical pole > fall + ANIMATION_LARA_JUMP_FORWARD_TO_POLE_GRAB = 331, // Jump forwards > grab and climb onto vertical pole + ANIMATION_LARA_POLE_TURN_LEFT_BEGIN = 332, // Hang still on vertical pole > turn clockwise on vertical pole + ANIMATION_LARA_POLE_TURN_RIGHT_BEGIN = 333, // Hang still on vertical pole > turn counter-clockwise on vertical pole + ANIMATION_LARA_POLE_IDLE_TO_CLIMB_DOWN = 334, // Hang still on vertical pole > slide down vertical pole + ANIMATION_LARA_POLE_CLIMB_DOWN = 335, // Slide down vertical pole + ANIMATION_LARA_POLE_CLIMB_DOWN_TO_IDLE = 336, // Slide down vertical pole > hang still on vertical pole + ANIMATION_LARA_JUMP_UP_TO_POLE_GRAB = 337, // Jump upwards > grab and climb onto vertical pole + ANIMATION_LARA_POLE_CLIMB_UP_INBETWEEN = 338, // Climb vertical pole > hang still on vertical pole + ANIMATION_LARA_PULLEY_GRAB = 339, // Stand > grab pulley + ANIMATION_LARA_PULLEY_PULL = 340, // Pull pulley + ANIMATION_LARA_PULLEY_UNGRAB = 341, // Let go of pulley + ANIMATION_LARA_POLE_GRAB_TO_STAY = 342, // Hang still on vertical pole > put feet on floor > stand + ANIMATION_LARA_POLE_TURN_LEFT = 343, // Turn clockwise on vertical pole (not used?) + ANIMATION_LARA_POLE_TURN_LEFT_END = 344, // Turn clockwise on vertical pole > hang still on vertical pole + ANIMATION_LARA_POLE_TURN_RIGHT = 345, // Turn counter-clockwise on vertical pole (not used?) + ANIMATION_LARA_POLE_TURN_RIGHT_END = 346, // Turn counter-clockwise on vertical pole > hang still on vertical pole + ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_BEGIN = 347, // Push turn handle (clockwise), first part > ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_CONTINUE + ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_CONTINUE = 348, // Push turn handle (clockwise), second part (from ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_BEGIN) + ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_END = 349, // Push turn handle (clockwise) > stand + ANIMATION_LARA_ROUND_HANDLE_PUSH_LEFT_BEGIN = 350, // Push turn handle (counter-clockwise), first part > ANIMATION_LARA_ROUND_HANDLE_PUSH_LEFT_BEGIN + ANIMATION_LARA_ROUND_HANDLE_PUSH_LEFT_CONTINUE = 351, // Push turn handle (counter-clockwise), second part (from ANIMATION_LARA_ROUND_HANDLE_PUSH_RIGHT_END) + ANIMATION_LARA_ROUND_HANDLE_PUSH_LEFT_END = 352, // Push turn handle (counter-clockwise) > stand + ANIMATION_LARA_CROUCH_TURN_LEFT = 353, // Crouch > turn left crouching + ANIMATION_LARA_CROUCH_TURN_RIGHT = 354, // Crouch > turn right crouching + ANIMATION_LARA_HANG_AROUND_LEFT_OUTER_BEGIN = 355, // Shimmy around left outer corner, first part > ANIMATION_LARA_HANG_AROUND_LEFT_OUTER_END + ANIMATION_LARA_HANG_AROUND_LEFT_OUTER_END = 356, // Shimmy around left outer corner, second part (from ANIMATION_LARA_HANG_AROUND_LEFT_OUTER_BEGIN) + ANIMATION_LARA_HANG_AROUND_RIGHT_OUTER_BEGIN = 357, // Shimmy around right outer corner, first part > ANIMATION_LARA_HANG_AROUND_RIGHT_OUTER_END + ANIMATION_LARA_HANG_AROUND_RIGHT_OUTER_END = 358, // Shimmy around right outer corner, second part (from ANIMATION_LARA_HANG_AROUND_RIGHT_OUTER_BEGIN) + ANIMATION_LARA_HANG_AROUND_LEFT_INNER_BEGIN = 359, // Shimmy around left inner corner, first part > ANIMATION_LARA_HANG_AROUND_LEFT_INNER_END + ANIMATION_LARA_HANG_AROUND_LEFT_INNER_END = 360, // Shimmy around left inner corner, second part (from ANIMATION_LARA_HANG_AROUND_LEFT_INNER_BEGIN) + ANIMATION_LARA_HANG_AROUND_RIGHT_INNER_BEGIN = 361, // Shimmy around right inner corner, first part > ANIMATION_LARA_HANG_AROUND_RIGHT_INNER_END + ANIMATION_LARA_HANG_AROUND_RIGHT_INNER_END = 362, // Shimmy around right inner corner, second part (from ANIMATION_LARA_HANG_AROUND_RIGHT_INNER_BEGIN) + ANIMATION_LARA_LADDER_AROUND_LEFT_OUTER_BEGIN = 363, // Climb sideways on ladder around left outer corner, first part > ANIMATION_LARA_LADDER_AROUND_LEFT_OUTER_END + ANIMATION_LARA_LADDER_AROUND_LEFT_OUTER_END = 364, // Climb sideways on ladder around left outer corner, second part (from ANIMATION_LARA_LADDER_AROUND_LEFT_OUTER_BEGIN) + ANIMATION_LARA_LADDER_AROUND_RIGHT_OUTER_BEGIN = 365, // Climb sideways on ladder around right outer corner, first part > ANIMATION_LARA_LADDER_AROUND_RIGHT_OUTER_END + ANIMATION_LARA_LADDER_AROUND_RIGHT_OUTER_END = 366, // Climb sideways on ladder around right outer corner, second part (from ANIMATION_LARA_LADDER_AROUND_RIGHT_OUTER_BEGIN) + ANIMATION_LARA_LADDER_AROUND_LEFT_INNER_BEGIN = 367, // Climb sideways on ladder around left inner corner, first part > ANIMATION_LARA_LADDER_AROUND_LEFT_INNER_END + ANIMATION_LARA_LADDER_AROUND_LEFT_INNER_END = 368, // Climb sideways on ladder around left inner corner, second part (from ANIMATION_LARA_LADDER_AROUND_LEFT_INNER_BEGIN) + ANIMATION_LARA_LADDER_AROUND_RIGHT_INNER_BEGIN = 369, // Climb sideways on ladder around right inner corner, first part > ANIMATION_LARA_LADDER_AROUND_RIGHT_INNER_END + ANIMATION_LARA_LADDER_AROUND_RIGHT_INNER_END = 370, // Climb sideways on ladder around right inner corner, second part (from ANIMATION_LARA_LADDER_AROUND_RIGHT_INNER_BEGIN) + ANIMATION_LARA_MONKEY_TO_ROPE_BEGIN = 371, // Hang from monkey-bars/jump upwards > grab rope (?) + ANIMATION_LARA_TRAIN_DEATH = 372, // Fall off train > die + ANIMATION_LARA_MONKEY_TO_ROPE_END = 373, // Loose momentum on rope > wrap legs around rope > hang still on rope + ANIMATION_LARA_ROPE_IDLE = 374, // Hang still on rope + ANIMATION_LARA_ROPE_DOWN_BEGIN = 375, // Hang still on rope > slide down rope + ANIMATION_LARA_ROPE_UP = 376, // Climb rope + ANIMATION_LARA_ROPE_IDLE_TO_SWING_SOFT = 377, // Hang still on rope > begin to swing with still some momentum left (no kick necessary)(?) + ANIMATION_LARA_ROPE_GRAB_TO_FALL = 378, // Have just grabbed rope > fall (?) + ANIMATION_LARA_ROPE_JUMP_TO_GRAB = 379, // Jump forwards > grab rope + ANIMATION_LARA_ROPE_IDLE_TO_BACKFLIP = 380, // Somersault from rope to ledge? (not used) + ANIMATION_LARA_ROPE_SWING_TO_FALL_SEMIFRONT = 381, // Swing on rope > fall (when Lara is in the fore end of the swing - haft past four o'clock)(?) + ANIMATION_LARA_ROPE_SWING_TO_FALL_MIDDLE = 382, // Swing on rope> fall (when Lara is in the middle of the swing) (?) + ANIMATION_LARA_ROPE_SWING_TO_FALL_BACK = 383, // Swing on rope > fall (when Lara is in the back end of the swing) (?) + ANIMATION_LARA_ROPE_DOWN = 384, // Slide down rope + ANIMATION_LARA_ROPE_DOWN_TO_IDLE = 385, // Slide down rope > hang still on rope + ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_BACK = 386, // Swing on rope > jump off to grab ledge (when Lara is in the back end of the swing) + ANIMATION_LARA_ROPE_IDLE_TO_SWING = 387, // Hang still on rope > give a kick to gain momentum to swing (begin to swing) + ANIMATION_LARA_ROPE_IDLE_TO_SWING_SEMIMIDDLE = 388, // Swing on rope> fall (when Lara is just before the middle of the swing - 7 o'clock) (?) + ANIMATION_LARA_ROPE_IDLE_TO_SWING_HALFMIDDLE = 389, // Swing on rope> fall (when Lara is just before the middle of the swing - half past six o'clock) (?) + ANIMATION_LARA_ROPE_SWING_TO_FALL_FRONT = 390, // Swing on rope > fall (when Lara is in the fore end of the swing - 5 o'clock) (?) + ANIMATION_LARA_ROPE_GRAB_TO_FALL_ALTERNATE = 391, // Have just grabbed rope > fall (same animation as ANIMATION_LARA_ROPE_GRAB_TO_FALL?) (?) + ANIMATION_LARA_ROPE_TURN_CLOCKWISE = 392, // Turn clockwise on rope + ANIMATION_LARA_ROPE_TURN_COUNTER_CLOCKWISE = 393, // Turn counter-clockwise on rope + ANIMATION_LARA_ROPE_SWING_FORWARD_SEMIHARD = 394, // Swing forwards on rope with much momentum + ANIMATION_LARA_ROPE_LADDER_TO_HANDS_DOWN_ALTERNATE = 395, // Hang still on ladder > abandon footing > hang by the hands alone (not used) (?) + ANIMATION_LARA_ROPE_SWING_BACK_CONTINUE = 396, // Swing backwards on rope, second part (from ANIMATION_LARA_ROPE_SWING_BACK_BEGIN) > ANIMATION_LARA_ROPE_SWING_BACK_END + ANIMATION_LARA_ROPE_SWING_BACK_END = 397, // Swing backwards on rope, third part (from ANIMATION_LARA_ROPE_SWING_BACK_CONTINUE) + ANIMATION_LARA_ROPE_SWING_BACK_BEGIN = 398, // Swing backwards on rope, first part > ANIMATION_LARA_ROPE_SWING_BACK_CONTINUE + ANIMATION_LARA_ROPE_SWING_FORWARD_SOFT = 399, // Swing forwards on rope with little momentum (?) + ANIMATION_LARA_WATERSKIN_EMPTY = 400, // Empty waterskin + ANIMATION_LARA_WATERSKIN_FILL = 401, // Fill waterskin + ANIMATION_LARA_WATERSKIN_POUR_ON_SCALE = 402, // Pour waterskin on scale + ANIMATION_LARA_DOOR_OPEN_CROWBAR = 403, // Open door with crowbar + ANIMATION_LARA_ROPE_SWING_FORWARD_HARD = 404, // Reach fore end of swing on rope with very much momentum + ANIMATION_LARA_ROPE_CHANGE_ROPE = 405, // Swing on rope and grab a new rope? (not used?) + ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_FRONT2 = 406, // Swing on rope > jump off to grab ledge (when Lara is in the fore end of the swing - 4 o'clock) + ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_MIDDLE = 407, // Swing on rope > jump off to grab ledge (when Lara is right in the middle of the swing) + ANIMATION_LARA_ROPE_SWING_BLOCK = 408, // Swing forth and back with almost no momentum (Lara is too high on the rope?) + ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_SEMIMIDDLE = 409, // Swing on rope > jump off to grab ledge (when Lara is just before the middle of the swing) + ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_FRONT3 = 410, // Swing on rope > jump off to grab ledge (when Lara is in the fore end of the swing - 5 o'clock) + ANIMATION_LARA_ROPE_SWING_TO_TRY_HANG_FRONT1 = 411, // Swing on rope > jump off to grab ledge (when Lara is in the fore end of the swing - 3 o'clock) + ANIMATION_LARA_DOUBLEDOORS_PUSH = 412, // Push double doors + ANIMATION_LARA_BIG_BUTTON_PUSH = 413, // Push big button + ANIMATION_LARA_JUMPSWITCH = 414, // Pull jumpswitch + ANIMATION_LARA_UNDERWATER_PULLEY = 415, // Pull underwater switch in the ceiling + ANIMATION_LARA_UNDERWATER_DOOR_OPEN = 416, // Open underwater_door + ANIMATION_LARA_PUSHABLE_PUSH_TO_STAND = 417, // Push pushable > stand + ANIMATION_LARA_PUSHABLE_PULL_TO_STAND = 418, // Pull pushable > stand + ANIMATION_LARA_CROWBAR_USE_ON_WALL = 419, // Use crowbar to get puzzle item from wall + ANIMATION_LARA_CROWBAR_USE_ON_FLOOR = 420, // Use crowbar to activate broken leverswitch (Desert Railroad) + ANIMATION_LARA_CRAWL_JUMP_DOWN = 421, // Roll forwards out of crawlspace (not used) + ANIMATION_LARA_HARP_PLAY = 422, // Play harp (The Lost Library) + ANIMATION_LARA_PUT_TRIDENT = 423, // Place trident on Poseidon statue (Temple of Poseidon) + ANIMATION_LARA_PICKUP_PEDESTAL_HIGH = 424, // Standing pickup from high pedestal (Lara's height) + ANIMATION_LARA_PICKUP_PEDESTAL_LOW = 425, // Standing pickup from low pedestal (waist-height) + ANIMATION_LARA_ROTATE_SENET = 426, // Play game of senet (Tomb of Semerkhet) + ANIMATION_LARA_TORCH_LIGHT_1 = 427, // Light torch with flame 0-1 clicks high + ANIMATION_LARA_TORCH_LIGHT_2 = 428, // Light torch with flame 2-3 clicks high + ANIMATION_LARA_TORCH_LIGHT_3 = 429, // Light torch with flame 4-5 clicks high + ANIMATION_LARA_TORCH_LIGHT_4 = 430, // Light torch with flame 6-7 clicks high + ANIMATION_LARA_TORCH_LIGHT_5 = 431, // Light torch with flame higher than 7 clicks + ANIMATION_LARA_DETONATOR_USE = 432, // use mine detector + ANIMATION_LARA_CORRECT_POSITION_FRONT = 433, // Small steps forward to correct Lara's position (hardcoded, used to put line up Lara in front of switches and puzzles) + ANIMATION_LARA_CORRECT_POSITION_LEFT = 434, // Small steps to the left to corrcts Lara's position + ANIMATION_LARA_CORRECT_POSITION_RIGHT = 435, // Small steps to the right to correct Lara's position + ANIMATION_LARA_CROWBAR_USE_ON_FLOOR_FAIL = 436, // Use crowbar to break train link? (not used) + ANIMATION_LARA_USE_KEYCARD = 437, // Use swipe card + ANIMATION_LARA_DEATH_BLOWUP = 438, // Blown up by mine + ANIMATION_LARA_PICKUP_SARCOPHAGUS = 439, // Pickup from sarcophagus + ANIMATION_LARA_DRAG = 440, // Dragging dead body (City of the Dead) + ANIMATION_LARA_BINOCULARS = 441, // Look through binoculars (not used) + ANIMATION_LARA_DEATH_BIG_SCORPION = 442, // Picked up and tossed away by big scorpion + ANIMATION_LARA_ELEVATOR_RECOVER = 443, // Lara painfully gets to her feet after fall in elevator (VCI-levels) + ANIMATION_LARA_BEETLE_PUT = 444, // Wind up beetle > put beetle on floor + ANIMATION_LARA_DOZY = 445, // DOZY Animation + ANIMATION_LARA_TIGHTROPE_WALK = 446, // Walk on tightrope + ANIMATION_LARA_TIGHTROPE_WALK_TO_STAND = 447, // Walk on tightrope > stand on tightrope + ANIMATION_LARA_TIGHTROPE_STAND = 448, // Stand on tightrope + ANIMATION_LARA_TIGHTROPE_WALK_TO_STAND_CAREFUL = 449, // Walk on tightrope > tread carefully > stand on tightrope + ANIMATION_LARA_TIGHTROPE_STAND_TO_WALK = 450, // Stand on tightrope > walk on tightrope + ANIMATION_LARA_TIGHTROPE_TURN = 451, // Turn around on tightrope + ANIMATION_LARA_TIGHTROPE_LOOSE_LEFT = 452, // Stand on tightrope > loose balance and lean left + ANIMATION_LARA_TIGHTROPE_RECOVER_LEFT = 453, // Lean left on tightrope > regain balance and stand on tightrope + ANIMATION_LARA_TIGHTROPE_FALL_LEFT = 454, // Fall off tightrope (to the left) + ANIMATION_LARA_TIGHTROPE_LOOSE_RIGHT = 455, // Stand on tightrope > loose balance and lean right + ANIMATION_LARA_TIGHTROPE_RECOVER_RIGHT = 456, // Lean right on tightrope > regain balance and stand on tightrope + ANIMATION_LARA_TIGHTROPE_FALL_RIGHT = 457, // Fall off tightrope (to the right) + ANIMATION_LARA_TIGHTROPE_START = 458, // Stand > walk out on tightrope + ANIMATION_LARA_TIGHTROPE_FINISH = 459, // Walk off tightrope > stand + ANIMATION_LARA_DOVESWITCH_TURN = 460, // Examine and turn doveswitch (Rome-levels) + ANIMATION_LARA_BARS_GRAB = 461, // Jump forwards > grab horizontal pole + ANIMATION_LARA_BARS_SWING = 462, // Swing around horizontal pole + ANIMATION_LARA_BARS_JUMP = 463, // Jump off horizontal pole + ANIMATION_LARA_LOOT_CABINET = 464, // Open cabinet and search it + ANIMATION_LARA_LOOT_DRAWER = 465, // Open drawer and search it + ANIMATION_LARA_LOOT_SHELF = 466, // Search shelves + ANIMATION_LARA_RADIO_BEGIN = 467, // Stand > put hand to headgear to listen (VCI-levels) + ANIMATION_LARA_RADIO_IDLE = 468, // Hold hand on headgear and listen (VCI-levels) + ANIMATION_LARA_RADIO_END = 469, // Remove hand from headgear > stand (VCI-levels) + ANIMATION_LARA_VALVE_TURN = 470, // Turn valve wheel + ANIMATION_LARA_CROWBAR_USE_ON_WALL2 = 471, // Pull object off wall (to use as crowbar) + ANIMATION_LARA_LOOT_CHEST = 472, // Kneel to open box and pick up item (VCI-levels) + ANIMATION_LARA_LADDER_TO_CROUCH = 473, // Climb wall > pull up in crawlspace + ANIMATION_LARA_1CLICK_CRAWL_VAULT = 474, // 1 click crawlspace vault + ANIMATION_LARA_2CLICK_CRAWL_VAULT = 475, // 2 click crawlspace vault + ANIMATION_LARA_3CLICK_CRAWL_VAULT = 476, // 3 click crawlspace vault + ANIMATION_LARA_1CLICK_CRAWL_EXIT = 477, // 1 click crawlspace exit + ANIMATION_LARA_2CLICK_CRAWL_EXIT = 478, // 2 click crawlspace exit + ANIMATION_LARA_1CLICK_CRAWL_TO_CRAWL_UP = 479, // maneuver up 1 click in crawlspace + ANIMATION_LARA_1CLICK_CRAWL_TO_CRAWL_DOWN = 480, // maneuver down 1 click in crawlspace + ANIMATION_LARA_CLIMB_OUT_OF_WATER_TO_2CLICK = 481, // climb out of water to 2click crawlspace + ANIMATION_LARA_ONWATER_TO_LAND_LOW_TO_2CLICK = 482, // climb out of onwater to 2click crawlspace + ANIMATION_LARA_WATER_TO_SUBMERGED_CRAWL = 483, // wade out of water to submerged crawlspace + ANIMATION_LARA_HANG_FEET = 484, // hang with feet supporting her + ANIMATION_LARA_HANG_FEET_SHIMMYR = 485, // shimmy right with feet on wall + ANIMATION_LARA_HANG_FEET_SHIMMYL = 486, // shimmy left with feet on wall + ANIMATION_LARA_HANG_FEET_CLIMB = 487, // feet hang -> climb + ANIMATION_LARA_HANG_FEET_IDLE = 488, // hang feet idle anim for shimmies/climbups + ANIMATION_LARA_HANG_FEET_CLIMB_TO_CROUCH = 489, // hang feet crouch climb + ANIMATION_LARA_HANG_FEET_IN_RCORNER = 490, // hang feet shimmy around inner right corner + ANIMATION_LARA_HANG_FEET_IN_LCORNER = 491, // hang feet shimmy around inner left corner + ANIMATION_LARA_HANG_FEET_OUT_RCORNER = 492, // hang feet shimmy around outer right corner + ANIMATION_LARA_HANG_FEET_OUT_LCORNER = 493, // hang feet shimmy around outer left corner + + NUM_LARA_ANIMS +}; +#pragma endregion + +typedef enum LARA_WATER_STATUS +{ + LW_ABOVE_WATER, + LW_UNDERWATER, + LW_SURFACE, + LW_FLYCHEAT, + LW_WADE +}; + +typedef enum LARA_GUN_STATUS +{ + LG_NO_ARMS, + LG_HANDS_BUSY, + LG_DRAW_GUNS, + LG_UNDRAW_GUNS, + LG_READY, + LG_SPECIAL +}; + +typedef enum WeaponAmmoType +{ + WEAPON_AMMO1, + WEAPON_AMMO2, + WEAPON_AMMO3, + MAX_AMMOTYPE +}; + +typedef enum LARA_MESHES +{ + LM_HIPS, + LM_LTHIGH, + LM_LSHIN, + LM_LFOOT, + LM_RTHIGH, + LM_RSHIN, + LM_RFOOT, + LM_TORSO, + LM_RINARM, + LM_ROUTARM, + LM_RHAND, + LM_LINARM, + LM_LOUTARM, + LM_LHAND, + LM_HEAD, + NUM_LARA_MESHES +}; + +typedef enum LARA_WEAPON_TYPE +{ + WEAPON_NONE, + WEAPON_PISTOLS, + WEAPON_REVOLVER, + WEAPON_UZI, + WEAPON_SHOTGUN, + WEAPON_HK, + WEAPON_CROSSBOW, + WEAPON_FLARE, + WEAPON_TORCH, + WEAPON_GRENADE_LAUNCHER, + WEAPON_HARPOON_GUN, + WEAPON_ROCKET_LAUNCHER, + WEAPON_SNOWMOBILE, + NUM_WEAPONS +}; + +typedef enum LARA_WEAPON_TYPE_CARRIED +{ + WTYPE_MISSING = 0x0, + WTYPE_PRESENT = 0x1, + WTYPE_SILENCER = 0x2, + WTYPE_LASERSIGHT = 0x4, + WTYPE_AMMO_1 = 0x8, + WTYPE_AMMO_2 = 0x10, + WTYPE_AMMO_3 = 0x20, + WTYPE_MASK_AMMO = WTYPE_AMMO_1 | WTYPE_AMMO_2 | WTYPE_AMMO_3, +}; + +typedef enum LARA_CLOTH_TYPES +{ + CLOTH_MISSING, + CLOTH_DRY, + CLOTH_WET +}; + +typedef struct CarriedWeaponInfo +{ + bool Present; + short Ammo[MAX_AMMOTYPE]; + int SelectedAmmo; // WeaponAmmoType_enum + bool HasLasersight; + bool HasSilencer; +}; + +typedef struct DiaryInfo +{ + bool Present; +}; + +typedef struct WaterskinInfo +{ + bool Present; + int Quantity; +}; + +typedef struct LARA_ARM +{ + short* frameBase; + short frameNumber; + short animNumber; + bool lock; + short yRot; + short xRot; + short zRot; + short flash_gun; +}; + +typedef struct LaraInfo +{ + short itemNumber; + short gunStatus; // LG_enum + short gunType; // WEAPON_enum + short requestGunType; // WEAPON_enum + short lastGunType; // WEAPON_enum + short calcFallSpeed; + short waterStatus; // LW_enum + short climbStatus; + short poseCount; + short hitFrame; + short hitDirection; + short air; + short diveCount; + short deathCount; + short currentActive; + short currentXvel; + short currentYvel; + short currentZvel; + short spazEffectCount; + short flareAge; + short burnCount; + short weaponItem; + short backGun; + short flareFrame; + short poisoned; + short dpoisoned; + short electric; // used for electric value in TR3 + byte anxiety; + byte wet[NUM_LARA_MESHES]; + bool flareControlLeft; + bool flareControlRight; // not used + bool look; + bool burn; + bool keepDucked; + bool isMoving; + bool canMonkeySwing; + byte burnBlue; + bool gassed; + bool burnSmoke; + bool isDucked; + bool hasFired; + bool busy; + bool litTorch; + bool isClimbing; + bool fired; + int waterSurfaceDist; + PHD_VECTOR lastPos; + FX_INFO* spazEffect; + int meshEffects; + short* meshPtrs[NUM_LARA_MESHES]; + ITEM_INFO* target; + short targetAngles[2]; + short turnRate; + short moveAngle; + short headYrot; + short headXrot; + short headZrot; + short torsoYrot; + short torsoXrot; + short torsoZrot; + LARA_ARM leftArm; + LARA_ARM rightArm; + // changing it to holster_left/holster_right will be good instead of doing the 2 at the same time ! + // note: no need 65535 for holster, just 255 is fine... + byte holster; + CREATURE_INFO* creature; + int cornerX; + int cornerZ; + byte ropeSegment; + byte ropeDirection; + short ropeArcFront; + short ropeArcBack; + short ropeLastX; + short ropeMaxXForward; + short ropeMaxXBackward; + int ropeDFrame; + int ropeFrame; + unsigned short ropeFrameRate; + unsigned short ropeY; + int ropePtr; + void* generalPtr; + int ropeOffset; + int ropeDownVel; + byte ropeFlag; + byte moveCount; + int ropeCount; + byte skelebob; + byte wetcloth; + byte bottle; + byte location; + byte highestLocation; + byte locationPad; + byte tightRopeOnCount; + byte tightRopeOff; + byte tightRopeFall; + byte chaffTimer; + /// =================================== NEW: + short Vehicle; + short ExtraAnim; + bool mineL; + bool mineR; + CarriedWeaponInfo Weapons[NUM_WEAPONS]; + DiaryInfo Diary; + WaterskinInfo Waterskin1; + WaterskinInfo Waterskin2; + RendererMesh* MeshesPointers[NUM_LARA_MESHES]; + int Puzzles[NUM_PUZZLES]; + int Keys[NUM_KEYS]; + int Pickups[NUM_PICKUPS]; + int Examines[NUM_EXAMINES]; + int PuzzlesCombo[NUM_PUZZLES * 2]; + int KeysCombo[NUM_KEYS * 2]; + int PickupsCombo[NUM_PICKUPS * 2]; + int ExaminesCombo[NUM_EXAMINES * 2]; + int Secrets; + bool Lasersight; + bool Crowbar; + bool Torch; + bool Silencer; + bool Binoculars; + int NumSmallMedipacks; + int NumLargeMedipacks; + int NumFlares; }; \ No newline at end of file diff --git a/TR5Main/Game/laraclmb.cpp b/TR5Main/Game/laraclmb.cpp index b851bf2f5..317b64cc9 100644 --- a/TR5Main/Game/laraclmb.cpp +++ b/TR5Main/Game/laraclmb.cpp @@ -1,13 +1,13 @@ +#include "framework.h" #include "laraclmb.h" -#include "..\Global\global.h" #include "Lara.h" #include "control.h" #include "draw.h" #include "sphere.h" #include "laramisc.h" #include "camera.h" -#include "..\Specific\level.h" -#include "../Specific/input.h" +#include "level.h" +#include "input.h" short LeftIntRightExtTab[4] = // offset 0xA0B7C { diff --git a/TR5Main/Game/laraclmb.h b/TR5Main/Game/laraclmb.h index cd7efd4f0..b710c8f45 100644 --- a/TR5Main/Game/laraclmb.h +++ b/TR5Main/Game/laraclmb.h @@ -1,5 +1,6 @@ #pragma once -#include "..\Global\global.h" +#include "items.h" +#include "collide.h" short GetClimbTrigger(int x, int y, int z, short roomNumber); void lara_col_climbend(ITEM_INFO* item, COLL_INFO* coll); diff --git a/TR5Main/Game/larafire.cpp b/TR5Main/Game/larafire.cpp index 9da01c1b9..61fc72a3a 100644 --- a/TR5Main/Game/larafire.cpp +++ b/TR5Main/Game/larafire.cpp @@ -1,25 +1,23 @@ +#include "framework.h" #include "larafire.h" - #include "items.h" -#include "Lara.h" #include "laraflar.h" #include "lara1gun.h" #include "lara2gun.h" #include "camera.h" -#include "..\Scripting\GameFlowScript.h" -#include #include "objects.h" -#include "effects.h" +#include "effect.h" #include "sphere.h" #include "draw.h" #include "effect2.h" #include "flmtorch.h" -#include "..\Specific\level.h" +#include "level.h" #include "lot.h" -#include "../Specific/setup.h" -#include "../Specific/input.h" +#include "setup.h" +#include "input.h" #include "sound.h" #include "savegame.h" +#include "GameFlowScript.h" WEAPON_INFO Weapons[NUM_WEAPONS] = { @@ -318,9 +316,7 @@ void SmashItem(short itemNum) // (F) (D) { ITEM_INFO* item = &Items[itemNum]; if (item->objectNumber >= ID_SMASH_OBJECT1 && item->objectNumber <= ID_SMASH_OBJECT8) - { SmashObject(itemNum); - } } void LaraGun() // (F) (D) @@ -697,7 +693,7 @@ void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag) if (creature && item != LaraItem) creature->hurtByLara = true; - if (hitPos) + if (hitPos != nullptr) { if (obj->hitEffect) { @@ -716,7 +712,8 @@ void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag) } } } - if (!obj->undead || flag || item->hitPoints == -16384) + + if (!obj->undead || flag || item->hitPoints == NOT_TARGETABLE) { if (item->hitPoints > 0 && item->hitPoints <= damage) ++Savegame.Level.Kills; @@ -724,50 +721,42 @@ void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag) } } -int DetectCrouchWhenFiring(ITEM_INFO* src, WEAPON_INFO* weapon) -{ - if (src->currentAnimState == STATE_LARA_CROUCH_IDLE || src->currentAnimState == STATE_LARA_CROUCH_TURN_LEFT || src->currentAnimState == STATE_LARA_CROUCH_TURN_RIGHT) - return STEP_SIZE; - else - return int(weapon->gunHeight); -} - -int FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) // (F) (D) +FIREWEAPON_TYPE FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) // (F) (D) { short* ammo = GetAmmo(weaponType); if (!*ammo) - return 0; + return FW_NOAMMO; if (*ammo != -1) (*ammo)--; WEAPON_INFO* weapon = &Weapons[weaponType]; int r; - PHD_3DPOS pos; - pos.xPos = 0; - pos.yPos = 0; - pos.zPos = 0; - GetLaraJointPosition((PHD_VECTOR*)&pos, LM_RHAND); + PHD_VECTOR pos; + pos.x = 0; + pos.y = 0; + pos.z = 0; + GetLaraJointPosition(&pos, LM_RHAND); - pos.xPos = src->pos.xPos; - pos.zPos = src->pos.zPos; - - pos.xRot = angles[1] + (GetRandomControl() - 16384) * weapon->shotAccuracy / 65536; - pos.yRot = angles[0] + (GetRandomControl() - 16384) * weapon->shotAccuracy / 65536; - pos.zRot = 0; + pos.x = src->pos.xPos; + pos.z = src->pos.zPos; + PHD_3DPOS rotation; + rotation.xRot = angles[1] + (GetRandomControl() - 0x4000) * weapon->shotAccuracy / 0x10000; + rotation.yRot = angles[0] + (GetRandomControl() - 0x4000) * weapon->shotAccuracy / 0x10000; + rotation.zRot = 0; // Calculate ray from rotation angles - float x = sin(TO_RAD(pos.yRot)) * cos(TO_RAD(pos.xRot)); - float y = -sin(TO_RAD(pos.xRot)); - float z = cos(TO_RAD(pos.yRot)) * cos(TO_RAD(pos.xRot)); + float x = sin(TO_RAD(rotation.yRot)) * cos(TO_RAD(rotation.xRot)); + float y = -sin(TO_RAD(rotation.xRot)); + float z = cos(TO_RAD(rotation.yRot)) * cos(TO_RAD(rotation.xRot)); Vector3 direction = Vector3(x, y, z); direction.Normalize(); - Vector3 source = Vector3(pos.xPos, pos.yPos, pos.zPos); - Vector3 destination = source + direction * 1024.0f; + Vector3 source = Vector3(pos.x, pos.y, pos.z); + Vector3 destination = source + direction * float(weapon->targetDist); Ray ray = Ray(source, direction); int num = GetSpheres(target, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity); - int best = -1; + int best = NO_ITEM; float bestDistance = FLT_MAX; for (int i = 0; i < num; i++) @@ -788,34 +777,29 @@ int FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) Lara.fired = true; GAME_VECTOR vSrc; - vSrc.x = pos.xPos; - vSrc.y = pos.yPos; - vSrc.z = pos.zPos; + vSrc.x = pos.x; + vSrc.y = pos.y; + vSrc.z = pos.z; short roomNumber = src->roomNumber; - GetFloor(pos.xPos, pos.yPos, pos.zPos, &roomNumber); + GetFloor(pos.x, pos.y, pos.z, &roomNumber); vSrc.roomNumber = roomNumber; if (best < 0) { GAME_VECTOR vDest; - vDest.x = destination.x; vDest.y = destination.y; vDest.z = destination.z; - - GetTargetOnLOS(&vSrc, &vDest, 0, 1); - - return -1; + GetTargetOnLOS(&vSrc, &vDest, FALSE, TRUE); + return FW_MISS; } else { Savegame.Game.AmmoHits++; - - GAME_VECTOR vDest; - destination = source + direction * bestDistance; + GAME_VECTOR vDest; vDest.x = destination.x; vDest.y = destination.y; vDest.z = destination.z; @@ -858,11 +842,11 @@ int FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) } else {*/ - if (!GetTargetOnLOS(&vSrc, &vDest, 0, 1)) - HitTarget(target, &vDest, weapon->damage, 0); + if (!GetTargetOnLOS(&vSrc, &vDest, FALSE, TRUE)) + HitTarget(target, &vDest, weapon->damage, NULL); //} - return 1; + return FW_MAYBEHIT; } } @@ -888,42 +872,43 @@ void LaraTargetInfo(WEAPON_INFO* weapon) // (F) (D) { if (!Lara.target) { - Lara.rightArm.lock = 0; - Lara.leftArm.lock = 0; + Lara.rightArm.lock = false; + Lara.leftArm.lock = false; Lara.targetAngles[1] = 0; Lara.targetAngles[0] = 0; return; } - GAME_VECTOR pos; - + PHD_VECTOR pos; pos.x = 0; pos.y = 0; pos.z = 0; - GetLaraJointPosition((PHD_VECTOR*)&pos, LM_RHAND); + GetLaraJointPosition(&pos, LM_RHAND); - pos.x = LaraItem->pos.xPos; - pos.z = LaraItem->pos.zPos; - pos.roomNumber = LaraItem->roomNumber; + GAME_VECTOR src; + src.x = LaraItem->pos.xPos; + src.y = pos.y; + src.z = LaraItem->pos.zPos; + src.roomNumber = LaraItem->roomNumber; GAME_VECTOR targetPoint; find_target_point(Lara.target, &targetPoint); short angles[2]; - phd_GetVectorAngles(targetPoint.x - pos.x, targetPoint.y - pos.y, targetPoint.z - pos.z, angles); + phd_GetVectorAngles(targetPoint.x - src.x, targetPoint.y - src.y, targetPoint.z - src.z, angles); angles[0] -= LaraItem->pos.yRot; angles[1] -= LaraItem->pos.xRot; - if (LOS(&pos, &targetPoint)) + if (LOS(&src, &targetPoint)) { if (angles[0] >= weapon->lockAngles[0] && angles[0] <= weapon->lockAngles[1] && angles[1] >= weapon->lockAngles[2] && angles[1] <= weapon->lockAngles[3]) { - Lara.rightArm.lock = 1; - Lara.leftArm.lock = 1; + Lara.rightArm.lock = true; + Lara.leftArm.lock = true; } else { @@ -933,7 +918,7 @@ void LaraTargetInfo(WEAPON_INFO* weapon) // (F) (D) angles[0] > weapon->leftAngles[1] || angles[1] < weapon->leftAngles[2] || angles[1] > weapon->leftAngles[3])) - Lara.leftArm.lock = 0; + Lara.leftArm.lock = false; } if (Lara.rightArm.lock) @@ -942,37 +927,36 @@ void LaraTargetInfo(WEAPON_INFO* weapon) // (F) (D) angles[0] > weapon->rightAngles[1] || angles[1] < weapon->rightAngles[2] || angles[1] > weapon->rightAngles[3])) - Lara.rightArm.lock = 0; + Lara.rightArm.lock = false; } } } else { - Lara.rightArm.lock = 0; - Lara.leftArm.lock = 0; + Lara.rightArm.lock = false; + Lara.leftArm.lock = false; } Lara.targetAngles[0] = angles[0]; Lara.targetAngles[1] = angles[1]; } -int CheckForHoldingState(int state) // (F) (D) +bool CheckForHoldingState(int state) // (F) (D) { - short* holdState = HoldStates; - #if 0 - if (Lara.ExtraAnim) - return 0; + if (Lara.ExtraAnim != NO_ITEM) + return false; #endif + short* holdState = HoldStates; while (*holdState >= 0) { if (state == *holdState) - return 1; + return true; holdState++; } - return 0; + return false; } void LaraGetNewTarget(WEAPON_INFO* winfo) // (F) (D) @@ -989,10 +973,15 @@ void LaraGetNewTarget(WEAPON_INFO* winfo) // (F) (D) return; } bestItem = NULL; - bestYrot = 0x7FFF; - bestDistance = 0x7FFFFFFF; + bestYrot = MAXSHORT; + bestDistance = MAXINT; + PHD_VECTOR handpos; + handpos.x = 0; + handpos.y = 0; + handpos.z = 0; + GetLaraJointPosition(&handpos, LM_RHAND); source.x = LaraItem->pos.xPos; - source.y = LaraItem->pos.yPos - 650; + source.y = LaraItem->pos.yPos - handpos.y; source.z = LaraItem->pos.zPos; source.roomNumber = LaraItem->roomNumber; maxDistance = winfo->targetDist; @@ -1035,6 +1024,7 @@ void LaraGetNewTarget(WEAPON_INFO* winfo) // (F) (D) } } } + TargetList[targets] = NULL; if (!TargetList[0]) { @@ -1087,12 +1077,14 @@ void LaraGetNewTarget(WEAPON_INFO* winfo) // (F) (D) } } } + if (Lara.target != LastTargets[0]) { for (slot = 7; slot > 0; --slot) LastTargets[slot] = LastTargets[slot - 1]; LastTargets[0] = Lara.target; } + LaraTargetInfo(winfo); } diff --git a/TR5Main/Game/larafire.h b/TR5Main/Game/larafire.h index ea079a353..e08808e0e 100644 --- a/TR5Main/Game/larafire.h +++ b/TR5Main/Game/larafire.h @@ -1,7 +1,28 @@ #pragma once +#include "lara.h" -#include "..\Global\global.h" +typedef enum FIREWEAPON_TYPE +{ + FW_MISS = -1, + FW_NOAMMO = 0, + FW_MAYBEHIT = 1 +}; +typedef struct WEAPON_INFO +{ + short lockAngles[4]; + short leftAngles[4]; + short rightAngles[4]; + short aimSpeed; + short shotAccuracy; + short gunHeight; + short targetDist; + byte damage; + byte recoilFrame; + byte flashTime; + byte drawFrame; + short sampleNum; +}; extern WEAPON_INFO Weapons[NUM_WEAPONS]; void SmashItem(short itemNum); @@ -12,9 +33,9 @@ void InitialiseNewWeapon(); int WeaponObjectMesh(int weaponType); void AimWeapon(WEAPON_INFO* winfo, LARA_ARM* arm); void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag); -int FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles); +FIREWEAPON_TYPE FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles); void find_target_point(ITEM_INFO* item, GAME_VECTOR* target); void LaraTargetInfo(WEAPON_INFO* weapon); -int CheckForHoldingState(int state); +bool CheckForHoldingState(int state); void LaraGetNewTarget(WEAPON_INFO* winfo); void DoProperDetection(short itemNumber, int x, int y, int z, int xv, int yv, int zv); \ No newline at end of file diff --git a/TR5Main/Game/laraflar.cpp b/TR5Main/Game/laraflar.cpp index 292adcd13..3fe4191b8 100644 --- a/TR5Main/Game/laraflar.cpp +++ b/TR5Main/Game/laraflar.cpp @@ -1,10 +1,8 @@ +#include "framework.h" #include "laraflar.h" - -#include "..\Global\global.h" -#include "..\Specific\level.h" -#include "..\Specific\setup.h" +#include "level.h" +#include "setup.h" #include "sound.h" - #include "draw.h" #include "items.h" #include "sphere.h" @@ -90,8 +88,8 @@ void ready_flare() // (F) (D) Lara.rightArm.zRot = 0; Lara.rightArm.yRot = 0; Lara.rightArm.xRot = 0; - Lara.rightArm.lock = 0; - Lara.leftArm.lock = 0; + Lara.rightArm.lock = false; + Lara.leftArm.lock = false; Lara.target = NULL; } @@ -140,8 +138,8 @@ void undraw_flare() // (F) (D) InitialiseNewWeapon(); Lara.target = NULL; - Lara.rightArm.lock = 0; - Lara.leftArm.lock = 0; + Lara.rightArm.lock = false; + Lara.leftArm.lock = false; LaraItem->animNumber = ANIMATION_LARA_STAY_SOLID; Lara.flareFrame = Anims[LaraItem->animNumber].frameBase; LaraItem->frameNumber = Anims[LaraItem->animNumber].frameBase; @@ -198,8 +196,8 @@ void undraw_flare() // (F) (D) Lara.flareControlLeft = false; Lara.target = NULL; - Lara.rightArm.lock = 0; - Lara.leftArm.lock = 0; + Lara.rightArm.lock = false; + Lara.leftArm.lock = false; Lara.flareFrame = 0; } else if (frame2 < 21) @@ -374,6 +372,11 @@ void CreateFlare(short objectNum, int thrown) // (F) (D) } } +void DrawFlareInAir(ITEM_INFO* item) +{ + printf("DrawFlareInAir() not implemented !"); +} + void DoFlareInHand(int flare_age) // (AF) (D) { PHD_VECTOR pos; diff --git a/TR5Main/Game/laraflar.h b/TR5Main/Game/laraflar.h index b7eeec784..e1b25d7a1 100644 --- a/TR5Main/Game/laraflar.h +++ b/TR5Main/Game/laraflar.h @@ -1,5 +1,5 @@ #pragma once -#include "..\Global\global.h" +#include "items.h" void FlareControl(short item_number); void ready_flare(); diff --git a/TR5Main/Game/laramisc.cpp b/TR5Main/Game/laramisc.cpp index 14b0c809e..db27f4496 100644 --- a/TR5Main/Game/laramisc.cpp +++ b/TR5Main/Game/laramisc.cpp @@ -1,23 +1,23 @@ +#include "framework.h" #include "laramisc.h" -#include "..\Global\global.h" -#include "..\Specific\level.h" -#include "../Specific/setup.h" -#include "..\Scripting\GameFlowScript.h" -#include "effects.h" + +#include "level.h" +#include "setup.h" +#include "GameFlowScript.h" +#include "effect.h" #include "collide.h" #include "Lara.h" #include "laraswim.h" #include "larasurf.h" #include "effect2.h" -#include "healt.h" +#include "health.h" #include "misc.h" #include "rope.h" -#include "rope.h" #include "draw.h" #include "savegame.h" #include "inventory.h" #include "camera.h" -#include "../Specific/input.h" +#include "input.h" #include "sound.h" @@ -707,8 +707,8 @@ void LaraInitialiseMeshes() // (AF) (D) Lara.leftArm.frameNumber = 0; Lara.rightArm.frameNumber = 0; Lara.target = NULL; - Lara.rightArm.lock = 0; - Lara.leftArm.lock = 0; + Lara.rightArm.lock = false; + Lara.leftArm.lock = false; } void InitialiseLara(int restore) @@ -730,7 +730,7 @@ void InitialiseLara(int restore) else { ZeroMemory(&Lara, sizeof(LaraInfo)); - Lara.ExtraAnim = 0; + Lara.ExtraAnim = NO_ITEM; Lara.Vehicle = NO_ITEM; } diff --git a/TR5Main/Game/laramisc.h b/TR5Main/Game/laramisc.h index f0232c21a..e5a7d847c 100644 --- a/TR5Main/Game/laramisc.h +++ b/TR5Main/Game/laramisc.h @@ -1,5 +1,6 @@ #pragma once -#include "..\Global\global.h" + +#include "collide.h" extern COLL_INFO coll; diff --git a/TR5Main/Game/larasurf.cpp b/TR5Main/Game/larasurf.cpp index 158a85846..b008e932f 100644 --- a/TR5Main/Game/larasurf.cpp +++ b/TR5Main/Game/larasurf.cpp @@ -1,6 +1,5 @@ +#include "framework.h" #include "larasurf.h" - -#include "..\Global\global.h" #include "control.h" #include "camera.h" #include "collide.h" @@ -10,11 +9,9 @@ #include "laraswim.h" #include "larafire.h" #include "laramisc.h" -#include "..\Specific\level.h" -#include "../Specific/input.h" +#include "level.h" +#include "input.h" -extern void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll); -extern void(*lara_collision_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll); bool EnableCrawlFlexWaterPullUp, EnableCrawlFlexSubmerged; void lara_col_surftread(ITEM_INFO* item, COLL_INFO* coll) @@ -516,5 +513,5 @@ int LaraTestWaterStepOut(ITEM_INFO* item, COLL_INFO* coll)//4D100, 4D564 (F) Lara.waterStatus = LW_WADE; - return true; + return 1; } diff --git a/TR5Main/Game/larasurf.h b/TR5Main/Game/larasurf.h index e42d3cf5c..f645335fa 100644 --- a/TR5Main/Game/larasurf.h +++ b/TR5Main/Game/larasurf.h @@ -1,6 +1,6 @@ #pragma once -#include "..\Global\global.h" + #include "Lara.h" void _cdecl lara_col_surftread(ITEM_INFO* item, COLL_INFO* coll); diff --git a/TR5Main/Game/laraswim.cpp b/TR5Main/Game/laraswim.cpp index 3868f65db..a7127d30d 100644 --- a/TR5Main/Game/laraswim.cpp +++ b/TR5Main/Game/laraswim.cpp @@ -1,26 +1,30 @@ +#include "framework.h" #include "laraswim.h" - -#include "..\Global\global.h" - #include "control.h" #include "camera.h" -#include "collide.h" #include "items.h" #include "box.h" #include "Lara.h" #include "larasurf.h" -#include "effects.h" +#include "effect.h" #include "effect2.h" #include "larafire.h" #include "laramisc.h" #include "draw.h" #include "camera.h" -#include "..\Specific\level.h" -#include "../Specific/input.h" +#include "level.h" +#include "input.h" #include "sound.h" +#include "GameFlowScript.h" - - +typedef struct SUBSUIT_INFO +{ + short XRot; + short dXRot; + short XRotVel; + short Vel[2]; + short YVel; +}; SUBSUIT_INFO Subsuit; byte SubHitCount = 0; @@ -823,7 +827,7 @@ void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll)//4B608, 4BA6C } } - if (Lara.waterStatus != LW_FLYCHEAT && Lara.ExtraAnim == 0) + if (Lara.waterStatus != LW_FLYCHEAT && Lara.ExtraAnim == NO_ITEM) LaraTestWaterDepth(item, coll); } diff --git a/TR5Main/Game/laraswim.h b/TR5Main/Game/laraswim.h index b4707788d..3ba940e0e 100644 --- a/TR5Main/Game/laraswim.h +++ b/TR5Main/Game/laraswim.h @@ -1,6 +1,6 @@ #pragma once -#include "..\Global\global.h" +#include "collide.h" void LaraWaterCurrent(COLL_INFO* coll); int GetWaterDepth(int x, int y, int z, short roomNumber); diff --git a/TR5Main/Game/lot.cpp b/TR5Main/Game/lot.cpp index f80a5b00f..08de35744 100644 --- a/TR5Main/Game/lot.cpp +++ b/TR5Main/Game/lot.cpp @@ -1,11 +1,10 @@ +#include "framework.h" #include "lot.h" #include "box.h" -#include "..\Global\global.h" -#include -#include "../Specific/setup.h" +#include "setup.h" #include "camera.h" #include "lara.h" -#include "..\Specific\level.h" +#include "level.h" #define DEFAULT_FLY_UPDOWN_SPEED 16 #define DEFAULT_SWIM_UPDOWN_SPEED 32 @@ -15,8 +14,6 @@ CREATURE_INFO* BaddieSlots; void InitialiseLOTarray(int allocMem) { - //DB_Log(0, "InitialiseLOTarray - DLL"); - if (allocMem) BaddieSlots = (CREATURE_INFO*)game_malloc(sizeof(CREATURE_INFO) * NUM_SLOTS); @@ -235,11 +232,13 @@ void InitialiseSlot(short itemNum, short slot) case ZONE_BLOCKABLE: creature->LOT.blockMask = BLOCKABLE; + creature->LOT.zone = ZONE_BASIC; break; case ZONE_SOPHIALEE: creature->LOT.step = CLICK(4); creature->LOT.drop = -CLICK(3); + creature->LOT.zone = ZONE_HUMAN_CLASSIC; break; } @@ -289,8 +288,8 @@ void CreateZone(ITEM_INFO* item) } else { - short* zone = Zones[creature->LOT.zone][0]; - short* flippedZone = Zones[creature->LOT.zone][1]; + short* zone = Zones[creature->LOT.zone][FALSE]; + short* flippedZone = Zones[creature->LOT.zone][TRUE]; short zoneNumber = zone[item->boxNumber]; short flippedZoneNumber = flippedZone[item->boxNumber]; diff --git a/TR5Main/Game/lot.h b/TR5Main/Game/lot.h index 4838c9427..d74e506ec 100644 --- a/TR5Main/Game/lot.h +++ b/TR5Main/Game/lot.h @@ -1,7 +1,7 @@ #pragma once +#include "box.h" -#include "..\Global\global.h" - +constexpr auto NUM_SLOTS = 32; extern int SlotsUsed; extern CREATURE_INFO* BaddieSlots; diff --git a/TR5Main/Global/malloc.cpp b/TR5Main/Game/malloc.cpp similarity index 87% rename from TR5Main/Global/malloc.cpp rename to TR5Main/Game/malloc.cpp index ad323a4c3..1f76f9197 100644 --- a/TR5Main/Global/malloc.cpp +++ b/TR5Main/Game/malloc.cpp @@ -1,43 +1,43 @@ -#include "malloc.h" -#include -#include "..\Global\global.h" - -char* malloc_buffer; -int malloc_size; -char* malloc_ptr; -int malloc_free; -int malloc_used; - -char* game_malloc(int size) -{ - char* ptr; - - size = (size + 3) & 0xfffffffc; - if (size <= malloc_free) - { - ptr = malloc_ptr; - malloc_free -= size; - malloc_used += size; - malloc_ptr += size; - return ptr; - } - - return 0; -} - -void init_game_malloc() -{ - malloc_size = 1048576 * 128; - malloc_buffer = (char*)malloc(malloc_size); - malloc_ptr = malloc_buffer; - malloc_free = malloc_size; - malloc_used = 0; -} - -void game_free(int size, int type) -{ - size = (size + 3) & (~3); - malloc_ptr -= size; - malloc_free += size; - malloc_used -= size; +#include "framework.h" +#include "malloc.h" + + +char* malloc_buffer; +int malloc_size; +char* malloc_ptr; +int malloc_free; +int malloc_used; + +char* game_malloc(int size) +{ + char* ptr; + + size = (size + 3) & 0xfffffffc; + if (size <= malloc_free) + { + ptr = malloc_ptr; + malloc_free -= size; + malloc_used += size; + malloc_ptr += size; + return ptr; + } + + return 0; +} + +void init_game_malloc() +{ + malloc_size = 1048576 * 128; + malloc_buffer = (char*)malloc(malloc_size); + malloc_ptr = malloc_buffer; + malloc_free = malloc_size; + malloc_used = 0; +} + +void game_free(int size, int type) +{ + size = (size + 3) & (~3); + malloc_ptr -= size; + malloc_free += size; + malloc_used -= size; } \ No newline at end of file diff --git a/TR5Main/Global/malloc.h b/TR5Main/Game/malloc.h similarity index 95% rename from TR5Main/Global/malloc.h rename to TR5Main/Game/malloc.h index 9d2e0e578..68c022972 100644 --- a/TR5Main/Global/malloc.h +++ b/TR5Main/Game/malloc.h @@ -1,11 +1,11 @@ -#pragma once - -extern char* malloc_buffer; -extern int malloc_size; -extern char* malloc_ptr; -extern int malloc_free; -extern int malloc_used; - -char* game_malloc(int size); -void init_game_malloc(); +#pragma once + +extern char* malloc_buffer; +extern int malloc_size; +extern char* malloc_ptr; +extern int malloc_free; +extern int malloc_used; + +char* game_malloc(int size); +void init_game_malloc(); void game_free(int size, int type); \ No newline at end of file diff --git a/TR5Main/Game/misc.cpp b/TR5Main/Game/misc.cpp index 55ee17451..1e0780595 100644 --- a/TR5Main/Game/misc.cpp +++ b/TR5Main/Game/misc.cpp @@ -1,9 +1,7 @@ +#include "framework.h" #include "misc.h" -#include "../Specific/setup.h" -#include "..\Specific\level.h" - -#define CHK_ANY(var, flag) (var & flag) != 0 -#define CHK_NOP(var, flag) !(var & flag) +#include "setup.h" +#include "level.h" short GF(short animIndex, short frameToStart) { diff --git a/TR5Main/Game/misc.h b/TR5Main/Game/misc.h index 4a78ffa7c..0f1273171 100644 --- a/TR5Main/Game/misc.h +++ b/TR5Main/Game/misc.h @@ -1,5 +1,10 @@ #pragma once -#include "../Global/global.h" + +#include "box.h" + +#define CHK_ANY(var, flag) (var & flag) != 0 +#define CHK_EXI(var, flag) var & flag +#define CHK_NOP(var, flag) !(var & flag) enum LARA_MESH_MASK { diff --git a/TR5Main/Game/missile.cpp b/TR5Main/Game/missile.cpp index 8ffc77bb0..a45af2c7e 100644 --- a/TR5Main/Game/missile.cpp +++ b/TR5Main/Game/missile.cpp @@ -1,15 +1,12 @@ +#include "framework.h" #include "missile.h" -#include "..\Global\global.h" -#include "..\Game\control.h" -#include "..\Game\sound.h" -#include "..\Game\items.h" -#include "..\Game\effects.h" -#include "..\Game\draw.h" -#include "..\Game\tomb4fx.h" -#include +#include "sound.h" +#include "items.h" +#include "effect.h" +#include "draw.h" #include "debris.h" -#include "../Specific/level.h" -#include "../Specific/setup.h" +#include "level.h" +#include "setup.h" #include "lara.h" #define SHARD_DAMAGE 30 diff --git a/TR5Main/Game/missile.h b/TR5Main/Game/missile.h index e56c6be6d..5fb022255 100644 --- a/TR5Main/Game/missile.h +++ b/TR5Main/Game/missile.h @@ -1,6 +1,5 @@ #pragma once - -#include "..\Global\global.h" +#include "effect.h" void ShootAtLara(FX_INFO* fx); void ControlMissile(short fxNumber); diff --git a/TR5Main/Game/newinv2.cpp b/TR5Main/Game/newinv2.cpp index 70f61a1d5..3226422c1 100644 --- a/TR5Main/Game/newinv2.cpp +++ b/TR5Main/Game/newinv2.cpp @@ -1 +1,2 @@ +#include "framework.h" #include "newinv2.h" \ No newline at end of file diff --git a/TR5Main/Game/objects.cpp b/TR5Main/Game/objects.cpp index a2aacda36..965e3848d 100644 --- a/TR5Main/Game/objects.cpp +++ b/TR5Main/Game/objects.cpp @@ -1,9 +1,8 @@ +#include "framework.h" #include "objects.h" -#include "..\Global\global.h" #include "items.h" -#include "effects.h" +#include "effect.h" #include "effect2.h" -#include "collide.h" #include "draw.h" #include "Lara.h" #include "sphere.h" @@ -11,10 +10,10 @@ #include "control.h" #include "switch.h" #include "box.h" -#include "../Specific/setup.h" +#include "setup.h" #include "tomb4fx.h" -#include "..\Specific\level.h" -#include "../Specific/input.h" +#include "level.h" +#include "input.h" #include "sound.h" OBJECT_TEXTURE* WaterfallTextures[6]; @@ -42,47 +41,7 @@ short PoleBounds[12] = // offset 0xA1250 -void InitialiseSmashObject(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - item->flags = 0; - item->meshBits = 1; - ROOM_INFO* r = &Rooms[item->roomNumber]; - FLOOR_INFO* floor = &XZ_GET_SECTOR(r, item->pos.xPos - r->x, item->pos.zPos - r->z); - - if (Boxes[floor->box].overlapIndex & END_BIT) - Boxes[floor->box].overlapIndex |= BLOCKED; -} - -void SmashObject(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - ROOM_INFO* r = &Rooms[item->roomNumber]; - int sector = ((item->pos.zPos - r->z) >> 10) + r->xSize * ((item->pos.xPos - r->x) >> 10); - - BOX_INFO* box = &Boxes[r->floor[sector].box]; - if (box->overlapIndex & BOX_LAST) - box->overlapIndex &= ~BOX_BLOCKED; - - SoundEffect(SFX_SMASH_GLASS, &item->pos, 0); - - item->collidable = 0; - item->meshBits = 0xFFFE; - - ExplodingDeath(itemNumber, -1, 257); - - item->flags |= IFLAG_INVISIBLE; - - if (item->status == ITEM_ACTIVE) - RemoveActiveItem(itemNumber); - item->status = ITEM_DEACTIVATED; -} - -void SmashObjectControl(short itemNumber) -{ - SmashObject(itemNumber << 16); -} void BridgeFlatFloor(ITEM_INFO* item, int x, int y, int z, int* height) { @@ -675,7 +634,7 @@ void AnimatingControl(short itemNumber) item->frameNumber = Anims[item->animNumber].frameBase; RemoveActiveItem(itemNumber); item->aiBits = 0; - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; } } diff --git a/TR5Main/Game/objects.h b/TR5Main/Game/objects.h index b1e362342..1ed51bb63 100644 --- a/TR5Main/Game/objects.h +++ b/TR5Main/Game/objects.h @@ -1,5 +1,6 @@ #pragma once -#include "..\Global\global.h" + +#include "collide.h" extern OBJECT_TEXTURE* WaterfallTextures[6]; extern float WaterfallY[6]; @@ -25,6 +26,6 @@ void CutsceneRopeControl(short itemNumber); void HybridCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll); void InitialiseSmashObject(short itemNumber); void InitialiseTightRope(short itemNumber); -void InitialiseAnimating(short itemNumber); -void AnimatingControl(short itemNumber); void HighObject2Control(short itemNumber); +void InitialiseAnimating(short itemNumber); +void AnimatingControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Global/objectslist.h b/TR5Main/Game/objectslist.h similarity index 52% rename from TR5Main/Global/objectslist.h rename to TR5Main/Game/objectslist.h index f2104a79a..d900b0252 100644 --- a/TR5Main/Global/objectslist.h +++ b/TR5Main/Game/objectslist.h @@ -1,1578 +1,1068 @@ -#pragma once - -//#define TR5_DEBUG // when defined, use the old GAME_OBJECT_ID enum to debug with TR5 level - -#ifdef TR5_DEBUG -typedef enum GAME_OBJECT_ID -{ - ID_LARA, - ID_PISTOLS_ANIM, - ID_UZI_ANIM, - ID_SHOTGUN_ANIM, - ID_CROSSBOW_ANIM, - ID_HK_ANIM, - ID_REVOLVER_ANIM, - ID_LARA_FLARE_ANIM, - ID_LARA_SKIN, - ID_LARA_SKIN_JOINTS, - ID_LARA_SCREAM, - ID_LARA_CROSSBOW_LASER, - ID_LARA_REVOLVER_LASER, - ID_LARA_HOLSTERS, - ID_LARA_HOLSTERS_PISTOLS, - ID_LARA_HOLSTERS_UZIS, - ID_LARA_HOLSTERS_REVOLVER, - ID_LARA_SPEECH_HEAD1, - ID_LARA_SPEECH_HEAD2, - ID_LARA_SPEECH_HEAD3, - ID_LARA_SPEECH_HEAD4, - ID_ACTOR1_SPEECH_HEAD1, - ID_ACTOR1_SPEECH_HEAD2, - ID_ACTOR2_SPEECH_HEAD1, - ID_ACTOR2_SPEECH_HEAD2, - ID_LARA_EXTRA_MESH1, - ID_LARA_EXTRA_MESH2, - ID_LARA_EXTRA_MESH3, - ID_LARA_CROWBAR_ANIM, - ID_LARA_TORCH_ANIM, - ID_LARA_HAIR, - ID_SAS, - ID_JEEP, // TR4 - 95% Working - ID_SWAT, - ID_MOTORBIKE, // TR4 - ID_SWAT_PLUS, - ID_JEEP_LARA_ANIMS, // TR4 - OK - ID_GUARD1, - ID_LARA_MOTORBIKE_ANIMS, // TR4 - OK - ID_TWOGUN, - ID_SKELETON, // TR4 - OK - ID_DOG, - ID_CROCODILE, // TR4 - OK - ID_LARA_EXTRA_ANIMS, // TR1-2-3 - OK - ID_MUMMY, // TR4 - OK - ID_LARSON, - ID_SMALL_SCORPION, // TR4 - OK - ID_PIERRE, - ID_BAT, // TR4 - OK - (Problem of pathfinding) - ID_MAFIA, - ID_GUIDE, // TR4 - OK - Needs testing (need custom level) - ID_MAFIA2, - ID_SPHINX, // TR4 - OK - Needs testing - ID_GUARD_LASER, - ID_HORSEMAN, // TR4 - ID_GUARD2, - ID_HORSE, // TR4 - ID_LION, - ID_WILD_BOAR, // TR4 - OK - ID_GLADIATOR, - ID_HARPY, // TR4 - OK - ID_ROMAN_GOD, - ID_DEMIGOD1, // TR4 - OK - ID_HYDRA, - ID_DEMIGOD2, // TR4 - OK - ID_GUARDIAN, - ID_DEMIGOD3, // TR4 - OK - ID_HITMAN, - ID_LITTLE_BEETLE, // TR4 - ID_SCIENTIST, - ID_MERCENARY, // TR3 - ID_WILLOWISP, // REPLACE? - ID_SHARK, // TR2 - OK - ID_INVISIBLE_GHOST, // Andy2 invisible ghost TO REPLACE? - ID_BADDY1, // TR4 - OK (implement picking, correct special moves) - ID_REAPER, - ID_BADDY2, //TR4 - OK - ID_BROWN_BEAST, // Andy2 brown beast TO REPLACE? - ID_CHAIN, // TR4 - OK - ID_GREEN_TEETH, // LAGOON WITCH TO REPLACE? - ID_PLOUGH, // TR4 - OK - ID_ATTACK_SUB, - ID_STARGATE, // TR4 - OK - ID_SNIPER, - ID_BURNING_FLOOR, // TR4 - ID_HUSKIE, - ID_COG, // TR4 - OK - ID_SAS_CAIRO, // TR4 - OK - ID_SPIKEBALL, // TR4 - OK - ID_IMP, - ID_FLOOR_4BLADES, // TR4 - OK - ID_GUNSHIP, - ID_CEILING_4BLADES, // TR4 - OK - ID_BATS_EMITTER, - ID_RATS_EMITTER, - ID_SPIDERS_EMITTER, - ID_FLAMETHROWER_BADDY, // TR3 - 50 - OK needs testing - ID_AUTOGUN, - ID_ELECTRICAL_CABLES, - ID_DARTS, - ID_DART_EMITTER, - ID_HOMING_DART_EMITTER, - ID_FALLING_CEILING, - ID_FALLING_BLOCK, - ID_FALLING_BLOCK2, - ID_CRUMBLING_FLOOR, - ID_TRAPDOOR1, - ID_TRAPDOOR2, - ID_TRAPDOOR3, - ID_FLOOR_TRAPDOOR1, - ID_FLOOR_TRAPDOOR2, - ID_CEILING_TRAPDOOR1, - ID_CEILING_TRAPDOOR2, - ID_SCALING_TRAPDOOR, - ID_ROLLINGBALL, - ID_ROLLINGBARREL, - ID_SPIKY_CEILING, // TR3 - OK - ID_TEETH_SPIKES, - ID_ROME_HAMMER, - ID_HAMMER, - ID_FLAME, - ID_FLAME_EMITTER, - ID_FLAME_EMITTER2, - ID_FLAME_EMITTER3, - ID_TO_REPLACE_2, // TR3 - ID_BURNING_ROOTS, - ID_ROPE, - ID_FIREROPE, - ID_POLEROPE, - ID_PROPELLER_H, // TO REPLACE? - ID_PROPELLER_V, // TO REPLACE? - ID_ENEMY_JEEP, // TR4 - ID_ONEBLOCK_PLATFORM, - ID_TWOBLOCK_PLATFORM, - ID_RAISING_BLOCK1, - ID_RAISING_BLOCK2, - ID_HEADSET_TALKING_POINT, - ID_PUSHABLE_OBJECT1, - ID_PUSHABLE_OBJECT2, - ID_PUSHABLE_OBJECT3, - ID_PUSHABLE_OBJECT4, - ID_PUSHABLE_OBJECT5, - ID_WRECKING_BALL, - ID_ZIPLINE_HANDLE, // Already in TR5 - to test - ID_TORPEDO, - ID_CHAFF, - ID_SNOWMOBILE, // TR2 - ID_ELECTRIC_FENCE, - ID_LIFT, - ID_SNOWMOBILE_LARA_ANIMS, // TR2 - OK - ID_YETI, // TR2 - 45 - ID_QUAD, // TR3 - OK - ID_QUAD_LARA_ANIMS, // TR3 - OK - ID_COMPY, // TR3 - 34 - ID_TIGHT_ROPE, - ID_PARALLEL_BARS, - ID_XRAY_CONTROLLER, - ID_RAT, // TR2 - OK - ID_PORTAL, - ID_GEN_SLOT1, - ID_GEN_SLOT2, - ID_GEN_SLOT3, - ID_GEN_SLOT4, - ID_IMP_ROCK, - ID_SEARCH_OBJECT1, - ID_CATWALK_BLADE, // TR4 - OK - ID_SEARCH_OBJECT2, - ID_PLINTH_BLADE, // TR4 - OK - ID_SEARCH_OBJECT3, - ID_SETH_BLADE, // TR4 - OK - ID_SEARCH_OBJECT4, - ID_SLICER_DICER, // TR4 - OK - Needs testing - ID_PUZZLE_ITEM1, - ID_PUZZLE_ITEM2, - ID_PUZZLE_ITEM3, - ID_PUZZLE_ITEM4, - ID_PUZZLE_ITEM5, - ID_PUZZLE_ITEM6, - ID_PUZZLE_ITEM7, - ID_PUZZLE_ITEM8, - ID_PUZZLE_ITEM1_COMBO1, - ID_PUZZLE_ITEM1_COMBO2, - ID_PUZZLE_ITEM2_COMBO1, - ID_PUZZLE_ITEM2_COMBO2, - ID_PUZZLE_ITEM3_COMBO1, - ID_PUZZLE_ITEM3_COMBO2, - ID_PUZZLE_ITEM4_COMBO1, - ID_PUZZLE_ITEM4_COMBO2, - ID_PUZZLE_ITEM5_COMBO1, - ID_PUZZLE_ITEM5_COMBO2, - ID_PUZZLE_ITEM6_COMBO1, - ID_PUZZLE_ITEM6_COMBO2, - ID_PUZZLE_ITEM7_COMBO1, - ID_PUZZLE_ITEM7_COMBO2, - ID_PUZZLE_ITEM8_COMBO1, - ID_PUZZLE_ITEM8_COMBO2, - ID_KEY_ITEM1, - ID_KEY_ITEM2, - ID_KEY_ITEM3, - ID_KEY_ITEM4, - ID_KEY_ITEM5, - ID_KEY_ITEM6, - ID_KEY_ITEM7, - ID_KEY_ITEM8, - ID_KEY_ITEM1_COMBO1, - ID_KEY_ITEM1_COMBO2, - ID_KEY_ITEM2_COMBO1, - ID_KEY_ITEM2_COMBO2, - ID_KEY_ITEM3_COMBO1, - ID_KEY_ITEM3_COMBO2, - ID_KEY_ITEM4_COMBO1, - ID_KEY_ITEM4_COMBO2, - ID_KEY_ITEM5_COMBO1, - ID_KEY_ITEM5_COMBO2, - ID_KEY_ITEM6_COMBO1, - ID_KEY_ITEM6_COMBO2, - ID_KEY_ITEM7_COMBO1, - ID_KEY_ITEM7_COMBO2, - ID_KEY_ITEM8_COMBO1, - ID_KEY_ITEM8_COMBO2, - ID_PICKUP_ITEM1, - ID_PICKUP_ITEM2, - ID_PICKUP_ITEM3, - ID_PICKUP_ITEM4, - ID_PICKUP_ITEM1_COMBO1, - ID_PICKUP_ITEM1_COMBO2, - ID_PICKUP_ITEM2_COMBO1, - ID_PICKUP_ITEM2_COMBO2, - ID_PICKUP_ITEM3_COMBO1, - ID_PICKUP_ITEM3_COMBO2, - ID_PICKUP_ITEM4_COMBO1, - ID_PICKUP_ITEM4_COMBO2, - ID_EXAMINE1, - ID_EXAMINE2, - ID_EXAMINE3, - ID_GAME_PIECE1, - ID_GAME_PIECE2, - ID_GAME_PIECE3, - ID_TRIBEBOSS, // TR3 - 36 - ID_HAMMER_ITEM, - ID_CROWBAR_ITEM, - ID_BURNING_TORCH_ITEM, - ID_PUZZLE_HOLE1, - ID_PUZZLE_HOLE2, - ID_PUZZLE_HOLE3, - ID_PUZZLE_HOLE4, - ID_PUZZLE_HOLE5, - ID_PUZZLE_HOLE6, - ID_PUZZLE_HOLE7, - ID_PUZZLE_HOLE8, - ID_PUZZLE_DONE1, - ID_PUZZLE_DONE2, - ID_PUZZLE_DONE3, - ID_PUZZLE_DONE4, - ID_PUZZLE_DONE5, - ID_PUZZLE_DONE6, - ID_PUZZLE_DONE7, - ID_PUZZLE_DONE8, - ID_KEY_HOLE1, - ID_KEY_HOLE2, - ID_KEY_HOLE3, - ID_KEY_HOLE4, - ID_KEY_HOLE5, - ID_KEY_HOLE6, - ID_KEY_HOLE7, - ID_KEY_HOLE8, - ID_SWITCH_TYPE1, - ID_SWITCH_TYPE2, - ID_SWITCH_TYPE3, - ID_SWITCH_TYPE4, - ID_SWITCH_TYPE5, - ID_SWITCH_TYPE6, - ID_SHOOT_SWITCH1, - ID_SHOOT_SWITCH2, - ID_AIRLOCK_SWITCH, - ID_UNDERWATER_SWITCH1, - ID_UNDERWATER_SWITCH2, - ID_TURN_SWITCH, - ID_COG_SWITCH, - ID_LEVER_SWITCH, - ID_JUMP_SWITCH, - ID_CROWBAR_SWITCH, - ID_PULLEY, - ID_CROWDOVE_SWITCH, - ID_DOOR_TYPE1, - ID_SARCOPHAGUS, // TR4 - OK - Needs testing - ID_DOOR_TYPE2, - ID_BIRD_BLADE, // TR4 - OK - ID_DOOR_TYPE3, - ID_KAYAK, // TR3 - 14 - ID_DOOR_TYPE4, - ID_KAYAK_LARA_ANIMS, // TR3 - OK - ID_DOOR_TYPE5, - ID_BOAT, // TR2 - 15 - ID_DOOR_TYPE6, - ID_BOAT_LARA_ANIMS, // TR2 - OK - ID_DOOR_TYPE7, - ID_TRIBESMAN_WITH_AX, // TR3 - OK - ID_DOOR_TYPE8, - ID_TRIBESMAN_WITH_DARTS, // TR3 - OK - ID_CLOSED_DOOR1, - ID_SCUBA_DIVER, // TR3 - OK - ID_CLOSED_DOOR2, - ID_CROW, // TR3 - OK - ID_CLOSED_DOOR3, - ID_TIGER, // TR3 - OK - ID_CLOSED_DOOR4, - ID_EAGLE, // TR3 - OK - ID_CLOSED_DOOR5, - ID_RAPTOR, // TR3 - OK - ID_CLOSED_DOOR6, - ID_TYRANNOSAUR, // TR3 - OK - ID_LIFT_DOORS1, - ID_COBRA, // TR3 - OK - ID_LIFT_DOORS2, - ID_MONKEY, // TR3 - OK - Needs testing - ID_PUSHPULL_DOOR1, - ID_MP_WITH_STICK, // TR3 - 60 - ID_PUSHPULL_DOOR2, - ID_MP_WITH_GUN, // TR3 - OK - Needs testing - ID_KICK_DOOR1, - ID_WALL_MOUNTED_BLADE, // TR3 - 111 - ID_KICK_DOOR2, - ID_SPIKY_WALL, // TR3 - OK - ID_UNDERWATER_DOOR, - ID_TO_REPLACE1, // TR3 - 127 - ID_DOUBLE_DOORS, - ID_FISH_EMITTER, // TR3 - 338 - OK - Needs testing and drawing - ID_SEQUENCE_DOOR1, - ID_SEQUENCE_SWITCH1, - ID_SEQUENCE_SWITCH2, - ID_SEQUENCE_SWITCH3, - ID_STEEL_DOOR, - ID_GOD_HEAD, - ID_PISTOLS_ITEM, - ID_PISTOLS_AMMO_ITEM, - ID_UZI_ITEM, - ID_UZI_AMMO_ITEM, - ID_SHOTGUN_ITEM, - ID_SHOTGUN_AMMO1_ITEM, - ID_SHOTGUN_AMMO2_ITEM, - ID_CROSSBOW_ITEM, - ID_CROSSBOW_AMMO1_ITEM, - ID_CROSSBOW_AMMO2_ITEM, - ID_CROSSBOW_BOLT, - ID_HK_ITEM, - ID_HK_AMMO_ITEM, - ID_REVOLVER_ITEM, - ID_REVOLVER_AMMO_ITEM, - ID_BIGMEDI_ITEM, - ID_SMALLMEDI_ITEM, - ID_LASERSIGHT_ITEM, - ID_BINOCULARS_ITEM, - ID_SILENCER_ITEM, - ID_FLARE_ITEM, - ID_FLARE_INV_ITEM, - ID_COMPASS_ITEM, - ID_INVENTORY_PASSPORT, - ID_INVENTORY_SUNGLASSES, - ID_INVENTORY_KEYS, - ID_INVENTORY_HEADPHONES, - ID_INVENTORY_POLAROID, - ID_OBELISK, // TR4 - ID_SMOKE_EMITTER_WHITE, - ID_SMOKE_EMITTER_BLACK, - ID_SMOKE_EMITTER, - ID_EARTHQUAKE, - ID_BUBBLES, - ID_WATERFALLMIST, - ID_GUNSHELL, - ID_SHOTGUNSHELL, - ID_GUN_FLASH, - ID_COLOR_LIGHT, - ID_BLINKING_LIGHT, - ID_PULSE_LIGHT, - ID_STROBE_LIGHT, - ID_ELECTRICAL_LIGHT, - ID_LENS_FLARE, - ID_AI_GUARD, - ID_AI_AMBUSH, - ID_AI_PATROL1, - ID_AI_MODIFY, - ID_AI_FOLLOW, - ID_AI_PATROL2, - ID_AI_X1, - ID_AI_X2, - ID_LARA_START_POS, - ID_TELEPORTER, - ID_LIFT_TELEPORTER, - ID_RAISING_COG, - ID_LASERS, - ID_STEAM_LASERS, - ID_FLOOR_LASERS, - ID_KILL_ALL_TRIGGERS, - ID_TRIGGER_TRIGGERER, - ID_HIGH_OBJECT1, - ID_HIGH_OBJECT2, - ID_SMASH_OBJECT1, - ID_SMASH_OBJECT2, - ID_SMASH_OBJECT3, - ID_SMASH_OBJECT4, - ID_SMASH_OBJECT5, - ID_SMASH_OBJECT6, - ID_SMASH_OBJECT7, - ID_SMASH_OBJECT8, - ID_MESHSWAP1, - ID_MESHSWAP2, - ID_MESHSWAP3, - ID_BODY_PART, - ID_CAMERA_TARGET, - ID_WATERFALL1, - ID_WATERFALL2, - ID_WATERFALL3, - ID_FISHTANK, - ID_WATERFALLSS1, - ID_WATERFALLSS2, - ID_ANIMATING1, - ID_BARRACUDA, // TR2 - OK - ID_ANIMATING2, - ID_MONK1, - ID_ANIMATING3, - ID_MONK2, - ID_ANIMATING4, - ID_DISK_SHOOTER, // TR2 - 62 - ID_ANIMATING5, - ID_DISK, // TR2 - 61 - ID_ANIMATING6, - ID_STATUE_WITH_BLADE, // TR2 - OK - ID_ANIMATING7, - ID_SPRINGBOARD, // TR2 - OK - ID_ANIMATING8, - ID_ROLLING_SPINDLE, // TR2 - OK - ID_ANIMATING9, - ID_WOLF, // TR1 - OK NEED TEST - ID_ANIMATING10, - ID_BEAR, // TR1 - OK NEED TEST - ID_ANIMATING11, - ID_APE, // TR1 - OK NEED TEST - ID_ANIMATING12, - ID_WINGED_MUMMY, // TR1 - 20 - ID_ANIMATING13, - ID_CENTAUR_MUTANT, // TR1 - 23 - ID_ANIMATING14, - ID_WINGED_NATLA, // TR1 - 33 - ID_ANIMATING15, - ID_GIANT_MUTANT, // TR1 - 34 - ID_ANIMATING16, - ID_SCUBA_HARPOON, // TR3 - OK - ID_BRIDGE_FLAT, - ID_BRIDGE_FLAT_MIP, - ID_BRIDGE_TILT1, - ID_BRIDGE_TILT1_MIP, - ID_BRIDGE_TILT2, - ID_BRIDGE_TILT2_MIP, - ID_HORIZON, - ID_SKY_GRAPHICS, - ID_BINOCULAR_GRAPHICS, - ID_TARGET_GRAPHICS, - ID_DEFAULT_SPRITES, - ID_MISC_SPRITES, - ID_ENERGY_BUBBLES, // TR4 - Energy attacks of harpy, demigod... - ID_GRENADE_ITEM, - ID_GRENADE_AMMO1_ITEM, - ID_GRENADE, - ID_GRENADE_ANIM, - ID_HARPOON_ITEM, - ID_HARPOON_AMMO_ITEM, - ID_HARPOON, - ID_HARPOON_ANIM, - ID_ROCKET_LAUNCHER_ITEM, - ID_ROCKET_LAUNCHER_AMMO_ITEM, - ID_ROCKET, - ID_ROCKET_ANIM, - ID_CROSSBOW_AMMO3_ITEM, - ID_GRENADE_AMMO2_ITEM, - ID_GRENADE_AMMO3_ITEM, - ID_GOLDROSE_ITEM, - ID_DIARY, - ID_VON_CROY, // TR4 - ID_SETHA, // TR4 - ID_KNIGHT_TEMPLAR, // TR4 - OK - ID_BIG_SCORPION, // TR4 - OK - ID_NEW_SLOT_482, - ID_AHMET, // TR4 - ID_LARA_DOUBLE, // TR4 - OK - Needs testing - ID_PLANET_EFFECT, // TR4 - ID_BUTTERFLY, // TR4 - ID_BIG_BEETLE, // TR4 - ID_VEHICLE_SMASHABLE_FLOOR, // TR4 - ID_VEHICLE_SMASHABLE_WALL, // TR4 - ID_SENTRY_GUN, // TR4 - OK - ID_MINE, // TR4 - OK - Needs testing - ID_MAPPER, // TR4 - ID_WHEEL_OF_FORTUNE, // TR4 - ID_LIGHTING_CONDUCTOR, // TR4 - ID_LOCUST_EMITTER, // TR4 - ID_SCALES, // TR4 - OK - Needs testing - ID_WATERSKIN1_EMPTY, // TR4 - OK - ID_WATERSKIN1_1, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN1_2, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN1_3, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_EMPTY, // TR4 - OK - ID_WATERSKIN2_1, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_2, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_3, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_4, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_5, // TR4 - OK - Needs testing and inventory handling - ID_LARA_WATER_MESH, // TR4 - ID_LARA_PETROL_MESH, // TR4 - ID_LARA_DIRT_MESH, // TR4 - ID_JEAN_YVES, // TR4 - OK - Needs testing - ID_TROOPS, // TR4 - OK - Needs testing - ID_WRAITH1, // TR4 - ID_WRAITH2, // TR4 - ID_WRAITH3, // TR4 - ID_WRAITH4, // TR4 - ID_CLOCKWORK_BEETLE, // TR4 - ID_CLOCKWORK_BEETLE_COMBO1, // TR4 - ID_CLOCKWORK_BEETLE_COMBO2, // TR4 - ID_PROJ_NATLA, // TR1 - OFF - ID_PROJ_SHARD, // TR1 - OFF - ID_PROJ_BOMB, // TR1 - OFF - ID_EVIL_LARA, // TR1 - OFF (Cant be targeted (if enabled, evil lara die anim is played)) (cant move for now) - ID_NATLA, // TR1 - OFF - ID_GOON_SILENCER1, // TR2 - ON - ID_GOON_SILENCER2, // TR2 - ON - ID_GOON_SILENCER3, // TR2 - ON - ID_WORKER_SHOTGUN, // TR2 - ON - ID_WORKER_MACHINEGUN, // TR2 - ON - ID_WORKER_DUAL_REVOLVER, // TR2 - ON - ID_WORKER_FLAMETHROWER, // TR2 - ON - ID_SMALL_SPIDER, // TR2 - ON - ID_BIG_SPIDER, // TR2 - ON - ID_TONY_BOSS, // TR3 - 90% (need effect) - ID_BIRDMONSTER, // TR2 - ON - ID_KNIFETHROWER, // TR2 - (Crash the game when shooting) - ID_KNIFETHROWER_KNIFE, // TR2 - ON - ID_MERCENARY_UZI, // TR2 - ON (Need to detect the monk first) - ID_MERCENARY_AUTOPISTOLS1, // TR2 - ON (Need to detect the monk first) - ID_MERCENARY_AUTOPISTOLS2, // TR2 - ON (Need to detect the monk first) - ID_SWORD_GUARDIAN, // TR2 - ON (blocked if the floor are 2+ click and currently flying) (need a custom render) - ID_SWORD_GUARDIAN_STATUE, // TR2 - ON - ID_SPEAR_GUARDIAN, // TR2 - ON (need a custom render) - ID_SPEAR_GUARDIAN_STATUE, // TR2 - ON - ID_SHIVA, // TR3 - (Need Test) - ID_SHIVA_STATUE, // TR3 - (Need Test) - ID_DRAGON_FRONT, // TR2 - (Need Test) (Need flame effect) (Need Explosion Effect (TR2 one)) (spawned by MARCO_BARTOLI) - ID_DRAGON_BACK, // TR2 - (Need Test) - ID_DRAGON_BONE_FRONT, // TR2 - ON - ID_DRAGON_BONE_BACK, // TR2 - ON - ID_SPHERE_OF_DOOM, // TR2 - 209 (Dragon Explosion Effect 1) - ID_SPHERE_OF_DOOM2, // TR2 - 210 (Dragon Explosion Effect 2) - ID_SPHERE_OF_DOOM3, // TR2 - 211 (Dragon Explosion Effect 3) - ID_MARCO_BARTOLI, // TR2 - (Need Test) - ID_SNOWMOBILE_GUN, // TR2 - (Need Test) - ID_SNOWMOBILE_DRIVER, // TR2 - (Need Test) - ID_MINECART, // TR3 - (Need Test) - ID_MINECART_LARA_ANIMS, // TR3 - (Need Test) - ID_UPV, // TR3 - 90% (Need new render) (lara cant enter) - ID_UPV_LARA_ANIMS, // TR3 - ON - ID_LASER_BOLT, // TR3 - OFF (Boss Laser Bolt) - ID_DIVER, // TR3 - OFF - ID_WHALE, // TR3 - OFF - ID_WILLARD_BOSS, // TR3 - OFF - ID_WHITE_SOLDIER, // TR3 - OFF (Oil-SMG) - ID_MUTANT1, // TR3 - OFF (Wingmute) - ID_MUTANT2, // TR3 - OFF (Claw Mutant) - ID_MUTANT3, // TR3 - OFF (Hybrid Mutant) - ID_BURNT_MUTANT, // TR3 - OFF (Seal Mutant) - ID_SWAT_GUN, // TR3 - OFF - ID_STHPAC_MERCENARY, // TR3 - OFF - ID_LIZARD_MAN, // TR3 - OFF - ID_MP1, // TR3 - OFF (Area 51 Baton Man) - ID_MP2, // TR3 - OFF (Area 51 Pistol MP) - ID_CIVVIE, // TR3 - OFF - ID_PRISONER, // TR3 - OFF (Area 51 Prisoner) - ID_SECURITY_GUARD, // TR3 - OFF - ID_ELECTRIC_CLEANER, // TR3 - OFF - ID_LON_MERCENARY1, // TR3 - OFF - ID_PUNK1, // TR3 - OFF - ID_WINSTON, // TR3 - OFF - ID_ARMY_WINSTON, // TR3 - OFF - ID_TARGETS, // TR3 - OFF - ID_SMALL_DINOSAUR, // TR3 - 34 - ID_LIZARD_THING, // TR3 - 35 - ID_PUNA_BOSS, // TR3 - 36 - ID_SOPHIA_LEE_BOSS, // TR3 - 57 - ID_EXAMINE1_COMBO1, - ID_EXAMINE1_COMBO2, - ID_EXAMINE2_COMBO1, - ID_EXAMINE2_COMBO2, - ID_EXAMINE3_COMBO1, - ID_EXAMINE3_COMBO2, - ID_CIVVY, // TR3 - ID_NUMBER_OBJECTS -}; - -#define NUM_PUZZLES (ID_PUZZLE_ITEM8 - ID_PUZZLE_ITEM1 + 1) -#define NUM_KEYS (ID_KEY_ITEM8 - ID_KEY_ITEM1 + 1) -#define NUM_PICKUPS (ID_PICKUP_ITEM4 - ID_PICKUP_ITEM1 + 1) -#define NUM_EXAMINES (ID_EXAMINE3 - ID_EXAMINE1 + 1) - -#else -typedef enum GAME_OBJECT_ID -{ - /* Lara Primary Slot */ - ID_LARA, - ID_LARA_EXTRA_ANIMS, - ID_PISTOLS_ANIM, - ID_UZI_ANIM, - ID_SHOTGUN_ANIM, - ID_REVOLVER_ANIM, - ID_CROSSBOW_ANIM, - ID_HK_ANIM, - ID_GRENADE_ANIM, - ID_ROCKET_ANIM, - ID_HARPOON_ANIM, - ID_LARA_FLARE_ANIM, - ID_LARA_SKIN, - ID_LARA_SKIN_JOINTS, - ID_LARA_SCREAM, - ID_LARA_CROSSBOW_LASER, - ID_LARA_REVOLVER_LASER, - ID_LARA_HOLSTERS, - ID_LARA_HOLSTERS_PISTOLS, - ID_LARA_HOLSTERS_UZIS, - ID_LARA_HOLSTERS_REVOLVER, - ID_LARA_SPEECH_HEAD1, - ID_LARA_SPEECH_HEAD2, - ID_LARA_SPEECH_HEAD3, - ID_LARA_SPEECH_HEAD4, - ID_ACTOR1_SPEECH_HEAD1, - ID_ACTOR1_SPEECH_HEAD2, - ID_ACTOR2_SPEECH_HEAD1, - ID_ACTOR2_SPEECH_HEAD2, - ID_LARA_EXTRA_MESH1, - ID_LARA_EXTRA_MESH2, - ID_LARA_EXTRA_MESH3, - ID_LARA_WATER_MESH, - ID_LARA_PETROL_MESH, - ID_LARA_DIRT_MESH, - ID_LARA_CROWBAR_ANIM, - ID_LARA_TORCH_ANIM, - ID_LARA_HAIR, - - /* Lara Vehicles */ - ID_SNOWMOBILE_LARA_ANIMS = 50, - ID_SNOWMOBILE, - ID_QUAD_LARA_ANIMS, - ID_QUAD, - ID_SPEEDBOAT_LARA_ANIMS, - ID_SPEEDBOAT, - ID_KAYAK_LARA_ANIMS, - ID_KAYAK, - ID_UPV_LARA_ANIMS, - ID_UPV, // TR3 - 90% (Need new render) (lara cant enter) - ID_MINECART_LARA_ANIMS, - ID_MINECART, - ID_JEEP_LARA_ANIMS, - ID_JEEP, // TR4 - 95% Working - ID_MOTORBIKE_LARA_ANIMS, - ID_MOTORBIKE, - ID_RUBBER_BOAT_LARA_ANIMS, - ID_RUBBER_BOAT_BOAT, - - ID_VEHICLE_SMASHABLE_FLOOR = 90, // NEW - ID_VEHICLE_SMASHABLE_WALL, // NEW - - /* Enemy */ - - /* Animals */ - ID_WOLF = 100, - ID_BEAR, - ID_APE, - ID_SMALL_SPIDER, - ID_BIG_SPIDER, - ID_CROW, - ID_TIGER, - ID_EAGLE, - ID_RAPTOR, - ID_TYRANNOSAUR, - ID_COBRA, - ID_MONKEY, - ID_WHALE, - ID_SMALL_DINOSAUR, // TR3 - 34 - ID_FISH_EMITTER, // TR3 - 338 - OK - Needs testing and drawing - ID_RAT, - ID_CROCODILE, - ID_BAT, - ID_SPHINX, - ID_WILD_BOAR, - ID_HARPY, - ID_BIG_SCORPION, - ID_SMALL_SCORPION, - ID_BABOON_NORMAL, - ID_BABOON_INV, - ID_BABOON_SILENT, - ID_LITTLE_BEETLE, - ID_LOCUSTS, - ID_SHARK, - ID_HUSKIE, - ID_DOG, - ID_BATS_EMITTER, - ID_RATS_EMITTER, - ID_SPIDERS_EMITTER, - ID_LION, - ID_DOBERMAN, - - /* Humans */ - ID_SCUBA_HARPOON = 150, - ID_SCUBA_DIVER, - ID_GOON_SILENCER1, - ID_GOON_SILENCER2, - ID_GOON_SILENCER3, - ID_BARRACUDA, - ID_WORKER_SHOTGUN, - ID_WORKER_MACHINEGUN, - ID_WORKER_DUAL_REVOLVER, - ID_WORKER_FLAMETHROWER, - ID_MONK1, - ID_MONK2, - ID_KNIFETHROWER, - ID_KNIFETHROWER_KNIFE, - ID_MERCENARY_UZI, - ID_MERCENARY_AUTOPISTOLS1, - ID_MERCENARY_AUTOPISTOLS2, - ID_SNOWMOBILE_GUN, - ID_SNOWMOBILE_DRIVER, - ID_FLAMETHROWER_BADDY, - ID_TRIBESMAN_WITH_AX, - ID_TRIBESMAN_WITH_DARTS, - ID_MP_WITH_STICK, - ID_MP_WITH_GUN, - ID_BADDY1, - ID_BADDY2, - ID_SAS_CAIRO, - ID_SAS_DYING, - ID_SAS_CAPTAIN, - ID_SAS_DRAG_BLOKE, - ID_GUIDE, - ID_VON_CROY, - ID_TROOPS, // TR4 - OK - Needs testing - ID_SAS, - ID_SWAT, - ID_SWAT_PLUS, - ID_GUARD1, - ID_GUARD_LASER, - ID_LARSON, - ID_PIERRE, - ID_MAFIA, - ID_MAFIA2, - ID_GUARD2, - ID_GUARD3, - ID_GLADIATOR, - ID_HITMAN, - ID_SNIPER, - ID_CHEF, - - /* Soprannatural, boss and others */ - ID_WINGED_MUMMY = 220, - ID_CENTAUR_MUTANT, - ID_EVIL_LARA, - ID_NATLA, - ID_WINGED_NATLA, - ID_GIANT_MUTANT, - ID_PROJ_NATLA, - ID_PROJ_SHARD, - ID_PROJ_BOMB, - ID_YETI, - ID_BIRDMONSTER, - ID_MARCO_BARTOLI, - ID_DRAGON_FRONT, - ID_DRAGON_BACK, - ID_DRAGON_BONE_FRONT, - ID_DRAGON_BONE_BACK, - ID_SPHERE_OF_DOOM, // Used by the dragon/boss to appear or death explosion. - ID_SPHERE_OF_DOOM2, - ID_SPHERE_OF_DOOM3, - ID_CIVVIE, - ID_SPEAR_GUARDIAN, - ID_SPEAR_GUARDIAN_STATUE, - ID_SWORD_GUARDIAN, - ID_SWORD_GUARDIAN_STATUE, - ID_SHIVA, - ID_SHIVA_STATUE, - ID_TRIBEBOSS, - ID_CIVVY, - ID_MUTANT2, - ID_LIZARD, // TR3 - 35 - ID_TONY_BOSS, // TR3 - Not Finished - ID_TONY_BOSS_FLAME, // TR3 Tony Flame Controller - ID_PUNA_BOSS, // TR3 - 36 - ID_SOPHIA_LEE_BOSS, // TR3 - 57 - ID_LASER_BOLT, - ID_SKELETON, - ID_MUMMY, - ID_ENEMY_JEEP, - ID_HORSE, - ID_HORSEMAN, - ID_DEMIGOD1, - ID_DEMIGOD2, - ID_DEMIGOD3, - ID_SETHA, - ID_KNIGHT_TEMPLAR, - ID_AHMET, - ID_BIG_BEETLE, - ID_JEAN_YVES, // TR4 - OK - Needs testing - ID_WRAITH1, - ID_WRAITH2, - ID_WRAITH3, - ID_WRAITH4, - ID_LARA_DOUBLE, // TR4 - OK - Needs testing - ID_COMPY, - ID_HYDRA, - ID_GUARDIAN, - ID_SCIENTIST, - ID_MERCENARY, - ID_WILLOWISP, - ID_INVISIBLE_GHOST, - ID_REAPER, - ID_BROWN_BEAST, - ID_ATTACK_SUB, - ID_IMP, - ID_IMP_ROCK, // maybe needed for imp so moved here ! - ID_GUNSHIP, - ID_AUTOGUN, - ID_ROMAN_GOD1, - ID_ROMAN_GOD2, - ID_LAGOON_WITCH, - ID_BOSS_SHIELD, - ID_BOSS_EXPLOSION_SHOCKWAVE, - ID_BOSS_EXPLOSION_RING, - - /* Traps / Doors */ - ID_SPRINGBOARD = 320, - ID_ROLLING_SPINDLE, - ID_DISK_SHOOTER, - ID_DISK, - ID_WALL_MOUNTED_BLADE, // TR3 - 111 - ID_STATUE_WITH_BLADE, - ID_COG, - ID_SPIKEBALL, - ID_FLOOR_4BLADES, - ID_CEILING_4BLADES, - ID_CATWALK_BLADE, - ID_SETH_BLADE, - ID_PLINTH_BLADE, - ID_SLICER_DICER, // TR4 - OK - Needs testing - ID_BIRD_BLADE, - ID_CHAIN, - ID_PLOUGH, - ID_STARGATE, - ID_SPIKY_FLOOR, - ID_SPIKY_WALL, - ID_SPIKY_CEILING, - ID_TEETH_SPIKES, - ID_JOBY_SPIKES, - ID_SENTRY_GUN, - ID_MAPPER, - ID_MOVING_BLADE, - ID_ELEMENT_PUZZLE, - ID_LIGHTING_CONDUCTOR, - ID_HAMMER, - ID_OBELISK, - ID_WHEEL_OF_FORTUNE, - ID_GAME_PIECE1, - ID_GAME_PIECE2, - ID_GAME_PIECE3, - ID_RAISING_COG, - ID_MINE, // TR4 - OK - Needs testing - ID_SCALES, // TR4 - OK - Needs testing - ID_ROME_HAMMER, - ID_FLAME, - ID_FLAME_EMITTER, - ID_FLAME_EMITTER2, - ID_FLAME_EMITTER3, - ID_BURNING_ROOTS, - ID_ROPE, - ID_FIREROPE, - ID_POLEROPE, - ID_ELECTRICAL_CABLES, - ID_BURNING_FLOOR, - ID_DARTS, - ID_DART_EMITTER, - ID_HOMING_DART_EMITTER, - ID_FALLING_CEILING, - ID_FALLING_BLOCK, - ID_FALLING_BLOCK2, - ID_CRUMBLING_FLOOR, - ID_TRAPDOOR1, - ID_TRAPDOOR2, - ID_TRAPDOOR3, - ID_FLOOR_TRAPDOOR1, - ID_FLOOR_TRAPDOOR2, - ID_CEILING_TRAPDOOR1, - ID_CEILING_TRAPDOOR2, - ID_SCALING_TRAPDOOR, - ID_ROLLINGBALL, - ID_ROLLINGBARREL, - ID_PROPELLER_H, - ID_PROPELLER_V, - ID_ONEBLOCK_PLATFORM, - ID_TWOBLOCK_PLATFORM, - ID_RAISING_BLOCK1, - ID_RAISING_BLOCK2, - ID_RAISING_BLOCK3, - ID_RAISING_BLOCK4, - ID_PUSHABLE_OBJECT1, - ID_PUSHABLE_OBJECT2, - ID_PUSHABLE_OBJECT3, - ID_PUSHABLE_OBJECT4, - ID_PUSHABLE_OBJECT5, - ID_PUSHABLE_OBJECT6, - ID_PUSHABLE_OBJECT7, - ID_PUSHABLE_OBJECT8, - ID_PUSHABLE_OBJECT9, - ID_PUSHABLE_OBJECT10, - ID_WRECKING_BALL, - ID_ZIPLINE_HANDLE, - ID_TORPEDO, - ID_CHAFF, - ID_ELECTRIC_FENCE, - ID_LIFT, - ID_TIGHT_ROPE, - ID_PARALLEL_BARS, - ID_XRAY_CONTROLLER, - ID_PORTAL, - ID_GEN_SLOT1, - ID_GEN_SLOT2, - ID_GEN_SLOT3, - ID_GEN_SLOT4, - - /* Searchable Objects */ - ID_SEARCH_OBJECT1, - ID_SEARCH_OBJECT2, - ID_SEARCH_OBJECT3, - ID_SEARCH_OBJECT4, - ID_SARCOPHAGUS, - - ID_ENEMY_PIECE, // NEW - ID_EXPANDING_PLATFORM, // NEW - ID_SQUISHY_BLOCK1, // NEW - ID_SQUISHY_BLOCK2, // NEW - ID_TRIPWIRE, // NEW - ID_MINE_DETECTOR, // NEW - ID_MAP, // NEW - ID_SECRET_MAP, // NEW - ID_SETH_DOOR, // NEW - ID_HORUS_STATUE, // NEW - ID_STATUE_PLINTH, // NEW - - /* Items */ - ID_PUZZLE_ITEM1 = 500, - ID_PUZZLE_ITEM2, - ID_PUZZLE_ITEM3, - ID_PUZZLE_ITEM4, - ID_PUZZLE_ITEM5, - ID_PUZZLE_ITEM6, - ID_PUZZLE_ITEM7, - ID_PUZZLE_ITEM8, - ID_PUZZLE_ITEM9, - ID_PUZZLE_ITEM10, - ID_PUZZLE_ITEM11, - ID_PUZZLE_ITEM12, - ID_PUZZLE_ITEM13, - ID_PUZZLE_ITEM14, - ID_PUZZLE_ITEM15, - ID_PUZZLE_ITEM16, - ID_PUZZLE_ITEM1_COMBO1, - ID_PUZZLE_ITEM1_COMBO2, - ID_PUZZLE_ITEM2_COMBO1, - ID_PUZZLE_ITEM2_COMBO2, - ID_PUZZLE_ITEM3_COMBO1, - ID_PUZZLE_ITEM3_COMBO2, - ID_PUZZLE_ITEM4_COMBO1, - ID_PUZZLE_ITEM4_COMBO2, - ID_PUZZLE_ITEM5_COMBO1, - ID_PUZZLE_ITEM5_COMBO2, - ID_PUZZLE_ITEM6_COMBO1, - ID_PUZZLE_ITEM6_COMBO2, - ID_PUZZLE_ITEM7_COMBO1, - ID_PUZZLE_ITEM7_COMBO2, - ID_PUZZLE_ITEM8_COMBO1, - ID_PUZZLE_ITEM8_COMBO2, - ID_PUZZLE_ITEM9_COMBO1, - ID_PUZZLE_ITEM9_COMBO2, - ID_PUZZLE_ITEM10_COMBO1, - ID_PUZZLE_ITEM10_COMBO2, - ID_PUZZLE_ITEM11_COMBO1, - ID_PUZZLE_ITEM11_COMBO2, - ID_PUZZLE_ITEM12_COMBO1, - ID_PUZZLE_ITEM12_COMBO2, - ID_PUZZLE_ITEM13_COMBO1, - ID_PUZZLE_ITEM13_COMBO2, - ID_PUZZLE_ITEM14_COMBO1, - ID_PUZZLE_ITEM14_COMBO2, - ID_PUZZLE_ITEM15_COMBO1, - ID_PUZZLE_ITEM15_COMBO2, - ID_PUZZLE_ITEM16_COMBO1, - ID_PUZZLE_ITEM16_COMBO2, - ID_KEY_ITEM1, - ID_KEY_ITEM2, - ID_KEY_ITEM3, - ID_KEY_ITEM4, - ID_KEY_ITEM5, - ID_KEY_ITEM6, - ID_KEY_ITEM7, - ID_KEY_ITEM8, - ID_KEY_ITEM9, - ID_KEY_ITEM10, - ID_KEY_ITEM11, - ID_KEY_ITEM12, - ID_KEY_ITEM13, - ID_KEY_ITEM14, - ID_KEY_ITEM15, - ID_KEY_ITEM16, - ID_KEY_ITEM1_COMBO1, - ID_KEY_ITEM1_COMBO2, - ID_KEY_ITEM2_COMBO1, - ID_KEY_ITEM2_COMBO2, - ID_KEY_ITEM3_COMBO1, - ID_KEY_ITEM3_COMBO2, - ID_KEY_ITEM4_COMBO1, - ID_KEY_ITEM4_COMBO2, - ID_KEY_ITEM5_COMBO1, - ID_KEY_ITEM5_COMBO2, - ID_KEY_ITEM6_COMBO1, - ID_KEY_ITEM6_COMBO2, - ID_KEY_ITEM7_COMBO1, - ID_KEY_ITEM7_COMBO2, - ID_KEY_ITEM8_COMBO1, - ID_KEY_ITEM8_COMBO2, - ID_KEY_ITEM9_COMBO1, - ID_KEY_ITEM9_COMBO2, - ID_KEY_ITEM10_COMBO1, - ID_KEY_ITEM10_COMBO2, - ID_KEY_ITEM11_COMBO1, - ID_KEY_ITEM11_COMBO2, - ID_KEY_ITEM12_COMBO1, - ID_KEY_ITEM12_COMBO2, - ID_KEY_ITEM13_COMBO1, - ID_KEY_ITEM13_COMBO2, - ID_KEY_ITEM14_COMBO1, - ID_KEY_ITEM14_COMBO2, - ID_KEY_ITEM15_COMBO1, - ID_KEY_ITEM15_COMBO2, - ID_KEY_ITEM16_COMBO1, - ID_KEY_ITEM16_COMBO2, - ID_PICKUP_ITEM1, - ID_PICKUP_ITEM2, - ID_PICKUP_ITEM3, - ID_PICKUP_ITEM4, - ID_PICKUP_ITEM5, - ID_PICKUP_ITEM6, - ID_PICKUP_ITEM7, - ID_PICKUP_ITEM8, - ID_PICKUP_ITEM9, - ID_PICKUP_ITEM10, - ID_PICKUP_ITEM11, - ID_PICKUP_ITEM12, - ID_PICKUP_ITEM13, - ID_PICKUP_ITEM14, - ID_PICKUP_ITEM15, - ID_PICKUP_ITEM16, - ID_PICKUP_ITEM1_COMBO1, - ID_PICKUP_ITEM1_COMBO2, - ID_PICKUP_ITEM2_COMBO1, - ID_PICKUP_ITEM2_COMBO2, - ID_PICKUP_ITEM3_COMBO1, - ID_PICKUP_ITEM3_COMBO2, - ID_PICKUP_ITEM4_COMBO1, - ID_PICKUP_ITEM4_COMBO2, - ID_PICKUP_ITEM5_COMBO1, - ID_PICKUP_ITEM5_COMBO2, - ID_PICKUP_ITEM6_COMBO1, - ID_PICKUP_ITEM6_COMBO2, - ID_PICKUP_ITEM7_COMBO1, - ID_PICKUP_ITEM7_COMBO2, - ID_PICKUP_ITEM8_COMBO1, - ID_PICKUP_ITEM8_COMBO2, - ID_PICKUP_ITEM9_COMBO1, - ID_PICKUP_ITEM9_COMBO2, - ID_PICKUP_ITEM10_COMBO1, - ID_PICKUP_ITEM10_COMBO2, - ID_PICKUP_ITEM11_COMBO1, - ID_PICKUP_ITEM11_COMBO2, - ID_PICKUP_ITEM12_COMBO1, - ID_PICKUP_ITEM12_COMBO2, - ID_PICKUP_ITEM13_COMBO1, - ID_PICKUP_ITEM13_COMBO2, - ID_PICKUP_ITEM14_COMBO1, - ID_PICKUP_ITEM14_COMBO2, - ID_PICKUP_ITEM15_COMBO1, - ID_PICKUP_ITEM15_COMBO2, - ID_PICKUP_ITEM16_COMBO1, - ID_PICKUP_ITEM16_COMBO2, - ID_EXAMINE1, - ID_EXAMINE2, - ID_EXAMINE3, - ID_EXAMINE4, - ID_EXAMINE5, - ID_EXAMINE6, - ID_EXAMINE7, - ID_EXAMINE8, - ID_EXAMINE1_COMBO1, - ID_EXAMINE1_COMBO2, - ID_EXAMINE2_COMBO1, - ID_EXAMINE2_COMBO2, - ID_EXAMINE3_COMBO1, - ID_EXAMINE3_COMBO2, - ID_EXAMINE4_COMBO1, - ID_EXAMINE4_COMBO2, - ID_EXAMINE5_COMBO1, - ID_EXAMINE5_COMBO2, - ID_EXAMINE6_COMBO1, - ID_EXAMINE6_COMBO2, - ID_EXAMINE7_COMBO1, - ID_EXAMINE7_COMBO2, - ID_EXAMINE8_COMBO1, - ID_EXAMINE8_COMBO2, - ID_PUZZLE_HOLE1, - ID_PUZZLE_HOLE2, - ID_PUZZLE_HOLE3, - ID_PUZZLE_HOLE4, - ID_PUZZLE_HOLE5, - ID_PUZZLE_HOLE6, - ID_PUZZLE_HOLE7, - ID_PUZZLE_HOLE8, - ID_PUZZLE_HOLE9, - ID_PUZZLE_HOLE10, - ID_PUZZLE_HOLE11, - ID_PUZZLE_HOLE12, - ID_PUZZLE_HOLE13, - ID_PUZZLE_HOLE14, - ID_PUZZLE_HOLE15, - ID_PUZZLE_HOLE16, - ID_PUZZLE_DONE1, - ID_PUZZLE_DONE2, - ID_PUZZLE_DONE3, - ID_PUZZLE_DONE4, - ID_PUZZLE_DONE5, - ID_PUZZLE_DONE6, - ID_PUZZLE_DONE7, - ID_PUZZLE_DONE8, - ID_PUZZLE_DONE9, - ID_PUZZLE_DONE10, - ID_PUZZLE_DONE11, - ID_PUZZLE_DONE12, - ID_PUZZLE_DONE13, - ID_PUZZLE_DONE14, - ID_PUZZLE_DONE15, - ID_PUZZLE_DONE16, - ID_KEY_HOLE1, - ID_KEY_HOLE2, - ID_KEY_HOLE3, - ID_KEY_HOLE4, - ID_KEY_HOLE5, - ID_KEY_HOLE6, - ID_KEY_HOLE7, - ID_KEY_HOLE8, - ID_KEY_HOLE9, - ID_KEY_HOLE10, - ID_KEY_HOLE11, - ID_KEY_HOLE12, - ID_KEY_HOLE13, - ID_KEY_HOLE14, - ID_KEY_HOLE15, - ID_KEY_HOLE16, - ID_WATERSKIN1_EMPTY, - ID_WATERSKIN1_1, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN1_2, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN1_3, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_EMPTY, - ID_WATERSKIN2_1, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_2, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_3, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_4, // TR4 - OK - Needs testing and inventory handling - ID_WATERSKIN2_5, // TR4 - OK - Needs testing and inventory handling - - /* Misc inventory objects */ - ID_HAMMER_ITEM = 750, - ID_CROWBAR_ITEM, - ID_BURNING_TORCH_ITEM, - ID_CLOCKWORK_BEETLE, - ID_CLOCKWORK_BEETLE_COMBO1, - ID_CLOCKWORK_BEETLE_COMBO2, - - /* Switches */ - ID_SWITCH_TYPE1 = 800, - ID_SWITCH_TYPE2, - ID_SWITCH_TYPE3, - ID_SWITCH_TYPE4, - ID_SWITCH_TYPE5, - ID_SWITCH_TYPE6, - ID_SWITCH_TYPE7, - ID_SWITCH_TYPE8, - ID_SWITCH_TYPE9, - ID_SWITCH_TYPE10, - ID_SWITCH_TYPE11, - ID_SWITCH_TYPE12, - ID_SWITCH_TYPE13, - ID_SWITCH_TYPE14, - ID_SWITCH_TYPE15, - ID_SWITCH_TYPE16, - ID_SHOOT_SWITCH1, - ID_SHOOT_SWITCH2, - ID_SHOOT_SWITCH3, - ID_SHOOT_SWITCH4, - ID_AIRLOCK_SWITCH, - ID_UNDERWATER_SWITCH1, - ID_UNDERWATER_SWITCH2, - ID_UNDERWATER_SWITCH3, - ID_UNDERWATER_SWITCH4, - ID_TURN_SWITCH, - ID_COG_SWITCH, - ID_LEVER_SWITCH, - ID_JUMP_SWITCH, - ID_CROWBAR_SWITCH, - ID_PULLEY, - ID_CROWDOVE_SWITCH, - - ID_DOOR_TYPE1 = 850, - ID_DOOR_TYPE2, - ID_DOOR_TYPE3, - ID_DOOR_TYPE4, - ID_DOOR_TYPE5, - ID_DOOR_TYPE6, - ID_DOOR_TYPE7, - ID_DOOR_TYPE8, - ID_DOOR_TYPE9, - ID_DOOR_TYPE10, - ID_DOOR_TYPE11, - ID_DOOR_TYPE12, - ID_DOOR_TYPE13, - ID_DOOR_TYPE14, - ID_DOOR_TYPE15, - ID_DOOR_TYPE16, - ID_DOOR_TYPE17, - ID_DOOR_TYPE18, - ID_DOOR_TYPE19, - ID_DOOR_TYPE20, - ID_DOOR_TYPE21, - ID_DOOR_TYPE22, - ID_DOOR_TYPE23, - ID_DOOR_TYPE24, - ID_CLOSED_DOOR1, - ID_CLOSED_DOOR2, - ID_CLOSED_DOOR3, - ID_CLOSED_DOOR4, - ID_CLOSED_DOOR5, - ID_CLOSED_DOOR6, - ID_LIFT_DOORS1, - ID_LIFT_DOORS2, - ID_PUSHPULL_DOOR1, - ID_PUSHPULL_DOOR2, - ID_PUSHPULL_DOOR3, - ID_PUSHPULL_DOOR4, - ID_KICK_DOOR1, - ID_KICK_DOOR2, - ID_KICK_DOOR3, - ID_KICK_DOOR4, - ID_UNDERWATER_DOOR1, // NEW - ID_UNDERWATER_DOOR2, - ID_UNDERWATER_DOOR3, - ID_UNDERWATER_DOOR4, - ID_DOUBLE_DOORS1, - ID_DOUBLE_DOORS2, - ID_DOUBLE_DOORS3, - ID_DOUBLE_DOORS4, - ID_SEQUENCE_DOOR1, - ID_SEQUENCE_SWITCH1, - ID_SEQUENCE_SWITCH2, - ID_SEQUENCE_SWITCH3, - ID_STEEL_DOOR, - ID_GOD_HEAD, - - /* Lara Items */ - ID_PISTOLS_ITEM = 950, - ID_PISTOLS_AMMO_ITEM, - ID_UZI_ITEM, - ID_UZI_AMMO_ITEM, - ID_SHOTGUN_ITEM, - ID_SHOTGUN_AMMO1_ITEM, - ID_SHOTGUN_AMMO2_ITEM, - ID_REVOLVER_ITEM, - ID_REVOLVER_AMMO_ITEM, - ID_CROSSBOW_ITEM, - ID_CROSSBOW_AMMO1_ITEM, - ID_CROSSBOW_AMMO2_ITEM, - ID_CROSSBOW_AMMO3_ITEM, - ID_CROSSBOW_BOLT, - ID_HK_ITEM, - ID_HK_AMMO_ITEM, - ID_GRENADE_GUN_ITEM, - ID_GRENADE_AMMO1_ITEM, - ID_GRENADE_AMMO2_ITEM, - ID_GRENADE_AMMO3_ITEM, - ID_GRENADE, - ID_ROCKET_LAUNCHER_ITEM, - ID_ROCKET_LAUNCHER_AMMO_ITEM, - ID_ROCKET, - ID_HARPOON_ITEM, - ID_HARPOON_AMMO_ITEM, - ID_HARPOON, - ID_GOLDROSE_ITEM, - ID_BIGMEDI_ITEM, - ID_SMALLMEDI_ITEM, - ID_LASERSIGHT_ITEM, - ID_BINOCULARS_ITEM, - ID_SILENCER_ITEM, - ID_FLARE_ITEM, - ID_FLARE_INV_ITEM, - ID_COMPASS_ITEM, - ID_DIARY_ITEM, - - /* Inventory main objects */ - ID_INVENTORY_PASSPORT = 1000, - ID_INVENTORY_SUNGLASSES, - ID_INVENTORY_KEYS, - ID_INVENTORY_HEADPHONES, - ID_INVENTORY_POLAROID, - - /* other effect in-game */ - ID_SMOKE_EMITTER_WHITE = 1020, - ID_SMOKE_EMITTER_BLACK, - ID_SMOKE_EMITTER, - ID_LOCUST_EMITTER, - ID_EARTHQUAKE, - ID_BUBBLES, - ID_WATERFALLMIST, - ID_GUNSHELL, - ID_SHOTGUNSHELL, - ID_GUN_FLASH, - ID_GUN_FLASH2, // used for M16/MP5/HK - ID_COLOR_LIGHT, - ID_BLINKING_LIGHT, - ID_PULSE_LIGHT, - ID_STROBE_LIGHT, - ID_ELECTRICAL_LIGHT, - ID_LENS_FLARE, - ID_ENERGY_BUBBLES, - ID_PLANET_EFFECT, - ID_BUTTERFLY, - ID_AI_GUARD, - ID_AI_AMBUSH, - ID_AI_PATROL1, - ID_AI_MODIFY, - ID_AI_FOLLOW, - ID_AI_PATROL2, - ID_AI_X1, - ID_AI_X2, - ID_LARA_START_POS, - ID_TELEPORTER, - ID_LIFT_TELEPORTER, - ID_LASERS, - ID_STEAM_LASERS, - ID_FLOOR_LASERS, - ID_KILL_ALL_TRIGGERS, - ID_TRIGGER_TRIGGERER, - ID_HIGH_OBJECT1, - ID_HIGH_OBJECT2, - ID_SMASH_OBJECT1, - ID_SMASH_OBJECT2, - ID_SMASH_OBJECT3, - ID_SMASH_OBJECT4, - ID_SMASH_OBJECT5, - ID_SMASH_OBJECT6, - ID_SMASH_OBJECT7, - ID_SMASH_OBJECT8, - ID_SMASH_OBJECT9, - ID_SMASH_OBJECT10, - ID_SMASH_OBJECT11, - ID_SMASH_OBJECT12, - ID_SMASH_OBJECT13, - ID_SMASH_OBJECT14, - ID_SMASH_OBJECT15, - ID_SMASH_OBJECT16, - ID_BODY_PART, - ID_CAMERA_TARGET, - ID_WATERFALL1, - ID_WATERFALL2, - ID_WATERFALL3, - ID_WATERFALL4, - ID_WATERFALL5, - ID_WATERFALL6, - ID_WATERFALLSS1, - ID_WATERFALLSS2, - ID_FISHTANK, - - ID_MESHSWAP1 = 1100, - ID_MESHSWAP2, - ID_MESHSWAP3, - ID_MESHSWAP4, - ID_MESHSWAP5, - ID_MESHSWAP6, - ID_MESHSWAP7, - ID_MESHSWAP8, - ID_MESHSWAP9, - ID_MESHSWAP10, - ID_MESHSWAP_BADDY1, - ID_MESHSWAP_BADDY2, - ID_MESHSWAP_MAFIA2 = 1113, - ID_MESHSWAP_IMP, - ID_MESHSWAP_HITMAN, - ID_MESHSWAP_ROMAN_GOD1, - ID_MESHSWAP_ROMAN_GOD2, - - ID_ANIMATING1 = 1200, - ID_ANIMATING2, - ID_ANIMATING3, - ID_ANIMATING4, - ID_ANIMATING5, - ID_ANIMATING6, - ID_ANIMATING7, - ID_ANIMATING8, - ID_ANIMATING9, - ID_ANIMATING10, - ID_ANIMATING11, - ID_ANIMATING12, - ID_ANIMATING13, - ID_ANIMATING14, - ID_ANIMATING15, - ID_ANIMATING16, - ID_ANIMATING17, - ID_ANIMATING18, - ID_ANIMATING19, - ID_ANIMATING20, - ID_ANIMATING21, - ID_ANIMATING22, - ID_ANIMATING23, - ID_ANIMATING24, - ID_ANIMATING25, - ID_ANIMATING26, - ID_ANIMATING27, - ID_ANIMATING28, - ID_ANIMATING29, - ID_ANIMATING30, - ID_ANIMATING31, - ID_ANIMATING32, - ID_ANIMATING33, - ID_ANIMATING34, - ID_ANIMATING35, - ID_ANIMATING36, - ID_ANIMATING37, - ID_ANIMATING38, - ID_ANIMATING39, - ID_ANIMATING40, - ID_ANIMATING41, - ID_ANIMATING42, - ID_ANIMATING43, - ID_ANIMATING44, - ID_ANIMATING45, - ID_ANIMATING46, - ID_ANIMATING47, - ID_ANIMATING48, - ID_ANIMATING49, - ID_ANIMATING50, - ID_ANIMATING51, - ID_ANIMATING52, - ID_ANIMATING53, - ID_ANIMATING54, - ID_ANIMATING55, - ID_ANIMATING56, - ID_ANIMATING57, - ID_ANIMATING58, - ID_ANIMATING59, - ID_ANIMATING60, - ID_ANIMATING61, - ID_ANIMATING62, - ID_ANIMATING63, - ID_ANIMATING64, - ID_ANIMATING65, - ID_ANIMATING66, - ID_ANIMATING67, - ID_ANIMATING68, - ID_ANIMATING69, - ID_ANIMATING70, - ID_ANIMATING71, - ID_ANIMATING72, - ID_ANIMATING73, - ID_ANIMATING74, - ID_ANIMATING75, - ID_ANIMATING76, - ID_ANIMATING77, - ID_ANIMATING78, - ID_ANIMATING79, - ID_ANIMATING80, - ID_ANIMATING81, - ID_ANIMATING82, - ID_ANIMATING83, - ID_ANIMATING84, - ID_ANIMATING85, - ID_ANIMATING86, - ID_ANIMATING87, - ID_ANIMATING88, - ID_ANIMATING89, - ID_ANIMATING90, - ID_ANIMATING91, - ID_ANIMATING92, - ID_ANIMATING93, - ID_ANIMATING94, - ID_ANIMATING95, - ID_ANIMATING96, - ID_ANIMATING97, - ID_ANIMATING98, - ID_ANIMATING99, - ID_ANIMATING100, - ID_ANIMATING101, - ID_ANIMATING102, - ID_ANIMATING103, - ID_ANIMATING104, - ID_ANIMATING105, - ID_ANIMATING106, - ID_ANIMATING107, - ID_ANIMATING108, - ID_ANIMATING109, - ID_ANIMATING110, - ID_ANIMATING111, - ID_ANIMATING112, - ID_ANIMATING113, - ID_ANIMATING114, - ID_ANIMATING115, - ID_ANIMATING116, - ID_ANIMATING117, - ID_ANIMATING118, - ID_ANIMATING119, - ID_ANIMATING120, - ID_ANIMATING121, - ID_ANIMATING122, - ID_ANIMATING123, - ID_ANIMATING124, - ID_ANIMATING125, - ID_ANIMATING126, - ID_ANIMATING127, - ID_ANIMATING128, - ID_GUARDIAN_BASE, - ID_GUARDIAN_TENTACLE, - - ID_BRIDGE_FLAT = 1340, - ID_BRIDGE_TILT1, - ID_BRIDGE_TILT2, - ID_BRIDGE_TILT3, - ID_BRIDGE_TILT4, - ID_BRIDGE_CUSTOM, - - ID_HORIZON = 1350, - ID_BINOCULAR_GRAPHICS, - ID_TARGET_GRAPHICS, - ID_SKY_GRAPHICS, - ID_DEFAULT_SPRITES, - ID_MISC_SPRITES, - ID_CUSTOM_SPRITES, - - ID_PANEL_BORDER = 1400, - ID_PANEL_MIDDLE, - ID_PANEL_CORNER, - ID_PANEL_DIAGONAL, - ID_PANEL_STRIP, - ID_PANEL_HALF_BORDER1, - ID_PANEL_HALF_BORDER2, - ID_PANEL_MIDDLE_CORNER, - - ID_NUMBER_OBJECTS, // NEED TO BE AT THE END !!!! -}; - -#define NUM_PUZZLES (ID_PUZZLE_ITEM16 - ID_PUZZLE_ITEM1 + 1) -#define NUM_KEYS (ID_KEY_ITEM16 - ID_KEY_ITEM1 + 1) -#define NUM_PICKUPS (ID_PICKUP_ITEM16 - ID_PICKUP_ITEM1 + 1) -#define NUM_EXAMINES (ID_EXAMINE8 - ID_EXAMINE1 + 1) - -#endif \ No newline at end of file +#pragma once + +typedef enum GAME_OBJECT_ID +{ + /* Lara Primary Slot */ + ID_LARA, + ID_LARA_EXTRA_ANIMS, + ID_PISTOLS_ANIM, + ID_UZI_ANIM, + ID_SHOTGUN_ANIM, + ID_REVOLVER_ANIM, + ID_CROSSBOW_ANIM, + ID_HK_ANIM, + ID_GRENADE_ANIM, + ID_ROCKET_ANIM, + ID_HARPOON_ANIM, + ID_LARA_FLARE_ANIM, + ID_LARA_SKIN, + ID_LARA_SKIN_JOINTS, + ID_LARA_SCREAM, + ID_LARA_CROSSBOW_LASER, + ID_LARA_REVOLVER_LASER, + ID_LARA_HOLSTERS, + ID_LARA_HOLSTERS_PISTOLS, + ID_LARA_HOLSTERS_UZIS, + ID_LARA_HOLSTERS_REVOLVER, + ID_LARA_SPEECH_HEAD1, + ID_LARA_SPEECH_HEAD2, + ID_LARA_SPEECH_HEAD3, + ID_LARA_SPEECH_HEAD4, + ID_ACTOR1_SPEECH_HEAD1, + ID_ACTOR1_SPEECH_HEAD2, + ID_ACTOR2_SPEECH_HEAD1, + ID_ACTOR2_SPEECH_HEAD2, + ID_LARA_EXTRA_MESH1, + ID_LARA_EXTRA_MESH2, + ID_LARA_EXTRA_MESH3, + ID_LARA_WATER_MESH, + ID_LARA_PETROL_MESH, + ID_LARA_DIRT_MESH, + ID_LARA_CROWBAR_ANIM, + ID_LARA_TORCH_ANIM, + ID_LARA_HAIR, + + /* Lara Vehicles */ + ID_SNOWMOBILE_LARA_ANIMS = 50, + ID_SNOWMOBILE, + ID_QUAD_LARA_ANIMS, + ID_QUAD, + ID_SPEEDBOAT_LARA_ANIMS, + ID_SPEEDBOAT, // TR2 + ID_KAYAK_LARA_ANIMS, + ID_KAYAK, + ID_UPV_LARA_ANIMS, + ID_UPV, // TR3 - 90% (Need new render) (lara cant enter) + ID_MINECART_LARA_ANIMS, + ID_MINECART, + ID_JEEP_LARA_ANIMS, + ID_JEEP, // TR4 - 95% Working + ID_MOTORBIKE_LARA_ANIMS, + ID_MOTORBIKE, + ID_RUBBER_BOAT_LARA_ANIMS, + ID_RUBBER_BOAT_BOAT, // TR3 / (TR4 TRNG) + + ID_VEHICLE_SMASHABLE_FLOOR = 90, // NEW + ID_VEHICLE_SMASHABLE_WALL, // NEW + + /* Enemy */ + + /* Animals */ + ID_WOLF = 100, + ID_BEAR, + ID_APE, + ID_SMALL_SPIDER, + ID_BIG_SPIDER, + ID_CROW, + ID_TIGER, + ID_EAGLE, + ID_RAPTOR, + ID_TYRANNOSAUR, + ID_COBRA, + ID_MONKEY, + ID_WHALE, + ID_SMALL_DINOSAUR, // TR3 - 34 + ID_FISH_EMITTER, // TR3 - 338 - OK - Needs testing and drawing + ID_RAT, + ID_CROCODILE, + ID_BAT, + ID_SPHINX, + ID_WILD_BOAR, + ID_HARPY, + ID_BIG_SCORPION, + ID_SMALL_SCORPION, + ID_BABOON_NORMAL, + ID_BABOON_INV, + ID_BABOON_SILENT, + ID_LITTLE_BEETLE, + ID_LOCUSTS, + ID_SHARK, + ID_HUSKIE, + ID_DOG, + ID_BATS_EMITTER, + ID_RATS_EMITTER, + ID_SPIDERS_EMITTER, + ID_LION, + ID_DOBERMAN, + + /* Humans */ + ID_SCUBA_HARPOON = 150, + ID_SCUBA_DIVER, + ID_GOON_SILENCER1, + ID_GOON_SILENCER2, + ID_GOON_SILENCER3, + ID_BARRACUDA, + ID_WORKER_SHOTGUN, + ID_WORKER_MACHINEGUN, + ID_WORKER_DUAL_REVOLVER, + ID_WORKER_FLAMETHROWER, + ID_MONK1, + ID_MONK2, + ID_KNIFETHROWER, + ID_KNIFETHROWER_KNIFE, + ID_MERCENARY_UZI, + ID_MERCENARY_AUTOPISTOLS1, + ID_MERCENARY_AUTOPISTOLS2, + ID_SNOWMOBILE_GUN, + ID_SNOWMOBILE_DRIVER, + ID_FLAMETHROWER_BADDY, + ID_TRIBESMAN_WITH_AX, + ID_TRIBESMAN_WITH_DARTS, + ID_MP_WITH_STICK, + ID_MP_WITH_GUN, + ID_BADDY1, + ID_BADDY2, + ID_SAS_CAIRO, + ID_SAS_DYING, + ID_SAS_CAPTAIN, + ID_SAS_DRAG_BLOKE, + ID_GUIDE, + ID_VON_CROY, + ID_TROOPS, // TR4 - OK - Needs testing + ID_SAS, + ID_SWAT, + ID_SWAT_PLUS, + ID_GUARD1, + ID_GUARD_LASER, + ID_LARSON, + ID_PIERRE, + ID_MAFIA, + ID_MAFIA2, + ID_GUARD2, + ID_GUARD3, + ID_GLADIATOR, + ID_HITMAN, + ID_SNIPER, + ID_CHEF, + + /* Soprannatural, boss and others */ + ID_WINGED_MUMMY = 220, + ID_CENTAUR_MUTANT, + ID_LARA_DOPPELGANGER, + ID_NATLA, + ID_WINGED_NATLA, + ID_GIANT_MUTANT, + ID_PROJ_NATLA, + ID_PROJ_SHARD, + ID_PROJ_BOMB, + ID_YETI, + ID_BIRDMONSTER, + ID_MARCO_BARTOLI, + ID_DRAGON_FRONT, + ID_DRAGON_BACK, + ID_DRAGON_BONE_FRONT, + ID_DRAGON_BONE_BACK, + ID_SPHERE_OF_DOOM, // Used by the dragon/boss to appear or death explosion. + ID_SPHERE_OF_DOOM2, + ID_SPHERE_OF_DOOM3, + ID_CIVVIE, + ID_SPEAR_GUARDIAN, + ID_SPEAR_GUARDIAN_STATUE, + ID_SWORD_GUARDIAN, + ID_SWORD_GUARDIAN_STATUE, + ID_SHIVA, + ID_SHIVA_STATUE, + ID_TRIBEBOSS, + ID_CIVVY, + ID_MUTANT2, + ID_LIZARD, // TR3 - 35 + ID_TONY_BOSS, // TR3 - Not Finished + ID_TONY_BOSS_FLAME, // TR3 Tony Flame Controller + ID_PUNA_BOSS, // TR3 - 36 + ID_SOPHIA_LEE_BOSS, // TR3 - 57 + ID_LASER_BOLT, + ID_SKELETON, + ID_MUMMY, + ID_ENEMY_JEEP, + ID_HORSE, + ID_HORSEMAN, + ID_DEMIGOD1, + ID_DEMIGOD2, + ID_DEMIGOD3, + ID_SETHA, + ID_KNIGHT_TEMPLAR, + ID_AHMET, + ID_BIG_BEETLE, + ID_JEAN_YVES, // TR4 - OK - Needs testing + ID_WRAITH1, + ID_WRAITH2, + ID_WRAITH3, + ID_WRAITH4, + ID_LARA_DOUBLE, // TR4 - OK - Needs testing + ID_COMPY, + ID_HYDRA, + ID_LASERHEAD, + ID_SCIENTIST, + ID_MERCENARY, + ID_WILLOWISP, + ID_INVISIBLE_GHOST, + ID_REAPER, + ID_BROWN_BEAST, + ID_ATTACK_SUB, + ID_IMP, + ID_IMP_ROCK, // maybe needed for imp so moved here ! + ID_GUNSHIP, + ID_AUTOGUN, + ID_ROMAN_GOD1, + ID_ROMAN_GOD2, + ID_LAGOON_WITCH, + ID_BOSS_SHIELD, + ID_BOSS_EXPLOSION_SHOCKWAVE, + ID_BOSS_EXPLOSION_RING, + + /* Traps / Doors */ + ID_SPRINGBOARD = 320, + ID_ROLLING_SPINDLE, + ID_DISK_SHOOTER, + ID_DISK, + ID_WALL_MOUNTED_BLADE, // TR3 - 111 + ID_STATUE_WITH_BLADE, + ID_COG, + ID_SPIKEBALL, + ID_FLOOR_4BLADES, + ID_CEILING_4BLADES, + ID_CATWALK_BLADE, + ID_SETH_BLADE, + ID_PLINTH_BLADE, + ID_SLICER_DICER, // TR4 - OK - Needs testing + ID_BIRD_BLADE, + ID_CHAIN, + ID_PLOUGH, + ID_STARGATE, + ID_SPIKY_FLOOR, + ID_SPIKY_WALL, + ID_SPIKY_CEILING, + ID_TEETH_SPIKES, + ID_JOBY_SPIKES, + ID_SENTRY_GUN, + ID_MAPPER, + ID_MOVING_BLADE, + ID_ELEMENT_PUZZLE, + ID_LIGHTING_CONDUCTOR, + ID_HAMMER, + ID_OBELISK, + ID_WHEEL_OF_FORTUNE, + ID_GAME_PIECE1, + ID_GAME_PIECE2, + ID_GAME_PIECE3, + ID_RAISING_COG, + ID_MINE, // TR4 - OK - Needs testing + ID_SCALES, // TR4 - OK - Needs testing + ID_ROME_HAMMER, + ID_FLAME, + ID_FLAME_EMITTER, + ID_FLAME_EMITTER2, + ID_FLAME_EMITTER3, + ID_BURNING_ROOTS, + ID_ROPE, + ID_FIREROPE, + ID_POLEROPE, + ID_ELECTRICAL_CABLES, + ID_BURNING_FLOOR, + ID_DARTS, + ID_DART_EMITTER, + ID_HOMING_DART_EMITTER, + ID_FALLING_CEILING, + ID_FALLING_BLOCK, + ID_FALLING_BLOCK2, + ID_CRUMBLING_FLOOR, + ID_TRAPDOOR1, + ID_TRAPDOOR2, + ID_TRAPDOOR3, + ID_FLOOR_TRAPDOOR1, + ID_FLOOR_TRAPDOOR2, + ID_CEILING_TRAPDOOR1, + ID_CEILING_TRAPDOOR2, + ID_SCALING_TRAPDOOR, + ID_ROLLINGBALL, + ID_ROLLINGBARREL, + ID_PROPELLER_H, + ID_PROPELLER_V, + ID_ONEBLOCK_PLATFORM, + ID_TWOBLOCK_PLATFORM, + ID_RAISING_BLOCK1, + ID_RAISING_BLOCK2, + ID_RAISING_BLOCK3, + ID_RAISING_BLOCK4, + ID_PUSHABLE_OBJECT1, + ID_PUSHABLE_OBJECT2, + ID_PUSHABLE_OBJECT3, + ID_PUSHABLE_OBJECT4, + ID_PUSHABLE_OBJECT5, + ID_PUSHABLE_OBJECT6, + ID_PUSHABLE_OBJECT7, + ID_PUSHABLE_OBJECT8, + ID_PUSHABLE_OBJECT9, + ID_PUSHABLE_OBJECT10, + ID_WRECKING_BALL, + ID_ZIPLINE_HANDLE, + ID_TORPEDO, + ID_CHAFF, + ID_ELECTRIC_FENCE, + ID_LIFT, + ID_TIGHT_ROPE, + ID_PARALLEL_BARS, + ID_XRAY_CONTROLLER, + ID_PORTAL, + ID_GEN_SLOT1, + ID_GEN_SLOT2, + ID_GEN_SLOT3, + ID_GEN_SLOT4, + + /* Searchable Objects */ + ID_SEARCH_OBJECT1, + ID_SEARCH_OBJECT2, + ID_SEARCH_OBJECT3, + ID_SEARCH_OBJECT4, + ID_SARCOPHAGUS, + + ID_ENEMY_PIECE, // NEW + ID_EXPANDING_PLATFORM, // NEW + ID_SQUISHY_BLOCK1, // NEW + ID_SQUISHY_BLOCK2, // NEW + ID_TRIPWIRE, // NEW + ID_MINE_DETECTOR, // NEW + ID_MAP, // NEW + ID_SECRET_MAP, // NEW + ID_SETH_DOOR, // NEW + ID_HORUS_STATUE, // NEW + ID_STATUE_PLINTH, // NEW + + /* Items */ + ID_PUZZLE_ITEM1 = 500, + ID_PUZZLE_ITEM2, + ID_PUZZLE_ITEM3, + ID_PUZZLE_ITEM4, + ID_PUZZLE_ITEM5, + ID_PUZZLE_ITEM6, + ID_PUZZLE_ITEM7, + ID_PUZZLE_ITEM8, + ID_PUZZLE_ITEM9, + ID_PUZZLE_ITEM10, + ID_PUZZLE_ITEM11, + ID_PUZZLE_ITEM12, + ID_PUZZLE_ITEM13, + ID_PUZZLE_ITEM14, + ID_PUZZLE_ITEM15, + ID_PUZZLE_ITEM16, + ID_PUZZLE_ITEM1_COMBO1, + ID_PUZZLE_ITEM1_COMBO2, + ID_PUZZLE_ITEM2_COMBO1, + ID_PUZZLE_ITEM2_COMBO2, + ID_PUZZLE_ITEM3_COMBO1, + ID_PUZZLE_ITEM3_COMBO2, + ID_PUZZLE_ITEM4_COMBO1, + ID_PUZZLE_ITEM4_COMBO2, + ID_PUZZLE_ITEM5_COMBO1, + ID_PUZZLE_ITEM5_COMBO2, + ID_PUZZLE_ITEM6_COMBO1, + ID_PUZZLE_ITEM6_COMBO2, + ID_PUZZLE_ITEM7_COMBO1, + ID_PUZZLE_ITEM7_COMBO2, + ID_PUZZLE_ITEM8_COMBO1, + ID_PUZZLE_ITEM8_COMBO2, + ID_PUZZLE_ITEM9_COMBO1, + ID_PUZZLE_ITEM9_COMBO2, + ID_PUZZLE_ITEM10_COMBO1, + ID_PUZZLE_ITEM10_COMBO2, + ID_PUZZLE_ITEM11_COMBO1, + ID_PUZZLE_ITEM11_COMBO2, + ID_PUZZLE_ITEM12_COMBO1, + ID_PUZZLE_ITEM12_COMBO2, + ID_PUZZLE_ITEM13_COMBO1, + ID_PUZZLE_ITEM13_COMBO2, + ID_PUZZLE_ITEM14_COMBO1, + ID_PUZZLE_ITEM14_COMBO2, + ID_PUZZLE_ITEM15_COMBO1, + ID_PUZZLE_ITEM15_COMBO2, + ID_PUZZLE_ITEM16_COMBO1, + ID_PUZZLE_ITEM16_COMBO2, + ID_KEY_ITEM1, + ID_KEY_ITEM2, + ID_KEY_ITEM3, + ID_KEY_ITEM4, + ID_KEY_ITEM5, + ID_KEY_ITEM6, + ID_KEY_ITEM7, + ID_KEY_ITEM8, + ID_KEY_ITEM9, + ID_KEY_ITEM10, + ID_KEY_ITEM11, + ID_KEY_ITEM12, + ID_KEY_ITEM13, + ID_KEY_ITEM14, + ID_KEY_ITEM15, + ID_KEY_ITEM16, + ID_KEY_ITEM1_COMBO1, + ID_KEY_ITEM1_COMBO2, + ID_KEY_ITEM2_COMBO1, + ID_KEY_ITEM2_COMBO2, + ID_KEY_ITEM3_COMBO1, + ID_KEY_ITEM3_COMBO2, + ID_KEY_ITEM4_COMBO1, + ID_KEY_ITEM4_COMBO2, + ID_KEY_ITEM5_COMBO1, + ID_KEY_ITEM5_COMBO2, + ID_KEY_ITEM6_COMBO1, + ID_KEY_ITEM6_COMBO2, + ID_KEY_ITEM7_COMBO1, + ID_KEY_ITEM7_COMBO2, + ID_KEY_ITEM8_COMBO1, + ID_KEY_ITEM8_COMBO2, + ID_KEY_ITEM9_COMBO1, + ID_KEY_ITEM9_COMBO2, + ID_KEY_ITEM10_COMBO1, + ID_KEY_ITEM10_COMBO2, + ID_KEY_ITEM11_COMBO1, + ID_KEY_ITEM11_COMBO2, + ID_KEY_ITEM12_COMBO1, + ID_KEY_ITEM12_COMBO2, + ID_KEY_ITEM13_COMBO1, + ID_KEY_ITEM13_COMBO2, + ID_KEY_ITEM14_COMBO1, + ID_KEY_ITEM14_COMBO2, + ID_KEY_ITEM15_COMBO1, + ID_KEY_ITEM15_COMBO2, + ID_KEY_ITEM16_COMBO1, + ID_KEY_ITEM16_COMBO2, + ID_PICKUP_ITEM1, + ID_PICKUP_ITEM2, + ID_PICKUP_ITEM3, + ID_PICKUP_ITEM4, + ID_PICKUP_ITEM5, + ID_PICKUP_ITEM6, + ID_PICKUP_ITEM7, + ID_PICKUP_ITEM8, + ID_PICKUP_ITEM9, + ID_PICKUP_ITEM10, + ID_PICKUP_ITEM11, + ID_PICKUP_ITEM12, + ID_PICKUP_ITEM13, + ID_PICKUP_ITEM14, + ID_PICKUP_ITEM15, + ID_PICKUP_ITEM16, + ID_PICKUP_ITEM1_COMBO1, + ID_PICKUP_ITEM1_COMBO2, + ID_PICKUP_ITEM2_COMBO1, + ID_PICKUP_ITEM2_COMBO2, + ID_PICKUP_ITEM3_COMBO1, + ID_PICKUP_ITEM3_COMBO2, + ID_PICKUP_ITEM4_COMBO1, + ID_PICKUP_ITEM4_COMBO2, + ID_PICKUP_ITEM5_COMBO1, + ID_PICKUP_ITEM5_COMBO2, + ID_PICKUP_ITEM6_COMBO1, + ID_PICKUP_ITEM6_COMBO2, + ID_PICKUP_ITEM7_COMBO1, + ID_PICKUP_ITEM7_COMBO2, + ID_PICKUP_ITEM8_COMBO1, + ID_PICKUP_ITEM8_COMBO2, + ID_PICKUP_ITEM9_COMBO1, + ID_PICKUP_ITEM9_COMBO2, + ID_PICKUP_ITEM10_COMBO1, + ID_PICKUP_ITEM10_COMBO2, + ID_PICKUP_ITEM11_COMBO1, + ID_PICKUP_ITEM11_COMBO2, + ID_PICKUP_ITEM12_COMBO1, + ID_PICKUP_ITEM12_COMBO2, + ID_PICKUP_ITEM13_COMBO1, + ID_PICKUP_ITEM13_COMBO2, + ID_PICKUP_ITEM14_COMBO1, + ID_PICKUP_ITEM14_COMBO2, + ID_PICKUP_ITEM15_COMBO1, + ID_PICKUP_ITEM15_COMBO2, + ID_PICKUP_ITEM16_COMBO1, + ID_PICKUP_ITEM16_COMBO2, + ID_EXAMINE1, + ID_EXAMINE2, + ID_EXAMINE3, + ID_EXAMINE4, + ID_EXAMINE5, + ID_EXAMINE6, + ID_EXAMINE7, + ID_EXAMINE8, + ID_EXAMINE1_COMBO1, + ID_EXAMINE1_COMBO2, + ID_EXAMINE2_COMBO1, + ID_EXAMINE2_COMBO2, + ID_EXAMINE3_COMBO1, + ID_EXAMINE3_COMBO2, + ID_EXAMINE4_COMBO1, + ID_EXAMINE4_COMBO2, + ID_EXAMINE5_COMBO1, + ID_EXAMINE5_COMBO2, + ID_EXAMINE6_COMBO1, + ID_EXAMINE6_COMBO2, + ID_EXAMINE7_COMBO1, + ID_EXAMINE7_COMBO2, + ID_EXAMINE8_COMBO1, + ID_EXAMINE8_COMBO2, + ID_PUZZLE_HOLE1, + ID_PUZZLE_HOLE2, + ID_PUZZLE_HOLE3, + ID_PUZZLE_HOLE4, + ID_PUZZLE_HOLE5, + ID_PUZZLE_HOLE6, + ID_PUZZLE_HOLE7, + ID_PUZZLE_HOLE8, + ID_PUZZLE_HOLE9, + ID_PUZZLE_HOLE10, + ID_PUZZLE_HOLE11, + ID_PUZZLE_HOLE12, + ID_PUZZLE_HOLE13, + ID_PUZZLE_HOLE14, + ID_PUZZLE_HOLE15, + ID_PUZZLE_HOLE16, + ID_PUZZLE_DONE1, + ID_PUZZLE_DONE2, + ID_PUZZLE_DONE3, + ID_PUZZLE_DONE4, + ID_PUZZLE_DONE5, + ID_PUZZLE_DONE6, + ID_PUZZLE_DONE7, + ID_PUZZLE_DONE8, + ID_PUZZLE_DONE9, + ID_PUZZLE_DONE10, + ID_PUZZLE_DONE11, + ID_PUZZLE_DONE12, + ID_PUZZLE_DONE13, + ID_PUZZLE_DONE14, + ID_PUZZLE_DONE15, + ID_PUZZLE_DONE16, + ID_KEY_HOLE1, + ID_KEY_HOLE2, + ID_KEY_HOLE3, + ID_KEY_HOLE4, + ID_KEY_HOLE5, + ID_KEY_HOLE6, + ID_KEY_HOLE7, + ID_KEY_HOLE8, + ID_KEY_HOLE9, + ID_KEY_HOLE10, + ID_KEY_HOLE11, + ID_KEY_HOLE12, + ID_KEY_HOLE13, + ID_KEY_HOLE14, + ID_KEY_HOLE15, + ID_KEY_HOLE16, + ID_WATERSKIN1_EMPTY, + ID_WATERSKIN1_1, // TR4 - OK - Needs testing and inventory handling + ID_WATERSKIN1_2, // TR4 - OK - Needs testing and inventory handling + ID_WATERSKIN1_3, // TR4 - OK - Needs testing and inventory handling + ID_WATERSKIN2_EMPTY, + ID_WATERSKIN2_1, // TR4 - OK - Needs testing and inventory handling + ID_WATERSKIN2_2, // TR4 - OK - Needs testing and inventory handling + ID_WATERSKIN2_3, // TR4 - OK - Needs testing and inventory handling + ID_WATERSKIN2_4, // TR4 - OK - Needs testing and inventory handling + ID_WATERSKIN2_5, // TR4 - OK - Needs testing and inventory handling + + /* Misc inventory objects */ + ID_HAMMER_ITEM = 750, + ID_CROWBAR_ITEM, + ID_BURNING_TORCH_ITEM, + ID_CLOCKWORK_BEETLE, + ID_CLOCKWORK_BEETLE_COMBO1, + ID_CLOCKWORK_BEETLE_COMBO2, + + /* Switches */ + ID_SWITCH_TYPE1 = 800, + ID_SWITCH_TYPE2, + ID_SWITCH_TYPE3, + ID_SWITCH_TYPE4, + ID_SWITCH_TYPE5, + ID_SWITCH_TYPE6, + ID_SWITCH_TYPE7, + ID_SWITCH_TYPE8, + ID_SWITCH_TYPE9, + ID_SWITCH_TYPE10, + ID_SWITCH_TYPE11, + ID_SWITCH_TYPE12, + ID_SWITCH_TYPE13, + ID_SWITCH_TYPE14, + ID_SWITCH_TYPE15, + ID_SWITCH_TYPE16, + ID_SHOOT_SWITCH1, + ID_SHOOT_SWITCH2, + ID_SHOOT_SWITCH3, + ID_SHOOT_SWITCH4, + ID_AIRLOCK_SWITCH, + ID_UNDERWATER_SWITCH1, + ID_UNDERWATER_SWITCH2, + ID_UNDERWATER_SWITCH3, + ID_UNDERWATER_SWITCH4, + ID_TURN_SWITCH, + ID_COG_SWITCH, + ID_LEVER_SWITCH, + ID_JUMP_SWITCH, + ID_CROWBAR_SWITCH, + ID_PULLEY, + ID_CROWDOVE_SWITCH, + + ID_DOOR_TYPE1 = 850, + ID_DOOR_TYPE2, + ID_DOOR_TYPE3, + ID_DOOR_TYPE4, + ID_DOOR_TYPE5, + ID_DOOR_TYPE6, + ID_DOOR_TYPE7, + ID_DOOR_TYPE8, + ID_DOOR_TYPE9, + ID_DOOR_TYPE10, + ID_DOOR_TYPE11, + ID_DOOR_TYPE12, + ID_DOOR_TYPE13, + ID_DOOR_TYPE14, + ID_DOOR_TYPE15, + ID_DOOR_TYPE16, + ID_DOOR_TYPE17, + ID_DOOR_TYPE18, + ID_DOOR_TYPE19, + ID_DOOR_TYPE20, + ID_DOOR_TYPE21, + ID_DOOR_TYPE22, + ID_DOOR_TYPE23, + ID_DOOR_TYPE24, + ID_CLOSED_DOOR1, + ID_CLOSED_DOOR2, + ID_CLOSED_DOOR3, + ID_CLOSED_DOOR4, + ID_CLOSED_DOOR5, + ID_CLOSED_DOOR6, + ID_LIFT_DOORS1, + ID_LIFT_DOORS2, + ID_PUSHPULL_DOOR1, + ID_PUSHPULL_DOOR2, + ID_PUSHPULL_DOOR3, + ID_PUSHPULL_DOOR4, + ID_KICK_DOOR1, + ID_KICK_DOOR2, + ID_KICK_DOOR3, + ID_KICK_DOOR4, + ID_UNDERWATER_DOOR1, // NEW + ID_UNDERWATER_DOOR2, + ID_UNDERWATER_DOOR3, + ID_UNDERWATER_DOOR4, + ID_DOUBLE_DOORS1, + ID_DOUBLE_DOORS2, + ID_DOUBLE_DOORS3, + ID_DOUBLE_DOORS4, + ID_SEQUENCE_DOOR1, + ID_SEQUENCE_SWITCH1, + ID_SEQUENCE_SWITCH2, + ID_SEQUENCE_SWITCH3, + ID_STEEL_DOOR, + ID_GOD_HEAD, + + /* Lara Items */ + ID_PISTOLS_ITEM = 950, + ID_PISTOLS_AMMO_ITEM, + ID_UZI_ITEM, + ID_UZI_AMMO_ITEM, + ID_SHOTGUN_ITEM, + ID_SHOTGUN_AMMO1_ITEM, + ID_SHOTGUN_AMMO2_ITEM, + ID_REVOLVER_ITEM, + ID_REVOLVER_AMMO_ITEM, + ID_CROSSBOW_ITEM, + ID_CROSSBOW_AMMO1_ITEM, + ID_CROSSBOW_AMMO2_ITEM, + ID_CROSSBOW_AMMO3_ITEM, + ID_CROSSBOW_BOLT, + ID_HK_ITEM, + ID_HK_AMMO_ITEM, + ID_GRENADE_GUN_ITEM, + ID_GRENADE_AMMO1_ITEM, + ID_GRENADE_AMMO2_ITEM, + ID_GRENADE_AMMO3_ITEM, + ID_GRENADE, + ID_ROCKET_LAUNCHER_ITEM, + ID_ROCKET_LAUNCHER_AMMO_ITEM, + ID_ROCKET, + ID_HARPOON_ITEM, + ID_HARPOON_AMMO_ITEM, + ID_HARPOON, + ID_GOLDROSE_ITEM, + ID_BIGMEDI_ITEM, + ID_SMALLMEDI_ITEM, + ID_LASERSIGHT_ITEM, + ID_BINOCULARS_ITEM, + ID_SILENCER_ITEM, + ID_FLARE_ITEM, + ID_FLARE_INV_ITEM, + ID_COMPASS_ITEM, + ID_DIARY_ITEM, + + /* Inventory main objects */ + ID_INVENTORY_PASSPORT = 1000, + ID_INVENTORY_SUNGLASSES, + ID_INVENTORY_KEYS, + ID_INVENTORY_HEADPHONES, + ID_INVENTORY_POLAROID, + + /* other effect in-game */ + ID_SMOKE_EMITTER_WHITE = 1020, + ID_SMOKE_EMITTER_BLACK, + ID_SMOKE_EMITTER, + ID_LOCUST_EMITTER, + ID_EARTHQUAKE, + ID_BUBBLES, + ID_WATERFALLMIST, + ID_GUNSHELL, + ID_SHOTGUNSHELL, + ID_GUN_FLASH, + ID_GUN_FLASH2, // used for M16/MP5/HK + ID_COLOR_LIGHT, + ID_BLINKING_LIGHT, + ID_PULSE_LIGHT, + ID_STROBE_LIGHT, + ID_ELECTRICAL_LIGHT, + ID_LENS_FLARE, + ID_ENERGY_BUBBLES, + ID_PLANET_EFFECT, + ID_BUTTERFLY, + ID_AI_GUARD, + ID_AI_AMBUSH, + ID_AI_PATROL1, + ID_AI_MODIFY, + ID_AI_FOLLOW, + ID_AI_PATROL2, + ID_AI_X1, + ID_AI_X2, + ID_LARA_START_POS, + ID_TELEPORTER, + ID_LIFT_TELEPORTER, + ID_LASERS, + ID_STEAM_LASERS, + ID_FLOOR_LASERS, + ID_KILL_ALL_TRIGGERS, + ID_TRIGGER_TRIGGERER, + ID_HIGH_OBJECT1, + ID_HIGH_OBJECT2, + ID_SMASH_OBJECT1, + ID_SMASH_OBJECT2, + ID_SMASH_OBJECT3, + ID_SMASH_OBJECT4, + ID_SMASH_OBJECT5, + ID_SMASH_OBJECT6, + ID_SMASH_OBJECT7, + ID_SMASH_OBJECT8, + ID_SMASH_OBJECT9, + ID_SMASH_OBJECT10, + ID_SMASH_OBJECT11, + ID_SMASH_OBJECT12, + ID_SMASH_OBJECT13, + ID_SMASH_OBJECT14, + ID_SMASH_OBJECT15, + ID_SMASH_OBJECT16, + ID_BODY_PART, + ID_CAMERA_TARGET, + ID_WATERFALL1, + ID_WATERFALL2, + ID_WATERFALL3, + ID_WATERFALL4, + ID_WATERFALL5, + ID_WATERFALL6, + ID_WATERFALLSS1, + ID_WATERFALLSS2, + ID_FISHTANK, + + ID_MESHSWAP1 = 1100, + ID_MESHSWAP2, + ID_MESHSWAP3, + ID_MESHSWAP4, + ID_MESHSWAP5, + ID_MESHSWAP6, + ID_MESHSWAP7, + ID_MESHSWAP8, + ID_MESHSWAP9, + ID_MESHSWAP10, + ID_MESHSWAP_BADDY1, + ID_MESHSWAP_BADDY2, + ID_MESHSWAP_MAFIA2 = 1113, + ID_MESHSWAP_IMP, + ID_MESHSWAP_HITMAN, + ID_MESHSWAP_ROMAN_GOD1, + ID_MESHSWAP_ROMAN_GOD2, + + ID_ANIMATING1 = 1200, + ID_ANIMATING2, + ID_ANIMATING3, + ID_ANIMATING4, + ID_ANIMATING5, + ID_ANIMATING6, + ID_ANIMATING7, + ID_ANIMATING8, + ID_ANIMATING9, + ID_ANIMATING10, + ID_ANIMATING11, + ID_ANIMATING12, + ID_ANIMATING13, + ID_ANIMATING14, + ID_ANIMATING15, + ID_ANIMATING16, + ID_ANIMATING17, + ID_ANIMATING18, + ID_ANIMATING19, + ID_ANIMATING20, + ID_ANIMATING21, + ID_ANIMATING22, + ID_ANIMATING23, + ID_ANIMATING24, + ID_ANIMATING25, + ID_ANIMATING26, + ID_ANIMATING27, + ID_ANIMATING28, + ID_ANIMATING29, + ID_ANIMATING30, + ID_ANIMATING31, + ID_ANIMATING32, + ID_ANIMATING33, + ID_ANIMATING34, + ID_ANIMATING35, + ID_ANIMATING36, + ID_ANIMATING37, + ID_ANIMATING38, + ID_ANIMATING39, + ID_ANIMATING40, + ID_ANIMATING41, + ID_ANIMATING42, + ID_ANIMATING43, + ID_ANIMATING44, + ID_ANIMATING45, + ID_ANIMATING46, + ID_ANIMATING47, + ID_ANIMATING48, + ID_ANIMATING49, + ID_ANIMATING50, + ID_ANIMATING51, + ID_ANIMATING52, + ID_ANIMATING53, + ID_ANIMATING54, + ID_ANIMATING55, + ID_ANIMATING56, + ID_ANIMATING57, + ID_ANIMATING58, + ID_ANIMATING59, + ID_ANIMATING60, + ID_ANIMATING61, + ID_ANIMATING62, + ID_ANIMATING63, + ID_ANIMATING64, + ID_ANIMATING65, + ID_ANIMATING66, + ID_ANIMATING67, + ID_ANIMATING68, + ID_ANIMATING69, + ID_ANIMATING70, + ID_ANIMATING71, + ID_ANIMATING72, + ID_ANIMATING73, + ID_ANIMATING74, + ID_ANIMATING75, + ID_ANIMATING76, + ID_ANIMATING77, + ID_ANIMATING78, + ID_ANIMATING79, + ID_ANIMATING80, + ID_ANIMATING81, + ID_ANIMATING82, + ID_ANIMATING83, + ID_ANIMATING84, + ID_ANIMATING85, + ID_ANIMATING86, + ID_ANIMATING87, + ID_ANIMATING88, + ID_ANIMATING89, + ID_ANIMATING90, + ID_ANIMATING91, + ID_ANIMATING92, + ID_ANIMATING93, + ID_ANIMATING94, + ID_ANIMATING95, + ID_ANIMATING96, + ID_ANIMATING97, + ID_ANIMATING98, + ID_ANIMATING99, + ID_ANIMATING100, + ID_ANIMATING101, + ID_ANIMATING102, + ID_ANIMATING103, + ID_ANIMATING104, + ID_ANIMATING105, + ID_ANIMATING106, + ID_ANIMATING107, + ID_ANIMATING108, + ID_ANIMATING109, + ID_ANIMATING110, + ID_ANIMATING111, + ID_ANIMATING112, + ID_ANIMATING113, + ID_ANIMATING114, + ID_ANIMATING115, + ID_ANIMATING116, + ID_ANIMATING117, + ID_ANIMATING118, + ID_ANIMATING119, + ID_ANIMATING120, + ID_ANIMATING121, + ID_ANIMATING122, + ID_ANIMATING123, + ID_ANIMATING124, + ID_ANIMATING125, + ID_ANIMATING126, + ID_ANIMATING127, + ID_ANIMATING128, + ID_LASERHEAD_BASE, + ID_LASERHEAD_TENTACLE, + + ID_BRIDGE_FLAT = 1340, + ID_BRIDGE_TILT1, + ID_BRIDGE_TILT2, + ID_BRIDGE_TILT3, + ID_BRIDGE_TILT4, + ID_BRIDGE_CUSTOM, + + ID_HORIZON = 1350, + ID_BINOCULAR_GRAPHICS, + ID_TARGET_GRAPHICS, + ID_SKY_GRAPHICS, + ID_DEFAULT_SPRITES, + ID_MISC_SPRITES, + ID_CUSTOM_SPRITES, + + ID_PANEL_BORDER = 1400, + ID_PANEL_MIDDLE, + ID_PANEL_CORNER, + ID_PANEL_DIAGONAL, + ID_PANEL_STRIP, + ID_PANEL_HALF_BORDER1, + ID_PANEL_HALF_BORDER2, + ID_PANEL_MIDDLE_CORNER, + + ID_NUMBER_OBJECTS, // NEED TO BE AT THE END !!!! +}; + +typedef enum SPRITE_TYPES +{ + SPR_FIRE0, + SPR_FIRE1, + SPR_FIRE2, + SPR_FIRE3, + SPR_SPLASH1, + SPR_SPLASH2, + SPR_SPLASH3, + SPR_SPLASH4, + SPR_SPLASH, + SPR_RIPPLES, + SPR_LENSFLARE, + SPR_LENSFLARE_LIGHT, + SPR_BULLETIMPACT, + SPR_BUBBLES, + SPR_UNDERWATERDUST, + SPR_BLOOD, + SPR_EMPTY1, + SPR_UNKNOWN1, + SPR_EMPTY2, + SPR_BACKGROUND, + SPR_GUI_UPLEFT, + SPR_GUI_UPRIGHT, + SPR_GUI_DOWNLEFT, + SPR_GUI_DOWNRIGHT, + SPR_GUI_DOWN, + SPR_GUI_UP, + SPR_GUI_LEFT, + SPR_GUI_RIGHT, + SPR_LIGHTHING +}; + +typedef enum FLOOR_TYPES +{ + FLOOR_TYPE, + DOOR_TYPE, + TILT_TYPE, + ROOF_TYPE, + TRIGGER_TYPE, + LAVA_TYPE, + CLIMB_TYPE, + SPLIT1, + SPLIT2, + SPLIT3, + SPLIT4, + NOCOLF1T, + NOCOLF1B, + NOCOLF2T, + NOCOLF2B, + NOCOLC1T, + NOCOLC1B, + NOCOLC2T, + NOCOLC2B, + MONKEY_TYPE, + TRIGTRIGGER_TYPE, + MINER_TYPE +}; + +typedef enum TRIGGER_TYPES +{ + TRIGGER, + PAD, + SWITCH, + KEY, + PICKUP, + HEAVY, + ANTIPAD, + COMBAT, + DUMMY, + ANTITRIGGER, + HEAVYSWITCH, + HEAVYANTITRIGGER, + MONKEY, + SKELETON_T, + TIGHTROPE_T, + CRAWLDUCK_T, + CLIMB_T, +}; + +typedef enum TRIGOBJECTS_TYPES +{ + TO_OBJECT, + TO_CAMERA, + TO_SINK, + TO_FLIPMAP, + TO_FLIPON, + TO_FLIPOFF, + TO_TARGET, + TO_FINISH, + TO_CD, + TO_FLIPEFFECT, + TO_SECRET, + TO_LUA_SCRIPT, + TO_FLYBY, + TO_CUTSCENE +}; + +typedef enum FLOORDATA_MASKS +{ + FD_MASK_FUNCTION = 0x1F, + FD_MASK_SUBFUNCTION = 0x7F00, + FD_MASK_END_DATA = 0x8000 +}; \ No newline at end of file diff --git a/TR5Main/Game/objlight.cpp b/TR5Main/Game/objlight.cpp index 166c9c2f3..c386c5fb7 100644 --- a/TR5Main/Game/objlight.cpp +++ b/TR5Main/Game/objlight.cpp @@ -1,6 +1,8 @@ +#include "framework.h" #include "objlight.h" #include "control.h" #include "effect2.h" +#include "trmath.h" void TriggerAlertLight(int x, int y, int z, int r, int g, int b, int angle, short room, int falloff) { diff --git a/TR5Main/Game/people.cpp b/TR5Main/Game/people.cpp index d07f54904..44df029be 100644 --- a/TR5Main/Game/people.cpp +++ b/TR5Main/Game/people.cpp @@ -1,6 +1,6 @@ +#include "framework.h" #include "people.h" -#include "..\Global\global.h" -#include "effects.h" +#include "effect.h" #include "effect2.h" #include "draw.h" #include "control.h" @@ -8,7 +8,6 @@ #include "debris.h" #include "lara.h" #include "sound.h" -#include "box.h" int ShotLara(ITEM_INFO* item, AI_INFO* info, BITE_INFO* gun, short extra_rotation, int damage) { diff --git a/TR5Main/Game/people.h b/TR5Main/Game/people.h index 5ae248122..643b4bed4 100644 --- a/TR5Main/Game/people.h +++ b/TR5Main/Game/people.h @@ -1,6 +1,6 @@ #pragma once -#include "..\Global\global.h" +#include "box.h" int ShotLara(ITEM_INFO* item, AI_INFO* info, BITE_INFO* gun, short extra_rotation, int damage); short GunMiss(int x, int y, int z, short speed, short yrot, short roomNumber); diff --git a/TR5Main/Game/phd_global.h b/TR5Main/Game/phd_global.h new file mode 100644 index 000000000..6cf8bb1f2 --- /dev/null +++ b/TR5Main/Game/phd_global.h @@ -0,0 +1,227 @@ +#pragma once + +typedef struct PHD_VECTOR +{ + int x; + int y; + int z; + + PHD_VECTOR() + { + this->x = 0; + this->y = 0; + this->z = 0; + } + + PHD_VECTOR(int xpos, int ypos, int zpos) + { + this->x = xpos; + this->y = ypos; + this->z = zpos; + } +}; + +typedef struct PHD_3DPOS +{ + int xPos; + int yPos; + int zPos; + short xRot; + short yRot; + short zRot; + + PHD_3DPOS() + { + this->xPos = 0; + this->yPos = 0; + this->zPos = 0; + this->xRot = 0; + this->yRot = 0; + this->zRot = 0; + } + + PHD_3DPOS(int x, int y, int z) + { + this->xPos = x; + this->yPos = y; + this->zPos = z; + this->xRot = 0; + this->yRot = 0; + this->zRot = 0; + } + + PHD_3DPOS(short xrot, short yrot, short zrot) + { + this->xPos = 0; + this->yPos = 0; + this->zPos = 0; + this->xRot = xrot; + this->yRot = yrot; + this->zRot = zrot; + } + + PHD_3DPOS(int x, int y, int z, short xrot, short yrot, short zrot) + { + this->xPos = x; + this->yPos = y; + this->zPos = z; + this->xRot = xrot; + this->yRot = yrot; + this->zRot = zrot; + } +}; + +typedef struct GAME_VECTOR +{ + int x; + int y; + int z; + short roomNumber; + short boxNumber; + + GAME_VECTOR() + { + this->x = 0; + this->y = 0; + this->z = 0; + this->roomNumber = 0; + this->boxNumber = 0; + } + + GAME_VECTOR(int xpos, int ypos, int zpos) + { + this->x = xpos; + this->y = ypos; + this->z = zpos; + this->roomNumber = 0; + this->boxNumber = 0; + } + + GAME_VECTOR(int xpos, int ypos, int zpos, short roomNumber) + { + this->x = xpos; + this->y = ypos; + this->z = zpos; + this->roomNumber = roomNumber; + this->boxNumber = 0; + } + + GAME_VECTOR(int xpos, int ypos, int zpos, short roomNumber, short boxNumber) + { + this->x = xpos; + this->y = ypos; + this->z = zpos; + this->roomNumber = roomNumber; + this->boxNumber = boxNumber; + } +}; + +typedef struct OBJECT_VECTOR +{ + int x; + int y; + int z; + short data; + short flags; + + OBJECT_VECTOR() + { + this->x = 0; + this->y = 0; + this->z = 0; + this->data = NULL; + this->flags = NULL; + } + + OBJECT_VECTOR(int xpos, int ypos, int zpos) + { + this->x = xpos; + this->y = ypos; + this->z = zpos; + this->data = NULL; + this->flags = NULL; + } + + OBJECT_VECTOR(int xpos, int ypos, int zpos, short newdata) + { + this->x = xpos; + this->y = ypos; + this->z = zpos; + this->data = newdata; + this->flags = NULL; + } + + OBJECT_VECTOR(int xpos, int ypos, int zpos, short flags, bool isFlags) // use isFlags to use flag instead of newdata ! + { + UNREFERENCED_PARAMETER(isFlags); + this->x = xpos; + this->y = ypos; + this->z = zpos; + this->data = NULL; + this->flags = flags; + } + + OBJECT_VECTOR(int xpos, int ypos, int zpos, short newdata, short newflags) + { + this->x = xpos; + this->y = ypos; + this->z = zpos; + this->data = newdata; + this->flags = newflags; + } +}; + +typedef struct VECTOR +{ + int vx; + int vy; + int vz; + int pad; +}; + +typedef struct SVECTOR +{ + short vx; + short vy; + short vz; + short pad; +}; + +typedef struct CVECTOR +{ + byte r; + byte g; + byte b; + byte cd; +}; + +typedef struct TR_VERTEX +{ + int x; + int y; + int z; +}; + +typedef enum MATRIX_ARRAY_VALUE +{ + M00, M01, M02, M03, + M10, M11, M12, M13, + M20, M21, M22, M23 +}; + +typedef struct MATRIX3D +{ + short m00; + short m01; + short m02; + short m10; + short m11; + short m12; + short m20; + short m21; + short m22; + short pad; + int tx; + int ty; + int tz; +}; \ No newline at end of file diff --git a/TR5Main/Game/pickup.cpp b/TR5Main/Game/pickup.cpp index 9212e829d..a26406790 100644 --- a/TR5Main/Game/pickup.cpp +++ b/TR5Main/Game/pickup.cpp @@ -1,73 +1,72 @@ +#include "framework.h" #include "pickup.h" +#include "phd_global.h" #include "lara.h" #include "draw.h" #include "inventory.h" -#include "effects.h" +#include "effect.h" #include "effect2.h" #include "control.h" #include "sphere.h" #include "debris.h" #include "box.h" -#include "healt.h" +#include "health.h" #include "items.h" -#include "collide.h" #include "switch.h" #include "larafire.h" #include "laraflar.h" #include "lara1gun.h" #include "lara2gun.h" #include "flmtorch.h" -#include "../Specific/setup.h" +#include "setup.h" #include "camera.h" -#include "..\Specific\level.h" -#include "../Specific/input.h" +#include "level.h" +#include "input.h" #include "sound.h" #include "savegame.h" -#include "..\Global\global.h" - static short PickUpBounds[12] = // offset 0xA1338 { 0xFF00, 0x0100, 0xFF38, 0x00C8, 0xFF00, 0x0100, 0xF8E4, 0x071C, 0x0000, 0x0000, 0x0000, 0x0000 }; -static PHD_VECTOR PickUpPosition = { 0, 0, 0xFFFFFF9C }; // offset 0xA1350 +static PHD_VECTOR PickUpPosition(0, 0, -100); // offset 0xA1350 static short HiddenPickUpBounds[12] = // offset 0xA135C { 0xFF00, 0x0100, 0xFF9C, 0x0064, 0xFCE0, 0xFF00, 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0x0000, 0x0000 }; -static PHD_VECTOR HiddenPickUpPosition = { 0, 0, 0xFFFFFD4E }; // offset 0xA1374 +static PHD_VECTOR HiddenPickUpPosition(0, 0, -690); // offset 0xA1374 static short CrowbarPickUpBounds[12] = // offset 0xA1380 { 0xFF00, 0x0100, 0xFF9C, 0x0064, 0x00C8, 0x0200, 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0x0000, 0x0000 }; -static PHD_VECTOR CrowbarPickUpPosition = { 0, 0, 0xD7 }; // offset 0xA1398 +static PHD_VECTOR CrowbarPickUpPosition(0, 0, 215); // offset 0xA1398 static short JobyCrowPickUpBounds[12] = // offset 0xA13A4 { 0xFE00, 0x0000, 0xFF9C, 0x0064, 0x0000, 0x0200, 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0x0000, 0x0000 }; -static PHD_VECTOR JobyCrowPickUpPosition = { 0xFFFFFF20, 0, 0xF0 }; // offset 0xA13BC +static PHD_VECTOR JobyCrowPickUpPosition(-224, 0, 240); // offset 0xA13BC static short PlinthPickUpBounds[12] = // offset 0xA13C8 { 0xFF00, 0x0100, 0xFD80, 0x0280, 0xFE01, 0x0000, 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0x0000, 0x0000 }; -static PHD_VECTOR PlinthPickUpPosition = { 0, 0, 0xFFFFFE34 }; // offset 0xA13E0 +static PHD_VECTOR PlinthPickUpPosition(0, 0, -460); // offset 0xA13E0 static short PickUpBoundsUW[12] = // offset 0xA13EC { 0xFE00, 0x0200, 0xFE00, 0x0200, 0xFE00, 0x0200, 0xE002, 0x1FFE, 0xE002, 0x1FFE, 0xE002, 0x1FFE }; -static PHD_VECTOR PickUpPositionUW = { 0, 0xFFFFFF38, 0xFFFFFEA2 }; // offset 0xA1404 +static PHD_VECTOR PickUpPositionUW(0, -200, -350); // offset 0xA1404 static short KeyHoleBounds[12] = // offset 0xA1410 { 0xFF00, 0x0100, 0x0000, 0x0000, 0x0000, 0x019C, 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0xF8E4, 0x071C }; -static PHD_VECTOR KeyHolePosition = { 0, 0, 0x138 }; // offset 0xA1428 +static PHD_VECTOR KeyHolePosition(0, 0, 312); // offset 0xA1428 static short PuzzleBounds[12] = // offset 0xA1434 { 0x0000, 0x0000, 0xFF00, 0x0100, 0x0000, 0x0000, 0xF8E4, 0x071C, 0xEAAC, 0x1554, @@ -78,7 +77,7 @@ static short SOBounds[12] = // offset 0xA144C 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0xF8E4, 0x071C }; -static PHD_VECTOR SOPos = { 0, 0, 0 }; // offset 0xA1464 +static PHD_VECTOR SOPos(0, 0, 0); // offset 0xA1464 short SearchCollectFrames[4] = { 0x00B4, 0x0064, 0x0099, 0x0053 @@ -110,7 +109,7 @@ void PickedUpObject(short objectNumber) switch (objectNumber) { case ID_UZI_ITEM: - if (!(Lara.Weapons[WEAPON_UZI].Present)) + if (!Lara.Weapons[WEAPON_UZI].Present) { Lara.Weapons[WEAPON_UZI].Present = true; Lara.Weapons[WEAPON_UZI].SelectedAmmo = 0; @@ -122,7 +121,7 @@ void PickedUpObject(short objectNumber) break; case ID_PISTOLS_ITEM: - if (!(Lara.Weapons[WEAPON_PISTOLS].Present)) + if (!Lara.Weapons[WEAPON_PISTOLS].Present) { Lara.Weapons[WEAPON_PISTOLS].Present = true; Lara.Weapons[WEAPON_PISTOLS].SelectedAmmo = 0; @@ -133,7 +132,7 @@ void PickedUpObject(short objectNumber) break; case ID_SHOTGUN_ITEM: - if (!(Lara.Weapons[WEAPON_SHOTGUN].Present)) + if (!Lara.Weapons[WEAPON_SHOTGUN].Present) { Lara.Weapons[WEAPON_SHOTGUN].Present = true; Lara.Weapons[WEAPON_SHOTGUN].SelectedAmmo = 0; @@ -145,7 +144,7 @@ void PickedUpObject(short objectNumber) break; case ID_REVOLVER_ITEM: - if (!(Lara.Weapons[WEAPON_REVOLVER].Present)) + if (!Lara.Weapons[WEAPON_REVOLVER].Present) { Lara.Weapons[WEAPON_REVOLVER].Present = true; Lara.Weapons[WEAPON_REVOLVER].SelectedAmmo = 0; @@ -157,7 +156,7 @@ void PickedUpObject(short objectNumber) break; case ID_CROSSBOW_ITEM: - if (!(Lara.Weapons[WEAPON_CROSSBOW].Present)) + if (!Lara.Weapons[WEAPON_CROSSBOW].Present) { Lara.Weapons[WEAPON_CROSSBOW].Present = true; Lara.Weapons[WEAPON_CROSSBOW].SelectedAmmo = 0; @@ -169,7 +168,7 @@ void PickedUpObject(short objectNumber) break; case ID_HK_ITEM: - if (!(Lara.Weapons[WEAPON_CROSSBOW].Present)) + if (!Lara.Weapons[WEAPON_CROSSBOW].Present) { Lara.Weapons[WEAPON_HK].Present = true; Lara.Weapons[WEAPON_HK].SelectedAmmo = 0; @@ -181,7 +180,7 @@ void PickedUpObject(short objectNumber) break; case ID_HARPOON_ITEM: - if (!(Lara.Weapons[WEAPON_HARPOON_GUN].Present)) + if (!Lara.Weapons[WEAPON_HARPOON_GUN].Present) { Lara.Weapons[WEAPON_HARPOON_GUN].Present = true; Lara.Weapons[WEAPON_HARPOON_GUN].SelectedAmmo = 0; @@ -193,7 +192,7 @@ void PickedUpObject(short objectNumber) break; case ID_GRENADE_GUN_ITEM: - if (!(Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Present)) + if (!Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Present) { Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Present = true; Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = 0; @@ -205,7 +204,7 @@ void PickedUpObject(short objectNumber) break; case ID_ROCKET_LAUNCHER_ITEM: - if (!(Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Present)) + if (!Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Present) { Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Present = true; Lara.Weapons[WEAPON_ROCKET_LAUNCHER].SelectedAmmo = 0; @@ -339,7 +338,7 @@ void PickedUpObject(short objectNumber) case ID_GOLDROSE_ITEM: IsAtmospherePlaying = 0; - S_CDPlay(6, 0); + S_CDPlay(6, FALSE); Lara.Secrets++; Savegame.Level.Secrets++; Savegame.Game.Secrets++; @@ -464,7 +463,7 @@ int KeyTrigger(short itemNum) oldkey = KeyTriggerActive; if (!oldkey) - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; KeyTriggerActive = false; @@ -704,7 +703,7 @@ void KeyHoleCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) { if (!Lara.isMoving) { - if (item->status != ITEM_INACTIVE) + if (item->status != ITEM_NOT_ACTIVE) return; if (g_Inventory->GetSelectedObject() == NO_ITEM) { @@ -1277,7 +1276,7 @@ void RegeneratePickups() if (ammo == 0) { - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; } } } @@ -1339,7 +1338,7 @@ short* FindPlinth(ITEM_INFO* item) if (item->pos.xPos == mesh->x && item->pos.zPos == mesh->z) { short* frame = GetBestFrame(item); - STATIC_INFO* s = &StaticObjects[mesh->staticNumber]; + StaticInfo* s = &StaticObjects[mesh->staticNumber]; if (frame[0] <= s->xMaxc && frame[1] >= s->xMinc && frame[4] <= s->zMaxc && frame[5] >= s->zMinc && (s->xMinc || s->xMaxc)) { found = mesh->staticNumber; @@ -1359,8 +1358,9 @@ short* FindPlinth(ITEM_INFO* item) for (itemNumber = room->itemNumber; itemNumber != NO_ITEM; itemNumber = Items[itemNumber].nextItem) { ITEM_INFO* current = &Items[itemNumber]; + ObjectInfo* obj = &Objects[current->objectNumber]; - if (Objects[current->objectNumber].collision != PickupCollision + if (!obj->isPickup && item->pos.xPos == current->pos.xPos && item->pos.yPos <= current->pos.yPos && item->pos.zPos == current->pos.zPos @@ -1401,7 +1401,7 @@ void PuzzleDone(ITEM_INFO* item, short itemNum) { FlipMap(Items[i].triggerFlags - 7); flipmap[Items[i].triggerFlags - 7] ^= IFLAG_ACTIVATION_MASK; - Items[i].status = ITEM_INACTIVE; + Items[i].status = ITEM_NOT_ACTIVE; Items[i].flags |= 0x20; } } @@ -1469,7 +1469,7 @@ void InitialiseSearchObject(short itemNumber) break; } } - else if (Objects[item2->objectNumber].collision == PickupCollision + else if (Objects[item2->objectNumber].isPickup && item->pos.xPos == item2->pos.xPos && item->pos.yPos == item2->pos.yPos && item->pos.zPos == item2->pos.zPos) @@ -1494,7 +1494,7 @@ void SearchObjectCollision(short itemNumber, ITEM_INFO* laraitem, COLL_INFO* lar item = &Items[itemNumber]; objNumber = (item->objectNumber - ID_SEARCH_OBJECT1) / 2; - if (TrInput & IN_ACTION && laraitem->currentAnimState == STATE_LARA_STOP && laraitem->animNumber == ANIMATION_LARA_STAY_IDLE && Lara.gunStatus == LG_NO_ARMS && (item->status == ITEM_INACTIVE && item->objectNumber != ID_SEARCH_OBJECT4 || !item->itemFlags[0]) + if (TrInput & IN_ACTION && laraitem->currentAnimState == STATE_LARA_STOP && laraitem->animNumber == ANIMATION_LARA_STAY_IDLE && Lara.gunStatus == LG_NO_ARMS && (item->status == ITEM_NOT_ACTIVE && item->objectNumber != ID_SEARCH_OBJECT4 || !item->itemFlags[0]) || Lara.isMoving && Lara.generalPtr == (void *) itemNumber) { bounds = GetBoundsAccurate(item); @@ -1600,10 +1600,10 @@ void SearchObjectControl(short itemNumber) if (item->itemFlags[1] != -1) { item2 = &Items[item->itemFlags[1]]; - if (Objects[item2->objectNumber].collision == PickupCollision) + if (Objects[item2->objectNumber].isPickup) { if (FlipStats[0]) - item2->status = ITEM_INACTIVE; + item2->status = ITEM_NOT_ACTIVE; else item2->status = ITEM_INVISIBLE; } @@ -1617,7 +1617,7 @@ void SearchObjectControl(short itemNumber) if (item->itemFlags[1] != -1) { item2 = &Items[item->itemFlags[1]]; - if (Objects[item2->objectNumber].collision == PickupCollision) + if (Objects[item2->objectNumber].isPickup) { AddDisplayPickup(item2->objectNumber); KillItem(item->itemFlags[1]); @@ -1639,7 +1639,7 @@ void SearchObjectControl(short itemNumber) } - if (item->status == ITEM_DEACTIVATED) + if (item->status == ITEM_DESACTIVATED) { if (item->objectNumber == ID_SEARCH_OBJECT4) { @@ -1649,7 +1649,7 @@ void SearchObjectControl(short itemNumber) else { RemoveActiveItem(itemNumber); - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; } } } \ No newline at end of file diff --git a/TR5Main/Game/pickup.h b/TR5Main/Game/pickup.h index 1c61f6d17..6d674ff8a 100644 --- a/TR5Main/Game/pickup.h +++ b/TR5Main/Game/pickup.h @@ -1,6 +1,6 @@ #pragma once -#include "..\Global\global.h" +#include "collide.h" void InitialisePickup(short itemNumber); void PickedUpObject(short objectNumber); diff --git a/TR5Main/Game/room.h b/TR5Main/Game/room.h new file mode 100644 index 000000000..fe54c32a2 --- /dev/null +++ b/TR5Main/Game/room.h @@ -0,0 +1,227 @@ +#pragma once + +typedef struct tr5_room_layer +{ + unsigned int NumLayerVertices; // Number of vertices in this layer (4 bytes) + unsigned short UnknownL1; + unsigned short NumLayerRectangles; // Number of rectangles in this layer (2 bytes) + unsigned short NumLayerTriangles; // Number of triangles in this layer (2 bytes) + unsigned short UnknownL2; + unsigned short Filler; // Always 0 + unsigned short Filler2; // Always 0 + /// The following 6 floats define the bounding box for the layer + float LayerBoundingBoxX1; + float LayerBoundingBoxY1; + float LayerBoundingBoxZ1; + float LayerBoundingBoxX2; + float LayerBoundingBoxY2; + float LayerBoundingBoxZ2; + unsigned int Filler3; // Always 0 (4 bytes) + void* VerticesOffset; + void* PolyOffset; + void* PolyOffset2; +}; + +typedef struct tr5_vertex +{ + float x; + float y; + float z; +}; + +typedef struct tr5_room_vertex +{ + tr5_vertex Vertex; // Vertex is now floating-point + tr5_vertex Normal; + DWORD Colour; // 32-bit colour +}; + +typedef struct tr4_mesh_face3 // 10 bytes +{ + short Vertices[3]; + short Texture; + short Effects; // TR4-5 ONLY: alpha blending and environment mapping strength +}; + +typedef struct tr4_mesh_face4 // 12 bytes +{ + short Vertices[4]; + short Texture; + short Effects; +}; + +typedef struct tr_room_portal // 32 bytes +{ + short AdjoiningRoom; // Which room this portal leads to + TR_VERTEX Normal; + TR_VERTEX Vertices[4]; +}; + +typedef struct tr_room_sector // 8 bytes +{ + unsigned short FDindex; // Index into FloorData[] + unsigned short BoxIndex; // Index into Boxes[] (-1 if none) + unsigned char RoomBelow; // 255 is none + signed char Floor; // Absolute height of floor + unsigned char RoomAbove; // 255 if none + signed char Ceiling; // Absolute height of ceiling +}; + +typedef struct tr5_room_light +{ + float x, y, z; // Position of light, in world coordinates + float r, g, b; // Colour of the light + int Separator; // Dummy value = 0xCDCDCDCD + float In; // Cosine of the IN value for light / size of IN value + float Out; // Cosine of the OUT value for light / size of OUT value + float RadIn; // (IN radians) * 2 + float RadOut; // (OUT radians) * 2 + float Range; // Range of light + float dx, dy, dz; // Direction - used only by sun and spot lights + int x2, y2, z2; // Same as position, only in integer. + int dx2, dy2, dz2; // Same as direction, only in integer. + byte LightType; + byte Filler[3]; // Dummy values = 3 x 0xCD +}; + +typedef struct MESH_INFO +{ + int x; + int y; + int z; + short yRot; + short shade; + short Flags; + short staticNumber; +}; + +typedef struct LIGHTINFO +{ + int x; // size=0, offset=0 + int y; // size=0, offset=4 + int z; // size=0, offset=8 + unsigned char Type; // size=0, offset=12 + unsigned char r; // size=0, offset=13 + unsigned char g; // size=0, offset=14 + unsigned char b; // size=0, offset=15 + short nx; // size=0, offset=16 + short ny; // size=0, offset=18 + short nz; // size=0, offset=20 + short Intensity; // size=0, offset=22 + unsigned char Inner; // size=0, offset=24 + unsigned char Outer; // size=0, offset=25 + short FalloffScale; // size=0, offset=26 + short Length; // size=0, offset=28 + short Cutoff; // size=0, offset=30 +}; + +typedef struct FLOOR_INFO +{ + unsigned short index; + unsigned short fx : 4; + unsigned short box : 11; + unsigned short stopper : 1; + unsigned char pitRoom; + signed char floor; + unsigned char skyRoom; + signed char ceiling; +}; + +typedef enum RoomEnumFlag +{ + ENV_FLAG_WATER = 0x0001, + ENV_FLAG_SWAMP = 0x0004, + ENV_FLAG_OUTSIDE = 0x0008, + ENV_FLAG_DYNAMIC_LIT = 0x0010, + ENV_FLAG_WIND = 0x0020, + ENV_FLAG_NOT_NEAR_OUTSIDE = 0x0040, + ENV_FLAG_NO_LENSFLARE = 0x0080, // Was quicksand in TR3. + ENV_FLAG_MIST = 0x0100, + ENV_FLAG_CAUSTICS = 0x0200, + ENV_FLAG_UNKNOWN3 = 0x0400 +}; + +typedef struct ROOM_INFO +{ + short* data; + short* door; + FLOOR_INFO* floor; + void* something; + MESH_INFO* mesh; + int x; + int y; + int z; + int minfloor; + int maxceiling; + short xSize; + short ySize; + CVECTOR ambient; + short numLights; + short numMeshes; + unsigned char reverbType; + unsigned char flipNumber; + byte meshEffect; + byte boundActive; + short left; + short right; + short top; + short bottom; + short testLeft; + short testRight; + short testTop; + short testBottom; + short itemNumber; + short fxNumber; + short flippedRoom; + unsigned short flags; // ENV_FLAG_enum + unsigned int Unknown1; + unsigned int Unknown2; // Always 0 + unsigned int Unknown3; // Always 0 + unsigned int Separator; // 0xCDCDCDCD + unsigned short Unknown4; + unsigned short Unknown5; + float RoomX; + float RoomY; + float RoomZ; + unsigned int Separator1[4]; // Always 0xCDCDCDCD + unsigned int Separator2; // 0 for normal rooms and 0xCDCDCDCD for null rooms + unsigned int Separator3; // Always 0xCDCDCDCD + unsigned int NumRoomTriangles; + unsigned int NumRoomRectangles; + tr5_room_light* light; // Always 0 + unsigned int LightDataSize; + unsigned int NumLights2; // Always same as NumLights + unsigned int Unknown6; + int RoomYTop; + int RoomYBottom; + unsigned int NumLayers; + tr5_room_layer* LayerOffset; + tr5_room_vertex* VerticesOffset; + void* PolyOffset; + void* PolyOffset2; // Same as PolyOffset + int NumVertices; + int Separator5[4]; // Always 0xCDCDCDCD +}; + +typedef struct ANIM_STRUCT +{ + short* framePtr; + short interpolation; + short currentAnimState; + int velocity; + int acceleration; + int Xvelocity; + int Xacceleration; + short frameBase; + short frameEnd; + short jumpAnimNum; + short jumpFrameNum; + short numberChanges; + short changeIndex; + short numberCommands; + short commandIndex; +}; + +constexpr auto NUM_ROOMS = 1024; +constexpr auto NO_ROOM = 0xFF; +constexpr auto NO_HEIGHT = (-0x7F00); \ No newline at end of file diff --git a/TR5Main/Game/rope.cpp b/TR5Main/Game/rope.cpp index d53bd33fe..11965adc5 100644 --- a/TR5Main/Game/rope.cpp +++ b/TR5Main/Game/rope.cpp @@ -1,10 +1,10 @@ +#include "framework.h" #include "rope.h" -#include "..\Global\global.h" #include "draw.h" #include "laramisc.h" #include "lara.h" -#include "..\Specific\level.h" -#include "../Specific/input.h" +#include "level.h" +#include "input.h" #include "control.h" PENDULUM CurrentPendulum; diff --git a/TR5Main/Game/rope.h b/TR5Main/Game/rope.h index 680b049e2..3f83b0326 100644 --- a/TR5Main/Game/rope.h +++ b/TR5Main/Game/rope.h @@ -1,6 +1,6 @@ #pragma once -#include "..\Global\global.h" +#include "collide.h" struct ROPE_STRUCT { diff --git a/TR5Main/Game/savegame.cpp b/TR5Main/Game/savegame.cpp index 3bbcf2cec..dcd57c051 100644 --- a/TR5Main/Game/savegame.cpp +++ b/TR5Main/Game/savegame.cpp @@ -1,27 +1,28 @@ +#include "framework.h" #include "savegame.h" -#include "..\Global\global.h" -#include "..\Game\Lara.h" -#include "..\Game\items.h" -#include "..\Game\box.h" -#include "..\Game\pickup.h" -#include "..\Game\lot.h" -#include "..\Game\switch.h" -#include "..\Game\spotcam.h" +#include "Lara.h" +#include "items.h" +#include "box.h" +#include "pickup.h" +#include "lot.h" +#include "switch.h" +#include "spotcam.h" #include "traps.h" -#include "..\Game\laramisc.h" -#include "..\Objects\newobjects.h" -#include "..\Objects\oldobjects.h" -#include "..\Game\sound.h" -#include "..\Specific\level.h" -#include "../Specific/setup.h" +#include "laramisc.h" +#include "sound.h" +#include "level.h" +#include "setup.h" #include "camera.h" +#include "quad.h" +#include "tr5_rats_emitter.h" +#include "tr5_bats_emitter.h" +#include "tr5_spider_emitter.h" FileStream* SaveGame::m_stream; ChunkReader* SaveGame::m_reader; ChunkWriter* SaveGame::m_writer; vector SaveGame::m_luaVariables; int SaveGame::LastSaveGame; -SAVEGAME_INFO Savegame; ChunkId* SaveGame::m_chunkGameStatus; ChunkId* SaveGame::m_chunkItems; @@ -65,6 +66,7 @@ ChunkId* SaveGame::m_chunkPickupCombo; ChunkId* SaveGame::m_chunkExamineCombo; ChunkId* SaveGame::m_chunkWeaponItem; +SAVEGAME_INFO Savegame; extern vector g_AudioTracks; extern byte SequenceUsed[6]; extern byte SequenceResults[3][3][3]; @@ -512,18 +514,17 @@ bool SaveGame::readLara() memcpy(&Lara, lara, sizeof(LaraInfo)); free(buffer); - for (int i = 0; i < 15; i++) + for (int i = 0; i < NUM_LARA_MESHES; i++) { - Lara.meshPtrs[i] = ADD_PTR(Lara.meshPtrs[i], short, MeshBase); - //printf("MeshPtr: %d\n", Lara.meshPtrs[i]); + Lara.meshPtrs[i] = AddPtr(Lara.meshPtrs[i], short, MeshBase); } - Lara.leftArm.frameBase = ADD_PTR(Lara.leftArm.frameBase, short, Objects[ID_LARA].frameBase); - Lara.rightArm.frameBase = ADD_PTR(Lara.rightArm.frameBase, short, Objects[ID_LARA].frameBase); + Lara.leftArm.frameBase = AddPtr(Lara.leftArm.frameBase, short, Objects[ID_LARA].frameBase); + Lara.rightArm.frameBase = AddPtr(Lara.rightArm.frameBase, short, Objects[ID_LARA].frameBase); Lara.target = NULL; Lara.spazEffect = NULL; - Lara.generalPtr = ADD_PTR(Lara.generalPtr, char, malloc_buffer); + Lara.generalPtr = (void*)AddPtr(Lara.generalPtr, char, malloc_buffer); Lara.weaponItem = NO_ITEM; // Is Lara burning? @@ -543,7 +544,6 @@ bool SaveGame::readLara() } m_reader->ReadChunks(&readLaraChunks, 0); - return true; } @@ -575,7 +575,7 @@ bool SaveGame::readItem() m_reader->ReadChunks(&readItemChunks, itemNumber); DisableBaddieAI(itemNumber); KillItem(itemNumber); - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; item->flags |= ONESHOT; item->afterDeath = 128; } @@ -589,11 +589,8 @@ bool SaveGame::readItem() } // Some post-processing things - if (obj->collision == PuzzleHoleCollision && (item->status == ITEM_DEACTIVATED || item->status == ITEM_ACTIVE)) - { - item->objectNumber += 8; - //*((_WORD *)pItem - 28) = v55 + Objects[*((_WORD *)pItem - 32)].anim_index; - } + if (obj->isPuzzleHole && (item->status == ITEM_DESACTIVATED || item->status == ITEM_ACTIVE)) + item->objectNumber += NUM_PUZZLES; if (item->objectNumber >= ID_SMASH_OBJECT1 && item->objectNumber <= ID_SMASH_OBJECT8 && (item->flags & ONESHOT)) item->meshBits = 0x100; @@ -770,7 +767,6 @@ bool SaveGame::readLaraChunks(ChunkId* chunkId, int maxSize, int arg) else if (chunkId->EqualsTo(m_chunkWeaponInfo)) { int id = LEB128::ReadInt32(m_stream); - CarriedWeaponInfo* weapon = &Lara.Weapons[id]; weapon->Present = LEB128::ReadByte(m_stream); @@ -1046,7 +1042,7 @@ bool SaveGame::readItemChunks(ChunkId* chunkId, int maxSize, int itemNumber) creature->mood = (MOOD_TYPE)LEB128::ReadInt32(m_stream); ITEM_INFO* enemy = (ITEM_INFO*)LEB128::ReadLong(m_stream); - creature->enemy = ADD_PTR(enemy, ITEM_INFO, malloc_buffer); + creature->enemy = AddPtr(enemy, ITEM_INFO, malloc_buffer); creature->aiTarget.objectNumber = LEB128::ReadInt16(m_stream); creature->aiTarget.roomNumber = LEB128::ReadInt16(m_stream); diff --git a/TR5Main/Game/savegame.h b/TR5Main/Game/savegame.h index 69d4aa00f..b679364d6 100644 --- a/TR5Main/Game/savegame.h +++ b/TR5Main/Game/savegame.h @@ -1,19 +1,49 @@ #pragma once - -#include "..\Global\global.h" -#include "..\Specific\IO\ChunkId.h" -#include "..\Specific\IO\ChunkReader.h" -#include "..\Specific\IO\ChunkWriter.h" -#include "..\Specific\IO\LEB128.h" -#include "..\Specific\IO\Streams.h" -#include "..\Scripting\GameFlowScript.h" -#include "..\Scripting\GameLogicScript.h" +#include "ChunkId.h" +#include "ChunkReader.h" +#include "ChunkWriter.h" +#include "LEB128.h" +#include "Streams.h" +#include "GameFlowScript.h" +#include "GameLogicScript.h" #define SAVEGAME_BUFFER_SIZE 1048576 -extern GameFlow* g_GameFlow; -extern GameScript* g_GameScript; -extern SAVEGAME_INFO Savegame; +typedef struct STATS +{ + unsigned int Timer; + unsigned int Distance; + unsigned int AmmoUsed; + unsigned int AmmoHits; + unsigned short Kills; + unsigned char Secrets; + unsigned char HealthUsed; +}; + +typedef struct SAVEGAME_INFO +{ + short Checksum; + unsigned short VolumeCD; + unsigned short VolumeFX; + short ScreenX; + short ScreenY; + unsigned char ControlOption; + bool VibrateOn; + bool AutoTarget; + STATS Level; + STATS Game; + short WeaponObject; + short WeaponAnim; + short WeaponFrame; + short WeaponCurrent; + short WeaponGoal; + unsigned int CutSceneTriggered1; + unsigned int CutSceneTriggered2; + byte GameComplete; + unsigned char LevelNumber; + unsigned char CampaignSecrets[4]; + unsigned char TLCount; +}; typedef struct SaveGameHeader { @@ -28,6 +58,10 @@ typedef struct SaveGameHeader bool Present; }; +extern GameFlow* g_GameFlow; +extern GameScript* g_GameScript; +extern SAVEGAME_INFO Savegame; + class SaveGame { private: static FileStream* m_stream; @@ -134,9 +168,7 @@ public: static void Start(); static void End(); - static bool Load(char* fileName); static bool LoadHeader(char* fileName, SaveGameHeader* header); - static bool Save(char* fileName); }; \ No newline at end of file diff --git a/TR5Main/Game/sound.cpp b/TR5Main/Game/sound.cpp index 8e2456dfb..9b8136e4c 100644 --- a/TR5Main/Game/sound.cpp +++ b/TR5Main/Game/sound.cpp @@ -1,9 +1,10 @@ +#include "framework.h" #include "sound.h" #include "lara.h" #include "camera.h" -#include "..\Specific\configuration.h" -#include "..\Specific\level.h"" -#include "..\Specific\winmain.h" +#include "configuration.h" +#include "level.h" +#include "winmain.h" HSTREAM BASS_3D_Mixdown; HFX BASS_FXHandler[NUM_SOUND_FILTERS]; diff --git a/TR5Main/Game/sound.h b/TR5Main/Game/sound.h index f701865f3..e605cc1bb 100644 --- a/TR5Main/Game/sound.h +++ b/TR5Main/Game/sound.h @@ -1,14 +1,12 @@ #pragma once +#include "control.h" -#include "bass.h" -#include "bass_fx.h" -#include - -#include "..\Game\control.h" -#include "..\Global\global.h" - -#include -using namespace DirectX::SimpleMath; +enum SFX_TYPES +{ + SFX_LANDANDWATER = 0, + SFX_LANDONLY = (1 << 14), + SFX_WATERONLY = (2 << 14) +}; typedef enum audio_tracks { @@ -1969,7 +1967,7 @@ typedef enum sound_effects #define SOUND_XFADETIME_HIJACKSOUND 50 #define SOUND_BGM_DAMP_COEFFICIENT 0.6f -struct SoundEffectSlot +typedef struct SoundEffectSlot { short state; short effectID; @@ -1978,13 +1976,13 @@ struct SoundEffectSlot Vector3 origin; }; -struct SoundTrackSlot +typedef struct SoundTrackSlot { HSTREAM channel; short trackID; }; -enum sound_track_types +typedef enum sound_track_types { SOUND_TRACK_ONESHOT, SOUND_TRACK_BGM, @@ -1992,7 +1990,7 @@ enum sound_track_types NUM_SOUND_TRACK_TYPES }; -enum sound_filters +typedef enum sound_filters { SOUND_FILTER_REVERB, SOUND_FILTER_COMPRESSOR, @@ -2001,14 +1999,14 @@ enum sound_filters NUM_SOUND_FILTERS }; -enum sound_states +typedef enum sound_states { SOUND_STATE_IDLE, SOUND_STATE_ENDING, SOUND_STATE_ENDED }; -enum sound_flags +typedef enum sound_flags { SOUND_NORMAL, SOUND_WAIT, @@ -2016,7 +2014,7 @@ enum sound_flags SOUND_LOOPED }; -enum reverb_type +typedef enum reverb_type { RVB_OUTSIDE, // 0x00 no reverberation RVB_SMALL_ROOM, // 0x01 little reverberation @@ -2027,7 +2025,17 @@ enum reverb_type NUM_REVERB_TYPES }; -struct AudioTrack +typedef struct SAMPLE_INFO +{ + short number; + byte volume; + byte radius; + byte randomness; + signed char pitch; + short flags; +}; + +typedef struct AudioTrack { char* Name; byte Mask; diff --git a/TR5Main/Game/sphere.cpp b/TR5Main/Game/sphere.cpp index 95eff6b7c..e03084f26 100644 --- a/TR5Main/Game/sphere.cpp +++ b/TR5Main/Game/sphere.cpp @@ -1,8 +1,11 @@ +#include "framework.h" #include "sphere.h" #include "draw.h" #include "lara.h" -#include "../Specific/level.h" -#include "../Specific/setup.h" +#include "level.h" +#include "setup.h" +#include "Renderer11.h" +#include "trmath.h" int NumLaraSpheres; bool GotLaraSpheres; @@ -97,7 +100,6 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l) int dz = z1 - z2; int r = r1 + r2; - if (SQUARE(dx) + SQUARE(dy) + SQUARE(dz) < SQUARE(r)) { l->touchBits |= (1 << j); diff --git a/TR5Main/Game/sphere.h b/TR5Main/Game/sphere.h index d59d090fa..8c4b771e6 100644 --- a/TR5Main/Game/sphere.h +++ b/TR5Main/Game/sphere.h @@ -1,12 +1,19 @@ #pragma once - -#include "..\Global\global.h" +#include "items.h" #define SPHERES_SPACE_LOCAL 0 #define SPHERES_SPACE_WORLD 1 #define SPHERES_SPACE_BONE_ORIGIN 2 #define MAX_SPHERES 34 +typedef struct SPHERE +{ + int x; + int y; + int z; + int r; +}; + extern int NumLaraSpheres; extern bool GotLaraSpheres; extern SPHERE LaraSpheres[MAX_SPHERES]; diff --git a/TR5Main/Game/spotcam.cpp b/TR5Main/Game/spotcam.cpp index a23bf07a0..4d9e56931 100644 --- a/TR5Main/Game/spotcam.cpp +++ b/TR5Main/Game/spotcam.cpp @@ -1,13 +1,12 @@ +#include "framework.h" #include "spotcam.h" - -#include "..\Global\global.h" -#include "Camera.h" +#include "camera.h" #include "control.h" #include "draw.h" #include "tomb4fx.h" #include "switch.h" #include "lara.h" -#include "../Specific/input.h" +#include "input.h" int LastSequence; int SpotcamTimer; @@ -50,8 +49,6 @@ int SlowMotion; int SpotcamDontDrawLara; int SpotcamOverlay; -extern Renderer11* g_Renderer; - void InitSpotCamSequences() { int s, cc, n, ce; diff --git a/TR5Main/Game/spotcam.h b/TR5Main/Game/spotcam.h index 9f9692cc0..c546c5d3a 100644 --- a/TR5Main/Game/spotcam.h +++ b/TR5Main/Game/spotcam.h @@ -1,6 +1,30 @@ #pragma once +#include "phd_global.h" -#include "..\Global\global.h" +struct QUAKE_CAMERA +{ + GAME_VECTOR spos; + GAME_VECTOR epos; +}; + +typedef struct SPOTCAM +{ + int x; + int y; + int z; + int tx; + int ty; + int tz; + unsigned char sequence; + unsigned char camera; + short fov; + short roll; + short timer; + short speed; + short flags; + short roomNumber; + short pad; +}; enum spotcam_flags { diff --git a/TR5Main/Game/switch.cpp b/TR5Main/Game/switch.cpp index e411bc45d..608a1797f 100644 --- a/TR5Main/Game/switch.cpp +++ b/TR5Main/Game/switch.cpp @@ -1,18 +1,18 @@ +#include "framework.h" #include "switch.h" #include "laramisc.h" #include "door.h" #include "items.h" #include "lot.h" #include "objects.h" -#include "collide.h" #include "Lara.h" #include "inventory.h" #include "draw.h" #include "sphere.h" #include "camera.h" -#include "../Specific/setup.h" -#include "..\Specific\level.h" -#include "../Specific/input.h" +#include "setup.h" +#include "level.h" +#include "input.h" #include "sound.h" byte SequenceUsed[6]; @@ -42,12 +42,6 @@ short TurnSwitchBoundsC[12] = // offset 0xA14FC 0xF8E4, 0x071C }; PHD_VECTOR TurnSwitchPosA = { 650, 0, -138 }; // offset 0xA1514 -PHD_VECTOR CogSwitchPos = { 0, 0, -856 }; // offset 0xA1520 -short CogSwitchBounds[12] = // offset 0xA152C -{ - 0xFE00, 0x0200, 0x0000, 0x0000, 0xFA00, 0xFE00, 0xF8E4, 0x071C, 0xEAAC, 0x1554, - 0xF8E4, 0x071C -}; PHD_VECTOR RailSwitchPos = { 0, 0, -550 }; // offset 0xA1544 short RailSwitchBounds[12] = // offset 0xA1550 { @@ -205,125 +199,6 @@ void CrowDoveSwitchControl(short itemNumber) } } -void CogSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) -{ - ITEM_INFO* item = &Items[itemNum]; - - FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &item->roomNumber); - GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - - if (!TriggerIndex) - { - ObjectCollision(itemNum, l, coll); - return; - } - - short* trigger = TriggerIndex; - for (int i = *TriggerIndex; (i & 0x1F) != 4; trigger++) - { - if (i < 0) - break; - i = trigger[1]; - } - - ITEM_INFO* target = &Items[trigger[3] & 0x3FF]; - DOOR_DATA* door = (DOOR_DATA*)target->data; - - if (item->status == ITEM_INACTIVE) - { - if (!(item->flags & 0x100) - && (TrInput & IN_ACTION - && !Lara.gunStatus - && !(item->status && item->gravityStatus) - && l->currentAnimState == STATE_LARA_STOP - && l->animNumber == ANIMATION_LARA_STAY_IDLE - || Lara.isMoving && Lara.generalPtr == (void*)itemNum)) - { - if (TestLaraPosition(CogSwitchBounds, item, l)) - { - if (MoveLaraPosition(&CogSwitchPos, item, l)) - { - Lara.isMoving = false; - Lara.headYrot = 0; - Lara.headXrot = 0; - Lara.torsoYrot = 0; - Lara.torsoXrot = 0; - Lara.gunStatus = LG_HANDS_BUSY; - Lara.generalPtr = target; - l->animNumber = ANIMATION_LARA_COGWHEEL_GRAB; - l->goalAnimState = STATE_LARA_COGWHEEL; - l->currentAnimState = STATE_LARA_COGWHEEL; - l->frameNumber = Anims[l->animNumber].frameBase; - - AddActiveItem(itemNum); - - item->goalAnimState = 1; - item->status = ITEM_ACTIVE; - if (!door->opened) - { - AddActiveItem((target - Items)); - target->itemFlags[2] = target->pos.yPos; - target->status = ITEM_ACTIVE; - } - } - else - { - Lara.generalPtr = (void*)itemNum; - } - return; - } - if (Lara.isMoving && Lara.generalPtr == (void*)itemNum) - { - Lara.isMoving = false; - Lara.gunStatus = LG_NO_ARMS; - } - } - - ObjectCollision(itemNum, l, coll); - } -} - -void CogSwitchControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - AnimateItem(item); - - if (item->currentAnimState == 1) - { - if (item->goalAnimState == 1 && !(TrInput & IN_ACTION)) - { - LaraItem->goalAnimState = STATE_LARA_STOP; - item->goalAnimState = 0; - } - - if (LaraItem->animNumber == ANIMATION_LARA_COGWHEEL_PULL) - { - if (LaraItem->frameNumber == (Anims[ANIMATION_LARA_COGWHEEL_PULL].frameBase + 10)) - { - ITEM_INFO* it = (ITEM_INFO*)Lara.generalPtr; - it->itemFlags[0] = 40; - Lara.generalPtr = it; - SoundEffect(SFX_STONE_SCRAPE_FAST, &it->pos, 0); - } - } - } - else - { - if (item->frameNumber == Anims[item->animNumber].frameEnd) - { - item->currentAnimState = 0; - item->status = ITEM_INACTIVE; - RemoveActiveItem(itemNum); - LaraItem->animNumber = ANIMATION_LARA_STAY_SOLID; - LaraItem->frameNumber = Anims[LaraItem->animNumber].frameBase; - LaraItem->goalAnimState = STATE_LARA_STOP; - LaraItem->currentAnimState = STATE_LARA_STOP; - Lara.gunStatus = LG_NO_ARMS; - } - } -} - void FullBlockSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) { ITEM_INFO* item = &Items[itemNum]; @@ -389,7 +264,7 @@ void FullBlockSwitchControl(short itemNumber) { item->itemFlags[0] = 0; item->goalAnimState = 1; - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; if (++CurrentSequence >= 7u) CurrentSequence = 0; } @@ -876,7 +751,7 @@ void TurnSwitchControl(short itemNum) l->frameNumber = Anims[l->animNumber].frameBase; item->animNumber = Objects[item->objectNumber].animIndex; item->frameNumber = Anims[item->animNumber].frameBase; - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; RemoveActiveItem(itemNum); @@ -1019,7 +894,7 @@ void SwitchCollision2(short itemNum, ITEM_INFO* l, COLL_INFO* coll) if (TrInput & IN_ACTION) { - if (item->status == ITEM_INACTIVE && Lara.waterStatus == LW_UNDERWATER && !Lara.gunStatus && l->currentAnimState == STATE_LARA_UNDERWATER_STOP) + if (item->status == ITEM_NOT_ACTIVE && Lara.waterStatus == LW_UNDERWATER && !Lara.gunStatus && l->currentAnimState == STATE_LARA_UNDERWATER_STOP) { if (TestLaraPosition(Switch2Bounds, item, l)) { @@ -1054,7 +929,7 @@ void SwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) && l->currentAnimState == STATE_LARA_STOP && l->animNumber == ANIMATION_LARA_STAY_IDLE && !Lara.gunStatus - && item->status == ITEM_INACTIVE + && item->status == ITEM_NOT_ACTIVE && !(item->flags & 0x100) && item->triggerFlags >= 0 || Lara.isMoving && Lara.generalPtr == (void*)itemNum) @@ -1347,7 +1222,7 @@ int GetSwitchTrigger(ITEM_INFO* item, short* itemNos, int AttatchedToSwitch) int SwitchTrigger(short itemNum, short timer) { ITEM_INFO* item = &Items[itemNum]; - if (item->status == ITEM_DEACTIVATED) + if (item->status == ITEM_DESACTIVATED) { if ((!item->currentAnimState && item->objectNumber != ID_JUMP_SWITCH || item->currentAnimState == 1 && item->objectNumber == ID_JUMP_SWITCH) && timer > 0) { @@ -1361,7 +1236,7 @@ int SwitchTrigger(short itemNum, short timer) { RemoveActiveItem(itemNum); - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; if (!item->itemFlags[0] == 0) item->flags |= 0x100; if (item->currentAnimState != 1) diff --git a/TR5Main/Game/switch.h b/TR5Main/Game/switch.h index 25ee9564f..f67c132a6 100644 --- a/TR5Main/Game/switch.h +++ b/TR5Main/Game/switch.h @@ -1,5 +1,8 @@ #pragma once -#include "..\Global\global.h" + +#include "collide.h" + +extern int PulleyItemNumber; void CrowDoveSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); void CrowDoveSwitchControl(short itemNumber); @@ -27,5 +30,3 @@ void InitialiseCrowDoveSwitch(short itemNumber); void ProcessExplodingSwitchType8(ITEM_INFO* item); void InitialiseShootSwitch(short itemNumber); void ShootSwitchCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll); - -extern int PulleyItemNumber; diff --git a/TR5Main/Game/text.cpp b/TR5Main/Game/text.cpp index eab180cb8..9ed77c6d1 100644 --- a/TR5Main/Game/text.cpp +++ b/TR5Main/Game/text.cpp @@ -1,7 +1,9 @@ +#include "framework.h" #include "text.h" #include "draw.h" +#include "Renderer11.h" void PrintString(int x, int y, int unk1, char* string, int unk2) { - g_Renderer->PrintString(x, y, string, 0xFFFFFFFF, 0); + g_Renderer->PrintString(x, y, string, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 255), 0); } diff --git a/TR5Main/Game/tomb4fx.cpp b/TR5Main/Game/tomb4fx.cpp index 84e61da4f..03db53dbc 100644 --- a/TR5Main/Game/tomb4fx.cpp +++ b/TR5Main/Game/tomb4fx.cpp @@ -1,13 +1,14 @@ +#include "framework.h" #include "tomb4fx.h" -#include "../Global/global.h" #include "lara.h" #include "effect2.h" #include "draw.h" -#include "items.h" -#include "../Specific/setup.h" -#include "..\Specific\level.h" +#include "setup.h" +#include "level.h" #include "sound.h" #include "bubble.h" +#include "trmath.h" +#include "GameFlowScript.h" char FlareTable[121] = { @@ -45,11 +46,7 @@ BLOOD_STRUCT Blood[MAX_SPARKS_BLOOD]; DRIP_STRUCT Drips[MAX_DRIPS]; SHOCKWAVE_STRUCT ShockWaves[MAX_SHOCKWAVE]; FIRE_LIST Fires[MAX_FIRE_LIST]; -ENERGY_ARC EnergyArcs[MAX_ENERGY_ARCS]; - -extern int NextSpark; -extern SPARKS Sparks[MAX_SPARKS]; -extern Renderer11* g_Renderer; +ENERGY_ARC EnergyArcs[MAX_ENERGYARCS]; int GetFreeFireSpark() { @@ -116,7 +113,7 @@ void TriggerGlobalStaticFlame() spark->xVel = 0; spark->yVel = 0; spark->zVel = 0; - spark->flags = 0; + spark->flags = SP_NONE; spark->dSize = spark->sSize = spark->size = (GetRandomControl() & 0x1F) + -128; } @@ -153,7 +150,7 @@ void TriggerGlobalFireSmoke() } else { - spark->flags = 0; + spark->flags = SP_NONE; } spark->gravity = -16 - (GetRandomControl() & 0xF); @@ -196,7 +193,7 @@ void TriggerGlobalFireFlame() } else { - spark->flags = 0; + spark->flags = SP_NONE; } spark->sSize = spark->size = (GetRandomControl() & 0x1F) + 128; @@ -331,7 +328,7 @@ void UpdateFireSparks() void UpdateEnergyArcs() { - for (int i = 0; i < MAX_ENERGY_ARCS; i++) + for (int i = 0; i < MAX_ENERGYARCS; i++) { ENERGY_ARC* arc = &EnergyArcs[i]; @@ -487,7 +484,7 @@ byte TriggerGunSmoke_SubFunction(int weaponType) case WEAPON_HK: case WEAPON_ROCKET_LAUNCHER: case WEAPON_GRENADE_LAUNCHER: - return 0x18; //(12) Rocket and Grenade value for TriggerGunSmoke in TR3 have the value 12 ! (the HK is not included there) + return 24; //(12) Rocket and Grenade value for TriggerGunSmoke in TR3 have the value 12 ! (the HK is not included there) // other weapon default: @@ -514,7 +511,7 @@ void TriggerGunSmoke(int x, int y, int z, short xv, short yv, short zv, byte ini spark->dShade = 64; } - spark->transType = 2; + spark->transType = COLADD; spark->x = x + (GetRandomControl() & 31) - 16; spark->y = y + (GetRandomControl() & 31) - 16; spark->z = z + (GetRandomControl() & 31) - 16; @@ -555,7 +552,7 @@ void TriggerGunSmoke(int x, int y, int z, short xv, short yv, short zv, byte ini } else { - spark->flags = 0; + spark->flags = SP_NONE; } float gravity = frand() * 1.25f; spark->gravity = gravity; @@ -595,7 +592,7 @@ void TriggerShatterSmoke(int x, int y, int z) spark->colFadeSpeed = 4; spark->dShade = (GetRandomControl() & 0x1F) + 64; spark->fadeToBlack = 24 - (GetRandomControl() & 7); - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 7) + 48; spark->x = (GetRandomControl() & 0x1F) + x - 16; spark->y = (GetRandomControl() & 0x1F) + y - 16; @@ -620,7 +617,7 @@ void TriggerShatterSmoke(int x, int y, int z) } else { - spark->flags = 0; + spark->flags = SP_NONE; } spark->gravity = -4 - (GetRandomControl() & 3); @@ -1026,13 +1023,13 @@ void AddWaterSparks(int x, int y, int z, int num) spark->fadeToBlack = 8; spark->life = 24; spark->sLife = 24; - spark->transType = 2; + spark->transType = COLADD; int random = GetRandomControl(); spark->xVel = -rcossin_tbl[2 * random] >> 5; spark->yVel = -640 - GetRandomControl(); spark->zVel = rcossin_tbl[2 * random & 0xFFF + 1] >> 5; spark->friction = 5; - spark->flags = 0; + spark->flags = SP_NONE; spark->x = x + (spark->xVel >> 3); spark->y = y - (spark->yVel >> 5); spark->z = z + (spark->zVel >> 3); @@ -1041,10 +1038,6 @@ void AddWaterSparks(int x, int y, int z, int num) } } - - - - void LaraBubbles(ITEM_INFO* item)// (F) { PHD_VECTOR pos; @@ -1201,7 +1194,7 @@ void TriggerLaraDrips()// (F) } } -int ExplodingDeath(short itemNumber, int meshBits, short damage) +int ExplodingDeath(short itemNumber, int meshBits, short flags) { ITEM_INFO* item = &Items[itemNumber]; ObjectInfo* obj = &Objects[item->objectNumber]; @@ -1234,7 +1227,7 @@ int ExplodingDeath(short itemNumber, int meshBits, short damage) int bits = 1; if (meshBits & 1 && item->meshBits & 1) { - if (damage & 0x100 || !(GetRandomControl() & 3)) + if (flags & 0x100 || !(GetRandomControl() & 3)) { Matrix boneMatrix = g_Renderer->GetBoneMatrix(item, 0); @@ -1250,24 +1243,24 @@ int ExplodingDeath(short itemNumber, int meshBits, short damage) fx->pos.zRot = 0; fx->pos.xRot = 0; - if (damage & 0x10) + if (flags & 0x10) { fx->speed = 0; } else { - if (damage & 0x20) + if (flags & 0x20) fx->speed = GetRandomControl() >> 12; else fx->speed = GetRandomControl() >> 8; } - if (damage & 0x40) + if (flags & 0x40) { fx->fallspeed = 0; } else { - if ((damage & 0x80u) == 0) + if ((flags & 0x80u) == 0) fx->fallspeed = -(GetRandomControl() >> 8); else fx->fallspeed = -(GetRandomControl() >> 12); @@ -1523,7 +1516,7 @@ void TriggerExplosionBubble(int x, int y, int z, short roomNum)// (F) spark->sB = 0; spark->colFadeSpeed = 8; spark->fadeToBlack = 12; - spark->transType = 2; + spark->transType = COLADD; spark->x = x; spark->y = y; spark->z = z; @@ -1580,7 +1573,7 @@ void TriggerExplosionBubble(int x, int y, int z, short roomNum)// (F) spark->fadeToBlack = 64; spark->life = spark->sLife = (GetRandomControl() & 0x1F) + 96; if (unk) - spark->transType = 2; + spark->transType = COLADD; else spark->transType = 3; spark->x = (GetRandomControl() & 0x1F) + x - 16; @@ -1645,7 +1638,7 @@ void TriggerLightningGlow(int x, int y, int z, byte size, byte r, byte g, byte b spark->dR = r; spark->sR = r; spark->colFadeSpeed = 2; - spark->transType = 2; + spark->transType = COLADD; spark->on = 1; spark->dB = b; spark->sB = b; @@ -1680,7 +1673,7 @@ void TriggerFenceSparks(int x, int y, int z, int kill, int crane)//(F) spark->life = (GetRandomControl() & 7) + 24; spark->sLife = (GetRandomControl() & 7) + 24; - spark->transType = 2; + spark->transType = COLADD; spark->dynamic = -1; spark->x = x; @@ -1700,7 +1693,7 @@ void TriggerFenceSparks(int x, int y, int z, int kill, int crane)//(F) spark->friction = 4; } - spark->flags = 0; + spark->flags = SP_NONE; spark->gravity = (GetRandomControl() & 0xF) + ((crane << 4) + 16); spark->maxYvel = 0; } @@ -1730,7 +1723,7 @@ void TriggerSmallSplash(int x, int y, int z, int num) sptr->life = 24; sptr->sLife = 24; - sptr->transType = 2; + sptr->transType = COLADD; angle = GetRandomControl() << 3; @@ -1754,7 +1747,7 @@ ENERGY_ARC* TriggerEnergyArc(PHD_VECTOR* start, PHD_VECTOR* end, byte r, byte g, { ENERGY_ARC* arc = NULL; - for (int i = 0; i < 16; i++) + for (int i = 0; i < MAX_ENERGYARCS; i++) { arc = &EnergyArcs[i]; if (arc->life == 0) diff --git a/TR5Main/Game/tomb4fx.h b/TR5Main/Game/tomb4fx.h index e322ef087..3e0bedaf9 100644 --- a/TR5Main/Game/tomb4fx.h +++ b/TR5Main/Game/tomb4fx.h @@ -1,31 +1,185 @@ #pragma once -#include "..\Global\types.h" -#include "..\Global\constants.h" +#include "phd_global.h" +#include "items.h" -struct ENERGY_ARC +typedef struct ENERGY_ARC { - PHD_VECTOR pos1; // 0 + PHD_VECTOR pos1; PHD_VECTOR pos2; - PHD_VECTOR pos3; // 24 - PHD_VECTOR pos4; // 36 - byte r; // 48 - byte g; // 49 - byte b; // 50 - short sLife; // 52 - short life; // 51 + PHD_VECTOR pos3; + PHD_VECTOR pos4; + byte r; + byte g; + byte b; + short sLife; + short life; short amplitude; - short segmentSize; // 64 - short sAmplitude; // 53 - byte type; // 61 - byte flags; // 62 - signed char direction; // 63 + short segmentSize; + short sAmplitude; + byte type; + byte flags; + signed char direction; short rotation; short filler; }; +typedef struct SMOKE_SPARKS +{ + int x; + int y; + int z; + short xVel; + short yVel; + short zVel; + short gravity; + short rotAng; + short flags; + byte sSize; + byte dSize; + byte size; + byte friction; + byte scalar; + byte def; + signed char rotAdd; + signed char maxYvel; + byte on; + byte sShade; + byte dShade; + byte shade; + byte colFadeSpeed; + byte fadeToBlack; + signed char sLife; + signed char life; + byte transType; + byte fxObj; + byte nodeNumber; + byte mirror; +}; + +typedef struct GUNFLASH_STRUCT +{ + MATRIX3D matrix; + short on; +}; + +typedef struct SHOCKWAVE_STRUCT +{ + int x; + int y; + int z; + short innerRad; + short outerRad; + short xRot; + short flags; + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char life; + short speed; + short temp; +}; + +typedef struct GUNSHELL_STRUCT +{ + PHD_3DPOS pos; + short fallspeed; + short roomNumber; + short speed; + short counter; + short dirXrot; + short objectNumber; +}; + +typedef struct DRIP_STRUCT +{ + int x; + int y; + int z; + byte on; + byte r; + byte g; + byte b; + short yVel; + byte gravity; + byte life; + short roomNumber; + byte outside; + byte pad; +}; + +typedef struct FIRE_LIST +{ + int x; + int y; + int z; + byte on; + byte size; + short roomNumber; +}; + +typedef struct FIRE_SPARKS +{ + short x; + short y; + short z; + short xVel; + short yVel; + short zVel; + short gravity; + short rotAng; + short flags; + unsigned char sSize; + unsigned char dSize; + unsigned char size; + unsigned char friction; + unsigned char scalar; + unsigned char def; + signed char rotAdd; + signed char maxYvel; + unsigned char on; + unsigned char sR; + unsigned char sG; + unsigned char sB; + unsigned char dR; + unsigned char dG; + unsigned char dB; + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char colFadeSpeed; + unsigned char fadeToBlack; + unsigned char sLife; + unsigned char life; +}; + +typedef struct BLOOD_STRUCT +{ + int x; + int y; + int z; + short xVel; + short yVel; + short zVel; + short gravity; + short rotAng; + unsigned char sSize; + unsigned char dSize; + unsigned char size; + unsigned char friction; + byte rotAdd; + unsigned char on; + unsigned char sShade; + unsigned char dShade; + unsigned char shade; + unsigned char colFadeSpeed; + unsigned char fadeToBlack; + byte sLife; + byte life; + byte pad; +}; + #define ENERGY_ARC_STRAIGHT_LINE 0 #define ENERGY_ARC_CIRCLE 1 - #define ENERGY_ARC_NO_RANDOMIZE 1 extern int LaserSightX; @@ -42,8 +196,26 @@ extern int NextBlood; extern int NextSpider; extern int NextGunShell; +#define MAX_SPARKS_FIRE 20 +#define MAX_FIRE_LIST 32 +#define MAX_SPARKS_SMOKE 32 +#define MAX_SPARKS_BLOOD 32 +#define MAX_GUNFLASH 4 +#define MAX_GUNSHELL 24 +#define MAX_DRIPS 32 +#define MAX_SHOCKWAVE 16 +#define MAX_ENERGYARCS 32 + +extern GUNFLASH_STRUCT Gunflashes[MAX_GUNFLASH]; +extern FIRE_SPARKS FireSparks[MAX_SPARKS_FIRE]; +extern SMOKE_SPARKS SmokeSparks[MAX_SPARKS_SMOKE]; +extern GUNSHELL_STRUCT Gunshells[MAX_GUNSHELL]; +extern BLOOD_STRUCT Blood[MAX_SPARKS_BLOOD]; +extern DRIP_STRUCT Drips[MAX_DRIPS]; +extern SHOCKWAVE_STRUCT ShockWaves[MAX_SHOCKWAVE]; +extern FIRE_LIST Fires[MAX_FIRE_LIST]; +extern ENERGY_ARC EnergyArcs[MAX_ENERGYARCS]; extern SMOKE_SPARKS SmokeSparks[MAX_SPARKS_SMOKE]; -extern ENERGY_ARC EnergyArcs[MAX_ENERGY_ARCS]; void TriggerBlood(int x, int y, int z, int unk, int num); void TriggerExplosionBubble(int x, int y, int z, short roomNum); @@ -73,7 +245,11 @@ void UpdateBubbles(); int GetFreeDrip(); void UpdateDrips(); void TriggerLaraDrips(); -int ExplodingDeath(short itemNumber, int meshBits, short damage); + +constexpr auto EXPLODE_HIT_EFFECT = 258; +constexpr auto EXPLODE_NORMAL = 256; +int ExplodingDeath(short itemNumber, int meshBits, short flags); // EXPLODE_ flags + int GetFreeShockwave(); void TriggerShockwave(PHD_3DPOS* pos, short innerRad, short outerRad, int speed, char r, char g, char b, char life, short angle, short flags); void TriggerShockwaveHitEffect(int x, int y, int z, int color, short rot, int vel); diff --git a/TR5Main/Game/traps.cpp b/TR5Main/Game/traps.cpp index 1b42cc72d..3ecc77b40 100644 --- a/TR5Main/Game/traps.cpp +++ b/TR5Main/Game/traps.cpp @@ -1,9 +1,10 @@ +#include "framework.h" #include "traps.h" -#include "..\Global\global.h" + #include "items.h" #include "effect2.h" #include "tomb4fx.h" -#include "effects.h" +#include "effect.h" #include "lara.h" #include "collide.h" #include "switch.h" @@ -11,8 +12,8 @@ #include "camera.h" #include "objlight.h" #include "draw.h" -#include "..\Specific\level.h" -#include "../Specific/input.h" +#include "level.h" +#include "input.h" #include "sound.h" static short CeilingTrapDoorBounds[12] = {-256, 256, 0, 900, -768, -256, -1820, 1820, -5460, 5460, -1820, 1820}; @@ -322,7 +323,7 @@ void CeilingTrapDoorCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) / l->pos.yRot += ANGLE(180); result2 = TestLaraPosition(CeilingTrapDoorBounds, item, l); l->pos.yRot += ANGLE(180); - if (TrInput & IN_ACTION && item->status != ITEM_DEACTIVATED && l->currentAnimState == STATE_LARA_JUMP_UP && l->gravityStatus && Lara.gunStatus == LG_NO_ARMS && (result || result2)) + if (TrInput & IN_ACTION && item->status != ITEM_DESACTIVATED && l->currentAnimState == STATE_LARA_JUMP_UP && l->gravityStatus && Lara.gunStatus == LG_NO_ARMS && (result || result2)) { AlignLaraPosition(&CeilingTrapDoorPos, item, l); if (result2) @@ -362,7 +363,7 @@ void FloorTrapDoorCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) // ITEM_INFO* item; item = &Items[itemNumber]; - if (TrInput & IN_ACTION && item->status != ITEM_DEACTIVATED && l->currentAnimState == STATE_LARA_STOP && l->animNumber == ANIMATION_LARA_STAY_IDLE && Lara.gunStatus == LG_NO_ARMS + if (TrInput & IN_ACTION && item->status != ITEM_DESACTIVATED && l->currentAnimState == STATE_LARA_STOP && l->animNumber == ANIMATION_LARA_STAY_IDLE && Lara.gunStatus == LG_NO_ARMS || Lara.isMoving && Lara.generalPtr == (void *) itemNumber) { if (TestLaraPosition(FloorTrapDoorBounds, item, l)) @@ -575,7 +576,7 @@ void FallingBlockFloor(ITEM_INFO* item, int x, int y, int z, int* height) if (y <= item->pos.yPos) { *height = item->pos.yPos; - HeightType = 0; + HeightType = WALL; OnFloor = 1; } } diff --git a/TR5Main/Game/traps.h b/TR5Main/Game/traps.h index 15ce72d82..526824ed9 100644 --- a/TR5Main/Game/traps.h +++ b/TR5Main/Game/traps.h @@ -1,6 +1,6 @@ #pragma once -#include "..\Global\global.h" +#include "collide.h" extern ITEM_INFO* WBItem; extern short WBRoom; diff --git a/TR5Main/Global/math.cpp b/TR5Main/Game/trmath.cpp similarity index 99% rename from TR5Main/Global/math.cpp rename to TR5Main/Game/trmath.cpp index 40432a6f9..7fb53e98c 100644 --- a/TR5Main/Global/math.cpp +++ b/TR5Main/Game/trmath.cpp @@ -1,10 +1,6 @@ -#include "math.h" -#include "types.h" +#include "framework.h" +#include "trmath.h" #include -#include -#include - -using namespace DirectX::SimpleMath; // LUT for cos and sin // 8192 entries, even entry = Sin, odd entry = Cos @@ -1327,18 +1323,19 @@ float TO_RAD(short angle) return angle * 360.0f / 65536.0f * RADIAN; } -const float frand() { - int randValue = rand(); - float result = randValue / (float)RAND_MAX; +const float frand() +{ + float result = float(rand() / RAND_MAX); return result; } const float frandMinMax(float min, float max) { - return frand()* (max - min) + min; + return frand() * (max - min) + min; } -const float lerp(float v0, float v1, float t) { +const float lerp(float v0, float v1, float t) +{ return (1 - t) * v0 + t * v1; } diff --git a/TR5Main/Global/math.h b/TR5Main/Game/trmath.h similarity index 55% rename from TR5Main/Global/math.h rename to TR5Main/Game/trmath.h index 71a539c86..3e11a0828 100644 --- a/TR5Main/Global/math.h +++ b/TR5Main/Game/trmath.h @@ -1,17 +1,26 @@ #pragma once +#include "phd_global.h" -#include "vodoo.h" -#include "types.h" +constexpr auto PI = 3.14159265358979323846f; +constexpr auto RADIAN = 0.01745329252f; +constexpr auto ONE_DEGREE = 182; +constexpr auto PREDICTIVE_SCALE_FACTOR = 14; +constexpr auto W2V_SHIFT = 14; // Shift scale of View.Frame to World.Frame +constexpr auto NODE_SHIFT = 15; +constexpr auto W2V_SCALE = (1 << W2V_SHIFT); // Scale of View Frame to World Frame +constexpr auto WALL_SHIFT = 10; +constexpr auto STEP_SIZE = 256; +constexpr auto WALL_SIZE = 1024; +constexpr auto STEPUP_HEIGHT = ((STEP_SIZE * 3) / 2); +constexpr auto BAD_JUMP_CEILING = ((STEP_SIZE * 3) / 4); -#define PI 3.14159265358979323846f -#define RADIAN 0.01745329252f #define SQUARE(x) ((x)*(x)) #define CLAMP(x, a, b) ((x)<(a)?(a):((x)>(b)?(b):(x))) #define SIGN(x) ((0 < (x)) - ((x) < 0)) #define CLAMPADD(x, a, b) ((x)<(a)?((x)+(a)):((x)>(b)?((x)-(b)):0)) -#define ONE_DEGREE 182 #define CLICK(x) ((x) * STEP_SIZE) #define SECTOR(x) ((x) * WALL_SIZE) +#define HIDWORD(l) ((DWORD)(((DWORDLONG)(l)>>32)&0xFFFFFFFF)) short ANGLE(float angle); float TO_DEGREES(short angle); @@ -21,7 +30,6 @@ extern short rcossin_tbl[8192]; int phd_sin(short a); int phd_cos(short a); -float ANGLEF(short angle); // returns a float between 0-1 const float frand(); diff --git a/TR5Main/Global/constants.h b/TR5Main/Global/constants.h deleted file mode 100644 index 6a2667959..000000000 --- a/TR5Main/Global/constants.h +++ /dev/null @@ -1,195 +0,0 @@ -#pragma once - -#define HAIR_SEGMENTS 7 // only classic lara (young lara have more segments !) -#define DOUBLE_HAIR_SEGMENTS 14 - -#define TEXTURE_PAGE (256 * 256) - -#define PREDICTIVE_SCALE_FACTOR 14 -#define W2V_SHIFT 14 // Shift scale of View.Frame to World.Frame -#define NODE_SHIFT 15 -#define W2V_SCALE (1 << W2V_SHIFT) // Scale of View Frame to World Frame -#define WALL_SHIFT 10 -#define STEP_SIZE 256 -#define WALL_SIZE 1024 - -/// obj->hitEffect flag -#define HIT_NONE 0 -#define HIT_BLOOD 1 -#define HIT_SMOKE 2 -#define HIT_FRAGMENT 3 - -#define GUARD 1 -#define AMBUSH 2 -#define PATROL1 4 -#define MODIFY 8 -#define FOLLOW 16 -#define PATROL2 32 -#define ALL_AIOBJ (GUARD|AMBUSH|PATROL1|MODIFY|FOLLOW|PATROL2) - -#define BOX_BLOCKED (1 << 14) // unpassable for other enemies, always set for movable blocks & closed doors -#define BOX_LAST (1 << 15) // unpassable by large enemies (T-Rex, Centaur, etc), always set behind doors -#define GRAVITY 6 -#define SWAMP_GRAVITY 2 - -#define NUM_SPRITES 256 -#define UNIT_SHADOW 256 -#define NO_SHADOW 0 -#define DEFAULT_RADIUS 10 -#define ROT_X 4 -#define ROT_Y 8 -#define ROT_Z 16 - -// ExplodingDeath() last argument flags -#define EXPLODE_HIT_EFFECT 258 -#define EXPLODE_NORMAL 256 - -#define FRONT_ARC ANGLE(90) -#define NO_ITEM -1 -#define ALL_MESHBITS -1 - -#define GAME_BUFFER_SIZE 128 * 1000000 -#define NUM_SLOTS 32 -#define NUM_ITEMS 1023 -#define NUM_ROOMS 1024 -#define NUM_ANIMATED_SETS 1024 -#define DRAW_DISTANCE 200 * 1024.0f -#define NUM_STATICS 1000 -#define MAX_LIGHTS 100 -#define MAX_LIGHTS_DRAW 16384 -#define MAX_DYNAMIC_LIGHTS 16384 -#define MAX_STATICS 1000 -#define MAX_DRAW_STATICS 16384 -#define MAX_BONES 32 -#define MAX_SPRITES 16384 -#define MAX_SPARKS 1024 -#define MAX_SPARKS_FIRE 20 -#define MAX_FIRE_LIST 32 -#define MAX_SPARKS_SMOKE 32 -#define MAX_SPARKS_BLOOD 32 -#define MAX_ENERGY_ARCS 256 -#define MAX_GUNSHELL 24 -#define MAX_GUNFLASH 4 -#define MAX_DRIPS 32 -#define MAX_DYNAMICS 64 -constexpr auto MAX_SPLASH = 8; -#define MAX_RIPPLES 32 -#define MAX_CAMERA 18 -#define MAX_SHOCKWAVE 16 -#define MAX_EFFECTS 100 -#define MAX_DEBRIS 256 -#define NO_ROOM 0xFF -#define NO_HEIGHT (-0x7F00) -#define NUM_PICKUPS 64 - -#define TIMID 0 -#define VIOLENT 1 - -#define LARA_HITE 762 - -// Room flags - -#define ENV_FLAG_WATER 0x0001 -#define ENV_FLAG_SWAMP 0x0004 -#define ENV_FLAG_OUTSIDE 0x0008 -#define ENV_FLAG_DYNAMIC_LIT 0x0010 -#define ENV_FLAG_WIND 0x0020 -#define ENV_FLAG_NOT_NEAR_OUTSIDE 0x0040 -#define ENV_FLAG_NO_LENSFLARE 0x0080 // Was quicksand in TR3. -#define ENV_FLAG_MIST 0x0100 -#define ENV_FLAG_CAUSTICS 0x0200 -#define ENV_FLAG_UNKNOWN3 0x0400 - -// From TR3, we need to check -#define SP_FLAT 1 -#define SP_SCALE 2 -#define SP_BLOOD 4 -#define SP_DEF 8 -#define SP_ROTATE 16 -#define SP_EXPLOSION 32 -#define SP_FX 64 -#define SP_ITEM 128 -#define SP_WIND 256 -#define SP_EXPDEF 512 -#define SP_USEFXOBJPOS 1024 -#define SP_UNDERWEXP 2048 -#define SP_NODEATTACH 4096 -#define SP_PLASMAEXP 8192 - -#define SD_EXPLOSION 1 -#define SD_UWEXPLOSION 2 - -#define SEMITRANS 1 -#define COLADD 2 -#define COLSUB 3 -#define WEIRD 4 - -#define ONESHOT 0x100 - -#define DATA_TYPE 0x1F -#define DATA_TILT 0xF // tile type (FLOOR_TYPE enum) -#define DATA_STATIC 0xFF // probably add static collision -#define END_BIT 0x8000 -#define VALUE_BITS 0x3FF -#define CODE_BITS 0x3e00 -#define REVERSE 0x4000 -#define SWONESHOT 0x40 -#define ATONESHOT 0x80 - -#define NUM_BATS 64 -#define NUM_SPIDERS 64 -#define NUM_RATS 32 - -#define NUM_DEBRIS 256 - -#define WEAPON_AMMO1 0 -#define WEAPON_AMMO2 1 -#define WEAPON_AMMO3 2 -#define WEAPON_AMMO4 3 - -#define BLOCKABLE 0x8000 -#define BLOCKED 0x4000 -#define OVERLAP_INDEX 0x3FFF -#define SEARCH_NUMBER 0x7FFF -#define BLOCKED_SEARCH 0x8000 - -#define FOLLOW_CENTRE 1 -#define NO_CHUNKY 2 -#define CHASE_OBJECT 3 -#define NO_MINY 0xFFFFFF - -#define NO_BOX 0x7FF -#define BOX_JUMP 0x800 -#define BOX_MONKEY 0x2000 - -#define BOX_NUMBER 0x7FF -#define BOX_END_BIT 0x8000 - -#define EXPAND_LEFT 0x1 -#define EXPAND_RIGHT 0x2 -#define EXPAND_TOP 0x4 -#define EXPAND_BOTTOM 0x8 - -#define NO_FLYING 0 -#define FLY_ZONE 0x2000 - -#define CLIP_LEFT 1 -#define CLIP_RIGHT 2 -#define CLIP_TOP 4 -#define CLIP_BOTTOM 8 -#define ALL_CLIP (CLIP_LEFT|CLIP_RIGHT|CLIP_TOP|CLIP_BOTTOM) -#define SECONDARY_CLIP 16 - -#define SLOPE_DIF 60 -#define LARA_FREEFALL_SPEED 131 -#define LARA_LEAN_RATE ANGLE(1.5) -#define LARA_LEAN_MAX ANGLE(11) -#define LARA_TURN_RATE ANGLE(2.25) -#define LARA_JUMP_TURN ANGLE(3) -#define LARA_SLOW_TURN ANGLE(4) -#define LARA_MED_TURN ANGLE(6) -#define LARA_FAST_TURN ANGLE(8) -#define STEPUP_HEIGHT ((STEP_SIZE*3)/2) -#define BAD_JUMP_CEILING ((STEP_SIZE*3)/4) -#define LARA_RAD 100 -#define LARA_VELOCITY 12 diff --git a/TR5Main/Global/global.h b/TR5Main/Global/global.h deleted file mode 100644 index b5916aab0..000000000 --- a/TR5Main/Global/global.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include -#include - -using namespace DirectX::SimpleMath; - -#include "vodoo.h" -#include "constants.h" -#include "enums.h" -#include "objectslist.h" -#include "types.h" -#include "math.h" -#include "macros.h" -#include "malloc.h" - -#include "..\Scripting\GameLogicScript.h" -#include "..\Scripting\GameFlowScript.h" - -#include "..\Renderer\Renderer11.h" - -#pragma warning(disable:4996) diff --git a/TR5Main/Global/macros.h b/TR5Main/Global/macros.h deleted file mode 100644 index 2737e3747..000000000 --- a/TR5Main/Global/macros.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#define RGB555(r, g, b) ((r << 7) & 0x7C00 | (g << 2) & 0x3E0 | (b >> 3) & 0x1F) -#define RED5(rgb) (((rgb >> 10) & 0x1F) << 3) -#define GREEN5(rgb) (((rgb >> 5) & 0x1F) << 3) -#define BLUE5(rgb) ((rgb & 0x1F) << 3) -#define WHITE555 RGB555(255, 255, 255) -#define GRAY555 RGB555(128, 128, 128) -#define BLACK555 RGB555( 0, 0, 0) -#define XZ_GET_SECTOR(room, x, z) (room->floor[((z) >> WALL_SHIFT) + ((x) >> WALL_SHIFT) * room->xSize]) - -#define ADD_PTR(p, t, n) p = (t*)((char*)(p) + (ptrdiff_t)(n)); - -///#define ZONE(A) (((A) >> (WALL_SIZE - 2)) - 1) -#define ZONE(A) FlipStatus + 2 * A -#define CHECK_CLICK(x) CLICK(x) / 2 - -#define RED(rgb) (((rgb) >> 16) & 0xFF) -#define GREEN(rgb) (((rgb) >> 8) & 0xFF) -#define BLUE(rgb) ((rgb) & 0xFF) -#define ALPHA(rgb) (((rgb) >> 24) & 0xFF) - -#define MESHES(slot, mesh) Meshes[Objects[slot].meshIndex + mesh] -#define MESH_BITS(x) (1 << x) -#define LARA_MESHES(slot, mesh) Lara.meshPtrs[mesh] = MESHES(slot, mesh) -#define CHECK_LARA_MESHES(slot, mesh) Lara.meshPtrs[mesh] == MESHES(slot, mesh) -#define INIT_LARA_MESHES(mesh, to, from) Lara.meshPtrs[mesh] = LARA_MESHES(to, mesh) = LARA_MESHES(from, mesh) - -#define HIDWORD(l) ((DWORD)(((DWORDLONG)(l)>>32)&0xFFFFFFFF)) \ No newline at end of file diff --git a/TR5Main/Global/types.h b/TR5Main/Global/types.h deleted file mode 100644 index e0916e6fc..000000000 --- a/TR5Main/Global/types.h +++ /dev/null @@ -1,1235 +0,0 @@ -#pragma once -#include -#include "enums.h" - -#pragma pack(push, 1) -typedef struct vector_t -{ - int vx; - int vy; - int vz; - int pad; -} VECTOR; - -typedef struct SPHERE -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - int r; // size=0, offset=12 -}; - -typedef struct svector_t -{ - short vx; - short vy; - short vz; - short pad; -} SVECTOR; - -typedef struct cvector_t -{ - unsigned char r; - unsigned char g; - unsigned char b; - unsigned char cd; -} CVECTOR; - -typedef struct phd_vector_t -{ - int x; - int y; - int z; -} PHD_VECTOR; - -typedef struct tr_vertex -{ - int x; - int y; - int z; -}; - -struct MATRIX3D -{ - short m00; // size=0, offset=0 - short m01; // size=0, offset=2 - short m02; // size=0, offset=4 - short m10; // size=0, offset=6 - short m11; // size=0, offset=8 - short m12; // size=0, offset=10 - short m20; // size=0, offset=12 - short m21; // size=0, offset=14 - short m22; // size=0, offset=16 - short pad; // size=0, offset=18 - int tx; // size=0, offset=20 - int ty; // size=0, offset=24 - int tz; // size=0, offset=28 -}; - -typedef struct phd_3dpos_t -{ - int xPos; // off 0 [64] - int yPos; // off 4 [68] - int zPos; // off 8 [72] - short xRot; // off 12 [76] - short yRot; // off 14 [78] - short zRot; // off 16 [80] -} PHD_3DPOS; - -typedef struct game_vector_t -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - short roomNumber; // size=0, offset=12 - short boxNumber; // size=0, offset=14 -} GAME_VECTOR; - -typedef struct object_vector -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - short data; // size=0, offset=12 - short flags; // size=0, offset=14 -} OBJECT_VECTOR; - -typedef struct ilight_t -{ - short x; - short y; - short z; - short pad1; - unsigned char r; - unsigned char g; - unsigned char b; - unsigned char pad; -} ILIGHT; - -typedef struct item_light_t -{ - ILIGHT light[4]; -} ITEM_LIGHT; - -typedef struct hair_struct -{ - PHD_3DPOS pos; - PHD_VECTOR hvel; - PHD_VECTOR unknown; -} HAIR_STRUCT; - -typedef struct box_node_t -{ - short exitBox; // size=0, offset=0 - unsigned short searchNumber; // size=0, offset=2 - short nextExpansion; // size=0, offset=4 - short boxNumber; // size=0, offset=6 -} BOX_NODE; - -typedef struct box_info_t -{ - unsigned char left; // size=0, offset=0 - unsigned char right; // size=0, offset=1 - unsigned char top; // size=0, offset=2 - unsigned char bottom; // size=0, offset=3 - short height; // size=0, offset=4 - short overlapIndex; // size=0, offset=6 -} BOX_INFO; - -typedef struct ai_info_t -{ - short zoneNumber; // size=0, offset=0 - short enemyZone; // size=0, offset=2 - int distance; // size=0, offset=4 - int ahead; // size=0, offset=8 - int bite; // size=0, offset=12 - short angle; // size=0, offset=16 - short xAngle; // size=0, offset=18 - short enemyFacing; // size=0, offset=20 -} AI_INFO; - -typedef struct bite_info_t { // Offset into given Mesh - int x; // where Baddie kicks off Bite Effect - int y; - int z; - int meshNum; -} BITE_INFO; - -typedef struct lot_info_t -{ - BOX_NODE* node; // size=8, offset=0 - short head; // size=0, offset=4 - short tail; // size=0, offset=6 - unsigned short searchNumber; // size=0, offset=8 - unsigned short blockMask; // size=0, offset=10 - short step; // size=0, offset=12 - short drop; // size=0, offset=14 - short zoneCount; // size=0, offset=16 - short targetBox; // size=0, offset=18 - short requiredBox; // size=0, offset=20 - short fly; // size=0, offset=22 - unsigned short canJump : 1; // offset=24.0 - unsigned short canMonkey : 1; // offset=24.1 - unsigned short isAmphibious : 1; // offset=24.2 - unsigned short isJumping : 1; // offset=24.3 - unsigned short isMonkeying : 1; // offset=24.4 - PHD_VECTOR target; // size=12, offset=26 - int zone; // size=4, offset=40 -} LOT_INFO; - -typedef struct floor_info_t { - unsigned short index; // size=0, offset=0 - unsigned short fx : 4; // offset=2.0 - unsigned short box : 11; // offset=2.4 - unsigned short stopper : 1; // offset=3.7 - unsigned char pitRoom; // size=0, offset=4 - signed char floor; // size=0, offset=5 - unsigned char skyRoom; // size=0, offset=6 - signed char ceiling; // size=0, offset=7 -} FLOOR_INFO; - -typedef struct item_info_t { - int floor; // size=0, offset=0 - int touchBits; // size=0, offset=4 - int meshBits; // size=0, offset=8 - short objectNumber; // size=0, offset=12 - short currentAnimState; // size=0, offset=14 - short goalAnimState; // size=0, offset=16 - short requiredAnimState; // size=0, offset=18 - short animNumber; // size=0, offset=20 - short frameNumber; // size=0, offset=22 - short roomNumber; // size=0, offset=24 - short nextItem; // size=0, offset=26 - short nextActive; // size=0, offset=28 - short speed; // size=0, offset=30 - short fallspeed; // size=0, offset=32 - short hitPoints; // size=0, offset=34 - unsigned short boxNumber; // size=0, offset=36 - short timer; // size=0, offset=38 - short flags; // size=0, offset=40 - short shade; // size=0, offset=42 - short triggerFlags; // size=0, offset=44 - short carriedItem; // size=0, offset=46 - short afterDeath; // size=0, offset=48 - unsigned short firedWeapon; // size=0, offset=50 - short itemFlags[4]; // size=8, offset=52 - void* data; // size=0, offset=60 - PHD_3DPOS pos; // size=20, offset=64 - byte legacyLightData[5528]; - unsigned int active : 1; // offset=132.0 OFF=5610 - unsigned int status : 2; // offset=132.1 - unsigned int gravityStatus : 1; // offset=132.3 - unsigned int hitStatus : 1; // offset=132.4 - unsigned int collidable : 1; // offset=132.5 - unsigned int lookedAt : 1; // offset=132.6 - unsigned int dynamicLight : 1; // offset=132.7 - unsigned int poisoned : 1; // offset=133.0 - unsigned int aiBits : 5; // offset=133.1 - unsigned int reallyActive : 1; // offset=133.6 - unsigned int inDrawRoom : 1; // offset=133.7 - int swapMeshFlags;// OFF=5614 - short drawRoom; - short TOSSPAD; -} ITEM_INFO; - -typedef struct creature_info_t -{ - short jointRotation[4]; // size=8, offset=0 - short maximumTurn; // size=0, offset=8 - short flags; // size=0, offset=10 - unsigned short alerted : 1; // offset=12.0 - unsigned short headLeft : 1; // offset=12.1 - unsigned short headRight : 1; // offset=12.2 - unsigned short reachedGoal : 1; // offset=12.3 - unsigned short hurtByLara : 1; // offset=12.4 - unsigned short patrol2 : 1; // offset=12.5 - unsigned short jumpAhead : 1; // offset=12.6 - unsigned short monkeyAhead : 1; // offset=12.7 - MOOD_TYPE mood; // size=4, offset=14 - ITEM_INFO* enemy; // size=144, offset=18 - ITEM_INFO aiTarget; // size=144, offset=22 - short pad; // size=0, offset=5644 - short itemNum; // size=0, offset=5644 - PHD_VECTOR target; // size=12, offset=5646 - LOT_INFO LOT; // size=44, offset=5658 -} CREATURE_INFO; - -typedef struct lara_arm_t -{ - short* frameBase; // size=0, offset=0 - short frameNumber; // size=0, offset=4 - short animNumber; // size=0, offset=6 - short lock; // size=0, offset=8 - short yRot; // size=0, offset=10 - short xRot; // size=0, offset=12 - short zRot; // size=0, offset=14 - short flash_gun; // size=0, offset=16 -} LARA_ARM; - -typedef struct fx_info_t -{ - PHD_3DPOS pos; // size=20, offset=0 - short roomNumber; // size=0, offset=20 - short objectNumber; // size=0, offset=22 - short nextFx; // size=0, offset=24 - short nextActive; // size=0, offset=26 - short speed; // size=0, offset=28 - short fallspeed; // size=0, offset=30 - short frameNumber; // size=0, offset=32 - short counter; // size=0, offset=34 - short shade; // size=0, offset=36 - short flag1; // size=0, offset=38 - short flag2; // size=0, offset=40 -} FX_INFO; - -typedef struct coll_info_t -{ - int midFloor; // size=0, offset=0 - int midCeiling; // size=0, offset=4 - int midType; // size=0, offset=8 - int frontFloor; // size=0, offset=12 - int frontCeiling; // size=0, offset=16 - int frontType; // size=0, offset=20 - int leftFloor; // size=0, offset=24 - int leftCeiling; // size=0, offset=28 - int leftType; // size=0, offset=32 - int rightFloor; // size=0, offset=36 - int rightCeiling; // size=0, offset=40 - int rightType; // size=0, offset=44 - int leftFloor2; // size=0, offset=48 - int leftCeiling2; // size=0, offset=52 - int leftType2; // size=0, offset=56 - int rightFloor2; // size=0, offset=60 - int rightCeiling2; // size=0, offset=64 - int rightType2; // size=0, offset=68 - int radius; // size=0, offset=72 - int badPos; // size=0, offset=76 - int badNeg; // size=0, offset=80 - int badCeiling; // size=0, offset=84 - PHD_VECTOR shift; // size=12, offset=88 - PHD_VECTOR old; // size=12, offset=100 - short oldAnimState; // size=0, offset=112 - short oldAnimNumber; // size=0, offset=114 - short oldFrameNumber; // size=0, offset=116 - short facing; // size=0, offset=118 - short quadrant; // size=0, offset=120 - short collType; // size=0, offset=122 USE ENUM CT_* - short* trigger; // size=0, offset=124 - signed char tiltX; // size=0, offset=128 - signed char tiltZ; // size=0, offset=129 - byte hitByBaddie; // size=0, offset=130 - byte hitStatic; // size=0, offset=131 - unsigned short slopesAreWalls : 2; // offset=132.0 - unsigned short slopesArePits : 1; // offset=132.2 - unsigned short lavaIsPit : 1; // offset=132.3 - unsigned short enableBaddiePush : 1; // offset=132.4 - unsigned short enableSpaz : 1; // offset=132.5 - unsigned short hitCeiling : 1; // offset=132.6 -} COLL_INFO; - -typedef struct aiobject_t -{ - short objectNumber; // size=0, offset=0 - short roomNumber; // size=0, offset=2 - int x; // size=0, offset=4 - int y; // size=0, offset=8 - int z; // size=0, offset=12 - short triggerFlags; // size=0, offset=16 - short flags; // size=0, offset=18 - short yRot; // size=0, offset=20 - short boxNumber; // size=0, offset=22 -} AIOBJECT; - -typedef struct tr5_room_layer_t // 56 bytes -{ - unsigned int NumLayerVertices; // Number of vertices in this layer (4 bytes) - unsigned short UnknownL1; - unsigned short NumLayerRectangles; // Number of rectangles in this layer (2 bytes) - unsigned short NumLayerTriangles; // Number of triangles in this layer (2 bytes) - unsigned short UnknownL2; - - unsigned short Filler; // Always 0 - unsigned short Filler2; // Always 0 - - // The following 6 floats define the bounding box for the layer - - float LayerBoundingBoxX1; - float LayerBoundingBoxY1; - float LayerBoundingBoxZ1; - float LayerBoundingBoxX2; - float LayerBoundingBoxY2; - float LayerBoundingBoxZ2; - - unsigned int Filler3; // Always 0 (4 bytes) - void* VerticesOffset; - void* PolyOffset; - void* PolyOffset2; -} tr5_room_layer; - -typedef struct tr5_vertex_t // 12 bytes -{ - float x; - float y; - float z; -} tr5_vertex; - -typedef struct tr5_room_vertex_t // 28 bytes -{ - tr5_vertex Vertex; // Vertex is now floating-point - tr5_vertex Normal; - unsigned int Colour; // 32-bit colour -} tr5_room_vertex; - -typedef struct mesh_info_t -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - short yRot; // size=0, offset=12 - short shade; // size=0, offset=14 - short Flags; // size=0, offset=16 - short staticNumber; // size=0, offset=18 -} MESH_INFO; - -typedef struct light_info_t -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - unsigned char Type; // size=0, offset=12 - unsigned char r; // size=0, offset=13 - unsigned char g; // size=0, offset=14 - unsigned char b; // size=0, offset=15 - short nx; // size=0, offset=16 - short ny; // size=0, offset=18 - short nz; // size=0, offset=20 - short Intensity; // size=0, offset=22 - unsigned char Inner; // size=0, offset=24 - unsigned char Outer; // size=0, offset=25 - short FalloffScale; // size=0, offset=26 - short Length; // size=0, offset=28 - short Cutoff; // size=0, offset=30 -} LIGHTINFO; - -struct tr4_mesh_face3 // 10 bytes -{ - short Vertices[3]; - short Texture; - short Effects; // TR4-5 ONLY: alpha blending and environment mapping strength -}; - -struct tr4_mesh_face4 // 12 bytes -{ - short Vertices[4]; - short Texture; - short Effects; -}; - -struct tr_room_portal // 32 bytes -{ - short AdjoiningRoom; // Which room this portal leads to - tr_vertex Normal; - tr_vertex Vertices[4]; -}; - -struct tr_room_sector // 8 bytes -{ - unsigned short FDindex; // Index into FloorData[] - unsigned short BoxIndex; // Index into Boxes[] (-1 if none) - byte RoomBelow; // 255 is none - INT8 Floor; // Absolute height of floor - byte RoomAbove; // 255 if none - INT8 Ceiling; // Absolute height of ceiling -}; - -struct tr5_room_light // 88 bytes -{ - float x, y, z; // Position of light, in world coordinates - float r, g, b; // Colour of the light - - int Separator; // Dummy value = 0xCDCDCDCD - - float In; // Cosine of the IN value for light / size of IN value - float Out; // Cosine of the OUT value for light / size of OUT value - float RadIn; // (IN radians) * 2 - float RadOut; // (OUT radians) * 2 - float Range; // Range of light - - float dx, dy, dz; // Direction - used only by sun and spot lights - int x2, y2, z2; // Same as position, only in integer. - int dx2, dy2, dz2; // Same as direction, only in integer. - - byte LightType; - - byte Filler[3]; // Dummy values = 3 x 0xCD -}; - -struct GAMEFLOW -{ - unsigned int CheatEnabled : 1; // offset=0.0 - unsigned int LoadSaveEnabled : 1; // offset=0.1 - unsigned int TitleEnabled : 1; // offset=0.2 - unsigned int PlayAnyLevel : 1; // offset=0.3 - unsigned int Language : 3; // offset=0.4 - unsigned int DemoDisc : 1; // offset=0.7 - unsigned int Unused : 24; // offset=1.0 - unsigned int InputTimeout; // size=0, offset=4 - unsigned char SecurityTag; // size=0, offset=8 - unsigned char nLevels; // size=0, offset=9 - unsigned char nFileNames; // size=0, offset=10 - unsigned char Pad; // size=0, offset=11 - unsigned short FileNameLen; // size=0, offset=12 - unsigned short ScriptLen; // size=0, offset=14 -}; - -typedef struct room_info_t { - short* data; // size=0, offset=0 - short* door; // size=0, offset=4 - FLOOR_INFO* floor; // size=8, offset=8 - void* somePointer; // size=32, offset=12 - MESH_INFO* mesh; // size=20, offset=16 - int x; // size=0, offset=20 - int y; // size=0, offset=24 - int z; // size=0, offset=28 - int minfloor; // size=0, offset=32 - int maxceiling; // size=0, offset=36 - short xSize; // size=0, offset=42 - short ySize; // size=0, offset=40 - CVECTOR ambient; // size=4, offset=44 - short numLights; // size=0, offset=48 - short numMeshes; // size=0, offset=50 - unsigned char reverbType; // size=0, offset=52 - unsigned char flipNumber; // size=0, offset=53 - byte meshEffect; // size=0, offset=54 - byte boundActive; // size=0, offset=55 - short left; // size=0, offset=56 - short right; // size=0, offset=58 - short top; // size=0, offset=60 - short bottom; // size=0, offset=62 - short testLeft; // size=0, offset=64 - short testRight; // size=0, offset=66 - short testTop; // size=0, offset=68 - short testBottom; // size=0, offset=70 - short itemNumber; // size=0, offset=72 - short fxNumber; // size=0, offset=74 - short flippedRoom; // size=0, offset=76 - unsigned short flags; // size=0, offset=78 - - unsigned int Unknown1; - unsigned int Unknown2; // Always 0 - unsigned int Unknown3; // Always 0 - - unsigned int Separator; // 0xCDCDCDCD - - unsigned short Unknown4; - unsigned short Unknown5; - - float RoomX; - float RoomY; - float RoomZ; - - unsigned int Separator1[4]; // Always 0xCDCDCDCD - unsigned int Separator2; // 0 for normal rooms and 0xCDCDCDCD for null rooms - unsigned int Separator3; // Always 0xCDCDCDCD - - unsigned int NumRoomTriangles; - unsigned int NumRoomRectangles; - - tr5_room_light* light; // Always 0 - - unsigned int LightDataSize; - unsigned int NumLights2; // Always same as NumLights - - unsigned int Unknown6; - - int RoomYTop; - int RoomYBottom; - - unsigned int NumLayers; - - tr5_room_layer* LayerOffset; - tr5_room_vertex* VerticesOffset; - void* PolyOffset; - void* PolyOffset2; // Same as PolyOffset - - int NumVertices; - - int Separator5[4]; // Always 0xCDCDCDCD - - /*tr5_room_light* Lights; // Data for the lights (88 bytes * NumRoomLights) - tr_room_sector* SectorList; // List of sectors in this room - - short NumPortals; // Number of visibility portals to other rooms - tr_room_portal Portals[NumPortals]; // List of visibility portals - - short Separator; // Always 0xCDCD - - tr3_room_staticmesh StaticMeshes[NumStaticMeshes]; // List of static meshes - - tr5_room_layer Layers[NumLayers]; // Data for the room layers (volumes) (56 bytes * NumLayers) - - uint8_t Faces[(NumRoomRectangles * sizeof(tr_face4) + NumRoomTriangles * sizeof(tr_face3)]; - - tr5_room_vertex Vertices[NumVertices];*/ -} ROOM_INFO; - -typedef struct anim_struct_t -{ - short* framePtr; // size=0, offset=0 - short interpolation; // size=0, offset=4 - short currentAnimState; // size=0, offset=6 - int velocity; // size=0, offset=8 - int acceleration; // size=0, offset=12 - int Xvelocity; // size=0, offset=16 - int Xacceleration; // size=0, offset=20 - short frameBase; // size=0, offset=24 - short frameEnd; // size=0, offset=26 - short jumpAnimNum; // size=0, offset=28 - short jumpFrameNum; // size=0, offset=30 - short numberChanges; // size=0, offset=32 - short changeIndex; // size=0, offset=34 - short numberCommands; // size=0, offset=36 - short commandIndex; // size=0, offset=38 -} ANIM_STRUCT; - -typedef struct sparks_t -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - short xVel; // size=0, offset=12 - short yVel; // size=0, offset=14 - short zVel; // size=0, offset=16 - short gravity; // size=0, offset=18 - short rotAng; // size=0, offset=20 - short flags; // size=0, offset=22 - unsigned char sSize; // size=0, offset=24 - unsigned char dSize; // size=0, offset=25 - unsigned char size; // size=0, offset=26 - unsigned char friction; // size=0, offset=27 - unsigned char scalar; // size=0, offset=28 - unsigned char def; // size=0, offset=29 - signed char rotAdd; // size=0, offset=30 - signed char maxYvel; // size=0, offset=31 - unsigned char on; // size=0, offset=32 - unsigned char sR; // size=0, offset=33 - unsigned char sG; // size=0, offset=34 - unsigned char sB; // size=0, offset=35 - unsigned char dR; // size=0, offset=36 - unsigned char dG; // size=0, offset=37 - unsigned char dB; // size=0, offset=38 - unsigned char r; // size=0, offset=39 - unsigned char g; // size=0, offset=40 - unsigned char b; // size=0, offset=41 - unsigned char colFadeSpeed; // size=0, offset=42 - unsigned char fadeToBlack; // size=0, offset=43 - unsigned char sLife; // size=0, offset=44 - unsigned char life; // size=0, offset=45 - unsigned char transType; // size=0, offset=46 - unsigned char extras; // size=0, offset=47 - signed char dynamic; // size=0, offset=48 - unsigned char fxObj; // size=0, offset=49 - unsigned char roomNumber; // size=0, offset=50 - unsigned char nodeNumber; // size=0, offset=51 -} SPARKS; - -typedef struct camera_info_t -{ - GAME_VECTOR pos; // size=16, offset=0 - GAME_VECTOR target; // size=16, offset=16 - CAMERA_TYPE type; // size=4, offset=32 - CAMERA_TYPE oldType; // size=4, offset=36 - int shift; // size=0, offset=40 - int flags; // size=0, offset=44 - int fixedCamera; // size=0, offset=48 - int numberFrames; // size=0, offset=52 - int bounce; // size=0, offset=56 - int underwater; // size=0, offset=60 - int targetDistance; // size=0, offset=64 - short targetAngle; // size=0, offset=68 - short targetElevation; // size=0, offset=70 - short actualElevation; // size=0, offset=72 - short actualAngle; // size=0, offset=74 - short laraNode; // size=0, offset=76 - short box; // size=0, offset=78 - short number; // size=0, offset=80 - short last; // size=0, offset=82 - short timer; // size=0, offset=84 - short speed; // size=0, offset=86 - short targetspeed; // size=0, offset=88 - ITEM_INFO* item; // size=144, offset=92 - ITEM_INFO* lastItem; // size=144, offset=96 - OBJECT_VECTOR* fixed; // size=16, offset=100 - int mikeAtLara; // size=0, offset=104 - PHD_VECTOR mikePos; // size=12, offset=108 -} CAMERA_INFO; - -typedef struct static_info_t -{ - short meshNumber; - short flags; - short xMinp; - short xMaxp; - short yMinp; - short yMaxp; - short zMinp; - short zMaxp; - short xMinc; - short xMaxc; - short yMinc; - short yMaxc; - short zMinc; - short zMaxc; -} STATIC_INFO; - -typedef struct sample_info_t -{ - short number; - unsigned char volume; - byte radius; - byte randomness; - signed char pitch; - short flags; -} SAMPLE_INFO; - -typedef struct change_struct_t -{ - short goalAnimState; // size=0, offset=0 - short numberRanges; // size=0, offset=2 - short rangeIndex; // size=0, offset=4 -} CHANGE_STRUCT; - -typedef struct range_struct_t -{ - short startFrame; // size=0, offset=0 - short endFrame; // size=0, offset=2 - short linkAnimNum; // size=0, offset=4 - short linkFrameNum; // size=0, offset=6 -} RANGE_STRUCT; - -struct tr_object_texture_vert // 4 bytes -{ - byte Xcoordinate; // 1 if Xpixel is the low value, 255 if Xpixel is the high value in the object texture - byte Xpixel; - byte Ycoordinate; // 1 if Ypixel is the low value, 255 if Ypixel is the high value in the object texture - byte Ypixel; -}; - -struct tr4_object_texture // 38 bytes -{ - short Attribute; - short TileAndFlag; - short NewFlags; - - tr_object_texture_vert Vertices[4]; // The four corners of the texture - - int OriginalU; - int OriginalV; - int Width; // Actually width-1 - int Height; // Actually height-1 - - short Padding; -}; - -typedef struct stats_t { - unsigned int Timer; // size=0, offset=0 - unsigned int Distance; // size=0, offset=4 - unsigned int AmmoUsed; // size=0, offset=8 - unsigned int AmmoHits; // size=0, offset=12 - unsigned short Kills; // size=0, offset=16 - unsigned char Secrets; // size=0, offset=18 - unsigned char HealthUsed; // size=0, offset=19 -} STATS; - -typedef struct savegame_info -{ - short Checksum; // size=0, offset=0 - unsigned short VolumeCD; // size=0, offset=2 - unsigned short VolumeFX; // size=0, offset=4 - short ScreenX; // size=0, offset=6 - short ScreenY; // size=0, offset=8 - unsigned char ControlOption; // size=0, offset=10 - unsigned char VibrateOn; // size=0, offset=11 - unsigned char AutoTarget; // size=0, offset=12 - STATS Level; // size=20, offset=368 - STATS Game; // size=20, offset=388 - short WeaponObject; // size=0, offset=408 - short WeaponAnim; // size=0, offset=410 - short WeaponFrame; // size=0, offset=412 - short WeaponCurrent; // size=0, offset=414 - short WeaponGoal; // size=0, offset=416 - unsigned int CutSceneTriggered1; // size=0, offset=420 - unsigned int CutSceneTriggered2; // size=0, offset=424 - byte GameComplete; // size=0, offset=428 - unsigned char LevelNumber; // size=0, offset=429 - unsigned char CampaignSecrets[4]; // size=4, offset=430 - unsigned char TLCount; // size=0, offset=434 -} SAVEGAME_INFO; - -struct OBJECT_TEXTURE_VERT -{ - float x; - float y; -}; - -struct OBJECT_TEXTURE -{ - short attribute; - short tileAndFlag; - short newFlags; - struct OBJECT_TEXTURE_VERT vertices[4]; -}; - -struct WINAPP -{ - HINSTANCE hInstance; - int nFillMode; - WNDCLASS WindowClass; - HWND WindowHandle; - bool bNoFocus; - bool isInScene; -}; - -struct GUNFLASH_STRUCT -{ - MATRIX3D matrix; // size=32, offset=0 - short on; // size=0, offset=32 -}; - -struct SHOCKWAVE_STRUCT -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - short innerRad; // size=0, offset=12 - short outerRad; // size=0, offset=14 - short xRot; // size=0, offset=16 - short flags; // size=0, offset=18 - unsigned char r; // size=0, offset=20 - unsigned char g; // size=0, offset=21 - unsigned char b; // size=0, offset=22 - unsigned char life; // size=0, offset=23 - short speed; // size=0, offset=24 - short temp; // size=0, offset=26 -}; - -struct GUNSHELL_STRUCT -{ - PHD_3DPOS pos; // size=20, offset=0 - short fallspeed; // size=0, offset=20 - short roomNumber; // size=0, offset=22 - short speed; // size=0, offset=24 - short counter; // size=0, offset=26 - short dirXrot; // size=0, offset=28 - short objectNumber; // size=0, offset=30 -}; - -struct SPLASH_STRUCT -{ - float x; - float y; - float z; - float innerRad; - float innerRadVel; - float heightVel; - float heightSpeed; - float height; - float outerRad; - float outerRadVel; - float animationSpeed; - float animationPhase; - short spriteSequenceStart; - short spriteSequenceEnd; - unsigned short life; - bool isRipple; - bool isActive; -}; - -struct DRIP_STRUCT -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - byte on; // size=0, offset=12 - byte r; // size=0, offset=13 - byte g; // size=0, offset=14 - byte b; // size=0, offset=15 - short yVel; // size=0, offset=16 - byte gravity; // size=0, offset=18 - byte life; // size=0, offset=19 - short roomNumber; // size=0, offset=20 - byte outside; // size=0, offset=22 - byte pad; // size=0, offset=23 -}; - - - -struct FIRE_LIST -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - byte on; // size=0, offset=12 - byte size; // size=0, offset=13 - short roomNumber; // size=0, offset=14 -}; - -struct FIRE_SPARKS -{ - short x; // size=0, offset=0 - short y; // size=0, offset=2 - short z; // size=0, offset=4 - short xVel; // size=0, offset=6 - short yVel; // size=0, offset=8 - short zVel; // size=0, offset=10 - short gravity; // size=0, offset=12 - short rotAng; // size=0, offset=14 - short flags; // size=0, offset=16 - unsigned char sSize; // size=0, offset=18 - unsigned char dSize; // size=0, offset=19 - unsigned char size; // size=0, offset=20 - unsigned char friction; // size=0, offset=21 - unsigned char scalar; // size=0, offset=22 - unsigned char def; // size=0, offset=23 - signed char rotAdd; // size=0, offset=24 - signed char maxYvel; // size=0, offset=25 - unsigned char on; // size=0, offset=26 - unsigned char sR; // size=0, offset=27 - unsigned char sG; // size=0, offset=28 - unsigned char sB; // size=0, offset=29 - unsigned char dR; // size=0, offset=30 - unsigned char dG; // size=0, offset=31 - unsigned char dB; // size=0, offset=32 - unsigned char r; // size=0, offset=33 - unsigned char g; // size=0, offset=34 - unsigned char b; // size=0, offset=35 - unsigned char colFadeSpeed; // size=0, offset=36 - unsigned char fadeToBlack; // size=0, offset=37 - unsigned char sLife; // size=0, offset=38 - unsigned char life; // size=0, offset=39 -}; - -struct SMOKE_SPARKS -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - short xVel; // size=0, offset=12 - short yVel; // size=0, offset=14 - short zVel; // size=0, offset=16 - short gravity; // size=0, offset=18 - short rotAng; // size=0, offset=20 - short flags; // size=0, offset=22 - byte sSize; // size=0, offset=24 - byte dSize; // size=0, offset=25 - byte size; // size=0, offset=26 - byte friction; // size=0, offset=27 - byte scalar; // size=0, offset=28 - byte def; // size=0, offset=29 - signed char rotAdd; // size=0, offset=30 - signed char maxYvel; // size=0, offset=31 - byte on; // size=0, offset=32 - byte sShade; // size=0, offset=33 - byte dShade; // size=0, offset=34 - byte shade; // size=0, offset=35 - byte colFadeSpeed; // size=0, offset=36 - byte fadeToBlack; // size=0, offset=37 - signed char sLife; // size=0, offset=38 - signed char life; // size=0, offset=39 - byte transType; // size=0, offset=40 - byte fxObj; // size=0, offset=41 - byte nodeNumber; // size=0, offset=42 - byte mirror; // size=0, offset=43 -}; - -struct BLOOD_STRUCT -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - short xVel; // size=0, offset=12 - short yVel; // size=0, offset=14 - short zVel; // size=0, offset=16 - short gravity; // size=0, offset=18 - short rotAng; // size=0, offset=20 - unsigned char sSize; // size=0, offset=22 - unsigned char dSize; // size=0, offset=23 - unsigned char size; // size=0, offset=24 - unsigned char friction; // size=0, offset=25 - byte rotAdd; // size=0, offset=26 - unsigned char on; // size=0, offset=27 - unsigned char sShade; // size=0, offset=28 - unsigned char dShade; // size=0, offset=29 - unsigned char shade; // size=0, offset=30 - unsigned char colFadeSpeed; // size=0, offset=31 - unsigned char fadeToBlack; // size=0, offset=32 - byte sLife; // size=0, offset=33 - byte life; // size=0, offset=34 - byte pad; // size=0, offset=35 -}; - -typedef struct SPOTCAM -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - int tx; // size=0, offset=12 - int ty; // size=0, offset=16 - int tz; // size=0, offset=20 - unsigned char sequence; // size=0, offset=24 - unsigned char camera; // size=0, offset=25 - short fov; // size=0, offset=26 - short roll; // size=0, offset=28 - short timer; // size=0, offset=30 - short speed; // size=0, offset=32 - short flags; // size=0, offset=34 - short roomNumber; // size=0, offset=36 - short pad; // size=0, offset=38 -}; - -typedef struct INVOBJ -{ - short objectNumber; - short yOff; - short scale1; - short yRot; - short xRot; - short zRot; - short flags; - short objectName; - int meshBits; -}; - -typedef struct OBJLIST { - short inventoryItem; - short yRot; - short bright; -}; - -typedef struct COMBINELIST { - int combineRoutine; - short item1; - short item2; - short combinedItem; -}; - -typedef struct INVENTORYRING { - OBJLIST currentObjectList[100]; - int ringActive; - int objectListMovement; - int currentObjectInList; - int numObjectsInList; -}; - -typedef struct DISPLAY_PICKUP { - short life; - short objectNumber; -}; - -typedef struct DYNAMIC -{ - int x; // size=0, offset=0 - int y; // size=0, offset=4 - int z; // size=0, offset=8 - byte on; // size=0, offset=12 - byte r; // size=0, offset=13 - byte g; // size=0, offset=14 - byte b; // size=0, offset=15 - short falloff; // size=0, offset=16 - byte used; // size=0, offset=18 - byte pad1[1]; // size=1, offset=19 - int FalloffScale; // size=0, offset=20 -}; - -typedef struct SPRITE -{ - short tile; - byte x; - byte y; - short width; - short height; - float left; - float top; - float right; - float bottom; -}; - -struct SHATTER_ITEM -{ - SPHERE sphere; // size=16, offset=0 - ITEM_LIGHT* il; // size=48, offset=16 - short* meshp; // size=0, offset=20 - int bit; // size=0, offset=24 - short yRot; // size=0, offset=28 - short flags; // size=0, offset=30 -}; - -struct WEAPON_INFO -{ - short lockAngles[4]; // size=8, offset=0 - short leftAngles[4]; // size=8, offset=8 - short rightAngles[4]; // size=8, offset=16 - short aimSpeed; // size=0, offset=24 - short shotAccuracy; // size=0, offset=26 - short gunHeight; // size=0, offset=28 - short targetDist; // size=0, offset=30 - byte damage; // size=0, offset=32 - byte recoilFrame; // size=0, offset=33 - byte flashTime; // size=0, offset=34 - byte drawFrame; // size=0, offset=35 - short sampleNum; // size=0, offset=36 -}; - - - -struct RAT_STRUCT -{ - PHD_3DPOS pos; // size=20, offset=0 - short roomNumber; // size=0, offset=20 - short speed; // size=0, offset=22 - short fallspeed; // size=0, offset=24 - byte on; // size=0, offset=26 - byte flags; // size=0, offset=27 -}; - -struct BAT_STRUCT -{ - PHD_3DPOS pos; // size=20, offset=0 - short roomNumber; // size=0, offset=20 - short speed; // size=0, offset=22 - short counter; // size=0, offset=24 - short laraTarget; // size=0, offset=26 - byte xTarget; // size=0, offset=28 - byte zTarget; // size=0, offset=29 - byte on; // size=0, offset=30 - byte flags; // size=0, offset=31 -}; - -struct SPIDER_STRUCT -{ - PHD_3DPOS pos; // size=20, offset=0 - short roomNumber; // size=0, offset=20 - short speed; // size=0, offset=22 - short fallspeed; // size=0, offset=24 - byte on; // size=0, offset=26 - byte flags; // size=0, offset=27 -}; - -struct DEBRIS_STRUCT -{ - void* textInfo; // size=0, offset=0 - int x; // size=0, offset=4 - int y; // size=0, offset=8 - int z; // size=0, offset=12 - short xyzOffsets1[3]; // size=6, offset=16 - short dir; // size=0, offset=22 - short xyzOffsets2[3]; // size=6, offset=24 - short speed; // size=0, offset=30 - short xyzOffsets3[3]; // size=6, offset=32 - short yVel; // size=0, offset=38 - short gravity; // size=0, offset=40 - short roomNumber; // size=0, offset=42 - byte on; // size=0, offset=44 - byte xRot; // size=0, offset=45 - byte yRot; // size=0, offset=46 - byte r; // size=0, offset=47 - byte g; // size=0, offset=48 - byte b; // size=0, offset=49 - byte pad[22]; // size=22, offset=50 -}; - -typedef struct BOUNDING_BOX { - short X1; - short X2; - short Y1; - short Y2; - short Z1; - short Z2; -}; - -struct QUAKE_CAMERA { - GAME_VECTOR spos; - GAME_VECTOR epos; -}; - -struct DOORPOS_DATA -{ - FLOOR_INFO* floor; // size=8, offset=0 - FLOOR_INFO data; // size=8, offset=4 - short block; // size=0, offset=12 -}; - -struct DOOR_DATA -{ - DOORPOS_DATA d1; // size=16, offset=0 - DOORPOS_DATA d1flip; // size=16, offset=16 - DOORPOS_DATA d2; // size=16, offset=32 - DOORPOS_DATA d2flip; // size=16, offset=48 - short opened; // size=0, offset=64 - short* dptr1; // size=0, offset=68 - short* dptr2; // size=0, offset=72 - short* dptr3; // size=0, offset=76 - short* dptr4; // size=0, offset=80 - byte dn1; // size=0, offset=84 - byte dn2; // size=0, offset=85 - byte dn3; // size=0, offset=86 - byte dn4; // size=0, offset=87 - ITEM_INFO* item; // size=144, offset=88 -}; - -struct SUBSUIT_INFO -{ - short XRot; // size=0, offset=0 - short dXRot; // size=0, offset=2 - short XRotVel; // size=0, offset=4 - short Vel[2]; // size=4, offset=6 - short YVel; // size=0, offset=10 -}; - -struct PISTOL_DEF { - short objectNum; - char draw1Anim2; - char draw1Anim; - char draw2Anim; - char recoilAnim; -}; - -struct SP_DYNAMIC -{ - unsigned char On; // size=0, offset=0 - unsigned char Falloff; // size=0, offset=1 - unsigned char R; // size=0, offset=2 - unsigned char G; // size=0, offset=3 - unsigned char B; // size=0, offset=4 - unsigned char Flags; // size=0, offset=5 - unsigned char Pad[2]; // size=2, offset=6 -}; - -struct ANIM_FRAME // Variable size -{ - short MinX; // size=0, offset=0 - short MaxX; // size=0, offset=2 - short MinY; // size=0, offset=4 - short MaxY; // size=0, offset=6 - short MinZ; // size=0, offset=8 - short MaxZ; // size=0, offset=10 - short OffsetX; // size=0, offset=12 - short OffsetY; // size=0, offset=14 - short OffsetZ; // size=0, offset=16 - unsigned short AngleSets[]; // Variable size -}; - -struct NODEOFFSET_INFO -{ - short x; // size=0, offset=0 - short y; // size=0, offset=2 - short z; // size=0, offset=4 - char meshNum; // size=0, offset=6 - unsigned char gotIt; // size=0, offset=7 -}; - -typedef void (cdecl *EFFECT_ROUTINE)(ITEM_INFO*); -typedef void (cdecl *LARA_COLLISION_ROUTINE)(ITEM_INFO*, COLL_INFO*); -typedef void (cdecl *LARA_CONTROL_ROUTINE)(ITEM_INFO*, COLL_INFO*); - -#pragma pack(pop) \ No newline at end of file diff --git a/TR5Main/Global/vodoo.h b/TR5Main/Global/vodoo.h deleted file mode 100644 index 2de74a04c..000000000 --- a/TR5Main/Global/vodoo.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include - -#pragma pack(push, 1) -typedef struct { - BYTE opCode; // must be 0xE9; - DWORD offset; // jump offset -} JMP; -#pragma pack(pop) - -#define INJECT(from,to) { \ - ((JMP*)(from))->opCode = 0xE9; \ - ((JMP*)(from))->offset = (DWORD)(to) - ((DWORD)(from) + sizeof(JMP)); \ -} - -#define VAR_U_(address, type) (*(type*)(address)) // uninitialized variable -#define VAR_I_(address, type, value) (*(type*)(address)) // initialized variable (value is just for info) -#define ARRAY_(address, type, length) (*(type(*)length)(address)) // array (can be multidimensional) diff --git a/TR5Main/Objects/Effects/tr4_bubbles.cpp b/TR5Main/Objects/Effects/tr4_bubbles.cpp index df9e3998d..155a5f88b 100644 --- a/TR5Main/Objects/Effects/tr4_bubbles.cpp +++ b/TR5Main/Objects/Effects/tr4_bubbles.cpp @@ -1,13 +1,14 @@ -#include "../newobjects.h" -#include "../../Game/effect2.h" -#include "../../Game/debris.h" -#include "../../Game/items.h" -#include "../../Game/traps.h" -#include "../../Game/draw.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/effects.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr4_bubbles.h" +#include "effect2.h" +#include "debris.h" +#include "items.h" +#include "traps.h" +#include "draw.h" +#include "tomb4fx.h" +#include "effect.h" +#include "level.h" +#include "lara.h" void BubblesEffect1(short fxNum, short xVel, short yVel, short zVel) { @@ -29,7 +30,7 @@ void BubblesEffect1(short fxNum, short xVel, short yVel, short zVel) spark->dG = spark->dB + 64; spark->fadeToBlack = 8; spark->colFadeSpeed = (GetRandomControl() & 3) + 4; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 3) + 16; spark->y = 0; spark->x = (GetRandomControl() & 0xF) - 8; @@ -83,7 +84,7 @@ void BubblesEffect2(short fxNum, short xVel, short yVel, short zVel) spark->dG = spark->dR = (GetRandomControl() & 0x7F) + 32; spark->fadeToBlack = 8; spark->colFadeSpeed = (GetRandomControl() & 3) + 4; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 3) + 16; spark->y = 0; spark->x = (GetRandomControl() & 0xF) - 8; @@ -131,7 +132,7 @@ void BubblesEffect3(short fxNum, short xVel, short yVel, short zVel) spark->dG = spark->dG >> 1; spark->fadeToBlack = 8; spark->colFadeSpeed = (GetRandomControl() & 3) + 8; - spark->transType = 2; + spark->transType = COLADD; spark->dynamic = -1; spark->life = spark->sLife = (GetRandomControl() & 7) + 32; spark->y = 0; @@ -195,7 +196,7 @@ void BubblesEffect4(short fxNum, short xVel, short yVel, short zVel) } spark->fadeToBlack = 8; spark->colFadeSpeed = (GetRandomControl() & 3) + 4; - spark->transType = 2; + spark->transType = COLADD; spark->life = spark->sLife = (GetRandomControl() & 3) + 16; spark->y = 0; spark->x = (GetRandomControl() & 0xF) - 8; @@ -223,7 +224,7 @@ void BubblesEffect4(short fxNum, short xVel, short yVel, short zVel) } } -int BubblesShatterFunction(FX_INFO* fx, int param1, int param2) +void BubblesShatterFunction(FX_INFO* fx, int param1, int param2) { ShatterItem.yRot = fx->pos.yRot; ShatterItem.meshp = Meshes[fx->frameNumber]; @@ -233,8 +234,6 @@ int BubblesShatterFunction(FX_INFO* fx, int param1, int param2) ShatterItem.bit = 0; ShatterItem.flags = fx->flag2 & 0x400; ShatterObject(&ShatterItem, 0, param2, fx->roomNumber, param1); - - return 1; } void BubblesControl(short fxNum) @@ -244,17 +243,17 @@ void BubblesControl(short fxNum) short angles[2]; phd_GetVectorAngles( LaraItem->pos.xPos - fx->pos.xPos, - LaraItem->pos.yPos - fx->pos.yPos - 256, + LaraItem->pos.yPos - fx->pos.yPos - STEP_SIZE, LaraItem->pos.zPos - fx->pos.zPos, angles); - int unk1 = 0; // v44 - int unk2 = 0; // v3 + int maxRotation = 0; + int maxSpeed = 0; if (fx->flag1 == 1) { - unk1 = 512; - unk2 = 256; + maxRotation = 512; + maxSpeed = 256; } else { @@ -264,16 +263,16 @@ void BubblesControl(short fxNum) { fx->counter--; } - unk1 = 256; + maxRotation = 256; } else { - unk1 = 768; + maxRotation = 768; } - unk2 = 192; + maxSpeed = 192; } - if (fx->speed < unk2) + if (fx->speed < maxSpeed) { if (fx->flag1 == 6) { @@ -285,29 +284,27 @@ void BubblesControl(short fxNum) } int dy = angles[0] - fx->pos.yRot; - if (abs(dy) > ANGLE(180)) + if (abs(dy) > ANGLE(180.0f)) { dy = -dy; } int dx = angles[1] - fx->pos.xRot; - if (abs(dx) > ANGLE(180)) - { + if (abs(dx) > ANGLE(180.0f)) dx = -dx; - } dy >>= 3; dx >>= 3; - if (dy < -unk1) - dy = -unk1; - else if (dy > unk1) - dy = unk1; + if (dy < -maxRotation) + dy = -maxRotation; + else if (dy > maxRotation) + dy = maxRotation; - if (dx < -unk1) - dx = -unk1; - else if (dx > unk1) - dx = unk1; + if (dx < -maxRotation) + dx = -maxRotation; + else if (dx > maxRotation) + dx = maxRotation; if (fx->flag1 != 4 && (fx->flag1 != 6 || !fx->counter)) { @@ -318,9 +315,7 @@ void BubblesControl(short fxNum) fx->pos.zRot += 16 * fx->speed; if (fx->flag1 == 6) - { fx->pos.zRot += 16 * fx->speed; - } int oldX = fx->pos.xPos; int oldY = fx->pos.yPos; @@ -343,21 +338,11 @@ void BubblesControl(short fxNum) fx->pos.zPos = oldZ; if (fx->flag1 != 6) - { BubblesShatterFunction(fx, 0, -32); - } if (fx->flag1 == 1) { - TriggerShockwave( - (PHD_3DPOS*)&fx->pos, - 32, - 160, - 64, - 64, 128, 00, - 24, - (((~Rooms[fx->roomNumber].flags) >> 4) & 2) << 16, 0); - + TriggerShockwave(&fx->pos, 32, 160, 64, 64, 128, 00, 24, (((~Rooms[fx->roomNumber].flags) >> 4) & 2) << 16, 0); TriggerExplosionSparks(oldX, oldY, oldZ, 3, -2, 2, fx->roomNumber); } else @@ -435,10 +420,9 @@ void BubblesControl(short fxNum) if (fx->flag1 == 1) { - TriggerShockwave((PHD_3DPOS*)fx, 48, 240, 64, 64, 128, 0, 24, 0, 0); + TriggerShockwave(&fx->pos, 48, 240, 64, 64, 128, 0, 24, 0, 0); TriggerExplosionSparks(oldX, oldY, oldZ, 3, -2, 2, fx->roomNumber); LaraBurn(); - //Lara.gassed = true; BYTE1(Lara_Flags) |= 2u; } else if (fx->flag1) { @@ -446,42 +430,34 @@ void BubblesControl(short fxNum) { case 3: case 4: - TriggerShockwave((PHD_3DPOS*)fx, 32, 160, 64, 128, 64, 0, 16, 0, 1); + TriggerShockwave(&fx->pos, 32, 160, 64, 128, 64, 0, 16, 0, 1); break; case 5: - TriggerShockwave((PHD_3DPOS*)fx, 32, 160, 64, 0, 96, 128, 16, 0, 2); + TriggerShockwave(&fx->pos, 32, 160, 64, 0, 96, 128, 16, 0, 2); break; case 2: - TriggerShockwave((PHD_3DPOS*)fx, 32, 160, 64, 0, 128, 128, 16, 0, 2); + TriggerShockwave(&fx->pos, 32, 160, 64, 0, 128, 128, 16, 0, 2); break; case 6: TriggerExplosionSparks(oldX, oldY, oldZ, 3, -2, 0, fx->roomNumber); - TriggerShockwave((PHD_3DPOS*)fx, 48, 240, 64, 0, 96, 128, 24, 0, 0); + TriggerShockwave(&fx->pos, 48, 240, 64, 0, 96, 128, 24, 0, 0); fx->pos.yPos -= 128; - TriggerShockwave((PHD_3DPOS*)fx, 48, 240, 48, 0, 112, 128, 16, 0, 0); + TriggerShockwave(&fx->pos, 48, 240, 48, 0, 112, 128, 16, 0, 0); fx->pos.yPos += 256; - TriggerShockwave((PHD_3DPOS*)fx, 48, 240, 48, 0, 112, 128, 16, 0, 0); + TriggerShockwave(&fx->pos, 48, 240, 48, 0, 112, 128, 16, 0, 0); LaraBurn(); break; } } else { - TriggerShockwave( - (PHD_3DPOS*)fx, - 24, - 88, - 48, - 64, 128, 0, 16, - (((~Rooms[fx->roomNumber].flags) >> 4) & 2) << 16, 0); + TriggerShockwave( &fx->pos, 24, 88, 48, 64, 128, 0, 16, (((~Rooms[fx->roomNumber].flags) >> 4) & 2) << 16, 0); } } else { if (roomNumber != fx->roomNumber) - { EffectNewRoom(fxNum, roomNumber); - } int dx = oldX - fx->pos.xPos; int dy = oldY - fx->pos.yPos; @@ -498,13 +474,9 @@ void BubblesControl(short fxNum) else if (fx->flag1 < 3 || fx->flag1 > 5) { if (fx->flag1 == 2) - { BubblesEffect2(fxNum, 16 * dx, 16 * dy, 16 * dz); - } else if (fx->flag1 == 6) - { BubblesEffect3(fxNum, 16 * dx, 16 * dy, 16 * dz); - } } else { diff --git a/TR5Main/Objects/Effects/tr4_bubbles.h b/TR5Main/Objects/Effects/tr4_bubbles.h new file mode 100644 index 000000000..33fcd8772 --- /dev/null +++ b/TR5Main/Objects/Effects/tr4_bubbles.h @@ -0,0 +1,3 @@ +#pragma once + +void BubblesControl(short fxNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR1/tr1_ape.cpp b/TR5Main/Objects/TR1/Entity/tr1_ape.cpp similarity index 95% rename from TR5Main/Objects/TR1/tr1_ape.cpp rename to TR5Main/Objects/TR1/Entity/tr1_ape.cpp index 927fdc7b3..15fb547a2 100644 --- a/TR5Main/Objects/TR1/tr1_ape.cpp +++ b/TR5Main/Objects/TR1/Entity/tr1_ape.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/box.h" -#include "../../Game/effects.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr1_ape.h" +#include "box.h" +#include "effect.h" +#include "setup.h" +#include "level.h" +#include "lara.h" BITE_INFO apeBite = { 0, -19, 75, 15 }; diff --git a/TR5Main/Objects/TR1/Entity/tr1_ape.h b/TR5Main/Objects/TR1/Entity/tr1_ape.h new file mode 100644 index 000000000..e48ae6b64 --- /dev/null +++ b/TR5Main/Objects/TR1/Entity/tr1_ape.h @@ -0,0 +1,3 @@ +#pragma once + +void ApeControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR1/tr1_bear.cpp b/TR5Main/Objects/TR1/Entity/tr1_bear.cpp similarity index 96% rename from TR5Main/Objects/TR1/tr1_bear.cpp rename to TR5Main/Objects/TR1/Entity/tr1_bear.cpp index 95adb60e8..94e4a40ef 100644 --- a/TR5Main/Objects/TR1/tr1_bear.cpp +++ b/TR5Main/Objects/TR1/Entity/tr1_bear.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/box.h" -#include "../../Game/effects.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr1_bear.h" +#include "box.h" +#include "effect.h" +#include "setup.h" +#include "level.h" +#include "lara.h" BITE_INFO bearBite = { 0, 96, 335, 14 }; diff --git a/TR5Main/Objects/TR1/Entity/tr1_bear.h b/TR5Main/Objects/TR1/Entity/tr1_bear.h new file mode 100644 index 000000000..b8810d504 --- /dev/null +++ b/TR5Main/Objects/TR1/Entity/tr1_bear.h @@ -0,0 +1,3 @@ +#pragma once + +void BearControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR1/tr1_lara_evil.cpp b/TR5Main/Objects/TR1/Entity/tr1_doppelganger.cpp similarity index 91% rename from TR5Main/Objects/TR1/tr1_lara_evil.cpp rename to TR5Main/Objects/TR1/Entity/tr1_doppelganger.cpp index f3bb65026..6a91a1fce 100644 --- a/TR5Main/Objects/TR1/tr1_lara_evil.cpp +++ b/TR5Main/Objects/TR1/Entity/tr1_doppelganger.cpp @@ -1,10 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/items.h" -#include "../../Game/larafire.h" -#include "../../Game/misc.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr1_doppelganger.h" +#include "box.h" +#include "items.h" +#include "larafire.h" +#include "misc.h" +#include "level.h" +#include "lara.h" // TODO: Evil lara is not targetable and cant move like lara. @@ -15,12 +16,12 @@ static short GetWeaponDamage(int weaponType) } // original: -void InitialiseEvilLara(short itemNum) +void InitialiseDoppelganger(short itemNum) { ClearItem(itemNum); } -void LaraEvilControl(short itemNum) +void DoppelgangerControl(short itemNum) { ITEM_INFO* item; FLOOR_INFO* floor; diff --git a/TR5Main/Objects/TR1/Entity/tr1_doppelganger.h b/TR5Main/Objects/TR1/Entity/tr1_doppelganger.h new file mode 100644 index 000000000..6ce07b0a4 --- /dev/null +++ b/TR5Main/Objects/TR1/Entity/tr1_doppelganger.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseDoppelganger(short itemNum); +void DoppelgangerControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR1/tr1_natla.cpp b/TR5Main/Objects/TR1/Entity/tr1_natla.cpp similarity index 94% rename from TR5Main/Objects/TR1/tr1_natla.cpp rename to TR5Main/Objects/TR1/Entity/tr1_natla.cpp index 9eb666b4c..adcf4527a 100644 --- a/TR5Main/Objects/TR1/tr1_natla.cpp +++ b/TR5Main/Objects/TR1/Entity/tr1_natla.cpp @@ -1,12 +1,14 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/items.h" -#include "../../Game/missile.h" -#include "..\..\Specific\level.h" -#include -#include "../../Game/sound.h" -#include "../../Game/effects.h" +#include "framework.h" +#include "tr1_natla.h" +#include "box.h" +#include "people.h" +#include "items.h" +#include "missile.h" +#include "level.h" +#include "sound.h" +#include "effect2.h" +#include "effect.h" +#include "trmath.h" /* HIT POINTS for Natla when she enters her second stage */ #define NATLA_NEAR_DEATH 200 @@ -19,9 +21,9 @@ BITE_INFO natla_gun = { 5, 220, 7, 4 }; #define NATLA_FLYMODE 0x8000 #define NATLA_TIMER 0x7fff -#define NATLA_FIRE_ARC ANGLE(30) -#define NATLA_FLY_TURN ANGLE(5) -#define NATLA_RUN_TURN ANGLE(6) +#define NATLA_FIRE_ARC ANGLE(30.0f) +#define NATLA_FLY_TURN ANGLE(5.0f) +#define NATLA_RUN_TURN ANGLE(6.0f) #define NATLA_LAND_CHANCE 0x100 #define NATLA_DIE_TIME 30*16 #define NATLA_SHOT_DAMAGE 100 diff --git a/TR5Main/Objects/TR1/Entity/tr1_natla.h b/TR5Main/Objects/TR1/Entity/tr1_natla.h new file mode 100644 index 000000000..b8895df31 --- /dev/null +++ b/TR5Main/Objects/TR1/Entity/tr1_natla.h @@ -0,0 +1,3 @@ +#pragma once + +void NatlaControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR1/tr1_natla_evil.cpp b/TR5Main/Objects/TR1/Entity/tr1_natla_mutant.cpp similarity index 91% rename from TR5Main/Objects/TR1/tr1_natla_evil.cpp rename to TR5Main/Objects/TR1/Entity/tr1_natla_mutant.cpp index c409b536f..c9f2f54ae 100644 --- a/TR5Main/Objects/TR1/tr1_natla_evil.cpp +++ b/TR5Main/Objects/TR1/Entity/tr1_natla_mutant.cpp @@ -1,13 +1,14 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effect2.h" -#include "../../Game/items.h" -#include "../../Game/camera.h" -#include "../../Specific/setup.h" -#include "../../Game/tomb4fx.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr1_natla_mutant.h" +#include "box.h" +#include "effect2.h" +#include "items.h" +#include "camera.h" +#include "setup.h" +#include "tomb4fx.h" +#include "level.h" +#include "lara.h" +#include "sound.h" enum abortion_anims { ABORT_EMPTY, ABORT_STOP, ABORT_TURNL, ABORT_TURNR, ABORT_ATTACK1, ABORT_ATTACK2, @@ -182,14 +183,14 @@ void NatlaEvilControl(short itemNum) Lara.gunStatus = LG_HANDS_BUSY; Lara.gunType = WEAPON_NONE; - Camera.targetDistance = WALL_SIZE * 2; - Camera.flags = FOLLOW_CENTRE; + Camera.targetDistance = SECTOR(2); + Camera.flags = CF_FOLLOW_CENTER; } break; case ABORT_KILL: - Camera.targetDistance = WALL_SIZE * 2; - Camera.flags = FOLLOW_CENTRE; + Camera.targetDistance = SECTOR(2); + Camera.flags = CF_FOLLOW_CENTER; break; } } @@ -213,7 +214,7 @@ void NatlaEvilControl(short itemNum) CreatureAnimation(itemNum, 0, 0); /* Explode on death and set off heavy trigger into the bargain */ - if (item->status == ITEM_DEACTIVATED) + if (item->status == ITEM_DESACTIVATED) { SoundEffect(171, &item->pos, NULL); ExplodingDeath(itemNum, 0xffffffff, ABORT_PART_DAMAGE); @@ -223,6 +224,6 @@ void NatlaEvilControl(short itemNum) TestTriggers(TriggerIndex, TRUE, 0); KillItem(itemNum); - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; } } \ No newline at end of file diff --git a/TR5Main/Objects/TR1/Entity/tr1_natla_mutant.h b/TR5Main/Objects/TR1/Entity/tr1_natla_mutant.h new file mode 100644 index 000000000..946343fcf --- /dev/null +++ b/TR5Main/Objects/TR1/Entity/tr1_natla_mutant.h @@ -0,0 +1,3 @@ +#pragma once + +void NatlaEvilControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR1/tr1_wolf.cpp b/TR5Main/Objects/TR1/Entity/tr1_wolf.cpp similarity index 94% rename from TR5Main/Objects/TR1/tr1_wolf.cpp rename to TR5Main/Objects/TR1/Entity/tr1_wolf.cpp index 4b8489abc..96f60c249 100644 --- a/TR5Main/Objects/TR1/tr1_wolf.cpp +++ b/TR5Main/Objects/TR1/Entity/tr1_wolf.cpp @@ -1,10 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/box.h" -#include "../../Game/effects.h" -#include "../../Game/lara.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr1_wolf.h" +#include "items.h" +#include "box.h" +#include "effect.h" +#include "lara.h" +#include "setup.h" +#include "level.h" BITE_INFO wolfBite = { 0, -14, 174, 6 }; diff --git a/TR5Main/Objects/TR1/Entity/tr1_wolf.h b/TR5Main/Objects/TR1/Entity/tr1_wolf.h new file mode 100644 index 000000000..71763efac --- /dev/null +++ b/TR5Main/Objects/TR1/Entity/tr1_wolf.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseWolf(short itemNum); +void WolfControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR1/tr1_larson.cpp b/TR5Main/Objects/TR1/tr1_larson.cpp deleted file mode 100644 index cf778e6cd..000000000 --- a/TR5Main/Objects/TR1/tr1_larson.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Specific/setup.h" -#include "../../Specific/level.h" -#include "../../Game/control.h" - -enum LARSON_STATE { - PEOPLE_EMPTY, PEOPLE_STOP, PEOPLE_WALK, PEOPLE_RUN, PEOPLE_AIM, - PEOPLE_DEATH, PEOPLE_POSE, PEOPLE_SHOOT -}; - -#define PEOPLE_WALK_TURN ANGLE(3) -#define PEOPLE_RUN_TURN ANGLE(6) -#define PEOPLE_POSE_CHANCE 0x60 -#define PEOPLE_WALK_RANGE SQUARE(WALL_SIZE*3) -#define PEOPLE_SHOT_DAMAGE 50 -#define LARSON_DIE_ANIM 15 - -BITE_INFO larson_gun = { -60, 170, 0, 14 }; - -void Tr1LarsonControl(short itemNum) -{ - if (!CreatureActive(itemNum)) - return; - - ITEM_INFO* item; - CREATURE_INFO* people; - AI_INFO info; - short angle, head, tilt; - - item = &Items[itemNum]; - people = (CREATURE_INFO*)item->data; - head = angle = tilt = 0; - - /* Has person been killed? */ - if (item->hitPoints <= 0) - { - if (item->currentAnimState != PEOPLE_DEATH) - { - item->animNumber = Objects[item->objectNumber].animIndex + LARSON_DIE_ANIM; - item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = PEOPLE_DEATH; - } - } - else - { - CreatureAIInfo(item, &info); - - if (info.ahead) - head = info.angle; - - GetCreatureMood(item, &info, TIMID); - CreatureMood(item, &info, TIMID); - - angle = CreatureTurn(item, people->maximumTurn); - - switch (item->currentAnimState) - { - case PEOPLE_STOP: - if (item->requiredAnimState) - item->goalAnimState = item->requiredAnimState; - else if (people->mood == BORED_MOOD) - item->goalAnimState = (GetRandomControl() < PEOPLE_POSE_CHANCE) ? PEOPLE_POSE : PEOPLE_WALK; - else if (people->mood == ESCAPE_MOOD) - item->goalAnimState = PEOPLE_RUN; - else - item->goalAnimState = PEOPLE_WALK; - break; - - case PEOPLE_POSE: - if (people->mood != BORED_MOOD) - item->goalAnimState = PEOPLE_STOP; - else if (GetRandomControl() < PEOPLE_POSE_CHANCE) - { - item->requiredAnimState = PEOPLE_WALK; - item->goalAnimState = PEOPLE_STOP; - } - break; - - case PEOPLE_WALK: - people->maximumTurn = PEOPLE_WALK_TURN; - - if (people->mood == BORED_MOOD && GetRandomControl() < PEOPLE_POSE_CHANCE) - { - item->requiredAnimState = PEOPLE_POSE; - item->goalAnimState = PEOPLE_STOP; - } - else if (people->mood == ESCAPE_MOOD) - { - item->requiredAnimState = PEOPLE_RUN; - item->goalAnimState = PEOPLE_STOP; - } - else if (Targetable(item, &info)) - { - item->requiredAnimState = PEOPLE_AIM; - item->goalAnimState = PEOPLE_STOP; - } - else if (!info.ahead || info.distance > PEOPLE_WALK_RANGE) - { - item->requiredAnimState = PEOPLE_RUN; - item->goalAnimState = PEOPLE_STOP; - } - break; - - case PEOPLE_RUN: - people->maximumTurn = PEOPLE_RUN_TURN; - tilt = angle / 2; - - if (people->mood == BORED_MOOD && GetRandomControl() < PEOPLE_POSE_CHANCE) - { - item->requiredAnimState = PEOPLE_POSE; - item->goalAnimState = PEOPLE_STOP; - } - else if (Targetable(item, &info)) - { - item->requiredAnimState = PEOPLE_AIM; - item->goalAnimState = PEOPLE_STOP; - } - else if (info.ahead && info.distance < PEOPLE_WALK_RANGE) - { - item->requiredAnimState = PEOPLE_WALK; - item->goalAnimState = PEOPLE_STOP; - } - break; - - case PEOPLE_AIM: - if (item->requiredAnimState) - item->goalAnimState = item->requiredAnimState; - else if (Targetable(item, &info)) - item->goalAnimState = PEOPLE_SHOOT; - else - item->goalAnimState = PEOPLE_STOP; - break; - - case PEOPLE_SHOOT: - /* Required state is set after this so only one shot is fired */ - if (!item->requiredAnimState) - { - ShotLara(item, &info, &larson_gun, head, PEOPLE_SHOT_DAMAGE); - item->requiredAnimState = PEOPLE_AIM; - } - - if (people->mood == ESCAPE_MOOD) - item->requiredAnimState = PEOPLE_STOP; - break; - } - } - - CreatureTilt(item, tilt); - CreatureJoint(item, 0, head); - CreatureAnimation(itemNum, angle, tilt); -} \ No newline at end of file diff --git a/TR5Main/Objects/TR1/tr1_objects.cpp b/TR5Main/Objects/TR1/tr1_objects.cpp new file mode 100644 index 000000000..3bdf8dfab --- /dev/null +++ b/TR5Main/Objects/TR1/tr1_objects.cpp @@ -0,0 +1,148 @@ +#include "framework.h" +#include "tr1_objects.h" +/// entities +#include "tr1_ape.h" // OK +#include "tr1_bear.h" // OK +#include "tr1_doppelganger.h" // OK +#include "tr1_natla.h" // OK +#include "tr1_natla_mutant.h" // OK +#include "tr1_wolf.h" // OK +/// objects + +/// traps + +/// necessary import +#include "box.h" +#include "collide.h" +#include "setup.h" +#include "level.h" + +static void StartBaddy(ObjectInfo* obj) +{ + obj = &Objects[ID_WOLF]; + if (obj->loaded) + { + obj->initialise = InitialiseWolf; + obj->control = WolfControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 6; + obj->pivotLength = 375; + obj->radius = 340; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex + 2 * 4] |= ROT_Y; + } + + obj = &Objects[ID_BEAR]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->control = BearControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 20; + obj->pivotLength = 500; + obj->radius = 340; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + } + + obj = &Objects[ID_APE]; + if (obj->loaded) + { + obj->control = ApeControl; + obj->collision = CreatureCollision; + obj->hitPoints = 22; + obj->shadowSize = 128; + obj->pivotLength = 250; + obj->radius = 340; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->zoneType = ZONE_APE; + } + + obj = &Objects[ID_NATLA]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = NatlaControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 400; + obj->radius = 204; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->savePosition = true; + obj->saveHitpoints = true; + Bones[obj->boneIndex + 2 * 4] |= (ROT_Z | ROT_X); + } + + obj = &Objects[ID_WINGED_NATLA]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = NatlaEvilControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 500; + obj->radius = 341; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->savePosition = true; + obj->saveHitpoints = true; + Bones[obj->boneIndex + 1 * 4] |= ROT_Y; + } + + obj = &Objects[ID_LARA_DOPPELGANGER]; + if (obj->loaded) + { + // use lara animation. + if (Objects[ID_LARA].loaded) + obj->animIndex = Objects[ID_LARA].animIndex; + + obj->initialise = InitialiseDoppelganger; + obj->collision = CreatureCollision; + obj->control = DoppelgangerControl; + //obj->drawRoutine = DrawEvilLara; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 1000; + obj->radius = 102; + //obj->intelligent = true; + obj->saveFlags = true; + obj->savePosition = true; + obj->saveHitpoints = true; + } +} + +static void StartObject(ObjectInfo* obj) +{ + +} + +static void StartTrap(ObjectInfo* obj) +{ + +} + +static ObjectInfo* objToInit; +void InitialiseTR1Objects() +{ + StartBaddy(objToInit); + StartObject(objToInit); + StartTrap(objToInit); +} diff --git a/TR5Main/Objects/TR1/tr1_objects.h b/TR5Main/Objects/TR1/tr1_objects.h new file mode 100644 index 000000000..97ecc6bb6 --- /dev/null +++ b/TR5Main/Objects/TR1/tr1_objects.h @@ -0,0 +1,3 @@ +#pragma once + +void InitialiseTR1Objects(); diff --git a/TR5Main/Objects/TR1/tr1_pierre.cpp b/TR5Main/Objects/TR1/tr1_pierre.cpp deleted file mode 100644 index d1116293b..000000000 --- a/TR5Main/Objects/TR1/tr1_pierre.cpp +++ /dev/null @@ -1,234 +0,0 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/lot.h" -#include "../../specific/setup.h" -#include "..\..\Game\camera.h" -#include "..\..\Specific\level.h" - -enum PIERRE_STATE { - PEOPLE_EMPTY, PEOPLE_STOP, PEOPLE_WALK, PEOPLE_RUN, PEOPLE_AIM, - PEOPLE_DEATH, PEOPLE_POSE, PEOPLE_SHOOT -}; - -#define PIERRE_DIE_ANIM 12 -#define PIERRE_WIMP_CHANCE 0x2000 -#define PIERRE_RUN_HITPOINTS 40 -#define PIERRE_DISAPPEAR 10 -#define PEOPLE_WALK_TURN ANGLE(3) -#define PEOPLE_RUN_TURN ANGLE(6) -#define PEOPLE_POSE_CHANCE 0x60 -#define PEOPLE_WALK_RANGE SQUARE(WALL_SIZE*3) -#define PEOPLE_SHOT_DAMAGE 50 - -BITE_INFO pierre_gun1 = { 60, 200, 0, 11 }; -BITE_INFO pierre_gun2 = { -57, 200, 0, 14 }; - -short pierre_item; - -void Tr1PierreControl(short itemNum) -{ - if (!CreatureActive(itemNum)) - return; - - ITEM_INFO* item; - CREATURE_INFO* people; - short angle, head, tilt; - AI_INFO info; - GAME_VECTOR start, end; - - item = &Items[itemNum]; - - /* Avoid packs of Pierre's */ - if (pierre_item != NO_ITEM) - { - if (pierre_item != itemNum) - { - /* Don't kill the one true Pierre */ - if (item->flags & ONESHOT) - KillItem(pierre_item); - else - KillItem(itemNum); - } - } - else - { - pierre_item = itemNum; - } - - people = (CREATURE_INFO*)item->data; - head = angle = tilt = 0; - - /* If not ONESHOT, death cannot happen, but Pierre will run away */ - if (item->hitPoints <= PIERRE_RUN_HITPOINTS && !(item->flags & ONESHOT)) - { - item->hitPoints = PIERRE_RUN_HITPOINTS; - people->flags++; - } - - /* Has Pierre been killed? */ - if (item->hitPoints <= 0) - { - if (item->currentAnimState != PEOPLE_DEATH) - { - item->animNumber = Objects[item->objectNumber].animIndex + PIERRE_DIE_ANIM; - item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = PEOPLE_DEATH; - // drop magnum/scion_item2/key_item1. - } - } - else - { - CreatureAIInfo(item, &info); - - if (info.ahead) - head = info.angle; - - /* Flags set means it is time to run away */ - if (people->flags) - { - /* Lie anout situation to fool CreatureMood */ - info.enemyZone = -1; - item->hitStatus = true; - } - GetCreatureMood(item, &info, TIMID); - CreatureMood(item, &info, TIMID); - - angle = CreatureTurn(item, people->maximumTurn); - - /* Decide on Pierre's action based on mood, anim state and AI info */ - switch (item->currentAnimState) - { - case PEOPLE_STOP: - if (item->requiredAnimState) - item->goalAnimState = item->requiredAnimState; - else if (people->mood == BORED_MOOD) - item->goalAnimState = (GetRandomControl() < PEOPLE_POSE_CHANCE) ? PEOPLE_POSE : PEOPLE_WALK; - else if (people->mood == ESCAPE_MOOD) - item->goalAnimState = PEOPLE_RUN; - else - item->goalAnimState = PEOPLE_WALK; - break; - - case PEOPLE_POSE: - if (people->mood != BORED_MOOD) - item->goalAnimState = PEOPLE_STOP; - else if (GetRandomControl() < PEOPLE_POSE_CHANCE) - { - item->requiredAnimState = PEOPLE_WALK; - item->goalAnimState = PEOPLE_STOP; - } - break; - - case PEOPLE_WALK: - people->maximumTurn = PEOPLE_WALK_TURN; - - if (people->mood == BORED_MOOD && GetRandomControl() < PEOPLE_POSE_CHANCE) - { - item->requiredAnimState = PEOPLE_POSE; - item->goalAnimState = PEOPLE_STOP; - } - else if (people->mood == ESCAPE_MOOD) - { - item->requiredAnimState = PEOPLE_RUN; - item->goalAnimState = PEOPLE_STOP; - } - else if (Targetable(item, &info)) - { - item->requiredAnimState = PEOPLE_AIM; - item->goalAnimState = PEOPLE_STOP; - } - else if (!info.ahead || info.distance > PEOPLE_WALK_RANGE) - { - item->requiredAnimState = PEOPLE_RUN; - item->goalAnimState = PEOPLE_STOP; - } - break; - - case PEOPLE_RUN: - people->maximumTurn = PEOPLE_RUN_TURN; - tilt = angle / 2; - - if (people->mood == BORED_MOOD && GetRandomControl() < PEOPLE_POSE_CHANCE) - { - item->requiredAnimState = PEOPLE_POSE; - item->goalAnimState = PEOPLE_STOP; - } - else if (Targetable(item, &info)) - { - item->requiredAnimState = PEOPLE_AIM; - item->goalAnimState = PEOPLE_STOP; - } - else if (info.ahead && info.distance < PEOPLE_WALK_RANGE) - { - item->requiredAnimState = PEOPLE_WALK; - item->goalAnimState = PEOPLE_STOP; - } - break; - - case PEOPLE_AIM: - if (item->requiredAnimState) - item->goalAnimState = item->requiredAnimState; - else if (Targetable(item, &info)) - item->goalAnimState = PEOPLE_SHOOT; - else - item->goalAnimState = PEOPLE_STOP; - break; - - case PEOPLE_SHOOT: - /* Required state is set after this so only one shot is fired */ - if (!item->requiredAnimState) - { - ShotLara(item, &info, &pierre_gun1, head, PEOPLE_SHOT_DAMAGE); - ShotLara(item, &info, &pierre_gun2, head, PEOPLE_SHOT_DAMAGE); - item->requiredAnimState = PEOPLE_AIM; - } - - if (people->mood == ESCAPE_MOOD && PIERRE_WIMP_CHANCE < GetRandomControl()) - item->requiredAnimState = PEOPLE_STOP; - break; - } - } - - CreatureTilt(item, tilt); - CreatureJoint(item, 0, head); - CreatureAnimation(itemNum, angle, 0); - - /* When Pierre goes out of sight when he's escaping, you've lost him */ - if (people->flags) - { - start.x = item->pos.xPos; - start.y = item->pos.yPos - WALL_SIZE; - start.z = item->pos.zPos; - - end.x = Camera.pos.x; - end.y = Camera.pos.y; - end.z = Camera.pos.z; - end.roomNumber = Camera.pos.roomNumber; - - if (!LOS(&end, &start)) - { - if (people->flags > PIERRE_DISAPPEAR) - { - item->hitPoints = -16384; - DisableBaddieAI(itemNum); - KillItem(itemNum); - pierre_item = NO_ITEM; - } - } - else - { - people->flags = 1; // reset timer - } - } - - /* If area Pierre in gets flooded then make him disappear */ - if (GetWaterHeight(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber) != NO_HEIGHT) - { - item->hitPoints = -16384; - DisableBaddieAI(itemNum); - KillItem(itemNum); - pierre_item = NO_ITEM; - } -} \ No newline at end of file diff --git a/TR5Main/Objects/TR1/tr1_raptor.cpp b/TR5Main/Objects/TR1/tr1_raptor.cpp deleted file mode 100644 index 61794bb4a..000000000 --- a/TR5Main/Objects/TR1/tr1_raptor.cpp +++ /dev/null @@ -1,199 +0,0 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" - -enum RAPTOR_STATE -{ - RAPTOR_EMPTY, - RAPTOR_STOP, - RAPTOR_WALK, - RAPTOR_RUN, - RAPTOR_ATTACK1, - RAPTOR_DEATH, - RAPTOR_WARNING, - RAPTOR_ATTACK2, - RAPTOR_ATTACK3 -}; - -BITE_INFO raptorBite = { 0, 66, 318, 22 }; - -/* Raptor has two deaths */ -#define RAPTOR_DIE_ANIM 9 -#define RAPTOR_ROAR_CHANCE 0x100 -#define RAPTOR_LUNGE_RANGE SQUARE(WALL_SIZE*3/2) -#define RAPTOR_ATTACK_RANGE SQUARE(WALL_SIZE*3/2) -#define RAPTOR_CLOSE_RANGE SQUARE(680) -#define RAPTOR_RUN_TURN ANGLE(4) -#define RAPTOR_WALK_TURN ANGLE(1) -#define RAPTOR_LUNGE_DAMAGE 100 -#define RAPTOR_BITE_DAMAGE 100 -#define RAPTOR_CHARGE_DAMAGE 100 -#define RAPTOR_TOUCH (0xFF7C00) - -void Tr1RaptorControl(short itemNum) -{ - if (!CreatureActive(itemNum)) - return; - - ITEM_INFO* item; - CREATURE_INFO* raptor; - AI_INFO info; - short head, angle, tilt; - - item = &Items[itemNum]; - raptor = (CREATURE_INFO*)item->data; - head = angle = tilt = 0; - - if (item->hitPoints <= 0) - { - if (item->currentAnimState != RAPTOR_DEATH) - { - item->animNumber = Objects[ID_RAPTOR].animIndex + RAPTOR_DIE_ANIM + (short)(GetRandomControl() / 16200); - item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = RAPTOR_DEATH; - } - } - else - { - CreatureAIInfo(item, &info); - - if (info.ahead) - head = info.angle; - - GetCreatureMood(item, &info, VIOLENT); - CreatureMood(item, &info, VIOLENT); - - angle = CreatureTurn(item, raptor->maximumTurn); - - switch (item->currentAnimState) - { - case RAPTOR_STOP: - if (item->requiredAnimState) - { - item->goalAnimState = item->requiredAnimState; - } - else if (item->touchBits & RAPTOR_TOUCH) - { - item->goalAnimState = RAPTOR_ATTACK3; - } - else if (info.distance < RAPTOR_CLOSE_RANGE && info.bite) - { - item->goalAnimState = RAPTOR_ATTACK3; - } - else if (info.bite && info.distance < RAPTOR_LUNGE_RANGE) - { - item->goalAnimState = RAPTOR_ATTACK1; - } - else if (raptor->mood == BORED_MOOD) - { - item->goalAnimState = RAPTOR_WALK; - } - else - { - item->goalAnimState = RAPTOR_RUN; - } - - break; - - case RAPTOR_WALK: - raptor->maximumTurn = RAPTOR_WALK_TURN; - - if (raptor->mood != BORED_MOOD) - { - item->goalAnimState = RAPTOR_STOP; - } - else if (info.ahead && GetRandomControl() < RAPTOR_ROAR_CHANCE) - { - item->requiredAnimState = RAPTOR_WARNING; - item->goalAnimState = RAPTOR_STOP; - } - break; - - case RAPTOR_RUN: - tilt = angle / 3; - raptor->maximumTurn = RAPTOR_RUN_TURN; - - if (item->touchBits & RAPTOR_TOUCH) - { - item->goalAnimState = RAPTOR_STOP; - } - else if (info.bite && info.distance < RAPTOR_ATTACK_RANGE) - { - if (item->goalAnimState == RAPTOR_RUN) - { - if (GetRandomControl() < 0x2000) - { - item->goalAnimState = RAPTOR_STOP; - } - else - { - item->goalAnimState = RAPTOR_ATTACK2; - } - } - } - else if (info.ahead && raptor->mood != ESCAPE_MOOD && GetRandomControl() < RAPTOR_ROAR_CHANCE) - { - item->requiredAnimState = RAPTOR_WARNING; - item->goalAnimState = RAPTOR_STOP; - } - else if (raptor->mood == BORED_MOOD) - { - item->goalAnimState = RAPTOR_STOP; - } - break; - - case RAPTOR_ATTACK1: - tilt = angle; - - /* Lunge attack */ - if (!item->requiredAnimState && info.ahead && (item->touchBits & RAPTOR_TOUCH)) - { - CreatureEffect(item, &raptorBite, DoBloodSplat); - - LaraItem->hitPoints -= RAPTOR_LUNGE_DAMAGE; - LaraItem->hitStatus = true; - - item->requiredAnimState = RAPTOR_STOP; - } - break; - - case RAPTOR_ATTACK3: - tilt = angle; - - /* Close bite attack */ - if (!item->requiredAnimState && (item->touchBits & RAPTOR_TOUCH)) - { - CreatureEffect(item, &raptorBite, DoBloodSplat); - - LaraItem->hitPoints -= RAPTOR_BITE_DAMAGE; - LaraItem->hitStatus = true; - - item->requiredAnimState = RAPTOR_STOP; - } - break; - - case RAPTOR_ATTACK2: - tilt = angle; - - /* Charge attack */ - if (!item->requiredAnimState && info.ahead && (item->touchBits & RAPTOR_TOUCH)) - { - CreatureEffect(item, &raptorBite, DoBloodSplat); - - LaraItem->hitPoints -= RAPTOR_CHARGE_DAMAGE; - LaraItem->hitStatus = true; - - item->requiredAnimState = RAPTOR_RUN; - } - - break; - } - } - - CreatureTilt(item, tilt); - CreatureJoint(item, 0, head); - CreatureAnimation(itemNum, angle, tilt); -} \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_barracuda.cpp b/TR5Main/Objects/TR2/Entity/tr2_barracuda.cpp similarity index 91% rename from TR5Main/Objects/TR2/tr2_barracuda.cpp rename to TR5Main/Objects/TR2/Entity/tr2_barracuda.cpp index cb1408366..9a7654daf 100644 --- a/TR5Main/Objects/TR2/tr2_barracuda.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_barracuda.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/lara.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr2_barracuda.h" +#include "box.h" +#include "effect.h" +#include "lara.h" +#include "setup.h" +#include "level.h" BITE_INFO barracudaBite = { 2, -60, 121, 7 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_barracuda.h b/TR5Main/Objects/TR2/Entity/tr2_barracuda.h new file mode 100644 index 000000000..5c7c1b980 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_barracuda.h @@ -0,0 +1,3 @@ +#pragma once + +void BarracudaControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_birdmonster.cpp b/TR5Main/Objects/TR2/Entity/tr2_birdmonster.cpp similarity index 93% rename from TR5Main/Objects/TR2/tr2_birdmonster.cpp rename to TR5Main/Objects/TR2/Entity/tr2_birdmonster.cpp index f5fca010f..f2dbb0a30 100644 --- a/TR5Main/Objects/TR2/tr2_birdmonster.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_birdmonster.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/lara.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr2_birdmonster.h" +#include "box.h" +#include "effect.h" +#include "lara.h" +#include "setup.h" +#include "level.h" BITE_INFO birdyBiteL = { 0, 224, 0, 19 }; BITE_INFO birdyBiteR = { 0, 224, 0, 22 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_birdmonster.h b/TR5Main/Objects/TR2/Entity/tr2_birdmonster.h new file mode 100644 index 000000000..cfda81b0f --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_birdmonster.h @@ -0,0 +1,3 @@ +#pragma once + +void BirdMonsterControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_dragon.cpp b/TR5Main/Objects/TR2/Entity/tr2_dragon.cpp similarity index 95% rename from TR5Main/Objects/TR2/tr2_dragon.cpp rename to TR5Main/Objects/TR2/Entity/tr2_dragon.cpp index aa84b90e4..08807d73a 100644 --- a/TR5Main/Objects/TR2/tr2_dragon.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_dragon.cpp @@ -1,18 +1,17 @@ -#include "../newobjects.h" -#include "../../Game/lara.h" -#include "../../Game/effect2.h" -#include "../../Game/items.h" -#include "../../Game/collide.h" -#include "../../Game/Box.h" -#include "../../Game/lot.h" -#include "../../Game/sphere.h" -#include "../../Game/camera.h" -#include "../../Specific/level.h" -#include "../../specific/setup.h" -#include "../../Specific/input.h" -#include "../../Game/sound.h" - - +#include "framework.h" +#include "tr2_dragon.h" +#include "lara.h" +#include "effect2.h" +#include "items.h" +#include "collide.h" +#include "box.h" +#include "lot.h" +#include "sphere.h" +#include "camera.h" +#include "level.h" +#include "setup.h" +#include "input.h" +#include "sound.h" // TODO: test the dragon and bartoli to check if it work ! // TODO: upgrade the collision of dragon to pick the dagger correctly. @@ -59,7 +58,7 @@ enum DRAGON_STATE { DRAGON_DEATH }; -void createBartoliLight(short ItemIndex, int type) +static void createBartoliLight(short ItemIndex, int type) { ITEM_INFO* item; item = &Items[ItemIndex]; @@ -72,7 +71,7 @@ void createBartoliLight(short ItemIndex, int type) TriggerDynamicLight(item->pos.xPos, item->pos.yPos - STEP_SIZE, item->pos.zPos, (GetRandomControl() & 20) + 25, (GetRandomControl() & 30) + 200, (GetRandomControl() & 25) + 50, (GetRandomControl() & 20) + 0); } -short dragonFire(int x, int y, int z, short speed, short yrot, short roomNumber) +static short dragonFire(int x, int y, int z, short speed, short yrot, short roomNumber) { short fx_number = NO_ITEM; /* @@ -99,7 +98,7 @@ short dragonFire(int x, int y, int z, short speed, short yrot, short roomNumber) return fx_number; } -void createExplosion(ITEM_INFO* item) +static void createExplosion(ITEM_INFO* item) { ITEM_INFO* itemExplo; short ExplIndex; @@ -133,7 +132,7 @@ void createExplosion(ITEM_INFO* item) } } -void createDragonBone(short front_number) +static void createDragonBone(short front_number) { /* Create the bones of the dragon */ short bone_back, bone_front; @@ -323,9 +322,9 @@ void DragonControl(short backNum) // all over DisableBaddieAI(itemNum); KillItem(backNum); - back->status = ITEM_DEACTIVATED; + back->status = ITEM_DESACTIVATED; KillItem(itemNum); - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; return; } else if (dragon->flags < -100) diff --git a/TR5Main/Objects/TR2/Entity/tr2_dragon.h b/TR5Main/Objects/TR2/Entity/tr2_dragon.h new file mode 100644 index 000000000..d0536b50d --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_dragon.h @@ -0,0 +1,8 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void DragonCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll); +void DragonControl(short backNum); +void InitialiseBartoli(short itemNum); +void BartoliControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_eagle_or_crow.cpp b/TR5Main/Objects/TR2/Entity/tr2_eagle_or_crow.cpp similarity index 92% rename from TR5Main/Objects/TR3/tr3_eagle_or_crow.cpp rename to TR5Main/Objects/TR2/Entity/tr2_eagle_or_crow.cpp index d4abe0f99..7685560fb 100644 --- a/TR5Main/Objects/TR3/tr3_eagle_or_crow.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_eagle_or_crow.cpp @@ -1,10 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/box.h" -#include "../../Game/effects.h" -#include "../../Game/lara.h" -#include "../../Game/items.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr2_eagle_or_crow.h" +#include "box.h" +#include "effect.h" +#include "lara.h" +#include "items.h" +#include "setup.h" +#include "level.h" BITE_INFO eagleBite = { 15, 46, 21, 6 }; BITE_INFO crowBite = { 2, 10, 60, 14 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_eagle_or_crow.h b/TR5Main/Objects/TR2/Entity/tr2_eagle_or_crow.h new file mode 100644 index 000000000..be5a6a657 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_eagle_or_crow.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseEagle(short itemNum); +void EagleControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_knifethrower.cpp b/TR5Main/Objects/TR2/Entity/tr2_knifethrower.cpp similarity index 94% rename from TR5Main/Objects/TR2/tr2_knifethrower.cpp rename to TR5Main/Objects/TR2/Entity/tr2_knifethrower.cpp index 25766d564..9ffe25b20 100644 --- a/TR5Main/Objects/TR2/tr2_knifethrower.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_knifethrower.cpp @@ -1,12 +1,13 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/effects.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr2_knifethrower.h" +#include "items.h" +#include "effect.h" +#include "box.h" +#include "people.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO knifeLeft = { 0, 0, 0, 5 }; BITE_INFO knifeRight = { 0, 0, 0, 8 }; @@ -73,7 +74,7 @@ void KnifeControl(short fxNum) } } -short ThrowKnife(int x, int y, int z, short speed, short yrot, short roomNumber) +static short ThrowKnife(int x, int y, int z, short speed, short yrot, short roomNumber) { short fx_number = 0; /* diff --git a/TR5Main/Objects/TR2/Entity/tr2_knifethrower.h b/TR5Main/Objects/TR2/Entity/tr2_knifethrower.h new file mode 100644 index 000000000..62fe568be --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_knifethrower.h @@ -0,0 +1,4 @@ +#pragma once + +void KnifeControl(short fxNum); +void KnifethrowerControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_mercenary.cpp b/TR5Main/Objects/TR2/Entity/tr2_mercenary.cpp similarity index 96% rename from TR5Main/Objects/TR2/tr2_mercenary.cpp rename to TR5Main/Objects/TR2/Entity/tr2_mercenary.cpp index d33eeb07f..04effa094 100644 --- a/TR5Main/Objects/TR2/tr2_mercenary.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_mercenary.cpp @@ -1,9 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/control.h" +#include "framework.h" +#include "tr2_mercenary.h" +#include "box.h" +#include "people.h" +#include "setup.h" +#include "level.h" +#include "control.h" +#include "trmath.h" BITE_INFO mercUziBite = { 0, 150, 19, 17 }; BITE_INFO mercAutoPistolBite = { 0, 230, 9, 17 }; @@ -95,7 +97,7 @@ void MercenaryUziControl(short itemNum) head_x = info.xAngle; } - mc1->maximumTurn = ANGLE(7); + mc1->maximumTurn = ANGLE(7.0f); if (mc1->mood == ESCAPE_MOOD) { @@ -135,7 +137,7 @@ void MercenaryUziControl(short itemNum) head_x = info.xAngle; } - mc1->maximumTurn = ANGLE(10); + mc1->maximumTurn = ANGLE(10.0f); tilt = (angle / 3); if (mc1->mood != ESCAPE_MOOD) diff --git a/TR5Main/Objects/TR2/Entity/tr2_mercenary.h b/TR5Main/Objects/TR2/Entity/tr2_mercenary.h new file mode 100644 index 000000000..564c4cb1a --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_mercenary.h @@ -0,0 +1,4 @@ +#pragma once + +void MercenaryUziControl(short itemNum); +void MercenaryAutoPistolControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_monk.cpp b/TR5Main/Objects/TR2/Entity/tr2_monk.cpp similarity index 95% rename from TR5Main/Objects/TR2/tr2_monk.cpp rename to TR5Main/Objects/TR2/Entity/tr2_monk.cpp index aa5222154..b17fccb34 100644 --- a/TR5Main/Objects/TR2/tr2_monk.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_monk.cpp @@ -1,10 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr2_monk.h" +#include "box.h" +#include "effect.h" +#include "lara.h" +#include "sound.h" +#include "setup.h" +#include "level.h" BITE_INFO monkBite = { -23,16,265, 14 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_monk.h b/TR5Main/Objects/TR2/Entity/tr2_monk.h new file mode 100644 index 000000000..2570f0a68 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_monk.h @@ -0,0 +1,3 @@ +#pragma once + +void MonkControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_rat.cpp b/TR5Main/Objects/TR2/Entity/tr2_rat.cpp similarity index 92% rename from TR5Main/Objects/TR2/tr2_rat.cpp rename to TR5Main/Objects/TR2/Entity/tr2_rat.cpp index 42df71a76..5d3d0c41e 100644 --- a/TR5Main/Objects/TR2/tr2_rat.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_rat.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/lara.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr2_rat.h" +#include "lara.h" +#include "box.h" +#include "effect.h" +#include "setup.h" +#include "level.h" BITE_INFO ratBite = { 0, 0, 57, 2 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_rat.h b/TR5Main/Objects/TR2/Entity/tr2_rat.h new file mode 100644 index 000000000..1e747952a --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_rat.h @@ -0,0 +1,3 @@ +#pragma once + +void RatControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_shark.cpp b/TR5Main/Objects/TR2/Entity/tr2_shark.cpp similarity index 92% rename from TR5Main/Objects/TR2/tr2_shark.cpp rename to TR5Main/Objects/TR2/Entity/tr2_shark.cpp index ed661e894..d4ed7f20a 100644 --- a/TR5Main/Objects/TR2/tr2_shark.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_shark.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/lara.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr2_shark.h" +#include "box.h" +#include "effect.h" +#include "lara.h" +#include "setup.h" +#include "level.h" BITE_INFO sharkBite = { 17, -22, 344, 12 }; @@ -101,5 +102,7 @@ void SharkControl(short itemNum) CreatureUnderwater(item, 340); } else + { AnimateItem(item); + } } \ No newline at end of file diff --git a/TR5Main/Objects/TR2/Entity/tr2_shark.h b/TR5Main/Objects/TR2/Entity/tr2_shark.h new file mode 100644 index 000000000..c25e20c32 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_shark.h @@ -0,0 +1,3 @@ +#pragma once + +void SharkControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_silencer.cpp b/TR5Main/Objects/TR2/Entity/tr2_silencer.cpp similarity index 96% rename from TR5Main/Objects/TR2/tr2_silencer.cpp rename to TR5Main/Objects/TR2/Entity/tr2_silencer.cpp index 3bfe5401e..17bdef265 100644 --- a/TR5Main/Objects/TR2/tr2_silencer.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_silencer.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/control.h" +#include "framework.h" +#include "tr2_silencer.h" +#include "box.h" +#include "people.h" +#include "setup.h" +#include "level.h" +#include "control.h" BITE_INFO silencerGun = { 3, 331, 56, 10 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_silencer.h b/TR5Main/Objects/TR2/Entity/tr2_silencer.h new file mode 100644 index 000000000..3217fbcc2 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_silencer.h @@ -0,0 +1,3 @@ +#pragma once + +void SilencerControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_skidman.cpp b/TR5Main/Objects/TR2/Entity/tr2_skidman.cpp similarity index 91% rename from TR5Main/Objects/TR2/tr2_skidman.cpp rename to TR5Main/Objects/TR2/Entity/tr2_skidman.cpp index a4161f87f..bcf923a72 100644 --- a/TR5Main/Objects/TR2/tr2_skidman.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_skidman.cpp @@ -1,21 +1,21 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/collide.h" -#include "../../Game/lara.h" -#include "../../Game/lot.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/sphere.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/sound.h" - - +#include "framework.h" +#include "tr2_skidman.h" +#include "items.h" +#include "collide.h" +#include "lara.h" +#include "lot.h" +#include "box.h" +#include "people.h" +#include "sphere.h" +#include "setup.h" +#include "level.h" +#include "sound.h" +#include "snowmobile.h" enum SKIDMAN_STATE { SMAN_EMPTY, SMAN_WAIT, SMAN_MOVING, SMAN_STARTLEFT, SMAN_STARTRIGHT, SMAN_LEFT, SMAN_RIGHT, SMAN_DEATH }; -#define SMAN_MIN_TURN (ANGLE(6)/3) -#define SMAN_TARGET_ANGLE ANGLE(15) +#define SMAN_MIN_TURN (ANGLE(6.0f)/3) +#define SMAN_TARGET_ANGLE ANGLE(15.0f) #define SMAN_WAIT_RANGE SQUARE(WALL_SIZE*4) #define SMAN_DEATH_ANIM 10 @@ -232,7 +232,7 @@ void SkidManControl(short riderNum) rider->animNumber = item->animNumber + (Objects[ID_SNOWMOBILE_DRIVER].animIndex - Objects[ID_SNOWMOBILE_GUN].animIndex); rider->frameNumber = item->frameNumber + (Anims[rider->animNumber].frameBase - Anims[item->animNumber].frameBase); } - else if (rider->status == ITEM_DEACTIVATED && item->speed == 0 && item->fallspeed == 0) + else if (rider->status == ITEM_DESACTIVATED && item->speed == 0 && item->fallspeed == 0) { /* If rider has reached end of his death animation, turn his skidoo into one that Lara can ride */ RemoveActiveItem(riderNum); @@ -242,7 +242,7 @@ void SkidManControl(short riderNum) DisableBaddieAI(item_number); item->objectNumber = ID_SNOWMOBILE; - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; InitialiseSkidoo(item_number); ((SKIDOO_INFO*)item->data)->armed = true; diff --git a/TR5Main/Objects/TR2/Entity/tr2_skidman.h b/TR5Main/Objects/TR2/Entity/tr2_skidman.h new file mode 100644 index 000000000..552fc0424 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_skidman.h @@ -0,0 +1,7 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void InitialiseSkidman(short itemNum); +void SkidManCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll); +void SkidManControl(short riderNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_spear_guardian.cpp b/TR5Main/Objects/TR2/Entity/tr2_spear_guardian.cpp similarity index 94% rename from TR5Main/Objects/TR2/tr2_spear_guardian.cpp rename to TR5Main/Objects/TR2/Entity/tr2_spear_guardian.cpp index fce2a13e9..5187eaedf 100644 --- a/TR5Main/Objects/TR2/tr2_spear_guardian.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_spear_guardian.cpp @@ -1,16 +1,17 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/items.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr2_spear_guardian.h" +#include "box.h" +#include "effect.h" +#include "items.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO spearLeftBite = { 0, 0, 920, 11 }; BITE_INFO spearRightBite = { 0, 0, 920, 18 }; -void XianDamage(ITEM_INFO* item, CREATURE_INFO* xian, int damage) +static void XianDamage(ITEM_INFO* item, CREATURE_INFO* xian, int damage) { if (!(xian->flags & 1) && (item->touchBits & 0x40000)) { @@ -46,7 +47,7 @@ void InitialiseSpearGuardian(short itemNum) item->frameNumber = anim->frameBase; item->currentAnimState = anim->currentAnimState; - //item->status = ITEM_INACTIVE; + //item->status = ITEM_NOT_ACTIVE; //item->meshBits = 0; } @@ -81,7 +82,7 @@ void SpearGuardianControl(short itemNum) item->objectNumber = ID_SPEAR_GUARDIAN; DisableBaddieAI(itemNum); KillItem(itemNum); - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; item->flags |= ONESHOT; */ } diff --git a/TR5Main/Objects/TR2/Entity/tr2_spear_guardian.h b/TR5Main/Objects/TR2/Entity/tr2_spear_guardian.h new file mode 100644 index 000000000..2d6179cfb --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_spear_guardian.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSpearGuardian(short itemNum); +void SpearGuardianControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_spider.cpp b/TR5Main/Objects/TR2/Entity/tr2_spider.cpp similarity index 92% rename from TR5Main/Objects/TR2/tr2_spider.cpp rename to TR5Main/Objects/TR2/Entity/tr2_spider.cpp index 8e7fbf6a2..1dc95fdfd 100644 --- a/TR5Main/Objects/TR2/tr2_spider.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_spider.cpp @@ -1,19 +1,20 @@ -#include "../newobjects.h" -#include "../../Game/effects.h" -#include "../../Game/sphere.h" -#include "../../Game/Box.h" -#include "../../Game/items.h" -#include "../../Game/effect2.h" -#include "../../Game/lot.h" -#include "../../Game/lara.h" -#include "../../specific/setup.h" -#include "../../Game/tomb4fx.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr2_spider.h" +#include "effect.h" +#include "sphere.h" +#include "box.h" +#include "items.h" +#include "effect2.h" +#include "lot.h" +#include "lara.h" +#include "setup.h" +#include "tomb4fx.h" +#include "level.h" BITE_INFO spiderBite = { 0, 0, 41, 1 }; // fix blood pos for small spider. -void S_SpiderBite(ITEM_INFO* item) +static void S_SpiderBite(ITEM_INFO* item) { PHD_VECTOR pos; pos.x = spiderBite.x; @@ -23,7 +24,7 @@ void S_SpiderBite(ITEM_INFO* item) DoBloodSplat(pos.x, pos.y, pos.z, 10, item->pos.yPos, item->roomNumber); } -void SpiderLeap(short itemNum, ITEM_INFO* item, short angle) +static void SpiderLeap(short itemNum, ITEM_INFO* item, short angle) { GAME_VECTOR vec; diff --git a/TR5Main/Objects/TR2/Entity/tr2_spider.h b/TR5Main/Objects/TR2/Entity/tr2_spider.h new file mode 100644 index 000000000..ba3af86c7 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_spider.h @@ -0,0 +1,4 @@ +#pragma once + +void SmallSpiderControl(short itemNum); +void BigSpiderControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_sword_guardian.cpp b/TR5Main/Objects/TR2/Entity/tr2_sword_guardian.cpp similarity index 90% rename from TR5Main/Objects/TR2/tr2_sword_guardian.cpp rename to TR5Main/Objects/TR2/Entity/tr2_sword_guardian.cpp index 75afec8c4..25aabe40a 100644 --- a/TR5Main/Objects/TR2/tr2_sword_guardian.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_sword_guardian.cpp @@ -1,13 +1,14 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/lot.h" -#include "../../Game/effect2.h" -#include "../../Game/items.h" -#include "../../Game/tomb4fx.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr2_sword_guardian.h" +#include "box.h" +#include "effect.h" +#include "lot.h" +#include "effect2.h" +#include "items.h" +#include "tomb4fx.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO swordBite = { 0, 37, 550, 15 }; @@ -20,11 +21,11 @@ void InitialiseSwordGuardian(short itemNum) ClearItem(itemNum); - //item->status = ITEM_INACTIVE; + //item->status = ITEM_NOT_ACTIVE; //item->meshBits = 0; } -void SwordGuardianFly(ITEM_INFO* item) +static void SwordGuardianFly(ITEM_INFO* item) { PHD_VECTOR pos; @@ -65,7 +66,7 @@ void SwordGuardianControl(short itemNum) //item->objectNumber = ID_SWAT; DisableBaddieAI(itemNum); KillItem(itemNum); - //item->status = ITEM_DEACTIVATED; + //item->status = ITEM_DESACTIVATED; //item->flags |= ONESHOT; item->currentAnimState = 12; @@ -79,7 +80,7 @@ void SwordGuardianControl(short itemNum) item->objectNumber = ID_SWAT; DisableBaddieAI(itemNum); KillItem(itemNum); - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; item->flags |= ONESHOT; } */ @@ -92,7 +93,7 @@ void SwordGuardianControl(short itemNum) sword->LOT.step = STEP_SIZE; sword->LOT.drop = -STEP_SIZE; sword->LOT.fly = NO_FLYING; - sword->LOT.zone = 1; + sword->LOT.zone = ZONE_BASIC; CreatureAIInfo(item, &info); if (item->currentAnimState == 8) @@ -103,7 +104,7 @@ void SwordGuardianControl(short itemNum) sword->LOT.step = WALL_SIZE * 20; sword->LOT.drop = -WALL_SIZE * 20; sword->LOT.fly = STEP_SIZE / 4; - sword->LOT.zone = 4; + sword->LOT.zone = ZONE_FLYER; CreatureAIInfo(item, &info); } } diff --git a/TR5Main/Objects/TR2/Entity/tr2_sword_guardian.h b/TR5Main/Objects/TR2/Entity/tr2_sword_guardian.h new file mode 100644 index 000000000..9d576d283 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_sword_guardian.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSwordGuardian(short itemNum); +void SwordGuardianControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_worker_dualrevolver.cpp b/TR5Main/Objects/TR2/Entity/tr2_worker_dualrevolver.cpp similarity index 96% rename from TR5Main/Objects/TR2/tr2_worker_dualrevolver.cpp rename to TR5Main/Objects/TR2/Entity/tr2_worker_dualrevolver.cpp index a29e11452..dbc16abe5 100644 --- a/TR5Main/Objects/TR2/tr2_worker_dualrevolver.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_worker_dualrevolver.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr2_worker_dualrevolver.h" +#include "box.h" +#include "people.h" +#include "setup.h" +#include "level.h" +#include "lara.h" BITE_INFO workerDualGunL = { -2, 275, 23, 6 }; BITE_INFO workerDualGunR = { 2, 275, 23, 10 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_worker_dualrevolver.h b/TR5Main/Objects/TR2/Entity/tr2_worker_dualrevolver.h new file mode 100644 index 000000000..356116ae0 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_worker_dualrevolver.h @@ -0,0 +1,3 @@ +#pragma once + +void WorkerDualGunControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_worker_flamethrower.cpp b/TR5Main/Objects/TR2/Entity/tr2_worker_flamethrower.cpp similarity index 92% rename from TR5Main/Objects/TR2/tr2_worker_flamethrower.cpp rename to TR5Main/Objects/TR2/Entity/tr2_worker_flamethrower.cpp index 3721f9458..e0914b798 100644 --- a/TR5Main/Objects/TR2/tr2_worker_flamethrower.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_worker_flamethrower.cpp @@ -1,18 +1,20 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/people.h" -#include "../../Game/items.h" -#include "../../Game/missile.h" -#include "../../Game/tomb4fx.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/effects.h" +#include "framework.h" +#include "tr2_worker_flamethrower.h" +#include "box.h" +#include "sphere.h" +#include "effect2.h" +#include "people.h" +#include "items.h" +#include "missile.h" +#include "tomb4fx.h" +#include "setup.h" +#include "level.h" +#include "effect.h" +#include "trmath.h" BITE_INFO workerFlameThrower = { 0, 250, 32, 9 }; -void Flame(DWORD x, int y, DWORD z, int speed, WORD yrot, WORD roomNumber) +static void Flame(DWORD x, int y, DWORD z, int speed, WORD yrot, WORD roomNumber) { short fx_number; short cam_rot; diff --git a/TR5Main/Objects/TR2/Entity/tr2_worker_flamethrower.h b/TR5Main/Objects/TR2/Entity/tr2_worker_flamethrower.h new file mode 100644 index 000000000..2786af034 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_worker_flamethrower.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseWorkerFlamethrower(short itemNum); +void WorkerFlamethrower(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_worker_machinegun.cpp b/TR5Main/Objects/TR2/Entity/tr2_worker_machinegun.cpp similarity index 96% rename from TR5Main/Objects/TR2/tr2_worker_machinegun.cpp rename to TR5Main/Objects/TR2/Entity/tr2_worker_machinegun.cpp index f715bdff3..1ec5284db 100644 --- a/TR5Main/Objects/TR2/tr2_worker_machinegun.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_worker_machinegun.cpp @@ -1,9 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/people.h" -#include "../../Game/Box.h" -#include "../../Game/items.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr2_worker_machinegun.h" +#include "people.h" +#include "box.h" +#include "items.h" +#include "setup.h" +#include "level.h" +#include "control.h" BITE_INFO workerMachineGun = { 0, 308, 32, 9 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_worker_machinegun.h b/TR5Main/Objects/TR2/Entity/tr2_worker_machinegun.h new file mode 100644 index 000000000..df446d9c2 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_worker_machinegun.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseWorkerMachineGun(short itemNum); +void WorkerMachineGunControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_worker_shotgun.cpp b/TR5Main/Objects/TR2/Entity/tr2_worker_shotgun.cpp similarity index 96% rename from TR5Main/Objects/TR2/tr2_worker_shotgun.cpp rename to TR5Main/Objects/TR2/Entity/tr2_worker_shotgun.cpp index 787f5fa55..362c9ef92 100644 --- a/TR5Main/Objects/TR2/tr2_worker_shotgun.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_worker_shotgun.cpp @@ -1,9 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/items.h" -#include "../../specific/setup.h" -#include "../../specific/level.h" +#include "framework.h" +#include "tr2_worker_shotgun.h" +#include "box.h" +#include "people.h" +#include "items.h" +#include "setup.h" +#include "level.h" +#include "control.h" BITE_INFO workerShotgun = { 0, 281, 40, 9 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_worker_shotgun.h b/TR5Main/Objects/TR2/Entity/tr2_worker_shotgun.h new file mode 100644 index 000000000..0113d530a --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_worker_shotgun.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseWorkerShotgun(short itemNum); +void WorkerShotgunControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_yeti.cpp b/TR5Main/Objects/TR2/Entity/tr2_yeti.cpp similarity index 96% rename from TR5Main/Objects/TR2/tr2_yeti.cpp rename to TR5Main/Objects/TR2/Entity/tr2_yeti.cpp index ea165e52f..00b1cb113 100644 --- a/TR5Main/Objects/TR2/tr2_yeti.cpp +++ b/TR5Main/Objects/TR2/Entity/tr2_yeti.cpp @@ -1,10 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/items.h" -#include "../../Game/lara.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr2_yeti.h" +#include "box.h" +#include "effect.h" +#include "items.h" +#include "lara.h" +#include "setup.h" +#include "level.h" BITE_INFO yetiBiteR = { 12, 101, 19, 10 }; BITE_INFO yetiBiteL = { 12, 101, 19, 13 }; diff --git a/TR5Main/Objects/TR2/Entity/tr2_yeti.h b/TR5Main/Objects/TR2/Entity/tr2_yeti.h new file mode 100644 index 000000000..fc712dbd5 --- /dev/null +++ b/TR5Main/Objects/TR2/Entity/tr2_yeti.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseYeti(short itemNum); +void YetiControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/Trap/tr2_killerstatue.cpp b/TR5Main/Objects/TR2/Trap/tr2_killerstatue.cpp new file mode 100644 index 000000000..d073c2450 --- /dev/null +++ b/TR5Main/Objects/TR2/Trap/tr2_killerstatue.cpp @@ -0,0 +1,44 @@ +#include "framework.h" +#include "tr2_killerstatue.h" +#include "level.h" +#include "setup.h" +#include "control.h" +#include "lara.h" +#include "effect.h" + +void InitialiseKillerStatue(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + item->animNumber = Objects[item->objectNumber].animIndex + 3; + item->frameNumber = Anims[item->animNumber].frameBase; + item->currentAnimState = 1; +} + +void KillerStatueControl(short itemNumber) +{ + ITEM_INFO* item; + int x, y, z; + short d; + + item = &Items[itemNumber]; + + if (TriggerActive(item) && item->currentAnimState == 1) + item->goalAnimState = 2; + else + item->goalAnimState = 1; + + if ((item->touchBits & 0x80) && item->currentAnimState == 2) + { + LaraItem->hitStatus = 1; + LaraItem->hitPoints -= 20; + + int x = LaraItem->pos.xPos + (GetRandomControl() - 16384) / 256; + int z = LaraItem->pos.zPos + (GetRandomControl() - 16384) / 256; + int y = LaraItem->pos.yPos - GetRandomControl() / 44; + int d = (GetRandomControl() - 16384) / 8 + LaraItem->pos.yRot; + DoBloodSplat(x, y, z, LaraItem->speed, d, LaraItem->roomNumber); + } + + AnimateItem(item); +} \ No newline at end of file diff --git a/TR5Main/Objects/TR2/Trap/tr2_killerstatue.h b/TR5Main/Objects/TR2/Trap/tr2_killerstatue.h new file mode 100644 index 000000000..df702370e --- /dev/null +++ b/TR5Main/Objects/TR2/Trap/tr2_killerstatue.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseKillerStatue(short itemNumber); +void KillerStatueControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/Trap/tr2_spinningblade.cpp b/TR5Main/Objects/TR2/Trap/tr2_spinningblade.cpp new file mode 100644 index 000000000..5a3f4f567 --- /dev/null +++ b/TR5Main/Objects/TR2/Trap/tr2_spinningblade.cpp @@ -0,0 +1,69 @@ +#include "framework.h" +#include "tr2_spinningblade.h" +#include "level.h" +#include "control.h" +#include "lara.h" +#include "setup.h" +#include "effect.h" +#include "sound.h" +#include "items.h" + +void InitialiseSpinningBlade(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + item->animNumber = Objects[item->objectNumber].animIndex + 3; + item->frameNumber = Anims[item->animNumber].frameBase; + item->currentAnimState = 1; +} + +void SpinningBladeControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + bool spinning = false; + + if (item->currentAnimState == 2) + { + if (item->goalAnimState != 1) + { + int x = item->pos.xPos + (WALL_SIZE * 3 / 2 * phd_sin(item->pos.yRot) >> W2V_SHIFT); + int z = item->pos.zPos + (WALL_SIZE * 3 / 2 * phd_cos(item->pos.yRot) >> W2V_SHIFT); + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(x, item->pos.yPos, z, &roomNumber); + int height = GetFloorHeight(floor, x, item->pos.yPos, z); + + if (height == NO_HEIGHT) + item->goalAnimState = 1; + } + + spinning = true; + + if (item->touchBits) + { + LaraItem->hitStatus = true; + LaraItem->hitPoints -= 100; + + DoLotsOfBlood(LaraItem->pos.xPos, LaraItem->pos.yPos - STEP_SIZE * 2, LaraItem->pos.zPos, (short)(item->speed * 2), LaraItem->pos.yRot, LaraItem->roomNumber, 2); + } + + SoundEffect(231, &item->pos, 0); + } + else + { + if (TriggerActive(item)) + item->goalAnimState = 2; + spinning = false; + } + + AnimateItem(item); + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + item->floor = item->pos.yPos = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + if (roomNumber != item->roomNumber) + ItemNewRoom(itemNumber, roomNumber); + + if (spinning && item->currentAnimState == 1) + item->pos.yRot += -ANGLE(180); +} \ No newline at end of file diff --git a/TR5Main/Objects/TR2/Trap/tr2_spinningblade.h b/TR5Main/Objects/TR2/Trap/tr2_spinningblade.h new file mode 100644 index 000000000..2fccb611e --- /dev/null +++ b/TR5Main/Objects/TR2/Trap/tr2_spinningblade.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSpinningBlade(short itemNumber); +void SpinningBladeControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/Trap/tr2_springboard.cpp b/TR5Main/Objects/TR2/Trap/tr2_springboard.cpp new file mode 100644 index 000000000..bc1a59522 --- /dev/null +++ b/TR5Main/Objects/TR2/Trap/tr2_springboard.cpp @@ -0,0 +1,32 @@ +#include "framework.h" +#include "tr2_springboard.h" +#include "level.h" +#include "lara.h" +#include "control.h" + +void SpringBoardControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (item->currentAnimState == 0 && LaraItem->pos.yPos == item->pos.yPos && + (LaraItem->pos.xPos >> WALL_SHIFT) == (item->pos.xPos >> WALL_SHIFT) && + (LaraItem->pos.zPos >> WALL_SHIFT) == (item->pos.zPos >> WALL_SHIFT)) + { + if (LaraItem->hitPoints <= 0) + return; + + if (LaraItem->currentAnimState == STATE_LARA_WALK_BACK || LaraItem->currentAnimState == STATE_LARA_RUN_BACK) + LaraItem->speed = -LaraItem->speed; + + LaraItem->fallspeed = -240; + LaraItem->gravityStatus = true; + LaraItem->animNumber = ANIMATION_LARA_FREE_FALL_FORWARD; + LaraItem->frameNumber = Anims[LaraItem->animNumber].frameBase; + LaraItem->currentAnimState = STATE_LARA_JUMP_FORWARD; + LaraItem->goalAnimState = STATE_LARA_JUMP_FORWARD; + + item->goalAnimState = 1; + } + + AnimateItem(item); +} \ No newline at end of file diff --git a/TR5Main/Objects/TR2/Trap/tr2_springboard.h b/TR5Main/Objects/TR2/Trap/tr2_springboard.h new file mode 100644 index 000000000..c13269eb3 --- /dev/null +++ b/TR5Main/Objects/TR2/Trap/tr2_springboard.h @@ -0,0 +1,3 @@ +#pragma once + +void SpringBoardControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/Vehicles/boat.cpp b/TR5Main/Objects/TR2/Vehicles/boat.cpp similarity index 93% rename from TR5Main/Objects/Vehicles/boat.cpp rename to TR5Main/Objects/TR2/Vehicles/boat.cpp index 66f494313..47f5ef1f5 100644 --- a/TR5Main/Objects/Vehicles/boat.cpp +++ b/TR5Main/Objects/TR2/Vehicles/boat.cpp @@ -1,17 +1,29 @@ -#include "../newobjects.h" -#include "../../Game/lara.h" -#include "../../Game/items.h" -#include "../../Game/collide.h" -#include "../../Game/sphere.h" -#include "../../Game/camera.h" -#include "../../Specific/setup.h" -#include "../../Specific/level.h" -#include "../../Specific/input.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "boat.h" +#include "lara.h" +#include "items.h" +#include "collide.h" +#include "sphere.h" +#include "camera.h" +#include "setup.h" +#include "level.h" +#include "input.h" +#include "sound.h" +typedef struct BOAT_INFO +{ + int boat_turn; + int left_fallspeed; + int right_fallspeed; + int water; + int pitch; + short tilt_angle; + short extra_rotation; + short prop_rot; +}; - -enum BOAT_STATE { +enum BOAT_STATE +{ BOAT_GETON, BOAT_STILL, BOAT_MOVING, @@ -67,7 +79,7 @@ enum BOAT_STATE { // TODO: (boat) render problem, water height problem, enter problem. -void GetBoatGetOff(ITEM_INFO* boat) +static void GetBoatGetOff(ITEM_INFO* boat) { /* Wait for last frame of getoff anims before returning to normal Lara control */ if ((LaraItem->currentAnimState == BOAT_JUMPR || LaraItem->currentAnimState == BOAT_JUMPL) && LaraItem->frameNumber == Anims[LaraItem->animNumber].frameEnd) @@ -110,7 +122,7 @@ void GetBoatGetOff(ITEM_INFO* boat) } } -int CanGetOff(int direction) +static int CanGetOff(int direction) { ITEM_INFO* v; FLOOR_INFO* floor; @@ -145,7 +157,7 @@ int CanGetOff(int direction) return 1; } -int BoatCheckGetOn(short itemNum, COLL_INFO* coll) +static int BoatCheckGetOn(short itemNum, COLL_INFO* coll) { /* Returns 0 if no get on, 1 if right get on and 2 if left get on and 3 if jump geton */ int geton = 0, dist; @@ -205,7 +217,7 @@ int BoatCheckGetOn(short itemNum, COLL_INFO* coll) return geton; } -int TestWaterHeight(ITEM_INFO* item, int z_off, int x_off, PHD_VECTOR* pos) +static int TestBoatWaterHeight(ITEM_INFO* item, int z_off, int x_off, PHD_VECTOR* pos) { /* Get water height at a position offset from the origin. Moves the vector in 'pos' to the required test position too */ @@ -238,7 +250,7 @@ int TestWaterHeight(ITEM_INFO* item, int z_off, int x_off, PHD_VECTOR* pos) return height - 5; // make sure boat is above water line else all sorts of weirdness results } -void DoBoatCollision(int itemNum) +static void DoBoatCollision(int itemNum) { ITEM_INFO* item, * boat; int item_number, distance, x, z, radius; @@ -272,7 +284,7 @@ void DoBoatCollision(int itemNum) } } -short DoBoatShift(ITEM_INFO* skidoo, PHD_VECTOR* pos, PHD_VECTOR* old) +static short DoBoatShift(ITEM_INFO* skidoo, PHD_VECTOR* pos, PHD_VECTOR* old) { int x, z; int x_old, z_old; @@ -387,7 +399,7 @@ short DoBoatShift(ITEM_INFO* skidoo, PHD_VECTOR* pos, PHD_VECTOR* old) return 0; } -int GetBoatCollisionAnim(ITEM_INFO* skidoo, PHD_VECTOR* moved) +static int GetBoatCollisionAnim(ITEM_INFO* skidoo, PHD_VECTOR* moved) { int c, s, front, side; @@ -420,7 +432,7 @@ int GetBoatCollisionAnim(ITEM_INFO* skidoo, PHD_VECTOR* moved) return 0; } -int DoBoatDynamics(int height, int fallspeed, int* y) +static int DoBoatDynamics(int height, int fallspeed, int* y) { if (height > * y) { @@ -448,7 +460,7 @@ int DoBoatDynamics(int height, int fallspeed, int* y) return fallspeed; } -int BoatDynamics(short itemNum) +static int BoatDynamics(short itemNum) { ITEM_INFO* boat; BOAT_INFO* binfo; @@ -468,11 +480,11 @@ int BoatDynamics(short itemNum) boat->pos.zRot -= binfo->tilt_angle; /* First get positions and heights of boat's corners + centre */ - hfl_old = TestWaterHeight(boat, BOAT_FRONT, -BOAT_SIDE, &fl_old); - hfr_old = TestWaterHeight(boat, BOAT_FRONT, BOAT_SIDE, &fr_old); - hbl_old = TestWaterHeight(boat, -BOAT_FRONT, -BOAT_SIDE, &bl_old); - hbr_old = TestWaterHeight(boat, -BOAT_FRONT, BOAT_SIDE, &br_old); - hf_old = TestWaterHeight(boat, BOAT_TIP, 0, &f_old); + hfl_old = TestBoatWaterHeight(boat, BOAT_FRONT, -BOAT_SIDE, &fl_old); + hfr_old = TestBoatWaterHeight(boat, BOAT_FRONT, BOAT_SIDE, &fr_old); + hbl_old = TestBoatWaterHeight(boat, -BOAT_FRONT, -BOAT_SIDE, &bl_old); + hbr_old = TestBoatWaterHeight(boat, -BOAT_FRONT, BOAT_SIDE, &br_old); + hf_old = TestBoatWaterHeight(boat, BOAT_TIP, 0, &f_old); old.x = boat->pos.xPos; old.y = boat->pos.yPos; old.z = boat->pos.zPos; @@ -522,25 +534,25 @@ int BoatDynamics(short itemNum) /* Test new positions of points (one at a time) and shift boat accordingly */ rot = 0; - hbl = TestWaterHeight(boat, -BOAT_FRONT, -BOAT_SIDE, &bl); + hbl = TestBoatWaterHeight(boat, -BOAT_FRONT, -BOAT_SIDE, &bl); if (hbl < bl_old.y - STEP_SIZE / 2) rot = DoBoatShift(boat, &bl, &bl_old); - hbr = TestWaterHeight(boat, -BOAT_FRONT, BOAT_SIDE, &br); + hbr = TestBoatWaterHeight(boat, -BOAT_FRONT, BOAT_SIDE, &br); if (hbr < br_old.y - STEP_SIZE / 2) rot += DoBoatShift(boat, &br, &br_old); - hfl = TestWaterHeight(boat, BOAT_FRONT, -BOAT_SIDE, &fl); + hfl = TestBoatWaterHeight(boat, BOAT_FRONT, -BOAT_SIDE, &fl); if (hfl < fl_old.y - STEP_SIZE / 2) rot += DoBoatShift(boat, &fl, &fl_old); - hfr = TestWaterHeight(boat, BOAT_FRONT, BOAT_SIDE, &fr); + hfr = TestBoatWaterHeight(boat, BOAT_FRONT, BOAT_SIDE, &fr); if (hfr < fr_old.y - STEP_SIZE / 2) rot += DoBoatShift(boat, &fr, &fr_old); if (!slip) { - hf = TestWaterHeight(boat, BOAT_TIP, 0, &f); + hf = TestBoatWaterHeight(boat, BOAT_TIP, 0, &f); if (hf < f_old.y - STEP_SIZE / 2) DoBoatShift(boat, &f, &f_old); } @@ -596,7 +608,7 @@ int BoatDynamics(short itemNum) return collide; } -int BoatUserControl(ITEM_INFO* boat) +static int BoatUserControl(ITEM_INFO* boat) { /* Return whether to straighten up or not */ int no_turn = 1, max_speed; @@ -683,7 +695,7 @@ int BoatUserControl(ITEM_INFO* boat) return no_turn; } -void BoatAnimation(ITEM_INFO* boat, int collide) +static void BoatAnimation(ITEM_INFO* boat, int collide) { BOAT_INFO* binfo; @@ -762,7 +774,7 @@ void BoatAnimation(ITEM_INFO* boat, int collide) } } -void BoatSplash(ITEM_INFO* item, long fallspeed, long water) +static void BoatSplash(ITEM_INFO* item, long fallspeed, long water) { /* splash_setup.x = item->pos.x_pos; @@ -885,8 +897,8 @@ void BoatControl(short itemNumber) /* Now got final position, so get heights under middle and corners (will only have changed from above if collision occurred, but recalc anyway as hardly big maths) */ - hfl = TestWaterHeight(boat, BOAT_FRONT, -BOAT_SIDE, &fl); - hfr = TestWaterHeight(boat, BOAT_FRONT, BOAT_SIDE, &fr); + hfl = TestBoatWaterHeight(boat, BOAT_FRONT, -BOAT_SIDE, &fl); + hfr = TestBoatWaterHeight(boat, BOAT_FRONT, BOAT_SIDE, &fr); roomNumber = boat->roomNumber; floor = GetFloor(boat->pos.xPos, boat->pos.yPos, boat->pos.zPos, &roomNumber); diff --git a/TR5Main/Objects/TR2/Vehicles/boat.h b/TR5Main/Objects/TR2/Vehicles/boat.h new file mode 100644 index 000000000..e242e7e12 --- /dev/null +++ b/TR5Main/Objects/TR2/Vehicles/boat.h @@ -0,0 +1,7 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void InitialiseBoat(short itemNum); +void BoatCollision(short itemNum, ITEM_INFO* litem, COLL_INFO* coll); +void BoatControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/Vehicles/snowmobile.cpp b/TR5Main/Objects/TR2/Vehicles/snowmobile.cpp similarity index 96% rename from TR5Main/Objects/Vehicles/snowmobile.cpp rename to TR5Main/Objects/TR2/Vehicles/snowmobile.cpp index 3dda5f788..9e36f716c 100644 --- a/TR5Main/Objects/Vehicles/snowmobile.cpp +++ b/TR5Main/Objects/TR2/Vehicles/snowmobile.cpp @@ -1,24 +1,23 @@ -#include "../newobjects.h" -#include "../../Game/lara.h" -#include "../../Game/items.h" -#include "../../Game/collide.h" -#include "../../Game/effects.h" -#include "../../Game/larafire.h" -#include "../../Game/lara1gun.h" -#include "../../Game/effect2.h" -#include "../../Game/laraflar.h" -#include "../../Game/lot.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/sphere.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Specific/input.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "snowmobile.h" +#include "lara.h" +#include "items.h" +#include "collide.h" +#include "effect.h" +#include "larafire.h" +#include "lara1gun.h" +#include "effect2.h" +#include "laraflar.h" +#include "lot.h" +#include "tomb4fx.h" +#include "sphere.h" +#include "setup.h" +#include "level.h" +#include "input.h" +#include "sound.h" // TODO: recreate the DrawSkidoo for the snowmobile. - - enum SKIDOO_STATE { SKID_SIT, SKID_GETON, SKID_LEFT, SKID_RIGHT, SKID_FALL, SKID_HIT, SKID_GETONL, SKID_GETOFFL, SKID_STILL, SKID_GETOFF, SKID_LETGO, SKID_DEATH, SKID_FALLOFF }; #define SWIM_DEPTH 730 @@ -89,7 +88,7 @@ void InitialiseSkidoo(short itemNum) } } -void SkidooBaddieCollision(short itemNum, ITEM_INFO* skidoo) +static void SkidooBaddieCollision(short itemNum, ITEM_INFO* skidoo) { vector roomsList; roomsList.push_back(skidoo->roomNumber); @@ -149,7 +148,7 @@ void SkidooBaddieCollision(short itemNum, ITEM_INFO* skidoo) } } -void SkidooGuns(void) +static void SkidooGuns(void) { ITEM_INFO* skidoo; SKIDOO_INFO* skinfo; @@ -182,7 +181,7 @@ void SkidooGuns(void) skidoo->itemFlags[0]--; } -void SkidooExplode(ITEM_INFO* skidoo) +static void SkidooExplode(ITEM_INFO* skidoo) { if (Rooms[skidoo->roomNumber].flags & ENV_FLAG_WATER) { @@ -197,13 +196,13 @@ void SkidooExplode(ITEM_INFO* skidoo) ExplodingDeath(Lara.Vehicle, -1, 256); KillItem(Lara.Vehicle); - skidoo->status = ITEM_DEACTIVATED; + skidoo->status = ITEM_DESACTIVATED; SoundEffect(SFX_EXPLOSION1, 0, 0); SoundEffect(SFX_EXPLOSION2, 0, 0); Lara.Vehicle = NO_ITEM; } -int SkidooCheckGetOffOK(int direction) +static int SkidooCheckGetOffOK(int direction) { /* Check if getting off skidoo here is possible in the direction required by player */ int x, y, z, height, ceiling; @@ -243,7 +242,7 @@ int SkidooCheckGetOffOK(int direction) /* Check if Lara is still under skidoo control. Return 0 if she is in that limbo state of the skidoo still needing control (it is falling) and her needing normal control (so is she) */ -int SkidooCheckGetOff() +static int SkidooCheckGetOff() { ITEM_INFO* skidoo; skidoo = &Items[Lara.Vehicle]; @@ -341,7 +340,7 @@ void DoSnowEffect(ITEM_INFO* skidoo) */ } -void SkidooAnimation(ITEM_INFO* skidoo, int collide, int dead) +static void SkidooAnimation(ITEM_INFO* skidoo, int collide, int dead) { short cd; SKIDOO_INFO* skinfo; @@ -444,7 +443,7 @@ void SkidooAnimation(ITEM_INFO* skidoo, int collide, int dead) } } -int GetSkidooCollisionAnim(ITEM_INFO* skidoo, PHD_VECTOR* moved) +static int GetSkidooCollisionAnim(ITEM_INFO* skidoo, PHD_VECTOR* moved) { int c, s, front, side; @@ -476,7 +475,7 @@ int GetSkidooCollisionAnim(ITEM_INFO* skidoo, PHD_VECTOR* moved) return 0; } -int SkidooUserControl(ITEM_INFO* skidoo, int height, int* pitch) +static int SkidooUserControl(ITEM_INFO* skidoo, int height, int* pitch) { int drive = 0, max_speed; SKIDOO_INFO* skinfo; @@ -555,7 +554,7 @@ int SkidooUserControl(ITEM_INFO* skidoo, int height, int* pitch) return drive; } -int DoSkidooDynamics(int height, int fallspeed, int* y) +static int DoSkidooDynamics(int height, int fallspeed, int* y) { int kick; @@ -586,7 +585,7 @@ int DoSkidooDynamics(int height, int fallspeed, int* y) } /* Returns 0 if no get on, 1 if right get on and 2 if left get on */ -int SkidooCheckGetOn(short itemNum, COLL_INFO* coll) +static int SkidooCheckGetOn(short itemNum, COLL_INFO* coll) { int geton; short rot, roomNumber; @@ -671,7 +670,7 @@ void SkidooCollision(short itemNum, ITEM_INFO* litem, COLL_INFO* coll) } /* Get height at a position offset from the origin. Moves the vector in 'pos' to the required test position too */ -int TestSkidooHeight(ITEM_INFO* item, int z_off, int x_off, PHD_VECTOR* pos) +static int TestSkidooHeight(ITEM_INFO* item, int z_off, int x_off, PHD_VECTOR* pos) { pos->y = item->pos.yPos - (z_off * phd_sin(item->pos.xRot) >> W2V_SHIFT) + (x_off * phd_sin(item->pos.zRot) >> W2V_SHIFT); @@ -691,7 +690,7 @@ int TestSkidooHeight(ITEM_INFO* item, int z_off, int x_off, PHD_VECTOR* pos) return GetFloorHeight(floor, pos->x, pos->y, pos->z); } -short DoSkidooShift(ITEM_INFO* skidoo, PHD_VECTOR* pos, PHD_VECTOR* old) +static short DoSkidooShift(ITEM_INFO* skidoo, PHD_VECTOR* pos, PHD_VECTOR* old) { int x, z; int x_old, z_old; @@ -808,7 +807,7 @@ short DoSkidooShift(ITEM_INFO* skidoo, PHD_VECTOR* pos, PHD_VECTOR* old) return 0; } -int SkidooDynamics(ITEM_INFO* skidoo) +static int SkidooDynamics(ITEM_INFO* skidoo) { /* Does all skidoo movement and collision and returns if collide value */ SKIDOO_INFO* skinfo; @@ -960,7 +959,7 @@ int SkidooDynamics(ITEM_INFO* skidoo) } /* Returns 1 if this controls Lara too, 0 if skidoo is no longer moving with Lara (so need normal Lara control) */ -int SkidooControl() +int SkidooControl(void) { ITEM_INFO* skidoo; SKIDOO_INFO* skinfo; diff --git a/TR5Main/Objects/TR2/Vehicles/snowmobile.h b/TR5Main/Objects/TR2/Vehicles/snowmobile.h new file mode 100644 index 000000000..e6deaa8ee --- /dev/null +++ b/TR5Main/Objects/TR2/Vehicles/snowmobile.h @@ -0,0 +1,21 @@ +#pragma once +#include "items.h" +#include "collide.h" + +typedef struct SKIDOO_INFO +{ + short track_mesh; + int skidoo_turn; + int left_fallspeed, right_fallspeed; + short momentum_angle, extra_rotation; + int pitch; + bool already_cd_played; + bool armed; + int flash_timer; +}; + +void InitialiseSkidoo(short itemNum); +void SkidooCollision(short itemNum, ITEM_INFO* litem, COLL_INFO* coll); +int SkidooControl(void); +void DrawSkidoo(ITEM_INFO* item); +void DoSnowEffect(ITEM_INFO* skidoo); \ No newline at end of file diff --git a/TR5Main/Objects/TR2/tr2_objects.cpp b/TR5Main/Objects/TR2/tr2_objects.cpp new file mode 100644 index 000000000..9873931e9 --- /dev/null +++ b/TR5Main/Objects/TR2/tr2_objects.cpp @@ -0,0 +1,664 @@ +#include "framework.h" +#include "tr2_objects.h" +/// entities +#include "tr2_barracuda.h" // OK +#include "tr2_birdmonster.h" // OK +#include "tr2_dragon.h" // OK +#include "tr2_eagle_or_crow.h" // OK +#include "tr2_knifethrower.h" // OK +#include "tr2_mercenary.h" // OK +#include "tr2_monk.h" // OK +#include "tr2_rat.h" // OK +#include "tr2_shark.h" // OK +#include "tr2_silencer.h" // OK +#include "tr2_skidman.h" // OK +#include "tr2_spear_guardian.h" // OK +#include "tr2_spider.h" // OK +#include "tr2_sword_guardian.h" // OK +#include "tr2_worker_dualrevolver.h" // OK +#include "tr2_worker_flamethrower.h" // OK +#include "tr2_worker_machinegun.h" // OK +#include "tr2_worker_shotgun.h" // OK +#include "tr2_yeti.h" // OK +/// objects + +/// trap +#include "tr2_spinningblade.h" +#include "tr2_springboard.h" +#include "tr2_killerstatue.h" +/// vehicles +#include "boat.h" +#include "snowmobile.h" +/// necessary import +#include "collide.h" +#include "box.h" +#include "setup.h" +#include "level.h" + +static void StartBaddy(ObjectInfo* obj) +{ + obj = &Objects[ID_SHARK]; + if (obj->loaded) + { + obj->control = SharkControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 30; + obj->pivotLength = 200; + obj->radius = 340; + obj->intelligent = true; + obj->waterCreature = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->zoneType = ZONE_WATER; + + Bones[obj->boneIndex + 9 * 4] |= ROT_Y; + } + + obj = &Objects[ID_BARRACUDA]; + if (obj->loaded) + { + obj->control = BarracudaControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 12; + obj->pivotLength = 200; + obj->radius = 204; + obj->intelligent = true; + obj->waterCreature = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->zoneType = ZONE_WATER; + + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + } + + obj = &Objects[ID_EAGLE]; + if (obj->loaded) + { + obj->initialise = InitialiseEagle; + obj->control = EagleControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 20; + obj->radius = 204; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 0; + obj->zoneType = ZONE_FLYER; + } + + obj = &Objects[ID_CROW]; + if (obj->loaded) + { + obj->initialise = InitialiseEagle; + obj->control = EagleControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 15; + obj->radius = 204; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 0; + obj->zoneType = ZONE_FLYER; + } + + obj = &Objects[ID_RAT]; + if (obj->loaded) + { + obj->control = RatControl; + obj->collision = CreatureCollision; + obj->hitPoints = 5; + obj->shadowSize = 128; + obj->pivotLength = 50; + obj->radius = 204; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_YETI]; + if (obj->loaded) + { + obj->initialise = InitialiseYeti; + obj->collision = CreatureCollision; + obj->control = YetiControl; + obj->hitPoints = 30; + obj->shadowSize = UNIT_SHADOW / 2; + obj->radius = 128; + obj->pivotLength = 100; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + obj->zoneType = ZONE_HUMAN_CLASSIC; + Bones[obj->boneIndex + 6 * 4] |= (ROT_Y); + Bones[obj->boneIndex + 14 * 4] |= (ROT_Y); + } + + obj = &Objects[ID_GOON_SILENCER1]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = SilencerControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 25; + obj->biteOffset = 0; + obj->radius = 102; + obj->pivotLength = 50; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 0] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 1 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_GOON_SILENCER2]; + if (obj->loaded) + { + if (Objects[ID_GOON_SILENCER1].loaded) + { + obj->animIndex = Objects[ID_GOON_SILENCER1].animIndex; + obj->frameBase = Objects[ID_GOON_SILENCER1].frameBase; + } + else + { + MessageBox(NULL, "ID_GOON_SILENCER1 not found !", NULL, MB_OK); + } + + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = SilencerControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 25; + obj->biteOffset = 0; + obj->radius = 102; + obj->pivotLength = 50; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 0] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 1 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_GOON_SILENCER3]; + if (obj->loaded) + { + if (Objects[ID_GOON_SILENCER1].loaded) + { + obj->animIndex = Objects[ID_GOON_SILENCER1].animIndex; + obj->frameBase = Objects[ID_GOON_SILENCER1].frameBase; + } + else + { + MessageBox(NULL, "ID_GOON_SILENCER1 not found !", NULL, MB_OK); + } + + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = SilencerControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 25; + obj->biteOffset = 0; + obj->radius = 102; + obj->pivotLength = 50; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 0] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 1 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_WORKER_SHOTGUN]; + if (obj->loaded) + { + obj->biteOffset = 0; + obj->initialise = InitialiseWorkerShotgun; + obj->collision = CreatureCollision; + obj->control = WorkerShotgunControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 25; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + //Bones[obj->boneIndex + 5*4] |= (ROT_X | ROT_Y); + //Bones[obj->boneIndex + 14*4] |= (ROT_X | ROT_Y); + // TODO: get the correct torso and head bones value and assign ROT_X and ROT_Y to it ! + } + + obj = &Objects[ID_WORKER_MACHINEGUN]; + if (obj->loaded) + { + obj->initialise = InitialiseWorkerMachineGun; + obj->collision = CreatureCollision; + obj->control = WorkerMachineGunControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 20; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + //Bones[obj->boneIndex + 5*4] |= (ROT_X | ROT_Y); + //Bones[obj->boneIndex + 14*4] |= (ROT_X | ROT_Y); + // TODO: get the correct torso and head bones value and assign ROT_X and ROT_Y to it ! + } + + obj = &Objects[ID_SMALL_SPIDER]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = SmallSpiderControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 5; + obj->pivotLength = 0; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + } + + obj = &Objects[ID_BIG_SPIDER]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = BigSpiderControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 40; + obj->pivotLength = 0; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + } + + obj = &Objects[ID_WORKER_DUAL_REVOLVER]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = WorkerDualGunControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 150; + obj->pivotLength = 0; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 11 * 4] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 0 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_BIRDMONSTER]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = BirdMonsterControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 200; + obj->pivotLength = 0; + obj->radius = 341; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 14 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_WORKER_FLAMETHROWER]; + if (obj->loaded) + { + obj->initialise = InitialiseWorkerFlamethrower; + obj->collision = CreatureCollision; + obj->control = WorkerFlamethrower; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 20; + obj->pivotLength = 0; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 4 * 4] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 14 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_KNIFETHROWER]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = KnifethrowerControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 60; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + //Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y); + //Bones[obj->boneIndex + 0 * 4] |= (ROT_X | ROT_Y); + // TODO: find the correct for bones (knifethrower). + } + + obj = &Objects[ID_KNIFETHROWER_KNIFE]; + if (obj->loaded) + obj->control = KnifeControl; + + obj = &Objects[ID_MERCENARY_UZI]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = MercenaryUziControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 45; + obj->pivotLength = 0; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_MERCENARY_AUTOPISTOLS1]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = MercenaryAutoPistolControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 50; + obj->pivotLength = 0; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_MERCENARY_AUTOPISTOLS2]; + if (obj->loaded) + { + if (Objects[ID_MERCENARY_AUTOPISTOLS1].loaded) + { + obj->animIndex = Objects[ID_MERCENARY_AUTOPISTOLS1].animIndex; + obj->frameBase = Objects[ID_MERCENARY_AUTOPISTOLS1].frameBase; + } + else + { + MessageBox(NULL, "ID_MERCENARY_AUTOPISTOLS1 not found !", NULL, MB_OK); + } + + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = MercenaryAutoPistolControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 50; + obj->pivotLength = 0; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_MONK1]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = MonkControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 50; + obj->pivotLength = 0; + obj->radius = 204; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_MONK2]; + if (obj->loaded) + { + obj->initialise = InitialiseCreature; + obj->collision = CreatureCollision; + obj->control = MonkControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 50; + obj->pivotLength = 0; + obj->radius = 204; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_SWORD_GUARDIAN]; + if (obj->loaded) + { + obj->initialise = InitialiseSwordGuardian; + obj->collision = CreatureCollision; + obj->control = SwordGuardianControl; + //obj->drawRoutine = DrawStatue; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 80; + obj->pivotLength = 0; + obj->radius = 204; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 16 * 4] |= (ROT_X | ROT_Y); + // TODO: bones value is not correct (shiva) ! + // need the correct one. + } + + obj = &Objects[ID_SPEAR_GUARDIAN]; + if (obj->loaded) + { + obj->initialise = InitialiseSpearGuardian; + obj->collision = CreatureCollision; + obj->control = SpearGuardianControl; + //obj->drawRoutine = DrawStatue; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 100; + obj->pivotLength = 0; + obj->radius = 204; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + //Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); + //Bones[obj->boneIndex + 12 * 4] |= (ROT_X | ROT_Y); + // TODO: get the correct id for bones ! (spear) + } + + obj = &Objects[ID_DRAGON_FRONT]; + if (obj->loaded) + { + if (!Objects[ID_DRAGON_BACK].loaded) + printf("FATAL: ID_DRAGON_BACK need ID_DRAGON_BACK !"); + + obj->collision = DragonCollision; + obj->control = DragonControl; + obj->hitPoints = 300; + obj->pivotLength = 300; + obj->radius = 256; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 10 * 4] |= ROT_Z; + } + + obj = &Objects[ID_DRAGON_BACK]; + if (obj->loaded) + { + if (!Objects[ID_MARCO_BARTOLI].loaded) + printf("FATAL: ID_DRAGON_BACK need ID_MARCO_BARTOLI !"); + + obj->collision = DragonCollision; + obj->control = DragonControl; + obj->radius = 256; + obj->saveAnim = true; + obj->saveFlags = true; + obj->savePosition = true; + } + + obj = &Objects[ID_MARCO_BARTOLI]; + if (obj->loaded) + { + obj->initialise = InitialiseBartoli; + obj->control = BartoliControl; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_SNOWMOBILE_GUN]; + if (obj->loaded) + { + obj->collision = SkidManCollision; + //obj->drawRoutine = DrawSkidoo; // TODO: recreate renderer for skidoo + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 100; + obj->pivotLength = 0; + obj->radius = 256; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + } + + obj = &Objects[ID_SNOWMOBILE_DRIVER]; + if (obj->loaded) + { + obj->initialise = InitialiseSkidman; + obj->control = SkidManControl; + obj->hitPoints = 1; + obj->saveAnim = true; + obj->saveFlags = true; + obj->savePosition = true; + } +} + +static void StartObject(ObjectInfo* obj) +{ + +} + +static void StartTrap(ObjectInfo* obj) +{ + obj = &Objects[ID_ROLLING_SPINDLE]; + if (obj->loaded) + { + obj->initialise = InitialiseSpinningBlade; + obj->control = SpinningBladeControl; + obj->collision = ObjectCollision; + obj->savePosition = true; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_SPRINGBOARD]; + if (obj->loaded) + { + obj->control = SpringBoardControl; + obj->saveAnim = true; + obj->saveFlags = true; + } +} + +// boat, snowmobile, snowmobile gun +static void StartVehicles(ObjectInfo* obj) +{ + // TODO: fix BoatControl() not using int BoatControl(void) + obj = &Objects[ID_SPEEDBOAT]; + if (obj->loaded) + { + obj->initialise = InitialiseBoat; + obj->collision = BoatCollision; + obj->control = BoatControl; + obj->saveAnim = true; + obj->saveFlags = true; + obj->savePosition = true; + } + + obj = &Objects[ID_SNOWMOBILE]; + if (obj->loaded) + { + obj->initialise = InitialiseSkidoo; + obj->collision = SkidooCollision; + //obj->drawRoutine = DrawSkidoo; // TODO: create a new render for the skidoo. (with track animated) + obj->saveAnim = true; + obj->saveFlags = true; + obj->savePosition = true; + } +} + +static ObjectInfo* objToInit; +void InitialiseTR2Objects() +{ + StartBaddy(objToInit); + StartObject(objToInit); + StartTrap(objToInit); + StartVehicles(objToInit); +} diff --git a/TR5Main/Objects/TR2/tr2_objects.h b/TR5Main/Objects/TR2/tr2_objects.h new file mode 100644 index 000000000..c994197ff --- /dev/null +++ b/TR5Main/Objects/TR2/tr2_objects.h @@ -0,0 +1,3 @@ +#pragma once + +void InitialiseTR2Objects(); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_civvy.cpp b/TR5Main/Objects/TR3/Entity/tr3_civvy.cpp similarity index 98% rename from TR5Main/Objects/TR3/tr3_civvy.cpp rename to TR5Main/Objects/TR3/Entity/tr3_civvy.cpp index 77fd93f9d..084c398ed 100644 --- a/TR5Main/Objects/TR3/tr3_civvy.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_civvy.cpp @@ -1,11 +1,13 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/people.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr3_civvy.h" +#include "box.h" +#include "effect2.h" +#include "effect.h" +#include "people.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO civvy_hit = { 0,0,0, 13 }; diff --git a/TR5Main/Objects/TR3/Entity/tr3_civvy.h b/TR5Main/Objects/TR3/Entity/tr3_civvy.h new file mode 100644 index 000000000..cc106224a --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_civvy.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseCivvy(short item_number); +void CivvyControl(short item_number); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_cobra.cpp b/TR5Main/Objects/TR3/Entity/tr3_cobra.cpp similarity index 91% rename from TR5Main/Objects/TR3/tr3_cobra.cpp rename to TR5Main/Objects/TR3/Entity/tr3_cobra.cpp index c9a495a51..1aa9bca93 100644 --- a/TR5Main/Objects/TR3/tr3_cobra.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_cobra.cpp @@ -1,10 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/items.h" -#include "../../Game/lara.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr3_cobra.h" +#include "box.h" +#include "effect.h" +#include "items.h" +#include "lara.h" +#include "setup.h" +#include "level.h" BITE_INFO cobraBite = { 0, 0, 0, 13 }; diff --git a/TR5Main/Objects/TR3/Entity/tr3_cobra.h b/TR5Main/Objects/TR3/Entity/tr3_cobra.h new file mode 100644 index 000000000..1e840e472 --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_cobra.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseCobra(short itemNum); +void CobraControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_fishemitter.cpp b/TR5Main/Objects/TR3/Entity/tr3_fishemitter.cpp similarity index 97% rename from TR5Main/Objects/TR3/tr3_fishemitter.cpp rename to TR5Main/Objects/TR3/Entity/tr3_fishemitter.cpp index 71301b181..df3be0716 100644 --- a/TR5Main/Objects/TR3/tr3_fishemitter.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_fishemitter.cpp @@ -1,23 +1,30 @@ -#include "../newobjects.h" -#include "../../Game/effects.h" -#include "../../Game/draw.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr3_fishemitter.h" +#include "effect.h" +#include "draw.h" +#include "level.h" +#include "lara.h" +#include "fish.h" -#define PIRAHNA_DAMAGE 4 -#define X 0 -#define Y 1 -#define Z 2 +#define PIRAHNA_DAMAGE 4 +#define X 0 +#define Y 1 +#define Z 2 #define XYZ 3 #define MAX_FISH 8 -#define OCB_FISH_LETAL 0x1000 -#define OCB_FISH_EAT_CARCASS 0x2000 +#define OCB_FISH_LETAL 0x1000 +#define OCB_FISH_EAT_CARCASS 0x2000 FISH_LEADER_INFO LeaderInfo[MAX_FISH]; FISH_INFO Fishes[MAX_FISH + (MAX_FISH * 24)]; -byte FishRanges[1][3] = { - { 2 << 2, 5 << 2, 3 } +unsigned char FishRanges[1][3] = +{ + { + 8, + 20, + 3 + } }; int PirahnaHitWait = false; @@ -137,7 +144,6 @@ void SetupFish(int leader, ITEM_INFO* item) Fishes[MAX_FISH + (leader * 24) + i].y = (GetRandomControl() % fishYRange); Fishes[MAX_FISH + (leader * 24) + i].destY = (GetRandomControl() % fishYRange); Fishes[MAX_FISH + (leader * 24) + i].z = (GetRandomControl() % (fishZRange << 1)) - fishZRange; - Fishes[MAX_FISH + (leader * 24) + i].angle = GetRandomControl() & 4095; Fishes[MAX_FISH + (leader * 24) + i].speed = (GetRandomControl() & 31) + 32; Fishes[MAX_FISH + (leader * 24) + i].swim = GetRandomControl() & 63; @@ -183,7 +189,7 @@ void ControlFish(short itemNumber) if (PirahnaHitWait) PirahnaHitWait--; - FISH_INFO* fish = (FISH_INFO*)&Fishes[leader]; + FISH_INFO* fish = &Fishes[leader]; if (pirahnaAttack) { diff --git a/TR5Main/Objects/TR3/Entity/tr3_fishemitter.h b/TR5Main/Objects/TR3/Entity/tr3_fishemitter.h new file mode 100644 index 000000000..44371ea62 --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_fishemitter.h @@ -0,0 +1,6 @@ +#pragma once +#include "items.h" + +void SetupShoal(int shoalNumber); +void ControlFish(short itemNumber); +bool FishNearLara(PHD_3DPOS* pos, int distance, ITEM_INFO* item); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_flamethrower.cpp b/TR5Main/Objects/TR3/Entity/tr3_flamethrower.cpp similarity index 94% rename from TR5Main/Objects/TR3/tr3_flamethrower.cpp rename to TR5Main/Objects/TR3/Entity/tr3_flamethrower.cpp index aaacab8ed..f232f7a6f 100644 --- a/TR5Main/Objects/TR3/tr3_flamethrower.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_flamethrower.cpp @@ -1,19 +1,215 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/people.h" -#include "../../Game/items.h" -#include "../../Game/draw.h" -#include "../../specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" -#include "../../Game/effects.h" +#include "framework.h" +#include "tr3_flamethrower.h" +#include "box.h" +#include "sphere.h" +#include "effect2.h" +#include "people.h" +#include "items.h" +#include "draw.h" +#include "setup.h" +#include "lot.h" +#include "level.h" +#include "lara.h" +#include "sound.h" +#include "effect.h" BITE_INFO flamerBite = { 0, 340, 64, 7 }; +static void TriggerPilotFlame(int itemnum) +{ + int dx = LaraItem->pos.xPos - Items[itemnum].pos.xPos; + int dz = LaraItem->pos.zPos - Items[itemnum].pos.zPos; + + if (dx < -16384 || dx > 16384 || dz < -16384 || dz > 16384) + return; + + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = 48 + (GetRandomControl() & 31); + spark->sG = spark->sR; + spark->sB = 192 + (GetRandomControl() & 63); + + spark->dR = 192 + (GetRandomControl() & 63); + spark->dG = 128 + (GetRandomControl() & 63); + spark->dB = 32; + + spark->colFadeSpeed = 12 + (GetRandomControl() & 3); + spark->fadeToBlack = 4; + spark->sLife = spark->life = (GetRandomControl() & 3) + 20; + spark->transType = COLADD; + spark->extras = 0; + spark->dynamic = -1; + spark->x = (GetRandomControl() & 31) - 16; + spark->y = (GetRandomControl() & 31) - 16; + spark->z = (GetRandomControl() & 31) - 16; + + spark->xVel = (GetRandomControl() & 31) - 16; + spark->yVel = -(GetRandomControl() & 3); + spark->zVel = (GetRandomControl() & 31) - 16; + + spark->flags = SP_SCALE | SP_DEF | SP_EXPDEF | SP_ITEM | SP_NODEATTACH; + spark->fxObj = itemnum; + spark->nodeNumber = 0; + spark->friction = 4; + spark->gravity = -(GetRandomControl() & 3) - 2; + spark->maxYvel = -(GetRandomControl() & 3) - 4; + //spark->def = Objects[EXPLOSION1].mesh_index; + spark->scalar = 0; + int size = (GetRandomControl() & 7) + 32; + spark->size = size >> 1; + spark->dSize = size; +} + +static void TriggerFlamethrowerFlame(int x, int y, int z, int xv, int yv, int zv, int fxnum) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = true; + spark->sR = 48 + (GetRandomControl() & 31); + spark->sG = spark->sR; + spark->sB = 192 + (GetRandomControl() & 63); + + spark->dR = 192 + (GetRandomControl() & 63); + spark->dG = 128 + (GetRandomControl() & 63); + spark->dB = 32; + + if (xv || yv || zv) + { + spark->colFadeSpeed = 6; + spark->fadeToBlack = 2; + spark->sLife = spark->life = (GetRandomControl() & 1) + 12; + } + else + { + spark->colFadeSpeed = 8; + spark->fadeToBlack = 16; + spark->sLife = spark->life = (GetRandomControl() & 3) + 20; + } + + spark->transType = COLADD; + + spark->extras = 0; + spark->dynamic = -1; + + spark->x = x + ((GetRandomControl() & 31) - 16); + spark->y = y; + spark->z = z + ((GetRandomControl() & 31) - 16); + + spark->xVel = ((GetRandomControl() & 15) - 16) + xv; + spark->yVel = yv; + spark->zVel = ((GetRandomControl() & 15) - 16) + zv; + spark->friction = 0; + + if (GetRandomControl() & 1) + { + if (fxnum >= 0) + spark->flags = SP_SCALE | SP_DEF | SP_ROTATE | SP_EXPDEF | SP_FX; + else + spark->flags = SP_SCALE | SP_DEF | SP_ROTATE | SP_EXPDEF; + spark->rotAng = GetRandomControl() & 4095; + if (GetRandomControl() & 1) + spark->rotAdd = -(GetRandomControl() & 15) - 16; + else + spark->rotAdd = (GetRandomControl() & 15) + 16; + } + else + { + if (fxnum >= 0) + spark->flags = SP_SCALE | SP_DEF | SP_EXPDEF | SP_FX; + else + spark->flags = SP_SCALE | SP_DEF | SP_EXPDEF; + } + + spark->fxObj = fxnum; + spark->gravity = 0; + spark->maxYvel = 0; + //spark->def = Objects[EXPLOSION1].mesh_index; + int size = (GetRandomControl() & 31) + 64; + + if (xv || yv || zv) + { + spark->size = size >> 5; + if (fxnum == -2) + spark->scalar = 2; + else + spark->scalar = 3; + } + else + { + spark->size = size >> 4; + spark->scalar = 4; + } + + spark->dSize = size >> 1; +} + +static short TriggerFlameThrower(ITEM_INFO* item, BITE_INFO* bite, short speed) +{ + PHD_VECTOR pos1; + PHD_VECTOR pos2; + short angles[2]; + int velocity; + int xv; + int yv; + int zv; + + short effectNumber = CreateNewEffect(item->roomNumber); + if (effectNumber != NO_ITEM) + { + FX_INFO* fx = &Effects[effectNumber]; + + pos1.x = bite->x; + pos1.y = bite->y; + pos1.z = bite->z; + GetJointAbsPosition(item, &pos1, bite->meshNum); + + pos2.x = bite->x; + pos2.y = bite->y / 2; + pos2.z = bite->z; + GetJointAbsPosition(item, &pos2, bite->meshNum); + + phd_GetVectorAngles(pos2.x - pos1.x, pos2.y - pos1.y, pos2.z - pos1.z, angles); + + fx->pos.xPos = pos1.x; + fx->pos.yPos = pos1.y; + fx->pos.zPos = pos1.z; + + fx->roomNumber = item->roomNumber; + + fx->pos.xRot = angles[1]; + fx->pos.zRot = 0; + fx->pos.yRot = angles[0]; + fx->speed = speed << 2; + //fx->objectNumber = DRAGON_FIRE; + fx->counter = 20; + fx->flag1 = 0; // Set to orange flame. + + TriggerFlamethrowerFlame(0, 0, 0, 0, 0, 0, effectNumber); + + for (int i = 0; i < 2; i++) + { + speed = (GetRandomControl() % (speed << 2)) + 32; + velocity = (speed * phd_cos(fx->pos.xRot)) >> W2V_SHIFT; + + xv = (velocity * phd_sin(fx->pos.yRot)) >> W2V_SHIFT; + yv = -((speed * phd_sin(fx->pos.xRot)) >> W2V_SHIFT); + zv = (velocity * phd_cos(fx->pos.yRot)) >> W2V_SHIFT; + + TriggerFlamethrowerFlame(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos, xv << 5, yv << 5, zv << 5, -1); + } + + velocity = ((speed << 1) * phd_cos(fx->pos.xRot)) >> W2V_SHIFT; + zv = (velocity * phd_cos(fx->pos.yRot)) >> W2V_SHIFT; + xv = (velocity * phd_sin(fx->pos.yRot)) >> W2V_SHIFT; + yv = -(((speed << 1) * phd_sin(fx->pos.xRot)) >> W2V_SHIFT); + + TriggerFlamethrowerFlame(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos, xv << 5, yv << 5, zv << 5, -2); + } + + return effectNumber; +} + void FlameThrowerControl(short itemNumber) { if (!CreatureActive(itemNumber)) @@ -322,199 +518,4 @@ void FlameThrowerControl(short itemNumber) CreatureJoint(item, 2, head); CreatureAnimation(itemNumber, angle, 0); -} - -short TriggerFlameThrower(ITEM_INFO* item, BITE_INFO* bite, short speed) -{ - PHD_VECTOR pos1; - PHD_VECTOR pos2; - short angles[2]; - int velocity; - int xv; - int yv; - int zv; - - short effectNumber = CreateNewEffect(item->roomNumber); - if (effectNumber != NO_ITEM) - { - FX_INFO* fx = &Effects[effectNumber]; - - pos1.x = bite->x; - pos1.y = bite->y; - pos1.z = bite->z; - GetJointAbsPosition(item, &pos1, bite->meshNum); - - pos2.x = bite->x; - pos2.y = bite->y / 2; - pos2.z = bite->z; - GetJointAbsPosition(item, &pos2, bite->meshNum); - - phd_GetVectorAngles(pos2.x - pos1.x, pos2.y - pos1.y, pos2.z - pos1.z, angles); - - fx->pos.xPos = pos1.x; - fx->pos.yPos = pos1.y; - fx->pos.zPos = pos1.z; - - fx->roomNumber = item->roomNumber; - - fx->pos.xRot = angles[1]; - fx->pos.zRot = 0; - fx->pos.yRot = angles[0]; - fx->speed = speed << 2; - //fx->objectNumber = DRAGON_FIRE; - fx->counter = 20; - fx->flag1 = 0; // Set to orange flame. - - TriggerFlamethrowerFlame(0, 0, 0, 0, 0, 0, effectNumber); - - for (int i = 0; i < 2; i++) - { - speed = (GetRandomControl() % (speed << 2)) + 32; - velocity = (speed * phd_cos(fx->pos.xRot)) >> W2V_SHIFT; - - xv = (velocity * phd_sin(fx->pos.yRot)) >> W2V_SHIFT; - yv = -((speed * phd_sin(fx->pos.xRot)) >> W2V_SHIFT); - zv = (velocity * phd_cos(fx->pos.yRot)) >> W2V_SHIFT; - - TriggerFlamethrowerFlame(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos, xv << 5, yv << 5, zv << 5, -1); - } - - velocity = ((speed << 1) * phd_cos(fx->pos.xRot)) >> W2V_SHIFT; - zv = (velocity * phd_cos(fx->pos.yRot)) >> W2V_SHIFT; - xv = (velocity * phd_sin(fx->pos.yRot)) >> W2V_SHIFT; - yv = -(((speed << 1) * phd_sin(fx->pos.xRot)) >> W2V_SHIFT); - - TriggerFlamethrowerFlame(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos, xv << 5, yv << 5, zv << 5, -2); - } - - return effectNumber; -} - -void TriggerFlamethrowerFlame(int x, int y, int z, int xv, int yv, int zv, int fxnum) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = true; - spark->sR = 48 + (GetRandomControl() & 31); - spark->sG = spark->sR; - spark->sB = 192 + (GetRandomControl() & 63); - - spark->dR = 192 + (GetRandomControl() & 63); - spark->dG = 128 + (GetRandomControl() & 63); - spark->dB = 32; - - if (xv || yv || zv) - { - spark->colFadeSpeed = 6; - spark->fadeToBlack = 2; - spark->sLife = spark->life = (GetRandomControl() & 1) + 12; - } - else - { - spark->colFadeSpeed = 8; - spark->fadeToBlack = 16; - spark->sLife = spark->life = (GetRandomControl() & 3) + 20; - } - - spark->transType = 2; - - spark->extras = 0; - spark->dynamic = -1; - - spark->x = x + ((GetRandomControl() & 31) - 16); - spark->y = y; - spark->z = z + ((GetRandomControl() & 31) - 16); - - spark->xVel = ((GetRandomControl() & 15) - 16) + xv; - spark->yVel = yv; - spark->zVel = ((GetRandomControl() & 15) - 16) + zv; - spark->friction = 0; - - if (GetRandomControl() & 1) - { - if (fxnum >= 0) - spark->flags = SP_SCALE | SP_DEF | SP_ROTATE | SP_EXPDEF | SP_FX; - else - spark->flags = SP_SCALE | SP_DEF | SP_ROTATE | SP_EXPDEF; - spark->rotAng = GetRandomControl() & 4095; - if (GetRandomControl() & 1) - spark->rotAdd = -(GetRandomControl() & 15) - 16; - else - spark->rotAdd = (GetRandomControl() & 15) + 16; - } - else - { - if (fxnum >= 0) - spark->flags = SP_SCALE | SP_DEF | SP_EXPDEF | SP_FX; - else - spark->flags = SP_SCALE | SP_DEF | SP_EXPDEF; - } - - spark->fxObj = fxnum; - spark->gravity = 0; - spark->maxYvel = 0; - //spark->def = Objects[EXPLOSION1].mesh_index; - int size = (GetRandomControl() & 31) + 64; - - if (xv || yv || zv) - { - spark->size = size >> 5; - if (fxnum == -2) - spark->scalar = 2; - else - spark->scalar = 3; - } - else - { - spark->size = size >> 4; - spark->scalar = 4; - } - - spark->dSize = size >> 1; -} - -void TriggerPilotFlame(int itemnum) -{ - int dx = LaraItem->pos.xPos - Items[itemnum].pos.xPos; - int dz = LaraItem->pos.zPos - Items[itemnum].pos.zPos; - - if (dx < -16384 || dx > 16384 || dz < -16384 || dz > 16384) - return; - - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = 48 + (GetRandomControl() & 31); - spark->sG = spark->sR; - spark->sB = 192 + (GetRandomControl() & 63); - - spark->dR = 192 + (GetRandomControl() & 63); - spark->dG = 128 + (GetRandomControl() & 63); - spark->dB = 32; - - spark->colFadeSpeed = 12 + (GetRandomControl() & 3); - spark->fadeToBlack = 4; - spark->sLife = spark->life = (GetRandomControl() & 3) + 20; - spark->transType = 2; - spark->extras = 0; - spark->dynamic = -1; - spark->x = (GetRandomControl() & 31) - 16; - spark->y = (GetRandomControl() & 31) - 16; - spark->z = (GetRandomControl() & 31) - 16; - - spark->xVel = (GetRandomControl() & 31) - 16; - spark->yVel = -(GetRandomControl() & 3); - spark->zVel = (GetRandomControl() & 31) - 16; - - spark->flags = SP_SCALE | SP_DEF | SP_EXPDEF | SP_ITEM | SP_NODEATTACH; - spark->fxObj = itemnum; - spark->nodeNumber = 0; - spark->friction = 4; - spark->gravity = -(GetRandomControl() & 3) - 2; - spark->maxYvel = -(GetRandomControl() & 3) - 4; - //spark->def = Objects[EXPLOSION1].mesh_index; - spark->scalar = 0; - int size = (GetRandomControl() & 7) + 32; - spark->size = size >> 1; - spark->dSize = size; } \ No newline at end of file diff --git a/TR5Main/Objects/TR3/Entity/tr3_flamethrower.h b/TR5Main/Objects/TR3/Entity/tr3_flamethrower.h new file mode 100644 index 000000000..ad22a9924 --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_flamethrower.h @@ -0,0 +1,3 @@ +#pragma once + +void FlameThrowerControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_monkey.cpp b/TR5Main/Objects/TR3/Entity/tr3_monkey.cpp similarity index 98% rename from TR5Main/Objects/TR3/tr3_monkey.cpp rename to TR5Main/Objects/TR3/Entity/tr3_monkey.cpp index 14e44a20f..f7b4c30a8 100644 --- a/TR5Main/Objects/TR3/tr3_monkey.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_monkey.cpp @@ -1,16 +1,15 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/lara.h" -#include "../../Game/effects.h" -#include "../../Game/items.h" -#include "../../specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr3_monkey.h" +#include "box.h" +#include "lara.h" +#include "effect.h" +#include "items.h" +#include "setup.h" +#include "lot.h" +#include "level.h" BITE_INFO monkeyBite = { 10, 10, 11, 13 }; - - void InitialiseMonkey(short itemNumber) { ITEM_INFO* item = &Items[itemNumber]; diff --git a/TR5Main/Objects/TR3/Entity/tr3_monkey.h b/TR5Main/Objects/TR3/Entity/tr3_monkey.h new file mode 100644 index 000000000..477838005 --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_monkey.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseMonkey(short itemNumber); +void MonkeyControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_mpgun.cpp b/TR5Main/Objects/TR3/Entity/tr3_mpgun.cpp similarity index 96% rename from TR5Main/Objects/TR3/tr3_mpgun.cpp rename to TR5Main/Objects/TR3/Entity/tr3_mpgun.cpp index bcfe255ec..1f532f13a 100644 --- a/TR5Main/Objects/TR3/tr3_mpgun.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_mpgun.cpp @@ -1,16 +1,18 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/effects.h" -#include "../../Game/people.h" -#include "../../specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr3_mpgun.h" +#include "box.h" +#include "sphere.h" +#include "effect2.h" +#include "effect.h" +#include "people.h" +#include "setup.h" +#include "lot.h" +#include "level.h" +#include "lara.h" +#include "sound.h" -enum MPGUN_STATES { +enum MPGUN_STATES +{ MPGUN_EMPTY, MPGUN_WAIT, MPGUN_WALK, @@ -445,6 +447,5 @@ void MPGunControl(short itemNumber) CreatureJoint(item, 0, torsoY); CreatureJoint(item, 1, torsoX); CreatureJoint(item, 2, head); - CreatureAnimation(itemNumber, angle, tilt); } \ No newline at end of file diff --git a/TR5Main/Objects/TR3/Entity/tr3_mpgun.h b/TR5Main/Objects/TR3/Entity/tr3_mpgun.h new file mode 100644 index 000000000..1bc0f16fe --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_mpgun.h @@ -0,0 +1,3 @@ +#pragma once + +void MPGunControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_mpstick.cpp b/TR5Main/Objects/TR3/Entity/tr3_mpstick.cpp similarity index 97% rename from TR5Main/Objects/TR3/tr3_mpstick.cpp rename to TR5Main/Objects/TR3/Entity/tr3_mpstick.cpp index f36736c44..40990fb99 100644 --- a/TR5Main/Objects/TR3/tr3_mpstick.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_mpstick.cpp @@ -1,13 +1,14 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/people.h" -#include "../../Game/items.h" -#include "../../specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr3_mpstick.h" +#include "box.h" +#include "effect.h" +#include "people.h" +#include "items.h" +#include "setup.h" +#include "lot.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO mpstickBite1 = { 247, 10, 11, 13 }; BITE_INFO mpstickBite2 = { 0, 0, 100, 6 }; diff --git a/TR5Main/Objects/TR3/Entity/tr3_mpstick.h b/TR5Main/Objects/TR3/Entity/tr3_mpstick.h new file mode 100644 index 000000000..f778b4ffc --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_mpstick.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseMPStick(short itemNumber); +void MPStickControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_raptor.cpp b/TR5Main/Objects/TR3/Entity/tr3_raptor.cpp similarity index 95% rename from TR5Main/Objects/TR3/tr3_raptor.cpp rename to TR5Main/Objects/TR3/Entity/tr3_raptor.cpp index 1dd15c027..12e1b91d4 100644 --- a/TR5Main/Objects/TR3/tr3_raptor.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_raptor.cpp @@ -1,14 +1,15 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr3_raptor.h" +#include "box.h" +#include "effect.h" +#include "setup.h" +#include "lot.h" +#include "level.h" +#include "lara.h" -extern BITE_INFO raptorBite; +static BITE_INFO raptorBite = { 0, 66, 318, 22 }; -void Tr3RaptorControl(short itemNum) +void RaptorControl(short itemNum) { if (!CreatureActive(itemNum)) return; @@ -20,7 +21,7 @@ void Tr3RaptorControl(short itemNum) short neck = 0; short angle = 0; short tilt = 0; - int minDistance = 0x7FFFFFFF; + INT minDistance = MAXINT; if (item->hitPoints <= 0) { diff --git a/TR5Main/Objects/TR3/Entity/tr3_raptor.h b/TR5Main/Objects/TR3/Entity/tr3_raptor.h new file mode 100644 index 000000000..061a45c8a --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_raptor.h @@ -0,0 +1,3 @@ +#pragma once + +void RaptorControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_scuba.cpp b/TR5Main/Objects/TR3/Entity/tr3_scuba.cpp similarity index 93% rename from TR5Main/Objects/TR3/tr3_scuba.cpp rename to TR5Main/Objects/TR3/Entity/tr3_scuba.cpp index aca3981fa..3594a4764 100644 --- a/TR5Main/Objects/TR3/tr3_scuba.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_scuba.cpp @@ -1,14 +1,15 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/effects.h" -#include "../../Game/Box.h" -#include "../../Game/lara.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr3_scuba.h" +#include "items.h" +#include "effect.h" +#include "box.h" +#include "lara.h" +#include "setup.h" +#include "level.h" BITE_INFO scubaGun = { 17, 164, 44, 18 }; -void ShootHarpoon(ITEM_INFO* frogman, int x, int y, int z, short speed, short yRot, short roomNumber) +static void ShootHarpoon(ITEM_INFO* frogman, int x, int y, int z, short speed, short yRot, short roomNumber) { short harpoonItemNum = CreateItem(); if (harpoonItemNum != NO_ITEM) @@ -35,7 +36,7 @@ void ShootHarpoon(ITEM_INFO* frogman, int x, int y, int z, short speed, short yR } } -void HarpoonControl(short itemNum) +void ScubaHarpoonControl(short itemNum) { ITEM_INFO* item = &Items[itemNum]; diff --git a/TR5Main/Objects/TR3/Entity/tr3_scuba.h b/TR5Main/Objects/TR3/Entity/tr3_scuba.h new file mode 100644 index 000000000..041ba164e --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_scuba.h @@ -0,0 +1,4 @@ +#pragma once + +void ScubaHarpoonControl(short itemNum); +void ScubaControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_shiva.cpp b/TR5Main/Objects/TR3/Entity/tr3_shiva.cpp similarity index 94% rename from TR5Main/Objects/TR3/tr3_shiva.cpp rename to TR5Main/Objects/TR3/Entity/tr3_shiva.cpp index 433123187..b2fd2354f 100644 --- a/TR5Main/Objects/TR3/tr3_shiva.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_shiva.cpp @@ -1,18 +1,19 @@ -#include "../newobjects.h" -#include "../../Game/effect2.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/sphere.h" -#include "../../Game/items.h" -#include "../../specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr3_shiva.h" +#include "effect2.h" +#include "box.h" +#include "effect.h" +#include "sphere.h" +#include "items.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO shivaLeftBite = { 0, 0, 920, 13 }; BITE_INFO shivaRightBite = { 0, 0, 920, 22 }; -void TriggerShivaSmoke(long x, long y, long z, long uw) +static void TriggerShivaSmoke(long x, long y, long z, long uw) { long size; SPARKS* sptr; @@ -51,9 +52,9 @@ void TriggerShivaSmoke(long x, long y, long z, long uw) sptr->sLife = sptr->life = (GetRandomControl() & 31) + 96; if (uw) - sptr->transType = 2; + sptr->transType = COLADD; else - sptr->transType = 2; + sptr->transType = COLADD; sptr->extras = 0; sptr->dynamic = -1; @@ -101,7 +102,7 @@ void TriggerShivaSmoke(long x, long y, long z, long uw) sptr->dSize = size; } -void ShivaDamage(ITEM_INFO* item, CREATURE_INFO* shiva, int damage) +static void ShivaDamage(ITEM_INFO* item, CREATURE_INFO* shiva, int damage) { if (!(shiva->flags) && (item->touchBits & 0x2400000)) { @@ -136,7 +137,7 @@ void InitialiseShiva(short itemNum) item->frameNumber = anim->frameBase; item->currentAnimState = anim->currentAnimState; - //item->status = ITEM_INACTIVE; + //item->status = ITEM_NOT_ACTIVE; //item->meshBits = 0; } diff --git a/TR5Main/Objects/TR3/Entity/tr3_shiva.h b/TR5Main/Objects/TR3/Entity/tr3_shiva.h new file mode 100644 index 000000000..33f28e0f1 --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_shiva.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseShiva(short itemNum); +void ShivaControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_sophia.cpp b/TR5Main/Objects/TR3/Entity/tr3_sophia.cpp similarity index 85% rename from TR5Main/Objects/TR3/tr3_sophia.cpp rename to TR5Main/Objects/TR3/Entity/tr3_sophia.cpp index 14f70516b..cc2ee3d86 100644 --- a/TR5Main/Objects/TR3/tr3_sophia.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_sophia.cpp @@ -1,17 +1,19 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/effect2.h" -#include "../../Game/lot.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/people.h" -#include "../../Game/draw.h" -#include "../../Game/effects.h" -#include "../../Game/misc.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr3_sophia.h" +#include "items.h" +#include "effect2.h" +#include "lot.h" +#include "boss.h" +#include "box.h" +#include "sphere.h" +#include "people.h" +#include "draw.h" +#include "effect.h" +#include "misc.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" static BOSS_STRUCT BossData; diff --git a/TR5Main/Objects/TR3/Entity/tr3_sophia.h b/TR5Main/Objects/TR3/Entity/tr3_sophia.h new file mode 100644 index 000000000..5cbfc7617 --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_sophia.h @@ -0,0 +1,8 @@ +#pragma once +#include "items.h" + +void ControlLaserBolts(short item_number); +void ControlLondBossPlasmaBall(short fx_number); +void InitialiseLondonBoss(short item_number); +void LondonBossControl(short item_number); +void S_DrawLondonBoss(ITEM_INFO* item); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_tiger.cpp b/TR5Main/Objects/TR3/Entity/tr3_tiger.cpp similarity index 94% rename from TR5Main/Objects/TR3/tr3_tiger.cpp rename to TR5Main/Objects/TR3/Entity/tr3_tiger.cpp index f0f248048..7aed14b74 100644 --- a/TR5Main/Objects/TR3/tr3_tiger.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_tiger.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr3_tiger.h" +#include "box.h" +#include "effect.h" +#include "setup.h" +#include "level.h" +#include "lara.h" BITE_INFO tigerBite = { 19, -13, 3, 26 }; diff --git a/TR5Main/Objects/TR3/Entity/tr3_tiger.h b/TR5Main/Objects/TR3/Entity/tr3_tiger.h new file mode 100644 index 000000000..0264ee0b8 --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_tiger.h @@ -0,0 +1,3 @@ +#pragma once + +void TigerControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_tony.cpp b/TR5Main/Objects/TR3/Entity/tr3_tony.cpp similarity index 95% rename from TR5Main/Objects/TR3/tr3_tony.cpp rename to TR5Main/Objects/TR3/Entity/tr3_tony.cpp index 0cf4ee57b..00e3c4ace 100644 --- a/TR5Main/Objects/TR3/tr3_tony.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_tony.cpp @@ -1,16 +1,18 @@ -#include "../newobjects.h" -#include "../../Game/effect2.h" -#include "../../Game/sphere.h" -#include "../../Game/items.h" -#include "../../Game/lot.h" -#include "../../Game/Box.h" -#include "../../Game/draw.h" -#include "../../Game/effects.h" -#include "..\..\Specific\level.h" -#include "../../Specific/setup.h" -#include "../../Game/lara.h" -#include "../../Game/traps.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr3_tony.h" +#include "effect2.h" +#include "sphere.h" +#include "items.h" +#include "lot.h" +#include "boss.h" +#include "box.h" +#include "draw.h" +#include "effect.h" +#include "level.h" +#include "setup.h" +#include "lara.h" +#include "traps.h" +#include "sound.h" enum TonyFlameType { @@ -30,7 +32,7 @@ struct TONY_FLAME PHD_VECTOR pos; int fallspeed; int speed; - short y_rot; + short yRot; short room_number; TonyFlameType type; }; @@ -63,7 +65,7 @@ static void TriggerTonyEffect(const TONY_FLAME flame) fx->pos.zPos = flame.pos.z; fx->fallspeed = flame.fallspeed; fx->pos.xRot = 0; - fx->pos.yRot = flame.y_rot; + fx->pos.yRot = flame.yRot; fx->pos.zRot = 0; fx->objectNumber = ID_TONY_BOSS_FLAME; fx->speed = flame.speed; @@ -83,7 +85,7 @@ static void TriggerTonyEffect(const TONY_FLAME flame) } } -void TriggerTonyFlame(short itemNum, int hand) +static void TriggerTonyFlame(short itemNum, int hand) { ITEM_INFO* item; SPARKS* sptr; @@ -143,7 +145,7 @@ void TriggerTonyFlame(short itemNum, int hand) sptr->dSize = size >> 2; } -void TriggerFireBallFlame(short fxNumber, long type, long xv, long yv, long zv) +static void TriggerFireBallFlame(short fxNumber, long type, long xv, long yv, long zv) { SPARKS* sptr; int dx, dz; @@ -223,7 +225,7 @@ void TriggerFireBallFlame(short fxNumber, long type, long xv, long yv, long zv) } } -void TriggerFireBall(ITEM_INFO* item, TonyFlameType type, PHD_VECTOR* lara_pos, short roomNumber, short angle, int zdspeed) +static void TriggerFireBall(ITEM_INFO* item, TonyFlameType type, PHD_VECTOR* lara_pos, short roomNumber, short angle, int zdspeed) { TONY_FLAME flame; memset(&flame, 0, sizeof(TONY_FLAME)); @@ -238,7 +240,7 @@ void TriggerFireBall(ITEM_INFO* item, TonyFlameType type, PHD_VECTOR* lara_pos, GetJointAbsPosition(item, &flame.pos, 10); flame.fallspeed = -16; flame.speed = 0; - flame.y_rot = item->pos.yRot; + flame.yRot = item->pos.yRot; flame.room_number = roomNumber; flame.type = T_ROCKZAPPL; break; @@ -250,7 +252,7 @@ void TriggerFireBall(ITEM_INFO* item, TonyFlameType type, PHD_VECTOR* lara_pos, GetJointAbsPosition(item, &flame.pos, 13); flame.fallspeed = -16; flame.speed = 0; - flame.y_rot = item->pos.yRot; + flame.yRot = item->pos.yRot; flame.room_number = roomNumber; flame.type = T_ROCKZAPPR; break; @@ -262,7 +264,7 @@ void TriggerFireBall(ITEM_INFO* item, TonyFlameType type, PHD_VECTOR* lara_pos, GetJointAbsPosition(item, &flame.pos, 13); flame.fallspeed = (GetRandomControl() & 7) + 10; flame.speed = 160; - flame.y_rot = item->pos.yRot; + flame.yRot = item->pos.yRot; flame.room_number = roomNumber; flame.type = T_ZAPP; break; @@ -273,7 +275,7 @@ void TriggerFireBall(ITEM_INFO* item, TonyFlameType type, PHD_VECTOR* lara_pos, flame.pos.z = lara_pos->z; flame.fallspeed = (GetRandomControl() & 3) + 4; flame.speed = 0; - flame.y_rot = angle; + flame.yRot = angle; flame.room_number = roomNumber; flame.type = T_DROPPER; break; @@ -284,7 +286,7 @@ void TriggerFireBall(ITEM_INFO* item, TonyFlameType type, PHD_VECTOR* lara_pos, flame.pos.z = lara_pos->z; flame.fallspeed = (GetRandomControl() & 3) - 2; flame.speed = zdspeed + (GetRandomControl() & 3); - flame.y_rot = GetRandomControl() << 1; + flame.yRot = GetRandomControl() << 1; flame.room_number = roomNumber; flame.type = T_ROCKZAPPDEBRIS; break; @@ -296,7 +298,7 @@ void TriggerFireBall(ITEM_INFO* item, TonyFlameType type, PHD_VECTOR* lara_pos, flame.fallspeed = -(GetRandomControl() & 15) - 16; flame.speed = (GetRandomControl() & 7) + 48; angle += (GetRandomControl() & 0x1fff) - 0x9000; - flame.y_rot = angle; + flame.yRot = angle; flame.room_number = roomNumber; flame.type = T_ZAPPDEBRIS; break; @@ -307,7 +309,7 @@ void TriggerFireBall(ITEM_INFO* item, TonyFlameType type, PHD_VECTOR* lara_pos, flame.pos.z = lara_pos->z; flame.fallspeed = -(GetRandomControl() & 31) - 32; flame.speed = (GetRandomControl() & 31) + 32; - flame.y_rot = GetRandomControl() << 1; + flame.yRot = GetRandomControl() << 1; flame.room_number = roomNumber; flame.type = T_DROPPERDEBRIS; break; @@ -443,7 +445,7 @@ void ControlTonyFireBall(short fxNumber) } } -void TonyBossDie(short itemNum) +static void TonyBossDie(short itemNum) { ITEM_INFO* item; item = &Items[itemNum]; diff --git a/TR5Main/Objects/TR3/Entity/tr3_tony.h b/TR5Main/Objects/TR3/Entity/tr3_tony.h new file mode 100644 index 000000000..22421c3f0 --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_tony.h @@ -0,0 +1,7 @@ +#pragma once +#include "items.h" + +void ControlTonyFireBall(short fxNumber); +void InitialiseTony(short itemNum); +void TonyControl(short itemNum); +void S_DrawTonyBoss(ITEM_INFO* item); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_trex.cpp b/TR5Main/Objects/TR3/Entity/tr3_trex.cpp similarity index 93% rename from TR5Main/Objects/TR3/tr3_trex.cpp rename to TR5Main/Objects/TR3/Entity/tr3_trex.cpp index 79de5d53a..4c2195ac3 100644 --- a/TR5Main/Objects/TR3/tr3_trex.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_trex.cpp @@ -1,10 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/camera.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr3_trex.h" +#include "items.h" +#include "box.h" +#include "camera.h" +#include "setup.h" +#include "level.h" +#include "lara.h" void LaraTyrannosaurDeath(ITEM_INFO* item) { diff --git a/TR5Main/Objects/TR3/Entity/tr3_trex.h b/TR5Main/Objects/TR3/Entity/tr3_trex.h new file mode 100644 index 000000000..438239298 --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_trex.h @@ -0,0 +1,5 @@ +#pragma once +#include "items.h" + +void LaraTyrannosaurDeath(ITEM_INFO* item); +void TyrannosaurControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_tribesman.cpp b/TR5Main/Objects/TR3/Entity/tr3_tribesman.cpp similarity index 96% rename from TR5Main/Objects/TR3/tr3_tribesman.cpp rename to TR5Main/Objects/TR3/Entity/tr3_tribesman.cpp index 6ff239211..2f77755ff 100644 --- a/TR5Main/Objects/TR3/tr3_tribesman.cpp +++ b/TR5Main/Objects/TR3/Entity/tr3_tribesman.cpp @@ -1,21 +1,22 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" -#include "../../Game/people.h" -#include "../../Game/draw.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr3_tribesman.h" +#include "box.h" +#include "effect.h" +#include "items.h" +#include "sphere.h" +#include "effect2.h" +#include "lara.h" +#include "sound.h" +#include "people.h" +#include "draw.h" +#include "setup.h" +#include "level.h" BITE_INFO tribesmanAxeBite = { 0, 16, 265, 13 }; BITE_INFO tribesmanDartsBite1 = { 0, 0, -200, 13 }; BITE_INFO tribesmanDartsBite2 = { 8, 40, -248, 13 }; -byte tribesmanAxeHit[13][3] = { +unsigned char tribesmanAxeHit[13][3] = { {0,0,0}, {0,0,0}, {0,0,0}, @@ -265,7 +266,7 @@ void TribemanAxeControl(short itemNum) CreatureAnimation(itemNum, angle, 0); } -void TribesmanShotDart(ITEM_INFO* item) +static void TribesmanShotDart(ITEM_INFO* item) { short dartItemNumber = CreateItem(); if (dartItemNumber != NO_ITEM) @@ -314,7 +315,7 @@ void TribesmanShotDart(ITEM_INFO* item) } } -void TribesmanDartsControl(short itemNum) +void TribemanDartsControl(short itemNum) { if (!CreatureActive(itemNum)) return; diff --git a/TR5Main/Objects/TR3/Entity/tr3_tribesman.h b/TR5Main/Objects/TR3/Entity/tr3_tribesman.h new file mode 100644 index 000000000..35fba9dae --- /dev/null +++ b/TR5Main/Objects/TR3/Entity/tr3_tribesman.h @@ -0,0 +1,4 @@ +#pragma once + +void TribemanAxeControl(short itemNum); +void TribemanDartsControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/Vehicles/cannon.cpp b/TR5Main/Objects/TR3/Vehicles/cannon.cpp new file mode 100644 index 000000000..474d5f8d5 --- /dev/null +++ b/TR5Main/Objects/TR3/Vehicles/cannon.cpp @@ -0,0 +1,2 @@ +#include "framework.h" +#include "cannon.h" diff --git a/TR5Main/Objects/TR3/Vehicles/cannon.h b/TR5Main/Objects/TR3/Vehicles/cannon.h new file mode 100644 index 000000000..3f59c932d --- /dev/null +++ b/TR5Main/Objects/TR3/Vehicles/cannon.h @@ -0,0 +1,2 @@ +#pragma once + diff --git a/TR5Main/Objects/Vehicles/kayak.cpp b/TR5Main/Objects/TR3/Vehicles/kayak.cpp similarity index 95% rename from TR5Main/Objects/Vehicles/kayak.cpp rename to TR5Main/Objects/TR3/Vehicles/kayak.cpp index bc61fe121..1f73a683e 100644 --- a/TR5Main/Objects/Vehicles/kayak.cpp +++ b/TR5Main/Objects/TR3/Vehicles/kayak.cpp @@ -1,18 +1,16 @@ -#include "../newobjects.h" -#include "../../Game/effects.h" -#include "../../Game/effect2.h" -#include "../../Game/draw.h" -#include "../../Game/camera.h" -#include "../../Game/lara.h" -#include "../../Game/collide.h" -#include "../../Game/laraflar.h" -#include "../../Game/items.h" -#include "..\..\Specific\level.h" -#include "..\..\Specific\level.h" -#include "../../Specific/setup.h" -#include "../../Specific/input.h" - - +#include "framework.h" +#include "kayak.h" +#include "effect.h" +#include "effect2.h" +#include "draw.h" +#include "camera.h" +#include "lara.h" +#include "collide.h" +#include "laraflar.h" +#include "items.h" +#include "level.h" +#include "setup.h" +#include "input.h" #define MAX_SPEED 0x380000 #define KAYAK_COLLIDE 64 @@ -62,7 +60,7 @@ enum KAYAK_STATE { KS_CLIMBOUTR, }; -void DoKayakRipple(ITEM_INFO* v, short xoff, short zoff) +static void DoKayakRipple(ITEM_INFO* v, short xoff, short zoff) { RIPPLE_STRUCT* r; int s, c, x, z; @@ -84,7 +82,7 @@ void DoKayakRipple(ITEM_INFO* v, short xoff, short zoff) } } -void KayakSplash(ITEM_INFO* item, long fallspeed, long water) +static void KayakSplash(ITEM_INFO* item, long fallspeed, long water) { /* SplashSetup.x = item->pos.xPos; @@ -113,7 +111,7 @@ void KayakSplash(ITEM_INFO* item, long fallspeed, long water) */ } -void TriggerRapidsMist(long x, long y, long z) +static void TriggerRapidsMist(long x, long y, long z) { SPARKS* sptr; long xsize; @@ -128,7 +126,7 @@ void TriggerRapidsMist(long x, long y, long z) sptr->colFadeSpeed = 2; sptr->fadeToBlack = 4; // 8 sptr->sLife = sptr->life = 6 + (GetRandomControl() & 3); - sptr->transType = 1; + sptr->transType = SEMITRANS; sptr->extras = 0; sptr->dynamic = -1; sptr->x = x + ((GetRandomControl() & 15) - 8); @@ -159,7 +157,7 @@ void TriggerRapidsMist(long x, long y, long z) sptr->dSize = xsize; } -int GetInKayak(short item_number, COLL_INFO* coll) +static int GetInKayak(short itemNumber, COLL_INFO* coll) { int dist; int x, z; @@ -170,7 +168,7 @@ int GetInKayak(short item_number, COLL_INFO* coll) if (!(TrInput & IN_ACTION) || Lara.gunStatus != LG_NO_ARMS || LaraItem->gravityStatus) return 0; - kayak = &Items[item_number]; + kayak = &Items[itemNumber]; /* -------- is Lara close enough to use the vehicle */ @@ -213,7 +211,7 @@ int GetInKayak(short item_number, COLL_INFO* coll) return 0; } -int GetKayakCollisionAnim(ITEM_INFO* v, int xdiff, int zdiff) +static int GetKayakCollisionAnim(ITEM_INFO* v, int xdiff, int zdiff) { xdiff = v->pos.xPos - xdiff; zdiff = v->pos.zPos - zdiff; @@ -248,7 +246,7 @@ int GetKayakCollisionAnim(ITEM_INFO* v, int xdiff, int zdiff) return 0; } -int DoKayakDynamics(int height, int fallspeed, int* y) +static int DoKayakDynamics(int height, int fallspeed, int* y) { int kick; @@ -282,7 +280,7 @@ int DoKayakDynamics(int height, int fallspeed, int* y) return fallspeed; } -void DoKayakCurrent(ITEM_INFO* item) +static void DoKayakCurrent(ITEM_INFO* item) { ROOM_INFO* r; PHD_VECTOR target; @@ -349,7 +347,7 @@ void DoKayakCurrent(ITEM_INFO* item) Lara.currentActive = 0; } -int TestKayakHeight(ITEM_INFO* item, int x, int z, PHD_VECTOR* pos) +static int TestKayakHeight(ITEM_INFO* item, int x, int z, PHD_VECTOR* pos) { int h; FLOOR_INFO* floor; @@ -382,7 +380,7 @@ int TestKayakHeight(ITEM_INFO* item, int x, int z, PHD_VECTOR* pos) return h - 5; } -int CanKayakGetOut(ITEM_INFO* kayak, int direction) +static int CanKayakGetOut(ITEM_INFO* kayak, int direction) { int height; PHD_VECTOR pos; @@ -395,7 +393,7 @@ int CanKayakGetOut(ITEM_INFO* kayak, int direction) return 1; } -int DoKayakShift(ITEM_INFO* v, PHD_VECTOR* pos, PHD_VECTOR* old) +static int DoKayakShift(ITEM_INFO* v, PHD_VECTOR* pos, PHD_VECTOR* old) { int x, z; int x_old, z_old; @@ -517,7 +515,7 @@ int DoKayakShift(ITEM_INFO* v, PHD_VECTOR* pos, PHD_VECTOR* old) return 0; } -void KayakToBackground(ITEM_INFO* kayak, KAYAK_INFO* kinfo) +static void KayakToBackground(ITEM_INFO* kayak, KAYAK_INFO* kinfo) { int h, slip = 0, rot = 0; PHD_VECTOR pos; @@ -533,7 +531,6 @@ void KayakToBackground(ITEM_INFO* kayak, KAYAK_INFO* kinfo) kinfo->OldPos = kayak->pos; /* -------- determine valid Kayak positions */ - height[0] = TestKayakHeight(kayak, 0, 1024, &oldpos[0]); height[1] = TestKayakHeight(kayak, -96, 512, &oldpos[1]); height[2] = TestKayakHeight(kayak, 96, 512, &oldpos[2]); @@ -676,7 +673,7 @@ void KayakToBackground(ITEM_INFO* kayak, KAYAK_INFO* kinfo) } } -void KayakUserInput(ITEM_INFO* kayak, ITEM_INFO* lara, KAYAK_INFO* kinfo) +static void KayakUserInput(ITEM_INFO* kayak, ITEM_INFO* lara, KAYAK_INFO* kinfo) { short frame; char lr; @@ -1068,7 +1065,7 @@ void KayakUserInput(ITEM_INFO* kayak, ITEM_INFO* lara, KAYAK_INFO* kinfo) } } -void KayakToBaddieCollision(ITEM_INFO* kayak) +static void KayakToBaddieCollision(ITEM_INFO* kayak) { #define TARGET_DIST (WALL_SIZE*2) // Up to this Distance more Complicated checks are made vector roomsList; @@ -1148,7 +1145,7 @@ void KayakToBaddieCollision(ITEM_INFO* kayak) #undef TARGET_DIST } -void LaraRapidsDrown() +static void LaraRapidsDrown() { ITEM_INFO* l = LaraItem; @@ -1169,13 +1166,13 @@ void LaraRapidsDrown() Lara.hitDirection = -1; } -void InitialiseKayak(short item_number) +void InitialiseKayak(short itemNumber) { int i; ITEM_INFO* v; KAYAK_INFO* Kayak; - v = &Items[item_number]; + v = &Items[itemNumber]; Kayak = (KAYAK_INFO*)game_malloc(sizeof(KAYAK_INFO)); v->data = (void*)Kayak; Kayak->Vel = 0; @@ -1194,19 +1191,19 @@ void DrawKayak(ITEM_INFO* kayak) kayak->pos.yPos -= KAYAK_DRAW_SHIFT; } -void KayakCollision(short item_number, ITEM_INFO* l, COLL_INFO* coll) +void KayakCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) { int geton; if ((l->hitPoints < 0) || (Lara.Vehicle != NO_ITEM)) return; - if ((geton = GetInKayak(item_number, coll))) + if ((geton = GetInKayak(itemNumber, coll))) { KAYAK_INFO* Kayak; - ITEM_INFO* v = &Items[item_number]; + ITEM_INFO* v = &Items[itemNumber]; - Lara.Vehicle = item_number; + Lara.Vehicle = itemNumber; /* -------- throw flare away if using */ if (Lara.gunType == WEAPON_FLARE) @@ -1248,11 +1245,11 @@ void KayakCollision(short item_number, ITEM_INFO* l, COLL_INFO* coll) else { coll->enableBaddiePush = true; - ObjectCollision(item_number, l, coll); + ObjectCollision(itemNumber, l, coll); } } -int KayakControl() +int KayakControl(void) { int h; KAYAK_INFO* Kayak; diff --git a/TR5Main/Objects/TR3/Vehicles/kayak.h b/TR5Main/Objects/TR3/Vehicles/kayak.h new file mode 100644 index 000000000..72871cca6 --- /dev/null +++ b/TR5Main/Objects/TR3/Vehicles/kayak.h @@ -0,0 +1,23 @@ +#pragma once +#include "items.h" +#include "collide.h" + +struct KAYAK_INFO +{ + int Vel; + int Rot; + int FallSpeedF; + int FallSpeedL; + int FallSpeedR; + int Water; + PHD_3DPOS OldPos; + char Turn; + char Forward; + char TrueWater; + char Flags; +}; + +void InitialiseKayak(short itemNumber); +void KayakCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll); +int KayakControl(void); +void DrawKayak(ITEM_INFO* kayak); \ No newline at end of file diff --git a/TR5Main/Objects/Vehicles/minecart.cpp b/TR5Main/Objects/TR3/Vehicles/minecart.cpp similarity index 97% rename from TR5Main/Objects/Vehicles/minecart.cpp rename to TR5Main/Objects/TR3/Vehicles/minecart.cpp index 747e53acd..58f776ca1 100644 --- a/TR5Main/Objects/Vehicles/minecart.cpp +++ b/TR5Main/Objects/TR3/Vehicles/minecart.cpp @@ -1,19 +1,18 @@ -#include "../newobjects.h" -#include "../../Game/lara.h" -#include "../../Game/collide.h" -#include "../../Game/effects.h" -#include "../../Game/laraflar.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/draw.h" -#include "../../Game/misc.h" -#include "../../Game/camera.h" -#include "..\..\Specific\level.h" -#include "../../Specific/setup.h" -#include "../../Specific/input.h" -#include "../../Game/sound.h" - - +#include "framework.h" +#include "minecart.h" +#include "lara.h" +#include "collide.h" +#include "effect.h" +#include "laraflar.h" +#include "items.h" +#include "sphere.h" +#include "draw.h" +#include "misc.h" +#include "camera.h" +#include "level.h" +#include "setup.h" +#include "input.h" +#include "sound.h" typedef enum MINECART_STATE { CART_GETIN, @@ -67,9 +66,7 @@ typedef enum MINECART_FLAGS #define CART_NHITS 25 #define CART_BADDIE_RADIUS STEP_SIZE - - -static int TestHeight(ITEM_INFO* v, int x, int z) +static int TestMinecartHeight(ITEM_INFO* v, int x, int z) { PHD_VECTOR pos; FLOOR_INFO* floor; @@ -435,11 +432,11 @@ static void MoveCart(ITEM_INFO* v, ITEM_INFO* l, CART_INFO* cart) } // tilt cart on slopes - cart->MidPos = TestHeight(v, 0, 0); + cart->MidPos = TestMinecartHeight(v, 0, 0); if (!cart->YVel) { - cart->FrontPos = TestHeight(v, 0, 256); + cart->FrontPos = TestMinecartHeight(v, 0, 256); cart->Gradient = cart->MidPos - cart->FrontPos; v->pos.yPos = cart->MidPos; } @@ -872,7 +869,7 @@ void MineCartCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) } } -int MineCartControl() +int MineCartControl(void) { CART_INFO* cart; ITEM_INFO* v; diff --git a/TR5Main/Objects/TR3/Vehicles/minecart.h b/TR5Main/Objects/TR3/Vehicles/minecart.h new file mode 100644 index 000000000..c28a337b5 --- /dev/null +++ b/TR5Main/Objects/TR3/Vehicles/minecart.h @@ -0,0 +1,22 @@ +#pragma once +#include "items.h" +#include "collide.h" + +typedef struct CART_INFO +{ + int Speed; + int MidPos; + int FrontPos; + int TurnX; + int TurnZ; + short TurnLen; + short TurnRot; + short YVel; + short Gradient; + char Flags; + char StopDelay; +}; + +void InitialiseMineCart(short itemNum); +void MineCartCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); +int MineCartControl(void); \ No newline at end of file diff --git a/TR5Main/Objects/Vehicles/quad.cpp b/TR5Main/Objects/TR3/Vehicles/quad.cpp similarity index 95% rename from TR5Main/Objects/Vehicles/quad.cpp rename to TR5Main/Objects/TR3/Vehicles/quad.cpp index ad462f65f..fb440f9a5 100644 --- a/TR5Main/Objects/Vehicles/quad.cpp +++ b/TR5Main/Objects/TR3/Vehicles/quad.cpp @@ -1,22 +1,20 @@ -#include "../newobjects.h" -#include "../../Game/lara.h" -#include "../../Game/effect2.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/collide.h" -#include "../../Game/camera.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/effects.h" -#include "../../Game/laraflar.h" -#include -#include "../../Game/lara1gun.h" -#include "../../Game/misc.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Specific/input.h" -#include "../../Game/sound.h" - -using namespace std; +#include "framework.h" +#include "quad.h" +#include "lara.h" +#include "effect2.h" +#include "items.h" +#include "sphere.h" +#include "collide.h" +#include "camera.h" +#include "tomb4fx.h" +#include "effect.h" +#include "laraflar.h" +#include "lara1gun.h" +#include "misc.h" +#include "setup.h" +#include "level.h" +#include "input.h" +#include "sound.h" typedef enum QUAD_EFFECTS_POSITIONS { EXHAUST_LEFT = 0, @@ -108,22 +106,22 @@ typedef enum QUAD_ANIM_STATES { #define QUAD_MIN_BOUNCE ((MAX_VELOCITY/2)>>8) #define QUADBIKE_TURNL_A 3 -#define QUADBIKE_TURNL_F GF2(ID_QUADBIKE, QUADBIKE_TURNL_A, 0) +#define QUADBIKE_TURNL_F GF2(ID_QUAD, QUADBIKE_TURNL_A, 0) #define QUADBIKE_TURNR_A 20 -#define QUADBIKE_TURNR_F GF2(ID_QUADBIKE, QUADBIKE_TURNR_A, 0) +#define QUADBIKE_TURNR_F GF2(ID_QUAD, QUADBIKE_TURNR_A, 0) #define QUADBIKE_FALLSTART_A 6 -#define QUADBIKE_FALLSTART_F GF2(ID_QUADBIKE, QUADBIKE_FALLSTART_A, 0) +#define QUADBIKE_FALLSTART_F GF2(ID_QUAD, QUADBIKE_FALLSTART_A, 0) #define QUADBIKE_FALL_A 7 -#define QUADBIKE_FALL_F GF2(ID_QUADBIKE, QUADBIKE_FALL_A, 0) +#define QUADBIKE_FALL_F GF2(ID_QUAD, QUADBIKE_FALL_A, 0) #define QUADBIKE_GETONR_A 9 -#define QUADBIKE_GETONR_F GF2(ID_QUADBIKE, QUADBIKE_GETONR_A, 0) +#define QUADBIKE_GETONR_F GF2(ID_QUAD, QUADBIKE_GETONR_A, 0) #define Q_HITB_A 11 #define Q_HITF_A 12 #define Q_HITL_A 14 #define Q_HITR_A 13 #define QUADBIKE_GETONL_A 23 -#define QUADBIKE_GETONL_F GF2(ID_QUADBIKE, QUADBIKE_GETONL_A, 0) +#define QUADBIKE_GETONL_F GF2(ID_QUAD, QUADBIKE_GETONL_A, 0) #define QUADBIKE_FALLSTART2_A 25 BITE_INFO quadEffectsPositions[6] = { @@ -140,9 +138,7 @@ bool QuadCanHandbrakeStart; int QuadSmokeStart; bool QuadNoGetOff; - - -void QuadbikeExplode(ITEM_INFO* item) +static void QuadbikeExplode(ITEM_INFO* item) { if (Rooms[item->roomNumber].flags & ENV_FLAG_WATER) { @@ -157,7 +153,7 @@ void QuadbikeExplode(ITEM_INFO* item) ExplodingDeath(Lara.Vehicle, 0xfffffffe, 1); KillItem(Lara.Vehicle); - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; SoundEffect(SFX_EXPLOSION1, NULL, 0); SoundEffect(SFX_EXPLOSION2, NULL, 0); @@ -165,7 +161,7 @@ void QuadbikeExplode(ITEM_INFO* item) Lara.Vehicle = NO_ITEM; } -int CanQuadbikeGetOff(int direction) +static int CanQuadbikeGetOff(int direction) { short angle; @@ -198,7 +194,7 @@ int CanQuadbikeGetOff(int direction) return true; } -int QuadCheckGetOff() +static int QuadCheckGetOff() { ITEM_INFO* item = &Items[Lara.Vehicle]; @@ -260,7 +256,7 @@ int QuadCheckGetOff() return true; } -int GetOnQuadBike(short itemNumber, COLL_INFO* coll) +static int GetOnQuadBike(short itemNumber, COLL_INFO* coll) { ITEM_INFO* item = &Items[itemNumber]; @@ -306,7 +302,7 @@ int GetOnQuadBike(short itemNumber, COLL_INFO* coll) return true; } -void QuadBaddieCollision(ITEM_INFO* quad) +static void QuadBaddieCollision(ITEM_INFO* quad) { vector roomsList; @@ -354,7 +350,7 @@ void QuadBaddieCollision(ITEM_INFO* quad) } } -int GetQuadCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p) +static int GetQuadCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p) { p->x = item->pos.xPos - p->x; p->z = item->pos.zPos - p->z; @@ -385,7 +381,7 @@ int GetQuadCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p) return 0; } -int TestQuadHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos) +static int TestQuadHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos) { pos->y = item->pos.yPos - (dz * phd_sin(item->pos.xRot) >> W2V_SHIFT) + (dx * phd_sin(item->pos.zRot) >> W2V_SHIFT); @@ -404,7 +400,7 @@ int TestQuadHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos) return GetFloorHeight(floor, pos->x, pos->y, pos->z); } -int DoQuadShift(ITEM_INFO* quad, PHD_VECTOR* pos, PHD_VECTOR* old) +static int DoQuadShift(ITEM_INFO* quad, PHD_VECTOR* pos, PHD_VECTOR* old) { int x = pos->x >> WALL_SHIFT; int z = pos->z >> WALL_SHIFT; @@ -504,7 +500,7 @@ int DoQuadShift(ITEM_INFO* quad, PHD_VECTOR* pos, PHD_VECTOR* old) return 0; } -int DoQuadDynamics(int height, int fallspeed, int *y) +static int DoQuadDynamics(int height, int fallspeed, int *y) { if (height > *y) { @@ -533,7 +529,7 @@ int DoQuadDynamics(int height, int fallspeed, int *y) return fallspeed; } -int QuadDynamics(ITEM_INFO* item) +static int QuadDynamics(ITEM_INFO* item) { /* Does all skidoo movement and collision and returns if collide value */ PHD_VECTOR moved, fl, fr, br, bl, mtl, mbl, mtr, mbr, mml, mmr; @@ -762,7 +758,7 @@ int QuadDynamics(ITEM_INFO* item) return collide; } -void AnimateQuadBike(ITEM_INFO* item, int collide, int dead) +static void AnimateQuadBike(ITEM_INFO* item, int collide, int dead) { QUAD_INFO* quad = (QUAD_INFO *)item->data; @@ -938,7 +934,7 @@ void AnimateQuadBike(ITEM_INFO* item, int collide, int dead) } } -int QuadUserControl(ITEM_INFO* item, int height, int* pitch) +static int QuadUserControl(ITEM_INFO* item, int height, int* pitch) { bool drive = false; int revs = 0; @@ -1206,7 +1202,7 @@ void QuadBikeCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) ObjectCollision(itemNumber, l, coll); } -void TriggerQuadExhaustSmoke(int x, int y, int z, short angle, int speed, int moving) +static void TriggerQuadExhaustSmoke(int x, int y, int z, short angle, int speed, int moving) { SPARKS* spark = &Sparks[GetFreeSpark()]; @@ -1266,7 +1262,7 @@ void TriggerQuadExhaustSmoke(int x, int y, int z, short angle, int speed, int mo spark->size = size >> 1; } -int QuadBikeControl() +int QuadBikeControl(void) { short xRot, zRot, rotadd; int pitch, dead = 0; @@ -1438,7 +1434,9 @@ int QuadBikeControl() } } else + { QuadSmokeStart = 0; + } return QuadCheckGetOff(); } \ No newline at end of file diff --git a/TR5Main/Objects/TR3/Vehicles/quad.h b/TR5Main/Objects/TR3/Vehicles/quad.h new file mode 100644 index 000000000..ba3c5b335 --- /dev/null +++ b/TR5Main/Objects/TR3/Vehicles/quad.h @@ -0,0 +1,24 @@ +#pragma once +#include "items.h" +#include "collide.h" + +typedef struct QUAD_INFO +{ + int velocity; + short frontRot; + short rearRot; + int revs; + int engineRevs; + short trackMesh; + int skidooTurn; + int leftFallspeed; + int rightFallspeed; + short momentumAngle; + short extraRotation; + int pitch; + char flags; +}; + +void InitialiseQuadBike(short itemNumber); +void QuadBikeCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll); +int QuadBikeControl(void); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/Vehicles/rubberboat.cpp b/TR5Main/Objects/TR3/Vehicles/rubberboat.cpp new file mode 100644 index 000000000..eac48e0af --- /dev/null +++ b/TR5Main/Objects/TR3/Vehicles/rubberboat.cpp @@ -0,0 +1,2 @@ +#include "framework.h" +#include "rubberboat.h" diff --git a/TR5Main/Objects/TR3/Vehicles/rubberboat.h b/TR5Main/Objects/TR3/Vehicles/rubberboat.h new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/TR5Main/Objects/TR3/Vehicles/rubberboat.h @@ -0,0 +1 @@ +#pragma once diff --git a/TR5Main/Objects/Vehicles/upv.cpp b/TR5Main/Objects/TR3/Vehicles/upv.cpp similarity index 96% rename from TR5Main/Objects/Vehicles/upv.cpp rename to TR5Main/Objects/TR3/Vehicles/upv.cpp index 2510e79c6..3e11cd17a 100644 --- a/TR5Main/Objects/Vehicles/upv.cpp +++ b/TR5Main/Objects/TR3/Vehicles/upv.cpp @@ -1,24 +1,23 @@ -#include "../newobjects.h" -#include "../../Game/lara.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/effects.h" -#include "../../Game/collide.h" -#include "../../Game/box.h" -#include "../../Game/laraflar.h" -#include "../../Game/draw.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/misc.h" -#include "../../Game/camera.h" -#include "../../Specific/setup.h" -#include "../../Game/bubble.h" -#include "..\..\Specific\level.h" -#include "../../Specific/input.h" -#include "../../Game/savegame.h" -#include "../../Game/sound.h" - - +#include "framework.h" +#include "upv.h" +#include "lara.h" +#include "items.h" +#include "sphere.h" +#include "effect2.h" +#include "effect.h" +#include "collide.h" +#include "box.h" +#include "laraflar.h" +#include "draw.h" +#include "tomb4fx.h" +#include "misc.h" +#include "camera.h" +#include "setup.h" +#include "bubble.h" +#include "level.h" +#include "input.h" +#include "savegame.h" +#include "sound.h" enum UPV_FLAG { @@ -137,8 +136,7 @@ static void FireSubHarpoon(ITEM_INFO* v) } } - -void TriggerSubMist(long x, long y, long z, long speed, short angle) +static void TriggerSubMist(long x, long y, long z, long speed, short angle) { long size, xv, zv; SPARKS* sptr; @@ -157,7 +155,7 @@ void TriggerSubMist(long x, long y, long z, long speed, short angle) sptr->colFadeSpeed = 4 + (GetRandomControl() & 3); sptr->fadeToBlack = 12; sptr->sLife = sptr->life = (GetRandomControl() & 3) + 20; - sptr->transType = 2; + sptr->transType = COLADD; sptr->extras = 0; sptr->dynamic = -1; @@ -190,7 +188,7 @@ void TriggerSubMist(long x, long y, long z, long speed, short angle) sptr->dSize = size; } -void SubEffects(short item_number) +static void SubEffects(short item_number) { ITEM_INFO* v; SUB_INFO* sub; @@ -301,7 +299,7 @@ static int CanGetOff(ITEM_INFO* v) return 1; } -int GetOnSub(short item_number, COLL_INFO* coll) +static int GetOnSub(short item_number, COLL_INFO* coll) { /* Returns 0 if no get on, 1 if right get on and 2 if left get on */ int dist; @@ -337,7 +335,7 @@ int GetOnSub(short item_number, COLL_INFO* coll) return 1; } -void DoCurrent(ITEM_INFO* item) +static void DoCurrent(ITEM_INFO* item) { PHD_VECTOR target; @@ -403,7 +401,7 @@ void DoCurrent(ITEM_INFO* item) Lara.currentActive = 0; } -void BackgroundCollision(ITEM_INFO* v, ITEM_INFO* l, SUB_INFO* sub) +static void BackgroundCollision(ITEM_INFO* v, ITEM_INFO* l, SUB_INFO* sub) { int height; COLL_INFO cinfo, *coll = &cinfo; @@ -840,7 +838,7 @@ void SubCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) } } -int SubControl() +int SubControl(void) { int h; SUB_INFO* sub; diff --git a/TR5Main/Objects/TR3/Vehicles/upv.h b/TR5Main/Objects/TR3/Vehicles/upv.h new file mode 100644 index 000000000..e65a590d5 --- /dev/null +++ b/TR5Main/Objects/TR3/Vehicles/upv.h @@ -0,0 +1,17 @@ +#pragma once +#include "items.h" +#include "collide.h" + +struct SUB_INFO +{ + int Vel; + int Rot; + int RotX; + short FanRot; + char Flags; + char WeaponTimer; +}; + +void SubInitialise(short itemNum); +void SubCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); +int SubControl(void); \ No newline at end of file diff --git a/TR5Main/Objects/TR3/boss.h b/TR5Main/Objects/TR3/boss.h new file mode 100644 index 000000000..8820b59ce --- /dev/null +++ b/TR5Main/Objects/TR3/boss.h @@ -0,0 +1,54 @@ +#pragma once +#include "phd_global.h" + +struct BOSS_STRUCT +{ + PHD_VECTOR BeamTarget; + bool DroppedIcon; + bool IsInvincible; + bool DrawExplode; // allow explosion geometry + bool Charged; + bool Dead; + short AttackCount; + short DeathCount; + short AttackFlag; + short AttackType; + short AttackHeadCount; + short RingCount; + short ExplodeCount; + short LizmanItem, LizmanRoom; + short HpCounter; +}; + +struct SHIELD_POINTS +{ + short x; + short y; + short z; + unsigned char rsub; + unsigned char gsub; + unsigned char bsub; + unsigned char pad[3]; + long rgb; +}; + +struct EXPLOSION_VERTS +{ + short x; + short z; + long rgb; +}; + +struct EXPLOSION_RING +{ + short on; + short life; // 0 - 32. + short speed; + short radius; // Width is 1/4 of radius. + short xrot; + short zrot; + int x; + int y; + int z; + EXPLOSION_VERTS verts[16]; +}; \ No newline at end of file diff --git a/TR5Main/Objects/TR3/fish.h b/TR5Main/Objects/TR3/fish.h new file mode 100644 index 000000000..8b8f23c1c --- /dev/null +++ b/TR5Main/Objects/TR3/fish.h @@ -0,0 +1,24 @@ +#pragma once + +struct FISH_INFO +{ + short x; + short y; + short z; + int angle; + short destY; + short angAdd; + unsigned char speed; + unsigned char acc; + unsigned char swim; +}; + +struct FISH_LEADER_INFO +{ + short angle; + unsigned char speed; + unsigned char on; + short angleTime; + short speedTime; + short xRange, yRange, zRange; +}; \ No newline at end of file diff --git a/TR5Main/Objects/TR3/tr3_objects.cpp b/TR5Main/Objects/TR3/tr3_objects.cpp new file mode 100644 index 000000000..d897b2e1f --- /dev/null +++ b/TR5Main/Objects/TR3/tr3_objects.cpp @@ -0,0 +1,412 @@ +#include "framework.h" +#include "tr3_objects.h" +/// entities +#include "tr3_civvy.h" // OK +#include "tr3_cobra.h" // OK +#include "tr3_fishemitter.h" // OK +#include "tr3_flamethrower.h" // OK +#include "tr3_monkey.h" // OK +#include "tr3_mpgun.h" // OK +#include "tr3_mpstick.h" // OK +#include "tr3_raptor.h" // OK +#include "tr3_scuba.h" // OK +#include "tr3_shiva.h" // OK +#include "tr3_sophia.h" // OK +#include "tr3_tiger.h" // OK +#include "tr3_tony.h" // OK +#include "tr3_trex.h" // OK +#include "tr3_tribesman.h" // OK +/// objects + +/// traps + +/// switch + +/// vehicles +#include "cannon.h" +#include "kayak.h" +#include "minecart.h" +#include "quad.h" +#include "upv.h" +#include "rubberboat.h" +/// necessary import +#include "collide.h" +#include "setup.h" +#include "level.h" + +static void StartBaddy(ObjectInfo* obj) +{ + obj = &Objects[ID_TONY_BOSS]; + if (obj->loaded) + { + obj->initialise = InitialiseTony; + obj->collision = CreatureCollision; + obj->control = TonyControl; + obj->drawRoutine = S_DrawTonyBoss; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 100; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + } + + obj = &Objects[ID_TIGER]; + if (obj->loaded) + { + obj->control = TigerControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 24; + obj->pivotLength = 200; + obj->radius = 340; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + Bones[obj->boneIndex + 21 * 4] |= ROT_Y; + } + + obj = &Objects[ID_COBRA]; + if (obj->loaded) + { + obj->initialise = InitialiseCobra; + obj->control = CobraControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 8; + obj->radius = 102; + obj->intelligent = true; + obj->nonLot = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex + 0 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + } + + obj = &Objects[ID_RAPTOR]; + if (obj->loaded) + { + obj->control = RaptorControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 100; + obj->radius = 341; + obj->pivotLength = 600; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex + 20 * 4] |= ROT_Y; + Bones[obj->boneIndex + 21 * 4] |= ROT_Y; + Bones[obj->boneIndex + 23 * 4] |= ROT_Y; + Bones[obj->boneIndex + 25 * 4] |= ROT_Y; + } + + obj = &Objects[ID_TRIBESMAN_WITH_AX]; + if (obj->loaded) + { + obj->control = TribemanAxeControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 28; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 0; + + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + } + + obj = &Objects[ID_TRIBESMAN_WITH_DARTS]; + if (obj->loaded) + { + obj->control = TribemanDartsControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 28; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 0; + + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + } + + obj = &Objects[ID_TYRANNOSAUR]; + if (obj->loaded) + { + obj->control = TyrannosaurControl; + obj->collision = CreatureCollision; + obj->hitPoints = 800; + obj->shadowSize = 64; + obj->pivotLength = 1800; + obj->radius = 512; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex + 10 * 4] |= ROT_Y; + Bones[obj->boneIndex + 11 * 4] |= ROT_Y; + } + + obj = &Objects[ID_SCUBA_DIVER]; + if (obj->loaded) + { + obj->control = ScubaControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 20; + obj->radius = 340; + obj->intelligent = true; + obj->waterCreature = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 50; + obj->zoneType = ZONE_WATER; + + Bones[obj->boneIndex + 10 * 4] |= ROT_Y; + Bones[obj->boneIndex + 14 * 4] |= ROT_Z; + } + + obj = &Objects[ID_SCUBA_HARPOON]; + if (obj->loaded) + { + obj->control = ScubaHarpoonControl; + obj->collision = ObjectCollision; + obj->savePosition = true; + } + + obj = &Objects[ID_FLAMETHROWER_BADDY]; + if (obj->loaded) + { + obj->control = FlameThrowerControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 36; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 0; + + Bones[obj->boneIndex + 0 * 4] |= ROT_Y; + Bones[obj->boneIndex + 0 * 4] |= ROT_X; + Bones[obj->boneIndex + 7 * 4] |= ROT_Y; + } + + obj = &Objects[ID_MONKEY]; + if (obj->loaded) + { + //if (!Objects[MESHSWAP2].loaded) + // S_ExitSystem("FATAL: Monkey requires MESHSWAP2 (Monkey + Pickups)"); + //obj->draw_routine = DrawMonkey; + obj->initialise = InitialiseMonkey; + obj->control = MonkeyControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 8; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 0; + + Bones[obj->boneIndex + 0 * 4] |= ROT_Y; + Bones[obj->boneIndex + 0 * 4] |= ROT_X; + Bones[obj->boneIndex + 7 * 4] |= ROT_Y; + } + + obj = &Objects[ID_MP_WITH_GUN]; + if (obj->loaded) + { + obj->control = MPGunControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 28; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 0; + obj->biteOffset = 0; + + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + } + + obj = &Objects[ID_MP_WITH_STICK]; + if (obj->loaded) + { + obj->initialise = InitialiseMPStick; + obj->control = MPStickControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 28; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 0; + obj->zoneType = ZONE_HUMAN_CLASSIC; + + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + } + + obj = &Objects[ID_SHIVA]; + if (obj->loaded) + { + obj->initialise = InitialiseShiva; + obj->collision = CreatureCollision; + obj->control = ShivaControl; + //obj->drawRoutine = DrawStatue; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 100; + obj->pivotLength = 0; + obj->radius = 256; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); + Bones[obj->boneIndex + 25 * 4] |= (ROT_X | ROT_Y); + } + + obj = &Objects[ID_SOPHIA_LEE_BOSS]; + if (obj->loaded) + { + obj->initialise = InitialiseLondonBoss; + obj->collision = CreatureCollision; + obj->control = LondonBossControl; + obj->drawRoutine = S_DrawLondonBoss; + obj->shadowSize = 0; + obj->pivotLength = 50; + obj->hitPoints = 300; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->savePosition = true; + obj->saveHitpoints = true; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + } + + obj = &Objects[ID_CIVVIE]; + if (obj->loaded) + { + obj->initialise = InitialiseCivvy; + obj->control = CivvyControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 15; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->pivotLength = 0; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + } +} + +static void StartObject(ObjectInfo* obj) +{ + +} + +static void StartTrap(ObjectInfo* obj) +{ + +} + +static void StartVehicles(ObjectInfo* obj) +{ + obj = &Objects[ID_QUAD]; + if (obj->loaded) + { + obj->initialise = InitialiseQuadBike; + obj->collision = QuadBikeCollision; + obj->savePosition = true; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_KAYAK]; + if (obj->loaded) + { + obj->initialise = InitialiseKayak; + obj->collision = KayakCollision; + //obj->drawRoutine = DrawKayak; + obj->saveAnim = true; + obj->saveFlags = true; + obj->savePosition = true; + } + + obj = &Objects[ID_MINECART]; + if (obj->loaded) + { + obj->initialise = InitialiseMineCart; + obj->collision = MineCartCollision; + obj->saveAnim = true; + obj->saveFlags = true; + obj->savePosition = true; + } +} + +static void StartProjectiles(ObjectInfo* obj) +{ + obj = &Objects[ID_TONY_BOSS_FLAME]; + obj->control = ControlTonyFireBall; + obj->drawRoutine = NULL; +} + +static ObjectInfo* objToInit; +void InitialiseTR3Objects() +{ + StartBaddy(objToInit); + StartObject(objToInit); + StartTrap(objToInit); + StartVehicles(objToInit); + StartProjectiles(objToInit); +} diff --git a/TR5Main/Objects/TR3/tr3_objects.h b/TR5Main/Objects/TR3/tr3_objects.h new file mode 100644 index 000000000..823424642 --- /dev/null +++ b/TR5Main/Objects/TR3/tr3_objects.h @@ -0,0 +1,3 @@ +#pragma once + +void InitialiseTR3Objects(); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_ahmet.cpp b/TR5Main/Objects/TR4/Entity/tr4_ahmet.cpp similarity index 86% rename from TR5Main/Objects/TR4/tr4_ahmet.cpp rename to TR5Main/Objects/TR4/Entity/tr4_ahmet.cpp index 519381630..b0d8ff034 100644 --- a/TR5Main/Objects/TR4/tr4_ahmet.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_ahmet.cpp @@ -1,15 +1,18 @@ -#include "../newobjects.h" -#include "../../Game/control.h" -#include "../../Game/sphere.h" -#include "../../Game/effects.h" -#include "../../Game/effect2.h" -#include "../../Game/sound.h" -#include "../../Specific/setup.h" -#include "../../Game/Box.h" -#include "../../Specific/level.h" -#include "../../Game/misc.h" -#include "../../Game/lara.h" -#include "../../Game/people.h" +#include "framework.h" +#include "tr4_ahmet.h" +#include "control.h" +#include "sphere.h" +#include "effect.h" +#include "effect2.h" +#include "sound.h" +#include "setup.h" +#include "box.h" +#include "level.h" +#include "misc.h" +#include "lara.h" +#include "people.h" +#include "items.h" +#include "lot.h" enum AHMET_STATE { @@ -76,12 +79,12 @@ static void TriggerAhmetDeathEffect(ITEM_INFO* item) SoundEffect(SFX_TR4_LOOP_FOR_SMALL_FIRES, &item->pos, NULL); } -void InitialiseAhmet(short item_number) +void InitialiseAhmet(short itemNumber) { ITEM_INFO* item; - item = &Items[item_number]; + item = &Items[itemNumber]; - InitialiseCreature(item_number); + InitialiseCreature(itemNumber); item->animNumber = Objects[item->objectNumber].animIndex; item->frameNumber = Anims[item->animNumber].frameBase; item->goalAnimState = AHMET_IDLE; @@ -91,17 +94,17 @@ void InitialiseAhmet(short item_number) item->itemFlags[2] = item->pos.zPos >> (WALL_SHIFT); } -void AhmetControl(short item_number) +void AhmetControl(short itemNumber) { + if (!CreatureActive(itemNumber)) + return; + ITEM_INFO* item; CREATURE_INFO* ahmet; AI_INFO lara_info, info; short angle, head_y; - if (!CreatureActive(item_number)) - return; - - item = &Items[item_number]; + item = &Items[itemNumber]; if (item->triggerFlags == 1) { item->triggerFlags = 0; @@ -114,7 +117,8 @@ void AhmetControl(short item_number) if (item->hitPoints <= 0) { - TriggerAhmetDeathEffect(item); + if (item->triggerFlags != 1) + TriggerAhmetDeathEffect(item); if (item->currentAnimState == AHMET_DIE) { @@ -131,7 +135,7 @@ void AhmetControl(short item_number) item->frameNumber = Anims[item->animNumber].frameBase; item->currentAnimState = AHMET_DIE; item->goalAnimState = AHMET_DIE; - Lara.generalPtr = (void*)item_number; + Lara.generalPtr = (void*)itemNumber; } } else @@ -164,7 +168,7 @@ void AhmetControl(short item_number) ahmet->enemy = LaraItem; if (lara_info.distance < AHMET_AWARE_DISTANCE || item->hitStatus || TargetVisible(item, &lara_info)) - AlertAllGuards(item_number); + AlertAllGuards(itemNumber); if (info.ahead) head_y = info.angle; @@ -350,5 +354,45 @@ void AhmetControl(short item_number) CreatureTilt(item, 0); CreatureJoint(item, 0, head_y); AhmetHeavyTriggers(item); - CreatureAnimation(item_number, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } + +bool RespawnAhmet(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (item->currentAnimState != 7 || item->frameNumber != Anims[item->animNumber].frameEnd) + return false; + + FlashFadeR = 255; + FlashFadeG = 64; + FlashFadeB = 0; + FlashFader = 32; + + item->pos.xPos = (item->itemFlags[0] << 10) + 512; + item->pos.yPos = (item->itemFlags[1] << 8); + item->pos.zPos = (item->itemFlags[2] << 10) + 512; + + IsRoomOutside(item->pos.xPos, item->pos.yPos, item->pos.zPos); + + if (item->roomNumber != IsRoomOutsideNo) + ItemNewRoom(itemNumber, IsRoomOutsideNo); + + item->animNumber = Objects[item->objectNumber].animIndex; + item->goalAnimState = 1; + item->frameNumber = Anims[item->animNumber].frameBase; + item->currentAnimState = 1; + item->hitPoints = Objects[item->objectNumber].hitPoints; + + AddActiveItem(itemNumber); + + item->flags &= 0xFE; + item->afterDeath = 0; + item->status = ITEM_ACTIVE; + item->collidable = true; + + EnableBaddieAI(itemNumber, 1); + + item->triggerFlags = 1; + return true; +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_ahmet.h b/TR5Main/Objects/TR4/Entity/tr4_ahmet.h new file mode 100644 index 000000000..52712c3dc --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_ahmet.h @@ -0,0 +1,5 @@ +#pragma once + +void InitialiseAhmet(short itemNumber); +void AhmetControl(short itemNumber); +bool RespawnAhmet(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_baddy.cpp b/TR5Main/Objects/TR4/Entity/tr4_baddy.cpp similarity index 51% rename from TR5Main/Objects/TR4/tr4_baddy.cpp rename to TR5Main/Objects/TR4/Entity/tr4_baddy.cpp index f569f344d..60d469206 100644 --- a/TR5Main/Objects/TR4/tr4_baddy.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_baddy.cpp @@ -1,19 +1,162 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/lara.h" -#include "../../Game/people.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr4_baddy.h" +#include "items.h" +#include "box.h" +#include "sphere.h" +#include "effect2.h" +#include "lara.h" +#include "people.h" +#include "effect.h" +#include "setup.h" +#include "level.h" + +enum BADDY_STATES { + STATE_BADDY_STOP = 0, + STATE_BADDY_WALK = 1, + STATE_BADDY_RUN = 2, + // 3 + STATE_BADDY_DODGE_START = 4, + // 5 + // 6 + // 7 + STATE_BADDY_UNKNOWN_8 = 8, + STATE_BADDY_UNKNOWN_9 = 9, + STATE_BADDY_DRAW_GUN = 10, + STATE_BADDY_HOLSTER_GUN = 11, + STATE_BADDY_DRAW_SWORD = 12, + STATE_BADDY_HOLSTER_SWORD = 13, + STATE_BADDY_FIRE = 14, + STATE_BADDY_SWORD_HIT_FRONT = 15, + STATE_BADDY_SWORD_HIT_RIGHT = 16, + STATE_BADDY_SWORD_HIT_LEFT = 17, + STATE_BADDY_MONKEY_GRAB = 18, + STATE_BADDY_MONKEY_IDLE = 19, + STATE_BADDY_MONKEY_FORWARD = 20, + STATE_BADDY_MONKEY_PUSH_OFF = 21, + STATE_BADDY_MONKEY_FALL_LAND = 22, + STATE_BADDY_ROLL_LEFT = 23, + STATE_BADDY_JUMP_RIGHT = 24, + STATE_BADDY_STAND_TO_CROUCH = 25, + STATE_BADDY_CROUCH = 26, + STATE_BADDY_CROUCH_PICKUP = 27, + STATE_BADDY_CROUCH_TO_STAND = 28, + STATE_BADDY_WALK_SWORD_HIT_RIGHT = 29, + STATE_BADDY_SOMERSAULT = 30, + STATE_BADDY_AIM = 31, + STATE_BADDY_DEATH = 32, + STATE_BADDY_JUMP_FORWARD_1_BLOCK = 33, + STATE_BADDY_JUMP_FORWARD_FALL = 34, + STATE_BADDY_MONKEY_TO_FREEFALL = 35, + STATE_BADDY_FREEFALL = 36, + STATE_BADDY_FREEFALL_LAND_DEATH = 37, + STATE_BADDY_JUMP_FORWARD_2_BLOCKS = 38, + STATE_BADDY_CLIMB_4_CLICKS = 39, + STATE_BADDY_CLIMB_3_CLICKS = 40, + STATE_BADDY_CLIMB_2_CLICKS = 41, + STATE_BADDY_JUMP_OFF_4_CLICKS = 42, + STATE_BADDY_JUMP_OFF_3_CLICKS = 43, + STATE_BADDY_BLIND = 44 +}; + +enum BADDY_ANIM { + ANIMATION_BADDY_RUN = 0, + ANIMATION_BADDY_RUN_STOP_START = 1, + ANIMATION_BADDY_RUN_STOP_END = 2, + ANIMATION_BADDY_SOMERSAULT_START = 3, + ANIMATION_BADDY_SOMERSAULT_END = 4, + ANIMATION_BADDY_DODGE_START = 5, + // 6 + // 7 + // 8 + ANIMATION_BADDY_MONKEY_GRAB = 9, + ANIMATION_BADDY_MONKEY_IDLE = 10, + ANIMATION_BADDY_MONKEY_FORWARD = 11, + ANIMATION_BADDY_MONKEY_IDLE_TO_FORWARD = 12, + ANIMATION_BADDY_MONKEY_STOP_LEFT = 13, + ANIMATION_BADDY_MONKEY_STOP_RIGHT = 14, + ANIMATION_BADDY_MONKEY_FALL_LAND = 15, + ANIMATION_BADDY_MONKEY_PUSH_OFF = 16, + ANIMATION_BADDY_DODGE_END = 17, + ANIMATION_BADDY_STAND_IDLE = 18, + ANIMATION_BADDY_DODGE_END_TO_STAND = 19, + ANIMATION_BADDY_DRAW_GUN = 20, + ANIMATION_BADDY_HOLSTER_GUN = 21, + ANIMATION_BADDY_DRAW_SWORD = 22, + ANIMATION_BADDY_HOLSTER_SWORD = 23, + ANIMATION_BADDY_STAND_TO_ROLL_LEFT = 24, + ANIMATION_BADDY_ROLL_LEFT_START = 25, + ANIMATION_BADDY_ROLL_LEFT_CONTINUE = 26, + ANIMATION_BADDY_ROLL_LEFT_END = 27, + ANIMATION_BADDY_ROLL_LEFT_TO_CROUCH = 28, + ANIMATION_BADDY_CROUCH = 29, + ANIMATION_BADDY_CROUCH_TO_STAND = 30, + ANIMATION_BADDY_STAND_TO_WALK = 31, + ANIMATION_BADDY_WALK = 32, + ANIMATION_BADDY_WALK_TO_RUN = 33, + ANIMATION_BADDY_STAND_TO_AIM = 34, + ANIMATION_BADDY_AIM = 35, + ANIMATION_BADDY_FIRE = 36, + ANIMATION_BADDY_AIM_TO_STAND = 37, + ANIMATION_BADDY_SWORD_HIT_FRONT = 38, + ANIMATION_BADDY_CROUCH_PICKUP = 39, + ANIMATION_BADDY_STAND_TO_CROUCH = 40, + ANIMATION_BADDY_SWORD_HIT_RIGHT = 41, + ANIMATION_BADDY_SWORD_HIT_RIGHT_TO_LEFT = 42, + ANIMATION_BADDY_SWORD_HIT_RIGHT_TO_STAND = 43, + ANIMATION_BADDY_SWORD_HIT_LEFT = 44, + ANIMATION_BADDY_STAND_DEATH = 45, + ANIMATION_BADDY_WALK_SWORD_HIT_RIGHT = 46, + ANIMATION_BADDY_STAND_TO_JUMP_RIGHT = 47, + ANIMATION_BADDY_JUMP_RIGHT_START = 48, + ANIMATION_BADDY_JUMP_RIGHT_CONTINUE = 49, + ANIMATION_BADDY_JUMP_RIGHT_END = 50, + ANIMATION_BADDY_RUN_TO_WALK = 51, + // 52 + // 53 + ANIMATION_BADDY_WALK_STOP_RIGHT = 54, + ANIMATION_BADDY_STAND_TO_JUMP_FORWARD = 55, + ANIMATION_BADDY_JUMP_FORWARD_1_BLOCK = 56, + ANIMATION_BADDY_JUMP_FORWARD_FALL = 57, + ANIMATION_BADDY_JUMP_FORWARD_LAND = 58, + ANIMATION_BADDY_MONKEY_TO_FREEFALL = 59, + ANIMATION_BADDY_FREEFALL = 60, + ANIMATION_BADDY_FREEFALL_LAND_DEATH = 61, + ANIMATION_BADDY_CLIMB_4_CLICKS = 62, + ANIMATION_BADDY_CLIMB_3_CLICKS = 63, + ANIMATION_BADDY_CLIMB_2_CLICKS = 64, + ANIMATION_BADDY_JUMP_OFF_4_CLICKS = 65, + ANIMATION_BADDY_JUMP_OFF_3_CLICKS = 66, + ANIMATION_BADDY_JUMP_FORWARD_2_BLOCKS = 67, + ANIMATION_BADDY_BLIND = 68, + ANIMATION_BADDY_BLIND_TO_STAND = 69, + ANIMATION_BADDY_DEAD = 70, +}; + +enum BADDY_FRAMES { + FRAME_BADDY_HOLSTER_GUN = 20, + FRAME_BADDY_DRAW_GUN = 21, + FRAME_BADDY_HOLSTER_SWORD = 22, + FRAME_BADDY_DRAW_SWORD = 12, + FRAME_BADDY_RUN_TO_SOMERSAULT = 11, + FRAME_BADDY_SWORD_HIT_NO_DAMAGE_MAX = 12, + FRAME_BADDY_SWORD_HIT_DAMAGE_MIN = 13, + FRAME_BADDY_SWORD_HIT_DAMAGE_MAX = 21, + FRAME_BADDY_CROUCH_PICKUP = 9, + FRAME_BADDY_FIRE_MIN = 1, + FRAME_BADDY_FIRE_MAX = 13, + FRAME_BADDY_SOMERSAULT_START_TAKE_OFF = 18, +}; + +enum BADDY_SWAP_MESH_FLAGS { + SWAPMESHFLAGS_BADDY_EMPTY = 0x7FC800, + SWAPMESHFLAGS_BADDY_SWORD_SIMPLE = 0x7E0880, + SWAPMESHFLAGS_BADDY_SWORD_NINJA = 0x000880, + SWAPMESHFLAGS_BADDY_GUN = 0x7FC010, +}; BITE_INFO baddyGun = { 0, -16, 200, 11 }; BITE_INFO baddySword = { 0, 0, 0, 15 }; - - void ClampRotation(PHD_3DPOS *pos, short angle, short rot) { if (angle <= rot) @@ -36,15 +179,16 @@ void InitialiseBaddy(short itemNum) ClearItem(itemNum); short objectNumber = (Objects[ID_BADDY2].loaded ? ID_BADDY2 : ID_BADDY1); + if (item->objectNumber == ID_BADDY1) { - item->swapMeshFlags = 0x7FC010; + item->swapMeshFlags = SWAPMESHFLAGS_BADDY_GUN; item->meshBits = 0xFF81FFFF; item->itemFlags[2] = 24; } else { - item->swapMeshFlags = 0x880; + item->swapMeshFlags = SWAPMESHFLAGS_BADDY_SWORD_NINJA; item->meshBits = -1; item->itemFlags[2] = 0; } @@ -62,64 +206,64 @@ void InitialiseBaddy(short itemNum) if (!ocb || ocb > 4 && ocb < 7) { - item->animNumber = Objects[objectNumber].animIndex + 18; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_STAND_IDLE; item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 0; - item->currentAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; + item->currentAnimState = STATE_BADDY_STOP; return; } if (ocb == 1) { - item->animNumber = Objects[objectNumber].animIndex + 47; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_STAND_TO_JUMP_RIGHT; item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 24; - item->currentAnimState = 24; + item->goalAnimState = STATE_BADDY_JUMP_RIGHT; + item->currentAnimState = STATE_BADDY_JUMP_RIGHT; return; } if (ocb == 2) { - item->animNumber = Objects[objectNumber].animIndex + 24; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_STAND_TO_ROLL_LEFT; item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 23; - item->currentAnimState = 23; + item->goalAnimState = STATE_BADDY_ROLL_LEFT; + item->currentAnimState = STATE_BADDY_ROLL_LEFT; return; } if (ocb == 3) { - item->animNumber = Objects[objectNumber].animIndex + 29; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_CROUCH; item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 26; - item->currentAnimState = 26; + item->goalAnimState = STATE_BADDY_CROUCH; + item->currentAnimState = STATE_BADDY_CROUCH; return; } if (ocb == 4) { - item->animNumber = Objects[objectNumber].animIndex + 62; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_CLIMB_4_CLICKS; item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 39; - item->currentAnimState = 39; - item->pos.xPos += phd_sin(item->pos.yRot) * 1024 >> 14;; - item->pos.zPos += phd_cos(item->pos.yRot) * 1024 >> 14;; + item->goalAnimState = STATE_BADDY_CLIMB_4_CLICKS; + item->currentAnimState = STATE_BADDY_CLIMB_4_CLICKS; + item->pos.xPos += phd_sin(item->pos.yRot) * (STEP_SIZE * 4) >> W2V_SHIFT; + item->pos.zPos += phd_cos(item->pos.yRot) * (STEP_SIZE * 4) >> W2V_SHIFT; return; } if (ocb > 100) { - item->animNumber = Objects[objectNumber].animIndex + 29; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_CROUCH; item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 26; - item->currentAnimState = 26; - item->pos.xPos += phd_sin(item->pos.yRot) * 1024 >> 14;; - item->pos.zPos += phd_cos(item->pos.yRot) * 1024 >> 14;; + item->goalAnimState = STATE_BADDY_CROUCH; + item->currentAnimState = STATE_BADDY_CROUCH; + item->pos.xPos += phd_sin(item->pos.yRot) * (STEP_SIZE * 4) >> W2V_SHIFT; + item->pos.zPos += phd_cos(item->pos.yRot) * (STEP_SIZE * 4) >> W2V_SHIFT; item->itemFlags[3] = ocb; return; @@ -168,8 +312,8 @@ void BaddyControl(short itemNum) int y = item->pos.yPos; int z = item->pos.zPos; - int dx = 942 * phd_sin(item->pos.yRot) >> 14; - int dz = 942 * phd_cos(item->pos.yRot) >> 14; + int dx = 942 * phd_sin(item->pos.yRot) >> W2V_SHIFT; + int dz = 942 * phd_cos(item->pos.yRot) >> W2V_SHIFT; x += dx; z += dz; @@ -195,9 +339,9 @@ void BaddyControl(short itemNum) int height = 0; bool canJump1sector = true; if (enemyItem && item->boxNumber == enemyItem->boxNumber - || y >= height1 - 384 - || y >= height2 + 256 - || y <= height2 - 256) + || y >= height1 - (STEP_SIZE * 1.5f) + || y >= height2 + STEP_SIZE + || y <= height2 - STEP_SIZE) { height = height2; canJump1sector = false; @@ -205,18 +349,18 @@ void BaddyControl(short itemNum) bool canJump2sectors = true; if (enemyItem && item->boxNumber == enemyItem->boxNumber - || y >= height1 - 384 - || y >= height - 384 - || y >= height3 + 256 - || y <= height3 - 256) + || y >= height1 - (STEP_SIZE * 1.5f) + || y >= height - (STEP_SIZE * 1.5f) + || y >= height3 + STEP_SIZE + || y <= height3 - STEP_SIZE) { canJump2sectors = false; } CREATURE_INFO* currentCreature; - if (item->itemFlags[1] == item->roomNumber || - Rooms[item->roomNumber].flippedRoom == -1) + if (item->itemFlags[1] == item->roomNumber + || Rooms[item->roomNumber].flippedRoom == -1) { currentCreature = creature; } @@ -254,7 +398,7 @@ void BaddyControl(short itemNum) switch (item->currentAnimState) { - case 32: + case STATE_BADDY_DEATH: item->gravityStatus = true; currentCreature->LOT.isMonkeying = false; if (item->pos.yPos >= item->floor) @@ -265,40 +409,40 @@ void BaddyControl(short itemNum) } break; - case 35: - item->goalAnimState = 36; + case STATE_BADDY_MONKEY_TO_FREEFALL: + item->goalAnimState = STATE_BADDY_FREEFALL; item->gravityStatus = false; break; - case 36: + case STATE_BADDY_FREEFALL: item->gravityStatus = true; if (item->pos.yPos >= item->floor) { item->pos.yPos = item->floor; item->fallspeed = 0; item->gravityStatus = false; - item->goalAnimState = 37; + item->goalAnimState = STATE_BADDY_FREEFALL_LAND_DEATH; } break; - case 37: + case STATE_BADDY_FREEFALL_LAND_DEATH: item->pos.yPos = item->floor; break; - case 18: - case 19: - case 20: - item->animNumber = Objects[objectNumber].animIndex + 59; + case STATE_BADDY_MONKEY_GRAB: + case STATE_BADDY_MONKEY_IDLE: + case STATE_BADDY_MONKEY_FORWARD: + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_MONKEY_TO_FREEFALL; item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = 35; + item->currentAnimState = STATE_BADDY_MONKEY_TO_FREEFALL; item->speed = 0; break; default: currentCreature->LOT.isJumping = true; - item->animNumber = Objects[objectNumber].animIndex + 45; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_STAND_DEATH; item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = 32; + item->currentAnimState = STATE_BADDY_DEATH; // TODO: baddy respawn setup with OCB break; @@ -329,7 +473,7 @@ void BaddyControl(short itemNum) laraInfo.angle = phd_atan(dz, dx) - item->pos.yRot; laraInfo.ahead = true; - if (laraInfo.angle <= -16384 || laraInfo.angle >= 16384) + if (laraInfo.angle <= -ANGLE(90) || laraInfo.angle >= ANGLE(90)) laraInfo.ahead = false; laraInfo.distance = dx * dx + dz * dz; @@ -348,20 +492,22 @@ void BaddyControl(short itemNum) //currentCreature->enemy = LaraItem; // Is baddy alerted? - if (item->hitStatus || laraInfo.distance < SQUARE(1024) || TargetVisible(item, &laraInfo) && abs(LaraItem->pos.yPos - item->pos.yPos) < 1024) + if (item->hitStatus + || laraInfo.distance < SQUARE(1024) + || TargetVisible(item, &laraInfo) && abs(LaraItem->pos.yPos - item->pos.yPos) < STEP_SIZE * 4) { currentCreature->alerted = true; } if (item != Lara.target || laraInfo.distance <= 942 || - laraInfo.angle <= -10240 || laraInfo.angle >= 10240) + laraInfo.angle <= -ANGLE(56.25f) || laraInfo.angle >= ANGLE(56.25f)) { roll = false; jump = false; } - dx = 942 * phd_sin(item->pos.yRot + ANGLE(45)) >> 14; - dz = 942 * phd_cos(item->pos.yRot + ANGLE(45)) >> 14; + dx = 942 * phd_sin(item->pos.yRot + ANGLE(45)) >> W2V_SHIFT; + dz = 942 * phd_cos(item->pos.yRot + ANGLE(45)) >> W2V_SHIFT; x = item->pos.xPos + dx; y = item->pos.yPos; @@ -371,8 +517,8 @@ void BaddyControl(short itemNum) floor = GetFloor(x, y, z, &roomNumber); int height4 = GetFloorHeight(floor, x, y, z); - dx = 942 * phd_sin(item->pos.yRot + 14336) >> 14; - dz = 942 * phd_cos(item->pos.yRot + 14336) >> 14; + dx = 942 * phd_sin(item->pos.yRot + ANGLE(78.75f)) >> W2V_SHIFT; + dz = 942 * phd_cos(item->pos.yRot + ANGLE(78.75f)) >> W2V_SHIFT; x = item->pos.xPos + dx; y = item->pos.yPos; @@ -382,7 +528,7 @@ void BaddyControl(short itemNum) floor = GetFloor(x, y, z, &roomNumber); int height5 = GetFloorHeight(floor, x, y, z); - if (abs(height5 - item->pos.yPos) > 256) + if (abs(height5 - item->pos.yPos) > STEP_SIZE) jump = false; else { @@ -391,8 +537,8 @@ void BaddyControl(short itemNum) jump = false; } - dx = 942 * phd_sin(item->pos.yRot - 8192) >> 14; - dz = 942 * phd_cos(item->pos.yRot - 8192) >> 14; + dx = 942 * phd_sin(item->pos.yRot - ANGLE(45)) >> W2V_SHIFT; + dz = 942 * phd_cos(item->pos.yRot - ANGLE(45)) >> W2V_SHIFT; x = item->pos.xPos + dx; y = item->pos.yPos; @@ -402,8 +548,8 @@ void BaddyControl(short itemNum) floor = GetFloor(x, y, z, &roomNumber); int height6 = GetFloorHeight(floor, x, y, z); - dx = 942 * phd_sin(item->pos.yRot - 14336) >> 14; - dz = 942 * phd_cos(item->pos.yRot - 14336) >> 14; + dx = 942 * phd_sin(item->pos.yRot - ANGLE(78.75f)) >> W2V_SHIFT; + dz = 942 * phd_cos(item->pos.yRot - ANGLE(78.75f)) >> W2V_SHIFT; x = item->pos.xPos + dx; y = item->pos.yPos; @@ -413,7 +559,7 @@ void BaddyControl(short itemNum) floor = GetFloor(x, y, z, &roomNumber); int height7 = GetFloorHeight(floor, x, y, z); - if (abs(height7 - item->pos.yPos) > 256 || height6 + 512 >= item->pos.yPos) + if (abs(height7 - item->pos.yPos) > STEP_SIZE || height6 + (STEP_SIZE * 2) >= item->pos.yPos) { roll = false; someFlag3 = false; @@ -425,7 +571,7 @@ void BaddyControl(short itemNum) switch (item->currentAnimState) { - case 0: + case STATE_BADDY_STOP: currentCreature->LOT.isMonkeying = false; currentCreature->LOT.isJumping = false; currentCreature->flags = 0; @@ -444,37 +590,37 @@ void BaddyControl(short itemNum) break; } - if (item->swapMeshFlags == 2176 + if (item->swapMeshFlags == SWAPMESHFLAGS_BADDY_SWORD_NINJA && item == Lara.target && laraInfo.ahead && laraInfo.distance > SQUARE(682)) { - item->goalAnimState = 4; + item->goalAnimState = STATE_BADDY_DODGE_START; break; } if (Targetable(item, &info) && item->itemFlags[2] > 0) { - if (item->swapMeshFlags == 0x7FC010) + if (item->swapMeshFlags == SWAPMESHFLAGS_BADDY_GUN) { - item->goalAnimState = 31; + item->goalAnimState = STATE_BADDY_AIM; break; } - if (item->swapMeshFlags != 0x7E0880 && item->swapMeshFlags != 2176) + if (item->swapMeshFlags != SWAPMESHFLAGS_BADDY_SWORD_SIMPLE && item->swapMeshFlags != SWAPMESHFLAGS_BADDY_SWORD_NINJA) { - item->goalAnimState = 10; + item->goalAnimState = STATE_BADDY_DRAW_GUN; break; } - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; } if (item->aiBits & MODIFY) { - item->goalAnimState = 0; - if (item->floor > item->pos.yPos + 768) + item->goalAnimState = STATE_BADDY_STOP; + if (item->floor > item->pos.yPos + (STEP_SIZE * 3)) item->aiBits &= ~MODIFY; break; } @@ -482,15 +628,15 @@ void BaddyControl(short itemNum) if (canJump1sector || canJump2sectors) { currentCreature->maximumTurn = 0; - item->animNumber = Objects[objectNumber].animIndex + 55; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_STAND_TO_JUMP_FORWARD; item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = 33; + item->currentAnimState = STATE_BADDY_JUMP_FORWARD_1_BLOCK; currentCreature->LOT.isJumping = true; if (!canJump2sectors) - item->goalAnimState = 33; + item->goalAnimState = STATE_BADDY_JUMP_FORWARD_1_BLOCK; else - item->goalAnimState = 38; + item->goalAnimState = STATE_BADDY_JUMP_FORWARD_2_BLOCKS; break; } @@ -499,15 +645,15 @@ void BaddyControl(short itemNum) short objNum = currentCreature->enemy->objectNumber; if ((objNum == ID_SMALLMEDI_ITEM || objNum == ID_UZI_AMMO_ITEM) && info.distance < 0x40000) { - item->goalAnimState = 25; - item->requiredAnimState = 27; + item->goalAnimState = STATE_BADDY_STAND_TO_CROUCH; + item->requiredAnimState = STATE_BADDY_CROUCH_PICKUP; break; } } - if (item->swapMeshFlags == 0x7FC010 && item->itemFlags[2] < 1) + if (item->swapMeshFlags == SWAPMESHFLAGS_BADDY_GUN && item->itemFlags[2] < 1) { - item->goalAnimState = 11; + item->goalAnimState = STATE_BADDY_HOLSTER_GUN; break; } @@ -515,20 +661,20 @@ void BaddyControl(short itemNum) { floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - if (GetCeiling(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos) == height - 1536) + if (GetCeiling(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos) == height - (STEP_SIZE * 6)) { - if (item->swapMeshFlags == 0x7FC800) + if (item->swapMeshFlags == SWAPMESHFLAGS_BADDY_EMPTY) { - item->goalAnimState = 18; + item->goalAnimState = STATE_BADDY_MONKEY_GRAB; break; } - if (item->swapMeshFlags == 0x7FC010) + if (item->swapMeshFlags == SWAPMESHFLAGS_BADDY_GUN) { - item->goalAnimState = 11; + item->goalAnimState = STATE_BADDY_HOLSTER_GUN; break; } - item->goalAnimState = 13; + item->goalAnimState = STATE_BADDY_HOLSTER_SWORD; break; } } @@ -537,45 +683,45 @@ void BaddyControl(short itemNum) if (roll) { currentCreature->maximumTurn = 0; - item->goalAnimState = 23; + item->goalAnimState = STATE_BADDY_ROLL_LEFT; break; } if (jump) { currentCreature->maximumTurn = 0; - item->goalAnimState = 24; + item->goalAnimState = STATE_BADDY_JUMP_RIGHT; break; } - if (item->swapMeshFlags == 0x7FC800) + if (item->swapMeshFlags == SWAPMESHFLAGS_BADDY_EMPTY) { - item->goalAnimState = 12; + item->goalAnimState = STATE_BADDY_DRAW_SWORD; break; } if (currentCreature->enemy && currentCreature->enemy->hitPoints > 0 && info.distance < SQUARE(682)) { - if (item->swapMeshFlags == 0x7FC010) + if (item->swapMeshFlags == SWAPMESHFLAGS_BADDY_GUN) { - item->goalAnimState = 11; + item->goalAnimState = STATE_BADDY_HOLSTER_GUN; } else if (info.distance >= 0x40000) { - item->goalAnimState = 15; + item->goalAnimState = STATE_BADDY_SWORD_HIT_FRONT; } else if (GetRandomControl() & 1) { - item->goalAnimState = 17; + item->goalAnimState = STATE_BADDY_SWORD_HIT_LEFT; } else { - item->goalAnimState = 16; + item->goalAnimState = STATE_BADDY_SWORD_HIT_RIGHT; } break; } } - item->goalAnimState = 1; + item->goalAnimState = STATE_BADDY_WALK; break; - case 1: + case STATE_BADDY_WALK: currentCreature->LOT.isMonkeying = false; currentCreature->LOT.isJumping = false; currentCreature->maximumTurn = ANGLE(7); @@ -591,61 +737,61 @@ void BaddyControl(short itemNum) } if (Targetable(item, &info) && item->itemFlags[2] > 0) { - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; } if (canJump1sector || canJump2sectors) { currentCreature->maximumTurn = 0; - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; } if (currentCreature->reachedGoal && currentCreature->monkeyAhead) { - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; } if (item->itemFlags[2] < 1) { - if (item->swapMeshFlags != 0x7E0880 && item->swapMeshFlags != 2176) + if (item->swapMeshFlags != SWAPMESHFLAGS_BADDY_SWORD_SIMPLE && item->swapMeshFlags != SWAPMESHFLAGS_BADDY_SWORD_NINJA) { - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; } } if (info.ahead && info.distance < 0x40000) { - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; } if (info.bite) { if (info.distance < SQUARE(482)) { - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; } if (info.distance < SQUARE(1024)) { - item->goalAnimState = 29; + item->goalAnimState = STATE_BADDY_WALK_SWORD_HIT_RIGHT; break; } } if (roll || jump) { - item->currentAnimState = 0; + item->currentAnimState = STATE_BADDY_STOP; break; } if (currentCreature->mood == ATTACK_MOOD && !(currentCreature->jumpAhead) && info.distance > SQUARE(1024)) { - item->goalAnimState = 2; + item->goalAnimState = STATE_BADDY_RUN; } break; - case 2: + case STATE_BADDY_RUN: if (info.ahead) { joint3 = info.angle; @@ -653,14 +799,14 @@ void BaddyControl(short itemNum) currentCreature->maximumTurn = ANGLE(11); tilt = abs(angle) / 2; if (objectNumber == ID_BADDY2 - && item->frameNumber == Anims[item->animNumber].frameBase + 11 + && item->frameNumber == Anims[item->animNumber].frameBase + FRAME_BADDY_RUN_TO_SOMERSAULT && height3 == height1 - && abs(height1 - item->pos.yPos) < 384 - && (info.angle > -4096 && info.angle < 4096 && + && abs(height1 - item->pos.yPos) < STEP_SIZE * 1.5f + && (info.angle > -ANGLE(22.5f) && info.angle < ANGLE(22.5f) && info.distance < SQUARE(3072) || height2 >= height1 + 512)) { - item->goalAnimState = 30; + item->goalAnimState = STATE_BADDY_SOMERSAULT; currentCreature->maximumTurn = 0; break; } @@ -673,24 +819,24 @@ void BaddyControl(short itemNum) || info.distance < SQUARE(614) || currentCreature->jumpAhead) { - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; } if (info.distance < SQUARE(1024)) { - item->goalAnimState = 1; + item->goalAnimState = STATE_BADDY_WALK; break; } break; - case 16: - case 15: - case 17: - case 29: - if (item->currentAnimState == 16 && + case STATE_BADDY_SWORD_HIT_RIGHT: + case STATE_BADDY_SWORD_HIT_FRONT: + case STATE_BADDY_SWORD_HIT_LEFT: + case STATE_BADDY_WALK_SWORD_HIT_RIGHT: + if (item->currentAnimState == STATE_BADDY_SWORD_HIT_RIGHT && info.distance < 0x40000) { - item->goalAnimState = 17; + item->goalAnimState = STATE_BADDY_SWORD_HIT_LEFT; } if (info.ahead) { @@ -698,8 +844,8 @@ void BaddyControl(short itemNum) joint2 = info.xAngle; } currentCreature->maximumTurn = 0; - if (item->currentAnimState != 15 || - item->frameNumber < Anims[item->animNumber].frameBase + 12) + if (item->currentAnimState != STATE_BADDY_SWORD_HIT_FRONT || + item->frameNumber < Anims[item->animNumber].frameBase + FRAME_BADDY_SWORD_HIT_NO_DAMAGE_MAX) { if (abs(info.angle) >= ANGLE(7)) { @@ -721,8 +867,8 @@ void BaddyControl(short itemNum) { if (item->touchBits & 0x1C000) { - if (item->frameNumber > Anims[item->animNumber].frameBase + 13 && - item->frameNumber < Anims[item->animNumber].frameBase + 21) + if (item->frameNumber > Anims[item->animNumber].frameBase + FRAME_BADDY_SWORD_HIT_DAMAGE_MIN && + item->frameNumber < Anims[item->animNumber].frameBase + FRAME_BADDY_SWORD_HIT_DAMAGE_MAX) { LaraItem->hitPoints -= 120; LaraItem->hitStatus = true; @@ -742,7 +888,7 @@ void BaddyControl(short itemNum) } break; - case 19: + case STATE_BADDY_MONKEY_IDLE: joint2 = 0; joint1 = 0; currentCreature->maximumTurn = 0; @@ -753,28 +899,31 @@ void BaddyControl(short itemNum) if (laraInfo.ahead && laraInfo.distance < SQUARE(682) - && (LaraItem->currentAnimState > 74 - && LaraItem->currentAnimState < 80 - || LaraItem->currentAnimState == 82 - || LaraItem->currentAnimState == 83)) + && (LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_IDLE + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_FORWARD + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_LEFT + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_RIGHT + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_TURNAROUND + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_TURN_LEFT + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_TURN_RIGHT)) { - item->goalAnimState = 21; + item->goalAnimState = STATE_BADDY_MONKEY_PUSH_OFF; } else if (item->boxNumber != currentCreature->LOT.targetBox && currentCreature->monkeyAhead - || GetCeiling(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos) != height - 1536) + || GetCeiling(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos) != height - (STEP_SIZE * 6)) { - item->goalAnimState = 20; + item->goalAnimState = STATE_BADDY_MONKEY_FORWARD; } else { - item->goalAnimState = 22; + item->goalAnimState = STATE_BADDY_MONKEY_FALL_LAND; currentCreature->LOT.isMonkeying = false; currentCreature->LOT.isJumping = false; } break; - case 20: + case STATE_BADDY_MONKEY_FORWARD: joint2 = 0; joint1 = 0; currentCreature->LOT.isJumping = true; @@ -786,9 +935,9 @@ void BaddyControl(short itemNum) { floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - if (GetCeiling(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos) == height - 1536) + if (GetCeiling(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos) == height - (STEP_SIZE * 6)) { - item->goalAnimState = 19; + item->goalAnimState = STATE_BADDY_MONKEY_IDLE; } } if (laraInfo.ahead) @@ -796,60 +945,63 @@ void BaddyControl(short itemNum) if (laraInfo.distance < SQUARE(682)) { - if (LaraItem->currentAnimState > 74 && - LaraItem->currentAnimState < 80 || - LaraItem->currentAnimState == 82 || - LaraItem->currentAnimState == 83) + if (LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_IDLE + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_FORWARD + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_LEFT + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_RIGHT + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_TURNAROUND + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_TURN_LEFT + || LaraItem->currentAnimState == STATE_LARA_MONKEYSWING_TURN_RIGHT) { - item->goalAnimState = 19; + item->goalAnimState = STATE_BADDY_MONKEY_IDLE; } } } break; - case 21: + case STATE_BADDY_MONKEY_PUSH_OFF: currentCreature->maximumTurn = ANGLE(7); if (currentCreature->flags == someFlag3) { if (item->touchBits) { - LaraItem->currentAnimState = 28; - LaraItem->goalAnimState = 28; - LaraItem->animNumber = 28; + LaraItem->currentAnimState = STATE_LARA_JUMP_UP; + LaraItem->goalAnimState = STATE_LARA_JUMP_UP; + LaraItem->animNumber = ANIMATION_LARA_TRY_HANG_VERTICAL; LaraItem->frameNumber = Anims[LaraItem->frameNumber].frameBase + 9; LaraItem->gravityStatus = true; LaraItem->speed = 2; LaraItem->fallspeed = 1; - LaraItem->pos.yPos += 192; + LaraItem->pos.yPos += (STEP_SIZE * 0.75f); Lara.gunStatus = 0; currentCreature->flags = 1; } } break; - case 23: - case 24: + case STATE_BADDY_ROLL_LEFT: + case STATE_BADDY_JUMP_RIGHT: currentCreature->alerted = false; currentCreature->maximumTurn = someFlag3; item->status = ITEM_ACTIVE; break; - case 26: + case STATE_BADDY_CROUCH: if (item->itemFlags[0] == someFlag3) { if (currentCreature->enemy) { - if ((currentCreature->enemy->objectNumber == ID_SMALLMEDI_ITEM || - currentCreature->enemy->objectNumber == ID_UZI_AMMO_ITEM) && - info.distance < 0x40000) + if ((currentCreature->enemy->objectNumber == ID_SMALLMEDI_ITEM + || currentCreature->enemy->objectNumber == ID_UZI_AMMO_ITEM) + && info.distance < 0x40000) { - item->goalAnimState = 27; + item->goalAnimState = STATE_BADDY_CROUCH_PICKUP; break; } } if (currentCreature->alerted) { - item->goalAnimState = 28; + item->goalAnimState = STATE_BADDY_CROUCH_TO_STAND; } } else @@ -858,14 +1010,14 @@ void BaddyControl(short itemNum) { break; } - item->goalAnimState = 28; + item->goalAnimState = STATE_BADDY_CROUCH_TO_STAND; currentCreature->enemy = NULL; } break; - case 27: + case STATE_BADDY_CROUCH_PICKUP: ClampRotation(&item->pos, info.angle, ANGLE(11)); - if (item->frameNumber != Anims[item->animNumber].frameBase + 9) + if (item->frameNumber != Anims[item->animNumber].frameBase + FRAME_BADDY_CROUCH_PICKUP) { break; } @@ -878,7 +1030,7 @@ void BaddyControl(short itemNum) { break; } - if (currentCreature->enemy->roomNumber == 255 || + if (currentCreature->enemy->roomNumber == NO_ROOM || currentCreature->enemy->status == ITEM_INVISIBLE || currentCreature->enemy->inDrawRoom) { @@ -917,7 +1069,7 @@ void BaddyControl(short itemNum) creature2->enemy = 0;*/ break; - case 31: + case STATE_BADDY_AIM: currentCreature->maximumTurn = 0; if (info.ahead) { @@ -925,24 +1077,24 @@ void BaddyControl(short itemNum) joint2 = info.xAngle; } ClampRotation(&item->pos, info.angle, ANGLE(7)); - if (!Targetable(item, &info) || - item->itemFlags[2] < 1) + if (!Targetable(item, &info) + || item->itemFlags[2] < 1) { - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; } - item->goalAnimState = 14; + item->goalAnimState = STATE_BADDY_FIRE; break; - case 14: + case STATE_BADDY_FIRE: if (info.ahead) { joint1 = info.angle; joint2 = info.xAngle; } ClampRotation(&item->pos, info.angle, ANGLE(7)); - if (item->frameNumber >= Anims[item->animNumber].frameBase + 13 || - item->frameNumber == Anims[item->animNumber].frameBase + 1) + if (item->frameNumber >= Anims[item->animNumber].frameBase + FRAME_BADDY_FIRE_MAX || + item->frameNumber == Anims[item->animNumber].frameBase + FRAME_BADDY_FIRE_MIN) { break; } @@ -952,89 +1104,88 @@ void BaddyControl(short itemNum) item->itemFlags[2]--; } if (!ShotLara(item, &info, &baddyGun, joint1, 15)); - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; break; default: break; - case 11: - //printf("%d %d\n", item->frameNumber, Anims[item->animNumber].frameBase + 20); - if (item->frameNumber == Anims[item->animNumber].frameBase + 20) + case STATE_BADDY_HOLSTER_GUN: + if (item->frameNumber == Anims[item->animNumber].frameBase + FRAME_BADDY_HOLSTER_GUN) { - item->swapMeshFlags = 0x7FC800; + item->swapMeshFlags = SWAPMESHFLAGS_BADDY_EMPTY; } break; - case 10: - if (item->frameNumber == Anims[item->animNumber].frameBase + 21) + case STATE_BADDY_DRAW_GUN: + if (item->frameNumber == Anims[item->animNumber].frameBase + FRAME_BADDY_DRAW_GUN) { - item->swapMeshFlags = 0x7FC010; + item->swapMeshFlags = SWAPMESHFLAGS_BADDY_GUN; } break; - case 13: - if (item->frameNumber == Anims[item->animNumber].frameBase + 22) + case STATE_BADDY_HOLSTER_SWORD: + if (item->frameNumber == Anims[item->animNumber].frameBase + FRAME_BADDY_HOLSTER_SWORD) { - item->swapMeshFlags = 0x7FC800; + item->swapMeshFlags = SWAPMESHFLAGS_BADDY_EMPTY; } break; - case 12: - if (item->frameNumber != Anims[item->animNumber].frameBase + 12) + case STATE_BADDY_DRAW_SWORD: + if (item->frameNumber != Anims[item->animNumber].frameBase + FRAME_BADDY_DRAW_SWORD) { break; } if (item->objectNumber == ID_BADDY1) { - item->swapMeshFlags = 0x7E0880; + item->swapMeshFlags = SWAPMESHFLAGS_BADDY_SWORD_SIMPLE; } else { - item->swapMeshFlags = 2176; + item->swapMeshFlags = SWAPMESHFLAGS_BADDY_SWORD_NINJA; } break; - case 8: + case STATE_BADDY_UNKNOWN_8: currentCreature->maximumTurn = 0; ClampRotation(&item->pos, info.angle, ANGLE(11)); if (laraInfo.distance < SQUARE(682) || item != Lara.target) { - item->goalAnimState = 9; + item->goalAnimState = STATE_BADDY_UNKNOWN_9; } break; - case 44: + case STATE_BADDY_BLIND: if (!WeaponEnemyTimer) { if ((GetRandomControl() & 0x7F) == 0) { - item->goalAnimState = 0; + item->goalAnimState = STATE_BADDY_STOP; } } break; - case 30: - if (item->animNumber == Objects[objectNumber].animIndex + 4) + case STATE_BADDY_SOMERSAULT: + if (item->animNumber == Objects[objectNumber].animIndex + ANIMATION_BADDY_SOMERSAULT_END) { ClampRotation(&item->pos, info.angle, ANGLE(7)); break; } - if (item->frameNumber != Anims[item->animNumber].frameBase + 18) + if (item->frameNumber != Anims[item->animNumber].frameBase + FRAME_BADDY_SOMERSAULT_START_TAKE_OFF) { break; } currentCreature->LOT.isJumping = true; break; - case 33: - case 38: + case STATE_BADDY_JUMP_FORWARD_1_BLOCK: + case STATE_BADDY_JUMP_FORWARD_2_BLOCKS: if (item->itemFlags[0] >= someFlag3) { break; } - if (item->animNumber != Objects[objectNumber].animIndex + 55) + if (item->animNumber != Objects[objectNumber].animIndex + ANIMATION_BADDY_STAND_TO_JUMP_FORWARD) { item->itemFlags[0] += 2; } @@ -1047,12 +1198,12 @@ void BaddyControl(short itemNum) CreatureJoint(item, 1, joint2); CreatureJoint(item, 2, joint3); - if (item->currentAnimState >= 38 || - item->currentAnimState == 33 || - item->currentAnimState == 20 || - item->currentAnimState == 32 || - item->currentAnimState == 30 || - item->currentAnimState == 44) + if (item->currentAnimState >= STATE_BADDY_JUMP_FORWARD_2_BLOCKS || + item->currentAnimState == STATE_BADDY_JUMP_FORWARD_1_BLOCK || + item->currentAnimState == STATE_BADDY_MONKEY_FORWARD || + item->currentAnimState == STATE_BADDY_DEATH || + item->currentAnimState == STATE_BADDY_SOMERSAULT || + item->currentAnimState == STATE_BADDY_BLIND) { CreatureAnimation(itemNum, angle, 0); } @@ -1064,36 +1215,36 @@ void BaddyControl(short itemNum) { case 2: creature->maximumTurn = 0; - item->animNumber = Objects[objectNumber].animIndex + 64; - item->currentAnimState = 41; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_CLIMB_2_CLICKS; + item->currentAnimState = STATE_BADDY_CLIMB_2_CLICKS; item->frameNumber = Anims[item->animNumber].frameBase; break; case 3: creature->maximumTurn = 0; - item->animNumber = Objects[objectNumber].animIndex + 63; - item->currentAnimState = 40; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_CLIMB_3_CLICKS; + item->currentAnimState = STATE_BADDY_CLIMB_3_CLICKS; item->frameNumber = Anims[item->animNumber].frameBase; break; case 4: creature->maximumTurn = 0; - item->animNumber = Objects[objectNumber].animIndex + 62; - item->currentAnimState = 39; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_CLIMB_4_CLICKS; + item->currentAnimState = STATE_BADDY_CLIMB_4_CLICKS; item->frameNumber = Anims[item->animNumber].frameBase; break; case -3: creature->maximumTurn = 0; - item->animNumber = Objects[objectNumber].animIndex + 66; - item->currentAnimState = 43; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_JUMP_OFF_3_CLICKS; + item->currentAnimState = STATE_BADDY_JUMP_OFF_3_CLICKS; item->frameNumber = Anims[item->animNumber].frameBase; break; case -4: creature->maximumTurn = 0; - item->animNumber = Objects[objectNumber].animIndex + 65; - item->currentAnimState = 42; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_JUMP_OFF_4_CLICKS; + item->currentAnimState = STATE_BADDY_JUMP_OFF_4_CLICKS; item->frameNumber = Anims[item->animNumber].frameBase; break; @@ -1104,9 +1255,9 @@ void BaddyControl(short itemNum) else { creature->maximumTurn = 0; - item->animNumber = Objects[objectNumber].animIndex + 68; + item->animNumber = Objects[objectNumber].animIndex + ANIMATION_BADDY_BLIND; item->frameNumber = Anims[item->animNumber].frameBase + (GetRandomControl() & 7); - item->currentAnimState = 44; + item->currentAnimState = STATE_BADDY_BLIND; } return; diff --git a/TR5Main/Objects/TR4/Entity/tr4_baddy.h b/TR5Main/Objects/TR4/Entity/tr4_baddy.h new file mode 100644 index 000000000..abadaa807 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_baddy.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseBaddy(short itemNum); +void BaddyControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_bat.cpp b/TR5Main/Objects/TR4/Entity/tr4_bat.cpp similarity index 87% rename from TR5Main/Objects/TR4/tr4_bat.cpp rename to TR5Main/Objects/TR4/Entity/tr4_bat.cpp index d68067cdd..0e73c0b2e 100644 --- a/TR5Main/Objects/TR4/tr4_bat.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_bat.cpp @@ -1,19 +1,20 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/items.h" -#include "../../Specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr4_bat.h" +#include "box.h" +#include "effect.h" +#include "items.h" +#include "setup.h" +#include "lot.h" +#include "level.h" +#include "lara.h" BITE_INFO batBite = { 0, 16, 45, 4 }; -void InitialiseBat(short itemNum) +void InitialiseBat(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); item->animNumber = Objects[ID_BAT].animIndex + 5; item->frameNumber = Anims[item->animNumber].frameBase; @@ -21,12 +22,12 @@ void InitialiseBat(short itemNum) item->currentAnimState = 6; } -void BatControl(short itemNum) +void BatControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; short angle = 0; short head = 0; @@ -57,7 +58,7 @@ void BatControl(short itemNum) for (int i = 0; i < NUM_SLOTS; i++, baddie++) { - if (baddie->itemNum == NO_ITEM || baddie->itemNum == itemNum) + if (baddie->itemNum == NO_ITEM || baddie->itemNum == itemNumber) continue; ITEM_INFO* target = &Items[baddie->itemNum]; @@ -158,5 +159,5 @@ void BatControl(short itemNum) } } - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_bat.h b/TR5Main/Objects/TR4/Entity/tr4_bat.h new file mode 100644 index 000000000..17c3959aa --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_bat.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseBat(short itemNumber); +void BatControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_bigscorpion.cpp b/TR5Main/Objects/TR4/Entity/tr4_bigscorpion.cpp similarity index 92% rename from TR5Main/Objects/TR4/tr4_bigscorpion.cpp rename to TR5Main/Objects/TR4/Entity/tr4_bigscorpion.cpp index ea11f7c58..4bef3538c 100644 --- a/TR5Main/Objects/TR4/tr4_bigscorpion.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_bigscorpion.cpp @@ -1,20 +1,21 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/items.h" -#include "../../Specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr4_bigscorpion.h" +#include "box.h" +#include "effect.h" +#include "items.h" +#include "setup.h" +#include "lot.h" +#include "level.h" +#include "lara.h" BITE_INFO scorpionBite1 = { 0, 0, 0, 8 }; BITE_INFO scorpionBite2 = { 0, 0, 0, 23 }; -void InitialiseScorpion(short itemNum) +void InitialiseScorpion(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); if (item->triggerFlags == 1) { @@ -32,12 +33,12 @@ void InitialiseScorpion(short itemNum) item->frameNumber = Anims[item->animNumber].frameBase; } -void ScorpionControl(short itemNum) +void ScorpionControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; short angle = 0; short head = 0; @@ -114,7 +115,7 @@ void ScorpionControl(short itemNum) { baddy = &BaddieSlots[i]; - if (baddy->itemNum != NO_ITEM && baddy->itemNum != itemNum) + if (baddy->itemNum != NO_ITEM && baddy->itemNum != itemNumber) { ITEM_INFO* currentItem = &Items[baddy->itemNum]; @@ -327,5 +328,5 @@ void ScorpionControl(short itemNum) item->pos.zRot += 256; } - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_bigscorpion.h b/TR5Main/Objects/TR4/Entity/tr4_bigscorpion.h new file mode 100644 index 000000000..f479f56ee --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_bigscorpion.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseScorpion(short itemNumber); +void ScorpionControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_crocodile.cpp b/TR5Main/Objects/TR4/Entity/tr4_crocodile.cpp similarity index 93% rename from TR5Main/Objects/TR4/tr4_crocodile.cpp rename to TR5Main/Objects/TR4/Entity/tr4_crocodile.cpp index 44157307c..0f04bd459 100644 --- a/TR5Main/Objects/TR4/tr4_crocodile.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_crocodile.cpp @@ -1,21 +1,22 @@ -#include "../newobjects.h" -#include "../../Game/box.h" -#include "../../Game/effects.h" -#include "../../Game/people.h" -#include "../../Game/items.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr4_crocodile.h" +#include "box.h" +#include "effect.h" +#include "people.h" +#include "items.h" +#include "setup.h" +#include "level.h" +#include "lara.h" BITE_INFO crocodileBite = { 0, -156, 500, 9 }; -void InitialiseCrocodile(short itemNum) +void InitialiseCrocodile(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; ObjectInfo* obj = &Objects[item->objectNumber]; ROOM_INFO* room = &Rooms[item->roomNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); if (room->flags & ENV_FLAG_WATER) { @@ -33,12 +34,12 @@ void InitialiseCrocodile(short itemNum) } } -void CrocodileControl(short itemNum) +void CrocodileControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; ObjectInfo* obj = &Objects[item->objectNumber]; @@ -93,7 +94,7 @@ void CrocodileControl(short itemNum) } if (Rooms[item->roomNumber].flags & ENV_FLAG_WATER) - CreatureFloat(itemNum); + CreatureFloat(itemNumber); } else { @@ -114,7 +115,7 @@ void CrocodileControl(short itemNum) { if (!creature->alerted) creature->alerted = true; - AlertAllGuards(itemNum); + AlertAllGuards(itemNumber); } joint0 = 4 * angle; @@ -322,7 +323,7 @@ void CrocodileControl(short itemNum) if (item->currentAnimState < 8) item->pos.xRot = angle; - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); roomNumber = item->roomNumber; diff --git a/TR5Main/Objects/TR4/Entity/tr4_crocodile.h b/TR5Main/Objects/TR4/Entity/tr4_crocodile.h new file mode 100644 index 000000000..c703f79ac --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_crocodile.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseCrocodile(short itemNumber); +void CrocodileControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_demigod.cpp b/TR5Main/Objects/TR4/Entity/tr4_demigod.cpp similarity index 89% rename from TR5Main/Objects/TR4/tr4_demigod.cpp rename to TR5Main/Objects/TR4/Entity/tr4_demigod.cpp index abdc528b1..65838cd02 100644 --- a/TR5Main/Objects/TR4/tr4_demigod.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_demigod.cpp @@ -1,24 +1,254 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/draw.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/camera.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/effects.h" +#include "framework.h" +#include "tr4_demigod.h" +#include "items.h" +#include "box.h" +#include "people.h" +#include "sphere.h" +#include "effect2.h" +#include "draw.h" +#include "tomb4fx.h" +#include "camera.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "effect.h" extern SMOKE_SPARKS SmokeSparks[MAX_SPARKS_SMOKE]; -void InitialiseDemigod(short itemNum) +static void DemigodThrowEnergyAttack(PHD_3DPOS* pos, short roomNumber, int flags) { - ITEM_INFO* item = &Items[itemNum]; + short fxNum = CreateNewEffect(roomNumber); + if (fxNum != -1) + { + FX_INFO* fx = &Effects[fxNum]; - ClearItem(itemNum); + fx->pos.xPos = pos->xPos; + fx->pos.yPos = pos->yPos - (GetRandomControl() & 0x3F) - 32; + fx->pos.zPos = pos->zPos; + fx->pos.xRot = pos->xRot; + if (flags < 4) + { + fx->pos.yRot = pos->yRot; + } + else + { + fx->pos.yRot = pos->yRot + (GetRandomControl() & 0x7FF) - 1024; + } + + ObjectInfo* obj = &Objects[ID_ENERGY_BUBBLES]; + + fx->pos.zRot = 0; + fx->roomNumber = roomNumber; + fx->counter = 2 * GetRandomControl() + -ANGLE(180); + fx->flag1 = flags; + fx->speed = (GetRandomControl() & 0x1F) + 96; + fx->objectNumber = ID_ENERGY_BUBBLES; + if (flags >= 4) + flags--; + fx->frameNumber = Objects[ID_ENERGY_BUBBLES].meshIndex + 2 * flags; + } +} + +static void DemigodEnergyAttack(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + short animIndex = item->animNumber - Objects[item->objectNumber].animIndex; + + if (animIndex == 8) + { + if (item->frameNumber == Anims[item->animNumber].frameBase) + { + PHD_VECTOR pos1; + PHD_VECTOR pos2; + + pos1.x = -544; + pos1.y = 96; + pos1.z = 0; + + GetJointAbsPosition(item, &pos1, 16); + + pos2.x = -900; + pos2.y = 96; + pos2.z = 0; + + GetJointAbsPosition(item, &pos2, 16); + + short angles[2]; + phd_GetVectorAngles(pos2.x - pos1.x, pos2.y - pos1.y, pos2.z - pos1.z, angles); + + PHD_3DPOS pos; + pos.xPos = pos1.x; + pos.yPos = pos1.y; + pos.zPos = pos1.z; + pos.xRot = angles[1]; + pos.yRot = angles[0]; + pos.zRot = 0; + + if (item->objectNumber == ID_DEMIGOD3) + { + DemigodThrowEnergyAttack(&pos, item->roomNumber, 3); + } + else + { + DemigodThrowEnergyAttack(&pos, item->roomNumber, 5); + } + } + + return; + } + + if (animIndex != 16) + { + if (animIndex != 19) + return; + + if (item->frameNumber == Anims[item->animNumber].frameBase) + { + PHD_VECTOR pos1; + PHD_VECTOR pos2; + + pos1.x = -544; + pos1.y = 96; + pos1.z = 0; + + GetJointAbsPosition(item, &pos1, 16); + + pos2.x = -900; + pos2.y = 96; + pos2.z = 0; + + GetJointAbsPosition(item, &pos2, 16); + + short angles[2]; + phd_GetVectorAngles(pos2.x - pos1.x, pos2.y - pos1.y, pos2.z - pos1.z, angles); + + PHD_3DPOS pos; + pos.xPos = pos1.x; + pos.yPos = pos1.y; + pos.zPos = pos1.z; + pos.xRot = angles[1]; + pos.yRot = angles[0]; + pos.zRot = 0; + + if (item->objectNumber == ID_DEMIGOD3) + { + DemigodThrowEnergyAttack(&pos, item->roomNumber, 3); + } + else + { + DemigodThrowEnergyAttack(&pos, item->roomNumber, 5); + } + } + + return; + } + + // Animation 16 (State 10) is the big circle attack of DEMIGOD_3 + int frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; + + if (frameNumber >= 8 && frameNumber <= 64) + { + PHD_VECTOR pos1; + PHD_VECTOR pos2; + + pos1.x = 0; + pos1.y = 0; + pos1.z = 192; + + pos2.x = 0; + pos2.y = 0; + pos2.z = 384; + + if (GlobalCounter & 1) + { + GetJointAbsPosition(item, &pos1, 18); + GetJointAbsPosition(item, &pos2, 18); + } + else + { + GetJointAbsPosition(item, &pos1, 17); + GetJointAbsPosition(item, &pos2, 17); + } + + short angles[2]; + phd_GetVectorAngles(pos2.x - pos1.x, pos2.y - pos1.y, pos2.z - pos1.z, angles); + + PHD_3DPOS pos; + pos.xPos = pos1.x; + pos.yPos = pos1.y; + pos.zPos = pos1.z; + pos.xRot = angles[1]; + pos.yRot = angles[0]; + pos.zRot = 0; + + DemigodThrowEnergyAttack(&pos, item->roomNumber, 4); + } +} + +static void DemigodHammerAttack(int x, int y, int z, int something) +{ + int angle = 2 * GetRandomControl(); + int deltaAngle = 0x10000 / something; + + if (something > 0) + { + for (int i = 0; i < something; i++) + { + SMOKE_SPARKS* spark = &SmokeSparks[GetFreeSmokeSpark()]; + + spark->on = true; + spark->sShade = 0; + spark->colFadeSpeed = 4; + spark->dShade = (GetRandomControl() & 0x1F) + 96; + spark->fadeToBlack = 24 - (GetRandomControl() & 7); + spark->transType = COLADD; + spark->life = spark->sLife = (GetRandomControl() & 7) + 48; + spark->x = (GetRandomControl() & 0x1F) + x - 16; + spark->y = (GetRandomControl() & 0x1F) + y - 16; + spark->z = (GetRandomControl() & 0x1F) + z - 16; + spark->xVel = (byte)(GetRandomControl() + 256) * phd_sin(angle) >> W2V_SHIFT; + spark->yVel = -32 - (GetRandomControl() & 0x3F); + spark->zVel = (byte)(GetRandomControl() + 256) * phd_cos(angle) >> W2V_SHIFT; + spark->friction = 9; + + if (GetRandomControl() & 1) + { + spark->flags = 16; + spark->rotAng = GetRandomControl() & 0xFFF; + if (GetRandomControl() & 1) + { + spark->rotAdd = -64 - (GetRandomControl() & 0x3F); + } + else + { + spark->rotAdd = (GetRandomControl() & 0x3F) + 64; + } + } + else if (Rooms[LaraItem->roomNumber].flags & ENV_FLAG_WIND) + { + spark->flags = 256; + } + else + { + spark->flags = SP_NONE; + } + spark->gravity = -4 - (GetRandomControl() & 3); + spark->maxYvel = -4 - (GetRandomControl() & 3); + spark->dSize = ((GetRandomControl() & 0x3F) + 64); + spark->sSize = spark->dSize >> 3; + spark->size = spark->dSize >> 3; + + angle += deltaAngle; + } + } +} + +void InitialiseDemigod(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + ClearItem(itemNumber); item->animNumber = Objects[item->objectNumber].animIndex; item->goalAnimState = 0; @@ -42,14 +272,14 @@ void InitialiseDemigod(short itemNum) }*/ } -void DemigodControl(short itemNum) +void DemigodControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; - int someItemNum = item->itemFlags[0]; - if (someItemNum && Items[someItemNum].status == ITEM_ACTIVE && Items[someItemNum].active) + ITEM_INFO* item = &Items[itemNumber]; + int someitemNumber = item->itemFlags[0]; + if (someitemNumber && Items[someitemNumber].status == ITEM_ACTIVE && Items[someitemNumber].active) { item->hitPoints = Objects[item->objectNumber].hitPoints; return; @@ -64,28 +294,6 @@ void DemigodControl(short itemNum) short joint2 = 0; short joint3 = 0; - /*if (CurrentLevel == 24) - { - ROOM_INFO* room = &Rooms[item->roomNumber]; - - short* zone = Zones[FlipStatus * 2 + creature->LOT.zone]; - - LaraItem->boxNumber = room->floor[((LaraItem->pos.zPos - room->z) >> WALL_SHIFT) + - ((LaraItem->pos.xPos - room->x) >> WALL_SHIFT) * room->xSize].box; - - if (zone[item->boxNumber] == zone[LaraItem->boxNumber]) - { - item->aiBits = 0; - creature->enemy = LaraItem; - } - else - { - item->aiBits = FOLLOW; - item->itemFlags[3] = Lara.location; - creature->enemy = NULL; - } - }*/ - if (item->hitPoints <= 0) { item->hitPoints = 0; @@ -341,7 +549,7 @@ void DemigodControl(short itemNum) case 4: case 12: - DemigodEnergyAttack(itemNum); + DemigodEnergyAttack(itemNumber); break; case 6: @@ -365,7 +573,7 @@ void DemigodControl(short itemNum) case 10: creature->maximumTurn = ANGLE(7); - DemigodEnergyAttack(itemNum); + DemigodEnergyAttack(itemNumber); if (!Targetable(item, &info) || info.distance < SQUARE(5120) || !GetRandomControl()) { @@ -509,234 +717,5 @@ void DemigodControl(short itemNum) CreatureJoint(item, 2, joint2); CreatureJoint(item, 3, joint3); - CreatureAnimation(itemNum, angle, 0); -} - -void DemigodThrowEnergyAttack(PHD_3DPOS* pos, short roomNumber, int flags) -{ - short fxNum = CreateNewEffect(roomNumber); - if (fxNum != -1) - { - FX_INFO* fx = &Effects[fxNum]; - - fx->pos.xPos = pos->xPos; - fx->pos.yPos = pos->yPos - (GetRandomControl() & 0x3F) - 32; - fx->pos.zPos = pos->zPos; - fx->pos.xRot = pos->xRot; - if (flags < 4) - { - fx->pos.yRot = pos->yRot; - } - else - { - fx->pos.yRot = pos->yRot + (GetRandomControl() & 0x7FF) - 1024; - } - - ObjectInfo* obj = &Objects[ID_ENERGY_BUBBLES]; - - fx->pos.zRot = 0; - fx->roomNumber = roomNumber; - fx->counter = 2 * GetRandomControl() + -ANGLE(180); - fx->flag1 = flags; - fx->speed = (GetRandomControl() & 0x1F) + 96; - fx->objectNumber = ID_ENERGY_BUBBLES; - if (flags >= 4) - flags--; - fx->frameNumber = Objects[ID_ENERGY_BUBBLES].meshIndex + 2 * flags; - } -} - -void DemigodEnergyAttack(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - short animIndex = item->animNumber - Objects[item->objectNumber].animIndex; - - if (animIndex == 8) - { - if (item->frameNumber == Anims[item->animNumber].frameBase) - { - PHD_VECTOR pos1; - PHD_VECTOR pos2; - - pos1.x = -544; - pos1.y = 96; - pos1.z = 0; - - GetJointAbsPosition(item, &pos1, 16); - - pos2.x = -900; - pos2.y = 96; - pos2.z = 0; - - GetJointAbsPosition(item, &pos2, 16); - - short angles[2]; - phd_GetVectorAngles(pos2.x - pos1.x, pos2.y - pos1.y, pos2.z - pos1.z, angles); - - PHD_3DPOS pos; - pos.xPos = pos1.x; - pos.yPos = pos1.y; - pos.zPos = pos1.z; - pos.xRot = angles[1]; - pos.yRot = angles[0]; - pos.zRot = 0; - - if (item->objectNumber == ID_DEMIGOD3) - { - DemigodThrowEnergyAttack(&pos, item->roomNumber, 3); - } - else - { - DemigodThrowEnergyAttack(&pos, item->roomNumber, 5); - } - } - - return; - } - - if (animIndex != 16) - { - if (animIndex != 19) - return; - - if (item->frameNumber == Anims[item->animNumber].frameBase) - { - PHD_VECTOR pos1; - PHD_VECTOR pos2; - - pos1.x = -544; - pos1.y = 96; - pos1.z = 0; - - GetJointAbsPosition(item, &pos1, 16); - - pos2.x = -900; - pos2.y = 96; - pos2.z = 0; - - GetJointAbsPosition(item, &pos2, 16); - - short angles[2]; - phd_GetVectorAngles(pos2.x - pos1.x, pos2.y - pos1.y, pos2.z - pos1.z, angles); - - PHD_3DPOS pos; - pos.xPos = pos1.x; - pos.yPos = pos1.y; - pos.zPos = pos1.z; - pos.xRot = angles[1]; - pos.yRot = angles[0]; - pos.zRot = 0; - - if (item->objectNumber == ID_DEMIGOD3) - { - DemigodThrowEnergyAttack(&pos, item->roomNumber, 3); - } - else - { - DemigodThrowEnergyAttack(&pos, item->roomNumber, 5); - } - } - - return; - } - - // Animation 16 (State 10) is the big circle attack of DEMIGOD_3 - int frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; - - if (frameNumber >= 8 && frameNumber <= 64) - { - PHD_VECTOR pos1; - PHD_VECTOR pos2; - - pos1.x = 0; - pos1.y = 0; - pos1.z = 192; - - pos2.x = 0; - pos2.y = 0; - pos2.z = 384; - - if (GlobalCounter & 1) - { - GetJointAbsPosition(item, &pos1, 18); - GetJointAbsPosition(item, &pos2, 18); - } - else - { - GetJointAbsPosition(item, &pos1, 17); - GetJointAbsPosition(item, &pos2, 17); - } - - short angles[2]; - phd_GetVectorAngles(pos2.x - pos1.x, pos2.y - pos1.y, pos2.z - pos1.z, angles); - - PHD_3DPOS pos; - pos.xPos = pos1.x; - pos.yPos = pos1.y; - pos.zPos = pos1.z; - pos.xRot = angles[1]; - pos.yRot = angles[0]; - pos.zRot = 0; - - DemigodThrowEnergyAttack(&pos, item->roomNumber, 4); - } -} - -void DemigodHammerAttack(int x, int y, int z, int something) -{ - int angle = 2 * GetRandomControl(); - int deltaAngle = 0x10000 / something; - - if (something > 0) - { - for (int i = 0; i < something; i++) - { - SMOKE_SPARKS* spark = &SmokeSparks[GetFreeSmokeSpark()]; - - spark->on = true; - spark->sShade = 0; - spark->colFadeSpeed = 4; - spark->dShade = (GetRandomControl() & 0x1F) + 96; - spark->fadeToBlack = 24 - (GetRandomControl() & 7); - spark->transType = 2; - spark->life = spark->sLife = (GetRandomControl() & 7) + 48; - spark->x = (GetRandomControl() & 0x1F) + x - 16; - spark->y = (GetRandomControl() & 0x1F) + y - 16; - spark->z = (GetRandomControl() & 0x1F) + z - 16; - spark->xVel = (byte)(GetRandomControl() + 256) * phd_sin(angle) >> W2V_SHIFT; - spark->yVel = -32 - (GetRandomControl() & 0x3F); - spark->zVel = (byte)(GetRandomControl() + 256) * phd_cos(angle) >> W2V_SHIFT; - spark->friction = 9; - - if (GetRandomControl() & 1) - { - spark->flags = 16; - spark->rotAng = GetRandomControl() & 0xFFF; - if (GetRandomControl() & 1) - { - spark->rotAdd = -64 - (GetRandomControl() & 0x3F); - } - else - { - spark->rotAdd = (GetRandomControl() & 0x3F) + 64; - } - } - else if (Rooms[LaraItem->roomNumber].flags & ENV_FLAG_WIND) - { - spark->flags = 256; - } - else - { - spark->flags = 0; - } - spark->gravity = -4 - (GetRandomControl() & 3); - spark->maxYvel = -4 - (GetRandomControl() & 3); - spark->dSize = ((GetRandomControl() & 0x3F) + 64); - spark->sSize = spark->dSize >> 3; - spark->size = spark->dSize >> 3; - - angle += deltaAngle; - } - } + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_demigod.h b/TR5Main/Objects/TR4/Entity/tr4_demigod.h new file mode 100644 index 000000000..43c297d1b --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_demigod.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseDemigod(short itemNumber); +void DemigodControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_guide.cpp b/TR5Main/Objects/TR4/Entity/tr4_guide.cpp similarity index 94% rename from TR5Main/Objects/TR4/tr4_guide.cpp rename to TR5Main/Objects/TR4/Entity/tr4_guide.cpp index 42a22e53a..e935e2c74 100644 --- a/TR5Main/Objects/TR4/tr4_guide.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_guide.cpp @@ -1,24 +1,25 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/effect2.h" -#include "../../Game/sphere.h" -#include "../../Game/lot.h" -#include "../../Game/effects.h" -#include "../../Game/tomb4fx.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr4_guide.h" +#include "items.h" +#include "box.h" +#include "effect2.h" +#include "sphere.h" +#include "lot.h" +#include "effect.h" +#include "tomb4fx.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO guideBiteInfo1 = { 0, 20, 200, 18 }; BITE_INFO guideBiteInfo2 = { 30, 80, 50, 15 }; -void InitialiseGuide(short itemNum) +void InitialiseGuide(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); item->animNumber = Objects[item->objectNumber].animIndex + 4; item->frameNumber = Anims[item->animNumber].frameBase; @@ -27,12 +28,12 @@ void InitialiseGuide(short itemNum) item->swapMeshFlags = 0x40000; } -void GuideControl(short itemNum) +void GuideControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; ObjectInfo* obj = &Objects[item->objectNumber]; @@ -118,7 +119,7 @@ void GuideControl(short itemNum) { baddie = &BaddieSlots[i]; - if (baddie->itemNum == NO_ITEM || baddie->itemNum == itemNum) + if (baddie->itemNum == NO_ITEM || baddie->itemNum == itemNumber) continue; ITEM_INFO* currentItem = &Items[baddie->itemNum]; @@ -204,7 +205,7 @@ void GuideControl(short itemNum) CreatureJoint((int)item, 2, joint2); CreatureJoint((int)item, 3, joint1); - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); return; } @@ -292,8 +293,8 @@ void GuideControl(short itemNum) case 0x3Eu: item->status = ITEM_INVISIBLE; - RemoveActiveItem(itemNum); - DisableBaddieAI(itemNum); + RemoveActiveItem(itemNumber); + DisableBaddieAI(itemNumber); break; @@ -634,10 +635,10 @@ void GuideControl(short itemNum) ROOM_INFO* room = &Rooms[item->roomNumber]; ITEM_INFO* currentItem = NULL; - short currentItemNumber = room->itemNumber; - while (currentItemNumber != NO_ITEM) + short currentitemNumber = room->itemNumber; + while (currentitemNumber != NO_ITEM) { - currentItem = &Items[currentItemNumber]; + currentItem = &Items[currentitemNumber]; if (currentItem->objectNumber >= ID_ANIMATING1 && currentItem->objectNumber <= ID_ANIMATING15 @@ -647,7 +648,7 @@ void GuideControl(short itemNum) break; } - currentItemNumber = currentItem->nextItem; + currentitemNumber = currentItem->nextItem; } if (currentItem != NULL) @@ -797,8 +798,8 @@ void GuideControl(short itemNum) } else { - KillItem(itemNum); - DisableBaddieAI(itemNum); + KillItem(itemNumber); + DisableBaddieAI(itemNumber); item->flags |= 1; } @@ -814,11 +815,9 @@ void GuideControl(short itemNum) } CreatureTilt(item, tilt); - CreatureJoint(item, 0, joint0); CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); CreatureJoint(item, 3, joint1); - - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_guide.h b/TR5Main/Objects/TR4/Entity/tr4_guide.h new file mode 100644 index 000000000..d32480d92 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_guide.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseGuide(short itemNumber); +void GuideControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_harpy.cpp b/TR5Main/Objects/TR4/Entity/tr4_harpy.cpp similarity index 90% rename from TR5Main/Objects/TR4/tr4_harpy.cpp rename to TR5Main/Objects/TR4/Entity/tr4_harpy.cpp index f26bacd82..b46418eae 100644 --- a/TR5Main/Objects/TR4/tr4_harpy.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_harpy.cpp @@ -1,15 +1,16 @@ -#include "../newobjects.h" -#include "../../Game/people.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/effect2.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/draw.h" -#include "../../Specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr4_harpy.h" +#include "people.h" +#include "box.h" +#include "effect.h" +#include "effect2.h" +#include "items.h" +#include "sphere.h" +#include "draw.h" +#include "setup.h" +#include "lot.h" +#include "level.h" +#include "lara.h" BITE_INFO harpyBite1 = { 0, 0, 0, 4 }; BITE_INFO harpyBite2 = { 0, 0, 0, 2 }; @@ -17,7 +18,77 @@ BITE_INFO harpyBite3 = { 0, 0, 0, 21 }; BITE_INFO harpyAttack1 = { 0, 128, 0, 2 }; BITE_INFO harpyAttack2 = { 0, 128, 0, 4 }; -void HarpySparks2(int x, int y, int z, int xv, int yv, int zv) +static void HarpyBubbles(PHD_3DPOS* pos, short roomNumber, int count) +{ + short fxNumber = CreateNewEffect(roomNumber); + if (fxNumber != -1) + { + FX_INFO* fx = &Effects[fxNumber]; + + fx->pos.xPos = pos->xPos; + fx->pos.yPos = pos->yPos - (GetRandomControl() & 0x3F) - 32; + fx->pos.zPos = pos->zPos; + fx->pos.xRot = pos->xRot; + fx->pos.yRot = pos->yRot; + fx->pos.zRot = 0; + fx->roomNumber = roomNumber; + fx->counter = 2 * GetRandomControl() + -32768; + fx->objectNumber = ID_ENERGY_BUBBLES; + fx->speed = (GetRandomControl() & 0x1F) + 96; + fx->flag1 = count; + fx->frameNumber = Objects[ID_ENERGY_BUBBLES].meshIndex + 2 * count; + } +} + +static void HarpySparks1(short itemNumber, byte num, int size) +{ + ITEM_INFO* item = &Items[itemNumber]; + + int dx = LaraItem->pos.xPos - item->pos.xPos; + int dz = LaraItem->pos.zPos - item->pos.zPos; + + if (dx >= -16384 && dx <= 16384 && dz >= -16384 && dz <= 16384) + { + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = true; + spark->sR = 0; + spark->sG = 0; + spark->sB = 0; + spark->dB = 0; + spark->dG = spark->dR = (GetRandomControl() & 0x7F) + 32; + spark->fadeToBlack = 8; + spark->colFadeSpeed = (GetRandomControl() & 3) + 4; + spark->transType = COLADD; + spark->life = spark->sLife = (GetRandomControl() & 7) + 20; + spark->y = 0; + spark->x = (GetRandomControl() & 0xF) - 8; + spark->z = (GetRandomControl() & 0xF) - 8; + spark->yVel = 0; + spark->xVel = GetRandomControl() - 128; + spark->friction = 5; + spark->flags = 4762; + spark->zVel = GetRandomControl() - 128; + spark->rotAng = GetRandomControl() & 0xFFF; + if (GetRandomControl() & 1) + { + spark->rotAdd = -32 - (GetRandomControl() & 0x1F); + } + else + { + spark->rotAdd = (GetRandomControl() & 0x1F) + 32; + } + spark->maxYvel = 0; + spark->gravity = (GetRandomControl() & 0x1F) + 16; + spark->fxObj = itemNumber; + spark->nodeNumber = num; + spark->scalar = 2; + spark->sSize = spark->size = GetRandomControl() & 0xF + size; + spark->dSize = spark->size >> 4; + } +} + +static void HarpySparks2(int x, int y, int z, int xv, int yv, int zv) { int dx = LaraItem->pos.xPos - x; int dz = LaraItem->pos.zPos - z; @@ -36,7 +107,7 @@ void HarpySparks2(int x, int y, int z, int xv, int yv, int zv) spark->sLife = 16; spark->colFadeSpeed = 4; spark->y = y; - spark->transType = 2; + spark->transType = COLADD; spark->fadeToBlack = 4; spark->x = x; spark->z = z; @@ -49,11 +120,11 @@ void HarpySparks2(int x, int y, int z, int xv, int yv, int zv) spark->maxYvel = 0; spark->gravity = 0; spark->dSize = (GetRandomControl() & 1) + 1; - spark->flags = 0; + spark->flags = SP_NONE; } } -void HarpyAttack(ITEM_INFO* item, short itemNum) +static void HarpyAttack(ITEM_INFO* item, short itemNumber) { item->itemFlags[0]++; @@ -100,11 +171,11 @@ void HarpyAttack(ITEM_INFO* item, short itemNum) { if ((Wibble & 0xF) == 8) { - HarpySparks1(itemNum, 4, something); + HarpySparks1(itemNumber, 4, something); } else if (!(Wibble & 0xF)) { - HarpySparks1(itemNum, 5, something); + HarpySparks1(itemNumber, 5, something); } } @@ -169,81 +240,11 @@ void HarpyAttack(ITEM_INFO* item, short itemNum) } } -void HarpyBubbles(PHD_3DPOS* pos, short roomNumber, int count) +void InitialiseHarpy(short itemNumber) { - short fxNumber = CreateNewEffect(roomNumber); - if (fxNumber != -1) - { - FX_INFO* fx = &Effects[fxNumber]; + ITEM_INFO* item = &Items[itemNumber]; - fx->pos.xPos = pos->xPos; - fx->pos.yPos = pos->yPos - (GetRandomControl() & 0x3F) - 32; - fx->pos.zPos = pos->zPos; - fx->pos.xRot = pos->xRot; - fx->pos.yRot = pos->yRot; - fx->pos.zRot = 0; - fx->roomNumber = roomNumber; - fx->counter = 2 * GetRandomControl() + -32768; - fx->objectNumber = ID_ENERGY_BUBBLES; - fx->speed = (GetRandomControl() & 0x1F) + 96; - fx->flag1 = count; - fx->frameNumber = Objects[ID_ENERGY_BUBBLES].meshIndex + 2 * count; - } -} - -void HarpySparks1(short itemNum, byte num, int size) -{ - ITEM_INFO* item = &Items[itemNum]; - - int dx = LaraItem->pos.xPos - item->pos.xPos; - int dz = LaraItem->pos.zPos - item->pos.zPos; - - if (dx >= -16384 && dx <= 16384 && dz >= -16384 && dz <= 16384) - { - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = true; - spark->sR = 0; - spark->sG = 0; - spark->sB = 0; - spark->dB = 0; - spark->dG = spark->dR = (GetRandomControl() & 0x7F) + 32; - spark->fadeToBlack = 8; - spark->colFadeSpeed = (GetRandomControl() & 3) + 4; - spark->transType = 2; - spark->life = spark->sLife = (GetRandomControl() & 7) + 20; - spark->y = 0; - spark->x = (GetRandomControl() & 0xF) - 8; - spark->z = (GetRandomControl() & 0xF) - 8; - spark->yVel = 0; - spark->xVel = GetRandomControl() - 128; - spark->friction = 5; - spark->flags = 4762; - spark->zVel = GetRandomControl() - 128; - spark->rotAng = GetRandomControl() & 0xFFF; - if (GetRandomControl() & 1) - { - spark->rotAdd = -32 - (GetRandomControl() & 0x1F); - } - else - { - spark->rotAdd = (GetRandomControl() & 0x1F) + 32; - } - spark->maxYvel = 0; - spark->gravity = (GetRandomControl() & 0x1F) + 16; - spark->fxObj = itemNum; - spark->nodeNumber = num; - spark->scalar = 2; - spark->sSize = spark->size = GetRandomControl() & 0xF + size; - spark->dSize = spark->size >> 4; - } -} - -void InitialiseHarpy(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - ClearItem(itemNum); + ClearItem(itemNumber); item->animNumber = Objects[ID_HARPY].animIndex + 4; item->frameNumber = Anims[item->animNumber].frameBase; @@ -251,11 +252,11 @@ void InitialiseHarpy(short itemNum) item->currentAnimState = 1; } -void HarpyControl(short itemNum) +void HarpyControl(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; @@ -297,7 +298,7 @@ void HarpyControl(short itemNum) CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); return; } @@ -328,7 +329,7 @@ void HarpyControl(short itemNum) for (int i = 0; i < NUM_SLOTS; i++, baddie++) { - if (baddie->itemNum == NO_ITEM || baddie->itemNum == itemNum) + if (baddie->itemNum == NO_ITEM || baddie->itemNum == itemNumber) continue; ITEM_INFO* target = &Items[baddie->itemNum]; @@ -570,7 +571,7 @@ void HarpyControl(short itemNum) case 8: // Flame attack - HarpyAttack(item, itemNum); + HarpyAttack(item, itemNumber); break; case 12: @@ -596,10 +597,8 @@ void HarpyControl(short itemNum) } CreatureTilt(item, 0); - CreatureJoint(item, 0, joint0); CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); - - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_harpy.h b/TR5Main/Objects/TR4/Entity/tr4_harpy.h new file mode 100644 index 000000000..c13493c58 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_harpy.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseHarpy(short itemNumber); +void HarpyControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_horseman.cpp b/TR5Main/Objects/TR4/Entity/tr4_horseman.cpp similarity index 95% rename from TR5Main/Objects/TR4/tr4_horseman.cpp rename to TR5Main/Objects/TR4/Entity/tr4_horseman.cpp index 49ef6d711..83f126295 100644 --- a/TR5Main/Objects/TR4/tr4_horseman.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_horseman.cpp @@ -1,8 +1,11 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/effect2.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr4_horseman.h" +#include "items.h" +#include "effect2.h" +#include "setup.h" +#include "level.h" +#include "control.h" +#include "trmath.h" BITE_INFO horseBite1 = { 0, 0, 0, 0x0D }; BITE_INFO horseBite2 = { 0, 0, 0, 0x11 }; @@ -11,32 +14,7 @@ BITE_INFO horsemanBite1 = { 0, 0, 0, 0x06 }; BITE_INFO horsemanBite2 = { 0, 0, 0, 0x0E }; BITE_INFO horsemanBite3 = { 0, 0, 0, 0x0A }; -void InitialiseHorse(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - ObjectInfo* obj = &Objects[ID_HORSE]; - - item->animNumber = obj->animIndex + 2; - item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 1; - item->currentAnimState = 1; -} - -void InitialiseHorseman(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - ObjectInfo* obj = &Objects[ID_HORSEMAN]; - - ClearItem(itemNum); - - item->animNumber = obj->animIndex + 8; - item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 9; - item->currentAnimState = 9; - item->itemFlags[0] = NO_ITEM; // No horse yet -} - -void HorsemanSparks(PHD_3DPOS* pos, int param1, int num) +static void HorsemanSparks(PHD_3DPOS* pos, int param1, int num) { for (int i = 0; i < num; i++) { @@ -55,13 +33,13 @@ void HorsemanSparks(PHD_3DPOS* pos, int param1, int num) spark->fadeToBlack = 4; spark->life = 9; spark->sLife = 9; - spark->transType = 2; + spark->transType = COLADD; spark->x = pos->xPos; spark->y = pos->yPos; spark->z = pos->zPos; spark->friction = 34; spark->yVel = (r & 0xFFF) - 2048; - spark->flags = 0; + spark->flags = SP_NONE; spark->gravity = (r >> 7) & 0x1F; spark->maxYvel = 0; spark->zVel = phd_cos((r & 0x7FF) + param1 - 1024) >> 2; @@ -85,7 +63,7 @@ void HorsemanSparks(PHD_3DPOS* pos, int param1, int num) spark->dB = ((r >> 4) & 0x1F) + 48; spark->life = 9; spark->sLife = 9; - spark->transType = 2; + spark->transType = COLADD; spark->x = pos->xPos; spark->y = pos->yPos; spark->z = pos->zPos; @@ -111,13 +89,39 @@ void HorsemanSparks(PHD_3DPOS* pos, int param1, int num) } } -void HorsemanControl(short itemNum) +void InitialiseHorse(short itemNumber) { + ITEM_INFO* item = &Items[itemNumber]; + ObjectInfo* obj = &Objects[ID_HORSE]; + + item->animNumber = obj->animIndex + 2; + item->frameNumber = Anims[item->animNumber].frameBase; + item->goalAnimState = 1; + item->currentAnimState = 1; +} + +void InitialiseHorseman(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + ObjectInfo* obj = &Objects[ID_HORSEMAN]; + + ClearItem(itemNumber); + + item->animNumber = obj->animIndex + 8; + item->frameNumber = Anims[item->animNumber].frameBase; + item->goalAnimState = 9; + item->currentAnimState = 9; + item->itemFlags[0] = NO_ITEM; // No horse yet +} + +void HorsemanControl(short itemNumber) +{ + printf("[Horseman] Not Implemented !"); #ifdef OLD_CODE - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; // Try to find the horse @@ -230,7 +234,7 @@ void HorsemanControl(short itemNum) AnimateItem(horseItem); END: Objects[ID_HORSEMAN].radius = item->itemFlags[1] != 0 ? 409 : 170; - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); return; } } @@ -275,7 +279,7 @@ void HorsemanControl(short itemNum) if (!horseItem || !item->itemFlags[1]) { Objects[ID_HORSEMAN].radius = item->itemFlags[1] != 0 ? 409 : 170; - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); return; } @@ -310,7 +314,7 @@ void HorsemanControl(short itemNum) AnimateItem(horseItem); Objects[ID_HORSEMAN].radius = item->itemFlags[1] != 0 ? 409 : 170; - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); if (item->currentAnimState != 15) { diff --git a/TR5Main/Objects/TR4/Entity/tr4_horseman.h b/TR5Main/Objects/TR4/Entity/tr4_horseman.h new file mode 100644 index 000000000..4583452b6 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_horseman.h @@ -0,0 +1,5 @@ +#pragma once + +void InitialiseHorse(short itemNumber); +void InitialiseHorseman(short itemNumber); +void HorsemanControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_jeanyves.cpp b/TR5Main/Objects/TR4/Entity/tr4_jeanyves.cpp similarity index 74% rename from TR5Main/Objects/TR4/tr4_jeanyves.cpp rename to TR5Main/Objects/TR4/Entity/tr4_jeanyves.cpp index f76b790a7..c978ce31a 100644 --- a/TR5Main/Objects/TR4/tr4_jeanyves.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_jeanyves.cpp @@ -1,12 +1,13 @@ -#include "../newobjects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/control.h" +#include "framework.h" +#include "tr4_jeanyves.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "control.h" -void InitialiseJeanYves(short itemNum) +void InitialiseJeanYves(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; ObjectInfo* obj = &Objects[item->objectNumber]; item->goalAnimState = 1; @@ -15,25 +16,20 @@ void InitialiseJeanYves(short itemNum) item->frameNumber = Anims[item->animNumber].frameBase; } -void JeanYvesControl(short itemNum) +void JeanYvesControl(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; if (item->triggerFlags >= Lara.highestLocation) { short state = 0; if (GetRandomControl() & 3) - { state = (GetRandomControl() & 1) + 1; - } else - { state = 3 * (GetRandomControl() & 1); - } item->goalAnimState = (((byte)(item->currentAnimState) - 1) & 0xC) + state + 1; - AnimateItem(item); } else diff --git a/TR5Main/Objects/TR4/Entity/tr4_jeanyves.h b/TR5Main/Objects/TR4/Entity/tr4_jeanyves.h new file mode 100644 index 000000000..c58fd9098 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_jeanyves.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseJeanYves(short itemNumber); +void JeanYvesControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_knighttemplar.cpp b/TR5Main/Objects/TR4/Entity/tr4_knighttemplar.cpp similarity index 88% rename from TR5Main/Objects/TR4/tr4_knighttemplar.cpp rename to TR5Main/Objects/TR4/Entity/tr4_knighttemplar.cpp index 4fa6701d9..47d0ea986 100644 --- a/TR5Main/Objects/TR4/tr4_knighttemplar.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_knighttemplar.cpp @@ -1,22 +1,23 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/debris.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr4_knighttemplar.h" +#include "items.h" +#include "box.h" +#include "sphere.h" +#include "effect2.h" +#include "debris.h" +#include "effect.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO knightTemplarBite = { 0, 0, 0, 11 }; -void InitialiseKnightTemplar(short itemNum) +void InitialiseKnightTemplar(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); item->animNumber = Objects[ID_KNIGHT_TEMPLAR].animIndex + 2; item->goalAnimState = 1; @@ -25,12 +26,12 @@ void InitialiseKnightTemplar(short itemNum) item->meshBits &= 0xF7FF; } -void KnightTemplarControl(short itemNum) +void KnightTemplarControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; ObjectInfo* obj = &Objects[item->objectNumber]; if (item->animNumber == obj->animIndex || @@ -259,5 +260,5 @@ void KnightTemplarControl(short itemNum) CreatureJoint(item, 0, joint0); CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); - CreatureAnimation(itemNum, angle, tilt); + CreatureAnimation(itemNumber, angle, tilt); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_knighttemplar.h b/TR5Main/Objects/TR4/Entity/tr4_knighttemplar.h new file mode 100644 index 000000000..5cd2ed0f1 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_knighttemplar.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseKnightTemplar(short itemNumber); +void KnightTemplarControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_littlebeetle.cpp b/TR5Main/Objects/TR4/Entity/tr4_littlebeetle.cpp similarity index 72% rename from TR5Main/Objects/TR4/tr4_littlebeetle.cpp rename to TR5Main/Objects/TR4/Entity/tr4_littlebeetle.cpp index c09f34808..c73b0f5c5 100644 --- a/TR5Main/Objects/TR4/tr4_littlebeetle.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_littlebeetle.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr4_littlebeetle.h" +#include "level.h" -void InitialiseLittleBeetle(short itemNum) +void InitialiseLittleBeetle(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; item->itemFlags[0] = (item->triggerFlags / 1000) & 1; item->itemFlags[1] = (item->triggerFlags / 1000) & 2; @@ -37,7 +38,7 @@ void InitialiseLittleBeetle(short itemNum) } } -void LittleBeetleControl(short itemNum) +void LittleBeetleControl(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + printf("[LittleBeetle] Not Implemented !"); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_littlebeetle.h b/TR5Main/Objects/TR4/Entity/tr4_littlebeetle.h new file mode 100644 index 000000000..6dc0cf868 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_littlebeetle.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseLittleBeetle(short itemNumber); +void LittleBeetleControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_mummy.cpp b/TR5Main/Objects/TR4/Entity/tr4_mummy.cpp similarity index 53% rename from TR5Main/Objects/TR4/tr4_mummy.cpp rename to TR5Main/Objects/TR4/Entity/tr4_mummy.cpp index 997a7ac27..4c083d851 100644 --- a/TR5Main/Objects/TR4/tr4_mummy.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_mummy.cpp @@ -1,44 +1,83 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/lara.h" -#include "../../Game/Box.h" -#include "../../Game/lara.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr4_mummy.h" +#include "items.h" +#include "lara.h" +#include "box.h" +#include "lara.h" +#include "effect.h" +#include "setup.h" +#include "level.h" + +enum MUMMY_STATES { + STATE_MUMMY_ARMS_CROSSED = 0, + STATE_MUMMY_STOP = 1, + STATE_MUMMY_WALK = 2, + STATE_MUMMY_WALK_ARMS_UP = 3, + STATE_MUMMY_WALK_HIT = 4, + STATE_MUMMY_PUSHED_BACK = 5, + STATE_MUMMY_ARMS_UP_PUSHED_BACK = 6, + STATE_MUMMY_COLLAPSE = 7, + STATE_MUMMY_LYING_DOWN = 8, + STATE_MUMMY_GET_UP = 9, + STATE_MUMMY_HIT = 10 +}; + +enum MUMMY_ANIM { + ANIMATION_MUMMY_STAND = 0, + ANIMATION_MUMMY_WALK = 1, + ANIMATION_MUMMY_WALK_ARMS_UP = 2, + ANIMATION_MUMMY_PUSHED_BACK = 3, + ANIMATION_MUMMY_WALK_TO_WALK_ARMS_UP_RIGHT = 4, + ANIMATION_MUMMY_WALK_ARMS_UP_TO_WALK_LEFT = 5, + ANIMATION_MUMMY_WALK_ARMS_UP_TO_STAND = 6, + ANIMATION_MUMMY_STAND_TO_WALK_ARMS_UP = 7, + ANIMATION_MUMMY_STAND_TO_WALK = 8, + ANIMATION_MUMMY_WALK_TO_STAND = 9, + ANIMATION_MUMMY_COLLAPSE_START = 10, + ANIMATION_MUMMY_COLLAPSE_END = 11, + ANIMATION_MUMMY_LYING_DOWN = 12, + ANIMATION_MUMMY_GET_UP = 13, + ANIMATION_MUMMY_HIT_RIGHT = 14, + ANIMATION_MUMMY_HIT_LEFT = 15, + ANIMATION_MUMMY_WALK_HIT = 16, + ANIMATION_MUMMY_ARMS_CROSSED_TO_STAND_START = 17, + ANIMATION_MUMMY_ARMS_CROSSED_TO_STAND_END = 18, + ANIMATION_MUMMY_ARMS_CROSSED = 19, + ANIMATION_MUMMY_ARMS_UP_PUSHED_BACK = 20 +}; BITE_INFO mummyBite1 = { 0, 0, 0, 11 }; BITE_INFO mummyBite2 = { 0, 0, 0, 14 }; -void InitialiseMummy(short itemNum) +void InitialiseMummy(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); if (item->triggerFlags == 2) { - item->animNumber = Objects[item->objectNumber].animIndex + 12; + item->animNumber = Objects[item->objectNumber].animIndex + ANIMATION_MUMMY_LYING_DOWN; item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 8; - item->currentAnimState = 8; + item->goalAnimState = STATE_MUMMY_LYING_DOWN; + item->currentAnimState = STATE_MUMMY_LYING_DOWN; item->status = ITEM_INVISIBLE; } else { - item->animNumber = Objects[item->objectNumber].animIndex + 19; + item->animNumber = Objects[item->objectNumber].animIndex + ANIMATION_MUMMY_ARMS_CROSSED; item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 0; - item->currentAnimState = 0; + item->goalAnimState = STATE_MUMMY_ARMS_CROSSED; + item->currentAnimState = STATE_MUMMY_ARMS_CROSSED; } } -void MummyControl(short itemNum) +void MummyControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; short tilt = 0; @@ -59,21 +98,21 @@ void MummyControl(short itemNum) { if (info.distance < SQUARE(3072)) { - if (item->currentAnimState != 7 && item->currentAnimState != 5 && item->currentAnimState != 8) + if (item->currentAnimState != ANIMATION_MUMMY_STAND_TO_WALK_ARMS_UP && item->currentAnimState != ANIMATION_MUMMY_WALK_ARMS_UP_TO_WALK_LEFT && item->currentAnimState != ANIMATION_MUMMY_STAND_TO_WALK) { - if (GetRandomControl() & 3 || Lara.gunType != 4 && Lara.gunType != 5 && Lara.gunType != 2) + if (GetRandomControl() & 3 || Lara.gunType != WEAPON_SHOTGUN && Lara.gunType != WEAPON_HK && Lara.gunType != WEAPON_REVOLVER) { - if (!(GetRandomControl() & 7) || Lara.gunType == 4 || Lara.gunType == 5 || Lara.gunType == 2) + if (!(GetRandomControl() & 7) || Lara.gunType == WEAPON_SHOTGUN || Lara.gunType == WEAPON_HK || Lara.gunType == WEAPON_REVOLVER) { - if (item->currentAnimState == 3 || item->currentAnimState == 4) + if (item->currentAnimState == STATE_MUMMY_WALK_ARMS_UP || item->currentAnimState == STATE_MUMMY_WALK_HIT) { - item->currentAnimState = 6; - item->animNumber = Objects[item->objectNumber].animIndex + 20; + item->currentAnimState = STATE_MUMMY_ARMS_UP_PUSHED_BACK; + item->animNumber = Objects[item->objectNumber].animIndex + ANIMATION_MUMMY_ARMS_UP_PUSHED_BACK; } else { - item->currentAnimState = 5; - item->animNumber = Objects[item->objectNumber].animIndex + 3; + item->currentAnimState = STATE_MUMMY_PUSHED_BACK; + item->animNumber = Objects[item->objectNumber].animIndex + ANIMATION_MUMMY_PUSHED_BACK; } item->frameNumber = Anims[item->animNumber].frameBase; item->pos.yRot += info.angle; @@ -81,9 +120,9 @@ void MummyControl(short itemNum) } else { - item->animNumber = Objects[item->objectNumber].animIndex + 10; + item->animNumber = Objects[item->objectNumber].animIndex + ANIMATION_MUMMY_COLLAPSE_START; item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = 7; + item->currentAnimState = STATE_MUMMY_COLLAPSE; item->pos.yRot += info.angle; creature->maximumTurn = 0; } @@ -93,7 +132,7 @@ void MummyControl(short itemNum) CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); return; } @@ -114,7 +153,7 @@ void MummyControl(short itemNum) switch (item->currentAnimState) { - case 1: + case STATE_MUMMY_STOP: creature->flags = 0; creature->maximumTurn = 0; @@ -133,10 +172,10 @@ void MummyControl(short itemNum) } } else - item->goalAnimState = 2; + item->goalAnimState = STATE_MUMMY_WALK; break; - case 2: + case STATE_MUMMY_WALK: if (item->triggerFlags == 1) { creature->maximumTurn = 0; @@ -150,42 +189,42 @@ void MummyControl(short itemNum) { if (info.distance > SQUARE(7168)) { - item->goalAnimState = 1; + item->goalAnimState = STATE_MUMMY_STOP; } } else { - item->goalAnimState = 3; + item->goalAnimState = STATE_MUMMY_WALK_ARMS_UP; } } break; - case 3: + case STATE_MUMMY_WALK_ARMS_UP: creature->flags = 0; creature->maximumTurn = ANGLE(7); if (info.distance < SQUARE(512)) { - item->goalAnimState = 1; + item->goalAnimState = STATE_MUMMY_STOP; break; } if (info.distance > SQUARE(3072) && info.distance < SQUARE(7168)) { - item->goalAnimState = 2; + item->goalAnimState = STATE_MUMMY_WALK; break; } if (info.distance <= SQUARE(682)) - item->goalAnimState = 4; + item->goalAnimState = STATE_MUMMY_WALK_HIT; else if (info.distance > SQUARE(7168)) - item->goalAnimState = 1; + item->goalAnimState = STATE_MUMMY_STOP; break; - case 0: + case STATE_MUMMY_ARMS_CROSSED: creature->maximumTurn = 0; if (info.distance < SQUARE(1024) || item->triggerFlags > -1) - item->goalAnimState = 2; + item->goalAnimState = STATE_MUMMY_WALK; break; - case 8: + case STATE_MUMMY_LYING_DOWN: joint0 = 0; joint1 = 0; joint2 = 0; @@ -193,13 +232,13 @@ void MummyControl(short itemNum) item->hitPoints = 0; if (info.distance < SQUARE(1024) || !(GetRandomControl() & 0x7F)) { - item->goalAnimState = 9; + item->goalAnimState = STATE_MUMMY_GET_UP; item->hitPoints = Objects[item->objectNumber].hitPoints; } break; - case 4: - case 10: + case STATE_MUMMY_WALK_HIT: + case STATE_MUMMY_HIT: creature->maximumTurn = 0; if (abs(info.angle) >= ANGLE(7)) { @@ -226,7 +265,7 @@ void MummyControl(short itemNum) LaraItem->hitPoints -= 100; LaraItem->hitStatus = true; - if (item->animNumber == Objects[item->objectNumber].animIndex + 15) + if (item->animNumber == Objects[item->objectNumber].animIndex + ANIMATION_MUMMY_HIT_LEFT) { CreatureEffect2( item, @@ -257,6 +296,5 @@ void MummyControl(short itemNum) CreatureJoint(item, 0, joint0); CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); - - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_mummy.h b/TR5Main/Objects/TR4/Entity/tr4_mummy.h new file mode 100644 index 000000000..3973e7dda --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_mummy.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseMummy(short itemNumber); +void MummyControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_sas.cpp b/TR5Main/Objects/TR4/Entity/tr4_sas.cpp similarity index 57% rename from TR5Main/Objects/TR4/tr4_sas.cpp rename to TR5Main/Objects/TR4/Entity/tr4_sas.cpp index 944fa5e0b..a46497d72 100644 --- a/TR5Main/Objects/TR4/tr4_sas.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_sas.cpp @@ -1,35 +1,90 @@ -#include "../newobjects.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/Box.h" -#include "../../Game/items.h" -#include "../../Game/people.h" -#include "../../Game/lara.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr4_sas.h" +#include "sphere.h" +#include "effect2.h" +#include "box.h" +#include "items.h" +#include "people.h" +#include "lara.h" +#include "setup.h" +#include "level.h" + +enum SAS_STATES +{ + STATE_SAS_EMPTY, + STATE_SAS_STOP, + STATE_SAS_WALK, + STATE_SAS_RUN, + STATE_SAS_WAIT, + STATE_SAS_SIGHT_SHOOT, + STATE_SAS_WALK_SHOOT, + STATE_SAS_DEATH, + STATE_SAS_SIGHT_AIM, + STATE_SAS_WALK_AIM, + STATE_SAS_HOLD_AIM, + STATE_SAS_HOLD_SHOOT, + STATE_SAS_KNEEL_AIM, + STATE_SAS_KNEEL_SHOOT, + STATE_SAS_KNEEL_STOP, + STATE_SAS_HOLD_PREPARE_GRENADE, + STATE_SAS_HOLD_SHOOT_GRENADE, + STATE_SAS_BLIND +}; + +enum SAS_ANIM +{ + ANIMATION_SAS_WALK, + ANIMATION_SAS_RUN, + ANIMATION_SAS_SIGHT_SHOOT, + ANIMATION_SAS_STAND_TO_SIGHT_AIM, + ANIMATION_SAS_WALK_TO_WALK_AIM, + ANIMATION_SAS_RUN_TO_WALK, + ANIMATION_SAS_WALK_SHOOT, + ANIMATION_SAS_SIGHT_AIM_TO_STAND, + ANIMATION_SAS_WALK_AIM_TO_STAND, + ANIMATION_SAS_STAND_TO_RUN, + ANIMATION_SAS_STAND_TO_WAIT, + ANIMATION_SAS_STAND_TO_WALK, + ANIMATION_SAS_STAND, + ANIMATION_SAS_WAIT_TO_STAND, + ANIMATION_SAS_WAIT, + ANIMATION_SAS_WAIT_TO_SIGHT_AIM, + ANIMATION_SAS_WALK_TO_RUN, + ANIMATION_SAS_WALK_TO_STAND, + ANIMATION_SAS_WALK_AIM_TO_WALK, + ANIMATION_SAS_DEATH, + ANIMATION_SAS_STAND_TO_HOLD_AIM, + ANIMATION_SAS_HOLD_SHOOT, + ANIMATION_SAS_HOLD_AIM_TO_STAND, + ANIMATION_SAS_HOLD_PREPARE_GRENADE, + ANIMATION_SAS_HOLD_SHOOT_GRENADE, + ANIMATION_SAS_STAND_TO_KNEEL_AIM, + ANIMATION_SAS_KNEEL_SHOOT, + ANIMATION_SAS_KNEEL_AIM_TO_STAND, + ANIMATION_SAS_BLIND, + ANIMATION_SAS_BLIND_TO_STAND +}; BITE_INFO sasGun = { 0, 300, 64, 7 }; - - -void InitialiseSas(short itemNum) +void InitialiseSas(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); - item->animNumber = Objects[item->objectNumber].animIndex + 12; + item->animNumber = Objects[item->objectNumber].animIndex + ANIMATION_SAS_STAND; item->frameNumber = Anims[item->animNumber].frameBase; - item->goalAnimState = 1; - item->currentAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; + item->currentAnimState = STATE_SAS_STOP; } -void SasControl(short itemNum) +void SasControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; ITEM_INFO* enemyItem = creature->enemy; @@ -92,18 +147,18 @@ void SasControl(short itemNum) angle = CreatureTurn(item, creature->maximumTurn); if (item->hitStatus) - AlertAllGuards(itemNum); + AlertAllGuards(itemNumber); int angle1 = 0; int angle2 = 0; switch (item->currentAnimState) { - case 1: + case STATE_SAS_STOP: creature->flags = 0; creature->maximumTurn = 0; joint2 = ang; - if (item->animNumber == Objects[item->objectNumber].animIndex + 17) + if (item->animNumber == Objects[item->objectNumber].animIndex + ANIMATION_SAS_WALK_TO_STAND) { if (abs(info.angle) >= ANGLE(10)) { @@ -137,12 +192,12 @@ void SasControl(short itemNum) joint2 = AIGuard(creature); if (!GetRandomControl()) { - if (item->currentAnimState == 1) + if (item->currentAnimState == STATE_SAS_STOP) { - item->goalAnimState = 4; + item->goalAnimState = STATE_SAS_WAIT; break; } - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; } } else if (!(item->aiBits & PATROL1) || (item->aiBits & 0x1F) == MODIFY /* || Lara_Bike*/) @@ -153,33 +208,33 @@ void SasControl(short itemNum) { if (GetRandomControl() & 1) { - item->goalAnimState = 8; + item->goalAnimState = STATE_SAS_SIGHT_AIM; } else if (GetRandomControl() & 1) { - item->goalAnimState = 10; + item->goalAnimState = STATE_SAS_HOLD_AIM; } else { - item->goalAnimState = 12; + item->goalAnimState = STATE_SAS_KNEEL_AIM; } } else if (!(item->aiBits & MODIFY)) { - item->goalAnimState = 2; + item->goalAnimState = STATE_SAS_WALK; } } else { if (item->aiBits & MODIFY) { - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; } else { if (creature->mood == ESCAPE_MOOD) { - item->goalAnimState = 3; + item->goalAnimState = STATE_SAS_RUN; } else { @@ -188,14 +243,14 @@ void SasControl(short itemNum) { if (creature->mood == BORED_MOOD || info.distance <= 0x400000) { - item->goalAnimState = 2; + item->goalAnimState = STATE_SAS_WALK; break; } - item->goalAnimState = 3; + item->goalAnimState = STATE_SAS_RUN; } else { - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; } } } @@ -203,12 +258,12 @@ void SasControl(short itemNum) } else { - item->goalAnimState = 2; + item->goalAnimState = STATE_SAS_WALK; joint2 = 0; } break; - case 4: + case STATE_SAS_WAIT: joint2 = ang; creature->flags = 0; creature->maximumTurn = 0; @@ -218,7 +273,7 @@ void SasControl(short itemNum) joint2 = AIGuard(creature); if (!GetRandomControl()) { - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; } } else if (Targetable(item, &info) @@ -227,62 +282,62 @@ void SasControl(short itemNum) || item->hitStatus /*|| Lara_Bike*/) { - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; } break; - case 2: + case STATE_SAS_WALK: creature->flags = 0; creature->maximumTurn = ANGLE(5); joint2 = ang; if (item->aiBits & PATROL1) { - item->goalAnimState = 2; + item->goalAnimState = STATE_SAS_WALK; } else if (/*!Lara_Bike ||*/ !(item->aiBits & GUARD) && item->aiBits) { if (creature->mood == ESCAPE_MOOD) { - item->goalAnimState = 3; + item->goalAnimState = STATE_SAS_RUN; } else { if (item->aiBits & GUARD || item->aiBits & FOLLOW && (creature->reachedGoal || distance > 0x400000)) { - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; break; } if (Targetable(item, &info)) { if (info.distance < 9437184 || info.enemyZone != info.zoneNumber) { - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; break; } - item->goalAnimState = 9; + item->goalAnimState = STATE_SAS_WALK_AIM; } else if (creature->mood) { if (info.distance > 0x400000) { - item->goalAnimState = 3; + item->goalAnimState = STATE_SAS_RUN; } } else if (info.ahead) { - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; break; } } } else { - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; } break; - case 3: + case STATE_SAS_RUN: if (info.ahead) joint2 = info.angle; creature->maximumTurn = ANGLE(10); @@ -299,29 +354,29 @@ void SasControl(short itemNum) if (item->aiBits & GUARD || item->aiBits & FOLLOW && (creature->reachedGoal || distance > 0x400000)) { - item->goalAnimState = 2; + item->goalAnimState = STATE_SAS_WALK; break; } if (creature->mood != ESCAPE_MOOD) { if (Targetable(item, &info)) { - item->goalAnimState = 2; + item->goalAnimState = STATE_SAS_WALK; } else { if (creature->mood != BORED_MOOD || creature->mood == STALK_MOOD && item->aiBits & FOLLOW && info.distance < 0x400000) { - item->goalAnimState = 2; + item->goalAnimState = STATE_SAS_WALK; } } } break; - case 8: - case 10: - case 12: + case STATE_SAS_SIGHT_AIM: + case STATE_SAS_HOLD_AIM: + case STATE_SAS_KNEEL_AIM: creature->flags = 0; if (info.ahead) { @@ -329,32 +384,32 @@ void SasControl(short itemNum) joint0 = info.angle; if (Targetable(item, &info)) { - if (item->currentAnimState == 8) + if (item->currentAnimState == STATE_SAS_SIGHT_AIM) { - item->goalAnimState = 5; + item->goalAnimState = STATE_SAS_SIGHT_SHOOT; } - else if (item->currentAnimState == 12) + else if (item->currentAnimState == STATE_SAS_KNEEL_AIM) { - item->goalAnimState = 13; + item->goalAnimState = STATE_SAS_KNEEL_SHOOT; } else { if (!(GetRandomControl() & 1)) { - item->goalAnimState = 15; + item->goalAnimState = STATE_SAS_HOLD_PREPARE_GRENADE; break; } - item->goalAnimState = 11; + item->goalAnimState = STATE_SAS_HOLD_SHOOT; } } else { - item->goalAnimState = 1; + item->goalAnimState = STATE_SAS_STOP; } } break; - case 9: + case STATE_SAS_WALK_AIM: creature->flags = 0; if (info.ahead) { @@ -362,16 +417,16 @@ void SasControl(short itemNum) joint0 = info.angle; if (Targetable(item, &info)) { - item->goalAnimState = 6; + item->goalAnimState = STATE_SAS_WALK_SHOOT; } else { - item->goalAnimState = 2; + item->goalAnimState = STATE_SAS_WALK; } } break; - case 15: + case STATE_SAS_HOLD_PREPARE_GRENADE: if (info.ahead) { joint1 = info.xAngle; @@ -379,7 +434,7 @@ void SasControl(short itemNum) } break; - case 16: + case STATE_SAS_HOLD_SHOOT_GRENADE: if (info.ahead) { angle1 = info.angle; @@ -404,19 +459,22 @@ void SasControl(short itemNum) } //ShotGreanade((int)item, v28, v27); if (Targetable(item, &info)) - item->goalAnimState = 15; + item->goalAnimState = STATE_SAS_HOLD_PREPARE_GRENADE; } break; - case 11: - case 13: - case 5: - case 6: - if (item->currentAnimState == 11 || item->currentAnimState == 13) + case STATE_SAS_HOLD_SHOOT: + case STATE_SAS_KNEEL_SHOOT: + case STATE_SAS_SIGHT_SHOOT: + case STATE_SAS_WALK_SHOOT: + if (item->currentAnimState == STATE_SAS_HOLD_SHOOT || item->currentAnimState == STATE_SAS_KNEEL_SHOOT) { - if (item->goalAnimState != 1 && item->goalAnimState != 14 && (creature->mood == ESCAPE_MOOD || !Targetable(item, &info))) + if (item->goalAnimState != STATE_SAS_STOP && item->goalAnimState != STATE_SAS_KNEEL_STOP && (creature->mood == ESCAPE_MOOD || !Targetable(item, &info))) { - item->goalAnimState = item->currentAnimState != 11 ? 14 : 1; + if(item->currentAnimState == STATE_SAS_HOLD_SHOOT) + item->goalAnimState = STATE_SAS_STOP; + else + item->goalAnimState = STATE_SAS_KNEEL_STOP; } } @@ -436,28 +494,29 @@ void SasControl(short itemNum) } break; - case 17: + case STATE_SAS_BLIND: if (!WeaponEnemyTimer && !(GetRandomControl() & 0x7F)) - item->goalAnimState = 4; + item->goalAnimState = STATE_SAS_WAIT; break; default: break; } - if ((unsigned __int8)WeaponEnemyTimer > 0x64u && item->currentAnimState != 17) + if (WeaponEnemyTimer > 100 && item->currentAnimState != STATE_SAS_BLIND) { creature->maximumTurn = 0; - item->animNumber = Objects[item->objectNumber].animIndex + 28; + item->animNumber = Objects[item->objectNumber].animIndex + ANIMATION_SAS_BLIND; item->frameNumber = Anims[item->animNumber].frameBase + (GetRandomControl() & 7); - item->currentAnimState = 17; + item->currentAnimState = STATE_SAS_BLIND; } + } - else if (item->currentAnimState != 7) + else if (item->currentAnimState != STATE_SAS_DEATH) { - item->animNumber = Objects[item->objectNumber].animIndex + 19; + item->animNumber = Objects[item->objectNumber].animIndex + ANIMATION_SAS_DEATH; item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = 7; + item->currentAnimState = STATE_SAS_DEATH; } CreatureTilt(item, tilt); @@ -465,5 +524,5 @@ void SasControl(short itemNum) CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_sas.h b/TR5Main/Objects/TR4/Entity/tr4_sas.h new file mode 100644 index 000000000..987ab189d --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_sas.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSas(short itemNumber); +void SasControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_sentrygun.cpp b/TR5Main/Objects/TR4/Entity/tr4_sentrygun.cpp new file mode 100644 index 000000000..e86827235 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_sentrygun.cpp @@ -0,0 +1,230 @@ +#include "framework.h" +#include "tr4_sentrygun.h" +#include "box.h" +#include "effect2.h" +#include "items.h" +#include "inventory.h" +#include "level.h" +#include "lot.h" +#include "tomb4fx.h" +#include "sphere.h" +#include "people.h" +#include "sound.h" +#include "trmath.h" +#include "objectslist.h" + +extern Inventory* g_Inventory; +BITE_INFO sentryGunBite = { 0, 0, 0, 8 }; + +static void SentryGunThrowFire(ITEM_INFO* item) +{ + for (int i = 0; i < 3; i++) + { + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = (GetRandomControl() & 0x1F) + 48; + spark->sG = 48; + spark->sB = 255; + spark->dR = (GetRandomControl() & 0x3F) - 64; + spark->dG = (GetRandomControl() & 0x3F) + -128; + spark->dB = 32; + spark->colFadeSpeed = 12; + spark->fadeToBlack = 8; + spark->transType = COLADD; + spark->life = spark->sLife = (GetRandomControl() & 0x1F) + 16; + + PHD_VECTOR pos1; + pos1.x = -140; + pos1.y = -30; + pos1.z = -4; + + GetJointAbsPosition(item, &pos1, 7); + + spark->x = (GetRandomControl() & 0x1F) + pos1.x - 16; + spark->y = (GetRandomControl() & 0x1F) + pos1.y - 16; + spark->z = (GetRandomControl() & 0x1F) + pos1.z - 16; + + PHD_VECTOR pos2; + pos2.x = -280; + pos2.y = -30; + pos2.z = -4; + + GetJointAbsPosition(item, &pos2, 7); + + int v = (GetRandomControl() & 0x3F) + 192; + + spark->xVel = v * (pos2.x - pos1.x) / 10; + spark->yVel = v * (pos2.y - pos1.y) / 10; + spark->zVel = v * (pos2.z - pos1.z) / 10; + + spark->friction = 85; + spark->gravity = -16 - (GetRandomControl() & 0x1F); + spark->maxYvel = 0; + spark->flags = 538; + + if ((GlobalCounter & 1) != 0) + { + v = 255; + spark->flags = 539; + } + + spark->scalar = 3; + spark->dSize = v * ((GetRandomControl() & 7) + 60) >> 8; + spark->sSize = spark->dSize >> 4; + spark->size = spark->dSize >> 4; + } +} + +void InitialiseSentryGun(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + ClearItem(itemNum); + + item->itemFlags[0] = 0; + item->itemFlags[1] = 768; + item->itemFlags[2] = 0; +} + +void SentryGunControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (!CreatureActive(itemNum)) + return; + + CREATURE_INFO* creature = (CREATURE_INFO*)item->data; + + AI_INFO info; + int c = 0; + + if (creature) + { + // Flags set by the ID_MINE object? + if (item->meshBits & 0x40) + { + if (item->itemFlags[0]) + { + PHD_VECTOR pos; + + pos.x = sentryGunBite.x; + pos.y = sentryGunBite.y; + pos.z = sentryGunBite.z; + + GetJointAbsPosition(item, &pos, sentryGunBite.meshNum); + + TriggerDynamicLight(pos.x, pos.y, pos.z, 4 * item->itemFlags[0] + 12, 24, 16, 4); + + item->itemFlags[0]--; + } + + if (item->itemFlags[0] & 1) + item->meshBits |= 0x100; + else + item->meshBits &= ~0x100; + + if (item->triggerFlags == 0) + { + item->pos.yPos -= 512; + CreatureAIInfo(item, &info); + item->pos.yPos += 512; + + int deltaAngle = info.angle - creature->jointRotation[0]; + + info.ahead = true; + if (deltaAngle <= -ANGLE(90) || deltaAngle >= ANGLE(90)) + info.ahead = false; + + if (Targetable(item, &info)) + { + if (info.distance < SQUARE(SECTOR(9))) + { + if (!g_Inventory->IsObjectPresentInInventory(ID_PUZZLE_ITEM5) && !item->itemFlags[0]) + { + if (info.distance <= SQUARE(SECTOR(2))) + { + // Throw fire + SentryGunThrowFire(item); + c = 4 * rcossin_tbl[(GlobalCounter & 0x1F) << 11 >> 3] >> 2; + } + else + { + // Shot to Lara with bullets + c = 0; + item->itemFlags[0] = 2; + + ShotLara(item, &info, &sentryGunBite, creature->jointRotation[0], 5); + SoundEffect(SFX_TR4_AUTOGUNS, &item->pos, 0); + + item->itemFlags[2] += 256; + if (item->itemFlags[2] > 6144) + { + item->itemFlags[2] = 6144; + } + } + } + + deltaAngle = c + info.angle - creature->jointRotation[0]; + if (deltaAngle <= ANGLE(10)) + { + if (deltaAngle < -ANGLE(10)) + { + deltaAngle = -ANGLE(10); + } + } + else + { + deltaAngle = ANGLE(10); + } + + creature->jointRotation[0] += deltaAngle; + + CreatureJoint(item, 1, -info.xAngle); + } + } + + item->itemFlags[2] -= 32; + + if (item->itemFlags[2] < 0) + { + item->itemFlags[2] = 0; + } + + creature->jointRotation[3] += item->itemFlags[2]; + creature->jointRotation[2] += item->itemFlags[1]; + + if (creature->jointRotation[2] > ANGLE(90) || + creature->jointRotation[2] < -ANGLE(90)) + { + item->itemFlags[1] = -item->itemFlags[1]; + } + } + else + { + // Stuck sentry gun + CreatureJoint(item, 0, (GetRandomControl() & 0x7FF) - 1024); + CreatureJoint(item, 1, ANGLE(45)); + CreatureJoint(item, 2, (GetRandomControl() & 0x3FFF) - ANGLE(45)); + } + } + else + { + ExplodingDeath(itemNum, -1, 257); + DisableBaddieAI(itemNum); + KillItem(itemNum); + + item->flags |= 1u; + item->status = ITEM_DESACTIVATED; + + RemoveAllItemsInRoom(item->roomNumber, ID_SMOKE_EMITTER_BLACK); + + TriggerExplosionSparks(item->pos.xPos, item->pos.yPos - 768, item->pos.zPos, 3, -2, 0, item->roomNumber); + for (int i = 0; i < 2; i++) + TriggerExplosionSparks(item->pos.xPos, item->pos.yPos - 768, item->pos.zPos, 3, -1, 0, item->roomNumber); + + SoundEffect(SFX_EXPLOSION1, &item->pos, 25165828); + SoundEffect(SFX_EXPLOSION2, &item->pos, 0); + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_sentrygun.h b/TR5Main/Objects/TR4/Entity/tr4_sentrygun.h new file mode 100644 index 000000000..08418fd9d --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_sentrygun.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSentryGun(short itemNum); +void SentryGunControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_skeleton.cpp b/TR5Main/Objects/TR4/Entity/tr4_skeleton.cpp similarity index 95% rename from TR5Main/Objects/TR4/tr4_skeleton.cpp rename to TR5Main/Objects/TR4/Entity/tr4_skeleton.cpp index e1a4879eb..25f37074a 100644 --- a/TR5Main/Objects/TR4/tr4_skeleton.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_skeleton.cpp @@ -1,26 +1,86 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/effects.h" -#include "../../Game/sphere.h" -#include "../../Game/debris.h" -#include "../../Game/effect2.h" -#include "../../Game/lot.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" -#include "../../Specific/setup.h" -#include "../../Game/tomb4fx.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr4_skeleton.h" +#include "items.h" +#include "box.h" +#include "people.h" +#include "effect.h" +#include "sphere.h" +#include "debris.h" +#include "effect2.h" +#include "lot.h" +#include "lara.h" +#include "sound.h" +#include "setup.h" +#include "tomb4fx.h" +#include "level.h" BITE_INFO skeletonBite = { 0, -16, 200, 11 }; -void InitialiseSkeleton(short itemNum) +static void WakeUpSkeleton(ITEM_INFO* item) { - ITEM_INFO* item = &Items[itemNum]; + short fxNum = CreateNewEffect(item->roomNumber); + if (fxNum != NO_ITEM) + { + FX_INFO* fx = &Effects[fxNum]; + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + + fx->pos.xPos = (byte)GetRandomControl() + item->pos.xPos - 128; + fx->pos.yPos = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + fx->pos.zPos = (byte)GetRandomControl() + item->pos.zPos - 128; + fx->roomNumber = item->roomNumber; + fx->pos.yRot = 2 * GetRandomControl(); + fx->speed = GetRandomControl() >> 11; + fx->fallspeed = -(GetRandomControl() >> 10); + fx->frameNumber = Objects[103].meshIndex; + fx->objectNumber = ID_BODY_PART; + fx->shade = 0x4210; + fx->flag2 = 0x601; + + SPARKS* spark = &Sparks[GetFreeSpark()]; + spark->on = 1; + spark->sR = 0; + spark->sG = 0; + spark->sB = 0; + spark->dR = 100; + spark->dG = 60; + spark->dB = 30; + spark->fadeToBlack = 8; + spark->colFadeSpeed = (GetRandomControl() & 3) + 4; + spark->life = spark->sLife = (GetRandomControl() & 7) + 16; + spark->x = fx->pos.xPos; + spark->y = fx->pos.yPos; + spark->z = fx->pos.zPos; + spark->xVel = phd_sin(fx->pos.yRot) >> 2; + spark->yVel = 0; + spark->zVel = phd_cos(fx->pos.yRot) >> 2; + spark->transType = COLADD; + spark->friction = 68; + spark->flags = 26; + spark->rotAng = GetRandomControl() & 0xFFF; + if (GetRandomControl() & 1) + { + spark->rotAdd = -16 - (GetRandomControl() & 0xF); + } + else + { + spark->rotAdd = (GetRandomControl() & 0xF) + 16; + } + spark->gravity = -4 - (GetRandomControl() & 3); + spark->scalar = 3; + spark->maxYvel = -4 - (GetRandomControl() & 3); + spark->sSize = spark->size = (GetRandomControl() & 0xF) + 8; + spark->dSize = spark->size * 4; + } +} + +void InitialiseSkeleton(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; ObjectInfo* obj = &Objects[ID_SKELETON]; - ClearItem(itemNum); + ClearItem(itemNumber); switch (item->triggerFlags) { @@ -50,18 +110,18 @@ void InitialiseSkeleton(short itemNum) item->currentAnimState = 25; item->animNumber = obj->animIndex; item->frameNumber = Anims[item->animNumber].frameBase; - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; break; } } -void SkeletonControl(short itemNum) +void SkeletonControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; ITEM_INFO* enemyItem = creature->enemy; bool someFlag1 = false; @@ -654,9 +714,9 @@ void SkeletonControl(short itemNum) { if (item->active) { - ExplodingDeath(itemNum, -1, 929); - KillItem(itemNum); - DisableBaddieAI(itemNum); + ExplodingDeath(itemNumber, -1, 929); + KillItem(itemNumber); + DisableBaddieAI(itemNumber); //Savegame.Kills++; } } @@ -719,65 +779,6 @@ void SkeletonControl(short itemNum) break; } - CreatureAnimation(itemNum, angle, 0); - } -} - -void WakeUpSkeleton(ITEM_INFO* item) -{ - short fxNum = CreateNewEffect(item->roomNumber); - if (fxNum != NO_ITEM) - { - FX_INFO* fx = &Effects[fxNum]; - - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - - fx->pos.xPos = (byte)GetRandomControl() + item->pos.xPos - 128; - fx->pos.yPos = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - fx->pos.zPos = (byte)GetRandomControl() + item->pos.zPos - 128; - fx->roomNumber = item->roomNumber; - fx->pos.yRot = 2 * GetRandomControl(); - fx->speed = GetRandomControl() >> 11; - fx->fallspeed = -(GetRandomControl() >> 10); - fx->frameNumber = Objects[103].meshIndex; - fx->objectNumber = ID_BODY_PART; - fx->shade = 0x4210; - fx->flag2 = 0x601; - - SPARKS* spark = &Sparks[GetFreeSpark()]; - spark->on = 1; - spark->sR = 0; - spark->sG = 0; - spark->sB = 0; - spark->dR = 100; - spark->dG = 60; - spark->dB = 30; - spark->fadeToBlack = 8; - spark->colFadeSpeed = (GetRandomControl() & 3) + 4; - spark->life = spark->sLife = (GetRandomControl() & 7) + 16; - spark->x = fx->pos.xPos; - spark->y = fx->pos.yPos; - spark->z = fx->pos.zPos; - spark->xVel = phd_sin(fx->pos.yRot) >> 2; - spark->yVel = 0; - spark->zVel = phd_cos(fx->pos.yRot) >> 2; - spark->transType = 2; - spark->friction = 68; - spark->flags = 26; - spark->rotAng = GetRandomControl() & 0xFFF; - if (GetRandomControl() & 1) - { - spark->rotAdd = -16 - (GetRandomControl() & 0xF); - } - else - { - spark->rotAdd = (GetRandomControl() & 0xF) + 16; - } - spark->gravity = -4 - (GetRandomControl() & 3); - spark->scalar = 3; - spark->maxYvel = -4 - (GetRandomControl() & 3); - spark->sSize = spark->size = (GetRandomControl() & 0xF) + 8; - spark->dSize = spark->size * 4; + CreatureAnimation(itemNumber, angle, 0); } } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_skeleton.h b/TR5Main/Objects/TR4/Entity/tr4_skeleton.h new file mode 100644 index 000000000..12796a76c --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_skeleton.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSkeleton(short itemNumber); +void SkeletonControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_smallscorpion.cpp b/TR5Main/Objects/TR4/Entity/tr4_smallscorpion.cpp similarity index 86% rename from TR5Main/Objects/TR4/tr4_smallscorpion.cpp rename to TR5Main/Objects/TR4/Entity/tr4_smallscorpion.cpp index 382095863..72bf56925 100644 --- a/TR5Main/Objects/TR4/tr4_smallscorpion.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_smallscorpion.cpp @@ -1,19 +1,20 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/items.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr4_smallscorpion.h" +#include "box.h" +#include "items.h" +#include "effect.h" +#include "setup.h" +#include "level.h" +#include "lara.h" BITE_INFO smallScorpionBiteInfo1 = { 0, 0, 0, 0 }; BITE_INFO smallScorpionBiteInfo2 = { 0, 0, 0, 23 }; -void InitialiseSmallScorpion(short itemNum) +void InitialiseSmallScorpion(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); item->animNumber = Objects[ID_SMALL_SCORPION].animIndex + 2; item->frameNumber = Anims[item->animNumber].frameBase; @@ -21,7 +22,7 @@ void InitialiseSmallScorpion(short itemNum) item->currentAnimState = 1; } -void SmallScorpionControl(short itemNum) +void SmallScorpionControl(short itemNumber) { short angle = 0; short head = 0; @@ -32,10 +33,10 @@ void SmallScorpionControl(short itemNum) short joint2 = 0; short joint3 = 0; - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; if (item->hitPoints > 0) @@ -167,5 +168,5 @@ void SmallScorpionControl(short itemNum) } } - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_smallscorpion.h b/TR5Main/Objects/TR4/Entity/tr4_smallscorpion.h new file mode 100644 index 000000000..d449b8e67 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_smallscorpion.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSmallScorpion(short itemNumber); +void SmallScorpionControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_sphinx.cpp b/TR5Main/Objects/TR4/Entity/tr4_sphinx.cpp similarity index 89% rename from TR5Main/Objects/TR4/tr4_sphinx.cpp rename to TR5Main/Objects/TR4/Entity/tr4_sphinx.cpp index 62fe9921a..5540385da 100644 --- a/TR5Main/Objects/TR4/tr4_sphinx.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_sphinx.cpp @@ -1,20 +1,21 @@ -#include "../newobjects.h" -#include "../../Game/debris.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr4_sphinx.h" +#include "debris.h" +#include "items.h" +#include "box.h" +#include "effect.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO sphinxBiteInfo = { 0, 0, 0, 6 }; -void InitialiseSphinx(short itemNum) +void InitialiseSphinx(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); item->animNumber = Objects[item->animNumber].animIndex + 1; item->frameNumber = Anims[item->animNumber].frameBase; @@ -22,12 +23,12 @@ void InitialiseSphinx(short itemNum) item->currentAnimState = 1; } -void SphinxControl(short itemNum) +void SphinxControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; ObjectInfo* obj = &Objects[item->objectNumber]; @@ -232,5 +233,5 @@ void SphinxControl(short itemNum) item->itemFlags[2] = item->pos.xPos; item->itemFlags[3] = item->pos.zPos; - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_sphinx.h b/TR5Main/Objects/TR4/Entity/tr4_sphinx.h new file mode 100644 index 000000000..209f580b1 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_sphinx.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSphinx(short itemNumber); +void SphinxControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_troops.cpp b/TR5Main/Objects/TR4/Entity/tr4_troops.cpp similarity index 93% rename from TR5Main/Objects/TR4/tr4_troops.cpp rename to TR5Main/Objects/TR4/Entity/tr4_troops.cpp index 439f00bd8..efe3e7539 100644 --- a/TR5Main/Objects/TR4/tr4_troops.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_troops.cpp @@ -1,23 +1,24 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/lara.h" -#include "../../Game/people.h" -#include "../../Specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr4_troops.h" +#include "box.h" +#include "items.h" +#include "sphere.h" +#include "effect2.h" +#include "lara.h" +#include "people.h" +#include "setup.h" +#include "lot.h" +#include "level.h" BITE_INFO TroopsBite1 = { 0, 300, 64, 7 }; -void InitialiseTroops(short itemNum) +void InitialiseTroops(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); if (item->triggerFlags == 1) { @@ -33,12 +34,12 @@ void InitialiseTroops(short itemNum) item->frameNumber = Anims[item->animNumber].frameBase; } -void TroopsControl(short itemNum) +void TroopsControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; ObjectInfo* obj = &Objects[item->objectNumber]; short angle = 0; @@ -126,7 +127,7 @@ void TroopsControl(short itemNum) { baddy = &BaddieSlots[i]; - if (baddy->itemNum != NO_ITEM && baddy->itemNum != itemNum) + if (baddy->itemNum != NO_ITEM && baddy->itemNum != itemNumber) { ITEM_INFO* currentItem = &Items[baddy->itemNum]; @@ -180,7 +181,7 @@ void TroopsControl(short itemNum) angle = CreatureTurn(item, creature->maximumTurn); if (item->hitStatus) - AlertAllGuards(itemNum); + AlertAllGuards(itemNumber); switch (item->currentAnimState) { @@ -474,10 +475,8 @@ void TroopsControl(short itemNum) } CreatureTilt(item, tilt); - CreatureJoint(item, 0, joint0); CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); - - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_troops.h b/TR5Main/Objects/TR4/Entity/tr4_troops.h new file mode 100644 index 000000000..4d1756e6f --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_troops.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseTroops(short itemNumber); +void TroopsControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_wildboard.cpp b/TR5Main/Objects/TR4/Entity/tr4_wildboar.cpp similarity index 86% rename from TR5Main/Objects/TR4/tr4_wildboard.cpp rename to TR5Main/Objects/TR4/Entity/tr4_wildboar.cpp index aef9330d8..458048044 100644 --- a/TR5Main/Objects/TR4/tr4_wildboard.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_wildboar.cpp @@ -1,19 +1,20 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/items.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "../../Game/lot.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr4_wildboar.h" +#include "box.h" +#include "items.h" +#include "effect.h" +#include "setup.h" +#include "lot.h" +#include "level.h" +#include "lara.h" BITE_INFO wildboardBiteInfo = { 0, 0, 0, 14 }; -void InitialiseWildBoar(short itemNum) +void InitialiseWildBoar(short itemNumber) { - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; - ClearItem(itemNum); + ClearItem(itemNumber); item->animNumber = Objects[ID_WILD_BOAR].animIndex + 6; item->frameNumber = Anims[item->animNumber].frameBase; @@ -21,12 +22,12 @@ void InitialiseWildBoar(short itemNum) item->currentAnimState = 1; } -void WildBoarControl(short itemNum) +void WildBoarControl(short itemNumber) { - if (!CreatureActive(itemNum)) + if (!CreatureActive(itemNumber)) return; - ITEM_INFO* item = &Items[itemNum]; + ITEM_INFO* item = &Items[itemNumber]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; short angle = 0; short head = 0; @@ -57,7 +58,7 @@ void WildBoarControl(short itemNum) for (int i = 0; i < NUM_SLOTS; i++, baddie++) { - if (baddie->itemNum == NO_ITEM || baddie->itemNum == itemNum) + if (baddie->itemNum == NO_ITEM || baddie->itemNum == itemNumber) continue; ITEM_INFO* target = &Items[baddie->itemNum]; @@ -170,5 +171,5 @@ void WildBoarControl(short itemNum) CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); CreatureJoint(item, 3, joint3); - CreatureAnimation(itemNum, angle, 0); + CreatureAnimation(itemNumber, angle, 0); } \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_wildboar.h b/TR5Main/Objects/TR4/Entity/tr4_wildboar.h new file mode 100644 index 000000000..46f39a5f9 --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_wildboar.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseWildBoar(short itemNumber); +void WildBoarControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Entity/tr4_wraith.cpp b/TR5Main/Objects/TR4/Entity/tr4_wraith.cpp new file mode 100644 index 000000000..de638f4cf --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_wraith.cpp @@ -0,0 +1,2 @@ +#include "framework.h" +#include "tr4_wraith.h" diff --git a/TR5Main/Objects/TR4/Entity/tr4_wraith.h b/TR5Main/Objects/TR4/Entity/tr4_wraith.h new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/TR5Main/Objects/TR4/Entity/tr4_wraith.h @@ -0,0 +1 @@ +#pragma once diff --git a/TR5Main/Objects/TR4/Floor/tr4_burningfloor.cpp b/TR5Main/Objects/TR4/Floor/tr4_burningfloor.cpp new file mode 100644 index 000000000..5d43b84ea --- /dev/null +++ b/TR5Main/Objects/TR4/Floor/tr4_burningfloor.cpp @@ -0,0 +1,13 @@ +#include "framework.h" +#include "tr4_burningfloor.h" +#include "level.h" + +void InitialiseBurningFloor(short itemNum) +{ + Items[itemNum].requiredAnimState = 127; +} + +void BurningFloorControl(short itemNum) +{ + +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Floor/tr4_burningfloor.h b/TR5Main/Objects/TR4/Floor/tr4_burningfloor.h new file mode 100644 index 000000000..1a0e45fad --- /dev/null +++ b/TR5Main/Objects/TR4/Floor/tr4_burningfloor.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseBurningFloor(short itemNum); +void BurningFloorControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Object/tr4_laradouble.cpp b/TR5Main/Objects/TR4/Object/tr4_laradouble.cpp new file mode 100644 index 000000000..5de438700 --- /dev/null +++ b/TR5Main/Objects/TR4/Object/tr4_laradouble.cpp @@ -0,0 +1,31 @@ +#include "framework.h" +#include "tr4_laradouble.h" +#include "items.h" +#include "level.h" +#include "sound.h" +#include "box.h" +#include "lara.h" + +void InitialiseLaraDouble(short itemNum) +{ + ClearItem(itemNum); +} + +void LaraDoubleControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP, &item->pos, 0); + + if (CreatureActive(itemNum)) + { + if (item->hitStatus) + { + LaraItem->hitPoints += item->hitPoints - 1000; + } + + item->hitPoints = 1000; + + AnimateItem(item); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Object/tr4_laradouble.h b/TR5Main/Objects/TR4/Object/tr4_laradouble.h new file mode 100644 index 000000000..39910d0ed --- /dev/null +++ b/TR5Main/Objects/TR4/Object/tr4_laradouble.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseLaraDouble(short itemNum); +void LaraDoubleControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Object/tr4_sarcophagus.cpp b/TR5Main/Objects/TR4/Object/tr4_sarcophagus.cpp new file mode 100644 index 000000000..2932717ba --- /dev/null +++ b/TR5Main/Objects/TR4/Object/tr4_sarcophagus.cpp @@ -0,0 +1,88 @@ +#include "framework.h" +#include "tr4_sarcophagus.h" +#include "level.h" +#include "input.h" +#include "lara.h" +#include "items.h" +#include "pickup.h" +#include "setup.h" + +static short SarcophagusBounds[12] = +{ + 0xFE00, 512, 0xFF9C, 100, 0xFE00, 0, + 0xF8E4, 1820, 0xEAAC, 5460, 0, 0 +}; +static PHD_VECTOR SarcophagusPosition(0, 0, -300); + +void InitialiseSarcophagus(short itemNum) +{ + +} + +void SarcophagusCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (TrInput & IN_ACTION && + item->status != ITEM_ACTIVE && + l->currentAnimState == STATE_LARA_STOP && + l->animNumber == ANIMATION_LARA_STAY_IDLE && + Lara.gunStatus == LG_NO_ARMS || + Lara.isMoving && (short)Lara.generalPtr == itemNum) + { + if (TestLaraPosition(SarcophagusBounds, item, l)) + { + if (MoveLaraPosition(&SarcophagusPosition, item, l)) + { + l->animNumber = ANIMATION_LARA_PICKUP_SARCOPHAGUS; + l->currentAnimState = STATE_LARA_MISC_CONTROL; + l->frameNumber = Anims[l->animNumber].frameBase; + item->flags |= IFLAG_ACTIVATION_MASK; + + AddActiveItem(itemNum); + item->status = ITEM_ACTIVE; + + Lara.isMoving = false; + Lara.headYrot = 0; + Lara.headXrot = 0; + Lara.torsoYrot = 0; + Lara.torsoXrot = 0; + Lara.gunStatus = LG_HANDS_BUSY; + } + else + { + Lara.generalPtr = (void*)itemNum; + } + } + else if (Lara.isMoving) + { + if ((short)Lara.generalPtr == itemNum) + { + Lara.isMoving = false; + Lara.gunStatus = LG_NO_ARMS; + } + } + } + else if (l->animNumber != ANIMATION_LARA_PICKUP_SARCOPHAGUS || l->frameNumber != Anims[ANIMATION_LARA_PICKUP_SARCOPHAGUS].frameBase + 113) + { + ObjectCollision(itemNum, l, coll); + } + else + { + short linknum; + for (linknum = Items[Rooms[item->roomNumber].itemNumber].nextItem; linknum != NO_ITEM; linknum = Items[linknum].nextItem) + { + ITEM_INFO* currentItem = &Items[linknum]; + + if (linknum != itemNum && currentItem->pos.xPos == item->pos.xPos && currentItem->pos.zPos == item->pos.zPos) + { + if (Objects[currentItem->objectNumber].isPickup) + { + PickedUpObject(currentItem->objectNumber); + currentItem->status = ITEM_ACTIVE; + currentItem->itemFlags[3] = 1; + } + } + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Object/tr4_sarcophagus.h b/TR5Main/Objects/TR4/Object/tr4_sarcophagus.h new file mode 100644 index 000000000..0b663c690 --- /dev/null +++ b/TR5Main/Objects/TR4/Object/tr4_sarcophagus.h @@ -0,0 +1,6 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void InitialiseSarcophagus(short itemNum); +void SarcophagusCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Object/tr4_scales.cpp b/TR5Main/Objects/TR4/Object/tr4_scales.cpp new file mode 100644 index 000000000..54c5bed7a --- /dev/null +++ b/TR5Main/Objects/TR4/Object/tr4_scales.cpp @@ -0,0 +1,185 @@ +#include "framework.h" +#include "tr4_scales.h" +#include "level.h" +#include "control.h" +#include "setup.h" +#include "items.h" +#include "lara.h" +#include "switch.h" +#include "sound.h" +#include "draw.h" +#include "tomb4fx.h" +#include "tr4_ahmet.h" + +static short ScalesBounds[12] = +{ + 0xFA80, 0xFA80, 0x0000, 0x0000, 0xFE00, 0x0200, + 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0xF8E4, 0x071C +}; + +void ScalesControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (item->frameNumber != Anims[item->animNumber].frameEnd) + { + AnimateItem(item); + return; + } + + if (item->currentAnimState == 1 || item->itemFlags[1]) + { + if (Objects[item->objectNumber].animIndex) + { + RemoveActiveItem(itemNum); + item->status = ITEM_NOT_ACTIVE; + item->itemFlags[1] = 0; + + AnimateItem(item); + return; + } + + if (RespawnAhmet((short)Lara.generalPtr)) + { + short itemNos[8]; + int sw = GetSwitchTrigger(item, itemNos, 0); + + if (sw > 0) + { + while (Items[itemNos[sw]].objectNumber == ID_FLAME_EMITTER2) + { + if (--sw <= 0) + break; + } + Items[itemNos[sw]].flags = 1024; + } + + item->goalAnimState = 1; + } + + AnimateItem(item); + } + + int flags = 0; + + if (item->currentAnimState == 2) + { + flags = -512; + RemoveActiveItem(itemNum); + item->status = ITEM_NOT_ACTIVE; + } + else + { + flags = -1024; + item->itemFlags[1] = 1; + } + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + + TestTriggers(TriggerIndex, TRUE, flags); + AnimateItem(item); +} + +void ScalesCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (TestBoundsCollide(item, l, LARA_RAD)) + { + if (l->animNumber != ANIMATION_LARA_WATERSKIN_EMPTY && l->animNumber != ANIMATION_LARA_WATERSKIN_POUR_ON_SCALE || item->currentAnimState != 1) + { + GlobalCollisionBounds.X1 = 640; + GlobalCollisionBounds.X2 = 1280; + GlobalCollisionBounds.Y1 = -1280; + GlobalCollisionBounds.Y2 = 0; + GlobalCollisionBounds.Z1 = -256; + GlobalCollisionBounds.Z2 = 384; + + ItemPushLara(item, l, coll, 0, 2); + + GlobalCollisionBounds.X1 = -256; + GlobalCollisionBounds.X2 = 256; + + ItemPushLara(item, l, coll, 0, 2); + + GlobalCollisionBounds.X1 = -1280; + GlobalCollisionBounds.X2 = -640; + + ItemPushLara(item, l, coll, 0, 2); + } + else + { + short rotY = item->pos.yRot; + item->pos.yRot = (short)(l->pos.yRot + ANGLE(45)) & 0xC000; + + ScalesBounds[0] = -1408; + ScalesBounds[1] = -640; + ScalesBounds[4] = -512; + ScalesBounds[5] = 0; + + if (TestLaraPosition(ScalesBounds, item, l)) + { + l->animNumber = ANIMATION_LARA_WATERSKIN_POUR_ON_SCALE; + l->frameNumber = Anims[item->animNumber].frameBase; + item->pos.yRot = rotY; + } + else if (l->frameNumber == Anims[ANIMATION_LARA_WATERSKIN_POUR_ON_SCALE].frameBase + 51) + { + SoundEffect(SFX_TR4_POUR, &l->pos, 0); + item->pos.yRot = rotY; + } + else if (l->frameNumber == Anims[ANIMATION_LARA_WATERSKIN_POUR_ON_SCALE].frameBase + 74) + { + AddActiveItem(itemNum); + item->status = ITEM_ACTIVE; + + if (l->itemFlags[3] < item->triggerFlags) + { + item->goalAnimState = 4; + item->pos.yRot = rotY; + } + else if (l->itemFlags[3] == item->triggerFlags) + { + item->goalAnimState = 2; + item->pos.yRot = rotY; + } + else + { + item->goalAnimState = 3; + } + } + else + { + item->pos.yRot = rotY; + } + } + } + + if (l->frameNumber >= Anims[ANIMATION_LARA_WATERSKIN_EMPTY].frameBase + 44 && + l->frameNumber <= Anims[ANIMATION_LARA_WATERSKIN_EMPTY].frameBase + 72 || + l->frameNumber >= Anims[ANIMATION_LARA_WATERSKIN_POUR_ON_SCALE].frameBase + 51 && + l->frameNumber <= Anims[ANIMATION_LARA_WATERSKIN_POUR_ON_SCALE].frameBase + 74) + { + PHD_VECTOR pos; + pos.x = 0; + pos.y = 0; + pos.z = 0; + + GetLaraJointPosition(&pos, LM_LHAND); + + DRIP_STRUCT* drip = &Drips[GetFreeDrip()]; + drip->x = pos.x; + drip->y = pos.y; + drip->z = pos.z; + drip->on = 1; + drip->r = (GetRandomControl() & 0xF) + 24; + drip->g = (GetRandomControl() & 0xF) + 44; + drip->b = (GetRandomControl() & 0xF) + 56; + drip->yVel = (GetRandomControl() & 0x1F) + 32; + drip->gravity = (GetRandomControl() & 0x1F) + 32; + drip->life = (GetRandomControl() & 0x1F) + 16; + drip->roomNumber = l->roomNumber; + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Object/tr4_scales.h b/TR5Main/Objects/TR4/Object/tr4_scales.h new file mode 100644 index 000000000..09ba9bc33 --- /dev/null +++ b/TR5Main/Objects/TR4/Object/tr4_scales.h @@ -0,0 +1,6 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void ScalesControl(short itemNum); +void ScalesCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_birdblade.cpp b/TR5Main/Objects/TR4/Trap/tr4_birdblade.cpp new file mode 100644 index 000000000..500d91542 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_birdblade.cpp @@ -0,0 +1,27 @@ +#include "framework.h" +#include "tr4_birdblade.h" +#include "level.h" +#include "control.h" + +void BirdBladeControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + item->itemFlags[3] = 100; + if (!TriggerActive(item)) + { + item->frameNumber = Anims[item->animNumber].frameBase; + item->itemFlags[0] = 0; + } + else + { + short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; + + if (frameNumber <= 14 || frameNumber >= 31) + item->itemFlags[0] = 0; + else + item->itemFlags[0] = 6; + + AnimateItem(item); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_birdblade.h b/TR5Main/Objects/TR4/Trap/tr4_birdblade.h new file mode 100644 index 000000000..7f9e1d73e --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_birdblade.h @@ -0,0 +1,3 @@ +#pragma once + +void BirdBladeControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_blade.cpp b/TR5Main/Objects/TR4/Trap/tr4_blade.cpp new file mode 100644 index 000000000..2f116f900 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_blade.cpp @@ -0,0 +1,55 @@ +#include "framework.h" +#include "tr4_blade.h" +#include "level.h" +#include "collide.h" +#include "lara.h" +#include "control.h" +#include "effect.h" + +void BladeCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (item->status == ITEM_INVISIBLE) + return; + + if (item->itemFlags[3]) // Check this + { + if (TestBoundsCollide(item, l, coll->radius)) + { + int oldX = LaraItem->pos.xPos; + int oldY = LaraItem->pos.yPos; + int oldZ = LaraItem->pos.zPos; + + int dx = 0; + int dy = 0; + int dz = 0; + + if (ItemPushLara(item, l, coll, 1, 1)) + { + LaraItem->hitPoints -= item->itemFlags[3]; + + dx = oldX - LaraItem->pos.xPos; + dy = oldY - LaraItem->pos.yPos; + dz = oldZ - LaraItem->pos.zPos; + + if ((dx || dy || dz) && TriggerActive(item)) + { + DoBloodSplat((GetRandomControl() & 0x3F) + l->pos.xPos - 32, + l->pos.yPos - (GetRandomControl() & 0x1FF) - 256, + (GetRandomControl() & 0x3F) + l->pos.zPos - 32, + (GetRandomControl() & 3) + (item->itemFlags[3] >> 5) + 2, + 2 * GetRandomControl(), + l->roomNumber); + } + + if (!coll->enableBaddiePush) + { + LaraItem->pos.xPos += dx; + LaraItem->pos.yPos += dy; + LaraItem->pos.zPos += dz; + } + } + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_blade.h b/TR5Main/Objects/TR4/Trap/tr4_blade.h new file mode 100644 index 000000000..5133968d3 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_blade.h @@ -0,0 +1,5 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void BladeCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_catwalkblade.cpp b/TR5Main/Objects/TR4/Trap/tr4_catwalkblade.cpp new file mode 100644 index 000000000..11feab647 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_catwalkblade.cpp @@ -0,0 +1,26 @@ +#include "framework.h" +#include "tr4_catwalkblade.h" +#include "level.h" +#include "control.h" + +void CatwalkBladeControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (!TriggerActive(item)) + { + item->frameNumber = Anims[item->animNumber].frameBase; + item->itemFlags[0] = 0; + } + else + { + short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; + + if (item->frameNumber == Anims[item->animNumber].frameEnd || frameNumber < 38) + item->itemFlags[3] = 0; + else + item->itemFlags[3] = 100; + + AnimateItem(item); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_catwalkblade.h b/TR5Main/Objects/TR4/Trap/tr4_catwalkblade.h new file mode 100644 index 000000000..23c45d702 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_catwalkblade.h @@ -0,0 +1,3 @@ +#pragma once + +void CatwalkBladeControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_chain.cpp b/TR5Main/Objects/TR4/Trap/tr4_chain.cpp new file mode 100644 index 000000000..30c50dd88 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_chain.cpp @@ -0,0 +1,35 @@ +#include "framework.h" +#include "tr4_chain.h" +#include "level.h" +#include "control.h" + +void ChainControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (item->triggerFlags) + { + item->itemFlags[2] = 1; + item->itemFlags[3] = 75; + + if (TriggerActive(item)) + { + item->itemFlags[0] = 30846; + AnimateItem(item); + return; + } + } + else + { + item->itemFlags[3] = 25; + + if (TriggerActive(item)) + { + item->itemFlags[0] = 1920; + AnimateItem(item); + return; + } + } + + item->itemFlags[0] = 0; +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_chain.h b/TR5Main/Objects/TR4/Trap/tr4_chain.h new file mode 100644 index 000000000..288da0811 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_chain.h @@ -0,0 +1,3 @@ +#pragma once + +void ChainControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_cog.cpp b/TR5Main/Objects/TR4/Trap/tr4_cog.cpp new file mode 100644 index 000000000..7b18ba51d --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_cog.cpp @@ -0,0 +1,32 @@ +#include "framework.h" +#include "tr4_cog.h" +#include "level.h" +#include "control.h" +#include "sphere.h" +#include "sound.h" + +void CogControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (TriggerActive(item)) + { + item->status = ITEM_ACTIVE; + // *(_DWORD *)&item->gap4C[5526] = *(_DWORD *)&item->gap4C[5526] & 0xFFFFFFFB | 2; + AnimateItem(item); + + if (item->triggerFlags == 666) + { + PHD_VECTOR pos; + GetJointAbsPosition(item, &pos, 0); + SoundEffect(65, (PHD_3DPOS*)&pos, 0); + + if (item->frameNumber == Anims[item->animNumber].frameEnd) + item->flags &= 0xC1; + } + } + else if (item->triggerFlags == 2) + { + item->status |= ITEM_INVISIBLE; + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_cog.h b/TR5Main/Objects/TR4/Trap/tr4_cog.h new file mode 100644 index 000000000..c60d92e3c --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_cog.h @@ -0,0 +1,3 @@ +#pragma once + +void CogControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_fourblades.cpp b/TR5Main/Objects/TR4/Trap/tr4_fourblades.cpp new file mode 100644 index 000000000..4fcf97970 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_fourblades.cpp @@ -0,0 +1,42 @@ +#include "framework.h" +#include "tr4_fourblades.h" +#include "level.h" +#include "control.h" + +void FourBladesControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + short frameNumber; + + if (!TriggerActive(item)) + { + item->frameNumber = Anims[item->animNumber].frameBase; + item->itemFlags[0] = 0; + } + else + { + frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; + if (frameNumber <= 5 || frameNumber >= 58 || frameNumber >= 8 && frameNumber <= 54) + { + item->itemFlags[0] = 0; + } + else + { + if (frameNumber >= 6 && frameNumber <= 7) + { + item->itemFlags[3] = 20; + item->itemFlags[0] = 30; + } + else + { + if (frameNumber >= 55 && frameNumber <= 57) + { + item->itemFlags[3] = 200; + item->itemFlags[0] = 30; + } + } + } + + AnimateItem(item); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_fourblades.h b/TR5Main/Objects/TR4/Trap/tr4_fourblades.h new file mode 100644 index 000000000..8273c702b --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_fourblades.h @@ -0,0 +1,3 @@ +#pragma once + +void FourBladesControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_mine.cpp b/TR5Main/Objects/TR4/Trap/tr4_mine.cpp new file mode 100644 index 000000000..274f4bb40 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_mine.cpp @@ -0,0 +1,160 @@ +#include "framework.h" +#include "tr4_mine.h" +#include "level.h" +#include "sphere.h" +#include "sound.h" +#include "effect2.h" +#include "tomb4fx.h" +#include "items.h" +#include "collide.h" +#include "objectslist.h" + +void InitialiseMine(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + if (item->triggerFlags) + item->meshBits = 0; +} + +void MineControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + int num = GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity); + if (item->itemFlags[0] >= 150) + { + SoundEffect(SFX_EXPLOSION1, &item->pos, 0); + SoundEffect(SFX_EXPLOSION2, &item->pos, 0); + SoundEffect(SFX_EXPLOSION1, &item->pos, PITCH_SHIFT | 0x1800000); + + if (num > 0) + { + SPHERE* sphere = &CreatureSpheres[0]; + + for (int i = 0; i < num; i++) + { + if (i >= 7 && i != 9) + { + TriggerExplosionSparks(sphere->x, sphere->y, sphere->z, 3, -2, 0, -item->roomNumber); + TriggerExplosionSparks(sphere->x, sphere->y, sphere->z, 3, -1, 0, -item->roomNumber); + TriggerShockwave((PHD_3DPOS*)sphere, 48, 304, (GetRandomControl() & 0x1F) + 112, 0, 96, 128, 32, 2048, 0); + } + + sphere++; + } + + for (int i = 0; i < num; i++) + ExplodeItemNode(item, i, 0, -128); + } + + FlashFadeR = 255; + FlashFadeG = 192; + FlashFadeB = 64; + FlashFader = 32; + + short currentItemNumber = Rooms[item->roomNumber].itemNumber; + + // Make the sentry gun explode? + while (currentItemNumber != NO_ITEM) + { + ITEM_INFO* currentItem = &Items[currentItemNumber]; + + if (currentItem->objectNumber == ID_SENTRY_GUN) + currentItem->meshBits &= ~0x40; + + currentItemNumber = currentItem->nextItem; + } + + KillItem(itemNum); + } + else + { + item->itemFlags[0]++; + + int something = 4 * item->itemFlags[0]; + if (something > 255) + something = 0; + + for (int i = 0; i < num; i++) + { + SPHERE* sphere = &CreatureSpheres[i]; + + if (i == 0 || i > 5) + AddFire(sphere->x, sphere->y, sphere->z, 2, item->roomNumber, something); + + sphere++; + } + + SoundEffect(SFX_LOOP_FOR_SMALL_FIRES, &item->pos, 0); + } +} + +void MineCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (item->triggerFlags && !item->itemFlags[3]) + { + if (l->animNumber != 432 || l->frameNumber < Anims[item->animNumber].frameBase + 57) + { + if (TestBoundsCollide(item, l, 512)) + { + TriggerExplosionSparks(item->pos.xPos, item->pos.yPos, item->pos.zPos, 3, -2, 0, item->roomNumber); + for (int i = 0; i < 2; i++) + TriggerExplosionSparks(item->pos.xPos, item->pos.yPos, item->pos.zPos, 3, -1, 0, item->roomNumber); + + item->meshBits = 1; + + ExplodeItemNode(item, 0, 0, 128); + KillItem(itemNum); + + l->animNumber = 438; + l->frameNumber = Anims[item->animNumber].frameBase; + l->currentAnimState = 8; + l->speed = 0; + + SoundEffect(SFX_TR4_MINE_EXP_OVERLAY, &item->pos, 0); + } + } + else + { + for (int i = 0; i < LevelItems; i++) + { + ITEM_INFO* currentItem = &Items[i]; + + // Explode other mines + if (currentItem->objectNumber == ID_MINE && currentItem->status != ITEM_INVISIBLE && !currentItem->triggerFlags) + { + TriggerExplosionSparks( + currentItem->pos.xPos, + currentItem->pos.yPos, + currentItem->pos.zPos, + 3, + -2, + 0, + currentItem->roomNumber); + + for (int j = 0; j < 2; j++) + TriggerExplosionSparks( + currentItem->pos.xPos, + currentItem->pos.yPos, + currentItem->pos.zPos, + 3, + -1, + 0, + currentItem->roomNumber); + + currentItem->meshBits = 1; + + ExplodeItemNode(currentItem, 0, 0, -32); + KillItem(i); + + if (!(GetRandomControl() & 3)) + SoundEffect(SFX_TR4_MINE_EXP_OVERLAY, ¤tItem->pos, 0); + + currentItem->status = ITEM_INVISIBLE; + } + } + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_mine.h b/TR5Main/Objects/TR4/Trap/tr4_mine.h new file mode 100644 index 000000000..d017972c6 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_mine.h @@ -0,0 +1,7 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void InitialiseMine(short itemNum); +void MineControl(short itemNum); +void MineCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_plinthblade.cpp b/TR5Main/Objects/TR4/Trap/tr4_plinthblade.cpp new file mode 100644 index 000000000..d84fcab1d --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_plinthblade.cpp @@ -0,0 +1,25 @@ +#include "framework.h" +#include "tr4_plinthblade.h" +#include "level.h" +#include "control.h" + +void PlinthBladeControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (!TriggerActive(item)) + { + item->frameNumber = Anims[item->animNumber].frameBase; + } + else + { + short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; + + if (item->frameNumber == Anims[item->animNumber].frameEnd) + item->itemFlags[3] = 0; + else + item->itemFlags[3] = 200; + + AnimateItem(item); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_plinthblade.h b/TR5Main/Objects/TR4/Trap/tr4_plinthblade.h new file mode 100644 index 000000000..2f378b38d --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_plinthblade.h @@ -0,0 +1,3 @@ +#pragma once + +void PlinthBladeControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_plough.cpp b/TR5Main/Objects/TR4/Trap/tr4_plough.cpp new file mode 100644 index 000000000..3ecd1136f --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_plough.cpp @@ -0,0 +1,20 @@ +#include "framework.h" +#include "tr4_plough.h" +#include "level.h" +#include "control.h" + +void PloughControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + item->itemFlags[3] = 50; + if (TriggerActive(item)) + { + item->itemFlags[0] = 258048; + AnimateItem(item); + } + else + { + item->itemFlags[0] = 0; + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_plough.h b/TR5Main/Objects/TR4/Trap/tr4_plough.h new file mode 100644 index 000000000..fd606f9ba --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_plough.h @@ -0,0 +1,3 @@ +#pragma once + +void PloughControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_sethblade.cpp b/TR5Main/Objects/TR4/Trap/tr4_sethblade.cpp new file mode 100644 index 000000000..6ded1a99a --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_sethblade.cpp @@ -0,0 +1,67 @@ +#include "framework.h" +#include "tr4_sethblade.h" +#include "level.h" +#include "setup.h" +#include "control.h" + +void InitialiseSethBlade(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + item->animNumber = Objects[item->objectNumber].animIndex + 1; + item->goalAnimState = 2; + item->currentAnimState = 2; + item->frameNumber = Anims[item->animNumber].frameBase; + item->itemFlags[2] = abs(item->triggerFlags); +} + +void SethBladeControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + item->itemFlags[0] = 0; + if (TriggerActive(item)) + { + if (item->currentAnimState == 2) + { + if (item->itemFlags[2] > 1) + { + item->itemFlags[2]--; + } + else if (item->itemFlags[2] == 1) + { + item->goalAnimState = 1; + item->itemFlags[2] = 0; + } + else if (!item->itemFlags[2]) + { + if (item->triggerFlags > 0) + { + item->itemFlags[2] = item->triggerFlags; + } + } + } + else + { + short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; + + if (item->frameNumber != Anims[item->animNumber].frameBase && frameNumber <= 6) + { + item->itemFlags[0] = -1; + item->itemFlags[3] = 1000; + } + else if (frameNumber >= 7 && frameNumber <= 15) + { + item->itemFlags[0] = 448; + item->itemFlags[3] = 1000; + } + else + { + item->itemFlags[0] = 0; + item->itemFlags[3] = 1000; + } + } + + AnimateItem(item); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_sethblade.h b/TR5Main/Objects/TR4/Trap/tr4_sethblade.h new file mode 100644 index 000000000..ea7bfe45d --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_sethblade.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSethBlade(short itemNum); +void SethBladeControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_slicerdicer.cpp b/TR5Main/Objects/TR4/Trap/tr4_slicerdicer.cpp new file mode 100644 index 000000000..a2135e01e --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_slicerdicer.cpp @@ -0,0 +1,45 @@ +#include "framework.h" +#include "tr4_slicerdicer.h" +#include "level.h" +#include "sound.h" +#include "items.h" +#include "trmath.h" + +void InitialiseSlicerDicer(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + int dx = phd_sin(item->pos.yRot + ANGLE(90.0f)) >> 5; + int dz = phd_cos(item->pos.yRot + ANGLE(90.0f)) >> 5; + + item->pos.xPos += dx; + item->pos.zPos += dz; + + item->itemFlags[0] = item->pos.xPos >> 8; + item->itemFlags[1] = (item->pos.yPos - 4608) >> 8; + item->itemFlags[2] = item->pos.zPos >> 8; + item->itemFlags[3] = 50; +} + +void SlicerDicerControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP1, &item->pos, 0); + SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP, &item->pos, 0); + + int factor = (9 * phd_cos(item->triggerFlags) << 9 >> W2V_SHIFT) * phd_cos(item->pos.yRot) >> W2V_SHIFT; + + item->pos.xPos = (item->itemFlags[0] << 8) + factor; + item->pos.yPos = (item->itemFlags[1] << 8) - 4608 * phd_sin(item->triggerFlags); + item->pos.zPos = (item->itemFlags[2] << 8) + factor; + + item->triggerFlags += 170; + + short roomNumber = item->roomNumber; + GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + if (item->roomNumber != roomNumber) + ItemNewRoom(itemNum, roomNumber); + + AnimateItem(item); +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_slicerdicer.h b/TR5Main/Objects/TR4/Trap/tr4_slicerdicer.h new file mode 100644 index 000000000..e3e7fe63c --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_slicerdicer.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseSlicerDicer(short itemNum); +void SlicerDicerControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_spikeball.cpp b/TR5Main/Objects/TR4/Trap/tr4_spikeball.cpp new file mode 100644 index 000000000..204bfea35 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_spikeball.cpp @@ -0,0 +1,37 @@ +#include "framework.h" +#include "tr4_spikeball.h" +#include "level.h" +#include "control.h" + +void SpikeballControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (TriggerActive(item)) + { + short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; + + if ((frameNumber <= 14 || frameNumber >= 24) && (frameNumber < 138 || frameNumber > 140)) + { + if (frameNumber < 141) + item->itemFlags[0] = 0; + else + { + item->itemFlags[3] = 50; + item->itemFlags[0] = 0x7FF800; + } + } + else + { + item->itemFlags[3] = 150; + item->itemFlags[0] = 0x7FF800; + } + + AnimateItem(item); + } + else + { + item->frameNumber = Anims[item->animNumber].frameBase; + item->itemFlags[0] = 0; + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_spikeball.h b/TR5Main/Objects/TR4/Trap/tr4_spikeball.h new file mode 100644 index 000000000..191bf03da --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_spikeball.h @@ -0,0 +1,3 @@ +#pragma once + +void SpikeballControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_spikyceiling.cpp b/TR5Main/Objects/TR4/Trap/tr4_spikyceiling.cpp new file mode 100644 index 000000000..6b4d80d9d --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_spikyceiling.cpp @@ -0,0 +1,50 @@ +#include "framework.h" +#include "tr4_spikyceiling.h" +#include "level.h" +#include "control.h" +#include "sound.h" +#include "items.h" +#include "lara.h" +#include "effect.h" + +void ControlSpikyCeiling(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (TriggerActive(item) && item->status != ITEM_DESACTIVATED) + { + int y = item->pos.yPos + ((item->itemFlags[0] == 1) ? 10 : 5); + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(item->pos.xPos, y, item->pos.zPos, &roomNumber); + + if (GetFloorHeight(floor, item->pos.xPos, y, item->pos.zPos) < y + 1024) + { + item->status = ITEM_DESACTIVATED; + StopSoundEffect(147); + } + else + { + item->pos.yPos = y; + + if (roomNumber != item->roomNumber) + ItemNewRoom(itemNumber, roomNumber); + + SoundEffect(147, &item->pos, 0); + } + } + + if (item->touchBits) + { + LaraItem->hitPoints -= 20; + LaraItem->hitStatus = true; + + DoLotsOfBlood(LaraItem->pos.xPos, item->pos.yPos + 768, LaraItem->pos.zPos, 4, item->pos.yRot, LaraItem->roomNumber, 3); + item->touchBits = 0; + + SoundEffect(56, &item->pos, 0); + } + + if (TriggerActive(item) && item->status != ITEM_DESACTIVATED && item->itemFlags[0] == 1) + AnimateItem(item); +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_spikyceiling.h b/TR5Main/Objects/TR4/Trap/tr4_spikyceiling.h new file mode 100644 index 000000000..ffc389666 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_spikyceiling.h @@ -0,0 +1,3 @@ +#pragma once + +void ControlSpikyCeiling(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_spikywall.cpp b/TR5Main/Objects/TR4/Trap/tr4_spikywall.cpp new file mode 100644 index 000000000..fd1cc35f0 --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_spikywall.cpp @@ -0,0 +1,48 @@ +#include "framework.h" +#include "tr4_spikywall.h" +#include "level.h" +#include "control.h" +#include "sound.h" +#include "lara.h" +#include "items.h" +#include "effect.h" + +void ControlSpikyWall(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + /* Move wall */ + if (TriggerActive(item) && item->status != ITEM_DESACTIVATED) + { + int x = item->pos.xPos + phd_sin(item->pos.yRot) >> WALL_SHIFT; + int z = item->pos.zPos + phd_cos(item->pos.yRot) >> WALL_SHIFT; + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(x, item->pos.yPos, z, &roomNumber); + + if (GetFloorHeight(floor, x, item->pos.yPos, z) != item->pos.yPos) + { + item->status = ITEM_DESACTIVATED; + StopSoundEffect(SFX_ROLLING_BALL); + } + else + { + item->pos.xPos = x; + item->pos.zPos = z; + if (roomNumber != item->roomNumber) + ItemNewRoom(itemNum, roomNumber); + SoundEffect(SFX_ROLLING_BALL, &item->pos, 0); + } + } + + if (item->touchBits) + { + LaraItem->hitPoints -= 15; + LaraItem->hitStatus = true; + + DoLotsOfBlood(LaraItem->pos.xPos, LaraItem->pos.yPos - 512, LaraItem->pos.zPos, 4, item->pos.yRot, LaraItem->roomNumber, 3); + item->touchBits = 0; + + SoundEffect(56, &item->pos, 0); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_spikywall.h b/TR5Main/Objects/TR4/Trap/tr4_spikywall.h new file mode 100644 index 000000000..afe7d486e --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_spikywall.h @@ -0,0 +1,3 @@ +#pragma once + +void ControlSpikyWall(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_stargate.cpp b/TR5Main/Objects/TR4/Trap/tr4_stargate.cpp new file mode 100644 index 000000000..08bf5187a --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_stargate.cpp @@ -0,0 +1,103 @@ +#include "framework.h" +#include "tr4_stargate.h" +#include "level.h" +#include "control.h" +#include "sound.h" +#include "collide.h" +#include "sphere.h" +#include "lara.h" +#include "effect.h" + +short StargateBounds[24] = +{ + 0xFE00, 0x0200, 0xFC00, 0xFC80, 0xFFA0, 0x0060, 0xFE00, 0x0200, + 0xFF80, 0x0000, 0xFFA0, 0x0060, 0xFE00, 0xFE80, 0xFC00, 0x0000, + 0xFFA0, 0x0060, 0x0180, 0x0200, 0xFC00, 0x0000, 0xFFA0, 0x0060 +}; + +void StargateControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + item->itemFlags[3] = 50; + + if (TriggerActive(item)) + { + SoundEffect(SFX_TR4_STARGATE_SWIRL, &item->pos, 0); + item->itemFlags[0] = 57521664; + AnimateItem(item); + } + else + { + item->itemFlags[0] = 0; + } +} + +void StargateCollision(short itemNum, ITEM_INFO* l, COLL_INFO* c) +{ + ITEM_INFO* item = &Items[itemNum]; + + if (item->status == ITEM_INVISIBLE) + return; + + if (TestBoundsCollide(item, l, c->radius)) + { + for (int i = 0; i < 8; i++) + { + GlobalCollisionBounds.X1 = StargateBounds[3 * i + 0]; + GlobalCollisionBounds.Y1 = StargateBounds[3 * i + 1]; + GlobalCollisionBounds.Z1 = StargateBounds[3 * i + 2]; + + if (TestWithGlobalCollisionBounds(item, l, c)) + ItemPushLara(item, l, c, 0, 2); + } + + int result = TestCollision(item, l); + if (result) + { + result &= item->itemFlags[0]; + int flags = item->itemFlags[0]; + + if (result) + { + int j = 0; + do + { + if (result & 1) + { + GlobalCollisionBounds.X1 = CreatureSpheres[j].x - CreatureSpheres[j].r - item->pos.xPos; + GlobalCollisionBounds.Y1 = CreatureSpheres[j].y - CreatureSpheres[j].r - item->pos.yPos; + GlobalCollisionBounds.Z1 = CreatureSpheres[j].z - CreatureSpheres[j].r - item->pos.zPos; + GlobalCollisionBounds.X2 = CreatureSpheres[j].x + CreatureSpheres[j].r - item->pos.xPos; + GlobalCollisionBounds.Y2 = CreatureSpheres[j].y + CreatureSpheres[j].r - item->pos.yPos; + GlobalCollisionBounds.Z2 = CreatureSpheres[j].z + CreatureSpheres[j].r - item->pos.zPos; + + int oldX = LaraItem->pos.xPos; + int oldY = LaraItem->pos.yPos; + int oldZ = LaraItem->pos.zPos; + + if (ItemPushLara(item, l, c, flags & 1, 2)) + { + if ((flags & 1) && + (oldX != LaraItem->pos.xPos || oldY != LaraItem->pos.yPos || oldZ != LaraItem->pos.zPos) && + TriggerActive(item)) + { + DoBloodSplat((GetRandomControl() & 0x3F) + l->pos.xPos - 32, + (GetRandomControl() & 0x1F) + CreatureSpheres[j].y - 16, + (GetRandomControl() & 0x3F) + l->pos.zPos - 32, + (GetRandomControl() & 3) + 2, + 2 * GetRandomControl(), + l->roomNumber); + LaraItem->hitPoints -= 100; + } + } + } + + result >>= 1; + j++; + flags >>= 1; + + } while (result); + } + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR4/Trap/tr4_stargate.h b/TR5Main/Objects/TR4/Trap/tr4_stargate.h new file mode 100644 index 000000000..d7797ea9d --- /dev/null +++ b/TR5Main/Objects/TR4/Trap/tr4_stargate.h @@ -0,0 +1,6 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void StargateControl(short itemNum); +void StargateCollision(short itemNum, ITEM_INFO* l, COLL_INFO* c); \ No newline at end of file diff --git a/TR5Main/Objects/Vehicles/jeep.cpp b/TR5Main/Objects/TR4/Vehicles/jeep.cpp similarity index 96% rename from TR5Main/Objects/Vehicles/jeep.cpp rename to TR5Main/Objects/TR4/Vehicles/jeep.cpp index caff6cfb6..69a92f7f3 100644 --- a/TR5Main/Objects/Vehicles/jeep.cpp +++ b/TR5Main/Objects/TR4/Vehicles/jeep.cpp @@ -1,23 +1,41 @@ -#include "../newobjects.h" -#include "../../Game/lara.h" -#include "../../Game/inventory.h" -#include "../../Game/effect2.h" -#include "../../Game/collide.h" -#include "../../Game/effects.h" -#include "../../Game/lara1gun.h" -#include "../../Game/items.h" -#include "../../Game/camera.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/sphere.h" -#include "../../Game/laraflar.h" -#include "../../Specific/input.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "jeep.h" +#include "lara.h" +#include "inventory.h" +#include "effect2.h" +#include "collide.h" +#include "effect.h" +#include "lara1gun.h" +#include "items.h" +#include "camera.h" +#include "tomb4fx.h" +#include "sphere.h" +#include "laraflar.h" +#include "input.h" +#include "sound.h" +#include "setup.h" +#include "level.h" -#include -#include "../../Specific/setup.h" -#include "../../Specific/level.h" - -using namespace std; +typedef struct JEEP_INFO +{ + short rot1; + short rot2; + short rot3; + short rot4; + int velocity; + int revs; + short engineRevs; + short trackMesh; + int jeepTurn; + int fallSpeed; + short momentumAngle; + short extraRotation; + short unknown0; + int pitch; + short flags; + short unknown1; + short unknown2; +}; #define JF_FALLING 0x40 #define JF_DEAD 0x80 @@ -38,21 +56,19 @@ using namespace std; #define JEEP_IN_ACCELERATE (IN_ACTION) #define JEEP_IN_BRAKE (IN_JUMP) #define JEEP_IN_DISMOUNT (IN_JUMP|IN_LEFT) -#define JEEP_IN_HANDBRAKE (IN_DASH|IN_DUCK) +#define JEEP_IN_HANDBRAKE (IN_SPRINT|IN_DUCK) //bool QuadHandbrakeStarting; //bool QuadCanHandbrakeStart; char JeepSmokeStart; bool JeepNoGetOff; - short Unk_0080DE1A; int Unk_0080DDE8; short Unk_0080DE24; - extern Inventory* g_Inventory; -int TestJeepHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos) +static int TestJeepHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos) { pos->y = item->pos.yPos - (dz * phd_sin(item->pos.xRot) >> W2V_SHIFT) + (dx * phd_sin(item->pos.zRot) >> W2V_SHIFT); @@ -71,7 +87,7 @@ int TestJeepHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos) return GetFloorHeight(floor, pos->x, pos->y, pos->z); } -int DoJeepShift(ITEM_INFO* jeep, PHD_VECTOR* pos, PHD_VECTOR* old) +static int DoJeepShift(ITEM_INFO* jeep, PHD_VECTOR* pos, PHD_VECTOR* old) { int x = pos->x >> WALL_SHIFT; int z = pos->z >> WALL_SHIFT; @@ -169,7 +185,7 @@ int DoJeepShift(ITEM_INFO* jeep, PHD_VECTOR* pos, PHD_VECTOR* old) return 0; } -int DoJeepDynamics(int height, int speed, int* y, int flags) +static int DoJeepDynamics(int height, int speed, int* y, int flags) { int result = 0; @@ -221,7 +237,7 @@ int DoJeepDynamics(int height, int speed, int* y, int flags) return result; } -int JeepCanGetOff() +static int JeepCanGetOff() { ITEM_INFO* item = &Items[Lara.Vehicle]; @@ -252,7 +268,7 @@ int JeepCanGetOff() return 1; } -void TriggerJeepExhaustSmoke(int x, int y, int z, short angle, short speed, int moving) +static void TriggerJeepExhaustSmoke(int x, int y, int z, short angle, short speed, int moving) { SPARKS* spark = &Sparks[GetFreeSpark()]; @@ -281,7 +297,7 @@ void TriggerJeepExhaustSmoke(int x, int y, int z, short angle, short speed, int spark->sLife = 9; } - spark->transType = 2; + spark->transType = COLADD; spark->x = (GetRandomControl() & 0xF) + x - 8; spark->y = (GetRandomControl() & 0xF) + y - 8; spark->z = (GetRandomControl() & 0xF) + z - 8; @@ -340,7 +356,7 @@ void InitialiseJeep(short itemNum) item->meshBits = 114687; } -int JeepCheckGetOff() +static int JeepCheckGetOff() { if (LaraItem->currentAnimState == 10) { @@ -368,7 +384,7 @@ int JeepCheckGetOff() return true; } -int GetOnJeep(int itemNumber) +static int GetOnJeep(int itemNumber) { ITEM_INFO* item = &Items[itemNumber]; @@ -412,7 +428,7 @@ int GetOnJeep(int itemNumber) return 0; } - _int16 roomNumber = item->roomNumber; + short roomNumber = item->roomNumber; FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); if (GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos) < -32000) return 0; @@ -464,7 +480,7 @@ int GetOnJeep(int itemNumber) return 0; } -int GetJeepCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p) +static int GetJeepCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p) { p->x = item->pos.xPos - p->x; p->z = item->pos.zPos - p->z; @@ -489,7 +505,7 @@ int GetJeepCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p) return 0; } -void JeepBaddieCollision(ITEM_INFO* jeep) +static void JeepBaddieCollision(ITEM_INFO* jeep) { vector roomsList; short* door, numDoors; @@ -576,7 +592,7 @@ void JeepBaddieCollision(ITEM_INFO* jeep) } } -void JeepExplode(ITEM_INFO* item) +static void JeepExplode(ITEM_INFO* item) { if (Rooms[item->roomNumber].flags & ENV_FLAG_WATER) { @@ -593,13 +609,13 @@ void JeepExplode(ITEM_INFO* item) ExplodingDeath(Lara.Vehicle, -1, 256); KillItem(Lara.Vehicle); - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; SoundEffect(SFX_EXPLOSION1, 0, 0); SoundEffect(SFX_EXPLOSION2, 0, 0); Lara.Vehicle = NO_ITEM; } -int JeepDynamics(ITEM_INFO* item) +static int JeepDynamics(ITEM_INFO* item) { JEEP_INFO* jeep = (JEEP_INFO*)item->data; @@ -844,7 +860,7 @@ int JeepDynamics(ITEM_INFO* item) return collide; } -int JeepUserControl(ITEM_INFO* item, int height, int* pitch) +static int JeepUserControl(ITEM_INFO* item, int height, int* pitch) { if (LaraItem->currentAnimState == 10 || LaraItem->goalAnimState == 10) TrInput = 0; @@ -1003,7 +1019,7 @@ int JeepUserControl(ITEM_INFO* item, int height, int* pitch) return 1; } -void AnimateJeep(ITEM_INFO* item, int collide, int dead) +static void AnimateJeep(ITEM_INFO* item, int collide, int dead) { JEEP_INFO* jeep = (JEEP_INFO*)item->data; @@ -1620,7 +1636,7 @@ void JeepCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) } } -int JeepControl() +int JeepControl(void) { ITEM_INFO* item = &Items[Lara.Vehicle]; JEEP_INFO* jeep = (JEEP_INFO*)item->data; diff --git a/TR5Main/Objects/TR4/Vehicles/jeep.h b/TR5Main/Objects/TR4/Vehicles/jeep.h new file mode 100644 index 000000000..6af38ddb6 --- /dev/null +++ b/TR5Main/Objects/TR4/Vehicles/jeep.h @@ -0,0 +1,7 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void InitialiseJeep(short itemNumber); +void JeepCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll); +int JeepControl(void); \ No newline at end of file diff --git a/TR5Main/Objects/Vehicles/motorbike.cpp b/TR5Main/Objects/TR4/Vehicles/motorbike.cpp similarity index 88% rename from TR5Main/Objects/Vehicles/motorbike.cpp rename to TR5Main/Objects/TR4/Vehicles/motorbike.cpp index 5eb98d529..fcfa7dc1e 100644 --- a/TR5Main/Objects/Vehicles/motorbike.cpp +++ b/TR5Main/Objects/TR4/Vehicles/motorbike.cpp @@ -1,19 +1,20 @@ -#include "../newobjects.h" -#include "../../Specific/level.h" -#include "../../Game/sphere.h" -#include "../../Game/control.h" -#include "../../Game/effect2.h" -#include "../../Game/lara.h" -#include "../../Game/inventory.h" -#include "../../Game/collide.h" -#include "../../Game/laraflar.h" -#include "../../Specific/setup.h" -#include "../../Game/lara1gun.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/items.h" -#include "../../Game/sound.h" -#include "../../Game/healt.h" -#include "../../Game/camera.h" +#include "framework.h" +#include "motorbike.h" +#include "level.h" +#include "sphere.h" +#include "control.h" +#include "effect2.h" +#include "lara.h" +#include "inventory.h" +#include "collide.h" +#include "laraflar.h" +#include "setup.h" +#include "lara1gun.h" +#include "tomb4fx.h" +#include "items.h" +#include "sound.h" +#include "health.h" +#include "camera.h" // TODO: need to fix the bug about the shift, i dont know why it appear but it's in MotorbikeDynamics() @@ -74,12 +75,12 @@ static MOTORBIKE_INFO* GetMotorbikeInfo(ITEM_INFO* item) return (MOTORBIKE_INFO*)item->data; } -void InitialiseMotorbike(short item_number) +void InitialiseMotorbike(short itemNumber) { ITEM_INFO* item; MOTORBIKE_INFO* motorbike; - item = &Items[item_number]; + item = &Items[itemNumber]; motorbike = (MOTORBIKE_INFO*)game_malloc(sizeof(MOTORBIKE_INFO)); item->data = (void*)motorbike; motorbike->velocity = 0; @@ -95,6 +96,123 @@ void InitialiseMotorbike(short item_number) item->meshBits = 0x3F7; } +static int TestMotorbikeHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos) +{ + pos->y = item->pos.yPos - (dz * phd_sin(item->pos.xRot) >> W2V_SHIFT) + (dx * phd_sin(item->pos.zRot) >> W2V_SHIFT); + + int c = phd_cos(item->pos.yRot); + int s = phd_sin(item->pos.yRot); + + pos->z = item->pos.zPos + ((dz * c - dx * s) >> W2V_SHIFT); + pos->x = item->pos.xPos + ((dz * s + dx * c) >> W2V_SHIFT); + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(pos->x, pos->y, pos->z, &roomNumber); + int ceiling = GetCeiling(floor, pos->x, pos->y, pos->z); + if (pos->y < ceiling || ceiling == NO_HEIGHT) + return NO_HEIGHT; + + return GetFloorHeight(floor, pos->x, pos->y, pos->z); +} + +static int DoMotorbikeShift(ITEM_INFO* motorbike, PHD_VECTOR* pos, PHD_VECTOR* old) +{ + int x = pos->x >> WALL_SHIFT; + int z = pos->z >> WALL_SHIFT; + int oldX = old->x >> WALL_SHIFT; + int oldZ = old->z >> WALL_SHIFT; + int shiftX = pos->x & (WALL_SIZE - 1); + int shiftZ = pos->z & (WALL_SIZE - 1); + + if (x == oldX) + { + if (z == oldZ) + { + motorbike->pos.zPos += (old->z - pos->z); + motorbike->pos.xPos += (old->x - pos->x); + } + else if (z > oldZ) + { + motorbike->pos.zPos -= shiftZ + 1; + return (pos->x - motorbike->pos.xPos); + } + else + { + motorbike->pos.zPos += WALL_SIZE - shiftZ; + return (motorbike->pos.xPos - pos->x); + } + } + else if (z == oldZ) + { + if (x > oldX) + { + motorbike->pos.xPos -= shiftX + 1; + return (motorbike->pos.zPos - pos->z); + } + else + { + motorbike->pos.xPos += WALL_SIZE - shiftX; + return (pos->z - motorbike->pos.zPos); + } + } + else + { + x = 0; + z = 0; + + short roomNumber = motorbike->roomNumber; + FLOOR_INFO* floor = GetFloor(old->x, pos->y, pos->z, &roomNumber); + int height = GetFloorHeight(floor, old->x, pos->y, pos->z); + if (height < old->y - STEP_SIZE) + { + if (pos->z > old->z) + z = -shiftZ - 1; + else + z = WALL_SIZE - shiftZ; + } + + roomNumber = motorbike->roomNumber; + floor = GetFloor(pos->x, pos->y, old->z, &roomNumber); + height = GetFloorHeight(floor, pos->x, pos->y, old->z); + if (height < old->y - STEP_SIZE) + { + if (pos->x > old->x) + x = -shiftX - 1; + else + x = WALL_SIZE - shiftX; + } + + if (x && z) + { + motorbike->pos.zPos += z; + motorbike->pos.xPos += x; + } + else if (z) + { + motorbike->pos.zPos += z; + if (z > 0) + return (motorbike->pos.xPos - pos->x); + else + return (pos->x - motorbike->pos.xPos); + } + else if (x) + { + motorbike->pos.xPos += x; + if (x > 0) + return (pos->z - motorbike->pos.zPos); + else + return (motorbike->pos.zPos - pos->z); + } + else + { + motorbike->pos.zPos += (old->z - pos->z); + motorbike->pos.xPos += (old->x - pos->x); + } + } + + return 0; +} + static void DrawMotorbikeLight(ITEM_INFO* item) { MOTORBIKE_INFO* motorbike; @@ -118,7 +236,7 @@ static void DrawMotorbikeLight(ITEM_INFO* item) CreateSpotLight(&start, &target, item->pos.yRot, rnd);*/ } -static BOOL GetOnMotorBike(short item_number) +static BOOL GetOnMotorBike(short itemNumber) { ITEM_INFO* item; FLOOR_INFO* floor; @@ -127,7 +245,7 @@ static BOOL GetOnMotorBike(short item_number) short angle; short room_number; - item = &Items[item_number]; + item = &Items[itemNumber]; if (item->flags & ONESHOT || Lara.gunStatus == LG_HANDS_BUSY || LaraItem->gravityStatus) return FALSE; @@ -163,14 +281,14 @@ static BOOL GetOnMotorBike(short item_number) return TRUE; } -void MotorbikeCollision(short item_number, ITEM_INFO* laraitem, COLL_INFO* coll) +void MotorbikeCollision(short itemNumber, ITEM_INFO* laraitem, COLL_INFO* coll) { ITEM_INFO* item; MOTORBIKE_INFO* motorbike; if (laraitem->hitPoints >= 0 && Lara.Vehicle == NO_ITEM) { - item = &Items[item_number]; + item = &Items[itemNumber]; motorbike = GetMotorbikeInfo(item); // update motorbike light @@ -180,9 +298,9 @@ void MotorbikeCollision(short item_number, ITEM_INFO* laraitem, COLL_INFO* coll) DrawMotorbikeLight(item); } - if (GetOnMotorBike(item_number)) + if (GetOnMotorBike(itemNumber)) { - Lara.Vehicle = item_number; + Lara.Vehicle = itemNumber; if (Lara.gunType == WEAPON_FLARE) { @@ -229,7 +347,7 @@ void MotorbikeCollision(short item_number, ITEM_INFO* laraitem, COLL_INFO* coll) } else { - ObjectCollision(item_number, laraitem, coll); + ObjectCollision(itemNumber, laraitem, coll); } } } @@ -399,30 +517,6 @@ static int MotorBikeCheckGetOff(void) return FALSE; } -int TestMotorbikeHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos) -{ - FLOOR_INFO* floor; - int c, s, ceiling, height; - short room_number; - - pos->y = item->pos.yPos - ((dx * phd_sin(item->pos.zRot) >> W2V_SHIFT) + (dz * phd_sin(item->pos.xRot)) >> W2V_SHIFT); - c = phd_cos(item->pos.yRot); - s = phd_sin(item->pos.yRot); - pos->z = item->pos.zPos + ((dz * c - dx * s) >> W2V_SHIFT); - pos->x = item->pos.xRot + ((dz * s + dx * c) >> W2V_SHIFT); - - room_number = item->roomNumber; - floor = GetFloor(pos->x, pos->y, pos->z, &room_number); - ceiling = GetCeiling(floor, pos->x, pos->y, pos->z); - - if (pos->y < ceiling || ceiling == -NO_HEIGHT) - return -NO_HEIGHT; - height = GetFloorHeight(floor, pos->x, pos->y, pos->z); - if (pos->y > height) - pos->y = height; - return height; -} - static int DoMotorBikeDynamics(int height, int fallspeed, int* y, int flags) { int kick; @@ -468,6 +562,31 @@ static int DoMotorBikeDynamics(int height, int fallspeed, int* y, int flags) return fallspeed; } +static int GetMotorbikeCollisionAnim(ITEM_INFO* item, PHD_VECTOR* pos) +{ + pos->x = item->pos.xPos - pos->x; + pos->z = item->pos.zPos - pos->z; + + if (pos->x || pos->z) + { + int c = phd_cos(item->pos.yRot); + int s = phd_sin(item->pos.yRot); + int front = ((pos->z * c) + (pos->x * s)) >> W2V_SHIFT; + int side = (-(pos->z * s) + (pos->x * c)) >> W2V_SHIFT; + + if (abs(front) > abs(side)) + { + return (front > 0) + 13; + } + else + { + return (side <= 0) + 11; + } + } + + return 0; +} + static int MotorBikeDynamics(ITEM_INFO* item) { MOTORBIKE_INFO* motorbike; @@ -638,33 +757,33 @@ static int MotorBikeDynamics(ITEM_INFO* item) int hfl = TestMotorbikeHeight(item, 500, -350, &fl); if (hfl < fl_old.y - STEP_SIZE) { - rot1 = abs(4 * DoJeepShift(item, &fl, &fl_old)); + rot1 = abs(4 * DoMotorbikeShift(item, &fl, &fl_old)); } int hbl = TestMotorbikeHeight(item, -500, -350, &bl); if (hbl < bl_old.y - STEP_SIZE) { if (rot1) - rot1 += abs(4 * DoJeepShift(item, &bl, &bl_old)); + rot1 += abs(4 * DoMotorbikeShift(item, &bl, &bl_old)); else - rot1 -= abs(4 * DoJeepShift(item, &bl, &bl_old)); + rot1 -= abs(4 * DoMotorbikeShift(item, &bl, &bl_old)); } int hmtf = TestMotorbikeHeight(item, 500, 128, &mtf); if (hmtf < mtf_old.y - STEP_SIZE) - rot2 -= abs(4 * DoJeepShift(item, &bl, &bl_old)); + rot2 -= abs(4 * DoMotorbikeShift(item, &bl, &bl_old)); int hmtb = TestMotorbikeHeight(item, -500, 0, &mtb); if (hmtb < mtb_old.y - STEP_SIZE) - DoJeepShift(item, &mtb, &mtb_old); + DoMotorbikeShift(item, &mtb, &mtb_old); int hbr = TestMotorbikeHeight(item, -500, 128, &br); if (hbr < br_old.y - STEP_SIZE) { if (rot2) - rot2 -= abs(4 * DoJeepShift(item, &bl, &bl_old)); + rot2 -= abs(4 * DoMotorbikeShift(item, &bl, &bl_old)); else - rot2 += abs(4 * DoJeepShift(item, &bl, &bl_old)); + rot2 += abs(4 * DoMotorbikeShift(item, &bl, &bl_old)); } if (rot1) @@ -674,7 +793,7 @@ static int MotorBikeDynamics(ITEM_INFO* item) floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &room_number); height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); if (height < (item->pos.yPos - STEP_SIZE)) - DoJeepShift(item, (PHD_VECTOR*)&item->pos, &oldpos); + DoMotorbikeShift(item, (PHD_VECTOR*)&item->pos, &oldpos); if (!motorbike->velocity) rot2 = 0; @@ -688,7 +807,7 @@ static int MotorBikeDynamics(ITEM_INFO* item) else motorbike->extraRotation = motorbike->wallShiftRotation; - collide = GetJeepCollisionAnim(item, &moved); + collide = GetMotorbikeCollisionAnim(item, &moved); if (collide) { newspeed = ((item->pos.zPos - oldpos.z) * phd_cos(motorbike->momentumAngle) + (item->pos.xPos - oldpos.x) * phd_sin(motorbike->momentumAngle)) >> 6; diff --git a/TR5Main/Objects/TR4/Vehicles/motorbike.h b/TR5Main/Objects/TR4/Vehicles/motorbike.h new file mode 100644 index 000000000..0cd21b771 --- /dev/null +++ b/TR5Main/Objects/TR4/Vehicles/motorbike.h @@ -0,0 +1,25 @@ +#pragma once +#include "items.h" +#include "collide.h" + +struct MOTORBIKE_INFO +{ + int wheelRight; // (two wheel: front and back) + int wheelLeft; // (one wheel: left) + int velocity; + int revs; + int engineRevs; + short momentumAngle; + short extraRotation; + short wallShiftRotation; + int bikeTurn; + int pitch; + short flags; + short lightPower; +}; + +void InitialiseMotorbike(short itemNumber); +void MotorbikeCollision(short itemNumber, ITEM_INFO* laraitem, COLL_INFO* coll); +int MotorbikeControl(void); +void DrawMotorbike(ITEM_INFO* item); +void DrawMotorbikeEffect(ITEM_INFO* item); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_objects.cpp b/TR5Main/Objects/TR4/tr4_objects.cpp new file mode 100644 index 000000000..5ad9b3049 --- /dev/null +++ b/TR5Main/Objects/TR4/tr4_objects.cpp @@ -0,0 +1,696 @@ +#include "framework.h" +#include "tr4_objects.h" +/// entities +#include "tr4_ahmet.h" // OK +#include "tr4_baddy.h" // OK +#include "tr4_bat.h" // OK +#include "tr4_bigscorpion.h" // OK +#include "tr4_crocodile.h" // OK +#include "tr4_demigod.h" // OK +#include "tr4_guide.h" // OK +#include "tr4_harpy.h" // OK +#include "tr4_horseman.h" // OFF +#include "tr4_jeanyves.h" // OK +#include "tr4_knighttemplar.h" // OK +#include "tr4_littlebeetle.h" +#include "tr4_mummy.h" // OK +#include "tr4_sas.h" // OK +#include "tr4_sentrygun.h" // OK +#include "tr4_skeleton.h" // OK +#include "tr4_smallscorpion.h" // OK +#include "tr4_sphinx.h" // OK +#include "tr4_troops.h" // OK +#include "tr4_wildboar.h" // OK +#include "tr4_wraith.h" // OFF +/// objects +#include "tr4_sarcophagus.h" +/// puzzle +#include "tr4_scales.h" +/// switch + +/// traps +#include "tr4_birdblade.h" +#include "tr4_blade.h" +#include "tr4_catwalkblade.h" +#include "tr4_chain.h" +#include "tr4_fourblades.h" +#include "tr4_mine.h" +#include "tr4_plinthblade.h" +#include "tr4_plough.h" +#include "tr4_sethblade.h" +#include "tr4_slicerdicer.h" +#include "tr4_spikeball.h" +#include "tr4_spikywall.h" +#include "tr4_spikyceiling.h" +#include "tr4_stargate.h" +#include "tr4_cog.h" +#include "tr4_laradouble.h" +/// vehicles +#include "motorbike.h" +#include "jeep.h" + +/// necessary import +#include "collide.h" +#include "objects.h" +#include "setup.h" +#include "level.h" + +static void StartBaddy(ObjectInfo* obj) +{ + obj = &Objects[ID_SMALL_SCORPION]; + if (obj->loaded) + { + obj->initialise = InitialiseSmallScorpion; + obj->control = SmallScorpionControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 8; + obj->pivotLength = 20; + obj->radius = 128; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_BIG_SCORPION]; + if (obj->loaded) + { + obj->initialise = InitialiseScorpion; + obj->control = ScorpionControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 80; + obj->pivotLength = 50; + obj->radius = 512; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveFlags = true; + obj->saveAnim = true; + } + + obj = &Objects[ID_WILD_BOAR]; + if (obj->loaded) + { + obj->initialise = InitialiseWildBoar; + obj->control = WildBoarControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 40; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex + 48 * 4] |= ROT_Z; + Bones[obj->boneIndex + 48 * 4] |= ROT_Y; + Bones[obj->boneIndex + 52 * 4] |= ROT_Z; + Bones[obj->boneIndex + 52 * 4] |= ROT_Y; + } + + obj = &Objects[ID_BAT]; + if (obj->loaded) + { + obj->initialise = InitialiseBat; + obj->control = BatControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 5; + obj->pivotLength = 10; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->zoneType = ZONE_FLYER; + } + + obj = &Objects[ID_AHMET]; + if (obj->loaded) + { + obj->initialise = InitialiseAhmet; + obj->control = AhmetControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 80; + obj->pivotLength = 300; + obj->radius = 341; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + obj->hitEffect = HIT_BLOOD; + + Bones[obj->boneIndex + 9 * 4] |= ROT_Y; + } + + obj = &Objects[ID_BADDY1]; + if (obj->loaded) + { + obj->initialise = InitialiseBaddy; + obj->control = BaddyControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 25; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->meshSwapSlot = ID_MESHSWAP_BADDY1; + obj->zoneType = ZONE_HUMAN_JUMP_AND_MONKEY; + + Bones[obj->boneIndex + 28 * 4] |= ROT_Y; + Bones[obj->boneIndex + 28 * 4] |= ROT_X; + Bones[obj->boneIndex + 88 * 4] |= ROT_Y; + Bones[obj->boneIndex + 88 * 4] |= ROT_X; + } + + obj = &Objects[ID_BADDY2]; + if (obj->loaded) + { + obj->initialise = InitialiseBaddy; + obj->control = BaddyControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 25; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->meshSwapSlot = ID_MESHSWAP_BADDY2; + obj->zoneType = ZONE_HUMAN_JUMP_AND_MONKEY; + + Bones[obj->boneIndex + 28 * 4] |= ROT_Y; + Bones[obj->boneIndex + 28 * 4] |= ROT_X; + Bones[obj->boneIndex + 88 * 4] |= ROT_Y; + Bones[obj->boneIndex + 88 * 4] |= ROT_X; + } + + obj = &Objects[ID_SAS_CAIRO]; + if (obj->loaded) + { + obj->initialise = InitialiseSas; + obj->control = SasControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 40; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex] |= ROT_Y; + Bones[obj->boneIndex] |= ROT_X; + Bones[obj->boneIndex + 28 * 4] |= ROT_Y; + Bones[obj->boneIndex + 28 * 4] |= ROT_X; + } + + obj = &Objects[ID_MUMMY]; + if (obj->loaded) + { + obj->initialise = InitialiseMummy; + obj->control = MummyControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 15; + obj->radius = 170; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex + 28 * 4] |= ROT_Y; + Bones[obj->boneIndex + 28 * 4] |= ROT_X; + Bones[obj->boneIndex + 72 * 4] |= ROT_Y; + } + + obj = &Objects[ID_SKELETON]; + if (obj->loaded) + { + obj->initialise = InitialiseSkeleton; + obj->control = SkeletonControl; + obj->collision = CreatureCollision; + obj->hitPoints = 15; + obj->shadowSize = 128; + obj->pivotLength = 50; + obj->radius = 128; + obj->explodableMeshbits = 0xA00; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_KNIGHT_TEMPLAR]; + if (obj->loaded) + { + obj->initialise = InitialiseKnightTemplar; + obj->control = KnightTemplarControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 15; + obj->pivotLength = 50; + obj->radius = 128; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveFlags = true; + obj->saveAnim = true; + + Bones[obj->boneIndex + 6 * 4] |= ROT_X | ROT_Y; + Bones[obj->boneIndex + 7 * 4] |= ROT_Y; + } + + obj = &Objects[ID_DEMIGOD1]; + if (obj->loaded) + { + obj->initialise = InitialiseDemigod; + obj->control = DemigodControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 200; + obj->pivotLength = 50; + obj->radius = 341; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->hitEffect = HIT_FRAGMENT; + obj->undead = true; + + Bones[obj->boneIndex + 4 * 4] |= ROT_X | ROT_Y | ROT_Z; + Bones[obj->boneIndex + 5 * 4] |= ROT_Y; + } + + obj = &Objects[ID_DEMIGOD2]; + if (obj->loaded) + { + obj->initialise = InitialiseDemigod; + obj->control = DemigodControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 200; + obj->pivotLength = 50; + obj->radius = 341; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->hitEffect = HIT_FRAGMENT; + Bones[obj->boneIndex + 4 * 4] |= ROT_X | ROT_Y | ROT_Z; + Bones[obj->boneIndex + 5 * 4] |= ROT_Y; + } + + obj = &Objects[ID_DEMIGOD3]; + if (obj->loaded) + { + obj->initialise = InitialiseDemigod; + obj->control = DemigodControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 200; + obj->pivotLength = 50; + obj->radius = 341; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->hitEffect = HIT_FRAGMENT; + Bones[obj->boneIndex + 4 * 4] |= ROT_X | ROT_Y | ROT_Z; + Bones[obj->boneIndex + 5 * 4] |= ROT_Y; + } + + obj = &Objects[ID_JEAN_YVES]; + if (obj->loaded) + { + obj->initialise = InitialiseJeanYves; + obj->control = JeanYvesControl; + obj->collision = ObjectCollision; + obj->nonLot = true; + obj->savePosition = true; + } + + obj = &Objects[ID_TROOPS]; + if (obj->loaded) + { + obj->initialise = InitialiseTroops; + obj->control = TroopsControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 40; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex] |= ROT_X | ROT_Y; + Bones[obj->boneIndex + 7 * 4] |= ROT_X | ROT_Y; + } + + obj = &Objects[ID_SENTRY_GUN]; + if (obj->loaded) + { + obj->initialise = InitialiseSentryGun; + obj->control = SentryGunControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 30; + obj->pivotLength = 50; + obj->radius = 204; + obj->intelligent = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->explodableMeshbits = 64; + + Bones[obj->boneIndex + 0] |= ROT_Y; + Bones[obj->boneIndex + 1 * 4] |= ROT_X; + Bones[obj->boneIndex + 2 * 4] |= ROT_Z; + Bones[obj->boneIndex + 3 * 4] |= ROT_Z; + } + + obj = &Objects[ID_HARPY]; + if (obj->loaded) + { + obj->initialise = InitialiseHarpy; + obj->control = HarpyControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 60; + obj->pivotLength = 50; + obj->radius = 409; + obj->intelligent = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->zoneType = ZONE_FLYER; + } + + obj = &Objects[ID_GUIDE]; + if (obj->loaded) + { + obj->initialise = InitialiseGuide; + obj->control = GuideControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = -16384; + obj->pivotLength = 0; + obj->radius = 128; + obj->intelligent = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + + Bones[obj->boneIndex + 6 * 4] |= ROT_X | ROT_Y; + Bones[obj->boneIndex + 20 * 4] |= ROT_X | ROT_Y; + } + + obj = &Objects[ID_CROCODILE]; + if (obj->loaded) + { + obj->initialise = InitialiseCrocodile; + obj->control = CrocodileControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 36; + obj->pivotLength = 300; + obj->radius = 409; + obj->intelligent = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->waterCreature = true; + obj->zoneType = ZONE_WATER; + + Bones[obj->boneIndex] |= ROT_Y; + Bones[obj->boneIndex + 7 * 4] |= ROT_Y; + Bones[obj->boneIndex + 9 * 4] |= ROT_Y; + Bones[obj->boneIndex + 10 * 4] |= ROT_Y; + } + + obj = &Objects[ID_SPHINX]; + if (obj->loaded) + { + obj->initialise = InitialiseSphinx; + obj->control = SphinxControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 1000; + obj->pivotLength = 500; + obj->radius = 512; + obj->intelligent = true; + obj->saveHitpoints = true; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_BABOON_NORMAL]; + if (obj->loaded) + { + + } + + obj = &Objects[ID_BABOON_INV]; + if (obj->loaded) + { + + } + + obj = &Objects[ID_BABOON_SILENT]; + if (obj->loaded) + { + + } +} + +static void StartObject(ObjectInfo* obj) +{ + obj = &Objects[ID_SARCOPHAGUS]; + if (obj->loaded) + { + obj->control = AnimatingControl; + obj->collision = SarcophagusCollision; + obj->saveFlags = true; + obj->saveAnim = true; + } +} + +static void StartTrap(ObjectInfo* obj) +{ + obj = &Objects[ID_CHAIN]; + if (obj->loaded) + { + obj->control = ChainControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_PLOUGH]; + if (obj->loaded) + { + obj->control = PloughControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_FLOOR_4BLADES]; + if (obj->loaded) + { + obj->control = FourBladesControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_CEILING_4BLADES]; + if (obj->loaded) + { + obj->control = FourBladesControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_SPIKEBALL]; + if (obj->loaded) + { + obj->control = SpikeballControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_CHAIN]; + if (obj->loaded) + { + obj->control = ChainControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_PLOUGH]; + if (obj->loaded) + { + obj->control = PloughControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_FLOOR_4BLADES]; + if (obj->loaded) + { + obj->control = FourBladesControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_CEILING_4BLADES]; + if (obj->loaded) + { + obj->control = FourBladesControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_STARGATE]; + if (obj->loaded) + { + obj->control = StargateControl; + obj->collision = StargateCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_SLICER_DICER]; + if (obj->loaded) + { + obj->initialise = InitialiseSlicerDicer; + obj->control = SlicerDicerControl; + obj->collision = BladeCollision; + obj->saveFlags = true; + } + + obj = &Objects[ID_MINE]; + if (obj->loaded) + { + obj->initialise = InitialiseMine; + obj->control = MineControl; + obj->collision = MineCollision; + obj->saveFlags = true; + obj->saveAnim = true; + obj->savePosition = true; + } + + obj = &Objects[ID_SPIKY_WALL]; + if (obj->loaded) + { + obj->control = ControlSpikyWall; + obj->collision = ObjectCollision; + obj->savePosition = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_SPIKY_CEILING]; + if (obj->loaded) + { + obj->control = ControlSpikyCeiling; + obj->collision = TrapCollision; + obj->savePosition = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_COG]; + if (obj->loaded) + { + obj->control = CogControl; + obj->collision = GenericSphereBoxCollision; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_LARA_DOUBLE]; + if (obj->loaded) + { + obj->initialise = InitialiseLaraDouble; + obj->control = LaraDoubleControl; + obj->collision = CreatureCollision; + obj->shadowSize = 128; + obj->hitPoints = 1000; + obj->pivotLength = 50; + obj->radius = 128; + obj->intelligent = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveFlags = true; + obj->saveAnim = true; + } +} + +static void StartVehicles(ObjectInfo* obj) +{ + obj = &Objects[ID_JEEP]; + if (obj->loaded) + { + obj->initialise = InitialiseJeep; + obj->collision = JeepCollision; + obj->savePosition = true; + obj->saveAnim = true; + obj->saveFlags = true; + } + + obj = &Objects[ID_MOTORBIKE]; + if (obj->loaded) + { + obj->initialise = InitialiseMotorbike; + obj->collision = MotorbikeCollision; + //obj->drawRoutine = DrawMotorbike; // for wheel rotation + obj->drawRoutineExtra = DrawMotorbikeEffect; + obj->savePosition = true; + obj->saveAnim = true; + obj->saveFlags = true; + } +} + +static void StartSwitch(ObjectInfo* obj) +{ + +} + +static ObjectInfo* objToInit; +void InitialiseTR4Objects() +{ + StartBaddy(objToInit); + StartObject(objToInit); + StartSwitch(objToInit); + StartTrap(objToInit); + StartVehicles(objToInit); +} diff --git a/TR5Main/Objects/TR4/tr4_objects.h b/TR5Main/Objects/TR4/tr4_objects.h new file mode 100644 index 000000000..c8cce843f --- /dev/null +++ b/TR5Main/Objects/TR4/tr4_objects.h @@ -0,0 +1,3 @@ +#pragma once + +void InitialiseTR4Objects(); \ No newline at end of file diff --git a/TR5Main/Objects/TR4/tr4_wraith.cpp b/TR5Main/Objects/TR4/tr4_wraith.cpp deleted file mode 100644 index 64f3ce7ea..000000000 --- a/TR5Main/Objects/TR4/tr4_wraith.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "../newobjects.h" \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Emitter/tr5_bats_emitter.cpp b/TR5Main/Objects/TR5/Emitter/tr5_bats_emitter.cpp new file mode 100644 index 000000000..8c3f10904 --- /dev/null +++ b/TR5Main/Objects/TR5/Emitter/tr5_bats_emitter.cpp @@ -0,0 +1,230 @@ +#include "framework.h" +#include "tr5_bats_emitter.h" +#include "level.h" +#include "control.h" +#include "setup.h" +#include "effect2.h" +#include "tomb4fx.h" +#include "sound.h" +#include "lara.h" +#include "draw.h" +#include + +int NextBat; +BAT_STRUCT* Bats; + +void InitialiseLittleBats(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (item->pos.yRot == 0) + { + item->pos.zPos += 512; + } + else if (item->pos.yRot == -ANGLE(180)) + { + item->pos.zPos -= 512; + } + else if (item->pos.yRot == -ANGLE(90)) + { + item->pos.xPos -= 512; + } + else if (item->pos.yRot == ANGLE(90)) + { + item->pos.xPos += 512; + } + + if (Objects[ID_BATS_EMITTER].loaded) + ZeroMemory(Bats, NUM_BATS * sizeof(BAT_STRUCT)); + + //LOWORD(item) = sub_402F27(ebx0, Bats, 0, 1920); +} + +void LittleBatsControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (TriggerActive(item)) + { + if (item->triggerFlags) + { + TriggerLittleBat(item); + item->triggerFlags--; + } + else + { + KillItem(itemNumber); + } + } +} + +short GetNextBat() +{ + short batNumber = NextBat; + int index = 0; + BAT_STRUCT* bat = &Bats[NextBat]; + + while (bat->on) + { + if (batNumber == NUM_BATS - 1) + { + bat = (BAT_STRUCT*)Bats; + batNumber = 0; + } + else + { + batNumber++; + bat++; + } + + index++; + + if (index >= NUM_BATS) + return NO_ITEM; + } + + NextBat = (batNumber + 1) & (NUM_BATS - 1); + + return batNumber; +} + +void TriggerLittleBat(ITEM_INFO* item) +{ + short batNumber = GetNextBat(); + + if (batNumber != NO_ITEM) + { + BAT_STRUCT* bat = &Bats[batNumber]; + + bat->roomNumber = item->roomNumber; + bat->pos.xPos = item->pos.xPos; + bat->pos.yPos = item->pos.yPos; + bat->pos.zPos = item->pos.zPos; + bat->pos.yRot = (GetRandomControl() & 0x7FF) + item->pos.yRot + -ANGLE(180) - 1024; + bat->on = 1; + bat->flags = 0; + bat->pos.xRot = (GetRandomControl() & 0x3FF) - 512; + bat->speed = (GetRandomControl() & 0x1F) + 16; + bat->laraTarget = GetRandomControl() & 0x1FF; + bat->counter = 20 * ((GetRandomControl() & 7) + 15); + } +} + +void UpdateBats() +{ + if (!Objects[ID_BATS_EMITTER].loaded) + return; + + short* bounds = GetBoundsAccurate(LaraItem); + + int x1 = LaraItem->pos.xPos + bounds[0] - (bounds[0] >> 2); + int x2 = LaraItem->pos.xPos + bounds[1] - (bounds[1] >> 2); + + int y1 = LaraItem->pos.yPos + bounds[2] - (bounds[2] >> 2); + int y2 = LaraItem->pos.yPos + bounds[3] - (bounds[3] >> 2); + + int z1 = LaraItem->pos.zPos + bounds[4] - (bounds[4] >> 2); + int z2 = LaraItem->pos.zPos + bounds[5] - (bounds[5] >> 2); + + int minDistance = MAXINT; + int minIndex = -1; + + for (int i = 0; i < NUM_BATS; i++) + { + BAT_STRUCT* bat = &Bats[i]; + + if (!bat->on) + continue; + + if ((Lara.burn || LaraItem->hitPoints <= 0) + && bat->counter > 90 + && !(GetRandomControl() & 7)) + bat->counter = 90; + + if (!(--bat->counter)) + { + bat->on = 0; + continue; + } + + if (!(GetRandomControl() & 7)) + { + bat->laraTarget = GetRandomControl() % 640 + 128; + bat->xTarget = (GetRandomControl() & 0x7F) - 64; + bat->zTarget = (GetRandomControl() & 0x7F) - 64; + } + + short angles[2]; + phd_GetVectorAngles( + LaraItem->pos.xPos + 8 * bat->xTarget - bat->pos.xPos, + LaraItem->pos.yPos - bat->laraTarget - bat->pos.yPos, + LaraItem->pos.zPos + 8 * bat->zTarget - bat->pos.zPos, + angles); + + int distance = SQUARE(LaraItem->pos.zPos - bat->pos.zPos) + + SQUARE(LaraItem->pos.xPos - bat->pos.xPos); + if (distance < minDistance) + { + minDistance = distance; + minIndex = i; + } + + distance = sqrt(distance) / 8; + if (distance < 48) + distance = 48; + else if (distance > 128) + distance = 128; + + if (bat->speed < distance) + bat->speed++; + else if (bat->speed > distance) + bat->speed--; + + if (bat->counter > 90) + { + short speed = bat->speed << 7; + + short xAngle = abs(angles[1] - bat->pos.xRot) >> 3; + short yAngle = abs(angles[0] - bat->pos.yRot) >> 3; + + if (xAngle < -speed) + xAngle = -speed; + else if (xAngle > speed) + xAngle = speed; + + if (yAngle < -speed) + yAngle = -speed; + else if (yAngle > speed) + yAngle = speed; + + bat->pos.yRot += yAngle; + bat->pos.xRot += xAngle; + } + + int sp = bat->speed * phd_cos(bat->pos.xRot) >> W2V_SHIFT; + + bat->pos.xPos += sp * phd_sin(bat->pos.yRot) >> W2V_SHIFT; + bat->pos.yPos += bat->speed * phd_sin(-bat->pos.xRot) >> W2V_SHIFT; + bat->pos.zPos += sp * phd_cos(bat->pos.yRot) >> W2V_SHIFT; + + if ((i % 2 == 0) + && bat->pos.xPos > x1 + && bat->pos.xPos < x2 + && bat->pos.yPos > y1 + && bat->pos.yPos < y2 + && bat->pos.zPos > z1 + && bat->pos.zPos < z2) + { + TriggerBlood(bat->pos.xPos, bat->pos.yPos, bat->pos.zPos, 2 * GetRandomControl(), 2); + if (LaraItem->hitPoints > 0) + LaraItem->hitPoints -= 2; + } + } + + if (minIndex != -1) + { + BAT_STRUCT* bat = &Bats[minIndex]; + if (!(GetRandomControl() & 4)) + SoundEffect(SFX_BATS_1, &bat->pos, 0); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Emitter/tr5_bats_emitter.h b/TR5Main/Objects/TR5/Emitter/tr5_bats_emitter.h new file mode 100644 index 000000000..7e9c3d031 --- /dev/null +++ b/TR5Main/Objects/TR5/Emitter/tr5_bats_emitter.h @@ -0,0 +1,27 @@ +#pragma once +#include "items.h" + +#define NUM_BATS 64 + +struct BAT_STRUCT +{ + PHD_3DPOS pos; // size=20, offset=0 + short roomNumber; // size=0, offset=20 + short speed; // size=0, offset=22 + short counter; // size=0, offset=24 + short laraTarget; // size=0, offset=26 + byte xTarget; // size=0, offset=28 + byte zTarget; // size=0, offset=29 + byte on; // size=0, offset=30 + byte flags; // size=0, offset=31 +}; + +extern int NextBat; +extern BAT_STRUCT* Bats; + + +short GetNextBat(); +void InitialiseLittleBats(short itemNumber); +void LittleBatsControl(short itemNumber); +void TriggerLittleBat(ITEM_INFO* item); +void UpdateBats(); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Emitter/tr5_dart_emitter.cpp b/TR5Main/Objects/TR5/Emitter/tr5_dart_emitter.cpp new file mode 100644 index 000000000..e539daa4a --- /dev/null +++ b/TR5Main/Objects/TR5/Emitter/tr5_dart_emitter.cpp @@ -0,0 +1,141 @@ +#include "framework.h" +#include "tr5_dart_emitter.h" +#include "level.h" +#include "lara.h" +#include "effect.h" +#include "items.h" +#include "effect2.h" +#include "sound.h" + +void DartControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (item->touchBits) + { + LaraItem->hitPoints -= 25; + LaraItem->hitStatus = true; + Lara.poisoned += 160; + DoBloodSplat(item->pos.xPos, item->pos.yPos, item->pos.zPos, (GetRandomControl() & 3) + 4, LaraItem->pos.yRot, LaraItem->roomNumber); + KillItem(itemNumber); + } + else + { + item->pos.xPos += item->speed * phd_sin(item->pos.yRot) >> W2V_SHIFT; + item->pos.yPos -= item->speed * phd_sin(item->pos.xRot) >> W2V_SHIFT; + item->pos.xPos += item->speed * phd_cos(item->pos.yRot) >> W2V_SHIFT; + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + + if (item->roomNumber != roomNumber) + ItemNewRoom(itemNumber, roomNumber); + + int height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + item->floor = height; + + if (item->pos.yPos >= height) + { + for (int i = 0; i < 4; i++) + { + TriggerDartSmoke(item->pos.xPos, item->pos.yPos, item->pos.zPos, 0, 0, 1); + } + + KillItem(itemNumber); + } + } +} + +void DartEmitterControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (item->active) + { + if (item->timer > 0) + { + item->timer--; + return; + } + else + { + item->timer = 24; + } + } + + short dartItemNumber = CreateItem(); + + if (dartItemNumber != NO_ITEM) + { + ITEM_INFO* dartItem = &Items[dartItemNumber]; + + dartItem->objectNumber = ID_DARTS; + dartItem->roomNumber = item->roomNumber; + + int x = 0; + int z = 0; + + if (item->pos.yRot > 0) + { + if (item->pos.yRot == ANGLE(90.0f)) + x = 512; + } + else if (item->pos.yRot < 0) + { + if (item->pos.yRot == -ANGLE(180.0f)) + { + z = -512; + } + else if (item->pos.yRot == -ANGLE(90.0f)) + { + x = -512; + } + } + else + { + z = 512; + } + + dartItem->pos.xPos = x + item->pos.xPos; + dartItem->pos.yPos = item->pos.yPos - 512; + dartItem->pos.zPos = z + item->pos.zPos; + + InitialiseItem(dartItemNumber); + + dartItem->pos.xRot = 0; + dartItem->pos.yRot = item->pos.yRot + -ANGLE(180); + dartItem->speed = 256; + + int xf = 0; + int zf = 0; + + if (x) + xf = abs(2 * x) - 1; + else + zf = abs(2 * z) - 1; + + for (int i = 0; i < 5; i++) + { + int random = -GetRandomControl(); + + int xv = 0; + int zv = 0; + + if (z >= 0) + zv = zf & random; + else + zv = -(zf & random); + + if (x >= 0) + xv = xf & random; + else + xv = -(xf & random); + + TriggerDartSmoke(dartItem->pos.xPos, dartItem->pos.yPos, dartItem->pos.zPos, xv, zv, 0); + } + + AddActiveItem(dartItemNumber); + dartItem->status = ITEM_ACTIVE; + SoundEffect(SFX_LIFT_DOORS, &dartItem->pos, 0); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Emitter/tr5_dart_emitter.h b/TR5Main/Objects/TR5/Emitter/tr5_dart_emitter.h new file mode 100644 index 000000000..3f59c932d --- /dev/null +++ b/TR5Main/Objects/TR5/Emitter/tr5_dart_emitter.h @@ -0,0 +1,2 @@ +#pragma once + diff --git a/TR5Main/Objects/TR5/Emitter/tr5_rats_emitter.cpp b/TR5Main/Objects/TR5/Emitter/tr5_rats_emitter.cpp new file mode 100644 index 000000000..366121957 --- /dev/null +++ b/TR5Main/Objects/TR5/Emitter/tr5_rats_emitter.cpp @@ -0,0 +1,298 @@ +#include "framework.h" +#include "tr5_rats_emitter.h" +#include "level.h" +#include "control.h" +#include "setup.h" +#include "effect2.h" +#include "tomb4fx.h" +#include "sound.h" +#include "lara.h" + +int NextRat; +RAT_STRUCT* Rats; + +short GetNextRat() +{ + short ratNum = NextRat; + int i = 0; + RAT_STRUCT* rat = &Rats[NextRat]; + + while (rat->on) + { + if (ratNum == NUM_RATS - 1) + { + rat = &Rats[0]; + ratNum = 0; + } + else + { + ratNum++; + rat++; + } + + i++; + + if (i >= NUM_RATS) + return NO_ITEM; + } + + NextRat = (ratNum + 1) & 0x1F; + return ratNum; +} + +void LittleRatsControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (item->triggerFlags) + { + if (!item->itemFlags[2] || !(GetRandomControl() & 0xF)) + { + item->triggerFlags--; + + if (item->itemFlags[2] && GetRandomControl() & 1) + item->itemFlags[2]--; + + short ratNum = GetNextRat(); + if (ratNum != -1) + { + RAT_STRUCT* rat = &Rats[ratNum]; + + rat->pos.xPos = item->pos.xPos; + rat->pos.yPos = item->pos.yPos; + rat->pos.zPos = item->pos.zPos; + rat->roomNumber = item->roomNumber; + + if (item->itemFlags[0]) + { + rat->pos.yRot = 2 * GetRandomControl(); + rat->fallspeed = -16 - (GetRandomControl() & 31); + } + else + { + rat->fallspeed = 0; + rat->pos.yRot = item->pos.yRot + (GetRandomControl() & 0x3FFF) - ANGLE(45); + } + + rat->pos.xRot = 0; + rat->pos.zRot = 0; + rat->on = 1; + rat->flags = GetRandomControl() & 30; + rat->speed = (GetRandomControl() & 31) + 1; + } + } + } +} + +void ClearRats() +{ + if (Objects[ID_RATS_EMITTER].loaded) + { + ZeroMemory(Rats, NUM_RATS * sizeof(RAT_STRUCT)); + NextRat = 0; + FlipEffect = -1; + } +} + +void InitialiseLittleRats(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + char flags = item->triggerFlags / 1000; + + item->pos.xRot = ANGLE(45); + item->itemFlags[1] = flags & 2; + item->itemFlags[2] = flags & 4; + item->itemFlags[0] = flags & 1; + item->triggerFlags = item->triggerFlags % 1000; + + if (flags & 1) + { + ClearRats(); + return; + } + + if (item->pos.yRot > -28672 && item->pos.yRot < -4096) + { + item->pos.xPos += 512; + } + else if (item->pos.yRot > 4096 && item->pos.yRot < 28672) + { + item->pos.xPos -= 512; + } + + if (item->pos.yRot > -8192 && item->pos.yRot < 8192) + { + item->pos.zPos -= 512; + } + else if (item->pos.yRot < -20480 || item->pos.yRot > 20480) + { + item->pos.zPos += 512; + } + + ClearRats(); +} + +void UpdateRats() +{ + if (Objects[ID_RATS_EMITTER].loaded) + { + for (int i = 0; i < NUM_RATS; i++) + { + RAT_STRUCT* rat = &Rats[i]; + + if (rat->on) + { + int oldX = rat->pos.xPos; + int oldY = rat->pos.yPos; + int oldZ = rat->pos.zPos; + + rat->pos.xPos += rat->speed * phd_sin(rat->pos.yRot) >> W2V_SHIFT; + rat->pos.yPos += rat->fallspeed; + rat->pos.zPos += rat->speed * phd_cos(rat->pos.yRot) >> W2V_SHIFT; + + rat->fallspeed += GRAVITY; + + int dx = LaraItem->pos.xPos - rat->pos.xPos; + int dy = LaraItem->pos.yPos - rat->pos.yPos; + int dz = LaraItem->pos.zPos - rat->pos.zPos; + + short angle; + if (rat->flags >= 170) + angle = rat->pos.yRot - (short)phd_atan(dz, dx); + else + angle = (short)phd_atan(dz, dx) - rat->pos.yRot; + + if (abs(dx) < 85 && abs(dy) < 85 && abs(dz) < 85) + { + LaraItem->hitPoints--; + LaraItem->hitStatus = true; + } + + // if life is even + if (rat->flags & 1) + { + // if rat is very near + if (abs(dz) + abs(dx) <= 1024) + { + if (rat->speed & 1) + rat->pos.yRot += 512; + else + rat->pos.yRot -= 512; + rat->speed = 48 - (abs(angle) >> 10); + } + else + { + if (rat->speed < (i & 31) + 24) + rat->speed++; + + if (abs(angle) >= 2048) + { + if (angle >= 0) + rat->pos.yRot += 1024; + else + rat->pos.yRot -= 1024; + } + else + { + rat->pos.yRot += 8 * (Wibble - i); + } + } + } + + short oldRoomNumber = rat->roomNumber; + + FLOOR_INFO* floor = GetFloor(rat->pos.xPos, rat->pos.yPos, rat->pos.zPos, &rat->roomNumber); + int height = GetFloorHeight(floor, rat->pos.xPos, rat->pos.yPos, rat->pos.zPos); + + // if height is higher than 5 clicks + if (height < rat->pos.yPos - 1280 || + height == NO_HEIGHT) + { + // if timer is higher than 170 time to disappear + if (rat->flags > 170) + { + rat->on = 0; + NextRat = 0; + } + + if (angle <= 0) + rat->pos.yRot -= ANGLE(90); + else + rat->pos.yRot += ANGLE(90); + + // reset rat to old position and disable fall + rat->pos.xPos = oldX; + rat->pos.yPos = oldY; + rat->pos.zPos = oldZ; + rat->fallspeed = 0; + } + else + { + // if height is lower than Y + 64 + if (height >= rat->pos.yPos - 64) + { + // if rat is higher than floor + if (height >= rat->pos.yPos) + { + // if fallspeed is too much or life is ended then kill rat + if (rat->fallspeed >= 500 || + rat->flags >= 200) + { + rat->on = 0; + NextRat = 0; + } + else + { + rat->pos.xRot = -128 * rat->fallspeed; + } + } + else + { + rat->pos.yPos = height; + rat->fallspeed = 0; + rat->flags |= 1; + } + } + else + { + // if block is higher than rat position then run vertically + rat->pos.xRot = 14336; + rat->pos.xPos = oldX; + rat->pos.yPos = oldY - 24; + rat->pos.zPos = oldZ; + rat->fallspeed = 0; + } + } + + if (!(Wibble & 60)) + rat->flags += 2; + + ROOM_INFO* r = &Rooms[rat->roomNumber]; + if (r->flags & ENV_FLAG_WATER) + { + rat->fallspeed = 0; + rat->speed = 16; + rat->pos.yPos = r->maxceiling + 50; + + if (Rooms[oldRoomNumber].flags & ENV_FLAG_WATER) + { + if (!(GetRandomControl() & 0xF)) + { + SetupRipple(rat->pos.xPos, r->maxceiling, rat->pos.zPos, (GetRandomControl() & 3) + 48, 2); + } + } + else + { + AddWaterSparks(rat->pos.xPos, r->maxceiling, rat->pos.zPos, 16); + SetupRipple(rat->pos.xPos, r->maxceiling, rat->pos.zPos, (GetRandomControl() & 3) + 48, 2); + SoundEffect(SFX_RATSPLASH, &rat->pos, 0); + } + } + + if (!i && !(GetRandomControl() & 4)) + SoundEffect(SFX_RATS_1, &rat->pos, 0); + } + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Emitter/tr5_rats_emitter.h b/TR5Main/Objects/TR5/Emitter/tr5_rats_emitter.h new file mode 100644 index 000000000..bd1ee90ca --- /dev/null +++ b/TR5Main/Objects/TR5/Emitter/tr5_rats_emitter.h @@ -0,0 +1,23 @@ +#pragma once +#include "items.h" + +#define NUM_RATS 32 + +struct RAT_STRUCT +{ + PHD_3DPOS pos; // size=20, offset=0 + short roomNumber; // size=0, offset=20 + short speed; // size=0, offset=22 + short fallspeed; // size=0, offset=24 + byte on; // size=0, offset=26 + byte flags; // size=0, offset=27 +}; + +extern int NextRat; +extern RAT_STRUCT* Rats; + +void ClearRats(); +short GetNextRat(); +void InitialiseLittleRats(short itemNumber); +void LittleRatsControl(short itemNumber); +void UpdateRats(); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Emitter/tr5_spider_emitter.cpp b/TR5Main/Objects/TR5/Emitter/tr5_spider_emitter.cpp new file mode 100644 index 000000000..9b3c7a852 --- /dev/null +++ b/TR5Main/Objects/TR5/Emitter/tr5_spider_emitter.cpp @@ -0,0 +1,260 @@ +#include "framework.h" +#include "tr5_spider_emitter.h" +#include "level.h" +#include "control.h" +#include "setup.h" +#include "effect2.h" +#include "tomb4fx.h" +#include "sound.h" +#include "lara.h" + +int NextSpider; +SPIDER_STRUCT* Spiders; + +short GetNextSpider() +{ + short spiderNum = NextSpider; + int i = 0; + SPIDER_STRUCT* spider = &Spiders[NextSpider]; + + while (spider->on) + { + if (spiderNum == (NUM_SPIDERS - 1)) + { + spider = &Spiders[0]; + spiderNum = 0; + } + else + { + ++spiderNum; + ++spider; + } + + if (++i >= NUM_SPIDERS) + return NO_ITEM; + } + + NextSpider = (spiderNum + 1) & (NUM_SPIDERS - 1); + return spiderNum; +} + +void ClearSpiders() +{ + if (Objects[ID_SPIDERS_EMITTER].loaded) + { + ZeroMemory(Spiders, NUM_SPIDERS * sizeof(SPIDER_STRUCT)); + NextSpider = 0; + FlipEffect = -1; + } +} + +void ClearSpidersPatch(ITEM_INFO* item) +{ + ClearSpiders(); +} + +void InitialiseSpiders(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + short flags = item->triggerFlags / -24; + + item->pos.xRot = ANGLE(45); + item->itemFlags[1] = flags & 2; + item->itemFlags[2] = flags & 4; + item->itemFlags[0] = flags & 1; + item->triggerFlags = flags % 1000; + + if (flags & 1) + { + ClearSpiders(); + return; + } + + if (item->pos.yRot > -28672 && item->pos.yRot < -4096) + { + item->pos.xPos += 512; + } + else if (item->pos.yRot > 4096 && item->pos.yRot < 28672) + { + item->pos.xPos -= 512; + } + + if (item->pos.yRot > -8192 && item->pos.yRot < 8192) + { + item->pos.zPos -= 512; + } + else if (item->pos.yRot < -20480 || item->pos.yRot > 20480) + { + item->pos.zPos += 512; + } + + ClearSpiders(); +} + +void SpidersEmitterControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (item->triggerFlags) + { + if (!item->itemFlags[2] || !(GetRandomControl() & 0xF)) + { + item->triggerFlags--; + + if (item->itemFlags[2] && GetRandomControl() & 1) + item->itemFlags[2]--; + + short spiderNum = GetNextSpider(); + if (spiderNum != NO_ITEM) + { + SPIDER_STRUCT* spider = &Spiders[spiderNum]; + + spider->pos.xPos = item->pos.xPos; + spider->pos.yPos = item->pos.yPos; + spider->pos.zPos = item->pos.zPos; + spider->roomNumber = item->roomNumber; + + if (item->itemFlags[0]) + { + spider->pos.yRot = 2 * GetRandomControl(); + spider->fallspeed = -16 - (GetRandomControl() & 0x1F); + } + else + { + spider->fallspeed = 0; + spider->pos.yRot = item->pos.yRot + (GetRandomControl() & 0x3FFF) - ANGLE(45); + } + + spider->pos.xRot = 0; + spider->pos.zRot = 0; + spider->on = true; + spider->flags = 0; + spider->speed = (GetRandomControl() & 0x1F) + 1; + } + } + } +} + +void UpdateSpiders() +{ + if (Objects[ID_SPIDERS_EMITTER].loaded) + { + for (int i = 0; i < NUM_SPIDERS; i++) + { + SPIDER_STRUCT* spider = &Spiders[i]; + if (spider->on) + { + int x = spider->pos.xPos; + int y = spider->pos.yPos; + int z = spider->pos.zPos; + + spider->pos.xPos += spider->speed * phd_sin(spider->pos.yRot) >> W2V_SHIFT; + spider->pos.yPos += spider->fallspeed; + spider->pos.zPos += spider->speed * phd_cos(spider->pos.yRot) >> W2V_SHIFT; + spider->fallspeed += GRAVITY; + + int dx = LaraItem->pos.xPos - spider->pos.xPos; + int dy = LaraItem->pos.yPos - spider->pos.yPos; + int dz = LaraItem->pos.zPos - spider->pos.zPos; + + short angle = phd_atan(dz, dx) - spider->pos.yRot; + + if (abs(dx) < 85 && abs(dy) < 85 && abs(dz) < 85) + { + LaraItem->hitPoints -= 3; + LaraItem->hitStatus = true; + TriggerBlood(spider->pos.xPos, spider->pos.yPos, spider->pos.zPos, spider->pos.yRot, 1); + } + + if (spider->flags) + { + if (abs(dx) + abs(dz) <= 768) + { + if (spider->speed & 1) + spider->pos.yRot += 512; + else + spider->pos.yRot -= 512; + spider->speed = 48 - (abs(angle) >> 10); + } + else + { + if (spider->speed < (i & 0x1F) + 24) + spider->speed++; + + if (abs(angle) >= 2048) + { + if (angle >= 0) + spider->pos.yRot += 1024; + else + spider->pos.yRot -= 1024; + } + else + { + spider->pos.yRot += 8 * (Wibble - i); + } + } + } + + FLOOR_INFO* floor = GetFloor(spider->pos.xPos, spider->pos.yPos, spider->pos.zPos, &spider->roomNumber); + int height = GetFloorHeight(floor, spider->pos.xPos, spider->pos.yPos, spider->pos.zPos); + + if (height >= spider->pos.yPos - 1280 || height == -32512) + { + if (height >= spider->pos.yPos - 64) + { + if (spider->pos.yPos <= height) + { + if (spider->fallspeed >= 500) + { + spider->on = false; + NextSpider = 0; + } + else + { + spider->pos.xRot = -128 * spider->fallspeed; + } + } + else + { + spider->pos.yPos = height; + spider->fallspeed = 0; + spider->flags = 1; + } + } + else + { + spider->pos.xRot = 14336; + spider->pos.xPos = x; + spider->pos.yPos = y - 8; + spider->pos.zPos = z; + spider->fallspeed = 0; + if (!(GetRandomControl() & 0x1F)) + spider->pos.yRot += -ANGLE(180); + } + } + else + { + if (angle <= 0) + spider->pos.yRot -= ANGLE(90); + else + spider->pos.yRot += ANGLE(90); + spider->pos.xPos = x; + spider->pos.yPos = y; + spider->pos.zPos = z; + spider->fallspeed = 0; + } + + if (spider->pos.yPos < Rooms[spider->roomNumber].maxceiling + 50) + { + spider->fallspeed = 1; + spider->pos.yRot += -32768; + spider->pos.yPos = Rooms[spider->roomNumber].maxceiling + 50; + } + + if (!i && !(GetRandomControl() & 4)) + SoundEffect(SFX_BEETLES, &spider->pos, 0); + } + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Emitter/tr5_spider_emitter.h b/TR5Main/Objects/TR5/Emitter/tr5_spider_emitter.h new file mode 100644 index 000000000..fe9887819 --- /dev/null +++ b/TR5Main/Objects/TR5/Emitter/tr5_spider_emitter.h @@ -0,0 +1,24 @@ +#pragma once +#include "items.h" + +#define NUM_SPIDERS 64 + +struct SPIDER_STRUCT +{ + PHD_3DPOS pos; // size=20, offset=0 + short roomNumber; // size=0, offset=20 + short speed; // size=0, offset=22 + short fallspeed; // size=0, offset=24 + byte on; // size=0, offset=26 + byte flags; // size=0, offset=27 +}; + +extern int NextSpider; +extern SPIDER_STRUCT* Spiders; + +short GetNextSpider(); +void ClearSpiders(); +void ClearSpidersPatch(ITEM_INFO* item); +void InitialiseSpiders(short itemNumber); +void SpidersEmitterControl(short itemNumber); +void UpdateSpiders(); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_autoguns.cpp b/TR5Main/Objects/TR5/Entity/tr5_autoguns.cpp similarity index 85% rename from TR5Main/Objects/TR5/tr5_autoguns.cpp rename to TR5Main/Objects/TR5/Entity/tr5_autoguns.cpp index 3846c9ae6..c66654c49 100644 --- a/TR5Main/Objects/TR5/tr5_autoguns.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_autoguns.cpp @@ -1,23 +1,24 @@ -#include "../newobjects.h" -#include "../../Game/sphere.h" -#include "../../Game/lara.h" -#include "../../Game/draw.h" -#include "../../Game/effect2.h" -#include "../../Game/effects.h" -#include "../../Game/tomb4fx.h" -#include "..\..\Specific\level.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_autoguns.h" +#include "sphere.h" +#include "lara.h" +#include "draw.h" +#include "effect2.h" +#include "effect.h" +#include "tomb4fx.h" +#include "level.h" +#include "sound.h" -void InitialiseAutoGuns(short itemNum) +void InitialiseAutoGuns(short itemNumber) { ITEM_INFO* item; - item = &Items[itemNum]; + item = &Items[itemNumber]; item->meshBits = 1024; item->data = (void*)game_malloc(5702); } -void TriggerAutoGunSmoke(PHD_VECTOR* pos, char shade) +static void TriggerAutoGunSmoke(PHD_VECTOR* pos, char shade) { SMOKE_SPARKS* spark = &SmokeSparks[GetFreeSmokeSpark()]; @@ -46,7 +47,7 @@ void TriggerAutoGunSmoke(PHD_VECTOR* pos, char shade) spark->size = spark->dSize >> 2; } -void ControlAutoGuns(short itemNumber) +void AutoGunsControl(short itemNumber) { ITEM_INFO* item = &Items[itemNumber]; @@ -62,13 +63,13 @@ void ControlAutoGuns(short itemNumber) pos1.x = 0; pos1.y = 0; pos1.z = -64; - GetJointAbsPosition(item, (PHD_VECTOR*)& pos1, 8); + GetJointAbsPosition(item, (PHD_VECTOR*)&pos1, 8); GAME_VECTOR pos2; pos2.x = 0; pos2.y = 0; pos2.z = 0; - GetLaraJointPosition((PHD_VECTOR*)& pos2, 0); + GetLaraJointPosition((PHD_VECTOR*)&pos2, 0); pos1.roomNumber = item->roomNumber; @@ -165,7 +166,7 @@ void ControlAutoGuns(short itemNumber) } if (item->itemFlags[2]) - TriggerAutoGunSmoke((PHD_VECTOR*)& pos1, item->itemFlags[2] >> 4); + TriggerAutoGunSmoke((PHD_VECTOR*)&pos1, item->itemFlags[2] >> 4); } else { diff --git a/TR5Main/Objects/TR5/Entity/tr5_autoguns.h b/TR5Main/Objects/TR5/Entity/tr5_autoguns.h new file mode 100644 index 000000000..11f19408f --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_autoguns.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseAutoGuns(short itemNumber); +void AutoGunsControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_brownbeast.cpp b/TR5Main/Objects/TR5/Entity/tr5_brownbeast.cpp similarity index 93% rename from TR5Main/Objects/TR5/tr5_brownbeast.cpp rename to TR5Main/Objects/TR5/Entity/tr5_brownbeast.cpp index 4af234182..0d761be12 100644 --- a/TR5Main/Objects/TR5/tr5_brownbeast.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_brownbeast.cpp @@ -1,13 +1,14 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/effect2.h" -#include "../../Game/tomb4fx.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_brownbeast.h" +#include "items.h" +#include "box.h" +#include "effect.h" +#include "effect2.h" +#include "tomb4fx.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO BrownBeastBite1 = { 0, 0, 0, 16 }; BITE_INFO BrownBeastBite2 = { 0, 0, 0, 22 }; diff --git a/TR5Main/Objects/TR5/Entity/tr5_brownbeast.h b/TR5Main/Objects/TR5/Entity/tr5_brownbeast.h new file mode 100644 index 000000000..968864179 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_brownbeast.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseBrownBeast(short itemNum); +void ControlBrowsBeast(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_chef.cpp b/TR5Main/Objects/TR5/Entity/tr5_chef.cpp similarity index 91% rename from TR5Main/Objects/TR5/tr5_chef.cpp rename to TR5Main/Objects/TR5/Entity/tr5_chef.cpp index e385ee663..76a230021 100644 --- a/TR5Main/Objects/TR5/tr5_chef.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_chef.cpp @@ -1,16 +1,17 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/debris.h" -#include "../../Game/effect2.h" -#include "../../Game/effects.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/people.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_chef.h" +#include "items.h" +#include "box.h" +#include "sphere.h" +#include "debris.h" +#include "effect2.h" +#include "effect.h" +#include "tomb4fx.h" +#include "people.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" #define STATE_CHEF_COOKING 1 #define STATE_CHEF_TURN_180 2 diff --git a/TR5Main/Objects/TR5/Entity/tr5_chef.h b/TR5Main/Objects/TR5/Entity/tr5_chef.h new file mode 100644 index 000000000..a2c54d468 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_chef.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseChef(short itemNumber); +void ControlChef(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_cybord.cpp b/TR5Main/Objects/TR5/Entity/tr5_cyborg.cpp similarity index 97% rename from TR5Main/Objects/TR5/tr5_cybord.cpp rename to TR5Main/Objects/TR5/Entity/tr5_cyborg.cpp index 8e7e7920e..288a135d9 100644 --- a/TR5Main/Objects/TR5/tr5_cybord.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_cyborg.cpp @@ -1,16 +1,17 @@ -#include "../oldobjects.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/Box.h" -#include "../../Game/effect2.h" -#include "../../Game/people.h" -#include "../../Game/draw.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/lara.h" -#include "../../Game/traps.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_cyborg.h" +#include "items.h" +#include "sphere.h" +#include "box.h" +#include "effect2.h" +#include "people.h" +#include "draw.h" +#include "tomb4fx.h" +#include "lara.h" +#include "traps.h" +#include "setup.h" +#include "level.h" +#include "sound.h" #define STATE_HITMAN_STOP 1 #define STATE_HITMAN_WALK 2 @@ -39,7 +40,7 @@ void InitialiseHitman(short itemNum) item->currentAnimState = STATE_HITMAN_STOP; } -void TriggerHitmanSparks(int x, int y, int z, short xv, short yv, short zv) +static void TriggerHitmanSparks(int x, int y, int z, short xv, short yv, short zv) { int dx = LaraItem->pos.xPos - x; int dz = LaraItem->pos.zPos - z; diff --git a/TR5Main/Objects/TR5/Entity/tr5_cyborg.h b/TR5Main/Objects/TR5/Entity/tr5_cyborg.h new file mode 100644 index 000000000..dd0fb06d5 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_cyborg.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseHitman(short itemNum); +void HitmanControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_doberman.cpp b/TR5Main/Objects/TR5/Entity/tr5_doberman.cpp similarity index 95% rename from TR5Main/Objects/TR5/tr5_doberman.cpp rename to TR5Main/Objects/TR5/Entity/tr5_doberman.cpp index d689a879a..fc712ea9a 100644 --- a/TR5Main/Objects/TR5/tr5_doberman.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_doberman.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr5_doberman.h" +#include "box.h" +#include "effect.h" +#include "setup.h" +#include "level.h" +#include "lara.h" BITE_INFO DobermanBite = { 0, 0x1E, 0x8D, 0x14 }; @@ -26,7 +27,7 @@ void InitialiseDoberman(short itemNum) item->frameNumber = Anims[item->animNumber].frameBase; } -void ControlDoberman(short itemNumber) +void DobermanControl(short itemNumber) { if (CreatureActive(itemNumber)) { diff --git a/TR5Main/Objects/TR5/Entity/tr5_doberman.h b/TR5Main/Objects/TR5/Entity/tr5_doberman.h new file mode 100644 index 000000000..6ef8f852c --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_doberman.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseDoberman(short itemNum); +void DobermanControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_dog.cpp b/TR5Main/Objects/TR5/Entity/tr5_dog.cpp similarity index 94% rename from TR5Main/Objects/TR5/tr5_dog.cpp rename to TR5Main/Objects/TR5/Entity/tr5_dog.cpp index a2db9583a..5352d0bd6 100644 --- a/TR5Main/Objects/TR5/tr5_dog.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_dog.cpp @@ -1,14 +1,15 @@ -#include "../newobjects.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr5_dog.h" +#include "box.h" +#include "effect.h" +#include "setup.h" +#include "level.h" +#include "lara.h" -byte DogAnims[] = { 20, 21, 22, 20 }; -BITE_INFO DogBite = { 0, 0, 100, 3 }; +static BYTE DogAnims[] = { 20, 21, 22, 20 }; +static BITE_INFO DogBite = { 0, 0, 100, 3 }; -void InitialiseDog(short itemNum) +void InitialiseTr5Dog(short itemNum) { ITEM_INFO* item; @@ -23,7 +24,7 @@ void InitialiseDog(short itemNum) item->frameNumber = Anims[item->animNumber].frameBase; } -void ControlDog(short itemNumber) +void Tr5DogControl(short itemNumber) { if (!CreatureActive(itemNumber)) return; diff --git a/TR5Main/Objects/TR5/Entity/tr5_dog.h b/TR5Main/Objects/TR5/Entity/tr5_dog.h new file mode 100644 index 000000000..ba8415e4d --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_dog.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseTr5Dog(short itemNum); +void Tr5DogControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_ghost.cpp b/TR5Main/Objects/TR5/Entity/tr5_ghost.cpp similarity index 87% rename from TR5Main/Objects/TR5/tr5_ghost.cpp rename to TR5Main/Objects/TR5/Entity/tr5_ghost.cpp index 6d05768e7..029dafd60 100644 --- a/TR5Main/Objects/TR5/tr5_ghost.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_ghost.cpp @@ -1,12 +1,13 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/effect2.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_ghost.h" +#include "items.h" +#include "box.h" +#include "effect.h" +#include "effect2.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO InvisibleGhostBite = { 0, 0, 0, 17 }; @@ -23,7 +24,7 @@ void InitialiseInvisibleGhost(short itemNum) item->pos.yPos += CLICK(2); } -void ControlInvisibleGhost(short itemNumber) +void InvisibleGhostControl(short itemNumber) { if (CreatureActive(itemNumber)) { diff --git a/TR5Main/Objects/TR5/Entity/tr5_ghost.h b/TR5Main/Objects/TR5/Entity/tr5_ghost.h new file mode 100644 index 000000000..c8a51ee1d --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_ghost.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseInvisibleGhost(short itemNum); +void InvisibleGhostControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_gladiator.cpp b/TR5Main/Objects/TR5/Entity/tr5_gladiator.cpp similarity index 95% rename from TR5Main/Objects/TR5/tr5_gladiator.cpp rename to TR5Main/Objects/TR5/Entity/tr5_gladiator.cpp index 6e9810435..a5e63a096 100644 --- a/TR5Main/Objects/TR5/tr5_gladiator.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_gladiator.cpp @@ -1,15 +1,16 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/debris.h" -#include "../../Game/effect2.h" -#include "../../Game/effects.h" -#include "../../Game/tomb4fx.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_gladiator.h" +#include "items.h" +#include "box.h" +#include "sphere.h" +#include "debris.h" +#include "effect2.h" +#include "effect.h" +#include "tomb4fx.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO GladiatorBite = { 0, 0, 0, 16 }; diff --git a/TR5Main/Objects/TR5/Entity/tr5_gladiator.h b/TR5Main/Objects/TR5/Entity/tr5_gladiator.h new file mode 100644 index 000000000..5574d4eaa --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_gladiator.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseGladiator(short itemNum); +void ControlGladiator(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_guard.cpp b/TR5Main/Objects/TR5/Entity/tr5_guard.cpp similarity index 99% rename from TR5Main/Objects/TR5/tr5_guard.cpp rename to TR5Main/Objects/TR5/Entity/tr5_guard.cpp index 9690fb515..d15df8764 100644 --- a/TR5Main/Objects/TR5/tr5_guard.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_guard.cpp @@ -1,15 +1,16 @@ -#include "../oldobjects.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/Box.h" -#include "../../Game/effect2.h" -#include "../../Game/people.h" -#include "../../Game/tomb4fx.h" -#include "../../Specific/setup.h" -#include "../../Game/draw.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_guard.h" +#include "items.h" +#include "sphere.h" +#include "box.h" +#include "effect2.h" +#include "people.h" +#include "tomb4fx.h" +#include "setup.h" +#include "draw.h" +#include "level.h" +#include "lara.h" +#include "sound.h" BITE_INFO SwatGun = { 80, 200, 13, 0 }; BITE_INFO SniperGun = { 0, 480, 110, 13 }; @@ -154,6 +155,7 @@ void InitialiseGuard(short itemNum) break; } } + void InitialiseSniper(short itemNum) { ITEM_INFO* item; @@ -167,6 +169,7 @@ void InitialiseSniper(short itemNum) item->pos.xPos += phd_sin(item->pos.yRot); item->pos.zPos += phd_cos(item->pos.yRot); } + void InitialiseGuardLaser(short itemNum) { ITEM_INFO* item; @@ -177,15 +180,23 @@ void InitialiseGuardLaser(short itemNum) item->goalAnimState = STATE_GUARD_STOP; item->currentAnimState = STATE_GUARD_STOP; } + +void ControlGuardLaser(short itemNumber) +{ + +} + void GuardControl(short itemNum) { if (!CreatureActive(itemNum)) return; + int animIndex = 0; if (Objects[ID_SWAT].loaded) animIndex= Objects[ID_SWAT].animIndex; else animIndex = Objects[ID_GUARD1].animIndex; + ITEM_INFO* item = &Items[itemNum]; CREATURE_INFO* creature = (CREATURE_INFO*)item->data; short angle = 0; @@ -886,6 +897,7 @@ void GuardControl(short itemNum) } } } + void SniperControl(short itemNumber) { if (CreatureActive(itemNumber)) @@ -980,6 +992,7 @@ void SniperControl(short itemNumber) CreatureAnimation(itemNumber, angle, 0); } } + void InitialiseMafia2(short itemNum) { ITEM_INFO* item = &Items[itemNum]; @@ -990,6 +1003,7 @@ void InitialiseMafia2(short itemNum) item->currentAnimState = STATE_GUARD_STOP; item->swapMeshFlags = 9216; } + void Mafia2Control(short itemNum) { if (!CreatureActive(itemNum)) @@ -1373,9 +1387,4 @@ void Mafia2Control(short itemNum) return; } } -} - -void ControlGuardLaser(short itemNumber) -{ - -} +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Entity/tr5_guard.h b/TR5Main/Objects/TR5/Entity/tr5_guard.h new file mode 100644 index 000000000..be571728d --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_guard.h @@ -0,0 +1,13 @@ +#pragma once + +void InitialiseGuard(short itemNum); +void GuardControl(short itemNum); + +void InitialiseSniper(short itemNum); +void SniperControl(short itemNumber); + +void InitialiseGuardLaser(short itemNum); +void ControlGuardLaser(short itemNumber); + +void InitialiseMafia2(short itemNum); +void Mafia2Control(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Entity/tr5_gunship.cpp b/TR5Main/Objects/TR5/Entity/tr5_gunship.cpp new file mode 100644 index 000000000..f3282e2c0 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_gunship.cpp @@ -0,0 +1,185 @@ +#include "framework.h" +#include "tr5_gunship.h" +#include "level.h" +#include "control.h" +#include "sound.h" +#include "draw.h" +#include "camera.h" +#include "effect2.h" +#include "debris.h" +#include "switch.h" +#include "objects.h" +#include "items.h" +#include "effect.h" +#include "lara.h" + +int GunShipCounter = 0; + +void ControlGunShip(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (TriggerActive(item)) + { + SoundEffect(SFX_HELICOPTER_LOOP, &item->pos, 0); + + GAME_VECTOR pos; + pos.x = ((GetRandomControl() & 0x1FF) - 255); + pos.y = (GetRandomControl() & 0x1FF) - 255; + pos.z = (GetRandomControl() & 0x1FF) - 255; + GetLaraJointPosition((PHD_VECTOR*)&pos, LM_TORSO); + + GAME_VECTOR end = pos; + + if (!item->itemFlags[0] && !item->itemFlags[1] && !item->itemFlags[2]) + { + item->itemFlags[0] = pos.x >> 4; + item->itemFlags[1] = pos.y >> 4; + item->itemFlags[2] = pos.z >> 4; + } + + pos.x = (pos.x + 80 * item->itemFlags[0]) / 6; + pos.y = (pos.y + 80 * item->itemFlags[1]) / 6; + pos.z = (pos.z + 80 * item->itemFlags[2]) / 6; + + item->itemFlags[0] = pos.x >> 4; + item->itemFlags[1] = pos.y >> 4; + item->itemFlags[2] = pos.z >> 4; + + if (item->triggerFlags == 1) + item->pos.zPos += (pos.z - item->pos.zPos) >> 5; + else + item->pos.xPos += (pos.x - item->pos.xPos) >> 5; + item->pos.yPos += (pos.y - item->pos.yPos - 256) >> 5; + + GAME_VECTOR start; + start.x = GetRandomControl() + item->pos.xPos - 128; + start.y = GetRandomControl() + item->pos.yPos - 128; + start.z = GetRandomControl() + item->pos.zPos - 128; + start.roomNumber = item->roomNumber; + int los = LOS(&start, &end); + + end.x = 3 * pos.x - 2 * start.x; + end.y = 3 * pos.y - 2 * start.y; + end.z = 3 * pos.z - 2 * start.z; + int los2 = LOS(&start, &end); + + if (los) + GunShipCounter = 1; + else + GunShipCounter++; + + if (GunShipCounter <= 15) + item->meshBits |= 0x100; + else + item->meshBits &= 0xFEFF; + + if (GunShipCounter < 15) + SoundEffect(SFX_HK_FIRE, &item->pos, 0xC00004); + + if (!(GlobalCounter & 1)) + return AnimateItem(item); + + GetLaraOnLOS = 1; + + PHD_VECTOR hitPos; + MESH_INFO* hitMesh = NULL; + int objOnLos = ObjectOnLOS2(&start, &end, &hitPos, &hitMesh); + + GetLaraOnLOS = 0; + + if (objOnLos == 999 || objOnLos < 0) + { + if (GunShipCounter >= 15) + return AnimateItem(item); + + TriggerDynamicLight( + start.x, start.y, start.z, 16, + (GetRandomControl() & 0x3F) + 96, + (GetRandomControl() & 0x1F) + 64, + 0); + + if (!los2) + { + TriggerRicochetSpark(&end, 2 * GetRandomControl(), 3, 0); + TriggerRicochetSpark(&end, 2 * GetRandomControl(), 3, 0); + } + + if (objOnLos < 0 && GetRandomControl() & 1) + { + if (hitMesh->staticNumber >= 50 && hitMesh->staticNumber < 59) + { + ShatterObject(0, hitMesh, 64, end.roomNumber, 0); + hitMesh->Flags &= 0xFFFE; + TestTriggersAtXYZ(hitMesh->x, hitMesh->y, hitMesh->z, end.roomNumber, 1, 0); + SoundEffect(ShatterSounds[CurrentLevel - 5][hitMesh->staticNumber], (PHD_3DPOS*)hitMesh, 0); + } + + TriggerRicochetSpark((GAME_VECTOR*)&hitPos, 2 * GetRandomControl(), 3, 0); + TriggerRicochetSpark((GAME_VECTOR*)&hitPos, 2 * GetRandomControl(), 3, 0); + } + } + else + { + ITEM_INFO* hitItem = &Items[objOnLos]; + + if (hitItem->objectNumber != ID_LARA) + { + if (hitItem->objectNumber >= ID_SMASH_OBJECT1 + && hitItem->objectNumber <= ID_SMASH_OBJECT8) + { + ExplodeItemNode(hitItem, 0, 0, 128); + SmashObject(objOnLos); + KillItem(objOnLos); + } + } + else + { + TriggerDynamicLight( + start.x, start.y, start.z, + 16, + (GetRandomControl() & 0x3F) + 96, + (GetRandomControl() & 0x1F) + 64, + 0); + + DoBloodSplat( + start.x, start.y, start.z, + (GetRandomControl() & 1) + 2, + 2 * GetRandomControl(), + LaraItem->roomNumber); + + LaraItem->hitPoints -= 20; + } + } + + if (GunShipCounter < 15) + { + SPARKS* spark = &Sparks[GetFreeSpark()]; + spark->on = 1; + spark->sR = spark->dR = (GetRandomControl() & 0x7F) + -128; + spark->sG = (spark->dR >> 1) + (GetRandomControl() & 0x7F); + if (spark->sG > spark->sR) + spark->sG = spark->sR; + spark->sB = 0; + spark->dB = 0; + spark->dR = 0; + spark->dG = 0; + spark->colFadeSpeed = 12; + spark->transType = COLADD; + spark->fadeToBlack = 0; + spark->life = 12; + spark->sLife = 12; + spark->x = start.x; + spark->y = start.y; + spark->z = start.z; + spark->xVel = 4 * (end.x - start.x); + spark->yVel = 4 * (end.y - start.y); + spark->zVel = 4 * (end.z - start.z); + spark->friction = 0; + spark->maxYvel = 0; + spark->flags = SP_NONE; + } + + AnimateItem(item); + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Entity/tr5_gunship.h b/TR5Main/Objects/TR5/Entity/tr5_gunship.h new file mode 100644 index 000000000..081cbd02e --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_gunship.h @@ -0,0 +1,3 @@ +#pragma once + +void ControlGunShip(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_hydra.cpp b/TR5Main/Objects/TR5/Entity/tr5_hydra.cpp similarity index 94% rename from TR5Main/Objects/TR5/tr5_hydra.cpp rename to TR5Main/Objects/TR5/Entity/tr5_hydra.cpp index 7dbb8ca57..2ffdb7c51 100644 --- a/TR5Main/Objects/TR5/tr5_hydra.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_hydra.cpp @@ -1,15 +1,16 @@ -#include "../oldobjects.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "../../Game/effect2.h" -#include "../../Game/people.h" -#include "../../Game/draw.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_hydra.h" +#include "items.h" +#include "sphere.h" +#include "box.h" +#include "effect.h" +#include "setup.h" +#include "effect2.h" +#include "people.h" +#include "draw.h" +#include "level.h" +#include "lara.h" +#include "sound.h" #define STATE_HYDRA_STOP 0 #define STATE_HYDRA_BITE_ATTACK1 1 @@ -43,7 +44,7 @@ void InitialiseHydra(short itemNum) item->pos.xPos -= 256; } -void HydraBubblesAttack(PHD_3DPOS* pos, short roomNumber, int count) +static void HydraBubblesAttack(PHD_3DPOS* pos, short roomNumber, int count) { short fxNum = CreateNewEffect(roomNumber); if (fxNum != NO_ITEM) @@ -64,7 +65,46 @@ void HydraBubblesAttack(PHD_3DPOS* pos, short roomNumber, int count) } } -void TriggerHydraSparks(short itemNumber, int frame) +void TriggerHydraMissileSparks(PHD_VECTOR* pos, short xv, short yv, short zv) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = true; + spark->sB = 0; + spark->sR = (GetRandomControl() & 0x3F) - 96; + spark->sG = spark->sR >> 1; + spark->dB = 0; + spark->dR = (GetRandomControl() & 0x3F) - 96; + spark->dG = spark->dR >> 1; + spark->fadeToBlack = 8; + spark->colFadeSpeed = (GetRandomControl() & 3) + 8; + spark->transType = COLADD; + spark->dynamic = -1; + spark->life = spark->sLife = (GetRandomControl() & 3) + 20; + spark->x = (GetRandomControl() & 0xF) - 8; + spark->y = 0; + spark->z = (GetRandomControl() & 0xF) - 8; + spark->x += pos->x; + spark->y += pos->y; + spark->z += pos->z; + spark->xVel = xv; + spark->yVel = yv; + spark->zVel = zv; + spark->friction = 68; + spark->flags = SP_EXPDEF | SP_ROTATE | SP_DEF | SP_SCALE; + spark->rotAng = GetRandomControl() & 0xFFF; + if (GetRandomControl() & 1) + spark->rotAdd = -32 - (GetRandomControl() & 0x1F); + else + spark->rotAdd = (GetRandomControl() & 0x1F) + 32; + spark->gravity = 0; + spark->maxYvel = 0; + spark->scalar = 1; + spark->sSize = spark->size = (GetRandomControl() & 0xF) + 96; + spark->dSize = spark->size >> 2; +} + +static void TriggerHydraSparks(short itemNumber, int frame) { SPARKS* spark = &Sparks[GetFreeSpark()]; @@ -104,7 +144,7 @@ void TriggerHydraSparks(short itemNumber, int frame) spark->sSize = spark->size = frame * ((GetRandomControl() & 0xF) + 16) >> 4; } -void ControlHydra(short itemNumber) +void HydraControl(short itemNumber) { if (!CreatureActive(itemNumber)) return; @@ -381,43 +421,4 @@ void ControlHydra(short itemNumber) CreatureJoint(item, 3, joint3); CreatureAnimation(itemNumber, 0, 0); -} - -void TriggerHydraMissileSparks(PHD_VECTOR* pos, short xv, short yv, short zv) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = true; - spark->sB = 0; - spark->sR = (GetRandomControl() & 0x3F) - 96; - spark->sG = spark->sR >> 1; - spark->dB = 0; - spark->dR = (GetRandomControl() & 0x3F) - 96; - spark->dG = spark->dR >> 1; - spark->fadeToBlack = 8; - spark->colFadeSpeed = (GetRandomControl() & 3) + 8; - spark->transType = COLADD; - spark->dynamic = -1; - spark->life = spark->sLife = (GetRandomControl() & 3) + 20; - spark->x = (GetRandomControl() & 0xF) - 8; - spark->y = 0; - spark->z = (GetRandomControl() & 0xF) - 8; - spark->x += pos->x; - spark->y += pos->y; - spark->z += pos->z; - spark->xVel = xv; - spark->yVel = yv; - spark->zVel = zv; - spark->friction = 68; - spark->flags = SP_EXPDEF | SP_ROTATE | SP_DEF | SP_SCALE; - spark->rotAng = GetRandomControl() & 0xFFF; - if (GetRandomControl() & 1) - spark->rotAdd = -32 - (GetRandomControl() & 0x1F); - else - spark->rotAdd = (GetRandomControl() & 0x1F) + 32; - spark->gravity = 0; - spark->maxYvel = 0; - spark->scalar = 1; - spark->sSize = spark->size = (GetRandomControl() & 0xF) + 96; - spark->dSize = spark->size >> 2; } \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Entity/tr5_hydra.h b/TR5Main/Objects/TR5/Entity/tr5_hydra.h new file mode 100644 index 000000000..a98349cc4 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_hydra.h @@ -0,0 +1,6 @@ +#pragma once +#include "phd_global.h" + +void InitialiseHydra(short itemNum); +void HydraControl(short itemNumber); +void TriggerHydraMissileSparks(PHD_VECTOR* pos, short xv, short yv, short zv); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_imp.cpp b/TR5Main/Objects/TR5/Entity/tr5_imp.cpp similarity index 94% rename from TR5Main/Objects/TR5/tr5_imp.cpp rename to TR5Main/Objects/TR5/Entity/tr5_imp.cpp index f27e3a7c3..cfcc287d1 100644 --- a/TR5Main/Objects/TR5/tr5_imp.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_imp.cpp @@ -1,13 +1,14 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/sphere.h" -#include "../../Game/lara.h" -#include "../../Game/draw.h" -#include "../../Game/effects.h" -#include "../../Game/effect2.h" -#include "../../Game/Box.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr5_imp.h" +#include "items.h" +#include "sphere.h" +#include "lara.h" +#include "draw.h" +#include "effect.h" +#include "effect2.h" +#include "box.h" +#include "setup.h" +#include "level.h" #define STATE_IMP_WALK 0 #define STATE_IMP_STOP 1 @@ -52,7 +53,7 @@ void InitialiseImp(short itemNum) item->frameNumber = Anims[item->animNumber].frameBase; } -void ImpThrowStones(ITEM_INFO* item) +static void ImpThrowStones(ITEM_INFO* item) { PHD_VECTOR pos1; pos1.x = 0; @@ -105,7 +106,7 @@ void ImpThrowStones(ITEM_INFO* item) } } -void ControlImp(short itemNumber) +void ImpControl(short itemNumber) { if (CreatureActive(itemNumber)) { diff --git a/TR5Main/Objects/TR5/Entity/tr5_imp.h b/TR5Main/Objects/TR5/Entity/tr5_imp.h new file mode 100644 index 000000000..c8ce51f85 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_imp.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseImp(short itemNum); +void ImpControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_lagoon_witch.cpp b/TR5Main/Objects/TR5/Entity/tr5_lagoon_witch.cpp similarity index 90% rename from TR5Main/Objects/TR5/tr5_lagoon_witch.cpp rename to TR5Main/Objects/TR5/Entity/tr5_lagoon_witch.cpp index 5128c53ba..78238b8c8 100644 --- a/TR5Main/Objects/TR5/tr5_lagoon_witch.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_lagoon_witch.cpp @@ -1,13 +1,14 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/effects.h" -#include "../../Game/effect2.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/inventory.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr5_lagoon_witch.h" +#include "items.h" +#include "box.h" +#include "effect.h" +#include "effect2.h" +#include "tomb4fx.h" +#include "inventory.h" +#include "setup.h" +#include "level.h" +#include "lara.h" #define STATE_LAGOON_WITCH_SWIM 1 #define STATE_LAGOON_WITCH_STOP 2 @@ -33,7 +34,7 @@ void InitialiseLagoonWitch(short itemNumber) item->pos.yPos += 512; } -void ControlLagoonWitch(short itemNumber) +void LagoonWitchControl(short itemNumber) { if (!CreatureActive(itemNumber)) return; @@ -143,12 +144,9 @@ void ControlLagoonWitch(short itemNumber) } CreatureTilt(item, 0); - CreatureJoint(item, 0, joint0); CreatureJoint(item, 1, joint1); CreatureJoint(item, 2, joint2); - CreatureAnimation(itemNumber, angle, 0); - CreatureUnderwater(item, 341); } \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Entity/tr5_lagoon_witch.h b/TR5Main/Objects/TR5/Entity/tr5_lagoon_witch.h new file mode 100644 index 000000000..d700ee533 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_lagoon_witch.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseLagoonWitch(short itemNumber); +void LagoonWitchControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_larson.cpp b/TR5Main/Objects/TR5/Entity/tr5_larson.cpp similarity index 95% rename from TR5Main/Objects/TR5/tr5_larson.cpp rename to TR5Main/Objects/TR5/Entity/tr5_larson.cpp index 646f962c8..ad3222332 100644 --- a/TR5Main/Objects/TR5/tr5_larson.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_larson.cpp @@ -1,13 +1,14 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/people.h" -#include "../../Game/lot.h" -#include "../../Game/lara.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr5_larson.h" +#include "items.h" +#include "box.h" +#include "sphere.h" +#include "effect2.h" +#include "people.h" +#include "lot.h" +#include "lara.h" +#include "setup.h" +#include "level.h" #define STATE_TR5_LARSON_STOP 1 #define STATE_TR5_LARSON_WALK 2 @@ -61,7 +62,7 @@ void InitialiseLarson(short itemNum) } } -void ControlLarson(short itemNumber) +void LarsonControl(short itemNumber) { if (!CreatureActive(itemNumber)) return; @@ -105,7 +106,7 @@ void ControlLarson(short itemNumber) item->gravityStatus = false; item->hitStatus = false; item->collidable = false; - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; } else { @@ -137,7 +138,7 @@ void ControlLarson(short itemNumber) item->gravityStatus = false; item->hitStatus = false; item->collidable = false; - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; creature->flags = 0; }*/ @@ -407,7 +408,7 @@ void ControlLarson(short itemNumber) item->gravityStatus = false; item->hitStatus = false; item->collidable = false; - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; item->triggerFlags = 0; } else diff --git a/TR5Main/Objects/TR5/Entity/tr5_larson.h b/TR5Main/Objects/TR5/Entity/tr5_larson.h new file mode 100644 index 000000000..fa359c0f9 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_larson.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseLarson(short itemNum); +void LarsonControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_laser_head.cpp b/TR5Main/Objects/TR5/Entity/tr5_laser_head.cpp similarity index 92% rename from TR5Main/Objects/TR5/tr5_laser_head.cpp rename to TR5Main/Objects/TR5/Entity/tr5_laser_head.cpp index 504cf19d4..c79e43e38 100644 --- a/TR5Main/Objects/TR5/tr5_laser_head.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_laser_head.cpp @@ -1,21 +1,22 @@ -#include "../oldobjects.h" -#include "../../Game/sphere.h" -#include "../../Game/items.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/effect2.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/debris.h" -#include "../../Game/draw.h" -#include "../../Game/control.h" -#include "../../Game/effects.h" -#include "../../Game/switch.h" -#include "../../Game/laramisc.h" -#include "../../Game/traps.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_laser_head.h" +#include "sphere.h" +#include "items.h" +#include "tomb4fx.h" +#include "effect2.h" +#include "box.h" +#include "people.h" +#include "debris.h" +#include "draw.h" +#include "control.h" +#include "effect.h" +#include "switch.h" +#include "laramisc.h" +#include "traps.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" struct LASER_HEAD_INFO { @@ -42,7 +43,115 @@ PHD_VECTOR LaserHeadBasePosition = { 0, -640, 0 }; PHD_VECTOR GuardianChargePositions[8]; int GuardianMeshes[5] = { 1,0,0,0,2 }; -void InitialiseGuardian(short itemNumber) +static void TriggerLaserHeadSparks(PHD_VECTOR* pos, int count, byte r, byte g, byte b, int unk) +{ + if (count > 0) + { + for (int i = 0; i < count; i++) + { + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = r; + spark->sG = g; + spark->sB = b; + spark->dB = 0; + spark->dG = 0; + spark->dR = 0; + spark->colFadeSpeed = 9 << unk; + spark->fadeToBlack = 0; + spark->life = 9 << unk; + spark->sLife = 9 << unk; + spark->transType = COLADD; + spark->x = pos->x; + spark->y = pos->y; + spark->z = pos->z; + spark->gravity = (GetRandomControl() >> 7) & 0x1F; + spark->yVel = ((GetRandomControl() & 0xFFF) - 2048) << unk; + spark->xVel = ((GetRandomControl() & 0xFFF) - 2048) << unk; + spark->zVel = ((GetRandomControl() & 0xFFF) - 2048) << unk; + spark->flags = SP_NONE; + spark->maxYvel = 0; + spark->friction = 34 << unk; + } + } +} + +static void LaserHeadCharge(ITEM_INFO* item) +{ + byte size = item->itemFlags[3]; + byte g = ((GetRandomControl() & 0x1F) + 128); + byte b = ((GetRandomControl() & 0x1F) + 64); + + if (item->itemFlags[3] <= 32) + { + g = item->itemFlags[3] * g >> 5; + b = item->itemFlags[3] * b >> 5; + } + else + { + size = 32; + } + + LASER_HEAD_INFO* creature = (LASER_HEAD_INFO*)item->data; + + PHD_VECTOR src, dest; + dest.x = LaserHeadBasePosition.x; + dest.y = LaserHeadBasePosition.y; + dest.z = LaserHeadBasePosition.z; + GetJointAbsPosition(&Items[creature->baseItem], &dest, 0); + + for (int i = 0; i < 4; i++) + { + ENERGY_ARC* arc = LaserHeadData.chargeArcs[i]; + + if (item->itemFlags[3] & 0x0F && arc != NULL) + { + arc->r = 0; + arc->g = g; + arc->b = b; + //arc->segmentSize = 50; + } + else + { + src.x = GuardianChargePositions[i].x; + src.y = GuardianChargePositions[i].y; + src.z = GuardianChargePositions[i].z; + GetJointAbsPosition(&Items[creature->baseItem], &src, 0); + //LaserHeadData.chargeArcs[i] = TriggerEnergyArc(&src, &dest, 255, 255, 255, 256, 90, 64, ENERGY_ARC_STRAIGHT_LINE); // (GetRandomControl() & 7) + 8, v4 | ((v1 | 0x240000) << 8), 13, 48, 3); + } + } + + if (GlobalCounter & 1) + { + for (int i = 0; i < 5; i += 4) + { + if (2 * GuardianMeshes[i] & item->meshBits) + { + src.x = 0; + src.y = 0; + src.z = 0; + GetJointAbsPosition(item, &src, GuardianMeshes[i]); + + TriggerLightningGlow(src.x, src.y, src.z, size + (GetRandomControl() & 3), 0, g, b); + TriggerLaserHeadSparks(&src, 3, 0, g, b, 0); + } + } + + TriggerLightningGlow(dest.x, dest.y, dest.z, (GetRandomControl() & 3) + size + 8, 0, g, b); + TriggerDynamicLight(dest.x, dest.y, dest.z, (GetRandomControl() & 3) + 16, 0, g, b); + } + + if (!(GlobalCounter & 3)) + { + TriggerEnergyArc(&dest, (PHD_VECTOR*)&item->pos, 0, g, b, 256, 3, 64, ENERGY_ARC_NO_RANDOMIZE, ENERGY_ARC_STRAIGHT_LINE); + //TriggerEnergyArc(&dest, &item->pos, (GetRandomControl() & 7) + 8, v4 | ((v1 | 0x180000) << 8), 13, 64, 3); + } + + TriggerLaserHeadSparks(&dest, 3, 0, g, b, 1); +} + +void InitialiseLaserHead(short itemNumber) { ITEM_INFO* item = &Items[itemNumber]; @@ -51,7 +160,7 @@ void InitialiseGuardian(short itemNumber) for (int i = 0; i < LevelItems; i++) { - if (Items[i].objectNumber == ID_GUARDIAN_BASE) + if (Items[i].objectNumber == ID_LASERHEAD_BASE) { info->baseItem = i; break; @@ -62,7 +171,7 @@ void InitialiseGuardian(short itemNumber) int j = 0; for (int i = 0; i < LevelItems; i++) { - if (Items[i].objectNumber == ID_GUARDIAN_TENTACLE && j < 8) + if (Items[i].objectNumber == ID_LASERHEAD_TENTACLE && j < 8) { info->tentacles[j] = i; rotation += ANGLE(45); @@ -88,7 +197,7 @@ void InitialiseGuardian(short itemNumber) ZeroMemory(&LaserHeadData, sizeof(LASER_HEAD_STRUCT)); } -void GuardianControl(short itemNumber) +void LaserHeadControl(short itemNumber) { ITEM_INFO* item = &Items[itemNumber]; LASER_HEAD_INFO* creature = (LASER_HEAD_INFO*)item->data; @@ -190,7 +299,7 @@ void GuardianControl(short itemNumber) dest.x = 0; dest.y = 0; dest.z = 0; - GetJointAbsPosition(LaraItem, (PHD_VECTOR*)&dest, LJ_LHAND); + GetJointAbsPosition(LaraItem, (PHD_VECTOR*)&dest, LM_LHAND); // Calculate distance between guardian and Lara int distance = sqrt(SQUARE(src.x - dest.x) + SQUARE(src.y - dest.y) + SQUARE(src.z - dest.z)); @@ -207,7 +316,7 @@ void GuardianControl(short itemNumber) dest.x = 0; dest.y = 0; dest.z = 0; - GetJointAbsPosition(LaraItem, (PHD_VECTOR*)&dest, LJ_HIPS); + GetJointAbsPosition(LaraItem, (PHD_VECTOR*)&dest, LM_HIPS); LaserHeadData.target.x = dest.x; LaserHeadData.target.y = dest.y; @@ -314,7 +423,7 @@ void GuardianControl(short itemNumber) if (item->itemFlags[3] <= 90) { SoundEffect(SFX_GOD_HEAD_CHARGE, &item->pos, 0); - GuardianCharge(item); + LaserHeadCharge(item); item->itemFlags[3]++; condition = item->itemFlags[3] >= 90; } @@ -392,7 +501,7 @@ void GuardianControl(short itemNumber) if (GlobalCounter & 1) { - TriggerGuardianSparks((PHD_VECTOR*)& src, 3, 0, g, b, 0); + TriggerLaserHeadSparks((PHD_VECTOR*)& src, 3, 0, g, b, 0); TriggerLightningGlow(src.x, src.y, src.z, (GetRandomControl() & 3) + 32, 0, g, b); TriggerDynamicLight(src.x, src.y, src.z, (GetRandomControl() & 3) + 16, 0, g, b); @@ -400,7 +509,7 @@ void GuardianControl(short itemNumber) { TriggerLightningGlow(currentArc->pos4.x, currentArc->pos4.y, currentArc->pos4.z, (GetRandomControl() & 3) + 16, 0, g, b); TriggerDynamicLight(currentArc->pos4.x, currentArc->pos4.y, currentArc->pos4.z, (GetRandomControl() & 3) + 6, 0, g, b); - TriggerGuardianSparks((PHD_VECTOR*)& currentArc->pos4, 3, 0, g, b, 0); + TriggerLaserHeadSparks((PHD_VECTOR*)& currentArc->pos4, 3, 0, g, b, 0); } } @@ -511,7 +620,7 @@ void GuardianControl(short itemNumber) dest.x = 0; dest.y = 0; dest.z = 0; - GetJointAbsPosition(LaraItem, (PHD_VECTOR*)& dest, LJ_LHAND); + GetJointAbsPosition(LaraItem, (PHD_VECTOR*)& dest, LM_LHAND); if (LOS(&src, &src)) { @@ -571,112 +680,4 @@ void GuardianControl(short itemNumber) item->triggerFlags = item->pos.xRot + (GetRandomControl() & 0x1000) - 2048; } } -} - -void TriggerGuardianSparks(PHD_VECTOR* pos, int count, byte r, byte g, byte b, int unk) -{ - if (count > 0) - { - for (int i = 0; i < count; i++) - { - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = r; - spark->sG = g; - spark->sB = b; - spark->dB = 0; - spark->dG = 0; - spark->dR = 0; - spark->colFadeSpeed = 9 << unk; - spark->fadeToBlack = 0; - spark->life = 9 << unk; - spark->sLife = 9 << unk; - spark->transType = COLADD; - spark->x = pos->x; - spark->y = pos->y; - spark->z = pos->z; - spark->gravity = (GetRandomControl() >> 7) & 0x1F; - spark->yVel = ((GetRandomControl() & 0xFFF) - 2048) << unk; - spark->xVel = ((GetRandomControl() & 0xFFF) - 2048) << unk; - spark->zVel = ((GetRandomControl() & 0xFFF) - 2048) << unk; - spark->flags = 0; - spark->maxYvel = 0; - spark->friction = 34 << unk; - } - } -} - -void GuardianCharge(ITEM_INFO* item) -{ - byte size = item->itemFlags[3]; - byte g = ((GetRandomControl() & 0x1F) + 128); - byte b = ((GetRandomControl() & 0x1F) + 64); - - if (item->itemFlags[3] <= 32) - { - g = item->itemFlags[3] * g >> 5; - b = item->itemFlags[3] * b >> 5; - } - else - { - size = 32; - } - - LASER_HEAD_INFO* creature = (LASER_HEAD_INFO*)item->data; - - PHD_VECTOR src, dest; - dest.x = LaserHeadBasePosition.x; - dest.y = LaserHeadBasePosition.y; - dest.z = LaserHeadBasePosition.z; - GetJointAbsPosition(&Items[creature->baseItem], &dest, 0); - - for (int i = 0; i < 4; i++) - { - ENERGY_ARC* arc = LaserHeadData.chargeArcs[i]; - - if (item->itemFlags[3] & 0x0F && arc != NULL) - { - arc->r = 0; - arc->g = g; - arc->b = b; - //arc->segmentSize = 50; - } - else - { - src.x = GuardianChargePositions[i].x; - src.y = GuardianChargePositions[i].y; - src.z = GuardianChargePositions[i].z; - GetJointAbsPosition(&Items[creature->baseItem], &src, 0); - //LaserHeadData.chargeArcs[i] = TriggerEnergyArc(&src, &dest, 255, 255, 255, 256, 90, 64, ENERGY_ARC_STRAIGHT_LINE); // (GetRandomControl() & 7) + 8, v4 | ((v1 | 0x240000) << 8), 13, 48, 3); - } - } - - if (GlobalCounter & 1) - { - for (int i = 0; i < 5; i += 4) - { - if (2 * GuardianMeshes[i] & item->meshBits) - { - src.x = 0; - src.y = 0; - src.z = 0; - GetJointAbsPosition(item, &src, GuardianMeshes[i]); - - TriggerLightningGlow(src.x, src.y, src.z, size + (GetRandomControl() & 3), 0, g, b); - TriggerGuardianSparks(&src, 3, 0, g, b, 0); - } - } - - TriggerLightningGlow(dest.x, dest.y, dest.z, (GetRandomControl() & 3) + size + 8, 0, g, b); - TriggerDynamicLight(dest.x, dest.y, dest.z, (GetRandomControl() & 3) + 16, 0, g, b); - } - - if (!(GlobalCounter & 3)) - { - TriggerEnergyArc(&dest, (PHD_VECTOR*)&item->pos, 0, g, b, 256, 3, 64, ENERGY_ARC_NO_RANDOMIZE, ENERGY_ARC_STRAIGHT_LINE); - //TriggerEnergyArc(&dest, &item->pos, (GetRandomControl() & 7) + 8, v4 | ((v1 | 0x180000) << 8), 13, 64, 3); - } - - TriggerGuardianSparks(&dest, 3, 0, g, b, 1); } \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Entity/tr5_laser_head.h b/TR5Main/Objects/TR5/Entity/tr5_laser_head.h new file mode 100644 index 000000000..e45acd948 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_laser_head.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseLaserHead(short itemNumber); +void LaserHeadControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_lion.cpp b/TR5Main/Objects/TR5/Entity/tr5_lion.cpp similarity index 90% rename from TR5Main/Objects/TR5/tr5_lion.cpp rename to TR5Main/Objects/TR5/Entity/tr5_lion.cpp index ed6484161..39aee9407 100644 --- a/TR5Main/Objects/TR5/tr5_lion.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_lion.cpp @@ -1,14 +1,15 @@ -#include "..\oldobjects.h" -#include "..\..\Global\global.h" -#include "..\..\game\items.h" -#include "..\..\game\effect2.h" -#include "..\..\game\effects.h" -#include "..\..\game\lot.h" -#include "..\..\game\box.h" -#include "..\..\game\tomb4fx.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr5_lion.h" + +#include "items.h" +#include "effect2.h" +#include "effect.h" +#include "lot.h" +#include "box.h" +#include "tomb4fx.h" +#include "setup.h" +#include "level.h" +#include "lara.h" BITE_INFO LionBite1 = { 0xFFFFFFFE, 0xFFFFFFF6, 0xFA, 0x15 }; BITE_INFO LionBite2 = { 0xFFFFFFFE, 0xFFFFFFF6, 0x84, 0x15 }; diff --git a/TR5Main/Objects/TR5/Entity/tr5_lion.h b/TR5Main/Objects/TR5/Entity/tr5_lion.h new file mode 100644 index 000000000..4c03015f2 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_lion.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseLion(short itemNum); +void LionControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_reaper.cpp b/TR5Main/Objects/TR5/Entity/tr5_reaper.cpp similarity index 84% rename from TR5Main/Objects/TR5/tr5_reaper.cpp rename to TR5Main/Objects/TR5/Entity/tr5_reaper.cpp index ba1ff0abe..08ad7a965 100644 --- a/TR5Main/Objects/TR5/tr5_reaper.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_reaper.cpp @@ -1,9 +1,10 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" +#include "framework.h" +#include "tr5_reaper.h" +#include "items.h" +#include "box.h" +#include "setup.h" +#include "level.h" +#include "lara.h" void InitialiseReaper(short itemNum) { @@ -18,7 +19,7 @@ void InitialiseReaper(short itemNum) item->currentAnimState = 2; } -void ControlReaper(short itemNumber) +void ReaperControl(short itemNumber) { if (CreatureActive(itemNumber)) { diff --git a/TR5Main/Objects/TR5/Entity/tr5_reaper.h b/TR5Main/Objects/TR5/Entity/tr5_reaper.h new file mode 100644 index 000000000..51ada8309 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_reaper.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseReaper(short itemNum); +void ReaperControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_romanstatue.cpp b/TR5Main/Objects/TR5/Entity/tr5_roman_statue.cpp similarity index 95% rename from TR5Main/Objects/TR5/tr5_romanstatue.cpp rename to TR5Main/Objects/TR5/Entity/tr5_roman_statue.cpp index 8b7f281e1..3b50333c7 100644 --- a/TR5Main/Objects/TR5/tr5_romanstatue.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_roman_statue.cpp @@ -1,18 +1,19 @@ -#include "../oldobjects.h" -#include "../../Game/sphere.h" -#include "../../Game/items.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/effect2.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/debris.h" -#include "../../Game/draw.h" -#include "../../Game/control.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_roman_statue.h" +#include "sphere.h" +#include "items.h" +#include "tomb4fx.h" +#include "effect2.h" +#include "box.h" +#include "people.h" +#include "debris.h" +#include "draw.h" +#include "control.h" +#include "effect.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" #define STATE_ROMAN_STATUE_STOP 1 #define STATE_ROMAN_STATUE_SCREAMING 2 @@ -40,6 +41,227 @@ struct ROMAN_STATUE_STRUCT BITE_INFO RomanStatueBite { 0, 0, 0, 15 }; ROMAN_STATUE_STRUCT RomanStatueData; +static void RomanStatueHitEffect(ITEM_INFO* item, PHD_VECTOR* pos, int joint) +{ + GetJointAbsPosition(item, pos, joint); + + if (!(GetRandomControl() & 0x1F)) + { + short fxNumber = CreateNewEffect(item->roomNumber); + if (fxNumber != -1) + { + FX_INFO* fx = &Effects[fxNumber]; + + fx->pos.xPos = pos->x; + fx->pos.yPos = pos->y; + fx->pos.zPos = pos->z; + fx->roomNumber = item->roomNumber; + fx->pos.zRot = 0; + fx->pos.xRot = 0; + fx->pos.yRot = 2 * GetRandomControl(); + fx->speed = 1; + fx->fallspeed = 0; + fx->objectNumber = ID_BODY_PART; + fx->shade = 16912; + fx->flag2 = 9729; + fx->frameNumber = Objects[ID_BUBBLES].meshIndex + (GetRandomControl() & 7); + fx->counter = 0; + fx->flag1 = 0; + } + } + + if (!(GetRandomControl() & 0xF)) + { + SMOKE_SPARKS* spark = &SmokeSparks[GetFreeSmokeSpark()]; + + spark->on = 1; + spark->sShade = 0; + spark->colFadeSpeed = 4; + spark->fadeToBlack = 32; + spark->dShade = (GetRandomControl() & 0xF) + 64; + spark->transType = COLADD; + spark->life = spark->sLife = (GetRandomControl() & 3) + 64; + spark->x = (GetRandomControl() & 0x1F) + pos->x - 16; + spark->y = (GetRandomControl() & 0x1F) + pos->y - 16; + spark->z = (GetRandomControl() & 0x1F) + pos->z - 16; + spark->xVel = (GetRandomControl() & 0x7F) - 64; + spark->yVel = 0; + spark->zVel = (GetRandomControl() & 0x7F) - 64; + spark->friction = 4; + spark->flags = SP_ROTATE; + spark->rotAng = GetRandomControl() & 0xFFF; + spark->rotAdd = (GetRandomControl() & 0x1F) - 16; + spark->maxYvel = 0; + spark->gravity = (GetRandomControl() & 7) + 8; + spark->mirror = 0; + spark->sSize = spark->size = (GetRandomControl() & 7) + 8; + spark->dSize = spark->size * 2; + } +} + +static void TriggerRomanStatueShockwaveAttackSparks(int x, int y, int z, byte r, byte g, byte b, byte size) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->dG = g; + spark->sG = g; + spark->colFadeSpeed = 2; + spark->dR = r; + spark->sR = r; + spark->transType = COLADD; + spark->life = 16; + spark->sLife = 16; + spark->x = x; + spark->on = 1; + spark->dB = b; + spark->sB = b; + spark->fadeToBlack = 4; + spark->y = y; + spark->z = z; + spark->zVel = 0; + spark->yVel = 0; + spark->xVel = 0; + spark->flags = SP_SCALE | SP_DEF; + spark->scalar = 3; + spark->maxYvel = 0; + spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 11; + spark->gravity = 0; + spark->dSize = spark->sSize = spark->size = size + (GetRandomControl() & 3); +} + +static void TriggerRomanStatueScreamingSparks(int x, int y, int z, short xv, short yv, short zv, int flags) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = 0; + spark->sG = 0; + spark->sB = 0; + spark->dR = 64; + if (flags) + { + spark->dG = (GetRandomControl() & 0x3F) - 64; + spark->dB = spark->dG >> 1; + } + else + { + spark->dB = (GetRandomControl() & 0x3F) - 64; + spark->dG = spark->dB >> 1; + } + spark->colFadeSpeed = 4; + spark->fadeToBlack = 4; + spark->life = 16; + spark->sLife = 16; + spark->x = x; + spark->y = y; + spark->z = z; + spark->xVel = xv; + spark->yVel = yv; + spark->zVel = zv; + spark->transType = COLADD; + spark->friction = 34; + spark->maxYvel = 0; + spark->gravity = 0; + spark->flags = SP_NONE; +} + +static void TriggerRomanStatueAttackEffect1(short itemNum, int factor) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = 0; + spark->sB = (GetRandomControl() & 0x3F) - 96; + spark->dB = (GetRandomControl() & 0x3F) - 96; + spark->dR = 0; + if (factor < 16) + { + spark->sB = factor * spark->sB >> 4; + spark->dB = factor * spark->dB >> 4; + } + spark->sG = spark->sB >> 1; + spark->dG = spark->dB >> 1; + spark->fadeToBlack = 4; + spark->colFadeSpeed = (GetRandomControl() & 3) + 8; + spark->transType = COLADD; + spark->dynamic = -1; + spark->life = spark->sLife = (GetRandomControl() & 3) + 32; + spark->y = 0; + spark->x = (GetRandomControl() & 0x1F) - 16; + spark->z = (GetRandomControl() & 0x1F) - 16; + spark->yVel = 0; + spark->xVel = (byte)GetRandomControl() - 128; + spark->friction = 4; + spark->zVel = (byte)GetRandomControl() - 128; + spark->flags = SP_NODEATTACH | SP_EXPDEF | SP_ITEM | SP_ROTATE | SP_DEF | SP_SCALE; // 4762; + spark->fxObj = itemNum; + spark->nodeNumber = 6; + spark->rotAng = GetRandomControl() & 0xFFF; + spark->rotAdd = (GetRandomControl() & 0x3F) - 32; + spark->maxYvel = 0; + spark->gravity = -8 - (GetRandomControl() & 7); + spark->scalar = 2; + spark->dSize = 4; + spark->sSize = spark->size = factor * ((GetRandomControl() & 0x1F) + 64) >> 4; +} + +static void RomanStatueAttack(PHD_3DPOS* pos, short roomNumber, short count) +{ + short fxNum = CreateNewEffect(roomNumber); + + if (fxNum != NO_ITEM) + { + FX_INFO* fx = &Effects[fxNum]; + + fx->pos.xPos = pos->xPos; + fx->pos.yPos = pos->yPos; + fx->pos.zPos = pos->zPos; + fx->pos.xRot = pos->xRot; + fx->pos.yRot = pos->yRot; + fx->pos.zRot = 0; + fx->roomNumber = roomNumber; + fx->counter = 16 * count + 15; + fx->flag1 = 1; + fx->objectNumber = ID_BUBBLES; + fx->speed = (GetRandomControl() & 0x1F) + 64; + fx->frameNumber = Objects[ID_BUBBLES].meshIndex + 8; + } +} + +void TriggerRomanStatueMissileSparks(PHD_VECTOR* pos, char fxObj) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = 0; + spark->sG = (GetRandomControl() & 0x3F) - 96; + spark->sB = spark->sG >> 1; + spark->dR = 0; + spark->dG = (GetRandomControl() & 0x3F) - 96; + spark->dB = spark->dG >> 1; + spark->fadeToBlack = 8; + spark->colFadeSpeed = (GetRandomControl() & 3) + 8; + spark->transType = COLADD; + spark->dynamic = -1; + spark->life = spark->sLife = (GetRandomControl() & 3) + 20; + spark->x = (GetRandomControl() & 0xF) - 8; + spark->y = (GetRandomControl() & 0xF) - 8; + spark->z = (GetRandomControl() & 0xF) - 8; + spark->xVel = (GetRandomControl() & 0x3FF) - 512; + spark->yVel = (GetRandomControl() & 0x3FF) - 512; + spark->zVel = (GetRandomControl() & 0x3FF) - 512; + spark->friction = 68; + spark->flags = SP_ROTATE | SP_FX | SP_ROTATE | SP_DEF | SP_SCALE; + spark->rotAng = GetRandomControl() & 0xFFF; + spark->gravity = 0; + spark->maxYvel = 0; + spark->rotAdd = (GetRandomControl() & 0x3F) - 32; + spark->fxObj = fxObj; + spark->scalar = 2; + spark->sSize = spark->size = (GetRandomControl() & 0xF) + 96; + spark->dSize = spark->size >> 2; +} + void InitialiseRomanStatue(short itemNum) { ITEM_INFO* item = &Items[itemNum]; @@ -50,14 +272,14 @@ void InitialiseRomanStatue(short itemNum) item->goalAnimState = 13; item->currentAnimState = 13; item->frameNumber = Anims[item->animNumber].frameBase; - item->status = ITEM_INACTIVE; - item->pos.xPos += 486 * phd_sin(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT; - item->pos.zPos += 486 * phd_cos(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT; + item->status = ITEM_NOT_ACTIVE; + item->pos.xPos += 486 * phd_sin(item->pos.yRot + ANGLE(90.0f)) >> W2V_SHIFT; + item->pos.zPos += 486 * phd_cos(item->pos.yRot + ANGLE(90.0f)) >> W2V_SHIFT; ZeroMemory(&RomanStatueData, sizeof(ROMAN_STATUE_STRUCT)); } -void ControlRomanStatue(short itemNumber) +void RomanStatueControl(short itemNumber) { if (!CreatureActive(itemNumber)) return; @@ -737,225 +959,4 @@ void ControlRomanStatue(short itemNumber) } CreatureAnimation(itemNumber, angle, 0); -} - -void RomanStatueHitEffect(ITEM_INFO* item, PHD_VECTOR* pos, int joint) -{ - GetJointAbsPosition(item, pos, joint); - - if (!(GetRandomControl() & 0x1F)) - { - short fxNumber = CreateNewEffect(item->roomNumber); - if (fxNumber != -1) - { - FX_INFO* fx = &Effects[fxNumber]; - - fx->pos.xPos = pos->x; - fx->pos.yPos = pos->y; - fx->pos.zPos = pos->z; - fx->roomNumber = item->roomNumber; - fx->pos.zRot = 0; - fx->pos.xRot = 0; - fx->pos.yRot = 2 * GetRandomControl(); - fx->speed = 1; - fx->fallspeed = 0; - fx->objectNumber = ID_BODY_PART; - fx->shade = 16912; - fx->flag2 = 9729; - fx->frameNumber = Objects[ID_BUBBLES].meshIndex + (GetRandomControl() & 7); - fx->counter = 0; - fx->flag1 = 0; - } - } - - if (!(GetRandomControl() & 0xF)) - { - SMOKE_SPARKS* spark = &SmokeSparks[GetFreeSmokeSpark()]; - - spark->on = 1; - spark->sShade = 0; - spark->colFadeSpeed = 4; - spark->fadeToBlack = 32; - spark->dShade = (GetRandomControl() & 0xF) + 64; - spark->transType = COLADD; - spark->life = spark->sLife= (GetRandomControl() & 3) + 64; - spark->x = (GetRandomControl() & 0x1F) + pos->x - 16; - spark->y = (GetRandomControl() & 0x1F) + pos->y - 16; - spark->z = (GetRandomControl() & 0x1F) + pos->z - 16; - spark->xVel = (GetRandomControl() & 0x7F) - 64; - spark->yVel = 0; - spark->zVel = (GetRandomControl() & 0x7F) - 64; - spark->friction = 4; - spark->flags = SP_ROTATE; - spark->rotAng = GetRandomControl() & 0xFFF; - spark->rotAdd = (GetRandomControl() & 0x1F) - 16; - spark->maxYvel = 0; - spark->gravity = (GetRandomControl() & 7) + 8; - spark->mirror = 0; - spark->sSize = spark->size = (GetRandomControl() & 7) + 8; - spark->dSize = spark->size * 2; - } -} - -void TriggerRomanStatueShockwaveAttackSparks(int x, int y, int z, byte r, byte g, byte b, byte size) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->dG = g; - spark->sG = g; - spark->colFadeSpeed = 2; - spark->dR = r; - spark->sR = r; - spark->transType = COLADD; - spark->life = 16; - spark->sLife = 16; - spark->x = x; - spark->on = 1; - spark->dB = b; - spark->sB = b; - spark->fadeToBlack = 4; - spark->y = y; - spark->z = z; - spark->zVel = 0; - spark->yVel = 0; - spark->xVel = 0; - spark->flags = SP_SCALE | SP_DEF; - spark->scalar = 3; - spark->maxYvel = 0; - spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 11; - spark->gravity = 0; - spark->dSize = spark->sSize = spark->size = size + (GetRandomControl() & 3); -} - -void TriggerRomanStatueScreamingSparks(int x, int y, int z, short xv, short yv, short zv, int flags) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = 0; - spark->sG = 0; - spark->sB = 0; - spark->dR = 64; - if (flags) - { - spark->dG = (GetRandomControl() & 0x3F) - 64; - spark->dB = spark->dG >> 1; - } - else - { - spark->dB = (GetRandomControl() & 0x3F) - 64; - spark->dG = spark->dB >> 1; - } - spark->colFadeSpeed = 4; - spark->fadeToBlack = 4; - spark->life = 16; - spark->sLife = 16; - spark->x = x; - spark->y = y; - spark->z = z; - spark->xVel = xv; - spark->yVel = yv; - spark->zVel = zv; - spark->transType = COLADD; - spark->friction = 34; - spark->maxYvel = 0; - spark->gravity = 0; - spark->flags = 0; -} - -void TriggerRomanStatueAttackEffect1(short itemNum, int factor) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = 0; - spark->sB = (GetRandomControl() & 0x3F) - 96; - spark->dB = (GetRandomControl() & 0x3F) - 96; - spark->dR = 0; - if (factor < 16) - { - spark->sB = factor * spark->sB >> 4; - spark->dB = factor * spark->dB >> 4; - } - spark->sG = spark->sB >> 1; - spark->dG = spark->dB >> 1; - spark->fadeToBlack = 4; - spark->colFadeSpeed = (GetRandomControl() & 3) + 8; - spark->transType = COLADD; - spark->dynamic = -1; - spark->life = spark->sLife = (GetRandomControl() & 3) + 32; - spark->y = 0; - spark->x = (GetRandomControl() & 0x1F) - 16; - spark->z = (GetRandomControl() & 0x1F) - 16; - spark->yVel = 0; - spark->xVel = (byte)GetRandomControl() - 128; - spark->friction = 4; - spark->zVel = (byte)GetRandomControl() - 128; - spark->flags = SP_NODEATTACH | SP_EXPDEF | SP_ITEM | SP_ROTATE | SP_DEF | SP_SCALE; // 4762; - spark->fxObj = itemNum; - spark->nodeNumber = 6; - spark->rotAng = GetRandomControl() & 0xFFF; - spark->rotAdd = (GetRandomControl() & 0x3F) - 32; - spark->maxYvel = 0; - spark->gravity = -8 - (GetRandomControl() & 7); - spark->scalar = 2; - spark->dSize = 4; - spark->sSize = spark->size = factor * ((GetRandomControl() & 0x1F) + 64) >> 4; -} - -void RomanStatueAttack(PHD_3DPOS* pos, short roomNumber, short count) -{ - short fxNum = CreateNewEffect(roomNumber); - - if (fxNum != NO_ITEM) - { - FX_INFO* fx = &Effects[fxNum]; - - fx->pos.xPos = pos->xPos; - fx->pos.yPos = pos->yPos; - fx->pos.zPos = pos->zPos; - fx->pos.xRot = pos->xRot; - fx->pos.yRot = pos->yRot; - fx->pos.zRot = 0; - fx->roomNumber = roomNumber; - fx->counter = 16 * count + 15; - fx->flag1 = 1; - fx->objectNumber = ID_BUBBLES; - fx->speed = (GetRandomControl() & 0x1F) + 64; - fx->frameNumber = Objects[ID_BUBBLES].meshIndex + 8; - } -} - -void TriggerRomanStatueMissileSparks(PHD_VECTOR* pos, char fxObj) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = 0; - spark->sG = (GetRandomControl() & 0x3F) - 96; - spark->sB = spark->sG >> 1; - spark->dR = 0; - spark->dG = (GetRandomControl() & 0x3F) - 96; - spark->dB = spark->dG >> 1; - spark->fadeToBlack = 8; - spark->colFadeSpeed = (GetRandomControl() & 3) + 8; - spark->transType = COLADD; - spark->dynamic = -1; - spark->life = spark->sLife = (GetRandomControl() & 3) + 20; - spark->x = (GetRandomControl() & 0xF) - 8; - spark->y = (GetRandomControl() & 0xF) - 8; - spark->z = (GetRandomControl() & 0xF) - 8; - spark->xVel = (GetRandomControl() & 0x3FF) - 512; - spark->yVel = (GetRandomControl() & 0x3FF) - 512; - spark->zVel = (GetRandomControl() & 0x3FF) - 512; - spark->friction = 68; - spark->flags = SP_ROTATE | SP_FX | SP_ROTATE | SP_DEF | SP_SCALE; - spark->rotAng = GetRandomControl() & 0xFFF; - spark->gravity = 0; - spark->maxYvel = 0; - spark->rotAdd = (GetRandomControl() & 0x3F) - 32; - spark->fxObj = fxObj; - spark->scalar = 2; - spark->sSize = spark->size = (GetRandomControl() & 0xF) + 96; - spark->dSize = spark->size >> 2; } \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Entity/tr5_roman_statue.h b/TR5Main/Objects/TR5/Entity/tr5_roman_statue.h new file mode 100644 index 000000000..375c70ad6 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_roman_statue.h @@ -0,0 +1,6 @@ +#pragma once +#include "phd_global.h" + +void InitialiseRomanStatue(short itemNum); +void RomanStatueControl(short itemNumber); +void TriggerRomanStatueMissileSparks(PHD_VECTOR* pos, char fxObj); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_submarine.cpp b/TR5Main/Objects/TR5/Entity/tr5_submarine.cpp similarity index 90% rename from TR5Main/Objects/TR5/tr5_submarine.cpp rename to TR5Main/Objects/TR5/Entity/tr5_submarine.cpp index 876151a62..c71341b16 100644 --- a/TR5Main/Objects/TR5/tr5_submarine.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_submarine.cpp @@ -1,18 +1,166 @@ -#include "../oldobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/sphere.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/effect2.h" -#include "../../Game/larafire.h" -#include "../../Game/draw.h" -#include "../../Game/effects.h" -#include "../../Game/lara1gun.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_submarine.h" +#include "items.h" +#include "box.h" +#include "people.h" +#include "sphere.h" +#include "tomb4fx.h" +#include "effect2.h" +#include "larafire.h" +#include "draw.h" +#include "effect.h" +#include "lara1gun.h" +#include "setup.h" +#include "level.h" +#include "lara.h" +#include "sound.h" + +static void TriggerSubmarineSparks(short itemNumber) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = -1; + spark->sG = -1; + spark->sB = -1; + spark->colFadeSpeed = 2; + spark->dG = (GetRandomControl() & 0x1F) - 32; + spark->life = 2; + spark->dR = spark->dG >> 1; + spark->dB = spark->dG >> 1; + spark->sLife = 2; + spark->transType = COLADD; + spark->fadeToBlack = 0; + spark->flags = 20650; + spark->fxObj = itemNumber; + spark->nodeNumber = 7; + spark->x = 0; + spark->z = 0; + spark->y = 0; + spark->xVel = 0; + spark->yVel = 0; + spark->zVel = 0; + spark->maxYvel = 0; + spark->gravity = 0; + spark->scalar = 1; + spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 11; + spark->dSize = spark->sSize = spark->size = (GetRandomControl() & 7) + 192; +} + +static void TriggerTorpedoBubbles(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char factor) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = 32; + spark->sG = 32; + spark->sB = 32; + spark->dR = 80; + spark->dG = 80; + spark->dB = 80; + spark->colFadeSpeed = 2; + spark->fadeToBlack = 8; + spark->transType = COLADD; + spark->life = spark->sLife = (GetRandomControl() & 7) + 16; + spark->x = pos1->x + (GetRandomControl() & 0x1F); + spark->y = (GetRandomControl() & 0x1F) + pos1->y - 16; + spark->z = (GetRandomControl() & 0x1F) + pos1->z - 16; + spark->xVel = pos2->x + (GetRandomControl() & 0x7F) - pos1->x - 64; + spark->yVel = pos2->y + (GetRandomControl() & 0x7F) - pos1->y - 64; + spark->zVel = pos2->z + (GetRandomControl() & 0x7F) - pos1->z - 64; + spark->friction = 0; + spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 17; + spark->maxYvel = 0; + spark->gravity = -4 - (GetRandomControl() & 3); + spark->scalar = 1; + spark->flags = SP_ROTATE | SP_DEF | SP_SCALE; + spark->rotAng = GetRandomControl() & 0xFFF; + spark->rotAdd = (GetRandomControl() & 0x3F) - 32; + spark->sSize = spark->size = (GetRandomControl() & 0xF) + 32 >> factor; + spark->dSize = spark->size << 1; +} + +static void TriggerTorpedoSparks2(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char scale) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = 32; + spark->sG = 32; + spark->sB = 32; + spark->dR = -128; + spark->dG = -128; + spark->dB = -128; + spark->colFadeSpeed = 2; + spark->fadeToBlack = 8; + spark->transType = COLADD; + spark->life = spark->sLife = (GetRandomControl() & 7) + 16; + spark->x = pos1->x + (GetRandomControl() & 0x1F); + spark->y = (GetRandomControl() & 0x1F) + pos1->y - 16; + spark->z = (GetRandomControl() & 0x1F) + pos1->z - 16; + spark->xVel = pos2->x + (GetRandomControl() & 0x7F) - pos1->x - 64; + spark->yVel = pos2->y + (GetRandomControl() & 0x7F) - pos1->y - 64; + spark->zVel = pos2->z + (GetRandomControl() & 0x7F) - pos1->z - 64; + spark->friction = 51; + spark->gravity = -4 - (GetRandomControl() & 3); + spark->maxYvel = 0; + spark->scalar = 2 - scale; + spark->flags = SP_EXPDEF | SP_ROTATE | SP_SCALE; + spark->rotAng = GetRandomControl() & 0xFFF; + spark->rotAdd = (GetRandomControl() & 0x3F) - 32; + spark->sSize = spark->size = (GetRandomControl() & 0xF) + 32; + spark->dSize = spark->size << 1; +} + +static void SubmarineAttack(ITEM_INFO* item) +{ + short itemNumber = CreateItem(); + if (itemNumber != NO_ITEM) + { + ITEM_INFO* torpedoItem = &Items[itemNumber]; + + SoundEffect(SFX_UNDERWATER_TORPEDO, &torpedoItem->pos, 2); + + torpedoItem->objectNumber = ID_TORPEDO; + torpedoItem->shade = -15856; + + PHD_VECTOR pos1; + PHD_VECTOR pos2; + + for (int i = 0; i < 8; i++) + { + pos1.x = (GetRandomControl() & 0x7F) - 414; + pos1.y = -320; + pos1.z = 352; + GetJointAbsPosition(item, &pos1, 4); + + pos2.x = (GetRandomControl() & 0x3FF) - 862; + pos2.y = -320 - (GetRandomControl() & 0x3FF); + pos2.z = (GetRandomControl() & 0x3FF) - 160; + GetJointAbsPosition(item, &pos2, 4); + + TriggerTorpedoSparks2(&pos1, &pos2, 0); + } + + torpedoItem->roomNumber = item->roomNumber; + GetFloor(pos1.x, pos1.y, pos1.z, &torpedoItem->roomNumber); + + torpedoItem->pos.xPos = pos1.x; + torpedoItem->pos.yPos = pos1.y; + torpedoItem->pos.zPos = pos1.z; + + InitialiseItem(itemNumber); + + torpedoItem->pos.xRot = 0; + torpedoItem->pos.yRot = item->pos.yRot; + torpedoItem->pos.zRot = 0; + torpedoItem->speed = 0; + torpedoItem->fallspeed = 0; + torpedoItem->itemFlags[0] = -1; + + AddActiveItem(itemNumber); + } +} void InitialiseSubmarine(short itemNum) { @@ -28,7 +176,7 @@ void InitialiseSubmarine(short itemNum) item->triggerFlags = 120; } -void ControlSubmarine(short itemNumber) +void SubmarineControl(short itemNumber) { if (!CreatureActive(itemNumber)) return; @@ -245,153 +393,6 @@ void ControlSubmarine(short itemNumber) CreatureUnderwater(item, -14080); } -void TriggerTorpedoBubbles(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char factor) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = 32; - spark->sG = 32; - spark->sB = 32; - spark->dR = 80; - spark->dG = 80; - spark->dB = 80; - spark->colFadeSpeed = 2; - spark->fadeToBlack = 8; - spark->transType = COLADD; - spark->life = spark->sLife = (GetRandomControl() & 7) + 16; - spark->x = pos1->x + (GetRandomControl() & 0x1F); - spark->y = (GetRandomControl() & 0x1F) + pos1->y - 16; - spark->z = (GetRandomControl() & 0x1F) + pos1->z - 16; - spark->xVel = LOWORD(pos2->x) + (GetRandomControl() & 0x7F) - LOWORD(pos1->x) - 64; - spark->yVel = LOWORD(pos2->y) + (GetRandomControl() & 0x7F) - LOWORD(pos1->y) - 64; - spark->zVel = LOWORD(pos2->z) + (GetRandomControl() & 0x7F) - LOWORD(pos1->z) - 64; - spark->friction = 0; - spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 17; - spark->maxYvel = 0; - spark->gravity = -4 - (GetRandomControl() & 3); - spark->scalar = 1; - spark->flags = SP_ROTATE | SP_DEF | SP_SCALE; - spark->rotAng = GetRandomControl() & 0xFFF; - spark->rotAdd = (GetRandomControl() & 0x3F) - 32; - spark->sSize = spark->size = (GetRandomControl() & 0xF) + 32 >> factor; - spark->dSize = spark->size << 1; -} - -void TriggerSubmarineSparks(short itemNumber) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = -1; - spark->sG = -1; - spark->sB = -1; - spark->colFadeSpeed = 2; - spark->dG = (GetRandomControl() & 0x1F) - 32; - spark->life = 2; - spark->dR = spark->dG >> 1; - spark->dB = spark->dG >> 1; - spark->sLife = 2; - spark->transType = COLADD; - spark->fadeToBlack = 0; - spark->flags = 20650; - spark->fxObj = itemNumber; - spark->nodeNumber = 7; - spark->x = 0; - spark->z = 0; - spark->y = 0; - spark->xVel = 0; - spark->yVel = 0; - spark->zVel = 0; - spark->maxYvel = 0; - spark->gravity = 0; - spark->scalar = 1; - spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 11; - spark->dSize = spark->sSize = spark->size = (GetRandomControl() & 7) + 192; -} - -void SubmarineAttack(ITEM_INFO* item) -{ - short itemNumber = CreateItem(); - if (itemNumber != NO_ITEM) - { - ITEM_INFO* torpedoItem = &Items[itemNumber]; - - SoundEffect(SFX_UNDERWATER_TORPEDO, &torpedoItem->pos, 2); - - torpedoItem->objectNumber = ID_TORPEDO; - torpedoItem->shade = -15856; - - PHD_VECTOR pos1; - PHD_VECTOR pos2; - - for (int i = 0; i < 8; i++) - { - pos1.x = (GetRandomControl() & 0x7F) - 414; - pos1.y = -320; - pos1.z = 352; - GetJointAbsPosition(item, &pos1, 4); - - pos2.x = (GetRandomControl() & 0x3FF) - 862; - pos2.y = -320 - (GetRandomControl() & 0x3FF); - pos2.z = (GetRandomControl() & 0x3FF) - 160; - GetJointAbsPosition(item, &pos2, 4); - - TriggerTorpedoSparks2(&pos1, &pos2, 0); - } - - torpedoItem->roomNumber = item->roomNumber; - GetFloor(pos1.x, pos1.y, pos1.z, &torpedoItem->roomNumber); - - torpedoItem->pos.xPos = pos1.x; - torpedoItem->pos.yPos = pos1.y; - torpedoItem->pos.zPos = pos1.z; - - InitialiseItem(itemNumber); - - torpedoItem->pos.xRot = 0; - torpedoItem->pos.yRot = item->pos.yRot; - torpedoItem->pos.zRot = 0; - torpedoItem->speed = 0; - torpedoItem->fallspeed = 0; - torpedoItem->itemFlags[0] = -1; - - AddActiveItem(itemNumber); - } -} - -void TriggerTorpedoSparks2(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char scale) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = 32; - spark->sG = 32; - spark->sB = 32; - spark->dR = -128; - spark->dG = -128; - spark->dB = -128; - spark->colFadeSpeed = 2; - spark->fadeToBlack = 8; - spark->transType = COLADD; - spark->life = spark->sLife = (GetRandomControl() & 7) + 16; - spark->x = pos1->x + (GetRandomControl() & 0x1F); - spark->y = (GetRandomControl() & 0x1F) + pos1->y - 16; - spark->z = (GetRandomControl() & 0x1F) + pos1->z - 16; - spark->xVel = LOWORD(pos2->x) + (GetRandomControl() & 0x7F) - LOWORD(pos1->x) - 64; - spark->yVel = LOWORD(pos2->y) + (GetRandomControl() & 0x7F) - LOWORD(pos1->y) - 64; - spark->zVel = pos2->z + (GetRandomControl() & 0x7F) - LOWORD(pos1->z) - 64; - spark->friction = 51; - spark->gravity = -4 - (GetRandomControl() & 3); - spark->maxYvel = 0; - spark->scalar = 2 - scale; - spark->flags = SP_EXPDEF | SP_ROTATE | SP_DEF | SP_SCALE; - spark->rotAng = GetRandomControl() & 0xFFF; - spark->rotAdd = (GetRandomControl() & 0x3F) - 32; - spark->sSize = spark->size = (GetRandomControl() & 0xF) + 32; - spark->dSize = spark->size << 1; -} - void ChaffFlareControl(short itemNumber) { ITEM_INFO* item = &Items[itemNumber]; diff --git a/TR5Main/Objects/TR5/Entity/tr5_submarine.h b/TR5Main/Objects/TR5/Entity/tr5_submarine.h new file mode 100644 index 000000000..f78c3e09f --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_submarine.h @@ -0,0 +1,6 @@ +#pragma once + +void InitialiseSubmarine(short itemNum); +void SubmarineControl(short itemNumber); +void TorpedoControl(short itemNumber); +void ChaffFlareControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_willowwisp.cpp b/TR5Main/Objects/TR5/Entity/tr5_willowwisp.cpp similarity index 70% rename from TR5Main/Objects/TR5/tr5_willowwisp.cpp rename to TR5Main/Objects/TR5/Entity/tr5_willowwisp.cpp index 6287a1d0f..56b2304bd 100644 --- a/TR5Main/Objects/TR5/tr5_willowwisp.cpp +++ b/TR5Main/Objects/TR5/Entity/tr5_willowwisp.cpp @@ -1,7 +1,8 @@ -#include "../newobjects.h" -#include "../../Game/items.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" +#include "framework.h" +#include "tr5_willowwisp.h" +#include "items.h" +#include "setup.h" +#include "level.h" void InitialiseLightingGuide(short itemNum) { diff --git a/TR5Main/Objects/TR5/Entity/tr5_willowwisp.h b/TR5Main/Objects/TR5/Entity/tr5_willowwisp.h new file mode 100644 index 000000000..85d538864 --- /dev/null +++ b/TR5Main/Objects/TR5/Entity/tr5_willowwisp.h @@ -0,0 +1,3 @@ +#pragma once + +void InitialiseLightingGuide(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_missile.cpp b/TR5Main/Objects/TR5/Object/tr5_missile.cpp similarity index 89% rename from TR5Main/Objects/TR5/tr5_missile.cpp rename to TR5Main/Objects/TR5/Object/tr5_missile.cpp index 9b155469a..f3bec3d22 100644 --- a/TR5Main/Objects/TR5/tr5_missile.cpp +++ b/TR5Main/Objects/TR5/Object/tr5_missile.cpp @@ -1,17 +1,20 @@ -#include "../oldobjects.h" -#include "../../Game/items.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/sphere.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/effect2.h" -#include "../../Game/draw.h" -#include "../../Game/effects.h" -#include "../../Game/traps.h" -#include "../../Specific/level.h" -#include "../../Game/debris.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_missile.h" +#include "items.h" +#include "box.h" +#include "people.h" +#include "sphere.h" +#include "tomb4fx.h" +#include "effect2.h" +#include "draw.h" +#include "effect.h" +#include "traps.h" +#include "level.h" +#include "debris.h" +#include "lara.h" +#include "sound.h" +#include "tr5_roman_statue.h" +#include "tr5_hydra.h" int DebrisFlags; @@ -203,10 +206,9 @@ void MissileControl(short itemNumber) int yv = y - fx->pos.yPos; int zv = z - fx->pos.zPos; - if (fx->flag1) + if (fx->flag1 == 1) { - if (fx->flag1 == 1) - TriggerRomanStatueMissileSparks(&pos, itemNumber); + TriggerRomanStatueMissileSparks(&pos, itemNumber); } else { diff --git a/TR5Main/Objects/TR5/Object/tr5_missile.h b/TR5Main/Objects/TR5/Object/tr5_missile.h new file mode 100644 index 000000000..db5dcbc4a --- /dev/null +++ b/TR5Main/Objects/TR5/Object/tr5_missile.h @@ -0,0 +1,5 @@ +#pragma once +#include "effect.h" + +void MissileControl(short itemNumber); +void ExplodeFX(FX_INFO* fx, int noXZVel, int bits); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_moving_block.cpp b/TR5Main/Objects/TR5/Object/tr5_pushableblock.cpp similarity index 96% rename from TR5Main/Objects/TR5/tr5_moving_block.cpp rename to TR5Main/Objects/TR5/Object/tr5_pushableblock.cpp index 601b00f3e..f7ef52a53 100644 --- a/TR5Main/Objects/TR5/tr5_moving_block.cpp +++ b/TR5Main/Objects/TR5/Object/tr5_pushableblock.cpp @@ -1,22 +1,22 @@ -#include "../newobjects.h" -#include "../oldobjects.h" -#include "../../Game/lara.h" -#include "../../Game/draw.h" -#include "../../Global/global.h" -#include "../../Game/items.h" -#include "../../Game/collide.h" -#include "../../Game/effects.h" -#include "../../Game/laramisc.h" -#include "../../Game/Box.h" -#include "..\..\Specific\level.h" -#include "../../Specific/input.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "tr5_pushableblock.h" +#include "lara.h" +#include "draw.h" + +#include "items.h" +#include "collide.h" +#include "effect.h" +#include "laramisc.h" +#include "box.h" +#include "level.h" +#include "input.h" +#include "sound.h" short MovingBlockBounds[12] = { -300, 300, 0, 0, -692, -512, - -10 * ONE_DEGREE, 10 * ONE_DEGREE, - -30 * ONE_DEGREE, 30 * ONE_DEGREE, - -10 * ONE_DEGREE, 10 * ONE_DEGREE + -ANGLE(10.0f), ANGLE(10.0f), + -ANGLE(30.0f), ANGLE(30.0f), + -ANGLE(10.0f), ANGLE(10.0f) }; short PushableBlockBounds[12] = { @@ -26,23 +26,12 @@ short PushableBlockBounds[12] = { }; PHD_VECTOR PushableBlockPos = { 0, 0, 0 }; - int DoPushPull = 0; -void InitialisePushableBlock(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - ClearMovableBlockSplitters(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber); - - //if (item->status != ITEM_INVISIBLE) - // AlterFloorHeight(item, -1024); -} - void ClearMovableBlockSplitters(int x, int y, int z, short roomNumber) { FLOOR_INFO* floor = GetFloor(x, y, z, &roomNumber); - Boxes[floor->box].overlapIndex &= (~BLOCKED); + Boxes[floor->box].overlapIndex &= (~BLOCKED); short height = Boxes[floor->box].height; short baseRoomNumber = roomNumber; @@ -78,6 +67,16 @@ void ClearMovableBlockSplitters(int x, int y, int z, short roomNumber) } } +void InitialisePushableBlock(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + ClearMovableBlockSplitters(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber); + + //if (item->status != ITEM_INVISIBLE) + // AlterFloorHeight(item, -1024); +} + void PushableBlockControl(short itemNumber) { ITEM_INFO* item = &Items[itemNumber]; @@ -242,7 +241,7 @@ void PushableBlockControl(short itemNumber) GetFloorHeight(floor, item->pos.xPos, item->pos.yPos - 256, item->pos.zPos); TestTriggers(TriggerIndex, 1, item->flags & 0x3E00); RemoveActiveItem(itemNumber); - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; } break; } @@ -269,16 +268,16 @@ void PushableBlockControl(short itemNumber) { item->gravityStatus = false; item->pos.yPos = height; - item->status = ITEM_DEACTIVATED; + item->status = ITEM_DESACTIVATED; floor_shake_effect(item); SoundEffect(SFX_LARA_THUD, &item->pos, 0); } if (item->roomNumber != roomNumber) ItemNewRoom(itemNumber, roomNumber); - if (item->status == ITEM_DEACTIVATED) + if (item->status == ITEM_DESACTIVATED) { - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; RemoveActiveItem(itemNumber); AlterFloorHeight(item, -1024); diff --git a/TR5Main/Objects/TR5/Object/tr5_pushableblock.h b/TR5Main/Objects/TR5/Object/tr5_pushableblock.h new file mode 100644 index 000000000..f22d01665 --- /dev/null +++ b/TR5Main/Objects/TR5/Object/tr5_pushableblock.h @@ -0,0 +1,11 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void ClearMovableBlockSplitters(int x, int y, int z, short roomNumber); +void InitialisePushableBlock(short itemNum); +void PushableBlockControl(short itemNum); +void PushableBlockCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll); +int TestBlockMovable(ITEM_INFO* item, int blockhite); +int TestBlockPush(ITEM_INFO* item, int blockhite, unsigned short quadrant); +int TestBlockPull(ITEM_INFO* item, int blockhite, short quadrant); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Object/tr5_twoblockplatform.cpp b/TR5Main/Objects/TR5/Object/tr5_twoblockplatform.cpp new file mode 100644 index 000000000..31e066c8b --- /dev/null +++ b/TR5Main/Objects/TR5/Object/tr5_twoblockplatform.cpp @@ -0,0 +1,125 @@ +#include "framework.h" +#include "tr5_twoblockplatform.h" +#include "level.h" +#include "control.h" +#include "items.h" +#include "lara.h" +#include "sound.h" + +void InitialiseTwoBlocksPlatform(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + item->itemFlags[0] = item->pos.yPos; + item->itemFlags[1] = 1; +} + +BOOL IsOnTwoBlocksPlatform(ITEM_INFO* item, int x, int z) +{ + if (!item->meshBits) + return FALSE; + + short angle = item->pos.yRot; + int xb = x >> WALL_SHIFT; + int zb = z >> WALL_SHIFT; + int itemxb = item->pos.xPos >> WALL_SHIFT; + int itemzb = item->pos.zPos >> WALL_SHIFT; + + if (!angle && (xb == itemxb || xb == itemxb - 1) && (zb == itemzb || zb == itemzb + 1)) + return TRUE; + if (angle == -ANGLE(180) && (xb == itemxb || xb == itemxb + 1) && (zb == itemzb || zb == itemzb - 1)) + return TRUE; + if (angle == ANGLE(90) && (zb == itemzb || zb == itemzb - 1) && (xb == itemxb || xb == itemxb + 1)) + return TRUE; + if (angle == -ANGLE(90) && (zb == itemzb || zb == itemzb - 1) && (xb == itemxb || xb == itemxb - 1)) + return TRUE; + + return FALSE; +} + +void TwoBlocksPlatformFloor(ITEM_INFO* item, int x, int y, int z, int* height) +{ + if (IsOnTwoBlocksPlatform(item, x, z)) + { + if (y <= (item->pos.yPos + 32) && item->pos.yPos < *height) + { + *height = item->pos.yPos; + OnFloor = 1; + HeightType = WALL; + } + } +} + +void TwoBlocksPlatformControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (TriggerActive(item)) + { + if (item->triggerFlags) + { + if (item->pos.yPos > (item->itemFlags[0] - 16 * (item->triggerFlags & 0xFFFFFFF0))) + { + item->pos.yPos -= item->triggerFlags & 0xF; + } + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + item->floor = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + + if (roomNumber != item->roomNumber) + ItemNewRoom(itemNumber, roomNumber); + } + else + { + OnFloor = false; + + int height = LaraItem->pos.yPos + 1; + TwoBlocksPlatformFloor(item, LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos, &height); + + if (OnFloor && LaraItem->animNumber != ANIMATION_LARA_RUN_BACK) + item->itemFlags[1] = 1; + else + item->itemFlags[1] = -1; + + if (item->itemFlags[1] <= 0) + { + if (item->itemFlags[1] <= 0) + { + if (item->pos.yPos <= item->itemFlags[0]) + { + item->itemFlags[1] = 1; + } + else + { + SoundEffect(SFX_2GUNTEX_FALL_BIG, &item->pos, 0); + item->pos.yPos -= 4; + } + } + } + else + { + if (item->pos.yPos >= item->itemFlags[0] + 128) + { + item->itemFlags[1] = -1; + } + else + { + SoundEffect(SFX_2GUNTEX_FALL_BIG, &item->pos, 0); + item->pos.yPos += 4; + } + } + } + } +} + +void TwoBlocksPlatformCeiling(ITEM_INFO* item, int x, int y, int z, int* height) +{ + if (IsOnTwoBlocksPlatform(item, x, z)) + { + if (y > item->pos.yPos + 32 && item->pos.yPos > * height) + { + *height = item->pos.yPos + 256; + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Object/tr5_twoblockplatform.h b/TR5Main/Objects/TR5/Object/tr5_twoblockplatform.h new file mode 100644 index 000000000..7128a1a21 --- /dev/null +++ b/TR5Main/Objects/TR5/Object/tr5_twoblockplatform.h @@ -0,0 +1,8 @@ +#pragma once +#include "items.h" + +void InitialiseTwoBlocksPlatform(short itemNumber); +void TwoBlocksPlatformControl(short itemNumber); +void TwoBlocksPlatformFloor(ITEM_INFO* item, int x, int y, int z, int* height); +void TwoBlocksPlatformCeiling(ITEM_INFO* item, int x, int y, int z, int* height); +BOOL IsOnTwoBlocksPlatform(ITEM_INFO* item, int x, int z); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Shatter/tr5_smashobject.cpp b/TR5Main/Objects/TR5/Shatter/tr5_smashobject.cpp new file mode 100644 index 000000000..0548d332a --- /dev/null +++ b/TR5Main/Objects/TR5/Shatter/tr5_smashobject.cpp @@ -0,0 +1,50 @@ +#include "framework.h" +#include "tr5_smashobject.h" +#include "level.h" +#include "box.h" +#include "sound.h" +#include "tomb4fx.h" +#include "items.h" +#include "trmath.h" + +void InitialiseSmashObject(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + item->flags = 0; + item->meshBits = 1; + + ROOM_INFO* r = &Rooms[item->roomNumber]; + FLOOR_INFO* floor = &XZ_GET_SECTOR(r, item->pos.xPos - r->x, item->pos.zPos - r->z); + BOX_INFO* box = &Boxes[floor->box]; + if (box->overlapIndex & END_BIT) + box->overlapIndex |= BLOCKED; +} + +void SmashObject(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + ROOM_INFO* r = &Rooms[item->roomNumber]; + int sector = ((item->pos.zPos - r->z) >> 10) + r->xSize * ((item->pos.xPos - r->x) >> 10); + + BOX_INFO* box = &Boxes[r->floor[sector].box]; + if (box->overlapIndex & BOX_LAST) + box->overlapIndex &= ~BOX_BLOCKED; + + SoundEffect(SFX_SMASH_GLASS, &item->pos, 0); + + item->collidable = 0; + item->meshBits = 0xFFFE; + + ExplodingDeath(itemNumber, -1, 257); + + item->flags |= IFLAG_INVISIBLE; + + if (item->status == ITEM_ACTIVE) + RemoveActiveItem(itemNumber); + item->status = ITEM_DESACTIVATED; +} + +void SmashObjectControl(short itemNumber) +{ + SmashObject(itemNumber << 16); +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Shatter/tr5_smashobject.h b/TR5Main/Objects/TR5/Shatter/tr5_smashobject.h new file mode 100644 index 000000000..b62e3aa84 --- /dev/null +++ b/TR5Main/Objects/TR5/Shatter/tr5_smashobject.h @@ -0,0 +1,5 @@ +#pragma once + +void SmashObject(short itemNumber); +void InitialiseSmashObject(short itemNumber); +void SmashObjectControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Switch/tr5_cogswitch.cpp b/TR5Main/Objects/TR5/Switch/tr5_cogswitch.cpp new file mode 100644 index 000000000..6f53fbda0 --- /dev/null +++ b/TR5Main/Objects/TR5/Switch/tr5_cogswitch.cpp @@ -0,0 +1,135 @@ +#include "framework.h" +#include "tr5_cogswitch.h" +#include "level.h" +#include "control.h" +#include "input.h" +#include "lara.h" +#include "items.h" +#include "sound.h" +#include "door.h" + +static PHD_VECTOR CogSwitchPos(0, 0, -856); +static short CogSwitchBounds[12] = +{ + 0xFE00, 0x0200, 0x0000, 0x0000, 0xFA00, 0xFE00, 0xF8E4, 0x071C, 0xEAAC, 0x1554, + 0xF8E4, 0x071C +}; + +void CogSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) +{ + ITEM_INFO* item = &Items[itemNum]; + + FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &item->roomNumber); + GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + + if (!TriggerIndex) + { + ObjectCollision(itemNum, l, coll); + return; + } + + short* trigger = TriggerIndex; + for (int i = *TriggerIndex; (i & 0x1F) != 4; trigger++) + { + if (i < 0) + break; + i = trigger[1]; + } + + ITEM_INFO* target = &Items[trigger[3] & 0x3FF]; + DOOR_DATA* door = (DOOR_DATA*)target->data; + + if (item->status == ITEM_NOT_ACTIVE) + { + if (!(item->flags & 0x100) + && (TrInput & IN_ACTION + && !Lara.gunStatus + && !(item->status && item->gravityStatus) + && l->currentAnimState == STATE_LARA_STOP + && l->animNumber == ANIMATION_LARA_STAY_IDLE + || Lara.isMoving && Lara.generalPtr == (void*)itemNum)) + { + if (TestLaraPosition(CogSwitchBounds, item, l)) + { + if (MoveLaraPosition(&CogSwitchPos, item, l)) + { + Lara.isMoving = false; + Lara.headYrot = 0; + Lara.headXrot = 0; + Lara.torsoYrot = 0; + Lara.torsoXrot = 0; + Lara.gunStatus = LG_HANDS_BUSY; + Lara.generalPtr = target; + l->animNumber = ANIMATION_LARA_COGWHEEL_GRAB; + l->goalAnimState = STATE_LARA_COGWHEEL; + l->currentAnimState = STATE_LARA_COGWHEEL; + l->frameNumber = Anims[l->animNumber].frameBase; + + AddActiveItem(itemNum); + + item->goalAnimState = 1; + item->status = ITEM_ACTIVE; + if (!door->opened) + { + AddActiveItem((target - Items)); + target->itemFlags[2] = target->pos.yPos; + target->status = ITEM_ACTIVE; + } + } + else + { + Lara.generalPtr = (void*)itemNum; + } + return; + } + if (Lara.isMoving && Lara.generalPtr == (void*)itemNum) + { + Lara.isMoving = false; + Lara.gunStatus = LG_NO_ARMS; + } + } + + ObjectCollision(itemNum, l, coll); + } +} + +void CogSwitchControl(short itemNum) +{ + ITEM_INFO* item = &Items[itemNum]; + + AnimateItem(item); + + if (item->currentAnimState == 1) + { + if (item->goalAnimState == 1 && !(TrInput & IN_ACTION)) + { + LaraItem->goalAnimState = STATE_LARA_STOP; + item->goalAnimState = 0; + } + + if (LaraItem->animNumber == ANIMATION_LARA_COGWHEEL_PULL) + { + if (LaraItem->frameNumber == (Anims[ANIMATION_LARA_COGWHEEL_PULL].frameBase + 10)) + { + ITEM_INFO* it = (ITEM_INFO*)Lara.generalPtr; + it->itemFlags[0] = 40; + Lara.generalPtr = it; + SoundEffect(SFX_STONE_SCRAPE_FAST, &it->pos, 0); + } + } + } + else + { + if (item->frameNumber == Anims[item->animNumber].frameEnd) + { + item->currentAnimState = 0; + item->status = ITEM_NOT_ACTIVE; + RemoveActiveItem(itemNum); + LaraItem->animNumber = ANIMATION_LARA_STAY_SOLID; + LaraItem->frameNumber = Anims[LaraItem->animNumber].frameBase; + LaraItem->goalAnimState = STATE_LARA_STOP; + LaraItem->currentAnimState = STATE_LARA_STOP; + Lara.gunStatus = LG_NO_ARMS; + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Switch/tr5_cogswitch.h b/TR5Main/Objects/TR5/Switch/tr5_cogswitch.h new file mode 100644 index 000000000..4838a21dd --- /dev/null +++ b/TR5Main/Objects/TR5/Switch/tr5_cogswitch.h @@ -0,0 +1,6 @@ +#pragma once +#include "items.h" +#include "collide.h" + +void CogSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); +void CogSwitchControl(short itemNum); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Switch/tr5_raisingcog.cpp b/TR5Main/Objects/TR5/Switch/tr5_raisingcog.cpp new file mode 100644 index 000000000..ca85674ea --- /dev/null +++ b/TR5Main/Objects/TR5/Switch/tr5_raisingcog.cpp @@ -0,0 +1,121 @@ +#include "framework.h" +#include "tr5_raisingcog.h" +#include "level.h" +#include "switch.h" +#include "control.h" +#include "items.h" +#include "sound.h" +#include "spotcam.h" +#include "objectslist.h" + +void InitialiseRaisingCog(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + short itemNos[32]; + int numSwitchItems = GetSwitchTrigger(item, itemNos, 1); + + if (numSwitchItems > 0) + { + for (int i = 0; i < numSwitchItems; i++) + { + ITEM_INFO* currentItem = &Items[itemNos[i]]; + + if (currentItem->objectNumber == ID_TRIGGER_TRIGGERER) + { + item->itemFlags[1] = currentItem->roomNumber; + } + + if (currentItem->objectNumber == ID_PULLEY || currentItem->objectNumber == ID_TRIGGER_TRIGGERER) + { + currentItem->itemFlags[1] = 1; + PulleyItemNumber = itemNos[i]; + } + } + } +} + +void RaisingCogControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (TriggerActive(item)) + { + if (item->itemFlags[0] >= 3) + { + AnimateItem(item); + } + else + { + if (item->itemFlags[2] >= 256) + { + item->itemFlags[2] = 0; + item->itemFlags[0]++; + + if (item->itemFlags[0] == 3) + { + short itemNos[32]; + short numItems = GetSwitchTrigger(item, itemNos, 1); + + if (numItems > 0) + { + for (int i = 0; i < numItems; i++) + { + ITEM_INFO* currentItem = &Items[itemNos[i]]; + + if (item->objectNumber == ID_PULLEY) + { + if (currentItem->roomNumber == item->itemFlags[1]) + { + currentItem->itemFlags[1] = 0; + currentItem->collidable = true; + } + else + { + currentItem->itemFlags[1] = 1; + } + } + else if (item->objectNumber == ID_TRIGGER_TRIGGERER) + { + AddActiveItem(itemNos[i]); + currentItem->status = ITEM_ACTIVE; + currentItem->aiBits = (GUARD | MODIFY | AMBUSH | PATROL1 | FOLLOW); + } + } + } + } + + RemoveActiveItem(itemNumber); + item->status = ITEM_NOT_ACTIVE; + item->aiBits = 0; + } + else + { + if (!item->itemFlags[2]) + { + InitialiseSpotCam(item->itemFlags[2]); + UseSpotCam = 1; + } + + int flags = 0; + + if (item->itemFlags[2] >= 31) + { + if (item->itemFlags[2] <= 224) + flags = 31; + else + flags = 255 - item->itemFlags[2]; + } + else + { + flags = item->itemFlags[2]; + } + + SoundEffect(SFX_BLK_PLAT_RAISE_LOW, &item->pos, (flags << 8) | 8); + + item->itemFlags[2] += 2; + item->pos.yPos -= 2; + } + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Switch/tr5_raisingcog.h b/TR5Main/Objects/TR5/Switch/tr5_raisingcog.h new file mode 100644 index 000000000..be08a9ce3 --- /dev/null +++ b/TR5Main/Objects/TR5/Switch/tr5_raisingcog.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseRaisingCog(short itemNumber); +void RaisingCogControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Trap/tr5_teethspike.cpp b/TR5Main/Objects/TR5/Trap/tr5_teethspike.cpp new file mode 100644 index 000000000..9f3761c82 --- /dev/null +++ b/TR5Main/Objects/TR5/Trap/tr5_teethspike.cpp @@ -0,0 +1,254 @@ +#include "framework.h" +#include "tr5_teethspike.h" +#include "control.h" +#include "draw.h" +#include "lara.h" +#include "level.h" +#include "sound.h" +#include "tomb4fx.h" +#include "trmath.h" + +short SPyoffs[8] = +{ + 0xFC00, 0x0000, 0xFE00, 0x0000, 0x0000, 0x0000, 0xFE00, 0x0000 +}; + +short SPxzoffs[8] = +{ + 0x0000, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, 0xFE00, 0x0000 +}; + +short SPDETyoffs[8] = +{ + 0x0400, 0x0200, 0x0200, 0x0200, 0x0000, 0x0200, 0x0200, 0x0200 +}; + +void InitialiseTeethSpikes(short itemNumber) +{ + ITEM_INFO* item; + int angle; + + item = &Items[itemNumber]; + item->status = ITEM_INVISIBLE; + + short rotations[8] = + { + -ANGLE(180.0f), + -ANGLE(135.0f), + -ANGLE(90.0f), + -ANGLE(45.0f), + ANGLE(0.0f), + ANGLE(45.0f), + ANGLE(90.0f), + ANGLE(135.0f) + }; + + if (item->triggerFlags & 8) + { + angle = item->triggerFlags & 7; + item->pos.xRot = rotations[angle]; + item->pos.yRot = ANGLE(90.0f); + item->pos.zPos -= SPxzoffs[angle]; + } + else + { + angle = item->triggerFlags & 7; + item->pos.zRot = rotations[angle]; + item->pos.xPos += SPxzoffs[angle]; + } + + item->itemFlags[0] = 1024; + item->itemFlags[2] = 0; + item->pos.yPos += SPyoffs[angle]; +} + +static int CollidedWithTeethSpikes(ITEM_INFO* item) +{ + short angle; + int x; + int z; + + if (item->triggerFlags & 8) + { + angle = item->triggerFlags & 7; + x = item->pos.xPos & 0xFFFFFE00 | 0x200; + z = (item->pos.zPos + SPxzoffs[angle]) & 0xFFFFFE00 | 0x200; + } + else + { + angle = item->triggerFlags & 7; + x = (item->pos.xPos - SPxzoffs[angle]) & 0xFFFFFE00 | 0x200; + z = item->pos.zPos & 0xFFFFFE00 | 0x200; + } + + int delta = -((angle & 1) != 0); + delta = delta & 0xFF4C; + delta += 480; + int y = item->pos.yPos + SPDETyoffs[angle]; + short* frames = GetBestFrame(LaraItem); + + if (LaraItem->pos.yPos + frames[2] <= y && LaraItem->pos.yPos + frames[3] >= y - 900) + { + if (LaraItem->pos.xPos + frames[0] <= (x + delta) && LaraItem->pos.xPos + frames[1] >= (x - delta)) + { + if (LaraItem->pos.zPos + frames[4] <= (z + delta) && LaraItem->pos.zPos + frames[5] >= (z - delta)) + return 1; + } + } + + return 0; +} + +void ControlTeethSpikes(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (!TriggerActive(item) || item->itemFlags[2]) + { + if (TriggerActive(item)) + { + item->itemFlags[1] -= item->itemFlags[0]; + item->itemFlags[0] += (item->itemFlags[0] >> 3) + 32; + + if (item->itemFlags[1] < 0) + { + item->itemFlags[0] = 1024; + item->itemFlags[1] = 0; + item->status = ITEM_INVISIBLE; + } + + if (item->triggerFlags & 0x20) + { + item->itemFlags[2] = 1; + } + else + { + if (item->itemFlags[2]) + { + item->itemFlags[2]--; + } + } + } + else if (!item->timer) + { + item->itemFlags[0] += (item->itemFlags[0] >> 3) + 32; + + if (item->itemFlags[1] > 0) + { + item->itemFlags[1] -= item->itemFlags[0]; + if (item->itemFlags[1] < 0) + item->itemFlags[1] = 0; + } + } + } + else + { + if (item->itemFlags[0] == 1024) + SoundEffect(SFX_TEETH_SPIKES, &item->pos, 0); + + item->status = ITEM_ACTIVE; + + if (LaraItem->hitPoints > 0 && CollidedWithTeethSpikes(item)) + { + short* itemFrames = GetBestFrame(item); + short* laraFrames = GetBestFrame(LaraItem); + + short angle = item->triggerFlags & 7; + int numBloods = 0; + + if ((item->itemFlags[0] > 1024 || LaraItem->gravityStatus) && angle > 2 && angle < 6) + { + if (LaraItem->fallspeed > 6 || item->itemFlags[0] > 1024) + { + LaraItem->hitPoints = -1; + numBloods = 20; + } + } + else if (LaraItem->speed < 30) + { + numBloods = 0; + } + else + { + LaraItem->hitPoints -= 8; + numBloods = (GetRandomControl() & 3) + 2; + } + + int laraY1 = LaraItem->pos.yPos + laraFrames[2]; + int laraY2 = LaraItem->pos.yPos + laraFrames[3]; + + short triggerFlags = item->triggerFlags & 0xF; + int itemY1; + int itemY2; + + if (triggerFlags != 8 && triggerFlags) + { + itemY1 = itemFrames[2]; + itemY2 = itemFrames[3]; + } + else + { + itemY1 = -itemFrames[3]; + itemY2 = -itemFrames[2]; + } + if (laraY1 < item->pos.yPos + itemY1) + laraY1 = itemY1 + item->pos.yPos; + if (laraY2 > item->pos.yPos + itemY2) + laraY2 = itemY2 + item->pos.yPos; + + long dy = laraY1 - laraY2; + int modulus = (HIDWORD(dy) ^ dy) - HIDWORD(dy) + 1; + + angle = item->triggerFlags & 7; + if (angle == 2 || angle == 6) + numBloods /= 2; + + for (int i = 0; i < numBloods; i++) + { + TriggerBlood( + (GetRandomControl() & 0x7F) + LaraItem->pos.xPos - 64, + laraY2 - GetRandomControl() % modulus, + (GetRandomControl() & 0x7F) + LaraItem->pos.zPos - 64, + 2 * GetRandomControl(), + 1); + } + + if (LaraItem->hitPoints <= 0) + { + short roomNumber = LaraItem->roomNumber; + FLOOR_INFO* floor = GetFloor(LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos, &roomNumber); + int height = GetFloorHeight(floor, LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos); + + if (item->pos.yPos >= LaraItem->pos.yPos && height - LaraItem->pos.yPos < 50) + { + LaraItem->animNumber = ANIMATION_LARA_SPIKED; + LaraItem->frameNumber = Anims[LaraItem->animNumber].frameBase; + LaraItem->currentAnimState = STATE_LARA_DEATH; + LaraItem->goalAnimState = STATE_LARA_DEATH; + LaraItem->gravityStatus = false; + } + } + } + + item->itemFlags[0] += 128; + item->itemFlags[1] += item->itemFlags[0]; + + if (item->itemFlags[1] >= 5120) + { + item->itemFlags[1] = 5120; + if (item->itemFlags[0] <= 1024) + { + item->itemFlags[0] = 0; + if (!(item->triggerFlags & 0x10)) + { + if (LaraItem->hitPoints > 0) + item->itemFlags[2] = 64; + } + } + else + { + item->itemFlags[0] = -item->itemFlags[0] >> 1; + } + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Trap/tr5_teethspike.h b/TR5Main/Objects/TR5/Trap/tr5_teethspike.h new file mode 100644 index 000000000..9afffead8 --- /dev/null +++ b/TR5Main/Objects/TR5/Trap/tr5_teethspike.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseTeethSpikes(short itemNumber); +void ControlTeethSpikes(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Trap/tr5_ventilator.cpp b/TR5Main/Objects/TR5/Trap/tr5_ventilator.cpp new file mode 100644 index 000000000..11abb9f48 --- /dev/null +++ b/TR5Main/Objects/TR5/Trap/tr5_ventilator.cpp @@ -0,0 +1,311 @@ +#include "framework.h" +#include "tr5_ventilator.h" +#include "draw.h" +#include "level.h" +#include "control.h" +#include "switch.h" +#include "lara.h" +#include "camera.h" +#include "effect2.h" + +static void VentilatorEffect(short* bounds, int intensity, short rot, int speed) +{ + int x, y, z; + + if (abs(intensity) == 1) + { + x = (bounds[0] + bounds[1]) >> 1; + if (intensity >= 0) + y = bounds[3]; + else + y = bounds[2]; + z = (bounds[4] + bounds[5]) >> 1; + } + else + { + y = (bounds[2] + bounds[3]) >> 1; + if (rot & 0x7FFF) + { + if (intensity >= 0) + z = bounds[5]; + else + z = bounds[4]; + x = (bounds[0] + bounds[1]) >> 1; + } + else + { + if (intensity >= 0) + x = bounds[1]; + else + x = bounds[0]; + z = (bounds[4] + bounds[5]) >> 1; + } + } + + if (abs(Camera.pos.x - x) <= 7168) + { + if (abs(Camera.pos.y - y) <= 7168) + { + if (abs(Camera.pos.z - z) <= 7168) + { + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = 0; + spark->sG = 0; + spark->sB = 0; + spark->dR = spark->dG = 48 * speed >> 7; + spark->colFadeSpeed = 4; + spark->fadeToBlack = 8; + spark->dB = speed * ((GetRandomControl() & 8) + 48) >> 7; + spark->transType = COLADD; + spark->life = spark->sLife = (GetRandomControl() & 3) + 20; + + if (abs(intensity) == 1) + { + int factor = 3 * (bounds[1] - bounds[0]) >> 3; + short angle = 2 * GetRandomControl(); + + spark->x = ((bounds[0] + bounds[1]) >> 1) + ((GetRandomControl() % factor) * phd_sin(angle) >> W2V_SHIFT); + spark->z = ((bounds[4] + bounds[5]) >> 1) + ((GetRandomControl() % factor) * phd_cos(angle) >> W2V_SHIFT); + + if (intensity >= 0) + spark->y = bounds[3]; + else + spark->y = bounds[2]; + + spark->zVel = 0; + spark->xVel = 0; + spark->yVel = 32 * intensity * ((GetRandomControl() & 0x1F) + 224); + } + else + { + int factor = 3 * (bounds[3] - bounds[2]) >> 3; + short angle = 2 * GetRandomControl(); + + spark->y = (bounds[2] + bounds[3]) >> 1; + + if (rot & 0x7FFF) + { + if (intensity >= 0) + spark->z = bounds[5]; + else + spark->z = bounds[4]; + + spark->x = ((bounds[0] + bounds[1]) >> 1) + ((GetRandomControl() % factor) * phd_cos(angle) >> W2V_SHIFT); + spark->y += (GetRandomControl() % factor) * phd_sin(angle) >> W2V_SHIFT; + spark->xVel = 0; + spark->zVel = 16 * intensity * ((GetRandomControl() & 0x1F) + 224); + } + else + { + if (intensity >= 0) + spark->x = bounds[1]; + else + spark->x = bounds[0]; + + spark->y += (GetRandomControl() % factor) * phd_sin(angle) >> W2V_SHIFT; + spark->z = ((bounds[4] + bounds[5]) >> 1) + ((GetRandomControl() % factor) * phd_cos(angle) >> W2V_SHIFT); + spark->zVel = 0; + spark->xVel = 16 * intensity * ((GetRandomControl() & 0x1F) + 224); + } + + spark->yVel = 0; + } + + spark->friction = 85; + spark->xVel = speed * spark->xVel >> 7; + spark->yVel = speed * spark->yVel >> 7; + spark->zVel = speed * spark->zVel >> 7; + spark->maxYvel = 0; + spark->gravity = 0; + spark->flags = SP_NONE; + } + } + } +} + +void InitialiseVentilator(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + item->itemFlags[0] = item->triggerFlags << WALL_SHIFT; + if (item->itemFlags[0] < 2048) + item->itemFlags[0] = 3072; +} + +void VentilatorControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + AnimateItem(item); + + int xChange = 0; + int zChange = 0; + + if (TriggerActive(item)) + { + xChange = 1; + } + else + { + xChange = 1; + TestTriggersAtXYZ(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 1, 0); + if (item->currentAnimState == 1) + { + //result = 5 * item->animNumber; + if (item->frameNumber == Anims[item->animNumber].frameEnd) + return; + } + else + { + item->goalAnimState = 1; + } + } + + int speed = 0; + if (item->currentAnimState == 1) + { + speed = Anims[item->animNumber].frameEnd - item->frameNumber; + } + else + { + speed = 128; + } + + short* bounds = GetBoundsAccurate(item); + short effectBounds[6]; + + effectBounds[2] = item->pos.yPos + bounds[2]; + effectBounds[3] = item->pos.yPos + bounds[3]; + + if (item->objectNumber != ID_PROPELLER_V) // TODO: check this ID + { + if (item->pos.yRot != -ANGLE(180.0f)) + { + if (item->pos.yRot == -ANGLE(90.0f)) + { + effectBounds[0] = item->pos.xPos - bounds[5]; + effectBounds[1] = item->pos.xPos - bounds[4]; + effectBounds[4] = item->pos.zPos + bounds[0]; + effectBounds[5] = item->pos.zPos + bounds[1]; + xChange = 0; + zChange = 1; + } + else + { + if (item->pos.yRot != ANGLE(90.0f)) + { + effectBounds[0] = item->pos.xPos + bounds[0]; + effectBounds[1] = item->pos.xPos + bounds[1]; + effectBounds[4] = item->pos.zPos + bounds[4]; + effectBounds[5] = item->pos.zPos + bounds[5]; + zChange = 0; + } + else + { + effectBounds[0] = item->pos.xPos + bounds[4]; + effectBounds[1] = item->pos.xPos + bounds[5]; + effectBounds[4] = item->pos.zPos - bounds[1]; + effectBounds[5] = item->pos.zPos - bounds[0]; + xChange = 0; + zChange = 1; + } + } + } + else + { + effectBounds[0] = item->pos.xPos - bounds[1]; + effectBounds[1] = item->pos.xPos - bounds[0]; + effectBounds[4] = item->pos.zPos - bounds[5]; + effectBounds[5] = item->pos.zPos - bounds[4]; + zChange = 0; + } + + VentilatorEffect(effectBounds, 2, item->pos.yRot, speed); + VentilatorEffect(effectBounds, -2, item->pos.yRot, speed); + + if (LaraItem->pos.yPos >= effectBounds[2] && LaraItem->pos.yPos <= effectBounds[3]) + { + if (zChange) + { + if (LaraItem->pos.xPos >= effectBounds[0] && LaraItem->pos.xPos <= effectBounds[1]) + { + int z1 = abs(LaraItem->pos.zPos - effectBounds[4]); + int z2 = abs(LaraItem->pos.zPos - effectBounds[5]); + + if (z2 >= z1) + zChange = -zChange; + else + z1 = z2; + + if (z1 < item->itemFlags[0]) + { + int dz = 96 * zChange * (item->itemFlags[0] - z1) / item->itemFlags[0]; + if (item->currentAnimState == 1) + dz = speed * dz / 120; + LaraItem->pos.zPos += dz; + } + } + } + else + { + if (LaraItem->pos.zPos >= effectBounds[4] && LaraItem->pos.zPos <= effectBounds[5]) + { + int x1 = abs(LaraItem->pos.xPos - effectBounds[0]); + int x2 = abs(LaraItem->pos.xPos - effectBounds[0]); + + if (x2 >= x1) + xChange = -xChange; + else + x1 = x2; + + if (x1 < item->itemFlags[0]) + { + int dx = 96 * xChange * (item->itemFlags[0] - x1) / item->itemFlags[0]; + if (item->currentAnimState == 1) + dx = speed * dx / 120; + LaraItem->pos.xPos += dx; + } + } + } + } + } + else + { + short tbounds[6]; + phd_RotBoundingBoxNoPersp(&item->pos, bounds, tbounds); + + effectBounds[0] = item->pos.xPos + tbounds[0]; + effectBounds[1] = item->pos.xPos + tbounds[1]; + effectBounds[4] = item->pos.zPos + tbounds[4]; + effectBounds[5] = item->pos.zPos + tbounds[5]; + + VentilatorEffect(effectBounds, 1, 0, speed); + VentilatorEffect(effectBounds, -1, 0, speed); + + if (LaraItem->pos.xPos >= effectBounds[0] && LaraItem->pos.xPos <= effectBounds[1]) + { + if (LaraItem->pos.zPos >= effectBounds[4] && LaraItem->pos.zPos <= effectBounds[5]) + { + int y = effectBounds[3]; + + if (LaraItem->pos.yPos <= effectBounds[3]) + { + if (effectBounds[2] - LaraItem->pos.yPos >= item->itemFlags[0]) + return; + y = 96 * (effectBounds[3] - item->itemFlags[0]) / item->itemFlags[0]; + } + else + { + if (LaraItem->pos.yPos - effectBounds[3] >= item->itemFlags[0]) + return; + y = 96 * (item->itemFlags[0] - (LaraItem->pos.yPos - effectBounds[3])) / item->itemFlags[0]; + } + if (item->currentAnimState == 1) + y = speed * y / 120; + LaraItem->pos.yPos += y; + } + } + } +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/Trap/tr5_ventilator.h b/TR5Main/Objects/TR5/Trap/tr5_ventilator.h new file mode 100644 index 000000000..4560b9625 --- /dev/null +++ b/TR5Main/Objects/TR5/Trap/tr5_ventilator.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseVentilator(short itemNumber); +void VentilatorControl(short itemNumber); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_objects.cpp b/TR5Main/Objects/TR5/tr5_objects.cpp new file mode 100644 index 000000000..3e49d474f --- /dev/null +++ b/TR5Main/Objects/TR5/tr5_objects.cpp @@ -0,0 +1,972 @@ +#include "framework.h" +#include "tr5_objects.h" +/// entities +#include "tr5_autoguns.h" // OK +#include "tr5_brownbeast.h" // OK +#include "tr5_chef.h" // OK +#include "tr5_cyborg.h" // OK +#include "tr5_doberman.h" // OK +#include "tr5_dog.h" // OK +#include "tr5_ghost.h" // OK +#include "tr5_gladiator.h" // OK +#include "tr5_guard.h" // OK +#include "tr5_gunship.h" // OK +#include "tr5_hydra.h" // OK +#include "tr5_imp.h" // OK +#include "tr5_lagoon_witch.h" // OK +#include "tr5_larson.h" // OK +#include "tr5_laser_head.h" // OK +#include "tr5_lion.h" // OK +#include "tr5_reaper.h" // OK +#include "tr5_roman_statue.h" // OK +#include "tr5_submarine.h" // OK +#include "tr5_willowwisp.h" // OK +/// emitter +#include "tr5_rats_emitter.h" +#include "tr5_bats_emitter.h" +#include "tr5_spider_emitter.h" +/// objects +#include "tr5_twoblockplatform.h" +#include "tr5_raisingcog.h" +/// traps +#include "tr5_teethspike.h" +/// switch +#include "tr5_cogswitch.h" +/// shatter +#include "tr5_smashobject.h" +/// necessary import +#include "collide.h" +#include "laramisc.h" +#include "lara1gun.h" +#include "laraflar.h" +#include "pickup.h" +#include "flmtorch.h" +#include "setup.h" +#include "objects.h" +#include "level.h" +/// register objects +#include "object_helper.h" + +static void StartBaddy(ObjectInfo* obj) +{ + obj = &Objects[ID_LARA]; + if (obj->loaded) + { + obj->initialise = InitialiseLaraLoad; + obj->shadowSize = 160; + obj->hitPoints = 1000; + obj->drawRoutine = nullptr; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + obj->usingDrawAnimatingItem = false; + } + else + { + printf("lara not found !"); + } + + obj = &Objects[ID_SAS]; + if (obj->loaded) + { + obj->initialise = InitialiseGuard; + obj->control = GuardControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 40; + obj->radius = 102; + obj->pivotLength = 50; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_SWAT]; + if (obj->loaded) + { + obj->biteOffset = 0; + obj->initialise = InitialiseGuard; + obj->collision = CreatureCollision; + obj->control = GuardControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 24; + obj->pivotLength = 50; + obj->radius = 102; + obj->explodableMeshbits = 0x4000; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_GUARD1]; + if (obj->loaded) + { + if (Objects[ID_SWAT].loaded) // object required + obj->animIndex = Objects[ID_SWAT].animIndex; + obj->biteOffset = 4; + obj->initialise = InitialiseGuard; + obj->collision = CreatureCollision; + obj->control = GuardControl; + obj->pivotLength = 50; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 24; + obj->radius = 102; + obj->explodableMeshbits = 0x4000; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_SWAT_PLUS]; + if (obj->loaded) + { + short animIndex; + if (!Objects[ID_SWAT].loaded) + animIndex = Objects[ID_GUARD1].animIndex; + else + animIndex = Objects[ID_SWAT].animIndex; + obj->animIndex = animIndex; + obj->biteOffset = 0; + obj->initialise = InitialiseGuard; + obj->collision = CreatureCollision; + obj->control = GuardControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 24; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_MAFIA]; + if (obj->loaded) + { + short animIndex; + if (!Objects[ID_SWAT].loaded) + animIndex = Objects[ID_GUARD1].animIndex; + else + animIndex = Objects[ID_SWAT].animIndex; + obj->animIndex = animIndex; + obj->biteOffset = 0; + obj->initialise = InitialiseGuard; + obj->collision = CreatureCollision; + obj->control = GuardControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 24; + obj->pivotLength = 50; + obj->radius = 102; + obj->explodableMeshbits = 0x4000; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_SCIENTIST]; + if (obj->loaded) + { + short animIndex; + if (!Objects[ID_SWAT].loaded) + animIndex = Objects[ID_GUARD1].animIndex; + else + animIndex = Objects[ID_SWAT].animIndex; + obj->animIndex = animIndex; + obj->initialise = InitialiseGuard; + obj->control = GuardControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 24; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + Bones[Objects[69].boneIndex + 6 * 4] |= ROT_Y; + Bones[Objects[69].boneIndex + 6 * 4] |= ROT_X; + Bones[Objects[69].boneIndex + 13 * 4] |= ROT_Y; + Bones[Objects[69].boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_GUARD2]; + if (obj->loaded) + { + short animIndex; + if (!Objects[ID_SWAT].loaded) + animIndex = Objects[ID_GUARD1].animIndex; + else + animIndex = Objects[ID_SWAT].animIndex; + obj->animIndex = animIndex; + obj->biteOffset = 4; + obj->initialise = InitialiseGuard; + obj->control = GuardControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 24; + obj->pivotLength = 50; + obj->radius = 102; + obj->explodableMeshbits = 0x4000; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_GUARD3]; + if (obj->loaded) + { + short animIndex; + if (!Objects[ID_SWAT].loaded) + animIndex = Objects[ID_GUARD1].animIndex; + else + animIndex = Objects[ID_SWAT].animIndex; + obj->animIndex = animIndex; + obj->biteOffset = 4; + obj->initialise = InitialiseGuard; + obj->control = GuardControl; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 24; + obj->pivotLength = 50; + obj->radius = 102; + obj->explodableMeshbits = 0x4000; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_ATTACK_SUB]; + if (obj->loaded) + { + obj->initialise = InitialiseSubmarine; + obj->collision = CreatureCollision; + obj->control = SubmarineControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 100; + obj->pivotLength = 200; + obj->radius = 512; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + obj->waterCreature = true; + obj->hitEffect = HIT_FRAGMENT; + obj->zoneType = ZONE_FLYER; + obj->undead = true; + Bones[obj->boneIndex] |= ROT_X; + Bones[obj->boneIndex + 4] |= ROT_X; + } + + obj = &Objects[ID_CHEF]; + if (obj->loaded) + { + obj->initialise = InitialiseChef; + obj->control = ControlChef; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 35; + obj->pivotLength = 50; + obj->radius = 102; + obj->biteOffset = 0; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + + Bones[obj->boneIndex + 4 * 6] |= ROT_Y; + Bones[obj->boneIndex + 4 * 6] |= ROT_X; + Bones[obj->boneIndex + 4 * 13] |= ROT_Y; + Bones[obj->boneIndex + 4 * 13] |= ROT_X; + } + + obj = &Objects[ID_LION]; + if (obj->loaded) + { + obj->initialise = InitialiseLion; + obj->collision = CreatureCollision; + obj->control = LionControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 40; + obj->pivotLength = 50; + obj->radius = 341; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 19 * 4] |= ROT_Y; + } + + obj = &Objects[ID_DOG]; + if (obj->loaded) + { + obj->initialise = InitialiseDoberman; + obj->collision = CreatureCollision; + obj->control = DobermanControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 18; + obj->pivotLength = 50; + obj->radius = 256; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 19 * 4] |= ROT_Y; + } + + obj = &Objects[ID_HUSKIE]; + if (obj->loaded) + { + obj->initialise = InitialiseTr5Dog; + obj->collision = CreatureCollision; + obj->control = Tr5DogControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 24; + obj->pivotLength = 50; + obj->radius = 256; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 19 * 4] |= ROT_Y; + } + + obj = &Objects[ID_REAPER]; + if (obj->loaded) + { + obj->initialise = InitialiseReaper; + obj->collision = CreatureCollision; + obj->control = ReaperControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 10; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + obj->hitEffect = HIT_BLOOD; + obj->waterCreature = true; + obj->zoneType = ZONE_FLYER; + } + + obj = &Objects[ID_MAFIA2]; + if (obj->loaded) + { + obj->biteOffset = 7; + obj->initialise = InitialiseMafia2; + obj->collision = CreatureCollision; + obj->control = Mafia2Control; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 26; + obj->pivotLength = 50; + obj->radius = 102; + obj->explodableMeshbits = 0x4000; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->zoneType = ZONE_HUMAN_CLASSIC; + obj->meshSwapSlot = ID_MESHSWAP_MAFIA2; + + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_PIERRE]; + if (obj->loaded) + { + obj->biteOffset = 1; + obj->initialise = InitialiseLarson; + obj->collision = CreatureCollision; + obj->control = LarsonControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 60; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 7 * 4] |= ROT_Y; + Bones[obj->boneIndex + 7 * 4] |= ROT_X; + } + + obj = &Objects[ID_LARSON]; + if (obj->loaded) + { + obj->biteOffset = 3; + obj->initialise = InitialiseLarson; + obj->collision = CreatureCollision; + obj->control = LarsonControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 60; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 7 * 4] |= ROT_Y; + Bones[obj->boneIndex + 7 * 4] |= ROT_X; + } + + obj = &Objects[ID_HITMAN]; + if (obj->loaded) + { + obj->biteOffset = 5; + obj->initialise = InitialiseHitman; + obj->collision = CreatureCollision; + obj->control = HitmanControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 50; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_FRAGMENT; + obj->undead = true; + obj->zoneType = ZONE_HUMAN_CLASSIC; + obj->meshSwapSlot = ID_MESHSWAP_HITMAN; + + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_SNIPER]; + if (obj->loaded) + { + obj->biteOffset = 6; + obj->initialise = InitialiseSniper; + obj->collision = CreatureCollision; + obj->control = SniperControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 35; + obj->pivotLength = 50; + obj->radius = 102; + obj->explodableMeshbits = 0x4000; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + obj = &Objects[ID_GUARD_LASER]; + if (obj->loaded) + { + obj->biteOffset = 0; + obj->initialise = InitialiseGuardLaser; + obj->collision = CreatureCollision; + //obj->control = GuardControlLaser; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 24; + obj->pivotLength = 50; + obj->radius = 128; + obj->explodableMeshbits = 4; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_FRAGMENT; + obj->undead = true; + Bones[obj->boneIndex] |= ROT_Y; + Bones[obj->boneIndex] |= ROT_X; + Bones[obj->boneIndex + 4] |= ROT_Y; + Bones[obj->boneIndex + 4] |= ROT_X; + } + + obj = &Objects[ID_HYDRA]; + if (obj->loaded) + { + obj->initialise = InitialiseHydra; + obj->collision = CreatureCollision; + obj->control = HydraControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 30; + obj->pivotLength = 50; + obj->radius = 102; + obj->biteOffset = 1024; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_FRAGMENT; + obj->undead = true; + Bones[obj->boneIndex + 0] |= ROT_Y; + Bones[obj->boneIndex + 8 * 4] |= ROT_Y; + Bones[obj->boneIndex + 8 * 4] |= ROT_X; + Bones[obj->boneIndex + 8 * 4] |= ROT_Z; + } + + obj = &Objects[ID_IMP]; + if (obj->loaded) + { + obj->biteOffset = 256; + obj->initialise = InitialiseImp; + obj->collision = CreatureCollision; + obj->control = ImpControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 12; + obj->pivotLength = 20; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + obj->meshSwapSlot = ID_MESHSWAP_IMP; + + Bones[obj->meshIndex + 4 * 4] |= ROT_Z; + Bones[obj->meshIndex + 4 * 4] |= ROT_X; + Bones[obj->meshIndex + 9 * 4] |= ROT_Z; + Bones[obj->meshIndex + 9 * 4] |= ROT_X; + } + + obj = &Objects[ID_WILLOWISP]; + if (obj->loaded) + { + obj->biteOffset = 256; + obj->initialise = InitialiseLightingGuide; + //obj->control = ControlLightingGuide; + obj->drawRoutine = NULL; + obj->shadowSize = UNIT_SHADOW / 2; + obj->radius = 256; + obj->hitPoints = 16; + obj->pivotLength = 20; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + obj->zoneType = ZONE_FLYER; + Bones[obj->boneIndex + 4 * 4] |= ROT_Z; + Bones[obj->boneIndex + 4 * 4] |= ROT_X; + Bones[obj->boneIndex + 9 * 4] |= ROT_Z; + Bones[obj->boneIndex + 9 * 4] |= ROT_X; + } + + obj = &Objects[ID_BROWN_BEAST]; + if (obj->loaded) + { + obj->biteOffset = 256; + obj->initialise = InitialiseBrownBeast; + obj->collision = CreatureCollision; + obj->control = ControlBrowsBeast; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 100; + obj->pivotLength = 20; + obj->radius = 341; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 4 * 4] |= ROT_Z; + Bones[obj->boneIndex + 4 * 4] |= ROT_X; + Bones[obj->boneIndex + 9 * 4] |= ROT_Z; + Bones[obj->boneIndex + 9 * 4] |= ROT_X; + } + + obj = &Objects[ID_LAGOON_WITCH]; + if (obj->loaded) + { + obj->biteOffset = 256; + obj->initialise = InitialiseLagoonWitch; + obj->collision = CreatureCollision; + obj->control = LagoonWitchControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 100; + obj->pivotLength = 20; + obj->radius = 256; + obj->intelligent = true; + obj->saveAnim = true; + obj->saveFlags = true; + obj->saveHitpoints = true; + obj->savePosition = true; + obj->waterCreature = true; + obj->zoneType = ZONE_FLYER; + + Bones[obj->boneIndex + 4 * 4] |= ROT_Z; + Bones[obj->boneIndex + 4 * 4] |= ROT_X; + Bones[obj->boneIndex + 9 * 4] |= ROT_Z; + Bones[obj->boneIndex + 9 * 4] |= ROT_X; + } + + obj = &Objects[ID_INVISIBLE_GHOST]; + if (obj->loaded) + { + obj->biteOffset = 256; + obj->initialise = InitialiseInvisibleGhost; + obj->collision = CreatureCollision; + obj->control = InvisibleGhostControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 100; + obj->pivotLength = 20; + obj->radius = 256; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 8 * 4] |= ROT_Y; + Bones[obj->boneIndex + 8 * 4] |= ROT_X; + } + + obj = &Objects[ID_RATS_EMITTER]; + if (obj->loaded) + { + obj->drawRoutine = NULL; + obj->initialise = InitialiseLittleRats; + obj->control = LittleRatsControl; + obj->usingDrawAnimatingItem = false; + } + + obj = &Objects[ID_BATS_EMITTER]; + if (obj->loaded) + { + obj->drawRoutine = NULL; + obj->initialise = InitialiseLittleBats; + obj->control = LittleBatsControl; + obj->usingDrawAnimatingItem = false; + } + + obj = &Objects[ID_SPIDERS_EMITTER]; + if (obj->loaded) + { + obj->drawRoutine = NULL; + obj->initialise = InitialiseSpiders; + obj->control = SpidersEmitterControl; + obj->usingDrawAnimatingItem = false; + } + + obj = &Objects[ID_GLADIATOR]; + if (obj->loaded) + { + obj->biteOffset = 0; + obj->initialise = InitialiseGladiator; + obj->control = ControlGladiator; + obj->collision = CreatureCollision; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 20; + obj->pivotLength = 50; + obj->radius = 102; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 13 * 4] |= ROT_Y; + Bones[obj->boneIndex + 13 * 4] |= ROT_X; + } + + for (int i = 0; i < 2; i++) + { + obj = &Objects[ID_ROMAN_GOD1 + i]; + if (obj->loaded) + { + obj->biteOffset = 0; + obj->initialise = InitialiseRomanStatue; + obj->collision = CreatureCollision; + obj->control = RomanStatueControl; + obj->shadowSize = UNIT_SHADOW / 2; + obj->hitPoints = 300; + obj->pivotLength = 50; + obj->radius = 256; + obj->intelligent = true; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveHitpoints = true; + obj->hitEffect = HIT_SMOKE; + obj->meshSwapSlot = ID_MESHSWAP_ROMAN_GOD1 + i; + + Bones[obj->boneIndex + 24] |= ROT_Y; + Bones[obj->boneIndex + 24] |= ROT_X; + Bones[obj->boneIndex + 52] |= ROT_Y; + Bones[obj->boneIndex + 52] |= ROT_X; + } + } + + obj = &Objects[ID_LASERHEAD]; + if (obj->loaded) + { + obj->initialise = InitialiseLaserHead; + obj->collision = CreatureCollision; + obj->control = LaserHeadControl; + obj->explodableMeshbits = 6; + obj->nonLot = true; + obj->savePosition = true; + obj->saveHitpoints = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->usingDrawAnimatingItem = false; + obj->undead = true; + obj->hitEffect = HIT_FRAGMENT; + obj->saveMesh = true; + } + + obj = &Objects[ID_AUTOGUN]; + if (obj->loaded) + { + obj->initialise = InitialiseAutoGuns; + obj->control = AutoGunsControl; + obj->saveHitpoints = true; + obj->saveFlags = true; + obj->saveAnim = true; + obj->hitEffect = HIT_BLOOD; + Bones[obj->boneIndex + 6 * 4] |= ROT_Y; + Bones[obj->boneIndex + 6 * 4] |= ROT_X; + Bones[obj->boneIndex + 8 * 4] |= ROT_Y; + } + + obj = &Objects[ID_GUNSHIP]; + if (obj->loaded) + { + obj->control = ControlGunShip; + obj->saveFlags = true; + obj->saveAnim = true; + Bones[obj->boneIndex + 0] |= ROT_Y; + Bones[obj->boneIndex + 4] |= ROT_X; + } +} + +static void StartObject(ObjectInfo* obj) +{ + InitPickupItem(obj, FlareControl, ID_FLARE_ITEM); + InitPickupItem(obj, TorchControl, ID_BURNING_TORCH_ITEM, true); + + for (int objNumber = ID_SEARCH_OBJECT1; objNumber <= ID_SEARCH_OBJECT4; objNumber++) + InitSearchObject(obj, objNumber); + + for (int objNumber = ID_PUSHABLE_OBJECT1; objNumber <= ID_PUSHABLE_OBJECT10; objNumber++) + InitPushableObject(obj, objNumber); + + obj = &Objects[ID_TWOBLOCK_PLATFORM]; + if (obj->loaded) + { + obj->initialise = InitialiseTwoBlocksPlatform; + obj->control = TwoBlocksPlatformControl; + obj->floor = TwoBlocksPlatformFloor; + obj->ceiling = TwoBlocksPlatformCeiling; + obj->saveFlags = true; + obj->savePosition = true; + obj->saveAnim = true; + } +} + +static void StartTrap(ObjectInfo* obj) +{ + +} + +static void StartSwitch(ObjectInfo* obj) +{ + obj = &Objects[ID_COG_SWITCH]; + if (obj->loaded) + { + obj->collision = CogSwitchCollision; + obj->control = CogSwitchControl; + obj->saveFlags = true; + obj->saveAnim = true; + } + + obj = &Objects[ID_RAISING_COG]; + if (obj->loaded) + { + obj->initialise = InitialiseRaisingCog; + obj->control = RaisingCogControl; + obj->saveFlags = true; + obj->savePosition = true; + obj->saveAnim = true; + } +} + +static void StartShatter(ObjectInfo* obj) +{ + for (int i = ID_SMASH_OBJECT1; i <= ID_SMASH_OBJECT16; i++) + InitSmashObject(obj, i); +} + +static void StartProjectiles(ObjectInfo* obj) +{ + InitProjectile(obj, TorpedoControl, ID_TORPEDO); + InitProjectile(obj, ControlGrenade, ID_GRENADE); + InitProjectile(obj, ControlHarpoonBolt, ID_HARPOON); + InitProjectile(obj, ControlCrossbowBolt, ID_CROSSBOW_BOLT); +} + +static void StartPickup(ObjectInfo* obj) +{ + for (int objNumber = ID_PUZZLE_ITEM1; objNumber <= ID_EXAMINE8_COMBO2; objNumber++) + { + InitPickup(obj, objNumber); + } + + InitPickup(obj, ID_GAME_PIECE1); + InitPickup(obj, ID_GAME_PIECE2); + InitPickup(obj, ID_GAME_PIECE3); + InitPickup(obj, ID_HAMMER_ITEM); + InitPickup(obj, ID_CROWBAR_ITEM); + InitPickup(obj, ID_PISTOLS_ITEM); + InitPickup(obj, ID_PISTOLS_AMMO_ITEM); + InitPickup(obj, ID_UZI_ITEM); + InitPickup(obj, ID_UZI_AMMO_ITEM); + InitPickup(obj, ID_SHOTGUN_ITEM); + InitPickup(obj, ID_SHOTGUN_AMMO1_ITEM); + InitPickup(obj, ID_SHOTGUN_AMMO2_ITEM); + InitPickup(obj, ID_CROSSBOW_ITEM); + InitPickup(obj, ID_CROSSBOW_AMMO1_ITEM); + InitPickup(obj, ID_CROSSBOW_AMMO2_ITEM); + InitPickup(obj, ID_CROSSBOW_AMMO3_ITEM); + InitPickup(obj, ID_GRENADE_GUN_ITEM); + InitPickup(obj, ID_GRENADE_AMMO1_ITEM); + InitPickup(obj, ID_GRENADE_AMMO2_ITEM); + InitPickup(obj, ID_GRENADE_AMMO3_ITEM); + InitPickup(obj, ID_HARPOON_ITEM); + InitPickup(obj, ID_HARPOON_AMMO_ITEM); + InitPickup(obj, ID_ROCKET_LAUNCHER_ITEM); + InitPickup(obj, ID_ROCKET_LAUNCHER_AMMO_ITEM); + InitPickup(obj, ID_HK_ITEM); + InitPickup(obj, ID_HK_AMMO_ITEM); + InitPickup(obj, ID_REVOLVER_ITEM); + InitPickup(obj, ID_REVOLVER_AMMO_ITEM); + InitPickup(obj, ID_BIGMEDI_ITEM); + InitPickup(obj, ID_SMALLMEDI_ITEM); + InitPickup(obj, ID_LASERSIGHT_ITEM); + InitPickup(obj, ID_BINOCULARS_ITEM); + InitPickup(obj, ID_SILENCER_ITEM); + InitPickup(obj, ID_FLARE_INV_ITEM); + InitPickup(obj, ID_WATERSKIN1_EMPTY); + InitPickup(obj, ID_WATERSKIN2_EMPTY); + InitPickup(obj, ID_CLOCKWORK_BEETLE); + InitPickup(obj, ID_CLOCKWORK_BEETLE_COMBO1); + InitPickup(obj, ID_CLOCKWORK_BEETLE_COMBO2); + InitPickup(obj, ID_GOLDROSE_ITEM); +} + +static ObjectInfo* objToInit; +void InitialiseTR5Objects() +{ + StartBaddy(objToInit); + StartObject(objToInit); + StartTrap(objToInit); + StartPickup(objToInit); + StartSwitch(objToInit); + StartShatter(objToInit); + StartProjectiles(objToInit); +} + +void AllocTR5Objects() +{ + if (Objects[ID_BATS_EMITTER].loaded) + Bats = (BAT_STRUCT*)game_malloc(NUM_BATS * sizeof(BAT_STRUCT)); + + if (Objects[ID_SPIDERS_EMITTER].loaded) + Spiders = (SPIDER_STRUCT*)game_malloc(NUM_SPIDERS * sizeof(SPIDER_STRUCT)); + + if (Objects[ID_RATS_EMITTER].loaded) + Rats = (RAT_STRUCT*)game_malloc(NUM_RATS * sizeof(RAT_STRUCT)); +} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_objects.h b/TR5Main/Objects/TR5/tr5_objects.h new file mode 100644 index 000000000..b0367a79d --- /dev/null +++ b/TR5Main/Objects/TR5/tr5_objects.h @@ -0,0 +1,4 @@ +#pragma once + +void InitialiseTR5Objects(); +void AllocTR5Objects(); \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_particle_enemies.cpp b/TR5Main/Objects/TR5/tr5_particle_enemies.cpp deleted file mode 100644 index d4c6209a1..000000000 --- a/TR5Main/Objects/TR5/tr5_particle_enemies.cpp +++ /dev/null @@ -1,776 +0,0 @@ -#include "../oldobjects.h" -#include "../../Game/sphere.h" -#include "../../Game/items.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/effect2.h" -#include "../../Game/Box.h" -#include "../../Game/people.h" -#include "../../Game/debris.h" -#include "../../Game/draw.h" -#include "../../Game/control.h" -#include "../../Game/effects.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/lara.h" -#include "../../Game/sound.h" - -int NextBat; -BAT_STRUCT* Bats; - -int NextSpider; -SPIDER_STRUCT* Spiders; - -int NextRat; -RAT_STRUCT* Rats; - -void InitialiseLittleBats(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (item->pos.yRot == 0) - { - item->pos.zPos += 512; - } - else if (item->pos.yRot == -ANGLE(180)) - { - item->pos.zPos -= 512; - } - else if (item->pos.yRot == -ANGLE(90)) - { - item->pos.xPos -= 512; - } - else if (item->pos.yRot == ANGLE(90)) - { - item->pos.xPos += 512; - } - - if (Objects[ID_BATS_EMITTER].loaded) - ZeroMemory(Bats, NUM_BATS * sizeof(BAT_STRUCT)); - - //LOWORD(item) = sub_402F27(ebx0, Bats, 0, 1920); -} - -void ControlLittleBats(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (TriggerActive(item)) - { - if (item->triggerFlags) - { - TriggerLittleBat(item); - item->triggerFlags--; - } - else - { - KillItem(itemNumber); - } - } -} - -short GetNextBat() -{ - short batNumber = NextBat; - int index = 0; - BAT_STRUCT* bat = &Bats[NextBat]; - - while (bat->on) - { - if (batNumber == NUM_BATS - 1) - { - bat = (BAT_STRUCT*)Bats; - batNumber = 0; - } - else - { - batNumber++; - bat++; - } - - index++; - - if (index >= NUM_BATS) - return NO_ITEM; - } - - NextBat = (batNumber + 1) & (NUM_BATS - 1); - - return batNumber; -} - -void TriggerLittleBat(ITEM_INFO* item) -{ - short batNumber = GetNextBat(); - - if (batNumber != NO_ITEM) - { - BAT_STRUCT* bat = &Bats[batNumber]; - - bat->roomNumber = item->roomNumber; - bat->pos.xPos = item->pos.xPos; - bat->pos.yPos = item->pos.yPos; - bat->pos.zPos = item->pos.zPos; - bat->pos.yRot = (GetRandomControl() & 0x7FF) + item->pos.yRot + -ANGLE(180) - 1024; - bat->on = 1; - bat->flags = 0; - bat->pos.xRot = (GetRandomControl() & 0x3FF) - 512; - bat->speed = (GetRandomControl() & 0x1F) + 16; - bat->laraTarget = GetRandomControl() & 0x1FF; - bat->counter = 20 * ((GetRandomControl() & 7) + 15); - } -} - -short GetNextSpider() -{ - short spiderNum = NextSpider; - int i = 0; - SPIDER_STRUCT* spider = &Spiders[NextSpider]; - - while (spider->on) - { - if (spiderNum == NUM_SPIDERS - 1) - { - spider = &Spiders[0]; - spiderNum = 0; - } - else - { - ++spiderNum; - ++spider; - } - - if (++i >= NUM_SPIDERS) - return -1; - } - - NextSpider = (spiderNum + 1) & 0x3F; - - return spiderNum; -} - -void ClearSpiders() -{ - if (Objects[ID_SPIDERS_EMITTER].loaded) - { - ZeroMemory(Spiders, NUM_SPIDERS * sizeof(SPIDER_STRUCT)); - NextSpider = 0; - FlipEffect = -1; - } -} - -void ClearSpidersPatch(ITEM_INFO* item) -{ - ClearSpiders(); -} - -void InitialiseSpiders(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - short flags = item->triggerFlags / -24; - - item->pos.xRot = ANGLE(45); - item->itemFlags[1] = flags & 2; - item->itemFlags[2] = flags & 4; - item->itemFlags[0] = flags & 1; - item->triggerFlags = flags % 1000; - - if (flags & 1) - { - ClearSpiders(); - return; - } - - if (item->pos.yRot > -28672 && item->pos.yRot < -4096) - { - item->pos.xPos += 512; - } - else if(item->pos.yRot > 4096 && item->pos.yRot < 28672) - { - item->pos.xPos -= 512; - } - - if (item->pos.yRot > -8192 && item->pos.yRot < 8192) - { - item->pos.zPos -= 512; - } - else if (item->pos.yRot < -20480 || item->pos.yRot > 20480) - { - item->pos.zPos += 512; - } - - ClearSpiders(); -} - -void ControlSpiders(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (item->triggerFlags) - { - if (!item->itemFlags[2] || !(GetRandomControl() & 0xF)) - { - item->triggerFlags--; - - if (item->itemFlags[2] && GetRandomControl() & 1) - item->itemFlags[2]--; - - short spiderNum = GetNextSpider(); - if (spiderNum != -1) - { - SPIDER_STRUCT* spider = &Spiders[spiderNum]; - - spider->pos.xPos = item->pos.xPos; - spider->pos.yPos = item->pos.yPos; - spider->pos.zPos = item->pos.zPos; - spider->roomNumber = item->roomNumber; - - if (item->itemFlags[0]) - { - spider->pos.yRot = 2 * GetRandomControl(); - spider->fallspeed = -16 - (GetRandomControl() & 0x1F); - } - else - { - spider->fallspeed = 0; - spider->pos.yRot = item->pos.yRot + (GetRandomControl() & 0x3FFF) - ANGLE(45); - } - - spider->pos.xRot = 0; - spider->pos.zRot = 0; - spider->on = true; - spider->flags = 0; - spider->speed = (GetRandomControl() & 0x1F) + 1; - } - } - } -} - -short GetNextRat() -{ - short ratNum = NextRat; - int i = 0; - RAT_STRUCT* rat = &Rats[NextRat]; - - while (rat->on) - { - if (ratNum == NUM_RATS - 1) - { - rat = &Rats[0]; - ratNum = 0; - } - else - { - ratNum++; - rat++; - } - - i++; - - if (i >= NUM_RATS) - return NO_ITEM; - } - - NextRat = (ratNum + 1) & 0x1F; - return ratNum; -} - -void ControlLittleRats(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (item->triggerFlags) - { - if (!item->itemFlags[2] || !(GetRandomControl() & 0xF)) - { - item->triggerFlags--; - - if (item->itemFlags[2] && GetRandomControl() & 1) - item->itemFlags[2]--; - - short ratNum = GetNextRat(); - if (ratNum != -1) - { - RAT_STRUCT* rat = &Rats[ratNum]; - - rat->pos.xPos = item->pos.xPos; - rat->pos.yPos = item->pos.yPos; - rat->pos.zPos = item->pos.zPos; - rat->roomNumber = item->roomNumber; - - if (item->itemFlags[0]) - { - rat->pos.yRot = 2 * GetRandomControl(); - rat->fallspeed = -16 - (GetRandomControl() & 31); - } - else - { - rat->fallspeed = 0; - rat->pos.yRot = item->pos.yRot + (GetRandomControl() & 0x3FFF) - ANGLE(45); - } - - rat->pos.xRot = 0; - rat->pos.zRot = 0; - rat->on = 1; - rat->flags = GetRandomControl() & 30; - rat->speed = (GetRandomControl() & 31) + 1; - } - } - } -} - -void ClearRats() -{ - if (Objects[ID_RATS_EMITTER].loaded) - { - ZeroMemory(Rats, NUM_RATS * sizeof(RAT_STRUCT)); - NextRat = 0; - FlipEffect = -1; - } -} - -void InitialiseLittleRats(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - char flags = item->triggerFlags / 1000; - - item->pos.xRot = ANGLE(45); - item->itemFlags[1] = flags & 2; - item->itemFlags[2] = flags & 4; - item->itemFlags[0] = flags & 1; - item->triggerFlags = item->triggerFlags % 1000; - - if (flags & 1) - { - ClearRats(); - return; - } - - if (item->pos.yRot > -28672 && item->pos.yRot < -4096) - { - item->pos.xPos += 512; - } - else if (item->pos.yRot > 4096 && item->pos.yRot < 28672) - { - item->pos.xPos -= 512; - } - - if (item->pos.yRot > -8192 && item->pos.yRot < 8192) - { - item->pos.zPos -= 512; - } - else if (item->pos.yRot < -20480 || item->pos.yRot > 20480) - { - item->pos.zPos += 512; - } - - ClearRats(); -} - -void UpdateBats() -{ - if (!Objects[ID_BATS_EMITTER].loaded) - return; - - short* bounds = GetBoundsAccurate(LaraItem); - - int x1 = LaraItem->pos.xPos + bounds[0] - (bounds[0] >> 2); - int x2 = LaraItem->pos.xPos + bounds[1] - (bounds[1] >> 2); - - int y1 = LaraItem->pos.yPos + bounds[2] - (bounds[2] >> 2); - int y2 = LaraItem->pos.yPos + bounds[3] - (bounds[3] >> 2); - - int z1 = LaraItem->pos.zPos + bounds[4] - (bounds[4] >> 2); - int z2 = LaraItem->pos.zPos + bounds[5] - (bounds[5] >> 2); - - int minDistance = 0xFFFFFFF; - int minIndex = -1; - - for (int i = 0; i < NUM_BATS; i++) - { - BAT_STRUCT* bat = &Bats[i]; - - if (!bat->on) - continue; - - if ((Lara.burn || LaraItem->hitPoints <= 0) - && bat->counter > 90 - && !(GetRandomControl() & 7)) - bat->counter = 90; - - if (!(--bat->counter)) - { - bat->on = 0; - continue; - } - - if (!(GetRandomControl() & 7)) - { - bat->laraTarget = GetRandomControl() % 640 + 128; - bat->xTarget = (GetRandomControl() & 0x7F) - 64; - bat->zTarget = (GetRandomControl() & 0x7F) - 64; - } - - short angles[2]; - phd_GetVectorAngles( - LaraItem->pos.xPos + 8 * bat->xTarget - bat->pos.xPos, - LaraItem->pos.yPos - bat->laraTarget - bat->pos.yPos, - LaraItem->pos.zPos + 8 * bat->zTarget - bat->pos.zPos, - angles); - - int distance = SQUARE(LaraItem->pos.zPos - bat->pos.zPos) + - SQUARE(LaraItem->pos.xPos - bat->pos.xPos); - if (distance < minDistance) - { - minDistance = distance; - minIndex = i; - } - - distance = sqrt(distance) / 8; - if (distance < 48) - distance = 48; - else if (distance > 128) - distance = 128; - - if (bat->speed < distance) - bat->speed++; - else if (bat->speed > distance) - bat->speed--; - - if (bat->counter > 90) - { - short speed = bat->speed << 7; - - short xAngle = abs(angles[1] - bat->pos.xRot) >> 3; - short yAngle = abs(angles[0] - bat->pos.yRot) >> 3; - - if (xAngle < -speed) - xAngle = -speed; - else if (xAngle > speed) - xAngle = speed; - - if (yAngle < -speed) - yAngle = -speed; - else if (yAngle > speed) - yAngle = speed; - - bat->pos.yRot += yAngle; - bat->pos.xRot += xAngle; - } - - int sp = bat->speed * phd_cos(bat->pos.xRot) >> W2V_SHIFT; - - bat->pos.xPos += sp * phd_sin(bat->pos.yRot) >> W2V_SHIFT; - bat->pos.yPos += bat->speed * phd_sin(-bat->pos.xRot) >> W2V_SHIFT; - bat->pos.zPos += sp * phd_cos(bat->pos.yRot) >> W2V_SHIFT; - - if ((i % 2 == 0) - && bat->pos.xPos > x1 - && bat->pos.xPos < x2 - && bat->pos.yPos > y1 - && bat->pos.yPos < y2 - && bat->pos.zPos > z1 - && bat->pos.zPos < z2) - { - TriggerBlood(bat->pos.xPos, bat->pos.yPos, bat->pos.zPos, 2 * GetRandomControl(), 2); - if (LaraItem->hitPoints > 0) - LaraItem->hitPoints -= 2; - } - } - - if (minIndex != -1) - { - BAT_STRUCT* bat = &Bats[minIndex]; - if (!(GetRandomControl() & 4)) - SoundEffect(SFX_BATS_1, &bat->pos, 0); - } -} - - -void UpdateRats() -{ - if (Objects[ID_RATS_EMITTER].loaded) - { - for (int i = 0; i < NUM_RATS; i++) - { - RAT_STRUCT* rat = &Rats[i]; - - if (rat->on) - { - int oldX = rat->pos.xPos; - int oldY = rat->pos.yPos; - int oldZ = rat->pos.zPos; - - rat->pos.xPos += rat->speed * phd_sin(rat->pos.yRot) >> W2V_SHIFT; - rat->pos.yPos += rat->fallspeed; - rat->pos.zPos += rat->speed * phd_cos(rat->pos.yRot) >> W2V_SHIFT; - - rat->fallspeed += GRAVITY; - - int dx = LaraItem->pos.xPos - rat->pos.xPos; - int dy = LaraItem->pos.yPos - rat->pos.yPos; - int dz = LaraItem->pos.zPos - rat->pos.zPos; - - short angle; - if (rat->flags >= 170) - angle = rat->pos.yRot - (short)phd_atan(dz, dx); - else - angle = (short)phd_atan(dz, dx) - rat->pos.yRot; - - if (abs(dx) < 85 && abs(dy) < 85 && abs(dz) < 85) - { - LaraItem->hitPoints--; - LaraItem->hitStatus = true; - } - - // if life is even - if (rat->flags & 1) - { - // if rat is very near - if (abs(dz) + abs(dx) <= 1024) - { - if (rat->speed & 1) - rat->pos.yRot += 512; - else - rat->pos.yRot -= 512; - rat->speed = 48 - (abs(angle) >> 10); - } - else - { - if (rat->speed < (i & 31) + 24) - rat->speed++; - - if (abs(angle) >= 2048) - { - if (angle >= 0) - rat->pos.yRot += 1024; - else - rat->pos.yRot -= 1024; - } - else - { - rat->pos.yRot += 8 * (Wibble - i); - } - } - } - - __int16 oldRoomNumber = rat->roomNumber; - - FLOOR_INFO* floor = GetFloor(rat->pos.xPos, rat->pos.yPos, rat->pos.zPos, &rat->roomNumber); - int height = GetFloorHeight(floor, rat->pos.xPos, rat->pos.yPos, rat->pos.zPos); - - // if height is higher than 5 clicks - if (height < rat->pos.yPos - 1280 || - height == NO_HEIGHT) - { - // if timer is higher than 170 time to disappear - if (rat->flags > 170) - { - rat->on = 0; - NextRat = 0; - } - - if (angle <= 0) - rat->pos.yRot -= ANGLE(90); - else - rat->pos.yRot += ANGLE(90); - - // reset rat to old position and disable fall - rat->pos.xPos = oldX; - rat->pos.yPos = oldY; - rat->pos.zPos = oldZ; - rat->fallspeed = 0; - } - else - { - // if height is lower than Y + 64 - if (height >= rat->pos.yPos - 64) - { - // if rat is higher than floor - if (height >= rat->pos.yPos) - { - // if fallspeed is too much or life is ended then kill rat - if (rat->fallspeed >= 500 || - rat->flags >= 200) - { - rat->on = 0; - NextRat = 0; - } - else - { - rat->pos.xRot = -128 * rat->fallspeed; - } - } - else - { - rat->pos.yPos = height; - rat->fallspeed = 0; - rat->flags |= 1; - } - } - else - { - // if block is higher than rat position then run vertically - rat->pos.xRot = 14336; - rat->pos.xPos = oldX; - rat->pos.yPos = oldY - 24; - rat->pos.zPos = oldZ; - rat->fallspeed = 0; - } - } - - if (!(Wibble & 60)) - rat->flags += 2; - - ROOM_INFO* r = &Rooms[rat->roomNumber]; - if (r->flags & ENV_FLAG_WATER) - { - rat->fallspeed = 0; - rat->speed = 16; - rat->pos.yPos = r->maxceiling + 50; - - if (Rooms[oldRoomNumber].flags & ENV_FLAG_WATER) - { - if (!(GetRandomControl() & 0xF)) - { - SetupRipple(rat->pos.xPos, r->maxceiling, rat->pos.zPos, (GetRandomControl() & 3) + 48, 2); - } - } - else - { - AddWaterSparks(rat->pos.xPos, r->maxceiling, rat->pos.zPos, 16); - SetupRipple(rat->pos.xPos, r->maxceiling, rat->pos.zPos, (GetRandomControl() & 3) + 48, 2); - SoundEffect(SFX_RATSPLASH, &rat->pos, 0); - } - } - - if (!i && !(GetRandomControl() & 4)) - SoundEffect(SFX_RATS_1, &rat->pos, 0); - } - } - } -} - -void UpdateSpiders() -{ - if (Objects[ID_SPIDERS_EMITTER].loaded) - { - for (int i = 0; i < NUM_SPIDERS; i++) - { - SPIDER_STRUCT* spider = &Spiders[i]; - if (spider->on) - { - int x = spider->pos.xPos; - int y = spider->pos.yPos; - int z = spider->pos.zPos; - - spider->pos.xPos += spider->speed * phd_sin(spider->pos.yRot) >> W2V_SHIFT; - spider->pos.yPos += spider->fallspeed; - spider->pos.zPos += spider->speed * phd_cos(spider->pos.yRot) >> W2V_SHIFT; - spider->fallspeed += GRAVITY; - - int dx = LaraItem->pos.xPos - spider->pos.xPos; - int dy = LaraItem->pos.yPos - spider->pos.yPos; - int dz = LaraItem->pos.zPos - spider->pos.zPos; - - short angle = phd_atan(dz, dx) - spider->pos.yRot; - - if (abs(dx) < 85 && abs(dy) < 85 && abs(dz) < 85) - { - LaraItem->hitPoints -= 3; - LaraItem->hitStatus = true; - TriggerBlood(spider->pos.xPos, spider->pos.yPos, spider->pos.zPos, spider->pos.yRot, 1); - } - - if (spider->flags) - { - if (abs(dx) + abs(dz) <= 768) - { - if (spider->speed & 1) - spider->pos.yRot += 512; - else - spider->pos.yRot -= 512; - spider->speed = 48 - (abs(angle) >> 10); - } - else - { - if (spider->speed < (i & 0x1F) + 24) - spider->speed++; - - if (abs(angle) >= 2048) - { - if (angle >= 0) - spider->pos.yRot += 1024; - else - spider->pos.yRot -= 1024; - } - else - { - spider->pos.yRot += 8 * (Wibble - i); - } - } - } - - FLOOR_INFO* floor = GetFloor(spider->pos.xPos, spider->pos.yPos, spider->pos.zPos, &spider->roomNumber); - int height = GetFloorHeight(floor, spider->pos.xPos, spider->pos.yPos, spider->pos.zPos); - - if (height >= spider->pos.yPos - 1280 || height == -32512) - { - if (height >= spider->pos.yPos - 64) - { - if (spider->pos.yPos <= height) - { - if (spider->fallspeed >= 500) - { - spider->on = false; - NextSpider = 0; - } - else - { - spider->pos.xRot = -128 * spider->fallspeed; - } - } - else - { - spider->pos.yPos = height; - spider->fallspeed = 0; - spider->flags = 1; - } - } - else - { - spider->pos.xRot = 14336; - spider->pos.xPos = x; - spider->pos.yPos = y - 8; - spider->pos.zPos = z; - spider->fallspeed = 0; - if (!(GetRandomControl() & 0x1F)) - spider->pos.yRot += -ANGLE(180); - } - } - else - { - if (angle <= 0) - spider->pos.yRot -= ANGLE(90); - else - spider->pos.yRot += ANGLE(90); - spider->pos.xPos = x; - spider->pos.yPos = y; - spider->pos.zPos = z; - spider->fallspeed = 0; - } - - if (spider->pos.yPos < Rooms[spider->roomNumber].maxceiling + 50) - { - spider->fallspeed = 1; - spider->pos.yRot += -32768; - spider->pos.yPos = Rooms[spider->roomNumber].maxceiling + 50; - } - - if (!i && !(GetRandomControl() & 4)) - SoundEffect(SFX_BEETLES, &spider->pos, 0); - } - } - } -} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_rats.cpp b/TR5Main/Objects/TR5/tr5_rats.cpp deleted file mode 100644 index 78069f4cc..000000000 --- a/TR5Main/Objects/TR5/tr5_rats.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "..\newobjects.h" - diff --git a/TR5Main/Objects/TR5/tr5_traps.cpp b/TR5Main/Objects/TR5/tr5_traps.cpp deleted file mode 100644 index 77c3386fd..000000000 --- a/TR5Main/Objects/TR5/tr5_traps.cpp +++ /dev/null @@ -1,1432 +0,0 @@ -#include "../newobjects.h" -#include "../oldobjects.h" -#include "../../Game/lara.h" -#include "../../Game/draw.h" -#include "../../Global/global.h" -#include "../../Game/items.h" -#include "../../Game/collide.h" -#include "../../Game/effects.h" -#include "../../Game/laramisc.h" -#include "../../Game/Box.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/switch.h" -#include "../../Game/spotcam.h" -#include "../../Game/effect2.h" -#include "../../Game/sphere.h" -#include "../../Game/traps.h" -#include "../../Game/camera.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Game/sound.h" - -short SPyoffs[8] = -{ - 0xFC00, 0x0000, 0xFE00, 0x0000, 0x0000, 0x0000, 0xFE00, 0x0000 -}; - -short SPxzoffs[8] = -{ - 0x0000, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, 0xFE00, 0x0000 -}; - -short SPDETyoffs[8] = -{ - 0x0400, 0x0200, 0x0200, 0x0200, 0x0000, 0x0200, 0x0200, 0x0200 -}; - -void InitialiseTeethSpikes(short itemNumber) -{ - short rotations[] = { -ANGLE(180), -ANGLE(135), -ANGLE(90), -ANGLE(45), ANGLE(0), ANGLE(45), ANGLE(90), ANGLE(135) }; - - ITEM_INFO* item = &Items[itemNumber]; - - item->status = ITEM_INVISIBLE; - - int angle; - if (item->triggerFlags & 8) - { - angle = item->triggerFlags & 7; - item->pos.xRot = rotations[angle]; - item->pos.yRot = ANGLE(90); - item->pos.zPos -= SPxzoffs[angle]; - } - else - { - angle = item->triggerFlags & 7; - item->pos.zRot = rotations[angle]; - item->pos.xPos += SPxzoffs[angle]; - } - - item->itemFlags[0] = 1024; - item->itemFlags[2] = 0; - item->pos.yPos += SPyoffs[angle]; -} - -int CollidedWithTeethSpikes(ITEM_INFO* item) -{ - short angle; - int x; - int z; - - if (item->triggerFlags & 8) - { - angle = item->triggerFlags & 7; - x = item->pos.xPos & 0xFFFFFE00 | 0x200; - z = (item->pos.zPos + SPxzoffs[angle]) & 0xFFFFFE00 | 0x200; - } - else - { - angle = item->triggerFlags & 7; - x = (item->pos.xPos - SPxzoffs[angle]) & 0xFFFFFE00 | 0x200; - z = item->pos.zPos & 0xFFFFFE00 | 0x200; - } - - int delta = -((angle & 1) != 0); - delta = delta & 0xFF4C; - delta += 480; - int y = item->pos.yPos + SPDETyoffs[angle]; - short* frames = GetBestFrame(LaraItem); - - if (LaraItem->pos.yPos + frames[2] <= y && LaraItem->pos.yPos + frames[3] >= y - 900) - { - if (LaraItem->pos.xPos + frames[0] <= (x + delta) && LaraItem->pos.xPos + frames[1] >= (x - delta)) - { - if (LaraItem->pos.zPos + frames[4] <= (z + delta) && LaraItem->pos.zPos + frames[5] >= (z - delta)) - return 1; - } - } - - return 0; -} - -void ControlTeethSpikes(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (!TriggerActive(item) || item->itemFlags[2]) - { - if (TriggerActive(item)) - { - item->itemFlags[1] -= item->itemFlags[0]; - item->itemFlags[0] += (item->itemFlags[0] >> 3) + 32; - - if (item->itemFlags[1] < 0) - { - item->itemFlags[0] = 1024; - item->itemFlags[1] = 0; - item->status = ITEM_INVISIBLE; - } - - if (item->triggerFlags & 0x20) - { - item->itemFlags[2] = 1; - } - else - { - if (item->itemFlags[2]) - { - item->itemFlags[2]--; - } - } - } - else if (!item->timer) - { - item->itemFlags[0] += (item->itemFlags[0] >> 3) + 32; - - if (item->itemFlags[1] > 0) - { - item->itemFlags[1] -= item->itemFlags[0]; - if (item->itemFlags[1] < 0) - item->itemFlags[1] = 0; - } - } - } - else - { - if (item->itemFlags[0] == 1024) - SoundEffect(SFX_TEETH_SPIKES, &item->pos, 0); - - item->status = ITEM_ACTIVE; - - if (LaraItem->hitPoints > 0 && CollidedWithTeethSpikes(item)) - { - short* itemFrames = GetBestFrame(item); - short* laraFrames = GetBestFrame(LaraItem); - - short angle = item->triggerFlags & 7; - int numBloods = 0; - - if ((item->itemFlags[0] > 1024 || LaraItem->gravityStatus) && angle > 2 && angle < 6) - { - if (LaraItem->fallspeed > 6 || item->itemFlags[0] > 1024) - { - LaraItem->hitPoints = -1; - numBloods = 20; - } - } - else if (LaraItem->speed < 30) - { - numBloods = 0; - } - else - { - LaraItem->hitPoints -= 8; - numBloods = (GetRandomControl() & 3) + 2; - } - - int laraY1 = LaraItem->pos.yPos + laraFrames[2]; - int laraY2 = LaraItem->pos.yPos + laraFrames[3]; - - short triggerFlags = item->triggerFlags & 0xF; - int itemY1; - int itemY2; - - if (triggerFlags != 8 && triggerFlags) - { - itemY1 = itemFrames[2]; - itemY2 = itemFrames[3]; - } - else - { - itemY1 = -itemFrames[3]; - itemY2 = -itemFrames[2]; - } - if (laraY1 < item->pos.yPos + itemY1) - laraY1 = itemY1 + item->pos.yPos; - if (laraY2 > item->pos.yPos + itemY2) - laraY2 = itemY2 + item->pos.yPos; - - long dy = laraY1 - laraY2; - int modulus = (HIDWORD(dy) ^ dy) - HIDWORD(dy) + 1; - - angle = item->triggerFlags & 7; - if (angle == 2 || angle == 6) - numBloods /= 2; - - for (int i = 0; i < numBloods; i++) - { - TriggerBlood( - (GetRandomControl() & 0x7F) + LaraItem->pos.xPos - 64, - laraY2 - GetRandomControl() % modulus, - (GetRandomControl() & 0x7F) + LaraItem->pos.zPos - 64, - 2 * GetRandomControl(), - 1); - } - - if (LaraItem->hitPoints <= 0) - { - short roomNumber = LaraItem->roomNumber; - FLOOR_INFO* floor = GetFloor(LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos, &roomNumber); - int height = GetFloorHeight(floor, LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos); - - if (item->pos.yPos >= LaraItem->pos.yPos && height - LaraItem->pos.yPos < 50) - { - LaraItem->animNumber = ANIMATION_LARA_SPIKED; - LaraItem->frameNumber = Anims[LaraItem->animNumber].frameBase; - LaraItem->currentAnimState = STATE_LARA_DEATH; - LaraItem->goalAnimState = STATE_LARA_DEATH; - LaraItem->gravityStatus = false; - } - } - } - - item->itemFlags[0] += 128; - item->itemFlags[1] += item->itemFlags[0]; - - if (item->itemFlags[1] >= 5120) - { - item->itemFlags[1] = 5120; - if (item->itemFlags[0] <= 1024) - { - item->itemFlags[0] = 0; - if (!(item->triggerFlags & 0x10)) - { - if (LaraItem->hitPoints > 0) - item->itemFlags[2] = 64; - } - } - else - { - item->itemFlags[0] = -item->itemFlags[0] >> 1; - } - } - } -} - -void InitialiseRaisingCog(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - short itemNos[32]; - int numSwitchItems = GetSwitchTrigger(item, itemNos, 1); - - if (numSwitchItems > 0) - { - for (int i = 0; i < numSwitchItems; i++) - { - ITEM_INFO* currentItem = &Items[itemNos[i]]; - - if (currentItem->objectNumber == ID_TRIGGER_TRIGGERER) - { - item->itemFlags[1] = currentItem->roomNumber; - } - - if (currentItem->objectNumber == ID_PULLEY || currentItem->objectNumber == ID_TRIGGER_TRIGGERER) - { - currentItem->itemFlags[1] = 1; - PulleyItemNumber = itemNos[i]; - } - } - } -} - -void RaisingCogControl(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (TriggerActive(item)) - { - if (item->itemFlags[0] >= 3) - { - AnimateItem(item); - } - else - { - if (item->itemFlags[2] >= 256) - { - item->itemFlags[2] = 0; - item->itemFlags[0]++; - - if (item->itemFlags[0] == 3) - { - short itemNos[32]; - short numItems = GetSwitchTrigger(item, itemNos, 1); - - if (numItems > 0) - { - for (int i = 0; i < numItems; i++) - { - ITEM_INFO* currentItem = &Items[itemNos[i]]; - - if (item->objectNumber == ID_PULLEY) - { - if (currentItem->roomNumber == item->itemFlags[1]) - { - currentItem->itemFlags[1] = 0; - currentItem->collidable = true; - } - else - { - currentItem->itemFlags[1] = 1; - } - } - else if (item->objectNumber == ID_TRIGGER_TRIGGERER) - { - AddActiveItem(itemNos[i]); - currentItem->status = ITEM_ACTIVE; - currentItem->aiBits = (GUARD | MODIFY | AMBUSH | PATROL1 | FOLLOW); - } - } - } - } - - RemoveActiveItem(itemNumber); - item->status = ITEM_INACTIVE; - item->aiBits = 0; - } - else - { - if (!item->itemFlags[2]) - { - InitialiseSpotCam(item->itemFlags[2]); - UseSpotCam = 1; - } - - int flags = 0; - - if (item->itemFlags[2] >= 31) - { - if (item->itemFlags[2] <= 224) - flags = 31; - else - flags = 255 - item->itemFlags[2]; - } - else - { - flags = item->itemFlags[2]; - } - - SoundEffect(SFX_BLK_PLAT_RAISE_LOW, &item->pos, (flags << 8) | 8); - - item->itemFlags[2] += 2; - item->pos.yPos -= 2; - } - } - } -} - -void TriggerElectricityWiresSparks(int x, int z, char objNum, char node, int flags) -{ - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = -1; - spark->sG = -1; - spark->sB = -1; - spark->dB = -1; - spark->dG = (GetRandomControl() & 0x7F) + 64; - spark->dR = 0; - - if (flags) - { - spark->colFadeSpeed = 1; - spark->fadeToBlack = 0; - spark->life = spark->sLife = 4; - } - else - { - spark->colFadeSpeed = 3; - spark->fadeToBlack = 4; - spark->life = spark->sLife = 16; - } - - spark->fxObj = objNum; - spark->transType = 2; - spark->flags = SP_ITEM | SP_NODEATTACH | SP_SCALE | SP_DEF; - spark->nodeNumber = node; - spark->x = x; - spark->z = z; - spark->y = 0; - - if (flags) - { - spark->xVel = 0; - spark->yVel = 0; - spark->zVel = 0; - } - else - { - spark->xVel = (GetRandomControl() & 0x1FF) - 256; - spark->yVel = GetRandomControl() - 64; - spark->zVel = (GetRandomControl() & 0x1FF) - 256; - } - spark->friction = 51; - spark->maxYvel = 0; - spark->gravity = 0; - - if (flags) - { - spark->scalar = 1; - spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 11; - spark->size = spark->sSize = (GetRandomControl() & 0x1F) + 160; - } - else - { - spark->scalar = 0; - spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 14; - spark->size = spark->sSize = (GetRandomControl() & 7) + 8; - } - - spark->dSize = spark->size >> 1; -} - -void TriggerLaraElectricitySparks(int flame) -{ - PHD_VECTOR pos; - pos.x = 0; - pos.y = 0; - pos.z = 0; - - GetLaraJointPosition(&pos, GetRandomControl() % 15); - - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->dR = 0; - spark->colFadeSpeed = 8; - byte color = (GetRandomControl() & 0x3F) - 64; - spark->sR = color; - spark->sB = color; - spark->sG = color; - spark->dB = color; - spark->dG = color >> 1; - spark->transType = 2; - spark->fadeToBlack = 4; - spark->life = 12; - spark->sLife = 12; - spark->x = pos.x; - spark->y = pos.y; - spark->z = pos.z; - spark->xVel = 2 * (GetRandomControl() & 0x1FF) - 512; - spark->yVel = 2 * (GetRandomControl() & 0x1FF) - 512; - spark->zVel = 2 * (GetRandomControl() & 0x1FF) - 512; - spark->friction = 51; - spark->maxYvel = 0; - spark->gravity = 0; - spark->flags = 0; - - if (flame) - TriggerFireFlame(pos.x, pos.y, pos.z, -1, 254); -} - -int ElectricityWireCheckDeadlyBounds(PHD_VECTOR* pos, short delta) -{ - if (pos->x + delta >= DeadlyBounds[0] && pos->x - delta <= DeadlyBounds[1] - && pos->y + delta >= DeadlyBounds[2] && pos->y - delta <= DeadlyBounds[3] - && pos->z + delta >= DeadlyBounds[4] && pos->z - delta <= DeadlyBounds[5]) - { - return 1; - } - - return 0; -} - -void ElectricityWiresControl(short itemNumber) -{ - bool flag = false; - int counter = 3; - - ITEM_INFO* item = &Items[itemNumber]; - - if (item->itemFlags[0] > 2) - { - TriggerDynamicLight( - LaraItem->pos.xPos, - LaraItem->pos.yPos, - LaraItem->pos.zPos, - item->itemFlags[0], - 0, - (GetRandomControl() & 0x1F) + 8 * item->itemFlags[0], - (GetRandomControl() & 0x1F) + 8 * item->itemFlags[0]); - - item->itemFlags[0] -= 2; - } - - if (TriggerActive(item)) - { - SoundEffect(SFX_ELECTRIC_WIRES, &item->pos, 0); - - counter = (abs(LaraItem->pos.xPos - item->pos.xPos) > 2048) - + (abs(LaraItem->pos.zPos - item->pos.zPos) > 2048) - + (abs(LaraItem->pos.yPos - item->pos.yPos) > 4096); - - int x = (GetRandomControl() & 0x1F) - 16; - int z = (GetRandomControl() & 0x1F) - 16; - - for (int i = 0; i < 3; i++) - { - if (GetRandomControl() & 1) - TriggerElectricityWiresSparks(x, z, itemNumber, i + 2, 0); - } - - if (!(GlobalCounter & 3)) - { - TriggerElectricityWiresSparks(0, 0, itemNumber, 2, 1); - TriggerElectricityWiresSparks(0, 0, itemNumber, 3, 1); - TriggerElectricityWiresSparks(0, 0, itemNumber, 4, 1); - } - } - else - { - flag = true; - } - - AnimateItem(item); - - if (!Lara.burn && !flag && !counter) - { - GetLaraDeadlyBounds(); - - int i = 2; - while (true) - { - PHD_VECTOR pos; - pos.x = 0; - pos.y = 0; - pos.z = 0; - - GetJointAbsPosition(item, &pos, i); - - if (ElectricityWireCheckDeadlyBounds(&pos, item->triggerFlags)) - { - for (int i = 0; i < 48; i++) - { - TriggerLaraElectricitySparks(0); - } - - item->itemFlags[0] = 28; - LaraBurn(); - Lara.burnBlue = 1; - Lara.burnCount = 48; - LaraItem->hitPoints = 0; - return; - } - - i += 3; - if (i >= 27) - break; - } - } - - int i = 8; - int j = 0; - counter = GlobalCounter % 3; - short roomNumber = item->roomNumber; - bool water = false; - - do - { - PHD_VECTOR pos; - pos.x = 0; - pos.y = 0; - pos.z = 256; - GetJointAbsPosition(item, &pos, i); - - if (GetRandomControl() & 1 && !flag) - { - TriggerDynamicLight(pos.x, pos.y, pos.z, 12, 0, ((GetRandomControl() & 0x3F) + 128) >> 1, (GetRandomControl() & 0x3F) + 128); - } - - roomNumber = item->roomNumber; - GetFloor(pos.x, pos.y, pos.z, &roomNumber); - ROOM_INFO* r = &Rooms[roomNumber]; - - if (r->flags & ENV_FLAG_WATER) - { - if (counter == j) - { - SetupRipple(pos.x, r->maxceiling, pos.z, (GetRandomControl() & 7) + 32, 16); - } - - water = true; - } - - i += 9; - j++; - } while (i < 27); - - if (!flag && !Lara.burn) - { - if (water) - { - int flipNumber = Rooms[roomNumber].flipNumber; - - PHD_VECTOR pos1; - pos1.x = 0; - pos1.y = 0; - pos1.z = 0; - GetLaraJointPosition(&pos1, LM_LFOOT); - - short roomNumber1 = LaraItem->roomNumber; - GetFloor(pos1.x, pos1.y, pos1.z, &roomNumber1); - - PHD_VECTOR pos2; - pos2.x = 0; - pos2.y = 0; - pos2.z = 0; - GetLaraJointPosition(&pos2, LM_RFOOT); - - short roomNumber2 = LaraItem->roomNumber; - GetFloor(pos2.x, pos2.y, pos2.z, &roomNumber2); - - if (Rooms[roomNumber1].flipNumber == flipNumber - || Rooms[roomNumber2].flipNumber == flipNumber) - { - if (LaraItem->hitPoints > 32) - { - SoundEffect(SFX_LARA_ELECTRIC_CRACKLES, &LaraItem->pos, 0); - TriggerLaraElectricitySparks(0); - TriggerLaraElectricitySparks(1); - TriggerDynamicLight(pos1.x, pos1.y, pos1.z, 8, 0, GetRandomControl() & 0x7F, (GetRandomControl() & 0x3F) + 128); - LaraItem->hitPoints -= 10; - } - else - { - item->itemFlags[0] = 28; - LaraBurn(); - Lara.burnBlue = 1; - Lara.burnCount = 48; - LaraItem->hitPoints = 0; - } - } - } - } -} - -void InitialiseRomeHammer(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - item->itemFlags[0] = 2; - item->itemFlags[3] = 250; -} - -void VentilatorEffect(short* bounds, int intensity, short rot, int speed) -{ - int x, y, z; - - if (abs(intensity) == 1) - { - x = (bounds[0]+bounds[1]) >> 1; - if (intensity >= 0) - y = bounds[3]; - else - y = bounds[2]; - z = (bounds[4] + bounds[5]) >> 1; - } - else - { - y = (bounds[2]+bounds[3]) >> 1; - if (rot & 0x7FFF) - { - if (intensity >= 0) - z = bounds[5]; - else - z = bounds[4]; - x = (bounds[0]+bounds[1]) >> 1; - } - else - { - if (intensity >= 0) - x = bounds[1]; - else - x = bounds[0]; - z = (bounds[4] + bounds[5]) >> 1; - } - } - - if (abs(Camera.pos.x-x) <= 7168) - { - if (abs(Camera.pos.y-y) <= 7168) - { - if (abs(Camera.pos.z-z) <= 7168) - { - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = 0; - spark->sG = 0; - spark->sB = 0; - spark->dR = spark->dG = 48 * speed >> 7; - spark->colFadeSpeed = 4; - spark->fadeToBlack = 8; - spark->dB = speed * ((GetRandomControl() & 8) + 48) >> 7; - spark->transType = COLADD; - spark->life = spark->sLife = (GetRandomControl() & 3) + 20; - - if (abs(intensity) == 1) - { - int factor = 3 * (bounds[1]-bounds[0]) >> 3; - short angle = 2 * GetRandomControl(); - - spark->x = ((bounds[0] + bounds[1]) >> 1) + ((GetRandomControl() % factor) * phd_sin(angle) >> W2V_SHIFT); - spark->z = ((bounds[4] + bounds[5]) >> 1) + ((GetRandomControl() % factor) * phd_cos(angle) >> W2V_SHIFT); - - if (intensity >= 0) - spark->y = bounds[3]; - else - spark->y = bounds[2]; - - spark->zVel = 0; - spark->xVel = 0; - spark->yVel = 32 * intensity * ((GetRandomControl() & 0x1F) + 224); - } - else - { - int factor = 3 * (bounds[3] - bounds[2]) >> 3; - short angle = 2 * GetRandomControl(); - - spark->y = (bounds[2] + bounds[3]) >> 1; - - if (rot & 0x7FFF) - { - if (intensity >= 0) - spark->z = bounds[5]; - else - spark->z = bounds[4]; - - spark->x = ((bounds[0] + bounds[1]) >> 1) + ((GetRandomControl() % factor) * phd_cos(angle) >> W2V_SHIFT); - spark->y += (GetRandomControl() % factor) * phd_sin(angle) >> W2V_SHIFT; - spark->xVel = 0; - spark->zVel = 16 * intensity * ((GetRandomControl() & 0x1F) + 224); - } - else - { - if (intensity >= 0) - spark->x = bounds[1]; - else - spark->x = bounds[0]; - - spark->y += (GetRandomControl() % factor) * phd_sin(angle) >> W2V_SHIFT; - spark->z = ((bounds[4] + bounds[5]) >> 1) + ((GetRandomControl() % factor) * phd_cos(angle) >> W2V_SHIFT); - spark->zVel = 0; - spark->xVel = 16 * intensity * ((GetRandomControl() & 0x1F) + 224); - } - - spark->yVel = 0; - } - - spark->friction = 85; - spark->xVel = speed * spark->xVel >> 7; - spark->yVel = speed * spark->yVel >> 7; - spark->zVel = speed * spark->zVel >> 7; - spark->maxYvel = 0; - spark->gravity = 0; - spark->flags = 0; - } - } - } -} - -void InitialiseVentilator(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - item->itemFlags[0] = item->triggerFlags << WALL_SHIFT; - if (item->itemFlags[0] < 2048) - item->itemFlags[0] = 3072; -} - -void VentilatorControl(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - AnimateItem(item); - - int xChange = 0; - int zChange = 0; - - if (TriggerActive(item)) - { - xChange = 1; - } - else - { - xChange = 1; - TestTriggersAtXYZ(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 1, 0); - if (item->currentAnimState == 1) - { - //result = 5 * item->animNumber; - if (item->frameNumber == Anims[item->animNumber].frameEnd) - return; - } - else - { - item->goalAnimState = 1; - } - } - - int speed = 0; - if (item->currentAnimState == 1) - { - speed = Anims[item->animNumber].frameEnd - item->frameNumber; - } - else - { - speed = 128; - } - - short* bounds = GetBoundsAccurate(item); - short effectBounds[6]; - - effectBounds[2] = item->pos.yPos + bounds[2]; - effectBounds[3] = item->pos.yPos + bounds[3]; - - if (item->objectNumber != ID_PROPELLER_V) // TODO: check this ID - { - if (item->pos.yRot != -ANGLE(180)) - { - if (item->pos.yRot == -ANGLE(90)) - { - effectBounds[0] = item->pos.xPos - bounds[5]; - effectBounds[1] = item->pos.xPos - bounds[4]; - effectBounds[4] = item->pos.zPos + bounds[0]; - effectBounds[5] = item->pos.zPos + bounds[1]; - xChange = 0; - zChange = 1; - } - else - { - if (item->pos.yRot != ANGLE(90)) - { - effectBounds[0] = item->pos.xPos + bounds[0]; - effectBounds[1] = item->pos.xPos + bounds[1]; - effectBounds[4] = item->pos.zPos + bounds[4]; - effectBounds[5] = item->pos.zPos + bounds[5]; - zChange = 0; - } - else - { - effectBounds[0] = item->pos.xPos + bounds[4]; - effectBounds[1] = item->pos.xPos + bounds[5]; - effectBounds[4] = item->pos.zPos - bounds[1]; - effectBounds[5] = item->pos.zPos - bounds[0]; - xChange = 0; - zChange = 1; - } - } - } - else - { - effectBounds[0] = item->pos.xPos - bounds[1]; - effectBounds[1] = item->pos.xPos - bounds[0]; - effectBounds[4] = item->pos.zPos - bounds[5]; - effectBounds[5] = item->pos.zPos - bounds[4]; - zChange = 0; - } - - VentilatorEffect(effectBounds, 2, item->pos.yRot, speed); - VentilatorEffect(effectBounds, -2, item->pos.yRot, speed); - - if (LaraItem->pos.yPos >= effectBounds[2] && LaraItem->pos.yPos <= effectBounds[3]) - { - if (zChange) - { - if (LaraItem->pos.xPos >= effectBounds[0] && LaraItem->pos.xPos <= effectBounds[1]) - { - int z1 = abs(LaraItem->pos.zPos - effectBounds[4]); - int z2 = abs(LaraItem->pos.zPos - effectBounds[5]); - - if (z2 >= z1) - zChange = -zChange; - else - z1 = z2; - - if (z1 < item->itemFlags[0]) - { - int dz = 96 * zChange * (item->itemFlags[0] - z1) / item->itemFlags[0]; - if (item->currentAnimState == 1) - dz = speed * dz / 120; - LaraItem->pos.zPos += dz; - } - } - } - else - { - if (LaraItem->pos.zPos >= effectBounds[4] && LaraItem->pos.zPos <= effectBounds[5]) - { - int x1 = abs(LaraItem->pos.xPos - effectBounds[0]); - int x2 = abs(LaraItem->pos.xPos - effectBounds[0]); - - if (x2 >= x1) - xChange = -xChange; - else - x1 = x2; - - if (x1 < item->itemFlags[0]) - { - int dx = 96 * xChange * (item->itemFlags[0] - x1) / item->itemFlags[0]; - if (item->currentAnimState == 1) - dx = speed * dx / 120; - LaraItem->pos.xPos += dx; - } - } - } - } - } - else - { - short tbounds[6]; - phd_RotBoundingBoxNoPersp(&item->pos, bounds, tbounds); - - effectBounds[0] = item->pos.xPos + tbounds[0]; - effectBounds[1] = item->pos.xPos + tbounds[1]; - effectBounds[4] = item->pos.zPos + tbounds[4]; - effectBounds[5] = item->pos.zPos + tbounds[5]; - - VentilatorEffect(effectBounds, 1, 0, speed); - VentilatorEffect(effectBounds, -1, 0, speed); - - if (LaraItem->pos.xPos >= effectBounds[0] && LaraItem->pos.xPos <= effectBounds[1]) - { - if (LaraItem->pos.zPos >= effectBounds[4] && LaraItem->pos.zPos <= effectBounds[5]) - { - int y = effectBounds[3]; - - if (LaraItem->pos.yPos <= effectBounds[3]) - { - if (effectBounds[2] - LaraItem->pos.yPos >= item->itemFlags[0]) - return; - y = 96 * (effectBounds[3] - item->itemFlags[0]) / item->itemFlags[0]; - } - else - { - if (LaraItem->pos.yPos - effectBounds[3] >= item->itemFlags[0]) - return; - y = 96 * (item->itemFlags[0] - (LaraItem->pos.yPos - effectBounds[3])) / item->itemFlags[0]; - } - if (item->currentAnimState == 1) - y = speed * y / 120; - LaraItem->pos.yPos += y; - } - } - } -} - -void DartControl(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (item->touchBits) - { - LaraItem->hitPoints -= 25; - LaraItem->hitStatus = true; - Lara.poisoned += 160; - DoBloodSplat(item->pos.xPos, item->pos.yPos, item->pos.zPos, (GetRandomControl() & 3) + 4, LaraItem->pos.yRot, LaraItem->roomNumber); - KillItem(itemNumber); - } - else - { - item->pos.xPos += item->speed * phd_sin(item->pos.yRot) >> W2V_SHIFT; - item->pos.yPos -= item->speed * phd_sin(item->pos.xRot) >> W2V_SHIFT; - item->pos.xPos += item->speed * phd_cos(item->pos.yRot) >> W2V_SHIFT; - - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - - if (item->roomNumber != roomNumber) - ItemNewRoom(itemNumber, roomNumber); - - int height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - item->floor = height; - - if (item->pos.yPos >= height) - { - for (int i = 0; i < 4; i++) - { - TriggerDartSmoke(item->pos.xPos, item->pos.yPos, item->pos.zPos, 0, 0, 1); - } - - KillItem(itemNumber); - } - } -} - -void DartEmitterControl(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (item->active) - { - if (item->timer > 0) - { - item->timer--; - return; - } - else - { - item->timer = 24; - } - } - - short dartItemNumber = CreateItem(); - - if (dartItemNumber != NO_ITEM) - { - ITEM_INFO* dartItem = &Items[dartItemNumber]; - - dartItem->objectNumber = ID_DARTS; - dartItem->roomNumber = item->roomNumber; - - int x = 0; - int z = 0; - - if (item->pos.yRot > 0) - { - if (item->pos.yRot == ANGLE(90)) - x = 512; - } - else if (item->pos.yRot < 0) - { - if (item->pos.yRot == -ANGLE(180)) - { - z = -512; - } - else if (item->pos.yRot == -ANGLE(90)) - { - x = -512; - } - } - else - { - z = 512; - } - - dartItem->pos.xPos = x + item->pos.xPos; - dartItem->pos.yPos = item->pos.yPos - 512; - dartItem->pos.zPos = z + item->pos.zPos; - - InitialiseItem(dartItemNumber); - - dartItem->pos.xRot = 0; - dartItem->pos.yRot = item->pos.yRot + -ANGLE(180); - dartItem->speed = 256; - - int xf = 0; - int zf = 0; - - if (x) - xf = abs(2 * x) - 1; - else - zf = abs(2 * z) - 1; - - for (int i = 0; i < 5; i++) - { - int random = -GetRandomControl(); - - int xv = 0; - int zv = 0; - - if (z >= 0) - zv = zf & random; - else - zv = -(zf & random); - - if (x >= 0) - xv = xf & random; - else - xv = -(xf & random); - - TriggerDartSmoke(dartItem->pos.xPos, dartItem->pos.yPos, dartItem->pos.zPos, xv, zv, 0); - } - - AddActiveItem(dartItemNumber); - dartItem->status = ITEM_ACTIVE; - SoundEffect(SFX_LIFT_DOORS, &dartItem->pos, 0); - } -} - -void FallingCeilingControl(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (item->currentAnimState) - { - if (item->currentAnimState == 1 && item->touchBits) - { - LaraItem->hitPoints -= 300; - LaraItem->hitStatus = true; - } - } - else - { - item->goalAnimState = 1; - item->gravityStatus = true;; - } - - AnimateItem(item); - - if (item->status == ITEM_DEACTIVATED) - { - RemoveActiveItem(itemNumber); - } - else - { - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - item->floor = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - - if (roomNumber != item->roomNumber) - ItemNewRoom(itemNumber, roomNumber); - - if (item->currentAnimState == 1) - { - if (item->pos.yPos >= item->floor) - { - item->pos.yPos = item->floor; - item->gravityStatus = false; - item->goalAnimState = 2; - item->fallspeed = 0; - } - } - } -} - -void RollingBallCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (TestBoundsCollide(item, l, coll->radius)) - { - if (TestCollision(item, l)) - { - if (TriggerActive(item) && (item->itemFlags[0] || item->fallspeed)) - { - LaraItem->animNumber = ANIMATION_LARA_SQUASH_BOULDER; - LaraItem->frameNumber = Anims[LaraItem->animNumber].frameBase; - LaraItem->goalAnimState = STATE_LARA_DEATH; - LaraItem->currentAnimState = STATE_LARA_DEATH; - LaraItem->gravityStatus = false; - } - else - { - ObjectCollision(itemNumber, l, coll); - } - } - } -} - -void RollingBallControl(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (!TriggerActive(item)) - return; - - item->fallspeed += GRAVITY; - - item->pos.xPos += item->itemFlags[0] >> 5; - item->pos.yPos += item->fallspeed; - item->pos.zPos += item->itemFlags[1] >> 5; - - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - int height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - int dh = height - 512; - - if (item->pos.yPos > height - 512) - { - if (abs(item->fallspeed) > 16) - { - int distance = sqrt( - SQUARE(Camera.pos.x - item->pos.xPos) + - SQUARE(Camera.pos.y - item->pos.yPos) + - SQUARE(Camera.pos.z - item->pos.zPos)); - - if (distance < 16384) - Camera.bounce = -((16384 - distance) * abs(item->fallspeed) >> 14); - } - - if (item->pos.yPos - dh < 512) - item->pos.yPos = dh; - - if (item->fallspeed <= 64) - { - if (abs(item->speed) <= 512 || GetRandomControl() & 0x1F) - item->fallspeed = 0; - else - item->fallspeed = -(short)(GetRandomControl() % (item->speed >> 3)); - } - else - { - item->fallspeed = -(short)(item->fallspeed >> 2); - } - } - - int x = item->pos.xPos; - int y = item->pos.yPos; - int z = item->pos.zPos; - - floor = GetFloor(x, y, z + 128, &roomNumber); - int y1a = GetFloorHeight(floor, x, y, z + 128) - 512; - - floor = GetFloor(x, y, z - 128, &roomNumber); - int y2a = GetFloorHeight(floor, x, y, z - 128) - 512; - - floor = GetFloor(x + 128, y, z, &roomNumber); - int y3a = GetFloorHeight(floor, x + 128, y, z) - 512; - - floor = GetFloor(x - 128, y, z, &roomNumber); - int y4a = GetFloorHeight(floor, x - 128, y, z) - 512; - - floor = GetFloor(x, y, z + 512, &roomNumber); - int y1b = GetFloorHeight(floor, x, y, z + 512) - 512; - - floor = GetFloor(x, y, z - 512, &roomNumber); - int y2b = GetFloorHeight(floor, x, y, z - 512) - 512; - - floor = GetFloor(x + 512, y, z, &roomNumber); - int y3b = GetFloorHeight(floor, x + 512, y, z) - 512; - - floor = GetFloor(x - 512, y, z, &roomNumber); - int y4b = GetFloorHeight(floor, x - 512, y, z) - 512; - - if (item->pos.yPos - dh > -256 - || item->pos.yPos - y1b >= 512 - || item->pos.yPos - y3b >= 512 - || item->pos.yPos - y2b >= 512 - || item->pos.yPos - y4b >= 512) - { - int counterZ = 0; - - if (y1a - dh <= 256) - { - if (y1b - dh < -1024 || y1a - dh < -256) - { - if (item->itemFlags[1] <= 0) - { - if (!item->itemFlags[1] && item->itemFlags[0]) - { - item->pos.zPos = (item->pos.zPos & 0xFFFFFE00) + 512; - } - } - else - { - item->itemFlags[1] = -item->itemFlags[1] >> 1; - item->pos.zPos = (item->pos.zPos & 0xFFFFFE00) + 512; - } - } - else if (y1a == dh) - { - counterZ = 1; - } - else - { - item->itemFlags[1] += (y1a - dh) >> 1; - } - } - - if (y2a - dh <= 256) - { - if (y2b - dh < -1024 || y2a - dh < -256) - { - if (item->itemFlags[1] >= 0) - { - if (!item->itemFlags[1] && item->itemFlags[0]) - { - item->pos.zPos = (item->pos.zPos & 0xFFFFFE00) + 512; - } - } - else - { - item->itemFlags[1] = -item->itemFlags[1] >> 1; - item->pos.zPos = (item->pos.zPos & 0xFFFFFE00) + 512; - } - } - else if (y2a == dh) - { - counterZ++; - } - else - { - item->itemFlags[1] -= (y2a - dh) >> 1; - } - } - - if (counterZ == 2) - { - if (abs(item->itemFlags[1]) <= 64) - item->itemFlags[1] = 0; - else - item->itemFlags[1] = item->itemFlags[1] - (item->itemFlags[1] >> 6); - } - - int counterX = 0; - - if (y4a - dh <= 256) - { - if (y4b - dh < -1024 || y4a - dh < -256) - { - if (item->itemFlags[0] >= 0) - { - if (!item->itemFlags[0] && item->itemFlags[1]) - { - item->pos.xPos = (item->pos.xPos & 0xFFFFFE00) + 512; - } - } - else - { - item->itemFlags[0] = -item->itemFlags[0] >> 1; - item->pos.xPos = (item->pos.xPos & 0xFFFFFE00) + 512; - } - } - else if (y4a == dh) - { - counterX = 1; - } - else - { - item->itemFlags[0] -= (y4a - dh) >> 1; - } - } - - if (y3a - dh <= 256) - { - if (y3b - dh < -1024 || y3a - dh < -256) - { - if (item->itemFlags[0] <= 0) - { - if (!item->itemFlags[0] && item->itemFlags[1]) - { - item->pos.xPos = (item->pos.xPos & 0xFFFFFE00) + 512; - } - } - else - { - item->itemFlags[0] = -item->itemFlags[0] >> 1; - item->pos.xPos = (item->pos.xPos & 0xFFFFFE00) + 512; - } - } - else if (y3a == dh) - { - counterX++; - } - else - { - item->itemFlags[0] += (y3a - dh) >> 1; - } - } - - if (counterX == 2) - { - if (abs(item->itemFlags[0]) <= 64) - item->itemFlags[0] = 0; - else - item->itemFlags[0] = item->itemFlags[0] - (item->itemFlags[0] >> 6); - } - } - - GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - - if (item->roomNumber != roomNumber) - ItemNewRoom(itemNumber, roomNumber); - - if (item->itemFlags[0] <= 3072) - { - if (item->itemFlags[0] < -3072) - item->itemFlags[0] = -3072; - } - else - { - item->itemFlags[0] = 3072; - } - - if (item->itemFlags[1] <= 3072) - { - if (item->itemFlags[1] < -3072) - item->itemFlags[1] = -3072; - } - else - { - item->itemFlags[1] = 3072; - } - - short angle = 0; - - if (item->itemFlags[1] || item->itemFlags[0]) - angle = phd_atan(item->itemFlags[1], item->itemFlags[0]); - else - angle = item->pos.yRot; - - if (item->pos.yRot != angle) - { - if (((angle - item->pos.yRot) & 0x7FFFu) >= 0x200) - { - if (angle <= item->pos.yRot || angle - item->pos.yRot >= 0x8000) - item->pos.yRot -= 512; - else - item->pos.yRot += 512; - } - else - { - item->pos.yRot = angle; - } - } - - item->pos.xRot -= (abs(item->itemFlags[0]) + abs(item->itemFlags[1])) >> 1; - - roomNumber = item->roomNumber; - floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - TestTriggers(TriggerIndex, 1, 0); -} \ No newline at end of file diff --git a/TR5Main/Objects/Utils/object_helper.cpp b/TR5Main/Objects/Utils/object_helper.cpp new file mode 100644 index 000000000..1ec203267 --- /dev/null +++ b/TR5Main/Objects/Utils/object_helper.cpp @@ -0,0 +1,150 @@ +#include "framework.h" +#include "object_helper.h" +#include "collide.h" +#include "objects.h" +#include "pickup.h" +#include "level.h" +#include "tr5_smashobject.h" +#include "tr5_pushableblock.h" + +void InitSmashObject(ObjectInfo* obj, int objectNumber) +{ + obj = &Objects[objectNumber]; + if (obj->loaded) + { + obj->initialise = InitialiseSmashObject; + obj->collision = ObjectCollision; + obj->control = SmashObjectControl; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveMesh = true; + } +} + +void InitKeyHole(ObjectInfo* obj, int objectNumber) +{ + obj = &Objects[objectNumber]; + if (obj->loaded) + { + obj->collision = KeyHoleCollision; + obj->saveFlags = true; + } +} + +void InitPuzzleHole(ObjectInfo* obj, int objectNumber) +{ + obj = &Objects[objectNumber]; + if (obj->loaded) + { + obj->collision = PuzzleHoleCollision; + obj->control = AnimatingControl; + obj->saveFlags = true; + obj->saveAnim = true; + obj->isPuzzleHole = true; + } +} + +void InitPuzzleDone(ObjectInfo* obj, int objectNumber) +{ + obj = &Objects[objectNumber]; + if (obj->loaded) + { + obj->collision = PuzzleDoneCollision; + obj->control = AnimatingControl; + obj->saveFlags = true; + obj->saveAnim = true; + } +} + +void InitAnimating(ObjectInfo* obj, int objectNumber) +{ + obj = &Objects[objectNumber]; + if (obj->loaded) + { + obj->initialise = InitialiseAnimating; + obj->control = AnimatingControl; + obj->collision = ObjectCollision; + obj->saveFlags = true; + obj->saveAnim = true; + obj->saveMesh = true; + Bones[obj->boneIndex + (0 * 4)] |= ROT_Y; + Bones[obj->boneIndex + (1 * 4)] |= ROT_X; + } +} + +void InitPickup(ObjectInfo* obj, int objectNumber) +{ + obj = &Objects[objectNumber]; + if (obj->loaded) + { + obj->initialise = InitialisePickup; + obj->collision = PickupCollision; + obj->control = PickupControl; + obj->savePosition = true; + obj->saveFlags = true; + obj->isPickup = true; + } +} + +void InitPickupItem(ObjectInfo* obj, function func, int objectNumber, bool useDrawAnimItem) +{ + obj = &Objects[objectNumber]; + if (obj->loaded) + { + obj->collision = PickupCollision; + obj->control = func; + + if (objectNumber == ID_FLARE_ITEM) + { + obj->pivotLength = 256; + obj->hitPoints = 256; // time + } + + obj->saveFlags = true; + obj->savePosition = true; + if (useDrawAnimItem) + obj->usingDrawAnimatingItem = true; + else + obj->usingDrawAnimatingItem = false; + } +} + +void InitProjectile(ObjectInfo* obj, function func, int objectNumber, bool noLoad) +{ + obj = &Objects[objectNumber]; + if (obj->loaded || noLoad) + { + obj->initialise = nullptr; + obj->collision = nullptr; + obj->control = func; + obj->savePosition = true; + obj->saveFlags = true; + obj->saveAnim = true; + } +} + +void InitSearchObject(ObjectInfo* obj, int objectNumber) +{ + obj = &Objects[objectNumber]; + if (obj->loaded) + { + obj->initialise = InitialiseSearchObject; + obj->collision = SearchObjectCollision; + obj->control = SearchObjectControl; + obj->saveFlags = true; + } +} + +void InitPushableObject(ObjectInfo* obj, int objectNumber) +{ + obj = &Objects[objectNumber]; + if (obj->loaded) + { + obj->initialise = InitialisePushableBlock; + obj->control = PushableBlockControl; + obj->collision = PushableBlockCollision; + obj->saveFlags = true; + obj->savePosition = true; + obj->saveAnim = true; + } +} diff --git a/TR5Main/Objects/Utils/object_helper.h b/TR5Main/Objects/Utils/object_helper.h new file mode 100644 index 000000000..aca51aa20 --- /dev/null +++ b/TR5Main/Objects/Utils/object_helper.h @@ -0,0 +1,13 @@ +#pragma once +#include "setup.h" + +void InitSmashObject(ObjectInfo* obj, int objectNumber); +void InitKeyHole(ObjectInfo* obj, int objectNumber); +void InitPuzzleHole(ObjectInfo* obj, int objectNumber); +void InitPuzzleDone(ObjectInfo* obj, int objectNumber); +void InitAnimating(ObjectInfo* obj, int objectNumber); +void InitPickup(ObjectInfo* obj, int objectNumber); +void InitPickupItem(ObjectInfo* obj, function func, int objectNumber, bool useDrawAnimItem = false); +void InitProjectile(ObjectInfo* obj, function func, int objectNumber, bool noLoad = false); +void InitSearchObject(ObjectInfo* obj, int objectNumber); +void InitPushableObject(ObjectInfo* obj, int objectNumber); \ No newline at end of file diff --git a/TR5Main/Objects/newobjects.h b/TR5Main/Objects/newobjects.h deleted file mode 100644 index 3afe9832f..000000000 --- a/TR5Main/Objects/newobjects.h +++ /dev/null @@ -1,445 +0,0 @@ -#pragma once -#include "../Global/global.h" - -typedef struct QUAD_INFO { - int velocity; - short frontRot; - short rearRot; - int revs; - int engineRevs; - short trackMesh; - int skidooTurn; - int leftFallspeed; - int rightFallspeed; - short momentumAngle; - short extraRotation; - int pitch; - char flags; -}; - -typedef struct JEEP_INFO { - short rot1; - short rot2; - short rot3; - short rot4; - int velocity; - int revs; - short engineRevs; - short trackMesh; - int jeepTurn; - int fallSpeed; - short momentumAngle; - short extraRotation; - short unknown0; - int pitch; - short flags; - short unknown1; - short unknown2; -}; - -struct MOTORBIKE_INFO -{ - int wheelRight; // (two wheel: front and back) - int wheelLeft; // (one wheel: left) - int velocity; - int revs; - int engineRevs; - short momentumAngle; - short extraRotation; - short wallShiftRotation; - int bikeTurn; - int pitch; - short flags; - short lightPower; -}; - -typedef struct SUB_INFO { - int Vel; - int Rot; - int RotX; - short FanRot; - char Flags; - char WeaponTimer; -}; - -typedef struct CART_INFO { - int Speed; - int MidPos; - int FrontPos; - int TurnX; - int TurnZ; - short TurnLen; - short TurnRot; - short YVel; - short Gradient; - char Flags; - char StopDelay; -}; - -typedef struct FISH_INFO -{ - short x; - short y; - short z; - int angle; - short destY; - short angAdd; - byte speed; - byte acc; - byte swim; -}; - -typedef struct FISH_LEADER_INFO -{ - short angle; - byte speed; - byte on; - short angleTime; - short speedTime; - short xRange, yRange, zRange; -}; - -typedef struct BOAT_INFO -{ - int boat_turn; - int left_fallspeed; - int right_fallspeed; - int water; - int pitch; - short tilt_angle; - short extra_rotation; - short prop_rot; -}; - -typedef struct SKIDOO_INFO -{ - short track_mesh; - int skidoo_turn; - int left_fallspeed, right_fallspeed; - short momentum_angle, extra_rotation; - int pitch; - bool already_cd_played; - bool armed; - int flash_timer; -}; - -typedef struct KAYAK_INFO { - int Vel; - int Rot; - int FallSpeedF; - int FallSpeedL; - int FallSpeedR; - int Water; - PHD_3DPOS OldPos; - char Turn; - char Forward; - char TrueWater; - char Flags; -}; - -typedef struct BOSS_STRUCT -{ - PHD_VECTOR BeamTarget; - bool DroppedIcon; - bool IsInvincible; - bool DrawExplode; // allow explosion geometry - bool Charged; - bool Dead; - short AttackCount; - short DeathCount; - short AttackFlag; - short AttackType; - short AttackHeadCount; - short RingCount; - short ExplodeCount; - short LizmanItem, LizmanRoom; - short HpCounter; -}; - -typedef struct SHIELD_POINTS -{ - short x; - short y; - short z; - byte rsub; - byte gsub; - byte bsub; - byte pad[3]; - long rgb; -}; - -typedef struct EXPLOSION_VERTS -{ - short x; - short z; - long rgb; -}; - -typedef struct EXPLOSION_RING -{ - short on; - short life; // 0 - 32. - short speed; - short radius; // Width is 1/4 of radius. - short xrot; - short zrot; - int x; - int y; - int z; - EXPLOSION_VERTS verts[16]; -}; - -void ClampRotation(PHD_3DPOS *pos, short angle, short rot); - -// TR1 objects -void InitialiseWolf(short itemNum); -void WolfControl(short itemNum); -void BearControl(short itemNum); -void Tr1RaptorControl(short itemNum); -void Tr1LarsonControl(short itemNum); -void Tr1PierreControl(short itemNum); -void ApeControl(short itemNum); -void InitialiseEvilLara(short itemNum); -void LaraEvilControl(short itemNum); -void DrawEvilLara(ITEM_INFO* item); -void NatlaControl(short itemNum); -void NatlaEvilControl(short itemNum); - -// TR2 objects -void BarracudaControl(short itemNum); -void SharkControl(short itemNum); -void InitialiseSpinningBlade(short itemNum); -void SpinningBlade(short itemNum); -void InitialiseKillerStatue(short itemNum); -void KillerStatueControl(short itemNum); -void SpringBoardControl(short itemNum); -void RatControl(short itemNum); -void SilencerControl(short itemNum); -void InitialiseYeti(short itemNum); -void YetiControl(short itemNum); -void WorkerShotgunControl(short itemNum); -void InitialiseWorkerShotgun(short itemNum); -void WorkerMachineGunControl(short itemNum); -void InitialiseWorkerMachineGun(short itemNum); -void SmallSpiderControl(short itemNum); -void BigSpiderControl(short itemNum); -void WorkerDualGunControl(short itemNum); -void BirdMonsterControl(short itemNum); -void WorkerFlamethrower(short itemNum); -void InitialiseWorkerFlamethrower(short itemNum); -void KnifethrowerControl(short itemNum); -void KnifeControl(short fxNum); -void MercenaryUziControl(short itemNum); -void MercenaryAutoPistolControl(short itemNum); -void MonkControl(short itemNum); -void DrawStatue(ITEM_INFO* item); // compatible with all statue :) -void InitialiseSwordGuardian(short itemNum); -void SwordGuardianFly(ITEM_INFO* item); // only effect to fly -void SwordGuardianControl(short itemNum); -void InitialiseSpearGuardian(short itemNum); -void SpearGuardianControl(short itemNum); -void DragonCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll); -void DragonControl(short backNum); -void InitialiseBartoli(short itemNum); -void BartoliControl(short itemNum); -void InitialiseSkidman(short itemNum); -void SkidManCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll); -void SkidManControl(short riderNum); - -// TR3 objects -void TigerControl(short itemNum); -void InitialiseCobra(short itemNum); -void CobraControl(short itemNum); -void Tr3RaptorControl(short itemNum); -void ShootHarpoon(ITEM_INFO* frogman, int x, int y, int z, short speed, short yRot, short roomNumber); -void HarpoonControl(short itemNum); -void ScubaControl(short itemNumber); -void InitialiseEagle(short itemNum); -void EagleControl(short itemNum); -void TribemanAxeControl(short itemNum); -void TribesmanShotDart(ITEM_INFO* item); -void TribesmanDartsControl(short itemNum); -void ControlSpikyWall(short itemNum); -void LaraTyrannosaurDeath(ITEM_INFO* item); -void TyrannosaurControl(short itemNum); -void TriggerFlamethrowerFlame(int x, int y, int z, int xv, int yv, int zv, int fxnum); -void TriggerPilotFlame(int itemnum); -short TriggerFlameThrower(ITEM_INFO* item, BITE_INFO* bite, short speed); -void FlameThrowerControl(short itemNumber); -void ControlSpikyCeiling(short itemNumber); -void InitialiseMonkey(short itemNumber); -void MonkeyControl(short itemNumber); -void MPGunControl(short itemNumber); -void InitialiseMPStick(short itemNumber); -void MPStickControl(short itemNumber); -void SetupShoal(int shoalNumber); -void SetupFish(int leader, ITEM_INFO* item); -void ControlFish(short itemNumber); -bool FishNearLara(PHD_3DPOS* pos, int distance, ITEM_INFO* item); -void InitialiseTony(short itemNum); -void TonyControl(short itemNum); -void S_DrawTonyBoss(ITEM_INFO* item); -void ControlTonyFireBall(short fxNumber); -void InitialiseShiva(short itemNum); -void ShivaControl(short itemNum); -void ControlLaserBolts(short item_number); -void ControlLondBossPlasmaBall(short fx_number); -void InitialiseLondonBoss(short item_number); -void LondonBossControl(short item_number); -void S_DrawLondonBoss(ITEM_INFO* item); -void InitialiseCivvy(short item_number); -void CivvyControl(short item_number); - -// TR4 object -void InitialiseAhmet(short item_number); -void AhmetControl(short item_number); -void InitialiseWildBoar(short itemNum); -void WildBoarControl(short itemNum); -void InitialiseSmallScorpion(short itemNum); -void SmallScorpionControl(short itemNum); -void InitialiseBat(short itemNum); -void BatControl(short itemNum); -void InitialiseBaddy(short itemNum); -void BaddyControl(short itemNum); -void InitialiseSas(short itemNum); -void SasControl(short itemNum); -void InitialiseMummy(short itemNum); -void MummyControl(short itemNum); -void InitialiseSkeleton(short itemNum); -void SkeletonControl(short itemNum); -void WakeUpSkeleton(ITEM_INFO* item); -void FourBladesControl(short itemNum); -void BirdBladeControl(short itemNum); -void CatwalkBlaldeControl(short itemNum); -void PlinthBladeControl(short itemNum); -void InitialiseSethBlade(short itemNum); -void SethBladeControl(short itemNum); -void ChainControl(short itemNum); -void PloughControl(short itemNum); -void CogControl(short itemNum); -void SpikeballControl(short itemNum); -void InitialiseKnightTemplar(short itemNum); -void KnightTemplarControl(short itemNum); -void StargateControl(short itemNum); -void StargateCollision(short itemNum, ITEM_INFO* item, COLL_INFO* coll); -void InitialiseSlicerDicer(short itemNum); -void SlicerDicerControl(short itemNum); -void BladeCollision(short itemNum, ITEM_INFO* item, COLL_INFO* coll); -void SarcophagusCollision(short itemNum, ITEM_INFO* item, COLL_INFO* coll); -void InitialiseScorpion(short itemNum); -void ScorpionControl(short itemNum); -void InitialiseLaraDouble(short itemNum); -void LaraDoubleControl(short itemNum); -void InitialiseDemigod(short itemNum); -void DemigodControl(short itemNum); -void DemigodThrowEnergyAttack(PHD_3DPOS* pos, short roomNumber, int something); -void DemigodEnergyAttack(short itemNum); -void DemigodHammerAttack(int x, int y, int z, int something); -void InitialiseMine(short itemNum); -void MineControl(short itemNum); -void MineCollision(short itemNum, ITEM_INFO* item, COLL_INFO* coll); -void InitialiseSentryGun(short itemNum); -void SentryGunControl(short itemNum); -void SentryGunThrowFire(ITEM_INFO* item); -void InitialiseJeanYves(short itemNum); -void JeanYvesControl(short itemNum); -void ScalesControl(short itemNum); -void ScalesCollision(short itemNum, ITEM_INFO* item, COLL_INFO* coll); -int RespawnAhmet(short itemNum); -void InitialiseLittleBeetle(short itemNum); -void LittleBeetleControl(short itemNum); -void InitialiseTroops(short itemNum); -void TroopsControl(short itemNum); -void InitialiseHarpy(short itemNum); -void HarpyControl(short itemNum); -void HarpyBubbles(PHD_3DPOS* pos, short roomNumber, int count); -void HarpyAttack(ITEM_INFO* item, short itemNum); -void HarpySparks1(short itemNum, byte num, int size); -void HarpySparks2(int x, int y, int z, int xv, int yv, int zv); -void InitialiseGuide(short itemNum); -void GuideControl(short itemNum); -void InitialiseCrocodile(short itemNum); -void CrocodileControl(short itemNum); -void InitialiseSphinx(short itemNum); -void SphinxControl(short itemNum); -void InitialiseBurningFloor(short itemNum); -void BurningFloorControl(short itemNum); -void InitialiseHorse(short itemNum); -void InitialiseHorseman(short itemNum); -void HorsemanControl(short itemNum); -void HorsemanSparks(PHD_3DPOS* pos, int param1, int num); -void BubblesControl(short fxNum); -int BubblesShatterFunction(FX_INFO* fx, int param1, int param2); -void BubblesEffect1(short fxNum, short xVel, short yVel, short zVel); -void BubblesEffect2(short fxNum, short xVel, short yVel, short zVel); -void BubblesEffect3(short fxNum, short xVel, short yVel, short zVel); -void BubblesEffect4(short fxNum, short xVel, short yVel, short zVel); - -/* Vehicles: */ - -// TODO: the boat is bugged, need to be fixed ! -void InitialiseBoat(short itemNum); -void BoatCollision(short itemNum, ITEM_INFO* litem, COLL_INFO* coll); -void BoatControl(short itemNumber); - -void InitialiseSkidoo(short itemNum); -void SkidooCollision(short itemNum, ITEM_INFO* litem, COLL_INFO* coll); -int SkidooControl(); -void DrawSkidoo(ITEM_INFO* item); -void DoSnowEffect(ITEM_INFO* skidoo); - -void QuadbikeExplode(ITEM_INFO* item); -int CanQuadbikeGetOff(int direction); -int QuadCheckGetOff(); -int GetOnQuadBike(short itemNumber, COLL_INFO* coll); -void QuadBaddieCollision(ITEM_INFO* quad); -int GetQuadCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p); -int TestQuadHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos); -int DoQuadShift(ITEM_INFO* quad, PHD_VECTOR* pos, PHD_VECTOR* old); -int DoQuadDynamics(int height, int fallspeed, int* y); -int QuadDynamics(ITEM_INFO* item); -void AnimateQuadBike(ITEM_INFO* item, int collide, int dead); -int QuadUserControl(ITEM_INFO* item, int height, int* pitch); -void TriggerQuadExhaustSmoke(int x, int y, int z, short angle, int speed, int moving); -void InitialiseQuadBike(short itemNumber); -void QuadBikeCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll); -int QuadBikeControl(); - -// TODO: the kayak is bugged, need to be fixed ! -void InitialiseKayak(short item_number); -void DrawKayak(ITEM_INFO* kayak); -void KayakCollision(short item_number, ITEM_INFO* l, COLL_INFO* coll); -int KayakControl(); - -/// Underwater Propeller -void SubInitialise(short itemNum); -void SubCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); -int SubControl(); - -void InitialiseMineCart(short itemNum); // minecart not tested ! -void MineCartCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll); -int MineCartControl(); - -int TestJeepHeight(ITEM_INFO* item, int dz, int dx, PHD_VECTOR* pos); -int DoJeepShift(ITEM_INFO* jeep, PHD_VECTOR* pos, PHD_VECTOR* old); -int DoJeepDynamics(int height, int speed, int* y, int flags); -int JeepCanGetOff(); -void TriggerJeepExhaustSmoke(int x, int y, int z, short angle, short speed, int moving); -int JeepCheckGetOff(); -int GetOnJeep(int itemNumber); -int GetJeepCollisionAnim(ITEM_INFO* item, PHD_VECTOR* p); -void JeepBaddieCollision(ITEM_INFO* jeep); -void JeepExplode(ITEM_INFO* item); -int JeepDynamics(ITEM_INFO* item); -int JeepUserControl(ITEM_INFO* item, int height, int* pitch); -void AnimateJeep(ITEM_INFO* item, int collide, int dead); -void InitialiseJeep(short itemNum); -int JeepControl(); -void JeepCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll); - -void InitialiseMotorbike(short item_number); -void MotorbikeCollision(short item_number, ITEM_INFO* laraitem, COLL_INFO* coll); -int MotorbikeControl(void); -void DrawMotorbike(ITEM_INFO* item); -void DrawMotorbikeEffect(ITEM_INFO* item); -void SetLaraOnMotorBike(ITEM_INFO* item, ITEM_INFO* laraitem); \ No newline at end of file diff --git a/TR5Main/Objects/oldobjects.h b/TR5Main/Objects/oldobjects.h index 10b2396de..670a1f121 100644 --- a/TR5Main/Objects/oldobjects.h +++ b/TR5Main/Objects/oldobjects.h @@ -1,87 +1,24 @@ #pragma once -#include "../Global/global.h" +#include "collide.h" +#include "effect.h" -extern int NextBat; -extern BAT_STRUCT* Bats; - -extern int NextSpider; -extern SPIDER_STRUCT* Spiders; - -extern int NextRat; -extern RAT_STRUCT* Rats; - -void InitialiseGuard(short itemNum); -void InitialiseSniper(short itemNum); -void InitialiseGuardLaser(short itemNum); -void InitialiseSubmarine(short itemNum); -void InitialiseDoberman(short itemNum); -void InitialiseDog(short itemNum); -void InitialiseReaper(short itemNum); -void InitialiseLarson(short itemNum); -void InitialiseHitman(short itemNum); -void InitialiseHydra(short itemNum); -void InitialiseImp(short itemNum); -void InitialiseLightingGuide(short itemNum); -void InitialiseBrownBeast(short itemNum); -void InitialiseInvisibleGhost(short itemNum); -void InitialiseGladiator(short itemNum); -/// void InitialiseRomanStatue(short itemNum) -void InitialiseAutoGuns(short itemNum); -void InitialisePushableBlock(short itemNum); -void ClearMovableBlockSplitters(int x, int y, int z, short roomNumber); -void PushableBlockControl(short itemNumber); -void PushableBlockCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll); -int TestBlockMovable(ITEM_INFO* item, int blokhite); -int TestBlockPush(ITEM_INFO* item, int blokhite, unsigned short quadrant); -int TestBlockPull(ITEM_INFO* item, int blokhite, short quadrant); -void GuardControl(short itemNum); -void ControlDoberman(short itemNumber); -void ControlReaper(short itemNumber); -void SniperControl(short itemNumber); -void ImpThrowStones(ITEM_INFO* item); -void ControlImp(short itemNumber); -void ControlGladiator(short itemNumber); -void ControlBrowsBeast(short itemNumber); -void ControlInvisibleGhost(short itemNumber); -short GetNextRat(); -void ControlLittleRats(short itemNumber); -void InitialiseMafia2(short itemNum); -void Mafia2Control(short itemNum); -void ControlDog(short itemNumber); -void ControlLarson(short itemNumber); void InitialiseRaisingBlock(short itemNumber); void ControlRaisingBlock(short itemNumber); void InitialiseTeethSpikes(short itemNumber); int CollidedWithTeethSpikes(ITEM_INFO* item); void ControlTeethSpikes(short itemNumber); void PulseLightControl(short itemNumber); -void TriggerAlertLight(int x, int y, int z, int r, int g, int b, int rot, __int16 roomNumber, __int16 falloff); +void TriggerAlertLight(int x, int y, int z, int r, int g, int b, int rot, short roomNumber, short falloff); void StrobeLightControl(short itemNumber); void ColorLightControl(short itemNumber); void ElectricalLightControl(short itemNumber); void BlinkingLightControl(short itemNumber); -void InitialiseTwoBlocksPlatform(short itemNumber); -void TwoBlocksPlatformControl(short itemNumber); -void TwoBlocksPlatformFloor(ITEM_INFO* item, int x, int y, int z, int* height); -void TwoBlocksPlatformCeiling(ITEM_INFO* item, int x, int y, int z, int* height); -int IsOnTwoBlocksPlatform(ITEM_INFO* item, int x, int z); -void InitialiseRaisingCog(short itemNumber); -void RaisingCogControl(short itemNumber); void TriggerElectricityWiresSparks(int x, int z, char objNum, char node, int flags); void TriggerLaraElectricitySparks(int flame); int ElectricityWireCheckDeadlyBounds(PHD_VECTOR* pos, short delta); void ElectricityWiresControl(short itemNumber); -void InitialiseRomeHammer(short itemNumber); void InitialiseSmokeEmitter(short itemNumber); void SmokeEmitterControl(short itemNumber); -void RomanStatueHitEffect(ITEM_INFO* item, PHD_VECTOR* pos, int joint); -void TriggerRomanStatueShockwaveAttackSparks(int x, int y, int z, byte r, byte g, byte b, byte size); -void TriggerRomanStatueScreamingSparks(int x, int y, int z, short xv, short yv, short zv, int flags); -void TriggerRomanStatueAttackEffect1(short itemNum, int factor); -void RomanStatueAttack(PHD_3DPOS* pos, short roomNumber, short count); -void TriggerRomanStatueMissileSparks(PHD_VECTOR* pos, char fxObj); -void InitialiseRomanStatue(short itemNum); -void ControlRomanStatue(short itemNumber); void InitialiseTeleporter(short itemNumber); void ControlTeleporter(short itemNumber); void InitialiseHighObject1(short itemNumber); @@ -99,46 +36,8 @@ void RollingBallControl(short itemNumber); void DeathSlideCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll); void ControlDeathSlide(short itemNumber); void InitialiseDeathSlide(short itemNumber); -void ControlSubmarine(short itemNumber); -void TriggerTorpedoBubbles(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char factor); -void TriggerSubmarineSparks(short itemNumber); -void SubmarineAttack(ITEM_INFO* item); -void TriggerTorpedoSparks2(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char scale); void ChaffFlareControl(short itemNumber); -void TorpedoControl(short itemNumber); -void InitialiseLittleBats(short itemNumber); -void ControlLittleBats(short itemNumber); -short GetNextBat(); -void TriggerLittleBat(ITEM_INFO* item); -void TriggerHitmanSparks(int x, int y, int z, short xv, short yv, short zv); -void HitmanControl(short itemNumber); -void ControlGunShip(short itemNumber); -void ControlHydra(short itemNumber); -void TriggerHydraSparks(short itemNumber, int frame); -void HydraBubblesAttack(PHD_3DPOS* pos, short roomNumber, int count); -void TriggerHydraMissileSparks(PHD_VECTOR* pos, short xv, short yv, short zv); -void TriggerAutoGunSmoke(PHD_VECTOR* pos, char shade); -void ControlAutoGuns(short itemNumber); -void TriggerGuardianSparks(PHD_VECTOR* pos, int count, byte r, byte g, byte b, int unk); -void GuardianCharge(ITEM_INFO* item); -short GetNextSpider(); -void ControlSpiders(short itemNumber); -void InitialiseSpiders(short itemNumber); -void ClearSpidersPatch(ITEM_INFO* item); -void ClearSpiders(); -void InitialiseLittleRats(short itemNumber); -void ClearRats(); -void UpdateSpiders(); -void UpdateRats(); -void UpdateBats(); void MissileControl(short itemNumber); -void InitialiseGuardian(short itemNumber); -void GuardianControl(short itemNumber); void ControlBodyPart(short fxNumber); void ExplodeFX(FX_INFO* fx, int noXZVel, int bits); -void InitialiseLagoonWitch(short itemNumber); -void ControlLagoonWitch(short itemNumber); -void InitialiseChef(short itemNumber); -void ControlChef(short itemNumber); -void InitialiseLion(short itemNum); -void LionControl(short itemNum); +void InitialiseRomeHammer(short itemNumber); diff --git a/TR5Main/Objects/puzzles.cpp b/TR5Main/Objects/puzzles.cpp deleted file mode 100644 index 96597805a..000000000 --- a/TR5Main/Objects/puzzles.cpp +++ /dev/null @@ -1,338 +0,0 @@ -#include "newobjects.h" -#include "..\Global\global.h" -#include "..\Game\Box.h" -#include "..\Game\items.h" -#include "..\Game\lot.h" -#include "..\Game\control.h" -#include "..\Game\effect2.h" -#include "..\Game\Lara.h" -#include "..\Game\effects.h" -#include "..\Game\draw.h" -#include "..\Game\collide.h" -#include "..\Game\sphere.h" -#include "..\Game\switch.h" -#include "../Game/tomb4fx.h" -#include "../Game/pickup.h" -#include "../Specific/setup.h" -#include "..\Specific\level.h" -#include "../Specific/input.h" -#include "../Game/sound.h" - -extern DRIP_STRUCT Drips[MAX_DRIPS]; - -short ScalesBounds[12] = { - 0xFA80, 0xFA80, 0x0000, 0x0000, 0xFE00, 0x0200, - 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0xF8E4, 0x071C -}; - -void ScalesControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (item->frameNumber != Anims[item->animNumber].frameEnd) - { - AnimateItem(item); - return; - } - - if (item->currentAnimState == 1 || item->itemFlags[1]) - { - if (Objects[item->objectNumber].animIndex) - { - RemoveActiveItem(itemNum); - item->status = ITEM_INACTIVE; - item->itemFlags[1] = 0; - - AnimateItem(item); - return; - } - - if (RespawnAhmet((short)Lara.generalPtr)) - { - short itemNos[8]; - int sw = GetSwitchTrigger(item, itemNos, 0); - - if (sw > 0) - { - while (Items[itemNos[sw]].objectNumber == ID_FLAME_EMITTER2) - { - if (--sw <= 0) - break; - } - Items[itemNos[sw]].flags = 1024; - } - - item->goalAnimState = 1; - } - - AnimateItem(item); - } - - int flags = 0; - - if (item->currentAnimState == 2) - { - flags = -512; - RemoveActiveItem(itemNum); - item->status = ITEM_INACTIVE; - } - else - { - flags = -1024; - item->itemFlags[1] = 1; - } - - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - int height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - - TestTriggers(TriggerIndex, 1, flags); - - AnimateItem(item); -} - -void ScalesCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (TestBoundsCollide(item, l, 100)) - { - if (l->animNumber != 400 && l->animNumber != 402 || item->currentAnimState != 1) - { - GlobalCollisionBounds.X1 = 640; - GlobalCollisionBounds.X2 = 1280; - GlobalCollisionBounds.Y1 = -1280; - GlobalCollisionBounds.Y2 = 0; - GlobalCollisionBounds.Z1 = -256; - GlobalCollisionBounds.Z2 = 384; - - ItemPushLara(item, l, coll, 0, 2); - - GlobalCollisionBounds.X1 = -256; - GlobalCollisionBounds.X2 = 256; - - ItemPushLara(item, l, coll, 0, 2); - - GlobalCollisionBounds.X1 = -1280; - GlobalCollisionBounds.X2 = -640; - - ItemPushLara(item, l, coll, 0, 2); - } - else - { - short rotY = item->pos.yRot; - item->pos.yRot = (short)(l->pos.yRot + ANGLE(45)) & 0xC000; - - ScalesBounds[0] = -1408; - ScalesBounds[1] = -640; - ScalesBounds[4] = -512; - ScalesBounds[5] = 0; - - if (TestLaraPosition(ScalesBounds, item, l)) - { - l->animNumber = 402; - l->frameNumber = Anims[item->animNumber].frameBase; - item->pos.yRot = rotY; - } - else if (l->frameNumber == Anims[402].frameBase + 51) - { - SoundEffect(SFX_TR4_POUR, &l->pos, 0); - item->pos.yRot = rotY; - } - else if (l->frameNumber == Anims[402].frameBase + 74) - { - AddActiveItem(itemNum); - item->status = ITEM_ACTIVE; - - if (l->itemFlags[3] < item->triggerFlags) - { - item->goalAnimState = 4; - item->pos.yRot = rotY; - } - else if (l->itemFlags[3] == item->triggerFlags) - { - item->goalAnimState = 2; - item->pos.yRot = rotY; - } - else - { - item->goalAnimState = 3; - } - } - else - { - item->pos.yRot = rotY; - } - } - } - - if (l->frameNumber >= Anims[400].frameBase + 44 && - l->frameNumber <= Anims[400].frameBase + 72 || - l->frameNumber >= Anims[402].frameBase + 51 && - l->frameNumber <= Anims[402].frameBase + 74) - { - PHD_VECTOR pos; - pos.x = 0; - pos.y = 0; - pos.z = 0; - - GetLaraJointPosition(&pos, LM_LHAND); - - DRIP_STRUCT* drip = &Drips[GetFreeDrip()]; - drip->x = pos.x; - drip->y = pos.y; - drip->z = pos.z; - drip->on = 1; - drip->r = (GetRandomControl() & 0xF) + 24; - drip->g = (GetRandomControl() & 0xF) + 44; - drip->b = (GetRandomControl() & 0xF) + 56; - drip->yVel = (GetRandomControl() & 0x1F) + 32; - drip->gravity = (GetRandomControl() & 0x1F) + 32; - drip->life = (GetRandomControl() & 0x1F) + 16; - drip->roomNumber = l->roomNumber; - } -} - -int RespawnAhmet(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (item->currentAnimState != 7 || item->frameNumber != Anims[item->animNumber].frameEnd) - return false; - - FlashFadeR = 255; - FlashFadeG = 64; - FlashFadeB = 0; - FlashFader = 32; - - item->pos.xPos = (item->itemFlags[0] << 10) + 512; - item->pos.yPos = (item->itemFlags[1] << 8); - item->pos.zPos = (item->itemFlags[2] << 10) + 512; - - IsRoomOutside(item->pos.xPos, item->pos.yPos, item->pos.zPos); - - if (item->roomNumber != IsRoomOutsideNo) - ItemNewRoom(itemNum, IsRoomOutsideNo); - - item->animNumber = Objects[ID_AHMET].animIndex; - item->goalAnimState = 1; - item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = 1; - item->hitPoints = Objects[ID_AHMET].hitPoints; - - AddActiveItem(itemNum); - - item->flags &= 0xFE; - item->afterDeath = 0; - item->status = ITEM_ACTIVE; - item->collidable = true; - - EnableBaddieAI(itemNum, 1); - - item->triggerFlags = 1; - - return true; -} - -void InitialiseLaraDouble(short itemNum) -{ - ClearItem(itemNum); -} - -void LaraDoubleControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP, &item->pos, 0); - - if (CreatureActive(itemNum)) - { - if (item->hitStatus) - { - LaraItem->hitPoints += item->hitPoints - 1000; - } - - item->hitPoints = 1000; - - AnimateItem(item); - } -} - -short SarcophagusBounds[12] = { - 0xFE00, 0x0200, 0xFF9C, 0x0064, 0xFE00, 0x0000, - 0xF8E4, 0x071C, 0xEAAC, 0x1554, 0x0000, 0x0000 -}; -PHD_VECTOR SarcophagusPosition = { 0x00000000, 0x00000000, 0xFFFFFED4 }; - -void InitialiseSarcophagus(short itemNum) -{ - -} - -void SarcophagusCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (TrInput & IN_ACTION && - item->status != ITEM_ACTIVE && - l->currentAnimState == 2 && - l->animNumber == 103 && - !Lara.gunStatus || - Lara.isMoving && (short)Lara.generalPtr == itemNum) - { - if (TestLaraPosition(SarcophagusBounds, item, l)) - { - if (MoveLaraPosition(&SarcophagusPosition, item, l)) - { - l->animNumber = 439; - l->currentAnimState = 89; - l->frameNumber = Anims[l->animNumber].frameBase; - item->flags |= 0x3E00; - - AddActiveItem(itemNum); - item->status = ITEM_ACTIVE; - - Lara.isMoving = false; - Lara.headYrot = 0; - Lara.headXrot = 0; - Lara.torsoYrot = 0; - Lara.torsoXrot = 0; - Lara.gunStatus = LG_HANDS_BUSY; - } - else - { - Lara.generalPtr = (void*)itemNum; - } - } - else if (Lara.isMoving) - { - if ((short)Lara.generalPtr == itemNum) - { - Lara.isMoving = false; - Lara.gunStatus = LG_NO_ARMS; - } - } - } - else if (l->animNumber != 439 || l->frameNumber != Anims[439].frameBase + 113) - { - ObjectCollision(itemNum, l, coll); - } - else - { - short linknum; - for (linknum = Items[Rooms[item->roomNumber].itemNumber].nextItem; linknum != NO_ITEM; linknum = Items[linknum].nextItem) - { - ITEM_INFO* currentItem = &Items[linknum]; - - if (linknum != itemNum && currentItem->pos.xPos == item->pos.xPos && currentItem->pos.zPos == item->pos.zPos) - { - if (Objects[currentItem->objectNumber].collision == PickupCollision) - { - PickedUpObject(currentItem->objectNumber); - currentItem->status = ITEM_ACTIVE; - currentItem->itemFlags[3] = 1; - } - } - } - } -} \ No newline at end of file diff --git a/TR5Main/Objects/statue.cpp b/TR5Main/Objects/statue.cpp deleted file mode 100644 index caf2d6e2b..000000000 --- a/TR5Main/Objects/statue.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include "newobjects.h" - -// TODO: finish the statue render (drawanimatingitem not work anymore with the new render) -// TODO: crash with the explosion death ! - -// for TR2 and TR3 statue (compatible by any statue entity) -// the statue object need to be after the normal one: -// ex: ID_SWORD_GUARDIAN: 256, ID_SWORD_GUARDIAN_STATUE: 257 -void DrawStatue(ITEM_INFO* item) -{ - /* - ObjectInfo* obj; - CREATURE_INFO* creature; - int* bones; - int clip, i, poppush, frac, rate, bit; - short* frames[2]; - short* extra_rotation; - short* rotation1, *rotation2; - short** normal, **statue; - - creature = (CREATURE_INFO*)item->data; - frac = GetFrame_D2(item, frames, &rate); - - if (item->hitPoints <= 0 && item->status != ITEM_ACTIVE && item->meshBits != 0) - item->meshBits = item->meshBits >> 1; - - obj = &Objects[item->objectNumber]; - //if (obj->shadowSize) - // S_PrintShadow(obj->shadowSize, frames[0], item, NULL); - - phd_PushMatrix(); - phd_TranslateAbs(item->pos.xPos, item->pos.yPos, item->pos.zPos); - phd_RotYXZ(item->pos.yRot, item->pos.xRot, item->pos.zRot); - - if (phd_ClipBoundingBox(frames[0])) - { - CalculateObjectLighting(item, frames[0]); - - if (item->data == NULL) - extra_rotation = NullRotations; - else - extra_rotation = (short*)item->data; - - // all entity have the statue slot after it, (ex: ID_SWORD_GUARDIAN: 256, ID_SWORD_GUARDIAN_STATUE: 257) - normal = &Meshes[Objects[obj->objectNumber].meshIndex]; - statue = &Meshes[Objects[obj->objectNumber + 1].meshIndex]; - bones = &Bones[obj->boneIndex]; - bit = 1; - - if (!frac) - { - phd_TranslateRel((int)*(frames[0] + 6), (int)*(frames[0] + 7), (int)*(frames[0] + 8)); // can be [0][6] etc.. ? - rotation1 = (short*)(frames[0] + 9); - gar_RotYXZsuperpack(&rotation1, 0); - - if (item->meshBits & bit) - phd_PutPolygons(*normal); - else - phd_PutPolygons(*statue); - normal++; - statue++; - - for (i = (obj->nmeshes - 1); i > 0; i--, bones += 4, normal++, statue++) - { - poppush = *bones; - - if (poppush & 1) - { - phd_PopMatrix(); - phd_PopDxMatrix(); - } - - if (poppush & 2) - phd_PushMatrix(); - - phd_TranslateRel(*(bones + 1), *(bones + 2), *(bones + 3)); - gar_RotYXZsuperpack(&rotation1, 0); - - if (extra_rotation && (poppush & (ROT_X|ROT_Y|ROT_Z))) - { - if (poppush & ROT_Y) - phd_RotY(*(extra_rotation++)); - if (poppush & ROT_X) - phd_RotX(*(extra_rotation++)); - if (poppush & ROT_Z) - phd_RotZ(*(extra_rotation++)); - } - - bit <<= 1; - if (item->meshBits & bit) - phd_PutPolygons(*normal); - else - phd_PutPolygons(*statue); - } - } - else - { - InitInterpolate(frac, rate); - phd_TranslateRel_ID((int)*(frames[0] + 6), (int)*(frames[0] + 7), (int)*(frames[0] + 8), - (int)*(frames[1] + 6), (int)*(frames[1] + 7), (int)*(frames[1] + 8)); - rotation1 = (short*)(frames[0] + 9); - rotation2 = (short*)(frames[1] + 9); - gar_RotYXZsuperpack_I(&rotation1, &rotation2, 0); - - if (item->meshBits & bit) - phd_PutPolygons_I(*normal); - else - phd_PutPolygons_I(*statue); - normal++; - statue++; - - for (i = (obj->nmeshes - 1); i > 0; i--, bones += 4, normal++, statue++) - { - poppush = *bones; - if (poppush & 1) - phd_PopMatrix_I(); - - if (poppush & 2) - phd_PushMatrix_I(); - - phd_TranslateRel_I(*(bones + 1), *(bones + 2), *(bones + 3)); - gar_RotYXZsuperpack_I(&rotation1, &rotation2, 0); - - if (extra_rotation && (poppush & (ROT_X|ROT_Y|ROT_Z))) - { - if (poppush & ROT_Y) - phd_RotY_I(*(extra_rotation++)); - if (poppush & ROT_X) - phd_RotX_I(*(extra_rotation++)); - if (poppush & ROT_Z) - phd_RotZ_I(*(extra_rotation++)); - } - - bit <<= 1; - if (item->meshBits & bit) - phd_PutPolygons_I(*normal); - else - phd_PutPolygons_I(*statue); - } - } - } - - //PhdRight = PhdWidth; - //PhdLeft = 0; - //PhdTop = 0; - //PhdBottom = PhdHeight; - phd_PopMatrix(); - phd_PopDxMatrix(); - */ -} \ No newline at end of file diff --git a/TR5Main/Objects/TR5/tr5_misc_objects.cpp b/TR5Main/Objects/tr5_misc_objects.cpp similarity index 80% rename from TR5Main/Objects/TR5/tr5_misc_objects.cpp rename to TR5Main/Objects/tr5_misc_objects.cpp index 0aaf81e0f..6e2e234a1 100644 --- a/TR5Main/Objects/TR5/tr5_misc_objects.cpp +++ b/TR5Main/Objects/tr5_misc_objects.cpp @@ -1,29 +1,28 @@ -#include "../newobjects.h" -#include "../oldobjects.h" -#include "../../Game/lara.h" -#include "../../Game/draw.h" -#include "../../Global/global.h" -#include "../../Game/items.h" -#include "../../Game/collide.h" -#include "../../Game/effects.h" -#include "../../Game/laramisc.h" -#include "../../Game/Box.h" -#include "../../Game/sphere.h" -#include "../../Game/effect2.h" -#include "../../Game/tomb4fx.h" -#include "../../Game/switch.h" -#include "../../Game/debris.h" -#include "../../Game/objects.h" -#include "../../Game/camera.h" -#include "../../Game/missile.h" -#include "../../Specific/setup.h" -#include "..\..\Specific\level.h" -#include "../../Specific/input.h" -#include "../../Game/sound.h" +#include "framework.h" +#include "oldobjects.h" +#include "lara.h" +#include "draw.h" + +#include "items.h" +#include "collide.h" +#include "effect.h" +#include "laramisc.h" +#include "box.h" +#include "sphere.h" +#include "effect2.h" +#include "tomb4fx.h" +#include "switch.h" +#include "debris.h" +#include "objects.h" +#include "camera.h" +#include "missile.h" +#include "setup.h" +#include "level.h" +#include "input.h" +#include "sound.h" short DeathSlideBounds[12] = { -256, 256, -100, 100, 256, 512, 0, 0, -25 * ONE_DEGREE, 25 * ONE_DEGREE, 0, 0 }; PHD_VECTOR DeathSlidePosition = { 0, 0, 371 }; -int GunShipCounter = 0; void InitialiseRaisingBlock(short itemNumber) { @@ -363,126 +362,6 @@ void BlinkingLightControl(short itemNumber) } } -void InitialiseTwoBlocksPlatform(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - item->itemFlags[0] = item->pos.yPos; - item->itemFlags[1] = 1; -} - -void TwoBlocksPlatformControl(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (TriggerActive(item)) - { - if (item->triggerFlags) - { - if (item->pos.yPos > (item->itemFlags[0] - 16 * (item->triggerFlags & 0xFFFFFFF0))) - { - item->pos.yPos -= item->triggerFlags & 0xF; - } - - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - item->floor = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - - if (roomNumber != item->roomNumber) - ItemNewRoom(itemNumber, roomNumber); - } - else - { - OnFloor = false; - - int height = LaraItem->pos.yPos + 1; - TwoBlocksPlatformFloor(item, LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos, &height); - - if (OnFloor && LaraItem->animNumber != ANIMATION_LARA_RUN_BACK) - item->itemFlags[1] = 1; - else - item->itemFlags[1] = -1; - - if (item->itemFlags[1] <= 0) - { - if (item->itemFlags[1]<= 0) - { - if (item->pos.yPos <= item->itemFlags[0]) - { - item->itemFlags[1] = 1; - } - else - { - SoundEffect(SFX_2GUNTEX_FALL_BIG, &item->pos, 0); - item->pos.yPos -= 4; - } - } - } - else - { - if (item->pos.yPos >= item->itemFlags[0] + 128) - { - item->itemFlags[1] = -1; - } - else - { - SoundEffect(SFX_2GUNTEX_FALL_BIG, &item->pos, 0); - item->pos.yPos+= 4; - } - } - } - } -} - -void TwoBlocksPlatformFloor(ITEM_INFO* item, int x, int y, int z, int* height) -{ - if (IsOnTwoBlocksPlatform(item, x, z)) - { - if (y <= item->pos.yPos + 32 && item->pos.yPos < *height) - { - *height = item->pos.yPos; - OnFloor = 1; - HeightType = 0; - } - } -} - -void TwoBlocksPlatformCeiling(ITEM_INFO* item, int x, int y, int z, int* height) -{ - if (IsOnTwoBlocksPlatform(item, x, z)) - { - if (y > item->pos.yPos + 32 && item->pos.yPos > * height) - { - *height = item->pos.yPos + 256; - } - } -} - -int IsOnTwoBlocksPlatform(ITEM_INFO* item, int x, int z) -{ - if (!item->meshBits) - return 0; - - short angle = item->pos.yRot; - - int xb = x >> 10; - int zb = z >> 10; - - int itemxb = item->pos.xPos >> 10; - int itemzb = item->pos.zPos >> 10; - - if (!angle && (xb == itemxb || xb == itemxb - 1) && (zb == itemzb || zb == itemzb + 1)) - return 1; - if (angle == -ANGLE(180) && (xb == itemxb || xb == itemxb + 1) && (zb == itemzb || zb == itemzb - 1)) - return 1; - if (angle == ANGLE(90) && (zb == itemzb || zb == itemzb - 1) && (xb == itemxb || xb == itemxb + 1)) - return 1; - if (angle == -ANGLE(90) && (zb == itemzb || zb == itemzb - 1) && (xb == itemxb || xb == itemxb - 1)) - return 1; - - return 0; -} - void InitialiseSmokeEmitter(short itemNumber) { ITEM_INFO* item = &Items[itemNumber]; @@ -1141,7 +1020,7 @@ void ControlHighObject1(short itemNumber) RemoveActiveItem(itemNumber); item->flags &= 0xC1FF; - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; return; } @@ -1196,7 +1075,7 @@ void ControlHighObject1(short itemNumber) RemoveActiveItem(itemNumber); item->flags &= 0xC1FF; - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; return; } @@ -1344,7 +1223,7 @@ void DeathSlideCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) return; ITEM_INFO* item = &Items[itemNumber]; - if (item->status != ITEM_INACTIVE) + if (item->status != ITEM_NOT_ACTIVE) return; if (TestLaraPosition(DeathSlideBounds, item, LaraItem)) @@ -1382,7 +1261,7 @@ void ControlDeathSlide(short itemNumber) if (old->roomNumber != item->roomNumber) ItemNewRoom(itemNumber, old->roomNumber); - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; item->currentAnimState = item->goalAnimState = 1; item->animNumber = Objects[item->objectNumber].animIndex; item->frameNumber = Anims[item->animNumber].frameBase; @@ -1443,7 +1322,7 @@ void ControlDeathSlide(short itemNumber) // Stop SoundEffect(SFX_COGS_ROME, &item->pos, 0); RemoveActiveItem(itemNumber); - item->status = ITEM_INACTIVE; + item->status = ITEM_NOT_ACTIVE; item->flags -= ONESHOT; } else @@ -1452,175 +1331,6 @@ void ControlDeathSlide(short itemNumber) } } -void ControlGunShip(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (TriggerActive(item)) - { - SoundEffect(SFX_HELICOPTER_LOOP, &item->pos, 0); - - GAME_VECTOR pos; - pos.x = ((GetRandomControl() & 0x1FF) - 255); - pos.y = (GetRandomControl() & 0x1FF) - 255; - pos.z = (GetRandomControl() & 0x1FF) - 255; - GetLaraJointPosition((PHD_VECTOR*)&pos, LM_TORSO); - - GAME_VECTOR end = pos; - - if (!item->itemFlags[0] && !item->itemFlags[1] && !item->itemFlags[2]) - { - item->itemFlags[0] = pos.x >> 4; - item->itemFlags[1] = pos.y >> 4; - item->itemFlags[2] = pos.z >> 4; - } - - pos.x = (pos.x + 80 * item->itemFlags[0]) / 6; - pos.y = (pos.y + 80 * item->itemFlags[1]) / 6; - pos.z = (pos.z + 80 * item->itemFlags[2]) / 6; - - item->itemFlags[0] = pos.x >> 4; - item->itemFlags[1] = pos.y >> 4; - item->itemFlags[2] = pos.z >> 4; - - if (item->triggerFlags == 1) - item->pos.zPos += (pos.z - item->pos.zPos) >> 5; - else - item->pos.xPos += (pos.x - item->pos.xPos) >> 5; - item->pos.yPos += (pos.y - item->pos.yPos - 256) >> 5; - - GAME_VECTOR start; - start.x = GetRandomControl() + item->pos.xPos - 128; - start.y = GetRandomControl() + item->pos.yPos - 128; - start.z = GetRandomControl() + item->pos.zPos - 128; - start.roomNumber = item->roomNumber; - int los = LOS(&start, &end); - - end.x = 3 * pos.x - 2 * start.x; - end.y = 3 * pos.y - 2 * start.y; - end.z = 3 * pos.z - 2 * start.z; - int los2 = LOS(&start, &end); - - if (los) - GunShipCounter = 1; - else - GunShipCounter++; - - if (GunShipCounter <= 15) - item->meshBits |= 0x100; - else - item->meshBits &= 0xFEFF; - - if (GunShipCounter < 15) - SoundEffect(SFX_HK_FIRE, &item->pos, 0xC00004); - - if (!(GlobalCounter & 1)) - return AnimateItem(item); - - GetLaraOnLOS = 1; - - PHD_VECTOR hitPos; - MESH_INFO* hitMesh = NULL; - int objOnLos = ObjectOnLOS2(&start, &end, &hitPos, &hitMesh); - - GetLaraOnLOS = 0; - - if (objOnLos == 999 || objOnLos < 0) - { - if (GunShipCounter >= 15) - return AnimateItem(item); - - TriggerDynamicLight( - start.x, start.y, start.z, 16, - (GetRandomControl() & 0x3F) + 96, - (GetRandomControl() & 0x1F) + 64, - 0); - - if (!los2) - { - TriggerRicochetSpark(&end, 2 * GetRandomControl(), 3, 0); - TriggerRicochetSpark(&end, 2 * GetRandomControl(), 3, 0); - } - - if (objOnLos < 0 && GetRandomControl() & 1) - { - if (hitMesh->staticNumber >= 50 && hitMesh->staticNumber < 59) - { - ShatterObject(0, hitMesh, 64, end.roomNumber, 0); - hitMesh->Flags &= 0xFFFE; - TestTriggersAtXYZ(hitMesh->x, hitMesh->y, hitMesh->z, end.roomNumber, 1, 0); - SoundEffect(ShatterSounds[CurrentLevel - 5][hitMesh->staticNumber], (PHD_3DPOS*)hitMesh, 0); - } - - TriggerRicochetSpark((GAME_VECTOR*)&hitPos, 2 * GetRandomControl(), 3, 0); - TriggerRicochetSpark((GAME_VECTOR*)&hitPos, 2 * GetRandomControl(), 3, 0); - } - } - else - { - ITEM_INFO* hitItem = &Items[objOnLos]; - - if (hitItem->objectNumber != ID_LARA) - { - if (hitItem->objectNumber >= ID_SMASH_OBJECT1 - && hitItem->objectNumber <= ID_SMASH_OBJECT8) - { - ExplodeItemNode(hitItem, 0, 0, 128); - SmashObject(objOnLos); - KillItem(objOnLos); - } - } - else - { - TriggerDynamicLight( - start.x, start.y, start.z, - 16, - (GetRandomControl() & 0x3F) + 96, - (GetRandomControl() & 0x1F) + 64, - 0); - - DoBloodSplat( - start.x, start.y, start.z, - (GetRandomControl() & 1) + 2, - 2 * GetRandomControl(), - LaraItem->roomNumber); - - LaraItem->hitPoints -= 20; - } - } - - if (GunShipCounter < 15) - { - SPARKS* spark = &Sparks[GetFreeSpark()]; - spark->on = 1; - spark->sR = spark->dR = (GetRandomControl() & 0x7F) + -128; - spark->sG = (spark->dR >> 1) + (GetRandomControl() & 0x7F); - if (spark->sG > spark->sR) - spark->sG = spark->sR; - spark->sB = 0; - spark->dB = 0; - spark->dR = 0; - spark->dG = 0; - spark->colFadeSpeed = 12; - spark->transType = COLADD; - spark->fadeToBlack = 0; - spark->life = 12; - spark->sLife = 12; - spark->x = start.x; - spark->y = start.y; - spark->z = start.z; - spark->xVel = 4 * (end.x - start.x); - spark->yVel = 4 * (end.y - start.y); - spark->zVel = 4 * (end.z - start.z); - spark->friction = 0; - spark->maxYvel = 0; - spark->flags = 0; - } - - AnimateItem(item); - } -} - void ControlBodyPart(short fxNumber) { FX_INFO* fx = &Effects[fxNumber]; diff --git a/TR5Main/Objects/tr5_traps.cpp b/TR5Main/Objects/tr5_traps.cpp new file mode 100644 index 000000000..3e2955f0f --- /dev/null +++ b/TR5Main/Objects/tr5_traps.cpp @@ -0,0 +1,651 @@ +#include "framework.h" +#include "oldobjects.h" +#include "lara.h" +#include "draw.h" + +#include "items.h" +#include "collide.h" +#include "effect.h" +#include "laramisc.h" +#include "box.h" +#include "tomb4fx.h" +#include "switch.h" +#include "spotcam.h" +#include "effect2.h" +#include "sphere.h" +#include "traps.h" +#include "camera.h" +#include "setup.h" +#include "level.h" +#include "sound.h" + +void TriggerElectricityWiresSparks(int x, int z, char objNum, char node, int flags) +{ + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->sR = -1; + spark->sG = -1; + spark->sB = -1; + spark->dB = -1; + spark->dG = (GetRandomControl() & 0x7F) + 64; + spark->dR = 0; + + if (flags) + { + spark->colFadeSpeed = 1; + spark->fadeToBlack = 0; + spark->life = spark->sLife = 4; + } + else + { + spark->colFadeSpeed = 3; + spark->fadeToBlack = 4; + spark->life = spark->sLife = 16; + } + + spark->fxObj = objNum; + spark->transType = COLADD; + spark->flags = SP_ITEM | SP_NODEATTACH | SP_SCALE | SP_DEF; + spark->nodeNumber = node; + spark->x = x; + spark->z = z; + spark->y = 0; + + if (flags) + { + spark->xVel = 0; + spark->yVel = 0; + spark->zVel = 0; + } + else + { + spark->xVel = (GetRandomControl() & 0x1FF) - 256; + spark->yVel = GetRandomControl() - 64; + spark->zVel = (GetRandomControl() & 0x1FF) - 256; + } + spark->friction = 51; + spark->maxYvel = 0; + spark->gravity = 0; + + if (flags) + { + spark->scalar = 1; + spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 11; + spark->size = spark->sSize = (GetRandomControl() & 0x1F) + 160; + } + else + { + spark->scalar = 0; + spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + 14; + spark->size = spark->sSize = (GetRandomControl() & 7) + 8; + } + + spark->dSize = spark->size >> 1; +} + +void TriggerLaraElectricitySparks(int flame) +{ + PHD_VECTOR pos; + pos.x = 0; + pos.y = 0; + pos.z = 0; + + GetLaraJointPosition(&pos, GetRandomControl() % 15); + + SPARKS* spark = &Sparks[GetFreeSpark()]; + + spark->on = 1; + spark->dR = 0; + spark->colFadeSpeed = 8; + byte color = (GetRandomControl() & 0x3F) - 64; + spark->sR = color; + spark->sB = color; + spark->sG = color; + spark->dB = color; + spark->dG = color >> 1; + spark->transType = COLADD; + spark->fadeToBlack = 4; + spark->life = 12; + spark->sLife = 12; + spark->x = pos.x; + spark->y = pos.y; + spark->z = pos.z; + spark->xVel = 2 * (GetRandomControl() & 0x1FF) - 512; + spark->yVel = 2 * (GetRandomControl() & 0x1FF) - 512; + spark->zVel = 2 * (GetRandomControl() & 0x1FF) - 512; + spark->friction = 51; + spark->maxYvel = 0; + spark->gravity = 0; + spark->flags = SP_NONE; + + if (flame) + TriggerFireFlame(pos.x, pos.y, pos.z, -1, 254); +} + +int ElectricityWireCheckDeadlyBounds(PHD_VECTOR* pos, short delta) +{ + if (pos->x + delta >= DeadlyBounds[0] && pos->x - delta <= DeadlyBounds[1] + && pos->y + delta >= DeadlyBounds[2] && pos->y - delta <= DeadlyBounds[3] + && pos->z + delta >= DeadlyBounds[4] && pos->z - delta <= DeadlyBounds[5]) + { + return 1; + } + + return 0; +} + +void ElectricityWiresControl(short itemNumber) +{ + bool flag = false; + int counter = 3; + + ITEM_INFO* item = &Items[itemNumber]; + + if (item->itemFlags[0] > 2) + { + TriggerDynamicLight( + LaraItem->pos.xPos, + LaraItem->pos.yPos, + LaraItem->pos.zPos, + item->itemFlags[0], + 0, + (GetRandomControl() & 0x1F) + 8 * item->itemFlags[0], + (GetRandomControl() & 0x1F) + 8 * item->itemFlags[0]); + + item->itemFlags[0] -= 2; + } + + if (TriggerActive(item)) + { + SoundEffect(SFX_ELECTRIC_WIRES, &item->pos, 0); + + counter = (abs(LaraItem->pos.xPos - item->pos.xPos) > 2048) + + (abs(LaraItem->pos.zPos - item->pos.zPos) > 2048) + + (abs(LaraItem->pos.yPos - item->pos.yPos) > 4096); + + int x = (GetRandomControl() & 0x1F) - 16; + int z = (GetRandomControl() & 0x1F) - 16; + + for (int i = 0; i < 3; i++) + { + if (GetRandomControl() & 1) + TriggerElectricityWiresSparks(x, z, itemNumber, i + 2, 0); + } + + if (!(GlobalCounter & 3)) + { + TriggerElectricityWiresSparks(0, 0, itemNumber, 2, 1); + TriggerElectricityWiresSparks(0, 0, itemNumber, 3, 1); + TriggerElectricityWiresSparks(0, 0, itemNumber, 4, 1); + } + } + else + { + flag = true; + } + + AnimateItem(item); + + if (!Lara.burn && !flag && !counter) + { + GetLaraDeadlyBounds(); + + int i = 2; + while (true) + { + PHD_VECTOR pos; + pos.x = 0; + pos.y = 0; + pos.z = 0; + + GetJointAbsPosition(item, &pos, i); + + if (ElectricityWireCheckDeadlyBounds(&pos, item->triggerFlags)) + { + for (int i = 0; i < 48; i++) + { + TriggerLaraElectricitySparks(0); + } + + item->itemFlags[0] = 28; + LaraBurn(); + Lara.burnBlue = 1; + Lara.burnCount = 48; + LaraItem->hitPoints = 0; + return; + } + + i += 3; + if (i >= 27) + break; + } + } + + int i = 8; + int j = 0; + counter = GlobalCounter % 3; + short roomNumber = item->roomNumber; + bool water = false; + + do + { + PHD_VECTOR pos; + pos.x = 0; + pos.y = 0; + pos.z = 256; + GetJointAbsPosition(item, &pos, i); + + if (GetRandomControl() & 1 && !flag) + { + TriggerDynamicLight(pos.x, pos.y, pos.z, 12, 0, ((GetRandomControl() & 0x3F) + 128) >> 1, (GetRandomControl() & 0x3F) + 128); + } + + roomNumber = item->roomNumber; + GetFloor(pos.x, pos.y, pos.z, &roomNumber); + ROOM_INFO* r = &Rooms[roomNumber]; + + if (r->flags & ENV_FLAG_WATER) + { + if (counter == j) + { + SetupRipple(pos.x, r->maxceiling, pos.z, (GetRandomControl() & 7) + 32, 16); + } + + water = true; + } + + i += 9; + j++; + } while (i < 27); + + if (!flag && !Lara.burn) + { + if (water) + { + int flipNumber = Rooms[roomNumber].flipNumber; + + PHD_VECTOR pos1; + pos1.x = 0; + pos1.y = 0; + pos1.z = 0; + GetLaraJointPosition(&pos1, LM_LFOOT); + + short roomNumber1 = LaraItem->roomNumber; + GetFloor(pos1.x, pos1.y, pos1.z, &roomNumber1); + + PHD_VECTOR pos2; + pos2.x = 0; + pos2.y = 0; + pos2.z = 0; + GetLaraJointPosition(&pos2, LM_RFOOT); + + short roomNumber2 = LaraItem->roomNumber; + GetFloor(pos2.x, pos2.y, pos2.z, &roomNumber2); + + if (Rooms[roomNumber1].flipNumber == flipNumber + || Rooms[roomNumber2].flipNumber == flipNumber) + { + if (LaraItem->hitPoints > 32) + { + SoundEffect(SFX_LARA_ELECTRIC_CRACKLES, &LaraItem->pos, 0); + TriggerLaraElectricitySparks(0); + TriggerLaraElectricitySparks(1); + TriggerDynamicLight(pos1.x, pos1.y, pos1.z, 8, 0, GetRandomControl() & 0x7F, (GetRandomControl() & 0x3F) + 128); + LaraItem->hitPoints -= 10; + } + else + { + item->itemFlags[0] = 28; + LaraBurn(); + Lara.burnBlue = 1; + Lara.burnCount = 48; + LaraItem->hitPoints = 0; + } + } + } + } +} + +void InitialiseRomeHammer(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + item->itemFlags[0] = 2; + item->itemFlags[3] = 250; +} + +void FallingCeilingControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (item->currentAnimState) + { + if (item->currentAnimState == 1 && item->touchBits) + { + LaraItem->hitPoints -= 300; + LaraItem->hitStatus = true; + } + } + else + { + item->goalAnimState = 1; + item->gravityStatus = true;; + } + + AnimateItem(item); + + if (item->status == ITEM_DESACTIVATED) + { + RemoveActiveItem(itemNumber); + } + else + { + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + item->floor = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + + if (roomNumber != item->roomNumber) + ItemNewRoom(itemNumber, roomNumber); + + if (item->currentAnimState == 1) + { + if (item->pos.yPos >= item->floor) + { + item->pos.yPos = item->floor; + item->gravityStatus = false; + item->goalAnimState = 2; + item->fallspeed = 0; + } + } + } +} + +void RollingBallCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (TestBoundsCollide(item, l, coll->radius)) + { + if (TestCollision(item, l)) + { + if (TriggerActive(item) && (item->itemFlags[0] || item->fallspeed)) + { + LaraItem->animNumber = ANIMATION_LARA_SQUASH_BOULDER; + LaraItem->frameNumber = Anims[LaraItem->animNumber].frameBase; + LaraItem->goalAnimState = STATE_LARA_DEATH; + LaraItem->currentAnimState = STATE_LARA_DEATH; + LaraItem->gravityStatus = false; + } + else + { + ObjectCollision(itemNumber, l, coll); + } + } + } +} + +void RollingBallControl(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + if (!TriggerActive(item)) + return; + + item->fallspeed += GRAVITY; + + item->pos.xPos += item->itemFlags[0] >> 5; + item->pos.yPos += item->fallspeed; + item->pos.zPos += item->itemFlags[1] >> 5; + + short roomNumber = item->roomNumber; + FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + int height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + int dh = height - 512; + + if (item->pos.yPos > height - 512) + { + if (abs(item->fallspeed) > 16) + { + int distance = sqrt( + SQUARE(Camera.pos.x - item->pos.xPos) + + SQUARE(Camera.pos.y - item->pos.yPos) + + SQUARE(Camera.pos.z - item->pos.zPos)); + + if (distance < 16384) + Camera.bounce = -((16384 - distance) * abs(item->fallspeed) >> 14); + } + + if (item->pos.yPos - dh < 512) + item->pos.yPos = dh; + + if (item->fallspeed <= 64) + { + if (abs(item->speed) <= 512 || GetRandomControl() & 0x1F) + item->fallspeed = 0; + else + item->fallspeed = -(short)(GetRandomControl() % (item->speed >> 3)); + } + else + { + item->fallspeed = -(short)(item->fallspeed >> 2); + } + } + + int x = item->pos.xPos; + int y = item->pos.yPos; + int z = item->pos.zPos; + + floor = GetFloor(x, y, z + 128, &roomNumber); + int y1a = GetFloorHeight(floor, x, y, z + 128) - 512; + + floor = GetFloor(x, y, z - 128, &roomNumber); + int y2a = GetFloorHeight(floor, x, y, z - 128) - 512; + + floor = GetFloor(x + 128, y, z, &roomNumber); + int y3a = GetFloorHeight(floor, x + 128, y, z) - 512; + + floor = GetFloor(x - 128, y, z, &roomNumber); + int y4a = GetFloorHeight(floor, x - 128, y, z) - 512; + + floor = GetFloor(x, y, z + 512, &roomNumber); + int y1b = GetFloorHeight(floor, x, y, z + 512) - 512; + + floor = GetFloor(x, y, z - 512, &roomNumber); + int y2b = GetFloorHeight(floor, x, y, z - 512) - 512; + + floor = GetFloor(x + 512, y, z, &roomNumber); + int y3b = GetFloorHeight(floor, x + 512, y, z) - 512; + + floor = GetFloor(x - 512, y, z, &roomNumber); + int y4b = GetFloorHeight(floor, x - 512, y, z) - 512; + + if (item->pos.yPos - dh > -256 + || item->pos.yPos - y1b >= 512 + || item->pos.yPos - y3b >= 512 + || item->pos.yPos - y2b >= 512 + || item->pos.yPos - y4b >= 512) + { + int counterZ = 0; + + if (y1a - dh <= 256) + { + if (y1b - dh < -1024 || y1a - dh < -256) + { + if (item->itemFlags[1] <= 0) + { + if (!item->itemFlags[1] && item->itemFlags[0]) + { + item->pos.zPos = (item->pos.zPos & 0xFFFFFE00) + 512; + } + } + else + { + item->itemFlags[1] = -item->itemFlags[1] >> 1; + item->pos.zPos = (item->pos.zPos & 0xFFFFFE00) + 512; + } + } + else if (y1a == dh) + { + counterZ = 1; + } + else + { + item->itemFlags[1] += (y1a - dh) >> 1; + } + } + + if (y2a - dh <= 256) + { + if (y2b - dh < -1024 || y2a - dh < -256) + { + if (item->itemFlags[1] >= 0) + { + if (!item->itemFlags[1] && item->itemFlags[0]) + { + item->pos.zPos = (item->pos.zPos & 0xFFFFFE00) + 512; + } + } + else + { + item->itemFlags[1] = -item->itemFlags[1] >> 1; + item->pos.zPos = (item->pos.zPos & 0xFFFFFE00) + 512; + } + } + else if (y2a == dh) + { + counterZ++; + } + else + { + item->itemFlags[1] -= (y2a - dh) >> 1; + } + } + + if (counterZ == 2) + { + if (abs(item->itemFlags[1]) <= 64) + item->itemFlags[1] = 0; + else + item->itemFlags[1] = item->itemFlags[1] - (item->itemFlags[1] >> 6); + } + + int counterX = 0; + + if (y4a - dh <= 256) + { + if (y4b - dh < -1024 || y4a - dh < -256) + { + if (item->itemFlags[0] >= 0) + { + if (!item->itemFlags[0] && item->itemFlags[1]) + { + item->pos.xPos = (item->pos.xPos & 0xFFFFFE00) + 512; + } + } + else + { + item->itemFlags[0] = -item->itemFlags[0] >> 1; + item->pos.xPos = (item->pos.xPos & 0xFFFFFE00) + 512; + } + } + else if (y4a == dh) + { + counterX = 1; + } + else + { + item->itemFlags[0] -= (y4a - dh) >> 1; + } + } + + if (y3a - dh <= 256) + { + if (y3b - dh < -1024 || y3a - dh < -256) + { + if (item->itemFlags[0] <= 0) + { + if (!item->itemFlags[0] && item->itemFlags[1]) + { + item->pos.xPos = (item->pos.xPos & 0xFFFFFE00) + 512; + } + } + else + { + item->itemFlags[0] = -item->itemFlags[0] >> 1; + item->pos.xPos = (item->pos.xPos & 0xFFFFFE00) + 512; + } + } + else if (y3a == dh) + { + counterX++; + } + else + { + item->itemFlags[0] += (y3a - dh) >> 1; + } + } + + if (counterX == 2) + { + if (abs(item->itemFlags[0]) <= 64) + item->itemFlags[0] = 0; + else + item->itemFlags[0] = item->itemFlags[0] - (item->itemFlags[0] >> 6); + } + } + + GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + + if (item->roomNumber != roomNumber) + ItemNewRoom(itemNumber, roomNumber); + + if (item->itemFlags[0] <= 3072) + { + if (item->itemFlags[0] < -3072) + item->itemFlags[0] = -3072; + } + else + { + item->itemFlags[0] = 3072; + } + + if (item->itemFlags[1] <= 3072) + { + if (item->itemFlags[1] < -3072) + item->itemFlags[1] = -3072; + } + else + { + item->itemFlags[1] = 3072; + } + + short angle = 0; + + if (item->itemFlags[1] || item->itemFlags[0]) + angle = phd_atan(item->itemFlags[1], item->itemFlags[0]); + else + angle = item->pos.yRot; + + if (item->pos.yRot != angle) + { + if (((angle - item->pos.yRot) & 0x7FFFu) >= 0x200) + { + if (angle <= item->pos.yRot || angle - item->pos.yRot >= 0x8000) + item->pos.yRot -= 512; + else + item->pos.yRot += 512; + } + else + { + item->pos.yRot = angle; + } + } + + item->pos.xRot -= (abs(item->itemFlags[0]) + abs(item->itemFlags[1])) >> 1; + + roomNumber = item->roomNumber; + floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); + GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); + TestTriggers(TriggerIndex, 1, 0); +} \ No newline at end of file diff --git a/TR5Main/Objects/trap.cpp b/TR5Main/Objects/trap.cpp deleted file mode 100644 index 592cda0bb..000000000 --- a/TR5Main/Objects/trap.cpp +++ /dev/null @@ -1,1054 +0,0 @@ -#include "newobjects.h" -#include "../Game/Box.h" -#include "../Game/items.h" -#include "../Game/lot.h" -#include "../Game/control.h" -#include "../Game/people.h" -#include "../Game/effects.h" -#include "../Game/effect2.h" -#include "../Game/draw.h" -#include "../Game/sphere.h" -#include "../Game/inventory.h" -#include "../Game/collide.h" -#include "../Game/draw.h" -#include "../Game/tomb4fx.h" -#include "../Game/lara.h" -#include "../Game/sound.h" -#include "../Game/misc.h" -#include "../Specific/setup.h" -#include "..\Specific\level.h" - -short StargateBounds[24] = -{ - 0xFE00, 0x0200, 0xFC00, 0xFC80, 0xFFA0, 0x0060, 0xFE00, 0x0200, - 0xFF80, 0x0000, 0xFFA0, 0x0060, 0xFE00, 0xFE80, 0xFC00, 0x0000, - 0xFFA0, 0x0060, 0x0180, 0x0200, 0xFC00, 0x0000, 0xFFA0, 0x0060 -}; - -BITE_INFO sentryGunBite = { 0, 0, 0, 8 }; - -void FourBladesControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (!TriggerActive(item)) - { - item->frameNumber = Anims[item->animNumber].frameBase; - item->itemFlags[0] = 0; - } - else - { - short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; - - if (frameNumber <= 5 || frameNumber >= 58 || frameNumber >= 8 && frameNumber <= 54) - item->itemFlags[0] = 0; - else - { - if (frameNumber >= 6 && frameNumber <= 7) - { - item->itemFlags[3] = 20; - item->itemFlags[0] = 30; - } - else - { - if (frameNumber >= 55 && frameNumber <= 57) - { - item->itemFlags[3] = 200; - item->itemFlags[0] = 30; - } - } - } - - AnimateItem(item); - } -} - -void BirdBladeControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - item->itemFlags[3] = 100; - if (!TriggerActive(item)) - { - item->frameNumber = Anims[item->animNumber].frameBase; - item->itemFlags[0] = 0; - } - else - { - short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; - - if (frameNumber <= 14 || frameNumber >= 31) - item->itemFlags[0] = 0; - else - item->itemFlags[0] = 6; - - AnimateItem(item); - } -} - -void CatwalkBlaldeControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (!TriggerActive(item)) - { - item->frameNumber = Anims[item->animNumber].frameBase; - item->itemFlags[0] = 0; - } - else - { - short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; - - if (item->frameNumber == Anims[item->animNumber].frameEnd || frameNumber < 38) - item->itemFlags[3] = 0; - else - item->itemFlags[3] = 100; - - AnimateItem(item); - } -} - -void PlinthBladeControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (!TriggerActive(item)) - { - item->frameNumber = Anims[item->animNumber].frameBase; - } - else - { - short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; - - if (item->frameNumber == Anims[item->animNumber].frameEnd) - item->itemFlags[3] = 0; - else - item->itemFlags[3] = 200; - - AnimateItem(item); - } -} - -void InitialiseSethBlade(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - item->animNumber = Objects[ID_SETH_BLADE].animIndex + 1; - item->goalAnimState = 2; - item->currentAnimState = 2; - item->frameNumber = Anims[item->animNumber].frameBase; - item->itemFlags[2] = abs(item->triggerFlags); -} - -void SethBladeControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - item->itemFlags[0] = 0; - if (TriggerActive(item)) - { - if (item->currentAnimState == 2) - { - if (item->itemFlags[2] > 1) - { - item->itemFlags[2]--; - } - else if (item->itemFlags[2] == 1) - { - item->goalAnimState = 1; - item->itemFlags[2] = 0; - } - else if (!item->itemFlags[2]) - { - if (item->triggerFlags > 0) - { - item->itemFlags[2] = item->triggerFlags; - } - } - } - else - { - short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; - - if (item->frameNumber != Anims[item->animNumber].frameBase && frameNumber <= 6) - { - item->itemFlags[0] = -1; - item->itemFlags[3] = 1000; - } - else if (frameNumber >= 7 && frameNumber <= 15) - { - item->itemFlags[0] = 448; - item->itemFlags[3] = 1000; - } - else - { - item->itemFlags[0] = 0; - item->itemFlags[3] = 1000; - } - } - - AnimateItem(item); - } -} - -void ChainControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (item->triggerFlags) - { - item->itemFlags[2] = 1; - item->itemFlags[3] = 75; - - if (TriggerActive(item)) - { - item->itemFlags[0] = 30846; - AnimateItem(item); - return; - } - } - else - { - item->itemFlags[3] = 25; - - if (TriggerActive(item)) - { - item->itemFlags[0] = 1920; - AnimateItem(item); - return; - } - } - - item->itemFlags[0] = 0; -} - -void PloughControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - item->itemFlags[3] = 50; - if (TriggerActive(item)) - { - item->itemFlags[0] = 258048; - AnimateItem(item); - } - else - { - item->itemFlags[0] = 0; - } -} - -void CogControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (TriggerActive(item)) - { - item->status = ITEM_ACTIVE; - // *(_DWORD *)&item->gap4C[5526] = *(_DWORD *)&item->gap4C[5526] & 0xFFFFFFFB | 2; - AnimateItem(item); - - if (item->triggerFlags == 666) - { - PHD_VECTOR pos; - GetJointAbsPosition(item, &pos, 0); - SoundEffect(65, (PHD_3DPOS *)&pos, 0); - - if (item->frameNumber == Anims[item->animNumber].frameEnd) - item->flags &= 0xC1; - } - } - else if (item->triggerFlags == 2) - { - item->status |= ITEM_INVISIBLE; - } -} - -void SpikeballControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (TriggerActive(item)) - { - short frameNumber = item->frameNumber - Anims[item->animNumber].frameBase; - - if ((frameNumber <= 14 || frameNumber >= 24) && (frameNumber < 138 || frameNumber > 140)) - { - if (frameNumber < 141) - item->itemFlags[0] = 0; - else - { - item->itemFlags[3] = 50; - item->itemFlags[0] = 0x7FF800; - } - } - else - { - item->itemFlags[3] = 150; - item->itemFlags[0] = 0x7FF800; - } - - AnimateItem(item); - } - else - { - item->frameNumber = Anims[item->animNumber].frameBase; - item->itemFlags[0] = 0; - } -} - -void StargateControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - item->itemFlags[3] = 50; - - if (TriggerActive(item)) - { - SoundEffect(SFX_TR4_STARGATE_SWIRL, &item->pos, 0); - item->itemFlags[0] = 57521664; - AnimateItem(item); - } - else - item->itemFlags[0] = 0; -} - -void StargateCollision(short itemNum, ITEM_INFO* l, COLL_INFO* c) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (item->status == ITEM_INVISIBLE) - return; - - if (TestBoundsCollide(item, l, c->radius)) - { - for (int i = 0; i < 8; i++) - { - GlobalCollisionBounds.X1 = StargateBounds[3 * i + 0]; - GlobalCollisionBounds.Y1 = StargateBounds[3 * i + 1]; - GlobalCollisionBounds.Z1 = StargateBounds[3 * i + 2]; - - if (TestWithGlobalCollisionBounds(item, l, c)) - ItemPushLara(item, l, c, 0, 2); - } - - int result = TestCollision(item, l); - if (result) - { - result &= item->itemFlags[0]; - int flags = item->itemFlags[0]; - - if (result) - { - int j = 0; - do - { - if (result & 1) - { - GlobalCollisionBounds.X1 = CreatureSpheres[j].x - CreatureSpheres[j].r - item->pos.xPos; - GlobalCollisionBounds.Y1 = CreatureSpheres[j].y - CreatureSpheres[j].r - item->pos.yPos; - GlobalCollisionBounds.Z1 = CreatureSpheres[j].z - CreatureSpheres[j].r - item->pos.zPos; - GlobalCollisionBounds.X2 = CreatureSpheres[j].x + CreatureSpheres[j].r - item->pos.xPos; - GlobalCollisionBounds.Y2 = CreatureSpheres[j].y + CreatureSpheres[j].r - item->pos.yPos; - GlobalCollisionBounds.Z2 = CreatureSpheres[j].z + CreatureSpheres[j].r - item->pos.zPos; - - int oldX = LaraItem->pos.xPos; - int oldY = LaraItem->pos.yPos; - int oldZ = LaraItem->pos.zPos; - - if (ItemPushLara(item, l, c, flags & 1, 2)) - { - if ((flags & 1) && - (oldX != LaraItem->pos.xPos || oldY != LaraItem->pos.yPos || oldZ != LaraItem->pos.zPos) && - TriggerActive(item)) - { - DoBloodSplat((GetRandomControl() & 0x3F) + l->pos.xPos - 32, - (GetRandomControl() & 0x1F) + CreatureSpheres[j].y - 16, - (GetRandomControl() & 0x3F) + l->pos.zPos - 32, - (GetRandomControl() & 3) + 2, - 2 * GetRandomControl(), - l->roomNumber); - LaraItem->hitPoints -= 100; - } - } - } - - result >>= 1; - j++; - flags >>= 1; - - } while (result); - } - } - } -} - -void ControlSpikyWall(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - /* Move wall */ - if (TriggerActive(item) && item->status != ITEM_DEACTIVATED) - { - int x = item->pos.xPos + phd_sin(item->pos.yRot) >> WALL_SHIFT; - int z = item->pos.zPos + phd_cos(item->pos.yRot) >> WALL_SHIFT; - - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(x, item->pos.yPos, z, &roomNumber); - - if (GetFloorHeight(floor, x, item->pos.yPos, z) != item->pos.yPos) - { - item->status = ITEM_DEACTIVATED; - StopSoundEffect(SFX_ROLLING_BALL); - } - else - { - item->pos.xPos = x; - item->pos.zPos = z; - if (roomNumber != item->roomNumber) - ItemNewRoom(itemNum, roomNumber); - SoundEffect(SFX_ROLLING_BALL, &item->pos, 0); - } - } - - if (item->touchBits) - { - LaraItem->hitPoints -= 15; - LaraItem->hitStatus = true; - - DoLotsOfBlood(LaraItem->pos.xPos, LaraItem->pos.yPos - 512, LaraItem->pos.zPos, 4, item->pos.yRot, LaraItem->roomNumber, 3); - item->touchBits = 0; - - SoundEffect(56, &item->pos, 0); - } -} - -void InitialiseSpinningBlade(short item_number) -{ - ITEM_INFO* item = &Items[item_number]; - - item->animNumber = Objects[item->objectNumber].animIndex + 3; - item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = 1; -} - -void SpinningBlade(short item_number) -{ - bool spinning = false; - - ITEM_INFO* item = &Items[item_number]; - - if (item->currentAnimState == 2) - { - if (item->goalAnimState != 1) - { - int x = item->pos.xPos + (WALL_SIZE * 3 / 2 * phd_sin(item->pos.yRot) >> W2V_SHIFT); - int z = item->pos.zPos + (WALL_SIZE * 3 / 2 * phd_cos(item->pos.yRot) >> W2V_SHIFT); - - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(x, item->pos.yPos, z, &roomNumber); - int height = GetFloorHeight(floor, x, item->pos.yPos, z); - - if (height == NO_HEIGHT) - item->goalAnimState = 1; - } - - spinning = true; - - if (item->touchBits) - { - LaraItem->hitStatus = true; - LaraItem->hitPoints -= 100; - - DoLotsOfBlood(LaraItem->pos.xPos, LaraItem->pos.yPos - STEP_SIZE * 2, LaraItem->pos.zPos, (short)(item->speed * 2), LaraItem->pos.yRot, LaraItem->roomNumber, 2); - } - - SoundEffect(231, &item->pos, 0); - } - else - { - if (TriggerActive(item)) - item->goalAnimState = 2; - spinning = false; - } - - AnimateItem(item); - - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - item->floor = item->pos.yPos = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos); - if (roomNumber != item->roomNumber) - ItemNewRoom(item_number, roomNumber); - - if (spinning && item->currentAnimState == 1) - item->pos.yRot += -ANGLE(180); -} - -void InitialiseKillerStatue(short item_number) -{ - ITEM_INFO* item = &Items[item_number]; - - item->animNumber = Objects[item->objectNumber].animIndex + 3; - item->frameNumber = Anims[item->animNumber].frameBase; - item->currentAnimState = 1; -} - -void KillerStatueControl(short item_number) -{ - ITEM_INFO *item; - int x, y, z; - short d; - - item = &Items[item_number]; - - if (TriggerActive(item) && item->currentAnimState == 1) - item->goalAnimState = 2; - else - item->goalAnimState = 1; - - if ((item->touchBits & 0x80) && item->currentAnimState == 2) - { - LaraItem->hitStatus = 1; - LaraItem->hitPoints -= 20; - - int x = LaraItem->pos.xPos + (GetRandomControl() - 16384) / 256; - int z = LaraItem->pos.zPos + (GetRandomControl() - 16384) / 256; - int y = LaraItem->pos.yPos - GetRandomControl() / 44; - int d = (GetRandomControl() - 16384) / 8 + LaraItem->pos.yRot; - DoBloodSplat(x, y, z, LaraItem->speed, d, LaraItem->roomNumber); - } - - AnimateItem(item); -} - -void SpringBoardControl(short item_number) -{ - ITEM_INFO* item = &Items[item_number]; - - if (item->currentAnimState == 0 && LaraItem->pos.yPos == item->pos.yPos && - (LaraItem->pos.xPos >> WALL_SHIFT) == (item->pos.xPos >> WALL_SHIFT) && - (LaraItem->pos.zPos >> WALL_SHIFT) == (item->pos.zPos >> WALL_SHIFT)) - { - if (LaraItem->hitPoints <= 0) - return; - - if (LaraItem->currentAnimState == STATE_LARA_WALK_BACK || LaraItem->currentAnimState == STATE_LARA_RUN_BACK) - LaraItem->speed = -LaraItem->speed; - - LaraItem->fallspeed = -240; - LaraItem->gravityStatus = true; - LaraItem->animNumber = ANIMATION_LARA_FREE_FALL_FORWARD; - LaraItem->frameNumber = GF2(ID_LARA, ANIMATION_LARA_FREE_FALL_FORWARD, 0); - LaraItem->currentAnimState = STATE_LARA_JUMP_FORWARD; - LaraItem->goalAnimState = STATE_LARA_JUMP_FORWARD; - - item->goalAnimState = 1; - } - - AnimateItem(item); -} - -void InitialiseSlicerDicer(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - int dx = phd_sin(item->pos.yRot + ANGLE(90)) >> 5; - int dz = phd_cos(item->pos.yRot + ANGLE(90)) >> 5; - - item->pos.xPos += dx; - item->pos.zPos += dz; - - item->itemFlags[0] = item->pos.xPos >> 8; - item->itemFlags[1] = (item->pos.yPos - 4608) >> 8; - item->itemFlags[2] = item->pos.zPos >> 8; - item->itemFlags[3] = 50; -} - -void SlicerDicerControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP1, &item->pos, 0); - SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP, &item->pos, 0); - - int factor = (9 * phd_cos(item->triggerFlags) << 9 >> W2V_SHIFT) * phd_cos(item->pos.yRot) >> W2V_SHIFT; - - item->pos.xPos = (item->itemFlags[0] << 8) + factor; - item->pos.yPos = (item->itemFlags[1] << 8) - 4608 * phd_sin(item->triggerFlags); - item->pos.zPos = (item->itemFlags[2] << 8) + factor; - - item->triggerFlags += 170; - - short roomNumber = item->roomNumber; - GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber); - if (item->roomNumber != roomNumber) - ItemNewRoom(itemNum, roomNumber); - - AnimateItem(item); -} - -void BladeCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (item->status == ITEM_INVISIBLE) - return; - - if (item->itemFlags[3]) // Check this - { - if (TestBoundsCollide(item, l, coll->radius)) - { - int oldX = LaraItem->pos.xPos; - int oldY = LaraItem->pos.yPos; - int oldZ = LaraItem->pos.zPos; - - int dx = 0; - int dy = 0; - int dz = 0; - - if (ItemPushLara(item, l, coll, 1, 1)) - { - LaraItem->hitPoints -= item->itemFlags[3]; - - dx = oldX - LaraItem->pos.xPos; - dy = oldY - LaraItem->pos.yPos; - dz = oldZ - LaraItem->pos.zPos; - - if ((dx || dy || dz) && TriggerActive(item)) - { - DoBloodSplat((GetRandomControl() & 0x3F) + l->pos.xPos - 32, - l->pos.yPos - (GetRandomControl() & 0x1FF) - 256, - (GetRandomControl() & 0x3F) + l->pos.zPos - 32, - (GetRandomControl() & 3) + (item->itemFlags[3] >> 5) + 2, - 2 * GetRandomControl(), - l->roomNumber); - } - - if (!coll->enableBaddiePush) - { - LaraItem->pos.xPos += dx; - LaraItem->pos.yPos += dy; - LaraItem->pos.zPos += dz; - } - } - } - } -} - -void InitialiseMine(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (item->triggerFlags) - item->meshBits = 0; -} - -void MineControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - int num = GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity); - if (item->itemFlags[0] >= 150) - { - SoundEffect(SFX_EXPLOSION1, &item->pos, 0); - SoundEffect(SFX_EXPLOSION2, &item->pos, 0); - SoundEffect(SFX_EXPLOSION1, &item->pos, 0x1800004); - - if (num > 0) - { - SPHERE* sphere = &CreatureSpheres[0]; - - for (int i = 0; i < num; i++) - { - if (i >= 7 && i != 9) - { - TriggerExplosionSparks(sphere->x, sphere->y, sphere->z, 3, -2, 0, -item->roomNumber); - TriggerExplosionSparks(sphere->x, sphere->y, sphere->z, 3, -1, 0, -item->roomNumber); - TriggerShockwave((PHD_3DPOS*)sphere, 48, 304, (GetRandomControl() & 0x1F) + 112, 0, 96, 128, 32, 2048, 0); - } - - sphere++; - } - - for (int i = 0; i < num; i++) - ExplodeItemNode(item, i, 0, -128); - } - - FlashFadeR = 255; - FlashFadeG = 192; - FlashFadeB = 64; - FlashFader = 32; - - short currentItemNumber = Rooms[item->roomNumber].itemNumber; - - // Make the sentry gun explode? - while (currentItemNumber != NO_ITEM) - { - ITEM_INFO* currentItem = &Items[currentItemNumber]; - - if (currentItem->objectNumber == ID_SENTRY_GUN) - currentItem->meshBits &= ~0x40; - - currentItemNumber = currentItem->nextItem; - } - - KillItem(itemNum); - } - else - { - item->itemFlags[0]++; - - int something = 4 * item->itemFlags[0]; - if (something > 255) - something = 0; - - for (int i = 0; i < num; i++) - { - SPHERE* sphere = &CreatureSpheres[i]; - - if (i == 0 || i > 5) - AddFire(sphere->x, sphere->y, sphere->z, 2, item->roomNumber, something); - - sphere++; - } - - SoundEffect(SFX_LOOP_FOR_SMALL_FIRES, &item->pos, 0); - } -} - -void MineCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (item->triggerFlags && !item->itemFlags[3]) - { - if (l->animNumber != 432 || l->frameNumber < Anims[item->animNumber].frameBase + 57) - { - if (TestBoundsCollide(item, l, 512)) - { - TriggerExplosionSparks(item->pos.xPos, item->pos.yPos, item->pos.zPos, 3, -2, 0, item->roomNumber); - for (int i = 0; i < 2; i++) - TriggerExplosionSparks(item->pos.xPos, item->pos.yPos, item->pos.zPos, 3, -1, 0, item->roomNumber); - - item->meshBits = 1; - - ExplodeItemNode(item, 0, 0, 128); - KillItem(itemNum); - - l->animNumber = 438; - l->frameNumber = Anims[item->animNumber].frameBase; - l->currentAnimState = 8; - l->speed = 0; - - SoundEffect(SFX_TR4_MINE_EXP_OVERLAY, &item->pos, 0); - } - } - else - { - for (int i = 0; i < LevelItems; i++) - { - ITEM_INFO* currentItem = &Items[i]; - - // Explode other mines - if (currentItem->objectNumber == ID_MINE && currentItem->status != ITEM_INVISIBLE && !currentItem->triggerFlags) - { - TriggerExplosionSparks( - currentItem->pos.xPos, - currentItem->pos.yPos, - currentItem->pos.zPos, - 3, - -2, - 0, - currentItem->roomNumber); - - for (int j = 0; j < 2; j++) - TriggerExplosionSparks( - currentItem->pos.xPos, - currentItem->pos.yPos, - currentItem->pos.zPos, - 3, - -1, - 0, - currentItem->roomNumber); - - currentItem->meshBits = 1; - - ExplodeItemNode(currentItem, 0, 0, -32); - KillItem(i); - - if (!(GetRandomControl() & 3)) - SoundEffect(SFX_TR4_MINE_EXP_OVERLAY, ¤tItem->pos, 0); - - currentItem->status = ITEM_INVISIBLE; - } - } - } - } -} - -void InitialiseSentryGun(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - ClearItem(itemNum); - - item->itemFlags[0] = 0; - item->itemFlags[1] = 768; - item->itemFlags[2] = 0; -} - -void SentryGunControl(short itemNum) -{ - ITEM_INFO* item = &Items[itemNum]; - - if (!CreatureActive(itemNum)) - return; - - CREATURE_INFO* creature = (CREATURE_INFO*)item->data; - - AI_INFO info; - int c = 0; - - if (creature) - { - // Flags set by the ID_MINE object? - if (item->meshBits & 0x40) - { - if (item->itemFlags[0]) - { - PHD_VECTOR pos; - - pos.x = sentryGunBite.x; - pos.y = sentryGunBite.y; - pos.z = sentryGunBite.z; - - GetJointAbsPosition(item, &pos, sentryGunBite.meshNum); - - TriggerDynamicLight(pos.x, pos.y, pos.z, 4 * item->itemFlags[0] + 12, 24, 16, 4); - - item->itemFlags[0]--; - } - - if (item->itemFlags[0] & 1) - item->meshBits |= 0x100; - else - item->meshBits &= ~0x100; - - if (item->triggerFlags == 0) - { - item->pos.yPos -= 512; - CreatureAIInfo(item, &info); - item->pos.yPos += 512; - - int deltaAngle = info.angle - creature->jointRotation[0]; - //printf("Angle: %d\n", (int)TO_DEGREES(info.angle)); - - info.ahead = true; - if (deltaAngle <= -ANGLE(90) || deltaAngle >= ANGLE(90)) - info.ahead = false; - - if (Targetable(item, &info)) - { - if (info.distance < SQUARE(9 * WALL_SIZE)) - { - if (!g_Inventory->IsObjectPresentInInventory(ID_PUZZLE_ITEM5) && - !item->itemFlags[0]) - { - if (info.distance <= SQUARE(2048)) - { - // Throw fire - SentryGunThrowFire(item); - c = 4 * rcossin_tbl[(GlobalCounter & 0x1F) << 11 >> 3] >> 2; - } - else - { - // Shot to Lara with bullets - c = 0; - item->itemFlags[0] = 2; - - ShotLara(item, &info, &sentryGunBite, creature->jointRotation[0], 5); - SoundEffect(SFX_TR4_AUTOGUNS, &item->pos, 0); - - item->itemFlags[2] += 256; - if (item->itemFlags[2] > 6144) - { - item->itemFlags[2] = 6144; - } - } - } - - deltaAngle = c + info.angle - creature->jointRotation[0]; - if (deltaAngle <= ANGLE(10)) - { - if (deltaAngle < -ANGLE(10)) - { - deltaAngle = -ANGLE(10); - } - } - else - { - deltaAngle = ANGLE(10); - } - - creature->jointRotation[0] += deltaAngle; - - CreatureJoint(item, 1, -info.xAngle); - } - } - - item->itemFlags[2] -= 32; - - if (item->itemFlags[2] < 0) - { - item->itemFlags[2] = 0; - } - - creature->jointRotation[3] += item->itemFlags[2]; - creature->jointRotation[2] += item->itemFlags[1]; - - if (creature->jointRotation[2] > ANGLE(90) || - creature->jointRotation[2] < -ANGLE(90)) - { - item->itemFlags[1] = -item->itemFlags[1]; - } - } - else - { - // Stuck sentry gun - CreatureJoint(item, 0, (GetRandomControl() & 0x7FF) - 1024); - CreatureJoint(item, 1, ANGLE(45)); - CreatureJoint(item, 2, (GetRandomControl() & 0x3FFF) - ANGLE(45)); - } - } - else - { - ExplodingDeath(itemNum, -1, 257); - DisableBaddieAI(itemNum); - KillItem(itemNum); - - item->flags |= 1u; - item->status = ITEM_DEACTIVATED; - - RemoveAllItemsInRoom(item->roomNumber, ID_SMOKE_EMITTER_BLACK); - - TriggerExplosionSparks(item->pos.xPos, item->pos.yPos - 768, item->pos.zPos, 3, -2, 0, item->roomNumber); - for (int i = 0; i < 2; i++) - TriggerExplosionSparks(item->pos.xPos, item->pos.yPos - 768, item->pos.zPos, 3, -1, 0, item->roomNumber); - - SoundEffect(SFX_EXPLOSION1, &item->pos, 25165828); - SoundEffect(SFX_EXPLOSION2, &item->pos, 0); - } - } -} - -void SentryGunThrowFire(ITEM_INFO* item) -{ - for (int i = 0; i < 3; i++) - { - SPARKS* spark = &Sparks[GetFreeSpark()]; - - spark->on = 1; - spark->sR = (GetRandomControl() & 0x1F) + 48; - spark->sG = 48; - spark->sB = 255; - spark->dR = (GetRandomControl() & 0x3F) - 64; - spark->dG = (GetRandomControl() & 0x3F) + -128; - spark->dB = 32; - spark->colFadeSpeed = 12; - spark->fadeToBlack = 8; - spark->transType = 2; - spark->life = spark->sLife = (GetRandomControl() & 0x1F) + 16; - - PHD_VECTOR pos1; - pos1.x = -140; - pos1.y = -30; - pos1.z = -4; - - GetJointAbsPosition(item, &pos1, 7); - - spark->x = (GetRandomControl() & 0x1F) + pos1.x - 16; - spark->y = (GetRandomControl() & 0x1F) + pos1.y - 16; - spark->z = (GetRandomControl() & 0x1F) + pos1.z - 16; - - PHD_VECTOR pos2; - pos2.x = -280; - pos2.y = -30; - pos2.z = -4; - - GetJointAbsPosition(item, &pos2, 7); - - int v = (GetRandomControl() & 0x3F) + 192; - - spark->xVel = v * (pos2.x - pos1.x) / 10; - spark->yVel = v * (pos2.y - pos1.y) / 10; - spark->zVel = v * (pos2.z - pos1.z) / 10; - - spark->friction = 85; - spark->gravity = -16 - (GetRandomControl() & 0x1F); - spark->maxYvel = 0; - spark->flags = 538; - - if ((GlobalCounter & 1) != 0) - { - v = 255; - spark->flags = 539; - } - - spark->scalar = 3; - spark->dSize = v * ((GetRandomControl() & 7) + 60) >> 8; - spark->sSize = spark->dSize >> 4; - spark->size = spark->dSize >> 4; - } -} - -void InitialiseBurningFloor(short itemNum) -{ - Items[itemNum].requiredAnimState = 127; -} - -void BurningFloorControl(short itemNum) -{ - -} - -void ControlSpikyCeiling(short itemNumber) -{ - ITEM_INFO* item = &Items[itemNumber]; - - if (TriggerActive(item) && item->status != ITEM_DEACTIVATED) - { - int y = item->pos.yPos + ((item->itemFlags[0] == 1) ? 10 : 5); - - short roomNumber = item->roomNumber; - FLOOR_INFO* floor = GetFloor(item->pos.xPos, y, item->pos.zPos, &roomNumber); - - if (GetFloorHeight(floor, item->pos.xPos, y, item->pos.zPos) < y + 1024) - { - item->status = ITEM_DEACTIVATED; - StopSoundEffect(147); - } - else - { - item->pos.yPos = y; - - if (roomNumber != item->roomNumber) - ItemNewRoom(itemNumber, roomNumber); - - SoundEffect(147, &item->pos, 0); - } - } - - if (item->touchBits) - { - LaraItem->hitPoints -= 20; - LaraItem->hitStatus = true; - - DoLotsOfBlood(LaraItem->pos.xPos, item->pos.yPos + 768, LaraItem->pos.zPos, - 4, item->pos.yRot, LaraItem->roomNumber, 3); - item->touchBits = 0; - - SoundEffect(56, &item->pos, 0); - } - - if (TriggerActive(item) && item->status != ITEM_DEACTIVATED && item->itemFlags[0] == 1) - AnimateItem(item); -} \ No newline at end of file diff --git a/TR5Main/Renderer/CameraMatrixBuffer.h b/TR5Main/Renderer/CameraMatrixBuffer.h index ac658cd59..714e8ac27 100644 --- a/TR5Main/Renderer/CameraMatrixBuffer.h +++ b/TR5Main/Renderer/CameraMatrixBuffer.h @@ -1,7 +1,7 @@ #pragma once -#include + struct alignas(16) CCameraMatrixBuffer { - DirectX::SimpleMath::Matrix ViewProjection; + Matrix ViewProjection; }; diff --git a/TR5Main/Renderer/Frustum.cpp b/TR5Main/Renderer/Frustum.cpp index d546faaa2..3b0894530 100644 --- a/TR5Main/Renderer/Frustum.cpp +++ b/TR5Main/Renderer/Frustum.cpp @@ -1,128 +1,111 @@ +#include "framework.h" #include "Frustum.h" -using namespace DirectX::SimpleMath; - void Frustum::Update(const Matrix& view, const Matrix& projection) { - std::array clip; - clip[0] = view._11 * projection._11 + view._12 * projection._21 + view._13 * projection._31 + view._14 * projection._41; - clip[1] = view._11 * projection._12 + view._12 * projection._22 + view._13 * projection._32 + view._14 * projection._42; - clip[2] = view._11 * projection._13 + view._12 * projection._23 + view._13 * projection._33 + view._14 * projection._43; - clip[3] = view._11 * projection._14 + view._12 * projection._24 + view._13 * projection._34 + view._14 * projection._44; +void Frustum::Update(const Matrix& view, const Matrix& projection) +{ + std::array clip; + clip[0] = view._11 * projection._11 + view._12 * projection._21 + view._13 * projection._31 + view._14 * projection._41; + clip[1] = view._11 * projection._12 + view._12 * projection._22 + view._13 * projection._32 + view._14 * projection._42; + clip[2] = view._11 * projection._13 + view._12 * projection._23 + view._13 * projection._33 + view._14 * projection._43; + clip[3] = view._11 * projection._14 + view._12 * projection._24 + view._13 * projection._34 + view._14 * projection._44; - clip[4] = view._21 * projection._11 + view._22 * projection._21 + view._23 * projection._31 + view._24 * projection._41; - clip[5] = view._21 * projection._12 + view._22 * projection._22 + view._23 * projection._32 + view._24 * projection._42; - clip[6] = view._21 * projection._13 + view._22 * projection._23 + view._23 * projection._33 + view._24 * projection._43; - clip[7] = view._21 * projection._14 + view._22 * projection._24 + view._23 * projection._34 + view._24 * projection._44; + clip[4] = view._21 * projection._11 + view._22 * projection._21 + view._23 * projection._31 + view._24 * projection._41; + clip[5] = view._21 * projection._12 + view._22 * projection._22 + view._23 * projection._32 + view._24 * projection._42; + clip[6] = view._21 * projection._13 + view._22 * projection._23 + view._23 * projection._33 + view._24 * projection._43; + clip[7] = view._21 * projection._14 + view._22 * projection._24 + view._23 * projection._34 + view._24 * projection._44; - clip[8] = view._31 * projection._11 + view._32 * projection._21 + view._33 * projection._31 + view._34 * projection._41; - clip[9] = view._31 * projection._12 + view._32 * projection._22 + view._33 * projection._32 + view._34 * projection._42; - clip[10] = view._31 * projection._13 + view._32 * projection._23 + view._33 * projection._33 + view._34 * projection._43; - clip[11] = view._31 * projection._14 + view._32 * projection._24 + view._33 * projection._34 + view._34 * projection._44; + clip[8] = view._31 * projection._11 + view._32 * projection._21 + view._33 * projection._31 + view._34 * projection._41; + clip[9] = view._31 * projection._12 + view._32 * projection._22 + view._33 * projection._32 + view._34 * projection._42; + clip[10] = view._31 * projection._13 + view._32 * projection._23 + view._33 * projection._33 + view._34 * projection._43; + clip[11] = view._31 * projection._14 + view._32 * projection._24 + view._33 * projection._34 + view._34 * projection._44; - clip[12] = view._41 * projection._11 + view._42 * projection._21 + view._43 * projection._31 + view._44 * projection._41; - clip[13] = view._41 * projection._12 + view._42 * projection._22 + view._43 * projection._32 + view._44 * projection._42; - clip[14] = view._41 * projection._13 + view._42 * projection._23 + view._43 * projection._33 + view._44 * projection._43; - clip[15] = view._41 * projection._14 + view._42 * projection._24 + view._43 * projection._34 + view._44 * projection._44; - // This will extract the LEFT side of the frustum. + clip[12] = view._41 * projection._11 + view._42 * projection._21 + view._43 * projection._31 + view._44 * projection._41; + clip[13] = view._41 * projection._12 + view._42 * projection._22 + view._43 * projection._32 + view._44 * projection._42; + clip[14] = view._41 * projection._13 + view._42 * projection._23 + view._43 * projection._33 + view._44 * projection._43; + clip[15] = view._41 * projection._14 + view._42 * projection._24 + view._43 * projection._34 + view._44 * projection._44; + + // This will extract the LEFT side of the frustum. + m_frustum[1][0] = clip[3] - clip[0]; + m_frustum[1][1] = clip[7] - clip[4]; + m_frustum[1][2] = clip[11] - clip[8]; + m_frustum[1][3] = clip[15] - clip[12]; + NormalizePlane(1); - m_frustum[1][0] = clip[3] - clip[0]; - m_frustum[1][1] = clip[7] - clip[4]; - m_frustum[1][2] = clip[11] - clip[8]; - m_frustum[1][3] = clip[15] - clip[12]; + // This will extract the RIGHT side of the frustum. + m_frustum[0][0] = clip[3] + clip[0]; + m_frustum[0][1] = clip[7] + clip[4]; + m_frustum[0][2] = clip[11] + clip[8]; + m_frustum[0][3] = clip[15] + clip[12]; + NormalizePlane(0); - NormalizePlane(1); + // This will extract the BOTTOM side of the frustum. + m_frustum[2][0] = clip[3] + clip[1]; + m_frustum[2][1] = clip[7] + clip[5]; + m_frustum[2][2] = clip[11] + clip[9]; + m_frustum[2][3] = clip[15] + clip[13]; + NormalizePlane(2); + + // This will extract the TOP side of the frustum. + m_frustum[3][0] = clip[3] - clip[1]; + m_frustum[3][1] = clip[7] - clip[5]; + m_frustum[3][2] = clip[11] - clip[9]; + m_frustum[3][3] = clip[15] - clip[13]; + NormalizePlane(3); - // This will extract the RIGHT side of the frustum. + // This will extract the BACK side of the frustum. + m_frustum[4][0] = clip[3] + clip[2]; + m_frustum[4][1] = clip[7] + clip[6]; + m_frustum[4][2] = clip[11] + clip[10]; + m_frustum[4][3] = clip[15] + clip[14]; + NormalizePlane(4); - m_frustum[0][0] = clip[3] + clip[0]; - m_frustum[0][1] = clip[7] + clip[4]; - m_frustum[0][2] = clip[11] + clip[8]; - m_frustum[0][3] = clip[15] + clip[12]; + // This will extract the FRONT side of the frustum. + m_frustum[5][0] = clip[3] - clip[2]; + m_frustum[5][1] = clip[7] - clip[6]; + m_frustum[5][2] = clip[11] - clip[10]; + m_frustum[5][3] = clip[15] - clip[14]; + NormalizePlane(5); +} - NormalizePlane(0); +bool Frustum::PointInFrustum(const Vector3& position) const +{ - // This will extract the BOTTOM side of the frustum. + for (uint32_t i = 0; i < 6; i++) + if (m_frustum[i][0] * position.x + m_frustum[i][1] * position.y + m_frustum[i][2] * position.z + m_frustum[i][3] <= 0.0f) + return false; + return true; +} - m_frustum[2][0] = clip[3] + clip[1]; - m_frustum[2][1] = clip[7] + clip[5]; - m_frustum[2][2] = clip[11] + clip[9]; - m_frustum[2][3] = clip[15] + clip[13]; +bool Frustum::SphereInFrustum(const Vector3& position, float radius) const +{ + for (uint32_t i = 0; i < 6; i++) + if (m_frustum[i][0] * position.x + m_frustum[i][1] * position.y + m_frustum[i][2] * position.z + m_frustum[i][3] <= -radius) + return false; + return true; +} - NormalizePlane(2); - - // This will extract the TOP side of the frustum. - - m_frustum[3][0] = clip[3] - clip[1]; - m_frustum[3][1] = clip[7] - clip[5]; - m_frustum[3][2] = clip[11] - clip[9]; - m_frustum[3][3] = clip[15] - clip[13]; - - NormalizePlane(3); - - // This will extract the BACK side of the frustum. - - m_frustum[4][0] = clip[3] + clip[2]; - m_frustum[4][1] = clip[7] + clip[6]; - m_frustum[4][2] = clip[11] + clip[10]; - m_frustum[4][3] = clip[15] + clip[14]; - - NormalizePlane(4); - - // This will extract the FRONT side of the frustum. - - m_frustum[5][0] = clip[3] - clip[2]; - m_frustum[5][1] = clip[7] - clip[6]; - m_frustum[5][2] = clip[11] - clip[10]; - m_frustum[5][3] = clip[15] - clip[14]; - - NormalizePlane(5); - - } - - - - bool Frustum::PointInFrustum(const Vector3& position) const { - - for (uint32_t i = 0; i < 6; i++) - if (m_frustum[i][0] * position.x + m_frustum[i][1] * position.y + m_frustum[i][2] * position.z + m_frustum[i][3] <= 0.0f) +bool Frustum::AABBInFrustum(const Vector3& min, const Vector3& max) const +{ + for (uint32_t i = 0; i < 6; i++) + { + if (m_frustum[i][0] * min.x + m_frustum[i][1] * min.y + m_frustum[i][2] * min.z + m_frustum[i][3] <= 0.0f + && m_frustum[i][0] * max.x + m_frustum[i][1] * min.y + m_frustum[i][2] * min.z + m_frustum[i][3] <= 0.0f + && m_frustum[i][0] * min.x + m_frustum[i][1] * max.y + m_frustum[i][2] * min.z + m_frustum[i][3] <= 0.0f + && m_frustum[i][0] * max.x + m_frustum[i][1] * max.y + m_frustum[i][2] * min.z + m_frustum[i][3] <= 0.0f + && m_frustum[i][0] * min.x + m_frustum[i][1] * min.y + m_frustum[i][2] * max.z + m_frustum[i][3] <= 0.0f + && m_frustum[i][0] * max.x + m_frustum[i][1] * min.y + m_frustum[i][2] * max.z + m_frustum[i][3] <= 0.0f + && m_frustum[i][0] * min.x + m_frustum[i][1] * max.y + m_frustum[i][2] * max.z + m_frustum[i][3] <= 0.0f + && m_frustum[i][0] * max.x + m_frustum[i][1] * max.y + m_frustum[i][2] * max.z + m_frustum[i][3] <= 0.0f) return false; return true; } +} - - - bool Frustum::SphereInFrustum(const Vector3& position, float radius) const { - - for (uint32_t i = 0; i < 6; i++) - if (m_frustum[i][0] * position.x + m_frustum[i][1] * position.y + m_frustum[i][2] * position.z + m_frustum[i][3] <= -radius) - return false; - return true; - } - - - - bool Frustum::AABBInFrustum(const Vector3& min, const Vector3& max) const { - - for (uint32_t i = 0; i < 6; i++) - - if (m_frustum[i][0] * min.x + m_frustum[i][1] * min.y + m_frustum[i][2] * min.z + m_frustum[i][3] <= 0.0f - && m_frustum[i][0] * max.x + m_frustum[i][1] * min.y + m_frustum[i][2] * min.z + m_frustum[i][3] <= 0.0f - && m_frustum[i][0] * min.x + m_frustum[i][1] * max.y + m_frustum[i][2] * min.z + m_frustum[i][3] <= 0.0f - && m_frustum[i][0] * max.x + m_frustum[i][1] * max.y + m_frustum[i][2] * min.z + m_frustum[i][3] <= 0.0f - && m_frustum[i][0] * min.x + m_frustum[i][1] * min.y + m_frustum[i][2] * max.z + m_frustum[i][3] <= 0.0f - && m_frustum[i][0] * max.x + m_frustum[i][1] * min.y + m_frustum[i][2] * max.z + m_frustum[i][3] <= 0.0f - && m_frustum[i][0] * min.x + m_frustum[i][1] * max.y + m_frustum[i][2] * max.z + m_frustum[i][3] <= 0.0f - && m_frustum[i][0] * max.x + m_frustum[i][1] * max.y + m_frustum[i][2] * max.z + m_frustum[i][3] <= 0.0f) - return false; - return true; - - } - - - - void Frustum::NormalizePlane(int32_t side) { - float magnitude = sqrt(m_frustum[side][0] * m_frustum[side][0] + m_frustum[side][1] * m_frustum[side][1] + m_frustum[side][2] * m_frustum[side][2]); - m_frustum[side][0] /= magnitude; - m_frustum[side][1] /= magnitude; - m_frustum[side][2] /= magnitude; - m_frustum[side][3] /= magnitude; - } \ No newline at end of file +void Frustum::NormalizePlane(int32_t side) +{ + float magnitude = sqrt(m_frustum[side][0] * m_frustum[side][0] + m_frustum[side][1] * m_frustum[side][1] + m_frustum[side][2] * m_frustum[side][2]); + m_frustum[side][0] /= magnitude; + m_frustum[side][1] /= magnitude; + m_frustum[side][2] /= magnitude; + m_frustum[side][3] /= magnitude; +} \ No newline at end of file diff --git a/TR5Main/Renderer/Frustum.h b/TR5Main/Renderer/Frustum.h index 63487c4a5..fb24e76d1 100644 --- a/TR5Main/Renderer/Frustum.h +++ b/TR5Main/Renderer/Frustum.h @@ -1,18 +1,15 @@ #pragma once -#include -#include -#include - -class Frustum { +class Frustum +{ public: Frustum() = default; - void Update(const DirectX::SimpleMath::Matrix& view, const DirectX::SimpleMath::Matrix& projection); - bool PointInFrustum(const DirectX::SimpleMath::Vector3& position) const; - bool SphereInFrustum(const DirectX::SimpleMath::Vector3& position, float radius) const; - bool AABBInFrustum(const DirectX::SimpleMath::Vector3& min, const DirectX::SimpleMath::Vector3& max) const; + void Update(const Matrix& view, const Matrix& projection); + bool PointInFrustum(const Vector3& position) const; + bool SphereInFrustum(const Vector3& position, float radius) const; + bool AABBInFrustum(const Vector3& min, const Vector3& max) const; private: diff --git a/TR5Main/Renderer/HUDBarBuffer.h b/TR5Main/Renderer/HUDBarBuffer.h index 08d3eb20a..13702721e 100644 --- a/TR5Main/Renderer/HUDBarBuffer.h +++ b/TR5Main/Renderer/HUDBarBuffer.h @@ -1,6 +1,6 @@ #pragma once -struct alignas(16) CHUDBarBuffer { +struct alignas(16) CHUDBarBuffer +{ float Percent; }; - diff --git a/TR5Main/Renderer/HUDBuffer.h b/TR5Main/Renderer/HUDBuffer.h index d6f5adb12..9f2d82414 100644 --- a/TR5Main/Renderer/HUDBuffer.h +++ b/TR5Main/Renderer/HUDBuffer.h @@ -1,7 +1,7 @@ #pragma once -#include -struct alignas(16) CHUDBuffer { - DirectX::SimpleMath::Matrix View; - DirectX::SimpleMath::Matrix Projection; -}; +struct alignas(16) CHUDBuffer +{ + Matrix View; + Matrix Projection; +}; diff --git a/TR5Main/Renderer/ItemBuffer.h b/TR5Main/Renderer/ItemBuffer.h index 4cc85a2ff..a59152711 100644 --- a/TR5Main/Renderer/ItemBuffer.h +++ b/TR5Main/Renderer/ItemBuffer.h @@ -1,10 +1,10 @@ #pragma once -#include + struct alignas(16) CItemBuffer { - DirectX::SimpleMath::Matrix World; - DirectX::SimpleMath::Matrix BonesMatrices[32]; - DirectX::SimpleMath::Vector4 Position; - DirectX::SimpleMath::Vector4 AmbientLight; + Matrix World; + Matrix BonesMatrices[32]; + Vector4 Position; + Vector4 AmbientLight; }; diff --git a/TR5Main/Renderer/LightBuffer.h b/TR5Main/Renderer/LightBuffer.h index 3e2e07c44..39a7b0682 100644 --- a/TR5Main/Renderer/LightBuffer.h +++ b/TR5Main/Renderer/LightBuffer.h @@ -1,11 +1,10 @@ #pragma once -#include #include "ShaderLight.h" -#include "Enums.h" +#include "RenderEnums.h" -struct alignas(16) CLightBuffer { +struct alignas(16) CLightBuffer +{ ShaderLight Lights[NUM_LIGHTS_PER_BUFFER]; int NumLights; - DirectX::SimpleMath::Vector3 CameraPosition; + Vector3 CameraPosition; }; - diff --git a/TR5Main/Renderer/MiscBuffer.h b/TR5Main/Renderer/MiscBuffer.h index 997bd51f8..a16f27f46 100644 --- a/TR5Main/Renderer/MiscBuffer.h +++ b/TR5Main/Renderer/MiscBuffer.h @@ -1,8 +1,8 @@ #pragma once -struct alignas(16) CMiscBuffer { +struct alignas(16) CMiscBuffer +{ int AlphaTest; int Caustics; float Padding[14]; }; - diff --git a/TR5Main/Renderer/Render11Helper.cpp b/TR5Main/Renderer/Render11Helper.cpp index b6eff4927..58d503c9a 100644 --- a/TR5Main/Renderer/Render11Helper.cpp +++ b/TR5Main/Renderer/Render11Helper.cpp @@ -1,15 +1,18 @@ -#pragma once +#include "framework.h" #include "Renderer11.h" -#include "../Specific/configuration.h" -#include "../Game/camera.h" -#include "../Game/draw.h" -#include "../Specific/setup.h" -#include "..\Specific\level.h" -#include "../Game/control.h" -#include "../Game/lara.h" -#include "../Game/sphere.h" +#include "configuration.h" +#include "camera.h" +#include "draw.h" +#include "setup.h" +#include "level.h" +#include "control.h" +#include "lara.h" +#include "sphere.h" +#include "GameFlowScript.h" + extern GameConfiguration g_Configuration; extern GameFlow* g_GameFlow; + bool Renderer11::isRoomUnderwater(short roomNumber) { return (m_rooms[roomNumber].Room->flags & ENV_FLAG_WATER); diff --git a/TR5Main/Renderer/Enums.h b/TR5Main/Renderer/RenderEnums.h similarity index 76% rename from TR5Main/Renderer/Enums.h rename to TR5Main/Renderer/RenderEnums.h index 22cfdb86e..92f9ec896 100644 --- a/TR5Main/Renderer/Enums.h +++ b/TR5Main/Renderer/RenderEnums.h @@ -1,149 +1,146 @@ -#pragma once - -typedef enum RENDERER_BUCKETS { - RENDERER_BUCKET_SOLID = 0, - RENDERER_BUCKET_SOLID_DS = 1, - RENDERER_BUCKET_TRANSPARENT = 2, - RENDERER_BUCKET_TRANSPARENT_DS = 3 -}; - -typedef enum RENDERER_PASSES { - RENDERER_PASS_DEPTH = 0, - RENDERER_PASS_DRAW = 1, - - RENDERER_PASS_SHADOW_MAP = 2, - RENDERER_PASS_GBUFFER = 3, - RENDERER_PASS_TRANSPARENT = 4, - RENDERER_PASS_RECONSTRUCT_DEPTH = 5 -}; - -typedef enum MODEL_TYPES { - MODEL_TYPE_HORIZON = 0, - MODEL_TYPE_ROOM = 1, - MODEL_TYPE_MOVEABLE = 2, - MODEL_TYPE_STATIC = 3, - MODEL_TYPE_INVENTORY = 4, - MODEL_TYPE_PICKUP = 5, - MODEL_TYPE_LARA = 6, - MODEL_TYPE_SKY = 7, - MODEL_TYPE_WATER_SURFACE = 8, - MODEL_TYPE_ROOM_UNDERWATER = 9 -}; - -typedef enum LIGHT_TYPES { - LIGHT_TYPE_SUN = 0, - LIGHT_TYPE_POINT = 1, - LIGHT_TYPE_SPOT = 2, - LIGHT_TYPE_SHADOW = 3 -}; - -typedef enum BLEND_MODES { - BLENDMODE_OPAQUE = 0, - BLENDMODE_ALPHATEST = 1, - BLENDMODE_ALPHABLEND = 2, - BLENDMODE_SUBTRACTIVE = 3 -}; - -typedef enum RENDERER_CULLMODE { - CULLMODE_NONE, - CULLMODE_CW, - CULLMODE_CCW -}; - -typedef enum RENDERER_BLENDSTATE { - BLENDSTATE_OPAQUE, - BLENDSTATE_ADDITIVE, - BLENDSTATE_ALPHABLEND, - BLENDSTATE_SPECIAL_Z_BUFFER -}; - -typedef enum RENDERER_SPRITE_TYPE { - SPRITE_TYPE_BILLBOARD, - SPRITE_TYPE_3D, - SPRITE_TYPE_BILLBOARD_CUSTOM -}; - -typedef enum RENDERER_SPRITE_ROTATION { - SPRITE_ROTATION_0_DEGREES, - SPRITE_ROTATION_90_DEGREES, - SPRITE_ROTATION_180_DEGREES, - SPRITE_ROTATION_270_DEGREES, -}; - -typedef enum RENDERER_POLYGON_SHAPE { - RENDERER_POLYGON_QUAD, - RENDERER_POLYGON_TRIANGLE -}; - -typedef enum RENDERER_FADE_STATUS { - NO_FADE, - FADE_IN, - FADE_OUT -}; - -#define SHADOW_MAP_SIZE 1024 - -#define TEXTURE_ATLAS_SIZE 4096 -#define TEXTURE_PAGE_SIZE 262144 -#define NUM_TEXTURE_PAGES_PER_ROW 16 -#define MAX_SHADOW_MAPS 8 - -#define GET_ATLAS_PAGE_X(p) ((p) % NUM_TEXTURE_PAGES_PER_ROW) * 256.0f -#define GET_ATLAS_PAGE_Y(p) floor((p) / NUM_TEXTURE_PAGES_PER_ROW) * 256.0f - -#define SHAPE_RECTANGLE 0 -#define SHAPE_TRIANGLE 1 - -#define MAX_VERTICES 200000 -#define MAX_INDICES 400000 - -#define MAX_LINES_2D 256 -#define MAX_LINES_3D 16384 - -#define NUM_BUCKETS 4 - -#define NUM_RAIN_DROPS 1024 -#define NUM_SNOW_PARTICLES 1024 -#define WEATHER_RADIUS 20000 -#define RAIN_SIZE 512 -#define RAIN_MAX_ANGLE_V 5 -#define RAIN_MAX_ANGLE_H 360 -#define WEATHER_HEIGHT 6 * 1024 -#define RAIN_COLOR 0.15f -#define RAIN_DELTA_Y 256.0f -#define SNOW_SIZE 72.0f -#define SNOW_MAX_ANGLE_V 30 -#define SNOW_MAX_ANGLE_H 360 -#define SNOW_DELTA_Y 128.0f - -#define NUM_UNDERWATER_DUST_PARTICLES 512 -#define UNDERWATER_DUST_PARTICLES_SIZE 32.0f -#define UNDERWATER_DUST_PARTICLES_RADIUS (10 * 1024) - -#define AMBIENT_CUBE_MAP_SIZE 64 - -#define NUM_SPRITES_PER_BUCKET 4096 -#define NUM_LINES_PER_BUCKET 4096 - -#define NUM_CAUSTICS_TEXTURES 16 - -#define FADEMODE_NONE 0 -#define FADEMODE_FADEIN 1 -#define FADEMODE_FADEOUT 2 - -#define PRINTSTRING_CENTER 1 -#define PRINTSTRING_BLINK 2 -#define PRINTSTRING_DONT_UPDATE_BLINK 4 -#define PRINTSTRING_OUTLINE 8 - -#define PRINTSTRING_COLOR_ORANGE D3DCOLOR_ARGB(255, 216, 117, 49) -#define PRINTSTRING_COLOR_WHITE D3DCOLOR_ARGB(255, 255, 255, 255) -#define PRINTSTRING_COLOR_BLACK D3DCOLOR_ARGB(255, 0, 0, 0) -#define PRINTSTRING_COLOR_YELLOW D3DCOLOR_ARGB(255, 240, 220, 32) - -#define FADE_FRAMES_COUNT 16 -#define FADE_FACTOR 0.0625f - -#define NUM_LIGHTS_PER_BUFFER 48 - -#define MAX_LIGHTS_PER_ITEM 8 \ No newline at end of file +#pragma once + +typedef enum RENDERER_BUCKETS +{ + RENDERER_BUCKET_SOLID = 0, + RENDERER_BUCKET_SOLID_DS = 1, + RENDERER_BUCKET_TRANSPARENT = 2, + RENDERER_BUCKET_TRANSPARENT_DS = 3 +}; + +typedef enum RENDERER_PASSES +{ + RENDERER_PASS_DEPTH = 0, + RENDERER_PASS_DRAW = 1, + RENDERER_PASS_SHADOW_MAP = 2, + RENDERER_PASS_GBUFFER = 3, + RENDERER_PASS_TRANSPARENT = 4, + RENDERER_PASS_RECONSTRUCT_DEPTH = 5 +}; + +typedef enum MODEL_TYPES +{ + MODEL_TYPE_HORIZON = 0, + MODEL_TYPE_ROOM = 1, + MODEL_TYPE_MOVEABLE = 2, + MODEL_TYPE_STATIC = 3, + MODEL_TYPE_INVENTORY = 4, + MODEL_TYPE_PICKUP = 5, + MODEL_TYPE_LARA = 6, + MODEL_TYPE_SKY = 7, + MODEL_TYPE_WATER_SURFACE = 8, + MODEL_TYPE_ROOM_UNDERWATER = 9 +}; + +typedef enum LIGHT_TYPES +{ + LIGHT_TYPE_SUN = 0, + LIGHT_TYPE_POINT = 1, + LIGHT_TYPE_SPOT = 2, + LIGHT_TYPE_SHADOW = 3 +}; + +typedef enum BLEND_MODES +{ + BLENDMODE_OPAQUE = 0, + BLENDMODE_ALPHATEST = 1, + BLENDMODE_ALPHABLEND = 2, + BLENDMODE_SUBTRACTIVE = 3 +}; + +typedef enum RENDERER_CULLMODE +{ + CULLMODE_NONE, + CULLMODE_CW, + CULLMODE_CCW +}; + +typedef enum RENDERER_BLENDSTATE +{ + BLENDSTATE_OPAQUE, + BLENDSTATE_ADDITIVE, + BLENDSTATE_ALPHABLEND, + BLENDSTATE_SPECIAL_Z_BUFFER +}; + +typedef enum RENDERER_SPRITE_TYPE +{ + SPRITE_TYPE_BILLBOARD, + SPRITE_TYPE_3D, + SPRITE_TYPE_BILLBOARD_CUSTOM +}; + +typedef enum RENDERER_SPRITE_ROTATION +{ + SPRITE_ROTATION_0_DEGREES, + SPRITE_ROTATION_90_DEGREES, + SPRITE_ROTATION_180_DEGREES, + SPRITE_ROTATION_270_DEGREES, +}; + +typedef enum RENDERER_POLYGON_SHAPE +{ + RENDERER_POLYGON_QUAD, + RENDERER_POLYGON_TRIANGLE +}; + +typedef enum RENDERER_FADE_STATUS +{ + NO_FADE, + FADE_IN, + FADE_OUT +}; + +constexpr auto TEXTURE_HEIGHT = 256; +constexpr auto TEXTURE_WIDTH = 256; +constexpr auto TEXTURE_PAGE = (TEXTURE_HEIGHT * TEXTURE_WIDTH); +#define SHADOW_MAP_SIZE 1024 +#define TEXTURE_ATLAS_SIZE 4096 +#define TEXTURE_PAGE_SIZE 262144 +#define NUM_TEXTURE_PAGES_PER_ROW 16 +#define MAX_SHADOW_MAPS 8 +#define GET_ATLAS_PAGE_X(p) ((p) % NUM_TEXTURE_PAGES_PER_ROW) * 256.0f +#define GET_ATLAS_PAGE_Y(p) floor((p) / NUM_TEXTURE_PAGES_PER_ROW) * 256.0f +#define SHAPE_RECTANGLE 0 +#define SHAPE_TRIANGLE 1 +#define MAX_VERTICES 200000 +#define MAX_INDICES 400000 +#define MAX_LINES_2D 256 +#define MAX_LINES_3D 16384 +#define NUM_BUCKETS 4 +#define NUM_RAIN_DROPS 1024 +#define NUM_SNOW_PARTICLES 1024 +#define WEATHER_RADIUS 20000 +#define RAIN_SIZE 512 +#define RAIN_MAX_ANGLE_V 5 +#define RAIN_MAX_ANGLE_H 360 +#define WEATHER_HEIGHT 6 * 1024 +#define RAIN_COLOR 0.15f +#define RAIN_DELTA_Y 256.0f +#define SNOW_SIZE 72.0f +#define SNOW_MAX_ANGLE_V 30 +#define SNOW_MAX_ANGLE_H 360 +#define SNOW_DELTA_Y 128.0f +#define NUM_UNDERWATER_DUST_PARTICLES 512 +#define UNDERWATER_DUST_PARTICLES_SIZE 32.0f +#define UNDERWATER_DUST_PARTICLES_RADIUS (10 * 1024) +#define AMBIENT_CUBE_MAP_SIZE 64 +#define NUM_SPRITES_PER_BUCKET 4096 +#define NUM_LINES_PER_BUCKET 4096 +#define NUM_CAUSTICS_TEXTURES 16 +#define FADEMODE_NONE 0 +#define FADEMODE_FADEIN 1 +#define FADEMODE_FADEOUT 2 +#define PRINTSTRING_CENTER 1 +#define PRINTSTRING_BLINK 2 +#define PRINTSTRING_DONT_UPDATE_BLINK 4 +#define PRINTSTRING_OUTLINE 8 +#define PRINTSTRING_COLOR_ORANGE D3DCOLOR_ARGB(255, 216, 117, 49) +#define PRINTSTRING_COLOR_WHITE D3DCOLOR_ARGB(255, 255, 255, 255) +#define PRINTSTRING_COLOR_BLACK D3DCOLOR_ARGB(255, 0, 0, 0) +#define PRINTSTRING_COLOR_YELLOW D3DCOLOR_ARGB(255, 240, 220, 32) +#define FADE_FRAMES_COUNT 16 +#define FADE_FACTOR 0.0625f +#define NUM_LIGHTS_PER_BUFFER 48 +#define MAX_LIGHTS_PER_ITEM 8 +#define MAX_LIGHTS 100 \ No newline at end of file diff --git a/TR5Main/Renderer/Renderer11.cpp b/TR5Main/Renderer/Renderer11.cpp index 3392cc047..16c9cb609 100644 --- a/TR5Main/Renderer/Renderer11.cpp +++ b/TR5Main/Renderer/Renderer11.cpp @@ -1,30 +1,26 @@ +#include "framework.h" #include "Renderer11.h" - -#include "..\Specific\input.h" -#include "..\Specific\winmain.h" -#include "..\Specific\level.h" -#include "..\Specific\configuration.h" - -#include "..\Game\draw.h" -#include "..\Game\healt.h" -#include "..\Game\pickup.h" -#include "..\Game\inventory.h" -#include "..\Game\gameflow.h" -#include "..\Game\Lara.h" -#include "..\Game\effect2.h" -#include "..\Game\rope.h" -#include "..\Game\items.h" -#include "..\Game\Camera.h" -#include "..\Game\healt.h" -#include "../Game/tomb4fx.h" -#include "math.h" -#include -#include -#include -#include "../Game/misc.h" -#include "../Game/footprint.h" +#include "input.h" +#include "winmain.h" +#include "level.h" +#include "configuration.h" +#include "draw.h" +#include "health.h" +#include "pickup.h" +#include "inventory.h" +#include "gameflow.h" +#include "Lara.h" +#include "effect2.h" +#include "rope.h" +#include "camera.h" +#include "tomb4fx.h" +#include "trmath.h" +#include "misc.h" +#include "footprint.h" +#include "setup.h" extern std::deque footprints; +Renderer11* g_Renderer; Renderer11::Renderer11() { @@ -101,7 +97,7 @@ void Renderer11::FreeRendererData() DX11_DELETE(m_sprites[i]); free(m_sprites); - for (int i = 0; i < NUM_STATICS; i++) + for (int i = 0; i < MAX_STATICS; i++) DX11_DELETE(m_staticObjects[i]); free(m_staticObjects); diff --git a/TR5Main/Renderer/Renderer11.h b/TR5Main/Renderer/Renderer11.h index f5f977b4e..fab02db09 100644 --- a/TR5Main/Renderer/Renderer11.h +++ b/TR5Main/Renderer/Renderer11.h @@ -1,27 +1,5 @@ #pragma once - -#include -#include -#include -#include "Enums.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "..\Global\global.h" -#include +#include "RenderEnums.h" #include "StaticBuffer.h" #include "LightBuffer.h" #include "MiscBuffer.h" @@ -33,32 +11,39 @@ #include "CameraMatrixBuffer.h" #include "Frustum.h" -#define PI 3.14159265358979323846f -#define RADIAN 0.01745329252f +#include "items.h" +#include "effect.h" +#define MESH_BITS(x) (1 << x) #define DX11_RELEASE(x) if (x != NULL) x->Release() #define DX11_DELETE(x) if (x != NULL) { delete x; x = NULL; } -constexpr int REFERENCE_RES_WIDTH = 800; -constexpr int REFERENCE_RES_HEIGHT = 450; -constexpr float HUD_UNIT_X = 1.0f / REFERENCE_RES_WIDTH; -constexpr float HUD_UNIT_Y = 1.0f / REFERENCE_RES_HEIGHT; -constexpr float HUD_ZERO_Y = -REFERENCE_RES_HEIGHT; -using namespace DirectX; -using namespace DirectX::SimpleMath; -using namespace std; +constexpr auto NUM_ANIMATED_SETS = 1024; +constexpr auto MAX_LIGHTS_DRAW = 16384; +constexpr auto MAX_DYNAMIC_LIGHTS = 16384; +constexpr auto MAX_DRAW_STATICS = 16384; +constexpr auto MAX_BONES = 32; +constexpr auto MAX_SPRITES = 16384; +constexpr auto REFERENCE_RES_WIDTH = 800; +constexpr auto REFERENCE_RES_HEIGHT = 450; +constexpr auto HUD_UNIT_X = 1.0f / REFERENCE_RES_WIDTH; +constexpr auto HUD_UNIT_Y = 1.0f / REFERENCE_RES_HEIGHT; +constexpr auto HUD_ZERO_Y = -REFERENCE_RES_HEIGHT; -struct RendererDisplayMode { +struct RendererDisplayMode +{ int Width; int Height; int RefreshRate; }; -struct RendererVideoAdapter { +struct RendererVideoAdapter +{ string Name; int Index; vector DisplayModes; }; -struct RendererVertex { +struct RendererVertex +{ Vector3 Position; Vector3 Normal; Vector2 UV; @@ -352,7 +337,8 @@ public: } }; -typedef struct RendererHUDBar { +typedef struct RendererHUDBar +{ VertexBuffer* vertexBufferBorder; IndexBuffer* indexBufferBorder; VertexBuffer* vertexBuffer; @@ -366,8 +352,9 @@ typedef struct RendererHUDBar { | | | 6-----------7-----------8 */ - RendererHUDBar(ID3D11Device* m_device, int x, int y, int w, int h, int borderSize, array colors); + RendererHUDBar(ID3D11Device* m_device, int x, int y, int w, int h, int borderSize, array colors); }; + struct RendererStringToDraw { float X; @@ -407,7 +394,8 @@ struct RendererBone } }; -struct RendererLight { +struct RendererLight +{ Vector3 Position; float Type; Vector3 Color; @@ -420,7 +408,7 @@ struct RendererLight { RendererLight() { - Dynamic = false; + Dynamic = 0.0f; } }; @@ -438,18 +426,19 @@ struct RendererAnimatedTextureSet struct RendererBucket { - vector Vertices; - vector Indices; - vector Polygons; - vector AnimatedPolygons; - int StartVertex; - int StartIndex; - int NumTriangles; - int NumVertices; - int NumIndices; + vector Vertices; + vector Indices; + vector Polygons; + vector AnimatedPolygons; + int StartVertex; + int StartIndex; + int NumTriangles; + int NumVertices; + int NumIndices; }; -struct RendererStatic { +struct RendererStatic +{ int Id; short RoomIndex; MESH_INFO* Mesh; @@ -470,13 +459,15 @@ struct RendererRoom vector LightsToDraw; }; -struct RendererRoomNode { +struct RendererRoomNode +{ short From; short To; Vector4 ClipPort; }; -struct RendererItem { +struct RendererItem +{ int Id; ITEM_INFO* Item; Matrix World; @@ -491,13 +482,14 @@ struct RendererItem { struct RendererMesh { - BoundingSphere Sphere; - RendererBucket Buckets[NUM_BUCKETS]; - RendererBucket AnimatedBuckets[NUM_BUCKETS]; - vector Positions; + BoundingSphere Sphere; + RendererBucket Buckets[NUM_BUCKETS]; + RendererBucket AnimatedBuckets[NUM_BUCKETS]; + vector Positions; }; -struct RendererEffect { +struct RendererEffect +{ int Id; FX_INFO* Effect; Matrix World; @@ -508,14 +500,14 @@ struct RendererEffect { struct RendererObject { int Id; - vector ObjectMeshes; - RendererBone* Skeleton; - vector AnimationTransforms; - vector BindPoseTransforms; - vector LinearizedBones; - bool DoNotDraw; - bool HasDataInBucket[NUM_BUCKETS]; - bool HasDataInAnimatedBucket[NUM_BUCKETS]; + vector ObjectMeshes; + RendererBone* Skeleton; + vector AnimationTransforms; + vector BindPoseTransforms; + vector LinearizedBones; + bool DoNotDraw; + bool HasDataInBucket[NUM_BUCKETS]; + bool HasDataInAnimatedBucket[NUM_BUCKETS]; ~RendererObject() { @@ -526,20 +518,25 @@ struct RendererObject } }; -struct RendererSprite { +struct RendererSprite +{ int Width; int Height; Vector2 UV[4]; }; -struct RendererSpriteSequence { +struct RendererSpriteSequence +{ int Id; vector SpritesList; int NumSprites; RendererSpriteSequence() { + Id = 0; + NumSprites = 0; } + RendererSpriteSequence(int id, int num) { Id = id; @@ -547,14 +544,17 @@ struct RendererSpriteSequence { SpritesList = vector(NumSprites); } - RendererSpriteSequence(const RendererSpriteSequence& rhs) { + RendererSpriteSequence(const RendererSpriteSequence& rhs) + { Id = rhs.Id; NumSprites = rhs.NumSprites; SpritesList = rhs.SpritesList; } - RendererSpriteSequence& operator=(const RendererSpriteSequence& other) { - if (this != &other) { + RendererSpriteSequence& operator=(const RendererSpriteSequence& other) + { + if (this != &other) + { Id = other.Id; NumSprites = other.NumSprites; SpritesList = vector(NumSprites); @@ -564,7 +564,8 @@ struct RendererSpriteSequence { } }; -struct RendererSpriteToDraw { +struct RendererSpriteToDraw +{ RENDERER_SPRITE_TYPE Type; RendererSprite* Sprite; float Distance; @@ -582,13 +583,15 @@ struct RendererSpriteToDraw { Vector3 ConstrainAxis; }; -struct RendererLine3D { +struct RendererLine3D +{ Vector3 start; Vector3 end; Vector4 color; }; -struct RendererWeatherParticle { +struct RendererWeatherParticle +{ float X, Y, Z; float AngleH; float AngleV; @@ -598,14 +601,16 @@ struct RendererWeatherParticle { bool Draw; }; -struct RendererUnderwaterDustParticle { +struct RendererUnderwaterDustParticle +{ float X, Y, Z; short Life; short Room; bool Reset; }; -struct RendererLine2D { +struct RendererLine2D +{ Vector2 Vertices[2]; Vector4 Color; }; @@ -615,56 +620,56 @@ class Renderer11 private: Frustum frustum; // Core DX11 objects - ID3D11Device* m_device = NULL; - ID3D11DeviceContext* m_context = NULL; - IDXGISwapChain* m_swapChain = NULL; - IDXGIDevice* m_dxgiDevice = NULL; - CommonStates* m_states = NULL; + ID3D11Device* m_device = nullptr; + ID3D11DeviceContext* m_context = nullptr; + IDXGISwapChain* m_swapChain = nullptr; + IDXGIDevice* m_dxgiDevice = nullptr; + CommonStates* m_states = nullptr; ID3D11BlendState* m_subtractiveBlendState = nullptr; - ID3D11InputLayout* m_inputLayout = NULL; - D3D11_VIEWPORT m_viewport; - D3D11_VIEWPORT m_shadowMapViewport; - Viewport* m_viewportToolkit; - vector m_adapters; + ID3D11InputLayout* m_inputLayout = nullptr; + D3D11_VIEWPORT m_viewport; + D3D11_VIEWPORT m_shadowMapViewport; + Viewport* m_viewportToolkit; + vector m_adapters; // Main back buffer - ID3D11RenderTargetView* m_backBufferRTV; - ID3D11Texture2D* m_backBufferTexture; + ID3D11RenderTargetView* m_backBufferRTV; + ID3D11Texture2D* m_backBufferTexture; - ID3D11DepthStencilState* m_depthStencilState; - ID3D11DepthStencilView* m_depthStencilView; - ID3D11Texture2D* m_depthStencilTexture; + ID3D11DepthStencilState* m_depthStencilState; + ID3D11DepthStencilView* m_depthStencilView; + ID3D11Texture2D* m_depthStencilTexture; - RenderTarget2D* m_dumpScreenRenderTarget; - RenderTarget2D* m_renderTarget; - RenderTarget2D* m_currentRenderTarget; - RenderTarget2D* m_shadowMap; + RenderTarget2D* m_dumpScreenRenderTarget; + RenderTarget2D* m_renderTarget; + RenderTarget2D* m_currentRenderTarget; + RenderTarget2D* m_shadowMap; // Shaders - ID3D11VertexShader* m_vsRooms; - ID3D11PixelShader* m_psRooms; - ID3D11VertexShader* m_vsItems; - ID3D11PixelShader* m_psItems; - ID3D11VertexShader* m_vsHairs; - ID3D11PixelShader* m_psHairs; - ID3D11VertexShader* m_vsStatics; - ID3D11PixelShader* m_psStatics; - ID3D11VertexShader* m_vsSky; - ID3D11PixelShader* m_psSky; - ID3D11VertexShader* m_vsSprites; - ID3D11PixelShader* m_psSprites; - ID3D11VertexShader* m_vsSolid; - ID3D11PixelShader* m_psSolid; - ID3D11VertexShader* m_vsInventory; - ID3D11PixelShader* m_psInventory; - ID3D11VertexShader* m_vsFullScreenQuad; - ID3D11PixelShader* m_psFullScreenQuad; - ID3D11VertexShader* m_vsShadowMap; - ID3D11PixelShader* m_psShadowMap; - ID3D11VertexShader* m_vsHUD; - ID3D11PixelShader* m_psHUDColor; - ID3D11PixelShader* m_psHUDTexture; - ID3D11PixelShader* m_psHUDBarColor; + ID3D11VertexShader* m_vsRooms; + ID3D11PixelShader* m_psRooms; + ID3D11VertexShader* m_vsItems; + ID3D11PixelShader* m_psItems; + ID3D11VertexShader* m_vsHairs; + ID3D11PixelShader* m_psHairs; + ID3D11VertexShader* m_vsStatics; + ID3D11PixelShader* m_psStatics; + ID3D11VertexShader* m_vsSky; + ID3D11PixelShader* m_psSky; + ID3D11VertexShader* m_vsSprites; + ID3D11PixelShader* m_psSprites; + ID3D11VertexShader* m_vsSolid; + ID3D11PixelShader* m_psSolid; + ID3D11VertexShader* m_vsInventory; + ID3D11PixelShader* m_psInventory; + ID3D11VertexShader* m_vsFullScreenQuad; + ID3D11PixelShader* m_psFullScreenQuad; + ID3D11VertexShader* m_vsShadowMap; + ID3D11PixelShader* m_psShadowMap; + ID3D11VertexShader* m_vsHUD; + ID3D11PixelShader* m_psHUDColor; + ID3D11PixelShader* m_psHUDTexture; + ID3D11PixelShader* m_psHUDBarColor; ID3D11ShaderResourceView* m_shadowMapRV; ID3D11Texture2D* m_shadowMapTexture; @@ -672,256 +677,257 @@ private: // Constant buffers - CCameraMatrixBuffer m_stCameraMatrices; - ID3D11Buffer* m_cbCameraMatrices; - CItemBuffer m_stItem; - ID3D11Buffer* m_cbItem; - CStaticBuffer m_stStatic; - ID3D11Buffer* m_cbStatic; - CLightBuffer m_stLights; - ID3D11Buffer* m_cbLights; - CMiscBuffer m_stMisc; - ID3D11Buffer* m_cbMisc; - CRoomBuffer m_stRoom; - ID3D11Buffer* m_cbRoom; - CShadowLightBuffer m_stShadowMap; - ID3D11Buffer* m_cbShadowMap; - CHUDBuffer m_stHUD; - ID3D11Buffer* m_cbHUD; - CHUDBarBuffer m_stHUDBar; - ID3D11Buffer* m_cbHUDBar; + CCameraMatrixBuffer m_stCameraMatrices; + ID3D11Buffer* m_cbCameraMatrices; + CItemBuffer m_stItem; + ID3D11Buffer* m_cbItem; + CStaticBuffer m_stStatic; + ID3D11Buffer* m_cbStatic; + CLightBuffer m_stLights; + ID3D11Buffer* m_cbLights; + CMiscBuffer m_stMisc; + ID3D11Buffer* m_cbMisc; + CRoomBuffer m_stRoom; + ID3D11Buffer* m_cbRoom; + CShadowLightBuffer m_stShadowMap; + ID3D11Buffer* m_cbShadowMap; + CHUDBuffer m_stHUD; + ID3D11Buffer* m_cbHUD; + CHUDBarBuffer m_stHUDBar; + ID3D11Buffer* m_cbHUDBar; // Text and sprites - SpriteFont* m_gameFont; - SpriteBatch* m_spriteBatch; - vector m_strings; - int m_blinkColorValue; - int m_blinkColorDirection; - PrimitiveBatch* m_primitiveBatch; + SpriteFont* m_gameFont; + SpriteBatch* m_spriteBatch; + vector m_strings; + int m_blinkColorValue; + int m_blinkColorDirection; + PrimitiveBatch* m_primitiveBatch; // System resources - Texture2D* m_HUDBarBorderTexture; - Texture2D* m_caustics[NUM_CAUSTICS_TEXTURES]; - Texture2D* m_binocularsTexture; - Texture2D* m_whiteTexture; + Texture2D* m_HUDBarBorderTexture; + Texture2D* m_caustics[NUM_CAUSTICS_TEXTURES]; + Texture2D* m_binocularsTexture; + Texture2D* m_whiteTexture; // Level data - Texture2D* m_titleScreen; - Texture2D* m_loadScreen; - Texture2D* m_textureAtlas; - Texture2D* m_skyTexture; - Texture2D* m_logo; - VertexBuffer* m_roomsVertexBuffer; - IndexBuffer* m_roomsIndexBuffer; - VertexBuffer* m_moveablesVertexBuffer; - IndexBuffer* m_moveablesIndexBuffer; - VertexBuffer* m_staticsVertexBuffer; - IndexBuffer* m_staticsIndexBuffer; - vector m_rooms; - Matrix m_hairsMatrices[12]; - short m_numHairVertices; - short m_numHairIndices; - vector m_hairVertices; - vector m_hairIndices; - vector m_roomsToDraw; - vector m_itemsToDraw; - vector m_effectsToDraw; - vector m_staticsToDraw; - vector m_lightsToDraw; - vector m_dynamicLights; - vector m_spritesToDraw; - vector m_lines3DToDraw; - vector m_lines2DToDraw; - vector m_tempItemLights; - RendererSpriteToDraw* m_spritesBuffer; - int m_nextSprite; - RendererLine3D* m_lines3DBuffer; - int m_nextLine3D; - RendererLine2D* m_lines2DBuffer; - int m_nextLine2D; - RendererLight* m_shadowLight; - RendererObject** m_moveableObjects; - RendererObject** m_staticObjects; - RendererSprite** m_sprites; - int m_numMoveables; - int m_numStatics; - int m_numSprites; - int m_numSpritesSequences; - vector m_spriteSequences; - unordered_map m_meshPointersToMesh; - Matrix m_LaraWorldMatrix; - vector m_animatedTextureSets; - int m_numAnimatedTextureSets; - int m_currentCausticsFrame; - RendererUnderwaterDustParticle m_underwaterDustParticles[NUM_UNDERWATER_DUST_PARTICLES]; - bool m_firstUnderwaterDustParticles = true; - vector m_meshes; + Texture2D* m_titleScreen; + Texture2D* m_loadScreen; + Texture2D* m_textureAtlas; + Texture2D* m_skyTexture; + Texture2D* m_logo; + VertexBuffer* m_roomsVertexBuffer; + IndexBuffer* m_roomsIndexBuffer; + VertexBuffer* m_moveablesVertexBuffer; + IndexBuffer* m_moveablesIndexBuffer; + VertexBuffer* m_staticsVertexBuffer; + IndexBuffer* m_staticsIndexBuffer; + vector m_rooms; + Matrix m_hairsMatrices[12]; + short m_numHairVertices; + short m_numHairIndices; + vector m_hairVertices; + vector m_hairIndices; + vector m_roomsToDraw; + vector m_itemsToDraw; + vector m_effectsToDraw; + vector m_staticsToDraw; + vector m_lightsToDraw; + vector m_dynamicLights; + vector m_spritesToDraw; + vector m_lines3DToDraw; + vector m_lines2DToDraw; + vector m_tempItemLights; + RendererSpriteToDraw* m_spritesBuffer; + int m_nextSprite; + RendererLine3D* m_lines3DBuffer; + int m_nextLine3D; + RendererLine2D* m_lines2DBuffer; + int m_nextLine2D; + RendererLight* m_shadowLight; + RendererObject** m_moveableObjects; + RendererObject** m_staticObjects; + RendererSprite** m_sprites; + int m_numMoveables; + int m_numStatics; + int m_numSprites; + int m_numSpritesSequences; + vector m_spriteSequences; + unordered_map m_meshPointersToMesh; + Matrix m_LaraWorldMatrix; + vector m_animatedTextureSets; + int m_numAnimatedTextureSets; + int m_currentCausticsFrame; + RendererUnderwaterDustParticle m_underwaterDustParticles[NUM_UNDERWATER_DUST_PARTICLES]; + bool m_firstUnderwaterDustParticles = true; + vector m_meshes; // Debug variables - int m_numDrawCalls = 0; + int m_numDrawCalls = 0; // Preallocated pools of objects for avoiding new/delete // Items and effects are safe (can't be more than 1024 items in TR), // lights should be oversized (eventually ignore lights more than MAX_LIGHTS) - RendererItem m_items[NUM_ITEMS]; - RendererEffect m_effects[NUM_ITEMS]; - RendererLight m_lights[MAX_LIGHTS]; - int m_nextLight; - int m_currentY; + RendererItem m_items[NUM_ITEMS]; + RendererEffect m_effects[NUM_ITEMS]; + RendererLight m_lights[MAX_LIGHTS]; + int m_nextLight; + int m_currentY; // Times for debug - int m_timeUpdate; - int m_timeDraw; - int m_timeFrame; + int m_timeUpdate; + int m_timeDraw; + int m_timeFrame; // Others - bool m_firstWeather; - RendererWeatherParticle m_rain[NUM_RAIN_DROPS]; - RendererWeatherParticle m_snow[NUM_SNOW_PARTICLES]; - RENDERER_FADE_STATUS m_fadeStatus; - float m_fadeFactor; - int m_progress; - bool m_enableCinematicBars = false; - int m_pickupRotation; + bool m_firstWeather; + RendererWeatherParticle m_rain[NUM_RAIN_DROPS]; + RendererWeatherParticle m_snow[NUM_SNOW_PARTICLES]; + RENDERER_FADE_STATUS m_fadeStatus; + float m_fadeFactor; + int m_progress; + bool m_enableCinematicBars = false; + int m_pickupRotation; // Private functions - bool drawScene(bool dump); - bool drawAllStrings(); - ID3D11VertexShader* compileVertexShader(const wchar_t * fileName, const char* function, const char* model, ID3D10Blob** bytecode); - ID3D11GeometryShader* compileGeometryShader(const wchar_t * fileName); - ID3D11PixelShader* compilePixelShader(const wchar_t * fileName, const char* function, const char* model, ID3D10Blob** bytecode); - ID3D11ComputeShader* compileComputeShader(const wchar_t * fileName); - ID3D11Buffer* createConstantBuffer(size_t size); - int getAnimatedTextureInfo(short textureId); - void initialiseHairRemaps(); - RendererMesh* getRendererMeshFromTrMesh(RendererObject* obj, short* meshPtr, short boneIndex, int isJoints, int isHairs); - void fromTrAngle(Matrix* matrix, short* frameptr, int index); - void buildHierarchy(RendererObject* obj); - void buildHierarchyRecursive(RendererObject* obj, RendererBone* node, RendererBone* parentNode); - void updateAnimation(RendererItem* item, RendererObject* obj, short** frmptr, short frac, short rate, int mask,bool useObjectWorldRotation = false); - bool printDebugMessage(int x, int y, int alpha, byte r, byte g, byte b, LPCSTR Message); - bool checkPortal(short roomIndex, short* portal, Vector4* viewPort, Vector4* clipPort); - void getVisibleRooms(int from, int to, Vector4* viewPort, bool water, int count); - void collectRooms(); - void collectItems(short roomNumber); - void collectStatics(short roomNumber); - void collectLightsForRoom(short roomNumber); - void collectLightsForItem(short roomNumber, RendererItem* item); - void collectLightsForEffect(short roomNumber, RendererEffect* effect); - void collectEffects(short roomNumber); - void prepareLights(); - void clearSceneItems(); - bool updateConstantBuffer(ID3D11Buffer* buffer, void* data, int size); - void updateItemsAnimations(); - void updateEffects(); - int getFrame(short animation, short frame, short** framePtr, int* rate); - bool drawAmbientCubeMap(short roomNumber); - bool sphereBoxIntersection(Vector3 boxMin, Vector3 boxMax, Vector3 sphereCentre, float sphereRadius); - bool drawHorizonAndSky(); - bool drawRooms(bool transparent, bool animated); - bool drawStatics(bool transparent); - bool drawItems(bool transparent, bool animated); - bool drawAnimatingItem(RendererItem* item, bool transparent, bool animated); - bool drawBaddieGunflashes(); - bool drawScaledSpikes(RendererItem* item, bool transparent, bool animated); - bool drawWaterfalls(); - bool drawShadowMap(); - bool drawObjectOn2DPosition(short x, short y, short objectNum, short rotX, short rotY, short rotZ); - bool drawLara(bool transparent, bool shadowMap); - void printDebugMessage(LPCSTR message, ...); - void drawFires(); - void drawSparks(); - void drawSmokes(); - void drawEnergyArcs(); - void drawBlood(); - void drawDrips(); - void drawBubbles(); - bool drawEffects(bool transparent); - bool drawEffect(RendererEffect* effect, bool transparent); - void drawSplahes(); - bool drawSprites(); - bool drawLines3D(); - bool drawLines2D(); - bool drawOverlays(); - bool drawRopes(); - bool drawBats(); - bool drawRats(); - bool drawSpiders(); - bool drawGunFlashes(); - bool drawGunShells(); - bool drawDebris(bool transparent); - int drawInventoryScene(); - int drawFinalPass(); - void updateAnimatedTextures(); - void createBillboardMatrix(Matrix* out, Vector3* particlePos, Vector3* cameraPos, float rotation); - void drawShockwaves(); - void drawRipples(); - void drawUnderwaterDust(); - bool doRain(); - bool doSnow(); - bool drawFullScreenQuad(ID3D11ShaderResourceView* texture, Vector3 color, bool cinematicBars); - bool drawFullScreenImage(ID3D11ShaderResourceView* texture, float fade); - bool isRoomUnderwater(short roomNumber); - bool isInRoom(int x, int y, int z, short roomNumber); - bool drawColoredQuad(int x, int y, int w, int h, Vector4 color); - bool initialiseScreen(int w, int h, int refreshRate, bool windowed, HWND handle, bool reset); - bool initialiseBars(); + bool drawScene(bool dump); + bool drawAllStrings(); + ID3D11VertexShader* compileVertexShader(const wchar_t * fileName, const char* function, const char* model, ID3D10Blob** bytecode); + ID3D11GeometryShader* compileGeometryShader(const wchar_t * fileName); + ID3D11PixelShader* compilePixelShader(const wchar_t * fileName, const char* function, const char* model, ID3D10Blob** bytecode); + ID3D11ComputeShader* compileComputeShader(const wchar_t * fileName); + ID3D11Buffer* createConstantBuffer(size_t size); + int getAnimatedTextureInfo(short textureId); + void initialiseHairRemaps(); + RendererMesh* getRendererMeshFromTrMesh(RendererObject* obj, short* meshPtr, short boneIndex, int isJoints, int isHairs); + void fromTrAngle(Matrix* matrix, short* frameptr, int index); + void buildHierarchy(RendererObject* obj); + void buildHierarchyRecursive(RendererObject* obj, RendererBone* node, RendererBone* parentNode); + void updateAnimation(RendererItem* item, RendererObject* obj, short** frmptr, short frac, short rate, int mask,bool useObjectWorldRotation = false); + bool printDebugMessage(int x, int y, int alpha, byte r, byte g, byte b, LPCSTR Message); + bool checkPortal(short roomIndex, short* portal, Vector4* viewPort, Vector4* clipPort); + void getVisibleRooms(int from, int to, Vector4* viewPort, bool water, int count); + void collectRooms(); + void collectItems(short roomNumber); + void collectStatics(short roomNumber); + void collectLightsForRoom(short roomNumber); + void collectLightsForItem(short roomNumber, RendererItem* item); + void collectLightsForEffect(short roomNumber, RendererEffect* effect); + void collectEffects(short roomNumber); + void prepareLights(); + void clearSceneItems(); + bool updateConstantBuffer(ID3D11Buffer* buffer, void* data, int size); + void updateItemsAnimations(); + void updateEffects(); + int getFrame(short animation, short frame, short** framePtr, int* rate); + bool drawAmbientCubeMap(short roomNumber); + bool sphereBoxIntersection(Vector3 boxMin, Vector3 boxMax, Vector3 sphereCentre, float sphereRadius); + bool drawHorizonAndSky(); + bool drawRooms(bool transparent, bool animated); + bool drawStatics(bool transparent); + bool drawItems(bool transparent, bool animated); + bool drawAnimatingItem(RendererItem* item, bool transparent, bool animated); + bool drawBaddieGunflashes(); + bool drawScaledSpikes(RendererItem* item, bool transparent, bool animated); + bool drawWaterfalls(); + bool drawShadowMap(); + bool drawObjectOn2DPosition(short x, short y, short objectNum, short rotX, short rotY, short rotZ); + bool drawLara(bool transparent, bool shadowMap); + void printDebugMessage(LPCSTR message, ...); + void drawFires(); + void drawSparks(); + void drawSmokes(); + void drawEnergyArcs(); + void drawBlood(); + void drawDrips(); + void drawBubbles(); + bool drawEffects(bool transparent); + bool drawEffect(RendererEffect* effect, bool transparent); + void drawSplahes(); + bool drawSprites(); + bool drawLines3D(); + bool drawLines2D(); + bool drawOverlays(); + bool drawRopes(); + bool drawBats(); + bool drawRats(); + bool drawSpiders(); + bool drawGunFlashes(); + bool drawGunShells(); + bool drawDebris(bool transparent); + int drawInventoryScene(); + int drawFinalPass(); + void updateAnimatedTextures(); + void createBillboardMatrix(Matrix* out, Vector3* particlePos, Vector3* cameraPos, float rotation); + void drawShockwaves(); + void drawRipples(); + void drawUnderwaterDust(); + bool doRain(); + bool doSnow(); + bool drawFullScreenQuad(ID3D11ShaderResourceView* texture, Vector3 color, bool cinematicBars); + bool drawFullScreenImage(ID3D11ShaderResourceView* texture, float fade); + bool isRoomUnderwater(short roomNumber); + bool isInRoom(int x, int y, int z, short roomNumber); + bool drawColoredQuad(int x, int y, int w, int h, Vector4 color); + bool initialiseScreen(int w, int h, int refreshRate, bool windowed, HWND handle, bool reset); + bool initialiseBars(); public: - Matrix View; - Matrix Projection; - Matrix ViewProjection; - float FieldOfView; - int ScreenWidth; - int ScreenHeight; - bool Windowed; - int NumTexturePages; + Matrix View; + Matrix Projection; + Matrix ViewProjection; + float FieldOfView; + int ScreenWidth; + int ScreenHeight; + bool Windowed; + int NumTexturePages; Renderer11(); ~Renderer11(); - bool Create(); - bool EnumerateVideoModes(); - bool Initialise(int w, int h, int refreshRate, bool windowed, HWND handle); - int Draw(); - bool PrepareDataForTheRenderer(); - void UpdateCameraMatrices(float posX, float posY, float posZ, float targetX, float targetY, float targetZ, float roll, float fov); - int DumpGameScene(); - int DrawInventory(); - int DrawPickup(short objectNum); - int SyncRenderer(); - bool PrintString(int x, int y, char* string, D3DCOLOR color, int flags); - void ClearDynamicLights(); - void AddDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byte b); - void FreeRendererData(); - void EnableCinematicBars(bool value); - void FadeIn(); - void FadeOut(); - void DrawLoadingScreen(char* fileName); - void UpdateProgress(float value); - bool IsFading(); - void GetLaraBonePosition(Vector3* pos, int bone); - bool ToggleFullScreen(); - bool IsFullsScreen(); + bool Create(); + bool EnumerateVideoModes(); + bool Initialise(int w, int h, int refreshRate, bool windowed, HWND handle); + int Draw(); + bool PrepareDataForTheRenderer(); + void UpdateCameraMatrices(float posX, float posY, float posZ, float targetX, float targetY, float targetZ, float roll, float fov); + int DumpGameScene(); + int DrawInventory(); + int DrawPickup(short objectNum); + int SyncRenderer(); + bool PrintString(int x, int y, char* string, D3DCOLOR color, int flags); + void ClearDynamicLights(); + void AddDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byte b); + void FreeRendererData(); + void EnableCinematicBars(bool value); + void FadeIn(); + void FadeOut(); + void DrawLoadingScreen(char* fileName); + void UpdateProgress(float value); + bool IsFading(); + void GetLaraBonePosition(Vector3* pos, int bone); + bool ToggleFullScreen(); + bool IsFullsScreen(); vector* GetAdapters(); - bool DoTitleImage(); - void AddLine2D(int x1, int y1, int x2, int y2, byte r, byte g, byte b, byte a); - void AddSpriteBillboard(RendererSprite* sprite, Vector3 pos,Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode); - void AddSpriteBillboardConstrained(RendererSprite* sprite, Vector3 pos, Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode, Vector3 constrainAxis); - void AddSprite3D(RendererSprite* sprite, Vector3 vtx1, Vector3 vtx2, Vector3 vtx3, Vector3 vtx4, Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode); - void AddLine3D(Vector3 start, Vector3 end, Vector4 color); - bool ChangeScreenResolution(int width, int height, int frequency, bool windowed); + bool DoTitleImage(); + void AddLine2D(int x1, int y1, int x2, int y2, byte r, byte g, byte b, byte a); + void AddSpriteBillboard(RendererSprite* sprite, Vector3 pos,Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode); + void AddSpriteBillboardConstrained(RendererSprite* sprite, Vector3 pos, Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode, Vector3 constrainAxis); + void AddSprite3D(RendererSprite* sprite, Vector3 vtx1, Vector3 vtx2, Vector3 vtx3, Vector3 vtx4, Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode); + void AddLine3D(Vector3 start, Vector3 end, Vector4 color); + bool ChangeScreenResolution(int width, int height, int frequency, bool windowed); bool DrawBar(float percent, const RendererHUDBar* const bar); - void FlipRooms(short roomNumber1, short roomNumber2); - void ResetAnimations(); - void UpdateLaraAnimations(bool force); - void UpdateItemAnimations(int itemNumber, bool force); - void GetLaraAbsBonePosition(Vector3* pos, int joint); - void GetItemAbsBonePosition(int itemNumber, Vector3* pos, int joint); - int GetSpheres(short itemNumber, BoundingSphere* ptr, char worldSpace, Matrix local); - void GetBoneMatrix(short itemNumber, int joint, Matrix* outMatrix); + void FlipRooms(short roomNumber1, short roomNumber2); + void ResetAnimations(); + void UpdateLaraAnimations(bool force); + void UpdateItemAnimations(int itemNumber, bool force); + void GetLaraAbsBonePosition(Vector3* pos, int joint); + void GetItemAbsBonePosition(int itemNumber, Vector3* pos, int joint); + int GetSpheres(short itemNumber, BoundingSphere* ptr, char worldSpace, Matrix local); + void GetBoneMatrix(short itemNumber, int joint, Matrix* outMatrix); RendererMesh* getMeshFromMeshPtr(unsigned int meshp); private: void drawFootprints(); void prepareCameraForFrame(); -}; \ No newline at end of file +}; +extern Renderer11* g_Renderer; \ No newline at end of file diff --git a/TR5Main/Renderer/Renderer11Compatibility.cpp b/TR5Main/Renderer/Renderer11Compatibility.cpp index 44262e2a2..16d9b3863 100644 --- a/TR5Main/Renderer/Renderer11Compatibility.cpp +++ b/TR5Main/Renderer/Renderer11Compatibility.cpp @@ -1,10 +1,10 @@ +#include "framework.h" #include "Renderer11.h" -#include "../Specific/level.h" -#include -#include "../Game/savegame.h" -#include "../Specific/setup.h" -#include "../Game/control.h" -#include "../Game/objects.h" +#include "level.h" +#include "savegame.h" +#include "setup.h" +#include "control.h" +#include "objects.h" bool Renderer11::PrepareDataForTheRenderer() { @@ -13,8 +13,8 @@ bool Renderer11::PrepareDataForTheRenderer() m_spriteSequences = vector(ID_NUMBER_OBJECTS); - m_staticObjects = (RendererObject * *)malloc(sizeof(RendererObject*) * NUM_STATICS); - ZeroMemory(m_staticObjects, sizeof(RendererObject*) * NUM_STATICS); + m_staticObjects = (RendererObject * *)malloc(sizeof(RendererObject*) * MAX_STATICS); + ZeroMemory(m_staticObjects, sizeof(RendererObject*) * MAX_STATICS); m_rooms = vector(NUM_ROOMS); @@ -718,7 +718,7 @@ bool Renderer11::PrepareDataForTheRenderer() for (int i = 0; i < StaticObjectsIds.size(); i++) { - STATIC_INFO* obj = &StaticObjects[StaticObjectsIds[i]]; + StaticInfo* obj = &StaticObjects[StaticObjectsIds[i]]; RendererObject* staticObject = new RendererObject(); staticObject->Id = StaticObjectsIds[i]; diff --git a/TR5Main/Renderer/Renderer11Debug.cpp b/TR5Main/Renderer/Renderer11Debug.cpp index 75e1e5e68..c25c16fcb 100644 --- a/TR5Main/Renderer/Renderer11Debug.cpp +++ b/TR5Main/Renderer/Renderer11Debug.cpp @@ -1,3 +1,4 @@ +#include "framework.h" #include "Renderer11.h" bool Renderer11::printDebugMessage(int x, int y, int alpha, byte r, byte g, byte b, LPCSTR Message) diff --git a/TR5Main/Renderer/Renderer11Draw.cpp b/TR5Main/Renderer/Renderer11Draw.cpp index 96c80d16e..c2d72d6fe 100644 --- a/TR5Main/Renderer/Renderer11Draw.cpp +++ b/TR5Main/Renderer/Renderer11Draw.cpp @@ -1,22 +1,23 @@ -#pragma once +#include "framework.h" #include "Renderer11.h" -#include "../Specific/configuration.h" -#include -#include "../Game/savegame.h" -#include "../Game/healt.h" -#include "../Game/camera.h" -#include "../Game/draw.h" -#include "../Game/inventory.h" -#include "../Game/lara.h" -#include "../Game/gameflow.h" -#include "../Game/rope.h" -#include "../Game/tomb4fx.h" -#include "../Game/door.h" -#include "../Objects/oldobjects.h" -#include "..\Specific\level.h" -#include "../Specific/setup.h" -#include "../Game/control.h" -#include "../Game/sound.h" +#include "configuration.h" +#include "savegame.h" +#include "health.h" +#include "camera.h" +#include "draw.h" +#include "inventory.h" +#include "lara.h" +#include "gameflow.h" +#include "rope.h" +#include "tomb4fx.h" +#include "door.h" +#include "level.h" +#include "setup.h" +#include "control.h" +#include "sound.h" +#include "tr5_rats_emitter.h" +#include "tr5_bats_emitter.h" +#include "tr5_spider_emitter.h" extern GUNSHELL_STRUCT Gunshells[MAX_GUNSHELL]; extern RendererHUDBar* g_DashBar; diff --git a/TR5Main/Renderer/Renderer11Draw2D.cpp b/TR5Main/Renderer/Renderer11Draw2D.cpp index 5b13e19ce..c3e37ae68 100644 --- a/TR5Main/Renderer/Renderer11Draw2D.cpp +++ b/TR5Main/Renderer/Renderer11Draw2D.cpp @@ -1,6 +1,7 @@ +#include "framework.h" #include "Renderer11.h" -#include "../game/camera.h" -#include "../Game/spotcam.h" +#include "camera.h" +#include "spotcam.h" RendererHUDBar* g_HealthBar; RendererHUDBar* g_AirBar; diff --git a/TR5Main/Renderer/Renderer11DrawEffect.cpp b/TR5Main/Renderer/Renderer11DrawEffect.cpp index 513b67c5f..a175ada25 100644 --- a/TR5Main/Renderer/Renderer11DrawEffect.cpp +++ b/TR5Main/Renderer/Renderer11DrawEffect.cpp @@ -1,28 +1,18 @@ +#include "framework.h" #include "Renderer11.h" -#include "../Game/footprint.h" -#include "../Game/effect2.h" -#include "../Game/sphere.h" -#include "../Game/tomb4fx.h" -#include "../Game/lara.h" -#include "../Game/draw.h" -#include "../Game/camera.h" -#include "../Game/debris.h" -#include "../Specific/setup.h" -#include "../Game/bubble.h" -#include "..\Specific\level.h" -#include "../Game/effects.h" +#include "footprint.h" +#include "effect2.h" +#include "sphere.h" +#include "tomb4fx.h" +#include "lara.h" +#include "draw.h" +#include "camera.h" +#include "debris.h" +#include "setup.h" +#include "bubble.h" +#include "level.h" +#include "effect.h" -extern BLOOD_STRUCT Blood[MAX_SPARKS_BLOOD]; -extern FIRE_SPARKS FireSparks[MAX_SPARKS_FIRE]; -extern SMOKE_SPARKS SmokeSparks[MAX_SPARKS_SMOKE]; -extern DRIP_STRUCT Drips[MAX_DRIPS]; -extern SHOCKWAVE_STRUCT ShockWaves[MAX_SHOCKWAVE]; -extern FIRE_LIST Fires[MAX_FIRE_LIST]; -extern GUNFLASH_STRUCT Gunflashes[MAX_GUNFLASH]; // offset 0xA31D8 -extern SPARKS Sparks[MAX_SPARKS]; -extern SPLASH_STRUCT Splashes[MAX_SPLASH]; -extern RIPPLE_STRUCT Ripples[MAX_RIPPLES]; -extern ENERGY_ARC EnergyArcs[MAX_ENERGY_ARCS]; extern std::deque footprints; extern int g_NumSprites; @@ -56,7 +46,7 @@ void Renderer11::AddSprite3D(RendererSprite* sprite, Vector3 vtx1, Vector3 vtx2, void Renderer11::drawEnergyArcs() { - for (int i = 0; i < MAX_ENERGY_ARCS; i++) + for (int i = 0; i < MAX_GUNFLASH; i++) { ENERGY_ARC* arc = &EnergyArcs[i]; @@ -325,7 +315,7 @@ void Renderer11::drawSparks() void Renderer11::drawSplahes() { constexpr size_t NUM_POINTS = 8; - for (int i = 0; i < MAX_SPLASH; i++) + for (int i = 0; i < MAX_SPLASHES; i++) { SPLASH_STRUCT& splash = Splashes[i]; if (splash.isActive) diff --git a/TR5Main/Renderer/Renderer11Frame.cpp b/TR5Main/Renderer/Renderer11Frame.cpp index d1d49f4ff..71dbe2c9d 100644 --- a/TR5Main/Renderer/Renderer11Frame.cpp +++ b/TR5Main/Renderer/Renderer11Frame.cpp @@ -1,10 +1,12 @@ +#include "framework.h" #include "Renderer11.h" -#include "../Game/draw.h" -#include "../Game/lara.h" -#include "../Game/effects.h" -#include "../Game/camera.h" -#include "..\Specific\level.h" -#include "../Specific/setup.h" +#include "draw.h" +#include "lara.h" +#include "effect.h" +#include "camera.h" +#include "level.h" +#include "setup.h" + void Renderer11::collectRooms() { short baseRoomIndex = Camera.pos.roomNumber; @@ -81,7 +83,7 @@ void Renderer11::collectStatics(short roomNumber) { MESH_INFO* mesh = &r->mesh[i]; RendererStatic* newStatic = &room.Statics[i]; - STATIC_INFO* staticInfo = &StaticObjects[mesh->staticNumber]; + StaticInfo* staticInfo = &StaticObjects[mesh->staticNumber]; Vector3 min = Vector3(staticInfo->xMinc, staticInfo->yMinc, staticInfo->zMinc); Vector3 max = Vector3(staticInfo->xMaxc, staticInfo->yMaxc, staticInfo->zMaxc); min += Vector3(mesh->x, mesh->y, mesh->z); diff --git a/TR5Main/Renderer/Renderer11Init.cpp b/TR5Main/Renderer/Renderer11Init.cpp index 67afd9516..0b7304553 100644 --- a/TR5Main/Renderer/Renderer11Init.cpp +++ b/TR5Main/Renderer/Renderer11Init.cpp @@ -1,6 +1,8 @@ +#include "framework.h" #include "Renderer11.h" -#include "../Specific/configuration.h" -#include "../Specific/winmain.h" +#include "configuration.h" +#include "winmain.h" +#include "GameFlowScript.h" extern GameConfiguration g_Configuration; extern GameFlow* g_GameFlow; diff --git a/TR5Main/Renderer/Renderer11Lara.cpp b/TR5Main/Renderer/Renderer11Lara.cpp index 4787497c2..2d16619b3 100644 --- a/TR5Main/Renderer/Renderer11Lara.cpp +++ b/TR5Main/Renderer/Renderer11Lara.cpp @@ -1,13 +1,14 @@ +#include "framework.h" #include "Renderer11.h" -#include "../Game/draw.h" -#include "../Game/hair.h" -#include "../Game/lara.h" -#include "../Game/control.h" -#include "../Game/spotcam.h" -#include "../game/camera.h" -#include "../game/sphere.h" -#include "../Global/global.h" -#include "..\Specific\level.h" +#include "draw.h" +#include "hair.h" +#include "lara.h" +#include "control.h" +#include "spotcam.h" +#include "camera.h" +#include "sphere.h" +#include "level.h" +#include "GameFlowScript.h" extern GameFlow* g_GameFlow; diff --git a/TR5Main/Renderer/Renderer11PostProcess.cpp b/TR5Main/Renderer/Renderer11PostProcess.cpp index 874eb365b..30e4309ae 100644 --- a/TR5Main/Renderer/Renderer11PostProcess.cpp +++ b/TR5Main/Renderer/Renderer11PostProcess.cpp @@ -1,3 +1,4 @@ +#include "framework.h" #include "Renderer11.h" void Renderer11::EnableCinematicBars(bool value) diff --git a/TR5Main/Renderer/Renderer11Settings.cpp b/TR5Main/Renderer/Renderer11Settings.cpp index 3e000672d..2dad9b7b0 100644 --- a/TR5Main/Renderer/Renderer11Settings.cpp +++ b/TR5Main/Renderer/Renderer11Settings.cpp @@ -1,5 +1,6 @@ +#include "framework.h" #include "Renderer11.h" -#include "../Specific/winmain.h" +#include "winmain.h" bool Renderer11::ToggleFullScreen() { diff --git a/TR5Main/Renderer/Renderer11String.cpp b/TR5Main/Renderer/Renderer11String.cpp index 0ad0df850..8faa0dd5a 100644 --- a/TR5Main/Renderer/Renderer11String.cpp +++ b/TR5Main/Renderer/Renderer11String.cpp @@ -1,6 +1,6 @@ +#include "framework.h" #include "Renderer11.h" - bool Renderer11::PrintString(int x, int y, char* string, D3DCOLOR color, int flags) { int realX = x; diff --git a/TR5Main/Renderer/RoomBuffer.h b/TR5Main/Renderer/RoomBuffer.h index 86db2fa84..90194556e 100644 --- a/TR5Main/Renderer/RoomBuffer.h +++ b/TR5Main/Renderer/RoomBuffer.h @@ -1,6 +1,6 @@ #pragma once -#include -struct alignas(16) CRoomBuffer { - DirectX::SimpleMath::Vector4 AmbientColor; -}; +struct alignas(16) CRoomBuffer +{ + Vector4 AmbientColor; +}; diff --git a/TR5Main/Renderer/ShaderLight.h b/TR5Main/Renderer/ShaderLight.h index 7d12bd17c..5e3894d0d 100644 --- a/TR5Main/Renderer/ShaderLight.h +++ b/TR5Main/Renderer/ShaderLight.h @@ -1,13 +1,12 @@ #pragma once -#include -struct alignas(16) ShaderLight { - DirectX::SimpleMath::Vector4 Position; - DirectX::SimpleMath::Vector4 Color; - DirectX::SimpleMath::Vector4 Direction; +struct alignas(16) ShaderLight +{ + Vector4 Position; + Vector4 Color; + Vector4 Direction; float Intensity; float In; float Out; float Range; }; - diff --git a/TR5Main/Renderer/ShadowLightBuffer.h b/TR5Main/Renderer/ShadowLightBuffer.h index 2e080fddc..af5ecd67e 100644 --- a/TR5Main/Renderer/ShadowLightBuffer.h +++ b/TR5Main/Renderer/ShadowLightBuffer.h @@ -1,10 +1,10 @@ #pragma once #include "ShaderLight.h" -struct alignas(16) CShadowLightBuffer { +struct alignas(16) CShadowLightBuffer +{ ShaderLight Light; - DirectX::SimpleMath::Matrix LightViewProjection; + Matrix LightViewProjection; int CastShadows; float Padding[15]; }; - diff --git a/TR5Main/Renderer/StaticBuffer.h b/TR5Main/Renderer/StaticBuffer.h index 601b380df..d91d743c0 100644 --- a/TR5Main/Renderer/StaticBuffer.h +++ b/TR5Main/Renderer/StaticBuffer.h @@ -1,10 +1,8 @@ #pragma once -#include struct alignas(16) CStaticBuffer { - DirectX::SimpleMath::Matrix World; - DirectX::SimpleMath::Vector4 Position; - DirectX::SimpleMath::Vector4 Color; + Matrix World; + Vector4 Position; + Vector4 Color; }; - diff --git a/TR5Main/Scripting/GameFlowScript.cpp b/TR5Main/Scripting/GameFlowScript.cpp index e5b1086b8..0331fbfbc 100644 --- a/TR5Main/Scripting/GameFlowScript.cpp +++ b/TR5Main/Scripting/GameFlowScript.cpp @@ -1,10 +1,11 @@ +#include "framework.h" #include "GameFlowScript.h" -#include "..\Game\items.h" -#include "..\Game\box.h" -#include "..\Game\lot.h" -#include "..\Game\sound.h" -#include "..\Game\savegame.h" -#include "..\Game\draw.h" +#include "items.h" +#include "box.h" +#include "lot.h" +#include "sound.h" +#include "savegame.h" +#include "draw.h" ChunkId* ChunkGameFlowFlags = ChunkId::FromString("Tr5MainFlags"); ChunkId* ChunkGameFlowLevel = ChunkId::FromString("Tr5MainLevel"); diff --git a/TR5Main/Scripting/GameFlowScript.h b/TR5Main/Scripting/GameFlowScript.h index 1bd91493b..ff40170c4 100644 --- a/TR5Main/Scripting/GameFlowScript.h +++ b/TR5Main/Scripting/GameFlowScript.h @@ -1,16 +1,7 @@ #pragma once - -#include -#include -#include -#include -#include -#include - -#include "..\Global\global.h" -#include "..\Specific\IO\ChunkId.h" -#include "..\Specific\IO\ChunkReader.h" -#include "..\Specific\IO\LEB128.h" +#include "ChunkId.h" +#include "ChunkReader.h" +#include "LEB128.h" #include "LanguageScript.h" #define TITLE_FLYBY 0 @@ -19,9 +10,25 @@ struct ChunkId; struct LEB128; -using namespace std; +typedef enum WEATHER_TYPES +{ + WEATHER_NORMAL, + WEATHER_RAIN, + WEATHER_SNOW +}; -struct GameScriptSettings { +typedef enum LARA_DRAW_TYPE +{ + LARA_NORMAL = 1, + LARA_YOUNG = 2, + LARA_BUNHEAD = 3, + LARA_CATSUIT = 4, + LARA_DIVESUIT = 5, + LARA_INVISIBLE = 7 +}; + +struct GameScriptSettings +{ int ScreenWidth; int ScreenHeight; bool EnableLoadSave; @@ -34,7 +41,8 @@ struct GameScriptSettings { bool ShowDebugInfo; }; -struct GameScriptSkyLayer { +struct GameScriptSkyLayer +{ bool Enabled; byte R; byte G; @@ -57,7 +65,8 @@ struct GameScriptSkyLayer { } }; -struct GameScriptFog { +struct GameScriptFog +{ byte R; byte G; byte B; @@ -75,7 +84,8 @@ struct GameScriptFog { } }; -struct GameScriptMirror { +struct GameScriptMirror +{ short Room; int StartX; int EndX; @@ -98,7 +108,8 @@ struct GameScriptMirror { } }; -struct GameScriptLevel { +struct GameScriptLevel +{ int NameStringIndex; string FileName; string ScriptFileName; diff --git a/TR5Main/Scripting/GameLogicScript.cpp b/TR5Main/Scripting/GameLogicScript.cpp index 1c0282b7f..310939fc4 100644 --- a/TR5Main/Scripting/GameLogicScript.cpp +++ b/TR5Main/Scripting/GameLogicScript.cpp @@ -1,12 +1,13 @@ +#include "framework.h" #include "GameLogicScript.h" -#include "..\Game\items.h" -#include "..\Game\box.h" -#include "..\Game\lara.h" -#include "../Game/savegame.h" -#include "..\Game\lot.h" -#include "..\Game\sound.h" -#include "../Specific/setup.h" -#include "../Specific/level.h" +#include "items.h" +#include "box.h" +#include "lara.h" +#include "savegame.h" +#include "lot.h" +#include "sound.h" +#include "setup.h" +#include "level.h" extern GameFlow* g_GameFlow; GameScript* g_GameScript; @@ -164,7 +165,7 @@ GameScript::GameScript(sol::state* lua) {"CHEF", ID_CHEF}, {"WINGED_MUMMY", ID_WINGED_MUMMY}, {"CENTAUR_MUTANT", ID_CENTAUR_MUTANT}, - {"EVIL_LARA", ID_EVIL_LARA}, + {"DOPPELGANGER", ID_LARA_DOPPELGANGER}, {"NATLA", ID_NATLA}, {"WINGED_NATLA", ID_WINGED_NATLA}, {"GIANT_MUTANT", ID_GIANT_MUTANT}, @@ -216,7 +217,7 @@ GameScript::GameScript(sol::state* lua) {"LARA_DOUBLE", ID_LARA_DOUBLE}, {"COMPY", ID_COMPY}, {"HYDRA", ID_HYDRA}, - {"GUARDIAN", ID_GUARDIAN}, + {"LASERHEAD", ID_LASERHEAD}, {"SCIENTIST", ID_SCIENTIST}, {"MERCENARY", ID_MERCENARY}, {"WILLOWISP", ID_WILLOWISP}, @@ -914,8 +915,8 @@ GameScript::GameScript(sol::state* lua) {"ANIMATING126", ID_ANIMATING126}, {"ANIMATING127", ID_ANIMATING127}, {"ANIMATING128", ID_ANIMATING128}, - {"GUARDIAN_BASE", ID_GUARDIAN_BASE}, - {"GUARDIAN_TENTACLE", ID_GUARDIAN_TENTACLE}, + {"LASERHEAD_BASE", ID_LASERHEAD_BASE}, + {"LASERHEAD_TENTACLE", ID_LASERHEAD_TENTACLE}, {"BRIDGE_FLAT", ID_BRIDGE_FLAT}, {"BRIDGE_TILT1", ID_BRIDGE_TILT1}, {"BRIDGE_TILT2", ID_BRIDGE_TILT2}, @@ -1534,7 +1535,7 @@ void GameScriptItem::EnableItem() { if (Objects[NativeItem->objectNumber].intelligent) { - if (NativeItem->status == ITEM_DEACTIVATED) + if (NativeItem->status == ITEM_DESACTIVATED) { NativeItem->touchBits = 0; NativeItem->status = ITEM_ACTIVE; @@ -1569,7 +1570,7 @@ void GameScriptItem::DisableItem() if (NativeItem->status == ITEM_ACTIVE) { NativeItem->touchBits = 0; - NativeItem->status = ITEM_DEACTIVATED; + NativeItem->status = ITEM_DESACTIVATED; RemoveActiveItem(NativeItemNumber); DisableBaddieAI(NativeItemNumber); } @@ -1578,7 +1579,7 @@ void GameScriptItem::DisableItem() { NativeItem->touchBits = 0; RemoveActiveItem(NativeItemNumber); - NativeItem->status = ITEM_DEACTIVATED; + NativeItem->status = ITEM_DESACTIVATED; } } } diff --git a/TR5Main/Scripting/GameLogicScript.h b/TR5Main/Scripting/GameLogicScript.h index ae7f6b22f..04a4a9d54 100644 --- a/TR5Main/Scripting/GameLogicScript.h +++ b/TR5Main/Scripting/GameLogicScript.h @@ -1,19 +1,10 @@ #pragma once - -#include -#include -#include -#include -#include -#include -#include "..\Global\global.h" -#include "..\Specific\IO\ChunkId.h" -#include "..\Specific\IO\ChunkReader.h" -#include "..\Specific\IO\ChunkWriter.h" -#include "..\Specific\IO\LEB128.h" -#include "..\Specific\IO\Streams.h" - -using namespace std; +#include "ChunkId.h" +#include "ChunkReader.h" +#include "ChunkWriter.h" +#include "LEB128.h" +#include "Streams.h" +#include "items.h" #define ITEM_PARAM_currentAnimState 0 #define ITEM_PARAM_goalAnimState 1 diff --git a/TR5Main/Scripting/LanguageScript.cpp b/TR5Main/Scripting/LanguageScript.cpp index f42ba61d6..1f60e1a4c 100644 --- a/TR5Main/Scripting/LanguageScript.cpp +++ b/TR5Main/Scripting/LanguageScript.cpp @@ -1,3 +1,4 @@ +#include "framework.h" #include "LanguageScript.h" LanguageScript::LanguageScript(char* name) diff --git a/TR5Main/Scripting/LanguageScript.h b/TR5Main/Scripting/LanguageScript.h index d98f60b75..931b24572 100644 --- a/TR5Main/Scripting/LanguageScript.h +++ b/TR5Main/Scripting/LanguageScript.h @@ -1,10 +1,5 @@ #pragma once -#include -#include - -using namespace std; - // Define string ids #define STRING_PASSPORT 1 #define STRING_LARA_HOME 2 diff --git a/TR5Main/Specific/IO/ChunkId.h b/TR5Main/Specific/IO/ChunkId.h index 9408c61d3..123d107f3 100644 --- a/TR5Main/Specific/IO/ChunkId.h +++ b/TR5Main/Specific/IO/ChunkId.h @@ -1,20 +1,9 @@ #pragma once - -#include -#include -#include -#include - #include "LEB128.h" #include "Streams.h" using namespace std; -class IHasChunkReader -{ - -}; - typedef struct ChunkId { private: diff --git a/TR5Main/Specific/IO/ChunkReader.h b/TR5Main/Specific/IO/ChunkReader.h index 9f3c9ed1b..1a3ee84d8 100644 --- a/TR5Main/Specific/IO/ChunkReader.h +++ b/TR5Main/Specific/IO/ChunkReader.h @@ -1,8 +1,4 @@ #pragma once - -#include -#include -#include #include "ChunkId.h" #include "LEB128.h" #include "Streams.h" diff --git a/TR5Main/Specific/Init.cpp b/TR5Main/Specific/Init.cpp index 2a8223f43..46d79d1b2 100644 --- a/TR5Main/Specific/Init.cpp +++ b/TR5Main/Specific/Init.cpp @@ -1,2 +1,3 @@ +#include "framework.h" #include "init.h" diff --git a/TR5Main/Specific/configuration.cpp b/TR5Main/Specific/configuration.cpp index 89a60a5d8..8116a3dcc 100644 --- a/TR5Main/Specific/configuration.cpp +++ b/TR5Main/Specific/configuration.cpp @@ -1,19 +1,14 @@ +#include "framework.h" #include "configuration.h" - #include "winmain.h" -#include "..\resource.h" -#include "..\Renderer\Renderer11.h" -#include "..\Specific\input.h" -#include "..\Scripting\GameFlowScript.h" - -#include +#include "resource.h" +#include "Renderer11.h" +#include "input.h" +#include "GameFlowScript.h" #include "configuration.h" -#include -#include "../Game/sound.h" +#include "sound.h" -extern Renderer11* g_Renderer; extern GameFlow* g_GameFlow; - GameConfiguration g_Configuration; void LoadResolutionsInCombobox(HWND handle, int index) diff --git a/TR5Main/Specific/init.h b/TR5Main/Specific/init.h index 1c6fd9964..5919022e0 100644 --- a/TR5Main/Specific/init.h +++ b/TR5Main/Specific/init.h @@ -1,4 +1,4 @@ #pragma once -#include "..\Global\global.h" + diff --git a/TR5Main/Specific/input.cpp b/TR5Main/Specific/input.cpp index 30324967d..025efb5e8 100644 --- a/TR5Main/Specific/input.cpp +++ b/TR5Main/Specific/input.cpp @@ -1,11 +1,10 @@ +#include "framework.h" #include "input.h" -#include "..\Global\global.h" -#include -#include "..\Game\Lara.h" +#include "Lara.h" #include "winmain.h" -#include "../Game/camera.h" -#include "../Game/sound.h" -#include "../Game/savegame.h" +#include "camera.h" +#include "sound.h" +#include "savegame.h" const char* g_KeyNames[] = { NULL, "ESC", "1", "2", "3", "4", "5", "6", @@ -270,7 +269,8 @@ int S_UpdateInput()// (F) if (Lara.gunStatus == LG_READY) { - Savegame.AutoTarget = 1; // App.; + // TODO: AutoTarget Not Saved + //Savegame.AutoTarget = 1; if (linput & IN_LOOK) { diff --git a/TR5Main/Specific/input.h b/TR5Main/Specific/input.h index 15811f049..9c81d6ff0 100644 --- a/TR5Main/Specific/input.h +++ b/TR5Main/Specific/input.h @@ -1,5 +1,5 @@ #pragma once -#include "..\Global\global.h" + #define NUM_CONTROLS 18 @@ -148,6 +148,44 @@ #define DIK_MAIL 0xEC /* Mail */ #define DIK_MEDIASELECT 0xED /* Media Select */ +enum INPUT_BUTTONS +{ + IN_NONE = 0, // 0x00000000 + IN_FORWARD = (1 << 0), // 0x00000001 + IN_BACK = (1 << 1), // 0x00000002 + IN_LEFT = (1 << 2), // 0x00000004 + IN_RIGHT = (1 << 3), // 0x00000008 + IN_JUMP = (1 << 4), // 0x00000010 + IN_DRAW = (1 << 5), // Space / Triangle // 0x00000020 + IN_ACTION = (1 << 6), // Ctrl / X // 0x00000040 + IN_WALK = (1 << 7), // Shift / R1 // 0x00000080 + IN_OPTION = (1 << 8), // 0x00000100 + IN_LOOK = (1 << 9), // 0x00000200 + IN_LSTEP = (1 << 10), // 0x00000400 + IN_RSTEP = (1 << 11), // 0x00000800 + IN_ROLL = (1 << 12), // End / O // 0x00001000 + IN_PAUSE = (1 << 13), // 0x00002000 + IN_A = (1 << 14), // 0x00004000 + IN_B = (1 << 15), // 0x00008000 + IN_CHEAT = (1 << 16), // 0x00010000 + IN_D = (1 << 17), // 0x00020000 + IN_E = (1 << 18), // 0x00040000 + IN_FLARE = (1 << 19), // 0x00080000 + IN_SELECT = (1 << 20), // 0x00100000 + IN_DESELECT = (1 << 21), // 0x00200000 + IN_SAVE = (1 << 22), // F5 // 0x00400000 + IN_LOAD = (1 << 23), // F6 // 0x00800000 + IN_STEPSHIFT = (1 << 24), // 0x01000000 + IN_LOOKLEFT = (1 << 25), // 0x02000000 + IN_LOOKRIGHT = (1 << 26), // 0x04000000 + IN_LOOKFORWARD = (1 << 27), // 0x08000000 + IN_LOOKBACK = (1 << 28), // 0x10000000 + IN_DUCK = (1 << 29), // 0x20000000 + IN_SPRINT = (1 << 30), // 0x40000000 + IN_LOOKSWITCH = (1 << 31), // 0x80000000 + IN_ALL = ~0, // 0xFFFFFFFF (-1) +}; + enum IKEYS { KEY_FORWARD = 0, diff --git a/TR5Main/Specific/level.cpp b/TR5Main/Specific/level.cpp index c8d7dffd1..386958ea8 100644 --- a/TR5Main/Specific/level.cpp +++ b/TR5Main/Specific/level.cpp @@ -1,31 +1,18 @@ +#include "framework.h" #include "level.h" -#include "..\Global\global.h" -#include "..\Game\items.h" -#include "..\Specific\setup.h" -#include "..\Game\draw.h" -#include "..\Game\lot.h" -#include "..\Game\Lara.h" -#include "..\Game\savegame.h" -#include "..\Game\spotcam.h" -#include "..\Game\camera.h" -#include "..\Scripting\GameFlowScript.h" -#include "..\Game\control.h" -#include "..\Game\pickup.h" -#include "../Game/door.h" -#include "../Game/box.h" - -#include "IO/ChunkId.h" -#include "IO/ChunkReader.h" -#include "IO/ChunkWriter.h" -#include "IO/LEB128.h" - -#include -#include -#include -#include -#include "IO/Streams.h" -#include -#include "../Game/sound.h" +#include "setup.h" +#include "draw.h" +#include "lot.h" +#include "Lara.h" +#include "savegame.h" +#include "spotcam.h" +#include "camera.h" +#include "control.h" +#include "pickup.h" +#include "door.h" +#include "box.h" +#include "sound.h" +#include "GameFlowScript.h" ChunkId* ChunkTriggersList = ChunkId::FromString("Tr5Triggers"); ChunkId* ChunkTrigger = ChunkId::FromString("Tr5Trigger"); @@ -56,8 +43,6 @@ unsigned int ThreadId; int IsLevelLoading; bool g_FirstLevel = true; -using namespace std; - vector MoveablesIds; vector StaticObjectsIds; @@ -158,7 +143,7 @@ int LoadItems() && !(CurrentLevel == 5 && (r == 19 || r == 23 || r == 16))) { int fl = floor->floor << 2; - STATIC_INFO* st = &StaticObjects[mesh->staticNumber]; + StaticInfo* st = &StaticObjects[mesh->staticNumber]; if (fl <= mesh->y - st->yMaxc + 512 && fl < mesh->y - st->yMinc) { if (st->xMaxc == 0 || st->xMinc == 0 || @@ -178,10 +163,8 @@ int LoadItems() void LoadObjects() { - //DB_Log(2, "LoadObjects - DLL"); - memset(Objects, 0, sizeof(ObjectInfo) * ID_NUMBER_OBJECTS); - memset(StaticObjects, 0, sizeof(STATIC_INFO) * NUM_STATICS); + memset(StaticObjects, 0, sizeof(StaticInfo) * MAX_STATICS); int numMeshDataWords = ReadInt32(); int numMeshDataBytes = 2 * numMeshDataWords; @@ -192,8 +175,8 @@ void LoadObjects() MeshDataSize = numMeshDataBytes; int numMeshPointers = ReadInt32(); - Meshes = (short**)game_malloc(4 * numMeshPointers); - ReadBytes(Meshes, 4 * numMeshPointers); + Meshes = (short**)game_malloc(sizeof(short*) * numMeshPointers); + ReadBytes(Meshes, sizeof(short*) * numMeshPointers); for (int i = 0; i < numMeshPointers; i++) { @@ -216,12 +199,12 @@ void LoadObjects() ReadBytes(Ranges, sizeof(RANGE_STRUCT) * numRanges); int numCommands = ReadInt32(); - Commands = (short*)game_malloc(2 * numCommands); - ReadBytes(Commands, 2 * numCommands); + Commands = (short*)game_malloc(sizeof(short) * numCommands); + ReadBytes(Commands, sizeof(short) * numCommands); int numBones = ReadInt32(); - Bones = (int*)game_malloc(4 * numBones); - ReadBytes(Bones, 4 * numBones); + Bones = (int*)game_malloc(sizeof(int) * numBones); + ReadBytes(Bones, sizeof(int) * numBones); int* bone = Bones; for (int i = 0; i < 15; i++) @@ -232,20 +215,20 @@ void LoadObjects() int linkZ = *(bone++); } - MeshTrees = (int*)game_malloc(4 * numBones); + MeshTrees = (int*)game_malloc(sizeof(int) * numBones); - memcpy(MeshTrees, Bones, 4 * numBones); + memcpy(MeshTrees, Bones, sizeof(int) * numBones); int numFrames = ReadInt32(); - Frames = (short*)game_malloc(2 * numFrames); - ReadBytes(Frames, 2 * numFrames); + Frames = (short*)game_malloc(sizeof(short) * numFrames); + ReadBytes(Frames, sizeof(short) * numFrames); AnimationsCount = numAnimations; if (AnimationsCount > 0) { int i = 0; for (int i = 0; i < AnimationsCount; i++) - ADD_PTR(Anims[i].framePtr, short, Frames); + AddPtr(Anims[i].framePtr, short, Frames); } int numModels = ReadInt32(); @@ -319,7 +302,6 @@ void LoadCameras() void LoadTextures() { - //DB_Log(2, "LoadTextures - DLL"); printf("LoadTextures\n"); int uncompressedSize = 0; @@ -604,7 +586,6 @@ void BuildOutsideRoomsTable() void LoadRooms() { - //DB_Log(2, "LoadRooms - DLL"); printf("LoadRooms\n"); Wibble = 0; @@ -677,8 +658,8 @@ void LoadTextureInfos() for (int j = 0; j < 4; j++) { - texture->vertices[j].x = srctext.Vertices[j].Xpixel / 256.0; - texture->vertices[j].y = srctext.Vertices[j].Ypixel / 256.0; + texture->vertices[j].x = srctext.Vertices[j].Xpixel / 256.0f; + texture->vertices[j].y = srctext.Vertices[j].Ypixel / 256.0f; } // Adjust UV @@ -850,9 +831,8 @@ void Decompress(byte* dest, byte* src, unsigned long compressedSize, unsigned lo } } -unsigned __stdcall LoadLevel(void* data) +unsigned CALLBACK LoadLevel(void* data) { - //DB_Log(5, "LoadLevel - DLL"); printf("LoadLevel\n"); char* filename = (char*)data; @@ -1167,10 +1147,10 @@ void LoadSprites() Sprites[i].y = ReadInt8(); Sprites[i].width = ReadInt16(); Sprites[i].height = ReadInt16(); - Sprites[i].left = (ReadInt16() + 1) / 256.0; - Sprites[i].top = (ReadInt16() + 1) / 256.0; - Sprites[i].right = (ReadInt16() - 1) / 256.0; - Sprites[i].bottom = (ReadInt16() - 1) / 256.0; + Sprites[i].left = (ReadInt16() + 1) / 256.0f; + Sprites[i].top = (ReadInt16() + 1) / 256.0f; + Sprites[i].right = (ReadInt16() - 1) / 256.0f; + Sprites[i].bottom = (ReadInt16() - 1) / 256.0f; } g_NumSpritesSequences = ReadInt32(); @@ -1212,7 +1192,7 @@ void GetCarriedItems() if (abs(item2->pos.xPos - item->pos.xPos) < 512 && abs(item2->pos.zPos - item->pos.zPos) < 512 && abs(item2->pos.yPos - item->pos.yPos) < 256 - && Objects[item2->objectNumber].collision == PickupCollision) + && Objects[item2->objectNumber].isPickup) { item2->carriedItem = item->carriedItem; item->carriedItem = linknum; diff --git a/TR5Main/Specific/level.h b/TR5Main/Specific/level.h index c4f9b2d6d..fbfaa6ec9 100644 --- a/TR5Main/Specific/level.h +++ b/TR5Main/Specific/level.h @@ -1,20 +1,95 @@ #pragma once +#include "ChunkId.h" +#include "ChunkReader.h" +#include "LEB128.h" +#include "Streams.h" -#include "..\Global\global.h" +#include "items.h" +#include "room.h" -#include -#include - -#include "IO/ChunkId.h" -#include "IO/ChunkReader.h" -#include "IO/LEB128.h" +#define AddPtr(p, t, n) p = (t*)((char*)(p) + (ptrdiff_t)(n)); +#define MESHES(slot, mesh) Meshes[Objects[slot].meshIndex + mesh] struct ChunkId; struct LEB128; -#define AddPtr(p, t, n) p = (t*)((char*)(p) + (ptrdiff_t)(n)); +typedef struct OBJECT_TEXTURE_VERT +{ + float x; + float y; +}; -using namespace std; +typedef struct OBJECT_TEXTURE +{ + short attribute; + short tileAndFlag; + short newFlags; + struct OBJECT_TEXTURE_VERT vertices[4]; +}; + +#pragma pack(push, 1) +struct tr_object_texture_vert +{ + byte Xcoordinate; // 1 if Xpixel is the low value, 255 if Xpixel is the high value in the object texture + byte Xpixel; + byte Ycoordinate; // 1 if Ypixel is the low value, 255 if Ypixel is the high value in the object texture + byte Ypixel; +}; + +struct tr4_object_texture +{ + short Attribute; + short TileAndFlag; + short NewFlags; + tr_object_texture_vert Vertices[4]; // The four corners of the texture + int OriginalU; + int OriginalV; + int Width; // Actually width-1 + int Height; // Actually height-1 + short Padding; +}; +#pragma pack(pop) + +typedef struct AIOBJECT +{ + short objectNumber; + short roomNumber; + int x; + int y; + int z; + short triggerFlags; + short flags; + short yRot; + short boxNumber; +}; + +typedef struct CHANGE_STRUCT +{ + short goalAnimState; + short numberRanges; + short rangeIndex; +}; + +typedef struct RANGE_STRUCT +{ + short startFrame; + short endFrame; + short linkAnimNum; + short linkFrameNum; +}; + +typedef struct SPRITE +{ + short tile; + byte x; + byte y; + short width; + short height; + float left; + float top; + float right; + float bottom; +}; extern byte* Texture32; extern byte* Texture16; @@ -81,7 +156,7 @@ void FileClose(FILE* ptr); void FixUpRoom(ROOM_INFO* room, ROOM_INFO* roomData); void Decompress(byte* dest, byte* src, unsigned long compressedSize, unsigned long uncompressedSize); -unsigned __stdcall LoadLevel(void* data); +unsigned CALLBACK LoadLevel(void* data); // New functions for loading data from TR5M footer bool ReadLuaIds(ChunkId* chunkId, int maxSize, int arg); diff --git a/TR5Main/Specific/newlevel.cpp b/TR5Main/Specific/levelloader.cpp similarity index 70% rename from TR5Main/Specific/newlevel.cpp rename to TR5Main/Specific/levelloader.cpp index 87695e85e..29a54faef 100644 --- a/TR5Main/Specific/newlevel.cpp +++ b/TR5Main/Specific/levelloader.cpp @@ -1,13 +1,16 @@ -#include "newlevel.h" -#include "../Specific/IO/ChunkId.h" -#include "../Specific/IO/ChunkReader.h" +#include "framework.h" +#include "levelloader.h" +#include "ChunkId.h" +#include "ChunkReader.h" +#include "level.h" +#include -TrLevel::TrLevel(string filename) +LevelLoader::LevelLoader(string filename) { m_filename = filename; } -TrLevel::~TrLevel() +LevelLoader::~LevelLoader() { delete m_chunkTextureAtlas; delete m_chunkTextureColor; @@ -56,9 +59,10 @@ TrLevel::~TrLevel() delete m_chunkDummy; delete m_chunkAnimatedTextureSequence; delete m_chunkAnimatedTextureFrame; + delete m_chunkFloorData; } -bool TrLevel::Load() +bool LevelLoader::Load() { m_stream = new FileStream((char*)m_filename.c_str(), true, false); m_reader = new ChunkReader(m_magicNumber, m_stream); @@ -71,6 +75,22 @@ bool TrLevel::Load() return readAnimatedTextureSequence(); else if (id->EqualsTo(m_chunkRoom)) return readRoom(); + else if (id->EqualsTo(m_chunkFloorData)) + return readRoom(); + else if (id->EqualsTo(m_chunkMesh)) + return readMesh(); + else if (id->EqualsTo(m_chunkBone)) + return readBone(); + else if (id->EqualsTo(m_chunkStateChange)) + return readChange(); + else if (id->EqualsTo(m_chunkAnimDispatch)) + return readDispatch(); + else if (id->EqualsTo(m_chunkKeyFrame)) + return readKeyFrame(); + else if (id->EqualsTo(m_chunkAnimCommand)) + return readCommand(); + else if (id->EqualsTo(m_chunkAnimation)) + return readAnimation(); else if (id->EqualsTo(m_chunkMoveable)) return readMoveable(); else if (id->EqualsTo(m_chunkStatic)) @@ -93,8 +113,12 @@ bool TrLevel::Load() return readSoundMap(); else if (id->EqualsTo(m_chunkSoundDetail)) return readSoundDetail(); + else if (id->EqualsTo(m_chunkSample)) + return readSample(); else if (id->EqualsTo(m_chunkBox)) return readBox(); + else if (id->EqualsTo(m_chunkOverlap)) + return readOverlap(); else if (id->EqualsTo(m_chunkZone)) return readZones(); else @@ -110,7 +134,7 @@ bool TrLevel::Load() ChunkReader* m_reader; -bool TrLevel::readTexture() +bool LevelLoader::readTexture() { TrTexturePage texture; @@ -134,11 +158,12 @@ bool TrLevel::readTexture() } }, 0); - textures.push_back(texture); + m_level.textures.push_back(texture); + return true; } -bool TrLevel::readAnimatedTextureSequence() +bool LevelLoader::readAnimatedTextureSequence() { TrAnimatedTexturesSequence sequence; @@ -169,11 +194,12 @@ bool TrLevel::readAnimatedTextureSequence() } }, 0); - animatedTextures.push_back(sequence); + m_level.animatedTextures.push_back(sequence); + return true; } -bool TrLevel::readRoom() +bool LevelLoader::readRoom() { TrRoom room; @@ -237,7 +263,10 @@ bool TrLevel::readRoom() else if (id->EqualsTo(m_chunkRoomSector)) { TrSector sector; - m_stream->ReadInt32(§or.boxIndex); + + m_stream->ReadInt32(§or.floorDataIndex); + m_stream->ReadInt32(§or.floorDataCount); + m_stream->ReadInt32(§or.box); m_stream->ReadInt32(§or.pathfindingFlags); m_stream->ReadInt32(§or.stepSound); m_stream->ReadInt32(§or.roomBelow); @@ -264,7 +293,7 @@ bool TrLevel::readRoom() return true; } -bool TrLevel::readBucket(TrBucket* bucket) +bool LevelLoader::readBucket(TrBucket* bucket) { m_reader->ReadChunks([this, bucket](ChunkId * id, long size, int arg) { if (id->EqualsTo(m_chunkMaterial)) @@ -370,15 +399,30 @@ bool TrLevel::readBucket(TrBucket* bucket) return true; } -bool TrLevel::readMesh(TrMesh* mesh) +bool LevelLoader::readFloorData() { - m_stream->ReadBoundingSphere(&mesh->sphere); - m_reader->ReadChunks([this, mesh](ChunkId * id, long size, int arg) { + int count; + m_stream->ReadInt32(&count); + for (int i = 0; i < count; i++) + { + int data; + m_stream->ReadInt32(&data); + m_level.floorData.push_back(data); + } + return true; +} + +bool LevelLoader::readMesh() +{ + TrMesh mesh; + + m_stream->ReadBoundingSphere(&mesh.sphere); + m_reader->ReadChunks([this, &mesh](ChunkId * id, long size, int arg) { if (id->EqualsTo(m_chunkBucket)) { TrBucket bucket; readBucket(&bucket); - mesh->buckets.push_back(bucket); + mesh.buckets.push_back(bucket); return true; } else @@ -386,23 +430,36 @@ bool TrLevel::readMesh(TrMesh* mesh) return false; } }, 0); + m_level.meshes.push_back(mesh); + return true; } -bool TrLevel::readAnimation(TrAnimation* animation) +bool LevelLoader::readAnimation() { - m_stream->ReadInt32(&animation->framerate); - m_stream->ReadInt32(&animation->state); - m_stream->ReadInt32(&animation->nextAnimation); - m_stream->ReadInt32(&animation->nextFrame); - m_stream->ReadInt32(&animation->frameStart); - m_stream->ReadInt32(&animation->frameEnd); - m_stream->ReadFloat(&animation->speed); - m_stream->ReadFloat(&animation->acceleration); - m_stream->ReadFloat(&animation->lateralSpeed); - m_stream->ReadFloat(&animation->lateralAcceleration); + TrAnimation animation; - m_reader->ReadChunks([this, animation](ChunkId * id, long size, int arg) { + m_stream->ReadInt32(&animation.framerate); + m_stream->ReadInt32(&animation.state); + m_stream->ReadInt32(&animation.nextAnimation); + m_stream->ReadInt32(&animation.nextFrame); + m_stream->ReadInt32(&animation.frameBase); + m_stream->ReadInt32(&animation.frameEnd); + m_stream->ReadFloat(&animation.speed); + m_stream->ReadFloat(&animation.acceleration); + m_stream->ReadFloat(&animation.lateralSpeed); + m_stream->ReadFloat(&animation.lateralAcceleration); + m_stream->ReadInt32(&animation.framesIndex); + m_stream->ReadInt32(&animation.framesCount); + m_stream->ReadInt32(&animation.changesIndex); + m_stream->ReadInt32(&animation.changesCount); + m_stream->ReadInt32(&animation.commandsIndex); + m_stream->ReadInt32(&animation.commandsCount); + + m_reader->ReadChunks([this, &animation](ChunkId * id, long size, int arg) { + return false; + + /* if (id->EqualsTo(m_chunkKeyFrame)) { TrKeyFrame kf; @@ -469,20 +526,112 @@ bool TrLevel::readAnimation(TrAnimation* animation) else { return false; - } + }*/ }, 0); + m_level.animations.push_back(animation); + return true; } -bool TrLevel::readMoveable() +bool LevelLoader::readChange() +{ + TrStateChange change; + + m_stream->ReadInt32(&change.state); + m_stream->ReadInt32(&change.dispatchIndex); + m_stream->ReadInt32(&change.dispatchCount); + + m_reader->ReadChunks([this, &change](ChunkId * id, long size, int arg) { + return false; + }, 0); + + m_level.changes.push_back(change); + + return true; +} + +bool LevelLoader::readDispatch() +{ + TrAnimDispatch dispatch; + + m_stream->ReadInt32(&dispatch.inFrame); + m_stream->ReadInt32(&dispatch.outFrame); + m_stream->ReadInt32(&dispatch.nextAnimation); + m_stream->ReadInt32(&dispatch.nextFrame); + + m_level.dispatches.push_back(dispatch); + + return true; +} + +bool LevelLoader::readBone() +{ + TrBone bone; + + m_stream->ReadInt32(&bone.opcode); + m_stream->ReadVector3(&bone.offset); + + m_level.bones.push_back(bone); + + return true; +} + +bool LevelLoader::readCommand() +{ + TrAnimCommand cmd; + + m_stream->ReadInt32(&cmd.type); + m_stream->ReadInt32(&cmd.frame); + int count = 0; + m_stream->ReadInt32(&count); + for (int i = 0; i < count; i++) + { + int p; + m_stream->ReadInt32(&p); + cmd.params.push_back(p); + } + + m_level.commands.push_back(cmd); + + return true; +} + +bool LevelLoader::readKeyFrame() +{ + TrKeyFrame kf; + + m_stream->ReadVector3(&kf.origin); + m_stream->ReadBoundingBox(&kf.boundingBox); + int count = 0; + m_stream->ReadInt32(&count); + for (int i = 0; i < count; i++) + { + Quaternion q; + m_stream->ReadQuaternion(&q); + kf.angles.push_back(q); + } + + m_level.frames.push_back(kf); + + return true; +} + +bool LevelLoader::readMoveable() { TrMoveable moveable; m_stream->ReadInt32(&moveable.id); + m_stream->ReadInt32(&moveable.meshIndex); + m_stream->ReadInt32(&moveable.meshCount); + m_stream->ReadInt32(&moveable.bonesIndex); + m_stream->ReadInt32(&moveable.bonesCount); + m_stream->ReadInt32(&moveable.animationIndex); + m_stream->ReadInt32(&moveable.animationCount); m_reader->ReadChunks([this, &moveable](ChunkId * id, long size, int arg) { - if (id->EqualsTo(m_chunkMesh)) + return false; + /*if (id->EqualsTo(m_chunkMesh)) { TrMesh mesh; readMesh(&mesh); @@ -507,23 +656,26 @@ bool TrLevel::readMoveable() else { return false; - } + }*/ }, 0); - moveables.push_back(moveable); + m_level.moveables.push_back(moveable); return true; } -bool TrLevel::readStatic() +bool LevelLoader::readStatic() { TrStatic st; m_stream->ReadInt32(&st.id); m_stream->ReadBoundingBox(&st.visibilityBox); m_stream->ReadBoundingBox(&st.collisionBox); + m_stream->ReadInt32(&st.meshNumber); + m_stream->ReadInt32(&st.meshCount); + m_reader->ReadChunks([this, &st](ChunkId * id, long size, int arg) { - if (id->EqualsTo(m_chunkMesh)) + /*if (id->EqualsTo(m_chunkMesh)) { TrMesh mesh; readMesh(&mesh); @@ -533,22 +685,26 @@ bool TrLevel::readStatic() else { return false; - } + }*/ + return false; }, 0); - statics.push_back(st); + m_level.statics.push_back(st); return true; } -bool TrLevel::readSpriteSequence() +bool LevelLoader::readSpriteSequence() { TrSpriteSequence sequence; m_stream->ReadInt32(&sequence.id); + m_stream->ReadInt32(&sequence.spritesIndex); + m_stream->ReadInt32(&sequence.spritesCount); + m_reader->ReadChunks([this, &sequence](ChunkId * id, long size, int arg) { - if (id->EqualsTo(m_chunkSprite)) + /*if (id->EqualsTo(m_chunkSprite)) { TrSprite sprite; @@ -567,51 +723,55 @@ bool TrLevel::readSpriteSequence() else { return false; - } + }*/ + + return false; }, 0); - spriteSequences.push_back(sequence); + m_level.spriteSequences.push_back(sequence); return true; } -bool TrLevel::readItem() +bool LevelLoader::readItem() { TrItem item; m_stream->ReadString(&item.name); m_stream->ReadVector3(&item.position); m_stream->ReadQuaternion(&item.rotation); + m_stream->ReadFloat(&item.angle); m_stream->ReadVector3(&item.scale); m_stream->ReadVector3(&item.color); m_stream->ReadInt32(&item.roomNumber); m_stream->ReadInt32(&item.objectNumber); m_stream->ReadString(&item.script); - items.push_back(item); + m_level.items.push_back(item); return true; } -bool TrLevel::readAiItem() +bool LevelLoader::readAiItem() { TrItem item; m_stream->ReadString(&item.name); m_stream->ReadVector3(&item.position); m_stream->ReadQuaternion(&item.rotation); + m_stream->ReadFloat(&item.angle); m_stream->ReadVector3(&item.scale); m_stream->ReadVector3(&item.color); m_stream->ReadInt32(&item.roomNumber); m_stream->ReadInt32(&item.objectNumber); m_stream->ReadString(&item.script); - aiItems.push_back(item); + m_level.aiItems.push_back(item); return true; } -bool TrLevel::readSink() +bool LevelLoader::readSink() { TrSink sink; @@ -623,12 +783,12 @@ bool TrLevel::readSink() m_reader->ReadChunks([this, sink](ChunkId * id, long size, int arg) { return false; }, 0); - sinks.push_back(sink); + m_level.sinks.push_back(sink); return true; } -bool TrLevel::readCamera() +bool LevelLoader::readCamera() { TrCamera camera; @@ -641,12 +801,12 @@ bool TrLevel::readCamera() m_reader->ReadChunks([this, camera](ChunkId * id, long size, int arg) { return false; }, 0); - cameras.push_back(camera); + m_level.cameras.push_back(camera); return true; } -bool TrLevel::readFlybyCamera() +bool LevelLoader::readFlybyCamera() { TrFlybyCamera camera; @@ -665,12 +825,12 @@ bool TrLevel::readFlybyCamera() m_reader->ReadChunks([this, camera](ChunkId * id, long size, int arg) { return false; }, 0); - flybyCameras.push_back(camera); + m_level.flybyCameras.push_back(camera); return true; } -bool TrLevel::readSoundSource() +bool LevelLoader::readSoundSource() { TrSoundSource soundSource; @@ -682,12 +842,12 @@ bool TrLevel::readSoundSource() m_reader->ReadChunks([this, soundSource](ChunkId * id, long size, int arg) { return false; }, 0); - soundSources.push_back(soundSource); + m_level.soundSources.push_back(soundSource); return true; } -bool TrLevel::readBox() +bool LevelLoader::readBox() { TrBox box; @@ -713,26 +873,26 @@ bool TrLevel::readBox() } }, 0); - boxes.push_back(box); + m_level.boxes.push_back(box); return true; } -bool TrLevel::readZones() +bool LevelLoader::readZones() { - for (int z = 0; z < 5; z++) - for (int a = 0; a < 2; a++) - for (int b = 0; b < boxes.size(); b++) + for (int a = 0; a < 2; a++) + for (int z = 0; z < 5; z++) + for (int b = 0; b < m_level.boxes.size(); b++) { int zone; m_stream->ReadInt32(&zone); - zones.push_back(zone); + m_level.zones[z][a].push_back(zone); } return true; } -bool TrLevel::readSoundMap() +bool LevelLoader::readSoundMap() { int count; m_stream->ReadInt32(&count); @@ -740,13 +900,13 @@ bool TrLevel::readSoundMap() { int sound; m_stream->ReadInt32(&sound); - soundMap.push_back(sound); + m_level.soundMap.push_back(sound); } return true; } -bool TrLevel::readSoundDetail() +bool LevelLoader::readSoundDetail() { TrSoundDetails detail; @@ -760,7 +920,7 @@ bool TrLevel::readSoundDetail() m_stream->ReadByte(&detail.loop); m_reader->ReadChunks([this, &detail](ChunkId * id, long size, int arg) { - if (id->EqualsTo(m_chunkSample)) + /*if (id->EqualsTo(m_chunkSample)) { TrSample sample; @@ -776,10 +936,40 @@ bool TrLevel::readSoundDetail() else { return false; - } + }*/ + return false; }, 0); - soundDetails.push_back(detail); + m_level.soundDetails.push_back(detail); return true; } + +bool LevelLoader::readSample() +{ + TrSample sample; + + m_stream->ReadInt32(&sample.uncompressedSize); + m_stream->ReadInt32(&sample.compressedSize); + sample.data = (byte*)malloc(sample.compressedSize); + m_stream->ReadBytes(sample.data, sample.compressedSize); + + Sound_LoadSample((char*)sample.data, sample.compressedSize, sample.uncompressedSize, m_numSamples); + m_numSamples++; + + return true; +} + +bool LevelLoader::readOverlap() +{ + TrOverlap overlap; + + m_stream->ReadInt32(&overlap.box); + m_stream->ReadInt32(&overlap.flags); + + m_reader->ReadChunks([this, &overlap](ChunkId * id, long size, int arg) { return false; }, 0); + + m_level.overlaps.push_back(overlap); + + return true; +} \ No newline at end of file diff --git a/TR5Main/Specific/levelloader.h b/TR5Main/Specific/levelloader.h new file mode 100644 index 000000000..b61c8ea06 --- /dev/null +++ b/TR5Main/Specific/levelloader.h @@ -0,0 +1,100 @@ +#pragma once +#include "framework.h" +#include "sound.h" +#include "Streams.h" +#include "newtypes.h" +#include "ChunkId.h" +#include "ChunkReader.h" + +class LevelLoader +{ +private: + ChunkId* m_chunkTextureAtlas = ChunkId::FromString("T5MTex"); + ChunkId* m_chunkTextureColor = ChunkId::FromString("T5MTexColMap"); + ChunkId* m_chunkTextureNormalMap = ChunkId::FromString("T5MTexNrmMap"); + ChunkId* m_chunkRoom = ChunkId::FromString("T5MRoom"); + ChunkId* m_chunkRoomInfo = ChunkId::FromString("T5MRoomInfo"); + ChunkId* m_chunkBucket = ChunkId::FromString("T5MBckt"); + ChunkId* m_chunkRoomLight = ChunkId::FromString("T5MLight"); + ChunkId* m_chunkRoomStatic = ChunkId::FromString("T5MRoomSt"); + ChunkId* m_chunkRoomPortal = ChunkId::FromString("T5MPortal"); + ChunkId* m_chunkRoomSector = ChunkId::FromString("T5MSector"); + ChunkId* m_chunkRoomTriggerVolume = ChunkId::FromString("T5MTrigVol"); + ChunkId* m_chunkRoomClimbVolume = ChunkId::FromString("T5MClimbVol"); + ChunkId* m_chunkMaterial = ChunkId::FromString("T5MMat"); + ChunkId* m_chunkVerticesPositions = ChunkId::FromString("T5MVrtPos"); + ChunkId* m_chunkVerticesNormals = ChunkId::FromString("T5MVrtN"); + ChunkId* m_chunkVerticesTextureCoords = ChunkId::FromString("T5MVrtUV"); + ChunkId* m_chunkVerticesColors = ChunkId::FromString("T5MVrtCol"); + ChunkId* m_chunkVerticesEffects = ChunkId::FromString("T5MVrtFX"); + ChunkId* m_chunkVerticesBones = ChunkId::FromString("T5MVrtB"); + ChunkId* m_chunkPolygon = ChunkId::FromString("T5MPoly"); + ChunkId* m_chunkMesh = ChunkId::FromString("T5MMesh"); + ChunkId* m_chunkBone = ChunkId::FromString("T5MBone"); + ChunkId* m_chunkKeyFrame = ChunkId::FromString("T5MKf"); + ChunkId* m_chunkAnimCommand = ChunkId::FromString("T5MAnCmd"); + ChunkId* m_chunkStateChange = ChunkId::FromString("T5MStCh"); + ChunkId* m_chunkAnimDispatch = ChunkId::FromString("T5MAnDisp"); + ChunkId* m_chunkAnimation = ChunkId::FromString("T5MAnim"); + ChunkId* m_chunkMoveable = ChunkId::FromString("T5MMoveable"); + ChunkId* m_chunkStatic = ChunkId::FromString("T5MStatic"); + ChunkId* m_chunkItem = ChunkId::FromString("T5MItem"); + ChunkId* m_chunkAiItem = ChunkId::FromString("T5MAiItem"); + ChunkId* m_chunkCamera = ChunkId::FromString("T5MCamera"); + ChunkId* m_chunkSink = ChunkId::FromString("T5MSink"); + ChunkId* m_chunkFlybyCamera = ChunkId::FromString("T5MFlyBy"); + ChunkId* m_chunkSoundSource = ChunkId::FromString("T5MSndSrc"); + ChunkId* m_chunkBox = ChunkId::FromString("T5MBox"); + ChunkId* m_chunkOverlap = ChunkId::FromString("T5MOv"); + ChunkId* m_chunkZone = ChunkId::FromString("T5MZone"); + ChunkId* m_chunkSoundMap = ChunkId::FromString("T5MSoundMap"); + ChunkId* m_chunkSoundDetail = ChunkId::FromString("T5MSndDet"); + ChunkId* m_chunkSample = ChunkId::FromString("T5MSam"); + ChunkId* m_chunkLeelScript = ChunkId::FromString("T5MScript"); + ChunkId* m_chunkSprite = ChunkId::FromString("T5MSpr"); + ChunkId* m_chunkSpriteSequence = ChunkId::FromString("T5MSprSeq"); + ChunkId* m_chunkDummy = ChunkId::FromString("T5MDummy"); + ChunkId* m_chunkAnimatedTextureSequence = ChunkId::FromString("T5MAnTxSeq"); + ChunkId* m_chunkAnimatedTextureFrame = ChunkId::FromString("T5MAnTxFr"); + ChunkId* m_chunkFloorData = ChunkId::FromString("T5MFloorData"); + + int m_magicNumber = 0x4D355254; + string m_filename; + ChunkReader* m_reader; + FileStream* m_stream; + int m_numSamples = 0; + TrLevel m_level; + + bool readTexture(); + bool readAnimatedTextureSequence(); + bool readRoom(); + bool readBucket(TrBucket* bucket); + bool readMesh(); + bool readAnimation(); + bool readChange(); + bool readDispatch(); + bool readBone(); + bool readKeyFrame(); + bool readCommand(); + bool readOverlap(); + bool readFloorData(); + bool readMoveable(); + bool readStatic(); + bool readSpriteSequence(); + bool readItem(); + bool readAiItem(); + bool readSink(); + bool readCamera(); + bool readFlybyCamera(); + bool readSoundSource(); + bool readBox(); + bool readZones(); + bool readSoundMap(); + bool readSoundDetail(); + bool readSample(); + +public: + LevelLoader(string filename); + ~LevelLoader(); + bool Load(); +}; \ No newline at end of file diff --git a/TR5Main/Specific/newlevel.h b/TR5Main/Specific/newlevel.h deleted file mode 100644 index 32fe73f0c..000000000 --- a/TR5Main/Specific/newlevel.h +++ /dev/null @@ -1,431 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include "../Game/sound.h" -#include "../Specific/IO/Streams.h" - -using namespace std; -using namespace DirectX; -using namespace DirectX::SimpleMath; - -struct TrTexturePage -{ - int width; - int height; - int flags; - int format; - byte* colorMap; - byte* normalMap; -}; - -struct TrPolygon -{ - vector indices; - int animatedSequence; - int frame; -}; - -struct TrMaterial -{ - int texture; - byte blendMode; - bool animated; -}; - -struct TrBucket -{ - TrMaterial material; - vector positions; - vector colors; - vector textureCoords; - vector normals; - vector verticesEffects; - vector bones; - vector polygons; -}; - -struct TrVolume -{ - int type; - Vector3 position; - Quaternion rotation; - BoundingBox box; - BoundingSphere sphere; - string script; -}; - -struct TrClimbVolume : TrVolume -{ - int climbType; -}; - -struct TrTriggerVolume : TrVolume -{ - int activators; -}; - -struct TrSector -{ - int boxIndex; - int pathfindingFlags; - int stepSound; - int roomBelow; - int roomAbove; - int floor; - int ceiling; - vector floorData; -}; - -struct TrLight -{ - Vector3 position; - Vector3 color; - Vector3 direction; - byte type; - bool castShadows; - float intensity; - float in; - float out; - float len; - float cutoff; - int flags; -}; - -struct TrRoomStatic -{ - string name; - Vector3 position; - Quaternion rotation; - Vector3 scale; - int staticNumber; - Vector3 color; - bool receiveShadows; - bool castShadows; - int flags; - string script; -}; - -struct TrPortal -{ - int adjoiningRoom; - Vector3 normal; - vector vertices; -}; - -struct TrRoom -{ - int x; - int z; - int yBottom; - int yTop; - int numXsectors; - int numZsectors; - int roomType; - int reverb; - int effect; - float effectStrength; - int alternateRoom; - int alternatGroup; - int flags; - Vector3 ambient; - vector buckets; - vector lights; - vector statics; - vector sectors; - vector portals; - vector triggers; - vector climbVolumes; -}; - -struct TrMesh -{ - BoundingSphere sphere; - vector buckets; -}; - -struct TrBone -{ - int opcode; - Vector3 offset; -}; - -struct TrKeyFrame -{ - Vector3 origin; - BoundingBox boundingBox; - vector angles; -}; - -struct TrAnimCommand -{ - int type; - int frame; - vector params; -}; - -struct TrAnimDispatch -{ - int inFrame; - int outFrame; - int nextAnimation; - int nextFrame; -}; - -struct TrStateChange -{ - int state; - vector dispatches; -}; - -struct TrAnimation -{ - int framerate; - int state; - int nextAnimation; - int nextFrame; - int frameStart; - int frameEnd; - float speed; - float acceleration; - float lateralSpeed; - float lateralAcceleration; - vector keyframes; - vector changes; - vector commands; -}; - -struct TrMoveable -{ - int id; - vector meshes; - vector bones; - vector animations; -}; - -struct TrStatic -{ - int id; - BoundingBox visibilityBox; - BoundingBox collisionBox; - vector meshes; -}; - -struct TrAnimatedTexturesFrame -{ - int texture; - vector textureCoords; -}; - -struct TrAnimatedTexturesSequence -{ - byte animationType; - float fps; - int uvRotate; - vector frames; -}; - -struct TrItem -{ - string name; - Vector3 position; - Quaternion rotation; - Vector3 scale; - Vector3 color; - int roomNumber; - int objectNumber; - string script; -}; - -struct TrCamera -{ - string name; - Vector3 position; - int roomNumber; - int type; - int flags; - string script; -}; - -struct TrSoundSource -{ - string name; - Vector3 position; - int roomNumber; - float volume; - int sound; - int playMode; -}; - -struct TrSink -{ - string name; - Vector3 position; - int roomNumber; - float strength; - int box; -}; - -struct TrOverlap -{ - int flags; - int box; -}; - -struct TrBox -{ - Vector2 min; - Vector2 max; - int floor; - vector overlaps; -}; - -struct TrSample -{ - int uncompressedSize; - int compressedSize; - byte* data; -}; - -struct TrSoundDetails -{ - float volume; - float range; - float chance; - float pitch; - bool randomizePitch; - bool randomizeGain; - bool noPanoramic; - byte loop; - vector samples; -}; - -struct TrFlybyCamera -{ - string name; - int sequence; - int number; - Vector3 position; - Vector3 direction; - float fov; - float roll; - float speed; - int timer; - int roomNumber; - int flags; - string script; -}; - -struct TrSprite -{ - int texture; - vector textureCoords; -}; - -struct TrSpriteSequence -{ - int id; - vector sprites; -}; - -class TrLevel : IHasChunkReader -{ -private: - ChunkId* m_chunkTextureAtlas = ChunkId::FromString("T5MTex"); - ChunkId* m_chunkTextureColor = ChunkId::FromString("T5MTexColMap"); - ChunkId* m_chunkTextureNormalMap = ChunkId::FromString("T5MTexNrmMap"); - ChunkId* m_chunkRoom = ChunkId::FromString("T5MRoom"); - ChunkId* m_chunkRoomInfo = ChunkId::FromString("T5MRoomInfo"); - ChunkId* m_chunkBucket = ChunkId::FromString("T5MBckt"); - ChunkId* m_chunkRoomLight = ChunkId::FromString("T5MLight"); - ChunkId* m_chunkRoomStatic = ChunkId::FromString("T5MRoomSt"); - ChunkId* m_chunkRoomPortal = ChunkId::FromString("T5MPortal"); - ChunkId* m_chunkRoomSector = ChunkId::FromString("T5MSector"); - ChunkId* m_chunkRoomTriggerVolume = ChunkId::FromString("T5MTrigVol"); - ChunkId* m_chunkRoomClimbVolume = ChunkId::FromString("T5MClimbVol"); - ChunkId* m_chunkMaterial = ChunkId::FromString("T5MMat"); - ChunkId* m_chunkVerticesPositions = ChunkId::FromString("T5MVrtPos"); - ChunkId* m_chunkVerticesNormals = ChunkId::FromString("T5MVrtN"); - ChunkId* m_chunkVerticesTextureCoords = ChunkId::FromString("T5MVrtUV"); - ChunkId* m_chunkVerticesColors = ChunkId::FromString("T5MVrtCol"); - ChunkId* m_chunkVerticesEffects = ChunkId::FromString("T5MVrtFX"); - ChunkId* m_chunkVerticesBones = ChunkId::FromString("T5MVrtB"); - ChunkId* m_chunkPolygon = ChunkId::FromString("T5MPoly"); - ChunkId* m_chunkMesh = ChunkId::FromString("T5MMesh"); - ChunkId* m_chunkBone = ChunkId::FromString("T5MBone"); - ChunkId* m_chunkKeyFrame = ChunkId::FromString("T5MKf"); - ChunkId* m_chunkAnimCommand = ChunkId::FromString("T5MAnCmd"); - ChunkId* m_chunkStateChange = ChunkId::FromString("T5MStCh"); - ChunkId* m_chunkAnimDispatch = ChunkId::FromString("T5MAnDisp"); - ChunkId* m_chunkAnimation = ChunkId::FromString("T5MAnim"); - ChunkId* m_chunkMoveable = ChunkId::FromString("T5MMoveable"); - ChunkId* m_chunkStatic = ChunkId::FromString("T5MStatic"); - ChunkId* m_chunkItem = ChunkId::FromString("T5MItem"); - ChunkId* m_chunkAiItem = ChunkId::FromString("T5MAiItem"); - ChunkId* m_chunkCamera = ChunkId::FromString("T5MCamera"); - ChunkId* m_chunkSink = ChunkId::FromString("T5MSink"); - ChunkId* m_chunkFlybyCamera = ChunkId::FromString("T5MFlyBy"); - ChunkId* m_chunkSoundSource = ChunkId::FromString("T5MSndSrc"); - ChunkId* m_chunkBox = ChunkId::FromString("T5MBox"); - ChunkId* m_chunkOverlap = ChunkId::FromString("T5MOv"); - ChunkId* m_chunkZone = ChunkId::FromString("T5MZone"); - ChunkId* m_chunkSoundMap = ChunkId::FromString("T5MSoundMap"); - ChunkId* m_chunkSoundDetail = ChunkId::FromString("T5MSndDet"); - ChunkId* m_chunkSample = ChunkId::FromString("T5MSam"); - ChunkId* m_chunkLeelScript = ChunkId::FromString("T5MScript"); - ChunkId* m_chunkSprite = ChunkId::FromString("T5MSpr"); - ChunkId* m_chunkSpriteSequence = ChunkId::FromString("T5MSprSeq"); - ChunkId* m_chunkDummy = ChunkId::FromString("T5MDummy"); - ChunkId* m_chunkAnimatedTextureSequence = ChunkId::FromString("T5MAnTxSeq"); - ChunkId* m_chunkAnimatedTextureFrame = ChunkId::FromString("T5MAnTxFr"); - - int m_magicNumber = 0x4D355254; - string m_filename; - ChunkReader* m_reader; - FileStream* m_stream; - - bool readTexture(); - bool readAnimatedTextureSequence(); - bool readRoom(); - bool readBucket(TrBucket* bucket); - bool readMesh(TrMesh* mesh); - bool readAnimation(TrAnimation* animation); - bool readMoveable(); - bool readStatic(); - bool readSpriteSequence(); - bool readItem(); - bool readAiItem(); - bool readSink(); - bool readCamera(); - bool readFlybyCamera(); - bool readSoundSource(); - bool readBox(); - bool readZones(); - bool readSoundMap(); - bool readSoundDetail(); - -public: - vector textures; - vector rooms; - vector moveables; - vector statics; - vector items; - vector aiItems; - vector cameras; - vector soundSources; - vector sinks; - vector flybyCameras; - vector spriteSequences; - vector animatedTextures; - vector boxes; - vector zones; - vector soundMap; - vector soundDetails; - string script; - - TrLevel(string filename); - ~TrLevel(); - bool Load(); -}; \ No newline at end of file diff --git a/TR5Main/Specific/newtypes.h b/TR5Main/Specific/newtypes.h new file mode 100644 index 000000000..918121ea3 --- /dev/null +++ b/TR5Main/Specific/newtypes.h @@ -0,0 +1,378 @@ +#pragma once +#include "framework.h" + +struct TrTexturePage +{ + int width; + int height; + int flags; + int format; + byte* colorMap; + byte* normalMap; +}; + +struct TrPolygon +{ + vector indices; + int animatedSequence; + int frame; +}; + +struct TrMaterial +{ + int texture; + byte blendMode; + bool animated; +}; + +struct TrBucket +{ + TrMaterial material; + vector positions; + vector colors; + vector textureCoords; + vector normals; + vector verticesEffects; + vector bones; + vector polygons; +}; + +struct TrVolume +{ + int type; + Vector3 position; + Quaternion rotation; + BoundingBox box; + BoundingSphere sphere; + string script; +}; + +struct TrClimbVolume : TrVolume +{ + int climbType; +}; + +struct TrTriggerVolume : TrVolume +{ + int activators; +}; + +struct TrSector +{ + int floorDataIndex; + int floorDataCount; + int box; + int pathfindingFlags; + int stepSound; + int roomBelow; + int roomAbove; + int floor; + int ceiling; + vector floorData; +}; + +struct TrLight +{ + Vector3 position; + Vector3 color; + Vector3 direction; + byte type; + bool castShadows; + float intensity; + float in; + float out; + float len; + float cutoff; + int flags; +}; + +struct TrRoomStatic +{ + string name; + Vector3 position; + Quaternion rotation; + Vector3 scale; + int staticNumber; + Vector3 color; + bool receiveShadows; + bool castShadows; + int flags; + string script; +}; + +struct TrPortal +{ + int adjoiningRoom; + Vector3 normal; + vector vertices; +}; + +struct TrRoom +{ + int x; + int z; + int yBottom; + int yTop; + int numXsectors; + int numZsectors; + int roomType; + int reverb; + int effect; + float effectStrength; + int alternateRoom; + int alternatGroup; + int flags; + Vector3 ambient; + vector buckets; + vector lights; + vector statics; + vector sectors; + vector portals; + vector triggers; + vector climbVolumes; + int itemNumber; + int fxNumber; +}; + +struct TrMesh +{ + BoundingSphere sphere; + vector buckets; +}; + +struct TrBone +{ + int opcode; + Vector3 offset; +}; + +struct TrKeyFrame +{ + Vector3 origin; + BoundingBox boundingBox; + vector angles; +}; + +struct TrAnimCommand +{ + int type; + int frame; + vector params; +}; + +struct TrAnimDispatch +{ + int inFrame; + int outFrame; + int nextAnimation; + int nextFrame; +}; + +struct TrStateChange +{ + int state; + int dispatchIndex; + int dispatchCount; + vector dispatches; +}; + +struct TrAnimation +{ + int framerate; + int state; + int nextAnimation; + int nextFrame; + int frameBase; + int frameEnd; + float speed; + float acceleration; + float lateralSpeed; + float lateralAcceleration; + int framesIndex; + int framesCount; + int changesIndex; + int changesCount; + int commandsIndex; + int commandsCount; + vector keyframes; + vector changes; + vector commands; +}; + +struct TrMoveable +{ + int id; + int animationIndex; + int animationCount; + int meshIndex; + int meshCount; + int bonesIndex; + int bonesCount; + vector meshes; + vector bones; + vector animations; +}; + +struct TrStatic +{ + int id; + BoundingBox visibilityBox; + BoundingBox collisionBox; + int meshNumber; + int meshCount; + vector meshes; +}; + +struct TrAnimatedTexturesFrame +{ + int texture; + vector textureCoords; +}; + +struct TrAnimatedTexturesSequence +{ + byte animationType; + float fps; + int uvRotate; + vector frames; +}; + +struct TrItem +{ + string name; + Vector3 position; + Quaternion rotation; + float angle; + Vector3 scale; + Vector3 color; + int roomNumber; + int objectNumber; + string script; +}; + +struct TrCamera +{ + string name; + Vector3 position; + int roomNumber; + int type; + int flags; + string script; +}; + +struct TrSoundSource +{ + string name; + Vector3 position; + int roomNumber; + float volume; + int sound; + int playMode; +}; + +struct TrSink +{ + string name; + Vector3 position; + int roomNumber; + float strength; + int box; +}; + +struct TrOverlap +{ + int flags; + int box; +}; + +struct TrBox +{ + Vector2 min; + Vector2 max; + int floor; + int flags; + int overlapsIndex; + int overlapsCount; + vector overlaps; +}; + +struct TrSample +{ + int uncompressedSize; + int compressedSize; + byte* data; +}; + +struct TrSoundDetails +{ + float volume; + float range; + float chance; + float pitch; + bool randomizePitch; + bool randomizeGain; + bool noPanoramic; + byte loop; + vector samples; +}; + +struct TrFlybyCamera +{ + string name; + int sequence; + int number; + Vector3 position; + Vector3 direction; + float fov; + float roll; + float speed; + int timer; + int roomNumber; + int flags; + string script; +}; + +struct TrSprite +{ + int texture; + vector textureCoords; +}; + +struct TrSpriteSequence +{ + int id; + int spritesIndex; + int spritesCount; + vector sprites; +}; + +struct TrLevel +{ + vector textures; + vector rooms; + vector floorData; + vector meshes; + vector animations; + vector bones; + vector changes; + vector dispatches; + vector frames; + vector commands; + vector animatedTextures; + vector sprites; + vector spriteSequences; + vector soundMap; + vector soundDetails; + vector samples; + vector items; + vector aiItems; + vector moveables; + vector statics; + vector boxes; + vector overlaps; + vector zones[5][2]; + vector sinks; + vector cameras; + vector soundSources; + vector flybyCameras; +}; \ No newline at end of file diff --git a/TR5Main/Specific/setup.cpp b/TR5Main/Specific/setup.cpp index 4bd7fb1a1..fb780a756 100644 --- a/TR5Main/Specific/setup.cpp +++ b/TR5Main/Specific/setup.cpp @@ -1,31 +1,35 @@ +#include "framework.h" #include "setup.h" -#include "..\Game\draw.h" -#include "..\Game\collide.h" -#include "..\Game\effect2.h" -#include "..\Game\effects.h" -#include "..\Game\tomb4fx.h" -#include "..\Game\Box.h" -#include "..\Game\switch.h" -#include "..\Game\missile.h" -#include "..\Game\control.h" -#include "..\Game\pickup.h" -#include "../Game/camera.h" -#include "..\Game\lara1gun.h" -#include "..\Game\laraflar.h" -#include "..\Game\larafire.h" -#include "..\Game\laramisc.h" -#include "..\Game\objects.h" -#include "..\Game\door.h" -#include "..\Game\rope.h" -#include "..\Game\traps.h" -#include "..\Game\flmtorch.h" -#include "..\Objects\oldobjects.h" -#include "..\Objects\newobjects.h" - +#include "draw.h" +#include "collide.h" +#include "effect2.h" +#include "effect.h" +#include "tomb4fx.h" +#include "switch.h" +#include "missile.h" +#include "control.h" +#include "pickup.h" +#include "camera.h" +#include "lara1gun.h" +#include "laraflar.h" +#include "larafire.h" +#include "laramisc.h" +#include "objects.h" +#include "door.h" +#include "rope.h" +#include "traps.h" +#include "flmtorch.h" #include "level.h" - -#include -#include +#include "oldobjects.h" +#include "tr4_bubbles.h" +/// objects initializer +#include "tr1_objects.h" +#include "tr2_objects.h" +#include "tr3_objects.h" +#include "tr4_objects.h" +#include "tr5_objects.h" +/// register objects +#include "object_helper.h" extern byte SequenceUsed[6]; extern byte SequenceResults[3][3][3]; @@ -33,1937 +37,20 @@ extern byte Sequences[3]; extern byte CurrentSequence; extern int NumRPickups; -extern GUNSHELL_STRUCT Gunshells[MAX_GUNSHELL]; -extern BLOOD_STRUCT Blood[MAX_SPARKS_BLOOD]; -extern FIRE_SPARKS FireSparks[MAX_SPARKS_FIRE]; -extern SMOKE_SPARKS SmokeSparks[MAX_SPARKS_SMOKE]; -extern DRIP_STRUCT Drips[MAX_DRIPS]; -extern SHOCKWAVE_STRUCT ShockWaves[MAX_SHOCKWAVE]; -extern FIRE_LIST Fires[MAX_FIRE_LIST]; -extern GUNFLASH_STRUCT Gunflashes[MAX_GUNFLASH]; -extern SPARKS Sparks[MAX_SPARKS]; -extern SPLASH_STRUCT Splashes[MAX_SPLASH]; -extern RIPPLE_STRUCT Ripples[MAX_RIPPLES]; - ObjectInfo Objects[ID_NUMBER_OBJECTS]; -STATIC_INFO StaticObjects[NUM_STATICS]; +StaticInfo StaticObjects[MAX_STATICS]; -void NewObjects() +void InitialiseGameFlags() { - ObjectInfo* obj; + ZeroMemory(FlipMap, MAX_FLIPMAP * sizeof(int)); + ZeroMemory(FlipStats, MAX_FLIPMAP * sizeof(int)); - obj = &Objects[ID_SMALL_SCORPION]; - if (obj->loaded) - { - obj->initialise = InitialiseSmallScorpion; - obj->control = SmallScorpionControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 8; - obj->pivotLength = 20; - obj->radius = 128; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_WILD_BOAR]; - if (obj->loaded) - { - obj->initialise = InitialiseWildBoar; - obj->control = WildBoarControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 40; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex + 48 * 4] |= ROT_Z; - Bones[obj->boneIndex + 48 * 4] |= ROT_Y; - Bones[obj->boneIndex + 52 * 4] |= ROT_Z; - Bones[obj->boneIndex + 52 * 4] |= ROT_Y; - } - - obj = &Objects[ID_BAT]; - if (obj->loaded) - { - obj->initialise = InitialiseBat; - obj->control = BatControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 5; - obj->pivotLength = 10; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->zoneType = ZONE_FLYER; - } - - obj = &Objects[ID_CHAIN]; - if (obj->loaded) - { - obj->control = ChainControl; - obj->collision = GenericSphereBoxCollision; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_PLOUGH]; - if (obj->loaded) - { - obj->control = PloughControl; - obj->collision = GenericSphereBoxCollision; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_FLOOR_4BLADES]; - if (obj->loaded) - { - obj->control = FourBladesControl; - obj->collision = GenericSphereBoxCollision; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_CEILING_4BLADES]; - if (obj->loaded) - { - obj->control = FourBladesControl; - obj->collision = GenericSphereBoxCollision; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_SPIKEBALL]; - if (obj->loaded) - { - obj->control = SpikeballControl; - obj->collision = GenericSphereBoxCollision; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_COG]; - if (obj->loaded) - { - obj->control = CogControl; - obj->collision = GenericSphereBoxCollision; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_AHMET]; - if (obj->loaded) - { - obj->initialise = InitialiseAhmet; - obj->control = AhmetControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 80; - obj->pivotLength = 300; - obj->radius = 341; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - obj->hitEffect = HIT_BLOOD; - - Bones[obj->boneIndex + 9 * 4] |= ROT_Y; - } - - obj = &Objects[ID_BADDY1]; - if (obj->loaded) - { - obj->initialise = InitialiseBaddy; - obj->control = BaddyControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 25; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->meshSwapSlot = ID_MESHSWAP_BADDY1; - obj->zoneType = ZONE_HUMAN_JUMP_AND_MONKEY; - - Bones[obj->boneIndex + 28 * 4] |= ROT_Y; - Bones[obj->boneIndex + 28 * 4] |= ROT_X; - Bones[obj->boneIndex + 88 * 4] |= ROT_Y; - Bones[obj->boneIndex + 88 * 4] |= ROT_X; - } - - obj = &Objects[ID_BADDY2]; - if (obj->loaded) - { - obj->initialise = InitialiseBaddy; - obj->control = BaddyControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 25; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->meshSwapSlot = ID_MESHSWAP_BADDY2; - obj->zoneType = ZONE_HUMAN_JUMP_AND_MONKEY; - - Bones[obj->boneIndex + 28 * 4] |= ROT_Y; - Bones[obj->boneIndex + 28 * 4] |= ROT_X; - Bones[obj->boneIndex + 88 * 4] |= ROT_Y; - Bones[obj->boneIndex + 88 * 4] |= ROT_X; - } - - obj = &Objects[ID_SAS_CAIRO]; - if (obj->loaded) - { - obj->initialise = InitialiseSas; - obj->control = SasControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 40; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex] |= ROT_Y; - Bones[obj->boneIndex] |= ROT_X; - Bones[obj->boneIndex + 28 * 4] |= ROT_Y; - Bones[obj->boneIndex + 28 * 4] |= ROT_X; - } - - obj = &Objects[ID_MUMMY]; - if (obj->loaded) - { - obj->initialise = InitialiseMummy; - obj->control = MummyControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 15; - obj->radius = 170; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex + 28 * 4] |= ROT_Y; - Bones[obj->boneIndex + 28 * 4] |= ROT_X; - Bones[obj->boneIndex + 72 * 4] |= ROT_Y; - } - - obj = &Objects[ID_QUAD]; - if (obj->loaded) - { - obj->initialise = InitialiseQuadBike; - obj->collision = QuadBikeCollision; - obj->savePosition = true; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_SHARK]; - if (obj->loaded) - { - obj->control = SharkControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 30; - obj->pivotLength = 200; - obj->radius = 340; - obj->intelligent = true; - obj->waterCreature = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->zoneType = ZONE_WATER; - - Bones[obj->boneIndex + 9 * 4] |= ROT_Y; - } - - obj = &Objects[ID_BARRACUDA]; - if (obj->loaded) - { - obj->control = BarracudaControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 12; - obj->pivotLength = 200; - obj->radius = 204; - obj->intelligent = true; - obj->waterCreature = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->zoneType = ZONE_WATER; - - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - } - - obj = &Objects[ID_ROLLING_SPINDLE]; - if (obj->loaded) - { - obj->initialise = InitialiseSpinningBlade; - obj->control = SpinningBlade; - obj->collision = ObjectCollision; - obj->savePosition = true; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_SPRINGBOARD]; - if (obj->loaded) - { - obj->control = SpringBoardControl; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_TIGER]; - if (obj->loaded) - { - obj->control = TigerControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 24; - obj->pivotLength = 200; - obj->radius = 340; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - Bones[obj->boneIndex + 21 * 4] |= ROT_Y; - } - - obj = &Objects[ID_COBRA]; - if (obj->loaded) - { - obj->initialise = InitialiseCobra; - obj->control = CobraControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 8; - obj->radius = 102; - obj->intelligent = true; - obj->nonLot = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex + 0 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - } - - obj = &Objects[ID_RAPTOR]; - if (obj->loaded) - { - obj->control = Tr3RaptorControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 100; - obj->radius = 341; - obj->pivotLength = 600; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex + 20 * 4] |= ROT_Y; - Bones[obj->boneIndex + 21 * 4] |= ROT_Y; - Bones[obj->boneIndex + 23 * 4] |= ROT_Y; - Bones[obj->boneIndex + 25 * 4] |= ROT_Y; - } - - obj = &Objects[ID_SCUBA_DIVER]; - if (obj->loaded) - { - obj->control = ScubaControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 20; - obj->radius = 340; - obj->intelligent = true; - obj->waterCreature = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 50; - obj->zoneType = ZONE_WATER; - - Bones[obj->boneIndex + 10 * 4] |= ROT_Y; - Bones[obj->boneIndex + 14 * 4] |= ROT_Z; - } - - obj = &Objects[ID_SCUBA_HARPOON]; - if (obj->loaded) - { - obj->control = HarpoonControl; - obj->collision = ObjectCollision; - obj->savePosition = true; - } - - obj = &Objects[ID_EAGLE]; - if (obj->loaded) - { - obj->initialise = InitialiseEagle; - obj->control = EagleControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 20; - obj->radius = 204; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 0; - obj->zoneType = ZONE_FLYER; - } - - obj = &Objects[ID_CROW]; - if (obj->loaded) - { - obj->initialise = InitialiseEagle; - obj->control = EagleControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 15; - obj->radius = 204; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 0; - obj->zoneType = ZONE_FLYER; - } - - obj = &Objects[ID_TRIBESMAN_WITH_AX]; - if (obj->loaded) - { - obj->control = TribemanAxeControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 28; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 0; - - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - } - - obj = &Objects[ID_TRIBESMAN_WITH_DARTS]; - if (obj->loaded) - { - obj->control = TribesmanDartsControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 28; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 0; - - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - } - - obj = &Objects[ID_WOLF]; - if (obj->loaded) - { - obj->initialise = InitialiseWolf; - obj->control = WolfControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 6; - obj->pivotLength = 375; - obj->radius = 340; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex + 2 * 4] |= ROT_Y; - } - - obj = &Objects[ID_BEAR]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->control = BearControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 20; - obj->pivotLength = 500; - obj->radius = 340; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - } - - obj = &Objects[ID_TYRANNOSAUR]; - if (obj->loaded) - { - obj->control = TyrannosaurControl; - obj->collision = CreatureCollision; - obj->hitPoints = 800; - obj->shadowSize = 64; - obj->pivotLength = 1800; - obj->radius = 512; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex + 10 * 4] |= ROT_Y; - Bones[obj->boneIndex + 11 * 4] |= ROT_Y; - } - - obj = &Objects[ID_APE]; - if (obj->loaded) - { - obj->control = ApeControl; - obj->collision = CreatureCollision; - obj->hitPoints = 22; - obj->shadowSize = 128; - obj->pivotLength = 250; - obj->radius = 340; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->zoneType = ZONE_APE; - } - - obj = &Objects[ID_RAT]; - if (obj->loaded) - { - obj->control = RatControl; - obj->collision = CreatureCollision; - obj->hitPoints = 5; - obj->shadowSize = 128; - obj->pivotLength = 50; - obj->radius = 204; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_SKELETON]; - if (obj->loaded) - { - obj->initialise = InitialiseSkeleton; - obj->control = SkeletonControl; - obj->collision = CreatureCollision; - obj->hitPoints = 15; - obj->shadowSize = 128; - obj->pivotLength = 50; - obj->radius = 128; - obj->explodableMeshbits = 0xA00; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_GRENADE_GUN_ITEM]; - if (obj->loaded) - { - obj->collision = PickupCollision; - obj->savePosition = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_GRENADE_AMMO1_ITEM]; - if (obj->loaded) - { - obj->collision = PickupCollision; - obj->savePosition = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_GRENADE_AMMO2_ITEM]; - if (obj->loaded) - { - obj->collision = PickupCollision; - obj->savePosition = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_GRENADE_AMMO3_ITEM]; - if (obj->loaded) - { - obj->collision = PickupCollision; - obj->savePosition = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_CROSSBOW_AMMO3_ITEM]; - if (obj->loaded) - { - obj->collision = PickupCollision; - obj->savePosition = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_GRENADE]; - if (obj->loaded) - { - obj->collision = NULL; - obj->control = ControlGrenade; - } - - obj = &Objects[ID_HARPOON_ITEM]; - if (obj->loaded) - { - obj->collision = PickupCollision; - obj->savePosition = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_HARPOON_AMMO_ITEM]; - if (obj->loaded) - { - obj->collision = PickupCollision; - obj->savePosition = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_HARPOON]; - if (obj->loaded) - { - obj->initialise = NULL; - obj->collision = NULL; - obj->control = ControlHarpoonBolt; - } - - obj = &Objects[ID_CROSSBOW_BOLT]; - if (obj->loaded) - { - obj->initialise = NULL; - obj->control = NULL; - obj->control = ControlCrossbowBolt; - } - - obj = &Objects[ID_STARGATE]; - if (obj->loaded) - { - obj->control = StargateControl; - obj->collision = StargateCollision; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_SLICER_DICER]; - if (obj->loaded) - { - obj->initialise = InitialiseSlicerDicer; - obj->control = SlicerDicerControl; - obj->collision = BladeCollision; - obj->saveFlags = true; - } - - obj = &Objects[ID_SARCOPHAGUS]; - if (obj->loaded) - { - obj->control = AnimatingControl; - obj->collision = SarcophagusCollision; - obj->saveFlags = true; - obj->saveAnim = true; - } - - obj = &Objects[ID_LARA_DOUBLE]; - if (obj->loaded) - { - obj->initialise = InitialiseLaraDouble; - obj->control = LaraDoubleControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 1000; - obj->pivotLength = 50; - obj->radius = 128; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveFlags = true; - obj->saveAnim = true; - } - - obj = &Objects[ID_KNIGHT_TEMPLAR]; - if (obj->loaded) - { - obj->initialise = InitialiseKnightTemplar; - obj->control = KnightTemplarControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 15; - obj->pivotLength = 50; - obj->radius = 128; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveFlags = true; - obj->saveAnim = true; - - Bones[obj->boneIndex + 6 * 4] |= ROT_X | ROT_Y; - Bones[obj->boneIndex + 7 * 4] |= ROT_Y; - } - - obj = &Objects[ID_DEMIGOD1]; - if (obj->loaded) - { - obj->initialise = InitialiseDemigod; - obj->control = DemigodControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 200; - obj->pivotLength = 50; - obj->radius = 341; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->hitEffect = HIT_FRAGMENT; - obj->undead = true; - - Bones[obj->boneIndex + 4 * 4] |= ROT_X | ROT_Y | ROT_Z; - Bones[obj->boneIndex + 5 * 4] |= ROT_Y; - } - - obj = &Objects[ID_DEMIGOD2]; - if (obj->loaded) - { - obj->initialise = InitialiseDemigod; - obj->control = DemigodControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 200; - obj->pivotLength = 50; - obj->radius = 341; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->hitEffect = HIT_FRAGMENT; - Bones[obj->boneIndex + 4 * 4] |= ROT_X | ROT_Y | ROT_Z; - Bones[obj->boneIndex + 5 * 4] |= ROT_Y; - } - - obj = &Objects[ID_DEMIGOD3]; - if (obj->loaded) - { - obj->initialise = InitialiseDemigod; - obj->control = DemigodControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 200; - obj->pivotLength = 50; - obj->radius = 341; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->hitEffect = HIT_FRAGMENT; - Bones[obj->boneIndex + 4 * 4] |= ROT_X | ROT_Y | ROT_Z; - Bones[obj->boneIndex + 5 * 4] |= ROT_Y; - } - - obj = &Objects[ID_MINE]; - if (obj->loaded) - { - obj->initialise = InitialiseMine; - obj->control = MineControl; - obj->collision = MineCollision; - obj->saveFlags = true; - obj->saveAnim = true; - obj->savePosition = true; - } - - obj = &Objects[ID_JEAN_YVES]; - if (obj->loaded) - { - obj->initialise = InitialiseJeanYves; - obj->control = JeanYvesControl; - obj->collision = ObjectCollision; - obj->nonLot = true; - obj->savePosition = true; - } - - obj = &Objects[ID_WATERSKIN1_EMPTY]; - if (obj->loaded) - { - obj->initialise = InitialisePickup; - obj->control = PickupControl; - obj->collision = PickupCollision; - obj->saveFlags = true; - obj->savePosition = true; - } - - obj = &Objects[ID_WATERSKIN2_EMPTY]; - if (obj->loaded) - { - obj->initialise = InitialisePickup; - obj->control = PickupControl; - obj->collision = PickupCollision; - obj->saveFlags = true; - obj->savePosition = true; - } - - obj = &Objects[ID_BIG_SCORPION]; - if (obj->loaded) - { - obj->initialise = InitialiseScorpion; - obj->control = ScorpionControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 80; - obj->pivotLength = 50; - obj->radius = 512; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveFlags = true; - obj->saveAnim = true; - } - - obj = &Objects[ID_TROOPS]; - if (obj->loaded) - { - obj->initialise = InitialiseTroops; - obj->control = TroopsControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 40; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex] |= ROT_X | ROT_Y; - Bones[obj->boneIndex + 7 * 4] |= ROT_X | ROT_Y; - } - - obj = &Objects[ID_SENTRY_GUN]; - if (obj->loaded) - { - obj->initialise = InitialiseSentryGun; - obj->control = SentryGunControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 30; - obj->pivotLength = 50; - obj->radius = 204; - obj->intelligent = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->explodableMeshbits = 64; - - Bones[obj->boneIndex + 0] |= ROT_Y; - Bones[obj->boneIndex + 1 * 4] |= ROT_X; - Bones[obj->boneIndex + 2 * 4] |= ROT_Z; - Bones[obj->boneIndex + 3 * 4] |= ROT_Z; - } - - obj = &Objects[ID_HARPY]; - if (obj->loaded) - { - obj->initialise = InitialiseHarpy; - obj->control = HarpyControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 60; - obj->pivotLength = 50; - obj->radius = 409; - obj->intelligent = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->zoneType = ZONE_FLYER; - } - - obj = &Objects[ID_GUIDE]; - if (obj->loaded) - { - obj->initialise = InitialiseGuide; - obj->control = GuideControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = -16384; - obj->pivotLength = 0; - obj->radius = 128; - obj->intelligent = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - - Bones[obj->boneIndex + 6 * 4] |= ROT_X | ROT_Y; - Bones[obj->boneIndex + 20 * 4] |= ROT_X | ROT_Y; - } - - obj = &Objects[ID_CROCODILE]; - if (obj->loaded) - { - obj->initialise = InitialiseCrocodile; - obj->control = CrocodileControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 36; - obj->pivotLength = 300; - obj->radius = 409; - obj->intelligent = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->waterCreature = true; - obj->zoneType = ZONE_WATER; - - Bones[obj->boneIndex] |= ROT_Y; - Bones[obj->boneIndex + 7 * 4] |= ROT_Y; - Bones[obj->boneIndex + 9 * 4] |= ROT_Y; - Bones[obj->boneIndex + 10 * 4] |= ROT_Y; - } - - obj = &Objects[ID_SPHINX]; - if (obj->loaded) - { - obj->initialise = InitialiseSphinx; - obj->control = SphinxControl; - obj->collision = CreatureCollision; - obj->shadowSize = 128; - obj->hitPoints = 1000; - obj->pivotLength = 500; - obj->radius = 512; - obj->intelligent = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_FLAMETHROWER_BADDY]; - if (obj->loaded) - { - obj->control = FlameThrowerControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 36; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 0; - - Bones[obj->boneIndex + 0 * 4] |= ROT_Y; - Bones[obj->boneIndex + 0 * 4] |= ROT_X; - Bones[obj->boneIndex + 7 * 4] |= ROT_Y; - } - - obj = &Objects[ID_SPIKY_WALL]; - if (obj->loaded) - { - obj->control = ControlSpikyWall; - obj->collision = ObjectCollision; - obj->savePosition = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_SPIKY_CEILING]; - if (obj->loaded) - { - obj->control = ControlSpikyCeiling; - obj->collision = TrapCollision; - obj->savePosition = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_MONKEY]; - if (obj->loaded) - { - //if (!Objects[MESHSWAP2].loaded) - // S_ExitSystem("FATAL: Monkey requires MESHSWAP2 (Monkey + Pickups)"); - - //obj->draw_routine = DrawMonkey; - obj->initialise = InitialiseMonkey; - obj->control = MonkeyControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 8; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 0; - - Bones[obj->boneIndex + 0 * 4] |= ROT_Y; - Bones[obj->boneIndex + 0 * 4] |= ROT_X; - Bones[obj->boneIndex + 7 * 4] |= ROT_Y; - } - - obj = &Objects[ID_JEEP]; - if (obj->loaded) - { - obj->initialise = InitialiseJeep; - obj->collision = JeepCollision; - obj->savePosition = true; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_MOTORBIKE]; - if (obj->loaded) - { - obj->initialise = InitialiseMotorbike; - obj->collision = MotorbikeCollision; - //obj->drawRoutine = DrawMotorbike; // for wheel rotation - obj->drawRoutineExtra = DrawMotorbikeEffect; - obj->savePosition = true; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_MP_WITH_GUN]; - if (obj->loaded) - { - obj->control = MPGunControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 28; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 0; - obj->biteOffset = 0; - - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - } - - obj = &Objects[ID_MP_WITH_STICK]; - if (obj->loaded) - { - obj->initialise = InitialiseMPStick; - obj->control = MPStickControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 28; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 0; - obj->zoneType = ZONE_HUMAN_CLASSIC; - - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - } - - obj = &Objects[ID_YETI]; - if (obj->loaded) - { - obj->initialise = InitialiseYeti; - obj->collision = CreatureCollision; - obj->control = YetiControl; - obj->hitPoints = 30; - obj->shadowSize = UNIT_SHADOW / 2; - obj->radius = 128; - obj->pivotLength = 100; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - obj->zoneType = ZONE_HUMAN_CLASSIC; - Bones[obj->boneIndex + 6 * 4] |= (ROT_Y); - Bones[obj->boneIndex + 14 * 4] |= (ROT_Y); - } - - obj = &Objects[ID_SNOWMOBILE]; - if (obj->loaded) - { - obj->initialise = InitialiseSkidoo; - obj->collision = SkidooCollision; - //obj->drawRoutine = DrawSkidoo; // TODO: create a new render for the skidoo. (with track animated) - obj->saveAnim = true; - obj->saveFlags = true; - obj->savePosition = true; - } - - obj = &Objects[ID_KAYAK]; - if (obj->loaded) - { - obj->initialise = InitialiseKayak; - obj->collision = KayakCollision; - //obj->drawRoutine = DrawKayak; - obj->saveAnim = true; - obj->saveFlags = true; - obj->savePosition = true; - } - - obj = &Objects[ID_SPEEDBOAT]; - if (obj->loaded) - { - obj->initialise = InitialiseBoat; - obj->collision = BoatCollision; - obj->control = BoatControl; - obj->saveAnim = true; - obj->saveFlags = true; - obj->savePosition = true; - Bones[obj->boneIndex + 1 * 4] |= ROT_Z; - } + FlipEffect = -1; + FlipStatus = 0; + IsAtmospherePlaying = 0; + Camera.underwater = 0; } -void BaddyObjects() -{ - ObjectInfo* obj; - - /* Initialise Lara directly since lara will be used all the time. */ - obj = &Objects[ID_LARA]; - if (obj->loaded) - { - obj->initialise = InitialiseLaraLoad; - obj->shadowSize = 160; - obj->hitPoints = 1000; - obj->drawRoutine = NULL; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - obj->usingDrawAnimatingItem = false; - } - else - { - printf("lara not found !"); - } - - obj = &Objects[ID_SAS]; - if (obj->loaded) - { - obj->initialise = InitialiseGuard; - obj->control = GuardControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 40; - obj->radius = 102; - obj->pivotLength = 50; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_SWAT]; - if (obj->loaded) - { - obj->biteOffset = 0; - obj->initialise = InitialiseGuard; - obj->collision = CreatureCollision; - obj->control = GuardControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 24; - obj->pivotLength = 50; - obj->radius = 102; - obj->explodableMeshbits = 0x4000; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_GUARD1]; - if (obj->loaded) - { - if (Objects[ID_SWAT].loaded) // object required - obj->animIndex = Objects[ID_SWAT].animIndex; - obj->biteOffset = 4; - obj->initialise = InitialiseGuard; - obj->collision = CreatureCollision; - obj->control = GuardControl; - obj->pivotLength = 50; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 24; - obj->radius = 102; - obj->explodableMeshbits = 0x4000; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_SWAT_PLUS]; - if (obj->loaded) - { - short animIndex; - if (!Objects[ID_SWAT].loaded) - animIndex = Objects[ID_GUARD1].animIndex; - else - animIndex = Objects[ID_SWAT].animIndex; - obj->animIndex = animIndex; - obj->biteOffset = 0; - obj->initialise = InitialiseGuard; - obj->collision = CreatureCollision; - obj->control = GuardControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 24; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_MAFIA]; - if (obj->loaded) - { - short animIndex; - if (!Objects[ID_SWAT].loaded) - animIndex = Objects[ID_GUARD1].animIndex; - else - animIndex = Objects[ID_SWAT].animIndex; - obj->animIndex = animIndex; - obj->biteOffset = 0; - obj->initialise = InitialiseGuard; - obj->collision = CreatureCollision; - obj->control = GuardControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 24; - obj->pivotLength = 50; - obj->radius = 102; - obj->explodableMeshbits = 0x4000; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_SCIENTIST]; - if (obj->loaded) - { - short animIndex; - if (!Objects[ID_SWAT].loaded) - animIndex = Objects[ID_GUARD1].animIndex; - else - animIndex = Objects[ID_SWAT].animIndex; - obj->animIndex = animIndex; - obj->initialise = InitialiseGuard; - obj->control = GuardControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 24; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - Bones[Objects[69].boneIndex + 6 * 4] |= ROT_Y; - Bones[Objects[69].boneIndex + 6 * 4] |= ROT_X; - Bones[Objects[69].boneIndex + 13 * 4] |= ROT_Y; - Bones[Objects[69].boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_GUARD2]; - if (obj->loaded) - { - short animIndex; - if (!Objects[ID_SWAT].loaded) - animIndex = Objects[ID_GUARD1].animIndex; - else - animIndex = Objects[ID_SWAT].animIndex; - obj->animIndex = animIndex; - obj->biteOffset = 4; - obj->initialise = InitialiseGuard; - obj->control = GuardControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 24; - obj->pivotLength = 50; - obj->radius = 102; - obj->explodableMeshbits = 0x4000; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_GUARD3]; - if (obj->loaded) - { - short animIndex; - if (!Objects[ID_SWAT].loaded) - animIndex = Objects[ID_GUARD1].animIndex; - else - animIndex = Objects[ID_SWAT].animIndex; - obj->animIndex = animIndex; - obj->biteOffset = 4; - obj->initialise = InitialiseGuard; - obj->control = GuardControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 24; - obj->pivotLength = 50; - obj->radius = 102; - obj->explodableMeshbits = 0x4000; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_ATTACK_SUB]; - if (obj->loaded) - { - obj->initialise = InitialiseSubmarine; - obj->collision = CreatureCollision; - obj->control = ControlSubmarine; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 100; - obj->pivotLength = 200; - obj->radius = 512; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - obj->waterCreature = true; - obj->hitEffect = HIT_FRAGMENT; - obj->zoneType = ZONE_FLYER; - obj->undead = true; - Bones[obj->boneIndex] |= ROT_X; - Bones[obj->boneIndex + 4] |= ROT_X; - } - - obj = &Objects[ID_CHEF]; - if (obj->loaded) - { - obj->initialise = InitialiseChef; - obj->control = ControlChef; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 35; - obj->pivotLength = 50; - obj->radius = 102; - obj->biteOffset = 0; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - - Bones[obj->boneIndex + 4 * 6] |= ROT_Y; - Bones[obj->boneIndex + 4 * 6] |= ROT_X; - Bones[obj->boneIndex + 4 * 13] |= ROT_Y; - Bones[obj->boneIndex + 4 * 13] |= ROT_X; - } - - obj = &Objects[ID_LION]; - if (obj->loaded) - { - obj->initialise = InitialiseLion; - obj->collision = CreatureCollision; - obj->control = LionControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 40; - obj->pivotLength = 50; - obj->radius = 341; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 19 * 4] |= ROT_Y; - } - - obj = &Objects[ID_DOG]; - if (obj->loaded) - { - obj->initialise = InitialiseDoberman; - obj->collision = CreatureCollision; - obj->control = ControlDoberman; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 18; - obj->pivotLength = 50; - obj->radius = 256; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 19 * 4] |= ROT_Y; - } - - obj = &Objects[ID_HUSKIE]; - if (obj->loaded) - { - obj->initialise = InitialiseDog; - obj->collision = CreatureCollision; - obj->control = ControlDog; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 24; - obj->pivotLength = 50; - obj->radius = 256; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 19 * 4] |= ROT_Y; - } - - obj = &Objects[ID_REAPER]; - if (obj->loaded) - { - obj->initialise = InitialiseReaper; - obj->collision = CreatureCollision; - obj->control = ControlReaper; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 10; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - obj->hitEffect = HIT_BLOOD; - obj->waterCreature = true; - obj->zoneType = ZONE_FLYER; - } - - obj = &Objects[ID_MAFIA2]; - if (obj->loaded) - { - obj->biteOffset = 7; - obj->initialise = InitialiseMafia2; - obj->collision = CreatureCollision; - obj->control = Mafia2Control; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 26; - obj->pivotLength = 50; - obj->radius = 102; - obj->explodableMeshbits = 0x4000; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->zoneType = ZONE_HUMAN_CLASSIC; - obj->meshSwapSlot = ID_MESHSWAP_MAFIA2; - - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_PIERRE]; - if (obj->loaded) - { - obj->biteOffset = 1; - obj->initialise = InitialiseLarson; - obj->collision = CreatureCollision; - obj->control = ControlLarson; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 60; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 7 * 4] |= ROT_Y; - Bones[obj->boneIndex + 7 * 4] |= ROT_X; - } - - obj = &Objects[ID_LARSON]; - if (obj->loaded) - { - obj->biteOffset = 3; - obj->initialise = InitialiseLarson; - obj->collision = CreatureCollision; - obj->control = ControlLarson; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 60; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 7 * 4] |= ROT_Y; - Bones[obj->boneIndex + 7 * 4] |= ROT_X; - } - - obj = &Objects[ID_HITMAN]; - if (obj->loaded) - { - obj->biteOffset = 5; - obj->initialise = InitialiseHitman; - obj->collision = CreatureCollision; - obj->control = HitmanControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 50; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_FRAGMENT; - obj->undead = true; - obj->zoneType = ZONE_HUMAN_CLASSIC; - obj->meshSwapSlot = ID_MESHSWAP_HITMAN; - - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_SNIPER]; - if (obj->loaded) - { - obj->biteOffset = 6; - obj->initialise = InitialiseSniper; - obj->collision = CreatureCollision; - obj->control = SniperControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 35; - obj->pivotLength = 50; - obj->radius = 102; - obj->explodableMeshbits = 0x4000; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - obj = &Objects[ID_GUARD_LASER]; - if (obj->loaded) - { - obj->biteOffset = 0; - obj->initialise = InitialiseGuardLaser; - obj->collision = CreatureCollision; - //obj->control = GuardControlLaser; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 24; - obj->pivotLength = 50; - obj->radius = 128; - obj->explodableMeshbits = 4; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_FRAGMENT; - obj->undead = true; - Bones[obj->boneIndex] |= ROT_Y; - Bones[obj->boneIndex] |= ROT_X; - Bones[obj->boneIndex + 4] |= ROT_Y; - Bones[obj->boneIndex + 4] |= ROT_X; - } - - obj = &Objects[ID_HYDRA]; - if (obj->loaded) - { - obj->initialise = InitialiseHydra; - obj->collision = CreatureCollision; - obj->control = ControlHydra; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 30; - obj->pivotLength = 50; - obj->radius = 102; - obj->biteOffset = 1024; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_FRAGMENT; - obj->undead = true; - Bones[obj->boneIndex + 0] |= ROT_Y; - Bones[obj->boneIndex + 8 * 4] |= ROT_Y; - Bones[obj->boneIndex + 8 * 4] |= ROT_X; - Bones[obj->boneIndex + 8 * 4] |= ROT_Z; - } - - obj = &Objects[ID_IMP]; - if (obj->loaded) - { - obj->biteOffset = 256; - obj->initialise = InitialiseImp; - obj->collision = CreatureCollision; - obj->control = ControlImp; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 12; - obj->pivotLength = 20; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - obj->meshSwapSlot = ID_MESHSWAP_IMP; - - Bones[obj->meshIndex + 4 * 4] |= ROT_Z; - Bones[obj->meshIndex + 4 * 4] |= ROT_X; - Bones[obj->meshIndex + 9 * 4] |= ROT_Z; - Bones[obj->meshIndex + 9 * 4] |= ROT_X; - } - - obj = &Objects[ID_WILLOWISP]; - if (obj->loaded) - { - obj->biteOffset = 256; - obj->initialise = InitialiseLightingGuide; - //obj->control = ControlLightingGuide; - obj->drawRoutine = NULL; - obj->shadowSize = UNIT_SHADOW / 2; - obj->radius = 256; - obj->hitPoints = 16; - obj->pivotLength = 20; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - obj->zoneType = ZONE_FLYER; - Bones[obj->boneIndex + 4 * 4] |= ROT_Z; - Bones[obj->boneIndex + 4 * 4] |= ROT_X; - Bones[obj->boneIndex + 9 * 4] |= ROT_Z; - Bones[obj->boneIndex + 9 * 4] |= ROT_X; - } - - obj = &Objects[ID_BROWN_BEAST]; - if (obj->loaded) - { - obj->biteOffset = 256; - obj->initialise = InitialiseBrownBeast; - obj->collision = CreatureCollision; - obj->control = ControlBrowsBeast; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 100; - obj->pivotLength = 20; - obj->radius = 341; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 4 * 4] |= ROT_Z; - Bones[obj->boneIndex + 4 * 4] |= ROT_X; - Bones[obj->boneIndex + 9 * 4] |= ROT_Z; - Bones[obj->boneIndex + 9 * 4] |= ROT_X; - } - - obj = &Objects[ID_LAGOON_WITCH]; - if (obj->loaded) - { - obj->biteOffset = 256; - obj->initialise = InitialiseLagoonWitch; - obj->collision = CreatureCollision; - obj->control = ControlLagoonWitch; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 100; - obj->pivotLength = 20; - obj->radius = 256; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - obj->waterCreature = true; - obj->zoneType = ZONE_FLYER; - - Bones[obj->boneIndex + 4 * 4] |= ROT_Z; - Bones[obj->boneIndex + 4 * 4] |= ROT_X; - Bones[obj->boneIndex + 9 * 4] |= ROT_Z; - Bones[obj->boneIndex + 9 * 4] |= ROT_X; - } - - obj = &Objects[ID_INVISIBLE_GHOST]; - if (obj->loaded) - { - obj->biteOffset = 256; - obj->initialise = InitialiseInvisibleGhost; - obj->collision = CreatureCollision; - obj->control = ControlInvisibleGhost; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 100; - obj->pivotLength = 20; - obj->radius = 256; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 8 * 4] |= ROT_Y; - Bones[obj->boneIndex + 8 * 4] |= ROT_X; - } - - obj = &Objects[ID_RATS_EMITTER]; - if (obj->loaded) - { - obj->drawRoutine = NULL; - obj->initialise = InitialiseLittleRats; - obj->control = ControlLittleRats; - obj->usingDrawAnimatingItem = false; - } - - obj = &Objects[ID_BATS_EMITTER]; - if (obj->loaded) - { - obj->drawRoutine = NULL; - obj->initialise = InitialiseLittleBats; - obj->control = ControlLittleBats; - obj->usingDrawAnimatingItem = false; - } - - obj = &Objects[ID_SPIDERS_EMITTER]; - if (obj->loaded) - { - obj->drawRoutine = NULL; - obj->initialise = InitialiseSpiders; - obj->control = ControlSpiders; - obj->usingDrawAnimatingItem = false; - } - - obj = &Objects[ID_GLADIATOR]; - if (obj->loaded) - { - obj->biteOffset = 0; - obj->initialise = InitialiseGladiator; - obj->control = ControlGladiator; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 20; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - Bones[obj->boneIndex + 13 * 4] |= ROT_X; - } - - for (int i = 0; i < 2; i++) - { - obj = &Objects[ID_ROMAN_GOD1 + i]; - if (obj->loaded) - { - obj->biteOffset = 0; - obj->initialise = InitialiseRomanStatue; - obj->collision = CreatureCollision; - obj->control = ControlRomanStatue; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 300; - obj->pivotLength = 50; - obj->radius = 256; - obj->intelligent = true; - obj->savePosition = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->saveHitpoints = true; - obj->hitEffect = HIT_SMOKE; - obj->meshSwapSlot = ID_MESHSWAP_ROMAN_GOD1 + i; - - Bones[obj->boneIndex + 24] |= ROT_Y; - Bones[obj->boneIndex + 24] |= ROT_X; - Bones[obj->boneIndex + 52] |= ROT_Y; - Bones[obj->boneIndex + 52] |= ROT_X; - } - } - - obj = &Objects[ID_GUARDIAN]; - if (obj->loaded) - { - obj->initialise = InitialiseGuardian; - obj->collision = CreatureCollision; - obj->control = GuardianControl; - obj->explodableMeshbits = 6; - obj->nonLot = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->usingDrawAnimatingItem = false; - obj->undead = true; - obj->unknown = 3; - obj->hitEffect = HIT_FRAGMENT; - obj->saveMesh = true; - } - - obj = &Objects[ID_AUTOGUN]; - if (obj->loaded) - { - obj->initialise = InitialiseAutoGuns; - obj->control = ControlAutoGuns; - obj->saveHitpoints = true; - obj->saveFlags = true; - obj->saveAnim = true; - obj->hitEffect = HIT_BLOOD; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 8 * 4] |= ROT_Y; - } - - obj = &Objects[ID_GUNSHIP]; - if (obj->loaded) - { - obj->control = ControlGunShip; - obj->saveFlags = true; - obj->saveAnim = true; - Bones[obj->boneIndex + 0] |= ROT_Y; - Bones[obj->boneIndex + 4] |= ROT_X; - } -} - -// TODO: add the flags void ObjectObjects() { ObjectInfo* obj; @@ -1971,7 +58,7 @@ void ObjectObjects() obj = &Objects[ID_CAMERA_TARGET]; if (obj->loaded) { - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->usingDrawAnimatingItem = false; } @@ -2196,14 +283,7 @@ void ObjectObjects() obj->saveAnim = true; } - obj = &Objects[ID_COG_SWITCH]; - if (obj->loaded) - { - obj->collision = CogSwitchCollision; - obj->control = CogSwitchControl; - obj->saveFlags = true; - obj->saveAnim = true; - } + obj = &Objects[ID_CROWDOVE_SWITCH]; if (obj->loaded) @@ -2365,110 +445,11 @@ void ObjectObjects() obj->saveFlags = true; } - obj = &Objects[ID_SEARCH_OBJECT1]; - if (obj->loaded) - { - obj->initialise = InitialiseSearchObject; - obj->collision = SearchObjectCollision; - obj->control = SearchObjectControl; - } - - obj = &Objects[ID_SEARCH_OBJECT2]; - if (obj->loaded) - { - obj->initialise = InitialiseSearchObject; - obj->collision = SearchObjectCollision; - obj->control = SearchObjectControl; - } - - obj = &Objects[ID_SEARCH_OBJECT3]; - if (obj->loaded) - { - obj->initialise = InitialiseSearchObject; - obj->collision = SearchObjectCollision; - obj->control = SearchObjectControl; - } - - obj = &Objects[ID_SEARCH_OBJECT4]; - if (obj->loaded) - { - obj->initialise = InitialiseSearchObject; - obj->collision = SearchObjectCollision; - obj->control = SearchObjectControl; - } - - obj = &Objects[ID_FLARE_ITEM]; - if (obj->loaded) - { - obj->collision = PickupCollision; - obj->control = FlareControl; - //obj->drawRoutine = draw_f; - obj->pivotLength = 256; - obj->hitPoints = 256; - obj->usingDrawAnimatingItem = false; - obj->saveFlags = true; - obj->savePosition = true; - } - - obj = &Objects[ID_BURNING_TORCH_ITEM]; - if (obj->loaded) - { - obj->collision = PickupCollision; - obj->control = TorchControl; - obj->saveFlags = true; - obj->savePosition = true; - } - - obj = &Objects[ID_TORPEDO]; - if (obj->loaded) - { - obj->control = TorpedoControl; - obj->saveFlags = true; - obj->savePosition = true; - obj->saveAnim = true; - } - - for (int objNum = ID_PUSHABLE_OBJECT1; objNum <= ID_PUSHABLE_OBJECT10; objNum++) - { - obj = &Objects[objNum]; - if (obj->loaded) - { - obj->initialise = InitialisePushableBlock; - obj->control = PushableBlockControl; - obj->collision = PushableBlockCollision; - obj->saveFlags = true; - obj->savePosition = true; - obj->saveAnim = true; - } - } - - obj = &Objects[ID_TWOBLOCK_PLATFORM]; - if (obj->loaded) - { - obj->initialise = InitialiseTwoBlocksPlatform; - obj->control = TwoBlocksPlatformControl; - obj->floor = TwoBlocksPlatformFloor; - obj->ceiling = TwoBlocksPlatformCeiling; - obj->saveFlags = true; - obj->savePosition = true; - obj->saveAnim = true; - } - - obj = &Objects[ID_RAISING_COG]; - if (obj->loaded) - { - obj->initialise = InitialiseRaisingCog; - obj->control = RaisingCogControl; - obj->saveFlags = true; - obj->savePosition = true; - obj->saveAnim = true; - } - obj = &Objects[ID_ELECTRICAL_LIGHT]; if (obj->loaded) { obj->control = ElectricalLightControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->usingDrawAnimatingItem = false; obj->saveFlags = true; } @@ -2477,7 +458,7 @@ void ObjectObjects() if (obj->loaded) { obj->control = PulseLightControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->usingDrawAnimatingItem = false; obj->saveFlags = true; } @@ -2493,7 +474,7 @@ void ObjectObjects() if (obj->loaded) { obj->control = ColorLightControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->usingDrawAnimatingItem = false; obj->saveFlags = true; } @@ -2507,33 +488,33 @@ void ObjectObjects() for (int objNum = ID_KEY_HOLE1; objNum <= ID_KEY_HOLE16; objNum++) { - INIT_KEYHOLE(objNum); + InitKeyHole(obj, objNum); } for (int objNum = ID_PUZZLE_HOLE1; objNum <= ID_PUZZLE_HOLE16; objNum++) { - INIT_PUZZLEHOLE(objNum); + InitPuzzleHole(obj, objNum); } for (int objNum = ID_PUZZLE_DONE1; objNum <= ID_PUZZLE_DONE16; objNum++) { - INIT_PUZZLEDONE(objNum); + InitPuzzleDone(obj, objNum); } for (int objNum = ID_ANIMATING1; objNum <= ID_ANIMATING128; objNum++) { - INIT_ANIMATING(objNum); + InitAnimating(obj, objNum); } - INIT_ANIMATING(ID_GUARDIAN_BASE); - INIT_ANIMATING(ID_GUARDIAN_TENTACLE); + InitAnimating(obj, ID_LASERHEAD_BASE); + InitAnimating(obj, ID_LASERHEAD_TENTACLE); obj = &Objects[ID_ANIMATING13]; if (obj->loaded) { obj->initialise = InitialiseAnimating; obj->control = AnimatingControl; - obj->collision = NULL; + obj->collision = nullptr; obj->saveFlags = true; obj->saveAnim = true; obj->saveMesh = true; @@ -2546,7 +527,7 @@ void ObjectObjects() { obj->initialise = InitialiseAnimating; obj->control = AnimatingControl; - obj->collision = NULL; + obj->collision = nullptr; obj->saveFlags = true; obj->saveAnim = true; obj->saveMesh = true; @@ -2559,7 +540,7 @@ void ObjectObjects() { obj->initialise = InitialiseAnimating; obj->control = AnimatingControl; - obj->collision = NULL; + obj->collision = nullptr; obj->saveFlags = true; obj->saveAnim = true; obj->saveMesh = true; @@ -2572,7 +553,7 @@ void ObjectObjects() { obj->initialise = InitialiseAnimating; obj->control = AnimatingControl; - obj->collision = NULL; + obj->collision = nullptr; obj->saveFlags = true; obj->saveAnim = true; obj->saveMesh = true; @@ -2585,7 +566,7 @@ void ObjectObjects() { obj->initialise = InitialiseTightRope; obj->collision = TightRopeCollision; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -2613,7 +594,7 @@ void ObjectObjects() { obj->initialise = InitialiseXRayMachine; obj->control = ControlXRayMachine; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; }*/ @@ -2625,14 +606,14 @@ void ObjectObjects() obj = &Objects[ID_EARTHQUAKE]; if (obj->loaded) { - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; } obj = &Objects[ID_HIGH_OBJECT2]; if (obj->loaded) { - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->control = HighObject2Control; } @@ -2652,7 +633,7 @@ void ObjectObjects() { obj->initialise = InitialiseSmokeEmitter; obj->control = SmokeEmitterControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->usingDrawAnimatingItem = false; obj->saveFlags = true; } @@ -2662,7 +643,7 @@ void ObjectObjects() { obj->initialise = InitialiseSmokeEmitter; obj->control = SmokeEmitterControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->usingDrawAnimatingItem = false; obj->saveFlags = true; } @@ -2672,7 +653,7 @@ void ObjectObjects() { obj->initialise = InitialiseSmokeEmitter; obj->control = SmokeEmitterControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->usingDrawAnimatingItem = false; obj->saveFlags = true; } @@ -2684,29 +665,15 @@ void ObjectObjects() obj->saveFlags = true; } - obj = &Objects[ID_ENERGY_BUBBLES]; - if (obj->loaded) - { - obj->control = BubblesControl; - } - - obj = &Objects[ID_BUBBLES]; - if (obj->loaded) - { - obj->control = MissileControl; - } - - obj = &Objects[ID_IMP_ROCK]; - if (obj->loaded) - { - obj->control = MissileControl; - } + InitProjectile(obj, BubblesControl, ID_ENERGY_BUBBLES, true); + InitProjectile(obj, MissileControl, ID_BUBBLES, true); + InitProjectile(obj, MissileControl, ID_IMP_ROCK, true); obj = &Objects[ID_WATERFALLMIST]; if (obj->loaded) { obj->control = ControlWaterfallMist; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; } @@ -2753,7 +720,7 @@ void ObjectObjects() { obj->initialise = InitialiseTeleporter; obj->control = ControlTeleporter; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; } } @@ -2804,7 +771,7 @@ void TrapObjects() if (obj->loaded) { obj->control = KillAllCurrentItems; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->hitPoints = 0; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; @@ -2858,7 +825,7 @@ void TrapObjects() if (obj->loaded) { obj->control = DartEmitterControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -2867,7 +834,7 @@ void TrapObjects() if (obj->loaded) { obj->control = DartEmitterControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -2876,7 +843,7 @@ void TrapObjects() obj = &Objects[ID_FLAME]; { obj->control = FlameControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -2887,7 +854,7 @@ void TrapObjects() obj->initialise = InitialiseFlameEmitter; obj->collision = FlameEmitterCollision; obj->control = FlameEmitterControl; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -2898,7 +865,7 @@ void TrapObjects() obj->initialise = InitialiseFlameEmitter2; obj->collision = FlameEmitterCollision; obj->control = FlameEmitter2Control; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -2907,7 +874,7 @@ void TrapObjects() if (obj->loaded) { obj->control = FlameEmitter3Control; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -2965,7 +932,7 @@ void TrapObjects() { //obj->initialise = InitialisePortal; //obj->control = PortalControl; // TODO: found the control procedure ! - obj->drawRoutine = NULL; // go to nullsub_44() ! + obj->drawRoutine = nullptr; // go to nullsub_44() ! obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -2974,7 +941,7 @@ void TrapObjects() if (obj->loaded) { obj->control = ControlTriggerTriggerer; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -2988,7 +955,7 @@ void TrapObjects() obj->initialise = InitialiseRope; obj->control = RopeControl; obj->collision = RopeCollision; - obj->drawRoutine = NULL; + obj->drawRoutine = nullptr; obj->saveFlags = true; obj->usingDrawAnimatingItem = false; } @@ -3046,7 +1013,7 @@ void InitialiseSpecialEffects() memset(&Gunshells, 0, MAX_GUNSHELL * sizeof(GUNSHELL_STRUCT)); memset(&Gunflashes, 0, (MAX_GUNFLASH * sizeof(GUNFLASH_STRUCT))); memset(&Blood, 0, MAX_SPARKS_BLOOD * sizeof(BLOOD_STRUCT)); - memset(&Splashes, 0, MAX_SPLASH * sizeof(SPLASH_STRUCT)); + memset(&Splashes, 0, MAX_SPLASHES * sizeof(SPLASH_STRUCT)); memset(&Ripples, 0, MAX_RIPPLES * sizeof(RIPPLE_STRUCT)); memset(&Drips, 0, MAX_DRIPS * sizeof(DRIP_STRUCT)); memset(&ShockWaves, 0, MAX_SHOCKWAVE * sizeof(SHOCKWAVE_STRUCT)); @@ -3068,664 +1035,9 @@ void InitialiseSpecialEffects() WBRoom = -1; } -void PickupObjects() -{ - ObjectInfo* obj; - - for (int objNum = ID_PUZZLE_ITEM1; objNum <= ID_EXAMINE8_COMBO2; objNum++) - { - INIT_PICKUP(objNum); - } - - INIT_PICKUP(ID_GAME_PIECE1); - INIT_PICKUP(ID_GAME_PIECE2); - INIT_PICKUP(ID_GAME_PIECE3); - INIT_PICKUP(ID_HAMMER_ITEM); - INIT_PICKUP(ID_CROWBAR_ITEM); - INIT_PICKUP(ID_PISTOLS_ITEM); - INIT_PICKUP(ID_PISTOLS_AMMO_ITEM); - INIT_PICKUP(ID_UZI_ITEM); - INIT_PICKUP(ID_UZI_AMMO_ITEM); - INIT_PICKUP(ID_SHOTGUN_ITEM); - INIT_PICKUP(ID_SHOTGUN_AMMO1_ITEM); - INIT_PICKUP(ID_SHOTGUN_AMMO2_ITEM); - INIT_PICKUP(ID_CROSSBOW_ITEM); - INIT_PICKUP(ID_CROSSBOW_AMMO1_ITEM); - INIT_PICKUP(ID_CROSSBOW_AMMO2_ITEM); - INIT_PICKUP(ID_CROSSBOW_AMMO3_ITEM); - INIT_PICKUP(ID_GRENADE_GUN_ITEM); - INIT_PICKUP(ID_GRENADE_AMMO1_ITEM); - INIT_PICKUP(ID_GRENADE_AMMO2_ITEM); - INIT_PICKUP(ID_GRENADE_AMMO3_ITEM); - INIT_PICKUP(ID_HARPOON_ITEM); - INIT_PICKUP(ID_HARPOON_AMMO_ITEM); - INIT_PICKUP(ID_ROCKET_LAUNCHER_ITEM); - INIT_PICKUP(ID_ROCKET_LAUNCHER_AMMO_ITEM); - INIT_PICKUP(ID_HK_ITEM); - INIT_PICKUP(ID_HK_AMMO_ITEM); - INIT_PICKUP(ID_REVOLVER_ITEM); - INIT_PICKUP(ID_REVOLVER_AMMO_ITEM); - INIT_PICKUP(ID_BIGMEDI_ITEM); - INIT_PICKUP(ID_SMALLMEDI_ITEM); - INIT_PICKUP(ID_LASERSIGHT_ITEM); - INIT_PICKUP(ID_BINOCULARS_ITEM); - INIT_PICKUP(ID_SILENCER_ITEM); - INIT_PICKUP(ID_FLARE_INV_ITEM); - INIT_PICKUP(ID_WATERSKIN1_EMPTY); - INIT_PICKUP(ID_WATERSKIN2_EMPTY); - INIT_PICKUP(ID_CLOCKWORK_BEETLE); - INIT_PICKUP(ID_CLOCKWORK_BEETLE_COMBO1); - INIT_PICKUP(ID_CLOCKWORK_BEETLE_COMBO2); - INIT_PICKUP(ID_GOLDROSE_ITEM); -} - void CustomObjects() { - ObjectInfo* obj; - - obj = &Objects[ID_GOON_SILENCER1]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = SilencerControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 25; - obj->biteOffset = 0; - obj->radius = 102; - obj->pivotLength = 50; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 0] |= (ROT_X | ROT_Y); - Bones[obj->boneIndex + 1 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_GOON_SILENCER2]; - if (obj->loaded) - { - if (Objects[ID_GOON_SILENCER1].loaded) - { - obj->animIndex = Objects[ID_GOON_SILENCER1].animIndex; - obj->frameBase = Objects[ID_GOON_SILENCER1].frameBase; - } - else - { - MessageBox(NULL, "ID_GOON_SILENCER1 not found !", NULL, MB_OK); - } - - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = SilencerControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 25; - obj->biteOffset = 0; - obj->radius = 102; - obj->pivotLength = 50; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 0] |= (ROT_X | ROT_Y); - Bones[obj->boneIndex + 1 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_GOON_SILENCER3]; - if (obj->loaded) - { - if (Objects[ID_GOON_SILENCER1].loaded) - { - obj->animIndex = Objects[ID_GOON_SILENCER1].animIndex; - obj->frameBase = Objects[ID_GOON_SILENCER1].frameBase; - } - else - { - MessageBox(NULL, "ID_GOON_SILENCER1 not found !", NULL, MB_OK); - } - - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = SilencerControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 25; - obj->biteOffset = 0; - obj->radius = 102; - obj->pivotLength = 50; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 0] |= (ROT_X | ROT_Y); - Bones[obj->boneIndex + 1 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_WORKER_SHOTGUN]; - if (obj->loaded) - { - obj->biteOffset = 0; - obj->initialise = InitialiseWorkerShotgun; - obj->collision = CreatureCollision; - obj->control = WorkerShotgunControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 25; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - //Bones[obj->boneIndex + 5*4] |= (ROT_X | ROT_Y); - //Bones[obj->boneIndex + 14*4] |= (ROT_X | ROT_Y); - // TODO: get the correct torso and head bones value and assign ROT_X and ROT_Y to it ! - } - - obj = &Objects[ID_WORKER_MACHINEGUN]; - if (obj->loaded) - { - obj->initialise = InitialiseWorkerMachineGun; - obj->collision = CreatureCollision; - obj->control = WorkerMachineGunControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 20; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - //Bones[obj->boneIndex + 5*4] |= (ROT_X | ROT_Y); - //Bones[obj->boneIndex + 14*4] |= (ROT_X | ROT_Y); - // TODO: get the correct torso and head bones value and assign ROT_X and ROT_Y to it ! - } - - obj = &Objects[ID_SMALL_SPIDER]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = SmallSpiderControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 5; - obj->pivotLength = 0; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - } - - obj = &Objects[ID_BIG_SPIDER]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = BigSpiderControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 40; - obj->pivotLength = 0; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - } - - obj = &Objects[ID_WORKER_DUAL_REVOLVER]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = WorkerDualGunControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 150; - obj->pivotLength = 0; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 11*4] |= (ROT_X|ROT_Y); - Bones[obj->boneIndex + 0*4] |= (ROT_X|ROT_Y); - } - - obj = &Objects[ID_TONY_BOSS]; - if (obj->loaded) - { - obj->initialise = InitialiseTony; - obj->collision = CreatureCollision; - obj->control = TonyControl; - obj->drawRoutine = S_DrawTonyBoss; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 100; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - } - - obj = &Objects[ID_TONY_BOSS_FLAME]; - obj->control = ControlTonyFireBall; - obj->drawRoutine = NULL; - - obj = &Objects[ID_BIRDMONSTER]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = BirdMonsterControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 200; - obj->pivotLength = 0; - obj->radius = 341; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 14 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_WORKER_FLAMETHROWER]; - if (obj->loaded) - { - obj->initialise = InitialiseWorkerFlamethrower; - obj->collision = CreatureCollision; - obj->control = WorkerFlamethrower; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 20; - obj->pivotLength = 0; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 4 * 4] |= (ROT_X | ROT_Y); - Bones[obj->boneIndex + 14 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_KNIFETHROWER]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = KnifethrowerControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 60; - obj->pivotLength = 50; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - //Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y); - //Bones[obj->boneIndex + 0 * 4] |= (ROT_X | ROT_Y); - // TODO: find the correct for bones (knifethrower). - } - - obj = &Objects[ID_KNIFETHROWER_KNIFE]; - if (obj->loaded) - obj->control = KnifeControl; - - obj = &Objects[ID_MERCENARY_UZI]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = MercenaryUziControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 45; - obj->pivotLength = 0; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); - Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_MERCENARY_AUTOPISTOLS1]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = MercenaryAutoPistolControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 50; - obj->pivotLength = 0; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); - Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_MERCENARY_AUTOPISTOLS2]; - if (obj->loaded) - { - if (Objects[ID_MERCENARY_AUTOPISTOLS1].loaded) - { - obj->animIndex = Objects[ID_MERCENARY_AUTOPISTOLS1].animIndex; - obj->frameBase = Objects[ID_MERCENARY_AUTOPISTOLS1].frameBase; - } - else - { - MessageBox(NULL, "ID_MERCENARY_AUTOPISTOLS1 not found !", NULL, MB_OK); - } - - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = MercenaryAutoPistolControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 50; - obj->pivotLength = 0; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); - Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_MONK1]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = MonkControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 50; - obj->pivotLength = 0; - obj->radius = 204; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_MONK2]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = MonkControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 50; - obj->pivotLength = 0; - obj->radius = 204; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_SWORD_GUARDIAN]; - if (obj->loaded) - { - obj->initialise = InitialiseSwordGuardian; - obj->collision = CreatureCollision; - obj->control = SwordGuardianControl; - obj->drawRoutine = DrawStatue; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 80; - obj->pivotLength = 0; - obj->radius = 204; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); - Bones[obj->boneIndex + 16 * 4] |= (ROT_X | ROT_Y); - // TODO: bones value is not correct (shiva) ! - // need the correct one. - } - - obj = &Objects[ID_SHIVA]; - if (obj->loaded) - { - obj->initialise = InitialiseShiva; - obj->collision = CreatureCollision; - obj->control = ShivaControl; - obj->drawRoutine = DrawStatue; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 100; - obj->pivotLength = 0; - obj->radius = 256; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); - Bones[obj->boneIndex + 25 * 4] |= (ROT_X | ROT_Y); - } - - obj = &Objects[ID_SPEAR_GUARDIAN]; - if (obj->loaded) - { - obj->initialise = InitialiseSpearGuardian; - obj->collision = CreatureCollision; - obj->control = SpearGuardianControl; - obj->drawRoutine = DrawStatue; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 100; - obj->pivotLength = 0; - obj->radius = 204; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - //Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y); - //Bones[obj->boneIndex + 12 * 4] |= (ROT_X | ROT_Y); - // TODO: get the correct id for bones ! (spear) - } - - obj = &Objects[ID_DRAGON_FRONT]; - if (obj->loaded) - { - if (!Objects[ID_DRAGON_BACK].loaded) - printf("FATAL: ID_DRAGON_BACK need ID_DRAGON_BACK !"); - - obj->collision = DragonCollision; - obj->control = DragonControl; - obj->hitPoints = 300; - obj->pivotLength = 300; - obj->radius = 256; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - Bones[obj->boneIndex + 10 * 4] |= ROT_Z; - } - - obj = &Objects[ID_DRAGON_BACK]; - if (obj->loaded) - { - if (!Objects[ID_MARCO_BARTOLI].loaded) - printf("FATAL: ID_DRAGON_BACK need ID_MARCO_BARTOLI !"); - - obj->collision = DragonCollision; - obj->control = DragonControl; - obj->radius = 256; - obj->saveAnim = true; - obj->saveFlags = true; - obj->savePosition = true; - } - - obj = &Objects[ID_MARCO_BARTOLI]; - if (obj->loaded) - { - obj->initialise = InitialiseBartoli; - obj->control = BartoliControl; - obj->saveAnim = true; - obj->saveFlags = true; - } - - obj = &Objects[ID_SNOWMOBILE_GUN]; - if (obj->loaded) - { - obj->collision = SkidManCollision; - obj->drawRoutine = DrawSkidoo; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 100; - obj->pivotLength = 0; - obj->radius = 256; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->saveHitpoints = true; - obj->savePosition = true; - } - - obj = &Objects[ID_SNOWMOBILE_DRIVER]; - if (obj->loaded) - { - obj->initialise = InitialiseSkidman; - obj->control = SkidManControl; - obj->hitPoints = 1; - obj->saveAnim = true; - obj->saveFlags = true; - obj->savePosition = true; - } - - obj = &Objects[ID_MINECART]; - if (obj->loaded) - { - obj->initialise = InitialiseMineCart; - obj->collision = MineCartCollision; - obj->saveAnim = true; - obj->saveFlags = true; - obj->savePosition = true; - } - - obj = &Objects[ID_SOPHIA_LEE_BOSS]; - if (obj->loaded) - { - obj->initialise = InitialiseLondonBoss; - obj->collision = CreatureCollision; - obj->control = LondonBossControl; - obj->drawRoutine = S_DrawLondonBoss; - obj->shadowSize = 0; - obj->pivotLength = 50; - obj->hitPoints = 300; - obj->radius = 102; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->savePosition = true; - obj->saveHitpoints = true; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - } - - obj = &Objects[ID_NATLA]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = NatlaControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 400; - obj->radius = 204; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->savePosition = true; - obj->saveHitpoints = true; - Bones[obj->boneIndex + 2 * 4] |= (ROT_Z|ROT_X); - } - - obj = &Objects[ID_WINGED_NATLA]; - if (obj->loaded) - { - obj->initialise = InitialiseCreature; - obj->collision = CreatureCollision; - obj->control = NatlaEvilControl; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 500; - obj->radius = 341; - obj->intelligent = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->savePosition = true; - obj->saveHitpoints = true; - Bones[obj->boneIndex + 1 * 4] |= ROT_Y; - } - - // FIXME: evil lara not work correctly. - obj = &Objects[ID_EVIL_LARA]; - if (obj->loaded) - { - // use lara animation. - if (Objects[ID_LARA].loaded) - { - obj->animIndex = Objects[ID_LARA].animIndex; - obj->frameBase = Objects[ID_LARA].frameBase; - } - - obj->initialise = InitialiseEvilLara; - obj->collision = CreatureCollision; - obj->control = LaraEvilControl; - //obj->drawRoutine = DrawEvilLara; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 1000; - obj->radius = 102; - //obj->intelligent = true; - obj->saveFlags = true; - obj->savePosition = true; - obj->saveHitpoints = true; - } - obj = &Objects[ID_CIVVIE]; - if (obj->loaded) - { - obj->initialise = InitialiseCivvy; - obj->control = CivvyControl; - obj->collision = CreatureCollision; - obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 15; - obj->radius = 102; - obj->intelligent = true; - obj->savePosition = true; - obj->saveHitpoints = true; - obj->saveAnim = true; - obj->saveFlags = true; - obj->pivotLength = 0; - Bones[obj->boneIndex + 6 * 4] |= ROT_Y; - Bones[obj->boneIndex + 6 * 4] |= ROT_X; - Bones[obj->boneIndex + 13 * 4] |= ROT_Y; - } } void InitialiseObjects() @@ -3735,19 +1047,19 @@ void InitialiseObjects() for (int i = 0; i < ID_NUMBER_OBJECTS; i++) { obj = &Objects[i]; - obj->initialise = NULL; - obj->collision = NULL; - obj->control = NULL; - obj->floor = NULL; - obj->ceiling = NULL; + obj->initialise = nullptr; + obj->collision = nullptr; + obj->control = nullptr; + obj->floor = nullptr; + obj->ceiling = nullptr; obj->drawRoutine = DrawAnimatingItem; - obj->drawRoutineExtra = NULL; + obj->drawRoutineExtra = nullptr; obj->pivotLength = 0; obj->radius = DEFAULT_RADIUS; obj->shadowSize = NO_SHADOW; obj->hitPoints = -16384; obj->hitEffect = HIT_NONE; - obj->explodableMeshbits = NULL; + obj->explodableMeshbits = 0; obj->intelligent = false; obj->waterCreature = false; obj->saveMesh = false; @@ -3761,23 +1073,19 @@ void InitialiseObjects() obj->undead = false; obj->zoneType = ZONE_NULL; obj->biteOffset = -1; - obj->meshSwapSlot = -1; + obj->meshSwapSlot = NO_ITEM; + obj->isPickup = false; + obj->isPuzzleHole = false; obj->frameBase += (short)Frames; } - // Standard TR5 objects - BaddyObjects(); + InitialiseTR1Objects(); // Standard TR1 objects + InitialiseTR2Objects(); // Standard TR2 objects + InitialiseTR3Objects(); // Standard TR3 objects + InitialiseTR4Objects(); // Standard TR4 objects + InitialiseTR5Objects(); // Standard TR5 objects ObjectObjects(); TrapObjects(); - PickupObjects(); - - /*for (int i = 0; i < 400; i++) - { - memcpy(&LegacyObjects[i], &Objects[i], sizeof(ObjectInfo)); - }*/ - - // New objects imported from old TRs - NewObjects(); // User defined objects CustomObjects(); @@ -3800,23 +1108,5 @@ void InitialiseObjects() SequenceUsed[4] = 0; SequenceUsed[5] = 0; - if (Objects[ID_BATS_EMITTER].loaded) - Bats = (BAT_STRUCT*)game_malloc(NUM_BATS * sizeof(BAT_STRUCT)); - - if (Objects[ID_SPIDERS_EMITTER].loaded) - Spiders = (SPIDER_STRUCT*)game_malloc(NUM_SPIDERS * sizeof(SPIDER_STRUCT)); - - if (Objects[ID_RATS_EMITTER].loaded) - Rats = (RAT_STRUCT*)game_malloc(NUM_RATS * sizeof(RAT_STRUCT)); -} - -void InitialiseGameFlags() -{ - ZeroMemory(FlipMap, 255 * sizeof(int)); - ZeroMemory(FlipStats, 255 * sizeof(int)); - - FlipEffect = -1; - FlipStatus = 0; - IsAtmospherePlaying = 0; - Camera.underwater = 0; + AllocTR5Objects(); } diff --git a/TR5Main/Specific/setup.h b/TR5Main/Specific/setup.h index 67721e636..279b954f5 100644 --- a/TR5Main/Specific/setup.h +++ b/TR5Main/Specific/setup.h @@ -1,20 +1,31 @@ #pragma once +#include "box.h" +#include "collide.h" +#include "objectslist.h" -#include "..\Global\global.h" +typedef enum HitEffectEnum +{ + HIT_NONE, + HIT_BLOOD, + HIT_SMOKE, + HIT_FRAGMENT, + MAX_HIT_EFFECT +}; -struct ObjectInfo { +typedef struct ObjectInfo +{ short nmeshes; short meshIndex; int boneIndex; short* frameBase; - void(*initialise)(short itemNumber); - void(*control)(short itemNumber); - void(*floor)(ITEM_INFO* item, int x, int y, int z, int* height); - void(*ceiling)(ITEM_INFO* item, int x, int y, int z, int* height); - void(*drawRoutine)(ITEM_INFO* item); - void(*drawRoutineExtra)(ITEM_INFO* item); - void(*collision)(short item_num, ITEM_INFO* laraitem, COLL_INFO* coll); - short zoneType; + function initialise; + function control; + function floor; + function ceiling; + function drawRoutine; + function drawRoutineExtra; + function collision; + ZONE_TYPE zoneType; short animIndex; short hitPoints; short pivotLength; @@ -31,75 +42,43 @@ struct ObjectInfo { bool semiTransparent; bool waterCreature; bool usingDrawAnimatingItem; - bool hitEffect; + HitEffectEnum hitEffect; bool undead; bool saveMesh; - bool unknown; bool friendly; bool castShadows; - unsigned int explodableMeshbits; + bool isPickup; + bool isPuzzleHole; int meshSwapSlot; + DWORD explodableMeshbits; }; +typedef struct StaticInfo +{ + short meshNumber; + short flags; + short xMinp; + short xMaxp; + short yMinp; + short yMaxp; + short zMinp; + short zMaxp; + short xMinc; + short xMaxc; + short yMinc; + short yMaxc; + short zMinc; + short zMaxc; +}; + +#define MAX_STATICS 1000 +constexpr auto GRAVITY = 6; +constexpr auto SWAMP_GRAVITY = 2; + extern ObjectInfo Objects[ID_NUMBER_OBJECTS]; -extern STATIC_INFO StaticObjects[NUM_STATICS]; +extern StaticInfo StaticObjects[MAX_STATICS]; -void BaddyObjects(); -void ObjectObjects(); -void TrapObjects(); -void InitialiseHair(); -void InitialiseSpecialEffects(); void InitialiseGameFlags(); -void CustomObjects(); -void InitialiseObjects(); - -#define INIT_PICKUP(obid) \ -obj = &Objects[obid]; \ -if (obj->loaded) \ -{ \ - obj->initialise = InitialisePickup; \ - obj->collision = PickupCollision; \ - obj->control = PickupControl; \ -} - -#define INIT_KEYHOLE(obid) \ -obj = &Objects[obid]; \ -if (obj->loaded) \ -{ \ - obj->collision = KeyHoleCollision; \ - obj->saveFlags = true; \ -} - -#define INIT_PUZZLEHOLE(obid) \ -obj = &Objects[obid]; \ -if (obj->loaded) \ -{ \ - obj->collision = PuzzleHoleCollision; \ - obj->control = AnimatingControl; \ - obj->saveFlags = true; \ - obj->saveAnim = true; \ -} - -#define INIT_PUZZLEDONE(obid) \ -obj = &Objects[obid]; \ -if (obj->loaded) \ -{ \ - obj->collision = PuzzleDoneCollision; \ - obj->control = AnimatingControl; \ - obj->saveFlags = true; \ - obj->saveAnim = true; \ -} - -#define INIT_ANIMATING(obid) \ -obj = &Objects[obid]; \ -if (obj->loaded) \ -{ \ - obj->initialise = InitialiseAnimating; \ - obj->control = AnimatingControl; \ - obj->collision = ObjectCollision; \ - obj->saveFlags = true; \ - obj->saveAnim = true; \ - obj->saveMesh = true; \ - Bones[obj->boneIndex] |= ROT_Y; \ - Bones[obj->boneIndex + 4] |= ROT_X; \ -} \ No newline at end of file +void InitialiseSpecialEffects(); +void InitialiseHair(); +void InitialiseObjects(); \ No newline at end of file diff --git a/TR5Main/Specific/winmain.cpp b/TR5Main/Specific/winmain.cpp index 76cebac5d..8a1d26320 100644 --- a/TR5Main/Specific/winmain.cpp +++ b/TR5Main/Specific/winmain.cpp @@ -1,32 +1,21 @@ -#include "init.h" +#include "framework.h" #include "winmain.h" -#include - -#include "..\resource.h" - -#include -#include -#include -#include "sol.hpp" - -#include "..\Game\draw.h" -#include "..\Game\sound.h" -#include "..\Game\inventory.h" -#include "..\Game\control.h" -#include "..\Game\gameflow.h" -#include "..\Game\savegame.h" -#include "..\Specific\level.h" -#include "..\Specific\level.h" -#include "..\Specific\newlevel.h" - +#include "init.h" +#include "resource.h" +#include "draw.h" +#include "sound.h" +#include "inventory.h" +#include "control.h" +#include "gameflow.h" +#include "savegame.h" +#include "level.h" +#include "newlevel.h" #include "configuration.h" -#include -#include -#include -#include -WINAPP App; -unsigned int threadId; -uintptr_t hThread; +#include "Renderer11.h" + +WINAPP App; +unsigned int ThreadID; +uintptr_t ThreadHandle; HACCEL hAccTable; byte receivedWmClose = false; bool Debug = false; @@ -39,46 +28,37 @@ extern GameScript* g_GameScript; extern GameConfiguration g_Configuration; DWORD DebugConsoleThreadID; DWORD MainThreadID; + int lua_exception_handler(lua_State *L, sol::optional maybe_exception, sol::string_view description) { return luaL_error(L, description.data()); } -int WinProcMsg() +void WinProcMsg() { - int result; - struct tagMSG Msg; + MSG Msg; - //DB_Log(2, "WinProcMsg"); do { - GetMessageA(&Msg, 0, 0, 0); - if (!TranslateAcceleratorA(WindowsHandle, hAccTable, &Msg)) + GetMessage(&Msg, 0, 0, 0); + if (!TranslateAccelerator(WindowsHandle, hAccTable, &Msg)) { TranslateMessage(&Msg); - DispatchMessageA(&Msg); + DispatchMessage(&Msg); } - result = Unk_876C48; - } while (!Unk_876C48 && Msg.message != WM_QUIT); - - return result; + } + while (!ThreadEnded && Msg.message != WM_QUIT); } -void __stdcall HandleWmCommand(unsigned short wParam) +void CALLBACK HandleWmCommand(unsigned short wParam) { if (wParam == 8) { - //DB_Log(5, "Pressed ALT + ENTER"); - if (!IsLevelLoading) { - SuspendThread((HANDLE)hThread); - //DB_Log(5, "Game thread suspended"); - + SuspendThread((HANDLE)ThreadHandle); g_Renderer->ToggleFullScreen(); - - ResumeThread((HANDLE)hThread); - //DB_Log(5, "Game thread resumed"); + ResumeThread((HANDLE)ThreadHandle); if (g_Renderer->IsFullsScreen()) { @@ -115,31 +95,26 @@ void HandleScriptMessage(WPARAM wParam) LRESULT CALLBACK WinAppProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if (msg == WM_USER + 0) { + if (msg == WM_USER + 0) + { HandleScriptMessage(wParam); + return 0; + } - return 0; - } // Disables ALT + SPACE - if (msg == WM_SYSCOMMAND && wParam == SC_KEYMENU) { + if (msg == WM_SYSCOMMAND && wParam == SC_KEYMENU) return 0; - } if (msg > 0x10) { if (msg == WM_COMMAND) - { - //DB_Log(6, "WM_COMMAND"); HandleWmCommand((unsigned short)wParam); - } return DefWindowProcA(hWnd, msg, wParam, (LPARAM)lParam); } if (msg == WM_CLOSE) { - //DB_Log(6, "WM_CLOSE"); - receivedWmClose = true; PostQuitMessage(0); DoTheGame = false; @@ -148,53 +123,36 @@ LRESULT CALLBACK WinAppProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) } if (msg != WM_ACTIVATE) - { return DefWindowProcA(hWnd, msg, wParam, (LPARAM)lParam); - } - - //DB_Log(6, "WM_ACTIVATE"); if (receivedWmClose) { return DefWindowProcA(hWnd, msg, wParam, (LPARAM)lParam); } - //if (App_Unk00D9AC2B) - // return 0; - if ((short)wParam) { if ((signed int)(unsigned short)wParam > 0 && (signed int)(unsigned short)wParam <= 2) { - //DB_Log(6, "WM_ACTIVE"); - if (!Debug) - ResumeThread((HANDLE)hThread); + ResumeThread((HANDLE)ThreadHandle); App_Unk00D9ABFD = 0; - - //DB_Log(5, "Game Thread Resumed"); - return 0; } } else { - //DB_Log(6, "WM_INACTIVE"); - //DB_Log(5, "HangGameThread"); - App_Unk00D9ABFD = 1; if (!Debug) - SuspendThread((HANDLE)hThread); - - //DB_Log(5, "Game Thread Suspended"); + SuspendThread((HANDLE)ThreadHandle); } return 0; } -int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { int RetVal; int n; @@ -247,10 +205,10 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL App.WindowClass.hIcon = NULL; App.WindowClass.lpszMenuName = NULL; App.WindowClass.lpszClassName = "TR5Main"; - App.WindowClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + App.WindowClass.hbrBackground = reinterpret_cast(GetStockObject(BLACK_BRUSH)); App.WindowClass.hInstance = hInstance; App.WindowClass.style = CS_VREDRAW | CS_HREDRAW; - App.WindowClass.lpfnWndProc = (WNDPROC)WinAppProc; + App.WindowClass.lpfnWndProc = WinAppProc; App.WindowClass.cbClsExtra = 0; App.WindowClass.cbWndExtra = 0; App.WindowClass.hCursor = LoadCursor(App.hInstance, IDC_ARROW); @@ -268,7 +226,6 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL // Load configuration and optionally show the setup dialog InitDefaultConfiguration(); - //SetupDialog(); if (setup || !LoadConfiguration()) { if (!SetupDialog()) @@ -280,13 +237,11 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL LoadConfiguration(); } - tagRECT Rect; - + RECT Rect; Rect.left = 0; Rect.top = 0; Rect.right = g_Configuration.Width; Rect.bottom = g_Configuration.Height; - AdjustWindowRect(&Rect, WS_CAPTION, false); App.WindowHandle = CreateWindowEx( @@ -294,8 +249,8 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL "TR5Main", g_GameFlow->GetSettings()->WindowTitle.c_str(), WS_POPUP, - 0, - 0, + CW_USEDEFAULT, // TODO: change this to center of screen !!! + CW_USEDEFAULT, Rect.right - Rect.left, Rect.bottom - Rect.top, NULL, @@ -312,8 +267,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL WindowsHandle = App.WindowHandle; // Initialise the renderer - g_Renderer->Initialise(g_Configuration.Width, g_Configuration.Height, g_Configuration.RefreshRate, - g_Configuration.Windowed, App.WindowHandle); + g_Renderer->Initialise(g_Configuration.Width, g_Configuration.Height, g_Configuration.RefreshRate, g_Configuration.Windowed, App.WindowHandle); // Initialize audio if (g_Configuration.EnableSound) @@ -321,15 +275,16 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL // Initialise the new inventory g_Inventory = new Inventory(); - App.bNoFocus = false; App.isInScene = false; UpdateWindow(WindowsHandle); ShowWindow(WindowsHandle, nShowCmd); + //Create debug script terminal - if (Debug) { + if (Debug) + { MainThreadID = GetWindowThreadProcessId(WindowsHandle, NULL); AllocConsole(); HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE); @@ -350,43 +305,43 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL LPTHREAD_START_ROUTINE readConsoleLoop = [](LPVOID params) -> DWORD { DWORD read; CHAR buffer[4096]; - while (true) { + while (true) + { BOOL success = ReadFile(params, &buffer, 4096, &read, NULL); - if (success) { + if (success) + { //Only send the actual written message minus \r\n string msg(buffer, read-2); - SendMessageA(WindowsHandle, WM_USER + 0, (WPARAM)&msg, NULL); + SendMessage(WindowsHandle, WM_USER, (WPARAM)&msg, NULL); } }; return 0; }; CreateThread(NULL, 0, readConsoleLoop, handle_in, 0, &DebugConsoleThreadID); } - SetCursor(0); - ShowCursor(0); - hAccTable = LoadAcceleratorsA(hInstance, (LPCSTR)0x65); + + SetCursor(NULL); + ShowCursor(FALSE); + hAccTable = LoadAccelerators(hInstance, (LPCSTR)0x65); //g_Renderer->Test(); SoundActive = false; DoTheGame = true; - Unk_876C48 = false; - hThread = _beginthreadex(0, 0, &GameMain, 0, 0, &threadId); + ThreadEnded = false; + ThreadHandle = BeginThread(GameMain, ThreadID); WinProcMsg(); - Unk_876C48 = true; + ThreadEnded = true; while (DoTheGame); WinClose(); - - return 0; + exit(EXIT_SUCCESS); } -int WinClose() +void WinClose() { - //DB_Log(2, "WinClose - DLL"); - DestroyAcceleratorTable(hAccTable); if (g_Configuration.EnableSound) @@ -398,6 +353,4 @@ int WinClose() delete g_GameFlow; SaveGame::End(); - - return 0; } \ No newline at end of file diff --git a/TR5Main/Specific/winmain.h b/TR5Main/Specific/winmain.h index 8e34d3410..1bad12106 100644 --- a/TR5Main/Specific/winmain.h +++ b/TR5Main/Specific/winmain.h @@ -1,7 +1,4 @@ #pragma once - -#include "..\Global\global.h" - #pragma comment(linker,"/manifestdependency:\"" \ "type='win32' " \ "name='Microsoft.Windows.Common-Controls' " \ @@ -10,18 +7,29 @@ "publicKeyToken='6595b64144ccf1df' " \ "language='*'\"") -extern WINAPP App; -extern unsigned int threadId; -extern uintptr_t hThread; +typedef struct WINAPP +{ + HINSTANCE hInstance; + int nFillMode; + WNDCLASS WindowClass; + HWND WindowHandle; + bool bNoFocus; + bool isInScene; +}; + +extern WINAPP App; +extern unsigned int ThreadID; +extern uintptr_t ThreadHandle; extern HACCEL hAccTable; extern HWND WindowsHandle; -//#define GameClose ((int (__cdecl*)(void)) 0x004A8575) -//#define WinAppProc2 ((int (__cdecl*)(HWND, UINT, WPARAM, LPARAM)) 0x004D2AB0) +// return handle +#define BeginThread(function, threadid) _beginthreadex(0, 0, &function, 0, 0, &threadid) +#define EndThread() _endthreadex(1) int lua_exception_handler(lua_State *L, sol::optional maybe_exception, sol::string_view description); -int WinProcMsg(); -int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd); -int WinClose(); +void WinProcMsg(); +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd); +void WinClose(); LRESULT CALLBACK WinAppProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -void __stdcall HandleWmCommand(unsigned short wParam); \ No newline at end of file +void CALLBACK HandleWmCommand(unsigned short wParam); \ No newline at end of file diff --git a/TR5Main/TR5Main.cpp b/TR5Main/TR5Main.cpp deleted file mode 100644 index 4f868b8e1..000000000 Binary files a/TR5Main/TR5Main.cpp and /dev/null differ diff --git a/TR5Main/TR5Main.vcxproj b/TR5Main/TR5Main.vcxproj index 907fa4b09..93f55dee4 100644 --- a/TR5Main/TR5Main.vcxproj +++ b/TR5Main/TR5Main.vcxproj @@ -60,18 +60,19 @@ - NotUsing + Use TurnOffAllWarnings Disabled true _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;TR5MAIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) false - %(AdditionalIncludeDirectories) + $(SolutionDir)TR5Main;$(SolutionDir)TR5Main\Game;$(SolutionDir)TR5Main\Global;$(SolutionDir)TR5Main\Objects;$(SolutionDir)TR5Main\Objects\Utils;$(SolutionDir)TR5Main\Objects\Effects;$(SolutionDir)TR5Main\Objects\TR1;$(SolutionDir)TR5Main\Objects\TR1\Entity;$(SolutionDir)TR5Main\Objects\TR1\Trap;$(SolutionDir)TR5Main\Objects\TR2;$(SolutionDir)TR5Main\Objects\TR2\Entity;$(SolutionDir)TR5Main\Objects\TR2\Trap;$(SolutionDir)TR5Main\Objects\TR2\Vehicles;$(SolutionDir)TR5Main\Objects\TR3;$(SolutionDir)TR5Main\Objects\TR3\Entity;$(SolutionDir)TR5Main\Objects\TR3\Trap;$(SolutionDir)TR5Main\Objects\TR3\Vehicles;$(SolutionDir)TR5Main\Objects\TR4;$(SolutionDir)TR5Main\Objects\TR4\Entity;$(SolutionDir)TR5Main\Objects\TR4\Trap;$(SolutionDir)TR5Main\Objects\TR4\Object;$(SolutionDir)TR5Main\Objects\TR4\Floor;$(SolutionDir)TR5Main\Objects\TR4\Switch;$(SolutionDir)TR5Main\Objects\TR4\Vehicles;$(SolutionDir)TR5Main\Objects\TR5;$(SolutionDir)TR5Main\Objects\TR5\Entity;$(SolutionDir)TR5Main\Objects\TR5\Trap;$(SolutionDir)TR5Main\Objects\TR5\Emitter;$(SolutionDir)TR5Main\Objects\TR5\Shatter;$(SolutionDir)TR5Main\Objects\TR5\Switch;$(SolutionDir)TR5Main\Objects\TR5\Object;$(SolutionDir)TR5Main\Objects\Vehicles;$(SolutionDir)TR5Main\Renderer;$(SolutionDir)TR5Main\Scripting;$(SolutionDir)TR5Main\Specific;$(SolutionDir)TR5Main\Specific\IO;%(AdditionalIncludeDirectories) MultiThreadedDebugDLL false true false stdcpp14 + framework.h Windows @@ -91,7 +92,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" - NotUsing + Use EnableAllWarnings MaxSpeed true @@ -99,12 +100,13 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" true _CRT_SECURE_NO_WARNINGS;WIN32;_RELEASE;TR5MAIN_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true - $(SolutionDir)TR5Main\Libs\fixedpoint;$(SolutionDir)TR5Main\Libs\sol2;%(AdditionalIncludeDirectories) + $(SolutionDir)TR5Main;$(SolutionDir)TR5Main\Game;$(SolutionDir)TR5Main\Global;$(SolutionDir)TR5Main\Objects;$(SolutionDir)TR5Main\Objects\Utils;$(SolutionDir)TR5Main\Objects\Effects;$(SolutionDir)TR5Main\Objects\TR1;$(SolutionDir)TR5Main\Objects\TR1\Entity;$(SolutionDir)TR5Main\Objects\TR1\Trap;$(SolutionDir)TR5Main\Objects\TR2;$(SolutionDir)TR5Main\Objects\TR2\Entity;$(SolutionDir)TR5Main\Objects\TR2\Trap;$(SolutionDir)TR5Main\Objects\TR2\Vehicles;$(SolutionDir)TR5Main\Objects\TR3;$(SolutionDir)TR5Main\Objects\TR3\Entity;$(SolutionDir)TR5Main\Objects\TR3\Trap;$(SolutionDir)TR5Main\Objects\TR3\Vehicles;$(SolutionDir)TR5Main\Objects\TR4;$(SolutionDir)TR5Main\Objects\TR4\Entity;$(SolutionDir)TR5Main\Objects\TR4\Trap;$(SolutionDir)TR5Main\Objects\TR4\Object;$(SolutionDir)TR5Main\Objects\TR4\Floor;$(SolutionDir)TR5Main\Objects\TR4\Switch;$(SolutionDir)TR5Main\Objects\TR4\Vehicles;$(SolutionDir)TR5Main\Objects\TR5;$(SolutionDir)TR5Main\Objects\TR5\Entity;$(SolutionDir)TR5Main\Objects\TR5\Trap;$(SolutionDir)TR5Main\Objects\TR5\Emitter;$(SolutionDir)TR5Main\Objects\TR5\Shatter;$(SolutionDir)TR5Main\Objects\TR5\Switch;$(SolutionDir)TR5Main\Objects\TR5\Object;$(SolutionDir)TR5Main\Objects\Vehicles;$(SolutionDir)TR5Main\Renderer;$(SolutionDir)TR5Main\Scripting;$(SolutionDir)TR5Main\Specific;$(SolutionDir)TR5Main\Specific\IO;%(AdditionalIncludeDirectories) true true Speed true stdcpp14 + framework.h Windows @@ -123,12 +125,165 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -158,21 +313,19 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" - - - + - + @@ -202,114 +355,148 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" - - - - - - - - - - - + + + + + + + Create + Create + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -324,13 +511,12 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" - - - - - - - + + + + + + @@ -338,15 +524,14 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" - - + - + @@ -374,162 +559,35 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" - - - - - - - - - - + + + + + + + + + - + - + - - true - true - - - true - true - - - true - true - - - true - true - - - true - false - - - true - true - - - true - true - - - true - true - Document - false true Text - - - true - true - Document - - - true - true - Document - - - true - true - Document - - - true - true - - - true - true - Document - - - true - true - Document - - - true - true - Document - - - true - true - Document - - - - - true - true - Document - - - - - true - true - Document - - - - - true - true - Document - - - - - true - true - Document - - - - - true - true - Document - - - - - true - true - Document - - - - - true - true - Document - - - - - true - true - Document + false + true @@ -549,100 +607,24 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" Document - - - true - true - Text - - - - - true - true - Text - - - - - true - true - Document - - - - - true - true - Document - - - - - true - true - Text - - - - - true - true - Text - - - - - true - true - Text - - - - - true - true - Text - - - - - true - true - Text - - - - - true - true - Text - - - - - true - true - - - - - true - true - Document - - - + + false + true + false + true + PS Pixel false true Document + false + true false @@ -650,15 +632,223 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" Document PSColored 2.0 + false + true - - true + + + + Document + false + true + false + true + + + + + false true Document - VS - Vertex - false - + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + + + false + true + Document + false + true + diff --git a/TR5Main/TR5Main.vcxproj.filters b/TR5Main/TR5Main.vcxproj.filters index e781c9881..c4da6d3e2 100644 --- a/TR5Main/TR5Main.vcxproj.filters +++ b/TR5Main/TR5Main.vcxproj.filters @@ -1,891 +1,1413 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - File di intestazione - - - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - File di origine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - File di risorse - - - - - - - - File di risorse - - - File di risorse - - - - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + File di intestazione + + + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + File di origine + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File di risorse + + + + + File di risorse + + \ No newline at end of file diff --git a/TR5Main/framework.cpp b/TR5Main/framework.cpp new file mode 100644 index 000000000..050e52587 --- /dev/null +++ b/TR5Main/framework.cpp @@ -0,0 +1 @@ +#include "framework.h" diff --git a/TR5Main/framework.h b/TR5Main/framework.h new file mode 100644 index 000000000..9fd8fdc2e --- /dev/null +++ b/TR5Main/framework.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +//#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "bass.h" +#include "bass_fx.h" +#include "sol.hpp" + +using namespace std; +using namespace DirectX; +using namespace DirectX::SimpleMath; + +#pragma warning(disable: 4996)