- Replaced various vectors with Vector3i and Vector3f (idea by Watermelon)
- Vector3i from lib/ivis also used in lib/audio, maybe want to move it to some more generic place? - Replace iPoint with Vector2i - Remove additional integer type declarations from pietypes.h - Rename all iSprite to iTexture - Various warning fixes: Unsigned/signed comparisons, uninitialized variables, declared but not defined symbols - Replace DEBUG_BLOCK with DEBUG_MALLOC (it was virtually the same) git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1245 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
fb2b443b9a
commit
2a74242eb3
|
@ -132,7 +132,7 @@ BOOL blkCreate(BLOCK_HEAP **ppsHeap, SDWORD init, SDWORD ext)
|
|||
(*ppsHeap)->psBlocks->pFree = (*ppsHeap)->psBlocks->pMem;
|
||||
(*ppsHeap)->psBlocks->psNext = NULL;
|
||||
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
(*ppsHeap)->pFileName = pCallFileName;
|
||||
(*ppsHeap)->line = callLine;
|
||||
(*ppsHeap)->psMemTreap = NULL;
|
||||
|
@ -150,7 +150,7 @@ void blkDestroy(BLOCK_HEAP *psHeap)
|
|||
{
|
||||
BLOCK_HEAP_MEM *psCurr, *psNext;
|
||||
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
if (psHeap->psMemTreap != NULL)
|
||||
{
|
||||
debug( LOG_NEVER, "blkDestroy: %s at %d: memory allocated :\n", psHeap->pFileName, psHeap->line );
|
||||
|
@ -171,15 +171,16 @@ void blkDestroy(BLOCK_HEAP *psHeap)
|
|||
RFREE(psHeap);
|
||||
}
|
||||
|
||||
void memMemoryDump(MEM_NODE *Node);
|
||||
|
||||
#ifdef DEBUG_MALLOC
|
||||
void memMemoryDump(MEM_NODE *Node);
|
||||
#endif
|
||||
|
||||
void blkPrintDetails(BLOCK_HEAP *psHeap)
|
||||
{
|
||||
if (psHeap!=NULL)
|
||||
{
|
||||
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
UDWORD Left = (UDWORD)((psHeap->psBlocks->pMem)+(psHeap->psBlocks->size)-(psHeap->psBlocks->pFree));
|
||||
debug( LOG_NEVER, "ptr=%p init=%d ext=%d used=%d (Start=$%p Free=$%p Left=%d)\n", psHeap,psHeap->init, psHeap->ext,psHeap->TotalAllocated, psHeap->psBlocks->pMem, psHeap->psBlocks->pFree, Left );
|
||||
memMemoryDump(psHeap->psMemTreap);
|
||||
|
@ -243,7 +244,7 @@ BOOL blkSpecialFree(BLOCK_HEAP *psHeap, void *Ptr)
|
|||
|
||||
if ((UDWORD)psCurr->pLastAllocated == RequestedFreeMem)
|
||||
{
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
|
||||
UDWORD BlockSize=((UDWORD)psCurr->pFree)-RequestedFreeMem;
|
||||
debug( LOG_NEVER, "FREED %d block bytes\n", BlockSize ); // del me now !
|
||||
|
@ -268,17 +269,14 @@ void *blkAlloc(BLOCK_HEAP *psHeap, SDWORD size)
|
|||
void *pAlloc;
|
||||
BLOCK_HEAP_MEM *psCurr, *psNew;
|
||||
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
SDWORD allocSize;
|
||||
MEM_NODE *psNode;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Round up to nearest 4 bytes ( 32 bit align ).. Neaded for Playstation.. PD.
|
||||
size = (size + 3) & 0xfffffffc;
|
||||
|
||||
|
||||
// can't allocate 0 bytes
|
||||
if (size <= 0)
|
||||
{
|
||||
|
@ -286,7 +284,7 @@ void *blkAlloc(BLOCK_HEAP *psHeap, SDWORD size)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
// see if free has been called for this block
|
||||
if (psHeap->free)
|
||||
{
|
||||
|
@ -353,7 +351,7 @@ void *blkAlloc(BLOCK_HEAP *psHeap, SDWORD size)
|
|||
psCurr->psNext = psNew;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
if (!pAlloc)
|
||||
{
|
||||
// failed to allocate the memory
|
||||
|
@ -403,7 +401,7 @@ void *blkAlloc(BLOCK_HEAP *psHeap, SDWORD size)
|
|||
// this only does anything whith DEBUG_BLOCK defined
|
||||
void blkFree(BLOCK_HEAP *psHeap, void *pMemToFree)
|
||||
{
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
MEM_NODE sNode, *psDeleted;
|
||||
SDWORD i, InvalidBottom, InvalidTop;
|
||||
UBYTE *pMemBase;
|
||||
|
@ -508,7 +506,7 @@ void blkReset(BLOCK_HEAP *psHeap)
|
|||
SDWORD block=0, alloc=0;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
if (psHeap->psMemTreap != NULL)
|
||||
{
|
||||
debug( LOG_NEVER, "blkReset: %s at %d: memory allocated :\n", psHeap->pFileName, psHeap->line );
|
||||
|
@ -533,7 +531,7 @@ void blkReset(BLOCK_HEAP *psHeap)
|
|||
alloc += psCurr->pFree - psCurr->pMem;
|
||||
block += psCurr->size;
|
||||
#endif
|
||||
#if defined(DEBUG_BLOCK) && MEMORY_SET
|
||||
#if defined(DEBUG_MALLOC) && MEMORY_SET
|
||||
memset(psCurr->pMem, FREE_BYTE, psCurr->size);
|
||||
#endif
|
||||
psCurr->pFree = psCurr->pMem;
|
||||
|
@ -569,7 +567,7 @@ BLOCK_HEAP *blkFind(void *pPtr)
|
|||
// check if a pointer is valid in a block
|
||||
BOOL blkPointerValid(BLOCK_HEAP *psHeap, void *pData, SDWORD size)
|
||||
{
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
MEM_NODE sNode;
|
||||
void *Tmp;
|
||||
|
||||
|
@ -606,7 +604,7 @@ BOOL blkPointerValid(BLOCK_HEAP *psHeap, void *pData, SDWORD size)
|
|||
// check if a pointer is valid in any currently allocated block
|
||||
BOOL blkPointerValidAll(void *pData, SDWORD size)
|
||||
{
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
BLOCK_HEAP *psCurr;
|
||||
|
||||
for(psCurr=psBlockList; psCurr; psCurr=psCurr->psNext)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
/*! \file block.h
|
||||
* \brief Routines to allocate memory from one large block.
|
||||
*
|
||||
*
|
||||
* Any memory allocated is only available to be reallocated after
|
||||
* the whole block has been reset.
|
||||
*/
|
||||
|
@ -29,11 +29,6 @@
|
|||
#include "mem.h"
|
||||
#include "memint.h"
|
||||
|
||||
// control whether the debugging block malloc is used
|
||||
#if DEBUG_MALLOC
|
||||
#define DEBUG_BLOCK
|
||||
#endif
|
||||
|
||||
/**********************************************************************************/
|
||||
/* type definitions */
|
||||
|
||||
|
@ -51,13 +46,13 @@ typedef struct _block_heap
|
|||
{
|
||||
SDWORD init, ext; // initial and extension block sizes
|
||||
BLOCK_HEAP_MEM *psBlocks;
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
const char *pFileName;
|
||||
SDWORD line;
|
||||
MEM_NODE *psMemTreap; // treap of the memory blocks
|
||||
BOOL free; // whether free has been called for this block
|
||||
const char *pFreeFile; // where the last free was called from
|
||||
SDWORD freeLine;
|
||||
SDWORD freeLine;
|
||||
UDWORD TotalAllocated; // Total amount of bytes used in the block (sum of all alloc's)
|
||||
#endif
|
||||
|
||||
|
@ -113,7 +108,7 @@ void blockUnsuspendUsage(void);
|
|||
/* macro definitions */
|
||||
|
||||
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
|
||||
#define BLOCK_CREATE(ppsHeap, init, ext) \
|
||||
(blkCallPos(__FILE__, __LINE__), \
|
||||
|
|
|
@ -361,7 +361,7 @@ static void setFatalSignalHandler(SigActionHandler signalHandler)
|
|||
* \param siginfo Signal info
|
||||
* \param sigcontext Signal context
|
||||
*/
|
||||
static void posixExceptionHandler(int signum, siginfo_t * siginfo, void * sigcontext)
|
||||
static void posixExceptionHandler(int signum, siginfo_t * siginfo, WZ_DECL_UNUSED void * sigcontext)
|
||||
{
|
||||
static sig_atomic_t allreadyRunning = 0;
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ static MEM_NODE *psMemRoot = NULL;
|
|||
|
||||
/* The current block heap to use instead of MALLOC */
|
||||
static BLOCK_HEAP *psCurrBlockHeap;
|
||||
void memMemoryDump(MEM_NODE *Node);
|
||||
|
||||
/* Initialise the memory system */
|
||||
BOOL memInitialise(void)
|
||||
|
@ -382,7 +381,7 @@ BOOL memPointerValid(void *pPtr, size_t size)
|
|||
}
|
||||
|
||||
// check the block heaps as well (if the code is there)
|
||||
#ifdef DEBUG_BLOCK
|
||||
#ifdef DEBUG_MALLOC
|
||||
return blkPointerValidAll(pPtr, size);
|
||||
#else
|
||||
return FALSE;
|
||||
|
@ -430,10 +429,10 @@ static UDWORD MemTotalModules;
|
|||
static UDWORD MemTotalAllocated;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_MALLOC
|
||||
/* Recursive function to total up the amount of mem allocated */
|
||||
static void memSummary(MEM_NODE *psRoot)
|
||||
{
|
||||
#ifdef DEBUG_MALLOC
|
||||
|
||||
// bsort
|
||||
if (psRoot)
|
||||
|
@ -463,22 +462,18 @@ static void memSummary(MEM_NODE *psRoot)
|
|||
MemModuleInfo[MemTotalModules].Total=psRoot->size;
|
||||
MemTotalModules++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
memSummary((MEM_NODE *)psRoot->psLeft);
|
||||
memSummary((MEM_NODE *)psRoot->psRight);
|
||||
}
|
||||
return ;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void memMemoryDump(MEM_NODE *Node)
|
||||
{
|
||||
#ifdef DEBUG_MALLOC
|
||||
|
||||
int i;
|
||||
|
||||
MemTotalEntries=0;
|
||||
|
|
|
@ -65,7 +65,7 @@ struct BASEANIM;
|
|||
/* ensure ANIM2D/3D structs same size */
|
||||
#define ANIM_2D_ELEMENTS \
|
||||
ANIM_BASE_ELEMENTS \
|
||||
iSprite *psFrames; \
|
||||
iTexture *psFrames; \
|
||||
UWORD uwBmapWidth; /* width of container bitmap */
|
||||
|
||||
/* ensure ANIM2D/3D structs same size */
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "lib/framework/frameresource.h"
|
||||
|
||||
|
||||
static BOOL LoadTextureFile(char *FileName, iSprite *TPage, int *TPageID);
|
||||
static BOOL LoadTextureFile(char *FileName, iTexture *TPage, int *TPageID);
|
||||
|
||||
UWORD iV_GetImageWidth(IMAGEFILE *ImageFile, UWORD ID)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ IMAGEFILE *iV_LoadImageFile(char *FileData, WZ_DECL_UNUSED UDWORD FileSize)
|
|||
}
|
||||
|
||||
|
||||
ImageFile->TexturePages = (iSprite*)MALLOC(sizeof(iSprite)*Header->NumTPages);
|
||||
ImageFile->TexturePages = (iTexture*)MALLOC(sizeof(iTexture)*Header->NumTPages);
|
||||
if(ImageFile->TexturePages == NULL) {
|
||||
debug( LOG_ERROR, "Out of memory" );
|
||||
return NULL;
|
||||
|
@ -107,7 +107,7 @@ IMAGEFILE *iV_LoadImageFile(char *FileData, WZ_DECL_UNUSED UDWORD FileSize)
|
|||
|
||||
// Load the texture pages.
|
||||
for (i = 0; i < Header->NumTPages; i++) {
|
||||
int tmp; /* Workaround for MacOS gcc 4.0.0 bug. */
|
||||
int tmp=0; /* Workaround for MacOS gcc 4.0.0 bug. */
|
||||
LoadTextureFile((char*)Header->TPageFiles[i],
|
||||
&ImageFile->TexturePages[i],
|
||||
&tmp);
|
||||
|
@ -151,7 +151,7 @@ void iV_FreeImageFile(IMAGEFILE *ImageFile)
|
|||
}
|
||||
|
||||
|
||||
static BOOL LoadTextureFile(char *FileName, iSprite *pSprite, int *texPageID)
|
||||
static BOOL LoadTextureFile(char *FileName, iTexture *pSprite, int *texPageID)
|
||||
{
|
||||
int i=0;
|
||||
|
||||
|
@ -162,7 +162,7 @@ static BOOL LoadTextureFile(char *FileName, iSprite *pSprite, int *texPageID)
|
|||
assert(FALSE);
|
||||
return FALSE;
|
||||
} else {
|
||||
*pSprite = *(iSprite*)resGetData("IMGPAGE", FileName);
|
||||
*pSprite = *(iTexture*)resGetData("IMGPAGE", FileName);
|
||||
debug(LOG_TEXTURE, "Load texture from resource cache: %s (%d, %d)",
|
||||
FileName, pSprite->width, pSprite->height);
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
void GetRealCameraPos(OBJPOS *Camera,SDWORD Distance, iVector *CameraLoc);
|
||||
void DrawBSPIMD(iIMDShape *IMDdef, iVector *pPos);
|
||||
void GetRealCameraPos(OBJPOS *Camera, SDWORD Distance, Vector3i *CameraLoc);
|
||||
void DrawBSPIMD(iIMDShape *IMDdef, Vector3i *pPos);
|
||||
PSBSPTREENODE InitNode(PSBSPTREENODE psBSPNode);
|
||||
void GetPlane( iIMDShape *s, UDWORD PolygonID, PSPLANE psPlane );
|
||||
|
||||
|
|
|
@ -20,12 +20,6 @@
|
|||
#ifndef i_BSPIMD
|
||||
#define i_BSPIMD
|
||||
|
||||
#ifdef PIETOOL // only needed when generating the tree
|
||||
typedef double HDVAL;
|
||||
typedef struct {HDVAL x, y, z;} iVectorHD;
|
||||
#endif
|
||||
|
||||
|
||||
typedef UDWORD WORLDCOORD;
|
||||
typedef SWORD ANGLE;
|
||||
|
||||
|
@ -84,7 +78,7 @@ typedef struct PLANE
|
|||
FRACT b;
|
||||
FRACT c;
|
||||
FRACT d;
|
||||
iVector vP; // a point on the plane - in normal non-fract format
|
||||
Vector3i vP; // a point on the plane - in normal non-fract format
|
||||
}
|
||||
PLANE, *PSPLANE;
|
||||
|
||||
|
@ -97,13 +91,12 @@ enum BINTREEORDER { PREORDER, INORDER, POSTORDER };
|
|||
typedef struct HDPLANE
|
||||
{
|
||||
// These 1st three entries can NOT NOW be cast into a iVectorf * (iVectorf on PC are doubles)
|
||||
HDVAL a; // these values form the plane equation ax+by+cz=d
|
||||
HDVAL b;
|
||||
HDVAL c;
|
||||
HDVAL d;
|
||||
iVectorHD vP; // a point on the plane - in normal non-fract format
|
||||
}
|
||||
HDPLANE;
|
||||
float a; // these values form the plane equation ax+by+cz=d
|
||||
float b;
|
||||
float c;
|
||||
float d;
|
||||
Vector3f vP; // a point on the plane - in normal non-fract format
|
||||
} HDPLANE;
|
||||
|
||||
|
||||
typedef int (*COMPFUNC) ( void *node1, void *node2 );
|
||||
|
@ -132,7 +125,7 @@ typedef struct BSPTREENODE
|
|||
BSPPOLYID TriSameDir; // id of the first polygon in the list ... or BSPPOLYID_TERMINATE for none
|
||||
BSPPOLYID TriOppoDir; // id of the first polygon in the list ... or BSPPOLYID_TERMINATE for none
|
||||
#ifdef PIETOOL // only needed when generating the tree
|
||||
HDPLANE *psPlane; // High def version of the plane equation
|
||||
HDPLANE *psPlane; // High def version of the plane equation
|
||||
PSBSPPTRLIST psTriSameDir;
|
||||
PSBSPPTRLIST psTriOppoDir;
|
||||
#endif
|
||||
|
|
|
@ -246,7 +246,7 @@ int GetBSPPolyCount(PSBSPTREENODE psNode, int *NodeCount)
|
|||
// new code the write out the connectors !
|
||||
void _imd_save_connectors(FILE *fp, iIMDShape *s)
|
||||
{
|
||||
iVector *p;
|
||||
Vector3i *p;
|
||||
int i;
|
||||
|
||||
if (s->nconnectors != 0) {
|
||||
|
@ -457,10 +457,10 @@ void iV_IMDRelease(iIMDShape *s)
|
|||
}
|
||||
|
||||
if (s->points) {
|
||||
iV_HeapFree(s->points,s->npoints * sizeof(iVector));
|
||||
iV_HeapFree(s->points,s->npoints * sizeof(Vector3i));
|
||||
}
|
||||
if (s->connectors) {
|
||||
iV_HeapFree(s->connectors,s->nconnectors * sizeof(iVector));
|
||||
iV_HeapFree(s->connectors,s->nconnectors * sizeof(Vector3i));
|
||||
}
|
||||
if (s->BSPNode) {
|
||||
FREE(s->BSPNode); // I used MALLOC() so i'm going to use FREE()
|
||||
|
|
|
@ -46,14 +46,14 @@
|
|||
|
||||
|
||||
// Static variables
|
||||
static uint32 _IMD_FLAGS;
|
||||
static Uint32 _IMD_FLAGS;
|
||||
static char _IMD_NAME[MAX_FILE_PATH];
|
||||
static int32 _IMD_VER;
|
||||
static Sint32 _IMD_VER;
|
||||
static VERTEXID vertexTable[iV_IMD_MAX_POINTS];
|
||||
static char imagePath[MAX_FILE_PATH] = {""};
|
||||
|
||||
// kludge
|
||||
extern void pie_SurfaceNormal(iVector *p1, iVector *p2, iVector *p3, iVector *v);
|
||||
extern void pie_SurfaceNormal(Vector3i *p1, Vector3i *p2, Vector3i *p3, Vector3i *v);
|
||||
|
||||
// local prototypes
|
||||
static iIMDShape *_imd_load_level(char **FileData, char *FileDataEnd, int nlevels,
|
||||
|
@ -276,7 +276,7 @@ static BOOL _imd_load_polys( char **ppFileData, iIMDShape *s )
|
|||
char *pFileData = *ppFileData;
|
||||
int cnt;
|
||||
int i, j; //, anim;
|
||||
iVector p0, p1, p2, *points;
|
||||
Vector3i p0, p1, p2, *points;
|
||||
iIMDPoly *poly;
|
||||
int nFrames,pbRate,tWidth,tHeight;
|
||||
|
||||
|
@ -395,7 +395,7 @@ static BOOL _imd_load_polys( char **ppFileData, iIMDShape *s )
|
|||
// PC texture coord routine
|
||||
if (poly->vrt && (poly->flags & (iV_IMD_TEX|iV_IMD_PSXTEX))) {
|
||||
for (j=0; j<poly->npnts; j++) {
|
||||
int32 VertexU,VertexV;
|
||||
Sint32 VertexU, VertexV;
|
||||
if (sscanf(pFileData, "%d %d%n", &VertexU, &VertexV, &cnt) != 2) {
|
||||
iV_Error(0xff,"(_load_polys) [poly %d] error reading tex outline",i);
|
||||
return FALSE;
|
||||
|
@ -578,7 +578,7 @@ static BOOL ReadPoints( char **ppFileData, iIMDShape *s )
|
|||
char *pFileData = *ppFileData;
|
||||
int cnt;
|
||||
int i;
|
||||
iVector *p;
|
||||
Vector3i *p;
|
||||
int lastPoint,match,j;
|
||||
SDWORD newX,newY,newZ;
|
||||
|
||||
|
@ -652,20 +652,20 @@ static BOOL ReadPoints( char **ppFileData, iIMDShape *s )
|
|||
static BOOL _imd_load_points( char **ppFileData, iIMDShape *s )
|
||||
{
|
||||
int i ;
|
||||
iVector *p;
|
||||
int32 tempXMax,tempXMin,tempZMax,tempZMin,extremeX,extremeZ;
|
||||
int32 xmax, ymax, zmax;
|
||||
Vector3i *p;
|
||||
Sint32 tempXMax, tempXMin, tempZMax, tempZMin, extremeX, extremeZ;
|
||||
Sint32 xmax, ymax, zmax;
|
||||
double dx, dy, dz, rad_sq, rad, old_to_p_sq, old_to_p, old_to_new;
|
||||
double xspan, yspan, zspan, maxspan;
|
||||
iVectorf dia1, dia2, cen;
|
||||
iVectorf vxmin = { 0, 0, 0 }, vymin = { 0, 0, 0 }, vzmin = { 0, 0, 0 },
|
||||
Vector3f dia1, dia2, cen;
|
||||
Vector3f vxmin = { 0, 0, 0 }, vymin = { 0, 0, 0 }, vzmin = { 0, 0, 0 },
|
||||
vxmax = { 0, 0, 0 }, vymax = { 0, 0, 0 }, vzmax = { 0, 0, 0 };
|
||||
|
||||
//load the points then pass through a second time to setup bounding datavalues
|
||||
|
||||
IMDPoints+=s->npoints;
|
||||
|
||||
s->points = p = (iVector *) iV_HeapAlloc(sizeof(iVector) * s->npoints);
|
||||
s->points = p = (Vector3i *) iV_HeapAlloc(sizeof(Vector3i) * s->npoints);
|
||||
if (p == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -858,16 +858,16 @@ static BOOL _imd_load_points( char **ppFileData, iIMDShape *s )
|
|||
cen.x = (rad*cen.x + old_to_new*p->x) / old_to_p;
|
||||
cen.y = (rad*cen.y + old_to_new*p->y) / old_to_p;
|
||||
cen.z = (rad*cen.z + old_to_new*p->z) / old_to_p;
|
||||
iV_DEBUG4("NEW SPHERE: cen,rad = %d %d %d, %d\n",(int32) cen.x, (int32) cen.y, (int32) cen.z, (int32) rad);
|
||||
iV_DEBUG4("NEW SPHERE: cen,rad = %d %d %d, %d\n",(Sint32) cen.x, (Sint32) cen.y, (inSint32t32) cen.z, (Sint32) rad);
|
||||
}
|
||||
}
|
||||
|
||||
s->ocen.x = (int32) cen.x;
|
||||
s->ocen.y = (int32) cen.y;
|
||||
s->ocen.z = (int32) cen.z;
|
||||
s->oradius = (int32) rad;
|
||||
iV_DEBUG2("radius, sradius, %d, %d\n",s->radius,s->sradius);
|
||||
iV_DEBUG4("SPHERE: cen,rad = %d %d %d, %d\n",s->ocen.x,s->ocen.y,s->ocen.z,s->oradius);
|
||||
s->ocen.x = (Sint32) cen.x;
|
||||
s->ocen.y = (Sint32) cen.y;
|
||||
s->ocen.z = (Sint32) cen.z;
|
||||
s->oradius = (Sint32) rad;
|
||||
iV_DEBUG2("radius, sradius, %d, %d\n", s->radius, s->sradius);
|
||||
iV_DEBUG4("SPHERE: cen,rad = %d %d %d, %d\n", s->ocen.x, s->ocen.y, s->ocen.z, s->oradius);
|
||||
|
||||
// END: tight bounding sphere
|
||||
return TRUE;
|
||||
|
@ -879,12 +879,12 @@ static BOOL _imd_load_connectors(char **ppFileData, iIMDShape *s)
|
|||
char *pFileData = *ppFileData;
|
||||
int cnt;
|
||||
int i;
|
||||
iVector *p;
|
||||
Vector3i *p;
|
||||
SDWORD newX,newY,newZ;
|
||||
|
||||
IMDConnectors+=s->nconnectors;
|
||||
|
||||
if ((s->connectors = (iVector *) iV_HeapAlloc(sizeof(iVector) * s->nconnectors)) == NULL)
|
||||
if ((s->connectors = (Vector3i *) iV_HeapAlloc(sizeof(Vector3i) * s->nconnectors)) == NULL)
|
||||
{
|
||||
iV_Error(0xff,"(_load_connectors) iV_HeapAlloc fail");
|
||||
return FALSE;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define iV_DIVMULTP_2 (1<<(iV_DIVSHIFT-1))
|
||||
|
||||
// Simple derived types
|
||||
typedef union {uint32 *dp; uint8 *bp; uint16 *wp;} iPointer;
|
||||
typedef union {Uint32 *dp; Uint8 *bp; Uint16 *wp;} iPointer;
|
||||
|
||||
extern void iV_Error(long n, const char *msge, ...);
|
||||
|
||||
|
@ -89,8 +89,8 @@ extern void iV_Error(long n, const char *msge, ...);
|
|||
/***************************************************************************/
|
||||
// Basic type (replace with framework definitions)
|
||||
typedef unsigned char uchar;
|
||||
typedef uint32 ufixed;
|
||||
typedef struct {int32 w, x, y, z;} iQuat;
|
||||
typedef Uint32 ufixed;
|
||||
typedef struct {Sint32 w, x, y, z;} iQuat;
|
||||
typedef struct {int x0, y0, x1, y1;} iBox;
|
||||
|
||||
|
||||
|
|
|
@ -81,10 +81,11 @@
|
|||
// screen surface structure
|
||||
//
|
||||
//*************************************************************************
|
||||
typedef struct { Sint32 left, top, right, bottom; } iClip;
|
||||
|
||||
typedef struct iSurface {
|
||||
int usr;
|
||||
uint32 flags;
|
||||
Uint32 flags;
|
||||
int xcentre;
|
||||
int ycentre;
|
||||
int xpshift;
|
||||
|
@ -92,11 +93,11 @@ typedef struct iSurface {
|
|||
iClip clip;
|
||||
|
||||
UBYTE *buffer;
|
||||
int32 scantable[iV_SCANTABLE_MAX]; // currently uses 4k per structure (!)
|
||||
Sint32 scantable[iV_SCANTABLE_MAX]; // currently uses 4k per structure (!)
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int32 size;
|
||||
Sint32 size;
|
||||
} iSurface;
|
||||
|
||||
//*************************************************************************
|
||||
|
@ -106,7 +107,7 @@ typedef struct iSurface {
|
|||
//*************************************************************************
|
||||
typedef struct {
|
||||
int npoints;
|
||||
iPoint frame[iV_IMD_ANIM_FRAMES];
|
||||
Vector2i frame[iV_IMD_ANIM_FRAMES];
|
||||
} iTexAnimFrame;
|
||||
|
||||
|
||||
|
@ -124,7 +125,7 @@ typedef struct {
|
|||
//
|
||||
//*************************************************************************
|
||||
#ifdef BSPIMD
|
||||
typedef uint16 BSPPOLYID; // lets hope this can work as a byte ... that will limit it to 255 polygons in 1 imd
|
||||
typedef Uint16 BSPPOLYID; // lets hope this can work as a byte ... that will limit it to 255 polygons in 1 imd
|
||||
#endif
|
||||
#include "bspimd.h" //structure defintions only
|
||||
|
||||
|
@ -132,10 +133,10 @@ typedef uint16 BSPPOLYID; // lets hope this can work as a byte ... that will l
|
|||
typedef int VERTEXID; // Size of the entry for vertex id in the imd polygon structure
|
||||
|
||||
typedef struct {
|
||||
uint32 flags;
|
||||
int32 zcentre;
|
||||
Uint32 flags;
|
||||
Sint32 zcentre;
|
||||
int npnts;
|
||||
iVector normal;
|
||||
Vector3i normal;
|
||||
VERTEXID *pindex;
|
||||
iVertex *vrt;
|
||||
iTexAnim *pTexAnim; // warning.... this is not used on the playstation version !
|
||||
|
@ -145,20 +146,20 @@ typedef struct {
|
|||
} iIMDPoly;
|
||||
|
||||
typedef struct iIMDShape {
|
||||
uint32 flags;
|
||||
int32 texpage;
|
||||
int32 oradius, sradius, radius, visRadius, xmin, xmax, ymin, ymax, zmin, zmax;
|
||||
Uint32 flags;
|
||||
Sint32 texpage;
|
||||
Sint32 oradius, sradius, radius, visRadius, xmin, xmax, ymin, ymax, zmin, zmax;
|
||||
|
||||
iVector ocen;
|
||||
Vector3i ocen;
|
||||
UWORD numFrames;
|
||||
UWORD animInterval;
|
||||
int npoints;
|
||||
int npolys; // After BSP this number is not updated - it stays the number of pre-bsp polys
|
||||
int nconnectors; // After BSP this number is not updated - it stays the number of pre-bsp polys
|
||||
|
||||
iVector *points;
|
||||
Vector3i *points;
|
||||
iIMDPoly *polys; // After BSP this is not changed - it stays the original chunk of polys - not all are now used,and others not in this array are, see BSPNode for a tree of all the post BSP polys
|
||||
iVector *connectors; // After BSP this is not changed - it stays the original chunk of polys - not all are now used,and others not in this array are, see BSPNode for a tree of all the post BSP polys
|
||||
Vector3i *connectors; // After BSP this is not changed - it stays the original chunk of polys - not all are now used,and others not in this array are, see BSPNode for a tree of all the post BSP polys
|
||||
|
||||
int ntexanims;
|
||||
iTexAnim **texanims;
|
||||
|
@ -210,7 +211,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
IMAGEHEADER Header;
|
||||
iSprite *TexturePages;
|
||||
iTexture *TexturePages;
|
||||
UWORD NumCluts;
|
||||
UWORD TPageIDs[16];
|
||||
UWORD ClutIDs[48];
|
||||
|
|
|
@ -43,7 +43,7 @@ static void wzpng_read_data(png_structp ctx, png_bytep area, png_size_t size)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL pie_PNGLoadMem(char *pngimage, iSprite *s)
|
||||
BOOL pie_PNGLoadMem(char *pngimage, iTexture *s)
|
||||
{
|
||||
unsigned int PNG_BYTES_TO_CHECK=4;
|
||||
png_structp png_ptr = NULL;
|
||||
|
@ -127,7 +127,7 @@ BOOL pie_PNGLoadMem(char *pngimage, iSprite *s)
|
|||
{
|
||||
png_bytep* row_pointers = (png_bytep*)malloc(s->height*sizeof(png_bytep));
|
||||
char* pdata;
|
||||
unsigned int i;
|
||||
int i;
|
||||
const unsigned int line_size = s->width*info_ptr->channels;
|
||||
|
||||
for (i = 0, pdata = s->bmp;
|
||||
|
|
|
@ -58,10 +58,10 @@
|
|||
* Global ProtoTypes
|
||||
*/
|
||||
/***************************************************************************/
|
||||
extern void pie_Line(int x0, int y0, int x1, int y1, uint32 colour);
|
||||
extern void pie_Box(int x0,int y0, int x1, int y1, uint32 colour);
|
||||
extern void pie_Line(int x0, int y0, int x1, int y1, Uint32 colour);
|
||||
extern void pie_Box(int x0,int y0, int x1, int y1, Uint32 colour);
|
||||
extern void pie_BoxFillIndex(int x0,int y0, int x1, int y1, UBYTE colour);
|
||||
extern void pie_BoxFill(int x0,int y0, int x1, int y1, uint32 colour);
|
||||
extern void pie_BoxFill(int x0,int y0, int x1, int y1, Uint32 colour);
|
||||
extern void pie_DrawImageFileID(IMAGEFILE *ImageFile,UWORD ID,int x,int y);
|
||||
extern void pie_ImageFileID(IMAGEFILE *ImageFile,UWORD ID,int x,int y);
|
||||
extern void pie_ImageFileIDTile(IMAGEFILE *ImageFile,UWORD ID,int x,int y,int x0,int y0,int Width,int Height);
|
||||
|
|
|
@ -64,7 +64,7 @@ void pie_Set2DClip(int x0, int y0, int x1, int y1)
|
|||
psRendSurface->clip.bottom = y1;
|
||||
}
|
||||
|
||||
static void pie_ClipUV(PIEVERTEX *s1, PIEVERTEX *s2, PIEVERTEX *clip, int32 t)
|
||||
static void pie_ClipUV(PIEVERTEX *s1, PIEVERTEX *s2, PIEVERTEX *clip, Sint32 t)
|
||||
{
|
||||
clip->tu = s1->tu + ((t * (s2->tu - s1->tu)) >> iV_DIVSHIFT);
|
||||
clip->tv = s1->tv + ((t * (s2->tv - s1->tv)) >> iV_DIVSHIFT);
|
||||
|
@ -77,10 +77,8 @@ static void pie_ClipUV(PIEVERTEX *s1, PIEVERTEX *s2, PIEVERTEX *clip, int32 t)
|
|||
|
||||
static int pie_ClipXT(PIEVERTEX *s1, PIEVERTEX *s2, PIEVERTEX *clip)
|
||||
{
|
||||
int n, dx;
|
||||
int32 t;
|
||||
|
||||
n = 1;
|
||||
int n = 1, dx;
|
||||
Sint32 t;
|
||||
|
||||
if (s2->sx >= s1->sx) {
|
||||
if (s1->sx < psRendSurface->clip.left) {
|
||||
|
@ -171,10 +169,8 @@ static int pie_ClipXT(PIEVERTEX *s1, PIEVERTEX *s2, PIEVERTEX *clip)
|
|||
|
||||
static int pie_ClipYT(PIEVERTEX *s1, PIEVERTEX *s2, PIEVERTEX *clip)
|
||||
{
|
||||
int n, dy;
|
||||
int32 t;
|
||||
|
||||
n = 1;
|
||||
int n = 1, dy;
|
||||
Sint32 t;
|
||||
|
||||
if (s2->sy >= s1->sy) {
|
||||
|
||||
|
@ -198,9 +194,9 @@ static int pie_ClipYT(PIEVERTEX *s1, PIEVERTEX *s2, PIEVERTEX *clip)
|
|||
*clip = *s1;
|
||||
}
|
||||
|
||||
if (s2->sy > psRendSurface->clip.bottom)
|
||||
if (s2->sy > psRendSurface->clip.bottom)
|
||||
{
|
||||
if (s1->sy > psRendSurface->clip.bottom)
|
||||
if (s1->sy > psRendSurface->clip.bottom)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -226,7 +222,7 @@ static int pie_ClipYT(PIEVERTEX *s1, PIEVERTEX *s2, PIEVERTEX *clip)
|
|||
return n;
|
||||
|
||||
} else {
|
||||
if (s1->sy > psRendSurface->clip.bottom)
|
||||
if (s1->sy > psRendSurface->clip.bottom)
|
||||
{
|
||||
if (s2->sy >= psRendSurface->clip.bottom) return 0;
|
||||
|
||||
|
@ -247,9 +243,9 @@ static int pie_ClipYT(PIEVERTEX *s1, PIEVERTEX *s2, PIEVERTEX *clip)
|
|||
*clip = *s1;
|
||||
}
|
||||
|
||||
if (s2->sy < psRendSurface->clip.top)
|
||||
if (s2->sy < psRendSurface->clip.top)
|
||||
{
|
||||
if (s1->sy < psRendSurface->clip.top)
|
||||
if (s1->sy < psRendSurface->clip.top)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -159,12 +159,12 @@ typedef struct {SDWORD texPage; SWORD tu, tv, tw, th;} PIEIMAGE; //an area of te
|
|||
typedef struct {UDWORD pieFlag; PIELIGHT colour, specular; UBYTE light, trans, scale, height;} PIESTYLE; //render style for pie draw functions
|
||||
|
||||
typedef struct {long n; char msge[240];} iError;
|
||||
typedef int32 fixed;
|
||||
typedef Sint32 fixed;
|
||||
|
||||
// This is the new resource loaded structure (TEXPAGE)
|
||||
typedef struct
|
||||
{
|
||||
iSprite *Texture;
|
||||
iTexture *Texture;
|
||||
iPalette *Palette;
|
||||
} TEXTUREPAGE;
|
||||
|
||||
|
@ -206,7 +206,7 @@ extern void SetBSPCameraPos(SDWORD x,SDWORD y,SDWORD z);
|
|||
* \param sprite Sprite to read into
|
||||
* \return TRUE on success, FALSE otherwise
|
||||
*/
|
||||
BOOL pie_PNGLoadMem(char *pngimage, iSprite *sprite);
|
||||
BOOL pie_PNGLoadMem(char *pngimage, iTexture *sprite);
|
||||
|
||||
void SetBSPObjectRot(SDWORD Yaw, SDWORD Pitch);
|
||||
|
||||
|
|
|
@ -42,6 +42,6 @@ extern void pie_CornerBox(SDWORD x0, SDWORD y0, SDWORD x1, SDWORD y1, UDWORD col
|
|||
UBYTE a, UBYTE b, UBYTE c, UBYTE d);
|
||||
extern void pie_TransColouredTriangle( PIEVERTEX *vrt, UDWORD rgb );
|
||||
extern void pie_DrawSkybox(iView player, iView camera, float rotation, int texpage, int u, int v, int w, int h);
|
||||
extern void pie_DrawViewingWindow( iVector *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2,UDWORD colour);
|
||||
extern void pie_DrawViewingWindow( Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, UDWORD colour);
|
||||
|
||||
#endif // _piedef_h
|
||||
|
|
|
@ -48,15 +48,15 @@
|
|||
|
||||
//*************************************************************************
|
||||
|
||||
extern uint8 colours[];
|
||||
extern uint8 palShades[PALETTE_SIZE * PALETTE_SHADE_LEVEL];
|
||||
extern Uint8 colours[];
|
||||
extern Uint8 palShades[PALETTE_SIZE * PALETTE_SHADE_LEVEL];
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
extern void pal_Init(void);
|
||||
extern void pal_ShutDown(void);
|
||||
extern void pal_BuildAdjustedShadeTable( void );
|
||||
extern uint8 pal_GetNearestColour(uint8 r, uint8 g, uint8 b);
|
||||
extern Uint8 pal_GetNearestColour(Uint8 r, Uint8 g, Uint8 b);
|
||||
extern int pal_AddNewPalette(iColour *pal);
|
||||
extern void pal_PaletteSet(void);
|
||||
extern iColour* pie_GetGamePal(void);
|
||||
|
|
|
@ -38,27 +38,22 @@
|
|||
* Global Type Definitions
|
||||
*/
|
||||
/***************************************************************************/
|
||||
typedef Sint32 int32;
|
||||
typedef Uint8 uint8;
|
||||
typedef Uint16 uint16;
|
||||
typedef Uint32 uint32;
|
||||
|
||||
//*************************************************************************
|
||||
//
|
||||
// Simple derived types
|
||||
//
|
||||
//*************************************************************************
|
||||
typedef struct { Sint32 left, top, right, bottom; } iClip;
|
||||
typedef char iBitmap;
|
||||
typedef struct { Sint32 x, y; } Vector2i;
|
||||
typedef struct { Sint32 x, y, z; } Vector3i;
|
||||
typedef struct { float x, y, z; } Vector3f;
|
||||
|
||||
typedef struct { Vector3i p, r; } iView;
|
||||
typedef struct { Sint32 x, y, z, u, v; Uint8 g; } iVertex;
|
||||
|
||||
typedef struct { Uint8 r, g, b; } iColour;
|
||||
typedef iColour iPalette[256];
|
||||
typedef struct { Sint32 x, y; } iPoint;
|
||||
typedef struct { Sint32 x, y, z; } iVector;
|
||||
typedef struct { double x, y, z; } iVectorf;
|
||||
|
||||
typedef char iBitmap;
|
||||
typedef struct { Sint32 width, height; iBitmap *bmp; } iTexture;
|
||||
typedef iTexture iSprite;
|
||||
typedef struct { Sint32 x, y, z, u, v; uint8 g; } iVertex;
|
||||
typedef struct { float x, y, z; } PIEVECTORF;
|
||||
typedef struct { iVector p, r; } iView;
|
||||
|
||||
#endif // _pieTypes_h
|
||||
|
|
|
@ -75,8 +75,8 @@ extern UDWORD iV_GetMouseFrame(void);
|
|||
//*************************************************************************
|
||||
// functions accessed indirectly from rendmode
|
||||
//*************************************************************************
|
||||
extern void (*iV_pBox)(int x0, int y0, int x1, int y1, uint32 colour);
|
||||
extern void (*iV_pBoxFill)(int x0, int y0, int x1, int y1, uint32 colour);
|
||||
extern void (*iV_pBox)(int x0, int y0, int x1, int y1, Uint32 colour);
|
||||
extern void (*iV_pBoxFill)(int x0, int y0, int x1, int y1, Uint32 colour);
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
|
|
|
@ -82,7 +82,7 @@ extern void rend_AssignScreen(void);
|
|||
extern void rend_Assign(iSurface *s);
|
||||
extern void iV_RenderAssign(iSurface *s);
|
||||
extern void iV_SurfaceDestroy(iSurface *s);
|
||||
extern iSurface *iV_SurfaceCreate(uint32 flags, int width, int height, int xp, int yp, uint8 *buffer);
|
||||
extern iSurface *iV_SurfaceCreate(Uint32 flags, int width, int height, int xp, int yp, Uint8 *buffer);
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
typedef struct
|
||||
{
|
||||
iTexture tex;
|
||||
uint8 type;
|
||||
Uint8 type;
|
||||
char name[80];
|
||||
unsigned int textPage3dfx;
|
||||
int bResource; // Was page provided by resource handler?
|
||||
|
@ -61,8 +61,8 @@ extern iTexPage _TEX_PAGE[iV_TEX_MAX];
|
|||
|
||||
int iV_GetTexture(char *filename);
|
||||
extern int pie_ReloadTexPage(char *filename, char *pBuffer);
|
||||
extern int pie_AddBMPtoTexPages(iSprite* s, const char *filename, int type, BOOL bResource);
|
||||
void pie_ChangeTexPage(int tex_index, iSprite* s, int type, BOOL bResource);
|
||||
extern int pie_AddBMPtoTexPages(iTexture* s, const char *filename, int type, BOOL bResource);
|
||||
void pie_ChangeTexPage(int tex_index, iTexture* s, int type, BOOL bResource);
|
||||
extern void pie_TexInit(void);
|
||||
|
||||
//*************************************************************************
|
||||
|
|
|
@ -53,14 +53,14 @@ void DrawTriangleList(BSPPOLYID PolygonNumber);
|
|||
|
||||
|
||||
// Local prototypes
|
||||
static inline int IsPointOnPlane( PSPLANE psPlane, iVector * vP );
|
||||
static iVector *IMDvec(int Vertex);
|
||||
static inline int IsPointOnPlane( PSPLANE psPlane, Vector3i * vP );
|
||||
static Vector3i *IMDvec(int Vertex);
|
||||
|
||||
iIMDShape *BSPimd=NULL; // This is a global ... it is used in imddraw.c (for speed)
|
||||
|
||||
|
||||
// Local static variables
|
||||
static iVector *CurrentVertexList=NULL;
|
||||
static Vector3i *CurrentVertexList=NULL;
|
||||
//static int CurrentVertexListCount=0;
|
||||
|
||||
|
||||
|
@ -79,9 +79,9 @@ extern BOOL NoCullBSP; // Oh yes... a global externaly referenced variable....
|
|||
* - psPlane structure containing the plane equation
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static inline int IsPointOnPlane( PSPLANE psPlane, iVector * vP )
|
||||
static inline int IsPointOnPlane( PSPLANE psPlane, Vector3i * vP )
|
||||
{
|
||||
iVectorf vecP;
|
||||
Vector3f vecP;
|
||||
FRACT Dot;
|
||||
|
||||
/* validate input */
|
||||
|
@ -116,16 +116,16 @@ static inline int IsPointOnPlane( PSPLANE psPlane, iVector * vP )
|
|||
*/
|
||||
typedef iIMDPoly * PSTRIANGLE;
|
||||
|
||||
static iVectorf *iNormalise(iVectorf * v);
|
||||
static iVectorf * iCrossProduct( iVectorf * psD, iVectorf * psA, iVectorf * psB );
|
||||
static void GetTriangleNormal( PSTRIANGLE psTri, iVectorf * psN,int pA, int pB, int pC );
|
||||
static Vector3f *iNormalise(Vector3f * v);
|
||||
static Vector3f * iCrossProduct( Vector3f * psD, Vector3f * psA, Vector3f * psB );
|
||||
static void GetTriangleNormal( PSTRIANGLE psTri, Vector3f * psN, int pA, int pB, int pC );
|
||||
PSBSPTREENODE InitNode(PSBSPTREENODE psBSPNode);
|
||||
|
||||
|
||||
static FRACT GetDist( PSTRIANGLE psTri, int pA, int pB );
|
||||
|
||||
// little routine for getting an imd vector structure in the IMD from the vertex ID
|
||||
static inline iVector *IMDvec(int Vertex)
|
||||
static inline Vector3i *IMDvec(int Vertex)
|
||||
{
|
||||
#ifdef BSP_MAXDEBUG
|
||||
assert((Vertex>=0)&&(Vertex<CurrentVertexListCount));
|
||||
|
@ -146,7 +146,7 @@ in practise mathematically inacurraceys mean that you need the three points tha
|
|||
void GetPlane( iIMDShape *s, UDWORD PolygonID, PSPLANE psPlane )
|
||||
{
|
||||
|
||||
iVectorf Result;
|
||||
Vector3f Result;
|
||||
iIMDPoly *psTri;
|
||||
/* validate input */
|
||||
ASSERT( PTRVALID(psPlane,sizeof(PLANE)),
|
||||
|
@ -211,7 +211,7 @@ void GetPlane( iIMDShape *s, UDWORD PolygonID, PSPLANE psPlane )
|
|||
/* store first triangle vertex as point on plane for later point /
|
||||
* plane classification in IsPointOnPlane
|
||||
*/
|
||||
memcpy( &psPlane->vP, IMDvec(psTri->pindex[0]), sizeof(iVector) );
|
||||
memcpy( &psPlane->vP, IMDvec(psTri->pindex[0]), sizeof(Vector3i) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,7 +223,7 @@ void GetPlane( iIMDShape *s, UDWORD PolygonID, PSPLANE psPlane )
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
static iVectorf * iCrossProduct( iVectorf * psD, iVectorf * psA, iVectorf * psB )
|
||||
static Vector3f * iCrossProduct( Vector3f * psD, Vector3f * psA, Vector3f * psB )
|
||||
{
|
||||
psD->x = FRACTmul(psA->y , psB->z) - FRACTmul(psA->z ,psB->y);
|
||||
psD->y = FRACTmul(psA->z , psB->x) - FRACTmul(psA->x ,psB->z);
|
||||
|
@ -250,9 +250,9 @@ static FRACT GetDist( PSTRIANGLE psTri, int pA, int pB )
|
|||
}
|
||||
|
||||
|
||||
static void GetTriangleNormal( PSTRIANGLE psTri, iVectorf * psN,int pA, int pB, int pC )
|
||||
static void GetTriangleNormal( PSTRIANGLE psTri, Vector3f * psN,int pA, int pB, int pC )
|
||||
{
|
||||
iVectorf vecA, vecB;
|
||||
Vector3f vecA, vecB;
|
||||
|
||||
/* validate input */
|
||||
ASSERT( PTRVALID(psTri,sizeof(iIMDPoly)),
|
||||
|
@ -279,7 +279,7 @@ static void GetTriangleNormal( PSTRIANGLE psTri, iVectorf * psN,int pA, int pB,
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
static iVectorf *iNormalise(iVectorf * v)
|
||||
static Vector3f *iNormalise(Vector3f * v)
|
||||
{
|
||||
FRACT vx, vy, vz, mod, sum_square;
|
||||
|
||||
|
@ -324,7 +324,7 @@ PSBSPTREENODE InitNode(PSBSPTREENODE psBSPNode)
|
|||
|
||||
// Calculate the real camera position based on the coordinates of the camera and the camera
|
||||
// distance - the result is stores in CameraLoc ,, up is +ve Y
|
||||
void GetRealCameraPos(OBJPOS *Camera,SDWORD Distance, iVector *CameraLoc)
|
||||
void GetRealCameraPos(OBJPOS *Camera, SDWORD Distance, Vector3i *CameraLoc)
|
||||
{
|
||||
int Yinc;
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ POINT rectVerts[4];
|
|||
* Source
|
||||
*/
|
||||
/***************************************************************************/
|
||||
void pie_Line(int x0, int y0, int x1, int y1, uint32 colour)
|
||||
void pie_Line(int x0, int y0, int x1, int y1, Uint32 colour)
|
||||
{
|
||||
// PIELIGHT light;
|
||||
|
||||
|
@ -96,7 +96,7 @@ void pie_Line(int x0, int y0, int x1, int y1, uint32 colour)
|
|||
}
|
||||
/***************************************************************************/
|
||||
|
||||
void pie_Box(int x0,int y0, int x1, int y1, uint32 colour)
|
||||
void pie_Box(int x0,int y0, int x1, int y1, Uint32 colour)
|
||||
{
|
||||
// PIELIGHT light;
|
||||
// iColour* psPalette;
|
||||
|
@ -159,7 +159,7 @@ void pie_BoxFillIndex(int x0,int y0, int x1, int y1, UBYTE colour)
|
|||
pie_DrawRect( x0, y0, x1, y1, light.argb );
|
||||
}
|
||||
|
||||
void pie_BoxFill(int x0,int y0, int x1, int y1, uint32 colour)
|
||||
void pie_BoxFill(int x0,int y0, int x1, int y1, Uint32 colour)
|
||||
{
|
||||
pie_SetRendMode(REND_FLAT);
|
||||
pie_SetTexturePage(-1);
|
||||
|
|
|
@ -98,7 +98,7 @@ static BOOL stencil_one_pass(void)
|
|||
|
||||
if (can_do_stencil_one_pass < 0) {
|
||||
can_do_stencil_one_pass = 0; // can't use it until we decide otherwise
|
||||
|
||||
|
||||
// let's check if we have the needed extensions
|
||||
if( check_extension("GL_EXT_stencil_two_side")
|
||||
&& check_extension("GL_EXT_stencil_wrap"))
|
||||
|
@ -189,8 +189,8 @@ void pie_EndLighting(void)
|
|||
#ifdef BSPIMD
|
||||
|
||||
// BSP object position
|
||||
static iVector BSPObject;
|
||||
static iVector BSPCamera;
|
||||
static Vector3i BSPObject;
|
||||
static Vector3i BSPCamera;
|
||||
static SDWORD BSPObject_Yaw=0,BSPObject_Pitch=0;
|
||||
|
||||
|
||||
|
@ -225,32 +225,26 @@ void SetBSPCameraPos(SDWORD x,SDWORD y,SDWORD z)
|
|||
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} fVector;
|
||||
|
||||
static void fVector_Set(fVector* v, float x, float y, float z)
|
||||
static void Vector3f_Set(Vector3f* v, float x, float y, float z)
|
||||
{
|
||||
v->x = x;
|
||||
v->y = y;
|
||||
v->z = z;
|
||||
}
|
||||
|
||||
static void fVector_Sub(fVector* dest, fVector* op1, fVector* op2)
|
||||
static void Vector3f_Sub(Vector3f* dest, Vector3f* op1, Vector3f* op2)
|
||||
{
|
||||
dest->x = op1->x - op2->x;
|
||||
dest->y = op1->y - op2->y;
|
||||
dest->z = op1->z - op2->z;
|
||||
}
|
||||
|
||||
static float fVector_SP(fVector* op1, fVector* op2)
|
||||
static float Vector3f_SP(Vector3f* op1, Vector3f* op2)
|
||||
{
|
||||
return op1->x * op2->x + op1->y * op2->y + op1->z * op2->z;
|
||||
}
|
||||
|
||||
static void fVector_CP(fVector* dest, fVector* op1, fVector* op2)
|
||||
static void Vector3f_CP(Vector3f* dest, Vector3f* op1, Vector3f* op2)
|
||||
{
|
||||
dest->x = op1->y * op2->z - op1->z * op2->y;
|
||||
dest->y = op1->z * op2->x - op1->x * op2->z;
|
||||
|
@ -285,15 +279,15 @@ pie_Polygon(SDWORD numVerts, PIEVERTEX* pVrts, FRACT texture_offset, BOOL light)
|
|||
}
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
if (light) {
|
||||
fVector p1, p2, p3, v1, v2, n;
|
||||
Vector3f p1, p2, p3, v1, v2, n;
|
||||
float l;
|
||||
|
||||
fVector_Set(&p1, pVrts[0].sx, pVrts[0].sy, pVrts[0].sz);
|
||||
fVector_Set(&p2, pVrts[1].sx, pVrts[1].sy, pVrts[1].sz);
|
||||
fVector_Set(&p3, pVrts[2].sx, pVrts[2].sy, pVrts[2].sz);
|
||||
fVector_Sub(&v1, &p3, &p1);
|
||||
fVector_Sub(&v2, &p2, &p1);
|
||||
fVector_CP(&n, &v1, &v2);
|
||||
Vector3f_Set(&p1, pVrts[0].sx, pVrts[0].sy, pVrts[0].sz);
|
||||
Vector3f_Set(&p2, pVrts[1].sx, pVrts[1].sy, pVrts[1].sz);
|
||||
Vector3f_Set(&p3, pVrts[2].sx, pVrts[2].sy, pVrts[2].sz);
|
||||
Vector3f_Sub(&v1, &p3, &p1);
|
||||
Vector3f_Sub(&v2, &p2, &p1);
|
||||
Vector3f_CP(&n, &v1, &v2);
|
||||
l = 1.0;
|
||||
|
||||
glNormal3f(n.x*l, n.y*l, n.z*l);
|
||||
|
@ -345,9 +339,9 @@ static unsigned int nb_tshapes = 0;
|
|||
static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELIGHT specular,
|
||||
int pieFlag, int pieFlagData)
|
||||
{
|
||||
int32 tempY;
|
||||
Sint32 tempY;
|
||||
int i, n;
|
||||
iVector *pVertices;
|
||||
Vector3i *pVertices;
|
||||
PIEPIXEL *pPixels;
|
||||
iIMDPoly *pPolys;
|
||||
PIEPOLY piePoly;
|
||||
|
@ -454,11 +448,11 @@ static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELI
|
|||
}
|
||||
}
|
||||
|
||||
static void pie_DrawShadow(iIMDShape *shape, int flag, int flag_data, fVector* light)
|
||||
static void pie_DrawShadow(iIMDShape *shape, int flag, int flag_data, Vector3f* light)
|
||||
{
|
||||
int32 tempY;
|
||||
Sint32 tempY;
|
||||
int i, n;
|
||||
iVector *pVertices;
|
||||
Vector3i *pVertices;
|
||||
PIEPIXEL *pPixels;
|
||||
iIMDPoly *pPolys;
|
||||
VERTEXID *index;
|
||||
|
@ -483,18 +477,18 @@ static void pie_DrawShadow(iIMDShape *shape, int flag, int flag_data, fVector* l
|
|||
|
||||
pPolys = shape->polys;
|
||||
for (i = 0; i < shape->npolys; ++i, ++pPolys) {
|
||||
fVector p1, p2, p3, v1, v2, normal;
|
||||
Vector3f p1, p2, p3, v1, v2, normal;
|
||||
|
||||
index = pPolys->pindex;
|
||||
fVector_Set(&p1, scrPoints[*index].d3dx, scrPoints[*index].d3dy, scrPoints[*index].d3dz);
|
||||
Vector3f_Set(&p1, scrPoints[*index].d3dx, scrPoints[*index].d3dy, scrPoints[*index].d3dz);
|
||||
++index;
|
||||
fVector_Set(&p2, scrPoints[*index].d3dx, scrPoints[*index].d3dy, scrPoints[*index].d3dz);
|
||||
Vector3f_Set(&p2, scrPoints[*index].d3dx, scrPoints[*index].d3dy, scrPoints[*index].d3dz);
|
||||
++index;
|
||||
fVector_Set(&p3, scrPoints[*index].d3dx, scrPoints[*index].d3dy, scrPoints[*index].d3dz);
|
||||
fVector_Sub(&v1, &p3, &p1);
|
||||
fVector_Sub(&v2, &p2, &p1);
|
||||
fVector_CP(&normal, &v1, &v2);
|
||||
if (fVector_SP(&normal, light) > 0) {
|
||||
Vector3f_Set(&p3, scrPoints[*index].d3dx, scrPoints[*index].d3dy, scrPoints[*index].d3dz);
|
||||
Vector3f_Sub(&v1, &p3, &p1);
|
||||
Vector3f_Sub(&v2, &p2, &p1);
|
||||
Vector3f_CP(&normal, &v1, &v2);
|
||||
if (Vector3f_SP(&normal, light) > 0) {
|
||||
if ( pPolys->flags & PIE_COLOURKEYED
|
||||
&& pPolys->flags & PIE_NO_CULL) {
|
||||
VERTEXID i;
|
||||
|
@ -649,7 +643,7 @@ static void inverse_matrix(float* src, float * dst)
|
|||
static void pie_ShadowDrawLoop(float pos_lgt0[4])
|
||||
{
|
||||
float invmat[9];
|
||||
fVector light;
|
||||
Vector3f light;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < nb_scshapes; i++)
|
||||
|
|
|
@ -72,7 +72,7 @@ static UBYTE aByteScale[256][256];
|
|||
|
||||
/* ---------------------------------------------------------------------------------- */
|
||||
|
||||
void pie_DrawViewingWindow(iVector *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, UDWORD colour)
|
||||
void pie_DrawViewingWindow(Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, UDWORD colour)
|
||||
{
|
||||
SDWORD clip, i;
|
||||
|
||||
|
@ -219,18 +219,18 @@ void pie_DrawSkybox(iView player, iView camera, float rotation, int texpage, int
|
|||
glTexCoord2i(u + w * 6, v + h); glVertex3f(-r, 0, -r); // bottom right
|
||||
glTexCoord2i(u + w * 6, v); glVertex3f(-r, r, -r); // top right
|
||||
|
||||
// Left
|
||||
// Left
|
||||
glTexCoord2i(u + w * 8, v + h); glVertex3f(-r, 0, r); // bottom r
|
||||
glTexCoord2i(u + w * 8, v); glVertex3f(-r, r, r); // top r
|
||||
glEnd();
|
||||
|
||||
|
||||
// Load Saved State
|
||||
pie_MatEnd();
|
||||
pie_PerspectiveEnd();
|
||||
|
||||
if (oldFogState)
|
||||
{
|
||||
glEnable(GL_FOG);
|
||||
glEnable(GL_FOG);
|
||||
}
|
||||
if (oldAlphaTestState)
|
||||
{
|
||||
|
|
|
@ -52,11 +52,10 @@ SDMATRIX *psMatrix = &aMatrixStack[0];
|
|||
|
||||
BOOL drawing_interface = TRUE;
|
||||
|
||||
void pie_VectorNormalise(iVector *v)
|
||||
|
||||
void pie_VectorNormalise(Vector3i *v)
|
||||
{
|
||||
int32 size;
|
||||
iVector av;
|
||||
Sint32 size;
|
||||
Vector3i av;
|
||||
|
||||
av.x = pie_ABS(v->x);
|
||||
av.y = pie_ABS(v->y);
|
||||
|
@ -92,10 +91,9 @@ void pie_VectorNormalise(iVector *v)
|
|||
//*
|
||||
//******
|
||||
|
||||
void pie_SurfaceNormal(iVector *p1, iVector *p2, iVector *p3, iVector *v)
|
||||
|
||||
void pie_SurfaceNormal(Vector3i *p1, Vector3i *p2, Vector3i *p3, Vector3i *v)
|
||||
{
|
||||
iVector a, b;
|
||||
Vector3i a, b;
|
||||
|
||||
a.x = p3->x - p1->x;
|
||||
a.y = p3->y - p1->y;
|
||||
|
@ -356,10 +354,10 @@ void pie_MatRotX(int x)
|
|||
//*
|
||||
//******
|
||||
|
||||
int32 pie_RotateProject(SDWORD x, SDWORD y, SDWORD z, SDWORD* xs, SDWORD* ys)
|
||||
Sint32 pie_RotateProject(SDWORD x, SDWORD y, SDWORD z, SDWORD* xs, SDWORD* ys)
|
||||
{
|
||||
int32 zfx, zfy;
|
||||
int32 zz, _x, _y, _z;
|
||||
Sint32 zfx, zfy;
|
||||
Sint32 zz, _x, _y, _z;
|
||||
|
||||
|
||||
_x = x * psMatrix->a+y * psMatrix->d+z * psMatrix->g + psMatrix->j;
|
||||
|
@ -390,7 +388,7 @@ int32 pie_RotateProject(SDWORD x, SDWORD y, SDWORD z, SDWORD* xs, SDWORD* ys)
|
|||
return zz;
|
||||
}
|
||||
|
||||
int32 pie_RotProj(iVector *v3d, iPoint *v2d)
|
||||
Sint32 pie_RotProj(Vector3i *v3d, Vector2i *v2d)
|
||||
{
|
||||
return pie_RotateProject(v3d->x, v3d->y, v3d->z, &(v2d->x), &(v2d->y));
|
||||
}
|
||||
|
@ -463,9 +461,9 @@ BOOL pie_PieClockwise(PIEVERTEX *s)
|
|||
//*
|
||||
//******
|
||||
|
||||
void pie_VectorInverseRotate0(iVector *v1, iVector *v2)
|
||||
void pie_VectorInverseRotate0(Vector3i *v1, Vector3i *v2)
|
||||
{
|
||||
int32 x, y, z;
|
||||
Sint32 x, y, z;
|
||||
|
||||
x = v1->x; y = v1->y; z = v1->z;
|
||||
|
||||
|
@ -493,9 +491,9 @@ void pie_MatInit(void)
|
|||
v = (double) sin(i * conv) * FP12_MULTIPLIER;
|
||||
|
||||
if (v >= 0.0)
|
||||
aSinTable[i] = (int32)(v + 0.5);
|
||||
aSinTable[i] = (Sint32)(v + 0.5);
|
||||
else
|
||||
aSinTable[i] = (int32)(v - 0.5);
|
||||
aSinTable[i] = (Sint32)(v - 0.5);
|
||||
}
|
||||
|
||||
// init matrix/quat stack
|
||||
|
|
|
@ -49,8 +49,8 @@ extern SDWORD aSinTable[];
|
|||
|
||||
//*************************************************************************
|
||||
|
||||
#define SIN(X) aSinTable[(uint16)(X) >> 4]
|
||||
#define COS(X) aSinTable[((uint16)(X) >> 4) + 1024]
|
||||
#define SIN(X) aSinTable[(Uint16)(X) >> 4]
|
||||
#define COS(X) aSinTable[((Uint16)(X) >> 4) + 1024]
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
|
@ -91,8 +91,8 @@ extern void pie_MatScale( UDWORD percent );
|
|||
extern void pie_MatRotX(int x);
|
||||
extern void pie_MatRotY(int y);
|
||||
extern void pie_MatRotZ(int z);
|
||||
extern int32 pie_RotProj(iVector *v3d, iPoint *v2d);
|
||||
extern int32 pie_RotateProject(SDWORD x, SDWORD y, SDWORD z, SDWORD* xs, SDWORD* ys);
|
||||
extern Sint32 pie_RotProj(Vector3i *v3d, Vector2i *v2d);
|
||||
extern Sint32 pie_RotateProject(SDWORD x, SDWORD y, SDWORD z, SDWORD* xs, SDWORD* ys);
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
|
@ -101,9 +101,9 @@ extern void pie_PerspectiveEnd(void);
|
|||
|
||||
//*************************************************************************
|
||||
|
||||
extern void pie_VectorNormalise(iVector *v);
|
||||
extern void pie_VectorInverseRotate0(iVector *v1, iVector *v2);
|
||||
extern void pie_SurfaceNormal(iVector *p1, iVector *p2, iVector *p3, iVector *v);
|
||||
extern void pie_VectorNormalise(Vector3i *v);
|
||||
extern void pie_VectorInverseRotate0(Vector3i *v1, Vector3i *v2);
|
||||
extern void pie_SurfaceNormal(Vector3i *p1, Vector3i *p2, Vector3i *p3, Vector3i *v);
|
||||
extern BOOL pie_Clockwise(iVertex *s);
|
||||
extern void pie_SetGeometricOffset(int x, int y);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
int32 _iVPRIM_DIVTABLE[DIVIDE_TABLE_SIZE];
|
||||
Sint32 _iVPRIM_DIVTABLE[DIVIDE_TABLE_SIZE];
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#define BLUE_CHROMATICITY 1
|
||||
|
||||
|
||||
uint8 pal_GetNearestColour(uint8 r, uint8 g, uint8 b);
|
||||
Uint8 pal_GetNearestColour(Uint8 r, Uint8 g, Uint8 b);
|
||||
void pie_SetColourDefines(void);
|
||||
/*
|
||||
This is how far from the end you want the drawn as the artist intended shades
|
||||
|
@ -41,9 +41,9 @@ void pie_SetColourDefines(void);
|
|||
#define COLOUR_BALANCE 6 // 3 from the end. (two brighter shades!)
|
||||
|
||||
iColour* psGamePal = NULL;
|
||||
uint8 palShades[PALETTE_SIZE * PALETTE_SHADE_LEVEL];
|
||||
Uint8 palShades[PALETTE_SIZE * PALETTE_SHADE_LEVEL];
|
||||
BOOL bPaletteInitialised = FALSE;
|
||||
uint8 colours[16];
|
||||
Uint8 colours[16];
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
|
@ -122,11 +122,11 @@ void pal_ShutDown(void)
|
|||
}
|
||||
}
|
||||
|
||||
uint8 pal_GetNearestColour(uint8 r, uint8 g, uint8 b)
|
||||
Uint8 pal_GetNearestColour(Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
int c ;
|
||||
int32 distance_r, distance_g, distance_b, squared_distance;
|
||||
int32 best_colour = 0, best_squared_distance;
|
||||
Sint32 distance_r, distance_g, distance_b, squared_distance;
|
||||
Sint32 best_colour = 0, best_squared_distance;
|
||||
|
||||
ASSERT( bPaletteInitialised,"pal_GetNearestColour, palette not initialised." );
|
||||
|
||||
|
@ -150,7 +150,7 @@ uint8 pal_GetNearestColour(uint8 r, uint8 g, uint8 b)
|
|||
{
|
||||
best_colour = 1;
|
||||
}
|
||||
return ((uint8) best_colour);
|
||||
return ((Uint8) best_colour);
|
||||
}
|
||||
|
||||
void pal_BuildAdjustedShadeTable( void )
|
||||
|
@ -179,7 +179,7 @@ int numShades;
|
|||
if(seekBlue >255) seekBlue = 255;
|
||||
|
||||
palShades[(numColours * PALETTE_SHADE_LEVEL) + (numShades-COLOUR_BALANCE)] =
|
||||
pal_GetNearestColour((uint8) seekRed, (uint8) seekGreen, (uint8) seekBlue);
|
||||
pal_GetNearestColour((Uint8) seekRed, (Uint8) seekGreen, (Uint8) seekBlue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ void iVBlitPixelTransRect(UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1);
|
|||
static void pie_BuildTransTable(UDWORD tableNo);
|
||||
|
||||
// dummy prototypes for pointer build functions
|
||||
void (*iV_pBox)(int x0, int y0, int x1, int y1, uint32 colour);
|
||||
void (*iV_pBoxFill)(int x0, int y0, int x1, int y1, uint32 colour);
|
||||
void (*iV_pBox)(int x0, int y0, int x1, int y1, Uint32 colour);
|
||||
void (*iV_pBoxFill)(int x0, int y0, int x1, int y1, Uint32 colour);
|
||||
|
||||
//*************************************************************************
|
||||
//*************************************************************************
|
||||
|
|
|
@ -41,7 +41,7 @@ iSurface *psRendSurface;
|
|||
//*
|
||||
//******
|
||||
|
||||
iSurface *iV_SurfaceCreate(uint32 flags, int width, int height, int xp, int yp, UBYTE *buffer)
|
||||
iSurface *iV_SurfaceCreate(Uint32 flags, int width, int height, int xp, int yp, UBYTE *buffer)
|
||||
{
|
||||
iSurface *s;
|
||||
int i;
|
||||
|
|
|
@ -174,7 +174,7 @@ BOOL screenInitialise(
|
|||
debug( LOG_ERROR, "Error: SDL_SetVideoMode failed (%s).", SDL_GetError() );
|
||||
return FALSE;
|
||||
}
|
||||
if ( SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &value) == -1)
|
||||
if ( SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &value) == -1)
|
||||
{
|
||||
debug( LOG_ERROR, "OpenGL initialization did not give double buffering!" );
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ void screen_SetBackDropFromFile(char* filename)
|
|||
}
|
||||
else if( strcmp(extension,".png") == 0 )
|
||||
{
|
||||
iSprite imagePNG;
|
||||
iTexture imagePNG;
|
||||
char * buffer = NULL;
|
||||
unsigned int dummy = 0;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ int _TEX_INDEX;
|
|||
|
||||
Returns the texture number of the image.
|
||||
**************************************************************************/
|
||||
int pie_AddBMPtoTexPages(iSprite* s, const char* filename, int type, BOOL bResource)
|
||||
int pie_AddBMPtoTexPages(iTexture* s, const char* filename, int type, BOOL bResource)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -119,7 +119,7 @@ int pie_AddBMPtoTexPages(iSprite* s, const char* filename, int type, BOOL bResou
|
|||
return i;
|
||||
}
|
||||
|
||||
void pie_ChangeTexPage(int tex_index, iSprite* s, int type, BOOL bResource)
|
||||
void pie_ChangeTexPage(int tex_index, iTexture* s, int type, BOOL bResource)
|
||||
{
|
||||
assert(s != NULL);
|
||||
|
||||
|
@ -183,7 +183,7 @@ int iV_GetTexture(char *filename)
|
|||
int pie_ReloadTexPage(char *filename, char *pBuffer)
|
||||
{
|
||||
int i = 0;
|
||||
iSprite s;
|
||||
iTexture s;
|
||||
|
||||
// Log call to check validity of deprecation
|
||||
debug( LOG_ERROR, "pie_ReloadTexPage called for %s, tell Per!", filename );
|
||||
|
|
|
@ -589,11 +589,11 @@ void pie_DrawText(char *string, UDWORD x, UDWORD y)
|
|||
void pie_RenderBlueTintedBitmap(iBitmap *bmp, int x, int y, int w, int h, int ow)
|
||||
{
|
||||
int i, j, lineSkip;
|
||||
uint8 *bp;
|
||||
uint8 present;
|
||||
Uint8 *bp;
|
||||
Uint8 present;
|
||||
|
||||
|
||||
bp = (uint8 *) psRendSurface->buffer + x + psRendSurface->scantable[y];
|
||||
bp = (Uint8 *) psRendSurface->buffer + x + psRendSurface->scantable[y];
|
||||
|
||||
lineSkip = psRendSurface->width - w;
|
||||
for (i=0; i<h; i++)
|
||||
|
@ -615,11 +615,11 @@ void pie_RenderBlueTintedBitmap(iBitmap *bmp, int x, int y, int w, int h, int ow
|
|||
void pie_RenderDeepBlueTintedBitmap(iBitmap *bmp, int x, int y, int w, int h, int ow)
|
||||
{
|
||||
int i, j, lineSkip;
|
||||
uint8 *bp;
|
||||
uint8 present;
|
||||
Uint8 *bp;
|
||||
Uint8 present;
|
||||
|
||||
|
||||
bp = (uint8 *) psRendSurface->buffer + x + psRendSurface->scantable[y];
|
||||
bp = (Uint8 *) psRendSurface->buffer + x + psRendSurface->scantable[y];
|
||||
|
||||
lineSkip = psRendSurface->width - w;
|
||||
for (i=0; i<h; i++)
|
||||
|
|
|
@ -37,7 +37,7 @@ BOOL NETinitPlaybackBuffer(void *pSoundBuffer)
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// handle the playback buffer.
|
||||
BOOL NETqueueIncomingAudio( void *pSoundData, SDWORD soundBytes,BOOL bStream)
|
||||
BOOL NETqueueIncomingAudio(void *pSoundData, SDWORD soundBytes, BOOL bStream)
|
||||
{
|
||||
debug(LOG_SOUND, "NETqueueIncomingAudio");
|
||||
return FALSE;
|
||||
|
|
|
@ -1329,7 +1329,7 @@ static CODE_ERROR scriptCodeBinaryOperator(CODE_BLOCK *psFirst, // Code for firs
|
|||
|
||||
/* check if the arguments in the function definition body match the argument types
|
||||
and names from function declaration (if there was any) */
|
||||
static BOOL checkFuncParamType(UDWORD argIndex, SDWORD argType)
|
||||
static BOOL checkFuncParamType(UDWORD argIndex, UDWORD argType)
|
||||
{
|
||||
VAR_SYMBOL *psCurr;
|
||||
SDWORD i,j;
|
||||
|
@ -1345,7 +1345,7 @@ static BOOL checkFuncParamType(UDWORD argIndex, SDWORD argType)
|
|||
/* find the argument by the index */
|
||||
i=psCurEvent->index;
|
||||
j=0;
|
||||
for(psCurr =psLocalVarsB[i]; psCurr != NULL; psCurr = psCurr->psNext)
|
||||
for(psCurr = psLocalVarsB[i]; psCurr != NULL; psCurr = psCurr->psNext)
|
||||
{
|
||||
if((psCurEvent->numParams - j - 1)==argIndex) /* got to the right argument */
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "lib/gamelib/priority.h"
|
||||
#include "aud.h"
|
||||
#include "lib/framework/trig.h"
|
||||
#include "lib/ivis_common/pietypes.h"
|
||||
|
||||
//*
|
||||
//
|
||||
|
@ -39,19 +40,6 @@
|
|||
#define AUDIO_QUEUE_SIZE 30
|
||||
#define LOWERED_VOL AUDIO_VOL_MAX / 4
|
||||
|
||||
//*
|
||||
//
|
||||
|
||||
//
|
||||
// -----------------------------------------------------------------------------------------------------------------------
|
||||
// * structs
|
||||
// -----------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
typedef struct SDWVEC3D
|
||||
{
|
||||
SDWORD x, y, z;
|
||||
} SDWVEC3D;
|
||||
|
||||
//*
|
||||
//
|
||||
// externs
|
||||
|
@ -67,11 +55,10 @@ static AUDIO_SAMPLE *g_psSampleQueue = NULL;
|
|||
static BOOL g_bAudioEnabled = FALSE;
|
||||
static BOOL g_bAudioPaused = FALSE;
|
||||
static BOOL g_bStopAll = FALSE;
|
||||
static AUDIO_SAMPLE g_sPreviousSample =
|
||||
{
|
||||
static AUDIO_SAMPLE g_sPreviousSample = {
|
||||
NO_SAMPLE, SAMPLE_COORD_INVALID, SAMPLE_COORD_INVALID, SAMPLE_COORD_INVALID
|
||||
};
|
||||
static SDWORD g_i3DVolume = AUDIO_VOL_MAX;
|
||||
static SDWORD g_i3DVolume = AUDIO_VOL_MAX;
|
||||
|
||||
|
||||
//*
|
||||
|
@ -528,7 +515,7 @@ static void audio_UpdateQueue( void )
|
|||
BOOL audio_Update( void )
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
SDWVEC3D vecPlayer;
|
||||
Vector3i vecPlayer;
|
||||
SDWORD iA;
|
||||
AUDIO_SAMPLE *psSample, *psSampleTemp;
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -72,7 +72,7 @@ static ALCdevice* device = 0;
|
|||
static ALCcontext* context = 0;
|
||||
|
||||
static ALvoid *data = NULL; // Needed for ReadTrackFromBuffer, must be global, so it can be free'd on shutdown
|
||||
static UDWORD DataBuffer_size = 16 * 1024;
|
||||
static ALsizei DataBuffer_size = 16 * 1024;
|
||||
|
||||
BOOL openal_initialized = FALSE;
|
||||
|
||||
|
@ -206,7 +206,7 @@ void sound_Update( void )
|
|||
|
||||
default:
|
||||
sound_FinishedCallback( i->curr );
|
||||
if (i->curr->iSample != AL_INVALID) {
|
||||
if (i->curr->iSample != (ALuint)AL_INVALID) {
|
||||
alDeleteSources( 1, &(i->curr->iSample) );
|
||||
i->curr->iSample = AL_INVALID;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ void sound_Update( void )
|
|||
//
|
||||
BOOL sound_QueueSamplePlaying( void )
|
||||
{
|
||||
if ( current_queue_sample == -1 )
|
||||
if ( current_queue_sample == (ALuint)AL_INVALID )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ BOOL sound_QueueSamplePlaying( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
if (current_queue_sample != AL_INVALID) {
|
||||
if (current_queue_sample != (ALuint)AL_INVALID) {
|
||||
alDeleteSources( 1, ¤t_queue_sample );
|
||||
current_queue_sample = AL_INVALID;
|
||||
}
|
||||
|
@ -718,10 +718,11 @@ BOOL sound_SampleIsFinished( AUDIO_SAMPLE *psSample )
|
|||
}
|
||||
else
|
||||
{
|
||||
if (psSample->iSample != AL_INVALID) {
|
||||
alDeleteSources( 1, &(psSample->iSample) );
|
||||
psSample->iSample = AL_INVALID;
|
||||
}
|
||||
if (psSample->iSample != (ALuint)AL_INVALID)
|
||||
{
|
||||
alDeleteSources( 1, &(psSample->iSample) );
|
||||
psSample->iSample = AL_INVALID;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -338,7 +338,9 @@ SDWORD sound_GetNumPlaying( SDWORD iTrack )
|
|||
static void sound_CheckSample( AUDIO_SAMPLE *psSample )
|
||||
{
|
||||
ASSERT( PTRVALID(psSample, sizeof(AUDIO_SAMPLE)), "sound_CheckSample: sample pointer invalid\n" );
|
||||
ASSERT( psSample->iSample >= 0 || psSample->iSample == SAMPLE_NOT_ALLOCATED, "sound_CheckSample: sample %i out of range\n", psSample->iSample );
|
||||
ASSERT( psSample->iSample >= 0 || psSample->iSample == (ALuint)SAMPLE_NOT_ALLOCATED, "sound_CheckSample: sample %i out of range\n", psSample->iSample );
|
||||
// FIXME iSample always >= 0 !
|
||||
// FIXME Leaving as is because if this is not always true it asserts too often
|
||||
}
|
||||
|
||||
//*
|
||||
|
@ -469,7 +471,7 @@ BOOL sound_Play3DTrack( AUDIO_SAMPLE *psSample )
|
|||
void sound_StopTrack( AUDIO_SAMPLE *psSample )
|
||||
{
|
||||
sound_CheckSample( psSample );
|
||||
if ( psSample->iSample != SAMPLE_NOT_ALLOCATED )
|
||||
if ( psSample->iSample != (ALuint)SAMPLE_NOT_ALLOCATED )
|
||||
{
|
||||
sound_StopSample( psSample->iSample );
|
||||
}
|
||||
|
@ -490,7 +492,7 @@ void sound_StopTrack( AUDIO_SAMPLE *psSample )
|
|||
//
|
||||
void sound_PauseTrack( AUDIO_SAMPLE *psSample )
|
||||
{
|
||||
if ( psSample->iSample != SAMPLE_NOT_ALLOCATED )
|
||||
if ( psSample->iSample != (ALuint)SAMPLE_NOT_ALLOCATED )
|
||||
{
|
||||
sound_StopSample( psSample->iSample );
|
||||
}
|
||||
|
|
|
@ -87,8 +87,7 @@ typedef struct AUDIO_SAMPLE
|
|||
void *psObj;
|
||||
struct AUDIO_SAMPLE *psPrev;
|
||||
struct AUDIO_SAMPLE *psNext;
|
||||
}
|
||||
AUDIO_SAMPLE;
|
||||
} AUDIO_SAMPLE;
|
||||
|
||||
typedef struct TRACK
|
||||
{
|
||||
|
|
|
@ -444,7 +444,7 @@ BOOL actionTargetTurret(BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, UWORD *p
|
|||
FRACT fR;
|
||||
SDWORD pitchLowerLimit, pitchUpperLimit;
|
||||
DROID *psDroid = NULL;
|
||||
// iVector muzzle;
|
||||
// Vector3i muzzle;
|
||||
|
||||
//these are constants now and can be set up at the start of the function
|
||||
rotRate = ACTION_TURRET_ROTATION_RATE;
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
|
||||
typedef struct ARROW
|
||||
{
|
||||
iVector vecBase;
|
||||
iVector vecHead;
|
||||
Vector3i vecBase;
|
||||
Vector3i vecHead;
|
||||
UBYTE iColour;
|
||||
struct ARROW *psNext;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,6 @@ void arrowShutDown( void );
|
|||
BOOL arrowAdd( SDWORD iBaseX, SDWORD iBaseY, SDWORD iBaseZ, SDWORD iHeadX,
|
||||
SDWORD iHeadY, SDWORD iHeadZ, UBYTE iColour );
|
||||
void arrowDrawAll( void );
|
||||
extern void draw3dLine(iVector *src, iVector *dest, UBYTE col);
|
||||
extern void draw3dLine(Vector3i *src, Vector3i *dest, UBYTE col);
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
25
src/atmos.c
25
src/atmos.c
|
@ -78,7 +78,7 @@ void atmosInitSystem ( void );
|
|||
void atmosUpdateSystem ( void );
|
||||
void atmosDrawParticles ( void );
|
||||
void processParticle ( ATPART *psPart );
|
||||
void atmosAddParticle ( iVector *pos, AP_TYPE type );
|
||||
void atmosAddParticle ( Vector3i *pos, AP_TYPE type );
|
||||
void renderParticle ( ATPART *psPart );
|
||||
void testParticleWrap ( ATPART *psPart );
|
||||
void atmosSetWeatherType ( WT_CLASS type );
|
||||
|
@ -105,9 +105,9 @@ UDWORD i;
|
|||
/* Move the particles */
|
||||
void atmosUpdateSystem( void )
|
||||
{
|
||||
UDWORD i;
|
||||
UDWORD numberToAdd;
|
||||
iVector pos;
|
||||
UDWORD i;
|
||||
UDWORD numberToAdd;
|
||||
Vector3i pos;
|
||||
|
||||
/* Establish how long the last game frame took */
|
||||
fraction = MAKEFRACT(frameTime)/GAME_TICKS_PER_SEC;
|
||||
|
@ -168,11 +168,10 @@ iVector pos;
|
|||
/* Moves one of the particles */
|
||||
void processParticle( ATPART *psPart )
|
||||
{
|
||||
SDWORD groundHeight;
|
||||
iVector pos;
|
||||
UDWORD x,y;
|
||||
MAPTILE *psTile;
|
||||
|
||||
SDWORD groundHeight;
|
||||
Vector3i pos;
|
||||
UDWORD x,y;
|
||||
MAPTILE *psTile;
|
||||
|
||||
/* Only move if the game isn't paused */
|
||||
if(!gamePaused())
|
||||
|
@ -239,10 +238,10 @@ MAPTILE *psTile;
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
/* Adds a particle to the system if it can */
|
||||
void atmosAddParticle( iVector *pos, AP_TYPE type )
|
||||
void atmosAddParticle( Vector3i *pos, AP_TYPE type )
|
||||
{
|
||||
UDWORD activeCount;
|
||||
UDWORD i;
|
||||
UDWORD activeCount;
|
||||
UDWORD i;
|
||||
|
||||
for(i=freeParticle,activeCount=0; (asAtmosParts[i].status==APS_ACTIVE)
|
||||
&& activeCount<MAX_ATMOS_PARTICLES; i++)
|
||||
|
@ -342,7 +341,7 @@ UDWORD i;
|
|||
// -----------------------------------------------------------------------------
|
||||
void renderParticle( ATPART *psPart )
|
||||
{
|
||||
iVector dv;
|
||||
Vector3i dv;
|
||||
UDWORD brightness, specular;
|
||||
SDWORD centreX, centreZ;
|
||||
SDWORD x, y, z;
|
||||
|
|
|
@ -25,9 +25,9 @@ typedef struct _atmosParticle
|
|||
UBYTE status;
|
||||
UBYTE type;
|
||||
UDWORD size;
|
||||
PIEVECTORF position;
|
||||
PIEVECTORF velocity;
|
||||
iIMDShape *imd;
|
||||
Vector3f position;
|
||||
Vector3f velocity;
|
||||
iIMDShape *imd;
|
||||
} ATPART;
|
||||
|
||||
typedef enum
|
||||
|
|
10
src/bridge.c
10
src/bridge.c
|
@ -117,7 +117,7 @@ BOOL renderBridgeSection(STRUCTURE *psStructure)
|
|||
SDWORD structX,structY,structZ;
|
||||
SDWORD rx,rz;
|
||||
//iIMDShape *imd;
|
||||
iVector dv;
|
||||
Vector3i dv;
|
||||
|
||||
/* Bomb out if it's not visible and there's no active god mode */
|
||||
if(!psStructure->visible[selectedPlayer] && !godMode)
|
||||
|
@ -240,11 +240,11 @@ BOOL startHigher;
|
|||
}
|
||||
}
|
||||
|
||||
void testBuildBridge(UDWORD startX,UDWORD startY,UDWORD endX,UDWORD endY)
|
||||
void testBuildBridge(UDWORD startX, UDWORD startY, UDWORD endX, UDWORD endY)
|
||||
{
|
||||
BRIDGE_INFO bridge;
|
||||
UDWORD i;
|
||||
iVector dv;
|
||||
BRIDGE_INFO bridge;
|
||||
UDWORD i;
|
||||
Vector3i dv;
|
||||
|
||||
if(bridgeValid(startX,startY,endX,endY))
|
||||
{
|
||||
|
|
|
@ -345,8 +345,8 @@ SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
|
|||
{
|
||||
SDWORD z = 0, radius;
|
||||
SDWORD px, pz;
|
||||
iPoint pixel;
|
||||
iVector position;
|
||||
Vector2i pixel;
|
||||
Vector3i position;
|
||||
UDWORD droidSize;
|
||||
DROID *psDroid;
|
||||
BODY_STATS *psBStats;
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#include "projectile.h"
|
||||
|
||||
void unsetMatrix(void);
|
||||
void setMatrix(iVector *Position,iVector *Rotation,iVector *CameraPos,BOOL RotXYZ);
|
||||
void setMatrix(Vector3i *Position, Vector3i *Rotation, Vector3i *CameraPos, BOOL RotXYZ);
|
||||
|
||||
#define MAX_GROUP_SIZE 10
|
||||
|
||||
|
@ -141,11 +141,9 @@ void updateLightLevels(void)
|
|||
}
|
||||
|
||||
|
||||
void setMatrix(iVector *Position,iVector *Rotation,iVector *CameraPos,BOOL RotXYZ)
|
||||
void setMatrix(Vector3i *Position, Vector3i *Rotation, Vector3i *CameraPos, BOOL RotXYZ)
|
||||
{
|
||||
|
||||
|
||||
iVector BSPCameraPos;
|
||||
Vector3i BSPCameraPos;
|
||||
OBJPOS Camera = {0,0,0,0,0,0};
|
||||
|
||||
Camera.pitch=-45;
|
||||
|
@ -286,10 +284,9 @@ UDWORD getStructureStatHeight(STRUCTURE_STATS *psStat)
|
|||
}
|
||||
|
||||
|
||||
void displayIMDButton(iIMDShape *IMDShape,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale)
|
||||
void displayIMDButton(iIMDShape *IMDShape, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
||||
{
|
||||
iVector TmpCamPos = {0,0,0};
|
||||
Vector3i TmpCamPos = {0,0,0};
|
||||
|
||||
setMatrix(Position,Rotation,&TmpCamPos,RotXYZ);
|
||||
pie_MatScale(scale);
|
||||
|
@ -303,14 +300,13 @@ void displayIMDButton(iIMDShape *IMDShape,
|
|||
|
||||
|
||||
//Watermelon:changed it to loop thru and draw all weapons
|
||||
void displayStructureButton(STRUCTURE *psStructure,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale)
|
||||
void displayStructureButton(STRUCTURE *psStructure, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
||||
{
|
||||
iIMDShape *baseImd,*strImd;//*mountImd,*weaponImd;
|
||||
iIMDShape *mountImd[STRUCT_MAXWEAPS];
|
||||
iIMDShape *weaponImd[STRUCT_MAXWEAPS];
|
||||
UDWORD nWeaponStat;
|
||||
iVector TmpCamPos = {0,0,0};
|
||||
Vector3i TmpCamPos = {0,0,0};
|
||||
int i;
|
||||
|
||||
/*HACK HACK HACK!
|
||||
|
@ -457,13 +453,12 @@ void displayStructureButton(STRUCTURE *psStructure,
|
|||
unsetMatrix();
|
||||
}
|
||||
|
||||
void displayStructureStatButton(STRUCTURE_STATS *Stats,UDWORD Player,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale)
|
||||
void displayStructureStatButton(STRUCTURE_STATS *Stats,UDWORD Player, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
||||
{
|
||||
iIMDShape *baseImd,*strImd;//*mountImd,*weaponImd;
|
||||
iIMDShape *mountImd[STRUCT_MAXWEAPS];
|
||||
iIMDShape *weaponImd[STRUCT_MAXWEAPS];
|
||||
iVector TmpCamPos = {0,0,0};
|
||||
Vector3i TmpCamPos = {0,0,0};
|
||||
//UDWORD nWeaponStat;
|
||||
UBYTE i;
|
||||
|
||||
|
@ -626,13 +621,13 @@ void displayStructureStatButton(STRUCTURE_STATS *Stats,UDWORD Player,
|
|||
|
||||
// Render a component given a BASE_STATS structure.
|
||||
//
|
||||
void displayComponentButton(BASE_STATS *Stat, iVector *Rotation,iVector *Position,
|
||||
void displayComponentButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Position,
|
||||
BOOL RotXYZ, SDWORD scale)
|
||||
{
|
||||
iIMDShape *ComponentIMD = NULL;
|
||||
iIMDShape *MountIMD = NULL;
|
||||
SDWORD compID;
|
||||
iVector TmpCamPos = {0,0,0};
|
||||
Vector3i TmpCamPos = {0,0,0};
|
||||
|
||||
setMatrix(Position,Rotation,&TmpCamPos,RotXYZ);
|
||||
pie_MatScale(scale);
|
||||
|
@ -674,12 +669,11 @@ void displayComponentButton(BASE_STATS *Stat, iVector *Rotation,iVector *Positio
|
|||
|
||||
// Render a research item given a BASE_STATS structure.
|
||||
//
|
||||
void displayResearchButton(BASE_STATS *Stat,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale)
|
||||
void displayResearchButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
||||
{
|
||||
iIMDShape *ResearchIMD = ((RESEARCH *)Stat)->pIMD;
|
||||
iIMDShape *MountIMD = ((RESEARCH *)Stat)->pIMD2;
|
||||
iVector TmpCamPos = {0,0,0};
|
||||
Vector3i TmpCamPos = {0,0,0};
|
||||
|
||||
|
||||
if(ResearchIMD)
|
||||
|
@ -702,12 +696,11 @@ void displayResearchButton(BASE_STATS *Stat,
|
|||
|
||||
// Render a composite droid given a DROID_TEMPLATE structure.
|
||||
//
|
||||
void displayComponentButtonTemplate(DROID_TEMPLATE *psTemplate,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale)
|
||||
void displayComponentButtonTemplate(DROID_TEMPLATE *psTemplate, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
||||
{
|
||||
static DROID Droid; // Made static to reduce stack usage.
|
||||
SDWORD difference;
|
||||
iVector TmpCamPos = {0,0,0};
|
||||
Vector3i TmpCamPos = {0,0,0};
|
||||
|
||||
/* init to NULL */
|
||||
memset( &Droid, 0, sizeof(DROID) );
|
||||
|
@ -743,11 +736,10 @@ void displayComponentButtonTemplate(DROID_TEMPLATE *psTemplate,
|
|||
|
||||
// Render a composite droid given a DROID structure.
|
||||
//
|
||||
void displayComponentButtonObject(DROID *psDroid,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale)
|
||||
void displayComponentButtonObject(DROID *psDroid, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
||||
{
|
||||
SDWORD difference;
|
||||
iVector TmpCamPos = {0,0,0};
|
||||
Vector3i TmpCamPos = {0,0,0};
|
||||
|
||||
setMatrix(Position,Rotation,&TmpCamPos,RotXYZ);
|
||||
pie_MatScale(scale);
|
||||
|
@ -779,10 +771,10 @@ void displayComponentObject(BASE_OBJECT *psObj)
|
|||
{
|
||||
DROID *psDroid;
|
||||
//iIMDShape *psShape;
|
||||
iVector position,rotation; //,null;
|
||||
Vector3i position, rotation; //,null;
|
||||
//iPoint screenCoords;
|
||||
//SDWORD dummyZ;
|
||||
int32 xShift,zShift;
|
||||
Sint32 xShift,zShift;
|
||||
UDWORD worldAngle;
|
||||
SDWORD difference;
|
||||
SDWORD frame;
|
||||
|
@ -854,7 +846,7 @@ MAPTILE *psTile;
|
|||
if (psDroid->lastHitWeapon == WSC_EMP &&
|
||||
(gameTime - psDroid->timeLastHit < EMP_DISABLE_TIME))
|
||||
{
|
||||
iVector position;
|
||||
Vector3i position;
|
||||
|
||||
//add an effect on the droid
|
||||
position.x = psDroid->x + DROID_EMP_SPREAD;
|
||||
|
@ -903,8 +895,8 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
DROID *psDroid;
|
||||
//Watermelon:I need another temp pointer to Shape
|
||||
iIMDShape *psShape, *psJet, *psShapeTemp = NULL;
|
||||
iVector null;
|
||||
iPoint screenCoords;
|
||||
Vector3i null;
|
||||
Vector2i screenCoords;
|
||||
SDWORD dummyZ, iConnector;
|
||||
PROPULSION_STATS *psPropStats;
|
||||
SDWORD frame;
|
||||
|
@ -1172,7 +1164,7 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
if ( iConnector < VTOL_CONNECTOR_START )
|
||||
{
|
||||
//Watermelon:midpoint for heavybody with only 1 weapon
|
||||
if ( psDroid->numWeaps == 1 &&
|
||||
if ( psDroid->numWeaps == 1 &&
|
||||
((asBodyStats[psDroid->asBits[COMP_BODY].nStat]).weaponSlots == 3 ||
|
||||
(asBodyStats[psDroid->asBits[COMP_BODY].nStat]).size >= SIZE_HEAVY))
|
||||
{
|
||||
|
@ -1555,12 +1547,12 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
}
|
||||
|
||||
|
||||
void destroyFXDroid(DROID *psDroid)
|
||||
void destroyFXDroid(DROID *psDroid)
|
||||
{
|
||||
UDWORD i;
|
||||
iIMDShape *psImd = NULL;
|
||||
SDWORD widthScatter,breadthScatter,heightScatter;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
|
||||
widthScatter = TILE_UNITS/4;
|
||||
breadthScatter = TILE_UNITS/4;
|
||||
|
@ -1662,7 +1654,7 @@ iVector pos;
|
|||
|
||||
void compPersonToBits(DROID *psDroid)
|
||||
{
|
||||
iVector position; //,rotation,velocity;
|
||||
Vector3i position; //,rotation,velocity;
|
||||
iIMDShape *headImd, *legsImd, *armImd, *bodyImd;
|
||||
UDWORD groundHeight;
|
||||
UDWORD col;
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "structuredef.h"
|
||||
|
||||
/*
|
||||
Header file for component.c
|
||||
Pumpkin Studios, EIDOS Interactive.
|
||||
Header file for component.c
|
||||
Pumpkin Studios, EIDOS Interactive.
|
||||
*/
|
||||
|
||||
extern UBYTE PlayerColour[MAX_PLAYERS];// = {0,1,2,3,4,5,6,7}
|
||||
|
@ -54,20 +54,13 @@ extern UDWORD getStructureStatSize(STRUCTURE_STATS *Stats);
|
|||
#define TOWER_HEIGHT 100
|
||||
extern UDWORD getStructureStatHeight(STRUCTURE_STATS *psStat);
|
||||
|
||||
extern void displayIMDButton(iIMDShape *IMDShape,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayStructureButton(STRUCTURE *psStructure,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayStructureStatButton(STRUCTURE_STATS *Stats,UDWORD Player,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayComponentButton(BASE_STATS *Stat,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayResearchButton(BASE_STATS *Stat,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayComponentButtonTemplate(DROID_TEMPLATE *psTemplate,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayComponentButtonObject(DROID *psDroid,
|
||||
iVector *Rotation,iVector *Position,BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayIMDButton(iIMDShape *IMDShape, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayStructureButton(STRUCTURE *psStructure, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayStructureStatButton(STRUCTURE_STATS *Stats,UDWORD Player, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayComponentButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayResearchButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayComponentButtonTemplate(DROID_TEMPLATE *psTemplate, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayComponentButtonObject(DROID *psDroid, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale);
|
||||
extern void displayComponentObject(BASE_OBJECT *psObj);
|
||||
|
||||
extern void compPersonToBits(DROID *psDroid);
|
||||
|
|
12
src/data.c
12
src/data.c
|
@ -741,7 +741,7 @@ BOOL dataIMDBufferLoad(char *pBuffer, UDWORD size, void **ppData)
|
|||
|
||||
BOOL dataIMGPAGELoad(char *pBuffer, UDWORD size, void **ppData)
|
||||
{
|
||||
iSprite *psSprite = (iSprite*) MALLOC(sizeof(iSprite));
|
||||
iTexture *psSprite = (iTexture*) MALLOC(sizeof(iTexture));
|
||||
if (!psSprite) {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -760,7 +760,7 @@ BOOL dataIMGPAGELoad(char *pBuffer, UDWORD size, void **ppData)
|
|||
|
||||
void dataIMGPAGERelease(void *pData)
|
||||
{
|
||||
iSprite *psSprite = (iSprite*) pData;
|
||||
iTexture *psSprite = (iTexture*) pData;
|
||||
dataISpriteRelease(psSprite);
|
||||
}
|
||||
|
||||
|
@ -812,7 +812,7 @@ BOOL dataHWTERTILESLoad(char *pBuffer, UDWORD size, void **ppData)
|
|||
|
||||
void dataHWTERTILESRelease(void *pData)
|
||||
{
|
||||
iSprite *psSprite = (iSprite*) pData;
|
||||
iTexture *psSprite = (iTexture*) pData;
|
||||
|
||||
freeTileTextures();
|
||||
if( psSprite->bmp )
|
||||
|
@ -852,7 +852,7 @@ BOOL bufferTexPageLoad(char *pBuffer, UDWORD size, void **ppData)
|
|||
{
|
||||
TEXTUREPAGE *NewTexturePage;
|
||||
iPalette *psPal;
|
||||
iSprite *psSprite;
|
||||
iTexture *psSprite;
|
||||
char texfile[255];
|
||||
SDWORD i, id;
|
||||
|
||||
|
@ -907,7 +907,7 @@ BOOL bufferTexPageLoad(char *pBuffer, UDWORD size, void **ppData)
|
|||
psPal = (iPalette*)MALLOC(sizeof(iPalette));
|
||||
if (!psPal) return FALSE;
|
||||
|
||||
psSprite = (iSprite*)MALLOC(sizeof(iSprite));
|
||||
psSprite = (iTexture*)MALLOC(sizeof(iTexture));
|
||||
if (!psSprite)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -934,7 +934,7 @@ BOOL bufferTexPageLoad(char *pBuffer, UDWORD size, void **ppData)
|
|||
/* Release an iSprite */
|
||||
void dataISpriteRelease(void *pData)
|
||||
{
|
||||
iSprite *psSprite = (iSprite*) pData;
|
||||
iTexture *psSprite = (iTexture*) pData;
|
||||
|
||||
if( psSprite )
|
||||
{
|
||||
|
|
17
src/design.c
17
src/design.c
|
@ -439,8 +439,7 @@ void intDisplayViewForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD
|
|||
void intDisplayTemplateButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours);
|
||||
void intDisplayComponentButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours);
|
||||
|
||||
extern void RenderCompositeDroid(UDWORD Index,iVector *Rotation,iVector *Position,iVector *TurretRotation,
|
||||
DROID *psDroid,BOOL RotXYZ);
|
||||
extern void RenderCompositeDroid(UDWORD Index, Vector3i *Rotation, Vector3i *Position, Vector3i *TurretRotation, DROID *psDroid, BOOL RotXYZ);
|
||||
|
||||
extern BOOL bRender3DOnly;
|
||||
|
||||
|
@ -3609,7 +3608,7 @@ static void intSetDesignPower(DROID_TEMPLATE *psTemplate)
|
|||
}
|
||||
|
||||
// work out current system component
|
||||
static UDWORD getSystemType(DROID_TEMPLATE* template)
|
||||
static UDWORD getSystemType(DROID_TEMPLATE* template)
|
||||
{
|
||||
if (template->asParts[COMP_ECM]) {
|
||||
return COMP_ECM;
|
||||
|
@ -3648,7 +3647,7 @@ static void intSetTemplatePowerShadowStats(COMP_BASE_STATS *psStats)
|
|||
/*if type = BODY or PROPULSION can do a straight comparison but if the new stat is
|
||||
a 'system' stat then need to find out which 'system' is currently in place so the
|
||||
comparison is meaningful*/
|
||||
if (desCompMode == IDES_SYSTEM)
|
||||
if (desCompMode == IDES_SYSTEM)
|
||||
{
|
||||
type = getSystemType(&sCurrDesign);
|
||||
}
|
||||
|
@ -3688,7 +3687,7 @@ static void intSetTemplatePowerShadowStats(COMP_BASE_STATS *psStats)
|
|||
/* propulsion power points are a percentage of the bodys' power points */
|
||||
power += (propulsionPower *
|
||||
bodyPower) / 100;
|
||||
|
||||
|
||||
//add weapon power
|
||||
// FIXME: Only takes first weapon into account
|
||||
power += weaponPower;
|
||||
|
@ -3774,7 +3773,7 @@ static void intSetTemplateBodyShadowStats(COMP_BASE_STATS *psStats)
|
|||
/* propulsion power points are a percentage of the bodys' power points */
|
||||
body += (propulsionBody *
|
||||
bodyBody) / 100;
|
||||
|
||||
|
||||
//add weapon power
|
||||
// FIXME: Only takes first weapon into account
|
||||
body += weaponBody;
|
||||
|
@ -5334,7 +5333,7 @@ void intRunDesign(void)
|
|||
}*/
|
||||
|
||||
|
||||
extern void BoxBlueWash(UWORD x,UWORD y,UWORD w,UWORD h,BOOL Animate);
|
||||
extern void BoxBlueWash(UWORD x, UWORD y, UWORD w, UWORD h, BOOL Animate);
|
||||
|
||||
void intDisplayStatForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
|
||||
{
|
||||
|
@ -5343,7 +5342,7 @@ void intDisplayStatForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD
|
|||
static UDWORD iRY = 45;
|
||||
// BOOL Hilight = FALSE;
|
||||
BASE_STATS *psStats;
|
||||
iVector Rotation,Position;
|
||||
Vector3i Rotation,Position;
|
||||
SWORD templateRadius;
|
||||
SDWORD falseScale;
|
||||
|
||||
|
@ -5398,7 +5397,7 @@ void intDisplayViewForm(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD
|
|||
W_FORM *Form = (W_FORM*)psWidget;
|
||||
UDWORD x0,y0,x1,y1;
|
||||
static UDWORD iRY = 45;
|
||||
iVector Rotation,Position;
|
||||
Vector3i Rotation, Position;
|
||||
SWORD templateRadius;
|
||||
SDWORD falseScale;
|
||||
|
||||
|
|
|
@ -1556,7 +1556,7 @@ BOOL CheckScrollLimits(void)
|
|||
/* Do the 3D display */
|
||||
void displayWorld(void)
|
||||
{
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
shakeUpdate();
|
||||
|
||||
if(mouseDown(MOUSE_RMB) && rotActive)
|
||||
|
@ -2540,7 +2540,7 @@ DROID_OACTION_INFO oaInfo = {{NULL}};
|
|||
{
|
||||
#ifdef TEST_EFFECT
|
||||
// Code to test an effect when left mouse button pressed
|
||||
iVector Pos;
|
||||
Vector3i Pos;
|
||||
Pos.x = mouseTileX*TILE_UNITS+TILE_UNITS/2;
|
||||
Pos.z = mouseTileY*TILE_UNITS+TILE_UNITS/2;
|
||||
Pos.y = 100;
|
||||
|
|
|
@ -102,7 +102,7 @@ extern UDWORD scroll_speed_accel; // now user modifyable.
|
|||
|
||||
#define BOX_PULSE_SPEED 50
|
||||
|
||||
struct _dragBox
|
||||
struct _dragBox
|
||||
{
|
||||
UDWORD x1;
|
||||
UDWORD y1;
|
||||
|
|
483
src/display3d.c
483
src/display3d.c
|
@ -146,7 +146,7 @@ void preprocessTiles(void);
|
|||
//void postprocessTiles(void);
|
||||
BOOL renderWallSection(STRUCTURE *psStructure);
|
||||
void buildTileTextures(void);
|
||||
void draw3dLine(iVector *src, iVector *dest, UBYTE col);
|
||||
void draw3dLine(Vector3i *src, Vector3i *dest, UBYTE col);
|
||||
UDWORD getSuggestedPitch ( void );
|
||||
void drawDragBox ( void );
|
||||
void calcScreenCoords ( DROID *psDroid );
|
||||
|
@ -160,9 +160,9 @@ void flipsAndRots ( int texture );
|
|||
void displayTerrain ( void );
|
||||
void draw3DScene ( void );
|
||||
iIMDShape *flattenImd(iIMDShape *imd, UDWORD structX, UDWORD structY, UDWORD direction);
|
||||
void RenderCompositeDroid ( UDWORD Index,iVector *Rotation,
|
||||
iVector *Position,
|
||||
iVector *TurretRotation,
|
||||
void RenderCompositeDroid ( UDWORD Index, Vector3i *Rotation,
|
||||
Vector3i *Position,
|
||||
Vector3i *TurretRotation,
|
||||
DROID *psDroid,BOOL RotXYZ );
|
||||
void drawTiles ( iView *camera, iView *player );
|
||||
void display3DProjectiles ( void );
|
||||
|
@ -236,7 +236,7 @@ BOOL selectAttempt = FALSE;
|
|||
iView player, camera;
|
||||
|
||||
/* Temporary rotation vectors to store rotations for droids etc */
|
||||
iVector imdRot,imdRot2;
|
||||
Vector3i imdRot,imdRot2;
|
||||
|
||||
/* How far away are we from the terrain */
|
||||
UDWORD distance = START_DISTANCE;//(DISTANCE - (DISTANCE/6));
|
||||
|
@ -276,7 +276,7 @@ BOOL radarOnScreen=FALSE;
|
|||
BOOL rangeOnScreen = FALSE; // For now, most likely will change later! -Q 5-10-05 A very nice effect - Per
|
||||
|
||||
/* Temporary values for the terrain render - top left corner of grid to be rendered */
|
||||
int32 playerXTile, playerZTile, rx, rz;
|
||||
Sint32 playerXTile, playerZTile, rx, rz;
|
||||
|
||||
/* Have we located the mouse? */
|
||||
BOOL mouseLocated = TRUE;
|
||||
|
@ -293,7 +293,7 @@ UDWORD cameraHeight = 400;
|
|||
|
||||
// The maximum number of points for flattenImd
|
||||
#define MAX_FLATTEN_POINTS 255
|
||||
static iVector alteredPoints[MAX_FLATTEN_POINTS];
|
||||
static Vector3i alteredPoints[MAX_FLATTEN_POINTS];
|
||||
|
||||
//number of tiles visible
|
||||
UDWORD visibleXTiles;
|
||||
|
@ -332,7 +332,9 @@ static UDWORD destTileX=0,destTileY=0;
|
|||
#define FOUNDATION_TEXTURE 22
|
||||
#define EFFECT_DELIVERY_POINT_TRANSPARENCY 128
|
||||
|
||||
#ifdef DEBUG
|
||||
static char buildInfo[255];
|
||||
#endif
|
||||
|
||||
typedef struct _defaultColours
|
||||
{
|
||||
|
@ -431,7 +433,7 @@ BOOL bPlayerHasHQ = FALSE;
|
|||
renderSky();
|
||||
// draw terrain
|
||||
displayTerrain();
|
||||
|
||||
|
||||
pie_BeginInterface();
|
||||
updateLightLevels();
|
||||
drawDroidSelections();
|
||||
|
@ -514,7 +516,7 @@ BOOL bPlayerHasHQ = FALSE;
|
|||
{
|
||||
if(apsDroidLists[0])
|
||||
{
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
UDWORD i;
|
||||
pos.x = apsDroidLists[0]->x;
|
||||
pos.z = apsDroidLists[0]->y;
|
||||
|
@ -658,7 +660,7 @@ void displayTerrain(void)
|
|||
|
||||
|
||||
// Parameter is the vector to store the camera position
|
||||
static void CalcBSPCameraPos(iVector *NewBSPCamera)
|
||||
static void CalcBSPCameraPos(Vector3i *NewBSPCamera)
|
||||
{
|
||||
OBJPOS Camera;
|
||||
|
||||
|
@ -700,7 +702,7 @@ void drawTiles(iView *camera, iView *player)
|
|||
{
|
||||
SDWORD i,j;
|
||||
SDWORD zMax;
|
||||
iVector BSPCamera;
|
||||
Vector3i BSPCamera;
|
||||
MAPTILE *psTile;
|
||||
UDWORD specular;
|
||||
UDWORD tilesRejected;
|
||||
|
@ -806,7 +808,7 @@ void drawTiles(iView *camera, iView *player)
|
|||
tileScreenInfo[i][j].x = ((j-terrainMidX)<<TILE_SHIFT);
|
||||
tileScreenInfo[i][j].y = 0;//map_TileHeight(edgeX,edgeY);
|
||||
tileScreenInfo[i][j].z = ((terrainMidY-i)<<TILE_SHIFT);
|
||||
tileScreenInfo[i][j].sz = pie_RotProj((iVector*)&tileScreenInfo[i][j].x,(iPoint *)&tileScreenInfo[i][j].sx);
|
||||
tileScreenInfo[i][j].sz = pie_RotProj((Vector3i*)&tileScreenInfo[i][j].x, (Vector2i*)&tileScreenInfo[i][j].sx);
|
||||
|
||||
if (pie_GetFogEnabled())
|
||||
{
|
||||
|
@ -898,7 +900,7 @@ void drawTiles(iView *camera, iView *player)
|
|||
TileIllum = (UBYTE)((TileIllum*3)/4);
|
||||
}
|
||||
|
||||
tileScreenInfo[i][j].sz = pie_RotProj((iVector*)&tileScreenInfo[i][j],(iPoint *)&tileScreenInfo[i][j].sx);
|
||||
tileScreenInfo[i][j].sz = pie_RotProj((Vector3i*)&tileScreenInfo[i][j], (Vector2i*)&tileScreenInfo[i][j].sx);
|
||||
|
||||
tileScreenInfo[i][j].light.argb = lightDoFogAndIllumination(TileIllum,rx-tileScreenInfo[i][j].x,rz - ((i-terrainMidY)<<TILE_SHIFT),&specular);
|
||||
|
||||
|
@ -914,7 +916,7 @@ void drawTiles(iView *camera, iView *player)
|
|||
}
|
||||
|
||||
// Transform it into the wx,wy mesh members.
|
||||
tileScreenInfo[i][j].wz = pie_RotProj((iVector*)&tileScreenInfo[i][j],(iPoint *)&tileScreenInfo[i][j].wx);
|
||||
tileScreenInfo[i][j].wz = pie_RotProj((Vector3i*)&tileScreenInfo[i][j], (Vector2i*)&tileScreenInfo[i][j].wx);
|
||||
tileScreenInfo[i][j].wlight.argb = lightDoFogAndIllumination(
|
||||
TileIllum, rx-tileScreenInfo[i][j].x, // cos altval can go to 20
|
||||
rz - ((i-terrainMidY)<<TILE_SHIFT), &specular);
|
||||
|
@ -1318,7 +1320,7 @@ void display3DProjectiles( void )
|
|||
void renderProjectile(PROJ_OBJECT *psCurr)
|
||||
{
|
||||
WEAPON_STATS *psStats;
|
||||
iVector dv;
|
||||
Vector3i dv;
|
||||
iIMDShape *pIMD;
|
||||
UDWORD brightness, specular;
|
||||
// SDWORD centreX, centreZ;
|
||||
|
@ -1397,7 +1399,7 @@ void renderProjectile(PROJ_OBJECT *psCurr)
|
|||
void
|
||||
renderAnimComponent( COMPONENT_OBJECT *psObj )
|
||||
{
|
||||
iVector dv;
|
||||
Vector3i dv;
|
||||
SDWORD posX, posY, posZ, iPlayer;
|
||||
BASE_OBJECT *psParentObj = (BASE_OBJECT *) psObj->psParent;
|
||||
DROID *psDroid;
|
||||
|
@ -2052,8 +2054,8 @@ UDWORD featX,featY;
|
|||
SDWORD rotation;
|
||||
//SDWORD centreX,centreZ;
|
||||
UDWORD brightness, specular;
|
||||
iVector dv;
|
||||
iVector *vecTemp;
|
||||
Vector3i dv;
|
||||
Vector3i *vecTemp;
|
||||
BOOL bForceDraw;
|
||||
|
||||
|
||||
|
@ -2147,7 +2149,7 @@ BOOL bForceDraw;
|
|||
void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp)
|
||||
{
|
||||
UDWORD msgX = 0, msgY = 0;
|
||||
iVector dv = { 0, 0, 0 };
|
||||
Vector3i dv = { 0, 0, 0 };
|
||||
VIEW_PROXIMITY *pViewProximity = NULL;
|
||||
SDWORD x, y, r;
|
||||
iIMDShape *proxImd = NULL;
|
||||
|
@ -2272,29 +2274,29 @@ void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp)
|
|||
// FIXME: this function is not completely multiple weapons compatible
|
||||
void renderStructure(STRUCTURE *psStructure)
|
||||
{
|
||||
SDWORD structX,structY;
|
||||
SDWORD sX,sY;
|
||||
iIMDShape *baseImd,*strImd;//*mountImd,*weaponImd,*flashImd;
|
||||
iIMDShape *mountImd[STRUCT_MAXWEAPS];
|
||||
iIMDShape *weaponImd[STRUCT_MAXWEAPS];
|
||||
iIMDShape *flashImd[STRUCT_MAXWEAPS];
|
||||
SDWORD rotation;
|
||||
SDWORD frame;
|
||||
SDWORD playerFrame;
|
||||
SDWORD animFrame;
|
||||
UDWORD nWeaponStat;
|
||||
UDWORD buildingBrightness, specular;
|
||||
iVector dv;
|
||||
SDWORD i;
|
||||
iIMDShape *lImd,*imd;
|
||||
iVector *temp = NULL;
|
||||
SDWORD brightVar;
|
||||
BOOL bHitByElectronic = FALSE;
|
||||
SDWORD yVar;
|
||||
iIMDShape *pRepImd;
|
||||
REPAIR_FACILITY *psRepairFac = NULL;
|
||||
BOOL defensive = FALSE;
|
||||
SDWORD pointHeight,strHeight,shift;
|
||||
SDWORD structX,structY;
|
||||
SDWORD sX,sY;
|
||||
iIMDShape *baseImd,*strImd;//*mountImd,*weaponImd,*flashImd;
|
||||
iIMDShape *mountImd[STRUCT_MAXWEAPS];
|
||||
iIMDShape *weaponImd[STRUCT_MAXWEAPS];
|
||||
iIMDShape *flashImd[STRUCT_MAXWEAPS];
|
||||
SDWORD rotation;
|
||||
SDWORD frame;
|
||||
SDWORD playerFrame;
|
||||
SDWORD animFrame;
|
||||
UDWORD nWeaponStat;
|
||||
UDWORD buildingBrightness, specular;
|
||||
Vector3i dv;
|
||||
SDWORD i;
|
||||
iIMDShape *lImd = NULL, *imd = NULL;
|
||||
Vector3i *temp = NULL;
|
||||
SDWORD brightVar;
|
||||
BOOL bHitByElectronic = FALSE;
|
||||
SDWORD yVar;
|
||||
iIMDShape *pRepImd;
|
||||
REPAIR_FACILITY *psRepairFac = NULL;
|
||||
BOOL defensive = FALSE;
|
||||
SDWORD pointHeight,strHeight,shift;
|
||||
|
||||
if(psStructure->pStructureType->type == REF_WALL ||
|
||||
psStructure->pStructureType->type == REF_WALLCORNER)
|
||||
|
@ -2346,14 +2348,14 @@ SDWORD pointHeight,strHeight,shift;
|
|||
structX = psStructure->x;
|
||||
structY = psStructure->y;
|
||||
|
||||
if ( defensive )
|
||||
if ( defensive )
|
||||
{
|
||||
// Play with the imd so its flattened
|
||||
imd = psStructure->sDisplay.imd;
|
||||
if ( imd != NULL )
|
||||
{
|
||||
// Get a copy of the points
|
||||
memcpy( alteredPoints, imd->points, imd->npoints * sizeof( iVector ) );
|
||||
memcpy( alteredPoints, imd->points, imd->npoints * sizeof(Vector3i) );
|
||||
|
||||
// Get the height of the centre point for reference
|
||||
strHeight = psStructure->z;//map_Height(structX,structY) + 64;
|
||||
|
@ -2398,7 +2400,7 @@ SDWORD pointHeight,strHeight,shift;
|
|||
|
||||
rotation = DEG(psStructure->direction);
|
||||
iV_MatrixRotateY(-rotation);
|
||||
if( !defensive
|
||||
if( !defensive
|
||||
&& gameTime2-psStructure->timeLastHit < ELEC_DAMAGE_DURATION
|
||||
&& psStructure->lastHitWeapon == WSC_ELECTRONIC )
|
||||
{
|
||||
|
@ -2447,7 +2449,7 @@ SDWORD pointHeight,strHeight,shift;
|
|||
if(imd!=NULL && bHitByElectronic)
|
||||
{
|
||||
// Get a copy of the points
|
||||
memcpy(alteredPoints,imd->points,imd->npoints*sizeof(iVector));
|
||||
memcpy(alteredPoints,imd->points,imd->npoints*sizeof(Vector3i));
|
||||
for(i=0; i<imd->npoints; i++)
|
||||
{
|
||||
yVar = (10-rand()%20);
|
||||
|
@ -2779,9 +2781,9 @@ SDWORD pointHeight,strHeight,shift;
|
|||
/*draw the delivery points */
|
||||
void renderDeliveryPoint(FLAG_POSITION *psPosition)
|
||||
{
|
||||
iVector dv;
|
||||
Vector3i dv;
|
||||
SDWORD x, y, r;
|
||||
iVector *temp = NULL;
|
||||
Vector3i *temp = NULL;
|
||||
// SDWORD centreX, centreZ;
|
||||
SDWORD buildingBrightness, specular;
|
||||
//store the frame number for when deciding what has been clicked on
|
||||
|
@ -2853,11 +2855,11 @@ BOOL renderWallSection(STRUCTURE *psStructure)
|
|||
UDWORD brightness;
|
||||
iIMDShape *imd;
|
||||
SDWORD rotation;
|
||||
iVector dv;
|
||||
Vector3i dv;
|
||||
UDWORD i;
|
||||
UDWORD centreHeight;
|
||||
UDWORD pointHeight;
|
||||
iVector *temp;
|
||||
Vector3i *temp;
|
||||
SDWORD shift;
|
||||
UDWORD buildingBrightness, specular;
|
||||
SDWORD sX,sY;
|
||||
|
@ -2909,7 +2911,7 @@ BOOL renderWallSection(STRUCTURE *psStructure)
|
|||
if(imd!=NULL)
|
||||
{
|
||||
// Get a copy of the points
|
||||
memcpy(alteredPoints,imd->points,imd->npoints*sizeof(iVector));
|
||||
memcpy(alteredPoints,imd->points,imd->npoints*sizeof(Vector3i));
|
||||
// Get the height of the centre point for reference
|
||||
centreHeight = map_Height(structX,structY);
|
||||
// Now we got through the shape looking for vertices on the edge
|
||||
|
@ -2986,8 +2988,8 @@ BOOL renderWallSection(STRUCTURE *psStructure)
|
|||
/* renderShadow: draws shadow under droid */
|
||||
void renderShadow( DROID *psDroid, iIMDShape *psShadowIMD )
|
||||
{
|
||||
iVector dv;
|
||||
iVector *pVecTemp;
|
||||
Vector3i dv;
|
||||
Vector3i *pVecTemp;
|
||||
SDWORD shadowScale;
|
||||
UDWORD brightness, specular;
|
||||
// SDWORD centreX, centreZ;
|
||||
|
@ -3569,8 +3571,8 @@ void showDroidSelection( DROID *psDroid )
|
|||
|
||||
void drawDeliveryPointSelection(void)
|
||||
{
|
||||
FLAG_POSITION *psDelivPoint;
|
||||
SDWORD scrX,scrY,scrR;
|
||||
FLAG_POSITION *psDelivPoint;
|
||||
UDWORD scrX,scrY,scrR;
|
||||
|
||||
//draw the selected Delivery Point if any
|
||||
for(psDelivPoint = apsFlagPosLists[selectedPlayer]; psDelivPoint; psDelivPoint =
|
||||
|
@ -3592,19 +3594,19 @@ SDWORD scrX,scrY,scrR;
|
|||
|
||||
void drawDroidSelections( void )
|
||||
{
|
||||
SDWORD scrX,scrY,scrR;
|
||||
DROID *psDroid;
|
||||
UDWORD damage;
|
||||
UDWORD longPowerCol = 0;
|
||||
UBYTE boxCol;
|
||||
UDWORD longBoxCol;
|
||||
BASE_OBJECT *psClickedOn;
|
||||
BOOL bMouseOverDroid = FALSE;
|
||||
BOOL bMouseOverOwnDroid = FALSE;
|
||||
BOOL bBeingTracked;
|
||||
UDWORD i,index;
|
||||
FEATURE *psFeature;
|
||||
FRACT mulH;
|
||||
UDWORD scrX,scrY,scrR;
|
||||
DROID *psDroid;
|
||||
UDWORD damage;
|
||||
UDWORD longPowerCol = 0;
|
||||
UBYTE boxCol;
|
||||
UDWORD longBoxCol;
|
||||
BASE_OBJECT *psClickedOn;
|
||||
BOOL bMouseOverDroid = FALSE;
|
||||
BOOL bMouseOverOwnDroid = FALSE;
|
||||
BOOL bBeingTracked;
|
||||
UDWORD i,index;
|
||||
FEATURE *psFeature;
|
||||
FRACT mulH;
|
||||
|
||||
psClickedOn = mouseTarget();
|
||||
if(psClickedOn!=NULL && psClickedOn->type == OBJ_DROID)
|
||||
|
@ -3757,7 +3759,6 @@ FRACT mulH;
|
|||
drawDroidGroupNumber(psDroid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (bReloadBars)
|
||||
|
@ -3768,7 +3769,6 @@ FRACT mulH;
|
|||
drawWeaponReloadBar((BASE_OBJECT *)psDroid, &psDroid->asWeaps[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3782,44 +3782,44 @@ FRACT mulH;
|
|||
if(psClickedOn->player!=selectedPlayer && psClickedOn->sDisplay.frameNumber == currentGameFrame)
|
||||
{
|
||||
psDroid = (DROID*)psClickedOn;
|
||||
//show resistance values if CTRL/SHIFT depressed
|
||||
if (ctrlShiftDown())
|
||||
{
|
||||
if (psDroid->resistance)
|
||||
{
|
||||
damage = PERCENT(psDroid->resistance, droidResistance(psDroid));
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = 100;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = PERCENT(psDroid->body,psDroid->originalBody);
|
||||
}
|
||||
//show resistance values if CTRL/SHIFT depressed
|
||||
if (ctrlShiftDown())
|
||||
{
|
||||
if (psDroid->resistance)
|
||||
{
|
||||
damage = PERCENT(psDroid->resistance, droidResistance(psDroid));
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = 100;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = PERCENT(psDroid->body,psDroid->originalBody);
|
||||
}
|
||||
|
||||
if (damage > REPAIRLEV_HIGH) longPowerCol = 0x0000ff00; //green
|
||||
if (damage > REPAIRLEV_HIGH) longPowerCol = 0x0000ff00; //green
|
||||
else if(damage > REPAIRLEV_LOW) longPowerCol = 0x00ffff00; //yellow
|
||||
else longPowerCol = 0x00ff0000; //red
|
||||
|
||||
//show resistance values if CTRL/SHIFT depressed
|
||||
if (ctrlShiftDown())
|
||||
{
|
||||
if (psDroid->resistance)
|
||||
{
|
||||
mulH = MAKEFRACT(psDroid->resistance) / MAKEFRACT(droidResistance(psDroid));
|
||||
}
|
||||
else
|
||||
{
|
||||
mulH = 100;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mulH = MAKEFRACT(psDroid->body) / MAKEFRACT(psDroid->originalBody);
|
||||
}
|
||||
damage = MAKEINT(mulH*MAKEFRACT(psDroid->sDisplay.screenR));// (((psDroid->sDisplay.screenR*10000)/100)*damage)/10000;
|
||||
//show resistance values if CTRL/SHIFT depressed
|
||||
if (ctrlShiftDown())
|
||||
{
|
||||
if (psDroid->resistance)
|
||||
{
|
||||
mulH = MAKEFRACT(psDroid->resistance) / MAKEFRACT(droidResistance(psDroid));
|
||||
}
|
||||
else
|
||||
{
|
||||
mulH = 100;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mulH = MAKEFRACT(psDroid->body) / MAKEFRACT(psDroid->originalBody);
|
||||
}
|
||||
damage = MAKEINT(mulH*MAKEFRACT(psDroid->sDisplay.screenR));// (((psDroid->sDisplay.screenR*10000)/100)*damage)/10000;
|
||||
// damage = MAKEINT(MAKEFRACT(psDroid->body) / MAKEFRACT(psDroid->originalBody));// (((psDroid->sDisplay.screenR*10000)/100)*damage)/10000;
|
||||
// damage = (((psDroid->sDisplay.screenR*10000)/100)*damage)/10000;
|
||||
if(damage>psDroid->sDisplay.screenR) damage = psDroid->sDisplay.screenR;
|
||||
|
@ -3892,9 +3892,9 @@ FRACT mulH;
|
|||
/* ---------------------------------------------------------------------------- */
|
||||
void drawBuildingLines( void )
|
||||
{
|
||||
iVector first,second;
|
||||
Vector3i first, second;
|
||||
|
||||
if(buildState == BUILD3D_VALID || buildState == BUILD3D_POS)
|
||||
if(buildState == BUILD3D_VALID || buildState == BUILD3D_POS)
|
||||
{
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON);
|
||||
pie_SetFogStatus(FALSE);
|
||||
|
@ -3910,7 +3910,6 @@ if(buildState == BUILD3D_VALID || buildState == BUILD3D_POS)
|
|||
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON);
|
||||
}
|
||||
|
||||
}
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
#define GN_X_OFFSET (28)
|
||||
|
@ -4054,10 +4053,10 @@ SDWORD xShift,yShift, index;
|
|||
|
||||
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
void draw3dLine(iVector *src, iVector *dest, UBYTE col)
|
||||
void draw3dLine(Vector3i *src, Vector3i *dest, UBYTE col)
|
||||
{
|
||||
iVector null,vec;
|
||||
iPoint srcS,destS;
|
||||
Vector3i null, vec;
|
||||
Vector2i srcS, destS;
|
||||
|
||||
null.x = null.y = null.z = 0;
|
||||
vec.x = (src->x - player.p.x) - terrainMidX*TILE_UNITS;
|
||||
|
@ -4217,107 +4216,107 @@ SDWORD order;
|
|||
}
|
||||
}
|
||||
|
||||
//don't display until we're releasing this feature in an update!
|
||||
//don't display until we're releasing this feature in an update!
|
||||
#ifndef DISABLE_BUILD_QUEUE
|
||||
if (intBuildSelectMode())
|
||||
{
|
||||
//and there may be multiple building sites that need highlighting - AB 26/04/99
|
||||
if (ctrlShiftDown())
|
||||
{
|
||||
//this just highlights the current interface selected unit
|
||||
//psObj = getCurrentSelected();
|
||||
//if (psObj && psObj->type == OBJ_DROID)
|
||||
if (intBuildSelectMode())
|
||||
{
|
||||
//and there may be multiple building sites that need highlighting - AB 26/04/99
|
||||
if (ctrlShiftDown())
|
||||
{
|
||||
//this just highlights the current interface selected unit
|
||||
//psObj = getCurrentSelected();
|
||||
//if (psObj && psObj->type == OBJ_DROID)
|
||||
|
||||
//this highlights ALL constructor units' build sites
|
||||
for (psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
|
||||
{
|
||||
//psDroid = (DROID *)psObj;
|
||||
if (psDroid->droidType == DROID_CONSTRUCT ||
|
||||
psDroid->droidType == DROID_CYBORG_CONSTRUCT)
|
||||
{
|
||||
//draw the current build site if its a line of structures
|
||||
if (psDroid->order == DORDER_LINEBUILD)
|
||||
{
|
||||
left = psDroid->orderX >> TILE_SHIFT;
|
||||
right = (psDroid->orderX2 >> TILE_SHIFT) + 1;
|
||||
if (left > right)
|
||||
{
|
||||
size = left;
|
||||
left = right;
|
||||
right = size;
|
||||
}
|
||||
up = psDroid->orderY >> TILE_SHIFT;
|
||||
down = (psDroid->orderY2 >> TILE_SHIFT) + 1;
|
||||
if (up > down)
|
||||
{
|
||||
size = up;
|
||||
up = down;
|
||||
down = size;
|
||||
}
|
||||
//hilight the tiles
|
||||
for(i=left; i<right; i++)
|
||||
{
|
||||
for(j=up; j<down; j++)
|
||||
{
|
||||
SET_TILE_HIGHLIGHT(mapTile(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
//now look thru' the list of orders to see if more building sites
|
||||
for (order = 0; order < psDroid->listSize; order++)
|
||||
{
|
||||
if (psDroid->asOrderList[order].order == DORDER_BUILD)
|
||||
{
|
||||
//set up coords for tiles
|
||||
size = ((STRUCTURE_STATS *)psDroid->asOrderList[order].
|
||||
psOrderTarget)->baseWidth;
|
||||
left = ((psDroid->asOrderList[order].x) >> TILE_SHIFT) - size/2;
|
||||
right = left + size;
|
||||
size = ((STRUCTURE_STATS *)psDroid->asOrderList[order].
|
||||
psOrderTarget)->baseBreadth;
|
||||
up = ((psDroid->asOrderList[order].y) >> TILE_SHIFT) - size/2;
|
||||
down = up + size;
|
||||
//hilight the tiles
|
||||
for(i=left; i<right; i++)
|
||||
{
|
||||
for(j=up; j<down; j++)
|
||||
{
|
||||
SET_TILE_HIGHLIGHT(mapTile(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (psDroid->asOrderList[order].order == DORDER_LINEBUILD)
|
||||
{
|
||||
//need to highlight the length of the wall
|
||||
left = psDroid->asOrderList[order].x >> TILE_SHIFT;
|
||||
right = psDroid->asOrderList[order].x2 >> TILE_SHIFT;
|
||||
if (left > right)
|
||||
{
|
||||
size = left;
|
||||
left = right;
|
||||
right = size;
|
||||
}
|
||||
up = psDroid->asOrderList[order].y >> TILE_SHIFT;
|
||||
down = psDroid->asOrderList[order].y2 >> TILE_SHIFT;
|
||||
if (up > down)
|
||||
{
|
||||
size = up;
|
||||
up = down;
|
||||
down = size;
|
||||
}
|
||||
//hilight the tiles
|
||||
for(i=left; i<=right; i++)
|
||||
{
|
||||
for(j=up; j<=down; j++)
|
||||
{
|
||||
SET_TILE_HIGHLIGHT(mapTile(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//this highlights ALL constructor units' build sites
|
||||
for (psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
|
||||
{
|
||||
//psDroid = (DROID *)psObj;
|
||||
if (psDroid->droidType == DROID_CONSTRUCT ||
|
||||
psDroid->droidType == DROID_CYBORG_CONSTRUCT)
|
||||
{
|
||||
//draw the current build site if its a line of structures
|
||||
if (psDroid->order == DORDER_LINEBUILD)
|
||||
{
|
||||
left = psDroid->orderX >> TILE_SHIFT;
|
||||
right = (psDroid->orderX2 >> TILE_SHIFT) + 1;
|
||||
if (left > right)
|
||||
{
|
||||
size = left;
|
||||
left = right;
|
||||
right = size;
|
||||
}
|
||||
up = psDroid->orderY >> TILE_SHIFT;
|
||||
down = (psDroid->orderY2 >> TILE_SHIFT) + 1;
|
||||
if (up > down)
|
||||
{
|
||||
size = up;
|
||||
up = down;
|
||||
down = size;
|
||||
}
|
||||
//hilight the tiles
|
||||
for(i=left; i<right; i++)
|
||||
{
|
||||
for(j=up; j<down; j++)
|
||||
{
|
||||
SET_TILE_HIGHLIGHT(mapTile(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
//now look thru' the list of orders to see if more building sites
|
||||
for (order = 0; order < psDroid->listSize; order++)
|
||||
{
|
||||
if (psDroid->asOrderList[order].order == DORDER_BUILD)
|
||||
{
|
||||
//set up coords for tiles
|
||||
size = ((STRUCTURE_STATS *)psDroid->asOrderList[order].
|
||||
psOrderTarget)->baseWidth;
|
||||
left = ((psDroid->asOrderList[order].x) >> TILE_SHIFT) - size/2;
|
||||
right = left + size;
|
||||
size = ((STRUCTURE_STATS *)psDroid->asOrderList[order].
|
||||
psOrderTarget)->baseBreadth;
|
||||
up = ((psDroid->asOrderList[order].y) >> TILE_SHIFT) - size/2;
|
||||
down = up + size;
|
||||
//hilight the tiles
|
||||
for(i=left; i<right; i++)
|
||||
{
|
||||
for(j=up; j<down; j++)
|
||||
{
|
||||
SET_TILE_HIGHLIGHT(mapTile(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (psDroid->asOrderList[order].order == DORDER_LINEBUILD)
|
||||
{
|
||||
//need to highlight the length of the wall
|
||||
left = psDroid->asOrderList[order].x >> TILE_SHIFT;
|
||||
right = psDroid->asOrderList[order].x2 >> TILE_SHIFT;
|
||||
if (left > right)
|
||||
{
|
||||
size = left;
|
||||
left = right;
|
||||
right = size;
|
||||
}
|
||||
up = psDroid->asOrderList[order].y >> TILE_SHIFT;
|
||||
down = psDroid->asOrderList[order].y2 >> TILE_SHIFT;
|
||||
if (up > down)
|
||||
{
|
||||
size = up;
|
||||
up = down;
|
||||
down = size;
|
||||
}
|
||||
//hilight the tiles
|
||||
for(i=left; i<=right; i++)
|
||||
{
|
||||
for(j=up; j<=down; j++)
|
||||
{
|
||||
SET_TILE_HIGHLIGHT(mapTile(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// if(tileCount)
|
||||
|
@ -4376,13 +4375,13 @@ MAPTILE *psTile;
|
|||
|
||||
void locateMouse(void)
|
||||
{
|
||||
UDWORD i,j;
|
||||
POINT pt;
|
||||
QUAD quad;
|
||||
SDWORD nearestZ = SDWORD_MAX;
|
||||
SDWORD tileZ;
|
||||
BOOL bWaterTile;
|
||||
//UDWORD bX,bY;
|
||||
UDWORD i,j;
|
||||
POINT pt;
|
||||
QUAD quad;
|
||||
SDWORD nearestZ = SDWORD_MAX;
|
||||
SDWORD tileZ;
|
||||
BOOL bWaterTile;
|
||||
//UDWORD bX,bY;
|
||||
|
||||
pt.x = mX;
|
||||
pt.y = mY;
|
||||
|
@ -4413,9 +4412,9 @@ BOOL bWaterTile;
|
|||
mouseTileX = playerXTile+j;
|
||||
mouseTileY = playerZTile+i;
|
||||
if(mouseTileX<0) mouseTileX = 0;
|
||||
if(mouseTileX>mapWidth-1) mouseTileX = mapWidth-1;
|
||||
if(mouseTileX > mapWidth-1) mouseTileX = mapWidth-1;
|
||||
if(mouseTileY<0) mouseTileY = 0;
|
||||
if(mouseTileY>mapHeight-1) mouseTileY = mapHeight-1;
|
||||
if(mouseTileY > mapHeight-1) mouseTileY = mapHeight-1;
|
||||
|
||||
tile3dX = playerXTile+j;
|
||||
tile3dY = playerZTile+i;
|
||||
|
@ -4465,7 +4464,7 @@ SDWORD shift;
|
|||
"flattenImd: too many points in the PIE to flatten it" );
|
||||
|
||||
/* Get a copy of the points */
|
||||
memcpy(alteredPoints,imd->points,imd->npoints*sizeof(iVector));
|
||||
memcpy(alteredPoints,imd->points,imd->npoints*sizeof(Vector3i));
|
||||
/* Get the height of the centre point for reference */
|
||||
centreHeight = map_Height(structX,structY);
|
||||
/* Now we go through the shape looking for vertices on the edge */
|
||||
|
@ -4578,7 +4577,7 @@ void drawTerrainTile(UDWORD i, UDWORD j, BOOL onWaterEdge)
|
|||
MAPTILE *psTile;
|
||||
BOOL bOutlined;
|
||||
UDWORD tileNumber;
|
||||
iPoint offset;
|
||||
Vector2i offset;
|
||||
PIEVERTEX aVrts[3];
|
||||
UBYTE oldColours[4] = { 0, 0, 0, 0 };
|
||||
UDWORD oldColoursWord[4] = { 0, 0, 0, 0 };
|
||||
|
@ -4596,8 +4595,8 @@ void drawTerrainTile(UDWORD i, UDWORD j, BOOL onWaterEdge)
|
|||
/* Let's just get out now if we're not supposed to draw it */
|
||||
if( (actualX<0) ||
|
||||
(actualY<0) ||
|
||||
(actualX>mapWidth-1) ||
|
||||
(actualY>mapHeight-1) )
|
||||
(actualX > mapWidth-1) ||
|
||||
(actualY > mapHeight-1) )
|
||||
{
|
||||
psTile = &edgeTile;
|
||||
CLEAR_TILE_HIGHLIGHT(psTile);
|
||||
|
@ -4879,7 +4878,7 @@ void drawTerrainWaterTile(UDWORD i, UDWORD j)
|
|||
MAPTILE *psTile;
|
||||
//BOOL bOutlined;
|
||||
UDWORD tileNumber;
|
||||
iPoint offset;
|
||||
Vector2i offset;
|
||||
PIEVERTEX aVrts[3];
|
||||
|
||||
/* Get the correct tile index for the x coordinate */
|
||||
|
@ -5227,7 +5226,7 @@ static void testEffect2( UDWORD player )
|
|||
UDWORD angle;
|
||||
STRUCTURE *psStructure;
|
||||
SDWORD xDif,yDif;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
UDWORD numConnected;
|
||||
POWER_GEN *psPowerGen;
|
||||
DROID *psDroid;
|
||||
|
@ -5406,12 +5405,12 @@ STRUCTURE *psStruct;
|
|||
|
||||
void showSensorRange1(DROID *psDroid) //this one doesn't do a circle, it displays 30 or so units at a time
|
||||
{
|
||||
SDWORD val;
|
||||
SDWORD radius;
|
||||
UDWORD angle;
|
||||
SDWORD xDif,yDif;
|
||||
UDWORD sensorRange;
|
||||
iVector pos;
|
||||
SDWORD val;
|
||||
SDWORD radius;
|
||||
UDWORD angle;
|
||||
SDWORD xDif,yDif;
|
||||
UDWORD sensorRange;
|
||||
Vector3i pos;
|
||||
|
||||
angle = gameTime%3600;
|
||||
val = angle/10;
|
||||
|
@ -5431,14 +5430,14 @@ iVector pos;
|
|||
|
||||
void showSensorRange2(BASE_OBJECT *psObj)
|
||||
{
|
||||
SDWORD radius;
|
||||
SDWORD xDif,yDif;
|
||||
UDWORD sensorRange;
|
||||
iVector pos;
|
||||
UDWORD i;
|
||||
DROID *psDroid;
|
||||
STRUCTURE *psStruct;
|
||||
BOOL bBuilding=FALSE;
|
||||
SDWORD radius;
|
||||
SDWORD xDif,yDif;
|
||||
UDWORD sensorRange;
|
||||
Vector3i pos;
|
||||
UDWORD i;
|
||||
DROID *psDroid;
|
||||
STRUCTURE *psStruct;
|
||||
BOOL bBuilding=FALSE;
|
||||
|
||||
for(i=0; i<360; i++)
|
||||
{
|
||||
|
@ -5478,7 +5477,7 @@ BOOL bBuilding=FALSE;
|
|||
void drawRangeAtPos(SDWORD centerX, SDWORD centerY, SDWORD radius)
|
||||
{
|
||||
SDWORD xDif,yDif;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
UDWORD i;
|
||||
|
||||
for(i=0; i<360; i++)
|
||||
|
@ -5728,11 +5727,11 @@ UDWORD i;
|
|||
static void addConstructionLine(DROID *psDroid, STRUCTURE *psStructure)
|
||||
{
|
||||
PIEVERTEX pts[3];
|
||||
iVector each;
|
||||
iVector *point;
|
||||
Vector3i each;
|
||||
Vector3i *point;
|
||||
UDWORD pointIndex;
|
||||
SDWORD realY;
|
||||
iVector null,vec;
|
||||
Vector3i null, vec;
|
||||
SDWORD rx,rz;
|
||||
UDWORD colour;
|
||||
UDWORD specular;
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#include "objectdef.h"
|
||||
#include "message.h"
|
||||
|
||||
extern BOOL xInOrder,yInOrder,yBeforeX,spinScene;
|
||||
extern BOOL xInOrder, yInOrder, yBeforeX, spinScene;
|
||||
|
||||
extern UDWORD mapX,mapY;
|
||||
extern UDWORD mapX,mapY;
|
||||
extern void setViewAngle(SDWORD angle);
|
||||
extern UDWORD getViewDistance(void);
|
||||
extern void setViewDistance(UDWORD dist);
|
||||
|
@ -79,18 +79,16 @@ extern BOOL clipXY ( SDWORD x, SDWORD y);
|
|||
extern BOOL init3DView(void);
|
||||
extern void initViewPosition(void);
|
||||
extern iView player,camera;
|
||||
extern iVector imdRot;
|
||||
extern Vector3i imdRot;
|
||||
extern UDWORD distance;
|
||||
extern UDWORD terrainOutline;
|
||||
extern SDWORD mouseTileX;
|
||||
extern SDWORD mouseTileY;
|
||||
extern UDWORD xOffset,yOffset;
|
||||
extern BOOL selectAttempt;
|
||||
extern BOOL draggingTile;
|
||||
extern struct iIMDShape *g_imd;
|
||||
extern BOOL droidSelected;
|
||||
extern UDWORD terrainMidX,terrainMidY;
|
||||
extern int32 playerXTile, playerZTile, rx, rz;
|
||||
extern Sint32 playerXTile, playerZTile, rx, rz;
|
||||
|
||||
extern SDWORD scrollSpeed;
|
||||
extern iBitmap **tilesRAW;
|
||||
|
@ -110,7 +108,7 @@ extern SDWORD getCentreX( void );
|
|||
extern SDWORD getCentreZ( void );
|
||||
|
||||
|
||||
extern SDWORD mouseTileX,mouseTileY;
|
||||
extern SDWORD mouseTileX, mouseTileY;
|
||||
extern BOOL yBeforeX;
|
||||
extern UDWORD numDroidsSelected;
|
||||
extern UDWORD intensity1,intensity2,intensity3;
|
||||
|
|
|
@ -107,7 +107,7 @@ DROID *psDrivenDroid = NULL; // The droid that's being driven.
|
|||
static BOOL bDriveMode = FALSE;
|
||||
static SDWORD driveDir; // Driven droid's direction.
|
||||
static SDWORD driveSpeed; // Driven droid's speed.
|
||||
static int driveBumpTime; // Time that followers get a kick up the ass.
|
||||
static UDWORD driveBumpTime; // Time that followers get a kick up the ass.
|
||||
static BOOL DoFollowRangeCheck = TRUE;
|
||||
static BOOL AllInRange = TRUE;
|
||||
static BOOL ClearFollowRangeCheck = FALSE;
|
||||
|
@ -634,8 +634,6 @@ void driveUpdate(void)
|
|||
|
||||
if(DirectControl) {
|
||||
if(psDrivenDroid != NULL) {
|
||||
|
||||
|
||||
if(bMultiPlayer && (driveBumpTime < gameTime)) // send latest info about driven droid.
|
||||
{
|
||||
SendDroidInfo(psDrivenDroid,DORDER_MOVE,psDrivenDroid->x,psDrivenDroid->y, NULL);
|
||||
|
|
26
src/droid.c
26
src/droid.c
|
@ -481,7 +481,7 @@ void recycleDroid(DROID *psDroid)
|
|||
{
|
||||
UDWORD numKills, minKills;
|
||||
SDWORD i, cost, storeIndex;
|
||||
iVector position;
|
||||
Vector3i position;
|
||||
|
||||
// store the droids kills
|
||||
numKills = psDroid->numKills;
|
||||
|
@ -690,7 +690,7 @@ UDWORD droidRemoveKills=0;
|
|||
*/
|
||||
static void removeDroidFX(DROID *psDel)
|
||||
{
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
|
||||
// only display anything if the droid is visible
|
||||
if (!psDel->visible[selectedPlayer])
|
||||
|
@ -793,7 +793,7 @@ void vanishDroid(DROID *psDel)
|
|||
/* Remove a droid and free it's memory */
|
||||
void destroyDroid(DROID *psDel)
|
||||
{
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
UDWORD widthScatter,breadthScatter,heightScatter;
|
||||
UDWORD i;
|
||||
DROID *psCurr, *psNext;
|
||||
|
@ -1286,7 +1286,7 @@ void droidGetNaybors(DROID *psDroid)
|
|||
/* The main update routine for all droids */
|
||||
void droidUpdate(DROID *psDroid)
|
||||
{
|
||||
iVector dv;
|
||||
Vector3i dv;
|
||||
UDWORD percentDamage, emissionInterval;
|
||||
BASE_OBJECT *psBeingTargetted = NULL;
|
||||
SDWORD damageToDo;
|
||||
|
@ -1759,21 +1759,19 @@ BOOL droidStartBuild(DROID *psDroid)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void droidAddWeldSound( iVector iVecEffect )
|
||||
static void droidAddWeldSound( Vector3i iVecEffect )
|
||||
{
|
||||
SDWORD iAudioID;
|
||||
|
||||
|
||||
iAudioID = ID_SOUND_CONSTRUCTION_1 + (rand()%4);
|
||||
|
||||
|
||||
audio_PlayStaticTrack( iVecEffect.x, iVecEffect.z, iAudioID );
|
||||
}
|
||||
|
||||
static void addConstructorEffect(STRUCTURE *psStruct)
|
||||
{
|
||||
UDWORD widthRange,breadthRange;
|
||||
iVector temp;
|
||||
Vector3i temp;
|
||||
|
||||
//FIXME
|
||||
if((ONEINTEN) && (psStruct->visible[selectedPlayer]))
|
||||
|
@ -2637,7 +2635,7 @@ BOOL droidUpdateDroidRepair(DROID *psRepairDroid)
|
|||
{
|
||||
DROID *psDroidToRepair;
|
||||
UDWORD iPointsToAdd, iRepairPoints, powerCost;
|
||||
iVector iVecEffect;
|
||||
Vector3i iVecEffect;
|
||||
|
||||
ASSERT( psRepairDroid->action == DACTION_DROIDREPAIR,
|
||||
"unitUpdateUnitRepair: unit does not have unit repair order" );
|
||||
|
@ -3902,7 +3900,7 @@ UDWORD calcDroidBaseBody(DROID *psDroid)
|
|||
UDWORD calcDroidBaseSpeed(DROID_TEMPLATE *psTemplate, UDWORD weight, UBYTE player)
|
||||
{
|
||||
UDWORD speed;
|
||||
//Watermelon:engine output bonus? 150%
|
||||
//Watermelon:engine output bonus? 150%
|
||||
float eoBonus = 1.5f;
|
||||
|
||||
//return ((asBodyStats + psTemplate->asParts[COMP_BODY])->
|
||||
|
@ -4546,7 +4544,7 @@ void droidSetBits(DROID_TEMPLATE *pTemplate,DROID *psDroid)
|
|||
//Watermelon:Re-enabled this one,cause I need numWeaps in psDroid
|
||||
if (pTemplate->numWeaps > 0)
|
||||
{
|
||||
|
||||
|
||||
//can only have one weapon now
|
||||
//Watermelon:re-enabled this for loop
|
||||
for (inc=0; inc < pTemplate->numWeaps; inc++)
|
||||
|
@ -5172,15 +5170,15 @@ void setSelectedCommander(UDWORD commander)
|
|||
selectedCommander = commander;
|
||||
}
|
||||
|
||||
/* calculate muzzle tip location in 3d world
|
||||
/* calculate muzzle tip location in 3d world
|
||||
* Watermelon:note:only the 1st muzzleLocation is calculated,since WEAPON_IMD and WEAPON_MOUNT_IMD
|
||||
* are #define pointing to asWeaps[0]...
|
||||
*/
|
||||
BOOL calcDroidMuzzleLocation(DROID *psDroid, iVector *muzzle, int weapon_slot)
|
||||
BOOL calcDroidMuzzleLocation(DROID *psDroid, Vector3i *muzzle, int weapon_slot)
|
||||
{
|
||||
// UDWORD turretType;
|
||||
// UDWORD bodyType;
|
||||
iVector barrel;
|
||||
Vector3i barrel;
|
||||
iIMDShape *psShape, *psWeapon, *psWeaponMount;
|
||||
|
||||
psShape = BODY_IMD(psDroid,psDroid->player);
|
||||
|
|
42
src/droid.h
42
src/droid.h
|
@ -37,7 +37,7 @@
|
|||
#define DROID_EXPLOSION_SPREAD_Y (rand()%TILE_UNITS)
|
||||
#define DROID_EXPLOSION_SPREAD_Z (TILE_UNITS/2 - (rand()%TILE_UNITS))
|
||||
|
||||
/*defines the % to decrease the illumination of a tile when building - gets set
|
||||
/*defines the % to decrease the illumination of a tile when building - gets set
|
||||
back when building is destroyed*/
|
||||
//#define FOUNDATION_ILLUMIN 50
|
||||
|
||||
|
@ -98,7 +98,7 @@ extern BOOL loadDroidWeapons(char *pWeaponData, UDWORD bufferSize);
|
|||
extern void initTemplatePoints(void);
|
||||
|
||||
/*Builds an instance of a Structure - the x/y passed in are in world coords.*/
|
||||
extern DROID* buildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y,
|
||||
extern DROID* buildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y,
|
||||
UDWORD player, BOOL onMission);
|
||||
|
||||
/* Set the asBits in a DROID structure given it's template. */
|
||||
|
@ -110,7 +110,7 @@ extern SDWORD droidCalcExp(DROID *psDroid);
|
|||
/* Calculate the weight of a droid from it's template */
|
||||
extern UDWORD calcDroidWeight(DROID_TEMPLATE *psTemplate);
|
||||
|
||||
/* Calculate the power points required to build/maintain a droid */
|
||||
/* Calculate the power points required to build/maintain a droid */
|
||||
extern UDWORD calcDroidPower(DROID *psDroid);
|
||||
|
||||
/* Calculate the body points of a droid from it's template */
|
||||
|
@ -131,7 +131,7 @@ extern UDWORD calcTemplateBuild(DROID_TEMPLATE *psTemplate);
|
|||
/* Calculate the points required to build the droid */
|
||||
//UDWORD calcDroidBuild(DROID *psDroid);
|
||||
|
||||
/* Calculate the power points required to build/maintain the droid */
|
||||
/* Calculate the power points required to build/maintain the droid */
|
||||
extern UDWORD calcTemplatePower(DROID_TEMPLATE *psTemplate);
|
||||
|
||||
// return whether a template is for an IDF droid
|
||||
|
@ -158,14 +158,14 @@ extern BOOL droidStartFoundation(DROID *psDroid);
|
|||
/* Sets a droid to start demolishing - returns true if successful */
|
||||
extern BOOL droidStartDemolishing( DROID *psDroid );
|
||||
|
||||
/* Update a construction droid while it is demolishing
|
||||
/* Update a construction droid while it is demolishing
|
||||
returns TRUE while demolishing */
|
||||
extern BOOL droidUpdateDemolishing( DROID *psDroid );
|
||||
|
||||
/* Sets a droid to start repairing - returns true if successful */
|
||||
extern BOOL droidStartRepair( DROID *psDroid );
|
||||
|
||||
/* Update a construction droid while it is repairing
|
||||
/* Update a construction droid while it is repairing
|
||||
returns TRUE while repairing */
|
||||
extern BOOL droidUpdateRepair( DROID *psDroid );
|
||||
|
||||
|
@ -178,7 +178,7 @@ extern BOOL droidUpdateDroidRepair(DROID *psRepairDroid);
|
|||
/*checks a droids current body points to see if need to self repair*/
|
||||
extern void droidSelfRepair(DROID *psDroid);
|
||||
|
||||
/* Update a construction droid while it is building
|
||||
/* Update a construction droid while it is building
|
||||
returns TRUE while building continues */
|
||||
extern BOOL droidUpdateBuild(DROID *psDroid);
|
||||
|
||||
|
@ -219,7 +219,7 @@ extern DROID_TYPE droidType(DROID *psDroid);
|
|||
|
||||
/* Return the type of a droid from it's template */
|
||||
extern DROID_TYPE droidTemplateType(DROID_TEMPLATE *psTemplate);
|
||||
|
||||
|
||||
//fills the list with Templates that can be manufactured in the Factory - based on size
|
||||
extern UDWORD fillTemplateList(DROID_TEMPLATE **pList, STRUCTURE *psFactory, UDWORD limit);
|
||||
|
||||
|
@ -234,7 +234,7 @@ extern UDWORD getNumDroidsForLevel(UDWORD level);
|
|||
|
||||
extern BOOL activateGroupAndMove(UDWORD playerNumber, UDWORD groupNumber);
|
||||
/* calculate muzzle tip location in 3d world added int weapon_slot to fix the always slot 0 hack*/
|
||||
extern BOOL calcDroidMuzzleLocation(DROID *psDroid, iVector *muzzle, int weapon_slot);
|
||||
extern BOOL calcDroidMuzzleLocation(DROID *psDroid, Vector3i *muzzle, int weapon_slot);
|
||||
|
||||
/* gets a template from its name - relies on the name being unique */
|
||||
extern DROID_TEMPLATE* getTemplateFromName(char *pName);
|
||||
|
@ -272,20 +272,20 @@ extern PICKTILE pickHalfATile (UDWORD *x, UDWORD *y, UBYTE numIterations);
|
|||
extern BOOL pickATile2 (UDWORD *x, UDWORD *y, UDWORD numIterations);
|
||||
extern BOOL normalPAT(UDWORD x, UDWORD y);
|
||||
extern BOOL zonedPAT(UDWORD x, UDWORD y);
|
||||
extern BOOL pickATileGen(UDWORD *x, UDWORD *y, UBYTE numIterations,
|
||||
extern BOOL pickATileGen(UDWORD *x, UDWORD *y, UBYTE numIterations,
|
||||
BOOL (*function)(UDWORD x, UDWORD y));
|
||||
extern BOOL pickATileGenThreat(UDWORD *x, UDWORD *y, UBYTE numIterations, SDWORD threatRange,
|
||||
extern BOOL pickATileGenThreat(UDWORD *x, UDWORD *y, UBYTE numIterations, SDWORD threatRange,
|
||||
SDWORD player, BOOL (*function)(UDWORD x, UDWORD y));
|
||||
|
||||
|
||||
//initialises the droid movement model
|
||||
extern void initDroidMovement(DROID *psDroid);
|
||||
|
||||
/* Looks through the players list of droids to see if any of them are
|
||||
/* Looks through the players list of droids to see if any of them are
|
||||
building the specified structure - returns TRUE if finds one*/
|
||||
extern BOOL checkDroidsBuilding(STRUCTURE *psStructure);
|
||||
|
||||
/* Looks through the players list of droids to see if any of them are
|
||||
/* Looks through the players list of droids to see if any of them are
|
||||
demolishing the specified structure - returns TRUE if finds one*/
|
||||
extern BOOL checkDroidsDemolishing(STRUCTURE *psStructure);
|
||||
|
||||
|
@ -294,13 +294,13 @@ a module if it can - returns TRUE if order is set */
|
|||
extern BOOL buildModule(DROID *psDroid, STRUCTURE *psStruct,BOOL bCheckPower);
|
||||
|
||||
/*Deals with building a module - checking if any droid is currently doing this
|
||||
- if so, helping to build the current one*/
|
||||
- if so, helping to build the current one*/
|
||||
extern void setUpBuildModule(DROID *psDroid);
|
||||
|
||||
/*return the name to display for the interface given a DROID structure*/
|
||||
extern char* getDroidName(DROID *psDroid);
|
||||
|
||||
/*return the name to display for the interface - we don't know if this is
|
||||
/*return the name to display for the interface - we don't know if this is
|
||||
a string ID or something the user types in*/
|
||||
extern char* getTemplateName(DROID_TEMPLATE *psTemplate);
|
||||
|
||||
|
@ -328,11 +328,11 @@ extern UBYTE checkCommandExist(UBYTE player);
|
|||
|
||||
/* Set up a droid to clear a wrecked building feature - returns true if successful */
|
||||
extern BOOL droidStartClearing( DROID *psDroid );
|
||||
/* Update a construction droid while it is clearing
|
||||
/* Update a construction droid while it is clearing
|
||||
returns TRUE while continues */
|
||||
extern BOOL droidUpdateClearing( DROID *psDroid );
|
||||
|
||||
/*For a given repair droid, check if there are any damaged droids within
|
||||
/*For a given repair droid, check if there are any damaged droids within
|
||||
a defined range*/
|
||||
extern BASE_OBJECT * checkForRepairRange(DROID *psDroid,DROID *psTarget);
|
||||
|
||||
|
@ -340,7 +340,7 @@ extern BASE_OBJECT * checkForRepairRange(DROID *psDroid,DROID *psTarget);
|
|||
extern BOOL vtolDroid(DROID *psDroid);
|
||||
/*returns TRUE if a VTOL Weapon Droid which has completed all runs*/
|
||||
extern BOOL vtolEmpty(DROID *psDroid);
|
||||
/*Checks a vtol for being fully armed and fully repaired to see if ready to
|
||||
/*Checks a vtol for being fully armed and fully repaired to see if ready to
|
||||
leave reArm pad */
|
||||
extern BOOL vtolHappy(DROID *psDroid);
|
||||
/*this mends the VTOL when it has been returned to home base whilst on an
|
||||
|
@ -365,7 +365,7 @@ extern BOOL droidAttacking(DROID *psDroid);
|
|||
// but still rearming
|
||||
extern BOOL allVtolsRearmed(DROID *psDroid);
|
||||
|
||||
/*compares the droid sensor type with the droid weapon type to see if the
|
||||
/*compares the droid sensor type with the droid weapon type to see if the
|
||||
FIRE_SUPPORT order can be assigned*/
|
||||
extern BOOL droidSensorDroidWeapon(BASE_OBJECT *psObj, DROID *psDroid);
|
||||
|
||||
|
@ -377,8 +377,8 @@ extern DROID * giftSingleDroid(DROID *psD, UDWORD to);
|
|||
/*calculates the electronic resistance of a droid based on its experience level*/
|
||||
extern SWORD droidResistance(DROID *psDroid);
|
||||
|
||||
/*this is called to check the weapon is 'allowed'. Check if VTOL, the weapon is
|
||||
direct fire. Also check numVTOLattackRuns for the weapon is not zero - return
|
||||
/*this is called to check the weapon is 'allowed'. Check if VTOL, the weapon is
|
||||
direct fire. Also check numVTOLattackRuns for the weapon is not zero - return
|
||||
TRUE if valid weapon*/
|
||||
extern BOOL checkValidWeaponForProp(DROID_TEMPLATE *psTemplate);
|
||||
|
||||
|
|
207
src/effects.c
207
src/effects.c
|
@ -140,10 +140,8 @@ UDWORD getFreeEffect ( void );
|
|||
void initEffectsSystem ( void );
|
||||
void drawEffects ( void );
|
||||
void processEffects ( void );
|
||||
void addEffect ( iVector *pos, EFFECT_GROUP group,
|
||||
EFFECT_TYPE type, BOOL specified, iIMDShape *imd, BOOL lit );
|
||||
void addMultiEffect(iVector *basePos, iVector *scatter,EFFECT_GROUP group,
|
||||
EFFECT_TYPE type,BOOL specified, iIMDShape *imd, UDWORD number, BOOL lit, UDWORD size);
|
||||
void addEffect ( Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type, BOOL specified, iIMDShape *imd, BOOL lit );
|
||||
void addMultiEffect(Vector3i *basePos, Vector3i *scatter, EFFECT_GROUP group, EFFECT_TYPE type, BOOL specified, iIMDShape *imd, UDWORD number, BOOL lit, UDWORD size);
|
||||
UDWORD getNumEffects ( void );
|
||||
void renderEffect ( EFFECT *psEffect ); // MASTER Fn
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
@ -287,11 +285,11 @@ void effectSetSize(UDWORD size)
|
|||
specifiedSize = size;
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------
|
||||
void addMultiEffect(iVector *basePos, iVector *scatter,EFFECT_GROUP group,
|
||||
EFFECT_TYPE type,BOOL specified, iIMDShape *imd, UDWORD number,BOOL lit,UDWORD size)
|
||||
void addMultiEffect(Vector3i *basePos, Vector3i *scatter, EFFECT_GROUP group,
|
||||
EFFECT_TYPE type,BOOL specified, iIMDShape *imd, UDWORD number, BOOL lit, UDWORD size)
|
||||
{
|
||||
UDWORD i;
|
||||
iVector scatPos;
|
||||
Vector3i scatPos;
|
||||
|
||||
|
||||
if(number==0)
|
||||
|
@ -351,21 +349,19 @@ UDWORD getNumEvenEffects(void)
|
|||
|
||||
UDWORD Reject1;
|
||||
|
||||
void addEffect(iVector *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specified, iIMDShape *imd, BOOL lit)
|
||||
void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specified, iIMDShape *imd, BOOL lit)
|
||||
{
|
||||
UDWORD essentialCount;
|
||||
UDWORD i;
|
||||
BOOL bSmoke;
|
||||
UDWORD essentialCount;
|
||||
UDWORD i;
|
||||
BOOL bSmoke;
|
||||
|
||||
aeCalls++;
|
||||
|
||||
|
||||
if(gamePaused())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Quick optimsation to reject every second non-essential effect if it's off grid */
|
||||
// if(clipXY((UDWORD)MAKEINT(pos->x),(UDWORD)MAKEINT(pos->z)) == FALSE)
|
||||
if(clipXY((UDWORD)pos->x,(UDWORD)pos->z) == FALSE)
|
||||
|
@ -715,13 +711,11 @@ void updateWaypoint(EFFECT *psEffect)
|
|||
// ----------------------------------------------------------------------------------------
|
||||
void updateFirework(EFFECT *psEffect)
|
||||
{
|
||||
|
||||
UDWORD height;
|
||||
UDWORD xDif,yDif,radius,val;
|
||||
iVector dv;
|
||||
SDWORD dif;
|
||||
UDWORD drop;
|
||||
|
||||
UDWORD height;
|
||||
UDWORD xDif,yDif,radius,val;
|
||||
Vector3i dv;
|
||||
SDWORD dif;
|
||||
UDWORD drop;
|
||||
|
||||
/* Move it */
|
||||
psEffect->position.x += (psEffect->velocity.x * fraction);
|
||||
|
@ -845,15 +839,15 @@ UDWORD drop;
|
|||
// ----------------------------------------------------------------------------------------
|
||||
void updateSatLaser(EFFECT *psEffect)
|
||||
{
|
||||
iVector dv;
|
||||
UDWORD val;
|
||||
UDWORD radius;
|
||||
UDWORD xDif,yDif;
|
||||
UDWORD i;
|
||||
UDWORD startHeight,endHeight;
|
||||
iIMDShape *pie;
|
||||
UDWORD xPos,yPos;
|
||||
LIGHT light;
|
||||
Vector3i dv;
|
||||
UDWORD val;
|
||||
UDWORD radius;
|
||||
UDWORD xDif,yDif;
|
||||
UDWORD i;
|
||||
UDWORD startHeight,endHeight;
|
||||
iIMDShape *pie;
|
||||
UDWORD xPos,yPos;
|
||||
LIGHT light;
|
||||
|
||||
// Do these here cause there used by the lighting code below this if.
|
||||
xPos = MAKEINT(psEffect->position.x);
|
||||
|
@ -1142,12 +1136,12 @@ void updatePolySmoke(EFFECT *psEffect)
|
|||
*/
|
||||
void updateGraviton(EFFECT *psEffect)
|
||||
{
|
||||
FRACT accel;
|
||||
iVector dv;
|
||||
UDWORD groundHeight;
|
||||
MAPTILE *psTile;
|
||||
FRACT accel;
|
||||
Vector3i dv;
|
||||
UDWORD groundHeight;
|
||||
MAPTILE *psTile;
|
||||
LIGHT light;
|
||||
|
||||
LIGHT light;
|
||||
#ifdef DOLIGHTS
|
||||
if(psEffect->type!=GRAVITON_TYPE_GIBLET)
|
||||
{
|
||||
|
@ -1293,15 +1287,15 @@ This isn't really an on-screen effect itself - it just spawns other ones....
|
|||
*/
|
||||
void updateDestruction(EFFECT *psEffect)
|
||||
{
|
||||
iVector pos;
|
||||
UDWORD effectType;
|
||||
UDWORD widthScatter = 0, breadthScatter = 0, heightScatter = 0;
|
||||
SDWORD iX, iY;
|
||||
LIGHT light;
|
||||
UDWORD percent;
|
||||
UDWORD range;
|
||||
FRACT div;
|
||||
UDWORD height;
|
||||
Vector3i pos;
|
||||
UDWORD effectType;
|
||||
UDWORD widthScatter = 0, breadthScatter = 0, heightScatter = 0;
|
||||
SDWORD iX, iY;
|
||||
LIGHT light;
|
||||
UDWORD percent;
|
||||
UDWORD range;
|
||||
FRACT div;
|
||||
UDWORD height;
|
||||
|
||||
percent = PERCENT(gameTime-psEffect->birthTime,psEffect->lifeSpan);
|
||||
if(percent > 100)
|
||||
|
@ -1526,9 +1520,9 @@ void updateConstruction(EFFECT *psEffect)
|
|||
/* Update fire sequences */
|
||||
void updateFire(EFFECT *psEffect)
|
||||
{
|
||||
iVector pos;
|
||||
LIGHT light;
|
||||
UDWORD percent;
|
||||
Vector3i pos;
|
||||
LIGHT light;
|
||||
UDWORD percent;
|
||||
|
||||
percent = PERCENT(gameTime-psEffect->birthTime,psEffect->lifeSpan);
|
||||
if(percent > 100)
|
||||
|
@ -1663,11 +1657,10 @@ void renderEffect(EFFECT *psEffect)
|
|||
/* drawing func for wapypoints . AJL. */
|
||||
void renderWaypointEffect(EFFECT *psEffect)
|
||||
{
|
||||
|
||||
iVector dv;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
Vector3i dv;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
|
||||
dv.x = ((UDWORD)MAKEINT(psEffect->position.x) - player.p.x) - terrainMidX * TILE_UNITS;
|
||||
dv.y = (UDWORD)MAKEINT(psEffect->position.y);
|
||||
|
@ -1692,11 +1685,10 @@ UDWORD brightness, specular;
|
|||
// ----------------------------------------------------------------------------------------
|
||||
void renderFirework(EFFECT *psEffect)
|
||||
{
|
||||
|
||||
iVector dv;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
Vector3i dv;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
|
||||
/* these don't get rendered */
|
||||
if(psEffect->type == FIREWORK_TYPE_LAUNCHER)
|
||||
|
@ -1731,11 +1723,10 @@ UDWORD brightness, specular;
|
|||
/* drawing func for blood. */
|
||||
void renderBloodEffect(EFFECT *psEffect)
|
||||
{
|
||||
|
||||
iVector dv;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
Vector3i dv;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
|
||||
dv.x = ((UDWORD)MAKEINT(psEffect->position.x) - player.p.x) - terrainMidX * TILE_UNITS;
|
||||
dv.y = (UDWORD)MAKEINT(psEffect->position.y);
|
||||
|
@ -1764,13 +1755,12 @@ UDWORD brightness, specular;
|
|||
// ----------------------------------------------------------------------------------------
|
||||
void renderDestructionEffect(EFFECT *psEffect)
|
||||
{
|
||||
|
||||
iVector dv;
|
||||
SDWORD rx,rz;
|
||||
FRACT div;
|
||||
SDWORD percent;
|
||||
//SDWORD centreX,centreZ;
|
||||
UDWORD brightness,specular;
|
||||
Vector3i dv;
|
||||
SDWORD rx,rz;
|
||||
FRACT div;
|
||||
SDWORD percent;
|
||||
//SDWORD centreX,centreZ;
|
||||
UDWORD brightness,specular;
|
||||
|
||||
if(psEffect->type!=DESTRUCTION_TYPE_SKYSCRAPER)
|
||||
{
|
||||
|
@ -1844,8 +1834,7 @@ UDWORD timeSlice;
|
|||
/* Renders the standard explosion effect */
|
||||
void renderExplosionEffect(EFFECT *psEffect)
|
||||
{
|
||||
|
||||
iVector dv;
|
||||
Vector3i dv;
|
||||
SDWORD rx,rz;
|
||||
SDWORD percent;
|
||||
UDWORD brightness, specular;
|
||||
|
@ -1918,13 +1907,13 @@ void renderExplosionEffect(EFFECT *psEffect)
|
|||
// ----------------------------------------------------------------------------------------
|
||||
void renderGravitonEffect(EFFECT *psEffect)
|
||||
{
|
||||
Vector3i vec;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX,centreZ;
|
||||
|
||||
iVector vec;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX,centreZ;
|
||||
// centreX = ( player.p.x + ((visibleXTiles/2)<<TILE_SHIFT) );
|
||||
// centreZ = ( player.p.z + ((visibleYTiles/2)<<TILE_SHIFT) );
|
||||
// centreX = ( player.p.x + ((visibleXTiles/2)<<TILE_SHIFT) );
|
||||
// centreZ = ( player.p.z + ((visibleYTiles/2)<<TILE_SHIFT) );
|
||||
|
||||
/* Establish world position */
|
||||
vec.x = ((UDWORD)MAKEINT(psEffect->position.x) - player.p.x) - terrainMidX * TILE_UNITS;
|
||||
|
@ -1974,14 +1963,13 @@ renderConstructionEffect:-
|
|||
Renders the standard construction effect */
|
||||
void renderConstructionEffect(EFFECT *psEffect)
|
||||
{
|
||||
|
||||
iVector vec,null;
|
||||
SDWORD rx,rz;
|
||||
SDWORD percent;
|
||||
UDWORD translucency;
|
||||
UDWORD size;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
Vector3i vec, null;
|
||||
SDWORD rx,rz;
|
||||
SDWORD percent;
|
||||
UDWORD translucency;
|
||||
UDWORD size;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
|
||||
/* No rotation about arbitrary axis */
|
||||
null.x = null.y = null.z = 0;
|
||||
|
@ -2051,13 +2039,12 @@ Renders the standard smoke effect - it is now scaled in real-time as well
|
|||
*/
|
||||
void renderSmokeEffect(EFFECT *psEffect)
|
||||
{
|
||||
|
||||
UDWORD percent;
|
||||
UDWORD transparency = 0;
|
||||
iVector vec;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
UDWORD percent;
|
||||
UDWORD transparency = 0;
|
||||
Vector3i vec;
|
||||
SDWORD rx,rz;
|
||||
UDWORD brightness, specular;
|
||||
//SDWORD centreX, centreZ;
|
||||
|
||||
/* Establish world position */
|
||||
vec.x = ((UDWORD)MAKEINT(psEffect->position.x) - player.p.x) - terrainMidX * TILE_UNITS;
|
||||
|
@ -2585,12 +2572,12 @@ void effectSetupDestruction(EFFECT *psEffect)
|
|||
// ----------------------------------------------------------------------------------------
|
||||
void initPerimeterSmoke(iIMDShape *pImd, UDWORD x, UDWORD y, UDWORD z)
|
||||
{
|
||||
SDWORD i;
|
||||
SDWORD inStart,inEnd;
|
||||
SDWORD varStart,varEnd,varStride;
|
||||
SDWORD shift = 0;
|
||||
iVector base;
|
||||
iVector pos;
|
||||
SDWORD i;
|
||||
SDWORD inStart, inEnd;
|
||||
SDWORD varStart, varEnd, varStride;
|
||||
SDWORD shift = 0;
|
||||
Vector3i base;
|
||||
Vector3i pos;
|
||||
|
||||
base.x = x;
|
||||
base.y = y;
|
||||
|
@ -2715,11 +2702,11 @@ void effectGiveAuxVarSec( UDWORD var)
|
|||
/* Runs all the spot effect stuff for the droids - adding of dust and the like... */
|
||||
void effectDroidUpdates( void )
|
||||
{
|
||||
UDWORD i;
|
||||
DROID *psDroid;
|
||||
UDWORD partition;
|
||||
iVector pos;
|
||||
SDWORD xBehind,yBehind;
|
||||
UDWORD i;
|
||||
DROID *psDroid;
|
||||
UDWORD partition;
|
||||
Vector3i pos;
|
||||
SDWORD xBehind,yBehind;
|
||||
|
||||
/* Go through all players */
|
||||
for(i=0; i<MAX_PLAYERS; i++)
|
||||
|
@ -2761,15 +2748,13 @@ SDWORD xBehind,yBehind;
|
|||
/* Runs all the structure effect stuff - steam puffing out etc */
|
||||
void effectStructureUpdates( void )
|
||||
{
|
||||
UDWORD i;
|
||||
UDWORD partition;
|
||||
STRUCTURE *psStructure;
|
||||
iVector eventPos;
|
||||
UDWORD capacity;
|
||||
POWER_GEN *psPowerGen;
|
||||
|
||||
BOOL active;
|
||||
|
||||
UDWORD i;
|
||||
UDWORD partition;
|
||||
STRUCTURE *psStructure;
|
||||
Vector3i eventPos;
|
||||
UDWORD capacity;
|
||||
POWER_GEN *psPowerGen;
|
||||
BOOL active;
|
||||
|
||||
/* Go thru' all players */
|
||||
for(i=0; i<MAX_PLAYERS; i++)
|
||||
|
|
|
@ -203,10 +203,10 @@ UBYTE frameNumber; // what frame number is the imd on?
|
|||
UWORD size; // Size in terms of percent of original imd.
|
||||
UBYTE baseScale; // if scaled, what's bottom line?
|
||||
UBYTE specific; // how many times has it bounced?
|
||||
PIEVECTORF position; // world coordinates of the effect - floats on the PC.
|
||||
PIEVECTORF velocity; // movement values per update
|
||||
iVector rotation; // current rotation - only for gravitons
|
||||
iVector spin; // rotation info for spinning things.
|
||||
Vector3f position; // world coordinates of the effect - floats on the PC.
|
||||
Vector3f velocity; // movement values per update
|
||||
Vector3i rotation; // current rotation - only for gravitons
|
||||
Vector3i spin; // rotation info for spinning things.
|
||||
UDWORD birthTime; // what time was it introduced into the world?
|
||||
UDWORD lastFrame; // when did we last update the frame?
|
||||
UWORD frameDelay; // how many game ticks between each frame?
|
||||
|
@ -225,9 +225,9 @@ extern void effectGiveAuxVarSec ( UDWORD var); // and so's this
|
|||
|
||||
extern void initEffectsSystem ( void );
|
||||
extern void processEffects ( void );
|
||||
extern void addEffect ( iVector *pos, EFFECT_GROUP group,
|
||||
extern void addEffect ( Vector3i *pos, EFFECT_GROUP group,
|
||||
EFFECT_TYPE type, BOOL specified, struct iIMDShape *imd, BOOL lit );
|
||||
extern void addMultiEffect ( iVector *basePos, iVector *scatter,EFFECT_GROUP group,
|
||||
extern void addMultiEffect ( Vector3i *basePos, Vector3i *scatter,EFFECT_GROUP group,
|
||||
EFFECT_TYPE type,BOOL specified, struct iIMDShape *imd, UDWORD number, BOOL lit, UDWORD size );
|
||||
|
||||
extern void drawEffects ( void );
|
||||
|
|
|
@ -964,7 +964,7 @@ void removeFeature(FEATURE *psDel)
|
|||
UDWORD mapX, mapY, width,breadth, player;
|
||||
MAPTILE *psTile;
|
||||
MESSAGE *psMessage;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
|
||||
// iVector dv;
|
||||
// UWORD uwFlameCycles, uwFlameAnims, i;
|
||||
|
@ -1064,7 +1064,7 @@ void destroyFeature(FEATURE *psDel)
|
|||
{
|
||||
UDWORD widthScatter,breadthScatter,heightScatter, i;
|
||||
EFFECT_TYPE explosionSize;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
UDWORD width,breadth;
|
||||
UDWORD mapX,mapY;
|
||||
MAPTILE *psTile;
|
||||
|
|
26
src/game.c
26
src/game.c
|
@ -1155,7 +1155,7 @@ typedef struct _save_flag_v18
|
|||
UDWORD screenR;
|
||||
UDWORD player; /*which player the Position belongs to*/
|
||||
BOOL selected; /*flag to indicate whether the Position */
|
||||
iVector coords; //the world coords of the Position
|
||||
Vector3i coords; //the world coords of the Position
|
||||
UBYTE factoryInc; //indicates whether the first, second etc factory
|
||||
UBYTE factoryType; //indicates whether standard, cyborg or vtol factory
|
||||
UBYTE dummyNOTUSED; //sub value. needed to order production points.
|
||||
|
@ -1171,7 +1171,7 @@ typedef struct _save_flag
|
|||
UDWORD screenR;
|
||||
UDWORD player; /*which player the Position belongs to*/
|
||||
BOOL selected; /*flag to indicate whether the Position */
|
||||
iVector coords; //the world coords of the Position
|
||||
Vector3i coords; //the world coords of the Position
|
||||
UBYTE factoryInc; //indicates whether the first, second etc factory
|
||||
UBYTE factoryType; //indicates whether standard, cyborg or vtol factory
|
||||
UBYTE dummyNOTUSED; //sub value. needed to order production points.
|
||||
|
@ -4973,7 +4973,7 @@ static DROID* buildDroidFromSaveDroidV19(SAVE_DROID_V18* psSaveDroid, UDWORD ver
|
|||
else
|
||||
{
|
||||
id = getStructStatFromName(psSaveDroidV14->tarStatName);
|
||||
if (id != -1)
|
||||
if (id != (UDWORD)-1)
|
||||
{
|
||||
psDroid->psTarStats[0] = (BASE_STATS*)&asStructureStats[id];
|
||||
}
|
||||
|
@ -5009,7 +5009,7 @@ static DROID* buildDroidFromSaveDroidV19(SAVE_DROID_V18* psSaveDroid, UDWORD ver
|
|||
else
|
||||
{
|
||||
id = getStructStatFromName(psSaveDroid->tarStatName);
|
||||
if (id != -1)
|
||||
if (id != (UDWORD)-1)
|
||||
{
|
||||
psDroid->psTarStats[0] = (BASE_STATS*)&asStructureStats[id];
|
||||
}
|
||||
|
@ -5236,7 +5236,7 @@ static DROID* buildDroidFromSaveDroid(SAVE_DROID* psSaveDroid, UDWORD version)
|
|||
else
|
||||
{
|
||||
id = getStructStatFromName(psSaveDroid->tarStatName);
|
||||
if (id != -1)
|
||||
if (id != (UDWORD)-1)
|
||||
{
|
||||
psDroid->psTarStats[0] = (BASE_STATS*)&asStructureStats[id];
|
||||
}
|
||||
|
@ -6595,14 +6595,14 @@ BOOL loadSaveStructureV7(char *pFileData, UDWORD filesize, UDWORD numStructures)
|
|||
|
||||
//check not trying to build too near the edge
|
||||
if(((psSaveStructure->x >> TILE_SHIFT) < TOO_NEAR_EDGE) || ((
|
||||
psSaveStructure->x >> TILE_SHIFT) > (SDWORD)(mapWidth - TOO_NEAR_EDGE)))
|
||||
psSaveStructure->x >> TILE_SHIFT) > (mapWidth - TOO_NEAR_EDGE)))
|
||||
{
|
||||
debug( LOG_ERROR, "Structure %s, x coord too near the edge of the map. id - %d", getSaveStructNameV19((SAVE_STRUCTURE_V17*)psSaveStructure), psSaveStructure->id );
|
||||
abort();
|
||||
continue;
|
||||
}
|
||||
if(((psSaveStructure->y >> TILE_SHIFT) < TOO_NEAR_EDGE) || ((
|
||||
psSaveStructure->y >> TILE_SHIFT) > (SDWORD)(mapHeight - TOO_NEAR_EDGE)))
|
||||
psSaveStructure->y >> TILE_SHIFT) > (mapHeight - TOO_NEAR_EDGE)))
|
||||
{
|
||||
debug( LOG_ERROR, "Structure %s, y coord too near the edge of the map. id - %d", getSaveStructNameV19((SAVE_STRUCTURE_V17*)psSaveStructure), psSaveStructure->id );
|
||||
abort();
|
||||
|
@ -6682,7 +6682,7 @@ BOOL loadSaveStructureV7(char *pFileData, UDWORD filesize, UDWORD numStructures)
|
|||
((RESEARCH_FACILITY *)psStructure->pFunctionality)->researchPoints =
|
||||
psSaveStructure->output;
|
||||
((RESEARCH_FACILITY *)psStructure->pFunctionality)->timeStarted = (psSaveStructure->timeStarted);
|
||||
if (psSaveStructure->subjectInc != -1)
|
||||
if (psSaveStructure->subjectInc != (UDWORD)-1)
|
||||
{
|
||||
((RESEARCH_FACILITY *)psStructure->pFunctionality)->psSubject = (BASE_STATS *)
|
||||
(asResearch + psSaveStructure->subjectInc);
|
||||
|
@ -6882,14 +6882,14 @@ BOOL loadSaveStructureV19(char *pFileData, UDWORD filesize, UDWORD numStructures
|
|||
}*/
|
||||
//check not trying to build too near the edge
|
||||
if(((psSaveStructure->x >> TILE_SHIFT) < TOO_NEAR_EDGE) || ((
|
||||
psSaveStructure->x >> TILE_SHIFT) > (SDWORD)(mapWidth - TOO_NEAR_EDGE)))
|
||||
psSaveStructure->x >> TILE_SHIFT) > (mapWidth - TOO_NEAR_EDGE)))
|
||||
{
|
||||
debug( LOG_ERROR, "Structure %s, x coord too near the edge of the map. id - %d", getSaveStructNameV19((SAVE_STRUCTURE_V17*)psSaveStructure), psSaveStructure->id );
|
||||
abort();
|
||||
continue;
|
||||
}
|
||||
if(((psSaveStructure->y >> TILE_SHIFT) < TOO_NEAR_EDGE) || ((
|
||||
psSaveStructure->y >> TILE_SHIFT) > (SDWORD)(mapHeight - TOO_NEAR_EDGE)))
|
||||
psSaveStructure->y >> TILE_SHIFT) > (mapHeight - TOO_NEAR_EDGE)))
|
||||
{
|
||||
debug( LOG_ERROR, "Structure %s, y coord too near the edge of the map. id - %d", getSaveStructNameV19((SAVE_STRUCTURE_V17*)psSaveStructure), psSaveStructure->id );
|
||||
abort();
|
||||
|
@ -7330,14 +7330,14 @@ BOOL loadSaveStructureV(char *pFileData, UDWORD filesize, UDWORD numStructures,
|
|||
}*/
|
||||
//check not trying to build too near the edge
|
||||
if(((psSaveStructure->x >> TILE_SHIFT) < TOO_NEAR_EDGE) || ((
|
||||
psSaveStructure->x >> TILE_SHIFT) > (SDWORD)(mapWidth - TOO_NEAR_EDGE)))
|
||||
psSaveStructure->x >> TILE_SHIFT) > (mapWidth - TOO_NEAR_EDGE)))
|
||||
{
|
||||
debug( LOG_ERROR, "Structure %s, x coord too near the edge of the map. id - %d", getSaveStructNameV((SAVE_STRUCTURE*)psSaveStructure), psSaveStructure->id );
|
||||
abort();
|
||||
continue;
|
||||
}
|
||||
if(((psSaveStructure->y >> TILE_SHIFT) < TOO_NEAR_EDGE) || ((
|
||||
psSaveStructure->y >> TILE_SHIFT) > (SDWORD)(mapHeight - TOO_NEAR_EDGE)))
|
||||
psSaveStructure->y >> TILE_SHIFT) > (mapHeight - TOO_NEAR_EDGE)))
|
||||
{
|
||||
debug( LOG_ERROR, "Structure %s, y coord too near the edge of the map. id - %d", getSaveStructNameV((SAVE_STRUCTURE*)psSaveStructure), psSaveStructure->id );
|
||||
abort();
|
||||
|
@ -11809,7 +11809,7 @@ static BOOL getNameFromComp(UDWORD compType, char *pDest, UDWORD compIndex)
|
|||
|
||||
|
||||
// draws the structures onto a completed map preview sprite.
|
||||
BOOL plotStructurePreview(iSprite *backDropSprite,UBYTE scale,UDWORD offX,UDWORD offY)
|
||||
BOOL plotStructurePreview(iTexture *backDropSprite, UBYTE scale, UDWORD offX, UDWORD offY)
|
||||
{
|
||||
SAVE_STRUCTURE sSave; // close eyes now.
|
||||
SAVE_STRUCTURE *psSaveStructure = &sSave; // assumes save_struct is larger than all previous ones...
|
||||
|
|
|
@ -44,7 +44,7 @@ void processImpact(UDWORD worldX, UDWORD worldY, UBYTE severity,UDWORD tilesAcro
|
|||
//BASE_OBJECT *getTileOccupier(UDWORD x, UDWORD y);
|
||||
//STRUCTURE *getTileStructure(UDWORD x, UDWORD y);
|
||||
//FEATURE *getTileFeature(UDWORD x, UDWORD y);
|
||||
void baseObjScreenCoords ( BASE_OBJECT *baseObj, iPoint *pt );
|
||||
void baseObjScreenCoords ( BASE_OBJECT *baseObj, Vector2i *pt );
|
||||
SDWORD calcDirection ( UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1 );
|
||||
UDWORD adjustDirection ( SDWORD present, SDWORD difference );
|
||||
|
||||
|
@ -222,13 +222,14 @@ SDWORD directionDiff(SDWORD a, SDWORD b)
|
|||
|
||||
|
||||
|
||||
void WorldPointToScreen( iPoint *worldPt, iPoint *screenPt )
|
||||
void WorldPointToScreen( Vector2i *worldPt, Vector2i *screenPt )
|
||||
{
|
||||
iVector vec,null;
|
||||
//MAPTILE *psTile;
|
||||
UDWORD worldX,worldY;
|
||||
SDWORD xShift,zShift;
|
||||
int32 rx,rz;
|
||||
Vector3i vec, null;
|
||||
//MAPTILE *psTile;
|
||||
UDWORD worldX,worldY;
|
||||
SDWORD xShift,zShift;
|
||||
Sint32 rx,rz;
|
||||
|
||||
/* Get into game context */
|
||||
/* Get the x,z translation components */
|
||||
rx = player.p.x & (TILE_UNITS-1);
|
||||
|
@ -298,9 +299,9 @@ int32 rx,rz;
|
|||
implies a movement DOWN the screen, and NOT up. */
|
||||
|
||||
void
|
||||
baseObjScreenCoords(BASE_OBJECT *baseObj, iPoint *pt)
|
||||
baseObjScreenCoords(BASE_OBJECT *baseObj, Vector2i *pt)
|
||||
{
|
||||
iPoint worldPt;
|
||||
Vector2i worldPt;
|
||||
|
||||
worldPt.x = baseObj->x;
|
||||
worldPt.y = baseObj->y;
|
||||
|
|
|
@ -49,8 +49,8 @@ extern FEATURE *getTileFeature(UDWORD x, UDWORD y);
|
|||
//extern UDWORD screenShakeLength;
|
||||
//extern void attemptScreenShake(void);
|
||||
|
||||
extern void baseObjScreenCoords(BASE_OBJECT *baseObj, iPoint *pt);
|
||||
extern void WorldPointToScreen( iPoint *worldPt, iPoint *screenPt );
|
||||
extern void baseObjScreenCoords(BASE_OBJECT *baseObj, Vector2i *pt);
|
||||
extern void WorldPointToScreen( Vector2i *worldPt, Vector2i *screenPt );
|
||||
extern UDWORD adjustDirection ( SDWORD present, SDWORD difference );
|
||||
extern SDWORD calcDirection ( UDWORD x0, UDWORD y0, UDWORD x1, UDWORD y1 );
|
||||
extern void initBulletTable ( void );
|
||||
|
|
|
@ -7184,10 +7184,9 @@ DROID* intCheckForDroid(UDWORD droidType)
|
|||
DROID *psDroid, *psSel = NULL;
|
||||
|
||||
// clearSelection();
|
||||
for (psDroid = apsDroidLists[selectedPlayer]; psDroid != NULL; psDroid =
|
||||
psDroid->psNext)
|
||||
for (psDroid = apsDroidLists[selectedPlayer]; psDroid != NULL; psDroid = psDroid->psNext)
|
||||
{
|
||||
if (psDroid->selected && psDroid->droidType == (SDWORD)droidType)
|
||||
if (psDroid->selected && psDroid->droidType == droidType)
|
||||
{
|
||||
if (psSel != NULL)
|
||||
{
|
||||
|
@ -7220,7 +7219,7 @@ SDWORD intNumSelectedDroids(UDWORD droidType)
|
|||
num = 0;
|
||||
for(psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
|
||||
{
|
||||
if (psDroid->selected && psDroid->droidType == (SDWORD)droidType)
|
||||
if (psDroid->selected && psDroid->droidType == droidType)
|
||||
{
|
||||
num += 1;
|
||||
}
|
||||
|
|
|
@ -2559,11 +2559,10 @@ void ClearButton(BOOL Down,UDWORD Size, UDWORD buttonType)
|
|||
|
||||
// Create a button by rendering an IMD object into it.
|
||||
//
|
||||
void CreateIMDButton(IMAGEFILE *ImageFile,UWORD ImageID,void *Object,UDWORD Player,RENDERED_BUTTON *Buffer,BOOL Down,
|
||||
UDWORD IMDType,UDWORD buttonType)
|
||||
void CreateIMDButton(IMAGEFILE *ImageFile, UWORD ImageID, void *Object, UDWORD Player, RENDERED_BUTTON *Buffer, BOOL Down, UDWORD IMDType, UDWORD buttonType)
|
||||
{
|
||||
UDWORD Size;
|
||||
iVector Rotation,Position, NullVector;
|
||||
Vector3i Rotation, Position, NullVector;
|
||||
UDWORD ox,oy;
|
||||
BUTTON_SURFACE *ButSurf;
|
||||
UDWORD Radius;
|
||||
|
|
|
@ -2385,13 +2385,13 @@ void kf_ScriptTest( void )
|
|||
// --------------------------------------------------------------------------
|
||||
void kf_TriggerShockWave( void )
|
||||
{
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
|
||||
pos.x = mouseTileX*TILE_UNITS + TILE_UNITS/2;
|
||||
pos.z = mouseTileY*TILE_UNITS + TILE_UNITS/2;
|
||||
pos.y = map_Height(pos.x,pos.z) + SHOCK_WAVE_HEIGHT;
|
||||
pos.x = mouseTileX*TILE_UNITS + TILE_UNITS/2;
|
||||
pos.z = mouseTileY*TILE_UNITS + TILE_UNITS/2;
|
||||
pos.y = map_Height(pos.x,pos.z) + SHOCK_WAVE_HEIGHT;
|
||||
|
||||
addEffect(&pos,EFFECT_EXPLOSION,EXPLOSION_TYPE_SHOCKWAVE,FALSE,NULL,0);
|
||||
addEffect(&pos,EFFECT_EXPLOSION,EXPLOSION_TYPE_SHOCKWAVE,FALSE,NULL,0);
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
void kf_ToggleMouseInvert( void )
|
||||
|
|
|
@ -39,21 +39,21 @@
|
|||
#include "arrow.h"
|
||||
|
||||
/* The vector that holds the sun's lighting direction - planar */
|
||||
iVector theSun;
|
||||
Vector3i theSun;
|
||||
UDWORD fogStatus = 0;
|
||||
/* Module function Prototypes */
|
||||
|
||||
UDWORD lightDoFogAndIllumination(UBYTE brightness, SDWORD dx, SDWORD dz, UDWORD* pSpecular);
|
||||
void doBuildingLights( void );
|
||||
void processLight(LIGHT *psLight);
|
||||
UDWORD calcDistToTile(UDWORD tileX, UDWORD tileY, iVector *pos);
|
||||
UDWORD calcDistToTile(UDWORD tileX, UDWORD tileY, Vector3i *pos);
|
||||
void colourTile(SDWORD xIndex, SDWORD yIndex, LIGHT_COLOUR colour, UBYTE percent);
|
||||
//void initLighting( void );
|
||||
void calcTileIllum(UDWORD tileX, UDWORD tileY);
|
||||
void normalsOnTile(UDWORD tileX, UDWORD tileY, UDWORD quadrant);
|
||||
UDWORD numNormals; // How many normals have we got?
|
||||
iVector normals[8]; // Maximum 8 possible normals
|
||||
extern void draw3dLine(iVector *src, iVector *dest, UBYTE col);
|
||||
Vector3i normals[8]; // Maximum 8 possible normals
|
||||
extern void draw3dLine(Vector3i *src, Vector3i *dest, UBYTE col);
|
||||
|
||||
|
||||
|
||||
|
@ -176,10 +176,10 @@ void initLighting(UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2)
|
|||
|
||||
void calcTileIllum(UDWORD tileX, UDWORD tileY)
|
||||
{
|
||||
iVector finalVector;
|
||||
SDWORD dotProduct;
|
||||
UDWORD i;
|
||||
UDWORD val;
|
||||
Vector3i finalVector;
|
||||
SDWORD dotProduct;
|
||||
UDWORD i;
|
||||
UDWORD val;
|
||||
|
||||
numNormals = 0;
|
||||
/* Quadrants look like:-
|
||||
|
@ -240,9 +240,9 @@ UDWORD val;
|
|||
|
||||
void normalsOnTile(UDWORD tileX, UDWORD tileY, UDWORD quadrant)
|
||||
{
|
||||
iVector corner1,corner2,corner3;
|
||||
MAPTILE *psTile, *tileRight, *tileDownRight, *tileDown;
|
||||
SDWORD rMod,drMod,dMod,nMod;
|
||||
Vector3i corner1, corner2, corner3;
|
||||
MAPTILE *psTile, *tileRight, *tileDownRight, *tileDown;
|
||||
SDWORD rMod,drMod,dMod,nMod;
|
||||
|
||||
/* Get a pointer to our tile */
|
||||
psTile = mapTile(tileX,tileY);
|
||||
|
@ -599,12 +599,12 @@ UDWORD total;
|
|||
return((UDWORD)sqrt(total));
|
||||
}
|
||||
*/
|
||||
UDWORD calcDistToTile(UDWORD tileX, UDWORD tileY, iVector *pos)
|
||||
UDWORD calcDistToTile(UDWORD tileX, UDWORD tileY, Vector3i *pos)
|
||||
{
|
||||
UDWORD x1,y1,z1;
|
||||
UDWORD x2,y2,z2;
|
||||
UDWORD xDif,yDif,zDif;
|
||||
UDWORD total;
|
||||
UDWORD x1,y1,z1;
|
||||
UDWORD x2,y2,z2;
|
||||
UDWORD xDif,yDif,zDif;
|
||||
UDWORD total;
|
||||
|
||||
/* The coordinates of the tile corner */
|
||||
x1 = tileX * TILE_UNITS;
|
||||
|
@ -997,24 +997,21 @@ UDWORD i;
|
|||
DBCONPRINTF(ConsoleString,(ConsoleString,"Sun Z Vector : %d",theSun.z));
|
||||
}
|
||||
|
||||
void showSunOnTile(UDWORD x, UDWORD y)
|
||||
void showSunOnTile(UDWORD x, UDWORD y)
|
||||
{
|
||||
iVector a,b;
|
||||
Vector3i a, b;
|
||||
|
||||
a.x = (x<<TILE_SHIFT)+(TILE_UNITS/2);
|
||||
a.z = (y<<TILE_SHIFT)+(TILE_UNITS/2);
|
||||
a.y = map_Height(a.x,a.z);
|
||||
|
||||
{
|
||||
a.x = (x<<TILE_SHIFT)+(TILE_UNITS/2);
|
||||
a.z = (y<<TILE_SHIFT)+(TILE_UNITS/2);
|
||||
a.y = map_Height(a.x,a.z);
|
||||
b.x = a.x + theSun.x/64;
|
||||
b.y = a.y + theSun.y/64;
|
||||
b.z = a.z + theSun.z/64;
|
||||
|
||||
b.x = a.x + theSun.x/64;
|
||||
b.y = a.y + theSun.y/64;
|
||||
b.z = a.z + theSun.z/64;
|
||||
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON);
|
||||
pie_SetFogStatus(FALSE);
|
||||
draw3dLine(&a,&b,mapTile(x,y)->illumination);
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON);
|
||||
}
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON);
|
||||
pie_SetFogStatus(FALSE);
|
||||
draw3dLine(&a,&b,mapTile(x,y)->illumination);
|
||||
pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,7 @@ LIGHT_WHITE
|
|||
|
||||
typedef struct _light
|
||||
{
|
||||
iVector position;
|
||||
Vector3i position;
|
||||
UBYTE type;
|
||||
UDWORD range;
|
||||
LIGHT_COLOUR colour;
|
||||
|
@ -51,7 +51,7 @@ extern void initLighting(UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2);
|
|||
extern void lightValueForTile(UDWORD tileX, UDWORD tileY);
|
||||
extern void calcTileIllum(UDWORD tileX, UDWORD tileY);
|
||||
extern void doBuildingLights( void );
|
||||
extern iVector theSun;
|
||||
extern Vector3i theSun;
|
||||
extern UDWORD lightDoFogAndIllumination(UBYTE brightness, SDWORD dx, SDWORD dz, UDWORD* pSpecular);
|
||||
extern void calcDroidIllumination(DROID *psDroid);
|
||||
//darkens down the tiles that are outside the scroll limits
|
||||
|
|
21
src/map.c
21
src/map.c
|
@ -772,19 +772,18 @@ BOOL mapLoad(char *pFileData, UDWORD fileSize)
|
|||
BOOL mapSave(char **ppFileData, UDWORD *pFileSize)
|
||||
{
|
||||
UDWORD i;
|
||||
MAP_SAVEHEADER *psHeader;
|
||||
MAP_SAVETILE *psTileData;
|
||||
MAPTILE *psTile;
|
||||
GATEWAY *psCurrGate;
|
||||
GATEWAY_SAVEHEADER *psGateHeader;
|
||||
GATEWAY_SAVE *psGate;
|
||||
ZONEMAP_SAVEHEADER *psZoneHeader;
|
||||
UBYTE *psZone;
|
||||
UBYTE *psLastZone;
|
||||
SDWORD numGateways;
|
||||
MAP_SAVEHEADER *psHeader = NULL;
|
||||
MAP_SAVETILE *psTileData = NULL;
|
||||
MAPTILE *psTile = NULL;
|
||||
GATEWAY *psCurrGate = NULL;
|
||||
GATEWAY_SAVEHEADER *psGateHeader = NULL;
|
||||
GATEWAY_SAVE *psGate = NULL;
|
||||
ZONEMAP_SAVEHEADER *psZoneHeader = NULL;
|
||||
UBYTE *psZone = NULL;
|
||||
UBYTE *psLastZone = NULL;
|
||||
SDWORD numGateways = 0;
|
||||
|
||||
// find the number of non water gateways
|
||||
numGateways = 0;
|
||||
for(psCurrGate = gwGetGateways(); psCurrGate; psCurrGate = psCurrGate->psNext)
|
||||
{
|
||||
if (!(psCurrGate->flags & GWR_WATERLINK))
|
||||
|
|
|
@ -97,7 +97,7 @@ void tileLayouts(int texture);
|
|||
/* ----------------------------------------------------------------------------------------- */
|
||||
|
||||
SDWORD elevation;
|
||||
iVector mapPos, mapView;
|
||||
Vector3i mapPos, mapView;
|
||||
//static iVector oldPos, oldView;
|
||||
POINT sP1,sP2,sP3,sP4;
|
||||
POINT *psP1,*psP2,*psP3,*psP4,*psPTemp;
|
||||
|
@ -158,7 +158,7 @@ void renderResearchToBuffer(RESEARCH *psResearch,
|
|||
|
||||
BASE_STATS *psResGraphic;
|
||||
UDWORD compID, IMDType;
|
||||
iVector Rotation,Position;
|
||||
Vector3i Rotation,Position;
|
||||
UDWORD basePlateSize, Radius;
|
||||
SDWORD scale = 0;
|
||||
|
||||
|
|
|
@ -3906,7 +3906,7 @@ void setNoGoArea(UBYTE x1, UBYTE y1, UBYTE x2, UBYTE y2, UBYTE area)
|
|||
|
||||
void addLandingLights( UDWORD x, UDWORD y)
|
||||
{
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
|
||||
pos.x = x;
|
||||
pos.z = y;
|
||||
|
|
|
@ -4389,7 +4389,7 @@ void moveUpdateDroid(DROID *psDroid)
|
|||
UBYTE oldStatus = psDroid->sMove.Status;
|
||||
SDWORD moveSpeed, moveDir;
|
||||
PROPULSION_STATS *psPropStats;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
BOOL bStarted = FALSE, bStopped;
|
||||
// UDWORD landX,landY;
|
||||
|
||||
|
|
|
@ -673,7 +673,7 @@ void addLoserGifts(void)
|
|||
{
|
||||
// DROID *psD;
|
||||
// DROID_TEMPLATE *psTempl;
|
||||
// iVector position;
|
||||
// Vector3i position;
|
||||
static UDWORD lastgift=0;
|
||||
UDWORD i,x,y,quantity,count;
|
||||
UWORD nx,ny;
|
||||
|
@ -933,7 +933,7 @@ void processMultiPlayerArtifacts(void)
|
|||
static UDWORD lastCall;
|
||||
FEATURE *pF,*pFN;
|
||||
UDWORD x,y,pl;
|
||||
iVector position;
|
||||
Vector3i position;
|
||||
BOOL found=FALSE;
|
||||
|
||||
// only do this every now and again.
|
||||
|
|
|
@ -4144,7 +4144,7 @@ BOOL addMultiBut(W_SCREEN *screen,UDWORD formid,UDWORD id,UDWORD x, UDWORD y,
|
|||
|
||||
void displayForceDroid(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
|
||||
{
|
||||
iVector Rotation,Position;
|
||||
Vector3i Rotation,Position;
|
||||
UDWORD x = psWidget->x+xOffset;
|
||||
UDWORD y = psWidget->y+yOffset;
|
||||
UDWORD tlx,tly,brx,bry;
|
||||
|
|
|
@ -428,7 +428,7 @@ void displayStructureBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWOR
|
|||
UDWORD w = psWidget->width;
|
||||
UDWORD h = psWidget->height;
|
||||
STRUCTURE_STATS *stat = asStructureStats+(UDWORD)psWidget->pUserData;
|
||||
iVector Rotation,Position;
|
||||
Vector3i Rotation, Position;
|
||||
char str[3];
|
||||
|
||||
UDWORD scale,Radius;
|
||||
|
|
|
@ -800,7 +800,7 @@ void displayMultiPlayer(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD
|
|||
UDWORD x = xOffset+psWidget->x;
|
||||
UDWORD y = yOffset+psWidget->y;
|
||||
UDWORD player;//,pl2;
|
||||
iVector Rotation,Position;
|
||||
Vector3i Rotation, Position;
|
||||
|
||||
player = (int)psWidget->pUserData; //get the in game player number.
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ BOOL isHumanPlayer (UDWORD player); // determine if human
|
|||
BOOL myResponsibility (UDWORD player); // this pc has comms responsibility
|
||||
BOOL responsibleFor (UDWORD player,UDWORD player2); // has player responsibility for player2
|
||||
UDWORD whosResponsible (UDWORD player); // returns player responsible for 'player'
|
||||
iVector cameraToHome (UDWORD player,BOOL scroll);
|
||||
Vector3i cameraToHome (UDWORD player,BOOL scroll);
|
||||
BOOL DirectPlaySystemMessageHandler(void * msg); // interpret DP messages
|
||||
BOOL recvMessage (void); // process an incoming message
|
||||
BOOL SendResearch (UBYTE player,UDWORD index); // send/recv Research issues
|
||||
|
@ -193,8 +193,8 @@ BOOL turnOffMultiMsg(BOOL bDoit)
|
|||
// throw a pary when you win!
|
||||
BOOL multiplayerWinSequence(BOOL firstCall)
|
||||
{
|
||||
static iVector pos;
|
||||
iVector pos2;
|
||||
static Vector3i pos;
|
||||
Vector3i pos2;
|
||||
static UDWORD last=0;
|
||||
FRACT fraction;
|
||||
FRACT rotAmount;
|
||||
|
@ -608,9 +608,9 @@ BOOL responsibleFor(UDWORD player, UDWORD playerinquestion)
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// probably temporary. Places the camera on the players 1st droid or struct.
|
||||
iVector cameraToHome(UDWORD player,BOOL scroll)
|
||||
Vector3i cameraToHome(UDWORD player,BOOL scroll)
|
||||
{
|
||||
iVector res;
|
||||
Vector3i res;
|
||||
UDWORD x,y;
|
||||
STRUCTURE *psBuilding;
|
||||
|
||||
|
@ -1336,7 +1336,7 @@ BOOL recvTextMessage(NETMSG *pMsg)
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT(player != MAX_PLAYERS, "recvTextMessage: failed to find owner of dpid %d", dpid);
|
||||
ASSERT(player != MAX_PLAYERS, "recvTextMessage: failed to find owner of dpid %d", dpid);
|
||||
|
||||
//sprintf(msg, "%d", i);
|
||||
strcpy(msg,NetPlay.players[i].name);
|
||||
|
|
|
@ -240,7 +240,7 @@ extern BOOL isHumanPlayer (UDWORD player); //to tell if the player is a comp
|
|||
extern BOOL myResponsibility (UDWORD player);
|
||||
extern BOOL responsibleFor (UDWORD player, UDWORD playerinquestion);
|
||||
extern UDWORD whosResponsible (UDWORD player);
|
||||
extern iVector cameraToHome (UDWORD player,BOOL scroll);
|
||||
extern Vector3i cameraToHome (UDWORD player,BOOL scroll);
|
||||
extern SDWORD dpidToPlayer (SDWORD dpid);
|
||||
extern char playerName[MAX_PLAYERS][MAX_NAME_SIZE]; //Array to store all player names (humans and AIs)
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ void useTheForce(BOOL bAddTempl)//Luke
|
|||
{
|
||||
DROID *pDr;
|
||||
DROID_TEMPLATE *pTempl;
|
||||
iVector position;
|
||||
Vector3i position;
|
||||
UDWORD x1,y1,x,y;
|
||||
DROID_TEMPLATE *psTempl;
|
||||
|
||||
|
|
|
@ -75,16 +75,16 @@ void optimisePathForDroid(DROID *psDroid)
|
|||
#if 0
|
||||
// didn't bother to get this to compile when I changed the PATH_POINT structure
|
||||
// I'll sort it out later - John.
|
||||
UDWORD index,stepIndex;
|
||||
UDWORD angleA,angleB;
|
||||
SDWORD x1,y1,x2,y2;
|
||||
UDWORD bisectingAngle;
|
||||
SDWORD xAlt,yAlt;
|
||||
UDWORD tileX,tileY;
|
||||
iVector pos;
|
||||
SDWORD xDif,yDif;
|
||||
SDWORD xRec,yRec;
|
||||
PATH_POINT *moveList;
|
||||
UDWORD index,stepIndex;
|
||||
UDWORD angleA,angleB;
|
||||
SDWORD x1,y1,x2,y2;
|
||||
UDWORD bisectingAngle;
|
||||
SDWORD xAlt,yAlt;
|
||||
UDWORD tileX,tileY;
|
||||
Vector3i pos;
|
||||
SDWORD xDif,yDif;
|
||||
SDWORD xRec,yRec;
|
||||
PATH_POINT *moveList;
|
||||
|
||||
index = 0;
|
||||
/* Get a pointer to the movement list */
|
||||
|
|
|
@ -2835,7 +2835,7 @@ BOOL bOrderEffectDisplayed = FALSE;
|
|||
void orderDroidAdd(DROID *psDroid, DROID_ORDER_DATA *psOrder)
|
||||
{
|
||||
|
||||
iVector position;
|
||||
Vector3i position;
|
||||
|
||||
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
|
||||
"orderUnitAdd: invalid unit pointer" );
|
||||
|
|
|
@ -316,7 +316,7 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
|
|||
SDWORD tarHeight, srcHeight, iMinSq;
|
||||
SDWORD altChange, dx, dy, dz, iVelSq, iVel;
|
||||
FRACT_D fR, fA, fS, fT, fC;
|
||||
iVector muzzle;
|
||||
Vector3i muzzle;
|
||||
SDWORD iRadSq, iPitchLow, iPitchHigh, iTemp;
|
||||
UDWORD heightVariance;
|
||||
WEAPON_STATS *psWeapStats = &asWeaponStats[psWeap->nStat];
|
||||
|
@ -600,7 +600,7 @@ proj_InFlightDirectFunc( PROJ_OBJECT *psObj )
|
|||
//Watermelon: make zdiff always positive
|
||||
UDWORD zdiff;
|
||||
SDWORD rad;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
//Watermelon:int i
|
||||
UDWORD i;
|
||||
//Watermelon:2 temp BASE_OBJECT pointer
|
||||
|
@ -896,7 +896,7 @@ proj_InFlightIndirectFunc( PROJ_OBJECT *psObj )
|
|||
{
|
||||
WEAPON_STATS *psStats;
|
||||
SDWORD iTime, iRad, iDist, dx, dy, dz, iX, iY;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
FRACT fVVert;
|
||||
BOOL bOver = FALSE;
|
||||
//Watermelon:psTempObj,psNewTarget,i,xdiff,ydiff,zdiff
|
||||
|
@ -1152,7 +1152,7 @@ proj_ImpactFunc( PROJ_OBJECT *psObj )
|
|||
SDWORD tarX0,tarY0, tarX1,tarY1;
|
||||
SDWORD radSquared, xDiff,yDiff;
|
||||
BOOL bKilled;//,bMultiTemp;
|
||||
iVector position,scatter;
|
||||
Vector3i position,scatter;
|
||||
UDWORD damage; //optimisation - were all being calculated twice on PC
|
||||
//Watermelon: tarZ0,tarZ1,zDiff for AA AOE weapons;
|
||||
SDWORD tarZ0,tarZ1,zDiff;
|
||||
|
|
20
src/radar.c
20
src/radar.c
|
@ -976,15 +976,15 @@ static void DrawRadarObjects(UBYTE *screen,UDWORD Modulus,UWORD boxSizeH,UWORD b
|
|||
|
||||
// Rotate an array of 2d vectors about a given angle, also translates them after rotating.
|
||||
//
|
||||
static void RotateVector2D(iVector *Vector,iVector *TVector,iVector *Pos,int Angle,int Count)
|
||||
static void RotateVector2D(Vector3i *Vector, Vector3i *TVector, Vector3i *Pos, int Angle, int Count)
|
||||
{
|
||||
int Cos = COS(Angle);
|
||||
int Sin = SIN(Angle);
|
||||
int ox = 0;
|
||||
int oy = 0;
|
||||
int i;
|
||||
iVector *Vec = Vector;
|
||||
iVector *TVec = TVector;
|
||||
Vector3i *Vec = Vector;
|
||||
Vector3i *TVec = TVector;
|
||||
|
||||
if(Pos) {
|
||||
ox = Pos->x;
|
||||
|
@ -1040,14 +1040,14 @@ SDWORD dif;
|
|||
|
||||
|
||||
/* Draws a Myth/FF7 style viewing window */
|
||||
static void drawViewingWindow( UDWORD x, UDWORD y, UDWORD boxSizeH,UDWORD boxSizeV )
|
||||
static void drawViewingWindow( UDWORD x, UDWORD y, UDWORD boxSizeH, UDWORD boxSizeV )
|
||||
{
|
||||
iVector v[4],tv[4],centre;
|
||||
UDWORD shortX,longX,yDrop,yDropVar;
|
||||
SDWORD dif = getDistanceAdjust();
|
||||
SDWORD dif2 = getLengthAdjust();
|
||||
UDWORD colour = 0;
|
||||
UDWORD camNumber;
|
||||
Vector3i v[4], tv[4], centre;
|
||||
UDWORD shortX,longX,yDrop,yDropVar;
|
||||
SDWORD dif = getDistanceAdjust();
|
||||
SDWORD dif2 = getLengthAdjust();
|
||||
UDWORD colour = 0;
|
||||
UDWORD camNumber;
|
||||
|
||||
shortX = ((visibleXTiles/4)-(dif/6)) * boxSizeH;
|
||||
longX = ((visibleXTiles/2)-(dif/4)) * boxSizeH;
|
||||
|
|
|
@ -490,9 +490,10 @@ UDWORD getTileTallObj(UDWORD x, UDWORD y)
|
|||
//-----------------------------------------------------------------------------------
|
||||
static BOOL getTileHighestCallback(SDWORD x, SDWORD y, SDWORD dist)
|
||||
{
|
||||
SDWORD heightDif;
|
||||
UDWORD height;
|
||||
//iVector pos;
|
||||
SDWORD heightDif;
|
||||
UDWORD height;
|
||||
//Vector3i pos;
|
||||
|
||||
if(clipXY(x,y))
|
||||
{
|
||||
height = map_Height(x,y);
|
||||
|
@ -520,15 +521,15 @@ UDWORD height;
|
|||
/* Will return false when we've hit the edge of the grid */
|
||||
static BOOL getTileHeightCallback(SDWORD x, SDWORD y, SDWORD dist)
|
||||
{
|
||||
SDWORD height,heightDif;
|
||||
FRACT newPitch;
|
||||
BOOL HasTallStructure = FALSE;
|
||||
SDWORD height,heightDif;
|
||||
FRACT newPitch;
|
||||
BOOL HasTallStructure = FALSE;
|
||||
#ifdef TEST_RAY
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
#endif
|
||||
|
||||
/* Are we still on the grid? */
|
||||
if(clipXY(x,y))
|
||||
if(clipXY(x,y))
|
||||
{
|
||||
HasTallStructure = TILE_HAS_TALLSTRUCTURE(mapTile(x>>TILE_SHIFT,y>>TILE_SHIFT));
|
||||
|
||||
|
|
|
@ -8561,11 +8561,11 @@ BOOL scrChooseValidLoc(void)
|
|||
BOOL scrGetClosestEnemy(void)
|
||||
{
|
||||
SDWORD x,y,tx,ty, player, range,i;
|
||||
UDWORD dist,bestDist;
|
||||
UDWORD dist, bestDist;
|
||||
BOOL weaponOnly, bVTOLs, bFound = FALSE; //only military objects?
|
||||
BASE_OBJECT *psObj;
|
||||
STRUCTURE *psStruct;
|
||||
DROID *psDroid;
|
||||
BASE_OBJECT *psObj = NULL;
|
||||
STRUCTURE *psStruct = NULL;
|
||||
DROID *psDroid = NULL;
|
||||
|
||||
if (!stackPopParams(6, VAL_INT, &x, VAL_INT, &y,
|
||||
VAL_INT, &range, VAL_BOOL, &weaponOnly, VAL_BOOL, &bVTOLs, VAL_INT, &player))
|
||||
|
@ -8968,7 +8968,7 @@ BOOL scrGetClosestEnemyDroidByType(void)
|
|||
UDWORD dist,bestDist;
|
||||
BOOL bFound = FALSE; //only military objects?
|
||||
BOOL bVTOLs;
|
||||
DROID *psDroid,*foundDroid;
|
||||
DROID *psDroid = NULL, *foundDroid = NULL;
|
||||
|
||||
if (!stackPopParams(6, VAL_INT, &x, VAL_INT, &y,
|
||||
VAL_INT, &range, VAL_INT, &type, VAL_BOOL, &bVTOLs, VAL_INT, &player))
|
||||
|
@ -9056,7 +9056,7 @@ BOOL scrGetClosestEnemyStructByType(void)
|
|||
SDWORD x,y,tx,ty, player, range,i,type,dist;
|
||||
UDWORD bestDist;
|
||||
BOOL bFound = FALSE; //only military objects?
|
||||
STRUCTURE *psStruct,*foundStruct;
|
||||
STRUCTURE *psStruct = NULL, *foundStruct = NULL;
|
||||
|
||||
if (!stackPopParams(5, VAL_INT, &x, VAL_INT, &y,
|
||||
VAL_INT, &range, VAL_INT, &type, VAL_INT, &player))
|
||||
|
|
|
@ -351,7 +351,7 @@ BOOL seq_SetupVideoBuffers(void)
|
|||
{
|
||||
for(b = 0 ; b < 32 ; b++)
|
||||
{
|
||||
pVideoPalette[(SDWORD)c] = (char)pal_GetNearestColour((uint8)(r<<3),(uint8)(g<<3),(uint8)(b<<3));
|
||||
pVideoPalette[(SDWORD)c] = (char)pal_GetNearestColour((Uint8)(r<<3),(Uint8)(g<<3),(Uint8)(b<<3));
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3562,7 +3562,7 @@ static BOOL structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
|
|||
SDWORD apx,apy;
|
||||
FLAG_POSITION *psFlag;
|
||||
// UDWORD i;
|
||||
iVector iVecEffect;
|
||||
Vector3i iVecEffect;
|
||||
UBYTE factoryType;
|
||||
BOOL assignCommander;
|
||||
//STRUCTURE *psReArmPad;
|
||||
|
@ -3944,7 +3944,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure)
|
|||
REPAIR_FACILITY *psRepairFac = NULL;
|
||||
RESEARCH_FACILITY *psResFacility;
|
||||
REARM_PAD *psReArmPad;
|
||||
iVector iVecEffect;
|
||||
Vector3i iVecEffect;
|
||||
BOOL bFinishAction,bDroidPlaced;
|
||||
WEAPON_STATS *psWStats;
|
||||
BASE_OBJECT *psTarget;
|
||||
|
@ -5052,9 +5052,9 @@ static BOOL canSmoke(STRUCTURE *psStruct)
|
|||
/* The main update routine for all Structures */
|
||||
void structureUpdate(STRUCTURE *psBuilding)
|
||||
{
|
||||
UDWORD widthScatter,breadthScatter;
|
||||
UDWORD percentDamage, emissionInterval, iPointsToAdd, iPointsRequired;
|
||||
iVector dv;
|
||||
UDWORD widthScatter,breadthScatter;
|
||||
UDWORD percentDamage, emissionInterval, iPointsToAdd, iPointsRequired;
|
||||
Vector3i dv;
|
||||
|
||||
ASSERT( PTRVALID(psBuilding, sizeof(STRUCTURE)),
|
||||
"structureUpdate: Invalid Structure pointer" );
|
||||
|
@ -5181,7 +5181,7 @@ iVector dv;
|
|||
//add the blue flashing effect for multiPlayer
|
||||
if(bMultiPlayer && ONEINTEN)
|
||||
{
|
||||
iVector position, *point;
|
||||
Vector3i position, *point;
|
||||
SDWORD realY;
|
||||
UDWORD pointIndex;
|
||||
|
||||
|
@ -6520,7 +6520,7 @@ BOOL destroyStruct(STRUCTURE *psDel)
|
|||
UDWORD mapX, mapY, width,breadth;
|
||||
UDWORD i;
|
||||
UDWORD widthScatter,breadthScatter,heightScatter;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
BOOL resourceFound = FALSE;
|
||||
MAPTILE *psTile;
|
||||
BOOL bMinor;
|
||||
|
@ -7345,9 +7345,9 @@ BOOL getLasSatExists(UDWORD player)
|
|||
|
||||
|
||||
/* calculate muzzle tip location in 3d world */
|
||||
BOOL calcStructureMuzzleLocation(STRUCTURE *psStructure, iVector *muzzle, int weapon_slot)
|
||||
BOOL calcStructureMuzzleLocation(STRUCTURE *psStructure, Vector3i *muzzle, int weapon_slot)
|
||||
{
|
||||
iVector barrel;
|
||||
Vector3i barrel;
|
||||
iIMDShape *psShape, *psWeaponImd;
|
||||
|
||||
psShape = psStructure->pStructureType->pIMD;
|
||||
|
@ -7985,7 +7985,7 @@ BOOL electronicDamage(BASE_OBJECT *psTarget, UDWORD damage, UBYTE attackPlayer)
|
|||
BOOL bCompleted = TRUE;
|
||||
|
||||
NETMSG m;
|
||||
iVector pos;
|
||||
Vector3i pos;
|
||||
UDWORD i;
|
||||
|
||||
|
||||
|
@ -9912,7 +9912,7 @@ BOOL lasSatStructSelected(STRUCTURE *psStruct)
|
|||
/* Call CALL_NEWDROID script callback */
|
||||
static void cbNewDroid(STRUCTURE *psFactory, DROID *psDroid)
|
||||
{
|
||||
ASSERT(psDroid != NULL,
|
||||
ASSERT(psDroid != NULL,
|
||||
"cbNewDroid: no droid assigned for CALL_NEWDROID callback");
|
||||
|
||||
psScrCBNewDroid = psDroid;
|
||||
|
|
|
@ -108,7 +108,7 @@ extern BOOL loadStructureStrengthModifiers(char *pStrengthModData, UDWORD buffer
|
|||
|
||||
extern BOOL structureStatsShutDown(void);
|
||||
|
||||
extern BOOL structureDamage(STRUCTURE *psStructure, UDWORD damage,
|
||||
extern BOOL structureDamage(STRUCTURE *psStructure, UDWORD damage,
|
||||
UDWORD weaponClass, UDWORD weaponSubClass);
|
||||
|
||||
/* Set the type of droid for a factory to build */
|
||||
|
@ -122,7 +122,7 @@ extern void createTestStructures(void);
|
|||
extern void setStructTileDraw(STRUCTURE *psStruct);
|
||||
|
||||
//builds a specified structure at a given location
|
||||
extern STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y,
|
||||
extern STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y,
|
||||
UDWORD player,BOOL FromSave);
|
||||
|
||||
/* The main update routine for all Structures */
|
||||
|
@ -140,20 +140,20 @@ extern BOOL destroyStruct(STRUCTURE *psDel);
|
|||
BOOL removeStruct(STRUCTURE *psDel, BOOL bDestroy);
|
||||
|
||||
//fills the list with Structures that can be built
|
||||
extern UDWORD fillStructureList(STRUCTURE_STATS **ppList, UDWORD selectedPlayer,
|
||||
extern UDWORD fillStructureList(STRUCTURE_STATS **ppList, UDWORD selectedPlayer,
|
||||
UDWORD limit);
|
||||
/* checks that the location is a valid one to build on and sets the outline colour
|
||||
x and y in tile-coords*/
|
||||
extern BOOL validLocation(BASE_STATS *psStats, UDWORD x, UDWORD y, UDWORD player,
|
||||
extern BOOL validLocation(BASE_STATS *psStats, UDWORD x, UDWORD y, UDWORD player,
|
||||
BOOL bCheckBuildQueue);
|
||||
|
||||
/* for a new structure, find a location along an edge which the droid can get
|
||||
to and return this as the destination for the droid */
|
||||
//extern BOOL getDroidDestination(STRUCTURE_STATS *psPositionStats, UDWORD structX,
|
||||
//extern BOOL getDroidDestination(STRUCTURE_STATS *psPositionStats, UDWORD structX,
|
||||
// UDWORD structY, UDWORD * pDroidX, UDWORD *pDroidY);
|
||||
/*for a structure or feature, find a location along an edge which the droid can get
|
||||
to and return this as the destination for the droid*/
|
||||
extern BOOL getDroidDestination(BASE_STATS *psPositionStats, UDWORD structX,
|
||||
extern BOOL getDroidDestination(BASE_STATS *psPositionStats, UDWORD structX,
|
||||
UDWORD structY, UDWORD * pDroidX, UDWORD *pDroidY);
|
||||
/* check along the width of a structure for an empty space */
|
||||
extern BOOL checkWidth(UDWORD maxRange, UDWORD x, UDWORD y, UDWORD *pDroidX, UDWORD *pDroidY);
|
||||
|
@ -174,14 +174,14 @@ extern BOOL structureIdle(STRUCTURE *psBuilding);
|
|||
/*checks to see if any structure exists of a specified type with a specified status */
|
||||
extern BOOL checkStructureStatus( STRUCTURE_STATS *psStats, UDWORD player, UDWORD status);
|
||||
/*sets the point new droids go to - x/y in world coords for a Factory*/
|
||||
extern void setAssemblyPoint(FLAG_POSITION *psAssemblyPoint, UDWORD x, UDWORD y,
|
||||
extern void setAssemblyPoint(FLAG_POSITION *psAssemblyPoint, UDWORD x, UDWORD y,
|
||||
UDWORD player, BOOL bCheck);
|
||||
//extern void createAssemblyPoint(STRUCTURE* psStruct);
|
||||
|
||||
/* consider delivery points when selected by player*/
|
||||
extern void processDeliveryPoint(UDWORD player, UDWORD x, UDWORD y);
|
||||
|
||||
/*called when a structure has been built - checks through the list of callbacks
|
||||
/*called when a structure has been built - checks through the list of callbacks
|
||||
for the scripts*/
|
||||
extern void structureCompletedCallback(STRUCTURE_STATS *psStructType);
|
||||
|
||||
|
@ -215,7 +215,7 @@ extern void setLasSatExists(BOOL state, UDWORD player);
|
|||
extern BOOL getLasSatExists(UDWORD player);
|
||||
|
||||
/* added int weapon_slot to fix the alway slot 0 hack */
|
||||
extern BOOL calcStructureMuzzleLocation(STRUCTURE *psStructure, iVector *muzzle, int weapon_slot);
|
||||
extern BOOL calcStructureMuzzleLocation(STRUCTURE *psStructure, Vector3i *muzzle, int weapon_slot);
|
||||
|
||||
/*this is called whenever a structure has finished building*/
|
||||
extern void buildingComplete(STRUCTURE *psBuilding);
|
||||
|
@ -243,14 +243,14 @@ is available*/
|
|||
extern void releaseResExtractor(STRUCTURE *psRelease);
|
||||
|
||||
/*called when a Power Gen is destroyed or is disconnected
|
||||
adjusts the associated Res Extractors so that they can link to different Power
|
||||
adjusts the associated Res Extractors so that they can link to different Power
|
||||
Gens if any are available*/
|
||||
extern void releasePowerGen(STRUCTURE *psRelease);
|
||||
|
||||
//print some info at the top of the screen dependant on the structure
|
||||
extern void printStructureInfo(STRUCTURE *psStructure);
|
||||
|
||||
/*Checks the template type against the factory type - returns FALSE
|
||||
/*Checks the template type against the factory type - returns FALSE
|
||||
if not a good combination!*/
|
||||
extern BOOL validTemplateForFactory(DROID_TEMPLATE *psTemplate, STRUCTURE *psFactory);
|
||||
|
||||
|
@ -262,7 +262,7 @@ extern BOOL electronicDamage(BASE_OBJECT *psTarget, UDWORD damage, UBYTE attackP
|
|||
/* EW works differently in multiplayer mode compared with single player.*/
|
||||
extern BOOL validStructResistance(STRUCTURE *psStruct);
|
||||
|
||||
/*checks to see if a specific structure type exists -as opposed to a structure
|
||||
/*checks to see if a specific structure type exists -as opposed to a structure
|
||||
stat type*/
|
||||
extern BOOL checkSpecificStructExists(UDWORD structInc, UDWORD player);
|
||||
|
||||
|
@ -287,7 +287,7 @@ extern FLAG_POSITION *FindFactoryDelivery(STRUCTURE *Struct);
|
|||
//Find the factory associated with the delivery point - returns NULL if none exist
|
||||
extern STRUCTURE *findDeliveryFactory(FLAG_POSITION *psDelPoint);
|
||||
|
||||
/*this is called when a factory produces a droid. The Template returned is the next
|
||||
/*this is called when a factory produces a droid. The Template returned is the next
|
||||
one to build - if any*/
|
||||
extern DROID_TEMPLATE * factoryProdUpdate(STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate);
|
||||
|
||||
|
@ -296,7 +296,7 @@ extern void factoryProdAdjust(STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate
|
|||
|
||||
//returns the quantity of a specific template in the production list
|
||||
extern UDWORD getProductionQuantity(STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate);
|
||||
/*returns the quantity of a specific template in the production list that
|
||||
/*returns the quantity of a specific template in the production list that
|
||||
have already been built*/
|
||||
extern UDWORD getProductionBuilt(STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate);
|
||||
|
||||
|
@ -309,7 +309,7 @@ extern void checkDeliveryPoints(UDWORD version);
|
|||
//adjust the loop quantity for this factory
|
||||
extern void factoryLoopAdjust(STRUCTURE *psStruct, BOOL add);
|
||||
|
||||
/*cancels the production run for the factory and returns any power that was
|
||||
/*cancels the production run for the factory and returns any power that was
|
||||
accrued but not used*/
|
||||
extern void cancelProduction(STRUCTURE *psBuilding);
|
||||
|
||||
|
@ -319,7 +319,7 @@ extern void holdProduction(STRUCTURE *psBuilding);
|
|||
/*release a factory's production run from hold*/
|
||||
extern void releaseProduction(STRUCTURE *psBuilding);
|
||||
|
||||
/*This function is called after a game is loaded so that any resource extractors
|
||||
/*This function is called after a game is loaded so that any resource extractors
|
||||
that are active are initialised for when to start*/
|
||||
extern void checkResExtractorsActive(void);
|
||||
|
||||
|
@ -329,22 +329,22 @@ extern UWORD countAssignableFactories(UBYTE player,UWORD FactoryType);
|
|||
/*Used for determining how much of the structure to draw as being built or demolished*/
|
||||
extern FRACT structHeightScale(STRUCTURE *psStruct);
|
||||
|
||||
/*compares the structure sensor type with the droid weapon type to see if the
|
||||
/*compares the structure sensor type with the droid weapon type to see if the
|
||||
FIRE_SUPPORT order can be assigned*/
|
||||
extern BOOL structSensorDroidWeapon(STRUCTURE *psStruct, DROID *psDroid);
|
||||
|
||||
/*checks if the structure has a Counter Battery sensor attached - returns
|
||||
/*checks if the structure has a Counter Battery sensor attached - returns
|
||||
TRUE if it has*/
|
||||
extern BOOL structCBSensor(STRUCTURE *psStruct);
|
||||
/*checks if the structure has a Standard Turret sensor attached - returns
|
||||
/*checks if the structure has a Standard Turret sensor attached - returns
|
||||
TRUE if it has*/
|
||||
extern BOOL structStandardSensor(STRUCTURE *psStruct);
|
||||
|
||||
/*checks if the structure has a VTOL Intercept sensor attached - returns
|
||||
/*checks if the structure has a VTOL Intercept sensor attached - returns
|
||||
TRUE if it has*/
|
||||
extern BOOL structVTOLSensor(STRUCTURE *psStruct);
|
||||
|
||||
/*checks if the structure has a VTOL Counter Battery sensor attached - returns
|
||||
/*checks if the structure has a VTOL Counter Battery sensor attached - returns
|
||||
TRUE if it has*/
|
||||
extern BOOL structVTOLCBSensor(STRUCTURE *psStruct);
|
||||
|
||||
|
@ -375,7 +375,7 @@ extern void changeProductionPlayer(UBYTE player);
|
|||
// La!
|
||||
extern BOOL IsStatExpansionModule(STRUCTURE_STATS *psStats);
|
||||
|
||||
/*checks that the structure stats have loaded up as expected - must be done after
|
||||
/*checks that the structure stats have loaded up as expected - must be done after
|
||||
all StructureStats parts have been loaded*/
|
||||
extern BOOL checkStructureStats(void);
|
||||
|
||||
|
@ -389,7 +389,7 @@ extern BOOL checkFactoryExists(UDWORD player, UDWORD factoryType, UDWORD inc);
|
|||
|
||||
extern BOOL ptInStructure(STRUCTURE *psStruct, UDWORD x, UDWORD y);
|
||||
|
||||
/*checks the structure passed in is a Las Sat structure which is currently
|
||||
/*checks the structure passed in is a Las Sat structure which is currently
|
||||
selected - returns TRUE if valid*/
|
||||
extern BOOL lasSatStructSelected(STRUCTURE *psStruct);
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
enum
|
||||
{
|
||||
REF_HQ,
|
||||
REF_FACTORY,
|
||||
REF_FACTORY_MODULE,//draw as factory 2
|
||||
REF_FACTORY,
|
||||
REF_FACTORY_MODULE,//draw as factory 2
|
||||
REF_POWER_GEN,
|
||||
REF_POWER_MODULE,
|
||||
REF_RESOURCE_EXTRACTOR,
|
||||
|
@ -49,8 +49,8 @@ REF_DEFENSE,
|
|||
REF_WALL,
|
||||
REF_WALLCORNER, //corner wall - no gun
|
||||
REF_BLASTDOOR,
|
||||
REF_RESEARCH,
|
||||
REF_RESEARCH_MODULE,
|
||||
REF_RESEARCH,
|
||||
REF_RESEARCH_MODULE,
|
||||
REF_REPAIR_FACILITY,
|
||||
REF_COMMAND_CONTROL, //control centre for command droids
|
||||
REF_BRIDGE,
|
||||
|
@ -63,7 +63,7 @@ REF_MISSILE_SILO,
|
|||
REF_SAT_UPLINK, //added for updates - AB 8/6/99
|
||||
|
||||
//REF_WALLH, //the following are needed for the demo
|
||||
//REF_WALLV,
|
||||
//REF_WALLV,
|
||||
//REF_CORNER1,
|
||||
//REF_CORNER2,
|
||||
//REF_CORNER3,
|
||||
|
@ -100,7 +100,7 @@ typedef enum _position_type
|
|||
UDWORD screenY; \
|
||||
UDWORD screenR; \
|
||||
UDWORD player; /*which player the Position belongs to*/ \
|
||||
BOOL selected /*flag to indicate whether the Position
|
||||
BOOL selected /*flag to indicate whether the Position
|
||||
is to be highlighted*/
|
||||
|
||||
typedef struct _object_position
|
||||
|
@ -111,11 +111,11 @@ typedef struct _object_position
|
|||
typedef struct _flag_position
|
||||
{
|
||||
POSITION_OBJ;
|
||||
iVector coords; //the world coords of the Position
|
||||
Vector3i coords; //the world coords of the Position
|
||||
//UDWORD frameNumber; //when the Position was last drawn
|
||||
//UDWORD screenX, screenY, screenR; //screen coords and radius of Position imd
|
||||
//UDWORD player; //which player the Position belongs to
|
||||
//BOOL selected; //flag to indicate whether the
|
||||
//BOOL selected; //flag to indicate whether the
|
||||
//Position is to be highlighted
|
||||
UBYTE factoryInc; //indicates whether the first, second etc factory
|
||||
UBYTE factoryType; //indicates whether standard, cyborg or vtol factory
|
||||
|
@ -129,7 +129,7 @@ typedef struct _flag_position
|
|||
#define NUM_DEMO_STRUCTS 12
|
||||
#endif
|
||||
|
||||
//only allowed one weapon per structure (more memory for Tim)
|
||||
//only allowed one weapon per structure (more memory for Tim)
|
||||
//Watermelon:only allowed 4 weapons per structure(sorry Tim...)
|
||||
#define STRUCT_MAXWEAPS 4
|
||||
|
||||
|
@ -150,11 +150,11 @@ typedef UWORD STRUCTSTRENGTH_MODIFIER;
|
|||
//this structure is used to hold the permenant stats for each type of building
|
||||
typedef struct _structure_stats
|
||||
{
|
||||
STATS_BASE; /* basic stats */
|
||||
STATS_BASE; /* basic stats */
|
||||
UDWORD type; /* the type of structure */
|
||||
TECH_LEVEL techLevel; /* technology level of the structure */
|
||||
STRUCT_STRENGTH strength; /* strength against the weapon effects */
|
||||
UDWORD terrainType; /*The type of terrain the structure has to be
|
||||
UDWORD terrainType; /*The type of terrain the structure has to be
|
||||
built next to - may be none*/
|
||||
UDWORD baseWidth; /*The width of the base in tiles*/
|
||||
UDWORD baseBreadth; /*The breadth of the base in tiles*/
|
||||
|
@ -163,29 +163,29 @@ typedef struct _structure_stats
|
|||
the structure*/
|
||||
UDWORD height; /*The height above/below the terrain - negative
|
||||
values denote below the terrain*/
|
||||
UDWORD armourValue; /*The armour value for the structure - can be
|
||||
UDWORD armourValue; /*The armour value for the structure - can be
|
||||
upgraded */
|
||||
UDWORD bodyPoints; /*The structure's body points - A structure goes
|
||||
off-line when 50% of its body points are lost*/
|
||||
UDWORD repairSystem; /*The repair system points are added to the body
|
||||
points until fully restored . The points are
|
||||
points until fully restored . The points are
|
||||
then added to the Armour Points*/
|
||||
UDWORD powerToBuild; /*How much power the structure requires to build*/
|
||||
UDWORD powerToBuild; /*How much power the structure requires to build*/
|
||||
//NOT USED ANYMORE - AB 24/01/99
|
||||
/*UDWORD minimumPower; The minimum power requirement to start building
|
||||
the structure*/
|
||||
UDWORD resistance; /*The number used to determine whether a
|
||||
structure can resist an enemy takeover -
|
||||
UDWORD resistance; /*The number used to determine whether a
|
||||
structure can resist an enemy takeover -
|
||||
0 = cannot be attacked electrically*/
|
||||
//NOT USED ANYMORE - AB 24/01/99
|
||||
/*UDWORD quantityLimit; The maximum number that a player can have -
|
||||
/*UDWORD quantityLimit; The maximum number that a player can have -
|
||||
0 = no limit 1 = only 1 allowed etc*/
|
||||
UDWORD sizeModifier; /*The larger the target, the easier to hit*/
|
||||
struct iIMDShape *pIMD; /*The IMD to draw for this structure */
|
||||
struct iIMDShape *pBaseIMD; /*The base IMD to draw for this structure */
|
||||
struct _ecm_stats *pECM; /*Which ECM is standard for the structure -
|
||||
struct _ecm_stats *pECM; /*Which ECM is standard for the structure -
|
||||
if any*/
|
||||
struct _sensor_stats *pSensor; /*Which Sensor is standard for the structure -
|
||||
struct _sensor_stats *pSensor; /*Which Sensor is standard for the structure -
|
||||
if any*/
|
||||
//NOT USED ANYMORE - AB 24/01/99
|
||||
//Watermelon:pfft
|
||||
|
@ -193,7 +193,7 @@ typedef struct _structure_stats
|
|||
building*/
|
||||
UDWORD numWeaps; /*Number of weapons for default */
|
||||
//SDWORD defaultWeap; /The default weapon/
|
||||
|
||||
|
||||
//struct _weapon_stats **asWeapList; /*List of pointers to default weapons*/
|
||||
|
||||
//Watermelon:can only have STRUCT_MAXWEAPS now...
|
||||
|
@ -201,7 +201,7 @@ typedef struct _structure_stats
|
|||
|
||||
UDWORD numFuncs; /*Number of functions for default*/
|
||||
SDWORD defaultFunc; /*The default function*/
|
||||
struct _function **asFuncList; /*List of pointers to allowable functions -
|
||||
struct _function **asFuncList; /*List of pointers to allowable functions -
|
||||
unalterable*/
|
||||
} STRUCTURE_STATS;
|
||||
|
||||
|
@ -219,9 +219,9 @@ typedef struct _research_facility
|
|||
UDWORD timeStarted; /* The time the building started on the subject*/
|
||||
UDWORD researchPoints; /* Research Points produced per research cycle*/
|
||||
UDWORD timeToResearch; /* Time taken to research the topic*/
|
||||
struct _base_stats *psBestTopic; /* The topic with the most research points
|
||||
struct _base_stats *psBestTopic; /* The topic with the most research points
|
||||
that was last performed*/
|
||||
UDWORD powerAccrued; /* used to keep track of power before
|
||||
UDWORD powerAccrued; /* used to keep track of power before
|
||||
researching a topic*/
|
||||
UDWORD timeStartHold; /* The time the research facility was put on hold*/
|
||||
|
||||
|
@ -230,15 +230,15 @@ typedef struct _research_facility
|
|||
typedef struct _factory
|
||||
{
|
||||
|
||||
UBYTE capacity; /* The max size of body the factory
|
||||
UBYTE capacity; /* The max size of body the factory
|
||||
can produce*/
|
||||
UBYTE quantity; /* The number of droids to produce OR for
|
||||
UBYTE quantity; /* The number of droids to produce OR for
|
||||
selectedPlayer, how many loops to perform*/
|
||||
UBYTE loopsPerformed; /* how many times the loop has been performed*/
|
||||
//struct _propulsion_types* propulsionType;
|
||||
//UBYTE propulsionType; /* The type of propulsion the facility
|
||||
//struct _propulsion_types* propulsionType;
|
||||
//UBYTE propulsionType; /* The type of propulsion the facility
|
||||
// can produce*/
|
||||
UBYTE productionOutput; /* Droid Build Points Produced Per
|
||||
UBYTE productionOutput; /* Droid Build Points Produced Per
|
||||
Build Cycle*/
|
||||
UDWORD powerAccrued; /* used to keep track of power before building a droid*/
|
||||
BASE_STATS *psSubject; /* the subject the structure is working on */
|
||||
|
@ -250,7 +250,7 @@ typedef struct _factory
|
|||
struct _droid *psCommander; // command droid to produce droids for (if any)
|
||||
UDWORD secondaryOrder; // secondary order state for all units coming out of the factory
|
||||
// added AB 22/04/99
|
||||
|
||||
|
||||
//these are no longer required - yipee!
|
||||
// The group the droids produced by this factory belong to - used for Missions
|
||||
//struct _droid_group *psGroup;
|
||||
|
@ -288,7 +288,7 @@ typedef struct REPAIR_FACILITY
|
|||
UDWORD power; /* Power used in repairing */
|
||||
UDWORD timeStarted; /* Time repair started on current object */
|
||||
BASE_OBJECT *psObj; /* Object being repaired */
|
||||
UDWORD powerAccrued; /* used to keep track of power before
|
||||
UDWORD powerAccrued; /* used to keep track of power before
|
||||
repairing a droid */
|
||||
FLAG_POSITION *psDeliveryPoint; /* Place for the repaired droids to assemble
|
||||
at */
|
||||
|
@ -317,12 +317,12 @@ typedef struct _structure
|
|||
BASE_ELEMENTS(struct _structure);
|
||||
|
||||
// UDWORD ref;
|
||||
STRUCTURE_STATS* pStructureType; /* pointer to the structure stats for this
|
||||
type of building */
|
||||
UBYTE status; /* defines whether the structure is being
|
||||
STRUCTURE_STATS* pStructureType; /* pointer to the structure stats for this
|
||||
type of building */
|
||||
UBYTE status; /* defines whether the structure is being
|
||||
built, doing nothing or performing a function*/
|
||||
//SDWORD currentBuildPts; /* the build points currently assigned to this
|
||||
SWORD currentBuildPts; /* the build points currently assigned to this
|
||||
//SDWORD currentBuildPts; /* the build points currently assigned to this
|
||||
SWORD currentBuildPts; /* the build points currently assigned to this
|
||||
structure */
|
||||
SWORD currentPowerAccrued; /* the power accrued for building this structure*/
|
||||
UWORD body; /* current body points */
|
||||
|
@ -330,8 +330,8 @@ typedef struct _structure
|
|||
//UDWORD baseBodyPoints; /* undamaged body points */
|
||||
UWORD armour; /* current armour points */
|
||||
//UDWORD armour; /* current armour points */
|
||||
//SDWORD resistance; /* current resistance points
|
||||
SWORD resistance; /* current resistance points
|
||||
//SDWORD resistance; /* current resistance points
|
||||
SWORD resistance; /* current resistance points
|
||||
0 = cannot be attacked electrically*/
|
||||
UDWORD lastResistance; /* time the resistance was last increased*/
|
||||
//UDWORD repair; /* current repair points */
|
||||
|
@ -361,7 +361,7 @@ typedef struct _structure
|
|||
UWORD radarY;
|
||||
//the ecm power needs to be stored since the actual ecm stat can change with research
|
||||
UWORD ecmPower;
|
||||
//FRACT heightScale;
|
||||
//FRACT heightScale;
|
||||
|
||||
FUNCTIONALITY *pFunctionality; /* pointer to structure that contains fields
|
||||
necessary for functionality */
|
||||
|
@ -382,7 +382,7 @@ typedef struct _structure
|
|||
typedef struct _structure_limits
|
||||
{
|
||||
UBYTE limit; /* the number allowed to be built */
|
||||
UBYTE currentQuantity; /* the number of the type currently
|
||||
UBYTE currentQuantity; /* the number of the type currently
|
||||
built per player*/
|
||||
|
||||
UBYTE globalLimit; // multiplayer only. sets the max value selectable (limits changed by player)
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#define TEXTURE_PAGE_SIZE PAGE_WIDTH*PAGE_HEIGHT*PAGE_DEPTH
|
||||
|
||||
/* Stores the graphics data for the terrain tiles textures (in src/data.c) */
|
||||
iSprite tilesPCX;
|
||||
iTexture tilesPCX;
|
||||
|
||||
/* How many pages have we loaded */
|
||||
SDWORD firstTexturePage;
|
||||
|
@ -81,7 +81,7 @@ void makeTileTexturePages(UDWORD srcWidth, UDWORD srcHeight, UDWORD tileWidth, U
|
|||
UDWORD tilesProcessed;
|
||||
char *tileStorage;
|
||||
char *presentLoc;
|
||||
iSprite sprite;
|
||||
iTexture sprite;
|
||||
|
||||
/* This is how many pages are already used on hardware */
|
||||
firstTexturePage = pie_GetLastPageDownloaded() + 1;
|
||||
|
@ -158,7 +158,7 @@ void remakeTileTexturePages(UDWORD srcWidth,UDWORD srcHeight, UDWORD tileWidth,
|
|||
UDWORD tilesProcessed;
|
||||
char *tileStorage;
|
||||
char *presentLoc;
|
||||
iSprite sprite;
|
||||
iTexture sprite;
|
||||
//check enough pages are allocated
|
||||
|
||||
debug(LOG_TEXTURE, "remakeTileTexturePages: src(%d,%d), tile(%d, %d)", srcWidth,
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef _texture_h
|
||||
#define _texture_h
|
||||
|
||||
extern iSprite tilesPCX;
|
||||
extern iTexture tilesPCX;
|
||||
|
||||
int makeTileTextures(void);
|
||||
int remakeTileTextures(void);
|
||||
|
|
10
src/warcam.c
10
src/warcam.c
|
@ -112,7 +112,7 @@ static FRACT radarX,radarY;
|
|||
|
||||
/* Where we were up to (pos and rot) last update - allows us to see whether
|
||||
we are sufficently near our target to disable further tracking */
|
||||
static iVector oldPosition,oldRotation;
|
||||
static Vector3i oldPosition, oldRotation;
|
||||
|
||||
/* The fraction of a second that the last game frame took */
|
||||
static FRACT fraction;
|
||||
|
@ -1242,7 +1242,7 @@ SDWORD yPos;
|
|||
/* Returns how far away we are from our goal in a radar track */
|
||||
static UDWORD getPositionMagnitude( void )
|
||||
{
|
||||
iVector dif;
|
||||
Vector3i dif;
|
||||
UDWORD val;
|
||||
|
||||
dif.x = abs(player.p.x - oldPosition.x);
|
||||
|
@ -1255,7 +1255,7 @@ static UDWORD getPositionMagnitude( void )
|
|||
|
||||
static UDWORD getRotationMagnitude( void )
|
||||
{
|
||||
iVector dif;
|
||||
Vector3i dif;
|
||||
UDWORD val;
|
||||
|
||||
dif.x = abs(player.r.x - oldRotation.x);
|
||||
|
@ -1561,7 +1561,7 @@ BOOL retVal;
|
|||
/* Displays a spinning MTV style logo in the top right of the screen */
|
||||
void dispWarCamLogo( void )
|
||||
{
|
||||
//iVector dv;
|
||||
//Vecotr3i dv;
|
||||
//
|
||||
// if(gamePaused())
|
||||
// {
|
||||
|
@ -1588,7 +1588,7 @@ void toggleRadarAllignment( void )
|
|||
bRadarAllign = !bRadarAllign;
|
||||
}
|
||||
|
||||
void camInformOfRotation( iVector *rotation )
|
||||
void camInformOfRotation( Vector3i *rotation )
|
||||
{
|
||||
trackingCamera.rotation.x = rotation->x;
|
||||
trackingCamera.rotation.y = rotation->y;
|
||||
|
|
20
src/warcam.h
20
src/warcam.h
|
@ -57,12 +57,6 @@ CAM_TRACK_OBJECT,
|
|||
CAM_TRACK_LOCATION
|
||||
};
|
||||
|
||||
// We define and use this struct instead of iVector because iVector is 32 bit on pc
|
||||
// but only 16 bit on Playstation and we definitly need 32 bits for the war camera stuff.
|
||||
typedef struct {
|
||||
int32 x,y,z;
|
||||
} iVector32;
|
||||
|
||||
/* Storage for old viewnagles etc */
|
||||
typedef struct _warcam
|
||||
{
|
||||
|
@ -71,13 +65,13 @@ UDWORD trackClass;
|
|||
UDWORD lastUpdate;
|
||||
iView oldView;
|
||||
|
||||
PIEVECTORF acceleration;
|
||||
PIEVECTORF velocity;
|
||||
PIEVECTORF position;
|
||||
Vector3f acceleration;
|
||||
Vector3f velocity;
|
||||
Vector3f position;
|
||||
|
||||
PIEVECTORF rotation;
|
||||
PIEVECTORF rotVel;
|
||||
PIEVECTORF rotAccel;
|
||||
Vector3f rotation;
|
||||
Vector3f rotVel;
|
||||
Vector3f rotAccel;
|
||||
|
||||
UDWORD oldDistance;
|
||||
BASE_OBJECT *target;
|
||||
|
@ -95,7 +89,7 @@ extern void requestRadarTrack ( SDWORD x, SDWORD y );
|
|||
extern BOOL getRadarTrackingStatus( void );
|
||||
extern void dispWarCamLogo ( void );
|
||||
extern void toggleRadarAllignment( void );
|
||||
extern void camInformOfRotation ( iVector *rotation );
|
||||
extern void camInformOfRotation ( Vector3i *rotation );
|
||||
extern BASE_OBJECT *camFindDroidTarget(void);
|
||||
extern DROID *getTrackingDroid( void );
|
||||
extern SDWORD getPresAngle( void );
|
||||
|
|
Loading…
Reference in New Issue