Make VTOLs roll more when turning, and smoothly.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9473 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
f9e3b1eb85
commit
826f3fde0c
22
src/move.c
22
src/move.c
|
@ -2380,8 +2380,9 @@ static void moveUpdateVtolModel(DROID *psDroid, SDWORD speed, SDWORD direction)
|
||||||
{
|
{
|
||||||
float fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
|
float fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
|
||||||
float iDroidDir;
|
float iDroidDir;
|
||||||
SDWORD iMapZ, iRoll, slideDir, iSpinSpeed, iTurnSpeed;
|
SDWORD iMapZ, slideDir, iSpinSpeed, iTurnSpeed;
|
||||||
float fDZ, fDroidZ, fMapZ;
|
float fDZ, fDroidZ, fMapZ, targetRoll, currentRoll;
|
||||||
|
int newRoll;
|
||||||
|
|
||||||
CHECK_DROID(psDroid);
|
CHECK_DROID(psDroid);
|
||||||
|
|
||||||
|
@ -2404,8 +2405,7 @@ static void moveUpdateVtolModel(DROID *psDroid, SDWORD speed, SDWORD direction)
|
||||||
{
|
{
|
||||||
iSpinSpeed = (psDroid->baseSpeed/2 > VTOL_SPIN_SPEED) ? psDroid->baseSpeed/2 : VTOL_SPIN_SPEED;
|
iSpinSpeed = (psDroid->baseSpeed/2 > VTOL_SPIN_SPEED) ? psDroid->baseSpeed/2 : VTOL_SPIN_SPEED;
|
||||||
iTurnSpeed = (psDroid->baseSpeed/8 > VTOL_TURN_SPEED) ? psDroid->baseSpeed/8 : VTOL_TURN_SPEED;
|
iTurnSpeed = (psDroid->baseSpeed/8 > VTOL_TURN_SPEED) ? psDroid->baseSpeed/8 : VTOL_TURN_SPEED;
|
||||||
moveUpdateDroidDirection( psDroid, &speed, direction, VTOL_SPIN_ANGLE,
|
moveUpdateDroidDirection(psDroid, &speed, direction, VTOL_SPIN_ANGLE, iSpinSpeed, iTurnSpeed, &iDroidDir, &fSpeed);
|
||||||
iSpinSpeed, iTurnSpeed, &iDroidDir, &fSpeed );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fNormalSpeed = moveCalcNormalSpeed( psDroid, fSpeed, iDroidDir,
|
fNormalSpeed = moveCalcNormalSpeed( psDroid, fSpeed, iDroidDir,
|
||||||
|
@ -2426,12 +2426,18 @@ static void moveUpdateVtolModel(DROID *psDroid, SDWORD speed, SDWORD direction)
|
||||||
moveUpdateDroidPos( psDroid, dx, dy );
|
moveUpdateDroidPos( psDroid, dx, dy );
|
||||||
|
|
||||||
/* update vtol orientation */
|
/* update vtol orientation */
|
||||||
iRoll = (psDroid->sMove.moveDir - psDroid->direction) / 3;
|
targetRoll = MIN(MAX((psDroid->sMove.moveDir - psDroid->direction)*4, -60), 60);
|
||||||
if ( iRoll < 0 )
|
currentRoll = psDroid->roll;
|
||||||
|
if (currentRoll > 180)
|
||||||
{
|
{
|
||||||
iRoll += 360;
|
currentRoll -= 360;
|
||||||
}
|
}
|
||||||
psDroid->roll = (UWORD) iRoll;
|
newRoll = currentRoll + timeAdjustedIncrement(3*(targetRoll - currentRoll), true) + 0.5f;
|
||||||
|
if (newRoll < 0 )
|
||||||
|
{
|
||||||
|
newRoll += 360;
|
||||||
|
}
|
||||||
|
psDroid->roll = newRoll;
|
||||||
|
|
||||||
iMapZ = map_Height(psDroid->pos.x, psDroid->pos.y);
|
iMapZ = map_Height(psDroid->pos.x, psDroid->pos.y);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue