mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-30 08:47:58 +03:00
Decompiled CHEF
This commit is contained in:
parent
b06111f6b5
commit
db49a19c19
7 changed files with 216 additions and 1 deletions
|
@ -761,6 +761,7 @@ typedef enum GAME_OBJECT_ID
|
|||
ID_GLADIATOR,
|
||||
ID_HITMAN,
|
||||
ID_SNIPER,
|
||||
ID_CHEF,
|
||||
|
||||
/* Soprannatural, boss and others */
|
||||
ID_WINGED_MUMMY = 220,
|
||||
|
|
184
TR5Main/Objects/TR5/tr5_chef.cpp
Normal file
184
TR5Main/Objects/TR5/tr5_chef.cpp
Normal file
|
@ -0,0 +1,184 @@
|
|||
#include "../newobjects.h"
|
||||
#include "../../Game/items.h"
|
||||
#include "../../Game/Box.h"
|
||||
#include "../../Game/sphere.h"
|
||||
#include "../../Game/debris.h"
|
||||
#include "../../Game/effect2.h"
|
||||
#include "../../Game/effects.h"
|
||||
#include "../../Game/tomb4fx.h"
|
||||
#include "../../Game/people.h"
|
||||
|
||||
#define STATE_CHEF_COOKING 1
|
||||
#define STATE_CHEF_TURN_180 2
|
||||
#define STATE_CHEF_ATTACK 3
|
||||
#define STATE_CHEF_AIM 4
|
||||
#define STATE_CHEF_WALK 5
|
||||
|
||||
BITE_INFO ChefBite = { 0, 200, 0 ,13 };
|
||||
|
||||
void InitialiseChef(short itemNumber)
|
||||
{
|
||||
ITEM_INFO* item = &Items[itemNumber];
|
||||
|
||||
ClearItem(itemNumber);
|
||||
|
||||
item->animNumber = Objects[item->objectNumber].animIndex;
|
||||
item->goalAnimState = STATE_CHEF_COOKING;
|
||||
item->currentAnimState = STATE_CHEF_COOKING;
|
||||
item->frameNumber = Anims[item->animNumber].frameBase;
|
||||
item->pos.xPos += 192 * SIN(item->pos.yRot) >> W2V_SHIFT;
|
||||
item->pos.zPos += 192 * COS(item->pos.yRot) >> W2V_SHIFT;
|
||||
}
|
||||
|
||||
void ControlChef(short itemNumber)
|
||||
{
|
||||
if (!CreatureActive(itemNumber))
|
||||
return;
|
||||
|
||||
short joint2 = 0;
|
||||
short joint1 = 0;
|
||||
short joint0 = 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;
|
||||
AI_INFO laraInfo;
|
||||
CreatureAIInfo(item, &info);
|
||||
|
||||
if (creature->enemy == LaraItem)
|
||||
{
|
||||
laraInfo.angle = info.angle;
|
||||
laraInfo.distance = info.distance;
|
||||
}
|
||||
else
|
||||
{
|
||||
int dx = LaraItem->pos.xPos - item->pos.xPos;
|
||||
int dz = LaraItem->pos.zPos - item->pos.zPos;
|
||||
|
||||
laraInfo.angle = ATAN(dz, dx) - item->pos.yRot;
|
||||
laraInfo.ahead = true;
|
||||
if (laraInfo.angle <= -ANGLE(90) || laraInfo.angle >= ANGLE(90))
|
||||
laraInfo.ahead = false;
|
||||
laraInfo.distance = SQUARE(dx) + SQUARE(dz);
|
||||
}
|
||||
|
||||
GetCreatureMood(item, &info, VIOLENT);
|
||||
CreatureMood(item, &info, VIOLENT);
|
||||
|
||||
short angle = CreatureTurn(item, creature->maximumTurn);
|
||||
|
||||
if (info.ahead)
|
||||
{
|
||||
joint0 = info.angle >> 1;
|
||||
joint2 = info.angle >> 1;
|
||||
joint1 = info.xAngle;
|
||||
}
|
||||
|
||||
creature->maximumTurn = 0;
|
||||
|
||||
switch (item->currentAnimState)
|
||||
{
|
||||
case STATE_CHEF_COOKING:
|
||||
if (abs(LaraItem->pos.yPos - item->pos.yPos) < 1024
|
||||
&& info.distance < SQUARE(1536)
|
||||
&& (item->touchBits
|
||||
|| LaraItem->speed > 15
|
||||
|| item->hitStatus
|
||||
|| TargetVisible(item, &laraInfo)))
|
||||
{
|
||||
item->goalAnimState = STATE_CHEF_TURN_180;
|
||||
creature->alerted = true;
|
||||
item->aiBits = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_CHEF_TURN_180:
|
||||
creature->maximumTurn = 0;
|
||||
if (info.angle > 0)
|
||||
item->pos.yRot -= ANGLE(2);
|
||||
else
|
||||
item->pos.yRot += ANGLE(2);
|
||||
if (item->frameNumber == Anims[item->animNumber].frameEnd)
|
||||
item->pos.yRot += -ANGLE(180);
|
||||
break;
|
||||
|
||||
case STATE_CHEF_ATTACK:
|
||||
creature->maximumTurn = 0;
|
||||
if (abs(info.angle) >= ANGLE(2))
|
||||
{
|
||||
if (info.angle > 0)
|
||||
item->pos.yRot += ANGLE(2);
|
||||
else
|
||||
item->pos.yRot -= ANGLE(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
item->pos.yRot += info.angle;
|
||||
}
|
||||
|
||||
if (!creature->flags)
|
||||
{
|
||||
if (item->touchBits & 0x2000)
|
||||
{
|
||||
if (item->frameNumber > Anims[item->animNumber].frameBase + 10)
|
||||
{
|
||||
LaraItem->hitPoints -= 80;
|
||||
LaraItem->hitStatus = true;
|
||||
CreatureEffect2(item, &ChefBite, 20, item->pos.yRot, DoBloodSplat);
|
||||
SoundEffect(SFX_LARA_THUD, &item->pos, 0);
|
||||
creature->flags = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_CHEF_AIM:
|
||||
creature->flags = 0;
|
||||
creature->maximumTurn = 364;
|
||||
if (info.distance >= SQUARE(682))
|
||||
{
|
||||
if (info.angle > 20480 || info.angle < -20480)
|
||||
{
|
||||
item->goalAnimState = STATE_CHEF_TURN_180;
|
||||
}
|
||||
else if (creature->mood == ATTACK_MOOD)
|
||||
{
|
||||
item->goalAnimState = STATE_CHEF_WALK;
|
||||
}
|
||||
}
|
||||
else if (info.bite)
|
||||
{
|
||||
item->goalAnimState = STATE_CHEF_ATTACK;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_CHEF_WALK:
|
||||
creature->maximumTurn = ANGLE(7);
|
||||
if (info.distance < SQUARE(682)
|
||||
|| info.angle > 20480
|
||||
|| info.angle < -20480
|
||||
|| creature->mood != ATTACK_MOOD)
|
||||
item->goalAnimState = STATE_CHEF_AIM;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
CreatureTilt(item, 0);
|
||||
CreatureJoint(item, 0, joint0);
|
||||
CreatureJoint(item, 1, joint1);
|
||||
CreatureJoint(item, 2, joint2);
|
||||
CreatureAnimation(itemNumber, angle, 0);
|
||||
}
|
|
@ -71,7 +71,6 @@ void ControlSubmarine(short itemNumber)
|
|||
tilt = -2048;
|
||||
}
|
||||
|
||||
LABEL_13:
|
||||
item->itemFlags[0] = tilt;
|
||||
|
||||
if (abs(tilt) >= 64)
|
||||
|
|
|
@ -167,3 +167,5 @@ void ControlBodyPart(short fxNumber);
|
|||
void ExplodeFX(FX_INFO* fx, int noXZVel, int bits);
|
||||
void InitialiseLagoonWitch(short itemNumber);
|
||||
void ControlLagoonWitch(short itemNumber);
|
||||
void InitialiseChef(short itemNumber);
|
||||
void ControlChef(short itemNumber);
|
|
@ -1413,6 +1413,31 @@ void BaddyObjects()
|
|||
Bones[obj->boneIndex + 4] |= ROT_X;
|
||||
}
|
||||
|
||||
obj = &Objects[ID_CHEF];
|
||||
if (obj->loaded)
|
||||
{
|
||||
obj->initialise = InitialiseChef;
|
||||
obj->control = ControlChef;
|
||||
obj->collision = CreatureCollision;
|
||||
obj->shadowSize = UNIT_SHADOW / 2;
|
||||
obj->hitPoints = 35;
|
||||
obj->pivotLength = 50;
|
||||
obj->radius = 102;
|
||||
obj->biteOffset = 0;
|
||||
obj->intelligent = true;
|
||||
obj->savePosition = true;
|
||||
obj->saveFlags = true;
|
||||
obj->saveAnim = true;
|
||||
obj->saveHitpoints = true;
|
||||
obj->hitEffect = HIT_BLOOD;
|
||||
obj->zoneType = ZONE_HUMAN_CLASSIC;
|
||||
|
||||
Bones[obj->boneIndex + 24] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 24] |= ROT_X;
|
||||
Bones[obj->boneIndex + 52] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 52] |= ROT_X;
|
||||
}
|
||||
|
||||
obj = &Objects[ID_LION];
|
||||
if (obj->loaded)
|
||||
{
|
||||
|
|
|
@ -235,6 +235,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
|||
<ClCompile Include="Objects\TR3\tr3_sophia.cpp" />
|
||||
<ClCompile Include="Objects\TR5\tr5_autoguns.cpp" />
|
||||
<ClCompile Include="Objects\TR5\tr5_brownbeast.cpp" />
|
||||
<ClCompile Include="Objects\TR5\tr5_chef.cpp" />
|
||||
<ClCompile Include="Objects\TR5\tr5_cybord.cpp" />
|
||||
<ClCompile Include="Objects\TR5\tr5_doberman.cpp" />
|
||||
<ClCompile Include="Objects\TR5\tr5_dog.cpp" />
|
||||
|
|
|
@ -848,6 +848,9 @@
|
|||
<ClCompile Include="Objects\TR5\tr5_lagoon_witch.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Objects\TR5\tr5_chef.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Shaders\Shader.fx" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue