Permit compilation without binary space partitioning. To test this, comment out

the #define BSPIMD line in lib/ivis_common/ivisdef.h header.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1529 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-04-23 17:59:13 +00:00
parent 153f21f20d
commit 9e1d57e718
9 changed files with 46 additions and 28 deletions

View File

@ -23,6 +23,8 @@
#include "ivisdef.h"
#include "bspimd.h"
#ifdef BSPIMD
/***************************************************************************/
void GetRealCameraPos(OBJPOS *Camera, SDWORD Distance, Vector3i *CameraLoc);
@ -31,3 +33,5 @@ void GetPlane( iIMDShape *s, UDWORD PolygonID, PSPLANE psPlane );
#endif
#endif

View File

@ -20,6 +20,8 @@
#ifndef i_BSPIMD
#define i_BSPIMD
#ifdef BSPIMD
typedef UDWORD WORLDCOORD;
typedef SWORD ANGLE;
@ -142,5 +144,8 @@ BSPTREENODE, *PSBSPTREENODE;
/***************************************************************************/
#endif
#endif

View File

@ -462,9 +462,11 @@ void iV_IMDRelease(iIMDShape *s)
if (s->connectors) {
free(s->connectors);
}
#ifdef BSPIMD
if (s->BSPNode) {
free(s->BSPNode); // I used malloc() so i'm going to use FREE()
}
#endif
if (s->polys) {
for (i = 0; i < s->npolys; i++) {
if (s->polys[i].pindex) {

View File

@ -87,9 +87,9 @@ iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
int i, nlevels, ptype, pwidth, pheight, texpage;
iIMDShape *s, *psShape;
BOOL bTextured = FALSE;
#ifdef BSPIMD
//#ifdef BSPIMD
UDWORD level;
#endif
//#endif
IMDcount++;
@ -196,7 +196,7 @@ iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
return NULL;
}
#ifdef BSPIMD
//#ifdef BSPIMD
// if we might have BSP then we need to preread the LEVEL directive
if (sscanf(pFileData,"%s %d%n",buffer,&level,&cnt) != 2) {
iV_Error(0xff,"(_load_level) file corrupt -J");
@ -208,7 +208,7 @@ iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
debug(LOG_ERROR, "iV_ProcessIMD(2): expecting 'LEVELS' directive (%s)", buffer);
return NULL;
}
#endif
//#endif
s = _imd_load_level(&pFileData,FileDataEnd,nlevels,texpage);
@ -911,15 +911,12 @@ static iIMDShape *_imd_load_level(char **ppFileData, char *FileDataEnd, int nlev
int cnt;
iIMDShape *s;
char buffer[MAX_FILE_PATH];
// int level;
#ifdef NEVER_BSPIMD
int level;
#endif
int n;
int npolys;
#ifdef BSPIMD
// UWORD NumberOfParameters;
// UDWORD count;
#endif
if (nlevels == 0)
return NULL;
@ -936,7 +933,7 @@ static iIMDShape *_imd_load_level(char **ppFileData, char *FileDataEnd, int nlev
s->nShadowEdges = 0;
// if we can be sure that there is no bsp ... the we check for level number at this point
#ifndef BSPIMD
#ifdef NEVER_BSPIMD
if (sscanf(pFileData,"%s %d%n",buffer,&level,&cnt) != 2) {
debug(LOG_ERROR, "_imd_load_level: file corrupt");
return NULL;
@ -944,7 +941,7 @@ static iIMDShape *_imd_load_level(char **ppFileData, char *FileDataEnd, int nlev
pFileData += cnt;
if (strcmp(buffer,"LEVEL") != 0) {
debug(LOG_ERROR, "_imd_load_level: excepting 'LEVEL' directive");
debug(LOG_ERROR, "_imd_load_level: expecting 'LEVEL' directive");
return NULL;
}
#endif
@ -963,7 +960,7 @@ static iIMDShape *_imd_load_level(char **ppFileData, char *FileDataEnd, int nlev
// load points
if (strcmp(buffer,"POINTS") != 0) {
debug(LOG_ERROR, "_imd_load_level: expecting 'POINTS' directive");
debug(LOG_ERROR, "_imd_load_level: expecting 'POINTS' directive, got: %s", buffer);
return NULL;
}

View File

@ -41,9 +41,6 @@
*/
/***************************************************************************/
#define BSPIMD // now defined for all versions (optional BSP handled on all formats)
#ifdef WIN321 //Not really needed I guess, however, see debug.c comments. -Qamly
#define iV_DDX
#endif
#define iV_SCANTABLE_MAX 1024

View File

@ -150,7 +150,9 @@ static SDWORD polyCount = 0;
static inline void pie_PiePoly(PIEPOLY *poly, BOOL bClip);
static inline void pie_PiePolyFrame(PIEPOLY *poly, SDWORD frame, BOOL bClip);
#ifdef BSPIMD
void DrawTriangleList(BSPPOLYID PolygonNumber);
#endif
/***************************************************************************/
/*

View File

@ -135,7 +135,9 @@ BOOL renderBridgeSection(STRUCTURE *psStructure)
dv.z = terrainMidY*TILE_UNITS - (structY - player.p.z);
dv.y = structZ;
#ifdef BSPIMD
SetBSPObjectPos(structX,dv.y,structY); // world x,y,z coord of structure ... this is needed for the BSP code
#endif
/* Push the indentity matrix */
pie_MatBegin();

View File

@ -143,22 +143,20 @@ void updateLightLevels(void)
void setMatrix(Vector3i *Position, Vector3i *Rotation, Vector3i *CameraPos, BOOL RotXYZ)
{
#ifdef BSPIMD
Vector3i BSPCameraPos;
OBJPOS Camera = {0,0,0,0,0,0};
Camera.pitch=-45;
Camera.yaw=0;
#endif
// Rotation->y=0;
#ifdef BSPIMD
GetRealCameraPos(&Camera,Position->z,&BSPCameraPos);
// SetBSPCameraPos(BSPCameraPos.x,BSPCameraPos.y,BSPCameraPos.z);
// Fixes BSP drawing in buttons. eg Player HQ.
SetBSPCameraPos(BSPCameraPos.x,500,BSPCameraPos.z);
SetBSPObjectPos(0,0,0); // For imd button the bsp is sourced at 0,0,0
SetBSPObjectRot(DEG(-Rotation->y),0); // Droid rotation
#endif
pie_PerspectiveBegin();
pie_MatBegin();
@ -318,7 +316,9 @@ void displayStructureButton(STRUCTURE *psStructure, Vector3i *Rotation, Vector3i
Position->y -= 20;
}
#ifdef BSPIMD
SetBSPObjectPos(0,0,0);
#endif
setMatrix(Position,Rotation,&TmpCamPos,RotXYZ);
pie_MatScale(scale);

View File

@ -315,11 +315,12 @@ static DEF_COLOURS defaultColours;
/******************** Functions ********************/
#ifdef BSPIMD
static UDWORD GetCameraDistance(void)
{
return distance;
}
#endif
static void displayMultiChat( void )
{
@ -622,7 +623,7 @@ static void displayTerrain(void)
}
}
#ifdef BSPIMD
// Parameter is the vector to store the camera position
static void CalcBSPCameraPos(Vector3i *NewBSPCamera)
{
@ -638,6 +639,7 @@ static void CalcBSPCameraPos(Vector3i *NewBSPCamera)
GetRealCameraPos(&Camera,GetCameraDistance(),NewBSPCamera);
}
#endif
/***************************************************************************/
BOOL doWeDrawRadarBlips( void )
@ -666,7 +668,9 @@ static void drawTiles(iView *camera, iView *player)
{
UDWORD i, j;
SDWORD zMax;
#ifdef BSPIMD
Vector3i BSPCamera;
#endif
MAPTILE *psTile;
UDWORD specular;
UDWORD edgeX, edgeY;
@ -703,8 +707,10 @@ static void drawTiles(iView *camera, iView *player)
terrainMidX = visibleXTiles/2;
terrainMidY = visibleYTiles/2;
#ifdef BSPIMD
CalcBSPCameraPos(&BSPCamera);
SetBSPCameraPos(BSPCamera.x, BSPCamera.y, BSPCamera.z);
#endif
/* Find our position in tile coordinates */
playerXTile = player->p.x >> TILE_SHIFT;
@ -1997,7 +2003,9 @@ void renderFeature(FEATURE *psFeature)
/* features sits at the height of the tile it's centre is on */
dv.y = psFeature->z;
#ifdef BSPIMD
SetBSPObjectPos(featX,dv.y,featY); // world x,y,z coord of structure ... this is needed for the BSP code
#endif
/* Push the indentity matrix */
iV_MatrixBegin();
@ -2300,7 +2308,9 @@ void renderStructure(STRUCTURE *psStructure)
} else {
dv.y = map_TileHeight(structX >> TILE_SHIFT, structY >> TILE_SHIFT);
}
#ifdef BSPIMD
SetBSPObjectPos(structX,dv.y,structY); // world x,y,z coord of structure ... this is needed for the BSP code
#endif
/* Push the indentity matrix */
iV_MatrixBegin();
@ -2712,9 +2722,6 @@ void renderDeliveryPoint(FLAG_POSITION *psPosition)
dv.z = terrainMidY*TILE_UNITS - (psPosition->coords.y - player.p.z);
dv.y = psPosition->coords.z;
// world x,y,z coord of deliv point ... this is needed for the BSP code
//SetBSPObjectPos(posX,dv.y,posY);
/* Push the indentity matrix */
iV_MatrixBegin();
@ -2851,7 +2858,9 @@ static BOOL renderWallSection(STRUCTURE *psStructure)
dv.z = terrainMidY*TILE_UNITS - (structY - player.p.z);
dv.y = map_Height(structX, structY);
#ifdef BSPIMD
SetBSPObjectPos(structX,dv.y,structY); // world x,y,z coord of structure ... this is needed for the BSP code
#endif
/* Push the indentity matrix */
iV_MatrixBegin();