mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-01 17:28:00 +03:00
Decompiled ID_BATS; Renamed submarine functions;
This commit is contained in:
parent
1d284ba9d0
commit
abfa7ae4ac
9 changed files with 146 additions and 19 deletions
|
@ -30,6 +30,7 @@
|
||||||
#include "sphere.h"
|
#include "sphere.h"
|
||||||
#include "debris.h"
|
#include "debris.h"
|
||||||
#include "larafire.h"
|
#include "larafire.h"
|
||||||
|
#include "..\Objects\oldobjects.h"
|
||||||
|
|
||||||
#include "footprint.h"
|
#include "footprint.h"
|
||||||
#include "..\Specific\roomload.h"
|
#include "..\Specific\roomload.h"
|
||||||
|
@ -1740,7 +1741,7 @@ void UpdateBats()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
short* bounds = GetBoundsAccurate(LaraItem);
|
short* bounds = GetBoundsAccurate(LaraItem);
|
||||||
|
|
||||||
int x1 = LaraItem->pos.xPos + bounds[0] - (bounds[0] >> 2);
|
int x1 = LaraItem->pos.xPos + bounds[0] - (bounds[0] >> 2);
|
||||||
int x2 = LaraItem->pos.xPos + bounds[1] - (bounds[1] >> 2);
|
int x2 = LaraItem->pos.xPos + bounds[1] - (bounds[1] >> 2);
|
||||||
|
|
||||||
|
@ -1749,19 +1750,19 @@ void UpdateBats()
|
||||||
|
|
||||||
int z1 = LaraItem->pos.zPos + bounds[4] - (bounds[4] >> 2);
|
int z1 = LaraItem->pos.zPos + bounds[4] - (bounds[4] >> 2);
|
||||||
int z2 = LaraItem->pos.zPos + bounds[5] - (bounds[5] >> 2);
|
int z2 = LaraItem->pos.zPos + bounds[5] - (bounds[5] >> 2);
|
||||||
|
|
||||||
int minDistance = 0xFFFFFFF; // v40
|
int minDistance = 0xFFFFFFF; // v40
|
||||||
int minIndex = -1;
|
int minIndex = -1;
|
||||||
|
|
||||||
for (int i=0;i<64;i++)
|
for (int i = 0; i < NUM_BATS; i++)
|
||||||
{
|
{
|
||||||
BAT_STRUCT* bat = &Bats[i];
|
BAT_STRUCT* bat = &Bats[i];
|
||||||
|
|
||||||
if (!bat->on)
|
if (!bat->on)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((Lara.burn || LaraItem->hitPoints <= 0)
|
if ((Lara.burn || LaraItem->hitPoints <= 0)
|
||||||
&& bat->counter > 90
|
&& bat->counter > 90
|
||||||
&& !(GetRandomControl() & 7))
|
&& !(GetRandomControl() & 7))
|
||||||
bat->counter = 90;
|
bat->counter = 90;
|
||||||
|
|
||||||
|
@ -1811,7 +1812,7 @@ void UpdateBats()
|
||||||
if (bat->counter > 90)
|
if (bat->counter > 90)
|
||||||
{
|
{
|
||||||
int speed = bat->speed * 128;
|
int speed = bat->speed * 128;
|
||||||
|
|
||||||
short xAngle = abs(angles[1] - bat->pos.yRot) >> 3;
|
short xAngle = abs(angles[1] - bat->pos.yRot) >> 3;
|
||||||
short yAngle = abs(angles[0] - bat->pos.yRot) >> 3;
|
short yAngle = abs(angles[0] - bat->pos.yRot) >> 3;
|
||||||
|
|
||||||
|
@ -1834,7 +1835,7 @@ void UpdateBats()
|
||||||
bat->pos.xPos += sp * SIN(bat->pos.yRot) >> W2V_SHIFT;
|
bat->pos.xPos += sp * SIN(bat->pos.yRot) >> W2V_SHIFT;
|
||||||
bat->pos.yPos += bat->speed * SIN(-bat->pos.xRot) >> W2V_SHIFT;
|
bat->pos.yPos += bat->speed * SIN(-bat->pos.xRot) >> W2V_SHIFT;
|
||||||
bat->pos.zPos += sp * COS(bat->pos.yRot) >> W2V_SHIFT;
|
bat->pos.zPos += sp * COS(bat->pos.yRot) >> W2V_SHIFT;
|
||||||
|
|
||||||
if ((i % 2 == 0)
|
if ((i % 2 == 0)
|
||||||
&& bat->pos.xPos > x1
|
&& bat->pos.xPos > x1
|
||||||
&& bat->pos.xPos < x2
|
&& bat->pos.xPos < x2
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "traps.h"
|
#include "traps.h"
|
||||||
#include "..\Game\laramisc.h"
|
#include "..\Game\laramisc.h"
|
||||||
#include "..\Objects\newobjects.h"
|
#include "..\Objects\newobjects.h"
|
||||||
|
#include "..\Objects\oldobjects.h"
|
||||||
#include "..\Game\sound.h"
|
#include "..\Game\sound.h"
|
||||||
|
|
||||||
FileStream* SaveGame::m_stream;
|
FileStream* SaveGame::m_stream;
|
||||||
|
|
|
@ -212,7 +212,7 @@
|
||||||
#define PhdWidth VAR_U_(0x0055D29C, int)
|
#define PhdWidth VAR_U_(0x0055D29C, int)
|
||||||
#define PhdHeight VAR_U_(0x0055D164, int)
|
#define PhdHeight VAR_U_(0x0055D164, int)
|
||||||
#define PhdPerspective VAR_U_(0x0055D208, int)
|
#define PhdPerspective VAR_U_(0x0055D208, int)
|
||||||
#define Bats VAR_U_(0x00EEEFE8, BAT_STRUCT*)
|
//#define Bats VAR_U_(0x00EEEFE8, BAT_STRUCT*)
|
||||||
#define Rats VAR_U_(0x00EEEFEC, RAT_STRUCT*)
|
#define Rats VAR_U_(0x00EEEFEC, RAT_STRUCT*)
|
||||||
#define Spiders VAR_U_(0x00EEF45C, SPIDER_STRUCT*)
|
#define Spiders VAR_U_(0x00EEF45C, SPIDER_STRUCT*)
|
||||||
#define PoisonFlags VAR_U_(0x00E5BF3E, byte)
|
#define PoisonFlags VAR_U_(0x00E5BF3E, byte)
|
||||||
|
|
111
TR5Main/Objects/TR5/tr5_particle_enemies.cpp
Normal file
111
TR5Main/Objects/TR5/tr5_particle_enemies.cpp
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
#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"
|
||||||
|
|
||||||
|
int NumBats;
|
||||||
|
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].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 GetFreeBat()
|
||||||
|
{
|
||||||
|
short batNumber = NumBats;
|
||||||
|
int index = 0;
|
||||||
|
BAT_STRUCT* bat = &Bats[NumBats];
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
NumBats = (batNumber + 1) & (NUM_BATS - 1);
|
||||||
|
|
||||||
|
return batNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TriggerLittleBat(ITEM_INFO* item)
|
||||||
|
{
|
||||||
|
short batNumber = GetFreeBat();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -157,7 +157,7 @@ LABEL_13:
|
||||||
pos2.z = 90;
|
pos2.z = 90;
|
||||||
GetJointAbsPosition(item, &pos2, 1);
|
GetJointAbsPosition(item, &pos2, 1);
|
||||||
|
|
||||||
TriggerTorpedoSparks(&pos1, &pos2, 0);
|
TriggerTorpedoBubbles(&pos1, &pos2, 0);
|
||||||
|
|
||||||
pos1.x = 200;
|
pos1.x = 200;
|
||||||
pos1.y = 320;
|
pos1.y = 320;
|
||||||
|
@ -169,7 +169,7 @@ LABEL_13:
|
||||||
pos2.z = -100;
|
pos2.z = -100;
|
||||||
GetJointAbsPosition(item, &pos2, 1);
|
GetJointAbsPosition(item, &pos2, 1);
|
||||||
|
|
||||||
TriggerTorpedoSparks(&pos1, &pos2, 0);
|
TriggerTorpedoBubbles(&pos1, &pos2, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -185,7 +185,7 @@ LABEL_13:
|
||||||
pos2.z = 90;
|
pos2.z = 90;
|
||||||
GetJointAbsPosition(item, &pos2, 2);
|
GetJointAbsPosition(item, &pos2, 2);
|
||||||
|
|
||||||
TriggerTorpedoSparks(&pos1, &pos2, 0);
|
TriggerTorpedoBubbles(&pos1, &pos2, 0);
|
||||||
|
|
||||||
pos1.x = -200;
|
pos1.x = -200;
|
||||||
pos1.y = 320;
|
pos1.y = 320;
|
||||||
|
@ -197,7 +197,7 @@ LABEL_13:
|
||||||
pos2.z = -100;
|
pos2.z = -100;
|
||||||
GetJointAbsPosition(item, &pos2, 2);
|
GetJointAbsPosition(item, &pos2, 2);
|
||||||
|
|
||||||
TriggerTorpedoSparks(&pos1, &pos2, 0);
|
TriggerTorpedoBubbles(&pos1, &pos2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TriggerSubmarineSparks(itemNumber);
|
TriggerSubmarineSparks(itemNumber);
|
||||||
|
@ -242,7 +242,7 @@ LABEL_13:
|
||||||
CreatureUnderwater(item, -14080);
|
CreatureUnderwater(item, -14080);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerTorpedoSparks(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char factor)
|
void TriggerTorpedoBubbles(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char factor)
|
||||||
{
|
{
|
||||||
SPARKS* spark = &Sparks[GetFreeSpark()];
|
SPARKS* spark = &Sparks[GetFreeSpark()];
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ void ChaffFlareControl(short itemNumber)
|
||||||
pos2.z = 8 * ((GlobalCounter & 1) != 0 ? 48 : -48);
|
pos2.z = 8 * ((GlobalCounter & 1) != 0 ? 48 : -48);
|
||||||
GetJointAbsPosition(item, &pos2, 0);
|
GetJointAbsPosition(item, &pos2, 0);
|
||||||
|
|
||||||
TriggerTorpedoSparks(&pos1, &pos2, 1);
|
TriggerTorpedoBubbles(&pos1, &pos2, 1);
|
||||||
|
|
||||||
if (item->itemFlags[0] >= 300)
|
if (item->itemFlags[0] >= 300)
|
||||||
{
|
{
|
||||||
|
@ -611,7 +611,7 @@ void TorpedoControl(short itemNumber)
|
||||||
pos2.z = -64 << ((GlobalCounter & 1) + 2);
|
pos2.z = -64 << ((GlobalCounter & 1) + 2);
|
||||||
GetJointAbsPosition(item, &pos2, 0);
|
GetJointAbsPosition(item, &pos2, 0);
|
||||||
|
|
||||||
TriggerTorpedoSparks(&pos1, &pos2, 1);
|
TriggerTorpedoBubbles(&pos1, &pos2, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
#define InitialiseLagoonWitch ((void (__cdecl*)(short)) 0x0047D2D0) // not used anymore !
|
#define InitialiseLagoonWitch ((void (__cdecl*)(short)) 0x0047D2D0) // not used anymore !
|
||||||
#define ControlLagoonWitch ((void (__cdecl*)(short)) 0x0047D360) // not used anymore !
|
#define ControlLagoonWitch ((void (__cdecl*)(short)) 0x0047D360) // not used anymore !
|
||||||
//#define ControlInvisibleGhost ((void (__cdecl*)(short)) 0x00477AB0)
|
//#define ControlInvisibleGhost ((void (__cdecl*)(short)) 0x00477AB0)
|
||||||
#define InitialiseLittleBats ((void (__cdecl*)(short)) 0x00407EC0)
|
//#define InitialiseLittleBats ((void (__cdecl*)(short)) 0x00407EC0)
|
||||||
#define ControlLittleBats ((void (__cdecl*)(short)) 0x00407F50)
|
//#define ControlLittleBats ((void (__cdecl*)(short)) 0x00407F50)
|
||||||
#define InitialiseSpiders ((void (__cdecl*)(short)) 0x0043F2B0)
|
#define InitialiseSpiders ((void (__cdecl*)(short)) 0x0043F2B0)
|
||||||
#define ControlSpiders ((void (__cdecl*)(short)) 0x0047A200)
|
#define ControlSpiders ((void (__cdecl*)(short)) 0x0047A200)
|
||||||
//#define ControlGladiator ((void (__cdecl*)(short)) 0x00436700)
|
//#define ControlGladiator ((void (__cdecl*)(short)) 0x00436700)
|
||||||
|
@ -30,6 +30,9 @@
|
||||||
|
|
||||||
//#define InitialiseRomanStatue ((void (__cdecl*)(short)) 0x0046BB00) // need to check a dword_ variable before decompiling
|
//#define InitialiseRomanStatue ((void (__cdecl*)(short)) 0x0046BB00) // need to check a dword_ variable before decompiling
|
||||||
|
|
||||||
|
extern int NumBats;
|
||||||
|
extern BAT_STRUCT* Bats;
|
||||||
|
|
||||||
void InitialiseGuard(short itemNum);
|
void InitialiseGuard(short itemNum);
|
||||||
void InitialiseGuardM16(short itemNum);
|
void InitialiseGuardM16(short itemNum);
|
||||||
void InitialiseGuardLaser(short itemNum);
|
void InitialiseGuardLaser(short itemNum);
|
||||||
|
@ -119,9 +122,13 @@ void DeathSlideCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll);
|
||||||
void ControlDeathSlide(short itemNumber);
|
void ControlDeathSlide(short itemNumber);
|
||||||
void InitialiseDeathSlide(short itemNumber);
|
void InitialiseDeathSlide(short itemNumber);
|
||||||
void ControlSubmarine(short itemNumber);
|
void ControlSubmarine(short itemNumber);
|
||||||
void TriggerTorpedoSparks(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char factor);
|
void TriggerTorpedoBubbles(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char factor);
|
||||||
void TriggerSubmarineSparks(short itemNumber);
|
void TriggerSubmarineSparks(short itemNumber);
|
||||||
void SubmarineAttack(ITEM_INFO* item);
|
void SubmarineAttack(ITEM_INFO* item);
|
||||||
void TriggerTorpedoSparks2(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char scale);
|
void TriggerTorpedoSparks2(PHD_VECTOR* pos1, PHD_VECTOR* pos2, char scale);
|
||||||
void ChaffFlareControl(short itemNumber);
|
void ChaffFlareControl(short itemNumber);
|
||||||
void TorpedoControl(short itemNumber);
|
void TorpedoControl(short itemNumber);
|
||||||
|
void InitialiseLittleBats(short itemNumber);
|
||||||
|
void ControlLittleBats(short itemNumber);
|
||||||
|
short GetFreeBat();
|
||||||
|
void TriggerLittleBat(ITEM_INFO* item);
|
|
@ -12,10 +12,13 @@
|
||||||
#include "../Game/rope.h"
|
#include "../Game/rope.h"
|
||||||
#include "../Game/tomb4fx.h"
|
#include "../Game/tomb4fx.h"
|
||||||
#include "../Game/door.h"
|
#include "../Game/door.h"
|
||||||
|
#include "../Objects/oldobjects.h"
|
||||||
|
|
||||||
extern GUNSHELL_STRUCT Gunshells[MAX_GUNSHELL];
|
extern GUNSHELL_STRUCT Gunshells[MAX_GUNSHELL];
|
||||||
extern RendererHUDBar* g_DashBar;
|
extern RendererHUDBar* g_DashBar;
|
||||||
extern RendererHUDBar* g_SFXVolumeBar;
|
extern RendererHUDBar* g_SFXVolumeBar;
|
||||||
extern RendererHUDBar* g_MusicVolumeBar;
|
extern RendererHUDBar* g_MusicVolumeBar;
|
||||||
|
|
||||||
int Renderer11::DrawPickup(short objectNum)
|
int Renderer11::DrawPickup(short objectNum)
|
||||||
{
|
{
|
||||||
drawObjectOn2DPosition(700 + PickupX, 450, objectNum, 0, m_pickupRotation, 0); // TODO: + PickupY
|
drawObjectOn2DPosition(700 + PickupX, 450, objectNum, 0, m_pickupRotation, 0); // TODO: + PickupY
|
||||||
|
|
|
@ -248,6 +248,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
||||||
<ClCompile Include="Objects\TR5\tr5_misc_objects.cpp" />
|
<ClCompile Include="Objects\TR5\tr5_misc_objects.cpp" />
|
||||||
<ClCompile Include="Objects\TR5\tr5_missile.cpp" />
|
<ClCompile Include="Objects\TR5\tr5_missile.cpp" />
|
||||||
<ClCompile Include="Objects\TR5\tr5_moving_block.cpp" />
|
<ClCompile Include="Objects\TR5\tr5_moving_block.cpp" />
|
||||||
|
<ClCompile Include="Objects\TR5\tr5_particle_enemies.cpp" />
|
||||||
<ClCompile Include="Objects\TR5\tr5_rats.cpp" />
|
<ClCompile Include="Objects\TR5\tr5_rats.cpp" />
|
||||||
<ClCompile Include="Objects\TR5\tr5_reaper.cpp" />
|
<ClCompile Include="Objects\TR5\tr5_reaper.cpp" />
|
||||||
<ClCompile Include="Objects\TR5\tr5_romanstatue.cpp" />
|
<ClCompile Include="Objects\TR5\tr5_romanstatue.cpp" />
|
||||||
|
|
|
@ -842,6 +842,9 @@
|
||||||
<ClCompile Include="Objects\TR5\tr5_missile.cpp">
|
<ClCompile Include="Objects\TR5\tr5_missile.cpp">
|
||||||
<Filter>File di origine</Filter>
|
<Filter>File di origine</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Objects\TR5\tr5_particle_enemies.cpp">
|
||||||
|
<Filter>File di origine</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Shaders\Shader.fx" />
|
<None Include="Shaders\Shader.fx" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue