mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-12 21:47:03 +03:00
Fixed ID_SETHA; Decompiled ID_BIG_BEETLE;
This commit is contained in:
parent
0ec1712f05
commit
bea6e53c79
7 changed files with 242 additions and 3 deletions
205
TR5Main/Objects/TR4/Entity/tr4_big_beetle.cpp
Normal file
205
TR5Main/Objects/TR4/Entity/tr4_big_beetle.cpp
Normal file
|
@ -0,0 +1,205 @@
|
|||
#include "framework.h"
|
||||
#include "tr4_big_beetle.h"
|
||||
#include "items.h"
|
||||
#include "effect2.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "control.h"
|
||||
#include "trmath.h"
|
||||
#include <lara.h>
|
||||
#include <sound.h>
|
||||
#include <sphere.h>
|
||||
#include <people.h>
|
||||
|
||||
BITE_INFO BitBeetleBite = { 0,0,0,12 };
|
||||
|
||||
void InitialiseBigBeetle(short itemNumber)
|
||||
{
|
||||
ITEM_INFO* item = &g_Level.Items[itemNumber];
|
||||
|
||||
ClearItem(itemNumber);
|
||||
|
||||
item->animNumber = Objects[item->objectNumber].animIndex + 3;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
item->goalAnimState = 1;
|
||||
item->currentAnimState = 1;
|
||||
}
|
||||
|
||||
void BigBeetleControl(short itemNumber)
|
||||
{
|
||||
if (!CreatureActive(itemNumber))
|
||||
return;
|
||||
|
||||
ITEM_INFO* item = &g_Level.Items[itemNumber];
|
||||
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
|
||||
|
||||
short angle = 0;
|
||||
|
||||
if (item->hitPoints <= 0)
|
||||
{
|
||||
if (item->currentAnimState != 6)
|
||||
{
|
||||
if (item->currentAnimState != 7)
|
||||
{
|
||||
if (item->currentAnimState == 8)
|
||||
{
|
||||
item->pos.xRot = 0;
|
||||
item->pos.yPos = item->floor;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->animNumber = Objects[item->objectNumber].animIndex + 5;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
item->gravityStatus = true;
|
||||
item->currentAnimState = 6;
|
||||
item->speed = 0;
|
||||
item->pos.xRot = 0;
|
||||
}
|
||||
}
|
||||
else if (item->pos.yPos >= item->floor)
|
||||
{
|
||||
item->pos.yPos = item->floor;
|
||||
item->gravityStatus = false;
|
||||
item->fallspeed = 0;
|
||||
item->goalAnimState = 8;
|
||||
}
|
||||
}
|
||||
item->pos.xRot = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
AI_INFO info;
|
||||
CreatureAIInfo(item, &info);
|
||||
|
||||
GetCreatureMood(item, &info, VIOLENT);
|
||||
if (creature->flags)
|
||||
creature->mood = ESCAPE_MOOD;
|
||||
CreatureMood(item, &info, VIOLENT);
|
||||
|
||||
angle = CreatureTurn(item, creature->maximumTurn);
|
||||
|
||||
if (info.distance > SQUARE(3072)
|
||||
|| !(GetRandomControl() & 0x7F)
|
||||
|| item->hitStatus)
|
||||
{
|
||||
creature->flags = 0;
|
||||
}
|
||||
|
||||
switch (item->currentAnimState)
|
||||
{
|
||||
case 1:
|
||||
item->pos.yPos = item->floor;
|
||||
creature->maximumTurn = ANGLE(1);
|
||||
|
||||
if (item->hitStatus
|
||||
|| info.distance < SQUARE(3072)
|
||||
|| creature->hurtByLara
|
||||
|| item->aiBits == MODIFY)
|
||||
{
|
||||
item->goalAnimState = 2;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
creature->maximumTurn = ANGLE(7);
|
||||
|
||||
if (item->requiredAnimState)
|
||||
{
|
||||
item->goalAnimState = item->requiredAnimState;
|
||||
}
|
||||
else if (info.ahead)
|
||||
{
|
||||
if (info.distance < SQUARE(256))
|
||||
{
|
||||
item->goalAnimState = 9;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4u:
|
||||
creature->maximumTurn = ANGLE(7);
|
||||
|
||||
if (info.ahead)
|
||||
{
|
||||
if (info.distance < SQUARE(256))
|
||||
{
|
||||
item->goalAnimState = 4;
|
||||
}
|
||||
}
|
||||
else if (info.distance < SQUARE(256))
|
||||
{
|
||||
item->goalAnimState = 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->requiredAnimState = 3;
|
||||
item->goalAnimState = 9;
|
||||
}
|
||||
|
||||
if (!creature->flags)
|
||||
{
|
||||
if (item->touchBits & 0x60)
|
||||
{
|
||||
LaraItem->hitPoints -= 50;
|
||||
LaraItem->hitStatus = true;
|
||||
CreatureEffect2(
|
||||
item,
|
||||
&BitBeetleBite,
|
||||
5,
|
||||
-1,
|
||||
DoBloodSplat);
|
||||
creature->flags = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
creature->flags = 0;
|
||||
|
||||
item->pos.yPos += 51;
|
||||
if (item->pos.yPos > item->floor)
|
||||
item->pos.yPos = item->floor;
|
||||
|
||||
break;
|
||||
|
||||
case 9u:
|
||||
creature->maximumTurn = ANGLE(7);
|
||||
|
||||
if (item->requiredAnimState)
|
||||
{
|
||||
item->goalAnimState = item->requiredAnimState;
|
||||
}
|
||||
else if (!item->hitStatus
|
||||
&& GetRandomControl() >= 384
|
||||
&& item->aiBits != MODIFY
|
||||
&& (creature->mood && GetRandomControl() >= 128
|
||||
|| creature->hurtByLara
|
||||
|| item->aiBits == MODIFY))
|
||||
{
|
||||
if (info.ahead)
|
||||
{
|
||||
if (info.distance < SQUARE(256) && !creature->flags)
|
||||
{
|
||||
item->goalAnimState = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item->goalAnimState = 3;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
CreatureTilt(item, 2 * angle);
|
||||
CreatureAnimation(itemNumber, angle, angle);
|
||||
}
|
4
TR5Main/Objects/TR4/Entity/tr4_big_beetle.h
Normal file
4
TR5Main/Objects/TR4/Entity/tr4_big_beetle.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
void InitialiseBigBeetle(short itemNumber);
|
||||
void BigBeetleControl(short itemNumber);
|
|
@ -1,5 +1,5 @@
|
|||
#include "framework.h"
|
||||
#include "tr4_horseman.h"
|
||||
#include "tr4_setha.h"
|
||||
#include "items.h"
|
||||
#include "effect2.h"
|
||||
#include "setup.h"
|
||||
|
@ -9,7 +9,7 @@
|
|||
#include <lara.h>
|
||||
#include <sound.h>
|
||||
#include <sphere.h>
|
||||
#include <Game\people.h>
|
||||
#include <people.h>
|
||||
|
||||
BITE_INFO SethaBite1 = { 0,220,50,17 };
|
||||
BITE_INFO SethaBite2 = { 0,220,50,13 };
|
||||
|
@ -484,7 +484,7 @@ void TriggerSethaSparks1(int x, int y, int z, short xv, short yv, short zv)
|
|||
}
|
||||
}
|
||||
|
||||
void TriggerSethaSparks2(short itemNumber, byte node, int size)
|
||||
void TriggerSethaSparks2(short itemNumber, char node, int size)
|
||||
{
|
||||
int dx = LaraItem->pos.xPos - g_Level.Items[itemNumber].pos.xPos;
|
||||
int dz = LaraItem->pos.zPos - g_Level.Items[itemNumber].pos.zPos;
|
||||
|
|
|
@ -7,3 +7,4 @@ void SethaControl(short itemNumber);
|
|||
void TriggerSethaSparks1(int x, int y, int z, short xv, short yv, short zv);
|
||||
void TriggerSethaSparks2(short itemNumber, char node, int size);
|
||||
void SethaThrowAttack(PHD_3DPOS* pos, short roomNumber, short mesh);
|
||||
void SethaAttack(int itemNumber);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "tr4_baboon.h" // OK
|
||||
#include "tr4_mutant.h" // OK
|
||||
#include "tr4_locusts.h" // OK
|
||||
#include "tr4_big_beetle.h" // OFF
|
||||
/// objects
|
||||
#include "tr4_sarcophagus.h"
|
||||
/// puzzle
|
||||
|
@ -291,6 +292,26 @@ static void StartBaddy(OBJECT_INFO* obj)
|
|||
g_Level.Bones[obj->boneIndex + 7 * 4] |= ROT_Y;
|
||||
}
|
||||
|
||||
obj = &Objects[ID_BIG_BEETLE];
|
||||
if (obj->loaded)
|
||||
{
|
||||
obj->initialise = InitialiseBigBeetle;
|
||||
obj->control = BigBeetleControl;
|
||||
obj->collision = CreatureCollision;
|
||||
obj->shadowSize = 128;
|
||||
obj->hitPoints = 30;
|
||||
obj->pivotLength = 50;
|
||||
obj->radius = 204;
|
||||
obj->intelligent = true;
|
||||
obj->saveHitpoints = true;
|
||||
obj->saveFlags = true;
|
||||
obj->saveAnim = true;
|
||||
obj->savePosition = true;
|
||||
obj->hitEffect = HIT_BLOOD;
|
||||
obj->undead = true;
|
||||
obj->zoneType = ZONE_FLYER;
|
||||
}
|
||||
|
||||
obj = &Objects[ID_SETHA];
|
||||
if (obj->loaded)
|
||||
{
|
||||
|
|
|
@ -147,6 +147,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
|||
<ClInclude Include="Game\room.h" />
|
||||
<ClInclude Include="Game\smoke.h" />
|
||||
<ClInclude Include="Game\spark.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_big_beetle.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_enemy_jeep.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_setha.h" />
|
||||
<ClInclude Include="Renderer\ConstantBuffers\SpriteBuffer.h" />
|
||||
|
@ -424,6 +425,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
|||
<ClCompile Include="Game\trmath.cpp" />
|
||||
<ClCompile Include="Game\smoke.cpp" />
|
||||
<ClCompile Include="Game\spark.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_big_beetle.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_enemy_jeep.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_setha.cpp" />
|
||||
<ClCompile Include="Renderer\Quad\RenderQuad.cpp">
|
||||
|
|
|
@ -864,6 +864,9 @@
|
|||
<ClInclude Include="Objects\TR4\Entity\tr4_setha.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_big_beetle.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Game\box.cpp">
|
||||
|
@ -1574,6 +1577,9 @@
|
|||
<ClCompile Include="Objects\TR4\Entity\tr4_setha.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_big_beetle.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue