master
dak180 2010-10-08 19:36:10 -04:00
commit a11af2d203
22 changed files with 215 additions and 245 deletions

17
fixcppbuild Executable file
View File

@ -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

View File

@ -8,7 +8,6 @@ noinst_HEADERS = \
imd.h \ imd.h \
ivi.h \ ivi.h \
ivisdef.h \ ivisdef.h \
ivispatch.h \
jpeg_encoder.h \ jpeg_encoder.h \
pieblitfunc.h \ pieblitfunc.h \
pieclip.h \ pieclip.h \

View File

@ -20,7 +20,7 @@
#include "imd.h" #include "imd.h"
#include "ivisdef.h" #include "ivisdef.h"
#include "tex.h" #include "tex.h"
#include "ivispatch.h" #include "pietypes.h"
//************************************************************************* //*************************************************************************
//*** free IMD shape memory //*** free IMD shape memory

View File

@ -33,7 +33,6 @@
#include "ivisdef.h" // for imd structures #include "ivisdef.h" // for imd structures
#include "imd.h" // for imd structures #include "imd.h" // for imd structures
#include "rendmode.h" #include "rendmode.h"
#include "ivispatch.h"
#include "tex.h" // texture page loading #include "tex.h" // texture page loading
static BOOL AtEndOfFile(const char *CurPos, const char *EndOfFile) static BOOL AtEndOfFile(const char *CurPos, const char *EndOfFile)

View File

@ -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

View File

