mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-05-10 02:55:00 +00:00
Get rid of some uses of dsq->inputMode
This commit is contained in:
parent
9d80077754
commit
8c2f76b606
7 changed files with 137 additions and 153 deletions
|
@ -1100,7 +1100,7 @@ void Avatar::onDamage(DamageData &d)
|
||||||
if (healthWillBe<=0)
|
if (healthWillBe<=0)
|
||||||
t = 2;
|
t = 2;
|
||||||
|
|
||||||
dsq->rumble(d.damage, d.damage, 0.4, _lastActionSourceID);
|
dsq->rumble(d.damage, d.damage, 0.4, _lastActionSourceID, _lastActionInputDevice);
|
||||||
if (d.damage > 0)
|
if (d.damage > 0)
|
||||||
{
|
{
|
||||||
//dsq->shakeCamera(5, t);
|
//dsq->shakeCamera(5, t);
|
||||||
|
@ -1312,12 +1312,12 @@ void Avatar::clearTargets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::openSingingInterface()
|
void Avatar::openSingingInterface(InputDevice device)
|
||||||
{
|
{
|
||||||
if (!singing && health > 0 && !isEntityDead() && !blockSinging)
|
if (!singing && health > 0 && !isEntityDead() && !blockSinging)
|
||||||
{
|
{
|
||||||
//core->mouse.position = Vector(400,300);
|
//core->mouse.position = Vector(400,300);
|
||||||
if (dsq->inputMode != INPUT_MOUSE)
|
if (device != INPUT_MOUSE)
|
||||||
{
|
{
|
||||||
core->centerMouse();
|
core->centerMouse();
|
||||||
//core->setMousePosition(Vector(400,300));
|
//core->setMousePosition(Vector(400,300));
|
||||||
|
@ -1340,7 +1340,7 @@ void Avatar::openSingingInterface()
|
||||||
dsq->game->songLineRender->clear();
|
dsq->game->songLineRender->clear();
|
||||||
|
|
||||||
|
|
||||||
if (dsq->inputMode == INPUT_JOYSTICK)
|
if (device == INPUT_JOYSTICK)
|
||||||
{
|
{
|
||||||
core->setMousePosition(core->center);
|
core->setMousePosition(core->center);
|
||||||
}
|
}
|
||||||
|
@ -2334,7 +2334,7 @@ bool Avatar::hasThingToActivate()
|
||||||
return ((pathToActivate != 0) || (entityToActivate != 0));
|
return ((pathToActivate != 0) || (entityToActivate != 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::formAbility(int ability)
|
void Avatar::formAbility()
|
||||||
{
|
{
|
||||||
if (hasThingToActivate()) return;
|
if (hasThingToActivate()) return;
|
||||||
//debugLog("form ability function");
|
//debugLog("form ability function");
|
||||||
|
@ -2469,137 +2469,121 @@ void Avatar::formAbility(int ability)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else if (ability == 1)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FORM_ENERGY:
|
case FORM_ENERGY:
|
||||||
{
|
{
|
||||||
if (ability == 0)
|
if (chargeLevelAttained == 2)
|
||||||
{
|
{
|
||||||
if (chargeLevelAttained == 2)
|
if (dsq->continuity.hasFormUpgrade(FORMUPGRADE_ENERGY2))
|
||||||
{
|
doShock("EnergyTendril2");
|
||||||
if (dsq->continuity.hasFormUpgrade(FORMUPGRADE_ENERGY2))
|
|
||||||
doShock("EnergyTendril2");
|
|
||||||
else
|
|
||||||
doShock("EnergyTendril");
|
|
||||||
if (!state.lockedToWall)
|
|
||||||
skeletalSprite.animate("energyChargeAttack", 0, ANIMLAYER_UPPERBODYIDLE);
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (core->afterEffectManager)
|
|
||||||
core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter, 0.1,0.03,30,0.2f, 1.5));
|
|
||||||
*/
|
|
||||||
dsq->playVisualEffect(VFX_SHOCK, position, this);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
doShock("EnergyTendril");
|
||||||
if (!fireDelay)
|
if (!state.lockedToWall)
|
||||||
{
|
skeletalSprite.animate("energyChargeAttack", 0, ANIMLAYER_UPPERBODYIDLE);
|
||||||
std::string shotName;
|
|
||||||
if (dsq->continuity.hasFormUpgrade(FORMUPGRADE_ENERGY2))
|
|
||||||
shotName = "EnergyBlast2";
|
|
||||||
else
|
|
||||||
shotName = "EnergyBlast";
|
|
||||||
|
|
||||||
if (fireAtNearestValidEntity(shotName))
|
/*
|
||||||
{
|
if (core->afterEffectManager)
|
||||||
fireDelay = fireDelayTime;
|
core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter, 0.1,0.03,30,0.2f, 1.5));
|
||||||
}
|
*/
|
||||||
|
dsq->playVisualEffect(VFX_SHOCK, position, this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!fireDelay)
|
||||||
|
{
|
||||||
|
std::string shotName;
|
||||||
|
if (dsq->continuity.hasFormUpgrade(FORMUPGRADE_ENERGY2))
|
||||||
|
shotName = "EnergyBlast2";
|
||||||
|
else
|
||||||
|
shotName = "EnergyBlast";
|
||||||
|
|
||||||
|
if (fireAtNearestValidEntity(shotName))
|
||||||
|
{
|
||||||
|
fireDelay = fireDelayTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FORM_NATURE:
|
case FORM_NATURE:
|
||||||
// no abilities
|
if (formAbilityDelay == 0)
|
||||||
{
|
{
|
||||||
//debugLog("rock ability");
|
formAbilityDelay = 0.2;
|
||||||
if (ability == 0)
|
//Vector pos = dsq->getGameCursorPosition() - position;
|
||||||
|
|
||||||
|
Vector pos = getAim();
|
||||||
|
if (!pos.isZero())
|
||||||
|
pos.setLength2D(16);
|
||||||
|
pos += position;
|
||||||
|
|
||||||
|
std::string seedName;
|
||||||
|
if (chargeLevelAttained == 0)
|
||||||
|
seedName = "SeedFlower";
|
||||||
|
else if (chargeLevelAttained == 2)
|
||||||
|
seedName = "SeedUberVine";
|
||||||
|
|
||||||
|
dsq->game->fireShot(seedName, this, 0, pos, getAim());
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Vector pos = getAim();
|
||||||
|
if (!pos.isZero())
|
||||||
|
pos.setLength2D(64);
|
||||||
|
pos += position;
|
||||||
|
|
||||||
|
|
||||||
|
//dsq->spawnParticleEffect("Fertilizer", pos);
|
||||||
|
|
||||||
|
Entity *e = 0;
|
||||||
|
std::string seedName;
|
||||||
|
if (chargeLevelAttained == 0)
|
||||||
|
seedName = "SeedFlower";
|
||||||
|
else if (chargeLevelAttained == 2)
|
||||||
|
seedName = "SeedUberVine";
|
||||||
|
|
||||||
|
e = dsq->game->createEntity(seedName, 0, pos, 0, false, "");
|
||||||
|
|
||||||
|
Vector add = pos - position;
|
||||||
|
add.setLength2D(800);
|
||||||
|
e->vel += add;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (chargeLevelAttained == 0)
|
||||||
{
|
{
|
||||||
if (formAbilityDelay == 0)
|
}
|
||||||
|
else if (chargeLevelAttained == 1)
|
||||||
|
{
|
||||||
|
e->setState(STATE_CHARGE1);
|
||||||
|
}
|
||||||
|
else if (chargeLevelAttained == 2)
|
||||||
|
{
|
||||||
|
e->setState(STATE_CHARGE2);
|
||||||
|
}
|
||||||
|
|
||||||
|
e->update(0);
|
||||||
|
*/
|
||||||
|
// idle = charge 0
|
||||||
|
// attack = charge1
|
||||||
|
// something = charge2
|
||||||
|
/*
|
||||||
|
FOR_ENTITIES (i)
|
||||||
|
{
|
||||||
|
Entity *e = *i;
|
||||||
|
if (e && e->getEntityType() == ET_ENEMY && e->isDamageTarget(DT_AVATAR_NATURE))
|
||||||
{
|
{
|
||||||
formAbilityDelay = 0.2;
|
if ((e->position - pos).isLength2DIn(128))
|
||||||
//Vector pos = dsq->getGameCursorPosition() - position;
|
|
||||||
|
|
||||||
Vector pos = getAim();
|
|
||||||
if (!pos.isZero())
|
|
||||||
pos.setLength2D(16);
|
|
||||||
pos += position;
|
|
||||||
|
|
||||||
std::string seedName;
|
|
||||||
if (chargeLevelAttained == 0)
|
|
||||||
seedName = "SeedFlower";
|
|
||||||
else if (chargeLevelAttained == 2)
|
|
||||||
seedName = "SeedUberVine";
|
|
||||||
|
|
||||||
dsq->game->fireShot(seedName, this, 0, pos, getAim());
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Vector pos = getAim();
|
|
||||||
if (!pos.isZero())
|
|
||||||
pos.setLength2D(64);
|
|
||||||
pos += position;
|
|
||||||
|
|
||||||
|
|
||||||
//dsq->spawnParticleEffect("Fertilizer", pos);
|
|
||||||
|
|
||||||
Entity *e = 0;
|
|
||||||
std::string seedName;
|
|
||||||
if (chargeLevelAttained == 0)
|
|
||||||
seedName = "SeedFlower";
|
|
||||||
else if (chargeLevelAttained == 2)
|
|
||||||
seedName = "SeedUberVine";
|
|
||||||
|
|
||||||
e = dsq->game->createEntity(seedName, 0, pos, 0, false, "");
|
|
||||||
|
|
||||||
Vector add = pos - position;
|
|
||||||
add.setLength2D(800);
|
|
||||||
e->vel += add;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (chargeLevelAttained == 0)
|
|
||||||
{
|
{
|
||||||
|
DamageData d;
|
||||||
|
d.damageType = DT_AVATAR_NATURE;
|
||||||
|
d.damage = 1;
|
||||||
|
d.attacker = this;
|
||||||
|
e->damage(d);
|
||||||
}
|
}
|
||||||
else if (chargeLevelAttained == 1)
|
|
||||||
{
|
|
||||||
e->setState(STATE_CHARGE1);
|
|
||||||
}
|
|
||||||
else if (chargeLevelAttained == 2)
|
|
||||||
{
|
|
||||||
e->setState(STATE_CHARGE2);
|
|
||||||
}
|
|
||||||
|
|
||||||
e->update(0);
|
|
||||||
*/
|
|
||||||
// idle = charge 0
|
|
||||||
// attack = charge1
|
|
||||||
// something = charge2
|
|
||||||
/*
|
|
||||||
FOR_ENTITIES (i)
|
|
||||||
{
|
|
||||||
Entity *e = *i;
|
|
||||||
if (e && e->getEntityType() == ET_ENEMY && e->isDamageTarget(DT_AVATAR_NATURE))
|
|
||||||
{
|
|
||||||
if ((e->position - pos).isLength2DIn(128))
|
|
||||||
{
|
|
||||||
DamageData d;
|
|
||||||
d.damageType = DT_AVATAR_NATURE;
|
|
||||||
d.damage = 1;
|
|
||||||
d.attacker = this;
|
|
||||||
e->damage(d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FORM_BEAST:
|
case FORM_BEAST:
|
||||||
|
@ -3021,20 +3005,20 @@ void Avatar::rmbd(int source, InputDevice device)
|
||||||
if (!isMouseInputEnabled() || isEntityDead()) return;
|
if (!isMouseInputEnabled() || isEntityDead()) return;
|
||||||
if (dsq->continuity.form == FORM_NORMAL )
|
if (dsq->continuity.form == FORM_NORMAL )
|
||||||
{
|
{
|
||||||
if (dsq->inputMode == INPUT_MOUSE)
|
if (device == INPUT_MOUSE)
|
||||||
{
|
{
|
||||||
Vector diff = getVectorToCursorFromScreenCentre();
|
Vector diff = getVectorToCursorFromScreenCentre();
|
||||||
if (diff.getSquaredLength2D() < sqr(openSingingInterfaceRadius))
|
if (diff.getSquaredLength2D() < sqr(openSingingInterfaceRadius))
|
||||||
openSingingInterface();
|
openSingingInterface(device);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
openSingingInterface();
|
openSingingInterface(device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
startCharge(0);
|
startCharge();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3045,7 +3029,7 @@ void Avatar::rmbu(int source, InputDevice device)
|
||||||
if (charging)
|
if (charging)
|
||||||
{
|
{
|
||||||
if (!entityToActivate && !pathToActivate)
|
if (!entityToActivate && !pathToActivate)
|
||||||
formAbility(0);
|
formAbility();
|
||||||
|
|
||||||
endCharge();
|
endCharge();
|
||||||
}
|
}
|
||||||
|
@ -3072,26 +3056,17 @@ void Avatar::rmbu(int source, InputDevice device)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Avatar::canCharge(int ability)
|
bool Avatar::canCharge()
|
||||||
{
|
{
|
||||||
switch(dsq->continuity.form)
|
switch(dsq->continuity.form)
|
||||||
{
|
{
|
||||||
case FORM_ENERGY:
|
case FORM_ENERGY:
|
||||||
if (ability == 0) return true;
|
|
||||||
break;
|
|
||||||
case FORM_BEAST:
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case FORM_DUAL:
|
case FORM_DUAL:
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case FORM_NATURE:
|
case FORM_NATURE:
|
||||||
if (ability == 0)
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case FORM_SUN:
|
case FORM_SUN:
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
case FORM_BEAST:
|
||||||
case FORM_NORMAL:
|
case FORM_NORMAL:
|
||||||
case FORM_SPIRIT:
|
case FORM_SPIRIT:
|
||||||
case FORM_FISH:
|
case FORM_FISH:
|
||||||
|
@ -3102,9 +3077,9 @@ bool Avatar::canCharge(int ability)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::startCharge(int ability)
|
void Avatar::startCharge()
|
||||||
{
|
{
|
||||||
if (!isCharging() && canCharge(ability))
|
if (!isCharging() && canCharge())
|
||||||
{
|
{
|
||||||
if (dsq->loops.charge != BBGE_AUDIO_NOCHANNEL)
|
if (dsq->loops.charge != BBGE_AUDIO_NOCHANNEL)
|
||||||
{
|
{
|
||||||
|
@ -3144,9 +3119,9 @@ void Avatar::startCharge(int ability)
|
||||||
charging = true;
|
charging = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!canCharge(ability))
|
if (!canCharge())
|
||||||
{
|
{
|
||||||
formAbility(ability);
|
formAbility();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3914,6 +3889,7 @@ Avatar::Avatar() : Entity(), ActionMapper()
|
||||||
blockBackFlip = false;
|
blockBackFlip = false;
|
||||||
elementEffectMult = 1;
|
elementEffectMult = 1;
|
||||||
_lastActionSourceID = 9999;
|
_lastActionSourceID = 9999;
|
||||||
|
_lastActionInputDevice = INPUT_NODEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::revert()
|
void Avatar::revert()
|
||||||
|
@ -4086,7 +4062,7 @@ void Avatar::startBurst()
|
||||||
{
|
{
|
||||||
if (!bursting && burst == 1)
|
if (!bursting && burst == 1)
|
||||||
{
|
{
|
||||||
dsq->rumble(0.2, 0.2, 0.2, _lastActionSourceID);
|
dsq->rumble(0.2, 0.2, 0.2, _lastActionSourceID, _lastActionInputDevice);
|
||||||
if (dsq->continuity.form != FORM_BEAST)
|
if (dsq->continuity.form != FORM_BEAST)
|
||||||
wakeEmitter.start();
|
wakeEmitter.start();
|
||||||
dsq->game->playBurstSound(pushingOffWallEffect>0);
|
dsq->game->playBurstSound(pushingOffWallEffect>0);
|
||||||
|
@ -4159,7 +4135,7 @@ void Avatar::startWallBurst(bool useCursor)
|
||||||
{
|
{
|
||||||
lastBurstType = BURST_WALL;
|
lastBurstType = BURST_WALL;
|
||||||
|
|
||||||
dsq->rumble(0.22, 0.22, 0.2, _lastActionSourceID);
|
dsq->rumble(0.22, 0.22, 0.2, _lastActionSourceID, _lastActionInputDevice);
|
||||||
bittenEntities.clear();
|
bittenEntities.clear();
|
||||||
if (useCursor)
|
if (useCursor)
|
||||||
{
|
{
|
||||||
|
@ -4270,6 +4246,7 @@ void Avatar::action(int id, int state, int source, InputDevice device)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_lastActionSourceID = source;
|
_lastActionSourceID = source;
|
||||||
|
_lastActionInputDevice = device;
|
||||||
|
|
||||||
if (id == ACTION_PRIMARY) { if (state) lmbd(source, device); else lmbu(source, device); }
|
if (id == ACTION_PRIMARY) { if (state) lmbd(source, device); else lmbu(source, device); }
|
||||||
if (id == ACTION_SECONDARY) { if (state) rmbd(source, device); else rmbu(source, device); }
|
if (id == ACTION_SECONDARY) { if (state) rmbd(source, device); else rmbu(source, device); }
|
||||||
|
@ -4337,7 +4314,7 @@ void Avatar::action(int id, int state, int source, InputDevice device)
|
||||||
// done for wall bursts, but the movement there is fast
|
// done for wall bursts, but the movement there is fast
|
||||||
// enough that people probably won't notice, so I skipped
|
// enough that people probably won't notice, so I skipped
|
||||||
// that. Sorry about the ugliness. --achurch
|
// that. Sorry about the ugliness. --achurch
|
||||||
if (dsq->inputMode != INPUT_MOUSE)
|
if (device != INPUT_MOUSE)
|
||||||
skeletalSprite.transitionAnimate("swim", ANIM_TRANSITION, -1);
|
skeletalSprite.transitionAnimate("swim", ANIM_TRANSITION, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4539,7 +4516,7 @@ void Avatar::splash(bool down)
|
||||||
//dsq->postProcessingFx.disable(FXT_RADIALBLUR);
|
//dsq->postProcessingFx.disable(FXT_RADIALBLUR);
|
||||||
if (_isUnderWater && core->afterEffectManager)
|
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));
|
core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter,0.08,0.05,22,0.2f, 1.2));
|
||||||
dsq->rumble(0.7, 0.7, 0.2, _lastActionSourceID);
|
dsq->rumble(0.7, 0.7, 0.2, _lastActionSourceID, _lastActionInputDevice);
|
||||||
plungeEmitter.start();
|
plungeEmitter.start();
|
||||||
|
|
||||||
core->sound->playSfx("GoUnder");
|
core->sound->playSfx("GoUnder");
|
||||||
|
|
|
@ -179,7 +179,7 @@ public:
|
||||||
|
|
||||||
void startBurstCommon();
|
void startBurstCommon();
|
||||||
|
|
||||||
void openSingingInterface();
|
void openSingingInterface(InputDevice device);
|
||||||
void closeSingingInterface();
|
void closeSingingInterface();
|
||||||
void updateSingingInterface(float dt);
|
void updateSingingInterface(float dt);
|
||||||
|
|
||||||
|
@ -195,10 +195,10 @@ public:
|
||||||
|
|
||||||
void setNearestPullTarget();
|
void setNearestPullTarget();
|
||||||
|
|
||||||
void formAbility(int ability);
|
void formAbility();
|
||||||
bool isMouseInputEnabled();
|
bool isMouseInputEnabled();
|
||||||
|
|
||||||
void startCharge(int ability);
|
void startCharge();
|
||||||
int currentMaxSpeed;
|
int currentMaxSpeed;
|
||||||
Vector getFakeCursorPosition();
|
Vector getFakeCursorPosition();
|
||||||
Vector getVectorToCursor(bool trueMouse=false);
|
Vector getVectorToCursor(bool trueMouse=false);
|
||||||
|
@ -331,7 +331,8 @@ public:
|
||||||
|
|
||||||
bool blockBackFlip;
|
bool blockBackFlip;
|
||||||
|
|
||||||
int getLastActionSourceID() { return _lastActionSourceID; }
|
int getLastActionSourceID() const { return _lastActionSourceID; }
|
||||||
|
InputDevice getLastActionInputDevice() const { return _lastActionInputDevice; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setSongIconPositions();
|
void setSongIconPositions();
|
||||||
|
@ -410,7 +411,7 @@ protected:
|
||||||
|
|
||||||
void clampVelocity();
|
void clampVelocity();
|
||||||
|
|
||||||
bool canCharge(int ability);
|
bool canCharge();
|
||||||
void formAbilityUpdate(float dt);
|
void formAbilityUpdate(float dt);
|
||||||
float revertTimer;
|
float revertTimer;
|
||||||
|
|
||||||
|
@ -468,6 +469,7 @@ protected:
|
||||||
float _collisionAvoidMod;
|
float _collisionAvoidMod;
|
||||||
|
|
||||||
int _lastActionSourceID;
|
int _lastActionSourceID;
|
||||||
|
InputDevice _lastActionInputDevice;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -248,9 +248,9 @@ void DSQ::onWindowResize(int w, int h)
|
||||||
screenTransition->reloadDevice();
|
screenTransition->reloadDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSQ::rumble(float leftMotor, float rightMotor, float time, int source)
|
void DSQ::rumble(float leftMotor, float rightMotor, float time, int source, InputDevice device)
|
||||||
{
|
{
|
||||||
if (this->inputMode == INPUT_JOYSTICK)
|
if (device == INPUT_JOYSTICK)
|
||||||
{
|
{
|
||||||
if(source < 0)
|
if(source < 0)
|
||||||
for(size_t i = 0; i < user.control.actionSets.size(); ++i)
|
for(size_t i = 0; i < user.control.actionSets.size(); ++i)
|
||||||
|
|
|
@ -353,7 +353,7 @@ public:
|
||||||
InputDevice inputMode;
|
InputDevice inputMode;
|
||||||
void setInputMode(InputDevice mode);
|
void setInputMode(InputDevice mode);
|
||||||
|
|
||||||
void rumble(float leftMotor, float rightMotor, float time, int source);
|
void rumble(float leftMotor, float rightMotor, float time, int source, InputDevice device);
|
||||||
void vision(std::string folder, int num, bool ignoreMusic = false);
|
void vision(std::string folder, int num, bool ignoreMusic = false);
|
||||||
|
|
||||||
void watch(float t, int canQuit = 0);
|
void watch(float t, int canQuit = 0);
|
||||||
|
|
|
@ -1305,10 +1305,11 @@ bool Entity::updateCurrents(float dt)
|
||||||
float scale = 0.2;
|
float scale = 0.2;
|
||||||
if (getEntityType() == ET_AVATAR)
|
if (getEntityType() == ET_AVATAR)
|
||||||
{
|
{
|
||||||
|
Avatar *a = dsq->game->avatar;
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
dsq->rumble((-v)*scale, (1.0f+v)*scale, 0.2, dsq->game->avatar->getLastActionSourceID());
|
dsq->rumble((-v)*scale, (1.0f+v)*scale, 0.2, a->getLastActionSourceID(), a->getLastActionInputDevice());
|
||||||
else
|
else
|
||||||
dsq->rumble((1.0f-v)*scale, (v)*scale, 0.1, dsq->game->avatar->getLastActionSourceID());
|
dsq->rumble((1.0f-v)*scale, (v)*scale, 0.1, a->getLastActionSourceID(), a->getLastActionInputDevice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5032,7 +5032,7 @@ void Game::removeState()
|
||||||
dsq->overlay->alpha.interpolateTo(1, fadeTime);
|
dsq->overlay->alpha.interpolateTo(1, fadeTime);
|
||||||
dsq->run(fadeTime);
|
dsq->run(fadeTime);
|
||||||
|
|
||||||
dsq->rumble(0,0,0,-1);
|
dsq->rumble(0,0,0,-1, INPUT_JOYSTICK);
|
||||||
|
|
||||||
dsq->sound->clearFadingSfx();
|
dsq->sound->clearFadingSfx();
|
||||||
|
|
||||||
|
|
|
@ -2078,8 +2078,12 @@ luaFunc(shakeCamera)
|
||||||
|
|
||||||
luaFunc(rumble)
|
luaFunc(rumble)
|
||||||
{
|
{
|
||||||
int source = lua_tonumber(L, 4) - 1;
|
int source = lua_tointeger(L, 4) - 1;
|
||||||
dsq->rumble(lua_tonumber(L, 1), lua_tonumber(L, 2), lua_tonumber(L, 3), source);
|
Avatar *a = dsq->game->avatar;
|
||||||
|
InputDevice device = (InputDevice)lua_tointeger(L, 5);
|
||||||
|
if(device == INPUT_NODEVICE) // default: use avatar status
|
||||||
|
device = a ? a->getLastActionInputDevice() : INPUT_NODEVICE;
|
||||||
|
dsq->rumble(lua_tonumber(L, 1), lua_tonumber(L, 2), lua_tonumber(L, 3), source, device);
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue