Refactored energy bubbles function names; Removed LanguageScript.cpp from the project; Working on ID_CROCODILE_GOD;

This commit is contained in:
MontyTRC89 2021-08-20 06:00:34 +02:00
parent 2e1ac44c08
commit 4991da66f6
10 changed files with 720 additions and 704 deletions

View file

@ -38,14 +38,14 @@ enum ZoneType
ZONE_HUMAN_LONGJUMP_AND_MONKEY,
};
struct OBJECT_Bones
struct OBJECT_BONES
{
short bone0;
short bone1;
short bone2;
short bone3;
OBJECT_Bones()
OBJECT_BONES()
{
this->bone0 = 0;
this->bone1 = 0;
@ -53,7 +53,7 @@ struct OBJECT_Bones
this->bone3 = 0;
}
OBJECT_Bones(short all)
OBJECT_BONES(short all)
{
this->bone0 = all;
this->bone1 = all;
@ -61,7 +61,7 @@ struct OBJECT_Bones
this->bone3 = all;
}
OBJECT_Bones(short angleY, short angleX)
OBJECT_BONES(short angleY, short angleX)
{
this->bone0 = angleY;
this->bone1 = angleX;
@ -69,7 +69,7 @@ struct OBJECT_Bones
this->bone3 = angleX;
}
OBJECT_Bones(short angleY, short angleX, bool total)
OBJECT_BONES(short angleY, short angleX, bool total)
{
this->bone0 = angleY;
this->bone1 = angleX;

View file

@ -11,7 +11,9 @@
#include "lara.h"
#include "tr4_mutant.h"
void BubblesEffect1(short fxNum, short xVel, short yVel, short zVel)
namespace ten::entities::all
{
void TriggerSethMissileFlame(short fxNum, short xVel, short yVel, short zVel)
{
FX_INFO* fx = &EffectList[fxNum];
@ -31,7 +33,7 @@ void BubblesEffect1(short fxNum, short xVel, short yVel, short zVel)
spark->dG = spark->dB + 64;
spark->fadeToBlack = 8;
spark->colFadeSpeed = (GetRandomControl() & 3) + 4;
spark->transType = COLADD;
spark->transType = TransTypeEnum::COLADD;
spark->life = spark->sLife = (GetRandomControl() & 3) + 16;
spark->y = 0;
spark->x = (GetRandomControl() & 0xF) - 8;
@ -66,7 +68,7 @@ void BubblesEffect1(short fxNum, short xVel, short yVel, short zVel)
}
}
void BubblesEffect2(short fxNum, short xVel, short yVel, short zVel)
void TriggerHarpyFlameFlame(short fxNum, short xVel, short yVel, short zVel)
{
FX_INFO* fx = &EffectList[fxNum];
@ -113,7 +115,7 @@ void BubblesEffect2(short fxNum, short xVel, short yVel, short zVel)
}
}
void BubblesEffect4(short fxNum, short xVel, short yVel, short zVel)
void TriggerDemigodMissileFlame(short fxNum, short xVel, short yVel, short zVel)
{
FX_INFO* fx = &EffectList[fxNum];
@ -185,7 +187,7 @@ void BubblesShatterFunction(FX_INFO* fx, int param1, int param2)
ShatterObject(&ShatterItem, 0, param2, fx->roomNumber, param1);
}
void BubblesControl(short fxNum)
void ControlEnemyMissile(short fxNum)
{
FX_INFO* fx = &EffectList[fxNum];
@ -418,20 +420,21 @@ void BubblesControl(short fxNum)
{
default:
case 1:
BubblesEffect1(fxNum, 32 * dx, 32 * dy, 32 * dz);
TriggerSethMissileFlame(fxNum, 32 * dx, 32 * dy, 32 * dz);
break;
case 2:
BubblesEffect2(fxNum, 16 * dx, 16 * dy, 16 * dz);
TriggerHarpyFlameFlame(fxNum, 16 * dx, 16 * dy, 16 * dz);
break;
case 3:
case 4:
case 5:
BubblesEffect4(fxNum, 16 * dx, 16 * dy, 16 * dz);
TriggerDemigodMissileFlame(fxNum, 16 * dx, 16 * dy, 16 * dz);
break;
case 6:
TriggerMutantRocketEffects(fxNum, 16 * dx, 16 * dy, 16 * dz);
ten::entities::tr4::TriggerCrocgodMissileFlame(fxNum, 16 * dx, 16 * dy, 16 * dz);
break;
}
}
}
}
}

View file

@ -1,3 +1,6 @@
#pragma once
void BubblesControl(short fxNum);
namespace ten::entities::all
{
void ControlEnemyMissile(short fxNum);
}

View file

@ -104,7 +104,7 @@ void CrocodileControl(short itemNumber)
OBJECT_INFO* obj;
CREATURE_INFO* crocodile;
AI_INFO info;
OBJECT_Bones boneRot;
OBJECT_BONES boneRot;
short angle;
short boneAngle;

View file

@ -10,29 +10,9 @@
#include "objectslist.h"
#include "trmath.h"
enum MUTANT_STATE
namespace ten::entities::tr4
{
MUTANT_EMPTY,
MUTANT_APPEAR,
MUTANT_IDLE,
MUTANT_SHOOT,
MUTANT_LOCUST1,
MUTANT_LOCUST2,
};
enum class MissileRotationType
{
M_FRONT,
M_LEFT,
M_RIGHT
};
constexpr auto MUTANT_ANIM_APPEAR = 0;
constexpr auto MUTANT_SHOOT_RANGE = SQUARE(SECTOR(10));
constexpr auto MUTANT_LOCUST1_RANGE = SQUARE(SECTOR(15));
constexpr auto MUTANT_LOCUST2_RANGE = SQUARE(SECTOR(30));
static void TriggerMutantRocket(PHD_3DPOS* src, short roomNumber, short counter)
void TriggerCrocgodMissile(PHD_3DPOS* src, short roomNumber, short counter)
{
FX_INFO* fx;
short fxNumber = NO_ITEM;
@ -56,7 +36,7 @@ static void TriggerMutantRocket(PHD_3DPOS* src, short roomNumber, short counter)
}
}
void TriggerMutantRocketEffects(short fxNumber, short xVel, short yVel, short zVel)
void TriggerCrocgodMissileFlame(short fxNumber, short xVel, short yVel, short zVel)
{
FX_INFO* fx;
SPARKS* sptr;
@ -79,7 +59,7 @@ void TriggerMutantRocketEffects(short fxNumber, short xVel, short yVel, short zV
sptr->dG = color / 2;
sptr->fadeToBlack = 8;
sptr->colFadeSpeed = (GetRandomControl() & 3) + 8;
sptr->transType = COLADD;
sptr->transType = TransTypeEnum::COLADD;
sptr->dynamic = -1;
life = (GetRandomControl() & 7) + 32;
sptr->life = life;
@ -122,7 +102,7 @@ static void ShootFireball(PHD_3DPOS* src, MissileRotationType rotation, short ro
break;
}
TriggerMutantRocket(src, roomNumber, timer);
TriggerCrocgodMissile(src, roomNumber, timer);
}
static bool ShootFrame(ITEM_INFO* item)
@ -241,7 +221,7 @@ static void MutantAIFix(ITEM_INFO* item, AI_INFO* info)
MoveItemBack(item, SECTOR(2));
}
void InitialiseMutant(short itemNumber)
void InitialiseCrocgod(short itemNumber)
{
ITEM_INFO* item;
InitialiseCreature(itemNumber);
@ -249,11 +229,11 @@ void InitialiseMutant(short itemNumber)
item = &g_Level.Items[itemNumber];
item->animNumber = Objects[item->objectNumber].animIndex + MUTANT_ANIM_APPEAR;
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
item->currentAnimState = MUTANT_APPEAR;
item->goalAnimState = MUTANT_APPEAR;
item->currentAnimState = STATE_MUTANT_APPEAR;
item->goalAnimState = STATE_MUTANT_APPEAR;
}
void MutantControl(short itemNumber)
void CrocgodControl(short itemNumber)
{
if (!CreatureActive(itemNumber))
return;
@ -261,7 +241,7 @@ void MutantControl(short itemNumber)
ITEM_INFO* item;
CREATURE_INFO* mutant;
AI_INFO info;
OBJECT_Bones mutant_joint;
OBJECT_BONES mutant_joint;
short frameNumber;
short headY;
short angle;
@ -287,19 +267,20 @@ void MutantControl(short itemNumber)
switch (item->currentAnimState)
{
case MUTANT_IDLE:
case STATE_MUTANT_IDLE:
if (info.ahead)
{
int random = GetRandomControl() & 31;
if ((random > 0 && random < 10) && info.distance <= MUTANT_SHOOT_RANGE)
item->goalAnimState = MUTANT_SHOOT;
item->goalAnimState = STATE_MUTANT_SHOOT;
else if ((random > 10 && random < 20) && info.distance <= MUTANT_LOCUST1_RANGE)
item->goalAnimState = MUTANT_LOCUST1;
item->goalAnimState = STATE_MUTANT_LOCUST1;
else if ((random > 20 && random < 30) && info.distance <= MUTANT_LOCUST2_RANGE)
item->goalAnimState = MUTANT_LOCUST2;
item->goalAnimState = STATE_MUTANT_LOCUST2;
}
break;
case MUTANT_SHOOT:
case STATE_MUTANT_SHOOT:
frameNumber = (item->frameNumber - g_Level.Anims[item->objectNumber].frameBase);
if (frameNumber >= 94 && frameNumber <= 96)
{
@ -321,12 +302,14 @@ void MutantControl(short itemNumber)
}
}
break;
case MUTANT_LOCUST1:
case STATE_MUTANT_LOCUST1:
frameNumber = (item->frameNumber - g_Level.Anims[item->objectNumber].frameBase);
if (frameNumber >= 60 && frameNumber <= 120)
ten::entities::tr4::SpawnLocust(item);
break;
case MUTANT_LOCUST2:
case STATE_MUTANT_LOCUST2:
if (ShootFrame(item))
{
PHD_3DPOS src;
@ -336,10 +319,10 @@ void MutantControl(short itemNumber)
break;
}
if (item->currentAnimState != MUTANT_LOCUST1)
mutant_joint = OBJECT_Bones(headY, info.xAngle, true);
if (item->currentAnimState != STATE_MUTANT_LOCUST1)
mutant_joint = OBJECT_BONES(headY, info.xAngle, true);
else
mutant_joint = OBJECT_Bones(0);
mutant_joint = OBJECT_BONES(0);
CreatureJoint(item, 0, mutant_joint.bone0);
CreatureJoint(item, 1, mutant_joint.bone1);
@ -347,4 +330,4 @@ void MutantControl(short itemNumber)
CreatureJoint(item, 3, mutant_joint.bone3);
CreatureAnimation(itemNumber, angle, 0);
}
}

View file

@ -1,5 +1,33 @@
#pragma once
void InitialiseMutant(short itemNumber);
void MutantControl(short itemNumber);
void TriggerMutantRocketEffects(short fxNumber, short xVel, short yVel, short zVel);
#include "framework.h"
#include "trmath.h"
namespace ten::entities::tr4
{
enum MUTANT_STATE
{
STATE_MUTANT_EMPTY,
STATE_MUTANT_APPEAR,
STATE_MUTANT_IDLE,
STATE_MUTANT_SHOOT,
STATE_MUTANT_LOCUST1,
STATE_MUTANT_LOCUST2,
};
enum class MissileRotationType
{
M_FRONT,
M_LEFT,
M_RIGHT
};
constexpr auto MUTANT_ANIM_APPEAR = 0;
constexpr auto MUTANT_SHOOT_RANGE = SQUARE(SECTOR(10));
constexpr auto MUTANT_LOCUST1_RANGE = SQUARE(SECTOR(15));
constexpr auto MUTANT_LOCUST2_RANGE = SQUARE(SECTOR(30));
void InitialiseCrocgod(short itemNumber);
void CrocgodControl(short itemNumber);
void TriggerCrocgodMissileFlame(short fxNumber, short xVel, short yVel, short zVel);
}

View file

@ -664,8 +664,8 @@ static void StartBaddy(OBJECT_INFO* obj)
obj = &Objects[ID_CROCODILE_GOD];
if (obj->loaded)
{
obj->initialise = InitialiseMutant;
obj->control = MutantControl;
obj->initialise = ten::entities::tr4::InitialiseCrocgod;
obj->control = ten::entities::tr4::CrocgodControl;
obj->collision = CreatureCollision;
obj->shadowSize = UNIT_SHADOW / 2;
obj->hitPoints = NOT_TARGETABLE;

View file

@ -1241,7 +1241,7 @@ static void StartShatter(OBJECT_INFO *obj)
static void StartProjectiles(OBJECT_INFO *obj)
{
InitProjectile(obj, BubblesControl, ID_ENERGY_BUBBLES, true);
InitProjectile(obj, ten::entities::all::ControlEnemyMissile, ID_ENERGY_BUBBLES, true);
InitProjectile(obj, MissileControl, ID_BUBBLES, true);
InitProjectile(obj, MissileControl, ID_IMP_ROCK, true);
InitProjectile(obj, TorpedoControl, ID_TORPEDO);

View file

@ -110,7 +110,7 @@ enum GAME_OBJECT_ID : short
ID_DOBERMAN,
ID_HAMMERHEAD, // TR4 - OK
ID_CROCODILE_GOD, // TR4 Citadel Gate Mutant
ID_LOCUSTS_EMITTER,
ID_LOCUSTS_EMITTER, // TR4 - OK
/* Humans */
ID_SCUBA_HARPOON = 150,

View file

@ -711,7 +711,6 @@ xcopy /Y "$(ProjectDir)Shaders\HUD\*.hlsl" "$(TargetDir)\Shaders\HUD\"</Command>
<ClCompile Include="Scripting\GameScriptSinkInfo.cpp" />
<ClCompile Include="Scripting\GameScriptSkyLayer.cpp" />
<ClCompile Include="Scripting\GameScriptSoundSourceInfo.cpp" />
<ClCompile Include="Scripting\LanguageScript.cpp" />
<ClCompile Include="Objects\TR4\Entity\tr4_demigod.cpp" />
<ClCompile Include="Objects\TR4\Entity\tr4_guide.cpp" />
<ClCompile Include="Objects\TR4\Entity\tr4_jeanyves.cpp" />