dumb test

master
an 2019-11-25 19:49:58 -05:00
parent 33ea8d7496
commit 866148d531
125 changed files with 2670 additions and 2670 deletions

View File

@ -46,7 +46,7 @@ typedef struct music_handler_s
{ {
uint32_t type; /* 1U << n (see snd_codec.h) */ uint32_t type; /* 1U << n (see snd_codec.h) */
bgm_player_t player; /* Enumerated bgm player type */ 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 *ext; /* Expected file extension */
const char *dir; /* Where to look for music file */ const char *dir; /* Where to look for music file */
struct music_handler_s *next; struct music_handler_s *next;
@ -126,7 +126,7 @@ static void BGM_Stop_f (void)
bool BGM_Init (void) bool BGM_Init (void)
{ {
music_handler_t *handlers = NULL; music_handler_t *handlers = NULL;
int i; int32_t i;
Cvar_RegisterVariable(&bgm_extmusic); Cvar_RegisterVariable(&bgm_extmusic);
Cmd_AddCommand("music", BGM_Play_f); Cmd_AddCommand("music", BGM_Play_f);
@ -313,7 +313,7 @@ void BGM_PlayCDtrack (byte track, bool looping)
if (! CDRIPTYPE(handler->type)) if (! CDRIPTYPE(handler->type))
goto _next; goto _next;
q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s", 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)) if (! COM_FileExists(tmp, &path_id))
goto _next; goto _next;
if (path_id > prev_id) if (path_id > prev_id)
@ -326,11 +326,11 @@ void BGM_PlayCDtrack (byte track, bool looping)
handler = handler->next; handler = handler->next;
} }
if (ext == NULL) 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 else
{ {
q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s", 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); bgmstream = S_CodecOpenStreamType(tmp, type);
if (! bgmstream) if (! bgmstream)
Con_Printf("Couldn't handle music file %s\n", tmp); Con_Printf("Couldn't handle music file %s\n", tmp);
@ -372,10 +372,10 @@ void BGM_Resume (void)
static void BGM_UpdateStream (void) static void BGM_UpdateStream (void)
{ {
bool did_rewind = false; bool did_rewind = false;
int res; /* Number of bytes read. */ int32_t res; /* Number of bytes read. */
int bufferSamples; int32_t bufferSamples;
int fileSamples; int32_t fileSamples;
int fileBytes; int32_t fileBytes;
byte raw[16384]; byte raw[16384];
if (bgmstream->status != STREAM_PLAY) if (bgmstream->status != STREAM_PLAY)
@ -400,9 +400,9 @@ static void BGM_UpdateStream (void)
/* our max buffer size */ /* our max buffer size */
fileBytes = fileSamples * (bgmstream->info.width * bgmstream->info.channels); 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 / fileSamples = fileBytes /
(bgmstream->info.width * bgmstream->info.channels); (bgmstream->info.width * bgmstream->info.channels);
} }

View File

@ -70,7 +70,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef struct typedef struct
{ {
int fileofs, filelen; int32_t fileofs, filelen;
} lump_t; } lump_t;
#define LUMP_ENTITIES 0 #define LUMP_ENTITIES 0
@ -95,21 +95,21 @@ typedef struct
{ {
float mins[3], maxs[3]; float mins[3], maxs[3];
float origin[3]; float origin[3];
int headnode[MAX_MAP_HULLS]; int32_t headnode[MAX_MAP_HULLS];
int visleafs; // not including the solid leaf 0 int32_t visleafs; // not including the solid leaf 0
int firstface, numfaces; int32_t firstface, numfaces;
} dmodel_t; } dmodel_t;
typedef struct typedef struct
{ {
int version; int32_t version;
lump_t lumps[HEADER_LUMPS]; lump_t lumps[HEADER_LUMPS];
} dheader_t; } dheader_t;
typedef struct typedef struct
{ {
int nummiptex; int32_t nummiptex;
int dataofs[4]; // [nummiptex] int32_t dataofs[4]; // [nummiptex]
} dmiptexlump_t; } dmiptexlump_t;
#define MIPLEVELS 4 #define MIPLEVELS 4
@ -141,7 +141,7 @@ typedef struct
{ {
float normal[3]; float normal[3];
float dist; 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; } dplane_t;
@ -165,7 +165,7 @@ typedef struct
// !!! if this is changed, it must be changed in asm_i386.h too !!! // !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct typedef struct
{ {
int planenum; int32_t planenum;
int16_t children[2]; // negative numbers are -(leafs+1), not nodes int16_t children[2]; // negative numbers are -(leafs+1), not nodes
int16_t mins[3]; // for sphere culling int16_t mins[3]; // for sphere culling
int16_t maxs[3]; int16_t maxs[3];
@ -175,8 +175,8 @@ typedef struct
typedef struct typedef struct
{ {
int planenum; int32_t planenum;
int children[2]; // negative numbers are -(leafs+1), not nodes int32_t children[2]; // negative numbers are -(leafs+1), not nodes
int16_t mins[3]; // for sphere culling int16_t mins[3]; // for sphere culling
int16_t maxs[3]; int16_t maxs[3];
uint32_t firstface; uint32_t firstface;
@ -185,8 +185,8 @@ typedef struct
typedef struct typedef struct
{ {
int planenum; int32_t planenum;
int children[2]; // negative numbers are -(leafs+1), not nodes int32_t children[2]; // negative numbers are -(leafs+1), not nodes
float mins[3]; // for sphere culling float mins[3]; // for sphere culling
float maxs[3]; float maxs[3];
uint32_t firstface; uint32_t firstface;
@ -195,22 +195,22 @@ typedef struct
typedef struct typedef struct
{ {
int planenum; int32_t planenum;
int16_t children[2]; // negative numbers are contents int16_t children[2]; // negative numbers are contents
} dsclipnode_t; } dsclipnode_t;
typedef struct typedef struct
{ {
int planenum; int32_t planenum;
int children[2]; // negative numbers are contents int32_t children[2]; // negative numbers are contents
} dlclipnode_t; } dlclipnode_t;
typedef struct texinfo_s typedef struct texinfo_s
{ {
float vecs[2][4]; // [s/t][xyz offset] float vecs[2][4]; // [s/t][xyz offset]
int miptex; int32_t miptex;
int flags; int32_t flags;
} texinfo_t; } texinfo_t;
#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision #define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
#define TEX_MISSING 2 // johnfitz -- this texinfo does not have a texture #define TEX_MISSING 2 // johnfitz -- this texinfo does not have a texture
@ -233,27 +233,27 @@ typedef struct
int16_t planenum; int16_t planenum;
int16_t side; int16_t side;
int firstedge; // we must support > 64k edges int32_t firstedge; // we must support > 64k edges
int16_t numedges; int16_t numedges;
int16_t texinfo; int16_t texinfo;
// lighting info // lighting info
byte styles[MAXLIGHTMAPS]; byte styles[MAXLIGHTMAPS];
int lightofs; // start of [numstyles*surfsize] samples int32_t lightofs; // start of [numstyles*surfsize] samples
} dsface_t; } dsface_t;
typedef struct typedef struct
{ {
int planenum; int32_t planenum;
int side; int32_t side;
int firstedge; // we must support > 64k edges int32_t firstedge; // we must support > 64k edges
int numedges; int32_t numedges;
int texinfo; int32_t texinfo;
// lighting info // lighting info
byte styles[MAXLIGHTMAPS]; byte styles[MAXLIGHTMAPS];
int lightofs; // start of [numstyles*surfsize] samples int32_t lightofs; // start of [numstyles*surfsize] samples
} dlface_t; } dlface_t;
#define AMBIENT_WATER 0 #define AMBIENT_WATER 0
@ -267,8 +267,8 @@ typedef struct
// all other leafs need visibility info // all other leafs need visibility info
typedef struct typedef struct
{ {
int contents; int32_t contents;
int visofs; // -1 = no visibility info int32_t visofs; // -1 = no visibility info
int16_t mins[3]; // for frustum culling int16_t mins[3]; // for frustum culling
int16_t maxs[3]; int16_t maxs[3];
@ -281,8 +281,8 @@ typedef struct
typedef struct typedef struct
{ {
int contents; int32_t contents;
int visofs; // -1 = no visibility info int32_t visofs; // -1 = no visibility info
int16_t mins[3]; // for frustum culling int16_t mins[3]; // for frustum culling
int16_t maxs[3]; int16_t maxs[3];
@ -295,8 +295,8 @@ typedef struct
typedef struct typedef struct
{ {
int contents; int32_t contents;
int visofs; // -1 = no visibility info int32_t visofs; // -1 = no visibility info
float mins[3]; // for frustum culling float mins[3]; // for frustum culling
float maxs[3]; float maxs[3];

View File

@ -20,7 +20,7 @@
#include "quakedef.h" #include "quakedef.h"
int CDAudio_Play(byte track, bool looping) int32_t CDAudio_Play(byte track, bool looping)
{ {
(void)track, (void)looping; (void)track, (void)looping;
return -1; 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"); Con_Printf("CDAudio disabled at compile time\n");
return -1; return -1;

View File

@ -43,7 +43,7 @@ static byte remap[100];
static byte playTrack; static byte playTrack;
static double endOfTrack = -1.0, pausetime = -1.0; static double endOfTrack = -1.0, pausetime = -1.0;
static SDL_CD *cd_handle; static SDL_CD *cd_handle;
static int cd_dev = -1; static int32_t cd_dev = -1;
static float old_cdvolume; static float old_cdvolume;
static bool hw_vol_works = true; 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 ()); Con_Printf ("Unable to eject CD-ROM: %s\n", SDL_GetError ());
} }
static int CDAudio_GetAudioDiskInfo(void) static int32_t CDAudio_GetAudioDiskInfo(void)
{ {
cdValid = false; cdValid = false;
@ -75,9 +75,9 @@ static int CDAudio_GetAudioDiskInfo(void)
return 0; 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) if (!cd_handle || !enabled)
return -1; return -1;
@ -198,9 +198,9 @@ void CDAudio_Resume(void)
pausetime = -1.0; 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) for (i = 0; i < cd_handle->numtracks; ++i)
if (cd_handle->track[i].type != SDL_DATA_TRACK) if (cd_handle->track[i].type != SDL_DATA_TRACK)
return ++i; return ++i;
@ -210,7 +210,7 @@ static int get_first_audiotrk (void)
static void CD_f (void) static void CD_f (void)
{ {
const char *command; const char *command;
int ret, n; int32_t ret, n;
if (Cmd_Argc() < 2) if (Cmd_Argc() < 2)
{ {
@ -317,8 +317,8 @@ static void CD_f (void)
if (q_strcasecmp(command, "info") == 0) if (q_strcasecmp(command, "info") == 0)
{ {
int current_min, current_sec, current_frame; int32_t current_min, current_sec, current_frame;
int length_min, length_sec, length_frame; int32_t length_min, length_sec, length_frame;
Con_Printf ("%u tracks\n", cd_handle->numtracks); 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. /* Bad ugly hack to workaround SDL's cdrom device detection.
* not needed for windows due to the way SDL_cdrom works. */ * not needed for windows due to the way SDL_cdrom works. */
#if !defined(_WIN32) #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') if (i != 0 && i < com_argc - 1 && com_argv[i+1][0] != '\0')
{ {
static char arg[64]; static char arg[64];
@ -486,9 +486,9 @@ static void export_cddev_arg (void)
#endif #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")) if (safemode || COM_CheckParm("-nocdaudio"))
return -1; return -1;

View File

@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __CDAUDIO_H #ifndef __CDAUDIO_H
#define __CDAUDIO_H #define __CDAUDIO_H
int CDAudio_Init (void); int32_t CDAudio_Init (void);
int CDAudio_Play (byte track, bool looping); int32_t CDAudio_Play (byte track, bool looping);
/* returns 0 for success, -1 for failure. */ /* returns 0 for success, -1 for failure. */
void CDAudio_Stop (void); void CDAudio_Stop (void);
void CDAudio_Pause (void); void CDAudio_Pause (void);

View File

@ -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. 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; char buff[1024], *tmp;
int i, j; int32_t i, j;
if (!cfg_file || num_vars < 1) if (!cfg_file || num_vars < 1)
return; return;
@ -118,10 +118,10 @@ values of cvars in the given list. doesn't do anything with
the config file. 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]; char buff[64];
int i, j; int32_t i, j;
if (num_vars < 1) if (num_vars < 1)
return; 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; FILE *f;
long length; long length;

View File

@ -22,18 +22,18 @@
#ifndef __CFGFILE_H #ifndef __CFGFILE_H
#define __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 // opens the given config file. only one open config file is
// kept: previosly opened one, if any, will be closed. // kept: previosly opened one, if any, will be closed.
void CFG_CloseConfig (void); void CFG_CloseConfig (void);
// closes the currently open config file. // 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 // reads the values of cvars in the given list from the opened
// config file. // 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 // convenience function, reading the "+" command line override
// values of cvars in the given list. doesn't do anything with // values of cvars in the given list. doesn't do anything with
// the config file. call this after CFG_ReadCvars() and before // the config file. call this after CFG_ReadCvars() and before

View File

@ -83,7 +83,7 @@ TODO: stay at least 8 units away from all walls in this leaf
*/ */
void Chase_UpdateForDrawing (void) void Chase_UpdateForDrawing (void)
{ {
int i; int32_t i;
vec3_t forward, up, right; vec3_t forward, up, right;
vec3_t ideal, crosshair, temp; vec3_t ideal, crosshair, temp;

View File

@ -38,7 +38,7 @@ read from the demo file.
// from ProQuake: space to fill out the demo header for record at any time // from ProQuake: space to fill out the demo header for record at any time
static byte demo_head[3][MAX_MSGLEN]; 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) static void CL_WriteDemoMessage (void)
{ {
int len; int32_t len;
int i; int32_t i;
float f; float f;
len = LittleLong (net_message.cursize); len = LittleLong (net_message.cursize);
@ -86,9 +86,9 @@ static void CL_WriteDemoMessage (void)
fflush (cls.demofile); fflush (cls.demofile);
} }
static int CL_GetDemoMessage (void) static int32_t CL_GetDemoMessage (void)
{ {
int r, i; int32_t r, i;
float f; float f;
if (cls.demopaused) if (cls.demopaused)
@ -142,9 +142,9 @@ CL_GetMessage
Handles recording and playback of demos, on top of NET_ code 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) if (cls.demoplayback)
return CL_GetDemoMessage (); return CL_GetDemoMessage ();
@ -220,9 +220,9 @@ record <demoname> <map> [cd track]
*/ */
void CL_Record_f (void) void CL_Record_f (void)
{ {
int c; int32_t c;
char name[MAX_OSPATH]; char name[MAX_OSPATH];
int track; int32_t track;
if (cmd_source != src_command) if (cmd_source != src_command)
return; return;
@ -303,8 +303,8 @@ void CL_Record_f (void)
if (c == 2 && cls.state == ca_connected) if (c == 2 && cls.state == ca_connected)
{ {
byte *data = net_message.data; byte *data = net_message.data;
int cursize = net_message.cursize; int32_t cursize = net_message.cursize;
int i; int32_t i;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
@ -382,7 +382,7 @@ play [demoname]
void CL_PlayDemo_f (void) void CL_PlayDemo_f (void)
{ {
char name[MAX_OSPATH]; char name[MAX_OSPATH];
int i, c; int32_t i, c;
bool neg; bool neg;
if (cmd_source != src_command) if (cmd_source != src_command)
@ -459,7 +459,7 @@ CL_FinishTimeDemo
*/ */
static void CL_FinishTimeDemo (void) static void CL_FinishTimeDemo (void)
{ {
int frames; int32_t frames;
float time; float time;
cls.timedemo = false; cls.timedemo = false;

View File

@ -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_strafe, in_speed, in_use, in_jump, in_attack;
kbutton_t in_up, in_down; kbutton_t in_up, in_down;
int in_impulse; int32_t in_impulse;
void KeyDown (kbutton_t *b) void KeyDown (kbutton_t *b)
{ {
int k; int32_t k;
const char *c; const char *c;
c = Cmd_Argv(1); c = Cmd_Argv(1);
@ -91,7 +91,7 @@ void KeyDown (kbutton_t *b)
void KeyUp (kbutton_t *b) void KeyUp (kbutton_t *b)
{ {
int k; int32_t k;
const char *c; const char *c;
c = Cmd_Argv(1); c = Cmd_Argv(1);
@ -339,8 +339,8 @@ CL_SendMove
*/ */
void CL_SendMove (const usercmd_t *cmd) void CL_SendMove (const usercmd_t *cmd)
{ {
int i; int32_t i;
int bits; int32_t bits;
sizebuf_t buf; sizebuf_t buf;
byte data[128]; byte data[128];

View File

@ -56,9 +56,9 @@ lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
dlight_t cl_dlights[MAX_DLIGHTS]; dlight_t cl_dlights[MAX_DLIGHTS];
entity_t *cl_entities; //johnfitz -- was a static array, now on hunk 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]; entity_t *cl_visedicts[MAX_VISEDICTS];
extern cvar_t r_lerpmodels, r_lerpmove; //johnfitz extern cvar_t r_lerpmodels, r_lerpmove; //johnfitz
@ -86,7 +86,7 @@ void CL_ClearState (void)
memset (cl_beams, 0, sizeof(cl_beams)); memset (cl_beams, 0, sizeof(cl_beams));
//johnfitz -- cl_entities is now dynamically allocated //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"); cl_entities = (entity_t *) Hunk_AllocName (cl_max_edicts*sizeof(entity_t), "cl_entities");
//johnfitz //johnfitz
} }
@ -195,7 +195,7 @@ void CL_SignonReply (void)
MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string)); MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
MSG_WriteByte (&cls.message, clc_stringcmd); 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); MSG_WriteByte (&cls.message, clc_stringcmd);
sprintf (str, "spawn %s", cls.spawnparms); sprintf (str, "spawn %s", cls.spawnparms);
@ -255,7 +255,7 @@ CL_PrintEntities_f
void CL_PrintEntities_f (void) void CL_PrintEntities_f (void)
{ {
entity_t *ent; entity_t *ent;
int i; int32_t i;
if (cls.state != ca_connected) if (cls.state != ca_connected)
return; 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; dlight_t *dl;
// first look for an exact key match // first look for an exact key match
@ -329,7 +329,7 @@ CL_DecayLights
*/ */
void CL_DecayLights (void) void CL_DecayLights (void)
{ {
int i; int32_t i;
dlight_t *dl; dlight_t *dl;
float time; float time;
@ -405,7 +405,7 @@ CL_RelinkEntities
void CL_RelinkEntities (void) void CL_RelinkEntities (void)
{ {
entity_t *ent; entity_t *ent;
int i, j; int32_t i, j;
float frac, f, d; float frac, f, d;
vec3_t delta; vec3_t delta;
float bobjrotate; float bobjrotate;
@ -590,15 +590,15 @@ CL_ReadFromServer
Read all incoming data from the server Read all incoming data from the server
=============== ===============
*/ */
int CL_ReadFromServer (void) int32_t CL_ReadFromServer (void)
{ {
int ret; int32_t ret;
extern int num_temp_entities; //johnfitz extern int32_t num_temp_entities; //johnfitz
int num_beams = 0; //johnfitz int32_t num_beams = 0; //johnfitz
int num_dlights = 0; //johnfitz int32_t num_dlights = 0; //johnfitz
beam_t *b; //johnfitz beam_t *b; //johnfitz
dlight_t *l; //johnfitz dlight_t *l; //johnfitz
int i; //johnfitz int32_t i; //johnfitz
cl.oldtime = cl.time; cl.oldtime = cl.time;
@ -728,7 +728,7 @@ void CL_Tracepos_f (void)
if (VectorLength(w) == 0) if (VectorLength(w) == 0)
Con_Printf ("Tracepos: trace didn't hit anything\n"); Con_Printf ("Tracepos: trace didn't hit anything\n");
else 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 #if 0
//camera position //camera position
Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n", Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n",
(int)r_refdef.vieworg[0], (int32_t)r_refdef.vieworg[0],
(int)r_refdef.vieworg[1], (int32_t)r_refdef.vieworg[1],
(int)r_refdef.vieworg[2], (int32_t)r_refdef.vieworg[2],
(int)r_refdef.viewangles[PITCH], (int32_t)r_refdef.viewangles[PITCH],
(int)r_refdef.viewangles[YAW], (int32_t)r_refdef.viewangles[YAW],
(int)r_refdef.viewangles[ROLL]); (int32_t)r_refdef.viewangles[ROLL]);
#else #else
//player position //player position
Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n", Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n",
(int)cl_entities[cl.viewentity].origin[0], (int32_t)cl_entities[cl.viewentity].origin[0],
(int)cl_entities[cl.viewentity].origin[1], (int32_t)cl_entities[cl.viewentity].origin[1],
(int)cl_entities[cl.viewentity].origin[2], (int32_t)cl_entities[cl.viewentity].origin[2],
(int)cl.viewangles[PITCH], (int32_t)cl.viewangles[PITCH],
(int)cl.viewangles[YAW], (int32_t)cl.viewangles[YAW],
(int)cl.viewangles[ROLL]); (int32_t)cl.viewangles[ROLL]);
#endif #endif
} }

View File

@ -102,7 +102,7 @@ CL_EntityNum
This error checks and tracks the total number of entities 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 //johnfitz -- check minimum number too
if (num < 0) if (num < 0)
@ -133,12 +133,12 @@ CL_ParseStartSoundPacket
void CL_ParseStartSoundPacket(void) void CL_ParseStartSoundPacket(void)
{ {
vec3_t pos; vec3_t pos;
int channel, ent; int32_t channel, ent;
int sound_num; int32_t sound_num;
int volume; int32_t volume;
int field_mask; int32_t field_mask;
float attenuation; float attenuation;
int i; int32_t i;
field_mask = MSG_ReadByte(); field_mask = MSG_ReadByte();
@ -198,7 +198,7 @@ void CL_KeepaliveMessage (void)
{ {
float time; float time;
static float lastmsg; static float lastmsg;
int ret; int32_t ret;
sizebuf_t old; sizebuf_t old;
byte *olddata; byte *olddata;
@ -256,8 +256,8 @@ CL_ParseServerInfo
void CL_ParseServerInfo (void) void CL_ParseServerInfo (void)
{ {
const char *str; const char *str;
int i; int32_t i;
int nummodels, numsounds; int32_t nummodels, numsounds;
char model_precache[MAX_MODELS][MAX_QPATH]; char model_precache[MAX_MODELS][MAX_QPATH];
char sound_precache[MAX_SOUNDS][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. 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; qmodel_t *model;
int modnum; int32_t modnum;
bool forcelink; bool forcelink;
entity_t *ent; entity_t *ent;
int num; int32_t num;
int skin; int32_t skin;
if (cls.signon == SIGNONS - 1) if (cls.signon == SIGNONS - 1)
{ // first update is the final signon stage { // first update is the final signon stage
@ -635,10 +635,10 @@ void CL_ParseUpdate (int bits)
CL_ParseBaseline 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; int32_t i;
int bits; //johnfitz int32_t bits; //johnfitz
//johnfitz -- PROTOCOL_FITZQUAKE //johnfitz -- PROTOCOL_FITZQUAKE
bits = (version == 2) ? MSG_ReadByte() : 0; bits = (version == 2) ? MSG_ReadByte() : 0;
@ -667,8 +667,8 @@ Server information pertaining to this client only
*/ */
void CL_ParseClientdata (void) void CL_ParseClientdata (void)
{ {
int i, j; int32_t i, j;
int bits; //johnfitz int32_t bits; //johnfitz
bits = (uint16_t)MSG_ReadShort (); //johnfitz -- read bits here isntead of in CL_ParseServerMessage() bits = (uint16_t)MSG_ReadShort (); //johnfitz -- read bits here isntead of in CL_ParseServerMessage()
@ -831,10 +831,10 @@ void CL_ParseClientdata (void)
CL_NewTranslation CL_NewTranslation
===================== =====================
*/ */
void CL_NewTranslation (int slot) void CL_NewTranslation (int32_t slot)
{ {
int i, j; int32_t i, j;
int top, bottom; int32_t top, bottom;
byte *dest, *source; byte *dest, *source;
if (slot > cl.maxclients) if (slot > cl.maxclients)
@ -871,10 +871,10 @@ void CL_NewTranslation (int slot)
CL_ParseStatic CL_ParseStatic
===================== =====================
*/ */
void CL_ParseStatic (int version) //johnfitz -- added a parameter void CL_ParseStatic (int32_t version) //johnfitz -- added a parameter
{ {
entity_t *ent; entity_t *ent;
int i; int32_t i;
i = cl.num_statics; i = cl.num_statics;
if (i >= MAX_STATIC_ENTITIES) if (i >= MAX_STATIC_ENTITIES)
@ -905,11 +905,11 @@ void CL_ParseStatic (int version) //johnfitz -- added a parameter
CL_ParseStaticSound CL_ParseStaticSound
=================== ===================
*/ */
void CL_ParseStaticSound (int version) //johnfitz -- added argument void CL_ParseStaticSound (int32_t version) //johnfitz -- added argument
{ {
vec3_t org; vec3_t org;
int sound_num, vol, atten; int32_t sound_num, vol, atten;
int i; int32_t i;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
org[i] = MSG_ReadCoord (cl.protocolflags); org[i] = MSG_ReadCoord (cl.protocolflags);
@ -937,10 +937,10 @@ CL_ParseServerMessage
*/ */
void CL_ParseServerMessage (void) void CL_ParseServerMessage (void)
{ {
int cmd; int32_t cmd;
int i; int32_t i;
const char *str; //johnfitz const char *str; //johnfitz
int total, j, lastcmd; //johnfitz int32_t total, j, lastcmd; //johnfitz
// //
// if recording demos, copy the message out // if recording demos, copy the message out

View File

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
int num_temp_entities; int32_t num_temp_entities;
entity_t cl_temp_entities[MAX_TEMP_ENTITIES]; entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
beam_t cl_beams[MAX_BEAMS]; beam_t cl_beams[MAX_BEAMS];
@ -58,10 +58,10 @@ CL_ParseBeam
*/ */
void CL_ParseBeam (qmodel_t *m) void CL_ParseBeam (qmodel_t *m)
{ {
int ent; int32_t ent;
vec3_t start, end; vec3_t start, end;
beam_t *b; beam_t *b;
int i; int32_t i;
ent = MSG_ReadShort (); ent = MSG_ReadShort ();
@ -115,11 +115,11 @@ CL_ParseTEnt
*/ */
void CL_ParseTEnt (void) void CL_ParseTEnt (void)
{ {
int type; int32_t type;
vec3_t pos; vec3_t pos;
dlight_t *dl; dlight_t *dl;
int rnd; int32_t rnd;
int colorStart, colorLength; int32_t colorStart, colorLength;
type = MSG_ReadByte (); type = MSG_ReadByte ();
switch (type) switch (type)
@ -291,7 +291,7 @@ CL_UpdateTEnts
*/ */
void CL_UpdateTEnts (void) 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; beam_t *b;
vec3_t dist, org; vec3_t dist, org;
float d; float d;
@ -301,7 +301,7 @@ void CL_UpdateTEnts (void)
num_temp_entities = 0; 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 // update lightning
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++) for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
@ -328,12 +328,12 @@ void CL_UpdateTEnts (void)
} }
else 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) if (yaw < 0)
yaw += 360; yaw += 360;
forward = sqrt (dist[0]*dist[0] + dist[1]*dist[1]); 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) if (pitch < 0)
pitch += 360; pitch += 360;
} }

View File

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef struct typedef struct
{ {
int length; int32_t length;
char map[MAX_STYLESTRING]; char map[MAX_STYLESTRING];
char average; //johnfitz char average; //johnfitz
char peak; //johnfitz char peak; //johnfitz
@ -37,15 +37,15 @@ typedef struct
{ {
char name[MAX_SCOREBOARDNAME]; char name[MAX_SCOREBOARDNAME];
float entertime; float entertime;
int frags; int32_t frags;
int colors; // two 4 bit fields int32_t colors; // two 4 bit fields
byte translations[VID_GRADES*256]; byte translations[VID_GRADES*256];
} scoreboard_t; } scoreboard_t;
typedef struct typedef struct
{ {
int destcolor[3]; int32_t destcolor[3];
int percent; // 0-256 int32_t percent; // 0-256
} cshift_t; } cshift_t;
#define CSHIFT_CONTENTS 0 #define CSHIFT_CONTENTS 0
@ -71,7 +71,7 @@ typedef struct
float die; // stop lighting after this time float die; // stop lighting after this time
float decay; // drop this each second float decay; // drop this each second
float minlight; // don't add when contributing less float minlight; // don't add when contributing less
int key; int32_t key;
vec3_t color; //johnfitz -- lit support via lordhavoc vec3_t color; //johnfitz -- lit support via lordhavoc
} dlight_t; } dlight_t;
@ -79,7 +79,7 @@ typedef struct
#define MAX_BEAMS 32 //johnfitz -- was 24 #define MAX_BEAMS 32 //johnfitz -- was 24
typedef struct typedef struct
{ {
int entity; int32_t entity;
struct qmodel_s *model; struct qmodel_s *model;
float endtime; float endtime;
vec3_t start, end; vec3_t start, end;
@ -107,7 +107,7 @@ typedef struct
char spawnparms[MAX_MAPSTRING]; // to restart a level char spawnparms[MAX_MAPSTRING]; // to restart a level
// demo loop control // 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 char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
// demo recording info must be here, because record is started before // demo recording info must be here, because record is started before
@ -120,14 +120,14 @@ typedef struct
bool demopaused; bool demopaused;
bool timedemo; bool timedemo;
int forcetrack; // -1 = use normal cd track int32_t forcetrack; // -1 = use normal cd track
FILE *demofile; FILE *demofile;
int td_lastframe; // to meter out one message a frame int32_t td_lastframe; // to meter out one message a frame
int td_startframe; // host_framecount at start int32_t td_startframe; // host_framecount at start
float td_starttime; // realtime at second frame of timedemo float td_starttime; // realtime at second frame of timedemo
// connection information // connection information
int signon; // 0 to SIGNONS int32_t signon; // 0 to SIGNONS
struct qsocket_s *netcon; struct qsocket_s *netcon;
sizebuf_t message; // writing buffer to send to server sizebuf_t message; // writing buffer to send to server
@ -141,15 +141,15 @@ extern client_static_t cls;
// //
typedef struct 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 // throw out the first couple, so the player
// doesn't accidentally do something the // doesn't accidentally do something the
// first frame // first frame
usercmd_t cmd; // last command sent to the server usercmd_t cmd; // last command sent to the server
// information for local display // information for local display
int stats[MAX_CL_STATS]; // health, etc int32_t stats[MAX_CL_STATS]; // health, etc
int items; // inventory bit flags int32_t items; // inventory bit flags
float item_gettime[32]; // cl.time of aquiring item, for blinking float item_gettime[32]; // cl.time of aquiring item, for blinking
float faceanimtime; // use anim frame if cl.time < this float faceanimtime; // use anim frame if cl.time < this
@ -184,8 +184,8 @@ typedef struct
bool onground; bool onground;
bool inwater; bool inwater;
int intermission; // don't change view angle, full screen, etc int32_t intermission; // don't change view angle, full screen, etc
int completed_time; // latched at intermission start int32_t completed_time; // latched at intermission start
double mtime[2]; // the timestamp of last two messages double mtime[2]; // the timestamp of last two messages
double time; // clients view of time, should be between double time; // clients view of time, should be between
@ -205,19 +205,19 @@ typedef struct
char mapname[128]; char mapname[128];
char levelname[128]; // for display on solo scoreboard //johnfitz -- was 40. char levelname[128]; // for display on solo scoreboard //johnfitz -- was 40.
int viewentity; // cl_entitites[cl.viewentity] = player int32_t viewentity; // cl_entitites[cl.viewentity] = player
int maxclients; int32_t maxclients;
int gametype; int32_t gametype;
// refresh related state // refresh related state
struct qmodel_s *worldmodel; // cl_entitites[0].model struct qmodel_s *worldmodel; // cl_entitites[0].model
struct efrag_s *free_efrags; struct efrag_s *free_efrags;
int num_efrags; int32_t num_efrags;
int num_entities; // held in cl_entities array int32_t num_entities; // held in cl_entities array
int num_statics; // held in cl_staticentities array int32_t num_statics; // held in cl_staticentities array
entity_t viewent; // the gun model entity_t viewent; // the gun model
int cdtrack, looptrack; // cd audio int32_t cdtrack, looptrack; // cd audio
// frag scoreboard // frag scoreboard
scoreboard_t *scores; // [cl.maxclients] 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 entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
extern beam_t cl_beams[MAX_BEAMS]; extern beam_t cl_beams[MAX_BEAMS];
extern entity_t *cl_visedicts[MAX_VISEDICTS]; 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 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 // cl_main
// //
dlight_t *CL_AllocDlight (int key); dlight_t *CL_AllocDlight (int32_t key);
void CL_DecayLights (void); void CL_DecayLights (void);
void CL_Init (void); void CL_Init (void);
@ -308,8 +308,8 @@ void CL_NextDemo (void);
// //
typedef struct typedef struct
{ {
int down[2]; // key nums holding it down int32_t down[2]; // key nums holding it down
int state; // low bit is down state int32_t state; // low bit is down state
} kbutton_t; } kbutton_t;
extern kbutton_t in_mlook, in_klook; extern kbutton_t in_mlook, in_klook;
@ -319,7 +319,7 @@ extern kbutton_t in_speed;
void CL_InitInput (void); void CL_InitInput (void);
void CL_SendCmd (void); void CL_SendCmd (void);
void CL_SendMove (const usercmd_t *cmd); void CL_SendMove (const usercmd_t *cmd);
int CL_ReadFromServer (void); int32_t CL_ReadFromServer (void);
void CL_BaseMove (usercmd_t *cmd); void CL_BaseMove (usercmd_t *cmd);
void CL_ParseTEnt (void); void CL_ParseTEnt (void);
@ -331,7 +331,7 @@ void CL_ClearState (void);
// cl_demo.c // cl_demo.c
// //
void CL_StopPlayback (void); void CL_StopPlayback (void);
int CL_GetMessage (void); int32_t CL_GetMessage (void);
void CL_Stop_f (void); void CL_Stop_f (void);
void CL_Record_f (void); void CL_Record_f (void);
@ -342,7 +342,7 @@ void CL_TimeDemo_f (void);
// cl_parse.c // cl_parse.c
// //
void CL_ParseServerMessage (void); void CL_ParseServerMessage (void);
void CL_NewTranslation (int slot); void CL_NewTranslation (int32_t slot);
// //
// view // view
@ -354,7 +354,7 @@ void V_RenderView (void);
//void V_UpdatePalette (void); //johnfitz //void V_UpdatePalette (void); //johnfitz
void V_Register (void); void V_Register (void);
void V_ParseDamage (void); void V_ParseDamage (void);
void V_SetContentsColor (int contents); void V_SetContentsColor (int32_t contents);
// //
// cl_tent // cl_tent

View File

@ -87,7 +87,7 @@ Adds command text at the end of the buffer
*/ */
void Cbuf_AddText (const char *text) void Cbuf_AddText (const char *text)
{ {
int l; int32_t l;
l = Q_strlen (text); l = Q_strlen (text);
@ -113,7 +113,7 @@ FIXME: actually change the command buffer to do less copying
void Cbuf_InsertText (const char *text) void Cbuf_InsertText (const char *text)
{ {
char *temp; char *temp;
int templen; int32_t templen;
// copy off any commands still remaining in the exec buffer // copy off any commands still remaining in the exec buffer
templen = cmd_text.cursize; templen = cmd_text.cursize;
@ -144,10 +144,10 @@ Cbuf_Execute
*/ */
void Cbuf_Execute (void) void Cbuf_Execute (void)
{ {
int i; int32_t i;
char *text; char *text;
char line[1024]; char line[1024];
int quotes; int32_t quotes;
while (cmd_text.cursize) while (cmd_text.cursize)
{ {
@ -165,7 +165,7 @@ void Cbuf_Execute (void)
break; break;
} }
if (i > (int)sizeof(line) - 1) if (i > (int32_t)sizeof(line) - 1)
{ {
memcpy (line, text, sizeof(line) - 1); memcpy (line, text, sizeof(line) - 1);
line[sizeof(line) - 1] = 0; line[sizeof(line) - 1] = 0;
@ -223,7 +223,7 @@ void Cmd_StuffCmds_f (void)
{ {
extern cvar_t cmdline; extern cvar_t cmdline;
char cmds[CMDLINE_LENGTH]; char cmds[CMDLINE_LENGTH];
int i, j, plus; int32_t i, j, plus;
plus = false; // On Unix, argv[0] is command name plus = false; // On Unix, argv[0] is command name
@ -258,7 +258,7 @@ Cmd_Exec_f
void Cmd_Exec_f (void) void Cmd_Exec_f (void)
{ {
char *f; char *f;
int mark; int32_t mark;
if (Cmd_Argc () != 2) if (Cmd_Argc () != 2)
{ {
@ -289,7 +289,7 @@ Just prints the rest of the line to the console
*/ */
void Cmd_Echo_f (void) void Cmd_Echo_f (void)
{ {
int i; int32_t i;
for (i=1 ; i<Cmd_Argc() ; i++) for (i=1 ; i<Cmd_Argc() ; i++)
Con_Printf ("%s ",Cmd_Argv(i)); Con_Printf ("%s ",Cmd_Argv(i));
@ -307,7 +307,7 @@ void Cmd_Alias_f (void)
{ {
cmdalias_t *a; cmdalias_t *a;
char cmd[1024]; char cmd[1024];
int i, c; int32_t i, c;
const char *s; const char *s;
@ -446,7 +446,7 @@ typedef struct cmd_function_s
#define MAX_ARGS 80 #define MAX_ARGS 80
static int cmd_argc; static int32_t cmd_argc;
static char *cmd_argv[MAX_ARGS]; static char *cmd_argv[MAX_ARGS];
static char cmd_null_string[] = ""; static char cmd_null_string[] = "";
static const char *cmd_args = NULL; static const char *cmd_args = NULL;
@ -467,7 +467,7 @@ void Cmd_List_f (void)
{ {
cmd_function_t *cmd; cmd_function_t *cmd;
const char *partial; const char *partial;
int len, count; int32_t len, count;
if (Cmd_Argc() > 1) if (Cmd_Argc() > 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) static char *Cmd_TintSubstring(const char *in, const char *substr, char *out, size_t outsize)
{ {
int l; int32_t l;
char *m; char *m;
q_strlcpy(out, in, outsize); q_strlcpy(out, in, outsize);
while ((m = q_strcasestr(out, substr))) 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) void Cmd_Apropos_f(void)
{ {
char tmpbuf[256]; char tmpbuf[256];
int hits = 0; int32_t hits = 0;
cmd_function_t *cmd; cmd_function_t *cmd;
cvar_t *var; cvar_t *var;
const char *substr = Cmd_Argv (1); const char *substr = Cmd_Argv (1);
@ -582,7 +582,7 @@ void Cmd_Init (void)
Cmd_Argc Cmd_Argc
============ ============
*/ */
int Cmd_Argc (void) int32_t Cmd_Argc (void)
{ {
return cmd_argc; return cmd_argc;
} }
@ -592,7 +592,7 @@ int Cmd_Argc (void)
Cmd_Argv Cmd_Argv
============ ============
*/ */
const char *Cmd_Argv (int arg) const char *Cmd_Argv (int32_t arg)
{ {
if (arg < 0 || arg >= cmd_argc) if (arg < 0 || arg >= cmd_argc)
return cmd_null_string; return cmd_null_string;
@ -619,7 +619,7 @@ Parses the given string into command line tokens.
*/ */
void Cmd_TokenizeString (const char *text) void Cmd_TokenizeString (const char *text)
{ {
int i; int32_t i;
// clear the args from the last string // clear the args from the last string
for (i=0 ; i<cmd_argc ; i++) for (i=0 ; i<cmd_argc ; i++)
@ -744,7 +744,7 @@ Cmd_CompleteCommand
const char *Cmd_CompleteCommand (const char *partial) const char *Cmd_CompleteCommand (const char *partial)
{ {
cmd_function_t *cmd; cmd_function_t *cmd;
int len; int32_t len;
len = Q_strlen(partial); len = Q_strlen(partial);
@ -846,9 +846,9 @@ where the given parameter apears, or 0 if not present
================ ================
*/ */
int Cmd_CheckParm (const char *parm) int32_t Cmd_CheckParm (const char *parm)
{ {
int i; int32_t i;
if (!parm) if (!parm)
Sys_Error ("Cmd_CheckParm: NULL"); Sys_Error ("Cmd_CheckParm: NULL");

View File

@ -95,14 +95,14 @@ const char *Cmd_CompleteCommand (const char *partial);
// attempts to match a partial command for automatic command line completion // attempts to match a partial command for automatic command line completion
// returns NULL if nothing fits // returns NULL if nothing fits
int Cmd_Argc (void); int32_t Cmd_Argc (void);
const char *Cmd_Argv (int arg); const char *Cmd_Argv (int32_t arg);
const char *Cmd_Args (void); const char *Cmd_Args (void);
// The functions that execute commands get their parameters with these // The functions that execute commands get their parameters with these
// functions. Cmd_Argv () will return an empty string, not a NULL // functions. Cmd_Argv () will return an empty string, not a NULL
// if arg > argc, so string operations are allways safe. // if arg > 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 // Returns the position (1 to argc-1) in the command's argument list
// where the given parameter apears, or 0 if not present // where the given parameter apears, or 0 if not present

View File

@ -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 *largv[MAX_NUM_ARGVS + 1];
static char argvdummy[] = " "; static char argvdummy[] = " ";
int safemode; int32_t safemode;
cvar_t registered = {"registered","1",CVAR_ROM}; /* set to correct value in COM_CheckRegistered() */ 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 */ 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 */ #define PAK0_CRC_V091 28804 /* id1/pak0.pak - v0.91/0.92, not supported */
char com_token[1024]; char com_token[1024];
int com_argc; int32_t com_argc;
char **com_argv; char **com_argv;
#define CMDLINE_LENGTH 256 /* johnfitz -- mirrored in cmd.c */ #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 * p1 = s1;
const char * p2 = s2; const char * p2 = s2;
@ -167,10 +167,10 @@ int q_strcasecmp(const char * s1, const char * s2)
break; break;
} while (c1 == c2); } 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 * p1 = s1;
const char * p2 = s2; const char * p2 = s2;
@ -187,14 +187,14 @@ int q_strncasecmp(const char *s1, const char *s2, size_t n)
break; break;
} while (--n > 0); } while (--n > 0);
return (int)(c1 - c2); return (int32_t)(c1 - c2);
} }
//spike -- grabbed this from fte, because its useful to me //spike -- grabbed this from fte, because its useful to me
char *q_strcasestr(const char *haystack, const char *needle) char *q_strcasestr(const char *haystack, const char *needle)
{ {
int c1, c2, c2f; int32_t c1, c2, c2f;
int i; int32_t i;
c2f = *needle; c2f = *needle;
if (c2f >= 'a' && c2f <= 'z') if (c2f >= 'a' && c2f <= 'z')
c2f -= ('a' - 'A'); c2f -= ('a' - 'A');
@ -263,14 +263,14 @@ char *q_strupr (char *str)
#define vsnprintf_func vsnprintf #define vsnprintf_func vsnprintf
#endif #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); ret = vsnprintf_func (str, size, format, args);
if (ret < 0) if (ret < 0)
ret = (int)size; ret = (int32_t)size;
if (size == 0) /* no buffer */ if (size == 0) /* no buffer */
return ret; return ret;
if ((size_t)ret >= size) 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; 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_list argptr;
va_start (argptr, format); va_start (argptr, format);
@ -291,7 +291,7 @@ int q_snprintf (char *str, size_t size, const char *format, ...)
return ret; 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; size_t i;
@ -300,7 +300,7 @@ void Q_memset (void *dest, int fill, size_t count)
count >>= 2; count >>= 2;
fill = fill | (fill<<8) | (fill<<16) | (fill<<24); fill = fill | (fill<<8) | (fill<<16) | (fill<<24);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
((int *)dest)[i] = fill; ((int32_t *)dest)[i] = fill;
} }
else else
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -315,14 +315,14 @@ void Q_memcpy (void *dest, const void *src, size_t count)
{ {
count >>= 2; count >>= 2;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
((int *)dest)[i] = ((int *)src)[i]; ((int32_t *)dest)[i] = ((int32_t *)src)[i];
} }
else else
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
((byte *)dest)[i] = ((byte *)src)[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) while(count)
{ {
@ -342,7 +342,7 @@ void Q_strcpy (char *dest, const char *src)
*dest++ = 0; *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--) while (*src && count--)
{ {
@ -352,9 +352,9 @@ void Q_strncpy (char *dest, const char *src, int count)
*dest++ = 0; *dest++ = 0;
} }
int Q_strlen (const char *str) int32_t Q_strlen (const char *str)
{ {
int count; int32_t count;
count = 0; count = 0;
while (str[count]) while (str[count])
@ -365,7 +365,7 @@ int Q_strlen (const char *str)
char *Q_strrchr(const char *s, char c) char *Q_strrchr(const char *s, char c)
{ {
int len = Q_strlen(s); int32_t len = Q_strlen(s);
s += len; s += len;
while (len--) while (len--)
{ {
@ -381,7 +381,7 @@ void Q_strcat (char *dest, const char *src)
Q_strcpy (dest, 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) while (1)
{ {
@ -396,7 +396,7 @@ int Q_strcmp (const char *s1, const char *s2)
return -1; 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) while (1)
{ {
@ -413,11 +413,11 @@ int Q_strncmp (const char *s1, const char *s2, int count)
return -1; return -1;
} }
int Q_atoi (const char *str) int32_t Q_atoi (const char *str)
{ {
int val; int32_t val;
int sign; int32_t sign;
int c; int32_t c;
if (*str == '-') if (*str == '-')
{ {
@ -475,9 +475,9 @@ int Q_atoi (const char *str)
float Q_atof (const char *str) float Q_atof (const char *str)
{ {
double val; double val;
int sign; int32_t sign;
int c; int32_t c;
int decimal, total; int32_t decimal, total;
if (*str == '-') if (*str == '-')
{ {
@ -559,8 +559,8 @@ bool host_bigendian;
int16_t (*BigShort) (int16_t l); int16_t (*BigShort) (int16_t l);
int16_t (*LittleShort) (int16_t l); int16_t (*LittleShort) (int16_t l);
int (*BigLong) (int l); int32_t (*BigLong) (int32_t l);
int (*LittleLong) (int l); int32_t (*LittleLong) (int32_t l);
float (*BigFloat) (float l); float (*BigFloat) (float l);
float (*LittleFloat) (float l); float (*LittleFloat) (float l);
@ -579,7 +579,7 @@ int16_t ShortNoSwap (int16_t l)
return l; return l;
} }
int LongSwap (int l) int32_t LongSwap (int32_t l)
{ {
byte b1, b2, b3, b4; byte b1, b2, b3, b4;
@ -588,10 +588,10 @@ int LongSwap (int l)
b3 = (l>>16)&255; b3 = (l>>16)&255;
b4 = (l>>24)&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; return l;
} }
@ -631,7 +631,7 @@ Handles byte ordering and avoids alignment errors
// writing functions // writing functions
// //
void MSG_WriteChar (sizebuf_t *sb, int c) void MSG_WriteChar (sizebuf_t *sb, int32_t c)
{ {
byte *buf; byte *buf;
@ -644,7 +644,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c)
buf[0] = c; buf[0] = c;
} }
void MSG_WriteByte (sizebuf_t *sb, int c) void MSG_WriteByte (sizebuf_t *sb, int32_t c)
{ {
byte *buf; byte *buf;
@ -657,7 +657,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c)
buf[0] = c; buf[0] = c;
} }
void MSG_WriteShort (sizebuf_t *sb, int c) void MSG_WriteShort (sizebuf_t *sb, int32_t c)
{ {
byte *buf; byte *buf;
@ -671,7 +671,7 @@ void MSG_WriteShort (sizebuf_t *sb, int c)
buf[1] = c>>8; buf[1] = c>>8;
} }
void MSG_WriteLong (sizebuf_t *sb, int c) void MSG_WriteLong (sizebuf_t *sb, int32_t c)
{ {
byte *buf; byte *buf;
@ -687,7 +687,7 @@ void MSG_WriteFloat (sizebuf_t *sb, float f)
union union
{ {
float f; float f;
int l; int32_t l;
} dat; } dat;
dat.f = f; dat.f = f;
@ -714,7 +714,7 @@ void MSG_WriteCoord16 (sizebuf_t *sb, float f)
void MSG_WriteCoord24 (sizebuf_t *sb, float f) void MSG_WriteCoord24 (sizebuf_t *sb, float f)
{ {
MSG_WriteShort (sb, 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 //johnfitz -- 32-bit float coords
@ -740,7 +740,7 @@ void MSG_WriteAngle (sizebuf_t *sb, float f, uint32_t flags)
MSG_WriteFloat (sb, f); MSG_WriteFloat (sb, f);
else if (flags & PRFL_SHORTANGLE) else if (flags & PRFL_SHORTANGLE)
MSG_WriteShort (sb, Q_rint(f * 65536.0 / 360.0) & 65535); 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 //johnfitz -- for PROTOCOL_FITZQUAKE
@ -755,7 +755,7 @@ void MSG_WriteAngle16 (sizebuf_t *sb, float f, uint32_t flags)
// //
// reading functions // reading functions
// //
int msg_readcount; int32_t msg_readcount;
bool msg_badread; bool msg_badread;
void MSG_BeginReading (void) void MSG_BeginReading (void)
@ -765,9 +765,9 @@ void MSG_BeginReading (void)
} }
// returns -1 and sets msg_badread if no more characters are available // 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) if (msg_readcount+1 > net_message.cursize)
{ {
@ -781,9 +781,9 @@ int MSG_ReadChar (void)
return c; return c;
} }
int MSG_ReadByte (void) int32_t MSG_ReadByte (void)
{ {
int c; int32_t c;
if (msg_readcount+1 > net_message.cursize) if (msg_readcount+1 > net_message.cursize)
{ {
@ -797,9 +797,9 @@ int MSG_ReadByte (void)
return c; return c;
} }
int MSG_ReadShort (void) int32_t MSG_ReadShort (void)
{ {
int c; int32_t c;
if (msg_readcount+2 > net_message.cursize) if (msg_readcount+2 > net_message.cursize)
{ {
@ -815,9 +815,9 @@ int MSG_ReadShort (void)
return c; return c;
} }
int MSG_ReadLong (void) int32_t MSG_ReadLong (void)
{ {
int c; int32_t c;
if (msg_readcount+4 > net_message.cursize) if (msg_readcount+4 > net_message.cursize)
{ {
@ -841,7 +841,7 @@ float MSG_ReadFloat (void)
{ {
byte b[4]; byte b[4];
float f; float f;
int l; int32_t l;
} dat; } dat;
dat.b[0] = net_message.data[msg_readcount]; dat.b[0] = net_message.data[msg_readcount];
@ -858,7 +858,7 @@ float MSG_ReadFloat (void)
const char *MSG_ReadString (void) const char *MSG_ReadString (void)
{ {
static char string[2048]; static char string[2048];
int c; int32_t c;
size_t l; size_t l;
l = 0; 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) if (startsize < 256)
startsize = 256; startsize = 256;
@ -948,7 +948,7 @@ void SZ_Clear (sizebuf_t *buf)
buf->cursize = 0; buf->cursize = 0;
} }
void *SZ_GetSpace (sizebuf_t *buf, int length) void *SZ_GetSpace (sizebuf_t *buf, int32_t length)
{ {
void *data; void *data;
@ -971,14 +971,14 @@ void *SZ_GetSpace (sizebuf_t *buf, int length)
return data; 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); Q_memcpy (SZ_GetSpace(buf,length),data,length);
} }
void SZ_Print (sizebuf_t *buf, const char *data) 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]) if (buf->data[buf->cursize-1])
{ /* no trailing 0 */ { /* no trailing 0 */
@ -1019,7 +1019,7 @@ COM_StripExtension
*/ */
void COM_StripExtension (const char *in, char *out, size_t outsize) void COM_StripExtension (const char *in, char *out, size_t outsize)
{ {
int length; int32_t length;
if (!*in) 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 */ if (in != out) /* copy when not in-place editing */
q_strlcpy (out, in, outsize); q_strlcpy (out, in, outsize);
length = (int)strlen(out) - 1; length = (int32_t)strlen(out) - 1;
while (length > 0 && out[length] != '.') while (length > 0 && out[length] != '.')
{ {
--length; --length;
@ -1162,8 +1162,8 @@ Parse a token out of a string
*/ */
const char *COM_Parse (const char *data) const char *COM_Parse (const char *data)
{ {
int c; int32_t c;
int len; int32_t len;
len = 0; len = 0;
com_token[0] = 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 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++) for (i = 1; i < com_argc; i++)
{ {
@ -1278,9 +1278,9 @@ being registered.
*/ */
static void COM_CheckRegistered (void) static void COM_CheckRegistered (void)
{ {
int h; int32_t h;
uint16_t check[128]; uint16_t check[128];
int i; int32_t i;
COM_OpenFile("gfx/pop.lmp", &h, NULL); COM_OpenFile("gfx/pop.lmp", &h, NULL);
@ -1323,9 +1323,9 @@ static void COM_CheckRegistered (void)
COM_InitArgv 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 // reconstitute the command line for the cmdline externally visible cvar
n = 0; n = 0;
@ -1391,7 +1391,7 @@ COM_Init
*/ */
void COM_Init (void) void COM_Init (void)
{ {
int i = 0x12345678; int32_t i = 0x12345678;
/* U N I X */ /* U N I X */
/* /*
@ -1454,7 +1454,7 @@ FIXME: make this buffer size safe someday
static char *get_va_buffer(void) static char *get_va_buffer(void)
{ {
static char va_buffers[VA_NUM_BUFFS][VA_BUFFERLEN]; 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); buffer_idx = (buffer_idx + 1) & (VA_NUM_BUFFS - 1);
return va_buffers[buffer_idx]; 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 typedef struct
{ {
char name[56]; char name[56];
int filepos, filelen; int32_t filepos, filelen;
} dpackfile_t; } dpackfile_t;
typedef struct typedef struct
{ {
char id[4]; char id[4];
int dirofs; int32_t dirofs;
int dirlen; int32_t dirlen;
} dpackheader_t; } dpackheader_t;
#define MAX_FILES_IN_PACK 2048 #define MAX_FILES_IN_PACK 2048
char com_gamedir[MAX_OSPATH]; char com_gamedir[MAX_OSPATH];
char com_basedir[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_searchpaths;
searchpath_t *com_base_searchpaths; searchpath_t *com_base_searchpaths;
@ -1536,9 +1536,9 @@ COM_WriteFile
The filename will be prefixed by the current game directory 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]; 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 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. 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) uint32_t *path_id)
{ {
searchpath_t *search; searchpath_t *search;
char netpath[MAX_OSPATH]; char netpath[MAX_OSPATH];
pack_t *pak; pack_t *pak;
int i, findtime; int32_t i, findtime;
if (file && handle) if (file && handle)
Sys_Error ("COM_FindFile: both handle and file set"); 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) 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; return (ret == -1) ? false : true;
} }
@ -1726,7 +1726,7 @@ returns a handle and a length
it may actually be inside a pak file 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); 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. 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); 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 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; searchpath_t *s;
@ -1780,14 +1780,14 @@ Allways appends a 0 byte.
static byte *loadbuf; static byte *loadbuf;
static cache_user_t *loadcache; 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; byte *buf;
char base[32]; char base[32];
int len; int32_t len;
buf = NULL; // quiet compiler warning 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 // 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; byte *buf;
@ -1912,23 +1912,23 @@ byte *COM_LoadMallocFile_TextMode_OSPath (const char *path, long *len_out)
return data; 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); sscanf (buffer, "%i\n%n", value, &consumed);
return buffer + consumed; return buffer + consumed;
} }
const char *COM_ParseFloatNewline(const char *buffer, float *value) const char *COM_ParseFloatNewline(const char *buffer, float *value)
{ {
int consumed = 0; int32_t consumed = 0;
sscanf (buffer, "%f\n%n", value, &consumed); sscanf (buffer, "%f\n%n", value, &consumed);
return buffer + consumed; return buffer + consumed;
} }
const char *COM_ParseStringNewline(const char *buffer) const char *COM_ParseStringNewline(const char *buffer)
{ {
int consumed = 0; int32_t consumed = 0;
com_token[0] = '\0'; com_token[0] = '\0';
sscanf (buffer, "%1023s\n%n", com_token, &consumed); sscanf (buffer, "%1023s\n%n", com_token, &consumed);
return buffer + 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) static pack_t *COM_LoadPackFile (const char *packfile)
{ {
dpackheader_t header; dpackheader_t header;
int i; int32_t i;
packfile_t *newfiles; packfile_t *newfiles;
int numpackfiles; int32_t numpackfiles;
pack_t *pack; pack_t *pack;
int packhandle; int32_t packhandle;
dpackfile_t info[MAX_FILES_IN_PACK]; dpackfile_t info[MAX_FILES_IN_PACK];
uint16_t crc; 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) static void COM_AddGameDirectory (const char *base, const char *dir)
{ {
int i; int32_t i;
uint32_t path_id; uint32_t path_id;
searchpath_t *search; searchpath_t *search;
pack_t *pak, *qspak; pack_t *pak, *qspak;
@ -2227,7 +2227,7 @@ COM_InitFilesystem
*/ */
void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
{ {
int i, j; int32_t i, j;
Cvar_RegisterVariable (&registered); Cvar_RegisterVariable (&registered);
Cvar_RegisterVariable (&cmdline); 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; 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. /* I don't care about 64 bit off_t or fseeko() here.
* the quake/hexen2 file system is 32 bits, anyway. */ * the quake/hexen2 file system is 32 bits, anyway. */
int ret; int32_t ret;
if (!fh) { if (!fh) {
errno = EBADF; errno = EBADF;
@ -2378,7 +2378,7 @@ int FS_fseek(fshandle_t *fh, long offset, int whence)
return 0; return 0;
} }
int FS_fclose(fshandle_t *fh) int32_t FS_fclose(fshandle_t *fh)
{ {
if (!fh) { if (!fh) {
errno = EBADF; errno = EBADF;
@ -2404,7 +2404,7 @@ void FS_rewind(fshandle_t *fh)
fh->pos = 0; fh->pos = 0;
} }
int FS_feof(fshandle_t *fh) int32_t FS_feof(fshandle_t *fh)
{ {
if (!fh) { if (!fh) {
errno = EBADF; errno = EBADF;
@ -2415,7 +2415,7 @@ int FS_feof(fshandle_t *fh)
return 0; return 0;
} }
int FS_ferror(fshandle_t *fh) int32_t FS_ferror(fshandle_t *fh)
{ {
if (!fh) { if (!fh) {
errno = EBADF; errno = EBADF;
@ -2424,7 +2424,7 @@ int FS_ferror(fshandle_t *fh)
return ferror(fh->file); return ferror(fh->file);
} }
int FS_fgetc(fshandle_t *fh) int32_t FS_fgetc(fshandle_t *fh)
{ {
if (!fh) { if (!fh) {
errno = EBADF; errno = EBADF;
@ -2436,7 +2436,7 @@ int FS_fgetc(fshandle_t *fh)
return fgetc(fh->file); 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; char *ret;

View File

@ -52,15 +52,15 @@ typedef struct sizebuf_s
bool allowoverflow; // if false, do a Sys_Error bool allowoverflow; // if false, do a Sys_Error
bool overflowed; // set to true if the buffer size failed bool overflowed; // set to true if the buffer size failed
byte *data; byte *data;
int maxsize; int32_t maxsize;
int cursize; int32_t cursize;
} sizebuf_t; } 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_Free (sizebuf_t *buf);
void SZ_Clear (sizebuf_t *buf); void SZ_Clear (sizebuf_t *buf);
void *SZ_GetSpace (sizebuf_t *buf, int length); void *SZ_GetSpace (sizebuf_t *buf, int32_t length);
void SZ_Write (sizebuf_t *buf, const void *data, int 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 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 (*BigShort) (int16_t l);
extern int16_t (*LittleShort) (int16_t l); extern int16_t (*LittleShort) (int16_t l);
extern int (*BigLong) (int l); extern int32_t (*BigLong) (int32_t l);
extern int (*LittleLong) (int l); extern int32_t (*LittleLong) (int32_t l);
extern float (*BigFloat) (float l); extern float (*BigFloat) (float l);
extern float (*LittleFloat) (float l); extern float (*LittleFloat) (float l);
//============================================================================ //============================================================================
void MSG_WriteChar (sizebuf_t *sb, int c); void MSG_WriteChar (sizebuf_t *sb, int32_t c);
void MSG_WriteByte (sizebuf_t *sb, int c); void MSG_WriteByte (sizebuf_t *sb, int32_t c);
void MSG_WriteShort (sizebuf_t *sb, int c); void MSG_WriteShort (sizebuf_t *sb, int32_t c);
void MSG_WriteLong (sizebuf_t *sb, int c); void MSG_WriteLong (sizebuf_t *sb, int32_t c);
void MSG_WriteFloat (sizebuf_t *sb, float f); void MSG_WriteFloat (sizebuf_t *sb, float f);
void MSG_WriteString (sizebuf_t *sb, const char *s); void MSG_WriteString (sizebuf_t *sb, const char *s);
void MSG_WriteCoord (sizebuf_t *sb, float f, uint32_t flags); void MSG_WriteCoord (sizebuf_t *sb, float f, uint32_t flags);
void MSG_WriteAngle (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 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 extern bool msg_badread; // set if a read goes beyond end of message
void MSG_BeginReading (void); void MSG_BeginReading (void);
int MSG_ReadChar (void); int32_t MSG_ReadChar (void);
int MSG_ReadByte (void); int32_t MSG_ReadByte (void);
int MSG_ReadShort (void); int32_t MSG_ReadShort (void);
int MSG_ReadLong (void); int32_t MSG_ReadLong (void);
float MSG_ReadFloat (void); float MSG_ReadFloat (void);
const char *MSG_ReadString (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); 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_strcpy (char *dest, const char *src);
void Q_strncpy (char *dest, const char *src, int count); void Q_strncpy (char *dest, const char *src, int32_t count);
int Q_strlen (const char *str); int32_t Q_strlen (const char *str);
char *Q_strrchr (const char *s, char c); char *Q_strrchr (const char *s, char c);
void Q_strcat (char *dest, const char *src); void Q_strcat (char *dest, const char *src);
int Q_strcmp (const char *s1, const char *s2); int32_t Q_strcmp (const char *s1, const char *s2);
int Q_strncmp (const char *s1, const char *s2, int count); int32_t Q_strncmp (const char *s1, const char *s2, int32_t count);
int Q_atoi (const char *str); int32_t Q_atoi (const char *str);
float Q_atof (const char *str); float Q_atof (const char *str);
#include "strl_fn.h" #include "strl_fn.h"
/* locale-insensitive strcasecmp replacement functions: */ /* locale-insensitive strcasecmp replacement functions: */
extern int q_strcasecmp (const char * s1, const char * s2); extern int32_t 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_strncasecmp (const char *s1, const char *s2, size_t n);
/* locale-insensitive case-insensitive alternative to strstr */ /* locale-insensitive case-insensitive alternative to strstr */
extern char *q_strcasestr(const char *haystack, const char *needle); 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); extern char *q_strupr (char *str);
/* snprintf, vsnprintf : always use our versions. */ /* snprintf, vsnprintf : always use our versions. */
extern int q_snprintf (char *str, size_t size, const char *format, ...) FUNC_PRINTF(3,4); extern int32_t 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_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); const char *COM_Parse (const char *data);
extern int com_argc; extern int32_t com_argc;
extern char **com_argv; extern char **com_argv;
extern int safemode; extern int32_t safemode;
/* safe mode: in true, the engine will behave as if one /* safe mode: in true, the engine will behave as if one
of these arguments were actually on the command line: of these arguments were actually on the command line:
-nosound, -nocdaudio, -nomidi, -stdvid, -dibonly, -nosound, -nocdaudio, -nomidi, -stdvid, -dibonly,
-nomouse, -nojoy, -nolan -nomouse, -nojoy, -nolan
*/ */
int COM_CheckParm (const char *parm); int32_t COM_CheckParm (const char *parm);
void COM_Init (void); void COM_Init (void);
void COM_InitArgv (int argc, char **argv); void COM_InitArgv (int32_t argc, char **argv);
void COM_InitFilesystem (void); void COM_InitFilesystem (void);
const char *COM_SkipPath (const char *pathname); const char *COM_SkipPath (const char *pathname);
@ -197,14 +197,14 @@ char *va (const char *format, ...) FUNC_PRINTF(1,2);
typedef struct typedef struct
{ {
char name[MAX_QPATH]; char name[MAX_QPATH];
int filepos, filelen; int32_t filepos, filelen;
} packfile_t; } packfile_t;
typedef struct pack_s typedef struct pack_s
{ {
char filename[MAX_OSPATH]; char filename[MAX_OSPATH];
int handle; int32_t handle;
int numfiles; int32_t numfiles;
packfile_t *files; packfile_t *files;
} pack_t; } pack_t;
@ -221,23 +221,23 @@ typedef struct searchpath_s
extern searchpath_t *com_searchpaths; extern searchpath_t *com_searchpaths;
extern searchpath_t *com_base_searchpaths; extern searchpath_t *com_base_searchpaths;
extern int com_filesize; extern int32_t com_filesize;
struct cache_user_s; struct cache_user_s;
extern char com_basedir[MAX_OSPATH]; extern char com_basedir[MAX_OSPATH];
extern char com_gamedir[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); void COM_WriteFile (const char *filename, const void *data, int32_t len);
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);
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);
bool COM_FileExists (const char *filename, 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 // 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 // buffer. the buffer is allocated with a total size of com_filesize + 1. the
// procedures differ by their buffer allocation method. // 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); uint32_t *path_id);
// uses the specified stack stack buffer with the specified size // uses the specified stack stack buffer with the specified size
// of bufsize. if bufsize is too short, uses temp hunk. the bufsize // 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. // Loads in "t" mode so CRLF to LF translation is performed on Windows.
byte *COM_LoadMallocFile_TextMode_OSPath (const char *path, long *len_out); 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. // Returns advanced buffer position.
// Doesn't signal parsing failure, but this is not needed for savegame loading. // 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. // Attempts to parse a float followed by a newline.
// Returns advanced buffer position. // Returns advanced buffer position.
@ -288,14 +288,14 @@ typedef struct _fshandle_t
} fshandle_t; } fshandle_t;
size_t FS_fread(void *ptr, size_t size, size_t nmemb, fshandle_t *fh); 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); long FS_ftell(fshandle_t *fh);
void FS_rewind(fshandle_t *fh); void FS_rewind(fshandle_t *fh);
int FS_feof(fshandle_t *fh); int32_t FS_feof(fshandle_t *fh);
int FS_ferror(fshandle_t *fh); int32_t FS_ferror(fshandle_t *fh);
int FS_fclose(fshandle_t *fh); int32_t FS_fclose(fshandle_t *fh);
int FS_fgetc(fshandle_t *fh); int32_t FS_fgetc(fshandle_t *fh);
char *FS_fgets(char *s, int size, fshandle_t *fh); char *FS_fgets(char *s, int32_t size, fshandle_t *fh);
long FS_filelength (fshandle_t *fh); long FS_filelength (fshandle_t *fh);

View File

@ -32,21 +32,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
#include "quakedef.h" #include "quakedef.h"
int con_linewidth; int32_t con_linewidth;
float con_cursorspeed = 4; float con_cursorspeed = 4;
#define CON_TEXTSIZE (1024 * 1024) //ericw -- was 65536. johnfitz -- new default size #define CON_TEXTSIZE (1024 * 1024) //ericw -- was 65536. johnfitz -- new default size
#define CON_MINSIZE 16384 //johnfitz -- old default, now the minimum 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 bool con_forcedup; // because no entities to refresh
int con_totallines; // total lines in console scrollback int32_t con_totallines; // total lines in console scrollback
int con_backscroll; // lines up from bottom to display int32_t con_backscroll; // lines up from bottom to display
int con_current; // where next message will be printed int32_t con_current; // where next message will be printed
int con_x; // offset in current line for next print int32_t con_x; // offset in current line for next print
char *con_text = NULL; char *con_text = NULL;
cvar_t con_notifytime = {"con_notifytime","3",CVAR_NONE}; //seconds 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 float con_times[NUM_CON_TIMES]; // realtime time the line was generated
// for transparent notify lines // for transparent notify lines
int con_vislines; int32_t con_vislines;
bool con_debuglog = false; 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. includes a newline, unless len >= con_linewidth.
================ ================
*/ */
const char *Con_Quakebar (int len) const char *Con_Quakebar (int32_t len)
{ {
static char bar[42]; 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); len = q_min(len, con_linewidth);
bar[0] = '\35'; bar[0] = '\35';
@ -101,7 +101,7 @@ const char *Con_Quakebar (int len)
Con_ToggleConsole_f Con_ToggleConsole_f
================ ================
*/ */
extern int history_line; //johnfitz extern int32_t history_line; //johnfitz
void Con_ToggleConsole_f (void) void Con_ToggleConsole_f (void)
{ {
@ -151,7 +151,7 @@ Con_Dump_f -- johnfitz -- adapted from quake2 source
*/ */
static void Con_Dump_f (void) static void Con_Dump_f (void)
{ {
int l, x; int32_t l, x;
const char *line; const char *line;
FILE *f; FILE *f;
char buffer[1024]; char buffer[1024];
@ -207,7 +207,7 @@ Con_ClearNotify
*/ */
void Con_ClearNotify (void) void Con_ClearNotify (void)
{ {
int i; int32_t i;
for (i = 0; i < NUM_CON_TIMES; i++) for (i = 0; i < NUM_CON_TIMES; i++)
con_times[i] = 0; con_times[i] = 0;
@ -250,9 +250,9 @@ If the line width has changed, reformat the buffer.
*/ */
void Con_CheckResize (void) 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 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 width = (vid.conwidth >> 3) - 2; //johnfitz -- use vid.conwidth instead of vid.width
@ -304,7 +304,7 @@ Con_Init
*/ */
void Con_Init (void) void Con_Init (void)
{ {
int i; int32_t i;
//johnfitz -- user settable console buffer size //johnfitz -- user settable console buffer size
i = COM_CheckParm("-consize"); 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) static void Con_Print (const char *txt)
{ {
int y; int32_t y;
int c, l; int32_t c, l;
static int cr; static int32_t cr;
int mask; int32_t mask;
bool boundary; bool boundary;
//con_backscroll = 0; //johnfitz -- better console scrolling //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 // borrowed from uhexen2 by S.A. for new procs, LOG_Init, LOG_Close
static char logfilename[MAX_OSPATH]; // current logfile name 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; va_list argptr;
char msg[1024]; char msg[1024];
int temp; int32_t temp;
va_start (argptr, fmt); va_start (argptr, fmt);
q_vsnprintf (msg, sizeof(msg), fmt, argptr); 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 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 (int32_t 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, ...)
{ {
va_list argptr; va_list argptr;
char msg[MAXPRINTMSG]; //the original message char msg[MAXPRINTMSG]; //the original message
char line[MAXPRINTMSG]; //one line from the message char line[MAXPRINTMSG]; //one line from the message
char spaces[21]; //buffer for spaces char spaces[21]; //buffer for spaces
char *src, *dst; char *src, *dst;
int len, s; int32_t len, s;
va_start (argptr, fmt); va_start (argptr, fmt);
q_vsnprintf (msg, sizeof(msg), fmt, argptr); q_vsnprintf (msg, sizeof(msg), fmt, argptr);
@ -822,7 +822,7 @@ static const arg_completion_type_t arg_completion_types[] =
{ "timedemo ", &demolist } { "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]); sizeof(arg_completion_types)/sizeof(arg_completion_types[0]);
/* /*
@ -830,12 +830,12 @@ static const int num_arg_completion_types =
FindCompletion -- stevenaaus 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]; static char matched[32];
char *i_matched, *i_name; char *i_matched, *i_name;
filelist_item_t *file; filelist_item_t *file;
int init, match, plen; int32_t init, match, plen;
memset(matched, 0, sizeof(matched)); memset(matched, 0, sizeof(matched));
plen = strlen(partial); plen = strlen(partial);
@ -891,7 +891,7 @@ void BuildTabList (const char *partial)
cmdalias_t *alias; cmdalias_t *alias;
cvar_t *cvar; cvar_t *cvar;
cmd_function_t *cmd; cmd_function_t *cmd;
int len; int32_t len;
tablist = NULL; tablist = NULL;
len = strlen(partial); len = strlen(partial);
@ -924,7 +924,7 @@ void Con_TabComplete (void)
const char *match; const char *match;
static char *c; static char *c;
tab_t *t; tab_t *t;
int mark, i, j; int32_t mark, i, j;
// if editline is empty, return // if editline is empty, return
if (key_lines[edit_line][1] == 0) 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))) 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); const char *matched_map = FindCompletion(partial, *arg_completion.filelist, &nummatches);
if (!*matched_map) if (!*matched_map)
return; return;
@ -1075,7 +1075,7 @@ Draws the last few lines of output transparently over the game top
*/ */
void Con_DrawNotify (void) void Con_DrawNotify (void)
{ {
int i, x, v; int32_t i, x, v;
const char *text; const char *text;
float time; float time;
@ -1131,7 +1131,7 @@ void Con_DrawNotify (void)
text++; 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; v += 8;
scr_tileclear_updates = 0; //johnfitz scr_tileclear_updates = 0; //johnfitz
@ -1149,7 +1149,7 @@ extern qpic_t *pic_ovr, *pic_ins; //johnfitz -- new cursor handling
void Con_DrawInput (void) void Con_DrawInput (void)
{ {
int i, ofs; int32_t i, ofs;
if (key_dest != key_console && !con_forcedup) if (key_dest != key_console && !con_forcedup)
return; // don't draw anything 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]); Draw_Character ((i+1)<<3, vid.conheight - 16, key_lines[edit_line][i+ofs]);
// johnfitz -- new cursor handling // 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; i = key_linepos - ofs;
Draw_Pic ((i+1)<<3, vid.conheight - 16, key_insert ? pic_ins : pic_ovr); 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 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; const char *text;
char ver[32]; char ver[32];
@ -1228,7 +1228,7 @@ void Con_DrawConsole (int lines, bool drawinput)
//draw version number in bottom right //draw version number in bottom right
y += 8; y += 8;
q_snprintf (ver, sizeof(ver), "QuakeSpasm " QUAKESPASM_VERSION); 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*/); 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) void Con_NotifyBox (const char *text)
{ {
double t1, t2; double t1, t2;
int lastkey, lastchar; int32_t lastkey, lastchar;
// during startup for sound / cd warnings // during startup for sound / cd warnings
Con_Printf ("\n\n%s", Con_Quakebar(40)); //johnfitz Con_Printf ("\n\n%s", Con_Quakebar(40)); //johnfitz

View File

@ -26,19 +26,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// //
// console // console
// //
extern int con_totallines; extern int32_t con_totallines;
extern int con_backscroll; extern int32_t con_backscroll;
extern bool con_forcedup; // because no entities to refresh extern bool con_forcedup; // because no entities to refresh
extern bool con_initialized; extern bool con_initialized;
extern byte *con_chars; extern byte *con_chars;
extern char con_lastcenterstring[]; //johnfitz 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_CheckResize (void);
void Con_Init (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_Printf (const char *fmt, ...) FUNC_PRINTF(1,2);
void Con_DWarning (const char *fmt, ...) FUNC_PRINTF(1,2); //ericw void Con_DWarning (const char *fmt, ...) FUNC_PRINTF(1,2); //ericw
void Con_Warning (const char *fmt, ...) FUNC_PRINTF(1,2); //johnfitz 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_Show (void);
void Con_Hide (void); void Con_Hide (void);
const char *Con_Quakebar (int len); const char *Con_Quakebar (int32_t len);
void Con_TabComplete (void); void Con_TabComplete (void);
void Con_LogCenterPrint (const char *str); void Con_LogCenterPrint (const char *str);

View File

@ -82,7 +82,7 @@ uint16_t CRC_Value(uint16_t crcvalue)
} }
//johnfitz -- texture crc //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; uint16_t crc;

View File

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void CRC_Init(uint16_t *crcvalue); void CRC_Init(uint16_t *crcvalue);
void CRC_ProcessByte(uint16_t *crcvalue, byte data); void CRC_ProcessByte(uint16_t *crcvalue, byte data);
uint16_t CRC_Value(uint16_t crcvalue); 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 */ #endif /* _QUAKE_CRC_H */

View File

@ -43,7 +43,7 @@ void Cvar_List_f (void)
{ {
cvar_t *cvar; cvar_t *cvar;
const char *partial; const char *partial;
int len, count; int32_t len, count;
if (Cmd_Argc() > 1) if (Cmd_Argc() > 1)
{ {
@ -130,7 +130,7 @@ Cvar_Cycle_f -- johnfitz
*/ */
void Cvar_Cycle_f (void) void Cvar_Cycle_f (void)
{ {
int i; int32_t i;
if (Cmd_Argc() < 3) if (Cmd_Argc() < 3)
{ {
@ -351,7 +351,7 @@ Cvar_CompleteVariable
const char *Cvar_CompleteVariable (const char *partial) const char *Cvar_CompleteVariable (const char *partial)
{ {
cvar_t *cvar; cvar_t *cvar;
int len; int32_t len;
len = Q_strlen(partial); len = Q_strlen(partial);
if (!len) if (!len)
@ -394,7 +394,7 @@ void Cvar_SetQuick (cvar_t *var, const char *value)
var->string = Z_Strdup (value); var->string = Z_Strdup (value);
else else
{ {
int len; int32_t len;
if (!strcmp(var->string, value)) if (!strcmp(var->string, value))
return; // no change return; // no change
@ -432,8 +432,8 @@ void Cvar_SetValueQuick (cvar_t *var, const float value)
{ {
char val[32], *ptr = val; char val[32], *ptr = val;
if (value == (float)((int)value)) if (value == (float)((int32_t)value))
q_snprintf (val, sizeof(val), "%i", (int)value); q_snprintf (val, sizeof(val), "%i", (int32_t)value);
else else
{ {
q_snprintf (val, sizeof(val), "%f", value); 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; char val[32], *ptr = val;
if (value == (float)((int)value)) if (value == (float)((int32_t)value))
q_snprintf (val, sizeof(val), "%i", (int)value); q_snprintf (val, sizeof(val), "%i", (int32_t)value);
else else
{ {
q_snprintf (val, sizeof(val), "%f", value); q_snprintf (val, sizeof(val), "%f", value);

View File

@ -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 extern qpic_t *draw_disc; // also used on sbar
void Draw_Init (void); 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_DebugChar (char num);
void Draw_Pic (int x, int y, qpic_t *pic); void Draw_Pic (int32_t x, int32_t y, qpic_t *pic);
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom); //johnfitz -- more parameters 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 int lines void Draw_ConsoleBackground (void); //johnfitz -- removed parameter int32_t lines
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);
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
void Draw_FadeScreen (void); 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_PicFromWad (const char *name);
qpic_t *Draw_CachePic (const char *path); qpic_t *Draw_CachePic (const char *path);
void Draw_NewGame (void); void Draw_NewGame (void);

View File

@ -122,7 +122,7 @@ typedef struct cachepic_s
#define MAX_CACHED_PICS 128 #define MAX_CACHED_PICS 128
cachepic_t menu_cachepics[MAX_CACHED_PICS]; cachepic_t menu_cachepics[MAX_CACHED_PICS];
int menu_numcachepics; int32_t menu_numcachepics;
byte menuplyr_pixels[4096]; byte menuplyr_pixels[4096];
@ -134,7 +134,7 @@ byte menuplyr_pixels[4096];
#define BLOCK_WIDTH 256 #define BLOCK_WIDTH 256
#define BLOCK_HEIGHT 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 byte scrap_texels[MAX_SCRAPS][BLOCK_WIDTH*BLOCK_HEIGHT]; //johnfitz -- removed *4 after BLOCK_HEIGHT
bool scrap_dirty; bool scrap_dirty;
gltexture_t *scrap_textures[MAX_SCRAPS]; //johnfitz gltexture_t *scrap_textures[MAX_SCRAPS]; //johnfitz
@ -147,11 +147,11 @@ Scrap_AllocBlock
returns an index into scrap_texnums[] and the position inside it 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; int32_t i, j;
int best, best2; int32_t best, best2;
int texnum; int32_t texnum;
for (texnum=0 ; texnum<MAX_SCRAPS ; texnum++) for (texnum=0 ; texnum<MAX_SCRAPS ; texnum++)
{ {
@ -196,7 +196,7 @@ Scrap_Upload -- johnfitz -- now uses TexMgr
void Scrap_Upload (void) void Scrap_Upload (void)
{ {
char name[8]; char name[8];
int i; int32_t i;
for (i=0; i<MAX_SCRAPS; i++) for (i=0; i<MAX_SCRAPS; i++)
{ {
@ -225,9 +225,9 @@ qpic_t *Draw_PicFromWad (const char *name)
// load little ones into the scrap // load little ones into the scrap
if (p->width < 64 && p->height < 64) if (p->width < 64 && p->height < 64)
{ {
int x, y; int32_t x, y;
int i, j, k; int32_t i, j, k;
int texnum; int32_t texnum;
texnum = Scrap_AllocBlock (p->width, p->height, &x, &y); texnum = Scrap_AllocBlock (p->width, p->height, &x, &y);
scrap_dirty = true; scrap_dirty = true;
@ -249,7 +249,7 @@ qpic_t *Draw_PicFromWad (const char *name)
char texturename[64]; //johnfitz char texturename[64]; //johnfitz
q_snprintf (texturename, sizeof(texturename), "%s:%s", WADFILENAME, name); //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, gl.gltexture = TexMgr_LoadImage (NULL, texturename, p->width, p->height, SRC_INDEXED, p->data, WADFILENAME,
offset, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr offset, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
@ -272,7 +272,7 @@ Draw_CachePic
qpic_t *Draw_CachePic (const char *path) qpic_t *Draw_CachePic (const char *path)
{ {
cachepic_t *pic; cachepic_t *pic;
int i; int32_t i;
qpic_t *dat; qpic_t *dat;
glpic_t gl; glpic_t gl;
@ -304,7 +304,7 @@ qpic_t *Draw_CachePic (const char *path)
pic->pic.height = dat->height; pic->pic.height = dat->height;
gl.gltexture = TexMgr_LoadImage (NULL, path, dat->width, dat->height, SRC_INDEXED, dat->data, path, 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.sl = 0;
gl.sh = (float)dat->width/(float)TexMgr_PadConditional(dat->width); //johnfitz gl.sh = (float)dat->width/(float)TexMgr_PadConditional(dat->width); //johnfitz
gl.tl = 0; gl.tl = 0;
@ -319,9 +319,9 @@ qpic_t *Draw_CachePic (const char *path)
Draw_MakePic -- johnfitz -- generate pics from internal data 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; qpic_t *pic;
glpic_t gl; glpic_t gl;
@ -373,7 +373,7 @@ Draw_NewGame -- johnfitz
void Draw_NewGame (void) void Draw_NewGame (void)
{ {
cachepic_t *pic; cachepic_t *pic;
int i; int32_t i;
// empty scrap and reallocate gltextures // empty scrap and reallocate gltextures
memset(scrap_allocated, 0, sizeof(scrap_allocated)); memset(scrap_allocated, 0, sizeof(scrap_allocated));
@ -428,9 +428,9 @@ void Draw_Init (void)
Draw_CharacterQuad -- johnfitz -- seperate function to spit out verts 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; float frow, fcol, size;
row = num>>4; row = num>>4;
@ -455,7 +455,7 @@ void Draw_CharacterQuad (int x, int y, char num)
Draw_Character -- johnfitz -- modified to call Draw_CharacterQuad 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) if (y <= -8)
return; // totally off screen 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 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) if (y <= -8)
return; // totally off screen return; // totally off screen
@ -502,7 +502,7 @@ void Draw_String (int x, int y, const char *str)
Draw_Pic -- johnfitz -- modified 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; 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 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 int32_t oldtop = -2;
static int oldbottom = -2; static int32_t oldbottom = -2;
if (top != oldtop || bottom != oldbottom) 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. 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; glpic_t *gl;
@ -621,7 +621,7 @@ Draw_Fill
Fills a box of pixels with a single color 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 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; extern vrect_t scr_vrect;
float s; float s;
int lines; int32_t lines;
if (newcanvas == currentcanvas) if (newcanvas == currentcanvas)
return; return;

View File

@ -233,7 +233,7 @@ float *Fog_GetColor (void)
{ {
static float c[4]; static float c[4];
float f; float f;
int i; int32_t i;
if (fade_done > cl.time) if (fade_done > cl.time)
{ {

View File

@ -35,35 +35,35 @@ ALIAS MODEL DISPLAY LIST GENERATION
qmodel_t *aliasmodel; qmodel_t *aliasmodel;
aliashdr_t *paliashdr; 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 // the command list holds counts and s/t values that are valid for
// every frame // every frame
int commands[8192]; int32_t commands[8192];
int numcommands; int32_t numcommands;
// all frames will have their vertexes rearranged and expanded // all frames will have their vertexes rearranged and expanded
// so they are in the order expected by the command list // so they are in the order expected by the command list
int vertexorder[8192]; int32_t vertexorder[8192];
int numorder; int32_t numorder;
int allverts, alltris; int32_t allverts, alltris;
int stripverts[128]; int32_t stripverts[128];
int striptris[128]; int32_t striptris[128];
int stripcount; int32_t stripcount;
/* /*
================ ================
StripLength StripLength
================ ================
*/ */
int StripLength (int starttri, int startv) int32_t StripLength (int32_t starttri, int32_t startv)
{ {
int m1, m2; int32_t m1, m2;
int j; int32_t j;
mtriangle_t *last, *check; mtriangle_t *last, *check;
int k; int32_t k;
used[starttri] = 2; used[starttri] = 2;
@ -127,12 +127,12 @@ done:
FanLength FanLength
=========== ===========
*/ */
int FanLength (int starttri, int startv) int32_t FanLength (int32_t starttri, int32_t startv)
{ {
int m1, m2; int32_t m1, m2;
int j; int32_t j;
mtriangle_t *last, *check; mtriangle_t *last, *check;
int k; int32_t k;
used[starttri] = 2; used[starttri] = 2;
@ -200,13 +200,13 @@ for the model, which holds for all frames
*/ */
void BuildTris (void) void BuildTris (void)
{ {
int i, j, k; int32_t i, j, k;
int startv; int32_t startv;
float s, t; float s, t;
int len, bestlen, besttype; int32_t len, bestlen, besttype;
int bestverts[1024]; int32_t bestverts[1024];
int besttris[1024]; int32_t besttris[1024];
int type; int32_t type;
// //
// build tristrips // build tristrips
@ -254,7 +254,7 @@ void BuildTris (void)
for (j = 0; j < bestlen+2; j++) for (j = 0; j < bestlen+2; j++)
{ {
int tmp; int32_t tmp;
// emit a vertex into the reorder buffer // emit a vertex into the reorder buffer
k = bestverts[j]; k = bestverts[j];
@ -270,7 +270,7 @@ void BuildTris (void)
// *(float *)&commands[numcommands++] = s; // *(float *)&commands[numcommands++] = s;
// *(float *)&commands[numcommands++] = t; // *(float *)&commands[numcommands++] = t;
// NOTE: 4 == sizeof(int) // NOTE: 4 == sizeof(int32_t)
// == sizeof(float) // == sizeof(float)
memcpy (&tmp, &s, 4); memcpy (&tmp, &s, 4);
commands[numcommands++] = tmp; commands[numcommands++] = tmp;
@ -297,12 +297,12 @@ GL_MakeAliasModelDisplayLists
*/ */
void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr) void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr)
{ {
int i, j; int32_t i, j;
int *cmds; int32_t *cmds;
trivertx_t *verts; trivertx_t *verts;
float hscale, vscale; //johnfitz -- padded skins float hscale, vscale; //johnfitz -- padded skins
int count; //johnfitz -- precompute texcoords for padded skins int32_t count; //johnfitz -- precompute texcoords for padded skins
int *loadcmds; //johnfitz int32_t *loadcmds; //johnfitz
//johnfitz -- padded skins //johnfitz -- padded skins
hscale = (float)hdr->skinwidth/(float)TexMgr_PadConditional(hdr->skinwidth); 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; paliashdr->poseverts = numorder;
cmds = (int *) Hunk_Alloc (numcommands * 4); cmds = (int32_t *) Hunk_Alloc (numcommands * 4);
paliashdr->commands = (byte *)cmds - (byte *)paliashdr; paliashdr->commands = (byte *)cmds - (byte *)paliashdr;
//johnfitz -- precompute texcoords for padded skins //johnfitz -- precompute texcoords for padded skins
@ -368,8 +368,8 @@ Original code by MH from RMQEngine
*/ */
void GL_MakeAliasModelDisplayLists_VBO (void) void GL_MakeAliasModelDisplayLists_VBO (void)
{ {
int i, j; int32_t i, j;
int maxverts_vbo; int32_t maxverts_vbo;
trivertx_t *verts; trivertx_t *verts;
uint16_t *indexes; uint16_t *indexes;
aliasmesh_t *desc; aliasmesh_t *desc;
@ -400,14 +400,14 @@ void GL_MakeAliasModelDisplayLists_VBO (void)
{ {
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
{ {
int v; int32_t v;
// index into hdr->vertexes // index into hdr->vertexes
uint16_t vertindex = triangles[i].vertindex[j]; uint16_t vertindex = triangles[i].vertindex[j];
// basic s/t coords // basic s/t coords
int s = stverts[vertindex].s; int32_t s = stverts[vertindex].s;
int t = stverts[vertindex].t; int32_t t = stverts[vertindex].t;
// check for back side and adjust texcoord s // check for back side and adjust texcoord s
if (!triangles[i].facesfront && stverts[vertindex].onseam) s += pheader->skinwidth / 2; 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++) for (v = 0; v < pheader->numverts_vbo; v++)
{ {
// it could use the same xyz but have different s and t // 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 // exists; emit an index for it
indexes[pheader->numindexes++] = v; 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) static void GLMesh_LoadVertexBuffer (qmodel_t *m, const aliashdr_t *hdr)
{ {
int totalvbosize = 0; int32_t totalvbosize = 0;
const aliasmesh_t *desc; const aliasmesh_t *desc;
const int16_t *indexes; const int16_t *indexes;
const trivertx_t *trivertexes; const trivertx_t *trivertexes;
byte *vbodata; byte *vbodata;
int f; int32_t f;
if (!gl_glsl_alias_able) if (!gl_glsl_alias_able)
return; 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 // 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 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))); meshxyz_t *xyz = (meshxyz_t *) (vbodata + (f * hdr->numverts_vbo * sizeof (meshxyz_t)));
const trivertx_t *tv = trivertexes + (hdr->numverts * f); 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) void GLMesh_LoadVertexBuffers (void)
{ {
int j; int32_t j;
qmodel_t *m; qmodel_t *m;
const aliashdr_t *hdr; const aliashdr_t *hdr;
@ -592,7 +592,7 @@ Delete VBOs for all loaded alias models
*/ */
void GLMesh_DeleteVertexBuffers (void) void GLMesh_DeleteVertexBuffers (void)
{ {
int j; int32_t j;
qmodel_t *m; qmodel_t *m;
if (!gl_glsl_alias_able) if (!gl_glsl_alias_able)

View File

@ -37,14 +37,14 @@ qmodel_t *Mod_LoadModel (qmodel_t *mod, bool crash);
cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE}; cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE};
static byte *mod_novis; static byte *mod_novis;
static int mod_novis_capacity; static int32_t mod_novis_capacity;
static byte *mod_decompressed; static byte *mod_decompressed;
static int mod_decompressed_capacity; static int32_t mod_decompressed_capacity;
#define MAX_MOD_KNOWN 2048 /*johnfitz -- was 512 */ #define MAX_MOD_KNOWN 2048 /*johnfitz -- was 512 */
qmodel_t mod_known[MAX_MOD_KNOWN]; 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_mip; //johnfitz -- moved here from r_main.c
texture_t *r_notexture_mip2; //johnfitz -- used for non-lightmapped surfs with a missing texture 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) byte *Mod_DecompressVis (byte *in, qmodel_t *model)
{ {
int c; int32_t c;
byte *out; byte *out;
byte *outend; byte *outend;
int row; int32_t row;
row = (model->numleafs+7)>>3; row = (model->numleafs+7)>>3;
if (mod_decompressed == NULL || row > mod_decompressed_capacity) 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) byte *Mod_NoVisPVS (qmodel_t *model)
{ {
int pvsbytes; int32_t pvsbytes;
pvsbytes = (model->numleafs+7)>>3; pvsbytes = (model->numleafs+7)>>3;
if (mod_novis == NULL || pvsbytes > mod_novis_capacity) if (mod_novis == NULL || pvsbytes > mod_novis_capacity)
@ -215,7 +215,7 @@ Mod_ClearAll
*/ */
void Mod_ClearAll (void) void Mod_ClearAll (void)
{ {
int i; int32_t i;
qmodel_t *mod; qmodel_t *mod;
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++) for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
@ -228,7 +228,7 @@ void Mod_ClearAll (void)
void Mod_ResetAll (void) void Mod_ResetAll (void)
{ {
int i; int32_t i;
qmodel_t *mod; qmodel_t *mod;
//ericw -- free alias model VBOs //ericw -- free alias model VBOs
@ -251,7 +251,7 @@ Mod_FindName
*/ */
qmodel_t *Mod_FindName (const char *name) qmodel_t *Mod_FindName (const char *name)
{ {
int i; int32_t i;
qmodel_t *mod; qmodel_t *mod;
if (!name[0]) if (!name[0])
@ -306,7 +306,7 @@ qmodel_t *Mod_LoadModel (qmodel_t *mod, bool crash)
{ {
byte *buf; byte *buf;
byte stackbuf[1024]; // avoid dirtying the cache heap byte stackbuf[1024]; // avoid dirtying the cache heap
int mod_type; int32_t mod_type;
if (!mod->needload) if (!mod->needload)
{ {
@ -403,9 +403,9 @@ byte *mod_base;
Mod_CheckFullbrights -- johnfitz 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++) for (i = 0; i < count; i++)
if (*pixels++ > 223) if (*pixels++ > 223)
return true; return true;
@ -419,7 +419,7 @@ Mod_LoadTextures
*/ */
void Mod_LoadTextures (lump_t *l) void Mod_LoadTextures (lump_t *l)
{ {
int i, j, pixels, num, maxanim, altmax; int32_t i, j, pixels, num, maxanim, altmax;
miptex_t *mt; miptex_t *mt;
texture_t *tx, *tx2; texture_t *tx, *tx2;
texture_t *anims[10]; texture_t *anims[10];
@ -427,9 +427,9 @@ void Mod_LoadTextures (lump_t *l)
dmiptexlump_t *m; dmiptexlump_t *m;
//johnfitz -- more variables //johnfitz -- more variables
char texturename[64]; char texturename[64];
int nummiptex; int32_t nummiptex;
src_offset_t offset; src_offset_t offset;
int mark, fwidth, fheight; int32_t mark, fwidth, fheight;
char filename[MAX_OSPATH], filename2[MAX_OSPATH], mapname[MAX_OSPATH]; char filename[MAX_OSPATH], filename2[MAX_OSPATH], mapname[MAX_OSPATH];
byte *data; byte *data;
extern byte *hunk_base; extern byte *hunk_base;
@ -536,7 +536,7 @@ void Mod_LoadTextures (lump_t *l)
else //regular texture else //regular texture
{ {
// ericw -- fence textures // ericw -- fence textures
int extraflags; int32_t extraflags;
extraflags = 0; extraflags = 0;
if (tx->name[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) void Mod_LoadLighting (lump_t *l)
{ {
int i, mark; int32_t i, mark;
byte *in, *out, *data; byte *in, *out, *data;
byte d; byte d;
char litfilename[MAX_OSPATH]; char litfilename[MAX_OSPATH];
@ -728,7 +728,7 @@ void Mod_LoadLighting (lump_t *l)
else else
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T') 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) if (i == 1)
{ {
Con_DPrintf2("%s loaded\n", litfilename); Con_DPrintf2("%s loaded\n", litfilename);
@ -791,7 +791,7 @@ void Mod_LoadEntities (lump_t *l)
{ {
char entfilename[MAX_QPATH]; char entfilename[MAX_QPATH];
char *ents; char *ents;
int mark; int32_t mark;
uint32_t path_id; uint32_t path_id;
if (! external_ents.value) if (! external_ents.value)
@ -840,7 +840,7 @@ void Mod_LoadVertexes (lump_t *l)
{ {
dvertex_t *in; dvertex_t *in;
mvertex_t *out; mvertex_t *out;
int i, count; int32_t i, count;
in = (dvertex_t *)(mod_base + l->fileofs); in = (dvertex_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
@ -864,10 +864,10 @@ void Mod_LoadVertexes (lump_t *l)
Mod_LoadEdges Mod_LoadEdges
================= =================
*/ */
void Mod_LoadEdges (lump_t *l, int bsp2) void Mod_LoadEdges (lump_t *l, int32_t bsp2)
{ {
medge_t *out; medge_t *out;
int i, count; int32_t i, count;
if (bsp2) if (bsp2)
{ {
@ -918,9 +918,9 @@ void Mod_LoadTexinfo (lump_t *l)
{ {
texinfo_t *in; texinfo_t *in;
mtexinfo_t *out; mtexinfo_t *out;
int i, j, count, miptex; int32_t i, j, count, miptex;
float len1, len2; float len1, len2;
int missing = 0; //johnfitz int32_t missing = 0; //johnfitz
in = (texinfo_t *)(mod_base + l->fileofs); in = (texinfo_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
@ -992,10 +992,10 @@ Fills in s->texturemins[] and s->extents[]
void CalcSurfaceExtents (msurface_t *s) void CalcSurfaceExtents (msurface_t *s)
{ {
float mins[2], maxs[2], val; float mins[2], maxs[2], val;
int i,j, e; int32_t i,j, e;
mvertex_t *v; mvertex_t *v;
mtexinfo_t *tex; mtexinfo_t *tex;
int bmins[2], bmaxs[2]; int32_t bmins[2], bmaxs[2];
mins[0] = mins[1] = 999999; mins[0] = mins[1] = 999999;
maxs[0] = maxs[1] = -99999; maxs[0] = maxs[1] = -99999;
@ -1062,7 +1062,7 @@ TODO: merge this into BuildSurfaceDisplayList?
void Mod_PolyForUnlitSurface (msurface_t *fa) void Mod_PolyForUnlitSurface (msurface_t *fa)
{ {
vec3_t verts[64]; vec3_t verts[64];
int numverts, i, lindex; int32_t numverts, i, lindex;
float *vec; float *vec;
glpoly_t *poly; glpoly_t *poly;
float texscale; float texscale;
@ -1106,7 +1106,7 @@ Mod_CalcSurfaceBounds -- johnfitz -- calculate bounding box for per-surface frus
*/ */
void Mod_CalcSurfaceBounds (msurface_t *s) void Mod_CalcSurfaceBounds (msurface_t *s)
{ {
int i, e; int32_t i, e;
mvertex_t *v; mvertex_t *v;
s->mins[0] = s->mins[1] = s->mins[2] = 9999; 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; dsface_t *ins;
dlface_t *inl; dlface_t *inl;
msurface_t *out; msurface_t *out;
int i, count, surfnum, lofs; int32_t i, count, surfnum, lofs;
int planenum, side, texinfon; int32_t planenum, side, texinfon;
if (bsp2) if (bsp2)
{ {
@ -1285,7 +1285,7 @@ Mod_LoadNodes
*/ */
void Mod_LoadNodes_S (lump_t *l) void Mod_LoadNodes_S (lump_t *l)
{ {
int i, j, count, p; int32_t i, j, count, p;
dsnode_t *in; dsnode_t *in;
mnode_t *out; mnode_t *out;
@ -1341,7 +1341,7 @@ void Mod_LoadNodes_S (lump_t *l)
void Mod_LoadNodes_L1 (lump_t *l) void Mod_LoadNodes_L1 (lump_t *l)
{ {
int i, j, count, p; int32_t i, j, count, p;
dl1node_t *in; dl1node_t *in;
mnode_t *out; mnode_t *out;
@ -1393,7 +1393,7 @@ void Mod_LoadNodes_L1 (lump_t *l)
void Mod_LoadNodes_L2 (lump_t *l) void Mod_LoadNodes_L2 (lump_t *l)
{ {
int i, j, count, p; int32_t i, j, count, p;
dl2node_t *in; dl2node_t *in;
mnode_t *out; 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) if (bsp2 == 2)
Mod_LoadNodes_L2(l); 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 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; mleaf_t *out;
int i, j, count, p; int32_t i, j, count, p;
if (filelen % sizeof(*in)) if (filelen % sizeof(*in))
Sys_Error ("Mod_ProcessLeafs: funny lump size in %s", loadmodel->name); 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; mleaf_t *out;
int i, j, count, p; int32_t i, j, count, p;
if (filelen % sizeof(*in)) if (filelen % sizeof(*in))
Sys_Error ("Mod_ProcessLeafs: funny lump size in %s", loadmodel->name); 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; mleaf_t *out;
int i, j, count, p; int32_t i, j, count, p;
if (filelen % sizeof(*in)) if (filelen % sizeof(*in))
Sys_Error ("Mod_ProcessLeafs: funny lump size in %s", loadmodel->name); 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 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); void *in = (void *)(mod_base + l->fileofs);
@ -1615,7 +1615,7 @@ void Mod_LoadClipnodes (lump_t *l, bool bsp2)
dlclipnode_t *inl; dlclipnode_t *inl;
mclipnode_t *out; //johnfitz -- was dclipnode_t mclipnode_t *out; //johnfitz -- was dclipnode_t
int i, count; int32_t i, count;
hull_t *hull; hull_t *hull;
if (bsp2) if (bsp2)
@ -1721,7 +1721,7 @@ void Mod_MakeHull0 (void)
{ {
mnode_t *in, *child; mnode_t *in, *child;
mclipnode_t *out; //johnfitz -- was dclipnode_t mclipnode_t *out; //johnfitz -- was dclipnode_t
int i, j, count; int32_t i, j, count;
hull_t *hull; hull_t *hull;
hull = &loadmodel->hulls[0]; hull = &loadmodel->hulls[0];
@ -1754,9 +1754,9 @@ void Mod_MakeHull0 (void)
Mod_LoadMarksurfaces 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; msurface_t **out;
if (bsp2) if (bsp2)
{ {
@ -1814,14 +1814,14 @@ Mod_LoadSurfedges
*/ */
void Mod_LoadSurfedges (lump_t *l) void Mod_LoadSurfedges (lump_t *l)
{ {
int i, count; int32_t i, count;
int *in, *out; int32_t *in, *out;
in = (int *)(mod_base + l->fileofs); in = (int32_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in); 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->surfedges = out;
loadmodel->numsurfedges = count; loadmodel->numsurfedges = count;
@ -1838,11 +1838,11 @@ Mod_LoadPlanes
*/ */
void Mod_LoadPlanes (lump_t *l) void Mod_LoadPlanes (lump_t *l)
{ {
int i, j; int32_t i, j;
mplane_t *out; mplane_t *out;
dplane_t *in; dplane_t *in;
int count; int32_t count;
int bits; int32_t bits;
in = (dplane_t *)(mod_base + l->fileofs); in = (dplane_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) if (l->filelen % sizeof(*in))
@ -1876,7 +1876,7 @@ RadiusFromBounds
*/ */
float RadiusFromBounds (vec3_t mins, vec3_t maxs) float RadiusFromBounds (vec3_t mins, vec3_t maxs)
{ {
int i; int32_t i;
vec3_t corner; vec3_t corner;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
@ -1896,7 +1896,7 @@ void Mod_LoadSubmodels (lump_t *l)
{ {
dmodel_t *in; dmodel_t *in;
dmodel_t *out; dmodel_t *out;
int i, j, count; int32_t i, j, count;
in = (dmodel_t *)(mod_base + l->fileofs); in = (dmodel_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in)) 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. 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; mplane_t *plane;
mclipnode_t *node; mclipnode_t *node;
@ -1989,8 +1989,8 @@ Mod_LoadBrushModel
*/ */
void Mod_LoadBrushModel (qmodel_t *mod, void *buffer) void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
{ {
int i, j; int32_t i, j;
int bsp2; int32_t bsp2;
dheader_t *header; dheader_t *header;
dmodel_t *bm; dmodel_t *bm;
float radius; //johnfitz float radius; //johnfitz
@ -2020,8 +2020,8 @@ void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
// swap all the lumps // swap all the lumps
mod_base = (byte *)header; mod_base = (byte *)header;
for (i = 0; i < (int) sizeof(dheader_t) / 4; i++) for (i = 0; i < (int32_t) sizeof(dheader_t) / 4; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]); ((int32_t *)header)[i] = LittleLong ( ((int32_t *)header)[i]);
// load into heap // load into heap
@ -2120,7 +2120,7 @@ mtriangle_t triangles[MAXALIASTRIS];
// a pose is a single set of vertexes. a frame may be // a pose is a single set of vertexes. a frame may be
// an animating sequence of poses // an animating sequence of poses
trivertx_t *poseverts[MAXALIASFRAMES]; trivertx_t *poseverts[MAXALIASFRAMES];
int posenum; int32_t posenum;
byte **player_8bit_texels_tbl; byte **player_8bit_texels_tbl;
byte *player_8bit_texels; byte *player_8bit_texels;
@ -2133,7 +2133,7 @@ Mod_LoadAliasFrame
void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame) void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame)
{ {
trivertx_t *pinframe; trivertx_t *pinframe;
int i; int32_t i;
daliasframe_t *pdaliasframe; daliasframe_t *pdaliasframe;
pdaliasframe = (daliasframe_t *)pin; pdaliasframe = (daliasframe_t *)pin;
@ -2170,7 +2170,7 @@ Mod_LoadAliasGroup
void *Mod_LoadAliasGroup (void * pin, maliasframedesc_t *frame) void *Mod_LoadAliasGroup (void * pin, maliasframedesc_t *frame)
{ {
daliasgroup_t *pingroup; daliasgroup_t *pingroup;
int i, numframes; int32_t i, numframes;
daliasinterval_t *pin_intervals; daliasinterval_t *pin_intervals;
void *ptemp; void *ptemp;
@ -2239,13 +2239,13 @@ do { \
else if (pos[off] != 255) fdc = pos[off]; \ else if (pos[off] != 255) fdc = pos[off]; \
} while (0) } 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 byte fillcolor = *skin; // assume this is the pixel to fill
floodfill_t fifo[FLOODFILL_FIFO_SIZE]; floodfill_t fifo[FLOODFILL_FIFO_SIZE];
int inpt = 0, outpt = 0; int32_t inpt = 0, outpt = 0;
int filledcolor = -1; int32_t filledcolor = -1;
int i; int32_t i;
if (filledcolor == -1) if (filledcolor == -1)
{ {
@ -2271,8 +2271,8 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
while (outpt != inpt) while (outpt != inpt)
{ {
int x = fifo[outpt].x, y = fifo[outpt].y; int32_t x = fifo[outpt].x, y = fifo[outpt].y;
int fdc = filledcolor; int32_t fdc = filledcolor;
byte *pos = &skin[x + skinwidth * y]; byte *pos = &skin[x + skinwidth * y];
outpt = (outpt + 1) & FLOODFILL_FIFO_MASK; outpt = (outpt + 1) & FLOODFILL_FIFO_MASK;
@ -2290,9 +2290,9 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
Mod_LoadAllSkins 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]; char name[MAX_QPATH];
byte *skin, *texels; byte *skin, *texels;
daliasskingroup_t *pinskingroup; daliasskingroup_t *pinskingroup;
@ -2404,7 +2404,7 @@ Mod_CalcAliasBounds -- johnfitz -- calculate bounds of alias model for nonrotate
*/ */
void Mod_CalcAliasBounds (aliashdr_t *a) void Mod_CalcAliasBounds (aliashdr_t *a)
{ {
int i,j,k; int32_t i,j,k;
float dist, yawradius, radius; float dist, yawradius, radius;
vec3_t v; vec3_t v;
@ -2454,7 +2454,7 @@ nameInList(const char *list, const char *name)
{ {
const char *s; const char *s;
char tmp[MAX_QPATH]; char tmp[MAX_QPATH];
int i; int32_t i;
s = list; s = list;
@ -2517,15 +2517,15 @@ Mod_LoadAliasModel
*/ */
void Mod_LoadAliasModel (qmodel_t *mod, void *buffer) void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
{ {
int i, j; int32_t i, j;
mdl_t *pinmodel; mdl_t *pinmodel;
stvert_t *pinstverts; stvert_t *pinstverts;
dtriangle_t *pintriangles; dtriangle_t *pintriangles;
int version, numframes; int32_t version, numframes;
int size; int32_t size;
daliasframetype_t *pframetype; daliasframetype_t *pframetype;
daliasskintype_t *pskintype; daliasskintype_t *pskintype;
int start, end, total; int32_t start, end, total;
start = Hunk_LowMark (); start = Hunk_LowMark ();
@ -2673,11 +2673,11 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
Mod_LoadSpriteFrame 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; dspriteframe_t *pinframe;
mspriteframe_t *pspriteframe; mspriteframe_t *pspriteframe;
int width, height, size, origin[2]; int32_t width, height, size, origin[2];
char name[64]; char name[64];
src_offset_t offset; //johnfitz src_offset_t offset; //johnfitz
@ -2721,11 +2721,11 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
Mod_LoadSpriteGroup 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; dspritegroup_t *pingroup;
mspritegroup_t *pspritegroup; mspritegroup_t *pspritegroup;
int i, numframes; int32_t i, numframes;
dspriteinterval_t *pin_intervals; dspriteinterval_t *pin_intervals;
float *poutintervals; float *poutintervals;
void *ptemp; void *ptemp;
@ -2775,12 +2775,12 @@ Mod_LoadSpriteModel
*/ */
void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer) void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
{ {
int i; int32_t i;
int version; int32_t version;
dsprite_t *pin; dsprite_t *pin;
msprite_t *psprite; msprite_t *psprite;
int numframes; int32_t numframes;
int size; int32_t size;
dspriteframetype_t *pframetype; dspriteframetype_t *pframetype;
pin = (dsprite_t *)buffer; pin = (dsprite_t *)buffer;
@ -2852,7 +2852,7 @@ Mod_Print
*/ */
void Mod_Print (void) void Mod_Print (void)
{ {
int i; int32_t i;
qmodel_t *mod; qmodel_t *mod;
Con_SafePrintf ("Cached models:\n"); //johnfitz -- safeprint instead of print Con_SafePrintf ("Cached models:\n"); //johnfitz -- safeprint instead of print

View File

@ -91,8 +91,8 @@ typedef struct texture_s
struct gltexture_s *warpimage; //johnfitz -- for water animation struct gltexture_s *warpimage; //johnfitz -- for water animation
bool update_warp; //johnfitz -- update warp this frame bool update_warp; //johnfitz -- update warp this frame
struct msurface_s *texturechains[2]; // for texture chains struct msurface_s *texturechains[2]; // for texture chains
int anim_total; // total tenths in sequence ( 0 = no) int32_t anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max 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 *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frmae 1 use these struct texture_s *alternate_anims; // bmodels in frmae 1 use these
unsigned offsets[MIPLEVELS]; // four mip maps stored unsigned offsets[MIPLEVELS]; // four mip maps stored
@ -125,7 +125,7 @@ typedef struct
float vecs[2][4]; float vecs[2][4];
float mipadjust; float mipadjust;
texture_t *texture; texture_t *texture;
int flags; int32_t flags;
} mtexinfo_t; } mtexinfo_t;
#define VERTEXSIZE 7 #define VERTEXSIZE 7
@ -134,43 +134,43 @@ typedef struct glpoly_s
{ {
struct glpoly_s *next; struct glpoly_s *next;
struct glpoly_s *chain; struct glpoly_s *chain;
int numverts; int32_t numverts;
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2) float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} glpoly_t; } glpoly_t;
typedef struct msurface_s 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 bool culled; // johnfitz -- for frustum culling
float mins[3]; // johnfitz -- for frustum culling float mins[3]; // johnfitz -- for frustum culling
float maxs[3]; // johnfitz -- for frustum culling float maxs[3]; // johnfitz -- for frustum culling
mplane_t *plane; mplane_t *plane;
int flags; int32_t flags;
int firstedge; // look up in model->surfedges[], negative numbers int32_t firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges int32_t numedges; // are backwards edges
int16_t texturemins[2]; int16_t texturemins[2];
int16_t extents[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 glpoly_t *polys; // multiple if warped
struct msurface_s *texturechain; struct msurface_s *texturechain;
mtexinfo_t *texinfo; 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 // lighting info
int dlightframe; int32_t dlightframe;
uint32_t dlightbits[(MAX_DLIGHTS + 31) >> 5]; 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]; 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 bool cached_dlight; // true if dynamic light in cache
byte *samples; // [numstyles*surfsize] byte *samples; // [numstyles*surfsize]
} msurface_t; } msurface_t;
@ -178,8 +178,8 @@ typedef struct msurface_s
typedef struct mnode_s typedef struct mnode_s
{ {
// common with leaf // common with leaf
int contents; // 0, to differentiate from leafs int32_t contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current int32_t visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling float minmaxs[6]; // for bounding box culling
@ -189,8 +189,8 @@ typedef struct mnode_s
mplane_t *plane; mplane_t *plane;
struct mnode_s *children[2]; struct mnode_s *children[2];
int firstsurface; int32_t firstsurface;
int numsurfaces; int32_t numsurfaces;
} mnode_t; } mnode_t;
@ -198,8 +198,8 @@ typedef struct mnode_s
typedef struct mleaf_s typedef struct mleaf_s
{ {
// common with node // common with node
int contents; // wil be a negative contents number int32_t contents; // wil be a negative contents number
int visframe; // node needs to be traversed if current int32_t visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling float minmaxs[6]; // for bounding box culling
@ -210,16 +210,16 @@ typedef struct mleaf_s
efrag_t *efrags; efrag_t *efrags;
msurface_t **firstmarksurface; msurface_t **firstmarksurface;
int nummarksurfaces; int32_t nummarksurfaces;
int key; // BSP sequence number for leaf's contents int32_t key; // BSP sequence number for leaf's contents
byte ambient_sound_level[NUM_AMBIENTS]; byte ambient_sound_level[NUM_AMBIENTS];
} mleaf_t; } mleaf_t;
//johnfitz -- for clipnodes>32k //johnfitz -- for clipnodes>32k
typedef struct mclipnode_s typedef struct mclipnode_s
{ {
int planenum; int32_t planenum;
int children[2]; // negative numbers are contents int32_t children[2]; // negative numbers are contents
} mclipnode_t; } mclipnode_t;
//johnfitz //johnfitz
@ -228,8 +228,8 @@ typedef struct
{ {
mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t
mplane_t *planes; mplane_t *planes;
int firstclipnode; int32_t firstclipnode;
int lastclipnode; int32_t lastclipnode;
vec3_t clip_mins; vec3_t clip_mins;
vec3_t clip_maxs; vec3_t clip_maxs;
} hull_t; } hull_t;
@ -246,7 +246,7 @@ SPRITE MODELS
// FIXME: shorten these? // FIXME: shorten these?
typedef struct mspriteframe_s typedef struct mspriteframe_s
{ {
int width, height; int32_t width, height;
float up, down, left, right; float up, down, left, right;
float smax, tmax; //johnfitz -- image might be padded float smax, tmax; //johnfitz -- image might be padded
struct gltexture_s *gltexture; struct gltexture_s *gltexture;
@ -254,7 +254,7 @@ typedef struct mspriteframe_s
typedef struct typedef struct
{ {
int numframes; int32_t numframes;
float *intervals; float *intervals;
mspriteframe_t *frames[1]; mspriteframe_t *frames[1];
} mspritegroup_t; } mspritegroup_t;
@ -267,10 +267,10 @@ typedef struct
typedef struct typedef struct
{ {
int type; int32_t type;
int maxwidth; int32_t maxwidth;
int maxheight; int32_t maxheight;
int numframes; int32_t numframes;
float beamlength; // remove? float beamlength; // remove?
void *cachespot; // remove? void *cachespot; // remove?
mspriteframedesc_t frames[1]; mspriteframedesc_t frames[1];
@ -308,12 +308,12 @@ typedef struct meshst_s
typedef struct typedef struct
{ {
int firstpose; int32_t firstpose;
int numposes; int32_t numposes;
float interval; float interval;
trivertx_t bboxmin; trivertx_t bboxmin;
trivertx_t bboxmax; trivertx_t bboxmax;
int frame; int32_t frame;
char name[16]; char name[16];
} maliasframedesc_t; } maliasframedesc_t;
@ -321,56 +321,56 @@ typedef struct
{ {
trivertx_t bboxmin; trivertx_t bboxmin;
trivertx_t bboxmax; trivertx_t bboxmax;
int frame; int32_t frame;
} maliasgroupframedesc_t; } maliasgroupframedesc_t;
typedef struct typedef struct
{ {
int numframes; int32_t numframes;
int intervals; int32_t intervals;
maliasgroupframedesc_t frames[1]; maliasgroupframedesc_t frames[1];
} maliasgroup_t; } maliasgroup_t;
// !!! if this is changed, it must be changed in asm_draw.h too !!! // !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct mtriangle_s { typedef struct mtriangle_s {
int facesfront; int32_t facesfront;
int vertindex[3]; int32_t vertindex[3];
} mtriangle_t; } mtriangle_t;
#define MAX_SKINS 32 #define MAX_SKINS 32
typedef struct { typedef struct {
int ident; int32_t ident;
int version; int32_t version;
vec3_t scale; vec3_t scale;
vec3_t scale_origin; vec3_t scale_origin;
float boundingradius; float boundingradius;
vec3_t eyeposition; vec3_t eyeposition;
int numskins; int32_t numskins;
int skinwidth; int32_t skinwidth;
int skinheight; int32_t skinheight;
int numverts; int32_t numverts;
int numtris; int32_t numtris;
int numframes; int32_t numframes;
synctype_t synctype; synctype_t synctype;
int flags; int32_t flags;
float size; float size;
//ericw -- used to populate vbo //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 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 indexes; // offset into extradata: numindexes unsigned shorts
intptr_t vertexes; // offset into extradata: numposes*vertsperframe trivertx_t intptr_t vertexes; // offset into extradata: numposes*vertsperframe trivertx_t
//ericw -- //ericw --
int numposes; int32_t numposes;
int poseverts; int32_t poseverts;
int posedata; // numposes*poseverts trivert_t int32_t posedata; // numposes*poseverts trivert_t
int commands; // gl command list with embedded s/t int32_t commands; // gl command list with embedded s/t
struct gltexture_s *gltextures[MAX_SKINS][4]; //johnfitz struct gltexture_s *gltextures[MAX_SKINS][4]; //johnfitz
struct gltexture_s *fbtextures[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 maliasframedesc_t frames[1]; // variable sized
} aliashdr_t; } aliashdr_t;
@ -414,10 +414,10 @@ typedef struct qmodel_s
bool needload; // bmodels and sprites don't cache normally bool needload; // bmodels and sprites don't cache normally
modtype_t type; modtype_t type;
int numframes; int32_t numframes;
synctype_t synctype; synctype_t synctype;
int flags; int32_t flags;
// //
// volume occupied by the model graphics // volume occupied by the model graphics
@ -436,44 +436,44 @@ typedef struct qmodel_s
// //
// brush model // brush model
// //
int firstmodelsurface, nummodelsurfaces; int32_t firstmodelsurface, nummodelsurfaces;
int numsubmodels; int32_t numsubmodels;
dmodel_t *submodels; dmodel_t *submodels;
int numplanes; int32_t numplanes;
mplane_t *planes; 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; mleaf_t *leafs;
int numvertexes; int32_t numvertexes;
mvertex_t *vertexes; mvertex_t *vertexes;
int numedges; int32_t numedges;
medge_t *edges; medge_t *edges;
int numnodes; int32_t numnodes;
mnode_t *nodes; mnode_t *nodes;
int numtexinfo; int32_t numtexinfo;
mtexinfo_t *texinfo; mtexinfo_t *texinfo;
int numsurfaces; int32_t numsurfaces;
msurface_t *surfaces; msurface_t *surfaces;
int numsurfedges; int32_t numsurfedges;
int *surfedges; int32_t *surfedges;
int numclipnodes; int32_t numclipnodes;
mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t
int nummarksurfaces; int32_t nummarksurfaces;
msurface_t **marksurfaces; msurface_t **marksurfaces;
hull_t hulls[MAX_MAP_HULLS]; hull_t hulls[MAX_MAP_HULLS];
int numtextures; int32_t numtextures;
texture_t **textures; texture_t **textures;
byte *visdata; byte *visdata;
@ -482,7 +482,7 @@ typedef struct qmodel_s
bool viswarn; // for Mod_DecompressVis() bool viswarn; // for Mod_DecompressVis()
int bspversion; int32_t bspversion;
// //
// alias model // alias model
@ -490,9 +490,9 @@ typedef struct qmodel_s
GLuint meshvbo; GLuint meshvbo;
GLuint meshindexesvbo; GLuint meshindexesvbo;
int vboindexofs; // offset in vbo of the hdr->numindexes unsigned shorts int32_t vboindexofs; // offset in vbo of the hdr->numindexes unsigned shorts
int vboxyzofs; // offset in vbo of hdr->numposes*hdr->numverts_vbo meshxyz_t int32_t 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 vbostofs; // offset in vbo of hdr->numverts_vbo meshst_t
// //
// additional model data // additional model data

View File

@ -72,7 +72,7 @@ static efrag_t *R_GetEfrag (void)
} }
else else
{ {
int i; int32_t i;
cl.free_efrags = (efrag_t *) Hunk_AllocName (EXTRA_EFRAGS * sizeof (efrag_t), "efrags"); 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; efrag_t *ef;
mplane_t *splitplane; mplane_t *splitplane;
mleaf_t *leaf; mleaf_t *leaf;
int sides; int32_t sides;
if (node->contents == CONTENTS_SOLID) if (node->contents == CONTENTS_SOLID)
{ {
@ -169,7 +169,7 @@ R_AddEfrags
void R_AddEfrags (entity_t *ent) void R_AddEfrags (entity_t *ent)
{ {
qmodel_t *entmodel; qmodel_t *entmodel;
int i; int32_t i;
if (!ent->model) if (!ent->model)
return; return;

View File

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
int r_dlightframecount; int32_t r_dlightframecount;
extern cvar_t r_flatlightstyles; //johnfitz extern cvar_t r_flatlightstyles; //johnfitz
@ -34,12 +34,12 @@ R_AnimateLight
*/ */
void R_AnimateLight (void) void R_AnimateLight (void)
{ {
int i,j,k; int32_t i,j,k;
// //
// light animations // light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright // '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 ; j<MAX_LIGHTSTYLES ; j++) for (j=0 ; j<MAX_LIGHTSTYLES ; j++)
{ {
if (!cl_lightstyle[j].length) if (!cl_lightstyle[j].length)
@ -85,7 +85,7 @@ void AddLightBlend (float r, float g, float b, float a2)
void R_RenderDlight (dlight_t *light) void R_RenderDlight (dlight_t *light)
{ {
int i, j; int32_t i, j;
float a; float a;
vec3_t v; vec3_t v;
float rad; float rad;
@ -123,7 +123,7 @@ R_RenderDlights
*/ */
void R_RenderDlights (void) void R_RenderDlights (void)
{ {
int i; int32_t i;
dlight_t *l; dlight_t *l;
if (!gl_flashblend.value) if (!gl_flashblend.value)
@ -166,13 +166,13 @@ DYNAMIC LIGHTS
R_MarkLights -- johnfitz -- rewritten to use LordHavoc's lighting speedup R_MarkLights -- johnfitz -- rewritten to use LordHavoc's lighting speedup
============= =============
*/ */
void R_MarkLights (dlight_t *light, int num, mnode_t *node) void R_MarkLights (dlight_t *light, int32_t num, mnode_t *node)
{ {
mplane_t *splitplane; mplane_t *splitplane;
msurface_t *surf; msurface_t *surf;
vec3_t impact; vec3_t impact;
float dist, l, maxdist; float dist, l, maxdist;
int i, j, s, t; int32_t i, j, s, t;
start: start:
@ -236,7 +236,7 @@ R_PushDlights
*/ */
void R_PushDlights (void) void R_PushDlights (void)
{ {
int i; int32_t i;
dlight_t *l; dlight_t *l;
if (gl_flashblend.value) if (gl_flashblend.value)
@ -272,7 +272,7 @@ vec3_t lightcolor; //johnfitz -- lit support via lordhavoc
RecursiveLightPoint -- johnfitz -- replaced entire function for lit support via lordhavoc RecursiveLightPoint -- johnfitz -- replaced entire function for lit support via lordhavoc
============= =============
*/ */
int RecursiveLightPoint (vec3_t color, mnode_t *node, vec3_t start, vec3_t end) int32_t RecursiveLightPoint (vec3_t color, mnode_t *node, vec3_t start, vec3_t end)
{ {
float front, back, frac; float front, back, frac;
vec3_t mid; vec3_t mid;
@ -311,7 +311,7 @@ loc0:
return true; // hit something return true; // hit something
else else
{ {
int i, ds, dt; int32_t i, ds, dt;
msurface_t *surf; msurface_t *surf;
// check for impact on this node // check for impact on this node
VectorCopy (mid, lightspot); VectorCopy (mid, lightspot);
@ -326,8 +326,8 @@ loc0:
// ericw -- added double casts to force 64-bit precision. // ericw -- added double casts to force 64-bit precision.
// Without them the zombie at the start of jam3_ericw.bsp was // Without them the zombie at the start of jam3_ericw.bsp was
// incorrectly being lit up in SSE builds. // incorrectly being lit up in SSE builds.
ds = (int) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]); ds = (int32_t) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]);
dt = (int) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][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]) if (ds < surf->texturemins[0] || dt < surf->texturemins[1])
continue; continue;
@ -342,7 +342,7 @@ loc0:
{ {
// LordHavoc: enhanced to interpolate lighting // LordHavoc: enhanced to interpolate lighting
byte *lightmap; 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; float scale;
line3 = ((surf->extents[0]>>4)+1)*3; 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 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[0] += (float) ((int32_t) ((((((((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[1] += (float) ((int32_t) ((((((((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[2] += (float) ((int32_t) ((((((((b11-b10) * dsfrac) >> 4) + b10)-((((b01-b00) * dsfrac) >> 4) + b00)) * dtfrac) >> 4) + ((((b01-b00) * dsfrac) >> 4) + b00)));
} }
return true; // success return true; // success
} }
@ -375,7 +375,7 @@ loc0:
R_LightPoint -- johnfitz -- replaced entire function for lit support via lordhavoc 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; vec3_t end;

View File

@ -28,14 +28,14 @@ bool r_cache_thrash; // compatability
vec3_t modelorg, r_entorigin; vec3_t modelorg, r_entorigin;
entity_t *currententity; entity_t *currententity;
int r_visframecount; // bumped when going to a new PVS int32_t r_visframecount; // bumped when going to a new PVS
int r_framecount; // used for dlight push checking int32_t r_framecount; // used for dlight push checking
mplane_t frustum[4]; mplane_t frustum[4];
//johnfitz -- rendering statistics //johnfitz -- rendering statistics
int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys; int32_t rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses; int32_t rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
float rs_megatexels; float rs_megatexels;
// //
@ -55,7 +55,7 @@ refdef_t r_refdef;
mleaf_t *r_viewleaf, *r_oldviewleaf; 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}; 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_texture;
static GLuint r_gamma_program; 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 // uniforms used in gamma shader
static GLuint gammaLoc; 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) bool R_CullBox (vec3_t emins, vec3_t emaxs)
{ {
int i; int32_t i;
mplane_t *p; mplane_t *p;
for (i = 0;i < 4;i++) for (i = 0;i < 4;i++)
{ {
@ -362,7 +362,7 @@ GL_PolygonOffset -- johnfitz
negative offset moves polygon closer to camera negative offset moves polygon closer to camera
============= =============
*/ */
void GL_PolygonOffset (int offset) void GL_PolygonOffset (int32_t offset)
{ {
if (offset > 0) 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 // for fast box on planeside test
@ -434,7 +434,7 @@ R_SetFrustum -- johnfitz -- rewritten
*/ */
void R_SetFrustum (float fovx, float fovy) void R_SetFrustum (float fovx, float fovy)
{ {
int i; int32_t i;
if (r_stereo.value) if (r_stereo.value)
fovx += 10; //silly hack so that polygons don't drop out becuase of stereo skew 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) void R_SetupGL (void)
{ {
int scale; int32_t scale;
//johnfitz -- rewrote this section //johnfitz -- rewrote this section
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity (); 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, glViewport (glx + r_refdef.vrect.x,
gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height, gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height,
r_refdef.vrect.width / scale, r_refdef.vrect.width / scale,
@ -571,7 +571,7 @@ void R_SetupView (void)
r_fovy = r_refdef.fov_y; r_fovy = r_refdef.fov_y;
if (r_waterwarp.value) 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) 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! //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 void R_DrawEntitiesOnList (bool alphapass) //johnfitz -- added parameter
{ {
int i; int32_t i;
if (!r_drawentities.value) if (!r_drawentities.value)
return; return;
@ -689,7 +689,7 @@ R_EmitWirePoint -- johnfitz -- draws a wireframe cross shape for point entities
*/ */
void R_EmitWirePoint (vec3_t origin) void R_EmitWirePoint (vec3_t origin)
{ {
int size=8; int32_t size=8;
glBegin (GL_LINES); glBegin (GL_LINES);
glVertex3f (origin[0]-size, origin[1], origin[2]); glVertex3f (origin[0]-size, origin[1], origin[2]);
@ -734,7 +734,7 @@ void R_ShowBoundingBoxes (void)
extern edict_t *sv_player; extern edict_t *sv_player;
vec3_t mins,maxs; vec3_t mins,maxs;
edict_t *ed; edict_t *ed;
int i; int32_t i;
if (!r_showbboxes.value || cl.maxclients > 1 || !r_drawentities.value || !sv.active) if (!r_showbboxes.value || cl.maxclients > 1 || !r_drawentities.value || !sv.active)
return; return;
@ -787,7 +787,7 @@ R_ShowTris -- johnfitz
void R_ShowTris (void) void R_ShowTris (void)
{ {
extern cvar_t r_particles; extern cvar_t r_particles;
int i; int32_t i;
if (r_showtris.value < 1 || r_showtris.value > 2 || cl.maxclients > 1) if (r_showtris.value < 1 || r_showtris.value > 2 || cl.maxclients > 1)
return; return;
@ -870,7 +870,7 @@ R_DrawShadows
*/ */
void R_DrawShadows (void) void R_DrawShadows (void)
{ {
int i; int32_t i;
if (!r_shadows.value || !r_drawentities.value || r_drawflat_cheatsafe || r_lightmap_cheatsafe) if (!r_shadows.value || !r_drawentities.value || r_drawflat_cheatsafe || r_lightmap_cheatsafe)
return; return;
@ -942,7 +942,7 @@ void R_RenderScene (void)
} }
static GLuint r_scaleview_texture; 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) void R_ScaleView (void)
{ {
float smax, tmax; float smax, tmax;
int scale; int32_t scale;
int srcx, srcy, srcw, srch; int32_t srcx, srcy, srcw, srch;
// copied from R_SetupGL() // 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; srcx = glx + r_refdef.vrect.x;
srcy = gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height; srcy = gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height;
srcw = r_refdef.vrect.width / scale; srcw = r_refdef.vrect.width / scale;
@ -1090,7 +1090,7 @@ void R_RenderView (void)
glColorMask(1, 0, 0, 1); glColorMask(1, 0, 0, 1);
VectorMA (r_refdef.vieworg, -0.5f * eyesep, vright, r_refdef.vieworg); VectorMA (r_refdef.vieworg, -0.5f * eyesep, vright, r_refdef.vieworg);
frustum_skew = 0.5 * eyesep * NEARCLIP / fdepth; 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 (); R_RenderScene ();
@ -1099,7 +1099,7 @@ void R_RenderView (void)
glColorMask(0, 1, 1, 1); glColorMask(0, 1, 1, 1);
VectorMA (r_refdef.vieworg, 1.0f * eyesep, vright, r_refdef.vieworg); VectorMA (r_refdef.vieworg, 1.0f * eyesep, vright, r_refdef.vieworg);
frustum_skew = -frustum_skew; 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 (); R_RenderScene ();
@ -1120,15 +1120,15 @@ void R_RenderView (void)
time2 = Sys_DoubleTime (); time2 = Sys_DoubleTime ();
if (r_pos.value) if (r_pos.value)
Con_Printf ("x %i y %i z %i (pitch %i yaw %i roll %i)\n", Con_Printf ("x %i y %i z %i (pitch %i yaw %i roll %i)\n",
(int)cl_entities[cl.viewentity].origin[0], (int32_t)cl_entities[cl.viewentity].origin[0],
(int)cl_entities[cl.viewentity].origin[1], (int32_t)cl_entities[cl.viewentity].origin[1],
(int)cl_entities[cl.viewentity].origin[2], (int32_t)cl_entities[cl.viewentity].origin[2],
(int)cl.viewangles[PITCH], (int32_t)cl.viewangles[PITCH],
(int)cl.viewangles[YAW], (int32_t)cl.viewangles[YAW],
(int)cl.viewangles[ROLL]); (int32_t)cl.viewangles[ROLL]);
else if (r_speeds.value == 2) 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", 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_brushpolys,
rs_brushpasses, rs_brushpasses,
rs_aliaspolys, rs_aliaspolys,
@ -1139,7 +1139,7 @@ void R_RenderView (void)
TexMgr_FrameUsage ()); TexMgr_FrameUsage ());
else if (r_speeds.value) else if (r_speeds.value)
Con_Printf ("%3i ms %4i wpoly %4i epoly %3i lmap\n", Con_Printf ("%3i ms %4i wpoly %4i epoly %3i lmap\n",
(int)((time2-time1)*1000), (int32_t)((time2-time1)*1000),
rs_brushpolys, rs_brushpolys,
rs_aliaspolys, rs_aliaspolys,
rs_dynamiclightmaps); rs_dynamiclightmaps);

View File

@ -81,10 +81,10 @@ R_SetClearColor_f -- johnfitz
static void R_SetClearColor_f (cvar_t *var) static void R_SetClearColor_f (cvar_t *var)
{ {
byte *rgb; byte *rgb;
int s; int32_t s;
(void)var; (void)var;
s = (int)r_clearcolor.value & 0xFF; s = (int32_t)r_clearcolor.value & 0xFF;
rgb = (byte*)(d_8to24table + s); rgb = (byte*)(d_8to24table + s);
glClearColor (rgb[0]/255.0,rgb[1]/255.0,rgb[2]/255.0,0); 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) static void R_VisChanged (cvar_t *var)
{ {
extern int vis_changed; extern int32_t vis_changed;
(void)var; (void)var;
vis_changed = 1; 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) static void R_Model_ExtraFlags_List_f (cvar_t *var)
{ {
(void)var; (void)var;
int i; int32_t i;
for (i=0; i < MAX_MODELS; i++) for (i=0; i < MAX_MODELS; i++)
Mod_SetExtraFlags (cl.model_precache[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 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; top = (cl.scores[playernum].colors & 0xf0)>>4;
bottom = cl.scores[playernum].colors &15; 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 added bug fix from bengt jardup
=============== ===============
*/ */
void R_TranslateNewPlayerSkin (int playernum) void R_TranslateNewPlayerSkin (int32_t playernum)
{ {
char name[64]; char name[64];
byte *pixels; byte *pixels;
aliashdr_t *paliashdr; aliashdr_t *paliashdr;
int skinnum; int32_t skinnum;
//get correct texture pixels //get correct texture pixels
currententity = &cl_entities[1+playernum]; currententity = &cl_entities[1+playernum];
@ -320,7 +320,7 @@ R_NewGame -- johnfitz -- handle a game switch
*/ */
void R_NewGame (void) void R_NewGame (void)
{ {
int i; int32_t i;
//clear playertexture pointers (the textures themselves were freed by texmgr_newgame) //clear playertexture pointers (the textures themselves were freed by texmgr_newgame)
for (i=0; i<MAX_SCOREBOARD; i++) for (i=0; i<MAX_SCOREBOARD; i++)
@ -389,7 +389,7 @@ R_NewMap
*/ */
void R_NewMap (void) void R_NewMap (void)
{ {
int i; int32_t i;
for (i=0 ; i<256 ; i++) for (i=0 ; i<256 ; i++)
d_lightstylevalue[i] = 264; // normal light value d_lightstylevalue[i] = 264; // normal light value
@ -425,7 +425,7 @@ For program optimization
*/ */
void R_TimeRefresh_f (void) void R_TimeRefresh_f (void)
{ {
int i; int32_t i;
float start, stop, time; float start, stop, time;
if (cls.state != ca_connected) if (cls.state != ca_connected)
@ -454,7 +454,7 @@ void D_FlushCaches (void)
} }
static GLuint gl_programs[16]; static GLuint gl_programs[16];
static int gl_num_programs; static int32_t gl_num_programs;
static bool GL_CheckShader (GLuint shader) static bool GL_CheckShader (GLuint shader)
{ {
@ -522,9 +522,9 @@ GL_CreateProgram
Compiles and returns GLSL program. Compiles and returns GLSL program.
==================== ====================
*/ */
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)
{ {
int i; int32_t i;
GLuint program, vertShader, fragShader; GLuint program, vertShader, fragShader;
if (!gl_glsl_able) if (!gl_glsl_able)
@ -588,7 +588,7 @@ Deletes any GLSL programs that have been created.
*/ */
void R_DeleteShaders (void) void R_DeleteShaders (void)
{ {
int i; int32_t i;
if (!gl_glsl_able) if (!gl_glsl_able)
return; return;
@ -625,7 +625,7 @@ void GL_BindBuffer (GLenum target, GLuint buffer)
cache = &current_element_array_buffer; cache = &current_element_array_buffer;
break; break;
default: default:
Host_Error("GL_BindBuffer: unsupported target %d", (int)target); Host_Error("GL_BindBuffer: unsupported target %d", (int32_t)target);
return; return;
} }

View File

@ -72,7 +72,7 @@ console is:
*/ */
int glx, gly, glwidth, glheight; int32_t glx, gly, glwidth, glheight;
float scr_con_current; float scr_con_current;
float scr_conlines; // lines of console to display float scr_conlines; // lines of console to display
@ -107,8 +107,8 @@ qpic_t *scr_ram;
qpic_t *scr_net; qpic_t *scr_net;
qpic_t *scr_turtle; qpic_t *scr_turtle;
int clearconsole; int32_t clearconsole;
int clearnotify; int32_t clearnotify;
vrect_t scr_vrect; vrect_t scr_vrect;
@ -116,7 +116,7 @@ bool scr_disabled_for_loading;
bool scr_drawloading; bool scr_drawloading;
float scr_disabled_time; float scr_disabled_time;
int scr_tileclear_updates = 0; //johnfitz int32_t scr_tileclear_updates = 0; //johnfitz
void SCR_ScreenShot_f (void); void SCR_ScreenShot_f (void);
@ -131,9 +131,9 @@ CENTER PRINTING
char scr_centerstring[1024]; char scr_centerstring[1024];
float scr_centertime_start; // for slow victory printing float scr_centertime_start; // for slow victory printing
float scr_centertime_off; float scr_centertime_off;
int scr_center_lines; int32_t scr_center_lines;
int scr_erase_lines; int32_t scr_erase_lines;
int scr_erase_center; int32_t scr_erase_center;
/* /*
============== ==============
@ -163,10 +163,10 @@ void SCR_CenterPrint (const char *str) //update centerprint data
void SCR_DrawCenterString (void) //actually do the drawing void SCR_DrawCenterString (void) //actually do the drawing
{ {
char *start; char *start;
int l; int32_t l;
int j; int32_t j;
int x, y; int32_t x, y;
int remaining; int32_t remaining;
GL_SetCanvas (CANVAS_MENU); //johnfitz GL_SetCanvas (CANVAS_MENU); //johnfitz
@ -370,7 +370,7 @@ void SCR_Conwidth_f (cvar_t *var)
{ {
(void)var; (void)var;
vid.recalc_refdef = 1; vid.recalc_refdef = 1;
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 = CLAMP (320, vid.conwidth, vid.width);
vid.conwidth &= 0xFFFFFFF8; vid.conwidth &= 0xFFFFFFF8;
vid.conheight = vid.conwidth * vid.height / vid.width; vid.conheight = vid.conwidth * vid.height / vid.width;
@ -444,9 +444,9 @@ void SCR_DrawFPS (void)
{ {
static double oldtime = 0; static double oldtime = 0;
static double lastfps = 0; static double lastfps = 0;
static int oldframecount = 0; static int32_t oldframecount = 0;
double elapsed_time; double elapsed_time;
int frames; int32_t frames;
elapsed_time = realtime - oldtime; elapsed_time = realtime - oldtime;
frames = r_framecount - oldframecount; frames = r_framecount - oldframecount;
@ -468,7 +468,7 @@ void SCR_DrawFPS (void)
if (scr_showfps.value) if (scr_showfps.value)
{ {
char st[16]; char st[16];
int x, y; int32_t x, y;
sprintf (st, "%4.0f fps", lastfps); sprintf (st, "%4.0f fps", lastfps);
x = 320 - (strlen(st)<<3); x = 320 - (strlen(st)<<3);
y = 200 - 8; y = 200 - 8;
@ -490,10 +490,10 @@ void SCR_DrawClock (void)
if (scr_clock.value == 1) if (scr_clock.value == 1)
{ {
int minutes, seconds; int32_t minutes, seconds;
minutes = cl.time / 60; 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); sprintf (str,"%i:%i%i", minutes, seconds/10, seconds%10);
} }
@ -515,8 +515,8 @@ SCR_DrawDevStats
void SCR_DrawDevStats (void) void SCR_DrawDevStats (void)
{ {
char str[40]; char str[40];
int y = 25-9; //9=number of lines to print int32_t y = 25-9; //9=number of lines to print
int x = 0; //margin int32_t x = 0; //margin
if (!devstats.value) if (!devstats.value)
return; return;
@ -578,7 +578,7 @@ SCR_DrawTurtle
*/ */
void SCR_DrawTurtle (void) void SCR_DrawTurtle (void)
{ {
static int count; static int32_t count;
if (!scr_showturtle.value) if (!scr_showturtle.value)
return; return;
@ -778,7 +778,7 @@ void SCR_ScreenShot_f (void)
char ext[4]; char ext[4];
char imagename[16]; //johnfitz -- was [80] char imagename[16]; //johnfitz -- was [80]
char checkname[MAX_OSPATH]; char checkname[MAX_OSPATH];
int i, quality; int32_t i, quality;
bool ok; bool ok;
Q_strncpy (ext, "png", sizeof(ext)); Q_strncpy (ext, "png", sizeof(ext));
@ -903,9 +903,9 @@ bool scr_drawdialog;
void SCR_DrawNotifyString (void) void SCR_DrawNotifyString (void)
{ {
const char *start; const char *start;
int l; int32_t l;
int j; int32_t j;
int x, y; int32_t x, y;
GL_SetCanvas (CANVAS_MENU); //johnfitz 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. 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 double time1, time2; //johnfitz -- timeout
int lastkey, lastchar; int32_t lastkey, lastchar;
if (cls.state == ca_dedicated) if (cls.state == ca_dedicated)
return true; return true;

View File

@ -30,8 +30,8 @@ float Fog_GetDensity(void);
float *Fog_GetColor(void); float *Fog_GetColor(void);
extern qmodel_t *loadmodel; extern qmodel_t *loadmodel;
extern int rs_skypolys; //for r_speeds readout extern int32_t rs_skypolys; //for r_speeds readout
extern int rs_skypasses; //for r_speeds readout extern int32_t rs_skypasses; //for r_speeds readout
float skyflatcolor[3]; float skyflatcolor[3];
float skymins[2][6], skymaxs[2][6]; 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_skyalpha = {"r_skyalpha", "1", CVAR_NONE};
cvar_t r_skyfog = {"r_skyfog","0.5",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] = { vec3_t skyclip[6] = {
{1,1,0}, {1,1,0},
@ -57,7 +57,7 @@ vec3_t skyclip[6] = {
{-1,0,1} {-1,0,1}
}; };
int st_to_vec[6][3] = int32_t st_to_vec[6][3] =
{ {
{3,-1,2}, {3,-1,2},
{-3,1,2}, {-3,1,2},
@ -67,7 +67,7 @@ int st_to_vec[6][3] =
{2,-1,-3} // straight down {2,-1,-3} // straight down
}; };
int vec_to_st[6][3] = int32_t vec_to_st[6][3] =
{ {
{-2,3,1}, {-2,3,1},
{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) void Sky_LoadTexture (texture_t *mt)
{ {
char texturename[64]; char texturename[64];
int i, j, p, r, g, b, count; int32_t i, j, p, r, g, b, count;
byte *src; byte *src;
static byte front_data[128*128]; //FIXME: Hunk_Alloc static byte front_data[128*128]; //FIXME: Hunk_Alloc
static byte back_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"}; const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
void Sky_LoadSkyBox (const char *name) void Sky_LoadSkyBox (const char *name)
{ {
int i, mark, width, height; int32_t i, mark, width, height;
char filename[MAX_OSPATH]; char filename[MAX_OSPATH];
byte *data; byte *data;
bool nonefound = true; bool nonefound = true;
@ -217,7 +217,7 @@ void Sky_NewMap (void)
{ {
char key[128], value[4096]; char key[128], value[4096];
const char *data; const char *data;
int i; int32_t i;
// //
// initially no sky // initially no sky
@ -311,7 +311,7 @@ Sky_Init
*/ */
void Sky_Init (void) void Sky_Init (void)
{ {
int i; int32_t i;
Cvar_RegisterVariable (&r_fastsky); Cvar_RegisterVariable (&r_fastsky);
Cvar_RegisterVariable (&r_sky_quality); Cvar_RegisterVariable (&r_sky_quality);
@ -338,12 +338,12 @@ Sky_ProjectPoly
update sky bounds 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; vec3_t v, av;
float s, t, dv; float s, t, dv;
int axis; int32_t axis;
float *vp; float *vp;
// decide which face it maps to // decide which face it maps to
@ -413,17 +413,17 @@ void Sky_ProjectPoly (int nump, vec3_t vecs)
Sky_ClipPoly 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 *norm;
float *v; float *v;
bool front, back; bool front, back;
float d, e; float d, e;
float dists[MAX_CLIP_VERTS]; float dists[MAX_CLIP_VERTS];
int sides[MAX_CLIP_VERTS]; int32_t sides[MAX_CLIP_VERTS];
vec3_t newv[2][MAX_CLIP_VERTS]; vec3_t newv[2][MAX_CLIP_VERTS];
int newc[2]; int32_t newc[2];
int i, j; int32_t i, j;
if (nump > MAX_CLIP_VERTS-2) if (nump > MAX_CLIP_VERTS-2)
Sys_Error ("Sky_ClipPoly: MAX_CLIP_VERTS"); Sys_Error ("Sky_ClipPoly: MAX_CLIP_VERTS");
@ -511,7 +511,7 @@ Sky_ProcessPoly
*/ */
void Sky_ProcessPoly (glpoly_t *p) void Sky_ProcessPoly (glpoly_t *p)
{ {
int i; int32_t i;
vec3_t verts[MAX_CLIP_VERTS]; vec3_t verts[MAX_CLIP_VERTS];
//draw it //draw it
@ -534,7 +534,7 @@ Sky_ProcessTextureChains -- handles sky polys in world model
*/ */
void Sky_ProcessTextureChains (void) void Sky_ProcessTextureChains (void)
{ {
int i; int32_t i;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
@ -564,7 +564,7 @@ void Sky_ProcessEntities (void)
entity_t *e; entity_t *e;
msurface_t *s; msurface_t *s;
glpoly_t *p; glpoly_t *p;
int i,j,k,mark; int32_t i,j,k,mark;
float dot; float dot;
bool rotated; bool rotated;
vec3_t temp, forward, right, up; vec3_t temp, forward, right, up;
@ -648,10 +648,10 @@ void Sky_ProcessEntities (void)
Sky_EmitSkyBoxVertex 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; vec3_t v, b;
int j, k; int32_t j, k;
float w, h; float w, h;
b[0] = s * gl_farclip.value / sqrt(3.0); 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) void Sky_DrawSkyBox (void)
{ {
int i; int32_t i;
for (i=0 ; i<6 ; i++) for (i=0 ; i<6 ; i++)
{ {
@ -753,10 +753,10 @@ void Sky_DrawSkyBox (void)
Sky_SetBoxVert 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; vec3_t b;
int j, k; int32_t j, k;
b[0] = s * gl_farclip.value / sqrt(3.0); b[0] = s * gl_farclip.value / sqrt(3.0);
b[1] = t * 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; length = 6*63/length;
scroll = cl.time*speed; scroll = cl.time*speed;
scroll -= (int)scroll & ~127; scroll -= (int32_t)scroll & ~127;
*s = (scroll + dir[0] * length) * (1.0/128); *s = (scroll + dir[0] * length) * (1.0/128);
*t = (scroll + dir[1] * 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 s, t;
float *v; float *v;
int i; int32_t i;
if (gl_mtexable && r_skyalpha.value >= 1.0) 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; glpoly_t *p;
vec3_t verts[4]; vec3_t verts[4];
int i, j, start; int32_t i, j, start;
float di,qi,dj,qj; float di,qi,dj,qj;
vec3_t vup, vright, temp, temp2; 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[3],vup);
VectorSubtract(verts[2],verts[1],vright); 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; qi = 1.0 / di;
dj = (axis < 4) ? di*2 : di; //subdivide vertically more than horizontally on skybox sides dj = (axis < 4) ? di*2 : di; //subdivide vertically more than horizontally on skybox sides
qj = 1.0 / dj; qj = 1.0 / dj;
@ -957,7 +957,7 @@ draws the old-style scrolling cloud layers
*/ */
void Sky_DrawSkyLayers (void) void Sky_DrawSkyLayers (void)
{ {
int i; int32_t i;
if (r_skyalpha.value < 1.0) if (r_skyalpha.value < 1.0)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 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) 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 //in these special render modes, the sky faces are handled in the normal world/brush renderer
if (r_drawflat_cheatsafe || r_lightmap_cheatsafe ) if (r_drawflat_cheatsafe || r_lightmap_cheatsafe )

View File

@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
const int gl_solid_format = 3; const int32_t gl_solid_format = 3;
const int gl_alpha_format = 4; const int32_t gl_alpha_format = 4;
static cvar_t gl_texturemode = {"gl_texturemode", "", CVAR_ARCHIVE}; static cvar_t gl_texturemode = {"gl_texturemode", "", CVAR_ARCHIVE};
static cvar_t gl_texture_anisotropy = {"gl_texture_anisotropy", "1", 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; static GLint gl_hardware_maxsize;
#define MAX_GLTEXTURES 2048 #define MAX_GLTEXTURES 2048
static int numgltextures; static int32_t numgltextures;
static gltexture_t *active_gltextures, *free_gltextures; static gltexture_t *active_gltextures, *free_gltextures;
gltexture_t *notexture, *nulltexture; gltexture_t *notexture, *nulltexture;
@ -57,8 +57,8 @@ uint32_t d_8to24table_pants[256];
typedef struct typedef struct
{ {
int magfilter; int32_t magfilter;
int minfilter; int32_t minfilter;
const char *name; const char *name;
} glmode_t; } glmode_t;
static glmode_t glmodes[] = { 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_NEAREST, "GL_LINEAR_MIPMAP_NEAREST"},
{GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, "GL_LINEAR_MIPMAP_LINEAR"}, {GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, "GL_LINEAR_MIPMAP_LINEAR"},
}; };
#define NUM_GLMODES (int)(sizeof(glmodes)/sizeof(glmodes[0])) #define NUM_GLMODES (int32_t)(sizeof(glmodes)/sizeof(glmodes[0]))
static int glmode_idx = NUM_GLMODES - 1; /* trilinear */ 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) static void TexMgr_DescribeTextureModes_f (void)
{ {
int i; int32_t i;
for (i = 0; i < NUM_GLMODES; i++) for (i = 0; i < NUM_GLMODES; i++)
Con_SafePrintf (" %2i: %s\n", i + 1, glmodes[i].name); 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) static void TexMgr_TextureMode_f (cvar_t *var)
{ {
gltexture_t *glt; gltexture_t *glt;
int i; int32_t i;
(void)var; (void)var;
@ -220,7 +220,7 @@ static void TexMgr_Imagelist_f (void)
} }
mb = texels * (Cvar_VariableValue("vid_bpp") / 8.0f) / 0x100000; 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) void TexMgr_LoadPalette (void)
{ {
byte *pal, *src, *dst; byte *pal, *src, *dst;
int i, mark; int32_t i, mark;
FILE *f; FILE *f;
COM_FOpenFile ("gfx/palette.lmp", &f, NULL); COM_FOpenFile ("gfx/palette.lmp", &f, NULL);
@ -557,8 +557,8 @@ choose safe warpimage size and resize existing warpimage textures
*/ */
void TexMgr_RecalcWarpImageSize (void) void TexMgr_RecalcWarpImageSize (void)
{ {
// int oldsize = gl_warpimagesize; // int32_t oldsize = gl_warpimagesize;
int mark; int32_t mark;
gltexture_t *glt; gltexture_t *glt;
byte *dummy; byte *dummy;
@ -605,7 +605,7 @@ must be called before any texture loading
*/ */
void TexMgr_Init (void) 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 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 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; 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 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) for (i = 1; i < s; i<<=1)
; ;
return i; return i;
@ -673,12 +673,12 @@ int TexMgr_Pad (int s)
TexMgr_SafeTextureSize -- return a size with hardware and user prefs in mind 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) if (!gl_texture_NPOT)
s = TexMgr_Pad(s); s = TexMgr_Pad(s);
if ((int)gl_max_size.value > 0) if ((int32_t)gl_max_size.value > 0)
s = q_min(TexMgr_Pad((int)gl_max_size.value), s); s = q_min(TexMgr_Pad((int32_t)gl_max_size.value), s);
s = q_min(gl_hardware_maxsize, s); s = q_min(gl_hardware_maxsize, s);
return 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) 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)) if (s < TexMgr_SafeTextureSize(s))
return TexMgr_Pad(s); return TexMgr_Pad(s);
@ -701,9 +701,9 @@ int TexMgr_PadConditional (int s)
TexMgr_MipMapW 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; byte *out, *in;
out = in = (byte *)data; out = in = (byte *)data;
@ -725,9 +725,9 @@ static unsigned *TexMgr_MipMapW (unsigned *data, int width, int height)
TexMgr_MipMapH 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; byte *out, *in;
out = in = (byte *)data; out = in = (byte *)data;
@ -753,12 +753,12 @@ static unsigned *TexMgr_MipMapH (unsigned *data, int width, int height)
TexMgr_ResampleTexture -- bilinear resample 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; byte *nwpx, *nepx, *swpx, *sepx, *dest;
unsigned xfrac, yfrac, x, y, modx, mody, imodx, imody, injump, outjump; unsigned xfrac, yfrac, x, y, modx, mody, imodx, imody, injump, outjump;
unsigned *out; unsigned *out;
int i, j, outwidth, outheight; int32_t i, j, outwidth, outheight;
if (inwidth == TexMgr_Pad(inwidth) && inheight == TexMgr_Pad(inheight)) if (inwidth == TexMgr_Pad(inwidth) && inheight == TexMgr_Pad(inheight))
return in; return in;
@ -815,9 +815,9 @@ eliminate pink edges on sprites, etc.
operates in place on 32bit data 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, lastrow, thisrow, nextrow,
lastpix, thispix, nextpix; lastpix, thispix, nextpix;
byte *dest = data; 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 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; byte *src, *dst;
int i, padw, padh; int32_t i, padw, padh;
padw = TexMgr_PadConditional(width); padw = TexMgr_PadConditional(width);
padh = TexMgr_PadConditional(height); 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 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; byte *src, *dst;
int i, padw, padh; int32_t i, padw, padh;
padw = TexMgr_PadConditional(width); padw = TexMgr_PadConditional(width);
padh = TexMgr_PadConditional(height); padh = TexMgr_PadConditional(height);
@ -942,9 +942,9 @@ static void TexMgr_PadEdgeFixH (byte *data, int width, int height)
TexMgr_8to32 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; unsigned *out, *data;
out = data = (unsigned *) Hunk_Alloc(pixels*4); 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 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; byte *out, *data;
if (width == TexMgr_Pad(width)) 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 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; byte *data, *out;
if (height == TexMgr_Pad(height)) if (height == TexMgr_Pad(height))
@ -1016,7 +1016,7 @@ TexMgr_LoadImage32 -- handles 32bit source data
*/ */
static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *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) if (!gl_texture_NPOT)
{ {
@ -1027,17 +1027,17 @@ static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data)
} }
// mipmap down // 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); mipwidth = TexMgr_SafeTextureSize (glt->width >> picmip);
mipheight = TexMgr_SafeTextureSize (glt->height >> 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); TexMgr_MipMapW (data, glt->width, glt->height);
glt->width >>= 1; glt->width >>= 1;
if (glt->flags & TEXPREF_ALPHA) if (glt->flags & TEXPREF_ALPHA)
TexMgr_AlphaEdgeFix ((byte *)data, glt->width, glt->height); 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); TexMgr_MipMapH (data, glt->width, glt->height);
glt->height >>= 1; glt->height >>= 1;
@ -1087,7 +1087,7 @@ static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
bool padw = false, padh = false; bool padw = false, padh = false;
byte padbyte; byte padbyte;
uint32_t *usepal; uint32_t *usepal;
int i; int32_t i;
// HACK HACK HACK -- taken from tomazquake // HACK HACK HACK -- taken from tomazquake
if (strstr(glt->name, "shot1sid") && if (strstr(glt->name, "shot1sid") &&
@ -1103,10 +1103,10 @@ static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
// detect false alpha cases // detect false alpha cases
if (glt->flags & TEXPREF_ALPHA && !(glt->flags & TEXPREF_CONCHARS)) 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 if (data[i] == 255) //transparent index
break; break;
if (i == (int) (glt->width * glt->height)) if (i == (int32_t) (glt->width * glt->height))
glt->flags -= TEXPREF_ALPHA; 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 // pad each dimention, but only if it's not going to be downsampled later
if (glt->flags & TEXPREF_PAD) 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); data = TexMgr_PadImageW (data, glt->width, glt->height, padbyte);
glt->width = TexMgr_Pad(glt->width); glt->width = TexMgr_Pad(glt->width);
padw = true; 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); data = TexMgr_PadImageH (data, glt->width, glt->height, padbyte);
glt->height = TexMgr_Pad(glt->height); 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 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) byte *data, const char *source_file, src_offset_t source_offset, unsigned flags)
{ {
uint16_t crc; uint16_t crc;
gltexture_t *glt; gltexture_t *glt;
int mark; int32_t mark;
if (isDedicated) if (isDedicated)
return NULL; 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 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 translation[256];
byte *src, *dst, *data = NULL, *translated; byte *src, *dst, *data = NULL, *translated;
int mark, size, i; int32_t mark, size, i;
// //
// get source data // get source data
// //
@ -1305,7 +1305,7 @@ void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants)
fclose (f); fclose (f);
} }
else if (glt->source_file[0] && !glt->source_offset) 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) else if (!glt->source_file[0] && glt->source_offset)
data = (byte *) glt->source_offset; //image in memory 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) void GL_ClearBindings(void)
{ {
int i; int32_t i;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
currenttexture[i] = GL_UNUSED_TEXTURE; currenttexture[i] = GL_UNUSED_TEXTURE;

View File

@ -62,7 +62,7 @@ typedef struct gltexture_s {
int8_t shirt; //0-13 shirt color, or -1 if never colormapped int8_t shirt; //0-13 shirt color, or -1 if never colormapped
int8_t pants; //0-13 pants color, or -1 if never colormapped int8_t pants; //0-13 pants color, or -1 if never colormapped
//used for rendering //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; } gltexture_t;
extern gltexture_t *notexture; extern gltexture_t *notexture;
@ -88,15 +88,15 @@ void TexMgr_Init (void);
void TexMgr_DeleteTextureObjects (void); void TexMgr_DeleteTextureObjects (void);
// IMAGE LOADING // 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); 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_ReloadImages (void);
void TexMgr_ReloadNobrightImages (void); void TexMgr_ReloadNobrightImages (void);
int TexMgr_Pad(int s); int32_t TexMgr_Pad(int32_t s);
int TexMgr_SafeTextureSize (int s); int32_t TexMgr_SafeTextureSize (int32_t s);
int TexMgr_PadConditional (int s); int32_t TexMgr_PadConditional (int32_t s);
// TEXTURE BINDING & TEXTURE UNIT SWITCHING // TEXTURE BINDING & TEXTURE UNIT SWITCHING

View File

@ -46,22 +46,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define DEFAULT_REFRESHRATE 60 #define DEFAULT_REFRESHRATE 60
typedef struct { typedef struct {
int width; int32_t width;
int height; int32_t height;
int refreshrate; int32_t refreshrate;
int bpp; int32_t bpp;
} vmode_t; } vmode_t;
static const char *gl_vendor; static const char *gl_vendor;
static const char *gl_renderer; static const char *gl_renderer;
static const char *gl_version; static const char *gl_version;
static int gl_version_major; static int32_t gl_version_major;
static int gl_version_minor; static int32_t gl_version_minor;
static const char *gl_extensions; static const char *gl_extensions;
static char * gl_extensions_nice; static char * gl_extensions_nice;
static vmode_t modelist[MAX_MODE_LIST]; static vmode_t modelist[MAX_MODE_LIST];
static int nummodes; static int32_t nummodes;
static bool vid_initialized = false; 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_Init (void); //johnfitz
static void VID_Menu_f (void); //johnfitz static void VID_Menu_f (void); //johnfitz
static void VID_MenuDraw (void); static void VID_MenuDraw (void);
static void VID_MenuKey (int key); static void VID_MenuKey (int32_t key);
static void ClearAllStates (void); static void ClearAllStates (void);
static void GL_Init (void); static void GL_Init (void);
@ -96,7 +96,7 @@ bool gl_glsl_able = false; //ericw
GLint gl_max_texture_units = 0; //ericw GLint gl_max_texture_units = 0; //ericw
bool gl_glsl_gamma_able = false; //ericw bool gl_glsl_gamma_able = false; //ericw
bool gl_glsl_alias_able = false; //ericw bool gl_glsl_alias_able = false; //ericw
int gl_stencilbits; int32_t gl_stencilbits;
PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz
PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz
@ -167,7 +167,7 @@ static uint16_t vid_sysgamma_blue[256];
#endif #endif
static bool gammaworks = false; // whether hw-gamma works 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; return;
#if USE_GAMMA_RAMPS #if USE_GAMMA_RAMPS
int i; int32_t i;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
vid_gamma_red[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_green[i] = vid_gamma_red[i];
vid_gamma_blue[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 VID_GetCurrentWidth
====================== ======================
*/ */
static int VID_GetCurrentWidth (void) static int32_t VID_GetCurrentWidth (void)
{ {
int w; int32_t w;
SDL_GetWindowSize(draw_context, &w, NULL); SDL_GetWindowSize(draw_context, &w, NULL);
return w; return w;
} }
@ -299,9 +299,9 @@ static int VID_GetCurrentWidth (void)
VID_GetCurrentHeight VID_GetCurrentHeight
======================= =======================
*/ */
static int VID_GetCurrentHeight (void) static int32_t VID_GetCurrentHeight (void)
{ {
int h; int32_t h;
SDL_GetWindowSize(draw_context, NULL, &h); SDL_GetWindowSize(draw_context, NULL, &h);
return h; return h;
} }
@ -311,10 +311,10 @@ static int VID_GetCurrentHeight (void)
VID_GetCurrentRefreshRate VID_GetCurrentRefreshRate
==================== ====================
*/ */
static int VID_GetCurrentRefreshRate (void) static int32_t VID_GetCurrentRefreshRate (void)
{ {
SDL_DisplayMode mode; SDL_DisplayMode mode;
int current_display; int32_t current_display;
current_display = SDL_GetWindowDisplayIndex(draw_context); current_display = SDL_GetWindowDisplayIndex(draw_context);
@ -330,7 +330,7 @@ static int VID_GetCurrentRefreshRate (void)
VID_GetCurrentBPP VID_GetCurrentBPP
==================== ====================
*/ */
static int VID_GetCurrentBPP (void) static int32_t VID_GetCurrentBPP (void)
{ {
const Uint32 pixelFormat = SDL_GetWindowPixelFormat(draw_context); const Uint32 pixelFormat = SDL_GetWindowPixelFormat(draw_context);
return SDL_BITSPERPIXEL(pixelFormat); 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. 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; static SDL_DisplayMode mode;
const int sdlmodes = SDL_GetNumDisplayModes(0); const int32_t sdlmodes = SDL_GetNumDisplayModes(0);
int i; int32_t i;
for (i = 0; i < sdlmodes; 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 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 // ignore width / height / bpp if vid_desktopfullscreen is enabled
if (fullscreen && vid_desktopfullscreen.value) if (fullscreen && vid_desktopfullscreen.value)
@ -473,14 +473,14 @@ static bool VID_ValidMode (int width, int height, int refreshrate, int bpp, bool
VID_SetMode 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; Uint32 flags;
char caption[50]; char caption[50];
int depthbits, stencilbits; int32_t depthbits, stencilbits;
int fsaa_obtained; int32_t fsaa_obtained;
int previous_display; int32_t previous_display;
// so Con_Printfs don't mess us up by forcing vid and snd updates // so Con_Printfs don't mess us up by forcing vid and snd updates
temp = scr_disabled_for_loading; temp = scr_disabled_for_loading;
@ -639,16 +639,16 @@ VID_Restart -- johnfitz -- change video modes on the fly
*/ */
static void VID_Restart (void) static void VID_Restart (void)
{ {
int width, height, refreshrate, bpp; int32_t width, height, refreshrate, bpp;
bool fullscreen; bool fullscreen;
if (vid_locked || !vid_changed) if (vid_locked || !vid_changed)
return; return;
width = (int)vid_width.value; width = (int32_t)vid_width.value;
height = (int)vid_height.value; height = (int32_t)vid_height.value;
refreshrate = (int)vid_refreshrate.value; refreshrate = (int32_t)vid_refreshrate.value;
bpp = (int)vid_bpp.value; bpp = (int32_t)vid_bpp.value;
fullscreen = vid_fullscreen.value ? true : false; fullscreen = vid_fullscreen.value ? true : false;
// //
@ -691,7 +691,7 @@ static void VID_Restart (void)
TexMgr_RecalcWarpImageSize (); TexMgr_RecalcWarpImageSize ();
//conwidth and conheight need to be recalculated //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 = CLAMP (320, vid.conwidth, vid.width);
vid.conwidth &= 0xFFFFFFF8; vid.conwidth &= 0xFFFFFFF8;
vid.conheight = vid.conwidth * vid.height / vid.width; 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) 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) if (vid_locked || !vid_changed)
return; return;
@ -787,12 +787,12 @@ GL_MakeNiceExtensionsList -- johnfitz
static char *GL_MakeNiceExtensionsList (const char *in) static char *GL_MakeNiceExtensionsList (const char *in)
{ {
char *copy, *token, *out; char *copy, *token, *out;
int i, count; int32_t i, count;
if (!in) return Z_Strdup("(none)"); if (!in) return Z_Strdup("(none)");
//each space will be replaced by 4 chars, so count the spaces before we malloc //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] == ' ') if (in[i] == ' ')
count++; count++;
@ -856,7 +856,7 @@ static bool GL_ParseExtensionList (const char *list, const char *name)
static void GL_CheckExtensions (void) static void GL_CheckExtensions (void)
{ {
int swap_control; int32_t swap_control;
// ARB_vertex_buffer_object // ARB_vertex_buffer_object
// //
@ -897,7 +897,7 @@ static void GL_CheckExtensions (void)
gl_mtexable = true; gl_mtexable = true;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &gl_max_texture_units); 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 else
{ {
@ -1202,7 +1202,7 @@ static void GL_Init (void)
GL_BeginRendering -- sets values of glx, gly, glwidth, glheight 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; *x = *y = 0;
*width = vid.width; *width = vid.width;
@ -1285,8 +1285,8 @@ VID_DescribeModes_f -- johnfitz -- changed formatting, and added refresh rates a
*/ */
static void VID_DescribeModes_f (void) static void VID_DescribeModes_f (void)
{ {
int i; int32_t i;
int lastwidth, lastheight, lastbpp, count; int32_t lastwidth, lastheight, lastbpp, count;
lastwidth = lastheight = lastbpp = count = 0; 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 // don't print the warning if vid_fsaa is set during startup
if (vid_initialized) 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) static void VID_InitModelist (void)
{ {
const int sdlmodes = SDL_GetNumDisplayModes(0); const int32_t sdlmodes = SDL_GetNumDisplayModes(0);
int i; int32_t i;
nummodes = 0; nummodes = 0;
for (i = 0; i < sdlmodes; i++) for (i = 0; i < sdlmodes; i++)
@ -1360,8 +1360,8 @@ VID_Init
void VID_Init (void) void VID_Init (void)
{ {
static char vid_center[] = "SDL_VIDEO_CENTERED=center"; static char vid_center[] = "SDL_VIDEO_CENTERED=center";
int p, width, height, refreshrate, bpp; int32_t p, width, height, refreshrate, bpp;
int display_width, display_height, display_refreshrate, display_bpp; int32_t display_width, display_height, display_refreshrate, display_bpp;
bool fullscreen; bool fullscreen;
const char *read_vars[] = { "vid_fullscreen", const char *read_vars[] = { "vid_fullscreen",
"vid_width", "vid_width",
@ -1426,12 +1426,12 @@ void VID_Init (void)
VID_InitModelist(); VID_InitModelist();
width = (int)vid_width.value; width = (int32_t)vid_width.value;
height = (int)vid_height.value; height = (int32_t)vid_height.value;
refreshrate = (int)vid_refreshrate.value; refreshrate = (int32_t)vid_refreshrate.value;
bpp = (int)vid_bpp.value; bpp = (int32_t)vid_bpp.value;
fullscreen = (int)vid_fullscreen.value; fullscreen = (int32_t)vid_fullscreen.value;
fsaa = (int)vid_fsaa.value; fsaa = (int32_t)vid_fsaa.value;
if (COM_CheckParm("-current")) if (COM_CheckParm("-current"))
{ {
@ -1481,11 +1481,11 @@ void VID_Init (void)
if (!VID_ValidMode(width, height, refreshrate, bpp, fullscreen)) if (!VID_ValidMode(width, height, refreshrate, bpp, fullscreen))
{ {
width = (int)vid_width.value; width = (int32_t)vid_width.value;
height = (int)vid_height.value; height = (int32_t)vid_height.value;
refreshrate = (int)vid_refreshrate.value; refreshrate = (int32_t)vid_refreshrate.value;
bpp = (int)vid_bpp.value; bpp = (int32_t)vid_bpp.value;
fullscreen = (int)vid_fullscreen.value; fullscreen = (int32_t)vid_fullscreen.value;
} }
if (!VID_ValidMode(width, height, refreshrate, bpp, fullscreen)) if (!VID_ValidMode(width, height, refreshrate, bpp, fullscreen))
@ -1502,7 +1502,7 @@ void VID_Init (void)
vid.maxwarpwidth = WARP_WIDTH; vid.maxwarpwidth = WARP_WIDTH;
vid.maxwarpheight = WARP_HEIGHT; vid.maxwarpheight = WARP_HEIGHT;
vid.colormap = host_colormap; vid.colormap = host_colormap;
vid.fullbright = 256 - LittleLong (*((int *)vid.colormap + 2048)); vid.fullbright = 256 - LittleLong (*((int32_t *)vid.colormap + 2048));
// set window icon // set window icon
PL_SetWindowIcon(); PL_SetWindowIcon();
@ -1631,21 +1631,21 @@ enum {
VIDEO_OPTIONS_ITEMS VIDEO_OPTIONS_ITEMS
}; };
static int video_options_cursor = 0; static int32_t video_options_cursor = 0;
typedef struct { typedef struct {
int width,height; int32_t width,height;
} vid_menu_mode; } vid_menu_mode;
//TODO: replace these fixed-length arrays with hunk_allocated buffers //TODO: replace these fixed-length arrays with hunk_allocated buffers
static vid_menu_mode vid_menu_modes[MAX_MODE_LIST]; 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 int32_t vid_menu_bpps[MAX_BPPS_LIST];
static int vid_menu_numbpps = 0; static int32_t vid_menu_numbpps = 0;
static int vid_menu_rates[MAX_RATES_LIST]; static int32_t vid_menu_rates[MAX_RATES_LIST];
static int vid_menu_numrates=0; static int32_t vid_menu_numrates=0;
/* /*
================ ================
@ -1654,7 +1654,7 @@ VID_Menu_Init
*/ */
static void VID_Menu_Init (void) static void VID_Menu_Init (void)
{ {
int i, j, h, w; int32_t i, j, h, w;
for (i = 0; i < nummodes; i++) 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) static void VID_Menu_RebuildBppList (void)
{ {
int i, j, b; int32_t i, j, b;
vid_menu_numbpps = 0; 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 //if vid_bpp is not in the new list, change vid_bpp
for (i = 0; i < vid_menu_numbpps; i++) 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; break;
if (i == vid_menu_numbpps) 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) static void VID_Menu_RebuildRateList (void)
{ {
int i,j,r; int32_t i,j,r;
vid_menu_numrates=0; 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 //if vid_refreshrate is not in the new list, change vid_refreshrate
for (i=0;i<vid_menu_numrates;i++) for (i=0;i<vid_menu_numrates;i++)
if (vid_menu_rates[i] == (int)(vid_refreshrate.value)) if (vid_menu_rates[i] == (int32_t)(vid_refreshrate.value))
break; break;
if (i==vid_menu_numrates) if (i==vid_menu_numrates)
@ -1791,9 +1791,9 @@ chooses next resolution in order, then updates vid_width and
vid_height cvars, then updates bpp and refreshrate lists vid_height cvars, then updates bpp and refreshrate lists
================ ================
*/ */
static void VID_Menu_ChooseNextMode (int dir) static void VID_Menu_ChooseNextMode (int32_t dir)
{ {
int i; int32_t i;
if (vid_menu_nummodes) if (vid_menu_nummodes)
{ {
@ -1831,9 +1831,9 @@ VID_Menu_ChooseNextBpp
chooses next bpp in order, then updates vid_bpp cvar chooses next bpp in order, then updates vid_bpp cvar
================ ================
*/ */
static void VID_Menu_ChooseNextBpp (int dir) static void VID_Menu_ChooseNextBpp (int32_t dir)
{ {
int i; int32_t i;
if (vid_menu_numbpps) if (vid_menu_numbpps)
{ {
@ -1867,9 +1867,9 @@ VID_Menu_ChooseNextRate
chooses next refresh rate in order, then updates vid_refreshrate cvar chooses next refresh rate in order, then updates vid_refreshrate cvar
================ ================
*/ */
static void VID_Menu_ChooseNextRate (int dir) static void VID_Menu_ChooseNextRate (int32_t dir)
{ {
int i; int32_t i;
for (i=0;i<vid_menu_numrates;i++) for (i=0;i<vid_menu_numrates;i++)
{ {
@ -1898,7 +1898,7 @@ static void VID_Menu_ChooseNextRate (int dir)
VID_MenuKey VID_MenuKey
================ ================
*/ */
static void VID_MenuKey (int key) static void VID_MenuKey (int32_t key)
{ {
switch (key) switch (key)
{ {
@ -2018,7 +2018,7 @@ VID_MenuDraw
*/ */
static void VID_MenuDraw (void) static void VID_MenuDraw (void)
{ {
int i, y; int32_t i, y;
qpic_t *p; qpic_t *p;
const char *title; const char *title;
@ -2047,24 +2047,24 @@ static void VID_MenuDraw (void)
{ {
case VID_OPT_MODE: case VID_OPT_MODE:
M_Print (16, y, " Video mode"); M_Print (16, y, " Video mode");
M_Print (184, y, va("%ix%i", (int)vid_width.value, (int)vid_height.value)); M_Print (184, y, va("%ix%i", (int32_t)vid_width.value, (int32_t)vid_height.value));
break; break;
case VID_OPT_BPP: case VID_OPT_BPP:
M_Print (16, y, " Color depth"); M_Print (16, y, " Color depth");
M_Print (184, y, va("%i", (int)vid_bpp.value)); M_Print (184, y, va("%i", (int32_t)vid_bpp.value));
break; break;
case VID_OPT_REFRESHRATE: case VID_OPT_REFRESHRATE:
M_Print (16, y, " Refresh rate"); M_Print (16, y, " Refresh rate");
M_Print (184, y, va("%i", (int)vid_refreshrate.value)); M_Print (184, y, va("%i", (int32_t)vid_refreshrate.value));
break; break;
case VID_OPT_FULLSCREEN: case VID_OPT_FULLSCREEN:
M_Print (16, y, " Fullscreen"); M_Print (16, y, " Fullscreen");
M_DrawCheckbox (184, y, (int)vid_fullscreen.value); M_DrawCheckbox (184, y, (int32_t)vid_fullscreen.value);
break; break;
case VID_OPT_VSYNC: case VID_OPT_VSYNC:
M_Print (16, y, " Vertical sync"); M_Print (16, y, " Vertical sync");
if (gl_swap_control) if (gl_swap_control)
M_DrawCheckbox (184, y, (int)vid_vsync.value); M_DrawCheckbox (184, y, (int32_t)vid_vsync.value);
else else
M_Print (184, y, "N/A"); M_Print (184, y, "N/A");
break; break;
@ -2078,7 +2078,7 @@ static void VID_MenuDraw (void)
} }
if (video_options_cursor == i) if (video_options_cursor == i)
M_DrawCharacter (168, y, 12+((int)(realtime*4)&1)); M_DrawCharacter (168, y, 12+((int32_t)(realtime*4)&1));
y += 8; y += 8;
} }

View File

@ -28,7 +28,7 @@ cvar_t r_oldwater = {"r_oldwater", "0", CVAR_ARCHIVE};
cvar_t r_waterquality = {"r_waterquality", "8", CVAR_NONE}; cvar_t r_waterquality = {"r_waterquality", "8", CVAR_NONE};
cvar_t r_waterwarp = {"r_waterwarp", "1", CVAR_NONE}; cvar_t r_waterwarp = {"r_waterwarp", "1", CVAR_NONE};
int gl_warpimagesize; int32_t gl_warpimagesize;
float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded
float turbsin[] = float turbsin[] =
@ -36,8 +36,8 @@ float turbsin[] =
#include "gl_warp_sin.h" #include "gl_warp_sin.h"
}; };
#define WARPCALC(s,t) ((s + turbsin[(int)((t*2)+(cl.time*(128.0/M_PI))) & 255]) * (1.0/64)) //johnfitz -- correct warp #define WARPCALC(s,t) ((s + turbsin[(int32_t)((t*2)+(cl.time*(128.0/M_PI))) & 255]) * (1.0/64)) //johnfitz -- correct warp
#define WARPCALC2(s,t) ((s + turbsin[(int)((t*0.125+cl.time)*(128.0/M_PI)) & 255]) * (1.0/64)) //johnfitz -- old warp #define WARPCALC2(s,t) ((s + turbsin[(int32_t)((t*0.125+cl.time)*(128.0/M_PI)) & 255]) * (1.0/64)) //johnfitz -- old warp
//============================================================================== //==============================================================================
// //
@ -51,9 +51,9 @@ msurface_t *warpface;
cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", CVAR_ARCHIVE}; cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", CVAR_ARCHIVE};
void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs) void BoundPoly (int32_t numverts, float *verts, vec3_t mins, vec3_t maxs)
{ {
int i, j; int32_t i, j;
float *v; float *v;
mins[0] = mins[1] = mins[2] = 999999999; mins[0] = mins[1] = mins[2] = 999999999;
@ -69,14 +69,14 @@ void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
} }
} }
void SubdividePolygon (int numverts, float *verts) void SubdividePolygon (int32_t numverts, float *verts)
{ {
int i, j, k; int32_t i, j, k;
vec3_t mins, maxs; vec3_t mins, maxs;
float m; float m;
float *v; float *v;
vec3_t front[64], back[64]; vec3_t front[64], back[64];
int f, b; int32_t f, b;
float dist[64]; float dist[64];
float frac; float frac;
glpoly_t *poly; glpoly_t *poly;
@ -160,7 +160,7 @@ GL_SubdivideSurface
void GL_SubdivideSurface (msurface_t *fa) void GL_SubdivideSurface (msurface_t *fa)
{ {
vec3_t verts[64]; vec3_t verts[64];
int i; int32_t i;
warpface = fa; warpface = fa;
@ -180,7 +180,7 @@ DrawWaterPoly -- johnfitz
void DrawWaterPoly (glpoly_t *p) void DrawWaterPoly (glpoly_t *p)
{ {
float *v; float *v;
int i; int32_t i;
if (load_subdivide_size > 48) if (load_subdivide_size > 48)
{ {
@ -220,7 +220,7 @@ R_UpdateWarpTextures -- johnfitz -- each frame, update warping textures
void R_UpdateWarpTextures (void) void R_UpdateWarpTextures (void)
{ {
texture_t *tx; texture_t *tx;
int i; int32_t i;
float x, y, x2, warptess; float x, y, x2, warptess;
if (r_oldwater.value || cl.paused || r_drawflat_cheatsafe || r_lightmap_cheatsafe) if (r_oldwater.value || cl.paused || r_drawflat_cheatsafe || r_lightmap_cheatsafe)

View File

@ -24,11 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __GLQUAKE_H #ifndef __GLQUAKE_H
#define __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_EndRendering (void);
void GL_Set2D (void); void GL_Set2D (void);
extern int glx, gly, glwidth, glheight; extern int32_t glx, gly, glwidth, glheight;
#define GL_UNUSED_TEXTURE (~(GLuint)0) #define GL_UNUSED_TEXTURE (~(GLuint)0)
@ -50,7 +50,7 @@ extern int glx, gly, glwidth, glheight;
void R_TimeRefresh_f (void); void R_TimeRefresh_f (void);
void R_ReadPointFile_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 { typedef enum {
pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2 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 bool r_cache_thrash; // compatability
extern vec3_t modelorg, r_entorigin; extern vec3_t modelorg, r_entorigin;
extern entity_t *currententity; extern entity_t *currententity;
extern int r_visframecount; // ??? what difs? extern int32_t r_visframecount; // ??? what difs?
extern int r_framecount; extern int32_t r_framecount;
extern mplane_t frustum[4]; extern mplane_t frustum[4];
// //
@ -93,7 +93,7 @@ extern vec3_t r_origin;
// //
extern refdef_t r_refdef; extern refdef_t r_refdef;
extern mleaf_t *r_viewleaf, *r_oldviewleaf; 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_norefresh;
extern cvar_t r_drawentities; extern cvar_t r_drawentities;
@ -126,7 +126,7 @@ extern cvar_t gl_playermip;
extern cvar_t gl_subdivide_size; extern cvar_t gl_subdivide_size;
extern float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded 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 // Multitexture
extern bool mtexenabled; extern bool mtexenabled;
@ -215,7 +215,7 @@ extern bool gl_texture_NPOT;
#define OFFSET_DECAL -1 #define OFFSET_DECAL -1
#define OFFSET_FOG -2 #define OFFSET_FOG -2
#define OFFSET_SHOWTRIS -3 #define OFFSET_SHOWTRIS -3
void GL_PolygonOffset (int); void GL_PolygonOffset (int32_t);
//johnfitz -- GL_EXT_texture_env_combine //johnfitz -- GL_EXT_texture_env_combine
//the values for GL_ARB_ are identical //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 extern bool gl_texture_env_add; // for GL_EXT_texture_env_add
//johnfitz -- rendering statistics //johnfitz -- rendering statistics
extern int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys; extern int32_t rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
extern int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses; extern int32_t rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
extern float rs_megatexels; extern float rs_megatexels;
//johnfitz -- track developer statistics that vary every frame //johnfitz -- track developer statistics that vary every frame
extern cvar_t devstats; extern cvar_t devstats;
typedef struct { typedef struct {
int packetsize; int32_t packetsize;
int edicts; int32_t edicts;
int visedicts; int32_t visedicts;
int efrags; int32_t efrags;
int tempents; int32_t tempents;
int beams; int32_t beams;
int dlights; int32_t dlights;
} devstats_t; } devstats_t;
extern devstats_t dev_stats, dev_peakstats; 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 #define CONSOLE_RESPAM_TIME 3 // seconds between repeated warning messages
//johnfitz -- moved here from r_brush.c //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 #define MAX_LIGHTMAPS 512 //johnfitz -- was 64
extern gltexture_t *lightmap_textures[MAX_LIGHTMAPS]; //johnfitz -- changed to an array 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 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); void R_StoreEfrags (efrag_t **ppefrag);
bool R_CullModelForEntity (entity_t *e); bool R_CullModelForEntity (entity_t *e);
void R_RotateForEntity (vec3_t origin, vec3_t angles); 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_InitParticles (void);
void R_DrawParticles (void); void R_DrawParticles (void);
void CL_RunParticles (void); void CL_RunParticles (void);
void R_ClearParticles (void); void R_ClearParticles (void);
void R_TranslatePlayerSkin (int playernum); void R_TranslatePlayerSkin (int32_t playernum);
void R_TranslateNewPlayerSkin (int playernum); //johnfitz -- this handles cases when the actual texture changes void R_TranslateNewPlayerSkin (int32_t playernum); //johnfitz -- this handles cases when the actual texture changes
void R_UpdateWarpTextures (void); void R_UpdateWarpTextures (void);
void R_DrawWorld (void); void R_DrawWorld (void);
@ -325,10 +325,10 @@ void GLMesh_LoadVertexBuffers (void);
void GLMesh_DeleteVertexBuffers (void); void GLMesh_DeleteVertexBuffers (void);
void R_RebuildAllLightmaps (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 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_RenderDynamicLightmaps (msurface_t *fa);
void R_UploadLightmaps (void); void R_UploadLightmaps (void);
@ -338,7 +338,7 @@ void R_DrawAliasModel_ShowTris (entity_t *e);
void R_DrawParticles_ShowTris (void); void R_DrawParticles_ShowTris (void);
GLint GL_GetUniformLocation (GLuint *programPtr, const char *name); 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 R_DeleteShaders (void);
void GLWorld_CreateShaders (void); void GLWorld_CreateShaders (void);

View File

@ -45,9 +45,9 @@ double host_frametime;
double realtime; // without any filtering or bounding double realtime; // without any filtering or bounding
double oldrealtime; // last frame run 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 client_t *host_client; // current client
@ -183,7 +183,7 @@ Host_FindMaxClients
*/ */
void Host_FindMaxClients (void) void Host_FindMaxClients (void)
{ {
int i; int32_t i;
svs.maxclients = 1; svs.maxclients = 1;
@ -357,7 +357,7 @@ void SV_BroadcastPrintf (const char *fmt, ...)
{ {
va_list argptr; va_list argptr;
char string[1024]; char string[1024];
int i; int32_t i;
va_start (argptr,fmt); va_start (argptr,fmt);
q_vsnprintf (string, sizeof(string), fmt, argptr); q_vsnprintf (string, sizeof(string), fmt, argptr);
@ -403,8 +403,8 @@ if (crash = true), don't bother sending signofs
*/ */
void SV_DropClient (bool crash) void SV_DropClient (bool crash)
{ {
int saveSelf; int32_t saveSelf;
int i; int32_t i;
client_t *client; client_t *client;
if (!crash) if (!crash)
@ -465,8 +465,8 @@ This only happens at the end of a game, not between levels
*/ */
void Host_ShutdownServer(bool crash) void Host_ShutdownServer(bool crash)
{ {
int i; int32_t i;
int count; int32_t count;
sizebuf_t buf; sizebuf_t buf;
byte message[4]; byte message[4];
double start; double start;
@ -619,7 +619,7 @@ Host_ServerFrame
*/ */
void Host_ServerFrame (void) void Host_ServerFrame (void)
{ {
int i, active; //johnfitz int32_t i, active; //johnfitz
edict_t *ent; //johnfitz edict_t *ent; //johnfitz
// run the world state // run the world state
@ -671,7 +671,7 @@ void _Host_Frame (float time)
static double time1 = 0; static double time1 = 0;
static double time2 = 0; static double time2 = 0;
static double time3 = 0; static double time3 = 0;
int pass1, pass2, pass3; int32_t pass1, pass2, pass3;
if (setjmp (host_abortserver) ) if (setjmp (host_abortserver) )
return; // something bad happened, or the server disconnected return; // something bad happened, or the server disconnected
@ -766,8 +766,8 @@ void Host_Frame (float time)
{ {
double time1, time2; double time1, time2;
static double timetotal; static double timetotal;
static int timecount; static int32_t timecount;
int i, c, m; int32_t i, c, m;
if (!serverprofile.value) if (!serverprofile.value)
{ {
@ -805,7 +805,7 @@ Host_Init
*/ */
void Host_Init (void) void Host_Init (void)
{ {
int minimum_memory; int32_t minimum_memory;
if (standard_quake) if (standard_quake)
minimum_memory = MINIMUM_MEMORY; minimum_memory = MINIMUM_MEMORY;

View File

@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern cvar_t pausable; extern cvar_t pausable;
int current_skill; int32_t current_skill;
void Mod_Print (void); void Mod_Print (void);
@ -128,7 +128,7 @@ void ExtraMaps_Init (void)
char ignorepakdir[32]; char ignorepakdir[32];
searchpath_t *search; searchpath_t *search;
pack_t *pak; pack_t *pak;
int i; int32_t i;
// we don't want to list the maps in id1 pakfiles, // we don't want to list the maps in id1 pakfiles,
// because these are not "add-on" levels // because these are not "add-on" levels
@ -202,7 +202,7 @@ Host_Maps_f
*/ */
void Host_Maps_f (void) void Host_Maps_f (void)
{ {
int i; int32_t i;
filelist_item_t *level; filelist_item_t *level;
for (level = extralevels, i = 0; level; level = level->next, i++) for (level = extralevels, i = 0; level; level = level->next, i++)
@ -315,7 +315,7 @@ void DemoList_Init (void)
char ignorepakdir[32]; char ignorepakdir[32];
searchpath_t *search; searchpath_t *search;
pack_t *pak; pack_t *pak;
int i; int32_t i;
// we don't want to list the demos in id1 pakfiles, // we don't want to list the demos in id1 pakfiles,
// because these are not "add-on" demos // 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) void Host_Mods_f (void)
{ {
int i; int32_t i;
filelist_item_t *mod; filelist_item_t *mod;
for (mod = modlist, i=0; mod; mod = mod->next, i++) 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, ...) void (*print_fn) (const char *fmt, ...)
FUNCP_PRINTF(1,2); FUNCP_PRINTF(1,2);
client_t *client; client_t *client;
int seconds; int32_t seconds;
int minutes; int32_t minutes;
int hours = 0; int32_t hours = 0;
int j; int32_t j;
if (cmd_source == src_command) if (cmd_source == src_command)
{ {
@ -453,7 +453,7 @@ void Host_Status_f (void)
{ {
if (!client->active) if (!client->active)
continue; continue;
seconds = (int)(net_time - NET_QSocketGetTime(client->netconnection)); seconds = (int32_t)(net_time - NET_QSocketGetTime(client->netconnection));
minutes = seconds / 60; minutes = seconds / 60;
if (minutes) if (minutes)
{ {
@ -464,7 +464,7 @@ void Host_Status_f (void)
} }
else else
hours = 0; 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)); print_fn (" %s\n", NET_QSocketGetAddressString(client->netconnection));
} }
} }
@ -491,8 +491,8 @@ void Host_God_f (void)
switch (Cmd_Argc()) switch (Cmd_Argc())
{ {
case 1: case 1:
sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE; sv_player->v.flags = (int32_t)sv_player->v.flags ^ FL_GODMODE;
if (!((int)sv_player->v.flags & FL_GODMODE) ) if (!((int32_t)sv_player->v.flags & FL_GODMODE) )
SV_ClientPrintf ("godmode OFF\n"); SV_ClientPrintf ("godmode OFF\n");
else else
SV_ClientPrintf ("godmode ON\n"); SV_ClientPrintf ("godmode ON\n");
@ -500,12 +500,12 @@ void Host_God_f (void)
case 2: case 2:
if (Q_atof(Cmd_Argv(1))) 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"); SV_ClientPrintf ("godmode ON\n");
} }
else 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"); SV_ClientPrintf ("godmode OFF\n");
} }
break; break;
@ -536,8 +536,8 @@ void Host_Notarget_f (void)
switch (Cmd_Argc()) switch (Cmd_Argc())
{ {
case 1: case 1:
sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET; sv_player->v.flags = (int32_t)sv_player->v.flags ^ FL_NOTARGET;
if (!((int)sv_player->v.flags & FL_NOTARGET) ) if (!((int32_t)sv_player->v.flags & FL_NOTARGET) )
SV_ClientPrintf ("notarget OFF\n"); SV_ClientPrintf ("notarget OFF\n");
else else
SV_ClientPrintf ("notarget ON\n"); SV_ClientPrintf ("notarget ON\n");
@ -545,12 +545,12 @@ void Host_Notarget_f (void)
case 2: case 2:
if (Q_atof(Cmd_Argv(1))) 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"); SV_ClientPrintf ("notarget ON\n");
} }
else 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"); SV_ClientPrintf ("notarget OFF\n");
} }
break; break;
@ -642,12 +642,12 @@ void Host_SetPos_f(void)
SV_ClientPrintf(" setpos <x> <y> <z> <pitch> <yaw> <roll>\n"); SV_ClientPrintf(" setpos <x> <y> <z> <pitch> <yaw> <roll>\n");
SV_ClientPrintf("current values:\n"); SV_ClientPrintf("current values:\n");
SV_ClientPrintf(" %i %i %i %i %i %i\n", SV_ClientPrintf(" %i %i %i %i %i %i\n",
(int)sv_player->v.origin[0], (int32_t)sv_player->v.origin[0],
(int)sv_player->v.origin[1], (int32_t)sv_player->v.origin[1],
(int)sv_player->v.origin[2], (int32_t)sv_player->v.origin[2],
(int)sv_player->v.v_angle[0], (int32_t)sv_player->v.v_angle[0],
(int)sv_player->v.v_angle[1], (int32_t)sv_player->v.v_angle[1],
(int)sv_player->v.v_angle[2]); (int32_t)sv_player->v.v_angle[2]);
return; return;
} }
@ -739,7 +739,7 @@ Host_Ping_f
*/ */
void Host_Ping_f (void) void Host_Ping_f (void)
{ {
int i, j; int32_t i, j;
float total; float total;
client_t *client; client_t *client;
@ -758,7 +758,7 @@ void Host_Ping_f (void)
for (j = 0; j < NUM_PING_TIMES; j++) for (j = 0; j < NUM_PING_TIMES; j++)
total+=client->ping_times[j]; total+=client->ping_times[j];
total /= NUM_PING_TIMES; 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) void Host_Map_f (void)
{ {
int i; int32_t i;
char name[MAX_QPATH], *p; char name[MAX_QPATH], *p;
if (Cmd_Argc() < 2) //no map name given 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) void Host_Randmap_f (void)
{ {
int i, randlevel, numlevels; int32_t i, randlevel, numlevels;
filelist_item_t *level; filelist_item_t *level;
if (cmd_source != src_command) if (cmd_source != src_command)
@ -998,7 +998,7 @@ Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current
*/ */
void Host_SavegameComment (char *text) void Host_SavegameComment (char *text)
{ {
int i; int32_t i;
char kills[20]; char kills[20];
for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++) for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
@ -1025,7 +1025,7 @@ void Host_Savegame_f (void)
{ {
char name[MAX_OSPATH]; char name[MAX_OSPATH];
FILE *f; FILE *f;
int i; int32_t i;
char comment[SAVEGAME_COMMENT_LENGTH+1]; char comment[SAVEGAME_COMMENT_LENGTH+1];
if (cmd_source != src_command) if (cmd_source != src_command)
@ -1125,10 +1125,10 @@ void Host_Loadgame_f (void)
char mapname[MAX_QPATH]; char mapname[MAX_QPATH];
float time, tfloat; float time, tfloat;
const char *data; const char *data;
int i; int32_t i;
edict_t *ent; edict_t *ent;
int entnum; int32_t entnum;
int version; int32_t version;
float spawn_parms[NUM_SPAWN_PARMS]; float spawn_parms[NUM_SPAWN_PARMS];
if (cmd_source != src_command) if (cmd_source != src_command)
@ -1182,7 +1182,7 @@ void Host_Loadgame_f (void)
data = COM_ParseFloatNewline (data, &spawn_parms[i]); data = COM_ParseFloatNewline (data, &spawn_parms[i]);
// this silliness is so we can load 1.06 save files, which have float skill values // this silliness is so we can load 1.06 save files, which have float skill values
data = COM_ParseFloatNewline(data, &tfloat); data = COM_ParseFloatNewline(data, &tfloat);
current_skill = (int)(tfloat + 0.1); current_skill = (int32_t)(tfloat + 0.1);
Cvar_SetValue ("skill", (float)current_skill); Cvar_SetValue ("skill", (float)current_skill);
data = COM_ParseStringNewline (data); data = COM_ParseStringNewline (data);
@ -1312,7 +1312,7 @@ void Host_Name_f (void)
void Host_Say(bool teamonly) void Host_Say(bool teamonly)
{ {
int j; int32_t j;
client_t *client; client_t *client;
client_t *save; client_t *save;
const char *p; const char *p;
@ -1351,8 +1351,8 @@ void Host_Say(bool teamonly)
q_snprintf (text, sizeof(text), "\001<%s> %s", hostname.string, p); q_snprintf (text, sizeof(text), "\001<%s> %s", hostname.string, p);
// check length & truncate if necessary // check length & truncate if necessary
j = (int) strlen(text); j = (int32_t) strlen(text);
if (j >= (int) sizeof(text) - 1) if (j >= (int32_t) sizeof(text) - 1)
{ {
text[sizeof(text) - 2] = '\n'; text[sizeof(text) - 2] = '\n';
text[sizeof(text) - 1] = '\0'; text[sizeof(text) - 1] = '\0';
@ -1402,7 +1402,7 @@ void Host_Say_Team_f(void)
void Host_Tell_f(void) void Host_Tell_f(void)
{ {
int j; int32_t j;
client_t *client; client_t *client;
client_t *save; client_t *save;
const char *p; const char *p;
@ -1429,8 +1429,8 @@ void Host_Tell_f(void)
q_snprintf (text, sizeof(text), "%s: %s", host_client->name, p); q_snprintf (text, sizeof(text), "%s: %s", host_client->name, p);
// check length & truncate if necessary // check length & truncate if necessary
j = (int) strlen(text); j = (int32_t) strlen(text);
if (j >= (int) sizeof(text) - 1) if (j >= (int32_t) sizeof(text) - 1)
{ {
text[sizeof(text) - 2] = '\n'; text[sizeof(text) - 2] = '\n';
text[sizeof(text) - 1] = '\0'; text[sizeof(text) - 1] = '\0';
@ -1472,12 +1472,12 @@ Host_Color_f
*/ */
void Host_Color_f(void) void Host_Color_f(void)
{ {
int top, bottom; int32_t top, bottom;
int playercolor; int32_t playercolor;
if (Cmd_Argc() == 1) 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"); Con_Printf ("color <0-13> [0-13]\n");
return; return;
} }
@ -1617,7 +1617,7 @@ Host_Spawn_f
*/ */
void Host_Spawn_f (void) void Host_Spawn_f (void)
{ {
int i; int32_t i;
client_t *client; client_t *client;
edict_t *ent; edict_t *ent;
@ -1761,7 +1761,7 @@ void Host_Kick_f (void)
const char *who; const char *who;
const char *message = NULL; const char *message = NULL;
client_t *save; client_t *save;
int i; int32_t i;
bool byNumber = false; bool byNumber = false;
if (cmd_source == src_command) if (cmd_source == src_command)
@ -1851,7 +1851,7 @@ Host_Give_f
void Host_Give_f (void) void Host_Give_f (void)
{ {
const char *t; const char *t;
int v; int32_t v;
eval_t *val; eval_t *val;
if (cmd_source == src_command) if (cmd_source == src_command)
@ -1884,21 +1884,21 @@ void Host_Give_f (void)
if (t[0] == '6') if (t[0] == '6')
{ {
if (t[1] == 'a') 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 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') 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') 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') 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 else
{ {
if (t[0] >= '2') 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; break;
@ -2013,7 +2013,7 @@ void Host_Give_f (void)
sv_player->v.armortype = 0.8; sv_player->v.armortype = 0.8;
sv_player->v.armorvalue = v; sv_player->v.armorvalue = v;
sv_player->v.items = sv_player->v.items - 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; IT_ARMOR3;
} }
else if (v > 100) else if (v > 100)
@ -2021,7 +2021,7 @@ void Host_Give_f (void)
sv_player->v.armortype = 0.6; sv_player->v.armortype = 0.6;
sv_player->v.armorvalue = v; sv_player->v.armorvalue = v;
sv_player->v.items = sv_player->v.items - 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; IT_ARMOR2;
} }
else if (v >= 0) else if (v >= 0)
@ -2029,7 +2029,7 @@ void Host_Give_f (void)
sv_player->v.armortype = 0.3; sv_player->v.armortype = 0.3;
sv_player->v.armorvalue = v; sv_player->v.armorvalue = v;
sv_player->v.items = sv_player->v.items - 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; IT_ARMOR1;
} }
break; break;
@ -2037,7 +2037,7 @@ void Host_Give_f (void)
} }
//johnfitz -- update currentammo to match new ammo (so statusbar updates correctly) //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_SHOTGUN:
case IT_SUPER_SHOTGUN: case IT_SUPER_SHOTGUN:
@ -2075,7 +2075,7 @@ void Host_Give_f (void)
edict_t *FindViewthing (void) edict_t *FindViewthing (void)
{ {
int i; int32_t i;
edict_t *e; edict_t *e;
for (i=0 ; i<sv.num_edicts ; i++) for (i=0 ; i<sv.num_edicts ; i++)
@ -2110,7 +2110,7 @@ void Host_Viewmodel_f (void)
} }
e->v.frame = 0; e->v.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) void Host_Viewframe_f (void)
{ {
edict_t *e; edict_t *e;
int f; int32_t f;
qmodel_t *m; qmodel_t *m;
e = FindViewthing (); e = FindViewthing ();
if (!e) if (!e)
return; return;
m = cl.model_precache[(int)e->v.modelindex]; m = cl.model_precache[(int32_t)e->v.modelindex];
f = atoi(Cmd_Argv(1)); f = atoi(Cmd_Argv(1));
if (f >= m->numframes) 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; aliashdr_t *hdr;
maliasframedesc_t *pframedesc; maliasframedesc_t *pframedesc;
@ -2163,7 +2163,7 @@ void Host_Viewnext_f (void)
e = FindViewthing (); e = FindViewthing ();
if (!e) if (!e)
return; 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; e->v.frame = e->v.frame + 1;
if (e->v.frame >= m->numframes) if (e->v.frame >= m->numframes)
@ -2186,7 +2186,7 @@ void Host_Viewprev_f (void)
if (!e) if (!e)
return; 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; e->v.frame = e->v.frame - 1;
if (e->v.frame < 0) if (e->v.frame < 0)
@ -2211,7 +2211,7 @@ Host_Startdemos_f
*/ */
void Host_Startdemos_f (void) void Host_Startdemos_f (void)
{ {
int i, c; int32_t i, c;
if (cls.state == ca_dedicated) if (cls.state == ca_dedicated)
return; return;

View File

@ -39,8 +39,8 @@ static char loadfilename[MAX_OSPATH]; //file scope so that error messages can us
typedef struct stdio_buffer_s { typedef struct stdio_buffer_s {
FILE *f; FILE *f;
uint8_t buffer[1024]; uint8_t buffer[1024];
int size; int32_t size;
int pos; int32_t pos;
} stdio_buffer_t; } stdio_buffer_t;
static stdio_buffer_t *Buf_Alloc(FILE *f) static stdio_buffer_t *Buf_Alloc(FILE *f)
@ -55,7 +55,7 @@ static void Buf_Free(stdio_buffer_t *buf)
free(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) 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 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; FILE *f;
@ -113,7 +113,7 @@ typedef struct targaheader_s {
targaheader_t targa_header; targaheader_t targa_header;
int fgetLittleShort (FILE *f) int32_t fgetLittleShort (FILE *f)
{ {
byte b1, b2; byte b1, b2;
@ -123,7 +123,7 @@ int fgetLittleShort (FILE *f)
return (int16_t)(b1 + b2*256); return (int16_t)(b1 + b2*256);
} }
int fgetLittleLong (FILE *f) int32_t fgetLittleLong (FILE *f)
{ {
byte b1, b2, b3, b4; 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) 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]; char pathname[MAX_OSPATH];
byte header[TARGAHEADERSIZE]; byte header[TARGAHEADERSIZE];
@ -188,13 +188,13 @@ bool Image_WriteTGA (const char *name, byte *data, int width, int height, int bp
Image_LoadTGA 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; byte *pixbuf;
int row, column; int32_t row, column;
byte *targa_rgba; 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 bool upside_down; //johnfitz -- fix for upside-down targas
stdio_buffer_t *buf; stdio_buffer_t *buf;
@ -371,8 +371,8 @@ byte *Image_LoadTGA (FILE *fin, int *width, int *height)
Buf_Free(buf); Buf_Free(buf);
fclose(fin); fclose(fin);
*width = (int)(targa_header.width); *width = (int32_t)(targa_header.width);
*height = (int)(targa_header.height); *height = (int32_t)(targa_header.height);
return targa_rgba; return targa_rgba;
} }
@ -403,10 +403,10 @@ typedef struct
Image_LoadPCX 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; pcxheader_t pcx;
int x, y, w, h, readbyte, runlength, start; int32_t x, y, w, h, readbyte, runlength, start;
byte *p, *data; byte *p, *data;
byte palette[768]; byte palette[768];
stdio_buffer_t *buf; 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; byte *flipped;
rowsize = width * (bpp / 8); rowsize = width * (bpp / 8);
@ -509,12 +509,12 @@ Image_WriteJPG -- writes using stb_image_write
returns true if successful 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; unsigned error;
char pathname[MAX_OSPATH]; char pathname[MAX_OSPATH];
byte *flipped; byte *flipped;
int bytes_per_pixel; int32_t bytes_per_pixel;
if (!(bpp == 32 || bpp == 24)) if (!(bpp == 32 || bpp == 24))
Sys_Error ("bpp not 24 or 32"); 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); 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; unsigned error;
char pathname[MAX_OSPATH]; char pathname[MAX_OSPATH];

View File

@ -26,13 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//image.h -- image reading / writing //image.h -- image reading / writing
//be sure to free the hunk after using these loading functions //be sure to free the hunk after using these loading functions
byte *Image_LoadTGA (FILE *f, int *width, int *height); byte *Image_LoadTGA (FILE *f, int32_t *width, int32_t *height);
byte *Image_LoadPCX (FILE *f, int *width, int *height); byte *Image_LoadPCX (FILE *f, int32_t *width, int32_t *height);
byte *Image_LoadImage (const char *name, int *width, int *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_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, 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);
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);
#endif /* GL_IMAGE_H */ #endif /* GL_IMAGE_H */

View File

@ -56,7 +56,7 @@ static SDL_GameController *joy_active_controller = NULL;
static bool no_mouse = false; static bool no_mouse = false;
static int buttonremap[] = static int32_t buttonremap[] =
{ {
K_MOUSE1, K_MOUSE1,
K_MOUSE3, /* right button */ K_MOUSE3, /* right button */
@ -66,9 +66,9 @@ static int buttonremap[] =
}; };
/* total accumulated mouse movement since last frame */ /* 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) switch (event->type)
{ {
@ -81,7 +81,7 @@ static int SDLCALL IN_FilterMouseEvents (const SDL_Event *event)
return 1; 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; (void)userdata;
return IN_FilterMouseEvents (event); return IN_FilterMouseEvents (event);
@ -218,8 +218,8 @@ void IN_Deactivate (bool free_cursor)
void IN_StartupJoystick (void) void IN_StartupJoystick (void)
{ {
int i; int32_t i;
int nummappings; int32_t nummappings;
char controllerdb[MAX_OSPATH]; char controllerdb[MAX_OSPATH];
SDL_GameController *gamecontroller; 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 */ 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_dx += dx;
total_dy += dy; total_dy += dy;
@ -449,7 +449,7 @@ static joyaxis_t IN_ApplyDeadzone(joyaxis_t axis, float deadzone)
IN_KeyForControllerButton IN_KeyForControllerButton
================ ================
*/ */
static int IN_KeyForControllerButton(SDL_GameControllerButton button) static int32_t IN_KeyForControllerButton(SDL_GameControllerButton button)
{ {
switch (button) switch (button)
{ {
@ -481,7 +481,7 @@ and generates key repeats if the button is held down.
Adapted from DarkPlaces by lordhavoc 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 // we can't use `realtime` for key repeats because it is not monotomic
const double currenttime = Sys_DoubleTime(); 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) void IN_Commands (void)
{ {
joyaxisstate_t newaxisstate; joyaxisstate_t newaxisstate;
int i; int32_t i;
const float stickthreshold = 0.9; const float stickthreshold = 0.9;
const float triggerthreshold = joy_deadzone_trigger.value; const float triggerthreshold = joy_deadzone_trigger.value;
@ -627,7 +627,7 @@ void IN_JoyMove (usercmd_t *cmd)
void IN_MouseMove(usercmd_t *cmd) void IN_MouseMove(usercmd_t *cmd)
{ {
int dmx, dmy; int32_t dmx, dmy;
dmx = total_dx * sensitivity.value; dmx = total_dx * sensitivity.value;
dmy = total_dy * 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) switch (scancode)
{ {
@ -834,7 +834,7 @@ static void IN_DebugKeyEvent(SDL_Event *event)
void IN_SendKeyEvents (void) void IN_SendKeyEvents (void)
{ {
SDL_Event event; SDL_Event event;
int key; int32_t key;
bool down; bool down;
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&event))

View File

@ -32,7 +32,7 @@ void IN_Commands (void);
// oportunity for devices to stick commands on the script buffer // oportunity for devices to stick commands on the script buffer
// mouse moved by dx and dy pixels // 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); void IN_SendKeyEvents (void);

View File

@ -30,12 +30,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
char key_lines[CMDLINES][MAXCMDLINE]; char key_lines[CMDLINES][MAXCMDLINE];
int key_linepos; int32_t key_linepos;
int key_insert; //johnfitz -- insert key toggle (for editing) 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 double key_blinktime; //johnfitz -- fudge cursor blinking to make it easier to spot in certain cases
int edit_line = 0; int32_t edit_line = 0;
int history_line = 0; int32_t history_line = 0;
keydest_t key_dest; keydest_t key_dest;
@ -47,7 +47,7 @@ bool keydown[MAX_KEYS];
typedef struct typedef struct
{ {
const char *name; const char *name;
int keynum; int32_t keynum;
} keyname_t; } keyname_t;
keyname_t keynames[] = keyname_t keynames[] =
@ -185,7 +185,7 @@ keyname_t keynames[] =
static void PasteToConsole (void) static void PasteToConsole (void)
{ {
char *cbd, *p, *workline; char *cbd, *p, *workline;
int mvlen, inslen; int32_t mvlen, inslen;
if (key_linepos == MAXCMDLINE - 1) if (key_linepos == MAXCMDLINE - 1)
return; return;
@ -204,14 +204,14 @@ static void PasteToConsole (void)
p++; p++;
} }
inslen = (int) (p - cbd); inslen = (int32_t) (p - cbd);
if (inslen + key_linepos > MAXCMDLINE - 1) if (inslen + key_linepos > MAXCMDLINE - 1)
inslen = MAXCMDLINE - 1 - key_linepos; inslen = MAXCMDLINE - 1 - key_linepos;
if (inslen <= 0) goto done; if (inslen <= 0) goto done;
workline = key_lines[edit_line]; workline = key_lines[edit_line];
workline += key_linepos; workline += key_linepos;
mvlen = (int) strlen(workline); mvlen = (int32_t) strlen(workline);
if (mvlen + inslen + key_linepos > MAXCMDLINE - 1) if (mvlen + inslen + key_linepos > MAXCMDLINE - 1)
{ {
mvlen = MAXCMDLINE - 1 - key_linepos - inslen; mvlen = MAXCMDLINE - 1 - key_linepos - inslen;
@ -236,12 +236,12 @@ Interactive line editing and console scrollback
==================== ====================
*/ */
extern char *con_text, key_tabpartial[MAXCMDLINE]; 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] = ""; static char current[MAXCMDLINE] = "";
int history_line_last; int32_t history_line_last;
size_t len; size_t len;
char *workline = key_lines[edit_line]; char *workline = key_lines[edit_line];
@ -304,7 +304,7 @@ void Key_Console (int key)
if (keydown[K_CTRL]) if (keydown[K_CTRL])
{ {
//skip initial empty lines //skip initial empty lines
int i, x; int32_t i, x;
char *line; char *line;
for (i = con_current - con_totallines + 1; i <= con_current; i++) for (i = con_current - con_totallines + 1; i <= con_current; i++)
@ -353,10 +353,10 @@ void Key_Console (int key)
case K_RIGHTARROW: case K_RIGHTARROW:
len = strlen(workline); len = strlen(workline);
if ((int)len == key_linepos) if ((int32_t)len == key_linepos)
{ {
len = strlen(key_lines[(edit_line + 31) & 31]); len = strlen(key_lines[(edit_line + 31) & 31]);
if ((int)len <= key_linepos) if ((int32_t)len <= key_linepos)
return; // no character to get return; // no character to get
workline += key_linepos; workline += key_linepos;
*workline = key_lines[(edit_line + 31) & 31][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; size_t len;
char *workline = key_lines[edit_line]; char *workline = key_lines[edit_line];
@ -477,14 +477,14 @@ void Char_Console (int key)
bool chat_team = false; bool chat_team = false;
static char chat_buffer[MAXCMDLINE]; static char chat_buffer[MAXCMDLINE];
static int chat_bufferlen = 0; static int32_t chat_bufferlen = 0;
const char *Key_GetChatBuffer (void) const char *Key_GetChatBuffer (void)
{ {
return chat_buffer; return chat_buffer;
} }
int Key_GetChatMsgLen (void) int32_t Key_GetChatMsgLen (void)
{ {
return chat_bufferlen; return chat_bufferlen;
} }
@ -496,7 +496,7 @@ void Key_EndChat (void)
chat_buffer[0] = 0; chat_buffer[0] = 0;
} }
void Key_Message (int key) void Key_Message (int32_t key)
{ {
switch (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) if (chat_bufferlen == sizeof(chat_buffer) - 1)
return; // all full return; // all full
@ -544,7 +544,7 @@ the given string. Single ascii characters return themselves, while
the K_* names are matched up. the K_* names are matched up.
=================== ===================
*/ */
int Key_StringToKeynum (const char *str) int32_t Key_StringToKeynum (const char *str)
{ {
keyname_t *kn; keyname_t *kn;
@ -570,7 +570,7 @@ given keynum.
FIXME: handle quote special (general escape sequence?) FIXME: handle quote special (general escape sequence?)
=================== ===================
*/ */
const char *Key_KeynumToString (int keynum) const char *Key_KeynumToString (int32_t keynum)
{ {
static char tinystr[2]; static char tinystr[2];
keyname_t *kn; keyname_t *kn;
@ -599,7 +599,7 @@ const char *Key_KeynumToString (int keynum)
Key_SetBinding Key_SetBinding
=================== ===================
*/ */
void Key_SetBinding (int keynum, const char *binding) void Key_SetBinding (int32_t keynum, const char *binding)
{ {
if (keynum == -1) if (keynum == -1)
return; return;
@ -623,7 +623,7 @@ Key_Unbind_f
*/ */
void Key_Unbind_f (void) void Key_Unbind_f (void)
{ {
int b; int32_t b;
if (Cmd_Argc() != 2) if (Cmd_Argc() != 2)
{ {
@ -643,7 +643,7 @@ void Key_Unbind_f (void)
void Key_Unbindall_f (void) void Key_Unbindall_f (void)
{ {
int i; int32_t i;
for (i = 0; i < MAX_KEYS; i++) for (i = 0; i < MAX_KEYS; i++)
{ {
@ -659,7 +659,7 @@ Key_Bindlist_f -- johnfitz
*/ */
void Key_Bindlist_f (void) void Key_Bindlist_f (void)
{ {
int i, count; int32_t i, count;
count = 0; count = 0;
for (i = 0; i < MAX_KEYS; i++) for (i = 0; i < MAX_KEYS; i++)
@ -680,7 +680,7 @@ Key_Bind_f
*/ */
void Key_Bind_f (void) void Key_Bind_f (void)
{ {
int i, c, b; int32_t i, c, b;
char cmd[1024]; char cmd[1024];
c = Cmd_Argc(); c = Cmd_Argc();
@ -727,7 +727,7 @@ Writes lines containing "bind key value"
*/ */
void Key_WriteBindings (FILE *f) void Key_WriteBindings (FILE *f)
{ {
int i; int32_t i;
// unbindall before loading stored bindings: // unbindall before loading stored bindings:
if (cfg_unbindall.value) if (cfg_unbindall.value)
@ -742,7 +742,7 @@ void Key_WriteBindings (FILE *f)
void History_Init (void) void History_Init (void)
{ {
int i, c; int32_t i, c;
FILE *hf; FILE *hf;
for (i = 0; i < CMDLINES; i++) for (i = 0; i < CMDLINES; i++)
@ -786,7 +786,7 @@ void History_Init (void)
void History_Shutdown (void) void History_Shutdown (void)
{ {
int i; int32_t i;
FILE *hf; FILE *hf;
hf = fopen(va("%s/%s", host_parms->userdir, HISTORY_FILE_NAME), "wt"); hf = fopen(va("%s/%s", host_parms->userdir, HISTORY_FILE_NAME), "wt");
@ -814,7 +814,7 @@ Key_Init
*/ */
void Key_Init (void) void Key_Init (void)
{ {
int i; int32_t i;
History_Init (); History_Init ();
@ -884,8 +884,8 @@ void Key_Init (void)
static struct { static struct {
bool active; bool active;
int lastkey; int32_t lastkey;
int lastchar; int32_t lastchar;
} key_inputgrab = { false, -1, -1 }; } key_inputgrab = { false, -1, -1 };
/* /*
@ -923,7 +923,7 @@ void Key_EndInputGrab (void)
Key_GetGrabbedInput Key_GetGrabbedInput
=================== ===================
*/ */
void Key_GetGrabbedInput (int *lastkey, int *lastchar) void Key_GetGrabbedInput (int32_t *lastkey, int32_t *lastchar)
{ {
if (lastkey) if (lastkey)
*lastkey = key_inputgrab.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! 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 *kb;
char cmd[1024]; char cmd[1024];
@ -1081,7 +1081,7 @@ Char_Event
Called by the backend when the user has input a character. 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) if (key < 32 || key > 126)
return; return;
@ -1153,7 +1153,7 @@ Key_ClearStates
*/ */
void Key_ClearStates (void) void Key_ClearStates (void)
{ {
int i; int32_t i;
for (i = 0; i < MAX_KEYS; i++) for (i = 0; i < MAX_KEYS; i++)
{ {

View File

@ -166,9 +166,9 @@ extern char *keybindings[MAX_KEYS];
#define CMDLINES 64 #define CMDLINES 64
extern char key_lines[CMDLINES][MAXCMDLINE]; extern char key_lines[CMDLINES][MAXCMDLINE];
extern int edit_line; extern int32_t edit_line;
extern int key_linepos; extern int32_t key_linepos;
extern int key_insert; extern int32_t key_insert;
extern double key_blinktime; extern double key_blinktime;
extern bool chat_team; extern bool chat_team;
@ -179,19 +179,19 @@ void Key_UpdateForDest (void);
void Key_BeginInputGrab (void); void Key_BeginInputGrab (void);
void Key_EndInputGrab (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 Key_Event (int32_t key, bool down);
void Char_Event (int key); void Char_Event (int32_t key);
bool Key_TextEntry (void); bool Key_TextEntry (void);
void Key_SetBinding (int keynum, const char *binding); void Key_SetBinding (int32_t keynum, const char *binding);
const char *Key_KeynumToString (int keynum); const char *Key_KeynumToString (int32_t keynum);
void Key_WriteBindings (FILE *f); void Key_WriteBindings (FILE *f);
void Key_EndChat (void); void Key_EndChat (void);
const char *Key_GetChatBuffer (void); const char *Key_GetChatBuffer (void);
int Key_GetChatMsgLen (void); int32_t Key_GetChatMsgLen (void);
void History_Init (void); void History_Init (void);
void History_Shutdown (void); void History_Shutdown (void);

View File

@ -673,10 +673,10 @@ Jyrki Katajainen, Alistair Moffat, Andrew Turpin, 1995.*/
/*chain node for boundary package merge*/ /*chain node for boundary package merge*/
typedef struct BPMNode 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)*/ unsigned index; /*index of this leaf node (called "count" in the paper)*/
struct BPMNode* tail; /*the next nodes in this chain (null if last)*/ struct BPMNode* tail; /*the next nodes in this chain (null if last)*/
int in_use; int32_t in_use;
} BPMNode; } BPMNode;
/*lists of chains*/ /*lists of chains*/
@ -695,7 +695,7 @@ typedef struct BPMLists
} BPMLists; } BPMLists;
/*creates a new chain node with the given parameters, from the memory in the lists */ /*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; unsigned i;
BPMNode* result; 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.*/ /*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; unsigned lastindex = lists->chains1[c]->index;
@ -768,7 +768,7 @@ static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int
else else
{ {
/*sum of the weights of the head nodes of the previous lookahead chains.*/ /*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]; lists->chains0[c] = lists->chains1[c];
if(lastindex < numpresent && sum > leaves[lastindex].weight) 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]); 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 /*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)*/ 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);
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) if(frequencies[i] > 0)
{ {
leaves[numpresent].weight = (int)frequencies[i]; leaves[numpresent].weight = (int32_t)frequencies[i];
leaves[numpresent].index = i; leaves[numpresent].index = i;
++numpresent; ++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.*/ /*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) 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 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*/ /*circular pos to prev circular pos*/
uint16_t* chain; 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 /*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*/ 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* chainz; /*those with same amount of zeros*/
uint16_t* zeros; /*length of zeros streak, used as a second hash chain*/ uint16_t* zeros; /*length of zeros streak, used as a second hash chain*/
} Hash; } Hash;
@ -1381,12 +1381,12 @@ typedef struct Hash
static unsigned hash_init(Hash* hash, unsigned windowsize) static unsigned hash_init(Hash* hash, unsigned windowsize)
{ {
unsigned i; unsigned i;
hash->head = (int*)lodepng_malloc(sizeof(int) * HASH_NUM_VALUES); hash->head = (int32_t*)lodepng_malloc(sizeof(int32_t) * HASH_NUM_VALUES);
hash->val = (int*)lodepng_malloc(sizeof(int) * windowsize); hash->val = (int32_t*)lodepng_malloc(sizeof(int32_t) * windowsize);
hash->chain = (uint16_t*)lodepng_malloc(sizeof(uint16_t) * windowsize); hash->chain = (uint16_t*)lodepng_malloc(sizeof(uint16_t) * windowsize);
hash->zeros = (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); hash->chainz = (uint16_t*)lodepng_malloc(sizeof(uint16_t) * windowsize);
if(!hash->head || !hash->chain || !hash->val || !hash->headz|| !hash->chainz || !hash->zeros) 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)*/ /*wpos = pos & (windowsize - 1)*/
static void updateHashChain(Hash* hash, size_t wpos, unsigned hashval, uint16_t numzeros) 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]; if(hash->head[hashval] != -1) hash->chain[wpos] = hash->head[hashval];
hash->head[hashval] = wpos; hash->head[hashval] = wpos;
@ -1578,7 +1578,7 @@ static unsigned encodeLZ77(uivector* out, Hash* hash,
{ {
hashpos = hash->chain[hashpos]; hashpos = hash->chain[hashpos];
/*outdated hash value, happens if particular value was not encountered in whole last window*/ /*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_ll; /*frequency of lit,len codes*/
uivector frequencies_d; /*frequency of dist codes*/ uivector frequencies_d; /*frequency of dist codes*/
uivector frequencies_cl; /*frequency of code length 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)*/ 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 /*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 (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; 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; size_t i;
if(a->colortype != b->colortype) return 0; if(a->colortype != b->colortype) return 0;
@ -2980,19 +2980,19 @@ node has 16 instead of 8 children.
struct ColorTree struct ColorTree
{ {
ColorTree* children[16]; /*up to 16 pointers to ColorTree of next level*/ 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) static void color_tree_init(ColorTree* tree)
{ {
int i; int32_t i;
for(i = 0; i != 16; ++i) tree->children[i] = 0; for(i = 0; i != 16; ++i) tree->children[i] = 0;
tree->index = -1; tree->index = -1;
} }
static void color_tree_cleanup(ColorTree* tree) static void color_tree_cleanup(ColorTree* tree)
{ {
int i; int32_t i;
for(i = 0; i != 16; ++i) for(i = 0; i != 16; ++i)
{ {
if(tree->children[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*/ /*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) 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; if(!tree->children[i]) return -1;
else tree = tree->children[i]; 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 #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; 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, static void color_tree_add(ColorTree* tree,
uint8_t r, uint8_t g, uint8_t b, uint8_t a, unsigned index) 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) 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]) if(!tree->children[i])
{ {
tree->children[i] = (ColorTree*)lodepng_malloc(sizeof(ColorTree)); tree->children[i] = (ColorTree*)lodepng_malloc(sizeof(ColorTree));
@ -3039,7 +3039,7 @@ static void color_tree_add(ColorTree* tree,
} }
tree = tree->children[i]; 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*/ /*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) 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(index < 0) return 82; /*color not in palette*/
if(mode->bitdepth == 8) out[i] = index; if(mode->bitdepth == 8) out[i] = index;
else addColorBits(out, i, mode->bitdepth, (unsigned)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++*/ /*function used for debug purposes with C++*/
/*void printColorProfile(LodePNGColorProfile* p) /*void printColorProfile(LodePNGColorProfile* p)
{ {
std::cout << "colored: " << (int)p->colored << ", "; std::cout << "colored: " << (int32_t)p->colored << ", ";
std::cout << "key: " << (int)p->key << ", "; std::cout << "key: " << (int32_t)p->key << ", ";
std::cout << "key_r: " << (int)p->key_r << ", "; std::cout << "key_r: " << (int32_t)p->key_r << ", ";
std::cout << "key_g: " << (int)p->key_g << ", "; std::cout << "key_g: " << (int32_t)p->key_g << ", ";
std::cout << "key_b: " << (int)p->key_b << ", "; std::cout << "key_b: " << (int32_t)p->key_b << ", ";
std::cout << "alpha: " << (int)p->alpha << ", "; std::cout << "alpha: " << (int32_t)p->alpha << ", ";
std::cout << "numcolors: " << (int)p->numcolors << ", "; std::cout << "numcolors: " << (int32_t)p->numcolors << ", ";
std::cout << "bits: " << (int)p->bits << std::endl; std::cout << "bits: " << (int32_t)p->bits << std::endl;
}*/ }*/
/*Returns how many bits needed to represent given value (max 8 bit)*/ /*Returns how many bits needed to represent given value (max 8 bit)*/

View File

@ -1524,7 +1524,7 @@ examples can be found on the LodePNG website.
#include "lodepng.h" #include "lodepng.h"
#include <iostream> #include <iostream>
int main(int argc, char *argv[]) int32_t main(int32_t argc, char *argv[])
{ {
const char* filename = argc > 1 ? argv[1] : "test.png"; const char* filename = argc > 1 ? argv[1] : "test.png";
@ -1544,7 +1544,7 @@ int main(int argc, char *argv[])
#include "lodepng.h" #include "lodepng.h"
int main(int argc, char *argv[]) int32_t main(int32_t argc, char *argv[])
{ {
unsigned error; unsigned error;
uint8_t* image; uint8_t* image;
@ -1689,7 +1689,7 @@ symbol.
C++ wrapper around this provides an interface almost identical to before. 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 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. 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 *) 30 aug 2007: bug fixed which makes this Borland C++ compatible
*) 09 aug 2007: some VS2005 warnings removed again *) 09 aug 2007: some VS2005 warnings removed again
*) 21 jul 2007: deflate code placed in new namespace separate from zlib code *) 21 jul 2007: deflate code placed in new namespace separate from zlib code

View File

@ -71,9 +71,9 @@ static quakeparms_t parms;
#define main SDL_main #define main SDL_main
#endif #endif
int main(int argc, char *argv[]) int32_t main(int32_t argc, char *argv[])
{ {
int t; int32_t t;
double time, oldtime, newtime; double time, oldtime, newtime;
host_parms = &parms; host_parms = &parms;

View File

@ -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 ) void PerpendicularVector( vec3_t dst, const vec3_t src )
{ {
int pos; int32_t pos;
int i; int32_t i;
float minelem = 1.0F; float minelem = 1.0F;
vec3_t tempvec; vec3_t tempvec;
@ -95,11 +95,11 @@ float anglemod(float a)
{ {
#if 0 #if 0
if (a >= 0) if (a >= 0)
a -= 360*(int)(a/360); a -= 360*(int32_t)(a/360);
else else
a += 360*( 1 + (int)(-a/360) ); a += 360*( 1 + (int32_t)(-a/360) );
#endif #endif
a = (360.0/65536) * ((int)(a*(65536/360.0)) & 65535); a = (360.0/65536) * ((int32_t)(a*(65536/360.0)) & 65535);
return a; return a;
} }
@ -111,10 +111,10 @@ BoxOnPlaneSide
Returns 1, 2, or 1 + 2 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; float dist1, dist2;
int sides; int32_t sides;
#if 0 // this is done by the BOX_ON_PLANE_SIDE macro before calling this #if 0 // this is done by the BOX_ON_PLANE_SIDE macro before calling this
// function // function
@ -171,7 +171,7 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p)
} }
#if 0 #if 0
int i; int32_t i;
vec3_t corners[2]; vec3_t corners[2];
for (i=0 ; i<3 ; i++) 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; 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++) for (i=0 ; i<3 ; i++)
if (v1[i] != v2[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) while (val>>=1)
answer++; answer++;
return answer; return answer;
@ -421,10 +421,10 @@ quotient must fit in 32 bits.
==================== ====================
*/ */
void FloorDivMod (double numer, double denom, int *quotient, void FloorDivMod (double numer, double denom, int32_t *quotient,
int *rem) int32_t *rem)
{ {
int q, r; int32_t q, r;
double x; double x;
#ifndef PARANOID #ifndef PARANOID
@ -440,8 +440,8 @@ void FloorDivMod (double numer, double denom, int *quotient,
{ {
x = floor(numer / denom); x = floor(numer / denom);
q = (int)x; q = (int32_t)x;
r = (int)floor(numer - (x * denom)); r = (int32_t)floor(numer - (x * denom));
} }
else 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 // perform operations with positive values, and fix mod to make floor-based
// //
x = floor(-numer / denom); x = floor(-numer / denom);
q = -(int)x; q = -(int32_t)x;
r = (int)floor(-numer - (x * denom)); r = (int32_t)floor(-numer - (x * denom));
if (r != 0) if (r != 0)
{ {
q--; q--;
r = (int)denom - r; r = (int32_t)denom - r;
} }
} }
@ -468,7 +468,7 @@ void FloorDivMod (double numer, double denom, int *quotient,
GreatestCommonDivisor GreatestCommonDivisor
==================== ====================
*/ */
int GreatestCommonDivisor (int i1, int i2) int32_t GreatestCommonDivisor (int32_t i1, int32_t i2)
{ {
if (i1 > i2) if (i1 > i2)
{ {

View File

@ -40,16 +40,16 @@ extern vec3_t vec3_origin;
#define nanmask (255 << 23) /* 7F800000 */ #define nanmask (255 << 23) /* 7F800000 */
#if 0 /* macro is violating strict aliasing rules */ #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 #else
static inline int IS_NAN (float x) { static inline int32_t IS_NAN (float x) {
union { float f; int i; } num; union { float f; int32_t i; } num;
num.f = x; num.f = x;
return ((num.i & nanmask) == nanmask); return ((num.i & nanmask) == nanmask);
} }
#endif #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 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]) #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];} #define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
//johnfitz -- courtesy of lordhavoc //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)\ #define VectorNormalizeFast(_v)\
{\ {\
union { float f; int i; } _y, _number;\ union { float f; int32_t i; } _y, _number;\
_number.f = DotProduct(_v, _v);\ _number.f = DotProduct(_v, _v);\
if (_number.f != 0.0)\ 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 _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorCopy (vec3_t in, 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); vec_t VectorLength (vec3_t v);
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross); void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
float VectorNormalize (vec3_t v); // returns vector length float VectorNormalize (vec3_t v); // returns vector length
void VectorInverse (vec3_t v); void VectorInverse (vec3_t v);
void VectorScale (vec3_t in, vec_t scale, vec3_t out); 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_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 R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
void FloorDivMod (double numer, double denom, int *quotient, void FloorDivMod (double numer, double denom, int32_t *quotient,
int *rem); int32_t *rem);
int GreatestCommonDivisor (int i1, int i2); int32_t GreatestCommonDivisor (int32_t i1, int32_t i2);
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); 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); float anglemod(float a);

View File

@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void (*vid_menucmdfn)(void); //johnfitz void (*vid_menucmdfn)(void); //johnfitz
void (*vid_menudrawfn)(void); void (*vid_menudrawfn)(void);
void (*vid_menukeyfn)(int key); void (*vid_menukeyfn)(int32_t key);
enum m_state_e m_state; enum m_state_e m_state;
@ -63,22 +63,22 @@ void M_Main_Draw (void);
void M_Help_Draw (void); void M_Help_Draw (void);
void M_Quit_Draw (void); void M_Quit_Draw (void);
void M_Main_Key (int key); void M_Main_Key (int32_t key);
void M_SinglePlayer_Key (int key); void M_SinglePlayer_Key (int32_t key);
void M_Load_Key (int key); void M_Load_Key (int32_t key);
void M_Save_Key (int key); void M_Save_Key (int32_t key);
void M_MultiPlayer_Key (int key); void M_MultiPlayer_Key (int32_t key);
void M_Setup_Key (int key); void M_Setup_Key (int32_t key);
void M_Net_Key (int key); void M_Net_Key (int32_t key);
void M_LanConfig_Key (int key); void M_LanConfig_Key (int32_t key);
void M_GameOptions_Key (int key); void M_GameOptions_Key (int32_t key);
void M_Search_Key (int key); void M_Search_Key (int32_t key);
void M_ServerList_Key (int key); void M_ServerList_Key (int32_t key);
void M_Options_Key (int key); void M_Options_Key (int32_t key);
void M_Keys_Key (int key); void M_Keys_Key (int32_t key);
void M_Video_Key (int key); void M_Video_Key (int32_t key);
void M_Help_Key (int key); void M_Help_Key (int32_t key);
void M_Quit_Key (int key); void M_Quit_Key (int32_t key);
bool m_entersound; // play after drawing a frame, so caching bool m_entersound; // play after drawing a frame, so caching
// won't disrupt the sound // won't disrupt the sound
@ -102,12 +102,12 @@ M_DrawCharacter
Draws one solid graphics character 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); 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) 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) 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 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 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 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; qpic_t *p;
int cx, cy; int32_t cx, cy;
int n; int32_t n;
// draw left side // draw left side
cx = x; 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 */ /* MAIN MENU */
int m_main_cursor; int32_t m_main_cursor;
#define MAIN_ITEMS 5 #define MAIN_ITEMS 5
@ -257,7 +257,7 @@ void M_Menu_Main_f (void)
void M_Main_Draw (void) void M_Main_Draw (void)
{ {
int f; int32_t f;
qpic_t *p; qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); 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_DrawPic ( (320-p->width)/2, 4, p);
M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp") ); 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 ) ) ); 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) switch (key)
{ {
@ -332,7 +332,7 @@ void M_Main_Key (int key)
//============================================================================= //=============================================================================
/* SINGLE PLAYER MENU */ /* SINGLE PLAYER MENU */
int m_singleplayer_cursor; int32_t m_singleplayer_cursor;
#define SINGLEPLAYER_ITEMS 3 #define SINGLEPLAYER_ITEMS 3
@ -347,7 +347,7 @@ void M_Menu_SinglePlayer_f (void)
void M_SinglePlayer_Draw (void) void M_SinglePlayer_Draw (void)
{ {
int f; int32_t f;
qpic_t *p; qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); 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_DrawPic ( (320-p->width)/2, 4, p);
M_DrawTransPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp") ); 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 ) ) ); 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) switch (key)
{ {
@ -417,18 +417,18 @@ void M_SinglePlayer_Key (int key)
//============================================================================= //=============================================================================
/* LOAD/SAVE MENU */ /* 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 */ #define MAX_SAVEGAMES 20 /* johnfitz -- increased from 12 */
char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1]; char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
int loadable[MAX_SAVEGAMES]; int32_t loadable[MAX_SAVEGAMES];
void M_ScanSaves (void) void M_ScanSaves (void)
{ {
int i, j; int32_t i, j;
char name[MAX_OSPATH]; char name[MAX_OSPATH];
FILE *f; FILE *f;
int version; int32_t version;
for (i = 0; i < MAX_SAVEGAMES; i++) for (i = 0; i < MAX_SAVEGAMES; i++)
{ {
@ -483,7 +483,7 @@ void M_Menu_Save_f (void)
void M_Load_Draw (void) void M_Load_Draw (void)
{ {
int i; int32_t i;
qpic_t *p; qpic_t *p;
p = Draw_CachePic ("gfx/p_load.lmp"); 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]); M_Print (16, 32 + 8*i, m_filenames[i]);
// line cursor // 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) void M_Save_Draw (void)
{ {
int i; int32_t i;
qpic_t *p; qpic_t *p;
p = Draw_CachePic ("gfx/p_save.lmp"); 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]); M_Print (16, 32 + 8*i, m_filenames[i]);
// line cursor // 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) 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) switch (k)
{ {
@ -598,7 +598,7 @@ void M_Save_Key (int k)
//============================================================================= //=============================================================================
/* MULTIPLAYER MENU */ /* MULTIPLAYER MENU */
int m_multiplayer_cursor; int32_t m_multiplayer_cursor;
#define MULTIPLAYER_ITEMS 3 #define MULTIPLAYER_ITEMS 3
@ -613,7 +613,7 @@ void M_Menu_MultiPlayer_f (void)
void M_MultiPlayer_Draw (void) void M_MultiPlayer_Draw (void)
{ {
int f; int32_t f;
qpic_t *p; qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); 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_DrawPic ( (320-p->width)/2, 4, p);
M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mp_menu.lmp") ); 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 ) ) ); 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) switch (key)
{ {
@ -678,15 +678,15 @@ void M_MultiPlayer_Key (int key)
//============================================================================= //=============================================================================
/* SETUP MENU */ /* SETUP MENU */
int setup_cursor = 4; int32_t setup_cursor = 4;
int setup_cursor_table[] = {40, 56, 80, 104, 140}; int32_t setup_cursor_table[] = {40, 56, 80, 104, 140};
char setup_hostname[16]; char setup_hostname[16];
char setup_myname[16]; char setup_myname[16];
int setup_oldtop; int32_t setup_oldtop;
int setup_oldbottom; int32_t setup_oldbottom;
int setup_top; int32_t setup_top;
int setup_bottom; int32_t setup_bottom;
#define NUM_SETUP_CMDS 5 #define NUM_SETUP_CMDS 5
@ -698,8 +698,8 @@ void M_Menu_Setup_f (void)
m_entersound = true; m_entersound = true;
Q_strcpy(setup_myname, cl_name.string); Q_strcpy(setup_myname, cl_name.string);
Q_strcpy(setup_hostname, hostname.string); Q_strcpy(setup_hostname, hostname.string);
setup_top = setup_oldtop = ((int)cl_color.value) >> 4; setup_top = setup_oldtop = ((int32_t)cl_color.value) >> 4;
setup_bottom = setup_oldbottom = ((int)cl_color.value) & 15; 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"); p = Draw_CachePic ("gfx/menuplyr.lmp");
M_DrawTransPicTranslate (172, 72, p, setup_top, setup_bottom); 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) 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) 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) 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) switch (setup_cursor)
{ {
@ -863,8 +863,8 @@ bool M_Setup_TextEntry (void)
//============================================================================= //=============================================================================
/* NET MENU */ /* NET MENU */
int m_net_cursor; int32_t m_net_cursor;
int m_net_items; int32_t m_net_items;
const char *net_helpMessage [] = const char *net_helpMessage [] =
{ {
@ -897,7 +897,7 @@ void M_Menu_Net_f (void)
void M_Net_Draw (void) void M_Net_Draw (void)
{ {
int f; int32_t f;
qpic_t *p; qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); 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, 120, net_helpMessage[m_net_cursor*4+2]);
M_Print (f, 128, net_helpMessage[m_net_cursor*4+3]); 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 ) ) ); 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: again:
switch (k) switch (k)
@ -1007,7 +1007,7 @@ enum
#define SLIDER_RANGE 10 #define SLIDER_RANGE 10
int options_cursor; int32_t options_cursor;
void M_Menu_Options_f (void) 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; float f, l;
S_LocalSound ("misc/menu3.wav"); 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) if (range < 0)
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); 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 0
if (on) if (on)
@ -1255,11 +1255,11 @@ void M_Options_Draw (void)
M_Print (16, 32 + 8*OPT_VIDEO, " Video Options"); M_Print (16, 32 + 8*OPT_VIDEO, " Video Options");
// cursor // 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) switch (k)
{ {
@ -1358,7 +1358,7 @@ const char *bindnames[][2] =
#define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0])) #define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
static int keys_cursor; static int32_t keys_cursor;
static bool bind_grab; static bool bind_grab;
void M_Menu_Keys_f (void) 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; int32_t count;
int j; int32_t j;
int l; int32_t l;
char *b; char *b;
threekeys[0] = threekeys[1] = threekeys[2] = -1; 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) void M_UnbindCommand (const char *command)
{ {
int j; int32_t j;
int l; int32_t l;
char *b; char *b;
l = strlen(command); l = strlen(command);
@ -1418,8 +1418,8 @@ extern qpic_t *pic_up, *pic_down;
void M_Keys_Draw (void) void M_Keys_Draw (void)
{ {
int i, x, y; int32_t i, x, y;
int keys[3]; int32_t keys[3];
const char *name; const char *name;
qpic_t *p; qpic_t *p;
@ -1432,7 +1432,7 @@ void M_Keys_Draw (void)
M_Print (18, 32, "Enter to change, backspace to clear"); M_Print (18, 32, "Enter to change, backspace to clear");
// search for known bindings // search for known bindings
for (i = 0; i < (int)NUMCOMMANDS; i++) for (i = 0; i < (int32_t)NUMCOMMANDS; i++)
{ {
y = 48 + 8*i; y = 48 + 8*i;
@ -1467,14 +1467,14 @@ void M_Keys_Draw (void)
if (bind_grab) if (bind_grab)
M_DrawCharacter (130, 48 + keys_cursor*8, '='); M_DrawCharacter (130, 48 + keys_cursor*8, '=');
else 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]; char cmd[80];
int keys[3]; int32_t keys[3];
if (bind_grab) if (bind_grab)
{ // defining a key { // defining a key
@ -1509,7 +1509,7 @@ void M_Keys_Key (int k)
case K_RIGHTARROW: case K_RIGHTARROW:
S_LocalSound ("misc/menu1.wav"); S_LocalSound ("misc/menu1.wav");
keys_cursor++; keys_cursor++;
if (keys_cursor >= (int)NUMCOMMANDS) if (keys_cursor >= (int32_t)NUMCOMMANDS)
keys_cursor = 0; keys_cursor = 0;
break; 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); (*vid_menukeyfn) (key);
} }
@ -1555,7 +1555,7 @@ void M_Video_Key (int key)
//============================================================================= //=============================================================================
/* HELP MENU */ /* HELP MENU */
int help_page; int32_t help_page;
#define NUM_HELP_PAGES 6 #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) switch (key)
{ {
@ -1605,7 +1605,7 @@ void M_Help_Key (int key)
//============================================================================= //=============================================================================
/* QUIT MENU */ /* QUIT MENU */
int msgNumber; int32_t msgNumber;
enum m_state_e m_quit_prevstate; enum m_state_e m_quit_prevstate;
bool wasInMenus; 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) 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) switch (key)
{ {
@ -1686,7 +1686,7 @@ void M_Quit_Draw (void) //johnfitz -- modified for new quit message
char msg1[40]; char msg1[40];
char msg2[] = "by Ozkan, Ericw & Stevenaaus"; /* msg2/msg3 are mostly [40] */ char msg2[] = "by Ozkan, Ericw & Stevenaaus"; /* msg2/msg3 are mostly [40] */
char msg3[] = "Press y to quit"; char msg3[] = "Press y to quit";
int boxlen; int32_t boxlen;
if (wasInMenus) if (wasInMenus)
{ {
@ -1714,11 +1714,11 @@ void M_Quit_Draw (void) //johnfitz -- modified for new quit message
//============================================================================= //=============================================================================
/* LAN CONFIG MENU */ /* LAN CONFIG MENU */
int lanConfig_cursor = -1; int32_t lanConfig_cursor = -1;
int lanConfig_cursor_table [] = {72, 92, 124}; int32_t lanConfig_cursor_table [] = {72, 92, 124};
#define NUM_LANCONFIG_CMDS 3 #define NUM_LANCONFIG_CMDS 3
int lanConfig_port; int32_t lanConfig_port;
char lanConfig_portname[6]; char lanConfig_portname[6];
char lanConfig_joinname[22]; char lanConfig_joinname[22];
@ -1748,7 +1748,7 @@ void M_Menu_LanConfig_f (void)
void M_LanConfig_Draw (void) void M_LanConfig_Draw (void)
{ {
qpic_t *p; qpic_t *p;
int basex; int32_t basex;
const char *startJoin; const char *startJoin;
const char *protocol; const char *protocol;
@ -1791,22 +1791,22 @@ void M_LanConfig_Draw (void)
M_Print (basex+8, lanConfig_cursor_table[1], "OK"); 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) 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) 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) if (*m_return_reason)
M_PrintWhite (basex, 148, 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) 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) switch (lanConfig_cursor)
{ {
@ -2039,8 +2039,8 @@ level_t roguelevels[] =
typedef struct typedef struct
{ {
const char *description; const char *description;
int firstLevel; int32_t firstLevel;
int levels; int32_t levels;
} episode_t; } episode_t;
episode_t episodes[] = episode_t episodes[] =
@ -2075,9 +2075,9 @@ episode_t rogueepisodes[] =
{"Deathmatch Arena", 16, 1} {"Deathmatch Arena", 16, 1}
}; };
int startepisode; int32_t startepisode;
int startlevel; int32_t startlevel;
int maxplayers; int32_t maxplayers;
bool m_serverInfoMessage = false; bool m_serverInfoMessage = false;
double m_serverInfoMessageTime; 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 #define NUM_GAMEOPTIONS 9
int gameoptions_cursor; int32_t gameoptions_cursor;
void M_GameOptions_Draw (void) void M_GameOptions_Draw (void)
{ {
qpic_t *p; qpic_t *p;
int x; int32_t x;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
p = Draw_CachePic ("gfx/p_multi.lmp"); p = Draw_CachePic ("gfx/p_multi.lmp");
@ -2124,7 +2124,7 @@ void M_GameOptions_Draw (void)
{ {
const char *msg; const char *msg;
switch((int)teamplay.value) switch((int32_t)teamplay.value)
{ {
case 1: msg = "No Friendly Fire"; break; case 1: msg = "No Friendly Fire"; break;
case 2: msg = "Friendly Fire"; break; case 2: msg = "Friendly Fire"; break;
@ -2140,7 +2140,7 @@ void M_GameOptions_Draw (void)
{ {
const char *msg; const char *msg;
switch((int)teamplay.value) switch((int32_t)teamplay.value)
{ {
case 1: msg = "No Friendly Fire"; break; case 1: msg = "No Friendly Fire"; break;
case 2: msg = "Friendly Fire"; break; case 2: msg = "Friendly Fire"; break;
@ -2163,13 +2163,13 @@ void M_GameOptions_Draw (void)
if (fraglimit.value == 0) if (fraglimit.value == 0)
M_Print (160, 88, "none"); M_Print (160, 88, "none");
else 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"); M_Print (0, 96, " Time Limit");
if (timelimit.value == 0) if (timelimit.value == 0)
M_Print (160, 96, "none"); M_Print (160, 96, "none");
else 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"); M_Print (0, 112, " Episode");
// MED 01/06/97 added hipnotic episodes // MED 01/06/97 added hipnotic episodes
@ -2201,7 +2201,7 @@ void M_GameOptions_Draw (void)
} }
// line cursor // 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) 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; float f;
switch (gameoptions_cursor) 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) switch (key)
{ {
@ -2405,7 +2405,7 @@ void M_Menu_Search_f (void)
void M_Search_Draw (void) void M_Search_Draw (void)
{ {
qpic_t *p; qpic_t *p;
int x; int32_t x;
p = Draw_CachePic ("gfx/p_multi.lmp"); p = Draw_CachePic ("gfx/p_multi.lmp");
M_DrawPic ( (320-p->width)/2, 4, p); 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; (void)key;
} }
@ -2447,7 +2447,7 @@ void M_Search_Key (int key)
//============================================================================= //=============================================================================
/* SLIST MENU */ /* SLIST MENU */
int slist_cursor; int32_t slist_cursor;
bool slist_sorted; bool slist_sorted;
void M_Menu_ServerList_f (void) void M_Menu_ServerList_f (void)
@ -2465,7 +2465,7 @@ void M_Menu_ServerList_f (void)
void M_ServerList_Draw (void) void M_ServerList_Draw (void)
{ {
int n; int32_t n;
qpic_t *p; qpic_t *p;
if (!slist_sorted) if (!slist_sorted)
@ -2478,14 +2478,14 @@ void M_ServerList_Draw (void)
M_DrawPic ( (320-p->width)/2, 4, p); M_DrawPic ( (320-p->width)/2, 4, p);
for (n = 0; n < hostCacheCount; n++) for (n = 0; n < hostCacheCount; n++)
M_Print (16, 32 + 8*n, NET_SlistPrintServer (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) if (*m_return_reason)
M_PrintWhite (16, 148, 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) switch (k)
{ {
@ -2663,7 +2663,7 @@ void M_Draw (void)
} }
void M_Keydown (int key) void M_Keydown (int32_t key)
{ {
switch (m_state) 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) switch (m_state)
{ {

View File

@ -52,8 +52,8 @@ extern bool m_entersound;
// menus // menus
// //
void M_Init (void); void M_Init (void);
void M_Keydown (int key); void M_Keydown (int32_t key);
void M_Charinput (int key); void M_Charinput (int32_t key);
bool M_TextEntry (void); bool M_TextEntry (void);
void M_ToggleMenu_f (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_Options_f (void);
void M_Menu_Quit_f (void); void M_Menu_Quit_f (void);
void M_Print (int cx, int cy, const char *str); void M_Print (int32_t cx, int32_t 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);
void M_Draw (void); 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_DrawPic (int32_t x, int32_t y, qpic_t *pic);
void M_DrawTransPic (int x, int y, qpic_t *pic); void M_DrawTransPic (int32_t x, int32_t y, qpic_t *pic);
void M_DrawCheckbox (int x, int y, int on); void M_DrawCheckbox (int32_t x, int32_t y, int32_t on);
#endif /* _QUAKE_MENU_H */ #endif /* _QUAKE_MENU_H */

View File

@ -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 enum { ALIAS_SKIN_SINGLE=0, ALIAS_SKIN_GROUP } aliasskintype_t;
typedef struct { typedef struct {
int ident; int32_t ident;
int version; int32_t version;
vec3_t scale; vec3_t scale;
vec3_t scale_origin; vec3_t scale_origin;
float boundingradius; float boundingradius;
vec3_t eyeposition; vec3_t eyeposition;
int numskins; int32_t numskins;
int skinwidth; int32_t skinwidth;
int skinheight; int32_t skinheight;
int numverts; int32_t numverts;
int numtris; int32_t numtris;
int numframes; int32_t numframes;
synctype_t synctype; synctype_t synctype;
int flags; int32_t flags;
float size; float size;
} mdl_t; } mdl_t;
// TODO: could be shorts // TODO: could be shorts
typedef struct { typedef struct {
int onseam; int32_t onseam;
int s; int32_t s;
int t; int32_t t;
} stvert_t; } stvert_t;
typedef struct dtriangle_s { typedef struct dtriangle_s {
int facesfront; int32_t facesfront;
int vertindex[3]; int32_t vertindex[3];
} dtriangle_t; } dtriangle_t;
#define DT_FACES_FRONT 0x0010 #define DT_FACES_FRONT 0x0010
@ -109,13 +109,13 @@ typedef struct {
} daliasframe_t; } daliasframe_t;
typedef struct { typedef struct {
int numframes; int32_t numframes;
trivertx_t bboxmin; // lightnormal isn't used trivertx_t bboxmin; // lightnormal isn't used
trivertx_t bboxmax; // lightnormal isn't used trivertx_t bboxmax; // lightnormal isn't used
} daliasgroup_t; } daliasgroup_t;
typedef struct { typedef struct {
int numskins; int32_t numskins;
} daliasskingroup_t; } daliasskingroup_t;
typedef struct { typedef struct {

View File

@ -36,14 +36,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define NET_MAXMESSAGE 64000 /* ericw -- was 32000 */ #define NET_MAXMESSAGE 64000 /* ericw -- was 32000 */
extern int DEFAULTnet_hostport; extern int32_t DEFAULTnet_hostport;
extern int net_hostport; extern int32_t net_hostport;
extern cvar_t hostname; extern cvar_t hostname;
extern double net_time; extern double net_time;
extern sizebuf_t net_message; extern sizebuf_t net_message;
extern int net_activeconnections; extern int32_t net_activeconnections;
void NET_Init (void); 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 // Returns true or false if the given qsocket can currently accept a
// message to be transmitted. // 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 data in net_message sizebuf
// returns 0 if no data is waiting // returns 0 if no data is waiting
// returns 1 if a message was received // returns 1 if a message was received
// returns 2 if an unreliable message was received // returns 2 if an unreliable message was received
// returns -1 if the connection died // returns -1 if the connection died
int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data); int32_t NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data);
int NET_SendUnreliableMessage (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 // returns 0 if the message connot be delivered reliably, but the connection
// is still considered valid // is still considered valid
// returns 1 if the message was sent properly // returns 1 if the message was sent properly
// returns -1 if the connection died // 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. // This is a reliable *blocking* send to all attached clients.
void NET_Close (struct qsocket_s *sock); void NET_Close (struct qsocket_s *sock);
@ -96,12 +96,12 @@ extern bool slistInProgress;
extern bool slistSilent; extern bool slistSilent;
extern bool slistLocal; extern bool slistLocal;
extern int hostCacheCount; extern int32_t hostCacheCount;
void NET_Slist_f (void); void NET_Slist_f (void);
void NET_SlistSort (void); void NET_SlistSort (void);
const char *NET_SlistPrintServer (int n); const char *NET_SlistPrintServer (int32_t n);
const char *NET_SlistPrintServerName (int n); const char *NET_SlistPrintServerName (int32_t n);
/* FIXME: driver related, but public: /* FIXME: driver related, but public:

View File

@ -138,20 +138,20 @@ typedef struct qsocket_s
bool canSend; bool canSend;
bool sendNext; bool sendNext;
int driver; int32_t driver;
int landriver; int32_t landriver;
sys_socket_t socket; sys_socket_t socket;
void *driverdata; void *driverdata;
uint32_t ackSequence; uint32_t ackSequence;
uint32_t sendSequence; uint32_t sendSequence;
uint32_t unreliableSendSequence; uint32_t unreliableSendSequence;
int sendMessageLength; int32_t sendMessageLength;
byte sendMessage [NET_MAXMESSAGE]; byte sendMessage [NET_MAXMESSAGE];
uint32_t receiveSequence; uint32_t receiveSequence;
uint32_t unreliableReceiveSequence; uint32_t unreliableReceiveSequence;
int receiveMessageLength; int32_t receiveMessageLength;
byte receiveMessage [NET_MAXMESSAGE]; byte receiveMessage [NET_MAXMESSAGE];
struct qsockaddr addr; struct qsockaddr addr;
@ -161,7 +161,7 @@ typedef struct qsocket_s
extern qsocket_t *net_activeSockets; extern qsocket_t *net_activeSockets;
extern qsocket_t *net_freeSockets; extern qsocket_t *net_freeSockets;
extern int net_numsockets; extern int32_t net_numsockets;
typedef struct typedef struct
{ {
@ -171,39 +171,39 @@ typedef struct
sys_socket_t (*Init) (void); sys_socket_t (*Init) (void);
void (*Shutdown) (void); void (*Shutdown) (void);
void (*Listen) (bool state); void (*Listen) (bool state);
sys_socket_t (*Open_Socket) (int port); sys_socket_t (*Open_Socket) (int32_t port);
int (*Close_Socket) (sys_socket_t socketid); int32_t (*Close_Socket) (sys_socket_t socketid);
int (*Connect) (sys_socket_t socketid, struct qsockaddr *addr); int32_t (*Connect) (sys_socket_t socketid, struct qsockaddr *addr);
sys_socket_t (*CheckNewConnections) (void); sys_socket_t (*CheckNewConnections) (void);
int (*Read) (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); int32_t (*Read) (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr);
int (*Write) (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr); int32_t (*Write) (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr);
int (*Broadcast) (sys_socket_t socketid, byte *buf, int len); int32_t (*Broadcast) (sys_socket_t socketid, byte *buf, int32_t len);
const char * (*AddrToString) (struct qsockaddr *addr); const char * (*AddrToString) (struct qsockaddr *addr);
int (*StringToAddr) (const char *string, struct qsockaddr *addr); int32_t (*StringToAddr) (const char *string, struct qsockaddr *addr);
int (*GetSocketAddr) (sys_socket_t socketid, struct qsockaddr *addr); int32_t (*GetSocketAddr) (sys_socket_t socketid, struct qsockaddr *addr);
int (*GetNameFromAddr) (struct qsockaddr *addr, char *name); int32_t (*GetNameFromAddr) (struct qsockaddr *addr, char *name);
int (*GetAddrFromName) (const char *name, struct qsockaddr *addr); int32_t (*GetAddrFromName) (const char *name, struct qsockaddr *addr);
int (*AddrCompare) (struct qsockaddr *addr1, struct qsockaddr *addr2); int32_t (*AddrCompare) (struct qsockaddr *addr1, struct qsockaddr *addr2);
int (*GetSocketPort) (struct qsockaddr *addr); int32_t (*GetSocketPort) (struct qsockaddr *addr);
int (*SetSocketPort) (struct qsockaddr *addr, int port); int32_t (*SetSocketPort) (struct qsockaddr *addr, int32_t port);
} net_landriver_t; } net_landriver_t;
#define MAX_NET_DRIVERS 8 #define MAX_NET_DRIVERS 8
extern net_landriver_t net_landrivers[]; extern net_landriver_t net_landrivers[];
extern const int net_numlandrivers; extern const int32_t net_numlandrivers;
typedef struct typedef struct
{ {
const char *name; const char *name;
bool initialized; bool initialized;
int (*Init) (void); int32_t (*Init) (void);
void (*Listen) (bool state); void (*Listen) (bool state);
void (*SearchForHosts) (bool xmit); void (*SearchForHosts) (bool xmit);
qsocket_t *(*Connect) (const char *host); qsocket_t *(*Connect) (const char *host);
qsocket_t *(*CheckNewConnections) (void); qsocket_t *(*CheckNewConnections) (void);
int (*QGetMessage) (qsocket_t *sock); int32_t (*QGetMessage) (qsocket_t *sock);
int (*QSendMessage) (qsocket_t *sock, sizebuf_t *data); int32_t (*QSendMessage) (qsocket_t *sock, sizebuf_t *data);
int (*SendUnreliableMessage) (qsocket_t *sock, sizebuf_t *data); int32_t (*SendUnreliableMessage) (qsocket_t *sock, sizebuf_t *data);
bool (*CanSendMessage) (qsocket_t *sock); bool (*CanSendMessage) (qsocket_t *sock);
bool (*CanSendUnreliableMessage) (qsocket_t *sock); bool (*CanSendUnreliableMessage) (qsocket_t *sock);
void (*Close) (qsocket_t *sock); void (*Close) (qsocket_t *sock);
@ -211,17 +211,17 @@ typedef struct
} net_driver_t; } net_driver_t;
extern net_driver_t net_drivers[]; 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 */ /* Loop driver must always be registered the first */
#define IS_LOOP_DRIVER(p) ((p) == 0) #define IS_LOOP_DRIVER(p) ((p) == 0)
extern int net_driverlevel; extern int32_t net_driverlevel;
extern int messagesSent; extern int32_t messagesSent;
extern int messagesReceived; extern int32_t messagesReceived;
extern int unreliableMessagesSent; extern int32_t unreliableMessagesSent;
extern int unreliableMessagesReceived; extern int32_t unreliableMessagesReceived;
qsocket_t *NET_NewQSocket (void); qsocket_t *NET_NewQSocket (void);
void NET_FreeQSocket(qsocket_t *); void NET_FreeQSocket(qsocket_t *);
@ -235,14 +235,14 @@ typedef struct
char name[16]; char name[16];
char map[16]; char map[16];
char cname[32]; char cname[32];
int users; int32_t users;
int maxusers; int32_t maxusers;
int driver; int32_t driver;
int ldriver; int32_t ldriver;
struct qsockaddr addr; struct qsockaddr addr;
} hostcache_t; } hostcache_t;
extern int hostCacheCount; extern int32_t hostCacheCount;
extern hostcache_t hostcache[HOSTCACHESIZE]; extern hostcache_t hostcache[HOSTCACHESIZE];

View File

@ -33,15 +33,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define sfunc net_landrivers[sock->landriver] #define sfunc net_landrivers[sock->landriver]
#define dfunc net_landrivers[net_landriverlevel] #define dfunc net_landrivers[net_landriverlevel]
static int net_landriverlevel; static int32_t net_landriverlevel;
/* statistic counters */ /* statistic counters */
static int packetsSent = 0; static int32_t packetsSent = 0;
static int packetsReSent = 0; static int32_t packetsReSent = 0;
static int packetsReceived = 0; static int32_t packetsReceived = 0;
static int receivedDuplicateCount = 0; static int32_t receivedDuplicateCount = 0;
static int shortPacketCount = 0; static int32_t shortPacketCount = 0;
static int droppedDatagrams; static int32_t droppedDatagrams;
static struct static struct
{ {
@ -50,7 +50,7 @@ static struct
byte data[MAX_DATAGRAM]; byte data[MAX_DATAGRAM];
} packetBuffer; } packetBuffer;
static int myDriverLevel; static int32_t myDriverLevel;
extern bool m_return_onerror; extern bool m_return_onerror;
extern char m_return_reason[32]; extern char m_return_reason[32];
@ -60,7 +60,7 @@ static char *StrAddr (struct qsockaddr *addr)
{ {
static char buf[34]; static char buf[34];
byte *p = (byte *)addr; byte *p = (byte *)addr;
int n; int32_t n;
for (n = 0; n < 16; n++) for (n = 0; n < 16; n++)
sprintf (buf + n * 2, "%02x", *p++); sprintf (buf + n * 2, "%02x", *p++);
@ -129,7 +129,7 @@ static void NET_Ban_f (void)
#endif // BAN_TEST #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 packetLen;
uint32_t dataLen; 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 packetLen;
uint32_t dataLen; 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 packetLen;
uint32_t dataLen; 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 #ifdef DEBUG
if (data->cursize == 0) 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 length;
uint32_t flags; uint32_t flags;
int ret = 0; int32_t ret = 0;
struct qsockaddr readaddr; struct qsockaddr readaddr;
uint32_t sequence; uint32_t sequence;
uint32_t count; uint32_t count;
@ -497,7 +497,7 @@ static const char *Strip_Port (const char *host)
static char noport[MAX_QPATH]; static char noport[MAX_QPATH];
/* array size as in Host_Connect_f() */ /* array size as in Host_Connect_f() */
char *p; char *p;
int port; int32_t port;
if (!host || !*host) if (!host || !*host)
return host; return host;
@ -516,8 +516,8 @@ static const char *Strip_Port (const char *host)
static bool testInProgress = false; static bool testInProgress = false;
static int testPollCount; static int32_t testPollCount;
static int testDriver; static int32_t testDriver;
static sys_socket_t testSocket; static sys_socket_t testSocket;
static void Test_Poll (void *); static void Test_Poll (void *);
@ -526,13 +526,13 @@ static PollProcedure testPollProcedure = {NULL, 0.0, Test_Poll};
static void Test_Poll (void *unused) static void Test_Poll (void *unused)
{ {
struct qsockaddr clientaddr; struct qsockaddr clientaddr;
int control; int32_t control;
int len; int32_t len;
char name[32]; char name[32];
char address[64]; char address[64];
int colors; int32_t colors;
int frags; int32_t frags;
int connectTime; int32_t connectTime;
(void)unused; (void)unused;
@ -541,17 +541,17 @@ static void Test_Poll (void *unused)
while (1) while (1)
{ {
len = dfunc.Read (testSocket, net_message.data, net_message.maxsize, &clientaddr); len = dfunc.Read (testSocket, net_message.data, net_message.maxsize, &clientaddr);
if (len < (int) sizeof(int)) if (len < (int32_t) sizeof(int32_t))
break; break;
net_message.cursize = len; net_message.cursize = len;
MSG_BeginReading (); MSG_BeginReading ();
control = BigLong(*((int *)net_message.data)); control = BigLong(*((int32_t *)net_message.data));
MSG_ReadLong(); MSG_ReadLong();
if (control == -1) if (control == -1)
break; break;
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
break; break;
if ((control & NETFLAG_LENGTH_MASK) != len) if ((control & NETFLAG_LENGTH_MASK) != len)
break; break;
@ -584,8 +584,8 @@ static void Test_Poll (void *unused)
static void Test_f (void) static void Test_f (void)
{ {
const char *host; const char *host;
int n; int32_t n;
int maxusers = MAX_SCOREBOARD; int32_t maxusers = MAX_SCOREBOARD;
struct qsockaddr sendaddr; struct qsockaddr sendaddr;
if (testInProgress) if (testInProgress)
@ -643,7 +643,7 @@ JustDoIt:
MSG_WriteLong(&net_message, 0); MSG_WriteLong(&net_message, 0);
MSG_WriteByte(&net_message, CCREQ_PLAYER_INFO); MSG_WriteByte(&net_message, CCREQ_PLAYER_INFO);
MSG_WriteByte(&net_message, n); 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); dfunc.Write (testSocket, net_message.data, net_message.cursize, &sendaddr);
} }
SZ_Clear(&net_message); SZ_Clear(&net_message);
@ -652,7 +652,7 @@ JustDoIt:
static bool test2InProgress = false; static bool test2InProgress = false;
static int test2Driver; static int32_t test2Driver;
static sys_socket_t test2Socket; static sys_socket_t test2Socket;
static void Test2_Poll (void *); static void Test2_Poll (void *);
@ -661,8 +661,8 @@ static PollProcedure test2PollProcedure = {NULL, 0.0, Test2_Poll};
static void Test2_Poll (void *unused) static void Test2_Poll (void *unused)
{ {
struct qsockaddr clientaddr; struct qsockaddr clientaddr;
int control; int32_t control;
int len; int32_t len;
char name[256]; char name[256];
char value[256]; char value[256];
@ -672,17 +672,17 @@ static void Test2_Poll (void *unused)
name[0] = 0; name[0] = 0;
len = dfunc.Read (test2Socket, net_message.data, net_message.maxsize, &clientaddr); 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; goto Reschedule;
net_message.cursize = len; net_message.cursize = len;
MSG_BeginReading (); MSG_BeginReading ();
control = BigLong(*((int *)net_message.data)); control = BigLong(*((int32_t *)net_message.data));
MSG_ReadLong(); MSG_ReadLong();
if (control == -1) if (control == -1)
goto Error; goto Error;
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
goto Error; goto Error;
if ((control & NETFLAG_LENGTH_MASK) != len) if ((control & NETFLAG_LENGTH_MASK) != len)
goto Error; goto Error;
@ -702,7 +702,7 @@ static void Test2_Poll (void *unused)
MSG_WriteLong(&net_message, 0); MSG_WriteLong(&net_message, 0);
MSG_WriteByte(&net_message, CCREQ_RULE_INFO); MSG_WriteByte(&net_message, CCREQ_RULE_INFO);
MSG_WriteString(&net_message, name); 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); dfunc.Write (test2Socket, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
@ -721,7 +721,7 @@ Done:
static void Test2_f (void) static void Test2_f (void)
{ {
const char *host; const char *host;
int n; int32_t n;
struct qsockaddr sendaddr; struct qsockaddr sendaddr;
if (test2InProgress) if (test2InProgress)
@ -776,16 +776,16 @@ JustDoIt:
MSG_WriteLong(&net_message, 0); MSG_WriteLong(&net_message, 0);
MSG_WriteByte(&net_message, CCREQ_RULE_INFO); MSG_WriteByte(&net_message, CCREQ_RULE_INFO);
MSG_WriteString(&net_message, ""); 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); dfunc.Write (test2Socket, net_message.data, net_message.cursize, &sendaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
SchedulePollProcedure(&test2PollProcedure, 0.05); 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; sys_socket_t csock;
#ifdef BAN_TEST #ifdef BAN_TEST
@ -825,7 +825,7 @@ int Datagram_Init (void)
void Datagram_Shutdown (void) void Datagram_Shutdown (void)
{ {
int i; int32_t i;
// //
// shutdown the lan drivers // shutdown the lan drivers
@ -849,7 +849,7 @@ void Datagram_Close (qsocket_t *sock)
void Datagram_Listen (bool state) void Datagram_Listen (bool state)
{ {
int i; int32_t i;
for (i = 0; i < net_numlandrivers; i++) for (i = 0; i < net_numlandrivers; i++)
{ {
@ -867,10 +867,10 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
sys_socket_t acceptsock; sys_socket_t acceptsock;
qsocket_t *sock; qsocket_t *sock;
qsocket_t *s; qsocket_t *s;
int len; int32_t len;
int command; int32_t command;
int control; int32_t control;
int ret; int32_t ret;
acceptsock = dfunc.CheckNewConnections(); acceptsock = dfunc.CheckNewConnections();
if (acceptsock == INVALID_SOCKET) if (acceptsock == INVALID_SOCKET)
@ -879,16 +879,16 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
SZ_Clear(&net_message); SZ_Clear(&net_message);
len = dfunc.Read (acceptsock, net_message.data, net_message.maxsize, &clientaddr); 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; return NULL;
net_message.cursize = len; net_message.cursize = len;
MSG_BeginReading (); MSG_BeginReading ();
control = BigLong(*((int *)net_message.data)); control = BigLong(*((int32_t *)net_message.data));
MSG_ReadLong(); MSG_ReadLong();
if (control == -1) if (control == -1)
return NULL; return NULL;
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
return NULL; return NULL;
if ((control & NETFLAG_LENGTH_MASK) != len) if ((control & NETFLAG_LENGTH_MASK) != len)
return NULL; return NULL;
@ -910,7 +910,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
MSG_WriteByte(&net_message, net_activeconnections); MSG_WriteByte(&net_message, net_activeconnections);
MSG_WriteByte(&net_message, svs.maxclients); MSG_WriteByte(&net_message, svs.maxclients);
MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION); 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); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
return NULL; return NULL;
@ -918,9 +918,9 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
if (command == CCREQ_PLAYER_INFO) if (command == CCREQ_PLAYER_INFO)
{ {
int playerNumber; int32_t playerNumber;
int activeNumber; int32_t activeNumber;
int clientNumber; int32_t clientNumber;
client_t *client; client_t *client;
playerNumber = MSG_ReadByte(); playerNumber = MSG_ReadByte();
@ -946,10 +946,10 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
MSG_WriteByte(&net_message, playerNumber); MSG_WriteByte(&net_message, playerNumber);
MSG_WriteString(&net_message, client->name); MSG_WriteString(&net_message, client->name);
MSG_WriteLong(&net_message, client->colors); MSG_WriteLong(&net_message, client->colors);
MSG_WriteLong(&net_message, (int)client->edict->v.frags); MSG_WriteLong(&net_message, (int32_t)client->edict->v.frags);
MSG_WriteLong(&net_message, (int)(net_time - client->netconnection->connecttime)); MSG_WriteLong(&net_message, (int32_t)(net_time - client->netconnection->connecttime));
MSG_WriteString(&net_message, client->netconnection->address); 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); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message); 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->name);
MSG_WriteString(&net_message, var->string); 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); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
@ -995,7 +995,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
MSG_WriteLong(&net_message, 0); MSG_WriteLong(&net_message, 0);
MSG_WriteByte(&net_message, CCREP_REJECT); MSG_WriteByte(&net_message, CCREP_REJECT);
MSG_WriteString(&net_message, "Incompatible version.\n"); 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); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
return NULL; return NULL;
@ -1014,7 +1014,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
MSG_WriteLong(&net_message, 0); MSG_WriteLong(&net_message, 0);
MSG_WriteByte(&net_message, CCREP_REJECT); MSG_WriteByte(&net_message, CCREP_REJECT);
MSG_WriteString(&net_message, "You have been banned.\n"); 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); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
return NULL; return NULL;
@ -1040,7 +1040,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
MSG_WriteByte(&net_message, CCREP_ACCEPT); MSG_WriteByte(&net_message, CCREP_ACCEPT);
dfunc.GetSocketAddr(s->socket, &newaddr); dfunc.GetSocketAddr(s->socket, &newaddr);
MSG_WriteLong(&net_message, dfunc.GetSocketPort(&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); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
return NULL; return NULL;
@ -1062,7 +1062,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
MSG_WriteLong(&net_message, 0); MSG_WriteLong(&net_message, 0);
MSG_WriteByte(&net_message, CCREP_REJECT); MSG_WriteByte(&net_message, CCREP_REJECT);
MSG_WriteString(&net_message, "Server is full.\n"); 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); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
return NULL; return NULL;
@ -1098,7 +1098,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
dfunc.GetSocketAddr(newsock, &newaddr); dfunc.GetSocketAddr(newsock, &newaddr);
MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr)); MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr));
// MSG_WriteString(&net_message, dfunc.AddrToString(&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); dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
@ -1123,12 +1123,12 @@ qsocket_t *Datagram_CheckNewConnections (void)
static void _Datagram_SearchForHosts (bool xmit) static void _Datagram_SearchForHosts (bool xmit)
{ {
int ret; int32_t ret;
int n; int32_t n;
int i; int32_t i;
struct qsockaddr readaddr; struct qsockaddr readaddr;
struct qsockaddr myaddr; struct qsockaddr myaddr;
int control; int32_t control;
dfunc.GetSocketAddr (dfunc.controlSock, &myaddr); dfunc.GetSocketAddr (dfunc.controlSock, &myaddr);
if (xmit) if (xmit)
@ -1139,14 +1139,14 @@ static void _Datagram_SearchForHosts (bool xmit)
MSG_WriteByte(&net_message, CCREQ_SERVER_INFO); MSG_WriteByte(&net_message, CCREQ_SERVER_INFO);
MSG_WriteString(&net_message, "QUAKE"); MSG_WriteString(&net_message, "QUAKE");
MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION); 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); dfunc.Broadcast(dfunc.controlSock, net_message.data, net_message.cursize);
SZ_Clear(&net_message); SZ_Clear(&net_message);
} }
while ((ret = dfunc.Read (dfunc.controlSock, net_message.data, net_message.maxsize, &readaddr)) > 0) 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; continue;
net_message.cursize = ret; net_message.cursize = ret;
@ -1159,11 +1159,11 @@ static void _Datagram_SearchForHosts (bool xmit)
continue; continue;
MSG_BeginReading (); MSG_BeginReading ();
control = BigLong(*((int *)net_message.data)); control = BigLong(*((int32_t *)net_message.data));
MSG_ReadLong(); MSG_ReadLong();
if (control == -1) if (control == -1)
continue; continue;
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
continue; continue;
if ((control & NETFLAG_LENGTH_MASK) != ret) if ((control & NETFLAG_LENGTH_MASK) != ret)
continue; continue;
@ -1241,10 +1241,10 @@ static qsocket_t *_Datagram_Connect (const char *host)
struct qsockaddr readaddr; struct qsockaddr readaddr;
qsocket_t *sock; qsocket_t *sock;
sys_socket_t newsock; sys_socket_t newsock;
int ret; int32_t ret;
int reps; int32_t reps;
double start_time; double start_time;
int control; int32_t control;
const char *reason; const char *reason;
// see if we can resolve the host name // 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_WriteByte(&net_message, CCREQ_CONNECT);
MSG_WriteString(&net_message, "QUAKE"); MSG_WriteString(&net_message, "QUAKE");
MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION); 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); dfunc.Write (newsock, net_message.data, net_message.cursize, &sendaddr);
SZ_Clear(&net_message); SZ_Clear(&net_message);
do do
@ -1301,7 +1301,7 @@ static qsocket_t *_Datagram_Connect (const char *host)
continue; continue;
} }
if (ret < (int) sizeof(int)) if (ret < (int32_t) sizeof(int32_t))
{ {
ret = 0; ret = 0;
continue; continue;
@ -1310,14 +1310,14 @@ static qsocket_t *_Datagram_Connect (const char *host)
net_message.cursize = ret; net_message.cursize = ret;
MSG_BeginReading (); MSG_BeginReading ();
control = BigLong(*((int *)net_message.data)); control = BigLong(*((int32_t *)net_message.data));
MSG_ReadLong(); MSG_ReadLong();
if (control == -1) if (control == -1)
{ {
ret = 0; ret = 0;
continue; continue;
} }
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL) if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
{ {
ret = 0; ret = 0;
continue; continue;

View File

@ -22,14 +22,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __NET_DATAGRAM_H #ifndef __NET_DATAGRAM_H
#define __NET_DATAGRAM_H #define __NET_DATAGRAM_H
int Datagram_Init (void); int32_t Datagram_Init (void);
void Datagram_Listen (bool state); void Datagram_Listen (bool state);
void Datagram_SearchForHosts (bool xmit); void Datagram_SearchForHosts (bool xmit);
qsocket_t *Datagram_Connect (const char *host); qsocket_t *Datagram_Connect (const char *host);
qsocket_t *Datagram_CheckNewConnections (void); qsocket_t *Datagram_CheckNewConnections (void);
int Datagram_GetMessage (qsocket_t *sock); int32_t Datagram_GetMessage (qsocket_t *sock);
int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data); int32_t Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data);
int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data); int32_t Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);
bool Datagram_CanSendMessage (qsocket_t *sock); bool Datagram_CanSendMessage (qsocket_t *sock);
bool Datagram_CanSendUnreliableMessage (qsocket_t *sock); bool Datagram_CanSendUnreliableMessage (qsocket_t *sock);
void Datagram_Close (qsocket_t *sock); void Datagram_Close (qsocket_t *sock);

View File

@ -30,7 +30,7 @@ static bool localconnectpending = false;
static qsocket_t *loop_client = NULL; static qsocket_t *loop_client = NULL;
static qsocket_t *loop_server = NULL; static qsocket_t *loop_server = NULL;
int Loop_Init (void) int32_t Loop_Init (void)
{ {
if (cls.state == ca_dedicated) if (cls.state == ca_dedicated)
return -1; 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; int32_t ret;
int length; int32_t length;
if (sock->receiveMessageLength == 0) if (sock->receiveMessageLength == 0)
return 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; byte *buffer;
int *bufferLength; int32_t *bufferLength;
if (!sock->driverdata) if (!sock->driverdata)
return -1; 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; byte *buffer;
int *bufferLength; int32_t *bufferLength;
if (!sock->driverdata) if (!sock->driverdata)
return -1; return -1;

View File

@ -23,14 +23,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __NET_LOOP_H #define __NET_LOOP_H
// net_loop.h // net_loop.h
int Loop_Init (void); int32_t Loop_Init (void);
void Loop_Listen (bool state); void Loop_Listen (bool state);
void Loop_SearchForHosts (bool xmit); void Loop_SearchForHosts (bool xmit);
qsocket_t *Loop_Connect (const char *host); qsocket_t *Loop_Connect (const char *host);
qsocket_t *Loop_CheckNewConnections (void); qsocket_t *Loop_CheckNewConnections (void);
int Loop_GetMessage (qsocket_t *sock); int32_t Loop_GetMessage (qsocket_t *sock);
int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data); int32_t 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);
bool Loop_CanSendMessage (qsocket_t *sock); bool Loop_CanSendMessage (qsocket_t *sock);
bool Loop_CanSendUnreliableMessage (qsocket_t *sock); bool Loop_CanSendUnreliableMessage (qsocket_t *sock);
void Loop_Close (qsocket_t *sock); void Loop_Close (qsocket_t *sock);

View File

@ -27,13 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
qsocket_t *net_activeSockets = NULL; qsocket_t *net_activeSockets = NULL;
qsocket_t *net_freeSockets = NULL; qsocket_t *net_freeSockets = NULL;
int net_numsockets = 0; int32_t net_numsockets = 0;
bool ipxAvailable = false; bool ipxAvailable = false;
bool tcpipAvailable = false; bool tcpipAvailable = false;
int net_hostport; int32_t net_hostport;
int DEFAULTnet_hostport = 26000; int32_t DEFAULTnet_hostport = 26000;
char my_ipx_address[NET_NAMELEN]; char my_ipx_address[NET_NAMELEN];
char my_tcpip_address[NET_NAMELEN]; char my_tcpip_address[NET_NAMELEN];
@ -44,7 +44,7 @@ bool slistInProgress = false;
bool slistSilent = false; bool slistSilent = false;
bool slistLocal = true; bool slistLocal = true;
static double slistStartTime; static double slistStartTime;
static int slistLastShown; static int32_t slistLastShown;
static void Slist_Send (void *); static void Slist_Send (void *);
static void Slist_Poll (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}; static PollProcedure slistPollProcedure = {NULL, 0.0, Slist_Poll};
sizebuf_t net_message; sizebuf_t net_message;
int net_activeconnections = 0; int32_t net_activeconnections = 0;
int messagesSent = 0; int32_t messagesSent = 0;
int messagesReceived = 0; int32_t messagesReceived = 0;
int unreliableMessagesSent = 0; int32_t unreliableMessagesSent = 0;
int unreliableMessagesReceived = 0; int32_t unreliableMessagesReceived = 0;
static cvar_t net_messagetimeout = {"net_messagetimeout","300",CVAR_NONE}; static cvar_t net_messagetimeout = {"net_messagetimeout","300",CVAR_NONE};
cvar_t hostname = {"hostname", "UNNAMED", 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 sfunc net_drivers[sock->driver]
#define dfunc net_drivers[net_driverlevel] #define dfunc net_drivers[net_driverlevel]
int net_driverlevel; int32_t net_driverlevel;
double net_time; double net_time;
@ -187,7 +187,7 @@ static void NET_Listen_f (void)
static void MaxPlayers_f (void) static void MaxPlayers_f (void)
{ {
int n; int32_t n;
if (Cmd_Argc () != 2) if (Cmd_Argc () != 2)
{ {
@ -226,7 +226,7 @@ static void MaxPlayers_f (void)
static void NET_Port_f (void) static void NET_Port_f (void)
{ {
int n; int32_t n;
if (Cmd_Argc () != 2) if (Cmd_Argc () != 2)
{ {
@ -263,7 +263,7 @@ static void PrintSlistHeader(void)
static void PrintSlist(void) static void PrintSlist(void)
{ {
int n; int32_t n;
for (n = slistLastShown; n < hostCacheCount; n++) for (n = slistLastShown; n < hostCacheCount; n++)
{ {
@ -310,7 +310,7 @@ void NET_SlistSort (void)
{ {
if (hostCacheCount > 1) if (hostCacheCount > 1)
{ {
int i, j; int32_t i, j;
hostcache_t temp; hostcache_t temp;
for (i = 0; i < hostCacheCount; i++) 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]; 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) if (idx < 0 || idx >= hostCacheCount)
return ""; return "";
@ -411,14 +411,14 @@ NET_Connect
=================== ===================
*/ */
int hostCacheCount = 0; int32_t hostCacheCount = 0;
hostcache_t hostcache[HOSTCACHESIZE]; hostcache_t hostcache[HOSTCACHESIZE];
qsocket_t *NET_Connect (const char *host) qsocket_t *NET_Connect (const char *host)
{ {
qsocket_t *ret; qsocket_t *ret;
int n; int32_t n;
int numdrivers = net_numdrivers; int32_t numdrivers = net_numdrivers;
SetNetTime(); SetNetTime();
@ -554,9 +554,9 @@ returns 1 if a message was received
returns -1 if connection is invalid 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) if (!sock)
return -1; return -1;
@ -608,9 +608,9 @@ returns 1 if the message was sent properly
returns -1 if the connection died 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) if (!sock)
return -1; 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) if (!sock)
return -1; 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; double start;
int i; int32_t i;
int count = 0; int32_t count = 0;
bool msg_init[MAX_SCOREBOARD]; /* did we write the message to the client's connection */ 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). */ bool msg_sent[MAX_SCOREBOARD]; /* did the msg arrive its destination (canSend state). */
@ -761,7 +761,7 @@ NET_Init
void NET_Init (void) void NET_Init (void)
{ {
int i; int32_t i;
qsocket_t *s; qsocket_t *s;
i = COM_CheckParm ("-port"); i = COM_CheckParm ("-port");

View File

@ -61,7 +61,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
typedef int sys_socket_t; typedef int32_t sys_socket_t;
#define INVALID_SOCKET (-1) #define INVALID_SOCKET (-1)
#define SOCKET_ERROR (-1) #define SOCKET_ERROR (-1)
@ -95,7 +95,7 @@ _Static_assert(offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET,
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
typedef int sys_socket_t; typedef int32_t sys_socket_t;
#define INVALID_SOCKET (-1) #define INVALID_SOCKET (-1)
#define SOCKET_ERROR (-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 */ /* on windows, socklen_t is to be a winsock2 thing */
#if !defined(IP_MSFILTER_SIZE) #if !defined(IP_MSFILTER_SIZE)
typedef int socklen_t; typedef int32_t socklen_t;
#endif /* socklen_t type */ #endif /* socklen_t type */
typedef SOCKET sys_socket_t; typedef SOCKET sys_socket_t;

View File

@ -32,7 +32,7 @@ static char *PR_GetTempString (void)
return pr_string_temp[(STRINGTEMP_BUFFERS-1) & ++pr_string_tempindex]; 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_BROADCAST 0 // unreliable to all
#define MSG_ONE 1 // reliable to one (msg_entity) #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]; static char out[1024];
size_t s; size_t s;
@ -68,7 +68,7 @@ static char *PF_VarString (int first)
{ {
if (!dev_overflows.varstring || dev_overflows.varstring + CONSOLE_RESPAM_TIME < realtime) 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; 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 xvector[2], yvector[2];
float a; float a;
vec3_t base, transformed; vec3_t base, transformed;
int i, j, k, l; int32_t i, j, k, l;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
if (minvec[i] > maxvec[i]) if (minvec[i] > maxvec[i])
@ -270,7 +270,7 @@ setmodel(entity, model)
*/ */
static void PF_setmodel (void) static void PF_setmodel (void)
{ {
int i; int32_t i;
const char *m, **check; const char *m, **check;
qmodel_t *mod; qmodel_t *mod;
edict_t *e; edict_t *e;
@ -292,7 +292,7 @@ static void PF_setmodel (void)
e->v.model = PR_SetEngineString(*check); e->v.model = PR_SetEngineString(*check);
e->v.modelindex = i; //SV_ModelIndex (m); 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) if (mod)
//johnfitz -- correct physics cullboxes for bmodels //johnfitz -- correct physics cullboxes for bmodels
@ -337,7 +337,7 @@ static void PF_sprint (void)
{ {
char *s; char *s;
client_t *client; client_t *client;
int entnum; int32_t entnum;
entnum = G_EDICTNUM(OFS_PARM0); entnum = G_EDICTNUM(OFS_PARM0);
s = PF_VarString(1); s = PF_VarString(1);
@ -368,7 +368,7 @@ static void PF_centerprint (void)
{ {
char *s; char *s;
client_t *client; client_t *client;
int entnum; int32_t entnum;
entnum = G_EDICTNUM(OFS_PARM0); entnum = G_EDICTNUM(OFS_PARM0);
s = PF_VarString(1); s = PF_VarString(1);
@ -455,7 +455,7 @@ static void PF_vectoyaw (void)
yaw = 0; yaw = 0;
else 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) if (yaw < 0)
yaw += 360; yaw += 360;
} }
@ -489,12 +489,12 @@ static void PF_vectoangles (void)
} }
else 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) if (yaw < 0)
yaw += 360; yaw += 360;
forward = sqrt (value1[0]*value1[0] + value1[1]*value1[1]); 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) if (pitch < 0)
pitch += 360; pitch += 360;
} }
@ -554,8 +554,8 @@ static void PF_ambientsound (void)
const char *samp, **check; const char *samp, **check;
float *pos; float *pos;
float vol, attenuation; float vol, attenuation;
int i, soundnum; int32_t i, soundnum;
int large = false; //johnfitz -- PROTOCOL_FITZQUAKE int32_t large = false; //johnfitz -- PROTOCOL_FITZQUAKE
pos = G_VECTOR (OFS_PARM0); pos = G_VECTOR (OFS_PARM0);
samp = G_STRING(OFS_PARM1); samp = G_STRING(OFS_PARM1);
@ -627,9 +627,9 @@ Larger attenuations will drop off.
static void PF_sound (void) static void PF_sound (void)
{ {
const char *sample; const char *sample;
int channel; int32_t channel;
edict_t *entity; edict_t *entity;
int volume; int32_t volume;
float attenuation; float attenuation;
entity = G_EDICT(OFS_PARM0); entity = G_EDICT(OFS_PARM0);
@ -660,7 +660,7 @@ break()
static void PF_break (void) static void PF_break (void)
{ {
Con_Printf ("break statement\n"); Con_Printf ("break statement\n");
*(int *)-4 = 0; // dump to debugger *(int32_t *)-4 = 0; // dump to debugger
// PR_RunError ("break statement"); // PR_RunError ("break statement");
} }
@ -679,7 +679,7 @@ static void PF_traceline (void)
{ {
float *v1, *v2; float *v1, *v2;
trace_t trace; trace_t trace;
int nomonsters; int32_t nomonsters;
edict_t *ent; edict_t *ent;
v1 = G_VECTOR(OFS_PARM0); v1 = G_VECTOR(OFS_PARM0);
@ -736,16 +736,16 @@ static void PF_checkpos (void)
//============================================================================ //============================================================================
static byte *checkpvs; //ericw -- changed to malloc 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; byte *pvs;
edict_t *ent; edict_t *ent;
mleaf_t *leaf; mleaf_t *leaf;
vec3_t org; vec3_t org;
int pvsbytes; int32_t pvsbytes;
// cycle to the next one // cycle to the next one
@ -773,7 +773,7 @@ static int PF_newcheckclient (int check)
continue; continue;
if (ent->v.health <= 0) if (ent->v.health <= 0)
continue; continue;
if ((int)ent->v.flags & FL_NOTARGET) if ((int32_t)ent->v.flags & FL_NOTARGET)
continue; continue;
// anything that is a client, or has a client as an enemy // anything that is a client, or has a client as an enemy
@ -814,12 +814,12 @@ name checkclient ()
================= =================
*/ */
#define MAX_CHECK 16 #define MAX_CHECK 16
static int c_invis, c_notvis; static int32_t c_invis, c_notvis;
static void PF_checkclient (void) static void PF_checkclient (void)
{ {
edict_t *ent, *self; edict_t *ent, *self;
mleaf_t *leaf; mleaf_t *leaf;
int l; int32_t l;
vec3_t view; vec3_t view;
// find a new check if on a new frame // find a new check if on a new frame
@ -868,7 +868,7 @@ stuffcmd (clientent, value)
*/ */
static void PF_stuffcmd (void) static void PF_stuffcmd (void)
{ {
int entnum; int32_t entnum;
const char *str; const char *str;
client_t *old; client_t *old;
@ -948,7 +948,7 @@ static void PF_findradius (void)
float rad; float rad;
float *org; float *org;
vec3_t eorg; vec3_t eorg;
int i, j; int32_t i, j;
chain = (edict_t *)sv.edicts; chain = (edict_t *)sv.edicts;
@ -991,8 +991,8 @@ static void PF_ftos (void)
v = G_FLOAT(OFS_PARM0); v = G_FLOAT(OFS_PARM0);
s = PR_GetTempString(); s = PR_GetTempString();
if (v == (int)v) if (v == (int32_t)v)
sprintf (s, "%d",(int)v); sprintf (s, "%d",(int32_t)v);
else else
sprintf (s, "%5.1f",v); sprintf (s, "%5.1f",v);
G_INT(OFS_RETURN) = PR_SetEngineString(s); 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; // entity (entity start, .string field, string match) find = #5;
static void PF_Find (void) static void PF_Find (void)
{ {
int e; int32_t e;
int f; int32_t f;
const char *s, *t; const char *s, *t;
edict_t *ed; edict_t *ed;
@ -1078,7 +1078,7 @@ static void PF_precache_file (void)
static void PF_precache_sound (void) static void PF_precache_sound (void)
{ {
const char *s; const char *s;
int i; int32_t i;
if (sv.state != ss_loading) if (sv.state != ss_loading)
PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions"); 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) static void PF_precache_model (void)
{ {
const char *s; const char *s;
int i; int32_t i;
if (sv.state != ss_loading) if (sv.state != ss_loading)
PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions"); PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions");
@ -1160,13 +1160,13 @@ static void PF_walkmove (void)
float yaw, dist; float yaw, dist;
vec3_t move; vec3_t move;
dfunction_t *oldf; dfunction_t *oldf;
int oldself; int32_t oldself;
ent = PROG_TO_EDICT(pr_global_struct->self); ent = PROG_TO_EDICT(pr_global_struct->self);
yaw = G_FLOAT(OFS_PARM0); yaw = G_FLOAT(OFS_PARM0);
dist = G_FLOAT(OFS_PARM1); 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; G_FLOAT(OFS_RETURN) = 0;
return; return;
@ -1216,7 +1216,7 @@ static void PF_droptofloor (void)
{ {
VectorCopy (trace.endpos, ent->v.origin); VectorCopy (trace.endpos, ent->v.origin);
SV_LinkEdict (ent, false); 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); ent->v.groundentity = EDICT_TO_PROG(trace.ent);
G_FLOAT(OFS_RETURN) = 1; G_FLOAT(OFS_RETURN) = 1;
} }
@ -1231,10 +1231,10 @@ void(float style, string value) lightstyle
*/ */
static void PF_lightstyle (void) static void PF_lightstyle (void)
{ {
int style; int32_t style;
const char *val; const char *val;
client_t *client; client_t *client;
int j; int32_t j;
style = G_FLOAT(OFS_PARM0); style = G_FLOAT(OFS_PARM0);
val = G_STRING(OFS_PARM1); val = G_STRING(OFS_PARM1);
@ -1269,9 +1269,9 @@ static void PF_rint (void)
float f; float f;
f = G_FLOAT(OFS_PARM0); f = G_FLOAT(OFS_PARM0);
if (f > 0) if (f > 0)
G_FLOAT(OFS_RETURN) = (int)(f + 0.5); G_FLOAT(OFS_RETURN) = (int32_t)(f + 0.5);
else else
G_FLOAT(OFS_RETURN) = (int)(f - 0.5); G_FLOAT(OFS_RETURN) = (int32_t)(f - 0.5);
} }
static void PF_floor (void) static void PF_floor (void)
@ -1322,7 +1322,7 @@ entity nextent(entity)
*/ */
static void PF_nextent (void) static void PF_nextent (void)
{ {
int i; int32_t i;
edict_t *ent; edict_t *ent;
i = G_EDICTNUM(OFS_PARM0); i = G_EDICTNUM(OFS_PARM0);
@ -1356,7 +1356,7 @@ static void PF_aim (void)
{ {
edict_t *ent, *check, *bestent; edict_t *ent, *check, *bestent;
vec3_t start, dir, end, bestdir; vec3_t start, dir, end, bestdir;
int i, j; int32_t i, j;
trace_t tr; trace_t tr;
float dist, bestdist; float dist, bestdist;
float speed; float speed;
@ -1477,8 +1477,8 @@ MESSAGE WRITING
static sizebuf_t *WriteDest (void) static sizebuf_t *WriteDest (void)
{ {
int entnum; int32_t entnum;
int dest; int32_t dest;
edict_t *ent; edict_t *ent;
dest = G_FLOAT(OFS_PARM0); dest = G_FLOAT(OFS_PARM0);
@ -1553,8 +1553,8 @@ static void PF_WriteEntity (void)
static void PF_makestatic (void) static void PF_makestatic (void)
{ {
edict_t *ent; edict_t *ent;
int i; int32_t i;
int bits = 0; //johnfitz -- PROTOCOL_FITZQUAKE int32_t bits = 0; //johnfitz -- PROTOCOL_FITZQUAKE
ent = G_EDICT(OFS_PARM0); ent = G_EDICT(OFS_PARM0);
@ -1568,7 +1568,7 @@ static void PF_makestatic (void)
//johnfitz -- PROTOCOL_FITZQUAKE //johnfitz -- PROTOCOL_FITZQUAKE
if (sv.protocol == PROTOCOL_NETQUAKE) 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); ED_Free (ent);
return; //can't display the correct model & frame, so don't show it at all 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) if (SV_ModelIndex(PR_GetString(ent->v.model)) & 0xFF00)
bits |= B_LARGEMODEL; bits |= B_LARGEMODEL;
if ((int)(ent->v.frame) & 0xFF00) if ((int32_t)(ent->v.frame) & 0xFF00)
bits |= B_LARGEFRAME; bits |= B_LARGEFRAME;
if (ent->alpha != ENTALPHA_DEFAULT) if (ent->alpha != ENTALPHA_DEFAULT)
bits |= B_ALPHA; bits |= B_ALPHA;
@ -1630,7 +1630,7 @@ PF_setspawnparms
static void PF_setspawnparms (void) static void PF_setspawnparms (void)
{ {
edict_t *ent; edict_t *ent;
int i; int32_t i;
client_t *client; client_t *client;
ent = G_EDICT(OFS_PARM0); ent = G_EDICT(OFS_PARM0);
@ -1761,5 +1761,5 @@ static builtin_t pr_builtin[] =
}; };
builtin_t *pr_builtins = 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]);

View File

@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// this file is shared by quake and qcc // this file is shared by quake and qcc
typedef int func_t; typedef int32_t func_t;
typedef int string_t; typedef int32_t string_t;
typedef enum typedef enum
{ {
@ -143,7 +143,7 @@ typedef struct
uint16_t type; // if DEF_SAVEGLOBAL bit is set uint16_t type; // if DEF_SAVEGLOBAL bit is set
// the variable needs to be saved in savegames // the variable needs to be saved in savegames
uint16_t ofs; uint16_t ofs;
int s_name; int32_t s_name;
} ddef_t; } ddef_t;
#define DEF_SAVEGLOBAL (1<<15) #define DEF_SAVEGLOBAL (1<<15)
@ -152,16 +152,16 @@ typedef struct
typedef struct typedef struct
{ {
int first_statement; // negative numbers are builtins int32_t first_statement; // negative numbers are builtins
int parm_start; int32_t parm_start;
int locals; // total ints of parms + locals int32_t locals; // total ints of parms + locals
int profile; // runtime int32_t profile; // runtime
int s_name; int32_t s_name;
int s_file; // source file defined in int32_t s_file; // source file defined in
int numparms; int32_t numparms;
byte parm_size[MAX_PARMS]; byte parm_size[MAX_PARMS];
} dfunction_t; } dfunction_t;
@ -169,28 +169,28 @@ typedef struct
#define PROG_VERSION 6 #define PROG_VERSION 6
typedef struct typedef struct
{ {
int version; int32_t version;
int crc; // check of header file int32_t crc; // check of header file
int ofs_statements; int32_t ofs_statements;
int numstatements; // statement 0 is an error int32_t numstatements; // statement 0 is an error
int ofs_globaldefs; int32_t ofs_globaldefs;
int numglobaldefs; int32_t numglobaldefs;
int ofs_fielddefs; int32_t ofs_fielddefs;
int numfielddefs; int32_t numfielddefs;
int ofs_functions; int32_t ofs_functions;
int numfunctions; // function 0 is an empty int32_t numfunctions; // function 0 is an empty
int ofs_strings; int32_t ofs_strings;
int numstrings; // first string is a null string int32_t numstrings; // first string is a null string
int ofs_globals; int32_t ofs_globals;
int numglobals; int32_t numglobals;
int entityfields; int32_t entityfields;
} dprograms_t; } dprograms_t;
#endif /* __PR_COMP_H */ #endif /* __PR_COMP_H */

View File

@ -27,10 +27,10 @@ dprograms_t *progs;
dfunction_t *pr_functions; dfunction_t *pr_functions;
static char *pr_strings; static char *pr_strings;
static int pr_stringssize; static int32_t pr_stringssize;
static const char **pr_knownstrings; static const char **pr_knownstrings;
static int pr_maxknownstrings; static int32_t pr_maxknownstrings;
static int pr_numknownstrings; static int32_t pr_numknownstrings;
static ddef_t *pr_fielddefs; static ddef_t *pr_fielddefs;
static ddef_t *pr_globaldefs; static ddef_t *pr_globaldefs;
@ -39,11 +39,11 @@ bool pr_alpha_supported; //johnfitz
dstatement_t *pr_statements; dstatement_t *pr_statements;
globalvars_t *pr_global_struct; globalvars_t *pr_global_struct;
float *pr_globals; // same as 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; uint16_t pr_crc;
int type_size[8] = { int32_t type_size[8] = {
1, // ev_void 1, // ev_void
1, // sizeof(string_t) / 4 // ev_string 1, // sizeof(string_t) / 4 // ev_string
1, // ev_float 1, // ev_float
@ -54,7 +54,7 @@ int type_size[8] = {
1 // sizeof(void *) / 4 // ev_pointer 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); static bool ED_ParseEpair (void *base, ddef_t *key, const char *s);
#define MAX_FIELD_LEN 64 #define MAX_FIELD_LEN 64
@ -109,7 +109,7 @@ angles and bad trails.
*/ */
edict_t *ED_Alloc (void) edict_t *ED_Alloc (void)
{ {
int i; int32_t i;
edict_t *e; edict_t *e;
for (i = svs.maxclients + 1; i < sv.num_edicts; i++) for (i = svs.maxclients + 1; i < sv.num_edicts; i++)
@ -169,10 +169,10 @@ void ED_Free (edict_t *ed)
ED_GlobalAtOfs ED_GlobalAtOfs
============ ============
*/ */
static ddef_t *ED_GlobalAtOfs (int ofs) static ddef_t *ED_GlobalAtOfs (int32_t ofs)
{ {
ddef_t *def; ddef_t *def;
int i; int32_t i;
for (i = 0; i < progs->numglobaldefs; i++) for (i = 0; i < progs->numglobaldefs; i++)
{ {
@ -188,10 +188,10 @@ static ddef_t *ED_GlobalAtOfs (int ofs)
ED_FieldAtOfs ED_FieldAtOfs
============ ============
*/ */
static ddef_t *ED_FieldAtOfs (int ofs) static ddef_t *ED_FieldAtOfs (int32_t ofs)
{ {
ddef_t *def; ddef_t *def;
int i; int32_t i;
for (i = 0; i < progs->numfielddefs; i++) for (i = 0; i < progs->numfielddefs; i++)
{ {
@ -210,7 +210,7 @@ ED_FindField
static ddef_t *ED_FindField (const char *name) static ddef_t *ED_FindField (const char *name)
{ {
ddef_t *def; ddef_t *def;
int i; int32_t i;
for (i = 0; i < progs->numfielddefs; i++) for (i = 0; i < progs->numfielddefs; i++)
{ {
@ -230,7 +230,7 @@ ED_FindGlobal
static ddef_t *ED_FindGlobal (const char *name) static ddef_t *ED_FindGlobal (const char *name)
{ {
ddef_t *def; ddef_t *def;
int i; int32_t i;
for (i = 0; i < progs->numglobaldefs; i++) for (i = 0; i < progs->numglobaldefs; i++)
{ {
@ -250,7 +250,7 @@ ED_FindFunction
static dfunction_t *ED_FindFunction (const char *fn_name) static dfunction_t *ED_FindFunction (const char *fn_name)
{ {
dfunction_t *func; dfunction_t *func;
int i; int32_t i;
for (i = 0; i < progs->numfunctions; i++) for (i = 0; i < progs->numfunctions; i++)
{ {
@ -269,8 +269,8 @@ GetEdictFieldValue
eval_t *GetEdictFieldValue(edict_t *ed, const char *field) eval_t *GetEdictFieldValue(edict_t *ed, const char *field)
{ {
ddef_t *def = NULL; ddef_t *def = NULL;
int i; int32_t i;
static int rep = 0; static int32_t rep = 0;
for (i = 0; i < GEFV_CACHESIZE; i++) for (i = 0; i < GEFV_CACHESIZE; i++)
{ {
@ -306,7 +306,7 @@ PR_ValueString
Returns a string describing *data in a type specific manner 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]; static char line[512];
ddef_t *def; ddef_t *def;
@ -359,7 +359,7 @@ Returns a string describing *data in a type specific manner
Easier to parse than PR_ValueString 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]; static char line[512];
ddef_t *def; ddef_t *def;
@ -408,11 +408,11 @@ Returns a string with a description and the contents of a global,
padded to 20 field width padded to 20 field width
============ ============
*/ */
const char *PR_GlobalString (int ofs) const char *PR_GlobalString (int32_t ofs)
{ {
static char line[512]; static char line[512];
const char *s; const char *s;
int i; int32_t i;
ddef_t *def; ddef_t *def;
void *val; void *val;
@ -434,10 +434,10 @@ const char *PR_GlobalString (int ofs)
return line; return line;
} }
const char *PR_GlobalStringNoContents (int ofs) const char *PR_GlobalStringNoContents (int32_t ofs)
{ {
static char line[512]; static char line[512];
int i; int32_t i;
ddef_t *def; ddef_t *def;
def = ED_GlobalAtOfs(ofs); def = ED_GlobalAtOfs(ofs);
@ -465,10 +465,10 @@ For debugging
void ED_Print (edict_t *ed) void ED_Print (edict_t *ed)
{ {
ddef_t *d; ddef_t *d;
int *v; int32_t *v;
int i, j, l; int32_t i, j, l;
const char *name; const char *name;
int type; int32_t type;
if (ed->free) if (ed->free)
{ {
@ -485,7 +485,7 @@ void ED_Print (edict_t *ed)
if (l > 1 && name[l - 2] == '_') if (l > 1 && name[l - 2] == '_')
continue; // skip _x, _y, _z vars 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 // if the value is still all 0, skip the field
type = d->type & ~DEF_SAVEGLOBAL; type = d->type & ~DEF_SAVEGLOBAL;
@ -516,10 +516,10 @@ For savegames
void ED_Write (FILE *f, edict_t *ed) void ED_Write (FILE *f, edict_t *ed)
{ {
ddef_t *d; ddef_t *d;
int *v; int32_t *v;
int i, j; int32_t i, j;
const char *name; const char *name;
int type; int32_t type;
fprintf (f, "{\n"); fprintf (f, "{\n");
@ -537,7 +537,7 @@ void ED_Write (FILE *f, edict_t *ed)
if (j > 1 && name[j - 2] == '_') if (j > 1 && name[j - 2] == '_')
continue; // skip _x, _y, _z vars 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 // if the value is still all 0, skip the field
type = d->type & ~DEF_SAVEGLOBAL; type = d->type & ~DEF_SAVEGLOBAL;
@ -561,7 +561,7 @@ void ED_Write (FILE *f, edict_t *ed)
fprintf (f, "}\n"); fprintf (f, "}\n");
} }
void ED_PrintNum (int ent) void ED_PrintNum (int32_t ent)
{ {
ED_Print (EDICT_NUM(ent)); ED_Print (EDICT_NUM(ent));
} }
@ -575,7 +575,7 @@ For debugging, prints all the entities in the current server
*/ */
void ED_PrintEdicts (void) void ED_PrintEdicts (void)
{ {
int i; int32_t i;
if (!sv.active) if (!sv.active)
return; return;
@ -594,7 +594,7 @@ For debugging, prints a single edicy
*/ */
static void ED_PrintEdict_f (void) static void ED_PrintEdict_f (void)
{ {
int i; int32_t i;
if (!sv.active) if (!sv.active)
return; return;
@ -618,7 +618,7 @@ For debugging
static void ED_Count (void) static void ED_Count (void)
{ {
edict_t *ent; edict_t *ent;
int i, active, models, solid, step; int32_t i, active, models, solid, step;
if (!sv.active) if (!sv.active)
return; return;
@ -663,9 +663,9 @@ ED_WriteGlobals
void ED_WriteGlobals (FILE *f) void ED_WriteGlobals (FILE *f)
{ {
ddef_t *def; ddef_t *def;
int i; int32_t i;
const char *name; const char *name;
int type; int32_t type;
fprintf (f, "{\n"); fprintf (f, "{\n");
for (i = 0; i < progs->numglobaldefs; i++) for (i = 0; i < progs->numglobaldefs; i++)
@ -739,7 +739,7 @@ ED_NewString
static string_t ED_NewString (const char *string) static string_t ED_NewString (const char *string)
{ {
char *new_p; char *new_p;
int i, l; int32_t i, l;
string_t num; string_t num;
l = strlen(string) + 1; l = strlen(string) + 1;
@ -773,7 +773,7 @@ returns false if error
*/ */
static bool ED_ParseEpair (void *base, ddef_t *key, const char *s) static bool ED_ParseEpair (void *base, ddef_t *key, const char *s)
{ {
int i; int32_t i;
char string[128]; char string[128];
ddef_t *def; ddef_t *def;
char *v, *w; char *v, *w;
@ -781,7 +781,7 @@ static bool ED_ParseEpair (void *base, ddef_t *key, const char *s)
void *d; void *d;
dfunction_t *func; dfunction_t *func;
d = (void *)((int *)base + key->ofs); d = (void *)((int32_t *)base + key->ofs);
switch (key->type & ~DEF_SAVEGLOBAL) switch (key->type & ~DEF_SAVEGLOBAL)
{ {
@ -819,7 +819,7 @@ static bool ED_ParseEpair (void *base, ddef_t *key, const char *s)
break; break;
case ev_entity: case ev_entity:
*(int *)d = EDICT_TO_PROG(EDICT_NUM(atoi (s))); *(int32_t *)d = EDICT_TO_PROG(EDICT_NUM(atoi (s)));
break; break;
case ev_field: 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); Con_DPrintf ("Can't find field %s\n", s);
return false; return false;
} }
*(int *)d = G_INT(def->ofs); *(int32_t *)d = G_INT(def->ofs);
break; break;
case ev_function: case ev_function:
@ -864,7 +864,7 @@ const char *ED_ParseEdict (const char *data, edict_t *ent)
ddef_t *key; ddef_t *key;
char keyname[256]; char keyname[256];
bool anglehack, init; bool anglehack, init;
int n; int32_t n;
init = false; init = false;
@ -972,7 +972,7 @@ void ED_LoadFromFile (const char *data)
{ {
dfunction_t *func; dfunction_t *func;
edict_t *ent = NULL; edict_t *ent = NULL;
int inhibit = 0; int32_t inhibit = 0;
pr_global_struct->time = sv.time; pr_global_struct->time = sv.time;
@ -995,16 +995,16 @@ void ED_LoadFromFile (const char *data)
// remove things from different skill levels or deathmatch // remove things from different skill levels or deathmatch
if (deathmatch.value) if (deathmatch.value)
{ {
if (((int)ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH)) if (((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH))
{ {
ED_Free (ent); ED_Free (ent);
inhibit++; inhibit++;
continue; continue;
} }
} }
else if ((current_skill == 0 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_EASY)) else if ((current_skill == 0 && ((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_EASY))
|| (current_skill == 1 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_MEDIUM)) || (current_skill == 1 && ((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_MEDIUM))
|| (current_skill >= 2 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_HARD)) ) || (current_skill >= 2 && ((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_HARD)) )
{ {
ED_Free (ent); ED_Free (ent);
inhibit++; inhibit++;
@ -1048,7 +1048,7 @@ PR_LoadProgs
*/ */
void PR_LoadProgs (void) void PR_LoadProgs (void)
{ {
int i; int32_t i;
// flush the non-C variable lookup cache // flush the non-C variable lookup cache
for (i = 0; i < GEFV_CACHESIZE; i++) for (i = 0; i < GEFV_CACHESIZE; i++)
@ -1065,8 +1065,8 @@ void PR_LoadProgs (void)
CRC_ProcessByte (&pr_crc, ((byte *)progs)[i]); CRC_ProcessByte (&pr_crc, ((byte *)progs)[i]);
// byte swap the header // byte swap the header
for (i = 0; i < (int) sizeof(*progs) / 4; i++) for (i = 0; i < (int32_t) sizeof(*progs) / 4; i++)
((int *)progs)[i] = LittleLong ( ((int *)progs)[i] ); ((int32_t *)progs)[i] = LittleLong ( ((int32_t *)progs)[i] );
if (progs->version != PROG_VERSION) if (progs->version != PROG_VERSION)
Host_Error ("progs.dat has wrong version number (%i should be %i)", 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++) 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); pr_edict_size = progs->entityfields * 4 + sizeof(edict_t) - sizeof(entvars_t);
// round off to next highest whole word address (esp for Alpha) // 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) if (n < 0 || n >= sv.max_edicts)
Host_Error ("EDICT_NUM: bad number %i", n); Host_Error ("EDICT_NUM: bad number %i", n);
return (edict_t *)((byte *)sv.edicts + (n)*pr_edict_size); 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 = (byte *)e - (byte *)sv.edicts;
b = b / pr_edict_size; 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 *)); 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) if (num >= 0 && num < pr_stringssize)
return pr_strings + num; 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) if (!s)
return 0; return 0;
@ -1235,7 +1235,7 @@ int PR_SetEngineString (const char *s)
Host_Error("PR_SetEngineString: \"%s\" in pr_strings area\n", s); Host_Error("PR_SetEngineString: \"%s\" in pr_strings area\n", s);
#else #else
if (s >= pr_strings && s <= pr_strings + pr_stringssize - 2) if (s >= pr_strings && s <= pr_strings + pr_stringssize - 2)
return (int)(s - pr_strings); return (int32_t)(s - pr_strings);
#endif #endif
for (i = 0; i < pr_numknownstrings; i++) for (i = 0; i < pr_numknownstrings; i++)
{ {
@ -1261,9 +1261,9 @@ int PR_SetEngineString (const char *s)
return -1 - i; 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) if (!size)
return 0; return 0;

View File

@ -23,22 +23,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef struct typedef struct
{ {
int s; int32_t s;
dfunction_t *f; dfunction_t *f;
} prstack_t; } prstack_t;
#define MAX_STACK_DEPTH 64 /* was 32 */ #define MAX_STACK_DEPTH 64 /* was 32 */
static prstack_t pr_stack[MAX_STACK_DEPTH]; static prstack_t pr_stack[MAX_STACK_DEPTH];
static int pr_depth; static int32_t pr_depth;
#define LOCALSTACK_SIZE 2048 #define LOCALSTACK_SIZE 2048
static int localstack[LOCALSTACK_SIZE]; static int32_t localstack[LOCALSTACK_SIZE];
static int localstack_used; static int32_t localstack_used;
bool pr_trace; bool pr_trace;
dfunction_t *pr_xfunction; dfunction_t *pr_xfunction;
int pr_xstatement; int32_t pr_xstatement;
int pr_argc; int32_t pr_argc;
static const char *pr_opnames[] = static const char *pr_opnames[] =
{ {
@ -129,8 +129,8 @@ static const char *pr_opnames[] =
"BITOR" "BITOR"
}; };
const char *PR_GlobalString (int ofs); const char *PR_GlobalString (int32_t ofs);
const char *PR_GlobalStringNoContents (int ofs); const char *PR_GlobalStringNoContents (int32_t ofs);
//============================================================================= //=============================================================================
@ -142,7 +142,7 @@ PR_PrintStatement
*/ */
static void PR_PrintStatement (dstatement_t *s) static void PR_PrintStatement (dstatement_t *s)
{ {
int i; int32_t i;
if ((uint32_t)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0])) if ((uint32_t)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0]))
{ {
@ -182,7 +182,7 @@ PR_StackTrace
*/ */
static void PR_StackTrace (void) static void PR_StackTrace (void)
{ {
int i; int32_t i;
dfunction_t *f; dfunction_t *f;
if (pr_depth == 0) if (pr_depth == 0)
@ -215,8 +215,8 @@ PR_Profile_f
*/ */
void PR_Profile_f (void) void PR_Profile_f (void)
{ {
int i, num; int32_t i, num;
int pmax; int32_t pmax;
dfunction_t *f, *best; dfunction_t *f, *best;
if (!sv.active) if (!sv.active)
@ -280,9 +280,9 @@ PR_EnterFunction
Returns the new program statement counter 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].s = pr_xstatement;
pr_stack[pr_depth].f = pr_xfunction; 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"); PR_RunError("PR_ExecuteProgram: locals stack overflow\n");
for (i = 0; i < c ; i++) 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; localstack_used += c;
// copy parameters // copy parameters
@ -305,7 +305,7 @@ static int PR_EnterFunction (dfunction_t *f)
{ {
for (j = 0; j < f->parm_size[i]; j++) 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++; o++;
} }
} }
@ -319,9 +319,9 @@ static int PR_EnterFunction (dfunction_t *f)
PR_LeaveFunction PR_LeaveFunction
==================== ====================
*/ */
static int PR_LeaveFunction (void) static int32_t PR_LeaveFunction (void)
{ {
int i, c; int32_t i, c;
if (pr_depth <= 0) if (pr_depth <= 0)
Host_Error("prog stack underflow"); Host_Error("prog stack underflow");
@ -333,7 +333,7 @@ static int PR_LeaveFunction (void)
PR_RunError("PR_ExecuteProgram: locals stack underflow"); PR_RunError("PR_ExecuteProgram: locals stack underflow");
for (i = 0; i < c; i++) 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 // up stack
pr_depth--; pr_depth--;
@ -358,9 +358,9 @@ void PR_ExecuteProgram (func_t fnum)
eval_t *ptr; eval_t *ptr;
dstatement_t *st; dstatement_t *st;
dfunction_t *f, *newf; dfunction_t *f, *newf;
int profile, startprofile; int32_t profile, startprofile;
edict_t *ed; edict_t *ed;
int exitdepth; int32_t exitdepth;
if (!fnum || fnum >= progs->numfunctions) if (!fnum || fnum >= progs->numfunctions)
{ {
@ -436,11 +436,11 @@ void PR_ExecuteProgram (func_t fnum)
break; break;
case OP_BITAND: case OP_BITAND:
OPC->_float = (int)OPA->_float & (int)OPB->_float; OPC->_float = (int32_t)OPA->_float & (int32_t)OPB->_float;
break; break;
case OP_BITOR: case OP_BITOR:
OPC->_float = (int)OPA->_float | (int)OPB->_float; OPC->_float = (int32_t)OPA->_float | (int32_t)OPB->_float;
break; break;
case OP_GE: case OP_GE:
@ -552,7 +552,7 @@ void PR_ExecuteProgram (func_t fnum)
pr_xstatement = st - pr_statements; pr_xstatement = st - pr_statements;
PR_RunError("assignment to world entity"); 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; break;
case OP_LOAD_F: case OP_LOAD_F:
@ -564,7 +564,7 @@ void PR_ExecuteProgram (func_t fnum)
#ifdef PARANOID #ifdef PARANOID
NUM_FOR_EDICT(ed); // Make sure it's in range NUM_FOR_EDICT(ed); // Make sure it's in range
#endif #endif
OPC->_int = ((eval_t *)((int *)&ed->v + OPB->_int))->_int; OPC->_int = ((eval_t *)((int32_t *)&ed->v + OPB->_int))->_int;
break; break;
case OP_LOAD_V: case OP_LOAD_V:
@ -572,7 +572,7 @@ void PR_ExecuteProgram (func_t fnum)
#ifdef PARANOID #ifdef PARANOID
NUM_FOR_EDICT(ed); // Make sure it's in range NUM_FOR_EDICT(ed); // Make sure it's in range
#endif #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[0] = ptr->vector[0];
OPC->vector[1] = ptr->vector[1]; OPC->vector[1] = ptr->vector[1];
OPC->vector[2] = ptr->vector[2]; OPC->vector[2] = ptr->vector[2];
@ -610,7 +610,7 @@ void PR_ExecuteProgram (func_t fnum)
newf = &pr_functions[OPA->function]; newf = &pr_functions[OPA->function];
if (newf->first_statement < 0) if (newf->first_statement < 0)
{ // Built-in function { // Built-in function
int i = -newf->first_statement; int32_t i = -newf->first_statement;
if (i >= pr_numbuiltins) if (i >= pr_numbuiltins)
PR_RunError("Bad builtin call number %d", i); PR_RunError("Bad builtin call number %d", i);
pr_builtins[i](); pr_builtins[i]();

View File

@ -2,10 +2,10 @@
/* file generated by qcc, do not modify */ /* file generated by qcc, do not modify */
typedef struct typedef struct
{ int pad[28]; { int32_t pad[28];
int self; int32_t self;
int other; int32_t other;
int world; int32_t world;
float time; float time;
float frametime; float frametime;
float force_retouch; float force_retouch;
@ -43,10 +43,10 @@ typedef struct
vec3_t trace_endpos; vec3_t trace_endpos;
vec3_t trace_plane_normal; vec3_t trace_plane_normal;
float trace_plane_dist; float trace_plane_dist;
int trace_ent; int32_t trace_ent;
float trace_inopen; float trace_inopen;
float trace_inwater; float trace_inwater;
int msg_entity; int32_t msg_entity;
func_t main; func_t main;
func_t StartFrame; func_t StartFrame;
func_t PlayerPreThink; func_t PlayerPreThink;
@ -86,7 +86,7 @@ typedef struct
func_t think; func_t think;
func_t blocked; func_t blocked;
float nextthink; float nextthink;
int groundentity; int32_t groundentity;
float health; float health;
float frags; float frags;
float weapon; float weapon;
@ -99,7 +99,7 @@ typedef struct
float ammo_cells; float ammo_cells;
float items; float items;
float takedamage; float takedamage;
int chain; int32_t chain;
float deadflag; float deadflag;
vec3_t view_ofs; vec3_t view_ofs;
float button0; float button0;
@ -110,7 +110,7 @@ typedef struct
vec3_t v_angle; vec3_t v_angle;
float idealpitch; float idealpitch;
string_t netname; string_t netname;
int enemy; int32_t enemy;
float flags; float flags;
float colormap; float colormap;
float team; float team;
@ -122,15 +122,15 @@ typedef struct
float watertype; float watertype;
float ideal_yaw; float ideal_yaw;
float yaw_speed; float yaw_speed;
int aiment; int32_t aiment;
int goalentity; int32_t goalentity;
float spawnflags; float spawnflags;
string_t target; string_t target;
string_t targetname; string_t targetname;
float dmg_take; float dmg_take;
float dmg_save; float dmg_save;
int dmg_inflictor; int32_t dmg_inflictor;
int owner; int32_t owner;
vec3_t movedir; vec3_t movedir;
string_t message; string_t message;
float sounds; float sounds;

View File

@ -32,8 +32,8 @@ typedef union eval_s
float _float; float _float;
float vector[3]; float vector[3];
func_t function; func_t function;
int _int; int32_t _int;
int edict; int32_t edict;
} eval_t; } eval_t;
#define MAX_ENT_LEAFS 32 #define MAX_ENT_LEAFS 32
@ -42,8 +42,8 @@ typedef struct edict_s
bool free; bool free;
link_t area; /* linked to a division node or leaf */ link_t area; /* linked to a division node or leaf */
int num_leafs; int32_t num_leafs;
int leafnums[MAX_ENT_LEAFS]; int32_t leafnums[MAX_ENT_LEAFS];
entity_state_t baseline; entity_state_t baseline;
uint8_t alpha; /* johnfitz -- hack to support alpha since it's not part of entvars_t */ 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 globalvars_t *pr_global_struct;
extern float *pr_globals; /* same as 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); void PR_Init (void);
@ -73,9 +73,9 @@ void PR_Init (void);
void PR_ExecuteProgram (func_t fnum); void PR_ExecuteProgram (func_t fnum);
void PR_LoadProgs (void); void PR_LoadProgs (void);
const char *PR_GetString (int num); const char *PR_GetString (int32_t num);
int PR_SetEngineString (const char *s); int32_t PR_SetEngineString (const char *s);
int PR_AllocString (int bufferlength, char **ptr); int32_t PR_AllocString (int32_t bufferlength, char **ptr);
void PR_Profile_f (void); 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 EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size))
#define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts) / pr_edict_size) #define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts) / pr_edict_size)
*/ */
edict_t *EDICT_NUM(int n); edict_t *EDICT_NUM(int32_t n);
int NUM_FOR_EDICT(edict_t *e); int32_t NUM_FOR_EDICT(edict_t *e);
#define NEXT_EDICT(e) ((edict_t *)( (byte *)e + pr_edict_size)) #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 PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e))
#define G_FLOAT(o) (pr_globals[o]) #define G_FLOAT(o) (pr_globals[o])
#define G_INT(o) (*(int *)&pr_globals[o]) #define G_INT(o) (*(int32_t *)&pr_globals[o])
#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int *)&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_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
#define G_VECTOR(o) (&pr_globals[o]) #define G_VECTOR(o) (&pr_globals[o])
#define G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o])) #define G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o]))
#define G_FUNCTION(o) (*(func_t *)&pr_globals[o]) #define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
#define E_FLOAT(e,o) (((float*)&e->v)[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_VECTOR(e,o) (&((float*)&e->v)[o])
#define E_STRING(e,o) (PR_GetString(*(string_t *)&((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); typedef void (*builtin_t) (void);
extern builtin_t *pr_builtins; 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 bool pr_trace;
extern dfunction_t *pr_xfunction; extern dfunction_t *pr_xfunction;
extern int pr_xstatement; extern int32_t pr_xstatement;
extern uint16_t pr_crc; extern uint16_t pr_crc;
@ -136,7 +136,7 @@ noreturn void PR_RunError (const char *error, ...) FUNC_PRINTF(1,2);
#endif #endif
void ED_PrintEdicts (void); void ED_PrintEdicts (void);
void ED_PrintNum (int ent); void ED_PrintNum (int32_t ent);
eval_t *GetEdictFieldValue(edict_t *ed, const char *field); eval_t *GetEdictFieldValue(edict_t *ed, const char *field);

View File

@ -235,12 +235,12 @@ typedef struct
{ {
vec3_t origin; vec3_t origin;
vec3_t angles; vec3_t angles;
uint16_t modelindex; //johnfitz -- was int uint16_t modelindex; //johnfitz -- was int32_t
uint16_t frame; //johnfitz -- was int uint16_t frame; //johnfitz -- was int32_t
uint8_t colormap; //johnfitz -- was int uint8_t colormap; //johnfitz -- was int32_t
uint8_t skin; //johnfitz -- was int uint8_t skin; //johnfitz -- was int32_t
uint8_t alpha; //johnfitz -- added uint8_t alpha; //johnfitz -- added
int effects; int32_t effects;
} entity_state_t; } entity_state_t;
typedef struct typedef struct

View File

@ -20,48 +20,48 @@
#ifndef Q_CTYPE_H #ifndef Q_CTYPE_H
#define 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); 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'); 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'); 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)); 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'); 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') || return (q_isdigit(c) || (c >= 'a' && c <= 'f') ||
(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)); 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'); return (c == ' ' || c == '\t');
} }
static inline int q_isspace(int c) static inline int32_t q_isspace(int32_t c)
{ {
switch(c) { switch(c) {
case ' ': case '\t': case ' ': case '\t':
@ -71,27 +71,27 @@ static inline int q_isspace(int c)
return 0; return 0;
} }
static inline int q_isgraph(int c) static inline int32_t q_isgraph(int32_t c)
{ {
return (c > 0x20 && c <= 0x7e); 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); return (c >= 0x20 && c <= 0x7e);
} }
static inline int q_toascii(int c) static inline int32_t q_toascii(int32_t c)
{ {
return (c & 0x7f); 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); 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); return ((q_islower(c)) ? (c & ~('a' - 'A')) : c);
} }

View File

@ -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 !!! */ /* !!! if this is changed, it must be changed in asm_i386.h too !!! */
typedef struct typedef struct
{ {
int left; int32_t left;
int right; int32_t right;
} portable_samplepair_t; } portable_samplepair_t;
typedef struct sfx_s 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 !!! */ /* !!! if this is changed, it must be changed in asm_i386.h too !!! */
typedef struct typedef struct
{ {
int length; int32_t length;
int loopstart; int32_t loopstart;
int speed; int32_t speed;
int width; int32_t width;
int stereo; int32_t stereo;
byte data[1]; /* variable sized */ byte data[1]; /* variable sized */
} sfxcache_t; } sfxcache_t;
typedef struct typedef struct
{ {
int channels; int32_t channels;
int samples; /* mono samples in buffer */ int32_t samples; /* mono samples in buffer */
int submission_chunk; /* don't mix less than this # */ int32_t submission_chunk; /* don't mix less than this # */
int samplepos; /* in mono samples */ int32_t samplepos; /* in mono samples */
int samplebits; int32_t samplebits;
int signed8; /* device opened for S8 format? (e.g. Amiga AHI) */ int32_t signed8; /* device opened for S8 format? (e.g. Amiga AHI) */
int speed; int32_t speed;
uint8_t *buffer; uint8_t *buffer;
} dma_t; } dma_t;
@ -65,36 +65,36 @@ typedef struct
typedef struct typedef struct
{ {
sfx_t *sfx; /* sfx number */ sfx_t *sfx; /* sfx number */
int leftvol; /* 0-255 volume */ int32_t leftvol; /* 0-255 volume */
int rightvol; /* 0-255 volume */ int32_t rightvol; /* 0-255 volume */
int end; /* end time in global paintsamples */ int32_t end; /* end time in global paintsamples */
int pos; /* sample position in sfx */ int32_t pos; /* sample position in sfx */
int looping; /* where to loop, -1 = no looping */ int32_t looping; /* where to loop, -1 = no looping */
int entnum; /* to allow overriding a specific sound */ int32_t entnum; /* to allow overriding a specific sound */
int entchannel; int32_t entchannel;
vec3_t origin; /* origin of sound effect */ vec3_t origin; /* origin of sound effect */
vec_t dist_mult; /* distance multiplier (attenuation/clipK) */ 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; } channel_t;
#define WAV_FORMAT_PCM 1 #define WAV_FORMAT_PCM 1
typedef struct typedef struct
{ {
int rate; int32_t rate;
int width; int32_t width;
int channels; int32_t channels;
int loopstart; int32_t loopstart;
int samples; int32_t samples;
int dataofs; /* chunk starts this many bytes from file start */ int32_t dataofs; /* chunk starts this many bytes from file start */
} wavinfo_t; } wavinfo_t;
void S_Init (void); void S_Init (void);
void S_Startup (void); void S_Startup (void);
void S_Shutdown (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_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_StopAllSounds(bool clear);
void S_ClearBuffer (void); void S_ClearBuffer (void);
void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up); 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_ClearPrecache (void);
void S_BeginPrecaching (void); void S_BeginPrecaching (void);
void S_EndPrecaching (void); void S_EndPrecaching (void);
void S_PaintChannels (int endtime); void S_PaintChannels (int32_t endtime);
void S_InitPaintChannels (void); void S_InitPaintChannels (void);
/* picks a channel based on priorities, empty slots, number of channels */ /* 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 */ /* spatializes a channel */
void SND_Spatialize (channel_t *ch); void SND_Spatialize (channel_t *ch);
/* music stream support */ /* 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. */ /* Expects data in signed 16 bit, or unsigned 8 bit format. */
/* initializes cycling through a DMA buffer and returns information on it */ /* initializes cycling through a DMA buffer and returns information on it */
bool SNDDMA_Init(dma_t *dma); bool SNDDMA_Init(dma_t *dma);
/* gets the current DMA position */ /* gets the current DMA position */
int SNDDMA_GetDMAPos(void); int32_t SNDDMA_GetDMAPos(void);
/* shutdown the DMA xfer. */ /* shutdown the DMA xfer. */
void SNDDMA_Shutdown(void); void SNDDMA_Shutdown(void);
@ -158,10 +158,10 @@ extern channel_t snd_channels[MAX_CHANNELS];
extern volatile dma_t *shm; extern volatile dma_t *shm;
extern int total_channels; extern int32_t total_channels;
extern int soundtime; extern int32_t soundtime;
extern int paintedtime; extern int32_t paintedtime;
extern int s_rawend; extern int32_t s_rawend;
extern vec3_t listener_origin; extern vec3_t listener_origin;
extern vec3_t listener_forward; extern vec3_t listener_forward;
@ -182,7 +182,7 @@ extern cvar_t bgmvolume;
void S_LocalSound (const char *name); void S_LocalSound (const char *name);
sfxcache_t *S_LoadSound (sfx_t *s); 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); void SND_InitScaletable (void);

View File

@ -51,13 +51,13 @@
#include <string.h> #include <string.h>
_Static_assert(sizeof(float) == 4, "float not correct size"); _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 */ /* make sure enums are the size of ints for structure packing */
enum dummy_enum { enum dummy_enum {
dummy_value 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; typedef uint8_t byte;

View File

@ -175,12 +175,12 @@ typedef struct
// if user directories are enabled, basedir // if user directories are enabled, basedir
// and userdir will point to different // and userdir will point to different
// memory locations, otherwise to the same. // memory locations, otherwise to the same.
int argc; int32_t argc;
char **argv; char **argv;
void *membase; void *membase;
int memsize; int32_t memsize;
int numcpus; int32_t numcpus;
int errstate; int32_t errstate;
} quakeparms_t; } quakeparms_t;
#include "common.h" #include "common.h"
@ -250,7 +250,7 @@ extern cvar_t max_edicts; //johnfitz
extern bool host_initialized; // true if into command execution extern bool host_initialized; // true if into command execution
extern double host_frametime; extern double host_frametime;
extern byte *host_colormap; 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 extern double realtime; // not bounded in any way, changed at
// start of every frame, never reset // start of every frame, never reset
@ -288,7 +288,7 @@ void DemoList_Init (void);
void DemoList_Rebuild (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 // the user changes the cvar while the level is
// running, this reflects the level actually in use) // running, this reflects the level actually in use)

View File

@ -94,9 +94,9 @@ Returns the offset of the first vertex's meshxyz_t.xyz in the vbo for the given
model and pose. 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); 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. 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); 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]; float vertcolor[4];
trivertx_t *verts1, *verts2; trivertx_t *verts1, *verts2;
int *commands; int32_t *commands;
int count; int32_t count;
float u,v; float u,v;
float blend, iblend; float blend, iblend;
bool lerping; bool lerping;
@ -326,7 +326,7 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata)
blend = iblend = 0; // avoid bogus compiler warning 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 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 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; entity_t *e = currententity;
int posenum, numposes; int32_t posenum, numposes;
if ((frame >= paliashdr->numframes) || (frame < 0)) if ((frame >= paliashdr->numframes) || (frame < 0))
{ {
@ -425,7 +425,7 @@ void R_SetupAliasFrame (aliashdr_t *paliashdr, int frame, lerpdata_t *lerpdata)
if (numposes > 1) if (numposes > 1)
{ {
e->lerptime = paliashdr->frames[frame].interval; e->lerptime = paliashdr->frames[frame].interval;
posenum += (int)(cl.time / e->lerptime) % numposes; posenum += (int32_t)(cl.time / e->lerptime) % numposes;
} }
else else
e->lerptime = 0.1; e->lerptime = 0.1;
@ -481,7 +481,7 @@ void R_SetupEntityTransform (entity_t *e, lerpdata_t *lerpdata)
{ {
float blend; float blend;
vec3_t d; vec3_t d;
int i; int32_t i;
// if LERP_RESETMOVE, kill any lerps in progress // if LERP_RESETMOVE, kill any lerps in progress
if (e->lerpflags & LERP_RESETMOVE) if (e->lerpflags & LERP_RESETMOVE)
@ -543,8 +543,8 @@ void R_SetupAliasLighting (entity_t *e)
{ {
vec3_t dist; vec3_t dist;
float add; float add;
int i; int32_t i;
int quantizedangle; int32_t quantizedangle;
float radiansangle; float radiansangle;
R_LightPoint (e->origin); R_LightPoint (e->origin);
@ -602,7 +602,7 @@ void R_SetupAliasLighting (entity_t *e)
lightcolor[2] = 256.0f; 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 //ericw -- shadevector is passed to the shader to compute shadedots inside the
//shader, see GLAlias_CreateShaders() //shader, see GLAlias_CreateShaders()
@ -625,7 +625,7 @@ R_DrawAliasModel -- johnfitz -- almost completely rewritten
void R_DrawAliasModel (entity_t *e) void R_DrawAliasModel (entity_t *e)
{ {
aliashdr_t *paliashdr; aliashdr_t *paliashdr;
int i, anim, skinnum; int32_t i, anim, skinnum;
gltexture_t *tx, *fb; gltexture_t *tx, *fb;
lerpdata_t lerpdata; lerpdata_t lerpdata;
bool alphatest = !!(e->model->flags & MF_HOLEY); bool alphatest = !!(e->model->flags & MF_HOLEY);
@ -689,7 +689,7 @@ void R_DrawAliasModel (entity_t *e)
// set up textures // set up textures
// //
GL_DisableMultitexture(); GL_DisableMultitexture();
anim = (int)(cl.time*10) & 3; anim = (int32_t)(cl.time*10) & 3;
skinnum = e->skinnum; skinnum = e->skinnum;
if ((skinnum >= paliashdr->numskins) || (skinnum < 0)) if ((skinnum >= paliashdr->numskins) || (skinnum < 0))
{ {
@ -716,7 +716,7 @@ void R_DrawAliasModel (entity_t *e)
glDisable (GL_TEXTURE_2D); glDisable (GL_TEXTURE_2D);
GL_DrawAliasFrame (paliashdr, lerpdata); GL_DrawAliasFrame (paliashdr, lerpdata);
glEnable (GL_TEXTURE_2D); glEnable (GL_TEXTURE_2D);
srand((int) (cl.time * 1000)); //restore randomness srand((int32_t) (cl.time * 1000)); //restore randomness
} }
else if (r_fullbright_cheatsafe) else if (r_fullbright_cheatsafe)
{ {

View File

@ -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_fullbrights, r_drawflat, gl_overbright, r_oldwater; //johnfitz
extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix
int gl_lightmap_format; int32_t gl_lightmap_format;
int lightmap_bytes; int32_t lightmap_bytes;
#define BLOCK_WIDTH 128 #define BLOCK_WIDTH 128
#define BLOCK_HEIGHT 128 #define BLOCK_HEIGHT 128
@ -45,8 +45,8 @@ glpoly_t *lightmap_polys[MAX_LIGHTMAPS];
bool lightmap_modified[MAX_LIGHTMAPS]; bool lightmap_modified[MAX_LIGHTMAPS];
glRect_t lightmap_rectchange[MAX_LIGHTMAPS]; glRect_t lightmap_rectchange[MAX_LIGHTMAPS];
int allocated[MAX_LIGHTMAPS][BLOCK_WIDTH]; int32_t 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 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 // the lightmap texture data needs to be kept in
// main memory so texsubimage can update properly // 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 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; int32_t relative;
int count; int32_t count;
if (frame) if (frame)
if (base->alternate_anims) if (base->alternate_anims)
@ -72,7 +72,7 @@ texture_t *R_TextureAnimation (texture_t *base, int frame)
if (!base->anim_total) if (!base->anim_total)
return base; return base;
relative = (int)(cl.time*10) % base->anim_total; relative = (int32_t)(cl.time*10) % base->anim_total;
count = 0; count = 0;
while (base->anim_min > relative || base->anim_max <= relative) while (base->anim_min > relative || base->anim_max <= relative)
@ -95,7 +95,7 @@ DrawGLPoly
void DrawGLPoly (glpoly_t *p) void DrawGLPoly (glpoly_t *p)
{ {
float *v; float *v;
int i; int32_t i;
glBegin (GL_POLYGON); glBegin (GL_POLYGON);
v = p->verts[0]; v = p->verts[0];
@ -115,7 +115,7 @@ DrawGLTriangleFan -- johnfitz -- like DrawGLPoly but for r_showtris
void DrawGLTriangleFan (glpoly_t *p) void DrawGLTriangleFan (glpoly_t *p)
{ {
float *v; float *v;
int i; int32_t i;
glBegin (GL_TRIANGLE_FAN); glBegin (GL_TRIANGLE_FAN);
v = p->verts[0]; v = p->verts[0];
@ -146,7 +146,7 @@ void R_DrawSequentialPoly (msurface_t *s)
texture_t *t; texture_t *t;
float *v; float *v;
float entalpha; float entalpha;
int i; int32_t i;
t = R_TextureAnimation (s->texinfo->texture, currententity->frame); t = R_TextureAnimation (s->texinfo->texture, currententity->frame);
entalpha = ENTALPHA_DECODE(currententity->alpha); entalpha = ENTALPHA_DECODE(currententity->alpha);
@ -513,7 +513,7 @@ R_DrawBrushModel
*/ */
void R_DrawBrushModel (entity_t *e) void R_DrawBrushModel (entity_t *e)
{ {
int i, k; int32_t i, k;
msurface_t *psurf; msurface_t *psurf;
float dot; float dot;
mplane_t *pplane; mplane_t *pplane;
@ -598,7 +598,7 @@ R_DrawBrushModel_ShowTris -- johnfitz
*/ */
void R_DrawBrushModel_ShowTris (entity_t *e) void R_DrawBrushModel_ShowTris (entity_t *e)
{ {
int i; int32_t i;
msurface_t *psurf; msurface_t *psurf;
float dot; float dot;
mplane_t *pplane; mplane_t *pplane;
@ -669,9 +669,9 @@ called during rendering
void R_RenderDynamicLightmaps (msurface_t *fa) void R_RenderDynamicLightmaps (msurface_t *fa)
{ {
byte *base; byte *base;
int maps; int32_t maps;
glRect_t *theRect; glRect_t *theRect;
int smax, tmax; int32_t smax, tmax;
if (fa->flags & SURF_DRAWTILED) //johnfitz -- not a lightmapped surface if (fa->flags & SURF_DRAWTILED) //johnfitz -- not a lightmapped surface
return; return;
@ -721,11 +721,11 @@ dynamic:
AllocBlock -- returns a texture number and the position inside it 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; int32_t i, j;
int best, best2; int32_t best, best2;
int texnum; int32_t texnum;
// ericw -- rather than searching starting at lightmap 0 every time, // ericw -- rather than searching starting at lightmap 0 every time,
// start at the last lightmap we allocated a surface in. // 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; mvertex_t *r_pcurrentvertbase;
qmodel_t *currentmodel; qmodel_t *currentmodel;
int nColinElim; int32_t nColinElim;
/* /*
======================== ========================
@ -780,7 +780,7 @@ GL_CreateSurfaceLightmap
*/ */
void GL_CreateSurfaceLightmap (msurface_t *surf) void GL_CreateSurfaceLightmap (msurface_t *surf)
{ {
int smax, tmax; int32_t smax, tmax;
byte *base; byte *base;
smax = (surf->extents[0]>>4)+1; smax = (surf->extents[0]>>4)+1;
@ -799,7 +799,7 @@ BuildSurfaceDisplayList -- called at level load time
*/ */
void BuildSurfaceDisplayList (msurface_t *fa) void BuildSurfaceDisplayList (msurface_t *fa)
{ {
int i, lindex, lnumverts; int32_t i, lindex, lnumverts;
medge_t *pedges, *r_pedge; medge_t *pedges, *r_pedge;
float *vec; float *vec;
float s, t; float s, t;
@ -877,7 +877,7 @@ void GL_BuildLightmaps (void)
{ {
char name[16]; char name[16];
byte *data; byte *data;
int i, j; int32_t i, j;
qmodel_t *m; qmodel_t *m;
memset (allocated, 0, sizeof(allocated)); memset (allocated, 0, sizeof(allocated));
@ -983,7 +983,7 @@ surfaces from world + all brush models
void GL_BuildBModelVertexBuffer (void) void GL_BuildBModelVertexBuffer (void)
{ {
uint32_t numverts, varray_bytes, varray_index; uint32_t numverts, varray_bytes, varray_index;
int i, j; int32_t i, j;
qmodel_t *m; qmodel_t *m;
float *varray; float *varray;
@ -1044,13 +1044,13 @@ R_AddDynamicLights
*/ */
void R_AddDynamicLights (msurface_t *surf) void R_AddDynamicLights (msurface_t *surf)
{ {
int lnum; int32_t lnum;
int sd, td; int32_t sd, td;
float dist, rad, minlight; float dist, rad, minlight;
vec3_t impact, local; vec3_t impact, local;
int s, t; int32_t s, t;
int i; int32_t i;
int smax, tmax; int32_t smax, tmax;
mtexinfo_t *tex; mtexinfo_t *tex;
//johnfitz -- lit support via lordhavoc //johnfitz -- lit support via lordhavoc
float cred, cgreen, cblue, brightness; float cred, cgreen, cblue, brightness;
@ -1111,9 +1111,9 @@ void R_AddDynamicLights (msurface_t *surf)
//johnfitz -- lit support via lordhavoc //johnfitz -- lit support via lordhavoc
{ {
brightness = rad - dist; brightness = rad - dist;
bl[0] += (int) (brightness * cred); bl[0] += (int32_t) (brightness * cred);
bl[1] += (int) (brightness * cgreen); bl[1] += (int32_t) (brightness * cgreen);
bl[2] += (int) (brightness * cblue); bl[2] += (int32_t) (brightness * cblue);
} }
bl += 3; bl += 3;
//johnfitz //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 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; int32_t smax, tmax;
int r,g,b; int32_t r,g,b;
int i, j, size; int32_t i, j, size;
byte *lightmap; byte *lightmap;
unsigned scale; unsigned scale;
int maps; int32_t maps;
unsigned *bl; unsigned *bl;
surf->cached_dlight = (surf->dlightframe == r_framecount); 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 assumes lightmap texture is already bound
=============== ===============
*/ */
static void R_UploadLightmap(int lmap) static void R_UploadLightmap(int32_t lmap)
{ {
glRect_t *theRect; glRect_t *theRect;
@ -1272,7 +1272,7 @@ static void R_UploadLightmap(int lmap)
void R_UploadLightmaps (void) void R_UploadLightmaps (void)
{ {
int lmap; int32_t lmap;
for (lmap = 0; lmap < MAX_LIGHTMAPS; 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) void R_RebuildAllLightmaps (void)
{ {
int i, j; int32_t i, j;
qmodel_t *mod; qmodel_t *mod;
msurface_t *fa; msurface_t *fa;
byte *base; byte *base;

View File

@ -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 #define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's
// on the command line // on the command line
int ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61}; int32_t ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61};
int ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66}; int32_t ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66};
int ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3}; int32_t ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
particle_t *active_particles, *free_particles, *particles; particle_t *active_particles, *free_particles, *particles;
vec3_t r_pright, r_pup, r_ppn; vec3_t r_pright, r_pup, r_ppn;
int r_numparticles; int32_t r_numparticles;
gltexture_t *particletexture, *particletexture1, *particletexture2, *particletexture3, *particletexture4; //johnfitz gltexture_t *particletexture, *particletexture1, *particletexture2, *particletexture3, *particletexture4; //johnfitz
float texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures 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 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 int32_t r; //distance from point x,y to circle origin, squared
int a; //alpha value to return int32_t a; //alpha value to return
x -= 16; x -= 16;
y -= 16; y -= 16;
@ -70,7 +70,7 @@ R_InitParticleTextures -- johnfitz -- rewritten
*/ */
void R_InitParticleTextures (void) void R_InitParticleTextures (void)
{ {
int x,y; int32_t x,y;
static byte particle1_data[64*64*4]; static byte particle1_data[64*64*4];
static byte particle2_data[2*2*4]; static byte particle2_data[2*2*4];
static byte particle3_data[64*64*4]; static byte particle3_data[64*64*4];
@ -125,7 +125,7 @@ R_SetParticleTexture_f -- johnfitz
static void R_SetParticleTexture_f (cvar_t *var) static void R_SetParticleTexture_f (cvar_t *var)
{ {
(void)var; (void)var;
switch ((int)(r_particles.value)) switch ((int32_t)(r_particles.value))
{ {
case 1: case 1:
particletexture = particletexture1; particletexture = particletexture1;
@ -149,13 +149,13 @@ R_InitParticles
*/ */
void R_InitParticles (void) void R_InitParticles (void)
{ {
int i; int32_t i;
i = COM_CheckParm ("-particles"); i = COM_CheckParm ("-particles");
if (i) 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) if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
r_numparticles = ABSOLUTE_MIN_PARTICLES; r_numparticles = ABSOLUTE_MIN_PARTICLES;
} }
@ -189,12 +189,12 @@ float timescale = 0.01;
void R_EntityParticles (entity_t *ent) void R_EntityParticles (entity_t *ent)
{ {
int i; int32_t i;
particle_t *p; particle_t *p;
float angle; float angle;
float sp, sy, cp, cy; float sp, sy, cp, cy;
// float sr, cr; // float sr, cr;
// int count; // int32_t count;
vec3_t forward; vec3_t forward;
float dist; float dist;
@ -251,7 +251,7 @@ R_ClearParticles
*/ */
void R_ClearParticles (void) void R_ClearParticles (void)
{ {
int i; int32_t i;
free_particles = &particles[0]; free_particles = &particles[0];
active_particles = NULL; active_particles = NULL;
@ -270,8 +270,8 @@ void R_ReadPointFile_f (void)
{ {
FILE *f; FILE *f;
vec3_t org; vec3_t org;
int r; int32_t r;
int c; int32_t c;
particle_t *p; particle_t *p;
char name[MAX_QPATH]; char name[MAX_QPATH];
@ -328,7 +328,7 @@ Parse an effect out of the server message
void R_ParseParticleEffect (void) void R_ParseParticleEffect (void)
{ {
vec3_t org, dir; vec3_t org, dir;
int i, count, msgcount, color; int32_t i, count, msgcount, color;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
org[i] = MSG_ReadCoord (cl.protocolflags); org[i] = MSG_ReadCoord (cl.protocolflags);
@ -352,7 +352,7 @@ R_ParticleExplosion
*/ */
void R_ParticleExplosion (vec3_t org) void R_ParticleExplosion (vec3_t org)
{ {
int i, j; int32_t i, j;
particle_t *p; particle_t *p;
for (i=0 ; i<1024 ; i++) for (i=0 ; i<1024 ; i++)
@ -393,11 +393,11 @@ void R_ParticleExplosion (vec3_t org)
R_ParticleExplosion2 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; particle_t *p;
int colorMod = 0; int32_t colorMod = 0;
for (i=0; i<512; i++) for (i=0; i<512; i++)
{ {
@ -428,7 +428,7 @@ R_BlobExplosion
*/ */
void R_BlobExplosion (vec3_t org) void R_BlobExplosion (vec3_t org)
{ {
int i, j; int32_t i, j;
particle_t *p; particle_t *p;
for (i=0 ; i<1024 ; i++) for (i=0 ; i<1024 ; i++)
@ -470,9 +470,9 @@ void R_BlobExplosion (vec3_t org)
R_RunParticleEffect 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; particle_t *p;
for (i=0 ; i<count ; i++) for (i=0 ; i<count ; i++)
@ -529,7 +529,7 @@ R_LavaSplash
*/ */
void R_LavaSplash (vec3_t org) void R_LavaSplash (vec3_t org)
{ {
int i, j, k; int32_t i, j, k;
particle_t *p; particle_t *p;
float vel; float vel;
vec3_t dir; vec3_t dir;
@ -570,7 +570,7 @@ R_TeleportSplash
*/ */
void R_TeleportSplash (vec3_t org) void R_TeleportSplash (vec3_t org)
{ {
int i, j, k; int32_t i, j, k;
particle_t *p; particle_t *p;
float vel; float vel;
vec3_t dir; vec3_t dir;
@ -611,14 +611,14 @@ R_RocketTrail
FIXME -- rename function and use #defined types instead of numbers FIXME -- rename function and use #defined types instead of numbers
=============== ===============
*/ */
void R_RocketTrail (vec3_t start, vec3_t end, int type) void R_RocketTrail (vec3_t start, vec3_t end, int32_t type)
{ {
vec3_t vec; vec3_t vec;
float len; float len;
int j; int32_t j;
particle_t *p; particle_t *p;
int dec; int32_t dec;
static int tracercount; static int32_t tracercount;
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
len = VectorNormalize (vec); len = VectorNormalize (vec);
@ -648,7 +648,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
{ {
case 0: // rocket trail case 0: // rocket trail
p->ramp = (rand()&3); p->ramp = (rand()&3);
p->color = ramp3[(int)p->ramp]; p->color = ramp3[(int32_t)p->ramp];
p->type = pt_fire; p->type = pt_fire;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
p->org[j] = start[j] + ((rand()%6)-3); 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 case 1: // smoke smoke
p->ramp = (rand()&3) + 2; p->ramp = (rand()&3) + 2;
p->color = ramp3[(int)p->ramp]; p->color = ramp3[(int32_t)p->ramp];
p->type = pt_fire; p->type = pt_fire;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
p->org[j] = start[j] + ((rand()%6)-3); 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) void CL_RunParticles (void)
{ {
particle_t *p, *kill; particle_t *p, *kill;
int i; int32_t i;
float time1, time2, time3, dvel, frametime, grav; float time1, time2, time3, dvel, frametime, grav;
extern cvar_t sv_gravity; extern cvar_t sv_gravity;
@ -774,7 +774,7 @@ void CL_RunParticles (void)
if (p->ramp >= 6) if (p->ramp >= 6)
p->die = -1; p->die = -1;
else else
p->color = ramp3[(int)p->ramp]; p->color = ramp3[(int32_t)p->ramp];
p->vel[2] += grav; p->vel[2] += grav;
break; break;
@ -783,7 +783,7 @@ void CL_RunParticles (void)
if (p->ramp >=8) if (p->ramp >=8)
p->die = -1; p->die = -1;
else else
p->color = ramp1[(int)p->ramp]; p->color = ramp1[(int32_t)p->ramp];
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
p->vel[i] += p->vel[i]*dvel; p->vel[i] += p->vel[i]*dvel;
p->vel[2] -= grav; p->vel[2] -= grav;
@ -794,7 +794,7 @@ void CL_RunParticles (void)
if (p->ramp >=8) if (p->ramp >=8)
p->die = -1; p->die = -1;
else else
p->color = ramp2[(int)p->ramp]; p->color = ramp2[(int32_t)p->ramp];
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
p->vel[i] -= p->vel[i]*frametime; p->vel[i] -= p->vel[i]*frametime;
p->vel[2] -= grav; p->vel[2] -= grav;
@ -868,12 +868,12 @@ void R_DrawParticles (void)
scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures
//johnfitz -- particle transparency and fade out //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[0] = c[0];
color[1] = c[1]; color[1] = c[1];
color[2] = c[2]; color[2] = c[2];
//alpha = CLAMP(0, p->die + 0.5 - cl.time, 1); //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); glColor4ubv(color);
//johnfitz //johnfitz
@ -913,12 +913,12 @@ void R_DrawParticles (void)
scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures
//johnfitz -- particle transparency and fade out //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[0] = c[0];
color[1] = c[1]; color[1] = c[1];
color[2] = c[2]; color[2] = c[2];
//alpha = CLAMP(0, p->die + 0.5 - cl.time, 1); //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); glColor4ubv(color);
//johnfitz //johnfitz

View File

@ -33,7 +33,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currentent)
msprite_t *psprite; msprite_t *psprite;
mspritegroup_t *pspritegroup; mspritegroup_t *pspritegroup;
mspriteframe_t *pspriteframe; mspriteframe_t *pspriteframe;
int i, numframes, frame; int32_t i, numframes, frame;
float *pintervals, fullinterval, targettime, time; float *pintervals, fullinterval, targettime, time;
psprite = (msprite_t *) currentent->model->cache.data; 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 // when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
// are positive, so we don't have to worry about division by 0 // 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++) for (i=0 ; i<(numframes-1) ; i++)
{ {

View File

@ -30,7 +30,7 @@ extern glpoly_t *lightmap_polys[MAX_LIGHTMAPS];
byte *SV_FatPVS (vec3_t org, qmodel_t *worldmodel); 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) void R_ClearTextureChains (qmodel_t *mod, texchain_t chain)
{ {
int i; int32_t i;
// set all chains to null // set all chains to null
for (i=0 ; i<mod->numtextures ; i++) for (i=0 ; i<mod->numtextures ; i++)
@ -81,7 +81,7 @@ void R_MarkSurfaces (void)
mleaf_t *leaf; mleaf_t *leaf;
mnode_t *node; mnode_t *node;
msurface_t *surf, **mark; msurface_t *surf, **mark;
int i, j; int32_t i, j;
bool nearwaterportal; bool nearwaterportal;
// clear lightmap chains // clear lightmap chains
@ -203,7 +203,7 @@ R_CullSurfaces -- johnfitz
void R_CullSurfaces (void) void R_CullSurfaces (void)
{ {
msurface_t *s; msurface_t *s;
int i; int32_t i;
texture_t *t; texture_t *t;
if (!r_drawworld_cheatsafe) if (!r_drawworld_cheatsafe)
@ -245,7 +245,7 @@ void R_BuildLightmapChains (qmodel_t *model, texchain_t chain)
{ {
texture_t *t; texture_t *t;
msurface_t *s; 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) // 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)); 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) void R_DrawTextureChains_ShowTris (qmodel_t *model, texchain_t chain)
{ {
int i; int32_t i;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
glpoly_t *p; glpoly_t *p;
@ -347,7 +347,7 @@ R_DrawTextureChains_Drawflat -- johnfitz
*/ */
void R_DrawTextureChains_Drawflat (qmodel_t *model, texchain_t chain) void R_DrawTextureChains_Drawflat (qmodel_t *model, texchain_t chain)
{ {
int i; int32_t i;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
glpoly_t *p; glpoly_t *p;
@ -383,7 +383,7 @@ void R_DrawTextureChains_Drawflat (qmodel_t *model, texchain_t chain)
} }
} }
glColor3f (1,1,1); 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) void R_DrawTextureChains_Glow (qmodel_t *model, entity_t *ent, texchain_t chain)
{ {
int i; int32_t i;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
gltexture_t *glt; 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) static void R_TriangleIndicesForSurf (msurface_t *s, uint32_t *dest)
{ {
int i; int32_t i;
for (i=2; i<s->numedges; i++) for (i=2; i<s->numedges; i++)
{ {
*dest++ = s->vbo_firstvert; *dest++ = s->vbo_firstvert;
@ -493,7 +493,7 @@ using VBOs.
*/ */
static void R_BatchSurface (msurface_t *s) static void R_BatchSurface (msurface_t *s)
{ {
int num_surf_indices; int32_t num_surf_indices;
num_surf_indices = R_NumTriangleIndicesForSurf (s); 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) void R_DrawTextureChains_Multitexture (qmodel_t *model, entity_t *ent, texchain_t chain)
{ {
int i, j; int32_t i, j;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
float *v; 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) void R_DrawTextureChains_NoTexture (qmodel_t *model, texchain_t chain)
{ {
int i; int32_t i;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
bool bound; bool bound;
@ -601,7 +601,7 @@ R_DrawTextureChains_TextureOnly -- johnfitz
*/ */
void R_DrawTextureChains_TextureOnly (qmodel_t *model, entity_t *ent, texchain_t chain) void R_DrawTextureChains_TextureOnly (qmodel_t *model, entity_t *ent, texchain_t chain)
{ {
int i; int32_t i;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
bool bound; bool bound;
@ -660,7 +660,7 @@ R_DrawTextureChains_Water -- johnfitz
*/ */
void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain) void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain)
{ {
int i; int32_t i;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
glpoly_t *p; 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) void R_DrawTextureChains_White (qmodel_t *model, texchain_t chain)
{ {
int i; int32_t i;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
@ -770,7 +770,7 @@ R_DrawLightmapChains -- johnfitz -- R_BlendLightmaps stripped down to almost not
*/ */
void R_DrawLightmapChains (void) void R_DrawLightmapChains (void)
{ {
int i, j; int32_t i, j;
glpoly_t *p; glpoly_t *p;
float *v; 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) void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
{ {
int i; int32_t i;
msurface_t *s; msurface_t *s;
texture_t *t; texture_t *t;
bool bound; bool bound;
int lastlightmap; int32_t lastlightmap;
gltexture_t *fullbright = NULL; gltexture_t *fullbright = NULL;
float entalpha; 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 (LMTexLoc, 1);
GL_Uniform1iFunc (fullbrightTexLoc, 2); GL_Uniform1iFunc (fullbrightTexLoc, 2);
GL_Uniform1iFunc (useFullbrightTexLoc, 0); GL_Uniform1iFunc (useFullbrightTexLoc, 0);
GL_Uniform1iFunc (useOverbrightLoc, (int)gl_overbright.value); GL_Uniform1iFunc (useOverbrightLoc, (int32_t)gl_overbright.value);
GL_Uniform1iFunc (useAlphaTestLoc, 0); GL_Uniform1iFunc (useAlphaTestLoc, 0);
GL_Uniform1fFunc (alphaLoc, entalpha); GL_Uniform1fFunc (alphaLoc, entalpha);

View File

@ -50,7 +50,7 @@ typedef struct entity_s
{ {
bool forcelink; // model changed bool forcelink; // model changed
int update_type; int32_t update_type;
entity_state_t baseline; // to fill in defaults in updates entity_state_t baseline; // to fill in defaults in updates
@ -61,19 +61,19 @@ typedef struct entity_s
vec3_t angles; vec3_t angles;
struct qmodel_s *model; // NULL = no model struct qmodel_s *model; // NULL = no model
struct efrag_s *efrag; // linked list of efrags struct efrag_s *efrag; // linked list of efrags
int frame; int32_t frame;
float syncbase; // for client-side animations float syncbase; // for client-side animations
byte *colormap; byte *colormap;
int effects; // light, particles, etc int32_t effects; // light, particles, etc
int skinnum; // for Alias models int32_t skinnum; // for Alias models
int visframe; // last frame this entity was int32_t visframe; // last frame this entity was
// found in an active leaf // found in an active leaf
int dlightframe; // dynamic lighting int32_t dlightframe; // dynamic lighting
int dlightbits; int32_t dlightbits;
// FIXME: could turn these into a union // FIXME: could turn these into a union
int trivial_accept; int32_t trivial_accept;
struct mnode_s *topnode; // for bmodels, first world node struct mnode_s *topnode; // for bmodels, first world node
// that splits bmodel, or NULL if // that splits bmodel, or NULL if
// not split // not split
@ -99,14 +99,14 @@ typedef struct
vrect_t vrect; // subwindow in video for refresh vrect_t vrect; // subwindow in video for refresh
// FIXME: not need vrect next field here? // FIXME: not need vrect next field here?
vrect_t aliasvrect; // scaled Alias version vrect_t aliasvrect; // scaled Alias version
int vrectright, vrectbottom; // right & bottom screen coords int32_t vrectright, vrectbottom; // right & bottom screen coords
int aliasvrectright, aliasvrectbottom; // scaled Alias versions int32_t aliasvrectright, aliasvrectbottom; // scaled Alias versions
float vrectrightedge; // rightmost right edge we care about, float vrectrightedge; // rightmost right edge we care about,
// for use in edge list // for use in edge list
float fvrectx, fvrecty; // for floating-point compares float fvrectx, fvrecty; // for floating-point compares
float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20 int32_t vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20 int32_t vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
float fvrectright_adj, fvrectbottom_adj; float fvrectright_adj, fvrectbottom_adj;
// right and bottom edges, for clamping // right and bottom edges, for clamping
float fvrectright; // rightmost edge, for Alias clamping float fvrectright; // rightmost edge, for Alias clamping
@ -121,14 +121,14 @@ typedef struct
float fov_x, fov_y; float fov_x, fov_y;
int ambientlight; int32_t ambientlight;
} refdef_t; } refdef_t;
// //
// refresh // refresh
// //
extern int reinit_surfcache; extern int32_t reinit_surfcache;
extern refdef_t r_refdef; extern refdef_t r_refdef;
@ -139,7 +139,7 @@ void R_Init (void);
void R_InitTextures (void); void R_InitTextures (void);
void R_InitEfrags (void); void R_InitEfrags (void);
void R_RenderView (void); // must set r_refdef first 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 // called whenever r_refdef or vid change
//void R_InitSky (struct texture_s *mt); // called at level load //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_ParseParticleEffect (void);
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);
void R_RocketTrail (vec3_t start, vec3_t end, int type); void R_RocketTrail (vec3_t start, vec3_t end, int32_t type);
void R_EntityParticles (entity_t *ent); void R_EntityParticles (entity_t *ent);
void R_BlobExplosion (vec3_t org); void R_BlobExplosion (vec3_t org);
void R_ParticleExplosion (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_LavaSplash (vec3_t org);
void R_TeleportSplash (vec3_t org); void R_TeleportSplash (vec3_t org);
@ -165,14 +165,14 @@ void R_PushDlights (void);
// //
// surface cache related // 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 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_FlushCaches (void);
void D_DeleteSurfaceCache (void); void D_DeleteSurfaceCache (void);
void D_InitCaches (void *buffer, int size); void D_InitCaches (void *buffer, int32_t size);
void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj); void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int32_t lineadj);
#endif /* _QUAKE_RENDER_H */ #endif /* _QUAKE_RENDER_H */

View File

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #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 #define STAT_MINUS 10 // num frame for '-' stats digit
@ -48,7 +48,7 @@ qpic_t *sb_face_invis_invuln;
bool sb_showscores; 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_invbar[2];
qpic_t *rsb_weapons[5]; 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 //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 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 //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 //MED 01/04/97 added hipnotic items array
qpic_t *hsb_items[2]; qpic_t *hsb_items[2];
void Sbar_MiniDeathmatchOverlay (void); void Sbar_MiniDeathmatchOverlay (void);
void Sbar_DeathmatchOverlay (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) void Sbar_LoadPics (void)
{ {
int i; int32_t i;
for (i = 0; i < 10; 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 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); Draw_Pic (x, y + 24, pic);
} }
@ -279,7 +279,7 @@ void Sbar_DrawPic (int x, int y, qpic_t *pic)
Sbar_DrawPicAlpha -- johnfitz 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); glDisable (GL_ALPHA_TEST);
glEnable (GL_BLEND); 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 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); 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 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); Draw_String (x, y + 24, str);
} }
@ -317,10 +317,10 @@ Sbar_DrawScrollString -- johnfitz
scroll the string inside a glscissor region 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; float scale;
int len, ofs, left; int32_t len, ofs, left;
scale = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0); scale = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0);
left = x * scale; 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); glScissor (left, 0, width * scale, glheight);
len = strlen(str)*8 + 40; len = strlen(str)*8 + 40;
ofs = ((int)(realtime*30))%len; ofs = ((int32_t)(realtime*30))%len;
Sbar_DrawString (x - ofs, y, str); Sbar_DrawString (x - ofs, y, str);
Sbar_DrawCharacter (x - ofs + len - 32, y, '/'); Sbar_DrawCharacter (x - ofs + len - 32, y, '/');
Sbar_DrawCharacter (x - ofs + len - 24, 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 Sbar_itoa
============= =============
*/ */
int Sbar_itoa (int num, char *buf) int32_t Sbar_itoa (int32_t num, char *buf)
{ {
char *str; char *str;
int pow10; int32_t pow10;
int dig; int32_t dig;
str = buf; str = buf;
@ -382,11 +382,11 @@ int Sbar_itoa (int num, char *buf)
Sbar_DrawNum 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 str[12];
char *ptr; char *ptr;
int l, frame; int32_t l, frame;
num = q_min(999,num); //johnfitz -- cap high values rather than truncating number 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]; char scoreboardtext[MAX_SCOREBOARD][20];
int scoreboardtop[MAX_SCOREBOARD]; int32_t scoreboardtop[MAX_SCOREBOARD];
int scoreboardbottom[MAX_SCOREBOARD]; int32_t scoreboardbottom[MAX_SCOREBOARD];
int scoreboardcount[MAX_SCOREBOARD]; int32_t scoreboardcount[MAX_SCOREBOARD];
int scoreboardlines; int32_t scoreboardlines;
/* /*
=============== ===============
@ -427,7 +427,7 @@ Sbar_SortFrags
*/ */
void Sbar_SortFrags (void) void Sbar_SortFrags (void)
{ {
int i, j, k; int32_t i, j, k;
// sort by frags // sort by frags
scoreboardlines = 0; 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; return m < 128 ? m + 8 : m + 8;
} }
@ -466,8 +466,8 @@ Sbar_UpdateScoreboard
*/ */
void Sbar_UpdateScoreboard (void) void Sbar_UpdateScoreboard (void)
{ {
int i, k; int32_t i, k;
int top, bottom; int32_t top, bottom;
scoreboard_t *s; scoreboard_t *s;
Sbar_SortFrags (); Sbar_SortFrags ();
@ -496,8 +496,8 @@ Sbar_SoloScoreboard -- johnfitz -- new layout
void Sbar_SoloScoreboard (void) void Sbar_SoloScoreboard (void)
{ {
char str[256]; char str[256];
int minutes, seconds, tens, units; int32_t minutes, seconds, tens, units;
int len; int32_t len;
sprintf (str,"Kills: %i/%i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]); sprintf (str,"Kills: %i/%i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
Sbar_DrawString (8, 12, str); Sbar_DrawString (8, 12, str);
@ -507,7 +507,7 @@ void Sbar_SoloScoreboard (void)
if (!fitzmode) if (!fitzmode)
{ /* QuakeSpasm customization: */ { /* 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); Sbar_DrawString (160 - strlen(str)*4, 12, str);
q_snprintf (str, sizeof(str), "%s (%s)", cl.levelname, cl.mapname); q_snprintf (str, sizeof(str), "%s (%s)", cl.levelname, cl.mapname);
@ -553,10 +553,10 @@ Sbar_DrawInventory
*/ */
void Sbar_DrawInventory (void) void Sbar_DrawInventory (void)
{ {
int i, val; int32_t i, val;
char num[6]; char num[6];
float time; float time;
int flashon; int32_t flashon;
if (rogue) if (rogue)
{ {
@ -576,7 +576,7 @@ void Sbar_DrawInventory (void)
if (cl.items & (IT_SHOTGUN<<i) ) if (cl.items & (IT_SHOTGUN<<i) )
{ {
time = cl.item_gettime[i]; time = cl.item_gettime[i];
flashon = (int)((cl.time - time)*10); flashon = (int32_t)((cl.time - time)*10);
if (flashon >= 10) if (flashon >= 10)
{ {
if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<<i) ) if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<<i) )
@ -598,13 +598,13 @@ void Sbar_DrawInventory (void)
// hipnotic weapons // hipnotic weapons
if (hipnotic) if (hipnotic)
{ {
int grenadeflashing = 0; int32_t grenadeflashing = 0;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (cl.items & (1<<hipweapons[i])) if (cl.items & (1<<hipweapons[i]))
{ {
time = cl.item_gettime[hipweapons[i]]; time = cl.item_gettime[hipweapons[i]];
flashon = (int)((cl.time - time)*10); flashon = (int32_t)((cl.time - time)*10);
if (flashon >= 10) if (flashon >= 10)
{ {
if (cl.stats[STAT_ACTIVEWEAPON] == (1<<hipweapons[i])) if (cl.stats[STAT_ACTIVEWEAPON] == (1<<hipweapons[i]))
@ -778,7 +778,7 @@ Sbar_DrawFrags -- johnfitz -- heavy revision
*/ */
void Sbar_DrawFrags (void) void Sbar_DrawFrags (void)
{ {
int numscores, i, x, color; int32_t numscores, i, x, color;
char num[12]; char num[12];
scoreboard_t *s; scoreboard_t *s;
@ -828,14 +828,14 @@ Sbar_DrawFace
*/ */
void Sbar_DrawFace (void) void Sbar_DrawFace (void)
{ {
int f, anim; int32_t f, anim;
// PGM 01/19/97 - team color drawing // PGM 01/19/97 - team color drawing
// PGM 03/02/97 - fixed so color swatch only appears in CTF modes // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
if (rogue && (cl.maxclients != 1) && (teamplay.value>3) && (teamplay.value<7)) if (rogue && (cl.maxclients != 1) && (teamplay.value>3) && (teamplay.value<7))
{ {
int top, bottom; int32_t top, bottom;
int xofs; int32_t xofs;
char num[12]; char num[12];
scoreboard_t *s; 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 str[12];
char *ptr; char *ptr;
int l, frame; int32_t l, frame;
l = Sbar_itoa (num, str); l = Sbar_itoa (num, str);
ptr = str; ptr = str;
@ -1106,9 +1106,9 @@ Sbar_DeathmatchOverlay
void Sbar_DeathmatchOverlay (void) void Sbar_DeathmatchOverlay (void)
{ {
qpic_t *pic; qpic_t *pic;
int i, k, l; int32_t i, k, l;
int top, bottom; int32_t top, bottom;
int x, y, f; int32_t x, y, f;
char num[12]; char num[12];
scoreboard_t *s; scoreboard_t *s;
@ -1154,12 +1154,12 @@ void Sbar_DeathmatchOverlay (void)
#if 0 #if 0
{ {
int total; int32_t total;
int n, minutes, tens, units; int32_t n, minutes, tens, units;
// draw time // draw time
total = cl.completed_time - s->entertime; total = cl.completed_time - s->entertime;
minutes = (int)total/60; minutes = (int32_t)total/60;
n = total - minutes*60; n = total - minutes*60;
tens = n/10; tens = n/10;
units = n%10; units = n%10;
@ -1186,7 +1186,7 @@ Sbar_MiniDeathmatchOverlay
*/ */
void Sbar_MiniDeathmatchOverlay (void) 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]; char num[12];
float scale; //johnfitz float scale; //johnfitz
scoreboard_t *s; scoreboard_t *s;
@ -1261,8 +1261,8 @@ Sbar_IntermissionOverlay
void Sbar_IntermissionOverlay (void) void Sbar_IntermissionOverlay (void)
{ {
qpic_t *pic; qpic_t *pic;
int dig; int32_t dig;
int num; int32_t num;
if (cl.gametype == GAME_DEATHMATCH) if (cl.gametype == GAME_DEATHMATCH)
{ {

View File

@ -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 // 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. // 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_Init (void);
void Sbar_LoadPics (void); void Sbar_LoadPics (void);

View File

@ -39,14 +39,14 @@ void SCR_CenterPrint (const char *str);
void SCR_BeginLoadingPlaque (void); void SCR_BeginLoadingPlaque (void);
void SCR_EndLoadingPlaque (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_con_current;
extern float scr_conlines; // lines of console to display 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_disabled_for_loading;
extern bool scr_skipupdate; extern bool scr_skipupdate;
@ -78,7 +78,7 @@ extern cvar_t scr_scale;
extern cvar_t scr_crosshairscale; extern cvar_t scr_crosshairscale;
//johnfitz //johnfitz
extern int scr_tileclear_updates; //johnfitz extern int32_t scr_tileclear_updates; //johnfitz
#endif /* _QUAKE_SCREEN_H */ #endif /* _QUAKE_SCREEN_H */

View File

@ -27,10 +27,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef struct typedef struct
{ {
int maxclients; int32_t maxclients;
int maxclientslimit; int32_t maxclientslimit;
struct client_s *clients; // [maxclients] struct client_s *clients; // [maxclients]
int serverflags; // episode completion information int32_t serverflags; // episode completion information
bool changelevel_issued; // cleared when at SV_SpawnServer bool changelevel_issued; // cleared when at SV_SpawnServer
} server_static_t; } server_static_t;
@ -47,7 +47,7 @@ typedef struct
double time; double time;
int lastcheck; // used by PF_checkclient int32_t lastcheck; // used by PF_checkclient
double lastchecktime; double lastchecktime;
char name[64]; // map name char name[64]; // map name
@ -57,8 +57,8 @@ typedef struct
struct qmodel_s *models[MAX_MODELS]; struct qmodel_s *models[MAX_MODELS];
const char *sound_precache[MAX_SOUNDS]; // NULL terminated const char *sound_precache[MAX_SOUNDS]; // NULL terminated
const char *lightstyles[MAX_LIGHTSTYLES]; const char *lightstyles[MAX_LIGHTSTYLES];
int num_edicts; int32_t num_edicts;
int max_edicts; int32_t max_edicts;
edict_t *edicts; // can NOT be array indexed, because edict_t *edicts; // can NOT be array indexed, because
// edict_t is variable sized, but can // edict_t is variable sized, but can
// be used to reference the world ent // be used to reference the world ent
@ -101,16 +101,16 @@ typedef struct client_s
byte msgbuf[MAX_MSGLEN]; byte msgbuf[MAX_MSGLEN];
edict_t *edict; // EDICT_NUM(clientnum+1) edict_t *edict; // EDICT_NUM(clientnum+1)
char name[32]; // for printing to other people char name[32]; // for printing to other people
int colors; int32_t colors;
float ping_times[NUM_PING_TIMES]; 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 // spawn parms are carried from level to level
float spawn_parms[NUM_SPAWN_PARMS]; float spawn_parms[NUM_SPAWN_PARMS];
// client known data for deltas // client known data for deltas
int old_frags; int32_t old_frags;
} client_t; } client_t;
@ -193,8 +193,8 @@ extern edict_t *sv_player;
void SV_Init (void); void SV_Init (void);
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);
void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, void SV_StartSound (edict_t *entity, int32_t channel, const char *sample, int32_t volume,
float attenuation); float attenuation);
void SV_DropClient (bool crash); void SV_DropClient (bool crash);
@ -202,7 +202,7 @@ void SV_DropClient (bool crash);
void SV_SendClientMessages (void); void SV_SendClientMessages (void);
void SV_ClearDatagram (void); void SV_ClearDatagram (void);
int SV_ModelIndex (const char *name); int32_t SV_ModelIndex (const char *name);
void SV_SetIdealPitch (void); void SV_SetIdealPitch (void);

View File

@ -246,12 +246,12 @@ void S_CodecCloseStream (snd_stream_t *stream)
stream->codec->codec_close(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); 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); return stream->codec->codec_read(stream, bytes, buffer);
} }
@ -294,7 +294,7 @@ void S_CodecUtilClose(snd_stream_t **stream)
*stream = NULL; *stream = NULL;
} }
int S_CodecIsAvailable (uint32_t type) int32_t S_CodecIsAvailable (uint32_t type)
{ {
snd_codec_t *codec = codecs; snd_codec_t *codec = codecs;
while (codec) while (codec)

View File

@ -28,13 +28,13 @@
typedef struct snd_info_s typedef struct snd_info_s
{ {
int rate; int32_t rate;
int bits, width; int32_t bits, width;
int channels; int32_t channels;
int samples; int32_t samples;
int blocksize; int32_t blocksize;
int size; int32_t size;
int dataofs; int32_t dataofs;
} snd_info_t; } snd_info_t;
typedef enum { typedef enum {
@ -76,8 +76,8 @@ snd_stream_t *S_CodecOpenStreamExt (const char *filename);
* MUST have an extension. */ * MUST have an extension. */
void S_CodecCloseStream (snd_stream_t *stream); void S_CodecCloseStream (snd_stream_t *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);
int S_CodecRewindStream (snd_stream_t *stream); int32_t S_CodecRewindStream (snd_stream_t *stream);
snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec); snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec);
void S_CodecUtilClose(snd_stream_t **stream); 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_WAVE CODECTYPE_WAV
#define CODECTYPE_MIDI CODECTYPE_MID #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 /* return 1 if available, 0 if codec failed init
* or -1 if no such codec is present. */ * or -1 if no such codec is present. */

View File

@ -30,8 +30,8 @@
typedef bool (*CODEC_INIT)(void); typedef bool (*CODEC_INIT)(void);
typedef void (*CODEC_SHUTDOWN)(void); typedef void (*CODEC_SHUTDOWN)(void);
typedef bool (*CODEC_OPEN)(snd_stream_t *stream); typedef bool (*CODEC_OPEN)(snd_stream_t *stream);
typedef int (*CODEC_READ)(snd_stream_t *stream, int bytes, void *buffer); typedef int32_t (*CODEC_READ)(snd_stream_t *stream, int32_t bytes, void *buffer);
typedef int (*CODEC_REWIND)(snd_stream_t *stream); typedef int32_t (*CODEC_REWIND)(snd_stream_t *stream);
typedef void (*CODEC_CLOSE)(snd_stream_t *stream); typedef void (*CODEC_CLOSE)(snd_stream_t *stream);
struct snd_codec_s struct snd_codec_s

View File

@ -40,9 +40,9 @@ static void S_StopAllSoundsC (void);
// ======================================================================= // =======================================================================
channel_t snd_channels[MAX_CHANNELS]; 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 bool snd_initialized = false;
static dma_t sn; static dma_t sn;
@ -55,16 +55,16 @@ vec3_t listener_up;
#define sound_nominal_clip_dist 1000.0 #define sound_nominal_clip_dist 1000.0
int soundtime; // sample PAIRS int32_t soundtime; // sample PAIRS
int paintedtime; // sample PAIRS int32_t paintedtime; // sample PAIRS
int s_rawend; int32_t s_rawend;
portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES]; portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES];
#define MAX_SFX 1024 #define MAX_SFX 1024
static sfx_t *known_sfx = NULL; // hunk allocated [MAX_SFX] 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]; static sfx_t *ambient_sfx[NUM_AMBIENTS];
@ -163,7 +163,7 @@ S_Init
*/ */
void S_Init (void) void S_Init (void)
{ {
int i; int32_t i;
if (snd_initialized) if (snd_initialized)
{ {
@ -271,7 +271,7 @@ S_FindName
*/ */
static sfx_t *S_FindName (const char *name) static sfx_t *S_FindName (const char *name)
{ {
int i; int32_t i;
sfx_t *sfx; sfx_t *sfx;
if (!name) if (!name)
@ -350,11 +350,11 @@ SND_PickChannel
picks a channel based on priorities, empty slots, number of channels 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; int32_t ch_idx;
int first_to_die; int32_t first_to_die;
int life_left; int32_t life_left;
// Check for replacement sound, or find the best one to replace // Check for replacement sound, or find the best one to replace
first_to_die = -1; first_to_die = -1;
@ -429,12 +429,12 @@ void SND_Spatialize (channel_t *ch)
// add in distance effect // add in distance effect
scale = (1.0 - dist) * rscale; scale = (1.0 - dist) * rscale;
ch->rightvol = (int) (ch->master_vol * scale); ch->rightvol = (int32_t) (ch->master_vol * scale);
if (ch->rightvol < 0) if (ch->rightvol < 0)
ch->rightvol = 0; ch->rightvol = 0;
scale = (1.0 - dist) * lscale; scale = (1.0 - dist) * lscale;
ch->leftvol = (int) (ch->master_vol * scale); ch->leftvol = (int32_t) (ch->master_vol * scale);
if (ch->leftvol < 0) if (ch->leftvol < 0)
ch->leftvol = 0; ch->leftvol = 0;
} }
@ -444,12 +444,12 @@ void SND_Spatialize (channel_t *ch)
// Start a sound effect // 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; channel_t *target_chan, *check;
sfxcache_t *sc; sfxcache_t *sc;
int ch_idx; int32_t ch_idx;
int skip; int32_t skip;
if (!sound_started) if (!sound_started)
return; 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)); memset (target_chan, 0, sizeof(*target_chan));
VectorCopy(origin, target_chan->origin); VectorCopy(origin, target_chan->origin);
target_chan->dist_mult = attenuation / sound_nominal_clip_dist; 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->entnum = entnum;
target_chan->entchannel = entchannel; target_chan->entchannel = entchannel;
SND_Spatialize(target_chan); 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) 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) if (skip >= target_chan->end)
skip = target_chan->end - 1; 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++) for (i = 0; i < MAX_DYNAMIC_CHANNELS; i++)
{ {
@ -534,7 +534,7 @@ void S_StopSound (int entnum, int entchannel)
void S_StopAllSounds (bool clear) void S_StopAllSounds (bool clear)
{ {
int i; int32_t i;
if (!sound_started) if (!sound_started)
return; return;
@ -560,7 +560,7 @@ static void S_StopAllSoundsC (void)
void S_ClearBuffer (void) void S_ClearBuffer (void)
{ {
int clear; int32_t clear;
if (!sound_started || !shm) if (!sound_started || !shm)
return; return;
@ -616,7 +616,7 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation)
ss->sfx = sfx; ss->sfx = sfx;
VectorCopy (origin, ss->origin); 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->dist_mult = (attenuation / 64) / sound_nominal_clip_dist;
ss->end = paintedtime + sc->length; ss->end = paintedtime + sc->length;
@ -634,7 +634,7 @@ S_UpdateAmbientSounds
static void S_UpdateAmbientSounds (void) static void S_UpdateAmbientSounds (void)
{ {
mleaf_t *l; mleaf_t *l;
int vol, ambient_channel; int32_t vol, ambient_channel;
channel_t *chan; channel_t *chan;
// no ambients when disconnected // no ambients when disconnected
@ -657,20 +657,20 @@ static void S_UpdateAmbientSounds (void)
chan = &snd_channels[ambient_channel]; chan = &snd_channels[ambient_channel];
chan->sfx = ambient_sfx[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) if (vol < 8)
vol = 0; vol = 0;
// don't adjust volume too fast // don't adjust volume too fast
if (chan->master_vol < vol) 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) if (chan->master_vol > vol)
chan->master_vol = vol; chan->master_vol = vol;
} }
else if (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) if (chan->master_vol < vol)
chan->master_vol = vol; chan->master_vol = vol;
} }
@ -690,18 +690,18 @@ Expects data in signed 16 bit, or unsigned
8 bit format. 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; int32_t i;
int src, dst; int32_t src, dst;
float scale; float scale;
int intVolume; int32_t intVolume;
if (s_rawend < paintedtime) if (s_rawend < paintedtime)
s_rawend = paintedtime; s_rawend = paintedtime;
scale = (float) rate / shm->speed; scale = (float) rate / shm->speed;
intVolume = (int) (256 * volume); intVolume = (int32_t) (256 * volume);
if (channels == 2 && width == 2) 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) void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up)
{ {
int i, j; int32_t i, j;
int total; int32_t total;
channel_t *ch; channel_t *ch;
channel_t *combine; 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) static void GetSoundtime (void)
{ {
int samplepos; int32_t samplepos;
static int buffers; static int32_t buffers;
static int oldsamplepos; static int32_t oldsamplepos;
int fullsamples; int32_t fullsamples;
fullsamples = shm->samples / shm->channels; fullsamples = shm->samples / shm->channels;
@ -905,7 +905,7 @@ void S_ExtraUpdate (void)
static void S_Update_ (void) static void S_Update_ (void)
{ {
uint32_t endtime; uint32_t endtime;
int samps; int32_t samps;
if (!sound_started || (snd_blocked > 0)) if (!sound_started || (snd_blocked > 0))
return; return;
@ -970,8 +970,8 @@ console functions
static void S_Play (void) static void S_Play (void)
{ {
static int hash = 345; static int32_t hash = 345;
int i; int32_t i;
char name[256]; char name[256];
sfx_t *sfx; sfx_t *sfx;
@ -991,8 +991,8 @@ static void S_Play (void)
static void S_PlayVol (void) static void S_PlayVol (void)
{ {
static int hash = 543; static int32_t hash = 543;
int i; int32_t i;
float vol; float vol;
char name[256]; char name[256];
sfx_t *sfx; sfx_t *sfx;
@ -1014,10 +1014,10 @@ static void S_PlayVol (void)
static void S_SoundList (void) static void S_SoundList (void)
{ {
int i; int32_t i;
sfx_t *sfx; sfx_t *sfx;
sfxcache_t *sc; sfxcache_t *sc;
int size, total; int32_t size, total;
total = 0; total = 0;
for (sfx = known_sfx, i = 0; i < num_sfx; i++, sfx++) for (sfx = known_sfx, i = 0; i < num_sfx; i++, sfx++)

View File

@ -72,7 +72,7 @@ typedef struct {
fshandle_t *file; fshandle_t *file;
snd_info_t *info; snd_info_t *info;
byte *buffer; byte *buffer;
int size, pos, error; int32_t size, pos, error;
} flacfile_t; } flacfile_t;
/* CALLBACK FUNCTIONS: */ /* CALLBACK FUNCTIONS: */
@ -244,7 +244,7 @@ static void S_FLAC_CodecShutdown (void)
static bool S_FLAC_CodecOpenStream (snd_stream_t *stream) static bool S_FLAC_CodecOpenStream (snd_stream_t *stream)
{ {
flacfile_t *ff; flacfile_t *ff;
int rc; int32_t rc;
ff = (flacfile_t *) Z_Malloc(sizeof(flacfile_t)); ff = (flacfile_t *) Z_Malloc(sizeof(flacfile_t));
@ -327,14 +327,14 @@ _fail:
return false; 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; flacfile_t *ff = (flacfile_t *) stream->priv;
byte *buf = (byte *) buffer; byte *buf = (byte *) buffer;
int count = 0; int32_t count = 0;
while (len) { while (len) {
int res = 0; int32_t res = 0;
if (ff->size == ff->pos) if (ff->size == ff->pos)
FLAC__stream_decoder_process_single (ff->decoder); FLAC__stream_decoder_process_single (ff->decoder);
if (ff->error) return -1; if (ff->error) return -1;
@ -371,7 +371,7 @@ static void S_FLAC_CodecCloseStream (snd_stream_t *stream)
S_CodecUtilClose(&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; flacfile_t *ff = (flacfile_t *) stream->priv;

View File

@ -27,13 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
ResampleSfx 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; int32_t outcount;
int srcsample; int32_t srcsample;
float stepscale; float stepscale;
int i; int32_t i;
int sample, samplefrac, fracstep; int32_t sample, samplefrac, fracstep;
sfxcache_t *sc; sfxcache_t *sc;
sc = (sfxcache_t *) Cache_Check (&sfx->cache); 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 // fast special case
for (i = 0; i < outcount; i++) 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 else
{ {
@ -74,7 +74,7 @@ static void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data)
if (inwidth == 2) if (inwidth == 2)
sample = LittleShort ( ((int16_t *)data)[srcsample] ); sample = LittleShort ( ((int16_t *)data)[srcsample] );
else else
sample = (int)( (uint8_t)(data[srcsample]) - 128) << 8; sample = (int32_t)( (uint8_t)(data[srcsample]) - 128) << 8;
if (sc->width == 2) if (sc->width == 2)
((int16_t *)sc->data)[i] = sample; ((int16_t *)sc->data)[i] = sample;
else else
@ -95,7 +95,7 @@ sfxcache_t *S_LoadSound (sfx_t *s)
char namebuffer[256]; char namebuffer[256];
byte *data; byte *data;
wavinfo_t info; wavinfo_t info;
int len; int32_t len;
float stepscale; float stepscale;
sfxcache_t *sc; sfxcache_t *sc;
byte stackbuf[1*1024]; // avoid dirtying the cache heap byte stackbuf[1*1024]; // avoid dirtying the cache heap
@ -105,7 +105,7 @@ sfxcache_t *S_LoadSound (sfx_t *s)
if (sc) if (sc)
return sc; return sc;
// Con_Printf ("S_LoadSound: %x\n", (int)stackbuf); // Con_Printf ("S_LoadSound: %x\n", (int32_t)stackbuf);
// load it in // load it in
q_strlcpy(namebuffer, "sound/", sizeof(namebuffer)); q_strlcpy(namebuffer, "sound/", sizeof(namebuffer));
@ -174,7 +174,7 @@ static byte *data_p;
static byte *iff_end; static byte *iff_end;
static byte *last_chunk; static byte *last_chunk;
static byte *iff_data; static byte *iff_data;
static int iff_chunk_len; static int32_t iff_chunk_len;
static int16_t GetLittleShort (void) static int16_t GetLittleShort (void)
{ {
@ -185,9 +185,9 @@ static int16_t GetLittleShort (void)
return val; return val;
} }
static int GetLittleLong (void) static int32_t GetLittleLong (void)
{ {
int val = 0; int32_t val = 0;
val = *data_p; val = *data_p;
val = val + (*(data_p+1)<<8); val = val + (*(data_p+1)<<8);
val = val + (*(data_p+2)<<16); val = val + (*(data_p+2)<<16);
@ -240,7 +240,7 @@ static void DumpChunks (void)
memcpy (str, data_p, 4); memcpy (str, data_p, 4);
data_p += 4; data_p += 4;
iff_chunk_len = GetLittleLong(); 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; data_p += (iff_chunk_len + 1) & ~1;
} while (data_p < iff_end); } while (data_p < iff_end);
} }
@ -251,12 +251,12 @@ static void DumpChunks (void)
GetWavinfo 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; wavinfo_t info;
int i; int32_t i;
int format; int32_t format;
int samples; int32_t samples;
memset (&info, 0, sizeof(info)); memset (&info, 0, sizeof(info));

View File

@ -53,7 +53,7 @@ typedef struct _mik_priv {
MODULE *module; MODULE *module;
} mik_priv_t; } 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); 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); 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); return FS_fgetc(((mik_priv_t *)r)->fh);
} }
@ -165,11 +165,11 @@ static bool S_MIKMOD_CodecOpenStream (snd_stream_t *stream)
return true; 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()) if (!Player_Active())
return 0; 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) 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); 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); Player_SetPosition (0);
return 0; return 0;

View File

@ -25,16 +25,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PAINTBUFFER_SIZE 2048 #define PAINTBUFFER_SIZE 2048
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE]; portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
int snd_scaletable[32][256]; int32_t snd_scaletable[32][256];
int *snd_p, snd_linear_count; int32_t *snd_p, snd_linear_count;
int16_t *snd_out; int16_t *snd_out;
static int snd_vol; static int32_t snd_vol;
static void Snd_WriteLinearBlastStereo16 (void) static void Snd_WriteLinearBlastStereo16 (void)
{ {
int i; int32_t i;
int val; int32_t val;
for (i = 0; i < snd_linear_count; i += 2) 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; int32_t lpos;
int lpaintedtime; int32_t lpaintedtime;
snd_p = (int *) paintbuffer; snd_p = (int32_t *) paintbuffer;
lpaintedtime = paintedtime; lpaintedtime = paintedtime;
while (lpaintedtime < endtime) 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; int32_t out_idx, out_mask;
int count, step, val; int32_t count, step, val;
int *p; int32_t *p;
if (shm->samplebits == 16 && shm->channels == 2) if (shm->samplebits == 16 && shm->channels == 2)
{ {
@ -97,7 +97,7 @@ static void S_TransferPaintBuffer (int endtime)
return; return;
} }
p = (int *) paintbuffer; p = (int32_t *) paintbuffer;
count = (endtime - paintedtime) * shm->channels; count = (endtime - paintedtime) * shm->channels;
out_mask = shm->samples - 1; out_mask = shm->samples - 1;
out_idx = paintedtime * shm->channels & out_mask; 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 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++) for (i = 0; i <= M; i++)
{ {
if (i == M/2) if (i == M/2)
@ -197,13 +197,13 @@ static void S_MakeBlackmanWindowKernel(float *kernel, int M, float f_c)
typedef struct { typedef struct {
float *memory; // kernelsize floats float *memory; // kernelsize floats
float *kernel; // kernelsize floats float *kernel; // kernelsize floats
int kernelsize; // M+1, rounded up to be a multiple of 16 int32_t kernelsize; // M+1, rounded up to be a multiple of 16
int M; // M value used to make kernel, even int32_t M; // M value used to make kernel, even
int parity; // 0-3 int32_t parity; // 0-3
float f_c; // cutoff frequency, [0..1], fraction of sample rate float f_c; // cutoff frequency, [0..1], fraction of sample rate
} filter_t; } 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) 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. 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; float *input;
const int kernelsize = filter->kernelsize; const int32_t kernelsize = filter->kernelsize;
const float *kernel = filter->kernel; const float *kernel = filter->kernel;
int parity; int32_t parity;
input = (float *) malloc(sizeof(float) * (filter->kernelsize + count)); 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 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) filter_t *memory)
{ {
int M; int32_t M;
float bw, f_c; float bw, f_c;
switch ((int)snd_filterquality.value) switch ((int32_t)snd_filterquality.value)
{ {
case 1: case 1:
M = 126; bw = 0.900; break; 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_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int32_t endtime, int32_t paintbufferstart);
static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int endtime, int 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; int32_t i;
int end, ltime, count; int32_t end, ltime, count;
channel_t *ch; channel_t *ch;
sfxcache_t *sc; sfxcache_t *sc;
@ -415,15 +415,15 @@ void S_PaintChannels (int endtime)
if (sndspeed.value == 11025 && shm->speed == 44100) if (sndspeed.value == 11025 && shm->speed == 44100)
{ {
static filter_t memory_l, memory_r; static filter_t memory_l, memory_r;
S_LowpassFilter((int *)paintbuffer, 2, end - paintedtime, &memory_l); S_LowpassFilter((int32_t *)paintbuffer, 2, end - paintedtime, &memory_l);
S_LowpassFilter(((int *)paintbuffer) + 1, 2, end - paintedtime, &memory_r); S_LowpassFilter(((int32_t *)paintbuffer) + 1, 2, end - paintedtime, &memory_r);
} }
// paint in the music // paint in the music
if (s_rawend >= paintedtime) if (s_rawend >= paintedtime)
{ // copy from the streaming sound source { // copy from the streaming sound source
int s; int32_t s;
int stop; int32_t stop;
stop = (end < s_rawend) ? end : s_rawend; stop = (end < s_rawend) ? end : s_rawend;
@ -448,8 +448,8 @@ void S_PaintChannels (int endtime)
void SND_InitScaletable (void) void SND_InitScaletable (void)
{ {
int i, j; int32_t i, j;
int scale; int32_t scale;
for (i = 0; i < 32; i++) 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; int32_t data;
int *lscale, *rscale; int32_t *lscale, *rscale;
uint8_t *sfx; uint8_t *sfx;
int i; int32_t i;
if (ch->leftvol > 255) if (ch->leftvol > 255)
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; 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; int32_t data;
int left, right; int32_t left, right;
int leftvol, rightvol; int32_t leftvol, rightvol;
int16_t *sfx; int16_t *sfx;
int i; int32_t i;
leftvol = ch->leftvol * snd_vol; leftvol = ch->leftvol * snd_vol;
rightvol = ch->rightvol * snd_vol; rightvol = ch->rightvol * snd_vol;

View File

@ -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 /* 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 * consume it all. Returns -1 if no tag is found. Its up to caller
* to recover. */ * 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; mp3_priv_t *p = (mp3_priv_t *) stream->priv;
int rc = -1; int32_t rc = -1;
size_t remaining; size_t remaining;
size_t tagsize; 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 /* (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 * still exists in the buffer then they are first shifted to be
* front of the stream buffer. */ * 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; mp3_priv_t *p = (mp3_priv_t *) stream->priv;
size_t bytes_read; size_t bytes_read;
@ -209,7 +209,7 @@ static int mp3_inputdata(snd_stream_t *stream)
return 0; 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; mp3_priv_t *p = (mp3_priv_t *) stream->priv;
size_t ReadSize; 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 * If needed, read some more MP3 data, decode them and synth them
* Place in buf[]. * Place in buf[].
* Return number of samples read. */ * 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; mp3_priv_t *p = (mp3_priv_t *) stream->priv;
int donow, i, done = 0; int32_t donow, i, done = 0;
mad_fixed_t sample; mad_fixed_t sample;
int chan, x; int32_t chan, x;
do do
{ {
@ -377,7 +377,7 @@ static int mp3_decode(snd_stream_t *stream, byte *buf, int len)
return done; 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; 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) static bool S_MP3_CodecOpenStream (snd_stream_t *stream)
{ {
int err; int32_t err;
stream->priv = calloc(1, sizeof(mp3_priv_t)); stream->priv = calloc(1, sizeof(mp3_priv_t));
if (!stream->priv) if (!stream->priv)
@ -425,9 +425,9 @@ static bool S_MP3_CodecOpenStream (snd_stream_t *stream)
return false; 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; return res * stream->info.width;
} }
@ -438,12 +438,12 @@ static void S_MP3_CodecCloseStream (snd_stream_t *stream)
S_CodecUtilClose(&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; mp3_priv_t *p = (mp3_priv_t *) stream->priv;
size_t initial_bitrate = p->frame.header.bitrate; size_t initial_bitrate = p->frame.header.bitrate;
size_t tagsize = 0, consumed = 0; size_t tagsize = 0, consumed = 0;
int vbr = 0; /* Variable Bit Rate, bool */ int32_t vbr = 0; /* Variable Bit Rate, bool */
bool depadded = false; bool depadded = false;
/* Reset all */ /* Reset all */
@ -462,7 +462,7 @@ static int S_MP3_CodecRewindStream (snd_stream_t *stream)
while (1) /* Read data from the MP3 file */ 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; size_t leftover = p->stream.bufend - p->stream.next_frame;
memcpy(p->mp3_buffer, p->stream.this_frame, leftover); memcpy(p->mp3_buffer, p->stream.this_frame, leftover);

View File

@ -36,7 +36,7 @@
/* Private data */ /* Private data */
typedef struct _mp3_priv_t typedef struct _mp3_priv_t
{ {
int handle_newed, handle_opened; int32_t handle_newed, handle_opened;
mpg123_handle* handle; mpg123_handle* handle;
} mp3_priv_t; } mp3_priv_t;
@ -53,7 +53,7 @@ static ssize_t mp3_read (void *f, void *buf, size_t size)
return ret; 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 (f == NULL) return (-1);
if (FS_fseek((fshandle_t *)f, (long) offset, whence) < 0) 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) static bool S_MP3_CodecOpenStream (snd_stream_t *stream)
{ {
long rate = 0; long rate = 0;
int encoding = 0, channels = 0; int32_t encoding = 0, channels = 0;
mp3_priv_t *priv = NULL; mp3_priv_t *priv = NULL;
stream->priv = Z_Malloc(sizeof(mp3_priv_t)); stream->priv = Z_Malloc(sizeof(mp3_priv_t));
@ -176,17 +176,17 @@ _fail:
return false; 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; mp3_priv_t *priv = (mp3_priv_t *) stream->priv;
size_t bytes_read = 0; 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) switch (res)
{ {
case MPG123_DONE: case MPG123_DONE:
Con_DPrintf("mp3 EOF\n"); Con_DPrintf("mp3 EOF\n");
case MPG123_OK: case MPG123_OK:
return (int)bytes_read; return (int32_t)bytes_read;
} }
return -1; /* error */ return -1; /* error */
} }
@ -200,7 +200,7 @@ static void S_MP3_CodecCloseStream (snd_stream_t *stream)
S_CodecUtilClose(&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; mp3_priv_t *priv = (mp3_priv_t *) stream->priv;
off_t res = mpg123_seek(priv->handle, 0, SEEK_SET); off_t res = mpg123_seek(priv->handle, 0, SEEK_SET);

View File

@ -34,15 +34,15 @@
/* CALLBACK FUNCTIONS: */ /* CALLBACK FUNCTIONS: */
static int opc_fclose (void *f) static int32_t opc_fclose (void *f)
{ {
(void)f; (void)f;
return 0; /* we fclose() elsewhere. */ 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) if (size < 0)
{ {
@ -50,13 +50,13 @@ static int opc_fread (void *f, uint8_t *buf, int size)
return -1; 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) if (ret == 0 && errno != 0)
ret = -1; ret = -1;
return ret; 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); if (f == NULL) return (-1);
return FS_fseek((fshandle_t *)f, (long) off, whence); 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 = static const OpusFileCallbacks opc_qfs =
{ {
(int (*)(void *, uint8_t *, int)) opc_fread, (int32_t (*)(void *, uint8_t *, int32_t)) opc_fread,
(int (*)(void *, opus_int64, int)) opc_fseek, (int32_t (*)(void *, opus_int64, int32_t)) opc_fseek,
(opus_int64 (*)(void *)) opc_ftell, (opus_int64 (*)(void *)) opc_ftell,
(int (*)(void *)) opc_fclose (int32_t (*)(void *)) opc_fclose
}; };
static bool S_OPUS_CodecInitialize (void) static bool S_OPUS_CodecInitialize (void)
@ -89,7 +89,7 @@ static bool S_OPUS_CodecOpenStream (snd_stream_t *stream)
OggOpusFile *opFile; OggOpusFile *opFile;
const OpusHead *op_info; const OpusHead *op_info;
long numstreams; long numstreams;
int res; int32_t res;
opFile = op_open_callbacks(&stream->fh, &opc_qfs, NULL, 0, &res); opFile = op_open_callbacks(&stream->fh, &opc_qfs, NULL, 0, &res);
if (!opFile) if (!opFile)
@ -147,10 +147,10 @@ _fail:
return false; 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 */ int32_t section; /* FIXME: handle section changes */
int cnt, res, rem; int32_t cnt, res, rem;
opus_int16 * ptr; opus_int16 * ptr;
rem = bytes / stream->info.width; rem = bytes / stream->info.width;
@ -188,7 +188,7 @@ static void S_OPUS_CodecCloseStream (snd_stream_t *stream)
S_CodecUtilClose(&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); return op_pcm_seek ((OggOpusFile *)stream->priv, 0);
} }

View File

@ -26,13 +26,13 @@
#include <SDL.h> #include <SDL.h>
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; int32_t pos, tobufend;
int len1, len2; int32_t len1, len2;
(void)unused; (void)unused;
@ -75,7 +75,7 @@ static void SDLCALL paint_audio (void *unused, Uint8 *stream, int len)
bool SNDDMA_Init (dma_t *dma) bool SNDDMA_Init (dma_t *dma)
{ {
SDL_AudioSpec desired, obtained; SDL_AudioSpec desired, obtained;
int tmp, val; int32_t tmp, val;
char drivername[128]; char drivername[128];
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
@ -174,7 +174,7 @@ bool SNDDMA_Init (dma_t *dma)
return true; return true;
} }
int SNDDMA_GetDMAPos (void) int32_t SNDDMA_GetDMAPos (void)
{ {
return shm->samplepos; return shm->samplepos;
} }

View File

@ -85,10 +85,10 @@ static const char *mustype[] = {
* also see Unreal Wiki: * also see Unreal Wiki:
* http://wiki.beyondunreal.com/Legacy:Package_File_Format/Data_Details * 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; int32_t a;
int size; int32_t size;
size = 1; size = 1;
a = in[0] & 0x3f; a = in[0] & 0x3f;
@ -121,7 +121,7 @@ static fci_t get_fci (const char *in, int *pos)
return a; 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]; char sig[16];
_retry: _retry:
@ -177,11 +177,11 @@ _retry:
return -1; 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) int32_t *ofs, int32_t *objsize)
{ {
char buf[40]; char buf[40];
int idx = 0, t; int32_t idx = 0, t;
FS_fseek(f, *ofs, SEEK_SET); FS_fseek(f, *ofs, SEEK_SET);
if (FS_fread(buf, 4, 10, f) < 10) 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 */ return t; /* return type_name index */
} }
static int read_typname(fshandle_t *f, const struct upkg_hdr *hdr, static int32_t read_typname(fshandle_t *f, const struct upkg_hdr *hdr,
int idx, char *out) int32_t idx, char *out)
{ {
int i, s; int32_t i, s;
long l; long l;
char buf[64]; char buf[64];
@ -224,10 +224,10 @@ static int read_typname(fshandle_t *f, const struct upkg_hdr *hdr,
return 0; 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) int32_t *ofs, int32_t *objsize)
{ {
int i, idx, t; int32_t i, idx, t;
int32_t s, pos; int32_t s, pos;
long fsiz; long fsiz;
char buf[64]; char buf[64];
@ -278,7 +278,7 @@ static int32_t probe_header (void *header)
struct upkg_hdr *hdr; struct upkg_hdr *hdr;
uint8_t *p; uint8_t *p;
uint32_t *swp; uint32_t *swp;
int i; int32_t i;
/* byte swap the header - all members are 32 bit LE values */ /* byte swap the header - all members are 32 bit LE values */
p = (uint8_t *) header; p = (uint8_t *) header;
@ -322,7 +322,7 @@ static int32_t probe_header (void *header)
return -1; 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]; char header[UPKG_HDR_SIZE];
@ -345,7 +345,7 @@ static void S_UMX_CodecShutdown (void)
static bool S_UMX_CodecOpenStream (snd_stream_t *stream) static bool S_UMX_CodecOpenStream (snd_stream_t *stream)
{ {
int type; int32_t type;
int32_t ofs = 0, size = 0; int32_t ofs = 0, size = 0;
type = process_upkg(&stream->fh, &ofs, &size); type = process_upkg(&stream->fh, &ofs, &size);
@ -373,7 +373,7 @@ static bool S_UMX_CodecOpenStream (snd_stream_t *stream)
return false; 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; (void)stream, (void)bytes, (void)buffer;
return -1; return -1;
@ -384,7 +384,7 @@ static void S_UMX_CodecCloseStream (snd_stream_t *stream)
S_CodecUtilClose(&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; (void)stream;
return -1; return -1;

View File

@ -45,13 +45,13 @@
/* CALLBACK FUNCTIONS: */ /* CALLBACK FUNCTIONS: */
static int ovc_fclose (void *f) static int32_t ovc_fclose (void *f)
{ {
(void)f; (void)f;
return 0; /* we fclose() elsewhere. */ 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); if (f == NULL) return (-1);
return FS_fseek((fshandle_t *)f, (long) off, whence); 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 = static ov_callbacks ovc_qfs =
{ {
(size_t (*)(void *, size_t, size_t, void *)) FS_fread, (size_t (*)(void *, size_t, size_t, void *)) FS_fread,
(int (*)(void *, ogg_int64_t, int)) ovc_fseek, (int32_t (*)(void *, ogg_int64_t, int32_t)) ovc_fseek,
(int (*)(void *)) ovc_fclose, (int32_t (*)(void *)) ovc_fclose,
(long (*)(void *)) FS_ftell (long (*)(void *)) FS_ftell
}; };
@ -79,7 +79,7 @@ static bool S_VORBIS_CodecOpenStream (snd_stream_t *stream)
OggVorbis_File *ovFile; OggVorbis_File *ovFile;
vorbis_info *ovf_info; vorbis_info *ovf_info;
long numstreams; long numstreams;
int res; int32_t res;
ovFile = (OggVorbis_File *) Z_Malloc(sizeof(OggVorbis_File)); ovFile = (OggVorbis_File *) Z_Malloc(sizeof(OggVorbis_File));
stream->priv = ovFile; stream->priv = ovFile;
@ -133,10 +133,10 @@ _fail:
return false; 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 */ int32_t section; /* FIXME: handle section changes */
int cnt, res, rem; int32_t cnt, res, rem;
char * ptr; char * ptr;
cnt = 0; rem = bytes; cnt = 0; rem = bytes;
@ -178,7 +178,7 @@ static void S_VORBIS_CodecCloseStream (snd_stream_t *stream)
S_CodecUtilClose(&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 /* for libvorbisfile, the ov_time_seek() position argument
* is seconds as doubles, whereas for Tremor libvorbisidec * is seconds as doubles, whereas for Tremor libvorbisidec

View File

@ -73,13 +73,13 @@ typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
// TODO: shorten these? // TODO: shorten these?
typedef struct { typedef struct {
int ident; int32_t ident;
int version; int32_t version;
int type; int32_t type;
float boundingradius; float boundingradius;
int width; int32_t width;
int height; int32_t height;
int numframes; int32_t numframes;
float beamlength; float beamlength;
synctype_t synctype; synctype_t synctype;
} dsprite_t; } dsprite_t;
@ -91,13 +91,13 @@ typedef struct {
#define SPR_VP_PARALLEL_ORIENTED 4 #define SPR_VP_PARALLEL_ORIENTED 4
typedef struct { typedef struct {
int origin[2]; int32_t origin[2];
int width; int32_t width;
int height; int32_t height;
} dspriteframe_t; } dspriteframe_t;
typedef struct { typedef struct {
int numframes; int32_t numframes;
} dspritegroup_t; } dspritegroup_t;
typedef struct { typedef struct {

Some files were not shown because too many files have changed in this diff Show More