Fixed some think, Added zoneType feature

- updated:
CreatureActive()
CreatureCreature()
UpdateBox()
TargetBox()
StalkBox()
ValidBox()
EscapeBox()
InitialiseSlot()
InitialiseObjects()
- updated SearchLOT() and fixed wrong value.
- fixed hitEffect not being initialised.
- fixed some double define.
- moved lara define to constants.h.
- updated script.dat to last version, deleted the one in script folder (not used).
This commit is contained in:
TokyoSU 2019-12-13 19:00:59 +01:00
parent 8189e22677
commit 0bc2b14595
19 changed files with 304 additions and 278 deletions

Binary file not shown.

Binary file not shown.

View file

@ -11,6 +11,9 @@
extern LaraExtraInfo g_LaraExtra;
#define ESCAPE_DIST (WALL_SIZE*5)
#define STALK_DIST (WALL_SIZE*3)
void DropBaddyPickups(ITEM_INFO* item)
{
ITEM_INFO* pickup = NULL;
@ -236,26 +239,20 @@ 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))
{
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);
}
short CreatureEffect(ITEM_INFO* item, BITE_INFO* bite, short(*generate)(int x, int y, int z, short speed, short yrot, short roomNumber))
{
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);
}
@ -313,7 +310,7 @@ void CreatureFloat(short itemNumber)
AnimateItem(item);
printf("Crocodile Y: %d\n", item->pos.yPos);
//printf("Crocodile Y: %d\n", item->pos.yPos);
short roomNumber = item->roomNumber;
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
@ -351,10 +348,10 @@ void CreatureJoint(ITEM_INFO* item, short joint, short required)
creature->jointRotation[joint] += change;
if (creature->jointRotation[joint] > 12288)
creature->jointRotation[joint] = 12288;
else if (creature->jointRotation[joint] < -12288)
creature->jointRotation[joint] = -12288;
if (creature->jointRotation[joint] > ANGLE(70))
creature->jointRotation[joint] = ANGLE(70);
else if (creature->jointRotation[joint] < -ANGLE(70))
creature->jointRotation[joint] = -ANGLE(70);
}
void CreatureTilt(ITEM_INFO* item, short angle)
@ -366,13 +363,15 @@ void CreatureTilt(ITEM_INFO* item, short angle)
else if (angle > ANGLE(3))
angle = ANGLE(3);
item->pos.zRot += angle;
/*
short theAngle = -ANGLE(3);
short absRot = abs(item->pos.zRot);
if (absRot < ANGLE(15) || absRot > ANGLE(30))
angle >>= 1;
item->pos.zRot += angle;
*/
}
// TODO: probably wrong value somewhere, since the xRot is modified.
@ -806,58 +805,69 @@ void CreatureDie(short itemNumber, int explode)
int BadFloor(int x, int y, int z, int boxHeight, int nextHeight, short roomNumber, LOT_INFO* LOT)
{
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNumber);
FLOOR_INFO* floor;
int height;
if (floor->box == 0x7FF)
return 1;
floor = GetFloor(x, y, z, &roomNumber);
if (floor->box == NO_BOX)
return TRUE;
if (LOT->isJumping)
return 0;
return FALSE;
if (Boxes[floor->box].overlapIndex & LOT->blockMask)
return 1;
return TRUE;
int height = Boxes[floor->box].height;
if (boxHeight - height > LOT->step)
return 1;
if (boxHeight - height < LOT->drop)
return 1;
height = Boxes[floor->box].height;
if (boxHeight - height > LOT->step || boxHeight - height < LOT->drop)
return TRUE;
if (boxHeight - height < -LOT->step && height > nextHeight)
return 1;
return TRUE;
if (LOT->fly && y > height + LOT->fly)
return 1;
if ((LOT->fly != NO_FLYING) && y > height + LOT->fly)
return TRUE;
return 0;
return FALSE;
}
int CreatureCreature(short itemNumber)
{
int x = Items[itemNumber].pos.xPos;
int z = Items[itemNumber].pos.zPos;
ITEM_INFO* item, *linked;
OBJECT_INFO* obj;
ROOM_INFO* r;
int x, z, xDistance, zDistance, distance = 0;
short link, radius;
ITEM_INFO* item;
item = &Items[itemNumber];
obj = &Objects[item->objectNumber];
x = item->pos.xPos;
z = item->pos.zPos;
radius = obj->radius;
for (short link = Rooms[Items[itemNumber].roomNumber].itemNumber; link != NO_ITEM; link = item->nextItem)
r = &Rooms[item->roomNumber];
link = r->itemNumber;
do
{
item = &Items[link];
linked = &Items[link];
if (link != itemNumber && item != LaraItem && item->status == ITEM_ACTIVE && item->hitPoints > 0)
if (link != itemNumber && linked != LaraItem && linked->status == ITEM_ACTIVE && linked->hitPoints > 0)
{
int xdistance = abs(item->pos.xPos - x);
int zdistance = abs(item->pos.zPos - z);
int radius = xdistance <= zdistance ? zdistance + (xdistance >> 1) : xdistance + (zdistance >> 1);
if (radius < Objects[Items[itemNumber].objectNumber].radius + Objects[item->objectNumber].radius)
{
int yRot = Items[itemNumber].pos.yRot;
return ATAN(item->pos.zPos - z, item->pos.xPos - x) - yRot;
}
}
xDistance = abs(linked->pos.xPos - x);
zDistance = abs(linked->pos.zPos - z);
if (xDistance > zDistance)
distance = xDistance + (zDistance >> 1);
else
distance = zDistance + (xDistance >> 1);
if (distance < radius + Objects[linked->objectNumber].radius)
return ATAN(linked->pos.zPos - z, linked->pos.xPos - x) - item->pos.yRot;
}
link = linked->nextItem;
} while (link != NO_ITEM);
return 0;
}
@ -869,56 +879,60 @@ int CreatureCreature(short itemNumber)
int ValidBox(ITEM_INFO* item, short zoneNumber, short boxNumber)
{
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
short* zone = GroundZones[FlipStatus + 2 * creature->LOT.zone];
CREATURE_INFO* creature;
BOX_INFO* box;
short* zone;
if (creature->LOT.fly == 0 && zone[boxNumber] != zoneNumber)
return 0;
BOX_INFO* box = &Boxes[boxNumber];
creature = (CREATURE_INFO*)item->data;
zone = GroundZones[FlipStatus + 2 * creature->LOT.zone];
if (creature->LOT.fly == NO_FLYING && zone[boxNumber] != zoneNumber)
return FALSE;
box = &Boxes[boxNumber];
if (box->overlapIndex & creature->LOT.blockMask)
return 0;
return FALSE;
if ((item->pos.zPos > (box->left * 1024)) || ((box->right * 1024) > item->pos.zPos) ||
(item->pos.xPos > (box->top * 1024)) || ((box->bottom * 1024) > item->pos.xPos))
return 1;
if ((item->pos.zPos > (box->left << WALL_SHIFT)) && item->pos.zPos < ((box->right << WALL_SHIFT)) &&
(item->pos.xPos > (box->top << WALL_SHIFT)) && item->pos.xPos < ((box->bottom << WALL_SHIFT)))
return FALSE;
return 0;
return TRUE;
}
int EscapeBox(ITEM_INFO* item, ITEM_INFO* enemy, short boxNumber)
{
BOX_INFO* box = &Boxes[boxNumber];
int x = ((box->top + box->bottom) << (WALL_SHIFT - 1)) - enemy->pos.xPos;
int z = ((box->left + box->right) << (WALL_SHIFT - 1)) - enemy->pos.zPos;
int x, z;
if (x > -5120 && x < 5120 && z > -5120 && z < 5120)
return 0;
x = (int(box->top + box->bottom) << (WALL_SHIFT - 1)) - enemy->pos.xPos;
z = (int(box->left + box->right) << (WALL_SHIFT - 1)) - enemy->pos.zPos;
if (((x > 0) ^ (item->pos.xPos > enemy->pos.xPos)) &&
((z > 0) ^ (item->pos.zPos > enemy->pos.zPos)))
return 0;
if (x > -ESCAPE_DIST && x < ESCAPE_DIST && z > -ESCAPE_DIST && z < ESCAPE_DIST)
return FALSE;
return 1;
if (((x > 0) ^ (item->pos.xPos > enemy->pos.xPos)) && ((z > 0) ^ (item->pos.zPos > enemy->pos.zPos)))
return FALSE;
return TRUE;
}
void TargetBox(LOT_INFO* LOT, short boxNumber)
{
boxNumber &= 0x7FF;
BOX_INFO* box = &Boxes[boxNumber];
BOX_INFO* box;
boxNumber &= NO_BOX;
box = &Boxes[boxNumber];
//LOT->target.x = (((((box->bottom - box->top) - 1) * GetRandomControl()) / 32) + (box->top * 1024)) + 512;
//LOT->target.z = (((((box->right - box->left) - 1) * GetRandomControl()) / 32) + (box->left * 1024)) + 512;
LOT->target.x = ((box->top << WALL_SHIFT) + GetRandomControl() * ((box->bottom - box->top) - 1) >> 5) + WALL_SIZE/2;
LOT->target.z = ((box->left << WALL_SHIFT) + GetRandomControl() * ((box->right - box->left) - 1) >> 5) + WALL_SIZE / 2;
LOT->requiredBox = boxNumber;
LOT->target.x = (((((box->bottom - box->top) - 1) * GetRandomControl()) / 32) + (box->top * 1024)) + 512;
LOT->target.z = (((((box->right - box->left) - 1) * GetRandomControl()) / 32) + (box->left * 1024)) + 512;
if (LOT->fly == 0)
if (LOT->fly == NO_FLYING)
LOT->target.y = box->height;
else
LOT->target.y = box->height - 384;
return;
LOT->target.y = box->height - STEPUP_HEIGHT;
}
int UpdateLOT(LOT_INFO* LOT, int depth)
@ -940,7 +954,7 @@ int UpdateLOT(LOT_INFO* LOT, int depth)
LOT->head = LOT->targetBox;
}
node->searchNumber = LOT->searchNumber++;
node->searchNumber = ++LOT->searchNumber;
node->exitBox = NO_BOX;
}
@ -949,39 +963,52 @@ int UpdateLOT(LOT_INFO* LOT, int depth)
int SearchLOT(LOT_INFO* LOT, int depth)
{
short* zone = GroundZones[FlipStatus + 2 * LOT->zone];
short searchZone = zone[LOT->head];
BOX_NODE* node, *expand;
BOX_INFO* box;
short* zone, index, searchZone, boxNumber, delta;
bool done;
if (LOT->fly == NO_FLYING)
{
zone = GroundZones[FlipStatus + 2 * LOT->zone];
searchZone = zone[LOT->head];
}
else
{
zone = GroundZones[FlipStatus + 2 * LOT->zone];
searchZone = FLY_ZONE;
}
for (int i = 0; i < depth; i++)
{
if (LOT->head == NO_BOX)
{
LOT->tail = NO_BOX;
return false;
return FALSE;
}
BOX_NODE* node = &LOT->node[LOT->head];
BOX_INFO* box = &Boxes[LOT->head];
node = &LOT->node[LOT->head];
box = &Boxes[LOT->head];
int index = box->overlapIndex & OVERLAP_INDEX;
bool done = false;
index = box->overlapIndex & OVERLAP_INDEX;
done = FALSE;
do
{
short boxNumber = Overlaps[index++];
boxNumber = Overlaps[index++];
if (boxNumber & BOX_END_BIT)
{
done = true;
boxNumber &= boxNumber;
done = TRUE;
boxNumber &= BOX_NUMBER;
}
if (LOT->fly == NO_FLYING && searchZone != zone[boxNumber])
continue;
int delta = Boxes[boxNumber].height - box->height;
delta = Boxes[boxNumber].height - box->height;
if (delta > LOT->step || delta < LOT->drop)
continue;
BOX_NODE* expand = &LOT->node[boxNumber];
expand = &LOT->node[boxNumber];
if ((node->searchNumber & SEARCH_NUMBER) < (expand->searchNumber & SEARCH_NUMBER))
continue;
@ -994,8 +1021,7 @@ int SearchLOT(LOT_INFO* LOT, int depth)
}
else
{
if ((node->searchNumber & SEARCH_NUMBER) == (expand->searchNumber & SEARCH_NUMBER) &&
!(expand->searchNumber & BLOCKED_SEARCH))
if ((node->searchNumber & SEARCH_NUMBER) == (expand->searchNumber & SEARCH_NUMBER) && !(expand->searchNumber & BLOCKED_SEARCH))
continue;
if (Boxes[boxNumber].overlapIndex & LOT->blockMask)
@ -1020,21 +1046,21 @@ int SearchLOT(LOT_INFO* LOT, int depth)
node->nextExpansion = NO_BOX;
}
return true;
return TRUE;
}
int CreatureActive(short itemNumber)
{
ITEM_INFO* item = &Items[itemNumber];
if (!(item->flags & IFLAG_KILLED) && (item->status & ITEM_INVISIBLE) == ITEM_INVISIBLE)
if (!(item->flags & IFLAG_KILLED) && item->status & ITEM_INVISIBLE)
{
if (!EnableBaddieAI(itemNumber, 0))
return false;
if (!EnableBaddieAI(itemNumber, FALSE))
return FALSE;
item->status = ITEM_ACTIVE;
}
return true;
return TRUE;
}
void InitialiseCreature(short itemNumber)
@ -1044,7 +1070,7 @@ void InitialiseCreature(short itemNumber)
item->collidable = true;
item->data = NULL;
item->drawRoom = (((item->pos.zPos - room->z) / 1024) & 0xFF) | (((item->pos.xPos - room->mesh->x) / 4) & 0xFF00);
item->drawRoom = (((item->pos.zPos - room->z) / WALL_SIZE) & 0xFF) | (((item->pos.xPos - room->mesh->x) / 4) & 0xFF00);
item->TOSSPAD = item->pos.yRot & 0xE000;
item->itemFlags[2] = item->roomNumber | (item->pos.yPos - room->minfloor);
}
@ -1052,35 +1078,43 @@ void InitialiseCreature(short itemNumber)
int StalkBox(ITEM_INFO* item, ITEM_INFO* enemy, short boxNumber)
{
if (enemy == NULL)
return 0;
return FALSE;
BOX_INFO* box = &Boxes[boxNumber];
BOX_INFO* box;
int x, z, xrange, zrange;
int enemyQuad, boxQuad, baddieQuad;
int xrange = ((box->bottom - box->top + 3) << WALL_SHIFT);
int zrange = ((box->right - box->left + 3) << WALL_SHIFT);
box = &Boxes[boxNumber];
int x = ((box->top + box->bottom) << (WALL_SHIFT - 1)) - enemy->pos.xPos;
int z = ((box->left + box->right) << (WALL_SHIFT - 1)) - enemy->pos.zPos;
xrange = STALK_DIST + ((box->bottom - box->top + 3) << WALL_SHIFT);
zrange = STALK_DIST + ((box->right - box->left + 3) << WALL_SHIFT);
x = ((box->top + box->bottom) << (WALL_SHIFT - 1)) - enemy->pos.xPos;
z = ((box->left + box->right) << (WALL_SHIFT - 1)) - enemy->pos.zPos;
if (x > xrange || x < -xrange || z > zrange || z < -zrange)
return 0;
return FALSE;
int enemyQuad = (enemy->pos.yRot >> W2V_SHIFT) + 2;
int boxQuad = (z <= 0 ? (x <= 0 ? 0 : 3) : (x > 0) + 1);
enemyQuad = (enemy->pos.yRot >> W2V_SHIFT) + 2;
// boxQuad = (z <= 0 ? (x <= 0 ? 0 : 3) : (x > 0) + 1);
if (z > 0)
boxQuad = (x > 0) ? 2 : 1;
else
boxQuad = (x > 0) ? 3 : 0;
if (enemyQuad == boxQuad)
return 0;
return FALSE;
int baddieQuad = 0;
baddieQuad = 0;
if (item->pos.zPos > enemy->pos.zPos)
baddieQuad = (item->pos.xPos > enemy->pos.xPos) + 1;
baddieQuad = (item->pos.xPos > enemy->pos.xPos) ? 2 : 1;
else
baddieQuad = item->pos.xPos <= enemy->pos.xPos ? 0 : 3;
baddieQuad = (item->pos.xPos > enemy->pos.xPos) ? 3 : 0;
if (enemyQuad == baddieQuad && abs(enemyQuad - boxQuad) == 2)
return 1;
return FALSE;
return 0;
return TRUE;
}
int CreatureVault(short itemNum, short angle, int vault, int shift)
@ -1479,12 +1513,20 @@ void CreatureMood(ITEM_INFO* item, AI_INFO* info, int violent)
void GetCreatureMood(ITEM_INFO* item, AI_INFO* info, int violent)
{
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
if (item->data == NULL)
return;
CREATURE_INFO* creature;
LOT_INFO* LOT;
ITEM_INFO* enemy;
creature = (CREATURE_INFO*)item->data;
enemy = creature->enemy;
LOT = &creature->LOT;
if (creature)
{
LOT_INFO* LOT = &creature->LOT;
ITEM_INFO* enemy = creature->enemy;
if (creature->LOT.node[item->boxNumber].searchNumber == (creature->LOT.searchNumber | 0x8000))
if (creature->LOT.node[item->boxNumber].searchNumber == (creature->LOT.searchNumber | BLOCKED_SEARCH))
creature->LOT.requiredBox = NO_BOX;
if (creature->mood != ATTACK_MOOD && creature->LOT.requiredBox != NO_BOX)

View file

@ -46,6 +46,9 @@
#define phd_DxRotYXZ ((void(__cdecl*)(int, int, int)) 0x00490AF0)
#define phd_DxRotYXZpack ((void(__cdecl*)(int)) 0x00490A80)
#define mGetAngle ((int(__cdecl*)(int, int, int, int)) 0x0048F290)
#define phd_GenerateW2V ((void(__cdecl*)(PHD_3DPOS*)) 0x0048F330)
int DrawPhaseGame();
void DrawAnimatingItem(ITEM_INFO* item);
int GetFrame_D2(ITEM_INFO* item, short* framePtr[], int* rate);

View file

@ -23,22 +23,6 @@
#include <stdio.h>
#include "Anim.h"
#define SLOPE_DIF 60
#define LARA_FREEFALL_SPEED 131
#define LARA_LEAN_RATE ((ANGLE(1)/2) + ANGLE(1))
#define LARA_LEAN_MAX ANGLE(11)
#define LARA_TURN_RATE ((ANGLE(1)/4) + ANGLE(2))
#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
static short LeftClimbTab[4] = // offset 0xA0638
{
0x0200, 0x0400, 0x0800, 0x0100

View file

@ -13,6 +13,7 @@
#include "effect2.h"
#include "larafire.h"
#include "laramisc.h"
#include "draw.h"
extern LaraExtraInfo g_LaraExtra;

View file

@ -2,6 +2,9 @@
#include "..\Global\global.h"
#include <stdio.h>
#define DEFAULT_FLY_UPDOWN_SPEED 16
#define DEFAULT_SWIM_UPDOWN_SPEED 32
void InitialiseLOTarray(int allocMem)
{
DB_Log(0, "InitialiseLOTarray - DLL");
@ -92,41 +95,11 @@ void DisableBaddieAI(short itemNumber)
}
}
void InitialiseCustomObjects(short itemNum, short slot)
{
CREATURE_INFO* creature = &BaddieSlots[slot];
ITEM_INFO* item = &Items[itemNum];
switch (item->objectNumber)
{
case ID_SCUBA_DIVER:
case ID_SHARK:
case ID_BARRACUDA:
creature->LOT.step = 20480;
creature->LOT.drop = -20480;
creature->LOT.fly = 32;
creature->LOT.zone = 4;
break;
case ID_TRIBESMAN_WITH_AX:
creature->LOT.step = 256;
creature->LOT.drop = -256;
creature->LOT.isAmphibious = false;
break;
case ID_APE:
case ID_SMALL_SPIDER:
creature->LOT.step = 512;
creature->LOT.drop = -512;
creature->LOT.zone = ZONE_HUMAN;
break;
}
}
void InitialiseSlot(short itemNum, short slot)
{
CREATURE_INFO* creature = &BaddieSlots[slot];
ITEM_INFO* item = &Items[itemNum];
OBJECT_INFO* obj = &Objects[item->objectNumber];
CREATURE_INFO* creature = &BaddieSlots[slot];
item->data = creature;
creature->itemNum = itemNum;
@ -146,96 +119,109 @@ void InitialiseSlot(short itemNum, short slot)
creature->alerted = false;
creature->LOT.canJump = false;
creature->LOT.canMonkey = false;
creature->LOT.isAmphibious = true;
creature->LOT.isAmphibious = false; // only land (only crocodile can be amphibious)
creature->LOT.isJumping = false;
creature->LOT.isMonkeying = false;
creature->maximumTurn = ANGLE(1);
creature->flags = 0;
creature->enemy = NULL;
creature->LOT.fly = NO_FLYING;
creature->LOT.blockMask = BLOCKED;
// default zone for all entity with (intelligent == true)
creature->LOT.step = 256;
creature->LOT.drop = -512;
creature->LOT.blockMask = 0x4000;
creature->LOT.fly = 0;
creature->LOT.zone = ZONE_BASIC;
switch (item->objectNumber)
if (obj->intelligent)
{
case ID_MP_WITH_STICK:
case ID_MONKEY:
case ID_YETI:
case ID_SOPHIA_LEE:
case ID_LIZARD_MAN:
case ID_MP1:
// Can climb
creature->LOT.step = 1024;
creature->LOT.drop = -1024;
creature->LOT.zone = ZONE_HUMAN;
// simple check to set hitEffect to blood or smoke by default if intelligent enabled and no value assigned to hitEffect !
// undead have smoke instead of blood !
if (!obj->hitEffect)
{
if (obj->undead)
obj->hitEffect = HIT_SMOKE;
else if (!obj->undead && obj->hitPoints)
obj->hitEffect = HIT_BLOOD;
}
// init the basic zone for intelligent creature.
// ignore if the zoneType is specified in the Objects[] already.
if (obj->zoneType == ZONE_NULL)
obj->zoneType = ZONE_BASIC;
}
switch (obj->zoneType)
{
default:
case ZONE_NULL:
break;
case ID_SAS:
case ID_BLUE_GUARD:
case ID_MAFIA2:
case ID_SAILOR:
// Can climb and jjump
creature->LOT.step = 1024;
creature->LOT.drop = -1024;
creature->LOT.canJump = true;
creature->LOT.zone = ZONE_HUMAN;
break;
case ID_HITMAN:
case ID_BADDY1:
case ID_BADDY2:
// Can climb, jump, monkey
creature->LOT.step = 1024;
creature->LOT.drop = -1024;
creature->LOT.canJump = true;
creature->LOT.canMonkey = true;
creature->LOT.zone = ZONE_HUMAN;
break;
case ID_SKELETON:
case ZONE_SKELLY:
// Can jump
creature->LOT.step = 256;
creature->LOT.drop = -256;
creature->LOT.step = SECTOR(1) - CLICK(3);
creature->LOT.drop = -(SECTOR(1) - CLICK(3));
creature->LOT.canJump = true;
//creature->LOT.zone = ZONE_SKELLY;
creature->LOT.zone = ZONE_SKELLY;
break;
case ID_CROW:
case ID_EAGLE:
case ID_WILLOWISP:
case ID_REAPER:
case ID_GREEN_TEETH:
case ID_ATTACK_SUB:
case ID_BAT:
case ID_HARPY:
case ZONE_BASIC:
creature->LOT.step = SECTOR(1) - CLICK(3);
creature->LOT.drop = -(SECTOR(1) - CLICK(3));
creature->LOT.zone = ZONE_BASIC;
break;
case ZONE_FLYER:
// Can fly
creature->LOT.step = 20480;
creature->LOT.drop = -20480;
creature->LOT.fly = 16;
creature->LOT.step = SECTOR(20);
creature->LOT.drop = -SECTOR(20);
creature->LOT.fly = DEFAULT_FLY_UPDOWN_SPEED;
creature->LOT.zone = ZONE_FLYER;
break;
case ID_SCUBA_DIVER:
case ID_SHARK:
case ID_BARRACUDA:
case ID_CROCODILE:
case ZONE_WATER:
// Can swim
creature->LOT.step = 20480;
creature->LOT.drop = -20480;
creature->LOT.fly = 32;
creature->LOT.step = SECTOR(20);
creature->LOT.drop = -SECTOR(20);
if (item->objectNumber == ID_CROCODILE)
{
creature->LOT.fly = DEFAULT_SWIM_UPDOWN_SPEED / 2; // crocodile is more slower than the other creature when swimming.
creature->LOT.isAmphibious = true; // crocodile can walk and swim.
}
else
{
creature->LOT.fly = DEFAULT_SWIM_UPDOWN_SPEED;
}
creature->LOT.zone = ZONE_WATER;
break;
case ZONE_HUMAN_CLASSIC:
// Can climb
creature->LOT.step = SECTOR(1);
creature->LOT.drop = -SECTOR(1);
creature->LOT.zone = ZONE_HUMAN_CLASSIC;
break;
case ZONE_HUMAN_JUMP:
// Can climb and jump
creature->LOT.step = SECTOR(1);
creature->LOT.drop = -SECTOR(1);
creature->LOT.canJump = true;
creature->LOT.zone = ZONE_HUMAN_CLASSIC;
break;
case ZONE_HUMAN_JUMP_AND_MONKEY:
// Can climb, jump, monkey
creature->LOT.step = SECTOR(1);
creature->LOT.drop = -SECTOR(1);
creature->LOT.canJump = true;
creature->LOT.canMonkey = true;
creature->LOT.zone = ZONE_HUMAN_CLASSIC;
break;
case ZONE_SPIDER:
creature->LOT.step = SECTOR(1) - CLICK(2);
creature->LOT.drop = -(SECTOR(1) - CLICK(2));
creature->LOT.zone = ZONE_HUMAN_CLASSIC;
break;
}
// Hook for initialising custom objects in a separate function
InitialiseCustomObjects(itemNum, slot);
ClearLOT(&creature->LOT);
if (itemNum != Lara.itemNumber)
CreateZone(item);

View file

@ -11,6 +11,12 @@
#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
@ -23,6 +29,7 @@
#define NUM_SPRITES 256
#define UNIT_SHADOW 256
#define NO_SHADOW 0
#define DEFAULT_RADIUS 10
#define ROT_X 4
#define ROT_Y 8
@ -120,7 +127,6 @@
#define BLOCKABLE 0x8000
#define BLOCKED 0x4000
#define OVERLAP_INDEX 0x3fff
#define SEARCH_NUMBER 0x7fff
#define BLOCKED_SEARCH 0x8000
@ -139,15 +145,7 @@
#define EXPAND_TOP 0x4
#define EXPAND_BOTTOM 0x8
#define BLOCKABLE 0x8000
#define BLOCKED 0x4000
#define OVERLAP_INDEX 0x3fff
#define SEARCH_NUMBER 0x7fff
#define BLOCKED_SEARCH 0x8000
#define NO_FLYING 0
#define FLY_ZONE 0x2000
#define CLIP_LEFT 1
@ -156,3 +154,16 @@
#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)/2) + ANGLE(1))
#define LARA_LEAN_MAX ANGLE(11)
#define LARA_TURN_RATE ((ANGLE(1)/4) + ANGLE(2))
#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

View file

@ -13,22 +13,14 @@
#define CLAMPADD(x, a, b) ((x)<(a)?((x)+(a)):((x)>(b)?((x)-(b)):0))
#define ONE_DEGREE 182
//#define ANGLE(x) ((x) * 65536.0 / 360.0)
#define CLICK(x) ((x) * STEP_SIZE)
#define SECTOR(x) ((x) * WALL_SIZE)
#define TR_ANGLE_TO_DEGREES(x) ((x) / 65536.0 * 360.0)
#define TR_ANGLE_TO_RAD(x) ((x) / 65536.0 * 360.0 * RADIAN)
#define TR_ANGLE_TO_DEGREES(x) ((x) / 65536.0f * 360.0f)
#define TR_ANGLE_TO_RAD(x) ((x) / 65536.0f * 360.0f * RADIAN)
#define SQRT_ASM ((int (__cdecl*)(int)) 0x0048F980)
#define ATAN ((int (__cdecl*)(int, int)) 0x0048F8A0)
#define SIN(x) (4 * rcossin_tbl[((int)(x) >> 3) & 0x1FFE])
#define COS(x) (4 * rcossin_tbl[(((int)(x) >> 3) & 0x1FFE) + 1])
#define phd_GetVectorAngles ((void(__cdecl*)(int, int, int, short*)) 0x004904B0)
#define phd_RotYXZ ((void(__cdecl*)(int, int, int)) 0x00490150)
#define phd_TranslateRel ((void(__cdecl*)(int, int, int)) 0x0048FB20)
#define mGetAngle ((int(__cdecl*)(int, int, int, int)) 0x0048F290)
#define phd_GenerateW2V ((void(__cdecl*)(PHD_3DPOS*)) 0x0048F330)
#define PI 3.14159265358979323846f
#define RADIAN 0.01745329252f
short ANGLE(short ang);

View file

@ -4,11 +4,15 @@
#pragma pack(push, 1)
typedef enum TYPE_ZONE
{
ZONE_SKELLY,
ZONE_NULL = -1,
ZONE_SKELLY = 0,
ZONE_BASIC,
ZONE_FLYER,
ZONE_HUMAN,
ZONE_WATER // TODO: zone water and flyer is the same ?
ZONE_HUMAN_CLASSIC,
ZONE_WATER,
ZONE_HUMAN_JUMP_AND_MONKEY,
ZONE_HUMAN_JUMP,
ZONE_SPIDER,
};
typedef struct vector_t

View file

@ -3,6 +3,7 @@
#include "../../Game/debris.h"
#include "../../Game/items.h"
#include "../../Game/traps.h"
#include "../../Game/draw.h"
void BubblesEffect1(short fxNum, short xVel, short yVel, short zVel)
{

View file

@ -1,5 +1,6 @@
#include "../newobjects.h"
#include "../../Game/effects.h"
#include "../../Game/draw.h"
#define PIRAHNA_DAMAGE 4
#define X 0

View file

@ -4,6 +4,7 @@
#include "../../Game/effect2.h"
#include "../../Game/people.h"
#include "../../Game/items.h"
#include "../../Game/draw.h"
BITE_INFO flamerBite = { 0, 340, 64, 7 };

View file

@ -5,6 +5,7 @@
#include "../../Game/sphere.h"
#include "../../Game/effect2.h"
#include "../../Game/people.h"
#include "../../Game/draw.h"
BITE_INFO tribesmanAxeBite = { 0, 16, 265, 13 };
BITE_INFO tribesmanDartsBite1 = { 0, 0, -200, 13 };

View file

@ -4,6 +4,7 @@
#include "../../Game/people.h"
#include "../../Game/sphere.h"
#include "../../Game/effect2.h"
#include "../../Game/draw.h"
void InitialiseDemigod(short itemNum)
{

View file

@ -5,6 +5,7 @@
#include "../../Game/effect2.h"
#include "../../Game/items.h"
#include "../../Game/sphere.h"
#include "../../Game/draw.h"
BITE_INFO harpyBite1 = { 0, 0, 0, 4 };
BITE_INFO harpyBite2 = { 0, 0, 0, 2 };

View file

@ -6,6 +6,7 @@
#include "../../Game/laraflar.h"
#include "../../Game/items.h"
#include "../../Game/sphere.h"
#include "../../Game/draw.h"
extern LaraExtraInfo g_LaraExtra;

View file

@ -8,6 +8,7 @@
#include "../../Game/box.h"
#include "../../Game/anim.h"
#include "../../Game/laraflar.h"
#include "../../Game/draw.h"
extern LaraExtraInfo g_LaraExtra;

View file

@ -53,7 +53,6 @@ void NewObjects()
obj->saveHitpoints = true;
obj->saveAnim = true;
obj->saveFlags = true;
obj->hitEffect = true;
}
obj = &Objects[ID_WILD_BOAR];
@ -320,7 +319,6 @@ void NewObjects()
obj->saveHitpoints = true;
obj->saveAnim = true;
obj->saveFlags = true;
Bones[obj->boneIndex + 21 * 4] |= ROT_Y;
}
@ -693,7 +691,6 @@ void NewObjects()
obj->saveHitpoints = true;
obj->saveFlags = true;
obj->saveAnim = true;
obj->hitEffect = 3;
}
obj = &Objects[ID_KNIGHT_TEMPLAR];
@ -731,7 +728,7 @@ void NewObjects()
obj->saveHitpoints = true;
obj->saveFlags = true;
obj->saveAnim = true;
obj->hitEffect = 3;
obj->hitEffect = HIT_FRAGMENT;
obj->undead = true;
Bones[obj->boneIndex + 4 * 4] |= ROT_X | ROT_Y | ROT_Z;
@ -753,7 +750,7 @@ void NewObjects()
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;
}
@ -773,7 +770,7 @@ void NewObjects()
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;
}
@ -834,7 +831,6 @@ void NewObjects()
obj->saveHitpoints = true;
obj->saveFlags = true;
obj->saveAnim = true;
obj->hitEffect = 2;
}
obj = &Objects[ID_TROOPS];
@ -1934,7 +1930,6 @@ void BaddyObjects()
obj->saveFlags = true;
obj->saveAnim = true;
obj->usingDrawAnimatingItem = false;
obj->hitEffect = 0;
obj->undead = true; // ??
}
@ -1953,7 +1948,6 @@ void BaddyObjects()
obj->saveFlags = true;
obj->saveAnim = true;
obj->usingDrawAnimatingItem = false;
obj->hitEffect = 1;
Bones[obj->boneIndex + 6 * 4] |= ROT_Y;
Bones[obj->boneIndex + 6 * 4] |= ROT_X;
Bones[obj->boneIndex + 8 * 4] |= ROT_Y;
@ -3737,9 +3731,10 @@ void InitialiseObjects()
obj->drawRoutineExtra = NULL;
obj->pivotLength = 0;
obj->radius = DEFAULT_RADIUS;
obj->shadowSize = 0;
obj->shadowSize = NO_SHADOW;
obj->hitPoints = -16384;
obj->explodableMeshbits = 0;
obj->hitEffect = HIT_NONE;
obj->explodableMeshbits = NULL;
obj->intelligent = false;
obj->waterCreature = false;
obj->saveMesh = false;
@ -3751,7 +3746,7 @@ void InitialiseObjects()
obj->usingDrawAnimatingItem = true;
obj->semiTransparent = false;
obj->undead = false;
obj->zoneType = ZONE_BASIC;
obj->zoneType = ZONE_NULL;
obj->frameBase += (short)Frames;
}