From 5f87829d265c6fe4b012c5f60a2ed8c08d298188 Mon Sep 17 00:00:00 2001 From: Dennis Schridde Date: Sun, 15 Apr 2007 20:45:09 +0000 Subject: [PATCH] Clean indention and make the code a little bit more readable. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1469 4a71c877-e1ca-e34f-864e-861f7616d084 --- lib/framework/macros.h | 2 +- src/display3d.c | 946 +++++++++++++++++++++-------------------- src/environ.c | 16 +- 3 files changed, 483 insertions(+), 481 deletions(-) diff --git a/lib/framework/macros.h b/lib/framework/macros.h index 4d7e9bd11..52f085f83 100644 --- a/lib/framework/macros.h +++ b/lib/framework/macros.h @@ -24,6 +24,6 @@ #define MACROS_H #define MIN(a, b) (((a) < (b)) ? (a) : (b)) -#define MAX(a, b) (((a) < (b)) ? (b) : (a)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) #endif // MACROS_H diff --git a/src/display3d.c b/src/display3d.c index 2a29034df..67295f61c 100644 --- a/src/display3d.c +++ b/src/display3d.c @@ -21,9 +21,9 @@ Display3D.c - draws the 3D terrain view. Both the 3D and pseudo-3D components:- textured tiles. - ------------------------------------------------------------------- - - Alex McLean & Jeremy Sallis, Pumpkin Studios, EIDOS INTERACTIVE - - ------------------------------------------------------------------- + ------------------------------------------------------------------- + - Alex McLean & Jeremy Sallis, Pumpkin Studios, EIDOS INTERACTIVE - + ------------------------------------------------------------------- */ /* Generic includes */ #include @@ -180,7 +180,7 @@ BOOL godMode; static UWORD WaterTileID = WATER_TILE; static UWORD RiverBedTileID = BED_TILE; -static FRACT waterRealValue = (FRACT)0; +static FRACT waterRealValue = 0.0f; #define WAVE_SPEED 4 static SWORD vOffset = 1; #define MAX_FIRE_STAGE 32 @@ -360,14 +360,14 @@ void draw3DScene( void ) BOOL bPlayerHasHQ = FALSE; - /* Set the droids on-screen display coordinates for selection later */ + /* Set the droids on-screen display coordinates for selection later */ mX = mouseX(); mY = mouseY(); // the world centre - used for decaying lighting etc - gridCentreX = ( player.p.x + ((visibleXTiles/2)<DEG(360)) + while(player.r.y>DEG(360)) { player.r.y-=DEG(360); } @@ -523,7 +523,7 @@ BOOL bPlayerHasHQ = FALSE; { /* player.p.y = averageCentreTerrainHeight; */ /* Move the autonomous camera if necessary */ - trackHeight(2*averageCentreTerrainHeight); + trackHeight(2*averageCentreTerrainHeight); } else { @@ -534,15 +534,15 @@ BOOL bPlayerHasHQ = FALSE; { flushConsoleMessages(); setConsolePermanence(TRUE,TRUE); - permitNewConsoleMessages(TRUE); + permitNewConsoleMessages(TRUE); addConsoleMessage("Warzone 2100 : Pumpkin Studios ",RIGHT_JUSTIFY); - permitNewConsoleMessages(FALSE); + permitNewConsoleMessages(FALSE); } - // sprintf(buildInfo,"WallDrag from %d,%d to %d,%d", wallDrag.x1,wallDrag.y1,wallDrag.x2,wallDrag.y2); - // iV_DrawText(buildInfo,100,180); +// sprintf(buildInfo,"WallDrag from %d,%d to %d,%d", wallDrag.x1,wallDrag.y1,wallDrag.x2,wallDrag.y2); +// iV_DrawText(buildInfo,100,180); /* - sprintf(buildInfo,"Gridvar calls : %d", gridVarCalls); + sprintf(buildInfo,"Gridvar calls : %d", gridVarCalls); iV_DrawText(buildInfo,100,180); sprintf(buildInfo,"Instructions saved : %d", gridVarCalls*24); @@ -551,7 +551,7 @@ BOOL bPlayerHasHQ = FALSE; */ #ifdef ALEXM - sprintf(buildInfo,"Skipped effects : %d", getNumSkippedEffects()); + sprintf(buildInfo,"Skipped effects : %d", getNumSkippedEffects()); iV_DrawText(buildInfo,100,200); sprintf(buildInfo,"Miss Count : %d", getMissCount()); iV_DrawText(buildInfo,100,220); @@ -559,10 +559,10 @@ BOOL bPlayerHasHQ = FALSE; iV_DrawText(buildInfo,100,240); #endif - // sprintf(buildInfo,"Average Grid Height : %d", averageCentreTerrainHeight); - // iV_DrawText(buildInfo,100,240); - // sprintf(buildInfo,"Height : %d", player.p.y); - // iV_DrawText(buildInfo,100,260); +// sprintf(buildInfo,"Average Grid Height : %d", averageCentreTerrainHeight); +// iV_DrawText(buildInfo,100,240); +// sprintf(buildInfo,"Height : %d", player.p.y); +// iV_DrawText(buildInfo,100,260); @@ -664,57 +664,55 @@ void setProximityDraw(BOOL val) static void drawTiles(iView *camera, iView *player) { - SDWORD i,j; - SDWORD zMax; + UDWORD i, j; + SDWORD zMax; Vector3i BSPCamera; - MAPTILE *psTile; - UDWORD specular; - UDWORD edgeX,edgeY; + MAPTILE *psTile; + UDWORD specular; + UDWORD edgeX, edgeY; BOOL IsWaterTile = FALSE; BOOL PushedDown = FALSE; UBYTE TileIllum; UWORD TextNum; - UDWORD shiftVal = 0; - UDWORD altVal = 0; - FRACT fraction; - UDWORD realX,realY; - BOOL bEdgeTile; + UDWORD shiftVal = 0; + UDWORD altVal = 0; + UDWORD realX, realY; + BOOL bEdgeTile; SDWORD tmp_y; static float angle = 0.0; // Animate the water texture, just cycles the V coordinate through half the tiles height. if(!gamePaused()) { - fraction = MAKEFRACT(frameTime2)/GAME_TICKS_PER_SEC; - waterRealValue += (fraction*WAVE_SPEED); - vOffset = (SWORD)MAKEINT(waterRealValue); - if(vOffset >= 64/2) - { - vOffset = 0; - waterRealValue = (FRACT)0; - } + waterRealValue += WAVE_SPEED * frameTime2 / GAME_TICKS_PER_SEC; + vOffset = waterRealValue; + if(vOffset >= 64/2) + { + vOffset = 0; + waterRealValue = 0; + } } /* Is the scene spinning? - showcase demo stuff */ if (spinScene) - player->r.y+=DEG(3); + player->r.y += DEG(3); /* ---------------------------------------------------------------- */ /* Do boundary and extent checking */ /* ---------------------------------------------------------------- */ /* Get the mid point of the grid */ - terrainMidX = (visibleXTiles>>1); - terrainMidY = (visibleYTiles>>1); + terrainMidX = visibleXTiles/2; + terrainMidY = visibleYTiles/2; CalcBSPCameraPos(&BSPCamera); - SetBSPCameraPos(BSPCamera.x,BSPCamera.y,BSPCamera.z); + SetBSPCameraPos(BSPCamera.x, BSPCamera.y, BSPCamera.z); /* Find our position in tile coordinates */ - playerXTile = player->p.x >> TILE_SHIFT; - playerZTile = player->p.z >> TILE_SHIFT; + playerXTile = player->p.x / TILE_UNITS; + playerZTile = player->p.z / TILE_UNITS; - /* Get the x,z translation components */ - rx = (player->p.x) & (TILE_UNITS-1); - rz = (player->p.z) & (TILE_UNITS-1); + /* Get the x,z translation components */ + rx = (player->p.x) & (TILE_UNITS-1); + rz = (player->p.z) & (TILE_UNITS-1); /* ---------------------------------------------------------------- */ @@ -727,13 +725,13 @@ static void drawTiles(iView *camera, iView *player) // Now, scale the world according to what resolution we're running in pie_MatScale(pie_GetResScalingFactor()); /* Set the camera position */ - pie_MATTRANS(camera->p.x,camera->p.y,camera->p.z); + pie_MATTRANS(camera->p.x, camera->p.y, camera->p.z); /* Rotate for the player */ pie_MatRotZ(player->r.z); pie_MatRotX(player->r.x); pie_MatRotY(player->r.y); - /* Translate */ - pie_TRANSLATE(-rx,-player->p.y,rz); + /* Translate */ + pie_TRANSLATE(-rx, -player->p.y, rz); angle += 0.01f; // RODZ uncomment the following line to see an OpenGL lighting demo if (getDrawShadows()) { @@ -749,46 +747,47 @@ static void drawTiles(iView *camera, iView *player) */ averageCentreTerrainHeight = 0; numTilesAveraged = 0; - for (i=0; i<(SDWORD)visibleYTiles+1; i++) + for (i=0; i < (SDWORD)visibleYTiles+1; i++) { /* Go through the x's */ - for (j=0; j<(SDWORD)visibleXTiles+1; j++) + for (j=0; j < (SDWORD)visibleXTiles+1; j++) { tileScreenInfo[i][j].bWater = FALSE; - if( (playerXTile+j < 0) || - (playerZTile+i < 0) || - (playerXTile+j > (SDWORD)(mapWidth-1)) || - (playerZTile+i > (SDWORD)(mapHeight-1)) ) + if( playerXTile+j < 0 || + playerZTile+i < 0 || + playerXTile+j > (SDWORD)(mapWidth-1) || + playerZTile+i > (SDWORD)(mapHeight-1) ) { edgeX = playerXTile+j; edgeY = playerZTile+i; - if(playerXTile+j < 0 ) edgeX = 0; - else - if(playerXTile+j > (SDWORD)(mapWidth-1) ) edgeX = mapWidth-1; - if(playerZTile+i < 0 ) edgeY = 0; - else - if(playerZTile+i > (SDWORD)(mapHeight-1) ) edgeY = mapHeight-1; + if(playerXTile+j < 0 ) + edgeX = 0; + else if(playerXTile+j > (SDWORD)(mapWidth-1) ) + edgeX = mapWidth-1; + if(playerZTile+i < 0 ) + edgeY = 0; + else if(playerZTile+i > (SDWORD)(mapHeight-1) ) + edgeY = mapHeight-1; - tileScreenInfo[i][j].x = ((j-terrainMidX)<illumination,rx-tileScreenInfo[i][j].x,rz - ((i-terrainMidY)<illumination, rx - tileScreenInfo[i][j].x, rz - (i - terrainMidY) * TILE_UNITS, &specular ); + } - - if( (playerXTile+j <-1 ) || - (playerZTile+i <-1) || - (playerXTile+j > (SDWORD)(mapWidth-1)) || - (playerZTile+i > (SDWORD)(mapHeight-1)) ) + if( playerXTile+j < -1 || + playerZTile+i < -1 || + playerXTile+j > (SDWORD)(mapWidth-1) || + playerZTile+i > (SDWORD)(mapHeight-1) ) { tileScreenInfo[i][j].drawInfo = FALSE; } @@ -796,25 +795,27 @@ static void drawTiles(iView *camera, iView *player) { tileScreenInfo[i][j].drawInfo = TRUE; } - - } else { tileScreenInfo[i][j].drawInfo = TRUE; - psTile = mapTile(playerXTile+j,playerZTile+i); + psTile = mapTile(playerXTile+j, playerZTile+i); /* Get a pointer to the tile at this location */ - tileScreenInfo[i][j].x = ((j-terrainMidX)< MIN_TILE_Y && i < MAX_TILE_Y && j > MIN_TILE_X && j < MAX_TILE_X) + if ( i > MIN_TILE_Y && + i < MAX_TILE_Y && + j > MIN_TILE_X && + j < MAX_TILE_X ) { averageCentreTerrainHeight += tileScreenInfo[i][j].y; numTilesAveraged++; @@ -822,7 +823,10 @@ static void drawTiles(iView *camera, iView *player) realX = playerXTile+j; realY = playerZTile+i; bEdgeTile = FALSE; - if(realX<=1 || realY<=1 || realX >= mapWidth-2 || realY >= mapHeight-2) + if ( realX <= 1 || + realY <= 1 || + realX >= mapWidth-2 || + realY >= mapHeight-2 ) { bEdgeTile = TRUE; } @@ -840,7 +844,7 @@ static void drawTiles(iView *camera, iView *player) } else { - TileIllum = psTile->illumination; + TileIllum = psTile->illumination; } @@ -849,67 +853,66 @@ static void drawTiles(iView *camera, iView *player) TileIllum = psTile->inRange; } - TextNum = (UWORD)(psTile->texture & TILE_NUMMASK); - IsWaterTile = (TERRAIN_TYPE(psTile) == TER_WATER); - // If it's the main water tile then.. - PushedDown = FALSE; - if( TextNum == WaterTileID && !bEdgeTile) - { - // Push the terrain down for the river bed. - PushedDown = TRUE; - shiftVal = WATER_DEPTH + ((3*environGetData(playerXTile+j,playerZTile+i))/2); - altVal = 0;//environGetValue(playerXTile+j,playerZTile+i); - tileScreenInfo[i][j].y -= (shiftVal+altVal); - // And darken it. - TileIllum = (UBYTE)((TileIllum*3)/4); - } + TextNum = (UWORD)(psTile->texture & TILE_NUMMASK); + IsWaterTile = (TERRAIN_TYPE(psTile) == TER_WATER); + // If it's the main water tile then.. + PushedDown = FALSE; + if( TextNum == WaterTileID && !bEdgeTile ) + { + // Push the terrain down for the river bed. + PushedDown = TRUE; + shiftVal = WATER_DEPTH + environGetData(playerXTile+j, playerZTile+i) * 1.5f; + altVal = 0;//environGetValue(playerXTile+j,playerZTile+i); + tileScreenInfo[i][j].y -= shiftVal + altVal; + // And darken it. + TileIllum = (UBYTE)(TileIllum * 0.75f); + } tileScreenInfo[i][j].sz = pie_RotProj((Vector3i*)&tileScreenInfo[i][j], (Vector2i*)&tileScreenInfo[i][j].sx); - tileScreenInfo[i][j].light.argb = lightDoFogAndIllumination(TileIllum,rx-tileScreenInfo[i][j].x,rz - ((i-terrainMidY)<mapHeight || (UDWORD)j>mapWidth) + if( (UDWORD)i > mapHeight || (UDWORD)j > mapWidth ) { - ASSERT( FALSE,"Weirdy tile coords" ); + ASSERT( FALSE, "Weirdy tile coords" ); } - if(zMax<0) + if(zMax < 0) { // clipped continue; } - drawTerrainTile(i,j, FALSE); + drawTerrainTile(i, j, FALSE); if(tileScreenInfo[i][j].bWater) { // add the (possibly) transparent water to the bucket sort bucketAddTypeToList(RENDER_WATERTILE, &tileIJ[i][j]); // check if we need to draw a water edge - if((mapTile(playerXTile + j, playerZTile + i)->texture & TILE_NUMMASK) != WaterTileID) { + if((mapTile(playerXTile+j, playerZTile+i)->texture & TILE_NUMMASK) != WaterTileID) { // the edge is in front of the water (which is drawn at z-index -1) pie_SetDepthOffset(-2.0); - drawTerrainTile(i,j, TRUE); + drawTerrainTile(i, j, TRUE); pie_SetDepthOffset(0.0); } } @@ -967,15 +970,15 @@ static void drawTiles(iView *camera, iView *player) /* ---------------------------------------------------------------- */ /* Now display all the static objects */ /* ---------------------------------------------------------------- */ - displayStaticObjects();//bucket render implemented - displayFeatures();//bucket render implemented - displayDynamicObjects();//bucket render implemented + displayStaticObjects(); // bucket render implemented + displayFeatures(); // bucket render implemented + displayDynamicObjects(); //bucket render implemented if(doWeDrawProximitys()) { - displayProximityMsgs(); //bucket render implemented + displayProximityMsgs(); // bucket render implemented } - displayDelivPoints(); //bucket render implemented - display3DProjectiles();//bucket render implemented + displayDelivPoints(); // bucket render implemented + display3DProjectiles(); // bucket render implemented atmosDrawParticles(); @@ -991,8 +994,7 @@ static void drawTiles(iView *camera, iView *player) if(driveModeActive()) { // If were in driving mode then mark the current target. - BASE_OBJECT *psObj = targetGetCurrent(); - if(psObj != NULL) { + if(targetGetCurrent() != NULL) { targetMarkCurrent(); } } @@ -1007,12 +1009,12 @@ static void drawTiles(iView *camera, iView *player) } -BOOL init3DView(void) +BOOL init3DView(void) { // the world centre - used for decaying lighting etc gridCentreX = ( player.p.x + ((visibleXTiles/2)<> TILE_ROTSHIFT) { case 1: - psPTemp = psP1; + psPTemp = psP1; psP1 = psP4; psP4 = psP3; psP3 = psP2; @@ -1225,7 +1227,7 @@ static void display3DProjectiles( void ) // if source or destination is visible // if( ((psObj->psSource != NULL) && psObj->psSource->visible[selectedPlayer]) // || ((psObj->psDest != NULL) && psObj->psDest->visible[selectedPlayer] ) ) - if(gfxVisible(psObj)) + if(gfxVisible(psObj)) // if(GFX_VISIBLE(psObj)) { @@ -1244,7 +1246,7 @@ static void display3DProjectiles( void ) psObj->psWStats->weaponSubClass == WSC_SLOWMISSILE || psObj->psWStats->weaponSubClass == WSC_SLOWROCKET || psObj->psWStats->weaponSubClass == WSC_ENERGY || - psObj->psWStats->weaponSubClass == WSC_EMP) + psObj->psWStats->weaponSubClass == WSC_EMP) { bucketAddTypeToList(RENDER_PROJECTILE_TRANSPARENT, psObj); } @@ -1281,10 +1283,10 @@ void renderProjectile(PROJ_OBJECT *psCurr) psStats = psCurr->psWStats; /* Reject flame or command since they have interim drawn fx */ if(psStats->weaponSubClass == WSC_FLAME || - psStats->weaponSubClass == WSC_COMMAND || // || psStats->weaponSubClass == WSC_ENERGY) + psStats->weaponSubClass == WSC_COMMAND || // || psStats->weaponSubClass == WSC_ENERGY) psStats->weaponSubClass == WSC_ELECTRONIC || - psStats->weaponSubClass == WSC_EMP || - (bMultiPlayer && psStats->weaponSubClass == WSC_LAS_SAT)) + psStats->weaponSubClass == WSC_EMP || + (bMultiPlayer && psStats->weaponSubClass == WSC_LAS_SAT)) // || psStats->weaponSubClass == WSC_ROCKET) { /* We don't do projectiles from these guys, cos there's an effect instead */ @@ -1297,13 +1299,13 @@ void renderProjectile(PROJ_OBJECT *psCurr) missing target, in flight etc - JUST DO IN FLIGHT FOR NOW! */ pIMD = psStats->pInFlightGraphic; - if (clipXY(psCurr->x,psCurr->y)) + if (clipXY(psCurr->x,psCurr->y)) { /* Get bullet's x coord */ - dv.x = (psCurr->x - player.p.x) - terrainMidX*TILE_UNITS; + dv.x = (psCurr->x - player.p.x) - terrainMidX*TILE_UNITS; /* Get it's y coord (z coord in the 3d world */ - dv.z = terrainMidY*TILE_UNITS - (psCurr->y - player.p.z); + dv.z = terrainMidY*TILE_UNITS - (psCurr->y - player.p.z); /* What's the present height of the bullet? */ dv.y = psCurr->z; @@ -1311,9 +1313,9 @@ void renderProjectile(PROJ_OBJECT *psCurr) iV_MatrixBegin(); /* Translate to the correct position */ - iV_TRANSLATE(dv.x,dv.y,dv.z); + iV_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ - rx = player.p.x & (TILE_UNITS-1); + rx = player.p.x & (TILE_UNITS-1); rz = player.p.z & (TILE_UNITS-1); /* Translate */ @@ -1323,19 +1325,19 @@ void renderProjectile(PROJ_OBJECT *psCurr) imdRot2.y = DEG(psCurr->direction); iV_MatrixRotateY(-imdRot2.y); - /* pitch it */ - imdRot2.x = DEG(psCurr->pitch); - iV_MatrixRotateX(imdRot2.x); + /* pitch it */ + imdRot2.x = DEG(psCurr->pitch); + iV_MatrixRotateX(imdRot2.x); /* Spin the bullet around - remove later */ // centreX = ( player.p.x + ((visibleXTiles/2)<x,getCentreZ()-psCurr->y, &specular); - if(psStats->weaponSubClass == WSC_ROCKET || psStats->weaponSubClass == WSC_MISSILE || - psStats->weaponSubClass == WSC_SLOWROCKET || psStats->weaponSubClass == WSC_SLOWMISSILE) + if(psStats->weaponSubClass == WSC_ROCKET || psStats->weaponSubClass == WSC_MISSILE || + psStats->weaponSubClass == WSC_SLOWROCKET || psStats->weaponSubClass == WSC_SLOWMISSILE) { - pie_Draw3DShape(pIMD, 0, 0, brightness, 0, pie_ADDITIVE, 164); + pie_Draw3DShape(pIMD, 0, 0, brightness, 0, pie_ADDITIVE, 164); // pie_Draw3DShape(pIMD, 0, 0, brightness, specular, pie_NO_BILINEAR, 0); } @@ -1346,7 +1348,7 @@ void renderProjectile(PROJ_OBJECT *psCurr) iV_MatrixEnd(); } - /* Flush matrices */ + /* Flush matrices */ } void @@ -1404,8 +1406,8 @@ renderAnimComponent( COMPONENT_OBJECT *psObj ) /* parent object rotations */ imdRot2.y = DEG(psParentObj->direction); iV_MatrixRotateY(-imdRot2.y); - imdRot2.x = DEG(psParentObj->pitch); - iV_MatrixRotateX(imdRot2.x); + imdRot2.x = DEG(psParentObj->pitch); + iV_MatrixRotateX(imdRot2.x); /* object (animation) translations - ivis z and y flipped */ iV_TRANSLATE( psObj->position.x, psObj->position.z, psObj->position.y ); @@ -1532,7 +1534,7 @@ BOOL bEdgeTile; topR = mapTile(realX+1,realY)->illumination; */ } - /* get the appropriate tile texture */ + /* get the appropriate tile texture */ if(TILE_HIGHLIGHT(psTile)) { CLEAR_TILE_HIGHLIGHT(psTile); @@ -1547,40 +1549,40 @@ BOOL bEdgeTile; pie_SetTexturePage(tileTexInfo[tileNumber & TILE_NUMMASK].texPage); /* Check for flipped and rotated tiles */ - flipsAndRots(tileNumber & ~TILE_NUMMASK); + flipsAndRots(tileNumber & ~TILE_NUMMASK); if(TRI_FLIPPED(psTile)) { - /* Get the screen coordinates to render into for the texturer */ - p[0].x = tileScreenInfo[i+0][j+0].sx; p[0].y = tileScreenInfo[i+0][j+0].sy; p[0].z = tileScreenInfo[i+0][j+0].sz; - p[1].x = tileScreenInfo[i+0][j+1].sx; p[1].y = tileScreenInfo[i+0][j+1].sy; p[1].z = tileScreenInfo[i+0][j+1].sz; - p[2].x = tileScreenInfo[i+1][j+0].sx; p[2].y = tileScreenInfo[i+1][j+0].sy; p[2].z = tileScreenInfo[i+1][j+0].sz; + /* Get the screen coordinates to render into for the texturer */ + p[0].x = tileScreenInfo[i+0][j+0].sx; p[0].y = tileScreenInfo[i+0][j+0].sy; p[0].z = tileScreenInfo[i+0][j+0].sz; + p[1].x = tileScreenInfo[i+0][j+1].sx; p[1].y = tileScreenInfo[i+0][j+1].sy; p[1].z = tileScreenInfo[i+0][j+1].sz; + p[2].x = tileScreenInfo[i+1][j+0].sx; p[2].y = tileScreenInfo[i+1][j+0].sy; p[2].z = tileScreenInfo[i+1][j+0].sz; /* Get the U,V values for the indexing into the texture */ p[0].u = psP1->x; p[0].v=psP1->y; - p[1].u = psP2->x; p[1].v=psP2->y; - p[2].u = psP4->x; p[2].v=psP4->y; + p[1].u = psP2->x; p[1].v=psP2->y; + p[2].u = psP4->x; p[2].v=psP4->y; /* Get the intensity values for shading */ - p[0].g = (UBYTE)topL; - p[1].g = (UBYTE)topR; + p[0].g = (UBYTE)topL; + p[1].g = (UBYTE)topR; p[2].g = (UBYTE)botL; } else { /* Get the screen coordinates to render into for the texturer */ - p[0].x = tileScreenInfo[i+0][j+0].sx; p[0].y = tileScreenInfo[i+0][j+0].sy; p[0].z = tileScreenInfo[i+0][j+0].sz; - p[1].x = tileScreenInfo[i+0][j+1].sx; p[1].y = tileScreenInfo[i+0][j+1].sy; p[1].z = tileScreenInfo[i+0][j+1].sz; - p[2].x = tileScreenInfo[i+1][j+1].sx; p[2].y = tileScreenInfo[i+1][j+1].sy; p[2].z = tileScreenInfo[i+1][j+1].sz; + p[0].x = tileScreenInfo[i+0][j+0].sx; p[0].y = tileScreenInfo[i+0][j+0].sy; p[0].z = tileScreenInfo[i+0][j+0].sz; + p[1].x = tileScreenInfo[i+0][j+1].sx; p[1].y = tileScreenInfo[i+0][j+1].sy; p[1].z = tileScreenInfo[i+0][j+1].sz; + p[2].x = tileScreenInfo[i+1][j+1].sx; p[2].y = tileScreenInfo[i+1][j+1].sy; p[2].z = tileScreenInfo[i+1][j+1].sz; /* Get the U,V values for the indexing into the texture */ p[0].u = psP1->x; p[0].v=psP1->y; - p[1].u = psP2->x; p[1].v=psP2->y; - p[2].u = psP3->x; p[2].v=psP3->y; + p[1].u = psP2->x; p[1].v=psP2->y; + p[2].u = psP3->x; p[2].v=psP3->y; /* Get the intensity values for shading */ - p[0].g = (UBYTE)topL; - p[1].g = (UBYTE)topR; + p[0].g = (UBYTE)topL; + p[1].g = (UBYTE)topR; p[2].g = (UBYTE)botR; } @@ -1590,36 +1592,36 @@ BOOL bEdgeTile; if(TRI_FLIPPED(psTile)) { /* Set up the texel coordinates */ - p[0].x = tileScreenInfo[i+0][j+1].sx; p[0].y = tileScreenInfo[i+0][j+1].sy; p[0].z = tileScreenInfo[i+0][j+1].sz; - p[1].x = tileScreenInfo[i+1][j+1].sx; p[1].y = tileScreenInfo[i+1][j+1].sy; p[1].z = tileScreenInfo[i+1][j+1].sz; - p[2].x = tileScreenInfo[i+1][j+0].sx; p[2].y = tileScreenInfo[i+1][j+0].sy; p[2].z = tileScreenInfo[i+1][j+0].sz; + p[0].x = tileScreenInfo[i+0][j+1].sx; p[0].y = tileScreenInfo[i+0][j+1].sy; p[0].z = tileScreenInfo[i+0][j+1].sz; + p[1].x = tileScreenInfo[i+1][j+1].sx; p[1].y = tileScreenInfo[i+1][j+1].sy; p[1].z = tileScreenInfo[i+1][j+1].sz; + p[2].x = tileScreenInfo[i+1][j+0].sx; p[2].y = tileScreenInfo[i+1][j+0].sy; p[2].z = tileScreenInfo[i+1][j+0].sz; /* Set up U,V */ p[0].u = psP2->x; p[0].v=psP2->y; - p[1].u = psP3->x; p[1].v=psP3->y; - p[2].u = psP4->x; p[2].v=psP4->y; + p[1].u = psP3->x; p[1].v=psP3->y; + p[2].u = psP4->x; p[2].v=psP4->y; /* Set up shading vars */ - p[0].g = (UBYTE)topR; + p[0].g = (UBYTE)topR; p[1].g = (UBYTE)botR; - p[2].g = (UBYTE)botL; + p[2].g = (UBYTE)botL; } else { /* Set up the texel coordinates */ p[0].x = tileScreenInfo[i+0][j+0].sx; p[0].y = tileScreenInfo[i+0][j+0].sy; p[0].z = tileScreenInfo[i+0][j+0].sz; - p[1].x = tileScreenInfo[i+1][j+1].sx; p[1].y = tileScreenInfo[i+1][j+1].sy; p[1].z = tileScreenInfo[i+1][j+1].sz; - p[2].x = tileScreenInfo[i+1][j+0].sx; p[2].y = tileScreenInfo[i+1][j+0].sy; p[2].z = tileScreenInfo[i+1][j+0].sz; + p[1].x = tileScreenInfo[i+1][j+1].sx; p[1].y = tileScreenInfo[i+1][j+1].sy; p[1].z = tileScreenInfo[i+1][j+1].sz; + p[2].x = tileScreenInfo[i+1][j+0].sx; p[2].y = tileScreenInfo[i+1][j+0].sy; p[2].z = tileScreenInfo[i+1][j+0].sz; /* Set up U,V */ p[0].u = psP1->x; p[0].v=psP1->y; - p[1].u = psP3->x; p[1].v=psP3->y; - p[2].u = psP4->x; p[2].v=psP4->y; + p[1].u = psP3->x; p[1].v=psP3->y; + p[2].u = psP4->x; p[2].v=psP4->y; /* Set up shading vars */ - p[0].g = (UBYTE)topL; + p[0].g = (UBYTE)topL; p[1].g = (UBYTE)botR; - p[2].g = (UBYTE)botL; + p[2].g = (UBYTE)botL; } @@ -1630,40 +1632,40 @@ BOOL bEdgeTile; if (terrainOutline || tileOutlined) { /*iV_Line(tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy, - tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy,255); - iV_Line(tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy, - tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy,255); - iV_Line(tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy, - tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy,255); - iV_Line(tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy, - tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy,255);*/ - iV_Line(tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy, - tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy, + tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy,255); + iV_Line(tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy, + tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy,255); + iV_Line(tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy, + tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy,255); + iV_Line(tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy, + tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy,255);*/ + iV_Line(tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy, + tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy, outlineColour3D); - iV_Line(tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy, - tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy, + iV_Line(tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy, + tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy, outlineColour3D); - iV_Line(tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy, - tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy, + iV_Line(tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy, + tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy, outlineColour3D); - iV_Line(tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy, - tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy, + iV_Line(tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy, + tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy, outlineColour3D); /* - if(TRI_FLIPPED(psTile)) + if(TRI_FLIPPED(psTile)) { iV_Line(tileScreenInfo[i+0][j+0].x,tileScreenInfo[i+0][j+0].y, - tileScreenInfo[i+1][j+1].x,tileScreenInfo[i+1][j+1].y,255); + tileScreenInfo[i+1][j+1].x,tileScreenInfo[i+1][j+1].y,255); } else { iV_Line(tileScreenInfo[i+0][j+1].x,tileScreenInfo[i+0][j+1].y, - tileScreenInfo[i+1][j+0].x,tileScreenInfo[i+1][j+0].y,255); + tileScreenInfo[i+1][j+0].x,tileScreenInfo[i+1][j+0].y,255); } */ } - } - } + } +} /* Draw the buildings */ void displayStaticObjects( void ) @@ -1772,9 +1774,9 @@ UDWORD clan; if(clipXY(psFeature->x,psFeature->y)) { renderFeature(psFeature); - } + } } - } +} /* Draw the Proximity messages for the **SELECTED PLAYER ONLY***/ void displayProximityMsgs( void ) @@ -1787,7 +1789,7 @@ void displayProximityMsgs( void ) for (psProxDisp = apsProxDisp[selectedPlayer]; psProxDisp != NULL; psProxDisp = psProxDisp->psNext) { - if(!(psProxDisp->psMessage->read)) + if(!(psProxDisp->psMessage->read)) { if (psProxDisp->type == POS_PROXDATA) { @@ -1875,13 +1877,13 @@ void displayDynamicObjects( void ) /* No point in adding it if you can't see it? */ if(psDroid->visible[selectedPlayer] || godMode || demoGetStatus()) { - psDroid->sDisplay.frameNumber = currentGameFrame; + psDroid->sDisplay.frameNumber = currentGameFrame; renderDroid( (DROID *) psDroid); /* draw anim if visible */ if ( psDroid->psCurAnim != NULL && - psDroid->psCurAnim->bVisible == TRUE && - (psAnimObj = animObj_Find( psDroid, - psDroid->psCurAnim->uwID )) != NULL ) + psDroid->psCurAnim->bVisible == TRUE && + (psAnimObj = animObj_Find( psDroid, + psDroid->psCurAnim->uwID )) != NULL ) { displayAnimation( psAnimObj, FALSE ); } @@ -2001,7 +2003,7 @@ void renderFeature(FEATURE *psFeature) iV_MatrixBegin(); /* Translate the feature - N.B. We can also do rotations here should we require - buildings to face different ways - Don't know if this is necessary - should be IMO */ + buildings to face different ways - Don't know if this is necessary - should be IMO */ iV_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); @@ -2035,8 +2037,8 @@ void renderFeature(FEATURE *psFeature) brightness = lightDoFogAndIllumination(brightness,getCentreX()-featX,getCentreZ()-featY, &specular); if(psFeature->psStats->subType == FEAT_BUILDING || - psFeature->psStats->subType == FEAT_SKYSCRAPER || - psFeature->psStats->subType == FEAT_OIL_DRUM) + psFeature->psStats->subType == FEAT_SKYSCRAPER || + psFeature->psStats->subType == FEAT_OIL_DRUM) { // these cast a shadow shadowFlags = pie_STATIC_SHADOW; @@ -2224,7 +2226,7 @@ void renderStructure(STRUCTURE *psStructure) if ( psStructure->pStructureType->type == REF_DEFENSE ) { - defensive = TRUE; + defensive = TRUE; } // ------------------------------------------------------------------------------- @@ -2232,7 +2234,7 @@ void renderStructure(STRUCTURE *psStructure) /* Power stations and factories have pulsing lights */ if ( !defensive && psStructure->sDisplay.imd->numFrames > 0 ) - { + { /*OK, so we've got a hack for a new structure - its a 2x2 wall but we've called it a BLAST_DOOR cos we don't want it to use the wallDrag code So its got clan colour trim and not really an anim - these HACKS just keep @@ -2254,11 +2256,11 @@ void renderStructure(STRUCTURE *psStructure) animFrame = playerFrame; } - // ------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------- if(psStructure->visible[selectedPlayer] || godMode || demoGetStatus()) { - /* Mark it as having been drawn */ + /* Mark it as having been drawn */ psStructure->sDisplay.frameNumber = currentGameFrame; /* Get it's x and y coordinates so we don't have to deref. struct later */ @@ -2303,7 +2305,7 @@ void renderStructure(STRUCTURE *psStructure) iV_MatrixBegin(); /* Translate the building - N.B. We can also do rotations here should we require - buildings to face different ways - Don't know if this is necessary - should be IMO */ + buildings to face different ways - Don't know if this is necessary - should be IMO */ iV_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); @@ -2313,15 +2315,15 @@ void renderStructure(STRUCTURE *psStructure) iV_TRANSLATE(rx,0,-rz); /* 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! */ + * buildings in other words are NOT made up of components - much quicker! */ rotation = DEG(psStructure->direction); iV_MatrixRotateY(-rotation); - if( !defensive - && gameTime2-psStructure->timeLastHit < ELEC_DAMAGE_DURATION - && psStructure->lastHitWeapon == WSC_ELECTRONIC ) - { - bHitByElectronic = TRUE; + if( !defensive + && gameTime2-psStructure->timeLastHit < ELEC_DAMAGE_DURATION + && psStructure->lastHitWeapon == WSC_ELECTRONIC ) + { + bHitByElectronic = TRUE; } buildingBrightness = 200 - (100-PERCENT( psStructure->body , structureBody(psStructure))); @@ -2347,47 +2349,47 @@ void renderStructure(STRUCTURE *psStructure) if ( !defensive ) { - /* Draw the building's base first */ - baseImd = psStructure->pStructureType->pBaseIMD; + /* Draw the building's base first */ + baseImd = psStructure->pStructureType->pBaseIMD; - if(baseImd!=NULL) - { - pie_Draw3DShape(baseImd, 0, 0, buildingBrightness, specular, 0,0); - } + if(baseImd!=NULL) + { + pie_Draw3DShape(baseImd, 0, 0, buildingBrightness, specular, 0,0); + } - // override - if(bHitByElectronic) - { - buildingBrightness = 150; - } + // override + if(bHitByElectronic) + { + buildingBrightness = 150; + } - imd = psStructure->sDisplay.imd; + imd = psStructure->sDisplay.imd; - if(imd!=NULL && bHitByElectronic) - { - // Get a copy of the points - memcpy(alteredPoints,imd->points,imd->npoints*sizeof(Vector3i)); - for(i=0; inpoints; i++) - { - yVar = (10-rand()%20); - alteredPoints[i].x +=yVar - (rand()%2*yVar); - alteredPoints[i].z +=yVar - (rand()%2*yVar); - } - temp = imd->points; - imd->points = alteredPoints; - } + if(imd!=NULL && bHitByElectronic) + { + // Get a copy of the points + memcpy(alteredPoints,imd->points,imd->npoints*sizeof(Vector3i)); + for(i=0; inpoints; i++) + { + yVar = (10-rand()%20); + alteredPoints[i].x +=yVar - (rand()%2*yVar); + alteredPoints[i].z +=yVar - (rand()%2*yVar); + } + temp = imd->points; + imd->points = alteredPoints; + } } //first check if partially built - ANOTHER HACK! if ( (psStructure->status == SS_BEING_BUILT ) || - (psStructure->status == SS_BEING_DEMOLISHED ) || - (psStructure->status == SS_BEING_BUILT && psStructure->pStructureType->type == REF_RESOURCE_EXTRACTOR) ) + (psStructure->status == SS_BEING_DEMOLISHED ) || + (psStructure->status == SS_BEING_BUILT && psStructure->pStructureType->type == REF_RESOURCE_EXTRACTOR) ) { if ( defensive ) { - temp = imd->points; - imd->points = alteredPoints; - } + temp = imd->points; + imd->points = alteredPoints; + } pie_Draw3DShape(imd, 0, playerFrame, buildingBrightness, specular, pie_HEIGHT_SCALED|pie_SHADOW, (SDWORD)(structHeightScale(psStructure) * pie_RAISE_SCALE)); @@ -2400,8 +2402,8 @@ void renderStructure(STRUCTURE *psStructure) if ( defensive ) { temp = imd->points; - imd->points = alteredPoints; - } + imd->points = alteredPoints; + } pie_Draw3DShape(imd, animFrame, 0, buildingBrightness, specular, pie_STATIC_SHADOW,0); if(bHitByElectronic || defensive) { imd->points = temp; @@ -2492,7 +2494,7 @@ void renderStructure(STRUCTURE *psStructure) pie_TRANSLATE(0,0,psStructure->asWeaps[i].recoilValue); pie_Draw3DShape(weaponImd[i], playerFrame, 0, buildingBrightness, specular, pie_SHADOW,0); - if(psStructure->pStructureType->type == REF_REPAIR_FACILITY) + if(psStructure->pStructureType->type == REF_REPAIR_FACILITY) { psRepairFac = (REPAIR_FACILITY*)psStructure->pFunctionality; //draw repair flash if the Repair Facility has a target which it has started work on @@ -2509,8 +2511,8 @@ void renderStructure(STRUCTURE *psStructure) iV_MatrixRotateX(-player.r.x); pie_Draw3DShape(pRepImd, getStaticTimeValueRange(100,pRepImd->numFrames), 0, buildingBrightness, 0, pie_ADDITIVE, 192); - iV_MatrixRotateX(player.r.x); - iV_MatrixRotateY(player.r.y); + iV_MatrixRotateX(player.r.x); + iV_MatrixRotateY(player.r.y); pie_MatRotY(DEG((SDWORD)psStructure->turretRotation[i])); } } @@ -2519,16 +2521,16 @@ void renderStructure(STRUCTURE *psStructure) { /* Now we need to move to the end fo the barrel */ pie_TRANSLATE( weaponImd[i]->connectors[0].x, - weaponImd[i]->connectors[0].z, - weaponImd[i]->connectors[0].y ); + weaponImd[i]->connectors[0].z, + weaponImd[i]->connectors[0].y ); //and draw the muzzle flash //animate for the duration of the flash only if(flashImd[i]) { //assume no clan colours formuzzle effects - if ((flashImd[i]->numFrames == 0) || (flashImd[i]->animInterval <= 0))//no anim so display one frame for a fixed time + if ((flashImd[i]->numFrames == 0) || (flashImd[i]->animInterval <= 0))//no anim so display one frame for a fixed time { - if (gameTime < (psStructure->asWeaps[i].lastFired + BASE_MUZZLE_FLASH_DURATION)) + if (gameTime < (psStructure->asWeaps[i].lastFired + BASE_MUZZLE_FLASH_DURATION)) { pie_Draw3DShape(flashImd[i], 0, 0, buildingBrightness, specular, pie_ADDITIVE, 128);//muzzle flash } @@ -2536,7 +2538,7 @@ void renderStructure(STRUCTURE *psStructure) else { - frame = (gameTime - psStructure->asWeaps[i].lastFired)/flashImd[i]->animInterval; + frame = (gameTime - psStructure->asWeaps[i].lastFired)/flashImd[i]->animInterval; if (frame < flashImd[i]->numFrames) { pie_Draw3DShape(flashImd[i], frame, 0, buildingBrightness, specular, pie_ADDITIVE, 20);//muzzle flash @@ -2567,7 +2569,7 @@ void renderStructure(STRUCTURE *psStructure) pie_TRANSLATE(0,0,psStructure->asWeaps[0].recoilValue); pie_Draw3DShape(weaponImd[0], playerFrame, 0, buildingBrightness, specular, pie_SHADOW,0); - if(psStructure->pStructureType->type == REF_REPAIR_FACILITY) + if(psStructure->pStructureType->type == REF_REPAIR_FACILITY) { psRepairFac = (REPAIR_FACILITY*)psStructure->pFunctionality; //draw repair flash if the Repair Facility has a target which it has started work on @@ -2584,8 +2586,8 @@ void renderStructure(STRUCTURE *psStructure) iV_MatrixRotateX(-player.r.x); pie_Draw3DShape(pRepImd, getStaticTimeValueRange(100,pRepImd->numFrames), 0, buildingBrightness, 0, pie_ADDITIVE, 192); - iV_MatrixRotateX(player.r.x); - iV_MatrixRotateY(player.r.y); + iV_MatrixRotateX(player.r.x); + iV_MatrixRotateY(player.r.y); pie_MatRotY(DEG((SDWORD)psStructure->turretRotation[0])); } } @@ -2594,16 +2596,16 @@ void renderStructure(STRUCTURE *psStructure) { /* Now we need to move to the end fo the barrel */ pie_TRANSLATE( weaponImd[0]->connectors[0].x, - weaponImd[0]->connectors[0].z, - weaponImd[0]->connectors[0].y ); + weaponImd[0]->connectors[0].z, + weaponImd[0]->connectors[0].y ); //and draw the muzzle flash //animate for the duration of the flash only if(flashImd[0]) { //assume no clan colours formuzzle effects - if ((flashImd[0]->numFrames == 0) || (flashImd[0]->animInterval <= 0))//no anim so display one frame for a fixed time + if ((flashImd[0]->numFrames == 0) || (flashImd[0]->animInterval <= 0))//no anim so display one frame for a fixed time { - if (gameTime < (psStructure->asWeaps[0].lastFired + BASE_MUZZLE_FLASH_DURATION)) + if (gameTime < (psStructure->asWeaps[0].lastFired + BASE_MUZZLE_FLASH_DURATION)) { pie_Draw3DShape(flashImd[0], 0, 0, buildingBrightness, specular, pie_ADDITIVE, 128);//muzzle flash } @@ -2611,7 +2613,7 @@ void renderStructure(STRUCTURE *psStructure) else { - frame = (gameTime - psStructure->asWeaps[0].lastFired)/flashImd[0]->animInterval; + frame = (gameTime - psStructure->asWeaps[0].lastFired)/flashImd[0]->animInterval; if (frame < flashImd[0]->numFrames) { pie_Draw3DShape(flashImd[0], frame, 0, buildingBrightness, specular, pie_ADDITIVE, 20);//muzzle flash @@ -2637,7 +2639,7 @@ void renderStructure(STRUCTURE *psStructure) } else //its a baba machine gun { - if (psStructure->asWeaps[0].nStat > 0) + if (psStructure->asWeaps[0].nStat > 0) { flashImd[0] = NULL; strImd = psStructure->sDisplay.imd; @@ -2727,7 +2729,7 @@ void renderDeliveryPoint(FLAG_POSITION *psPosition) //quick check for invalid data //ASSERT( psPosition->factoryType < NUM_FACTORY_TYPES && - ASSERT( psPosition->factoryType < NUM_FLAG_TYPES && psPosition->factoryInc < MAX_FACTORY, "Invalid assembly point" ); + ASSERT( psPosition->factoryType < NUM_FLAG_TYPES && psPosition->factoryInc < MAX_FACTORY, "Invalid assembly point" ); if(!psPosition->selected) { @@ -2794,8 +2796,8 @@ static BOOL renderWallSection(STRUCTURE *psStructure) /* Get it's x and y coordinates so we don't have to deref. struct later */ structX = psStructure->x; structY = psStructure->y; - // centreX = ( player.p.x + ((visibleXTiles/2)<body , structureBody(psStructure))); if(psStructure->selected) @@ -2836,7 +2838,7 @@ static BOOL renderWallSection(STRUCTURE *psStructure) memcpy(alteredPoints,imd->points,imd->npoints*sizeof(Vector3i)); // Get the height of the centre point for reference centreHeight = map_Height(structX,structY); - // Now we got through the shape looking for vertices on the edge + // Now we got through the shape looking for vertices on the edge for(i=0; i<(UDWORD)imd->npoints; i++) { pointHeight = map_Height(structX+alteredPoints[i].x,structY-alteredPoints[i].z); @@ -2899,12 +2901,12 @@ static BOOL renderWallSection(STRUCTURE *psStructure) /* Actually render it */ if ( (psStructure->status == SS_BEING_BUILT ) || - (psStructure->status == SS_BEING_DEMOLISHED ) || - (psStructure->status == SS_BEING_BUILT && psStructure->pStructureType->type == REF_RESOURCE_EXTRACTOR) ) + (psStructure->status == SS_BEING_DEMOLISHED ) || + (psStructure->status == SS_BEING_BUILT && psStructure->pStructureType->type == REF_RESOURCE_EXTRACTOR) ) { pie_Draw3DShape( psStructure->sDisplay.imd, 0, getPlayerColour(psStructure->player), - brightness, specular, pie_HEIGHT_SCALED|pie_SHADOW, - (SDWORD)(structHeightScale(psStructure) * pie_RAISE_SCALE) ); + brightness, specular, pie_HEIGHT_SCALED|pie_SHADOW, + (SDWORD)(structHeightScale(psStructure) * pie_RAISE_SCALE) ); } else if(psStructure->status == SS_BUILT) { @@ -2972,7 +2974,7 @@ void renderShadow( DROID *psDroid, iIMDShape *psShadowIMD ) } else { - pie_MatRotY(DEG(-psDroid->direction)); + pie_MatRotY(DEG(-psDroid->direction)); pie_MatRotX(DEG(psDroid->pitch)); pie_MatRotZ(DEG(psDroid->roll)); } @@ -2997,8 +2999,8 @@ void renderDroid( DROID *psDroid ) // "moveUpdateUnit: unit at (0,0)" ); - // psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat; - // ASSERT( psPropStats != NULL, +// psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat; +// ASSERT( psPropStats != NULL, // "moveUpdateDroid: invalid propulsion stats pointer" ); /* @@ -3027,7 +3029,7 @@ static void drawDragBox( void ) { if(gameTime - dragBox3D.lastTime > BOX_PULSE_SPEED) { - dragBox3D.boxColourIndex++; + dragBox3D.boxColourIndex++; if(dragBox3D.boxColourIndex>=BOX_PULSE_SIZE) { dragBox3D.boxColourIndex = 0; @@ -3048,14 +3050,14 @@ static void drawDragBox( void ) maxY -= dragBox3D.boxColourIndex/2; pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_OFF); - iV_Box(minX, minY, + iV_Box(minX, minY, maxX, maxY, boxPulseColours[dragBox3D.boxColourIndex]); if (war_GetTranslucent()) { - pie_UniTransBoxFill(minX+1, minY+1, - maxX-1, maxY-1, - 0x00ffffff, 16); + pie_UniTransBoxFill(minX+1, minY+1, + maxX-1, maxY-1, + 0x00ffffff, 16); } pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON); } @@ -3079,7 +3081,7 @@ static void drawWeaponReloadBar(BASE_OBJECT *psObj, WEAPON *psWeap, int weapon_s DROID *psDroid; if (ctrlShiftDown() && (psObj->type == OBJ_DROID)) - { + { psDroid = (DROID*)psObj; scrX = psObj->sDisplay.screenX; scrY = psObj->sDisplay.screenY; @@ -3087,13 +3089,13 @@ static void drawWeaponReloadBar(BASE_OBJECT *psObj, WEAPON *psWeap, int weapon_s scrY += scrR + 2; if (psDroid->resistance) - { + { mulH = MAKEFRACT(psDroid->resistance) / MAKEFRACT(droidResistance(psDroid)); - } - else - { + } + else + { mulH = 100; - } + } firingStage = MAKEINT(mulH); firingStage = ((((2*scrR)*10000)/100)*firingStage)/10000; if(firingStage >= (UDWORD)(2*scrR)) @@ -3131,7 +3133,7 @@ static void drawWeaponReloadBar(BASE_OBJECT *psObj, WEAPON *psWeap, int weapon_s { //deal with VTOLs firingStage = getNumAttackRuns((DROID *)psObj, weapon_slot) - ((DROID *)psObj)->sMove.iAttackRuns[weapon_slot]; - //compare with max value + //compare with max value interval = getNumAttackRuns((DROID *)psObj, weapon_slot); } else @@ -3146,7 +3148,7 @@ static void drawWeaponReloadBar(BASE_OBJECT *psObj, WEAPON *psWeap, int weapon_s interval = weaponFirePause(psStats, psObj->player); } - //we haven't calculated the damLevel yet! DOH! + //we haven't calculated the damLevel yet! DOH! /*if (damLevel < HEAVY_DAMAGE_LEVEL) { interval += interval; @@ -3175,8 +3177,8 @@ static void drawWeaponReloadBar(BASE_OBJECT *psObj, WEAPON *psWeap, int weapon_s break; } - //now we know what it is!! - if (damLevel < HEAVY_DAMAGE_LEVEL) + //now we know what it is!! + if (damLevel < HEAVY_DAMAGE_LEVEL) { interval += interval; } @@ -3220,7 +3222,7 @@ FRACT mulH; bMouseOverStructure = TRUE; if(psClickedOn->player == selectedPlayer) { - bMouseOverOwnStructure = TRUE; + bMouseOverOwnStructure = TRUE; } } pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON); @@ -3233,9 +3235,9 @@ FRACT mulH; /* If it's selected */ if( (psStruct->selected) || (bMouseOverOwnStructure && (psStruct==(STRUCTURE*)psClickedOn) - && (((STRUCTURE*)psClickedOn)->status==SS_BUILT) - /* If it was clipped - reject it */ - && psStruct->sDisplay.frameNumber == currentGameFrame)) + && (((STRUCTURE*)psClickedOn)->status==SS_BUILT) + /* If it was clipped - reject it */ + && psStruct->sDisplay.frameNumber == currentGameFrame)) { //---- scale = max(psStruct->pStructureType->baseWidth,psStruct->pStructureType->baseBreadth); @@ -3244,25 +3246,25 @@ FRACT mulH; scrY = psStruct->sDisplay.screenY + (scale*10); scrR = width; //health = PERCENT(psStruct->body, psStruct->baseBodyPoints); - if (ctrlShiftDown()) - { - //show resistance values if CTRL/SHIFT depressed - UDWORD resistance = structureResistance( - psStruct->pStructureType, psStruct->player); - if (resistance) - { - health = PERCENT(psStruct->resistance, resistance); - } - else - { - health = 100; - } - } - else - { - //show body points - health = PERCENT(psStruct->body, structureBody(psStruct)); - } + if (ctrlShiftDown()) + { + //show resistance values if CTRL/SHIFT depressed + UDWORD resistance = structureResistance( + psStruct->pStructureType, psStruct->player); + if (resistance) + { + health = PERCENT(psStruct->resistance, resistance); + } + else + { + health = 100; + } + } + else + { + //show body points + health = PERCENT(psStruct->body, structureBody(psStruct)); + } if(health>100) health =100; if (health > REPAIRLEV_HIGH) { @@ -3292,7 +3294,7 @@ FRACT mulH; scrY = psStruct->sDisplay.screenY + (scale*10); scrR = width; // health = PERCENT(psStruct->body, psStruct->baseBodyPoints); - health = PERCENT(psStruct->currentBuildPts , + health = PERCENT(psStruct->currentBuildPts , psStruct->pStructureType->buildPoints); if(health>=100) health = 100; // belt and braces powerCol = COL_YELLOW; @@ -3364,25 +3366,25 @@ FRACT mulH; scrY = psStruct->sDisplay.screenY + (scale*10); scrR = width; //health = PERCENT(psStruct->body, psStruct->baseBodyPoints); - if (ctrlShiftDown()) - { - //show resistance values if CTRL/SHIFT depressed - UDWORD resistance = structureResistance( - psStruct->pStructureType, psStruct->player); - if (resistance) - { - health = PERCENT(psStruct->resistance, resistance); - } - else - { - health = 100; - } - } - else - { - //show body points - health = PERCENT(psStruct->body, structureBody(psStruct)); - } + if (ctrlShiftDown()) + { + //show resistance values if CTRL/SHIFT depressed + UDWORD resistance = structureResistance( + psStruct->pStructureType, psStruct->player); + if (resistance) + { + health = PERCENT(psStruct->resistance, resistance); + } + else + { + health = 100; + } + } + else + { + //show body points + health = PERCENT(psStruct->body, structureBody(psStruct)); + } if (health > REPAIRLEV_HIGH) longPowerCol = 0x0000ff00; //green else if (health > REPAIRLEV_LOW) longPowerCol = 0x00ffff00; //yellow else longPowerCol = 0x00ff0000; //red @@ -3399,7 +3401,7 @@ FRACT mulH; scrY = psStruct->sDisplay.screenY + (scale*10); scrR = width; // health = PERCENT(psStruct->body, psStruct->baseBodyPoints); - health = PERCENT(psStruct->currentBuildPts , psStruct->pStructureType->buildPoints); + health = PERCENT(psStruct->currentBuildPts , psStruct->pStructureType->buildPoints); powerCol = COL_GREEN; health = (((width*10000)/100)*health)/10000; health*=2; @@ -3419,7 +3421,7 @@ static UDWORD getTargettingGfx( void ) { UDWORD index; - index = getTimeValueRange(1000,10); + index = getTimeValueRange(1000,10); switch(index) { @@ -3607,10 +3609,10 @@ static void drawDroidSelections( void ) // } // else // { - damage = PERCENT(psDroid->body,psDroid->originalBody); + damage = PERCENT(psDroid->body,psDroid->originalBody); // } - if (damage > REPAIRLEV_HIGH) longPowerCol = 0x0000ff00; //green + if (damage > REPAIRLEV_HIGH) longPowerCol = 0x0000ff00; //green else if (damage > REPAIRLEV_LOW) longPowerCol = 0x00ffff00; //yellow else longPowerCol = 0x00ff0000; //red //show resistance values if CTRL/SHIFT depressed(now done in reload bar) @@ -3627,7 +3629,7 @@ static void drawDroidSelections( void ) // } // else // { - mulH = MAKEFRACT(psDroid->body) / MAKEFRACT(psDroid->originalBody); + mulH = MAKEFRACT(psDroid->body) / MAKEFRACT(psDroid->originalBody); // } damage = MAKEINT(mulH*MAKEFRACT(psDroid->sDisplay.screenR));// (((psDroid->sDisplay.screenR*10000)/100)*damage)/10000; if(damage>psDroid->sDisplay.screenR) damage = psDroid->sDisplay.screenR; @@ -3657,7 +3659,7 @@ static void drawDroidSelections( void ) { if(bEnergyBars) { - pie_BoxFill(scrX-scrR, scrY+scrR-7, scrX-scrR+1, scrY+scrR, longBoxCol); + pie_BoxFill(scrX-scrR, scrY+scrR-7, scrX-scrR+1, scrY+scrR, longBoxCol); pie_BoxFill(scrX-scrR, scrY+scrR, scrX-scrR+7, scrY+scrR+1,longBoxCol); pie_BoxFill(scrX+scrR-7, scrY+scrR, scrX+scrR, scrY+scrR+1,longBoxCol); pie_BoxFill(scrX+scrR, scrY+scrR-7, scrX+scrR+1, scrY+scrR+1,longBoxCol); @@ -3783,7 +3785,7 @@ static void drawDroidSelections( void ) longBoxCol = 0x0000ff00; } - //we always want to show the enemy health/resistance as energyBar - AB 18/06/99 + //we always want to show the enemy health/resistance as energyBar - AB 18/06/99 //if(bEnergyBars) { /* Power bars */ @@ -4086,7 +4088,7 @@ void calcScreenCoords(DROID *psDroid) if(inQuad(&pt,&dragQuad) && psDroid->player == selectedPlayer) { //don't allow Transporter Droids to be selected here - //unless we're in multiPlayer mode!!!! + //unless we're in multiPlayer mode!!!! if (psDroid->droidType != DROID_TRANSPORTER || bMultiPlayer) { dealWithDroidSelect(psDroid, TRUE); @@ -4157,7 +4159,7 @@ SDWORD order; // averageHeight+=map_TileHeight(i,j); } } - } + } //don't display until we're releasing this feature in an update! #ifndef DISABLE_BUILD_QUEUE @@ -4359,7 +4361,7 @@ static void locateMouse(void) if(mouseTileY<0) mouseTileY = 0; if(mouseTileY > mapHeight-1) mouseTileY = mapHeight-1; - tile3dX = playerXTile+j; + tile3dX = playerXTile+j; tile3dY = playerZTile+i; if( (tile3dX > 0) && (tile3dY > 0) && @@ -4385,7 +4387,7 @@ static void renderSurroundings(void) const float wider = 2*(visibleXTiles*TILE_UNITS); int left, right, front, back; const float scale = 10000.0f; - + // set up matrices and textures pie_PerspectiveBegin(); @@ -4404,8 +4406,8 @@ static void renderSurroundings(void) pie_MatRotY(player.r.y); // Fogbox // - rx = (player.p.x) & (TILE_UNITS-1); - rz = (player.p.z) & (TILE_UNITS-1); + rx = (player.p.x) & (TILE_UNITS-1); + rz = (player.p.z) & (TILE_UNITS-1); pie_TRANSLATE(-rx,-player.p.y,rz); left = TILE_UNITS * min(visibleXTiles/2, playerXTile+visibleXTiles/2+1); @@ -4431,10 +4433,10 @@ static void renderSurroundings(void) if(!gamePaused()) { wind += 0.5*frameTime2/GAME_TICKS_PER_SEC; - if(wind >= 360) - { - wind = 0; - } + if(wind >= 360) + { + wind = 0; + } } pie_DrawSkybox(scale, 0, 128, 256, 128); @@ -4456,87 +4458,87 @@ SDWORD shift; "flattenImd: too many points in the PIE to flatten it" ); /* Get a copy of the points */ - memcpy(alteredPoints,imd->points,imd->npoints*sizeof(Vector3i)); - /* Get the height of the centre point for reference */ - centreHeight = map_Height(structX,structY); - /* Now we go through the shape looking for vertices on the edge */ - /* Flip reference coords if we're on a vertical wall */ + memcpy(alteredPoints,imd->points,imd->npoints*sizeof(Vector3i)); + /* Get the height of the centre point for reference */ + centreHeight = map_Height(structX,structY); + /* Now we go through the shape looking for vertices on the edge */ + /* Flip reference coords if we're on a vertical wall */ /* Little hack below 'cos sometimes they're not exactly 90 degree alligned. */ direction /= 90; direction *= 90; switch(direction) - { - case 0: - for(i=0; i<(UDWORD)imd->npoints; i++) - { + { + case 0: + for(i=0; i<(UDWORD)imd->npoints; i++) + { if(abs(alteredPoints[i].x) >= 63 || abs(alteredPoints[i].z)>=63) { - pointHeight = map_Height(structX+alteredPoints[i].x,structY-alteredPoints[i].z); - shift = centreHeight - pointHeight; + pointHeight = map_Height(structX+alteredPoints[i].x,structY-alteredPoints[i].z); + shift = centreHeight - pointHeight; alteredPoints[i].y -= (shift-4); } - } - break; - case 90: - for(i=0; i<(UDWORD)imd->npoints; i++) - { + } + break; + case 90: + for(i=0; i<(UDWORD)imd->npoints; i++) + { if(abs(alteredPoints[i].x) >= 63 || abs(alteredPoints[i].z)>=63) { - pointHeight = map_Height(structX-alteredPoints[i].z,structY-alteredPoints[i].x); - shift = centreHeight - pointHeight; - alteredPoints[i].y -= (shift-4); + pointHeight = map_Height(structX-alteredPoints[i].z,structY-alteredPoints[i].x); + shift = centreHeight - pointHeight; + alteredPoints[i].y -= (shift-4); } - } - break; + } + break; - case 180: - for(i=0; i<(UDWORD)imd->npoints; i++) - { + case 180: + for(i=0; i<(UDWORD)imd->npoints; i++) + { if(abs(alteredPoints[i].x) >= 63 || abs(alteredPoints[i].z)>=63) { - pointHeight = map_Height(structX-alteredPoints[i].x,structY+alteredPoints[i].z); - shift = centreHeight - pointHeight; - alteredPoints[i].y -= (shift-4); + pointHeight = map_Height(structX-alteredPoints[i].x,structY+alteredPoints[i].z); + shift = centreHeight - pointHeight; + alteredPoints[i].y -= (shift-4); } - } - break; - case 270: - for(i=0; i<(UDWORD)imd->npoints; i++) - { + } + break; + case 270: + for(i=0; i<(UDWORD)imd->npoints; i++) + { if(abs(alteredPoints[i].x) >= 63 || abs(alteredPoints[i].z)>=63) { - pointHeight = map_Height(structX+alteredPoints[i].z,structY+alteredPoints[i].x); - shift = centreHeight - pointHeight; - alteredPoints[i].y -= (shift-4); + pointHeight = map_Height(structX+alteredPoints[i].z,structY+alteredPoints[i].x); + shift = centreHeight - pointHeight; + alteredPoints[i].y -= (shift-4); } - } - break; + } + break; - default: + default: debug( LOG_ERROR, "Weirdy direction for a structure in renderWall" ); abort(); - break; - } + break; + } /* if (psStructure-> direction == 90) { for(i=0; inpoints; i++) - { + { pointHeight = map_Height(structX-alteredPoints[i].z,structY-alteredPoints[i].x); - shift = centreHeight - pointHeight; + shift = centreHeight - pointHeight; alteredPoints[i].y -= shift; - } + } } else { for(i=0; inpoints; i++) - { + { pointHeight = map_Height(structX+alteredPoints[i].x,structY-alteredPoints[i].z); - shift = centreHeight - pointHeight; + shift = centreHeight - pointHeight; alteredPoints[i].y -= shift; - } + } } */ imd->points = alteredPoints; @@ -4728,7 +4730,7 @@ void drawTerrainTile(UDWORD i, UDWORD j, BOOL onWaterEdge) } */ /* Get the right texture page; it is pre stored and indexed on - * the graphics card */ + * the graphics card */ pie_SetTexturePage(tileTexInfo[tileNumber & TILE_NUMMASK].texPage); /* set up the texture size info */ @@ -4833,13 +4835,13 @@ void drawTerrainTile(UDWORD i, UDWORD j, BOOL onWaterEdge) if(!onWaterEdge && terrainOutline) { iV_Line(tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy, - tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy,255); - iV_Line(tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy, - tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy,255); - iV_Line(tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy, - tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy,255); - iV_Line(tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy, - tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy,255); + tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy,255); + iV_Line(tileScreenInfo[i+0][j+1].sx,tileScreenInfo[i+0][j+1].sy, + tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy,255); + iV_Line(tileScreenInfo[i+1][j+1].sx,tileScreenInfo[i+1][j+1].sy, + tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy,255); + iV_Line(tileScreenInfo[i+1][j+0].sx,tileScreenInfo[i+1][j+0].sy, + tileScreenInfo[i+0][j+0].sx,tileScreenInfo[i+0][j+0].sy,255); } if(!onWaterEdge && bOutlined) @@ -4961,12 +4963,12 @@ UDWORD xPos,yPos; SDWORD pitch; worldAngle = (UDWORD) ((UDWORD)player.r.y/DEG_1)%360; - /* Now, we need to track angle too - to avoid near z clip! */ + /* Now, we need to track angle too - to avoid near z clip! */ - xPos = (player.p.x + ((visibleXTiles/2)*TILE_UNITS)); - yPos = (player.p.z + ((visibleYTiles/2)*TILE_UNITS)); + xPos = (player.p.x + ((visibleXTiles/2)*TILE_UNITS)); + yPos = (player.p.z + ((visibleYTiles/2)*TILE_UNITS)); // getBestPitchToEdgeOfGrid(xPos,yPos,360-worldAngle,&pitch); - getPitchToHighestPoint(xPos,yPos,360-worldAngle,0,&pitch); + getPitchToHighestPoint(xPos,yPos,360-worldAngle,0,&pitch); if(pitchabs(MIN_PLAYER_X_ANGLE)) pitch = abs(MIN_PLAYER_X_ANGLE); @@ -5243,12 +5245,12 @@ static void testEffect2( UDWORD player ) numConnected++; } } - /* No effect if nothing connected */ + /* No effect if nothing connected */ if(!numConnected) { //return; - //keep looking for another! - continue; + //keep looking for another! + continue; } else switch(numConnected) @@ -5273,7 +5275,7 @@ static void testEffect2( UDWORD player ) /* New addition - it shows how many are connected... */ for(i=0 ;ipStructureType->type == REF_REARM_PAD && psStructure->visible[selectedPlayer] ) { - psReArmPad = (REARM_PAD *) psStructure->pFunctionality; + psReArmPad = (REARM_PAD *) psStructure->pFunctionality; psChosenObj = psReArmPad->psObj; if(psChosenObj!=NULL) { if((((DROID*)psChosenObj)->visible[selectedPlayer])) { - bFXSize = 0; + bFXSize = 0; psDroid = (DROID*) psChosenObj; if(!psDroid->died && psDroid->action == DACTION_WAITDURINGREARM ) { - bFXSize = 30; + bFXSize = 30; } - /* Then it's repairing...? */ + /* Then it's repairing...? */ if(!gamePaused()) { val = lastSpinVal = getTimeValueRange(720,360); // grab an angle - 4 seconds cyclic @@ -5355,10 +5357,10 @@ static void testEffect( void ) { for(i=0;ix - xDif; + pos.x = psDroid->x - xDif; pos.z = psDroid->y - yDif; pos.y = map_Height(pos.x,pos.z)+ 16; // 64 up to get to base of spire effectGiveAuxVar(80); // half normal plasma size... @@ -5435,7 +5437,7 @@ static void showSensorRange2(BASE_OBJECT *psObj) { if(psObj->type == OBJ_DROID) { - psDroid = (DROID*)psObj; + psDroid = (DROID*)psObj; sensorRange = asSensorStats[psDroid->asBits[COMP_SENSOR].nStat].range; } else @@ -5451,7 +5453,7 @@ static void showSensorRange2(BASE_OBJECT *psObj) xDif = xDif/4096; // cos it's fixed point yDif = yDif/4096; - pos.x = psObj->x - xDif; + pos.x = psObj->x - xDif; pos.z = psObj->y - yDif; pos.y = map_Height(pos.x,pos.z)+ 16; // 64 up to get to base of spire effectGiveAuxVar(80); // half normal plasma size... @@ -5479,7 +5481,7 @@ static void drawRangeAtPos(SDWORD centerX, SDWORD centerY, SDWORD radius) xDif = xDif/4096; // cos it's fixed point yDif = yDif/4096; - pos.x = centerX - xDif; + pos.x = centerX - xDif; pos.z = centerY - yDif; pos.y = map_Height(pos.x,pos.z)+ 16; // 64 up to get to base of spire effectGiveAuxVar(80); // half normal plasma size... @@ -5501,8 +5503,8 @@ void debugToggleSensorDisplay( void ) } /* draw some effects at certain position to visualize the radius, - * negative radius turns this off - */ +* negative radius turns this off +*/ void showRangeAtPos(SDWORD centerX, SDWORD centerY, SDWORD radius) { rangeCenterX = centerX; @@ -5518,7 +5520,7 @@ void showRangeAtPos(SDWORD centerX, SDWORD centerY, SDWORD radius) /*returns the graphic ID for a droid rank*/ UDWORD getDroidRankGraphic(DROID *psDroid) { - UDWORD gfxId; + UDWORD gfxId; /* Not found yet */ gfxId = UDWORD_MAX; @@ -5557,7 +5559,7 @@ UDWORD getDroidRankGraphic(DROID *psDroid) break; } //#else - /* + /* switch(getDroidLevel(psDroid)) { case 0: @@ -5629,7 +5631,7 @@ UDWORD getDroidRankGraphic(DROID *psDroid) break; }*/ - return gfxId; + return gfxId; } /* DOES : Assumes matrix context set and that z-buffer write is force enabled (Always). @@ -5641,9 +5643,9 @@ static void drawDroidRank(DROID *psDroid) //UDWORD droidLevel; UDWORD gfxId; - gfxId = getDroidRankGraphic(psDroid); + gfxId = getDroidRankGraphic(psDroid); - /* Did we get one? - We should have... */ + /* Did we get one? - We should have... */ if(gfxId!=UDWORD_MAX) { /* Render the rank graphic at the correct location */ // remove hardcoded numbers?! @@ -5671,7 +5673,7 @@ DROID *psDroid; UDWORD i; // pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON); - // pie_SetFogStatus(FALSE); +// pie_SetFogStatus(FALSE); for(i=0; ivisible[selectedPlayer]==UBYTE_MAX) && - (psDroid->sMove.Status != MOVESHUFFLE) ) + (psDroid->sMove.Status != MOVESHUFFLE) ) { if(psDroid->action == DACTION_BUILD) { @@ -5712,7 +5714,7 @@ UDWORD i; } } } - pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON); + pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON); } diff --git a/src/environ.c b/src/environ.c index e8e166380..3f9a0c749 100644 --- a/src/environ.c +++ b/src/environ.c @@ -130,14 +130,14 @@ MAPTILE *psTile; // ------------------------------------------------------------------------------- void environUpdate( void ) { -UDWORD i,j; -UDWORD index; -FRACT value,newValue; -FRACT increment = 0; -FRACT lowest = 0; -FRACT highest = 0; -UDWORD startX,startY,endX,endY; -FRACT fraction; + UDWORD i,j; + UDWORD index; + FRACT value,newValue; + FRACT increment = 0; + FRACT lowest = 0; + FRACT highest = 0; + UDWORD startX,startY,endX,endY; + FRACT fraction; //at the moment this function is getting called between levels and so crashes - quick check here for now if (pEnvironData == NULL)