@ -34,7 +34,7 @@
#include "lib/framework/frame.h" #include "lib/framework/frame.h"
#include "lib/framework/vector.h" #include "lib/framework/vector.h"
#include "ivisdef.h" #include "ivisdef.h"
#include "ivispatch.h" #include "pietypes.h"
/***************************************************************************/ /***************************************************************************/
/* /*

View File

@ -28,3 +28,10 @@ endif
libivis_opengl_a_LIBADD = $(top_builddir)/lib/ivis_common/libivis_common.a \ libivis_opengl_a_LIBADD = $(top_builddir)/lib/ivis_common/libivis_common.a \
$(top_builddir)/lib/framework/libframework.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

View File

@ -180,7 +180,7 @@ void pie_MatScale(float scale)
//* //*
//****** //******
void pie_MatRotY(float y) void pie_MatRotY(uint16_t y)
{ {
/* /*
* a := angle * a := angle
@ -194,10 +194,10 @@ void pie_MatRotY(float y)
* curMatrix = curMatrix . [ -s 0 c 0 ] * curMatrix = curMatrix . [ -s 0 c 0 ]
* [ 0 0 0 1 ] * [ 0 0 0 1 ]
*/ */
if (y != 0.f) if (y != 0)
{ {
int t; 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; t = (cra*psMatrix->a - sra*psMatrix->g)>>16;
psMatrix->g = (sra*psMatrix->a + cra*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->i = (sra*psMatrix->c + cra*psMatrix->i)>>16;
psMatrix->c = t; 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 * a := angle
@ -235,10 +235,10 @@ void pie_MatRotZ(float z)
* curMatrix = curMatrix . [ 0 0 1 0 ] * curMatrix = curMatrix . [ 0 0 1 0 ]
* [ 0 0 0 1 ] * [ 0 0 0 1 ]
*/ */
if (z != 0.f) if (z != 0)
{ {
int t; 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; t = (cra*psMatrix->a + sra*psMatrix->d)>>16;
psMatrix->d = (cra*psMatrix->d - sra*psMatrix->a)>>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->f = (cra*psMatrix->f - sra*psMatrix->c)>>16;
psMatrix->c = t; 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 * a := angle
@ -279,7 +279,7 @@ void pie_MatRotX(float x)
if (x != 0.f) if (x != 0.f)
{ {
int t; 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; t = (cra*psMatrix->d + sra*psMatrix->g)>>16;
psMatrix->g = (cra*psMatrix->g - sra*psMatrix->d)>>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->i = (cra*psMatrix->i - sra*psMatrix->f)>>16;
psMatrix->f = t; psMatrix->f = t;
glRotatef(x, 1.0f, 0.0f, 0.0f); glRotatef(UNDEG(x), 1.0f, 0.0f, 0.0f);
} }
} }

View File

@ -91,9 +91,9 @@ extern void pie_MatEnd(void);
extern void pie_MATTRANS(float x, float y, float z); extern void pie_MATTRANS(float x, float y, float z);
extern void pie_TRANSLATE(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_MatScale(float scale);
extern void pie_MatRotX(float x); extern void pie_MatRotX(uint16_t x);
extern void pie_MatRotY(float y); extern void pie_MatRotY(uint16_t y);
extern void pie_MatRotZ(float z); extern void pie_MatRotZ(uint16_t z);
extern int32_t pie_RotateProject(const Vector3i *src, Vector2i *dest); extern int32_t pie_RotateProject(const Vector3i *src, Vector2i *dest);
//************************************************************************* //*************************************************************************

View File

@ -22,7 +22,6 @@
#include "lib/ivis_common/textdraw.h" #include "lib/ivis_common/textdraw.h"
#include "lib/ivis_common/piepalette.h" #include "lib/ivis_common/piepalette.h"
#include "lib/ivis_common/piestate.h" #include "lib/ivis_common/piestate.h"
#include "lib/ivis_common/ivispatch.h"
//************************************************************************* //*************************************************************************

View File

@ -32,7 +32,6 @@
#include "lib/ivis_common/tex.h" #include "lib/ivis_common/tex.h"
#include "lib/ivis_common/rendmode.h" #include "lib/ivis_common/rendmode.h"
#include "lib/ivis_common/piepalette.h" #include "lib/ivis_common/piepalette.h"
#include "lib/ivis_common/ivispatch.h"
#include "lib/ivis_common/png_util.h" #include "lib/ivis_common/png_util.h"
#include "screen.h" #include "screen.h"

View File

@ -29,7 +29,6 @@
#include "lib/ivis_common/pieclip.h" #include "lib/ivis_common/pieclip.h"
#include "lib/ivis_common/pieblitfunc.h" #include "lib/ivis_common/pieblitfunc.h"
#include "lib/ivis_common/piepalette.h" #include "lib/ivis_common/piepalette.h"
#include "lib/ivis_common/ivispatch.h"
#include "lib/ivis_common/textdraw.h" #include "lib/ivis_common/textdraw.h"
#include "lib/ivis_common/bitimage.h" #include "lib/ivis_common/bitimage.h"

View File

@ -352,21 +352,21 @@ void renderParticle( ATPART *psPart )
dv.x = ((UDWORD)x - player.p.x) - terrainMidX * TILE_UNITS; dv.x = ((UDWORD)x - player.p.x) - terrainMidX * TILE_UNITS;
dv.y = (UDWORD)y; dv.y = (UDWORD)y;
dv.z = terrainMidY * TILE_UNITS - ((UDWORD)z - player.p.z); dv.z = terrainMidY * TILE_UNITS - ((UDWORD)z - player.p.z);
iV_MatrixBegin(); /* Push the indentity matrix */ pie_MatBegin(); /* Push the identity matrix */
iV_TRANSLATE(dv.x,dv.y,dv.z); pie_TRANSLATE(dv.x,dv.y,dv.z);
rx = map_round(player.p.x); /* Get the x,z translation components */ rx = map_round(player.p.x); /* Get the x,z translation components */
rz = map_round(player.p.z); rz = map_round(player.p.z);
iV_TRANSLATE(rx,0,-rz); /* Translate */ pie_TRANSLATE(rx,0,-rz); /* Translate */
/* Make it face camera */ /* Make it face camera */
iV_MatrixRotateY(UNDEG(-player.r.y)); pie_MatRotY(-player.r.y);
iV_MatrixRotateX(UNDEG(-player.r.x)); pie_MatRotY(-player.r.x);
/* Scale it... */ /* Scale it... */
pie_MatScale(psPart->size / 100.f); pie_MatScale(psPart->size / 100.f);
/* Draw it... */ /* Draw it... */
centreX = player.p.x + world_coord(visibleTiles.x / 2); centreX = player.p.x + world_coord(visibleTiles.x / 2);
centreZ = player.p.z + world_coord(visibleTiles.y / 2); centreZ = player.p.z + world_coord(visibleTiles.y / 2);
pie_Draw3DShape(psPart->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0); pie_Draw3DShape(psPart->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0);
iV_MatrixEnd(); pie_MatEnd();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -77,7 +77,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
const iIMDShape *pImd; const iIMDShape *pImd;
SPACETIME spacetime; SPACETIME spacetime;
iV_MatrixBegin(); pie_MatBegin();
switch(objectType) switch(objectType)
{ {
@ -86,7 +86,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
pz = player.p.z & (TILE_UNITS-1); pz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(px,0,-pz); pie_TRANSLATE(px,0,-pz);
position.x = ((ATPART*)pObject)->position.x; position.x = ((ATPART*)pObject)->position.x;
position.y = ((ATPART*)pObject)->position.y; 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); pz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(px,0,-pz); pie_TRANSLATE(px,0,-pz);
psSimpObj = (SIMPLE_OBJECT*) pObject; psSimpObj = (SIMPLE_OBJECT*) pObject;
position.x = (psSimpObj->pos.x - player.p.x) - terrainMidX*TILE_UNITS; 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); pz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(px,0,-pz); pie_TRANSLATE(px,0,-pz);
psSimpObj = (SIMPLE_OBJECT*) pObject; psSimpObj = (SIMPLE_OBJECT*) pObject;
position.x = (psSimpObj->pos.x - player.p.x) - terrainMidX*TILE_UNITS; 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); pz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(px,0,-pz); pie_TRANSLATE(px,0,-pz);
psSimpObj = (SIMPLE_OBJECT*) pObject; psSimpObj = (SIMPLE_OBJECT*) pObject;
position.x = (psSimpObj->pos.x - player.p.x) - terrainMidX*TILE_UNITS; 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); pz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(px,0,-pz); pie_TRANSLATE(px,0,-pz);
psCompObj = (COMPONENT_OBJECT *) pObject; psCompObj = (COMPONENT_OBJECT *) pObject;
spacetime = interpolateObjectSpacetime((SIMPLE_OBJECT *)psCompObj->psParent, graphicsTime); 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; position.z -= psCompObj->psShape->ocen.y;
/* object (animation) translations - ivis z and y flipped */ /* 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 ); psCompObj->position.y );
/* object (animation) rotations */ /* object (animation) rotations */
iV_MatrixRotateY(UNDEG(-psCompObj->orientation.z)); pie_MatRotY(-psCompObj->orientation.z);
iV_MatrixRotateZ(UNDEG(-psCompObj->orientation.y)); pie_MatRotZ(-psCompObj->orientation.y);
iV_MatrixRotateX(UNDEG(-psCompObj->orientation.x)); pie_MatRotX(-psCompObj->orientation.x);
z = pie_RotateProject(&position,&pixel); z = pie_RotateProject(&position,&pixel);
@ -260,7 +260,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
pz = player.p.z & (TILE_UNITS-1); pz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(px,0,-pz); pie_TRANSLATE(px,0,-pz);
psSimpObj = (SIMPLE_OBJECT*) pObject; psSimpObj = (SIMPLE_OBJECT*) pObject;
position.x = (psSimpObj->pos.x - player.p.x) - terrainMidX*TILE_UNITS; 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); pz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(px,0,-pz); pie_TRANSLATE(px,0,-pz);
if (((PROXIMITY_DISPLAY *)pObject)->type == POS_PROXDATA) if (((PROXIMITY_DISPLAY *)pObject)->type == POS_PROXDATA)
{ {
position.x = (((VIEW_PROXIMITY *)((VIEWDATA *)((PROXIMITY_DISPLAY *) 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); pz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* 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.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)); 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); pz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(px,0,-pz); pie_TRANSLATE(px,0,-pz);
position.x = (((FLAG_POSITION *)pObject)->coords.x - player.p.x) - position.x = (((FLAG_POSITION *)pObject)->coords.x - player.p.x) -
terrainMidX * TILE_UNITS; terrainMidX * TILE_UNITS;
position.z = terrainMidY*TILE_UNITS - (((FLAG_POSITION*)pObject)-> position.z = terrainMidY*TILE_UNITS - (((FLAG_POSITION*)pObject)->

View File

@ -74,13 +74,13 @@ static void setMatrix(Vector3i *Position, Vector3i *Rotation, BOOL RotXYZ)
pie_TRANSLATE(Position->x,Position->y,Position->z); pie_TRANSLATE(Position->x,Position->y,Position->z);
if(RotXYZ) { if(RotXYZ) {
pie_MatRotX(Rotation->x); pie_MatRotX(DEG(Rotation->x));
pie_MatRotY(Rotation->y); pie_MatRotY(DEG(Rotation->y));
pie_MatRotZ(Rotation->z); pie_MatRotZ(DEG(Rotation->z));
} else { } else {
pie_MatRotY(Rotation->y); pie_MatRotY(DEG(Rotation->y));
pie_MatRotX(Rotation->x); pie_MatRotX(DEG(Rotation->x));
pie_MatRotZ(Rotation->z); pie_MatRotZ(DEG(Rotation->z));
} }
} }
@ -263,21 +263,21 @@ void displayStructureButton(STRUCTURE *psStructure, Vector3i *rotation, Vector3i
{ {
Rotation rot = structureGetInterpolatedWeaponRotation(psStructure, i, graphicsTime); Rotation rot = structureGetInterpolatedWeaponRotation(psStructure, i, graphicsTime);
iV_MatrixBegin(); pie_MatBegin();
iV_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y); pie_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y);
pie_MatRotY(UNDEG(-rot.direction)); pie_MatRotY(-rot.direction);
if (mountImd[i] != NULL) if (mountImd[i] != NULL)
{ {
pie_Draw3DShape(mountImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0); pie_Draw3DShape(mountImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
if(mountImd[i]->nconnectors) 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); 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 //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++) for (i = 0; i < MAX(1, Stats->numWeaps); i++)
{ {
iV_MatrixBegin(); pie_MatBegin();
iV_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y); pie_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y);
if (mountImd[i] != NULL) if (mountImd[i] != NULL)
{ {
pie_Draw3DShape(mountImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0); pie_Draw3DShape(mountImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
if(mountImd[i]->nconnectors) 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); 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 //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 ); psShapeTemp->connectors[iConnector + i].y );
} }
pie_MatRotY(UNDEG(-rot.direction)); pie_MatRotY(-rot.direction);
/* vtol weapons inverted */ /* vtol weapons inverted */
if ( iConnector >= VTOL_CONNECTOR_START ) 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 */ /* Get the mount graphic */
@ -746,12 +746,12 @@ static void displayCompObj(DROID *psDroid, BOOL bButton)
if ( iConnector >= VTOL_CONNECTOR_START ) if ( iConnector >= VTOL_CONNECTOR_START )
{ {
//pitch the barrel down //pitch the barrel down
pie_MatRotX(UNDEG(-rot.pitch)); pie_MatRotX(-rot.pitch);
} }
else else
{ {
//pitch the barrel up //pitch the barrel up
pie_MatRotX(UNDEG(rot.pitch)); pie_MatRotX(rot.pitch);
} }
/* Get the weapon (gun?) graphic */ /* Get the weapon (gun?) graphic */
@ -856,14 +856,14 @@ static void displayCompObj(DROID *psDroid, BOOL bButton)
/* vtol weapons inverted */ /* vtol weapons inverted */
if ( iConnector >= VTOL_CONNECTOR_START ) 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, pie_TRANSLATE( psShapeTemp->connectors[0].x,
psShapeTemp->connectors[0].z, psShapeTemp->connectors[0].z,
psShapeTemp->connectors[0].y ); psShapeTemp->connectors[0].y );
pie_MatRotY(UNDEG(-rot.direction)); pie_MatRotY(-rot.direction);
/* Draw it */ /* Draw it */
if (psMountShape) if (psMountShape)
{ {
@ -898,21 +898,21 @@ static void displayCompObj(DROID *psDroid, BOOL bButton)
psShape = getImdFromIndex(MI_FLAME); psShape = getImdFromIndex(MI_FLAME);
/* Rotate for droid */ /* Rotate for droid */
pie_MatRotY(UNDEG(st.rot.direction)); pie_MatRotY(st.rot.direction);
pie_MatRotX(UNDEG(-st.rot.pitch)); pie_MatRotX(-st.rot.pitch);
pie_MatRotZ(UNDEG(-st.rot.roll)); pie_MatRotZ(-st.rot.roll);
//rotate Y //rotate Y
pie_MatRotY(UNDEG(rot.direction)); pie_MatRotY(rot.direction);
iV_MatrixRotateY(UNDEG(-player.r.y)); pie_MatRotY(-player.r.y);
iV_MatrixRotateX(UNDEG(-player.r.x)); pie_MatRotX(-player.r.x);
/* Dither on software */ /* Dither on software */
pie_Draw3DShape(psShape, getModularScaledGraphicsTime(100, psShape->numFrames), 0, brightness, WZCOL_BLACK, pie_ADDITIVE, 140); pie_Draw3DShape(psShape, getModularScaledGraphicsTime(100, psShape->numFrames), 0, brightness, WZCOL_BLACK, pie_ADDITIVE, 140);
/* Dither off software */ /* Dither off software */
iV_MatrixRotateX(UNDEG(player.r.x)); pie_MatRotX(player.r.x);
iV_MatrixRotateY(UNDEG(player.r.y)); pie_MatRotY(player.r.y);
} }
} }
/* Pop Matrix */ /* Pop Matrix */
@ -1062,9 +1062,9 @@ void displayComponentObject(DROID *psDroid)
pie_TRANSLATE(position.x,position.y,position.z); pie_TRANSLATE(position.x,position.y,position.z);
/* Rotate for droid */ /* Rotate for droid */
pie_MatRotY(UNDEG(rotation.y)); pie_MatRotY(rotation.y);
pie_MatRotX(UNDEG(rotation.x)); pie_MatRotX(rotation.x);
pie_MatRotZ(UNDEG(rotation.z)); pie_MatRotZ(rotation.z);
if( (gameTime-psDroid->timeLastHit < GAME_TICKS_PER_SEC) && psDroid->lastHitWeapon == WSC_ELECTRONIC) if( (gameTime-psDroid->timeLastHit < GAME_TICKS_PER_SEC) && psDroid->lastHitWeapon == WSC_ELECTRONIC)
{ {

View File

@ -858,9 +858,9 @@ static void drawTiles(iView *player)
pie_MATTRANS(0, 0, distance); pie_MATTRANS(0, 0, distance);
/* Rotate for the player */ /* Rotate for the player */
pie_MatRotZ(UNDEG(player->r.z)); pie_MatRotZ(player->r.z);
pie_MatRotX(UNDEG(player->r.x)); pie_MatRotX(player->r.x);
pie_MatRotY(UNDEG(player->r.y)); pie_MatRotY(player->r.y);
/* Translate */ /* Translate */
pie_TRANSLATE(-rx, -player->p.y, rz); pie_TRANSLATE(-rx, -player->p.y, rz);
@ -985,7 +985,7 @@ static void drawTiles(iView *player)
} }
/* Clear the matrix stack */ /* Clear the matrix stack */
iV_MatrixEnd(); pie_MatEnd();
locateMouse(); locateMouse();
} }
@ -1197,24 +1197,24 @@ void renderProjectile(PROJECTILE *psCurr)
/* What's the present height of the bullet? */ /* What's the present height of the bullet? */
dv.y = st.pos.z; dv.y = st.pos.z;
/* Set up the matrix */ /* Set up the matrix */
iV_MatrixBegin(); pie_MatBegin();
/* Translate to the correct position */ /* 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 */ /* 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); rz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(rx,0,-rz); pie_TRANSLATE(rx,0,-rz);
/* Rotate it to the direction it's facing */ /* Rotate it to the direction it's facing */
imdRot2.y = st.rot.direction; imdRot2.y = st.rot.direction;
iV_MatrixRotateY(UNDEG(-imdRot2.y)); pie_MatRotY(-imdRot2.y);
/* pitch it */ /* pitch it */
imdRot2.x = st.rot.pitch; imdRot2.x = st.rot.pitch;
iV_MatrixRotateX(UNDEG(imdRot2.x)); pie_MatRotX(imdRot2.x);
if (psStats->weaponSubClass == WSC_ROCKET || psStats->weaponSubClass == WSC_MISSILE if (psStats->weaponSubClass == WSC_ROCKET || psStats->weaponSubClass == WSC_MISSILE
|| psStats->weaponSubClass == WSC_SLOWROCKET || psStats->weaponSubClass == WSC_SLOWMISSILE) || 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); pie_Draw3DShape(pIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0);
} }
iV_MatrixEnd(); pie_MatEnd();
} }
/* Flush matrices */ /* Flush matrices */
} }
@ -1264,23 +1264,23 @@ void renderAnimComponent( const COMPONENT_OBJECT *psObj )
psParentObj->sDisplay.frameNumber = currentGameFrame; psParentObj->sDisplay.frameNumber = currentGameFrame;
/* Push the indentity matrix */ /* Push the indentity matrix */
iV_MatrixBegin(); pie_MatBegin();
/* parent object translation */ /* 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 */ /* 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); rz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(rx, 0, -rz); pie_TRANSLATE(rx, 0, -rz);
/* parent object rotations */ /* parent object rotations */
imdRot2.y = spacetime.rot.direction; imdRot2.y = spacetime.rot.direction;
iV_MatrixRotateY(UNDEG(-imdRot2.y)); pie_MatRotY(-imdRot2.y);
imdRot2.x = spacetime.rot.pitch; imdRot2.x = spacetime.rot.pitch;
iV_MatrixRotateX(UNDEG(imdRot2.x)); pie_MatRotX(imdRot2.x);
/* Set frame numbers - look into this later?? FIXME!!!!!!!! */ /* Set frame numbers - look into this later?? FIXME!!!!!!!! */
if( psParentObj->type == OBJ_DROID ) 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. // 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 // 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 // object (animation) rotations
iV_MatrixRotateY(UNDEG(-psObj->orientation.z)); pie_MatRotY(-psObj->orientation.z);
iV_MatrixRotateZ(UNDEG(-psObj->orientation.y)); pie_MatRotZ(-psObj->orientation.y);
iV_MatrixRotateX(UNDEG(-psObj->orientation.x)); pie_MatRotX(-psObj->orientation.x);
pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, WZCOL_BLACK, pie_STATIC_SHADOW, 0); pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, WZCOL_BLACK, pie_STATIC_SHADOW, 0);
/* clear stack */ /* clear stack */
iV_MatrixEnd(); pie_MatEnd();
} }
} }
@ -1882,21 +1882,21 @@ void renderFeature(FEATURE *psFeature)
); );
/* Push the indentity matrix */ /* Push the indentity matrix */
iV_MatrixBegin(); pie_MatBegin();
/* Translate the feature - N.B. We can also do rotations here should we require /* 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); pie_TRANSLATE(dv.x,dv.y,dv.z);
/* Get the x,z translation components */ /* 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); rz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(rx,0,-rz); pie_TRANSLATE(rx,0,-rz);
rotation = psFeature->rot.direction; rotation = psFeature->rot.direction;
iV_MatrixRotateY(UNDEG(-rotation)); pie_MatRotY(-rotation);
brightness = pal_SetBrightness(200); //? HUH? brightness = pal_SetBrightness(200); //? HUH?
@ -1950,7 +1950,7 @@ void renderFeature(FEATURE *psFeature)
psFeature->sDisplay.screenY = s.y; 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); dv.z = terrainMidY*TILE_UNITS - (msgY - player.p.z);
/* Push the indentity matrix */ /* Push the indentity matrix */
iV_MatrixBegin(); pie_MatBegin();
/* Translate the message */ /* 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 */ /* 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); rz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(rx,0,-rz); pie_TRANSLATE(rx,0,-rz);
//get the appropriate IMD //get the appropriate IMD
if (pViewProximity) if (pViewProximity)
{ {
@ -2050,8 +2050,8 @@ void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp)
} }
} }
iV_MatrixRotateY(UNDEG(-player.r.y)); pie_MatRotY(-player.r.y);
iV_MatrixRotateX(UNDEG(-player.r.x)); pie_MatRotX(-player.r.x);
pie_Draw3DShape(proxImd, getModularScaledGraphicsTime(1000, 4), 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, 192); 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->screenY = y;
psProxDisp->screenR = r; psProxDisp->screenR = r;
iV_MatrixEnd(); pie_MatEnd();
} }
static PIELIGHT getBlueprintColour(STRUCT_STATES state) static PIELIGHT getBlueprintColour(STRUCT_STATES state)
@ -2159,24 +2159,24 @@ void renderStructure(STRUCTURE *psStructure)
dv.y = map_TileHeight(map_coord(structX), map_coord(structY)); dv.y = map_TileHeight(map_coord(structX), map_coord(structY));
} }
/* Push the indentity matrix */ /* Push the indentity matrix */
iV_MatrixBegin(); pie_MatBegin();
/* Translate the building - N.B. We can also do rotations here should we require /* 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); pie_TRANSLATE(dv.x,dv.y,dv.z);
/* Get the x,z translation components */ /* 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); rz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* 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, /* 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 = psStructure->rot.direction; rotation = psStructure->rot.direction;
iV_MatrixRotateY(UNDEG(-rotation)); pie_MatRotY(-rotation);
if (!defensive if (!defensive
&& gameTime2-psStructure->timeLastHit < ELEC_DAMAGE_DURATION && gameTime2-psStructure->timeLastHit < ELEC_DAMAGE_DURATION
&& psStructure->lastHitWeapon == WSC_ELECTRONIC ) && psStructure->lastHitWeapon == WSC_ELECTRONIC )
@ -2313,9 +2313,9 @@ void renderStructure(STRUCTURE *psStructure)
if (weaponImd[i] != NULL) if (weaponImd[i] != NULL)
{ {
iV_MatrixBegin(); pie_MatBegin();
iV_TRANSLATE(strImd->connectors[i].x, strImd->connectors[i].z, strImd->connectors[i].y); pie_TRANSLATE(strImd->connectors[i].x, strImd->connectors[i].z, strImd->connectors[i].y);
pie_MatRotY(UNDEG(-rot.direction)); pie_MatRotY(-rot.direction);
if (mountImd[i] != NULL) if (mountImd[i] != NULL)
{ {
pie_TRANSLATE(0, 0, psStructure->asWeaps[i].recoilValue / 3); 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); pie_Draw3DShape(mountImd[i], animFrame, colour, buildingBrightness, WZCOL_BLACK, pieFlag, pieFlagData);
if(mountImd[i]->nconnectors) 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_TRANSLATE(0, 0, psStructure->asWeaps[i].recoilValue);
pie_Draw3DShape(weaponImd[i], 0, colour, buildingBrightness, WZCOL_BLACK, pieFlag, pieFlagData); pie_Draw3DShape(weaponImd[i], 0, colour, buildingBrightness, WZCOL_BLACK, pieFlag, pieFlagData);
@ -2347,18 +2347,18 @@ void renderStructure(STRUCTURE *psStructure)
{ {
iIMDShape *pRepImd; 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); pRepImd = getImdFromIndex(MI_FLAME);
pie_MatRotY(UNDEG(rot.direction)); pie_MatRotY(rot.direction);
iV_MatrixRotateY(UNDEG(-player.r.y)); pie_MatRotY(-player.r.y);
iV_MatrixRotateX(UNDEG(-player.r.x)); pie_MatRotX(-player.r.x);
pie_Draw3DShape(pRepImd, getModularScaledGraphicsTime(100, pRepImd->numFrames), colour, buildingBrightness, WZCOL_BLACK, pie_ADDITIVE, 192); pie_Draw3DShape(pRepImd, getModularScaledGraphicsTime(100, pRepImd->numFrames), colour, buildingBrightness, WZCOL_BLACK, pie_ADDITIVE, 192);
iV_MatrixRotateX(UNDEG(player.r.x)); pie_MatRotX(player.r.x);
iV_MatrixRotateY(UNDEG(player.r.y)); pie_MatRotY(player.r.y);
pie_MatRotY(UNDEG(rot.direction)); 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. // no IMD, its a baba machine gun, bunker, etc.
else if (psStructure->asWeaps[i].nStat > 0) else if (psStructure->asWeaps[i].nStat > 0)
@ -2415,21 +2415,21 @@ void renderStructure(STRUCTURE *psStructure)
// draw Weapon/ECM/Sensor for structure // draw Weapon/ECM/Sensor for structure
if (flashImd[i] != NULL) if (flashImd[i] != NULL)
{ {
iV_MatrixBegin(); pie_MatBegin();
// horrendous hack // horrendous hack
if (strImd->max.y > 80) // babatower if (strImd->max.y > 80) // babatower
{ {
iV_TRANSLATE(0, 80, 0); pie_TRANSLATE(0, 80, 0);
pie_MatRotY(UNDEG(-rot.direction)); pie_MatRotY(-rot.direction);
iV_TRANSLATE(0, 0, -20); pie_TRANSLATE(0, 0, -20);
} }
else//baba bunker else//baba bunker
{ {
iV_TRANSLATE(0, 10, 0); pie_TRANSLATE(0, 10, 0);
pie_MatRotY(UNDEG(-rot.direction)); pie_MatRotY(-rot.direction);
iV_TRANSLATE(0, 0, -40); pie_TRANSLATE(0, 0, -40);
} }
pie_MatRotX(UNDEG(rot.pitch)); pie_MatRotX(rot.pitch);
// draw the muzzle flash? // draw the muzzle flash?
if (psStructure && psStructure->visible[selectedPlayer] > UBYTE_MAX / 2) 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; iIMDShape *lImd;
iV_MatrixBegin(); pie_MatBegin();
iV_TRANSLATE(psStructure->sDisplay.imd->connectors->x, psStructure->sDisplay.imd->connectors->z, pie_TRANSLATE(psStructure->sDisplay.imd->connectors->x, psStructure->sDisplay.imd->connectors->z,
psStructure->sDisplay.imd->connectors->y); psStructure->sDisplay.imd->connectors->y);
lImd = getImdFromIndex(MI_LANDING); lImd = getImdFromIndex(MI_LANDING);
pie_Draw3DShape(lImd, getModularScaledGraphicsTime(1024, lImd->numFrames), colour, buildingBrightness, WZCOL_BLACK, 0, 0); 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; psStructure->sDisplay.screenY = s.y;
} }
iV_MatrixEnd(); pie_MatEnd();
} }
/// draw the delivery points /// draw the delivery points
@ -2503,16 +2503,16 @@ void renderDeliveryPoint(FLAG_POSITION *psPosition, BOOL blueprint)
dv.y = psPosition->coords.z; dv.y = psPosition->coords.z;
/* Push the indentity matrix */ /* 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 */ /* 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); rz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(rx,0,-rz); pie_TRANSLATE(rx,0,-rz);
//quick check for invalid data //quick check for invalid data
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" );
@ -2552,7 +2552,7 @@ void renderDeliveryPoint(FLAG_POSITION *psPosition, BOOL blueprint)
psPosition->screenY = y; psPosition->screenY = y;
psPosition->screenR = r; psPosition->screenR = r;
iV_MatrixEnd(); pie_MatEnd();
} }
/// Draw a piece of wall /// Draw a piece of wall
@ -2620,20 +2620,20 @@ static BOOL renderWallSection(STRUCTURE *psStructure)
} }
/* Push the indentity matrix */ /* Push the indentity matrix */
iV_MatrixBegin(); pie_MatBegin();
/* Translate */ /* Translate */
iV_TRANSLATE(dv.x,dv.y,dv.z); pie_TRANSLATE(dv.x,dv.y,dv.z);
/* Get the x,z translation components */ /* 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); rz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(rx, 0, -rz); pie_TRANSLATE(rx, 0, -rz);
rotation = psStructure->rot.direction; rotation = psStructure->rot.direction;
iV_MatrixRotateY(UNDEG(-rotation)); pie_MatRotY(-rotation);
if(imd != NULL) if(imd != NULL)
{ {
@ -2692,7 +2692,7 @@ static BOOL renderWallSection(STRUCTURE *psStructure)
psStructure->sDisplay.screenY = s.y; psStructure->sDisplay.screenY = s.y;
} }
iV_MatrixEnd(); pie_MatEnd();
return(true); return(true);
} }
@ -2715,20 +2715,20 @@ void renderShadow( DROID *psDroid, iIMDShape *psShadowIMD )
dv.y = map_Height(psDroid->pos.x, psDroid->pos.y); dv.y = map_Height(psDroid->pos.x, psDroid->pos.y);
/* Push the indentity matrix */ /* 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 */ /* 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); rz = player.p.z & (TILE_UNITS-1);
/* Translate */ /* Translate */
iV_TRANSLATE(rx,0,-rz); pie_TRANSLATE(rx,0,-rz);
if(psDroid->droidType == DROID_TRANSPORTER) if(psDroid->droidType == DROID_TRANSPORTER)
{ {
iV_MatrixRotateY(UNDEG(-psDroid->rot.direction)); pie_MatRotY(-psDroid->rot.direction);
} }
pVecTemp = psShadowIMD->points; pVecTemp = psShadowIMD->points;
@ -2740,15 +2740,15 @@ void renderShadow( DROID *psDroid, iIMDShape *psShadowIMD )
} }
else else
{ {
pie_MatRotY(UNDEG(-psDroid->rot.direction)); pie_MatRotY(-psDroid->rot.direction);
pie_MatRotX(UNDEG(psDroid->rot.pitch)); pie_MatRotX(psDroid->rot.pitch);
pie_MatRotZ(UNDEG(psDroid->rot.roll)); pie_MatRotZ(psDroid->rot.roll);
} }
pie_Draw3DShape(psShadowIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, 128); pie_Draw3DShape(psShadowIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, 128);
psShadowIMD->points = pVecTemp; psShadowIMD->points = pVecTemp;
iV_MatrixEnd(); pie_MatEnd();
} }
/// Draw all pieces of a droid and register it as a target /// 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); pie_MATTRANS(0, 0, distance);
// rotate it // rotate it
pie_MatRotY(wind); pie_MatRotY(DEG(wind));
// move it somewhat below ground level for the blending effect // move it somewhat below ground level for the blending effect
pie_TRANSLATE(0, -skybox_scale/8, 0); pie_TRANSLATE(0, -skybox_scale/8, 0);

