mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Add ExplodeItemNode() and TriggerActive()
This commit is contained in:
parent
3204a9ce1a
commit
90d71fa5ae
2 changed files with 65 additions and 2 deletions
|
@ -3536,6 +3536,69 @@ void RefreshCamera(short type, short* data)
|
|||
Camera.timer = -1;
|
||||
}
|
||||
|
||||
int ExplodeItemNode(ITEM_INFO* item, int Node, int NoXZVel, int bits)
|
||||
{
|
||||
short Num;
|
||||
|
||||
if (1 << Node & item->meshBits)
|
||||
{
|
||||
Num = bits;
|
||||
if (item->objectNumber == ID_SHOOT_SWITCH1 && (CurrentLevel == 4 || CurrentLevel == 7))
|
||||
{
|
||||
SoundEffect(SFX_SMASH_METAL, &item->pos, 0);
|
||||
}
|
||||
else if (Num == 256)
|
||||
{
|
||||
Num = -64;
|
||||
}
|
||||
GetSpheres(item, SphereList, 3);
|
||||
ShatterItem.yRot = item->pos.yRot;
|
||||
ShatterItem.bit = 1 << Node;
|
||||
ShatterItem.meshp = Meshes[Objects[item->objectNumber].meshIndex + 2 * Node];
|
||||
ShatterItem.sphere.x = SphereList[Node].x;
|
||||
ShatterItem.sphere.y = SphereList[Node].y;
|
||||
ShatterItem.sphere.z = SphereList[Node].z;
|
||||
ShatterItem.il = (ITEM_LIGHT *) &item->legacyLightData;
|
||||
ShatterItem.flags = item->objectNumber == ID_CROSSBOW_BOLT ? 0x400 : 0;
|
||||
ShatterObject(&ShatterItem, 0, Num, item->roomNumber, NoXZVel);
|
||||
item->meshBits &= ~ShatterItem.bit;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TriggerActive(ITEM_INFO* item)
|
||||
{
|
||||
int flag;
|
||||
|
||||
flag = item->flags & IFLAG_REVERSE ? 0 : 1;
|
||||
if ((item->flags & IFLAG_ACTIVATION_MASK) != IFLAG_ACTIVATION_MASK)
|
||||
{
|
||||
flag = !flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->timer)
|
||||
{
|
||||
if (item->timer > 0)
|
||||
{
|
||||
--item->timer;
|
||||
if (!item->timer)
|
||||
item->timer = -1;
|
||||
}
|
||||
else if (item->timer < -1)
|
||||
{
|
||||
++item->timer;
|
||||
if (item->timer == -1)
|
||||
item->timer = 0;
|
||||
}
|
||||
if (item->timer <= -1)
|
||||
flag = !flag;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
void Inject_Control()
|
||||
{
|
||||
INJECT(0x00416760, TestTriggers);
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
#include "..\Global\global.h"
|
||||
|
||||
#define GetWaterHeight ((int (__cdecl*)(int, int, int, short)) 0x00415DA0)
|
||||
#define TriggerActive ((int (__cdecl*)(ITEM_INFO*)) 0x004175B0)
|
||||
#define UpdateSpiders ((void (__cdecl*)()) 0x0047A340)
|
||||
#define UpdateLightning ((void (__cdecl*)()) 0x00484CB0)
|
||||
#define UpdatePulseColor ((void (__cdecl*)()) 0x00480830)
|
||||
#define ExplodeItemNode ((int (__cdecl*)(ITEM_INFO*, int, int, int)) 0x0041ABF0)
|
||||
#define DoRayBox_sub_401523 ((int (__cdecl*)(PHD_VECTOR*, PHD_VECTOR*, PHD_VECTOR*, PHD_VECTOR*, PHD_VECTOR*)) 0x00401523)
|
||||
|
||||
#define TRIG_BITS(T) ((T & 0x3fff) >> 10)
|
||||
|
@ -55,6 +53,8 @@ void RemoveRoomFlipItems(ROOM_INFO* r);
|
|||
void PlaySoundTrack(short track, short flags);
|
||||
void RumbleScreen();
|
||||
void RefreshCamera(short type, short* data);
|
||||
int ExplodeItemNode(ITEM_INFO* item, int Node, int NoXZVel, int bits);
|
||||
int TriggerActive(ITEM_INFO* item);
|
||||
|
||||
unsigned __stdcall GameMain(void*);
|
||||
void Inject_Control();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue