mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-04 19:04:08 +00:00
remove unused / reorg entity variables
This commit is contained in:
parent
e22cfec0e6
commit
cf6464daa7
2 changed files with 101 additions and 107 deletions
|
@ -29,6 +29,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "PathFinding.h"
|
#include "PathFinding.h"
|
||||||
#include "Hair.h"
|
#include "Hair.h"
|
||||||
|
|
||||||
|
LanceData::LanceData()
|
||||||
|
: delay(0), timer(0), gfx(NULL), bone(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LanceData::~LanceData()
|
||||||
|
{
|
||||||
|
if(gfx)
|
||||||
|
{
|
||||||
|
gfx->setLife(1.0);
|
||||||
|
gfx->setDecayRate(2);
|
||||||
|
gfx->fadeAlphaWithLife = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Entity::stopPull()
|
void Entity::stopPull()
|
||||||
{
|
{
|
||||||
|
@ -158,13 +173,9 @@ Entity::Entity()
|
||||||
|
|
||||||
|
|
||||||
invincible = false;
|
invincible = false;
|
||||||
lanceDelay = 0;
|
lancedata = NULL;
|
||||||
lance = 0;
|
|
||||||
lanceTimer = 0;
|
|
||||||
lanceGfx = 0;
|
|
||||||
lanceBone = 0;
|
|
||||||
beautyFlip = true;
|
beautyFlip = true;
|
||||||
fhScale = fvScale = 0;
|
fhScale = false;
|
||||||
flipScale = Vector(1,1);
|
flipScale = Vector(1,1);
|
||||||
wasUnderWater = true;
|
wasUnderWater = true;
|
||||||
deathScene = false;
|
deathScene = false;
|
||||||
|
@ -189,8 +200,7 @@ Entity::Entity()
|
||||||
fillGridFromQuad = false;
|
fillGridFromQuad = false;
|
||||||
dropChance = 0;
|
dropChance = 0;
|
||||||
inCurrent = false;
|
inCurrent = false;
|
||||||
entityProperties.resize(EP_MAX);
|
for (size_t i = 0; i < EP_MAX; i++)
|
||||||
for (size_t i = 0; i < entityProperties.size(); i++)
|
|
||||||
{
|
{
|
||||||
entityProperties[i] = false;
|
entityProperties[i] = false;
|
||||||
}
|
}
|
||||||
|
@ -254,6 +264,7 @@ Entity::Entity()
|
||||||
Entity::~Entity()
|
Entity::~Entity()
|
||||||
{
|
{
|
||||||
delete minimapIcon;
|
delete minimapIcon;
|
||||||
|
delete lancedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::setDeathScene(bool v)
|
void Entity::setDeathScene(bool v)
|
||||||
|
@ -323,12 +334,12 @@ void Entity::setPauseFreeze(bool v)
|
||||||
|
|
||||||
void Entity::setEntityProperty(EntityProperty ep, bool value)
|
void Entity::setEntityProperty(EntityProperty ep, bool value)
|
||||||
{
|
{
|
||||||
entityProperties[int(ep)] = value;
|
entityProperties[ep] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::isEntityProperty(EntityProperty ep)
|
bool Entity::isEntityProperty(EntityProperty ep)
|
||||||
{
|
{
|
||||||
return entityProperties[int(ep)];
|
return entityProperties[ep];
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector Entity::getRidingPosition()
|
Vector Entity::getRidingPosition()
|
||||||
|
@ -997,10 +1008,7 @@ void Entity::onFHScale()
|
||||||
{
|
{
|
||||||
flipScale.interpolateTo(Vector(1, 1), sct);
|
flipScale.interpolateTo(Vector(1, 1), sct);
|
||||||
_fh = !_fh;
|
_fh = !_fh;
|
||||||
|
fhScale = false;
|
||||||
|
|
||||||
|
|
||||||
fhScale = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::onFH()
|
void Entity::onFH()
|
||||||
|
@ -1010,14 +1018,8 @@ void Entity::onFH()
|
||||||
if (!fhScale)
|
if (!fhScale)
|
||||||
{
|
{
|
||||||
flipScale = Vector(1,1);
|
flipScale = Vector(1,1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
flipScale.interpolateTo(Vector(0.6f, 1), sct);
|
flipScale.interpolateTo(Vector(0.6f, 1), sct);
|
||||||
|
fhScale = true;
|
||||||
|
|
||||||
|
|
||||||
fhScale = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1500,16 +1502,8 @@ void Entity::onUpdate(float dt)
|
||||||
if (beautyFlip)
|
if (beautyFlip)
|
||||||
{
|
{
|
||||||
flipScale.update(dt);
|
flipScale.update(dt);
|
||||||
|
if (fhScale && !flipScale.isInterpolating())
|
||||||
switch (fhScale)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
if (!flipScale.isInterpolating())
|
|
||||||
onFHScale();
|
onFHScale();
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1756,39 +1750,36 @@ void Entity::idle()
|
||||||
|
|
||||||
void Entity::updateLance(float dt)
|
void Entity::updateLance(float dt)
|
||||||
{
|
{
|
||||||
if (lance == 1)
|
if(!lancedata)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lancedata->timer -= dt;
|
||||||
|
if (lancedata->timer < 0)
|
||||||
{
|
{
|
||||||
lanceTimer -= dt;
|
delete lancedata;
|
||||||
if (lanceTimer < 0)
|
lancedata = NULL;
|
||||||
{
|
|
||||||
lance = 0;
|
|
||||||
lanceGfx->setLife(1.0);
|
|
||||||
lanceGfx->setDecayRate(2);
|
|
||||||
lanceGfx->fadeAlphaWithLife = 1;
|
|
||||||
lanceGfx = 0;
|
|
||||||
lanceTimer = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lanceGfx->fhTo(_fh);
|
lancedata->gfx->fhTo(_fh);
|
||||||
lanceDelay = lanceDelay + dt;
|
lancedata->delay += dt;
|
||||||
if (lanceDelay > 0.1f)
|
if (lancedata->delay > 0.1f)
|
||||||
{
|
{
|
||||||
lanceDelay = 0;
|
lancedata->delay = 0;
|
||||||
dsq->game->fireShot("Lance", this, 0, lanceGfx->getWorldCollidePosition(Vector(-64, 0)));
|
dsq->game->fireShot("Lance", this, 0, lancedata->gfx->getWorldCollidePosition(Vector(-64, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lanceBone != 0)
|
if (lancedata->bone)
|
||||||
{
|
{
|
||||||
lanceGfx->position = lanceBone->getWorldPosition();
|
Vector pr = lancedata->bone->getWorldPositionAndRotation();
|
||||||
lanceGfx->rotation = lanceBone->getWorldRotation();
|
lancedata->gfx->position.x = pr.x;
|
||||||
|
lancedata->gfx->position.y = pr.y;
|
||||||
|
lancedata->gfx->rotation = pr.z;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lanceGfx->position = getWorldPosition();
|
lancedata->gfx->position = getWorldPosition();
|
||||||
lanceGfx->rotation = rotation;
|
lancedata->gfx->rotation = rotation;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1798,18 +1789,17 @@ void Entity::attachLance()
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "attaching lance to " << this->name;
|
os << "attaching lance to " << this->name;
|
||||||
debugLog(os.str());
|
debugLog(os.str());
|
||||||
lance = 1;
|
lancedata = new LanceData();
|
||||||
lanceBone = 0;
|
lancedata->timer = 8;
|
||||||
if (!lanceGfx)
|
lancedata->bone = skeletalSprite.getBoneByName("Lance");
|
||||||
{
|
|
||||||
lanceGfx = new PauseQuad();
|
PauseQuad *q = new PauseQuad();
|
||||||
lanceGfx->setTexture("Particles/Lance");
|
q = new PauseQuad();
|
||||||
lanceGfx->alpha = 0;
|
q->setTexture("Particles/Lance");
|
||||||
lanceGfx->alpha.interpolateTo(1, 0.5);
|
q->alpha = 0;
|
||||||
dsq->game->addRenderObject(lanceGfx, LR_PARTICLES);
|
q->alpha.interpolateTo(1, 0.5);
|
||||||
}
|
dsq->game->addRenderObject(q, LR_PARTICLES);
|
||||||
lanceTimer = 8;
|
lancedata->gfx = q;
|
||||||
lanceBone = skeletalSprite.getBoneByName("Lance");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::setRiding(Entity *e)
|
void Entity::setRiding(Entity *e)
|
||||||
|
@ -2765,7 +2755,7 @@ void Entity::exertHairForce(const Vector &force, float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::isEntityInside()
|
bool Entity::isEntityInside() const
|
||||||
{
|
{
|
||||||
FOR_ENTITIES(i)
|
FOR_ENTITIES(i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,20 @@ struct BoneLock
|
||||||
int collisionMaskIndex;
|
int collisionMaskIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The Lance is an ability that never made it into the released version of the game.
|
||||||
|
// The code is functional but it was never used. Keeping it around for now
|
||||||
|
// in case any mods use it for whatever reason.
|
||||||
|
struct LanceData
|
||||||
|
{
|
||||||
|
LanceData();
|
||||||
|
~LanceData();
|
||||||
|
|
||||||
|
PauseQuad *gfx;
|
||||||
|
float timer;
|
||||||
|
float delay;
|
||||||
|
Bone *bone;
|
||||||
|
};
|
||||||
|
|
||||||
class Entity : public CollideQuad, public StateMachine, public SoundHolder
|
class Entity : public CollideQuad, public StateMachine, public SoundHolder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -120,7 +134,6 @@ public:
|
||||||
float activationRange;
|
float activationRange;
|
||||||
Entity *followEntity;
|
Entity *followEntity;
|
||||||
Entity *ridingOnEntity;
|
Entity *ridingOnEntity;
|
||||||
bool canBeTargetedByAvatar;
|
|
||||||
Vector startPos;
|
Vector startPos;
|
||||||
void getEXP(unsigned int exp);
|
void getEXP(unsigned int exp);
|
||||||
void rotateToVec(Vector addVec, float time, float offsetAngle=0);
|
void rotateToVec(Vector addVec, float time, float offsetAngle=0);
|
||||||
|
@ -226,7 +239,6 @@ public:
|
||||||
bool isAvatarAttackTarget();
|
bool isAvatarAttackTarget();
|
||||||
int dropChance;
|
int dropChance;
|
||||||
void fillGrid();
|
void fillGrid();
|
||||||
bool fillGridFromQuad;
|
|
||||||
|
|
||||||
void setID(int id);
|
void setID(int id);
|
||||||
int getID();
|
int getID();
|
||||||
|
@ -288,7 +300,6 @@ public:
|
||||||
bool checkSplash(const Vector &override=Vector(0,0,0));
|
bool checkSplash(const Vector &override=Vector(0,0,0));
|
||||||
EatData eatData;
|
EatData eatData;
|
||||||
InterpolatedVector flipScale;
|
InterpolatedVector flipScale;
|
||||||
bool beautyFlip;
|
|
||||||
void attachLance();
|
void attachLance();
|
||||||
void setInvincible(bool inv);
|
void setInvincible(bool inv);
|
||||||
void clampToHit();
|
void clampToHit();
|
||||||
|
@ -335,7 +346,7 @@ public:
|
||||||
void setHairHeadPosition(const Vector &pos);
|
void setHairHeadPosition(const Vector &pos);
|
||||||
void exertHairForce(const Vector &force, float dt);
|
void exertHairForce(const Vector &force, float dt);
|
||||||
|
|
||||||
bool isEntityInside();
|
bool isEntityInside() const;
|
||||||
|
|
||||||
void updateSoundPosition();
|
void updateSoundPosition();
|
||||||
|
|
||||||
|
@ -346,9 +357,7 @@ public:
|
||||||
MinimapIcon *ensureMinimapIcon();
|
MinimapIcon *ensureMinimapIcon();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool calledEntityDied;
|
|
||||||
Path *waterBubble;
|
Path *waterBubble;
|
||||||
bool ridingFlip;
|
|
||||||
Vector ridingPosition;
|
Vector ridingPosition;
|
||||||
float ridingRotation;
|
float ridingRotation;
|
||||||
|
|
||||||
|
@ -364,30 +373,14 @@ protected:
|
||||||
int vs[EV_MAX];
|
int vs[EV_MAX];
|
||||||
void onEndOfLife();
|
void onEndOfLife();
|
||||||
|
|
||||||
bool invincible;
|
|
||||||
PauseQuad *lanceGfx;
|
|
||||||
float lanceTimer;
|
|
||||||
float lanceDelay;
|
|
||||||
int lance;
|
|
||||||
Bone *lanceBone;
|
|
||||||
void updateLance(float dt);
|
void updateLance(float dt);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int fhScale, fvScale;
|
|
||||||
void onFHScale();
|
void onFHScale();
|
||||||
void onFH();
|
void onFH();
|
||||||
bool deathScene;
|
|
||||||
float dieTimer;
|
float dieTimer;
|
||||||
BounceType bounceType;
|
BounceType bounceType;
|
||||||
Entity* riding;
|
Entity* riding;
|
||||||
EatType eatType;
|
EatType eatType;
|
||||||
bool stickToNaijasHead;
|
|
||||||
|
|
||||||
bool spiritFreeze;
|
|
||||||
bool pauseFreeze;
|
|
||||||
bool canLeaveWater;
|
|
||||||
bool wasUnderWater;
|
|
||||||
|
|
||||||
std::vector<Vector>targetPoints;
|
std::vector<Vector>targetPoints;
|
||||||
|
|
||||||
|
@ -400,15 +393,12 @@ protected:
|
||||||
virtual void onHeal(int type){}
|
virtual void onHeal(int type){}
|
||||||
virtual void onDamage(DamageData &d){}
|
virtual void onDamage(DamageData &d){}
|
||||||
virtual void onHealthChange(float change){}
|
virtual void onHealthChange(float change){}
|
||||||
bool inCurrent;
|
|
||||||
std::vector<bool> entityProperties;
|
|
||||||
float slowingToStopPathTimer, slowingToStopPath;
|
float slowingToStopPathTimer, slowingToStopPath;
|
||||||
|
|
||||||
void movementDetails(Vector v);
|
void movementDetails(Vector v);
|
||||||
Entity *watchingEntity;
|
Entity *watchingEntity;
|
||||||
virtual void onPathEnd();
|
virtual void onPathEnd();
|
||||||
bool swimPath;
|
|
||||||
bool deleteOnPathEnd;
|
|
||||||
InterpolatedVector multColor;
|
InterpolatedVector multColor;
|
||||||
EntityType entityType;
|
EntityType entityType;
|
||||||
std::vector<Entity*> attachedEntities;
|
std::vector<Entity*> attachedEntities;
|
||||||
|
@ -428,9 +418,7 @@ protected:
|
||||||
void onEnterState(int action);
|
void onEnterState(int action);
|
||||||
void onExitState(int action);
|
void onExitState(int action);
|
||||||
|
|
||||||
bool invincibleBreak;
|
|
||||||
|
|
||||||
bool entityDead;
|
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
|
|
||||||
Vector pushVec;
|
Vector pushVec;
|
||||||
|
@ -444,19 +432,35 @@ protected:
|
||||||
|
|
||||||
float pushMaxSpeed;
|
float pushMaxSpeed;
|
||||||
std::string currentAnim;
|
std::string currentAnim;
|
||||||
|
LanceData *lancedata;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
Timer poisonTimer, poisonBitTimer;
|
Timer poisonTimer, poisonBitTimer;
|
||||||
float poison;
|
float poison;
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
float maxSpeed;
|
float maxSpeed;
|
||||||
|
|
||||||
bool stopSoundsOnDeath;
|
char entityProperties[EP_MAX];
|
||||||
|
|
||||||
|
// TODO: this should be a bitmask
|
||||||
|
bool invincible;
|
||||||
|
bool invincibleBreak;
|
||||||
|
bool stickToNaijasHead;
|
||||||
|
bool spiritFreeze;
|
||||||
|
bool pauseFreeze;
|
||||||
|
bool canLeaveWater;
|
||||||
|
bool wasUnderWater;
|
||||||
|
bool entityDead;
|
||||||
|
bool swimPath;
|
||||||
|
bool deleteOnPathEnd;
|
||||||
|
bool inCurrent;
|
||||||
|
bool deathScene;
|
||||||
|
bool fhScale;
|
||||||
|
bool calledEntityDied;
|
||||||
|
bool ridingFlip;
|
||||||
|
bool canBeTargetedByAvatar;
|
||||||
|
bool stopSoundsOnDeath;
|
||||||
|
public:
|
||||||
|
bool fillGridFromQuad;
|
||||||
|
bool beautyFlip;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue