1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-27 00:40:21 +00:00

Merge pull request #2610 from akortunov/warnfix2

Fix some build warnings
This commit is contained in:
Bret Curtis 2019-11-27 21:24:44 +01:00 committed by GitHub
commit 62b9f1a2f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 57 deletions

View File

@ -1773,23 +1773,25 @@ bool CharacterController::updateWeaponState(CharacterState& idle)
0, mAttackType+" min attack", mAttackType+" max attack", 0.999f, 0);
break;
case UpperCharState_StartToMinAttack:
{
// If actor is already stopped preparing attack, do not play the "min attack -> max attack" part.
// Happens if the player did not hold the attack button.
// Note: if the "min attack"->"max attack" is a stub, "play" it anyway. Attack strength will be random.
float minAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"min attack");
float maxAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"max attack");
if (mAttackingOrSpell || minAttackTime == maxAttackTime)
{
start = mAttackType+" min attack";
stop = mAttackType+" max attack";
mUpperBodyState = UpperCharState_MinAttackToMaxAttack;
break;
}
playSwishSound(0.0f);
}
// Fall-through
case UpperCharState_MaxAttackToMinHit:
{
if (mUpperBodyState == UpperCharState_StartToMinAttack)
{
// If actor is already stopped preparing attack, do not play the "min attack -> max attack" part.
// Happens if the player did not hold the attack button.
// Note: if the "min attack"->"max attack" is a stub, "play" it anyway. Attack strength will be random.
float minAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"min attack");
float maxAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"max attack");
if (mAttackingOrSpell || minAttackTime == maxAttackTime)
{
start = mAttackType+" min attack";
stop = mAttackType+" max attack";
mUpperBodyState = UpperCharState_MinAttackToMaxAttack;
break;
}
playSwishSound(0.0f);
}
if(mAttackType == "shoot")
{
start = mAttackType+" min hit";
@ -1802,6 +1804,7 @@ bool CharacterController::updateWeaponState(CharacterState& idle)
}
mUpperBodyState = UpperCharState_MinHitToHit;
break;
}
case UpperCharState_MinHitToHit:
if(mAttackType == "shoot")
{

View File

@ -127,54 +127,39 @@ namespace MWMechanics
mDistSameSpot = DIST_SAME_SPOT * actor.getClass().getSpeed(actor);
const float distSameSpot = mDistSameSpot * duration;
const bool samePosition = (pos - mPrev).length2() < distSameSpot * distSameSpot;
const bool samePosition = (pos - mPrev).length2() < distSameSpot * distSameSpot;
mPrev = pos;
switch(mWalkState)
if (mWalkState != State_Evade)
{
case State_Norm:
if(!samePosition)
{
if(!samePosition)
break;
else
mWalkState = State_CheckStuck;
mWalkState = State_Norm;
mStuckDuration = 0;
mEvadeDuration = 0;
return;
}
/* FALL THROUGH */
case State_CheckStuck:
mWalkState = State_CheckStuck;
mStuckDuration += duration;
// consider stuck only if position unchanges for a period
if(mStuckDuration < DURATION_SAME_SPOT)
return; // still checking, note duration added to timer
else
{
if(!samePosition)
{
mWalkState = State_Norm;
mStuckDuration = 0;
break;
}
else
{
mStuckDuration += duration;
// consider stuck only if position unchanges for a period
if(mStuckDuration < DURATION_SAME_SPOT)
break; // still checking, note duration added to timer
else
{
mStuckDuration = 0;
mWalkState = State_Evade;
chooseEvasionDirection();
}
}
mStuckDuration = 0;
mWalkState = State_Evade;
chooseEvasionDirection();
}
/* FALL THROUGH */
case State_Evade:
{
mEvadeDuration += duration;
if(mEvadeDuration >= DURATION_TO_EVADE)
{
// tried to evade, assume all is ok and start again
mWalkState = State_Norm;
mEvadeDuration = 0;
}
}
/* NO DEFAULT CASE */
}
mEvadeDuration += duration;
if(mEvadeDuration >= DURATION_TO_EVADE)
{
// tried to evade, assume all is ok and start again
mWalkState = State_Norm;
mEvadeDuration = 0;
}
}

View File

@ -148,7 +148,7 @@ namespace ICS
float step = FromString<float>(xmlInterval->Attribute("step"));
ICS_LOG("Applying Bezier filter to channel [number="
+ ToString<int>(ch) + ", startX="
+ ToString<size_t>(ch) + ", startX="
+ ToString<float>(startX) + ", startY="
+ ToString<float>(startY) + ", midX="
+ ToString<float>(midX) + ", midY="