1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-13 16:16:08 +00:00

Cleaning out some dead code.

This adds a small compile error, to be fixed in next commit.
This commit is contained in:
fgenesis 2013-09-04 16:07:46 +02:00
parent 31ab72334b
commit a91a22f463
7 changed files with 30 additions and 365 deletions

View file

@ -93,7 +93,6 @@ const float QUICK_SONG_CAST_DELAY = 0.4;
const float BURST_RECOVER_RATE = 1.2; // 3.0 // 0.75 const float BURST_RECOVER_RATE = 1.2; // 3.0 // 0.75
const float BURST_USE_RATE = 1.5; //0.9 //1.5; const float BURST_USE_RATE = 1.5; //0.9 //1.5;
const float BURST_DELAY = 0.1;
const float BURST_ACCEL = 4000; //2000 // 1000 const float BURST_ACCEL = 4000; //2000 // 1000
// Minimum time between two splash effects (seconds). // Minimum time between two splash effects (seconds).
@ -265,13 +264,6 @@ void Avatar::postInit()
void Avatar::onAnimationKeyPassed(int key) void Avatar::onAnimationKeyPassed(int key)
{ {
if (swimming && !isRolling() && !bursting && _isUnderWater)
{
if (key == 0 || key == 2)
{
//core->sound->playSfx("SwimKick", 255, 0, 1000+getMaxSpeed()/10.0f);
}
}
Entity::onAnimationKeyPassed(key); Entity::onAnimationKeyPassed(key);
} }
@ -3496,31 +3488,15 @@ void Avatar::lockToWall()
if (dsq->game->isPaused()) return; if (dsq->game->isPaused()) return;
TileVector t(position); TileVector t(position);
TileVector myTile = t;
// 3 + 4
// 4 + 5
Vector m = vel; Vector m = vel;
m.setLength2D(3); m.setLength2D(3);
t.x += int(m.x); t.x += int(m.x);
t.y += int(m.y); t.y += int(m.y);
m.setLength2D(2);
TileVector tback = myTile;
tback.x += int(m.x);
tback.y += int(m.y);
Vector add = m;
add.setLength2D(1);
TileVector tnext = myTile;
tnext.x += int(add.x);
tnext.y += int(add.y);
bool good = true; bool good = true;
if (!dsq->game->isObstructed(t)) if (!dsq->game->isObstructed(t))
{ {
int tried = 0; do
//tryAgain:
while(1)
{ {
TileVector test; TileVector test;
@ -3572,46 +3548,23 @@ void Avatar::lockToWall()
t = test; t = test;
break; break;
} }
tried++;
//if (tried >= 2) good = false;
if (true)
{
good = false;
break;
}
else
{
//debugLog("trying other");
//t = myTile;
//goto tryAgain;
}
} }
while(0);
} }
if (dsq->game->getGrid(t)==OT_HURT && isDamageTarget(DT_WALLHURT)) if (dsq->game->getGrid(t)==OT_HURT && isDamageTarget(DT_WALLHURT))
{ {
good = false; good = false;
} }
if (good /*&& dsq->game->)isObstructed(t2, OT_BLACK)*/ /*&& diff.getSquaredLength2D() > sqr(40)*/) if (good)
{ {
wallNormal = dsq->game->getWallNormal(position); wallNormal = dsq->game->getWallNormal(position);
bool outOfWaterHit = (!_isUnderWater && !(wallNormal.y < -0.1f)); bool outOfWaterHit = (!_isUnderWater && !(wallNormal.y < -0.1f));
if (wallNormal.isZero() ) //|| outOfWaterHit if (wallNormal.isZero() )
{ {
debugLog("COULD NOT FIND NORMAL, GOING TO BOUNCE"); debugLog("COULD NOT FIND NORMAL, GOING TO BOUNCE");
if (outOfWaterHit)
{
/*
Animation *anim = skeletalSprite.getCurrentAnimation();
if (anim && anim->name == "hitGround")
{
}
else
{
skeletalSprite.animate("hitGround");
}
*/
}
return; return;
} }
else else
@ -3648,16 +3601,6 @@ void Avatar::lockToWall()
offset.stop(); offset.stop();
Vector goIn;
TileVector uset;
if (!dsq->game->isObstructed(tnext))
{
uset = tnext;
}
else
uset = tback;
int tileType = dsq->game->getGrid(t); int tileType = dsq->game->getGrid(t);
Vector offdiff = t.worldVector() - position; Vector offdiff = t.worldVector() - position;
if (!offdiff.isZero()) if (!offdiff.isZero())
@ -3948,12 +3891,9 @@ Avatar::Avatar() : Entity(), ActionMapper()
bursting = false; bursting = false;
burst = 1; burst = 1;
burstDelay = 0; burstDelay = 0;
ignoreInputDelay = 0;
splashDelay = 0; splashDelay = 0;
avatar = this; avatar = this;
particleDelay = 0;
swimming = false; swimming = false;
debugLog("Avatar 3"); debugLog("Avatar 3");
@ -6558,32 +6498,15 @@ void Avatar::onUpdate(float dt)
if (!rolling && !state.backFlip && !flourish) if (!rolling && !state.backFlip && !flourish)
{ {
bool swimOnBack = false; if (addVec.x > 0)
if (swimOnBack)
{ {
if (addVec.x > 0) if (!isfh())
{ flipHorizontal();
if (isfh())
flipHorizontal();
}
if (addVec.x < 0)
{
if (!isfh())
flipHorizontal();
}
} }
else if (addVec.x < 0)
{ {
if (addVec.x > 0) if (isfh())
{ flipHorizontal();
if (!isfh())
flipHorizontal();
}
if (addVec.x < 0)
{
if (isfh())
flipHorizontal();
}
} }
} }

View file

@ -445,7 +445,6 @@ protected:
bool checkWarpAreas(); bool checkWarpAreas();
void toggleZoom(); void toggleZoom();
float ignoreInputDelay;
float splashDelay; float splashDelay;
//Hair *hair; //Hair *hair;
@ -453,8 +452,6 @@ protected:
void onUpdate(float dt); void onUpdate(float dt);
void onRender(); void onRender();
float particleDelay;
//float rippleDelay;
Quad *glow; Quad *glow;
bool swimming; bool swimming;
@ -469,8 +466,7 @@ protected:
float pushingOffWallEffect; float pushingOffWallEffect;
float lockToWallFallTimer; float lockToWallFallTimer;
Vector dodgeVec; Vector wallPushVec;
Vector wallPushVec, wallTurnVec;

View file

@ -29,9 +29,6 @@ CollideEntity::CollideEntity() : Entity()
this->canBeTargetedByAvatar = true; this->canBeTargetedByAvatar = true;
weight = 0; weight = 0;
bounceAmount = 0.5f; bounceAmount = 0.5f;
bounceEntityAmount = 0.5f;
doCusion = false;
friction = 0;
this->updateCull = 4000; this->updateCull = 4000;
} }
@ -115,56 +112,6 @@ void CollideEntity::updateMovement(float dt)
updateVel2(dt); updateVel2(dt);
if (doCusion)
{
Vector push;
TileVector t(position+vel*dt);
if (dsq->game->isObstructed(TileVector(t.x-1, t.y)))
{
push += Vector(1.25,0);
}
if (dsq->game->isObstructed(TileVector(t.x+1, t.y)))
{
push += Vector(-1.25,0);
}
if (dsq->game->isObstructed(TileVector(t.x, t.y-1)))
{
push += Vector(0,1.25);
}
if (dsq->game->isObstructed(TileVector(t.x, t.y+1)))
{
push += Vector(0,-1.25);
}
if (dsq->game->isObstructed(TileVector(t.x-1, t.y-1)))
{
push += Vector(0.5,0.5);
}
if (dsq->game->isObstructed(TileVector(t.x-1, t.y+1)))
{
push += Vector(0.5,-0.5);
}
if (dsq->game->isObstructed(TileVector(t.x+1, t.y-1)))
{
push += Vector(-0.5,0.5);
}
if (dsq->game->isObstructed(TileVector(t.x+1, t.y+1)))
{
push += Vector(-0.5,-0.5);
}
// cushion
if (push.x != 0 || push.y != 0)
{
if (vel.getSquaredLength2D() > sqr(10))
{
push.setLength2D(100 * dt * 60);
push.z = 0;
}
vel += push;
}
}
Vector lastPosition = position; Vector lastPosition = position;
bool underWater = isUnderWater(); bool underWater = isUnderWater();
@ -252,16 +199,6 @@ void CollideEntity::updateMovement(float dt)
} }
} }
if (collided && friction != 0 && (vel.x != 0 || vel.y != 0))
{
Vector fric = vel;
fric.setLength2D(-friction);
vel.z = 0;
vel += fric*dt;
}
//doFriction(dt);
if (!collided && weight != 0) if (!collided && weight != 0)
{ {
vel += Vector(0, weight*dt); vel += Vector(0, weight*dt);

View file

@ -27,9 +27,8 @@ class CollideEntity : public Entity
{ {
public: public:
CollideEntity(); CollideEntity();
float bounceAmount, bounceEntityAmount; float bounceAmount;
float weight; float weight;
Vector collideOffset;
void updateMovement(float dt); void updateMovement(float dt);
void entityDied(Entity *e); void entityDied(Entity *e);
protected: protected:
@ -37,8 +36,6 @@ protected:
void onUpdateFrozen(float dt); void onUpdateFrozen(float dt);
virtual void onBounce() {} virtual void onBounce() {}
float friction;
bool doCusion;
void bounce(float ba); void bounce(float ba);
}; };

View file

@ -35,13 +35,12 @@ class Path;
struct BoneLock struct BoneLock
{ {
BoneLock() : entity(0), bone(0), on(false), origRot(0), offRot(0) {} BoneLock() : entity(0), bone(0), on(false), origRot(0) {}
Entity *entity; Entity *entity;
Bone *bone; Bone *bone;
Vector localOffset; Vector localOffset;
bool on; bool on;
float origRot; float origRot;
float offRot;
Vector wallNormal, circleOffset; Vector wallNormal, circleOffset;
int collisionMaskIndex; int collisionMaskIndex;
}; };

View file

@ -38,7 +38,6 @@ ScriptedEntity::ScriptedEntity(const std::string &scriptName, Vector position, E
becomeSolidDelay = false; becomeSolidDelay = false;
strandSpacing = 10; strandSpacing = 10;
animKeyFunc = true; animKeyFunc = true;
preUpdateFunc = true;
//runningActivation = false; //runningActivation = false;
setEntityType(et); setEntityType(et);
@ -120,16 +119,8 @@ void ScriptedEntity::init()
if (!script->call("init", this)) if (!script->call("init", this))
luaDebugMsg("init", script->getLastError()); luaDebugMsg("init", script->getLastError());
} }
//update(0);
Entity::init(); Entity::init();
/*
if (script)
{
bool fail=false;
//update(0);
}
*/
} }
void ScriptedEntity::postInit() void ScriptedEntity::postInit()
@ -257,11 +248,6 @@ void ScriptedEntity::initStrands(int num, int segs, int dist, int strandSpacing,
strands.resize(num); strands.resize(num);
for (int i = 0; i < strands.size(); i++) for (int i = 0; i < strands.size(); i++)
{ {
/*
int sz = 5;
if (i == 0 || i == strands.size()-1)
sz = 4;
*/
strands[i] = new Strand(position, segs, dist); strands[i] = new Strand(position, segs, dist);
strands[i]->color = color; strands[i]->color = color;
dsq->game->addRenderObject(strands[i], this->layer); dsq->game->addRenderObject(strands[i], this->layer);
@ -269,113 +255,32 @@ void ScriptedEntity::initStrands(int num, int segs, int dist, int strandSpacing,
updateStrands(0); updateStrands(0);
} }
/*
// write this if/when needed, set all strands to color (with lerp)
void ScriptedEntity::setStrandsColor(const Vector &color, float time)
{
}
*/
void ScriptedEntity::onAlwaysUpdate(float dt) void ScriptedEntity::onAlwaysUpdate(float dt)
{ {
Entity::onAlwaysUpdate(dt); Entity::onAlwaysUpdate(dt);
// debugLog("calling updateStrands");
updateStrands(dt); updateStrands(dt);
//HACK: this would be better in base Entity
/*
if (frozenTimer)
{
}
*/
if (!isEntityDead() && getState() != STATE_DEAD && getState() != STATE_DEATHSCENE && isPresent()) if (!isEntityDead() && getState() != STATE_DEAD && getState() != STATE_DEATHSCENE && isPresent())
{ {
const bool useEV=false;
if (useEV)
{
int mov = getv(EV_MOVEMENT);
if (mov && frozenTimer)
{
doFriction(dt, 50);
}
else
{
// don't update friction if we're in a bubble.
int fric = getv(EV_FRICTION);
if (fric)
{
doFriction(dt, fric);
}
}
switch (mov)
{
case 1:
updateMovement(dt);
break;
case 2:
updateCurrents(dt);
updateMovement(dt);
break;
}
if (mov)
{
if (hair)
{
setHairHeadPosition(position);
updateHair(dt);
}
}
switch (getv(EV_COLLIDE))
{
case 1:
if (skeletalSprite.isLoaded())
dsq->game->handleShotCollisionsSkeletal(this);
else
dsq->game->handleShotCollisions(this);
break;
case 2:
if (skeletalSprite.isLoaded())
dsq->game->handleShotCollisionsSkeletal(this);
else
dsq->game->handleShotCollisions(this);
int dmg = getv(EV_TOUCHDMG);
if (frozenTimer > 0)
dmg = 0;
touchAvatarDamage(collideRadius, dmg);
break;
}
}
if (frozenTimer > 0) if (frozenTimer > 0)
{ {
pullEmitter.update(dt); pullEmitter.update(dt);
if (!useEV) doFriction(dt, 50);
updateCurrents(dt);
updateMovement(dt);
if (hair)
{ {
doFriction(dt, 50); setHairHeadPosition(position);
updateCurrents(dt); updateHair(dt);
updateMovement(dt);
if (hair)
{
setHairHeadPosition(position);
updateHair(dt);
}
if (skeletalSprite.isLoaded())
dsq->game->handleShotCollisionsSkeletal(this);
else
dsq->game->handleShotCollisions(this);
} }
if (skeletalSprite.isLoaded())
dsq->game->handleShotCollisionsSkeletal(this);
else
dsq->game->handleShotCollisions(this);
} }
if (isPullable() && !fillGridFromQuad) if (isPullable() && !fillGridFromQuad)
@ -387,7 +292,6 @@ void ScriptedEntity::onAlwaysUpdate(float dt)
crushDelay = 0.2; crushDelay = 0.2;
doCrush = true; doCrush = true;
} }
//if ((dsq->game->avatar->position - this->position).getSquaredLength2D() < sqr(collideRadius + dsq->game->avatar->collideRadius))
FOR_ENTITIES(i) FOR_ENTITIES(i)
{ {
Entity *e = *i; Entity *e = *i;
@ -397,9 +301,6 @@ void ScriptedEntity::onAlwaysUpdate(float dt)
{ {
if (this->isEntityProperty(EP_BLOCKER) && doCrush) if (this->isEntityProperty(EP_BLOCKER) && doCrush)
{ {
//bool doit = !vel.isLength2DIn(200) || (e->position.y > position.y && vel.y > 0);
/*dsq->game->avatar->pullTarget != this ||*/
/*&& */
bool doit = !vel.isLength2DIn(64) || (e->position.y > position.y && vel.y > 0); bool doit = !vel.isLength2DIn(64) || (e->position.y > position.y && vel.y > 0);
if (doit) if (doit)
{ {
@ -432,11 +333,9 @@ void ScriptedEntity::onAlwaysUpdate(float dt)
if (isPullable()) if (isPullable())
{ {
//debugLog("movable!");
Entity *followEntity = dsq->game->avatar; Entity *followEntity = dsq->game->avatar;
if (followEntity && dsq->game->avatar->pullTarget == this) if (followEntity && dsq->game->avatar->pullTarget == this)
{ {
//debugLog("followentity!");
Vector dist = followEntity->position - this->position; Vector dist = followEntity->position - this->position;
if (dist.isLength2DIn(followEntity->collideRadius + collideRadius + 16)) if (dist.isLength2DIn(followEntity->collideRadius + collideRadius + 16))
{ {
@ -468,7 +367,6 @@ void ScriptedEntity::onAlwaysUpdate(float dt)
if (vel.isLength2DIn(100)) if (vel.isLength2DIn(100))
vel = 0; vel = 0;
} }
//vel = 0;
} }
doCollisionAvoidance(dt, 2, 0.5); doCollisionAvoidance(dt, 2, 0.5);
} }
@ -497,28 +395,8 @@ void ScriptedEntity::updateStrands(float dt)
void ScriptedEntity::destroy() void ScriptedEntity::destroy()
{ {
//debugLog("calling target died");
CollideEntity::destroy(); CollideEntity::destroy();
/*
// spring plant might already be destroyed at this point (end of state)
// could add as child?
if (springPlant)
{
//springPlant->life = 0.1;
springPlant->alpha = 0;
}
*/
/*
if (hair)
{
//dsq->removeRenderObject(hair, DESTROY_RENDER_OBJECT);
dsq->game->removeRenderObject(hair);
hair->destroy();
delete hair;
hair = 0;
}
*/
if (script) if (script)
{ {
dsq->scriptInterface.closeScript(script); dsq->scriptInterface.closeScript(script);
@ -552,14 +430,9 @@ void ScriptedEntity::startPull()
debugLog("HERE!"); debugLog("HERE!");
if (isEntityProperty(EP_BLOCKER)) if (isEntityProperty(EP_BLOCKER))
{ {
//debugLog("property set!");
fillGridFromQuad = false; fillGridFromQuad = false;
dsq->game->reconstructEntityGrid(); dsq->game->reconstructEntityGrid();
} }
else
{
//debugLog("property not set!");
}
pullEmitter.load("Pulled"); pullEmitter.load("Pulled");
pullEmitter.start(); pullEmitter.start();
@ -603,21 +476,8 @@ void ScriptedEntity::onUpdate(float dt)
{ {
BBGE_PROF(ScriptedEntity_onUpdate); BBGE_PROF(ScriptedEntity_onUpdate);
/*
if (script && preUpdateFunc)
{
if (!script->call("preUpdate", this, dt))
{
debugLog(name + " : preUpdate : " + script->getLastError());
preUpdateFunc = false;
}
}
*/
CollideEntity::onUpdate(dt); CollideEntity::onUpdate(dt);
//updateStrands(dt);
if (becomeSolidDelay) if (becomeSolidDelay)
{ {
if (vel.isLength2DIn(5)) if (vel.isLength2DIn(5))
@ -659,15 +519,6 @@ void ScriptedEntity::onUpdate(float dt)
updateSegments(position, reverseSegments); updateSegments(position, reverseSegments);
updateAlpha(alpha.x); updateAlpha(alpha.x);
} }
/*
//HACK: if this is wanted (to support moving placed entities), then
// springPlant has to notify ScriptedEntity when it is deleted / pulled out
if (springPlant)
{
springPlant->position = this->position;
}
*/
} }
void ScriptedEntity::resetTimer(float t) void ScriptedEntity::resetTimer(float t)
@ -720,25 +571,14 @@ bool ScriptedEntity::damage(const DamageData &d)
if (!script->call("damage", this, d.attacker, d.bone, int(d.damageType), d.damage, d.hitPos.x, d.hitPos.y, d.shot, &doDefault)) if (!script->call("damage", this, d.attacker, d.bone, int(d.damageType), d.damage, d.hitPos.x, d.hitPos.y, d.shot, &doDefault))
{ {
debugLog(name + ": damage function failed"); debugLog(name + ": damage function failed");
//debugLog(this->name + " : " + script->getLastError() + " hit");
}
else
{
/*
std::ostringstream os;
os << "doDefault: " << doDefault;
debugLog(os.str());
*/
} }
} }
if (doDefault) if (doDefault)
{ {
//debugLog("doing default damage");
return Entity::damage(d); return Entity::damage(d);
} }
//debugLog("not doing default damage");
return false; return false;
} }
@ -835,24 +675,6 @@ void ScriptedEntity::activate()
{ {
if (runningActivation) return; if (runningActivation) return;
Entity::activate(); Entity::activate();
/*
if (dsq->game->avatar)
{
Avatar *a = dsq->game->avatar;
if (a->position.x < this->position.x)
{
if (!a->isFlippedHorizontal())
a->flipHorizontal();
}
else
{
if (a->isFlippedHorizontal())
a->flipHorizontal();
}
if (getEntityType() == ET_NEUTRAL)
flipToTarget(dsq->game->avatar->position);
}
*/
runningActivation = true; runningActivation = true;
if (script) if (script)
@ -940,15 +762,6 @@ void ScriptedEntity::onEnterState(int action)
strands.clear(); strands.clear();
// BASE ENTITY CLASS WILL HANDLE CLEANING UP HAIR // BASE ENTITY CLASS WILL HANDLE CLEANING UP HAIR
/*
if (hair)
{
hair->setLife(1.0);
hair->setDecayRate(10);
hair->fadeAlphaWithLife = true;
hair = 0;
}
*/
break; break;
} }
} }

View file

@ -91,7 +91,7 @@ protected:
void luaDebugMsg(const std::string &func, const std::string &msg); void luaDebugMsg(const std::string &func, const std::string &msg);
float crushDelay; float crushDelay;
int beforePullMaxSpeed; int beforePullMaxSpeed;
bool songNoteFunction, preUpdateFunc; bool songNoteFunction;
bool songNoteDoneFunction; bool songNoteDoneFunction;
std::vector<ParticleEffect*> emitters; std::vector<ParticleEffect*> emitters;
bool becomeSolidDelay; bool becomeSolidDelay;