- Constification
- POINT -> Vector2i - changed internalformat = getPixelFormat() to GL_RGBA in one place - removed unused variables/functions - proper intialisation git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1792 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
a6b56ed7e9
commit
68e56823e1
|
@ -63,12 +63,6 @@ typedef int32_t SDWORD;
|
|||
|
||||
typedef int BOOL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
} POINT;
|
||||
|
||||
#endif /* !WZ_OS_WIN */
|
||||
|
||||
// If we are C99 compatible, the "bool" macro will be defined in <stdbool.h> (as _Bool)
|
||||
|
|
|
@ -260,26 +260,6 @@ animObj_Add( void *pParentObj, int iAnimID,
|
|||
return psObj;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
* animObj_GetFrame3D
|
||||
*
|
||||
* returns NULL if animation not started yet
|
||||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
UWORD
|
||||
animObj_GetFrame3D( ANIM_OBJECT *psObj, UWORD uwObj, Vector3i *psVecPos,
|
||||
Vector3i *psVecRot, Vector3i *psVecScale )
|
||||
{
|
||||
ANIM3D *psAnim;
|
||||
|
||||
/* get local anim pointer */
|
||||
psAnim = (ANIM3D *) psObj->psAnim;
|
||||
|
||||
return anim_GetFrame3D( psAnim, uwObj, gameTime, psObj->udwStartTime,
|
||||
psObj->udwStartDelay, psVecPos, psVecRot, psVecScale );
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
|
|
@ -102,9 +102,6 @@ BOOL animObj_Remove( ANIM_OBJECT **ppsObj, int iAnimID );
|
|||
ANIM_OBJECT * animObj_GetFirst( void );
|
||||
ANIM_OBJECT * animObj_GetNext( void );
|
||||
ANIM_OBJECT * animObj_Find( void *pParentObj, int iAnimID );
|
||||
UWORD animObj_GetFrame3D( ANIM_OBJECT *psObj, UWORD uwObj,
|
||||
Vector3i *psPos, Vector3i *psVecRot,
|
||||
Vector3i *psVecScale );
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ SDWORD gSrcStride;
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
PIESTYLE rendStyle;
|
||||
POINT rectVerts[4];
|
||||
PIESTYLE rendStyle;
|
||||
Vector2i rectVerts[4];
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
|
|
|
@ -284,8 +284,7 @@ static unsigned int nb_tshapes = 0;
|
|||
|
||||
static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELIGHT specular, int pieFlag, int pieFlagData)
|
||||
{
|
||||
float tempY;
|
||||
int i, n;
|
||||
unsigned int n;
|
||||
Vector3f *pVertices, *pPixels;
|
||||
iIMDPoly *pPolys;
|
||||
PIEPOLY piePoly;
|
||||
|
@ -341,11 +340,11 @@ static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELI
|
|||
|
||||
//now draw the shape
|
||||
//rotate and project points from shape->points to scrPoints
|
||||
for (i = 0, pVertices = shape->points, pPixels = scrPoints;
|
||||
i < shape->npoints;
|
||||
i++, pVertices++, pPixels++)
|
||||
for (pVertices = shape->points, pPixels = scrPoints;
|
||||
pVertices < shape->points + shape->npoints;
|
||||
pVertices++, pPixels++)
|
||||
{
|
||||
tempY = pVertices->y;
|
||||
float tempY = pVertices->y;
|
||||
if (pieFlag & pie_RAISE)
|
||||
{
|
||||
tempY = pVertices->y - pieFlagData;
|
||||
|
@ -353,22 +352,21 @@ static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELI
|
|||
tempY = 0;
|
||||
|
||||
}
|
||||
else if (pieFlag & pie_HEIGHT_SCALED)
|
||||
else if ( (pieFlag & pie_HEIGHT_SCALED) && pVertices->y > 0 )
|
||||
{
|
||||
if(pVertices->y > 0)
|
||||
{
|
||||
tempY = (pVertices->y * pieFlagData) / pie_RAISE_SCALE;
|
||||
}
|
||||
tempY = (pVertices->y * pieFlagData) / pie_RAISE_SCALE;
|
||||
}
|
||||
pPixels->x = pVertices->x;
|
||||
pPixels->y = tempY;
|
||||
pPixels->z = pVertices->z;
|
||||
}
|
||||
|
||||
pPolys = shape->polys;
|
||||
for (i=0; i<shape->npolys; i++, pPolys++) {
|
||||
index = pPolys->pindex;
|
||||
for (pPolys = shape->polys;
|
||||
pPolys < shape->polys + shape->npolys;
|
||||
pPolys++)
|
||||
{
|
||||
piePoly.flags = pPolys->flags;
|
||||
|
||||
if (pieFlag & pie_TRANSLUCENT)
|
||||
{
|
||||
/* There are no PIE files with PIE_ALPHA set, this is the only user, and
|
||||
|
@ -380,7 +378,10 @@ static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELI
|
|||
{
|
||||
piePoly.flags &= (0xffffffff-PIE_COLOURKEYED);//dont treat additive images as colour keyed
|
||||
}
|
||||
for (n=0; n<pPolys->npnts; n++, index++)
|
||||
|
||||
for (n = 0, index = pPolys->pindex;
|
||||
n < pPolys->npnts;
|
||||
n++, index++)
|
||||
{
|
||||
pieVrts[n].sx = scrPoints[*index].x;
|
||||
pieVrts[n].sy = scrPoints[*index].y;
|
||||
|
@ -400,6 +401,7 @@ static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELI
|
|||
pie_PiePolyFrame(&piePoly, frame, light); // draw the polygon ...
|
||||
}
|
||||
}
|
||||
|
||||
if (pieFlag & pie_BUTTON)
|
||||
{
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON);
|
||||
|
@ -625,18 +627,16 @@ void pie_CleanUp( void )
|
|||
void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD spec, int pieFlag, int pieFlagData)
|
||||
{
|
||||
PIELIGHT colour, specular;
|
||||
float distance;
|
||||
|
||||
pieCount++;
|
||||
|
||||
// Fix for transparent buildings and features!! */
|
||||
// Fix for transparent buildings and features!!
|
||||
if( (pieFlag & pie_TRANSLUCENT) && (pieFlagData>220) )
|
||||
{
|
||||
// force to bilinear and non-transparent
|
||||
pieFlag = pieFlag & ~pie_TRANSLUCENT;
|
||||
pieFlagData = 0;
|
||||
}
|
||||
// Fix for transparent buildings and features!! */
|
||||
|
||||
// WARZONE light as byte passed in colour so expand
|
||||
if (col <= MAX_UB_LIGHT)
|
||||
|
@ -675,7 +675,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD s
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned int old_size = tshapes_size;
|
||||
const unsigned int old_size = tshapes_size;
|
||||
tshapes_size <<= 1;
|
||||
tshapes = (transluscent_shape_t*)realloc(tshapes, tshapes_size*sizeof(transluscent_shape_t));
|
||||
memset( &tshapes[old_size], 0, (tshapes_size-old_size)*sizeof(transluscent_shape_t) );
|
||||
|
@ -694,6 +694,8 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD s
|
|||
{
|
||||
if(pieFlag & pie_SHADOW || pieFlag & pie_STATIC_SHADOW)
|
||||
{
|
||||
float distance;
|
||||
|
||||
// draw a shadow
|
||||
if (scshapes_size <= nb_scshapes)
|
||||
{
|
||||
|
@ -705,7 +707,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD s
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned int old_size = scshapes_size;
|
||||
const unsigned int old_size = scshapes_size;
|
||||
scshapes_size <<= 1;
|
||||
scshapes = (shadowcasting_shape_t*)realloc(scshapes, scshapes_size*sizeof(shadowcasting_shape_t));
|
||||
memset( &scshapes[old_size], 0, (scshapes_size-old_size)*sizeof(shadowcasting_shape_t) );
|
||||
|
@ -988,28 +990,35 @@ static inline void pie_PiePoly(PIEPOLY *poly, BOOL light)
|
|||
|
||||
static inline void pie_PiePolyFrame(PIEPOLY *poly, SDWORD frame, BOOL light)
|
||||
{
|
||||
int uFrame, vFrame, j, framesPerLine;
|
||||
|
||||
if ((poly->flags & iV_IMD_TEXANIM) && (frame != 0)) {
|
||||
if (poly->pTexAnim != NULL) {
|
||||
if (poly->pTexAnim->nFrames >=0) {
|
||||
if ((poly->flags & iV_IMD_TEXANIM) && (frame != 0))
|
||||
{
|
||||
if (poly->pTexAnim != NULL)
|
||||
{
|
||||
if (poly->pTexAnim->nFrames >=0)
|
||||
{
|
||||
frame %= poly->pTexAnim->nFrames;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
frame %= (-poly->pTexAnim->nFrames);
|
||||
}
|
||||
if (frame > 0) {
|
||||
|
||||
if (frame > 0)
|
||||
{
|
||||
// HACK - fix this!!!!
|
||||
framesPerLine = 256 / poly->pTexAnim->textureWidth;
|
||||
const int framesPerLine = 256 / poly->pTexAnim->textureWidth;
|
||||
//should be framesPerLine = iV_TEXTEX(texPage)->width / poly->pTexAnim->textureWidth;
|
||||
vFrame = 0;
|
||||
int uFrame = 0, vFrame = 0, j = 0;
|
||||
|
||||
while (frame >= framesPerLine)
|
||||
{
|
||||
frame -= framesPerLine;
|
||||
vFrame += poly->pTexAnim->textureHeight;
|
||||
}
|
||||
|
||||
uFrame = frame * poly->pTexAnim->textureWidth;
|
||||
|
||||
for (j=0; j<poly->nVrts; j++)
|
||||
for (j = 0; j < poly->nVrts; j++)
|
||||
{
|
||||
poly->pVrts[j].tu += uFrame;
|
||||
poly->pVrts[j].tv += vFrame;
|
||||
|
|
|
@ -184,13 +184,10 @@ SDWORD aSinTable[SC_TABLESIZE + (SC_TABLESIZE/4)];
|
|||
//******
|
||||
|
||||
static void pie_MatReset(void)
|
||||
|
||||
{
|
||||
// printf("pie_MatReset\n");
|
||||
psMatrix = &aMatrixStack[0];
|
||||
|
||||
// make 1st matrix identity
|
||||
|
||||
*psMatrix = _MATRIX_ID;
|
||||
|
||||
glLoadIdentity();
|
||||
|
@ -203,13 +200,10 @@ static void pie_MatReset(void)
|
|||
//******
|
||||
|
||||
void pie_MatBegin(void)
|
||||
|
||||
{
|
||||
_MATRIX_INDEX++;
|
||||
if (_MATRIX_INDEX > 3)
|
||||
{
|
||||
ASSERT( _MATRIX_INDEX < MATRIX_MAX,"pie_MatBegin past top of the stack" );
|
||||
}
|
||||
ASSERT( _MATRIX_INDEX < MATRIX_MAX, "pie_MatBegin past top of the stack" );
|
||||
|
||||
psMatrix++;
|
||||
aMatrixStack[_MATRIX_INDEX] = aMatrixStack[_MATRIX_INDEX-1];
|
||||
|
||||
|
@ -223,10 +217,10 @@ void pie_MatBegin(void)
|
|||
//******
|
||||
|
||||
void pie_MatEnd(void)
|
||||
|
||||
{
|
||||
_MATRIX_INDEX--;
|
||||
ASSERT( _MATRIX_INDEX >= 0,"pie_MatEnd of the bottom of the stack" );
|
||||
ASSERT( _MATRIX_INDEX >= 0, "pie_MatEnd of the bottom of the stack" );
|
||||
|
||||
psMatrix--;
|
||||
|
||||
glPopMatrix();
|
||||
|
|
|
@ -224,7 +224,7 @@ void screen_SetBackDropFromFile(const char* filename)
|
|||
glGenTextures(1, &backDropTexture);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, backDropTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, iV_getPixelFormat(&image),
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
image.width, image.height,
|
||||
0, iV_getPixelFormat(&image), GL_UNSIGNED_BYTE, image.bmp);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
|
|
@ -100,7 +100,7 @@ static POINT aDirOffset[NUM_DIR] =
|
|||
#define NUM_DIR 8
|
||||
// Convert a direction into an offset
|
||||
// dir 0 => x = 0, y = -1
|
||||
static POINT aDirOffset[NUM_DIR] =
|
||||
static Vector2i aDirOffset[NUM_DIR] =
|
||||
{
|
||||
{ 0, 1},
|
||||
{-1, 1},
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#define ASTAR_MAXROUTE 50
|
||||
typedef struct _astar_route
|
||||
{
|
||||
POINT asPos[ASTAR_MAXROUTE];
|
||||
SDWORD finalX,finalY,numPoints;
|
||||
Vector2i asPos[ASTAR_MAXROUTE];
|
||||
SDWORD finalX, finalY, numPoints;
|
||||
} ASTAR_ROUTE;
|
||||
|
||||
// Sizes for the node heap
|
||||
|
|
16
src/disp2d.c
16
src/disp2d.c
|
@ -886,14 +886,14 @@ removed cos types are different - am
|
|||
/* Display a texture tile in 2D */
|
||||
void blitTile(RECT *psDestRect, RECT *psSrcRect, UDWORD texture)
|
||||
{
|
||||
LPDIRECTDRAWSURFACE4 psBack;
|
||||
DDSURFACEDESC2 sDDSDDest, sDDSDSrc;
|
||||
HRESULT ddrval;
|
||||
POINT sP1,sP2,sP3,sP4;
|
||||
POINT *psP1,*psP2,*psP3,*psP4,*psPTemp;
|
||||
UBYTE *p8Src, *p8Dest;
|
||||
UWORD *p16Src, *p16Dest;
|
||||
SDWORD x,y, xDir,yDir, srcInc,destInc;
|
||||
LPDIRECTDRAWSURFACE4 psBack;
|
||||
DDSURFACEDESC2 sDDSDDest, sDDSDSrc;
|
||||
HRESULT ddrval;
|
||||
Vector2i sP1, sP2, sP3, sP4;
|
||||
Vector2i *psP1, *psP2, *psP3, *psP4 ,*psPTemp;
|
||||
UBYTE *p8Src, *p8Dest;
|
||||
UWORD *p16Src, *p16Dest;
|
||||
SDWORD x, y, xDir, yDir, srcInc, destInc;
|
||||
|
||||
psBack = screenGetSurface();
|
||||
// surfCreate(&psBack, 640,480, DDSCAPS_SYSTEMMEMORY, NULL);
|
||||
|
|
107
src/display3d.c
107
src/display3d.c
|
@ -217,8 +217,8 @@ SVMESH tileScreenInfo[LAND_YGRD][LAND_XGRD];
|
|||
static TILE_BUCKET tileIJ[LAND_YGRD][LAND_XGRD];
|
||||
|
||||
/* Points for flipping the texture around if the tile is flipped or rotated */
|
||||
static POINT sP1, sP2, sP3, sP4;
|
||||
static POINT *psP1, *psP2, *psP3, *psP4;
|
||||
static Vector2i sP1, sP2, sP3, sP4;
|
||||
static Vector2i *psP1, *psP2, *psP3, *psP4;
|
||||
|
||||
/* Records the present X and Y values for the current mouse tile (in tiles */
|
||||
SDWORD mouseTileX, mouseTileY;
|
||||
|
@ -1068,13 +1068,12 @@ void disp3d_getView(iView *newView)
|
|||
|
||||
/* John's routine - deals with flipping around the vertex ordering for source textures
|
||||
when flips and rotations are being done */
|
||||
static void flipsAndRots(int texture)
|
||||
static void flipsAndRots(int texture)
|
||||
{
|
||||
/* Used to calculate texture coordinates, which are 0-255 in value */
|
||||
const UDWORD xMult = (256 / TILES_IN_PAGE_COLUMN);
|
||||
const UDWORD yMult = (256 / TILES_IN_PAGE_ROW);
|
||||
|
||||
POINT *psPTemp;
|
||||
Vector2i *psPTemp;
|
||||
|
||||
/* Store the source rect as four points */
|
||||
sP1.x = 1;
|
||||
|
@ -1311,52 +1310,47 @@ void renderProjectile(PROJ_OBJECT *psCurr)
|
|||
}
|
||||
|
||||
void
|
||||
renderAnimComponent( COMPONENT_OBJECT *psObj )
|
||||
renderAnimComponent( const COMPONENT_OBJECT *psObj )
|
||||
{
|
||||
Vector3i dv;
|
||||
SDWORD posX, posY, posZ, iPlayer;
|
||||
BASE_OBJECT *psParentObj = (BASE_OBJECT *) psObj->psParent;
|
||||
DROID *psDroid;
|
||||
STRUCTURE *psStructure;
|
||||
UDWORD brightness, specular;
|
||||
BASE_OBJECT *psParentObj = (BASE_OBJECT*)psObj->psParent;
|
||||
const SDWORD posX = psParentObj->x + psObj->position.x,
|
||||
posY = psParentObj->y + psObj->position.y;
|
||||
|
||||
ASSERT( psParentObj != NULL,
|
||||
"renderAnimComponent: invalid parent object pointer" );
|
||||
ASSERT( psParentObj != NULL, "renderAnimComponent: invalid parent object pointer" );
|
||||
|
||||
/* only draw visible bits */
|
||||
if( (psParentObj->type == OBJ_DROID) && !godMode && !demoGetStatus())
|
||||
if( (psParentObj->type == OBJ_DROID) && !godMode && !demoGetStatus() &&
|
||||
((DROID*)psParentObj)->visible[selectedPlayer] != UBYTE_MAX )
|
||||
{
|
||||
if( ((DROID*)psParentObj)->visible[selectedPlayer] != UBYTE_MAX)
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
posX = psParentObj->x + psObj->position.x;
|
||||
posY = psParentObj->y + psObj->position.y;
|
||||
posZ = psParentObj->z + psObj->position.z;
|
||||
|
||||
/* render */
|
||||
if( clipXY( posX, posY ) )
|
||||
{
|
||||
/* get parent object translation */
|
||||
const Vector3i dv = {
|
||||
(psParentObj->x - player.p.x) - terrainMidX * TILE_UNITS,
|
||||
psParentObj->z,
|
||||
terrainMidY * TILE_UNITS - (psParentObj->y - player.p.z)
|
||||
};
|
||||
SDWORD iPlayer;
|
||||
UDWORD brightness, specular;
|
||||
|
||||
psParentObj->sDisplay.frameNumber = currentGameFrame;
|
||||
|
||||
/* Push the indentity matrix */
|
||||
iV_MatrixBegin();
|
||||
|
||||
/* get parent object translation */
|
||||
dv.x = (psParentObj->x - player.p.x) - terrainMidX*TILE_UNITS;
|
||||
dv.z = terrainMidY*TILE_UNITS - (psParentObj->y - player.p.z);
|
||||
dv.y = psParentObj->z;
|
||||
|
||||
/* parent object translation */
|
||||
iV_TRANSLATE(dv.x,dv.y,dv.z);
|
||||
iV_TRANSLATE(dv.x, dv.y, dv.z);
|
||||
|
||||
/* Get the x,z translation components */
|
||||
rx = player.p.x & (TILE_UNITS-1);
|
||||
rz = player.p.z & (TILE_UNITS-1);
|
||||
|
||||
/* Translate */
|
||||
iV_TRANSLATE(rx,0,-rz);
|
||||
iV_TRANSLATE(rx, 0, -rz);
|
||||
|
||||
/* parent object rotations */
|
||||
imdRot2.y = DEG( (int)psParentObj->direction );
|
||||
|
@ -1375,10 +1369,10 @@ renderAnimComponent( COMPONENT_OBJECT *psObj )
|
|||
/* Set frame numbers - look into this later?? FIXME!!!!!!!! */
|
||||
if( psParentObj->type == OBJ_DROID )
|
||||
{
|
||||
psDroid = (DROID *) psParentObj;
|
||||
DROID *psDroid = (DROID*)psParentObj;
|
||||
if ( psDroid->droidType == DROID_PERSON )
|
||||
{
|
||||
iPlayer = psParentObj->player-6;
|
||||
iPlayer = psParentObj->player - 6;
|
||||
pie_MatScale(75);
|
||||
}
|
||||
else
|
||||
|
@ -1398,15 +1392,16 @@ renderAnimComponent( COMPONENT_OBJECT *psObj )
|
|||
//brightness and fog calculation
|
||||
if (psParentObj->type == OBJ_STRUCTURE)
|
||||
{
|
||||
Vector3i zero = {0, 0, 0};
|
||||
const Vector3i zero = {0, 0, 0};
|
||||
Vector2i s = {0, 0};
|
||||
STRUCTURE *psStructure = (STRUCTURE*)psParentObj;
|
||||
|
||||
brightness = 200 - (100 - PERCENT(psStructure->body, structureBody(psStructure)));
|
||||
|
||||
psStructure = (STRUCTURE*)psParentObj;
|
||||
brightness = 200 - (100-PERCENT( psStructure->body ,
|
||||
structureBody(psStructure)));
|
||||
pie_RotateProject( &zero, &s );
|
||||
psStructure->sDisplay.screenX = s.x;
|
||||
psStructure->sDisplay.screenY = s.y;
|
||||
|
||||
targetAdd((BASE_OBJECT*)psStructure);
|
||||
}
|
||||
else
|
||||
|
@ -1418,7 +1413,8 @@ renderAnimComponent( COMPONENT_OBJECT *psObj )
|
|||
{
|
||||
brightness = avGetObjLightLevel((BASE_OBJECT*)psParentObj,brightness);
|
||||
}
|
||||
brightness = (UDWORD)lightDoFogAndIllumination((UBYTE)brightness,getCentreX()-posX,getCentreZ()-posY, &specular);
|
||||
|
||||
brightness = (UDWORD)lightDoFogAndIllumination((UBYTE)brightness, getCentreX()-posX, getCentreZ()-posY, &specular);
|
||||
|
||||
pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, specular, pie_NO_BILINEAR|pie_STATIC_SHADOW, 0);
|
||||
|
||||
|
@ -1576,11 +1572,11 @@ void displayProximityMsgs( void )
|
|||
|
||||
static void displayAnimation( ANIM_OBJECT * psAnimObj, BOOL bHoldOnFirstFrame )
|
||||
{
|
||||
UWORD i,uwFrame;
|
||||
Vector3i vecPos, vecRot, vecScale;
|
||||
COMPONENT_OBJECT *psComp;
|
||||
UWORD i, uwFrame;
|
||||
Vector3i vecPos, vecRot, vecScale;
|
||||
COMPONENT_OBJECT *psComp;
|
||||
|
||||
for ( i=0; i<psAnimObj->psAnim->uwObj; i++ )
|
||||
for ( i = 0; i < psAnimObj->psAnim->uwObj; i++ )
|
||||
{
|
||||
if ( bHoldOnFirstFrame == TRUE )
|
||||
{
|
||||
|
@ -1591,8 +1587,7 @@ static void displayAnimation( ANIM_OBJECT * psAnimObj, BOOL bHoldOnFirstFrame )
|
|||
}
|
||||
else
|
||||
{
|
||||
uwFrame = animObj_GetFrame3D( psAnimObj, i,
|
||||
&vecPos, &vecRot, &vecScale );
|
||||
uwFrame = anim_GetFrame3D( psAnimObj->psAnim, i, gameTime, psAnimObj->udwStartTime, psAnimObj->udwStartDelay, &vecPos, &vecRot, &vecScale );
|
||||
}
|
||||
|
||||
if ( uwFrame != ANIM_DELAYED )
|
||||
|
@ -3747,14 +3742,13 @@ void draw3dLine(Vector3i *src, Vector3i *dest, UBYTE col)
|
|||
|
||||
/* Get the onscreen corrdinates of a droid - so we can draw a bounding box - this need to be severely
|
||||
speeded up and the accuracy increased to allow variable size bouding boxes */
|
||||
void calcScreenCoords(DROID *psDroid)
|
||||
void calcScreenCoords(DROID *psDroid)
|
||||
{
|
||||
/* Get it's absolute dimensions */
|
||||
Vector3i center = {0, 0, 0};
|
||||
Vector2i center2 = {0, 0};
|
||||
const Vector3i zero = {0, 0, 0};
|
||||
Vector2i center = {0, 0};
|
||||
SDWORD cZ;
|
||||
UDWORD radius;
|
||||
POINT pt;
|
||||
UDWORD radius;
|
||||
|
||||
/* How big a box do we want - will ultimately be calculated using xmax, ymax, zmax etc */
|
||||
if(psDroid->droidType == DROID_TRANSPORTER)
|
||||
|
@ -3767,7 +3761,7 @@ void calcScreenCoords(DROID *psDroid)
|
|||
}
|
||||
|
||||
/* Pop matrices and get the screen corrdinates */
|
||||
cZ = pie_RotateProject( ¢er, ¢er2 );
|
||||
cZ = pie_RotateProject( &zero, ¢er );
|
||||
|
||||
//Watermelon:added a crash protection hack...
|
||||
if (cZ != 0)
|
||||
|
@ -3778,9 +3772,7 @@ void calcScreenCoords(DROID *psDroid)
|
|||
/* Deselect all the droids if we've released the drag box */
|
||||
if(dragBox3D.status == DRAG_RELEASED)
|
||||
{
|
||||
pt.x = center2.x;
|
||||
pt.y = center2.y;
|
||||
if(inQuad(&pt, &dragQuad) && psDroid->player == selectedPlayer)
|
||||
if(inQuad(¢er, &dragQuad) && psDroid->player == selectedPlayer)
|
||||
{
|
||||
//don't allow Transporter Droids to be selected here
|
||||
//unless we're in multiPlayer mode!!!!
|
||||
|
@ -3790,10 +3782,11 @@ void calcScreenCoords(DROID *psDroid)
|
|||
}
|
||||
}
|
||||
}
|
||||
center2.y -= 4;
|
||||
center.y -= 4;
|
||||
|
||||
/* Store away the screen coordinates so we can select the droids without doing a trasform */
|
||||
psDroid->sDisplay.screenX = center2.x;
|
||||
psDroid->sDisplay.screenY = center2.y;
|
||||
psDroid->sDisplay.screenX = center.x;
|
||||
psDroid->sDisplay.screenY = center.y;
|
||||
psDroid->sDisplay.screenR = radius;
|
||||
}
|
||||
|
||||
|
@ -3953,7 +3946,7 @@ static void preprocessTiles(void)
|
|||
/* TODO This is slow - speed it up */
|
||||
static void locateMouse(void)
|
||||
{
|
||||
const POINT pt = {mouseXPos, mouseYPos};
|
||||
const Vector2i pt = {mouseXPos, mouseYPos};
|
||||
unsigned int i;
|
||||
int nearestZ = INT32_MAX;
|
||||
|
||||
|
@ -4435,7 +4428,7 @@ void drawTerrainWaterTile(UDWORD i, UDWORD j)
|
|||
psTile = mapTile(actualX,actualY);
|
||||
|
||||
// If it's a water tile then draw the water
|
||||
if (TERRAIN_TYPE(psTile) == TER_WATER)
|
||||
if (TERRAIN_TYPE(psTile) == TER_WATER)
|
||||
{
|
||||
/* Used to calculate texture coordinates, which are 0-255 in value */
|
||||
const UDWORD xMult = (256 / TILES_IN_PAGE_COLUMN);
|
||||
|
|
|
@ -51,7 +51,7 @@ extern void renderProximityMsg ( PROXIMITY_DISPLAY *psProxDisp);
|
|||
extern void drawTerrainTile ( UDWORD i, UDWORD j, BOOL onWaterEdge );
|
||||
extern void drawTerrainWaterTile ( UDWORD i, UDWORD j);
|
||||
extern void renderProjectile ( PROJ_OBJECT *psCurr);
|
||||
extern void renderAnimComponent ( COMPONENT_OBJECT *psObj );
|
||||
extern void renderAnimComponent ( const COMPONENT_OBJECT *psObj );
|
||||
extern void renderDeliveryPoint ( FLAG_POSITION *psPosition );
|
||||
extern void debugToggleSensorDisplay ( void );
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#define NUM_DIR 8
|
||||
// Convert a direction into an offset
|
||||
// dir 0 => x = 0, y = -1
|
||||
static POINT aDirOffset[NUM_DIR] =
|
||||
static Vector2i aDirOffset[NUM_DIR] =
|
||||
{
|
||||
{ 0, 1},
|
||||
{-1, 1},
|
||||
|
|
|
@ -114,12 +114,12 @@ BOOL CancelPressed(void)
|
|||
|
||||
void processFrontendSnap(BOOL bHideCursor)
|
||||
{
|
||||
static POINT point,opoint;
|
||||
static Vector2i point = {0, 0}, old_point = {0, 0};
|
||||
|
||||
point.x = mouseX();
|
||||
point.y = mouseY();
|
||||
|
||||
if(point.x != opoint.x || point.y != opoint.y)
|
||||
if(point.x != old_point.x || point.y != old_point.y)
|
||||
{
|
||||
bUsingKeyboard = FALSE;
|
||||
}
|
||||
|
@ -128,26 +128,26 @@ void processFrontendSnap(BOOL bHideCursor)
|
|||
{
|
||||
if(keyPressed(KEY_RIGHTARROW))
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
GotoDirectionalSnap(&InterfaceSnap,SNAP_RIGHT,0,0);
|
||||
bUsingKeyboard = TRUE;
|
||||
GotoDirectionalSnap(&InterfaceSnap, SNAP_RIGHT, 0, 0);
|
||||
}
|
||||
else if(keyPressed(KEY_LEFTARROW))
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
GotoDirectionalSnap(&InterfaceSnap,SNAP_LEFT,0,0);
|
||||
bUsingKeyboard = TRUE;
|
||||
GotoDirectionalSnap(&InterfaceSnap, SNAP_LEFT, 0, 0);
|
||||
}
|
||||
}
|
||||
if(keyPressed(KEY_UPARROW))
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
bUsingSlider = FALSE;
|
||||
GotoDirectionalSnap(&InterfaceSnap,SNAP_UP,0,0);
|
||||
bUsingKeyboard = TRUE;
|
||||
bUsingSlider = FALSE;
|
||||
GotoDirectionalSnap(&InterfaceSnap, SNAP_UP, 0, 0);
|
||||
}
|
||||
else if(keyPressed(KEY_DOWNARROW))
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
bUsingSlider = FALSE;
|
||||
GotoDirectionalSnap(&InterfaceSnap,SNAP_DOWN,0,0);
|
||||
bUsingKeyboard = TRUE;
|
||||
bUsingSlider = FALSE;
|
||||
GotoDirectionalSnap(&InterfaceSnap, SNAP_DOWN, 0, 0);
|
||||
}
|
||||
|
||||
if (!keyDown(KEY_LALT) && !keyDown(KEY_RALT)/* Check for toggling display mode */
|
||||
|
@ -171,8 +171,8 @@ void processFrontendSnap(BOOL bHideCursor)
|
|||
bUsingKeyboard = FALSE;
|
||||
}
|
||||
|
||||
opoint.x = mouseX();
|
||||
opoint.y = mouseY();
|
||||
old_point.x = mouseX();
|
||||
old_point.y = mouseY();
|
||||
}
|
||||
|
||||
|
||||
|
|
12
src/game.c
12
src/game.c
|
@ -395,7 +395,7 @@ typedef struct save_game_v19
|
|||
#define GAME_SAVE_V20 \
|
||||
GAME_SAVE_V19; \
|
||||
UBYTE bDroidsToSafetyFlag; \
|
||||
POINT asVTOLReturnPos[MAX_PLAYERS]
|
||||
Vector2i asVTOLReturnPos[MAX_PLAYERS]
|
||||
|
||||
typedef struct save_game_v20
|
||||
{
|
||||
|
@ -1697,7 +1697,7 @@ BOOL loadGame(char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL UserSaveGa
|
|||
setDroidsToSafetyFlag(saveGameData.bDroidsToSafetyFlag);
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
memcpy(&asVTOLReturnPos[inc],&(saveGameData.asVTOLReturnPos[inc]),sizeof(POINT));
|
||||
memcpy(&asVTOLReturnPos[inc], &(saveGameData.asVTOLReturnPos[inc]), sizeof(Vector2i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1705,7 +1705,7 @@ BOOL loadGame(char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL UserSaveGa
|
|||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
memcpy(&asRunData[inc],&(saveGameData.asRunData[inc]),sizeof(RUN_DATA));
|
||||
memcpy(&asRunData[inc], &(saveGameData.asRunData[inc]), sizeof(RUN_DATA));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3922,7 +3922,7 @@ BOOL gameLoadV(char *pFileData, UDWORD filesize, UDWORD version)
|
|||
setDroidsToSafetyFlag(psSaveGame->bDroidsToSafetyFlag);
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
memcpy(&asVTOLReturnPos[inc],&(psSaveGame->asVTOLReturnPos[inc]),sizeof(POINT));
|
||||
memcpy(&asVTOLReturnPos[inc], &(psSaveGame->asVTOLReturnPos[inc]), sizeof(Vector2i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3930,7 +3930,7 @@ BOOL gameLoadV(char *pFileData, UDWORD filesize, UDWORD version)
|
|||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
memcpy(&asRunData[inc],&(psSaveGame->asRunData[inc]),sizeof(RUN_DATA));
|
||||
memcpy(&asRunData[inc], &(psSaveGame->asRunData[inc]), sizeof(RUN_DATA));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4244,7 +4244,7 @@ BOOL writeGameFile(char *pFileName, SDWORD saveType)
|
|||
psSaveGame->bDroidsToSafetyFlag = (UBYTE)getDroidsToSafetyFlag();
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
{
|
||||
memcpy(&(psSaveGame->asVTOLReturnPos[i]),&asVTOLReturnPos[i],sizeof(POINT));
|
||||
memcpy(&(psSaveGame->asVTOLReturnPos[i]), &asVTOLReturnPos[i], sizeof(Vector2i));
|
||||
}
|
||||
|
||||
//version 22
|
||||
|
|
|
@ -117,7 +117,7 @@ UDWORD bestSoFar;
|
|||
|
||||
/* Returns non-zero if a point is in a 4 sided polygon */
|
||||
/* See header file for definition of QUAD */
|
||||
int inQuad(const POINT *pt, const QUAD *quad)
|
||||
int inQuad(const Vector2i *pt, const QUAD *quad)
|
||||
{
|
||||
int i, j, c = 0;
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
|
||||
typedef struct _t_quad
|
||||
{
|
||||
POINT coords[4];
|
||||
Vector2i coords[4];
|
||||
} QUAD;
|
||||
|
||||
extern UDWORD adjustDirection( SDWORD present, SDWORD difference );
|
||||
extern SDWORD calcDirection( UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1 );
|
||||
extern void initBulletTable( void );
|
||||
extern int inQuad( const POINT *pt, const QUAD *quad );
|
||||
extern int inQuad( const Vector2i *pt, const QUAD *quad );
|
||||
extern DROID *getNearestDroid( UDWORD x, UDWORD y, BOOL bSelected );
|
||||
extern BOOL droidOnScreen( DROID *psDroid, SDWORD tolerance );
|
||||
|
||||
|
|
|
@ -437,7 +437,7 @@ static UBYTE ProductionRun = 1;
|
|||
static BASE_OBJECT *apsPreviousObj[IOBJ_MAX];
|
||||
|
||||
/* The jump position for each object on the base bar */
|
||||
static POINT asJumpPos[IOBJ_MAX];
|
||||
static Vector2i asJumpPos[IOBJ_MAX];
|
||||
|
||||
// whether to reopen the build menu
|
||||
//static BOOL bReopenBuildMenu = FALSE;
|
||||
|
@ -2121,14 +2121,14 @@ INT_RETVAL intRunWidgets(void)
|
|||
if (psStructure && psTile->psObject->type == OBJ_STRUCTURE)
|
||||
{
|
||||
removeStruct(psStructure, TRUE);
|
||||
}
|
||||
else if (psFeature && psTile->psObject->type == OBJ_FEATURE)
|
||||
}
|
||||
else if (psFeature && psTile->psObject->type == OBJ_FEATURE)
|
||||
{
|
||||
removeFeature(psFeature);
|
||||
}
|
||||
psStructure = NULL;
|
||||
} else {
|
||||
psStructure = buildStructure(psBuilding, structX, structY,
|
||||
psStructure = buildStructure(psBuilding, structX, structY,
|
||||
selectedPlayer, FALSE);
|
||||
}
|
||||
if (psStructure)
|
||||
|
|
|
@ -196,7 +196,7 @@ static BOOL bDroidsToSafety;
|
|||
static BOOL g_bMissionResult;
|
||||
|
||||
// return positions for vtols
|
||||
POINT asVTOLReturnPos[MAX_PLAYERS];
|
||||
Vector2i asVTOLReturnPos[MAX_PLAYERS];
|
||||
|
||||
|
||||
static UBYTE missionCountDown;
|
||||
|
@ -363,7 +363,7 @@ void initMission(void)
|
|||
}
|
||||
|
||||
// init the vtol return pos
|
||||
memset(asVTOLReturnPos, 0, sizeof(POINT)*MAX_PLAYERS);
|
||||
memset(asVTOLReturnPos, 0, sizeof(Vector2i)*MAX_PLAYERS);
|
||||
|
||||
bDroidsToSafety = FALSE;
|
||||
|
||||
|
@ -378,7 +378,7 @@ void initMission(void)
|
|||
// reset the vtol landing pos
|
||||
void resetVTOLLandingPos(void)
|
||||
{
|
||||
memset(asVTOLReturnPos, 0, sizeof(POINT)*MAX_PLAYERS);
|
||||
memset(asVTOLReturnPos, 0, sizeof(Vector2i)*MAX_PLAYERS);
|
||||
}
|
||||
|
||||
//this is called everytime the game is quit
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
#include "missiondef.h"
|
||||
#include "group.h"
|
||||
|
||||
/*the number of areas that can be defined to prevent buildings being placed -
|
||||
/*the number of areas that can be defined to prevent buildings being placed -
|
||||
used for Transporter Landing Zones 0-7 are for players, 8 = LIMBO_LANDING*/
|
||||
#define MAX_NOGO_AREAS 9
|
||||
#define LIMBO_LANDING 8
|
||||
|
||||
|
||||
// Set by scrFlyInTransporter. True if were currenly tracking the transporter.
|
||||
extern BOOL bTrackingTransporter;
|
||||
|
||||
|
@ -43,7 +43,7 @@ extern MISSION mission;
|
|||
extern BOOL offWorldKeepLists;
|
||||
extern DROID *apsLimboDroids[MAX_PLAYERS];
|
||||
// return positions for vtols
|
||||
extern POINT asVTOLReturnPos[MAX_PLAYERS];
|
||||
extern Vector2i asVTOLReturnPos[MAX_PLAYERS];
|
||||
|
||||
extern void initMission(void);
|
||||
extern BOOL missionShutDown(void);
|
||||
|
@ -109,9 +109,9 @@ extern void intRemoveMissionResultNoAnim (void);
|
|||
extern void intProcessMissionResult (UDWORD id);
|
||||
extern void intRunMissionResult (void);
|
||||
|
||||
extern void unloadTransporter(DROID *psTransporter, UDWORD x, UDWORD y,
|
||||
extern void unloadTransporter(DROID *psTransporter, UDWORD x, UDWORD y,
|
||||
BOOL goingHome);
|
||||
/*sets the appropriate pause states for when the interface is up but the
|
||||
/*sets the appropriate pause states for when the interface is up but the
|
||||
game needs to be paused*/
|
||||
extern void setMissionPauseState(void);
|
||||
/*resets the pause states */
|
||||
|
@ -120,13 +120,13 @@ extern void resetMissionPauseState(void);
|
|||
extern UWORD getLandingX( SDWORD iPlayer );
|
||||
//returns the y coord for where the Transporter can land
|
||||
extern UWORD getLandingY( SDWORD iPlayer );
|
||||
/*checks that the timer has been set and that a Transporter exists before
|
||||
/*checks that the timer has been set and that a Transporter exists before
|
||||
adding the timer button*/
|
||||
extern void addTransporterTimerInterface(void);
|
||||
extern void intRemoveTransporterTimer(void);
|
||||
/*update routine for mission details */
|
||||
extern void missionTimerUpdate(void);
|
||||
/*checks the time has been set and then adds the timer if not already on
|
||||
/*checks the time has been set and then adds the timer if not already on
|
||||
the display*/
|
||||
extern void addMissionTimerInterface(void);
|
||||
extern void intRemoveMissionTimer(void);
|
||||
|
@ -160,11 +160,11 @@ extern UDWORD missionGetReinforcementTime(void);
|
|||
|
||||
/*builds a droid back at the home base whilst on a mission - stored in a list made
|
||||
available to the transporter interface*/
|
||||
extern DROID * buildMissionDroid(DROID_TEMPLATE *psTempl, UDWORD x, UDWORD y,
|
||||
extern DROID * buildMissionDroid(DROID_TEMPLATE *psTempl, UDWORD x, UDWORD y,
|
||||
UDWORD player);
|
||||
|
||||
//This is just a very big number - bigger than a map width/height could ever be!
|
||||
#define INVALID_XY (512 * 127)
|
||||
#define INVALID_XY (512 * 127)
|
||||
|
||||
extern void missionSetTransporterEntry( SDWORD iPlayer, SDWORD iEntryTileX, SDWORD iEntryTileY );
|
||||
extern void missionSetTransporterExit( SDWORD iPlayer, SDWORD iExitTileX, SDWORD iExitTileY );
|
||||
|
@ -176,8 +176,8 @@ extern void setDroidsToSafetyFlag(BOOL set);
|
|||
extern BOOL getDroidsToSafetyFlag(void);
|
||||
//checks to see if the player has any droids (except Transporters left)
|
||||
extern BOOL missionDroidsRemaining(UDWORD player);
|
||||
/*called when a Transporter gets to the edge of the world and the droids are
|
||||
being flown to safety. The droids inside the Transporter are placed into the
|
||||
/*called when a Transporter gets to the edge of the world and the droids are
|
||||
being flown to safety. The droids inside the Transporter are placed into the
|
||||
mission list for later use*/
|
||||
extern void moveDroidsToSafety(DROID *psTransporter);
|
||||
|
||||
|
@ -201,15 +201,15 @@ extern void setMissionCheatTime(BOOL bCheating);
|
|||
|
||||
|
||||
#define MISSIONRES_X 20 // pos & size of box.
|
||||
#define MISSIONRES_Y 380
|
||||
#define MISSIONRES_W 600
|
||||
#define MISSIONRES_Y 380
|
||||
#define MISSIONRES_W 600
|
||||
#define MISSIONRES_H 80
|
||||
|
||||
|
||||
|
||||
#define MISSIONRES_TITLE_X 20
|
||||
#define MISSIONRES_TITLE_Y 20
|
||||
#define MISSIONRES_TITLE_W 600
|
||||
#define MISSIONRES_TITLE_X 20
|
||||
#define MISSIONRES_TITLE_Y 20
|
||||
#define MISSIONRES_TITLE_W 600
|
||||
#define MISSIONRES_TITLE_H 40
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
//
|
||||
// orderdef.h
|
||||
// orderdef.h
|
||||
//
|
||||
// order releated structures.
|
||||
|
||||
|
@ -28,17 +28,15 @@
|
|||
// data for barbarians retreating
|
||||
typedef struct _run_data
|
||||
{
|
||||
POINT sPos; // position to retreat to
|
||||
UBYTE forceLevel; // number of units below which might run
|
||||
UBYTE healthLevel; // %health value below which to turn and run - FOR GROUPS ONLY
|
||||
UBYTE leadership; // basic chance to run
|
||||
Vector2i sPos; // position to retreat to
|
||||
UBYTE forceLevel; // number of units below which might run
|
||||
UBYTE healthLevel; // %health value below which to turn and run - FOR GROUPS ONLY
|
||||
UBYTE leadership; // basic chance to run
|
||||
} RUN_DATA;
|
||||
|
||||
typedef struct _droid_order_data
|
||||
{
|
||||
SDWORD order;
|
||||
//UDWORD x,y;
|
||||
//UDWORD x2,y2;
|
||||
UWORD x,y;
|
||||
UWORD x2,y2;
|
||||
//Watermelon:multiple target info;
|
||||
|
@ -47,7 +45,7 @@ typedef struct _droid_order_data
|
|||
} DROID_ORDER_DATA;
|
||||
|
||||
|
||||
extern RUN_DATA asRunData[MAX_PLAYERS]; // retreat positions for the players
|
||||
extern RUN_DATA asRunData[MAX_PLAYERS]; // retreat positions for the players
|
||||
extern void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder);
|
||||
|
||||
#endif
|
||||
|
|
144
src/structure.c
144
src/structure.c
|
@ -1852,7 +1852,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
|
|||
{
|
||||
ASSERT(!(TILE_HAS_STRUCTURE(psTile)),
|
||||
"buildStructure: building %s at (%d, %d) but found %s already at (%d, %d)",
|
||||
pStructureType->pName, mapX, mapY,
|
||||
pStructureType->pName, mapX, mapY,
|
||||
getTileStructure(mapX + width, mapY + breadth)->pStructureType->pName,
|
||||
mapX + width, mapY + breadth);
|
||||
}
|
||||
|
@ -1860,7 +1860,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
|
|||
psTile->psObject = (BASE_OBJECT*)psBuilding;
|
||||
|
||||
// if it's a tall structure then flag it in the map.
|
||||
if(psBuilding->sDisplay.imd->ymax > TALLOBJECT_YMAX)
|
||||
if(psBuilding->sDisplay.imd->ymax > TALLOBJECT_YMAX)
|
||||
{
|
||||
SET_TILE_TALLSTRUCTURE(psTile);
|
||||
}
|
||||
|
@ -6523,110 +6523,76 @@ BOOL validStructResistance(STRUCTURE *psStruct)
|
|||
|
||||
|
||||
/*Access functions for the upgradeable stats of a structure*/
|
||||
UDWORD structureBody(STRUCTURE *psStructure)
|
||||
UDWORD structureBody(const STRUCTURE *psStructure)
|
||||
{
|
||||
STRUCTURE_STATS *psStats;
|
||||
UBYTE player;//, i;
|
||||
|
||||
psStats = psStructure->pStructureType;
|
||||
player = psStructure->player;
|
||||
const STRUCTURE_STATS *psStats = psStructure->pStructureType;
|
||||
const UBYTE player = psStructure->player;
|
||||
|
||||
switch(psStats->type)
|
||||
{
|
||||
//wall/defence structures
|
||||
case REF_DEFENSE:
|
||||
case REF_WALL:
|
||||
case REF_WALLCORNER:
|
||||
case REF_BLASTDOOR:
|
||||
return (psStats->bodyPoints + (psStats->bodyPoints *
|
||||
asWallDefenceUpgrade[player].body)/100);
|
||||
break;
|
||||
default:
|
||||
//all other structures
|
||||
return (structureBaseBody(psStructure) + (structureBaseBody(psStructure) *
|
||||
asStructureUpgrade[player].body)/100);
|
||||
break;
|
||||
// wall/defence structures:
|
||||
case REF_DEFENSE:
|
||||
case REF_WALL:
|
||||
case REF_WALLCORNER:
|
||||
case REF_BLASTDOOR:
|
||||
return psStats->bodyPoints + (psStats->bodyPoints * asWallDefenceUpgrade[player].body)/100;
|
||||
// all other structures:
|
||||
default:
|
||||
return structureBaseBody(psStructure) + (structureBaseBody(psStructure) * asStructureUpgrade[player].body)/100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*this returns the Base Body points of a structure - regardless of upgrade*/
|
||||
UDWORD structureBaseBody(STRUCTURE *psStructure)
|
||||
UDWORD structureBaseBody(const STRUCTURE *psStructure)
|
||||
{
|
||||
STRUCTURE_STATS *psStats;
|
||||
UBYTE player, capacity;
|
||||
UDWORD body;
|
||||
const STRUCTURE_STATS *psStats = psStructure->pStructureType;
|
||||
|
||||
ASSERT( psStructure != NULL,
|
||||
"structureBaseBody: invalid structure pointer" );
|
||||
|
||||
psStats = psStructure->pStructureType;
|
||||
player = psStructure->player;
|
||||
ASSERT( psStructure != NULL, "structureBaseBody: invalid structure pointer" );
|
||||
|
||||
switch(psStats->type)
|
||||
{
|
||||
//modules may be attached
|
||||
case REF_FACTORY:
|
||||
case REF_VTOL_FACTORY:
|
||||
ASSERT( psStructure->pFunctionality != NULL,
|
||||
"structureBaseBody: invalid structure functionality pointer" );
|
||||
if (((FACTORY *)psStructure->pFunctionality)->capacity > 0)
|
||||
{
|
||||
body = 0;
|
||||
capacity = ((FACTORY *)psStructure->pFunctionality)->capacity;
|
||||
while (capacity)
|
||||
// modules may be attached:
|
||||
case REF_FACTORY:
|
||||
case REF_VTOL_FACTORY:
|
||||
ASSERT( psStructure->pFunctionality != NULL, "structureBaseBody: invalid structure functionality pointer" );
|
||||
if (((FACTORY *)psStructure->pFunctionality)->capacity > 0)
|
||||
{
|
||||
body += asStructureStats[factoryModuleStat].bodyPoints;
|
||||
capacity--;
|
||||
//add on the default for the factory
|
||||
return psStats->bodyPoints + asStructureStats[factoryModuleStat].bodyPoints * ((FACTORY*)psStructure->pFunctionality)->capacity;
|
||||
}
|
||||
//add on the default for the factory
|
||||
body += psStats->bodyPoints;
|
||||
return body;
|
||||
}
|
||||
else
|
||||
{
|
||||
//no modules
|
||||
else
|
||||
{
|
||||
//no modules
|
||||
return psStats->bodyPoints;
|
||||
}
|
||||
case REF_RESEARCH:
|
||||
ASSERT( psStructure->pFunctionality != NULL, "structureBaseBody: invalid structure functionality pointer" );
|
||||
if (((RESEARCH_FACILITY *)psStructure->pFunctionality)->capacity > 0)
|
||||
{
|
||||
//add on the default for the factory
|
||||
return psStats->bodyPoints + asStructureStats[researchModuleStat].bodyPoints;
|
||||
}
|
||||
else
|
||||
{
|
||||
//no modules
|
||||
return psStats->bodyPoints;
|
||||
}
|
||||
case REF_POWER_GEN:
|
||||
ASSERT( psStructure->pFunctionality != NULL, "structureBaseBody: invalid structure functionality pointer" );
|
||||
if (((POWER_GEN *)psStructure->pFunctionality)->capacity > 0)
|
||||
{
|
||||
//add on the default for the factory
|
||||
return psStats->bodyPoints + asStructureStats[powerModuleStat].bodyPoints;
|
||||
}
|
||||
else
|
||||
{
|
||||
//no modules
|
||||
return psStats->bodyPoints;
|
||||
}
|
||||
// all other structures:
|
||||
default:
|
||||
return psStats->bodyPoints;
|
||||
}
|
||||
break;
|
||||
case REF_RESEARCH:
|
||||
ASSERT( psStructure->pFunctionality != NULL,
|
||||
"structureBaseBody: invalid structure functionality pointer" );
|
||||
if (((RESEARCH_FACILITY *)psStructure->pFunctionality)->capacity > 0)
|
||||
{
|
||||
body = 0;
|
||||
body = asStructureStats[researchModuleStat].bodyPoints;
|
||||
//add on the default for the factory
|
||||
body += psStats->bodyPoints;
|
||||
return body;
|
||||
}
|
||||
else
|
||||
{
|
||||
//no modules
|
||||
return psStats->bodyPoints;
|
||||
}
|
||||
break;
|
||||
case REF_POWER_GEN:
|
||||
ASSERT( psStructure->pFunctionality != NULL,
|
||||
"structureBaseBody: invalid structure functionality pointer" );
|
||||
if (((POWER_GEN *)psStructure->pFunctionality)->capacity > 0)
|
||||
{
|
||||
body = 0;
|
||||
body = asStructureStats[powerModuleStat].bodyPoints;
|
||||
//add on the default for the factory
|
||||
body += psStats->bodyPoints;
|
||||
return body;
|
||||
}
|
||||
else
|
||||
{
|
||||
//no modules
|
||||
return psStats->bodyPoints;
|
||||
}
|
||||
|
||||
//all other structures
|
||||
default:
|
||||
return psStats->bodyPoints;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -270,11 +270,11 @@ stat type*/
|
|||
extern BOOL checkSpecificStructExists(UDWORD structInc, UDWORD player);
|
||||
|
||||
/*Access functions for the upgradeable stats of a structure*/
|
||||
extern UDWORD structureBody(STRUCTURE * psStruct);
|
||||
extern UDWORD structureBody(const STRUCTURE *psStruct);
|
||||
extern UDWORD structureArmour(STRUCTURE_STATS *psStats, UBYTE player);
|
||||
extern UDWORD structureResistance(STRUCTURE_STATS *psStats, UBYTE player);
|
||||
/*this returns the Base Body points of a structure - regardless of upgrade*/
|
||||
extern UDWORD structureBaseBody(STRUCTURE *psStructure);
|
||||
extern UDWORD structureBaseBody(const STRUCTURE *psStructure);
|
||||
|
||||
extern void hqReward(UBYTE losingPlayer, UBYTE rewardPlayer);
|
||||
|
||||
|
|
Loading…
Reference in New Issue