From 9095a4911d2e54eabb7879d38f214b3879245461 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 10 Jan 2009 07:38:50 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@1206 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 50 +- polymer/eduke32/build/include/mdsprite.h | 148 ++-- polymer/eduke32/build/include/mmulti.h | 9 +- .../eduke32/build/include/mmulti_unstable.h | 9 +- polymer/eduke32/build/include/polymer.h | 2 +- polymer/eduke32/build/include/polymost.h | 2 +- polymer/eduke32/build/include/pragmas.h | 2 +- polymer/eduke32/build/src/build.c | 2 +- polymer/eduke32/build/src/compat.c | 2 +- polymer/eduke32/build/src/engine.c | 64 +- polymer/eduke32/build/src/engine_priv.h | 70 +- polymer/eduke32/build/src/gtkbits.c | 4 +- polymer/eduke32/build/src/kplib.c | 18 +- polymer/eduke32/build/src/lzwnew.c | 1 + polymer/eduke32/build/src/mdsprite.c | 136 ++-- polymer/eduke32/build/src/mmulti.c | 9 +- polymer/eduke32/build/src/mmulti_null.c | 12 +- polymer/eduke32/build/src/mmulti_unstable.c | 50 +- polymer/eduke32/build/src/osd.c | 14 +- polymer/eduke32/build/src/polymer.c | 14 +- polymer/eduke32/build/src/polymost.c | 24 +- polymer/eduke32/build/src/sdlayer.c | 10 +- polymer/eduke32/build/src/winlayer.c | 34 +- polymer/eduke32/eduke32.vcproj | 16 +- polymer/eduke32/source/actors.c | 2 +- polymer/eduke32/source/config.c | 38 +- polymer/eduke32/source/duke3d.h | 56 +- polymer/eduke32/source/funct.h | 4 +- polymer/eduke32/source/game.c | 199 +++--- polymer/eduke32/source/gamedef.c | 653 +++++++++--------- polymer/eduke32/source/gameexec.c | 6 +- polymer/eduke32/source/gamevars.c | 26 +- polymer/eduke32/source/jaudiolib/dsoundout.c | 3 +- polymer/eduke32/source/jaudiolib/sdlmusic.c | 3 +- polymer/eduke32/source/jmact/control.c | 32 +- polymer/eduke32/source/jmact/control.h | 2 +- polymer/eduke32/source/jmact/keyboard.h | 2 +- polymer/eduke32/source/mapster32.h | 16 +- polymer/eduke32/source/menus.c | 12 +- polymer/eduke32/source/namesdyn.c | 10 +- polymer/eduke32/source/osdcmds.c | 126 ++-- polymer/eduke32/source/osdcmds.h | 4 +- polymer/eduke32/source/premap.c | 6 +- polymer/eduke32/source/savegame.c | 4 +- polymer/eduke32/source/sector.c | 15 +- polymer/eduke32/source/wrapper.c | 4 +- 46 files changed, 941 insertions(+), 984 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index d7a3a9240..ef67c2b96 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -100,11 +100,11 @@ typedef struct BPACK int16_t ceilingstat, floorstat; int16_t ceilingpicnum, ceilingheinum; int8_t ceilingshade; - char ceilingpal, ceilingxpanning, ceilingypanning; + uint8_t ceilingpal, ceilingxpanning, ceilingypanning; int16_t floorpicnum, floorheinum; int8_t floorshade; - char floorpal, floorxpanning, floorypanning; - char visibility, filler; + uint8_t floorpal, floorxpanning, floorypanning; + uint8_t visibility, filler; int16_t lotag, hitag, extra; } sectortype; @@ -128,7 +128,7 @@ typedef struct BPACK int16_t point2, nextwall, nextsector, cstat; int16_t picnum, overpicnum; int8_t shade; - char pal, xrepeat, yrepeat, xpanning, ypanning; + uint8_t pal, xrepeat, yrepeat, xpanning, ypanning; int16_t lotag, hitag, extra; } walltype; @@ -153,8 +153,8 @@ typedef struct BPACK int32_t x, y, z; int16_t cstat, picnum; int8_t shade; - char pal, clipdist, filler; - char xrepeat, yrepeat; + uint8_t pal, clipdist, filler; + uint8_t xrepeat, yrepeat; int8_t xoffset, yoffset; int16_t sectnum, statnum; int16_t ang, owner, xvel, yvel, zvel; @@ -167,18 +167,18 @@ typedef struct BPACK { int16_t angoff; int16_t pitch, roll; int32_t xoff, yoff, zoff; - char flags; - char xpanning, ypanning; - char filler[1]; + uint8_t flags; + uint8_t xpanning, ypanning; + uint8_t filler[1]; spritetype *tspr; -} spriteexttype; +} spriteext_t; typedef struct BPACK { float smoothduration; int16_t mdcurframe, mdoldframe; int16_t mdsmooth; - char filler[2]; -} spritesmoothtype; + uint8_t filler[2]; +} spritesmooth_t; #define SPREXT_NOTMD 1 #define SPREXT_NOMDANIM 2 @@ -186,8 +186,8 @@ typedef struct BPACK { #define SPREXT_AWAY2 8 #define SPREXT_TSPRACCESS 16 -EXTERN spriteexttype *spriteext; -EXTERN spritesmoothtype *spritesmooth; +EXTERN spriteext_t *spriteext; +EXTERN spritesmooth_t *spritesmooth; EXTERN int32_t guniqhudid; EXTERN sectortype *sector; @@ -220,7 +220,7 @@ EXTERN char display_mirror; EXTERN /*volatile*/ int32_t totalclock; EXTERN int32_t numframes, randomseed; EXTERN int16_t sintable[2048]; -EXTERN char palette[768]; +EXTERN uint8_t palette[768]; EXTERN int16_t numpalookups; EXTERN char *palookup[MAXPALOOKUPS]; EXTERN char parallaxtype, showinvisibility; @@ -416,7 +416,7 @@ int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz); void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2); void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat); void setvgapalette(void); -void setbrightness(char dabrightness, char *dapal, char noapply); +void setbrightness(char dabrightness, uint8_t *dapal, char noapply); void setpalettefade(char r, char g, char b, char offset); void squarerotatetile(int16_t tilenume); @@ -600,20 +600,20 @@ typedef struct _hashitem // size is 12/24 bits. char *string; int32_t key; struct _hashitem *next; -} HASH_item; +} hashitem_t; typedef struct { int32_t size; - HASH_item **items; -} HASH_table; + hashitem_t **items; +} hashtable_t; -void HASH_init(HASH_table *t); -void HASH_free(HASH_table *t); -int32_t HASH_findcase(HASH_table *t, const char *s); -int32_t HASH_find(HASH_table *t, const char *s); -void HASH_replace(HASH_table *t, const char *s, int32_t key); -void HASH_add(HASH_table *t, const char *s, int32_t key); +void hash_init(hashtable_t *t); +void hash_free(hashtable_t *t); +int32_t hash_findcase(hashtable_t *t, const char *s); +int32_t hash_find(hashtable_t *t, const char *s); +void hash_replace(hashtable_t *t, const char *s, int32_t key); +void hash_add(hashtable_t *t, const char *s, int32_t key); #ifdef _MSC_VER #pragma pack() diff --git a/polymer/eduke32/build/include/mdsprite.h b/polymer/eduke32/build/include/mdsprite.h index b43ca9248..b27c3dd15 100644 --- a/polymer/eduke32/build/include/mdsprite.h +++ b/polymer/eduke32/build/include/mdsprite.h @@ -9,17 +9,17 @@ typedef struct { - int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! - int shadeoff; + int32_t mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! + int32_t shadeoff; float scale, bscale, zadd; GLuint *texid; // skins - int flags; -} mdmodel; + int32_t flags; +} mdmodel_t; typedef struct _mdanim_t { - int startframe, endframe; - int fpssc, flags; + int32_t startframe, endframe; + int32_t fpssc, flags; struct _mdanim_t *next; } mdanim_t; #define MDANIM_LOOP 0 @@ -28,12 +28,12 @@ typedef struct _mdanim_t typedef struct _mdskinmap_t { unsigned char palette, filler[3]; // Build palette number - int skinnum, surfnum; // Skin identifier, surface number + int32_t skinnum, surfnum; // Skin identifier, surface number char *fn; // Skin filename GLuint texid[HICEFFECTMASK+1]; // OpenGL texture numbers for effect variations struct _mdskinmap_t *next; float param; - char *palmap;int size; + char *palmap;int32_t size; } mdskinmap_t; @@ -46,9 +46,9 @@ typedef struct { float x, y, z; } point3d; typedef struct { - int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8 - int numskins, numverts, numuv, numtris, numglcmds, numframes; - int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each) + int32_t id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8 + int32_t numskins, numverts, numuv, numtris, numglcmds, numframes; + int32_t ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each) } md2head_t; typedef struct { unsigned char v[3], ni; } md2vert_t; //compressed vertex coords (x,y,z) @@ -59,42 +59,42 @@ typedef struct md2vert_t verts[1]; //first vertex of this frame } md2frame_t; -typedef struct { short u, v; } md2uv_t; +typedef struct { int16_t u, v; } md2uv_t; typedef struct { - unsigned short v[3]; - unsigned short u[3]; + uint16_t v[3]; + uint16_t u[3]; } md2tri_t; typedef struct { //WARNING: This top block is a union between md2model&md3model: Make sure it matches! - int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! - int shadeoff; + int32_t mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! + int32_t shadeoff; float scale, bscale, zadd; GLuint *texid; // texture ids for base skin if no mappings defined - int flags; + int32_t flags; - int numframes, cframe, nframe, fpssc, usesalpha; + int32_t numframes, cframe, nframe, fpssc, usesalpha; float oldtime, curtime, interpol; mdanim_t *animations; mdskinmap_t *skinmap; - int numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified, + int32_t numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified, //MD2 specific stuff: - int numverts, numglcmds, framebytes, *glcmds; + int32_t numverts, numglcmds, framebytes, *glcmds; char *frames; char *basepath; // pointer to string of base path char *skinfn; // pointer to first of numskins 64-char strings md2uv_t *uv; md2tri_t* tris; -} md2model; +} md2model_t; -typedef struct { char nam[64]; int i; } md3shader_t; //ascz path of shader, shader index -typedef struct { int i[3]; } md3tri_t; //indices of tri +typedef struct { char nam[64]; int32_t i; } md3shader_t; //ascz path of shader, shader index +typedef struct { int32_t i[3]; } md3tri_t; //indices of tri typedef struct { float u, v; } md3uv_t; -typedef struct { signed short x, y, z; unsigned char nlat, nlng; } md3xyzn_t; //xyz are [10:6] ints +typedef struct { int16_t x, y, z; unsigned char nlat, nlng; } md3xyzn_t; //xyz are [10:6] ints typedef struct { @@ -111,15 +111,15 @@ typedef struct typedef struct { - int id; //IDP3(0x33806873) + int32_t id; //IDP3(0x33806873) char nam[64]; //ascz surface name - int flags; //? - int numframes, numshaders, numverts, numtris; //numframes same as md3head,max shade=~256,vert=~4096,tri=~8192 - int ofstris; - int ofsshaders; - int ofsuv; - int ofsxyzn; - int ofsend; + int32_t flags; //? + int32_t numframes, numshaders, numverts, numtris; //numframes same as md3head,max shade=~256,vert=~4096,tri=~8192 + int32_t ofstris; + int32_t ofsshaders; + int32_t ofsuv; + int32_t ofsxyzn; + int32_t ofsend; // DO NOT read directly to this structure // the following block is NOT in the file format // be sure to use the SIZEOF_MD3SURF_T macro @@ -133,14 +133,14 @@ typedef struct typedef struct { - int id, vers; //id=IDP3(0x33806873), vers=15 + int32_t id, vers; //id=IDP3(0x33806873), vers=15 char nam[64]; //ascz path in PK3 - int flags; //? - int numframes, numtags, numsurfs, numskins; //max=~1024,~16,~32,numskins=artifact of MD2; use shader field instead - int ofsframes; - int ofstags; - int ofssurfs; - int eof; + int32_t flags; //? + int32_t numframes, numtags, numsurfs, numskins; //max=~1024,~16,~32,numskins=artifact of MD2; use shader field instead + int32_t ofsframes; + int32_t ofstags; + int32_t ofssurfs; + int32_t eof; // DO NOT read directly to this structure // the following block is NOT in the file format // be sure to use the SIZEOF_MD3HEAD_T macro @@ -154,90 +154,90 @@ typedef struct typedef struct { //WARNING: This top block is a union between md2model&md3model: Make sure it matches! - int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! - int shadeoff; + int32_t mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! + int32_t shadeoff; float scale, bscale, zadd; - unsigned int *texid; // texture ids for base skin if no mappings defined - int flags; + uint32_t *texid; // texture ids for base skin if no mappings defined + int32_t flags; - int numframes, cframe, nframe, fpssc, usesalpha; + int32_t numframes, cframe, nframe, fpssc, usesalpha; float oldtime, curtime, interpol; mdanim_t *animations; mdskinmap_t *skinmap; - int numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified, + int32_t numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified, //MD3 specific md3head_t head; point3d *muladdframes; - unsigned short *indexes; - unsigned short *vindexes; + uint16_t *indexes; + uint16_t *vindexes; float *maxdepths; GLuint* vbos; // polymer VBO names after that, allocated per surface GLuint* indices; GLuint* texcoords; GLuint* geometry; -} md3model; +} md3model_t; #define VOXBORDWIDTH 1 //use 0 to save memory, but has texture artifacts; 1 looks better... #define VOXUSECHAR 0 #if (VOXUSECHAR != 0) typedef struct { unsigned char x, y, z, u, v; } vert_t; #else -typedef struct { unsigned short x, y, z, u, v; } vert_t; +typedef struct { uint16_t x, y, z, u, v; } vert_t; #endif typedef struct { vert_t v[4]; } voxrect_t; typedef struct { //WARNING: This top block is a union of md2model,md3model,voxmodel: Make sure it matches! - int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! - int shadeoff; + int32_t mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! + int32_t shadeoff; float scale, bscale, zadd; - unsigned int *texid; // skins for palettes - int flags; + uint32_t *texid; // skins for palettes + int32_t flags; //VOX specific stuff: - voxrect_t *quad; int qcnt, qfacind[7]; - int *mytex, mytexx, mytexy; - int xsiz, ysiz, zsiz; + voxrect_t *quad; int32_t qcnt, qfacind[7]; + int32_t *mytex, mytexx, mytexy; + int32_t xsiz, ysiz, zsiz; float xpiv, ypiv, zpiv; - int is8bit; -} voxmodel; + int32_t is8bit; +} voxmodel_t; typedef struct { // maps build tiles to particular animation frames of a model - int modelid; - int skinnum; - int framenum; // calculate the number from the name when declaring + int32_t modelid; + int32_t skinnum; + int32_t framenum; // calculate the number from the name when declaring float smoothduration; - int next; + int32_t next; char pal; } tile2model_t; #define EXTRATILES MAXTILES EXTERN tile2model_t tile2model[MAXTILES+EXTRATILES]; -EXTERN mdmodel **models; +EXTERN mdmodel_t **models; -void updateanimation(md2model *m, spritetype *tspr); -int mdloadskin(md2model *m, int number, int pal, int surf); +void updateanimation(md2model_t *m, spritetype *tspr); +int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf); void mdinit(void); void freeallmodels(void); void clearskins(void); -int mddraw(spritetype *tspr); +int32_t mddraw(spritetype *tspr); -typedef struct { float xadd, yadd, zadd; short angadd, flags; } hudtyp; +typedef struct { float xadd, yadd, zadd; int16_t angadd, flags; } hudtyp; EXTERN hudtyp hudmem[2][MAXTILES]; //~320KB ... ok for now ... could replace with dynamic alloc -EXTERN int mdinited; -EXTERN int mdpause; -EXTERN int nummodelsalloced, nextmodelid; -EXTERN voxmodel *voxmodels[MAXVOXELS]; +EXTERN int32_t mdinited; +EXTERN int32_t mdpause; +EXTERN int32_t nummodelsalloced, nextmodelid; +EXTERN voxmodel_t *voxmodels[MAXVOXELS]; -void voxfree(voxmodel *m); -voxmodel *voxload(const char *filnam); -int voxdraw(voxmodel *m, spritetype *tspr); +void voxfree(voxmodel_t *m); +voxmodel_t *voxload(const char *filnam); +int32_t voxdraw(voxmodel_t *m, spritetype *tspr); #endif // !_mdsprite_h_ diff --git a/polymer/eduke32/build/include/mmulti.h b/polymer/eduke32/build/include/mmulti.h index b17442b09..0103da68b 100644 --- a/polymer/eduke32/build/include/mmulti.h +++ b/polymer/eduke32/build/include/mmulti.h @@ -16,14 +16,13 @@ int32_t initmultiplayerscycle(void); void mmulti_initmultiplayers(int32_t argc, char **argv); void mmulti_setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount); void mmulti_uninitmultiplayers(void); -void sendlogon(void); -void sendlogoff(void); -int32_t getoutputcirclesize(void); -void setsocket(int16_t newsocket); +void mmulti_sendlogon(void); +void mmulti_sendlogoff(void); +int32_t mmulti_getoutputcirclesize(void); void mmulti_sendpacket(int32_t other, char *bufptr, int32_t messleng); int32_t mmulti_getpacket(int32_t *other, char *bufptr); void mmulti_flushpackets(void); -void genericmultifunction(int32_t other, char *bufptr, int32_t messleng, int32_t command); +void mmulti_generic(int32_t other, char *bufptr, int32_t messleng, int32_t command); int32_t isvalidipaddress(char *st); void nfIncCP(void); //Addfaz NatFree diff --git a/polymer/eduke32/build/include/mmulti_unstable.h b/polymer/eduke32/build/include/mmulti_unstable.h index aa6b681af..9a4e5373d 100644 --- a/polymer/eduke32/build/include/mmulti_unstable.h +++ b/polymer/eduke32/build/include/mmulti_unstable.h @@ -10,13 +10,12 @@ void mmulti_initmultiplayers(int32_t argc, char **argv); void mmulti_sendpacket(int32_t other, char *bufptr, int32_t messleng); void mmulti_setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount); void mmulti_uninitmultiplayers(void); -void sendlogon(void); -void sendlogoff(void); -int32_t getoutputcirclesize(void); -void setsocket(int32_t newsocket); +void mmulti_sendlogon(void); +void mmulti_sendlogoff(void); +int32_t mmulti_getoutputcirclesize(void); int32_t mmulti_getpacket(int32_t *other, char *bufptr); void mmulti_flushpackets(void); -void genericmultifunction(int32_t other, char *bufptr, int32_t messleng, int32_t command); +void mmulti_generic(int32_t other, char *bufptr, int32_t messleng, int32_t command); extern int32_t natfree; diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index 4bcd6efe5..12b83ed4e 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -232,7 +232,7 @@ static void polymer_drawartskyquad(int32_t p1, int32_t p2, GLfloat heigh static void polymer_drawskybox(int16_t tilenum); // MDSPRITES static void polymer_drawmdsprite(spritetype *tspr); -static void polymer_loadmodelvbos(md3model* m); +static void polymer_loadmodelvbos(md3model_t* m); // MATERIALS static void polymer_getscratchmaterial(_prmaterial* material); static void polymer_getbuildmaterial(_prmaterial* material, int16_t tilenum, char pal, int8_t shade); diff --git a/polymer/eduke32/build/include/polymost.h b/polymer/eduke32/build/include/polymost.h index 68229655f..1446fafd9 100644 --- a/polymer/eduke32/build/include/polymost.h +++ b/polymer/eduke32/build/include/polymost.h @@ -61,7 +61,7 @@ extern GLuint peelprogram[2]; extern int32_t cachefilehandle; extern FILE *cacheindexptr; -extern HASH_table cacheH; +extern hashtable_t cacheH; struct cacheitem_t { diff --git a/polymer/eduke32/build/include/pragmas.h b/polymer/eduke32/build/include/pragmas.h index 47712a618..ad46f9526 100644 --- a/polymer/eduke32/build/include/pragmas.h +++ b/polymer/eduke32/build/include/pragmas.h @@ -3585,7 +3585,7 @@ static __inline void swapbuf4(void *a, void *b, int32_t c) add eax, 4 add ebx, 4 dec ecx - jnz int16_t begswap + jnz short begswap } } diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index b0d566233..100e528a3 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -762,7 +762,7 @@ void editinput(void) } if (keystatus[0x44]) { - memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES); + memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); memset(spritesmooth, 0, sizeof(spritesmooth)); mhk=0; initprintf("Maphacks disabled\n"); diff --git a/polymer/eduke32/build/src/compat.c b/polymer/eduke32/build/src/compat.c index e003607a8..2b58ca04c 100644 --- a/polymer/eduke32/build/src/compat.c +++ b/polymer/eduke32/build/src/compat.c @@ -25,7 +25,7 @@ #include #include #include -#include +// #include #ifdef __APPLE__ #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index dce3da4e9..1e9f8835f 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -229,10 +229,10 @@ static inline int32_t nsqrtasm(int32_t a) mov eax, a test eax, 0xff000000 mov ebx, eax - jnz int16_t over24 + jnz short over24 shr ebx, 12 mov cx, word ptr shlookup[ebx*2] - jmp int16_t under24 + jmp short under24 over24: shr ebx, 24 mov cx, word ptr shlookup[ebx*2+8192] @@ -332,7 +332,7 @@ beg: ror edx, cl adc eax, edx bswap eax - loop int16_t beg + loop short beg pop ebx } } @@ -5555,8 +5555,8 @@ static int32_t preinitcalled = 0; #define DYNALLOC_ARRAYS #ifndef DYNALLOC_ARRAYS -static spriteexttype spriteext_s[MAXSPRITES+MAXUNIQHUDID]; -static spritesmoothtype spritesmooth_s[MAXSPRITES+MAXUNIQHUDID]; +static spriteext_t spriteext_s[MAXSPRITES+MAXUNIQHUDID]; +static spritesmooth_t spritesmooth_s[MAXSPRITES+MAXUNIQHUDID]; static sectortype sector_s[MAXSECTORS]; static walltype wall_s[MAXWALLS]; static spritetype sprite_s[MAXSPRITES]; @@ -5577,8 +5577,8 @@ int32_t preinitengine(void) wall = Bcalloc(MAXWALLS,sizeof(walltype)); sprite = Bcalloc(MAXSPRITES,sizeof(spritetype)); tsprite = Bcalloc(MAXSPRITESONSCREEN,sizeof(spritetype)); - spriteext = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spriteexttype)); - spritesmooth = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spritesmoothtype)); + spriteext = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spriteext_t)); + spritesmooth = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spritesmooth_t)); if (!sector || !wall || !sprite || !tsprite || !spriteext || !spritesmooth) return 1; @@ -6817,7 +6817,7 @@ int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *dapo kclose(fil); #if defined(POLYMOST) && defined(USE_OPENGL) - memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES); + memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); memset(spritesmooth, 0, sizeof(spritesmooth)); # ifdef POLYMER @@ -7300,7 +7300,7 @@ int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *d kclose(fil); #if defined(POLYMOST) && defined(USE_OPENGL) - memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES); + memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); memset(spritesmooth, 0, sizeof(spritesmooth)); #endif guniqhudid = 0; @@ -7361,7 +7361,7 @@ int32_t loadmaphack(char *filename) script = scriptfile_fromfile(filename); if (!script) return -1; - memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES); + memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); memset(spritesmooth, 0, sizeof(spritesmooth)); while (1) @@ -9952,7 +9952,7 @@ void setvgapalette(void) // // setbrightness // -void setbrightness(char dabrightness, char *dapal, char noapply) +void setbrightness(char dabrightness, uint8_t *dapal, char noapply) { int32_t i, k, j; // uint32_t lastbright = curbrightness; @@ -12129,15 +12129,15 @@ void setpolymost2dview(void) #endif } -void HASH_init(HASH_table *t) +void hash_init(hashtable_t *t) { - HASH_free(t); - t->items=Bcalloc(1, t->size * sizeof(HASH_item)); + hash_free(t); + t->items=Bcalloc(1, t->size * sizeof(hashitem_t)); } -void HASH_free(HASH_table *t) +void hash_free(hashtable_t *t) { - HASH_item *cur, *tmp; + hashitem_t *cur, *tmp; int32_t i; int32_t num; @@ -12192,16 +12192,16 @@ inline uint32_t HASH_getcode(const char *s) } #endif -void HASH_add(HASH_table *t, const char *s, int32_t key) +void hash_add(hashtable_t *t, const char *s, int32_t key) { - HASH_item *cur, *prev=NULL; + hashitem_t *cur, *prev=NULL; int32_t code; if (!s) return; if (t->items == NULL) { - initprintf("HASH_add(): table not initialized!\n"); + initprintf("hash_add(): table not initialized!\n"); return; } code = HASH_getcode(s)%t->size; @@ -12209,7 +12209,7 @@ void HASH_add(HASH_table *t, const char *s, int32_t key) if (!cur) { - cur=Bcalloc(1,sizeof(HASH_item)); + cur=Bcalloc(1,sizeof(hashitem_t)); cur->string=Bstrdup(s); cur->key=key; cur->next=NULL; @@ -12226,21 +12226,21 @@ void HASH_add(HASH_table *t, const char *s, int32_t key) } while (cur); - cur=Bcalloc(1,sizeof(HASH_item)); + cur=Bcalloc(1,sizeof(hashitem_t)); cur->string=Bstrdup(s); cur->key=key; cur->next=NULL; prev->next=cur; } -void HASH_replace(HASH_table *t, const char *s, int32_t key) +void hash_replace(hashtable_t *t, const char *s, int32_t key) { - HASH_item *cur, *prev=NULL; + hashitem_t *cur, *prev=NULL; int32_t code; if (t->items==NULL) { - initprintf("HASH_replace(): table not initialized!\n"); + initprintf("hash_replace(): table not initialized!\n"); return; } code=HASH_getcode(s)%t->size; @@ -12248,7 +12248,7 @@ void HASH_replace(HASH_table *t, const char *s, int32_t key) if (!cur) { - cur=Bcalloc(1,sizeof(HASH_item)); + cur=Bcalloc(1,sizeof(hashitem_t)); cur->string=Bstrdup(s); cur->key=key; cur->next=NULL; @@ -12268,20 +12268,20 @@ void HASH_replace(HASH_table *t, const char *s, int32_t key) } while (cur); - cur=Bcalloc(1,sizeof(HASH_item)); + cur=Bcalloc(1,sizeof(hashitem_t)); cur->string=Bstrdup(s); cur->key=key; cur->next=NULL; prev->next=cur; } -int32_t HASH_find(HASH_table *t, const char *s) +int32_t hash_find(hashtable_t *t, const char *s) { - HASH_item *cur; + hashitem_t *cur; if (t->items==NULL) { - initprintf("HASH_find(): table not initialized!\n"); + initprintf("hash_find(): table not initialized!\n"); return -1; } cur=t->items[HASH_getcode(s)%t->size]; @@ -12294,13 +12294,13 @@ int32_t HASH_find(HASH_table *t, const char *s) return -1; } -int32_t HASH_findcase(HASH_table *t, const char *s) +int32_t hash_findcase(hashtable_t *t, const char *s) { - HASH_item *cur; + hashitem_t *cur; if (t->items==NULL) { - initprintf("HASH_findcase(): table not initialized!\n"); + initprintf("hash_findcase(): table not initialized!\n"); return -1; } cur=t->items[HASH_getcode(s)%t->size]; diff --git a/polymer/eduke32/build/src/engine_priv.h b/polymer/eduke32/build/src/engine_priv.h index 34849eb67..d86c28cec 100644 --- a/polymer/eduke32/build/src/engine_priv.h +++ b/polymer/eduke32/build/src/engine_priv.h @@ -9,55 +9,55 @@ #define MAXCLIPDIST 1024 extern char pow2char[8]; -extern int pow2int[32]; +extern int32_t pow2int[32]; -extern short thesector[MAXWALLSB], thewall[MAXWALLSB]; -extern short bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; -extern short maskwall[MAXWALLSB], maskwallcnt; +extern int16_t thesector[MAXWALLSB], thewall[MAXWALLSB]; +extern int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; +extern int16_t maskwall[MAXWALLSB], maskwallcnt; extern spritetype *tspriteptr[MAXSPRITESONSCREEN]; -extern int xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen; +extern int32_t xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen; extern intptr_t frameoffset; -extern int globalposx, globalposy, globalposz, globalhoriz; -extern short globalang, globalcursectnum; -extern int globalpal, cosglobalang, singlobalang; -extern int cosviewingrangeglobalang, sinviewingrangeglobalang; -extern int globalvisibility; -extern int xyaspect; +extern int32_t globalposx, globalposy, globalposz, globalhoriz; +extern int16_t globalang, globalcursectnum; +extern int32_t globalpal, cosglobalang, singlobalang; +extern int32_t cosviewingrangeglobalang, sinviewingrangeglobalang; +extern int32_t globalvisibility; +extern int32_t xyaspect; extern intptr_t asm1, asm2, asm3, asm4; -extern int globalshade; -extern short globalpicnum; -extern int globalx1, globaly2; -extern int globalorientation; +extern int32_t globalshade; +extern int16_t globalpicnum; +extern int32_t globalx1, globaly2; +extern int32_t globalorientation; -extern short searchit; -extern int searchx, searchy; -extern short searchsector, searchwall, searchstat; +extern int16_t searchit; +extern int32_t searchx, searchy; +extern int16_t searchsector, searchwall, searchstat; extern char inpreparemirror; -extern int curbrightness, gammabrightness; +extern int32_t curbrightness, gammabrightness; extern char britable[16][256]; extern char picsiz[MAXTILES]; -extern int lastx[MAXYDIM]; +extern int32_t lastx[MAXYDIM]; extern char *transluc; -extern short sectorborder[256], sectorbordercnt; -extern int qsetmode; -extern int hitallsprites; +extern int16_t sectorborder[256], sectorbordercnt; +extern int32_t qsetmode; +extern int32_t hitallsprites; -extern int xb1[MAXWALLSB]; -extern int rx1[MAXWALLSB], ry1[MAXWALLSB]; -extern short p2[MAXWALLSB]; -extern short numscans, numhits, numbunches; +extern int32_t xb1[MAXWALLSB]; +extern int32_t rx1[MAXWALLSB], ry1[MAXWALLSB]; +extern int16_t p2[MAXWALLSB]; +extern int16_t numscans, numhits, numbunches; #ifdef USE_OPENGL extern palette_t palookupfog[MAXPALOOKUPS]; #endif -int wallmost(short *mostbuf, int w, int sectnum, char dastat); -int wallfront(int l1, int l2); -int animateoffs(short tilenum, short fakevar); +int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat); +int32_t wallfront(int32_t l1, int32_t l2); +int32_t animateoffs(int16_t tilenum, int16_t fakevar); -extern int indrawroomsandmasks; +extern int32_t indrawroomsandmasks; #if defined(__WATCOMC__) && !defined(NOASM) @@ -75,11 +75,11 @@ extern int indrawroomsandmasks; "mov byte ptr gotpic[eax], dl",\ parm [eax]\ modify exact [eax ebx ecx edx] -void setgotpic(int); +void setgotpic(int32_t); #elif defined(_MSC_VER) && !defined(NOASM) // __WATCOMC__ -static inline void setgotpic(int a) +static inline void setgotpic(int32_t a) { _asm { push ebx @@ -102,7 +102,7 @@ skipit: #elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // _MSC_VER #define setgotpic(a) \ -({ int __a=(a); \ +({ int32_t __a=(a); \ __asm__ __volatile__ ( \ "movl %%eax, %%ebx\n\t" \ "cmpb $200, "ASMSYM("walock")"(%%eax)\n\t" \ @@ -121,7 +121,7 @@ skipit: #else // __GNUC__ && __i386__ -static inline void setgotpic(int tilenume) +static inline void setgotpic(int32_t tilenume) { if (walock[tilenume] < 200) walock[tilenume] = 199; gotpic[tilenume>>3] |= pow2char[tilenume&7]; diff --git a/polymer/eduke32/build/src/gtkbits.c b/polymer/eduke32/build/src/gtkbits.c index 94b397dd1..c43b20387 100644 --- a/polymer/eduke32/build/src/gtkbits.c +++ b/polymer/eduke32/build/src/gtkbits.c @@ -24,7 +24,7 @@ int32_t gtkbuild_msgbox(char *name, char *msg) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - msg); + "%s", msg); gtk_window_set_title(GTK_WINDOW(dialog), name); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); @@ -43,7 +43,7 @@ int32_t gtkbuild_ynbox(char *name, char *msg) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO, - msg); + "%s", msg); gtk_window_set_title(GTK_WINDOW(dialog), name); r = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); diff --git a/polymer/eduke32/build/src/kplib.c b/polymer/eduke32/build/src/kplib.c index 6098242bc..463a201df 100644 --- a/polymer/eduke32/build/src/kplib.c +++ b/polymer/eduke32/build/src/kplib.c @@ -265,7 +265,7 @@ beg: shr edx, 1 adc eax, eax sub ecx, 1 - jnz int16_t beg + jnz short beg } } @@ -684,29 +684,29 @@ static _inline void rgbhlineasm(int32_t c, int32_t d, int32_t t, int32_t b) mov edi, t mov ebx, b sub ecx, edx - jle int16_t endit + jle short endit add edx, offset olinbuf cmp dword ptr trnsrgb, 0 - jz int16_t begit2 + jz short begit2 begit: mov eax, dword ptr [ecx+edx] or eax, 0xff000000 cmp eax, dword ptr trnsrgb - jne int16_t skipit + jne short skipit and eax, 0xffffff skipit: sub ecx, 3 mov [edi], eax lea edi, [edi+ebx] - jnz int16_t begit - jmp int16_t endit + jnz short begit + jmp short endit begit2: mov eax, dword ptr [ecx+edx] or eax, 0xff000000 sub ecx, 3 mov [edi], eax lea edi, [edi+ebx] - jnz int16_t begit2 + jnz short begit2 endit: } } @@ -720,7 +720,7 @@ static _inline void pal8hlineasm(int32_t c, int32_t d, int32_t t, int32_t b) mov edi, t mov ebx, b sub ecx, edx - jle int16_t endit + jle short endit add edx, offset olinbuf begit: movzx eax, byte ptr [ecx+edx] @@ -728,7 +728,7 @@ begit: sub ecx, 1 mov [edi], eax lea edi, [edi+ebx] - jnz int16_t begit + jnz short begit endit: } } diff --git a/polymer/eduke32/build/src/lzwnew.c b/polymer/eduke32/build/src/lzwnew.c index e989e8e0a..c44b2e61c 100644 --- a/polymer/eduke32/build/src/lzwnew.c +++ b/polymer/eduke32/build/src/lzwnew.c @@ -1,4 +1,5 @@ //-------------------------------------------------------------------------------------------------- +#include "compat.h" #if defined(__POWERPC__) static uint32_t LSWAPIB(uint32_t a) { return(((a>>8)&0xff00)+((a&0xff00)<<8)+(a<<24)+(a>>24)); } static uint16_t SSWAPIB(uint16_t a) { return((a>>8)+(a<<8)); } diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index 4aa1e9265..aa4d6e970 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -15,7 +15,7 @@ #include "kplib.h" #include "md4.h" -voxmodel *voxmodels[MAXVOXELS]; +voxmodel_t *voxmodels[MAXVOXELS]; int32_t curextra=MAXTILES; int32_t addtileP(int32_t model,int32_t tile,int32_t pallet) @@ -57,9 +57,9 @@ static int32_t allocvbos = 0, curvbo = 0; static GLuint* vertvbos = NULL; static GLuint* indexvbos = NULL; -mdmodel *mdload(const char *); +mdmodel_t *mdload(const char *); int32_t mddraw(spritetype *); -void mdfree(mdmodel *); +void mdfree(mdmodel_t *); int32_t globalnoeffect=0; extern int32_t timerticspersec; @@ -104,7 +104,7 @@ void freevbos() for (i=0;imdnum == 3) { - md3model *m = (md3model *)models[i]; + md3model_t *m = (md3model_t *)models[i]; if (m->vbos) { // OSD_Printf("freeing model %d vbo\n",i); @@ -129,7 +129,7 @@ void freevbos() void clearskins() { - mdmodel *m; + mdmodel_t *m; int32_t i, j; for (i=0;imdnum == 1) { - voxmodel *v = (voxmodel*)m; + voxmodel_t *v = (voxmodel_t*)m; for (j=0;jtexid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]); @@ -146,7 +146,7 @@ void clearskins() } else if (m->mdnum == 2 || m->mdnum == 3) { - md2model *m2 = (md2model*)m; + md2model_t *m2 = (md2model_t*)m; mdskinmap_t *sk; for (j=0;jnumskins*(HICEFFECTMASK+1);j++) { @@ -165,7 +165,7 @@ void clearskins() for (i=0;itexid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]); @@ -183,13 +183,13 @@ void mdinit() int32_t md_loadmodel(const char *fn) { - mdmodel *vm, **ml; + mdmodel_t *vm, **ml; if (!mdinited) mdinit(); if (nextmodelid >= nummodelsalloced) { - ml = (mdmodel **)realloc(models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void*)); if (!ml) return(-1); + ml = (mdmodel_t **)realloc(models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void*)); if (!ml) return(-1); models = ml; nummodelsalloced += MODELALLOCGROUP; } @@ -200,7 +200,7 @@ int32_t md_loadmodel(const char *fn) int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, int32_t flags) { - mdmodel *m; + mdmodel_t *m; if (!mdinited) mdinit(); @@ -220,7 +220,7 @@ int32_t md_tilehasmodel(int32_t tilenume,int32_t pal) return tile2model[Ptile2tile(tilenume,pal)].modelid; } -static int32_t framename2index(mdmodel *vm, const char *nam) +static int32_t framename2index(mdmodel_t *vm, const char *nam) { int32_t i = 0; @@ -228,7 +228,7 @@ static int32_t framename2index(mdmodel *vm, const char *nam) { case 2: { - md2model *m = (md2model *)vm; + md2model_t *m = (md2model_t *)vm; md2frame_t *fr; for (i=0;inumframes;i++) { @@ -239,7 +239,7 @@ static int32_t framename2index(mdmodel *vm, const char *nam) break; case 3: { - md3model *m = (md3model *)vm; + md3model_t *m = (md3model_t *)vm; for (i=0;inumframes;i++) if (!Bstrcmp(m->head.frames[i].nam,nam)) break; } @@ -250,7 +250,7 @@ static int32_t framename2index(mdmodel *vm, const char *nam) int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal) { - md2model *m; + md2model_t *m; int32_t i; if (!mdinited) mdinit(); @@ -260,7 +260,7 @@ int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, if (!framename) return(-3); tilenume=addtileP(modelid,tilenume,pal); - m = (md2model *)models[modelid]; + m = (md2model_t *)models[modelid]; if (m->mdnum == 1) { tile2model[tilenume].modelid = modelid; @@ -268,7 +268,7 @@ int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, return 0; } - i = framename2index((mdmodel*)m,framename); + i = framename2index((mdmodel_t*)m,framename); if (i == m->numframes) return(-3); // frame name invalid tile2model[tilenume].modelid = modelid; @@ -281,7 +281,7 @@ int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, int32_t fpssc, int32_t flags) { - md2model *m; + md2model_t *m; mdanim_t ma, *map; int32_t i; @@ -290,16 +290,16 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char * if ((uint32_t)modelid >= (uint32_t)nextmodelid) return(-1); memset(&ma, 0, sizeof(ma)); - m = (md2model *)models[modelid]; + m = (md2model_t *)models[modelid]; if (m->mdnum < 2) return 0; //find index of start frame - i = framename2index((mdmodel*)m,framestart); + i = framename2index((mdmodel_t*)m,framestart); if (i == m->numframes) return -2; ma.startframe = i; //find index of finish frame which must trail start frame - i = framename2index((mdmodel*)m,frameend); + i = framename2index((mdmodel_t*)m,frameend); if (i == m->numframes) return -3; ma.endframe = i; @@ -319,7 +319,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char * int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param) { mdskinmap_t *sk, *skl; - md2model *m; + md2model_t *m; if (!mdinited) mdinit(); @@ -327,7 +327,7 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32 if (!skinfn) return -2; if ((unsigned)palnum >= (unsigned)MAXPALOOKUPS) return -3; - m = (md2model *)models[modelid]; + m = (md2model_t *)models[modelid]; if (m->mdnum < 2) return 0; if (m->mdnum == 2) surfnum = 0; @@ -401,7 +401,7 @@ int32_t md_undefinemodel(int32_t modelid) return 0; } -md2model *modelhead; +md2model_t *modelhead; mdskinmap_t *skhead; typedef struct @@ -481,7 +481,7 @@ void applypalmap(char *pic, char *palmap, int32_t size, int32_t pal) } } -static void applypalmapSkin(char *pic, int32_t sizx, int32_t sizy, md2model *m, int32_t number, int32_t pal, int32_t surf) +static void applypalmapSkin(char *pic, int32_t sizx, int32_t sizy, md2model_t *m, int32_t number, int32_t pal, int32_t surf) { int32_t stage; @@ -493,7 +493,7 @@ static void applypalmapSkin(char *pic, int32_t sizx, int32_t sizy, md2model *m, getpalmap(&stage,&pal1,&pal2); if (!pal1)return; - mdloadskin((md2model *)m,number,pal1,surf); + mdloadskin((md2model_t *)m,number,pal1,surf); for (; sk; sk = sk->next) if ((int32_t)sk->palette == pal1&&sk->palmap)break; if (!sk||sk->size!=sizx*sizy)continue; @@ -502,7 +502,7 @@ static void applypalmapSkin(char *pic, int32_t sizx, int32_t sizy, md2model *m, } } -static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t *sizx, int32_t *sizy, int32_t *osizx, int32_t *osizy, char *hasalpha, int32_t pal, char effect, md2model *m, int32_t number, int32_t surf) +static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t *sizx, int32_t *sizy, int32_t *osizx, int32_t *osizy, char *hasalpha, int32_t pal, char effect, md2model_t *m, int32_t number, int32_t surf) { int32_t picfillen, j,y,x; char *picfil,*cptr,al=255; @@ -644,7 +644,7 @@ int32_t mdloadskin_trytexcache(char *fn, int32_t len, int32_t pal, char effect, } while (cacheindexptr->next); */ - i = HASH_find(&cacheH,cachefn); + i = hash_find(&cacheH,cachefn); if (i != -1) { texcacheindex *cacheindexptr = cacheptrs[i]; @@ -746,7 +746,7 @@ failure: // --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF //Note: even though it says md2model, it works for both md2model&md3model -int32_t mdloadskin(md2model *m, int32_t number, int32_t pal, int32_t surf) +int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) { int32_t i,j, bpl, xsiz=0, ysiz=0, osizx, osizy, texfmt = GL_RGBA, intexfmt = GL_RGBA; intptr_t fptr=0; @@ -809,7 +809,7 @@ int32_t mdloadskin(md2model *m, int32_t number, int32_t pal, int32_t surf) // possibly fetch an already loaded multitexture :_) if (pal >= (MAXPALOOKUPS - RESERVEDPALS)) for (i=0;iskinmap; skzero; skzero = skzero->next) + for (skzero = ((md2model_t *)models[i])->skinmap; skzero; skzero = skzero->next) if (!Bstrcasecmp(skzero->fn, sk->fn) && skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)]) { sk->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)] = skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)]; @@ -897,7 +897,7 @@ int32_t mdloadskin(md2model *m, int32_t number, int32_t pal, int32_t surf) } else if (m->mdnum == 3) { - md3model *m3 = (md3model *)m; + md3model_t *m3 = (md3model_t *)m; md3surf_t *s; int32_t surfi; for (surfi=0;surfihead.numsurfs;surfi++) @@ -944,7 +944,7 @@ int32_t mdloadskin(md2model *m, int32_t number, int32_t pal, int32_t surf) } //Note: even though it says md2model, it works for both md2model&md3model -void updateanimation(md2model *m, spritetype *tspr) +void updateanimation(md2model_t *m, spritetype *tspr) { mdanim_t *anim; int32_t i, j, k; @@ -1066,7 +1066,7 @@ void updateanimation(md2model *m, spritetype *tspr) } // VBO generation and allocation -static void mdloadvbos(md3model *m) +static void mdloadvbos(md3model_t *m) { int32_t i; @@ -1084,17 +1084,17 @@ static void mdloadvbos(md3model *m) } //--------------------------------------- MD2 LIBRARY BEGINS --------------------------------------- -static md2model *md2load(int32_t fil, const char *filnam) +static md2model_t *md2load(int32_t fil, const char *filnam) { - md2model *m; - md3model *m3; + md2model_t *m; + md3model_t *m3; md3surf_t *s; md2frame_t *f; md2head_t head; char st[BMAX_PATH]; int32_t i, j, k; - m = (md2model *)calloc(1,sizeof(md2model)); if (!m) return(0); + m = (md2model_t *)calloc(1,sizeof(md2model_t)); if (!m) return(0); m->mdnum = 2; m->scale = .01f; kread(fil,(char *)&head,sizeof(md2head_t)); @@ -1181,7 +1181,7 @@ static md2model *md2load(int32_t fil, const char *filnam) // the MD2 is now loaded internally - let's begin the MD3 conversion process //OSD_Printf("Beginning md3 conversion.\n"); - m3 = (md3model *)calloc(1, sizeof(md3model)); if (!m3) { free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); } + m3 = (md3model_t *)calloc(1, sizeof(md3model_t)); if (!m3) { free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); } m3->mdnum = 3; m3->texid = 0; m3->scale = m->scale; m3->head.id = 0x33504449; m3->head.vers = 15; // this changes the conversion code to do real MD2->MD3 conversion @@ -1315,7 +1315,7 @@ static md2model *md2load(int32_t fil, const char *filnam) // die MD2 ! DIE ! free(m->texid); free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); - return((md2model *)m3); + return((md2model_t *)m3); } //---------------------------------------- MD2 LIBRARY ENDS ---------------------------------------- @@ -1367,14 +1367,14 @@ void quicksort(uint16_t *indexes, float *depths, int32_t first, int32_t last) //--------------------------------------- MD3 LIBRARY BEGINS --------------------------------------- -static md3model *md3load(int32_t fil) +static md3model_t *md3load(int32_t fil) { int32_t i, surfi, ofsurf, offs[4], leng[4]; int32_t maxtrispersurf; - md3model *m; + md3model_t *m; md3surf_t *s; - m = (md3model *)calloc(1,sizeof(md3model)); if (!m) return(0); + m = (md3model_t *)calloc(1,sizeof(md3model_t)); if (!m) return(0); m->mdnum = 3; m->texid = 0; m->scale = .01; m->muladdframes = NULL; @@ -1533,7 +1533,7 @@ static md3model *md3load(int32_t fil) return(m); } -static int32_t md3draw(md3model *m, spritetype *tspr) +static int32_t md3draw(md3model_t *m, spritetype *tspr) { point3d fp, fp1, fp2, m0, m1, a0; md3xyzn_t *v0, *v1; @@ -1554,7 +1554,7 @@ static int32_t md3draw(md3model *m, spritetype *tspr) // if ((tspr->cstat&48) == 32) return 0; - updateanimation((md2model *)m,tspr); + updateanimation((md2model_t *)m,tspr); //create current&next frame's vertex list from whole list @@ -1801,12 +1801,12 @@ static int32_t md3draw(md3model *m, spritetype *tspr) mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat); // PLAG: End - i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,globalpal,surfi); if (!i) continue; + i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,globalpal,surfi); if (!i) continue; //i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,surfi); //hack for testing multiple surfaces per MD3 bglBindTexture(GL_TEXTURE_2D, i); if (r_detailmapping && !r_depthpeeling && !(tspr->cstat&1024)) - i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi); + i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi); else i = 0; @@ -1846,7 +1846,7 @@ static int32_t md3draw(md3model *m, spritetype *tspr) } if (r_glowmapping && !r_depthpeeling && !(tspr->cstat&1024)) - i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi); + i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi); else i = 0; @@ -2052,7 +2052,7 @@ static int32_t md3draw(md3model *m, spritetype *tspr) return 1; } -static void md3free(md3model *m) +static void md3free(md3model_t *m) { mdanim_t *anim, *nanim = NULL; mdskinmap_t *sk, *nsk = NULL; @@ -2127,7 +2127,7 @@ typedef struct { int16_t x, y; } spoint2d; static spoint2d *shp; static int32_t *shcntmal, *shcnt = 0, shcntp; static int32_t mytexo5, *zbit, gmaxx, gmaxy, garea, pow2m1[33]; -static voxmodel *gvox; +static voxmodel_t *gvox; //pitch must equal xsiz*4 unsigned gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, int32_t dapal) @@ -2384,13 +2384,13 @@ static int32_t isolid(int32_t x, int32_t y, int32_t z) z += x*yzsiz + y*zsiz; return(vbit[z>>5]&(1<mytex) free(m->mytex); @@ -2751,10 +2751,10 @@ void voxfree(voxmodel *m) free(m); } -voxmodel *voxload(const char *filnam) +voxmodel_t *voxload(const char *filnam) { int32_t i, is8bit, ret; - voxmodel *vm; + voxmodel_t *vm; i = strlen(filnam)-4; if (i < 0) return(0); if (!Bstrcasecmp(&filnam[i],".vox")) { ret = loadvox(filnam); is8bit = 1; } @@ -2782,7 +2782,7 @@ voxmodel *voxload(const char *filnam) } //Draw voxel model as perfect cubes -int32_t voxdraw(voxmodel *m, spritetype *tspr) +int32_t voxdraw(voxmodel_t *m, spritetype *tspr) { point3d fp, m0, a0; int32_t i, j, fi, xx, yy, zz; @@ -2935,13 +2935,13 @@ int32_t voxdraw(voxmodel *m, spritetype *tspr) //---------------------------------------- VOX LIBRARY ENDS ---------------------------------------- //--------------------------------------- MD LIBRARY BEGINS --------------------------------------- -mdmodel *mdload(const char *filnam) +mdmodel_t *mdload(const char *filnam) { - mdmodel *vm; + mdmodel_t *vm; int32_t fil; int32_t i; - vm = (mdmodel*)voxload(filnam); if (vm) return(vm); + vm = (mdmodel_t*)voxload(filnam); if (vm) return(vm); fil = kopen4load((char *)filnam,0); if (fil < 0) return(0); kread(fil,&i,4); klseek(fil,0,SEEK_SET); @@ -2949,11 +2949,11 @@ mdmodel *mdload(const char *filnam) { case 0x32504449: // initprintf("Warning: model '%s' is version IDP2; wanted version IDP3\n",filnam); - vm = (mdmodel*)md2load(fil,filnam); break; //IDP2 + vm = (mdmodel_t*)md2load(fil,filnam); break; //IDP2 case 0x33504449: - vm = (mdmodel*)md3load(fil); break; //IDP3 + vm = (mdmodel_t*)md3load(fil); break; //IDP3 default: - vm = (mdmodel*)0; break; + vm = (mdmodel_t*)0; break; } kclose(fil); return(vm); @@ -2961,7 +2961,7 @@ mdmodel *mdload(const char *filnam) int32_t mddraw(spritetype *tspr) { - mdmodel *vm; + mdmodel_t *vm; int32_t i; if (r_vbos && (r_vbocount > allocvbos)) @@ -2997,15 +2997,15 @@ int32_t mddraw(spritetype *tspr) } vm = models[tile2model[Ptile2tile(tspr->picnum,(tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal)].modelid]; - if (vm->mdnum == 1) { return voxdraw((voxmodel *)vm,tspr); } - if (vm->mdnum == 3) { return md3draw((md3model *)vm,tspr); } + if (vm->mdnum == 1) { return voxdraw((voxmodel_t *)vm,tspr); } + if (vm->mdnum == 3) { return md3draw((md3model_t *)vm,tspr); } return 0; } -void mdfree(mdmodel *vm) +void mdfree(mdmodel_t *vm) { - if (vm->mdnum == 1) { voxfree((voxmodel *)vm); return; } - if (vm->mdnum == 3) { md3free((md3model *)vm); return; } + if (vm->mdnum == 1) { voxfree((voxmodel_t *)vm); return; } + if (vm->mdnum == 3) { md3free((md3model_t *)vm); return; } } #endif diff --git a/polymer/eduke32/build/src/mmulti.c b/polymer/eduke32/build/src/mmulti.c index 6f66f4de3..b07ca37d1 100644 --- a/polymer/eduke32/build/src/mmulti.c +++ b/polymer/eduke32/build/src/mmulti.c @@ -329,18 +329,17 @@ int32_t isvalidipaddress(char *st) //---------------------------------- Obsolete variables&functions ---------------------------------- char syncstate = 0; void mmulti_setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount) { UNREFERENCED_PARAMETER(datimeoutcount); UNREFERENCED_PARAMETER(daresendagaincount); } -void genericmultifunction(int32_t other, char *bufptr, int32_t messleng, int32_t command) +void mmulti_generic(int32_t other, char *bufptr, int32_t messleng, int32_t command) { UNREFERENCED_PARAMETER(other); UNREFERENCED_PARAMETER(bufptr); UNREFERENCED_PARAMETER(messleng); UNREFERENCED_PARAMETER(command); } -int32_t getoutputcirclesize() { return(0); } -void setsocket(int32_t newsocket) { UNREFERENCED_PARAMETER(newsocket); } +int32_t mmulti_getoutputcirclesize() { return(0); } void mmulti_flushpackets() {} -void sendlogon() {} -void sendlogoff() {} +void mmulti_sendlogon() {} +void mmulti_sendlogoff() {} //-------------------------------------------------------------------------------------------------- static int32_t crctab16[256]; diff --git a/polymer/eduke32/build/src/mmulti_null.c b/polymer/eduke32/build/src/mmulti_null.c index 287c9d3cd..c59c3b453 100644 --- a/polymer/eduke32/build/src/mmulti_null.c +++ b/polymer/eduke32/build/src/mmulti_null.c @@ -42,23 +42,19 @@ void mmulti_uninitmultiplayers(void) { } -void sendlogon(void) +void mmulti_sendlogon(void) { } -void sendlogoff(void) +void mmulti_sendlogoff(void) { } -int32_t getoutputcirclesize(void) +int32_t mmulti_getoutputcirclesize(void) { return 0; } -void setsocket(int16_t newsocket) -{ -} - void mmulti_sendpacket(int32_t other, char *bufptr, int32_t messleng) { } @@ -72,7 +68,7 @@ void mmulti_flushpackets(void) { } -void genericmultifunction(int32_t other, char *bufptr, int32_t messleng, int32_t command) +void mmulti_generic(int32_t other, char *bufptr, int32_t messleng, int32_t command) { } diff --git a/polymer/eduke32/build/src/mmulti_unstable.c b/polymer/eduke32/build/src/mmulti_unstable.c index 6d0d73be1..fce5a530f 100644 --- a/polymer/eduke32/build/src/mmulti_unstable.c +++ b/polymer/eduke32/build/src/mmulti_unstable.c @@ -55,7 +55,8 @@ int32_t crctable[256]; int32_t tmpmax[8]; //addfaz variable addition (you could probs think of something better) int32_t itmp = 0; //addfaz router fix STUN -static char lastpacket[576], inlastpacket = 0; +static uint8_t lastpacket[576]; +char inlastpacket = 0; static int32_t lastpacketfrom, lastpacketleng; extern int32_t totalclock; /* MUST EXTERN 1 ANNOYING VARIABLE FROM GAME */ @@ -64,7 +65,7 @@ static int32_t timeoutcount = 60, resendagaincount = 4, lastsendtime[MAXPLAYERS] int32_t natfree; //NatFree mode flag static int16_t bakpacketptr[MAXPLAYERS][256], bakpacketlen[MAXPLAYERS][256]; -static char bakpacketbuf[BAKSIZ]; +static uint16_t bakpacketbuf[BAKSIZ]; static int32_t bakpacketplc = 0; int32_t myconnectindex, numplayers; @@ -74,18 +75,24 @@ char syncstate = 0; #define MAXPACKETSIZE 2048 #define PACKET_START_GAME 0x1337 +enum commit_cmd_t +{ + COMMIT_CMD_SEND = 1, + COMMIT_CMD_GET = 2, + COMMIT_CMD_SENDTOALL = 3, + COMMIT_CMD_SENDTOALLOTHERS = 4, + COMMIT_CMD_SCORE = 5, +}; + typedef struct gcomtype_t { -// short intnum; /* communication between Game and the driver */ int16_t command; /* 1-send, 2-get */ int16_t other; /* dest for send, set by get (-1 = no packet) */ int16_t numbytes; int16_t myconnectindex; int16_t numplayers; -// short gametype; /* gametype: 1-serial,2-modem,3-net */ int16_t filler; char buffer[MAXPACKETSIZE]; -// intptr_t longcalladdress; } gcomtype; static gcomtype *gcom; @@ -119,15 +126,6 @@ typedef struct //typedef std::vector PacketQueue; -enum ECommitCMDs -{ - COMMIT_CMD_SEND = 1, - COMMIT_CMD_GET = 2, - COMMIT_CMD_SENDTOALL = 3, - COMMIT_CMD_SENDTOALLOTHERS = 4, - COMMIT_CMD_SCORE = 5, -}; - static struct allowed_addr_t { int32_t host; @@ -371,14 +369,14 @@ typedef enum udpmode_peer, udpmode_server, udpmode_client -} udpmodes; -static udpmodes udpmode = udpmode_peer; +} udpmode_t; +static udpmode_t udpmode = udpmode_peer; -void sendlogon(void) +void mmulti_sendlogon(void) { } -void sendlogoff(void) +void mmulti_sendlogoff(void) { int32_t i; char tempbuf[2]; @@ -393,17 +391,11 @@ void sendlogoff(void) } } -int32_t getoutputcirclesize(void) +int32_t mmulti_getoutputcirclesize(void) { return(0); } -void setsocket(int32_t newsocket) -{ - UNREFERENCED_PARAMETER(newsocket); -} - - int32_t mmulti_getpacket(int32_t *other, char *bufptr) { int32_t i, messleng; @@ -577,7 +569,7 @@ void mmulti_flushpackets() #endif } -void genericmultifunction(int32_t other, char *bufptr, int32_t messleng, int32_t command) +void mmulti_generic(int32_t other, char *bufptr, int32_t messleng, int32_t command) { if (numplayers < 2) return; @@ -589,8 +581,6 @@ void genericmultifunction(int32_t other, char *bufptr, int32_t messleng, int32_t } -#if UDP_NETWORKING - #if PLATFORM_WIN32 # include # define EWOULDBLOCK WSAEWOULDBLOCK @@ -2169,9 +2159,5 @@ void callcommit(void) } } -#else -#error Please define a network transport for your platform. -#endif - /* end of mmulti.c ... */ diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index 1fa611411..00c141c58 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -105,7 +105,7 @@ static int32_t osdcursorpal=0; */ static symbol_t *osdsymbptrs[MAXSYMBOLS]; static int32_t osdnumsymbols = 0; -static HASH_table osdsymbolsH = { MAXSYMBOLS<<1, NULL }; +static hashtable_t osdsymbolsH = { MAXSYMBOLS<<1, NULL }; // application callbacks static void (*drawosdchar)(int32_t, int32_t, char, int32_t, int32_t) = _internal_drawosdchar; @@ -623,7 +623,7 @@ void OSD_Cleanup(void) { symbol_t *s; - HASH_free(&osdsymbolsH); + hash_free(&osdsymbolsH); for (; symbols; symbols=s) { @@ -649,7 +649,7 @@ void OSD_Init(void) osdnumsymbols = 0; - HASH_init(&osdsymbolsH); + hash_init(&osdsymbolsH); osdlines=1; @@ -1823,9 +1823,9 @@ static symbol_t *addnewsymbol(const char *name) newsymb->next = t; } } - HASH_add(&osdsymbolsH, name, osdnumsymbols); + hash_add(&osdsymbolsH, name, osdnumsymbols); lname = strtolower(Bstrdup(name),Bstrlen(name)); - HASH_add(&osdsymbolsH, lname, osdnumsymbols); + hash_add(&osdsymbolsH, lname, osdnumsymbols); Bfree(lname); osdsymbptrs[osdnumsymbols++] = newsymb; return newsymb; @@ -1855,7 +1855,7 @@ static symbol_t *findexactsymbol(const char *name) char *lname = Bstrdup(name); if (!symbols) return NULL; - i = HASH_find(&osdsymbolsH,lname); + i = hash_find(&osdsymbolsH,lname); if (i > -1) { // if ((symbol_t *)osdsymbptrs[i]->func == (void *)OSD_UNALIASED) @@ -1866,7 +1866,7 @@ static symbol_t *findexactsymbol(const char *name) // try it again lname = strtolower(lname, Bstrlen(name)); - i = HASH_find(&osdsymbolsH,lname); + i = hash_find(&osdsymbolsH,lname); Bfree(lname); if (i > -1) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 15ff423c8..382f95829 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -2308,7 +2308,7 @@ static void polymer_drawskybox(int16_t tilenum) // MDSPRITES static void polymer_drawmdsprite(spritetype *tspr) { - md3model* m; + md3model_t* m; mdskinmap_t* sk; md3xyzn_t *v0, *v1; md3surf_t *s; @@ -2320,8 +2320,8 @@ static void polymer_drawmdsprite(spritetype *tspr) GLfloat* color; int32_t materialbits; - m = (md3model*)models[tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].modelid]; - updateanimation((md2model *)m,tspr); + m = (md3model_t*)models[tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].modelid]; + updateanimation((md2model_t *)m,tspr); lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal; @@ -2410,14 +2410,14 @@ static void polymer_drawmdsprite(spritetype *tspr) v1 = &s->xyzn[m->nframe*s->numverts]; mdspritematerial.diffusemap = - mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,tspr->pal,surfi); + mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,tspr->pal,surfi); if (!mdspritematerial.diffusemap) continue; if (r_detailmapping && !(tspr->cstat&1024)) { mdspritematerial.detailmap = - mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi); + mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi); for (sk = m->skinmap; sk; sk = sk->next) if ((int32_t)sk->palette == DETAILPAL && @@ -2429,7 +2429,7 @@ static void polymer_drawmdsprite(spritetype *tspr) if (r_glowmapping && !(tspr->cstat&1024)) { mdspritematerial.glowmap = - mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi); + mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi); } if (pr_vbos > 1) @@ -2480,7 +2480,7 @@ static void polymer_drawmdsprite(spritetype *tspr) globalnoeffect=0; } -static void polymer_loadmodelvbos(md3model* m) +static void polymer_loadmodelvbos(md3model_t* m) { int32_t i; md3surf_t *s; diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index a7ed86c71..39e7ade3f 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -339,7 +339,7 @@ void drawline2d(float x0, float y0, float x1, float y1, char col) int32_t cachefilehandle = -1; // texture cache file handle FILE *cacheindexptr = NULL; -HASH_table cacheH = { 1024, NULL }; +hashtable_t cacheH = { 1024, NULL }; char TEXCACHEFILE[BMAX_PATH] = "textures"; @@ -600,11 +600,11 @@ void gltexapplyprops(void) { int32_t j; mdskinmap_t *sk; - md2model *m; + md2model_t *m; for (i=0;imdnum < 2) continue; for (j=0;jnumskins*(HICEFFECTMASK+1);j++) { @@ -897,7 +897,7 @@ void polymost_glinit() numcacheentries = 0; Bmemset(&firstcacheindex, 0, sizeof(texcacheindex)); Bmemset(&cacheptrs[0], 0, sizeof(cacheptrs)); - HASH_init(&cacheH); + hash_init(&cacheH); LoadCacheOffsets(); Bstrcpy(ptempbuf,TEXCACHEFILE); @@ -971,7 +971,7 @@ void invalidatecache(void) numcacheentries = 0; Bmemset(&firstcacheindex, 0, sizeof(texcacheindex)); Bmemset(&cacheptrs[0], 0, sizeof(cacheptrs)); - HASH_init(&cacheH); + hash_init(&cacheH); // LoadCacheOffsets(); Bstrcpy(ptempbuf,TEXCACHEFILE); @@ -1381,7 +1381,7 @@ static int32_t LoadCacheOffsets(void) if (scriptfile_getnumber(script, &foffset)) break; // offset in cache if (scriptfile_getnumber(script, &fsize)) break; // size - i = HASH_find(&cacheH,fname); + i = hash_find(&cacheH,fname); if (i > -1) { // update an existing entry @@ -1396,7 +1396,7 @@ static int32_t LoadCacheOffsets(void) curcacheindex->offset = foffset; curcacheindex->len = fsize; curcacheindex->next = Bcalloc(1, sizeof(texcacheindex)); - HASH_replace(&cacheH, Bstrdup(fname), numcacheentries); + hash_replace(&cacheH, Bstrdup(fname), numcacheentries); cacheptrs[numcacheentries++] = curcacheindex; curcacheindex = curcacheindex->next; } @@ -1445,7 +1445,7 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache int32_t len = 0; int32_t i; - i = HASH_find(&cacheH,cachefn); + i = hash_find(&cacheH,cachefn); if (i > -1) { texcacheindex *t = cacheptrs[i]; @@ -1616,7 +1616,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea } { - int32_t i = HASH_find(&cacheH,cachefn); + int32_t i = hash_find(&cacheH,cachefn); if (i > -1) { // update an existing entry @@ -1638,7 +1638,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea if (cacheindexptr) Bfprintf(cacheindexptr, "%s %d %d\n", curcacheindex->name, curcacheindex->offset, curcacheindex->len); - HASH_add(&cacheH, Bstrdup(cachefn), numcacheentries); + hash_add(&cacheH, Bstrdup(cachefn), numcacheentries); cacheptrs[numcacheentries++] = curcacheindex; curcacheindex = curcacheindex->next; } @@ -6426,11 +6426,11 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype) int32_t i,j=0; if (models[mid]->mdnum == 3) - j = ((md3model *)models[mid])->head.numsurfs; + j = ((md3model_t *)models[mid])->head.numsurfs; for (i=0;i<=j;i++) { - mdloadskin((md2model*)models[mid], 0, dapalnum, i); + mdloadskin((md2model_t*)models[mid], 0, dapalnum, i); } } #endif diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index fbf38ee3d..0e4a79f93 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -69,7 +69,7 @@ char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend; char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend; char remap[256]; int32_t remapinit=0; -static char keynames[256][24]; +static char key_names[256][24]; volatile int32_t mousex=0,mousey=0,mouseb=0; int32_t *joyaxis = NULL, joyb=0, *joyhat = NULL; char joyisgamepad=0, joynumaxes=0, joynumbuttons=0, joynumhats=0; @@ -412,18 +412,18 @@ int32_t initinput(void) SDL_EnableUNICODE(1); // let's hope this doesn't hit us too hard - memset(keynames,0,sizeof(keynames)); + memset(key_names,0,sizeof(key_names)); #if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) for (i=0; i= 256) return NULL; - return keynames[num]; + return key_names[num]; } const char *getjoyname(int32_t what, int32_t num) diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 328119182..379663eab 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -108,8 +108,8 @@ intptr_t frameplace=0; int32_t lockcount=0; static int32_t curvidmode = -1; static int32_t customxdim = 640, customydim = 480, custombpp = 8, customfs = 0; -static unsigned modeschecked=0; -unsigned maxrefreshfreq=60; +static uint32_t modeschecked=0; +uint32_t maxrefreshfreq=60; char modechange=1, repaintneeded=0; char offscreenrendering=0; int32_t glcolourdepth=32; @@ -131,7 +131,7 @@ char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend; char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend; char remap[256]; int32_t remapinit=0; -static char keynames[256][24]; +static char key_names[256][24]; static uint32_t lastKeyDown = 0; static uint32_t lastKeyTime = 0; @@ -640,7 +640,7 @@ void initprintf(const char *f, ...) // void debugprintf(const char *f, ...) { -#ifdef DEBUGGINGAIDS +#if 0 // def DEBUGGINGAIDS va_list va; char buf[1024]; @@ -731,7 +731,7 @@ static struct static struct _joydef { const char *name; - unsigned ofs; // directinput 'dwOfs' value + uint32_t ofs; // directinput 'dwOfs' value } *axisdefs = NULL, *buttondefs = NULL, *hatdefs = NULL; struct _joydevicefeature @@ -877,7 +877,7 @@ DWORD WINAPI ProcessMouse(LPVOID lpThreadParameter) continue; { DWORD i; - unsigned t; + uint32_t t; int32_t result; DIDEVICEOBJECTDATA didod; DWORD dwElements = 1; @@ -1557,7 +1557,7 @@ static void GetKeyNames(void) HRESULT res; char tbuf[MAX_PATH]; - memset(keynames,0,sizeof(keynames)); + memset(key_names,0,sizeof(key_names)); for (i=0;i<256;i++) { ZeroMemory(&key,sizeof(key)); @@ -1567,19 +1567,19 @@ static void GetKeyNames(void) if (FAILED(res)) continue; CharToOem(key.tszName, tbuf); - strncpy((char *)keynames[i], tbuf, sizeof(keynames[i])-1); + strncpy((char *)key_names[i], tbuf, sizeof(key_names[i])-1); tbuf[0] = 0; - GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(keynames[i])-1); -// initprintf("%d %15s %15s\n",i,keynames[i],tbuf); - if (*tbuf)strncpy(&keynames[i][0], tbuf, sizeof(keynames[i])-1); + GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(key_names[i])-1); +// initprintf("%d %15s %15s\n",i,key_names[i],tbuf); + if (*tbuf)strncpy(&key_names[i][0], tbuf, sizeof(key_names[i])-1); } } const char *getkeyname(int32_t num) { if ((unsigned)num >= 256) return NULL; - return keynames[num]; + return key_names[num]; } const char *getjoyname(int32_t what, int32_t num) @@ -1672,8 +1672,8 @@ static void ProcessInputDevices(void) DIDEVICEOBJECTDATA didod[INPUT_BUFFER_SIZE]; DWORD dwElements = INPUT_BUFFER_SIZE; DWORD ev; - unsigned t,u; - unsigned idevnums[NUM_INPUTS], numdevs = 0; + uint32_t t,u; + uint32_t idevnums[NUM_INPUTS], numdevs = 0; HANDLE waithnds[NUM_INPUTS]; for (t = 0; t < NUM_INPUTS; t++) @@ -2260,9 +2260,9 @@ static void cdsenummodes(void) DEVMODE dm; int32_t i = 0, j = 0; - struct { unsigned x,y,bpp,freq; } modes[MAXVALIDMODES]; + struct { uint32_t x,y,bpp,freq; } modes[MAXVALIDMODES]; int32_t nmodes=0; - unsigned maxx = MAXXDIM, maxy = MAXYDIM; + uint32_t maxx = MAXXDIM, maxy = MAXYDIM; ZeroMemory(&dm,sizeof(DEVMODE)); @@ -2307,7 +2307,7 @@ static void cdsenummodes(void) // mode enumerator static HRESULT WINAPI getvalidmodes_enum(DDSURFACEDESC *ddsd, VOID *udata) { - unsigned maxx = MAXXDIM, maxy = MAXYDIM; + uint32_t maxx = MAXXDIM, maxy = MAXYDIM; UNREFERENCED_PARAMETER(udata); diff --git a/polymer/eduke32/eduke32.vcproj b/polymer/eduke32/eduke32.vcproj index 602479d37..5b2d0d557 100644 --- a/polymer/eduke32/eduke32.vcproj +++ b/polymer/eduke32/eduke32.vcproj @@ -136,6 +136,10 @@ RelativePath=".\build\include\md4.h" > + + @@ -248,6 +252,10 @@ RelativePath=".\build\src\engine.c" > + + @@ -328,14 +336,6 @@ RelativePath=".\build\src\smalltextfont.c" > - - - - diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index befa22726..f3a242c2a 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2228,7 +2228,7 @@ CLEAR_THE_BOLT: p = CheckPlayerInSector(sect); if (p >= 0 && (g_player[p].ps->on_ground || s->ang == 512)) { - if (t[0] == 0 && !check_activator_motion(s->lotag)) + if (t[0] == 0 && !G_CheckActivatorMotion(s->lotag)) { t[0] = 1; t[1] = 1; diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 1946fcb3c..c773aefca 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -51,18 +51,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =================== */ -HASH_table gamefuncH = { NUMGAMEFUNCTIONS<<1, NULL }; +hashtable_t gamefuncH = { NUMGAMEFUNCTIONS<<1, NULL }; int32 CONFIG_FunctionNameToNum(char * func) { int32 i; - i = HASH_find(&gamefuncH,func); + i = hash_find(&gamefuncH,func); if (i < 0) { char *str = strtolower(Bstrdup(func),Bstrlen(func)); - i = HASH_find(&gamefuncH,str); + i = hash_find(&gamefuncH,str); Bfree(str); return i; @@ -150,8 +150,8 @@ void CONFIG_SetDefaultKeys(int32_t type) int32 i,f; Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys)); - Bmemset(&boundkeys,0,sizeof(boundkeys)); - Bmemset(&mousebind,0,sizeof(mousebind)); + Bmemset(&KeyBindings,0,sizeof(KeyBindings)); + Bmemset(&MouseBindings,0,sizeof(MouseBindings)); if (type == 1) { @@ -351,7 +351,7 @@ void CONFIG_ReadKeys(void) numkeyentries = SCRIPT_NumberEntries(ud.config.scripthandle,"KeyDefinitions"); - Bmemset(&boundkeys,0,sizeof(boundkeys)); + Bmemset(&KeyBindings,0,sizeof(KeyBindings)); for (i=0;i=0;i--) @@ -423,11 +423,11 @@ void CONFIG_MapKey(int32 which, kb_scancode key1, kb_scancode oldkey1, kb_scanco Bstrcat(tempbuf,buf); } } - Bstrncpy(boundkeys[ii[k]].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncpy(KeyBindings[ii[k]].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); - i = Bstrlen(boundkeys[ii[k]].cmd); + i = Bstrlen(KeyBindings[ii[k]].cmd); if (i) - boundkeys[ii[k]].cmd[i-2] = 0; // cut off the trailing "; " + KeyBindings[ii[k]].cmd[i-2] = 0; // cut off the trailing "; " } } @@ -973,12 +973,12 @@ void CONFIG_WriteBinds(void) // save binds and aliases to disk symbol_t *symb; fprintf(fp,"// this file automatically generated by EDuke32\n// do not modify if you lack common sense\n"); for (i=0;inext) if (symb->func == (void *)OSD_ALIAS) diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 6500f6adb..973e27a1c 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -438,7 +438,7 @@ typedef struct { int32_t loogiex[64], loogiey[64], numloogs, loogcnt; - char *palette; + uint8_t *palette; int16_t sbs, sound_pitch; @@ -620,7 +620,7 @@ extern int32_t packetrate; extern int32_t cachecount; extern char boardfilename[BMAX_PATH]; -extern char waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768],animpal[768]; +extern uint8_t waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768],animpal[768]; extern char currentboardfilename[BMAX_PATH]; extern char cachedebug,g_earthquakeTime; // 0: master/slave, 1: peer-to-peer @@ -989,7 +989,7 @@ typedef struct { int16_t numsectors; sectortype sector[MAXSECTORS]; spritetype sprite[MAXSPRITES]; - spriteexttype spriteext[MAXSPRITES]; + spriteext_t spriteext[MAXSPRITES]; int16_t headspritesect[MAXSECTORS+1]; int16_t prevspritesect[MAXSPRITES]; int16_t nextspritesect[MAXSPRITES]; @@ -1051,46 +1051,46 @@ typedef struct { int32_t id; } keydef_t; -extern keydef_t keynames[]; -extern char *mousenames[]; +extern keydef_t ConsoleKeys[]; +extern char *ConsoleButtons[]; extern char *duke3dgrp, *duke3dgrpstring; extern char mod_dir[BMAX_PATH]; -extern HASH_table gamevarH; -extern HASH_table arrayH; -extern HASH_table keywH; -extern HASH_table gamefuncH; +extern hashtable_t gamevarH; +extern hashtable_t arrayH; +extern hashtable_t keywH; +extern hashtable_t gamefuncH; enum DukePacket_t { - PACKET_TYPE_MASTER_TO_SLAVE, - PACKET_TYPE_SLAVE_TO_MASTER, - PACKET_TYPE_BROADCAST, + PACKET_MASTER_TO_SLAVE, + PACKET_SLAVE_TO_MASTER, + PACKET_BROADCAST, SERVER_GENERATED_BROADCAST, - PACKET_TYPE_VERSION, + PACKET_VERSION, /* don't change anything above this line */ - PACKET_TYPE_MESSAGE, + PACKET_MESSAGE, - PACKET_TYPE_NEW_GAME, - PACKET_TYPE_RTS, - PACKET_TYPE_MENU_LEVEL_QUIT, - PACKET_TYPE_WEAPON_CHOICE, - PACKET_TYPE_PLAYER_OPTIONS, - PACKET_TYPE_PLAYER_NAME, + PACKET_NEW_GAME, + PACKET_RTS, + PACKET_MENU_LEVEL_QUIT, + PACKET_WEAPON_CHOICE, + PACKET_PLAYER_OPTIONS, + PACKET_PLAYER_NAME, - PACKET_TYPE_USER_MAP, + PACKET_USER_MAP, - PACKET_TYPE_MAP_VOTE, - PACKET_TYPE_MAP_VOTE_INITIATE, - PACKET_TYPE_MAP_VOTE_CANCEL, + PACKET_MAP_VOTE, + PACKET_MAP_VOTE_INITIATE, + PACKET_MAP_VOTE_CANCEL, - PACKET_TYPE_LOAD_GAME, - PACKET_TYPE_NULL_PACKET, - PACKET_TYPE_PLAYER_READY, - PACKET_TYPE_QUIT = 255 // should match mmulti I think + PACKET_LOAD_GAME, + PACKET_NULL_PACKET, + PACKET_PLAYER_READY, + PACKET_QUIT = 255 // should match mmulti I think }; #ifdef __cplusplus diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h index ab4961d7d..706f85624 100644 --- a/polymer/eduke32/source/funct.h +++ b/polymer/eduke32/source/funct.h @@ -52,7 +52,7 @@ extern void pan3dsound(void); extern void S_TestSoundCallback(uint32_t num); extern void S_ClearSoundLocks(void); extern int32_t A_CallSound(int32_t sn,int32_t whatsprite); -extern int32_t check_activator_motion(int32_t lotag); +extern int32_t G_CheckActivatorMotion(int32_t lotag); extern int32_t CheckDoorTile(int32_t dapic); extern int32_t isanunderoperator(int32_t lotag); extern int32_t isanearoperator(int32_t lotag); @@ -195,7 +195,7 @@ extern void A_MoveDummyPlayers(void); // game.c extern inline void G_SetStatusBarScale(int32_t sc); -extern void P_SetGamePalette(DukePlayer_t *player, char *pal, int32_t set); +extern void P_SetGamePalette(DukePlayer_t *player, uint8_t *pal, int32_t set); extern void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step); extern int32_t gametext_z(int32_t small, int32_t starttile, int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t orientation,int32_t x1, int32_t y1, int32_t x2, int32_t y2,int32_t z); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 4dc65b935..cd7ddf1bb 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -86,7 +86,7 @@ static struct strllist char boardfilename[BMAX_PATH] = {0}, currentboardfilename[BMAX_PATH] = {0}; char root[BMAX_PATH]; -char waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768], animpal[768]; +uint8_t waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768], animpal[768]; static char firstdemofile[80] = { '\0' }; static int32_t userconfiles = 0; @@ -285,7 +285,7 @@ static void G_PatchStatusBar(int32_t x1, int32_t y1, int32_t x2, int32_t y2) // else rotatesprite(tx,ty,scl,0,BOTTOMSTATUSBAR,4,0,10+16+64,clx1,cly1,clx2+clofx-1,cly2+clofy-1); } -void P_SetGamePalette(DukePlayer_t *player, char *pal, int32_t set) +void P_SetGamePalette(DukePlayer_t *player, uint8_t *pal, int32_t set) { if (player != g_player[screenpeek].ps) { @@ -513,32 +513,6 @@ int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t return (x); } -static void allowtimetocorrecterrorswhenquitting(void) -{ - int32_t i, j, oldtotalclock; - - ready2send = 0; - - for (j=MAXPLAYERS-1;j>=0;j--) - { - oldtotalclock = totalclock; - - while (totalclock < oldtotalclock+TICSPERFRAME) - { - handleevents(); - Net_GetPackets(); - } - if (KB_KeyPressed(sc_Escape)) return; - - packbuf[0] = PACKET_TYPE_NULL_PACKET; - TRAVERSE_CONNECT(i) - { - if (i != myconnectindex) mmulti_sendpacket(i,packbuf,1); - if ((!g_networkBroadcastMode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master - } - } -} - void G_AddUserQuote(const char *daquote) { int32_t i; @@ -619,7 +593,7 @@ void Net_GetPackets(void) #endif switch (packbuf[0]) { - case PACKET_TYPE_MASTER_TO_SLAVE: //[0] (receive master sync buffer) + case PACKET_MASTER_TO_SLAVE: //[0] (receive master sync buffer) j = 1; if ((g_player[other].movefifoend&(TIMERUPDATESIZ-1)) == 0) @@ -710,7 +684,7 @@ void Net_GetPackets(void) movefifosendplc += g_movesPerPacket; break; - case PACKET_TYPE_SLAVE_TO_MASTER: //[1] (receive slave sync buffer) + case PACKET_SLAVE_TO_MASTER: //[1] (receive slave sync buffer) j = 3; k = packbuf[1] + (int32_t)(packbuf[2]<<8); @@ -748,7 +722,7 @@ void Net_GetPackets(void) break; - case PACKET_TYPE_BROADCAST: + case PACKET_BROADCAST: g_player[other].movefifoend = movefifoplc = movefifosendplc = predictfifoplc = 0; g_player[other].syncvalhead = syncvaltottail = 0L; case SERVER_GENERATED_BROADCAST: @@ -804,21 +778,21 @@ void Net_GetPackets(void) initprintf("INVALID GAME PACKET!!! (packet %d, %d too many bytes (%d %d))\n",packbuf[0],j-packbufleng,packbufleng,k); break; - case PACKET_TYPE_NULL_PACKET: + case PACKET_NULL_PACKET: break; - case PACKET_TYPE_PLAYER_READY: + case PACKET_PLAYER_READY: if (g_player[other].playerreadyflag == 0) initprintf("Player %d is ready\n", other); g_player[other].playerreadyflag++; return; - case PACKET_TYPE_QUIT: + case PACKET_QUIT: G_GameExit(" "); break; default: switch (packbuf[0]) { - case PACKET_TYPE_MESSAGE: + case PACKET_MESSAGE: //slaves in M/S mode only send to master if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) { @@ -848,7 +822,7 @@ void Net_GetPackets(void) break; - case PACKET_TYPE_NEW_GAME: + case PACKET_NEW_GAME: //Slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) @@ -883,7 +857,7 @@ void Net_GetPackets(void) break; - case PACKET_TYPE_VERSION: + case PACKET_VERSION: //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) @@ -908,7 +882,7 @@ void Net_GetPackets(void) break; - case PACKET_TYPE_PLAYER_OPTIONS: + case PACKET_PLAYER_OPTIONS: //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) @@ -926,7 +900,7 @@ void Net_GetPackets(void) break; - case PACKET_TYPE_PLAYER_NAME: + case PACKET_PLAYER_NAME: //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) @@ -942,7 +916,7 @@ void Net_GetPackets(void) break; - case PACKET_TYPE_WEAPON_CHOICE: + case PACKET_WEAPON_CHOICE: //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) @@ -957,7 +931,7 @@ void Net_GetPackets(void) for (;i-j<10;i++) g_player[other].wchoice[i-j] = packbuf[i]; break; - case PACKET_TYPE_RTS: + case PACKET_RTS: //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) @@ -976,7 +950,7 @@ void Net_GetPackets(void) g_RTSPlaying = 7; break; - case PACKET_TYPE_MENU_LEVEL_QUIT: + case PACKET_MENU_LEVEL_QUIT: //slaves in M/S mode only send to master if (myconnectindex == connecthead) { @@ -1012,7 +986,7 @@ void Net_GetPackets(void) break; - case PACKET_TYPE_USER_MAP: + case PACKET_USER_MAP: //slaves in M/S mode only send to master if (myconnectindex == connecthead) { @@ -1040,9 +1014,9 @@ void Net_GetPackets(void) break; - case PACKET_TYPE_MAP_VOTE: - case PACKET_TYPE_MAP_VOTE_INITIATE: - case PACKET_TYPE_MAP_VOTE_CANCEL: + case PACKET_MAP_VOTE: + case PACKET_MAP_VOTE_INITIATE: + case PACKET_MAP_VOTE_CANCEL: if (myconnectindex == connecthead) { @@ -1054,7 +1028,7 @@ void Net_GetPackets(void) switch (packbuf[0]) { - case PACKET_TYPE_MAP_VOTE: + case PACKET_MAP_VOTE: if (voting == myconnectindex && g_player[(uint8_t)packbuf[1]].gotvote == 0) { g_player[(uint8_t)packbuf[1]].gotvote = 1; @@ -1064,7 +1038,7 @@ void Net_GetPackets(void) } break; - case PACKET_TYPE_MAP_VOTE_INITIATE: // call map vote + case PACKET_MAP_VOTE_INITIATE: // call map vote /* if (g_networkBroadcastMode == 0 && packbuf[1] == connecthead) break; // ignore this from master */ voting = packbuf[1]; @@ -1088,7 +1062,7 @@ void Net_GetPackets(void) g_player[voting].gotvote = g_player[voting].vote = 1; break; - case PACKET_TYPE_MAP_VOTE_CANCEL: // cancel map vote + case PACKET_MAP_VOTE_CANCEL: // cancel map vote if (voting == packbuf[1]) { voting = -1; @@ -1110,7 +1084,7 @@ void Net_GetPackets(void) } break; - case PACKET_TYPE_LOAD_GAME: + case PACKET_LOAD_GAME: //Slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) @@ -1228,7 +1202,7 @@ void faketimerhandler(void) if (g_networkBroadcastMode == 1) { packbuf[0] = SERVER_GENERATED_BROADCAST; - if ((g_player[myconnectindex].movefifoend-1) == 0) packbuf[0] = PACKET_TYPE_BROADCAST; + if ((g_player[myconnectindex].movefifoend-1) == 0) packbuf[0] = PACKET_BROADCAST; j = 1; //Fix timers and buffer/jitter value @@ -1377,7 +1351,7 @@ void faketimerhandler(void) } } - packbuf[0] = PACKET_TYPE_SLAVE_TO_MASTER; + packbuf[0] = PACKET_SLAVE_TO_MASTER; packbuf[1] = 0; packbuf[2] = 0; j = 3; @@ -1433,7 +1407,7 @@ void faketimerhandler(void) TRAVERSE_CONNECT(i) if (g_player[i].movefifoend <= movefifosendplc) { - packbuf[0] = PACKET_TYPE_NULL_PACKET; + packbuf[0] = PACKET_NULL_PACKET; for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) mmulti_sendpacket(i,packbuf,1); return; @@ -1448,7 +1422,7 @@ void faketimerhandler(void) nsyn = (input_t *)&inputfifo[(movefifosendplc)&(MOVEFIFOSIZ-1)][0]; //MASTER -> SLAVE packet - packbuf[0] = PACKET_TYPE_MASTER_TO_SLAVE; + packbuf[0] = PACKET_MASTER_TO_SLAVE; j = 1; //Fix timers and buffer/jitter value @@ -2878,10 +2852,33 @@ extern int32_t g_doQuickSave; void G_GameExit(const char *t) { - if (*t != 0) g_player[myconnectindex].ps->palette = (char *) &palette[0]; + if (*t != 0) g_player[myconnectindex].ps->palette = (unsigned char *) &palette[0]; if (numplayers > 1) - allowtimetocorrecterrorswhenquitting(); + { + int32_t i, j, oldtotalclock; + + ready2send = 0; + + for (j=MAXPLAYERS-1;j>=0;j--) + { + oldtotalclock = totalclock; + + while (totalclock < oldtotalclock+TICSPERFRAME) + { + handleevents(); + Net_GetPackets(); + } + if (KB_KeyPressed(sc_Escape)) return; + + packbuf[0] = PACKET_NULL_PACKET; + TRAVERSE_CONNECT(i) + { + if (i != myconnectindex) mmulti_sendpacket(i,packbuf,1); + if ((!g_networkBroadcastMode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + } + } + } mmulti_uninitmultiplayers(); @@ -3016,7 +3013,7 @@ static void Net_EnterMessage(void) { if (g_chatPlayer != -1 || ud.multimode < 3 || g_movesPerPacket == 4) { - tempbuf[0] = PACKET_TYPE_MESSAGE; + tempbuf[0] = PACKET_MESSAGE; tempbuf[2] = 0; recbuf[0] = 0; @@ -4756,8 +4753,8 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3 if (show2dsector[SECT>>3]&(1<<(SECT&7))) show2dsprite[i>>3] |= (1<<(i&7)); else show2dsprite[i>>3] &= ~(1<<(i&7)); - clearbufbyte(&spriteext[i], sizeof(spriteexttype), 0); - clearbufbyte(&spritesmooth[i], sizeof(spritesmoothtype), 0); + clearbufbyte(&spriteext[i], sizeof(spriteext_t), 0); + clearbufbyte(&spritesmooth[i], sizeof(spritesmooth_t), 0); /* if(s->sectnum < 0) @@ -8221,7 +8218,7 @@ static void G_HandleLocalKeys(void) { if (KB_UnBoundKeyPressed(sc_F1) || KB_UnBoundKeyPressed(sc_F2) || ud.autovote) { - tempbuf[0] = PACKET_TYPE_MAP_VOTE; + tempbuf[0] = PACKET_MAP_VOTE; tempbuf[1] = myconnectindex; tempbuf[2] = (KB_UnBoundKeyPressed(sc_F1) || ud.autovote?ud.autovote-1:0); @@ -8407,7 +8404,7 @@ static void G_HandleLocalKeys(void) ch = 0; - tempbuf[ch] = PACKET_TYPE_MESSAGE; + tempbuf[ch] = PACKET_MESSAGE; tempbuf[ch+1] = 255; tempbuf[ch+2] = 0; Bstrcat(tempbuf+2,ud.ridecule[i-1]); @@ -8440,7 +8437,7 @@ static void G_HandleLocalKeys(void) if (ud.multimode > 1) { - tempbuf[0] = PACKET_TYPE_RTS; + tempbuf[0] = PACKET_RTS; tempbuf[1] = i; TRAVERSE_CONNECT(ch) @@ -9083,25 +9080,25 @@ static char *makename(char *destname, char *OGGname, char *origname) if (!origname) return destname; - if (destname) - Bfree(destname); - destname = Bcalloc(Bstrlen(OGGname) + Bstrlen(origname) + 1, sizeof(uint8_t)); + destname = Brealloc(destname, Bstrlen(OGGname) + Bstrlen(origname) + 1); + if (!destname) return NULL; - Bstrcpy(destname,(*OGGname)?OGGname:origname); + Bstrcpy(destname, (*OGGname)?OGGname:origname); - if (*OGGname&&OGGname[Bstrlen(OGGname)-1]=='/') + if (*OGGname && OGGname[Bstrlen(OGGname)-1] == '/') { - while (*origname=='/') + while (*origname == '/') origname++; - Bstrcat(destname,origname); + Bstrcat(destname, origname); } - OGGname=Bstrchr(destname,'.'); + OGGname = Bstrchr(destname, '.'); + if (OGGname) - Bstrcpy(OGGname,".ogg"); - else Bstrcat(destname,".ogg"); + Bstrcpy(OGGname, ".ogg"); + else Bstrcat(destname, ".ogg"); return destname; } @@ -10186,7 +10183,7 @@ static void G_FreeMemory(void) // if (MusicPtr != NULL) Bfree(MusicPtr); // C_FreeHashes(); - HASH_free(&gamefuncH); + hash_free(&gamefuncH); } /* @@ -10534,7 +10531,7 @@ void Net_SendQuit(void) { int32_t i; - tempbuf[0] = PACKET_TYPE_MENU_LEVEL_QUIT; + tempbuf[0] = PACKET_MENU_LEVEL_QUIT; tempbuf[1] = myconnectindex; TRAVERSE_CONNECT(i) @@ -10556,7 +10553,7 @@ static void Net_SendWeaponChoice(void) { int32_t i,l; - buf[0] = PACKET_TYPE_WEAPON_CHOICE; + buf[0] = PACKET_WEAPON_CHOICE; buf[1] = myconnectindex; l = 2; @@ -10579,7 +10576,7 @@ static void Net_SendVersion(void) if (numplayers < 2) return; - buf[0] = PACKET_TYPE_VERSION; + buf[0] = PACKET_VERSION; buf[1] = myconnectindex; buf[2] = (uint8_t)atoi(s_buildDate); buf[3] = BYTEVERSION; @@ -10597,7 +10594,7 @@ static void Net_SendPlayerOptions(void) { int32_t i,l; - buf[0] = PACKET_TYPE_PLAYER_OPTIONS; + buf[0] = PACKET_PLAYER_OPTIONS; buf[1] = myconnectindex; l = 2; @@ -10628,7 +10625,7 @@ void Net_SendPlayerName(void) if (numplayers < 2) return; - buf[0] = PACKET_TYPE_PLAYER_NAME; + buf[0] = PACKET_PLAYER_NAME; buf[1] = myconnectindex; l = 2; @@ -10650,7 +10647,7 @@ void Net_SendUserMapName(void) int32_t j; int32_t ch; - packbuf[0] = PACKET_TYPE_USER_MAP; + packbuf[0] = PACKET_USER_MAP; packbuf[1] = 0; Bcorrectfilename(boardfilename,0); @@ -10671,7 +10668,7 @@ void Net_NewGame(int32_t volume, int32_t level) { int32_t i; - packbuf[0] = PACKET_TYPE_NEW_GAME; + packbuf[0] = PACKET_NEW_GAME; packbuf[1] = ud.m_level_number = level; packbuf[2] = ud.m_volume_number = volume; packbuf[3] = ud.m_player_skill+1; @@ -10691,27 +10688,6 @@ void Net_NewGame(int32_t volume, int32_t level) } } -#if 0 -static void getnames(void) -{ - int32_t l; - - if (numplayers > 1) - { - Net_SendVersion(); - Net_SendPlayerName(); - Net_SendPlayerOptions(); - Net_SendWeaponChoice(); - Net_SendUserMapName(); - getpackets(); - waitforeverybody(); - } - - if (cp == 1 && numplayers < 2) - G_GameExit("Please put the Duke Nukem 3D Atomic Edition CD in the CD-ROM drive."); -} -#endif - void G_UpdatePlayerFromMenu(void) { if (ud.recstat != 0) @@ -10725,13 +10701,13 @@ void G_UpdatePlayerFromMenu(void) } else { - int32_t j; + /*int32_t j = g_player[myconnectindex].ps->team;*/ g_player[myconnectindex].ps->aim_mode = ud.mouseaiming; g_player[myconnectindex].ps->auto_aim = ud.config.AutoAim; g_player[myconnectindex].ps->weaponswitch = ud.weaponswitch; g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = ud.color; - j = g_player[myconnectindex].ps->team; + g_player[myconnectindex].pteam = ud.team; if (sprite[g_player[myconnectindex].ps->i].picnum == APLAYER && sprite[g_player[myconnectindex].ps->i].pal != 1) @@ -10928,12 +10904,12 @@ void app_main(int32_t argc,const char **argv) ud.config.CheckForUpdates = -1; #endif - HASH_init(&gamefuncH); + hash_init(&gamefuncH); for (i=NUMGAMEFUNCTIONS-1;i>=0;i--) { char *str = strtolower(Bstrdup(gamefunctions[i]),Bstrlen(gamefunctions[i])); - HASH_add(&gamefuncH,gamefunctions[i],i); - HASH_add(&gamefuncH,str,i); + hash_add(&gamefuncH,gamefunctions[i],i); + hash_add(&gamefuncH,str,i); Bfree(str); } @@ -10990,10 +10966,12 @@ void app_main(int32_t argc,const char **argv) if (!ShellExecuteExA(&sinfo)) initprintf("update: error launching browser!\n"); +/* CONFIG_SetupMouse(); CONFIG_SetupJoystick(); CONFIG_WriteSetup(); G_GameExit(" "); +*/ } } else initprintf("... no updates available\n"); @@ -11280,7 +11258,7 @@ CLEAN_DIRECTORY: g_player[i].sync = (input_t *) Bcalloc(1,sizeof(input_t)); } - g_player[myconnectindex].ps->palette = (char *) &palette[0]; + g_player[myconnectindex].ps->palette = (uint8_t *) &palette[0]; i = 1; for (j=numplayers;j 1) { - sendlogon(); + mmulti_sendlogon(); Net_SendPlayerOptions(); Net_SendWeaponChoice(); Net_SendUserMapName(); diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 861f247cc..d5385407e 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -940,20 +940,20 @@ const memberlabel_t InputLabels[]= char *bitptr; // pointer to bitmap of which bytecode positions contain pointers #define BITPTR_POINTER 1 -HASH_table gamevarH = { MAXGAMEVARS>>1, NULL }; -HASH_table arrayH = { MAXGAMEARRAYS>>1, NULL }; -HASH_table labelH = { 11264>>1, NULL }; -HASH_table keywH = { CON_END>>1, NULL }; +hashtable_t gamevarH = { MAXGAMEVARS>>1, NULL }; +hashtable_t arrayH = { MAXGAMEARRAYS>>1, NULL }; +hashtable_t labelH = { 11264>>1, NULL }; +hashtable_t keywH = { CON_END>>1, NULL }; -HASH_table sectorH = { SECTOR_END>>1, NULL }; -HASH_table wallH = { WALL_END>>1, NULL }; -HASH_table userdefH = { USERDEFS_END>>1, NULL }; +hashtable_t sectorH = { SECTOR_END>>1, NULL }; +hashtable_t wallH = { WALL_END>>1, NULL }; +hashtable_t userdefH = { USERDEFS_END>>1, NULL }; -HASH_table projectileH = { PROJ_END>>1, NULL }; -HASH_table playerH = { PLAYER_END>>1, NULL }; -HASH_table inputH = { INPUT_END>>1, NULL }; -HASH_table actorH = { ACTOR_END>>1, NULL }; -HASH_table tspriteH = { ACTOR_END>>1, NULL }; +hashtable_t projectileH = { PROJ_END>>1, NULL }; +hashtable_t playerH = { PLAYER_END>>1, NULL }; +hashtable_t inputH = { INPUT_END>>1, NULL }; +hashtable_t actorH = { ACTOR_END>>1, NULL }; +hashtable_t tspriteH = { ACTOR_END>>1, NULL }; void inithashnames(); void freehashnames(); @@ -962,47 +962,47 @@ void C_InitHashes() { int32_t i; - HASH_init(&gamevarH); - HASH_init(&arrayH); - HASH_init(&labelH); + hash_init(&gamevarH); + hash_init(&arrayH); + hash_init(&labelH); inithashnames(); - HASH_init(&keywH); + hash_init(&keywH); for (i=NUMKEYWORDS-1;i>=0;i--) - HASH_add(&keywH,keyw[i],i); + hash_add(&keywH,keyw[i],i); - HASH_init(§orH); + hash_init(§orH); for (i=0;SectorLabels[i].lId >=0 ; i++) - HASH_add(§orH,SectorLabels[i].name,i); - HASH_init(&wallH); + hash_add(§orH,SectorLabels[i].name,i); + hash_init(&wallH); for (i=0;WallLabels[i].lId >=0 ; i++) - HASH_add(&wallH,WallLabels[i].name,i); - HASH_init(&userdefH); + hash_add(&wallH,WallLabels[i].name,i); + hash_init(&userdefH); for (i=0;UserdefsLabels[i].lId >=0 ; i++) - HASH_add(&userdefH,UserdefsLabels[i].name,i); + hash_add(&userdefH,UserdefsLabels[i].name,i); - HASH_init(&projectileH); + hash_init(&projectileH); for (i=0;ProjectileLabels[i].lId >=0 ; i++) - HASH_add(&projectileH,ProjectileLabels[i].name,i); - HASH_init(&playerH); + hash_add(&projectileH,ProjectileLabels[i].name,i); + hash_init(&playerH); for (i=0;PlayerLabels[i].lId >=0 ; i++) - HASH_add(&playerH,PlayerLabels[i].name,i); - HASH_init(&inputH); + hash_add(&playerH,PlayerLabels[i].name,i); + hash_init(&inputH); for (i=0;InputLabels[i].lId >=0 ; i++) - HASH_add(&inputH,InputLabels[i].name,i); - HASH_init(&actorH); + hash_add(&inputH,InputLabels[i].name,i); + hash_init(&actorH); for (i=0;ActorLabels[i].lId >=0 ; i++) - HASH_add(&actorH,ActorLabels[i].name,i); - HASH_init(&tspriteH); + hash_add(&actorH,ActorLabels[i].name,i); + hash_init(&tspriteH); for (i=0;TsprLabels[i].lId >=0 ; i++) - HASH_add(&tspriteH,TsprLabels[i].name,i); + hash_add(&tspriteH,TsprLabels[i].name,i); } void C_FreeHashes(void) { - HASH_free(&gamevarH); - HASH_free(&arrayH); - HASH_free(&labelH); + hash_free(&gamevarH); + hash_free(&arrayH); + hash_free(&labelH); } #define IFELSE_MAGIC 31337 @@ -1031,15 +1031,14 @@ static int32_t C_IncreaseScriptSize(int32_t size) scriptptrs = Bcalloc(1,g_scriptSize * sizeof(uint8_t)); for (i=g_scriptSize-1;i>=0;i--) { -// initprintf("%d\n",i); - /* if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) && !((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize]))) - { - g_numCompilerErrors++; - initprintf("Internal compiler error at %d (0x%x)\n",i,i); - } */ + if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) && !((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize]))) + { + g_numCompilerErrors++; + initprintf("Internal compiler error at %d (0x%x)\n",i,i); + } // if (bitptr[i] == 0 && ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize]))) // initprintf("oh no!\n"); - if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) /*&& ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize]))*/) + if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7))) { scriptptrs[i] = 1; script[i] -= (intptr_t)&script[0]; @@ -1381,8 +1380,8 @@ static int32_t C_CheckEventSync(int32_t iEventID) return 1; } -#define GetDefID(szGameLabel) HASH_find(&gamevarH,szGameLabel) -#define GetADefID(szGameLabel) HASH_find(&arrayH,szGameLabel) +#define GetDefID(szGameLabel) hash_find(&gamevarH,szGameLabel) +#define GetADefID(szGameLabel) hash_find(&arrayH,szGameLabel) static inline int32_t ispecial(char c) { @@ -1403,25 +1402,25 @@ static inline int32_t isaltok(char c) return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.'); } -static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, HASH_table *tH, const char *psz) +static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, hashtable_t *tH, const char *psz) { // find the label psz in the table pLabel. // returns the ID for the label, or -1 int32_t l=-1; - l = HASH_findcase(tH,psz); + l = hash_findcase(tH,psz); if (l>=0) l= pLabel[l].lId; return l; } -static inline int32_t C_GetLabelNameOffset(HASH_table *tH, const char *psz) +static inline int32_t C_GetLabelNameOffset(hashtable_t *tH, const char *psz) { // find the label psz in the table pLabel. // returns the offset in the array for the label, or -1 - return HASH_findcase(tH,psz); + return hash_findcase(tH,psz); } static void C_GetNextLabelName(void) @@ -1467,7 +1466,7 @@ static int32_t C_GetKeyword(void) while (isaltok(*temptextptr)) tempbuf[i++] = *(temptextptr++); tempbuf[i] = 0; - return HASH_find(&keywH,tempbuf); + return hash_find(&keywH,tempbuf); } static int32_t C_GetNextKeyword(void) //Returns its code # @@ -1497,7 +1496,7 @@ static int32_t C_GetNextKeyword(void) //Returns its code # } tempbuf[l] = 0; - i = HASH_find(&keywH,tempbuf); + i = hash_find(&keywH,tempbuf); if (i>=0) { if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP) @@ -1516,12 +1515,12 @@ static int32_t C_GetNextKeyword(void) //Returns its code # if (tempbuf[0] == '{' && tempbuf[1] != 0) { C_ReportError(-1); - initprintf("%s:%d: error: expected a SPACE or CR between `{' and `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf+1); + initprintf("%s:%d: error: expected whitespace between `{' and `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf+1); } else if (tempbuf[0] == '}' && tempbuf[1] != 0) { C_ReportError(-1); - initprintf("%s:%d: error: expected a SPACE or CR between `}' and `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf+1); + initprintf("%s:%d: error: expected whitespace between `}' and `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf+1); } else C_ReportError(ERROR_EXPECTEDKEYWORD); g_numCompilerErrors++; @@ -1542,7 +1541,7 @@ static void C_GetNextVarType(int32_t type) if (tolower(textptr[1])=='x') sscanf(textptr+2,"%" PRIxPTR "",g_scriptPtr); else - *g_scriptPtr=atol(textptr); + *g_scriptPtr=atoi(textptr); bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); g_scriptPtr++; C_GetNextLabelName(); @@ -1566,7 +1565,7 @@ static void C_GetNextVarType(int32_t type) } C_GetNextLabelName(); - if (!g_skipKeywordCheck && HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (!g_skipKeywordCheck && hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); @@ -1579,7 +1578,6 @@ static void C_GetNextVarType(int32_t type) int32_t lLabelID = -1; f |= (MAXGAMEVARS<<2); -// initprintf("got an array"); textptr++; i=GetADefID(label+(g_numLabels<<6)); if (i < 0) @@ -1696,7 +1694,7 @@ static void C_GetNextVarType(int32_t type) { //try looking for a define instead Bstrcpy(tempbuf,label+(g_numLabels<<6)); - i = HASH_find(&labelH,tempbuf); + i = hash_find(&labelH,tempbuf); if (i>=0) { if (labeltype[i] & LABEL_DEFINE) @@ -1735,7 +1733,9 @@ static void C_GetNextVarType(int32_t type) if ((aGameVars[i].dwFlags & GAMEVAR_SYNCCHECK) && g_parsingActorPtr && C_CheckEventSync(g_currentEvent)) { C_ReportError(-1); - initprintf("%s:%d: warning: found local gamevar `%s' used within %s; expect multiplayer synchronization issues.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6),g_parsingEventPtr?"a synced event":"an actor"); + initprintf("%s:%d: warning: found local gamevar `%s' used within %s; " + "expect multiplayer synchronization issues.\n",g_szScriptFileName, + g_lineNumber,label+(g_numLabels<<6),g_parsingEventPtr?"a synced event":"an actor"); g_numCompilerWarnings++; } if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) @@ -1745,10 +1745,7 @@ static void C_GetNextVarType(int32_t type) *g_scriptPtr++=(i|f); } -static inline void C_GetNextVar(void) -{ - C_GetNextVarType(0); -} +#define C_GetNextVar() C_GetNextVarType(0) static inline void C_GetManyVarsType(int32_t type, int32_t num) { @@ -1757,10 +1754,7 @@ static inline void C_GetManyVarsType(int32_t type, int32_t num) C_GetNextVarType(type); } -static inline void C_GetManyVars(int32_t num) -{ - C_GetManyVarsType(0,num); -} +#define C_GetManyVars(num) C_GetManyVarsType(0,num) static int32_t C_GetNextValue(int32_t type) { @@ -1784,14 +1778,14 @@ static int32_t C_GetNextValue(int32_t type) } tempbuf[l] = 0; - if (!g_skipKeywordCheck && HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (!g_skipKeywordCheck && hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); textptr+=l; } - i = HASH_find(&labelH,tempbuf); + i = hash_find(&labelH,tempbuf); if (i>=0) { char *el,*gl; @@ -1817,7 +1811,7 @@ static int32_t C_GetNextValue(int32_t type) el = (char *)C_GetLabelType(type); gl = (char *)C_GetLabelType(labeltype[i]); C_ReportError(-1); - initprintf("%s:%d: warning: expected a %s, found a %s.\n",g_szScriptFileName,g_lineNumber,el,gl); + initprintf("%s:%d: warning: expected %s, found %s.\n",g_szScriptFileName,g_lineNumber,el,gl); g_numCompilerWarnings++; Bfree(el); Bfree(gl); @@ -1844,11 +1838,12 @@ static int32_t C_GetNextValue(int32_t type) i = l-1; do { + // FIXME: check for 0-9 A-F for hex if (textptr[0] == '0' && textptr[1] == 'x') break; // kill the warning for hex if (!isdigit(textptr[i--])) { C_ReportError(-1); - initprintf("%s:%d: warning: invalid character in definition: '%c'!\n",g_szScriptFileName,g_lineNumber,textptr[i+1]); + initprintf("%s:%d: warning: invalid character `%c' in definition!\n",g_szScriptFileName,g_lineNumber,textptr[i+1]); g_numCompilerWarnings++; break; } @@ -1980,28 +1975,28 @@ static int32_t C_ParseCommand(void) g_processingState = 1; Bsprintf(g_szCurrentBlockName,"%s",label+(g_numLabels<<6)); - HASH_add(&labelH,label+(g_numLabels<<6),g_numLabels); + hash_add(&labelH,label+(g_numLabels<<6),g_numLabels); g_numLabels++; return 0; } C_GetNextLabelName(); - if (HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); return 0; } - i = HASH_find(&gamevarH,label+(g_numLabels<<6)); + i = hash_find(&gamevarH,label+(g_numLabels<<6)); if (i>=0) { g_numCompilerWarnings++; C_ReportError(WARNING_NAMEMATCHESVAR); } - j = HASH_find(&labelH,label+(g_numLabels<<6)); + j = hash_find(&labelH,label+(g_numLabels<<6)); if (j>=0) { if (labeltype[j] & LABEL_STATE) @@ -2019,7 +2014,7 @@ static int32_t C_ParseCommand(void) { char *gl = (char *)C_GetLabelType(labeltype[j]); C_ReportError(-1); - initprintf("%s:%d: warning: expected a state, found a %s.\n",g_szScriptFileName,g_lineNumber,gl); + initprintf("%s:%d: warning: expected state, found %s.\n",g_szScriptFileName,g_lineNumber,gl); g_numCompilerWarnings++; Bfree(gl); *(g_scriptPtr-1) = CON_NULLOP; // get rid of the state, leaving a nullop to satisfy if conditions @@ -2166,7 +2161,7 @@ static int32_t C_ParseCommand(void) //printf("Got Label '%.20s'\n",textptr); // Check to see it's already defined - if (HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); @@ -2211,14 +2206,14 @@ static int32_t C_ParseCommand(void) //printf("Got Label '%.20s'\n",textptr); // Check to see it's already defined - if (HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); return 0; } - i = HASH_find(&gamevarH,label+(g_numLabels<<6)); + i = hash_find(&gamevarH,label+(g_numLabels<<6)); if (i>=0) { g_numCompilerWarnings++; @@ -2239,21 +2234,21 @@ static int32_t C_ParseCommand(void) //printf("Got label. '%.20s'\n",textptr); // Check to see it's already defined - if (HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); return 0; } - i = HASH_find(&gamevarH,label+(g_numLabels<<6)); + i = hash_find(&gamevarH,label+(g_numLabels<<6)); if (i>=0) { g_numCompilerWarnings++; C_ReportError(WARNING_NAMEMATCHESVAR); } - i = HASH_find(&labelH,label+(g_numLabels<<6)); + i = hash_find(&labelH,label+(g_numLabels<<6)); if (i>=0) { /* if (i >= g_numDefaultLabels) @@ -2269,7 +2264,7 @@ static int32_t C_ParseCommand(void) if (i == -1) { // printf("Defining Definition '%s' to be '%d'\n",label+(g_numLabels<<6),*(g_scriptPtr-1)); - HASH_add(&labelH,label+(g_numLabels<<6),g_numLabels); + hash_add(&labelH,label+(g_numLabels<<6),g_numLabels); labeltype[g_numLabels] = LABEL_DEFINE; labelcode[g_numLabels++] = *(g_scriptPtr-1); if (*(g_scriptPtr-1) >= 0 && *(g_scriptPtr-1) < MAXTILES && g_dynamicTileMapping) @@ -2332,21 +2327,21 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); // Check to see it's already defined - if (HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); return 0; } - i = HASH_find(&gamevarH,label+(g_numLabels<<6)); + i = hash_find(&gamevarH,label+(g_numLabels<<6)); if (i>=0) { g_numCompilerWarnings++; C_ReportError(WARNING_NAMEMATCHESVAR); } - i = HASH_find(&labelH,label+(g_numLabels<<6)); + i = hash_find(&labelH,label+(g_numLabels<<6)); if (i>=0) { g_numCompilerWarnings++; @@ -2354,7 +2349,7 @@ static int32_t C_ParseCommand(void) } if (i == -1) { - HASH_add(&labelH,label+(g_numLabels<<6),g_numLabels); + hash_add(&labelH,label+(g_numLabels<<6),g_numLabels); labeltype[g_numLabels] = LABEL_MOVE; labelcode[g_numLabels++] = (intptr_t) g_scriptPtr; } @@ -2534,21 +2529,21 @@ static int32_t C_ParseCommand(void) g_scriptPtr--; C_GetNextLabelName(); - if (HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); return 0; } - i = HASH_find(&gamevarH,label+(g_numLabels<<6)); + i = hash_find(&gamevarH,label+(g_numLabels<<6)); if (i>=0) { g_numCompilerWarnings++; C_ReportError(WARNING_NAMEMATCHESVAR); } - i = HASH_find(&labelH,label+(g_numLabels<<6)); + i = hash_find(&labelH,label+(g_numLabels<<6)); if (i>=0) { g_numCompilerWarnings++; @@ -2558,7 +2553,7 @@ static int32_t C_ParseCommand(void) if (i == -1) { labeltype[g_numLabels] = LABEL_AI; - HASH_add(&labelH,label+(g_numLabels<<6),g_numLabels); + hash_add(&labelH,label+(g_numLabels<<6),g_numLabels); labelcode[g_numLabels++] = (intptr_t) g_scriptPtr; } @@ -2615,21 +2610,21 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); // Check to see it's already defined - if (HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); return 0; } - i = HASH_find(&gamevarH,label+(g_numLabels<<6)); + i = hash_find(&gamevarH,label+(g_numLabels<<6)); if (i>=0) { g_numCompilerWarnings++; C_ReportError(WARNING_NAMEMATCHESVAR); } - i = HASH_find(&labelH,label+(g_numLabels<<6)); + i = hash_find(&labelH,label+(g_numLabels<<6)); if (i>=0) { g_numCompilerWarnings++; @@ -2640,7 +2635,7 @@ static int32_t C_ParseCommand(void) { labeltype[g_numLabels] = LABEL_ACTION; labelcode[g_numLabels] = (intptr_t) g_scriptPtr; - HASH_add(&labelH,label+(g_numLabels<<6),g_numLabels); + hash_add(&labelH,label+(g_numLabels<<6),g_numLabels); g_numLabels++; } @@ -3535,7 +3530,7 @@ static int32_t C_ParseCommand(void) //printf("found label of '%s'\n", label+(g_numLabels<<6)); // Check to see if it's a keyword - if (HASH_find(&keywH,label+(g_numLabels<<6))>=0) + if (hash_find(&keywH,label+(g_numLabels<<6))>=0) { g_numCompilerErrors++; C_ReportError(ERROR_ISAKEYWORD); @@ -4947,10 +4942,10 @@ repeatcase: } gamefunctions[j][i] = '\0'; keydefaults[j*3][i] = '\0'; - HASH_add(&gamefuncH,gamefunctions[j],j); + hash_add(&gamefuncH,gamefunctions[j],j); { char *str = strtolower(Bstrdup(gamefunctions[j]),Bstrlen(gamefunctions[j])); - HASH_add(&gamefuncH,str,j); + hash_add(&gamefuncH,str,j); Bfree(str); } @@ -5321,7 +5316,7 @@ repeatcase: if (k > 25) { - initprintf("%s:%d: error: cheat redefinition attempts to redefine nonexistant cheat.\n",g_szScriptFileName,g_lineNumber); + initprintf("%s:%d: error: cheat redefinition attempts to redefine nonexistent cheat.\n",g_szScriptFileName,g_lineNumber); g_numCompilerErrors++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; @@ -5597,6 +5592,7 @@ repeatcase: return 0; } +/* #define NUM_DEFAULT_CONS 4 static const char *defaultcons[NUM_DEFAULT_CONS] = { @@ -5633,145 +5629,146 @@ void copydefaultcons(void) fclose(fpo); } } +*/ -/* Anything added with AddDefinition() cannot be overwritten in the CONs */ +/* Anything added with C_AddDefinition() cannot be overwritten in the CONs */ -static void AddDefinition(const char *lLabel,int32_t lValue,int32_t lType) +static void C_AddDefinition(const char *lLabel,int32_t lValue,int32_t lType) { Bstrcpy(label+(g_numLabels<<6),lLabel); labeltype[g_numLabels] = lType; - HASH_add(&labelH,label+(g_numLabels<<6),g_numLabels); + hash_add(&labelH,label+(g_numLabels<<6),g_numLabels); labelcode[g_numLabels++] = lValue; g_numDefaultLabels++; } static void C_AddDefaultDefinitions(void) { - AddDefinition("EVENT_AIMDOWN",EVENT_AIMDOWN,LABEL_DEFINE); - AddDefinition("EVENT_AIMUP",EVENT_AIMUP,LABEL_DEFINE); - AddDefinition("EVENT_ANIMATESPRITES",EVENT_ANIMATESPRITES,LABEL_DEFINE); - AddDefinition("EVENT_CHANGEWEAPON",EVENT_CHANGEWEAPON,LABEL_DEFINE); - AddDefinition("EVENT_CHEATGETBOOT",EVENT_CHEATGETBOOT,LABEL_DEFINE); - AddDefinition("EVENT_CHEATGETFIRSTAID",EVENT_CHEATGETFIRSTAID,LABEL_DEFINE); - AddDefinition("EVENT_CHEATGETHEAT",EVENT_CHEATGETHEAT,LABEL_DEFINE); - AddDefinition("EVENT_CHEATGETHOLODUKE",EVENT_CHEATGETHOLODUKE,LABEL_DEFINE); - AddDefinition("EVENT_CHEATGETJETPACK",EVENT_CHEATGETJETPACK,LABEL_DEFINE); - AddDefinition("EVENT_CHEATGETSCUBA",EVENT_CHEATGETSCUBA,LABEL_DEFINE); - AddDefinition("EVENT_CHEATGETSHIELD",EVENT_CHEATGETSHIELD,LABEL_DEFINE); - AddDefinition("EVENT_CHEATGETSTEROIDS",EVENT_CHEATGETSTEROIDS,LABEL_DEFINE); - AddDefinition("EVENT_CROUCH",EVENT_CROUCH,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYCROSSHAIR",EVENT_DISPLAYCROSSHAIR,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYREST",EVENT_DISPLAYREST,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYBONUSSCREEN",EVENT_DISPLAYBONUSSCREEN,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYMENU",EVENT_DISPLAYMENU,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYMENUREST",EVENT_DISPLAYMENUREST,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYLOADINGSCREEN",EVENT_DISPLAYLOADINGSCREEN,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYROOMS",EVENT_DISPLAYROOMS,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYSBAR",EVENT_DISPLAYSBAR,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYWEAPON",EVENT_DISPLAYWEAPON,LABEL_DEFINE); - AddDefinition("EVENT_DOFIRE",EVENT_DOFIRE,LABEL_DEFINE); - AddDefinition("EVENT_DRAWWEAPON",EVENT_DRAWWEAPON,LABEL_DEFINE); - AddDefinition("EVENT_EGS",EVENT_EGS,LABEL_DEFINE); - AddDefinition("EVENT_ENTERLEVEL",EVENT_ENTERLEVEL,LABEL_DEFINE); - AddDefinition("EVENT_FAKEDOMOVETHINGS",EVENT_FAKEDOMOVETHINGS,LABEL_DEFINE); - AddDefinition("EVENT_FIRE",EVENT_FIRE,LABEL_DEFINE); - AddDefinition("EVENT_FIREWEAPON",EVENT_FIREWEAPON,LABEL_DEFINE); - AddDefinition("EVENT_GAME",EVENT_GAME,LABEL_DEFINE); - AddDefinition("EVENT_GETAUTOAIMANGLE",EVENT_GETAUTOAIMANGLE,LABEL_DEFINE); - AddDefinition("EVENT_GETLOADTILE",EVENT_GETLOADTILE,LABEL_DEFINE); - AddDefinition("EVENT_GETMENUTILE",EVENT_GETMENUTILE,LABEL_DEFINE); - AddDefinition("EVENT_GETSHOTRANGE",EVENT_GETSHOTRANGE,LABEL_DEFINE); - AddDefinition("EVENT_HOLODUKEOFF",EVENT_HOLODUKEOFF,LABEL_DEFINE); - AddDefinition("EVENT_HOLODUKEON",EVENT_HOLODUKEON,LABEL_DEFINE); - AddDefinition("EVENT_HOLSTER",EVENT_HOLSTER,LABEL_DEFINE); - AddDefinition("EVENT_INCURDAMAGE",EVENT_INCURDAMAGE,LABEL_DEFINE); - AddDefinition("EVENT_INIT",EVENT_INIT,LABEL_DEFINE); - AddDefinition("EVENT_INVENTORY",EVENT_INVENTORY,LABEL_DEFINE); - AddDefinition("EVENT_INVENTORYLEFT",EVENT_INVENTORYLEFT,LABEL_DEFINE); - AddDefinition("EVENT_INVENTORYRIGHT",EVENT_INVENTORYRIGHT,LABEL_DEFINE); - AddDefinition("EVENT_JUMP",EVENT_JUMP,LABEL_DEFINE); - AddDefinition("EVENT_LOGO",EVENT_LOGO,LABEL_DEFINE); - AddDefinition("EVENT_LOOKDOWN",EVENT_LOOKDOWN,LABEL_DEFINE); - AddDefinition("EVENT_LOOKLEFT",EVENT_LOOKLEFT,LABEL_DEFINE); - AddDefinition("EVENT_LOOKRIGHT",EVENT_LOOKRIGHT,LABEL_DEFINE); - AddDefinition("EVENT_LOOKUP",EVENT_LOOKUP,LABEL_DEFINE); - AddDefinition("EVENT_MOVEBACKWARD",EVENT_MOVEBACKWARD,LABEL_DEFINE); - AddDefinition("EVENT_MOVEFORWARD",EVENT_MOVEFORWARD,LABEL_DEFINE); - AddDefinition("EVENT_NEXTWEAPON",EVENT_NEXTWEAPON,LABEL_DEFINE); - AddDefinition("EVENT_PREVIOUSWEAPON",EVENT_PREVIOUSWEAPON,LABEL_DEFINE); - AddDefinition("EVENT_PRESSEDFIRE",EVENT_PRESSEDFIRE,LABEL_DEFINE); - AddDefinition("EVENT_PROCESSINPUT",EVENT_PROCESSINPUT,LABEL_DEFINE); - AddDefinition("EVENT_QUICKKICK",EVENT_QUICKKICK,LABEL_DEFINE); - AddDefinition("EVENT_RESETINVENTORY",EVENT_RESETINVENTORY,LABEL_DEFINE); - AddDefinition("EVENT_RESETPLAYER",EVENT_RESETPLAYER,LABEL_DEFINE); - AddDefinition("EVENT_RESETWEAPONS",EVENT_RESETWEAPONS,LABEL_DEFINE); - AddDefinition("EVENT_RETURNTOCENTER",EVENT_RETURNTOCENTER,LABEL_DEFINE); - AddDefinition("EVENT_SELECTWEAPON",EVENT_SELECTWEAPON,LABEL_DEFINE); - AddDefinition("EVENT_SOARDOWN",EVENT_SOARDOWN,LABEL_DEFINE); - AddDefinition("EVENT_SOARUP",EVENT_SOARUP,LABEL_DEFINE); - AddDefinition("EVENT_SPAWN",EVENT_SPAWN,LABEL_DEFINE); - AddDefinition("EVENT_STRAFELEFT",EVENT_STRAFELEFT,LABEL_DEFINE); - AddDefinition("EVENT_STRAFERIGHT",EVENT_STRAFERIGHT,LABEL_DEFINE); - AddDefinition("EVENT_SWIMDOWN",EVENT_SWIMDOWN,LABEL_DEFINE); - AddDefinition("EVENT_SWIMUP",EVENT_SWIMUP,LABEL_DEFINE); - AddDefinition("EVENT_TURNAROUND",EVENT_TURNAROUND,LABEL_DEFINE); - AddDefinition("EVENT_TURNLEFT",EVENT_TURNLEFT,LABEL_DEFINE); - AddDefinition("EVENT_TURNRIGHT",EVENT_TURNRIGHT,LABEL_DEFINE); - AddDefinition("EVENT_USE",EVENT_USE,LABEL_DEFINE); - AddDefinition("EVENT_USEJETPACK",EVENT_USEJETPACK,LABEL_DEFINE); - AddDefinition("EVENT_USEMEDKIT",EVENT_USEMEDKIT,LABEL_DEFINE); - AddDefinition("EVENT_USENIGHTVISION",EVENT_USENIGHTVISION,LABEL_DEFINE); - AddDefinition("EVENT_USESTEROIDS",EVENT_USESTEROIDS,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY10",EVENT_WEAPKEY10,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY1",EVENT_WEAPKEY1,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY2",EVENT_WEAPKEY2,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY3",EVENT_WEAPKEY3,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY4",EVENT_WEAPKEY4,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY5",EVENT_WEAPKEY5,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY6",EVENT_WEAPKEY6,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY7",EVENT_WEAPKEY7,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY8",EVENT_WEAPKEY8,LABEL_DEFINE); - AddDefinition("EVENT_WEAPKEY9",EVENT_WEAPKEY9,LABEL_DEFINE); - AddDefinition("EVENT_KILLIT",EVENT_KILLIT,LABEL_DEFINE); - AddDefinition("EVENT_LOADACTOR",EVENT_LOADACTOR,LABEL_DEFINE); - AddDefinition("EVENT_NEWGAME",EVENT_NEWGAME,LABEL_DEFINE); + C_AddDefinition("EVENT_AIMDOWN",EVENT_AIMDOWN,LABEL_DEFINE); + C_AddDefinition("EVENT_AIMUP",EVENT_AIMUP,LABEL_DEFINE); + C_AddDefinition("EVENT_ANIMATESPRITES",EVENT_ANIMATESPRITES,LABEL_DEFINE); + C_AddDefinition("EVENT_CHANGEWEAPON",EVENT_CHANGEWEAPON,LABEL_DEFINE); + C_AddDefinition("EVENT_CHEATGETBOOT",EVENT_CHEATGETBOOT,LABEL_DEFINE); + C_AddDefinition("EVENT_CHEATGETFIRSTAID",EVENT_CHEATGETFIRSTAID,LABEL_DEFINE); + C_AddDefinition("EVENT_CHEATGETHEAT",EVENT_CHEATGETHEAT,LABEL_DEFINE); + C_AddDefinition("EVENT_CHEATGETHOLODUKE",EVENT_CHEATGETHOLODUKE,LABEL_DEFINE); + C_AddDefinition("EVENT_CHEATGETJETPACK",EVENT_CHEATGETJETPACK,LABEL_DEFINE); + C_AddDefinition("EVENT_CHEATGETSCUBA",EVENT_CHEATGETSCUBA,LABEL_DEFINE); + C_AddDefinition("EVENT_CHEATGETSHIELD",EVENT_CHEATGETSHIELD,LABEL_DEFINE); + C_AddDefinition("EVENT_CHEATGETSTEROIDS",EVENT_CHEATGETSTEROIDS,LABEL_DEFINE); + C_AddDefinition("EVENT_CROUCH",EVENT_CROUCH,LABEL_DEFINE); + C_AddDefinition("EVENT_DISPLAYCROSSHAIR",EVENT_DISPLAYCROSSHAIR,LABEL_DEFINE); + C_AddDefinition("EVENT_DISPLAYREST",EVENT_DISPLAYREST,LABEL_DEFINE); + C_AddDefinition("EVENT_DISPLAYBONUSSCREEN",EVENT_DISPLAYBONUSSCREEN,LABEL_DEFINE); + C_AddDefinition("EVENT_DISPLAYMENU",EVENT_DISPLAYMENU,LABEL_DEFINE); + C_AddDefinition("EVENT_DISPLAYMENUREST",EVENT_DISPLAYMENUREST,LABEL_DEFINE); + C_AddDefinition("EVENT_DISPLAYLOADINGSCREEN",EVENT_DISPLAYLOADINGSCREEN,LABEL_DEFINE); + C_AddDefinition("EVENT_DISPLAYROOMS",EVENT_DISPLAYROOMS,LABEL_DEFINE); + C_AddDefinition("EVENT_DISPLAYSBAR",EVENT_DISPLAYSBAR,LABEL_DEFINE); + C_AddDefinition("EVENT_DISPLAYWEAPON",EVENT_DISPLAYWEAPON,LABEL_DEFINE); + C_AddDefinition("EVENT_DOFIRE",EVENT_DOFIRE,LABEL_DEFINE); + C_AddDefinition("EVENT_DRAWWEAPON",EVENT_DRAWWEAPON,LABEL_DEFINE); + C_AddDefinition("EVENT_EGS",EVENT_EGS,LABEL_DEFINE); + C_AddDefinition("EVENT_ENTERLEVEL",EVENT_ENTERLEVEL,LABEL_DEFINE); + C_AddDefinition("EVENT_FAKEDOMOVETHINGS",EVENT_FAKEDOMOVETHINGS,LABEL_DEFINE); + C_AddDefinition("EVENT_FIRE",EVENT_FIRE,LABEL_DEFINE); + C_AddDefinition("EVENT_FIREWEAPON",EVENT_FIREWEAPON,LABEL_DEFINE); + C_AddDefinition("EVENT_GAME",EVENT_GAME,LABEL_DEFINE); + C_AddDefinition("EVENT_GETAUTOAIMANGLE",EVENT_GETAUTOAIMANGLE,LABEL_DEFINE); + C_AddDefinition("EVENT_GETLOADTILE",EVENT_GETLOADTILE,LABEL_DEFINE); + C_AddDefinition("EVENT_GETMENUTILE",EVENT_GETMENUTILE,LABEL_DEFINE); + C_AddDefinition("EVENT_GETSHOTRANGE",EVENT_GETSHOTRANGE,LABEL_DEFINE); + C_AddDefinition("EVENT_HOLODUKEOFF",EVENT_HOLODUKEOFF,LABEL_DEFINE); + C_AddDefinition("EVENT_HOLODUKEON",EVENT_HOLODUKEON,LABEL_DEFINE); + C_AddDefinition("EVENT_HOLSTER",EVENT_HOLSTER,LABEL_DEFINE); + C_AddDefinition("EVENT_INCURDAMAGE",EVENT_INCURDAMAGE,LABEL_DEFINE); + C_AddDefinition("EVENT_INIT",EVENT_INIT,LABEL_DEFINE); + C_AddDefinition("EVENT_INVENTORY",EVENT_INVENTORY,LABEL_DEFINE); + C_AddDefinition("EVENT_INVENTORYLEFT",EVENT_INVENTORYLEFT,LABEL_DEFINE); + C_AddDefinition("EVENT_INVENTORYRIGHT",EVENT_INVENTORYRIGHT,LABEL_DEFINE); + C_AddDefinition("EVENT_JUMP",EVENT_JUMP,LABEL_DEFINE); + C_AddDefinition("EVENT_LOGO",EVENT_LOGO,LABEL_DEFINE); + C_AddDefinition("EVENT_LOOKDOWN",EVENT_LOOKDOWN,LABEL_DEFINE); + C_AddDefinition("EVENT_LOOKLEFT",EVENT_LOOKLEFT,LABEL_DEFINE); + C_AddDefinition("EVENT_LOOKRIGHT",EVENT_LOOKRIGHT,LABEL_DEFINE); + C_AddDefinition("EVENT_LOOKUP",EVENT_LOOKUP,LABEL_DEFINE); + C_AddDefinition("EVENT_MOVEBACKWARD",EVENT_MOVEBACKWARD,LABEL_DEFINE); + C_AddDefinition("EVENT_MOVEFORWARD",EVENT_MOVEFORWARD,LABEL_DEFINE); + C_AddDefinition("EVENT_NEXTWEAPON",EVENT_NEXTWEAPON,LABEL_DEFINE); + C_AddDefinition("EVENT_PREVIOUSWEAPON",EVENT_PREVIOUSWEAPON,LABEL_DEFINE); + C_AddDefinition("EVENT_PRESSEDFIRE",EVENT_PRESSEDFIRE,LABEL_DEFINE); + C_AddDefinition("EVENT_PROCESSINPUT",EVENT_PROCESSINPUT,LABEL_DEFINE); + C_AddDefinition("EVENT_QUICKKICK",EVENT_QUICKKICK,LABEL_DEFINE); + C_AddDefinition("EVENT_RESETINVENTORY",EVENT_RESETINVENTORY,LABEL_DEFINE); + C_AddDefinition("EVENT_RESETPLAYER",EVENT_RESETPLAYER,LABEL_DEFINE); + C_AddDefinition("EVENT_RESETWEAPONS",EVENT_RESETWEAPONS,LABEL_DEFINE); + C_AddDefinition("EVENT_RETURNTOCENTER",EVENT_RETURNTOCENTER,LABEL_DEFINE); + C_AddDefinition("EVENT_SELECTWEAPON",EVENT_SELECTWEAPON,LABEL_DEFINE); + C_AddDefinition("EVENT_SOARDOWN",EVENT_SOARDOWN,LABEL_DEFINE); + C_AddDefinition("EVENT_SOARUP",EVENT_SOARUP,LABEL_DEFINE); + C_AddDefinition("EVENT_SPAWN",EVENT_SPAWN,LABEL_DEFINE); + C_AddDefinition("EVENT_STRAFELEFT",EVENT_STRAFELEFT,LABEL_DEFINE); + C_AddDefinition("EVENT_STRAFERIGHT",EVENT_STRAFERIGHT,LABEL_DEFINE); + C_AddDefinition("EVENT_SWIMDOWN",EVENT_SWIMDOWN,LABEL_DEFINE); + C_AddDefinition("EVENT_SWIMUP",EVENT_SWIMUP,LABEL_DEFINE); + C_AddDefinition("EVENT_TURNAROUND",EVENT_TURNAROUND,LABEL_DEFINE); + C_AddDefinition("EVENT_TURNLEFT",EVENT_TURNLEFT,LABEL_DEFINE); + C_AddDefinition("EVENT_TURNRIGHT",EVENT_TURNRIGHT,LABEL_DEFINE); + C_AddDefinition("EVENT_USE",EVENT_USE,LABEL_DEFINE); + C_AddDefinition("EVENT_USEJETPACK",EVENT_USEJETPACK,LABEL_DEFINE); + C_AddDefinition("EVENT_USEMEDKIT",EVENT_USEMEDKIT,LABEL_DEFINE); + C_AddDefinition("EVENT_USENIGHTVISION",EVENT_USENIGHTVISION,LABEL_DEFINE); + C_AddDefinition("EVENT_USESTEROIDS",EVENT_USESTEROIDS,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY10",EVENT_WEAPKEY10,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY1",EVENT_WEAPKEY1,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY2",EVENT_WEAPKEY2,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY3",EVENT_WEAPKEY3,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY4",EVENT_WEAPKEY4,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY5",EVENT_WEAPKEY5,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY6",EVENT_WEAPKEY6,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY7",EVENT_WEAPKEY7,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY8",EVENT_WEAPKEY8,LABEL_DEFINE); + C_AddDefinition("EVENT_WEAPKEY9",EVENT_WEAPKEY9,LABEL_DEFINE); + C_AddDefinition("EVENT_KILLIT",EVENT_KILLIT,LABEL_DEFINE); + C_AddDefinition("EVENT_LOADACTOR",EVENT_LOADACTOR,LABEL_DEFINE); + C_AddDefinition("EVENT_NEWGAME",EVENT_NEWGAME,LABEL_DEFINE); - AddDefinition("STR_MAPNAME",STR_MAPNAME,LABEL_DEFINE); - AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME,LABEL_DEFINE); - AddDefinition("STR_PLAYERNAME",STR_PLAYERNAME,LABEL_DEFINE); - AddDefinition("STR_VERSION",STR_VERSION,LABEL_DEFINE); - AddDefinition("STR_GAMETYPE",STR_GAMETYPE,LABEL_DEFINE); + C_AddDefinition("STR_MAPNAME",STR_MAPNAME,LABEL_DEFINE); + C_AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME,LABEL_DEFINE); + C_AddDefinition("STR_PLAYERNAME",STR_PLAYERNAME,LABEL_DEFINE); + C_AddDefinition("STR_VERSION",STR_VERSION,LABEL_DEFINE); + C_AddDefinition("STR_GAMETYPE",STR_GAMETYPE,LABEL_DEFINE); - AddDefinition("NO",0,LABEL_DEFINE|LABEL_ACTION|LABEL_AI|LABEL_MOVE); + C_AddDefinition("NO",0,LABEL_DEFINE|LABEL_ACTION|LABEL_AI|LABEL_MOVE); - AddDefinition("PROJ_BOUNCES",PROJ_BOUNCES,LABEL_DEFINE); - AddDefinition("PROJ_BSOUND",PROJ_BSOUND,LABEL_DEFINE); - AddDefinition("PROJ_CLIPDIST",PROJ_CLIPDIST,LABEL_DEFINE); - AddDefinition("PROJ_CSTAT",PROJ_CSTAT,LABEL_DEFINE); - AddDefinition("PROJ_DECAL",PROJ_DECAL,LABEL_DEFINE); - AddDefinition("PROJ_DROP",PROJ_DROP,LABEL_DEFINE); - AddDefinition("PROJ_EXTRA",PROJ_EXTRA,LABEL_DEFINE); - AddDefinition("PROJ_EXTRA_RAND",PROJ_EXTRA_RAND,LABEL_DEFINE); - AddDefinition("PROJ_HITRADIUS",PROJ_HITRADIUS,LABEL_DEFINE); - AddDefinition("PROJ_ISOUND",PROJ_ISOUND,LABEL_DEFINE); - AddDefinition("PROJ_OFFSET",PROJ_OFFSET,LABEL_DEFINE); - AddDefinition("PROJ_PAL",PROJ_PAL,LABEL_DEFINE); - AddDefinition("PROJ_RANGE",PROJ_RANGE,LABEL_DEFINE); - AddDefinition("PROJ_SHADE",PROJ_SHADE,LABEL_DEFINE); - AddDefinition("PROJ_SOUND",PROJ_SOUND,LABEL_DEFINE); - AddDefinition("PROJ_SPAWNS",PROJ_SPAWNS,LABEL_DEFINE); - AddDefinition("PROJ_SXREPEAT",PROJ_SXREPEAT,LABEL_DEFINE); - AddDefinition("PROJ_SYREPEAT",PROJ_SYREPEAT,LABEL_DEFINE); - AddDefinition("PROJ_TNUM",PROJ_TNUM,LABEL_DEFINE); - AddDefinition("PROJ_TOFFSET",PROJ_TOFFSET,LABEL_DEFINE); - AddDefinition("PROJ_TRAIL",PROJ_TRAIL,LABEL_DEFINE); - AddDefinition("PROJ_TXREPEAT",PROJ_TXREPEAT,LABEL_DEFINE); - AddDefinition("PROJ_TYREPEAT",PROJ_TYREPEAT,LABEL_DEFINE); - AddDefinition("PROJ_VEL_MULT",PROJ_VEL_MULT,LABEL_DEFINE); - AddDefinition("PROJ_VEL",PROJ_VEL,LABEL_DEFINE); - AddDefinition("PROJ_WORKSLIKE",PROJ_WORKSLIKE,LABEL_DEFINE); - AddDefinition("PROJ_XREPEAT",PROJ_XREPEAT,LABEL_DEFINE); - AddDefinition("PROJ_YREPEAT",PROJ_YREPEAT,LABEL_DEFINE); + C_AddDefinition("PROJ_BOUNCES",PROJ_BOUNCES,LABEL_DEFINE); + C_AddDefinition("PROJ_BSOUND",PROJ_BSOUND,LABEL_DEFINE); + C_AddDefinition("PROJ_CLIPDIST",PROJ_CLIPDIST,LABEL_DEFINE); + C_AddDefinition("PROJ_CSTAT",PROJ_CSTAT,LABEL_DEFINE); + C_AddDefinition("PROJ_DECAL",PROJ_DECAL,LABEL_DEFINE); + C_AddDefinition("PROJ_DROP",PROJ_DROP,LABEL_DEFINE); + C_AddDefinition("PROJ_EXTRA",PROJ_EXTRA,LABEL_DEFINE); + C_AddDefinition("PROJ_EXTRA_RAND",PROJ_EXTRA_RAND,LABEL_DEFINE); + C_AddDefinition("PROJ_HITRADIUS",PROJ_HITRADIUS,LABEL_DEFINE); + C_AddDefinition("PROJ_ISOUND",PROJ_ISOUND,LABEL_DEFINE); + C_AddDefinition("PROJ_OFFSET",PROJ_OFFSET,LABEL_DEFINE); + C_AddDefinition("PROJ_PAL",PROJ_PAL,LABEL_DEFINE); + C_AddDefinition("PROJ_RANGE",PROJ_RANGE,LABEL_DEFINE); + C_AddDefinition("PROJ_SHADE",PROJ_SHADE,LABEL_DEFINE); + C_AddDefinition("PROJ_SOUND",PROJ_SOUND,LABEL_DEFINE); + C_AddDefinition("PROJ_SPAWNS",PROJ_SPAWNS,LABEL_DEFINE); + C_AddDefinition("PROJ_SXREPEAT",PROJ_SXREPEAT,LABEL_DEFINE); + C_AddDefinition("PROJ_SYREPEAT",PROJ_SYREPEAT,LABEL_DEFINE); + C_AddDefinition("PROJ_TNUM",PROJ_TNUM,LABEL_DEFINE); + C_AddDefinition("PROJ_TOFFSET",PROJ_TOFFSET,LABEL_DEFINE); + C_AddDefinition("PROJ_TRAIL",PROJ_TRAIL,LABEL_DEFINE); + C_AddDefinition("PROJ_TXREPEAT",PROJ_TXREPEAT,LABEL_DEFINE); + C_AddDefinition("PROJ_TYREPEAT",PROJ_TYREPEAT,LABEL_DEFINE); + C_AddDefinition("PROJ_VEL_MULT",PROJ_VEL_MULT,LABEL_DEFINE); + C_AddDefinition("PROJ_VEL",PROJ_VEL,LABEL_DEFINE); + C_AddDefinition("PROJ_WORKSLIKE",PROJ_WORKSLIKE,LABEL_DEFINE); + C_AddDefinition("PROJ_XREPEAT",PROJ_XREPEAT,LABEL_DEFINE); + C_AddDefinition("PROJ_YREPEAT",PROJ_YREPEAT,LABEL_DEFINE); } static void C_InitProjectiles(void) @@ -5791,7 +5788,7 @@ static void C_InitProjectiles(void) // this will only happen if I forget to update this function... if (sizeof(projectile_t) != sizeof(DefaultProjectile)) - G_GameExit("ERROR: C_InitProjectiles() projectile_t mismatch!"); + G_GameExit("ERROR: C_InitProjectiles(): projectile_t mismatch!"); for (i=MAXTILES-1;i>=0;i--) Bmemcpy(&ProjectileData[i],&DefaultProjectile,sizeof(projectile_t)); @@ -5966,18 +5963,18 @@ void C_Compile(const char *filenam) { int32_t j=0, k=0; - HASH_free(&keywH); + hash_free(&keywH); freehashnames(); - HASH_free(§orH); - HASH_free(&wallH); - HASH_free(&userdefH); + hash_free(§orH); + hash_free(&wallH); + hash_free(&userdefH); - HASH_free(&projectileH); - HASH_free(&playerH); - HASH_free(&inputH); - HASH_free(&actorH); - HASH_free(&tspriteH); + hash_free(&projectileH); + hash_free(&playerH); + hash_free(&inputH); + hash_free(&actorH); + hash_free(&tspriteH); g_totalLines += g_lineNumber; @@ -5985,11 +5982,16 @@ void C_Compile(const char *filenam) flushlogwindow = 0; - initprintf("Script compiled in %dms\n",getticks()-startcompiletime); + initprintf("Script compiled in %dms\n", getticks() - startcompiletime); + + initprintf("Compiled code size: %ld*%d bytes, version %s\n", + (unsigned)(g_scriptPtr-script), sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D")); - initprintf("Compiled code size: %ld*%d bytes, version %s\n",(unsigned)(g_scriptPtr-script),sizeof(intptr_t),(g_scriptVersion == 14?"1.4+":"1.3D")); initprintf("Pointer bitmap size: %ld bytes\n",(g_scriptSize+7)>>3); - initprintf("%ld/%ld labels, %d/%d variables\n",g_numLabels,min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)),(MAXSPRITES * sizeof(spritetype)/(1<<6))),g_gameVarCount,MAXGAMEVARS); + initprintf("%ld/%ld labels, %d/%d variables\n", g_numLabels, + min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)), + MAXSPRITES * sizeof(spritetype)/(1<<6)), + g_gameVarCount, MAXGAMEVARS); for (i=MAXQUOTES-1;i>=0;i--) if (ScriptQuotes[i]) @@ -6011,9 +6013,6 @@ void C_Compile(const char *filenam) if (ScriptQuotes[i] == NULL) ScriptQuotes[i] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t)); -// if (!Bstrcmp(ScriptQuotes[13],"PRESS SPACE TO RESTART LEVEL")) -// Bstrcpy(ScriptQuotes[13],"PRESS USE TO RESTART LEVEL"); - for (i=MAXQUOTELEN-7;i>=0;i--) if (Bstrncmp(&ScriptQuotes[13][i],"SPACE",5) == 0) { @@ -6112,92 +6111,92 @@ void C_Compile(const char *filenam) void C_ReportError(int32_t iError) { - if (Bstrcmp(g_szCurrentBlockName,g_szLastBlockName)) - { - if (g_parsingEventPtr || g_processingState || g_parsingActorPtr) - initprintf("%s: In %s `%s':\n",g_szScriptFileName,g_parsingEventPtr?"event":g_parsingActorPtr?"actor":"state",g_szCurrentBlockName); - else initprintf("%s: At top level:\n",g_szScriptFileName); - Bstrcpy(g_szLastBlockName,g_szCurrentBlockName); - } - switch (iError) - { - case ERROR_CLOSEBRACKET: - initprintf("%s:%d: error: found more `}' than `{' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_EVENTONLY: - initprintf("%s:%d: error: command `%s' only valid during events.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_EXCEEDSMAXTILES: - initprintf("%s:%d: error: `%s' value exceeds MAXTILES. Maximum is %d.\n",g_szScriptFileName,g_lineNumber,tempbuf,MAXTILES-1); - break; - case ERROR_EXPECTEDKEYWORD: - initprintf("%s:%d: error: expected a keyword but found `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_FOUNDWITHIN: - initprintf("%s:%d: error: found `%s' within %s.\n",g_szScriptFileName,g_lineNumber,tempbuf,g_parsingEventPtr?"an event":g_parsingActorPtr?"an actor":"a state"); - break; - case ERROR_ISAKEYWORD: - initprintf("%s:%d: error: symbol `%s' is a keyword.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOENDSWITCH: - initprintf("%s:%d: error: did not find `endswitch' before `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOTAGAMEDEF: - initprintf("%s:%d: error: symbol `%s' is not a game definition.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOTAGAMEVAR: - initprintf("%s:%d: error: symbol `%s' is not a game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOTAGAMEARRAY: - initprintf("%s:%d: error: symbol `%s' is not a game array.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_GAMEARRAYBNC: - initprintf("%s:%d: error: square brackets for index of game array not closed, expected ] found %c\n",g_szScriptFileName,g_lineNumber,*textptr); - break; - case ERROR_GAMEARRAYBNO: - initprintf("%s:%d: error: square brackets for index of game array not opened, expected [ found %c\n",g_szScriptFileName,g_lineNumber,*textptr); - break; - case ERROR_INVALIDARRAYWRITE: - initprintf("%s:%d: error: arrays can only be written using setarray %c\n",g_szScriptFileName,g_lineNumber,*textptr); - break; - case ERROR_OPENBRACKET: - initprintf("%s:%d: error: found more `{' than `}' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_PARAMUNDEFINED: - initprintf("%s:%d: error: parameter `%s' is undefined.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_SYMBOLNOTRECOGNIZED: - initprintf("%s:%d: error: symbol `%s' is not recognized.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_SYNTAXERROR: - initprintf("%s:%d: error: syntax error.\n",g_szScriptFileName,g_lineNumber); - break; - case ERROR_VARREADONLY: - initprintf("%s:%d: error: variable `%s' is read-only.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_VARTYPEMISMATCH: - initprintf("%s:%d: error: variable `%s' is of the wrong type.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_BADGAMEVAR: - initprintf("%s:%ld: warning: variable `%s' should be either per-player OR per-actor, not both.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_DUPLICATECASE: - initprintf("%s:%ld: warning: duplicate case ignored.\n",g_szScriptFileName,g_lineNumber); - break; - case WARNING_DUPLICATEDEFINITION: - initprintf("%s:%d: warning: duplicate game definition `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_EVENTSYNC: - initprintf("%s:%d: warning: found `%s' within a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case WARNING_LABELSONLY: - initprintf("%s:%d: warning: expected a label, found a constant.\n",g_szScriptFileName,g_lineNumber); - break; - case WARNING_NAMEMATCHESVAR: - initprintf("%s:%d: warning: symbol `%s' already used for game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_REVEVENTSYNC: - initprintf("%s:%d: warning: found `%s' outside of a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - } + if (Bstrcmp(g_szCurrentBlockName,g_szLastBlockName)) + { + if (g_parsingEventPtr || g_processingState || g_parsingActorPtr) + initprintf("%s: In %s `%s':\n",g_szScriptFileName,g_parsingEventPtr?"event":g_parsingActorPtr?"actor":"state",g_szCurrentBlockName); + else initprintf("%s: At top level:\n",g_szScriptFileName); + Bstrcpy(g_szLastBlockName,g_szCurrentBlockName); + } + switch (iError) + { + case ERROR_CLOSEBRACKET: + initprintf("%s:%d: error: found more `}' than `{' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_EVENTONLY: + initprintf("%s:%d: error: `%s' only valid during events.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_EXCEEDSMAXTILES: + initprintf("%s:%d: error: `%s' value exceeds MAXTILES. Maximum is %d.\n",g_szScriptFileName,g_lineNumber,tempbuf,MAXTILES-1); + break; + case ERROR_EXPECTEDKEYWORD: + initprintf("%s:%d: error: expected a keyword but found `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_FOUNDWITHIN: + initprintf("%s:%d: error: found `%s' within %s.\n",g_szScriptFileName,g_lineNumber,tempbuf,g_parsingEventPtr?"an event":g_parsingActorPtr?"an actor":"a state"); + break; + case ERROR_ISAKEYWORD: + initprintf("%s:%d: error: symbol `%s' is a keyword.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_NOENDSWITCH: + initprintf("%s:%d: error: did not find `endswitch' before `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_NOTAGAMEDEF: + initprintf("%s:%d: error: symbol `%s' is not a game definition.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_NOTAGAMEVAR: + initprintf("%s:%d: error: symbol `%s' is not a game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_NOTAGAMEARRAY: + initprintf("%s:%d: error: symbol `%s' is not a game array.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_GAMEARRAYBNC: + initprintf("%s:%d: error: square brackets for index of game array not closed, expected ] found %c\n",g_szScriptFileName,g_lineNumber,*textptr); + break; + case ERROR_GAMEARRAYBNO: + initprintf("%s:%d: error: square brackets for index of game array not opened, expected [ found %c\n",g_szScriptFileName,g_lineNumber,*textptr); + break; + case ERROR_INVALIDARRAYWRITE: + initprintf("%s:%d: error: arrays can only be written to using `setarray' %c\n",g_szScriptFileName,g_lineNumber,*textptr); + break; + case ERROR_OPENBRACKET: + initprintf("%s:%d: error: found more `{' than `}' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_PARAMUNDEFINED: + initprintf("%s:%d: error: parameter `%s' is undefined.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_SYMBOLNOTRECOGNIZED: + initprintf("%s:%d: error: symbol `%s' is not recognized.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_SYNTAXERROR: + initprintf("%s:%d: error: syntax error.\n",g_szScriptFileName,g_lineNumber); + break; + case ERROR_VARREADONLY: + initprintf("%s:%d: error: variable `%s' is read-only.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_VARTYPEMISMATCH: + initprintf("%s:%d: error: variable `%s' is of the wrong type.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case WARNING_BADGAMEVAR: + initprintf("%s:%ld: warning: variable `%s' should be either per-player OR per-actor, not both.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case WARNING_DUPLICATECASE: + initprintf("%s:%ld: warning: duplicate case ignored.\n",g_szScriptFileName,g_lineNumber); + break; + case WARNING_DUPLICATEDEFINITION: + initprintf("%s:%d: warning: duplicate game definition `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case WARNING_EVENTSYNC: + initprintf("%s:%d: warning: found `%s' within a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case WARNING_LABELSONLY: + initprintf("%s:%d: warning: expected a label, found a constant.\n",g_szScriptFileName,g_lineNumber); + break; + case WARNING_NAMEMATCHESVAR: + initprintf("%s:%d: warning: symbol `%s' already used for game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case WARNING_REVEVENTSYNC: + initprintf("%s:%d: warning: found `%s' outside of a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + } } diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index ea0b1a22c..5bb007f42 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -1402,7 +1402,7 @@ static int32_t X_DoExecute(void) G_OperateMasterSwitches(var1); break; case CON_CHECKACTIVATORMOTION: - Gv_SetVarX(g_iReturnVarID, check_activator_motion(var1)); + Gv_SetVarX(g_iReturnVarID, G_CheckActivatorMotion(var1)); break; } break; @@ -4385,7 +4385,7 @@ void G_SaveMapState(mapstate_t *save) Bmemcpy(&save->numsectors,&numsectors,sizeof(numsectors)); Bmemcpy(&save->sector[0],§or[0],sizeof(sectortype)*MAXSECTORS); Bmemcpy(&save->sprite[0],&sprite[0],sizeof(spritetype)*MAXSPRITES); - Bmemcpy(&save->spriteext[0],&spriteext[0],sizeof(spriteexttype)*MAXSPRITES); + Bmemcpy(&save->spriteext[0],&spriteext[0],sizeof(spriteext_t)*MAXSPRITES); Bmemcpy(&save->headspritesect[0],&headspritesect[0],sizeof(headspritesect)); Bmemcpy(&save->prevspritesect[0],&prevspritesect[0],sizeof(prevspritesect)); Bmemcpy(&save->nextspritesect[0],&nextspritesect[0],sizeof(nextspritesect)); @@ -4509,7 +4509,7 @@ void G_RestoreMapState(mapstate_t *save) Bmemcpy(&numsectors,&save->numsectors,sizeof(numsectors)); Bmemcpy(§or[0],&save->sector[0],sizeof(sectortype)*MAXSECTORS); Bmemcpy(&sprite[0],&save->sprite[0],sizeof(spritetype)*MAXSPRITES); - Bmemcpy(&spriteext[0],&save->spriteext[0],sizeof(spriteexttype)*MAXSPRITES); + Bmemcpy(&spriteext[0],&save->spriteext[0],sizeof(spriteext_t)*MAXSPRITES); Bmemcpy(&headspritesect[0],&save->headspritesect[0],sizeof(headspritesect)); Bmemcpy(&prevspritesect[0],&save->prevspritesect[0],sizeof(prevspritesect)); Bmemcpy(&nextspritesect[0],&save->nextspritesect[0],sizeof(nextspritesect)); diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 2f9780036..d07853e89 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -54,8 +54,8 @@ static void Gv_Free(void) /* called from Gv_ReadSave() and Gv_ResetVars() */ aGameArrays[i].bReset=1; } g_gameVarCount=g_gameArrayCount=0; - HASH_init(&gamevarH); - HASH_init(&arrayH); + hash_init(&gamevarH); + hash_init(&arrayH); return; } @@ -92,8 +92,8 @@ static void Gv_Clear(void) aGameArrays[i].bReset=1; } g_gameVarCount=g_gameArrayCount=0; - HASH_init(&gamevarH); - HASH_init(&arrayH); + hash_init(&gamevarH); + hash_init(&arrayH); return; } @@ -118,7 +118,7 @@ int32_t Gv_ReadSave(int32_t fil) if (kdfread(&(aGameVars[i]),sizeof(gamevar_t),1,fil) != 1) goto corrupt; aGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(uint8_t)); if (kdfread(aGameVars[i].szLabel,sizeof(uint8_t) * MAXVARLABEL, 1, fil) != 1) goto corrupt; - HASH_replace(&gamevarH,aGameVars[i].szLabel,i); + hash_replace(&gamevarH,aGameVars[i].szLabel,i); if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER) { @@ -146,7 +146,7 @@ int32_t Gv_ReadSave(int32_t fil) if (kdfread(&(aGameArrays[i]),sizeof(gamearray_t),1,fil) != 1) goto corrupt; aGameArrays[i].szLabel=Bcalloc(MAXARRAYLABEL,sizeof(uint8_t)); if (kdfread(aGameArrays[i].szLabel,sizeof(uint8_t) * MAXARRAYLABEL, 1, fil) != 1) goto corrupt; - HASH_replace(&arrayH,aGameArrays[i].szLabel,i); + hash_replace(&arrayH,aGameArrays[i].szLabel,i); aGameArrays[i].plValues=Bcalloc(aGameArrays[i].size,sizeof(intptr_t)); if (kdfread(aGameArrays[i].plValues,sizeof(intptr_t) * aGameArrays[i].size, 1, fil) < 1) goto corrupt; @@ -384,7 +384,7 @@ int32_t Gv_NewArray(const char *pszLabel, int32_t asize) initprintf("%s:%d: error: array name `%s' exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,pszLabel, MAXARRAYLABEL); return 0; } - i = HASH_find(&arrayH,pszLabel); + i = hash_find(&arrayH,pszLabel); if (i >=0 && !aGameArrays[i].bReset) { // found it it's a duplicate in error @@ -403,7 +403,7 @@ int32_t Gv_NewArray(const char *pszLabel, int32_t asize) aGameArrays[i].size=asize; aGameArrays[i].bReset=0; g_gameArrayCount++; - HASH_replace(&arrayH,aGameArrays[i].szLabel,i); + hash_replace(&arrayH,aGameArrays[i].szLabel,i); return 1; } @@ -430,7 +430,7 @@ int32_t Gv_NewVar(const char *pszLabel, int32_t lValue, uint32_t dwFlags) return 0; } - i = HASH_find(&gamevarH,pszLabel); + i = hash_find(&gamevarH,pszLabel); if (i >= 0 && !(aGameVars[i].dwFlags & GAMEVAR_RESET)) { @@ -480,7 +480,7 @@ int32_t Gv_NewVar(const char *pszLabel, int32_t lValue, uint32_t dwFlags) if (i == g_gameVarCount) { // we're adding a new one. - HASH_add(&gamevarH, aGameVars[i].szLabel, g_gameVarCount++); + hash_add(&gamevarH, aGameVars[i].szLabel, g_gameVarCount++); } if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER) @@ -512,7 +512,7 @@ void A_ResetVars(int32_t iActor) static int32_t Gv_GetVarIndex(const char *szGameLabel) { - int32_t i = HASH_find(&gamevarH,szGameLabel); + int32_t i = hash_find(&gamevarH,szGameLabel); if (i == -1) { OSD_Printf(OSD_ERROR "Gv_GetVarDataPtr(): INTERNAL ERROR: couldn't find gamevar %s!\n",szGameLabel); @@ -863,7 +863,7 @@ void __fastcall Gv_SetVarX(int32_t id, int32_t lValue) int32_t Gv_GetVarByLabel(const char *szGameLabel, int32_t lDefault, int32_t iActor, int32_t iPlayer) { - int32_t i = HASH_find(&gamevarH,szGameLabel); + int32_t i = hash_find(&gamevarH,szGameLabel); if (i < 0) return lDefault; @@ -873,7 +873,7 @@ int32_t Gv_GetVarByLabel(const char *szGameLabel, int32_t lDefault, int32_t iAct static intptr_t *Gv_GetVarDataPtr(const char *szGameLabel) { - int32_t i = HASH_find(&gamevarH,szGameLabel); + int32_t i = hash_find(&gamevarH,szGameLabel); if (i < 0) return NULL; diff --git a/polymer/eduke32/source/jaudiolib/dsoundout.c b/polymer/eduke32/source/jaudiolib/dsoundout.c index 3efa78468..44c7c6d66 100644 --- a/polymer/eduke32/source/jaudiolib/dsoundout.c +++ b/polymer/eduke32/source/jaudiolib/dsoundout.c @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //------------------------------------------------------------------------- +#include "dsound.h" #include "dsoundout.h" #define WIN32_LEAN_AND_MEAN @@ -32,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include "dsound.h" + #ifdef USE_OPENAL #include "openal.h" #endif diff --git a/polymer/eduke32/source/jaudiolib/sdlmusic.c b/polymer/eduke32/source/jaudiolib/sdlmusic.c index f137535f3..65f6e2e6e 100644 --- a/polymer/eduke32/source/jaudiolib/sdlmusic.c +++ b/polymer/eduke32/source/jaudiolib/sdlmusic.c @@ -312,8 +312,7 @@ int32_t MUSIC_PlaySong(char *song, int32_t loopflag) if (music_musicchunk != NULL) { - // !!! FIXME: I set the music to loop. Hope that's okay. --ryan. - Mix_PlayMusic(music_musicchunk, -1); + Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_LoopSong)?-1:0); } // if return MUSIC_Ok; } diff --git a/polymer/eduke32/source/jmact/control.c b/polymer/eduke32/source/jmact/control.c index cc24b8b4c..d65611a99 100644 --- a/polymer/eduke32/source/jmact/control.c +++ b/polymer/eduke32/source/jmact/control.c @@ -55,7 +55,7 @@ static int32 ticrate; static int32 CONTROL_DoubleClickSpeed; int32_t extinput[CONTROL_NUM_FLAGS]; -keybind boundkeys[MAXBOUNDKEYS], mousebind[MAXMOUSEBUTTONS]; +keybind KeyBindings[MAXBOUNDKEYS], MouseBindings[MAXMOUSEBUTTONS]; int32_t bindsenabled = 0; int32_t control_smoothmouse = 0; @@ -167,10 +167,10 @@ boolean CONTROL_KeyboardFunctionPressed(int32 which) if (!CONTROL_Flags[which].used) return false; - if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED && !boundkeys[CONTROL_KeyMapping[which].key1].cmd[0]) + if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED && !KeyBindings[CONTROL_KeyMapping[which].key1].cmd[0]) key1 = KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] ? true : false; - if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !boundkeys[CONTROL_KeyMapping[which].key2].cmd[0]) + if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !KeyBindings[CONTROL_KeyMapping[which].key2].cmd[0]) key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? true : false; return (key1 | key2); @@ -723,7 +723,7 @@ void CONTROL_ButtonFunctionState(int32 *p1) do { - if (!mousebind[i].cmd[0]) + if (!MouseBindings[i].cmd[0]) { j = CONTROL_MouseButtonMapping[i].doubleclicked; if (j != KEYUNDEFINED) @@ -737,12 +737,12 @@ void CONTROL_ButtonFunctionState(int32 *p1) if (!bindsenabled) continue; - if (mousebind[i].cmd[0] && CONTROL_MouseButtonState[i]) + if (MouseBindings[i].cmd[0] && CONTROL_MouseButtonState[i]) { - if (mousebind[i].repeat || (mousebind[i].laststate == 0)) - OSD_Dispatch(mousebind[i].cmd); + if (MouseBindings[i].repeat || (MouseBindings[i].laststate == 0)) + OSD_Dispatch(MouseBindings[i].cmd); } - mousebind[i].laststate = CONTROL_MouseButtonState[i]; + MouseBindings[i].laststate = CONTROL_MouseButtonState[i]; } while (i--); } @@ -867,22 +867,22 @@ void CONTROL_ProcessBinds(void) do { - if (boundkeys[i].cmd[0] && KB_KeyPressed(i)) + if (KeyBindings[i].cmd[0] && KB_KeyPressed(i)) { - if (boundkeys[i].repeat || (boundkeys[i].laststate == 0)) - OSD_Dispatch(boundkeys[i].cmd); + if (KeyBindings[i].repeat || (KeyBindings[i].laststate == 0)) + OSD_Dispatch(KeyBindings[i].cmd); } - boundkeys[i].laststate = KB_KeyPressed(i); + KeyBindings[i].laststate = KB_KeyPressed(i); } while (--i); } - if (boundkeys[0].cmd[0] && KB_KeyPressed(0)) + if (KeyBindings[0].cmd[0] && KB_KeyPressed(0)) { - if (boundkeys[0].repeat || (boundkeys[0].laststate == 0)) - OSD_Dispatch(boundkeys[0].cmd); + if (KeyBindings[0].repeat || (KeyBindings[0].laststate == 0)) + OSD_Dispatch(KeyBindings[0].cmd); } - boundkeys[0].laststate = KB_KeyPressed(0); + KeyBindings[0].laststate = KB_KeyPressed(0); } diff --git a/polymer/eduke32/source/jmact/control.h b/polymer/eduke32/source/jmact/control.h index cb7fa43a6..4d0b94bcd 100644 --- a/polymer/eduke32/source/jmact/control.h +++ b/polymer/eduke32/source/jmact/control.h @@ -213,7 +213,7 @@ typedef struct binding { #define MAXMOUSEBUTTONS 10 -extern keybind boundkeys[MAXBOUNDKEYS], mousebind[MAXMOUSEBUTTONS]; +extern keybind KeyBindings[MAXBOUNDKEYS], MouseBindings[MAXMOUSEBUTTONS]; extern int32_t bindsenabled; void CONTROL_ProcessBinds(void); diff --git a/polymer/eduke32/source/jmact/keyboard.h b/polymer/eduke32/source/jmact/keyboard.h index 0154bff19..8d2759268 100644 --- a/polymer/eduke32/source/jmact/keyboard.h +++ b/polymer/eduke32/source/jmact/keyboard.h @@ -199,7 +199,7 @@ extern kb_scancode KB_LastScan; #define KB_ClearKeyDown( scan ) { keystatus[ ( scan ) ] = FALSE; } -#define KB_UnBoundKeyPressed( scan ) ( keystatus[ ( scan ) ] != 0 && !boundkeys[scan].cmd[0]) +#define KB_UnBoundKeyPressed( scan ) ( keystatus[ ( scan ) ] != 0 && !KeyBindings[scan].cmd[0]) /* ============================================================================= diff --git a/polymer/eduke32/source/mapster32.h b/polymer/eduke32/source/mapster32.h index 862212611..4dbcb1898 100644 --- a/polymer/eduke32/source/mapster32.h +++ b/polymer/eduke32/source/mapster32.h @@ -52,11 +52,11 @@ static int32_t ototalclock = 0; char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0}; uint8_t keys[NUMBUILDKEYS] = - { - 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, - 0x1e,0x2c,0xd1,0xc9,0x47,0x49, +{ + 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, + 0x1e,0x2c,0xd1,0xc9,0x47,0x49, 0x9c,0x1c,0xd,0xc,0xf,0x29 - }; +}; int32_t nextvoxid = 0; @@ -111,12 +111,8 @@ static void EditWallData(int16_t wallnum); static void EditSectorData(int16_t sectnum); static void FuncMenu(void); -char GAMEpalette[768]; -char WATERpalette[768]; -char SLIMEpalette[768]; -char TITLEpalette[768]; -char REALMSpalette[768]; -char BOSS1palette[768]; +uint8_t GAMEpalette[768], WATERpalette[768], SLIMEpalette[768], TITLEpalette[768]; +uint8_t REALMSpalette[768], BOSS1palette[768]; char num_tables; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 22a47238b..a3c9c1dd6 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -1477,7 +1477,7 @@ void M_DisplayMenus(void) } else { - tempbuf[0] = PACKET_TYPE_LOAD_GAME; + tempbuf[0] = PACKET_LOAD_GAME; tempbuf[1] = g_lastSaveSlot; tempbuf[2] = myconnectindex; TRAVERSE_CONNECT(x) @@ -3790,13 +3790,13 @@ cheat_for_port_credits: { ud.config.MouseFunctions[whichkey>>1][whichkey&1] = x; CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_mouse); - mousebind[whichkey>>1].cmd[0] = 0; // kill the bind when changing the button in the menu + MouseBindings[whichkey>>1].cmd[0] = 0; // kill the bind when changing the button in the menu } else { ud.config.MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x; CONTROL_MapButton(x, whichkey-(MAXMOUSEBUTTONS-2), 0, controldevice_mouse); - mousebind[whichkey-(MAXMOUSEBUTTONS-2)].cmd[0] = 0; + MouseBindings[whichkey-(MAXMOUSEBUTTONS-2)].cmd[0] = 0; } ChangeToMenu(205); probey = whichkey; @@ -5107,7 +5107,7 @@ VOLUME_ALL_40x: g_player[i].gotvote = 0; } - tempbuf[0] = PACKET_TYPE_MAP_VOTE_CANCEL; + tempbuf[0] = PACKET_MAP_VOTE_CANCEL; tempbuf[1] = myconnectindex; TRAVERSE_CONNECT(c) @@ -5164,7 +5164,7 @@ VOLUME_ALL_40x: voting = -1; - tempbuf[0] = PACKET_TYPE_MAP_VOTE_CANCEL; + tempbuf[0] = PACKET_MAP_VOTE_CANCEL; tempbuf[1] = myconnectindex; tempbuf[2] = 1; @@ -5315,7 +5315,7 @@ VOLUME_ALL_40x: g_player[myconnectindex].vote = g_player[myconnectindex].gotvote = 1; voting = myconnectindex; - tempbuf[0] = PACKET_TYPE_MAP_VOTE_INITIATE; + tempbuf[0] = PACKET_MAP_VOTE_INITIATE; tempbuf[1] = myconnectindex; tempbuf[2] = ud.m_volume_number; tempbuf[3] = ud.m_level_number; diff --git a/polymer/eduke32/source/namesdyn.c b/polymer/eduke32/source/namesdyn.c index 1fef54b38..087efe66e 100644 --- a/polymer/eduke32/source/namesdyn.c +++ b/polymer/eduke32/source/namesdyn.c @@ -35,7 +35,7 @@ struct dynitem int16_t vstat; int16_t val; }; -HASH_table dynnamesH = {512, NULL}; +hashtable_t dynnamesH = {512, NULL}; struct dynitem list[]= { @@ -1525,21 +1525,21 @@ void G_ProcessDynamicTileMapping(const char *szLabel, int32_t lValue) if (lValue >= MAXTILES || !szLabel) return; - i = HASH_find(&dynnamesH,szLabel); + i = hash_find(&dynnamesH,szLabel); if (i>=0) *(list[i].v)=lValue; } void inithashnames() { int32_t i; - HASH_init(&dynnamesH); + hash_init(&dynnamesH); for (i=0;list[i].val;i++) - HASH_add(&dynnamesH,list[i].s,i); + hash_add(&dynnamesH,list[i].s,i); } void freehashnames() { - HASH_free(&dynnamesH); + hash_free(&dynnamesH); } void G_InitDynamicTiles(void) diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 64774bc1d..a0588a4ec 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -122,7 +122,7 @@ static int32_t osdcmd_changelevel(const osdfuncparm_t *parm) voting = myconnectindex; - tempbuf[0] = PACKET_TYPE_MAP_VOTE_INITIATE; + tempbuf[0] = PACKET_MAP_VOTE_INITIATE; tempbuf[1] = myconnectindex; tempbuf[2] = ud.m_volume_number; tempbuf[3] = ud.m_level_number; @@ -280,7 +280,7 @@ static int32_t osdcmd_map(const osdfuncparm_t *parm) g_player[myconnectindex].vote = g_player[myconnectindex].gotvote = 1; voting = myconnectindex; - tempbuf[0] = PACKET_TYPE_MAP_VOTE_INITIATE; + tempbuf[0] = PACKET_MAP_VOTE_INITIATE; tempbuf[1] = myconnectindex; tempbuf[2] = ud.m_volume_number; tempbuf[3] = ud.m_level_number; @@ -614,12 +614,12 @@ static int32_t osdcmd_setvar(const osdfuncparm_t *parm) strcpy(varname,parm->parms[1]); varval = Batol(varname); - i = HASH_find(&gamevarH,varname); + i = hash_find(&gamevarH,varname); if (i >= 0) varval=Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex); strcpy(varname,parm->parms[0]); - i = HASH_find(&gamevarH,varname); + i = hash_find(&gamevarH,varname); if (i >= 0) Gv_SetVar(i, varval, g_player[myconnectindex].ps->i, myconnectindex); return OSDCMD_OK; @@ -639,7 +639,7 @@ static int32_t osdcmd_addlogvar(const osdfuncparm_t *parm) } strcpy(varname,parm->parms[0]); - i = HASH_find(&gamevarH,varname); + i = hash_find(&gamevarH,varname); if (i >= 0) OSD_Printf("%s = %d\n", varname, Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex)); return OSDCMD_OK; @@ -668,12 +668,12 @@ static int32_t osdcmd_setactorvar(const osdfuncparm_t *parm) varval = Batol(parm->parms[2]); strcpy(varname,parm->parms[2]); varval = Batol(varname); - i = HASH_find(&gamevarH,varname); + i = hash_find(&gamevarH,varname); if (i >= 0) varval=Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex); strcpy(varname,parm->parms[1]); - i = HASH_find(&gamevarH,varname); + i = hash_find(&gamevarH,varname); if (i >= 0) Gv_SetVar(i, varval, ID, -1); return OSDCMD_OK; @@ -717,7 +717,7 @@ static int32_t osdcmd_cmenu(const osdfuncparm_t *parm) return OSDCMD_OK; } -cvarmappings cvar[] = +cvar_t cvars[] = { { "crosshair", "crosshair: enable/disable crosshair", (void*)&ud.crosshair, CVAR_BOOL, 0, 0, 1 }, @@ -789,18 +789,18 @@ static int32_t osdcmd_cvar_set(const osdfuncparm_t *parm) int32_t showval = (parm->numparms == 0); uint32_t i; - for (i = 0; i < sizeof(cvar)/sizeof(cvarmappings); i++) + for (i = 0; i < sizeof(cvars)/sizeof(cvar_t); i++) { - if (!Bstrcasecmp(parm->name, cvar[i].name)) + if (!Bstrcasecmp(parm->name, cvars[i].name)) { - if ((cvar[i].type & CVAR_NOMULTI) && numplayers > 1) + if ((cvars[i].type & CVAR_NOMULTI) && numplayers > 1) { // sound the alarm - OSD_Printf("Cvar \"%s\" locked in multiplayer.\n",cvar[i].name); + OSD_Printf("Cvar \"%s\" locked in multiplayer.\n",cvars[i].name); return OSDCMD_OK; } else - switch (cvar[i].type&0x7f) + switch (cvars[i].type&0x7f) { case CVAR_INT: case CVAR_UNSIGNEDINT: @@ -809,41 +809,41 @@ static int32_t osdcmd_cvar_set(const osdfuncparm_t *parm) int32_t val; if (showval) { - OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvar[i].name,*(int32_t*)cvar[i].var,(char*)cvar[i].helpstr); + OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvars[i].name,*(int32_t*)cvars[i].var,(char*)cvars[i].helpstr); return OSDCMD_OK; } val = atoi(parm->parms[0]); - if (cvar[i].type == CVAR_BOOL) val = val != 0; + if (cvars[i].type == CVAR_BOOL) val = val != 0; - if (val < cvar[i].min || val > cvar[i].max) + if (val < cvars[i].min || val > cvars[i].max) { - OSD_Printf("%s value out of range\n",cvar[i].name); + OSD_Printf("%s value out of range\n",cvars[i].name); return OSDCMD_OK; } - *(int32_t*)cvar[i].var = val; - OSD_Printf("%s %d",cvar[i].name,val); + *(int32_t*)cvars[i].var = val; + OSD_Printf("%s %d",cvars[i].name,val); } break; case CVAR_STRING: { if (showval) { - OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvar[i].name,(char*)cvar[i].var,(char*)cvar[i].helpstr); + OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvars[i].name,(char*)cvars[i].var,(char*)cvars[i].helpstr); return OSDCMD_OK; } else { - Bstrncpy((char*)cvar[i].var, parm->parms[0], cvar[i].extra-1); - ((char*)cvar[i].var)[cvar[i].extra-1] = 0; - OSD_Printf("%s %s",cvar[i].name,(char*)cvar[i].var); + Bstrncpy((char*)cvars[i].var, parm->parms[0], cvars[i].extra-1); + ((char*)cvars[i].var)[cvars[i].extra-1] = 0; + OSD_Printf("%s %s",cvars[i].name,(char*)cvars[i].var); } } break; default: break; } - if (cvar[i].type&CVAR_MULTI) + if (cvars[i].type&CVAR_MULTI) G_UpdatePlayerFromMenu(); } } @@ -932,7 +932,7 @@ static int32_t osdcmd_give(const osdfuncparm_t *parm) void onvideomodechange(int32_t newmode) { - char *pal; + uint8_t *pal; extern int32_t g_crosshairSum; if (newmode) @@ -1023,7 +1023,7 @@ static int32_t osdcmd_button(const osdfuncparm_t *parm) return OSDCMD_OK; } -keydef_t keynames[]= +keydef_t ConsoleKeys[]= { { "Escape", 0x1 }, { "1", 0x2 }, @@ -1130,7 +1130,7 @@ keydef_t keynames[]= {0,0} }; -char *mousenames[] = { "mouse1", "mouse2", "mouse3", "mouse4", "mwheelup", "mwheeldn", "mouse5", "mouse6", "mouse7", "mouse8" }; +char *ConsoleButtons[] = { "mouse1", "mouse2", "mouse3", "mouse4", "mwheelup", "mwheeldn", "mouse5", "mouse6", "mouse7", "mouse8" }; static int32_t osdcmd_bind(const osdfuncparm_t *parm) { @@ -1138,8 +1138,8 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm) if (parm->numparms==1&&!Bstrcasecmp(parm->parms[0],"showkeys")) { - for (i=0;keynames[i].name;i++)OSD_Printf("%s\n",keynames[i].name); - for (i=0;iparms[0],keynames[i].name)) + for (i=0;ConsoleKeys[i].name;i++) + if (!Bstrcasecmp(parm->parms[0],ConsoleKeys[i].name)) break; - if (!keynames[i].name) + if (!ConsoleKeys[i].name) { for (i=0;iparms[0],mousenames[i])) + if (!Bstrcasecmp(parm->parms[0],ConsoleButtons[i])) break; if (i >= MAXMOUSEBUTTONS) return OSDCMD_SHOWHELP; if (parm->numparms < 2) { - OSD_Printf("%-9s %s\"%s\"\n",mousenames[i], mousebind[i].repeat?"":"norepeat ",mousebind[i].cmd); + OSD_Printf("%-9s %s\"%s\"\n",ConsoleButtons[i], MouseBindings[i].repeat?"":"norepeat ",MouseBindings[i].cmd); return OSDCMD_OK; } j = 1; - mousebind[i].repeat = 1; + MouseBindings[i].repeat = 1; if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat")) { - mousebind[i].repeat = 0; + MouseBindings[i].repeat = 0; j++; } @@ -1201,9 +1201,9 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm) Bstrcat(tempbuf," "); Bstrcat(tempbuf,parm->parms[j++]); } - Bstrncpy(mousebind[i].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncpy(MouseBindings[i].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); - mousebind[i].key=mousenames[i]; + MouseBindings[i].key=ConsoleButtons[i]; if (!OSD_ParsingScript()) OSD_Printf("%s\n",parm->raw); return OSDCMD_OK; @@ -1211,16 +1211,16 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm) if (parm->numparms < 2) { - OSD_Printf("%-9s %s\"%s\"\n",keynames[i].name, boundkeys[keynames[i].id].repeat?"":"norepeat ", boundkeys[keynames[i].id].cmd); + OSD_Printf("%-9s %s\"%s\"\n",ConsoleKeys[i].name, KeyBindings[ConsoleKeys[i].id].repeat?"":"norepeat ", KeyBindings[ConsoleKeys[i].id].cmd); return OSDCMD_OK; } j = 1; - boundkeys[keynames[i].id].repeat = 1; + KeyBindings[ConsoleKeys[i].id].repeat = 1; if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat")) { - boundkeys[keynames[i].id].repeat = 0; + KeyBindings[ConsoleKeys[i].id].repeat = 0; j++; } @@ -1230,9 +1230,9 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm) Bstrcat(tempbuf," "); Bstrcat(tempbuf,parm->parms[j++]); } - Bstrncpy(boundkeys[keynames[i].id].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); + Bstrncpy(KeyBindings[ConsoleKeys[i].id].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); - boundkeys[keynames[i].id].key=keynames[i].name; + KeyBindings[ConsoleKeys[i].id].key=ConsoleKeys[i].name; if (!OSD_ParsingScript()) OSD_Printf("%s\n",parm->raw); return OSDCMD_OK; @@ -1245,11 +1245,11 @@ static int32_t osdcmd_unbindall(const osdfuncparm_t *parm) UNREFERENCED_PARAMETER(parm); for (i=0;inumparms < 1) return OSDCMD_SHOWHELP; - for (i=0;keynames[i].name;i++) - if (!Bstrcasecmp(parm->parms[0],keynames[i].name)) + for (i=0;ConsoleKeys[i].name;i++) + if (!Bstrcasecmp(parm->parms[0],ConsoleKeys[i].name)) break; - if (!keynames[i].name) + if (!ConsoleKeys[i].name) { for (i=0;iparms[0],mousenames[i])) + if (!Bstrcasecmp(parm->parms[0],ConsoleButtons[i])) break; if (i >= MAXMOUSEBUTTONS) return OSDCMD_SHOWHELP; - mousebind[i].repeat = 0; - mousebind[i].cmd[0] = 0; - OSD_Printf("unbound %s\n",mousenames[i]); + MouseBindings[i].repeat = 0; + MouseBindings[i].cmd[0] = 0; + OSD_Printf("unbound %s\n",ConsoleButtons[i]); return OSDCMD_OK; } - boundkeys[keynames[i].id].repeat = 0; - boundkeys[keynames[i].id].cmd[0] = 0; - OSD_Printf("unbound key %s\n",keynames[i].name); + KeyBindings[ConsoleKeys[i].id].repeat = 0; + KeyBindings[ConsoleKeys[i].id].cmd[0] = 0; + OSD_Printf("unbound key %s\n",ConsoleKeys[i].name); return OSDCMD_OK; } @@ -1463,9 +1463,9 @@ int32_t registerosdcommands(void) osdcmd_cheatsinfo_stat.cheatnum = -1; - for (i=0; ion_warping_sector = 0; p->spritebridge = 0; p->sbs = 0; - p->palette = (char *) &palette[0]; + p->palette = (uint8_t *) &palette[0]; if (p->steroids_amount < 400) { @@ -1531,7 +1531,7 @@ void waitforeverybody() int32_t i; if (numplayers < 2) return; - packbuf[0] = PACKET_TYPE_PLAYER_READY; + packbuf[0] = PACKET_PLAYER_READY; g_player[myconnectindex].playerreadyflag++; @@ -1579,7 +1579,7 @@ void waitforeverybody() if (!g_networkBroadcastMode && myconnectindex == connecthead) TRAVERSE_CONNECT(i) { - packbuf[0] = PACKET_TYPE_PLAYER_READY; + packbuf[0] = PACKET_PLAYER_READY; if (i != myconnectindex) mmulti_sendpacket(i,packbuf,1); } diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 8c0a8f686..cb45fcacc 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -239,7 +239,7 @@ int32_t G_LoadPlayer(int32_t spot) if (kdfread(&numsectors,2,1,fil) != 1) goto corrupt; if (kdfread(§or[0],sizeof(sectortype),MAXSECTORS,fil) != MAXSECTORS) goto corrupt; if (kdfread(&sprite[0],sizeof(spritetype),MAXSPRITES,fil) != MAXSPRITES) goto corrupt; - if (kdfread(&spriteext[0],sizeof(spriteexttype),MAXSPRITES,fil) != MAXSPRITES) goto corrupt; + if (kdfread(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt; #if defined(POLYMOST) && defined(USE_OPENGL) for (i=0;i= 0) { if (sprite[i].lotag == lotag) @@ -578,7 +577,7 @@ void G_OperateSectors(int32_t sn,int32_t ii) i = GetAnimationGoal(&sptr->ceilingz); if (i == -1) //if the door has stopped { - haltsoundhack = 1; + g_haltSoundHack = 1; sptr->lotag &= 0xff00; sptr->lotag |= 22; G_OperateSectors(sn,ii); @@ -1271,7 +1270,7 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype) //case LOCKSWITCH1+1: case POWERSWITCH2__STATIC: //case POWERSWITCH2+1: - if (check_activator_motion(lotag)) return 0; + if (G_CheckActivatorMotion(lotag)) return 0; break; default: if (CheckDoorTile(picnum) == 0) return 0; diff --git a/polymer/eduke32/source/wrapper.c b/polymer/eduke32/source/wrapper.c index 8de9285e4..f49a7d5f7 100644 --- a/polymer/eduke32/source/wrapper.c +++ b/polymer/eduke32/source/wrapper.c @@ -7,9 +7,9 @@ #define ISWS(x) ((x == ' ') || (x == '\t') || (x == '\r') || (x == '\n')) -int32_t WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, int32_t nCmdShow) +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { - int32_t i=0,j=0; + int i=0,j=0; char CmdLine[1024], sCmdLine[1024], szFileName[255]; LPTSTR szCmdLine;