diff --git a/fixcppbuild b/fixcppbuild new file mode 100755 index 000000000..68b26e301 --- /dev/null +++ b/fixcppbuild @@ -0,0 +1,17 @@ +#!/bin/bash +for a in {src,lib/*}/*.cpp +do + b="${a%pp}" + c="${a##*/}" + d="${b##*/}" + if [ "$d" != '*.c' ] + then + #echo Checking "$a" + sed -i "s/\\b${b//\//\\\\}\\b/${a//\//\\\\}/" win32/*.vcproj + sed -i "s/\\b$d\\b/$c/" {src,lib/*}/{Makefile.am,makefile.win32} macosx/Warzone.xcodeproj/project.pbxproj + else + echo Skipping "$a". + fi +done +# macosx weirdness: +sed -i 's/sourcecode\.c\.c;\(.*\.cpp;\)/sourcecode.cpp.cpp;\1/' macosx/Warzone.xcodeproj/project.pbxproj diff --git a/lib/ivis_common/Makefile.am b/lib/ivis_common/Makefile.am index 79d96f1d7..e53bc464d 100644 --- a/lib/ivis_common/Makefile.am +++ b/lib/ivis_common/Makefile.am @@ -8,7 +8,6 @@ noinst_HEADERS = \ imd.h \ ivi.h \ ivisdef.h \ - ivispatch.h \ jpeg_encoder.h \ pieblitfunc.h \ pieclip.h \ diff --git a/lib/ivis_common/imd.c b/lib/ivis_common/imd.c index c570be221..2c1e10e48 100644 --- a/lib/ivis_common/imd.c +++ b/lib/ivis_common/imd.c @@ -20,7 +20,7 @@ #include "imd.h" #include "ivisdef.h" #include "tex.h" -#include "ivispatch.h" +#include "pietypes.h" //************************************************************************* //*** free IMD shape memory diff --git a/lib/ivis_common/imdload.c b/lib/ivis_common/imdload.c index 283c04320..a87f3376c 100644 --- a/lib/ivis_common/imdload.c +++ b/lib/ivis_common/imdload.c @@ -33,7 +33,6 @@ #include "ivisdef.h" // for imd structures #include "imd.h" // for imd structures #include "rendmode.h" -#include "ivispatch.h" #include "tex.h" // texture page loading static BOOL AtEndOfFile(const char *CurPos, const char *EndOfFile) diff --git a/lib/ivis_common/ivispatch.h b/lib/ivis_common/ivispatch.h deleted file mode 100644 index f30212c16..000000000 --- a/lib/ivis_common/ivispatch.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - This file is part of Warzone 2100. - Copyright (C) 1999-2004 Eidos Interactive - Copyright (C) 2005-2010 Warzone 2100 Project - - Warzone 2100 is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Warzone 2100 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Warzone 2100; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -/***************************************************************************/ -/* - * ivispatch.h - * - * patches old ivis defines to new pie defines allows both definitions to run concurrently . - * - */ -/***************************************************************************/ - -#ifndef _ivispatch_h -#define _ivispatch_h - -#include "lib/framework/frame.h" -#include "pietypes.h" - -/***************************************************************************/ -/* - * Global Definitions - */ -/***************************************************************************/ - -//matrixstuff -#define iV_MatrixBegin pie_MatBegin -#define iV_MatrixEnd pie_MatEnd -#define iV_MatrixRotateX pie_MatRotX -#define iV_MatrixRotateY pie_MatRotY -#define iV_MatrixRotateZ pie_MatRotZ -#define iV_TRANSLATE pie_TRANSLATE - -#endif // _ivispatch_h diff --git a/lib/ivis_common/piedef.h b/lib/ivis_common/piedef.h index 318fc4ef1..78d441f2f 100644 --- a/lib/ivis_common/piedef.h +++ b/lib/ivis_common/piedef.h @@ -34,7 +34,7 @@ #include "lib/framework/frame.h" #include "lib/framework/vector.h" #include "ivisdef.h" -#include "ivispatch.h" +#include "pietypes.h" /***************************************************************************/ /* diff --git a/lib/ivis_opengl/Makefile.am b/lib/ivis_opengl/Makefile.am index 4c057599d..3863deea0 100644 --- a/lib/ivis_opengl/Makefile.am +++ b/lib/ivis_opengl/Makefile.am @@ -28,3 +28,10 @@ endif libivis_opengl_a_LIBADD = $(top_builddir)/lib/ivis_common/libivis_common.a \ $(top_builddir)/lib/framework/libframework.a + +# HACK Don't give make errors when switching between trunk and branches. +# Works by finding the .deps/*.Po files which refer to source files that don't exist, and replacing them with a single dependency on the correct source file. +# Now with PD-ksh support. +fixbrokendependencies: + mkdir -p ".deps" ; for ext in c cpp ; do for a in `cd $(srcdir) ; echo *.$$ext` ; do fpref="`echo "$$a" | sed "s/\.$$ext//"`" ; pofile=".deps/$$fpref.Po" ; srcfile="$(srcdir)/$$a" ; if [ -e "$$srcfile" ] && ! grep -q "\b$$a\b" "$$pofile" 2> /dev/null ; then echo "$$fpref.o: $$srcfile" | tee "$$pofile" ; fi ; done ; done +all: fixbrokendependencies diff --git a/lib/ivis_opengl/piematrix.c b/lib/ivis_opengl/piematrix.c index 3670c2763..c2e0eb002 100644 --- a/lib/ivis_opengl/piematrix.c +++ b/lib/ivis_opengl/piematrix.c @@ -180,7 +180,7 @@ void pie_MatScale(float scale) //* //****** -void pie_MatRotY(float y) +void pie_MatRotY(uint16_t y) { /* * a := angle @@ -194,10 +194,10 @@ void pie_MatRotY(float y) * curMatrix = curMatrix . [ -s 0 c 0 ] * [ 0 0 0 1 ] */ - if (y != 0.f) + if (y != 0) { int t; - int64_t cra = iCos(DEG(y)), sra = iSin(DEG(y)); + int64_t cra = iCos(y), sra = iSin(y); t = (cra*psMatrix->a - sra*psMatrix->g)>>16; psMatrix->g = (sra*psMatrix->a + cra*psMatrix->g)>>16; @@ -211,7 +211,7 @@ void pie_MatRotY(float y) psMatrix->i = (sra*psMatrix->c + cra*psMatrix->i)>>16; psMatrix->c = t; - glRotatef(y, 0.0f, 1.0f, 0.0f); + glRotatef(UNDEG(y), 0.0f, 1.0f, 0.0f); } } @@ -221,7 +221,7 @@ void pie_MatRotY(float y) //* //****** -void pie_MatRotZ(float z) +void pie_MatRotZ(uint16_t z) { /* * a := angle @@ -235,10 +235,10 @@ void pie_MatRotZ(float z) * curMatrix = curMatrix . [ 0 0 1 0 ] * [ 0 0 0 1 ] */ - if (z != 0.f) + if (z != 0) { int t; - int64_t cra = iCos(DEG(z)), sra = iSin(DEG(z)); + int64_t cra = iCos(z), sra = iSin(z); t = (cra*psMatrix->a + sra*psMatrix->d)>>16; psMatrix->d = (cra*psMatrix->d - sra*psMatrix->a)>>16; @@ -252,7 +252,7 @@ void pie_MatRotZ(float z) psMatrix->f = (cra*psMatrix->f - sra*psMatrix->c)>>16; psMatrix->c = t; - glRotatef(z, 0.0f, 0.0f, 1.0f); + glRotatef(UNDEG(z), 0.0f, 0.0f, 1.0f); } } @@ -262,7 +262,7 @@ void pie_MatRotZ(float z) //* //****** -void pie_MatRotX(float x) +void pie_MatRotX(uint16_t x) { /* * a := angle @@ -279,7 +279,7 @@ void pie_MatRotX(float x) if (x != 0.f) { int t; - int64_t cra = iCos(DEG(x)), sra = iSin(DEG(x)); + int64_t cra = iCos(x), sra = iSin(x); t = (cra*psMatrix->d + sra*psMatrix->g)>>16; psMatrix->g = (cra*psMatrix->g - sra*psMatrix->d)>>16; @@ -293,7 +293,7 @@ void pie_MatRotX(float x) psMatrix->i = (cra*psMatrix->i - sra*psMatrix->f)>>16; psMatrix->f = t; - glRotatef(x, 1.0f, 0.0f, 0.0f); + glRotatef(UNDEG(x), 1.0f, 0.0f, 0.0f); } } diff --git a/lib/ivis_opengl/piematrix.h b/lib/ivis_opengl/piematrix.h index 201f7c05d..3c2782437 100644 --- a/lib/ivis_opengl/piematrix.h +++ b/lib/ivis_opengl/piematrix.h @@ -91,9 +91,9 @@ extern void pie_MatEnd(void); extern void pie_MATTRANS(float x, float y, float z); extern void pie_TRANSLATE(float x, float y, float z); extern void pie_MatScale(float scale); -extern void pie_MatRotX(float x); -extern void pie_MatRotY(float y); -extern void pie_MatRotZ(float z); +extern void pie_MatRotX(uint16_t x); +extern void pie_MatRotY(uint16_t y); +extern void pie_MatRotZ(uint16_t z); extern int32_t pie_RotateProject(const Vector3i *src, Vector2i *dest); //************************************************************************* diff --git a/lib/ivis_opengl/rendmode.c b/lib/ivis_opengl/rendmode.c index aece911df..fe52afa9f 100644 --- a/lib/ivis_opengl/rendmode.c +++ b/lib/ivis_opengl/rendmode.c @@ -22,7 +22,6 @@ #include "lib/ivis_common/textdraw.h" #include "lib/ivis_common/piepalette.h" #include "lib/ivis_common/piestate.h" -#include "lib/ivis_common/ivispatch.h" //************************************************************************* diff --git a/lib/ivis_opengl/tex.c b/lib/ivis_opengl/tex.c index 71afc3ea0..3e76dd9dc 100644 --- a/lib/ivis_opengl/tex.c +++ b/lib/ivis_opengl/tex.c @@ -32,7 +32,6 @@ #include "lib/ivis_common/tex.h" #include "lib/ivis_common/rendmode.h" #include "lib/ivis_common/piepalette.h" -#include "lib/ivis_common/ivispatch.h" #include "lib/ivis_common/png_util.h" #include "screen.h" diff --git a/lib/ivis_opengl/textdraw.c b/lib/ivis_opengl/textdraw.c index 022ed46c3..3fc4c4de1 100644 --- a/lib/ivis_opengl/textdraw.c +++ b/lib/ivis_opengl/textdraw.c @@ -29,7 +29,6 @@ #include "lib/ivis_common/pieclip.h" #include "lib/ivis_common/pieblitfunc.h" #include "lib/ivis_common/piepalette.h" -#include "lib/ivis_common/ivispatch.h" #include "lib/ivis_common/textdraw.h" #include "lib/ivis_common/bitimage.h" diff --git a/src/atmos.c b/src/atmos.c index eeea4edd4..5fe8b45db 100644 --- a/src/atmos.c +++ b/src/atmos.c @@ -352,21 +352,21 @@ void renderParticle( ATPART *psPart ) dv.x = ((UDWORD)x - player.p.x) - terrainMidX * TILE_UNITS; dv.y = (UDWORD)y; dv.z = terrainMidY * TILE_UNITS - ((UDWORD)z - player.p.z); - iV_MatrixBegin(); /* Push the indentity matrix */ - iV_TRANSLATE(dv.x,dv.y,dv.z); + pie_MatBegin(); /* Push the identity matrix */ + pie_TRANSLATE(dv.x,dv.y,dv.z); rx = map_round(player.p.x); /* Get the x,z translation components */ rz = map_round(player.p.z); - iV_TRANSLATE(rx,0,-rz); /* Translate */ + pie_TRANSLATE(rx,0,-rz); /* Translate */ /* Make it face camera */ - iV_MatrixRotateY(UNDEG(-player.r.y)); - iV_MatrixRotateX(UNDEG(-player.r.x)); + pie_MatRotY(-player.r.y); + pie_MatRotY(-player.r.x); /* Scale it... */ pie_MatScale(psPart->size / 100.f); /* Draw it... */ centreX = player.p.x + world_coord(visibleTiles.x / 2); centreZ = player.p.z + world_coord(visibleTiles.y / 2); pie_Draw3DShape(psPart->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0); - iV_MatrixEnd(); + pie_MatEnd(); } // ----------------------------------------------------------------------------- diff --git a/src/bucket3d.c b/src/bucket3d.c index 9dbfc5bb7..582236465 100644 --- a/src/bucket3d.c +++ b/src/bucket3d.c @@ -77,7 +77,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) const iIMDShape *pImd; SPACETIME spacetime; - iV_MatrixBegin(); + pie_MatBegin(); switch(objectType) { @@ -86,7 +86,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) pz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(px,0,-pz); + pie_TRANSLATE(px,0,-pz); position.x = ((ATPART*)pObject)->position.x; position.y = ((ATPART*)pObject)->position.y; @@ -129,7 +129,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) pz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(px,0,-pz); + pie_TRANSLATE(px,0,-pz); psSimpObj = (SIMPLE_OBJECT*) pObject; position.x = (psSimpObj->pos.x - player.p.x) - terrainMidX*TILE_UNITS; @@ -158,7 +158,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) pz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(px,0,-pz); + pie_TRANSLATE(px,0,-pz); psSimpObj = (SIMPLE_OBJECT*) pObject; position.x = (psSimpObj->pos.x - player.p.x) - terrainMidX*TILE_UNITS; @@ -200,7 +200,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) pz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(px,0,-pz); + pie_TRANSLATE(px,0,-pz); psSimpObj = (SIMPLE_OBJECT*) pObject; position.x = (psSimpObj->pos.x - player.p.x) - terrainMidX*TILE_UNITS; @@ -228,7 +228,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) pz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(px,0,-pz); + pie_TRANSLATE(px,0,-pz); psCompObj = (COMPONENT_OBJECT *) pObject; spacetime = interpolateObjectSpacetime((SIMPLE_OBJECT *)psCompObj->psParent, graphicsTime); @@ -242,13 +242,13 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) position.z -= psCompObj->psShape->ocen.y; /* object (animation) translations - ivis z and y flipped */ - iV_TRANSLATE( psCompObj->position.x, psCompObj->position.z, + pie_TRANSLATE( psCompObj->position.x, psCompObj->position.z, psCompObj->position.y ); /* object (animation) rotations */ - iV_MatrixRotateY(UNDEG(-psCompObj->orientation.z)); - iV_MatrixRotateZ(UNDEG(-psCompObj->orientation.y)); - iV_MatrixRotateX(UNDEG(-psCompObj->orientation.x)); + pie_MatRotY(-psCompObj->orientation.z); + pie_MatRotZ(-psCompObj->orientation.y); + pie_MatRotX(-psCompObj->orientation.x); z = pie_RotateProject(&position,&pixel); @@ -260,7 +260,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) pz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(px,0,-pz); + pie_TRANSLATE(px,0,-pz); psSimpObj = (SIMPLE_OBJECT*) pObject; position.x = (psSimpObj->pos.x - player.p.x) - terrainMidX*TILE_UNITS; @@ -293,7 +293,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) pz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(px,0,-pz); + pie_TRANSLATE(px,0,-pz); if (((PROXIMITY_DISPLAY *)pObject)->type == POS_PROXDATA) { position.x = (((VIEW_PROXIMITY *)((VIEWDATA *)((PROXIMITY_DISPLAY *) @@ -337,7 +337,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) pz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(px,0,-pz); + pie_TRANSLATE(px,0,-pz); position.x = (SDWORD)(((EFFECT*)pObject)->position.x - player.p.x) - terrainMidX*TILE_UNITS; position.z = (SDWORD)(terrainMidY*TILE_UNITS - (((EFFECT*)pObject)->position.z - player.p.z)); @@ -370,7 +370,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject) pz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(px,0,-pz); + pie_TRANSLATE(px,0,-pz); position.x = (((FLAG_POSITION *)pObject)->coords.x - player.p.x) - terrainMidX * TILE_UNITS; position.z = terrainMidY*TILE_UNITS - (((FLAG_POSITION*)pObject)-> diff --git a/src/component.c b/src/component.c index 79fd8e319..8b0ae68e7 100644 --- a/src/component.c +++ b/src/component.c @@ -74,13 +74,13 @@ static void setMatrix(Vector3i *Position, Vector3i *Rotation, BOOL RotXYZ) pie_TRANSLATE(Position->x,Position->y,Position->z); if(RotXYZ) { - pie_MatRotX(Rotation->x); - pie_MatRotY(Rotation->y); - pie_MatRotZ(Rotation->z); + pie_MatRotX(DEG(Rotation->x)); + pie_MatRotY(DEG(Rotation->y)); + pie_MatRotZ(DEG(Rotation->z)); } else { - pie_MatRotY(Rotation->y); - pie_MatRotX(Rotation->x); - pie_MatRotZ(Rotation->z); + pie_MatRotY(DEG(Rotation->y)); + pie_MatRotX(DEG(Rotation->x)); + pie_MatRotZ(DEG(Rotation->z)); } } @@ -263,21 +263,21 @@ void displayStructureButton(STRUCTURE *psStructure, Vector3i *rotation, Vector3i { Rotation rot = structureGetInterpolatedWeaponRotation(psStructure, i, graphicsTime); - iV_MatrixBegin(); - iV_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y); - pie_MatRotY(UNDEG(-rot.direction)); + pie_MatBegin(); + pie_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y); + pie_MatRotY(-rot.direction); if (mountImd[i] != NULL) { pie_Draw3DShape(mountImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0); if(mountImd[i]->nconnectors) { - iV_TRANSLATE(mountImd[i]->connectors->x,mountImd[i]->connectors->z,mountImd[i]->connectors->y); + pie_TRANSLATE(mountImd[i]->connectors->x,mountImd[i]->connectors->z,mountImd[i]->connectors->y); } } - iV_MatrixRotateX(UNDEG(rot.pitch)); + pie_MatRotX(rot.pitch); pie_Draw3DShape(weaponImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0); //we have a droid weapon so do we draw a muzzle flash - iV_MatrixEnd(); + pie_MatEnd(); } } } @@ -367,19 +367,19 @@ void displayStructureStatButton(STRUCTURE_STATS *Stats, Vector3i *Rotation, Vect { for (i = 0; i < MAX(1, Stats->numWeaps); i++) { - iV_MatrixBegin(); - iV_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y); + pie_MatBegin(); + pie_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y); if (mountImd[i] != NULL) { pie_Draw3DShape(mountImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0); if(mountImd[i]->nconnectors) { - iV_TRANSLATE(mountImd[i]->connectors->x,mountImd[i]->connectors->z,mountImd[i]->connectors->y); + pie_TRANSLATE(mountImd[i]->connectors->x,mountImd[i]->connectors->z,mountImd[i]->connectors->y); } } pie_Draw3DShape(weaponImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0); //we have a droid weapon so do we draw a muzzle flash - iV_MatrixEnd(); + pie_MatEnd(); } } } @@ -715,12 +715,12 @@ static void displayCompObj(DROID *psDroid, BOOL bButton) psShapeTemp->connectors[iConnector + i].y ); } - pie_MatRotY(UNDEG(-rot.direction)); + pie_MatRotY(-rot.direction); /* vtol weapons inverted */ if ( iConnector >= VTOL_CONNECTOR_START ) { - pie_MatRotZ(180.f);//this might affect gun rotation + pie_MatRotZ(65536/2); //this might affect gun rotation } /* Get the mount graphic */ @@ -746,12 +746,12 @@ static void displayCompObj(DROID *psDroid, BOOL bButton) if ( iConnector >= VTOL_CONNECTOR_START ) { //pitch the barrel down - pie_MatRotX(UNDEG(-rot.pitch)); + pie_MatRotX(-rot.pitch); } else { //pitch the barrel up - pie_MatRotX(UNDEG(rot.pitch)); + pie_MatRotX(rot.pitch); } /* Get the weapon (gun?) graphic */ @@ -856,14 +856,14 @@ static void displayCompObj(DROID *psDroid, BOOL bButton) /* vtol weapons inverted */ if ( iConnector >= VTOL_CONNECTOR_START ) { - pie_MatRotZ(180.f);//this might affect gun rotation + pie_MatRotZ(65536/2); //this might affect gun rotation } pie_TRANSLATE( psShapeTemp->connectors[0].x, psShapeTemp->connectors[0].z, psShapeTemp->connectors[0].y ); - pie_MatRotY(UNDEG(-rot.direction)); + pie_MatRotY(-rot.direction); /* Draw it */ if (psMountShape) { @@ -898,21 +898,21 @@ static void displayCompObj(DROID *psDroid, BOOL bButton) psShape = getImdFromIndex(MI_FLAME); /* Rotate for droid */ - pie_MatRotY(UNDEG(st.rot.direction)); - pie_MatRotX(UNDEG(-st.rot.pitch)); - pie_MatRotZ(UNDEG(-st.rot.roll)); + pie_MatRotY(st.rot.direction); + pie_MatRotX(-st.rot.pitch); + pie_MatRotZ(-st.rot.roll); //rotate Y - pie_MatRotY(UNDEG(rot.direction)); + pie_MatRotY(rot.direction); - iV_MatrixRotateY(UNDEG(-player.r.y)); - iV_MatrixRotateX(UNDEG(-player.r.x)); + pie_MatRotY(-player.r.y); + pie_MatRotX(-player.r.x); /* Dither on software */ pie_Draw3DShape(psShape, getModularScaledGraphicsTime(100, psShape->numFrames), 0, brightness, WZCOL_BLACK, pie_ADDITIVE, 140); /* Dither off software */ - iV_MatrixRotateX(UNDEG(player.r.x)); - iV_MatrixRotateY(UNDEG(player.r.y)); + pie_MatRotX(player.r.x); + pie_MatRotY(player.r.y); } } /* Pop Matrix */ @@ -1062,9 +1062,9 @@ void displayComponentObject(DROID *psDroid) pie_TRANSLATE(position.x,position.y,position.z); /* Rotate for droid */ - pie_MatRotY(UNDEG(rotation.y)); - pie_MatRotX(UNDEG(rotation.x)); - pie_MatRotZ(UNDEG(rotation.z)); + pie_MatRotY(rotation.y); + pie_MatRotX(rotation.x); + pie_MatRotZ(rotation.z); if( (gameTime-psDroid->timeLastHit < GAME_TICKS_PER_SEC) && psDroid->lastHitWeapon == WSC_ELECTRONIC) { diff --git a/src/display3d.c b/src/display3d.c index 742ff6f45..452eba5c3 100644 --- a/src/display3d.c +++ b/src/display3d.c @@ -858,9 +858,9 @@ static void drawTiles(iView *player) pie_MATTRANS(0, 0, distance); /* Rotate for the player */ - pie_MatRotZ(UNDEG(player->r.z)); - pie_MatRotX(UNDEG(player->r.x)); - pie_MatRotY(UNDEG(player->r.y)); + pie_MatRotZ(player->r.z); + pie_MatRotX(player->r.x); + pie_MatRotY(player->r.y); /* Translate */ pie_TRANSLATE(-rx, -player->p.y, rz); @@ -985,7 +985,7 @@ static void drawTiles(iView *player) } /* Clear the matrix stack */ - iV_MatrixEnd(); + pie_MatEnd(); locateMouse(); } @@ -1197,24 +1197,24 @@ void renderProjectile(PROJECTILE *psCurr) /* What's the present height of the bullet? */ dv.y = st.pos.z; /* Set up the matrix */ - iV_MatrixBegin(); + pie_MatBegin(); /* Translate to the correct position */ - iV_TRANSLATE(dv.x,dv.y,dv.z); + pie_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); rz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(rx,0,-rz); + pie_TRANSLATE(rx,0,-rz); /* Rotate it to the direction it's facing */ imdRot2.y = st.rot.direction; - iV_MatrixRotateY(UNDEG(-imdRot2.y)); + pie_MatRotY(-imdRot2.y); /* pitch it */ imdRot2.x = st.rot.pitch; - iV_MatrixRotateX(UNDEG(imdRot2.x)); + pie_MatRotX(imdRot2.x); if (psStats->weaponSubClass == WSC_ROCKET || psStats->weaponSubClass == WSC_MISSILE || psStats->weaponSubClass == WSC_SLOWROCKET || psStats->weaponSubClass == WSC_SLOWMISSILE) @@ -1226,7 +1226,7 @@ void renderProjectile(PROJECTILE *psCurr) pie_Draw3DShape(pIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0); } - iV_MatrixEnd(); + pie_MatEnd(); } /* Flush matrices */ } @@ -1264,23 +1264,23 @@ void renderAnimComponent( const COMPONENT_OBJECT *psObj ) psParentObj->sDisplay.frameNumber = currentGameFrame; /* Push the indentity matrix */ - iV_MatrixBegin(); + pie_MatBegin(); /* parent object translation */ - iV_TRANSLATE(dv.x, dv.y, dv.z); + pie_TRANSLATE(dv.x, dv.y, dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); rz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(rx, 0, -rz); + pie_TRANSLATE(rx, 0, -rz); /* parent object rotations */ imdRot2.y = spacetime.rot.direction; - iV_MatrixRotateY(UNDEG(-imdRot2.y)); + pie_MatRotY(-imdRot2.y); imdRot2.x = spacetime.rot.pitch; - iV_MatrixRotateX(UNDEG(imdRot2.x)); + pie_MatRotX(imdRot2.x); /* Set frame numbers - look into this later?? FIXME!!!!!!!! */ if( psParentObj->type == OBJ_DROID ) @@ -1328,16 +1328,16 @@ void renderAnimComponent( const COMPONENT_OBJECT *psObj ) // Do translation and rotation after setting sDisplay.screen[XY], so that the health bars for animated objects (such as oil derricks and cyborgs) will show on the stationary part. // object (animation) translations - ivis z and y flipped - iV_TRANSLATE(psObj->position.x, psObj->position.z, psObj->position.y); + pie_TRANSLATE(psObj->position.x, psObj->position.z, psObj->position.y); // object (animation) rotations - iV_MatrixRotateY(UNDEG(-psObj->orientation.z)); - iV_MatrixRotateZ(UNDEG(-psObj->orientation.y)); - iV_MatrixRotateX(UNDEG(-psObj->orientation.x)); + pie_MatRotY(-psObj->orientation.z); + pie_MatRotZ(-psObj->orientation.y); + pie_MatRotX(-psObj->orientation.x); pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, WZCOL_BLACK, pie_STATIC_SHADOW, 0); /* clear stack */ - iV_MatrixEnd(); + pie_MatEnd(); } } @@ -1882,21 +1882,21 @@ void renderFeature(FEATURE *psFeature) ); /* Push the indentity matrix */ - iV_MatrixBegin(); + pie_MatBegin(); /* 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 */ - iV_TRANSLATE(dv.x,dv.y,dv.z); + pie_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); rz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(rx,0,-rz); + pie_TRANSLATE(rx,0,-rz); rotation = psFeature->rot.direction; - iV_MatrixRotateY(UNDEG(-rotation)); + pie_MatRotY(-rotation); brightness = pal_SetBrightness(200); //? HUH? @@ -1950,7 +1950,7 @@ void renderFeature(FEATURE *psFeature) psFeature->sDisplay.screenY = s.y; } - iV_MatrixEnd(); + pie_MatEnd(); } /// @@ -2002,16 +2002,16 @@ void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp) dv.z = terrainMidY*TILE_UNITS - (msgY - player.p.z); /* Push the indentity matrix */ - iV_MatrixBegin(); + pie_MatBegin(); /* Translate the message */ - iV_TRANSLATE(dv.x,dv.y,dv.z); + pie_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); rz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(rx,0,-rz); + pie_TRANSLATE(rx,0,-rz); //get the appropriate IMD if (pViewProximity) { @@ -2050,8 +2050,8 @@ void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp) } } - iV_MatrixRotateY(UNDEG(-player.r.y)); - iV_MatrixRotateX(UNDEG(-player.r.x)); + pie_MatRotY(-player.r.y); + pie_MatRotX(-player.r.x); pie_Draw3DShape(proxImd, getModularScaledGraphicsTime(1000, 4), 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, 192); @@ -2061,7 +2061,7 @@ void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp) psProxDisp->screenY = y; psProxDisp->screenR = r; - iV_MatrixEnd(); + pie_MatEnd(); } static PIELIGHT getBlueprintColour(STRUCT_STATES state) @@ -2159,24 +2159,24 @@ void renderStructure(STRUCTURE *psStructure) dv.y = map_TileHeight(map_coord(structX), map_coord(structY)); } /* Push the indentity matrix */ - iV_MatrixBegin(); + pie_MatBegin(); /* 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 */ - iV_TRANSLATE(dv.x,dv.y,dv.z); + pie_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); rz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(rx, 0, -rz); + pie_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! */ rotation = psStructure->rot.direction; - iV_MatrixRotateY(UNDEG(-rotation)); + pie_MatRotY(-rotation); if (!defensive && gameTime2-psStructure->timeLastHit < ELEC_DAMAGE_DURATION && psStructure->lastHitWeapon == WSC_ELECTRONIC ) @@ -2313,9 +2313,9 @@ void renderStructure(STRUCTURE *psStructure) if (weaponImd[i] != NULL) { - iV_MatrixBegin(); - iV_TRANSLATE(strImd->connectors[i].x, strImd->connectors[i].z, strImd->connectors[i].y); - pie_MatRotY(UNDEG(-rot.direction)); + pie_MatBegin(); + pie_TRANSLATE(strImd->connectors[i].x, strImd->connectors[i].z, strImd->connectors[i].y); + pie_MatRotY(-rot.direction); if (mountImd[i] != NULL) { pie_TRANSLATE(0, 0, psStructure->asWeaps[i].recoilValue / 3); @@ -2323,10 +2323,10 @@ void renderStructure(STRUCTURE *psStructure) pie_Draw3DShape(mountImd[i], animFrame, colour, buildingBrightness, WZCOL_BLACK, pieFlag, pieFlagData); if(mountImd[i]->nconnectors) { - iV_TRANSLATE(mountImd[i]->connectors->x, mountImd[i]->connectors->z, mountImd[i]->connectors->y); + pie_TRANSLATE(mountImd[i]->connectors->x, mountImd[i]->connectors->z, mountImd[i]->connectors->y); } } - iV_MatrixRotateX(UNDEG(rot.pitch)); + pie_MatRotX(rot.pitch); pie_TRANSLATE(0, 0, psStructure->asWeaps[i].recoilValue); pie_Draw3DShape(weaponImd[i], 0, colour, buildingBrightness, WZCOL_BLACK, pieFlag, pieFlagData); @@ -2347,18 +2347,18 @@ void renderStructure(STRUCTURE *psStructure) { iIMDShape *pRepImd; - iV_TRANSLATE(weaponImd[i]->connectors->x,weaponImd[i]->connectors->z-12,weaponImd[i]->connectors->y); + pie_TRANSLATE(weaponImd[i]->connectors->x,weaponImd[i]->connectors->z-12,weaponImd[i]->connectors->y); pRepImd = getImdFromIndex(MI_FLAME); - pie_MatRotY(UNDEG(rot.direction)); + pie_MatRotY(rot.direction); - iV_MatrixRotateY(UNDEG(-player.r.y)); - iV_MatrixRotateX(UNDEG(-player.r.x)); + pie_MatRotY(-player.r.y); + pie_MatRotX(-player.r.x); pie_Draw3DShape(pRepImd, getModularScaledGraphicsTime(100, pRepImd->numFrames), colour, buildingBrightness, WZCOL_BLACK, pie_ADDITIVE, 192); - iV_MatrixRotateX(UNDEG(player.r.x)); - iV_MatrixRotateY(UNDEG(player.r.y)); - pie_MatRotY(UNDEG(rot.direction)); + pie_MatRotX(player.r.x); + pie_MatRotY(player.r.y); + pie_MatRotY(rot.direction); } } } @@ -2399,7 +2399,7 @@ void renderStructure(STRUCTURE *psStructure) } } } - iV_MatrixEnd(); + pie_MatEnd(); } // no IMD, its a baba machine gun, bunker, etc. else if (psStructure->asWeaps[i].nStat > 0) @@ -2415,21 +2415,21 @@ void renderStructure(STRUCTURE *psStructure) // draw Weapon/ECM/Sensor for structure if (flashImd[i] != NULL) { - iV_MatrixBegin(); + pie_MatBegin(); // horrendous hack if (strImd->max.y > 80) // babatower { - iV_TRANSLATE(0, 80, 0); - pie_MatRotY(UNDEG(-rot.direction)); - iV_TRANSLATE(0, 0, -20); + pie_TRANSLATE(0, 80, 0); + pie_MatRotY(-rot.direction); + pie_TRANSLATE(0, 0, -20); } else//baba bunker { - iV_TRANSLATE(0, 10, 0); - pie_MatRotY(UNDEG(-rot.direction)); - iV_TRANSLATE(0, 0, -40); + pie_TRANSLATE(0, 10, 0); + pie_MatRotY(-rot.direction); + pie_TRANSLATE(0, 0, -40); } - pie_MatRotX(UNDEG(rot.pitch)); + pie_MatRotX(rot.pitch); // draw the muzzle flash? if (psStructure && psStructure->visible[selectedPlayer] > UBYTE_MAX / 2) { @@ -2452,7 +2452,7 @@ void renderStructure(STRUCTURE *psStructure) } } } - iV_MatrixEnd(); + pie_MatEnd(); } } } @@ -2463,12 +2463,12 @@ void renderStructure(STRUCTURE *psStructure) { iIMDShape *lImd; - iV_MatrixBegin(); - iV_TRANSLATE(psStructure->sDisplay.imd->connectors->x, psStructure->sDisplay.imd->connectors->z, + pie_MatBegin(); + pie_TRANSLATE(psStructure->sDisplay.imd->connectors->x, psStructure->sDisplay.imd->connectors->z, psStructure->sDisplay.imd->connectors->y); lImd = getImdFromIndex(MI_LANDING); pie_Draw3DShape(lImd, getModularScaledGraphicsTime(1024, lImd->numFrames), colour, buildingBrightness, WZCOL_BLACK, 0, 0); - iV_MatrixEnd(); + pie_MatEnd(); } } } @@ -2484,7 +2484,7 @@ void renderStructure(STRUCTURE *psStructure) psStructure->sDisplay.screenY = s.y; } - iV_MatrixEnd(); + pie_MatEnd(); } /// draw the delivery points @@ -2503,16 +2503,16 @@ void renderDeliveryPoint(FLAG_POSITION *psPosition, BOOL blueprint) dv.y = psPosition->coords.z; /* Push the indentity matrix */ - iV_MatrixBegin(); + pie_MatBegin(); - iV_TRANSLATE(dv.x,dv.y,dv.z); + pie_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); rz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(rx,0,-rz); + pie_TRANSLATE(rx,0,-rz); //quick check for invalid data ASSERT( psPosition->factoryType < NUM_FLAG_TYPES && psPosition->factoryInc < MAX_FACTORY, "Invalid assembly point" ); @@ -2552,7 +2552,7 @@ void renderDeliveryPoint(FLAG_POSITION *psPosition, BOOL blueprint) psPosition->screenY = y; psPosition->screenR = r; - iV_MatrixEnd(); + pie_MatEnd(); } /// Draw a piece of wall @@ -2620,20 +2620,20 @@ static BOOL renderWallSection(STRUCTURE *psStructure) } /* Push the indentity matrix */ - iV_MatrixBegin(); + pie_MatBegin(); /* Translate */ - iV_TRANSLATE(dv.x,dv.y,dv.z); + pie_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); rz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(rx, 0, -rz); + pie_TRANSLATE(rx, 0, -rz); rotation = psStructure->rot.direction; - iV_MatrixRotateY(UNDEG(-rotation)); + pie_MatRotY(-rotation); if(imd != NULL) { @@ -2692,7 +2692,7 @@ static BOOL renderWallSection(STRUCTURE *psStructure) psStructure->sDisplay.screenY = s.y; } - iV_MatrixEnd(); + pie_MatEnd(); return(true); } @@ -2715,20 +2715,20 @@ void renderShadow( DROID *psDroid, iIMDShape *psShadowIMD ) dv.y = map_Height(psDroid->pos.x, psDroid->pos.y); /* Push the indentity matrix */ - iV_MatrixBegin(); + pie_MatBegin(); - iV_TRANSLATE(dv.x,dv.y,dv.z); + pie_TRANSLATE(dv.x,dv.y,dv.z); /* Get the x,z translation components */ rx = player.p.x & (TILE_UNITS-1); rz = player.p.z & (TILE_UNITS-1); /* Translate */ - iV_TRANSLATE(rx,0,-rz); + pie_TRANSLATE(rx,0,-rz); if(psDroid->droidType == DROID_TRANSPORTER) { - iV_MatrixRotateY(UNDEG(-psDroid->rot.direction)); + pie_MatRotY(-psDroid->rot.direction); } pVecTemp = psShadowIMD->points; @@ -2740,15 +2740,15 @@ void renderShadow( DROID *psDroid, iIMDShape *psShadowIMD ) } else { - pie_MatRotY(UNDEG(-psDroid->rot.direction)); - pie_MatRotX(UNDEG(psDroid->rot.pitch)); - pie_MatRotZ(UNDEG(psDroid->rot.roll)); + pie_MatRotY(-psDroid->rot.direction); + pie_MatRotX(psDroid->rot.pitch); + pie_MatRotZ(psDroid->rot.roll); } pie_Draw3DShape(psShadowIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, 128); psShadowIMD->points = pVecTemp; - iV_MatrixEnd(); + pie_MatEnd(); } /// Draw all pieces of a droid and register it as a target @@ -3700,7 +3700,7 @@ static void renderSurroundings(void) pie_MATTRANS(0, 0, distance); // rotate it - pie_MatRotY(wind); + pie_MatRotY(DEG(wind)); // move it somewhat below ground level for the blending effect pie_TRANSLATE(0, -skybox_scale/8, 0); diff --git a/src/droid.c b/src/droid.c index c948db9db..84c21fe1d 100644 --- a/src/droid.c +++ b/src/droid.c @@ -3069,14 +3069,14 @@ BOOL calcDroidMuzzleLocation(DROID *psDroid, Vector3f *muzzle, int weapon_slot) pie_TRANSLATE(psDroid->pos.x, -psDroid->pos.z, psDroid->pos.y); //matrix = the center of droid - pie_MatRotY(UNDEG(psDroid->rot.direction)); - pie_MatRotX(UNDEG(psDroid->rot.pitch)); - pie_MatRotZ(UNDEG(-psDroid->rot.roll)); + pie_MatRotY(psDroid->rot.direction); + pie_MatRotX(psDroid->rot.pitch); + pie_MatRotZ(-psDroid->rot.roll); pie_TRANSLATE(psBodyImd->connectors[weapon_slot].x, -psBodyImd->connectors[weapon_slot].z, -psBodyImd->connectors[weapon_slot].y);//note y and z flipped //matrix = the weapon[slot] mount on the body - pie_MatRotY(UNDEG(psDroid->asWeaps[weapon_slot].rot.direction)); // +ve anticlockwise + pie_MatRotY(psDroid->asWeaps[weapon_slot].rot.direction); // +ve anticlockwise // process turret mount if (psMountImd && psMountImd->nconnectors) @@ -3085,7 +3085,7 @@ BOOL calcDroidMuzzleLocation(DROID *psDroid, Vector3f *muzzle, int weapon_slot) } //matrix = the turret connector for the gun - pie_MatRotX(UNDEG(psDroid->asWeaps[weapon_slot].rot.pitch)); // +ve up + pie_MatRotX(psDroid->asWeaps[weapon_slot].rot.pitch); // +ve up //process the gun if (psWeaponImd && psWeaponImd->nconnectors) diff --git a/src/effects.c b/src/effects.c index 714e2a8bf..f06ef0e23 100644 --- a/src/effects.c +++ b/src/effects.c @@ -439,17 +439,17 @@ static void positionEffect(const EFFECT *psEffect) }; /* Push the indentity matrix */ - iV_MatrixBegin(); + pie_MatBegin(); /* Move to position */ - iV_TRANSLATE(dv.x, dv.y, dv.z); + pie_TRANSLATE(dv.x, dv.y, dv.z); /* Get the x,z translation components */ rx = map_round(player.p.x); rz = map_round(player.p.z); /* Move to camera reference */ - iV_TRANSLATE(rx, 0, -rz); + pie_TRANSLATE(rx, 0, -rz); } static void killEffect(EFFECT *e) @@ -1613,7 +1613,7 @@ static void renderWaypointEffect(const EFFECT *psEffect) positionEffect(psEffect); pie_Draw3DShape(psEffect->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0); - iV_MatrixEnd(); + pie_MatEnd(); } static void renderFirework(const EFFECT *psEffect) @@ -1626,12 +1626,12 @@ static void renderFirework(const EFFECT *psEffect) positionEffect(psEffect); - iV_MatrixRotateY(UNDEG(-player.r.y)); - iV_MatrixRotateX(UNDEG(-player.r.x)); + pie_MatRotY(-player.r.y); + pie_MatRotX(-player.r.x); pie_MatScale(psEffect->size / 100.f); pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, EFFECT_EXPLOSION_ADDITIVE); - iV_MatrixEnd(); + pie_MatEnd(); } /** drawing func for blood. */ @@ -1639,12 +1639,12 @@ static void renderBloodEffect(const EFFECT *psEffect) { positionEffect(psEffect); - iV_MatrixRotateY(UNDEG(-player.r.y)); - iV_MatrixRotateX(UNDEG(-player.r.x)); + pie_MatRotY(-player.r.y); + pie_MatRotX(-player.r.x); pie_MatScale(psEffect->size / 100.f); pie_Draw3DShape(getImdFromIndex(MI_BLOOD), psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, EFFECT_BLOOD_TRANSPARENCY); - iV_MatrixEnd(); + pie_MatEnd(); } static void renderDestructionEffect(const EFFECT *psEffect) @@ -1668,13 +1668,13 @@ static void renderDestructionEffect(const EFFECT *psEffect) if(!gamePaused()) { - iV_MatrixRotateX(UNDEG(SKY_SHIMMY)); - iV_MatrixRotateY(UNDEG(SKY_SHIMMY)); - iV_MatrixRotateZ(UNDEG(SKY_SHIMMY)); + pie_MatRotX(SKY_SHIMMY); + pie_MatRotY(SKY_SHIMMY); + pie_MatRotZ(SKY_SHIMMY); } pie_Draw3DShape(psEffect->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_RAISE, percent); - iV_MatrixEnd(); + pie_MatEnd(); } static bool rejectLandLight(LAND_LIGHT_SPEC type) @@ -1722,8 +1722,8 @@ static void renderExplosionEffect(const EFFECT *psEffect) if(TEST_FACING(psEffect)) { /* Always face the viewer! */ -/* TEST_FLIPPED_Y(psEffect) ? iV_MatrixRotateY(UNDEG(-player.r.y+iV_DEG(180))) :*/ iV_MatrixRotateY(UNDEG(-player.r.y)); -/* TEST_FLIPPED_X(psEffect) ? iV_MatrixRotateX(UNDEG(-player.r.x+iV_DEG(180))) :*/ iV_MatrixRotateX(UNDEG(-player.r.x)); + pie_MatRotY(-player.r.y); + pie_MatRotX(-player.r.x); } /* Tesla explosions diminish in size */ @@ -1759,7 +1759,7 @@ static void renderExplosionEffect(const EFFECT *psEffect) pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, brightness, WZCOL_BLACK, pie_ADDITIVE, EFFECT_EXPLOSION_ADDITIVE); } - iV_MatrixEnd(); + pie_MatEnd(); } static void renderGravitonEffect(const EFFECT *psEffect) @@ -1767,9 +1767,9 @@ static void renderGravitonEffect(const EFFECT *psEffect) positionEffect(psEffect); - iV_MatrixRotateX(UNDEG(psEffect->rotation.x)); - iV_MatrixRotateY(UNDEG(psEffect->rotation.y)); - iV_MatrixRotateZ(UNDEG(psEffect->rotation.z)); + pie_MatRotX(psEffect->rotation.x); + pie_MatRotY(psEffect->rotation.y); + pie_MatRotZ(psEffect->rotation.z); /* Buildings emitted by gravitons are chunkier */ if(psEffect->type == GRAVITON_TYPE_EMITTING_ST) @@ -1781,7 +1781,7 @@ static void renderGravitonEffect(const EFFECT *psEffect) pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0); /* Pop the matrix */ - iV_MatrixEnd(); + pie_MatEnd(); } /** Renders the standard construction effect */ @@ -1800,8 +1800,8 @@ static void renderConstructionEffect(const EFFECT *psEffect) /* Bit in comments doesn't quite work yet? */ if(TEST_FACING(psEffect)) { -/* TEST_FLIPPED_Y(psEffect) ? iV_MatrixRotateY(UNDEG(-player.r.y+iV_DEG(180))) :*/ iV_MatrixRotateY(UNDEG(-player.r.y)); -/* TEST_FLIPPED_X(psEffect) ? iV_MatrixRotateX(UNDEG(-player.r.x+iV_DEG(180))) :*/ iV_MatrixRotateX(UNDEG(-player.r.x)); + pie_MatRotY(-player.r.y); + pie_MatRotX(-player.r.x); } /* Scale size according to age */ @@ -1825,7 +1825,7 @@ static void renderConstructionEffect(const EFFECT *psEffect) pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, (UBYTE)(translucency)); /* Pop the matrix */ - iV_MatrixEnd(); + pie_MatEnd(); } /** Renders the standard smoke effect - it is now scaled in real-time as well */ @@ -1841,8 +1841,8 @@ static void renderSmokeEffect(const EFFECT *psEffect) if(TEST_FACING(psEffect)) { /* Always face the viewer! */ -/* TEST_FLIPPED_Y(psEffect) ? iV_MatrixRotateY(UNDEG(-player.r.y+iV_DEG(180))) : */iV_MatrixRotateY(UNDEG(-player.r.y)); -/* TEST_FLIPPED_X(psEffect) ? iV_MatrixRotateX(UNDEG(-player.r.x+iV_DEG(180))) : */iV_MatrixRotateX(UNDEG(-player.r.x)); + pie_MatRotY(-player.r.y); + pie_MatRotX(-player.r.x); } /* Small smoke - used for the droids */ @@ -1893,7 +1893,7 @@ static void renderSmokeEffect(const EFFECT *psEffect) } /* Pop the matrix */ - iV_MatrixEnd(); + pie_MatEnd(); } diff --git a/src/mapdisplay.c b/src/mapdisplay.c index 97c0bbeab..45ddef8a6 100644 --- a/src/mapdisplay.c +++ b/src/mapdisplay.c @@ -55,7 +55,7 @@ void renderResearchToBuffer(RESEARCH *psResearch, pie_SetGeometricOffset(OriginX+10,OriginY+10); // Pitch down a bit - //pie_MatRotX(-30); + //pie_MatRotX(-65536/12); // Rotate round // full rotation once every 2 seconds.. diff --git a/src/projectile.c b/src/projectile.c index 05c58cca5..324bccd82 100644 --- a/src/projectile.c +++ b/src/projectile.c @@ -1860,12 +1860,12 @@ void objectShimmy(BASE_OBJECT *psObj) { if(justBeenHitByEW(psObj)) { - iV_MatrixRotateX(UNDEG(SKY_SHIMMY)); - iV_MatrixRotateY(UNDEG(SKY_SHIMMY)); - iV_MatrixRotateZ(UNDEG(SKY_SHIMMY)); + pie_MatRotX(SKY_SHIMMY); + pie_MatRotY(SKY_SHIMMY); + pie_MatRotZ(SKY_SHIMMY); if(psObj->type == OBJ_DROID) { - iV_TRANSLATE(1-rand()%3,0,1-rand()%3); + pie_TRANSLATE(1-rand()%3,0,1-rand()%3); } } } diff --git a/src/radar.c b/src/radar.c index d17a12392..19f4020ec 100644 --- a/src/radar.c +++ b/src/radar.c @@ -292,7 +292,7 @@ void drawRadar(void) if (rotateRadar) { // rotate the map - iV_MatrixRotateZ(UNDEG(player.r.y)); + pie_MatRotZ(player.r.y); DrawNorth(); } // draw the box at the dimensions of the map diff --git a/src/structure.c b/src/structure.c index 41a8bcc7c..daf9022bc 100644 --- a/src/structure.c +++ b/src/structure.c @@ -5632,14 +5632,14 @@ BOOL calcStructureMuzzleLocation(STRUCTURE *psStructure, Vector3f *muzzle, int w pie_TRANSLATE(psStructure->pos.x, -psStructure->pos.z, psStructure->pos.y); //matrix = the center of droid - pie_MatRotY(UNDEG(psStructure->rot.direction)); - pie_MatRotX(UNDEG(psStructure->rot.pitch)); - pie_MatRotZ(UNDEG(-psStructure->rot.roll)); + pie_MatRotY(psStructure->rot.direction); + pie_MatRotX(psStructure->rot.pitch); + pie_MatRotZ(-psStructure->rot.roll); pie_TRANSLATE( psShape->connectors[weapon_slot].x, -psShape->connectors[weapon_slot].z, -psShape->connectors[weapon_slot].y);//note y and z flipped //matrix = the weapon[slot] mount on the body - pie_MatRotY(UNDEG(psStructure->asWeaps[weapon_slot].rot.direction)); // +ve anticlockwise + pie_MatRotY(psStructure->asWeaps[weapon_slot].rot.direction); // +ve anticlockwise // process turret mount if (psMountImd && psMountImd->nconnectors) @@ -5648,7 +5648,7 @@ BOOL calcStructureMuzzleLocation(STRUCTURE *psStructure, Vector3f *muzzle, int w } //matrix = the turret connector for the gun - pie_MatRotX(UNDEG(psStructure->asWeaps[weapon_slot].rot.pitch)); // +ve up + pie_MatRotX(psStructure->asWeaps[weapon_slot].rot.pitch); // +ve up //process the gun if (psWeaponImd && psWeaponImd->nconnectors)