diff --git a/TR5Main/Global/objectslist.h b/TR5Main/Global/objectslist.h
index 09c25326d..425d9d2f0 100644
--- a/TR5Main/Global/objectslist.h
+++ b/TR5Main/Global/objectslist.h
@@ -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,
diff --git a/TR5Main/Objects/TR5/tr5_chef.cpp b/TR5Main/Objects/TR5/tr5_chef.cpp
new file mode 100644
index 000000000..5ac75adb9
--- /dev/null
+++ b/TR5Main/Objects/TR5/tr5_chef.cpp
@@ -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);
+}
\ No newline at end of file
diff --git a/TR5Main/Objects/TR5/tr5_submarine.cpp b/TR5Main/Objects/TR5/tr5_submarine.cpp
index 1c3da28e2..43a0ffa4d 100644
--- a/TR5Main/Objects/TR5/tr5_submarine.cpp
+++ b/TR5Main/Objects/TR5/tr5_submarine.cpp
@@ -71,7 +71,6 @@ void ControlSubmarine(short itemNumber)
tilt = -2048;
}
-LABEL_13:
item->itemFlags[0] = tilt;
if (abs(tilt) >= 64)
diff --git a/TR5Main/Objects/oldobjects.h b/TR5Main/Objects/oldobjects.h
index 731f63057..414c61eda 100644
--- a/TR5Main/Objects/oldobjects.h
+++ b/TR5Main/Objects/oldobjects.h
@@ -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);
\ No newline at end of file
diff --git a/TR5Main/Specific/setup.cpp b/TR5Main/Specific/setup.cpp
index cfa115f51..758d82b98 100644
--- a/TR5Main/Specific/setup.cpp
+++ b/TR5Main/Specific/setup.cpp
@@ -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)
{
diff --git a/TR5Main/TR5Main.vcxproj b/TR5Main/TR5Main.vcxproj
index 7d05b0382..1e14217a8 100644
--- a/TR5Main/TR5Main.vcxproj
+++ b/TR5Main/TR5Main.vcxproj
@@ -235,6 +235,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"
+
diff --git a/TR5Main/TR5Main.vcxproj.filters b/TR5Main/TR5Main.vcxproj.filters
index f1945b7e1..1da795fa2 100644
--- a/TR5Main/TR5Main.vcxproj.filters
+++ b/TR5Main/TR5Main.vcxproj.filters
@@ -848,6 +848,9 @@
File di origine
+
+ File di origine
+