mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-02 17:57:59 +03:00

* Starting Reformat the project
- New Import Method, no more "../../" in import,
- New Entity Folder Structure, less compile time
* Refactoring the Project
- added precompiled header with default import like microsoft or directx.
- fix many double import.
- fix math.h confliting math.h from
microsoft.
- fix effects.h confliting Effects.h from DirectX.
- refactored TR4 entity folder and how it's loaded.
* Update Some Code Before Switching to Master
* Finished the NewProjectFormat Template
- need to finish entity in the master later.
* Added Monty NewFileFormat
* Fixed Monty NewFileFormat Include
* Revert "Fixed Monty NewFileFormat Include"
This reverts commit ebf0afca10
.
* Trying to fix conflits for NewFileFormat
* Fixed .filters
* Last Commit in NewProjectFormat
117 lines
No EOL
2.4 KiB
C++
117 lines
No EOL
2.4 KiB
C++
#include "framework.h"
|
|
#include "newobjects.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 };
|
|
|
|
void InitialiseInvisibleGhost(short itemNum)
|
|
{
|
|
ITEM_INFO* item;
|
|
|
|
item = &Items[itemNum];
|
|
ClearItem(itemNum);
|
|
item->animNumber = Objects[item->objectNumber].animIndex;
|
|
item->frameNumber = Anims[item->animNumber].frameBase;
|
|
item->goalAnimState = 1;
|
|
item->currentAnimState = 1;
|
|
item->pos.yPos += CLICK(2);
|
|
}
|
|
|
|
void ControlInvisibleGhost(short itemNumber)
|
|
{
|
|
if (CreatureActive(itemNumber))
|
|
{
|
|
short joint0 = 0;
|
|
short joint2 = 0;
|
|
short joint1 = 0;
|
|
short angle = 0;
|
|
|
|
ITEM_INFO* item = &Items[itemNumber];
|
|
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
|
|
|
|
if (item->aiBits)
|
|
{
|
|
GetAITarget(creature);
|
|
}
|
|
else if (creature->hurtByLara)
|
|
{
|
|
creature->enemy = LaraItem;
|
|
}
|
|
|
|
AI_INFO info;
|
|
CreatureAIInfo(item, &info);
|
|
|
|
angle = CreatureTurn(item, creature->maximumTurn);
|
|
if (abs(info.angle) >= ANGLE(3))
|
|
{
|
|
if (info.angle > 0)
|
|
item->pos.yRot += ANGLE(3);
|
|
else
|
|
item->pos.yRot -= ANGLE(3);
|
|
}
|
|
else
|
|
{
|
|
item->pos.yRot += info.angle;
|
|
}
|
|
|
|
if (info.ahead)
|
|
{
|
|
joint0 = info.angle >> 1;
|
|
joint2 = info.angle >> 1;
|
|
joint1 = info.xAngle;
|
|
}
|
|
|
|
creature->maximumTurn = 0;
|
|
|
|
if (item->currentAnimState == 1)
|
|
{
|
|
creature->flags = 0;
|
|
if (info.distance < SQUARE(614))
|
|
{
|
|
if (GetRandomControl() & 1)
|
|
item->goalAnimState = 2;
|
|
else
|
|
item->goalAnimState = 3;
|
|
}
|
|
}
|
|
else if (item->currentAnimState > 1
|
|
&& item->currentAnimState <= 3
|
|
&& !creature->flags
|
|
&& item->touchBits & 0x9470
|
|
&& item->frameNumber > Anims[item->animNumber].frameBase + 18)
|
|
{
|
|
LaraItem->hitPoints -= 400;
|
|
LaraItem->hitStatus = true;
|
|
CreatureEffect2(item, &InvisibleGhostBite, 10, item->pos.yRot, DoBloodSplat);
|
|
creature->flags = 1;
|
|
}
|
|
|
|
CreatureJoint(item, 0, joint0);
|
|
CreatureJoint(item, 1, joint1);
|
|
CreatureJoint(item, 2, joint2);
|
|
|
|
if (info.distance >= SQUARE(1536))
|
|
{
|
|
item->afterDeath = 125;
|
|
item->itemFlags[0] = 0;
|
|
}
|
|
else
|
|
{
|
|
item->afterDeath = sqrt(info.distance) / 16;
|
|
if (item->itemFlags[0] == 0)
|
|
{
|
|
item->itemFlags[0] = 1;
|
|
SoundEffect(SFX_SKELETON_APPEAR, &item->pos, 0);
|
|
}
|
|
}
|
|
|
|
CreatureAnimation(itemNumber, angle, 0);
|
|
}
|
|
} |