From 9eb5b9828a6b0f5dae2b04fe98ecb57acf54a65d Mon Sep 17 00:00:00 2001 From: fgenesis Date: Wed, 19 Dec 2012 06:23:51 +0100 Subject: [PATCH] clean out some dead code and some old commented out code --- Aquaria/Avatar.cpp | 1987 +------------------------------------------- Aquaria/Avatar.h | 80 +- Aquaria/DSQ.cpp | 10 +- Aquaria/DSQ.h | 1 - Aquaria/Entity.cpp | 33 - Aquaria/Entity.h | 2 - Aquaria/Game.cpp | 5 +- BBGE/Core.cpp | 3 - BBGE/Core.h | 2 +- 9 files changed, 24 insertions(+), 2099 deletions(-) diff --git a/Aquaria/Avatar.cpp b/Aquaria/Avatar.cpp index d75802f..82c3101 100644 --- a/Aquaria/Avatar.cpp +++ b/Aquaria/Avatar.cpp @@ -117,9 +117,6 @@ const float NOTE_ACCEPT_DISTANCE = 25; // we accept a note. const float NOTE_ACCEPT_ANGLE_OFFSET = 15; -volatile int micNote = -1; -bool openedFromMicInput = false; - const int requiredDualFormCharge = 3; bool usingDigital = false; @@ -462,7 +459,7 @@ void SongIcon::onUpdate(float dt) } if (alpha.x == 1) { - if ((!openedFromMicInput && isCoordinateInRadius(core->mouse.position, NOTE_ACCEPT_DISTANCE)) || micNote == note) + if (isCoordinateInRadius(core->mouse.position, NOTE_ACCEPT_DISTANCE)) { //if (delay == 0) if (true) @@ -487,7 +484,7 @@ void SongIcon::onUpdate(float dt) } } } - else if (openedFromMicInput || !isCoordinateInRadius(core->mouse.position, NOTE_ACCEPT_DISTANCE*1.25f)) + else if (!isCoordinateInRadius(core->mouse.position, NOTE_ACCEPT_DISTANCE*1.25f)) { if (cursorIsIn) { @@ -727,7 +724,6 @@ AvatarState::AvatarState() wasUnderWater = true; blind = false; lockedToWall = false; - crawlingOnWall = false; shotDelay = 0; spellCharge = 0; leachTimer = 0; @@ -738,14 +734,6 @@ AvatarState::AvatarState() blinkTimer = 0; } -// 0 1 2 3 4 5 6 7 8 9 -const int spellManaCost [] = { 0, 3, 1, 1, 2, 1, 4, 1, 1, 2}; -const float spellChargeMins [] = { 0, 1.25, 0, 0, 0.75, 0, 0.5, 0, 0, 3}; -//const float spellChargeMaxs [] = { 0.75, 1.5, 1.9, 1, 1, 1, 0.75, 1, 1, 3}; -const float spellCastDelays [] = { 0.05, 0.2, 0.4, 0.1, 0.1, 0.1, 0.2, 0.1, 0.1, 0.1 }; - -bool avatarDebugEnabled = false; - void Avatar::toggleMovement(bool on) { canMove = on; @@ -946,30 +934,6 @@ void Avatar::updatePosition() updateHair(0); } -void Avatar::debugMsg(const std::string &msg) -{ - if (avatarDebugEnabled) - { - BitmapText *txt = new BitmapText(&dsq->font); - txt->setLife(2); - txt->setDecayRate(1); - txt->position = this->position; - txt->setText(msg); - txt->fadeAlphaWithLife = true; - core->getTopStateData()->addRenderObject(txt, LR_DEBUG_TEXT); - } -} - -void Avatar::onBlindTest() -{ - setBlind(5); -} - -void Avatar::onToggleDebugMessages() -{ - avatarDebugEnabled = !avatarDebugEnabled; -} - void Avatar::updateHair(float dt) { static float hairTimer = 0; @@ -1451,170 +1415,9 @@ void Avatar::clearTargets() } } -void Avatar::slowToRest() -{ - vel.capLength2D(50); - /* - if (vel.getSquaredLength2D() > sqr(50)) - { - vel.setLength2D(50); - } - */ - bursting = swimming = false; - skeletalSprite.stopAnimation(1); - rotation.interpolateTo(Vector(0,0,0), 0.2, 0, 0, 1); -} - -/* -#define SPECWIDTH 368 -#define SPECHEIGHT 127 -BYTE *specbuf = 0; -*/ - -volatile int curMicNote = -1, lastMicNote=-1; - -#ifdef BBGE_BUILD_RECORD - volatile float timeFromLastNote=0; - volatile float timerFreq; - volatile float lastLargest=0; - volatile bool inMe = false; - volatile __int64 lastTick = 0; -#endif - - /* -BOOL CALLBACK recordCallback(HRECORD handle, const void *buf, DWORD len, DWORD user) -{ - -#ifdef BBGE_BUILD_RECORD - if (inMe) return TRUE; - inMe = true; - - //if (!dsq->game->avatar->isSinging()) return FALSE; - //int x,y; - - //timerFreq = - __int64 freq=0; - QueryPerformanceFrequency((LARGE_INTEGER*)&freq); - __int64 curTime=0; - QueryPerformanceCounter((LARGE_INTEGER*)&curTime); - if (lastTick == 0) - { - lastTick = curTime; - } - - float fft[4096]; // get the FFT data - BASS_ChannelGetData(handle,fft,BASS_DATA_FFT4096); - - int v = 0; - int c = 0; - float largest = -1; - - //128 - //for (int i = 5; i < 13; i++) - for (int i = 12; i < 64; i++) - { - if (fft[i] > 0.01f && (fft[i] > largest || largest == -1)) - { - largest = fft[i]; - v = i; - } - } - - int v2=0; - largest = -1; - // find the next largest - - float dt = (float(curTime-lastTick)/float(freq)); - lastTick = curTime; - int posMicNote=-1; - if (c != 0) - v /= float(c); - int ov = v; - float factor=1.0; - int octave = dsq->user.audio.octave; - - int minNote = 12;///6; - int maxNote = minNote + 25; // 8 - int octRange = 11; - - minNote += (octRange)*octave; - maxNote += (octRange)*octave; - - posMicNote = dsq->fftnotes.getNoteFromFFT(v, octave); - - //if (lastLargest 0.0001f) - { - micNote = curMicNote; - timeFromLastNote = 0; - } - if (curMicNote == -1) - micNote = -1; - lastMicNote = curMicNote; - - inMe = false; -#endif - return TRUE; -} -*/ - -/* - -class FoodIcon2 : public Quad -{ -}; - -class FoodIcon : public Quad -{ -public: - FoodIcon(IngredientEffectType iet); - - IngredientEffectType type; - - void -}; - -void Avatar::openFoodInterface() -{ - if (!singing && !pickingPullTarget && health > 0 && !isEntityDead() && !blockSinging) - { - // build it - foodIcons.clear(); - - foodIcons.resize(8); - } -} -*/ - void Avatar::openSingingInterface() { - if (!singing && !pickingPullTarget && health > 0 && !isEntityDead() && !blockSinging) + if (!singing && health > 0 && !isEntityDead() && !blockSinging) { //core->mouse.position = Vector(400,300); if (dsq->inputMode != INPUT_MOUSE) @@ -1635,19 +1438,10 @@ void Avatar::openSingingInterface() } currentSong.notes.clear(); - // songInterfaceTimer = 0; dsq->game->songLineRender->clear(); - //if (avatarRecord) - //{ - // if (dsq->useMic && !dsq->autoSingMenuOpen && dsq->user.audio.micOn) - // { - // //avatarRecord=BASS_RecordStart(44100,1,0,&recordCallback,0); - // BASS_ChannelPlay(avatarRecord, false); - // } - //} if (dsq->inputMode == INPUT_JOYSTICK) { @@ -1686,48 +1480,6 @@ void Avatar::closeSingingInterface() dsq->continuity.castSong(currentSongIdx); currentSongIdx = SONG_NONE; } - - /* - if (avatarRecord) - { - if (dsq->useMic && !dsq->autoSingMenuOpen && dsq->user.audio.micOn) - { - //BASS_ChannelStop(avatarRecord); - BASS_ChannelPause(avatarRecord); - //BASS_RecordFree(); - //avatarRecord = 0; - - } - } - */ - - lastMicNote = curMicNote = micNote = -1; - } -} - -void Avatar::openFormInterface() -{ - if (!inFormInterface) - { - inFormInterface = true; - - for(int i = 0; i < formIcons.size(); i++) - { - formIcons[i]->alpha.interpolateTo(1, 0.1); - } - } -} - -void Avatar::closeFormInterface() -{ - if (inFormInterface) - { - inFormInterface = false; - - for (int i = 0; i < formIcons.size(); i++) - { - formIcons[i]->alpha.interpolateTo(0, 0.1); - } } } @@ -1874,7 +1626,6 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF state.abilityDelay = 0; formAbilityDelay = 0; dsq->continuity.form = form; - ropeState = 0; formTimer = 0; if (effects) { @@ -2092,33 +1843,10 @@ void Avatar::singNote(int note) { currentSong.notes.push_back(note); lastNote = note; - //int song = dsq->continuity.checkSong(currentSong); - //int song = dsq->continuity.checkSongAssisted(currentSong); - //int song = dsq->continuity.checkSongAssisted(currentSong); - /* - std::ostringstream os; - os << "sung note: " << note; - debugLog(os.str()); - */ - //currentSongIdx = song; - /* - if (song != -1) - { - */ - /* - std::ostringstream os; - os << "Sung Song: " << song; - debugLog(os.str()); - */ - // close in a few seconds - //closeSingingInterface(); - //} } void Avatar::updateSingingInterface(float dt) { - - //if (singing) if (songIcons.size()>0 && songIcons[0]->alpha.x > 0) { if (dsq->inputMode != INPUT_JOYSTICK && !core->mouse.change.isZero()) @@ -2902,12 +2630,6 @@ void Avatar::formAbility(int ability) { if (chargeLevelAttained == 2) { - /* - shockTimer = 1; - damageDelay = 0.2; - didShockDamage = false; - */ - didShockDamage = false; if (dsq->continuity.hasFormUpgrade(FORMUPGRADE_ENERGY2)) doShock("EnergyTendril2"); else @@ -3438,70 +3160,6 @@ void Avatar::doShock(const std::string &shotName) { targets.clear(); } - - - /* - // old method - for (int i = 0; i < entitiesToHit.size(); i++) - { - Entity *e = entitiesToHit[i]; - DamageData d; - d.attacker = this; - d.damageType = DT_AVATAR_SHOCK; - d.damage = 3; - e->damage(d); - - dsq->playVisualEffect(VFX_SHOCKHIT, e->position, e); - - EnergyTendril *t = new EnergyTendril(this, e); - core->addRenderObject(t, LR_PARTICLES); - - e->shock(); - } - */ - - //HACK: WHAT DOES THIS VARIABLE DO EXACTLY? - didShockDamage = true; - - - //loseTargets(); -} - -void Avatar::updateShock(float dt) -{ - /* - if (shockTimer > 0) - { - float shockTime = 0.75; - castShockTimer += dt; - std::vector closestEntities; - unsigned int c=0; - const float shotDelayTime = 0.05; - - - if (damageDelay > 0) - { - damageDelay -= dt; - if (damageDelay <= 0) - damageDelay = 0; - } - - if (damageDelay == 0) - { - } - - if (damageDelay == 0) - { - damageDelay = 999; - } - - shockTimer -= dt; - if (shockTimer < 0) - { - shockTimer = 0; - } - } - */ } void Avatar::formAbilityUpdate(float dt) @@ -3534,58 +3192,6 @@ void Avatar::formAbilityUpdate(float dt) break; case FORM_ENERGY: { - /* - if (core->mouse.buttons.right && mana > 0 && !core->mouse.buttons.left) - { - float shockTime = 0.75; - castShockTimer += dt; - std::vector closestEntities; - unsigned int c=0; - const float shotDelayTime = 0.05; - - - int maxHit = 2 + dsq->continuity.getSpellLevel(SPELL_SHOCK)*2; - FOR_ENTITIES (i) - { - Entity *e = *i; - Vector d = e->position - this->position; - if (e != this && !e->isEntityDead() && e->isAffectedBySpell(SPELL_SHOCK) && d.getSquaredLength2D() < sqr(400+(dsq->continuity.getSpellLevel(SPELL_SHOCK)-1)*100)) - { - state.shotDelay += dt; - if (state.shotDelay > shotDelayTime) - { - state.shotDelay -= shotDelayTime; - - EnergyTendril *t = new EnergyTendril(avatar->position, e->position); - core->addRenderObject(t, LR_PARTICLES); - } - e->offset.x = rand()%5; - e->shock(); - DamageData d; - d.attacker = this; - d.spellType = SPELL_SHOCK; - d.damage = 1+(dsq->continuity.getSpellLevel(SPELL_SHOCK)-1)*1; - e->hit(d); - c ++; - } - if (c >= maxHit) - break; - } - //std::ostringstream os; - //os << "castShockTimer: " << castShockTimer << " - shockTime: " << shockTime; - //debugLog(os.str()); - if (castShockTimer > shockTime) - { - castShockTimer -= shockTime; - mana --; - } - } - else - { - state.shotDelay = 0; - endShock(); - } - */ } break; } @@ -3600,14 +3206,6 @@ bool Avatar::isMouseInputEnabled() return true; } -int rmb_flag = 0; -void Avatar::rmbd2() -{ - rmb_flag = 1; - rmbd(); - rmb_flag = 0; -} - void Avatar::rmbd() { //core->setDockIcon("BitBlot"); @@ -3616,7 +3214,7 @@ void Avatar::rmbd() { //if (isCoordinateInRadius(dsq->getGameCursorPosition(), 96)) ///Vector diff = core->mouse.position - c; - if (dsq->inputMode == INPUT_MOUSE && !rmb_flag) + if (dsq->inputMode == INPUT_MOUSE) { Vector diff = getVectorToCursorFromScreenCentre(); if (diff.getSquaredLength2D() < sqr(openSingingInterfaceRadius)) @@ -3629,13 +3227,8 @@ void Avatar::rmbd() } else { - if (spellCastDelay == 0) - startCharge(0); + startCharge(0); } - /* - if (spellCastDelay == 0) - startCharging(1); - */ } void Avatar::rmbu() @@ -3654,17 +3247,6 @@ void Avatar::rmbu() dsq->cursorGlow->alpha.interpolateTo(0, 0.2); dsq->cursorBlinker->alpha.interpolateTo(0, 0.2); - if (pickingPullTarget) - { - if (potentialPullTarget) - { - pullTarget = potentialPullTarget; - debugLog("Calling start pull"); - pullTarget->startPull(); - } - closePullTargetInterface(); - } - if (singing) { closeSingingInterface(); @@ -3681,16 +3263,6 @@ void Avatar::rmbu() pathToActivate->activate(); pathToActivate = 0; } - - - - /* - if (charging) - { - formAbility(1); - endCharge(); - } - */ } bool Avatar::canCharge(int ability) @@ -3701,22 +3273,9 @@ bool Avatar::canCharge(int ability) if (ability == 0) return true; break; case FORM_BEAST: - //if (inTummy) return true; + return false; break; case FORM_DUAL: - /* - if (dualFormMode == DUALFORM_NAIJA) - { - if (dualFormCharge >= requiredDualFormCharge) - { - return true; - } - } - else - { - return true; - } - */ return true; break; case FORM_NATURE: @@ -3746,17 +3305,8 @@ void Avatar::startCharge(int ability) dsq->loops.charge = core->sound->playSfx(sfx); state.spellCharge = 0; - spellChargeMin = 0; chargeLevelAttained = 0; - /* - chargeGraphic->alpha = 0; - chargeGraphic->scale = Vector(0,0); - chargeGraphic->alpha.interpolateTo(0.6, chargeMax, 0); - float sz = 1.5; - chargeGraphic->scale.interpolateTo(Vector(sz,sz), chargeMax, 0); - */ - switch(dsq->continuity.form) { case FORM_ENERGY: @@ -3779,7 +3329,6 @@ void Avatar::startCharge(int ability) chargingEmitter->start(); charging = true; - abilityCharging = ability; } if (!canCharge(ability)) @@ -3795,11 +3344,6 @@ void Avatar::setBlockSinging(bool v) bool Avatar::canSetBoneLock() { - /* - if (dsq->continuity.form == FORM_FISH || dsq->continuity.form == FORM_SPIRIT) - return false; - */ - return true; } @@ -3849,13 +3393,6 @@ void Avatar::lmbd() } } } - /* - else - { - if (spellCastDelay == 0) - startCharging(0); - } - */ } void Avatar::fallOffWall() @@ -3910,17 +3447,6 @@ void Avatar::endCharge() dsq->loops.charge = BBGE_AUDIO_NOCHANNEL; } - - /* - std::ostringstream os; - os << "spellCharge: " << spellCharge; - debugLog(os.str()); - */ - /* - chargeGraphic->alpha.interpolateTo(0, 0.5, 0); - chargeGraphic->scale.interpolateTo(Vector(0,0), 1.0, 0); - */ - chargingEmitter->stop(); charging = false; @@ -3931,37 +3457,6 @@ void Avatar::endCharge() Vector Avatar::getWallNormal(TileVector t) { return dsq->game->getWallNormal(t.worldVector(), 5)*-1; - - /* - Vector accum; - int c = 0; - for (int x = -2; x <= 2; x++) - { - for (int y = -2; y <= 2; y++) - { - TileVector check = t; - check.x+=x; - check.y+=y; - if (!dsq->game->isObstructed(check)) - { - Vector v(check.x, check.y); - c++; - accum+= v; - } - //check.x+x, check.y+y - } - } - if (c > 0) - { - accum /= c; - //accum.normalize2D(); - accum.setLength2D(-1); - return accum; - } - Vector v = vel; - v.setLength2D(-1); - return v; - */ } int Avatar::getSingingInterfaceRadius() @@ -3993,7 +3488,6 @@ void Avatar::lockToWallCommon() stopRoll(); core->sound->playSfx("LockToWall", 1.0, 0);//, (1000+rand()%100)/1000.0f); //bursting = false; - animatedBurst = false; this->burst = 1; //lastLockToWallPos = position; @@ -4016,11 +3510,6 @@ void Avatar::lockToWall() if (vel.x == 0 && vel.y == 0) return; if (dsq->game->isPaused()) return; - /* - Vector opos = position; - position = lastPosition; - */ - TileVector t(position); TileVector myTile = t; // 3 + 4 @@ -4029,12 +3518,7 @@ void Avatar::lockToWall() m.setLength2D(3); t.x += int(m.x); t.y += int(m.y); - /* - TileVector t2 = t; - m.setLength2D(4); - t2.x += int(m.x); - t2.y += int(m.y); - */ + m.setLength2D(2); TileVector tback = myTile; tback.x += int(m.x); @@ -4046,27 +3530,6 @@ void Avatar::lockToWall() tnext.x += int(add.x); tnext.y += int(add.y); - // find the fraking wall - /* - TileVector actualWall = myTile; - Vector lastWall; - Vector getWall(myTile.x, myTile.y); - for (int i = -1; i < 5; i++) - { - getWall.x += add.x*i; - getWall.y += add.y*i; - if (lastWall.isZero()) - lastWall = getWall; - TileVector test(getWall.x, getWall.y); - if (dsq->game->isObstructed(test)) - break; - lastWall = getWall; - } - actualWall = TileVector(lastWall.x, lastWall.y); - */ - - Vector diff = lastLockToWallPos - position; - bool good = true; if (!dsq->game->isObstructed(t)) { @@ -4168,12 +3631,6 @@ void Avatar::lockToWall() } else { - - /* - position = TileVector(position).worldVector(); - lastPosition = position; - */ - if (!dsq->mod.isActive() && !dsq->continuity.getFlag("lockedToWall")) { @@ -4190,9 +3647,6 @@ void Avatar::lockToWall() else lockToWallFallTimer = -1; - //wallPushVec = getWallNormal(t); - - wallPushVec = wallNormal; wallPushVec *= 2000; wallPushVec.z = 0; @@ -4248,47 +3702,12 @@ void Avatar::lockToWall() { time = len/spd; } - /* - std::ostringstream os; - os << "time: " << time; - debugLog(os.str()); - */ offset.interpolateTo(offdiff, time); - /* - if (tileType == OT_INVISIBLEIN) - { - goIn = wallNormal; - goIn.setLength2D(-28); - } - else - { - Vector diff = uset.worldVector()-position; - goIn = diff; - } - offset.interpolateTo(goIn, 0.05); - */ wallLockTile = t; vel = Vector(0,0,0); vel2 = 0; - - /* - Vector oldPos = position; - - while (true) - { - Vector m = vel; - m |= 1; - position += m; - TileVector t(position); - if (dsq->game->isObstructed(t, OT_BLACK)) - { - position = oldPos; - break; - } - } - */ } } else @@ -4405,28 +3824,6 @@ void Avatar::setNearestPullTarget() } } -void Avatar::openPullTargetInterface() -{ - debugLog("Open pull target"); - if (pullTarget) - { - pullTarget->stopPull(); - } - pullTarget = 0; - potentialPullTarget = 0; - pickingPullTarget = true; - // change the cursor - dsq->cursor->color = Vector(0.5,0.5,1); -} - -void Avatar::closePullTargetInterface() -{ - debugLog("close pull target"); - pickingPullTarget = false; - potentialPullTarget = 0; - dsq->cursor->color = Vector(1,1,1); -} - void Avatar::createWeb() { web = new Web; @@ -4455,7 +3852,6 @@ Avatar::Avatar() : Entity(), ActionMapper() urchinDelay = 0; jellyDelay = 0; - warpIn = false; #ifdef AQ_TEST_QUADTRAIL quadTrail = new QuadTrail(100, 32); quadTrail->setTexture("Particles/QuadTrail"); @@ -4485,7 +3881,6 @@ Avatar::Avatar() : Entity(), ActionMapper() //registerEntityDied = true; setv(EV_ENTITYDIED, 1); - wallJumps = 0; wallBurstTimer = 0; beautyFlip = false; invincibleBreak = true; @@ -4494,7 +3889,6 @@ Avatar::Avatar() : Entity(), ActionMapper() songInterfaceTimer = 0; quickSongCastDelay = 0; flourish = false; - tummyAmount=0; blockSinging = false; singing = false; @@ -4519,31 +3913,17 @@ Avatar::Avatar() : Entity(), ActionMapper() fallGravityTimer = 0; lastOutOfWaterMaxSpeed = 0; //chargeGraphic = 0; - tummyTimer = 0; - inTummy = EAT_NONE; - ropeTimer = shieldPoints = auraTimer = 0; + shieldPoints = auraTimer = 0; glow = 0; fireDelay = 0; - inFormInterface = false; looking = false; - canWarpDelay = 0.5; - canWarp = false; rollDidOne = 0; lastQuad = lastQuadDir = rollDelay = rolling = 0; - stopTimer = 0; - doubleClickDelay = 0; - damageDelay = 0; - didShockDamage = false; chargeLevelAttained = 0; - shockTimer = 0; activeAura = AURA_NONE; - ropeState = 0; movingOn = false; currentMaxSpeed = 0; - abilityCharging = -1; - pickingPullTarget = false; - potentialPullTarget = 0; pullTarget = 0; revertTimer = 0; currentSongIdx = -1; @@ -4556,7 +3936,6 @@ Avatar::Avatar() : Entity(), ActionMapper() activateEntity = 0; canMove = true; - castShockTimer = 0; //scale = Vector(0.5, 0.5); scale = Vector(0.5, 0.5); @@ -4569,9 +3948,6 @@ Avatar::Avatar() : Entity(), ActionMapper() targets.resize(1); - - lastEntityActivation = 0; - entityToActivate = 0; pathToActivate = 0; zoomOverriden = false; @@ -4580,17 +3956,14 @@ Avatar::Avatar() : Entity(), ActionMapper() zoomVel = 0; myZoom = Vector(1,1); - spellChargeMin = spellCastDelay = 0; this->pushingOffWallEffect = 0; lockToWallFallTimer = 0; swimming = false; charging = false; bursting = false; - animatedBurst = false; burst = 1; burstDelay = 0; ignoreInputDelay = 0; - idleAnimDelay = 2; splashDelay = 0; avatar = this; @@ -4654,27 +4027,6 @@ Avatar::Avatar() : Entity(), ActionMapper() fader->alpha = 0; dsq->game->addRenderObject(fader, LR_AFTER_EFFECTS); - text = 0; - - /* - chargeGraphic = new Particle; - { - chargeGraphic->setBlendType(RenderObject::BLEND_ADD); - chargeGraphic->setTexture("glow"); - chargeGraphic->alpha = 0; - //chargeGraphic->color = Vector(1,,0); - chargeGraphic->width = 128; - chargeGraphic->height = 128; - chargeGraphic->scale = Vector(0,0); - chargeGraphic->parentManagedPointer = 1; - //chargeGraphic->positionSnapTo = &this->position; - chargeGraphic->rotation.interpolateTo(Vector(0,0,360), 1, -1, 1); - chargeGraphic->position = Vector(16, 58); - //chargeGraphic->color = Vector(1,0.2,0.1); - } - //skeletalSprite.getBoneByIdx(3)->addChild(chargeGraphic); - */ - debugLog("Avatar 6"); targetQuads.resize(targets.size()); @@ -4728,10 +4080,6 @@ Avatar::Avatar() : Entity(), ActionMapper() chargingEmitter = new ParticleEffect; dsq->getTopStateData()->addRenderObject(chargingEmitter, LR_PARTICLES); - /* - addChild(&chargingEmitter); - chargingEmitter.parentManagedStatic = true; - */ chargeEmitter = new ParticleEffect; dsq->getTopStateData()->addRenderObject(chargeEmitter, LR_PARTICLES_TOP); @@ -4742,19 +4090,6 @@ Avatar::Avatar() : Entity(), ActionMapper() rightHandEmitter = new ParticleEffect; dsq->getTopStateData()->addRenderObject(rightHandEmitter, LR_PARTICLES); - /* - leftHandEmitter = new ParticleEffect; - dsq->getTopStateData()->addRenderObject(`, LR_PARTICLES); - - rightHandEmitter = new ParticlesEffect; - dsq->getTopStateData()->addRenderObject(rightHandEmitter, LR_PARTICLES); - */ - - /* - addChild(&chargeEmitter); - chargeEmitter.parentManagedStatic = true; - */ - addChild(&biteLeftEmitter, PM_STATIC); biteLeftEmitter.load("BiteLeft"); @@ -4792,30 +4127,6 @@ Avatar::Avatar() : Entity(), ActionMapper() debugLog("Avatar 9"); - if (dsq->useMic) - { - debugLog("useMic...initing recording"); - - /* - debugLog("RecordStart..."); - avatarRecord = BASS_RecordStart(44100,1,0,&recordCallback,0); - - if (avatarRecord) - { - if (dsq->autoSingMenuOpen) - { - } - else - { - debugLog("ChannelPause..."); - BASS_ChannelPause(avatarRecord); - } - } - debugLog("...done"); - */ - } - - debugLog("Avatar 10"); setDamageTarget(DT_AVATAR_LANCE, false); //changeForm(FORM_NORMAL, false); @@ -4943,8 +4254,6 @@ void Avatar::destroy() { Entity::destroy(); - text = 0; - if (dsq->loops.shield != BBGE_AUDIO_NOCHANNEL) { core->sound->fadeSfx(dsq->loops.shield, SFT_OUT, 1); @@ -4959,24 +4268,6 @@ void Avatar::destroy() avatar = 0; } -void Avatar::fireRope() -{ - ropeVel = getAim(); - ropeVel.z = 0; - if (!ropeVel.isLength2DIn(1)) - { - ropeTimer = 0.2; - ropeState = 1; - ropePos = position; - //ropeVel = core->mouse.position - Vector(400,300); - - ropeVel.setLength2D(7000); - //ropeVel |= 500; - } - else - ropeVel = Vector(0,0,0); -} - void Avatar::toggleZoom() { if (core->globalScale.isInterpolating()) return; @@ -4989,20 +4280,8 @@ void Avatar::toggleZoom() else if (core->globalScale.x == 0.25) core->globalScale.interpolateTo(Vector(1,1),0.2); - /* - else if (core->globalScale.x == 1.5) - core->globalScale.interpolateTo(Vector(1,1),0.2); - */ - } -/* -void Avatar::setActiveSpell(Spells spell) -{ - activeSpell = spell; -} -*/ - void Avatar::startBackFlip() { if (boneLock.on) return; @@ -5050,24 +4329,6 @@ void Avatar::startBurstCommon() void Avatar::startBurst() { - //getVectorToCursorFromScreenCentre() - //!bursting && burst == 1 - //&& - /* - bool nearWallProblem = false; - if (vel.isLength2DIn(200)) - { - if () - { - nearWallProblem = false - } - else - { - nearWallProblem = true; - } - } - */ - //&& !vel.isLength2DIn(32) if (!riding && dsq->continuity.form != FORM_SPIRIT && (joystickMove || getVectorToCursor().getSquaredLength2D() > sqr(BURST_DISTANCE)) && getState() != STATE_PUSH && (!skeletalSprite.getCurrentAnimation() || (skeletalSprite.getCurrentAnimation()->name != "spin")) && _isUnderWater && !isActing(ACTION_ROLL)) @@ -5146,35 +4407,6 @@ void Avatar::startWallBurst(bool useCursor) if (goDir.x != 0 || goDir.y != 0) { lastBurstType = BURST_WALL; - /* - if (wallBurstTimer > 0) - { - Vector wallJumpDir = position - lastWallJumpPos; - if (lastWallJumpPos.isZero() || wallJumpDir.dot2D(lastWallJumpPos) > 0.2f) - { - std::ostringstream os; - os << "wallJumps: " << wallJumps; - debugLog(os.str()); - wallJumps++; - } - else - { - debugLog("failed angle"); - stopWallJump(); - } - } - wallBurstTimer = 0.8f - 0.1f * wallJumps; - if (wallBurstTimer <= 0) - { - // super boost! - debugLog("super boost!"); - wallJumps = 0; - } - - - lastWallJumpPos = position; - lastWallJumpDir = position - lastWallJumpPos; - */ dsq->rumble(0.22, 0.22, 0.2); bittenEntities.clear(); @@ -5201,10 +4433,6 @@ void Avatar::startWallBurst(bool useCursor) vel = wallPushVec; this->state.lockedToWall = false; skeletalSprite.stopAllAnimations(); - if (wallJumps > 0) - { - dsq->sound->playSfx("WallJump", 255, 0, 1000+wallJumps*100); - } dsq->game->playBurstSound(pushingOffWallEffect>0); skeletalSprite.animate(getBurstAnimName(), 0); bursting = true; @@ -5212,33 +4440,6 @@ void Avatar::startWallBurst(bool useCursor) ripples = true; startBurstCommon(); - /* - if (core->afterEffectManager) - core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter,0.04,0.06,15,0.2f)); - */ - - - /* - float len = wallPushVec.getLength2D(); - goDir |= len; - goDir.z = 0; - - Vector test = goDir; - test |= TILE_SIZE*2; - if (dsq->game->isObstructed(TileVector(position + test))) - { - } - else - wallPushVec = goDir; - */ - /* - wallPushVec = Vector((wallPushVec.x+goDir.x)/2, (wallPushVec.y+goDir.y)/2); - wallPushVec |= len; - */ - } - else - { - //wallPushVec |= 10; } } } @@ -5286,18 +4487,6 @@ Vector Avatar::getFakeCursorPosition() Vector Avatar::getVectorToCursorFromScreenCentre() { - /* - if (core->joystickEnabled) - { - Vector joy(core->joystate.lX-(65536/2), core->joystate.lY-(65536/2)); - float len = (joy.getLength2D() * 600) / 65536; - joy.setLength2D(len); - std::ostringstream os; - os << "joy (" << joy.x << ", " << joy.y << ")"; - debugLog(os.str()); - return joy; - } - */ if (game->cameraOffBounds) return getVectorToCursor(); else @@ -5321,20 +4510,6 @@ Vector Avatar::getVectorToCursor(bool trueMouse) //return core->mouse.position - Vector(400,300); } -void Avatar::startWallCrawl() -{ - lastWallNormal = wallNormal; - state.crawlingOnWall = true; - skeletalSprite.transitionAnimate("crawl", 0.1, -1); -} - -void Avatar::stopWallCrawl() -{ - state.crawlingOnWall = false; - state.lockedToWall = false; - idle(); -} - void Avatar::action(int id, int state) { if (id == ACTION_PRIMARY) { if (state) lmbd(); else lmbu(); } @@ -5344,31 +4519,15 @@ void Avatar::action(int id, int state) { if (isMiniMapCursorOkay()) { - if (this->state.lockedToWall && !this->state.crawlingOnWall) + if (this->state.lockedToWall) { Vector test = getVectorToCursor(); if (test.isLength2DIn(minMouse)) { fallOffWall(); - // previously didn't fall off wall with mouse.... why? - /* - //fallOffWall(); - if (dsq->inputMode == INPUT_JOYSTICK || dsq->inputMode == INPUT_KEYBOARD) - fallOffWall(); - */ } - /* - else if (test.isLength2DIn(maxMouse)) - { - this->state.lockedToWall = false; - idle(); - } - */ else { - //if (dsq->continuity.setFlag("lockedToWall", 1) - - //!boneLock.entity && if (boneLock.entity) wallNormal = boneLock.wallNormal; @@ -5406,15 +4565,6 @@ void Avatar::action(int id, int state) } } - /* - else - { - wallNormal = getWallNormal(TileVector(position)); - Vector left = wallNormal.getPerpendicularLeft(); - Vector right = wallNormal.getPerpendicularRight(); - position += left*0.1f; - } - */ } else { @@ -5430,24 +4580,7 @@ void Avatar::action(int id, int state) } } } - /* - // song note keys - else if (!action.empty() && action[0] == 's') - { - if (isSinging()) - { - int count=0; - std::istringstream is(action.substr(1, action.size())); - is >> count; - count--; - if (count >= 0 && count <= 7) - { - core->setMousePosition(songIcons[count]->position); - } - } - } - */ else if (id >= ACTION_SONGSLOT1 && id < ACTION_SONGSLOTEND) { if (canQuickSong()) @@ -5555,240 +4688,6 @@ void Avatar::action(int id, int state) } } -void Avatar::doRangePull(float dt) -{ - int range = 4; - Vector total; - - Vector dest = position + vel*dt; - TileVector t(dest); - std::vector vectors; - for (int x = t.x-range; x <= t.x+range; x++) - { - for (int y = t.y-range; y <= t.y+range; y++) - { - TileVector tile(x,y); - if (!(tile.x == t.x && tile.y == t.y) && !dsq->game->isObstructed(tile) - && !dsq->game->isObstructed(TileVector(tile.x+1, tile.y)) - && !dsq->game->isObstructed(TileVector(tile.x, tile.y+1)) - && !dsq->game->isObstructed(TileVector(tile.x-1, tile.y)) - && !dsq->game->isObstructed(TileVector(tile.x, tile.y+1)) - ) - { - vectors.push_back(tile.worldVector()); - /* - Vector obs = tile.worldVector(); - Vector mov = position - obs; - - int len = range*TILE_SIZE - mov.getLength2D(); - if (len < 0) len = 1; - mov |= len; - total += mov; - */ - } - } - } - - unsigned int amount = 5; - if (amount > vectors.size()) - amount = vectors.size(); - std::vectorsmallestDists; - smallestDists.resize(amount); - int i = 0; - for (i = 0; i < smallestDists.size(); i++) - { - smallestDists[i] = 0x7FFFFFFF; - } - std::vector closestVectors; - closestVectors.resize(amount); - for (i = 0; i < vectors.size(); i++) - { - Vector diff = dest - vectors[i]; - int dist = diff.getSquaredLength2D(); - for (int j = 0; j < smallestDists.size(); j++) - { - if (dist < smallestDists[j]) - { - for (int k = smallestDists.size()-1; k > j; k--) - { - smallestDists[k] = smallestDists[k-1]; - closestVectors[k] = closestVectors[k-1]; - } - smallestDists[j] = dist; - closestVectors[j] = vectors[i]; - } - } - } - - for (i = 0; i < closestVectors.size(); i++) - { - Vector obs = closestVectors[i]; - if (obs.x == 0 && obs.y == 0) continue; - Vector mov = obs - position; - - int len = range*TILE_SIZE - mov.getLength2D(); - if (len < 0) len = 0; - else - { - mov.setLength2D(len); - total += mov; - } - } - - if (total.x != 0 || total.y != 0) - { - //float vlen = vel.getLength2D(); - //float len = (range*TILE_SIZE - avgDist)/range*TILE_SIZE; - //if (len > 0) - { - if (bursting && swimming) - { - total.setLength2D(dt*4000); - } - else if (swimming) - { - //vel = Vector(0,0,0); - //vel |= vlen; - total.setLength2D(dt*1000); - } - else - { - total.setLength2D(dt*200); - } - vel += total; - } - /* - if (vlen < 250) - { - total |= 200*dt; - } - else - */ - /* - { - total |= 500*dt; - } - */ - - } -} - -void Avatar::doRangePush(float dt) -{ - // current not used - /* - if (vel.getSquaredLength2D() < sqr(1)) return; - int range = 4; - Vector total; - TileVector t(position); - std::vector vectors; - for (int x = t.x-range; x <= t.x+range; x++) - { - for (int y = t.y-range; y <= t.y+range; y++) - { - TileVector tile(x,y); - if (dsq->game->isObstructed(tile)) - { - vectors.push_back(tile.worldVector()); - } - } - } - - int amount = 5; - if (amount > vectors.size()) - amount = vectors.size(); - std::vectorsmallestDists; - smallestDists.resize(amount); - for (int i = 0; i < smallestDists.size(); i++) - { - smallestDists[i] = 0x7FFFFFFF; - } - std::vector closestVectors; - closestVectors.resize(amount); - for (int i = 0; i < vectors.size(); i++) - { - Vector diff = position - vectors[i]; - int dist = diff.getSquaredLength2D(); - for (int j = 0; j < smallestDists.size(); j++) - { - if (dist < smallestDists[j]) - { - for (int k = smallestDists.size()-1; k > j; k--) - { - smallestDists[k] = smallestDists[k-1]; - closestVectors[k] = closestVectors[k-1]; - } - smallestDists[j] = dist; - closestVectors[j] = vectors[i]; - } - } - } - - float tot=0; - int c = 0; - for (int i = 0; i < smallestDists.size(); i++) - { - if (smallestDists[i] < HUGE_VALF) - { - tot += smallestDists[i]; - c++; - } - } - float avgDist = range*TILE_SIZE; - if (c > 0) - { - avgDist = tot / c; - } - - - - for (int i = 0; i < closestVectors.size(); i++) - { - Vector obs = closestVectors[i]; - if (obs.x == 0 && obs.y == 0) continue; - Vector mov = position - obs; - - int len = range*range*TILE_SIZE - mov.getLength2D(); - if (len < 0) len = 0; - else - { - mov |= len; - total += mov; - } - } - - if (total.x != 0 || total.y != 0) - { - float vlen = vel.getLength2D(); - //float len = (range*TILE_SIZE - avgDist)/range*TILE_SIZE; - //if (len > 0) - { - float totLen = 0; - if (swimming) - { - totLen = dt*600; - } - else - { - totLen = dt*50; - } - total |= totLen; - - Vector perp = vel; - Vector n = vel; - n.normalize2D(); - float d = total.dot2D(n); - perp |= d; - total -= perp; - total |= totLen; - lastPush = total; - vel += total; - } - } - */ - -} - void Avatar::render() { @@ -5802,74 +4701,11 @@ void Avatar::render() Entity::render(); - if (ropeState != 0) - { -#ifdef BBGE_BUILD_OPENGL - glPushMatrix(); - glColor4f(1.0f,0.0f,0.0f,1.0f); - glBegin(GL_LINES); - glVertex3f(position.x, position.y, 0); - glVertex3f(ropePos.x, ropePos.y, 0); - glEnd(); - glPopMatrix(); -#endif - } - - /* - if (activeAura == AURA_SHIELD) - { - glPushMatrix(); - glColor4f(0,0.5,1,1); - glTranslatef(shieldPosition.x, shieldPosition.y, 0); - drawCircle(AURA_SHIELD_RADIUS, 8); - glPopMatrix(); - } - */ - } void Avatar::onRender() { Entity::onRender(); - - /* - // HACK - if (RenderObject::renderPaths) - { - glPushMatrix(); - glLoadIdentity(); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(1, 0, 0, 0.5); - glTranslatef(400, 300, 0); - drawCircle(64); - glPopMatrix(); - } - */ - - //dsq->print(20, 600-100, "Naija: Hello there. My name is fred."); - /* - std::ostringstream os; - os << lastPush.x << ", " << lastPush.y; - debugLog(os.str()); - */ - /* - glPopMatrix(); - glPushMatrix(); - glTranslatef(position.x, position.y, position.z); - //glRotatef(0, 0, 1, -rotation.z); - glDisable(GL_BLEND); - glPointSize(12); - glDisable(GL_LIGHTING); - glColor3f(1,0,0); - glBegin(GL_LINES); - //glColor3f(1, 0, 0); - glVertex3f(0,0,0); - //glColor3f(1, 0, 0); - glVertex3f(lastPush.x*50, lastPush.y*50, 0); - glEnd(); - glPopMatrix(); - */ } int Avatar::getBeamWidth() @@ -5922,26 +4758,10 @@ void Avatar::onEnterState(int action) if (action == STATE_PUSH) { state.lockedToWall = false; - state.crawlingOnWall = false; Animation *a = skeletalSprite.getCurrentAnimation(); if (!a || (a && a->name != "pushed")) skeletalSprite.animate("pushed", 0); } - else if (action == STATE_EATING) - { - /* - // the problems with this: - // 1. what happens out of water? - // 2. is the delay too long? - // could just play a sound and then spawn some kind of particle effect - disableInput(); - idle(); - vel=vel2=Vector(0,0); - skeletalSprite.animate("eat", 0, ANIM_OVERRIDE); - core->main(1); - enableInput(); - */ - } } void Avatar::onExitState(int action) @@ -5954,10 +4774,6 @@ void Avatar::onExitState(int action) else if (action == STATE_PUSH) { skeletalSprite.transitionAnimate("spin", 0.1); - /* - rotation.z = rotation.z+360; - rotation.interpolateTo(Vector(0,0,rotation.z-360-90), 0.5); - */ } } @@ -6022,25 +4838,6 @@ void Avatar::splash(bool down) } dsq->spawnParticleEffect("Splash", position, a); - - - //Vector(position.x, dsq->game->waterLevel.x)); - /* - Quad *splash = new Quad; - splash->setTexture("splash"); - splash->position = this->position; - splash->position.y = dsq->game->waterLevel-splash->width.x/2; - float t = 0.5; - splash->alpha.path.addPathNode(0, 0); - splash->alpha.path.addPathNode(1, 0.25); - splash->alpha.path.addPathNode(0, 1); - splash->alpha.startPath(t); - splash->scale = Vector(1.5, 0.9); - splash->scale.interpolateTo(Vector(0.5,1.2),t); - splash->setLife(1); - splash->setDecayRate(0.9); - core->getTopStateData()->addRenderObject(splash, LR_PARTICLES); - */ } void Avatar::clampVelocity() @@ -6313,13 +5110,11 @@ void Avatar::stopBurst() //burstDelay = BURST_DELAY; burstDelay = 0; bursting = false; - animatedBurst = false; wakeEmitter.stop(); ripples = false; biteLeftEmitter.stop(); biteRightEmitter.stop(); -// lastWallJumpPos = Vector(0,0,0); } int Avatar::getCursorQuadrant() @@ -6341,7 +5136,6 @@ int Avatar::getCursorQuadrant() int Avatar::getQuadrantDirection(int lastQuad, int quad) { int diff = quad - lastQuad; - //if (lastQuad==0) return 0; if ((lastQuad==4 && quad == 1)) { diff = 1; @@ -6372,18 +5166,11 @@ void Avatar::startRoll(int dir) } Animation *a = skeletalSprite.getCurrentAnimation(); - //debugLog("start roll!"); if (!a || a->name != getRollAnimName()) { skeletalSprite.transitionAnimate(getRollAnimName(), 0.2, -1); } - /* - rollRightEmitter.load("RollRight"); - rollLeftEmitter.load("RollLeft"); - rollRightEmitter.start(); - rollLeftEmitter.start(); - */ rollRightEmitter.stop(); rollLeftEmitter.stop(); @@ -6413,23 +5200,9 @@ void Avatar::startRoll(int dir) { core->sound->fadeSfx(dsq->loops.roll, SFT_OUT, 0.5); } - /* - //HACK: make this dt based - static int rollBits = 0; - rollBits = rollBits + 1; - if (rollBits > 6) - { - if (_isUnderWater) - core->sound->playSfx("Roll2"); - rollBits = 0; - } - */ + rollDir = dir; - /* - if (core->afterEffectManager) - core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter,0.04,0.06,15,0.2f)); - */ if (_isUnderWater && core->afterEffectManager) core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter,0.08,0.05,22,0.2f, 1.2)); @@ -6458,8 +5231,6 @@ void Avatar::stopRoll() void Avatar::stopWallJump() { wallBurstTimer = 0; - wallJumps = 0; - lastWallJumpPos = Vector(0,0,0); } void Avatar::updateWallJump(float dt) @@ -6487,11 +5258,6 @@ void Avatar::updateRoll(float dt) if (rollDelay > 0) { - /* - std::ostringstream os; - os << "rollDelay: " << rollDelay; - debugLog(os.str()); - */ rollDelay -= dt; if (rollDelay <= 0) { @@ -6514,19 +5280,6 @@ void Avatar::updateRoll(float dt) if (rolling) { - /* - FOR_ENTITIES (i) - { - Entity *e = *i; - if (e->getEntityType() == ET_ENEMY && (e->position - this->position).isLength2DIn(350)) - { - //e->move(dt, 500, 1, this); - Vector diff = (position - e->position); - diff.setLength2D(1000*dt); - e->vel2 += diff; - } - } - */ if (dsq->continuity.form == FORM_ENERGY && dsq->continuity.hasFormUpgrade(FORMUPGRADE_ENERGY1)) { FOR_ENTITIES(i) @@ -6554,14 +5307,6 @@ void Avatar::updateRoll(float dt) } } - /* - //HACK: -ish, fixes low frame rate roll stuck problem? - // nope - if (rollDelay == 0) - { - rollDelay = 0.01; - } - */ // NOTE: does this fix the roll problem? if (rollDelay <= 0) stopRoll(); @@ -6615,19 +5360,6 @@ void Avatar::updateRoll(float dt) } } } - /* - std::ostringstream os; - os << "quad: " << quad << " lastQuad: " << lastQuad << " lastQuadDir: " << lastQuadDir; - debugLog(os.str()); - */ - - - /* - if (lastQuad != 0) - { - lastQuadDir = quadDir; - } - */ lastQuadDir = quadDir; @@ -6648,28 +5380,6 @@ int Avatar::getBurstDistance() return BURST_DISTANCE; } -void Avatar::updateTummy(float dt) -{ - if (dsq->continuity.form == FORM_BEAST) - { - //dsq->shakeCamera(5, 0.1); - - /* - if (inTummy > 0) - { - tummyTimer += dt; - if (tummyTimer > TUMMY_TIME) - { - //core->sound->playSfx("Digest"); - //heal(inTummy); - inTummy = 0; - } - } - */ - - } -} - void Avatar::setWasUnderWater() { state.wasUnderWater = isUnderWater(); @@ -6814,7 +5524,6 @@ void Avatar::updateLookAt(float dt) { if (lastHeadTexture.empty()) { - //if (dsq->continuity.form == FORM_NORMAL) setHeadTexture("blink", 0.1); if (chance(50)) { @@ -6876,20 +5585,8 @@ void Avatar::updateLookAt(float dt) bone_head->rotationOffset.z = oldRot - bone_head->rotation.z; bone_head->rotationOffset.interpolateTo(Vector(0,0,0), t); bone_head->internalOffset.interpolateTo(Vector(0,0,0), t); - /* - std::ostringstream os; - os << "rotationOffset lerp " << bone_head->rotationOffset.z; - debugLog(os.str()); - */ } - /* - bone_head->rotationOffset = bone_head->rotation.z; - bone_head->rotation.z = 0; - bone_head->rotationOffset.interpolateTo(0, 0.2); - */ - //state.updateLookAtTime += dt*10; - //state.updateLookAtTime += dt; state.updateLookAtTime += dt*4*2; bone_head->internalOffset.interpolateTo(Vector(0,0), 0.2); } @@ -6899,23 +5596,7 @@ void Avatar::updateLookAt(float dt) state.lookAtEntity = dsq->game->getNearestEntity(position, 800, this, ET_NOTYPE, DT_NONE, LR_ENTITIES0, LR_ENTITIES2); if (state.lookAtEntity && state.lookAtEntity->isv(EV_LOOKAT, 1)) { - /* - std::ostringstream os; - os << "Nearest: " << state.lookAtEntity->name; - debugLog(os.str()); - */ - state.updateLookAtTime = 0; - //if (dsq->continuity.form == FORM_NORMAL) - //setHeadTexture("blink", 0.1); - - /* - if (state.lookAtEntity->getEntityType() == ET_NEUTRAL) - { - //if (dsq->continuity.form == FORM_NORMAL) - //setHeadTexture("smile", 1); - } - */ if (!state.lookAtEntity->naijaReaction.empty()) { @@ -6925,15 +5606,8 @@ void Avatar::updateLookAt(float dt) else { state.lookAtEntity = 0; - /* - std::ostringstream os; - os << state.updateLookAtTime << " : found no entities"; - debugLog(os.str()); - */ - //state.updateLookAtTime -= 0.3f; - } - //skeletalSprite.animate("blink", 2, ANIMLAYER_HEADOVERRIDE); + } } } } @@ -6950,70 +5624,13 @@ bool lastCursorKeyboard = false; bool Avatar::isMiniMapCursorOkay() { -//!(dsq->getMouseButtonState(0) || dsq->getMouseButtonState(1)) return ((dsq->inputMode != INPUT_MOUSE) || (!dsq->game->miniMapRender || !dsq->game->miniMapRender->isCursorIn())); } -void Avatar::updateCursorFromKeyboard() -{ - /* - // why return when singing?? - //if (isSinging()) return; - if (!isInputEnabled()) return; - - Vector diff; - int dist = 200; - if (isActing(ACTION_SINGLEFT)) - diff.x = -dist; - if (isActing(ACTION_SINGRIGHT)) - diff.x = dist; - if (isActing(ACTION_SINGUP)) - diff.y = -dist; - if (isActing(ACTION_SINGDOWN)) - diff.y = dist; - if (!diff.isZero()) - { - diff.setLength2D(dist); - core->mouse.position = Vector(400,300) + diff; - lastCursorKeyboard = true; - } - else if (lastCursorKeyboard) - { - debugLog("HEY!: lastCursorKeyboard mouse position reset"); - core->mouse.position = Vector(400,300); - lastCursorKeyboard = false; - dsq->toggleCursor(false, 0.2); - } - - //!diff.isZero() || - if (isInputEnabled() && (!core->mouse.change.isZero())) - { - dsq->toggleCursor(true, 0.2); - } - */ -} - void Avatar::onUpdate(float dt) { BBGE_PROF(Avatar_onUpdate); - // animation debug code - /* - for (int i = 0; i < 8; i++) - { - if (skeletalSprite.getAnimationLayer(i)) - { - if (skeletalSprite.getAnimationLayer(i)->isAnimating()) - { - std::ostringstream os; - os << "anim layer: " << i << " - " << skeletalSprite.getAnimationLayer(i)->getCurrentAnimation()->name; - debugLog(os.str()); - //debugLog("anim layer 0: " + skeletalSprite.getAnimationLayer(0)->getCurrentAnimation()->name); - } - } - } - */ - looking = 0; #ifdef AQ_TEST_QUADTRAIL @@ -7048,16 +5665,6 @@ void Avatar::onUpdate(float dt) vel = Vector(0,0); } - if (canWarpDelay > 0) - { - canWarpDelay = canWarpDelay - dt; - if (canWarpDelay < 0) - { - canWarp = true; - canWarpDelay = 0; - } - } - if (fireDelay > 0) { fireDelay -= dt; @@ -7067,13 +5674,6 @@ void Avatar::onUpdate(float dt) } } - if (doubleClickDelay > 0) - { - doubleClickDelay = doubleClickDelay - dt; - if (doubleClickDelay < 0) doubleClickDelay = 0; - } - - if (isInputEnabled()) { if (web) @@ -7139,35 +5739,6 @@ void Avatar::onUpdate(float dt) } } - /* - if (!targets.empty()) - { - if (targets[0] && (targets[0]->position - this->position).getSquaredLength2D() > sqr(TARGET_RANGE)) - { - clearTargets(); - } - } - */ - //spawnChildClone(4); - if (!core->cameraRot.isInterpolating()) - // 10 - core->cameraRot.interpolateTo(Vector(0,0,360), 30, -1); - /* - for (int i = 0; i < targets.size(); i++) - { - if (targets[i] && !this->isEntityDead()) - { - targetQuads[i]->alpha.interpolateTo(1,0.1); - targetQuads[i]->position = targets[i]->position; - } - else - { - if (targetQuads[i]->alpha.getValue()>0) - targetQuads[i]->alpha.interpolateTo(0,0.1); - } - } - */ - Entity::onUpdate(dt); if (isEntityDead() && skeletalSprite.getCurrentAnimation()->name != "dead") @@ -7359,8 +5930,6 @@ void Avatar::onUpdate(float dt) } - //skeletalSprite.getBoneByIdx(3)->getWorldPosition(); - state.wasUnderWater = _isUnderWater; if (!_isUnderWater) @@ -7385,30 +5954,6 @@ void Avatar::onUpdate(float dt) } } - /* - if (core->afterEffectManager && _isUnderWater) - { - if (swimming && vel.getSquaredLength2D() > sqr(200)) - { - rippleTimer += dt; - while (rippleTimer > RIPPLE_INTERVAL) - { - // 0.01 20 - core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter,0.05,0.08,15,0.2f, 1.2)); - - //core->afterEffectManager->addEffect(new ShockEffect(Vector(400,300),0.01,0.002f,15,0.1f)); - rippleTimer = 0; - } - } - } - */ - - - /* - bobTimer += dt*2; - offset.y = sinf(bobTimer)*5 - 2.5f; - */ - if (isEntityDead()) { updateHair(dt); @@ -7470,7 +6015,6 @@ void Avatar::onUpdate(float dt) tripDelay -= dt; if (tripDelay < 0) { -; tripDelay = 0.15; tripCount ++; if (tripCount > 10) @@ -7529,28 +6073,10 @@ void Avatar::onUpdate(float dt) lastPosition = position; } - - updateCursorFromKeyboard(); updateFormVisualEffects(dt); - updateShock(dt); updateRoll(dt); - updateTummy(dt); updateWallJump(dt); - if (dsq->autoSingMenuOpen) - { - if (micNote != -1 && !this->isSinging()) - { - openedFromMicInput = true; - openSingingInterface(); - } - if (micNote == -1 && isSinging() && openedFromMicInput) - { - openedFromMicInput = false; - closeSingingInterface(); - } - } - if (formAbilityDelay > 0) { formAbilityDelay -= dt; @@ -7575,49 +6101,6 @@ void Avatar::onUpdate(float dt) } updateAura(dt); - switch(ropeState) - { - case 1: - { - if (ropeTimer > 0) - { - ropeTimer -= dt; - if (ropeTimer < 0) - { - ropeState = 0; - ropeTimer = 0; - } - } - ropePos += ropeVel*dt; - if (dsq->game->isObstructed(TileVector(ropePos))) - { - ropeState = 2; - ropeTimer = 2; - } - std::ostringstream os; - os << "ropePos (" << ropePos.x << ", " << ropePos.y << ")"; - debugLog(os.str()); - } - break; - case 2: - if (ropeTimer > 0) - { - ropeTimer -= dt; - if (ropeTimer < 0) - { - ropeState = 0; - ropeTimer = 0; - } - } - Vector add = (ropePos - position); - if (add.getSquaredLength2D() > sqr(200)) - { - add.setLength2D(4000); - vel += add*dt; - } - break; - } - updateSingingInterface(dt); @@ -7628,53 +6111,10 @@ void Avatar::onUpdate(float dt) pullTarget->stopPull(); pullTarget = 0; } - else - { - /* - static float c = 0; - c += dt; - if (c > 0.2f) - { - EnergyTendril *t = new EnergyTendril(avatar->position, pullTarget->position); - core->addRenderObject(t, LR_PARTICLES); - c -= dt; - } - */ - } } formTimer += dt; - /* - if (formTimer > 2.0f && dsq->continuity.form == FORM_SPIRIT) - { - changeForm(FORM_NORMAL, true); - } - */ - if (pickingPullTarget) - { - //debugLog("picking pull target"); - Entity *closest = 0; - float smallestDist = HUGE_VALF; - FOR_ENTITIES(i) - { - Entity *e = *i; - - if (e->isPullable() && e->life == 1) - { - if (e->isCoordinateInside(dsq->getGameCursorPosition())) - { - float dist = (e->position - dsq->getGameCursorPosition()).getSquaredLength2D(); - if (dist < smallestDist) - { - smallestDist = dist; - closest = e; - } - } - } - } - potentialPullTarget = closest; - } if (dsq->continuity.form == FORM_SPIRIT) { @@ -7700,10 +6140,6 @@ void Avatar::onUpdate(float dt) static bool revertButtonsAreDown = false; if (inputEnabled && (dsq->inputMode == INPUT_KEYBOARD || dsq->inputMode == INPUT_MOUSE) && (!pathToActivate && !entityToActivate)) { - //debugLog("update stuff"); - ///*&& dsq->continuity.form != FORM_SPIRIT*/ - //|| isActing(ACTION_PRIMARY) - //|| isActing(ACTION_SECONDARY) if (dsq->continuity.form != FORM_NORMAL && (core->mouse.pure_buttons.left && core->mouse.pure_buttons.right) && getVectorToCursor(true).isLength2DIn(minMouse)) { if (!revertButtonsAreDown) @@ -7740,97 +6176,11 @@ void Avatar::onUpdate(float dt) revertButtonsAreDown = false; } - /* - if (this->state.crawlingOnWall) - { - if (isActing("a1")) - { - wallNormal = dsq->game->getWallNormal(position); - if (wallNormal.dot2D(lastWallNormal)<=0.3f) - { - stopWallCrawl(); - } - else - { - Vector left = wallNormal.getPerpendicularLeft(); - Vector right = wallNormal.getPerpendicularRight(); - - - Vector test = getVectorToCursor(); - if (!test.isLength2DIn(64)) - { - test.normalize2D(); - - Vector move; - if (test.dot2D(left)>0) - move = left; - else - move = right; - - move.setLength2D(800); - - if (move.x > 0 && !isfh()) - flipHorizontal(); - if (move.x < 0 && isfh()) - flipHorizontal(); - - position += move*dt; - rotateToVec(wallNormal, 0.1); - } - else - { - stopWallCrawl(); - } - } - } - else - { - stopWallCrawl(); - } - } - */ - //if (core->getNestedMains() == 1) { - if (leaches > 3) - { - /* - const float leachHurtInterval = 3; - state.leachTimer += dt; - if (state.leachTimer > leachHurtInterval) - { - state.leachTimer -= leachHurtInterval; - DamageData d; - d.damage = int(leaches/3); - damage(d); - //hit(0, 0, SPELL_NONE, int(leaches/3)); - } - */ - } - - if (getState() != STATE_TRANSFORM && dsq->continuity.getWorldType() == WT_NORMAL) - //if (dsq->continuity.form == FORM_ENERGY) { - //if (dsq->continuity.selectedSpell == SPELL_SHOCK) - formAbilityUpdate(dt); - - // is this really necessary?? - // YES! - // this allows the player to start charging quickly after firing - /* - if (isActing("charge") && !charging && spellCastDelay == 0 && inputEnabled) - { - this->rmbd(); - } - */ - // maybe not useful anymore - /* - if (!isActing("charge") && charging && spellChargeDelay == 0 && inputEnabled) - { - } - */ } if (state.useItemDelay.updateCheck(dt)) @@ -7849,29 +6199,6 @@ void Avatar::onUpdate(float dt) removeBlindEffects(); } } - - /*&& this->getSelectedSpell() == SPELL_ENERGYBLAST*/ - /* - // HACK: hacked out for now - // FINDTARGET - - if (charging && !targets.empty() && targets[0] == 0 && state.spellCharge > 0.2f - && dsq->continuity.form == FORM_ENERGY) - { - FOR_ENTITIES (i) - { - Entity *e = *i; - if (e && e != this && e->isAvatarAttackTarget() && !e->isEntityDead() && e->isAffectedBySpell(SPELL_ENERGYBLAST)) - { - ScriptedEntity *se = (ScriptedEntity*)e; - if ((e->position - dsq->getGameCursorPosition()).getSquaredLength2D() < sqr(64)) - { - targets[0] = e; - } - } - } - } - */ } @@ -7900,15 +6227,6 @@ void Avatar::onUpdate(float dt) } } - if (spellCastDelay > 0) - { - spellCastDelay -= dt; - if (spellCastDelay <= 0) - { - spellCastDelay = 0; - } - } - if (state.lockToWallDelay.updateCheck(dt)) { } @@ -7918,7 +6236,6 @@ void Avatar::onUpdate(float dt) pushingOffWallEffect -= dt; if (pushingOffWallEffect <= 0) { - lastLockToWallPos = Vector(0,0); pushingOffWallEffect = 0; if (vel.getSquaredLength2D() > sqr(1200)) { @@ -7926,53 +6243,9 @@ void Avatar::onUpdate(float dt) } } } - /* - if (beamFiring) - { - // collides enemies with beam as well - beam->width = getBeamWidth(); - Vector diff = dsq->getGameCursorPosition() - this->position; - diff |= beam->width.getValue()/2.0f; - beam->position = this->position + diff; - float angle=0; - MathFunctions::calculateAngleBetweenVectorsInDegrees(this->position, dsq->getGameCursorPosition(), angle); - beam->rotation.z = angle+90; - beam->position.z = 3; - //collideBeamWithEntities(); - } - */ - if (state.dodgeEffectTimer.updateCheck(dt)) - { - vel.capLength2D(vars->maxSwimSpeed); - /* - if (vel.getSquaredLength2D() > sqr(vars->maxSwimSpeed)) - vel.setLength2D(vars->maxSwimSpeed); - */ - } - /* - if (dodgeEffectTimer > 0) - { - dodgeEffectTimer -= dt; - if (dodgeEffectTimer <= 0) - { - dodgeEffectTimer = 0; - if (vel.getSquaredLength2D() > sqr(vars->maxSwimSpeed)) - vel |= vars->maxSwimSpeed; - } - } - */ - - if (text) - { - text->position = position + Vector(100); - } if (charging) { - /* - chargeGraphic->position = this->position; - chargeGraphic->position.z = position.z + 0.05f; - */ state.spellCharge += dt; switch (dsq->continuity.form) { @@ -7999,37 +6272,11 @@ void Avatar::onUpdate(float dt) chargingEmitter->load("ChargedDualForm"); chargingEmitter->start(); - - - - //chargeVisualEffect("particles/energy-charge-2"); } - /* - if (state.spellCharge >= 1.5f && chargeLevelAttained<2) - { - chargeLevelAttained = 2; - - core->sound->playSfx("PowerUp"); - //debugLog("charge visual effect 2"); - chargeEmitter->load("EnergyCharge"); - chargeEmitter->start(); - - //chargeVisualEffect("particles/energy-charge-2"); - } - */ } break; case FORM_ENERGY: { - /* - if (state.spellCharge >= 0.99f && chargeLevelAttained<1) - { - chargeLevelAttained = 1; - debugLog("charge visual effect 1"); - chargeVisualEffect("energy-charge-1"); - - } - */ if (state.spellCharge >= 1.5f && chargeLevelAttained<2) { chargeLevelAttained = 2; @@ -8056,26 +6303,6 @@ void Avatar::onUpdate(float dt) chargingEmitter->load("ChargingNature2"); chargingEmitter->start(); } - /* - if (state.spellCharge >= 0.5f && chargeLevelAttained<1) - { - chargeLevelAttained = 1; - core->sound->playSfx("PowerUp"); - chargeEmitter->load("ChargeNature"); - chargeEmitter->start(); - } - - if (state.spellCharge >= 2.0f && chargeLevelAttained<2) - { - chargeLevelAttained = 2; - core->sound->playSfx("PowerUp"); - chargeEmitter->load("ChargeNature2"); - chargeEmitter->start(); - - chargingEmitter->load("ChargingNature2"); - chargingEmitter->start(); - } - */ } break; } @@ -8185,7 +6412,7 @@ void Avatar::onUpdate(float dt) } } - if (!(state.lockedToWall || state.dodgeEffectTimer.isActive()) && _isUnderWater && dsq->continuity.getWorldType() == WT_NORMAL && canMove) + if (!state.lockedToWall && _isUnderWater && dsq->continuity.getWorldType() == WT_NORMAL && canMove) { if (bursting) { @@ -8208,18 +6435,8 @@ void Avatar::onUpdate(float dt) } if (inputEnabled && _isUnderWater) { - if (bursting) + if(bursting) { - // disable check to stop burst - /* - if (!isActing("a1")) - { - stopBurst(); - //bursting = false; - //burstDelay = BURST_DELAY; - //animatedBurst = false; - } - */ } else if (burstDelay > 0) { @@ -8238,7 +6455,7 @@ void Avatar::onUpdate(float dt) bool moved = false; //check to make sure there's still a wall there, if not fall off - if (state.lockedToWall && !state.crawlingOnWall) + if (state.lockedToWall) { rotateToVec(wallPushVec, dt*2); if (!boneLock.on && !dsq->game->isObstructed(wallLockTile)) @@ -8248,7 +6465,7 @@ void Avatar::onUpdate(float dt) } } - if (getState() != STATE_PUSH && !state.lockedToWall && inputEnabled && !ignoreInputDelay && _isUnderWater && canMove) + if (getState() != STATE_PUSH && !state.lockedToWall && inputEnabled && _isUnderWater && canMove) { float a = 800*dt; Vector lastVel = vel; @@ -8260,8 +6477,6 @@ void Avatar::onUpdate(float dt) static bool lastDown; float len = 0; - //dsq->continuity.toggleMoveMode && - //!dsq->continuity.toggleMoveMode && if (isMiniMapCursorOkay() && !isActing(ACTION_ROLL) && _isUnderWater && !riding && !boneLock.on && @@ -8291,12 +6506,6 @@ void Avatar::onUpdate(float dt) { if (dsq->inputMode == INPUT_JOYSTICK) addVec = Vector(0,0,0); - /* - if (dsq->inputMode == INPUT_JOYSTICK && !core->mouse.buttons.left) - { - addVec = Vector(0,0,0); - } - */ } @@ -8442,8 +6651,8 @@ void Avatar::onUpdate(float dt) add.setLength2D(BURST_ACCEL*dt); vel += add; - if (pushingOffWallEffect > 0 || wallJumps > 0) - currentMaxSpeed = vars->maxWallJumpBurstSpeed + 50*wallJumps; + if (pushingOffWallEffect > 0) + currentMaxSpeed = vars->maxWallJumpBurstSpeed; else currentMaxSpeed = vars->maxBurstSpeed; @@ -8452,8 +6661,6 @@ void Avatar::onUpdate(float dt) { if (pushingOffWallEffect > 0) currentMaxSpeed = vars->maxWallJumpSpeed; - else if (state.dodgeEffectTimer.isActive()) - currentMaxSpeed = vars->maxDodgeSpeed; else { if (isActing(ACTION_SLOW) || isMovingSlow) @@ -8493,9 +6700,6 @@ void Avatar::onUpdate(float dt) if (currentMaxSpeed < 0) currentMaxSpeed = 1; - if (ropeState == 2 && currentMaxSpeed < vars->maxWallJumpBurstSpeed) - currentMaxSpeed = vars->maxWallJumpBurstSpeed; - /* if (inCurrent) { @@ -8580,8 +6784,6 @@ void Avatar::onUpdate(float dt) { if (getState() == STATE_IDLE && !rolling) skeletalSprite.transitionAnimate(getBurstAnimName(), ANIM_TRANSITION); - //animate(anim_burst); - animatedBurst = true; } } } @@ -8637,19 +6839,6 @@ void Avatar::onUpdate(float dt) } if (isLockable()) lockToWall(); - /* - if (isActing("left")) - addVec += Vector(-a, 0); - if (isActing("right")) - addVec += Vector(a, 0); - */ - /* - if (isActing("up")) - addVec += Vector(0, -a); - if (isActing("down")) - addVec += Vector(0, a); - */ - //vel += addVec; } if (!moved) @@ -8657,7 +6846,6 @@ void Avatar::onUpdate(float dt) if (swimming) { swimming = false; - idleAnimDelay = 0; if (dsq->continuity.form == FORM_FISH) rotation.interpolateTo(0, 0.2); } @@ -8706,9 +6894,6 @@ void Avatar::onUpdate(float dt) if (!inCurrent) currentMaxSpeed = vars->maxSwimSpeed; - if (ropeState == 2 && currentMaxSpeed < vars->maxWallJumpBurstSpeed) - currentMaxSpeed = vars->maxWallJumpBurstSpeed; - if (!state.lockedToWall && !bursting) { if (getState() == STATE_IDLE && inputEnabled) @@ -8717,22 +6902,6 @@ void Avatar::onUpdate(float dt) if (a && a->name != getIdleAnimName() && a->name != "pushed" && a->name != "spin" && !rolling) skeletalSprite.transitionAnimate(getIdleAnimName(), ANIM_TRANSITION, -1); } - /* - idleAnimDelay -= dt; - if (idleAnimDelay <= 0) - { - idleAnimDelay = 1.5;//anim_idle.time*2; - - //if (currentAction == IDLE && (!skeletalSprite.isAnimating() || skeletalSprite.getCurrentAnimation()->name=="swim" - // || skeletalSprite.getCurrentAnimation()->name=="a1")) - if (currentAction == STATE_IDLE) - { - skeletalSprite.transitionAnimate("idle", ANIM_TRANSITION); - } - - //animate(anim_idle); - } - */ } } @@ -8750,7 +6919,6 @@ void Avatar::onUpdate(float dt) if (swimming) { - //static bool lastSpreadUp = false; if (!rolling && !internalOffset.isInterpolating()) { int spread = 8; @@ -8760,25 +6928,10 @@ void Avatar::onUpdate(float dt) internalOffset = Vector(-spread, 0); internalOffset.interpolateTo(Vector(spread, 0), t, -1, 1, 1); - /* - rotationOffset = Vector(-rotSpread, 0); - rotationOffset.interpolateTo(Vector(rotSpread, 0), t, -1, 1, 1); - */ - for (int i = 0; i < int((t*0.5f)/0.01f); i++) { internalOffset.update(0.01); - //rotationOffset.update(0.01); } - /* - if (lastSpreadUp) - internalOffset.interpolateTo(Vector(spread, 0), t, 1, 1, 1); - else - internalOffset.interpolateTo(Vector(-spread, 0), t, 1, 1, 1); - */ - - //lastSpreadUp = !lastSpreadUp; - //internalOffset.update(t*0.5f); } if (dsq->continuity.form != FORM_ENERGY && dsq->continuity.form != FORM_DUAL && dsq->continuity.form != FORM_FISH) @@ -8903,11 +7056,6 @@ void Avatar::onUpdate(float dt) } - if (state.dodgeEffectTimer.isActive()) - { - vel += dodgeVec*dt; - } - if (!state.lockedToWall && !bursting && _isUnderWater && swimming && !isFollowingPath()) { //debugLog("collision avoidance"); @@ -8917,15 +7065,6 @@ void Avatar::onUpdate(float dt) doCollisionAvoidance(dt, 2, 1.0, 0, 800, OT_HURT); } - // friction for extraVel - if (!extraVel.isZero()) - { - Vector d = extraVel; - d.setLength2D(100); - extraVel -= d*dt; - } - - if (!game->isShuttingDownGameState()) { updateCurrents(dt); @@ -8971,7 +7110,7 @@ void Avatar::onUpdate(float dt) os << "vel (" << vel.x << ", " << vel.y << ")"; debugLog(os.str()); */ - Vector mov = (moveVel * dt) + (extraVel * dt); + Vector mov = (moveVel * dt); Vector omov = mov; mov.capLength2D(TILE_SIZE); /* @@ -9104,19 +7243,6 @@ void Avatar::onUpdate(float dt) // && dsq->game->getPercObsInArea(position, 4) < 0.75f if (!inCurrent) { - /* - int px=int(position.x); - int py=int(position.y); - int llpx=int(lastLastPosition.x); - int llpy=int(lastLastPosition.y); - if (px == llpx && py == llpy) - { - - } - else - { - */ - //doBounce(); if (bursting) { //vel = 0; @@ -9145,7 +7271,6 @@ void Avatar::onUpdate(float dt) //vel = (n + vel)*0.5f; } } - //} } } } @@ -9164,39 +7289,6 @@ void Avatar::onUpdate(float dt) } } } - - /* - if (swimming) - { - int px=int(position.x); - int py=int(position.y); - int llpx=int(lastLastPosition.x); - int llpy=int(lastLastPosition.y); - if (px == llpx && py == llpy) - { - if (isNearObstruction(4)) - { - vel = 0; - Vector n = dsq->game->getWallNormal(position, 6); - if (!n.isZero()) - { - Vector add = n * 100; - Vector f = getForward(); - n = (n + f * 100); - n *= 0.5f; - vel += n; - } - } - } - } - */ - - if (ignoreInputDelay>0) - { - ignoreInputDelay -= dt; - if (ignoreInputDelay < 0) - ignoreInputDelay = 0; - } } //fuuugly @@ -9226,23 +7318,6 @@ void Avatar::checkNearWall() if (!inCurrent && bursting && !state.lockedToWall && !vel.isZero() && !riding && _isUnderWater) { - /* - int mult = 1; - if (isfh()) - mult = -1; - */ - /* - Vector n = dsq->game->getWallNormal(position, 8); - if (!n.isZero()) - { - state.nearWall = true; - float t=0.2; - rotateToVec(n, t, 0); - skeletalSprite.transitionAnimate("wall", t); - } - else - state.nearWall = false; - */ int checkRange = 11; Vector v = vel; v.normalize2D(); @@ -9280,32 +7355,6 @@ void Avatar::checkNearWall() } } -void Avatar::checkSpecial() -{ - /* - if (dsq->continuity.getFlag("VedhaFollow1") == 7) - { - int total = 0, c = 0; - FOR_ENTITIES (i) - { - Entity *e = *i; - if (e->name == "PracticeEnemy") - { - total++; - if (e->isEntityDead()) - c++; - } - } - if (total == c) - { - health = maxHealth; - dsq->continuity.setFlag("VedhaFollow1", 8); - dsq->getEntityByName("Vedha")->activate(); - } - } - */ -} - void Avatar::onWarp() { avatar->setv(EV_NOINPUTNOVEL, 0); diff --git a/Aquaria/Avatar.h b/Aquaria/Avatar.h index 93cc73d..675aedb 100644 --- a/Aquaria/Avatar.h +++ b/Aquaria/Avatar.h @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define AVATAR_H #include "../BBGE/Particles.h" -#include "../BBGE/BitmapFont.h" #include "DSQ.h" #include "Hair.h" @@ -30,9 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Web.h" -class SpringPlant; - -//class Item; class TileVector; class SongIcon; @@ -106,20 +102,10 @@ protected: void onUpdate(float dt); }; -class FormIcon : public Quad -{ -public: - FormIcon(); -protected: - bool cursorIsIn; - void onUpdate(float dt); -}; - class AvatarState { public: AvatarState(); - Timer dodgeEffectTimer; Timer blindTimer; float abilityDelay; bool blind; @@ -131,7 +117,6 @@ public: float spellCharge; bool lockedToWall; float leachTimer; - bool crawlingOnWall; bool nearWall; float swimTimer, rollTimer; float updateLookAtTime; @@ -151,20 +136,13 @@ public: void destroy(); void action(int actionID, int state); AvatarState state; - void setIgnoreInputDelay(float delay) - { - ignoreInputDelay = delay; - } float burst, burstTimer; float burstDelay; bool bursting; BurstType lastBurstType; //void damage(int amount); bool isCharging(); - void slowToRest(); - void debugMsg(const std::string &msg); void setBlind(float time); - void onBlindTest(); void revive(); @@ -182,10 +160,8 @@ public: Entity *entityToActivate; Path *pathToActivate; - Entity *lastEntityActivation; void shift(); void applyWorldEffects(WorldType type); - Vector extraVel; void toggleMovement(bool on); @@ -220,16 +196,11 @@ public: void changeForm(FormType form, bool effects=true, bool onInit=false, FormType lastForm=FORM_NONE); void singNote(int note); std::vector songIcons; - std::vector formIcons; - //std::vector currentsong; Song currentSong; int currentSongIdx; Entity *pullTarget; - bool pickingPullTarget; - void openPullTargetInterface(); - void closePullTargetInterface(); void setNearestPullTarget(); void formAbility(int ability); @@ -243,16 +214,11 @@ public: bool canDie; - bool warpIn; Vector warpInLocal; float biteDelay, urchinDelay, jellyDelay; bool movingOn; - int ropeState; - float ropeTimer; - Vector ropePos, ropeVel; - void fireRope(); void render(); void activateAura(AuraType aura); void stopAura(); @@ -264,7 +230,6 @@ public: void updateFormVisualEffects(float dt); bool isSinging(); bool isLockable(); - float stopTimer; int getCursorQuadrant(); void onWarp(); int getBurstDistance(); @@ -275,16 +240,12 @@ public: int rollDir; std::string getBurstAnimName(); std::string getRollAnimName(); - void startWallCrawl(); - void stopWallCrawl(); void updateDualFormChargeEffects(); TileVector wallLockTile; - Vector wallNormal, lastWallNormal; + Vector wallNormal; - void openFormInterface(); - void closeFormInterface(); void fallOffWall(); float fireDelay; @@ -293,8 +254,6 @@ public: AuraType activeAura; float auraTimer; bool fireAtNearestValidEntity(const std::string &shot); - EatType inTummy; - float tummyTimer; void checkNearWall(); Vector getAim(); @@ -306,7 +265,6 @@ public: void updatePosition(); float quickSongCastDelay; void onAnimationKeyPassed(int key); - int tummyAmount; bool isSwimming(); @@ -369,23 +327,17 @@ protected: int curWebPoint; void checkUpgradeForShot(Shot *s); int getNumShots(); - void updateCursorFromKeyboard(); void lockToWallCommon(); void onSetBoneLock(); void onUpdateBoneLock(); - - - InterpolatedVector cursorPos; void adjustHeadRot(); std::string lastHeadTexture; void updateDualFormGlow(float dt); Vector getTendrilAimVector(int i, int max); void applyRidingPosition(); - Vector lastWallJumpPos, lastWallJumpDir; void stopWallJump(); void updateWallJump(float dt); - int wallJumps; float wallBurstTimer; float targetUpdateDelay; std::vector targets; @@ -410,7 +362,6 @@ protected: int shieldPoints; - bool inFormInterface; void onIdle(); void onHeal(int type); ParticleEffect biteLeftEmitter, biteRightEmitter, swimEmitter, auraHitEmitter; @@ -419,7 +370,6 @@ protected: ParticleEffect *leftHandEmitter, *rightHandEmitter; ParticleEffect *chargingEmitter, *chargeEmitter; void updateCursor(float dt); - float canWarpDelay; bool rolling; int rollDidOne; @@ -427,19 +377,12 @@ protected: void stopRoll(); int getQuadrantDirection(int lastQuad, int quad); void updateRoll(float dt); - void updateTummy(float dt); int lastQuad, lastQuadDir; void onDamage(DamageData &d); void updateHair(float dt); void lostTarget(int i, Entity *e); - float doubleClickDelay; - - float damageDelay; - bool didShockDamage; - void updateShock(float dt); - float shockTimer; Vector shieldPosition; void updateAura(float dt); @@ -455,15 +398,12 @@ protected: void clampVelocity(); bool canCharge(int ability); - int abilityCharging; void formAbilityUpdate(float dt); - Entity *potentialPullTarget; float revertTimer; void endCharge(); Entity *activateEntity; bool canMove; - float castShockTimer; void onEnterState(int action); void onExitState(int action); @@ -472,28 +412,17 @@ protected: void applyBlindEffects(); void removeBlindEffects(); - - //bool blind; - bool animatedBurst; - float zoomVel; // implement "bobbing" in a lower class int getBeamWidth(); Vector getWallNormal(TileVector t); - void onToggleDebugMessages(); - float spellCastDelay; - float spellChargeMin; bool checkWarpAreas(); - void checkSpecial(); void toggleZoom(); float ignoreInputDelay; - float idleAnimDelay; float splashDelay; //Hair *hair; - BitmapText *text; - //Item *currentItem; void onUpdate(float dt); void onRender(); @@ -503,26 +432,19 @@ protected: Quad *glow; bool swimming; - void doRangePush(float dt); - void doRangePull(float dt); - void lmbd(); void lmbu(); void rmbd(); - void rmbd2(); void rmbu(); bool charging; - Vector lastPush; - float pushingOffWallEffect; float lockToWallFallTimer; Vector dodgeVec; Vector wallPushVec, wallTurnVec; - Vector lastLockToWallPos; diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 41e31d2..f67f612 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -198,8 +198,6 @@ DSQ::DSQ(std::string fileSystem) : Core(fileSystem, LR_MAX, APPNAME, PARTICLE_AM menuSelectDelay = 0; modSelectorScr = 0; blackout = 0; - useMic = false; - autoSingMenuOpen = false; inputMode = INPUT_MOUSE; overlay = 0; recentSaveSlot = -1; @@ -4492,7 +4490,7 @@ void DSQ::onUpdate(float dt) dsq->setInputMode(INPUT_MOUSE); } - if (isDeveloperKeys()) + /*if (isDeveloperKeys()) { if (core->getCtrlState()) { @@ -4505,7 +4503,7 @@ void DSQ::onUpdate(float dt) if (core->getKeyState(KEY_DOWN)) core->adjustWindowPosition(0, 5); } - } + }*/ if (isDeveloperKeys() && cmDebug && cmDebug->alpha == 1 && fpsText) { @@ -4534,8 +4532,7 @@ void DSQ::onUpdate(float dt) os << "maxSpeed: " << dsq->game->avatar->currentMaxSpeed << " - "; os << "lockedToWall: " << dsq->game->avatar->state.lockedToWall; os << std::endl; - os << "crwlng: " << avatar->state.crawlingOnWall; - os << " swmng: " << avatar->isSwimming(); + os << "swmng: " << avatar->isSwimming(); os << " dualFormCharge: " << continuity.dualFormCharge; os << std::endl; os << "vel(" << avatar->vel.x << ", " << avatar->vel.y << ") "; @@ -4546,7 +4543,6 @@ void DSQ::onUpdate(float dt) os << "inp: " << avatar->isInputEnabled() << std::endl; os << "wallNormal(" << avatar->wallNormal.x << ", " << avatar->wallNormal.y << ")" << std::endl; os << "burst: " << avatar->burst << " burstTimer: " << avatar->burstTimer << std::endl; - os << "inTummy: " << avatar->inTummy << " tummyAmount: " << avatar->tummyAmount << std::endl; os << "inCurrent: " << avatar->isInCurrent() << std::endl; os << "qsongCastDelay: " << avatar->quickSongCastDelay << std::endl; os << "singing: " << dsq->game->avatar->singing << " blockSinging: " << dsq->game->avatar->isBlockSinging(); diff --git a/Aquaria/DSQ.h b/Aquaria/DSQ.h index 48ef1f2..57b7df0 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -1452,7 +1452,6 @@ public: void rumble(float leftMotor, float rightMotor, float time); void vision(std::string folder, int num, bool ignoreMusic = false); - bool useMic, autoSingMenuOpen; void watch(float t, int canQuit = 0); std::string lastVoiceFile; diff --git a/Aquaria/Entity.cpp b/Aquaria/Entity.cpp index cf49e82..b6b945c 100644 --- a/Aquaria/Entity.cpp +++ b/Aquaria/Entity.cpp @@ -551,39 +551,6 @@ void Entity::flipToTarget(Vector pos) } } -bool Entity::isCollideAgainst(Entity *e) -{ - if (this == e) return false; - if (getEntityType()==ET_PET || getEntityType()==ET_AVATAR || getEntityType() == ET_NEUTRAL) - { - if (e->getEntityType()==ET_ENEMY || e->getEntityType()==ET_NEUTRAL) - { - return true; - } - } - if (getEntityType() == ET_ENEMY) - { - if (e->getEntityType()==ET_PET || e->getEntityType()==ET_AVATAR || e->getEntityType()==ET_NEUTRAL) - return true; - } - return false; -} - -bool Entity::isOpposedTo(Entity *e) -{ - if (getEntityType()==ET_PET || getEntityType()==ET_AVATAR || getEntityType() == ET_NEUTRAL) - { - if (e->getEntityType()==ET_ENEMY || e->getEntityType()==ET_NEUTRAL) - return true; - } - if (getEntityType() == ET_ENEMY) - { - if (e->getEntityType()==ET_PET || e->getEntityType()==ET_AVATAR) - return true; - } - return false; -} - Entity* Entity::getTargetEntity(int t) { return targets[t]; diff --git a/Aquaria/Entity.h b/Aquaria/Entity.h index 76f10b3..c069447 100644 --- a/Aquaria/Entity.h +++ b/Aquaria/Entity.h @@ -341,8 +341,6 @@ public: void setEntityType(EntityType et); EntityType getEntityType(); - bool isOpposedTo(Entity *e); - bool isCollideAgainst(Entity *e); void flipToTarget(Vector pos); bool isFollowingPath(); void stopFollowingPath(); diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 8379a06..5f2e90b 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -4138,8 +4138,7 @@ void Game::toggleOverrideZoom(bool on) if (!on && avatar->zoomOverriden == true) { dsq->globalScale.stop(); - dsq->game->avatar->myZoom = dsq->globalScale; - //dsq->game->avatar->myZoom.interpolateTo(Vector(1,1), 1.0); + avatar->myZoom = dsq->globalScale; } avatar->zoomOverriden = on; } @@ -8400,8 +8399,6 @@ void Game::preLocalWarp(LocalWarpType localWarpType) { dsq->game->avatar->warpInLocal = Vector(0,0,0); } - - dsq->game->avatar->warpIn = !dsq->game->avatar->warpIn; dsq->screenTransition->capture(); core->resetTimer(); diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index 68d7c4f..b71581c 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -1778,7 +1778,6 @@ void Core::onUpdate(float dt) //script.update(dt); cameraPos.update(dt); - cameraRot.update(dt); globalScale.update(dt); if (afterEffectManager) @@ -3162,10 +3161,8 @@ void Core::clearBuffers() void Core::setupRenderPositionAndScale() { #ifdef BBGE_BUILD_OPENGL - //glRotatef(cameraRot.z, 0, 0, 1); glScalef(globalScale.x*globalResolutionScale.x*screenCapScale.x, globalScale.y*globalResolutionScale.y*screenCapScale.y, globalScale.z*globalResolutionScale.z); glTranslatef(-(cameraPos.x+cameraOffset.x), -(cameraPos.y+cameraOffset.y), -(cameraPos.z+cameraOffset.z)); - //glRotatef(180, 0, 1, 0); #endif } diff --git a/BBGE/Core.h b/BBGE/Core.h index 2d62bda..84b08cb 100644 --- a/BBGE/Core.h +++ b/BBGE/Core.h @@ -1133,7 +1133,7 @@ public: virtual void onPlayedVoice(const std::string &name){} - InterpolatedVector cameraPos, cameraRot; + InterpolatedVector cameraPos; int fps; bool loopDone;