From 866148d531eb3874f416a77fdce8bd06c907a332 Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Mon, 25 Nov 2019 19:49:58 -0500 Subject: [PATCH] dumb test --- source/bgmusic.c | 22 +-- source/bspfile.h | 64 ++++----- source/cd_null.c | 4 +- source/cd_sdl.c | 24 ++-- source/cdaudio.h | 4 +- source/cfgfile.c | 10 +- source/cfgfile.h | 6 +- source/chase.c | 2 +- source/cl_demo.c | 26 ++-- source/cl_input.c | 10 +- source/cl_main.c | 56 ++++---- source/cl_parse.c | 60 ++++---- source/cl_tent.c | 20 +-- source/client.h | 66 ++++----- source/cmd.c | 38 ++--- source/cmd.h | 6 +- source/common.c | 206 +++++++++++++-------------- source/common.h | 98 ++++++------- source/console.c | 78 +++++------ source/console.h | 10 +- source/crc.c | 2 +- source/crc.h | 2 +- source/cvar.c | 16 +-- source/draw.h | 14 +- source/gl_draw.c | 54 +++---- source/gl_fog.c | 2 +- source/gl_mesh.c | 82 +++++------ source/gl_model.c | 170 +++++++++++----------- source/gl_model.h | 152 ++++++++++---------- source/gl_refrag.c | 6 +- source/gl_rlight.c | 34 ++--- source/gl_rmain.c | 66 ++++----- source/gl_rmisc.c | 32 ++--- source/gl_screen.c | 52 +++---- source/gl_sky.c | 62 ++++---- source/gl_texmgr.c | 106 +++++++------- source/gl_texmgr.h | 12 +- source/gl_vidsdl.c | 170 +++++++++++----------- source/gl_warp.c | 22 +-- source/glquake.h | 50 +++---- source/host.c | 26 ++-- source/host_cmd.c | 130 ++++++++--------- source/image.c | 42 +++--- source/image.h | 12 +- source/in_sdl.c | 26 ++-- source/input.h | 2 +- source/keys.c | 72 +++++----- source/keys.h | 18 +-- source/lodepng.c | 74 +++++----- source/lodepng.h | 6 +- source/main_sdl.c | 4 +- source/mathlib.c | 42 +++--- source/mathlib.h | 24 ++-- source/menu.c | 264 +++++++++++++++++------------------ source/menu.h | 16 +-- source/modelgen.h | 32 ++--- source/net.h | 20 +-- source/net_defs.h | 68 ++++----- source/net_dgrm.c | 156 ++++++++++----------- source/net_dgrm.h | 8 +- source/net_loop.c | 20 +-- source/net_loop.h | 8 +- source/net_main.c | 58 ++++---- source/net_sys.h | 6 +- source/pr_cmds.c | 100 ++++++------- source/pr_comp.h | 50 +++---- source/pr_edict.c | 120 ++++++++-------- source/pr_exec.c | 54 +++---- source/progdefs.q1 | 26 ++-- source/progs.h | 36 ++--- source/protocol.h | 10 +- source/q_ctype.h | 28 ++-- source/q_sound.h | 78 +++++------ source/q_stdinc.h | 4 +- source/quakedef.h | 12 +- source/r_alias.c | 34 ++--- source/r_brush.c | 80 +++++------ source/r_part.c | 80 +++++------ source/r_sprite.c | 4 +- source/r_world.c | 40 +++--- source/render.h | 44 +++--- source/sbar.c | 98 ++++++------- source/sbar.h | 2 +- source/screen.h | 8 +- source/server.h | 24 ++-- source/snd_codec.c | 6 +- source/snd_codec.h | 20 +-- source/snd_codeci.h | 4 +- source/snd_dma.c | 92 ++++++------ source/snd_flac.c | 12 +- source/snd_mem.c | 34 ++--- source/snd_mikmod.c | 10 +- source/snd_mix.c | 94 ++++++------- source/snd_mp3.c | 28 ++-- source/snd_mpg123.c | 14 +- source/snd_opus.c | 26 ++-- source/snd_sdl.c | 12 +- source/snd_umx.c | 30 ++-- source/snd_vorbis.c | 18 +-- source/spritegn.h | 20 +-- source/stb_image_write.h | 86 ++++++------ source/sv_main.c | 116 +++++++-------- source/sv_move.c | 30 ++-- source/sv_phys.c | 82 +++++------ source/sv_user.c | 32 ++--- source/sys.h | 14 +- source/unix/net_bsd.c | 4 +- source/unix/net_udp.c | 60 ++++---- source/unix/net_udp.h | 26 ++-- source/unix/sys_sdl_unix.c | 54 +++---- source/vid.h | 26 ++-- source/view.c | 16 +-- source/wad.c | 14 +- source/wad.h | 16 +-- source/windows/net_win.c | 4 +- source/windows/net_wins.c | 58 ++++---- source/windows/net_wins.h | 26 ++-- source/windows/net_wipx.c | 52 +++---- source/windows/net_wipx.h | 26 ++-- source/windows/sys_sdl_win.c | 26 ++-- source/windows/wsaerror.h | 2 +- source/world.c | 52 +++---- source/world.h | 8 +- source/zone.c | 84 +++++------ source/zone.h | 24 ++-- 125 files changed, 2670 insertions(+), 2670 deletions(-) diff --git a/source/bgmusic.c b/source/bgmusic.c index fd22895..7cd9272 100644 --- a/source/bgmusic.c +++ b/source/bgmusic.c @@ -46,7 +46,7 @@ typedef struct music_handler_s { uint32_t type; /* 1U << n (see snd_codec.h) */ bgm_player_t player; /* Enumerated bgm player type */ - int is_available; /* -1 means not present */ + int32_t is_available; /* -1 means not present */ const char *ext; /* Expected file extension */ const char *dir; /* Where to look for music file */ struct music_handler_s *next; @@ -126,7 +126,7 @@ static void BGM_Stop_f (void) bool BGM_Init (void) { music_handler_t *handlers = NULL; - int i; + int32_t i; Cvar_RegisterVariable(&bgm_extmusic); Cmd_AddCommand("music", BGM_Play_f); @@ -313,7 +313,7 @@ void BGM_PlayCDtrack (byte track, bool looping) if (! CDRIPTYPE(handler->type)) goto _next; q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s", - MUSIC_DIRNAME, (int)track, handler->ext); + MUSIC_DIRNAME, (int32_t)track, handler->ext); if (! COM_FileExists(tmp, &path_id)) goto _next; if (path_id > prev_id) @@ -326,11 +326,11 @@ void BGM_PlayCDtrack (byte track, bool looping) handler = handler->next; } if (ext == NULL) - Con_Printf("Couldn't find a cdrip for track %d\n", (int)track); + Con_Printf("Couldn't find a cdrip for track %d\n", (int32_t)track); else { q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s", - MUSIC_DIRNAME, (int)track, ext); + MUSIC_DIRNAME, (int32_t)track, ext); bgmstream = S_CodecOpenStreamType(tmp, type); if (! bgmstream) Con_Printf("Couldn't handle music file %s\n", tmp); @@ -372,10 +372,10 @@ void BGM_Resume (void) static void BGM_UpdateStream (void) { bool did_rewind = false; - int res; /* Number of bytes read. */ - int bufferSamples; - int fileSamples; - int fileBytes; + int32_t res; /* Number of bytes read. */ + int32_t bufferSamples; + int32_t fileSamples; + int32_t fileBytes; byte raw[16384]; if (bgmstream->status != STREAM_PLAY) @@ -400,9 +400,9 @@ static void BGM_UpdateStream (void) /* our max buffer size */ fileBytes = fileSamples * (bgmstream->info.width * bgmstream->info.channels); - if (fileBytes > (int) sizeof(raw)) + if (fileBytes > (int32_t) sizeof(raw)) { - fileBytes = (int) sizeof(raw); + fileBytes = (int32_t) sizeof(raw); fileSamples = fileBytes / (bgmstream->info.width * bgmstream->info.channels); } diff --git a/source/bspfile.h b/source/bspfile.h index 5c19dc2..c0249d9 100644 --- a/source/bspfile.h +++ b/source/bspfile.h @@ -70,7 +70,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { - int fileofs, filelen; + int32_t fileofs, filelen; } lump_t; #define LUMP_ENTITIES 0 @@ -95,21 +95,21 @@ typedef struct { float mins[3], maxs[3]; float origin[3]; - int headnode[MAX_MAP_HULLS]; - int visleafs; // not including the solid leaf 0 - int firstface, numfaces; + int32_t headnode[MAX_MAP_HULLS]; + int32_t visleafs; // not including the solid leaf 0 + int32_t firstface, numfaces; } dmodel_t; typedef struct { - int version; + int32_t version; lump_t lumps[HEADER_LUMPS]; } dheader_t; typedef struct { - int nummiptex; - int dataofs[4]; // [nummiptex] + int32_t nummiptex; + int32_t dataofs[4]; // [nummiptex] } dmiptexlump_t; #define MIPLEVELS 4 @@ -141,7 +141,7 @@ typedef struct { float normal[3]; float dist; - int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate + int32_t type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate } dplane_t; @@ -165,7 +165,7 @@ typedef struct // !!! if this is changed, it must be changed in asm_i386.h too !!! typedef struct { - int planenum; + int32_t planenum; int16_t children[2]; // negative numbers are -(leafs+1), not nodes int16_t mins[3]; // for sphere culling int16_t maxs[3]; @@ -175,8 +175,8 @@ typedef struct typedef struct { - int planenum; - int children[2]; // negative numbers are -(leafs+1), not nodes + int32_t planenum; + int32_t children[2]; // negative numbers are -(leafs+1), not nodes int16_t mins[3]; // for sphere culling int16_t maxs[3]; uint32_t firstface; @@ -185,8 +185,8 @@ typedef struct typedef struct { - int planenum; - int children[2]; // negative numbers are -(leafs+1), not nodes + int32_t planenum; + int32_t children[2]; // negative numbers are -(leafs+1), not nodes float mins[3]; // for sphere culling float maxs[3]; uint32_t firstface; @@ -195,22 +195,22 @@ typedef struct typedef struct { - int planenum; + int32_t planenum; int16_t children[2]; // negative numbers are contents } dsclipnode_t; typedef struct { - int planenum; - int children[2]; // negative numbers are contents + int32_t planenum; + int32_t children[2]; // negative numbers are contents } dlclipnode_t; typedef struct texinfo_s { float vecs[2][4]; // [s/t][xyz offset] - int miptex; - int flags; + int32_t miptex; + int32_t flags; } texinfo_t; #define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision #define TEX_MISSING 2 // johnfitz -- this texinfo does not have a texture @@ -233,27 +233,27 @@ typedef struct int16_t planenum; int16_t side; - int firstedge; // we must support > 64k edges + int32_t firstedge; // we must support > 64k edges int16_t numedges; int16_t texinfo; // lighting info byte styles[MAXLIGHTMAPS]; - int lightofs; // start of [numstyles*surfsize] samples + int32_t lightofs; // start of [numstyles*surfsize] samples } dsface_t; typedef struct { - int planenum; - int side; + int32_t planenum; + int32_t side; - int firstedge; // we must support > 64k edges - int numedges; - int texinfo; + int32_t firstedge; // we must support > 64k edges + int32_t numedges; + int32_t texinfo; // lighting info byte styles[MAXLIGHTMAPS]; - int lightofs; // start of [numstyles*surfsize] samples + int32_t lightofs; // start of [numstyles*surfsize] samples } dlface_t; #define AMBIENT_WATER 0 @@ -267,8 +267,8 @@ typedef struct // all other leafs need visibility info typedef struct { - int contents; - int visofs; // -1 = no visibility info + int32_t contents; + int32_t visofs; // -1 = no visibility info int16_t mins[3]; // for frustum culling int16_t maxs[3]; @@ -281,8 +281,8 @@ typedef struct typedef struct { - int contents; - int visofs; // -1 = no visibility info + int32_t contents; + int32_t visofs; // -1 = no visibility info int16_t mins[3]; // for frustum culling int16_t maxs[3]; @@ -295,8 +295,8 @@ typedef struct typedef struct { - int contents; - int visofs; // -1 = no visibility info + int32_t contents; + int32_t visofs; // -1 = no visibility info float mins[3]; // for frustum culling float maxs[3]; diff --git a/source/cd_null.c b/source/cd_null.c index 996643d..1c68df7 100644 --- a/source/cd_null.c +++ b/source/cd_null.c @@ -20,7 +20,7 @@ #include "quakedef.h" -int CDAudio_Play(byte track, bool looping) +int32_t CDAudio_Play(byte track, bool looping) { (void)track, (void)looping; return -1; @@ -42,7 +42,7 @@ void CDAudio_Update(void) { } -int CDAudio_Init(void) +int32_t CDAudio_Init(void) { Con_Printf("CDAudio disabled at compile time\n"); return -1; diff --git a/source/cd_sdl.c b/source/cd_sdl.c index 0538753..aa11d98 100644 --- a/source/cd_sdl.c +++ b/source/cd_sdl.c @@ -43,7 +43,7 @@ static byte remap[100]; static byte playTrack; static double endOfTrack = -1.0, pausetime = -1.0; static SDL_CD *cd_handle; -static int cd_dev = -1; +static int32_t cd_dev = -1; static float old_cdvolume; static bool hw_vol_works = true; @@ -60,7 +60,7 @@ static void CDAudio_Eject(void) Con_Printf ("Unable to eject CD-ROM: %s\n", SDL_GetError ()); } -static int CDAudio_GetAudioDiskInfo(void) +static int32_t CDAudio_GetAudioDiskInfo(void) { cdValid = false; @@ -75,9 +75,9 @@ static int CDAudio_GetAudioDiskInfo(void) return 0; } -int CDAudio_Play(byte track, bool looping) +int32_t CDAudio_Play(byte track, bool looping) { - int len_m, len_s, len_f; + int32_t len_m, len_s, len_f; if (!cd_handle || !enabled) return -1; @@ -198,9 +198,9 @@ void CDAudio_Resume(void) pausetime = -1.0; } -static int get_first_audiotrk (void) +static int32_t get_first_audiotrk (void) { - int i; + int32_t i; for (i = 0; i < cd_handle->numtracks; ++i) if (cd_handle->track[i].type != SDL_DATA_TRACK) return ++i; @@ -210,7 +210,7 @@ static int get_first_audiotrk (void) static void CD_f (void) { const char *command; - int ret, n; + int32_t ret, n; if (Cmd_Argc() < 2) { @@ -317,8 +317,8 @@ static void CD_f (void) if (q_strcasecmp(command, "info") == 0) { - int current_min, current_sec, current_frame; - int length_min, length_sec, length_frame; + int32_t current_min, current_sec, current_frame; + int32_t length_min, length_sec, length_frame; Con_Printf ("%u tracks\n", cd_handle->numtracks); @@ -476,7 +476,7 @@ static void export_cddev_arg (void) /* Bad ugly hack to workaround SDL's cdrom device detection. * not needed for windows due to the way SDL_cdrom works. */ #if !defined(_WIN32) - int i = COM_CheckParm("-cddev"); + int32_t i = COM_CheckParm("-cddev"); if (i != 0 && i < com_argc - 1 && com_argv[i+1][0] != '\0') { static char arg[64]; @@ -486,9 +486,9 @@ static void export_cddev_arg (void) #endif } -int CDAudio_Init(void) +int32_t CDAudio_Init(void) { - int i, sdl_num_drives; + int32_t i, sdl_num_drives; if (safemode || COM_CheckParm("-nocdaudio")) return -1; diff --git a/source/cdaudio.h b/source/cdaudio.h index d52078a..6f90978 100644 --- a/source/cdaudio.h +++ b/source/cdaudio.h @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __CDAUDIO_H #define __CDAUDIO_H -int CDAudio_Init (void); -int CDAudio_Play (byte track, bool looping); +int32_t CDAudio_Init (void); +int32_t CDAudio_Play (byte track, bool looping); /* returns 0 for success, -1 for failure. */ void CDAudio_Stop (void); void CDAudio_Pause (void); diff --git a/source/cfgfile.c b/source/cfgfile.c index 83b81d3..016514c 100644 --- a/source/cfgfile.c +++ b/source/cfgfile.c @@ -35,10 +35,10 @@ the num_vars argument must be the exact number of strings in the array, otherwise I have nothing against going out of bounds. =================== */ -void CFG_ReadCvars (const char **vars, int num_vars) +void CFG_ReadCvars (const char **vars, int32_t num_vars) { char buff[1024], *tmp; - int i, j; + int32_t i, j; if (!cfg_file || num_vars < 1) return; @@ -118,10 +118,10 @@ values of cvars in the given list. doesn't do anything with the config file. =================== */ -void CFG_ReadCvarOverrides (const char **vars, int num_vars) +void CFG_ReadCvarOverrides (const char **vars, int32_t num_vars) { char buff[64]; - int i, j; + int32_t i, j; if (num_vars < 1) return; @@ -150,7 +150,7 @@ void CFG_CloseConfig (void) } } -int CFG_OpenConfig (const char *cfg_name) +int32_t CFG_OpenConfig (const char *cfg_name) { FILE *f; long length; diff --git a/source/cfgfile.h b/source/cfgfile.h index dbe8f39..869b17b 100644 --- a/source/cfgfile.h +++ b/source/cfgfile.h @@ -22,18 +22,18 @@ #ifndef __CFGFILE_H #define __CFGFILE_H -int CFG_OpenConfig (const char *cfg_name); +int32_t CFG_OpenConfig (const char *cfg_name); // opens the given config file. only one open config file is // kept: previosly opened one, if any, will be closed. void CFG_CloseConfig (void); // closes the currently open config file. -void CFG_ReadCvars (const char **vars, int num_vars); +void CFG_ReadCvars (const char **vars, int32_t num_vars); // reads the values of cvars in the given list from the opened // config file. -void CFG_ReadCvarOverrides (const char **vars, int num_vars); +void CFG_ReadCvarOverrides (const char **vars, int32_t num_vars); // convenience function, reading the "+" command line override // values of cvars in the given list. doesn't do anything with // the config file. call this after CFG_ReadCvars() and before diff --git a/source/chase.c b/source/chase.c index 6ddd25b..3b987e8 100644 --- a/source/chase.c +++ b/source/chase.c @@ -83,7 +83,7 @@ TODO: stay at least 8 units away from all walls in this leaf */ void Chase_UpdateForDrawing (void) { - int i; + int32_t i; vec3_t forward, up, right; vec3_t ideal, crosshair, temp; diff --git a/source/cl_demo.c b/source/cl_demo.c index 5878bc6..7ae84ad 100644 --- a/source/cl_demo.c +++ b/source/cl_demo.c @@ -38,7 +38,7 @@ read from the demo file. // from ProQuake: space to fill out the demo header for record at any time static byte demo_head[3][MAX_MSGLEN]; -static int demo_head_size[2]; +static int32_t demo_head_size[2]; /* ============== @@ -71,8 +71,8 @@ Dumps the current net message, prefixed by the length and view angles */ static void CL_WriteDemoMessage (void) { - int len; - int i; + int32_t len; + int32_t i; float f; len = LittleLong (net_message.cursize); @@ -86,9 +86,9 @@ static void CL_WriteDemoMessage (void) fflush (cls.demofile); } -static int CL_GetDemoMessage (void) +static int32_t CL_GetDemoMessage (void) { - int r, i; + int32_t r, i; float f; if (cls.demopaused) @@ -142,9 +142,9 @@ CL_GetMessage Handles recording and playback of demos, on top of NET_ code ==================== */ -int CL_GetMessage (void) +int32_t CL_GetMessage (void) { - int r; + int32_t r; if (cls.demoplayback) return CL_GetDemoMessage (); @@ -220,9 +220,9 @@ record [cd track] */ void CL_Record_f (void) { - int c; + int32_t c; char name[MAX_OSPATH]; - int track; + int32_t track; if (cmd_source != src_command) return; @@ -303,8 +303,8 @@ void CL_Record_f (void) if (c == 2 && cls.state == ca_connected) { byte *data = net_message.data; - int cursize = net_message.cursize; - int i; + int32_t cursize = net_message.cursize; + int32_t i; for (i = 0; i < 2; i++) { @@ -382,7 +382,7 @@ play [demoname] void CL_PlayDemo_f (void) { char name[MAX_OSPATH]; - int i, c; + int32_t i, c; bool neg; if (cmd_source != src_command) @@ -459,7 +459,7 @@ CL_FinishTimeDemo */ static void CL_FinishTimeDemo (void) { - int frames; + int32_t frames; float time; cls.timedemo = false; diff --git a/source/cl_input.c b/source/cl_input.c index 204269e..6844fe3 100644 --- a/source/cl_input.c +++ b/source/cl_input.c @@ -57,12 +57,12 @@ kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright; kbutton_t in_strafe, in_speed, in_use, in_jump, in_attack; kbutton_t in_up, in_down; -int in_impulse; +int32_t in_impulse; void KeyDown (kbutton_t *b) { - int k; + int32_t k; const char *c; c = Cmd_Argv(1); @@ -91,7 +91,7 @@ void KeyDown (kbutton_t *b) void KeyUp (kbutton_t *b) { - int k; + int32_t k; const char *c; c = Cmd_Argv(1); @@ -339,8 +339,8 @@ CL_SendMove */ void CL_SendMove (const usercmd_t *cmd) { - int i; - int bits; + int32_t i; + int32_t bits; sizebuf_t buf; byte data[128]; diff --git a/source/cl_main.c b/source/cl_main.c index 110098d..5b01a57 100644 --- a/source/cl_main.c +++ b/source/cl_main.c @@ -56,9 +56,9 @@ lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES]; dlight_t cl_dlights[MAX_DLIGHTS]; entity_t *cl_entities; //johnfitz -- was a static array, now on hunk -int cl_max_edicts; //johnfitz -- only changes when new map loads +int32_t cl_max_edicts; //johnfitz -- only changes when new map loads -int cl_numvisedicts; +int32_t cl_numvisedicts; entity_t *cl_visedicts[MAX_VISEDICTS]; extern cvar_t r_lerpmodels, r_lerpmove; //johnfitz @@ -86,7 +86,7 @@ void CL_ClearState (void) memset (cl_beams, 0, sizeof(cl_beams)); //johnfitz -- cl_entities is now dynamically allocated - cl_max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS); + cl_max_edicts = CLAMP (MIN_EDICTS,(int32_t)max_edicts.value,MAX_EDICTS); cl_entities = (entity_t *) Hunk_AllocName (cl_max_edicts*sizeof(entity_t), "cl_entities"); //johnfitz } @@ -195,7 +195,7 @@ void CL_SignonReply (void) MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string)); MSG_WriteByte (&cls.message, clc_stringcmd); - MSG_WriteString (&cls.message, va("color %i %i\n", ((int)cl_color.value)>>4, ((int)cl_color.value)&15)); + MSG_WriteString (&cls.message, va("color %i %i\n", ((int32_t)cl_color.value)>>4, ((int32_t)cl_color.value)&15)); MSG_WriteByte (&cls.message, clc_stringcmd); sprintf (str, "spawn %s", cls.spawnparms); @@ -255,7 +255,7 @@ CL_PrintEntities_f void CL_PrintEntities_f (void) { entity_t *ent; - int i; + int32_t i; if (cls.state != ca_connected) return; @@ -279,9 +279,9 @@ CL_AllocDlight =============== */ -dlight_t *CL_AllocDlight (int key) +dlight_t *CL_AllocDlight (int32_t key) { - int i; + int32_t i; dlight_t *dl; // first look for an exact key match @@ -329,7 +329,7 @@ CL_DecayLights */ void CL_DecayLights (void) { - int i; + int32_t i; dlight_t *dl; float time; @@ -405,7 +405,7 @@ CL_RelinkEntities void CL_RelinkEntities (void) { entity_t *ent; - int i, j; + int32_t i, j; float frac, f, d; vec3_t delta; float bobjrotate; @@ -590,15 +590,15 @@ CL_ReadFromServer Read all incoming data from the server =============== */ -int CL_ReadFromServer (void) +int32_t CL_ReadFromServer (void) { - int ret; - extern int num_temp_entities; //johnfitz - int num_beams = 0; //johnfitz - int num_dlights = 0; //johnfitz + int32_t ret; + extern int32_t num_temp_entities; //johnfitz + int32_t num_beams = 0; //johnfitz + int32_t num_dlights = 0; //johnfitz beam_t *b; //johnfitz dlight_t *l; //johnfitz - int i; //johnfitz + int32_t i; //johnfitz cl.oldtime = cl.time; @@ -728,7 +728,7 @@ void CL_Tracepos_f (void) if (VectorLength(w) == 0) Con_Printf ("Tracepos: trace didn't hit anything\n"); else - Con_Printf ("Tracepos: (%i %i %i)\n", (int)w[0], (int)w[1], (int)w[2]); + Con_Printf ("Tracepos: (%i %i %i)\n", (int32_t)w[0], (int32_t)w[1], (int32_t)w[2]); } /* @@ -745,21 +745,21 @@ void CL_Viewpos_f (void) #if 0 //camera position Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n", - (int)r_refdef.vieworg[0], - (int)r_refdef.vieworg[1], - (int)r_refdef.vieworg[2], - (int)r_refdef.viewangles[PITCH], - (int)r_refdef.viewangles[YAW], - (int)r_refdef.viewangles[ROLL]); + (int32_t)r_refdef.vieworg[0], + (int32_t)r_refdef.vieworg[1], + (int32_t)r_refdef.vieworg[2], + (int32_t)r_refdef.viewangles[PITCH], + (int32_t)r_refdef.viewangles[YAW], + (int32_t)r_refdef.viewangles[ROLL]); #else //player position Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n", - (int)cl_entities[cl.viewentity].origin[0], - (int)cl_entities[cl.viewentity].origin[1], - (int)cl_entities[cl.viewentity].origin[2], - (int)cl.viewangles[PITCH], - (int)cl.viewangles[YAW], - (int)cl.viewangles[ROLL]); + (int32_t)cl_entities[cl.viewentity].origin[0], + (int32_t)cl_entities[cl.viewentity].origin[1], + (int32_t)cl_entities[cl.viewentity].origin[2], + (int32_t)cl.viewangles[PITCH], + (int32_t)cl.viewangles[YAW], + (int32_t)cl.viewangles[ROLL]); #endif } diff --git a/source/cl_parse.c b/source/cl_parse.c index 32c4a6d..30b3eea 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -102,7 +102,7 @@ CL_EntityNum This error checks and tracks the total number of entities =============== */ -entity_t *CL_EntityNum (int num) +entity_t *CL_EntityNum (int32_t num) { //johnfitz -- check minimum number too if (num < 0) @@ -133,12 +133,12 @@ CL_ParseStartSoundPacket void CL_ParseStartSoundPacket(void) { vec3_t pos; - int channel, ent; - int sound_num; - int volume; - int field_mask; + int32_t channel, ent; + int32_t sound_num; + int32_t volume; + int32_t field_mask; float attenuation; - int i; + int32_t i; field_mask = MSG_ReadByte(); @@ -198,7 +198,7 @@ void CL_KeepaliveMessage (void) { float time; static float lastmsg; - int ret; + int32_t ret; sizebuf_t old; byte *olddata; @@ -256,8 +256,8 @@ CL_ParseServerInfo void CL_ParseServerInfo (void) { const char *str; - int i; - int nummodels, numsounds; + int32_t i; + int32_t nummodels, numsounds; char model_precache[MAX_MODELS][MAX_QPATH]; char sound_precache[MAX_SOUNDS][MAX_QPATH]; @@ -419,15 +419,15 @@ If an entities model or origin changes from frame to frame, it must be relinked. Other attributes can change without relinking. ================== */ -void CL_ParseUpdate (int bits) +void CL_ParseUpdate (int32_t bits) { - int i; + int32_t i; qmodel_t *model; - int modnum; + int32_t modnum; bool forcelink; entity_t *ent; - int num; - int skin; + int32_t num; + int32_t skin; if (cls.signon == SIGNONS - 1) { // first update is the final signon stage @@ -635,10 +635,10 @@ void CL_ParseUpdate (int bits) CL_ParseBaseline ================== */ -void CL_ParseBaseline (entity_t *ent, int version) //johnfitz -- added argument +void CL_ParseBaseline (entity_t *ent, int32_t version) //johnfitz -- added argument { - int i; - int bits; //johnfitz + int32_t i; + int32_t bits; //johnfitz //johnfitz -- PROTOCOL_FITZQUAKE bits = (version == 2) ? MSG_ReadByte() : 0; @@ -667,8 +667,8 @@ Server information pertaining to this client only */ void CL_ParseClientdata (void) { - int i, j; - int bits; //johnfitz + int32_t i, j; + int32_t bits; //johnfitz bits = (uint16_t)MSG_ReadShort (); //johnfitz -- read bits here isntead of in CL_ParseServerMessage() @@ -831,10 +831,10 @@ void CL_ParseClientdata (void) CL_NewTranslation ===================== */ -void CL_NewTranslation (int slot) +void CL_NewTranslation (int32_t slot) { - int i, j; - int top, bottom; + int32_t i, j; + int32_t top, bottom; byte *dest, *source; if (slot > cl.maxclients) @@ -871,10 +871,10 @@ void CL_NewTranslation (int slot) CL_ParseStatic ===================== */ -void CL_ParseStatic (int version) //johnfitz -- added a parameter +void CL_ParseStatic (int32_t version) //johnfitz -- added a parameter { entity_t *ent; - int i; + int32_t i; i = cl.num_statics; if (i >= MAX_STATIC_ENTITIES) @@ -905,11 +905,11 @@ void CL_ParseStatic (int version) //johnfitz -- added a parameter CL_ParseStaticSound =================== */ -void CL_ParseStaticSound (int version) //johnfitz -- added argument +void CL_ParseStaticSound (int32_t version) //johnfitz -- added argument { vec3_t org; - int sound_num, vol, atten; - int i; + int32_t sound_num, vol, atten; + int32_t i; for (i = 0; i < 3; i++) org[i] = MSG_ReadCoord (cl.protocolflags); @@ -937,10 +937,10 @@ CL_ParseServerMessage */ void CL_ParseServerMessage (void) { - int cmd; - int i; + int32_t cmd; + int32_t i; const char *str; //johnfitz - int total, j, lastcmd; //johnfitz + int32_t total, j, lastcmd; //johnfitz // // if recording demos, copy the message out diff --git a/source/cl_tent.c b/source/cl_tent.c index b1c9b8c..6333063 100644 --- a/source/cl_tent.c +++ b/source/cl_tent.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -int num_temp_entities; +int32_t num_temp_entities; entity_t cl_temp_entities[MAX_TEMP_ENTITIES]; beam_t cl_beams[MAX_BEAMS]; @@ -58,10 +58,10 @@ CL_ParseBeam */ void CL_ParseBeam (qmodel_t *m) { - int ent; + int32_t ent; vec3_t start, end; beam_t *b; - int i; + int32_t i; ent = MSG_ReadShort (); @@ -115,11 +115,11 @@ CL_ParseTEnt */ void CL_ParseTEnt (void) { - int type; + int32_t type; vec3_t pos; dlight_t *dl; - int rnd; - int colorStart, colorLength; + int32_t rnd; + int32_t colorStart, colorLength; type = MSG_ReadByte (); switch (type) @@ -291,7 +291,7 @@ CL_UpdateTEnts */ void CL_UpdateTEnts (void) { - int i, j; //johnfitz -- use j instead of using i twice, so we don't corrupt memory + int32_t i, j; //johnfitz -- use j instead of using i twice, so we don't corrupt memory beam_t *b; vec3_t dist, org; float d; @@ -301,7 +301,7 @@ void CL_UpdateTEnts (void) num_temp_entities = 0; - srand ((int) (cl.time * 1000)); //johnfitz -- freeze beams when paused + srand ((int32_t) (cl.time * 1000)); //johnfitz -- freeze beams when paused // update lightning for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++) @@ -328,12 +328,12 @@ void CL_UpdateTEnts (void) } else { - yaw = (int) (atan2(dist[1], dist[0]) * 180 / M_PI); + yaw = (int32_t) (atan2(dist[1], dist[0]) * 180 / M_PI); if (yaw < 0) yaw += 360; forward = sqrt (dist[0]*dist[0] + dist[1]*dist[1]); - pitch = (int) (atan2(dist[2], forward) * 180 / M_PI); + pitch = (int32_t) (atan2(dist[2], forward) * 180 / M_PI); if (pitch < 0) pitch += 360; } diff --git a/source/client.h b/source/client.h index 9344b28..dd24429 100644 --- a/source/client.h +++ b/source/client.h @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { - int length; + int32_t length; char map[MAX_STYLESTRING]; char average; //johnfitz char peak; //johnfitz @@ -37,15 +37,15 @@ typedef struct { char name[MAX_SCOREBOARDNAME]; float entertime; - int frags; - int colors; // two 4 bit fields + int32_t frags; + int32_t colors; // two 4 bit fields byte translations[VID_GRADES*256]; } scoreboard_t; typedef struct { - int destcolor[3]; - int percent; // 0-256 + int32_t destcolor[3]; + int32_t percent; // 0-256 } cshift_t; #define CSHIFT_CONTENTS 0 @@ -71,7 +71,7 @@ typedef struct float die; // stop lighting after this time float decay; // drop this each second float minlight; // don't add when contributing less - int key; + int32_t key; vec3_t color; //johnfitz -- lit support via lordhavoc } dlight_t; @@ -79,7 +79,7 @@ typedef struct #define MAX_BEAMS 32 //johnfitz -- was 24 typedef struct { - int entity; + int32_t entity; struct qmodel_s *model; float endtime; vec3_t start, end; @@ -107,7 +107,7 @@ typedef struct char spawnparms[MAX_MAPSTRING]; // to restart a level // demo loop control - int demonum; // -1 = don't play demos + int32_t demonum; // -1 = don't play demos char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing // demo recording info must be here, because record is started before @@ -120,14 +120,14 @@ typedef struct bool demopaused; bool timedemo; - int forcetrack; // -1 = use normal cd track + int32_t forcetrack; // -1 = use normal cd track FILE *demofile; - int td_lastframe; // to meter out one message a frame - int td_startframe; // host_framecount at start + int32_t td_lastframe; // to meter out one message a frame + int32_t td_startframe; // host_framecount at start float td_starttime; // realtime at second frame of timedemo // connection information - int signon; // 0 to SIGNONS + int32_t signon; // 0 to SIGNONS struct qsocket_s *netcon; sizebuf_t message; // writing buffer to send to server @@ -141,15 +141,15 @@ extern client_static_t cls; // typedef struct { - int movemessages; // since connecting to this server + int32_t movemessages; // since connecting to this server // throw out the first couple, so the player // doesn't accidentally do something the // first frame usercmd_t cmd; // last command sent to the server // information for local display - int stats[MAX_CL_STATS]; // health, etc - int items; // inventory bit flags + int32_t stats[MAX_CL_STATS]; // health, etc + int32_t items; // inventory bit flags float item_gettime[32]; // cl.time of aquiring item, for blinking float faceanimtime; // use anim frame if cl.time < this @@ -184,8 +184,8 @@ typedef struct bool onground; bool inwater; - int intermission; // don't change view angle, full screen, etc - int completed_time; // latched at intermission start + int32_t intermission; // don't change view angle, full screen, etc + int32_t completed_time; // latched at intermission start double mtime[2]; // the timestamp of last two messages double time; // clients view of time, should be between @@ -205,19 +205,19 @@ typedef struct char mapname[128]; char levelname[128]; // for display on solo scoreboard //johnfitz -- was 40. - int viewentity; // cl_entitites[cl.viewentity] = player - int maxclients; - int gametype; + int32_t viewentity; // cl_entitites[cl.viewentity] = player + int32_t maxclients; + int32_t gametype; // refresh related state struct qmodel_s *worldmodel; // cl_entitites[0].model struct efrag_s *free_efrags; - int num_efrags; - int num_entities; // held in cl_entities array - int num_statics; // held in cl_staticentities array + int32_t num_efrags; + int32_t num_entities; // held in cl_entities array + int32_t num_statics; // held in cl_staticentities array entity_t viewent; // the gun model - int cdtrack, looptrack; // cd audio + int32_t cdtrack, looptrack; // cd audio // frag scoreboard scoreboard_t *scores; // [cl.maxclients] @@ -278,17 +278,17 @@ extern dlight_t cl_dlights[MAX_DLIGHTS]; extern entity_t cl_temp_entities[MAX_TEMP_ENTITIES]; extern beam_t cl_beams[MAX_BEAMS]; extern entity_t *cl_visedicts[MAX_VISEDICTS]; -extern int cl_numvisedicts; +extern int32_t cl_numvisedicts; extern entity_t *cl_entities; //johnfitz -- was a static array, now on hunk -extern int cl_max_edicts; //johnfitz -- only changes when new map loads +extern int32_t cl_max_edicts; //johnfitz -- only changes when new map loads //============================================================================= // // cl_main // -dlight_t *CL_AllocDlight (int key); +dlight_t *CL_AllocDlight (int32_t key); void CL_DecayLights (void); void CL_Init (void); @@ -308,8 +308,8 @@ void CL_NextDemo (void); // typedef struct { - int down[2]; // key nums holding it down - int state; // low bit is down state + int32_t down[2]; // key nums holding it down + int32_t state; // low bit is down state } kbutton_t; extern kbutton_t in_mlook, in_klook; @@ -319,7 +319,7 @@ extern kbutton_t in_speed; void CL_InitInput (void); void CL_SendCmd (void); void CL_SendMove (const usercmd_t *cmd); -int CL_ReadFromServer (void); +int32_t CL_ReadFromServer (void); void CL_BaseMove (usercmd_t *cmd); void CL_ParseTEnt (void); @@ -331,7 +331,7 @@ void CL_ClearState (void); // cl_demo.c // void CL_StopPlayback (void); -int CL_GetMessage (void); +int32_t CL_GetMessage (void); void CL_Stop_f (void); void CL_Record_f (void); @@ -342,7 +342,7 @@ void CL_TimeDemo_f (void); // cl_parse.c // void CL_ParseServerMessage (void); -void CL_NewTranslation (int slot); +void CL_NewTranslation (int32_t slot); // // view @@ -354,7 +354,7 @@ void V_RenderView (void); //void V_UpdatePalette (void); //johnfitz void V_Register (void); void V_ParseDamage (void); -void V_SetContentsColor (int contents); +void V_SetContentsColor (int32_t contents); // // cl_tent diff --git a/source/cmd.c b/source/cmd.c index eda7b2c..2088ef9 100644 --- a/source/cmd.c +++ b/source/cmd.c @@ -87,7 +87,7 @@ Adds command text at the end of the buffer */ void Cbuf_AddText (const char *text) { - int l; + int32_t l; l = Q_strlen (text); @@ -113,7 +113,7 @@ FIXME: actually change the command buffer to do less copying void Cbuf_InsertText (const char *text) { char *temp; - int templen; + int32_t templen; // copy off any commands still remaining in the exec buffer templen = cmd_text.cursize; @@ -144,10 +144,10 @@ Cbuf_Execute */ void Cbuf_Execute (void) { - int i; + int32_t i; char *text; char line[1024]; - int quotes; + int32_t quotes; while (cmd_text.cursize) { @@ -165,7 +165,7 @@ void Cbuf_Execute (void) break; } - if (i > (int)sizeof(line) - 1) + if (i > (int32_t)sizeof(line) - 1) { memcpy (line, text, sizeof(line) - 1); line[sizeof(line) - 1] = 0; @@ -223,7 +223,7 @@ void Cmd_StuffCmds_f (void) { extern cvar_t cmdline; char cmds[CMDLINE_LENGTH]; - int i, j, plus; + int32_t i, j, plus; plus = false; // On Unix, argv[0] is command name @@ -258,7 +258,7 @@ Cmd_Exec_f void Cmd_Exec_f (void) { char *f; - int mark; + int32_t mark; if (Cmd_Argc () != 2) { @@ -289,7 +289,7 @@ Just prints the rest of the line to the console */ void Cmd_Echo_f (void) { - int i; + int32_t i; for (i=1 ; i 1) { @@ -501,7 +501,7 @@ void Cmd_List_f (void) static char *Cmd_TintSubstring(const char *in, const char *substr, char *out, size_t outsize) { - int l; + int32_t l; char *m; q_strlcpy(out, in, outsize); while ((m = q_strcasestr(out, substr))) @@ -525,7 +525,7 @@ we don't support descriptions, so this isn't really all that useful, but even wi void Cmd_Apropos_f(void) { char tmpbuf[256]; - int hits = 0; + int32_t hits = 0; cmd_function_t *cmd; cvar_t *var; const char *substr = Cmd_Argv (1); @@ -582,7 +582,7 @@ void Cmd_Init (void) Cmd_Argc ============ */ -int Cmd_Argc (void) +int32_t Cmd_Argc (void) { return cmd_argc; } @@ -592,7 +592,7 @@ int Cmd_Argc (void) Cmd_Argv ============ */ -const char *Cmd_Argv (int arg) +const char *Cmd_Argv (int32_t arg) { if (arg < 0 || arg >= cmd_argc) return cmd_null_string; @@ -619,7 +619,7 @@ Parses the given string into command line tokens. */ void Cmd_TokenizeString (const char *text) { - int i; + int32_t i; // clear the args from the last string for (i=0 ; i argc, so string operations are allways safe. -int Cmd_CheckParm (const char *parm); +int32_t Cmd_CheckParm (const char *parm); // Returns the position (1 to argc-1) in the command's argument list // where the given parameter apears, or 0 if not present diff --git a/source/common.c b/source/common.c index be83532..b398cfe 100644 --- a/source/common.c +++ b/source/common.c @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static char *largv[MAX_NUM_ARGVS + 1]; static char argvdummy[] = " "; -int safemode; +int32_t safemode; cvar_t registered = {"registered","1",CVAR_ROM}; /* set to correct value in COM_CheckRegistered() */ cvar_t cmdline = {"cmdline","",CVAR_ROM/*|CVAR_SERVERINFO*/}; /* sending cmdline upon CCREQ_RULE_INFO is evil */ @@ -50,7 +50,7 @@ static void COM_Path_f (void); #define PAK0_CRC_V091 28804 /* id1/pak0.pak - v0.91/0.92, not supported */ char com_token[1024]; -int com_argc; +int32_t com_argc; char **com_argv; #define CMDLINE_LENGTH 256 /* johnfitz -- mirrored in cmd.c */ @@ -150,7 +150,7 @@ void InsertLinkAfter (link_t *l, link_t *after) ============================================================================ */ -int q_strcasecmp(const char * s1, const char * s2) +int32_t q_strcasecmp(const char * s1, const char * s2) { const char * p1 = s1; const char * p2 = s2; @@ -167,10 +167,10 @@ int q_strcasecmp(const char * s1, const char * s2) break; } while (c1 == c2); - return (int)(c1 - c2); + return (int32_t)(c1 - c2); } -int q_strncasecmp(const char *s1, const char *s2, size_t n) +int32_t q_strncasecmp(const char *s1, const char *s2, size_t n) { const char * p1 = s1; const char * p2 = s2; @@ -187,14 +187,14 @@ int q_strncasecmp(const char *s1, const char *s2, size_t n) break; } while (--n > 0); - return (int)(c1 - c2); + return (int32_t)(c1 - c2); } //spike -- grabbed this from fte, because its useful to me char *q_strcasestr(const char *haystack, const char *needle) { - int c1, c2, c2f; - int i; + int32_t c1, c2, c2f; + int32_t i; c2f = *needle; if (c2f >= 'a' && c2f <= 'z') c2f -= ('a' - 'A'); @@ -263,14 +263,14 @@ char *q_strupr (char *str) #define vsnprintf_func vsnprintf #endif -int q_vsnprintf(char *str, size_t size, const char *format, va_list args) +int32_t q_vsnprintf(char *str, size_t size, const char *format, va_list args) { - int ret; + int32_t ret; ret = vsnprintf_func (str, size, format, args); if (ret < 0) - ret = (int)size; + ret = (int32_t)size; if (size == 0) /* no buffer */ return ret; if ((size_t)ret >= size) @@ -279,9 +279,9 @@ int q_vsnprintf(char *str, size_t size, const char *format, va_list args) return ret; } -int q_snprintf (char *str, size_t size, const char *format, ...) +int32_t q_snprintf (char *str, size_t size, const char *format, ...) { - int ret; + int32_t ret; va_list argptr; va_start (argptr, format); @@ -291,7 +291,7 @@ int q_snprintf (char *str, size_t size, const char *format, ...) return ret; } -void Q_memset (void *dest, int fill, size_t count) +void Q_memset (void *dest, int32_t fill, size_t count) { size_t i; @@ -300,7 +300,7 @@ void Q_memset (void *dest, int fill, size_t count) count >>= 2; fill = fill | (fill<<8) | (fill<<16) | (fill<<24); for (i = 0; i < count; i++) - ((int *)dest)[i] = fill; + ((int32_t *)dest)[i] = fill; } else for (i = 0; i < count; i++) @@ -315,14 +315,14 @@ void Q_memcpy (void *dest, const void *src, size_t count) { count >>= 2; for (i = 0; i < count; i++) - ((int *)dest)[i] = ((int *)src)[i]; + ((int32_t *)dest)[i] = ((int32_t *)src)[i]; } else for (i = 0; i < count; i++) ((byte *)dest)[i] = ((byte *)src)[i]; } -int Q_memcmp (const void *m1, const void *m2, size_t count) +int32_t Q_memcmp (const void *m1, const void *m2, size_t count) { while(count) { @@ -342,7 +342,7 @@ void Q_strcpy (char *dest, const char *src) *dest++ = 0; } -void Q_strncpy (char *dest, const char *src, int count) +void Q_strncpy (char *dest, const char *src, int32_t count) { while (*src && count--) { @@ -352,9 +352,9 @@ void Q_strncpy (char *dest, const char *src, int count) *dest++ = 0; } -int Q_strlen (const char *str) +int32_t Q_strlen (const char *str) { - int count; + int32_t count; count = 0; while (str[count]) @@ -365,7 +365,7 @@ int Q_strlen (const char *str) char *Q_strrchr(const char *s, char c) { - int len = Q_strlen(s); + int32_t len = Q_strlen(s); s += len; while (len--) { @@ -381,7 +381,7 @@ void Q_strcat (char *dest, const char *src) Q_strcpy (dest, src); } -int Q_strcmp (const char *s1, const char *s2) +int32_t Q_strcmp (const char *s1, const char *s2) { while (1) { @@ -396,7 +396,7 @@ int Q_strcmp (const char *s1, const char *s2) return -1; } -int Q_strncmp (const char *s1, const char *s2, int count) +int32_t Q_strncmp (const char *s1, const char *s2, int32_t count) { while (1) { @@ -413,11 +413,11 @@ int Q_strncmp (const char *s1, const char *s2, int count) return -1; } -int Q_atoi (const char *str) +int32_t Q_atoi (const char *str) { - int val; - int sign; - int c; + int32_t val; + int32_t sign; + int32_t c; if (*str == '-') { @@ -475,9 +475,9 @@ int Q_atoi (const char *str) float Q_atof (const char *str) { double val; - int sign; - int c; - int decimal, total; + int32_t sign; + int32_t c; + int32_t decimal, total; if (*str == '-') { @@ -559,8 +559,8 @@ bool host_bigendian; int16_t (*BigShort) (int16_t l); int16_t (*LittleShort) (int16_t l); -int (*BigLong) (int l); -int (*LittleLong) (int l); +int32_t (*BigLong) (int32_t l); +int32_t (*LittleLong) (int32_t l); float (*BigFloat) (float l); float (*LittleFloat) (float l); @@ -579,7 +579,7 @@ int16_t ShortNoSwap (int16_t l) return l; } -int LongSwap (int l) +int32_t LongSwap (int32_t l) { byte b1, b2, b3, b4; @@ -588,10 +588,10 @@ int LongSwap (int l) b3 = (l>>16)&255; b4 = (l>>24)&255; - return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4; + return ((int32_t)b1<<24) + ((int32_t)b2<<16) + ((int32_t)b3<<8) + b4; } -int LongNoSwap (int l) +int32_t LongNoSwap (int32_t l) { return l; } @@ -631,7 +631,7 @@ Handles byte ordering and avoids alignment errors // writing functions // -void MSG_WriteChar (sizebuf_t *sb, int c) +void MSG_WriteChar (sizebuf_t *sb, int32_t c) { byte *buf; @@ -644,7 +644,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c) buf[0] = c; } -void MSG_WriteByte (sizebuf_t *sb, int c) +void MSG_WriteByte (sizebuf_t *sb, int32_t c) { byte *buf; @@ -657,7 +657,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c) buf[0] = c; } -void MSG_WriteShort (sizebuf_t *sb, int c) +void MSG_WriteShort (sizebuf_t *sb, int32_t c) { byte *buf; @@ -671,7 +671,7 @@ void MSG_WriteShort (sizebuf_t *sb, int c) buf[1] = c>>8; } -void MSG_WriteLong (sizebuf_t *sb, int c) +void MSG_WriteLong (sizebuf_t *sb, int32_t c) { byte *buf; @@ -687,7 +687,7 @@ void MSG_WriteFloat (sizebuf_t *sb, float f) union { float f; - int l; + int32_t l; } dat; dat.f = f; @@ -714,7 +714,7 @@ void MSG_WriteCoord16 (sizebuf_t *sb, float f) void MSG_WriteCoord24 (sizebuf_t *sb, float f) { MSG_WriteShort (sb, f); - MSG_WriteByte (sb, (int)(f*255)%255); + MSG_WriteByte (sb, (int32_t)(f*255)%255); } //johnfitz -- 32-bit float coords @@ -740,7 +740,7 @@ void MSG_WriteAngle (sizebuf_t *sb, float f, uint32_t flags) MSG_WriteFloat (sb, f); else if (flags & PRFL_SHORTANGLE) MSG_WriteShort (sb, Q_rint(f * 65536.0 / 360.0) & 65535); - else MSG_WriteByte (sb, Q_rint(f * 256.0 / 360.0) & 255); //johnfitz -- use Q_rint instead of (int) } + else MSG_WriteByte (sb, Q_rint(f * 256.0 / 360.0) & 255); //johnfitz -- use Q_rint instead of (int32_t) } } //johnfitz -- for PROTOCOL_FITZQUAKE @@ -755,7 +755,7 @@ void MSG_WriteAngle16 (sizebuf_t *sb, float f, uint32_t flags) // // reading functions // -int msg_readcount; +int32_t msg_readcount; bool msg_badread; void MSG_BeginReading (void) @@ -765,9 +765,9 @@ void MSG_BeginReading (void) } // returns -1 and sets msg_badread if no more characters are available -int MSG_ReadChar (void) +int32_t MSG_ReadChar (void) { - int c; + int32_t c; if (msg_readcount+1 > net_message.cursize) { @@ -781,9 +781,9 @@ int MSG_ReadChar (void) return c; } -int MSG_ReadByte (void) +int32_t MSG_ReadByte (void) { - int c; + int32_t c; if (msg_readcount+1 > net_message.cursize) { @@ -797,9 +797,9 @@ int MSG_ReadByte (void) return c; } -int MSG_ReadShort (void) +int32_t MSG_ReadShort (void) { - int c; + int32_t c; if (msg_readcount+2 > net_message.cursize) { @@ -815,9 +815,9 @@ int MSG_ReadShort (void) return c; } -int MSG_ReadLong (void) +int32_t MSG_ReadLong (void) { - int c; + int32_t c; if (msg_readcount+4 > net_message.cursize) { @@ -841,7 +841,7 @@ float MSG_ReadFloat (void) { byte b[4]; float f; - int l; + int32_t l; } dat; dat.b[0] = net_message.data[msg_readcount]; @@ -858,7 +858,7 @@ float MSG_ReadFloat (void) const char *MSG_ReadString (void) { static char string[2048]; - int c; + int32_t c; size_t l; l = 0; @@ -925,7 +925,7 @@ float MSG_ReadAngle16 (uint32_t flags) //=========================================================================== -void SZ_Alloc (sizebuf_t *buf, int startsize) +void SZ_Alloc (sizebuf_t *buf, int32_t startsize) { if (startsize < 256) startsize = 256; @@ -948,7 +948,7 @@ void SZ_Clear (sizebuf_t *buf) buf->cursize = 0; } -void *SZ_GetSpace (sizebuf_t *buf, int length) +void *SZ_GetSpace (sizebuf_t *buf, int32_t length) { void *data; @@ -971,14 +971,14 @@ void *SZ_GetSpace (sizebuf_t *buf, int length) return data; } -void SZ_Write (sizebuf_t *buf, const void *data, int length) +void SZ_Write (sizebuf_t *buf, const void *data, int32_t length) { Q_memcpy (SZ_GetSpace(buf,length),data,length); } void SZ_Print (sizebuf_t *buf, const char *data) { - int len = Q_strlen(data) + 1; + int32_t len = Q_strlen(data) + 1; if (buf->data[buf->cursize-1]) { /* no trailing 0 */ @@ -1019,7 +1019,7 @@ COM_StripExtension */ void COM_StripExtension (const char *in, char *out, size_t outsize) { - int length; + int32_t length; if (!*in) { @@ -1028,7 +1028,7 @@ void COM_StripExtension (const char *in, char *out, size_t outsize) } if (in != out) /* copy when not in-place editing */ q_strlcpy (out, in, outsize); - length = (int)strlen(out) - 1; + length = (int32_t)strlen(out) - 1; while (length > 0 && out[length] != '.') { --length; @@ -1162,8 +1162,8 @@ Parse a token out of a string */ const char *COM_Parse (const char *data) { - int c; - int len; + int32_t c; + int32_t len; len = 0; com_token[0] = 0; @@ -1251,9 +1251,9 @@ Returns the position (1 to argc-1) in the program's argument list where the given parameter apears, or 0 if not present ================ */ -int COM_CheckParm (const char *parm) +int32_t COM_CheckParm (const char *parm) { - int i; + int32_t i; for (i = 1; i < com_argc; i++) { @@ -1278,9 +1278,9 @@ being registered. */ static void COM_CheckRegistered (void) { - int h; + int32_t h; uint16_t check[128]; - int i; + int32_t i; COM_OpenFile("gfx/pop.lmp", &h, NULL); @@ -1323,9 +1323,9 @@ static void COM_CheckRegistered (void) COM_InitArgv ================ */ -void COM_InitArgv (int argc, char **argv) +void COM_InitArgv (int32_t argc, char **argv) { - int i, j, n; + int32_t i, j, n; // reconstitute the command line for the cmdline externally visible cvar n = 0; @@ -1391,7 +1391,7 @@ COM_Init */ void COM_Init (void) { - int i = 0x12345678; + int32_t i = 0x12345678; /* U N I X */ /* @@ -1454,7 +1454,7 @@ FIXME: make this buffer size safe someday static char *get_va_buffer(void) { static char va_buffers[VA_NUM_BUFFS][VA_BUFFERLEN]; - static int buffer_idx = 0; + static int32_t buffer_idx = 0; buffer_idx = (buffer_idx + 1) & (VA_NUM_BUFFS - 1); return va_buffers[buffer_idx]; } @@ -1480,7 +1480,7 @@ QUAKE FILESYSTEM ============================================================================= */ -int com_filesize; +int32_t com_filesize; // @@ -1489,21 +1489,21 @@ int com_filesize; typedef struct { char name[56]; - int filepos, filelen; + int32_t filepos, filelen; } dpackfile_t; typedef struct { char id[4]; - int dirofs; - int dirlen; + int32_t dirofs; + int32_t dirlen; } dpackheader_t; #define MAX_FILES_IN_PACK 2048 char com_gamedir[MAX_OSPATH]; char com_basedir[MAX_OSPATH]; -int file_from_pak; // ZOID: global indicating that file came from a pak +int32_t file_from_pak; // ZOID: global indicating that file came from a pak searchpath_t *com_searchpaths; searchpath_t *com_base_searchpaths; @@ -1536,9 +1536,9 @@ COM_WriteFile The filename will be prefixed by the current game directory ============ */ -void COM_WriteFile (const char *filename, const void *data, int len) +void COM_WriteFile (const char *filename, const void *data, int32_t len) { - int handle; + int32_t handle; char name[MAX_OSPATH]; Sys_mkdir (com_gamedir); //johnfitz -- if we've switched to a nonexistant gamedir, create it now so we don't crash @@ -1604,13 +1604,13 @@ If neither of file or handle is set, this can be used for detecting a file's presence. =========== */ -static int COM_FindFile (const char *filename, int *handle, FILE **file, +static int32_t COM_FindFile (const char *filename, int32_t *handle, FILE **file, uint32_t *path_id) { searchpath_t *search; char netpath[MAX_OSPATH]; pack_t *pak; - int i, findtime; + int32_t i, findtime; if (file && handle) Sys_Error ("COM_FindFile: both handle and file set"); @@ -1713,7 +1713,7 @@ Returns whether the file is found in the quake filesystem. */ bool COM_FileExists (const char *filename, uint32_t *path_id) { - int ret = COM_FindFile (filename, NULL, NULL, path_id); + int32_t ret = COM_FindFile (filename, NULL, NULL, path_id); return (ret == -1) ? false : true; } @@ -1726,7 +1726,7 @@ returns a handle and a length it may actually be inside a pak file =========== */ -int COM_OpenFile (const char *filename, int *handle, uint32_t *path_id) +int32_t COM_OpenFile (const char *filename, int32_t *handle, uint32_t *path_id) { return COM_FindFile (filename, handle, NULL, path_id); } @@ -1739,7 +1739,7 @@ If the requested file is inside a packfile, a new FILE * will be opened into the file. =========== */ -int COM_FOpenFile (const char *filename, FILE **file, uint32_t *path_id) +int32_t COM_FOpenFile (const char *filename, FILE **file, uint32_t *path_id) { return COM_FindFile (filename, NULL, file, path_id); } @@ -1751,7 +1751,7 @@ COM_CloseFile If it is a pak file handle, don't really close it ============ */ -void COM_CloseFile (int h) +void COM_CloseFile (int32_t h) { searchpath_t *s; @@ -1780,14 +1780,14 @@ Allways appends a 0 byte. static byte *loadbuf; static cache_user_t *loadcache; -static int loadsize; +static int32_t loadsize; -byte *COM_LoadFile (const char *path, int usehunk, uint32_t *path_id) +byte *COM_LoadFile (const char *path, int32_t usehunk, uint32_t *path_id) { - int h; + int32_t h; byte *buf; char base[32]; - int len; + int32_t len; buf = NULL; // quiet compiler warning @@ -1859,7 +1859,7 @@ void COM_LoadCacheFile (const char *path, struct cache_user_s *cu, uint32_t *pat } // uses temp hunk if larger than bufsize -byte *COM_LoadStackFile (const char *path, void *buffer, int bufsize, uint32_t *path_id) +byte *COM_LoadStackFile (const char *path, void *buffer, int32_t bufsize, uint32_t *path_id) { byte *buf; @@ -1912,23 +1912,23 @@ byte *COM_LoadMallocFile_TextMode_OSPath (const char *path, long *len_out) return data; } -const char *COM_ParseIntNewline(const char *buffer, int *value) +const char *COM_ParseIntNewline(const char *buffer, int32_t *value) { - int consumed = 0; + int32_t consumed = 0; sscanf (buffer, "%i\n%n", value, &consumed); return buffer + consumed; } const char *COM_ParseFloatNewline(const char *buffer, float *value) { - int consumed = 0; + int32_t consumed = 0; sscanf (buffer, "%f\n%n", value, &consumed); return buffer + consumed; } const char *COM_ParseStringNewline(const char *buffer) { - int consumed = 0; + int32_t consumed = 0; com_token[0] = '\0'; sscanf (buffer, "%1023s\n%n", com_token, &consumed); return buffer + consumed; @@ -1947,11 +1947,11 @@ of the list so they override previous pack files. static pack_t *COM_LoadPackFile (const char *packfile) { dpackheader_t header; - int i; + int32_t i; packfile_t *newfiles; - int numpackfiles; + int32_t numpackfiles; pack_t *pack; - int packhandle; + int32_t packhandle; dpackfile_t info[MAX_FILES_IN_PACK]; uint16_t crc; @@ -2021,7 +2021,7 @@ COM_AddGameDirectory -- johnfitz -- modified based on topaz's tutorial */ static void COM_AddGameDirectory (const char *base, const char *dir) { - int i; + int32_t i; uint32_t path_id; searchpath_t *search; pack_t *pak, *qspak; @@ -2227,7 +2227,7 @@ COM_InitFilesystem */ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial { - int i, j; + int32_t i, j; Cvar_RegisterVariable (®istered); Cvar_RegisterVariable (&cmdline); @@ -2334,11 +2334,11 @@ size_t FS_fread(void *ptr, size_t size, size_t nmemb, fshandle_t *fh) return nmemb_read; } -int FS_fseek(fshandle_t *fh, long offset, int whence) +int32_t FS_fseek(fshandle_t *fh, long offset, int32_t whence) { /* I don't care about 64 bit off_t or fseeko() here. * the quake/hexen2 file system is 32 bits, anyway. */ - int ret; + int32_t ret; if (!fh) { errno = EBADF; @@ -2378,7 +2378,7 @@ int FS_fseek(fshandle_t *fh, long offset, int whence) return 0; } -int FS_fclose(fshandle_t *fh) +int32_t FS_fclose(fshandle_t *fh) { if (!fh) { errno = EBADF; @@ -2404,7 +2404,7 @@ void FS_rewind(fshandle_t *fh) fh->pos = 0; } -int FS_feof(fshandle_t *fh) +int32_t FS_feof(fshandle_t *fh) { if (!fh) { errno = EBADF; @@ -2415,7 +2415,7 @@ int FS_feof(fshandle_t *fh) return 0; } -int FS_ferror(fshandle_t *fh) +int32_t FS_ferror(fshandle_t *fh) { if (!fh) { errno = EBADF; @@ -2424,7 +2424,7 @@ int FS_ferror(fshandle_t *fh) return ferror(fh->file); } -int FS_fgetc(fshandle_t *fh) +int32_t FS_fgetc(fshandle_t *fh) { if (!fh) { errno = EBADF; @@ -2436,7 +2436,7 @@ int FS_fgetc(fshandle_t *fh) return fgetc(fh->file); } -char *FS_fgets(char *s, int size, fshandle_t *fh) +char *FS_fgets(char *s, int32_t size, fshandle_t *fh) { char *ret; diff --git a/source/common.h b/source/common.h index fe8e5b2..8379192 100644 --- a/source/common.h +++ b/source/common.h @@ -52,15 +52,15 @@ typedef struct sizebuf_s bool allowoverflow; // if false, do a Sys_Error bool overflowed; // set to true if the buffer size failed byte *data; - int maxsize; - int cursize; + int32_t maxsize; + int32_t cursize; } sizebuf_t; -void SZ_Alloc (sizebuf_t *buf, int startsize); +void SZ_Alloc (sizebuf_t *buf, int32_t startsize); void SZ_Free (sizebuf_t *buf); void SZ_Clear (sizebuf_t *buf); -void *SZ_GetSpace (sizebuf_t *buf, int length); -void SZ_Write (sizebuf_t *buf, const void *data, int length); +void *SZ_GetSpace (sizebuf_t *buf, int32_t length); +void SZ_Write (sizebuf_t *buf, const void *data, int32_t length); void SZ_Print (sizebuf_t *buf, const char *data); // strcats onto the sizebuf //============================================================================ @@ -87,31 +87,31 @@ extern bool host_bigendian; extern int16_t (*BigShort) (int16_t l); extern int16_t (*LittleShort) (int16_t l); -extern int (*BigLong) (int l); -extern int (*LittleLong) (int l); +extern int32_t (*BigLong) (int32_t l); +extern int32_t (*LittleLong) (int32_t l); extern float (*BigFloat) (float l); extern float (*LittleFloat) (float l); //============================================================================ -void MSG_WriteChar (sizebuf_t *sb, int c); -void MSG_WriteByte (sizebuf_t *sb, int c); -void MSG_WriteShort (sizebuf_t *sb, int c); -void MSG_WriteLong (sizebuf_t *sb, int c); +void MSG_WriteChar (sizebuf_t *sb, int32_t c); +void MSG_WriteByte (sizebuf_t *sb, int32_t c); +void MSG_WriteShort (sizebuf_t *sb, int32_t c); +void MSG_WriteLong (sizebuf_t *sb, int32_t c); void MSG_WriteFloat (sizebuf_t *sb, float f); void MSG_WriteString (sizebuf_t *sb, const char *s); void MSG_WriteCoord (sizebuf_t *sb, float f, uint32_t flags); void MSG_WriteAngle (sizebuf_t *sb, float f, uint32_t flags); void MSG_WriteAngle16 (sizebuf_t *sb, float f, uint32_t flags); //johnfitz -extern int msg_readcount; +extern int32_t msg_readcount; extern bool msg_badread; // set if a read goes beyond end of message void MSG_BeginReading (void); -int MSG_ReadChar (void); -int MSG_ReadByte (void); -int MSG_ReadShort (void); -int MSG_ReadLong (void); +int32_t MSG_ReadChar (void); +int32_t MSG_ReadByte (void); +int32_t MSG_ReadShort (void); +int32_t MSG_ReadLong (void); float MSG_ReadFloat (void); const char *MSG_ReadString (void); @@ -121,25 +121,25 @@ float MSG_ReadAngle16 (uint32_t flags); //johnfitz //============================================================================ -void Q_memset (void *dest, int fill, size_t count); +void Q_memset (void *dest, int32_t fill, size_t count); void Q_memcpy (void *dest, const void *src, size_t count); -int Q_memcmp (const void *m1, const void *m2, size_t count); +int32_t Q_memcmp (const void *m1, const void *m2, size_t count); void Q_strcpy (char *dest, const char *src); -void Q_strncpy (char *dest, const char *src, int count); -int Q_strlen (const char *str); +void Q_strncpy (char *dest, const char *src, int32_t count); +int32_t Q_strlen (const char *str); char *Q_strrchr (const char *s, char c); void Q_strcat (char *dest, const char *src); -int Q_strcmp (const char *s1, const char *s2); -int Q_strncmp (const char *s1, const char *s2, int count); -int Q_atoi (const char *str); +int32_t Q_strcmp (const char *s1, const char *s2); +int32_t Q_strncmp (const char *s1, const char *s2, int32_t count); +int32_t Q_atoi (const char *str); float Q_atof (const char *str); #include "strl_fn.h" /* locale-insensitive strcasecmp replacement functions: */ -extern int q_strcasecmp (const char * s1, const char * s2); -extern int q_strncasecmp (const char *s1, const char *s2, size_t n); +extern int32_t q_strcasecmp (const char * s1, const char * s2); +extern int32_t q_strncasecmp (const char *s1, const char *s2, size_t n); /* locale-insensitive case-insensitive alternative to strstr */ extern char *q_strcasestr(const char *haystack, const char *needle); @@ -149,8 +149,8 @@ extern char *q_strlwr (char *str); extern char *q_strupr (char *str); /* snprintf, vsnprintf : always use our versions. */ -extern int q_snprintf (char *str, size_t size, const char *format, ...) FUNC_PRINTF(3,4); -extern int q_vsnprintf(char *str, size_t size, const char *format, va_list args) FUNC_PRINTF(3,0); +extern int32_t q_snprintf (char *str, size_t size, const char *format, ...) FUNC_PRINTF(3,4); +extern int32_t q_vsnprintf(char *str, size_t size, const char *format, va_list args) FUNC_PRINTF(3,0); //============================================================================ @@ -160,20 +160,20 @@ extern bool com_eof; const char *COM_Parse (const char *data); -extern int com_argc; +extern int32_t com_argc; extern char **com_argv; -extern int safemode; +extern int32_t safemode; /* safe mode: in true, the engine will behave as if one of these arguments were actually on the command line: -nosound, -nocdaudio, -nomidi, -stdvid, -dibonly, -nomouse, -nojoy, -nolan */ -int COM_CheckParm (const char *parm); +int32_t COM_CheckParm (const char *parm); void COM_Init (void); -void COM_InitArgv (int argc, char **argv); +void COM_InitArgv (int32_t argc, char **argv); void COM_InitFilesystem (void); const char *COM_SkipPath (const char *pathname); @@ -197,14 +197,14 @@ char *va (const char *format, ...) FUNC_PRINTF(1,2); typedef struct { char name[MAX_QPATH]; - int filepos, filelen; + int32_t filepos, filelen; } packfile_t; typedef struct pack_s { char filename[MAX_OSPATH]; - int handle; - int numfiles; + int32_t handle; + int32_t numfiles; packfile_t *files; } pack_t; @@ -221,23 +221,23 @@ typedef struct searchpath_s extern searchpath_t *com_searchpaths; extern searchpath_t *com_base_searchpaths; -extern int com_filesize; +extern int32_t com_filesize; struct cache_user_s; extern char com_basedir[MAX_OSPATH]; extern char com_gamedir[MAX_OSPATH]; -extern int file_from_pak; // global indicating that file came from a pak +extern int32_t file_from_pak; // global indicating that file came from a pak -void COM_WriteFile (const char *filename, const void *data, int len); -int COM_OpenFile (const char *filename, int *handle, uint32_t *path_id); -int COM_FOpenFile (const char *filename, FILE **file, uint32_t *path_id); +void COM_WriteFile (const char *filename, const void *data, int32_t len); +int32_t COM_OpenFile (const char *filename, int32_t *handle, uint32_t *path_id); +int32_t COM_FOpenFile (const char *filename, FILE **file, uint32_t *path_id); bool COM_FileExists (const char *filename, uint32_t *path_id); -void COM_CloseFile (int h); +void COM_CloseFile (int32_t h); // these procedures open a file using COM_FindFile and loads it into a proper // buffer. the buffer is allocated with a total size of com_filesize + 1. the // procedures differ by their buffer allocation method. -byte *COM_LoadStackFile (const char *path, void *buffer, int bufsize, +byte *COM_LoadStackFile (const char *path, void *buffer, int32_t bufsize, uint32_t *path_id); // uses the specified stack stack buffer with the specified size // of bufsize. if bufsize is too short, uses temp hunk. the bufsize @@ -259,10 +259,10 @@ byte *COM_LoadMallocFile (const char *path, uint32_t *path_id); // Loads in "t" mode so CRLF to LF translation is performed on Windows. byte *COM_LoadMallocFile_TextMode_OSPath (const char *path, long *len_out); -// Attempts to parse an int, followed by a newline. +// Attempts to parse an int32_t, followed by a newline. // Returns advanced buffer position. // Doesn't signal parsing failure, but this is not needed for savegame loading. -const char *COM_ParseIntNewline(const char *buffer, int *value); +const char *COM_ParseIntNewline(const char *buffer, int32_t *value); // Attempts to parse a float followed by a newline. // Returns advanced buffer position. @@ -288,14 +288,14 @@ typedef struct _fshandle_t } fshandle_t; size_t FS_fread(void *ptr, size_t size, size_t nmemb, fshandle_t *fh); -int FS_fseek(fshandle_t *fh, long offset, int whence); +int32_t FS_fseek(fshandle_t *fh, long offset, int32_t whence); long FS_ftell(fshandle_t *fh); void FS_rewind(fshandle_t *fh); -int FS_feof(fshandle_t *fh); -int FS_ferror(fshandle_t *fh); -int FS_fclose(fshandle_t *fh); -int FS_fgetc(fshandle_t *fh); -char *FS_fgets(char *s, int size, fshandle_t *fh); +int32_t FS_feof(fshandle_t *fh); +int32_t FS_ferror(fshandle_t *fh); +int32_t FS_fclose(fshandle_t *fh); +int32_t FS_fgetc(fshandle_t *fh); +char *FS_fgets(char *s, int32_t size, fshandle_t *fh); long FS_filelength (fshandle_t *fh); diff --git a/source/console.c b/source/console.c index be73cf1..f66fdf7 100644 --- a/source/console.c +++ b/source/console.c @@ -32,21 +32,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #include "quakedef.h" -int con_linewidth; +int32_t con_linewidth; float con_cursorspeed = 4; #define CON_TEXTSIZE (1024 * 1024) //ericw -- was 65536. johnfitz -- new default size #define CON_MINSIZE 16384 //johnfitz -- old default, now the minimum size -int con_buffersize; //johnfitz -- user can now override default +int32_t con_buffersize; //johnfitz -- user can now override default bool con_forcedup; // because no entities to refresh -int con_totallines; // total lines in console scrollback -int con_backscroll; // lines up from bottom to display -int con_current; // where next message will be printed -int con_x; // offset in current line for next print +int32_t con_totallines; // total lines in console scrollback +int32_t con_backscroll; // lines up from bottom to display +int32_t con_current; // where next message will be printed +int32_t con_x; // offset in current line for next print char *con_text = NULL; cvar_t con_notifytime = {"con_notifytime","3",CVAR_NONE}; //seconds @@ -58,7 +58,7 @@ char con_lastcenterstring[1024]; //johnfitz float con_times[NUM_CON_TIMES]; // realtime time the line was generated // for transparent notify lines -int con_vislines; +int32_t con_vislines; bool con_debuglog = false; @@ -72,12 +72,12 @@ Con_Quakebar -- johnfitz -- returns a bar of the desired length, but never wider includes a newline, unless len >= con_linewidth. ================ */ -const char *Con_Quakebar (int len) +const char *Con_Quakebar (int32_t len) { static char bar[42]; - int i; + int32_t i; - len = q_min(len, (int)sizeof(bar) - 2); + len = q_min(len, (int32_t)sizeof(bar) - 2); len = q_min(len, con_linewidth); bar[0] = '\35'; @@ -101,7 +101,7 @@ const char *Con_Quakebar (int len) Con_ToggleConsole_f ================ */ -extern int history_line; //johnfitz +extern int32_t history_line; //johnfitz void Con_ToggleConsole_f (void) { @@ -151,7 +151,7 @@ Con_Dump_f -- johnfitz -- adapted from quake2 source */ static void Con_Dump_f (void) { - int l, x; + int32_t l, x; const char *line; FILE *f; char buffer[1024]; @@ -207,7 +207,7 @@ Con_ClearNotify */ void Con_ClearNotify (void) { - int i; + int32_t i; for (i = 0; i < NUM_CON_TIMES; i++) con_times[i] = 0; @@ -250,9 +250,9 @@ If the line width has changed, reformat the buffer. */ void Con_CheckResize (void) { - int i, j, width, oldwidth, oldtotallines, numlines, numchars; + int32_t i, j, width, oldwidth, oldtotallines, numlines, numchars; char *tbuf; //johnfitz -- tbuf no longer a static array - int mark; //johnfitz + int32_t mark; //johnfitz width = (vid.conwidth >> 3) - 2; //johnfitz -- use vid.conwidth instead of vid.width @@ -304,7 +304,7 @@ Con_Init */ void Con_Init (void) { - int i; + int32_t i; //johnfitz -- user settable console buffer size i = COM_CheckParm("-consize"); @@ -369,10 +369,10 @@ If no console is visible, the notify window will pop up. */ static void Con_Print (const char *txt) { - int y; - int c, l; - static int cr; - int mask; + int32_t y; + int32_t c, l; + static int32_t cr; + int32_t mask; bool boundary; //con_backscroll = 0; //johnfitz -- better console scrolling @@ -455,7 +455,7 @@ static void Con_Print (const char *txt) // borrowed from uhexen2 by S.A. for new procs, LOG_Init, LOG_Close static char logfilename[MAX_OSPATH]; // current logfile name -static int log_fd = -1; // log file descriptor +static int32_t log_fd = -1; // log file descriptor /* ================ @@ -617,7 +617,7 @@ void Con_SafePrintf (const char *fmt, ...) { va_list argptr; char msg[1024]; - int temp; + int32_t temp; va_start (argptr, fmt); q_vsnprintf (msg, sizeof(msg), fmt, argptr); @@ -634,15 +634,15 @@ void Con_SafePrintf (const char *fmt, ...) Con_CenterPrintf -- johnfitz -- pad each line with spaces to make it appear centered ================ */ -void Con_CenterPrintf (int linewidth, const char *fmt, ...) FUNC_PRINTF(2,3); -void Con_CenterPrintf (int linewidth, const char *fmt, ...) +void Con_CenterPrintf (int32_t linewidth, const char *fmt, ...) FUNC_PRINTF(2,3); +void Con_CenterPrintf (int32_t linewidth, const char *fmt, ...) { va_list argptr; char msg[MAXPRINTMSG]; //the original message char line[MAXPRINTMSG]; //one line from the message char spaces[21]; //buffer for spaces char *src, *dst; - int len, s; + int32_t len, s; va_start (argptr, fmt); q_vsnprintf (msg, sizeof(msg), fmt, argptr); @@ -822,7 +822,7 @@ static const arg_completion_type_t arg_completion_types[] = { "timedemo ", &demolist } }; -static const int num_arg_completion_types = +static const int32_t num_arg_completion_types = sizeof(arg_completion_types)/sizeof(arg_completion_types[0]); /* @@ -830,12 +830,12 @@ static const int num_arg_completion_types = FindCompletion -- stevenaaus ============ */ -const char *FindCompletion (const char *partial, filelist_item_t *filelist, int *nummatches_out) +const char *FindCompletion (const char *partial, filelist_item_t *filelist, int32_t *nummatches_out) { static char matched[32]; char *i_matched, *i_name; filelist_item_t *file; - int init, match, plen; + int32_t init, match, plen; memset(matched, 0, sizeof(matched)); plen = strlen(partial); @@ -891,7 +891,7 @@ void BuildTabList (const char *partial) cmdalias_t *alias; cvar_t *cvar; cmd_function_t *cmd; - int len; + int32_t len; tablist = NULL; len = strlen(partial); @@ -924,7 +924,7 @@ void Con_TabComplete (void) const char *match; static char *c; tab_t *t; - int mark, i, j; + int32_t mark, i, j; // if editline is empty, return if (key_lines[edit_line][1] == 0) @@ -954,7 +954,7 @@ void Con_TabComplete (void) if (!strncmp (key_lines[edit_line] + 1, command_name, strlen(command_name))) { - int nummatches = 0; + int32_t nummatches = 0; const char *matched_map = FindCompletion(partial, *arg_completion.filelist, &nummatches); if (!*matched_map) return; @@ -1075,7 +1075,7 @@ Draws the last few lines of output transparently over the game top */ void Con_DrawNotify (void) { - int i, x, v; + int32_t i, x, v; const char *text; float time; @@ -1131,7 +1131,7 @@ void Con_DrawNotify (void) text++; } - Draw_Character (x<<3, v, 10 + ((int)(realtime*con_cursorspeed)&1)); + Draw_Character (x<<3, v, 10 + ((int32_t)(realtime*con_cursorspeed)&1)); v += 8; scr_tileclear_updates = 0; //johnfitz @@ -1149,7 +1149,7 @@ extern qpic_t *pic_ovr, *pic_ins; //johnfitz -- new cursor handling void Con_DrawInput (void) { - int i, ofs; + int32_t i, ofs; if (key_dest != key_console && !con_forcedup) return; // don't draw anything @@ -1165,7 +1165,7 @@ void Con_DrawInput (void) Draw_Character ((i+1)<<3, vid.conheight - 16, key_lines[edit_line][i+ofs]); // johnfitz -- new cursor handling - if (!((int)((realtime-key_blinktime)*con_cursorspeed) & 1)) + if (!((int32_t)((realtime-key_blinktime)*con_cursorspeed) & 1)) { i = key_linepos - ofs; Draw_Pic ((i+1)<<3, vid.conheight - 16, key_insert ? pic_ins : pic_ovr); @@ -1180,9 +1180,9 @@ Draws the console with the solid background The typing input line at the bottom should only be drawn if typing is allowed ================ */ -void Con_DrawConsole (int lines, bool drawinput) +void Con_DrawConsole (int32_t lines, bool drawinput) { - int i, x, y, j, sb, rows; + int32_t i, x, y, j, sb, rows; const char *text; char ver[32]; @@ -1228,7 +1228,7 @@ void Con_DrawConsole (int lines, bool drawinput) //draw version number in bottom right y += 8; q_snprintf (ver, sizeof(ver), "QuakeSpasm " QUAKESPASM_VERSION); - for (x = 0; x < (int)strlen(ver); x++) + for (x = 0; x < (int32_t)strlen(ver); x++) Draw_Character ((con_linewidth - strlen(ver) + x + 2)<<3, y, ver[x] /*+ 128*/); } @@ -1241,7 +1241,7 @@ Con_NotifyBox void Con_NotifyBox (const char *text) { double t1, t2; - int lastkey, lastchar; + int32_t lastkey, lastchar; // during startup for sound / cd warnings Con_Printf ("\n\n%s", Con_Quakebar(40)); //johnfitz diff --git a/source/console.h b/source/console.h index 2560f36..fe58472 100644 --- a/source/console.h +++ b/source/console.h @@ -26,19 +26,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // console // -extern int con_totallines; -extern int con_backscroll; +extern int32_t con_totallines; +extern int32_t con_backscroll; extern bool con_forcedup; // because no entities to refresh extern bool con_initialized; extern byte *con_chars; extern char con_lastcenterstring[]; //johnfitz -void Con_DrawCharacter (int cx, int line, int num); +void Con_DrawCharacter (int32_t cx, int32_t line, int32_t num); void Con_CheckResize (void); void Con_Init (void); -void Con_DrawConsole (int lines, bool drawinput); +void Con_DrawConsole (int32_t lines, bool drawinput); void Con_Printf (const char *fmt, ...) FUNC_PRINTF(1,2); void Con_DWarning (const char *fmt, ...) FUNC_PRINTF(1,2); //ericw void Con_Warning (const char *fmt, ...) FUNC_PRINTF(1,2); //johnfitz @@ -54,7 +54,7 @@ void Con_NotifyBox (const char *text); // during startup for sound / cd warnings void Con_Show (void); void Con_Hide (void); -const char *Con_Quakebar (int len); +const char *Con_Quakebar (int32_t len); void Con_TabComplete (void); void Con_LogCenterPrint (const char *str); diff --git a/source/crc.c b/source/crc.c index 379047b..378008b 100644 --- a/source/crc.c +++ b/source/crc.c @@ -82,7 +82,7 @@ uint16_t CRC_Value(uint16_t crcvalue) } //johnfitz -- texture crc -uint16_t CRC_Block (const byte *start, int count) +uint16_t CRC_Block (const byte *start, int32_t count) { uint16_t crc; diff --git a/source/crc.h b/source/crc.h index 7844cfa..ced63e6 100644 --- a/source/crc.h +++ b/source/crc.h @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CRC_Init(uint16_t *crcvalue); void CRC_ProcessByte(uint16_t *crcvalue, byte data); uint16_t CRC_Value(uint16_t crcvalue); -uint16_t CRC_Block (const byte *start, int count); //johnfitz -- texture crc +uint16_t CRC_Block (const byte *start, int32_t count); //johnfitz -- texture crc #endif /* _QUAKE_CRC_H */ diff --git a/source/cvar.c b/source/cvar.c index 8958dc6..9e11d93 100644 --- a/source/cvar.c +++ b/source/cvar.c @@ -43,7 +43,7 @@ void Cvar_List_f (void) { cvar_t *cvar; const char *partial; - int len, count; + int32_t len, count; if (Cmd_Argc() > 1) { @@ -130,7 +130,7 @@ Cvar_Cycle_f -- johnfitz */ void Cvar_Cycle_f (void) { - int i; + int32_t i; if (Cmd_Argc() < 3) { @@ -351,7 +351,7 @@ Cvar_CompleteVariable const char *Cvar_CompleteVariable (const char *partial) { cvar_t *cvar; - int len; + int32_t len; len = Q_strlen(partial); if (!len) @@ -394,7 +394,7 @@ void Cvar_SetQuick (cvar_t *var, const char *value) var->string = Z_Strdup (value); else { - int len; + int32_t len; if (!strcmp(var->string, value)) return; // no change @@ -432,8 +432,8 @@ void Cvar_SetValueQuick (cvar_t *var, const float value) { char val[32], *ptr = val; - if (value == (float)((int)value)) - q_snprintf (val, sizeof(val), "%i", (int)value); + if (value == (float)((int32_t)value)) + q_snprintf (val, sizeof(val), "%i", (int32_t)value); else { q_snprintf (val, sizeof(val), "%f", value); @@ -475,8 +475,8 @@ void Cvar_SetValue (const char *var_name, const float value) { char val[32], *ptr = val; - if (value == (float)((int)value)) - q_snprintf (val, sizeof(val), "%i", (int)value); + if (value == (float)((int32_t)value)) + q_snprintf (val, sizeof(val), "%i", (int32_t)value); else { q_snprintf (val, sizeof(val), "%f", value); diff --git a/source/draw.h b/source/draw.h index 396f57e..23a8c3c 100644 --- a/source/draw.h +++ b/source/draw.h @@ -29,15 +29,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern qpic_t *draw_disc; // also used on sbar void Draw_Init (void); -void Draw_Character (int x, int y, int num); +void Draw_Character (int32_t x, int32_t y, int32_t num); void Draw_DebugChar (char num); -void Draw_Pic (int x, int y, qpic_t *pic); -void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom); //johnfitz -- more parameters -void Draw_ConsoleBackground (void); //johnfitz -- removed parameter int lines -void Draw_TileClear (int x, int y, int w, int h); -void Draw_Fill (int x, int y, int w, int h, int c, float alpha); //johnfitz -- added alpha +void Draw_Pic (int32_t x, int32_t y, qpic_t *pic); +void Draw_TransPicTranslate (int32_t x, int32_t y, qpic_t *pic, int32_t top, int32_t bottom); //johnfitz -- more parameters +void Draw_ConsoleBackground (void); //johnfitz -- removed parameter int32_t lines +void Draw_TileClear (int32_t x, int32_t y, int32_t w, int32_t h); +void Draw_Fill (int32_t x, int32_t y, int32_t w, int32_t h, int32_t c, float alpha); //johnfitz -- added alpha void Draw_FadeScreen (void); -void Draw_String (int x, int y, const char *str); +void Draw_String (int32_t x, int32_t y, const char *str); qpic_t *Draw_PicFromWad (const char *name); qpic_t *Draw_CachePic (const char *path); void Draw_NewGame (void); diff --git a/source/gl_draw.c b/source/gl_draw.c index 60a27f4..04a6730 100644 --- a/source/gl_draw.c +++ b/source/gl_draw.c @@ -122,7 +122,7 @@ typedef struct cachepic_s #define MAX_CACHED_PICS 128 cachepic_t menu_cachepics[MAX_CACHED_PICS]; -int menu_numcachepics; +int32_t menu_numcachepics; byte menuplyr_pixels[4096]; @@ -134,7 +134,7 @@ byte menuplyr_pixels[4096]; #define BLOCK_WIDTH 256 #define BLOCK_HEIGHT 256 -int scrap_allocated[MAX_SCRAPS][BLOCK_WIDTH]; +int32_t scrap_allocated[MAX_SCRAPS][BLOCK_WIDTH]; byte scrap_texels[MAX_SCRAPS][BLOCK_WIDTH*BLOCK_HEIGHT]; //johnfitz -- removed *4 after BLOCK_HEIGHT bool scrap_dirty; gltexture_t *scrap_textures[MAX_SCRAPS]; //johnfitz @@ -147,11 +147,11 @@ Scrap_AllocBlock returns an index into scrap_texnums[] and the position inside it ================ */ -int Scrap_AllocBlock (int w, int h, int *x, int *y) +int32_t Scrap_AllocBlock (int32_t w, int32_t h, int32_t *x, int32_t *y) { - int i, j; - int best, best2; - int texnum; + int32_t i, j; + int32_t best, best2; + int32_t texnum; for (texnum=0 ; texnumwidth < 64 && p->height < 64) { - int x, y; - int i, j, k; - int texnum; + int32_t x, y; + int32_t i, j, k; + int32_t texnum; texnum = Scrap_AllocBlock (p->width, p->height, &x, &y); scrap_dirty = true; @@ -249,7 +249,7 @@ qpic_t *Draw_PicFromWad (const char *name) char texturename[64]; //johnfitz q_snprintf (texturename, sizeof(texturename), "%s:%s", WADFILENAME, name); //johnfitz - offset = (src_offset_t)p - (src_offset_t)wad_base + sizeof(int)*2; //johnfitz + offset = (src_offset_t)p - (src_offset_t)wad_base + sizeof(int32_t)*2; //johnfitz gl.gltexture = TexMgr_LoadImage (NULL, texturename, p->width, p->height, SRC_INDEXED, p->data, WADFILENAME, offset, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr @@ -272,7 +272,7 @@ Draw_CachePic qpic_t *Draw_CachePic (const char *path) { cachepic_t *pic; - int i; + int32_t i; qpic_t *dat; glpic_t gl; @@ -304,7 +304,7 @@ qpic_t *Draw_CachePic (const char *path) pic->pic.height = dat->height; gl.gltexture = TexMgr_LoadImage (NULL, path, dat->width, dat->height, SRC_INDEXED, dat->data, path, - sizeof(int)*2, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr + sizeof(int32_t)*2, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr gl.sl = 0; gl.sh = (float)dat->width/(float)TexMgr_PadConditional(dat->width); //johnfitz gl.tl = 0; @@ -319,9 +319,9 @@ qpic_t *Draw_CachePic (const char *path) Draw_MakePic -- johnfitz -- generate pics from internal data ================ */ -qpic_t *Draw_MakePic (const char *name, int width, int height, byte *data) +qpic_t *Draw_MakePic (const char *name, int32_t width, int32_t height, byte *data) { - int flags = TEXPREF_NEAREST | TEXPREF_ALPHA | TEXPREF_PERSIST | TEXPREF_NOPICMIP | TEXPREF_PAD; + int32_t flags = TEXPREF_NEAREST | TEXPREF_ALPHA | TEXPREF_PERSIST | TEXPREF_NOPICMIP | TEXPREF_PAD; qpic_t *pic; glpic_t gl; @@ -373,7 +373,7 @@ Draw_NewGame -- johnfitz void Draw_NewGame (void) { cachepic_t *pic; - int i; + int32_t i; // empty scrap and reallocate gltextures memset(scrap_allocated, 0, sizeof(scrap_allocated)); @@ -428,9 +428,9 @@ void Draw_Init (void) Draw_CharacterQuad -- johnfitz -- seperate function to spit out verts ================ */ -void Draw_CharacterQuad (int x, int y, char num) +void Draw_CharacterQuad (int32_t x, int32_t y, char num) { - int row, col; + int32_t row, col; float frow, fcol, size; row = num>>4; @@ -455,7 +455,7 @@ void Draw_CharacterQuad (int x, int y, char num) Draw_Character -- johnfitz -- modified to call Draw_CharacterQuad ================ */ -void Draw_Character (int x, int y, int num) +void Draw_Character (int32_t x, int32_t y, int32_t num) { if (y <= -8) return; // totally off screen @@ -478,7 +478,7 @@ void Draw_Character (int x, int y, int num) Draw_String -- johnfitz -- modified to call Draw_CharacterQuad ================ */ -void Draw_String (int x, int y, const char *str) +void Draw_String (int32_t x, int32_t y, const char *str) { if (y <= -8) return; // totally off screen @@ -502,7 +502,7 @@ void Draw_String (int x, int y, const char *str) Draw_Pic -- johnfitz -- modified ============= */ -void Draw_Pic (int x, int y, qpic_t *pic) +void Draw_Pic (int32_t x, int32_t y, qpic_t *pic) { glpic_t *gl; @@ -529,10 +529,10 @@ Draw_TransPicTranslate -- johnfitz -- rewritten to use texmgr to do translation Only used for the player color selection menu ============= */ -void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom) +void Draw_TransPicTranslate (int32_t x, int32_t y, qpic_t *pic, int32_t top, int32_t bottom) { - static int oldtop = -2; - static int oldbottom = -2; + static int32_t oldtop = -2; + static int32_t oldbottom = -2; if (top != oldtop || bottom != oldbottom) { @@ -594,7 +594,7 @@ This repeats a 64*64 tile graphic to fill the screen around a sized down refresh window. ============= */ -void Draw_TileClear (int x, int y, int w, int h) +void Draw_TileClear (int32_t x, int32_t y, int32_t w, int32_t h) { glpic_t *gl; @@ -621,7 +621,7 @@ Draw_Fill Fills a box of pixels with a single color ============= */ -void Draw_Fill (int x, int y, int w, int h, int c, float alpha) //johnfitz -- added alpha +void Draw_Fill (int32_t x, int32_t y, int32_t w, int32_t h, int32_t c, float alpha) //johnfitz -- added alpha { byte *pal = (byte *)d_8to24table; //johnfitz -- use d_8to24table instead of host_basepal @@ -681,7 +681,7 @@ void GL_SetCanvas (canvastype newcanvas) { extern vrect_t scr_vrect; float s; - int lines; + int32_t lines; if (newcanvas == currentcanvas) return; diff --git a/source/gl_fog.c b/source/gl_fog.c index e0e3996..746e0e3 100644 --- a/source/gl_fog.c +++ b/source/gl_fog.c @@ -233,7 +233,7 @@ float *Fog_GetColor (void) { static float c[4]; float f; - int i; + int32_t i; if (fade_done > cl.time) { diff --git a/source/gl_mesh.c b/source/gl_mesh.c index b1c2357..cfef661 100644 --- a/source/gl_mesh.c +++ b/source/gl_mesh.c @@ -35,35 +35,35 @@ ALIAS MODEL DISPLAY LIST GENERATION qmodel_t *aliasmodel; aliashdr_t *paliashdr; -int used[8192]; // bool +int32_t used[8192]; // bool // the command list holds counts and s/t values that are valid for // every frame -int commands[8192]; -int numcommands; +int32_t commands[8192]; +int32_t numcommands; // all frames will have their vertexes rearranged and expanded // so they are in the order expected by the command list -int vertexorder[8192]; -int numorder; +int32_t vertexorder[8192]; +int32_t numorder; -int allverts, alltris; +int32_t allverts, alltris; -int stripverts[128]; -int striptris[128]; -int stripcount; +int32_t stripverts[128]; +int32_t striptris[128]; +int32_t stripcount; /* ================ StripLength ================ */ -int StripLength (int starttri, int startv) +int32_t StripLength (int32_t starttri, int32_t startv) { - int m1, m2; - int j; + int32_t m1, m2; + int32_t j; mtriangle_t *last, *check; - int k; + int32_t k; used[starttri] = 2; @@ -127,12 +127,12 @@ done: FanLength =========== */ -int FanLength (int starttri, int startv) +int32_t FanLength (int32_t starttri, int32_t startv) { - int m1, m2; - int j; + int32_t m1, m2; + int32_t j; mtriangle_t *last, *check; - int k; + int32_t k; used[starttri] = 2; @@ -200,13 +200,13 @@ for the model, which holds for all frames */ void BuildTris (void) { - int i, j, k; - int startv; + int32_t i, j, k; + int32_t startv; float s, t; - int len, bestlen, besttype; - int bestverts[1024]; - int besttris[1024]; - int type; + int32_t len, bestlen, besttype; + int32_t bestverts[1024]; + int32_t besttris[1024]; + int32_t type; // // build tristrips @@ -254,7 +254,7 @@ void BuildTris (void) for (j = 0; j < bestlen+2; j++) { - int tmp; + int32_t tmp; // emit a vertex into the reorder buffer k = bestverts[j]; @@ -270,7 +270,7 @@ void BuildTris (void) // *(float *)&commands[numcommands++] = s; // *(float *)&commands[numcommands++] = t; - // NOTE: 4 == sizeof(int) + // NOTE: 4 == sizeof(int32_t) // == sizeof(float) memcpy (&tmp, &s, 4); commands[numcommands++] = tmp; @@ -297,12 +297,12 @@ GL_MakeAliasModelDisplayLists */ void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr) { - int i, j; - int *cmds; + int32_t i, j; + int32_t *cmds; trivertx_t *verts; float hscale, vscale; //johnfitz -- padded skins - int count; //johnfitz -- precompute texcoords for padded skins - int *loadcmds; //johnfitz + int32_t count; //johnfitz -- precompute texcoords for padded skins + int32_t *loadcmds; //johnfitz //johnfitz -- padded skins hscale = (float)hdr->skinwidth/(float)TexMgr_PadConditional(hdr->skinwidth); @@ -320,7 +320,7 @@ void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr) paliashdr->poseverts = numorder; - cmds = (int *) Hunk_Alloc (numcommands * 4); + cmds = (int32_t *) Hunk_Alloc (numcommands * 4); paliashdr->commands = (byte *)cmds - (byte *)paliashdr; //johnfitz -- precompute texcoords for padded skins @@ -368,8 +368,8 @@ Original code by MH from RMQEngine */ void GL_MakeAliasModelDisplayLists_VBO (void) { - int i, j; - int maxverts_vbo; + int32_t i, j; + int32_t maxverts_vbo; trivertx_t *verts; uint16_t *indexes; aliasmesh_t *desc; @@ -400,14 +400,14 @@ void GL_MakeAliasModelDisplayLists_VBO (void) { for (j = 0; j < 3; j++) { - int v; + int32_t v; // index into hdr->vertexes uint16_t vertindex = triangles[i].vertindex[j]; // basic s/t coords - int s = stverts[vertindex].s; - int t = stverts[vertindex].t; + int32_t s = stverts[vertindex].s; + int32_t t = stverts[vertindex].t; // check for back side and adjust texcoord s if (!triangles[i].facesfront && stverts[vertindex].onseam) s += pheader->skinwidth / 2; @@ -416,7 +416,7 @@ void GL_MakeAliasModelDisplayLists_VBO (void) for (v = 0; v < pheader->numverts_vbo; v++) { // it could use the same xyz but have different s and t - if (desc[v].vertindex == vertindex && (int) desc[v].st[0] == s && (int) desc[v].st[1] == t) + if (desc[v].vertindex == vertindex && (int32_t) desc[v].st[0] == s && (int32_t) desc[v].st[1] == t) { // exists; emit an index for it indexes[pheader->numindexes++] = v; @@ -456,12 +456,12 @@ Original code by MH from RMQEngine */ static void GLMesh_LoadVertexBuffer (qmodel_t *m, const aliashdr_t *hdr) { - int totalvbosize = 0; + int32_t totalvbosize = 0; const aliasmesh_t *desc; const int16_t *indexes; const trivertx_t *trivertexes; byte *vbodata; - int f; + int32_t f; if (!gl_glsl_alias_able) return; @@ -503,7 +503,7 @@ static void GLMesh_LoadVertexBuffer (qmodel_t *m, const aliashdr_t *hdr) // fill in the vertices at the start of the buffer for (f = 0; f < hdr->numposes; f++) // ericw -- what RMQEngine called nummeshframes is called numposes in QuakeSpasm { - int v; + int32_t v; meshxyz_t *xyz = (meshxyz_t *) (vbodata + (f * hdr->numverts_vbo * sizeof (meshxyz_t))); const trivertx_t *tv = trivertexes + (hdr->numverts * f); @@ -565,7 +565,7 @@ Loop over all precached alias models, and upload each one to a VBO. */ void GLMesh_LoadVertexBuffers (void) { - int j; + int32_t j; qmodel_t *m; const aliashdr_t *hdr; @@ -592,7 +592,7 @@ Delete VBOs for all loaded alias models */ void GLMesh_DeleteVertexBuffers (void) { - int j; + int32_t j; qmodel_t *m; if (!gl_glsl_alias_able) diff --git a/source/gl_model.c b/source/gl_model.c index 754393a..7d3166d 100644 --- a/source/gl_model.c +++ b/source/gl_model.c @@ -37,14 +37,14 @@ qmodel_t *Mod_LoadModel (qmodel_t *mod, bool crash); cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE}; static byte *mod_novis; -static int mod_novis_capacity; +static int32_t mod_novis_capacity; static byte *mod_decompressed; -static int mod_decompressed_capacity; +static int32_t mod_decompressed_capacity; #define MAX_MOD_KNOWN 2048 /*johnfitz -- was 512 */ qmodel_t mod_known[MAX_MOD_KNOWN]; -int mod_numknown; +int32_t mod_numknown; texture_t *r_notexture_mip; //johnfitz -- moved here from r_main.c texture_t *r_notexture_mip2; //johnfitz -- used for non-lightmapped surfs with a missing texture @@ -130,10 +130,10 @@ Mod_DecompressVis */ byte *Mod_DecompressVis (byte *in, qmodel_t *model) { - int c; + int32_t c; byte *out; byte *outend; - int row; + int32_t row; row = (model->numleafs+7)>>3; if (mod_decompressed == NULL || row > mod_decompressed_capacity) @@ -193,7 +193,7 @@ byte *Mod_LeafPVS (mleaf_t *leaf, qmodel_t *model) byte *Mod_NoVisPVS (qmodel_t *model) { - int pvsbytes; + int32_t pvsbytes; pvsbytes = (model->numleafs+7)>>3; if (mod_novis == NULL || pvsbytes > mod_novis_capacity) @@ -215,7 +215,7 @@ Mod_ClearAll */ void Mod_ClearAll (void) { - int i; + int32_t i; qmodel_t *mod; for (i=0 , mod=mod_known ; ineedload) { @@ -403,9 +403,9 @@ byte *mod_base; Mod_CheckFullbrights -- johnfitz ================= */ -bool Mod_CheckFullbrights (byte *pixels, int count) +bool Mod_CheckFullbrights (byte *pixels, int32_t count) { - int i; + int32_t i; for (i = 0; i < count; i++) if (*pixels++ > 223) return true; @@ -419,7 +419,7 @@ Mod_LoadTextures */ void Mod_LoadTextures (lump_t *l) { - int i, j, pixels, num, maxanim, altmax; + int32_t i, j, pixels, num, maxanim, altmax; miptex_t *mt; texture_t *tx, *tx2; texture_t *anims[10]; @@ -427,9 +427,9 @@ void Mod_LoadTextures (lump_t *l) dmiptexlump_t *m; //johnfitz -- more variables char texturename[64]; - int nummiptex; + int32_t nummiptex; src_offset_t offset; - int mark, fwidth, fheight; + int32_t mark, fwidth, fheight; char filename[MAX_OSPATH], filename2[MAX_OSPATH], mapname[MAX_OSPATH]; byte *data; extern byte *hunk_base; @@ -536,7 +536,7 @@ void Mod_LoadTextures (lump_t *l) else //regular texture { // ericw -- fence textures - int extraflags; + int32_t extraflags; extraflags = 0; if (tx->name[0] == '{') @@ -703,7 +703,7 @@ Mod_LoadLighting -- johnfitz -- replaced with lit support code via lordhavoc */ void Mod_LoadLighting (lump_t *l) { - int i, mark; + int32_t i, mark; byte *in, *out, *data; byte d; char litfilename[MAX_OSPATH]; @@ -728,7 +728,7 @@ void Mod_LoadLighting (lump_t *l) else if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T') { - i = LittleLong(((int *)data)[1]); + i = LittleLong(((int32_t *)data)[1]); if (i == 1) { Con_DPrintf2("%s loaded\n", litfilename); @@ -791,7 +791,7 @@ void Mod_LoadEntities (lump_t *l) { char entfilename[MAX_QPATH]; char *ents; - int mark; + int32_t mark; uint32_t path_id; if (! external_ents.value) @@ -840,7 +840,7 @@ void Mod_LoadVertexes (lump_t *l) { dvertex_t *in; mvertex_t *out; - int i, count; + int32_t i, count; in = (dvertex_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) @@ -864,10 +864,10 @@ void Mod_LoadVertexes (lump_t *l) Mod_LoadEdges ================= */ -void Mod_LoadEdges (lump_t *l, int bsp2) +void Mod_LoadEdges (lump_t *l, int32_t bsp2) { medge_t *out; - int i, count; + int32_t i, count; if (bsp2) { @@ -918,9 +918,9 @@ void Mod_LoadTexinfo (lump_t *l) { texinfo_t *in; mtexinfo_t *out; - int i, j, count, miptex; + int32_t i, j, count, miptex; float len1, len2; - int missing = 0; //johnfitz + int32_t missing = 0; //johnfitz in = (texinfo_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) @@ -992,10 +992,10 @@ Fills in s->texturemins[] and s->extents[] void CalcSurfaceExtents (msurface_t *s) { float mins[2], maxs[2], val; - int i,j, e; + int32_t i,j, e; mvertex_t *v; mtexinfo_t *tex; - int bmins[2], bmaxs[2]; + int32_t bmins[2], bmaxs[2]; mins[0] = mins[1] = 999999; maxs[0] = maxs[1] = -99999; @@ -1062,7 +1062,7 @@ TODO: merge this into BuildSurfaceDisplayList? void Mod_PolyForUnlitSurface (msurface_t *fa) { vec3_t verts[64]; - int numverts, i, lindex; + int32_t numverts, i, lindex; float *vec; glpoly_t *poly; float texscale; @@ -1106,7 +1106,7 @@ Mod_CalcSurfaceBounds -- johnfitz -- calculate bounding box for per-surface frus */ void Mod_CalcSurfaceBounds (msurface_t *s) { - int i, e; + int32_t i, e; mvertex_t *v; s->mins[0] = s->mins[1] = s->mins[2] = 9999; @@ -1146,8 +1146,8 @@ void Mod_LoadFaces (lump_t *l, bool bsp2) dsface_t *ins; dlface_t *inl; msurface_t *out; - int i, count, surfnum, lofs; - int planenum, side, texinfon; + int32_t i, count, surfnum, lofs; + int32_t planenum, side, texinfon; if (bsp2) { @@ -1285,7 +1285,7 @@ Mod_LoadNodes */ void Mod_LoadNodes_S (lump_t *l) { - int i, j, count, p; + int32_t i, j, count, p; dsnode_t *in; mnode_t *out; @@ -1341,7 +1341,7 @@ void Mod_LoadNodes_S (lump_t *l) void Mod_LoadNodes_L1 (lump_t *l) { - int i, j, count, p; + int32_t i, j, count, p; dl1node_t *in; mnode_t *out; @@ -1393,7 +1393,7 @@ void Mod_LoadNodes_L1 (lump_t *l) void Mod_LoadNodes_L2 (lump_t *l) { - int i, j, count, p; + int32_t i, j, count, p; dl2node_t *in; mnode_t *out; @@ -1443,7 +1443,7 @@ void Mod_LoadNodes_L2 (lump_t *l) } } -void Mod_LoadNodes (lump_t *l, int bsp2) +void Mod_LoadNodes (lump_t *l, int32_t bsp2) { if (bsp2 == 2) Mod_LoadNodes_L2(l); @@ -1455,10 +1455,10 @@ void Mod_LoadNodes (lump_t *l, int bsp2) Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs } -void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen) +void Mod_ProcessLeafs_S (dsleaf_t *in, int32_t filelen) { mleaf_t *out; - int i, j, count, p; + int32_t i, j, count, p; if (filelen % sizeof(*in)) Sys_Error ("Mod_ProcessLeafs: funny lump size in %s", loadmodel->name); @@ -1501,10 +1501,10 @@ void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen) } } -void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen) +void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int32_t filelen) { mleaf_t *out; - int i, j, count, p; + int32_t i, j, count, p; if (filelen % sizeof(*in)) Sys_Error ("Mod_ProcessLeafs: funny lump size in %s", loadmodel->name); @@ -1544,10 +1544,10 @@ void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen) } } -void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen) +void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int32_t filelen) { mleaf_t *out; - int i, j, count, p; + int32_t i, j, count, p; if (filelen % sizeof(*in)) Sys_Error ("Mod_ProcessLeafs: funny lump size in %s", loadmodel->name); @@ -1592,7 +1592,7 @@ void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen) Mod_LoadLeafs ================= */ -void Mod_LoadLeafs (lump_t *l, int bsp2) +void Mod_LoadLeafs (lump_t *l, int32_t bsp2) { void *in = (void *)(mod_base + l->fileofs); @@ -1615,7 +1615,7 @@ void Mod_LoadClipnodes (lump_t *l, bool bsp2) dlclipnode_t *inl; mclipnode_t *out; //johnfitz -- was dclipnode_t - int i, count; + int32_t i, count; hull_t *hull; if (bsp2) @@ -1721,7 +1721,7 @@ void Mod_MakeHull0 (void) { mnode_t *in, *child; mclipnode_t *out; //johnfitz -- was dclipnode_t - int i, j, count; + int32_t i, j, count; hull_t *hull; hull = &loadmodel->hulls[0]; @@ -1754,9 +1754,9 @@ void Mod_MakeHull0 (void) Mod_LoadMarksurfaces ================= */ -void Mod_LoadMarksurfaces (lump_t *l, int bsp2) +void Mod_LoadMarksurfaces (lump_t *l, int32_t bsp2) { - int i, j, count; + int32_t i, j, count; msurface_t **out; if (bsp2) { @@ -1814,14 +1814,14 @@ Mod_LoadSurfedges */ void Mod_LoadSurfedges (lump_t *l) { - int i, count; - int *in, *out; + int32_t i, count; + int32_t *in, *out; - in = (int *)(mod_base + l->fileofs); + in = (int32_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = (int *) Hunk_AllocName ( count*sizeof(*out), loadname); + out = (int32_t *) Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->surfedges = out; loadmodel->numsurfedges = count; @@ -1838,11 +1838,11 @@ Mod_LoadPlanes */ void Mod_LoadPlanes (lump_t *l) { - int i, j; + int32_t i, j; mplane_t *out; dplane_t *in; - int count; - int bits; + int32_t count; + int32_t bits; in = (dplane_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) @@ -1876,7 +1876,7 @@ RadiusFromBounds */ float RadiusFromBounds (vec3_t mins, vec3_t maxs) { - int i; + int32_t i; vec3_t corner; for (i=0 ; i<3 ; i++) @@ -1896,7 +1896,7 @@ void Mod_LoadSubmodels (lump_t *l) { dmodel_t *in; dmodel_t *out; - int i, j, count; + int32_t i, j, count; in = (dmodel_t *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) @@ -1942,7 +1942,7 @@ Therefore, the bounding box of the hull can be constructed entirely from axial planes found in the clipnodes for that hull. ================= */ -void Mod_BoundsFromClipNode (qmodel_t *mod, int hull, int nodenum) +void Mod_BoundsFromClipNode (qmodel_t *mod, int32_t hull, int32_t nodenum) { mplane_t *plane; mclipnode_t *node; @@ -1989,8 +1989,8 @@ Mod_LoadBrushModel */ void Mod_LoadBrushModel (qmodel_t *mod, void *buffer) { - int i, j; - int bsp2; + int32_t i, j; + int32_t bsp2; dheader_t *header; dmodel_t *bm; float radius; //johnfitz @@ -2020,8 +2020,8 @@ void Mod_LoadBrushModel (qmodel_t *mod, void *buffer) // swap all the lumps mod_base = (byte *)header; - for (i = 0; i < (int) sizeof(dheader_t) / 4; i++) - ((int *)header)[i] = LittleLong ( ((int *)header)[i]); + for (i = 0; i < (int32_t) sizeof(dheader_t) / 4; i++) + ((int32_t *)header)[i] = LittleLong ( ((int32_t *)header)[i]); // load into heap @@ -2120,7 +2120,7 @@ mtriangle_t triangles[MAXALIASTRIS]; // a pose is a single set of vertexes. a frame may be // an animating sequence of poses trivertx_t *poseverts[MAXALIASFRAMES]; -int posenum; +int32_t posenum; byte **player_8bit_texels_tbl; byte *player_8bit_texels; @@ -2133,7 +2133,7 @@ Mod_LoadAliasFrame void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame) { trivertx_t *pinframe; - int i; + int32_t i; daliasframe_t *pdaliasframe; pdaliasframe = (daliasframe_t *)pin; @@ -2170,7 +2170,7 @@ Mod_LoadAliasGroup void *Mod_LoadAliasGroup (void * pin, maliasframedesc_t *frame) { daliasgroup_t *pingroup; - int i, numframes; + int32_t i, numframes; daliasinterval_t *pin_intervals; void *ptemp; @@ -2239,13 +2239,13 @@ do { \ else if (pos[off] != 255) fdc = pos[off]; \ } while (0) -void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight ) +void Mod_FloodFillSkin( byte *skin, int32_t skinwidth, int32_t skinheight ) { byte fillcolor = *skin; // assume this is the pixel to fill floodfill_t fifo[FLOODFILL_FIFO_SIZE]; - int inpt = 0, outpt = 0; - int filledcolor = -1; - int i; + int32_t inpt = 0, outpt = 0; + int32_t filledcolor = -1; + int32_t i; if (filledcolor == -1) { @@ -2271,8 +2271,8 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight ) while (outpt != inpt) { - int x = fifo[outpt].x, y = fifo[outpt].y; - int fdc = filledcolor; + int32_t x = fifo[outpt].x, y = fifo[outpt].y; + int32_t fdc = filledcolor; byte *pos = &skin[x + skinwidth * y]; outpt = (outpt + 1) & FLOODFILL_FIFO_MASK; @@ -2290,9 +2290,9 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight ) Mod_LoadAllSkins =============== */ -void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) +void *Mod_LoadAllSkins (int32_t numskins, daliasskintype_t *pskintype) { - int i, j, k, size, groupskins; + int32_t i, j, k, size, groupskins; char name[MAX_QPATH]; byte *skin, *texels; daliasskingroup_t *pinskingroup; @@ -2404,7 +2404,7 @@ Mod_CalcAliasBounds -- johnfitz -- calculate bounds of alias model for nonrotate */ void Mod_CalcAliasBounds (aliashdr_t *a) { - int i,j,k; + int32_t i,j,k; float dist, yawradius, radius; vec3_t v; @@ -2454,7 +2454,7 @@ nameInList(const char *list, const char *name) { const char *s; char tmp[MAX_QPATH]; - int i; + int32_t i; s = list; @@ -2517,15 +2517,15 @@ Mod_LoadAliasModel */ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer) { - int i, j; + int32_t i, j; mdl_t *pinmodel; stvert_t *pinstverts; dtriangle_t *pintriangles; - int version, numframes; - int size; + int32_t version, numframes; + int32_t size; daliasframetype_t *pframetype; daliasskintype_t *pskintype; - int start, end, total; + int32_t start, end, total; start = Hunk_LowMark (); @@ -2673,11 +2673,11 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer) Mod_LoadSpriteFrame ================= */ -void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum) +void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int32_t framenum) { dspriteframe_t *pinframe; mspriteframe_t *pspriteframe; - int width, height, size, origin[2]; + int32_t width, height, size, origin[2]; char name[64]; src_offset_t offset; //johnfitz @@ -2721,11 +2721,11 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum) Mod_LoadSpriteGroup ================= */ -void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum) +void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int32_t framenum) { dspritegroup_t *pingroup; mspritegroup_t *pspritegroup; - int i, numframes; + int32_t i, numframes; dspriteinterval_t *pin_intervals; float *poutintervals; void *ptemp; @@ -2775,12 +2775,12 @@ Mod_LoadSpriteModel */ void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer) { - int i; - int version; + int32_t i; + int32_t version; dsprite_t *pin; msprite_t *psprite; - int numframes; - int size; + int32_t numframes; + int32_t size; dspriteframetype_t *pframetype; pin = (dsprite_t *)buffer; @@ -2852,7 +2852,7 @@ Mod_Print */ void Mod_Print (void) { - int i; + int32_t i; qmodel_t *mod; Con_SafePrintf ("Cached models:\n"); //johnfitz -- safeprint instead of print diff --git a/source/gl_model.h b/source/gl_model.h index 245e807..19ef10a 100644 --- a/source/gl_model.h +++ b/source/gl_model.h @@ -91,8 +91,8 @@ typedef struct texture_s struct gltexture_s *warpimage; //johnfitz -- for water animation bool update_warp; //johnfitz -- update warp this frame struct msurface_s *texturechains[2]; // for texture chains - int anim_total; // total tenths in sequence ( 0 = no) - int anim_min, anim_max; // time for this frame min <=time< max + int32_t anim_total; // total tenths in sequence ( 0 = no) + int32_t anim_min, anim_max; // time for this frame min <=time< max struct texture_s *anim_next; // in the animation sequence struct texture_s *alternate_anims; // bmodels in frmae 1 use these unsigned offsets[MIPLEVELS]; // four mip maps stored @@ -125,7 +125,7 @@ typedef struct float vecs[2][4]; float mipadjust; texture_t *texture; - int flags; + int32_t flags; } mtexinfo_t; #define VERTEXSIZE 7 @@ -134,43 +134,43 @@ typedef struct glpoly_s { struct glpoly_s *next; struct glpoly_s *chain; - int numverts; + int32_t numverts; float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2) } glpoly_t; typedef struct msurface_s { - int visframe; // should be drawn when node is crossed + int32_t visframe; // should be drawn when node is crossed bool culled; // johnfitz -- for frustum culling float mins[3]; // johnfitz -- for frustum culling float maxs[3]; // johnfitz -- for frustum culling mplane_t *plane; - int flags; + int32_t flags; - int firstedge; // look up in model->surfedges[], negative numbers - int numedges; // are backwards edges + int32_t firstedge; // look up in model->surfedges[], negative numbers + int32_t numedges; // are backwards edges int16_t texturemins[2]; int16_t extents[2]; - int light_s, light_t; // gl lightmap coordinates + int32_t light_s, light_t; // gl lightmap coordinates glpoly_t *polys; // multiple if warped struct msurface_s *texturechain; mtexinfo_t *texinfo; - int vbo_firstvert; // index of this surface's first vert in the VBO + int32_t vbo_firstvert; // index of this surface's first vert in the VBO // lighting info - int dlightframe; + int32_t dlightframe; uint32_t dlightbits[(MAX_DLIGHTS + 31) >> 5]; - // int is 32 bits, need an array for MAX_DLIGHTS > 32 + // int32_t is 32 bits, need an array for MAX_DLIGHTS > 32 - int lightmaptexturenum; + int32_t lightmaptexturenum; byte styles[MAXLIGHTMAPS]; - int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap + int32_t cached_light[MAXLIGHTMAPS]; // values currently used in lightmap bool cached_dlight; // true if dynamic light in cache byte *samples; // [numstyles*surfsize] } msurface_t; @@ -178,8 +178,8 @@ typedef struct msurface_s typedef struct mnode_s { // common with leaf - int contents; // 0, to differentiate from leafs - int visframe; // node needs to be traversed if current + int32_t contents; // 0, to differentiate from leafs + int32_t visframe; // node needs to be traversed if current float minmaxs[6]; // for bounding box culling @@ -189,8 +189,8 @@ typedef struct mnode_s mplane_t *plane; struct mnode_s *children[2]; - int firstsurface; - int numsurfaces; + int32_t firstsurface; + int32_t numsurfaces; } mnode_t; @@ -198,8 +198,8 @@ typedef struct mnode_s typedef struct mleaf_s { // common with node - int contents; // wil be a negative contents number - int visframe; // node needs to be traversed if current + int32_t contents; // wil be a negative contents number + int32_t visframe; // node needs to be traversed if current float minmaxs[6]; // for bounding box culling @@ -210,16 +210,16 @@ typedef struct mleaf_s efrag_t *efrags; msurface_t **firstmarksurface; - int nummarksurfaces; - int key; // BSP sequence number for leaf's contents + int32_t nummarksurfaces; + int32_t key; // BSP sequence number for leaf's contents byte ambient_sound_level[NUM_AMBIENTS]; } mleaf_t; //johnfitz -- for clipnodes>32k typedef struct mclipnode_s { - int planenum; - int children[2]; // negative numbers are contents + int32_t planenum; + int32_t children[2]; // negative numbers are contents } mclipnode_t; //johnfitz @@ -228,8 +228,8 @@ typedef struct { mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t mplane_t *planes; - int firstclipnode; - int lastclipnode; + int32_t firstclipnode; + int32_t lastclipnode; vec3_t clip_mins; vec3_t clip_maxs; } hull_t; @@ -246,7 +246,7 @@ SPRITE MODELS // FIXME: shorten these? typedef struct mspriteframe_s { - int width, height; + int32_t width, height; float up, down, left, right; float smax, tmax; //johnfitz -- image might be padded struct gltexture_s *gltexture; @@ -254,7 +254,7 @@ typedef struct mspriteframe_s typedef struct { - int numframes; + int32_t numframes; float *intervals; mspriteframe_t *frames[1]; } mspritegroup_t; @@ -267,10 +267,10 @@ typedef struct typedef struct { - int type; - int maxwidth; - int maxheight; - int numframes; + int32_t type; + int32_t maxwidth; + int32_t maxheight; + int32_t numframes; float beamlength; // remove? void *cachespot; // remove? mspriteframedesc_t frames[1]; @@ -308,12 +308,12 @@ typedef struct meshst_s typedef struct { - int firstpose; - int numposes; + int32_t firstpose; + int32_t numposes; float interval; trivertx_t bboxmin; trivertx_t bboxmax; - int frame; + int32_t frame; char name[16]; } maliasframedesc_t; @@ -321,56 +321,56 @@ typedef struct { trivertx_t bboxmin; trivertx_t bboxmax; - int frame; + int32_t frame; } maliasgroupframedesc_t; typedef struct { - int numframes; - int intervals; + int32_t numframes; + int32_t intervals; maliasgroupframedesc_t frames[1]; } maliasgroup_t; // !!! if this is changed, it must be changed in asm_draw.h too !!! typedef struct mtriangle_s { - int facesfront; - int vertindex[3]; + int32_t facesfront; + int32_t vertindex[3]; } mtriangle_t; #define MAX_SKINS 32 typedef struct { - int ident; - int version; + int32_t ident; + int32_t version; vec3_t scale; vec3_t scale_origin; float boundingradius; vec3_t eyeposition; - int numskins; - int skinwidth; - int skinheight; - int numverts; - int numtris; - int numframes; + int32_t numskins; + int32_t skinwidth; + int32_t skinheight; + int32_t numverts; + int32_t numtris; + int32_t numframes; synctype_t synctype; - int flags; + int32_t flags; float size; //ericw -- used to populate vbo - int numverts_vbo; // number of verts with unique x,y,z,s,t + int32_t numverts_vbo; // number of verts with unique x,y,z,s,t intptr_t meshdesc; // offset into extradata: numverts_vbo aliasmesh_t - int numindexes; + int32_t numindexes; intptr_t indexes; // offset into extradata: numindexes unsigned shorts intptr_t vertexes; // offset into extradata: numposes*vertsperframe trivertx_t //ericw -- - int numposes; - int poseverts; - int posedata; // numposes*poseverts trivert_t - int commands; // gl command list with embedded s/t + int32_t numposes; + int32_t poseverts; + int32_t posedata; // numposes*poseverts trivert_t + int32_t commands; // gl command list with embedded s/t struct gltexture_s *gltextures[MAX_SKINS][4]; //johnfitz struct gltexture_s *fbtextures[MAX_SKINS][4]; //johnfitz - int texels[MAX_SKINS]; // only for player skins + int32_t texels[MAX_SKINS]; // only for player skins maliasframedesc_t frames[1]; // variable sized } aliashdr_t; @@ -414,10 +414,10 @@ typedef struct qmodel_s bool needload; // bmodels and sprites don't cache normally modtype_t type; - int numframes; + int32_t numframes; synctype_t synctype; - int flags; + int32_t flags; // // volume occupied by the model graphics @@ -436,44 +436,44 @@ typedef struct qmodel_s // // brush model // - int firstmodelsurface, nummodelsurfaces; + int32_t firstmodelsurface, nummodelsurfaces; - int numsubmodels; + int32_t numsubmodels; dmodel_t *submodels; - int numplanes; + int32_t numplanes; mplane_t *planes; - int numleafs; // number of visible leafs, not counting 0 + int32_t numleafs; // number of visible leafs, not counting 0 mleaf_t *leafs; - int numvertexes; + int32_t numvertexes; mvertex_t *vertexes; - int numedges; + int32_t numedges; medge_t *edges; - int numnodes; + int32_t numnodes; mnode_t *nodes; - int numtexinfo; + int32_t numtexinfo; mtexinfo_t *texinfo; - int numsurfaces; + int32_t numsurfaces; msurface_t *surfaces; - int numsurfedges; - int *surfedges; + int32_t numsurfedges; + int32_t *surfedges; - int numclipnodes; + int32_t numclipnodes; mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t - int nummarksurfaces; + int32_t nummarksurfaces; msurface_t **marksurfaces; hull_t hulls[MAX_MAP_HULLS]; - int numtextures; + int32_t numtextures; texture_t **textures; byte *visdata; @@ -482,7 +482,7 @@ typedef struct qmodel_s bool viswarn; // for Mod_DecompressVis() - int bspversion; + int32_t bspversion; // // alias model @@ -490,9 +490,9 @@ typedef struct qmodel_s GLuint meshvbo; GLuint meshindexesvbo; - int vboindexofs; // offset in vbo of the hdr->numindexes unsigned shorts - int vboxyzofs; // offset in vbo of hdr->numposes*hdr->numverts_vbo meshxyz_t - int vbostofs; // offset in vbo of hdr->numverts_vbo meshst_t + int32_t vboindexofs; // offset in vbo of the hdr->numindexes unsigned shorts + int32_t vboxyzofs; // offset in vbo of hdr->numposes*hdr->numverts_vbo meshxyz_t + int32_t vbostofs; // offset in vbo of hdr->numverts_vbo meshst_t // // additional model data diff --git a/source/gl_refrag.c b/source/gl_refrag.c index ee2350c..76972b5 100644 --- a/source/gl_refrag.c +++ b/source/gl_refrag.c @@ -72,7 +72,7 @@ static efrag_t *R_GetEfrag (void) } else { - int i; + int32_t i; cl.free_efrags = (efrag_t *) Hunk_AllocName (EXTRA_EFRAGS * sizeof (efrag_t), "efrags"); @@ -96,7 +96,7 @@ void R_SplitEntityOnNode (mnode_t *node) efrag_t *ef; mplane_t *splitplane; mleaf_t *leaf; - int sides; + int32_t sides; if (node->contents == CONTENTS_SOLID) { @@ -169,7 +169,7 @@ R_AddEfrags void R_AddEfrags (entity_t *ent) { qmodel_t *entmodel; - int i; + int32_t i; if (!ent->model) return; diff --git a/source/gl_rlight.c b/source/gl_rlight.c index 86c73b8..eac751f 100644 --- a/source/gl_rlight.c +++ b/source/gl_rlight.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -int r_dlightframecount; +int32_t r_dlightframecount; extern cvar_t r_flatlightstyles; //johnfitz @@ -34,12 +34,12 @@ R_AnimateLight */ void R_AnimateLight (void) { - int i,j,k; + int32_t i,j,k; // // light animations // 'm' is normal light, 'a' is no light, 'z' is double bright - i = (int)(cl.time*10); + i = (int32_t)(cl.time*10); for (j=0 ; jtexinfo->vecs[0]) + surf->texinfo->vecs[0][3]); - dt = (int) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]); + ds = (int32_t) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]); + dt = (int32_t) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]); if (ds < surf->texturemins[0] || dt < surf->texturemins[1]) continue; @@ -342,7 +342,7 @@ loc0: { // LordHavoc: enhanced to interpolate lighting byte *lightmap; - int maps, line3, dsfrac = ds & 15, dtfrac = dt & 15, r00 = 0, g00 = 0, b00 = 0, r01 = 0, g01 = 0, b01 = 0, r10 = 0, g10 = 0, b10 = 0, r11 = 0, g11 = 0, b11 = 0; + int32_t maps, line3, dsfrac = ds & 15, dtfrac = dt & 15, r00 = 0, g00 = 0, b00 = 0, r01 = 0, g01 = 0, b01 = 0, r10 = 0, g10 = 0, b10 = 0, r11 = 0, g11 = 0, b11 = 0; float scale; line3 = ((surf->extents[0]>>4)+1)*3; @@ -358,9 +358,9 @@ loc0: lightmap += ((surf->extents[0]>>4)+1) * ((surf->extents[1]>>4)+1)*3; // LordHavoc: *3 for colored lighting } - color[0] += (float) ((int) ((((((((r11-r10) * dsfrac) >> 4) + r10)-((((r01-r00) * dsfrac) >> 4) + r00)) * dtfrac) >> 4) + ((((r01-r00) * dsfrac) >> 4) + r00))); - color[1] += (float) ((int) ((((((((g11-g10) * dsfrac) >> 4) + g10)-((((g01-g00) * dsfrac) >> 4) + g00)) * dtfrac) >> 4) + ((((g01-g00) * dsfrac) >> 4) + g00))); - color[2] += (float) ((int) ((((((((b11-b10) * dsfrac) >> 4) + b10)-((((b01-b00) * dsfrac) >> 4) + b00)) * dtfrac) >> 4) + ((((b01-b00) * dsfrac) >> 4) + b00))); + color[0] += (float) ((int32_t) ((((((((r11-r10) * dsfrac) >> 4) + r10)-((((r01-r00) * dsfrac) >> 4) + r00)) * dtfrac) >> 4) + ((((r01-r00) * dsfrac) >> 4) + r00))); + color[1] += (float) ((int32_t) ((((((((g11-g10) * dsfrac) >> 4) + g10)-((((g01-g00) * dsfrac) >> 4) + g00)) * dtfrac) >> 4) + ((((g01-g00) * dsfrac) >> 4) + g00))); + color[2] += (float) ((int32_t) ((((((((b11-b10) * dsfrac) >> 4) + b10)-((((b01-b00) * dsfrac) >> 4) + b00)) * dtfrac) >> 4) + ((((b01-b00) * dsfrac) >> 4) + b00))); } return true; // success } @@ -375,7 +375,7 @@ loc0: R_LightPoint -- johnfitz -- replaced entire function for lit support via lordhavoc ============= */ -int R_LightPoint (vec3_t p) +int32_t R_LightPoint (vec3_t p) { vec3_t end; diff --git a/source/gl_rmain.c b/source/gl_rmain.c index 59f0af4..d2048e3 100644 --- a/source/gl_rmain.c +++ b/source/gl_rmain.c @@ -28,14 +28,14 @@ bool r_cache_thrash; // compatability vec3_t modelorg, r_entorigin; entity_t *currententity; -int r_visframecount; // bumped when going to a new PVS -int r_framecount; // used for dlight push checking +int32_t r_visframecount; // bumped when going to a new PVS +int32_t r_framecount; // used for dlight push checking mplane_t frustum[4]; //johnfitz -- rendering statistics -int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys; -int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses; +int32_t rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys; +int32_t rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses; float rs_megatexels; // @@ -55,7 +55,7 @@ refdef_t r_refdef; mleaf_t *r_viewleaf, *r_oldviewleaf; -int d_lightstylevalue[256]; // 8.8 fraction of base light value +int32_t d_lightstylevalue[256]; // 8.8 fraction of base light value cvar_t r_norefresh = {"r_norefresh","0",CVAR_NONE}; @@ -122,7 +122,7 @@ cvar_t r_scale = {"r_scale", "1", CVAR_ARCHIVE}; static GLuint r_gamma_texture; static GLuint r_gamma_program; -static int r_gamma_texture_width, r_gamma_texture_height; +static int32_t r_gamma_texture_width, r_gamma_texture_height; // uniforms used in gamma shader static GLuint gammaLoc; @@ -270,7 +270,7 @@ Returns true if the box is completely outside the frustum */ bool R_CullBox (vec3_t emins, vec3_t emaxs) { - int i; + int32_t i; mplane_t *p; for (i = 0;i < 4;i++) { @@ -362,7 +362,7 @@ GL_PolygonOffset -- johnfitz negative offset moves polygon closer to camera ============= */ -void GL_PolygonOffset (int offset) +void GL_PolygonOffset (int32_t offset) { if (offset > 0) { @@ -389,9 +389,9 @@ void GL_PolygonOffset (int offset) // //============================================================================== -int SignbitsForPlane (mplane_t *out) +int32_t SignbitsForPlane (mplane_t *out) { - int bits, j; + int32_t bits, j; // for fast box on planeside test @@ -434,7 +434,7 @@ R_SetFrustum -- johnfitz -- rewritten */ void R_SetFrustum (float fovx, float fovy) { - int i; + int32_t i; if (r_stereo.value) fovx += 10; //silly hack so that polygons don't drop out becuase of stereo skew @@ -474,12 +474,12 @@ R_SetupGL */ void R_SetupGL (void) { - int scale; + int32_t scale; //johnfitz -- rewrote this section glMatrixMode(GL_PROJECTION); glLoadIdentity (); - scale = CLAMP(1, (int)r_scale.value, 4); // ericw -- see R_ScaleView + scale = CLAMP(1, (int32_t)r_scale.value, 4); // ericw -- see R_ScaleView glViewport (glx + r_refdef.vrect.x, gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height, r_refdef.vrect.width / scale, @@ -571,7 +571,7 @@ void R_SetupView (void) r_fovy = r_refdef.fov_y; if (r_waterwarp.value) { - int contents = Mod_PointInLeaf (r_origin, cl.worldmodel)->contents; + int32_t contents = Mod_PointInLeaf (r_origin, cl.worldmodel)->contents; if (contents == CONTENTS_WATER || contents == CONTENTS_SLIME || contents == CONTENTS_LAVA) { //variance is a percentage of width, where width = 2 * tan(fov / 2) otherwise the effect is too dramatic at high FOV and too subtle at low FOV. what a mess! @@ -618,7 +618,7 @@ R_DrawEntitiesOnList */ void R_DrawEntitiesOnList (bool alphapass) //johnfitz -- added parameter { - int i; + int32_t i; if (!r_drawentities.value) return; @@ -689,7 +689,7 @@ R_EmitWirePoint -- johnfitz -- draws a wireframe cross shape for point entities */ void R_EmitWirePoint (vec3_t origin) { - int size=8; + int32_t size=8; glBegin (GL_LINES); glVertex3f (origin[0]-size, origin[1], origin[2]); @@ -734,7 +734,7 @@ void R_ShowBoundingBoxes (void) extern edict_t *sv_player; vec3_t mins,maxs; edict_t *ed; - int i; + int32_t i; if (!r_showbboxes.value || cl.maxclients > 1 || !r_drawentities.value || !sv.active) return; @@ -787,7 +787,7 @@ R_ShowTris -- johnfitz void R_ShowTris (void) { extern cvar_t r_particles; - int i; + int32_t i; if (r_showtris.value < 1 || r_showtris.value > 2 || cl.maxclients > 1) return; @@ -870,7 +870,7 @@ R_DrawShadows */ void R_DrawShadows (void) { - int i; + int32_t i; if (!r_shadows.value || !r_drawentities.value || r_drawflat_cheatsafe || r_lightmap_cheatsafe) return; @@ -942,7 +942,7 @@ void R_RenderScene (void) } static GLuint r_scaleview_texture; -static int r_scaleview_texture_width, r_scaleview_texture_height; +static int32_t r_scaleview_texture_width, r_scaleview_texture_height; /* ============= @@ -968,11 +968,11 @@ or possibly as a perforance boost on slow graphics cards. void R_ScaleView (void) { float smax, tmax; - int scale; - int srcx, srcy, srcw, srch; + int32_t scale; + int32_t srcx, srcy, srcw, srch; // copied from R_SetupGL() - scale = CLAMP(1, (int)r_scale.value, 4); + scale = CLAMP(1, (int32_t)r_scale.value, 4); srcx = glx + r_refdef.vrect.x; srcy = gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height; srcw = r_refdef.vrect.width / scale; @@ -1090,7 +1090,7 @@ void R_RenderView (void) glColorMask(1, 0, 0, 1); VectorMA (r_refdef.vieworg, -0.5f * eyesep, vright, r_refdef.vieworg); frustum_skew = 0.5 * eyesep * NEARCLIP / fdepth; - srand((int) (cl.time * 1000)); //sync random stuff between eyes + srand((int32_t) (cl.time * 1000)); //sync random stuff between eyes R_RenderScene (); @@ -1099,7 +1099,7 @@ void R_RenderView (void) glColorMask(0, 1, 1, 1); VectorMA (r_refdef.vieworg, 1.0f * eyesep, vright, r_refdef.vieworg); frustum_skew = -frustum_skew; - srand((int) (cl.time * 1000)); //sync random stuff between eyes + srand((int32_t) (cl.time * 1000)); //sync random stuff between eyes R_RenderScene (); @@ -1120,15 +1120,15 @@ void R_RenderView (void) time2 = Sys_DoubleTime (); if (r_pos.value) Con_Printf ("x %i y %i z %i (pitch %i yaw %i roll %i)\n", - (int)cl_entities[cl.viewentity].origin[0], - (int)cl_entities[cl.viewentity].origin[1], - (int)cl_entities[cl.viewentity].origin[2], - (int)cl.viewangles[PITCH], - (int)cl.viewangles[YAW], - (int)cl.viewangles[ROLL]); + (int32_t)cl_entities[cl.viewentity].origin[0], + (int32_t)cl_entities[cl.viewentity].origin[1], + (int32_t)cl_entities[cl.viewentity].origin[2], + (int32_t)cl.viewangles[PITCH], + (int32_t)cl.viewangles[YAW], + (int32_t)cl.viewangles[ROLL]); else if (r_speeds.value == 2) Con_Printf ("%3i ms %4i/%4i wpoly %4i/%4i epoly %3i lmap %4i/%4i sky %1.1f mtex\n", - (int)((time2-time1)*1000), + (int32_t)((time2-time1)*1000), rs_brushpolys, rs_brushpasses, rs_aliaspolys, @@ -1139,7 +1139,7 @@ void R_RenderView (void) TexMgr_FrameUsage ()); else if (r_speeds.value) Con_Printf ("%3i ms %4i wpoly %4i epoly %3i lmap\n", - (int)((time2-time1)*1000), + (int32_t)((time2-time1)*1000), rs_brushpolys, rs_aliaspolys, rs_dynamiclightmaps); diff --git a/source/gl_rmisc.c b/source/gl_rmisc.c index 2717cc1..d3d85f4 100644 --- a/source/gl_rmisc.c +++ b/source/gl_rmisc.c @@ -81,10 +81,10 @@ R_SetClearColor_f -- johnfitz static void R_SetClearColor_f (cvar_t *var) { byte *rgb; - int s; + int32_t s; (void)var; - s = (int)r_clearcolor.value & 0xFF; + s = (int32_t)r_clearcolor.value & 0xFF; rgb = (byte*)(d_8to24table + s); glClearColor (rgb[0]/255.0,rgb[1]/255.0,rgb[2]/255.0,0); } @@ -96,7 +96,7 @@ R_Novis_f -- johnfitz */ static void R_VisChanged (cvar_t *var) { - extern int vis_changed; + extern int32_t vis_changed; (void)var; vis_changed = 1; } @@ -109,7 +109,7 @@ R_Model_ExtraFlags_List_f -- johnfitz -- called when r_nolerp_list or r_noshadow static void R_Model_ExtraFlags_List_f (cvar_t *var) { (void)var; - int i; + int32_t i; for (i=0; i < MAX_MODELS; i++) Mod_SetExtraFlags (cl.model_precache[i]); } @@ -258,9 +258,9 @@ void R_Init (void) R_TranslatePlayerSkin -- johnfitz -- rewritten. also, only handles new colors, not new skins =============== */ -void R_TranslatePlayerSkin (int playernum) +void R_TranslatePlayerSkin (int32_t playernum) { - int top, bottom; + int32_t top, bottom; top = (cl.scores[playernum].colors & 0xf0)>>4; bottom = cl.scores[playernum].colors &15; @@ -278,12 +278,12 @@ the skin or model actually changes, instead of just new colors added bug fix from bengt jardup =============== */ -void R_TranslateNewPlayerSkin (int playernum) +void R_TranslateNewPlayerSkin (int32_t playernum) { char name[64]; byte *pixels; aliashdr_t *paliashdr; - int skinnum; + int32_t skinnum; //get correct texture pixels currententity = &cl_entities[1+playernum]; @@ -320,7 +320,7 @@ R_NewGame -- johnfitz -- handle a game switch */ void R_NewGame (void) { - int i; + int32_t i; //clear playertexture pointers (the textures themselves were freed by texmgr_newgame) for (i=0; i 0) ? (int)scr_conwidth.value : (scr_conscale.value > 0) ? (int)(vid.width/scr_conscale.value) : vid.width; + vid.conwidth = (scr_conwidth.value > 0) ? (int32_t)scr_conwidth.value : (scr_conscale.value > 0) ? (int32_t)(vid.width/scr_conscale.value) : vid.width; vid.conwidth = CLAMP (320, vid.conwidth, vid.width); vid.conwidth &= 0xFFFFFFF8; vid.conheight = vid.conwidth * vid.height / vid.width; @@ -444,9 +444,9 @@ void SCR_DrawFPS (void) { static double oldtime = 0; static double lastfps = 0; - static int oldframecount = 0; + static int32_t oldframecount = 0; double elapsed_time; - int frames; + int32_t frames; elapsed_time = realtime - oldtime; frames = r_framecount - oldframecount; @@ -468,7 +468,7 @@ void SCR_DrawFPS (void) if (scr_showfps.value) { char st[16]; - int x, y; + int32_t x, y; sprintf (st, "%4.0f fps", lastfps); x = 320 - (strlen(st)<<3); y = 200 - 8; @@ -490,10 +490,10 @@ void SCR_DrawClock (void) if (scr_clock.value == 1) { - int minutes, seconds; + int32_t minutes, seconds; minutes = cl.time / 60; - seconds = ((int)cl.time)%60; + seconds = ((int32_t)cl.time)%60; sprintf (str,"%i:%i%i", minutes, seconds/10, seconds%10); } @@ -515,8 +515,8 @@ SCR_DrawDevStats void SCR_DrawDevStats (void) { char str[40]; - int y = 25-9; //9=number of lines to print - int x = 0; //margin + int32_t y = 25-9; //9=number of lines to print + int32_t x = 0; //margin if (!devstats.value) return; @@ -578,7 +578,7 @@ SCR_DrawTurtle */ void SCR_DrawTurtle (void) { - static int count; + static int32_t count; if (!scr_showturtle.value) return; @@ -778,7 +778,7 @@ void SCR_ScreenShot_f (void) char ext[4]; char imagename[16]; //johnfitz -- was [80] char checkname[MAX_OSPATH]; - int i, quality; + int32_t i, quality; bool ok; Q_strncpy (ext, "png", sizeof(ext)); @@ -903,9 +903,9 @@ bool scr_drawdialog; void SCR_DrawNotifyString (void) { const char *start; - int l; - int j; - int x, y; + int32_t l; + int32_t j; + int32_t x, y; GL_SetCanvas (CANVAS_MENU); //johnfitz @@ -942,10 +942,10 @@ Displays a text string in the center of the screen and waits for a Y or N keypress. ================== */ -int SCR_ModalMessage (const char *text, float timeout) //johnfitz -- timeout +int32_t SCR_ModalMessage (const char *text, float timeout) //johnfitz -- timeout { double time1, time2; //johnfitz -- timeout - int lastkey, lastchar; + int32_t lastkey, lastchar; if (cls.state == ca_dedicated) return true; diff --git a/source/gl_sky.c b/source/gl_sky.c index 164252b..badaff8 100644 --- a/source/gl_sky.c +++ b/source/gl_sky.c @@ -30,8 +30,8 @@ float Fog_GetDensity(void); float *Fog_GetColor(void); extern qmodel_t *loadmodel; -extern int rs_skypolys; //for r_speeds readout -extern int rs_skypasses; //for r_speeds readout +extern int32_t rs_skypolys; //for r_speeds readout +extern int32_t rs_skypasses; //for r_speeds readout float skyflatcolor[3]; float skymins[2][6], skymaxs[2][6]; @@ -46,7 +46,7 @@ cvar_t r_sky_quality = {"r_sky_quality", "12", CVAR_NONE}; cvar_t r_skyalpha = {"r_skyalpha", "1", CVAR_NONE}; cvar_t r_skyfog = {"r_skyfog","0.5",CVAR_NONE}; -int skytexorder[6] = {0,2,1,3,4,5}; //for skybox +int32_t skytexorder[6] = {0,2,1,3,4,5}; //for skybox vec3_t skyclip[6] = { {1,1,0}, @@ -57,7 +57,7 @@ vec3_t skyclip[6] = { {-1,0,1} }; -int st_to_vec[6][3] = +int32_t st_to_vec[6][3] = { {3,-1,2}, {-3,1,2}, @@ -67,7 +67,7 @@ int st_to_vec[6][3] = {2,-1,-3} // straight down }; -int vec_to_st[6][3] = +int32_t vec_to_st[6][3] = { {-2,3,1}, {2,3,-1}, @@ -95,7 +95,7 @@ A sky texture is 256*128, with the left side being a masked overlay void Sky_LoadTexture (texture_t *mt) { char texturename[64]; - int i, j, p, r, g, b, count; + int32_t i, j, p, r, g, b, count; byte *src; static byte front_data[128*128]; //FIXME: Hunk_Alloc static byte back_data[128*128]; //FIXME: Hunk_Alloc @@ -151,7 +151,7 @@ Sky_LoadSkyBox const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; void Sky_LoadSkyBox (const char *name) { - int i, mark, width, height; + int32_t i, mark, width, height; char filename[MAX_OSPATH]; byte *data; bool nonefound = true; @@ -217,7 +217,7 @@ void Sky_NewMap (void) { char key[128], value[4096]; const char *data; - int i; + int32_t i; // // initially no sky @@ -311,7 +311,7 @@ Sky_Init */ void Sky_Init (void) { - int i; + int32_t i; Cvar_RegisterVariable (&r_fastsky); Cvar_RegisterVariable (&r_sky_quality); @@ -338,12 +338,12 @@ Sky_ProjectPoly update sky bounds ================= */ -void Sky_ProjectPoly (int nump, vec3_t vecs) +void Sky_ProjectPoly (int32_t nump, vec3_t vecs) { - int i,j; + int32_t i,j; vec3_t v, av; float s, t, dv; - int axis; + int32_t axis; float *vp; // decide which face it maps to @@ -413,17 +413,17 @@ void Sky_ProjectPoly (int nump, vec3_t vecs) Sky_ClipPoly ================= */ -void Sky_ClipPoly (int nump, vec3_t vecs, int stage) +void Sky_ClipPoly (int32_t nump, vec3_t vecs, int32_t stage) { float *norm; float *v; bool front, back; float d, e; float dists[MAX_CLIP_VERTS]; - int sides[MAX_CLIP_VERTS]; + int32_t sides[MAX_CLIP_VERTS]; vec3_t newv[2][MAX_CLIP_VERTS]; - int newc[2]; - int i, j; + int32_t newc[2]; + int32_t i, j; if (nump > MAX_CLIP_VERTS-2) Sys_Error ("Sky_ClipPoly: MAX_CLIP_VERTS"); @@ -511,7 +511,7 @@ Sky_ProcessPoly */ void Sky_ProcessPoly (glpoly_t *p) { - int i; + int32_t i; vec3_t verts[MAX_CLIP_VERTS]; //draw it @@ -534,7 +534,7 @@ Sky_ProcessTextureChains -- handles sky polys in world model */ void Sky_ProcessTextureChains (void) { - int i; + int32_t i; msurface_t *s; texture_t *t; @@ -564,7 +564,7 @@ void Sky_ProcessEntities (void) entity_t *e; msurface_t *s; glpoly_t *p; - int i,j,k,mark; + int32_t i,j,k,mark; float dot; bool rotated; vec3_t temp, forward, right, up; @@ -648,10 +648,10 @@ void Sky_ProcessEntities (void) Sky_EmitSkyBoxVertex ============== */ -void Sky_EmitSkyBoxVertex (float s, float t, int axis) +void Sky_EmitSkyBoxVertex (float s, float t, int32_t axis) { vec3_t v, b; - int j, k; + int32_t j, k; float w, h; b[0] = s * gl_farclip.value / sqrt(3.0); @@ -692,7 +692,7 @@ FIXME: eliminate cracks by adding an extra vert on tjuncs */ void Sky_DrawSkyBox (void) { - int i; + int32_t i; for (i=0 ; i<6 ; i++) { @@ -753,10 +753,10 @@ void Sky_DrawSkyBox (void) Sky_SetBoxVert ============== */ -void Sky_SetBoxVert (float s, float t, int axis, vec3_t v) +void Sky_SetBoxVert (float s, float t, int32_t axis, vec3_t v) { vec3_t b; - int j, k; + int32_t j, k; b[0] = s * gl_farclip.value / sqrt(3.0); b[1] = t * gl_farclip.value / sqrt(3.0); @@ -791,7 +791,7 @@ void Sky_GetTexCoord (vec3_t v, float speed, float *s, float *t) length = 6*63/length; scroll = cl.time*speed; - scroll -= (int)scroll & ~127; + scroll -= (int32_t)scroll & ~127; *s = (scroll + dir[0] * length) * (1.0/128); *t = (scroll + dir[1] * length) * (1.0/128); @@ -806,7 +806,7 @@ void Sky_DrawFaceQuad (glpoly_t *p) { float s, t; float *v; - int i; + int32_t i; if (gl_mtexable && r_skyalpha.value >= 1.0) { @@ -896,11 +896,11 @@ Sky_DrawFace ============== */ -void Sky_DrawFace (int axis) +void Sky_DrawFace (int32_t axis) { glpoly_t *p; vec3_t verts[4]; - int i, j, start; + int32_t i, j, start; float di,qi,dj,qj; vec3_t vup, vright, temp, temp2; @@ -915,7 +915,7 @@ void Sky_DrawFace (int axis) VectorSubtract(verts[2],verts[3],vup); VectorSubtract(verts[2],verts[1],vright); - di = q_max((int)r_sky_quality.value, 1); + di = q_max((int32_t)r_sky_quality.value, 1); qi = 1.0 / di; dj = (axis < 4) ? di*2 : di; //subdivide vertically more than horizontally on skybox sides qj = 1.0 / dj; @@ -957,7 +957,7 @@ draws the old-style scrolling cloud layers */ void Sky_DrawSkyLayers (void) { - int i; + int32_t i; if (r_skyalpha.value < 1.0) glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -979,7 +979,7 @@ called once per frame before drawing anything else */ void Sky_DrawSky (void) { - int i; + int32_t i; //in these special render modes, the sky faces are handled in the normal world/brush renderer if (r_drawflat_cheatsafe || r_lightmap_cheatsafe ) diff --git a/source/gl_texmgr.c b/source/gl_texmgr.c index 289b430..04a625a 100644 --- a/source/gl_texmgr.c +++ b/source/gl_texmgr.c @@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -const int gl_solid_format = 3; -const int gl_alpha_format = 4; +const int32_t gl_solid_format = 3; +const int32_t gl_alpha_format = 4; static cvar_t gl_texturemode = {"gl_texturemode", "", CVAR_ARCHIVE}; static cvar_t gl_texture_anisotropy = {"gl_texture_anisotropy", "1", CVAR_ARCHIVE}; @@ -34,7 +34,7 @@ static cvar_t gl_picmip = {"gl_picmip", "0", CVAR_NONE}; static GLint gl_hardware_maxsize; #define MAX_GLTEXTURES 2048 -static int numgltextures; +static int32_t numgltextures; static gltexture_t *active_gltextures, *free_gltextures; gltexture_t *notexture, *nulltexture; @@ -57,8 +57,8 @@ uint32_t d_8to24table_pants[256]; typedef struct { - int magfilter; - int minfilter; + int32_t magfilter; + int32_t minfilter; const char *name; } glmode_t; static glmode_t glmodes[] = { @@ -69,8 +69,8 @@ static glmode_t glmodes[] = { {GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, "GL_LINEAR_MIPMAP_NEAREST"}, {GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, "GL_LINEAR_MIPMAP_LINEAR"}, }; -#define NUM_GLMODES (int)(sizeof(glmodes)/sizeof(glmodes[0])) -static int glmode_idx = NUM_GLMODES - 1; /* trilinear */ +#define NUM_GLMODES (int32_t)(sizeof(glmodes)/sizeof(glmodes[0])) +static int32_t glmode_idx = NUM_GLMODES - 1; /* trilinear */ /* =============== @@ -79,7 +79,7 @@ TexMgr_DescribeTextureModes_f -- report available texturemodes */ static void TexMgr_DescribeTextureModes_f (void) { - int i; + int32_t i; for (i = 0; i < NUM_GLMODES; i++) Con_SafePrintf (" %2i: %s\n", i + 1, glmodes[i].name); @@ -127,7 +127,7 @@ TexMgr_TextureMode_f -- called when gl_texturemode changes static void TexMgr_TextureMode_f (cvar_t *var) { gltexture_t *glt; - int i; + int32_t i; (void)var; @@ -220,7 +220,7 @@ static void TexMgr_Imagelist_f (void) } mb = texels * (Cvar_VariableValue("vid_bpp") / 8.0f) / 0x100000; - Con_Printf ("%i textures %i pixels %1.1f megabytes\n", numgltextures, (int)texels, mb); + Con_Printf ("%i textures %i pixels %1.1f megabytes\n", numgltextures, (int32_t)texels, mb); } /* @@ -464,7 +464,7 @@ TexMgr_LoadPalette -- johnfitz -- was VID_SetPalette, moved here, renamed, rewri void TexMgr_LoadPalette (void) { byte *pal, *src, *dst; - int i, mark; + int32_t i, mark; FILE *f; COM_FOpenFile ("gfx/palette.lmp", &f, NULL); @@ -557,8 +557,8 @@ choose safe warpimage size and resize existing warpimage textures */ void TexMgr_RecalcWarpImageSize (void) { -// int oldsize = gl_warpimagesize; - int mark; +// int32_t oldsize = gl_warpimagesize; + int32_t mark; gltexture_t *glt; byte *dummy; @@ -605,7 +605,7 @@ must be called before any texture loading */ void TexMgr_Init (void) { - int i; + int32_t i; static byte notexture_data[16] = {159,91,83,255,0,0,0,255,0,0,0,255,159,91,83,255}; //black and pink checker static byte nulltexture_data[16] = {127,191,255,255,0,0,0,255,0,0,0,255,127,191,255,255}; //black and blue checker extern texture_t *r_notexture_mip, *r_notexture_mip2; @@ -660,9 +660,9 @@ void TexMgr_Init (void) TexMgr_Pad -- return smallest power of two greater than or equal to s ================ */ -int TexMgr_Pad (int s) +int32_t TexMgr_Pad (int32_t s) { - int i; + int32_t i; for (i = 1; i < s; i<<=1) ; return i; @@ -673,12 +673,12 @@ int TexMgr_Pad (int s) TexMgr_SafeTextureSize -- return a size with hardware and user prefs in mind =============== */ -int TexMgr_SafeTextureSize (int s) +int32_t TexMgr_SafeTextureSize (int32_t s) { if (!gl_texture_NPOT) s = TexMgr_Pad(s); - if ((int)gl_max_size.value > 0) - s = q_min(TexMgr_Pad((int)gl_max_size.value), s); + if ((int32_t)gl_max_size.value > 0) + s = q_min(TexMgr_Pad((int32_t)gl_max_size.value), s); s = q_min(gl_hardware_maxsize, s); return s; } @@ -688,7 +688,7 @@ int TexMgr_SafeTextureSize (int s) TexMgr_PadConditional -- only pad if a texture of that size would be padded. (used for tex coords) ================ */ -int TexMgr_PadConditional (int s) +int32_t TexMgr_PadConditional (int32_t s) { if (s < TexMgr_SafeTextureSize(s)) return TexMgr_Pad(s); @@ -701,9 +701,9 @@ int TexMgr_PadConditional (int s) TexMgr_MipMapW ================ */ -static unsigned *TexMgr_MipMapW (unsigned *data, int width, int height) +static unsigned *TexMgr_MipMapW (unsigned *data, int32_t width, int32_t height) { - int i, size; + int32_t i, size; byte *out, *in; out = in = (byte *)data; @@ -725,9 +725,9 @@ static unsigned *TexMgr_MipMapW (unsigned *data, int width, int height) TexMgr_MipMapH ================ */ -static unsigned *TexMgr_MipMapH (unsigned *data, int width, int height) +static unsigned *TexMgr_MipMapH (unsigned *data, int32_t width, int32_t height) { - int i, j; + int32_t i, j; byte *out, *in; out = in = (byte *)data; @@ -753,12 +753,12 @@ static unsigned *TexMgr_MipMapH (unsigned *data, int width, int height) TexMgr_ResampleTexture -- bilinear resample ================ */ -static unsigned *TexMgr_ResampleTexture (unsigned *in, int inwidth, int inheight, bool alpha) +static unsigned *TexMgr_ResampleTexture (unsigned *in, int32_t inwidth, int32_t inheight, bool alpha) { byte *nwpx, *nepx, *swpx, *sepx, *dest; unsigned xfrac, yfrac, x, y, modx, mody, imodx, imody, injump, outjump; unsigned *out; - int i, j, outwidth, outheight; + int32_t i, j, outwidth, outheight; if (inwidth == TexMgr_Pad(inwidth) && inheight == TexMgr_Pad(inheight)) return in; @@ -815,9 +815,9 @@ eliminate pink edges on sprites, etc. operates in place on 32bit data =============== */ -static void TexMgr_AlphaEdgeFix (byte *data, int width, int height) +static void TexMgr_AlphaEdgeFix (byte *data, int32_t width, int32_t height) { - int i, j, n = 0, b, c[3] = {0,0,0}, + int32_t i, j, n = 0, b, c[3] = {0,0,0}, lastrow, thisrow, nextrow, lastpix, thispix, nextpix; byte *dest = data; @@ -866,10 +866,10 @@ TexMgr_PadEdgeFixW -- special case of AlphaEdgeFix for textures that only need i operates in place on 32bit data, and expects unpadded height and width values =============== */ -static void TexMgr_PadEdgeFixW (byte *data, int width, int height) +static void TexMgr_PadEdgeFixW (byte *data, int32_t width, int32_t height) { byte *src, *dst; - int i, padw, padh; + int32_t i, padw, padh; padw = TexMgr_PadConditional(width); padh = TexMgr_PadConditional(height); @@ -904,10 +904,10 @@ TexMgr_PadEdgeFixH -- special case of AlphaEdgeFix for textures that only need i operates in place on 32bit data, and expects unpadded height and width values =============== */ -static void TexMgr_PadEdgeFixH (byte *data, int width, int height) +static void TexMgr_PadEdgeFixH (byte *data, int32_t width, int32_t height) { byte *src, *dst; - int i, padw, padh; + int32_t i, padw, padh; padw = TexMgr_PadConditional(width); padh = TexMgr_PadConditional(height); @@ -942,9 +942,9 @@ static void TexMgr_PadEdgeFixH (byte *data, int width, int height) TexMgr_8to32 ================ */ -static unsigned *TexMgr_8to32 (byte *in, int pixels, uint32_t *usepal) +static unsigned *TexMgr_8to32 (byte *in, int32_t pixels, uint32_t *usepal) { - int i; + int32_t i; unsigned *out, *data; out = data = (unsigned *) Hunk_Alloc(pixels*4); @@ -960,9 +960,9 @@ static unsigned *TexMgr_8to32 (byte *in, int pixels, uint32_t *usepal) TexMgr_PadImageW -- return image with width padded up to power-of-two dimentions ================ */ -static byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte) +static byte *TexMgr_PadImageW (byte *in, int32_t width, int32_t height, byte padbyte) { - int i, j, outwidth; + int32_t i, j, outwidth; byte *out, *data; if (width == TexMgr_Pad(width)) @@ -988,9 +988,9 @@ static byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte) TexMgr_PadImageH -- return image with height padded up to power-of-two dimentions ================ */ -static byte *TexMgr_PadImageH (byte *in, int width, int height, byte padbyte) +static byte *TexMgr_PadImageH (byte *in, int32_t width, int32_t height, byte padbyte) { - int i, srcpix, dstpix; + int32_t i, srcpix, dstpix; byte *data, *out; if (height == TexMgr_Pad(height)) @@ -1016,7 +1016,7 @@ TexMgr_LoadImage32 -- handles 32bit source data */ static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data) { - int internalformat, miplevel, mipwidth, mipheight, picmip; + int32_t internalformat, miplevel, mipwidth, mipheight, picmip; if (!gl_texture_NPOT) { @@ -1027,17 +1027,17 @@ static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data) } // mipmap down - picmip = (glt->flags & TEXPREF_NOPICMIP) ? 0 : q_max((int)gl_picmip.value, 0); + picmip = (glt->flags & TEXPREF_NOPICMIP) ? 0 : q_max((int32_t)gl_picmip.value, 0); mipwidth = TexMgr_SafeTextureSize (glt->width >> picmip); mipheight = TexMgr_SafeTextureSize (glt->height >> picmip); - while ((int) glt->width > mipwidth) + while ((int32_t) glt->width > mipwidth) { TexMgr_MipMapW (data, glt->width, glt->height); glt->width >>= 1; if (glt->flags & TEXPREF_ALPHA) TexMgr_AlphaEdgeFix ((byte *)data, glt->width, glt->height); } - while ((int) glt->height > mipheight) + while ((int32_t) glt->height > mipheight) { TexMgr_MipMapH (data, glt->width, glt->height); glt->height >>= 1; @@ -1087,7 +1087,7 @@ static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data) bool padw = false, padh = false; byte padbyte; uint32_t *usepal; - int i; + int32_t i; // HACK HACK HACK -- taken from tomazquake if (strstr(glt->name, "shot1sid") && @@ -1103,10 +1103,10 @@ static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data) // detect false alpha cases if (glt->flags & TEXPREF_ALPHA && !(glt->flags & TEXPREF_CONCHARS)) { - for (i = 0; i < (int) (glt->width * glt->height); i++) + for (i = 0; i < (int32_t) (glt->width * glt->height); i++) if (data[i] == 255) //transparent index break; - if (i == (int) (glt->width * glt->height)) + if (i == (int32_t) (glt->width * glt->height)) glt->flags -= TEXPREF_ALPHA; } @@ -1141,13 +1141,13 @@ static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data) // pad each dimention, but only if it's not going to be downsampled later if (glt->flags & TEXPREF_PAD) { - if ((int) glt->width < TexMgr_SafeTextureSize(glt->width)) + if ((int32_t) glt->width < TexMgr_SafeTextureSize(glt->width)) { data = TexMgr_PadImageW (data, glt->width, glt->height, padbyte); glt->width = TexMgr_Pad(glt->width); padw = true; } - if ((int) glt->height < TexMgr_SafeTextureSize(glt->height)) + if ((int32_t) glt->height < TexMgr_SafeTextureSize(glt->height)) { data = TexMgr_PadImageH (data, glt->width, glt->height, padbyte); glt->height = TexMgr_Pad(glt->height); @@ -1193,12 +1193,12 @@ static void TexMgr_LoadLightmap (gltexture_t *glt, byte *data) TexMgr_LoadImage -- the one entry point for loading all textures ================ */ -gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int height, enum srcformat format, +gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int32_t width, int32_t height, enum srcformat format, byte *data, const char *source_file, src_offset_t source_offset, unsigned flags) { uint16_t crc; gltexture_t *glt; - int mark; + int32_t mark; if (isDedicated) return NULL; @@ -1275,11 +1275,11 @@ gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int TexMgr_ReloadImage -- reloads a texture, and colormaps it if needed ================ */ -void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants) +void TexMgr_ReloadImage (gltexture_t *glt, int32_t shirt, int32_t pants) { byte translation[256]; byte *src, *dst, *data = NULL, *translated; - int mark, size, i; + int32_t mark, size, i; // // get source data // @@ -1305,7 +1305,7 @@ void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants) fclose (f); } else if (glt->source_file[0] && !glt->source_offset) - data = Image_LoadImage (glt->source_file, (int *)&glt->source_width, (int *)&glt->source_height); //simple file + data = Image_LoadImage (glt->source_file, (int32_t *)&glt->source_width, (int32_t *)&glt->source_height); //simple file else if (!glt->source_file[0] && glt->source_offset) data = (byte *) glt->source_offset; //image in memory @@ -1539,7 +1539,7 @@ Call this after changing the binding outside of GL_Bind. */ void GL_ClearBindings(void) { - int i; + int32_t i; for (i = 0; i < 3; i++) { currenttexture[i] = GL_UNUSED_TEXTURE; diff --git a/source/gl_texmgr.h b/source/gl_texmgr.h index 25ec163..e8433f9 100644 --- a/source/gl_texmgr.h +++ b/source/gl_texmgr.h @@ -62,7 +62,7 @@ typedef struct gltexture_s { int8_t shirt; //0-13 shirt color, or -1 if never colormapped int8_t pants; //0-13 pants color, or -1 if never colormapped //used for rendering - int visframe; //matches r_framecount if texture was bound this frame + int32_t visframe; //matches r_framecount if texture was bound this frame } gltexture_t; extern gltexture_t *notexture; @@ -88,15 +88,15 @@ void TexMgr_Init (void); void TexMgr_DeleteTextureObjects (void); // IMAGE LOADING -gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int height, enum srcformat format, +gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int32_t width, int32_t height, enum srcformat format, byte *data, const char *source_file, src_offset_t source_offset, unsigned flags); -void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants); +void TexMgr_ReloadImage (gltexture_t *glt, int32_t shirt, int32_t pants); void TexMgr_ReloadImages (void); void TexMgr_ReloadNobrightImages (void); -int TexMgr_Pad(int s); -int TexMgr_SafeTextureSize (int s); -int TexMgr_PadConditional (int s); +int32_t TexMgr_Pad(int32_t s); +int32_t TexMgr_SafeTextureSize (int32_t s); +int32_t TexMgr_PadConditional (int32_t s); // TEXTURE BINDING & TEXTURE UNIT SWITCHING diff --git a/source/gl_vidsdl.c b/source/gl_vidsdl.c index ceea848..28967ac 100644 --- a/source/gl_vidsdl.c +++ b/source/gl_vidsdl.c @@ -46,22 +46,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DEFAULT_REFRESHRATE 60 typedef struct { - int width; - int height; - int refreshrate; - int bpp; + int32_t width; + int32_t height; + int32_t refreshrate; + int32_t bpp; } vmode_t; static const char *gl_vendor; static const char *gl_renderer; static const char *gl_version; -static int gl_version_major; -static int gl_version_minor; +static int32_t gl_version_major; +static int32_t gl_version_minor; static const char *gl_extensions; static char * gl_extensions_nice; static vmode_t modelist[MAX_MODE_LIST]; -static int nummodes; +static int32_t nummodes; static bool vid_initialized = false; @@ -74,7 +74,7 @@ static bool vid_changed = false; static void VID_Menu_Init (void); //johnfitz static void VID_Menu_f (void); //johnfitz static void VID_MenuDraw (void); -static void VID_MenuKey (int key); +static void VID_MenuKey (int32_t key); static void ClearAllStates (void); static void GL_Init (void); @@ -96,7 +96,7 @@ bool gl_glsl_able = false; //ericw GLint gl_max_texture_units = 0; //ericw bool gl_glsl_gamma_able = false; //ericw bool gl_glsl_alias_able = false; //ericw -int gl_stencilbits; +int32_t gl_stencilbits; PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz @@ -167,7 +167,7 @@ static uint16_t vid_sysgamma_blue[256]; #endif static bool gammaworks = false; // whether hw-gamma works -static int fsaa; +static int32_t fsaa; /* ================ @@ -242,12 +242,12 @@ static void VID_Gamma_f (cvar_t *var) return; #if USE_GAMMA_RAMPS - int i; + int32_t i; for (i = 0; i < 256; i++) { vid_gamma_red[i] = - CLAMP(0, (int) ((255 * pow((i + 0.5)/255.5, vid_gamma.value) + 0.5) * vid_contrast.value), 255) << 8; + CLAMP(0, (int32_t) ((255 * pow((i + 0.5)/255.5, vid_gamma.value) + 0.5) * vid_contrast.value), 255) << 8; vid_gamma_green[i] = vid_gamma_red[i]; vid_gamma_blue[i] = vid_gamma_red[i]; } @@ -287,9 +287,9 @@ static void VID_Gamma_Init (void) VID_GetCurrentWidth ====================== */ -static int VID_GetCurrentWidth (void) +static int32_t VID_GetCurrentWidth (void) { - int w; + int32_t w; SDL_GetWindowSize(draw_context, &w, NULL); return w; } @@ -299,9 +299,9 @@ static int VID_GetCurrentWidth (void) VID_GetCurrentHeight ======================= */ -static int VID_GetCurrentHeight (void) +static int32_t VID_GetCurrentHeight (void) { - int h; + int32_t h; SDL_GetWindowSize(draw_context, NULL, &h); return h; } @@ -311,10 +311,10 @@ static int VID_GetCurrentHeight (void) VID_GetCurrentRefreshRate ==================== */ -static int VID_GetCurrentRefreshRate (void) +static int32_t VID_GetCurrentRefreshRate (void) { SDL_DisplayMode mode; - int current_display; + int32_t current_display; current_display = SDL_GetWindowDisplayIndex(draw_context); @@ -330,7 +330,7 @@ static int VID_GetCurrentRefreshRate (void) VID_GetCurrentBPP ==================== */ -static int VID_GetCurrentBPP (void) +static int32_t VID_GetCurrentBPP (void) { const Uint32 pixelFormat = SDL_GetWindowPixelFormat(draw_context); return SDL_BITSPERPIXEL(pixelFormat); @@ -414,11 +414,11 @@ This is passed to SDL_SetWindowDisplayMode to specify a pixel format with the requested bpp. If we didn't care about bpp we could just pass NULL. ================ */ -static SDL_DisplayMode *VID_SDL2_GetDisplayMode(int width, int height, int refreshrate, int bpp) +static SDL_DisplayMode *VID_SDL2_GetDisplayMode(int32_t width, int32_t height, int32_t refreshrate, int32_t bpp) { static SDL_DisplayMode mode; - const int sdlmodes = SDL_GetNumDisplayModes(0); - int i; + const int32_t sdlmodes = SDL_GetNumDisplayModes(0); + int32_t i; for (i = 0; i < sdlmodes; i++) { @@ -440,7 +440,7 @@ static SDL_DisplayMode *VID_SDL2_GetDisplayMode(int width, int height, int refre VID_ValidMode ================ */ -static bool VID_ValidMode (int width, int height, int refreshrate, int bpp, bool fullscreen) +static bool VID_ValidMode (int32_t width, int32_t height, int32_t refreshrate, int32_t bpp, bool fullscreen) { // ignore width / height / bpp if vid_desktopfullscreen is enabled if (fullscreen && vid_desktopfullscreen.value) @@ -473,14 +473,14 @@ static bool VID_ValidMode (int width, int height, int refreshrate, int bpp, bool VID_SetMode ================ */ -static bool VID_SetMode (int width, int height, int refreshrate, int bpp, bool fullscreen) +static bool VID_SetMode (int32_t width, int32_t height, int32_t refreshrate, int32_t bpp, bool fullscreen) { - int temp; + int32_t temp; Uint32 flags; char caption[50]; - int depthbits, stencilbits; - int fsaa_obtained; - int previous_display; + int32_t depthbits, stencilbits; + int32_t fsaa_obtained; + int32_t previous_display; // so Con_Printfs don't mess us up by forcing vid and snd updates temp = scr_disabled_for_loading; @@ -639,16 +639,16 @@ VID_Restart -- johnfitz -- change video modes on the fly */ static void VID_Restart (void) { - int width, height, refreshrate, bpp; + int32_t width, height, refreshrate, bpp; bool fullscreen; if (vid_locked || !vid_changed) return; - width = (int)vid_width.value; - height = (int)vid_height.value; - refreshrate = (int)vid_refreshrate.value; - bpp = (int)vid_bpp.value; + width = (int32_t)vid_width.value; + height = (int32_t)vid_height.value; + refreshrate = (int32_t)vid_refreshrate.value; + bpp = (int32_t)vid_bpp.value; fullscreen = vid_fullscreen.value ? true : false; // @@ -691,7 +691,7 @@ static void VID_Restart (void) TexMgr_RecalcWarpImageSize (); //conwidth and conheight need to be recalculated - vid.conwidth = (scr_conwidth.value > 0) ? (int)scr_conwidth.value : (scr_conscale.value > 0) ? (int)(vid.width/scr_conscale.value) : vid.width; + vid.conwidth = (scr_conwidth.value > 0) ? (int32_t)scr_conwidth.value : (scr_conscale.value > 0) ? (int32_t)(vid.width/scr_conscale.value) : vid.width; vid.conwidth = CLAMP (320, vid.conwidth, vid.width); vid.conwidth &= 0xFFFFFFF8; vid.conheight = vid.conwidth * vid.height / vid.width; @@ -718,7 +718,7 @@ VID_Test -- johnfitz -- like vid_restart, but asks for confirmation after switch */ static void VID_Test (void) { - int old_width, old_height, old_refreshrate, old_bpp, old_fullscreen; + int32_t old_width, old_height, old_refreshrate, old_bpp, old_fullscreen; if (vid_locked || !vid_changed) return; @@ -787,12 +787,12 @@ GL_MakeNiceExtensionsList -- johnfitz static char *GL_MakeNiceExtensionsList (const char *in) { char *copy, *token, *out; - int i, count; + int32_t i, count; if (!in) return Z_Strdup("(none)"); //each space will be replaced by 4 chars, so count the spaces before we malloc - for (i = 0, count = 1; i < (int) strlen(in); i++) + for (i = 0, count = 1; i < (int32_t) strlen(in); i++) { if (in[i] == ' ') count++; @@ -856,7 +856,7 @@ static bool GL_ParseExtensionList (const char *list, const char *name) static void GL_CheckExtensions (void) { - int swap_control; + int32_t swap_control; // ARB_vertex_buffer_object // @@ -897,7 +897,7 @@ static void GL_CheckExtensions (void) gl_mtexable = true; glGetIntegerv(GL_MAX_TEXTURE_UNITS, &gl_max_texture_units); - Con_Printf("GL_MAX_TEXTURE_UNITS: %d\n", (int)gl_max_texture_units); + Con_Printf("GL_MAX_TEXTURE_UNITS: %d\n", (int32_t)gl_max_texture_units); } else { @@ -1202,7 +1202,7 @@ static void GL_Init (void) GL_BeginRendering -- sets values of glx, gly, glwidth, glheight ================= */ -void GL_BeginRendering (int *x, int *y, int *width, int *height) +void GL_BeginRendering (int32_t *x, int32_t *y, int32_t *width, int32_t *height) { *x = *y = 0; *width = vid.width; @@ -1285,8 +1285,8 @@ VID_DescribeModes_f -- johnfitz -- changed formatting, and added refresh rates a */ static void VID_DescribeModes_f (void) { - int i; - int lastwidth, lastheight, lastbpp, count; + int32_t i; + int32_t lastwidth, lastheight, lastbpp, count; lastwidth = lastheight = lastbpp = count = 0; @@ -1315,7 +1315,7 @@ static void VID_FSAA_f (cvar_t *var) { // don't print the warning if vid_fsaa is set during startup if (vid_initialized) - Con_Printf("%s %d requires engine restart to take effect\n", var->name, (int)var->value); + Con_Printf("%s %d requires engine restart to take effect\n", var->name, (int32_t)var->value); } //========================================================================== @@ -1331,8 +1331,8 @@ VID_InitModelist */ static void VID_InitModelist (void) { - const int sdlmodes = SDL_GetNumDisplayModes(0); - int i; + const int32_t sdlmodes = SDL_GetNumDisplayModes(0); + int32_t i; nummodes = 0; for (i = 0; i < sdlmodes; i++) @@ -1360,8 +1360,8 @@ VID_Init void VID_Init (void) { static char vid_center[] = "SDL_VIDEO_CENTERED=center"; - int p, width, height, refreshrate, bpp; - int display_width, display_height, display_refreshrate, display_bpp; + int32_t p, width, height, refreshrate, bpp; + int32_t display_width, display_height, display_refreshrate, display_bpp; bool fullscreen; const char *read_vars[] = { "vid_fullscreen", "vid_width", @@ -1426,12 +1426,12 @@ void VID_Init (void) VID_InitModelist(); - width = (int)vid_width.value; - height = (int)vid_height.value; - refreshrate = (int)vid_refreshrate.value; - bpp = (int)vid_bpp.value; - fullscreen = (int)vid_fullscreen.value; - fsaa = (int)vid_fsaa.value; + width = (int32_t)vid_width.value; + height = (int32_t)vid_height.value; + refreshrate = (int32_t)vid_refreshrate.value; + bpp = (int32_t)vid_bpp.value; + fullscreen = (int32_t)vid_fullscreen.value; + fsaa = (int32_t)vid_fsaa.value; if (COM_CheckParm("-current")) { @@ -1481,11 +1481,11 @@ void VID_Init (void) if (!VID_ValidMode(width, height, refreshrate, bpp, fullscreen)) { - width = (int)vid_width.value; - height = (int)vid_height.value; - refreshrate = (int)vid_refreshrate.value; - bpp = (int)vid_bpp.value; - fullscreen = (int)vid_fullscreen.value; + width = (int32_t)vid_width.value; + height = (int32_t)vid_height.value; + refreshrate = (int32_t)vid_refreshrate.value; + bpp = (int32_t)vid_bpp.value; + fullscreen = (int32_t)vid_fullscreen.value; } if (!VID_ValidMode(width, height, refreshrate, bpp, fullscreen)) @@ -1502,7 +1502,7 @@ void VID_Init (void) vid.maxwarpwidth = WARP_WIDTH; vid.maxwarpheight = WARP_HEIGHT; vid.colormap = host_colormap; - vid.fullbright = 256 - LittleLong (*((int *)vid.colormap + 2048)); + vid.fullbright = 256 - LittleLong (*((int32_t *)vid.colormap + 2048)); // set window icon PL_SetWindowIcon(); @@ -1631,21 +1631,21 @@ enum { VIDEO_OPTIONS_ITEMS }; -static int video_options_cursor = 0; +static int32_t video_options_cursor = 0; typedef struct { - int width,height; + int32_t width,height; } vid_menu_mode; //TODO: replace these fixed-length arrays with hunk_allocated buffers static vid_menu_mode vid_menu_modes[MAX_MODE_LIST]; -static int vid_menu_nummodes = 0; +static int32_t vid_menu_nummodes = 0; -static int vid_menu_bpps[MAX_BPPS_LIST]; -static int vid_menu_numbpps = 0; +static int32_t vid_menu_bpps[MAX_BPPS_LIST]; +static int32_t vid_menu_numbpps = 0; -static int vid_menu_rates[MAX_RATES_LIST]; -static int vid_menu_numrates=0; +static int32_t vid_menu_rates[MAX_RATES_LIST]; +static int32_t vid_menu_numrates=0; /* ================ @@ -1654,7 +1654,7 @@ VID_Menu_Init */ static void VID_Menu_Init (void) { - int i, j, h, w; + int32_t i, j, h, w; for (i = 0; i < nummodes; i++) { @@ -1686,7 +1686,7 @@ regenerates bpp list based on current vid_width and vid_height */ static void VID_Menu_RebuildBppList (void) { - int i, j, b; + int32_t i, j, b; vid_menu_numbpps = 0; @@ -1724,7 +1724,7 @@ static void VID_Menu_RebuildBppList (void) //if vid_bpp is not in the new list, change vid_bpp for (i = 0; i < vid_menu_numbpps; i++) - if (vid_menu_bpps[i] == (int)(vid_bpp.value)) + if (vid_menu_bpps[i] == (int32_t)(vid_bpp.value)) break; if (i == vid_menu_numbpps) @@ -1740,7 +1740,7 @@ regenerates rate list based on current vid_width, vid_height and vid_bpp */ static void VID_Menu_RebuildRateList (void) { - int i,j,r; + int32_t i,j,r; vid_menu_numrates=0; @@ -1776,7 +1776,7 @@ static void VID_Menu_RebuildRateList (void) //if vid_refreshrate is not in the new list, change vid_refreshrate for (i=0;i 48) { @@ -220,7 +220,7 @@ R_UpdateWarpTextures -- johnfitz -- each frame, update warping textures void R_UpdateWarpTextures (void) { texture_t *tx; - int i; + int32_t i; float x, y, x2, warptess; if (r_oldwater.value || cl.paused || r_drawflat_cheatsafe || r_lightmap_cheatsafe) diff --git a/source/glquake.h b/source/glquake.h index f3324e8..0e9eec5 100644 --- a/source/glquake.h +++ b/source/glquake.h @@ -24,11 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __GLQUAKE_H #define __GLQUAKE_H -void GL_BeginRendering (int *x, int *y, int *width, int *height); +void GL_BeginRendering (int32_t *x, int32_t *y, int32_t *width, int32_t *height); void GL_EndRendering (void); void GL_Set2D (void); -extern int glx, gly, glwidth, glheight; +extern int32_t glx, gly, glwidth, glheight; #define GL_UNUSED_TEXTURE (~(GLuint)0) @@ -50,7 +50,7 @@ extern int glx, gly, glwidth, glheight; void R_TimeRefresh_f (void); void R_ReadPointFile_f (void); -texture_t *R_TextureAnimation (texture_t *base, int frame); +texture_t *R_TextureAnimation (texture_t *base, int32_t frame); typedef enum { pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2 @@ -76,8 +76,8 @@ typedef struct particle_s extern bool r_cache_thrash; // compatability extern vec3_t modelorg, r_entorigin; extern entity_t *currententity; -extern int r_visframecount; // ??? what difs? -extern int r_framecount; +extern int32_t r_visframecount; // ??? what difs? +extern int32_t r_framecount; extern mplane_t frustum[4]; // @@ -93,7 +93,7 @@ extern vec3_t r_origin; // extern refdef_t r_refdef; extern mleaf_t *r_viewleaf, *r_oldviewleaf; -extern int d_lightstylevalue[256]; // 8.8 fraction of base light value +extern int32_t d_lightstylevalue[256]; // 8.8 fraction of base light value extern cvar_t r_norefresh; extern cvar_t r_drawentities; @@ -126,7 +126,7 @@ extern cvar_t gl_playermip; extern cvar_t gl_subdivide_size; extern float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded -extern int gl_stencilbits; +extern int32_t gl_stencilbits; // Multitexture extern bool mtexenabled; @@ -215,7 +215,7 @@ extern bool gl_texture_NPOT; #define OFFSET_DECAL -1 #define OFFSET_FOG -2 #define OFFSET_SHOWTRIS -3 -void GL_PolygonOffset (int); +void GL_PolygonOffset (int32_t); //johnfitz -- GL_EXT_texture_env_combine //the values for GL_ARB_ are identical @@ -234,20 +234,20 @@ extern bool gl_texture_env_combine; extern bool gl_texture_env_add; // for GL_EXT_texture_env_add //johnfitz -- rendering statistics -extern int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys; -extern int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses; +extern int32_t rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys; +extern int32_t rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses; extern float rs_megatexels; //johnfitz -- track developer statistics that vary every frame extern cvar_t devstats; typedef struct { - int packetsize; - int edicts; - int visedicts; - int efrags; - int tempents; - int beams; - int dlights; + int32_t packetsize; + int32_t edicts; + int32_t visedicts; + int32_t efrags; + int32_t tempents; + int32_t beams; + int32_t dlights; } devstats_t; extern devstats_t dev_stats, dev_peakstats; @@ -262,11 +262,11 @@ extern overflowtimes_t dev_overflows; //this stores the last time overflow messa #define CONSOLE_RESPAM_TIME 3 // seconds between repeated warning messages //johnfitz -- moved here from r_brush.c -extern int gl_lightmap_format, lightmap_bytes; +extern int32_t gl_lightmap_format, lightmap_bytes; #define MAX_LIGHTMAPS 512 //johnfitz -- was 64 extern gltexture_t *lightmap_textures[MAX_LIGHTMAPS]; //johnfitz -- changed to an array -extern int gl_warpimagesize; //johnfitz -- for water warp +extern int32_t gl_warpimagesize; //johnfitz -- for water warp extern bool r_drawflat_cheatsafe, r_fullbright_cheatsafe, r_lightmap_cheatsafe, r_drawworld_cheatsafe; //johnfitz @@ -299,15 +299,15 @@ bool R_CullBox (vec3_t emins, vec3_t emaxs); void R_StoreEfrags (efrag_t **ppefrag); bool R_CullModelForEntity (entity_t *e); void R_RotateForEntity (vec3_t origin, vec3_t angles); -void R_MarkLights (dlight_t *light, int num, mnode_t *node); +void R_MarkLights (dlight_t *light, int32_t num, mnode_t *node); void R_InitParticles (void); void R_DrawParticles (void); void CL_RunParticles (void); void R_ClearParticles (void); -void R_TranslatePlayerSkin (int playernum); -void R_TranslateNewPlayerSkin (int playernum); //johnfitz -- this handles cases when the actual texture changes +void R_TranslatePlayerSkin (int32_t playernum); +void R_TranslateNewPlayerSkin (int32_t playernum); //johnfitz -- this handles cases when the actual texture changes void R_UpdateWarpTextures (void); void R_DrawWorld (void); @@ -325,10 +325,10 @@ void GLMesh_LoadVertexBuffers (void); void GLMesh_DeleteVertexBuffers (void); void R_RebuildAllLightmaps (void); -int R_LightPoint (vec3_t p); +int32_t R_LightPoint (vec3_t p); void GL_SubdivideSurface (msurface_t *fa); -void R_BuildLightMap (msurface_t *surf, byte *dest, int stride); +void R_BuildLightMap (msurface_t *surf, byte *dest, int32_t stride); void R_RenderDynamicLightmaps (msurface_t *fa); void R_UploadLightmaps (void); @@ -338,7 +338,7 @@ void R_DrawAliasModel_ShowTris (entity_t *e); void R_DrawParticles_ShowTris (void); GLint GL_GetUniformLocation (GLuint *programPtr, const char *name); -GLuint GL_CreateProgram (const GLchar *vertSource, const GLchar *fragSource, int numbindings, const glsl_attrib_binding_t *bindings); +GLuint GL_CreateProgram (const GLchar *vertSource, const GLchar *fragSource, int32_t numbindings, const glsl_attrib_binding_t *bindings); void R_DeleteShaders (void); void GLWorld_CreateShaders (void); diff --git a/source/host.c b/source/host.c index 7b38cd0..4d20a54 100644 --- a/source/host.c +++ b/source/host.c @@ -45,9 +45,9 @@ double host_frametime; double realtime; // without any filtering or bounding double oldrealtime; // last frame run -int host_framecount; +int32_t host_framecount; -int host_hunklevel; +int32_t host_hunklevel; client_t *host_client; // current client @@ -183,7 +183,7 @@ Host_FindMaxClients */ void Host_FindMaxClients (void) { - int i; + int32_t i; svs.maxclients = 1; @@ -357,7 +357,7 @@ void SV_BroadcastPrintf (const char *fmt, ...) { va_list argptr; char string[1024]; - int i; + int32_t i; va_start (argptr,fmt); q_vsnprintf (string, sizeof(string), fmt, argptr); @@ -403,8 +403,8 @@ if (crash = true), don't bother sending signofs */ void SV_DropClient (bool crash) { - int saveSelf; - int i; + int32_t saveSelf; + int32_t i; client_t *client; if (!crash) @@ -465,8 +465,8 @@ This only happens at the end of a game, not between levels */ void Host_ShutdownServer(bool crash) { - int i; - int count; + int32_t i; + int32_t count; sizebuf_t buf; byte message[4]; double start; @@ -619,7 +619,7 @@ Host_ServerFrame */ void Host_ServerFrame (void) { - int i, active; //johnfitz + int32_t i, active; //johnfitz edict_t *ent; //johnfitz // run the world state @@ -671,7 +671,7 @@ void _Host_Frame (float time) static double time1 = 0; static double time2 = 0; static double time3 = 0; - int pass1, pass2, pass3; + int32_t pass1, pass2, pass3; if (setjmp (host_abortserver) ) return; // something bad happened, or the server disconnected @@ -766,8 +766,8 @@ void Host_Frame (float time) { double time1, time2; static double timetotal; - static int timecount; - int i, c, m; + static int32_t timecount; + int32_t i, c, m; if (!serverprofile.value) { @@ -805,7 +805,7 @@ Host_Init */ void Host_Init (void) { - int minimum_memory; + int32_t minimum_memory; if (standard_quake) minimum_memory = MINIMUM_MEMORY; diff --git a/source/host_cmd.c b/source/host_cmd.c index 97a8f2c..518aba9 100644 --- a/source/host_cmd.c +++ b/source/host_cmd.c @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern cvar_t pausable; -int current_skill; +int32_t current_skill; void Mod_Print (void); @@ -128,7 +128,7 @@ void ExtraMaps_Init (void) char ignorepakdir[32]; searchpath_t *search; pack_t *pak; - int i; + int32_t i; // we don't want to list the maps in id1 pakfiles, // because these are not "add-on" levels @@ -202,7 +202,7 @@ Host_Maps_f */ void Host_Maps_f (void) { - int i; + int32_t i; filelist_item_t *level; for (level = extralevels, i = 0; level; level = level->next, i++) @@ -315,7 +315,7 @@ void DemoList_Init (void) char ignorepakdir[32]; searchpath_t *search; pack_t *pak; - int i; + int32_t i; // we don't want to list the demos in id1 pakfiles, // because these are not "add-on" demos @@ -378,7 +378,7 @@ list all potential mod directories (contain either a pak file or a progs.dat) */ void Host_Mods_f (void) { - int i; + int32_t i; filelist_item_t *mod; for (mod = modlist, i=0; mod; mod = mod->next, i++) @@ -424,10 +424,10 @@ void Host_Status_f (void) void (*print_fn) (const char *fmt, ...) FUNCP_PRINTF(1,2); client_t *client; - int seconds; - int minutes; - int hours = 0; - int j; + int32_t seconds; + int32_t minutes; + int32_t hours = 0; + int32_t j; if (cmd_source == src_command) { @@ -453,7 +453,7 @@ void Host_Status_f (void) { if (!client->active) continue; - seconds = (int)(net_time - NET_QSocketGetTime(client->netconnection)); + seconds = (int32_t)(net_time - NET_QSocketGetTime(client->netconnection)); minutes = seconds / 60; if (minutes) { @@ -464,7 +464,7 @@ void Host_Status_f (void) } else hours = 0; - print_fn ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j+1, client->name, (int)client->edict->v.frags, hours, minutes, seconds); + print_fn ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j+1, client->name, (int32_t)client->edict->v.frags, hours, minutes, seconds); print_fn (" %s\n", NET_QSocketGetAddressString(client->netconnection)); } } @@ -491,8 +491,8 @@ void Host_God_f (void) switch (Cmd_Argc()) { case 1: - sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE; - if (!((int)sv_player->v.flags & FL_GODMODE) ) + sv_player->v.flags = (int32_t)sv_player->v.flags ^ FL_GODMODE; + if (!((int32_t)sv_player->v.flags & FL_GODMODE) ) SV_ClientPrintf ("godmode OFF\n"); else SV_ClientPrintf ("godmode ON\n"); @@ -500,12 +500,12 @@ void Host_God_f (void) case 2: if (Q_atof(Cmd_Argv(1))) { - sv_player->v.flags = (int)sv_player->v.flags | FL_GODMODE; + sv_player->v.flags = (int32_t)sv_player->v.flags | FL_GODMODE; SV_ClientPrintf ("godmode ON\n"); } else { - sv_player->v.flags = (int)sv_player->v.flags & ~FL_GODMODE; + sv_player->v.flags = (int32_t)sv_player->v.flags & ~FL_GODMODE; SV_ClientPrintf ("godmode OFF\n"); } break; @@ -536,8 +536,8 @@ void Host_Notarget_f (void) switch (Cmd_Argc()) { case 1: - sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET; - if (!((int)sv_player->v.flags & FL_NOTARGET) ) + sv_player->v.flags = (int32_t)sv_player->v.flags ^ FL_NOTARGET; + if (!((int32_t)sv_player->v.flags & FL_NOTARGET) ) SV_ClientPrintf ("notarget OFF\n"); else SV_ClientPrintf ("notarget ON\n"); @@ -545,12 +545,12 @@ void Host_Notarget_f (void) case 2: if (Q_atof(Cmd_Argv(1))) { - sv_player->v.flags = (int)sv_player->v.flags | FL_NOTARGET; + sv_player->v.flags = (int32_t)sv_player->v.flags | FL_NOTARGET; SV_ClientPrintf ("notarget ON\n"); } else { - sv_player->v.flags = (int)sv_player->v.flags & ~FL_NOTARGET; + sv_player->v.flags = (int32_t)sv_player->v.flags & ~FL_NOTARGET; SV_ClientPrintf ("notarget OFF\n"); } break; @@ -642,12 +642,12 @@ void Host_SetPos_f(void) SV_ClientPrintf(" setpos \n"); SV_ClientPrintf("current values:\n"); SV_ClientPrintf(" %i %i %i %i %i %i\n", - (int)sv_player->v.origin[0], - (int)sv_player->v.origin[1], - (int)sv_player->v.origin[2], - (int)sv_player->v.v_angle[0], - (int)sv_player->v.v_angle[1], - (int)sv_player->v.v_angle[2]); + (int32_t)sv_player->v.origin[0], + (int32_t)sv_player->v.origin[1], + (int32_t)sv_player->v.origin[2], + (int32_t)sv_player->v.v_angle[0], + (int32_t)sv_player->v.v_angle[1], + (int32_t)sv_player->v.v_angle[2]); return; } @@ -739,7 +739,7 @@ Host_Ping_f */ void Host_Ping_f (void) { - int i, j; + int32_t i, j; float total; client_t *client; @@ -758,7 +758,7 @@ void Host_Ping_f (void) for (j = 0; j < NUM_PING_TIMES; j++) total+=client->ping_times[j]; total /= NUM_PING_TIMES; - SV_ClientPrintf ("%4i %s\n", (int)(total*1000), client->name); + SV_ClientPrintf ("%4i %s\n", (int32_t)(total*1000), client->name); } } @@ -782,7 +782,7 @@ command from the console. Active clients are kicked off. */ void Host_Map_f (void) { - int i; + int32_t i; char name[MAX_QPATH], *p; if (Cmd_Argc() < 2) //no map name given @@ -850,7 +850,7 @@ Loads a random map from the "maps" list. */ void Host_Randmap_f (void) { - int i, randlevel, numlevels; + int32_t i, randlevel, numlevels; filelist_item_t *level; if (cmd_source != src_command) @@ -998,7 +998,7 @@ Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current */ void Host_SavegameComment (char *text) { - int i; + int32_t i; char kills[20]; for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++) @@ -1025,7 +1025,7 @@ void Host_Savegame_f (void) { char name[MAX_OSPATH]; FILE *f; - int i; + int32_t i; char comment[SAVEGAME_COMMENT_LENGTH+1]; if (cmd_source != src_command) @@ -1125,10 +1125,10 @@ void Host_Loadgame_f (void) char mapname[MAX_QPATH]; float time, tfloat; const char *data; - int i; + int32_t i; edict_t *ent; - int entnum; - int version; + int32_t entnum; + int32_t version; float spawn_parms[NUM_SPAWN_PARMS]; if (cmd_source != src_command) @@ -1182,7 +1182,7 @@ void Host_Loadgame_f (void) data = COM_ParseFloatNewline (data, &spawn_parms[i]); // this silliness is so we can load 1.06 save files, which have float skill values data = COM_ParseFloatNewline(data, &tfloat); - current_skill = (int)(tfloat + 0.1); + current_skill = (int32_t)(tfloat + 0.1); Cvar_SetValue ("skill", (float)current_skill); data = COM_ParseStringNewline (data); @@ -1312,7 +1312,7 @@ void Host_Name_f (void) void Host_Say(bool teamonly) { - int j; + int32_t j; client_t *client; client_t *save; const char *p; @@ -1351,8 +1351,8 @@ void Host_Say(bool teamonly) q_snprintf (text, sizeof(text), "\001<%s> %s", hostname.string, p); // check length & truncate if necessary - j = (int) strlen(text); - if (j >= (int) sizeof(text) - 1) + j = (int32_t) strlen(text); + if (j >= (int32_t) sizeof(text) - 1) { text[sizeof(text) - 2] = '\n'; text[sizeof(text) - 1] = '\0'; @@ -1402,7 +1402,7 @@ void Host_Say_Team_f(void) void Host_Tell_f(void) { - int j; + int32_t j; client_t *client; client_t *save; const char *p; @@ -1429,8 +1429,8 @@ void Host_Tell_f(void) q_snprintf (text, sizeof(text), "%s: %s", host_client->name, p); // check length & truncate if necessary - j = (int) strlen(text); - if (j >= (int) sizeof(text) - 1) + j = (int32_t) strlen(text); + if (j >= (int32_t) sizeof(text) - 1) { text[sizeof(text) - 2] = '\n'; text[sizeof(text) - 1] = '\0'; @@ -1472,12 +1472,12 @@ Host_Color_f */ void Host_Color_f(void) { - int top, bottom; - int playercolor; + int32_t top, bottom; + int32_t playercolor; if (Cmd_Argc() == 1) { - Con_Printf ("\"color\" is \"%i %i\"\n", ((int)cl_color.value) >> 4, ((int)cl_color.value) & 0x0f); + Con_Printf ("\"color\" is \"%i %i\"\n", ((int32_t)cl_color.value) >> 4, ((int32_t)cl_color.value) & 0x0f); Con_Printf ("color <0-13> [0-13]\n"); return; } @@ -1617,7 +1617,7 @@ Host_Spawn_f */ void Host_Spawn_f (void) { - int i; + int32_t i; client_t *client; edict_t *ent; @@ -1761,7 +1761,7 @@ void Host_Kick_f (void) const char *who; const char *message = NULL; client_t *save; - int i; + int32_t i; bool byNumber = false; if (cmd_source == src_command) @@ -1851,7 +1851,7 @@ Host_Give_f void Host_Give_f (void) { const char *t; - int v; + int32_t v; eval_t *val; if (cmd_source == src_command) @@ -1884,21 +1884,21 @@ void Host_Give_f (void) if (t[0] == '6') { if (t[1] == 'a') - sv_player->v.items = (int)sv_player->v.items | HIT_PROXIMITY_GUN; + sv_player->v.items = (int32_t)sv_player->v.items | HIT_PROXIMITY_GUN; else - sv_player->v.items = (int)sv_player->v.items | IT_GRENADE_LAUNCHER; + sv_player->v.items = (int32_t)sv_player->v.items | IT_GRENADE_LAUNCHER; } else if (t[0] == '9') - sv_player->v.items = (int)sv_player->v.items | HIT_LASER_CANNON; + sv_player->v.items = (int32_t)sv_player->v.items | HIT_LASER_CANNON; else if (t[0] == '0') - sv_player->v.items = (int)sv_player->v.items | HIT_MJOLNIR; + sv_player->v.items = (int32_t)sv_player->v.items | HIT_MJOLNIR; else if (t[0] >= '2') - sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2')); + sv_player->v.items = (int32_t)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2')); } else { if (t[0] >= '2') - sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2')); + sv_player->v.items = (int32_t)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2')); } break; @@ -2013,7 +2013,7 @@ void Host_Give_f (void) sv_player->v.armortype = 0.8; sv_player->v.armorvalue = v; sv_player->v.items = sv_player->v.items - - ((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + + ((int32_t)(sv_player->v.items) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + IT_ARMOR3; } else if (v > 100) @@ -2021,7 +2021,7 @@ void Host_Give_f (void) sv_player->v.armortype = 0.6; sv_player->v.armorvalue = v; sv_player->v.items = sv_player->v.items - - ((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + + ((int32_t)(sv_player->v.items) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + IT_ARMOR2; } else if (v >= 0) @@ -2029,7 +2029,7 @@ void Host_Give_f (void) sv_player->v.armortype = 0.3; sv_player->v.armorvalue = v; sv_player->v.items = sv_player->v.items - - ((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + + ((int32_t)(sv_player->v.items) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + IT_ARMOR1; } break; @@ -2037,7 +2037,7 @@ void Host_Give_f (void) } //johnfitz -- update currentammo to match new ammo (so statusbar updates correctly) - switch ((int)(sv_player->v.weapon)) + switch ((int32_t)(sv_player->v.weapon)) { case IT_SHOTGUN: case IT_SUPER_SHOTGUN: @@ -2075,7 +2075,7 @@ void Host_Give_f (void) edict_t *FindViewthing (void) { - int i; + int32_t i; edict_t *e; for (i=0 ; iv.frame = 0; - cl.model_precache[(int)e->v.modelindex] = m; + cl.model_precache[(int32_t)e->v.modelindex] = m; } /* @@ -2121,13 +2121,13 @@ Host_Viewframe_f void Host_Viewframe_f (void) { edict_t *e; - int f; + int32_t f; qmodel_t *m; e = FindViewthing (); if (!e) return; - m = cl.model_precache[(int)e->v.modelindex]; + m = cl.model_precache[(int32_t)e->v.modelindex]; f = atoi(Cmd_Argv(1)); if (f >= m->numframes) @@ -2137,7 +2137,7 @@ void Host_Viewframe_f (void) } -void PrintFrameName (qmodel_t *m, int frame) +void PrintFrameName (qmodel_t *m, int32_t frame) { aliashdr_t *hdr; maliasframedesc_t *pframedesc; @@ -2163,7 +2163,7 @@ void Host_Viewnext_f (void) e = FindViewthing (); if (!e) return; - m = cl.model_precache[(int)e->v.modelindex]; + m = cl.model_precache[(int32_t)e->v.modelindex]; e->v.frame = e->v.frame + 1; if (e->v.frame >= m->numframes) @@ -2186,7 +2186,7 @@ void Host_Viewprev_f (void) if (!e) return; - m = cl.model_precache[(int)e->v.modelindex]; + m = cl.model_precache[(int32_t)e->v.modelindex]; e->v.frame = e->v.frame - 1; if (e->v.frame < 0) @@ -2211,7 +2211,7 @@ Host_Startdemos_f */ void Host_Startdemos_f (void) { - int i, c; + int32_t i, c; if (cls.state == ca_dedicated) return; diff --git a/source/image.c b/source/image.c index d41741c..ddb75d5 100644 --- a/source/image.c +++ b/source/image.c @@ -39,8 +39,8 @@ static char loadfilename[MAX_OSPATH]; //file scope so that error messages can us typedef struct stdio_buffer_s { FILE *f; uint8_t buffer[1024]; - int size; - int pos; + int32_t size; + int32_t pos; } stdio_buffer_t; static stdio_buffer_t *Buf_Alloc(FILE *f) @@ -55,7 +55,7 @@ static void Buf_Free(stdio_buffer_t *buf) free(buf); } -static inline int Buf_GetC(stdio_buffer_t *buf) +static inline int32_t Buf_GetC(stdio_buffer_t *buf) { if (buf->pos >= buf->size) { @@ -78,7 +78,7 @@ returns a pointer to hunk allocated RGBA data TODO: search order: tga png jpg pcx lmp ============ */ -byte *Image_LoadImage (const char *name, int *width, int *height) +byte *Image_LoadImage (const char *name, int32_t *width, int32_t *height) { FILE *f; @@ -113,7 +113,7 @@ typedef struct targaheader_s { targaheader_t targa_header; -int fgetLittleShort (FILE *f) +int32_t fgetLittleShort (FILE *f) { byte b1, b2; @@ -123,7 +123,7 @@ int fgetLittleShort (FILE *f) return (int16_t)(b1 + b2*256); } -int fgetLittleLong (FILE *f) +int32_t fgetLittleLong (FILE *f) { byte b1, b2, b3, b4; @@ -144,9 +144,9 @@ returns true if successful TODO: support BGRA and BGR formats (since opengl can return them, and we don't have to swap) ============ */ -bool Image_WriteTGA (const char *name, byte *data, int width, int height, int bpp, bool upsidedown) +bool Image_WriteTGA (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, bool upsidedown) { - int handle, i, size, temp, bytes; + int32_t handle, i, size, temp, bytes; char pathname[MAX_OSPATH]; byte header[TARGAHEADERSIZE]; @@ -188,13 +188,13 @@ bool Image_WriteTGA (const char *name, byte *data, int width, int height, int bp Image_LoadTGA ============= */ -byte *Image_LoadTGA (FILE *fin, int *width, int *height) +byte *Image_LoadTGA (FILE *fin, int32_t *width, int32_t *height) { - int columns, rows, numPixels; + int32_t columns, rows, numPixels; byte *pixbuf; - int row, column; + int32_t row, column; byte *targa_rgba; - int realrow; //johnfitz -- fix for upside-down targas + int32_t realrow; //johnfitz -- fix for upside-down targas bool upside_down; //johnfitz -- fix for upside-down targas stdio_buffer_t *buf; @@ -371,8 +371,8 @@ byte *Image_LoadTGA (FILE *fin, int *width, int *height) Buf_Free(buf); fclose(fin); - *width = (int)(targa_header.width); - *height = (int)(targa_header.height); + *width = (int32_t)(targa_header.width); + *height = (int32_t)(targa_header.height); return targa_rgba; } @@ -403,10 +403,10 @@ typedef struct Image_LoadPCX ============ */ -byte *Image_LoadPCX (FILE *f, int *width, int *height) +byte *Image_LoadPCX (FILE *f, int32_t *width, int32_t *height) { pcxheader_t pcx; - int x, y, w, h, readbyte, runlength, start; + int32_t x, y, w, h, readbyte, runlength, start; byte *p, *data; byte palette[768]; stdio_buffer_t *buf; @@ -485,9 +485,9 @@ byte *Image_LoadPCX (FILE *f, int *width, int *height) // //============================================================================== -static byte *CopyFlipped(const byte *data, int width, int height, int bpp) +static byte *CopyFlipped(const byte *data, int32_t width, int32_t height, int32_t bpp) { - int y, rowsize; + int32_t y, rowsize; byte *flipped; rowsize = width * (bpp / 8); @@ -509,12 +509,12 @@ Image_WriteJPG -- writes using stb_image_write returns true if successful ============ */ -bool Image_WriteJPG (const char *name, byte *data, int width, int height, int bpp, int quality, bool upsidedown) +bool Image_WriteJPG (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, int32_t quality, bool upsidedown) { unsigned error; char pathname[MAX_OSPATH]; byte *flipped; - int bytes_per_pixel; + int32_t bytes_per_pixel; if (!(bpp == 32 || bpp == 24)) Sys_Error ("bpp not 24 or 32"); @@ -540,7 +540,7 @@ bool Image_WriteJPG (const char *name, byte *data, int width, int height, int bp return (error != 0); } -bool Image_WritePNG (const char *name, byte *data, int width, int height, int bpp, bool upsidedown) +bool Image_WritePNG (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, bool upsidedown) { unsigned error; char pathname[MAX_OSPATH]; diff --git a/source/image.h b/source/image.h index 2899607..9529c4a 100644 --- a/source/image.h +++ b/source/image.h @@ -26,13 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //image.h -- image reading / writing //be sure to free the hunk after using these loading functions -byte *Image_LoadTGA (FILE *f, int *width, int *height); -byte *Image_LoadPCX (FILE *f, int *width, int *height); -byte *Image_LoadImage (const char *name, int *width, int *height); +byte *Image_LoadTGA (FILE *f, int32_t *width, int32_t *height); +byte *Image_LoadPCX (FILE *f, int32_t *width, int32_t *height); +byte *Image_LoadImage (const char *name, int32_t *width, int32_t *height); -bool Image_WriteTGA (const char *name, byte *data, int width, int height, int bpp, bool upsidedown); -bool Image_WritePNG (const char *name, byte *data, int width, int height, int bpp, bool upsidedown); -bool Image_WriteJPG (const char *name, byte *data, int width, int height, int bpp, int quality, bool upsidedown); +bool Image_WriteTGA (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, bool upsidedown); +bool Image_WritePNG (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, bool upsidedown); +bool Image_WriteJPG (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, int32_t quality, bool upsidedown); #endif /* GL_IMAGE_H */ diff --git a/source/in_sdl.c b/source/in_sdl.c index a7fbfb9..e4d663c 100644 --- a/source/in_sdl.c +++ b/source/in_sdl.c @@ -56,7 +56,7 @@ static SDL_GameController *joy_active_controller = NULL; static bool no_mouse = false; -static int buttonremap[] = +static int32_t buttonremap[] = { K_MOUSE1, K_MOUSE3, /* right button */ @@ -66,9 +66,9 @@ static int buttonremap[] = }; /* total accumulated mouse movement since last frame */ -static int total_dx, total_dy = 0; +static int32_t total_dx, total_dy = 0; -static int SDLCALL IN_FilterMouseEvents (const SDL_Event *event) +static int32_t SDLCALL IN_FilterMouseEvents (const SDL_Event *event) { switch (event->type) { @@ -81,7 +81,7 @@ static int SDLCALL IN_FilterMouseEvents (const SDL_Event *event) return 1; } -static int SDLCALL IN_SDL2_FilterMouseEvents (void *userdata, SDL_Event *event) +static int32_t SDLCALL IN_SDL2_FilterMouseEvents (void *userdata, SDL_Event *event) { (void)userdata; return IN_FilterMouseEvents (event); @@ -218,8 +218,8 @@ void IN_Deactivate (bool free_cursor) void IN_StartupJoystick (void) { - int i; - int nummappings; + int32_t i; + int32_t nummappings; char controllerdb[MAX_OSPATH]; SDL_GameController *gamecontroller; @@ -322,7 +322,7 @@ extern cvar_t cl_maxpitch; /* johnfitz -- variable pitch clamping */ extern cvar_t cl_minpitch; /* johnfitz -- variable pitch clamping */ -void IN_MouseMotion(int dx, int dy) +void IN_MouseMotion(int32_t dx, int32_t dy) { total_dx += dx; total_dy += dy; @@ -449,7 +449,7 @@ static joyaxis_t IN_ApplyDeadzone(joyaxis_t axis, float deadzone) IN_KeyForControllerButton ================ */ -static int IN_KeyForControllerButton(SDL_GameControllerButton button) +static int32_t IN_KeyForControllerButton(SDL_GameControllerButton button) { switch (button) { @@ -481,7 +481,7 @@ and generates key repeats if the button is held down. Adapted from DarkPlaces by lordhavoc ================ */ -static void IN_JoyKeyEvent(bool wasdown, bool isdown, int key, double *timer) +static void IN_JoyKeyEvent(bool wasdown, bool isdown, int32_t key, double *timer) { // we can't use `realtime` for key repeats because it is not monotomic const double currenttime = Sys_DoubleTime(); @@ -522,7 +522,7 @@ Emit key events for game controller buttons, including emulated buttons for anal void IN_Commands (void) { joyaxisstate_t newaxisstate; - int i; + int32_t i; const float stickthreshold = 0.9; const float triggerthreshold = joy_deadzone_trigger.value; @@ -627,7 +627,7 @@ void IN_JoyMove (usercmd_t *cmd) void IN_MouseMove(usercmd_t *cmd) { - int dmx, dmy; + int32_t dmx, dmy; dmx = total_dx * sensitivity.value; dmy = total_dy * sensitivity.value; @@ -695,7 +695,7 @@ void IN_UpdateInputMode (void) } } -static inline int IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode) +static inline int32_t IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode) { switch (scancode) { @@ -834,7 +834,7 @@ static void IN_DebugKeyEvent(SDL_Event *event) void IN_SendKeyEvents (void) { SDL_Event event; - int key; + int32_t key; bool down; while (SDL_PollEvent(&event)) diff --git a/source/input.h b/source/input.h index f32dc54..a5be65c 100644 --- a/source/input.h +++ b/source/input.h @@ -32,7 +32,7 @@ void IN_Commands (void); // oportunity for devices to stick commands on the script buffer // mouse moved by dx and dy pixels -void IN_MouseMotion(int dx, int dy); +void IN_MouseMotion(int32_t dx, int32_t dy); void IN_SendKeyEvents (void); diff --git a/source/keys.c b/source/keys.c index a34c41b..0f519e8 100644 --- a/source/keys.c +++ b/source/keys.c @@ -30,12 +30,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char key_lines[CMDLINES][MAXCMDLINE]; -int key_linepos; -int key_insert; //johnfitz -- insert key toggle (for editing) +int32_t key_linepos; +int32_t key_insert; //johnfitz -- insert key toggle (for editing) double key_blinktime; //johnfitz -- fudge cursor blinking to make it easier to spot in certain cases -int edit_line = 0; -int history_line = 0; +int32_t edit_line = 0; +int32_t history_line = 0; keydest_t key_dest; @@ -47,7 +47,7 @@ bool keydown[MAX_KEYS]; typedef struct { const char *name; - int keynum; + int32_t keynum; } keyname_t; keyname_t keynames[] = @@ -185,7 +185,7 @@ keyname_t keynames[] = static void PasteToConsole (void) { char *cbd, *p, *workline; - int mvlen, inslen; + int32_t mvlen, inslen; if (key_linepos == MAXCMDLINE - 1) return; @@ -204,14 +204,14 @@ static void PasteToConsole (void) p++; } - inslen = (int) (p - cbd); + inslen = (int32_t) (p - cbd); if (inslen + key_linepos > MAXCMDLINE - 1) inslen = MAXCMDLINE - 1 - key_linepos; if (inslen <= 0) goto done; workline = key_lines[edit_line]; workline += key_linepos; - mvlen = (int) strlen(workline); + mvlen = (int32_t) strlen(workline); if (mvlen + inslen + key_linepos > MAXCMDLINE - 1) { mvlen = MAXCMDLINE - 1 - key_linepos - inslen; @@ -236,12 +236,12 @@ Interactive line editing and console scrollback ==================== */ extern char *con_text, key_tabpartial[MAXCMDLINE]; -extern int con_current, con_linewidth, con_vislines; +extern int32_t con_current, con_linewidth, con_vislines; -void Key_Console (int key) +void Key_Console (int32_t key) { static char current[MAXCMDLINE] = ""; - int history_line_last; + int32_t history_line_last; size_t len; char *workline = key_lines[edit_line]; @@ -304,7 +304,7 @@ void Key_Console (int key) if (keydown[K_CTRL]) { //skip initial empty lines - int i, x; + int32_t i, x; char *line; for (i = con_current - con_totallines + 1; i <= con_current; i++) @@ -353,10 +353,10 @@ void Key_Console (int key) case K_RIGHTARROW: len = strlen(workline); - if ((int)len == key_linepos) + if ((int32_t)len == key_linepos) { len = strlen(key_lines[(edit_line + 31) & 31]); - if ((int)len <= key_linepos) + if ((int32_t)len <= key_linepos) return; // no character to get workline += key_linepos; *workline = key_lines[(edit_line + 31) & 31][key_linepos]; @@ -442,7 +442,7 @@ void Key_Console (int key) } } -void Char_Console (int key) +void Char_Console (int32_t key) { size_t len; char *workline = key_lines[edit_line]; @@ -477,14 +477,14 @@ void Char_Console (int key) bool chat_team = false; static char chat_buffer[MAXCMDLINE]; -static int chat_bufferlen = 0; +static int32_t chat_bufferlen = 0; const char *Key_GetChatBuffer (void) { return chat_buffer; } -int Key_GetChatMsgLen (void) +int32_t Key_GetChatMsgLen (void) { return chat_bufferlen; } @@ -496,7 +496,7 @@ void Key_EndChat (void) chat_buffer[0] = 0; } -void Key_Message (int key) +void Key_Message (int32_t key) { switch (key) { @@ -523,7 +523,7 @@ void Key_Message (int key) } } -void Char_Message (int key) +void Char_Message (int32_t key) { if (chat_bufferlen == sizeof(chat_buffer) - 1) return; // all full @@ -544,7 +544,7 @@ the given string. Single ascii characters return themselves, while the K_* names are matched up. =================== */ -int Key_StringToKeynum (const char *str) +int32_t Key_StringToKeynum (const char *str) { keyname_t *kn; @@ -570,7 +570,7 @@ given keynum. FIXME: handle quote special (general escape sequence?) =================== */ -const char *Key_KeynumToString (int keynum) +const char *Key_KeynumToString (int32_t keynum) { static char tinystr[2]; keyname_t *kn; @@ -599,7 +599,7 @@ const char *Key_KeynumToString (int keynum) Key_SetBinding =================== */ -void Key_SetBinding (int keynum, const char *binding) +void Key_SetBinding (int32_t keynum, const char *binding) { if (keynum == -1) return; @@ -623,7 +623,7 @@ Key_Unbind_f */ void Key_Unbind_f (void) { - int b; + int32_t b; if (Cmd_Argc() != 2) { @@ -643,7 +643,7 @@ void Key_Unbind_f (void) void Key_Unbindall_f (void) { - int i; + int32_t i; for (i = 0; i < MAX_KEYS; i++) { @@ -659,7 +659,7 @@ Key_Bindlist_f -- johnfitz */ void Key_Bindlist_f (void) { - int i, count; + int32_t i, count; count = 0; for (i = 0; i < MAX_KEYS; i++) @@ -680,7 +680,7 @@ Key_Bind_f */ void Key_Bind_f (void) { - int i, c, b; + int32_t i, c, b; char cmd[1024]; c = Cmd_Argc(); @@ -727,7 +727,7 @@ Writes lines containing "bind key value" */ void Key_WriteBindings (FILE *f) { - int i; + int32_t i; // unbindall before loading stored bindings: if (cfg_unbindall.value) @@ -742,7 +742,7 @@ void Key_WriteBindings (FILE *f) void History_Init (void) { - int i, c; + int32_t i, c; FILE *hf; for (i = 0; i < CMDLINES; i++) @@ -786,7 +786,7 @@ void History_Init (void) void History_Shutdown (void) { - int i; + int32_t i; FILE *hf; hf = fopen(va("%s/%s", host_parms->userdir, HISTORY_FILE_NAME), "wt"); @@ -814,7 +814,7 @@ Key_Init */ void Key_Init (void) { - int i; + int32_t i; History_Init (); @@ -884,8 +884,8 @@ void Key_Init (void) static struct { bool active; - int lastkey; - int lastchar; + int32_t lastkey; + int32_t lastchar; } key_inputgrab = { false, -1, -1 }; /* @@ -923,7 +923,7 @@ void Key_EndInputGrab (void) Key_GetGrabbedInput =================== */ -void Key_GetGrabbedInput (int *lastkey, int *lastchar) +void Key_GetGrabbedInput (int32_t *lastkey, int32_t *lastchar) { if (lastkey) *lastkey = key_inputgrab.lastkey; @@ -939,7 +939,7 @@ Called by the system between frames for both key up and key down events Should NOT be called during an interrupt! =================== */ -void Key_Event (int key, bool down) +void Key_Event (int32_t key, bool down) { char *kb; char cmd[1024]; @@ -1081,7 +1081,7 @@ Char_Event Called by the backend when the user has input a character. =================== */ -void Char_Event (int key) +void Char_Event (int32_t key) { if (key < 32 || key > 126) return; @@ -1153,7 +1153,7 @@ Key_ClearStates */ void Key_ClearStates (void) { - int i; + int32_t i; for (i = 0; i < MAX_KEYS; i++) { diff --git a/source/keys.h b/source/keys.h index d180ef7..ad15b63 100644 --- a/source/keys.h +++ b/source/keys.h @@ -166,9 +166,9 @@ extern char *keybindings[MAX_KEYS]; #define CMDLINES 64 extern char key_lines[CMDLINES][MAXCMDLINE]; -extern int edit_line; -extern int key_linepos; -extern int key_insert; +extern int32_t edit_line; +extern int32_t key_linepos; +extern int32_t key_insert; extern double key_blinktime; extern bool chat_team; @@ -179,19 +179,19 @@ void Key_UpdateForDest (void); void Key_BeginInputGrab (void); void Key_EndInputGrab (void); -void Key_GetGrabbedInput (int *lastkey, int *lastchar); +void Key_GetGrabbedInput (int32_t *lastkey, int32_t *lastchar); -void Key_Event (int key, bool down); -void Char_Event (int key); +void Key_Event (int32_t key, bool down); +void Char_Event (int32_t key); bool Key_TextEntry (void); -void Key_SetBinding (int keynum, const char *binding); -const char *Key_KeynumToString (int keynum); +void Key_SetBinding (int32_t keynum, const char *binding); +const char *Key_KeynumToString (int32_t keynum); void Key_WriteBindings (FILE *f); void Key_EndChat (void); const char *Key_GetChatBuffer (void); -int Key_GetChatMsgLen (void); +int32_t Key_GetChatMsgLen (void); void History_Init (void); void History_Shutdown (void); diff --git a/source/lodepng.c b/source/lodepng.c index 02462de..2ebc78c 100644 --- a/source/lodepng.c +++ b/source/lodepng.c @@ -673,10 +673,10 @@ Jyrki Katajainen, Alistair Moffat, Andrew Turpin, 1995.*/ /*chain node for boundary package merge*/ typedef struct BPMNode { - int weight; /*the sum of all weights in this chain*/ + int32_t weight; /*the sum of all weights in this chain*/ unsigned index; /*index of this leaf node (called "count" in the paper)*/ struct BPMNode* tail; /*the next nodes in this chain (null if last)*/ - int in_use; + int32_t in_use; } BPMNode; /*lists of chains*/ @@ -695,7 +695,7 @@ typedef struct BPMLists } BPMLists; /*creates a new chain node with the given parameters, from the memory in the lists */ -static BPMNode* bpmnode_create(BPMLists* lists, int weight, unsigned index, BPMNode* tail) +static BPMNode* bpmnode_create(BPMLists* lists, int32_t weight, unsigned index, BPMNode* tail) { unsigned i; BPMNode* result; @@ -755,7 +755,7 @@ static void bpmnode_sort(BPMNode* leaves, size_t num) } /*Boundary Package Merge step, numpresent is the amount of leaves, and c is the current chain.*/ -static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int c, int num) +static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int32_t c, int32_t num) { unsigned lastindex = lists->chains1[c]->index; @@ -768,7 +768,7 @@ static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int else { /*sum of the weights of the head nodes of the previous lookahead chains.*/ - int sum = lists->chains0[c - 1]->weight + lists->chains1[c - 1]->weight; + int32_t sum = lists->chains0[c - 1]->weight + lists->chains1[c - 1]->weight; lists->chains0[c] = lists->chains1[c]; if(lastindex < numpresent && sum > leaves[lastindex].weight) { @@ -778,7 +778,7 @@ static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int lists->chains1[c] = bpmnode_create(lists, sum, lastindex, lists->chains1[c - 1]); /*in the end we are only interested in the chain of the last list, so no need to recurse if we're at the last one (this gives measurable speedup)*/ - if(num + 1 < (int)(2 * numpresent - 2)) + if(num + 1 < (int32_t)(2 * numpresent - 2)) { boundaryPM(lists, leaves, numpresent, c - 1, num); boundaryPM(lists, leaves, numpresent, c - 1, num); @@ -804,7 +804,7 @@ unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequen { if(frequencies[i] > 0) { - leaves[numpresent].weight = (int)frequencies[i]; + leaves[numpresent].weight = (int32_t)frequencies[i]; leaves[numpresent].index = i; ++numpresent; } @@ -857,7 +857,7 @@ unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequen } /*each boundaryPM call adds one chain to the last list, and we need 2 * numpresent - 2 chains.*/ - for(i = 2; i != 2 * numpresent - 2; ++i) boundaryPM(&lists, leaves, numpresent, (int)maxbitlen - 1, (int)i); + for(i = 2; i != 2 * numpresent - 2; ++i) boundaryPM(&lists, leaves, numpresent, (int32_t)maxbitlen - 1, (int32_t)i); for(node = lists.chains1[maxbitlen - 1]; node; node = node->tail) { @@ -1366,14 +1366,14 @@ static const unsigned HASH_BIT_MASK = 65535; /*HASH_NUM_VALUES - 1, but C90 does typedef struct Hash { - int* head; /*hash value to head circular pos - can be outdated if went around window*/ + int32_t* head; /*hash value to head circular pos - can be outdated if went around window*/ /*circular pos to prev circular pos*/ uint16_t* chain; - int* val; /*circular pos to hash value*/ + int32_t* val; /*circular pos to hash value*/ /*TODO: do this not only for zeros but for any repeated byte. However for PNG it's always going to be the zeros that dominate, so not important for PNG*/ - int* headz; /*similar to head, but for chainz*/ + int32_t* headz; /*similar to head, but for chainz*/ uint16_t* chainz; /*those with same amount of zeros*/ uint16_t* zeros; /*length of zeros streak, used as a second hash chain*/ } Hash; @@ -1381,12 +1381,12 @@ typedef struct Hash static unsigned hash_init(Hash* hash, unsigned windowsize) { unsigned i; - hash->head = (int*)lodepng_malloc(sizeof(int) * HASH_NUM_VALUES); - hash->val = (int*)lodepng_malloc(sizeof(int) * windowsize); + hash->head = (int32_t*)lodepng_malloc(sizeof(int32_t) * HASH_NUM_VALUES); + hash->val = (int32_t*)lodepng_malloc(sizeof(int32_t) * windowsize); hash->chain = (uint16_t*)lodepng_malloc(sizeof(uint16_t) * windowsize); hash->zeros = (uint16_t*)lodepng_malloc(sizeof(uint16_t) * windowsize); - hash->headz = (int*)lodepng_malloc(sizeof(int) * (MAX_SUPPORTED_DEFLATE_LENGTH + 1)); + hash->headz = (int32_t*)lodepng_malloc(sizeof(int32_t) * (MAX_SUPPORTED_DEFLATE_LENGTH + 1)); hash->chainz = (uint16_t*)lodepng_malloc(sizeof(uint16_t) * windowsize); if(!hash->head || !hash->chain || !hash->val || !hash->headz|| !hash->chainz || !hash->zeros) @@ -1453,7 +1453,7 @@ static unsigned countZeros(const uint8_t* data, size_t size, size_t pos) /*wpos = pos & (windowsize - 1)*/ static void updateHashChain(Hash* hash, size_t wpos, unsigned hashval, uint16_t numzeros) { - hash->val[wpos] = (int)hashval; + hash->val[wpos] = (int32_t)hashval; if(hash->head[hashval] != -1) hash->chain[wpos] = hash->head[hashval]; hash->head[hashval] = wpos; @@ -1578,7 +1578,7 @@ static unsigned encodeLZ77(uivector* out, Hash* hash, { hashpos = hash->chain[hashpos]; /*outdated hash value, happens if particular value was not encountered in whole last window*/ - if(hash->val[hashpos] != (int)hashval) break; + if(hash->val[hashpos] != (int32_t)hashval) break; } } @@ -1746,7 +1746,7 @@ static unsigned deflateDynamic(ucvector* out, size_t* bp, Hash* hash, uivector frequencies_ll; /*frequency of lit,len codes*/ uivector frequencies_d; /*frequency of dist codes*/ uivector frequencies_cl; /*frequency of code length codes*/ - uivector bitlen_lld; /*lit,len,dist code lenghts (int bits), literally (without repeat codes).*/ + uivector bitlen_lld; /*lit,len,dist code lenghts (int32_t bits), literally (without repeat codes).*/ uivector bitlen_lld_e; /*bitlen_lld encoded with repeat codes (this is a rudemtary run length compression)*/ /*bitlen_cl is the code length code lengths ("clcl"). The bit lengths of codes to represent tree_cl (these are written as is in the file, it would be crazy to compress these using yet another huffman @@ -2609,7 +2609,7 @@ unsigned lodepng_color_mode_copy(LodePNGColorMode* dest, const LodePNGColorMode* return 0; } -static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColorMode* b) +static int32_t lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColorMode* b) { size_t i; if(a->colortype != b->colortype) return 0; @@ -2980,19 +2980,19 @@ node has 16 instead of 8 children. struct ColorTree { ColorTree* children[16]; /*up to 16 pointers to ColorTree of next level*/ - int index; /*the payload. Only has a meaningful value if this is in the last level*/ + int32_t index; /*the payload. Only has a meaningful value if this is in the last level*/ }; static void color_tree_init(ColorTree* tree) { - int i; + int32_t i; for(i = 0; i != 16; ++i) tree->children[i] = 0; tree->index = -1; } static void color_tree_cleanup(ColorTree* tree) { - int i; + int32_t i; for(i = 0; i != 16; ++i) { if(tree->children[i]) @@ -3004,12 +3004,12 @@ static void color_tree_cleanup(ColorTree* tree) } /*returns -1 if color not present, its index otherwise*/ -static int color_tree_get(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint8_t a) +static int32_t color_tree_get(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint8_t a) { - int bit = 0; + int32_t bit = 0; for(bit = 0; bit < 8; ++bit) { - int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1); + int32_t i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1); if(!tree->children[i]) return -1; else tree = tree->children[i]; } @@ -3017,7 +3017,7 @@ static int color_tree_get(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint } #ifdef LODEPNG_COMPILE_ENCODER -static int color_tree_has(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint8_t a) +static int32_t color_tree_has(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint8_t a) { return color_tree_get(tree, r, g, b, a) >= 0; } @@ -3028,10 +3028,10 @@ Index should be >= 0 (it's signed to be compatible with using -1 for "doesn't ex static void color_tree_add(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint8_t a, unsigned index) { - int bit; + int32_t bit; for(bit = 0; bit < 8; ++bit) { - int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1); + int32_t i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1); if(!tree->children[i]) { tree->children[i] = (ColorTree*)lodepng_malloc(sizeof(ColorTree)); @@ -3039,7 +3039,7 @@ static void color_tree_add(ColorTree* tree, } tree = tree->children[i]; } - tree->index = (int)index; + tree->index = (int32_t)index; } /*put a pixel, given its RGBA color, into image of any color type*/ @@ -3076,7 +3076,7 @@ static unsigned rgba8ToPixel(uint8_t* out, size_t i, } else if(mode->colortype == LCT_PALETTE) { - int index = color_tree_get(tree, r, g, b, a); + int32_t index = color_tree_get(tree, r, g, b, a); if(index < 0) return 82; /*color not in palette*/ if(mode->bitdepth == 8) out[i] = index; else addColorBits(out, i, mode->bitdepth, (unsigned)index); @@ -3534,14 +3534,14 @@ void lodepng_color_profile_init(LodePNGColorProfile* profile) /*function used for debug purposes with C++*/ /*void printColorProfile(LodePNGColorProfile* p) { - std::cout << "colored: " << (int)p->colored << ", "; - std::cout << "key: " << (int)p->key << ", "; - std::cout << "key_r: " << (int)p->key_r << ", "; - std::cout << "key_g: " << (int)p->key_g << ", "; - std::cout << "key_b: " << (int)p->key_b << ", "; - std::cout << "alpha: " << (int)p->alpha << ", "; - std::cout << "numcolors: " << (int)p->numcolors << ", "; - std::cout << "bits: " << (int)p->bits << std::endl; + std::cout << "colored: " << (int32_t)p->colored << ", "; + std::cout << "key: " << (int32_t)p->key << ", "; + std::cout << "key_r: " << (int32_t)p->key_r << ", "; + std::cout << "key_g: " << (int32_t)p->key_g << ", "; + std::cout << "key_b: " << (int32_t)p->key_b << ", "; + std::cout << "alpha: " << (int32_t)p->alpha << ", "; + std::cout << "numcolors: " << (int32_t)p->numcolors << ", "; + std::cout << "bits: " << (int32_t)p->bits << std::endl; }*/ /*Returns how many bits needed to represent given value (max 8 bit)*/ diff --git a/source/lodepng.h b/source/lodepng.h index ebbc591..13230a4 100644 --- a/source/lodepng.h +++ b/source/lodepng.h @@ -1524,7 +1524,7 @@ examples can be found on the LodePNG website. #include "lodepng.h" #include -int main(int argc, char *argv[]) +int32_t main(int32_t argc, char *argv[]) { const char* filename = argc > 1 ? argv[1] : "test.png"; @@ -1544,7 +1544,7 @@ int main(int argc, char *argv[]) #include "lodepng.h" -int main(int argc, char *argv[]) +int32_t main(int32_t argc, char *argv[]) { unsigned error; uint8_t* image; @@ -1689,7 +1689,7 @@ symbol. C++ wrapper around this provides an interface almost identical to before. Having LodePNG be pure ISO C90 makes it more portable. The C and C++ code are together in these files but it works both for C and C++ compilers. -*) 29 dec 2007: (!) changed most integer types to unsigned int + other tweaks +*) 29 dec 2007: (!) changed most integer types to unsigned int32_t + other tweaks *) 30 aug 2007: bug fixed which makes this Borland C++ compatible *) 09 aug 2007: some VS2005 warnings removed again *) 21 jul 2007: deflate code placed in new namespace separate from zlib code diff --git a/source/main_sdl.c b/source/main_sdl.c index 326c6db..eac203e 100644 --- a/source/main_sdl.c +++ b/source/main_sdl.c @@ -71,9 +71,9 @@ static quakeparms_t parms; #define main SDL_main #endif -int main(int argc, char *argv[]) +int32_t main(int32_t argc, char *argv[]) { - int t; + int32_t t; double time, oldtime, newtime; host_parms = &parms; diff --git a/source/mathlib.c b/source/mathlib.c index 5cf26e5..47479aa 100644 --- a/source/mathlib.c +++ b/source/mathlib.c @@ -56,8 +56,8 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal ) */ void PerpendicularVector( vec3_t dst, const vec3_t src ) { - int pos; - int i; + int32_t pos; + int32_t i; float minelem = 1.0F; vec3_t tempvec; @@ -95,11 +95,11 @@ float anglemod(float a) { #if 0 if (a >= 0) - a -= 360*(int)(a/360); + a -= 360*(int32_t)(a/360); else - a += 360*( 1 + (int)(-a/360) ); + a += 360*( 1 + (int32_t)(-a/360) ); #endif - a = (360.0/65536) * ((int)(a*(65536/360.0)) & 65535); + a = (360.0/65536) * ((int32_t)(a*(65536/360.0)) & 65535); return a; } @@ -111,10 +111,10 @@ BoxOnPlaneSide Returns 1, 2, or 1 + 2 ================== */ -int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p) +int32_t BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p) { float dist1, dist2; - int sides; + int32_t sides; #if 0 // this is done by the BOX_ON_PLANE_SIDE macro before calling this // function @@ -171,7 +171,7 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p) } #if 0 - int i; + int32_t i; vec3_t corners[2]; for (i=0 ; i<3 ; i++) @@ -250,9 +250,9 @@ void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) up[2] = cr*cp; } -int VectorCompare (vec3_t v1, vec3_t v2) +int32_t VectorCompare (vec3_t v1, vec3_t v2) { - int i; + int32_t i; for (i=0 ; i<3 ; i++) if (v1[i] != v2[i]) @@ -340,9 +340,9 @@ void VectorScale (vec3_t in, vec_t scale, vec3_t out) } -int Q_log2(int val) +int32_t Q_log2(int32_t val) { - int answer=0; + int32_t answer=0; while (val>>=1) answer++; return answer; @@ -421,10 +421,10 @@ quotient must fit in 32 bits. ==================== */ -void FloorDivMod (double numer, double denom, int *quotient, - int *rem) +void FloorDivMod (double numer, double denom, int32_t *quotient, + int32_t *rem) { - int q, r; + int32_t q, r; double x; #ifndef PARANOID @@ -440,8 +440,8 @@ void FloorDivMod (double numer, double denom, int *quotient, { x = floor(numer / denom); - q = (int)x; - r = (int)floor(numer - (x * denom)); + q = (int32_t)x; + r = (int32_t)floor(numer - (x * denom)); } else { @@ -449,12 +449,12 @@ void FloorDivMod (double numer, double denom, int *quotient, // perform operations with positive values, and fix mod to make floor-based // x = floor(-numer / denom); - q = -(int)x; - r = (int)floor(-numer - (x * denom)); + q = -(int32_t)x; + r = (int32_t)floor(-numer - (x * denom)); if (r != 0) { q--; - r = (int)denom - r; + r = (int32_t)denom - r; } } @@ -468,7 +468,7 @@ void FloorDivMod (double numer, double denom, int *quotient, GreatestCommonDivisor ==================== */ -int GreatestCommonDivisor (int i1, int i2) +int32_t GreatestCommonDivisor (int32_t i1, int32_t i2) { if (i1 > i2) { diff --git a/source/mathlib.h b/source/mathlib.h index 056f3a2..46a12bc 100644 --- a/source/mathlib.h +++ b/source/mathlib.h @@ -40,16 +40,16 @@ extern vec3_t vec3_origin; #define nanmask (255 << 23) /* 7F800000 */ #if 0 /* macro is violating strict aliasing rules */ -#define IS_NAN(x) (((*(int *) (char *) &x) & nanmask) == nanmask) +#define IS_NAN(x) (((*(int32_t *) (char *) &x) & nanmask) == nanmask) #else -static inline int IS_NAN (float x) { - union { float f; int i; } num; +static inline int32_t IS_NAN (float x) { + union { float f; int32_t i; } num; num.f = x; return ((num.i & nanmask) == nanmask); } #endif -#define Q_rint(x) ((x) > 0 ? (int)((x) + 0.5) : (int)((x) - 0.5)) //johnfitz -- from joequake +#define Q_rint(x) ((x) > 0 ? (int32_t)((x) + 0.5) : (int32_t)((x) - 0.5)) //johnfitz -- from joequake #define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) #define DoublePrecisionDotProduct(x,y) ((double)x[0]*y[0]+(double)x[1]*y[1]+(double)x[2]*y[2]) @@ -58,10 +58,10 @@ static inline int IS_NAN (float x) { #define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];} //johnfitz -- courtesy of lordhavoc -// QuakeSpasm: To avoid strict aliasing violations, use a float/int union instead of type punning. +// QuakeSpasm: To avoid strict aliasing violations, use a float/int32_t union instead of type punning. #define VectorNormalizeFast(_v)\ {\ - union { float f; int i; } _y, _number;\ + union { float f; int32_t i; } _y, _number;\ _number.f = DotProduct(_v, _v);\ if (_number.f != 0.0)\ {\ @@ -81,23 +81,23 @@ void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); void _VectorCopy (vec3_t in, vec3_t out); -int VectorCompare (vec3_t v1, vec3_t v2); +int32_t VectorCompare (vec3_t v1, vec3_t v2); vec_t VectorLength (vec3_t v); void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross); float VectorNormalize (vec3_t v); // returns vector length void VectorInverse (vec3_t v); void VectorScale (vec3_t in, vec_t scale, vec3_t out); -int Q_log2(int val); +int32_t Q_log2(int32_t val); void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); -void FloorDivMod (double numer, double denom, int *quotient, - int *rem); -int GreatestCommonDivisor (int i1, int i2); +void FloorDivMod (double numer, double denom, int32_t *quotient, + int32_t *rem); +int32_t GreatestCommonDivisor (int32_t i1, int32_t i2); void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); -int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane); +int32_t BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane); float anglemod(float a); diff --git a/source/menu.c b/source/menu.c index 104d5da..48d26d0 100644 --- a/source/menu.c +++ b/source/menu.c @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void (*vid_menucmdfn)(void); //johnfitz void (*vid_menudrawfn)(void); -void (*vid_menukeyfn)(int key); +void (*vid_menukeyfn)(int32_t key); enum m_state_e m_state; @@ -63,22 +63,22 @@ void M_Main_Draw (void); void M_Help_Draw (void); void M_Quit_Draw (void); -void M_Main_Key (int key); - void M_SinglePlayer_Key (int key); - void M_Load_Key (int key); - void M_Save_Key (int key); - void M_MultiPlayer_Key (int key); - void M_Setup_Key (int key); - void M_Net_Key (int key); - void M_LanConfig_Key (int key); - void M_GameOptions_Key (int key); - void M_Search_Key (int key); - void M_ServerList_Key (int key); - void M_Options_Key (int key); - void M_Keys_Key (int key); - void M_Video_Key (int key); - void M_Help_Key (int key); - void M_Quit_Key (int key); +void M_Main_Key (int32_t key); + void M_SinglePlayer_Key (int32_t key); + void M_Load_Key (int32_t key); + void M_Save_Key (int32_t key); + void M_MultiPlayer_Key (int32_t key); + void M_Setup_Key (int32_t key); + void M_Net_Key (int32_t key); + void M_LanConfig_Key (int32_t key); + void M_GameOptions_Key (int32_t key); + void M_Search_Key (int32_t key); + void M_ServerList_Key (int32_t key); + void M_Options_Key (int32_t key); + void M_Keys_Key (int32_t key); + void M_Video_Key (int32_t key); + void M_Help_Key (int32_t key); + void M_Quit_Key (int32_t key); bool m_entersound; // play after drawing a frame, so caching // won't disrupt the sound @@ -102,12 +102,12 @@ M_DrawCharacter Draws one solid graphics character ================ */ -void M_DrawCharacter (int cx, int line, int num) +void M_DrawCharacter (int32_t cx, int32_t line, int32_t num) { Draw_Character (cx, line, num); } -void M_Print (int cx, int cy, const char *str) +void M_Print (int32_t cx, int32_t cy, const char *str) { while (*str) { @@ -117,7 +117,7 @@ void M_Print (int cx, int cy, const char *str) } } -void M_PrintWhite (int cx, int cy, const char *str) +void M_PrintWhite (int32_t cx, int32_t cy, const char *str) { while (*str) { @@ -127,26 +127,26 @@ void M_PrintWhite (int cx, int cy, const char *str) } } -void M_DrawTransPic (int x, int y, qpic_t *pic) +void M_DrawTransPic (int32_t x, int32_t y, qpic_t *pic) { Draw_Pic (x, y, pic); //johnfitz -- simplified becuase centering is handled elsewhere } -void M_DrawPic (int x, int y, qpic_t *pic) +void M_DrawPic (int32_t x, int32_t y, qpic_t *pic) { Draw_Pic (x, y, pic); //johnfitz -- simplified becuase centering is handled elsewhere } -void M_DrawTransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom) //johnfitz -- more parameters +void M_DrawTransPicTranslate (int32_t x, int32_t y, qpic_t *pic, int32_t top, int32_t bottom) //johnfitz -- more parameters { Draw_TransPicTranslate (x, y, pic, top, bottom); //johnfitz -- simplified becuase centering is handled elsewhere } -void M_DrawTextBox (int x, int y, int width, int lines) +void M_DrawTextBox (int32_t x, int32_t y, int32_t width, int32_t lines) { qpic_t *p; - int cx, cy; - int n; + int32_t cx, cy; + int32_t n; // draw left side cx = x; @@ -199,7 +199,7 @@ void M_DrawTextBox (int x, int y, int width, int lines) //============================================================================= -int m_save_demonum; +int32_t m_save_demonum; /* ================ @@ -237,7 +237,7 @@ void M_ToggleMenu_f (void) //============================================================================= /* MAIN MENU */ -int m_main_cursor; +int32_t m_main_cursor; #define MAIN_ITEMS 5 @@ -257,7 +257,7 @@ void M_Menu_Main_f (void) void M_Main_Draw (void) { - int f; + int32_t f; qpic_t *p; M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); @@ -265,13 +265,13 @@ void M_Main_Draw (void) M_DrawPic ( (320-p->width)/2, 4, p); M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp") ); - f = (int)(realtime * 10)%6; + f = (int32_t)(realtime * 10)%6; M_DrawTransPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) ); } -void M_Main_Key (int key) +void M_Main_Key (int32_t key) { switch (key) { @@ -332,7 +332,7 @@ void M_Main_Key (int key) //============================================================================= /* SINGLE PLAYER MENU */ -int m_singleplayer_cursor; +int32_t m_singleplayer_cursor; #define SINGLEPLAYER_ITEMS 3 @@ -347,7 +347,7 @@ void M_Menu_SinglePlayer_f (void) void M_SinglePlayer_Draw (void) { - int f; + int32_t f; qpic_t *p; M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); @@ -355,13 +355,13 @@ void M_SinglePlayer_Draw (void) M_DrawPic ( (320-p->width)/2, 4, p); M_DrawTransPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp") ); - f = (int)(realtime * 10)%6; + f = (int32_t)(realtime * 10)%6; M_DrawTransPic (54, 32 + m_singleplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) ); } -void M_SinglePlayer_Key (int key) +void M_SinglePlayer_Key (int32_t key) { switch (key) { @@ -417,18 +417,18 @@ void M_SinglePlayer_Key (int key) //============================================================================= /* LOAD/SAVE MENU */ -int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES +int32_t load_cursor; // 0 < load_cursor < MAX_SAVEGAMES #define MAX_SAVEGAMES 20 /* johnfitz -- increased from 12 */ char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1]; -int loadable[MAX_SAVEGAMES]; +int32_t loadable[MAX_SAVEGAMES]; void M_ScanSaves (void) { - int i, j; + int32_t i, j; char name[MAX_OSPATH]; FILE *f; - int version; + int32_t version; for (i = 0; i < MAX_SAVEGAMES; i++) { @@ -483,7 +483,7 @@ void M_Menu_Save_f (void) void M_Load_Draw (void) { - int i; + int32_t i; qpic_t *p; p = Draw_CachePic ("gfx/p_load.lmp"); @@ -493,13 +493,13 @@ void M_Load_Draw (void) M_Print (16, 32 + 8*i, m_filenames[i]); // line cursor - M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1)); + M_DrawCharacter (8, 32 + load_cursor*8, 12+((int32_t)(realtime*4)&1)); } void M_Save_Draw (void) { - int i; + int32_t i; qpic_t *p; p = Draw_CachePic ("gfx/p_save.lmp"); @@ -509,11 +509,11 @@ void M_Save_Draw (void) M_Print (16, 32 + 8*i, m_filenames[i]); // line cursor - M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1)); + M_DrawCharacter (8, 32 + load_cursor*8, 12+((int32_t)(realtime*4)&1)); } -void M_Load_Key (int k) +void M_Load_Key (int32_t k) { switch (k) { @@ -559,7 +559,7 @@ void M_Load_Key (int k) } -void M_Save_Key (int k) +void M_Save_Key (int32_t k) { switch (k) { @@ -598,7 +598,7 @@ void M_Save_Key (int k) //============================================================================= /* MULTIPLAYER MENU */ -int m_multiplayer_cursor; +int32_t m_multiplayer_cursor; #define MULTIPLAYER_ITEMS 3 @@ -613,7 +613,7 @@ void M_Menu_MultiPlayer_f (void) void M_MultiPlayer_Draw (void) { - int f; + int32_t f; qpic_t *p; M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); @@ -621,7 +621,7 @@ void M_MultiPlayer_Draw (void) M_DrawPic ( (320-p->width)/2, 4, p); M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mp_menu.lmp") ); - f = (int)(realtime * 10)%6; + f = (int32_t)(realtime * 10)%6; M_DrawTransPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) ); @@ -631,7 +631,7 @@ void M_MultiPlayer_Draw (void) } -void M_MultiPlayer_Key (int key) +void M_MultiPlayer_Key (int32_t key) { switch (key) { @@ -678,15 +678,15 @@ void M_MultiPlayer_Key (int key) //============================================================================= /* SETUP MENU */ -int setup_cursor = 4; -int setup_cursor_table[] = {40, 56, 80, 104, 140}; +int32_t setup_cursor = 4; +int32_t setup_cursor_table[] = {40, 56, 80, 104, 140}; char setup_hostname[16]; char setup_myname[16]; -int setup_oldtop; -int setup_oldbottom; -int setup_top; -int setup_bottom; +int32_t setup_oldtop; +int32_t setup_oldbottom; +int32_t setup_top; +int32_t setup_bottom; #define NUM_SETUP_CMDS 5 @@ -698,8 +698,8 @@ void M_Menu_Setup_f (void) m_entersound = true; Q_strcpy(setup_myname, cl_name.string); Q_strcpy(setup_hostname, hostname.string); - setup_top = setup_oldtop = ((int)cl_color.value) >> 4; - setup_bottom = setup_oldbottom = ((int)cl_color.value) & 15; + setup_top = setup_oldtop = ((int32_t)cl_color.value) >> 4; + setup_bottom = setup_oldbottom = ((int32_t)cl_color.value) & 15; } @@ -730,17 +730,17 @@ void M_Setup_Draw (void) p = Draw_CachePic ("gfx/menuplyr.lmp"); M_DrawTransPicTranslate (172, 72, p, setup_top, setup_bottom); - M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1)); + M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int32_t)(realtime*4)&1)); if (setup_cursor == 0) - M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1)); + M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int32_t)(realtime*4)&1)); if (setup_cursor == 1) - M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1)); + M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int32_t)(realtime*4)&1)); } -void M_Setup_Key (int k) +void M_Setup_Key (int32_t k) { switch (k) { @@ -829,9 +829,9 @@ forward: } -void M_Setup_Char (int k) +void M_Setup_Char (int32_t k) { - int l; + int32_t l; switch (setup_cursor) { @@ -863,8 +863,8 @@ bool M_Setup_TextEntry (void) //============================================================================= /* NET MENU */ -int m_net_cursor; -int m_net_items; +int32_t m_net_cursor; +int32_t m_net_items; const char *net_helpMessage [] = { @@ -897,7 +897,7 @@ void M_Menu_Net_f (void) void M_Net_Draw (void) { - int f; + int32_t f; qpic_t *p; M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); @@ -927,12 +927,12 @@ void M_Net_Draw (void) M_Print (f, 120, net_helpMessage[m_net_cursor*4+2]); M_Print (f, 128, net_helpMessage[m_net_cursor*4+3]); - f = (int)(realtime * 10)%6; + f = (int32_t)(realtime * 10)%6; M_DrawTransPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) ); } -void M_Net_Key (int k) +void M_Net_Key (int32_t k) { again: switch (k) @@ -1007,7 +1007,7 @@ enum #define SLIDER_RANGE 10 -int options_cursor; +int32_t options_cursor; void M_Menu_Options_f (void) { @@ -1018,9 +1018,9 @@ void M_Menu_Options_f (void) } -void M_AdjustSliders (int dir) +void M_AdjustSliders (int32_t dir) { - int curr_alwaysrun, target_alwaysrun; + int32_t curr_alwaysrun, target_alwaysrun; float f, l; S_LocalSound ("misc/menu3.wav"); @@ -1134,9 +1134,9 @@ void M_AdjustSliders (int dir) } -void M_DrawSlider (int x, int y, float range) +void M_DrawSlider (int32_t x, int32_t y, float range) { - int i; + int32_t i; if (range < 0) range = 0; @@ -1149,7 +1149,7 @@ void M_DrawSlider (int x, int y, float range) M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131); } -void M_DrawCheckbox (int x, int y, int on) +void M_DrawCheckbox (int32_t x, int32_t y, int32_t on) { #if 0 if (on) @@ -1255,11 +1255,11 @@ void M_Options_Draw (void) M_Print (16, 32 + 8*OPT_VIDEO, " Video Options"); // cursor - M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1)); + M_DrawCharacter (200, 32 + options_cursor*8, 12+((int32_t)(realtime*4)&1)); } -void M_Options_Key (int k) +void M_Options_Key (int32_t k) { switch (k) { @@ -1358,7 +1358,7 @@ const char *bindnames[][2] = #define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0])) -static int keys_cursor; +static int32_t keys_cursor; static bool bind_grab; void M_Menu_Keys_f (void) @@ -1370,11 +1370,11 @@ void M_Menu_Keys_f (void) } -void M_FindKeysForCommand (const char *command, int *threekeys) +void M_FindKeysForCommand (const char *command, int32_t *threekeys) { - int count; - int j; - int l; + int32_t count; + int32_t j; + int32_t l; char *b; threekeys[0] = threekeys[1] = threekeys[2] = -1; @@ -1398,8 +1398,8 @@ void M_FindKeysForCommand (const char *command, int *threekeys) void M_UnbindCommand (const char *command) { - int j; - int l; + int32_t j; + int32_t l; char *b; l = strlen(command); @@ -1418,8 +1418,8 @@ extern qpic_t *pic_up, *pic_down; void M_Keys_Draw (void) { - int i, x, y; - int keys[3]; + int32_t i, x, y; + int32_t keys[3]; const char *name; qpic_t *p; @@ -1432,7 +1432,7 @@ void M_Keys_Draw (void) M_Print (18, 32, "Enter to change, backspace to clear"); // search for known bindings - for (i = 0; i < (int)NUMCOMMANDS; i++) + for (i = 0; i < (int32_t)NUMCOMMANDS; i++) { y = 48 + 8*i; @@ -1467,14 +1467,14 @@ void M_Keys_Draw (void) if (bind_grab) M_DrawCharacter (130, 48 + keys_cursor*8, '='); else - M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int)(realtime*4)&1)); + M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int32_t)(realtime*4)&1)); } -void M_Keys_Key (int k) +void M_Keys_Key (int32_t k) { char cmd[80]; - int keys[3]; + int32_t keys[3]; if (bind_grab) { // defining a key @@ -1509,7 +1509,7 @@ void M_Keys_Key (int k) case K_RIGHTARROW: S_LocalSound ("misc/menu1.wav"); keys_cursor++; - if (keys_cursor >= (int)NUMCOMMANDS) + if (keys_cursor >= (int32_t)NUMCOMMANDS) keys_cursor = 0; break; @@ -1547,7 +1547,7 @@ void M_Video_Draw (void) } -void M_Video_Key (int key) +void M_Video_Key (int32_t key) { (*vid_menukeyfn) (key); } @@ -1555,7 +1555,7 @@ void M_Video_Key (int key) //============================================================================= /* HELP MENU */ -int help_page; +int32_t help_page; #define NUM_HELP_PAGES 6 @@ -1576,7 +1576,7 @@ void M_Help_Draw (void) } -void M_Help_Key (int key) +void M_Help_Key (int32_t key) { switch (key) { @@ -1605,7 +1605,7 @@ void M_Help_Key (int key) //============================================================================= /* QUIT MENU */ -int msgNumber; +int32_t msgNumber; enum m_state_e m_quit_prevstate; bool wasInMenus; @@ -1623,7 +1623,7 @@ void M_Menu_Quit_f (void) } -void M_Quit_Key (int key) +void M_Quit_Key (int32_t key) { if (key == K_ESCAPE) { @@ -1642,7 +1642,7 @@ void M_Quit_Key (int key) } -void M_Quit_Char (int key) +void M_Quit_Char (int32_t key) { switch (key) { @@ -1686,7 +1686,7 @@ void M_Quit_Draw (void) //johnfitz -- modified for new quit message char msg1[40]; char msg2[] = "by Ozkan, Ericw & Stevenaaus"; /* msg2/msg3 are mostly [40] */ char msg3[] = "Press y to quit"; - int boxlen; + int32_t boxlen; if (wasInMenus) { @@ -1714,11 +1714,11 @@ void M_Quit_Draw (void) //johnfitz -- modified for new quit message //============================================================================= /* LAN CONFIG MENU */ -int lanConfig_cursor = -1; -int lanConfig_cursor_table [] = {72, 92, 124}; +int32_t lanConfig_cursor = -1; +int32_t lanConfig_cursor_table [] = {72, 92, 124}; #define NUM_LANCONFIG_CMDS 3 -int lanConfig_port; +int32_t lanConfig_port; char lanConfig_portname[6]; char lanConfig_joinname[22]; @@ -1748,7 +1748,7 @@ void M_Menu_LanConfig_f (void) void M_LanConfig_Draw (void) { qpic_t *p; - int basex; + int32_t basex; const char *startJoin; const char *protocol; @@ -1791,22 +1791,22 @@ void M_LanConfig_Draw (void) M_Print (basex+8, lanConfig_cursor_table[1], "OK"); } - M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1)); + M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int32_t)(realtime*4)&1)); if (lanConfig_cursor == 0) - M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1)); + M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int32_t)(realtime*4)&1)); if (lanConfig_cursor == 2) - M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1)); + M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int32_t)(realtime*4)&1)); if (*m_return_reason) M_PrintWhite (basex, 148, m_return_reason); } -void M_LanConfig_Key (int key) +void M_LanConfig_Key (int32_t key) { - int l; + int32_t l; switch (key) { @@ -1895,9 +1895,9 @@ void M_LanConfig_Key (int key) } -void M_LanConfig_Char (int key) +void M_LanConfig_Char (int32_t key) { - int l; + int32_t l; switch (lanConfig_cursor) { @@ -2039,8 +2039,8 @@ level_t roguelevels[] = typedef struct { const char *description; - int firstLevel; - int levels; + int32_t firstLevel; + int32_t levels; } episode_t; episode_t episodes[] = @@ -2075,9 +2075,9 @@ episode_t rogueepisodes[] = {"Deathmatch Arena", 16, 1} }; -int startepisode; -int startlevel; -int maxplayers; +int32_t startepisode; +int32_t startlevel; +int32_t maxplayers; bool m_serverInfoMessage = false; double m_serverInfoMessageTime; @@ -2094,14 +2094,14 @@ void M_Menu_GameOptions_f (void) } -int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120}; +int32_t gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120}; #define NUM_GAMEOPTIONS 9 -int gameoptions_cursor; +int32_t gameoptions_cursor; void M_GameOptions_Draw (void) { qpic_t *p; - int x; + int32_t x; M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); p = Draw_CachePic ("gfx/p_multi.lmp"); @@ -2124,7 +2124,7 @@ void M_GameOptions_Draw (void) { const char *msg; - switch((int)teamplay.value) + switch((int32_t)teamplay.value) { case 1: msg = "No Friendly Fire"; break; case 2: msg = "Friendly Fire"; break; @@ -2140,7 +2140,7 @@ void M_GameOptions_Draw (void) { const char *msg; - switch((int)teamplay.value) + switch((int32_t)teamplay.value) { case 1: msg = "No Friendly Fire"; break; case 2: msg = "Friendly Fire"; break; @@ -2163,13 +2163,13 @@ void M_GameOptions_Draw (void) if (fraglimit.value == 0) M_Print (160, 88, "none"); else - M_Print (160, 88, va("%i frags", (int)fraglimit.value)); + M_Print (160, 88, va("%i frags", (int32_t)fraglimit.value)); M_Print (0, 96, " Time Limit"); if (timelimit.value == 0) M_Print (160, 96, "none"); else - M_Print (160, 96, va("%i minutes", (int)timelimit.value)); + M_Print (160, 96, va("%i minutes", (int32_t)timelimit.value)); M_Print (0, 112, " Episode"); // MED 01/06/97 added hipnotic episodes @@ -2201,7 +2201,7 @@ void M_GameOptions_Draw (void) } // line cursor - M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1)); + M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int32_t)(realtime*4)&1)); if (m_serverInfoMessage) { @@ -2223,9 +2223,9 @@ void M_GameOptions_Draw (void) } -void M_NetStart_Change (int dir) +void M_NetStart_Change (int32_t dir) { - int count; + int32_t count; float f; switch (gameoptions_cursor) @@ -2318,7 +2318,7 @@ void M_NetStart_Change (int dir) } } -void M_GameOptions_Key (int key) +void M_GameOptions_Key (int32_t key) { switch (key) { @@ -2405,7 +2405,7 @@ void M_Menu_Search_f (void) void M_Search_Draw (void) { qpic_t *p; - int x; + int32_t x; p = Draw_CachePic ("gfx/p_multi.lmp"); M_DrawPic ( (320-p->width)/2, 4, p); @@ -2439,7 +2439,7 @@ void M_Search_Draw (void) } -void M_Search_Key (int key) +void M_Search_Key (int32_t key) { (void)key; } @@ -2447,7 +2447,7 @@ void M_Search_Key (int key) //============================================================================= /* SLIST MENU */ -int slist_cursor; +int32_t slist_cursor; bool slist_sorted; void M_Menu_ServerList_f (void) @@ -2465,7 +2465,7 @@ void M_Menu_ServerList_f (void) void M_ServerList_Draw (void) { - int n; + int32_t n; qpic_t *p; if (!slist_sorted) @@ -2478,14 +2478,14 @@ void M_ServerList_Draw (void) M_DrawPic ( (320-p->width)/2, 4, p); for (n = 0; n < hostCacheCount; n++) M_Print (16, 32 + 8*n, NET_SlistPrintServer (n)); - M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1)); + M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int32_t)(realtime*4)&1)); if (*m_return_reason) M_PrintWhite (16, 148, m_return_reason); } -void M_ServerList_Key (int k) +void M_ServerList_Key (int32_t k) { switch (k) { @@ -2663,7 +2663,7 @@ void M_Draw (void) } -void M_Keydown (int key) +void M_Keydown (int32_t key) { switch (m_state) { @@ -2737,7 +2737,7 @@ void M_Keydown (int key) } -void M_Charinput (int key) +void M_Charinput (int32_t key) { switch (m_state) { diff --git a/source/menu.h b/source/menu.h index 7fd9799..b0c68c4 100644 --- a/source/menu.h +++ b/source/menu.h @@ -52,8 +52,8 @@ extern bool m_entersound; // menus // void M_Init (void); -void M_Keydown (int key); -void M_Charinput (int key); +void M_Keydown (int32_t key); +void M_Charinput (int32_t key); bool M_TextEntry (void); void M_ToggleMenu_f (void); @@ -61,15 +61,15 @@ void M_Menu_Main_f (void); void M_Menu_Options_f (void); void M_Menu_Quit_f (void); -void M_Print (int cx, int cy, const char *str); -void M_PrintWhite (int cx, int cy, const char *str); +void M_Print (int32_t cx, int32_t cy, const char *str); +void M_PrintWhite (int32_t cx, int32_t cy, const char *str); void M_Draw (void); -void M_DrawCharacter (int cx, int line, int num); +void M_DrawCharacter (int32_t cx, int32_t line, int32_t num); -void M_DrawPic (int x, int y, qpic_t *pic); -void M_DrawTransPic (int x, int y, qpic_t *pic); -void M_DrawCheckbox (int x, int y, int on); +void M_DrawPic (int32_t x, int32_t y, qpic_t *pic); +void M_DrawTransPic (int32_t x, int32_t y, qpic_t *pic); +void M_DrawCheckbox (int32_t x, int32_t y, int32_t on); #endif /* _QUAKE_MENU_H */ diff --git a/source/modelgen.h b/source/modelgen.h index 92dbcf4..5cb89ce 100644 --- a/source/modelgen.h +++ b/source/modelgen.h @@ -62,34 +62,34 @@ typedef enum { ALIAS_SINGLE=0, ALIAS_GROUP } aliasframetype_t; typedef enum { ALIAS_SKIN_SINGLE=0, ALIAS_SKIN_GROUP } aliasskintype_t; typedef struct { - int ident; - int version; + int32_t ident; + int32_t version; vec3_t scale; vec3_t scale_origin; float boundingradius; vec3_t eyeposition; - int numskins; - int skinwidth; - int skinheight; - int numverts; - int numtris; - int numframes; + int32_t numskins; + int32_t skinwidth; + int32_t skinheight; + int32_t numverts; + int32_t numtris; + int32_t numframes; synctype_t synctype; - int flags; + int32_t flags; float size; } mdl_t; // TODO: could be shorts typedef struct { - int onseam; - int s; - int t; + int32_t onseam; + int32_t s; + int32_t t; } stvert_t; typedef struct dtriangle_s { - int facesfront; - int vertindex[3]; + int32_t facesfront; + int32_t vertindex[3]; } dtriangle_t; #define DT_FACES_FRONT 0x0010 @@ -109,13 +109,13 @@ typedef struct { } daliasframe_t; typedef struct { - int numframes; + int32_t numframes; trivertx_t bboxmin; // lightnormal isn't used trivertx_t bboxmax; // lightnormal isn't used } daliasgroup_t; typedef struct { - int numskins; + int32_t numskins; } daliasskingroup_t; typedef struct { diff --git a/source/net.h b/source/net.h index d72d0a8..8580355 100644 --- a/source/net.h +++ b/source/net.h @@ -36,14 +36,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define NET_MAXMESSAGE 64000 /* ericw -- was 32000 */ -extern int DEFAULTnet_hostport; -extern int net_hostport; +extern int32_t DEFAULTnet_hostport; +extern int32_t net_hostport; extern cvar_t hostname; extern double net_time; extern sizebuf_t net_message; -extern int net_activeconnections; +extern int32_t net_activeconnections; void NET_Init (void); @@ -62,21 +62,21 @@ bool NET_CanSendMessage (struct qsocket_s *sock); // Returns true or false if the given qsocket can currently accept a // message to be transmitted. -int NET_GetMessage (struct qsocket_s *sock); +int32_t NET_GetMessage (struct qsocket_s *sock); // returns data in net_message sizebuf // returns 0 if no data is waiting // returns 1 if a message was received // returns 2 if an unreliable message was received // returns -1 if the connection died -int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data); -int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data); +int32_t NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data); +int32_t NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data); // returns 0 if the message connot be delivered reliably, but the connection // is still considered valid // returns 1 if the message was sent properly // returns -1 if the connection died -int NET_SendToAll(sizebuf_t *data, double blocktime); +int32_t NET_SendToAll(sizebuf_t *data, double blocktime); // This is a reliable *blocking* send to all attached clients. void NET_Close (struct qsocket_s *sock); @@ -96,12 +96,12 @@ extern bool slistInProgress; extern bool slistSilent; extern bool slistLocal; -extern int hostCacheCount; +extern int32_t hostCacheCount; void NET_Slist_f (void); void NET_SlistSort (void); -const char *NET_SlistPrintServer (int n); -const char *NET_SlistPrintServerName (int n); +const char *NET_SlistPrintServer (int32_t n); +const char *NET_SlistPrintServerName (int32_t n); /* FIXME: driver related, but public: diff --git a/source/net_defs.h b/source/net_defs.h index 81276c1..7035f04 100644 --- a/source/net_defs.h +++ b/source/net_defs.h @@ -138,20 +138,20 @@ typedef struct qsocket_s bool canSend; bool sendNext; - int driver; - int landriver; + int32_t driver; + int32_t landriver; sys_socket_t socket; void *driverdata; uint32_t ackSequence; uint32_t sendSequence; uint32_t unreliableSendSequence; - int sendMessageLength; + int32_t sendMessageLength; byte sendMessage [NET_MAXMESSAGE]; uint32_t receiveSequence; uint32_t unreliableReceiveSequence; - int receiveMessageLength; + int32_t receiveMessageLength; byte receiveMessage [NET_MAXMESSAGE]; struct qsockaddr addr; @@ -161,7 +161,7 @@ typedef struct qsocket_s extern qsocket_t *net_activeSockets; extern qsocket_t *net_freeSockets; -extern int net_numsockets; +extern int32_t net_numsockets; typedef struct { @@ -171,39 +171,39 @@ typedef struct sys_socket_t (*Init) (void); void (*Shutdown) (void); void (*Listen) (bool state); - sys_socket_t (*Open_Socket) (int port); - int (*Close_Socket) (sys_socket_t socketid); - int (*Connect) (sys_socket_t socketid, struct qsockaddr *addr); + sys_socket_t (*Open_Socket) (int32_t port); + int32_t (*Close_Socket) (sys_socket_t socketid); + int32_t (*Connect) (sys_socket_t socketid, struct qsockaddr *addr); sys_socket_t (*CheckNewConnections) (void); - int (*Read) (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); - int (*Write) (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); - int (*Broadcast) (sys_socket_t socketid, byte *buf, int len); + int32_t (*Read) (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr); + int32_t (*Write) (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr); + int32_t (*Broadcast) (sys_socket_t socketid, byte *buf, int32_t len); const char * (*AddrToString) (struct qsockaddr *addr); - int (*StringToAddr) (const char *string, struct qsockaddr *addr); - int (*GetSocketAddr) (sys_socket_t socketid, struct qsockaddr *addr); - int (*GetNameFromAddr) (struct qsockaddr *addr, char *name); - int (*GetAddrFromName) (const char *name, struct qsockaddr *addr); - int (*AddrCompare) (struct qsockaddr *addr1, struct qsockaddr *addr2); - int (*GetSocketPort) (struct qsockaddr *addr); - int (*SetSocketPort) (struct qsockaddr *addr, int port); + int32_t (*StringToAddr) (const char *string, struct qsockaddr *addr); + int32_t (*GetSocketAddr) (sys_socket_t socketid, struct qsockaddr *addr); + int32_t (*GetNameFromAddr) (struct qsockaddr *addr, char *name); + int32_t (*GetAddrFromName) (const char *name, struct qsockaddr *addr); + int32_t (*AddrCompare) (struct qsockaddr *addr1, struct qsockaddr *addr2); + int32_t (*GetSocketPort) (struct qsockaddr *addr); + int32_t (*SetSocketPort) (struct qsockaddr *addr, int32_t port); } net_landriver_t; #define MAX_NET_DRIVERS 8 extern net_landriver_t net_landrivers[]; -extern const int net_numlandrivers; +extern const int32_t net_numlandrivers; typedef struct { const char *name; bool initialized; - int (*Init) (void); + int32_t (*Init) (void); void (*Listen) (bool state); void (*SearchForHosts) (bool xmit); qsocket_t *(*Connect) (const char *host); qsocket_t *(*CheckNewConnections) (void); - int (*QGetMessage) (qsocket_t *sock); - int (*QSendMessage) (qsocket_t *sock, sizebuf_t *data); - int (*SendUnreliableMessage) (qsocket_t *sock, sizebuf_t *data); + int32_t (*QGetMessage) (qsocket_t *sock); + int32_t (*QSendMessage) (qsocket_t *sock, sizebuf_t *data); + int32_t (*SendUnreliableMessage) (qsocket_t *sock, sizebuf_t *data); bool (*CanSendMessage) (qsocket_t *sock); bool (*CanSendUnreliableMessage) (qsocket_t *sock); void (*Close) (qsocket_t *sock); @@ -211,17 +211,17 @@ typedef struct } net_driver_t; extern net_driver_t net_drivers[]; -extern const int net_numdrivers; +extern const int32_t net_numdrivers; /* Loop driver must always be registered the first */ #define IS_LOOP_DRIVER(p) ((p) == 0) -extern int net_driverlevel; +extern int32_t net_driverlevel; -extern int messagesSent; -extern int messagesReceived; -extern int unreliableMessagesSent; -extern int unreliableMessagesReceived; +extern int32_t messagesSent; +extern int32_t messagesReceived; +extern int32_t unreliableMessagesSent; +extern int32_t unreliableMessagesReceived; qsocket_t *NET_NewQSocket (void); void NET_FreeQSocket(qsocket_t *); @@ -235,14 +235,14 @@ typedef struct char name[16]; char map[16]; char cname[32]; - int users; - int maxusers; - int driver; - int ldriver; + int32_t users; + int32_t maxusers; + int32_t driver; + int32_t ldriver; struct qsockaddr addr; } hostcache_t; -extern int hostCacheCount; +extern int32_t hostCacheCount; extern hostcache_t hostcache[HOSTCACHESIZE]; diff --git a/source/net_dgrm.c b/source/net_dgrm.c index 71e8410..42fb41e 100644 --- a/source/net_dgrm.c +++ b/source/net_dgrm.c @@ -33,15 +33,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define sfunc net_landrivers[sock->landriver] #define dfunc net_landrivers[net_landriverlevel] -static int net_landriverlevel; +static int32_t net_landriverlevel; /* statistic counters */ -static int packetsSent = 0; -static int packetsReSent = 0; -static int packetsReceived = 0; -static int receivedDuplicateCount = 0; -static int shortPacketCount = 0; -static int droppedDatagrams; +static int32_t packetsSent = 0; +static int32_t packetsReSent = 0; +static int32_t packetsReceived = 0; +static int32_t receivedDuplicateCount = 0; +static int32_t shortPacketCount = 0; +static int32_t droppedDatagrams; static struct { @@ -50,7 +50,7 @@ static struct byte data[MAX_DATAGRAM]; } packetBuffer; -static int myDriverLevel; +static int32_t myDriverLevel; extern bool m_return_onerror; extern char m_return_reason[32]; @@ -60,7 +60,7 @@ static char *StrAddr (struct qsockaddr *addr) { static char buf[34]; byte *p = (byte *)addr; - int n; + int32_t n; for (n = 0; n < 16; n++) sprintf (buf + n * 2, "%02x", *p++); @@ -129,7 +129,7 @@ static void NET_Ban_f (void) #endif // BAN_TEST -int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data) +int32_t Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data) { uint32_t packetLen; uint32_t dataLen; @@ -176,7 +176,7 @@ int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data) } -static int SendMessageNext (qsocket_t *sock) +static int32_t SendMessageNext (qsocket_t *sock) { uint32_t packetLen; uint32_t dataLen; @@ -209,7 +209,7 @@ static int SendMessageNext (qsocket_t *sock) } -static int ReSendMessage (qsocket_t *sock) +static int32_t ReSendMessage (qsocket_t *sock) { uint32_t packetLen; uint32_t dataLen; @@ -258,9 +258,9 @@ bool Datagram_CanSendUnreliableMessage (qsocket_t *sock) } -int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) +int32_t Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) { - int packetLen; + int32_t packetLen; #ifdef DEBUG if (data->cursize == 0) @@ -284,11 +284,11 @@ int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) } -int Datagram_GetMessage (qsocket_t *sock) +int32_t Datagram_GetMessage (qsocket_t *sock) { uint32_t length; uint32_t flags; - int ret = 0; + int32_t ret = 0; struct qsockaddr readaddr; uint32_t sequence; uint32_t count; @@ -497,7 +497,7 @@ static const char *Strip_Port (const char *host) static char noport[MAX_QPATH]; /* array size as in Host_Connect_f() */ char *p; - int port; + int32_t port; if (!host || !*host) return host; @@ -516,8 +516,8 @@ static const char *Strip_Port (const char *host) static bool testInProgress = false; -static int testPollCount; -static int testDriver; +static int32_t testPollCount; +static int32_t testDriver; static sys_socket_t testSocket; static void Test_Poll (void *); @@ -526,13 +526,13 @@ static PollProcedure testPollProcedure = {NULL, 0.0, Test_Poll}; static void Test_Poll (void *unused) { struct qsockaddr clientaddr; - int control; - int len; + int32_t control; + int32_t len; char name[32]; char address[64]; - int colors; - int frags; - int connectTime; + int32_t colors; + int32_t frags; + int32_t connectTime; (void)unused; @@ -541,17 +541,17 @@ static void Test_Poll (void *unused) while (1) { len = dfunc.Read (testSocket, net_message.data, net_message.maxsize, &clientaddr); - if (len < (int) sizeof(int)) + if (len < (int32_t) sizeof(int32_t)) break; net_message.cursize = len; MSG_BeginReading (); - control = BigLong(*((int *)net_message.data)); + control = BigLong(*((int32_t *)net_message.data)); MSG_ReadLong(); if (control == -1) break; - if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) + if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL) break; if ((control & NETFLAG_LENGTH_MASK) != len) break; @@ -584,8 +584,8 @@ static void Test_Poll (void *unused) static void Test_f (void) { const char *host; - int n; - int maxusers = MAX_SCOREBOARD; + int32_t n; + int32_t maxusers = MAX_SCOREBOARD; struct qsockaddr sendaddr; if (testInProgress) @@ -643,7 +643,7 @@ JustDoIt: MSG_WriteLong(&net_message, 0); MSG_WriteByte(&net_message, CCREQ_PLAYER_INFO); MSG_WriteByte(&net_message, n); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (testSocket, net_message.data, net_message.cursize, &sendaddr); } SZ_Clear(&net_message); @@ -652,7 +652,7 @@ JustDoIt: static bool test2InProgress = false; -static int test2Driver; +static int32_t test2Driver; static sys_socket_t test2Socket; static void Test2_Poll (void *); @@ -661,8 +661,8 @@ static PollProcedure test2PollProcedure = {NULL, 0.0, Test2_Poll}; static void Test2_Poll (void *unused) { struct qsockaddr clientaddr; - int control; - int len; + int32_t control; + int32_t len; char name[256]; char value[256]; @@ -672,17 +672,17 @@ static void Test2_Poll (void *unused) name[0] = 0; len = dfunc.Read (test2Socket, net_message.data, net_message.maxsize, &clientaddr); - if (len < (int) sizeof(int)) + if (len < (int32_t) sizeof(int32_t)) goto Reschedule; net_message.cursize = len; MSG_BeginReading (); - control = BigLong(*((int *)net_message.data)); + control = BigLong(*((int32_t *)net_message.data)); MSG_ReadLong(); if (control == -1) goto Error; - if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) + if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL) goto Error; if ((control & NETFLAG_LENGTH_MASK) != len) goto Error; @@ -702,7 +702,7 @@ static void Test2_Poll (void *unused) MSG_WriteLong(&net_message, 0); MSG_WriteByte(&net_message, CCREQ_RULE_INFO); MSG_WriteString(&net_message, name); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (test2Socket, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); @@ -721,7 +721,7 @@ Done: static void Test2_f (void) { const char *host; - int n; + int32_t n; struct qsockaddr sendaddr; if (test2InProgress) @@ -776,16 +776,16 @@ JustDoIt: MSG_WriteLong(&net_message, 0); MSG_WriteByte(&net_message, CCREQ_RULE_INFO); MSG_WriteString(&net_message, ""); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (test2Socket, net_message.data, net_message.cursize, &sendaddr); SZ_Clear(&net_message); SchedulePollProcedure(&test2PollProcedure, 0.05); } -int Datagram_Init (void) +int32_t Datagram_Init (void) { - int i, num_inited; + int32_t i, num_inited; sys_socket_t csock; #ifdef BAN_TEST @@ -825,7 +825,7 @@ int Datagram_Init (void) void Datagram_Shutdown (void) { - int i; + int32_t i; // // shutdown the lan drivers @@ -849,7 +849,7 @@ void Datagram_Close (qsocket_t *sock) void Datagram_Listen (bool state) { - int i; + int32_t i; for (i = 0; i < net_numlandrivers; i++) { @@ -867,10 +867,10 @@ static qsocket_t *_Datagram_CheckNewConnections (void) sys_socket_t acceptsock; qsocket_t *sock; qsocket_t *s; - int len; - int command; - int control; - int ret; + int32_t len; + int32_t command; + int32_t control; + int32_t ret; acceptsock = dfunc.CheckNewConnections(); if (acceptsock == INVALID_SOCKET) @@ -879,16 +879,16 @@ static qsocket_t *_Datagram_CheckNewConnections (void) SZ_Clear(&net_message); len = dfunc.Read (acceptsock, net_message.data, net_message.maxsize, &clientaddr); - if (len < (int) sizeof(int)) + if (len < (int32_t) sizeof(int32_t)) return NULL; net_message.cursize = len; MSG_BeginReading (); - control = BigLong(*((int *)net_message.data)); + control = BigLong(*((int32_t *)net_message.data)); MSG_ReadLong(); if (control == -1) return NULL; - if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) + if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL) return NULL; if ((control & NETFLAG_LENGTH_MASK) != len) return NULL; @@ -910,7 +910,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void) MSG_WriteByte(&net_message, net_activeconnections); MSG_WriteByte(&net_message, svs.maxclients); MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); return NULL; @@ -918,9 +918,9 @@ static qsocket_t *_Datagram_CheckNewConnections (void) if (command == CCREQ_PLAYER_INFO) { - int playerNumber; - int activeNumber; - int clientNumber; + int32_t playerNumber; + int32_t activeNumber; + int32_t clientNumber; client_t *client; playerNumber = MSG_ReadByte(); @@ -946,10 +946,10 @@ static qsocket_t *_Datagram_CheckNewConnections (void) MSG_WriteByte(&net_message, playerNumber); MSG_WriteString(&net_message, client->name); MSG_WriteLong(&net_message, client->colors); - MSG_WriteLong(&net_message, (int)client->edict->v.frags); - MSG_WriteLong(&net_message, (int)(net_time - client->netconnection->connecttime)); + MSG_WriteLong(&net_message, (int32_t)client->edict->v.frags); + MSG_WriteLong(&net_message, (int32_t)(net_time - client->netconnection->connecttime)); MSG_WriteString(&net_message, client->netconnection->address); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); @@ -975,7 +975,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void) MSG_WriteString(&net_message, var->name); MSG_WriteString(&net_message, var->string); } - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); @@ -995,7 +995,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void) MSG_WriteLong(&net_message, 0); MSG_WriteByte(&net_message, CCREP_REJECT); MSG_WriteString(&net_message, "Incompatible version.\n"); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); return NULL; @@ -1014,7 +1014,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void) MSG_WriteLong(&net_message, 0); MSG_WriteByte(&net_message, CCREP_REJECT); MSG_WriteString(&net_message, "You have been banned.\n"); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); return NULL; @@ -1040,7 +1040,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void) MSG_WriteByte(&net_message, CCREP_ACCEPT); dfunc.GetSocketAddr(s->socket, &newaddr); MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr)); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); return NULL; @@ -1062,7 +1062,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void) MSG_WriteLong(&net_message, 0); MSG_WriteByte(&net_message, CCREP_REJECT); MSG_WriteString(&net_message, "Server is full.\n"); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); return NULL; @@ -1098,7 +1098,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void) dfunc.GetSocketAddr(newsock, &newaddr); MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr)); // MSG_WriteString(&net_message, dfunc.AddrToString(&newaddr)); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr); SZ_Clear(&net_message); @@ -1123,12 +1123,12 @@ qsocket_t *Datagram_CheckNewConnections (void) static void _Datagram_SearchForHosts (bool xmit) { - int ret; - int n; - int i; + int32_t ret; + int32_t n; + int32_t i; struct qsockaddr readaddr; struct qsockaddr myaddr; - int control; + int32_t control; dfunc.GetSocketAddr (dfunc.controlSock, &myaddr); if (xmit) @@ -1139,14 +1139,14 @@ static void _Datagram_SearchForHosts (bool xmit) MSG_WriteByte(&net_message, CCREQ_SERVER_INFO); MSG_WriteString(&net_message, "QUAKE"); MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Broadcast(dfunc.controlSock, net_message.data, net_message.cursize); SZ_Clear(&net_message); } while ((ret = dfunc.Read (dfunc.controlSock, net_message.data, net_message.maxsize, &readaddr)) > 0) { - if (ret < (int) sizeof(int)) + if (ret < (int32_t) sizeof(int32_t)) continue; net_message.cursize = ret; @@ -1159,11 +1159,11 @@ static void _Datagram_SearchForHosts (bool xmit) continue; MSG_BeginReading (); - control = BigLong(*((int *)net_message.data)); + control = BigLong(*((int32_t *)net_message.data)); MSG_ReadLong(); if (control == -1) continue; - if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) + if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL) continue; if ((control & NETFLAG_LENGTH_MASK) != ret) continue; @@ -1241,10 +1241,10 @@ static qsocket_t *_Datagram_Connect (const char *host) struct qsockaddr readaddr; qsocket_t *sock; sys_socket_t newsock; - int ret; - int reps; + int32_t ret; + int32_t reps; double start_time; - int control; + int32_t control; const char *reason; // see if we can resolve the host name @@ -1281,7 +1281,7 @@ static qsocket_t *_Datagram_Connect (const char *host) MSG_WriteByte(&net_message, CCREQ_CONNECT); MSG_WriteString(&net_message, "QUAKE"); MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION); - *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); + *((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); dfunc.Write (newsock, net_message.data, net_message.cursize, &sendaddr); SZ_Clear(&net_message); do @@ -1301,7 +1301,7 @@ static qsocket_t *_Datagram_Connect (const char *host) continue; } - if (ret < (int) sizeof(int)) + if (ret < (int32_t) sizeof(int32_t)) { ret = 0; continue; @@ -1310,14 +1310,14 @@ static qsocket_t *_Datagram_Connect (const char *host) net_message.cursize = ret; MSG_BeginReading (); - control = BigLong(*((int *)net_message.data)); + control = BigLong(*((int32_t *)net_message.data)); MSG_ReadLong(); if (control == -1) { ret = 0; continue; } - if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) + if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL) { ret = 0; continue; diff --git a/source/net_dgrm.h b/source/net_dgrm.h index ed09dd1..32517c6 100644 --- a/source/net_dgrm.h +++ b/source/net_dgrm.h @@ -22,14 +22,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __NET_DATAGRAM_H #define __NET_DATAGRAM_H -int Datagram_Init (void); +int32_t Datagram_Init (void); void Datagram_Listen (bool state); void Datagram_SearchForHosts (bool xmit); qsocket_t *Datagram_Connect (const char *host); qsocket_t *Datagram_CheckNewConnections (void); -int Datagram_GetMessage (qsocket_t *sock); -int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data); -int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); +int32_t Datagram_GetMessage (qsocket_t *sock); +int32_t Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data); +int32_t Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); bool Datagram_CanSendMessage (qsocket_t *sock); bool Datagram_CanSendUnreliableMessage (qsocket_t *sock); void Datagram_Close (qsocket_t *sock); diff --git a/source/net_loop.c b/source/net_loop.c index 7874634..8ca4bfb 100644 --- a/source/net_loop.c +++ b/source/net_loop.c @@ -30,7 +30,7 @@ static bool localconnectpending = false; static qsocket_t *loop_client = NULL; static qsocket_t *loop_server = NULL; -int Loop_Init (void) +int32_t Loop_Init (void) { if (cls.state == ca_dedicated) return -1; @@ -125,16 +125,16 @@ qsocket_t *Loop_CheckNewConnections (void) } -static int IntAlign(int value) +static int32_t IntAlign(int32_t value) { - return (value + (sizeof(int) - 1)) & (~(sizeof(int) - 1)); + return (value + (sizeof(int32_t) - 1)) & (~(sizeof(int32_t) - 1)); } -int Loop_GetMessage (qsocket_t *sock) +int32_t Loop_GetMessage (qsocket_t *sock) { - int ret; - int length; + int32_t ret; + int32_t length; if (sock->receiveMessageLength == 0) return 0; @@ -158,10 +158,10 @@ int Loop_GetMessage (qsocket_t *sock) } -int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data) +int32_t Loop_SendMessage (qsocket_t *sock, sizebuf_t *data) { byte *buffer; - int *bufferLength; + int32_t *bufferLength; if (!sock->driverdata) return -1; @@ -192,10 +192,10 @@ int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data) } -int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) +int32_t Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) { byte *buffer; - int *bufferLength; + int32_t *bufferLength; if (!sock->driverdata) return -1; diff --git a/source/net_loop.h b/source/net_loop.h index 0817a6a..def5c93 100644 --- a/source/net_loop.h +++ b/source/net_loop.h @@ -23,14 +23,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __NET_LOOP_H // net_loop.h -int Loop_Init (void); +int32_t Loop_Init (void); void Loop_Listen (bool state); void Loop_SearchForHosts (bool xmit); qsocket_t *Loop_Connect (const char *host); qsocket_t *Loop_CheckNewConnections (void); -int Loop_GetMessage (qsocket_t *sock); -int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data); -int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); +int32_t Loop_GetMessage (qsocket_t *sock); +int32_t Loop_SendMessage (qsocket_t *sock, sizebuf_t *data); +int32_t Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); bool Loop_CanSendMessage (qsocket_t *sock); bool Loop_CanSendUnreliableMessage (qsocket_t *sock); void Loop_Close (qsocket_t *sock); diff --git a/source/net_main.c b/source/net_main.c index 038f30d..fd6e78c 100644 --- a/source/net_main.c +++ b/source/net_main.c @@ -27,13 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. qsocket_t *net_activeSockets = NULL; qsocket_t *net_freeSockets = NULL; -int net_numsockets = 0; +int32_t net_numsockets = 0; bool ipxAvailable = false; bool tcpipAvailable = false; -int net_hostport; -int DEFAULTnet_hostport = 26000; +int32_t net_hostport; +int32_t DEFAULTnet_hostport = 26000; char my_ipx_address[NET_NAMELEN]; char my_tcpip_address[NET_NAMELEN]; @@ -44,7 +44,7 @@ bool slistInProgress = false; bool slistSilent = false; bool slistLocal = true; static double slistStartTime; -static int slistLastShown; +static int32_t slistLastShown; static void Slist_Send (void *); static void Slist_Poll (void *); @@ -52,12 +52,12 @@ static PollProcedure slistSendProcedure = {NULL, 0.0, Slist_Send}; static PollProcedure slistPollProcedure = {NULL, 0.0, Slist_Poll}; sizebuf_t net_message; -int net_activeconnections = 0; +int32_t net_activeconnections = 0; -int messagesSent = 0; -int messagesReceived = 0; -int unreliableMessagesSent = 0; -int unreliableMessagesReceived = 0; +int32_t messagesSent = 0; +int32_t messagesReceived = 0; +int32_t unreliableMessagesSent = 0; +int32_t unreliableMessagesReceived = 0; static cvar_t net_messagetimeout = {"net_messagetimeout","300",CVAR_NONE}; cvar_t hostname = {"hostname", "UNNAMED", CVAR_NONE}; @@ -66,7 +66,7 @@ cvar_t hostname = {"hostname", "UNNAMED", CVAR_NONE}; #define sfunc net_drivers[sock->driver] #define dfunc net_drivers[net_driverlevel] -int net_driverlevel; +int32_t net_driverlevel; double net_time; @@ -187,7 +187,7 @@ static void NET_Listen_f (void) static void MaxPlayers_f (void) { - int n; + int32_t n; if (Cmd_Argc () != 2) { @@ -226,7 +226,7 @@ static void MaxPlayers_f (void) static void NET_Port_f (void) { - int n; + int32_t n; if (Cmd_Argc () != 2) { @@ -263,7 +263,7 @@ static void PrintSlistHeader(void) static void PrintSlist(void) { - int n; + int32_t n; for (n = slistLastShown; n < hostCacheCount; n++) { @@ -310,7 +310,7 @@ void NET_SlistSort (void) { if (hostCacheCount > 1) { - int i, j; + int32_t i, j; hostcache_t temp; for (i = 0; i < hostCacheCount; i++) { @@ -328,7 +328,7 @@ void NET_SlistSort (void) } -const char *NET_SlistPrintServer (int idx) +const char *NET_SlistPrintServer (int32_t idx) { static char string[64]; @@ -351,7 +351,7 @@ const char *NET_SlistPrintServer (int idx) } -const char *NET_SlistPrintServerName (int idx) +const char *NET_SlistPrintServerName (int32_t idx) { if (idx < 0 || idx >= hostCacheCount) return ""; @@ -411,14 +411,14 @@ NET_Connect =================== */ -int hostCacheCount = 0; +int32_t hostCacheCount = 0; hostcache_t hostcache[HOSTCACHESIZE]; qsocket_t *NET_Connect (const char *host) { qsocket_t *ret; - int n; - int numdrivers = net_numdrivers; + int32_t n; + int32_t numdrivers = net_numdrivers; SetNetTime(); @@ -554,9 +554,9 @@ returns 1 if a message was received returns -1 if connection is invalid ================= */ -int NET_GetMessage (qsocket_t *sock) +int32_t NET_GetMessage (qsocket_t *sock) { - int ret; + int32_t ret; if (!sock) return -1; @@ -608,9 +608,9 @@ returns 1 if the message was sent properly returns -1 if the connection died ================== */ -int NET_SendMessage (qsocket_t *sock, sizebuf_t *data) +int32_t NET_SendMessage (qsocket_t *sock, sizebuf_t *data) { - int r; + int32_t r; if (!sock) return -1; @@ -630,9 +630,9 @@ int NET_SendMessage (qsocket_t *sock, sizebuf_t *data) } -int NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) +int32_t NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) { - int r; + int32_t r; if (!sock) return -1; @@ -674,11 +674,11 @@ bool NET_CanSendMessage (qsocket_t *sock) } -int NET_SendToAll (sizebuf_t *data, double blocktime) +int32_t NET_SendToAll (sizebuf_t *data, double blocktime) { double start; - int i; - int count = 0; + int32_t i; + int32_t count = 0; bool msg_init[MAX_SCOREBOARD]; /* did we write the message to the client's connection */ bool msg_sent[MAX_SCOREBOARD]; /* did the msg arrive its destination (canSend state). */ @@ -761,7 +761,7 @@ NET_Init void NET_Init (void) { - int i; + int32_t i; qsocket_t *s; i = COM_CheckParm ("-port"); diff --git a/source/net_sys.h b/source/net_sys.h index 3dfbdd8..9d4541d 100644 --- a/source/net_sys.h +++ b/source/net_sys.h @@ -61,7 +61,7 @@ #include #include -typedef int sys_socket_t; +typedef int32_t sys_socket_t; #define INVALID_SOCKET (-1) #define SOCKET_ERROR (-1) @@ -95,7 +95,7 @@ _Static_assert(offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET, #include #include -typedef int sys_socket_t; +typedef int32_t sys_socket_t; #define INVALID_SOCKET (-1) #define SOCKET_ERROR (-1) @@ -142,7 +142,7 @@ typedef u_long in_addr_t; /* uint32_t */ /* on windows, socklen_t is to be a winsock2 thing */ #if !defined(IP_MSFILTER_SIZE) -typedef int socklen_t; +typedef int32_t socklen_t; #endif /* socklen_t type */ typedef SOCKET sys_socket_t; diff --git a/source/pr_cmds.c b/source/pr_cmds.c index 5d5120a..4a9cd00 100644 --- a/source/pr_cmds.c +++ b/source/pr_cmds.c @@ -32,7 +32,7 @@ static char *PR_GetTempString (void) return pr_string_temp[(STRINGTEMP_BUFFERS-1) & ++pr_string_tempindex]; } -#define RETURN_EDICT(e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e)) +#define RETURN_EDICT(e) (((int32_t *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e)) #define MSG_BROADCAST 0 // unreliable to all #define MSG_ONE 1 // reliable to one (msg_entity) @@ -47,9 +47,9 @@ static char *PR_GetTempString (void) =============================================================================== */ -static char *PF_VarString (int first) +static char *PF_VarString (int32_t first) { - int i; + int32_t i; static char out[1024]; size_t s; @@ -68,7 +68,7 @@ static char *PF_VarString (int first) { if (!dev_overflows.varstring || dev_overflows.varstring + CONSOLE_RESPAM_TIME < realtime) { - Con_DWarning("PF_VarString: %i characters exceeds standard limit of 255 (max = %d).\n", (int) s, (int)(sizeof(out) - 1)); + Con_DWarning("PF_VarString: %i characters exceeds standard limit of 255 (max = %d).\n", (int32_t) s, (int32_t)(sizeof(out) - 1)); dev_overflows.varstring = realtime; } } @@ -174,7 +174,7 @@ static void SetMinMaxSize (edict_t *e, float *minvec, float *maxvec, bool rotate float xvector[2], yvector[2]; float a; vec3_t base, transformed; - int i, j, k, l; + int32_t i, j, k, l; for (i = 0; i < 3; i++) if (minvec[i] > maxvec[i]) @@ -270,7 +270,7 @@ setmodel(entity, model) */ static void PF_setmodel (void) { - int i; + int32_t i; const char *m, **check; qmodel_t *mod; edict_t *e; @@ -292,7 +292,7 @@ static void PF_setmodel (void) e->v.model = PR_SetEngineString(*check); e->v.modelindex = i; //SV_ModelIndex (m); - mod = sv.models[ (int)e->v.modelindex]; // Mod_ForName (m, true); + mod = sv.models[ (int32_t)e->v.modelindex]; // Mod_ForName (m, true); if (mod) //johnfitz -- correct physics cullboxes for bmodels @@ -337,7 +337,7 @@ static void PF_sprint (void) { char *s; client_t *client; - int entnum; + int32_t entnum; entnum = G_EDICTNUM(OFS_PARM0); s = PF_VarString(1); @@ -368,7 +368,7 @@ static void PF_centerprint (void) { char *s; client_t *client; - int entnum; + int32_t entnum; entnum = G_EDICTNUM(OFS_PARM0); s = PF_VarString(1); @@ -455,7 +455,7 @@ static void PF_vectoyaw (void) yaw = 0; else { - yaw = (int) (atan2(value1[1], value1[0]) * 180 / M_PI); + yaw = (int32_t) (atan2(value1[1], value1[0]) * 180 / M_PI); if (yaw < 0) yaw += 360; } @@ -489,12 +489,12 @@ static void PF_vectoangles (void) } else { - yaw = (int) (atan2(value1[1], value1[0]) * 180 / M_PI); + yaw = (int32_t) (atan2(value1[1], value1[0]) * 180 / M_PI); if (yaw < 0) yaw += 360; forward = sqrt (value1[0]*value1[0] + value1[1]*value1[1]); - pitch = (int) (atan2(value1[2], forward) * 180 / M_PI); + pitch = (int32_t) (atan2(value1[2], forward) * 180 / M_PI); if (pitch < 0) pitch += 360; } @@ -554,8 +554,8 @@ static void PF_ambientsound (void) const char *samp, **check; float *pos; float vol, attenuation; - int i, soundnum; - int large = false; //johnfitz -- PROTOCOL_FITZQUAKE + int32_t i, soundnum; + int32_t large = false; //johnfitz -- PROTOCOL_FITZQUAKE pos = G_VECTOR (OFS_PARM0); samp = G_STRING(OFS_PARM1); @@ -627,9 +627,9 @@ Larger attenuations will drop off. static void PF_sound (void) { const char *sample; - int channel; + int32_t channel; edict_t *entity; - int volume; + int32_t volume; float attenuation; entity = G_EDICT(OFS_PARM0); @@ -660,7 +660,7 @@ break() static void PF_break (void) { Con_Printf ("break statement\n"); - *(int *)-4 = 0; // dump to debugger + *(int32_t *)-4 = 0; // dump to debugger // PR_RunError ("break statement"); } @@ -679,7 +679,7 @@ static void PF_traceline (void) { float *v1, *v2; trace_t trace; - int nomonsters; + int32_t nomonsters; edict_t *ent; v1 = G_VECTOR(OFS_PARM0); @@ -736,16 +736,16 @@ static void PF_checkpos (void) //============================================================================ static byte *checkpvs; //ericw -- changed to malloc -static int checkpvs_capacity; +static int32_t checkpvs_capacity; -static int PF_newcheckclient (int check) +static int32_t PF_newcheckclient (int32_t check) { - int i; + int32_t i; byte *pvs; edict_t *ent; mleaf_t *leaf; vec3_t org; - int pvsbytes; + int32_t pvsbytes; // cycle to the next one @@ -773,7 +773,7 @@ static int PF_newcheckclient (int check) continue; if (ent->v.health <= 0) continue; - if ((int)ent->v.flags & FL_NOTARGET) + if ((int32_t)ent->v.flags & FL_NOTARGET) continue; // anything that is a client, or has a client as an enemy @@ -814,12 +814,12 @@ name checkclient () ================= */ #define MAX_CHECK 16 -static int c_invis, c_notvis; +static int32_t c_invis, c_notvis; static void PF_checkclient (void) { edict_t *ent, *self; mleaf_t *leaf; - int l; + int32_t l; vec3_t view; // find a new check if on a new frame @@ -868,7 +868,7 @@ stuffcmd (clientent, value) */ static void PF_stuffcmd (void) { - int entnum; + int32_t entnum; const char *str; client_t *old; @@ -948,7 +948,7 @@ static void PF_findradius (void) float rad; float *org; vec3_t eorg; - int i, j; + int32_t i, j; chain = (edict_t *)sv.edicts; @@ -991,8 +991,8 @@ static void PF_ftos (void) v = G_FLOAT(OFS_PARM0); s = PR_GetTempString(); - if (v == (int)v) - sprintf (s, "%d",(int)v); + if (v == (int32_t)v) + sprintf (s, "%d",(int32_t)v); else sprintf (s, "%5.1f",v); G_INT(OFS_RETURN) = PR_SetEngineString(s); @@ -1035,8 +1035,8 @@ static void PF_Remove (void) // entity (entity start, .string field, string match) find = #5; static void PF_Find (void) { - int e; - int f; + int32_t e; + int32_t f; const char *s, *t; edict_t *ed; @@ -1078,7 +1078,7 @@ static void PF_precache_file (void) static void PF_precache_sound (void) { const char *s; - int i; + int32_t i; if (sv.state != ss_loading) PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions"); @@ -1103,7 +1103,7 @@ static void PF_precache_sound (void) static void PF_precache_model (void) { const char *s; - int i; + int32_t i; if (sv.state != ss_loading) PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions"); @@ -1160,13 +1160,13 @@ static void PF_walkmove (void) float yaw, dist; vec3_t move; dfunction_t *oldf; - int oldself; + int32_t oldself; ent = PROG_TO_EDICT(pr_global_struct->self); yaw = G_FLOAT(OFS_PARM0); dist = G_FLOAT(OFS_PARM1); - if ( !( (int)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) ) + if ( !( (int32_t)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) ) { G_FLOAT(OFS_RETURN) = 0; return; @@ -1216,7 +1216,7 @@ static void PF_droptofloor (void) { VectorCopy (trace.endpos, ent->v.origin); SV_LinkEdict (ent, false); - ent->v.flags = (int)ent->v.flags | FL_ONGROUND; + ent->v.flags = (int32_t)ent->v.flags | FL_ONGROUND; ent->v.groundentity = EDICT_TO_PROG(trace.ent); G_FLOAT(OFS_RETURN) = 1; } @@ -1231,10 +1231,10 @@ void(float style, string value) lightstyle */ static void PF_lightstyle (void) { - int style; + int32_t style; const char *val; client_t *client; - int j; + int32_t j; style = G_FLOAT(OFS_PARM0); val = G_STRING(OFS_PARM1); @@ -1269,9 +1269,9 @@ static void PF_rint (void) float f; f = G_FLOAT(OFS_PARM0); if (f > 0) - G_FLOAT(OFS_RETURN) = (int)(f + 0.5); + G_FLOAT(OFS_RETURN) = (int32_t)(f + 0.5); else - G_FLOAT(OFS_RETURN) = (int)(f - 0.5); + G_FLOAT(OFS_RETURN) = (int32_t)(f - 0.5); } static void PF_floor (void) @@ -1322,7 +1322,7 @@ entity nextent(entity) */ static void PF_nextent (void) { - int i; + int32_t i; edict_t *ent; i = G_EDICTNUM(OFS_PARM0); @@ -1356,7 +1356,7 @@ static void PF_aim (void) { edict_t *ent, *check, *bestent; vec3_t start, dir, end, bestdir; - int i, j; + int32_t i, j; trace_t tr; float dist, bestdist; float speed; @@ -1477,8 +1477,8 @@ MESSAGE WRITING static sizebuf_t *WriteDest (void) { - int entnum; - int dest; + int32_t entnum; + int32_t dest; edict_t *ent; dest = G_FLOAT(OFS_PARM0); @@ -1553,8 +1553,8 @@ static void PF_WriteEntity (void) static void PF_makestatic (void) { edict_t *ent; - int i; - int bits = 0; //johnfitz -- PROTOCOL_FITZQUAKE + int32_t i; + int32_t bits = 0; //johnfitz -- PROTOCOL_FITZQUAKE ent = G_EDICT(OFS_PARM0); @@ -1568,7 +1568,7 @@ static void PF_makestatic (void) //johnfitz -- PROTOCOL_FITZQUAKE if (sv.protocol == PROTOCOL_NETQUAKE) { - if (SV_ModelIndex(PR_GetString(ent->v.model)) & 0xFF00 || (int)(ent->v.frame) & 0xFF00) + if (SV_ModelIndex(PR_GetString(ent->v.model)) & 0xFF00 || (int32_t)(ent->v.frame) & 0xFF00) { ED_Free (ent); return; //can't display the correct model & frame, so don't show it at all @@ -1578,7 +1578,7 @@ static void PF_makestatic (void) { if (SV_ModelIndex(PR_GetString(ent->v.model)) & 0xFF00) bits |= B_LARGEMODEL; - if ((int)(ent->v.frame) & 0xFF00) + if ((int32_t)(ent->v.frame) & 0xFF00) bits |= B_LARGEFRAME; if (ent->alpha != ENTALPHA_DEFAULT) bits |= B_ALPHA; @@ -1630,7 +1630,7 @@ PF_setspawnparms static void PF_setspawnparms (void) { edict_t *ent; - int i; + int32_t i; client_t *client; ent = G_EDICT(OFS_PARM0); @@ -1761,5 +1761,5 @@ static builtin_t pr_builtin[] = }; builtin_t *pr_builtins = pr_builtin; -int pr_numbuiltins = sizeof(pr_builtin)/sizeof(pr_builtin[0]); +int32_t pr_numbuiltins = sizeof(pr_builtin)/sizeof(pr_builtin[0]); diff --git a/source/pr_comp.h b/source/pr_comp.h index 9104dae..bcdbacc 100644 --- a/source/pr_comp.h +++ b/source/pr_comp.h @@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // this file is shared by quake and qcc -typedef int func_t; -typedef int string_t; +typedef int32_t func_t; +typedef int32_t string_t; typedef enum { @@ -143,7 +143,7 @@ typedef struct uint16_t type; // if DEF_SAVEGLOBAL bit is set // the variable needs to be saved in savegames uint16_t ofs; - int s_name; + int32_t s_name; } ddef_t; #define DEF_SAVEGLOBAL (1<<15) @@ -152,16 +152,16 @@ typedef struct typedef struct { - int first_statement; // negative numbers are builtins - int parm_start; - int locals; // total ints of parms + locals + int32_t first_statement; // negative numbers are builtins + int32_t parm_start; + int32_t locals; // total ints of parms + locals - int profile; // runtime + int32_t profile; // runtime - int s_name; - int s_file; // source file defined in + int32_t s_name; + int32_t s_file; // source file defined in - int numparms; + int32_t numparms; byte parm_size[MAX_PARMS]; } dfunction_t; @@ -169,28 +169,28 @@ typedef struct #define PROG_VERSION 6 typedef struct { - int version; - int crc; // check of header file + int32_t version; + int32_t crc; // check of header file - int ofs_statements; - int numstatements; // statement 0 is an error + int32_t ofs_statements; + int32_t numstatements; // statement 0 is an error - int ofs_globaldefs; - int numglobaldefs; + int32_t ofs_globaldefs; + int32_t numglobaldefs; - int ofs_fielddefs; - int numfielddefs; + int32_t ofs_fielddefs; + int32_t numfielddefs; - int ofs_functions; - int numfunctions; // function 0 is an empty + int32_t ofs_functions; + int32_t numfunctions; // function 0 is an empty - int ofs_strings; - int numstrings; // first string is a null string + int32_t ofs_strings; + int32_t numstrings; // first string is a null string - int ofs_globals; - int numglobals; + int32_t ofs_globals; + int32_t numglobals; - int entityfields; + int32_t entityfields; } dprograms_t; #endif /* __PR_COMP_H */ diff --git a/source/pr_edict.c b/source/pr_edict.c index 8e6bb97..33b2a6b 100644 --- a/source/pr_edict.c +++ b/source/pr_edict.c @@ -27,10 +27,10 @@ dprograms_t *progs; dfunction_t *pr_functions; static char *pr_strings; -static int pr_stringssize; +static int32_t pr_stringssize; static const char **pr_knownstrings; -static int pr_maxknownstrings; -static int pr_numknownstrings; +static int32_t pr_maxknownstrings; +static int32_t pr_numknownstrings; static ddef_t *pr_fielddefs; static ddef_t *pr_globaldefs; @@ -39,11 +39,11 @@ bool pr_alpha_supported; //johnfitz dstatement_t *pr_statements; globalvars_t *pr_global_struct; float *pr_globals; // same as pr_global_struct -int pr_edict_size; // in bytes +int32_t pr_edict_size; // in bytes uint16_t pr_crc; -int type_size[8] = { +int32_t type_size[8] = { 1, // ev_void 1, // sizeof(string_t) / 4 // ev_string 1, // ev_float @@ -54,7 +54,7 @@ int type_size[8] = { 1 // sizeof(void *) / 4 // ev_pointer }; -static ddef_t *ED_FieldAtOfs (int ofs); +static ddef_t *ED_FieldAtOfs (int32_t ofs); static bool ED_ParseEpair (void *base, ddef_t *key, const char *s); #define MAX_FIELD_LEN 64 @@ -109,7 +109,7 @@ angles and bad trails. */ edict_t *ED_Alloc (void) { - int i; + int32_t i; edict_t *e; for (i = svs.maxclients + 1; i < sv.num_edicts; i++) @@ -169,10 +169,10 @@ void ED_Free (edict_t *ed) ED_GlobalAtOfs ============ */ -static ddef_t *ED_GlobalAtOfs (int ofs) +static ddef_t *ED_GlobalAtOfs (int32_t ofs) { ddef_t *def; - int i; + int32_t i; for (i = 0; i < progs->numglobaldefs; i++) { @@ -188,10 +188,10 @@ static ddef_t *ED_GlobalAtOfs (int ofs) ED_FieldAtOfs ============ */ -static ddef_t *ED_FieldAtOfs (int ofs) +static ddef_t *ED_FieldAtOfs (int32_t ofs) { ddef_t *def; - int i; + int32_t i; for (i = 0; i < progs->numfielddefs; i++) { @@ -210,7 +210,7 @@ ED_FindField static ddef_t *ED_FindField (const char *name) { ddef_t *def; - int i; + int32_t i; for (i = 0; i < progs->numfielddefs; i++) { @@ -230,7 +230,7 @@ ED_FindGlobal static ddef_t *ED_FindGlobal (const char *name) { ddef_t *def; - int i; + int32_t i; for (i = 0; i < progs->numglobaldefs; i++) { @@ -250,7 +250,7 @@ ED_FindFunction static dfunction_t *ED_FindFunction (const char *fn_name) { dfunction_t *func; - int i; + int32_t i; for (i = 0; i < progs->numfunctions; i++) { @@ -269,8 +269,8 @@ GetEdictFieldValue eval_t *GetEdictFieldValue(edict_t *ed, const char *field) { ddef_t *def = NULL; - int i; - static int rep = 0; + int32_t i; + static int32_t rep = 0; for (i = 0; i < GEFV_CACHESIZE; i++) { @@ -306,7 +306,7 @@ PR_ValueString Returns a string describing *data in a type specific manner ============= */ -static const char *PR_ValueString (int type, eval_t *val) +static const char *PR_ValueString (int32_t type, eval_t *val) { static char line[512]; ddef_t *def; @@ -359,7 +359,7 @@ Returns a string describing *data in a type specific manner Easier to parse than PR_ValueString ============= */ -static const char *PR_UglyValueString (int type, eval_t *val) +static const char *PR_UglyValueString (int32_t type, eval_t *val) { static char line[512]; ddef_t *def; @@ -408,11 +408,11 @@ Returns a string with a description and the contents of a global, padded to 20 field width ============ */ -const char *PR_GlobalString (int ofs) +const char *PR_GlobalString (int32_t ofs) { static char line[512]; const char *s; - int i; + int32_t i; ddef_t *def; void *val; @@ -434,10 +434,10 @@ const char *PR_GlobalString (int ofs) return line; } -const char *PR_GlobalStringNoContents (int ofs) +const char *PR_GlobalStringNoContents (int32_t ofs) { static char line[512]; - int i; + int32_t i; ddef_t *def; def = ED_GlobalAtOfs(ofs); @@ -465,10 +465,10 @@ For debugging void ED_Print (edict_t *ed) { ddef_t *d; - int *v; - int i, j, l; + int32_t *v; + int32_t i, j, l; const char *name; - int type; + int32_t type; if (ed->free) { @@ -485,7 +485,7 @@ void ED_Print (edict_t *ed) if (l > 1 && name[l - 2] == '_') continue; // skip _x, _y, _z vars - v = (int *)((char *)&ed->v + d->ofs*4); + v = (int32_t *)((char *)&ed->v + d->ofs*4); // if the value is still all 0, skip the field type = d->type & ~DEF_SAVEGLOBAL; @@ -516,10 +516,10 @@ For savegames void ED_Write (FILE *f, edict_t *ed) { ddef_t *d; - int *v; - int i, j; + int32_t *v; + int32_t i, j; const char *name; - int type; + int32_t type; fprintf (f, "{\n"); @@ -537,7 +537,7 @@ void ED_Write (FILE *f, edict_t *ed) if (j > 1 && name[j - 2] == '_') continue; // skip _x, _y, _z vars - v = (int *)((char *)&ed->v + d->ofs*4); + v = (int32_t *)((char *)&ed->v + d->ofs*4); // if the value is still all 0, skip the field type = d->type & ~DEF_SAVEGLOBAL; @@ -561,7 +561,7 @@ void ED_Write (FILE *f, edict_t *ed) fprintf (f, "}\n"); } -void ED_PrintNum (int ent) +void ED_PrintNum (int32_t ent) { ED_Print (EDICT_NUM(ent)); } @@ -575,7 +575,7 @@ For debugging, prints all the entities in the current server */ void ED_PrintEdicts (void) { - int i; + int32_t i; if (!sv.active) return; @@ -594,7 +594,7 @@ For debugging, prints a single edicy */ static void ED_PrintEdict_f (void) { - int i; + int32_t i; if (!sv.active) return; @@ -618,7 +618,7 @@ For debugging static void ED_Count (void) { edict_t *ent; - int i, active, models, solid, step; + int32_t i, active, models, solid, step; if (!sv.active) return; @@ -663,9 +663,9 @@ ED_WriteGlobals void ED_WriteGlobals (FILE *f) { ddef_t *def; - int i; + int32_t i; const char *name; - int type; + int32_t type; fprintf (f, "{\n"); for (i = 0; i < progs->numglobaldefs; i++) @@ -739,7 +739,7 @@ ED_NewString static string_t ED_NewString (const char *string) { char *new_p; - int i, l; + int32_t i, l; string_t num; l = strlen(string) + 1; @@ -773,7 +773,7 @@ returns false if error */ static bool ED_ParseEpair (void *base, ddef_t *key, const char *s) { - int i; + int32_t i; char string[128]; ddef_t *def; char *v, *w; @@ -781,7 +781,7 @@ static bool ED_ParseEpair (void *base, ddef_t *key, const char *s) void *d; dfunction_t *func; - d = (void *)((int *)base + key->ofs); + d = (void *)((int32_t *)base + key->ofs); switch (key->type & ~DEF_SAVEGLOBAL) { @@ -819,7 +819,7 @@ static bool ED_ParseEpair (void *base, ddef_t *key, const char *s) break; case ev_entity: - *(int *)d = EDICT_TO_PROG(EDICT_NUM(atoi (s))); + *(int32_t *)d = EDICT_TO_PROG(EDICT_NUM(atoi (s))); break; case ev_field: @@ -831,7 +831,7 @@ static bool ED_ParseEpair (void *base, ddef_t *key, const char *s) Con_DPrintf ("Can't find field %s\n", s); return false; } - *(int *)d = G_INT(def->ofs); + *(int32_t *)d = G_INT(def->ofs); break; case ev_function: @@ -864,7 +864,7 @@ const char *ED_ParseEdict (const char *data, edict_t *ent) ddef_t *key; char keyname[256]; bool anglehack, init; - int n; + int32_t n; init = false; @@ -972,7 +972,7 @@ void ED_LoadFromFile (const char *data) { dfunction_t *func; edict_t *ent = NULL; - int inhibit = 0; + int32_t inhibit = 0; pr_global_struct->time = sv.time; @@ -995,16 +995,16 @@ void ED_LoadFromFile (const char *data) // remove things from different skill levels or deathmatch if (deathmatch.value) { - if (((int)ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH)) + if (((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH)) { ED_Free (ent); inhibit++; continue; } } - else if ((current_skill == 0 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_EASY)) - || (current_skill == 1 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_MEDIUM)) - || (current_skill >= 2 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_HARD)) ) + else if ((current_skill == 0 && ((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_EASY)) + || (current_skill == 1 && ((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_MEDIUM)) + || (current_skill >= 2 && ((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_HARD)) ) { ED_Free (ent); inhibit++; @@ -1048,7 +1048,7 @@ PR_LoadProgs */ void PR_LoadProgs (void) { - int i; + int32_t i; // flush the non-C variable lookup cache for (i = 0; i < GEFV_CACHESIZE; i++) @@ -1065,8 +1065,8 @@ void PR_LoadProgs (void) CRC_ProcessByte (&pr_crc, ((byte *)progs)[i]); // byte swap the header - for (i = 0; i < (int) sizeof(*progs) / 4; i++) - ((int *)progs)[i] = LittleLong ( ((int *)progs)[i] ); + for (i = 0; i < (int32_t) sizeof(*progs) / 4; i++) + ((int32_t *)progs)[i] = LittleLong ( ((int32_t *)progs)[i] ); if (progs->version != PROG_VERSION) Host_Error ("progs.dat has wrong version number (%i should be %i)", progs->version, PROG_VERSION); @@ -1137,7 +1137,7 @@ void PR_LoadProgs (void) } for (i = 0; i < progs->numglobals; i++) - ((int *)pr_globals)[i] = LittleLong (((int *)pr_globals)[i]); + ((int32_t *)pr_globals)[i] = LittleLong (((int32_t *)pr_globals)[i]); pr_edict_size = progs->entityfields * 4 + sizeof(edict_t) - sizeof(entvars_t); // round off to next highest whole word address (esp for Alpha) @@ -1173,16 +1173,16 @@ void PR_Init (void) } -edict_t *EDICT_NUM(int n) +edict_t *EDICT_NUM(int32_t n) { if (n < 0 || n >= sv.max_edicts) Host_Error ("EDICT_NUM: bad number %i", n); return (edict_t *)((byte *)sv.edicts + (n)*pr_edict_size); } -int NUM_FOR_EDICT(edict_t *e) +int32_t NUM_FOR_EDICT(edict_t *e) { - int b; + int32_t b; b = (byte *)e - (byte *)sv.edicts; b = b / pr_edict_size; @@ -1204,7 +1204,7 @@ static void PR_AllocStringSlots (void) pr_knownstrings = (const char **) Z_Realloc ((void *)pr_knownstrings, pr_maxknownstrings * sizeof(char *)); } -const char *PR_GetString (int num) +const char *PR_GetString (int32_t num) { if (num >= 0 && num < pr_stringssize) return pr_strings + num; @@ -1224,9 +1224,9 @@ const char *PR_GetString (int num) } } -int PR_SetEngineString (const char *s) +int32_t PR_SetEngineString (const char *s) { - int i; + int32_t i; if (!s) return 0; @@ -1235,7 +1235,7 @@ int PR_SetEngineString (const char *s) Host_Error("PR_SetEngineString: \"%s\" in pr_strings area\n", s); #else if (s >= pr_strings && s <= pr_strings + pr_stringssize - 2) - return (int)(s - pr_strings); + return (int32_t)(s - pr_strings); #endif for (i = 0; i < pr_numknownstrings; i++) { @@ -1261,9 +1261,9 @@ int PR_SetEngineString (const char *s) return -1 - i; } -int PR_AllocString (int size, char **ptr) +int32_t PR_AllocString (int32_t size, char **ptr) { - int i; + int32_t i; if (!size) return 0; diff --git a/source/pr_exec.c b/source/pr_exec.c index 7b75db2..c8275a1 100644 --- a/source/pr_exec.c +++ b/source/pr_exec.c @@ -23,22 +23,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { - int s; + int32_t s; dfunction_t *f; } prstack_t; #define MAX_STACK_DEPTH 64 /* was 32 */ static prstack_t pr_stack[MAX_STACK_DEPTH]; -static int pr_depth; +static int32_t pr_depth; #define LOCALSTACK_SIZE 2048 -static int localstack[LOCALSTACK_SIZE]; -static int localstack_used; +static int32_t localstack[LOCALSTACK_SIZE]; +static int32_t localstack_used; bool pr_trace; dfunction_t *pr_xfunction; -int pr_xstatement; -int pr_argc; +int32_t pr_xstatement; +int32_t pr_argc; static const char *pr_opnames[] = { @@ -129,8 +129,8 @@ static const char *pr_opnames[] = "BITOR" }; -const char *PR_GlobalString (int ofs); -const char *PR_GlobalStringNoContents (int ofs); +const char *PR_GlobalString (int32_t ofs); +const char *PR_GlobalStringNoContents (int32_t ofs); //============================================================================= @@ -142,7 +142,7 @@ PR_PrintStatement */ static void PR_PrintStatement (dstatement_t *s) { - int i; + int32_t i; if ((uint32_t)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0])) { @@ -182,7 +182,7 @@ PR_StackTrace */ static void PR_StackTrace (void) { - int i; + int32_t i; dfunction_t *f; if (pr_depth == 0) @@ -215,8 +215,8 @@ PR_Profile_f */ void PR_Profile_f (void) { - int i, num; - int pmax; + int32_t i, num; + int32_t pmax; dfunction_t *f, *best; if (!sv.active) @@ -280,9 +280,9 @@ PR_EnterFunction Returns the new program statement counter ==================== */ -static int PR_EnterFunction (dfunction_t *f) +static int32_t PR_EnterFunction (dfunction_t *f) { - int i, j, c, o; + int32_t i, j, c, o; pr_stack[pr_depth].s = pr_xstatement; pr_stack[pr_depth].f = pr_xfunction; @@ -296,7 +296,7 @@ static int PR_EnterFunction (dfunction_t *f) PR_RunError("PR_ExecuteProgram: locals stack overflow\n"); for (i = 0; i < c ; i++) - localstack[localstack_used + i] = ((int *)pr_globals)[f->parm_start + i]; + localstack[localstack_used + i] = ((int32_t *)pr_globals)[f->parm_start + i]; localstack_used += c; // copy parameters @@ -305,7 +305,7 @@ static int PR_EnterFunction (dfunction_t *f) { for (j = 0; j < f->parm_size[i]; j++) { - ((int *)pr_globals)[o] = ((int *)pr_globals)[OFS_PARM0 + i*3 + j]; + ((int32_t *)pr_globals)[o] = ((int32_t *)pr_globals)[OFS_PARM0 + i*3 + j]; o++; } } @@ -319,9 +319,9 @@ static int PR_EnterFunction (dfunction_t *f) PR_LeaveFunction ==================== */ -static int PR_LeaveFunction (void) +static int32_t PR_LeaveFunction (void) { - int i, c; + int32_t i, c; if (pr_depth <= 0) Host_Error("prog stack underflow"); @@ -333,7 +333,7 @@ static int PR_LeaveFunction (void) PR_RunError("PR_ExecuteProgram: locals stack underflow"); for (i = 0; i < c; i++) - ((int *)pr_globals)[pr_xfunction->parm_start + i] = localstack[localstack_used + i]; + ((int32_t *)pr_globals)[pr_xfunction->parm_start + i] = localstack[localstack_used + i]; // up stack pr_depth--; @@ -358,9 +358,9 @@ void PR_ExecuteProgram (func_t fnum) eval_t *ptr; dstatement_t *st; dfunction_t *f, *newf; - int profile, startprofile; + int32_t profile, startprofile; edict_t *ed; - int exitdepth; + int32_t exitdepth; if (!fnum || fnum >= progs->numfunctions) { @@ -436,11 +436,11 @@ void PR_ExecuteProgram (func_t fnum) break; case OP_BITAND: - OPC->_float = (int)OPA->_float & (int)OPB->_float; + OPC->_float = (int32_t)OPA->_float & (int32_t)OPB->_float; break; case OP_BITOR: - OPC->_float = (int)OPA->_float | (int)OPB->_float; + OPC->_float = (int32_t)OPA->_float | (int32_t)OPB->_float; break; case OP_GE: @@ -552,7 +552,7 @@ void PR_ExecuteProgram (func_t fnum) pr_xstatement = st - pr_statements; PR_RunError("assignment to world entity"); } - OPC->_int = (byte *)((int *)&ed->v + OPB->_int) - (byte *)sv.edicts; + OPC->_int = (byte *)((int32_t *)&ed->v + OPB->_int) - (byte *)sv.edicts; break; case OP_LOAD_F: @@ -564,7 +564,7 @@ void PR_ExecuteProgram (func_t fnum) #ifdef PARANOID NUM_FOR_EDICT(ed); // Make sure it's in range #endif - OPC->_int = ((eval_t *)((int *)&ed->v + OPB->_int))->_int; + OPC->_int = ((eval_t *)((int32_t *)&ed->v + OPB->_int))->_int; break; case OP_LOAD_V: @@ -572,7 +572,7 @@ void PR_ExecuteProgram (func_t fnum) #ifdef PARANOID NUM_FOR_EDICT(ed); // Make sure it's in range #endif - ptr = (eval_t *)((int *)&ed->v + OPB->_int); + ptr = (eval_t *)((int32_t *)&ed->v + OPB->_int); OPC->vector[0] = ptr->vector[0]; OPC->vector[1] = ptr->vector[1]; OPC->vector[2] = ptr->vector[2]; @@ -610,7 +610,7 @@ void PR_ExecuteProgram (func_t fnum) newf = &pr_functions[OPA->function]; if (newf->first_statement < 0) { // Built-in function - int i = -newf->first_statement; + int32_t i = -newf->first_statement; if (i >= pr_numbuiltins) PR_RunError("Bad builtin call number %d", i); pr_builtins[i](); diff --git a/source/progdefs.q1 b/source/progdefs.q1 index eb15c45..68295b4 100644 --- a/source/progdefs.q1 +++ b/source/progdefs.q1 @@ -2,10 +2,10 @@ /* file generated by qcc, do not modify */ typedef struct -{ int pad[28]; - int self; - int other; - int world; +{ int32_t pad[28]; + int32_t self; + int32_t other; + int32_t world; float time; float frametime; float force_retouch; @@ -43,10 +43,10 @@ typedef struct vec3_t trace_endpos; vec3_t trace_plane_normal; float trace_plane_dist; - int trace_ent; + int32_t trace_ent; float trace_inopen; float trace_inwater; - int msg_entity; + int32_t msg_entity; func_t main; func_t StartFrame; func_t PlayerPreThink; @@ -86,7 +86,7 @@ typedef struct func_t think; func_t blocked; float nextthink; - int groundentity; + int32_t groundentity; float health; float frags; float weapon; @@ -99,7 +99,7 @@ typedef struct float ammo_cells; float items; float takedamage; - int chain; + int32_t chain; float deadflag; vec3_t view_ofs; float button0; @@ -110,7 +110,7 @@ typedef struct vec3_t v_angle; float idealpitch; string_t netname; - int enemy; + int32_t enemy; float flags; float colormap; float team; @@ -122,15 +122,15 @@ typedef struct float watertype; float ideal_yaw; float yaw_speed; - int aiment; - int goalentity; + int32_t aiment; + int32_t goalentity; float spawnflags; string_t target; string_t targetname; float dmg_take; float dmg_save; - int dmg_inflictor; - int owner; + int32_t dmg_inflictor; + int32_t owner; vec3_t movedir; string_t message; float sounds; diff --git a/source/progs.h b/source/progs.h index 2e5664b..854467e 100644 --- a/source/progs.h +++ b/source/progs.h @@ -32,8 +32,8 @@ typedef union eval_s float _float; float vector[3]; func_t function; - int _int; - int edict; + int32_t _int; + int32_t edict; } eval_t; #define MAX_ENT_LEAFS 32 @@ -42,8 +42,8 @@ typedef struct edict_s bool free; link_t area; /* linked to a division node or leaf */ - int num_leafs; - int leafnums[MAX_ENT_LEAFS]; + int32_t num_leafs; + int32_t leafnums[MAX_ENT_LEAFS]; entity_state_t baseline; uint8_t alpha; /* johnfitz -- hack to support alpha since it's not part of entvars_t */ @@ -65,7 +65,7 @@ extern dstatement_t *pr_statements; extern globalvars_t *pr_global_struct; extern float *pr_globals; /* same as pr_global_struct */ -extern int pr_edict_size; /* in bytes */ +extern int32_t pr_edict_size; /* in bytes */ void PR_Init (void); @@ -73,9 +73,9 @@ void PR_Init (void); void PR_ExecuteProgram (func_t fnum); void PR_LoadProgs (void); -const char *PR_GetString (int num); -int PR_SetEngineString (const char *s); -int PR_AllocString (int bufferlength, char **ptr); +const char *PR_GetString (int32_t num); +int32_t PR_SetEngineString (const char *s); +int32_t PR_AllocString (int32_t bufferlength, char **ptr); void PR_Profile_f (void); @@ -95,8 +95,8 @@ void ED_LoadFromFile (const char *data); #define EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size)) #define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts) / pr_edict_size) */ -edict_t *EDICT_NUM(int n); -int NUM_FOR_EDICT(edict_t *e); +edict_t *EDICT_NUM(int32_t n); +int32_t NUM_FOR_EDICT(edict_t *e); #define NEXT_EDICT(e) ((edict_t *)( (byte *)e + pr_edict_size)) @@ -104,29 +104,29 @@ int NUM_FOR_EDICT(edict_t *e); #define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e)) #define G_FLOAT(o) (pr_globals[o]) -#define G_INT(o) (*(int *)&pr_globals[o]) -#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int *)&pr_globals[o])) +#define G_INT(o) (*(int32_t *)&pr_globals[o]) +#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int32_t *)&pr_globals[o])) #define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o)) #define G_VECTOR(o) (&pr_globals[o]) #define G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o])) #define G_FUNCTION(o) (*(func_t *)&pr_globals[o]) #define E_FLOAT(e,o) (((float*)&e->v)[o]) -#define E_INT(e,o) (*(int *)&((float*)&e->v)[o]) +#define E_INT(e,o) (*(int32_t *)&((float*)&e->v)[o]) #define E_VECTOR(e,o) (&((float*)&e->v)[o]) #define E_STRING(e,o) (PR_GetString(*(string_t *)&((float*)&e->v)[o])) -extern int type_size[8]; +extern int32_t type_size[8]; typedef void (*builtin_t) (void); extern builtin_t *pr_builtins; -extern int pr_numbuiltins; +extern int32_t pr_numbuiltins; -extern int pr_argc; +extern int32_t pr_argc; extern bool pr_trace; extern dfunction_t *pr_xfunction; -extern int pr_xstatement; +extern int32_t pr_xstatement; extern uint16_t pr_crc; @@ -136,7 +136,7 @@ noreturn void PR_RunError (const char *error, ...) FUNC_PRINTF(1,2); #endif void ED_PrintEdicts (void); -void ED_PrintNum (int ent); +void ED_PrintNum (int32_t ent); eval_t *GetEdictFieldValue(edict_t *ed, const char *field); diff --git a/source/protocol.h b/source/protocol.h index 7a4fc64..9c7191f 100644 --- a/source/protocol.h +++ b/source/protocol.h @@ -235,12 +235,12 @@ typedef struct { vec3_t origin; vec3_t angles; - uint16_t modelindex; //johnfitz -- was int - uint16_t frame; //johnfitz -- was int - uint8_t colormap; //johnfitz -- was int - uint8_t skin; //johnfitz -- was int + uint16_t modelindex; //johnfitz -- was int32_t + uint16_t frame; //johnfitz -- was int32_t + uint8_t colormap; //johnfitz -- was int32_t + uint8_t skin; //johnfitz -- was int32_t uint8_t alpha; //johnfitz -- added - int effects; + int32_t effects; } entity_state_t; typedef struct diff --git a/source/q_ctype.h b/source/q_ctype.h index 729f796..e6fce51 100644 --- a/source/q_ctype.h +++ b/source/q_ctype.h @@ -20,48 +20,48 @@ #ifndef Q_CTYPE_H #define Q_CTYPE_H -static inline int q_isascii(int c) +static inline int32_t q_isascii(int32_t c) { return ((c & ~0x7f) == 0); } -static inline int q_islower(int c) +static inline int32_t q_islower(int32_t c) { return (c >= 'a' && c <= 'z'); } -static inline int q_isupper(int c) +static inline int32_t q_isupper(int32_t c) { return (c >= 'A' && c <= 'Z'); } -static inline int q_isalpha(int c) +static inline int32_t q_isalpha(int32_t c) { return (q_islower(c) || q_isupper(c)); } -static inline int q_isdigit(int c) +static inline int32_t q_isdigit(int32_t c) { return (c >= '0' && c <= '9'); } -static inline int q_isxdigit(int c) +static inline int32_t q_isxdigit(int32_t c) { return (q_isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); } -static inline int q_isalnum(int c) +static inline int32_t q_isalnum(int32_t c) { return (q_isalpha(c) || q_isdigit(c)); } -static inline int q_isblank(int c) +static inline int32_t q_isblank(int32_t c) { return (c == ' ' || c == '\t'); } -static inline int q_isspace(int c) +static inline int32_t q_isspace(int32_t c) { switch(c) { case ' ': case '\t': @@ -71,27 +71,27 @@ static inline int q_isspace(int c) return 0; } -static inline int q_isgraph(int c) +static inline int32_t q_isgraph(int32_t c) { return (c > 0x20 && c <= 0x7e); } -static inline int q_isprint(int c) +static inline int32_t q_isprint(int32_t c) { return (c >= 0x20 && c <= 0x7e); } -static inline int q_toascii(int c) +static inline int32_t q_toascii(int32_t c) { return (c & 0x7f); } -static inline int q_tolower(int c) +static inline int32_t q_tolower(int32_t c) { return ((q_isupper(c)) ? (c | ('a' - 'A')) : c); } -static inline int q_toupper(int c) +static inline int32_t q_toupper(int32_t c) { return ((q_islower(c)) ? (c & ~('a' - 'A')) : c); } diff --git a/source/q_sound.h b/source/q_sound.h index eca5be8..9494257 100644 --- a/source/q_sound.h +++ b/source/q_sound.h @@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* !!! if this is changed, it must be changed in asm_i386.h too !!! */ typedef struct { - int left; - int right; + int32_t left; + int32_t right; } portable_samplepair_t; typedef struct sfx_s @@ -41,23 +41,23 @@ typedef struct sfx_s /* !!! if this is changed, it must be changed in asm_i386.h too !!! */ typedef struct { - int length; - int loopstart; - int speed; - int width; - int stereo; + int32_t length; + int32_t loopstart; + int32_t speed; + int32_t width; + int32_t stereo; byte data[1]; /* variable sized */ } sfxcache_t; typedef struct { - int channels; - int samples; /* mono samples in buffer */ - int submission_chunk; /* don't mix less than this # */ - int samplepos; /* in mono samples */ - int samplebits; - int signed8; /* device opened for S8 format? (e.g. Amiga AHI) */ - int speed; + int32_t channels; + int32_t samples; /* mono samples in buffer */ + int32_t submission_chunk; /* don't mix less than this # */ + int32_t samplepos; /* in mono samples */ + int32_t samplebits; + int32_t signed8; /* device opened for S8 format? (e.g. Amiga AHI) */ + int32_t speed; uint8_t *buffer; } dma_t; @@ -65,36 +65,36 @@ typedef struct typedef struct { sfx_t *sfx; /* sfx number */ - int leftvol; /* 0-255 volume */ - int rightvol; /* 0-255 volume */ - int end; /* end time in global paintsamples */ - int pos; /* sample position in sfx */ - int looping; /* where to loop, -1 = no looping */ - int entnum; /* to allow overriding a specific sound */ - int entchannel; + int32_t leftvol; /* 0-255 volume */ + int32_t rightvol; /* 0-255 volume */ + int32_t end; /* end time in global paintsamples */ + int32_t pos; /* sample position in sfx */ + int32_t looping; /* where to loop, -1 = no looping */ + int32_t entnum; /* to allow overriding a specific sound */ + int32_t entchannel; vec3_t origin; /* origin of sound effect */ vec_t dist_mult; /* distance multiplier (attenuation/clipK) */ - int master_vol; /* 0-255 master volume */ + int32_t master_vol; /* 0-255 master volume */ } channel_t; #define WAV_FORMAT_PCM 1 typedef struct { - int rate; - int width; - int channels; - int loopstart; - int samples; - int dataofs; /* chunk starts this many bytes from file start */ + int32_t rate; + int32_t width; + int32_t channels; + int32_t loopstart; + int32_t samples; + int32_t dataofs; /* chunk starts this many bytes from file start */ } wavinfo_t; void S_Init (void); void S_Startup (void); void S_Shutdown (void); -void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation); +void S_StartSound (int32_t entnum, int32_t entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation); void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation); -void S_StopSound (int entnum, int entchannel); +void S_StopSound (int32_t entnum, int32_t entchannel); void S_StopAllSounds(bool clear); void S_ClearBuffer (void); void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up); @@ -108,24 +108,24 @@ void S_TouchSound (const char *sample); void S_ClearPrecache (void); void S_BeginPrecaching (void); void S_EndPrecaching (void); -void S_PaintChannels (int endtime); +void S_PaintChannels (int32_t endtime); void S_InitPaintChannels (void); /* picks a channel based on priorities, empty slots, number of channels */ -channel_t *SND_PickChannel (int entnum, int entchannel); +channel_t *SND_PickChannel (int32_t entnum, int32_t entchannel); /* spatializes a channel */ void SND_Spatialize (channel_t *ch); /* music stream support */ -void S_RawSamples(int samples, int rate, int width, int channels, byte * data, float volume); +void S_RawSamples(int32_t samples, int32_t rate, int32_t width, int32_t channels, byte * data, float volume); /* Expects data in signed 16 bit, or unsigned 8 bit format. */ /* initializes cycling through a DMA buffer and returns information on it */ bool SNDDMA_Init(dma_t *dma); /* gets the current DMA position */ -int SNDDMA_GetDMAPos(void); +int32_t SNDDMA_GetDMAPos(void); /* shutdown the DMA xfer. */ void SNDDMA_Shutdown(void); @@ -158,10 +158,10 @@ extern channel_t snd_channels[MAX_CHANNELS]; extern volatile dma_t *shm; -extern int total_channels; -extern int soundtime; -extern int paintedtime; -extern int s_rawend; +extern int32_t total_channels; +extern int32_t soundtime; +extern int32_t paintedtime; +extern int32_t s_rawend; extern vec3_t listener_origin; extern vec3_t listener_forward; @@ -182,7 +182,7 @@ extern cvar_t bgmvolume; void S_LocalSound (const char *name); sfxcache_t *S_LoadSound (sfx_t *s); -wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength); +wavinfo_t GetWavinfo (const char *name, byte *wav, int32_t wavlength); void SND_InitScaletable (void); diff --git a/source/q_stdinc.h b/source/q_stdinc.h index 3eb2246..abf607b 100644 --- a/source/q_stdinc.h +++ b/source/q_stdinc.h @@ -51,13 +51,13 @@ #include _Static_assert(sizeof(float) == 4, "float not correct size"); -_Static_assert(sizeof(int) == 4, "int not correct size"); +_Static_assert(sizeof(int32_t) == 4, "int32_t not correct size"); /* make sure enums are the size of ints for structure packing */ enum dummy_enum { dummy_value }; -_Static_assert(sizeof(enum dummy_enum) == sizeof(int), "enum not sizeof(int)"); +_Static_assert(sizeof(enum dummy_enum) == sizeof(int32_t), "enum not sizeof(int32_t)"); typedef uint8_t byte; diff --git a/source/quakedef.h b/source/quakedef.h index 9d5eb8e..94e8282 100644 --- a/source/quakedef.h +++ b/source/quakedef.h @@ -175,12 +175,12 @@ typedef struct // if user directories are enabled, basedir // and userdir will point to different // memory locations, otherwise to the same. - int argc; + int32_t argc; char **argv; void *membase; - int memsize; - int numcpus; - int errstate; + int32_t memsize; + int32_t numcpus; + int32_t errstate; } quakeparms_t; #include "common.h" @@ -250,7 +250,7 @@ extern cvar_t max_edicts; //johnfitz extern bool host_initialized; // true if into command execution extern double host_frametime; extern byte *host_colormap; -extern int host_framecount; // incremented every frame, never reset +extern int32_t host_framecount; // incremented every frame, never reset extern double realtime; // not bounded in any way, changed at // start of every frame, never reset @@ -288,7 +288,7 @@ void DemoList_Init (void); void DemoList_Rebuild (void); -extern int current_skill; // skill level for currently loaded level (in case +extern int32_t current_skill; // skill level for currently loaded level (in case // the user changes the cvar while the level is // running, this reflects the level actually in use) diff --git a/source/r_alias.c b/source/r_alias.c index b0a8b6b..d6c28b5 100644 --- a/source/r_alias.c +++ b/source/r_alias.c @@ -94,9 +94,9 @@ Returns the offset of the first vertex's meshxyz_t.xyz in the vbo for the given model and pose. ============= */ -static void *GLARB_GetXYZOffset (aliashdr_t *hdr, int pose) +static void *GLARB_GetXYZOffset (aliashdr_t *hdr, int32_t pose) { - const int xyzoffs = offsetof (meshxyz_t, xyz); + const int32_t xyzoffs = offsetof (meshxyz_t, xyz); return (void *) (currententity->model->vboxyzofs + (hdr->numverts_vbo * pose * sizeof (meshxyz_t)) + xyzoffs); } @@ -108,9 +108,9 @@ Returns the offset of the first vertex's meshxyz_t.normal in the vbo for the given model and pose. ============= */ -static void *GLARB_GetNormalOffset (aliashdr_t *hdr, int pose) +static void *GLARB_GetNormalOffset (aliashdr_t *hdr, int32_t pose) { - const int normaloffs = offsetof (meshxyz_t, normal); + const int32_t normaloffs = offsetof (meshxyz_t, normal); return (void *)(currententity->model->vboxyzofs + (hdr->numverts_vbo * pose * sizeof (meshxyz_t)) + normaloffs); } @@ -301,8 +301,8 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata) { float vertcolor[4]; trivertx_t *verts1, *verts2; - int *commands; - int count; + int32_t *commands; + int32_t count; float u,v; float blend, iblend; bool lerping; @@ -326,7 +326,7 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata) blend = iblend = 0; // avoid bogus compiler warning } - commands = (int *)((byte *)paliashdr + paliashdr->commands); + commands = (int32_t *)((byte *)paliashdr + paliashdr->commands); vertcolor[3] = entalpha; //never changes, so there's no need to put this inside the loop @@ -408,10 +408,10 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata) R_SetupAliasFrame -- johnfitz -- rewritten to support lerping ================= */ -void R_SetupAliasFrame (aliashdr_t *paliashdr, int frame, lerpdata_t *lerpdata) +void R_SetupAliasFrame (aliashdr_t *paliashdr, int32_t frame, lerpdata_t *lerpdata) { entity_t *e = currententity; - int posenum, numposes; + int32_t posenum, numposes; if ((frame >= paliashdr->numframes) || (frame < 0)) { @@ -425,7 +425,7 @@ void R_SetupAliasFrame (aliashdr_t *paliashdr, int frame, lerpdata_t *lerpdata) if (numposes > 1) { e->lerptime = paliashdr->frames[frame].interval; - posenum += (int)(cl.time / e->lerptime) % numposes; + posenum += (int32_t)(cl.time / e->lerptime) % numposes; } else e->lerptime = 0.1; @@ -481,7 +481,7 @@ void R_SetupEntityTransform (entity_t *e, lerpdata_t *lerpdata) { float blend; vec3_t d; - int i; + int32_t i; // if LERP_RESETMOVE, kill any lerps in progress if (e->lerpflags & LERP_RESETMOVE) @@ -543,8 +543,8 @@ void R_SetupAliasLighting (entity_t *e) { vec3_t dist; float add; - int i; - int quantizedangle; + int32_t i; + int32_t quantizedangle; float radiansangle; R_LightPoint (e->origin); @@ -602,7 +602,7 @@ void R_SetupAliasLighting (entity_t *e) lightcolor[2] = 256.0f; } - quantizedangle = ((int)(e->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1); + quantizedangle = ((int32_t)(e->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1); //ericw -- shadevector is passed to the shader to compute shadedots inside the //shader, see GLAlias_CreateShaders() @@ -625,7 +625,7 @@ R_DrawAliasModel -- johnfitz -- almost completely rewritten void R_DrawAliasModel (entity_t *e) { aliashdr_t *paliashdr; - int i, anim, skinnum; + int32_t i, anim, skinnum; gltexture_t *tx, *fb; lerpdata_t lerpdata; bool alphatest = !!(e->model->flags & MF_HOLEY); @@ -689,7 +689,7 @@ void R_DrawAliasModel (entity_t *e) // set up textures // GL_DisableMultitexture(); - anim = (int)(cl.time*10) & 3; + anim = (int32_t)(cl.time*10) & 3; skinnum = e->skinnum; if ((skinnum >= paliashdr->numskins) || (skinnum < 0)) { @@ -716,7 +716,7 @@ void R_DrawAliasModel (entity_t *e) glDisable (GL_TEXTURE_2D); GL_DrawAliasFrame (paliashdr, lerpdata); glEnable (GL_TEXTURE_2D); - srand((int) (cl.time * 1000)); //restore randomness + srand((int32_t) (cl.time * 1000)); //restore randomness } else if (r_fullbright_cheatsafe) { diff --git a/source/r_brush.c b/source/r_brush.c index 7c25c23..9038daf 100644 --- a/source/r_brush.c +++ b/source/r_brush.c @@ -27,8 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern cvar_t gl_fullbrights, r_drawflat, gl_overbright, r_oldwater; //johnfitz extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix -int gl_lightmap_format; -int lightmap_bytes; +int32_t gl_lightmap_format; +int32_t lightmap_bytes; #define BLOCK_WIDTH 128 #define BLOCK_HEIGHT 128 @@ -45,8 +45,8 @@ glpoly_t *lightmap_polys[MAX_LIGHTMAPS]; bool lightmap_modified[MAX_LIGHTMAPS]; glRect_t lightmap_rectchange[MAX_LIGHTMAPS]; -int allocated[MAX_LIGHTMAPS][BLOCK_WIDTH]; -int last_lightmap_allocated; //ericw -- optimization: remember the index of the last lightmap AllocBlock stored a surf in +int32_t allocated[MAX_LIGHTMAPS][BLOCK_WIDTH]; +int32_t last_lightmap_allocated; //ericw -- optimization: remember the index of the last lightmap AllocBlock stored a surf in // the lightmap texture data needs to be kept in // main memory so texsubimage can update properly @@ -60,10 +60,10 @@ R_TextureAnimation -- johnfitz -- added "frame" param to eliminate use of "curre Returns the proper texture for a given time and base texture =============== */ -texture_t *R_TextureAnimation (texture_t *base, int frame) +texture_t *R_TextureAnimation (texture_t *base, int32_t frame) { - int relative; - int count; + int32_t relative; + int32_t count; if (frame) if (base->alternate_anims) @@ -72,7 +72,7 @@ texture_t *R_TextureAnimation (texture_t *base, int frame) if (!base->anim_total) return base; - relative = (int)(cl.time*10) % base->anim_total; + relative = (int32_t)(cl.time*10) % base->anim_total; count = 0; while (base->anim_min > relative || base->anim_max <= relative) @@ -95,7 +95,7 @@ DrawGLPoly void DrawGLPoly (glpoly_t *p) { float *v; - int i; + int32_t i; glBegin (GL_POLYGON); v = p->verts[0]; @@ -115,7 +115,7 @@ DrawGLTriangleFan -- johnfitz -- like DrawGLPoly but for r_showtris void DrawGLTriangleFan (glpoly_t *p) { float *v; - int i; + int32_t i; glBegin (GL_TRIANGLE_FAN); v = p->verts[0]; @@ -146,7 +146,7 @@ void R_DrawSequentialPoly (msurface_t *s) texture_t *t; float *v; float entalpha; - int i; + int32_t i; t = R_TextureAnimation (s->texinfo->texture, currententity->frame); entalpha = ENTALPHA_DECODE(currententity->alpha); @@ -513,7 +513,7 @@ R_DrawBrushModel */ void R_DrawBrushModel (entity_t *e) { - int i, k; + int32_t i, k; msurface_t *psurf; float dot; mplane_t *pplane; @@ -598,7 +598,7 @@ R_DrawBrushModel_ShowTris -- johnfitz */ void R_DrawBrushModel_ShowTris (entity_t *e) { - int i; + int32_t i; msurface_t *psurf; float dot; mplane_t *pplane; @@ -669,9 +669,9 @@ called during rendering void R_RenderDynamicLightmaps (msurface_t *fa) { byte *base; - int maps; + int32_t maps; glRect_t *theRect; - int smax, tmax; + int32_t smax, tmax; if (fa->flags & SURF_DRAWTILED) //johnfitz -- not a lightmapped surface return; @@ -721,11 +721,11 @@ dynamic: AllocBlock -- returns a texture number and the position inside it ======================== */ -int AllocBlock (int w, int h, int *x, int *y) +int32_t AllocBlock (int32_t w, int32_t h, int32_t *x, int32_t *y) { - int i, j; - int best, best2; - int texnum; + int32_t i, j; + int32_t best, best2; + int32_t texnum; // ericw -- rather than searching starting at lightmap 0 every time, // start at the last lightmap we allocated a surface in. @@ -771,7 +771,7 @@ int AllocBlock (int w, int h, int *x, int *y) mvertex_t *r_pcurrentvertbase; qmodel_t *currentmodel; -int nColinElim; +int32_t nColinElim; /* ======================== @@ -780,7 +780,7 @@ GL_CreateSurfaceLightmap */ void GL_CreateSurfaceLightmap (msurface_t *surf) { - int smax, tmax; + int32_t smax, tmax; byte *base; smax = (surf->extents[0]>>4)+1; @@ -799,7 +799,7 @@ BuildSurfaceDisplayList -- called at level load time */ void BuildSurfaceDisplayList (msurface_t *fa) { - int i, lindex, lnumverts; + int32_t i, lindex, lnumverts; medge_t *pedges, *r_pedge; float *vec; float s, t; @@ -877,7 +877,7 @@ void GL_BuildLightmaps (void) { char name[16]; byte *data; - int i, j; + int32_t i, j; qmodel_t *m; memset (allocated, 0, sizeof(allocated)); @@ -983,7 +983,7 @@ surfaces from world + all brush models void GL_BuildBModelVertexBuffer (void) { uint32_t numverts, varray_bytes, varray_index; - int i, j; + int32_t i, j; qmodel_t *m; float *varray; @@ -1044,13 +1044,13 @@ R_AddDynamicLights */ void R_AddDynamicLights (msurface_t *surf) { - int lnum; - int sd, td; + int32_t lnum; + int32_t sd, td; float dist, rad, minlight; vec3_t impact, local; - int s, t; - int i; - int smax, tmax; + int32_t s, t; + int32_t i; + int32_t smax, tmax; mtexinfo_t *tex; //johnfitz -- lit support via lordhavoc float cred, cgreen, cblue, brightness; @@ -1111,9 +1111,9 @@ void R_AddDynamicLights (msurface_t *surf) //johnfitz -- lit support via lordhavoc { brightness = rad - dist; - bl[0] += (int) (brightness * cred); - bl[1] += (int) (brightness * cgreen); - bl[2] += (int) (brightness * cblue); + bl[0] += (int32_t) (brightness * cred); + bl[1] += (int32_t) (brightness * cgreen); + bl[2] += (int32_t) (brightness * cblue); } bl += 3; //johnfitz @@ -1130,14 +1130,14 @@ R_BuildLightMap -- johnfitz -- revised for lit support via lordhavoc Combine and scale multiple lightmaps into the 8.8 format in blocklights =============== */ -void R_BuildLightMap (msurface_t *surf, byte *dest, int stride) +void R_BuildLightMap (msurface_t *surf, byte *dest, int32_t stride) { - int smax, tmax; - int r,g,b; - int i, j, size; + int32_t smax, tmax; + int32_t r,g,b; + int32_t i, j, size; byte *lightmap; unsigned scale; - int maps; + int32_t maps; unsigned *bl; surf->cached_dlight = (surf->dlightframe == r_framecount); @@ -1250,7 +1250,7 @@ R_UploadLightmap -- johnfitz -- uploads the modified lightmap to opengl if neces assumes lightmap texture is already bound =============== */ -static void R_UploadLightmap(int lmap) +static void R_UploadLightmap(int32_t lmap) { glRect_t *theRect; @@ -1272,7 +1272,7 @@ static void R_UploadLightmap(int lmap) void R_UploadLightmaps (void) { - int lmap; + int32_t lmap; for (lmap = 0; lmap < MAX_LIGHTMAPS; lmap++) { @@ -1291,7 +1291,7 @@ R_RebuildAllLightmaps -- johnfitz -- called when gl_overbright gets toggled */ void R_RebuildAllLightmaps (void) { - int i, j; + int32_t i, j; qmodel_t *mod; msurface_t *fa; byte *base; diff --git a/source/r_part.c b/source/r_part.c index 2f1ff4a..6c10768 100644 --- a/source/r_part.c +++ b/source/r_part.c @@ -28,15 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's // on the command line -int ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61}; -int ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66}; -int ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3}; +int32_t ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61}; +int32_t ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66}; +int32_t ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3}; particle_t *active_particles, *free_particles, *particles; vec3_t r_pright, r_pup, r_ppn; -int r_numparticles; +int32_t r_numparticles; gltexture_t *particletexture, *particletexture1, *particletexture2, *particletexture3, *particletexture4; //johnfitz float texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures @@ -49,10 +49,10 @@ cvar_t r_quadparticles = {"r_quadparticles","1", CVAR_ARCHIVE}; //johnfitz R_ParticleTextureLookup -- johnfitz -- generate nice antialiased 32x32 circle for particles =============== */ -int R_ParticleTextureLookup (int x, int y, int sharpness) +int32_t R_ParticleTextureLookup (int32_t x, int32_t y, int32_t sharpness) { - int r; //distance from point x,y to circle origin, squared - int a; //alpha value to return + int32_t r; //distance from point x,y to circle origin, squared + int32_t a; //alpha value to return x -= 16; y -= 16; @@ -70,7 +70,7 @@ R_InitParticleTextures -- johnfitz -- rewritten */ void R_InitParticleTextures (void) { - int x,y; + int32_t x,y; static byte particle1_data[64*64*4]; static byte particle2_data[2*2*4]; static byte particle3_data[64*64*4]; @@ -125,7 +125,7 @@ R_SetParticleTexture_f -- johnfitz static void R_SetParticleTexture_f (cvar_t *var) { (void)var; - switch ((int)(r_particles.value)) + switch ((int32_t)(r_particles.value)) { case 1: particletexture = particletexture1; @@ -149,13 +149,13 @@ R_InitParticles */ void R_InitParticles (void) { - int i; + int32_t i; i = COM_CheckParm ("-particles"); if (i) { - r_numparticles = (int)(Q_atoi(com_argv[i+1])); + r_numparticles = (int32_t)(Q_atoi(com_argv[i+1])); if (r_numparticles < ABSOLUTE_MIN_PARTICLES) r_numparticles = ABSOLUTE_MIN_PARTICLES; } @@ -189,12 +189,12 @@ float timescale = 0.01; void R_EntityParticles (entity_t *ent) { - int i; + int32_t i; particle_t *p; float angle; float sp, sy, cp, cy; // float sr, cr; -// int count; +// int32_t count; vec3_t forward; float dist; @@ -251,7 +251,7 @@ R_ClearParticles */ void R_ClearParticles (void) { - int i; + int32_t i; free_particles = &particles[0]; active_particles = NULL; @@ -270,8 +270,8 @@ void R_ReadPointFile_f (void) { FILE *f; vec3_t org; - int r; - int c; + int32_t r; + int32_t c; particle_t *p; char name[MAX_QPATH]; @@ -328,7 +328,7 @@ Parse an effect out of the server message void R_ParseParticleEffect (void) { vec3_t org, dir; - int i, count, msgcount, color; + int32_t i, count, msgcount, color; for (i=0 ; i<3 ; i++) org[i] = MSG_ReadCoord (cl.protocolflags); @@ -352,7 +352,7 @@ R_ParticleExplosion */ void R_ParticleExplosion (vec3_t org) { - int i, j; + int32_t i, j; particle_t *p; for (i=0 ; i<1024 ; i++) @@ -393,11 +393,11 @@ void R_ParticleExplosion (vec3_t org) R_ParticleExplosion2 =============== */ -void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength) +void R_ParticleExplosion2 (vec3_t org, int32_t colorStart, int32_t colorLength) { - int i, j; + int32_t i, j; particle_t *p; - int colorMod = 0; + int32_t colorMod = 0; for (i=0; i<512; i++) { @@ -428,7 +428,7 @@ R_BlobExplosion */ void R_BlobExplosion (vec3_t org) { - int i, j; + int32_t i, j; particle_t *p; for (i=0 ; i<1024 ; i++) @@ -470,9 +470,9 @@ void R_BlobExplosion (vec3_t org) R_RunParticleEffect =============== */ -void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count) +void R_RunParticleEffect (vec3_t org, vec3_t dir, int32_t color, int32_t count) { - int i, j; + int32_t i, j; particle_t *p; for (i=0 ; iramp = (rand()&3); - p->color = ramp3[(int)p->ramp]; + p->color = ramp3[(int32_t)p->ramp]; p->type = pt_fire; for (j=0 ; j<3 ; j++) p->org[j] = start[j] + ((rand()%6)-3); @@ -656,7 +656,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type) case 1: // smoke smoke p->ramp = (rand()&3) + 2; - p->color = ramp3[(int)p->ramp]; + p->color = ramp3[(int32_t)p->ramp]; p->type = pt_fire; for (j=0 ; j<3 ; j++) p->org[j] = start[j] + ((rand()%6)-3); @@ -722,7 +722,7 @@ CL_RunParticles -- johnfitz -- all the particle behavior, separated from R_DrawP void CL_RunParticles (void) { particle_t *p, *kill; - int i; + int32_t i; float time1, time2, time3, dvel, frametime, grav; extern cvar_t sv_gravity; @@ -774,7 +774,7 @@ void CL_RunParticles (void) if (p->ramp >= 6) p->die = -1; else - p->color = ramp3[(int)p->ramp]; + p->color = ramp3[(int32_t)p->ramp]; p->vel[2] += grav; break; @@ -783,7 +783,7 @@ void CL_RunParticles (void) if (p->ramp >=8) p->die = -1; else - p->color = ramp1[(int)p->ramp]; + p->color = ramp1[(int32_t)p->ramp]; for (i=0 ; i<3 ; i++) p->vel[i] += p->vel[i]*dvel; p->vel[2] -= grav; @@ -794,7 +794,7 @@ void CL_RunParticles (void) if (p->ramp >=8) p->die = -1; else - p->color = ramp2[(int)p->ramp]; + p->color = ramp2[(int32_t)p->ramp]; for (i=0 ; i<3 ; i++) p->vel[i] -= p->vel[i]*frametime; p->vel[2] -= grav; @@ -868,12 +868,12 @@ void R_DrawParticles (void) scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures //johnfitz -- particle transparency and fade out - c = (GLubyte *) &d_8to24table[(int)p->color]; + c = (GLubyte *) &d_8to24table[(int32_t)p->color]; color[0] = c[0]; color[1] = c[1]; color[2] = c[2]; //alpha = CLAMP(0, p->die + 0.5 - cl.time, 1); - color[3] = 255; //(int)(alpha * 255); + color[3] = 255; //(int32_t)(alpha * 255); glColor4ubv(color); //johnfitz @@ -913,12 +913,12 @@ void R_DrawParticles (void) scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures //johnfitz -- particle transparency and fade out - c = (GLubyte *) &d_8to24table[(int)p->color]; + c = (GLubyte *) &d_8to24table[(int32_t)p->color]; color[0] = c[0]; color[1] = c[1]; color[2] = c[2]; //alpha = CLAMP(0, p->die + 0.5 - cl.time, 1); - color[3] = 255; //(int)(alpha * 255); + color[3] = 255; //(int32_t)(alpha * 255); glColor4ubv(color); //johnfitz diff --git a/source/r_sprite.c b/source/r_sprite.c index 6765e97..31e6f0b 100644 --- a/source/r_sprite.c +++ b/source/r_sprite.c @@ -33,7 +33,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currentent) msprite_t *psprite; mspritegroup_t *pspritegroup; mspriteframe_t *pspriteframe; - int i, numframes, frame; + int32_t i, numframes, frame; float *pintervals, fullinterval, targettime, time; psprite = (msprite_t *) currentent->model->cache.data; @@ -60,7 +60,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currentent) // when loading in Mod_LoadSpriteGroup, we guaranteed all interval values // are positive, so we don't have to worry about division by 0 - targettime = time - ((int)(time / fullinterval)) * fullinterval; + targettime = time - ((int32_t)(time / fullinterval)) * fullinterval; for (i=0 ; i<(numframes-1) ; i++) { diff --git a/source/r_world.c b/source/r_world.c index 031d0ea..b9ae330 100644 --- a/source/r_world.c +++ b/source/r_world.c @@ -30,7 +30,7 @@ extern glpoly_t *lightmap_polys[MAX_LIGHTMAPS]; byte *SV_FatPVS (vec3_t org, qmodel_t *worldmodel); -int vis_changed; //if true, force pvs to be refreshed +int32_t vis_changed; //if true, force pvs to be refreshed //============================================================================== // @@ -48,7 +48,7 @@ clears the lightmap chains */ void R_ClearTextureChains (qmodel_t *mod, texchain_t chain) { - int i; + int32_t i; // set all chains to null for (i=0 ; inumtextures ; i++) @@ -81,7 +81,7 @@ void R_MarkSurfaces (void) mleaf_t *leaf; mnode_t *node; msurface_t *surf, **mark; - int i, j; + int32_t i, j; bool nearwaterportal; // clear lightmap chains @@ -203,7 +203,7 @@ R_CullSurfaces -- johnfitz void R_CullSurfaces (void) { msurface_t *s; - int i; + int32_t i; texture_t *t; if (!r_drawworld_cheatsafe) @@ -245,7 +245,7 @@ void R_BuildLightmapChains (qmodel_t *model, texchain_t chain) { texture_t *t; msurface_t *s; - int i; + int32_t i; // clear lightmap chains (already done in r_marksurfaces, but clearing them here to be safe becuase of r_stereo) memset (lightmap_polys, 0, sizeof(lightmap_polys)); @@ -309,7 +309,7 @@ R_DrawTextureChains_ShowTris -- johnfitz */ void R_DrawTextureChains_ShowTris (qmodel_t *model, texchain_t chain) { - int i; + int32_t i; msurface_t *s; texture_t *t; glpoly_t *p; @@ -347,7 +347,7 @@ R_DrawTextureChains_Drawflat -- johnfitz */ void R_DrawTextureChains_Drawflat (qmodel_t *model, texchain_t chain) { - int i; + int32_t i; msurface_t *s; texture_t *t; glpoly_t *p; @@ -383,7 +383,7 @@ void R_DrawTextureChains_Drawflat (qmodel_t *model, texchain_t chain) } } glColor3f (1,1,1); - srand ((int) (cl.time * 1000)); + srand ((int32_t) (cl.time * 1000)); } /* @@ -393,7 +393,7 @@ R_DrawTextureChains_Glow -- johnfitz */ void R_DrawTextureChains_Glow (qmodel_t *model, entity_t *ent, texchain_t chain) { - int i; + int32_t i; msurface_t *s; texture_t *t; gltexture_t *glt; @@ -443,7 +443,7 @@ The number of indices it will write is given by R_NumTriangleIndicesForSurf. */ static void R_TriangleIndicesForSurf (msurface_t *s, uint32_t *dest) { - int i; + int32_t i; for (i=2; inumedges; i++) { *dest++ = s->vbo_firstvert; @@ -493,7 +493,7 @@ using VBOs. */ static void R_BatchSurface (msurface_t *s) { - int num_surf_indices; + int32_t num_surf_indices; num_surf_indices = R_NumTriangleIndicesForSurf (s); @@ -511,7 +511,7 @@ R_DrawTextureChains_Multitexture -- johnfitz */ void R_DrawTextureChains_Multitexture (qmodel_t *model, entity_t *ent, texchain_t chain) { - int i, j; + int32_t i, j; msurface_t *s; texture_t *t; float *v; @@ -566,7 +566,7 @@ draws surfs whose textures were missing from the BSP */ void R_DrawTextureChains_NoTexture (qmodel_t *model, texchain_t chain) { - int i; + int32_t i; msurface_t *s; texture_t *t; bool bound; @@ -601,7 +601,7 @@ R_DrawTextureChains_TextureOnly -- johnfitz */ void R_DrawTextureChains_TextureOnly (qmodel_t *model, entity_t *ent, texchain_t chain) { - int i; + int32_t i; msurface_t *s; texture_t *t; bool bound; @@ -660,7 +660,7 @@ R_DrawTextureChains_Water -- johnfitz */ void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain) { - int i; + int32_t i; msurface_t *s; texture_t *t; glpoly_t *p; @@ -741,7 +741,7 @@ R_DrawTextureChains_White -- johnfitz -- draw sky and water as white polys when */ void R_DrawTextureChains_White (qmodel_t *model, texchain_t chain) { - int i; + int32_t i; msurface_t *s; texture_t *t; @@ -770,7 +770,7 @@ R_DrawLightmapChains -- johnfitz -- R_BlendLightmaps stripped down to almost not */ void R_DrawLightmapChains (void) { - int i, j; + int32_t i, j; glpoly_t *p; float *v; @@ -903,11 +903,11 @@ Requires 3 TMUs, OpenGL 2.0 */ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain) { - int i; + int32_t i; msurface_t *s; texture_t *t; bool bound; - int lastlightmap; + int32_t lastlightmap; gltexture_t *fullbright = NULL; float entalpha; @@ -939,7 +939,7 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain) GL_Uniform1iFunc (LMTexLoc, 1); GL_Uniform1iFunc (fullbrightTexLoc, 2); GL_Uniform1iFunc (useFullbrightTexLoc, 0); - GL_Uniform1iFunc (useOverbrightLoc, (int)gl_overbright.value); + GL_Uniform1iFunc (useOverbrightLoc, (int32_t)gl_overbright.value); GL_Uniform1iFunc (useAlphaTestLoc, 0); GL_Uniform1fFunc (alphaLoc, entalpha); diff --git a/source/render.h b/source/render.h index 80adb09..f11bd88 100644 --- a/source/render.h +++ b/source/render.h @@ -50,7 +50,7 @@ typedef struct entity_s { bool forcelink; // model changed - int update_type; + int32_t update_type; entity_state_t baseline; // to fill in defaults in updates @@ -61,19 +61,19 @@ typedef struct entity_s vec3_t angles; struct qmodel_s *model; // NULL = no model struct efrag_s *efrag; // linked list of efrags - int frame; + int32_t frame; float syncbase; // for client-side animations byte *colormap; - int effects; // light, particles, etc - int skinnum; // for Alias models - int visframe; // last frame this entity was + int32_t effects; // light, particles, etc + int32_t skinnum; // for Alias models + int32_t visframe; // last frame this entity was // found in an active leaf - int dlightframe; // dynamic lighting - int dlightbits; + int32_t dlightframe; // dynamic lighting + int32_t dlightbits; // FIXME: could turn these into a union - int trivial_accept; + int32_t trivial_accept; struct mnode_s *topnode; // for bmodels, first world node // that splits bmodel, or NULL if // not split @@ -99,14 +99,14 @@ typedef struct vrect_t vrect; // subwindow in video for refresh // FIXME: not need vrect next field here? vrect_t aliasvrect; // scaled Alias version - int vrectright, vrectbottom; // right & bottom screen coords - int aliasvrectright, aliasvrectbottom; // scaled Alias versions + int32_t vrectright, vrectbottom; // right & bottom screen coords + int32_t aliasvrectright, aliasvrectbottom; // scaled Alias versions float vrectrightedge; // rightmost right edge we care about, // for use in edge list float fvrectx, fvrecty; // for floating-point compares float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping - int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20 - int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20 + int32_t vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20 + int32_t vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20 float fvrectright_adj, fvrectbottom_adj; // right and bottom edges, for clamping float fvrectright; // rightmost edge, for Alias clamping @@ -121,14 +121,14 @@ typedef struct float fov_x, fov_y; - int ambientlight; + int32_t ambientlight; } refdef_t; // // refresh // -extern int reinit_surfcache; +extern int32_t reinit_surfcache; extern refdef_t r_refdef; @@ -139,7 +139,7 @@ void R_Init (void); void R_InitTextures (void); void R_InitEfrags (void); void R_RenderView (void); // must set r_refdef first -void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect); +void R_ViewChanged (vrect_t *pvrect, int32_t lineadj, float aspect); // called whenever r_refdef or vid change //void R_InitSky (struct texture_s *mt); // called at level load @@ -150,12 +150,12 @@ void R_NewMap (void); void R_ParseParticleEffect (void); -void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count); -void R_RocketTrail (vec3_t start, vec3_t end, int type); +void R_RunParticleEffect (vec3_t org, vec3_t dir, int32_t color, int32_t count); +void R_RocketTrail (vec3_t start, vec3_t end, int32_t type); void R_EntityParticles (entity_t *ent); void R_BlobExplosion (vec3_t org); void R_ParticleExplosion (vec3_t org); -void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength); +void R_ParticleExplosion2 (vec3_t org, int32_t colorStart, int32_t colorLength); void R_LavaSplash (vec3_t org); void R_TeleportSplash (vec3_t org); @@ -165,14 +165,14 @@ void R_PushDlights (void); // // surface cache related // -extern int reinit_surfcache; // if 1, surface cache is currently empty and +extern int32_t reinit_surfcache; // if 1, surface cache is currently empty and extern bool r_cache_thrash; // set if thrashing the surface cache -int D_SurfaceCacheForRes (int width, int height); +int32_t D_SurfaceCacheForRes (int32_t width, int32_t height); void D_FlushCaches (void); void D_DeleteSurfaceCache (void); -void D_InitCaches (void *buffer, int size); -void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj); +void D_InitCaches (void *buffer, int32_t size); +void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int32_t lineadj); #endif /* _QUAKE_RENDER_H */ diff --git a/source/sbar.c b/source/sbar.c index 7854041..cbef0e8 100644 --- a/source/sbar.c +++ b/source/sbar.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -int sb_updates; // if >= vid.numpages, no update needed +int32_t sb_updates; // if >= vid.numpages, no update needed #define STAT_MINUS 10 // num frame for '-' stats digit @@ -48,7 +48,7 @@ qpic_t *sb_face_invis_invuln; bool sb_showscores; -int sb_lines; // scan lines to draw +int32_t sb_lines; // scan lines to draw qpic_t *rsb_invbar[2]; qpic_t *rsb_weapons[5]; @@ -59,13 +59,13 @@ qpic_t *rsb_teambord; // PGM 01/19/97 - team color border //MED 01/04/97 added two more weapons + 3 alternates for grenade launcher qpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are flashes //MED 01/04/97 added array to simplify weapon parsing -int hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT}; +int32_t hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT}; //MED 01/04/97 added hipnotic items array qpic_t *hsb_items[2]; void Sbar_MiniDeathmatchOverlay (void); void Sbar_DeathmatchOverlay (void); -void M_DrawPic (int x, int y, qpic_t *pic); +void M_DrawPic (int32_t x, int32_t y, qpic_t *pic); /* =============== @@ -112,7 +112,7 @@ Sbar_LoadPics -- johnfitz -- load all the sbar pics */ void Sbar_LoadPics (void) { - int i; + int32_t i; for (i = 0; i < 10; i++) { @@ -269,7 +269,7 @@ void Sbar_Init (void) Sbar_DrawPic -- johnfitz -- rewritten now that GL_SetCanvas is doing the work ============= */ -void Sbar_DrawPic (int x, int y, qpic_t *pic) +void Sbar_DrawPic (int32_t x, int32_t y, qpic_t *pic) { Draw_Pic (x, y + 24, pic); } @@ -279,7 +279,7 @@ void Sbar_DrawPic (int x, int y, qpic_t *pic) Sbar_DrawPicAlpha -- johnfitz ============= */ -void Sbar_DrawPicAlpha (int x, int y, qpic_t *pic, float alpha) +void Sbar_DrawPicAlpha (int32_t x, int32_t y, qpic_t *pic, float alpha) { glDisable (GL_ALPHA_TEST); glEnable (GL_BLEND); @@ -295,7 +295,7 @@ void Sbar_DrawPicAlpha (int x, int y, qpic_t *pic, float alpha) Sbar_DrawCharacter -- johnfitz -- rewritten now that GL_SetCanvas is doing the work ================ */ -void Sbar_DrawCharacter (int x, int y, int num) +void Sbar_DrawCharacter (int32_t x, int32_t y, int32_t num) { Draw_Character (x, y + 24, num); } @@ -305,7 +305,7 @@ void Sbar_DrawCharacter (int x, int y, int num) Sbar_DrawString -- johnfitz -- rewritten now that GL_SetCanvas is doing the work ================ */ -void Sbar_DrawString (int x, int y, const char *str) +void Sbar_DrawString (int32_t x, int32_t y, const char *str) { Draw_String (x, y + 24, str); } @@ -317,10 +317,10 @@ Sbar_DrawScrollString -- johnfitz scroll the string inside a glscissor region =============== */ -void Sbar_DrawScrollString (int x, int y, int width, const char *str) +void Sbar_DrawScrollString (int32_t x, int32_t y, int32_t width, const char *str) { float scale; - int len, ofs, left; + int32_t len, ofs, left; scale = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0); left = x * scale; @@ -331,7 +331,7 @@ void Sbar_DrawScrollString (int x, int y, int width, const char *str) glScissor (left, 0, width * scale, glheight); len = strlen(str)*8 + 40; - ofs = ((int)(realtime*30))%len; + ofs = ((int32_t)(realtime*30))%len; Sbar_DrawString (x - ofs, y, str); Sbar_DrawCharacter (x - ofs + len - 32, y, '/'); Sbar_DrawCharacter (x - ofs + len - 24, y, '/'); @@ -346,11 +346,11 @@ void Sbar_DrawScrollString (int x, int y, int width, const char *str) Sbar_itoa ============= */ -int Sbar_itoa (int num, char *buf) +int32_t Sbar_itoa (int32_t num, char *buf) { char *str; - int pow10; - int dig; + int32_t pow10; + int32_t dig; str = buf; @@ -382,11 +382,11 @@ int Sbar_itoa (int num, char *buf) Sbar_DrawNum ============= */ -void Sbar_DrawNum (int x, int y, int num, int digits, int color) +void Sbar_DrawNum (int32_t x, int32_t y, int32_t num, int32_t digits, int32_t color) { char str[12]; char *ptr; - int l, frame; + int32_t l, frame; num = q_min(999,num); //johnfitz -- cap high values rather than truncating number @@ -412,13 +412,13 @@ void Sbar_DrawNum (int x, int y, int num, int digits, int color) //============================================================================= -int fragsort[MAX_SCOREBOARD]; +int32_t fragsort[MAX_SCOREBOARD]; char scoreboardtext[MAX_SCOREBOARD][20]; -int scoreboardtop[MAX_SCOREBOARD]; -int scoreboardbottom[MAX_SCOREBOARD]; -int scoreboardcount[MAX_SCOREBOARD]; -int scoreboardlines; +int32_t scoreboardtop[MAX_SCOREBOARD]; +int32_t scoreboardbottom[MAX_SCOREBOARD]; +int32_t scoreboardcount[MAX_SCOREBOARD]; +int32_t scoreboardlines; /* =============== @@ -427,7 +427,7 @@ Sbar_SortFrags */ void Sbar_SortFrags (void) { - int i, j, k; + int32_t i, j, k; // sort by frags scoreboardlines = 0; @@ -454,7 +454,7 @@ void Sbar_SortFrags (void) } } -int Sbar_ColorForMap (int m) +int32_t Sbar_ColorForMap (int32_t m) { return m < 128 ? m + 8 : m + 8; } @@ -466,8 +466,8 @@ Sbar_UpdateScoreboard */ void Sbar_UpdateScoreboard (void) { - int i, k; - int top, bottom; + int32_t i, k; + int32_t top, bottom; scoreboard_t *s; Sbar_SortFrags (); @@ -496,8 +496,8 @@ Sbar_SoloScoreboard -- johnfitz -- new layout void Sbar_SoloScoreboard (void) { char str[256]; - int minutes, seconds, tens, units; - int len; + int32_t minutes, seconds, tens, units; + int32_t len; sprintf (str,"Kills: %i/%i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]); Sbar_DrawString (8, 12, str); @@ -507,7 +507,7 @@ void Sbar_SoloScoreboard (void) if (!fitzmode) { /* QuakeSpasm customization: */ - q_snprintf (str, sizeof(str), "skill %i", (int)(skill.value + 0.5)); + q_snprintf (str, sizeof(str), "skill %i", (int32_t)(skill.value + 0.5)); Sbar_DrawString (160 - strlen(str)*4, 12, str); q_snprintf (str, sizeof(str), "%s (%s)", cl.levelname, cl.mapname); @@ -553,10 +553,10 @@ Sbar_DrawInventory */ void Sbar_DrawInventory (void) { - int i, val; + int32_t i, val; char num[6]; float time; - int flashon; + int32_t flashon; if (rogue) { @@ -576,7 +576,7 @@ void Sbar_DrawInventory (void) if (cl.items & (IT_SHOTGUN<= 10) { if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<= 10) { if (cl.stats[STAT_ACTIVEWEAPON] == (1<3) && (teamplay.value<7)) { - int top, bottom; - int xofs; + int32_t top, bottom; + int32_t xofs; char num[12]; scoreboard_t *s; @@ -1071,11 +1071,11 @@ Sbar_IntermissionNumber ================== */ -void Sbar_IntermissionNumber (int x, int y, int num, int digits, int color) +void Sbar_IntermissionNumber (int32_t x, int32_t y, int32_t num, int32_t digits, int32_t color) { char str[12]; char *ptr; - int l, frame; + int32_t l, frame; l = Sbar_itoa (num, str); ptr = str; @@ -1106,9 +1106,9 @@ Sbar_DeathmatchOverlay void Sbar_DeathmatchOverlay (void) { qpic_t *pic; - int i, k, l; - int top, bottom; - int x, y, f; + int32_t i, k, l; + int32_t top, bottom; + int32_t x, y, f; char num[12]; scoreboard_t *s; @@ -1154,12 +1154,12 @@ void Sbar_DeathmatchOverlay (void) #if 0 { - int total; - int n, minutes, tens, units; + int32_t total; + int32_t n, minutes, tens, units; // draw time total = cl.completed_time - s->entertime; - minutes = (int)total/60; + minutes = (int32_t)total/60; n = total - minutes*60; tens = n/10; units = n%10; @@ -1186,7 +1186,7 @@ Sbar_MiniDeathmatchOverlay */ void Sbar_MiniDeathmatchOverlay (void) { - int i, k, top, bottom, x, y, f, numlines; + int32_t i, k, top, bottom, x, y, f, numlines; char num[12]; float scale; //johnfitz scoreboard_t *s; @@ -1261,8 +1261,8 @@ Sbar_IntermissionOverlay void Sbar_IntermissionOverlay (void) { qpic_t *pic; - int dig; - int num; + int32_t dig; + int32_t num; if (cl.gametype == GAME_DEATHMATCH) { diff --git a/source/sbar.h b/source/sbar.h index bce73b5..695f065 100644 --- a/source/sbar.h +++ b/source/sbar.h @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // the status bar is only redrawn if something has changed, but if anything // does, the entire thing will be redrawn for the next vid.numpages frames. -extern int sb_lines; // scan lines to draw +extern int32_t sb_lines; // scan lines to draw void Sbar_Init (void); void Sbar_LoadPics (void); diff --git a/source/screen.h b/source/screen.h index ac62624..c994982 100644 --- a/source/screen.h +++ b/source/screen.h @@ -39,14 +39,14 @@ void SCR_CenterPrint (const char *str); void SCR_BeginLoadingPlaque (void); void SCR_EndLoadingPlaque (void); -int SCR_ModalMessage (const char *text, float timeout); //johnfitz -- added timeout +int32_t SCR_ModalMessage (const char *text, float timeout); //johnfitz -- added timeout extern float scr_con_current; extern float scr_conlines; // lines of console to display -extern int sb_lines; +extern int32_t sb_lines; -extern int clearnotify; // set to 0 whenever notify text is drawn +extern int32_t clearnotify; // set to 0 whenever notify text is drawn extern bool scr_disabled_for_loading; extern bool scr_skipupdate; @@ -78,7 +78,7 @@ extern cvar_t scr_scale; extern cvar_t scr_crosshairscale; //johnfitz -extern int scr_tileclear_updates; //johnfitz +extern int32_t scr_tileclear_updates; //johnfitz #endif /* _QUAKE_SCREEN_H */ diff --git a/source/server.h b/source/server.h index 6a79f24..ea00a5b 100644 --- a/source/server.h +++ b/source/server.h @@ -27,10 +27,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { - int maxclients; - int maxclientslimit; + int32_t maxclients; + int32_t maxclientslimit; struct client_s *clients; // [maxclients] - int serverflags; // episode completion information + int32_t serverflags; // episode completion information bool changelevel_issued; // cleared when at SV_SpawnServer } server_static_t; @@ -47,7 +47,7 @@ typedef struct double time; - int lastcheck; // used by PF_checkclient + int32_t lastcheck; // used by PF_checkclient double lastchecktime; char name[64]; // map name @@ -57,8 +57,8 @@ typedef struct struct qmodel_s *models[MAX_MODELS]; const char *sound_precache[MAX_SOUNDS]; // NULL terminated const char *lightstyles[MAX_LIGHTSTYLES]; - int num_edicts; - int max_edicts; + int32_t num_edicts; + int32_t max_edicts; edict_t *edicts; // can NOT be array indexed, because // edict_t is variable sized, but can // be used to reference the world ent @@ -101,16 +101,16 @@ typedef struct client_s byte msgbuf[MAX_MSGLEN]; edict_t *edict; // EDICT_NUM(clientnum+1) char name[32]; // for printing to other people - int colors; + int32_t colors; float ping_times[NUM_PING_TIMES]; - int num_pings; // ping_times[num_pings%NUM_PING_TIMES] + int32_t num_pings; // ping_times[num_pings%NUM_PING_TIMES] // spawn parms are carried from level to level float spawn_parms[NUM_SPAWN_PARMS]; // client known data for deltas - int old_frags; + int32_t old_frags; } client_t; @@ -193,8 +193,8 @@ extern edict_t *sv_player; void SV_Init (void); -void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count); -void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, +void SV_StartParticle (vec3_t org, vec3_t dir, int32_t color, int32_t count); +void SV_StartSound (edict_t *entity, int32_t channel, const char *sample, int32_t volume, float attenuation); void SV_DropClient (bool crash); @@ -202,7 +202,7 @@ void SV_DropClient (bool crash); void SV_SendClientMessages (void); void SV_ClearDatagram (void); -int SV_ModelIndex (const char *name); +int32_t SV_ModelIndex (const char *name); void SV_SetIdealPitch (void); diff --git a/source/snd_codec.c b/source/snd_codec.c index 2319274..dfea2e2 100644 --- a/source/snd_codec.c +++ b/source/snd_codec.c @@ -246,12 +246,12 @@ void S_CodecCloseStream (snd_stream_t *stream) stream->codec->codec_close(stream); } -int S_CodecRewindStream (snd_stream_t *stream) +int32_t S_CodecRewindStream (snd_stream_t *stream) { return stream->codec->codec_rewind(stream); } -int S_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) +int32_t S_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer) { return stream->codec->codec_read(stream, bytes, buffer); } @@ -294,7 +294,7 @@ void S_CodecUtilClose(snd_stream_t **stream) *stream = NULL; } -int S_CodecIsAvailable (uint32_t type) +int32_t S_CodecIsAvailable (uint32_t type) { snd_codec_t *codec = codecs; while (codec) diff --git a/source/snd_codec.h b/source/snd_codec.h index a25408f..3ebca6e 100644 --- a/source/snd_codec.h +++ b/source/snd_codec.h @@ -28,13 +28,13 @@ typedef struct snd_info_s { - int rate; - int bits, width; - int channels; - int samples; - int blocksize; - int size; - int dataofs; + int32_t rate; + int32_t bits, width; + int32_t channels; + int32_t samples; + int32_t blocksize; + int32_t size; + int32_t dataofs; } snd_info_t; typedef enum { @@ -76,8 +76,8 @@ snd_stream_t *S_CodecOpenStreamExt (const char *filename); * MUST have an extension. */ void S_CodecCloseStream (snd_stream_t *stream); -int S_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer); -int S_CodecRewindStream (snd_stream_t *stream); +int32_t S_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer); +int32_t S_CodecRewindStream (snd_stream_t *stream); snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec); void S_CodecUtilClose(snd_stream_t **stream); @@ -96,7 +96,7 @@ void S_CodecUtilClose(snd_stream_t **stream); #define CODECTYPE_WAVE CODECTYPE_WAV #define CODECTYPE_MIDI CODECTYPE_MID -int S_CodecIsAvailable (uint32_t type); +int32_t S_CodecIsAvailable (uint32_t type); /* return 1 if available, 0 if codec failed init * or -1 if no such codec is present. */ diff --git a/source/snd_codeci.h b/source/snd_codeci.h index cf6b788..2d00a45 100644 --- a/source/snd_codeci.h +++ b/source/snd_codeci.h @@ -30,8 +30,8 @@ typedef bool (*CODEC_INIT)(void); typedef void (*CODEC_SHUTDOWN)(void); typedef bool (*CODEC_OPEN)(snd_stream_t *stream); -typedef int (*CODEC_READ)(snd_stream_t *stream, int bytes, void *buffer); -typedef int (*CODEC_REWIND)(snd_stream_t *stream); +typedef int32_t (*CODEC_READ)(snd_stream_t *stream, int32_t bytes, void *buffer); +typedef int32_t (*CODEC_REWIND)(snd_stream_t *stream); typedef void (*CODEC_CLOSE)(snd_stream_t *stream); struct snd_codec_s diff --git a/source/snd_dma.c b/source/snd_dma.c index 71e4e79..57a47d0 100644 --- a/source/snd_dma.c +++ b/source/snd_dma.c @@ -40,9 +40,9 @@ static void S_StopAllSoundsC (void); // ======================================================================= channel_t snd_channels[MAX_CHANNELS]; -int total_channels; +int32_t total_channels; -static int snd_blocked = 0; +static int32_t snd_blocked = 0; static bool snd_initialized = false; static dma_t sn; @@ -55,16 +55,16 @@ vec3_t listener_up; #define sound_nominal_clip_dist 1000.0 -int soundtime; // sample PAIRS -int paintedtime; // sample PAIRS +int32_t soundtime; // sample PAIRS +int32_t paintedtime; // sample PAIRS -int s_rawend; +int32_t s_rawend; portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES]; #define MAX_SFX 1024 static sfx_t *known_sfx = NULL; // hunk allocated [MAX_SFX] -static int num_sfx; +static int32_t num_sfx; static sfx_t *ambient_sfx[NUM_AMBIENTS]; @@ -163,7 +163,7 @@ S_Init */ void S_Init (void) { - int i; + int32_t i; if (snd_initialized) { @@ -271,7 +271,7 @@ S_FindName */ static sfx_t *S_FindName (const char *name) { - int i; + int32_t i; sfx_t *sfx; if (!name) @@ -350,11 +350,11 @@ SND_PickChannel picks a channel based on priorities, empty slots, number of channels ================= */ -channel_t *SND_PickChannel (int entnum, int entchannel) +channel_t *SND_PickChannel (int32_t entnum, int32_t entchannel) { - int ch_idx; - int first_to_die; - int life_left; + int32_t ch_idx; + int32_t first_to_die; + int32_t life_left; // Check for replacement sound, or find the best one to replace first_to_die = -1; @@ -429,12 +429,12 @@ void SND_Spatialize (channel_t *ch) // add in distance effect scale = (1.0 - dist) * rscale; - ch->rightvol = (int) (ch->master_vol * scale); + ch->rightvol = (int32_t) (ch->master_vol * scale); if (ch->rightvol < 0) ch->rightvol = 0; scale = (1.0 - dist) * lscale; - ch->leftvol = (int) (ch->master_vol * scale); + ch->leftvol = (int32_t) (ch->master_vol * scale); if (ch->leftvol < 0) ch->leftvol = 0; } @@ -444,12 +444,12 @@ void SND_Spatialize (channel_t *ch) // Start a sound effect // ======================================================================= -void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation) +void S_StartSound (int32_t entnum, int32_t entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation) { channel_t *target_chan, *check; sfxcache_t *sc; - int ch_idx; - int skip; + int32_t ch_idx; + int32_t skip; if (!sound_started) return; @@ -469,7 +469,7 @@ void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float memset (target_chan, 0, sizeof(*target_chan)); VectorCopy(origin, target_chan->origin); target_chan->dist_mult = attenuation / sound_nominal_clip_dist; - target_chan->master_vol = (int) (fvol * 255); + target_chan->master_vol = (int32_t) (fvol * 255); target_chan->entnum = entnum; target_chan->entchannel = entchannel; SND_Spatialize(target_chan); @@ -499,7 +499,7 @@ void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float if (check->sfx == sfx && !check->pos) { /* - skip = rand () % (int)(0.1 * shm->speed); + skip = rand () % (int32_t)(0.1 * shm->speed); if (skip >= target_chan->end) skip = target_chan->end - 1; */ @@ -516,9 +516,9 @@ void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float } } -void S_StopSound (int entnum, int entchannel) +void S_StopSound (int32_t entnum, int32_t entchannel) { - int i; + int32_t i; for (i = 0; i < MAX_DYNAMIC_CHANNELS; i++) { @@ -534,7 +534,7 @@ void S_StopSound (int entnum, int entchannel) void S_StopAllSounds (bool clear) { - int i; + int32_t i; if (!sound_started) return; @@ -560,7 +560,7 @@ static void S_StopAllSoundsC (void) void S_ClearBuffer (void) { - int clear; + int32_t clear; if (!sound_started || !shm) return; @@ -616,7 +616,7 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) ss->sfx = sfx; VectorCopy (origin, ss->origin); - ss->master_vol = (int)vol; + ss->master_vol = (int32_t)vol; ss->dist_mult = (attenuation / 64) / sound_nominal_clip_dist; ss->end = paintedtime + sc->length; @@ -634,7 +634,7 @@ S_UpdateAmbientSounds static void S_UpdateAmbientSounds (void) { mleaf_t *l; - int vol, ambient_channel; + int32_t vol, ambient_channel; channel_t *chan; // no ambients when disconnected @@ -657,20 +657,20 @@ static void S_UpdateAmbientSounds (void) chan = &snd_channels[ambient_channel]; chan->sfx = ambient_sfx[ambient_channel]; - vol = (int) (ambient_level.value * l->ambient_sound_level[ambient_channel]); + vol = (int32_t) (ambient_level.value * l->ambient_sound_level[ambient_channel]); if (vol < 8) vol = 0; // don't adjust volume too fast if (chan->master_vol < vol) { - chan->master_vol += (int) (host_frametime * ambient_fade.value); + chan->master_vol += (int32_t) (host_frametime * ambient_fade.value); if (chan->master_vol > vol) chan->master_vol = vol; } else if (chan->master_vol > vol) { - chan->master_vol -= (int) (host_frametime * ambient_fade.value); + chan->master_vol -= (int32_t) (host_frametime * ambient_fade.value); if (chan->master_vol < vol) chan->master_vol = vol; } @@ -690,18 +690,18 @@ Expects data in signed 16 bit, or unsigned 8 bit format. =================== */ -void S_RawSamples (int samples, int rate, int width, int channels, byte *data, float volume) +void S_RawSamples (int32_t samples, int32_t rate, int32_t width, int32_t channels, byte *data, float volume) { - int i; - int src, dst; + int32_t i; + int32_t src, dst; float scale; - int intVolume; + int32_t intVolume; if (s_rawend < paintedtime) s_rawend = paintedtime; scale = (float) rate / shm->speed; - intVolume = (int) (256 * volume); + intVolume = (int32_t) (256 * volume); if (channels == 2 && width == 2) { @@ -774,8 +774,8 @@ Called once each time through the main loop */ void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) { - int i, j; - int total; + int32_t i, j; + int32_t total; channel_t *ch; channel_t *combine; @@ -868,10 +868,10 @@ void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) static void GetSoundtime (void) { - int samplepos; - static int buffers; - static int oldsamplepos; - int fullsamples; + int32_t samplepos; + static int32_t buffers; + static int32_t oldsamplepos; + int32_t fullsamples; fullsamples = shm->samples / shm->channels; @@ -905,7 +905,7 @@ void S_ExtraUpdate (void) static void S_Update_ (void) { uint32_t endtime; - int samps; + int32_t samps; if (!sound_started || (snd_blocked > 0)) return; @@ -970,8 +970,8 @@ console functions static void S_Play (void) { - static int hash = 345; - int i; + static int32_t hash = 345; + int32_t i; char name[256]; sfx_t *sfx; @@ -991,8 +991,8 @@ static void S_Play (void) static void S_PlayVol (void) { - static int hash = 543; - int i; + static int32_t hash = 543; + int32_t i; float vol; char name[256]; sfx_t *sfx; @@ -1014,10 +1014,10 @@ static void S_PlayVol (void) static void S_SoundList (void) { - int i; + int32_t i; sfx_t *sfx; sfxcache_t *sc; - int size, total; + int32_t size, total; total = 0; for (sfx = known_sfx, i = 0; i < num_sfx; i++, sfx++) diff --git a/source/snd_flac.c b/source/snd_flac.c index d769b3a..4ecdbe4 100644 --- a/source/snd_flac.c +++ b/source/snd_flac.c @@ -72,7 +72,7 @@ typedef struct { fshandle_t *file; snd_info_t *info; byte *buffer; - int size, pos, error; + int32_t size, pos, error; } flacfile_t; /* CALLBACK FUNCTIONS: */ @@ -244,7 +244,7 @@ static void S_FLAC_CodecShutdown (void) static bool S_FLAC_CodecOpenStream (snd_stream_t *stream) { flacfile_t *ff; - int rc; + int32_t rc; ff = (flacfile_t *) Z_Malloc(sizeof(flacfile_t)); @@ -327,14 +327,14 @@ _fail: return false; } -static int S_FLAC_CodecReadStream (snd_stream_t *stream, int len, void *buffer) +static int32_t S_FLAC_CodecReadStream (snd_stream_t *stream, int32_t len, void *buffer) { flacfile_t *ff = (flacfile_t *) stream->priv; byte *buf = (byte *) buffer; - int count = 0; + int32_t count = 0; while (len) { - int res = 0; + int32_t res = 0; if (ff->size == ff->pos) FLAC__stream_decoder_process_single (ff->decoder); if (ff->error) return -1; @@ -371,7 +371,7 @@ static void S_FLAC_CodecCloseStream (snd_stream_t *stream) S_CodecUtilClose(&stream); } -static int S_FLAC_CodecRewindStream (snd_stream_t *stream) +static int32_t S_FLAC_CodecRewindStream (snd_stream_t *stream) { flacfile_t *ff = (flacfile_t *) stream->priv; diff --git a/source/snd_mem.c b/source/snd_mem.c index 306ec5b..511a107 100644 --- a/source/snd_mem.c +++ b/source/snd_mem.c @@ -27,13 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ResampleSfx ================ */ -static void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data) +static void ResampleSfx (sfx_t *sfx, int32_t inrate, int32_t inwidth, byte *data) { - int outcount; - int srcsample; + int32_t outcount; + int32_t srcsample; float stepscale; - int i; - int sample, samplefrac, fracstep; + int32_t i; + int32_t sample, samplefrac, fracstep; sfxcache_t *sc; sc = (sfxcache_t *) Cache_Check (&sfx->cache); @@ -60,7 +60,7 @@ static void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data) { // fast special case for (i = 0; i < outcount; i++) - ((int8_t *)sc->data)[i] = (int)( (uint8_t)(data[i]) - 128); + ((int8_t *)sc->data)[i] = (int32_t)( (uint8_t)(data[i]) - 128); } else { @@ -74,7 +74,7 @@ static void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data) if (inwidth == 2) sample = LittleShort ( ((int16_t *)data)[srcsample] ); else - sample = (int)( (uint8_t)(data[srcsample]) - 128) << 8; + sample = (int32_t)( (uint8_t)(data[srcsample]) - 128) << 8; if (sc->width == 2) ((int16_t *)sc->data)[i] = sample; else @@ -95,7 +95,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) char namebuffer[256]; byte *data; wavinfo_t info; - int len; + int32_t len; float stepscale; sfxcache_t *sc; byte stackbuf[1*1024]; // avoid dirtying the cache heap @@ -105,7 +105,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) if (sc) return sc; -// Con_Printf ("S_LoadSound: %x\n", (int)stackbuf); +// Con_Printf ("S_LoadSound: %x\n", (int32_t)stackbuf); // load it in q_strlcpy(namebuffer, "sound/", sizeof(namebuffer)); @@ -174,7 +174,7 @@ static byte *data_p; static byte *iff_end; static byte *last_chunk; static byte *iff_data; -static int iff_chunk_len; +static int32_t iff_chunk_len; static int16_t GetLittleShort (void) { @@ -185,9 +185,9 @@ static int16_t GetLittleShort (void) return val; } -static int GetLittleLong (void) +static int32_t GetLittleLong (void) { - int val = 0; + int32_t val = 0; val = *data_p; val = val + (*(data_p+1)<<8); val = val + (*(data_p+2)<<16); @@ -240,7 +240,7 @@ static void DumpChunks (void) memcpy (str, data_p, 4); data_p += 4; iff_chunk_len = GetLittleLong(); - Con_Printf ("0x%x : %s (%d)\n", (int)(data_p - 4), str, iff_chunk_len); + Con_Printf ("0x%x : %s (%d)\n", (int32_t)(data_p - 4), str, iff_chunk_len); data_p += (iff_chunk_len + 1) & ~1; } while (data_p < iff_end); } @@ -251,12 +251,12 @@ static void DumpChunks (void) GetWavinfo ============ */ -wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength) +wavinfo_t GetWavinfo (const char *name, byte *wav, int32_t wavlength) { wavinfo_t info; - int i; - int format; - int samples; + int32_t i; + int32_t format; + int32_t samples; memset (&info, 0, sizeof(info)); diff --git a/source/snd_mikmod.c b/source/snd_mikmod.c index 7e2ded1..ad78375 100644 --- a/source/snd_mikmod.c +++ b/source/snd_mikmod.c @@ -53,7 +53,7 @@ typedef struct _mik_priv { MODULE *module; } mik_priv_t; -static int MIK_Seek (MREADER *r, long ofs, int whence) +static int32_t MIK_Seek (MREADER *r, long ofs, int32_t whence) { return FS_fseek(((mik_priv_t *)r)->fh, ofs, whence); } @@ -68,7 +68,7 @@ static BOOL MIK_Read (MREADER *r, void *ptr, size_t siz) return !!FS_fread(ptr, siz, 1, ((mik_priv_t *)r)->fh); } -static int MIK_Get (MREADER *r) +static int32_t MIK_Get (MREADER *r) { return FS_fgetc(((mik_priv_t *)r)->fh); } @@ -165,11 +165,11 @@ static bool S_MIKMOD_CodecOpenStream (snd_stream_t *stream) return true; } -static int S_MIKMOD_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) +static int32_t S_MIKMOD_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer) { if (!Player_Active()) return 0; - return (int) VC_WriteBytes((SBYTE *)buffer, bytes); + return (int32_t) VC_WriteBytes((SBYTE *)buffer, bytes); } static void S_MIKMOD_CodecCloseStream (snd_stream_t *stream) @@ -180,7 +180,7 @@ static void S_MIKMOD_CodecCloseStream (snd_stream_t *stream) S_CodecUtilClose(&stream); } -static int S_MIKMOD_CodecRewindStream (snd_stream_t *stream) +static int32_t S_MIKMOD_CodecRewindStream (snd_stream_t *stream) { Player_SetPosition (0); return 0; diff --git a/source/snd_mix.c b/source/snd_mix.c index 7f7a741..96e7573 100644 --- a/source/snd_mix.c +++ b/source/snd_mix.c @@ -25,16 +25,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PAINTBUFFER_SIZE 2048 portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE]; -int snd_scaletable[32][256]; -int *snd_p, snd_linear_count; +int32_t snd_scaletable[32][256]; +int32_t *snd_p, snd_linear_count; int16_t *snd_out; -static int snd_vol; +static int32_t snd_vol; static void Snd_WriteLinearBlastStereo16 (void) { - int i; - int val; + int32_t i; + int32_t val; for (i = 0; i < snd_linear_count; i += 2) { @@ -56,12 +56,12 @@ static void Snd_WriteLinearBlastStereo16 (void) } } -static void S_TransferStereo16 (int endtime) +static void S_TransferStereo16 (int32_t endtime) { - int lpos; - int lpaintedtime; + int32_t lpos; + int32_t lpaintedtime; - snd_p = (int *) paintbuffer; + snd_p = (int32_t *) paintbuffer; lpaintedtime = paintedtime; while (lpaintedtime < endtime) @@ -85,11 +85,11 @@ static void S_TransferStereo16 (int endtime) } } -static void S_TransferPaintBuffer (int endtime) +static void S_TransferPaintBuffer (int32_t endtime) { - int out_idx, out_mask; - int count, step, val; - int *p; + int32_t out_idx, out_mask; + int32_t count, step, val; + int32_t *p; if (shm->samplebits == 16 && shm->channels == 2) { @@ -97,7 +97,7 @@ static void S_TransferPaintBuffer (int endtime) return; } - p = (int *) paintbuffer; + p = (int32_t *) paintbuffer; count = (endtime - paintedtime) * shm->channels; out_mask = shm->samples - 1; out_idx = paintedtime * shm->channels & out_mask; @@ -162,9 +162,9 @@ kernel has room for M+1 floats f_c is the filter cutoff frequency, as a fraction of the samplerate ============== */ -static void S_MakeBlackmanWindowKernel(float *kernel, int M, float f_c) +static void S_MakeBlackmanWindowKernel(float *kernel, int32_t M, float f_c) { - int i; + int32_t i; for (i = 0; i <= M; i++) { if (i == M/2) @@ -197,13 +197,13 @@ static void S_MakeBlackmanWindowKernel(float *kernel, int M, float f_c) typedef struct { float *memory; // kernelsize floats float *kernel; // kernelsize floats - int kernelsize; // M+1, rounded up to be a multiple of 16 - int M; // M value used to make kernel, even - int parity; // 0-3 + int32_t kernelsize; // M+1, rounded up to be a multiple of 16 + int32_t M; // M value used to make kernel, even + int32_t parity; // 0-3 float f_c; // cutoff frequency, [0..1], fraction of sample rate } filter_t; -static void S_UpdateFilter(filter_t *filter, int M, float f_c) +static void S_UpdateFilter(filter_t *filter, int32_t M, float f_c) { if (filter->f_c != f_c || filter->M != M) { @@ -235,13 +235,13 @@ kernel is 4x faster, because we can skip 3/4 of the input samples that are known to be 0 and skip 3/4 of the filter kernel. ============== */ -static void S_ApplyFilter(filter_t *filter, int *data, int stride, int count) +static void S_ApplyFilter(filter_t *filter, int32_t *data, int32_t stride, int32_t count) { - int i, j; + int32_t i, j; float *input; - const int kernelsize = filter->kernelsize; + const int32_t kernelsize = filter->kernelsize; const float *kernel = filter->kernel; - int parity; + int32_t parity; input = (float *) malloc(sizeof(float) * (filter->kernelsize + count)); @@ -295,13 +295,13 @@ assumes 44100Hz sample rate, and lowpasses at around 5kHz memory should be a zero-filled filter_t struct ============== */ -static void S_LowpassFilter(int *data, int stride, int count, +static void S_LowpassFilter(int32_t *data, int32_t stride, int32_t count, filter_t *memory) { - int M; + int32_t M; float bw, f_c; - switch ((int)snd_filterquality.value) + switch ((int32_t)snd_filterquality.value) { case 1: M = 126; bw = 0.900; break; @@ -330,13 +330,13 @@ CHANNEL MIXING =============================================================================== */ -static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int endtime, int paintbufferstart); -static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int endtime, int paintbufferstart); +static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int32_t endtime, int32_t paintbufferstart); +static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int32_t endtime, int32_t paintbufferstart); -void S_PaintChannels (int endtime) +void S_PaintChannels (int32_t endtime) { - int i; - int end, ltime, count; + int32_t i; + int32_t end, ltime, count; channel_t *ch; sfxcache_t *sc; @@ -415,15 +415,15 @@ void S_PaintChannels (int endtime) if (sndspeed.value == 11025 && shm->speed == 44100) { static filter_t memory_l, memory_r; - S_LowpassFilter((int *)paintbuffer, 2, end - paintedtime, &memory_l); - S_LowpassFilter(((int *)paintbuffer) + 1, 2, end - paintedtime, &memory_r); + S_LowpassFilter((int32_t *)paintbuffer, 2, end - paintedtime, &memory_l); + S_LowpassFilter(((int32_t *)paintbuffer) + 1, 2, end - paintedtime, &memory_r); } // paint in the music if (s_rawend >= paintedtime) { // copy from the streaming sound source - int s; - int stop; + int32_t s; + int32_t stop; stop = (end < s_rawend) ? end : s_rawend; @@ -448,8 +448,8 @@ void S_PaintChannels (int endtime) void SND_InitScaletable (void) { - int i, j; - int scale; + int32_t i, j; + int32_t scale; for (i = 0; i < 32; i++) { @@ -469,12 +469,12 @@ void SND_InitScaletable (void) } -static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count, int paintbufferstart) +static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int32_t count, int32_t paintbufferstart) { - int data; - int *lscale, *rscale; + int32_t data; + int32_t *lscale, *rscale; uint8_t *sfx; - int i; + int32_t i; if (ch->leftvol > 255) ch->leftvol = 255; @@ -495,13 +495,13 @@ static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count, int ch->pos += count; } -static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count, int paintbufferstart) +static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int32_t count, int32_t paintbufferstart) { - int data; - int left, right; - int leftvol, rightvol; + int32_t data; + int32_t left, right; + int32_t leftvol, rightvol; int16_t *sfx; - int i; + int32_t i; leftvol = ch->leftvol * snd_vol; rightvol = ch->rightvol * snd_vol; diff --git a/source/snd_mp3.c b/source/snd_mp3.c index 9b26f1d..8333221 100644 --- a/source/snd_mp3.c +++ b/source/snd_mp3.c @@ -140,10 +140,10 @@ static size_t mp3_tagsize(const uint8_t *data, size_t length) /* Attempts to read an ID3 tag at the current location in stream and * consume it all. Returns -1 if no tag is found. Its up to caller * to recover. */ -static int mp3_inputtag(snd_stream_t *stream) +static int32_t mp3_inputtag(snd_stream_t *stream) { mp3_priv_t *p = (mp3_priv_t *) stream->priv; - int rc = -1; + int32_t rc = -1; size_t remaining; size_t tagsize; @@ -178,7 +178,7 @@ static int mp3_inputtag(snd_stream_t *stream) /* (Re)fill the stream buffer that is to be decoded. If any data * still exists in the buffer then they are first shifted to be * front of the stream buffer. */ -static int mp3_inputdata(snd_stream_t *stream) +static int32_t mp3_inputdata(snd_stream_t *stream) { mp3_priv_t *p = (mp3_priv_t *) stream->priv; size_t bytes_read; @@ -209,7 +209,7 @@ static int mp3_inputdata(snd_stream_t *stream) return 0; } -static int mp3_startread(snd_stream_t *stream) +static int32_t mp3_startread(snd_stream_t *stream) { mp3_priv_t *p = (mp3_priv_t *) stream->priv; size_t ReadSize; @@ -292,12 +292,12 @@ static int mp3_startread(snd_stream_t *stream) * If needed, read some more MP3 data, decode them and synth them * Place in buf[]. * Return number of samples read. */ -static int mp3_decode(snd_stream_t *stream, byte *buf, int len) +static int32_t mp3_decode(snd_stream_t *stream, byte *buf, int32_t len) { mp3_priv_t *p = (mp3_priv_t *) stream->priv; - int donow, i, done = 0; + int32_t donow, i, done = 0; mad_fixed_t sample; - int chan, x; + int32_t chan, x; do { @@ -377,7 +377,7 @@ static int mp3_decode(snd_stream_t *stream, byte *buf, int len) return done; } -static int mp3_stopread(snd_stream_t *stream) +static int32_t mp3_stopread(snd_stream_t *stream) { mp3_priv_t *p = (mp3_priv_t*) stream->priv; @@ -399,7 +399,7 @@ static void S_MP3_CodecShutdown (void) static bool S_MP3_CodecOpenStream (snd_stream_t *stream) { - int err; + int32_t err; stream->priv = calloc(1, sizeof(mp3_priv_t)); if (!stream->priv) @@ -425,9 +425,9 @@ static bool S_MP3_CodecOpenStream (snd_stream_t *stream) return false; } -static int S_MP3_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) +static int32_t S_MP3_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer) { - int res = mp3_decode(stream, (byte *)buffer, bytes / stream->info.width); + int32_t res = mp3_decode(stream, (byte *)buffer, bytes / stream->info.width); return res * stream->info.width; } @@ -438,12 +438,12 @@ static void S_MP3_CodecCloseStream (snd_stream_t *stream) S_CodecUtilClose(&stream); } -static int S_MP3_CodecRewindStream (snd_stream_t *stream) +static int32_t S_MP3_CodecRewindStream (snd_stream_t *stream) { mp3_priv_t *p = (mp3_priv_t *) stream->priv; size_t initial_bitrate = p->frame.header.bitrate; size_t tagsize = 0, consumed = 0; - int vbr = 0; /* Variable Bit Rate, bool */ + int32_t vbr = 0; /* Variable Bit Rate, bool */ bool depadded = false; /* Reset all */ @@ -462,7 +462,7 @@ static int S_MP3_CodecRewindStream (snd_stream_t *stream) while (1) /* Read data from the MP3 file */ { - int bytes_read, padding = 0; + int32_t bytes_read, padding = 0; size_t leftover = p->stream.bufend - p->stream.next_frame; memcpy(p->mp3_buffer, p->stream.this_frame, leftover); diff --git a/source/snd_mpg123.c b/source/snd_mpg123.c index 21a0c93..83d49b1 100644 --- a/source/snd_mpg123.c +++ b/source/snd_mpg123.c @@ -36,7 +36,7 @@ /* Private data */ typedef struct _mp3_priv_t { - int handle_newed, handle_opened; + int32_t handle_newed, handle_opened; mpg123_handle* handle; } mp3_priv_t; @@ -53,7 +53,7 @@ static ssize_t mp3_read (void *f, void *buf, size_t size) return ret; } -static off_t mp3_seek (void *f, off_t offset, int whence) +static off_t mp3_seek (void *f, off_t offset, int32_t whence) { if (f == NULL) return (-1); if (FS_fseek((fshandle_t *)f, (long) offset, whence) < 0) @@ -89,7 +89,7 @@ static void S_MP3_CodecShutdown (void) static bool S_MP3_CodecOpenStream (snd_stream_t *stream) { long rate = 0; - int encoding = 0, channels = 0; + int32_t encoding = 0, channels = 0; mp3_priv_t *priv = NULL; stream->priv = Z_Malloc(sizeof(mp3_priv_t)); @@ -176,17 +176,17 @@ _fail: return false; } -static int S_MP3_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) +static int32_t S_MP3_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer) { mp3_priv_t *priv = (mp3_priv_t *) stream->priv; size_t bytes_read = 0; - int res = mpg123_read (priv->handle, (uint8_t *)buffer, (size_t)bytes, &bytes_read); + int32_t res = mpg123_read (priv->handle, (uint8_t *)buffer, (size_t)bytes, &bytes_read); switch (res) { case MPG123_DONE: Con_DPrintf("mp3 EOF\n"); case MPG123_OK: - return (int)bytes_read; + return (int32_t)bytes_read; } return -1; /* error */ } @@ -200,7 +200,7 @@ static void S_MP3_CodecCloseStream (snd_stream_t *stream) S_CodecUtilClose(&stream); } -static int S_MP3_CodecRewindStream (snd_stream_t *stream) +static int32_t S_MP3_CodecRewindStream (snd_stream_t *stream) { mp3_priv_t *priv = (mp3_priv_t *) stream->priv; off_t res = mpg123_seek(priv->handle, 0, SEEK_SET); diff --git a/source/snd_opus.c b/source/snd_opus.c index b2f81bf..0ba9cdb 100644 --- a/source/snd_opus.c +++ b/source/snd_opus.c @@ -34,15 +34,15 @@ /* CALLBACK FUNCTIONS: */ -static int opc_fclose (void *f) +static int32_t opc_fclose (void *f) { (void)f; return 0; /* we fclose() elsewhere. */ } -static int opc_fread (void *f, uint8_t *buf, int size) +static int32_t opc_fread (void *f, uint8_t *buf, int32_t size) { - int ret; + int32_t ret; if (size < 0) { @@ -50,13 +50,13 @@ static int opc_fread (void *f, uint8_t *buf, int size) return -1; } - ret = (int) FS_fread(buf, 1, (size_t)size, (fshandle_t *)f); + ret = (int32_t) FS_fread(buf, 1, (size_t)size, (fshandle_t *)f); if (ret == 0 && errno != 0) ret = -1; return ret; } -static int opc_fseek (void *f, opus_int64 off, int whence) +static int32_t opc_fseek (void *f, opus_int64 off, int32_t whence) { if (f == NULL) return (-1); return FS_fseek((fshandle_t *)f, (long) off, whence); @@ -69,10 +69,10 @@ static opus_int64 opc_ftell (void *f) static const OpusFileCallbacks opc_qfs = { - (int (*)(void *, uint8_t *, int)) opc_fread, - (int (*)(void *, opus_int64, int)) opc_fseek, + (int32_t (*)(void *, uint8_t *, int32_t)) opc_fread, + (int32_t (*)(void *, opus_int64, int32_t)) opc_fseek, (opus_int64 (*)(void *)) opc_ftell, - (int (*)(void *)) opc_fclose + (int32_t (*)(void *)) opc_fclose }; static bool S_OPUS_CodecInitialize (void) @@ -89,7 +89,7 @@ static bool S_OPUS_CodecOpenStream (snd_stream_t *stream) OggOpusFile *opFile; const OpusHead *op_info; long numstreams; - int res; + int32_t res; opFile = op_open_callbacks(&stream->fh, &opc_qfs, NULL, 0, &res); if (!opFile) @@ -147,10 +147,10 @@ _fail: return false; } -static int S_OPUS_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) +static int32_t S_OPUS_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer) { - int section; /* FIXME: handle section changes */ - int cnt, res, rem; + int32_t section; /* FIXME: handle section changes */ + int32_t cnt, res, rem; opus_int16 * ptr; rem = bytes / stream->info.width; @@ -188,7 +188,7 @@ static void S_OPUS_CodecCloseStream (snd_stream_t *stream) S_CodecUtilClose(&stream); } -static int S_OPUS_CodecRewindStream (snd_stream_t *stream) +static int32_t S_OPUS_CodecRewindStream (snd_stream_t *stream) { return op_pcm_seek ((OggOpusFile *)stream->priv, 0); } diff --git a/source/snd_sdl.c b/source/snd_sdl.c index f104584..49ab4df 100644 --- a/source/snd_sdl.c +++ b/source/snd_sdl.c @@ -26,13 +26,13 @@ #include -static int buffersize; +static int32_t buffersize; -static void SDLCALL paint_audio (void *unused, Uint8 *stream, int len) +static void SDLCALL paint_audio (void *unused, Uint8 *stream, int32_t len) { - int pos, tobufend; - int len1, len2; + int32_t pos, tobufend; + int32_t len1, len2; (void)unused; @@ -75,7 +75,7 @@ static void SDLCALL paint_audio (void *unused, Uint8 *stream, int len) bool SNDDMA_Init (dma_t *dma) { SDL_AudioSpec desired, obtained; - int tmp, val; + int32_t tmp, val; char drivername[128]; if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) @@ -174,7 +174,7 @@ bool SNDDMA_Init (dma_t *dma) return true; } -int SNDDMA_GetDMAPos (void) +int32_t SNDDMA_GetDMAPos (void) { return shm->samplepos; } diff --git a/source/snd_umx.c b/source/snd_umx.c index 88b0479..17afc29 100644 --- a/source/snd_umx.c +++ b/source/snd_umx.c @@ -85,10 +85,10 @@ static const char *mustype[] = { * also see Unreal Wiki: * http://wiki.beyondunreal.com/Legacy:Package_File_Format/Data_Details */ -static fci_t get_fci (const char *in, int *pos) +static fci_t get_fci (const char *in, int32_t *pos) { int32_t a; - int size; + int32_t size; size = 1; a = in[0] & 0x3f; @@ -121,7 +121,7 @@ static fci_t get_fci (const char *in, int *pos) return a; } -static int get_objtype (fshandle_t *f, int32_t ofs, int type) +static int32_t get_objtype (fshandle_t *f, int32_t ofs, int32_t type) { char sig[16]; _retry: @@ -177,11 +177,11 @@ _retry: return -1; } -static int read_export (fshandle_t *f, const struct upkg_hdr *hdr, +static int32_t read_export (fshandle_t *f, const struct upkg_hdr *hdr, int32_t *ofs, int32_t *objsize) { char buf[40]; - int idx = 0, t; + int32_t idx = 0, t; FS_fseek(f, *ofs, SEEK_SET); if (FS_fread(buf, 4, 10, f) < 10) @@ -198,10 +198,10 @@ static int read_export (fshandle_t *f, const struct upkg_hdr *hdr, return t; /* return type_name index */ } -static int read_typname(fshandle_t *f, const struct upkg_hdr *hdr, - int idx, char *out) +static int32_t read_typname(fshandle_t *f, const struct upkg_hdr *hdr, + int32_t idx, char *out) { - int i, s; + int32_t i, s; long l; char buf[64]; @@ -224,10 +224,10 @@ static int read_typname(fshandle_t *f, const struct upkg_hdr *hdr, return 0; } -static int probe_umx (fshandle_t *f, const struct upkg_hdr *hdr, +static int32_t probe_umx (fshandle_t *f, const struct upkg_hdr *hdr, int32_t *ofs, int32_t *objsize) { - int i, idx, t; + int32_t i, idx, t; int32_t s, pos; long fsiz; char buf[64]; @@ -278,7 +278,7 @@ static int32_t probe_header (void *header) struct upkg_hdr *hdr; uint8_t *p; uint32_t *swp; - int i; + int32_t i; /* byte swap the header - all members are 32 bit LE values */ p = (uint8_t *) header; @@ -322,7 +322,7 @@ static int32_t probe_header (void *header) return -1; } -static int process_upkg (fshandle_t *f, int32_t *ofs, int32_t *objsize) +static int32_t process_upkg (fshandle_t *f, int32_t *ofs, int32_t *objsize) { char header[UPKG_HDR_SIZE]; @@ -345,7 +345,7 @@ static void S_UMX_CodecShutdown (void) static bool S_UMX_CodecOpenStream (snd_stream_t *stream) { - int type; + int32_t type; int32_t ofs = 0, size = 0; type = process_upkg(&stream->fh, &ofs, &size); @@ -373,7 +373,7 @@ static bool S_UMX_CodecOpenStream (snd_stream_t *stream) return false; } -static int S_UMX_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) +static int32_t S_UMX_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer) { (void)stream, (void)bytes, (void)buffer; return -1; @@ -384,7 +384,7 @@ static void S_UMX_CodecCloseStream (snd_stream_t *stream) S_CodecUtilClose(&stream); } -static int S_UMX_CodecRewindStream (snd_stream_t *stream) +static int32_t S_UMX_CodecRewindStream (snd_stream_t *stream) { (void)stream; return -1; diff --git a/source/snd_vorbis.c b/source/snd_vorbis.c index 803b033..d819b3f 100644 --- a/source/snd_vorbis.c +++ b/source/snd_vorbis.c @@ -45,13 +45,13 @@ /* CALLBACK FUNCTIONS: */ -static int ovc_fclose (void *f) +static int32_t ovc_fclose (void *f) { (void)f; return 0; /* we fclose() elsewhere. */ } -static int ovc_fseek (void *f, ogg_int64_t off, int whence) +static int32_t ovc_fseek (void *f, ogg_int64_t off, int32_t whence) { if (f == NULL) return (-1); return FS_fseek((fshandle_t *)f, (long) off, whence); @@ -60,8 +60,8 @@ static int ovc_fseek (void *f, ogg_int64_t off, int whence) static ov_callbacks ovc_qfs = { (size_t (*)(void *, size_t, size_t, void *)) FS_fread, - (int (*)(void *, ogg_int64_t, int)) ovc_fseek, - (int (*)(void *)) ovc_fclose, + (int32_t (*)(void *, ogg_int64_t, int32_t)) ovc_fseek, + (int32_t (*)(void *)) ovc_fclose, (long (*)(void *)) FS_ftell }; @@ -79,7 +79,7 @@ static bool S_VORBIS_CodecOpenStream (snd_stream_t *stream) OggVorbis_File *ovFile; vorbis_info *ovf_info; long numstreams; - int res; + int32_t res; ovFile = (OggVorbis_File *) Z_Malloc(sizeof(OggVorbis_File)); stream->priv = ovFile; @@ -133,10 +133,10 @@ _fail: return false; } -static int S_VORBIS_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) +static int32_t S_VORBIS_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer) { - int section; /* FIXME: handle section changes */ - int cnt, res, rem; + int32_t section; /* FIXME: handle section changes */ + int32_t cnt, res, rem; char * ptr; cnt = 0; rem = bytes; @@ -178,7 +178,7 @@ static void S_VORBIS_CodecCloseStream (snd_stream_t *stream) S_CodecUtilClose(&stream); } -static int S_VORBIS_CodecRewindStream (snd_stream_t *stream) +static int32_t S_VORBIS_CodecRewindStream (snd_stream_t *stream) { /* for libvorbisfile, the ov_time_seek() position argument * is seconds as doubles, whereas for Tremor libvorbisidec diff --git a/source/spritegn.h b/source/spritegn.h index 1065052..da10e43 100644 --- a/source/spritegn.h +++ b/source/spritegn.h @@ -73,13 +73,13 @@ typedef enum {ST_SYNC=0, ST_RAND } synctype_t; // TODO: shorten these? typedef struct { - int ident; - int version; - int type; + int32_t ident; + int32_t version; + int32_t type; float boundingradius; - int width; - int height; - int numframes; + int32_t width; + int32_t height; + int32_t numframes; float beamlength; synctype_t synctype; } dsprite_t; @@ -91,13 +91,13 @@ typedef struct { #define SPR_VP_PARALLEL_ORIENTED 4 typedef struct { - int origin[2]; - int width; - int height; + int32_t origin[2]; + int32_t width; + int32_t height; } dspriteframe_t; typedef struct { - int numframes; + int32_t numframes; } dspritegroup_t; typedef struct { diff --git a/source/stb_image_write.h b/source/stb_image_write.h index 978fc20..5f5e527 100644 --- a/source/stb_image_write.h +++ b/source/stb_image_write.h @@ -33,23 +33,23 @@ USAGE: There are four functions, one for each image file format: - int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes); - int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data); - int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data); - int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data); - int stbi_write_jpg(char const *filename, int w, int h, int comp, const float *data); + int32_t stbi_write_png(char const *filename, int32_t w, int32_t h, int32_t comp, const void *data, int32_t stride_in_bytes); + int32_t stbi_write_bmp(char const *filename, int32_t w, int32_t h, int32_t comp, const void *data); + int32_t stbi_write_tga(char const *filename, int32_t w, int32_t h, int32_t comp, const void *data); + int32_t stbi_write_hdr(char const *filename, int32_t w, int32_t h, int32_t comp, const float *data); + int32_t stbi_write_jpg(char const *filename, int32_t w, int32_t h, int32_t comp, const float *data); There are also four equivalent functions that use an arbitrary write function. You are expected to open/close your file-equivalent before and after calling these: - int stbi_write_png_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data, int stride_in_bytes); - int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); - int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); - int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data); - int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality); + int32_t stbi_write_png_to_func(stbi_write_func *func, void *context, int32_t w, int32_t h, int32_t comp, const void *data, int32_t stride_in_bytes); + int32_t stbi_write_bmp_to_func(stbi_write_func *func, void *context, int32_t w, int32_t h, int32_t comp, const void *data); + int32_t stbi_write_tga_to_func(stbi_write_func *func, void *context, int32_t w, int32_t h, int32_t comp, const void *data); + int32_t stbi_write_hdr_to_func(stbi_write_func *func, void *context, int32_t w, int32_t h, int32_t comp, const float *data); + int32_t stbi_write_jpg_to_func(stbi_write_func *func, void *context, int32_t x, int32_t y, int32_t comp, const void *data, int32_t quality); where the callback is: - void stbi_write_func(void *context, void *data, int size); + void stbi_write_func(void *context, void *data, int32_t size); You can define STBI_WRITE_NO_STDIO to disable the file variant of these functions, so the library will not use stdio.h at all. However, this will @@ -137,13 +137,13 @@ extern "C" { #endif #ifndef STBI_WRITE_NO_STDIO -STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality); +STBIWDEF int32_t stbi_write_jpg(char const *filename, int32_t x, int32_t y, int32_t comp, const void *data, int32_t quality); #endif -typedef void stbi_write_func(void *context, void *data, int size); +typedef void stbi_write_func(void *context, void *data, int32_t size); #if 0 /* not used in QuakeSpasm */ -STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality); +STBIWDEF int32_t stbi_write_jpg_to_func(stbi_write_func *func, void *context, int32_t x, int32_t y, int32_t comp, const void *data, int32_t quality); #endif #ifdef __cplusplus @@ -218,12 +218,12 @@ static void stbi__start_write_callbacks(stbi__write_context *s, stbi_write_func #ifndef STBI_WRITE_NO_STDIO -static void stbi__stdio_write(void *context, void *data, int size) +static void stbi__stdio_write(void *context, void *data, int32_t size) { fwrite(data,1,size,(FILE*) context); } -static int stbi__start_write_file(stbi__write_context *s, const char *filename) +static int32_t stbi__start_write_file(stbi__write_context *s, const char *filename) { FILE *f = fopen(filename, "wb"); stbi__start_write_callbacks(s, stbi__stdio_write, (void *) f); @@ -238,7 +238,7 @@ static void stbi__end_write_file(stbi__write_context *s) #endif // !STBI_WRITE_NO_STDIO typedef uint32_t stbiw_uint32; -typedef int stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1]; +typedef int32_t stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1]; static void stbiw__putc(stbi__write_context *s, uint8_t c) { @@ -256,8 +256,8 @@ static void stbiw__putc(stbi__write_context *s, uint8_t c) static const uint8_t stbiw__jpg_ZigZag[] = { 0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18, 24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63 }; -static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, int *bitCntP, const uint16_t *bs) { - int bitBuf = *bitBufP, bitCnt = *bitCntP; +static void stbiw__jpg_writeBits(stbi__write_context *s, int32_t *bitBufP, int32_t *bitCntP, const uint16_t *bs) { + int32_t bitBuf = *bitBufP, bitCnt = *bitCntP; bitCnt += bs[1]; bitBuf |= bs[0] << (24 - bitCnt); while(bitCnt >= 8) { @@ -321,8 +321,8 @@ static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float *d0p = d0; *d2p = d2; *d4p = d4; *d6p = d6; } -static void stbiw__jpg_calcBits(int val, uint16_t bits[2]) { - int tmp1 = val < 0 ? -val : val; +static void stbiw__jpg_calcBits(int32_t val, uint16_t bits[2]) { + int32_t tmp1 = val < 0 ? -val : val; val = val < 0 ? val-1 : val; bits[1] = 1; while(tmp1 >>= 1) { @@ -331,11 +331,11 @@ static void stbiw__jpg_calcBits(int val, uint16_t bits[2]) { bits[0] = val & ((1<= 16 ) { - int lng = nrzeroes>>4; - int nrmarker; + int32_t lng = nrzeroes>>4; + int32_t nrmarker; for (nrmarker=1; nrmarker <= lng; ++nrmarker) stbiw__jpg_writeBits(s, bitBuf, bitCnt, M16zeroes); nrzeroes &= 15; @@ -401,7 +401,7 @@ static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt return DU[0]; } -static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, int comp, const void* data, int quality) { +static int32_t stbi_write_jpg_core(stbi__write_context *s, int32_t width, int32_t height, int32_t comp, const void* data, int32_t quality) { // Constants that don't pollute global namespace static const uint8_t std_dc_luminance_nrcodes[] = {0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0}; static const uint8_t std_dc_luminance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; @@ -466,14 +466,14 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in {16352,14},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{65525,16},{0,0},{0,0},{0,0},{0,0},{0,0}, {1018,10},{32707,15},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0} }; - static const int YQT[] = {16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22, + static const int32_t YQT[] = {16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22, 37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99}; - static const int UVQT[] = {17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99, + static const int32_t UVQT[] = {17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99, 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99}; static const float aasf[] = { 1.0f * 2.828427125f, 1.387039845f * 2.828427125f, 1.306562965f * 2.828427125f, 1.175875602f * 2.828427125f, 1.0f * 2.828427125f, 0.785694958f * 2.828427125f, 0.541196100f * 2.828427125f, 0.275899379f * 2.828427125f }; - int row, col, i, k; + int32_t row, col, i, k; float fdtbl_Y[64], fdtbl_UV[64]; uint8_t YTable[64], UVTable[64]; @@ -486,7 +486,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in quality = quality < 50 ? 5000 / quality : 200 - quality * 2; for(i = 0; i < 64; ++i) { - int uvti, yti = (YQT[i]*quality+50)/100; + int32_t uvti, yti = (YQT[i]*quality+50)/100; YTable[stbiw__jpg_ZigZag[i]] = (uint8_t) (yti < 1 ? 1 : yti > 255 ? 255 : yti); uvti = (UVQT[i]*quality+50)/100; UVTable[stbiw__jpg_ZigZag[i]] = (uint8_t) (uvti < 1 ? 1 : uvti > 255 ? 255 : uvti); @@ -532,17 +532,17 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in { static const uint16_t fillBits[] = {0x7F, 7}; const uint8_t *imageData = (const uint8_t *)data; - int DCY=0, DCU=0, DCV=0; - int bitBuf=0, bitCnt=0; + int32_t DCY=0, DCU=0, DCV=0; + int32_t bitBuf=0, bitCnt=0; // comp == 2 is grey+alpha (alpha is ignored) - int ofsG = comp > 2 ? 1 : 0, ofsB = comp > 2 ? 2 : 0; - int x, y, pos; + int32_t ofsG = comp > 2 ? 1 : 0, ofsB = comp > 2 ? 2 : 0; + int32_t x, y, pos; for(y = 0; y < height; y += 8) { for(x = 0; x < width; x += 8) { float YDU[64], UDU[64], VDU[64]; for(row = y, pos = 0; row < y+8; ++row) { for(col = x; col < x+8; ++col, ++pos) { - int p = row*width*comp + col*comp; + int32_t p = row*width*comp + col*comp; float r, g, b; if(row >= height) { p -= width*comp*(row+1 - height); @@ -578,7 +578,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in } #if 0 /* not used in QuakeSpasm */ -STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality) +STBIWDEF int32_t stbi_write_jpg_to_func(stbi_write_func *func, void *context, int32_t x, int32_t y, int32_t comp, const void *data, int32_t quality) { stbi__write_context s; stbi__start_write_callbacks(&s, func, context); @@ -588,11 +588,11 @@ STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, #ifndef STBI_WRITE_NO_STDIO -STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality) +STBIWDEF int32_t stbi_write_jpg(char const *filename, int32_t x, int32_t y, int32_t comp, const void *data, int32_t quality) { stbi__write_context s; if (stbi__start_write_file(&s,filename)) { - int r = stbi_write_jpg_core(&s, x, y, comp, data, quality); + int32_t r = stbi_write_jpg_core(&s, x, y, comp, data, quality); stbi__end_write_file(&s); return r; } else diff --git a/source/sv_main.c b/source/sv_main.c index 3c018f7..75b1ff5 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -28,7 +28,7 @@ server_static_t svs; static char localmodels[MAX_MODELS][8]; // inline model names for precache -int sv_protocol = PROTOCOL_FITZQUAKE; //johnfitz +int32_t sv_protocol = PROTOCOL_FITZQUAKE; //johnfitz extern bool pr_alpha_supported; //johnfitz @@ -41,7 +41,7 @@ SV_Protocol_f */ void SV_Protocol_f (void) { - int i; + int32_t i; switch (Cmd_Argc()) { @@ -72,7 +72,7 @@ SV_Init */ void SV_Init (void) { - int i; + int32_t i; const char *p; extern cvar_t sv_maxvelocity; extern cvar_t sv_gravity; @@ -147,9 +147,9 @@ SV_StartParticle Make sure the event gets sent to all clients ================== */ -void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count) +void SV_StartParticle (vec3_t org, vec3_t dir, int32_t color, int32_t count) { - int i, v; + int32_t i, v; if (sv.datagram.cursize > MAX_DATAGRAM-16) return; @@ -185,10 +185,10 @@ Larger attenuations will drop off. (max 4 attenuation) ================== */ -void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, float attenuation) +void SV_StartSound (edict_t *entity, int32_t channel, const char *sample, int32_t volume, float attenuation) { - int sound_num, ent; - int i, field_mask; + int32_t sound_num, ent; + int32_t i, field_mask; if (volume < 0 || volume > 255) Host_Error ("SV_StartSound: volume = %i", volume); @@ -286,7 +286,7 @@ void SV_SendServerinfo (client_t *client) { const char **s; char message[2048]; - int i; //johnfitz + int32_t i; //johnfitz MSG_WriteByte (&client->message, svc_print); sprintf (message, "%c\nFITZQUAKE " FITZQUAKE_VERSION " SERVER (%i CRC)\n", 2, pr_crc); //johnfitz -- include fitzquake version @@ -346,13 +346,13 @@ Initializes a client_t for a new net connection. This will only be called once for a player each game, not once for each level change. ================ */ -void SV_ConnectClient (int clientnum) +void SV_ConnectClient (int32_t clientnum) { edict_t *ent; client_t *client; - int edictnum; + int32_t edictnum; struct qsocket_s *netconnection; - int i; + int32_t i; float spawn_parms[NUM_SPAWN_PARMS]; client = svs.clients + clientnum; @@ -402,7 +402,7 @@ SV_CheckForNewClients void SV_CheckForNewClients (void) { struct qsocket_s *ret; - int i; + int32_t i; // // check for new connections @@ -460,13 +460,13 @@ crosses a waterline. ============================================================================= */ -static int fatbytes; +static int32_t fatbytes; static byte *fatpvs; -static int fatpvs_capacity; +static int32_t fatpvs_capacity; void SV_AddToFatPVS (vec3_t org, mnode_t *node, qmodel_t *worldmodel) //johnfitz -- added worldmodel as a parameter { - int i; + int32_t i; byte *pvs; mplane_t *plane; float d; @@ -534,7 +534,7 @@ bool SV_VisibleToClient (edict_t *client, edict_t *test, qmodel_t *worldmodel) { byte *pvs; vec3_t org; - int i; + int32_t i; VectorAdd (client->v.origin, client->v.view_ofs, org); pvs = SV_FatPVS (org, worldmodel); @@ -556,8 +556,8 @@ SV_WriteEntitiesToClient */ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) { - int e, i; - int bits; + int32_t e, i; + int32_t bits; byte *pvs; vec3_t org; float miss; @@ -579,7 +579,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) continue; //johnfitz -- don't send model>255 entities if protocol is 15 - if (sv.protocol == PROTOCOL_NETQUAKE && (int)ent->v.modelindex & 0xFF00) + if (sv.protocol == PROTOCOL_NETQUAKE && (int32_t)ent->v.modelindex & 0xFF00) continue; // ignore if not touching a PV leaf @@ -668,8 +668,8 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) { if (ent->baseline.alpha != ent->alpha) bits |= U_ALPHA; - if (bits & U_FRAME && (int)ent->v.frame & 0xFF00) bits |= U_FRAME2; - if (bits & U_MODEL && (int)ent->v.modelindex & 0xFF00) bits |= U_MODEL2; + if (bits & U_FRAME && (int32_t)ent->v.frame & 0xFF00) bits |= U_FRAME2; + if (bits & U_MODEL && (int32_t)ent->v.modelindex & 0xFF00) bits |= U_MODEL2; if (ent->sendinterval) bits |= U_LERPFINISH; if (bits >= 65536) bits |= U_EXTEND1; if (bits >= 16777216) bits |= U_EXTEND2; @@ -729,9 +729,9 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) if (bits & U_ALPHA) MSG_WriteByte(msg, ent->alpha); if (bits & U_FRAME2) - MSG_WriteByte(msg, (int)ent->v.frame >> 8); + MSG_WriteByte(msg, (int32_t)ent->v.frame >> 8); if (bits & U_MODEL2) - MSG_WriteByte(msg, (int)ent->v.modelindex >> 8); + MSG_WriteByte(msg, (int32_t)ent->v.modelindex >> 8); if (bits & U_LERPFINISH) MSG_WriteByte(msg, (byte)(Q_rint((ent->v.nextthink-sv.time)*255))); //johnfitz @@ -754,13 +754,13 @@ SV_CleanupEnts */ void SV_CleanupEnts (void) { - int e; + int32_t e; edict_t *ent; ent = NEXT_EDICT(sv.edicts); for (e=1 ; ev.effects = (int)ent->v.effects & ~EF_MUZZLEFLASH; + ent->v.effects = (int32_t)ent->v.effects & ~EF_MUZZLEFLASH; } } @@ -772,10 +772,10 @@ SV_WriteClientdataToMessage */ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) { - int bits; - int i; + int32_t bits; + int32_t i; edict_t *other; - int items; + int32_t items; eval_t *val; // @@ -821,13 +821,13 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) val = GetEdictFieldValue(ent, "items2"); if (val) - items = (int)ent->v.items | ((int)val->_float << 23); + items = (int32_t)ent->v.items | ((int32_t)val->_float << 23); else - items = (int)ent->v.items | ((int)pr_global_struct->serverflags << 28); + items = (int32_t)ent->v.items | ((int32_t)pr_global_struct->serverflags << 28); bits |= SU_ITEMS; - if ( (int)ent->v.flags & FL_ONGROUND) + if ( (int32_t)ent->v.flags & FL_ONGROUND) bits |= SU_ONGROUND; if ( ent->v.waterlevel >= 2) @@ -854,13 +854,13 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) if (sv.protocol != PROTOCOL_NETQUAKE) { if (bits & SU_WEAPON && SV_ModelIndex(PR_GetString(ent->v.weaponmodel)) & 0xFF00) bits |= SU_WEAPON2; - if ((int)ent->v.armorvalue & 0xFF00) bits |= SU_ARMOR2; - if ((int)ent->v.currentammo & 0xFF00) bits |= SU_AMMO2; - if ((int)ent->v.ammo_shells & 0xFF00) bits |= SU_SHELLS2; - if ((int)ent->v.ammo_nails & 0xFF00) bits |= SU_NAILS2; - if ((int)ent->v.ammo_rockets & 0xFF00) bits |= SU_ROCKETS2; - if ((int)ent->v.ammo_cells & 0xFF00) bits |= SU_CELLS2; - if (bits & SU_WEAPONFRAME && (int)ent->v.weaponframe & 0xFF00) bits |= SU_WEAPONFRAME2; + if ((int32_t)ent->v.armorvalue & 0xFF00) bits |= SU_ARMOR2; + if ((int32_t)ent->v.currentammo & 0xFF00) bits |= SU_AMMO2; + if ((int32_t)ent->v.ammo_shells & 0xFF00) bits |= SU_SHELLS2; + if ((int32_t)ent->v.ammo_nails & 0xFF00) bits |= SU_NAILS2; + if ((int32_t)ent->v.ammo_rockets & 0xFF00) bits |= SU_ROCKETS2; + if ((int32_t)ent->v.ammo_cells & 0xFF00) bits |= SU_CELLS2; + if (bits & SU_WEAPONFRAME && (int32_t)ent->v.weaponframe & 0xFF00) bits |= SU_WEAPONFRAME2; if (bits & SU_WEAPON && ent->alpha != ENTALPHA_DEFAULT) bits |= SU_WEAPONALPHA; //for now, weaponalpha = client entity alpha if (bits >= 65536) bits |= SU_EXTEND1; if (bits >= 16777216) bits |= SU_EXTEND2; @@ -916,7 +916,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) { for(i=0;i<32;i++) { - if ( ((int)ent->v.weapon) & (1<v.weapon) & (1<v.weaponmodel)) >> 8); if (bits & SU_ARMOR2) - MSG_WriteByte (msg, (int)ent->v.armorvalue >> 8); + MSG_WriteByte (msg, (int32_t)ent->v.armorvalue >> 8); if (bits & SU_AMMO2) - MSG_WriteByte (msg, (int)ent->v.currentammo >> 8); + MSG_WriteByte (msg, (int32_t)ent->v.currentammo >> 8); if (bits & SU_SHELLS2) - MSG_WriteByte (msg, (int)ent->v.ammo_shells >> 8); + MSG_WriteByte (msg, (int32_t)ent->v.ammo_shells >> 8); if (bits & SU_NAILS2) - MSG_WriteByte (msg, (int)ent->v.ammo_nails >> 8); + MSG_WriteByte (msg, (int32_t)ent->v.ammo_nails >> 8); if (bits & SU_ROCKETS2) - MSG_WriteByte (msg, (int)ent->v.ammo_rockets >> 8); + MSG_WriteByte (msg, (int32_t)ent->v.ammo_rockets >> 8); if (bits & SU_CELLS2) - MSG_WriteByte (msg, (int)ent->v.ammo_cells >> 8); + MSG_WriteByte (msg, (int32_t)ent->v.ammo_cells >> 8); if (bits & SU_WEAPONFRAME2) - MSG_WriteByte (msg, (int)ent->v.weaponframe >> 8); + MSG_WriteByte (msg, (int32_t)ent->v.weaponframe >> 8); if (bits & SU_WEAPONALPHA) MSG_WriteByte (msg, ent->alpha); //for now, weaponalpha = client entity alpha //johnfitz @@ -994,7 +994,7 @@ SV_UpdateToReliableMessages */ void SV_UpdateToReliableMessages (void) { - int i, j; + int32_t i, j; client_t *client; // check for changes to be sent over the reliable streams @@ -1057,7 +1057,7 @@ SV_SendClientMessages */ void SV_SendClientMessages (void) { - int i; + int32_t i; // update frags, names, etc SV_UpdateToReliableMessages (); @@ -1140,9 +1140,9 @@ SV_ModelIndex ================ */ -int SV_ModelIndex (const char *name) +int32_t SV_ModelIndex (const char *name) { - int i; + int32_t i; if (!name || !name[0]) return 0; @@ -1162,10 +1162,10 @@ SV_CreateBaseline */ void SV_CreateBaseline (void) { - int i; + int32_t i; edict_t *svent; - int entnum; - int bits; //johnfitz -- PROTOCOL_FITZQUAKE + int32_t entnum; + int32_t bits; //johnfitz -- PROTOCOL_FITZQUAKE for (entnum = 0; entnum < sv.num_edicts ; entnum++) { @@ -1295,7 +1295,7 @@ transition to another level */ void SV_SaveSpawnparms (void) { - int i, j; + int32_t i, j; svs.serverflags = pr_global_struct->serverflags; @@ -1325,7 +1325,7 @@ void SV_SpawnServer (const char *server) { static char dummy[8] = { 0,0,0,0,0,0,0,0 }; edict_t *ent; - int i; + int32_t i; // let's not have any servers with no name if (hostname.string[0] == 0) @@ -1348,7 +1348,7 @@ void SV_SpawnServer (const char *server) // if (coop.value) Cvar_Set ("deathmatch", "0"); - current_skill = (int)(skill.value + 0.5); + current_skill = (int32_t)(skill.value + 0.5); if (current_skill < 0) current_skill = 0; if (current_skill > 3) @@ -1379,7 +1379,7 @@ void SV_SpawnServer (const char *server) // allocate server memory /* Host_ClearMemory() called above already cleared the whole sv structure */ - sv.max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS); //johnfitz -- max_edicts cvar + sv.max_edicts = CLAMP (MIN_EDICTS,(int32_t)max_edicts.value,MAX_EDICTS); //johnfitz -- max_edicts cvar sv.edicts = (edict_t *) malloc (sv.max_edicts*pr_edict_size); // ericw -- sv.edicts switched to use malloc() sv.datagram.maxsize = sizeof(sv.datagram_buf); diff --git a/source/sv_move.c b/source/sv_move.c index 939a6f0..0315341 100644 --- a/source/sv_move.c +++ b/source/sv_move.c @@ -34,13 +34,13 @@ is not a staircase. ============= */ -int c_yes, c_no; +int32_t c_yes, c_no; bool SV_CheckBottom (edict_t *ent) { vec3_t mins, maxs, start, stop; trace_t trace; - int x, y; + int32_t x, y; float mid, bottom; VectorAdd (ent->v.origin, ent->v.mins, mins); @@ -114,7 +114,7 @@ bool SV_movestep (edict_t *ent, vec3_t move, bool relink) float dz; vec3_t oldorg, neworg, end; trace_t trace; - int i; + int32_t i; edict_t *enemy; // try the move @@ -122,7 +122,7 @@ bool SV_movestep (edict_t *ent, vec3_t move, bool relink) VectorAdd (ent->v.origin, move, neworg); // flying monsters don't step up - if ( (int)ent->v.flags & (FL_SWIM | FL_FLY) ) + if ( (int32_t)ent->v.flags & (FL_SWIM | FL_FLY) ) { // try one move with vertical motion, then one without for (i=0 ; i<2 ; i++) @@ -141,7 +141,7 @@ bool SV_movestep (edict_t *ent, vec3_t move, bool relink) if (trace.fraction == 1) { - if ( ((int)ent->v.flags & FL_SWIM) && SV_PointContents(trace.endpos) == CONTENTS_EMPTY ) + if ( ((int32_t)ent->v.flags & FL_SWIM) && SV_PointContents(trace.endpos) == CONTENTS_EMPTY ) return false; // swim monster left water VectorCopy (trace.endpos, ent->v.origin); @@ -177,12 +177,12 @@ bool SV_movestep (edict_t *ent, vec3_t move, bool relink) if (trace.fraction == 1) { // if monster had the ground pulled out, go ahead and fall - if ( (int)ent->v.flags & FL_PARTIALGROUND ) + if ( (int32_t)ent->v.flags & FL_PARTIALGROUND ) { VectorAdd (ent->v.origin, move, ent->v.origin); if (relink) SV_LinkEdict (ent, true); - ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND; + ent->v.flags = (int32_t)ent->v.flags & ~FL_ONGROUND; // Con_Printf ("fall down\n"); return true; } @@ -195,7 +195,7 @@ bool SV_movestep (edict_t *ent, vec3_t move, bool relink) if (!SV_CheckBottom (ent)) { - if ( (int)ent->v.flags & FL_PARTIALGROUND ) + if ( (int32_t)ent->v.flags & FL_PARTIALGROUND ) { // entity had floor mostly pulled out from underneath it // and is trying to correct if (relink) @@ -206,10 +206,10 @@ bool SV_movestep (edict_t *ent, vec3_t move, bool relink) return false; } - if ( (int)ent->v.flags & FL_PARTIALGROUND ) + if ( (int32_t)ent->v.flags & FL_PARTIALGROUND ) { // Con_Printf ("back on ground\n"); - ent->v.flags = (int)ent->v.flags & ~FL_PARTIALGROUND; + ent->v.flags = (int32_t)ent->v.flags & ~FL_PARTIALGROUND; } ent->v.groundentity = EDICT_TO_PROG(trace.ent); @@ -271,7 +271,7 @@ void SV_FixCheckBottom (edict_t *ent) { // Con_Printf ("SV_FixCheckBottom\n"); - ent->v.flags = (int)ent->v.flags | FL_PARTIALGROUND; + ent->v.flags = (int32_t)ent->v.flags | FL_PARTIALGROUND; } @@ -289,7 +289,7 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) float d[3]; float tdir, olddir, turnaround; - olddir = anglemod( (int)(actor->v.ideal_yaw/45)*45 ); + olddir = anglemod( (int32_t)(actor->v.ideal_yaw/45)*45 ); turnaround = anglemod(olddir - 180); deltax = enemy->v.origin[0] - actor->v.origin[0]; @@ -320,7 +320,7 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) } // try other directions - if ( ((rand()&3) & 1) || abs((int)deltay)>abs((int)deltax)) // ericw -- explicit int cast to suppress clang suggestion to use fabsf + if ( ((rand()&3) & 1) || abs((int32_t)deltay)>abs((int32_t)deltax)) // ericw -- explicit int32_t cast to suppress clang suggestion to use fabsf { tdir=d[1]; d[1]=d[2]; @@ -374,7 +374,7 @@ SV_CloseEnough */ bool SV_CloseEnough (edict_t *ent, edict_t *goal, float dist) { - int i; + int32_t i; for (i=0 ; i<3 ; i++) { @@ -401,7 +401,7 @@ void SV_MoveToGoal (void) goal = PROG_TO_EDICT(ent->v.goalentity); dist = G_FLOAT(OFS_PARM0); - if ( !( (int)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) ) + if ( !( (int32_t)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) ) { G_FLOAT(OFS_RETURN) = 0; return; diff --git a/source/sv_phys.c b/source/sv_phys.c index 1c1a926..15f8a76 100644 --- a/source/sv_phys.c +++ b/source/sv_phys.c @@ -60,7 +60,7 @@ SV_CheckAllEnts */ void SV_CheckAllEnts (void) { - int e; + int32_t e; edict_t *check; // see if any solid entities are inside the final position @@ -86,7 +86,7 @@ SV_CheckVelocity */ void SV_CheckVelocity (edict_t *ent) { - int i; + int32_t i; // // bound velocity @@ -124,7 +124,7 @@ bool SV_RunThink (edict_t *ent) { float thinktime; float oldframe; //johnfitz - int i; //johnfitz + int32_t i; //johnfitz thinktime = ent->v.nextthink; if (thinktime <= 0 || thinktime > sv.time + host_frametime) @@ -167,7 +167,7 @@ Two entities have touched, so run their touch functions */ void SV_Impact (edict_t *e1, edict_t *e2) { - int old_self, old_other; + int32_t old_self, old_other; old_self = pr_global_struct->self; old_other = pr_global_struct->other; @@ -202,11 +202,11 @@ returns the blocked flags (1 = floor, 2 = step / wall) */ #define STOP_EPSILON 0.1 -int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) +int32_t ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) { float backoff; float change; - int i, blocked; + int32_t i, blocked; blocked = 0; if (normal[2] > 0) @@ -241,19 +241,19 @@ If steptrace is not NULL, the trace of any vertical wall hit will be stored ============ */ #define MAX_CLIP_PLANES 5 -int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) +int32_t SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) { - int bumpcount, numbumps; + int32_t bumpcount, numbumps; vec3_t dir; float d; - int numplanes; + int32_t numplanes; vec3_t planes[MAX_CLIP_PLANES]; vec3_t primal_velocity, original_velocity, new_velocity; - int i, j; + int32_t i, j; trace_t trace; vec3_t end; float time_left; - int blocked; + int32_t blocked; numbumps = 4; @@ -298,7 +298,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) blocked |= 1; // floor if (trace.ent->v.solid == SOLID_BSP) { - ent->v.flags = (int)ent->v.flags | FL_ONGROUND; + ent->v.flags = (int32_t)ent->v.flags | FL_ONGROUND; ent->v.groundentity = EDICT_TO_PROG(trace.ent); } } @@ -445,14 +445,14 @@ SV_PushMove */ void SV_PushMove (edict_t *pusher, float movetime) { - int i, e; + int32_t i, e; edict_t *check, *block; vec3_t mins, maxs, move; vec3_t entorig, pushorig; - int num_moved; + int32_t num_moved; edict_t **moved_edict; //johnfitz -- dynamically allocate vec3_t *moved_from; //johnfitz -- dynamically allocate - int mark; //johnfitz + int32_t mark; //johnfitz if (!pusher->v.velocity[0] && !pusher->v.velocity[1] && !pusher->v.velocity[2]) { @@ -494,7 +494,7 @@ void SV_PushMove (edict_t *pusher, float movetime) continue; // if the entity is standing on the pusher, it will definately be moved - if ( ! ( ((int)check->v.flags & FL_ONGROUND) + if ( ! ( ((int32_t)check->v.flags & FL_ONGROUND) && PROG_TO_EDICT(check->v.groundentity) == pusher) ) { if ( check->v.absmin[0] >= maxs[0] @@ -512,7 +512,7 @@ void SV_PushMove (edict_t *pusher, float movetime) // remove the onground flag for non-players if (check->v.movetype != MOVETYPE_WALK) - check->v.flags = (int)check->v.flags & ~FL_ONGROUND; + check->v.flags = (int32_t)check->v.flags & ~FL_ONGROUND; VectorCopy (check->v.origin, entorig); VectorCopy (check->v.origin, moved_from[num_moved]); @@ -629,8 +629,8 @@ clipping hull. */ void SV_CheckStuck (edict_t *ent) { - int i, j; - int z; + int32_t i, j; + int32_t z; vec3_t org; if (!SV_TestEntityPosition(ent)) @@ -676,7 +676,7 @@ SV_CheckWater bool SV_CheckWater (edict_t *ent) { vec3_t point; - int cont; + int32_t cont; point[0] = ent->v.origin[0]; point[1] = ent->v.origin[1]; @@ -744,12 +744,12 @@ Try fixing by pushing one pixel in each direction. This is a hack, but in the interest of good gameplay... ====================== */ -int SV_TryUnstick (edict_t *ent, vec3_t oldvel) +int32_t SV_TryUnstick (edict_t *ent, vec3_t oldvel) { - int i; + int32_t i; vec3_t oldorg; vec3_t dir; - int clip; + int32_t clip; trace_t steptrace; VectorCopy (ent->v.origin, oldorg); @@ -806,15 +806,15 @@ void SV_WalkMove (edict_t *ent) vec3_t upmove, downmove; vec3_t oldorg, oldvel; vec3_t nosteporg, nostepvel; - int clip; - int oldonground; + int32_t clip; + int32_t oldonground; trace_t steptrace, downtrace; // // do a regular slide move unless it looks like you ran into a step // - oldonground = (int)ent->v.flags & FL_ONGROUND; - ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND; + oldonground = (int32_t)ent->v.flags & FL_ONGROUND; + ent->v.flags = (int32_t)ent->v.flags & ~FL_ONGROUND; VectorCopy (ent->v.origin, oldorg); VectorCopy (ent->v.velocity, oldvel); @@ -833,7 +833,7 @@ void SV_WalkMove (edict_t *ent) if (sv_nostep.value) return; - if ( (int)sv_player->v.flags & FL_WATERJUMP ) + if ( (int32_t)sv_player->v.flags & FL_WATERJUMP ) return; VectorCopy (ent->v.origin, nosteporg); @@ -880,7 +880,7 @@ void SV_WalkMove (edict_t *ent) { if (ent->v.solid == SOLID_BSP) { - ent->v.flags = (int)ent->v.flags | FL_ONGROUND; + ent->v.flags = (int32_t)ent->v.flags | FL_ONGROUND; ent->v.groundentity = EDICT_TO_PROG(downtrace.ent); } } @@ -902,7 +902,7 @@ SV_Physics_Client Player character actions ================ */ -void SV_Physics_Client (edict_t *ent, int num) +void SV_Physics_Client (edict_t *ent, int32_t num) { if ( ! svs.clients[num-1].active ) return; // unconnected slot @@ -922,7 +922,7 @@ void SV_Physics_Client (edict_t *ent, int num) // // decide which move function to call // - switch ((int)ent->v.movetype) + switch ((int32_t)ent->v.movetype) { case MOVETYPE_NONE: if (!SV_RunThink (ent)) @@ -932,7 +932,7 @@ void SV_Physics_Client (edict_t *ent, int num) case MOVETYPE_WALK: if (!SV_RunThink (ent)) return; - if (!SV_CheckWater (ent) && ! ((int)ent->v.flags & FL_WATERJUMP) ) + if (!SV_CheckWater (ent) && ! ((int32_t)ent->v.flags & FL_WATERJUMP) ) SV_AddGravity (ent); SV_CheckStuck (ent); SV_WalkMove (ent); @@ -956,7 +956,7 @@ void SV_Physics_Client (edict_t *ent, int num) break; default: - Sys_Error ("SV_Physics_client: bad movetype %i", (int)ent->v.movetype); + Sys_Error ("SV_Physics_client: bad movetype %i", (int32_t)ent->v.movetype); } // @@ -1019,7 +1019,7 @@ SV_CheckWaterTransition */ void SV_CheckWaterTransition (edict_t *ent) { - int cont; + int32_t cont; cont = SV_PointContents (ent->v.origin); @@ -1068,7 +1068,7 @@ void SV_Physics_Toss (edict_t *ent) return; // if onground, return without moving - if ( ((int)ent->v.flags & FL_ONGROUND) ) + if ( ((int32_t)ent->v.flags & FL_ONGROUND) ) return; SV_CheckVelocity (ent); @@ -1101,7 +1101,7 @@ void SV_Physics_Toss (edict_t *ent) { if (ent->v.velocity[2] < 60 || ent->v.movetype != MOVETYPE_BOUNCE) { - ent->v.flags = (int)ent->v.flags | FL_ONGROUND; + ent->v.flags = (int32_t)ent->v.flags | FL_ONGROUND; ent->v.groundentity = EDICT_TO_PROG(trace.ent); VectorCopy (vec3_origin, ent->v.velocity); VectorCopy (vec3_origin, ent->v.avelocity); @@ -1136,7 +1136,7 @@ void SV_Physics_Step (edict_t *ent) bool hitsound; // freefall if not onground - if ( ! ((int)ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM) ) ) + if ( ! ((int32_t)ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM) ) ) { if (ent->v.velocity[2] < sv_gravity.value*-0.1) hitsound = true; @@ -1148,7 +1148,7 @@ void SV_Physics_Step (edict_t *ent) SV_FlyMove (ent, host_frametime, NULL); SV_LinkEdict (ent, true); - if ( (int)ent->v.flags & FL_ONGROUND ) // just hit ground + if ( (int32_t)ent->v.flags & FL_ONGROUND ) // just hit ground { if (hitsound) SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1); @@ -1172,8 +1172,8 @@ SV_Physics */ void SV_Physics (void) { - int i; - int entity_cap; // For sv_freezenonclients + int32_t i; + int32_t entity_cap; // For sv_freezenonclients edict_t *ent; // let the progs know that a new frame has started @@ -1221,7 +1221,7 @@ void SV_Physics (void) || ent->v.movetype == MOVETYPE_FLYMISSILE) SV_Physics_Toss (ent); else - Sys_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype); + Sys_Error ("SV_Physics: bad movetype %i", (int32_t)ent->v.movetype); } if (pr_global_struct->force_retouch) diff --git a/source/sv_user.c b/source/sv_user.c index ba5350b..b8fb6bf 100644 --- a/source/sv_user.c +++ b/source/sv_user.c @@ -55,10 +55,10 @@ void SV_SetIdealPitch (void) trace_t tr; vec3_t top, bottom; float z[MAX_FORWARD]; - int i, j; - int step, dir, steps; + int32_t i, j; + int32_t step, dir, steps; - if (!((int)sv_player->v.flags & FL_ONGROUND)) + if (!((int32_t)sv_player->v.flags & FL_ONGROUND)) return; angleval = sv_player->v.angles[YAW] * M_PI*2 / 360; @@ -167,7 +167,7 @@ cvar_t sv_maxspeed = {"sv_maxspeed", "320", CVAR_NOTIFY|CVAR_SERVERINFO}; cvar_t sv_accelerate = {"sv_accelerate", "10", CVAR_NONE}; void SV_Accelerate (float wishspeed, const vec3_t wishdir) { - int i; + int32_t i; float addspeed, accelspeed, currentspeed; currentspeed = DotProduct (velocity, wishdir); @@ -184,7 +184,7 @@ void SV_Accelerate (float wishspeed, const vec3_t wishdir) void SV_AirAccelerate (float wishspeed, vec3_t wishveloc) { - int i; + int32_t i; float addspeed, wishspd, accelspeed, currentspeed; wishspd = VectorNormalize (wishveloc); @@ -224,7 +224,7 @@ SV_WaterMove */ void SV_WaterMove (void) { - int i; + int32_t i; vec3_t wishvel; float speed, newspeed, wishspeed, addspeed, accelspeed; @@ -287,7 +287,7 @@ void SV_WaterJump (void) if (sv.time > sv_player->v.teleport_time || !sv_player->v.waterlevel) { - sv_player->v.flags = (int)sv_player->v.flags & ~FL_WATERJUMP; + sv_player->v.flags = (int32_t)sv_player->v.flags & ~FL_WATERJUMP; sv_player->v.teleport_time = 0; } sv_player->v.velocity[0] = sv_player->v.movedir[0]; @@ -324,7 +324,7 @@ SV_AirMove */ void SV_AirMove (void) { - int i; + int32_t i; vec3_t wishvel, wishdir; float wishspeed; float fmove, smove; @@ -341,7 +341,7 @@ void SV_AirMove (void) for (i=0 ; i<3 ; i++) wishvel[i] = forward[i]*fmove + right[i]*smove; - if ( (int)sv_player->v.movetype != MOVETYPE_WALK) + if ( (int32_t)sv_player->v.movetype != MOVETYPE_WALK) wishvel[2] = cmd.upmove; else wishvel[2] = 0; @@ -384,7 +384,7 @@ void SV_ClientThink (void) if (sv_player->v.movetype == MOVETYPE_NONE) return; - onground = (int)sv_player->v.flags & FL_ONGROUND; + onground = (int32_t)sv_player->v.flags & FL_ONGROUND; origin = sv_player->v.origin; velocity = sv_player->v.velocity; @@ -411,7 +411,7 @@ void SV_ClientThink (void) angles[YAW] = v_angle[YAW]; } - if ( (int)sv_player->v.flags & FL_WATERJUMP ) + if ( (int32_t)sv_player->v.flags & FL_WATERJUMP ) { SV_WaterJump (); return; @@ -437,9 +437,9 @@ SV_ReadClientMove */ void SV_ReadClientMove (usercmd_t *move) { - int i; + int32_t i; vec3_t angle; - int bits; + int32_t bits; // read ping time host_client->ping_times[host_client->num_pings%NUM_PING_TIMES] @@ -481,8 +481,8 @@ Returns false if the client should be killed */ bool SV_ReadClientMessage (void) { - int ret; - int ccmd; + int32_t ret; + int32_t ccmd; const char *s; do @@ -597,7 +597,7 @@ SV_RunClients */ void SV_RunClients (void) { - int i; + int32_t i; for (i=0, host_client = svs.clients ; isin_addr.s_addr); q_snprintf (buffer, sizeof(buffer), "%d.%d.%d.%d:%d", (haddr >> 24) & 0xff, @@ -357,9 +357,9 @@ const char *UDP_AddrToString (struct qsockaddr *addr) //============================================================================= -int UDP_StringToAddr (const char *string, struct qsockaddr *addr) +int32_t UDP_StringToAddr (const char *string, struct qsockaddr *addr) { - int ha1, ha2, ha3, ha4, hp, ipaddr; + int32_t ha1, ha2, ha3, ha4, hp, ipaddr; sscanf(string, "%d.%d.%d.%d:%d", &ha1, &ha2, &ha3, &ha4, &hp); ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4; @@ -372,7 +372,7 @@ int UDP_StringToAddr (const char *string, struct qsockaddr *addr) //============================================================================= -int UDP_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr) +int32_t UDP_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr) { socklen_t addrlen = sizeof(struct qsockaddr); in_addr_t a; @@ -390,7 +390,7 @@ int UDP_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr) //============================================================================= -int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name) +int32_t UDP_GetNameFromAddr (struct qsockaddr *addr, char *name) { struct hostent *hostentry; @@ -408,7 +408,7 @@ int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name) //============================================================================= -int UDP_GetAddrFromName (const char *name, struct qsockaddr *addr) +int32_t UDP_GetAddrFromName (const char *name, struct qsockaddr *addr) { struct hostent *hostentry; @@ -429,7 +429,7 @@ int UDP_GetAddrFromName (const char *name, struct qsockaddr *addr) //============================================================================= -int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) +int32_t UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) { if (addr1->qsa_family != addr2->qsa_family) return -1; @@ -447,13 +447,13 @@ int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) //============================================================================= -int UDP_GetSocketPort (struct qsockaddr *addr) +int32_t UDP_GetSocketPort (struct qsockaddr *addr) { return ntohs(((struct sockaddr_in *)addr)->sin_port); } -int UDP_SetSocketPort (struct qsockaddr *addr, int port) +int32_t UDP_SetSocketPort (struct qsockaddr *addr, int32_t port) { ((struct sockaddr_in *)addr)->sin_port = htons((uint16_t)port); return 0; diff --git a/source/unix/net_udp.h b/source/unix/net_udp.h index 13b8fc4..bba4f4b 100644 --- a/source/unix/net_udp.h +++ b/source/unix/net_udp.h @@ -25,21 +25,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. sys_socket_t UDP_Init (void); void UDP_Shutdown (void); void UDP_Listen (bool state); -sys_socket_t UDP_OpenSocket (int port); -int UDP_CloseSocket (sys_socket_t socketid); -int UDP_Connect (sys_socket_t socketid, struct qsockaddr *addr); +sys_socket_t UDP_OpenSocket (int32_t port); +int32_t UDP_CloseSocket (sys_socket_t socketid); +int32_t UDP_Connect (sys_socket_t socketid, struct qsockaddr *addr); sys_socket_t UDP_CheckNewConnections (void); -int UDP_Read (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); -int UDP_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); -int UDP_Broadcast (sys_socket_t socketid, byte *buf, int len); +int32_t UDP_Read (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr); +int32_t UDP_Write (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr); +int32_t UDP_Broadcast (sys_socket_t socketid, byte *buf, int32_t len); const char *UDP_AddrToString (struct qsockaddr *addr); -int UDP_StringToAddr (const char *string, struct qsockaddr *addr); -int UDP_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr); -int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name); -int UDP_GetAddrFromName (const char *name, struct qsockaddr *addr); -int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); -int UDP_GetSocketPort (struct qsockaddr *addr); -int UDP_SetSocketPort (struct qsockaddr *addr, int port); +int32_t UDP_StringToAddr (const char *string, struct qsockaddr *addr); +int32_t UDP_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr); +int32_t UDP_GetNameFromAddr (struct qsockaddr *addr, char *name); +int32_t UDP_GetAddrFromName (const char *name, struct qsockaddr *addr); +int32_t UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); +int32_t UDP_GetSocketPort (struct qsockaddr *addr); +int32_t UDP_SetSocketPort (struct qsockaddr *addr, int32_t port); #endif /* __net_udp_h */ diff --git a/source/unix/sys_sdl_unix.c b/source/unix/sys_sdl_unix.c index 323efff..ff45908 100644 --- a/source/unix/sys_sdl_unix.c +++ b/source/unix/sys_sdl_unix.c @@ -45,9 +45,9 @@ cvar_t sys_throttle = {"sys_throttle", "0.02", CVAR_ARCHIVE}; static FILE *sys_handles[MAX_HANDLES]; -static int findhandle (void) +static int32_t findhandle (void) { - int i; + int32_t i; for (i = 1; i < MAX_HANDLES; i++) { @@ -70,10 +70,10 @@ long Sys_filelength (FILE *f) return end; } -int Sys_FileOpenRead (const char *path, int *hndl) +int32_t Sys_FileOpenRead (const char *path, int32_t *hndl) { FILE *f; - int i, retval; + int32_t i, retval; i = findhandle (); f = fopen(path, "rb"); @@ -93,10 +93,10 @@ int Sys_FileOpenRead (const char *path, int *hndl) return retval; } -int Sys_FileOpenWrite (const char *path) +int32_t Sys_FileOpenWrite (const char *path) { FILE *f; - int i; + int32_t i; i = findhandle (); f = fopen(path, "wb"); @@ -108,28 +108,28 @@ int Sys_FileOpenWrite (const char *path) return i; } -void Sys_FileClose (int handle) +void Sys_FileClose (int32_t handle) { fclose (sys_handles[handle]); sys_handles[handle] = NULL; } -void Sys_FileSeek (int handle, int position) +void Sys_FileSeek (int32_t handle, int32_t position) { fseek (sys_handles[handle], position, SEEK_SET); } -int Sys_FileRead (int handle, void *dest, int count) +int32_t Sys_FileRead (int32_t handle, void *dest, int32_t count) { return fread (dest, 1, count, sys_handles[handle]); } -int Sys_FileWrite (int handle, const void *data, int count) +int32_t Sys_FileWrite (int32_t handle, const void *data, int32_t count) { return fwrite (data, 1, count, sys_handles[handle]); } -int Sys_FileTime (const char *path) +int32_t Sys_FileTime (const char *path) { FILE *f; @@ -146,9 +146,9 @@ int Sys_FileTime (const char *path) #if defined(__linux__) || defined(__sun) || defined(sun) || defined(_AIX) -static int Sys_NumCPUs (void) +static int32_t Sys_NumCPUs (void) { - int numcpus = sysconf(_SC_NPROCESSORS_ONLN); + int32_t numcpus = sysconf(_SC_NPROCESSORS_ONLN); return (numcpus < 1) ? 1 : numcpus; } @@ -157,10 +157,10 @@ static int Sys_NumCPUs (void) #if !defined(HW_AVAILCPU) /* using an ancient SDK? */ #define HW_AVAILCPU 25 /* needs >= 10.2 */ #endif -static int Sys_NumCPUs (void) +static int32_t Sys_NumCPUs (void) { - int numcpus; - int mib[2]; + int32_t numcpus; + int32_t mib[2]; size_t len; #if defined(_SC_NPROCESSORS_ONLN) /* needs >= 10.5 */ @@ -182,9 +182,9 @@ static int Sys_NumCPUs (void) } #elif defined(__sgi) || defined(sgi) || defined(__sgi__) /* IRIX */ -static int Sys_NumCPUs (void) +static int32_t Sys_NumCPUs (void) { - int numcpus = sysconf(_SC_NPROC_ONLN); + int32_t numcpus = sysconf(_SC_NPROC_ONLN); if (numcpus < 1) numcpus = 1; return numcpus; @@ -192,10 +192,10 @@ static int Sys_NumCPUs (void) #elif defined(PLATFORM_BSD) #include -static int Sys_NumCPUs (void) +static int32_t Sys_NumCPUs (void) { - int numcpus; - int mib[2]; + int32_t numcpus; + int32_t mib[2]; size_t len; #if defined(_SC_NPROCESSORS_ONLN) @@ -213,14 +213,14 @@ static int Sys_NumCPUs (void) #elif defined(__hpux) || defined(__hpux__) || defined(_hpux) #include -static int Sys_NumCPUs (void) +static int32_t Sys_NumCPUs (void) { - int numcpus = mpctl(MPC_GETNUMSPUS, NULL, NULL); + int32_t numcpus = mpctl(MPC_GETNUMSPUS, NULL, NULL); return numcpus; } #else /* unknown OS */ -static int Sys_NumCPUs (void) +static int32_t Sys_NumCPUs (void) { return -2; } @@ -357,7 +357,7 @@ void Sys_Init (void) void Sys_mkdir (const char *path) { - int rc = mkdir (path, 0777); + int32_t rc = mkdir (path, 0777); if (rc != 0 && errno == EEXIST) { struct stat st; @@ -420,7 +420,7 @@ double Sys_DoubleTime (void) const char *Sys_ConsoleInput (void) { static char con_text[256]; - static int textlen; + static int32_t textlen; char c; fd_set set; struct timeval timeout; @@ -450,7 +450,7 @@ const char *Sys_ConsoleInput (void) } con_text[textlen] = c; textlen++; - if (textlen < (int) sizeof(con_text)) + if (textlen < (int32_t) sizeof(con_text)) con_text[textlen] = '\0'; else { diff --git a/source/vid.h b/source/vid.h index 5e888dd..0fbc9c9 100644 --- a/source/vid.h +++ b/source/vid.h @@ -41,7 +41,7 @@ typedef byte pixel_t; typedef struct vrect_s { - int x, y, width, height; + int32_t x, y, width, height; struct vrect_s *pnext; } vrect_t; @@ -50,26 +50,26 @@ typedef struct pixel_t *buffer; // invisible buffer pixel_t *colormap; // 256 * VID_GRADES size uint16_t *colormap16; // 256 * VID_GRADES size - int fullbright; // index of first fullbright color - int rowbytes; // may be > width if displayed in a window - int width; - int height; + int32_t fullbright; // index of first fullbright color + int32_t rowbytes; // may be > width if displayed in a window + int32_t width; + int32_t height; float aspect; // width / height -- < 0 is taller than wide - int numpages; - int recalc_refdef; // if true, recalc vid-based stuff + int32_t numpages; + int32_t recalc_refdef; // if true, recalc vid-based stuff pixel_t *conbuffer; - int conrowbytes; - int conwidth; - int conheight; - int maxwarpwidth; - int maxwarpheight; + int32_t conrowbytes; + int32_t conwidth; + int32_t conheight; + int32_t maxwarpwidth; + int32_t maxwarpheight; pixel_t *direct; // direct drawing to framebuffer, if not NULL } viddef_t; extern viddef_t vid; // global video state extern void (*vid_menudrawfn)(void); -extern void (*vid_menukeyfn)(int key); +extern void (*vid_menukeyfn)(int32_t key); extern void (*vid_menucmdfn)(void); //johnfitz void VID_Init (void); //johnfitz -- removed palette from argument list diff --git a/source/view.c b/source/view.c index 5fdc3b3..84d06bb 100644 --- a/source/view.c +++ b/source/view.c @@ -69,7 +69,7 @@ cvar_t r_viewmodel_quake = {"r_viewmodel_quake", "0", CVAR_ARCHIVE}; float v_dmg_time, v_dmg_roll, v_dmg_pitch; -extern int in_forward, in_forward2, in_back; +extern int32_t in_forward, in_forward2, in_back; vec3_t v_punchangles[2]; //johnfitz -- copied from cl.punchangle. 0 is current, 1 is previous value. never the same unless map just loaded @@ -116,7 +116,7 @@ float V_CalcBob (void) float bob; float cycle; - cycle = cl.time - (int)(cl.time/cl_bobcycle.value)*cl_bobcycle.value; + cycle = cl.time - (int32_t)(cl.time/cl_bobcycle.value)*cl_bobcycle.value; cycle /= cl_bobcycle.value; if (cycle < cl_bobup.value) cycle = M_PI * cycle / cl_bobup.value; @@ -265,9 +265,9 @@ V_ParseDamage */ void V_ParseDamage (void) { - int armor, blood; + int32_t armor, blood; vec3_t from; - int i; + int32_t i; vec3_t forward, right, up; entity_t *ent; float side; @@ -365,7 +365,7 @@ V_SetContentsColor Underwater, lava, etc each has a color shift ============= */ -void V_SetContentsColor (int contents) +void V_SetContentsColor (int32_t contents) { switch (contents) { @@ -432,7 +432,7 @@ V_CalcBlend void V_CalcBlend (void) { float r, g, b, a, a2; - int j; + int32_t j; cvar_t *cshiftpercent_cvars[NUM_CSHIFTS] = { &gl_cshiftpercent_contents, &gl_cshiftpercent_damage, @@ -485,7 +485,7 @@ V_UpdateBlend -- johnfitz -- V_UpdatePalette cleaned up and renamed */ void V_UpdateBlend (void) { - int i, j; + int32_t i, j; bool blend_changed; V_CalcPowerupCshift (); @@ -739,7 +739,7 @@ V_CalcRefdef void V_CalcRefdef (void) { entity_t *ent, *view; - int i; + int32_t i; vec3_t forward, right, up; vec3_t angles; float bob; diff --git a/source/wad.c b/source/wad.c index aae5f38..666900d 100644 --- a/source/wad.c +++ b/source/wad.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -int wad_numlumps; +int32_t wad_numlumps; lumpinfo_t *wad_lumps; byte *wad_base = NULL; @@ -42,8 +42,8 @@ Can safely be performed in place. */ void W_CleanupName (const char *in, char *out) { - int i; - int c; + int32_t i; + int32_t c; for (i=0 ; i<16 ; i++ ) { @@ -69,8 +69,8 @@ void W_LoadWadFile (void) //johnfitz -- filename is now hard-coded for honesty { lumpinfo_t *lump_p; wadinfo_t *header; - int i; - int infotableofs; + int32_t i; + int32_t infotableofs; const char *filename = WADFILENAME; //johnfitz -- modified to use malloc @@ -113,7 +113,7 @@ W_GetLumpinfo */ lumpinfo_t *W_GetLumpinfo (const char *name) { - int i; + int32_t i; lumpinfo_t *lump_p; char clean[16]; @@ -140,7 +140,7 @@ void *W_GetLumpName (const char *name) return (void *)(wad_base + lump->filepos); } -void *W_GetLumpNum (int num) +void *W_GetLumpNum (int32_t num) { lumpinfo_t *lump; diff --git a/source/wad.h b/source/wad.h index 388dd10..b7d35e0 100644 --- a/source/wad.h +++ b/source/wad.h @@ -44,29 +44,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { - int width, height; + int32_t width, height; byte data[4]; // variably sized } qpic_t; typedef struct { char identification[4]; // should be WAD2 or 2DAW - int numlumps; - int infotableofs; + int32_t numlumps; + int32_t infotableofs; } wadinfo_t; typedef struct { - int filepos; - int disksize; - int size; // uncompressed + int32_t filepos; + int32_t disksize; + int32_t size; // uncompressed int8_t type; int8_t compression; uint8_t pad1, pad2; char name[16]; // must be null terminated } lumpinfo_t; -extern int wad_numlumps; +extern int32_t wad_numlumps; extern lumpinfo_t *wad_lumps; extern byte *wad_base; @@ -74,7 +74,7 @@ void W_LoadWadFile (void); //johnfitz -- filename is now hard-coded for honesty void W_CleanupName (const char *in, char *out); lumpinfo_t *W_GetLumpinfo (const char *name); void *W_GetLumpName (const char *name); -void *W_GetLumpNum (int num); +void *W_GetLumpNum (int32_t num); void SwapPic (qpic_t *pic); diff --git a/source/windows/net_win.c b/source/windows/net_win.c index 2d4ec9e..70b75b2 100644 --- a/source/windows/net_win.c +++ b/source/windows/net_win.c @@ -63,7 +63,7 @@ net_driver_t net_drivers[] = } }; -const int net_numdrivers = (sizeof(net_drivers) / sizeof(net_drivers[0])); +const int32_t net_numdrivers = (sizeof(net_drivers) / sizeof(net_drivers[0])); #include "net_wins.h" @@ -118,5 +118,5 @@ net_landriver_t net_landrivers[] = } }; -const int net_numlandrivers = (sizeof(net_landrivers) / sizeof(net_landrivers[0])); +const int32_t net_numlandrivers = (sizeof(net_landrivers) / sizeof(net_landrivers[0])); diff --git a/source/windows/net_wins.c b/source/windows/net_wins.c index 767f2cd..6693a7c 100644 --- a/source/windows/net_wins.c +++ b/source/windows/net_wins.c @@ -33,7 +33,7 @@ static in_addr_t myAddr; #include "net_wins.h" -int winsock_initialized = 0; +int32_t winsock_initialized = 0; WSADATA winsockdata; #define __wsaerr_static /* not static: used by net_wipx.c too */ #include "wsaerror.h" @@ -75,7 +75,7 @@ static void WINS_GetLocalAddress (void) struct hostent *local = NULL; char buff[MAXHOSTNAMELEN]; in_addr_t addr; - int err; + int32_t err; if (myAddr != INADDR_ANY) return; @@ -114,7 +114,7 @@ static void WINS_GetLocalAddress (void) sys_socket_t WINS_Init (void) { - int i, err; + int32_t i, err; char buff[MAXHOSTNAMELEN]; if (COM_CheckParm ("-noudp")) @@ -216,12 +216,12 @@ void WINS_Listen (bool state) //============================================================================= -sys_socket_t WINS_OpenSocket (int port) +sys_socket_t WINS_OpenSocket (int32_t port) { sys_socket_t newsocket; struct sockaddr_in address; u_long _true = 1; - int err; + int32_t err; if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET) { @@ -259,7 +259,7 @@ ErrorReturn: //============================================================================= -int WINS_CloseSocket (sys_socket_t socketid) +int32_t WINS_CloseSocket (sys_socket_t socketid) { if (socketid == net_broadcastsocket) net_broadcastsocket = 0; @@ -276,11 +276,11 @@ this lets you type only as much of the net address as required, using the local network components to fill in the rest ============ */ -static int PartialIPAddress (const char *in, struct qsockaddr *hostaddr) +static int32_t PartialIPAddress (const char *in, struct qsockaddr *hostaddr) { char buff[256]; char *b; - int addr, mask, num, port, run; + int32_t addr, mask, num, port, run; buff[0] = '.'; b = buff; @@ -324,7 +324,7 @@ static int PartialIPAddress (const char *in, struct qsockaddr *hostaddr) //============================================================================= -int WINS_Connect (sys_socket_t socketid, struct qsockaddr *addr) +int32_t WINS_Connect (sys_socket_t socketid, struct qsockaddr *addr) { return 0; } @@ -348,15 +348,15 @@ sys_socket_t WINS_CheckNewConnections (void) //============================================================================= -int WINS_Read (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr) +int32_t WINS_Read (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr) { socklen_t addrlen = sizeof(struct qsockaddr); - int ret; + int32_t ret; ret = recvfrom (socketid, (char *)buf, len, 0, (struct sockaddr *)addr, &addrlen); if (ret == SOCKET_ERROR) { - int err = SOCKETERRNO; + int32_t err = SOCKETERRNO; if (err == NET_EWOULDBLOCK || err == NET_ECONNREFUSED) return 0; Con_SafePrintf ("WINS_Read, recvfrom: %s\n", socketerror(err)); @@ -366,15 +366,15 @@ int WINS_Read (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr //============================================================================= -static int WINS_MakeSocketBroadcastCapable (sys_socket_t socketid) +static int32_t WINS_MakeSocketBroadcastCapable (sys_socket_t socketid) { - int i = 1; + int32_t i = 1; // make this socket broadcast capable if (setsockopt(socketid, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i)) == SOCKET_ERROR) { - int err = SOCKETERRNO; + int32_t err = SOCKETERRNO; Con_SafePrintf ("UDP, setsockopt: %s\n", socketerror(err)); return -1; } @@ -385,9 +385,9 @@ static int WINS_MakeSocketBroadcastCapable (sys_socket_t socketid) //============================================================================= -int WINS_Broadcast (sys_socket_t socketid, byte *buf, int len) +int32_t WINS_Broadcast (sys_socket_t socketid, byte *buf, int32_t len) { - int ret; + int32_t ret; if (socketid != net_broadcastsocket) { @@ -407,15 +407,15 @@ int WINS_Broadcast (sys_socket_t socketid, byte *buf, int len) //============================================================================= -int WINS_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr) +int32_t WINS_Write (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr) { - int ret; + int32_t ret; ret = sendto (socketid, (char *)buf, len, 0, (struct sockaddr *)addr, sizeof(struct qsockaddr)); if (ret == SOCKET_ERROR) { - int err = SOCKETERRNO; + int32_t err = SOCKETERRNO; if (err == NET_EWOULDBLOCK) return 0; Con_SafePrintf ("WINS_Write, sendto: %s\n", socketerror(err)); @@ -428,7 +428,7 @@ int WINS_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *add const char *WINS_AddrToString (struct qsockaddr *addr) { static char buffer[22]; - int haddr; + int32_t haddr; haddr = ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr); sprintf(buffer, "%d.%d.%d.%d:%d", (haddr >> 24) & 0xff, @@ -439,9 +439,9 @@ const char *WINS_AddrToString (struct qsockaddr *addr) //============================================================================= -int WINS_StringToAddr (const char *string, struct qsockaddr *addr) +int32_t WINS_StringToAddr (const char *string, struct qsockaddr *addr) { - int ha1, ha2, ha3, ha4, hp, ipaddr; + int32_t ha1, ha2, ha3, ha4, hp, ipaddr; sscanf(string, "%d.%d.%d.%d:%d", &ha1, &ha2, &ha3, &ha4, &hp); ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4; @@ -454,7 +454,7 @@ int WINS_StringToAddr (const char *string, struct qsockaddr *addr) //============================================================================= -int WINS_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr) +int32_t WINS_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr) { socklen_t addrlen = sizeof(struct qsockaddr); in_addr_t a; @@ -471,7 +471,7 @@ int WINS_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr) //============================================================================= -int WINS_GetNameFromAddr (struct qsockaddr *addr, char *name) +int32_t WINS_GetNameFromAddr (struct qsockaddr *addr, char *name) { struct hostent *hostentry; @@ -489,7 +489,7 @@ int WINS_GetNameFromAddr (struct qsockaddr *addr, char *name) //============================================================================= -int WINS_GetAddrFromName (const char *name, struct qsockaddr *addr) +int32_t WINS_GetAddrFromName (const char *name, struct qsockaddr *addr) { struct hostent *hostentry; @@ -510,7 +510,7 @@ int WINS_GetAddrFromName (const char *name, struct qsockaddr *addr) //============================================================================= -int WINS_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) +int32_t WINS_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) { if (addr1->qsa_family != addr2->qsa_family) return -1; @@ -528,13 +528,13 @@ int WINS_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) //============================================================================= -int WINS_GetSocketPort (struct qsockaddr *addr) +int32_t WINS_GetSocketPort (struct qsockaddr *addr) { return ntohs(((struct sockaddr_in *)addr)->sin_port); } -int WINS_SetSocketPort (struct qsockaddr *addr, int port) +int32_t WINS_SetSocketPort (struct qsockaddr *addr, int32_t port) { ((struct sockaddr_in *)addr)->sin_port = htons((uint16_t)port); return 0; diff --git a/source/windows/net_wins.h b/source/windows/net_wins.h index 65f93e9..39e2535 100644 --- a/source/windows/net_wins.h +++ b/source/windows/net_wins.h @@ -25,21 +25,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. sys_socket_t WINS_Init (void); void WINS_Shutdown (void); void WINS_Listen (bool state); -sys_socket_t WINS_OpenSocket (int port); -int WINS_CloseSocket (sys_socket_t socketid); -int WINS_Connect (sys_socket_t socketid, struct qsockaddr *addr); +sys_socket_t WINS_OpenSocket (int32_t port); +int32_t WINS_CloseSocket (sys_socket_t socketid); +int32_t WINS_Connect (sys_socket_t socketid, struct qsockaddr *addr); sys_socket_t WINS_CheckNewConnections (void); -int WINS_Read (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); -int WINS_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); -int WINS_Broadcast (sys_socket_t socketid, byte *buf, int len); +int32_t WINS_Read (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr); +int32_t WINS_Write (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr); +int32_t WINS_Broadcast (sys_socket_t socketid, byte *buf, int32_t len); const char *WINS_AddrToString (struct qsockaddr *addr); -int WINS_StringToAddr (const char *string, struct qsockaddr *addr); -int WINS_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr); -int WINS_GetNameFromAddr (struct qsockaddr *addr, char *name); -int WINS_GetAddrFromName (const char *name, struct qsockaddr *addr); -int WINS_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); -int WINS_GetSocketPort (struct qsockaddr *addr); -int WINS_SetSocketPort (struct qsockaddr *addr, int port); +int32_t WINS_StringToAddr (const char *string, struct qsockaddr *addr); +int32_t WINS_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr); +int32_t WINS_GetNameFromAddr (struct qsockaddr *addr, char *name); +int32_t WINS_GetAddrFromName (const char *name, struct qsockaddr *addr); +int32_t WINS_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); +int32_t WINS_GetSocketPort (struct qsockaddr *addr); +int32_t WINS_SetSocketPort (struct qsockaddr *addr, int32_t port); #endif /* __NET_WINSOCK_H */ diff --git a/source/windows/net_wipx.c b/source/windows/net_wipx.c index 28b27ae..66fcca2 100644 --- a/source/windows/net_wipx.c +++ b/source/windows/net_wipx.c @@ -38,17 +38,17 @@ static struct sockaddr_ipx broadcastaddr; /* externs from net_wins.c: */ extern bool winsock_initialized; extern WSADATA winsockdata; -extern const char *__WSAE_StrError (int); +extern const char *__WSAE_StrError (int32_t); #define IPXSOCKETS 18 static sys_socket_t ipxsocket[IPXSOCKETS]; -static int sequence[IPXSOCKETS]; +static int32_t sequence[IPXSOCKETS]; //============================================================================= sys_socket_t WIPX_Init (void) { - int i, err; + int32_t i, err; char *colon; char buff[MAXHOSTNAMELEN]; struct qsockaddr addr; @@ -141,9 +141,9 @@ void WIPX_Listen (bool state) //============================================================================= -sys_socket_t WIPX_OpenSocket (int port) +sys_socket_t WIPX_OpenSocket (int32_t port) { - int err; + int32_t err; sys_socket_t handle, newsocket; struct sockaddr_ipx address; u_long _true = 1; @@ -201,10 +201,10 @@ ErrorReturn: //============================================================================= -int WIPX_CloseSocket (sys_socket_t handle) +int32_t WIPX_CloseSocket (sys_socket_t handle) { sys_socket_t socketid = ipxsocket[handle]; - int ret; + int32_t ret; ret = closesocket (socketid); ipxsocket[handle] = 0; @@ -213,7 +213,7 @@ int WIPX_CloseSocket (sys_socket_t handle) //============================================================================= -int WIPX_Connect (sys_socket_t handle, struct qsockaddr *addr) +int32_t WIPX_Connect (sys_socket_t handle, struct qsockaddr *addr) { return 0; } @@ -229,7 +229,7 @@ sys_socket_t WIPX_CheckNewConnections (void) if (ioctlsocket (ipxsocket[net_acceptsocket], FIONREAD, &available) == SOCKET_ERROR) { - int err = SOCKETERRNO; + int32_t err = SOCKETERRNO; Sys_Error ("WIPX: ioctlsocket (FIONREAD) failed (%s)", socketerror(err)); } if (available) @@ -241,16 +241,16 @@ sys_socket_t WIPX_CheckNewConnections (void) static byte netpacketBuffer[NET_DATAGRAMSIZE + 4]; -int WIPX_Read (sys_socket_t handle, byte *buf, int len, struct qsockaddr *addr) +int32_t WIPX_Read (sys_socket_t handle, byte *buf, int32_t len, struct qsockaddr *addr) { socklen_t addrlen = sizeof(struct qsockaddr); sys_socket_t socketid = ipxsocket[handle]; - int ret; + int32_t ret; ret = recvfrom (socketid, (char *)netpacketBuffer, len+4, 0, (struct sockaddr *)addr, &addrlen); if (ret == SOCKET_ERROR) { - int err = SOCKETERRNO; + int32_t err = SOCKETERRNO; if (err == NET_EWOULDBLOCK || err == NET_ECONNREFUSED) return 0; Con_SafePrintf ("WIPX_Read, recvfrom: %s\n", socketerror(err)); @@ -268,17 +268,17 @@ int WIPX_Read (sys_socket_t handle, byte *buf, int len, struct qsockaddr *addr) //============================================================================= -int WIPX_Broadcast (sys_socket_t handle, byte *buf, int len) +int32_t WIPX_Broadcast (sys_socket_t handle, byte *buf, int32_t len) { return WIPX_Write (handle, buf, len, (struct qsockaddr *)&broadcastaddr); } //============================================================================= -int WIPX_Write (sys_socket_t handle, byte *buf, int len, struct qsockaddr *addr) +int32_t WIPX_Write (sys_socket_t handle, byte *buf, int32_t len, struct qsockaddr *addr) { sys_socket_t socketid = ipxsocket[handle]; - int ret; + int32_t ret; // build packet with sequence number memcpy(&netpacketBuffer[0], &sequence[handle], 4); @@ -289,7 +289,7 @@ int WIPX_Write (sys_socket_t handle, byte *buf, int len, struct qsockaddr *addr) ret = sendto (socketid, (char *)netpacketBuffer, len, 0, (struct sockaddr *)addr, sizeof(struct qsockaddr)); if (ret == SOCKET_ERROR) { - int err = SOCKETERRNO; + int32_t err = SOCKETERRNO; if (err == NET_EWOULDBLOCK) return 0; Con_SafePrintf ("WIPX_Write, sendto: %s\n", socketerror(err)); @@ -322,9 +322,9 @@ const char *WIPX_AddrToString (struct qsockaddr *addr) //============================================================================= -int WIPX_StringToAddr (const char *string, struct qsockaddr *addr) +int32_t WIPX_StringToAddr (const char *string, struct qsockaddr *addr) { - int val; + int32_t val; char buf[3]; buf[2] = 0; @@ -359,7 +359,7 @@ int WIPX_StringToAddr (const char *string, struct qsockaddr *addr) //============================================================================= -int WIPX_GetSocketAddr (sys_socket_t handle, struct qsockaddr *addr) +int32_t WIPX_GetSocketAddr (sys_socket_t handle, struct qsockaddr *addr) { sys_socket_t socketid = ipxsocket[handle]; socklen_t addrlen = sizeof(struct qsockaddr); @@ -367,7 +367,7 @@ int WIPX_GetSocketAddr (sys_socket_t handle, struct qsockaddr *addr) Q_memset(addr, 0, sizeof(struct qsockaddr)); if (getsockname(socketid, (struct sockaddr *)addr, &addrlen) != 0) { - int err = SOCKETERRNO; + int32_t err = SOCKETERRNO; /* FIXME: what action should be taken?... */ Con_SafePrintf ("WIPX, getsockname: %s\n", socketerror(err)); } @@ -377,7 +377,7 @@ int WIPX_GetSocketAddr (sys_socket_t handle, struct qsockaddr *addr) //============================================================================= -int WIPX_GetNameFromAddr (struct qsockaddr *addr, char *name) +int32_t WIPX_GetNameFromAddr (struct qsockaddr *addr, char *name) { Q_strcpy(name, WIPX_AddrToString(addr)); return 0; @@ -385,9 +385,9 @@ int WIPX_GetNameFromAddr (struct qsockaddr *addr, char *name) //============================================================================= -int WIPX_GetAddrFromName (const char *name, struct qsockaddr *addr) +int32_t WIPX_GetAddrFromName (const char *name, struct qsockaddr *addr) { - int n; + int32_t n; char buf[32]; n = Q_strlen(name); @@ -410,7 +410,7 @@ int WIPX_GetAddrFromName (const char *name, struct qsockaddr *addr) //============================================================================= -int WIPX_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) +int32_t WIPX_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) { if (addr1->qsa_family != addr2->qsa_family) return -1; @@ -432,13 +432,13 @@ int WIPX_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2) //============================================================================= -int WIPX_GetSocketPort (struct qsockaddr *addr) +int32_t WIPX_GetSocketPort (struct qsockaddr *addr) { return ntohs(((struct sockaddr_ipx *)addr)->sa_socket); } -int WIPX_SetSocketPort (struct qsockaddr *addr, int port) +int32_t WIPX_SetSocketPort (struct qsockaddr *addr, int32_t port) { ((struct sockaddr_ipx *)addr)->sa_socket = htons((uint16_t)port); return 0; diff --git a/source/windows/net_wipx.h b/source/windows/net_wipx.h index ca3b25a..ae3fa49 100644 --- a/source/windows/net_wipx.h +++ b/source/windows/net_wipx.h @@ -25,21 +25,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. sys_socket_t WIPX_Init (void); void WIPX_Shutdown (void); void WIPX_Listen (bool state); -sys_socket_t WIPX_OpenSocket (int port); -int WIPX_CloseSocket (sys_socket_t socketid); -int WIPX_Connect (sys_socket_t socketid, struct qsockaddr *addr); +sys_socket_t WIPX_OpenSocket (int32_t port); +int32_t WIPX_CloseSocket (sys_socket_t socketid); +int32_t WIPX_Connect (sys_socket_t socketid, struct qsockaddr *addr); sys_socket_t WIPX_CheckNewConnections (void); -int WIPX_Read (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); -int WIPX_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); -int WIPX_Broadcast (sys_socket_t socketid, byte *buf, int len); +int32_t WIPX_Read (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr); +int32_t WIPX_Write (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr); +int32_t WIPX_Broadcast (sys_socket_t socketid, byte *buf, int32_t len); const char *WIPX_AddrToString (struct qsockaddr *addr); -int WIPX_StringToAddr (const char *string, struct qsockaddr *addr); -int WIPX_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr); -int WIPX_GetNameFromAddr (struct qsockaddr *addr, char *name); -int WIPX_GetAddrFromName (const char *name, struct qsockaddr *addr); -int WIPX_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); -int WIPX_GetSocketPort (struct qsockaddr *addr); -int WIPX_SetSocketPort (struct qsockaddr *addr, int port); +int32_t WIPX_StringToAddr (const char *string, struct qsockaddr *addr); +int32_t WIPX_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr); +int32_t WIPX_GetNameFromAddr (struct qsockaddr *addr, char *name); +int32_t WIPX_GetAddrFromName (const char *name, struct qsockaddr *addr); +int32_t WIPX_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); +int32_t WIPX_GetSocketPort (struct qsockaddr *addr); +int32_t WIPX_SetSocketPort (struct qsockaddr *addr, int32_t port); #endif /* __NET_WINIPX_H */ diff --git a/source/windows/sys_sdl_win.c b/source/windows/sys_sdl_win.c index eca1cfc..c0bbb12 100644 --- a/source/windows/sys_sdl_win.c +++ b/source/windows/sys_sdl_win.c @@ -46,9 +46,9 @@ static HANDLE hinput, houtput; static FILE *sys_handles[MAX_HANDLES]; -static int findhandle (void) +static int32_t findhandle (void) { - int i; + int32_t i; for (i = 1; i < MAX_HANDLES; i++) { @@ -71,10 +71,10 @@ long Sys_filelength (FILE *f) return end; } -int Sys_FileOpenRead (const char *path, int *hndl) +int32_t Sys_FileOpenRead (const char *path, int32_t *hndl) { FILE *f; - int i, retval; + int32_t i, retval; i = findhandle (); f = fopen(path, "rb"); @@ -94,10 +94,10 @@ int Sys_FileOpenRead (const char *path, int *hndl) return retval; } -int Sys_FileOpenWrite (const char *path) +int32_t Sys_FileOpenWrite (const char *path) { FILE *f; - int i; + int32_t i; i = findhandle (); f = fopen(path, "wb"); @@ -109,28 +109,28 @@ int Sys_FileOpenWrite (const char *path) return i; } -void Sys_FileClose (int handle) +void Sys_FileClose (int32_t handle) { fclose (sys_handles[handle]); sys_handles[handle] = NULL; } -void Sys_FileSeek (int handle, int position) +void Sys_FileSeek (int32_t handle, int32_t position) { fseek (sys_handles[handle], position, SEEK_SET); } -int Sys_FileRead (int handle, void *dest, int count) +int32_t Sys_FileRead (int32_t handle, void *dest, int32_t count) { return fread (dest, 1, count, sys_handles[handle]); } -int Sys_FileWrite (int handle, const void *data, int count) +int32_t Sys_FileWrite (int32_t handle, const void *data, int32_t count) { return fwrite (data, 1, count, sys_handles[handle]); } -int Sys_FileTime (const char *path) +int32_t Sys_FileTime (const char *path) { FILE *f; @@ -357,9 +357,9 @@ double Sys_DoubleTime (void) const char *Sys_ConsoleInput (void) { static char con_text[256]; - static int textlen; + static int32_t textlen; INPUT_RECORD recs[1024]; - int ch; + int32_t ch; DWORD dummy, numread, numevents; for ( ;; ) diff --git a/source/windows/wsaerror.h b/source/windows/wsaerror.h index b41a98e..5c72a37 100644 --- a/source/windows/wsaerror.h +++ b/source/windows/wsaerror.h @@ -10,7 +10,7 @@ #define __wsaerr_static static #endif /* static */ -__wsaerr_static const char *__WSAE_StrError (int err) +__wsaerr_static const char *__WSAE_StrError (int32_t err) { switch (err) { diff --git a/source/world.c b/source/world.c index bc3e3d2..33f4d11 100644 --- a/source/world.c +++ b/source/world.c @@ -40,12 +40,12 @@ typedef struct vec3_t mins2, maxs2; // size when clipping against mosnters float *start, *end; trace_t trace; - int type; + int32_t type; edict_t *passedict; } moveclip_t; -int SV_HullPointContents (hull_t *hull, int num, vec3_t p); +int32_t SV_HullPointContents (hull_t *hull, int32_t num, vec3_t p); /* =============================================================================== @@ -70,8 +70,8 @@ can just be stored out and get a proper hull_t structure. */ void SV_InitBoxHull (void) { - int i; - int side; + int32_t i; + int32_t side; box_hull.clipnodes = box_clipnodes; box_hull.planes = box_planes; @@ -143,7 +143,7 @@ hull_t *SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset) Host_Error ("SOLID_BSP without MOVETYPE_PUSH (%s at %f %f %f)", PR_GetString(ent->v.classname), ent->v.origin[0], ent->v.origin[1], ent->v.origin[2]); - model = sv.models[ (int)ent->v.modelindex ]; + model = sv.models[ (int32_t)ent->v.modelindex ]; if (!model || model->type != mod_brush) Host_Error ("SOLID_BSP with a non bsp model (%s at %f %f %f)", @@ -185,7 +185,7 @@ ENTITY AREA CHECKING typedef struct areanode_s { - int axis; // -1 = leaf node + int32_t axis; // -1 = leaf node float dist; struct areanode_s *children[2]; link_t trigger_edicts; @@ -196,7 +196,7 @@ typedef struct areanode_s #define AREA_NODES 32 static areanode_t sv_areanodes[AREA_NODES]; -static int sv_numareanodes; +static int32_t sv_numareanodes; /* =============== @@ -204,7 +204,7 @@ SV_CreateAreaNode =============== */ -areanode_t *SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs) +areanode_t *SV_CreateAreaNode (int32_t depth, vec3_t mins, vec3_t maxs) { areanode_t *anode; vec3_t size; @@ -283,7 +283,7 @@ them and risking the list getting corrupt. ==================== */ static void -SV_AreaTriggerEdicts ( edict_t *ent, areanode_t *node, edict_t **list, int *listcount, const int listspace ) +SV_AreaTriggerEdicts ( edict_t *ent, areanode_t *node, edict_t **list, int32_t *listcount, const int32_t listspace ) { link_t *l, *next; edict_t *touch; @@ -336,9 +336,9 @@ void SV_TouchLinks (edict_t *ent) { edict_t **list; edict_t *touch; - int old_self, old_other; - int i, listcount; - int mark; + int32_t old_self, old_other; + int32_t i, listcount; + int32_t mark; mark = Hunk_LowMark (); list = (edict_t **) Hunk_Alloc (sv.num_edicts*sizeof(edict_t *)); @@ -389,8 +389,8 @@ void SV_FindTouchedLeafs (edict_t *ent, mnode_t *node) { mplane_t *splitplane; mleaf_t *leaf; - int sides; - int leafnum; + int32_t sides; + int32_t leafnum; if (node->contents == CONTENTS_SOLID) return; @@ -450,7 +450,7 @@ void SV_LinkEdict (edict_t *ent, bool touch_triggers) // to make items easier to pick up and allow them to be grabbed off // of shelves, the abs sizes are expanded // - if ((int)ent->v.flags & FL_ITEM) + if ((int32_t)ent->v.flags & FL_ITEM) { ent->v.absmin[0] -= 15; ent->v.absmin[1] -= 15; @@ -518,7 +518,7 @@ SV_HullPointContents ================== */ -int SV_HullPointContents (hull_t *hull, int num, vec3_t p) +int32_t SV_HullPointContents (hull_t *hull, int32_t num, vec3_t p) { float d; mclipnode_t *node; //johnfitz -- was dclipnode_t @@ -552,9 +552,9 @@ SV_PointContents ================== */ -int SV_PointContents (vec3_t p) +int32_t SV_PointContents (vec3_t p) { - int cont; + int32_t cont; cont = SV_HullPointContents (&sv.worldmodel->hulls[0], 0, p); if (cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN) @@ -562,7 +562,7 @@ int SV_PointContents (vec3_t p) return cont; } -int SV_TruePointContents (vec3_t p) +int32_t SV_TruePointContents (vec3_t p) { return SV_HullPointContents (&sv.worldmodel->hulls[0], 0, p); } @@ -603,15 +603,15 @@ SV_RecursiveHullCheck ================== */ -bool SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace) +bool SV_RecursiveHullCheck (hull_t *hull, int32_t num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace) { mclipnode_t *node; //johnfitz -- was dclipnode_t mplane_t *plane; float t1, t2; float frac; - int i; + int32_t i; vec3_t mid; - int side; + int32_t side; float midf; // check for empty @@ -829,7 +829,7 @@ void SV_ClipToLinks ( areanode_t *node, moveclip_t *clip ) continue; // don't clip against owner } - if ((int)touch->v.flags & FL_MONSTER) + if ((int32_t)touch->v.flags & FL_MONSTER) trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins2, clip->maxs2, clip->end); else trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins, clip->maxs, clip->end); @@ -872,7 +872,7 @@ void SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, vec3_t b boxmins[0] = boxmins[1] = boxmins[2] = -9999; boxmaxs[0] = boxmaxs[1] = boxmaxs[2] = 9999; #else - int i; + int32_t i; for (i=0 ; i<3 ; i++) { @@ -895,10 +895,10 @@ boxmaxs[0] = boxmaxs[1] = boxmaxs[2] = 9999; SV_Move ================== */ -trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict) +trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int32_t type, edict_t *passedict) { moveclip_t clip; - int i; + int32_t i; memset ( &clip, 0, sizeof ( moveclip_t ) ); diff --git a/source/world.h b/source/world.h index eb36e5d..511e060 100644 --- a/source/world.h +++ b/source/world.h @@ -60,15 +60,15 @@ void SV_LinkEdict (edict_t *ent, bool touch_triggers); // sets ent->v.absmin and ent->v.absmax // if touchtriggers, calls prog functions for the intersected triggers -int SV_PointContents (vec3_t p); -int SV_TruePointContents (vec3_t p); +int32_t SV_PointContents (vec3_t p); +int32_t SV_TruePointContents (vec3_t p); // returns the CONTENTS_* value from the world at the given point. // does not check any entities at all // the non-true version remaps the water current contents to content_water edict_t *SV_TestEntityPosition (edict_t *ent); -trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict); +trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int32_t type, edict_t *passedict); // mins and maxs are reletive // if the entire move stays in a solid volume, trace.allsolid will be set @@ -81,7 +81,7 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, e // passedict is explicitly excluded from clipping checks (normally NULL) -bool SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace); +bool SV_RecursiveHullCheck (hull_t *hull, int32_t num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace); #endif /* _QUAKE_WORLD_H */ diff --git a/source/zone.c b/source/zone.c index ec0c860..4ef8497 100644 --- a/source/zone.c +++ b/source/zone.c @@ -30,22 +30,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct memblock_s { - int size; // including the header and possibly tiny fragments - int tag; // a tag of 0 is a free block - int id; // should be ZONEID - int pad; // pad to 64 bit boundary + int32_t size; // including the header and possibly tiny fragments + int32_t tag; // a tag of 0 is a free block + int32_t id; // should be ZONEID + int32_t pad; // pad to 64 bit boundary struct memblock_s *next, *prev; } memblock_t; typedef struct { - int size; // total bytes malloced, including header + int32_t size; // total bytes malloced, including header memblock_t blocklist; // start / end cap for linked list memblock_t *rover; } memzone_t; -void Cache_FreeLow (int new_low_hunk); -void Cache_FreeHigh (int new_high_hunk); +void Cache_FreeLow (int32_t new_low_hunk); +void Cache_FreeHigh (int32_t new_high_hunk); /* @@ -109,9 +109,9 @@ void Z_Free (void *ptr) } -static void *Z_TagMalloc (int size, int tag) +static void *Z_TagMalloc (int32_t size, int32_t tag) { - int extra; + int32_t extra; memblock_t *start, *rover, *newblock, *base; if (!tag) @@ -162,7 +162,7 @@ static void *Z_TagMalloc (int size, int tag) base->id = ZONEID; // marker for memory trash testing - *(int *)((byte *)base + base->size - 4) = ZONEID; + *(int32_t *)((byte *)base + base->size - 4) = ZONEID; return (void *) ((byte *)base + sizeof(memblock_t)); } @@ -195,7 +195,7 @@ static void Z_CheckHeap (void) Z_Malloc ======================== */ -void *Z_Malloc (int size) +void *Z_Malloc (int32_t size) { void *buf; @@ -213,9 +213,9 @@ void *Z_Malloc (int size) Z_Realloc ======================== */ -void *Z_Realloc(void *ptr, int size) +void *Z_Realloc(void *ptr, int32_t size) { - int old_size; + int32_t old_size; void *old_ptr; memblock_t *block; @@ -229,7 +229,7 @@ void *Z_Realloc(void *ptr, int size) Sys_Error ("Z_Realloc: realloced a freed pointer"); old_size = block->size; - old_size -= (4 + (int)sizeof(memblock_t)); /* see Z_TagMalloc() */ + old_size -= (4 + (int32_t)sizeof(memblock_t)); /* see Z_TagMalloc() */ old_ptr = ptr; Z_Free (ptr); @@ -289,19 +289,19 @@ void Z_Print (memzone_t *zone) #define HUNKNAME_LEN 24 typedef struct { - int sentinal; - int size; // including sizeof(hunk_t), -1 = not allocated + int32_t sentinal; + int32_t size; // including sizeof(hunk_t), -1 = not allocated char name[HUNKNAME_LEN]; } hunk_t; byte *hunk_base; -int hunk_size; +int32_t hunk_size; -int hunk_low_used; -int hunk_high_used; +int32_t hunk_low_used; +int32_t hunk_high_used; bool hunk_tempactive; -int hunk_tempmark; +int32_t hunk_tempmark; /* ============== @@ -318,7 +318,7 @@ void Hunk_Check (void) { if (h->sentinal != HUNK_SENTINAL) Sys_Error ("Hunk_Check: trahsed sentinal"); - if (h->size < (int) sizeof(hunk_t) || h->size + (byte *)h - hunk_base > hunk_size) + if (h->size < (int32_t) sizeof(hunk_t) || h->size + (byte *)h - hunk_base > hunk_size) Sys_Error ("Hunk_Check: bad size"); h = (hunk_t *)((byte *)h+h->size); } @@ -335,8 +335,8 @@ Otherwise, allocations with the same name will be totaled up before printing. void Hunk_Print (bool all) { hunk_t *h, *next, *endlow, *starthigh, *endhigh; - int count, sum; - int totalblocks; + int32_t count, sum; + int32_t totalblocks; char name[HUNKNAME_LEN]; count = 0; @@ -375,7 +375,7 @@ void Hunk_Print (bool all) // if (h->sentinal != HUNK_SENTINAL) Sys_Error ("Hunk_Check: trahsed sentinal"); - if (h->size < (int) sizeof(hunk_t) || h->size + (byte *)h - hunk_base > hunk_size) + if (h->size < (int32_t) sizeof(hunk_t) || h->size + (byte *)h - hunk_base > hunk_size) Sys_Error ("Hunk_Check: bad size"); next = (hunk_t *)((byte *)h+h->size); @@ -425,7 +425,7 @@ void Hunk_Print_f (void) Hunk_AllocName =================== */ -void *Hunk_AllocName (int size, const char *name) +void *Hunk_AllocName (int32_t size, const char *name) { hunk_t *h; @@ -460,17 +460,17 @@ void *Hunk_AllocName (int size, const char *name) Hunk_Alloc =================== */ -void *Hunk_Alloc (int size) +void *Hunk_Alloc (int32_t size) { return Hunk_AllocName (size, "unknown"); } -int Hunk_LowMark (void) +int32_t Hunk_LowMark (void) { return hunk_low_used; } -void Hunk_FreeToLowMark (int mark) +void Hunk_FreeToLowMark (int32_t mark) { if (mark < 0 || mark > hunk_low_used) Sys_Error ("Hunk_FreeToLowMark: bad mark %i", mark); @@ -478,7 +478,7 @@ void Hunk_FreeToLowMark (int mark) hunk_low_used = mark; } -int Hunk_HighMark (void) +int32_t Hunk_HighMark (void) { if (hunk_tempactive) { @@ -489,7 +489,7 @@ int Hunk_HighMark (void) return hunk_high_used; } -void Hunk_FreeToHighMark (int mark) +void Hunk_FreeToHighMark (int32_t mark) { if (hunk_tempactive) { @@ -508,7 +508,7 @@ void Hunk_FreeToHighMark (int mark) Hunk_HighAllocName =================== */ -void *Hunk_HighAllocName (int size, const char *name) +void *Hunk_HighAllocName (int32_t size, const char *name) { hunk_t *h; @@ -554,7 +554,7 @@ Hunk_TempAlloc Return space from the top of the hunk ================= */ -void *Hunk_TempAlloc (int size) +void *Hunk_TempAlloc (int32_t size) { void *buf; @@ -594,14 +594,14 @@ CACHE MEMORY #define CACHENAME_LEN 32 typedef struct cache_system_s { - int size; // including this header + int32_t size; // including this header cache_user_t *user; char name[CACHENAME_LEN]; struct cache_system_s *prev, *next; struct cache_system_s *lru_prev, *lru_next; // for LRU flushing } cache_system_t; -cache_system_t *Cache_TryAlloc (int size, bool nobottom); +cache_system_t *Cache_TryAlloc (int32_t size, bool nobottom); cache_system_t cache_head; @@ -641,7 +641,7 @@ Cache_FreeLow Throw things out until the hunk can be expanded to the given point ============ */ -void Cache_FreeLow (int new_low_hunk) +void Cache_FreeLow (int32_t new_low_hunk) { cache_system_t *c; @@ -663,7 +663,7 @@ Cache_FreeHigh Throw things out until the hunk can be expanded to the given point ============ */ -void Cache_FreeHigh (int new_high_hunk) +void Cache_FreeHigh (int32_t new_high_hunk) { cache_system_t *c, *prev; @@ -715,7 +715,7 @@ Looks for a free block of memory between the high and low hunk marks Size should already include the header and padding ============ */ -cache_system_t *Cache_TryAlloc (int size, bool nobottom) +cache_system_t *Cache_TryAlloc (int32_t size, bool nobottom) { cache_system_t *cs, *new_cs; @@ -901,7 +901,7 @@ void *Cache_Check (cache_user_t *c) Cache_Alloc ============== */ -void *Cache_Alloc (cache_user_t *c, int size, const char *name) +void *Cache_Alloc (cache_user_t *c, int32_t size, const char *name) { cache_system_t *cs; @@ -938,7 +938,7 @@ void *Cache_Alloc (cache_user_t *c, int size, const char *name) //============================================================================ -static void Memory_InitZone (memzone_t *zone, int size) +static void Memory_InitZone (memzone_t *zone, int32_t size) { memblock_t *block; @@ -962,10 +962,10 @@ static void Memory_InitZone (memzone_t *zone, int size) Memory_Init ======================== */ -void Memory_Init (void *buf, int size) +void Memory_Init (void *buf, int32_t size) { - int p; - int zonesize = DYNAMIC_SIZE; + int32_t p; + int32_t zonesize = DYNAMIC_SIZE; hunk_base = (byte *) buf; hunk_size = size; diff --git a/source/zone.h b/source/zone.h index e3da1cc..af2cce0 100644 --- a/source/zone.h +++ b/source/zone.h @@ -89,25 +89,25 @@ Zone block */ -void Memory_Init (void *buf, int size); +void Memory_Init (void *buf, int32_t size); void Z_Free (void *ptr); -void *Z_Malloc (int size); // returns 0 filled memory -void *Z_Realloc (void *ptr, int size); +void *Z_Malloc (int32_t size); // returns 0 filled memory +void *Z_Realloc (void *ptr, int32_t size); char *Z_Strdup (const char *s); -void *Hunk_Alloc (int size); // returns 0 filled memory -void *Hunk_AllocName (int size, const char *name); -void *Hunk_HighAllocName (int size, const char *name); +void *Hunk_Alloc (int32_t size); // returns 0 filled memory +void *Hunk_AllocName (int32_t size, const char *name); +void *Hunk_HighAllocName (int32_t size, const char *name); char *Hunk_Strdup (const char *s, const char *name); -int Hunk_LowMark (void); -void Hunk_FreeToLowMark (int mark); +int32_t Hunk_LowMark (void); +void Hunk_FreeToLowMark (int32_t mark); -int Hunk_HighMark (void); -void Hunk_FreeToHighMark (int mark); +int32_t Hunk_HighMark (void); +void Hunk_FreeToHighMark (int32_t mark); -void *Hunk_TempAlloc (int size); +void *Hunk_TempAlloc (int32_t size); void Hunk_Check (void); @@ -124,7 +124,7 @@ void *Cache_Check (cache_user_t *c); void Cache_Free (cache_user_t *c, bool freetextures); //johnfitz -- added second argument -void *Cache_Alloc (cache_user_t *c, int size, const char *name); +void *Cache_Alloc (cache_user_t *c, int32_t size, const char *name); // Returns NULL if all purgable data was tossed and there still // wasn't enough room.