diff --git a/TR5Main/Global/objectslist.h b/TR5Main/Global/objectslist.h index 30f925642..09c25326d 100644 --- a/TR5Main/Global/objectslist.h +++ b/TR5Main/Global/objectslist.h @@ -831,6 +831,7 @@ typedef enum GAME_OBJECT_ID ID_AUTOGUN, ID_ROMAN_GOD1, ID_ROMAN_GOD2, + ID_LAGOON_WITCH, /* Traps / Doors */ ID_SPRINGBOARD = 320, diff --git a/TR5Main/Objects/TR5/tr5_lagoon_witch.cpp b/TR5Main/Objects/TR5/tr5_lagoon_witch.cpp new file mode 100644 index 000000000..b832656e4 --- /dev/null +++ b/TR5Main/Objects/TR5/tr5_lagoon_witch.cpp @@ -0,0 +1,133 @@ +#include "../newobjects.h" +#include "../../Game/items.h" +#include "../../Game/Box.h" +#include "../../Game/effects.h" +#include "../../Game/effect2.h" +#include "../../Game/tomb4fx.h" +#include "../../Game/inventory.h" + +#define STATE_LAGOON_WITCH_SWIM 1 +#define STATE_LAGOON_WITCH_STOP 2 +#define STATE_LAGOON_WITCH_ATTACK 3 + +extern Inventory* g_Inventory; + +BITE_INFO LagoonWitchBite = { 0, 0, 0, 7 }; + +void InitialiseLagoonWitch(short itemNumber) +{ + ITEM_INFO* item = &Items[itemNumber]; + + ClearItem(itemNumber); + + item->animNumber = Objects[item->objectNumber].animIndex + 1; + item->goalAnimState = STATE_LAGOON_WITCH_STOP; + item->currentAnimState = STATE_LAGOON_WITCH_STOP; + item->frameNumber = Anims[item->animNumber].frameBase; + item->pos.yPos += 512; +} + +void ControlLagoonWitch(short itemNumber) +{ + if (!CreatureActive(itemNumber)) + return; + + short joint0 = 0; + short joint1 = 0; + short joint2 = 0; + + ITEM_INFO* item = &Items[itemNumber]; + CREATURE_INFO* creature = (CREATURE_INFO*)item->data; + + if (g_Inventory->IsObjectPresentInInventory(ID_PUZZLE_ITEM2)) + { + item->aiBits = 0; + creature->enemy = LaraItem; + } + + if (item->aiBits) + { + GetAITarget(creature); + } + else if (creature->hurtByLara) + { + creature->enemy = LaraItem; + } + + AI_INFO info; + CreatureAIInfo(item, &info); + + //if (creature->enemy != LaraItem) + // phd_atan(lara_item->pos.z_pos - item->pos.z_pos, lara_item->pos.x_pos - item->pos.x_pos); + + 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_LAGOON_WITCH_SWIM: + creature->maximumTurn = 728; + if (info.distance < SQUARE(1024)) + item->goalAnimState = STATE_LAGOON_WITCH_STOP; + break; + + case STATE_LAGOON_WITCH_STOP: + creature->flags = 0; + creature->maximumTurn = ANGLE(2); + if (info.distance < SQUARE(768)) + item->goalAnimState = STATE_LAGOON_WITCH_ATTACK; + else if (info.distance > SQUARE(1024)) + item->goalAnimState = STATE_LAGOON_WITCH_SWIM; + else + item->goalAnimState = STATE_LAGOON_WITCH_STOP; + break; + + case STATE_LAGOON_WITCH_ATTACK: + creature->maximumTurn = ANGLE(2); + if (!creature->flags + && item->touchBits & 0x3C3C0 + && item->frameNumber > Anims[item->animNumber].frameBase + 29) + { + LaraItem->hitPoints -= 100; + LaraItem->hitStatus = true; + CreatureEffect2(item, &LagoonWitchBite, 10, item->pos.yRot, DoBloodSplat); + creature->flags = STATE_LAGOON_WITCH_SWIM; + } + break; + + } + + if (creature->reachedGoal) + { + ITEM_INFO* enemy = creature->enemy; + if (enemy) + { + if (enemy->flags & 2) + item->itemFlags[3] = (item->TOSSPAD & 0xFF) - 1; + item->itemFlags[3]++; + creature->reachedGoal = false; + creature->enemy = 0; + } + } + + CreatureTilt(item, 0); + + CreatureJoint(item, 0, joint0); + CreatureJoint(item, 1, joint1); + CreatureJoint(item, 2, joint2); + + CreatureAnimation(itemNumber, angle, 0); + + CreatureUnderwater(item, 341); +} \ No newline at end of file diff --git a/TR5Main/Objects/oldobjects.h b/TR5Main/Objects/oldobjects.h index 54d0064e0..731f63057 100644 --- a/TR5Main/Objects/oldobjects.h +++ b/TR5Main/Objects/oldobjects.h @@ -164,4 +164,6 @@ void MissileControl(short itemNumber); void InitialiseGuardian(short itemNumber); void GuardianControl(short itemNumber); void ControlBodyPart(short fxNumber); -void ExplodeFX(FX_INFO* fx, int noXZVel, int bits); \ No newline at end of file +void ExplodeFX(FX_INFO* fx, int noXZVel, int bits); +void InitialiseLagoonWitch(short itemNumber); +void ControlLagoonWitch(short itemNumber); diff --git a/TR5Main/Specific/setup.cpp b/TR5Main/Specific/setup.cpp index 01e6379ff..cfa115f51 100644 --- a/TR5Main/Specific/setup.cpp +++ b/TR5Main/Specific/setup.cpp @@ -1725,7 +1725,7 @@ void BaddyObjects() obj->collision = CreatureCollision; obj->control = ControlBrowsBeast; obj->shadowSize = UNIT_SHADOW / 2; - obj->hitPoints = 4000; + obj->hitPoints = 100; obj->pivotLength = 20; obj->radius = 341; obj->intelligent = true; @@ -1740,16 +1740,9 @@ void BaddyObjects() Bones[obj->boneIndex + 9 * 4] |= ROT_X; } - // TODO: LagoonWitch is deleted ! - /* - obj = &Objects[ID_GREEN_TEETH]; + obj = &Objects[ID_LAGOON_WITCH]; if (obj->loaded) { - //v33 = (*(&Objects[79] + 25) | 2) & 0xF7FF; - //HIBYTE(v33) |= 4u; - //v33 |= 0x100u; - //LOBYTE(v33) = v33 | 0x70; - //*(&Objects[79] + 25) = v33 | 8; obj->biteOffset = 256; obj->initialise = InitialiseLagoonWitch; obj->collision = CreatureCollision; @@ -1763,13 +1756,14 @@ void BaddyObjects() obj->saveFlags = true; obj->saveHitpoints = true; obj->savePosition = true; + //obj->undead = true; obj->zoneType = ZONE_FLYER; + Bones[obj->boneIndex + 4 * 4] |= ROT_Z; Bones[obj->boneIndex + 4 * 4] |= ROT_X; Bones[obj->boneIndex + 9 * 4] |= ROT_Z; Bones[obj->boneIndex + 9 * 4] |= ROT_X; } - */ obj = &Objects[ID_INVISIBLE_GHOST]; if (obj->loaded) diff --git a/TR5Main/TR5Main.vcxproj b/TR5Main/TR5Main.vcxproj index b2a115092..7d05b0382 100644 --- a/TR5Main/TR5Main.vcxproj +++ b/TR5Main/TR5Main.vcxproj @@ -243,6 +243,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts" + diff --git a/TR5Main/TR5Main.vcxproj.filters b/TR5Main/TR5Main.vcxproj.filters index 8da186735..f1945b7e1 100644 --- a/TR5Main/TR5Main.vcxproj.filters +++ b/TR5Main/TR5Main.vcxproj.filters @@ -845,6 +845,9 @@ File di origine + + File di origine +