Patch from Noid posted on forums: http://wz2100.net/forum/index.php?topic=291.0 --- I figured I'd just give it a shot, and, as my first attempt at C, change the direction to FRACT. And it seems it worked. Units turn at the correct speed, regardless of the gamespeed. VTOL's land beautifully. Saving and loading works, loading old savegames doesn't work at the moment as I haven't looked into that yet. I guess I'll have to define a new savegame version.
I haven't tested multiplayer, only Skirmish. Patch to SVN attached. --- This patch makes heavy use of FRACT which might not be what we want... --Dennis
Index: warzone/src/warcam.c
===================================================================
--- warzone/src/warcam.c (revision 1029)
+++ warzone/src/warcam.c (working copy)
@@ -330,7 +330,7 @@
{
radarTarget.z = map_Height(x,y);
}
- radarTarget.direction = (UWORD)calcDirection(player.p.x, player.p.z, x, y);
+ radarTarget.directionF = MAKEFRACT(calcDirection(player.p.x, player.p.z, x, y));
radarTarget.pitch = 0;
radarTarget.roll = 0;
radarTarget.type = OBJ_TARGET;
@@ -592,7 +592,7 @@
FRACT xTotal = 0.0, yTotal = 0.0;
FRACT averageAngleFloat = 0;
SDWORD droidCount = 0, averageAngle = 0;
- SDWORD retVal;
+ SDWORD retVal, tempDir;
/* Got thru' all droids */
for (psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
@@ -603,9 +603,10 @@
if (bCheckOnScreen ? droidOnScreen(psDroid, pie_GetVideoBufferWidth() / 6) : TRUE)
{
droidCount++;
- averageAngle += psDroid->direction;
- xShift = trigSin(psDroid->direction);
- yShift = trigCos(psDroid->direction);
+ tempDir = MAKEINT(psDroid->directionF);
+ averageAngle += tempDir;
+ xShift = trigSin(tempDir);
+ yShift = trigCos(tempDir);
xTotal += xShift;
yTotal += yShift;
}
@@ -634,7 +635,7 @@
FRACT xTotal = 0.0, yTotal = 0.0;
FRACT averageAngleFloat = 0;
SDWORD droidCount = 0, averageAngle = 0;
- SDWORD retVal;
+ SDWORD retVal, tempDir;
/* Got thru' all droids */
for (psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
@@ -645,9 +646,10 @@
if (bCheckOnScreen ? droidOnScreen(psDroid, pie_GetVideoBufferWidth() / 6) : TRUE)
{
droidCount++;
- averageAngle += psDroid->direction;
- xShift = trigSin(psDroid->direction);
- yShift = trigCos(psDroid->direction);
+ tempDir = MAKEINT(psDroid->directionF);
+ averageAngle += tempDir;
+ xShift = trigSin(tempDir);
+ yShift = trigCos(tempDir);
xTotal += xShift;
yTotal += yShift;
}
@@ -820,8 +822,8 @@
}
else
{
- xBehind = ((camDroidYOffset*SIN(DEG(trackingCamera.target->direction))) >> FP12_SHIFT);
- yBehind = ((camDroidXOffset*COS(DEG(trackingCamera.target->direction))) >> FP12_SHIFT);
+ xBehind = ((camDroidYOffset*SIN(DEG(MAKEINT(trackingCamera.target->directionF)))) >> FP12_SHIFT);
+ yBehind = ((camDroidXOffset*COS(DEG(MAKEINT(trackingCamera.target->directionF)))) >> FP12_SHIFT);
}
}
else
@@ -1059,7 +1061,7 @@
}
else
{
- yConcern = DEG(trackingCamera.target->direction);
+ yConcern = DEG(MAKEINT(trackingCamera.target->directionF));
}
yConcern += DEG(180);
Index: warzone/src/oprint.c
===================================================================
--- warzone/src/oprint.c (revision 1029)
+++ warzone/src/oprint.c (working copy)
@@ -54,9 +54,9 @@
break;
}
- OPRINTF(ConsoleString,(ConsoleString,"%s id %d at (%d,%d,%d) dpr (%d,%d,%d)\n",
+ OPRINTF(ConsoleString,(ConsoleString,"%s id %d at (%d,%d,%d) dpr (%f,%d,%d)\n",
pType, psObj->id, psObj->x,psObj->y,psObj->z,
- psObj->direction,psObj->pitch,psObj->roll));
+ psObj->directionF,psObj->pitch,psObj->roll));
}
// print out information about a general component
Index: warzone/src/action.c
===================================================================
--- warzone/src/action.c (revision 1029)
+++ warzone/src/action.c (working copy)
@@ -526,7 +526,7 @@
//and point the turret at target
targetRotation = calcDirection(psAttacker->x, psAttacker->y, psTarget->x, psTarget->y);
- rotationError = targetRotation - (tRotation + psAttacker->direction);
+ rotationError = targetRotation - (tRotation + MAKEINT(psAttacker->directionF)); //Noid: direction now FRACT
//restrict rotationerror to =/- 180 degrees
while (rotationError > 180)
{
@@ -558,13 +558,13 @@
}
else //roughly there so lock on and fire
{
- if ((SDWORD)psAttacker->direction > targetRotation)
+ if (MAKEINT(psAttacker->directionF) > targetRotation)
{
- tRotation = (SWORD)(targetRotation + 360 - psAttacker->direction);
+ tRotation = (SWORD)(targetRotation + 360 - MAKEINT(psAttacker->directionF));
}
else
{
- tRotation = (SWORD)(targetRotation - psAttacker->direction);
+ tRotation = (SWORD)(targetRotation - MAKEINT(psAttacker->directionF));
}
// debug( LOG_NEVER, "locked on target...\n");
onTarget = TRUE;
@@ -1171,8 +1171,8 @@
ASSERT( psPropStats != NULL,
"actionUpdateUnit: invalid propulsion stats pointer" );
- ASSERT( psDroid->turretRotation[i] < 360, "turretRotation out of range" );
- ASSERT( psDroid->direction < 360, "unit direction out of range" );
+ ASSERT( psDroid->turretRotation[i] < 360, "turretRotation out of range: %f", psDroid->turretRotation[i]);
+ ASSERT( psDroid->directionF < 360, "unit direction out of range: %f", psDroid->directionF);
/* check whether turret inverted for actionTargetTurret */
//if ( psDroid->droidType != DROID_CYBORG &&
@@ -1658,7 +1658,7 @@
targetDir = (SDWORD)calcDirection(
psDroid->x,psDroid->y,
psActionTarget->x, psActionTarget->y);
- dirDiff = labs(targetDir - (SDWORD)psDroid->direction);
+ dirDiff = labs(targetDir - MAKEINT(psDroid->directionF));
}
else
{
Index: warzone/src/base.h
===================================================================
--- warzone/src/base.h (revision 1029)
+++ warzone/src/base.h (working copy)
@@ -52,7 +52,8 @@
OBJECT_TYPE type; /* The type of object */ \
UDWORD id; /* ID number of the object */ \
UWORD x,y,z; /* Object's location */ \
- UWORD direction; /* Object's direction +ve rotation about y axis*/ \
+ /* UWORD direction;*/ /* Object's direction +ve rotation about y axis*/ \
+ FRACT directionF; /* Object's direction +ve rotation about y axis, noid: now FRACT*/ \
SWORD pitch; /* Object's pitch +ve nose up*/ \
SWORD roll /* Object's roll +ve left up, right down */
Index: warzone/src/multibot.c
===================================================================
--- warzone/src/multibot.c (revision 1029)
+++ warzone/src/multibot.c (working copy)
@@ -1178,7 +1178,7 @@
NetAdd(m,sizecount,pD->NameVersion); sizecount+=sizeof(pD->NameVersion);
NetAdd(m,sizecount,pD->droidType); sizecount+=sizeof(pD->droidType);
- NetAdd(m,sizecount,pD->direction); sizecount+=sizeof(pD->direction);
+ NetAdd(m,sizecount,pD->directionF); sizecount+=sizeof(pD->directionF);
NetAdd(m,sizecount,pD->pitch); sizecount+=sizeof(pD->pitch);
NetAdd(m,sizecount,pD->roll); sizecount+=sizeof(pD->roll);
NetAdd(m,sizecount,pD->visible); sizecount+=sizeof(pD->visible);
@@ -1288,7 +1288,7 @@
NetGet(m,sizecount,pD->NameVersion); sizecount+=sizeof(pD->NameVersion);
NetGet(m,sizecount,pD->droidType); sizecount+=sizeof(pD->droidType);
- NetGet(m,sizecount,pD->direction); sizecount+=sizeof(pD->direction);
+ NetGet(m,sizecount,pD->directionF); sizecount+=sizeof(pD->directionF);
NetGet(m,sizecount,pD->pitch); sizecount+=sizeof(pD->pitch);
NetGet(m,sizecount,pD->roll); sizecount+=sizeof(pD->roll);
Index: warzone/src/structure.c
===================================================================
--- warzone/src/structure.c (revision 1029)
+++ warzone/src/structure.c (working copy)
@@ -1738,7 +1738,7 @@
psStruct = apsStructs[x][y];
if (psStruct->pStructureType->type == REF_WALL)
{
- if (psStruct->direction == 90)
+ if (MAKEINT(psStruct->directionF) == 90)
{
nayborType = WALL_VERT;
}
@@ -1804,12 +1804,12 @@
else if (scanType == WALL_HORIZ)
{
// change to a horizontal wall
- psStruct->direction = 0;
+ psStruct->directionF = 0;
}
else
{
// change to a vertical wall
- psStruct->direction = 90;
+ psStruct->directionF = 90;
}
}
}
@@ -2158,7 +2158,7 @@
psBuilding->burnStart = 0;
psBuilding->burnDamage = 0;
- psBuilding->direction = 0;
+ psBuilding->directionF = 0;
psBuilding->pitch = 0;
psBuilding->roll = 0;
//psBuilding->damage = structureDamage;
@@ -2174,7 +2174,7 @@
// rotate a wall if necessary
if (!FromSave && pStructureType->type == REF_WALL && wallType == WALL_VERT)
{
- psBuilding->direction = 90;
+ psBuilding->directionF = 90;
}
//set up the sensor stats
@@ -7242,7 +7242,7 @@
pie_TRANSLATE(psStructure->x,-(SDWORD)psStructure->z,psStructure->y);
//matrix = the center of droid
- pie_MatRotY(DEG((SDWORD) psStructure->direction));
+ pie_MatRotY(DEG(MAKEINT(psStructure->directionF)));
pie_MatRotX(DEG(psStructure->pitch));
pie_MatRotZ(DEG(-(SDWORD)psStructure->roll));
// pie_TRANSLATE(100,0,0); // (left,-height,forward)
@@ -7301,7 +7301,7 @@
pie_TRANSLATE(psStructure->x,-(SDWORD)psStructure->z,psStructure->y);
//matrix = the center of droid
- pie_MatRotY(DEG((SDWORD) psStructure->direction));
+ pie_MatRotY(DEG(MAKEINT(psStructure->directionF)));
pie_MatRotX(DEG(psStructure->pitch));
pie_MatRotZ(DEG(-(SDWORD)psStructure->roll));
// pie_TRANSLATE(100,0,0); // (left,-height,forward)
@@ -9473,7 +9473,7 @@
psType = psStructure->pStructureType;
x = psStructure->x;
y = psStructure->y;
- direction = psStructure->direction;
+ direction = (UWORD)MAKEINT(psStructure->directionF);
originalPlayer = psStructure->player;
//save how complete the build process is
if (psStructure->status == SS_BEING_BUILT)
@@ -9509,7 +9509,7 @@
psNewStruct = buildStructure(psType, x, y, attackPlayer, TRUE);
if (psNewStruct)
{
- psNewStruct->direction = direction;
+ psNewStruct->directionF = MAKEFRACT(direction);
if (capacity)
{
switch(psType->type)
Index: warzone/src/combat.c
===================================================================
--- warzone/src/combat.c (revision 1029)
+++ warzone/src/combat.c (working copy)
@@ -287,7 +287,7 @@
{
targetDir = (SDWORD)calcDirection(psAttacker->x,psAttacker->y,
psTarget->x,psTarget->y);
- dirDiff = labs(targetDir - (SDWORD)psAttacker->direction);
+ dirDiff = labs(targetDir - MAKEINT(psAttacker->directionF));
if (dirDiff > FIXED_TURRET_DIR)
{
return;
@@ -394,9 +394,9 @@
//Watermelon:Target prediction
if(psTarget->type == OBJ_DROID)
{
- predictX = (sinf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.dir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
+ predictX = (sinf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.moveDir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
predictX += psTarget->x;
- predictY = (cosf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.dir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
+ predictY = (cosf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.moveDir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
predictY += psTarget->y;
}
else
@@ -445,9 +445,9 @@
//Watermelon:Target prediction
if(psTarget->type == OBJ_DROID)
{
- predictX = (sinf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.dir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
+ predictX = (sinf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.moveDir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
predictX += psTarget->x;
- predictY = (cosf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.dir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
+ predictY = (cosf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.moveDir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
predictY += psTarget->y;
}
else
Index: warzone/src/move.c
===================================================================
--- warzone/src/move.c (revision 1029)
+++ warzone/src/move.c (working copy)
@@ -590,7 +590,7 @@
{
SDWORD moveDir = (SDWORD)calcDirection(psDroid->x,psDroid->y, x, y);
- if ( psDroid->direction != (UDWORD) moveDir )
+ if ( MAKEINT(psDroid->directionF) != moveDir )
{
psDroid->sMove.targetX = (SDWORD)x;
psDroid->sMove.targetY = (SDWORD)y;
@@ -880,7 +880,7 @@
//dx is atan of angle of elevation along x axis
//dx is atan of angle of elevation along y axis
//body
- direction = (M_PI * psDroid->direction) / 180.0;
+ direction = (M_PI * psDroid->directionF) / 180.0;
pitch = sin(direction) * dx + cos(direction) * dy;
pitch = atan(pitch);
newPitch = (SDWORD)((pitch * 180) / M_PI);
@@ -970,10 +970,10 @@
#endif
ASSERT( target < MAKEFRACT(360) && target >= MAKEFRACT(0),
- "moveCalcTurn: target out of range" );
+ "moveCalcTurn: target out of range %f",target );
ASSERT( (*pCurr) < MAKEFRACT(360) && (*pCurr) >= MAKEFRACT(0),
- "moveCalcTurn: cur ang out of range" );
+ "moveCalcTurn: cur ang out of range %f",(*pCurr) );
// calculate the difference in the angles
@@ -986,10 +986,11 @@
// change = FRACTmul( baseTurn, MAKEFRACT(rate) );
change = (baseTurn* rate); // constant rate so we can use a normal mult
- if(change < FRACTCONST(1,1))
- {
- change = FRACTCONST(1,1); // HACK to solve issue of when framerate so high
- } // that integer angle to turn per frame is less than 1
+ //if(change < FRACTCONST(1,1))
+ //{ // Noid: This should not be needed anymore
+ //printf("Change = %f \n",change);
+ //change = FRACTCONST(1,1); // HACK to solve issue of when framerate so high
+ //} // that integer angle to turn per frame is less than 1
@@ -1244,7 +1245,7 @@
}
// See if the block can be cancelled
- if (dirDiff((SDWORD)psDroid->direction, psDroid->sMove.bumpDir) > BLOCK_DIR)
+ if (dirDiff(MAKEINT(psDroid->directionF), psDroid->sMove.bumpDir) > BLOCK_DIR)
{
// Move on, clear the bump
psDroid->sMove.bumpTime = 0;
@@ -1495,7 +1496,7 @@
psDroid->sMove.pauseTime = 0;
psDroid->sMove.bumpX = psDroid->x;
psDroid->sMove.bumpY = psDroid->y;
- psDroid->sMove.bumpDir = (SWORD)psDroid->direction;
+ psDroid->sMove.bumpDir = (SWORD)MAKEINT(psDroid->directionF);
}
if (tx != ntx && ty != nty)
@@ -1844,7 +1845,7 @@
psDroid->sMove.pauseTime = 0;
psDroid->sMove.bumpX = psDroid->x;
psDroid->sMove.bumpY = psDroid->y;
- psDroid->sMove.bumpDir = (SWORD)psDroid->direction;
+ psDroid->sMove.bumpDir = (SWORD)MAKEINT(psDroid->directionF);
}
else
{
@@ -2400,14 +2401,15 @@
}
static void moveUpdateDroidDirection( DROID *psDroid, SDWORD *pSpeed, SDWORD direction,
- SDWORD iSpinAngle, SDWORD iSpinSpeed, SDWORD iTurnSpeed, SDWORD *pDroidDir,
- FRACT *pfSpeed )
+ SDWORD iSpinAngle, SDWORD iSpinSpeed, SDWORD iTurnSpeed, FRACT *pDroidDir,
+ FRACT *pfSpeed ) //Noid: *pDroidDir SDWORD -> FRACT
+ // direction is target-direction
{
- SDWORD adiff;
+ FRACT adiff;
FRACT temp;
*pfSpeed = MKF(*pSpeed);
- *pDroidDir = (SDWORD) psDroid->direction;
+ *pDroidDir = psDroid->directionF;
// don't move if in MOVEPAUSE state
if (psDroid->sMove.Status == MOVEPAUSE)
@@ -2415,8 +2417,8 @@
return;
}
- temp = MKF(*pDroidDir);
- adiff = labs(direction - *pDroidDir);
+ temp = *pDroidDir;
+ adiff = fabsf(direction - *pDroidDir);
if (adiff > TRIG_DEGREES/2)
{
adiff = TRIG_DEGREES - adiff;
@@ -2435,18 +2437,18 @@
moveCalcTurn(&temp, MKF(direction), iTurnSpeed);
}
- *pDroidDir = MAKEINT(temp);
+ *pDroidDir = temp;
}
// Calculate current speed perpendicular to droids direction
-static FRACT moveCalcPerpSpeed( DROID *psDroid, SDWORD iDroidDir, SDWORD iSkidDecel )
+static FRACT moveCalcPerpSpeed( DROID *psDroid, FRACT iDroidDir, SDWORD iSkidDecel )
{
- SDWORD adiff;
+ FRACT adiff;
FRACT perpSpeed;
- adiff = labs(iDroidDir - psDroid->sMove.dir);
- perpSpeed = Fmul(psDroid->sMove.speed,trigSin(adiff));
+ adiff = fabsf(iDroidDir - psDroid->sMove.moveDir);
+ perpSpeed = Fmul(psDroid->sMove.speed,trigSin(MAKEINT(adiff)));
// decelerate the perpendicular speed
perpSpeed -= (iSkidDecel * baseSpeed);
@@ -2460,32 +2462,32 @@
static void moveCombineNormalAndPerpSpeeds( DROID *psDroid, FRACT fNormalSpeed,
- FRACT fPerpSpeed, SDWORD iDroidDir )
+ FRACT fPerpSpeed, FRACT iDroidDir ) // Noid: iDroidDir might need changing to FRACT
{
- SDWORD finalDir, adiff;
+ FRACT finalDir, adiff;
FRACT finalSpeed;
/* set current direction */
- psDroid->direction = (UWORD)iDroidDir;
+ psDroid->directionF = iDroidDir;
/* set normal speed and direction if perpendicular speed is zero */
if (fPerpSpeed == MKF(0))
{
psDroid->sMove.speed = fNormalSpeed;
- psDroid->sMove.dir = (SWORD)iDroidDir;
+ psDroid->sMove.moveDir = iDroidDir;
return;
}
finalSpeed = fSQRT(Fmul(fNormalSpeed,fNormalSpeed) + Fmul(fPerpSpeed,fPerpSpeed));
// calculate the angle between the droid facing and movement direction
- finalDir = MAKEINT(trigInvCos(Fdiv(fNormalSpeed,finalSpeed)));
+ finalDir = trigInvCos(Fdiv(fNormalSpeed,finalSpeed));
// choose the finalDir on the same side as the old movement direction
- adiff = labs(iDroidDir - psDroid->sMove.dir);
+ adiff = fabsf(iDroidDir - psDroid->sMove.moveDir);
if (adiff < TRIG_DEGREES/2)
{
- if (iDroidDir > psDroid->sMove.dir)
+ if (iDroidDir > psDroid->sMove.moveDir)
{
finalDir = iDroidDir - finalDir;
}
@@ -2496,7 +2498,7 @@
}
else
{
- if (iDroidDir > psDroid->sMove.dir)
+ if (iDroidDir > psDroid->sMove.moveDir)
{
finalDir = iDroidDir + finalDir;
if (finalDir >= TRIG_DEGREES)
@@ -2514,20 +2516,20 @@
}
}
- psDroid->sMove.dir = (SWORD)finalDir;
+ psDroid->sMove.moveDir = finalDir;
psDroid->sMove.speed = finalSpeed;
}
// Calculate the current speed in the droids normal direction
-static FRACT moveCalcNormalSpeed( DROID *psDroid, FRACT fSpeed, SDWORD iDroidDir,
- SDWORD iAccel, SDWORD iDecel )
+static FRACT moveCalcNormalSpeed( DROID *psDroid, FRACT fSpeed, FRACT iDroidDir,
+ SDWORD iAccel, SDWORD iDecel ) // Noid: iDroidDir might need changing to FRACT
{
- SDWORD adiff;
+ FRACT adiff;
FRACT normalSpeed;
- adiff = labs(iDroidDir - psDroid->sMove.dir);
- normalSpeed = Fmul(psDroid->sMove.speed,trigCos(adiff));
+ adiff = fabsf(iDroidDir - psDroid->sMove.moveDir);
+ normalSpeed = Fmul(psDroid->sMove.speed,trigCos(MAKEINT(adiff)));
if (normalSpeed < fSpeed)
{
@@ -2560,8 +2562,8 @@
move = Fmul(psDroid->sMove.speed, baseSpeed);
- *pDX = Fmul(move,trigSin(psDroid->sMove.dir));
- *pDY = Fmul(move,trigCos(psDroid->sMove.dir));
+ *pDX = Fmul(move,trigSin(MAKEINT(psDroid->sMove.moveDir)));
+ *pDY = Fmul(move,trigCos(MAKEINT(psDroid->sMove.moveDir)));
}
// see if the droid is close to the final way point
@@ -2666,8 +2668,8 @@
/* Update a tracked droids position and speed given target values */
static void moveUpdateGroundModel(DROID *psDroid, SDWORD speed, SDWORD direction)
{
- FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed, bx,by;
- SDWORD iDroidDir, slideDir;
+ FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed, bx,by, iDroidDir; // Noid: iDroidDir: SDWORD->FRACT
+ SDWORD slideDir;
PROPULSION_STATS *psPropStats;
SDWORD spinSpeed, turnSpeed, skidDecel;
// constants for the different propulsion types
@@ -2756,7 +2758,7 @@
{
moveUpdateDroidDirection( psDroid, &speed, slideDir, TRACKED_SPIN_ANGLE,
psDroid->baseSpeed, psDroid->baseSpeed/3, &iDroidDir, &fSpeed );
- psDroid->direction = (UWORD)iDroidDir;
+ psDroid->directionF = iDroidDir;
}
moveUpdateDroidPos( psDroid, bx, by );
@@ -2769,8 +2771,8 @@
/* Update a persons position and speed given target values */
void moveUpdatePersonModel(DROID *psDroid, SDWORD speed, SDWORD direction)
{
- FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
- SDWORD iDroidDir, slideDir;
+ FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed, iDroidDir; //Noid: iDroidDir = SDWORD->FRACT
+ SDWORD slideDir;
// BASE_OBJECT *psObst;
BOOL bRet;
@@ -2937,8 +2939,8 @@
static void moveUpdateVtolModel(DROID *psDroid, SDWORD speed, SDWORD direction)
{
- FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
- SDWORD iDroidDir, iMapZ, iRoll, slideDir, iSpinSpeed, iTurnSpeed;
+ FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed,iDroidDir; //Noid: iDroidDir=SDWORD->FRACT
+ SDWORD iMapZ, iRoll, slideDir, iSpinSpeed, iTurnSpeed;
// SDWORD iDZ, iDroidZ;
FRACT fDZ, fDroidZ, fMapZ;
@@ -2988,7 +2990,7 @@
moveUpdateDroidPos( psDroid, dx, dy );
/* update vtol orientation */
- iRoll = (psDroid->sMove.dir - (SDWORD) psDroid->direction) / 3;
+ iRoll = (MAKEINT(psDroid->sMove.moveDir) - MAKEINT(psDroid->directionF)) / 3;
if ( iRoll < 0 )
{
iRoll += 360;
@@ -3098,8 +3100,8 @@
static void moveUpdateJumpCyborgModel(DROID *psDroid, SDWORD speed, SDWORD direction)
{
- FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed;
- SDWORD iDroidDir;
+ FRACT fPerpSpeed, fNormalSpeed, dx, dy, fSpeed, iDroidDir; //Noid: iDroidDir=SDWORD->FRACT
+ //SDWORD ;
// nothing to do if the droid is stopped
if ( moveDroidStopped( psDroid, speed ) == TRUE )
@@ -3557,7 +3559,8 @@
SDWORD fx, fy;
UDWORD oldx, oldy, iZ;
UBYTE oldStatus = psDroid->sMove.Status;
- SDWORD moveSpeed, moveDir;
+ SDWORD moveSpeed;
+ FRACT moveDir; // Noid: moveDir=SDWORD->FRACT
PROPULSION_STATS *psPropStats;
Vector3i pos;
BOOL bStarted = FALSE, bStopped;
@@ -3600,7 +3603,7 @@
fpathSetCurrentObject( (BASE_OBJECT *) psDroid );
moveSpeed = 0;
- moveDir = (SDWORD)psDroid->direction;
+ moveDir = psDroid->directionF;
/* get droid height */
iZ = map_Height(psDroid->x, psDroid->y);
@@ -3710,7 +3713,7 @@
}
moveSpeed = moveCalcDroidSpeed(psDroid);
- moveDir = MAKEINT(tangle);
+ moveDir = tangle;
}
}
@@ -3861,7 +3864,7 @@
moveSpeed = moveCalcDroidSpeed(psDroid);
- moveDir = MAKEINT(tangle);
+ moveDir = tangle;
//if ( psDroid->droidType == DROID_TRANSPORTER )
@@ -3897,10 +3900,10 @@
// Turn the droid to it's final facing
if (psDroid->sMove.psFormation &&
psDroid->sMove.psFormation->refCount > 1 &&
- psDroid->direction != (UDWORD)psDroid->sMove.psFormation->dir)
+ MAKEINT(psDroid->directionF) != (SDWORD)psDroid->sMove.psFormation->dir)
{
moveSpeed = 0;
- moveDir = psDroid->sMove.psFormation->dir;
+ moveDir = MAKEFRACT(psDroid->sMove.psFormation->dir);
}
else
{
@@ -3916,9 +3919,9 @@
break;
case MOVETURNTOTARGET:
moveSpeed = 0;
- moveDir = (SDWORD)calcDirection(psDroid->x,psDroid->y,
- psDroid->sMove.targetX, psDroid->sMove.targetY);
- if (psDroid->direction == (UDWORD)moveDir)
+ moveDir = MAKEFRACT(calcDirection(psDroid->x,psDroid->y,
+ psDroid->sMove.targetX, psDroid->sMove.targetY));
+ if (MAKEINT(psDroid->directionF) == MAKEINT(moveDir))
{
if ( psPropStats->propulsionType == LIFT )
{
@@ -3981,7 +3984,7 @@
case MOVEDRIVE:
driveSetDroidMove(psDroid);
moveSpeed = driveGetMoveSpeed(); //MAKEINT(psDroid->sMove.speed);
- moveDir = driveGetMoveDir(); //psDroid->sMove.dir;
+ moveDir = MAKEFRACT(driveGetMoveDir()); //psDroid->sMove.dir; // Noid: Might need changing to FRACT!
// DBPRINTF(("%d\n",frameGetFrameNumber()-LastMoveFrame);
// LastMoveFrame = frameGetFrameNumber();
// psDroid->sMove.speed = MAKEFRACT(driveSpeed);
@@ -4017,20 +4020,20 @@
if ( psDroid->droidType == DROID_PERSON )
{
- moveUpdatePersonModel(psDroid,moveSpeed,moveDir);
+ moveUpdatePersonModel(psDroid,moveSpeed,MAKEINT(moveDir));
}
//else if ( psDroid->droidType == DROID_CYBORG )
else if (cyborgDroid(psDroid))
{
- moveUpdateCyborgModel(psDroid,moveSpeed,moveDir,oldStatus);
+ moveUpdateCyborgModel(psDroid,moveSpeed,MAKEINT(moveDir),oldStatus);
}
else if ( psPropStats->propulsionType == LIFT )
{
- moveUpdateVtolModel(psDroid,moveSpeed,moveDir);
+ moveUpdateVtolModel(psDroid,moveSpeed,MAKEINT(moveDir));
}
else
{
- moveUpdateGroundModel(psDroid,moveSpeed,moveDir);
+ moveUpdateGroundModel(psDroid,moveSpeed,MAKEINT(moveDir));
}
Index: warzone/src/display3d.c
===================================================================
--- warzone/src/display3d.c (revision 1029)
+++ warzone/src/display3d.c (working copy)
@@ -1320,7 +1320,7 @@
iV_TRANSLATE(rx,0,-rz);
/* Rotate it to the direction it's facing */
- imdRot2.y = DEG(psCurr->direction);
+ imdRot2.y = DEG(MAKEINT(psCurr->directionF));
iV_MatrixRotateY(-imdRot2.y);
/* pitch it */
@@ -1402,7 +1402,7 @@
iV_TRANSLATE(rx,0,-rz);
/* parent object rotations */
- imdRot2.y = DEG(psParentObj->direction);
+ imdRot2.y = DEG(MAKEINT(psParentObj->directionF));
iV_MatrixRotateY(-imdRot2.y);
imdRot2.x = DEG(psParentObj->pitch);
iV_MatrixRotateX(imdRot2.x);
@@ -2009,7 +2009,7 @@
/* Translate */
iV_TRANSLATE(rx,0,-rz);
- rotation = DEG(psFeature->direction);
+ rotation = DEG(MAKEINT(psFeature->directionF));
iV_MatrixRotateY(-rotation);
@@ -2315,7 +2315,7 @@
/* OK - here is where we establish which IMD to draw for the building - luckily static objects,
* buildings in other words are NOT made up of components - much quicker! */
- rotation = DEG(psStructure->direction);
+ rotation = DEG(MAKEINT(psStructure->directionF));
iV_MatrixRotateY(-rotation);
if( !defensive
&& gameTime2-psStructure->timeLastHit < ELEC_DAMAGE_DURATION
@@ -2864,7 +2864,7 @@
/* Translate */
iV_TRANSLATE(rx,0,-rz);
- rotation = DEG(psStructure->direction);
+ rotation = DEG(MAKEINT(psStructure->directionF));
iV_MatrixRotateY(-rotation);
// objectShimmy((BASE_OBJECT*)psStructure);
if(imd!=NULL)
@@ -2881,21 +2881,21 @@
temp = imd->points;
// now check if we need to apply the wall hack
- if(psStructure->direction > 0 && psStructure->pStructureType->type == REF_WALL)
+ if(psStructure->directionF > 0 && psStructure->pStructureType->type == REF_WALL)
{
// switch them
originalDirection = imd;
- imd = &otherDirections[psStructure->direction/90-1];
- if(!directionSet[psStructure->direction/90-1])
+ imd = &otherDirections[MAKEINT(psStructure->directionF)/90-1];
+ if(!directionSet[MAKEINT(psStructure->directionF)/90-1])
{
// not yet initialised, so do that now
*imd = *originalDirection;
imd->shadowEdgeList = NULL;
- directionSet[psStructure->direction/90-1] = TRUE;
+ directionSet[MAKEINT(psStructure->directionF)/90-1] = TRUE;
}
}
- flattenImd(imd,structX,structY,psStructure->direction);
+ flattenImd(imd,structX,structY,MAKEINT(psStructure->directionF));
/* Actually render it */
if ( (psStructure->status == SS_BEING_BUILT ) ||
@@ -2912,7 +2912,7 @@
}
imd->points = temp;
- if(psStructure->direction > 0 && psStructure->pStructureType->type == REF_WALL)
+ if(psStructure->directionF > 0 && psStructure->pStructureType->type == REF_WALL)
{
// switch back
imd = originalDirection;
@@ -2960,7 +2960,7 @@
if(psDroid->droidType == DROID_TRANSPORTER)
{
- iV_MatrixRotateY( DEG(-psDroid->direction));
+ iV_MatrixRotateY( DEG(MAKEINT(-psDroid->directionF)));
}
pVecTemp = psShadowIMD->points;
@@ -2972,7 +2972,7 @@
}
else
{
- pie_MatRotY(DEG(-psDroid->direction));
+ pie_MatRotY(DEG(MAKEINT(-psDroid->directionF)));
pie_MatRotX(DEG(psDroid->pitch));
pie_MatRotZ(DEG(psDroid->roll));
}
Index: warzone/src/projectile.c
===================================================================
--- warzone/src/projectile.c (revision 1029)
+++ warzone/src/projectile.c (working copy)
@@ -436,7 +436,7 @@
{
fR += (FRACT_D) (2 * M_PI);
}
- psObj->direction = (UWORD)( RAD_TO_DEG(fR) );
+ psObj->directionF = MAKEFRACT( RAD_TO_DEG(fR) );
/* get target distance */
@@ -1395,7 +1395,7 @@
{
xDiff = psObj->startX - psObj->psDest->x;
yDiff = psObj->startY - psObj->psDest->y;
- impact_angle = abs(psObj->psDest->direction - (180 * atan2f((float)xDiff, (float)yDiff) / M_PI));
+ impact_angle = abs(psObj->psDest->directionF - (180 * atan2f((float)xDiff, (float)yDiff) / M_PI));
if (impact_angle >= 360)
{
impact_angle -= 360;
@@ -1599,7 +1599,7 @@
{
xDiff = psObj->x - psCurrD->x;
yDiff = psObj->y - psCurrD->y;
- impact_angle = abs(psCurrD->direction - (180 * atan2f((float)xDiff, (float)yDiff) / M_PI));
+ impact_angle = abs(psCurrD->directionF - (180 * atan2f((float)xDiff, (float)yDiff) / M_PI));
if (impact_angle >= 360)
{
impact_angle -= 360;
@@ -1681,7 +1681,7 @@
{
xDiff = psObj->x - psCurrD->x;
yDiff = psObj->y - psCurrD->y;
- impact_angle = abs(psCurrD->direction - (180 * atan2f((float)xDiff, (float)yDiff) / M_PI));
+ impact_angle = abs(psCurrD->directionF - (180 * atan2f((float)xDiff, (float)yDiff) / M_PI));
if (impact_angle >= 360)
{
impact_angle -= 360;
Index: warzone/src/movedef.h
===================================================================
--- warzone/src/movedef.h (revision 1029)
+++ warzone/src/movedef.h (working copy)
@@ -71,7 +71,10 @@
// NOTE: this is supposed to replace Speed
FRACT speed; // Speed of motion
SWORD boundX,boundY; // Vector for the end of path boundary
- SWORD dir; // direction of motion (not the direction the droid is facing)
+
+ //SWORD dir; // direction of motion (not the direction the droid is facing)
+ FRACT moveDir; // direction of motion (not the direction the droid is facing)
+ // Attempt to convert movement dir from int to fract.
SWORD bumpDir; // direction at last bump
UDWORD bumpTime; // time of first bump with something
Index: warzone/src/feature.c
===================================================================
--- warzone/src/feature.c (revision 1029)
+++ warzone/src/feature.c (working copy)
@@ -779,17 +779,17 @@
/* Dump down the building wrecks at random angles - still looks shit though */
if(psStats->subType == FEAT_BUILD_WRECK)
{
- psFeature->direction = (UWORD)(rand()%360);
+ psFeature->directionF = (FRACT)(rand()%360);
psFeature->gfxScaling = (UWORD)(80 + (10 - rand()%20)); // put into define
}
else if(psStats->subType == FEAT_TREE)
{
- psFeature->direction = (UWORD)(rand()%360);
+ psFeature->directionF = (FRACT)(rand()%360);
psFeature->gfxScaling = (UWORD) (100 + (14-rand()%28));
}
else
{
- psFeature->direction = 0;
+ psFeature->directionF = 0;
psFeature->gfxScaling = 100; // but irrelevant anyway, cos it's not scaled
}
//psFeature->damage = featureDamage;
Index: warzone/src/droid.c
===================================================================
--- warzone/src/droid.c (revision 1029)
+++ warzone/src/droid.c (working copy)
@@ -3950,7 +3950,7 @@
psDroid->sMove.Direction3D=0;
psDroid->sMove.psFormation = NULL;*/
- psDroid->direction=0;
+ psDroid->directionF = 0;
psDroid->pitch = 0;
psDroid->roll = 0;
//psDroid->turretRotRate = 360;
@@ -4139,7 +4139,7 @@
psDroid->droidType = droidTemplateType(pTemplate);
- psDroid->direction=0;
+ psDroid->directionF = 0;
psDroid->pitch = 0;
psDroid->roll = 0;
//psDroid->turretRotRate = 360;
@@ -4810,7 +4810,7 @@
pie_TRANSLATE(psDroid->x,-(SDWORD)psDroid->z,psDroid->y);
//matrix = the center of droid
- pie_MatRotY(DEG((SDWORD) psDroid->direction));
+ pie_MatRotY(DEG((SDWORD) MAKEINT(psDroid->directionF)));
pie_MatRotX(DEG(psDroid->pitch));
pie_MatRotZ(DEG(-(SDWORD)psDroid->roll));
// pie_TRANSLATE(100,0,0); // (left,-height,forward)
@@ -4858,7 +4858,7 @@
pie_TRANSLATE(psDroid->x,-(SDWORD)psDroid->z,psDroid->y);
//matrix = the center of droid
- pie_MatRotY(DEG((SDWORD) psDroid->direction));
+ pie_MatRotY(DEG((SDWORD) MAKEINT(psDroid->directionF)));
pie_MatRotX(DEG(psDroid->pitch));
pie_MatRotZ(DEG(-(SDWORD)psDroid->roll));
// pie_TRANSLATE(100,0,0); // (left,-height,forward)
@@ -6402,7 +6402,8 @@
DROID * giftSingleDroid(DROID *psD, UDWORD to)
{
DROID_TEMPLATE sTemplate;
- UWORD x, y, numKills, direction, i;
+ UWORD x, y, numKills, i;
+ FRACT directionF;
DROID *psNewDroid, *psCurr;
STRUCTURE *psStruct;
UDWORD body, armourK[NUM_HIT_SIDES], armourH[NUM_HIT_SIDES];
@@ -6538,7 +6539,7 @@
armourH[impact_side] = psD->armour[impact_side][WC_HEAT];
}
numKills = psD->numKills;
- direction = psD->direction;
+ directionF = psD->directionF;
//only play the sound if unit being taken over is selectedPlayer's but not going to the selectedPlayer
//if ((psD->player == selectedPlayer) &&
// (psD->player != to))
@@ -6563,7 +6564,7 @@
psNewDroid->armour[impact_side][WC_HEAT] = armourH[impact_side];
}
psNewDroid->numKills = numKills;
- psNewDroid->direction = direction;
+ psNewDroid->directionF = directionF;
if(!(psNewDroid->droidType == DROID_PERSON ||
//psNewDroid->droidType == DROID_CYBORG ||
cyborgDroid(psNewDroid) ||
Index: warzone/src/component.c
===================================================================
--- warzone/src/component.c (revision 1029)
+++ warzone/src/component.c (working copy)
@@ -786,7 +786,7 @@
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
worldAngle = (UDWORD) ((UDWORD)player.r.y/DEG_1)%360;
- difference = (worldAngle-psObj->direction);
+ difference = (worldAngle - MAKEINT(psObj->directionF));
if((difference>0 && difference <180) || difference<-180)
{
@@ -822,7 +822,7 @@
}
/* Get all the pitch,roll,yaw info */
- rotation.y = -(SDWORD)psDroid->direction;
+ rotation.y = -MAKEINT(psDroid->directionF);
rotation.x = psDroid->pitch;
rotation.z = psDroid->roll;
@@ -1472,7 +1472,7 @@
psShape = getImdFromIndex(MI_FLAME);
/* Rotate for droid */
- pie_MatRotY(DEG((SDWORD)psDroid->direction));
+ pie_MatRotY(DEG(MAKEINT(psDroid->directionF)));
pie_MatRotX(DEG(-psDroid->pitch));
pie_MatRotZ(DEG(-psDroid->roll));
//Watermelon:rotate Y
Index: warzone/src/drive.c
===================================================================
--- warzone/src/drive.c (revision 1029)
+++ warzone/src/drive.c (working copy)
@@ -243,7 +243,7 @@
if(psDrivenDroid) {
- driveDir = psDrivenDroid->direction % 360;
+ driveDir = MAKEINT(psDrivenDroid->directionF) % 360;
driveSpeed = 0;
driveBumpTime = gameTime;
@@ -636,7 +636,7 @@
if(psDrivenDroid->sMove.Status != MOVEDRIVE) {
psDrivenDroid->sMove.Status = MOVEDRIVE;
ASSERT( (psDrivenDroid->droidType != DROID_TRANSPORTER),"Tried to control a transporter" );
- driveDir = psDrivenDroid->direction % 360;
+ driveDir = MAKEINT(psDrivenDroid->directionF) % 360;
}
DoFollowRangeCheck = TRUE;
@@ -714,7 +714,8 @@
{
// psDroid->sMove.speed = MAKEFRACT(driveSpeed);
// psDroid->sMove.dir = driveDir;
- psDroid->direction = (UWORD)driveDir;
+ printf("driveSetDroidMove from %f to %d",psDroid->directionF, driveDir);
+ psDroid->directionF = MAKEFRACT(driveDir);
}
Index: warzone/src/multisync.c
===================================================================
--- warzone/src/multisync.c (revision 1029)
+++ warzone/src/multisync.c (working copy)
@@ -293,7 +293,7 @@
NetAdd2( pMsg, i+2, pD->id); // droid id
NetAdd2( pMsg, i+6, pD->secondaryOrder );
NetAdd2( pMsg, i+10, pD->body); // damage points
- NetAdd2( pMsg, i+14, pD->direction); // direction
+ NetAdd2( pMsg, i+14, pD->directionF); // direction
if( pD->order == DORDER_ATTACK || pD->order == DORDER_ATTACK_M || pD->order == DORDER_MOVE || pD->order == DORDER_RTB || pD->order == DORDER_RTR)
{
@@ -578,7 +578,7 @@
psDroid->y = (UWORD) fy;
gridMoveObject((BASE_OBJECT *)psDroid, (SDWORD)oldx,(SDWORD)oldy);
- psDroid->direction = (UWORD)(dir %360); // update rotation
+ psDroid->directionF = MAKEFRACT(dir %360); // update rotation
// reroute the droid.
turnOffMultiMsg(TRUE);
@@ -595,7 +595,7 @@
psDroid->x = (UWORD)x; //update x
psDroid->y = (UWORD)y; //update y
gridMoveObject((BASE_OBJECT *)psDroid, (SDWORD)oldx,(SDWORD)oldy);
- psDroid->direction = (UWORD)(dir %360); // update rotation
+ psDroid->directionF = MAKEFRACT(dir %360); // update rotation
}
psDroid->body = dam; // update damage
@@ -713,7 +713,7 @@
NetAdd(m,11,pS->x); //position
NetAdd(m,13,pS->y);
NetAdd(m,15,pS->z);
- NetAdd(m,17,pS->direction);
+ NetAdd(m,17,pS->directionF);
m.type = NET_CHECK_STRUCT;
m.size = 19;
@@ -763,7 +763,7 @@
if(pS)
{
NetGet(m,5,pS->body); // Damage update.
- NetGet(m,17,pS->direction);
+ NetGet(m,17,pS->directionF);
}
else // structure wasn't found, create it.
{
@@ -791,7 +791,7 @@
&& (pS->player == player )
)
{
- pS->direction = dir;
+ pS->directionF = MAKEFRACT(dir);
pS->id = ref;
if(pS->status != SS_BUILT)
{
@@ -853,7 +853,7 @@
if( pS->status != SS_BUILT) // check its finished
{
- pS->direction = dir;
+ pS->directionF = MAKEFRACT(dir);
pS->id = ref;
pS->status = SS_BUILT;
buildingComplete(pS);
Index: warzone/src/effects.c
===================================================================
--- warzone/src/effects.c (revision 1029)
+++ warzone/src/effects.c (working copy)
@@ -2700,8 +2700,8 @@
if( (SDWORD)psDroid->sMove.speed != 0 )
{
/* Present direction is important */
- xBehind = ((50*iV_SIN(DEG(psDroid->direction))) >> FP12_SHIFT);
- yBehind = ((50*iV_COS(DEG(psDroid->direction))) >> FP12_SHIFT);
+ xBehind = ((50*iV_SIN(DEG(MAKEINT(psDroid->directionF)))) >> FP12_SHIFT);
+ yBehind = ((50*iV_COS(DEG(MAKEINT(psDroid->directionF)))) >> FP12_SHIFT);
pos.x = psDroid->x - xBehind;
pos.z = psDroid->y - yBehind;
pos.y = map_Height(pos.x,pos.z);
Index: warzone/src/game.c
===================================================================
--- warzone/src/game.c (revision 1029)
+++ warzone/src/game.c (working copy)
@@ -225,7 +225,7 @@
char name[MAX_SAVE_NAME_SIZE_V19]; \
UDWORD id; \
UDWORD x,y,z; \
- UDWORD direction; \
+ FRACT directionF; \
UDWORD player; \
BOOL inFire; \
UDWORD burnStart; \
@@ -235,7 +235,7 @@
char name[MAX_SAVE_NAME_SIZE]; \
UDWORD id; \
UDWORD x,y,z; \
- UDWORD direction; \
+ FRACT directionF; \
UDWORD player; \
BOOL inFire; \
UDWORD burnStart; \
@@ -4472,7 +4472,7 @@
endian_udword(&pDroidInit->x);
endian_udword(&pDroidInit->y);
endian_udword(&pDroidInit->z);
- endian_udword(&pDroidInit->direction);
+ endian_udword(&pDroidInit->directionF);
endian_udword(&pDroidInit->player);
endian_udword(&pDroidInit->burnStart);
endian_udword(&pDroidInit->burnDamage);
@@ -4511,7 +4511,7 @@
if (psDroid) {
psDroid->id = pDroidInit->id;
- psDroid->direction = (UWORD)pDroidInit->direction;
+ psDroid->directionF = pDroidInit->directionF;
addDroid(psDroid, apsDroidLists);
}
else
@@ -4732,7 +4732,7 @@
//are these going to ever change from the values set up with?
// psDroid->z = psSaveDroid->z; // use the correct map height value
- psDroid->direction = (UWORD)psSaveDroid->direction;
+ psDroid->directionF = psSaveDroid->directionF;
psDroid->body = psSaveDroid->body;
if (psDroid->body > psDroid->originalBody)
{
@@ -4869,7 +4869,7 @@
//are these going to ever change from the values set up with?
// psDroid->z = psSaveDroid->z; // use the correct map height value
- psDroid->direction = (UWORD)psSaveDroid->direction;
+ psDroid->directionF = psSaveDroid->directionF;
psDroid->body = psSaveDroid->body;
if (psDroid->body > psDroid->originalBody)
{
@@ -5127,7 +5127,7 @@
//are these going to ever change from the values set up with?
// psDroid->z = psSaveDroid->z; // use the correct map height value
- psDroid->direction = (UWORD)psSaveDroid->direction;
+ psDroid->directionF = psSaveDroid->directionF;
psDroid->body = psSaveDroid->body;
if (psDroid->body > psDroid->originalBody)
{
@@ -6087,7 +6087,7 @@
//version 24
psSaveDroid->resistance = psCurr->resistance;
memcpy(&psSaveDroid->sMove, &psCurr->sMove, sizeof(SAVE_MOVE_CONTROL));
- if (psSaveDroid->sMove.psFormation != NULL)
+ if (psCurr->sMove.psFormation != NULL)
{
psSaveDroid->formationDir = psCurr->sMove.psFormation->dir;
psSaveDroid->formationX = psCurr->sMove.psFormation->x;
@@ -6152,7 +6152,7 @@
psSaveDroid->y = psCurr->y;
ASSERT(worldOnMap(psSaveDroid->x,psSaveDroid->y), "the saved droid if off the map");
psSaveDroid->z = psCurr->z;
- psSaveDroid->direction = psCurr->direction;
+ psSaveDroid->directionF = psCurr->directionF;
psSaveDroid->player = psCurr->player;
psSaveDroid->inFire = psCurr->inFire;
psSaveDroid->burnStart = psCurr->burnStart;
@@ -6573,7 +6573,7 @@
psStructure->id = psSaveStructure->id;
//are these going to ever change from the values set up with?
// psStructure->z = (UWORD)psSaveStructure->z;
- psStructure->direction = (UWORD)psSaveStructure->direction;
+ psStructure->directionF = psSaveStructure->directionF;
}
@@ -6860,7 +6860,7 @@
psStructure->id = psSaveStructure->id;
//are these going to ever change from the values set up with?
// psStructure->z = (UWORD)psSaveStructure->z;
- psStructure->direction = (UWORD)psSaveStructure->direction;
+ psStructure->directionF = psSaveStructure->directionF;
}
psStructure->inFire = psSaveStructure->inFire;
@@ -7308,7 +7308,7 @@
psStructure->id = psSaveStructure->id;
//are these going to ever change from the values set up with?
// psStructure->z = (UWORD)psSaveStructure->z;
- psStructure->direction = (UWORD)psSaveStructure->direction;
+ psStructure->directionF = psSaveStructure->directionF;
}
psStructure->inFire = psSaveStructure->inFire;
@@ -7649,7 +7649,7 @@
psSaveStruct->y = psCurr->y;
psSaveStruct->z = psCurr->z;
- psSaveStruct->direction = psCurr->direction;
+ psSaveStruct->directionF = psCurr->directionF;
psSaveStruct->player = psCurr->player;
psSaveStruct->inFire = psCurr->inFire;
psSaveStruct->burnStart = psCurr->burnStart;
@@ -8119,7 +8119,7 @@
//DBPRINTF(("Loaded feature - id = %d @ %p\n",psSaveFeature->id,pFeature);
//restore values
pFeature->id = psSaveFeature->id;
- pFeature->direction = (UWORD)psSaveFeature->direction;
+ pFeature->directionF = psSaveFeature->directionF;
pFeature->inFire = psSaveFeature->inFire;
pFeature->burnDamage = psSaveFeature->burnDamage;
if (version >= VERSION_14)
@@ -8229,7 +8229,7 @@
//DBPRINTF(("Loaded feature - id = %d @ %p\n",psSaveFeature->id,pFeature);
//restore values
pFeature->id = psSaveFeature->id;
- pFeature->direction = (UWORD)psSaveFeature->direction;
+ pFeature->directionF = psSaveFeature->directionF;
pFeature->inFire = psSaveFeature->inFire;
pFeature->burnDamage = psSaveFeature->burnDamage;
for (i=0; i < MAX_PLAYERS; i++)
@@ -8301,7 +8301,7 @@
psSaveFeature->y = psCurr->y;
psSaveFeature->z = psCurr->z;
- psSaveFeature->direction = psCurr->direction;
+ psSaveFeature->directionF = psCurr->directionF;
psSaveFeature->inFire = psCurr->inFire;
psSaveFeature->burnDamage = psCurr->burnDamage;
for (i=0; i < MAX_PLAYERS; i++)
Index: warzone/src/mission.c
===================================================================
--- warzone/src/mission.c (revision 1029)
+++ warzone/src/mission.c (working copy)
@@ -849,7 +849,7 @@
{
fR += (FRACT_D) (2 * M_PI);
}
- psTransporter->direction = (UWORD)( RAD_TO_DEG(fR) );
+ psTransporter->directionF = MAKEFRACT( RAD_TO_DEG(fR) );
// Camera track requested and it's the selected player.
pgpDaIDCtxVfl.pgp
Description: PGP signature
_______________________________________________ Warzone-dev mailing list [email protected] https://mail.gna.org/listinfo/warzone-dev