View File

@ -3069,14 +3069,14 @@ BOOL calcDroidMuzzleLocation(DROID *psDroid, Vector3f *muzzle, int weapon_slot)
pie_TRANSLATE(psDroid->pos.x, -psDroid->pos.z, psDroid->pos.y); pie_TRANSLATE(psDroid->pos.x, -psDroid->pos.z, psDroid->pos.y);
//matrix = the center of droid //matrix = the center of droid
pie_MatRotY(UNDEG(psDroid->rot.direction)); pie_MatRotY(psDroid->rot.direction);
pie_MatRotX(UNDEG(psDroid->rot.pitch)); pie_MatRotX(psDroid->rot.pitch);
pie_MatRotZ(UNDEG(-psDroid->rot.roll)); pie_MatRotZ(-psDroid->rot.roll);
pie_TRANSLATE(psBodyImd->connectors[weapon_slot].x, -psBodyImd->connectors[weapon_slot].z, pie_TRANSLATE(psBodyImd->connectors[weapon_slot].x, -psBodyImd->connectors[weapon_slot].z,
-psBodyImd->connectors[weapon_slot].y);//note y and z flipped -psBodyImd->connectors[weapon_slot].y);//note y and z flipped
//matrix = the weapon[slot] mount on the body //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 // process turret mount
if (psMountImd && psMountImd->nconnectors) if (psMountImd && psMountImd->nconnectors)
@ -3085,7 +3085,7 @@ BOOL calcDroidMuzzleLocation(DROID *psDroid, Vector3f *muzzle, int weapon_slot)
} }
//matrix = the turret connector for the gun //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 //process the gun
if (psWeaponImd && psWeaponImd->nconnectors) if (psWeaponImd && psWeaponImd->nconnectors)

View File

@ -439,17 +439,17 @@ static void positionEffect(const EFFECT *psEffect)
}; };
/* Push the indentity matrix */ /* Push the indentity matrix */
iV_MatrixBegin(); pie_MatBegin();
/* Move to position */ /* 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 */ /* Get the x,z translation components */
rx = map_round(player.p.x); rx = map_round(player.p.x);
rz = map_round(player.p.z); rz = map_round(player.p.z);
/* Move to camera reference */ /* Move to camera reference */
iV_TRANSLATE(rx, 0, -rz); pie_TRANSLATE(rx, 0, -rz);
} }
static void killEffect(EFFECT *e) static void killEffect(EFFECT *e)
@ -1613,7 +1613,7 @@ static void renderWaypointEffect(const EFFECT *psEffect)
positionEffect(psEffect); positionEffect(psEffect);
pie_Draw3DShape(psEffect->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0); pie_Draw3DShape(psEffect->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0);
iV_MatrixEnd(); pie_MatEnd();
} }
static void renderFirework(const EFFECT *psEffect) static void renderFirework(const EFFECT *psEffect)
@ -1626,12 +1626,12 @@ static void renderFirework(const EFFECT *psEffect)
positionEffect(psEffect); positionEffect(psEffect);
iV_MatrixRotateY(UNDEG(-player.r.y)); pie_MatRotY(-player.r.y);
iV_MatrixRotateX(UNDEG(-player.r.x)); pie_MatRotX(-player.r.x);
pie_MatScale(psEffect->size / 100.f); pie_MatScale(psEffect->size / 100.f);
pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, EFFECT_EXPLOSION_ADDITIVE); pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, EFFECT_EXPLOSION_ADDITIVE);
iV_MatrixEnd(); pie_MatEnd();
} }
/** drawing func for blood. */ /** drawing func for blood. */
@ -1639,12 +1639,12 @@ static void renderBloodEffect(const EFFECT *psEffect)
{ {
positionEffect(psEffect); positionEffect(psEffect);
iV_MatrixRotateY(UNDEG(-player.r.y)); pie_MatRotY(-player.r.y);
iV_MatrixRotateX(UNDEG(-player.r.x)); pie_MatRotX(-player.r.x);
pie_MatScale(psEffect->size / 100.f); pie_MatScale(psEffect->size / 100.f);
pie_Draw3DShape(getImdFromIndex(MI_BLOOD), psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, EFFECT_BLOOD_TRANSPARENCY); 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) static void renderDestructionEffect(const EFFECT *psEffect)
@ -1668,13 +1668,13 @@ static void renderDestructionEffect(const EFFECT *psEffect)
if(!gamePaused()) if(!gamePaused())
{ {
iV_MatrixRotateX(UNDEG(SKY_SHIMMY)); pie_MatRotX(SKY_SHIMMY);
iV_MatrixRotateY(UNDEG(SKY_SHIMMY)); pie_MatRotY(SKY_SHIMMY);
iV_MatrixRotateZ(UNDEG(SKY_SHIMMY)); pie_MatRotZ(SKY_SHIMMY);
} }
pie_Draw3DShape(psEffect->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_RAISE, percent); pie_Draw3DShape(psEffect->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_RAISE, percent);
iV_MatrixEnd(); pie_MatEnd();
} }
static bool rejectLandLight(LAND_LIGHT_SPEC type) static bool rejectLandLight(LAND_LIGHT_SPEC type)
@ -1722,8 +1722,8 @@ static void renderExplosionEffect(const EFFECT *psEffect)
if(TEST_FACING(psEffect)) if(TEST_FACING(psEffect))
{ {
/* Always face the viewer! */ /* Always face the viewer! */
/* TEST_FLIPPED_Y(psEffect) ? iV_MatrixRotateY(UNDEG(-player.r.y+iV_DEG(180))) :*/ iV_MatrixRotateY(UNDEG(-player.r.y)); pie_MatRotY(-player.r.y);
/* TEST_FLIPPED_X(psEffect) ? iV_MatrixRotateX(UNDEG(-player.r.x+iV_DEG(180))) :*/ iV_MatrixRotateX(UNDEG(-player.r.x)); pie_MatRotX(-player.r.x);
} }
/* Tesla explosions diminish in size */ /* 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); 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) static void renderGravitonEffect(const EFFECT *psEffect)
@ -1767,9 +1767,9 @@ static void renderGravitonEffect(const EFFECT *psEffect)
positionEffect(psEffect); positionEffect(psEffect);
iV_MatrixRotateX(UNDEG(psEffect->rotation.x)); pie_MatRotX(psEffect->rotation.x);
iV_MatrixRotateY(UNDEG(psEffect->rotation.y)); pie_MatRotY(psEffect->rotation.y);
iV_MatrixRotateZ(UNDEG(psEffect->rotation.z)); pie_MatRotZ(psEffect->rotation.z);
/* Buildings emitted by gravitons are chunkier */ /* Buildings emitted by gravitons are chunkier */
if(psEffect->type == GRAVITON_TYPE_EMITTING_ST) 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); pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0);
/* Pop the matrix */ /* Pop the matrix */
iV_MatrixEnd(); pie_MatEnd();
} }
/** Renders the standard construction effect */ /** Renders the standard construction effect */
@ -1800,8 +1800,8 @@ static void renderConstructionEffect(const EFFECT *psEffect)
/* Bit in comments doesn't quite work yet? */ /* Bit in comments doesn't quite work yet? */
if(TEST_FACING(psEffect)) if(TEST_FACING(psEffect))
{ {
/* TEST_FLIPPED_Y(psEffect) ? iV_MatrixRotateY(UNDEG(-player.r.y+iV_DEG(180))) :*/ iV_MatrixRotateY(UNDEG(-player.r.y)); pie_MatRotY(-player.r.y);
/* TEST_FLIPPED_X(psEffect) ? iV_MatrixRotateX(UNDEG(-player.r.x+iV_DEG(180))) :*/ iV_MatrixRotateX(UNDEG(-player.r.x)); pie_MatRotX(-player.r.x);
} }
/* Scale size according to age */ /* 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)); pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, (UBYTE)(translucency));
/* Pop the matrix */ /* Pop the matrix */
iV_MatrixEnd(); pie_MatEnd();
} }
/** Renders the standard smoke effect - it is now scaled in real-time as well */ /** 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)) if(TEST_FACING(psEffect))
{ {
/* Always face the viewer! */ /* Always face the viewer! */
/* TEST_FLIPPED_Y(psEffect) ? iV_MatrixRotateY(UNDEG(-player.r.y+iV_DEG(180))) : */iV_MatrixRotateY(UNDEG(-player.r.y)); pie_MatRotY(-player.r.y);
/* TEST_FLIPPED_X(psEffect) ? iV_MatrixRotateX(UNDEG(-player.r.x+iV_DEG(180))) : */iV_MatrixRotateX(UNDEG(-player.r.x)); pie_MatRotX(-player.r.x);
} }
/* Small smoke - used for the droids */ /* Small smoke - used for the droids */
@ -1893,7 +1893,7 @@ static void renderSmokeEffect(const EFFECT *psEffect)
} }
/* Pop the matrix */ /* Pop the matrix */
iV_MatrixEnd(); pie_MatEnd();
} }

View File

@ -55,7 +55,7 @@ void renderResearchToBuffer(RESEARCH *psResearch,
pie_SetGeometricOffset(OriginX+10,OriginY+10); pie_SetGeometricOffset(OriginX+10,OriginY+10);
// Pitch down a bit // Pitch down a bit
//pie_MatRotX(-30); //pie_MatRotX(-65536/12);
// Rotate round // Rotate round
// full rotation once every 2 seconds.. // full rotation once every 2 seconds..

View File

@ -1860,12 +1860,12 @@ void objectShimmy(BASE_OBJECT *psObj)
{ {
if(justBeenHitByEW(psObj)) if(justBeenHitByEW(psObj))
{ {
iV_MatrixRotateX(UNDEG(SKY_SHIMMY)); pie_MatRotX(SKY_SHIMMY);
iV_MatrixRotateY(UNDEG(SKY_SHIMMY)); pie_MatRotY(SKY_SHIMMY);
iV_MatrixRotateZ(UNDEG(SKY_SHIMMY)); pie_MatRotZ(SKY_SHIMMY);
if(psObj->type == OBJ_DROID) if(psObj->type == OBJ_DROID)
{ {
iV_TRANSLATE(1-rand()%3,0,1-rand()%3); pie_TRANSLATE(1-rand()%3,0,1-rand()%3);
} }
} }
} }

View File

@ -292,7 +292,7 @@ void drawRadar(void)
if (rotateRadar) if (rotateRadar)
{ {
// rotate the map // rotate the map
iV_MatrixRotateZ(UNDEG(player.r.y)); pie_MatRotZ(player.r.y);
DrawNorth(); DrawNorth();
} }
// draw the box at the dimensions of the map // draw the box at the dimensions of the map

View File

@ -5632,14 +5632,14 @@ BOOL calcStructureMuzzleLocation(STRUCTURE *psStructure, Vector3f *muzzle, int w
pie_TRANSLATE(psStructure->pos.x, -psStructure->pos.z, psStructure->pos.y); pie_TRANSLATE(psStructure->pos.x, -psStructure->pos.z, psStructure->pos.y);
//matrix = the center of droid //matrix = the center of droid
pie_MatRotY(UNDEG(psStructure->rot.direction)); pie_MatRotY(psStructure->rot.direction);
pie_MatRotX(UNDEG(psStructure->rot.pitch)); pie_MatRotX(psStructure->rot.pitch);
pie_MatRotZ(UNDEG(-psStructure->rot.roll)); pie_MatRotZ(-psStructure->rot.roll);
pie_TRANSLATE( psShape->connectors[weapon_slot].x, -psShape->connectors[weapon_slot].z, pie_TRANSLATE( psShape->connectors[weapon_slot].x, -psShape->connectors[weapon_slot].z,
-psShape->connectors[weapon_slot].y);//note y and z flipped -psShape->connectors[weapon_slot].y);//note y and z flipped
//matrix = the weapon[slot] mount on the body //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 // process turret mount
if (psMountImd && psMountImd->nconnectors) if (psMountImd && psMountImd->nconnectors)
@ -5648,7 +5648,7 @@ BOOL calcStructureMuzzleLocation(STRUCTURE *psStructure, Vector3f *muzzle, int w
} }
//matrix = the turret connector for the gun //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 //process the gun
if (psWeaponImd && psWeaponImd->nconnectors) if (psWeaponImd && psWeaponImd->nconnectors)