mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-11 21:16:55 +03:00
Pushables: substitute hardcoded floor values with constants, test functions return bool.
This commit is contained in:
parent
032f91a87c
commit
dda01d145f
2 changed files with 74 additions and 76 deletions
|
@ -25,7 +25,7 @@ OBJECT_COLLISION_BOUNDS PushableBlockBounds = {
|
||||||
};
|
};
|
||||||
|
|
||||||
PHD_VECTOR PushableBlockPos = { 0, 0, 0 };
|
PHD_VECTOR PushableBlockPos = { 0, 0, 0 };
|
||||||
int DoPushPull = 0;
|
bool DoPushPull = 0;
|
||||||
|
|
||||||
void ClearMovableBlockSplitters(int x, int y, int z, short roomNumber)
|
void ClearMovableBlockSplitters(int x, int y, int z, short roomNumber)
|
||||||
{
|
{
|
||||||
|
@ -34,35 +34,35 @@ void ClearMovableBlockSplitters(int x, int y, int z, short roomNumber)
|
||||||
short height = g_Level.Boxes[floor->box].height;
|
short height = g_Level.Boxes[floor->box].height;
|
||||||
short baseRoomNumber = roomNumber;
|
short baseRoomNumber = roomNumber;
|
||||||
|
|
||||||
floor = GetFloor(x + 1024, y, z, &roomNumber);
|
floor = GetFloor(x + SECTOR(1), y, z, &roomNumber);
|
||||||
if (floor->box != NO_BOX)
|
if (floor->box != NO_BOX)
|
||||||
{
|
{
|
||||||
if (g_Level.Boxes[floor->box].height == height && (g_Level.Boxes[floor->box].flags & BLOCKABLE) && (g_Level.Boxes[floor->box].flags & BLOCKED))
|
if (g_Level.Boxes[floor->box].height == height && (g_Level.Boxes[floor->box].flags & BLOCKABLE) && (g_Level.Boxes[floor->box].flags & BLOCKED))
|
||||||
ClearMovableBlockSplitters(x + 1024, y, z, roomNumber);
|
ClearMovableBlockSplitters(x + SECTOR(1), y, z, roomNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
roomNumber = baseRoomNumber;
|
roomNumber = baseRoomNumber;
|
||||||
floor = GetFloor(x - 1024, y, z, &roomNumber);
|
floor = GetFloor(x - SECTOR(1), y, z, &roomNumber);
|
||||||
if (floor->box != NO_BOX)
|
if (floor->box != NO_BOX)
|
||||||
{
|
{
|
||||||
if (g_Level.Boxes[floor->box].height == height && (g_Level.Boxes[floor->box].flags & BLOCKABLE) && (g_Level.Boxes[floor->box].flags & BLOCKED))
|
if (g_Level.Boxes[floor->box].height == height && (g_Level.Boxes[floor->box].flags & BLOCKABLE) && (g_Level.Boxes[floor->box].flags & BLOCKED))
|
||||||
ClearMovableBlockSplitters(x - 1024, y, z, roomNumber);
|
ClearMovableBlockSplitters(x - SECTOR(1), y, z, roomNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
roomNumber = baseRoomNumber;
|
roomNumber = baseRoomNumber;
|
||||||
floor = GetFloor(x, y, z + 1024, &roomNumber);
|
floor = GetFloor(x, y, z + SECTOR(1), &roomNumber);
|
||||||
if (floor->box != NO_BOX)
|
if (floor->box != NO_BOX)
|
||||||
{
|
{
|
||||||
if (g_Level.Boxes[floor->box].height == height && (g_Level.Boxes[floor->box].flags & BLOCKABLE) && (g_Level.Boxes[floor->box].flags & BLOCKED))
|
if (g_Level.Boxes[floor->box].height == height && (g_Level.Boxes[floor->box].flags & BLOCKABLE) && (g_Level.Boxes[floor->box].flags & BLOCKED))
|
||||||
ClearMovableBlockSplitters(x, y, z + 1024, roomNumber);
|
ClearMovableBlockSplitters(x, y, z + SECTOR(1), roomNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
roomNumber = baseRoomNumber;
|
roomNumber = baseRoomNumber;
|
||||||
floor = GetFloor(x, y, z - 1024, &roomNumber);
|
floor = GetFloor(x, y, z - SECTOR(1), &roomNumber);
|
||||||
if (floor->box != NO_BOX)
|
if (floor->box != NO_BOX)
|
||||||
{
|
{
|
||||||
if (g_Level.Boxes[floor->box].height == height && (g_Level.Boxes[floor->box].flags & BLOCKABLE) && (g_Level.Boxes[floor->box].flags & BLOCKED))
|
if (g_Level.Boxes[floor->box].height == height && (g_Level.Boxes[floor->box].flags & BLOCKABLE) && (g_Level.Boxes[floor->box].flags & BLOCKED))
|
||||||
ClearMovableBlockSplitters(x, y, z - 1024, roomNumber);
|
ClearMovableBlockSplitters(x, y, z - SECTOR(1), roomNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ void InitialisePushableBlock(short itemNum)
|
||||||
ClearMovableBlockSplitters(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber);
|
ClearMovableBlockSplitters(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber);
|
||||||
|
|
||||||
if (item->triggerFlags > 64 && item->status != ITEM_INVISIBLE)
|
if (item->triggerFlags > 64 && item->status != ITEM_INVISIBLE)
|
||||||
AlterFloorHeight(item, -(item->triggerFlags - 64) * 256);
|
AlterFloorHeight(item, -(item->triggerFlags - 64) * CLICK(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PushableBlockControl(short itemNumber)
|
void PushableBlockControl(short itemNumber)
|
||||||
|
@ -119,27 +119,27 @@ void PushableBlockControl(short itemNumber)
|
||||||
|
|
||||||
switch (quadrant)
|
switch (quadrant)
|
||||||
{
|
{
|
||||||
case 0:
|
case NORTH:
|
||||||
z = pos.z + item->itemFlags[2] - LaraItem->itemFlags[2];
|
z = pos.z + item->itemFlags[2] - LaraItem->itemFlags[2];
|
||||||
if (abs(item->pos.zPos - z) < 512 && item->pos.zPos < z)
|
if (abs(item->pos.zPos - z) < SECTOR(1) / 2 && item->pos.zPos < z)
|
||||||
item->pos.zPos = z;
|
item->pos.zPos = z;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case EAST:
|
||||||
x = pos.x + item->itemFlags[0] - LaraItem->itemFlags[0];
|
x = pos.x + item->itemFlags[0] - LaraItem->itemFlags[0];
|
||||||
if (abs(item->pos.xPos - x) < 512 && item->pos.xPos < x)
|
if (abs(item->pos.xPos - x) < SECTOR(1) / 2 && item->pos.xPos < x)
|
||||||
item->pos.xPos = x;
|
item->pos.xPos = x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case SOUTH:
|
||||||
z = pos.z + item->itemFlags[2] - LaraItem->itemFlags[2];
|
z = pos.z + item->itemFlags[2] - LaraItem->itemFlags[2];
|
||||||
if (abs(item->pos.zPos - z) < 512 && item->pos.zPos > z)
|
if (abs(item->pos.zPos - z) < SECTOR(1) / 2 && item->pos.zPos > z)
|
||||||
item->pos.zPos = z;
|
item->pos.zPos = z;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case WEST:
|
||||||
x = pos.x + item->itemFlags[0] - LaraItem->itemFlags[0];
|
x = pos.x + item->itemFlags[0] - LaraItem->itemFlags[0];
|
||||||
if (abs(item->pos.xPos - x) < 512 && item->pos.xPos > x)
|
if (abs(item->pos.xPos - x) < SECTOR(1) / 2 && item->pos.xPos > x)
|
||||||
item->pos.xPos = x;
|
item->pos.xPos = x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ void PushableBlockControl(short itemNumber)
|
||||||
{
|
{
|
||||||
if (TrInput & IN_ACTION)
|
if (TrInput & IN_ACTION)
|
||||||
{
|
{
|
||||||
if (!TestBlockPush(item, 1024, quadrant))
|
if (!TestBlockPush(item, CLICK(4), quadrant))
|
||||||
LaraItem->goalAnimState = LS_STOP;
|
LaraItem->goalAnimState = LS_STOP;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -170,13 +170,13 @@ void PushableBlockControl(short itemNumber)
|
||||||
if (DoPushPull)
|
if (DoPushPull)
|
||||||
{
|
{
|
||||||
SoundEffect(SFX_PUSH_BLOCK_END, &item->pos, 2);
|
SoundEffect(SFX_PUSH_BLOCK_END, &item->pos, 2);
|
||||||
DoPushPull = 0;
|
DoPushPull = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SoundEffect(SFX_PUSHABLE_SOUND, &item->pos, 2);
|
SoundEffect(SFX_PUSHABLE_SOUND, &item->pos, 2);
|
||||||
DoPushPull = 1;
|
DoPushPull = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LM_LHAND);
|
GetLaraJointPosition(&pos, LM_LHAND);
|
||||||
|
@ -185,25 +185,25 @@ void PushableBlockControl(short itemNumber)
|
||||||
{
|
{
|
||||||
case NORTH:
|
case NORTH:
|
||||||
z = pos.z + item->itemFlags[2] - LaraItem->itemFlags[2];
|
z = pos.z + item->itemFlags[2] - LaraItem->itemFlags[2];
|
||||||
if (abs(item->pos.zPos - z) < 512 && item->pos.zPos > z)
|
if (abs(item->pos.zPos - z) < SECTOR(1) / 2 && item->pos.zPos > z)
|
||||||
item->pos.zPos = z;
|
item->pos.zPos = z;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EAST:
|
case EAST:
|
||||||
x = pos.x + item->itemFlags[0] - LaraItem->itemFlags[0];
|
x = pos.x + item->itemFlags[0] - LaraItem->itemFlags[0];
|
||||||
if (abs(item->pos.xPos - x) < 512 && item->pos.xPos > x)
|
if (abs(item->pos.xPos - x) < SECTOR(1) / 2 && item->pos.xPos > x)
|
||||||
item->pos.xPos = x;
|
item->pos.xPos = x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
z = pos.z + item->itemFlags[2] - LaraItem->itemFlags[2];
|
z = pos.z + item->itemFlags[2] - LaraItem->itemFlags[2];
|
||||||
if (abs(item->pos.zPos - z) < 512 && item->pos.zPos < z)
|
if (abs(item->pos.zPos - z) < SECTOR(1) / 2 && item->pos.zPos < z)
|
||||||
item->pos.zPos = z;
|
item->pos.zPos = z;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEST:
|
case WEST:
|
||||||
x = pos.x + item->itemFlags[0] - LaraItem->itemFlags[0];
|
x = pos.x + item->itemFlags[0] - LaraItem->itemFlags[0];
|
||||||
if (abs(item->pos.xPos - x) < 512 && item->pos.xPos < x)
|
if (abs(item->pos.xPos - x) < SECTOR(1) / 2 && item->pos.xPos < x)
|
||||||
item->pos.xPos = x;
|
item->pos.xPos = x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ void PushableBlockControl(short itemNumber)
|
||||||
{
|
{
|
||||||
if (TrInput & IN_ACTION)
|
if (TrInput & IN_ACTION)
|
||||||
{
|
{
|
||||||
if (!TestBlockPull(item, 1024, quadrant))
|
if (!TestBlockPull(item, CLICK(4), quadrant))
|
||||||
LaraItem->goalAnimState = LS_STOP;
|
LaraItem->goalAnimState = LS_STOP;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -237,13 +237,13 @@ void PushableBlockControl(short itemNumber)
|
||||||
{
|
{
|
||||||
if (item->triggerFlags > 64)
|
if (item->triggerFlags > 64)
|
||||||
{
|
{
|
||||||
AlterFloorHeight(item, -(item->triggerFlags - 64) * 256);
|
AlterFloorHeight(item, -(item->triggerFlags - 64) * CLICK(1));
|
||||||
AdjustStopperFlag(item, item->itemFlags[7] + 0x8000, 0);
|
AdjustStopperFlag(item, item->itemFlags[7] + 0x8000, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
roomNumber = item->roomNumber;
|
roomNumber = item->roomNumber;
|
||||||
floor = GetFloor(item->pos.xPos, item->pos.yPos - 256, item->pos.zPos, &roomNumber);
|
floor = GetFloor(item->pos.xPos, item->pos.yPos - CLICK(1), item->pos.zPos, &roomNumber);
|
||||||
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos - 256, item->pos.zPos);
|
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos - CLICK(1), item->pos.zPos);
|
||||||
TestTriggers(TriggerIndex, 1, item->flags & 0x3E00);
|
TestTriggers(TriggerIndex, 1, item->flags & 0x3E00);
|
||||||
RemoveActiveItem(itemNumber);
|
RemoveActiveItem(itemNumber);
|
||||||
item->status = ITEM_NOT_ACTIVE;
|
item->status = ITEM_NOT_ACTIVE;
|
||||||
|
@ -275,10 +275,10 @@ void PushableBlockCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
ITEM_INFO* item = &g_Level.Items[itemNum];
|
ITEM_INFO* item = &g_Level.Items[itemNum];
|
||||||
|
|
||||||
short roomNumber = item->roomNumber;
|
short roomNumber = item->roomNumber;
|
||||||
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos - 256, item->pos.zPos, &roomNumber);
|
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos - CLICK(1), item->pos.zPos, &roomNumber);
|
||||||
if (item->triggerFlags < 64)
|
if (item->triggerFlags < 64)
|
||||||
{
|
{
|
||||||
item->pos.yPos = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos - 256, item->pos.zPos);
|
item->pos.yPos = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos - CLICK(1), item->pos.zPos);
|
||||||
if (item->roomNumber != roomNumber)
|
if (item->roomNumber != roomNumber)
|
||||||
ItemNewRoom(itemNum, roomNumber);
|
ItemNewRoom(itemNum, roomNumber);
|
||||||
}
|
}
|
||||||
|
@ -305,13 +305,13 @@ void PushableBlockCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
|
|
||||||
if (TrInput & IN_FORWARD)
|
if (TrInput & IN_FORWARD)
|
||||||
{
|
{
|
||||||
if (!TestBlockPush(item, 1024, quadrant))
|
if (!TestBlockPush(item, CLICK(4), quadrant))
|
||||||
return;
|
return;
|
||||||
l->goalAnimState = LS_PUSHABLE_PUSH;
|
l->goalAnimState = LS_PUSHABLE_PUSH;
|
||||||
}
|
}
|
||||||
else if (TrInput & IN_BACK)
|
else if (TrInput & IN_BACK)
|
||||||
{
|
{
|
||||||
if (!TestBlockPull(item, 1024, quadrant))
|
if (!TestBlockPull(item, CLICK(4), quadrant))
|
||||||
return;
|
return;
|
||||||
l->goalAnimState = LS_PUSHABLE_PULL;
|
l->goalAnimState = LS_PUSHABLE_PULL;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ void PushableBlockCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
short roomNumber = l->roomNumber;
|
short roomNumber = l->roomNumber;
|
||||||
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos - 256, item->pos.zPos, &roomNumber);
|
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos - CLICK(1), item->pos.zPos, &roomNumber);
|
||||||
if (roomNumber == item->roomNumber)
|
if (roomNumber == item->roomNumber)
|
||||||
{
|
{
|
||||||
//if (item->triggerFlags < 64)
|
//if (item->triggerFlags < 64)
|
||||||
|
@ -439,20 +439,19 @@ void PushableBlockCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestBlockMovable(ITEM_INFO * item, int blokhite)
|
bool TestBlockMovable(ITEM_INFO* item, int blockHeight)
|
||||||
{
|
{
|
||||||
short roomNumber = item->roomNumber;
|
short roomNum = item->roomNumber;
|
||||||
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNum);
|
||||||
if (floor->floor == NO_HEIGHT / 256)
|
if (floor->floor == NO_HEIGHT / CLICK(1))
|
||||||
return 1;
|
return true;
|
||||||
|
else if (floor->floor * CLICK(1) != item->pos.yPos - blockHeight)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (floor->floor * 256 != item->pos.yPos - blokhite)
|
return true;
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestBlockPush(ITEM_INFO * item, int blockhite, unsigned short quadrant)
|
bool TestBlockPush(ITEM_INFO* item, int blockHeight, unsigned short quadrant)
|
||||||
{
|
{
|
||||||
//if (!TestBlockMovable(item, blokhite))
|
//if (!TestBlockMovable(item, blokhite))
|
||||||
// return 0;
|
// return 0;
|
||||||
|
@ -465,38 +464,38 @@ int TestBlockPush(ITEM_INFO * item, int blockhite, unsigned short quadrant)
|
||||||
switch (quadrant)
|
switch (quadrant)
|
||||||
{
|
{
|
||||||
case NORTH:
|
case NORTH:
|
||||||
z += 1024;
|
z += SECTOR(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EAST:
|
case EAST:
|
||||||
x += 1024;
|
x += SECTOR(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
z -= 1024;
|
z -= SECTOR(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEST:
|
case WEST:
|
||||||
x -= 1024;
|
x -= SECTOR(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNum);
|
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNum);
|
||||||
ROOM_INFO* r = &g_Level.Rooms[roomNum];
|
ROOM_INFO* r = &g_Level.Rooms[roomNum];
|
||||||
if (XZ_GET_SECTOR(r, x - r->x, z - r->z).stopper)
|
if (XZ_GET_SECTOR(r, x - r->x, z - r->z).stopper)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (GetFloorHeight(floor, x, y - 256, z) != y)
|
if (GetFloorHeight(floor, x, y - CLICK(1), z) != y)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
GetFloorHeight(floor, x, y, z);
|
GetFloorHeight(floor, x, y, z);
|
||||||
if (HeightType)
|
if (HeightType)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
int ceiling = y - blockhite + 100;
|
int ceiling = y - blockHeight + 100;
|
||||||
floor = GetFloor(x, ceiling, z, &roomNum);
|
floor = GetFloor(x, ceiling, z, &roomNum);
|
||||||
if (GetCeiling(floor, x, ceiling, z) > ceiling)
|
if (GetCeiling(floor, x, ceiling, z) > ceiling)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
int oldX = item->pos.xPos;
|
int oldX = item->pos.xPos;
|
||||||
int oldZ = item->pos.zPos;
|
int oldZ = item->pos.zPos;
|
||||||
|
@ -511,7 +510,7 @@ int TestBlockPush(ITEM_INFO * item, int blockhite, unsigned short quadrant)
|
||||||
return CollidedItems[0] == NULL;
|
return CollidedItems[0] == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestBlockPull(ITEM_INFO * item, int blockhite, short quadrant)
|
bool TestBlockPull(ITEM_INFO * item, int blockHeight, short quadrant)
|
||||||
{
|
{
|
||||||
//if (!TestBlockMovable(item, blokhite))
|
//if (!TestBlockMovable(item, blokhite))
|
||||||
// return (0);
|
// return (0);
|
||||||
|
@ -522,19 +521,19 @@ int TestBlockPull(ITEM_INFO * item, int blockhite, short quadrant)
|
||||||
switch (quadrant)
|
switch (quadrant)
|
||||||
{
|
{
|
||||||
case NORTH:
|
case NORTH:
|
||||||
zadd = -1024;
|
zadd = -SECTOR(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EAST:
|
case EAST:
|
||||||
xadd = -1024;
|
xadd = -SECTOR(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
zadd = 1024;
|
zadd = SECTOR(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEST:
|
case WEST:
|
||||||
xadd = 1024;
|
xadd = SECTOR(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,17 +541,17 @@ int TestBlockPull(ITEM_INFO * item, int blockhite, short quadrant)
|
||||||
int y = item->pos.yPos;
|
int y = item->pos.yPos;
|
||||||
int z = item->pos.zPos + zadd;
|
int z = item->pos.zPos + zadd;
|
||||||
short roomNum = item->roomNumber;
|
short roomNum = item->roomNumber;
|
||||||
FLOOR_INFO* floor = GetFloor(x, y - 256, z, &roomNum);
|
FLOOR_INFO* floor = GetFloor(x, y - CLICK(1), z, &roomNum);
|
||||||
|
|
||||||
ROOM_INFO* r = &g_Level.Rooms[roomNum];
|
ROOM_INFO* r = &g_Level.Rooms[roomNum];
|
||||||
if (XZ_GET_SECTOR(r, x - r->x, z - r->z).stopper)
|
if (XZ_GET_SECTOR(r, x - r->x, z - r->z).stopper)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (GetFloorHeight(floor, x, y - 256, z) != y)
|
if (GetFloorHeight(floor, x, y - CLICK(1), z) != y)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (GetFloor(x, y - blockhite, z, &quadrant)->ceiling * 256 > y - blockhite)
|
if (GetFloor(x, y - blockHeight, z, &quadrant)->ceiling * CLICK(1) > y - blockHeight)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
int oldX = item->pos.xPos;
|
int oldX = item->pos.xPos;
|
||||||
int oldZ = item->pos.zPos;
|
int oldZ = item->pos.zPos;
|
||||||
|
@ -563,18 +562,18 @@ int TestBlockPull(ITEM_INFO * item, int blockhite, short quadrant)
|
||||||
item->pos.zPos = oldZ;
|
item->pos.zPos = oldZ;
|
||||||
|
|
||||||
if (CollidedItems[0] != NULL)
|
if (CollidedItems[0] != NULL)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
x += xadd;
|
x += xadd;
|
||||||
z += zadd;
|
z += zadd;
|
||||||
roomNum = item->roomNumber;
|
roomNum = item->roomNumber;
|
||||||
floor = GetFloor(x, y - 256, z, &roomNum);
|
floor = GetFloor(x, y - CLICK(1), z, &roomNum);
|
||||||
|
|
||||||
if (GetFloorHeight(floor, x, y - 256, z) != y)
|
if (GetFloorHeight(floor, x, y - CLICK(1), z) != y)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (GetFloor(x, y - 762, z, &roomNum)->ceiling * 256 > y - 762)
|
if (GetFloor(x, y - 762, z, &roomNum)->ceiling * CLICK(1) > y - 762)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
x = LaraItem->pos.xPos + xadd;
|
x = LaraItem->pos.xPos + xadd;
|
||||||
z = LaraItem->pos.zPos + zadd;
|
z = LaraItem->pos.zPos + zadd;
|
||||||
|
@ -584,7 +583,7 @@ int TestBlockPull(ITEM_INFO * item, int blockhite, short quadrant)
|
||||||
|
|
||||||
r = &g_Level.Rooms[roomNum];
|
r = &g_Level.Rooms[roomNum];
|
||||||
if (XZ_GET_SECTOR(r, x - r->x, z - r->z).stopper)
|
if (XZ_GET_SECTOR(r, x - r->x, z - r->z).stopper)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
oldX = LaraItem->pos.xPos;
|
oldX = LaraItem->pos.xPos;
|
||||||
oldZ = LaraItem->pos.zPos;
|
oldZ = LaraItem->pos.zPos;
|
||||||
|
@ -596,4 +595,3 @@ int TestBlockPull(ITEM_INFO * item, int blockhite, short quadrant)
|
||||||
|
|
||||||
return (CollidedItems[0] == NULL);
|
return (CollidedItems[0] == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,6 @@ void ClearMovableBlockSplitters(int x, int y, int z, short roomNumber);
|
||||||
void InitialisePushableBlock(short itemNum);
|
void InitialisePushableBlock(short itemNum);
|
||||||
void PushableBlockControl(short itemNum);
|
void PushableBlockControl(short itemNum);
|
||||||
void PushableBlockCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll);
|
void PushableBlockCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll);
|
||||||
int TestBlockMovable(ITEM_INFO* item, int blockhite);
|
bool TestBlockMovable(ITEM_INFO* item, int blockHeight);
|
||||||
int TestBlockPush(ITEM_INFO* item, int blockhite, unsigned short quadrant);
|
bool TestBlockPush(ITEM_INFO* item, int blockHeight, unsigned short quadrant);
|
||||||
int TestBlockPull(ITEM_INFO* item, int blockhite, short quadrant);
|
bool TestBlockPull(ITEM_INFO* item, int blocHeight, short quadrant);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue