mirror of
https://github.com/ioquake/jedi-outcast.git
synced 2024-11-09 23:01:48 +00:00
initial round of amd64 fixes
This commit is contained in:
parent
147d694c92
commit
2602d6e48d
36 changed files with 195 additions and 133 deletions
|
@ -1567,10 +1567,10 @@ qboolean CG_WorldCoordToScreenCoordFloat(vec3_t worldCoord, float *x, float *y)
|
|||
|
||||
qboolean CG_WorldCoordToScreenCoord( vec3_t worldCoord, int *x, int *y )
|
||||
{
|
||||
float xF, yF;
|
||||
qboolean retVal = CG_WorldCoordToScreenCoordFloat( worldCoord, &xF, &yF );
|
||||
*x = (int)xF;
|
||||
*y = (int)yF;
|
||||
floatint_t xFI, yFI;
|
||||
qboolean retVal = CG_WorldCoordToScreenCoordFloat( worldCoord, &xFI.f, &yFI.f );
|
||||
*x = xFI.i;
|
||||
*y = yFI.i;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,8 @@ This must be the very first function compiled into the .q3vm file
|
|||
================
|
||||
*/
|
||||
extern "C" {
|
||||
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7 ) {
|
||||
intptr_t vmMain( intptr_t command, intptr_t arg0, intptr_t arg1, intptr_t arg2,
|
||||
intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6, intptr_t arg7 ) {
|
||||
centity_t *cent;
|
||||
|
||||
switch ( command ) {
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
//prototypes
|
||||
extern void CG_PreInit();
|
||||
|
||||
int (*qsyscall)( int arg, ... ) = (int (*)( int, ...))-1;
|
||||
intptr_t (*qsyscall)( intptr_t arg, ... ) = (intptr_t (*)( intptr_t, ...))-1;
|
||||
|
||||
|
||||
extern "C" {
|
||||
void dllEntry( int (*syscallptr)( int arg,... ) ) {
|
||||
void dllEntry( intptr_t (*syscallptr)( intptr_t arg,... ) ) {
|
||||
qsyscall = syscallptr;
|
||||
CG_PreInit();
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ void dllEntry( int (*syscallptr)( int arg,... ) ) {
|
|||
|
||||
|
||||
inline int PASSFLOAT( float x ) {
|
||||
float floatTemp;
|
||||
floatTemp = x;
|
||||
return *(int *)&floatTemp;
|
||||
floatint_t fi;
|
||||
fi.f = x;
|
||||
return fi.i;
|
||||
}
|
||||
|
||||
void cgi_Printf( const char *fmt ) {
|
||||
|
|
|
@ -376,8 +376,16 @@ void *VM_ArgPtr( int intValue );
|
|||
void CM_SnapPVS(vec3_t origin,byte *buffer);
|
||||
//#define VMA(x) VM_ArgPtr(args[x])
|
||||
#define VMA(x) ((void*)args[x])
|
||||
#define VMF(x) ((float *)args)[x]
|
||||
int CL_CgameSystemCalls( int *args ) {
|
||||
|
||||
static inline float _vmf(intptr_t x)
|
||||
{
|
||||
floatint_t fi;
|
||||
fi.i = (int) x;
|
||||
return fi.f;
|
||||
}
|
||||
#define VMF(x) _vmf(args[x])
|
||||
|
||||
intptr_t CL_CgameSystemCalls( intptr_t *args ) {
|
||||
switch( args[0] ) {
|
||||
case CG_PRINT:
|
||||
Com_Printf( "%s", VMA(1) );
|
||||
|
@ -690,7 +698,7 @@ Ghoul2 Insert End
|
|||
return 0;
|
||||
|
||||
case CG_Z_MALLOC:
|
||||
return (int)Z_Malloc(args[1], (memtag_t) args[2], qfalse);
|
||||
return (intptr_t)Z_Malloc(args[1], (memtag_t) args[2], qfalse);
|
||||
|
||||
case CG_Z_FREE:
|
||||
Z_Free((void *) VMA(1));
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef struct {
|
|||
byte file[65536];
|
||||
short sqrTable[256];
|
||||
|
||||
unsigned int mcomp[256];
|
||||
int mcomp[256];
|
||||
unsigned short vq2[256*16*4];
|
||||
unsigned short vq4[256*64*4];
|
||||
unsigned short vq8[256*256*4];
|
||||
|
@ -889,8 +889,8 @@ static void readQuadInfo( byte *qData )
|
|||
cinTable[currentHandle].VQ0 = cinTable[currentHandle].VQNormal;
|
||||
cinTable[currentHandle].VQ1 = cinTable[currentHandle].VQBuffer;
|
||||
|
||||
cinTable[currentHandle].t[0] = (0 - (unsigned int)cin.linbuf)+(unsigned int)cin.linbuf+cinTable[currentHandle].screenDelta;
|
||||
cinTable[currentHandle].t[1] = (0 - ((unsigned int)cin.linbuf + cinTable[currentHandle].screenDelta))+(unsigned int)cin.linbuf;
|
||||
cinTable[currentHandle].t[0] = cinTable[currentHandle].screenDelta;
|
||||
cinTable[currentHandle].t[1] = -cinTable[currentHandle].screenDelta;
|
||||
|
||||
cinTable[currentHandle].drawX = cinTable[currentHandle].CIN_WIDTH;
|
||||
cinTable[currentHandle].drawY = cinTable[currentHandle].CIN_HEIGHT;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
int PC_ReadTokenHandle(int handle, struct pc_token_s *pc_token);
|
||||
|
||||
int CL_UISystemCalls( int *args );
|
||||
intptr_t CL_UISystemCalls( intptr_t *args );
|
||||
|
||||
//prototypes
|
||||
extern qboolean SG_GetSaveImage( const char *psPathlessBaseName, void *pvAddress );
|
||||
|
@ -127,11 +127,10 @@ FloatAsInt
|
|||
*/
|
||||
int FloatAsInt( float f )
|
||||
{
|
||||
int temp;
|
||||
floatint_t fi;
|
||||
|
||||
*(float *)&temp = f;
|
||||
|
||||
return temp;
|
||||
fi.f = f;
|
||||
return fi.i;
|
||||
}
|
||||
|
||||
static void UI_Cvar_Create( const char *var_name, const char *var_value, int flags ) {
|
||||
|
@ -357,8 +356,18 @@ The ui module is making a system call
|
|||
vm_t uivm;
|
||||
|
||||
#define VMA(x) ((void*)args[x])
|
||||
#define VMF(x) ((float *)args)[x]
|
||||
int CL_UISystemCalls( int *args )
|
||||
//#define VMF(x) ((float *)args)[x]
|
||||
|
||||
static inline float _vmf(intptr_t x)
|
||||
{
|
||||
floatint_t fi;
|
||||
fi.i = (int) x;
|
||||
return fi.f;
|
||||
}
|
||||
#define VMF(x) _vmf(args[x])
|
||||
|
||||
|
||||
intptr_t CL_UISystemCalls( intptr_t *args )
|
||||
{
|
||||
|
||||
switch( args[0] )
|
||||
|
|
|
@ -97,7 +97,7 @@ void DumpChunks(void)
|
|||
memcpy (str, data_p, 4);
|
||||
data_p += 4;
|
||||
iff_chunk_len = GetLittleLong();
|
||||
Com_Printf ("0x%x : %s (%d)\n", (int)(data_p - 4), str, iff_chunk_len);
|
||||
Com_Printf ("0x%lx : %s (%d)\n", (intptr_t)(data_p - 4), str, iff_chunk_len);
|
||||
data_p += (iff_chunk_len + 1) & ~1;
|
||||
} while (data_p < iff_end);
|
||||
}
|
||||
|
|
|
@ -10,11 +10,19 @@ VIRTUAL MACHINE
|
|||
|
||||
==============================================================
|
||||
*/
|
||||
int VM_Call( int callnum, ... )
|
||||
intptr_t VM_Call( intptr_t callnum, ... )
|
||||
{
|
||||
return cgvm.entryPoint( (&callnum)[0], (&callnum)[1], (&callnum)[2], (&callnum)[3],
|
||||
(&callnum)[4], (&callnum)[5], (&callnum)[6], (&callnum)[7],
|
||||
(&callnum)[8], (&callnum)[9] );
|
||||
intptr_t args[9];
|
||||
int i;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, callnum);
|
||||
for (i = 0; i < 9; i++) {
|
||||
args[i] = va_arg(ap, intptr_t);
|
||||
}
|
||||
va_end(ap);
|
||||
return cgvm.entryPoint( callnum, args[0], args[1], args[2], args[3],
|
||||
args[4], args[5], args[6], args[7], args[8] );
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,10 +33,25 @@ VM_DllSyscall
|
|||
we pass this to the cgame dll to call back into the client
|
||||
============
|
||||
*/
|
||||
extern int CL_CgameSystemCalls( int *args );
|
||||
extern int CL_UISystemCalls( int *args );
|
||||
extern intptr_t CL_CgameSystemCalls( intptr_t *args );
|
||||
extern intptr_t CL_UISystemCalls( intptr_t *args );
|
||||
|
||||
int VM_DllSyscall( int arg, ... ) {
|
||||
intptr_t VM_DllSyscall( intptr_t arg, ... ) {
|
||||
#if !defined(__i386__) || defined(__clang__)
|
||||
intptr_t args[15];
|
||||
int i;
|
||||
va_list ap;
|
||||
|
||||
args[0] = arg;
|
||||
|
||||
va_start(ap, arg);
|
||||
for (i = 1; i < 15; i++)
|
||||
args[i] = va_arg(ap, intptr_t);
|
||||
va_end(ap);
|
||||
|
||||
return CL_CgameSystemCalls( args );
|
||||
#else
|
||||
// return cgvm->systemCall( &arg );
|
||||
return CL_CgameSystemCalls( &arg );
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ VIRTUAL MACHINE
|
|||
==============================================================
|
||||
*/
|
||||
struct vm_s {
|
||||
int (*entryPoint)( int callNum, ... );
|
||||
intptr_t (*entryPoint)( intptr_t callNum, ... );
|
||||
};
|
||||
|
||||
typedef struct vm_s vm_t;
|
||||
|
@ -54,8 +54,8 @@ typedef struct vm_s vm_t;
|
|||
extern vm_t cgvm; // interface to cgame dll or vm
|
||||
extern vm_t uivm; // interface to ui dll or vm
|
||||
|
||||
extern int VM_Call( int callnum, ... );
|
||||
extern int VM_DllSyscall( int arg, ... );
|
||||
extern intptr_t VM_Call( intptr_t callnum, ... );
|
||||
extern intptr_t VM_DllSyscall( intptr_t arg, ... );
|
||||
extern void CL_ShutdownCGame(void);
|
||||
|
||||
#include "../game/q_shared.h"
|
||||
|
@ -67,7 +67,7 @@ VM_Create
|
|||
it will attempt to load as a system dll
|
||||
================
|
||||
*/
|
||||
extern void *Sys_LoadCgame( int (**entryPoint)(int, ...), int (*systemcalls)(int, ...) );
|
||||
extern void *Sys_LoadCgame( intptr_t (**entryPoint)(intptr_t, ...), intptr_t (*systemcalls)(intptr_t, ...) );
|
||||
|
||||
inline void *VM_Create( const char *module)
|
||||
{
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
#define MAX_GHOULINST_SIZE 16384
|
||||
|
||||
#ifndef FOFS
|
||||
#define FOFS(x) ((int)&(((gentity_t *)0)->x)) // usually already defined in qshared.h
|
||||
#define FOFS(x) ((size_t)&(((gentity_t *)0)->x)) // usually already defined in qshared.h
|
||||
#endif
|
||||
#define STOFS(x) ((int)&(((spawn_temp_t *)0)->x))
|
||||
#define LLOFS(x) ((int)&(((level_locals_t *)0)->x))
|
||||
#define CLOFS(x) ((int)&(((gclient_t *)0)->x))
|
||||
#define NPCOFS(x) ((int)&(((gNPC_t *)0)->x))
|
||||
#define STOFS(x) ((size_t)&(((spawn_temp_t *)0)->x))
|
||||
#define LLOFS(x) ((size_t)&(((level_locals_t *)0)->x))
|
||||
#define CLOFS(x) ((size_t)&(((gclient_t *)0)->x))
|
||||
#define NPCOFS(x) ((size_t)&(((gNPC_t *)0)->x))
|
||||
//
|
||||
#define strFOFS(x) #x,FOFS(x)
|
||||
#define strSTOFS(x) #x,STOFS(x)
|
||||
|
|
|
@ -511,7 +511,7 @@ void EvaluateField(field_t *pField, byte *pbBase, byte *pbOriginalRefData/* may
|
|||
|
||||
for (int i=0; i<MAX_ALERT_EVENTS; i++)
|
||||
{
|
||||
p[i].owner = GetGEntityPtr((int)(p[i].owner));
|
||||
p[i].owner = GetGEntityPtr((intptr_t)(p[i].owner));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -522,8 +522,8 @@ void EvaluateField(field_t *pField, byte *pbBase, byte *pbOriginalRefData/* may
|
|||
|
||||
for (int i=0; i<MAX_FRAME_GROUPS; i++)
|
||||
{
|
||||
p[i].enemy = GetGEntityPtr((int)(p[i].enemy));
|
||||
p[i].commander = GetGEntityPtr((int)(p[i].commander));
|
||||
p[i].enemy = GetGEntityPtr((intptr_t)(p[i].enemy));
|
||||
p[i].commander = GetGEntityPtr((intptr_t)(p[i].commander));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "../cgame/cg_public.h"
|
||||
#include "bset.h"
|
||||
|
||||
#define FOFS(x) ((int)&(((gentity_t *)0)->x))
|
||||
#define FOFS(x) ((size_t)&(((gentity_t *)0)->x))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
@ -166,7 +166,7 @@ public:
|
|||
int mMeshFrameNum;
|
||||
int mFlags; // used for determining whether to do full collision detection against this object
|
||||
// to here
|
||||
int *mTransformedVertsArray; // used to create an array of pointers to transformed verts per surface for collision detection
|
||||
size_t *mTransformedVertsArray; // used to create an array of pointers to transformed verts per surface for collision detection
|
||||
CBoneCache *mBoneCache;
|
||||
int mSkin;
|
||||
|
||||
|
|
|
@ -512,15 +512,15 @@ void MakeNormalVectors( const vec3_t forward, vec3_t right, vec3_t up) {
|
|||
*/
|
||||
float Q_rsqrt( float number )
|
||||
{
|
||||
long i;
|
||||
floatint_t t;
|
||||
float x2, y;
|
||||
const float threehalfs = 1.5F;
|
||||
|
||||
x2 = number * 0.5F;
|
||||
y = number;
|
||||
i = * ( long * ) &y; // evil floating point bit level hacking
|
||||
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
|
||||
y = * ( float * ) &i;
|
||||
t.f = number;
|
||||
t.i = 0x5f3759df - (t.i >> 1); // what the fuck?
|
||||
y = t.f;
|
||||
|
||||
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
|
||||
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
|
||||
|
||||
|
@ -528,9 +528,10 @@ float Q_rsqrt( float number )
|
|||
}
|
||||
|
||||
float Q_fabs( float f ) {
|
||||
int tmp = * ( int * ) &f;
|
||||
tmp &= 0x7FFFFFFF;
|
||||
return * ( float * ) &tmp;
|
||||
floatint_t fi;
|
||||
fi.f = f;
|
||||
fi.i &= 0x7FFFFFFF;
|
||||
return fi.f;
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
|
|
@ -175,6 +175,13 @@ typedef const char *LPCSTR;
|
|||
typedef enum {qfalse, qtrue} qboolean;
|
||||
#define qboolean int //don't want strict type checking on the qboolean
|
||||
|
||||
typedef union
|
||||
{
|
||||
float f;
|
||||
int i;
|
||||
unsigned int ui;
|
||||
} floatint_t;
|
||||
|
||||
typedef int qhandle_t;
|
||||
typedef int fxHandle_t;
|
||||
typedef int sfxHandle_t;
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
const int modelIndex;
|
||||
const skin_t *skin;
|
||||
const shader_t *cust_shader;
|
||||
int *TransformedVertsArray;
|
||||
size_t *TransformedVertsArray;
|
||||
const EG2_Collision eG2TraceType;
|
||||
bool hitOne;
|
||||
float m_fRadius;
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
int initmodelIndex,
|
||||
const skin_t *initskin,
|
||||
const shader_t *initcust_shader,
|
||||
int *initTransformedVertsArray,
|
||||
size_t *initTransformedVertsArray,
|
||||
const EG2_Collision einitG2TraceType,
|
||||
float fRadius
|
||||
):
|
||||
|
@ -110,7 +110,7 @@ void G2_List_Model_Surfaces(const char *fileName)
|
|||
}
|
||||
}
|
||||
// find the next surface
|
||||
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
|
||||
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (size_t)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
|
||||
surface =(mdxmSurface_t *)( (byte *)surface + surface->ofsEnd );
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ void G2_List_Model_Bones(const char *fileName, int frame)
|
|||
// figure out where the offset list is
|
||||
offsets = (mdxaSkelOffsets_t *)((byte *)header + sizeof(mdxaHeader_t));
|
||||
|
||||
// frameSize = (int)( &((mdxaFrame_t *)0)->boneIndexes[ header->numBones ] );
|
||||
// frameSize = (size_t)( &((mdxaFrame_t *)0)->boneIndexes[ header->numBones ] );
|
||||
|
||||
// aframe = (mdxaFrame_t *)((byte *)header + header->ofsFrames + (frame * frameSize));
|
||||
// walk each bone and list it's name
|
||||
|
@ -210,7 +210,7 @@ int G2_DecideTraceLod(CGhoul2Info &ghoul2, int useLod)
|
|||
return returnLod;
|
||||
}
|
||||
|
||||
void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, CMiniHeap *G2VertSpace, int *TransformedVertsArray,CBoneCache *boneCache)
|
||||
void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, CMiniHeap *G2VertSpace, size_t *TransformedVertsArray,CBoneCache *boneCache)
|
||||
{
|
||||
int j, k;
|
||||
mdxmVertex_t *v;
|
||||
|
@ -223,7 +223,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, CMiniHe
|
|||
|
||||
// alloc some space for the transformed verts to get put in
|
||||
TransformedVerts = (float *)G2VertSpace->MiniHeapAlloc(surface->numVerts * 5 * 4);
|
||||
TransformedVertsArray[surface->thisSurfaceIndex] = (int)TransformedVerts;
|
||||
TransformedVertsArray[surface->thisSurfaceIndex] = (size_t)TransformedVerts;
|
||||
if (!TransformedVerts)
|
||||
{
|
||||
Com_Error(ERR_DROP, "Ran out of transform space for Ghoul2 Models. Adjust MiniHeapSize in SV_SpawnServer.\n");
|
||||
|
@ -322,7 +322,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, CMiniHe
|
|||
}
|
||||
|
||||
void G2_TransformSurfaces(int surfaceNum, surfaceInfo_v &rootSList,
|
||||
CBoneCache *boneCache, const model_t *currentModel, int lod, vec3_t scale, CMiniHeap *G2VertSpace, int *TransformedVertArray, bool secondTimeAround)
|
||||
CBoneCache *boneCache, const model_t *currentModel, int lod, vec3_t scale, CMiniHeap *G2VertSpace, size_t *TransformedVertArray, bool secondTimeAround)
|
||||
{
|
||||
int i;
|
||||
assert(currentModel);
|
||||
|
@ -402,7 +402,7 @@ void G2_TransformModel(CGhoul2Info_v &ghoul2, const int frameNum, vec3_t scale,
|
|||
lod = G2_DecideTraceLod(g, useLod);
|
||||
|
||||
// give us space for the transformed vertex array to be put in
|
||||
ghoul2[i].mTransformedVertsArray = (int*)G2VertSpace->MiniHeapAlloc(g.currentModel->mdxm->numSurfaces * 4);
|
||||
ghoul2[i].mTransformedVertsArray = (size_t*)G2VertSpace->MiniHeapAlloc(g.currentModel->mdxm->numSurfaces * 4);
|
||||
if (!g.mTransformedVertsArray)
|
||||
{
|
||||
Com_Error(ERR_DROP, "Ran out of transform space for Ghoul2 Models. Adjust MiniHeapSize in SV_SpawnServer.\n");
|
||||
|
@ -1083,7 +1083,7 @@ void *G2_FindSurface(const model_s *mod, int index, int lod)
|
|||
assert(mod->mdxm);
|
||||
|
||||
// point at first lod list
|
||||
byte *current = (byte*)((int)mod->mdxm + (int)mod->mdxm->ofsLODs);
|
||||
byte *current = (byte*)((size_t)mod->mdxm + (size_t)mod->mdxm->ofsLODs);
|
||||
int i;
|
||||
|
||||
//walk the lods
|
||||
|
@ -1126,7 +1126,7 @@ qboolean G2_SaveGhoul2Models(CGhoul2Info_v &ghoul2, char **buffer, int *size)
|
|||
*size = 0;
|
||||
|
||||
// this one isn't a define since I couldn't work out how to figure it out at compile time
|
||||
int ghoul2BlockSize = (int)&ghoul2[0].mTransformedVertsArray - (int)&ghoul2[0].mModelindex;
|
||||
int ghoul2BlockSize = (size_t)&ghoul2[0].mTransformedVertsArray - (size_t)&ghoul2[0].mModelindex;
|
||||
|
||||
// add in count for number of ghoul2 models
|
||||
*size += 4;
|
||||
|
@ -1244,7 +1244,7 @@ void G2_LoadGhoul2Model(CGhoul2Info_v &ghoul2, char *buffer)
|
|||
}
|
||||
|
||||
// this one isn't a define since I couldn't work out how to figure it out at compile time
|
||||
int ghoul2BlockSize = (int)&ghoul2[0].mTransformedVertsArray - (int)&ghoul2[0].mModelindex;
|
||||
int ghoul2BlockSize = (size_t)&ghoul2[0].mTransformedVertsArray - (size_t)&ghoul2[0].mModelindex;
|
||||
|
||||
// now we have enough instances, lets go through each one and load up the relevant details
|
||||
for (int i=0; i<ghoul2.size(); i++)
|
||||
|
|
|
@ -135,7 +135,7 @@ int G2_IsSurfaceLegal(const model_s *mod_m, const char *surfaceName, int *flags)
|
|||
return i;
|
||||
}
|
||||
// find the next surface
|
||||
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
|
||||
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (size_t)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -98,23 +98,23 @@ ReadMember
|
|||
-------------------------
|
||||
*/
|
||||
|
||||
int CBlockMember::ReadMember( char **stream, long *streamPos )
|
||||
int CBlockMember::ReadMember( char **stream, int *streamPos )
|
||||
{
|
||||
m_id = *(int *) (*stream + *streamPos);
|
||||
m_id = *(int *) (*stream + *((int *)streamPos));
|
||||
*streamPos += sizeof( int );
|
||||
|
||||
if ( m_id == ID_RANDOM )
|
||||
{//special case, need to initialize this member's data to Q3_INFINITE so we can randomize the number only the first time random is checked when inside a wait
|
||||
m_size = sizeof( float );
|
||||
*streamPos += sizeof( long );
|
||||
*streamPos += sizeof( int );
|
||||
m_data = ICARUS_Malloc( m_size );
|
||||
float infinite = Q3_INFINITE;
|
||||
memcpy( m_data, &infinite, m_size );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_size = *(long *) (*stream + *streamPos);
|
||||
*streamPos += sizeof( long );
|
||||
m_size = *(int *) (*stream + *streamPos);
|
||||
*streamPos += sizeof( int );
|
||||
m_data = ICARUS_Malloc( m_size );
|
||||
memcpy( m_data, (*stream + *streamPos), m_size );
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ long CBlockStream::GetLong( void )
|
|||
{
|
||||
long data;
|
||||
|
||||
data = *(long *) (m_stream + m_streamPos);
|
||||
data = *(int *) (m_stream + m_streamPos);
|
||||
m_streamPos += sizeof( data );
|
||||
|
||||
return data;
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
void Free( void );
|
||||
|
||||
int WriteMember ( FILE * ); //Writes the member's data, in block format, to FILE *
|
||||
int ReadMember( char **, long * ); //Reads the member's data, in block format, from FILE *
|
||||
int ReadMember( char **, int * ); //Reads the member's data, in block format, from FILE *
|
||||
|
||||
void SetID( int id ) { m_id = id; } //Set the ID member variable
|
||||
void SetSize( int size ) { m_size = size; } //Set the size member variable
|
||||
|
@ -181,7 +181,7 @@ protected:
|
|||
char m_fileName[MAX_FILENAME_LENGTH]; //Name of the current file
|
||||
|
||||
char *m_stream; //Stream of data to be parsed
|
||||
long m_streamPos;
|
||||
int m_streamPos;
|
||||
};
|
||||
|
||||
#endif //__INTERPRETED_BLOCK_STREAM__
|
|
@ -250,7 +250,7 @@ winding_t *CopyWinding (winding_t *w)
|
|||
winding_t *c;
|
||||
|
||||
c = AllocWinding (w->numpoints);
|
||||
size = (int)((winding_t *)0)->p[w->numpoints];
|
||||
size = (size_t)((winding_t *)0)->p[w->numpoints];
|
||||
memcpy (c, w, size);
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -1948,7 +1948,7 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
|
|||
sorted[i] = pakfiles[i];
|
||||
}
|
||||
|
||||
qsort( sorted, numfiles, 4, paksort );
|
||||
qsort( sorted, numfiles, sizeof(char *), paksort );
|
||||
|
||||
for ( i = 0 ; i < numfiles ; i++ ) {
|
||||
pakfile = FS_BuildOSPath( path, dir, sorted[i] );
|
||||
|
|
|
@ -9,7 +9,7 @@ typedef unsigned char *POINTER;
|
|||
typedef unsigned short int UINT2;
|
||||
|
||||
/* UINT4 defines a four byte word */
|
||||
typedef unsigned long int UINT4;
|
||||
typedef unsigned int UINT4;
|
||||
|
||||
|
||||
/* MD4.H - header file for MD4C.C */
|
||||
|
|
|
@ -13,9 +13,9 @@ public:
|
|||
// reset the heap back to the start
|
||||
void ResetHeap()
|
||||
{
|
||||
if ((int)mCurrentHeap - (int)mHeap>mMaxAlloc)
|
||||
if ((size_t)mCurrentHeap - (size_t)mHeap>mMaxAlloc)
|
||||
{
|
||||
mMaxAlloc=(int)mCurrentHeap - (int)mHeap;
|
||||
mMaxAlloc=(size_t)mCurrentHeap - (size_t)mHeap;
|
||||
}
|
||||
mCurrentHeap = mHeap;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ CMiniHeap(int size)
|
|||
// give me some space from the heap please
|
||||
char *MiniHeapAlloc(int size)
|
||||
{
|
||||
if (size < (mSize - ((int)mCurrentHeap - (int)mHeap)))
|
||||
if (size < (mSize - ((size_t)mCurrentHeap - (size_t)mHeap)))
|
||||
{
|
||||
char *tempAddress = mCurrentHeap;
|
||||
mCurrentHeap += size;
|
||||
|
|
|
@ -398,20 +398,22 @@ int MSG_ReadDelta( msg_t *msg, int oldV, int bits ) {
|
|||
}
|
||||
|
||||
void MSG_WriteDeltaFloat( msg_t *msg, float oldV, float newV ) {
|
||||
floatint_t fi;
|
||||
if ( oldV == newV ) {
|
||||
MSG_WriteBits( msg, 0, 1 );
|
||||
return;
|
||||
}
|
||||
fi.f = newV;
|
||||
MSG_WriteBits( msg, 1, 1 );
|
||||
MSG_WriteBits( msg, *(int *)&newV, 32 );
|
||||
MSG_WriteBits( msg, fi.i, 32 );
|
||||
}
|
||||
|
||||
float MSG_ReadDeltaFloat( msg_t *msg, float oldV ) {
|
||||
if ( MSG_ReadBits( msg, 1 ) ) {
|
||||
float newV;
|
||||
floatint_t fi;
|
||||
|
||||
*(int *)&newV = MSG_ReadBits( msg, 32 );
|
||||
return newV;
|
||||
fi.i = MSG_ReadBits(msg, 32);
|
||||
return fi.f;
|
||||
}
|
||||
return oldV;
|
||||
}
|
||||
|
@ -485,7 +487,7 @@ typedef struct {
|
|||
} netField_t;
|
||||
|
||||
// using the stringizing operator to save typing...
|
||||
#define NETF(x) #x,(int)&((entityState_t*)0)->x
|
||||
#define NETF(x) #x,(size_t)&((entityState_t*)0)->x
|
||||
|
||||
const netField_t entityStateFields[] =
|
||||
{
|
||||
|
@ -887,7 +889,7 @@ plyer_state_t communication
|
|||
*/
|
||||
|
||||
// using the stringizing operator to save typing...
|
||||
#define PSF(x) #x,(int)&((playerState_t*)0)->x
|
||||
#define PSF(x) #x,(size_t)&((playerState_t*)0)->x
|
||||
|
||||
static const netField_t playerStateFields[] =
|
||||
{
|
||||
|
|
|
@ -192,7 +192,7 @@ typedef struct {
|
|||
int parentIndex; // this points to the index in the file of the parent surface. -1 if null/root
|
||||
int numChildren; // number of surfaces which are children of this one
|
||||
int childIndexes[1]; // [mdxmSurfHierarch_t->numChildren] (variable sized)
|
||||
} mdxmSurfHierarchy_t; // struct size = (int)( &((mdxmSurfHierarch_t *)0)->childIndexes[ mdxmSurfHierarch_t->numChildren ] );
|
||||
} mdxmSurfHierarchy_t; // struct size = (size_t)( &((mdxmSurfHierarch_t *)0)->childIndexes[ mdxmSurfHierarch_t->numChildren ] );
|
||||
// }
|
||||
|
||||
|
||||
|
@ -382,7 +382,7 @@ typedef struct {
|
|||
mdxaBone_t BasePoseMatInv; // inverse, to save run-time calc
|
||||
int numChildren; // number of children bones
|
||||
int children[1]; // [mdxaSkel_t->numChildren] (variable sized)
|
||||
} mdxaSkel_t; // struct size = (int)( &((mdxaSkel_t *)0)->children[ mdxaSkel_t->numChildren ] );
|
||||
} mdxaSkel_t; // struct size = (size_t)( &((mdxaSkel_t *)0)->children[ mdxaSkel_t->numChildren ] );
|
||||
// }
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static int R_ACullModel( md4Header_t *header, trRefEntity_t *ent ) {
|
|||
|
||||
if (header->ofsFrames<0) // Compressed
|
||||
{
|
||||
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
frameSize = (size_t)( &((md4CompFrame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
newFrame = (md4Frame_t *)((byte *)header - header->ofsFrames + ent->e.frame * frameSize );
|
||||
oldFrame = (md4Frame_t *)((byte *)header - header->ofsFrames + ent->e.oldframe * frameSize );
|
||||
// HACK! These frames actually are md4CompFrames, but the first fields are the same,
|
||||
|
@ -41,7 +41,7 @@ static int R_ACullModel( md4Header_t *header, trRefEntity_t *ent ) {
|
|||
}
|
||||
else
|
||||
{
|
||||
frameSize = (int)( &((md4Frame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
newFrame = (md4Frame_t *)((byte *)header + header->ofsFrames + ent->e.frame * frameSize );
|
||||
oldFrame = (md4Frame_t *)((byte *)header + header->ofsFrames + ent->e.oldframe * frameSize );
|
||||
}
|
||||
|
@ -139,14 +139,14 @@ static int R_AComputeFogNum( md4Header_t *header, trRefEntity_t *ent ) {
|
|||
|
||||
if (header->ofsFrames<0) // Compressed
|
||||
{
|
||||
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ header->numBones ] );
|
||||
frameSize = (size_t)( &((md4CompFrame_t *)0)->bones[ header->numBones ] );
|
||||
frame = (md4Frame_t *)((byte *)header - header->ofsFrames + ent->e.frame * frameSize );
|
||||
// HACK! These frames actually are md4CompFrames, but the first fields are the same,
|
||||
// so this will work for this routine.
|
||||
}
|
||||
else
|
||||
{
|
||||
frameSize = (int)( &((md4Frame_t *)0)->bones[ header->numBones ] );
|
||||
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ header->numBones ] );
|
||||
frame = (md4Frame_t *)((byte *)header + header->ofsFrames + ent->e.frame * frameSize );
|
||||
}
|
||||
|
||||
|
@ -377,14 +377,14 @@ void RB_SurfaceAnim( md4Surface_t *surface ) {
|
|||
if (header->ofsFrames<0) // Compressed
|
||||
{
|
||||
compressed = qtrue;
|
||||
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ header->numBones ] );
|
||||
frameSize = (size_t)( &((md4CompFrame_t *)0)->bones[ header->numBones ] );
|
||||
cframe = (md4CompFrame_t *)((byte *)header - header->ofsFrames + backEnd.currentEntity->e.frame * frameSize );
|
||||
coldFrame = (md4CompFrame_t *)((byte *)header - header->ofsFrames + backEnd.currentEntity->e.oldframe * frameSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
compressed = qfalse;
|
||||
frameSize = (int)( &((md4Frame_t *)0)->bones[ header->numBones ] );
|
||||
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ header->numBones ] );
|
||||
frame = (md4Frame_t *)((byte *)header + header->ofsFrames +
|
||||
backEnd.currentEntity->e.frame * frameSize );
|
||||
oldFrame = (md4Frame_t *)((byte *)header + header->ofsFrames +
|
||||
|
|
|
@ -349,7 +349,7 @@ static void ParseFace( dsurface_t *ds, mapVert_t *verts, msurface_t *surf, int *
|
|||
srfSurfaceFace_t *cv;
|
||||
int numPoints, numIndexes;
|
||||
int lightmapNum[MAXLIGHTMAPS];
|
||||
int sfaceSize, ofsIndexes;
|
||||
size_t sfaceSize, ofsIndexes;
|
||||
|
||||
for(i=0;i<MAXLIGHTMAPS;i++)
|
||||
{
|
||||
|
@ -373,7 +373,7 @@ static void ParseFace( dsurface_t *ds, mapVert_t *verts, msurface_t *surf, int *
|
|||
numIndexes = LittleLong( ds->numIndexes );
|
||||
|
||||
// create the srfSurfaceFace_t
|
||||
sfaceSize = ( int ) &((srfSurfaceFace_t *)0)->points[numPoints];
|
||||
sfaceSize = ( size_t ) &((srfSurfaceFace_t *)0)->points[numPoints];
|
||||
ofsIndexes = sfaceSize;
|
||||
sfaceSize += sizeof( int ) * numIndexes;
|
||||
|
||||
|
@ -639,7 +639,7 @@ static void R_LoadSurfaces( lump_t *surfs, lump_t *verts, lump_t *indexLump ) {
|
|||
{
|
||||
case MST_PLANAR:
|
||||
|
||||
int sfaceSize = ( int ) &((srfSurfaceFace_t *)0)->points[LittleLong(in->numVerts)];
|
||||
int sfaceSize = ( size_t ) &((srfSurfaceFace_t *)0)->points[LittleLong(in->numVerts)];
|
||||
sfaceSize += sizeof( int ) * LittleLong(in->numIndexes);
|
||||
|
||||
iFaceDataSizeRequired += sfaceSize;
|
||||
|
|
|
@ -340,15 +340,15 @@ byte* RE_TempRawImage_ReadFromFile(const char *psLocalFilename, int *piWidth, in
|
|||
|
||||
if (pbReturn && qbVertFlip)
|
||||
{
|
||||
unsigned long *pSrcLine = (unsigned long *) pbReturn;
|
||||
unsigned long *pDstLine = (unsigned long *) pbReturn + (*piHeight * *piWidth ); // *4 done by compiler (longs)
|
||||
unsigned int *pSrcLine = (unsigned int *) pbReturn;
|
||||
unsigned int *pDstLine = (unsigned int *) pbReturn + (*piHeight * *piWidth ); // *4 done by compiler (ints)
|
||||
pDstLine-= *piWidth; // point at start of last line, not first after buffer
|
||||
|
||||
for (int iLineCount=0; iLineCount<*piHeight/2; iLineCount++)
|
||||
{
|
||||
for (int x=0; x<*piWidth; x++)
|
||||
{
|
||||
unsigned long l = pSrcLine[x];
|
||||
unsigned int l = pSrcLine[x];
|
||||
pSrcLine[x] = pDstLine[x];
|
||||
pDstLine[x] = l;
|
||||
}
|
||||
|
|
|
@ -1199,7 +1199,7 @@ void G2_TransformGhoulBones(boneInfo_v &rootBoneList,mdxaBone_t &rootMatrix, CGh
|
|||
}
|
||||
ghoul2.mBoneCache->mCurrentTouch++;
|
||||
ghoul2.mBoneCache->mWraithID=0;
|
||||
ghoul2.mBoneCache->frameSize = 0;// can be deleted in new G2 format //(int)( &((mdxaFrame_t *)0)->boneIndexes[ ghoul2.aHeader->numBones ] );
|
||||
ghoul2.mBoneCache->frameSize = 0;// can be deleted in new G2 format //(size_t)( &((mdxaFrame_t *)0)->boneIndexes[ ghoul2.aHeader->numBones ] );
|
||||
|
||||
ghoul2.mBoneCache->rootBoneList=&rootBoneList;
|
||||
ghoul2.mBoneCache->rootMatrix=rootMatrix;
|
||||
|
@ -2214,7 +2214,7 @@ qboolean R_LoadAndPatchMDXM( model_t *mod, void *buffer, const char *mod_name, q
|
|||
}
|
||||
|
||||
// find the next surface
|
||||
surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surfInfo->numChildren ] ));
|
||||
surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + (size_t)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surfInfo->numChildren ] ));
|
||||
}
|
||||
|
||||
tempPtr += mdxm->ofsLODs;
|
||||
|
@ -2422,7 +2422,7 @@ qboolean R_LoadAndPatchMDXM( model_t *mod, void *buffer, const char *mod_name, q
|
|||
RE_RegisterModels_StoreShaderRequest(mod_name, &surfInfo->shader[0], &surfInfo->shaderIndex);
|
||||
|
||||
// find the next surface
|
||||
surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surfInfo->numChildren ] ));
|
||||
surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + (size_t)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surfInfo->numChildren ] ));
|
||||
}
|
||||
|
||||
return qtrue;
|
||||
|
@ -2555,7 +2555,7 @@ qboolean R_LoadMDXM( model_t *mod, void *buffer, const char *mod_name, qboolean
|
|||
RE_RegisterModels_StoreShaderRequest(mod_name, &surfInfo->shader[0], &surfInfo->shaderIndex);
|
||||
|
||||
// find the next surface
|
||||
surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surfInfo->numChildren ] ));
|
||||
surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + (size_t)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surfInfo->numChildren ] ));
|
||||
}
|
||||
|
||||
#if _DEBUG
|
||||
|
@ -2757,12 +2757,12 @@ qboolean R_LoadMDXA( model_t *mod, void *buffer, const char *mod_name, qboolean
|
|||
}
|
||||
|
||||
// get next bone
|
||||
boneInfo += (int)( &((mdxaSkel_t *)0)->children[ boneInfo->numChildren ] );
|
||||
boneInfo += (size_t)( &((mdxaSkel_t *)0)->children[ boneInfo->numChildren ] );
|
||||
}
|
||||
|
||||
|
||||
// swap all the frames
|
||||
frameSize = (int)( &((mdxaFrame_t *)0)->bones[ mdxa->numBones ] );
|
||||
frameSize = (size_t)( &((mdxaFrame_t *)0)->bones[ mdxa->numBones ] );
|
||||
for ( i = 0 ; i < mdxa->numFrames ; i++)
|
||||
{
|
||||
cframe = (mdxaFrame_t *) ( (byte *)mdxa + mdxa->ofsFrames + i * frameSize );
|
||||
|
|
|
@ -1181,8 +1181,8 @@ void R_Init( void ) {
|
|||
Swap_Init();
|
||||
|
||||
#ifndef FINAL_BUILD
|
||||
if ( (int)tess.xyz & 15 ) {
|
||||
Com_Printf( "WARNING: tess.xyz not 16 byte aligned (%x)\n",(int)tess.xyz & 15 );
|
||||
if ( (intptr_t)tess.xyz & 15 ) {
|
||||
Com_Printf( "WARNING: tess.xyz not 16 byte aligned (%x)\n",(intptr_t)tess.xyz & 15 );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1079,7 +1079,14 @@ qsort replacement
|
|||
|
||||
=================
|
||||
*/
|
||||
#define SWAP_DRAW_SURF(a,b) temp=((int *)a)[0];((int *)a)[0]=((int *)b)[0];((int *)b)[0]=temp; temp=((int *)a)[1];((int *)a)[1]=((int *)b)[1];((int *)b)[1]=temp;
|
||||
|
||||
static inline void SWAP_DRAW_SURF(drawSurf_t* a, drawSurf_t* b)
|
||||
{
|
||||
drawSurf_t t;
|
||||
memcpy(&t, a, sizeof(t));
|
||||
memcpy(a, b, sizeof(t));
|
||||
memcpy(b, &t, sizeof(t));
|
||||
}
|
||||
|
||||
/* this parameter defines the cutoff between using quick sort and
|
||||
insertion sort for arrays; arrays with lengths shorter or equal to the
|
||||
|
@ -1122,9 +1129,11 @@ void qsortFast (
|
|||
int stkptr; /* stack for saving sub-array to be processed */
|
||||
int temp;
|
||||
|
||||
#if 0
|
||||
if ( sizeof(drawSurf_t) != 8 ) {
|
||||
ri.Error( ERR_DROP, "change SWAP_DRAW_SURF macro" );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Note: the number of stack entries required is no more than
|
||||
1 + log2(size), so 30 is sufficient for any array */
|
||||
|
@ -1159,7 +1168,7 @@ recurse:
|
|||
performance. */
|
||||
|
||||
mid = lo + (size / 2) * width; /* find middle element */
|
||||
SWAP_DRAW_SURF(mid, lo); /* swap it to beginning of array */
|
||||
SWAP_DRAW_SURF((drawSurf_t *)mid, (drawSurf_t *)lo); /* swap it to beginning of array */
|
||||
|
||||
/* We now wish to partition the array into three pieces, one
|
||||
consisiting of elements <= partition element, one of elements
|
||||
|
@ -1200,7 +1209,7 @@ recurse:
|
|||
A[loguy] > A[lo], A[higuy] < A[lo],
|
||||
loguy < hi, highy > lo */
|
||||
|
||||
SWAP_DRAW_SURF(loguy, higuy);
|
||||
SWAP_DRAW_SURF((drawSurf_t *)loguy, (drawSurf_t *)higuy);
|
||||
|
||||
/* A[loguy] < A[lo], A[higuy] > A[lo]; so condition at top
|
||||
of loop is re-established */
|
||||
|
@ -1214,7 +1223,7 @@ recurse:
|
|||
A[i] <= A[lo] for lo <= i <= higuy,
|
||||
A[i] = A[lo] for higuy < i < loguy */
|
||||
|
||||
SWAP_DRAW_SURF(lo, higuy); /* put partition element in place */
|
||||
SWAP_DRAW_SURF((drawSurf_t *)lo, (drawSurf_t *)higuy); /* put partition element in place */
|
||||
|
||||
/* OK, now we have the following:
|
||||
A[i] >= A[higuy] for loguy <= i <= hi,
|
||||
|
|
|
@ -174,14 +174,14 @@ int R_ComputeLOD( trRefEntity_t *ent ) {
|
|||
if (tr.currentModel->md4->ofsFrames<0) // Compressed
|
||||
{
|
||||
md4CompFrame_t *frame;
|
||||
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
frameSize = (size_t)( &((md4CompFrame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
frame = (md4CompFrame_t *)((byte *)tr.currentModel->md4 - tr.currentModel->md4->ofsFrames + ent->e.frame * frameSize );
|
||||
radius = RadiusFromBounds( frame->bounds[0], frame->bounds[1] );
|
||||
}
|
||||
else
|
||||
{
|
||||
md4Frame_t *frame;
|
||||
frameSize = (int)( &((md4Frame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ tr.currentModel->md4->numBones ] );
|
||||
frame = (md4Frame_t *)((byte *)tr.currentModel->md4 + tr.currentModel->md4->ofsFrames + ent->e.frame * frameSize );
|
||||
radius = RadiusFromBounds( frame->bounds[0], frame->bounds[1] );
|
||||
}
|
||||
|
|
|
@ -1097,7 +1097,7 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name, qbo
|
|||
if (md4->ofsFrames<0) // Compressed .
|
||||
{
|
||||
// swap all the frames
|
||||
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ md4->numBones ] );
|
||||
frameSize = (size_t)( &((md4CompFrame_t *)0)->bones[ md4->numBones ] );
|
||||
for ( i = 0 ; i < md4->numFrames ; i++) {
|
||||
cframe = (md4CompFrame_t *) ( (byte *)md4 - md4->ofsFrames + i * frameSize );
|
||||
cframe->radius = LittleFloat( cframe->radius );
|
||||
|
@ -1114,7 +1114,7 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name, qbo
|
|||
else
|
||||
{
|
||||
// swap all the frames
|
||||
frameSize = (int)( &((md4Frame_t *)0)->bones[ md4->numBones ] );
|
||||
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ md4->numBones ] );
|
||||
for ( i = 0 ; i < md4->numFrames ; i++) {
|
||||
frame = (md4Frame_t *) ( (byte *)md4 + md4->ofsFrames + i * frameSize );
|
||||
frame->radius = LittleFloat( frame->radius );
|
||||
|
@ -1392,7 +1392,7 @@ static void R_GetAnimTag( md4Header_t *mod, int framenum, const char *tagName ,m
|
|||
{
|
||||
if (mod->ofsFrames<0) //compressed model
|
||||
{
|
||||
frameSize = (int)( &((md4CompFrame_t *)0)->bones[ mod->numBones ] );
|
||||
frameSize = (size_t)( &((md4CompFrame_t *)0)->bones[ mod->numBones ] );
|
||||
cframe = (md4CompFrame_t *)((byte *)mod - mod->ofsFrames + framenum * frameSize );
|
||||
MC_UnCompress(tbone.matrix,cframe->bones[tag->boneIndex].Comp);
|
||||
{
|
||||
|
@ -1409,7 +1409,7 @@ static void R_GetAnimTag( md4Header_t *mod, int framenum, const char *tagName ,m
|
|||
}
|
||||
else
|
||||
{
|
||||
frameSize = (int)( &((md4Frame_t *)0)->bones[ mod->numBones ] );
|
||||
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ mod->numBones ] );
|
||||
frame = (md4Frame_t *)((byte *)mod + mod->ofsFrames + framenum * frameSize );
|
||||
{
|
||||
int j,k;
|
||||
|
|
|
@ -213,7 +213,9 @@ This is the only way control passes into the module.
|
|||
This must be the very first function compiled into the .qvm file
|
||||
================
|
||||
*/
|
||||
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 )
|
||||
intptr_t vmMain( intptr_t command, intptr_t arg0, intptr_t arg1, intptr_t arg2,
|
||||
intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6, intptr_t arg7,
|
||||
intptr_t arg8, intptr_t arg9, intptr_t arg10, intptr_t arg11 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -949,7 +951,7 @@ void _UI_Init( qboolean inGameLoad )
|
|||
Menus_CloseAll();
|
||||
|
||||
// sets defaults for ui temp cvars
|
||||
uiInfo.effectsColor = (int)trap_Cvar_VariableValue("color")-1;
|
||||
uiInfo.effectsColor = gamecodetoui[(int)trap_Cvar_VariableValue("color")-1];
|
||||
if (uiInfo.effectsColor < 0)
|
||||
{
|
||||
uiInfo.effectsColor = 0;
|
||||
|
|
|
@ -13,27 +13,27 @@
|
|||
// this file is only included when building a dll
|
||||
// syscalls.asm is included instead when building a qvm
|
||||
|
||||
int (*qsyscall)( int arg, ... ) = (int (*)( int, ...))-1;
|
||||
intptr_t (*qsyscall)( intptr_t arg, ... ) = (intptr_t (*)( intptr_t, ...))-1;
|
||||
|
||||
extern "C" {
|
||||
void dllEntry( int (*syscallptr)( int arg,... ) ) {
|
||||
void dllEntry( intptr_t (*syscallptr)( intptr_t arg,... ) ) {
|
||||
qsyscall = syscallptr;
|
||||
// CG_PreInit();
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
|
||||
int CL_UISystemCalls( int *args );
|
||||
intptr_t CL_UISystemCalls( intptr_t *args );
|
||||
|
||||
|
||||
int FloatAsInt( float f );
|
||||
|
||||
float trap_Cvar_VariableValue( const char *var_name )
|
||||
{
|
||||
int temp;
|
||||
// temp = qsyscall( UI_CVAR_VARIABLEVALUE, var_name );
|
||||
temp = FloatAsInt( Cvar_VariableValue(var_name) );
|
||||
return (*(float*)&temp);
|
||||
floatint_t fi;
|
||||
// fi.i = qsyscall( UI_CVAR_VARIABLEVALUE, var_name );
|
||||
fi.i = FloatAsInt( Cvar_VariableValue(var_name) );
|
||||
return fi.f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,7 +167,7 @@ int trap_CIN_StopCinematic(int handle)
|
|||
|
||||
int PASSFLOAT( float x )
|
||||
{
|
||||
float floatTemp;
|
||||
floatTemp = x;
|
||||
return *(int *)&floatTemp;
|
||||
floatint_t fi;
|
||||
fi.f = x;
|
||||
return fi.i;
|
||||
}
|
||||
|
|
|
@ -318,12 +318,12 @@ void *Sys_GetGameAPI (void *parms)
|
|||
return GetGameAPI (parms);
|
||||
}
|
||||
|
||||
void * Sys_LoadCgame( int (**entryPoint)(int, ...), int (*systemcalls)(int, ...) )
|
||||
void * Sys_LoadCgame( intptr_t (**entryPoint)(intptr_t, ...), intptr_t (*systemcalls)(intptr_t, ...) )
|
||||
{
|
||||
void (*dllEntry)( int (*syscallptr)(int, ...) );
|
||||
void (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
|
||||
|
||||
dllEntry = ( void (*)( int (*)( int, ... ) ) )dlsym( game_library, "dllEntry" );
|
||||
*entryPoint = (int (*)(int,...))dlsym( game_library, "vmMain" );
|
||||
dllEntry = ( void (*)( intptr_t (*)( intptr_t, ... ) ) )dlsym( game_library, "dllEntry" );
|
||||
*entryPoint = (intptr_t (*)(intptr_t,...))dlsym( game_library, "vmMain" );
|
||||
if ( !*entryPoint || !dllEntry ) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue