Compare commits
7 Commits
5d5dc61d1b
...
00a944ce24
Author | SHA1 | Date |
---|---|---|
an | 00a944ce24 | |
an | 5368518173 | |
an | 866148d531 | |
an | 33ea8d7496 | |
an | 0f96a959d3 | |
an | 16e7b4373d | |
an | 3a9d2a8db0 |
|
@ -29,10 +29,10 @@
|
|||
|
||||
#define MUSIC_DIRNAME "music"
|
||||
|
||||
qboolean bgmloop;
|
||||
bool bgmloop;
|
||||
cvar_t bgm_extmusic = {"bgm_extmusic", "1", CVAR_ARCHIVE};
|
||||
|
||||
static qboolean no_extmusic= false;
|
||||
static bool no_extmusic= false;
|
||||
static float old_volume = -1.0f;
|
||||
|
||||
typedef enum _bgm_player
|
||||
|
@ -46,7 +46,7 @@ typedef struct music_handler_s
|
|||
{
|
||||
uint32_t type; /* 1U << n (see snd_codec.h) */
|
||||
bgm_player_t player; /* Enumerated bgm player type */
|
||||
int is_available; /* -1 means not present */
|
||||
int32_t is_available; /* -1 means not present */
|
||||
const char *ext; /* Expected file extension */
|
||||
const char *dir; /* Where to look for music file */
|
||||
struct music_handler_s *next;
|
||||
|
@ -123,10 +123,10 @@ static void BGM_Stop_f (void)
|
|||
BGM_Stop();
|
||||
}
|
||||
|
||||
qboolean BGM_Init (void)
|
||||
bool BGM_Init (void)
|
||||
{
|
||||
music_handler_t *handlers = NULL;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
Cvar_RegisterVariable(&bgm_extmusic);
|
||||
Cmd_AddCommand("music", BGM_Play_f);
|
||||
|
@ -278,7 +278,7 @@ void BGM_Play (const char *filename)
|
|||
Con_Printf("Couldn't handle music file %s\n", filename);
|
||||
}
|
||||
|
||||
void BGM_PlayCDtrack (byte track, qboolean looping)
|
||||
void BGM_PlayCDtrack (byte track, bool looping)
|
||||
{
|
||||
/* instead of searching by the order of music_handlers, do so by
|
||||
* the order of searchpath priority: the file from the searchpath
|
||||
|
@ -312,8 +312,8 @@ void BGM_PlayCDtrack (byte track, qboolean looping)
|
|||
goto _next;
|
||||
if (! CDRIPTYPE(handler->type))
|
||||
goto _next;
|
||||
q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s",
|
||||
MUSIC_DIRNAME, (int)track, handler->ext);
|
||||
q_snprintf(tmp, sizeof(tmp), "%s/track%02" PRIi32 ".%s",
|
||||
MUSIC_DIRNAME, (int32_t)track, handler->ext);
|
||||
if (! COM_FileExists(tmp, &path_id))
|
||||
goto _next;
|
||||
if (path_id > prev_id)
|
||||
|
@ -326,11 +326,11 @@ void BGM_PlayCDtrack (byte track, qboolean looping)
|
|||
handler = handler->next;
|
||||
}
|
||||
if (ext == NULL)
|
||||
Con_Printf("Couldn't find a cdrip for track %d\n", (int)track);
|
||||
Con_Printf("Couldn't find a cdrip for track %" PRIi32 "\n", (int32_t)track);
|
||||
else
|
||||
{
|
||||
q_snprintf(tmp, sizeof(tmp), "%s/track%02d.%s",
|
||||
MUSIC_DIRNAME, (int)track, ext);
|
||||
q_snprintf(tmp, sizeof(tmp), "%s/track%02" PRIi32 ".%s",
|
||||
MUSIC_DIRNAME, (int32_t)track, ext);
|
||||
bgmstream = S_CodecOpenStreamType(tmp, type);
|
||||
if (! bgmstream)
|
||||
Con_Printf("Couldn't handle music file %s\n", tmp);
|
||||
|
@ -371,11 +371,11 @@ void BGM_Resume (void)
|
|||
|
||||
static void BGM_UpdateStream (void)
|
||||
{
|
||||
qboolean did_rewind = false;
|
||||
int res; /* Number of bytes read. */
|
||||
int bufferSamples;
|
||||
int fileSamples;
|
||||
int fileBytes;
|
||||
bool did_rewind = false;
|
||||
int32_t res; /* Number of bytes read. */
|
||||
int32_t bufferSamples;
|
||||
int32_t fileSamples;
|
||||
int32_t fileBytes;
|
||||
byte raw[16384];
|
||||
|
||||
if (bgmstream->status != STREAM_PLAY)
|
||||
|
@ -400,9 +400,9 @@ static void BGM_UpdateStream (void)
|
|||
|
||||
/* our max buffer size */
|
||||
fileBytes = fileSamples * (bgmstream->info.width * bgmstream->info.channels);
|
||||
if (fileBytes > (int) sizeof(raw))
|
||||
if (fileBytes > (int32_t) sizeof(raw))
|
||||
{
|
||||
fileBytes = (int) sizeof(raw);
|
||||
fileBytes = (int32_t) sizeof(raw);
|
||||
fileSamples = fileBytes /
|
||||
(bgmstream->info.width * bgmstream->info.channels);
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ static void BGM_UpdateStream (void)
|
|||
res = S_CodecRewindStream(bgmstream);
|
||||
if (res != 0)
|
||||
{
|
||||
Con_Printf("Stream seek error (%i), stopping.\n", res);
|
||||
Con_Printf("Stream seek error (%" PRIi32 "), stopping.\n", res);
|
||||
BGM_Stop();
|
||||
return;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ static void BGM_UpdateStream (void)
|
|||
}
|
||||
else /* res < 0: some read error */
|
||||
{
|
||||
Con_Printf("Stream read error (%i), stopping.\n", res);
|
||||
Con_Printf("Stream read error (%" PRIi32 "), stopping.\n", res);
|
||||
BGM_Stop();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
#ifndef _BGMUSIC_H_
|
||||
#define _BGMUSIC_H_
|
||||
|
||||
extern qboolean bgmloop;
|
||||
extern bool bgmloop;
|
||||
extern cvar_t bgm_extmusic;
|
||||
|
||||
qboolean BGM_Init (void);
|
||||
bool BGM_Init (void);
|
||||
void BGM_Shutdown (void);
|
||||
|
||||
void BGM_Play (const char *filename);
|
||||
|
@ -37,7 +37,7 @@ void BGM_Update (void);
|
|||
void BGM_Pause (void);
|
||||
void BGM_Resume (void);
|
||||
|
||||
void BGM_PlayCDtrack (byte track, qboolean looping);
|
||||
void BGM_PlayCDtrack (byte track, bool looping);
|
||||
|
||||
#endif /* _BGMUSIC_H_ */
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int fileofs, filelen;
|
||||
int32_t fileofs, filelen;
|
||||
} lump_t;
|
||||
|
||||
#define LUMP_ENTITIES 0
|
||||
|
@ -95,21 +95,21 @@ typedef struct
|
|||
{
|
||||
float mins[3], maxs[3];
|
||||
float origin[3];
|
||||
int headnode[MAX_MAP_HULLS];
|
||||
int visleafs; // not including the solid leaf 0
|
||||
int firstface, numfaces;
|
||||
int32_t headnode[MAX_MAP_HULLS];
|
||||
int32_t visleafs; // not including the solid leaf 0
|
||||
int32_t firstface, numfaces;
|
||||
} dmodel_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version;
|
||||
int32_t version;
|
||||
lump_t lumps[HEADER_LUMPS];
|
||||
} dheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nummiptex;
|
||||
int dataofs[4]; // [nummiptex]
|
||||
int32_t nummiptex;
|
||||
int32_t dataofs[4]; // [nummiptex]
|
||||
} dmiptexlump_t;
|
||||
|
||||
#define MIPLEVELS 4
|
||||
|
@ -141,7 +141,7 @@ typedef struct
|
|||
{
|
||||
float normal[3];
|
||||
float dist;
|
||||
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
|
||||
int32_t type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
|
||||
} dplane_t;
|
||||
|
||||
|
||||
|
@ -165,7 +165,7 @@ typedef struct
|
|||
// !!! if this is changed, it must be changed in asm_i386.h too !!!
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int32_t planenum;
|
||||
int16_t children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
int16_t mins[3]; // for sphere culling
|
||||
int16_t maxs[3];
|
||||
|
@ -175,8 +175,8 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
int32_t planenum;
|
||||
int32_t children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
int16_t mins[3]; // for sphere culling
|
||||
int16_t maxs[3];
|
||||
uint32_t firstface;
|
||||
|
@ -185,8 +185,8 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
int32_t planenum;
|
||||
int32_t children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
float mins[3]; // for sphere culling
|
||||
float maxs[3];
|
||||
uint32_t firstface;
|
||||
|
@ -195,22 +195,22 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int32_t planenum;
|
||||
int16_t children[2]; // negative numbers are contents
|
||||
} dsclipnode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int children[2]; // negative numbers are contents
|
||||
int32_t planenum;
|
||||
int32_t children[2]; // negative numbers are contents
|
||||
} dlclipnode_t;
|
||||
|
||||
|
||||
typedef struct texinfo_s
|
||||
{
|
||||
float vecs[2][4]; // [s/t][xyz offset]
|
||||
int miptex;
|
||||
int flags;
|
||||
int32_t miptex;
|
||||
int32_t flags;
|
||||
} texinfo_t;
|
||||
#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
|
||||
#define TEX_MISSING 2 // johnfitz -- this texinfo does not have a texture
|
||||
|
@ -233,27 +233,27 @@ typedef struct
|
|||
int16_t planenum;
|
||||
int16_t side;
|
||||
|
||||
int firstedge; // we must support > 64k edges
|
||||
int32_t firstedge; // we must support > 64k edges
|
||||
int16_t numedges;
|
||||
int16_t texinfo;
|
||||
|
||||
// lighting info
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
int32_t lightofs; // start of [numstyles*surfsize] samples
|
||||
} dsface_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int side;
|
||||
int32_t planenum;
|
||||
int32_t side;
|
||||
|
||||
int firstedge; // we must support > 64k edges
|
||||
int numedges;
|
||||
int texinfo;
|
||||
int32_t firstedge; // we must support > 64k edges
|
||||
int32_t numedges;
|
||||
int32_t texinfo;
|
||||
|
||||
// lighting info
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
int32_t lightofs; // start of [numstyles*surfsize] samples
|
||||
} dlface_t;
|
||||
|
||||
#define AMBIENT_WATER 0
|
||||
|
@ -267,8 +267,8 @@ typedef struct
|
|||
// all other leafs need visibility info
|
||||
typedef struct
|
||||
{
|
||||
int contents;
|
||||
int visofs; // -1 = no visibility info
|
||||
int32_t contents;
|
||||
int32_t visofs; // -1 = no visibility info
|
||||
|
||||
int16_t mins[3]; // for frustum culling
|
||||
int16_t maxs[3];
|
||||
|
@ -281,8 +281,8 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int contents;
|
||||
int visofs; // -1 = no visibility info
|
||||
int32_t contents;
|
||||
int32_t visofs; // -1 = no visibility info
|
||||
|
||||
int16_t mins[3]; // for frustum culling
|
||||
int16_t maxs[3];
|
||||
|
@ -295,8 +295,8 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int contents;
|
||||
int visofs; // -1 = no visibility info
|
||||
int32_t contents;
|
||||
int32_t visofs; // -1 = no visibility info
|
||||
|
||||
float mins[3]; // for frustum culling
|
||||
float maxs[3];
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
int CDAudio_Play(byte track, qboolean looping)
|
||||
int32_t CDAudio_Play(byte track, bool looping)
|
||||
{
|
||||
(void)track, (void)looping;
|
||||
return -1;
|
||||
|
@ -42,7 +42,7 @@ void CDAudio_Update(void)
|
|||
{
|
||||
}
|
||||
|
||||
int CDAudio_Init(void)
|
||||
int32_t CDAudio_Init(void)
|
||||
{
|
||||
Con_Printf("CDAudio disabled at compile time\n");
|
||||
return -1;
|
||||
|
|
|
@ -34,18 +34,18 @@
|
|||
#include "quakedef.h"
|
||||
#include "cdaudio.h"
|
||||
|
||||
static qboolean cdValid = false;
|
||||
static qboolean playing = false;
|
||||
static qboolean wasPlaying = false;
|
||||
static qboolean enabled = true;
|
||||
static qboolean playLooping = false;
|
||||
static bool cdValid = false;
|
||||
static bool playing = false;
|
||||
static bool wasPlaying = false;
|
||||
static bool enabled = true;
|
||||
static bool playLooping = false;
|
||||
static byte remap[100];
|
||||
static byte playTrack;
|
||||
static double endOfTrack = -1.0, pausetime = -1.0;
|
||||
static SDL_CD *cd_handle;
|
||||
static int cd_dev = -1;
|
||||
static int32_t cd_dev = -1;
|
||||
static float old_cdvolume;
|
||||
static qboolean hw_vol_works = true;
|
||||
static bool hw_vol_works = true;
|
||||
|
||||
|
||||
static void CDAudio_Eject(void)
|
||||
|
@ -60,7 +60,7 @@ static void CDAudio_Eject(void)
|
|||
Con_Printf ("Unable to eject CD-ROM: %s\n", SDL_GetError ());
|
||||
}
|
||||
|
||||
static int CDAudio_GetAudioDiskInfo(void)
|
||||
static int32_t CDAudio_GetAudioDiskInfo(void)
|
||||
{
|
||||
cdValid = false;
|
||||
|
||||
|
@ -75,9 +75,9 @@ static int CDAudio_GetAudioDiskInfo(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int CDAudio_Play(byte track, qboolean looping)
|
||||
int32_t CDAudio_Play(byte track, bool looping)
|
||||
{
|
||||
int len_m, len_s, len_f;
|
||||
int32_t len_m, len_s, len_f;
|
||||
|
||||
if (!cd_handle || !enabled)
|
||||
return -1;
|
||||
|
@ -93,13 +93,13 @@ int CDAudio_Play(byte track, qboolean looping)
|
|||
|
||||
if (track < 1 || track > cd_handle->numtracks)
|
||||
{
|
||||
Con_Printf ("CDAudio_Play: Bad track number %d.\n", track);
|
||||
Con_Printf ("CDAudio_Play: Bad track number %" PRIi32 ".\n", track);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cd_handle->track[track-1].type == SDL_DATA_TRACK)
|
||||
{
|
||||
Con_Printf ("CDAudio_Play: track %d is not audio\n", track);
|
||||
Con_Printf ("CDAudio_Play: track %" PRIi32 " is not audio\n", track);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ int CDAudio_Play(byte track, qboolean looping)
|
|||
|
||||
if (SDL_CDPlay(cd_handle, cd_handle->track[track-1].offset, cd_handle->track[track-1].length) < 0)
|
||||
{
|
||||
Con_Printf ("CDAudio_Play: Unable to play track %d: %s\n", track, SDL_GetError ());
|
||||
Con_Printf ("CDAudio_Play: Unable to play track %" PRIi32 ": %s\n", track, SDL_GetError ());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -198,9 +198,9 @@ void CDAudio_Resume(void)
|
|||
pausetime = -1.0;
|
||||
}
|
||||
|
||||
static int get_first_audiotrk (void)
|
||||
static int32_t get_first_audiotrk (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for (i = 0; i < cd_handle->numtracks; ++i)
|
||||
if (cd_handle->track[i].type != SDL_DATA_TRACK)
|
||||
return ++i;
|
||||
|
@ -210,7 +210,7 @@ static int get_first_audiotrk (void)
|
|||
static void CD_f (void)
|
||||
{
|
||||
const char *command;
|
||||
int ret, n;
|
||||
int32_t ret, n;
|
||||
|
||||
if (Cmd_Argc() < 2)
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ static void CD_f (void)
|
|||
{
|
||||
for (n = 1; n < 100; n++)
|
||||
if (remap[n] != n)
|
||||
Con_Printf(" %u -> %u\n", n, remap[n]);
|
||||
Con_Printf(" %" PRIu32 " -> %" PRIu32 "\n", n, remap[n]);
|
||||
return;
|
||||
}
|
||||
for (n = 1; n <= ret; n++)
|
||||
|
@ -317,15 +317,15 @@ static void CD_f (void)
|
|||
|
||||
if (q_strcasecmp(command, "info") == 0)
|
||||
{
|
||||
int current_min, current_sec, current_frame;
|
||||
int length_min, length_sec, length_frame;
|
||||
int32_t current_min, current_sec, current_frame;
|
||||
int32_t length_min, length_sec, length_frame;
|
||||
|
||||
Con_Printf ("%u tracks\n", cd_handle->numtracks);
|
||||
Con_Printf ("%" PRIu32 " tracks\n", cd_handle->numtracks);
|
||||
|
||||
if (playing)
|
||||
Con_Printf("Currently %s track %u\n", playLooping ? "looping" : "playing", playTrack);
|
||||
Con_Printf("Currently %s track %" PRIu32 "\n", playLooping ? "looping" : "playing", playTrack);
|
||||
else if (wasPlaying)
|
||||
Con_Printf("Paused %s track %u\n", playLooping ? "looping" : "playing", playTrack);
|
||||
Con_Printf("Paused %s track %" PRIu32 "\n", playLooping ? "looping" : "playing", playTrack);
|
||||
|
||||
if (playing || wasPlaying)
|
||||
{
|
||||
|
@ -333,7 +333,7 @@ static void CD_f (void)
|
|||
FRAMES_TO_MSF(cd_handle->cur_frame, ¤t_min, ¤t_sec, ¤t_frame);
|
||||
FRAMES_TO_MSF(cd_handle->track[playTrack-1].length, &length_min, &length_sec, &length_frame);
|
||||
|
||||
Con_Printf ("Current position: %d:%02d.%02d (of %d:%02d.%02d)\n",
|
||||
Con_Printf ("Current position: %" PRIi32 ":%02" PRIi32 ".%02" PRIi32 " (of %" PRIi32 ":%02" PRIi32 ".%02" PRIi32 ")\n",
|
||||
current_min, current_sec, current_frame * 60 / CD_FPS,
|
||||
length_min, length_sec, length_frame * 60 / CD_FPS);
|
||||
}
|
||||
|
@ -361,21 +361,21 @@ static void CD_f (void)
|
|||
Con_Printf ("cd: unknown command \"%s\"\n", command);
|
||||
}
|
||||
|
||||
static qboolean CD_GetVolume (void *unused)
|
||||
static bool CD_GetVolume (void *unused)
|
||||
{
|
||||
/* FIXME: write proper code in here when SDL
|
||||
supports cdrom volume control some day. */
|
||||
return false;
|
||||
}
|
||||
|
||||
static qboolean CD_SetVolume (void *unused)
|
||||
static bool CD_SetVolume (void *unused)
|
||||
{
|
||||
/* FIXME: write proper code in here when SDL
|
||||
supports cdrom volume control some day. */
|
||||
return false;
|
||||
}
|
||||
|
||||
static qboolean CDAudio_SetVolume (float value)
|
||||
static bool CDAudio_SetVolume (float value)
|
||||
{
|
||||
if (!cd_handle || !enabled)
|
||||
return false;
|
||||
|
@ -476,7 +476,7 @@ static void export_cddev_arg (void)
|
|||
/* Bad ugly hack to workaround SDL's cdrom device detection.
|
||||
* not needed for windows due to the way SDL_cdrom works. */
|
||||
#if !defined(_WIN32)
|
||||
int i = COM_CheckParm("-cddev");
|
||||
int32_t i = COM_CheckParm("-cddev");
|
||||
if (i != 0 && i < com_argc - 1 && com_argv[i+1][0] != '\0')
|
||||
{
|
||||
static char arg[64];
|
||||
|
@ -486,9 +486,9 @@ static void export_cddev_arg (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
int CDAudio_Init(void)
|
||||
int32_t CDAudio_Init(void)
|
||||
{
|
||||
int i, sdl_num_drives;
|
||||
int32_t i, sdl_num_drives;
|
||||
|
||||
if (safemode || COM_CheckParm("-nocdaudio"))
|
||||
return -1;
|
||||
|
@ -502,7 +502,7 @@ int CDAudio_Init(void)
|
|||
}
|
||||
|
||||
sdl_num_drives = SDL_CDNumDrives ();
|
||||
Con_Printf ("SDL detected %d CD-ROM drive%c\n", sdl_num_drives,
|
||||
Con_Printf ("SDL detected %" PRIi32 " CD-ROM drive%c\n", sdl_num_drives,
|
||||
sdl_num_drives == 1 ? ' ' : 's');
|
||||
|
||||
if (sdl_num_drives < 1)
|
||||
|
|
|
@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef __CDAUDIO_H
|
||||
#define __CDAUDIO_H
|
||||
|
||||
int CDAudio_Init (void);
|
||||
int CDAudio_Play (byte track, qboolean looping);
|
||||
int32_t CDAudio_Init (void);
|
||||
int32_t CDAudio_Play (byte track, bool looping);
|
||||
/* returns 0 for success, -1 for failure. */
|
||||
void CDAudio_Stop (void);
|
||||
void CDAudio_Pause (void);
|
||||
|
|
|
@ -35,10 +35,10 @@ the num_vars argument must be the exact number of strings in the
|
|||
array, otherwise I have nothing against going out of bounds.
|
||||
===================
|
||||
*/
|
||||
void CFG_ReadCvars (const char **vars, int num_vars)
|
||||
void CFG_ReadCvars (const char **vars, int32_t num_vars)
|
||||
{
|
||||
char buff[1024], *tmp;
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
|
||||
if (!cfg_file || num_vars < 1)
|
||||
return;
|
||||
|
@ -118,10 +118,10 @@ values of cvars in the given list. doesn't do anything with
|
|||
the config file.
|
||||
===================
|
||||
*/
|
||||
void CFG_ReadCvarOverrides (const char **vars, int num_vars)
|
||||
void CFG_ReadCvarOverrides (const char **vars, int32_t num_vars)
|
||||
{
|
||||
char buff[64];
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
|
||||
if (num_vars < 1)
|
||||
return;
|
||||
|
@ -150,11 +150,11 @@ void CFG_CloseConfig (void)
|
|||
}
|
||||
}
|
||||
|
||||
int CFG_OpenConfig (const char *cfg_name)
|
||||
int32_t CFG_OpenConfig (const char *cfg_name)
|
||||
{
|
||||
FILE *f;
|
||||
long length;
|
||||
qboolean pak;
|
||||
bool pak;
|
||||
|
||||
CFG_CloseConfig ();
|
||||
|
||||
|
|
|
@ -22,18 +22,18 @@
|
|||
#ifndef __CFGFILE_H
|
||||
#define __CFGFILE_H
|
||||
|
||||
int CFG_OpenConfig (const char *cfg_name);
|
||||
int32_t CFG_OpenConfig (const char *cfg_name);
|
||||
// opens the given config file. only one open config file is
|
||||
// kept: previosly opened one, if any, will be closed.
|
||||
|
||||
void CFG_CloseConfig (void);
|
||||
// closes the currently open config file.
|
||||
|
||||
void CFG_ReadCvars (const char **vars, int num_vars);
|
||||
void CFG_ReadCvars (const char **vars, int32_t num_vars);
|
||||
// reads the values of cvars in the given list from the opened
|
||||
// config file.
|
||||
|
||||
void CFG_ReadCvarOverrides (const char **vars, int num_vars);
|
||||
void CFG_ReadCvarOverrides (const char **vars, int32_t num_vars);
|
||||
// convenience function, reading the "+" command line override
|
||||
// values of cvars in the given list. doesn't do anything with
|
||||
// the config file. call this after CFG_ReadCvars() and before
|
||||
|
|
|
@ -83,7 +83,7 @@ TODO: stay at least 8 units away from all walls in this leaf
|
|||
*/
|
||||
void Chase_UpdateForDrawing (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
vec3_t forward, up, right;
|
||||
vec3_t ideal, crosshair, temp;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ read from the demo file.
|
|||
|
||||
// from ProQuake: space to fill out the demo header for record at any time
|
||||
static byte demo_head[3][MAX_MSGLEN];
|
||||
static int demo_head_size[2];
|
||||
static int32_t demo_head_size[2];
|
||||
|
||||
/*
|
||||
==============
|
||||
|
@ -71,8 +71,8 @@ Dumps the current net message, prefixed by the length and view angles
|
|||
*/
|
||||
static void CL_WriteDemoMessage (void)
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
int32_t len;
|
||||
int32_t i;
|
||||
float f;
|
||||
|
||||
len = LittleLong (net_message.cursize);
|
||||
|
@ -86,9 +86,9 @@ static void CL_WriteDemoMessage (void)
|
|||
fflush (cls.demofile);
|
||||
}
|
||||
|
||||
static int CL_GetDemoMessage (void)
|
||||
static int32_t CL_GetDemoMessage (void)
|
||||
{
|
||||
int r, i;
|
||||
int32_t r, i;
|
||||
float f;
|
||||
|
||||
if (cls.demopaused)
|
||||
|
@ -142,9 +142,9 @@ CL_GetMessage
|
|||
Handles recording and playback of demos, on top of NET_ code
|
||||
====================
|
||||
*/
|
||||
int CL_GetMessage (void)
|
||||
int32_t CL_GetMessage (void)
|
||||
{
|
||||
int r;
|
||||
int32_t r;
|
||||
|
||||
if (cls.demoplayback)
|
||||
return CL_GetDemoMessage ();
|
||||
|
@ -220,9 +220,9 @@ record <demoname> <map> [cd track]
|
|||
*/
|
||||
void CL_Record_f (void)
|
||||
{
|
||||
int c;
|
||||
int32_t c;
|
||||
char name[MAX_OSPATH];
|
||||
int track;
|
||||
int32_t track;
|
||||
|
||||
if (cmd_source != src_command)
|
||||
return;
|
||||
|
@ -266,7 +266,7 @@ void CL_Record_f (void)
|
|||
if (c == 4)
|
||||
{
|
||||
track = atoi(Cmd_Argv(3));
|
||||
Con_Printf ("Forcing CD track to %i\n", cls.forcetrack);
|
||||
Con_Printf ("Forcing CD track to %" PRIi32 "\n", cls.forcetrack);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ void CL_Record_f (void)
|
|||
}
|
||||
|
||||
cls.forcetrack = track;
|
||||
fprintf (cls.demofile, "%i\n", cls.forcetrack);
|
||||
fprintf (cls.demofile, "%" PRIi32 "\n", cls.forcetrack);
|
||||
|
||||
cls.demorecording = true;
|
||||
|
||||
|
@ -303,8 +303,8 @@ void CL_Record_f (void)
|
|||
if (c == 2 && cls.state == ca_connected)
|
||||
{
|
||||
byte *data = net_message.data;
|
||||
int cursize = net_message.cursize;
|
||||
int i;
|
||||
int32_t cursize = net_message.cursize;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
|
@ -382,8 +382,8 @@ play [demoname]
|
|||
void CL_PlayDemo_f (void)
|
||||
{
|
||||
char name[MAX_OSPATH];
|
||||
int i, c;
|
||||
qboolean neg;
|
||||
int32_t i, c;
|
||||
bool neg;
|
||||
|
||||
if (cmd_source != src_command)
|
||||
return;
|
||||
|
@ -414,7 +414,7 @@ void CL_PlayDemo_f (void)
|
|||
// ZOID, fscanf is evil
|
||||
// O.S.: if a space character e.g. 0x20 (' ') follows '\n',
|
||||
// fscanf skips that byte too and screws up further reads.
|
||||
// fscanf (cls.demofile, "%i\n", &cls.forcetrack);
|
||||
// fscanf (cls.demofile, "%" PRIi32 "\n", &cls.forcetrack);
|
||||
cls.forcetrack = 0;
|
||||
c = 0; /* silence pesky compiler warnings */
|
||||
neg = false;
|
||||
|
@ -459,7 +459,7 @@ CL_FinishTimeDemo
|
|||
*/
|
||||
static void CL_FinishTimeDemo (void)
|
||||
{
|
||||
int frames;
|
||||
int32_t frames;
|
||||
float time;
|
||||
|
||||
cls.timedemo = false;
|
||||
|
@ -469,7 +469,7 @@ static void CL_FinishTimeDemo (void)
|
|||
time = realtime - cls.td_starttime;
|
||||
if (!time)
|
||||
time = 1;
|
||||
Con_Printf ("%i frames %5.1f seconds %5.1f fps\n", frames, time, frames/time);
|
||||
Con_Printf ("%" PRIi32 " frames %5.1f seconds %5.1f fps\n", frames, time, frames/time);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -57,12 +57,12 @@ kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright;
|
|||
kbutton_t in_strafe, in_speed, in_use, in_jump, in_attack;
|
||||
kbutton_t in_up, in_down;
|
||||
|
||||
int in_impulse;
|
||||
int32_t in_impulse;
|
||||
|
||||
|
||||
void KeyDown (kbutton_t *b)
|
||||
{
|
||||
int k;
|
||||
int32_t k;
|
||||
const char *c;
|
||||
|
||||
c = Cmd_Argv(1);
|
||||
|
@ -91,7 +91,7 @@ void KeyDown (kbutton_t *b)
|
|||
|
||||
void KeyUp (kbutton_t *b)
|
||||
{
|
||||
int k;
|
||||
int32_t k;
|
||||
const char *c;
|
||||
|
||||
c = Cmd_Argv(1);
|
||||
|
@ -176,7 +176,7 @@ Returns 0.25 if a key was pressed and released during the frame,
|
|||
float CL_KeyState (kbutton_t *key)
|
||||
{
|
||||
float val;
|
||||
qboolean impulsedown, impulseup, down;
|
||||
bool impulsedown, impulseup, down;
|
||||
|
||||
impulsedown = key->state & 2;
|
||||
impulseup = key->state & 4;
|
||||
|
@ -339,8 +339,8 @@ CL_SendMove
|
|||
*/
|
||||
void CL_SendMove (const usercmd_t *cmd)
|
||||
{
|
||||
int i;
|
||||
int bits;
|
||||
int32_t i;
|
||||
int32_t bits;
|
||||
sizebuf_t buf;
|
||||
byte data[128];
|
||||
|
||||
|
|
|
@ -56,9 +56,9 @@ lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
|||
dlight_t cl_dlights[MAX_DLIGHTS];
|
||||
|
||||
entity_t *cl_entities; //johnfitz -- was a static array, now on hunk
|
||||
int cl_max_edicts; //johnfitz -- only changes when new map loads
|
||||
int32_t cl_max_edicts; //johnfitz -- only changes when new map loads
|
||||
|
||||
int cl_numvisedicts;
|
||||
int32_t cl_numvisedicts;
|
||||
entity_t *cl_visedicts[MAX_VISEDICTS];
|
||||
|
||||
extern cvar_t r_lerpmodels, r_lerpmove; //johnfitz
|
||||
|
@ -86,7 +86,7 @@ void CL_ClearState (void)
|
|||
memset (cl_beams, 0, sizeof(cl_beams));
|
||||
|
||||
//johnfitz -- cl_entities is now dynamically allocated
|
||||
cl_max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS);
|
||||
cl_max_edicts = CLAMP (MIN_EDICTS,(int32_t)max_edicts.value,MAX_EDICTS);
|
||||
cl_entities = (entity_t *) Hunk_AllocName (cl_max_edicts*sizeof(entity_t), "cl_entities");
|
||||
//johnfitz
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ void CL_SignonReply (void)
|
|||
{
|
||||
char str[8192];
|
||||
|
||||
Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
|
||||
Con_DPrintf ("CL_SignonReply: %" PRIi32 "\n", cls.signon);
|
||||
|
||||
switch (cls.signon)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ void CL_SignonReply (void)
|
|||
MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
|
||||
|
||||
MSG_WriteByte (&cls.message, clc_stringcmd);
|
||||
MSG_WriteString (&cls.message, va("color %i %i\n", ((int)cl_color.value)>>4, ((int)cl_color.value)&15));
|
||||
MSG_WriteString (&cls.message, va("color %" PRIi32 " %" PRIi32 "\n", ((int32_t)cl_color.value)>>4, ((int32_t)cl_color.value)&15));
|
||||
|
||||
MSG_WriteByte (&cls.message, clc_stringcmd);
|
||||
sprintf (str, "spawn %s", cls.spawnparms);
|
||||
|
@ -255,20 +255,20 @@ CL_PrintEntities_f
|
|||
void CL_PrintEntities_f (void)
|
||||
{
|
||||
entity_t *ent;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (cls.state != ca_connected)
|
||||
return;
|
||||
|
||||
for (i=0,ent=cl_entities ; i<cl.num_entities ; i++,ent++)
|
||||
{
|
||||
Con_Printf ("%3i:",i);
|
||||
Con_Printf ("%3" PRIi32 ":",i);
|
||||
if (!ent->model)
|
||||
{
|
||||
Con_Printf ("EMPTY\n");
|
||||
continue;
|
||||
}
|
||||
Con_Printf ("%s:%2i (%5.1f,%5.1f,%5.1f) [%5.1f %5.1f %5.1f]\n"
|
||||
Con_Printf ("%s:%2" PRIi32 " (%5.1f,%5.1f,%5.1f) [%5.1f %5.1f %5.1f]\n"
|
||||
,ent->model->name,ent->frame, ent->origin[0], ent->origin[1], ent->origin[2], ent->angles[0], ent->angles[1], ent->angles[2]);
|
||||
}
|
||||
}
|
||||
|
@ -279,9 +279,9 @@ CL_AllocDlight
|
|||
|
||||
===============
|
||||
*/
|
||||
dlight_t *CL_AllocDlight (int key)
|
||||
dlight_t *CL_AllocDlight (int32_t key)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
dlight_t *dl;
|
||||
|
||||
// first look for an exact key match
|
||||
|
@ -329,7 +329,7 @@ CL_DecayLights
|
|||
*/
|
||||
void CL_DecayLights (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
dlight_t *dl;
|
||||
float time;
|
||||
|
||||
|
@ -405,7 +405,7 @@ CL_RelinkEntities
|
|||
void CL_RelinkEntities (void)
|
||||
{
|
||||
entity_t *ent;
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
float frac, f, d;
|
||||
vec3_t delta;
|
||||
float bobjrotate;
|
||||
|
@ -590,15 +590,15 @@ CL_ReadFromServer
|
|||
Read all incoming data from the server
|
||||
===============
|
||||
*/
|
||||
int CL_ReadFromServer (void)
|
||||
int32_t CL_ReadFromServer (void)
|
||||
{
|
||||
int ret;
|
||||
extern int num_temp_entities; //johnfitz
|
||||
int num_beams = 0; //johnfitz
|
||||
int num_dlights = 0; //johnfitz
|
||||
int32_t ret;
|
||||
extern int32_t num_temp_entities; //johnfitz
|
||||
int32_t num_beams = 0; //johnfitz
|
||||
int32_t num_dlights = 0; //johnfitz
|
||||
beam_t *b; //johnfitz
|
||||
dlight_t *l; //johnfitz
|
||||
int i; //johnfitz
|
||||
int32_t i; //johnfitz
|
||||
|
||||
|
||||
cl.oldtime = cl.time;
|
||||
|
@ -626,13 +626,13 @@ int CL_ReadFromServer (void)
|
|||
|
||||
//visedicts
|
||||
if (cl_numvisedicts > 256 && dev_peakstats.visedicts <= 256)
|
||||
Con_DWarning ("%i visedicts exceeds standard limit of 256 (max = %d).\n", cl_numvisedicts, MAX_VISEDICTS);
|
||||
Con_DWarning ("%" PRIi32 " visedicts exceeds standard limit of 256 (max = %" PRIi32 ").\n", cl_numvisedicts, MAX_VISEDICTS);
|
||||
dev_stats.visedicts = cl_numvisedicts;
|
||||
dev_peakstats.visedicts = q_max(cl_numvisedicts, dev_peakstats.visedicts);
|
||||
|
||||
//temp entities
|
||||
if (num_temp_entities > 64 && dev_peakstats.tempents <= 64)
|
||||
Con_DWarning ("%i tempentities exceeds standard limit of 64 (max = %d).\n", num_temp_entities, MAX_TEMP_ENTITIES);
|
||||
Con_DWarning ("%" PRIi32 " tempentities exceeds standard limit of 64 (max = %" PRIi32 ").\n", num_temp_entities, MAX_TEMP_ENTITIES);
|
||||
dev_stats.tempents = num_temp_entities;
|
||||
dev_peakstats.tempents = q_max(num_temp_entities, dev_peakstats.tempents);
|
||||
|
||||
|
@ -641,7 +641,7 @@ int CL_ReadFromServer (void)
|
|||
if (b->model && b->endtime >= cl.time)
|
||||
num_beams++;
|
||||
if (num_beams > 24 && dev_peakstats.beams <= 24)
|
||||
Con_DWarning ("%i beams exceeded standard limit of 24 (max = %d).\n", num_beams, MAX_BEAMS);
|
||||
Con_DWarning ("%" PRIi32 " beams exceeded standard limit of 24 (max = %" PRIi32 ").\n", num_beams, MAX_BEAMS);
|
||||
dev_stats.beams = num_beams;
|
||||
dev_peakstats.beams = q_max(num_beams, dev_peakstats.beams);
|
||||
|
||||
|
@ -650,7 +650,7 @@ int CL_ReadFromServer (void)
|
|||
if (l->die >= cl.time && l->radius)
|
||||
num_dlights++;
|
||||
if (num_dlights > 32 && dev_peakstats.dlights <= 32)
|
||||
Con_DWarning ("%i dlights exceeded standard limit of 32 (max = %d).\n", num_dlights, MAX_DLIGHTS);
|
||||
Con_DWarning ("%" PRIi32 " dlights exceeded standard limit of 32 (max = %" PRIi32 ").\n", num_dlights, MAX_DLIGHTS);
|
||||
dev_stats.dlights = num_dlights;
|
||||
dev_peakstats.dlights = q_max(num_dlights, dev_peakstats.dlights);
|
||||
|
||||
|
@ -728,7 +728,7 @@ void CL_Tracepos_f (void)
|
|||
if (VectorLength(w) == 0)
|
||||
Con_Printf ("Tracepos: trace didn't hit anything\n");
|
||||
else
|
||||
Con_Printf ("Tracepos: (%i %i %i)\n", (int)w[0], (int)w[1], (int)w[2]);
|
||||
Con_Printf ("Tracepos: (%" PRIi32 " %" PRIi32 " %" PRIi32 ")\n", (int32_t)w[0], (int32_t)w[1], (int32_t)w[2]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -744,22 +744,22 @@ void CL_Viewpos_f (void)
|
|||
return;
|
||||
#if 0
|
||||
//camera position
|
||||
Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n",
|
||||
(int)r_refdef.vieworg[0],
|
||||
(int)r_refdef.vieworg[1],
|
||||
(int)r_refdef.vieworg[2],
|
||||
(int)r_refdef.viewangles[PITCH],
|
||||
(int)r_refdef.viewangles[YAW],
|
||||
(int)r_refdef.viewangles[ROLL]);
|
||||
Con_Printf ("Viewpos: (%" PRIi32 " %" PRIi32 " %" PRIi32 ") %" PRIi32 " %" PRIi32 " %" PRIi32 "\n",
|
||||
(int32_t)r_refdef.vieworg[0],
|
||||
(int32_t)r_refdef.vieworg[1],
|
||||
(int32_t)r_refdef.vieworg[2],
|
||||
(int32_t)r_refdef.viewangles[PITCH],
|
||||
(int32_t)r_refdef.viewangles[YAW],
|
||||
(int32_t)r_refdef.viewangles[ROLL]);
|
||||
#else
|
||||
//player position
|
||||
Con_Printf ("Viewpos: (%i %i %i) %i %i %i\n",
|
||||
(int)cl_entities[cl.viewentity].origin[0],
|
||||
(int)cl_entities[cl.viewentity].origin[1],
|
||||
(int)cl_entities[cl.viewentity].origin[2],
|
||||
(int)cl.viewangles[PITCH],
|
||||
(int)cl.viewangles[YAW],
|
||||
(int)cl.viewangles[ROLL]);
|
||||
Con_Printf ("Viewpos: (%" PRIi32 " %" PRIi32 " %" PRIi32 ") %" PRIi32 " %" PRIi32 " %" PRIi32 "\n",
|
||||
(int32_t)cl_entities[cl.viewentity].origin[0],
|
||||
(int32_t)cl_entities[cl.viewentity].origin[1],
|
||||
(int32_t)cl_entities[cl.viewentity].origin[2],
|
||||
(int32_t)cl.viewangles[PITCH],
|
||||
(int32_t)cl.viewangles[YAW],
|
||||
(int32_t)cl.viewangles[ROLL]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ const char *svc_strings[] =
|
|||
//johnfitz
|
||||
};
|
||||
|
||||
qboolean warn_about_nehahra_protocol; //johnfitz
|
||||
bool warn_about_nehahra_protocol; //johnfitz
|
||||
|
||||
extern vec3_t v_punchangles[2]; //johnfitz
|
||||
|
||||
|
@ -102,17 +102,17 @@ CL_EntityNum
|
|||
This error checks and tracks the total number of entities
|
||||
===============
|
||||
*/
|
||||
entity_t *CL_EntityNum (int num)
|
||||
entity_t *CL_EntityNum (int32_t num)
|
||||
{
|
||||
//johnfitz -- check minimum number too
|
||||
if (num < 0)
|
||||
Host_Error ("CL_EntityNum: %i is an invalid number",num);
|
||||
Host_Error ("CL_EntityNum: %" PRIi32 " is an invalid number",num);
|
||||
//john
|
||||
|
||||
if (num >= cl.num_entities)
|
||||
{
|
||||
if (num >= cl_max_edicts) //johnfitz -- no more MAX_EDICTS
|
||||
Host_Error ("CL_EntityNum: %i is an invalid number",num);
|
||||
Host_Error ("CL_EntityNum: %" PRIi32 " is an invalid number",num);
|
||||
while (cl.num_entities<=num)
|
||||
{
|
||||
cl_entities[cl.num_entities].colormap = vid.colormap;
|
||||
|
@ -133,12 +133,12 @@ CL_ParseStartSoundPacket
|
|||
void CL_ParseStartSoundPacket(void)
|
||||
{
|
||||
vec3_t pos;
|
||||
int channel, ent;
|
||||
int sound_num;
|
||||
int volume;
|
||||
int field_mask;
|
||||
int32_t channel, ent;
|
||||
int32_t sound_num;
|
||||
int32_t volume;
|
||||
int32_t field_mask;
|
||||
float attenuation;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
field_mask = MSG_ReadByte();
|
||||
|
||||
|
@ -173,11 +173,11 @@ void CL_ParseStartSoundPacket(void)
|
|||
|
||||
//johnfitz -- check soundnum
|
||||
if (sound_num >= MAX_SOUNDS)
|
||||
Host_Error ("CL_ParseStartSoundPacket: %i > MAX_SOUNDS", sound_num);
|
||||
Host_Error ("CL_ParseStartSoundPacket: %" PRIi32 " > MAX_SOUNDS", sound_num);
|
||||
//johnfitz
|
||||
|
||||
if (ent > cl_max_edicts) //johnfitz -- no more MAX_EDICTS
|
||||
Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);
|
||||
Host_Error ("CL_ParseStartSoundPacket: ent = %" PRIi32 "", ent);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
pos[i] = MSG_ReadCoord (cl.protocolflags);
|
||||
|
@ -198,7 +198,7 @@ void CL_KeepaliveMessage (void)
|
|||
{
|
||||
float time;
|
||||
static float lastmsg;
|
||||
int ret;
|
||||
int32_t ret;
|
||||
sizebuf_t old;
|
||||
byte *olddata;
|
||||
|
||||
|
@ -256,8 +256,8 @@ CL_ParseServerInfo
|
|||
void CL_ParseServerInfo (void)
|
||||
{
|
||||
const char *str;
|
||||
int i;
|
||||
int nummodels, numsounds;
|
||||
int32_t i;
|
||||
int32_t nummodels, numsounds;
|
||||
char model_precache[MAX_MODELS][MAX_QPATH];
|
||||
char sound_precache[MAX_SOUNDS][MAX_QPATH];
|
||||
|
||||
|
@ -278,7 +278,7 @@ void CL_ParseServerInfo (void)
|
|||
//johnfitz -- support multiple protocols
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ) {
|
||||
Con_Printf ("\n"); //because there's no newline after serverinfo print
|
||||
Host_Error ("Server returned version %i, not %i or %i or %i", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||
Host_Error ("Server returned version %" PRIi32 ", not %" PRIi32 " or %" PRIi32 " or %" PRIi32 "", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||
}
|
||||
cl.protocol = i;
|
||||
//johnfitz
|
||||
|
@ -292,7 +292,7 @@ void CL_ParseServerInfo (void)
|
|||
|
||||
if (0 != (cl.protocolflags & (~supportedflags)))
|
||||
{
|
||||
Con_Warning("PROTOCOL_RMQ protocolflags %i contains unsupported flags\n", cl.protocolflags);
|
||||
Con_Warning("PROTOCOL_RMQ protocolflags %" PRIi32 " contains unsupported flags\n", cl.protocolflags);
|
||||
}
|
||||
}
|
||||
else cl.protocolflags = 0;
|
||||
|
@ -301,7 +301,7 @@ void CL_ParseServerInfo (void)
|
|||
cl.maxclients = MSG_ReadByte ();
|
||||
if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD)
|
||||
{
|
||||
Host_Error ("Bad maxclients (%u) from server", cl.maxclients);
|
||||
Host_Error ("Bad maxclients (%" PRIu32 ") from server", cl.maxclients);
|
||||
}
|
||||
cl.scores = (scoreboard_t *) Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores");
|
||||
|
||||
|
@ -317,7 +317,7 @@ void CL_ParseServerInfo (void)
|
|||
Con_Printf ("%c%s\n", 2, str);
|
||||
|
||||
//johnfitz -- tell user which protocol this is
|
||||
Con_Printf ("Using protocol %i\n", i);
|
||||
Con_Printf ("Using protocol %" PRIi32 "\n", i);
|
||||
|
||||
// first we go through and touch all of the precache data that still
|
||||
// happens to be in the cache, so precaching something else doesn't
|
||||
|
@ -340,7 +340,7 @@ void CL_ParseServerInfo (void)
|
|||
|
||||
//johnfitz -- check for excessive models
|
||||
if (nummodels >= 256)
|
||||
Con_DWarning ("%i models exceeds standard limit of 256 (max = %d).\n", nummodels, MAX_MODELS);
|
||||
Con_DWarning ("%" PRIi32 " models exceeds standard limit of 256 (max = %" PRIi32 ").\n", nummodels, MAX_MODELS);
|
||||
//johnfitz
|
||||
|
||||
// precache sounds
|
||||
|
@ -360,7 +360,7 @@ void CL_ParseServerInfo (void)
|
|||
|
||||
//johnfitz -- check for excessive sounds
|
||||
if (numsounds >= 256)
|
||||
Con_DWarning ("%i sounds exceeds standard limit of 256 (max = %d).\n", numsounds, MAX_SOUNDS);
|
||||
Con_DWarning ("%" PRIi32 " sounds exceeds standard limit of 256 (max = %" PRIi32 ").\n", numsounds, MAX_SOUNDS);
|
||||
//johnfitz
|
||||
|
||||
//
|
||||
|
@ -419,15 +419,15 @@ If an entities model or origin changes from frame to frame, it must be
|
|||
relinked. Other attributes can change without relinking.
|
||||
==================
|
||||
*/
|
||||
void CL_ParseUpdate (int bits)
|
||||
void CL_ParseUpdate (int32_t bits)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
qmodel_t *model;
|
||||
int modnum;
|
||||
qboolean forcelink;
|
||||
int32_t modnum;
|
||||
bool forcelink;
|
||||
entity_t *ent;
|
||||
int num;
|
||||
int skin;
|
||||
int32_t num;
|
||||
int32_t skin;
|
||||
|
||||
if (cls.signon == SIGNONS - 1)
|
||||
{ // first update is the final signon stage
|
||||
|
@ -635,10 +635,10 @@ void CL_ParseUpdate (int bits)
|
|||
CL_ParseBaseline
|
||||
==================
|
||||
*/
|
||||
void CL_ParseBaseline (entity_t *ent, int version) //johnfitz -- added argument
|
||||
void CL_ParseBaseline (entity_t *ent, int32_t version) //johnfitz -- added argument
|
||||
{
|
||||
int i;
|
||||
int bits; //johnfitz
|
||||
int32_t i;
|
||||
int32_t bits; //johnfitz
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
bits = (version == 2) ? MSG_ReadByte() : 0;
|
||||
|
@ -667,8 +667,8 @@ Server information pertaining to this client only
|
|||
*/
|
||||
void CL_ParseClientdata (void)
|
||||
{
|
||||
int i, j;
|
||||
int bits; //johnfitz
|
||||
int32_t i, j;
|
||||
int32_t bits; //johnfitz
|
||||
|
||||
bits = (uint16_t)MSG_ReadShort (); //johnfitz -- read bits here isntead of in CL_ParseServerMessage()
|
||||
|
||||
|
@ -831,10 +831,10 @@ void CL_ParseClientdata (void)
|
|||
CL_NewTranslation
|
||||
=====================
|
||||
*/
|
||||
void CL_NewTranslation (int slot)
|
||||
void CL_NewTranslation (int32_t slot)
|
||||
{
|
||||
int i, j;
|
||||
int top, bottom;
|
||||
int32_t i, j;
|
||||
int32_t top, bottom;
|
||||
byte *dest, *source;
|
||||
|
||||
if (slot > cl.maxclients)
|
||||
|
@ -871,10 +871,10 @@ void CL_NewTranslation (int slot)
|
|||
CL_ParseStatic
|
||||
=====================
|
||||
*/
|
||||
void CL_ParseStatic (int version) //johnfitz -- added a parameter
|
||||
void CL_ParseStatic (int32_t version) //johnfitz -- added a parameter
|
||||
{
|
||||
entity_t *ent;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
i = cl.num_statics;
|
||||
if (i >= MAX_STATIC_ENTITIES)
|
||||
|
@ -905,11 +905,11 @@ void CL_ParseStatic (int version) //johnfitz -- added a parameter
|
|||
CL_ParseStaticSound
|
||||
===================
|
||||
*/
|
||||
void CL_ParseStaticSound (int version) //johnfitz -- added argument
|
||||
void CL_ParseStaticSound (int32_t version) //johnfitz -- added argument
|
||||
{
|
||||
vec3_t org;
|
||||
int sound_num, vol, atten;
|
||||
int i;
|
||||
int32_t sound_num, vol, atten;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
org[i] = MSG_ReadCoord (cl.protocolflags);
|
||||
|
@ -928,7 +928,7 @@ void CL_ParseStaticSound (int version) //johnfitz -- added argument
|
|||
}
|
||||
|
||||
|
||||
#define SHOWNET(x) if(cl_shownet.value==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x);
|
||||
#define SHOWNET(x) if(cl_shownet.value==2)Con_Printf ("%3" PRIi32 ":%s\n", msg_readcount-1, x);
|
||||
|
||||
/*
|
||||
=====================
|
||||
|
@ -937,16 +937,16 @@ CL_ParseServerMessage
|
|||
*/
|
||||
void CL_ParseServerMessage (void)
|
||||
{
|
||||
int cmd;
|
||||
int i;
|
||||
int32_t cmd;
|
||||
int32_t i;
|
||||
const char *str; //johnfitz
|
||||
int total, j, lastcmd; //johnfitz
|
||||
int32_t total, j, lastcmd; //johnfitz
|
||||
|
||||
//
|
||||
// if recording demos, copy the message out
|
||||
//
|
||||
if (cl_shownet.value == 1)
|
||||
Con_Printf ("%i ",net_message.cursize);
|
||||
Con_Printf ("%" PRIi32 " ",net_message.cursize);
|
||||
else if (cl_shownet.value == 2)
|
||||
Con_Printf ("------------------\n");
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ void CL_ParseServerMessage (void)
|
|||
i = MSG_ReadLong ();
|
||||
//johnfitz -- support multiple protocols
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ)
|
||||
Host_Error ("Server returned version %i, not %i or %i or %i", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||
Host_Error ("Server returned version %" PRIi32 ", not %" PRIi32 " or %" PRIi32 " or %" PRIi32 "", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||
cl.protocol = i;
|
||||
//johnfitz
|
||||
break;
|
||||
|
@ -1132,13 +1132,13 @@ void CL_ParseServerMessage (void)
|
|||
case svc_signonnum:
|
||||
i = MSG_ReadByte ();
|
||||
if (i <= cls.signon)
|
||||
Host_Error ("Received signon %i when at %i", i, cls.signon);
|
||||
Host_Error ("Received signon %" PRIi32 " when at %" PRIi32 "", i, cls.signon);
|
||||
cls.signon = i;
|
||||
//johnfitz -- if signonnum==2, signon packet has been fully parsed, so check for excessive static ents and efrags
|
||||
if (i == 2)
|
||||
{
|
||||
if (cl.num_statics > 128)
|
||||
Con_DWarning ("%i static entities exceeds standard limit of 128 (max = %d).\n", cl.num_statics, MAX_STATIC_ENTITIES);
|
||||
Con_DWarning ("%" PRIi32 " static entities exceeds standard limit of 128 (max = %" PRIi32 ").\n", cl.num_statics, MAX_STATIC_ENTITIES);
|
||||
R_CheckEfrags ();
|
||||
}
|
||||
//johnfitz
|
||||
|
@ -1156,7 +1156,7 @@ void CL_ParseServerMessage (void)
|
|||
case svc_updatestat:
|
||||
i = MSG_ReadByte ();
|
||||
if (i < 0 || i >= MAX_CL_STATS)
|
||||
Sys_Error ("svc_updatestat: %i is invalid", i);
|
||||
Sys_Error ("svc_updatestat: %" PRIi32 " is invalid", i);
|
||||
cl.stats[i] = MSG_ReadLong ();;
|
||||
break;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
int num_temp_entities;
|
||||
int32_t num_temp_entities;
|
||||
entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
|
||||
beam_t cl_beams[MAX_BEAMS];
|
||||
|
||||
|
@ -58,10 +58,10 @@ CL_ParseBeam
|
|||
*/
|
||||
void CL_ParseBeam (qmodel_t *m)
|
||||
{
|
||||
int ent;
|
||||
int32_t ent;
|
||||
vec3_t start, end;
|
||||
beam_t *b;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
ent = MSG_ReadShort ();
|
||||
|
||||
|
@ -115,11 +115,11 @@ CL_ParseTEnt
|
|||
*/
|
||||
void CL_ParseTEnt (void)
|
||||
{
|
||||
int type;
|
||||
int32_t type;
|
||||
vec3_t pos;
|
||||
dlight_t *dl;
|
||||
int rnd;
|
||||
int colorStart, colorLength;
|
||||
int32_t rnd;
|
||||
int32_t colorStart, colorLength;
|
||||
|
||||
type = MSG_ReadByte ();
|
||||
switch (type)
|
||||
|
@ -291,7 +291,7 @@ CL_UpdateTEnts
|
|||
*/
|
||||
void CL_UpdateTEnts (void)
|
||||
{
|
||||
int i, j; //johnfitz -- use j instead of using i twice, so we don't corrupt memory
|
||||
int32_t i, j; //johnfitz -- use j instead of using i twice, so we don't corrupt memory
|
||||
beam_t *b;
|
||||
vec3_t dist, org;
|
||||
float d;
|
||||
|
@ -301,7 +301,7 @@ void CL_UpdateTEnts (void)
|
|||
|
||||
num_temp_entities = 0;
|
||||
|
||||
srand ((int) (cl.time * 1000)); //johnfitz -- freeze beams when paused
|
||||
srand ((int32_t) (cl.time * 1000)); //johnfitz -- freeze beams when paused
|
||||
|
||||
// update lightning
|
||||
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
|
||||
|
@ -328,12 +328,12 @@ void CL_UpdateTEnts (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
yaw = (int) (atan2(dist[1], dist[0]) * 180 / M_PI);
|
||||
yaw = (int32_t) (atan2(dist[1], dist[0]) * 180 / M_PI);
|
||||
if (yaw < 0)
|
||||
yaw += 360;
|
||||
|
||||
forward = sqrt (dist[0]*dist[0] + dist[1]*dist[1]);
|
||||
pitch = (int) (atan2(dist[2], forward) * 180 / M_PI);
|
||||
pitch = (int32_t) (atan2(dist[2], forward) * 180 / M_PI);
|
||||
if (pitch < 0)
|
||||
pitch += 360;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int length;
|
||||
int32_t length;
|
||||
char map[MAX_STYLESTRING];
|
||||
char average; //johnfitz
|
||||
char peak; //johnfitz
|
||||
|
@ -37,15 +37,15 @@ typedef struct
|
|||
{
|
||||
char name[MAX_SCOREBOARDNAME];
|
||||
float entertime;
|
||||
int frags;
|
||||
int colors; // two 4 bit fields
|
||||
int32_t frags;
|
||||
int32_t colors; // two 4 bit fields
|
||||
byte translations[VID_GRADES*256];
|
||||
} scoreboard_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int destcolor[3];
|
||||
int percent; // 0-256
|
||||
int32_t destcolor[3];
|
||||
int32_t percent; // 0-256
|
||||
} cshift_t;
|
||||
|
||||
#define CSHIFT_CONTENTS 0
|
||||
|
@ -71,7 +71,7 @@ typedef struct
|
|||
float die; // stop lighting after this time
|
||||
float decay; // drop this each second
|
||||
float minlight; // don't add when contributing less
|
||||
int key;
|
||||
int32_t key;
|
||||
vec3_t color; //johnfitz -- lit support via lordhavoc
|
||||
} dlight_t;
|
||||
|
||||
|
@ -79,7 +79,7 @@ typedef struct
|
|||
#define MAX_BEAMS 32 //johnfitz -- was 24
|
||||
typedef struct
|
||||
{
|
||||
int entity;
|
||||
int32_t entity;
|
||||
struct qmodel_s *model;
|
||||
float endtime;
|
||||
vec3_t start, end;
|
||||
|
@ -107,27 +107,27 @@ typedef struct
|
|||
char spawnparms[MAX_MAPSTRING]; // to restart a level
|
||||
|
||||
// demo loop control
|
||||
int demonum; // -1 = don't play demos
|
||||
int32_t demonum; // -1 = don't play demos
|
||||
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
|
||||
|
||||
// demo recording info must be here, because record is started before
|
||||
// entering a map (and clearing client_state_t)
|
||||
qboolean demorecording;
|
||||
qboolean demoplayback;
|
||||
bool demorecording;
|
||||
bool demoplayback;
|
||||
|
||||
// did the user pause demo playback? (separate from cl.paused because we don't
|
||||
// want a svc_setpause inside the demo to actually pause demo playback).
|
||||
qboolean demopaused;
|
||||
bool demopaused;
|
||||
|
||||
qboolean timedemo;
|
||||
int forcetrack; // -1 = use normal cd track
|
||||
bool timedemo;
|
||||
int32_t forcetrack; // -1 = use normal cd track
|
||||
FILE *demofile;
|
||||
int td_lastframe; // to meter out one message a frame
|
||||
int td_startframe; // host_framecount at start
|
||||
int32_t td_lastframe; // to meter out one message a frame
|
||||
int32_t td_startframe; // host_framecount at start
|
||||
float td_starttime; // realtime at second frame of timedemo
|
||||
|
||||
// connection information
|
||||
int signon; // 0 to SIGNONS
|
||||
int32_t signon; // 0 to SIGNONS
|
||||
struct qsocket_s *netcon;
|
||||
sizebuf_t message; // writing buffer to send to server
|
||||
|
||||
|
@ -141,15 +141,15 @@ extern client_static_t cls;
|
|||
//
|
||||
typedef struct
|
||||
{
|
||||
int movemessages; // since connecting to this server
|
||||
int32_t movemessages; // since connecting to this server
|
||||
// throw out the first couple, so the player
|
||||
// doesn't accidentally do something the
|
||||
// first frame
|
||||
usercmd_t cmd; // last command sent to the server
|
||||
|
||||
// information for local display
|
||||
int stats[MAX_CL_STATS]; // health, etc
|
||||
int items; // inventory bit flags
|
||||
int32_t stats[MAX_CL_STATS]; // health, etc
|
||||
int32_t items; // inventory bit flags
|
||||
float item_gettime[32]; // cl.time of aquiring item, for blinking
|
||||
float faceanimtime; // use anim frame if cl.time < this
|
||||
|
||||
|
@ -173,19 +173,19 @@ typedef struct
|
|||
// pitch drifting vars
|
||||
float idealpitch;
|
||||
float pitchvel;
|
||||
qboolean nodrift;
|
||||
bool nodrift;
|
||||
float driftmove;
|
||||
double laststop;
|
||||
|
||||
float viewheight;
|
||||
float crouch; // local amount for smoothing stepups
|
||||
|
||||
qboolean paused; // send over by server
|
||||
qboolean onground;
|
||||
qboolean inwater;
|
||||
bool paused; // send over by server
|
||||
bool onground;
|
||||
bool inwater;
|
||||
|
||||
int intermission; // don't change view angle, full screen, etc
|
||||
int completed_time; // latched at intermission start
|
||||
int32_t intermission; // don't change view angle, full screen, etc
|
||||
int32_t completed_time; // latched at intermission start
|
||||
|
||||
double mtime[2]; // the timestamp of last two messages
|
||||
double time; // clients view of time, should be between
|
||||
|
@ -205,19 +205,19 @@ typedef struct
|
|||
|
||||
char mapname[128];
|
||||
char levelname[128]; // for display on solo scoreboard //johnfitz -- was 40.
|
||||
int viewentity; // cl_entitites[cl.viewentity] = player
|
||||
int maxclients;
|
||||
int gametype;
|
||||
int32_t viewentity; // cl_entitites[cl.viewentity] = player
|
||||
int32_t maxclients;
|
||||
int32_t gametype;
|
||||
|
||||
// refresh related state
|
||||
struct qmodel_s *worldmodel; // cl_entitites[0].model
|
||||
struct efrag_s *free_efrags;
|
||||
int num_efrags;
|
||||
int num_entities; // held in cl_entities array
|
||||
int num_statics; // held in cl_staticentities array
|
||||
int32_t num_efrags;
|
||||
int32_t num_entities; // held in cl_entities array
|
||||
int32_t num_statics; // held in cl_staticentities array
|
||||
entity_t viewent; // the gun model
|
||||
|
||||
int cdtrack, looptrack; // cd audio
|
||||
int32_t cdtrack, looptrack; // cd audio
|
||||
|
||||
// frag scoreboard
|
||||
scoreboard_t *scores; // [cl.maxclients]
|
||||
|
@ -278,17 +278,17 @@ extern dlight_t cl_dlights[MAX_DLIGHTS];
|
|||
extern entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
|
||||
extern beam_t cl_beams[MAX_BEAMS];
|
||||
extern entity_t *cl_visedicts[MAX_VISEDICTS];
|
||||
extern int cl_numvisedicts;
|
||||
extern int32_t cl_numvisedicts;
|
||||
|
||||
extern entity_t *cl_entities; //johnfitz -- was a static array, now on hunk
|
||||
extern int cl_max_edicts; //johnfitz -- only changes when new map loads
|
||||
extern int32_t cl_max_edicts; //johnfitz -- only changes when new map loads
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//
|
||||
// cl_main
|
||||
//
|
||||
dlight_t *CL_AllocDlight (int key);
|
||||
dlight_t *CL_AllocDlight (int32_t key);
|
||||
void CL_DecayLights (void);
|
||||
|
||||
void CL_Init (void);
|
||||
|
@ -308,8 +308,8 @@ void CL_NextDemo (void);
|
|||
//
|
||||
typedef struct
|
||||
{
|
||||
int down[2]; // key nums holding it down
|
||||
int state; // low bit is down state
|
||||
int32_t down[2]; // key nums holding it down
|
||||
int32_t state; // low bit is down state
|
||||
} kbutton_t;
|
||||
|
||||
extern kbutton_t in_mlook, in_klook;
|
||||
|
@ -319,7 +319,7 @@ extern kbutton_t in_speed;
|
|||
void CL_InitInput (void);
|
||||
void CL_SendCmd (void);
|
||||
void CL_SendMove (const usercmd_t *cmd);
|
||||
int CL_ReadFromServer (void);
|
||||
int32_t CL_ReadFromServer (void);
|
||||
void CL_BaseMove (usercmd_t *cmd);
|
||||
|
||||
void CL_ParseTEnt (void);
|
||||
|
@ -331,7 +331,7 @@ void CL_ClearState (void);
|
|||
// cl_demo.c
|
||||
//
|
||||
void CL_StopPlayback (void);
|
||||
int CL_GetMessage (void);
|
||||
int32_t CL_GetMessage (void);
|
||||
|
||||
void CL_Stop_f (void);
|
||||
void CL_Record_f (void);
|
||||
|
@ -342,7 +342,7 @@ void CL_TimeDemo_f (void);
|
|||
// cl_parse.c
|
||||
//
|
||||
void CL_ParseServerMessage (void);
|
||||
void CL_NewTranslation (int slot);
|
||||
void CL_NewTranslation (int32_t slot);
|
||||
|
||||
//
|
||||
// view
|
||||
|
@ -354,7 +354,7 @@ void V_RenderView (void);
|
|||
//void V_UpdatePalette (void); //johnfitz
|
||||
void V_Register (void);
|
||||
void V_ParseDamage (void);
|
||||
void V_SetContentsColor (int contents);
|
||||
void V_SetContentsColor (int32_t contents);
|
||||
|
||||
//
|
||||
// cl_tent
|
||||
|
|
46
source/cmd.c
46
source/cmd.c
|
@ -39,7 +39,7 @@ typedef struct cmdalias_s
|
|||
|
||||
cmdalias_t *cmd_alias;
|
||||
|
||||
qboolean cmd_wait;
|
||||
bool cmd_wait;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
@ -87,7 +87,7 @@ Adds command text at the end of the buffer
|
|||
*/
|
||||
void Cbuf_AddText (const char *text)
|
||||
{
|
||||
int l;
|
||||
int32_t l;
|
||||
|
||||
l = Q_strlen (text);
|
||||
|
||||
|
@ -113,7 +113,7 @@ FIXME: actually change the command buffer to do less copying
|
|||
void Cbuf_InsertText (const char *text)
|
||||
{
|
||||
char *temp;
|
||||
int templen;
|
||||
int32_t templen;
|
||||
|
||||
// copy off any commands still remaining in the exec buffer
|
||||
templen = cmd_text.cursize;
|
||||
|
@ -144,10 +144,10 @@ Cbuf_Execute
|
|||
*/
|
||||
void Cbuf_Execute (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
char *text;
|
||||
char line[1024];
|
||||
int quotes;
|
||||
int32_t quotes;
|
||||
|
||||
while (cmd_text.cursize)
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ void Cbuf_Execute (void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (i > (int)sizeof(line) - 1)
|
||||
if (i > (int32_t)sizeof(line) - 1)
|
||||
{
|
||||
memcpy (line, text, sizeof(line) - 1);
|
||||
line[sizeof(line) - 1] = 0;
|
||||
|
@ -223,7 +223,7 @@ void Cmd_StuffCmds_f (void)
|
|||
{
|
||||
extern cvar_t cmdline;
|
||||
char cmds[CMDLINE_LENGTH];
|
||||
int i, j, plus;
|
||||
int32_t i, j, plus;
|
||||
|
||||
plus = false; // On Unix, argv[0] is command name
|
||||
|
||||
|
@ -258,7 +258,7 @@ Cmd_Exec_f
|
|||
void Cmd_Exec_f (void)
|
||||
{
|
||||
char *f;
|
||||
int mark;
|
||||
int32_t mark;
|
||||
|
||||
if (Cmd_Argc () != 2)
|
||||
{
|
||||
|
@ -289,7 +289,7 @@ Just prints the rest of the line to the console
|
|||
*/
|
||||
void Cmd_Echo_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i=1 ; i<Cmd_Argc() ; i++)
|
||||
Con_Printf ("%s ",Cmd_Argv(i));
|
||||
|
@ -307,7 +307,7 @@ void Cmd_Alias_f (void)
|
|||
{
|
||||
cmdalias_t *a;
|
||||
char cmd[1024];
|
||||
int i, c;
|
||||
int32_t i, c;
|
||||
const char *s;
|
||||
|
||||
|
||||
|
@ -317,7 +317,7 @@ void Cmd_Alias_f (void)
|
|||
for (a = cmd_alias, i = 0; a; a=a->next, i++)
|
||||
Con_SafePrintf (" %s: %s", a->name, a->value);
|
||||
if (i)
|
||||
Con_SafePrintf ("%i alias command(s)\n", i);
|
||||
Con_SafePrintf ("%" PRIi32 " alias command(s)\n", i);
|
||||
else
|
||||
Con_SafePrintf ("no alias commands found\n");
|
||||
break;
|
||||
|
@ -446,7 +446,7 @@ typedef struct cmd_function_s
|
|||
|
||||
#define MAX_ARGS 80
|
||||
|
||||
static int cmd_argc;
|
||||
static int32_t cmd_argc;
|
||||
static char *cmd_argv[MAX_ARGS];
|
||||
static char cmd_null_string[] = "";
|
||||
static const char *cmd_args = NULL;
|
||||
|
@ -467,7 +467,7 @@ void Cmd_List_f (void)
|
|||
{
|
||||
cmd_function_t *cmd;
|
||||
const char *partial;
|
||||
int len, count;
|
||||
int32_t len, count;
|
||||
|
||||
if (Cmd_Argc() > 1)
|
||||
{
|
||||
|
@ -491,7 +491,7 @@ void Cmd_List_f (void)
|
|||
count++;
|
||||
}
|
||||
|
||||
Con_SafePrintf ("%i commands", count);
|
||||
Con_SafePrintf ("%" PRIi32 " commands", count);
|
||||
if (partial)
|
||||
{
|
||||
Con_SafePrintf (" beginning with \"%s\"", partial);
|
||||
|
@ -501,7 +501,7 @@ void Cmd_List_f (void)
|
|||
|
||||
static char *Cmd_TintSubstring(const char *in, const char *substr, char *out, size_t outsize)
|
||||
{
|
||||
int l;
|
||||
int32_t l;
|
||||
char *m;
|
||||
q_strlcpy(out, in, outsize);
|
||||
while ((m = q_strcasestr(out, substr)))
|
||||
|
@ -525,7 +525,7 @@ we don't support descriptions, so this isn't really all that useful, but even wi
|
|||
void Cmd_Apropos_f(void)
|
||||
{
|
||||
char tmpbuf[256];
|
||||
int hits = 0;
|
||||
int32_t hits = 0;
|
||||
cmd_function_t *cmd;
|
||||
cvar_t *var;
|
||||
const char *substr = Cmd_Argv (1);
|
||||
|
@ -582,7 +582,7 @@ void Cmd_Init (void)
|
|||
Cmd_Argc
|
||||
============
|
||||
*/
|
||||
int Cmd_Argc (void)
|
||||
int32_t Cmd_Argc (void)
|
||||
{
|
||||
return cmd_argc;
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ int Cmd_Argc (void)
|
|||
Cmd_Argv
|
||||
============
|
||||
*/
|
||||
const char *Cmd_Argv (int arg)
|
||||
const char *Cmd_Argv (int32_t arg)
|
||||
{
|
||||
if (arg < 0 || arg >= cmd_argc)
|
||||
return cmd_null_string;
|
||||
|
@ -619,7 +619,7 @@ Parses the given string into command line tokens.
|
|||
*/
|
||||
void Cmd_TokenizeString (const char *text)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// clear the args from the last string
|
||||
for (i=0 ; i<cmd_argc ; i++)
|
||||
|
@ -721,7 +721,7 @@ void Cmd_AddCommand (const char *cmd_name, xcommand_t function)
|
|||
Cmd_Exists
|
||||
============
|
||||
*/
|
||||
qboolean Cmd_Exists (const char *cmd_name)
|
||||
bool Cmd_Exists (const char *cmd_name)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
|
||||
|
@ -744,7 +744,7 @@ Cmd_CompleteCommand
|
|||
const char *Cmd_CompleteCommand (const char *partial)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
int len;
|
||||
int32_t len;
|
||||
|
||||
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)
|
||||
Sys_Error ("Cmd_CheckParm: NULL");
|
||||
|
|
|
@ -88,21 +88,21 @@ void Cmd_AddCommand (const char *cmd_name, xcommand_t function);
|
|||
// register commands and functions to call for them.
|
||||
// The cmd_name is referenced later, so it should not be in temp memory
|
||||
|
||||
qboolean Cmd_Exists (const char *cmd_name);
|
||||
bool Cmd_Exists (const char *cmd_name);
|
||||
// used by the cvar code to check for cvar / command name overlap
|
||||
|
||||
const char *Cmd_CompleteCommand (const char *partial);
|
||||
// attempts to match a partial command for automatic command line completion
|
||||
// returns NULL if nothing fits
|
||||
|
||||
int Cmd_Argc (void);
|
||||
const char *Cmd_Argv (int arg);
|
||||
int32_t Cmd_Argc (void);
|
||||
const char *Cmd_Argv (int32_t arg);
|
||||
const char *Cmd_Args (void);
|
||||
// The functions that execute commands get their parameters with these
|
||||
// functions. Cmd_Argv () will return an empty string, not a NULL
|
||||
// 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
|
||||
// where the given parameter apears, or 0 if not present
|
||||
|
||||
|
|
236
source/common.c
236
source/common.c
|
@ -29,14 +29,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
static char *largv[MAX_NUM_ARGVS + 1];
|
||||
static char argvdummy[] = " ";
|
||||
|
||||
int safemode;
|
||||
int32_t safemode;
|
||||
|
||||
cvar_t registered = {"registered","1",CVAR_ROM}; /* set to correct value in COM_CheckRegistered() */
|
||||
cvar_t cmdline = {"cmdline","",CVAR_ROM/*|CVAR_SERVERINFO*/}; /* sending cmdline upon CCREQ_RULE_INFO is evil */
|
||||
|
||||
static qboolean com_modified; // set true if using non-id files
|
||||
static bool com_modified; // set true if using non-id files
|
||||
|
||||
qboolean fitzmode;
|
||||
bool fitzmode;
|
||||
|
||||
static void COM_Path_f (void);
|
||||
|
||||
|
@ -50,13 +50,13 @@ static void COM_Path_f (void);
|
|||
#define PAK0_CRC_V091 28804 /* id1/pak0.pak - v0.91/0.92, not supported */
|
||||
|
||||
char com_token[1024];
|
||||
int com_argc;
|
||||
int32_t com_argc;
|
||||
char **com_argv;
|
||||
|
||||
#define CMDLINE_LENGTH 256 /* johnfitz -- mirrored in cmd.c */
|
||||
char com_cmdline[CMDLINE_LENGTH];
|
||||
|
||||
qboolean standard_quake = true, rogue, hipnotic;
|
||||
bool standard_quake = true, rogue, hipnotic;
|
||||
|
||||
// this graphic needs to be in the pak file to use registered features
|
||||
static uint16_t pop[] =
|
||||
|
@ -150,7 +150,7 @@ void InsertLinkAfter (link_t *l, link_t *after)
|
|||
============================================================================
|
||||
*/
|
||||
|
||||
int q_strcasecmp(const char * s1, const char * s2)
|
||||
int32_t q_strcasecmp(const char * s1, const char * s2)
|
||||
{
|
||||
const char * p1 = s1;
|
||||
const char * p2 = s2;
|
||||
|
@ -167,10 +167,10 @@ int q_strcasecmp(const char * s1, const char * s2)
|
|||
break;
|
||||
} while (c1 == c2);
|
||||
|
||||
return (int)(c1 - c2);
|
||||
return (int32_t)(c1 - c2);
|
||||
}
|
||||
|
||||
int q_strncasecmp(const char *s1, const char *s2, size_t n)
|
||||
int32_t q_strncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
const char * p1 = s1;
|
||||
const char * p2 = s2;
|
||||
|
@ -187,14 +187,14 @@ int q_strncasecmp(const char *s1, const char *s2, size_t n)
|
|||
break;
|
||||
} while (--n > 0);
|
||||
|
||||
return (int)(c1 - c2);
|
||||
return (int32_t)(c1 - c2);
|
||||
}
|
||||
|
||||
//spike -- grabbed this from fte, because its useful to me
|
||||
char *q_strcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
int c1, c2, c2f;
|
||||
int i;
|
||||
int32_t c1, c2, c2f;
|
||||
int32_t i;
|
||||
c2f = *needle;
|
||||
if (c2f >= 'a' && c2f <= 'z')
|
||||
c2f -= ('a' - 'A');
|
||||
|
@ -263,14 +263,14 @@ char *q_strupr (char *str)
|
|||
#define vsnprintf_func vsnprintf
|
||||
#endif
|
||||
|
||||
int q_vsnprintf(char *str, size_t size, const char *format, va_list args)
|
||||
int32_t q_vsnprintf(char *str, size_t size, const char *format, va_list args)
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
|
||||
ret = vsnprintf_func (str, size, format, args);
|
||||
|
||||
if (ret < 0)
|
||||
ret = (int)size;
|
||||
ret = (int32_t)size;
|
||||
if (size == 0) /* no buffer */
|
||||
return ret;
|
||||
if ((size_t)ret >= size)
|
||||
|
@ -279,9 +279,9 @@ int q_vsnprintf(char *str, size_t size, const char *format, va_list args)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int q_snprintf (char *str, size_t size, const char *format, ...)
|
||||
int32_t q_snprintf (char *str, size_t size, const char *format, ...)
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, format);
|
||||
|
@ -291,7 +291,7 @@ int q_snprintf (char *str, size_t size, const char *format, ...)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void Q_memset (void *dest, int fill, size_t count)
|
||||
void Q_memset (void *dest, int32_t fill, size_t count)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
@ -300,7 +300,7 @@ void Q_memset (void *dest, int fill, size_t count)
|
|||
count >>= 2;
|
||||
fill = fill | (fill<<8) | (fill<<16) | (fill<<24);
|
||||
for (i = 0; i < count; i++)
|
||||
((int *)dest)[i] = fill;
|
||||
((int32_t *)dest)[i] = fill;
|
||||
}
|
||||
else
|
||||
for (i = 0; i < count; i++)
|
||||
|
@ -315,14 +315,14 @@ void Q_memcpy (void *dest, const void *src, size_t count)
|
|||
{
|
||||
count >>= 2;
|
||||
for (i = 0; i < count; i++)
|
||||
((int *)dest)[i] = ((int *)src)[i];
|
||||
((int32_t *)dest)[i] = ((int32_t *)src)[i];
|
||||
}
|
||||
else
|
||||
for (i = 0; i < count; i++)
|
||||
((byte *)dest)[i] = ((byte *)src)[i];
|
||||
}
|
||||
|
||||
int Q_memcmp (const void *m1, const void *m2, size_t count)
|
||||
int32_t Q_memcmp (const void *m1, const void *m2, size_t count)
|
||||
{
|
||||
while(count)
|
||||
{
|
||||
|
@ -342,7 +342,7 @@ void Q_strcpy (char *dest, const char *src)
|
|||
*dest++ = 0;
|
||||
}
|
||||
|
||||
void Q_strncpy (char *dest, const char *src, int count)
|
||||
void Q_strncpy (char *dest, const char *src, int32_t count)
|
||||
{
|
||||
while (*src && count--)
|
||||
{
|
||||
|
@ -352,9 +352,9 @@ void Q_strncpy (char *dest, const char *src, int count)
|
|||
*dest++ = 0;
|
||||
}
|
||||
|
||||
int Q_strlen (const char *str)
|
||||
int32_t Q_strlen (const char *str)
|
||||
{
|
||||
int count;
|
||||
int32_t count;
|
||||
|
||||
count = 0;
|
||||
while (str[count])
|
||||
|
@ -365,7 +365,7 @@ int Q_strlen (const char *str)
|
|||
|
||||
char *Q_strrchr(const char *s, char c)
|
||||
{
|
||||
int len = Q_strlen(s);
|
||||
int32_t len = Q_strlen(s);
|
||||
s += len;
|
||||
while (len--)
|
||||
{
|
||||
|
@ -381,7 +381,7 @@ void Q_strcat (char *dest, const char *src)
|
|||
Q_strcpy (dest, src);
|
||||
}
|
||||
|
||||
int Q_strcmp (const char *s1, const char *s2)
|
||||
int32_t Q_strcmp (const char *s1, const char *s2)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
|
@ -396,7 +396,7 @@ int Q_strcmp (const char *s1, const char *s2)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int Q_strncmp (const char *s1, const char *s2, int count)
|
||||
int32_t Q_strncmp (const char *s1, const char *s2, int32_t count)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
|
@ -413,11 +413,11 @@ int Q_strncmp (const char *s1, const char *s2, int count)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int Q_atoi (const char *str)
|
||||
int32_t Q_atoi (const char *str)
|
||||
{
|
||||
int val;
|
||||
int sign;
|
||||
int c;
|
||||
int32_t val;
|
||||
int32_t sign;
|
||||
int32_t c;
|
||||
|
||||
if (*str == '-')
|
||||
{
|
||||
|
@ -475,9 +475,9 @@ int Q_atoi (const char *str)
|
|||
float Q_atof (const char *str)
|
||||
{
|
||||
double val;
|
||||
int sign;
|
||||
int c;
|
||||
int decimal, total;
|
||||
int32_t sign;
|
||||
int32_t c;
|
||||
int32_t decimal, total;
|
||||
|
||||
if (*str == '-')
|
||||
{
|
||||
|
@ -555,12 +555,12 @@ float Q_atof (const char *str)
|
|||
============================================================================
|
||||
*/
|
||||
|
||||
qboolean host_bigendian;
|
||||
bool host_bigendian;
|
||||
|
||||
int16_t (*BigShort) (int16_t l);
|
||||
int16_t (*LittleShort) (int16_t l);
|
||||
int (*BigLong) (int l);
|
||||
int (*LittleLong) (int l);
|
||||
int32_t (*BigLong) (int32_t l);
|
||||
int32_t (*LittleLong) (int32_t l);
|
||||
float (*BigFloat) (float l);
|
||||
float (*LittleFloat) (float l);
|
||||
|
||||
|
@ -579,7 +579,7 @@ int16_t ShortNoSwap (int16_t l)
|
|||
return l;
|
||||
}
|
||||
|
||||
int LongSwap (int l)
|
||||
int32_t LongSwap (int32_t l)
|
||||
{
|
||||
byte b1, b2, b3, b4;
|
||||
|
||||
|
@ -588,10 +588,10 @@ int LongSwap (int l)
|
|||
b3 = (l>>16)&255;
|
||||
b4 = (l>>24)&255;
|
||||
|
||||
return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
|
||||
return ((int32_t)b1<<24) + ((int32_t)b2<<16) + ((int32_t)b3<<8) + b4;
|
||||
}
|
||||
|
||||
int LongNoSwap (int l)
|
||||
int32_t LongNoSwap (int32_t l)
|
||||
{
|
||||
return l;
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ Handles byte ordering and avoids alignment errors
|
|||
// writing functions
|
||||
//
|
||||
|
||||
void MSG_WriteChar (sizebuf_t *sb, int c)
|
||||
void MSG_WriteChar (sizebuf_t *sb, int32_t c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
@ -644,7 +644,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c)
|
|||
buf[0] = c;
|
||||
}
|
||||
|
||||
void MSG_WriteByte (sizebuf_t *sb, int c)
|
||||
void MSG_WriteByte (sizebuf_t *sb, int32_t c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
@ -657,7 +657,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c)
|
|||
buf[0] = c;
|
||||
}
|
||||
|
||||
void MSG_WriteShort (sizebuf_t *sb, int c)
|
||||
void MSG_WriteShort (sizebuf_t *sb, int32_t c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
@ -671,7 +671,7 @@ void MSG_WriteShort (sizebuf_t *sb, int c)
|
|||
buf[1] = c>>8;
|
||||
}
|
||||
|
||||
void MSG_WriteLong (sizebuf_t *sb, int c)
|
||||
void MSG_WriteLong (sizebuf_t *sb, int32_t c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
@ -687,7 +687,7 @@ void MSG_WriteFloat (sizebuf_t *sb, float f)
|
|||
union
|
||||
{
|
||||
float f;
|
||||
int l;
|
||||
int32_t l;
|
||||
} dat;
|
||||
|
||||
dat.f = f;
|
||||
|
@ -714,7 +714,7 @@ void MSG_WriteCoord16 (sizebuf_t *sb, float f)
|
|||
void MSG_WriteCoord24 (sizebuf_t *sb, float f)
|
||||
{
|
||||
MSG_WriteShort (sb, f);
|
||||
MSG_WriteByte (sb, (int)(f*255)%255);
|
||||
MSG_WriteByte (sb, (int32_t)(f*255)%255);
|
||||
}
|
||||
|
||||
//johnfitz -- 32-bit float coords
|
||||
|
@ -740,7 +740,7 @@ void MSG_WriteAngle (sizebuf_t *sb, float f, uint32_t flags)
|
|||
MSG_WriteFloat (sb, f);
|
||||
else if (flags & PRFL_SHORTANGLE)
|
||||
MSG_WriteShort (sb, Q_rint(f * 65536.0 / 360.0) & 65535);
|
||||
else MSG_WriteByte (sb, Q_rint(f * 256.0 / 360.0) & 255); //johnfitz -- use Q_rint instead of (int) }
|
||||
else MSG_WriteByte (sb, Q_rint(f * 256.0 / 360.0) & 255); //johnfitz -- use Q_rint instead of (int32_t) }
|
||||
}
|
||||
|
||||
//johnfitz -- for PROTOCOL_FITZQUAKE
|
||||
|
@ -755,8 +755,8 @@ void MSG_WriteAngle16 (sizebuf_t *sb, float f, uint32_t flags)
|
|||
//
|
||||
// reading functions
|
||||
//
|
||||
int msg_readcount;
|
||||
qboolean msg_badread;
|
||||
int32_t msg_readcount;
|
||||
bool msg_badread;
|
||||
|
||||
void MSG_BeginReading (void)
|
||||
{
|
||||
|
@ -765,9 +765,9 @@ void MSG_BeginReading (void)
|
|||
}
|
||||
|
||||
// returns -1 and sets msg_badread if no more characters are available
|
||||
int MSG_ReadChar (void)
|
||||
int32_t MSG_ReadChar (void)
|
||||
{
|
||||
int c;
|
||||
int32_t c;
|
||||
|
||||
if (msg_readcount+1 > net_message.cursize)
|
||||
{
|
||||
|
@ -781,9 +781,9 @@ int MSG_ReadChar (void)
|
|||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadByte (void)
|
||||
int32_t MSG_ReadByte (void)
|
||||
{
|
||||
int c;
|
||||
int32_t c;
|
||||
|
||||
if (msg_readcount+1 > net_message.cursize)
|
||||
{
|
||||
|
@ -797,9 +797,9 @@ int MSG_ReadByte (void)
|
|||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadShort (void)
|
||||
int32_t MSG_ReadShort (void)
|
||||
{
|
||||
int c;
|
||||
int32_t c;
|
||||
|
||||
if (msg_readcount+2 > net_message.cursize)
|
||||
{
|
||||
|
@ -815,9 +815,9 @@ int MSG_ReadShort (void)
|
|||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadLong (void)
|
||||
int32_t MSG_ReadLong (void)
|
||||
{
|
||||
int c;
|
||||
int32_t c;
|
||||
|
||||
if (msg_readcount+4 > net_message.cursize)
|
||||
{
|
||||
|
@ -841,7 +841,7 @@ float MSG_ReadFloat (void)
|
|||
{
|
||||
byte b[4];
|
||||
float f;
|
||||
int l;
|
||||
int32_t l;
|
||||
} dat;
|
||||
|
||||
dat.b[0] = net_message.data[msg_readcount];
|
||||
|
@ -858,7 +858,7 @@ float MSG_ReadFloat (void)
|
|||
const char *MSG_ReadString (void)
|
||||
{
|
||||
static char string[2048];
|
||||
int c;
|
||||
int32_t c;
|
||||
size_t l;
|
||||
|
||||
l = 0;
|
||||
|
@ -925,7 +925,7 @@ float MSG_ReadAngle16 (uint32_t flags)
|
|||
|
||||
//===========================================================================
|
||||
|
||||
void SZ_Alloc (sizebuf_t *buf, int startsize)
|
||||
void SZ_Alloc (sizebuf_t *buf, int32_t startsize)
|
||||
{
|
||||
if (startsize < 256)
|
||||
startsize = 256;
|
||||
|
@ -948,7 +948,7 @@ void SZ_Clear (sizebuf_t *buf)
|
|||
buf->cursize = 0;
|
||||
}
|
||||
|
||||
void *SZ_GetSpace (sizebuf_t *buf, int length)
|
||||
void *SZ_GetSpace (sizebuf_t *buf, int32_t length)
|
||||
{
|
||||
void *data;
|
||||
|
||||
|
@ -958,7 +958,7 @@ void *SZ_GetSpace (sizebuf_t *buf, int length)
|
|||
Host_Error ("SZ_GetSpace: overflow without allowoverflow set"); // ericw -- made Host_Error to be less annoying
|
||||
|
||||
if (length > buf->maxsize)
|
||||
Sys_Error ("SZ_GetSpace: %i is > full buffer size", length);
|
||||
Sys_Error ("SZ_GetSpace: %" PRIi32 " is > full buffer size", length);
|
||||
|
||||
buf->overflowed = true;
|
||||
Con_Printf ("SZ_GetSpace: overflow");
|
||||
|
@ -971,14 +971,14 @@ void *SZ_GetSpace (sizebuf_t *buf, int length)
|
|||
return data;
|
||||
}
|
||||
|
||||
void SZ_Write (sizebuf_t *buf, const void *data, int length)
|
||||
void SZ_Write (sizebuf_t *buf, const void *data, int32_t length)
|
||||
{
|
||||
Q_memcpy (SZ_GetSpace(buf,length),data,length);
|
||||
}
|
||||
|
||||
void SZ_Print (sizebuf_t *buf, const char *data)
|
||||
{
|
||||
int len = Q_strlen(data) + 1;
|
||||
int32_t len = Q_strlen(data) + 1;
|
||||
|
||||
if (buf->data[buf->cursize-1])
|
||||
{ /* no trailing 0 */
|
||||
|
@ -1019,7 +1019,7 @@ COM_StripExtension
|
|||
*/
|
||||
void COM_StripExtension (const char *in, char *out, size_t outsize)
|
||||
{
|
||||
int length;
|
||||
int32_t length;
|
||||
|
||||
if (!*in)
|
||||
{
|
||||
|
@ -1028,7 +1028,7 @@ void COM_StripExtension (const char *in, char *out, size_t outsize)
|
|||
}
|
||||
if (in != out) /* copy when not in-place editing */
|
||||
q_strlcpy (out, in, outsize);
|
||||
length = (int)strlen(out) - 1;
|
||||
length = (int32_t)strlen(out) - 1;
|
||||
while (length > 0 && out[length] != '.')
|
||||
{
|
||||
--length;
|
||||
|
@ -1162,8 +1162,8 @@ Parse a token out of a string
|
|||
*/
|
||||
const char *COM_Parse (const char *data)
|
||||
{
|
||||
int c;
|
||||
int len;
|
||||
int32_t c;
|
||||
int32_t len;
|
||||
|
||||
len = 0;
|
||||
com_token[0] = 0;
|
||||
|
@ -1251,9 +1251,9 @@ Returns the position (1 to argc-1) in the program's argument list
|
|||
where the given parameter apears, or 0 if not present
|
||||
================
|
||||
*/
|
||||
int COM_CheckParm (const char *parm)
|
||||
int32_t COM_CheckParm (const char *parm)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 1; i < com_argc; i++)
|
||||
{
|
||||
|
@ -1278,9 +1278,9 @@ being registered.
|
|||
*/
|
||||
static void COM_CheckRegistered (void)
|
||||
{
|
||||
int h;
|
||||
int32_t h;
|
||||
uint16_t check[128];
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
COM_OpenFile("gfx/pop.lmp", &h, NULL);
|
||||
|
||||
|
@ -1323,9 +1323,9 @@ static void COM_CheckRegistered (void)
|
|||
COM_InitArgv
|
||||
================
|
||||
*/
|
||||
void COM_InitArgv (int argc, char **argv)
|
||||
void COM_InitArgv (int32_t argc, char **argv)
|
||||
{
|
||||
int i, j, n;
|
||||
int32_t i, j, n;
|
||||
|
||||
// reconstitute the command line for the cmdline externally visible cvar
|
||||
n = 0;
|
||||
|
@ -1391,7 +1391,7 @@ COM_Init
|
|||
*/
|
||||
void COM_Init (void)
|
||||
{
|
||||
int i = 0x12345678;
|
||||
int32_t i = 0x12345678;
|
||||
/* U N I X */
|
||||
|
||||
/*
|
||||
|
@ -1454,7 +1454,7 @@ FIXME: make this buffer size safe someday
|
|||
static char *get_va_buffer(void)
|
||||
{
|
||||
static char va_buffers[VA_NUM_BUFFS][VA_BUFFERLEN];
|
||||
static int buffer_idx = 0;
|
||||
static int32_t buffer_idx = 0;
|
||||
buffer_idx = (buffer_idx + 1) & (VA_NUM_BUFFS - 1);
|
||||
return va_buffers[buffer_idx];
|
||||
}
|
||||
|
@ -1480,7 +1480,7 @@ QUAKE FILESYSTEM
|
|||
=============================================================================
|
||||
*/
|
||||
|
||||
int com_filesize;
|
||||
int32_t com_filesize;
|
||||
|
||||
|
||||
//
|
||||
|
@ -1489,21 +1489,21 @@ int com_filesize;
|
|||
typedef struct
|
||||
{
|
||||
char name[56];
|
||||
int filepos, filelen;
|
||||
int32_t filepos, filelen;
|
||||
} dpackfile_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char id[4];
|
||||
int dirofs;
|
||||
int dirlen;
|
||||
int32_t dirofs;
|
||||
int32_t dirlen;
|
||||
} dpackheader_t;
|
||||
|
||||
#define MAX_FILES_IN_PACK 2048
|
||||
|
||||
char com_gamedir[MAX_OSPATH];
|
||||
char com_basedir[MAX_OSPATH];
|
||||
int file_from_pak; // ZOID: global indicating that file came from a pak
|
||||
int32_t file_from_pak; // ZOID: global indicating that file came from a pak
|
||||
|
||||
searchpath_t *com_searchpaths;
|
||||
searchpath_t *com_base_searchpaths;
|
||||
|
@ -1522,7 +1522,7 @@ static void COM_Path_f (void)
|
|||
{
|
||||
if (s->pack)
|
||||
{
|
||||
Con_Printf ("%s (%i files)\n", s->pack->filename, s->pack->numfiles);
|
||||
Con_Printf ("%s (%" PRIi32 " files)\n", s->pack->filename, s->pack->numfiles);
|
||||
}
|
||||
else
|
||||
Con_Printf ("%s\n", s->filename);
|
||||
|
@ -1536,9 +1536,9 @@ COM_WriteFile
|
|||
The filename will be prefixed by the current game directory
|
||||
============
|
||||
*/
|
||||
void COM_WriteFile (const char *filename, const void *data, int len)
|
||||
void COM_WriteFile (const char *filename, const void *data, int32_t len)
|
||||
{
|
||||
int handle;
|
||||
int32_t handle;
|
||||
char name[MAX_OSPATH];
|
||||
|
||||
Sys_mkdir (com_gamedir); //johnfitz -- if we've switched to a nonexistant gamedir, create it now so we don't crash
|
||||
|
@ -1604,13 +1604,13 @@ If neither of file or handle is set, this
|
|||
can be used for detecting a file's presence.
|
||||
===========
|
||||
*/
|
||||
static int COM_FindFile (const char *filename, int *handle, FILE **file,
|
||||
static int32_t COM_FindFile (const char *filename, int32_t *handle, FILE **file,
|
||||
uint32_t *path_id)
|
||||
{
|
||||
searchpath_t *search;
|
||||
char netpath[MAX_OSPATH];
|
||||
pack_t *pak;
|
||||
int i, findtime;
|
||||
int32_t i, findtime;
|
||||
|
||||
if (file && handle)
|
||||
Sys_Error ("COM_FindFile: both handle and file set");
|
||||
|
@ -1711,9 +1711,9 @@ COM_FileExists
|
|||
Returns whether the file is found in the quake filesystem.
|
||||
===========
|
||||
*/
|
||||
qboolean 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;
|
||||
}
|
||||
|
||||
|
@ -1726,7 +1726,7 @@ returns a handle and a length
|
|||
it may actually be inside a pak file
|
||||
===========
|
||||
*/
|
||||
int COM_OpenFile (const char *filename, int *handle, uint32_t *path_id)
|
||||
int32_t COM_OpenFile (const char *filename, int32_t *handle, uint32_t *path_id)
|
||||
{
|
||||
return COM_FindFile (filename, handle, NULL, path_id);
|
||||
}
|
||||
|
@ -1739,7 +1739,7 @@ If the requested file is inside a packfile, a new FILE * will be opened
|
|||
into the file.
|
||||
===========
|
||||
*/
|
||||
int COM_FOpenFile (const char *filename, FILE **file, uint32_t *path_id)
|
||||
int32_t COM_FOpenFile (const char *filename, FILE **file, uint32_t *path_id)
|
||||
{
|
||||
return COM_FindFile (filename, NULL, file, path_id);
|
||||
}
|
||||
|
@ -1751,7 +1751,7 @@ COM_CloseFile
|
|||
If it is a pak file handle, don't really close it
|
||||
============
|
||||
*/
|
||||
void COM_CloseFile (int h)
|
||||
void COM_CloseFile (int32_t h)
|
||||
{
|
||||
searchpath_t *s;
|
||||
|
||||
|
@ -1780,14 +1780,14 @@ Allways appends a 0 byte.
|
|||
|
||||
static byte *loadbuf;
|
||||
static cache_user_t *loadcache;
|
||||
static int loadsize;
|
||||
static int32_t loadsize;
|
||||
|
||||
byte *COM_LoadFile (const char *path, int usehunk, uint32_t *path_id)
|
||||
byte *COM_LoadFile (const char *path, int32_t usehunk, uint32_t *path_id)
|
||||
{
|
||||
int h;
|
||||
int32_t h;
|
||||
byte *buf;
|
||||
char base[32];
|
||||
int len;
|
||||
int32_t len;
|
||||
|
||||
buf = NULL; // quiet compiler warning
|
||||
|
||||
|
@ -1859,7 +1859,7 @@ void COM_LoadCacheFile (const char *path, struct cache_user_s *cu, uint32_t *pat
|
|||
}
|
||||
|
||||
// uses temp hunk if larger than bufsize
|
||||
byte *COM_LoadStackFile (const char *path, void *buffer, int bufsize, uint32_t *path_id)
|
||||
byte *COM_LoadStackFile (const char *path, void *buffer, int32_t bufsize, uint32_t *path_id)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
@ -1912,23 +1912,23 @@ byte *COM_LoadMallocFile_TextMode_OSPath (const char *path, long *len_out)
|
|||
return data;
|
||||
}
|
||||
|
||||
const char *COM_ParseIntNewline(const char *buffer, int *value)
|
||||
const char *COM_ParseIntNewline(const char *buffer, int32_t *value)
|
||||
{
|
||||
int consumed = 0;
|
||||
sscanf (buffer, "%i\n%n", value, &consumed);
|
||||
int32_t consumed = 0;
|
||||
sscanf (buffer, "%" PRIi32 "\n%n", value, &consumed);
|
||||
return buffer + consumed;
|
||||
}
|
||||
|
||||
const char *COM_ParseFloatNewline(const char *buffer, float *value)
|
||||
{
|
||||
int consumed = 0;
|
||||
int32_t consumed = 0;
|
||||
sscanf (buffer, "%f\n%n", value, &consumed);
|
||||
return buffer + consumed;
|
||||
}
|
||||
|
||||
const char *COM_ParseStringNewline(const char *buffer)
|
||||
{
|
||||
int consumed = 0;
|
||||
int32_t consumed = 0;
|
||||
com_token[0] = '\0';
|
||||
sscanf (buffer, "%1023s\n%n", com_token, &consumed);
|
||||
return buffer + consumed;
|
||||
|
@ -1947,11 +1947,11 @@ of the list so they override previous pack files.
|
|||
static pack_t *COM_LoadPackFile (const char *packfile)
|
||||
{
|
||||
dpackheader_t header;
|
||||
int i;
|
||||
int32_t i;
|
||||
packfile_t *newfiles;
|
||||
int numpackfiles;
|
||||
int32_t numpackfiles;
|
||||
pack_t *pack;
|
||||
int packhandle;
|
||||
int32_t packhandle;
|
||||
dpackfile_t info[MAX_FILES_IN_PACK];
|
||||
uint16_t crc;
|
||||
|
||||
|
@ -1969,7 +1969,7 @@ static pack_t *COM_LoadPackFile (const char *packfile)
|
|||
|
||||
if (header.dirlen < 0 || header.dirofs < 0)
|
||||
{
|
||||
Sys_Error ("Invalid packfile %s (dirlen: %i, dirofs: %i)",
|
||||
Sys_Error ("Invalid packfile %s (dirlen: %" PRIi32 ", dirofs: %" PRIi32 ")",
|
||||
packfile, header.dirlen, header.dirofs);
|
||||
}
|
||||
if (!numpackfiles)
|
||||
|
@ -1979,7 +1979,7 @@ static pack_t *COM_LoadPackFile (const char *packfile)
|
|||
return NULL;
|
||||
}
|
||||
if (numpackfiles > MAX_FILES_IN_PACK)
|
||||
Sys_Error ("%s has %i files", packfile, numpackfiles);
|
||||
Sys_Error ("%s has %" PRIi32 " files", packfile, numpackfiles);
|
||||
|
||||
if (numpackfiles != PAK0_COUNT)
|
||||
com_modified = true; // not the original file
|
||||
|
@ -2010,7 +2010,7 @@ static pack_t *COM_LoadPackFile (const char *packfile)
|
|||
pack->numfiles = numpackfiles;
|
||||
pack->files = newfiles;
|
||||
|
||||
//Sys_Printf ("Added packfile %s (%i files)\n", packfile, numpackfiles);
|
||||
//Sys_Printf ("Added packfile %s (%" PRIi32 " files)\n", packfile, numpackfiles);
|
||||
return pack;
|
||||
}
|
||||
|
||||
|
@ -2021,12 +2021,12 @@ COM_AddGameDirectory -- johnfitz -- modified based on topaz's tutorial
|
|||
*/
|
||||
static void COM_AddGameDirectory (const char *base, const char *dir)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
uint32_t path_id;
|
||||
searchpath_t *search;
|
||||
pack_t *pak, *qspak;
|
||||
char pakfile[MAX_OSPATH];
|
||||
qboolean been_here = false;
|
||||
bool been_here = false;
|
||||
|
||||
q_strlcpy (com_gamedir, va("%s/%s", base, dir), sizeof(com_gamedir));
|
||||
|
||||
|
@ -2046,12 +2046,12 @@ _add_path:
|
|||
// add any pak files in the format pak0.pak pak1.pak, ...
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
q_snprintf (pakfile, sizeof(pakfile), "%s/pak%i.pak", com_gamedir, i);
|
||||
q_snprintf (pakfile, sizeof(pakfile), "%s/pak%" PRIi32 ".pak", com_gamedir, i);
|
||||
pak = COM_LoadPackFile (pakfile);
|
||||
if (i != 0 || path_id != 1 || fitzmode)
|
||||
qspak = NULL;
|
||||
else {
|
||||
qboolean old = com_modified;
|
||||
bool old = com_modified;
|
||||
if (been_here) base = host_parms->userdir;
|
||||
q_snprintf (pakfile, sizeof(pakfile), "%s/quakespasm.pak", base);
|
||||
qspak = COM_LoadPackFile (pakfile);
|
||||
|
@ -2227,7 +2227,7 @@ COM_InitFilesystem
|
|||
*/
|
||||
void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
|
||||
Cvar_RegisterVariable (®istered);
|
||||
Cvar_RegisterVariable (&cmdline);
|
||||
|
@ -2334,11 +2334,11 @@ size_t FS_fread(void *ptr, size_t size, size_t nmemb, fshandle_t *fh)
|
|||
return nmemb_read;
|
||||
}
|
||||
|
||||
int FS_fseek(fshandle_t *fh, long offset, int whence)
|
||||
int32_t FS_fseek(fshandle_t *fh, long offset, int32_t whence)
|
||||
{
|
||||
/* I don't care about 64 bit off_t or fseeko() here.
|
||||
* the quake/hexen2 file system is 32 bits, anyway. */
|
||||
int ret;
|
||||
int32_t ret;
|
||||
|
||||
if (!fh) {
|
||||
errno = EBADF;
|
||||
|
@ -2378,7 +2378,7 @@ int FS_fseek(fshandle_t *fh, long offset, int whence)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int FS_fclose(fshandle_t *fh)
|
||||
int32_t FS_fclose(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
errno = EBADF;
|
||||
|
@ -2404,7 +2404,7 @@ void FS_rewind(fshandle_t *fh)
|
|||
fh->pos = 0;
|
||||
}
|
||||
|
||||
int FS_feof(fshandle_t *fh)
|
||||
int32_t FS_feof(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
errno = EBADF;
|
||||
|
@ -2415,7 +2415,7 @@ int FS_feof(fshandle_t *fh)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int FS_ferror(fshandle_t *fh)
|
||||
int32_t FS_ferror(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
errno = EBADF;
|
||||
|
@ -2424,7 +2424,7 @@ int FS_ferror(fshandle_t *fh)
|
|||
return ferror(fh->file);
|
||||
}
|
||||
|
||||
int FS_fgetc(fshandle_t *fh)
|
||||
int32_t FS_fgetc(fshandle_t *fh)
|
||||
{
|
||||
if (!fh) {
|
||||
errno = EBADF;
|
||||
|
@ -2436,7 +2436,7 @@ int FS_fgetc(fshandle_t *fh)
|
|||
return fgetc(fh->file);
|
||||
}
|
||||
|
||||
char *FS_fgets(char *s, int size, fshandle_t *fh)
|
||||
char *FS_fgets(char *s, int32_t size, fshandle_t *fh)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
|
|
116
source/common.h
116
source/common.h
|
@ -49,18 +49,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
typedef struct sizebuf_s
|
||||
{
|
||||
qboolean allowoverflow; // if false, do a Sys_Error
|
||||
qboolean overflowed; // set to true if the buffer size failed
|
||||
bool allowoverflow; // if false, do a Sys_Error
|
||||
bool overflowed; // set to true if the buffer size failed
|
||||
byte *data;
|
||||
int maxsize;
|
||||
int cursize;
|
||||
int32_t maxsize;
|
||||
int32_t cursize;
|
||||
} sizebuf_t;
|
||||
|
||||
void SZ_Alloc (sizebuf_t *buf, int startsize);
|
||||
void SZ_Alloc (sizebuf_t *buf, int32_t startsize);
|
||||
void SZ_Free (sizebuf_t *buf);
|
||||
void SZ_Clear (sizebuf_t *buf);
|
||||
void *SZ_GetSpace (sizebuf_t *buf, int length);
|
||||
void SZ_Write (sizebuf_t *buf, const void *data, int length);
|
||||
void *SZ_GetSpace (sizebuf_t *buf, int32_t length);
|
||||
void SZ_Write (sizebuf_t *buf, const void *data, int32_t length);
|
||||
void SZ_Print (sizebuf_t *buf, const char *data); // strcats onto the sizebuf
|
||||
|
||||
//============================================================================
|
||||
|
@ -83,35 +83,35 @@ void InsertLinkAfter (link_t *l, link_t *after);
|
|||
|
||||
//============================================================================
|
||||
|
||||
extern qboolean host_bigendian;
|
||||
extern bool host_bigendian;
|
||||
|
||||
extern int16_t (*BigShort) (int16_t l);
|
||||
extern int16_t (*LittleShort) (int16_t l);
|
||||
extern int (*BigLong) (int l);
|
||||
extern int (*LittleLong) (int l);
|
||||
extern int32_t (*BigLong) (int32_t l);
|
||||
extern int32_t (*LittleLong) (int32_t l);
|
||||
extern float (*BigFloat) (float l);
|
||||
extern float (*LittleFloat) (float l);
|
||||
|
||||
//============================================================================
|
||||
|
||||
void MSG_WriteChar (sizebuf_t *sb, int c);
|
||||
void MSG_WriteByte (sizebuf_t *sb, int c);
|
||||
void MSG_WriteShort (sizebuf_t *sb, int c);
|
||||
void MSG_WriteLong (sizebuf_t *sb, int c);
|
||||
void MSG_WriteChar (sizebuf_t *sb, int32_t c);
|
||||
void MSG_WriteByte (sizebuf_t *sb, int32_t c);
|
||||
void MSG_WriteShort (sizebuf_t *sb, int32_t c);
|
||||
void MSG_WriteLong (sizebuf_t *sb, int32_t c);
|
||||
void MSG_WriteFloat (sizebuf_t *sb, float f);
|
||||
void MSG_WriteString (sizebuf_t *sb, const char *s);
|
||||
void MSG_WriteCoord (sizebuf_t *sb, float f, uint32_t flags);
|
||||
void MSG_WriteAngle (sizebuf_t *sb, float f, uint32_t flags);
|
||||
void MSG_WriteAngle16 (sizebuf_t *sb, float f, uint32_t flags); //johnfitz
|
||||
|
||||
extern int msg_readcount;
|
||||
extern qboolean msg_badread; // set if a read goes beyond end of message
|
||||
extern int32_t msg_readcount;
|
||||
extern bool msg_badread; // set if a read goes beyond end of message
|
||||
|
||||
void MSG_BeginReading (void);
|
||||
int MSG_ReadChar (void);
|
||||
int MSG_ReadByte (void);
|
||||
int MSG_ReadShort (void);
|
||||
int MSG_ReadLong (void);
|
||||
int32_t MSG_ReadChar (void);
|
||||
int32_t MSG_ReadByte (void);
|
||||
int32_t MSG_ReadShort (void);
|
||||
int32_t MSG_ReadLong (void);
|
||||
float MSG_ReadFloat (void);
|
||||
const char *MSG_ReadString (void);
|
||||
|
||||
|
@ -121,25 +121,25 @@ float MSG_ReadAngle16 (uint32_t flags); //johnfitz
|
|||
|
||||
//============================================================================
|
||||
|
||||
void Q_memset (void *dest, int fill, size_t count);
|
||||
void Q_memset (void *dest, int32_t fill, size_t count);
|
||||
void Q_memcpy (void *dest, const void *src, size_t count);
|
||||
int Q_memcmp (const void *m1, const void *m2, size_t count);
|
||||
int32_t Q_memcmp (const void *m1, const void *m2, size_t count);
|
||||
void Q_strcpy (char *dest, const char *src);
|
||||
void Q_strncpy (char *dest, const char *src, int count);
|
||||
int Q_strlen (const char *str);
|
||||
void Q_strncpy (char *dest, const char *src, int32_t count);
|
||||
int32_t Q_strlen (const char *str);
|
||||
char *Q_strrchr (const char *s, char c);
|
||||
void Q_strcat (char *dest, const char *src);
|
||||
int Q_strcmp (const char *s1, const char *s2);
|
||||
int Q_strncmp (const char *s1, const char *s2, int count);
|
||||
int Q_atoi (const char *str);
|
||||
int32_t Q_strcmp (const char *s1, const char *s2);
|
||||
int32_t Q_strncmp (const char *s1, const char *s2, int32_t count);
|
||||
int32_t Q_atoi (const char *str);
|
||||
float Q_atof (const char *str);
|
||||
|
||||
|
||||
#include "strl_fn.h"
|
||||
|
||||
/* locale-insensitive strcasecmp replacement functions: */
|
||||
extern int q_strcasecmp (const char * s1, const char * s2);
|
||||
extern int q_strncasecmp (const char *s1, const char *s2, size_t n);
|
||||
extern int32_t q_strcasecmp (const char * s1, const char * s2);
|
||||
extern int32_t q_strncasecmp (const char *s1, const char *s2, size_t n);
|
||||
|
||||
/* locale-insensitive case-insensitive alternative to strstr */
|
||||
extern char *q_strcasestr(const char *haystack, const char *needle);
|
||||
|
@ -149,31 +149,31 @@ extern char *q_strlwr (char *str);
|
|||
extern char *q_strupr (char *str);
|
||||
|
||||
/* snprintf, vsnprintf : always use our versions. */
|
||||
extern int q_snprintf (char *str, size_t size, const char *format, ...) FUNC_PRINTF(3,4);
|
||||
extern int q_vsnprintf(char *str, size_t size, const char *format, va_list args) FUNC_PRINTF(3,0);
|
||||
extern int32_t q_snprintf (char *str, size_t size, const char *format, ...) FUNC_PRINTF(3,4);
|
||||
extern int32_t q_vsnprintf(char *str, size_t size, const char *format, va_list args) FUNC_PRINTF(3,0);
|
||||
|
||||
//============================================================================
|
||||
|
||||
extern char com_token[1024];
|
||||
extern qboolean com_eof;
|
||||
extern bool com_eof;
|
||||
|
||||
const char *COM_Parse (const char *data);
|
||||
|
||||
|
||||
extern int com_argc;
|
||||
extern int32_t com_argc;
|
||||
extern char **com_argv;
|
||||
|
||||
extern int safemode;
|
||||
extern int32_t safemode;
|
||||
/* safe mode: in true, the engine will behave as if one
|
||||
of these arguments were actually on the command line:
|
||||
-nosound, -nocdaudio, -nomidi, -stdvid, -dibonly,
|
||||
-nomouse, -nojoy, -nolan
|
||||
*/
|
||||
|
||||
int COM_CheckParm (const char *parm);
|
||||
int32_t COM_CheckParm (const char *parm);
|
||||
|
||||
void COM_Init (void);
|
||||
void COM_InitArgv (int argc, char **argv);
|
||||
void COM_InitArgv (int32_t argc, char **argv);
|
||||
void COM_InitFilesystem (void);
|
||||
|
||||
const char *COM_SkipPath (const char *pathname);
|
||||
|
@ -197,14 +197,14 @@ char *va (const char *format, ...) FUNC_PRINTF(1,2);
|
|||
typedef struct
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
int filepos, filelen;
|
||||
int32_t filepos, filelen;
|
||||
} packfile_t;
|
||||
|
||||
typedef struct pack_s
|
||||
{
|
||||
char filename[MAX_OSPATH];
|
||||
int handle;
|
||||
int numfiles;
|
||||
int32_t handle;
|
||||
int32_t numfiles;
|
||||
packfile_t *files;
|
||||
} pack_t;
|
||||
|
||||
|
@ -221,23 +221,23 @@ typedef struct searchpath_s
|
|||
extern searchpath_t *com_searchpaths;
|
||||
extern searchpath_t *com_base_searchpaths;
|
||||
|
||||
extern int com_filesize;
|
||||
extern int32_t com_filesize;
|
||||
struct cache_user_s;
|
||||
|
||||
extern char com_basedir[MAX_OSPATH];
|
||||
extern char com_gamedir[MAX_OSPATH];
|
||||
extern int file_from_pak; // global indicating that file came from a pak
|
||||
extern int32_t file_from_pak; // global indicating that file came from a pak
|
||||
|
||||
void COM_WriteFile (const char *filename, const void *data, int len);
|
||||
int COM_OpenFile (const char *filename, int *handle, uint32_t *path_id);
|
||||
int COM_FOpenFile (const char *filename, FILE **file, uint32_t *path_id);
|
||||
qboolean COM_FileExists (const char *filename, uint32_t *path_id);
|
||||
void COM_CloseFile (int h);
|
||||
void COM_WriteFile (const char *filename, const void *data, int32_t len);
|
||||
int32_t COM_OpenFile (const char *filename, int32_t *handle, uint32_t *path_id);
|
||||
int32_t COM_FOpenFile (const char *filename, FILE **file, uint32_t *path_id);
|
||||
bool COM_FileExists (const char *filename, uint32_t *path_id);
|
||||
void COM_CloseFile (int32_t h);
|
||||
|
||||
// these procedures open a file using COM_FindFile and loads it into a proper
|
||||
// buffer. the buffer is allocated with a total size of com_filesize + 1. the
|
||||
// procedures differ by their buffer allocation method.
|
||||
byte *COM_LoadStackFile (const char *path, void *buffer, int bufsize,
|
||||
byte *COM_LoadStackFile (const char *path, void *buffer, int32_t bufsize,
|
||||
uint32_t *path_id);
|
||||
// uses the specified stack stack buffer with the specified size
|
||||
// of bufsize. if bufsize is too short, uses temp hunk. the bufsize
|
||||
|
@ -259,10 +259,10 @@ byte *COM_LoadMallocFile (const char *path, uint32_t *path_id);
|
|||
// Loads in "t" mode so CRLF to LF translation is performed on Windows.
|
||||
byte *COM_LoadMallocFile_TextMode_OSPath (const char *path, long *len_out);
|
||||
|
||||
// Attempts to parse an int, followed by a newline.
|
||||
// Attempts to parse an int32_t, followed by a newline.
|
||||
// Returns advanced buffer position.
|
||||
// Doesn't signal parsing failure, but this is not needed for savegame loading.
|
||||
const char *COM_ParseIntNewline(const char *buffer, int *value);
|
||||
const char *COM_ParseIntNewline(const char *buffer, int32_t *value);
|
||||
|
||||
// Attempts to parse a float followed by a newline.
|
||||
// Returns advanced buffer position.
|
||||
|
@ -281,27 +281,27 @@ const char *COM_ParseStringNewline(const char *buffer);
|
|||
typedef struct _fshandle_t
|
||||
{
|
||||
FILE *file;
|
||||
qboolean pak; /* is the file read from a pak */
|
||||
bool pak; /* is the file read from a pak */
|
||||
long start; /* file or data start position */
|
||||
long length; /* file or data size */
|
||||
long pos; /* current position relative to start */
|
||||
} fshandle_t;
|
||||
|
||||
size_t FS_fread(void *ptr, size_t size, size_t nmemb, fshandle_t *fh);
|
||||
int FS_fseek(fshandle_t *fh, long offset, int whence);
|
||||
int32_t FS_fseek(fshandle_t *fh, long offset, int32_t whence);
|
||||
long FS_ftell(fshandle_t *fh);
|
||||
void FS_rewind(fshandle_t *fh);
|
||||
int FS_feof(fshandle_t *fh);
|
||||
int FS_ferror(fshandle_t *fh);
|
||||
int FS_fclose(fshandle_t *fh);
|
||||
int FS_fgetc(fshandle_t *fh);
|
||||
char *FS_fgets(char *s, int size, fshandle_t *fh);
|
||||
int32_t FS_feof(fshandle_t *fh);
|
||||
int32_t FS_ferror(fshandle_t *fh);
|
||||
int32_t FS_fclose(fshandle_t *fh);
|
||||
int32_t FS_fgetc(fshandle_t *fh);
|
||||
char *FS_fgets(char *s, int32_t size, fshandle_t *fh);
|
||||
long FS_filelength (fshandle_t *fh);
|
||||
|
||||
|
||||
extern struct cvar_s registered;
|
||||
extern qboolean standard_quake, rogue, hipnotic;
|
||||
extern qboolean fitzmode;
|
||||
extern bool standard_quake, rogue, hipnotic;
|
||||
extern bool fitzmode;
|
||||
/* if true, run in fitzquake mode disabling custom quakespasm hacks */
|
||||
|
||||
#endif /* _Q_COMMON_H */
|
||||
|
|
|
@ -32,21 +32,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#endif
|
||||
#include "quakedef.h"
|
||||
|
||||
int con_linewidth;
|
||||
int32_t con_linewidth;
|
||||
|
||||
float con_cursorspeed = 4;
|
||||
|
||||
#define CON_TEXTSIZE (1024 * 1024) //ericw -- was 65536. johnfitz -- new default size
|
||||
#define CON_MINSIZE 16384 //johnfitz -- old default, now the minimum size
|
||||
|
||||
int con_buffersize; //johnfitz -- user can now override default
|
||||
int32_t con_buffersize; //johnfitz -- user can now override default
|
||||
|
||||
qboolean con_forcedup; // because no entities to refresh
|
||||
bool con_forcedup; // because no entities to refresh
|
||||
|
||||
int con_totallines; // total lines in console scrollback
|
||||
int con_backscroll; // lines up from bottom to display
|
||||
int con_current; // where next message will be printed
|
||||
int con_x; // offset in current line for next print
|
||||
int32_t con_totallines; // total lines in console scrollback
|
||||
int32_t con_backscroll; // lines up from bottom to display
|
||||
int32_t con_current; // where next message will be printed
|
||||
int32_t con_x; // offset in current line for next print
|
||||
char *con_text = NULL;
|
||||
|
||||
cvar_t con_notifytime = {"con_notifytime","3",CVAR_NONE}; //seconds
|
||||
|
@ -58,11 +58,11 @@ char con_lastcenterstring[1024]; //johnfitz
|
|||
float con_times[NUM_CON_TIMES]; // realtime time the line was generated
|
||||
// for transparent notify lines
|
||||
|
||||
int con_vislines;
|
||||
int32_t con_vislines;
|
||||
|
||||
qboolean con_debuglog = false;
|
||||
bool con_debuglog = false;
|
||||
|
||||
qboolean con_initialized;
|
||||
bool con_initialized;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -72,12 +72,12 @@ Con_Quakebar -- johnfitz -- returns a bar of the desired length, but never wider
|
|||
includes a newline, unless len >= con_linewidth.
|
||||
================
|
||||
*/
|
||||
const char *Con_Quakebar (int len)
|
||||
const char *Con_Quakebar (int32_t len)
|
||||
{
|
||||
static char bar[42];
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
len = q_min(len, (int)sizeof(bar) - 2);
|
||||
len = q_min(len, (int32_t)sizeof(bar) - 2);
|
||||
len = q_min(len, con_linewidth);
|
||||
|
||||
bar[0] = '\35';
|
||||
|
@ -101,7 +101,7 @@ const char *Con_Quakebar (int len)
|
|||
Con_ToggleConsole_f
|
||||
================
|
||||
*/
|
||||
extern int history_line; //johnfitz
|
||||
extern int32_t history_line; //johnfitz
|
||||
|
||||
void Con_ToggleConsole_f (void)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ Con_Dump_f -- johnfitz -- adapted from quake2 source
|
|||
*/
|
||||
static void Con_Dump_f (void)
|
||||
{
|
||||
int l, x;
|
||||
int32_t l, x;
|
||||
const char *line;
|
||||
FILE *f;
|
||||
char buffer[1024];
|
||||
|
@ -207,7 +207,7 @@ Con_ClearNotify
|
|||
*/
|
||||
void Con_ClearNotify (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < NUM_CON_TIMES; i++)
|
||||
con_times[i] = 0;
|
||||
|
@ -250,9 +250,9 @@ If the line width has changed, reformat the buffer.
|
|||
*/
|
||||
void Con_CheckResize (void)
|
||||
{
|
||||
int i, j, width, oldwidth, oldtotallines, numlines, numchars;
|
||||
int32_t i, j, width, oldwidth, oldtotallines, numlines, numchars;
|
||||
char *tbuf; //johnfitz -- tbuf no longer a static array
|
||||
int mark; //johnfitz
|
||||
int32_t mark; //johnfitz
|
||||
|
||||
width = (vid.conwidth >> 3) - 2; //johnfitz -- use vid.conwidth instead of vid.width
|
||||
|
||||
|
@ -304,7 +304,7 @@ Con_Init
|
|||
*/
|
||||
void Con_Init (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
//johnfitz -- user settable console buffer size
|
||||
i = COM_CheckParm("-consize");
|
||||
|
@ -369,11 +369,11 @@ If no console is visible, the notify window will pop up.
|
|||
*/
|
||||
static void Con_Print (const char *txt)
|
||||
{
|
||||
int y;
|
||||
int c, l;
|
||||
static int cr;
|
||||
int mask;
|
||||
qboolean boundary;
|
||||
int32_t y;
|
||||
int32_t c, l;
|
||||
static int32_t cr;
|
||||
int32_t mask;
|
||||
bool boundary;
|
||||
|
||||
//con_backscroll = 0; //johnfitz -- better console scrolling
|
||||
|
||||
|
@ -455,7 +455,7 @@ static void Con_Print (const char *txt)
|
|||
// borrowed from uhexen2 by S.A. for new procs, LOG_Init, LOG_Close
|
||||
|
||||
static char logfilename[MAX_OSPATH]; // current logfile name
|
||||
static int log_fd = -1; // log file descriptor
|
||||
static int32_t log_fd = -1; // log file descriptor
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -483,7 +483,7 @@ void Con_Printf (const char *fmt, ...)
|
|||
{
|
||||
va_list argptr;
|
||||
char msg[MAXPRINTMSG];
|
||||
static qboolean inupdate;
|
||||
static bool inupdate;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
q_vsnprintf (msg, sizeof(msg), fmt, argptr);
|
||||
|
@ -617,7 +617,7 @@ void Con_SafePrintf (const char *fmt, ...)
|
|||
{
|
||||
va_list argptr;
|
||||
char msg[1024];
|
||||
int temp;
|
||||
int32_t temp;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
q_vsnprintf (msg, sizeof(msg), fmt, argptr);
|
||||
|
@ -634,15 +634,15 @@ void Con_SafePrintf (const char *fmt, ...)
|
|||
Con_CenterPrintf -- johnfitz -- pad each line with spaces to make it appear centered
|
||||
================
|
||||
*/
|
||||
void Con_CenterPrintf (int linewidth, const char *fmt, ...) FUNC_PRINTF(2,3);
|
||||
void Con_CenterPrintf (int linewidth, const char *fmt, ...)
|
||||
void Con_CenterPrintf (int32_t linewidth, const char *fmt, ...) FUNC_PRINTF(2,3);
|
||||
void Con_CenterPrintf (int32_t linewidth, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char msg[MAXPRINTMSG]; //the original message
|
||||
char line[MAXPRINTMSG]; //one line from the message
|
||||
char spaces[21]; //buffer for spaces
|
||||
char *src, *dst;
|
||||
int len, s;
|
||||
int32_t len, s;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
q_vsnprintf (msg, sizeof(msg), fmt, argptr);
|
||||
|
@ -716,7 +716,7 @@ typedef struct tab_s
|
|||
tab_t *tablist;
|
||||
|
||||
//defs from elsewhere
|
||||
extern qboolean keydown[256];
|
||||
extern bool keydown[256];
|
||||
typedef struct cmd_function_s
|
||||
{
|
||||
struct cmd_function_s *next;
|
||||
|
@ -744,7 +744,7 @@ tablist is a doubly-linked loop, alphabetized by name
|
|||
// bash_partial is the string that can be expanded,
|
||||
// aka Linux Bash shell. -- S.A.
|
||||
static char bash_partial[80];
|
||||
static qboolean bash_singlematch;
|
||||
static bool bash_singlematch;
|
||||
|
||||
void AddToTabList (const char *name, const char *type)
|
||||
{
|
||||
|
@ -822,7 +822,7 @@ static const arg_completion_type_t arg_completion_types[] =
|
|||
{ "timedemo ", &demolist }
|
||||
};
|
||||
|
||||
static const int num_arg_completion_types =
|
||||
static const int32_t num_arg_completion_types =
|
||||
sizeof(arg_completion_types)/sizeof(arg_completion_types[0]);
|
||||
|
||||
/*
|
||||
|
@ -830,12 +830,12 @@ static const int num_arg_completion_types =
|
|||
FindCompletion -- stevenaaus
|
||||
============
|
||||
*/
|
||||
const char *FindCompletion (const char *partial, filelist_item_t *filelist, int *nummatches_out)
|
||||
const char *FindCompletion (const char *partial, filelist_item_t *filelist, int32_t *nummatches_out)
|
||||
{
|
||||
static char matched[32];
|
||||
char *i_matched, *i_name;
|
||||
filelist_item_t *file;
|
||||
int init, match, plen;
|
||||
int32_t init, match, plen;
|
||||
|
||||
memset(matched, 0, sizeof(matched));
|
||||
plen = strlen(partial);
|
||||
|
@ -891,7 +891,7 @@ void BuildTabList (const char *partial)
|
|||
cmdalias_t *alias;
|
||||
cvar_t *cvar;
|
||||
cmd_function_t *cmd;
|
||||
int len;
|
||||
int32_t len;
|
||||
|
||||
tablist = NULL;
|
||||
len = strlen(partial);
|
||||
|
@ -924,7 +924,7 @@ void Con_TabComplete (void)
|
|||
const char *match;
|
||||
static char *c;
|
||||
tab_t *t;
|
||||
int mark, i, j;
|
||||
int32_t mark, i, j;
|
||||
|
||||
// if editline is empty, return
|
||||
if (key_lines[edit_line][1] == 0)
|
||||
|
@ -954,7 +954,7 @@ void Con_TabComplete (void)
|
|||
|
||||
if (!strncmp (key_lines[edit_line] + 1, command_name, strlen(command_name)))
|
||||
{
|
||||
int nummatches = 0;
|
||||
int32_t nummatches = 0;
|
||||
const char *matched_map = FindCompletion(partial, *arg_completion.filelist, &nummatches);
|
||||
if (!*matched_map)
|
||||
return;
|
||||
|
@ -1075,7 +1075,7 @@ Draws the last few lines of output transparently over the game top
|
|||
*/
|
||||
void Con_DrawNotify (void)
|
||||
{
|
||||
int i, x, v;
|
||||
int32_t i, x, v;
|
||||
const char *text;
|
||||
float time;
|
||||
|
||||
|
@ -1131,7 +1131,7 @@ void Con_DrawNotify (void)
|
|||
text++;
|
||||
}
|
||||
|
||||
Draw_Character (x<<3, v, 10 + ((int)(realtime*con_cursorspeed)&1));
|
||||
Draw_Character (x<<3, v, 10 + ((int32_t)(realtime*con_cursorspeed)&1));
|
||||
v += 8;
|
||||
|
||||
scr_tileclear_updates = 0; //johnfitz
|
||||
|
@ -1149,7 +1149,7 @@ extern qpic_t *pic_ovr, *pic_ins; //johnfitz -- new cursor handling
|
|||
|
||||
void Con_DrawInput (void)
|
||||
{
|
||||
int i, ofs;
|
||||
int32_t i, ofs;
|
||||
|
||||
if (key_dest != key_console && !con_forcedup)
|
||||
return; // don't draw anything
|
||||
|
@ -1165,7 +1165,7 @@ void Con_DrawInput (void)
|
|||
Draw_Character ((i+1)<<3, vid.conheight - 16, key_lines[edit_line][i+ofs]);
|
||||
|
||||
// johnfitz -- new cursor handling
|
||||
if (!((int)((realtime-key_blinktime)*con_cursorspeed) & 1))
|
||||
if (!((int32_t)((realtime-key_blinktime)*con_cursorspeed) & 1))
|
||||
{
|
||||
i = key_linepos - ofs;
|
||||
Draw_Pic ((i+1)<<3, vid.conheight - 16, key_insert ? pic_ins : pic_ovr);
|
||||
|
@ -1180,9 +1180,9 @@ Draws the console with the solid background
|
|||
The typing input line at the bottom should only be drawn if typing is allowed
|
||||
================
|
||||
*/
|
||||
void Con_DrawConsole (int lines, qboolean drawinput)
|
||||
void Con_DrawConsole (int32_t lines, bool drawinput)
|
||||
{
|
||||
int i, x, y, j, sb, rows;
|
||||
int32_t i, x, y, j, sb, rows;
|
||||
const char *text;
|
||||
char ver[32];
|
||||
|
||||
|
@ -1228,7 +1228,7 @@ void Con_DrawConsole (int lines, qboolean drawinput)
|
|||
//draw version number in bottom right
|
||||
y += 8;
|
||||
q_snprintf (ver, sizeof(ver), "QuakeSpasm " QUAKESPASM_VERSION);
|
||||
for (x = 0; x < (int)strlen(ver); x++)
|
||||
for (x = 0; x < (int32_t)strlen(ver); x++)
|
||||
Draw_Character ((con_linewidth - strlen(ver) + x + 2)<<3, y, ver[x] /*+ 128*/);
|
||||
}
|
||||
|
||||
|
@ -1241,7 +1241,7 @@ Con_NotifyBox
|
|||
void Con_NotifyBox (const char *text)
|
||||
{
|
||||
double t1, t2;
|
||||
int lastkey, lastchar;
|
||||
int32_t lastkey, lastchar;
|
||||
|
||||
// during startup for sound / cd warnings
|
||||
Con_Printf ("\n\n%s", Con_Quakebar(40)); //johnfitz
|
||||
|
@ -1281,7 +1281,7 @@ void LOG_Init (quakeparms_t *parms)
|
|||
return;
|
||||
|
||||
inittime = time (NULL);
|
||||
strftime (session, sizeof(session), "%m/%d/%Y %H:%M:%S", localtime(&inittime));
|
||||
strftime (session, sizeof(session), "%m/%" PRIi32 "/%Y %H:%M:%S", localtime(&inittime));
|
||||
q_snprintf (logfilename, sizeof(logfilename), "%s/qconsole.log", parms->basedir);
|
||||
|
||||
// unlink (logfilename);
|
||||
|
|
|
@ -26,19 +26,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//
|
||||
// console
|
||||
//
|
||||
extern int con_totallines;
|
||||
extern int con_backscroll;
|
||||
extern qboolean con_forcedup; // because no entities to refresh
|
||||
extern qboolean con_initialized;
|
||||
extern int32_t con_totallines;
|
||||
extern int32_t con_backscroll;
|
||||
extern bool con_forcedup; // because no entities to refresh
|
||||
extern bool con_initialized;
|
||||
extern byte *con_chars;
|
||||
|
||||
extern char con_lastcenterstring[]; //johnfitz
|
||||
|
||||
void Con_DrawCharacter (int cx, int line, int num);
|
||||
void Con_DrawCharacter (int32_t cx, int32_t line, int32_t num);
|
||||
|
||||
void Con_CheckResize (void);
|
||||
void Con_Init (void);
|
||||
void Con_DrawConsole (int lines, qboolean drawinput);
|
||||
void Con_DrawConsole (int32_t lines, bool drawinput);
|
||||
void Con_Printf (const char *fmt, ...) FUNC_PRINTF(1,2);
|
||||
void Con_DWarning (const char *fmt, ...) FUNC_PRINTF(1,2); //ericw
|
||||
void Con_Warning (const char *fmt, ...) FUNC_PRINTF(1,2); //johnfitz
|
||||
|
@ -54,7 +54,7 @@ void Con_NotifyBox (const char *text); // during startup for sound / cd warnings
|
|||
void Con_Show (void);
|
||||
void Con_Hide (void);
|
||||
|
||||
const char *Con_Quakebar (int len);
|
||||
const char *Con_Quakebar (int32_t len);
|
||||
void Con_TabComplete (void);
|
||||
void Con_LogCenterPrint (const char *str);
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ uint16_t CRC_Value(uint16_t crcvalue)
|
|||
}
|
||||
|
||||
//johnfitz -- texture crc
|
||||
uint16_t CRC_Block (const byte *start, int count)
|
||||
uint16_t CRC_Block (const byte *start, int32_t count)
|
||||
{
|
||||
uint16_t crc;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
void CRC_Init(uint16_t *crcvalue);
|
||||
void CRC_ProcessByte(uint16_t *crcvalue, byte data);
|
||||
uint16_t CRC_Value(uint16_t crcvalue);
|
||||
uint16_t CRC_Block (const byte *start, int count); //johnfitz -- texture crc
|
||||
uint16_t CRC_Block (const byte *start, int32_t count); //johnfitz -- texture crc
|
||||
|
||||
#endif /* _QUAKE_CRC_H */
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void Cvar_List_f (void)
|
|||
{
|
||||
cvar_t *cvar;
|
||||
const char *partial;
|
||||
int len, count;
|
||||
int32_t len, count;
|
||||
|
||||
if (Cmd_Argc() > 1)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ void Cvar_List_f (void)
|
|||
count++;
|
||||
}
|
||||
|
||||
Con_SafePrintf ("%i cvars", count);
|
||||
Con_SafePrintf ("%" PRIi32 " cvars", count);
|
||||
if (partial)
|
||||
{
|
||||
Con_SafePrintf (" beginning with \"%s\"", partial);
|
||||
|
@ -130,7 +130,7 @@ Cvar_Cycle_f -- johnfitz
|
|||
*/
|
||||
void Cvar_Cycle_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (Cmd_Argc() < 3)
|
||||
{
|
||||
|
@ -351,7 +351,7 @@ Cvar_CompleteVariable
|
|||
const char *Cvar_CompleteVariable (const char *partial)
|
||||
{
|
||||
cvar_t *cvar;
|
||||
int len;
|
||||
int32_t len;
|
||||
|
||||
len = Q_strlen(partial);
|
||||
if (!len)
|
||||
|
@ -394,7 +394,7 @@ void Cvar_SetQuick (cvar_t *var, const char *value)
|
|||
var->string = Z_Strdup (value);
|
||||
else
|
||||
{
|
||||
int len;
|
||||
int32_t len;
|
||||
|
||||
if (!strcmp(var->string, value))
|
||||
return; // no change
|
||||
|
@ -432,8 +432,8 @@ void Cvar_SetValueQuick (cvar_t *var, const float value)
|
|||
{
|
||||
char val[32], *ptr = val;
|
||||
|
||||
if (value == (float)((int)value))
|
||||
q_snprintf (val, sizeof(val), "%i", (int)value);
|
||||
if (value == (float)((int32_t)value))
|
||||
q_snprintf (val, sizeof(val), "%" PRIi32 "", (int32_t)value);
|
||||
else
|
||||
{
|
||||
q_snprintf (val, sizeof(val), "%f", value);
|
||||
|
@ -475,8 +475,8 @@ void Cvar_SetValue (const char *var_name, const float value)
|
|||
{
|
||||
char val[32], *ptr = val;
|
||||
|
||||
if (value == (float)((int)value))
|
||||
q_snprintf (val, sizeof(val), "%i", (int)value);
|
||||
if (value == (float)((int32_t)value))
|
||||
q_snprintf (val, sizeof(val), "%" PRIi32 "", (int32_t)value);
|
||||
else
|
||||
{
|
||||
q_snprintf (val, sizeof(val), "%f", value);
|
||||
|
@ -532,7 +532,7 @@ Adds a freestanding variable to the variable list.
|
|||
void Cvar_RegisterVariable (cvar_t *variable)
|
||||
{
|
||||
char value[512];
|
||||
qboolean set_rom;
|
||||
bool set_rom;
|
||||
cvar_t *cursor,*prev; //johnfitz -- sorted list insert
|
||||
|
||||
// first check to see if it has already been defined
|
||||
|
@ -610,7 +610,7 @@ Cvar_Command
|
|||
Handles variable inspection and changing from the console
|
||||
============
|
||||
*/
|
||||
qboolean Cvar_Command (void)
|
||||
bool Cvar_Command (void)
|
||||
{
|
||||
cvar_t *v;
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ float Cvar_VariableValue (const char *var_name);
|
|||
const char *Cvar_VariableString (const char *var_name);
|
||||
// returns an empty string if not defined
|
||||
|
||||
qboolean Cvar_Command (void);
|
||||
bool Cvar_Command (void);
|
||||
// called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known
|
||||
// command. Returns true if the command was a variable reference that
|
||||
// was handled. (print or change)
|
||||
|
|
|
@ -29,15 +29,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
extern qpic_t *draw_disc; // also used on sbar
|
||||
|
||||
void Draw_Init (void);
|
||||
void Draw_Character (int x, int y, int num);
|
||||
void Draw_Character (int32_t x, int32_t y, int32_t num);
|
||||
void Draw_DebugChar (char num);
|
||||
void Draw_Pic (int x, int y, qpic_t *pic);
|
||||
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom); //johnfitz -- more parameters
|
||||
void Draw_ConsoleBackground (void); //johnfitz -- removed parameter int lines
|
||||
void Draw_TileClear (int x, int y, int w, int h);
|
||||
void Draw_Fill (int x, int y, int w, int h, int c, float alpha); //johnfitz -- added alpha
|
||||
void Draw_Pic (int32_t x, int32_t y, qpic_t *pic);
|
||||
void Draw_TransPicTranslate (int32_t x, int32_t y, qpic_t *pic, int32_t top, int32_t bottom); //johnfitz -- more parameters
|
||||
void Draw_ConsoleBackground (void); //johnfitz -- removed parameter int32_t lines
|
||||
void Draw_TileClear (int32_t x, int32_t y, int32_t w, int32_t h);
|
||||
void Draw_Fill (int32_t x, int32_t y, int32_t w, int32_t h, int32_t c, float alpha); //johnfitz -- added alpha
|
||||
void Draw_FadeScreen (void);
|
||||
void Draw_String (int x, int y, const char *str);
|
||||
void Draw_String (int32_t x, int32_t y, const char *str);
|
||||
qpic_t *Draw_PicFromWad (const char *name);
|
||||
qpic_t *Draw_CachePic (const char *path);
|
||||
void Draw_NewGame (void);
|
||||
|
|
|
@ -122,7 +122,7 @@ typedef struct cachepic_s
|
|||
|
||||
#define MAX_CACHED_PICS 128
|
||||
cachepic_t menu_cachepics[MAX_CACHED_PICS];
|
||||
int menu_numcachepics;
|
||||
int32_t menu_numcachepics;
|
||||
|
||||
byte menuplyr_pixels[4096];
|
||||
|
||||
|
@ -134,9 +134,9 @@ byte menuplyr_pixels[4096];
|
|||
#define BLOCK_WIDTH 256
|
||||
#define BLOCK_HEIGHT 256
|
||||
|
||||
int scrap_allocated[MAX_SCRAPS][BLOCK_WIDTH];
|
||||
int32_t scrap_allocated[MAX_SCRAPS][BLOCK_WIDTH];
|
||||
byte scrap_texels[MAX_SCRAPS][BLOCK_WIDTH*BLOCK_HEIGHT]; //johnfitz -- removed *4 after BLOCK_HEIGHT
|
||||
qboolean scrap_dirty;
|
||||
bool scrap_dirty;
|
||||
gltexture_t *scrap_textures[MAX_SCRAPS]; //johnfitz
|
||||
|
||||
|
||||
|
@ -147,11 +147,11 @@ Scrap_AllocBlock
|
|||
returns an index into scrap_texnums[] and the position inside it
|
||||
================
|
||||
*/
|
||||
int Scrap_AllocBlock (int w, int h, int *x, int *y)
|
||||
int32_t Scrap_AllocBlock (int32_t w, int32_t h, int32_t *x, int32_t *y)
|
||||
{
|
||||
int i, j;
|
||||
int best, best2;
|
||||
int texnum;
|
||||
int32_t i, j;
|
||||
int32_t best, best2;
|
||||
int32_t texnum;
|
||||
|
||||
for (texnum=0 ; texnum<MAX_SCRAPS ; texnum++)
|
||||
{
|
||||
|
@ -196,11 +196,11 @@ Scrap_Upload -- johnfitz -- now uses TexMgr
|
|||
void Scrap_Upload (void)
|
||||
{
|
||||
char name[8];
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i=0; i<MAX_SCRAPS; i++)
|
||||
{
|
||||
sprintf (name, "scrap%i", i);
|
||||
sprintf (name, "scrap%" PRIi32 "", i);
|
||||
scrap_textures[i] = TexMgr_LoadImage (NULL, name, BLOCK_WIDTH, BLOCK_HEIGHT, SRC_INDEXED, scrap_texels[i],
|
||||
"", (src_offset_t)scrap_texels[i], TEXPREF_ALPHA | TEXPREF_OVERWRITE | TEXPREF_NOPICMIP);
|
||||
}
|
||||
|
@ -225,9 +225,9 @@ qpic_t *Draw_PicFromWad (const char *name)
|
|||
// load little ones into the scrap
|
||||
if (p->width < 64 && p->height < 64)
|
||||
{
|
||||
int x, y;
|
||||
int i, j, k;
|
||||
int texnum;
|
||||
int32_t x, y;
|
||||
int32_t i, j, k;
|
||||
int32_t texnum;
|
||||
|
||||
texnum = Scrap_AllocBlock (p->width, p->height, &x, &y);
|
||||
scrap_dirty = true;
|
||||
|
@ -249,7 +249,7 @@ qpic_t *Draw_PicFromWad (const char *name)
|
|||
char texturename[64]; //johnfitz
|
||||
q_snprintf (texturename, sizeof(texturename), "%s:%s", WADFILENAME, name); //johnfitz
|
||||
|
||||
offset = (src_offset_t)p - (src_offset_t)wad_base + sizeof(int)*2; //johnfitz
|
||||
offset = (src_offset_t)p - (src_offset_t)wad_base + sizeof(int32_t)*2; //johnfitz
|
||||
|
||||
gl.gltexture = TexMgr_LoadImage (NULL, texturename, p->width, p->height, SRC_INDEXED, p->data, WADFILENAME,
|
||||
offset, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
|
||||
|
@ -272,7 +272,7 @@ Draw_CachePic
|
|||
qpic_t *Draw_CachePic (const char *path)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
int32_t i;
|
||||
qpic_t *dat;
|
||||
glpic_t gl;
|
||||
|
||||
|
@ -304,7 +304,7 @@ qpic_t *Draw_CachePic (const char *path)
|
|||
pic->pic.height = dat->height;
|
||||
|
||||
gl.gltexture = TexMgr_LoadImage (NULL, path, dat->width, dat->height, SRC_INDEXED, dat->data, path,
|
||||
sizeof(int)*2, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
|
||||
sizeof(int32_t)*2, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
|
||||
gl.sl = 0;
|
||||
gl.sh = (float)dat->width/(float)TexMgr_PadConditional(dat->width); //johnfitz
|
||||
gl.tl = 0;
|
||||
|
@ -319,9 +319,9 @@ qpic_t *Draw_CachePic (const char *path)
|
|||
Draw_MakePic -- johnfitz -- generate pics from internal data
|
||||
================
|
||||
*/
|
||||
qpic_t *Draw_MakePic (const char *name, int width, int height, byte *data)
|
||||
qpic_t *Draw_MakePic (const char *name, int32_t width, int32_t height, byte *data)
|
||||
{
|
||||
int flags = TEXPREF_NEAREST | TEXPREF_ALPHA | TEXPREF_PERSIST | TEXPREF_NOPICMIP | TEXPREF_PAD;
|
||||
int32_t flags = TEXPREF_NEAREST | TEXPREF_ALPHA | TEXPREF_PERSIST | TEXPREF_NOPICMIP | TEXPREF_PAD;
|
||||
qpic_t *pic;
|
||||
glpic_t gl;
|
||||
|
||||
|
@ -373,7 +373,7 @@ Draw_NewGame -- johnfitz
|
|||
void Draw_NewGame (void)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// empty scrap and reallocate gltextures
|
||||
memset(scrap_allocated, 0, sizeof(scrap_allocated));
|
||||
|
@ -428,9 +428,9 @@ void Draw_Init (void)
|
|||
Draw_CharacterQuad -- johnfitz -- seperate function to spit out verts
|
||||
================
|
||||
*/
|
||||
void Draw_CharacterQuad (int x, int y, char num)
|
||||
void Draw_CharacterQuad (int32_t x, int32_t y, char num)
|
||||
{
|
||||
int row, col;
|
||||
int32_t row, col;
|
||||
float frow, fcol, size;
|
||||
|
||||
row = num>>4;
|
||||
|
@ -455,7 +455,7 @@ void Draw_CharacterQuad (int x, int y, char num)
|
|||
Draw_Character -- johnfitz -- modified to call Draw_CharacterQuad
|
||||
================
|
||||
*/
|
||||
void Draw_Character (int x, int y, int num)
|
||||
void Draw_Character (int32_t x, int32_t y, int32_t num)
|
||||
{
|
||||
if (y <= -8)
|
||||
return; // totally off screen
|
||||
|
@ -478,7 +478,7 @@ void Draw_Character (int x, int y, int num)
|
|||
Draw_String -- johnfitz -- modified to call Draw_CharacterQuad
|
||||
================
|
||||
*/
|
||||
void Draw_String (int x, int y, const char *str)
|
||||
void Draw_String (int32_t x, int32_t y, const char *str)
|
||||
{
|
||||
if (y <= -8)
|
||||
return; // totally off screen
|
||||
|
@ -502,7 +502,7 @@ void Draw_String (int x, int y, const char *str)
|
|||
Draw_Pic -- johnfitz -- modified
|
||||
=============
|
||||
*/
|
||||
void Draw_Pic (int x, int y, qpic_t *pic)
|
||||
void Draw_Pic (int32_t x, int32_t y, qpic_t *pic)
|
||||
{
|
||||
glpic_t *gl;
|
||||
|
||||
|
@ -529,10 +529,10 @@ Draw_TransPicTranslate -- johnfitz -- rewritten to use texmgr to do translation
|
|||
Only used for the player color selection menu
|
||||
=============
|
||||
*/
|
||||
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom)
|
||||
void Draw_TransPicTranslate (int32_t x, int32_t y, qpic_t *pic, int32_t top, int32_t bottom)
|
||||
{
|
||||
static int oldtop = -2;
|
||||
static int oldbottom = -2;
|
||||
static int32_t oldtop = -2;
|
||||
static int32_t oldbottom = -2;
|
||||
|
||||
if (top != oldtop || bottom != oldbottom)
|
||||
{
|
||||
|
@ -594,7 +594,7 @@ This repeats a 64*64 tile graphic to fill the screen around a sized down
|
|||
refresh window.
|
||||
=============
|
||||
*/
|
||||
void Draw_TileClear (int x, int y, int w, int h)
|
||||
void Draw_TileClear (int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
{
|
||||
glpic_t *gl;
|
||||
|
||||
|
@ -621,7 +621,7 @@ Draw_Fill
|
|||
Fills a box of pixels with a single color
|
||||
=============
|
||||
*/
|
||||
void Draw_Fill (int x, int y, int w, int h, int c, float alpha) //johnfitz -- added alpha
|
||||
void Draw_Fill (int32_t x, int32_t y, int32_t w, int32_t h, int32_t c, float alpha) //johnfitz -- added alpha
|
||||
{
|
||||
byte *pal = (byte *)d_8to24table; //johnfitz -- use d_8to24table instead of host_basepal
|
||||
|
||||
|
@ -681,7 +681,7 @@ void GL_SetCanvas (canvastype newcanvas)
|
|||
{
|
||||
extern vrect_t scr_vrect;
|
||||
float s;
|
||||
int lines;
|
||||
int32_t lines;
|
||||
|
||||
if (newcanvas == currentcanvas)
|
||||
return;
|
||||
|
|
|
@ -233,7 +233,7 @@ float *Fog_GetColor (void)
|
|||
{
|
||||
static float c[4];
|
||||
float f;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (fade_done > cl.time)
|
||||
{
|
||||
|
|
110
source/gl_mesh.c
110
source/gl_mesh.c
|
@ -35,35 +35,35 @@ ALIAS MODEL DISPLAY LIST GENERATION
|
|||
qmodel_t *aliasmodel;
|
||||
aliashdr_t *paliashdr;
|
||||
|
||||
int used[8192]; // qboolean
|
||||
int32_t used[8192]; // bool
|
||||
|
||||
// the command list holds counts and s/t values that are valid for
|
||||
// every frame
|
||||
int commands[8192];
|
||||
int numcommands;
|
||||
int32_t commands[8192];
|
||||
int32_t numcommands;
|
||||
|
||||
// all frames will have their vertexes rearranged and expanded
|
||||
// so they are in the order expected by the command list
|
||||
int vertexorder[8192];
|
||||
int numorder;
|
||||
int32_t vertexorder[8192];
|
||||
int32_t numorder;
|
||||
|
||||
int allverts, alltris;
|
||||
int32_t allverts, alltris;
|
||||
|
||||
int stripverts[128];
|
||||
int striptris[128];
|
||||
int stripcount;
|
||||
int32_t stripverts[128];
|
||||
int32_t striptris[128];
|
||||
int32_t stripcount;
|
||||
|
||||
/*
|
||||
================
|
||||
StripLength
|
||||
================
|
||||
*/
|
||||
int StripLength (int starttri, int startv)
|
||||
int32_t StripLength (int32_t starttri, int32_t startv)
|
||||
{
|
||||
int m1, m2;
|
||||
int j;
|
||||
int32_t m1, m2;
|
||||
int32_t j;
|
||||
mtriangle_t *last, *check;
|
||||
int k;
|
||||
int32_t k;
|
||||
|
||||
used[starttri] = 2;
|
||||
|
||||
|
@ -127,12 +127,12 @@ done:
|
|||
FanLength
|
||||
===========
|
||||
*/
|
||||
int FanLength (int starttri, int startv)
|
||||
int32_t FanLength (int32_t starttri, int32_t startv)
|
||||
{
|
||||
int m1, m2;
|
||||
int j;
|
||||
int32_t m1, m2;
|
||||
int32_t j;
|
||||
mtriangle_t *last, *check;
|
||||
int k;
|
||||
int32_t k;
|
||||
|
||||
used[starttri] = 2;
|
||||
|
||||
|
@ -200,13 +200,13 @@ for the model, which holds for all frames
|
|||
*/
|
||||
void BuildTris (void)
|
||||
{
|
||||
int i, j, k;
|
||||
int startv;
|
||||
int32_t i, j, k;
|
||||
int32_t startv;
|
||||
float s, t;
|
||||
int len, bestlen, besttype;
|
||||
int bestverts[1024];
|
||||
int besttris[1024];
|
||||
int type;
|
||||
int32_t len, bestlen, besttype;
|
||||
int32_t bestverts[1024];
|
||||
int32_t besttris[1024];
|
||||
int32_t type;
|
||||
|
||||
//
|
||||
// build tristrips
|
||||
|
@ -254,7 +254,7 @@ void BuildTris (void)
|
|||
|
||||
for (j = 0; j < bestlen+2; j++)
|
||||
{
|
||||
int tmp;
|
||||
int32_t tmp;
|
||||
|
||||
// emit a vertex into the reorder buffer
|
||||
k = bestverts[j];
|
||||
|
@ -270,7 +270,7 @@ void BuildTris (void)
|
|||
|
||||
// *(float *)&commands[numcommands++] = s;
|
||||
// *(float *)&commands[numcommands++] = t;
|
||||
// NOTE: 4 == sizeof(int)
|
||||
// NOTE: 4 == sizeof(int32_t)
|
||||
// == sizeof(float)
|
||||
memcpy (&tmp, &s, 4);
|
||||
commands[numcommands++] = tmp;
|
||||
|
@ -281,7 +281,7 @@ void BuildTris (void)
|
|||
|
||||
commands[numcommands++] = 0; // end of list marker
|
||||
|
||||
Con_DPrintf2 ("%3i tri %3i vert %3i cmd\n", pheader->numtris, numorder, numcommands);
|
||||
Con_DPrintf2 ("%3" PRIi32 " tri %3" PRIi32 " vert %3" PRIi32 " cmd\n", pheader->numtris, numorder, numcommands);
|
||||
|
||||
allverts += numorder;
|
||||
alltris += pheader->numtris;
|
||||
|
@ -297,12 +297,12 @@ GL_MakeAliasModelDisplayLists
|
|||
*/
|
||||
void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr)
|
||||
{
|
||||
int i, j;
|
||||
int *cmds;
|
||||
int32_t i, j;
|
||||
int32_t *cmds;
|
||||
trivertx_t *verts;
|
||||
float hscale, vscale; //johnfitz -- padded skins
|
||||
int count; //johnfitz -- precompute texcoords for padded skins
|
||||
int *loadcmds; //johnfitz
|
||||
int32_t count; //johnfitz -- precompute texcoords for padded skins
|
||||
int32_t *loadcmds; //johnfitz
|
||||
|
||||
//johnfitz -- padded skins
|
||||
hscale = (float)hdr->skinwidth/(float)TexMgr_PadConditional(hdr->skinwidth);
|
||||
|
@ -320,7 +320,7 @@ void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr)
|
|||
|
||||
paliashdr->poseverts = numorder;
|
||||
|
||||
cmds = (int *) Hunk_Alloc (numcommands * 4);
|
||||
cmds = (int32_t *) Hunk_Alloc (numcommands * 4);
|
||||
paliashdr->commands = (byte *)cmds - (byte *)paliashdr;
|
||||
|
||||
//johnfitz -- precompute texcoords for padded skins
|
||||
|
@ -368,8 +368,8 @@ Original code by MH from RMQEngine
|
|||
*/
|
||||
void GL_MakeAliasModelDisplayLists_VBO (void)
|
||||
{
|
||||
int i, j;
|
||||
int maxverts_vbo;
|
||||
int32_t i, j;
|
||||
int32_t maxverts_vbo;
|
||||
trivertx_t *verts;
|
||||
uint16_t *indexes;
|
||||
aliasmesh_t *desc;
|
||||
|
@ -400,14 +400,14 @@ void GL_MakeAliasModelDisplayLists_VBO (void)
|
|||
{
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
int v;
|
||||
int32_t v;
|
||||
|
||||
// index into hdr->vertexes
|
||||
uint16_t vertindex = triangles[i].vertindex[j];
|
||||
|
||||
// basic s/t coords
|
||||
int s = stverts[vertindex].s;
|
||||
int t = stverts[vertindex].t;
|
||||
int32_t s = stverts[vertindex].s;
|
||||
int32_t t = stverts[vertindex].t;
|
||||
|
||||
// check for back side and adjust texcoord s
|
||||
if (!triangles[i].facesfront && stverts[vertindex].onseam) s += pheader->skinwidth / 2;
|
||||
|
@ -416,7 +416,7 @@ void GL_MakeAliasModelDisplayLists_VBO (void)
|
|||
for (v = 0; v < pheader->numverts_vbo; v++)
|
||||
{
|
||||
// it could use the same xyz but have different s and t
|
||||
if (desc[v].vertindex == vertindex && (int) desc[v].st[0] == s && (int) desc[v].st[1] == t)
|
||||
if (desc[v].vertindex == vertindex && (int32_t) desc[v].st[0] == s && (int32_t) desc[v].st[1] == t)
|
||||
{
|
||||
// exists; emit an index for it
|
||||
indexes[pheader->numindexes++] = v;
|
||||
|
@ -437,7 +437,7 @@ void GL_MakeAliasModelDisplayLists_VBO (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// upload immediately
|
||||
GLMesh_LoadVertexBuffer (aliasmodel, pheader);
|
||||
}
|
||||
|
@ -456,32 +456,32 @@ Original code by MH from RMQEngine
|
|||
*/
|
||||
static void GLMesh_LoadVertexBuffer (qmodel_t *m, const aliashdr_t *hdr)
|
||||
{
|
||||
int totalvbosize = 0;
|
||||
int32_t totalvbosize = 0;
|
||||
const aliasmesh_t *desc;
|
||||
const int16_t *indexes;
|
||||
const trivertx_t *trivertexes;
|
||||
byte *vbodata;
|
||||
int f;
|
||||
int32_t f;
|
||||
|
||||
if (!gl_glsl_alias_able)
|
||||
return;
|
||||
|
||||
|
||||
// count the sizes we need
|
||||
|
||||
|
||||
// ericw -- RMQEngine stored these vbo*ofs values in aliashdr_t, but we must not
|
||||
// mutate Mod_Extradata since it might be reloaded from disk, so I moved them to qmodel_t
|
||||
// (test case: roman1.bsp from arwop, 64mb heap)
|
||||
m->vboindexofs = 0;
|
||||
|
||||
|
||||
m->vboxyzofs = 0;
|
||||
totalvbosize += (hdr->numposes * hdr->numverts_vbo * sizeof (meshxyz_t)); // ericw -- what RMQEngine called nummeshframes is called numposes in QuakeSpasm
|
||||
|
||||
|
||||
m->vbostofs = totalvbosize;
|
||||
totalvbosize += (hdr->numverts_vbo * sizeof (meshst_t));
|
||||
|
||||
|
||||
if (!hdr->numindexes) return;
|
||||
if (!totalvbosize) return;
|
||||
|
||||
|
||||
// grab the pointers to data in the extradata
|
||||
|
||||
desc = (aliasmesh_t *) ((byte *) hdr + hdr->meshdesc);
|
||||
|
@ -503,7 +503,7 @@ static void GLMesh_LoadVertexBuffer (qmodel_t *m, const aliashdr_t *hdr)
|
|||
// fill in the vertices at the start of the buffer
|
||||
for (f = 0; f < hdr->numposes; f++) // ericw -- what RMQEngine called nummeshframes is called numposes in QuakeSpasm
|
||||
{
|
||||
int v;
|
||||
int32_t v;
|
||||
meshxyz_t *xyz = (meshxyz_t *) (vbodata + (f * hdr->numverts_vbo * sizeof (meshxyz_t)));
|
||||
const trivertx_t *tv = trivertexes + (hdr->numverts * f);
|
||||
|
||||
|
@ -565,20 +565,20 @@ Loop over all precached alias models, and upload each one to a VBO.
|
|||
*/
|
||||
void GLMesh_LoadVertexBuffers (void)
|
||||
{
|
||||
int j;
|
||||
int32_t j;
|
||||
qmodel_t *m;
|
||||
const aliashdr_t *hdr;
|
||||
|
||||
if (!gl_glsl_alias_able)
|
||||
return;
|
||||
|
||||
|
||||
for (j = 1; j < MAX_MODELS; j++)
|
||||
{
|
||||
if (!(m = cl.model_precache[j])) break;
|
||||
if (m->type != mod_alias) continue;
|
||||
|
||||
hdr = (const aliashdr_t *) Mod_Extradata (m);
|
||||
|
||||
|
||||
GLMesh_LoadVertexBuffer (m, hdr);
|
||||
}
|
||||
}
|
||||
|
@ -592,23 +592,23 @@ Delete VBOs for all loaded alias models
|
|||
*/
|
||||
void GLMesh_DeleteVertexBuffers (void)
|
||||
{
|
||||
int j;
|
||||
int32_t j;
|
||||
qmodel_t *m;
|
||||
|
||||
|
||||
if (!gl_glsl_alias_able)
|
||||
return;
|
||||
|
||||
|
||||
for (j = 1; j < MAX_MODELS; j++)
|
||||
{
|
||||
if (!(m = cl.model_precache[j])) break;
|
||||
if (m->type != mod_alias) continue;
|
||||
|
||||
|
||||
GL_DeleteBuffersFunc (1, &m->meshvbo);
|
||||
m->meshvbo = 0;
|
||||
|
||||
GL_DeleteBuffersFunc (1, &m->meshindexesvbo);
|
||||
m->meshindexesvbo = 0;
|
||||
}
|
||||
|
||||
|
||||
GL_ClearBufferBindings ();
|
||||
}
|
||||
|
|
|
@ -32,19 +32,19 @@ char loadname[32]; // for hunk tags
|
|||
void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer);
|
||||
void Mod_LoadBrushModel (qmodel_t *mod, void *buffer);
|
||||
void Mod_LoadAliasModel (qmodel_t *mod, void *buffer);
|
||||
qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash);
|
||||
qmodel_t *Mod_LoadModel (qmodel_t *mod, bool crash);
|
||||
|
||||
cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE};
|
||||
|
||||
static byte *mod_novis;
|
||||
static int mod_novis_capacity;
|
||||
static int32_t mod_novis_capacity;
|
||||
|
||||
static byte *mod_decompressed;
|
||||
static int mod_decompressed_capacity;
|
||||
static int32_t mod_decompressed_capacity;
|
||||
|
||||
#define MAX_MOD_KNOWN 2048 /*johnfitz -- was 512 */
|
||||
qmodel_t mod_known[MAX_MOD_KNOWN];
|
||||
int mod_numknown;
|
||||
int32_t mod_numknown;
|
||||
|
||||
texture_t *r_notexture_mip; //johnfitz -- moved here from r_main.c
|
||||
texture_t *r_notexture_mip2; //johnfitz -- used for non-lightmapped surfs with a missing texture
|
||||
|
@ -130,10 +130,10 @@ Mod_DecompressVis
|
|||
*/
|
||||
byte *Mod_DecompressVis (byte *in, qmodel_t *model)
|
||||
{
|
||||
int c;
|
||||
int32_t c;
|
||||
byte *out;
|
||||
byte *outend;
|
||||
int row;
|
||||
int32_t row;
|
||||
|
||||
row = (model->numleafs+7)>>3;
|
||||
if (mod_decompressed == NULL || row > mod_decompressed_capacity)
|
||||
|
@ -141,7 +141,7 @@ byte *Mod_DecompressVis (byte *in, qmodel_t *model)
|
|||
mod_decompressed_capacity = row;
|
||||
mod_decompressed = (byte *) realloc (mod_decompressed, mod_decompressed_capacity);
|
||||
if (!mod_decompressed)
|
||||
Sys_Error ("Mod_DecompressVis: realloc() failed on %d bytes", mod_decompressed_capacity);
|
||||
Sys_Error ("Mod_DecompressVis: realloc() failed on %" PRIi32 " bytes", mod_decompressed_capacity);
|
||||
}
|
||||
out = mod_decompressed;
|
||||
outend = mod_decompressed + row;
|
||||
|
@ -193,7 +193,7 @@ byte *Mod_LeafPVS (mleaf_t *leaf, qmodel_t *model)
|
|||
|
||||
byte *Mod_NoVisPVS (qmodel_t *model)
|
||||
{
|
||||
int pvsbytes;
|
||||
int32_t pvsbytes;
|
||||
|
||||
pvsbytes = (model->numleafs+7)>>3;
|
||||
if (mod_novis == NULL || pvsbytes > mod_novis_capacity)
|
||||
|
@ -201,7 +201,7 @@ byte *Mod_NoVisPVS (qmodel_t *model)
|
|||
mod_novis_capacity = pvsbytes;
|
||||
mod_novis = (byte *) realloc (mod_novis, mod_novis_capacity);
|
||||
if (!mod_novis)
|
||||
Sys_Error ("Mod_NoVisPVS: realloc() failed on %d bytes", mod_novis_capacity);
|
||||
Sys_Error ("Mod_NoVisPVS: realloc() failed on %" PRIi32 " bytes", mod_novis_capacity);
|
||||
|
||||
memset(mod_novis, 0xff, mod_novis_capacity);
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ Mod_ClearAll
|
|||
*/
|
||||
void Mod_ClearAll (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
qmodel_t *mod;
|
||||
|
||||
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
|
||||
|
@ -228,7 +228,7 @@ void Mod_ClearAll (void)
|
|||
|
||||
void Mod_ResetAll (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
qmodel_t *mod;
|
||||
|
||||
//ericw -- free alias model VBOs
|
||||
|
@ -251,7 +251,7 @@ Mod_FindName
|
|||
*/
|
||||
qmodel_t *Mod_FindName (const char *name)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
qmodel_t *mod;
|
||||
|
||||
if (!name[0])
|
||||
|
@ -302,11 +302,11 @@ Mod_LoadModel
|
|||
Loads a model into the cache
|
||||
==================
|
||||
*/
|
||||
qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash)
|
||||
qmodel_t *Mod_LoadModel (qmodel_t *mod, bool crash)
|
||||
{
|
||||
byte *buf;
|
||||
byte stackbuf[1024]; // avoid dirtying the cache heap
|
||||
int mod_type;
|
||||
int32_t mod_type;
|
||||
|
||||
if (!mod->needload)
|
||||
{
|
||||
|
@ -378,7 +378,7 @@ Mod_ForName
|
|||
Loads in a model for the given name
|
||||
==================
|
||||
*/
|
||||
qmodel_t *Mod_ForName (const char *name, qboolean crash)
|
||||
qmodel_t *Mod_ForName (const char *name, bool crash)
|
||||
{
|
||||
qmodel_t *mod;
|
||||
|
||||
|
@ -403,9 +403,9 @@ byte *mod_base;
|
|||
Mod_CheckFullbrights -- johnfitz
|
||||
=================
|
||||
*/
|
||||
qboolean Mod_CheckFullbrights (byte *pixels, int count)
|
||||
bool Mod_CheckFullbrights (byte *pixels, int32_t count)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for (i = 0; i < count; i++)
|
||||
if (*pixels++ > 223)
|
||||
return true;
|
||||
|
@ -419,7 +419,7 @@ Mod_LoadTextures
|
|||
*/
|
||||
void Mod_LoadTextures (lump_t *l)
|
||||
{
|
||||
int i, j, pixels, num, maxanim, altmax;
|
||||
int32_t i, j, pixels, num, maxanim, altmax;
|
||||
miptex_t *mt;
|
||||
texture_t *tx, *tx2;
|
||||
texture_t *anims[10];
|
||||
|
@ -427,9 +427,9 @@ void Mod_LoadTextures (lump_t *l)
|
|||
dmiptexlump_t *m;
|
||||
//johnfitz -- more variables
|
||||
char texturename[64];
|
||||
int nummiptex;
|
||||
int32_t nummiptex;
|
||||
src_offset_t offset;
|
||||
int mark, fwidth, fheight;
|
||||
int32_t mark, fwidth, fheight;
|
||||
char filename[MAX_OSPATH], filename2[MAX_OSPATH], mapname[MAX_OSPATH];
|
||||
byte *data;
|
||||
extern byte *hunk_base;
|
||||
|
@ -536,7 +536,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
else //regular texture
|
||||
{
|
||||
// ericw -- fence textures
|
||||
int extraflags;
|
||||
int32_t extraflags;
|
||||
|
||||
extraflags = 0;
|
||||
if (tx->name[0] == '{')
|
||||
|
@ -673,7 +673,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
{
|
||||
tx2 = anims[j];
|
||||
if (!tx2)
|
||||
Sys_Error ("Missing frame %i of %s",j, tx->name);
|
||||
Sys_Error ("Missing frame %" PRIi32 " of %s",j, tx->name);
|
||||
tx2->anim_total = maxanim * ANIM_CYCLE;
|
||||
tx2->anim_min = j * ANIM_CYCLE;
|
||||
tx2->anim_max = (j+1) * ANIM_CYCLE;
|
||||
|
@ -685,7 +685,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
{
|
||||
tx2 = altanims[j];
|
||||
if (!tx2)
|
||||
Sys_Error ("Missing frame %i of %s",j, tx->name);
|
||||
Sys_Error ("Missing frame %" PRIi32 " of %s",j, tx->name);
|
||||
tx2->anim_total = altmax * ANIM_CYCLE;
|
||||
tx2->anim_min = j * ANIM_CYCLE;
|
||||
tx2->anim_max = (j+1) * ANIM_CYCLE;
|
||||
|
@ -703,7 +703,7 @@ Mod_LoadLighting -- johnfitz -- replaced with lit support code via lordhavoc
|
|||
*/
|
||||
void Mod_LoadLighting (lump_t *l)
|
||||
{
|
||||
int i, mark;
|
||||
int32_t i, mark;
|
||||
byte *in, *out, *data;
|
||||
byte d;
|
||||
char litfilename[MAX_OSPATH];
|
||||
|
@ -728,7 +728,7 @@ void Mod_LoadLighting (lump_t *l)
|
|||
else
|
||||
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T')
|
||||
{
|
||||
i = LittleLong(((int *)data)[1]);
|
||||
i = LittleLong(((int32_t *)data)[1]);
|
||||
if (i == 1)
|
||||
{
|
||||
Con_DPrintf2("%s loaded\n", litfilename);
|
||||
|
@ -738,7 +738,7 @@ void Mod_LoadLighting (lump_t *l)
|
|||
else
|
||||
{
|
||||
Hunk_FreeToLowMark(mark);
|
||||
Con_Printf("Unknown .lit file version (%d)\n", i);
|
||||
Con_Printf("Unknown .lit file version (%" PRIi32 ")\n", i);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -791,7 +791,7 @@ void Mod_LoadEntities (lump_t *l)
|
|||
{
|
||||
char entfilename[MAX_QPATH];
|
||||
char *ents;
|
||||
int mark;
|
||||
int32_t mark;
|
||||
uint32_t path_id;
|
||||
|
||||
if (! external_ents.value)
|
||||
|
@ -840,7 +840,7 @@ void Mod_LoadVertexes (lump_t *l)
|
|||
{
|
||||
dvertex_t *in;
|
||||
mvertex_t *out;
|
||||
int i, count;
|
||||
int32_t i, count;
|
||||
|
||||
in = (dvertex_t *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
|
@ -864,10 +864,10 @@ void Mod_LoadVertexes (lump_t *l)
|
|||
Mod_LoadEdges
|
||||
=================
|
||||
*/
|
||||
void Mod_LoadEdges (lump_t *l, int bsp2)
|
||||
void Mod_LoadEdges (lump_t *l, int32_t bsp2)
|
||||
{
|
||||
medge_t *out;
|
||||
int i, count;
|
||||
int32_t i, count;
|
||||
|
||||
if (bsp2)
|
||||
{
|
||||
|
@ -918,9 +918,9 @@ void Mod_LoadTexinfo (lump_t *l)
|
|||
{
|
||||
texinfo_t *in;
|
||||
mtexinfo_t *out;
|
||||
int i, j, count, miptex;
|
||||
int32_t i, j, count, miptex;
|
||||
float len1, len2;
|
||||
int missing = 0; //johnfitz
|
||||
int32_t missing = 0; //johnfitz
|
||||
|
||||
in = (texinfo_t *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
|
@ -978,7 +978,7 @@ void Mod_LoadTexinfo (lump_t *l)
|
|||
|
||||
//johnfitz: report missing textures
|
||||
if (missing && loadmodel->numtextures > 1)
|
||||
Con_Printf ("Mod_LoadTexinfo: %d texture(s) missing from BSP file\n", missing);
|
||||
Con_Printf ("Mod_LoadTexinfo: %" PRIi32 " texture(s) missing from BSP file\n", missing);
|
||||
//johnfitz
|
||||
}
|
||||
|
||||
|
@ -992,10 +992,10 @@ Fills in s->texturemins[] and s->extents[]
|
|||
void CalcSurfaceExtents (msurface_t *s)
|
||||
{
|
||||
float mins[2], maxs[2], val;
|
||||
int i,j, e;
|
||||
int32_t i,j, e;
|
||||
mvertex_t *v;
|
||||
mtexinfo_t *tex;
|
||||
int bmins[2], bmaxs[2];
|
||||
int32_t bmins[2], bmaxs[2];
|
||||
|
||||
mins[0] = mins[1] = 999999;
|
||||
maxs[0] = maxs[1] = -99999;
|
||||
|
@ -1062,7 +1062,7 @@ TODO: merge this into BuildSurfaceDisplayList?
|
|||
void Mod_PolyForUnlitSurface (msurface_t *fa)
|
||||
{
|
||||
vec3_t verts[64];
|
||||
int numverts, i, lindex;
|
||||
int32_t numverts, i, lindex;
|
||||
float *vec;
|
||||
glpoly_t *poly;
|
||||
float texscale;
|
||||
|
@ -1106,7 +1106,7 @@ Mod_CalcSurfaceBounds -- johnfitz -- calculate bounding box for per-surface frus
|
|||
*/
|
||||
void Mod_CalcSurfaceBounds (msurface_t *s)
|
||||
{
|
||||
int i, e;
|
||||
int32_t i, e;
|
||||
mvertex_t *v;
|
||||
|
||||
s->mins[0] = s->mins[1] = s->mins[2] = 9999;
|
||||
|
@ -1141,13 +1141,13 @@ void Mod_CalcSurfaceBounds (msurface_t *s)
|
|||
Mod_LoadFaces
|
||||
=================
|
||||
*/
|
||||
void Mod_LoadFaces (lump_t *l, qboolean bsp2)
|
||||
void Mod_LoadFaces (lump_t *l, bool bsp2)
|
||||
{
|
||||
dsface_t *ins;
|
||||
dlface_t *inl;
|
||||
msurface_t *out;
|
||||
int i, count, surfnum, lofs;
|
||||
int planenum, side, texinfon;
|
||||
int32_t i, count, surfnum, lofs;
|
||||
int32_t planenum, side, texinfon;
|
||||
|
||||
if (bsp2)
|
||||
{
|
||||
|
@ -1169,7 +1169,7 @@ void Mod_LoadFaces (lump_t *l, qboolean bsp2)
|
|||
|
||||
//johnfitz -- warn mappers about exceeding old limits
|
||||
if (count > 32767 && !bsp2)
|
||||
Con_DWarning ("%i faces exceeds standard limit of 32767.\n", count);
|
||||
Con_DWarning ("%" PRIi32 " faces exceeds standard limit of 32767.\n", count);
|
||||
//johnfitz
|
||||
|
||||
loadmodel->surfaces = out;
|
||||
|
@ -1285,7 +1285,7 @@ Mod_LoadNodes
|
|||
*/
|
||||
void Mod_LoadNodes_S (lump_t *l)
|
||||
{
|
||||
int i, j, count, p;
|
||||
int32_t i, j, count, p;
|
||||
dsnode_t *in;
|
||||
mnode_t *out;
|
||||
|
||||
|
@ -1297,7 +1297,7 @@ void Mod_LoadNodes_S (lump_t *l)
|
|||
|
||||
//johnfitz -- warn mappers about exceeding old limits
|
||||
if (count > 32767)
|
||||
Con_DWarning ("%i nodes exceeds standard limit of 32767.\n", count);
|
||||
Con_DWarning ("%" PRIi32 " nodes exceeds standard limit of 32767.\n", count);
|
||||
//johnfitz
|
||||
|
||||
loadmodel->nodes = out;
|
||||
|
@ -1330,7 +1330,7 @@ void Mod_LoadNodes_S (lump_t *l)
|
|||
out->children[j] = (mnode_t *)(loadmodel->leafs + p);
|
||||
else
|
||||
{
|
||||
Con_Printf("Mod_LoadNodes: invalid leaf index %i (file has only %i leafs)\n", p, loadmodel->numleafs);
|
||||
Con_Printf("Mod_LoadNodes: invalid leaf index %" PRIi32 " (file has only %" PRIi32 " leafs)\n", p, loadmodel->numleafs);
|
||||
out->children[j] = (mnode_t *)(loadmodel->leafs); //map it to the solid leaf
|
||||
}
|
||||
}
|
||||
|
@ -1341,7 +1341,7 @@ void Mod_LoadNodes_S (lump_t *l)
|
|||
|
||||
void Mod_LoadNodes_L1 (lump_t *l)
|
||||
{
|
||||
int i, j, count, p;
|
||||
int32_t i, j, count, p;
|
||||
dl1node_t *in;
|
||||
mnode_t *out;
|
||||
|
||||
|
@ -1382,7 +1382,7 @@ void Mod_LoadNodes_L1 (lump_t *l)
|
|||
out->children[j] = (mnode_t *)(loadmodel->leafs + p);
|
||||
else
|
||||
{
|
||||
Con_Printf("Mod_LoadNodes: invalid leaf index %i (file has only %i leafs)\n", p, loadmodel->numleafs);
|
||||
Con_Printf("Mod_LoadNodes: invalid leaf index %" PRIi32 " (file has only %" PRIi32 " leafs)\n", p, loadmodel->numleafs);
|
||||
out->children[j] = (mnode_t *)(loadmodel->leafs); //map it to the solid leaf
|
||||
}
|
||||
}
|
||||
|
@ -1393,7 +1393,7 @@ void Mod_LoadNodes_L1 (lump_t *l)
|
|||
|
||||
void Mod_LoadNodes_L2 (lump_t *l)
|
||||
{
|
||||
int i, j, count, p;
|
||||
int32_t i, j, count, p;
|
||||
dl2node_t *in;
|
||||
mnode_t *out;
|
||||
|
||||
|
@ -1434,7 +1434,7 @@ void Mod_LoadNodes_L2 (lump_t *l)
|
|||
out->children[j] = (mnode_t *)(loadmodel->leafs + p);
|
||||
else
|
||||
{
|
||||
Con_Printf("Mod_LoadNodes: invalid leaf index %i (file has only %i leafs)\n", p, loadmodel->numleafs);
|
||||
Con_Printf("Mod_LoadNodes: invalid leaf index %" PRIi32 " (file has only %" PRIi32 " leafs)\n", p, loadmodel->numleafs);
|
||||
out->children[j] = (mnode_t *)(loadmodel->leafs); //map it to the solid leaf
|
||||
}
|
||||
}
|
||||
|
@ -1443,7 +1443,7 @@ void Mod_LoadNodes_L2 (lump_t *l)
|
|||
}
|
||||
}
|
||||
|
||||
void Mod_LoadNodes (lump_t *l, int bsp2)
|
||||
void Mod_LoadNodes (lump_t *l, int32_t bsp2)
|
||||
{
|
||||
if (bsp2 == 2)
|
||||
Mod_LoadNodes_L2(l);
|
||||
|
@ -1455,10 +1455,10 @@ void Mod_LoadNodes (lump_t *l, int bsp2)
|
|||
Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs
|
||||
}
|
||||
|
||||
void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen)
|
||||
void Mod_ProcessLeafs_S (dsleaf_t *in, int32_t filelen)
|
||||
{
|
||||
mleaf_t *out;
|
||||
int i, j, count, p;
|
||||
int32_t i, j, count, p;
|
||||
|
||||
if (filelen % sizeof(*in))
|
||||
Sys_Error ("Mod_ProcessLeafs: funny lump size in %s", loadmodel->name);
|
||||
|
@ -1467,7 +1467,7 @@ void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen)
|
|||
|
||||
//johnfitz
|
||||
if (count > 32767)
|
||||
Host_Error ("Mod_LoadLeafs: %i leafs exceeds limit of 32767.\n", count);
|
||||
Host_Error ("Mod_LoadLeafs: %" PRIi32 " leafs exceeds limit of 32767.\n", count);
|
||||
//johnfitz
|
||||
|
||||
loadmodel->leafs = out;
|
||||
|
@ -1501,10 +1501,10 @@ void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen)
|
|||
}
|
||||
}
|
||||
|
||||
void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen)
|
||||
void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int32_t filelen)
|
||||
{
|
||||
mleaf_t *out;
|
||||
int i, j, count, p;
|
||||
int32_t i, j, count, p;
|
||||
|
||||
if (filelen % sizeof(*in))
|
||||
Sys_Error ("Mod_ProcessLeafs: funny lump size in %s", loadmodel->name);
|
||||
|
@ -1544,10 +1544,10 @@ void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen)
|
|||
}
|
||||
}
|
||||
|
||||
void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen)
|
||||
void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int32_t filelen)
|
||||
{
|
||||
mleaf_t *out;
|
||||
int i, j, count, p;
|
||||
int32_t i, j, count, p;
|
||||
|
||||
if (filelen % sizeof(*in))
|
||||
Sys_Error ("Mod_ProcessLeafs: funny lump size in %s", loadmodel->name);
|
||||
|
@ -1592,7 +1592,7 @@ void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen)
|
|||
Mod_LoadLeafs
|
||||
=================
|
||||
*/
|
||||
void Mod_LoadLeafs (lump_t *l, int bsp2)
|
||||
void Mod_LoadLeafs (lump_t *l, int32_t bsp2)
|
||||
{
|
||||
void *in = (void *)(mod_base + l->fileofs);
|
||||
|
||||
|
@ -1609,13 +1609,13 @@ void Mod_LoadLeafs (lump_t *l, int bsp2)
|
|||
Mod_LoadClipnodes
|
||||
=================
|
||||
*/
|
||||
void Mod_LoadClipnodes (lump_t *l, qboolean bsp2)
|
||||
void Mod_LoadClipnodes (lump_t *l, bool bsp2)
|
||||
{
|
||||
dsclipnode_t *ins;
|
||||
dlclipnode_t *inl;
|
||||
|
||||
mclipnode_t *out; //johnfitz -- was dclipnode_t
|
||||
int i, count;
|
||||
int32_t i, count;
|
||||
hull_t *hull;
|
||||
|
||||
if (bsp2)
|
||||
|
@ -1640,7 +1640,7 @@ void Mod_LoadClipnodes (lump_t *l, qboolean bsp2)
|
|||
|
||||
//johnfitz -- warn about exceeding old limits
|
||||
if (count > 32767 && !bsp2)
|
||||
Con_DWarning ("%i clipnodes exceeds standard limit of 32767.\n", count);
|
||||
Con_DWarning ("%" PRIi32 " clipnodes exceeds standard limit of 32767.\n", count);
|
||||
//johnfitz
|
||||
|
||||
loadmodel->clipnodes = out;
|
||||
|
@ -1721,7 +1721,7 @@ void Mod_MakeHull0 (void)
|
|||
{
|
||||
mnode_t *in, *child;
|
||||
mclipnode_t *out; //johnfitz -- was dclipnode_t
|
||||
int i, j, count;
|
||||
int32_t i, j, count;
|
||||
hull_t *hull;
|
||||
|
||||
hull = &loadmodel->hulls[0];
|
||||
|
@ -1754,9 +1754,9 @@ void Mod_MakeHull0 (void)
|
|||
Mod_LoadMarksurfaces
|
||||
=================
|
||||
*/
|
||||
void Mod_LoadMarksurfaces (lump_t *l, int bsp2)
|
||||
void Mod_LoadMarksurfaces (lump_t *l, int32_t bsp2)
|
||||
{
|
||||
int i, j, count;
|
||||
int32_t i, j, count;
|
||||
msurface_t **out;
|
||||
if (bsp2)
|
||||
{
|
||||
|
@ -1794,7 +1794,7 @@ void Mod_LoadMarksurfaces (lump_t *l, int bsp2)
|
|||
|
||||
//johnfitz -- warn mappers about exceeding old limits
|
||||
if (count > 32767)
|
||||
Con_DWarning ("%i marksurfaces exceeds standard limit of 32767.\n", count);
|
||||
Con_DWarning ("%" PRIi32 " marksurfaces exceeds standard limit of 32767.\n", count);
|
||||
//johnfitz
|
||||
|
||||
for (i=0 ; i<count ; i++)
|
||||
|
@ -1814,14 +1814,14 @@ Mod_LoadSurfedges
|
|||
*/
|
||||
void Mod_LoadSurfedges (lump_t *l)
|
||||
{
|
||||
int i, count;
|
||||
int *in, *out;
|
||||
int32_t i, count;
|
||||
int32_t *in, *out;
|
||||
|
||||
in = (int *)(mod_base + l->fileofs);
|
||||
in = (int32_t *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = (int *) Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = (int32_t *) Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->surfedges = out;
|
||||
loadmodel->numsurfedges = count;
|
||||
|
@ -1838,11 +1838,11 @@ Mod_LoadPlanes
|
|||
*/
|
||||
void Mod_LoadPlanes (lump_t *l)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
mplane_t *out;
|
||||
dplane_t *in;
|
||||
int count;
|
||||
int bits;
|
||||
int32_t count;
|
||||
int32_t bits;
|
||||
|
||||
in = (dplane_t *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
|
@ -1876,7 +1876,7 @@ RadiusFromBounds
|
|||
*/
|
||||
float RadiusFromBounds (vec3_t mins, vec3_t maxs)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
vec3_t corner;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
|
@ -1896,7 +1896,7 @@ void Mod_LoadSubmodels (lump_t *l)
|
|||
{
|
||||
dmodel_t *in;
|
||||
dmodel_t *out;
|
||||
int i, j, count;
|
||||
int32_t i, j, count;
|
||||
|
||||
in = (dmodel_t *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
|
@ -1926,7 +1926,7 @@ void Mod_LoadSubmodels (lump_t *l)
|
|||
out = loadmodel->submodels;
|
||||
|
||||
if (out->visleafs > 8192)
|
||||
Con_DWarning ("%i visleafs exceeds standard limit of 8192.\n", out->visleafs);
|
||||
Con_DWarning ("%" PRIi32 " visleafs exceeds standard limit of 8192.\n", out->visleafs);
|
||||
//johnfitz
|
||||
}
|
||||
|
||||
|
@ -1942,7 +1942,7 @@ Therefore, the bounding box of the hull can be constructed entirely
|
|||
from axial planes found in the clipnodes for that hull.
|
||||
=================
|
||||
*/
|
||||
void Mod_BoundsFromClipNode (qmodel_t *mod, int hull, int nodenum)
|
||||
void Mod_BoundsFromClipNode (qmodel_t *mod, int32_t hull, int32_t nodenum)
|
||||
{
|
||||
mplane_t *plane;
|
||||
mclipnode_t *node;
|
||||
|
@ -1989,8 +1989,8 @@ Mod_LoadBrushModel
|
|||
*/
|
||||
void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
|
||||
{
|
||||
int i, j;
|
||||
int bsp2;
|
||||
int32_t i, j;
|
||||
int32_t bsp2;
|
||||
dheader_t *header;
|
||||
dmodel_t *bm;
|
||||
float radius; //johnfitz
|
||||
|
@ -2013,15 +2013,15 @@ void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
|
|||
bsp2 = 2; //sanitised revision
|
||||
break;
|
||||
default:
|
||||
Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, mod->bspversion, BSPVERSION);
|
||||
Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%" PRIi32 " should be %" PRIi32 ")", mod->name, mod->bspversion, BSPVERSION);
|
||||
break;
|
||||
}
|
||||
|
||||
// swap all the lumps
|
||||
mod_base = (byte *)header;
|
||||
|
||||
for (i = 0; i < (int) sizeof(dheader_t) / 4; i++)
|
||||
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
|
||||
for (i = 0; i < (int32_t) sizeof(dheader_t) / 4; i++)
|
||||
((int32_t *)header)[i] = LittleLong ( ((int32_t *)header)[i]);
|
||||
|
||||
// load into heap
|
||||
|
||||
|
@ -2095,7 +2095,7 @@ void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
|
|||
{ // duplicate the basic information
|
||||
char name[10];
|
||||
|
||||
sprintf (name, "*%i", i+1);
|
||||
sprintf (name, "*%" PRIi32 "", i+1);
|
||||
loadmodel = Mod_FindName (name);
|
||||
*loadmodel = *mod;
|
||||
strcpy (loadmodel->name, name);
|
||||
|
@ -2120,7 +2120,7 @@ mtriangle_t triangles[MAXALIASTRIS];
|
|||
// a pose is a single set of vertexes. a frame may be
|
||||
// an animating sequence of poses
|
||||
trivertx_t *poseverts[MAXALIASFRAMES];
|
||||
int posenum;
|
||||
int32_t posenum;
|
||||
|
||||
byte **player_8bit_texels_tbl;
|
||||
byte *player_8bit_texels;
|
||||
|
@ -2133,7 +2133,7 @@ Mod_LoadAliasFrame
|
|||
void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame)
|
||||
{
|
||||
trivertx_t *pinframe;
|
||||
int i;
|
||||
int32_t i;
|
||||
daliasframe_t *pdaliasframe;
|
||||
|
||||
pdaliasframe = (daliasframe_t *)pin;
|
||||
|
@ -2170,7 +2170,7 @@ Mod_LoadAliasGroup
|
|||
void *Mod_LoadAliasGroup (void * pin, maliasframedesc_t *frame)
|
||||
{
|
||||
daliasgroup_t *pingroup;
|
||||
int i, numframes;
|
||||
int32_t i, numframes;
|
||||
daliasinterval_t *pin_intervals;
|
||||
void *ptemp;
|
||||
|
||||
|
@ -2239,13 +2239,13 @@ do { \
|
|||
else if (pos[off] != 255) fdc = pos[off]; \
|
||||
} while (0)
|
||||
|
||||
void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
|
||||
void Mod_FloodFillSkin( byte *skin, int32_t skinwidth, int32_t skinheight )
|
||||
{
|
||||
byte fillcolor = *skin; // assume this is the pixel to fill
|
||||
floodfill_t fifo[FLOODFILL_FIFO_SIZE];
|
||||
int inpt = 0, outpt = 0;
|
||||
int filledcolor = -1;
|
||||
int i;
|
||||
int32_t inpt = 0, outpt = 0;
|
||||
int32_t filledcolor = -1;
|
||||
int32_t i;
|
||||
|
||||
if (filledcolor == -1)
|
||||
{
|
||||
|
@ -2262,7 +2262,7 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
|
|||
// can't fill to filled color or to transparent color (used as visited marker)
|
||||
if ((fillcolor == filledcolor) || (fillcolor == 255))
|
||||
{
|
||||
//printf( "not filling skin from %d to %d\n", fillcolor, filledcolor );
|
||||
//printf( "not filling skin from %" PRIi32 " to %" PRIi32 "\n", fillcolor, filledcolor );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2271,8 +2271,8 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
|
|||
|
||||
while (outpt != inpt)
|
||||
{
|
||||
int x = fifo[outpt].x, y = fifo[outpt].y;
|
||||
int fdc = filledcolor;
|
||||
int32_t x = fifo[outpt].x, y = fifo[outpt].y;
|
||||
int32_t fdc = filledcolor;
|
||||
byte *pos = &skin[x + skinwidth * y];
|
||||
|
||||
outpt = (outpt + 1) & FLOODFILL_FIFO_MASK;
|
||||
|
@ -2290,9 +2290,9 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
|
|||
Mod_LoadAllSkins
|
||||
===============
|
||||
*/
|
||||
void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
||||
void *Mod_LoadAllSkins (int32_t numskins, daliasskintype_t *pskintype)
|
||||
{
|
||||
int i, j, k, size, groupskins;
|
||||
int32_t i, j, k, size, groupskins;
|
||||
char name[MAX_QPATH];
|
||||
byte *skin, *texels;
|
||||
daliasskingroup_t *pinskingroup;
|
||||
|
@ -2304,7 +2304,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
|||
skin = (byte *)(pskintype + 1);
|
||||
|
||||
if (numskins < 1 || numskins > MAX_SKINS)
|
||||
Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins);
|
||||
Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %" PRIi32 "\n", numskins);
|
||||
|
||||
size = pheader->skinwidth * pheader->skinheight;
|
||||
|
||||
|
@ -2323,13 +2323,13 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
|||
memcpy (texels, (byte *)(pskintype + 1), size);
|
||||
|
||||
//johnfitz -- rewritten
|
||||
q_snprintf (name, sizeof(name), "%s:frame%i", loadmodel->name, i);
|
||||
q_snprintf (name, sizeof(name), "%s:frame%" PRIi32 "", loadmodel->name, i);
|
||||
offset = (src_offset_t)(pskintype+1) - (src_offset_t)mod_base;
|
||||
if (Mod_CheckFullbrights ((byte *)(pskintype+1), size))
|
||||
{
|
||||
pheader->gltextures[i][0] = TexMgr_LoadImage (loadmodel, name, pheader->skinwidth, pheader->skinheight,
|
||||
SRC_INDEXED, (byte *)(pskintype+1), loadmodel->name, offset, texflags | TEXPREF_NOBRIGHT);
|
||||
q_snprintf (fbr_mask_name, sizeof(fbr_mask_name), "%s:frame%i_glow", loadmodel->name, i);
|
||||
q_snprintf (fbr_mask_name, sizeof(fbr_mask_name), "%s:frame%" PRIi32 "_glow", loadmodel->name, i);
|
||||
pheader->fbtextures[i][0] = TexMgr_LoadImage (loadmodel, fbr_mask_name, pheader->skinwidth, pheader->skinheight,
|
||||
SRC_INDEXED, (byte *)(pskintype+1), loadmodel->name, offset, texflags | TEXPREF_FULLBRIGHT);
|
||||
}
|
||||
|
@ -2366,13 +2366,13 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
|||
}
|
||||
|
||||
//johnfitz -- rewritten
|
||||
q_snprintf (name, sizeof(name), "%s:frame%i_%i", loadmodel->name, i,j);
|
||||
q_snprintf (name, sizeof(name), "%s:frame%" PRIi32 "_%" PRIi32 "", loadmodel->name, i,j);
|
||||
offset = (src_offset_t)(pskintype) - (src_offset_t)mod_base; //johnfitz
|
||||
if (Mod_CheckFullbrights ((byte *)(pskintype), size))
|
||||
{
|
||||
pheader->gltextures[i][j&3] = TexMgr_LoadImage (loadmodel, name, pheader->skinwidth, pheader->skinheight,
|
||||
SRC_INDEXED, (byte *)(pskintype), loadmodel->name, offset, texflags | TEXPREF_NOBRIGHT);
|
||||
q_snprintf (fbr_mask_name, sizeof(fbr_mask_name), "%s:frame%i_%i_glow", loadmodel->name, i,j);
|
||||
q_snprintf (fbr_mask_name, sizeof(fbr_mask_name), "%s:frame%" PRIi32 "_%" PRIi32 "_glow", loadmodel->name, i,j);
|
||||
pheader->fbtextures[i][j&3] = TexMgr_LoadImage (loadmodel, fbr_mask_name, pheader->skinwidth, pheader->skinheight,
|
||||
SRC_INDEXED, (byte *)(pskintype), loadmodel->name, offset, texflags | TEXPREF_FULLBRIGHT);
|
||||
}
|
||||
|
@ -2404,7 +2404,7 @@ Mod_CalcAliasBounds -- johnfitz -- calculate bounds of alias model for nonrotate
|
|||
*/
|
||||
void Mod_CalcAliasBounds (aliashdr_t *a)
|
||||
{
|
||||
int i,j,k;
|
||||
int32_t i,j,k;
|
||||
float dist, yawradius, radius;
|
||||
vec3_t v;
|
||||
|
||||
|
@ -2449,12 +2449,12 @@ void Mod_CalcAliasBounds (aliashdr_t *a)
|
|||
loadmodel->ymaxs[2] = loadmodel->maxs[2];
|
||||
}
|
||||
|
||||
static qboolean
|
||||
static bool
|
||||
nameInList(const char *list, const char *name)
|
||||
{
|
||||
const char *s;
|
||||
char tmp[MAX_QPATH];
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
s = list;
|
||||
|
||||
|
@ -2517,15 +2517,15 @@ Mod_LoadAliasModel
|
|||
*/
|
||||
void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
mdl_t *pinmodel;
|
||||
stvert_t *pinstverts;
|
||||
dtriangle_t *pintriangles;
|
||||
int version, numframes;
|
||||
int size;
|
||||
int32_t version, numframes;
|
||||
int32_t size;
|
||||
daliasframetype_t *pframetype;
|
||||
daliasskintype_t *pskintype;
|
||||
int start, end, total;
|
||||
int32_t start, end, total;
|
||||
|
||||
start = Hunk_LowMark ();
|
||||
|
||||
|
@ -2534,7 +2534,7 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
|
|||
|
||||
version = LittleLong (pinmodel->version);
|
||||
if (version != ALIAS_VERSION)
|
||||
Sys_Error ("%s has wrong version number (%i should be %i)",
|
||||
Sys_Error ("%s has wrong version number (%" PRIi32 " should be %" PRIi32 ")",
|
||||
mod->name, version, ALIAS_VERSION);
|
||||
|
||||
//
|
||||
|
@ -2556,7 +2556,7 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
|
|||
pheader->skinheight = LittleLong (pinmodel->skinheight);
|
||||
|
||||
if (pheader->skinheight > MAX_LBM_HEIGHT)
|
||||
Sys_Error ("model %s has a skin taller than %d", mod->name,
|
||||
Sys_Error ("model %s has a skin taller than %" PRIi32 "", mod->name,
|
||||
MAX_LBM_HEIGHT);
|
||||
|
||||
pheader->numverts = LittleLong (pinmodel->numverts);
|
||||
|
@ -2575,7 +2575,7 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
|
|||
pheader->numframes = LittleLong (pinmodel->numframes);
|
||||
numframes = pheader->numframes;
|
||||
if (numframes < 1)
|
||||
Sys_Error ("Mod_LoadAliasModel: Invalid # of frames: %d\n", numframes);
|
||||
Sys_Error ("Mod_LoadAliasModel: Invalid # of frames: %" PRIi32 "\n", numframes);
|
||||
|
||||
pheader->size = LittleFloat (pinmodel->size) * ALIAS_BASE_SIZE_RATIO;
|
||||
mod->synctype = (synctype_t) LittleLong (pinmodel->synctype);
|
||||
|
@ -2673,11 +2673,11 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
|
|||
Mod_LoadSpriteFrame
|
||||
=================
|
||||
*/
|
||||
void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
|
||||
void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int32_t framenum)
|
||||
{
|
||||
dspriteframe_t *pinframe;
|
||||
mspriteframe_t *pspriteframe;
|
||||
int width, height, size, origin[2];
|
||||
int32_t width, height, size, origin[2];
|
||||
char name[64];
|
||||
src_offset_t offset; //johnfitz
|
||||
|
||||
|
@ -2705,7 +2705,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
|
|||
pspriteframe->tmax = (float)height/(float)TexMgr_PadConditional(height);
|
||||
//johnfitz
|
||||
|
||||
q_snprintf (name, sizeof(name), "%s:frame%i", loadmodel->name, framenum);
|
||||
q_snprintf (name, sizeof(name), "%s:frame%" PRIi32 "", loadmodel->name, framenum);
|
||||
offset = (src_offset_t)(pinframe+1) - (src_offset_t)mod_base; //johnfitz
|
||||
pspriteframe->gltexture =
|
||||
TexMgr_LoadImage (loadmodel, name, width, height, SRC_INDEXED,
|
||||
|
@ -2721,11 +2721,11 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
|
|||
Mod_LoadSpriteGroup
|
||||
=================
|
||||
*/
|
||||
void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum)
|
||||
void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int32_t framenum)
|
||||
{
|
||||
dspritegroup_t *pingroup;
|
||||
mspritegroup_t *pspritegroup;
|
||||
int i, numframes;
|
||||
int32_t i, numframes;
|
||||
dspriteinterval_t *pin_intervals;
|
||||
float *poutintervals;
|
||||
void *ptemp;
|
||||
|
@ -2775,12 +2775,12 @@ Mod_LoadSpriteModel
|
|||
*/
|
||||
void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
|
||||
{
|
||||
int i;
|
||||
int version;
|
||||
int32_t i;
|
||||
int32_t version;
|
||||
dsprite_t *pin;
|
||||
msprite_t *psprite;
|
||||
int numframes;
|
||||
int size;
|
||||
int32_t numframes;
|
||||
int32_t size;
|
||||
dspriteframetype_t *pframetype;
|
||||
|
||||
pin = (dsprite_t *)buffer;
|
||||
|
@ -2789,7 +2789,7 @@ void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
|
|||
version = LittleLong (pin->version);
|
||||
if (version != SPRITE_VERSION)
|
||||
Sys_Error ("%s has wrong version number "
|
||||
"(%i should be %i)", mod->name, version, SPRITE_VERSION);
|
||||
"(%" PRIi32 " should be %" PRIi32 ")", mod->name, version, SPRITE_VERSION);
|
||||
|
||||
numframes = LittleLong (pin->numframes);
|
||||
|
||||
|
@ -2815,7 +2815,7 @@ void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
|
|||
// load the frames
|
||||
//
|
||||
if (numframes < 1)
|
||||
Sys_Error ("Mod_LoadSpriteModel: Invalid # of frames: %d\n", numframes);
|
||||
Sys_Error ("Mod_LoadSpriteModel: Invalid # of frames: %" PRIi32 "\n", numframes);
|
||||
|
||||
mod->numframes = numframes;
|
||||
|
||||
|
@ -2852,7 +2852,7 @@ Mod_Print
|
|||
*/
|
||||
void Mod_Print (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
qmodel_t *mod;
|
||||
|
||||
Con_SafePrintf ("Cached models:\n"); //johnfitz -- safeprint instead of print
|
||||
|
@ -2860,6 +2860,6 @@ void Mod_Print (void)
|
|||
{
|
||||
Con_SafePrintf ("%8p : %s\n", mod->cache.data, mod->name); //johnfitz -- safeprint instead of print
|
||||
}
|
||||
Con_Printf ("%i models\n",mod_numknown); //johnfitz -- print the total too
|
||||
Con_Printf ("%" PRIi32 " models\n",mod_numknown); //johnfitz -- print the total too
|
||||
}
|
||||
|
||||
|
|
|
@ -89,10 +89,10 @@ typedef struct texture_s
|
|||
struct gltexture_s *gltexture; //johnfitz -- pointer to gltexture
|
||||
struct gltexture_s *fullbright; //johnfitz -- fullbright mask texture
|
||||
struct gltexture_s *warpimage; //johnfitz -- for water animation
|
||||
qboolean update_warp; //johnfitz -- update warp this frame
|
||||
bool update_warp; //johnfitz -- update warp this frame
|
||||
struct msurface_s *texturechains[2]; // for texture chains
|
||||
int anim_total; // total tenths in sequence ( 0 = no)
|
||||
int anim_min, anim_max; // time for this frame min <=time< max
|
||||
int32_t anim_total; // total tenths in sequence ( 0 = no)
|
||||
int32_t anim_min, anim_max; // time for this frame min <=time< max
|
||||
struct texture_s *anim_next; // in the animation sequence
|
||||
struct texture_s *alternate_anims; // bmodels in frmae 1 use these
|
||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||
|
@ -125,7 +125,7 @@ typedef struct
|
|||
float vecs[2][4];
|
||||
float mipadjust;
|
||||
texture_t *texture;
|
||||
int flags;
|
||||
int32_t flags;
|
||||
} mtexinfo_t;
|
||||
|
||||
#define VERTEXSIZE 7
|
||||
|
@ -134,52 +134,52 @@ typedef struct glpoly_s
|
|||
{
|
||||
struct glpoly_s *next;
|
||||
struct glpoly_s *chain;
|
||||
int numverts;
|
||||
int32_t numverts;
|
||||
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
||||
} glpoly_t;
|
||||
|
||||
typedef struct msurface_s
|
||||
{
|
||||
int visframe; // should be drawn when node is crossed
|
||||
qboolean culled; // johnfitz -- for frustum culling
|
||||
int32_t visframe; // should be drawn when node is crossed
|
||||
bool culled; // johnfitz -- for frustum culling
|
||||
float mins[3]; // johnfitz -- for frustum culling
|
||||
float maxs[3]; // johnfitz -- for frustum culling
|
||||
|
||||
mplane_t *plane;
|
||||
int flags;
|
||||
int32_t flags;
|
||||
|
||||
int firstedge; // look up in model->surfedges[], negative numbers
|
||||
int numedges; // are backwards edges
|
||||
int32_t firstedge; // look up in model->surfedges[], negative numbers
|
||||
int32_t numedges; // are backwards edges
|
||||
|
||||
int16_t texturemins[2];
|
||||
int16_t extents[2];
|
||||
|
||||
int light_s, light_t; // gl lightmap coordinates
|
||||
int32_t light_s, light_t; // gl lightmap coordinates
|
||||
|
||||
glpoly_t *polys; // multiple if warped
|
||||
struct msurface_s *texturechain;
|
||||
|
||||
mtexinfo_t *texinfo;
|
||||
|
||||
int vbo_firstvert; // index of this surface's first vert in the VBO
|
||||
int32_t vbo_firstvert; // index of this surface's first vert in the VBO
|
||||
|
||||
// lighting info
|
||||
int dlightframe;
|
||||
int32_t dlightframe;
|
||||
uint32_t dlightbits[(MAX_DLIGHTS + 31) >> 5];
|
||||
// int is 32 bits, need an array for MAX_DLIGHTS > 32
|
||||
// int32_t is 32 bits, need an array for MAX_DLIGHTS > 32
|
||||
|
||||
int lightmaptexturenum;
|
||||
int32_t lightmaptexturenum;
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
|
||||
qboolean cached_dlight; // true if dynamic light in cache
|
||||
int32_t cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
|
||||
bool cached_dlight; // true if dynamic light in cache
|
||||
byte *samples; // [numstyles*surfsize]
|
||||
} msurface_t;
|
||||
|
||||
typedef struct mnode_s
|
||||
{
|
||||
// common with leaf
|
||||
int contents; // 0, to differentiate from leafs
|
||||
int visframe; // node needs to be traversed if current
|
||||
int32_t contents; // 0, to differentiate from leafs
|
||||
int32_t visframe; // node needs to be traversed if current
|
||||
|
||||
float minmaxs[6]; // for bounding box culling
|
||||
|
||||
|
@ -189,8 +189,8 @@ typedef struct mnode_s
|
|||
mplane_t *plane;
|
||||
struct mnode_s *children[2];
|
||||
|
||||
int firstsurface;
|
||||
int numsurfaces;
|
||||
int32_t firstsurface;
|
||||
int32_t numsurfaces;
|
||||
} mnode_t;
|
||||
|
||||
|
||||
|
@ -198,8 +198,8 @@ typedef struct mnode_s
|
|||
typedef struct mleaf_s
|
||||
{
|
||||
// common with node
|
||||
int contents; // wil be a negative contents number
|
||||
int visframe; // node needs to be traversed if current
|
||||
int32_t contents; // wil be a negative contents number
|
||||
int32_t visframe; // node needs to be traversed if current
|
||||
|
||||
float minmaxs[6]; // for bounding box culling
|
||||
|
||||
|
@ -210,16 +210,16 @@ typedef struct mleaf_s
|
|||
efrag_t *efrags;
|
||||
|
||||
msurface_t **firstmarksurface;
|
||||
int nummarksurfaces;
|
||||
int key; // BSP sequence number for leaf's contents
|
||||
int32_t nummarksurfaces;
|
||||
int32_t key; // BSP sequence number for leaf's contents
|
||||
byte ambient_sound_level[NUM_AMBIENTS];
|
||||
} mleaf_t;
|
||||
|
||||
//johnfitz -- for clipnodes>32k
|
||||
typedef struct mclipnode_s
|
||||
{
|
||||
int planenum;
|
||||
int children[2]; // negative numbers are contents
|
||||
int32_t planenum;
|
||||
int32_t children[2]; // negative numbers are contents
|
||||
} mclipnode_t;
|
||||
//johnfitz
|
||||
|
||||
|
@ -228,8 +228,8 @@ typedef struct
|
|||
{
|
||||
mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t
|
||||
mplane_t *planes;
|
||||
int firstclipnode;
|
||||
int lastclipnode;
|
||||
int32_t firstclipnode;
|
||||
int32_t lastclipnode;
|
||||
vec3_t clip_mins;
|
||||
vec3_t clip_maxs;
|
||||
} hull_t;
|
||||
|
@ -246,7 +246,7 @@ SPRITE MODELS
|
|||
// FIXME: shorten these?
|
||||
typedef struct mspriteframe_s
|
||||
{
|
||||
int width, height;
|
||||
int32_t width, height;
|
||||
float up, down, left, right;
|
||||
float smax, tmax; //johnfitz -- image might be padded
|
||||
struct gltexture_s *gltexture;
|
||||
|
@ -254,7 +254,7 @@ typedef struct mspriteframe_s
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int numframes;
|
||||
int32_t numframes;
|
||||
float *intervals;
|
||||
mspriteframe_t *frames[1];
|
||||
} mspritegroup_t;
|
||||
|
@ -267,10 +267,10 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int type;
|
||||
int maxwidth;
|
||||
int maxheight;
|
||||
int numframes;
|
||||
int32_t type;
|
||||
int32_t maxwidth;
|
||||
int32_t maxheight;
|
||||
int32_t numframes;
|
||||
float beamlength; // remove?
|
||||
void *cachespot; // remove?
|
||||
mspriteframedesc_t frames[1];
|
||||
|
@ -308,12 +308,12 @@ typedef struct meshst_s
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int firstpose;
|
||||
int numposes;
|
||||
int32_t firstpose;
|
||||
int32_t numposes;
|
||||
float interval;
|
||||
trivertx_t bboxmin;
|
||||
trivertx_t bboxmax;
|
||||
int frame;
|
||||
int32_t frame;
|
||||
char name[16];
|
||||
} maliasframedesc_t;
|
||||
|
||||
|
@ -321,56 +321,56 @@ typedef struct
|
|||
{
|
||||
trivertx_t bboxmin;
|
||||
trivertx_t bboxmax;
|
||||
int frame;
|
||||
int32_t frame;
|
||||
} maliasgroupframedesc_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numframes;
|
||||
int intervals;
|
||||
int32_t numframes;
|
||||
int32_t intervals;
|
||||
maliasgroupframedesc_t frames[1];
|
||||
} maliasgroup_t;
|
||||
|
||||
// !!! if this is changed, it must be changed in asm_draw.h too !!!
|
||||
typedef struct mtriangle_s {
|
||||
int facesfront;
|
||||
int vertindex[3];
|
||||
int32_t facesfront;
|
||||
int32_t vertindex[3];
|
||||
} mtriangle_t;
|
||||
|
||||
|
||||
#define MAX_SKINS 32
|
||||
typedef struct {
|
||||
int ident;
|
||||
int version;
|
||||
int32_t ident;
|
||||
int32_t version;
|
||||
vec3_t scale;
|
||||
vec3_t scale_origin;
|
||||
float boundingradius;
|
||||
vec3_t eyeposition;
|
||||
int numskins;
|
||||
int skinwidth;
|
||||
int skinheight;
|
||||
int numverts;
|
||||
int numtris;
|
||||
int numframes;
|
||||
int32_t numskins;
|
||||
int32_t skinwidth;
|
||||
int32_t skinheight;
|
||||
int32_t numverts;
|
||||
int32_t numtris;
|
||||
int32_t numframes;
|
||||
synctype_t synctype;
|
||||
int flags;
|
||||
int32_t flags;
|
||||
float size;
|
||||
|
||||
//ericw -- used to populate vbo
|
||||
int numverts_vbo; // number of verts with unique x,y,z,s,t
|
||||
int32_t numverts_vbo; // number of verts with unique x,y,z,s,t
|
||||
intptr_t meshdesc; // offset into extradata: numverts_vbo aliasmesh_t
|
||||
int numindexes;
|
||||
int32_t numindexes;
|
||||
intptr_t indexes; // offset into extradata: numindexes unsigned shorts
|
||||
intptr_t vertexes; // offset into extradata: numposes*vertsperframe trivertx_t
|
||||
//ericw --
|
||||
|
||||
int numposes;
|
||||
int poseverts;
|
||||
int posedata; // numposes*poseverts trivert_t
|
||||
int commands; // gl command list with embedded s/t
|
||||
int32_t numposes;
|
||||
int32_t poseverts;
|
||||
int32_t posedata; // numposes*poseverts trivert_t
|
||||
int32_t commands; // gl command list with embedded s/t
|
||||
struct gltexture_s *gltextures[MAX_SKINS][4]; //johnfitz
|
||||
struct gltexture_s *fbtextures[MAX_SKINS][4]; //johnfitz
|
||||
int texels[MAX_SKINS]; // only for player skins
|
||||
int32_t texels[MAX_SKINS]; // only for player skins
|
||||
maliasframedesc_t frames[1]; // variable sized
|
||||
} aliashdr_t;
|
||||
|
||||
|
@ -411,13 +411,13 @@ typedef struct qmodel_s
|
|||
char name[MAX_QPATH];
|
||||
uint32_t path_id; // path id of the game directory
|
||||
// that this model came from
|
||||
qboolean needload; // bmodels and sprites don't cache normally
|
||||
bool needload; // bmodels and sprites don't cache normally
|
||||
|
||||
modtype_t type;
|
||||
int numframes;
|
||||
int32_t numframes;
|
||||
synctype_t synctype;
|
||||
|
||||
int flags;
|
||||
int32_t flags;
|
||||
|
||||
//
|
||||
// volume occupied by the model graphics
|
||||
|
@ -430,59 +430,59 @@ typedef struct qmodel_s
|
|||
//
|
||||
// solid volume for clipping
|
||||
//
|
||||
qboolean clipbox;
|
||||
bool clipbox;
|
||||
vec3_t clipmins, clipmaxs;
|
||||
|
||||
//
|
||||
// brush model
|
||||
//
|
||||
int firstmodelsurface, nummodelsurfaces;
|
||||
int32_t firstmodelsurface, nummodelsurfaces;
|
||||
|
||||
int numsubmodels;
|
||||
int32_t numsubmodels;
|
||||
dmodel_t *submodels;
|
||||
|
||||
int numplanes;
|
||||
int32_t numplanes;
|
||||
mplane_t *planes;
|
||||
|
||||
int numleafs; // number of visible leafs, not counting 0
|
||||
int32_t numleafs; // number of visible leafs, not counting 0
|
||||
mleaf_t *leafs;
|
||||
|
||||
int numvertexes;
|
||||
int32_t numvertexes;
|
||||
mvertex_t *vertexes;
|
||||
|
||||
int numedges;
|
||||
int32_t numedges;
|
||||
medge_t *edges;
|
||||
|
||||
int numnodes;
|
||||
int32_t numnodes;
|
||||
mnode_t *nodes;
|
||||
|
||||
int numtexinfo;
|
||||
int32_t numtexinfo;
|
||||
mtexinfo_t *texinfo;
|
||||
|
||||
int numsurfaces;
|
||||
int32_t numsurfaces;
|
||||
msurface_t *surfaces;
|
||||
|
||||
int numsurfedges;
|
||||
int *surfedges;
|
||||
int32_t numsurfedges;
|
||||
int32_t *surfedges;
|
||||
|
||||
int numclipnodes;
|
||||
int32_t numclipnodes;
|
||||
mclipnode_t *clipnodes; //johnfitz -- was dclipnode_t
|
||||
|
||||
int nummarksurfaces;
|
||||
int32_t nummarksurfaces;
|
||||
msurface_t **marksurfaces;
|
||||
|
||||
hull_t hulls[MAX_MAP_HULLS];
|
||||
|
||||
int numtextures;
|
||||
int32_t numtextures;
|
||||
texture_t **textures;
|
||||
|
||||
byte *visdata;
|
||||
byte *lightdata;
|
||||
char *entities;
|
||||
|
||||
qboolean viswarn; // for Mod_DecompressVis()
|
||||
bool viswarn; // for Mod_DecompressVis()
|
||||
|
||||
int bspversion;
|
||||
int32_t bspversion;
|
||||
|
||||
//
|
||||
// alias model
|
||||
|
@ -490,9 +490,9 @@ typedef struct qmodel_s
|
|||
|
||||
GLuint meshvbo;
|
||||
GLuint meshindexesvbo;
|
||||
int vboindexofs; // offset in vbo of the hdr->numindexes unsigned shorts
|
||||
int vboxyzofs; // offset in vbo of hdr->numposes*hdr->numverts_vbo meshxyz_t
|
||||
int vbostofs; // offset in vbo of hdr->numverts_vbo meshst_t
|
||||
int32_t vboindexofs; // offset in vbo of the hdr->numindexes unsigned shorts
|
||||
int32_t vboxyzofs; // offset in vbo of hdr->numposes*hdr->numverts_vbo meshxyz_t
|
||||
int32_t vbostofs; // offset in vbo of hdr->numverts_vbo meshst_t
|
||||
|
||||
//
|
||||
// additional model data
|
||||
|
@ -506,7 +506,7 @@ typedef struct qmodel_s
|
|||
void Mod_Init (void);
|
||||
void Mod_ClearAll (void);
|
||||
void Mod_ResetAll (void); // for gamedir changes (Host_Game_f)
|
||||
qmodel_t *Mod_ForName (const char *name, qboolean crash);
|
||||
qmodel_t *Mod_ForName (const char *name, bool crash);
|
||||
void *Mod_Extradata (qmodel_t *mod); // handles caching
|
||||
void Mod_TouchModel (const char *name);
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ static efrag_t *R_GetEfrag (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
cl.free_efrags = (efrag_t *) Hunk_AllocName (EXTRA_EFRAGS * sizeof (efrag_t), "efrags");
|
||||
|
||||
|
@ -96,7 +96,7 @@ void R_SplitEntityOnNode (mnode_t *node)
|
|||
efrag_t *ef;
|
||||
mplane_t *splitplane;
|
||||
mleaf_t *leaf;
|
||||
int sides;
|
||||
int32_t sides;
|
||||
|
||||
if (node->contents == CONTENTS_SOLID)
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ void R_CheckEfrags (void)
|
|||
return; //don't spam when still parsing signon packet full of static ents
|
||||
|
||||
if (cl.num_efrags > 640 && dev_peakstats.efrags <= 640)
|
||||
Con_DWarning ("%i efrags exceeds standard limit of 640.\n", cl.num_efrags);
|
||||
Con_DWarning ("%" PRIi32 " efrags exceeds standard limit of 640.\n", cl.num_efrags);
|
||||
|
||||
dev_stats.efrags = cl.num_efrags;
|
||||
dev_peakstats.efrags = q_max(cl.num_efrags, dev_peakstats.efrags);
|
||||
|
@ -169,7 +169,7 @@ R_AddEfrags
|
|||
void R_AddEfrags (entity_t *ent)
|
||||
{
|
||||
qmodel_t *entmodel;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!ent->model)
|
||||
return;
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
int r_dlightframecount;
|
||||
int32_t r_dlightframecount;
|
||||
|
||||
extern cvar_t r_flatlightstyles; //johnfitz
|
||||
|
||||
|
@ -34,12 +34,12 @@ R_AnimateLight
|
|||
*/
|
||||
void R_AnimateLight (void)
|
||||
{
|
||||
int i,j,k;
|
||||
int32_t i,j,k;
|
||||
|
||||
//
|
||||
// light animations
|
||||
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
||||
i = (int)(cl.time*10);
|
||||
i = (int32_t)(cl.time*10);
|
||||
for (j=0 ; j<MAX_LIGHTSTYLES ; j++)
|
||||
{
|
||||
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)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
float a;
|
||||
vec3_t v;
|
||||
float rad;
|
||||
|
@ -123,7 +123,7 @@ R_RenderDlights
|
|||
*/
|
||||
void R_RenderDlights (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
dlight_t *l;
|
||||
|
||||
if (!gl_flashblend.value)
|
||||
|
@ -166,13 +166,13 @@ DYNAMIC LIGHTS
|
|||
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;
|
||||
msurface_t *surf;
|
||||
vec3_t impact;
|
||||
float dist, l, maxdist;
|
||||
int i, j, s, t;
|
||||
int32_t i, j, s, t;
|
||||
|
||||
start:
|
||||
|
||||
|
@ -236,7 +236,7 @@ R_PushDlights
|
|||
*/
|
||||
void R_PushDlights (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
dlight_t *l;
|
||||
|
||||
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
|
||||
=============
|
||||
*/
|
||||
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;
|
||||
vec3_t mid;
|
||||
|
@ -311,7 +311,7 @@ loc0:
|
|||
return true; // hit something
|
||||
else
|
||||
{
|
||||
int i, ds, dt;
|
||||
int32_t i, ds, dt;
|
||||
msurface_t *surf;
|
||||
// check for impact on this node
|
||||
VectorCopy (mid, lightspot);
|
||||
|
@ -326,8 +326,8 @@ loc0:
|
|||
// ericw -- added double casts to force 64-bit precision.
|
||||
// Without them the zombie at the start of jam3_ericw.bsp was
|
||||
// incorrectly being lit up in SSE builds.
|
||||
ds = (int) ((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]);
|
||||
ds = (int32_t) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]);
|
||||
dt = (int32_t) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]);
|
||||
|
||||
if (ds < surf->texturemins[0] || dt < surf->texturemins[1])
|
||||
continue;
|
||||
|
@ -342,7 +342,7 @@ loc0:
|
|||
{
|
||||
// LordHavoc: enhanced to interpolate lighting
|
||||
byte *lightmap;
|
||||
int maps, line3, dsfrac = ds & 15, dtfrac = dt & 15, r00 = 0, g00 = 0, b00 = 0, r01 = 0, g01 = 0, b01 = 0, r10 = 0, g10 = 0, b10 = 0, r11 = 0, g11 = 0, b11 = 0;
|
||||
int32_t maps, line3, dsfrac = ds & 15, dtfrac = dt & 15, r00 = 0, g00 = 0, b00 = 0, r01 = 0, g01 = 0, b01 = 0, r10 = 0, g10 = 0, b10 = 0, r11 = 0, g11 = 0, b11 = 0;
|
||||
float scale;
|
||||
line3 = ((surf->extents[0]>>4)+1)*3;
|
||||
|
||||
|
@ -358,9 +358,9 @@ loc0:
|
|||
lightmap += ((surf->extents[0]>>4)+1) * ((surf->extents[1]>>4)+1)*3; // LordHavoc: *3 for colored lighting
|
||||
}
|
||||
|
||||
color[0] += (float) ((int) ((((((((r11-r10) * dsfrac) >> 4) + r10)-((((r01-r00) * dsfrac) >> 4) + r00)) * dtfrac) >> 4) + ((((r01-r00) * dsfrac) >> 4) + r00)));
|
||||
color[1] += (float) ((int) ((((((((g11-g10) * dsfrac) >> 4) + g10)-((((g01-g00) * dsfrac) >> 4) + g00)) * dtfrac) >> 4) + ((((g01-g00) * dsfrac) >> 4) + g00)));
|
||||
color[2] += (float) ((int) ((((((((b11-b10) * dsfrac) >> 4) + b10)-((((b01-b00) * dsfrac) >> 4) + b00)) * dtfrac) >> 4) + ((((b01-b00) * dsfrac) >> 4) + b00)));
|
||||
color[0] += (float) ((int32_t) ((((((((r11-r10) * dsfrac) >> 4) + r10)-((((r01-r00) * dsfrac) >> 4) + r00)) * dtfrac) >> 4) + ((((r01-r00) * dsfrac) >> 4) + r00)));
|
||||
color[1] += (float) ((int32_t) ((((((((g11-g10) * dsfrac) >> 4) + g10)-((((g01-g00) * dsfrac) >> 4) + g00)) * dtfrac) >> 4) + ((((g01-g00) * dsfrac) >> 4) + g00)));
|
||||
color[2] += (float) ((int32_t) ((((((((b11-b10) * dsfrac) >> 4) + b10)-((((b01-b00) * dsfrac) >> 4) + b00)) * dtfrac) >> 4) + ((((b01-b00) * dsfrac) >> 4) + b00)));
|
||||
}
|
||||
return true; // success
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ loc0:
|
|||
R_LightPoint -- johnfitz -- replaced entire function for lit support via lordhavoc
|
||||
=============
|
||||
*/
|
||||
int R_LightPoint (vec3_t p)
|
||||
int32_t R_LightPoint (vec3_t p)
|
||||
{
|
||||
vec3_t end;
|
||||
|
||||
|
|
|
@ -23,19 +23,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
qboolean r_cache_thrash; // compatability
|
||||
bool r_cache_thrash; // compatability
|
||||
|
||||
vec3_t modelorg, r_entorigin;
|
||||
entity_t *currententity;
|
||||
|
||||
int r_visframecount; // bumped when going to a new PVS
|
||||
int r_framecount; // used for dlight push checking
|
||||
int32_t r_visframecount; // bumped when going to a new PVS
|
||||
int32_t r_framecount; // used for dlight push checking
|
||||
|
||||
mplane_t frustum[4];
|
||||
|
||||
//johnfitz -- rendering statistics
|
||||
int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
|
||||
int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
|
||||
int32_t rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
|
||||
int32_t rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
|
||||
float rs_megatexels;
|
||||
|
||||
//
|
||||
|
@ -55,7 +55,7 @@ refdef_t r_refdef;
|
|||
|
||||
mleaf_t *r_viewleaf, *r_oldviewleaf;
|
||||
|
||||
int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||
int32_t d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||
|
||||
|
||||
cvar_t r_norefresh = {"r_norefresh","0",CVAR_NONE};
|
||||
|
@ -110,7 +110,7 @@ cvar_t r_slimealpha = {"r_slimealpha","0",CVAR_NONE};
|
|||
|
||||
float map_wateralpha, map_lavaalpha, map_telealpha, map_slimealpha;
|
||||
|
||||
qboolean r_drawflat_cheatsafe, r_fullbright_cheatsafe, r_lightmap_cheatsafe, r_drawworld_cheatsafe; //johnfitz
|
||||
bool r_drawflat_cheatsafe, r_fullbright_cheatsafe, r_lightmap_cheatsafe, r_drawworld_cheatsafe; //johnfitz
|
||||
|
||||
cvar_t r_scale = {"r_scale", "1", CVAR_ARCHIVE};
|
||||
|
||||
|
@ -122,7 +122,7 @@ cvar_t r_scale = {"r_scale", "1", CVAR_ARCHIVE};
|
|||
|
||||
static GLuint r_gamma_texture;
|
||||
static GLuint r_gamma_program;
|
||||
static int r_gamma_texture_width, r_gamma_texture_height;
|
||||
static int32_t r_gamma_texture_width, r_gamma_texture_height;
|
||||
|
||||
// uniforms used in gamma shader
|
||||
static GLuint gammaLoc;
|
||||
|
@ -209,7 +209,7 @@ void GLSLGamma_GammaCorrect (void)
|
|||
r_gamma_texture_width = TexMgr_Pad(r_gamma_texture_width);
|
||||
r_gamma_texture_height = TexMgr_Pad(r_gamma_texture_height);
|
||||
}
|
||||
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, r_gamma_texture_width, r_gamma_texture_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
@ -224,7 +224,7 @@ void GLSLGamma_GammaCorrect (void)
|
|||
Sys_Error("GLSLGamma_CreateShaders failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// copy the framebuffer to the texture
|
||||
GL_DisableMultitexture();
|
||||
glBindTexture (GL_TEXTURE_2D, r_gamma_texture);
|
||||
|
@ -254,9 +254,9 @@ void GLSLGamma_GammaCorrect (void)
|
|||
glTexCoord2f (0, tmax);
|
||||
glVertex2f (-1, 1);
|
||||
glEnd ();
|
||||
|
||||
|
||||
GL_UseProgramFunc (0);
|
||||
|
||||
|
||||
// clear cached binding
|
||||
GL_ClearBindings ();
|
||||
}
|
||||
|
@ -268,9 +268,9 @@ R_CullBox -- johnfitz -- replaced with new function from lordhavoc
|
|||
Returns true if the box is completely outside the frustum
|
||||
=================
|
||||
*/
|
||||
qboolean 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;
|
||||
for (i = 0;i < 4;i++)
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ qboolean R_CullBox (vec3_t emins, vec3_t emaxs)
|
|||
R_CullModelForEntity -- johnfitz -- uses correct bounds based on rotation
|
||||
===============
|
||||
*/
|
||||
qboolean R_CullModelForEntity (entity_t *e)
|
||||
bool R_CullModelForEntity (entity_t *e)
|
||||
{
|
||||
vec3_t mins, maxs;
|
||||
|
||||
|
@ -362,7 +362,7 @@ GL_PolygonOffset -- johnfitz
|
|||
negative offset moves polygon closer to camera
|
||||
=============
|
||||
*/
|
||||
void GL_PolygonOffset (int offset)
|
||||
void GL_PolygonOffset (int32_t offset)
|
||||
{
|
||||
if (offset > 0)
|
||||
{
|
||||
|
@ -389,9 +389,9 @@ void GL_PolygonOffset (int offset)
|
|||
//
|
||||
//==============================================================================
|
||||
|
||||
int SignbitsForPlane (mplane_t *out)
|
||||
int32_t SignbitsForPlane (mplane_t *out)
|
||||
{
|
||||
int bits, j;
|
||||
int32_t bits, j;
|
||||
|
||||
// for fast box on planeside test
|
||||
|
||||
|
@ -434,7 +434,7 @@ R_SetFrustum -- johnfitz -- rewritten
|
|||
*/
|
||||
void R_SetFrustum (float fovx, float fovy)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (r_stereo.value)
|
||||
fovx += 10; //silly hack so that polygons don't drop out becuase of stereo skew
|
||||
|
@ -474,12 +474,12 @@ R_SetupGL
|
|||
*/
|
||||
void R_SetupGL (void)
|
||||
{
|
||||
int scale;
|
||||
int32_t scale;
|
||||
|
||||
//johnfitz -- rewrote this section
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity ();
|
||||
scale = CLAMP(1, (int)r_scale.value, 4); // ericw -- see R_ScaleView
|
||||
scale = CLAMP(1, (int32_t)r_scale.value, 4); // ericw -- see R_ScaleView
|
||||
glViewport (glx + r_refdef.vrect.x,
|
||||
gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height,
|
||||
r_refdef.vrect.width / scale,
|
||||
|
@ -571,7 +571,7 @@ void R_SetupView (void)
|
|||
r_fovy = r_refdef.fov_y;
|
||||
if (r_waterwarp.value)
|
||||
{
|
||||
int contents = Mod_PointInLeaf (r_origin, cl.worldmodel)->contents;
|
||||
int32_t contents = Mod_PointInLeaf (r_origin, cl.worldmodel)->contents;
|
||||
if (contents == CONTENTS_WATER || contents == CONTENTS_SLIME || contents == CONTENTS_LAVA)
|
||||
{
|
||||
//variance is a percentage of width, where width = 2 * tan(fov / 2) otherwise the effect is too dramatic at high FOV and too subtle at low FOV. what a mess!
|
||||
|
@ -616,9 +616,9 @@ void R_SetupView (void)
|
|||
R_DrawEntitiesOnList
|
||||
=============
|
||||
*/
|
||||
void R_DrawEntitiesOnList (qboolean alphapass) //johnfitz -- added parameter
|
||||
void R_DrawEntitiesOnList (bool alphapass) //johnfitz -- added parameter
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!r_drawentities.value)
|
||||
return;
|
||||
|
@ -689,7 +689,7 @@ R_EmitWirePoint -- johnfitz -- draws a wireframe cross shape for point entities
|
|||
*/
|
||||
void R_EmitWirePoint (vec3_t origin)
|
||||
{
|
||||
int size=8;
|
||||
int32_t size=8;
|
||||
|
||||
glBegin (GL_LINES);
|
||||
glVertex3f (origin[0]-size, origin[1], origin[2]);
|
||||
|
@ -734,7 +734,7 @@ void R_ShowBoundingBoxes (void)
|
|||
extern edict_t *sv_player;
|
||||
vec3_t mins,maxs;
|
||||
edict_t *ed;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!r_showbboxes.value || cl.maxclients > 1 || !r_drawentities.value || !sv.active)
|
||||
return;
|
||||
|
@ -787,7 +787,7 @@ R_ShowTris -- johnfitz
|
|||
void R_ShowTris (void)
|
||||
{
|
||||
extern cvar_t r_particles;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (r_showtris.value < 1 || r_showtris.value > 2 || cl.maxclients > 1)
|
||||
return;
|
||||
|
@ -870,7 +870,7 @@ R_DrawShadows
|
|||
*/
|
||||
void R_DrawShadows (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!r_shadows.value || !r_drawentities.value || r_drawflat_cheatsafe || r_lightmap_cheatsafe)
|
||||
return;
|
||||
|
@ -942,7 +942,7 @@ void R_RenderScene (void)
|
|||
}
|
||||
|
||||
static GLuint r_scaleview_texture;
|
||||
static int r_scaleview_texture_width, r_scaleview_texture_height;
|
||||
static int32_t r_scaleview_texture_width, r_scaleview_texture_height;
|
||||
|
||||
/*
|
||||
=============
|
||||
|
@ -960,7 +960,7 @@ void R_ScaleView_DeleteTexture (void)
|
|||
R_ScaleView
|
||||
|
||||
The r_scale cvar allows rendering the 3D view at 1/2, 1/3, or 1/4 resolution.
|
||||
This function scales the reduced resolution 3D view back up to fill
|
||||
This function scales the reduced resolution 3D view back up to fill
|
||||
r_refdef.vrect. This is for emulating a low-resolution pixellated look,
|
||||
or possibly as a perforance boost on slow graphics cards.
|
||||
================
|
||||
|
@ -968,11 +968,11 @@ or possibly as a perforance boost on slow graphics cards.
|
|||
void R_ScaleView (void)
|
||||
{
|
||||
float smax, tmax;
|
||||
int scale;
|
||||
int srcx, srcy, srcw, srch;
|
||||
int32_t scale;
|
||||
int32_t srcx, srcy, srcw, srch;
|
||||
|
||||
// copied from R_SetupGL()
|
||||
scale = CLAMP(1, (int)r_scale.value, 4);
|
||||
scale = CLAMP(1, (int32_t)r_scale.value, 4);
|
||||
srcx = glx + r_refdef.vrect.x;
|
||||
srcy = gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height;
|
||||
srcw = r_refdef.vrect.width / scale;
|
||||
|
@ -1090,7 +1090,7 @@ void R_RenderView (void)
|
|||
glColorMask(1, 0, 0, 1);
|
||||
VectorMA (r_refdef.vieworg, -0.5f * eyesep, vright, r_refdef.vieworg);
|
||||
frustum_skew = 0.5 * eyesep * NEARCLIP / fdepth;
|
||||
srand((int) (cl.time * 1000)); //sync random stuff between eyes
|
||||
srand((int32_t) (cl.time * 1000)); //sync random stuff between eyes
|
||||
|
||||
R_RenderScene ();
|
||||
|
||||
|
@ -1099,7 +1099,7 @@ void R_RenderView (void)
|
|||
glColorMask(0, 1, 1, 1);
|
||||
VectorMA (r_refdef.vieworg, 1.0f * eyesep, vright, r_refdef.vieworg);
|
||||
frustum_skew = -frustum_skew;
|
||||
srand((int) (cl.time * 1000)); //sync random stuff between eyes
|
||||
srand((int32_t) (cl.time * 1000)); //sync random stuff between eyes
|
||||
|
||||
R_RenderScene ();
|
||||
|
||||
|
@ -1119,16 +1119,16 @@ void R_RenderView (void)
|
|||
//johnfitz -- modified r_speeds output
|
||||
time2 = Sys_DoubleTime ();
|
||||
if (r_pos.value)
|
||||
Con_Printf ("x %i y %i z %i (pitch %i yaw %i roll %i)\n",
|
||||
(int)cl_entities[cl.viewentity].origin[0],
|
||||
(int)cl_entities[cl.viewentity].origin[1],
|
||||
(int)cl_entities[cl.viewentity].origin[2],
|
||||
(int)cl.viewangles[PITCH],
|
||||
(int)cl.viewangles[YAW],
|
||||
(int)cl.viewangles[ROLL]);
|
||||
Con_Printf ("x %" PRIi32 " y %" PRIi32 " z %" PRIi32 " (pitch %" PRIi32 " yaw %" PRIi32 " roll %" PRIi32 ")\n",
|
||||
(int32_t)cl_entities[cl.viewentity].origin[0],
|
||||
(int32_t)cl_entities[cl.viewentity].origin[1],
|
||||
(int32_t)cl_entities[cl.viewentity].origin[2],
|
||||
(int32_t)cl.viewangles[PITCH],
|
||||
(int32_t)cl.viewangles[YAW],
|
||||
(int32_t)cl.viewangles[ROLL]);
|
||||
else if (r_speeds.value == 2)
|
||||
Con_Printf ("%3i ms %4i/%4i wpoly %4i/%4i epoly %3i lmap %4i/%4i sky %1.1f mtex\n",
|
||||
(int)((time2-time1)*1000),
|
||||
Con_Printf ("%3" PRIi32 " ms %4" PRIi32 "/%4" PRIi32 " wpoly %4" PRIi32 "/%4" PRIi32 " epoly %3" PRIi32 " lmap %4" PRIi32 "%4" PRIi32 "sky %1.1f mtex\n",
|
||||
(int32_t)((time2-time1)*1000),
|
||||
rs_brushpolys,
|
||||
rs_brushpasses,
|
||||
rs_aliaspolys,
|
||||
|
@ -1138,8 +1138,8 @@ void R_RenderView (void)
|
|||
rs_skypasses,
|
||||
TexMgr_FrameUsage ());
|
||||
else if (r_speeds.value)
|
||||
Con_Printf ("%3i ms %4i wpoly %4i epoly %3i lmap\n",
|
||||
(int)((time2-time1)*1000),
|
||||
Con_Printf ("%3" PRIi32 " ms %4" PRIi32 " wpoly %4" PRIi32 " epoly %3" PRIi32 " lmap\n",
|
||||
(int32_t)((time2-time1)*1000),
|
||||
rs_brushpolys,
|
||||
rs_aliaspolys,
|
||||
rs_dynamiclightmaps);
|
||||
|
|
|
@ -81,10 +81,10 @@ R_SetClearColor_f -- johnfitz
|
|||
static void R_SetClearColor_f (cvar_t *var)
|
||||
{
|
||||
byte *rgb;
|
||||
int s;
|
||||
int32_t s;
|
||||
|
||||
(void)var;
|
||||
s = (int)r_clearcolor.value & 0xFF;
|
||||
s = (int32_t)r_clearcolor.value & 0xFF;
|
||||
rgb = (byte*)(d_8to24table + s);
|
||||
glClearColor (rgb[0]/255.0,rgb[1]/255.0,rgb[2]/255.0,0);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ R_Novis_f -- johnfitz
|
|||
*/
|
||||
static void R_VisChanged (cvar_t *var)
|
||||
{
|
||||
extern int vis_changed;
|
||||
extern int32_t vis_changed;
|
||||
(void)var;
|
||||
vis_changed = 1;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ R_Model_ExtraFlags_List_f -- johnfitz -- called when r_nolerp_list or r_noshadow
|
|||
static void R_Model_ExtraFlags_List_f (cvar_t *var)
|
||||
{
|
||||
(void)var;
|
||||
int i;
|
||||
int32_t i;
|
||||
for (i=0; i < MAX_MODELS; i++)
|
||||
Mod_SetExtraFlags (cl.model_precache[i]);
|
||||
}
|
||||
|
@ -258,9 +258,9 @@ void R_Init (void)
|
|||
R_TranslatePlayerSkin -- johnfitz -- rewritten. also, only handles new colors, not new skins
|
||||
===============
|
||||
*/
|
||||
void R_TranslatePlayerSkin (int playernum)
|
||||
void R_TranslatePlayerSkin (int32_t playernum)
|
||||
{
|
||||
int top, bottom;
|
||||
int32_t top, bottom;
|
||||
|
||||
top = (cl.scores[playernum].colors & 0xf0)>>4;
|
||||
bottom = cl.scores[playernum].colors &15;
|
||||
|
@ -278,12 +278,12 @@ the skin or model actually changes, instead of just new colors
|
|||
added bug fix from bengt jardup
|
||||
===============
|
||||
*/
|
||||
void R_TranslateNewPlayerSkin (int playernum)
|
||||
void R_TranslateNewPlayerSkin (int32_t playernum)
|
||||
{
|
||||
char name[64];
|
||||
byte *pixels;
|
||||
aliashdr_t *paliashdr;
|
||||
int skinnum;
|
||||
int32_t skinnum;
|
||||
|
||||
//get correct texture pixels
|
||||
currententity = &cl_entities[1+playernum];
|
||||
|
@ -298,14 +298,14 @@ void R_TranslateNewPlayerSkin (int playernum)
|
|||
//TODO: move these tests to the place where skinnum gets received from the server
|
||||
if (skinnum < 0 || skinnum >= paliashdr->numskins)
|
||||
{
|
||||
Con_DPrintf("(%d): Invalid player skin #%d\n", playernum, skinnum);
|
||||
Con_DPrintf("(%" PRIi32 "): Invalid player skin #%" PRIi32 "\n", playernum, skinnum);
|
||||
skinnum = 0;
|
||||
}
|
||||
|
||||
pixels = (byte *)paliashdr + paliashdr->texels[skinnum]; // This is not a persistent place!
|
||||
|
||||
//upload new image
|
||||
q_snprintf(name, sizeof(name), "player_%i", playernum);
|
||||
q_snprintf(name, sizeof(name), "player_%" PRIi32 "", playernum);
|
||||
playertextures[playernum] = TexMgr_LoadImage (currententity->model, name, paliashdr->skinwidth, paliashdr->skinheight,
|
||||
SRC_INDEXED, pixels, paliashdr->gltextures[skinnum][0]->source_file, paliashdr->gltextures[skinnum][0]->source_offset, TEXPREF_PAD | TEXPREF_OVERWRITE);
|
||||
|
||||
|
@ -320,7 +320,7 @@ R_NewGame -- johnfitz -- handle a game switch
|
|||
*/
|
||||
void R_NewGame (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
//clear playertexture pointers (the textures themselves were freed by texmgr_newgame)
|
||||
for (i=0; i<MAX_SCOREBOARD; i++)
|
||||
|
@ -389,7 +389,7 @@ R_NewMap
|
|||
*/
|
||||
void R_NewMap (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i=0 ; i<256 ; i++)
|
||||
d_lightstylevalue[i] = 264; // normal light value
|
||||
|
@ -425,7 +425,7 @@ For program optimization
|
|||
*/
|
||||
void R_TimeRefresh_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
float start, stop, time;
|
||||
|
||||
if (cls.state != ca_connected)
|
||||
|
@ -454,9 +454,9 @@ void D_FlushCaches (void)
|
|||
}
|
||||
|
||||
static GLuint gl_programs[16];
|
||||
static int gl_num_programs;
|
||||
static int32_t gl_num_programs;
|
||||
|
||||
static qboolean GL_CheckShader (GLuint shader)
|
||||
static bool GL_CheckShader (GLuint shader)
|
||||
{
|
||||
GLint status;
|
||||
GL_GetShaderivFunc (shader, GL_COMPILE_STATUS, &status);
|
||||
|
@ -475,7 +475,7 @@ static qboolean GL_CheckShader (GLuint shader)
|
|||
return true;
|
||||
}
|
||||
|
||||
static qboolean GL_CheckProgram (GLuint program)
|
||||
static bool GL_CheckProgram (GLuint program)
|
||||
{
|
||||
GLint status;
|
||||
GL_GetProgramivFunc (program, GL_LINK_STATUS, &status);
|
||||
|
@ -522,9 +522,9 @@ GL_CreateProgram
|
|||
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;
|
||||
|
||||
if (!gl_glsl_able)
|
||||
|
@ -588,7 +588,7 @@ Deletes any GLSL programs that have been created.
|
|||
*/
|
||||
void R_DeleteShaders (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!gl_glsl_able)
|
||||
return;
|
||||
|
@ -625,7 +625,7 @@ void GL_BindBuffer (GLenum target, GLuint buffer)
|
|||
cache = ¤t_element_array_buffer;
|
||||
break;
|
||||
default:
|
||||
Host_Error("GL_BindBuffer: unsupported target %d", (int)target);
|
||||
Host_Error("GL_BindBuffer: unsupported target %" PRIi32 "", (int32_t)target);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ console is:
|
|||
*/
|
||||
|
||||
|
||||
int glx, gly, glwidth, glheight;
|
||||
int32_t glx, gly, glwidth, glheight;
|
||||
|
||||
float scr_con_current;
|
||||
float scr_conlines; // lines of console to display
|
||||
|
@ -101,22 +101,22 @@ cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", CVAR_ARCHIVE};
|
|||
|
||||
extern cvar_t crosshair;
|
||||
|
||||
qboolean scr_initialized; // ready to draw
|
||||
bool scr_initialized; // ready to draw
|
||||
|
||||
qpic_t *scr_ram;
|
||||
qpic_t *scr_net;
|
||||
qpic_t *scr_turtle;
|
||||
|
||||
int clearconsole;
|
||||
int clearnotify;
|
||||
int32_t clearconsole;
|
||||
int32_t clearnotify;
|
||||
|
||||
vrect_t scr_vrect;
|
||||
|
||||
qboolean scr_disabled_for_loading;
|
||||
qboolean scr_drawloading;
|
||||
bool scr_disabled_for_loading;
|
||||
bool scr_drawloading;
|
||||
float scr_disabled_time;
|
||||
|
||||
int scr_tileclear_updates = 0; //johnfitz
|
||||
int32_t scr_tileclear_updates = 0; //johnfitz
|
||||
|
||||
void SCR_ScreenShot_f (void);
|
||||
|
||||
|
@ -131,9 +131,9 @@ CENTER PRINTING
|
|||
char scr_centerstring[1024];
|
||||
float scr_centertime_start; // for slow victory printing
|
||||
float scr_centertime_off;
|
||||
int scr_center_lines;
|
||||
int scr_erase_lines;
|
||||
int scr_erase_center;
|
||||
int32_t scr_center_lines;
|
||||
int32_t scr_erase_lines;
|
||||
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
|
||||
{
|
||||
char *start;
|
||||
int l;
|
||||
int j;
|
||||
int x, y;
|
||||
int remaining;
|
||||
int32_t l;
|
||||
int32_t j;
|
||||
int32_t x, y;
|
||||
int32_t remaining;
|
||||
|
||||
GL_SetCanvas (CANVAS_MENU); //johnfitz
|
||||
|
||||
|
@ -370,7 +370,7 @@ void SCR_Conwidth_f (cvar_t *var)
|
|||
{
|
||||
(void)var;
|
||||
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 &= 0xFFFFFFF8;
|
||||
vid.conheight = vid.conwidth * vid.height / vid.width;
|
||||
|
@ -444,9 +444,9 @@ void SCR_DrawFPS (void)
|
|||
{
|
||||
static double oldtime = 0;
|
||||
static double lastfps = 0;
|
||||
static int oldframecount = 0;
|
||||
static int32_t oldframecount = 0;
|
||||
double elapsed_time;
|
||||
int frames;
|
||||
int32_t frames;
|
||||
|
||||
elapsed_time = realtime - oldtime;
|
||||
frames = r_framecount - oldframecount;
|
||||
|
@ -468,7 +468,7 @@ void SCR_DrawFPS (void)
|
|||
if (scr_showfps.value)
|
||||
{
|
||||
char st[16];
|
||||
int x, y;
|
||||
int32_t x, y;
|
||||
sprintf (st, "%4.0f fps", lastfps);
|
||||
x = 320 - (strlen(st)<<3);
|
||||
y = 200 - 8;
|
||||
|
@ -490,12 +490,12 @@ void SCR_DrawClock (void)
|
|||
|
||||
if (scr_clock.value == 1)
|
||||
{
|
||||
int minutes, seconds;
|
||||
int32_t minutes, seconds;
|
||||
|
||||
minutes = cl.time / 60;
|
||||
seconds = ((int)cl.time)%60;
|
||||
seconds = ((int32_t)cl.time)%60;
|
||||
|
||||
sprintf (str,"%i:%i%i", minutes, seconds/10, seconds%10);
|
||||
sprintf (str,"%" PRIi32 ":%" PRIi32 "%" PRIi32 "", minutes, seconds/10, seconds%10);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
@ -515,8 +515,8 @@ SCR_DrawDevStats
|
|||
void SCR_DrawDevStats (void)
|
||||
{
|
||||
char str[40];
|
||||
int y = 25-9; //9=number of lines to print
|
||||
int x = 0; //margin
|
||||
int32_t y = 25-9; //9=number of lines to print
|
||||
int32_t x = 0; //margin
|
||||
|
||||
if (!devstats.value)
|
||||
return;
|
||||
|
@ -531,25 +531,25 @@ void SCR_DrawDevStats (void)
|
|||
sprintf (str, "---------+---------");
|
||||
Draw_String (x, (y++)*8-x, str);
|
||||
|
||||
sprintf (str, "Edicts |%4i %4i", dev_stats.edicts, dev_peakstats.edicts);
|
||||
sprintf (str, "Edicts |%4" PRIi32 " %4" PRIi32 "", dev_stats.edicts, dev_peakstats.edicts);
|
||||
Draw_String (x, (y++)*8-x, str);
|
||||
|
||||
sprintf (str, "Packet |%4i %4i", dev_stats.packetsize, dev_peakstats.packetsize);
|
||||
sprintf (str, "Packet |%4" PRIi32 " %4" PRIi32 "", dev_stats.packetsize, dev_peakstats.packetsize);
|
||||
Draw_String (x, (y++)*8-x, str);
|
||||
|
||||
sprintf (str, "Visedicts|%4i %4i", dev_stats.visedicts, dev_peakstats.visedicts);
|
||||
sprintf (str, "Visedicts|%4" PRIi32 " %4" PRIi32 "", dev_stats.visedicts, dev_peakstats.visedicts);
|
||||
Draw_String (x, (y++)*8-x, str);
|
||||
|
||||
sprintf (str, "Efrags |%4i %4i", dev_stats.efrags, dev_peakstats.efrags);
|
||||
sprintf (str, "Efrags |%4" PRIi32 " %4" PRIi32 "", dev_stats.efrags, dev_peakstats.efrags);
|
||||
Draw_String (x, (y++)*8-x, str);
|
||||
|
||||
sprintf (str, "Dlights |%4i %4i", dev_stats.dlights, dev_peakstats.dlights);
|
||||
sprintf (str, "Dlights |%4" PRIi32 " %4" PRIi32 "", dev_stats.dlights, dev_peakstats.dlights);
|
||||
Draw_String (x, (y++)*8-x, str);
|
||||
|
||||
sprintf (str, "Beams |%4i %4i", dev_stats.beams, dev_peakstats.beams);
|
||||
sprintf (str, "Beams |%4" PRIi32 " %4" PRIi32 "", dev_stats.beams, dev_peakstats.beams);
|
||||
Draw_String (x, (y++)*8-x, str);
|
||||
|
||||
sprintf (str, "Tempents |%4i %4i", dev_stats.tempents, dev_peakstats.tempents);
|
||||
sprintf (str, "Tempents |%4" PRIi32 " %4" PRIi32 "", dev_stats.tempents, dev_peakstats.tempents);
|
||||
Draw_String (x, (y++)*8-x, str);
|
||||
}
|
||||
|
||||
|
@ -578,7 +578,7 @@ SCR_DrawTurtle
|
|||
*/
|
||||
void SCR_DrawTurtle (void)
|
||||
{
|
||||
static int count;
|
||||
static int32_t count;
|
||||
|
||||
if (!scr_showturtle.value)
|
||||
return;
|
||||
|
@ -778,8 +778,8 @@ void SCR_ScreenShot_f (void)
|
|||
char ext[4];
|
||||
char imagename[16]; //johnfitz -- was [80]
|
||||
char checkname[MAX_OSPATH];
|
||||
int i, quality;
|
||||
qboolean ok;
|
||||
int32_t i, quality;
|
||||
bool ok;
|
||||
|
||||
Q_strncpy (ext, "png", sizeof(ext));
|
||||
|
||||
|
@ -811,7 +811,7 @@ void SCR_ScreenShot_f (void)
|
|||
// find a file name to save it to
|
||||
for (i=0; i<10000; i++)
|
||||
{
|
||||
q_snprintf (imagename, sizeof(imagename), "spasm%04i.%s", i, ext); // "fitz%04i.tga"
|
||||
q_snprintf (imagename, sizeof(imagename), "quake%04" PRIi32 ".%s", i, ext);
|
||||
q_snprintf (checkname, sizeof(checkname), "%s/%s", com_gamedir, imagename);
|
||||
if (Sys_FileTime(checkname) == -1)
|
||||
break; // file doesn't exist
|
||||
|
@ -898,14 +898,14 @@ void SCR_EndLoadingPlaque (void)
|
|||
//=============================================================================
|
||||
|
||||
const char *scr_notifystring;
|
||||
qboolean scr_drawdialog;
|
||||
bool scr_drawdialog;
|
||||
|
||||
void SCR_DrawNotifyString (void)
|
||||
{
|
||||
const char *start;
|
||||
int l;
|
||||
int j;
|
||||
int x, y;
|
||||
int32_t l;
|
||||
int32_t j;
|
||||
int32_t x, y;
|
||||
|
||||
GL_SetCanvas (CANVAS_MENU); //johnfitz
|
||||
|
||||
|
@ -942,10 +942,10 @@ Displays a text string in the center of the screen and waits for a Y or N
|
|||
keypress.
|
||||
==================
|
||||
*/
|
||||
int SCR_ModalMessage (const char *text, float timeout) //johnfitz -- timeout
|
||||
int32_t SCR_ModalMessage (const char *text, float timeout) //johnfitz -- timeout
|
||||
{
|
||||
double time1, time2; //johnfitz -- timeout
|
||||
int lastkey, lastchar;
|
||||
int32_t lastkey, lastchar;
|
||||
|
||||
if (cls.state == ca_dedicated)
|
||||
return true;
|
||||
|
|
|
@ -30,8 +30,8 @@ float Fog_GetDensity(void);
|
|||
float *Fog_GetColor(void);
|
||||
|
||||
extern qmodel_t *loadmodel;
|
||||
extern int rs_skypolys; //for r_speeds readout
|
||||
extern int rs_skypasses; //for r_speeds readout
|
||||
extern int32_t rs_skypolys; //for r_speeds readout
|
||||
extern int32_t rs_skypasses; //for r_speeds readout
|
||||
float skyflatcolor[3];
|
||||
float skymins[2][6], skymaxs[2][6];
|
||||
|
||||
|
@ -46,7 +46,7 @@ cvar_t r_sky_quality = {"r_sky_quality", "12", CVAR_NONE};
|
|||
cvar_t r_skyalpha = {"r_skyalpha", "1", CVAR_NONE};
|
||||
cvar_t r_skyfog = {"r_skyfog","0.5",CVAR_NONE};
|
||||
|
||||
int skytexorder[6] = {0,2,1,3,4,5}; //for skybox
|
||||
int32_t skytexorder[6] = {0,2,1,3,4,5}; //for skybox
|
||||
|
||||
vec3_t skyclip[6] = {
|
||||
{1,1,0},
|
||||
|
@ -57,7 +57,7 @@ vec3_t skyclip[6] = {
|
|||
{-1,0,1}
|
||||
};
|
||||
|
||||
int st_to_vec[6][3] =
|
||||
int32_t st_to_vec[6][3] =
|
||||
{
|
||||
{3,-1,2},
|
||||
{-3,1,2},
|
||||
|
@ -67,7 +67,7 @@ int st_to_vec[6][3] =
|
|||
{2,-1,-3} // straight down
|
||||
};
|
||||
|
||||
int vec_to_st[6][3] =
|
||||
int32_t vec_to_st[6][3] =
|
||||
{
|
||||
{-2,3,1},
|
||||
{2,3,-1},
|
||||
|
@ -95,7 +95,7 @@ A sky texture is 256*128, with the left side being a masked overlay
|
|||
void Sky_LoadTexture (texture_t *mt)
|
||||
{
|
||||
char texturename[64];
|
||||
int i, j, p, r, g, b, count;
|
||||
int32_t i, j, p, r, g, b, count;
|
||||
byte *src;
|
||||
static byte front_data[128*128]; //FIXME: Hunk_Alloc
|
||||
static byte back_data[128*128]; //FIXME: Hunk_Alloc
|
||||
|
@ -151,10 +151,10 @@ Sky_LoadSkyBox
|
|||
const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
|
||||
void Sky_LoadSkyBox (const char *name)
|
||||
{
|
||||
int i, mark, width, height;
|
||||
int32_t i, mark, width, height;
|
||||
char filename[MAX_OSPATH];
|
||||
byte *data;
|
||||
qboolean nonefound = true;
|
||||
bool nonefound = true;
|
||||
|
||||
if (strcmp(skybox_name, name) == 0)
|
||||
return; //no change
|
||||
|
@ -217,7 +217,7 @@ void Sky_NewMap (void)
|
|||
{
|
||||
char key[128], value[4096];
|
||||
const char *data;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
//
|
||||
// initially no sky
|
||||
|
@ -311,7 +311,7 @@ Sky_Init
|
|||
*/
|
||||
void Sky_Init (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
Cvar_RegisterVariable (&r_fastsky);
|
||||
Cvar_RegisterVariable (&r_sky_quality);
|
||||
|
@ -338,12 +338,12 @@ Sky_ProjectPoly
|
|||
update sky bounds
|
||||
=================
|
||||
*/
|
||||
void Sky_ProjectPoly (int nump, vec3_t vecs)
|
||||
void Sky_ProjectPoly (int32_t nump, vec3_t vecs)
|
||||
{
|
||||
int i,j;
|
||||
int32_t i,j;
|
||||
vec3_t v, av;
|
||||
float s, t, dv;
|
||||
int axis;
|
||||
int32_t axis;
|
||||
float *vp;
|
||||
|
||||
// decide which face it maps to
|
||||
|
@ -413,17 +413,17 @@ void Sky_ProjectPoly (int nump, vec3_t vecs)
|
|||
Sky_ClipPoly
|
||||
=================
|
||||
*/
|
||||
void Sky_ClipPoly (int nump, vec3_t vecs, int stage)
|
||||
void Sky_ClipPoly (int32_t nump, vec3_t vecs, int32_t stage)
|
||||
{
|
||||
float *norm;
|
||||
float *v;
|
||||
qboolean front, back;
|
||||
bool front, back;
|
||||
float d, e;
|
||||
float dists[MAX_CLIP_VERTS];
|
||||
int sides[MAX_CLIP_VERTS];
|
||||
int32_t sides[MAX_CLIP_VERTS];
|
||||
vec3_t newv[2][MAX_CLIP_VERTS];
|
||||
int newc[2];
|
||||
int i, j;
|
||||
int32_t newc[2];
|
||||
int32_t i, j;
|
||||
|
||||
if (nump > MAX_CLIP_VERTS-2)
|
||||
Sys_Error ("Sky_ClipPoly: MAX_CLIP_VERTS");
|
||||
|
@ -511,7 +511,7 @@ Sky_ProcessPoly
|
|||
*/
|
||||
void Sky_ProcessPoly (glpoly_t *p)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
vec3_t verts[MAX_CLIP_VERTS];
|
||||
|
||||
//draw it
|
||||
|
@ -534,7 +534,7 @@ Sky_ProcessTextureChains -- handles sky polys in world model
|
|||
*/
|
||||
void Sky_ProcessTextureChains (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
|
||||
|
@ -564,9 +564,9 @@ void Sky_ProcessEntities (void)
|
|||
entity_t *e;
|
||||
msurface_t *s;
|
||||
glpoly_t *p;
|
||||
int i,j,k,mark;
|
||||
int32_t i,j,k,mark;
|
||||
float dot;
|
||||
qboolean rotated;
|
||||
bool rotated;
|
||||
vec3_t temp, forward, right, up;
|
||||
|
||||
if (!r_drawentities.value)
|
||||
|
@ -648,10 +648,10 @@ void Sky_ProcessEntities (void)
|
|||
Sky_EmitSkyBoxVertex
|
||||
==============
|
||||
*/
|
||||
void Sky_EmitSkyBoxVertex (float s, float t, int axis)
|
||||
void Sky_EmitSkyBoxVertex (float s, float t, int32_t axis)
|
||||
{
|
||||
vec3_t v, b;
|
||||
int j, k;
|
||||
int32_t j, k;
|
||||
float w, h;
|
||||
|
||||
b[0] = s * gl_farclip.value / sqrt(3.0);
|
||||
|
@ -692,7 +692,7 @@ FIXME: eliminate cracks by adding an extra vert on tjuncs
|
|||
*/
|
||||
void Sky_DrawSkyBox (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i=0 ; i<6 ; i++)
|
||||
{
|
||||
|
@ -753,10 +753,10 @@ void Sky_DrawSkyBox (void)
|
|||
Sky_SetBoxVert
|
||||
==============
|
||||
*/
|
||||
void Sky_SetBoxVert (float s, float t, int axis, vec3_t v)
|
||||
void Sky_SetBoxVert (float s, float t, int32_t axis, vec3_t v)
|
||||
{
|
||||
vec3_t b;
|
||||
int j, k;
|
||||
int32_t j, k;
|
||||
|
||||
b[0] = s * gl_farclip.value / sqrt(3.0);
|
||||
b[1] = t * gl_farclip.value / sqrt(3.0);
|
||||
|
@ -791,7 +791,7 @@ void Sky_GetTexCoord (vec3_t v, float speed, float *s, float *t)
|
|||
length = 6*63/length;
|
||||
|
||||
scroll = cl.time*speed;
|
||||
scroll -= (int)scroll & ~127;
|
||||
scroll -= (int32_t)scroll & ~127;
|
||||
|
||||
*s = (scroll + dir[0] * length) * (1.0/128);
|
||||
*t = (scroll + dir[1] * length) * (1.0/128);
|
||||
|
@ -806,7 +806,7 @@ void Sky_DrawFaceQuad (glpoly_t *p)
|
|||
{
|
||||
float s, t;
|
||||
float *v;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (gl_mtexable && r_skyalpha.value >= 1.0)
|
||||
{
|
||||
|
@ -896,11 +896,11 @@ Sky_DrawFace
|
|||
==============
|
||||
*/
|
||||
|
||||
void Sky_DrawFace (int axis)
|
||||
void Sky_DrawFace (int32_t axis)
|
||||
{
|
||||
glpoly_t *p;
|
||||
vec3_t verts[4];
|
||||
int i, j, start;
|
||||
int32_t i, j, start;
|
||||
float di,qi,dj,qj;
|
||||
vec3_t vup, vright, temp, temp2;
|
||||
|
||||
|
@ -915,7 +915,7 @@ void Sky_DrawFace (int axis)
|
|||
VectorSubtract(verts[2],verts[3],vup);
|
||||
VectorSubtract(verts[2],verts[1],vright);
|
||||
|
||||
di = q_max((int)r_sky_quality.value, 1);
|
||||
di = q_max((int32_t)r_sky_quality.value, 1);
|
||||
qi = 1.0 / di;
|
||||
dj = (axis < 4) ? di*2 : di; //subdivide vertically more than horizontally on skybox sides
|
||||
qj = 1.0 / dj;
|
||||
|
@ -957,7 +957,7 @@ draws the old-style scrolling cloud layers
|
|||
*/
|
||||
void Sky_DrawSkyLayers (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (r_skyalpha.value < 1.0)
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
@ -979,7 +979,7 @@ called once per frame before drawing anything else
|
|||
*/
|
||||
void Sky_DrawSky (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
//in these special render modes, the sky faces are handled in the normal world/brush renderer
|
||||
if (r_drawflat_cheatsafe || r_lightmap_cheatsafe )
|
||||
|
|
|
@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
const int gl_solid_format = 3;
|
||||
const int gl_alpha_format = 4;
|
||||
const int32_t gl_solid_format = 3;
|
||||
const int32_t gl_alpha_format = 4;
|
||||
|
||||
static cvar_t gl_texturemode = {"gl_texturemode", "", CVAR_ARCHIVE};
|
||||
static cvar_t gl_texture_anisotropy = {"gl_texture_anisotropy", "1", CVAR_ARCHIVE};
|
||||
|
@ -34,7 +34,7 @@ static cvar_t gl_picmip = {"gl_picmip", "0", CVAR_NONE};
|
|||
static GLint gl_hardware_maxsize;
|
||||
|
||||
#define MAX_GLTEXTURES 2048
|
||||
static int numgltextures;
|
||||
static int32_t numgltextures;
|
||||
static gltexture_t *active_gltextures, *free_gltextures;
|
||||
gltexture_t *notexture, *nulltexture;
|
||||
|
||||
|
@ -57,8 +57,8 @@ uint32_t d_8to24table_pants[256];
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int magfilter;
|
||||
int minfilter;
|
||||
int32_t magfilter;
|
||||
int32_t minfilter;
|
||||
const char *name;
|
||||
} glmode_t;
|
||||
static glmode_t glmodes[] = {
|
||||
|
@ -69,8 +69,8 @@ static glmode_t glmodes[] = {
|
|||
{GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, "GL_LINEAR_MIPMAP_NEAREST"},
|
||||
{GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, "GL_LINEAR_MIPMAP_LINEAR"},
|
||||
};
|
||||
#define NUM_GLMODES (int)(sizeof(glmodes)/sizeof(glmodes[0]))
|
||||
static int glmode_idx = NUM_GLMODES - 1; /* trilinear */
|
||||
#define NUM_GLMODES (int32_t)(sizeof(glmodes)/sizeof(glmodes[0]))
|
||||
static int32_t glmode_idx = NUM_GLMODES - 1; /* trilinear */
|
||||
|
||||
/*
|
||||
===============
|
||||
|
@ -79,12 +79,12 @@ TexMgr_DescribeTextureModes_f -- report available texturemodes
|
|||
*/
|
||||
static void TexMgr_DescribeTextureModes_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < NUM_GLMODES; i++)
|
||||
Con_SafePrintf (" %2i: %s\n", i + 1, glmodes[i].name);
|
||||
Con_SafePrintf (" %2" PRIi32 ": %s\n", i + 1, glmodes[i].name);
|
||||
|
||||
Con_Printf ("%i modes\n", i);
|
||||
Con_Printf ("%" PRIi32 " modes\n", i);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -127,7 +127,7 @@ TexMgr_TextureMode_f -- called when gl_texturemode changes
|
|||
static void TexMgr_TextureMode_f (cvar_t *var)
|
||||
{
|
||||
gltexture_t *glt;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
(void)var;
|
||||
|
||||
|
@ -212,7 +212,7 @@ static void TexMgr_Imagelist_f (void)
|
|||
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
{
|
||||
Con_SafePrintf (" %4i x%4i %s\n", glt->width, glt->height, glt->name);
|
||||
Con_SafePrintf (" %4" PRIi32 " x%4" PRIi32 " %s\n", glt->width, glt->height, glt->name);
|
||||
if (glt->flags & TEXPREF_MIPMAP)
|
||||
texels += glt->width * glt->height * 4.0f / 3.0f;
|
||||
else
|
||||
|
@ -220,7 +220,7 @@ static void TexMgr_Imagelist_f (void)
|
|||
}
|
||||
|
||||
mb = texels * (Cvar_VariableValue("vid_bpp") / 8.0f) / 0x100000;
|
||||
Con_Printf ("%i textures %i pixels %1.1f megabytes\n", numgltextures, (int)texels, mb);
|
||||
Con_Printf ("%" PRIi32 " textures %" PRIi32 " pixels %1.1f megabytes\n", numgltextures, (int32_t)texels, mb);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -266,7 +266,7 @@ static void TexMgr_Imagedump_f (void)
|
|||
free (buffer);
|
||||
}
|
||||
|
||||
Con_Printf ("dumped %i textures to %s\n", numgltextures, dirname);
|
||||
Con_Printf ("dumped %" PRIi32 " textures to %s\n", numgltextures, dirname);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -349,7 +349,7 @@ gltexture_t *TexMgr_NewTexture (void)
|
|||
static void GL_DeleteTexture (gltexture_t *texture);
|
||||
|
||||
//ericw -- workaround for preventing TexMgr_FreeTexture during TexMgr_ReloadImages
|
||||
static qboolean in_reload_images;
|
||||
static bool in_reload_images;
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -464,7 +464,7 @@ TexMgr_LoadPalette -- johnfitz -- was VID_SetPalette, moved here, renamed, rewri
|
|||
void TexMgr_LoadPalette (void)
|
||||
{
|
||||
byte *pal, *src, *dst;
|
||||
int i, mark;
|
||||
int32_t i, mark;
|
||||
FILE *f;
|
||||
|
||||
COM_FOpenFile ("gfx/palette.lmp", &f, NULL);
|
||||
|
@ -557,8 +557,8 @@ choose safe warpimage size and resize existing warpimage textures
|
|||
*/
|
||||
void TexMgr_RecalcWarpImageSize (void)
|
||||
{
|
||||
// int oldsize = gl_warpimagesize;
|
||||
int mark;
|
||||
// int32_t oldsize = gl_warpimagesize;
|
||||
int32_t mark;
|
||||
gltexture_t *glt;
|
||||
byte *dummy;
|
||||
|
||||
|
@ -605,7 +605,7 @@ must be called before any texture loading
|
|||
*/
|
||||
void TexMgr_Init (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
static byte notexture_data[16] = {159,91,83,255,0,0,0,255,0,0,0,255,159,91,83,255}; //black and pink checker
|
||||
static byte nulltexture_data[16] = {127,191,255,255,0,0,0,255,0,0,0,255,127,191,255,255}; //black and blue checker
|
||||
extern texture_t *r_notexture_mip, *r_notexture_mip2;
|
||||
|
@ -660,9 +660,9 @@ void TexMgr_Init (void)
|
|||
TexMgr_Pad -- return smallest power of two greater than or equal to s
|
||||
================
|
||||
*/
|
||||
int TexMgr_Pad (int s)
|
||||
int32_t TexMgr_Pad (int32_t s)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for (i = 1; i < s; i<<=1)
|
||||
;
|
||||
return i;
|
||||
|
@ -673,12 +673,12 @@ int TexMgr_Pad (int s)
|
|||
TexMgr_SafeTextureSize -- return a size with hardware and user prefs in mind
|
||||
===============
|
||||
*/
|
||||
int TexMgr_SafeTextureSize (int s)
|
||||
int32_t TexMgr_SafeTextureSize (int32_t s)
|
||||
{
|
||||
if (!gl_texture_NPOT)
|
||||
s = TexMgr_Pad(s);
|
||||
if ((int)gl_max_size.value > 0)
|
||||
s = q_min(TexMgr_Pad((int)gl_max_size.value), s);
|
||||
if ((int32_t)gl_max_size.value > 0)
|
||||
s = q_min(TexMgr_Pad((int32_t)gl_max_size.value), s);
|
||||
s = q_min(gl_hardware_maxsize, s);
|
||||
return s;
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ int TexMgr_SafeTextureSize (int s)
|
|||
TexMgr_PadConditional -- only pad if a texture of that size would be padded. (used for tex coords)
|
||||
================
|
||||
*/
|
||||
int TexMgr_PadConditional (int s)
|
||||
int32_t TexMgr_PadConditional (int32_t s)
|
||||
{
|
||||
if (s < TexMgr_SafeTextureSize(s))
|
||||
return TexMgr_Pad(s);
|
||||
|
@ -701,9 +701,9 @@ int TexMgr_PadConditional (int s)
|
|||
TexMgr_MipMapW
|
||||
================
|
||||
*/
|
||||
static unsigned *TexMgr_MipMapW (unsigned *data, int width, int height)
|
||||
static unsigned *TexMgr_MipMapW (unsigned *data, int32_t width, int32_t height)
|
||||
{
|
||||
int i, size;
|
||||
int32_t i, size;
|
||||
byte *out, *in;
|
||||
|
||||
out = in = (byte *)data;
|
||||
|
@ -725,9 +725,9 @@ static unsigned *TexMgr_MipMapW (unsigned *data, int width, int height)
|
|||
TexMgr_MipMapH
|
||||
================
|
||||
*/
|
||||
static unsigned *TexMgr_MipMapH (unsigned *data, int width, int height)
|
||||
static unsigned *TexMgr_MipMapH (unsigned *data, int32_t width, int32_t height)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
byte *out, *in;
|
||||
|
||||
out = in = (byte *)data;
|
||||
|
@ -753,12 +753,12 @@ static unsigned *TexMgr_MipMapH (unsigned *data, int width, int height)
|
|||
TexMgr_ResampleTexture -- bilinear resample
|
||||
================
|
||||
*/
|
||||
static unsigned *TexMgr_ResampleTexture (unsigned *in, int inwidth, int inheight, qboolean alpha)
|
||||
static unsigned *TexMgr_ResampleTexture (unsigned *in, int32_t inwidth, int32_t inheight, bool alpha)
|
||||
{
|
||||
byte *nwpx, *nepx, *swpx, *sepx, *dest;
|
||||
unsigned xfrac, yfrac, x, y, modx, mody, imodx, imody, injump, outjump;
|
||||
unsigned *out;
|
||||
int i, j, outwidth, outheight;
|
||||
int32_t i, j, outwidth, outheight;
|
||||
|
||||
if (inwidth == TexMgr_Pad(inwidth) && inheight == TexMgr_Pad(inheight))
|
||||
return in;
|
||||
|
@ -815,9 +815,9 @@ eliminate pink edges on sprites, etc.
|
|||
operates in place on 32bit data
|
||||
===============
|
||||
*/
|
||||
static void TexMgr_AlphaEdgeFix (byte *data, int width, int height)
|
||||
static void TexMgr_AlphaEdgeFix (byte *data, int32_t width, int32_t height)
|
||||
{
|
||||
int i, j, n = 0, b, c[3] = {0,0,0},
|
||||
int32_t i, j, n = 0, b, c[3] = {0,0,0},
|
||||
lastrow, thisrow, nextrow,
|
||||
lastpix, thispix, nextpix;
|
||||
byte *dest = data;
|
||||
|
@ -866,10 +866,10 @@ TexMgr_PadEdgeFixW -- special case of AlphaEdgeFix for textures that only need i
|
|||
operates in place on 32bit data, and expects unpadded height and width values
|
||||
===============
|
||||
*/
|
||||
static void TexMgr_PadEdgeFixW (byte *data, int width, int height)
|
||||
static void TexMgr_PadEdgeFixW (byte *data, int32_t width, int32_t height)
|
||||
{
|
||||
byte *src, *dst;
|
||||
int i, padw, padh;
|
||||
int32_t i, padw, padh;
|
||||
|
||||
padw = TexMgr_PadConditional(width);
|
||||
padh = TexMgr_PadConditional(height);
|
||||
|
@ -904,10 +904,10 @@ TexMgr_PadEdgeFixH -- special case of AlphaEdgeFix for textures that only need i
|
|||
operates in place on 32bit data, and expects unpadded height and width values
|
||||
===============
|
||||
*/
|
||||
static void TexMgr_PadEdgeFixH (byte *data, int width, int height)
|
||||
static void TexMgr_PadEdgeFixH (byte *data, int32_t width, int32_t height)
|
||||
{
|
||||
byte *src, *dst;
|
||||
int i, padw, padh;
|
||||
int32_t i, padw, padh;
|
||||
|
||||
padw = TexMgr_PadConditional(width);
|
||||
padh = TexMgr_PadConditional(height);
|
||||
|
@ -942,9 +942,9 @@ static void TexMgr_PadEdgeFixH (byte *data, int width, int height)
|
|||
TexMgr_8to32
|
||||
================
|
||||
*/
|
||||
static unsigned *TexMgr_8to32 (byte *in, int pixels, uint32_t *usepal)
|
||||
static unsigned *TexMgr_8to32 (byte *in, int32_t pixels, uint32_t *usepal)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
unsigned *out, *data;
|
||||
|
||||
out = data = (unsigned *) Hunk_Alloc(pixels*4);
|
||||
|
@ -960,9 +960,9 @@ static unsigned *TexMgr_8to32 (byte *in, int pixels, uint32_t *usepal)
|
|||
TexMgr_PadImageW -- return image with width padded up to power-of-two dimentions
|
||||
================
|
||||
*/
|
||||
static byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte)
|
||||
static byte *TexMgr_PadImageW (byte *in, int32_t width, int32_t height, byte padbyte)
|
||||
{
|
||||
int i, j, outwidth;
|
||||
int32_t i, j, outwidth;
|
||||
byte *out, *data;
|
||||
|
||||
if (width == TexMgr_Pad(width))
|
||||
|
@ -988,9 +988,9 @@ static byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte)
|
|||
TexMgr_PadImageH -- return image with height padded up to power-of-two dimentions
|
||||
================
|
||||
*/
|
||||
static byte *TexMgr_PadImageH (byte *in, int width, int height, byte padbyte)
|
||||
static byte *TexMgr_PadImageH (byte *in, int32_t width, int32_t height, byte padbyte)
|
||||
{
|
||||
int i, srcpix, dstpix;
|
||||
int32_t i, srcpix, dstpix;
|
||||
byte *data, *out;
|
||||
|
||||
if (height == TexMgr_Pad(height))
|
||||
|
@ -1016,7 +1016,7 @@ TexMgr_LoadImage32 -- handles 32bit source data
|
|||
*/
|
||||
static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data)
|
||||
{
|
||||
int internalformat, miplevel, mipwidth, mipheight, picmip;
|
||||
int32_t internalformat, miplevel, mipwidth, mipheight, picmip;
|
||||
|
||||
if (!gl_texture_NPOT)
|
||||
{
|
||||
|
@ -1027,17 +1027,17 @@ static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data)
|
|||
}
|
||||
|
||||
// mipmap down
|
||||
picmip = (glt->flags & TEXPREF_NOPICMIP) ? 0 : q_max((int)gl_picmip.value, 0);
|
||||
picmip = (glt->flags & TEXPREF_NOPICMIP) ? 0 : q_max((int32_t)gl_picmip.value, 0);
|
||||
mipwidth = TexMgr_SafeTextureSize (glt->width >> picmip);
|
||||
mipheight = TexMgr_SafeTextureSize (glt->height >> picmip);
|
||||
while ((int) glt->width > mipwidth)
|
||||
while ((int32_t) glt->width > mipwidth)
|
||||
{
|
||||
TexMgr_MipMapW (data, glt->width, glt->height);
|
||||
glt->width >>= 1;
|
||||
if (glt->flags & TEXPREF_ALPHA)
|
||||
TexMgr_AlphaEdgeFix ((byte *)data, glt->width, glt->height);
|
||||
}
|
||||
while ((int) glt->height > mipheight)
|
||||
while ((int32_t) glt->height > mipheight)
|
||||
{
|
||||
TexMgr_MipMapH (data, glt->width, glt->height);
|
||||
glt->height >>= 1;
|
||||
|
@ -1084,10 +1084,10 @@ TexMgr_LoadImage8 -- handles 8bit source data, then passes it to LoadImage32
|
|||
static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
|
||||
{
|
||||
extern cvar_t gl_fullbrights;
|
||||
qboolean padw = false, padh = false;
|
||||
bool padw = false, padh = false;
|
||||
byte padbyte;
|
||||
uint32_t *usepal;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// HACK HACK HACK -- taken from tomazquake
|
||||
if (strstr(glt->name, "shot1sid") &&
|
||||
|
@ -1103,10 +1103,10 @@ static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
|
|||
// detect false alpha cases
|
||||
if (glt->flags & TEXPREF_ALPHA && !(glt->flags & TEXPREF_CONCHARS))
|
||||
{
|
||||
for (i = 0; i < (int) (glt->width * glt->height); i++)
|
||||
for (i = 0; i < (int32_t) (glt->width * glt->height); i++)
|
||||
if (data[i] == 255) //transparent index
|
||||
break;
|
||||
if (i == (int) (glt->width * glt->height))
|
||||
if (i == (int32_t) (glt->width * glt->height))
|
||||
glt->flags -= TEXPREF_ALPHA;
|
||||
}
|
||||
|
||||
|
@ -1141,13 +1141,13 @@ static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
|
|||
// pad each dimention, but only if it's not going to be downsampled later
|
||||
if (glt->flags & TEXPREF_PAD)
|
||||
{
|
||||
if ((int) glt->width < TexMgr_SafeTextureSize(glt->width))
|
||||
if ((int32_t) glt->width < TexMgr_SafeTextureSize(glt->width))
|
||||
{
|
||||
data = TexMgr_PadImageW (data, glt->width, glt->height, padbyte);
|
||||
glt->width = TexMgr_Pad(glt->width);
|
||||
padw = true;
|
||||
}
|
||||
if ((int) glt->height < TexMgr_SafeTextureSize(glt->height))
|
||||
if ((int32_t) glt->height < TexMgr_SafeTextureSize(glt->height))
|
||||
{
|
||||
data = TexMgr_PadImageH (data, glt->width, glt->height, padbyte);
|
||||
glt->height = TexMgr_Pad(glt->height);
|
||||
|
@ -1193,12 +1193,12 @@ static void TexMgr_LoadLightmap (gltexture_t *glt, byte *data)
|
|||
TexMgr_LoadImage -- the one entry point for loading all textures
|
||||
================
|
||||
*/
|
||||
gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int height, enum srcformat format,
|
||||
gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int32_t width, int32_t height, enum srcformat format,
|
||||
byte *data, const char *source_file, src_offset_t source_offset, unsigned flags)
|
||||
{
|
||||
uint16_t crc;
|
||||
gltexture_t *glt;
|
||||
int mark;
|
||||
int32_t mark;
|
||||
|
||||
if (isDedicated)
|
||||
return NULL;
|
||||
|
@ -1275,11 +1275,11 @@ gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int
|
|||
TexMgr_ReloadImage -- reloads a texture, and colormaps it if needed
|
||||
================
|
||||
*/
|
||||
void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants)
|
||||
void TexMgr_ReloadImage (gltexture_t *glt, int32_t shirt, int32_t pants)
|
||||
{
|
||||
byte translation[256];
|
||||
byte *src, *dst, *data = NULL, *translated;
|
||||
int mark, size, i;
|
||||
int32_t mark, size, i;
|
||||
//
|
||||
// get source data
|
||||
//
|
||||
|
@ -1305,7 +1305,7 @@ void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants)
|
|||
fclose (f);
|
||||
}
|
||||
else if (glt->source_file[0] && !glt->source_offset)
|
||||
data = Image_LoadImage (glt->source_file, (int *)&glt->source_width, (int *)&glt->source_height); //simple file
|
||||
data = Image_LoadImage (glt->source_file, (int32_t *)&glt->source_width, (int32_t *)&glt->source_height); //simple file
|
||||
else if (!glt->source_file[0] && glt->source_offset)
|
||||
data = (byte *) glt->source_offset; //image in memory
|
||||
|
||||
|
@ -1445,7 +1445,7 @@ void TexMgr_ReloadNobrightImages (void)
|
|||
|
||||
static GLuint currenttexture[3] = {GL_UNUSED_TEXTURE, GL_UNUSED_TEXTURE, GL_UNUSED_TEXTURE}; // to avoid unnecessary texture sets
|
||||
static GLenum currenttarget = GL_TEXTURE0_ARB;
|
||||
qboolean mtexenabled = false;
|
||||
bool mtexenabled = false;
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -1539,7 +1539,7 @@ Call this after changing the binding outside of GL_Bind.
|
|||
*/
|
||||
void GL_ClearBindings(void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
currenttexture[i] = GL_UNUSED_TEXTURE;
|
||||
|
|
|
@ -62,7 +62,7 @@ typedef struct gltexture_s {
|
|||
int8_t shirt; //0-13 shirt color, or -1 if never colormapped
|
||||
int8_t pants; //0-13 pants color, or -1 if never colormapped
|
||||
//used for rendering
|
||||
int visframe; //matches r_framecount if texture was bound this frame
|
||||
int32_t visframe; //matches r_framecount if texture was bound this frame
|
||||
} gltexture_t;
|
||||
|
||||
extern gltexture_t *notexture;
|
||||
|
@ -88,15 +88,15 @@ void TexMgr_Init (void);
|
|||
void TexMgr_DeleteTextureObjects (void);
|
||||
|
||||
// IMAGE LOADING
|
||||
gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int height, enum srcformat format,
|
||||
gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int32_t width, int32_t height, enum srcformat format,
|
||||
byte *data, const char *source_file, src_offset_t source_offset, unsigned flags);
|
||||
void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants);
|
||||
void TexMgr_ReloadImage (gltexture_t *glt, int32_t shirt, int32_t pants);
|
||||
void TexMgr_ReloadImages (void);
|
||||
void TexMgr_ReloadNobrightImages (void);
|
||||
|
||||
int TexMgr_Pad(int s);
|
||||
int TexMgr_SafeTextureSize (int s);
|
||||
int TexMgr_PadConditional (int s);
|
||||
int32_t TexMgr_Pad(int32_t s);
|
||||
int32_t TexMgr_SafeTextureSize (int32_t s);
|
||||
int32_t TexMgr_PadConditional (int32_t s);
|
||||
|
||||
// TEXTURE BINDING & TEXTURE UNIT SWITCHING
|
||||
|
||||
|
|
|
@ -46,35 +46,35 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define DEFAULT_REFRESHRATE 60
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
int refreshrate;
|
||||
int bpp;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t refreshrate;
|
||||
int32_t bpp;
|
||||
} vmode_t;
|
||||
|
||||
static const char *gl_vendor;
|
||||
static const char *gl_renderer;
|
||||
static const char *gl_version;
|
||||
static int gl_version_major;
|
||||
static int gl_version_minor;
|
||||
static int32_t gl_version_major;
|
||||
static int32_t gl_version_minor;
|
||||
static const char *gl_extensions;
|
||||
static char * gl_extensions_nice;
|
||||
|
||||
static vmode_t modelist[MAX_MODE_LIST];
|
||||
static int nummodes;
|
||||
static int32_t nummodes;
|
||||
|
||||
static qboolean vid_initialized = false;
|
||||
static bool vid_initialized = false;
|
||||
|
||||
static SDL_Window *draw_context;
|
||||
static SDL_GLContext gl_context;
|
||||
|
||||
static qboolean vid_locked = false; //johnfitz
|
||||
static qboolean vid_changed = false;
|
||||
static bool vid_locked = false; //johnfitz
|
||||
static bool vid_changed = false;
|
||||
|
||||
static void VID_Menu_Init (void); //johnfitz
|
||||
static void VID_Menu_f (void); //johnfitz
|
||||
static void VID_MenuDraw (void);
|
||||
static void VID_MenuKey (int key);
|
||||
static void VID_MenuKey (int32_t key);
|
||||
|
||||
static void ClearAllStates (void);
|
||||
static void GL_Init (void);
|
||||
|
@ -82,21 +82,21 @@ static void GL_SetupState (void); //johnfitz
|
|||
|
||||
viddef_t vid; // global video state
|
||||
modestate_t modestate = MS_UNINIT;
|
||||
qboolean scr_skipupdate;
|
||||
bool scr_skipupdate;
|
||||
|
||||
qboolean gl_mtexable = false;
|
||||
qboolean gl_texture_env_combine = false; //johnfitz
|
||||
qboolean gl_texture_env_add = false; //johnfitz
|
||||
qboolean gl_swap_control = false; //johnfitz
|
||||
qboolean gl_anisotropy_able = false; //johnfitz
|
||||
bool gl_mtexable = false;
|
||||
bool gl_texture_env_combine = false; //johnfitz
|
||||
bool gl_texture_env_add = false; //johnfitz
|
||||
bool gl_swap_control = false; //johnfitz
|
||||
bool gl_anisotropy_able = false; //johnfitz
|
||||
float gl_max_anisotropy; //johnfitz
|
||||
qboolean gl_texture_NPOT = false; //ericw
|
||||
qboolean gl_vbo_able = false; //ericw
|
||||
qboolean gl_glsl_able = false; //ericw
|
||||
bool gl_texture_NPOT = false; //ericw
|
||||
bool gl_vbo_able = false; //ericw
|
||||
bool gl_glsl_able = false; //ericw
|
||||
GLint gl_max_texture_units = 0; //ericw
|
||||
qboolean gl_glsl_gamma_able = false; //ericw
|
||||
qboolean gl_glsl_alias_able = false; //ericw
|
||||
int gl_stencilbits;
|
||||
bool gl_glsl_gamma_able = false; //ericw
|
||||
bool gl_glsl_alias_able = false; //ericw
|
||||
int32_t gl_stencilbits;
|
||||
|
||||
PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz
|
||||
PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz
|
||||
|
@ -166,8 +166,8 @@ static uint16_t vid_sysgamma_green[256];
|
|||
static uint16_t vid_sysgamma_blue[256];
|
||||
#endif
|
||||
|
||||
static qboolean gammaworks = false; // whether hw-gamma works
|
||||
static int fsaa;
|
||||
static bool gammaworks = false; // whether hw-gamma works
|
||||
static int32_t fsaa;
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -242,12 +242,12 @@ static void VID_Gamma_f (cvar_t *var)
|
|||
return;
|
||||
|
||||
#if USE_GAMMA_RAMPS
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
vid_gamma_red[i] =
|
||||
CLAMP(0, (int) ((255 * pow((i + 0.5)/255.5, vid_gamma.value) + 0.5) * vid_contrast.value), 255) << 8;
|
||||
CLAMP(0, (int32_t) ((255 * pow((i + 0.5)/255.5, vid_gamma.value) + 0.5) * vid_contrast.value), 255) << 8;
|
||||
vid_gamma_green[i] = vid_gamma_red[i];
|
||||
vid_gamma_blue[i] = vid_gamma_red[i];
|
||||
}
|
||||
|
@ -287,9 +287,9 @@ static void VID_Gamma_Init (void)
|
|||
VID_GetCurrentWidth
|
||||
======================
|
||||
*/
|
||||
static int VID_GetCurrentWidth (void)
|
||||
static int32_t VID_GetCurrentWidth (void)
|
||||
{
|
||||
int w;
|
||||
int32_t w;
|
||||
SDL_GetWindowSize(draw_context, &w, NULL);
|
||||
return w;
|
||||
}
|
||||
|
@ -299,9 +299,9 @@ static int VID_GetCurrentWidth (void)
|
|||
VID_GetCurrentHeight
|
||||
=======================
|
||||
*/
|
||||
static int VID_GetCurrentHeight (void)
|
||||
static int32_t VID_GetCurrentHeight (void)
|
||||
{
|
||||
int h;
|
||||
int32_t h;
|
||||
SDL_GetWindowSize(draw_context, NULL, &h);
|
||||
return h;
|
||||
}
|
||||
|
@ -311,10 +311,10 @@ static int VID_GetCurrentHeight (void)
|
|||
VID_GetCurrentRefreshRate
|
||||
====================
|
||||
*/
|
||||
static int VID_GetCurrentRefreshRate (void)
|
||||
static int32_t VID_GetCurrentRefreshRate (void)
|
||||
{
|
||||
SDL_DisplayMode mode;
|
||||
int current_display;
|
||||
int32_t current_display;
|
||||
|
||||
current_display = SDL_GetWindowDisplayIndex(draw_context);
|
||||
|
||||
|
@ -330,7 +330,7 @@ static int VID_GetCurrentRefreshRate (void)
|
|||
VID_GetCurrentBPP
|
||||
====================
|
||||
*/
|
||||
static int VID_GetCurrentBPP (void)
|
||||
static int32_t VID_GetCurrentBPP (void)
|
||||
{
|
||||
const Uint32 pixelFormat = SDL_GetWindowPixelFormat(draw_context);
|
||||
return SDL_BITSPERPIXEL(pixelFormat);
|
||||
|
@ -343,7 +343,7 @@ VID_GetFullscreen
|
|||
returns true if we are in regular fullscreen or "desktop fullscren"
|
||||
====================
|
||||
*/
|
||||
static qboolean VID_GetFullscreen (void)
|
||||
static bool VID_GetFullscreen (void)
|
||||
{
|
||||
return (SDL_GetWindowFlags(draw_context) & SDL_WINDOW_FULLSCREEN) != 0;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ VID_GetDesktopFullscreen
|
|||
returns true if we are specifically in "desktop fullscreen" mode
|
||||
====================
|
||||
*/
|
||||
static qboolean VID_GetDesktopFullscreen (void)
|
||||
static bool VID_GetDesktopFullscreen (void)
|
||||
{
|
||||
return (SDL_GetWindowFlags(draw_context) & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ static qboolean VID_GetDesktopFullscreen (void)
|
|||
VID_GetVSync
|
||||
====================
|
||||
*/
|
||||
static qboolean VID_GetVSync (void)
|
||||
static bool VID_GetVSync (void)
|
||||
{
|
||||
return SDL_GL_GetSwapInterval() == 1;
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ void *VID_GetWindow (void)
|
|||
VID_HasMouseOrInputFocus
|
||||
====================
|
||||
*/
|
||||
qboolean VID_HasMouseOrInputFocus (void)
|
||||
bool VID_HasMouseOrInputFocus (void)
|
||||
{
|
||||
return (SDL_GetWindowFlags(draw_context) & (SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_INPUT_FOCUS)) != 0;
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ qboolean VID_HasMouseOrInputFocus (void)
|
|||
VID_IsMinimized
|
||||
====================
|
||||
*/
|
||||
qboolean VID_IsMinimized (void)
|
||||
bool VID_IsMinimized (void)
|
||||
{
|
||||
return !(SDL_GetWindowFlags(draw_context) & SDL_WINDOW_SHOWN);
|
||||
}
|
||||
|
@ -414,11 +414,11 @@ This is passed to SDL_SetWindowDisplayMode to specify a pixel format
|
|||
with the requested bpp. If we didn't care about bpp we could just pass NULL.
|
||||
================
|
||||
*/
|
||||
static SDL_DisplayMode *VID_SDL2_GetDisplayMode(int width, int height, int refreshrate, int bpp)
|
||||
static SDL_DisplayMode *VID_SDL2_GetDisplayMode(int32_t width, int32_t height, int32_t refreshrate, int32_t bpp)
|
||||
{
|
||||
static SDL_DisplayMode mode;
|
||||
const int sdlmodes = SDL_GetNumDisplayModes(0);
|
||||
int i;
|
||||
const int32_t sdlmodes = SDL_GetNumDisplayModes(0);
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < sdlmodes; i++)
|
||||
{
|
||||
|
@ -440,7 +440,7 @@ static SDL_DisplayMode *VID_SDL2_GetDisplayMode(int width, int height, int refre
|
|||
VID_ValidMode
|
||||
================
|
||||
*/
|
||||
static qboolean VID_ValidMode (int width, int height, int refreshrate, int bpp, qboolean fullscreen)
|
||||
static bool VID_ValidMode (int32_t width, int32_t height, int32_t refreshrate, int32_t bpp, bool fullscreen)
|
||||
{
|
||||
// ignore width / height / bpp if vid_desktopfullscreen is enabled
|
||||
if (fullscreen && vid_desktopfullscreen.value)
|
||||
|
@ -473,14 +473,14 @@ static qboolean VID_ValidMode (int width, int height, int refreshrate, int bpp,
|
|||
VID_SetMode
|
||||
================
|
||||
*/
|
||||
static qboolean VID_SetMode (int width, int height, int refreshrate, int bpp, qboolean fullscreen)
|
||||
static bool VID_SetMode (int32_t width, int32_t height, int32_t refreshrate, int32_t bpp, bool fullscreen)
|
||||
{
|
||||
int temp;
|
||||
int32_t temp;
|
||||
Uint32 flags;
|
||||
char caption[50];
|
||||
int depthbits, stencilbits;
|
||||
int fsaa_obtained;
|
||||
int previous_display;
|
||||
int32_t depthbits, stencilbits;
|
||||
int32_t fsaa_obtained;
|
||||
int32_t previous_display;
|
||||
|
||||
// so Con_Printfs don't mess us up by forcing vid and snd updates
|
||||
temp = scr_disabled_for_loading;
|
||||
|
@ -605,7 +605,7 @@ static qboolean VID_SetMode (int width, int height, int refreshrate, int bpp, qb
|
|||
// fix the leftover Alt from any Alt-Tab or the like that switched us away
|
||||
ClearAllStates ();
|
||||
|
||||
Con_SafePrintf ("Video mode %dx%dx%d %dHz (%d-bit z-buffer, %dx FSAA) initialized\n",
|
||||
Con_SafePrintf ("Video mode %" PRIi32 "x%" PRIi32 "x%" PRIi32 " %" PRIi32 "Hz (%" PRIi32 "-bit z-buffer, %" PRIi32 "x FSAA) initialized\n",
|
||||
VID_GetCurrentWidth(),
|
||||
VID_GetCurrentHeight(),
|
||||
VID_GetCurrentBPP(),
|
||||
|
@ -639,16 +639,16 @@ VID_Restart -- johnfitz -- change video modes on the fly
|
|||
*/
|
||||
static void VID_Restart (void)
|
||||
{
|
||||
int width, height, refreshrate, bpp;
|
||||
qboolean fullscreen;
|
||||
int32_t width, height, refreshrate, bpp;
|
||||
bool fullscreen;
|
||||
|
||||
if (vid_locked || !vid_changed)
|
||||
return;
|
||||
|
||||
width = (int)vid_width.value;
|
||||
height = (int)vid_height.value;
|
||||
refreshrate = (int)vid_refreshrate.value;
|
||||
bpp = (int)vid_bpp.value;
|
||||
width = (int32_t)vid_width.value;
|
||||
height = (int32_t)vid_height.value;
|
||||
refreshrate = (int32_t)vid_refreshrate.value;
|
||||
bpp = (int32_t)vid_bpp.value;
|
||||
fullscreen = vid_fullscreen.value ? true : false;
|
||||
|
||||
//
|
||||
|
@ -656,7 +656,7 @@ static void VID_Restart (void)
|
|||
//
|
||||
if (!VID_ValidMode (width, height, refreshrate, bpp, fullscreen))
|
||||
{
|
||||
Con_Printf ("%dx%dx%d %dHz %s is not a valid mode\n",
|
||||
Con_Printf ("%" PRIi32 "x%" PRIi32 "x%" PRIi32 " %" PRIi32 "Hz %s is not a valid mode\n",
|
||||
width, height, bpp, refreshrate, fullscreen? "fullscreen" : "windowed");
|
||||
return;
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ static void VID_Restart (void)
|
|||
TexMgr_RecalcWarpImageSize ();
|
||||
|
||||
//conwidth and conheight need to be recalculated
|
||||
vid.conwidth = (scr_conwidth.value > 0) ? (int)scr_conwidth.value : (scr_conscale.value > 0) ? (int)(vid.width/scr_conscale.value) : vid.width;
|
||||
vid.conwidth = (scr_conwidth.value > 0) ? (int32_t)scr_conwidth.value : (scr_conscale.value > 0) ? (int32_t)(vid.width/scr_conscale.value) : vid.width;
|
||||
vid.conwidth = CLAMP (320, vid.conwidth, vid.width);
|
||||
vid.conwidth &= 0xFFFFFFF8;
|
||||
vid.conheight = vid.conwidth * vid.height / vid.width;
|
||||
|
@ -718,7 +718,7 @@ VID_Test -- johnfitz -- like vid_restart, but asks for confirmation after switch
|
|||
*/
|
||||
static void VID_Test (void)
|
||||
{
|
||||
int old_width, old_height, old_refreshrate, old_bpp, old_fullscreen;
|
||||
int32_t old_width, old_height, old_refreshrate, old_bpp, old_fullscreen;
|
||||
|
||||
if (vid_locked || !vid_changed)
|
||||
return;
|
||||
|
@ -787,12 +787,12 @@ GL_MakeNiceExtensionsList -- johnfitz
|
|||
static char *GL_MakeNiceExtensionsList (const char *in)
|
||||
{
|
||||
char *copy, *token, *out;
|
||||
int i, count;
|
||||
int32_t i, count;
|
||||
|
||||
if (!in) return Z_Strdup("(none)");
|
||||
|
||||
//each space will be replaced by 4 chars, so count the spaces before we malloc
|
||||
for (i = 0, count = 1; i < (int) strlen(in); i++)
|
||||
for (i = 0, count = 1; i < (int32_t) strlen(in); i++)
|
||||
{
|
||||
if (in[i] == ' ')
|
||||
count++;
|
||||
|
@ -830,7 +830,7 @@ static void GL_Info_f (void)
|
|||
GL_CheckExtensions
|
||||
===============
|
||||
*/
|
||||
static qboolean GL_ParseExtensionList (const char *list, const char *name)
|
||||
static bool GL_ParseExtensionList (const char *list, const char *name)
|
||||
{
|
||||
const char *start;
|
||||
const char *where, *terminator;
|
||||
|
@ -856,7 +856,7 @@ static qboolean GL_ParseExtensionList (const char *list, const char *name)
|
|||
|
||||
static void GL_CheckExtensions (void)
|
||||
{
|
||||
int swap_control;
|
||||
int32_t swap_control;
|
||||
|
||||
// ARB_vertex_buffer_object
|
||||
//
|
||||
|
@ -897,7 +897,7 @@ static void GL_CheckExtensions (void)
|
|||
gl_mtexable = true;
|
||||
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &gl_max_texture_units);
|
||||
Con_Printf("GL_MAX_TEXTURE_UNITS: %d\n", (int)gl_max_texture_units);
|
||||
Con_Printf("GL_MAX_TEXTURE_UNITS: %" PRIi32 "\n", (int32_t)gl_max_texture_units);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1162,7 +1162,7 @@ static void GL_Init (void)
|
|||
Con_SafePrintf ("GL_RENDERER: %s\n", gl_renderer);
|
||||
Con_SafePrintf ("GL_VERSION: %s\n", gl_version);
|
||||
|
||||
if (gl_version == NULL || sscanf(gl_version, "%d.%d", &gl_version_major, &gl_version_minor) < 2)
|
||||
if (gl_version == NULL || sscanf(gl_version, "%" PRIi32 ".%" PRIi32 "", &gl_version_major, &gl_version_minor) < 2)
|
||||
{
|
||||
gl_version_major = 0;
|
||||
gl_version_minor = 0;
|
||||
|
@ -1202,7 +1202,7 @@ static void GL_Init (void)
|
|||
GL_BeginRendering -- sets values of glx, gly, glwidth, glheight
|
||||
=================
|
||||
*/
|
||||
void GL_BeginRendering (int *x, int *y, int *width, int *height)
|
||||
void GL_BeginRendering (int32_t *x, int32_t *y, int32_t *width, int32_t *height)
|
||||
{
|
||||
*x = *y = 0;
|
||||
*width = vid.width;
|
||||
|
@ -1270,7 +1270,7 @@ VID_DescribeCurrentMode_f
|
|||
static void VID_DescribeCurrentMode_f (void)
|
||||
{
|
||||
if (draw_context)
|
||||
Con_Printf("%dx%dx%d %dHz %s\n",
|
||||
Con_Printf("%" PRIi32 "x%" PRIi32 "x%" PRIi32 " %" PRIi32 "Hz %s\n",
|
||||
VID_GetCurrentWidth(),
|
||||
VID_GetCurrentHeight(),
|
||||
VID_GetCurrentBPP(),
|
||||
|
@ -1285,8 +1285,8 @@ VID_DescribeModes_f -- johnfitz -- changed formatting, and added refresh rates a
|
|||
*/
|
||||
static void VID_DescribeModes_f (void)
|
||||
{
|
||||
int i;
|
||||
int lastwidth, lastheight, lastbpp, count;
|
||||
int32_t i;
|
||||
int32_t lastwidth, lastheight, lastbpp, count;
|
||||
|
||||
lastwidth = lastheight = lastbpp = count = 0;
|
||||
|
||||
|
@ -1296,14 +1296,14 @@ static void VID_DescribeModes_f (void)
|
|||
{
|
||||
if (count > 0)
|
||||
Con_SafePrintf ("\n");
|
||||
Con_SafePrintf (" %4i x %4i x %i : %i", modelist[i].width, modelist[i].height, modelist[i].bpp, modelist[i].refreshrate);
|
||||
Con_SafePrintf (" %4" PRIi32 " x %4" PRIi32 " x %" PRIi32 " : %" PRIi32 "", modelist[i].width, modelist[i].height, modelist[i].bpp, modelist[i].refreshrate);
|
||||
lastwidth = modelist[i].width;
|
||||
lastheight = modelist[i].height;
|
||||
lastbpp = modelist[i].bpp;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
Con_Printf ("\n%i modes\n", count);
|
||||
Con_Printf ("\n%" PRIi32 " modes\n", count);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1315,7 +1315,7 @@ static void VID_FSAA_f (cvar_t *var)
|
|||
{
|
||||
// don't print the warning if vid_fsaa is set during startup
|
||||
if (vid_initialized)
|
||||
Con_Printf("%s %d requires engine restart to take effect\n", var->name, (int)var->value);
|
||||
Con_Printf("%s %" PRIi32 " requires engine restart to take effect\n", var->name, (int32_t)var->value);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1331,8 +1331,8 @@ VID_InitModelist
|
|||
*/
|
||||
static void VID_InitModelist (void)
|
||||
{
|
||||
const int sdlmodes = SDL_GetNumDisplayModes(0);
|
||||
int i;
|
||||
const int32_t sdlmodes = SDL_GetNumDisplayModes(0);
|
||||
int32_t i;
|
||||
|
||||
nummodes = 0;
|
||||
for (i = 0; i < sdlmodes; i++)
|
||||
|
@ -1360,9 +1360,9 @@ VID_Init
|
|||
void VID_Init (void)
|
||||
{
|
||||
static char vid_center[] = "SDL_VIDEO_CENTERED=center";
|
||||
int p, width, height, refreshrate, bpp;
|
||||
int display_width, display_height, display_refreshrate, display_bpp;
|
||||
qboolean fullscreen;
|
||||
int32_t p, width, height, refreshrate, bpp;
|
||||
int32_t display_width, display_height, display_refreshrate, display_bpp;
|
||||
bool fullscreen;
|
||||
const char *read_vars[] = { "vid_fullscreen",
|
||||
"vid_width",
|
||||
"vid_height",
|
||||
|
@ -1426,12 +1426,12 @@ void VID_Init (void)
|
|||
|
||||
VID_InitModelist();
|
||||
|
||||
width = (int)vid_width.value;
|
||||
height = (int)vid_height.value;
|
||||
refreshrate = (int)vid_refreshrate.value;
|
||||
bpp = (int)vid_bpp.value;
|
||||
fullscreen = (int)vid_fullscreen.value;
|
||||
fsaa = (int)vid_fsaa.value;
|
||||
width = (int32_t)vid_width.value;
|
||||
height = (int32_t)vid_height.value;
|
||||
refreshrate = (int32_t)vid_refreshrate.value;
|
||||
bpp = (int32_t)vid_bpp.value;
|
||||
fullscreen = (int32_t)vid_fullscreen.value;
|
||||
fsaa = (int32_t)vid_fsaa.value;
|
||||
|
||||
if (COM_CheckParm("-current"))
|
||||
{
|
||||
|
@ -1481,11 +1481,11 @@ void VID_Init (void)
|
|||
|
||||
if (!VID_ValidMode(width, height, refreshrate, bpp, fullscreen))
|
||||
{
|
||||
width = (int)vid_width.value;
|
||||
height = (int)vid_height.value;
|
||||
refreshrate = (int)vid_refreshrate.value;
|
||||
bpp = (int)vid_bpp.value;
|
||||
fullscreen = (int)vid_fullscreen.value;
|
||||
width = (int32_t)vid_width.value;
|
||||
height = (int32_t)vid_height.value;
|
||||
refreshrate = (int32_t)vid_refreshrate.value;
|
||||
bpp = (int32_t)vid_bpp.value;
|
||||
fullscreen = (int32_t)vid_fullscreen.value;
|
||||
}
|
||||
|
||||
if (!VID_ValidMode(width, height, refreshrate, bpp, fullscreen))
|
||||
|
@ -1502,7 +1502,7 @@ void VID_Init (void)
|
|||
vid.maxwarpwidth = WARP_WIDTH;
|
||||
vid.maxwarpheight = WARP_HEIGHT;
|
||||
vid.colormap = host_colormap;
|
||||
vid.fullbright = 256 - LittleLong (*((int *)vid.colormap + 2048));
|
||||
vid.fullbright = 256 - LittleLong (*((int32_t *)vid.colormap + 2048));
|
||||
|
||||
// set window icon
|
||||
PL_SetWindowIcon();
|
||||
|
@ -1536,8 +1536,8 @@ void VID_Toggle (void)
|
|||
// TODO: Clear out the dead code, reinstate the fast path using SDL_SetWindowFullscreen
|
||||
// inside VID_SetMode, check window size to fix WinXP issue. This will
|
||||
// keep all the mode changing code in one place.
|
||||
static qboolean vid_toggle_works = false;
|
||||
qboolean toggleWorked;
|
||||
static bool vid_toggle_works = false;
|
||||
bool toggleWorked;
|
||||
Uint32 flags = 0;
|
||||
|
||||
S_ClearBuffer ();
|
||||
|
@ -1631,21 +1631,21 @@ enum {
|
|||
VIDEO_OPTIONS_ITEMS
|
||||
};
|
||||
|
||||
static int video_options_cursor = 0;
|
||||
static int32_t video_options_cursor = 0;
|
||||
|
||||
typedef struct {
|
||||
int width,height;
|
||||
int32_t width,height;
|
||||
} vid_menu_mode;
|
||||
|
||||
//TODO: replace these fixed-length arrays with hunk_allocated buffers
|
||||
static vid_menu_mode vid_menu_modes[MAX_MODE_LIST];
|
||||
static int vid_menu_nummodes = 0;
|
||||
static int32_t vid_menu_nummodes = 0;
|
||||
|
||||
static int vid_menu_bpps[MAX_BPPS_LIST];
|
||||
static int vid_menu_numbpps = 0;
|
||||
static int32_t vid_menu_bpps[MAX_BPPS_LIST];
|
||||
static int32_t vid_menu_numbpps = 0;
|
||||
|
||||
static int vid_menu_rates[MAX_RATES_LIST];
|
||||
static int vid_menu_numrates=0;
|
||||
static int32_t vid_menu_rates[MAX_RATES_LIST];
|
||||
static int32_t vid_menu_numrates=0;
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -1654,7 +1654,7 @@ VID_Menu_Init
|
|||
*/
|
||||
static void VID_Menu_Init (void)
|
||||
{
|
||||
int i, j, h, w;
|
||||
int32_t i, j, h, w;
|
||||
|
||||
for (i = 0; i < nummodes; i++)
|
||||
{
|
||||
|
@ -1686,7 +1686,7 @@ regenerates bpp list based on current vid_width and vid_height
|
|||
*/
|
||||
static void VID_Menu_RebuildBppList (void)
|
||||
{
|
||||
int i, j, b;
|
||||
int32_t i, j, b;
|
||||
|
||||
vid_menu_numbpps = 0;
|
||||
|
||||
|
@ -1724,7 +1724,7 @@ static void VID_Menu_RebuildBppList (void)
|
|||
|
||||
//if vid_bpp is not in the new list, change vid_bpp
|
||||
for (i = 0; i < vid_menu_numbpps; i++)
|
||||
if (vid_menu_bpps[i] == (int)(vid_bpp.value))
|
||||
if (vid_menu_bpps[i] == (int32_t)(vid_bpp.value))
|
||||
break;
|
||||
|
||||
if (i == vid_menu_numbpps)
|
||||
|
@ -1740,7 +1740,7 @@ regenerates rate list based on current vid_width, vid_height and vid_bpp
|
|||
*/
|
||||
static void VID_Menu_RebuildRateList (void)
|
||||
{
|
||||
int i,j,r;
|
||||
int32_t i,j,r;
|
||||
|
||||
vid_menu_numrates=0;
|
||||
|
||||
|
@ -1776,7 +1776,7 @@ static void VID_Menu_RebuildRateList (void)
|
|||
|
||||
//if vid_refreshrate is not in the new list, change vid_refreshrate
|
||||
for (i=0;i<vid_menu_numrates;i++)
|
||||
if (vid_menu_rates[i] == (int)(vid_refreshrate.value))
|
||||
if (vid_menu_rates[i] == (int32_t)(vid_refreshrate.value))
|
||||
break;
|
||||
|
||||
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
|
||||
================
|
||||
*/
|
||||
static void VID_Menu_ChooseNextMode (int dir)
|
||||
static void VID_Menu_ChooseNextMode (int32_t dir)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (vid_menu_nummodes)
|
||||
{
|
||||
|
@ -1831,9 +1831,9 @@ VID_Menu_ChooseNextBpp
|
|||
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)
|
||||
{
|
||||
|
@ -1867,9 +1867,9 @@ VID_Menu_ChooseNextRate
|
|||
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++)
|
||||
{
|
||||
|
@ -1898,7 +1898,7 @@ static void VID_Menu_ChooseNextRate (int dir)
|
|||
VID_MenuKey
|
||||
================
|
||||
*/
|
||||
static void VID_MenuKey (int key)
|
||||
static void VID_MenuKey (int32_t key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -2018,7 +2018,7 @@ VID_MenuDraw
|
|||
*/
|
||||
static void VID_MenuDraw (void)
|
||||
{
|
||||
int i, y;
|
||||
int32_t i, y;
|
||||
qpic_t *p;
|
||||
const char *title;
|
||||
|
||||
|
@ -2047,24 +2047,24 @@ static void VID_MenuDraw (void)
|
|||
{
|
||||
case VID_OPT_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("%" PRIi32 "x%" PRIi32 "", (int32_t)vid_width.value, (int32_t)vid_height.value));
|
||||
break;
|
||||
case VID_OPT_BPP:
|
||||
M_Print (16, y, " Color depth");
|
||||
M_Print (184, y, va("%i", (int)vid_bpp.value));
|
||||
M_Print (184, y, va("%" PRIi32 "", (int32_t)vid_bpp.value));
|
||||
break;
|
||||
case VID_OPT_REFRESHRATE:
|
||||
M_Print (16, y, " Refresh rate");
|
||||
M_Print (184, y, va("%i", (int)vid_refreshrate.value));
|
||||
M_Print (184, y, va("%" PRIi32 "", (int32_t)vid_refreshrate.value));
|
||||
break;
|
||||
case VID_OPT_FULLSCREEN:
|
||||
M_Print (16, y, " Fullscreen");
|
||||
M_DrawCheckbox (184, y, (int)vid_fullscreen.value);
|
||||
M_DrawCheckbox (184, y, (int32_t)vid_fullscreen.value);
|
||||
break;
|
||||
case VID_OPT_VSYNC:
|
||||
M_Print (16, y, " Vertical sync");
|
||||
if (gl_swap_control)
|
||||
M_DrawCheckbox (184, y, (int)vid_vsync.value);
|
||||
M_DrawCheckbox (184, y, (int32_t)vid_vsync.value);
|
||||
else
|
||||
M_Print (184, y, "N/A");
|
||||
break;
|
||||
|
@ -2078,7 +2078,7 @@ static void VID_MenuDraw (void)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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_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 turbsin[] =
|
||||
|
@ -36,8 +36,8 @@ float turbsin[] =
|
|||
#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 WARPCALC2(s,t) ((s + turbsin[(int)((t*0.125+cl.time)*(128.0/M_PI)) & 255]) * (1.0/64)) //johnfitz -- old 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[(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};
|
||||
|
||||
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;
|
||||
|
||||
mins[0] = mins[1] = mins[2] = 999999999;
|
||||
|
@ -69,21 +69,21 @@ 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;
|
||||
float m;
|
||||
float *v;
|
||||
vec3_t front[64], back[64];
|
||||
int f, b;
|
||||
int32_t f, b;
|
||||
float dist[64];
|
||||
float frac;
|
||||
glpoly_t *poly;
|
||||
float s, t;
|
||||
|
||||
if (numverts > 60)
|
||||
Sys_Error ("numverts = %i", numverts);
|
||||
Sys_Error ("numverts = %" PRIi32 "", numverts);
|
||||
|
||||
BoundPoly (numverts, verts, mins, maxs);
|
||||
|
||||
|
@ -160,7 +160,7 @@ GL_SubdivideSurface
|
|||
void GL_SubdivideSurface (msurface_t *fa)
|
||||
{
|
||||
vec3_t verts[64];
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
warpface = fa;
|
||||
|
||||
|
@ -180,7 +180,7 @@ DrawWaterPoly -- johnfitz
|
|||
void DrawWaterPoly (glpoly_t *p)
|
||||
{
|
||||
float *v;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (load_subdivide_size > 48)
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ R_UpdateWarpTextures -- johnfitz -- each frame, update warping textures
|
|||
void R_UpdateWarpTextures (void)
|
||||
{
|
||||
texture_t *tx;
|
||||
int i;
|
||||
int32_t i;
|
||||
float x, y, x2, warptess;
|
||||
|
||||
if (r_oldwater.value || cl.paused || r_drawflat_cheatsafe || r_lightmap_cheatsafe)
|
||||
|
|
107
source/glquake.h
107
source/glquake.h
|
@ -24,11 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef __GLQUAKE_H
|
||||
#define __GLQUAKE_H
|
||||
|
||||
void GL_BeginRendering (int *x, int *y, int *width, int *height);
|
||||
void GL_BeginRendering (int32_t *x, int32_t *y, int32_t *width, int32_t *height);
|
||||
void GL_EndRendering (void);
|
||||
void GL_Set2D (void);
|
||||
|
||||
extern int glx, gly, glwidth, glheight;
|
||||
extern int32_t glx, gly, glwidth, glheight;
|
||||
|
||||
#define GL_UNUSED_TEXTURE (~(GLuint)0)
|
||||
|
||||
|
@ -50,36 +50,7 @@ extern int glx, gly, glwidth, glheight;
|
|||
|
||||
void R_TimeRefresh_f (void);
|
||||
void R_ReadPointFile_f (void);
|
||||
texture_t *R_TextureAnimation (texture_t *base, int frame);
|
||||
|
||||
typedef struct surfcache_s
|
||||
{
|
||||
struct surfcache_s *next;
|
||||
struct surfcache_s **owner; // NULL is an empty chunk of memory
|
||||
int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
|
||||
int dlight;
|
||||
int size; // including header
|
||||
unsigned width;
|
||||
unsigned height; // DEBUG only needed for debug
|
||||
float mipscale;
|
||||
struct texture_s *texture; // checked for animating textures
|
||||
byte data[4]; // width*height elements
|
||||
} surfcache_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pixel_t *surfdat; // destination for generated surface
|
||||
int rowbytes; // destination logical width in bytes
|
||||
msurface_t *surf; // description for surface to generate
|
||||
fixed8_t lightadj[MAXLIGHTMAPS];
|
||||
// adjust for lightmap levels for dynamic lighting
|
||||
texture_t *texture; // corrected for animating textures
|
||||
int surfmip; // mipmapped ratio of surface texels / world pixels
|
||||
int surfwidth; // in mipmapped texels
|
||||
int surfheight; // in mipmapped texels
|
||||
} drawsurf_t;
|
||||
|
||||
texture_t *R_TextureAnimation (texture_t *base, int32_t frame);
|
||||
|
||||
typedef enum {
|
||||
pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
|
||||
|
@ -102,11 +73,11 @@ typedef struct particle_s
|
|||
|
||||
//====================================================
|
||||
|
||||
extern qboolean r_cache_thrash; // compatability
|
||||
extern bool r_cache_thrash; // compatability
|
||||
extern vec3_t modelorg, r_entorigin;
|
||||
extern entity_t *currententity;
|
||||
extern int r_visframecount; // ??? what difs?
|
||||
extern int r_framecount;
|
||||
extern int32_t r_visframecount; // ??? what difs?
|
||||
extern int32_t r_framecount;
|
||||
extern mplane_t frustum[4];
|
||||
|
||||
//
|
||||
|
@ -122,7 +93,7 @@ extern vec3_t r_origin;
|
|||
//
|
||||
extern refdef_t r_refdef;
|
||||
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
|
||||
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||
extern int32_t d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||
|
||||
extern cvar_t r_norefresh;
|
||||
extern cvar_t r_drawentities;
|
||||
|
@ -155,11 +126,11 @@ extern cvar_t gl_playermip;
|
|||
extern cvar_t gl_subdivide_size;
|
||||
extern float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded
|
||||
|
||||
extern int gl_stencilbits;
|
||||
extern int32_t gl_stencilbits;
|
||||
|
||||
// Multitexture
|
||||
extern qboolean mtexenabled;
|
||||
extern qboolean gl_mtexable;
|
||||
extern bool mtexenabled;
|
||||
extern bool gl_mtexable;
|
||||
extern PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc;
|
||||
extern PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc;
|
||||
extern PFNGLCLIENTACTIVETEXTUREARBPROC GL_ClientActiveTextureFunc;
|
||||
|
@ -169,7 +140,7 @@ extern GLint gl_max_texture_units; //ericw
|
|||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
extern float gl_max_anisotropy;
|
||||
extern qboolean gl_anisotropy_able;
|
||||
extern bool gl_anisotropy_able;
|
||||
|
||||
//ericw -- VBO
|
||||
extern PFNGLBINDBUFFERARBPROC GL_BindBufferFunc;
|
||||
|
@ -177,7 +148,7 @@ extern PFNGLBUFFERDATAARBPROC GL_BufferDataFunc;
|
|||
extern PFNGLBUFFERSUBDATAARBPROC GL_BufferSubDataFunc;
|
||||
extern PFNGLDELETEBUFFERSARBPROC GL_DeleteBuffersFunc;
|
||||
extern PFNGLGENBUFFERSARBPROC GL_GenBuffersFunc;
|
||||
extern qboolean gl_vbo_able;
|
||||
extern bool gl_vbo_able;
|
||||
//ericw
|
||||
|
||||
//ericw -- GLSL
|
||||
|
@ -230,13 +201,13 @@ extern QS_PFNGLUNIFORM1IPROC GL_Uniform1iFunc;
|
|||
extern QS_PFNGLUNIFORM1FPROC GL_Uniform1fFunc;
|
||||
extern QS_PFNGLUNIFORM3FPROC GL_Uniform3fFunc;
|
||||
extern QS_PFNGLUNIFORM4FPROC GL_Uniform4fFunc;
|
||||
extern qboolean gl_glsl_able;
|
||||
extern qboolean gl_glsl_gamma_able;
|
||||
extern qboolean gl_glsl_alias_able;
|
||||
extern bool gl_glsl_able;
|
||||
extern bool gl_glsl_gamma_able;
|
||||
extern bool gl_glsl_alias_able;
|
||||
// ericw --
|
||||
|
||||
//ericw -- NPOT texture support
|
||||
extern qboolean gl_texture_NPOT;
|
||||
extern bool gl_texture_NPOT;
|
||||
|
||||
//johnfitz -- polygon offset
|
||||
#define OFFSET_BMODEL 1
|
||||
|
@ -244,7 +215,7 @@ extern qboolean gl_texture_NPOT;
|
|||
#define OFFSET_DECAL -1
|
||||
#define OFFSET_FOG -2
|
||||
#define OFFSET_SHOWTRIS -3
|
||||
void GL_PolygonOffset (int);
|
||||
void GL_PolygonOffset (int32_t);
|
||||
|
||||
//johnfitz -- GL_EXT_texture_env_combine
|
||||
//the values for GL_ARB_ are identical
|
||||
|
@ -259,24 +230,24 @@ void GL_PolygonOffset (int);
|
|||
#define GL_SOURCE1_RGB_EXT 0x8581
|
||||
#define GL_SOURCE0_ALPHA_EXT 0x8588
|
||||
#define GL_SOURCE1_ALPHA_EXT 0x8589
|
||||
extern qboolean gl_texture_env_combine;
|
||||
extern qboolean gl_texture_env_add; // for GL_EXT_texture_env_add
|
||||
extern bool gl_texture_env_combine;
|
||||
extern bool gl_texture_env_add; // for GL_EXT_texture_env_add
|
||||
|
||||
//johnfitz -- rendering statistics
|
||||
extern int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
|
||||
extern int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
|
||||
extern int32_t rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
|
||||
extern int32_t rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
|
||||
extern float rs_megatexels;
|
||||
|
||||
//johnfitz -- track developer statistics that vary every frame
|
||||
extern cvar_t devstats;
|
||||
typedef struct {
|
||||
int packetsize;
|
||||
int edicts;
|
||||
int visedicts;
|
||||
int efrags;
|
||||
int tempents;
|
||||
int beams;
|
||||
int dlights;
|
||||
int32_t packetsize;
|
||||
int32_t edicts;
|
||||
int32_t visedicts;
|
||||
int32_t efrags;
|
||||
int32_t tempents;
|
||||
int32_t beams;
|
||||
int32_t dlights;
|
||||
} devstats_t;
|
||||
extern devstats_t dev_stats, dev_peakstats;
|
||||
|
||||
|
@ -291,13 +262,13 @@ extern overflowtimes_t dev_overflows; //this stores the last time overflow messa
|
|||
#define CONSOLE_RESPAM_TIME 3 // seconds between repeated warning messages
|
||||
|
||||
//johnfitz -- moved here from r_brush.c
|
||||
extern int gl_lightmap_format, lightmap_bytes;
|
||||
extern int32_t gl_lightmap_format, lightmap_bytes;
|
||||
#define MAX_LIGHTMAPS 512 //johnfitz -- was 64
|
||||
extern gltexture_t *lightmap_textures[MAX_LIGHTMAPS]; //johnfitz -- changed to an array
|
||||
|
||||
extern int gl_warpimagesize; //johnfitz -- for water warp
|
||||
extern int32_t gl_warpimagesize; //johnfitz -- for water warp
|
||||
|
||||
extern qboolean 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
|
||||
|
||||
typedef struct glsl_attrib_binding_s {
|
||||
const char *name;
|
||||
|
@ -324,19 +295,19 @@ void R_NewGame (void);
|
|||
void R_AnimateLight (void);
|
||||
void R_MarkSurfaces (void);
|
||||
void R_CullSurfaces (void);
|
||||
qboolean R_CullBox (vec3_t emins, vec3_t emaxs);
|
||||
bool R_CullBox (vec3_t emins, vec3_t emaxs);
|
||||
void R_StoreEfrags (efrag_t **ppefrag);
|
||||
qboolean R_CullModelForEntity (entity_t *e);
|
||||
bool R_CullModelForEntity (entity_t *e);
|
||||
void R_RotateForEntity (vec3_t origin, vec3_t angles);
|
||||
void R_MarkLights (dlight_t *light, int num, mnode_t *node);
|
||||
void R_MarkLights (dlight_t *light, int32_t num, mnode_t *node);
|
||||
|
||||
void R_InitParticles (void);
|
||||
void R_DrawParticles (void);
|
||||
void CL_RunParticles (void);
|
||||
void R_ClearParticles (void);
|
||||
|
||||
void R_TranslatePlayerSkin (int playernum);
|
||||
void R_TranslateNewPlayerSkin (int playernum); //johnfitz -- this handles cases when the actual texture changes
|
||||
void R_TranslatePlayerSkin (int32_t playernum);
|
||||
void R_TranslateNewPlayerSkin (int32_t playernum); //johnfitz -- this handles cases when the actual texture changes
|
||||
void R_UpdateWarpTextures (void);
|
||||
|
||||
void R_DrawWorld (void);
|
||||
|
@ -354,10 +325,10 @@ void GLMesh_LoadVertexBuffers (void);
|
|||
void GLMesh_DeleteVertexBuffers (void);
|
||||
void R_RebuildAllLightmaps (void);
|
||||
|
||||
int R_LightPoint (vec3_t p);
|
||||
int32_t R_LightPoint (vec3_t p);
|
||||
|
||||
void GL_SubdivideSurface (msurface_t *fa);
|
||||
void R_BuildLightMap (msurface_t *surf, byte *dest, int stride);
|
||||
void R_BuildLightMap (msurface_t *surf, byte *dest, int32_t stride);
|
||||
void R_RenderDynamicLightmaps (msurface_t *fa);
|
||||
void R_UploadLightmaps (void);
|
||||
|
||||
|
@ -367,7 +338,7 @@ void R_DrawAliasModel_ShowTris (entity_t *e);
|
|||
void R_DrawParticles_ShowTris (void);
|
||||
|
||||
GLint GL_GetUniformLocation (GLuint *programPtr, const char *name);
|
||||
GLuint GL_CreateProgram (const GLchar *vertSource, const GLchar *fragSource, int numbindings, const glsl_attrib_binding_t *bindings);
|
||||
GLuint GL_CreateProgram (const GLchar *vertSource, const GLchar *fragSource, int32_t numbindings, const glsl_attrib_binding_t *bindings);
|
||||
void R_DeleteShaders (void);
|
||||
|
||||
void GLWorld_CreateShaders (void);
|
||||
|
|
|
@ -39,17 +39,15 @@ Memory is cleared / released when a server or client begins, not when they end.
|
|||
|
||||
quakeparms_t *host_parms;
|
||||
|
||||
qboolean host_initialized; // true if into command execution
|
||||
bool host_initialized; // true if into command execution
|
||||
|
||||
double host_frametime;
|
||||
double realtime; // without any filtering or bounding
|
||||
double oldrealtime; // last frame run
|
||||
|
||||
int host_framecount;
|
||||
int32_t host_framecount;
|
||||
|
||||
int host_hunklevel;
|
||||
|
||||
int minimum_memory;
|
||||
int32_t host_hunklevel;
|
||||
|
||||
client_t *host_client; // current client
|
||||
|
||||
|
@ -150,7 +148,7 @@ void Host_Error (const char *error, ...)
|
|||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
static qboolean inerror = false;
|
||||
static bool inerror = false;
|
||||
|
||||
if (inerror)
|
||||
Sys_Error ("Host_Error: recursively entered");
|
||||
|
@ -185,7 +183,7 @@ Host_FindMaxClients
|
|||
*/
|
||||
void Host_FindMaxClients (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
svs.maxclients = 1;
|
||||
|
||||
|
@ -359,7 +357,7 @@ void SV_BroadcastPrintf (const char *fmt, ...)
|
|||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
va_start (argptr,fmt);
|
||||
q_vsnprintf (string, sizeof(string), fmt, argptr);
|
||||
|
@ -403,10 +401,10 @@ Called when the player is getting totally kicked off the host
|
|||
if (crash = true), don't bother sending signofs
|
||||
=====================
|
||||
*/
|
||||
void SV_DropClient (qboolean crash)
|
||||
void SV_DropClient (bool crash)
|
||||
{
|
||||
int saveSelf;
|
||||
int i;
|
||||
int32_t saveSelf;
|
||||
int32_t i;
|
||||
client_t *client;
|
||||
|
||||
if (!crash)
|
||||
|
@ -465,10 +463,10 @@ Host_ShutdownServer
|
|||
This only happens at the end of a game, not between levels
|
||||
==================
|
||||
*/
|
||||
void Host_ShutdownServer(qboolean crash)
|
||||
void Host_ShutdownServer(bool crash)
|
||||
{
|
||||
int i;
|
||||
int count;
|
||||
int32_t i;
|
||||
int32_t count;
|
||||
sizebuf_t buf;
|
||||
byte message[4];
|
||||
double start;
|
||||
|
@ -515,7 +513,7 @@ void Host_ShutdownServer(qboolean crash)
|
|||
MSG_WriteByte(&buf, svc_disconnect);
|
||||
count = NET_SendToAll(&buf, 5.0);
|
||||
if (count)
|
||||
Con_Printf("Host_ShutdownServer: NET_SendToAll failed for %u clients\n", count);
|
||||
Con_Printf("Host_ShutdownServer: NET_SendToAll failed for %" PRIu32 " clients\n", count);
|
||||
|
||||
for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++)
|
||||
if (host_client->active)
|
||||
|
@ -564,7 +562,7 @@ Host_FilterTime
|
|||
Returns false if the time is too short to run a frame
|
||||
===================
|
||||
*/
|
||||
qboolean Host_FilterTime (float time)
|
||||
bool Host_FilterTime (float time)
|
||||
{
|
||||
float maxfps; //johnfitz
|
||||
|
||||
|
@ -621,7 +619,7 @@ Host_ServerFrame
|
|||
*/
|
||||
void Host_ServerFrame (void)
|
||||
{
|
||||
int i, active; //johnfitz
|
||||
int32_t i, active; //johnfitz
|
||||
edict_t *ent; //johnfitz
|
||||
|
||||
// run the world state
|
||||
|
@ -651,7 +649,7 @@ void Host_ServerFrame (void)
|
|||
active++;
|
||||
}
|
||||
if (active > 600 && dev_peakstats.edicts <= 600)
|
||||
Con_DWarning ("%i edicts exceeds standard limit of 600 (max = %d).\n", active, sv.max_edicts);
|
||||
Con_DWarning ("%" PRIi32 " edicts exceeds standard limit of 600 (max = %" PRIi32 ").\n", active, sv.max_edicts);
|
||||
dev_stats.edicts = active;
|
||||
dev_peakstats.edicts = q_max(active, dev_peakstats.edicts);
|
||||
}
|
||||
|
@ -673,7 +671,7 @@ void _Host_Frame (float time)
|
|||
static double time1 = 0;
|
||||
static double time2 = 0;
|
||||
static double time3 = 0;
|
||||
int pass1, pass2, pass3;
|
||||
int32_t pass1, pass2, pass3;
|
||||
|
||||
if (setjmp (host_abortserver) )
|
||||
return; // something bad happened, or the server disconnected
|
||||
|
@ -756,7 +754,7 @@ void _Host_Frame (float time)
|
|||
time3 = Sys_DoubleTime ();
|
||||
pass2 = (time2 - time1)*1000;
|
||||
pass3 = (time3 - time2)*1000;
|
||||
Con_Printf ("%3i tot %3i server %3i gfx %3i snd\n",
|
||||
Con_Printf ("%3" PRIi32 " tot %3" PRIi32 " server %3" PRIi32 " gfx %3" PRIi32 " snd\n",
|
||||
pass1+pass2+pass3, pass1, pass2, pass3);
|
||||
}
|
||||
|
||||
|
@ -768,8 +766,8 @@ void Host_Frame (float time)
|
|||
{
|
||||
double time1, time2;
|
||||
static double timetotal;
|
||||
static int timecount;
|
||||
int i, c, m;
|
||||
static int32_t timecount;
|
||||
int32_t i, c, m;
|
||||
|
||||
if (!serverprofile.value)
|
||||
{
|
||||
|
@ -797,7 +795,7 @@ void Host_Frame (float time)
|
|||
c++;
|
||||
}
|
||||
|
||||
Con_Printf ("serverprofile: %2i clients %2i msec\n", c, m);
|
||||
Con_Printf ("serverprofile: %2" PRIi32 " clients %2" PRIi32 " msec\n", c, m);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -807,15 +805,18 @@ Host_Init
|
|||
*/
|
||||
void Host_Init (void)
|
||||
{
|
||||
int32_t minimum_memory;
|
||||
|
||||
if (standard_quake)
|
||||
minimum_memory = MINIMUM_MEMORY;
|
||||
else minimum_memory = MINIMUM_MEMORY_LEVELPAK;
|
||||
else
|
||||
minimum_memory = MINIMUM_MEMORY_LEVELPAK;
|
||||
|
||||
if (COM_CheckParm ("-minmemory"))
|
||||
host_parms->memsize = minimum_memory;
|
||||
|
||||
if (host_parms->memsize < minimum_memory)
|
||||
Sys_Error ("Only %4.1f megs of memory available, can't execute game", host_parms->memsize / (float)0x100000);
|
||||
Sys_Error ("Only %4.1f MiB of memory available, can't execute game", host_parms->memsize / (float)0x100000);
|
||||
|
||||
com_argc = host_parms->argc;
|
||||
com_argv = host_parms->argv;
|
||||
|
@ -901,7 +902,7 @@ to run quit through here before the final handoff to the sys code.
|
|||
*/
|
||||
void Host_Shutdown(void)
|
||||
{
|
||||
static qboolean isdown = false;
|
||||
static bool isdown = false;
|
||||
|
||||
if (isdown)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
extern cvar_t pausable;
|
||||
|
||||
int current_skill;
|
||||
int32_t current_skill;
|
||||
|
||||
void Mod_Print (void);
|
||||
|
||||
|
@ -128,7 +128,7 @@ void ExtraMaps_Init (void)
|
|||
char ignorepakdir[32];
|
||||
searchpath_t *search;
|
||||
pack_t *pak;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// we don't want to list the maps in id1 pakfiles,
|
||||
// because these are not "add-on" levels
|
||||
|
@ -202,14 +202,14 @@ Host_Maps_f
|
|||
*/
|
||||
void Host_Maps_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
filelist_item_t *level;
|
||||
|
||||
for (level = extralevels, i = 0; level; level = level->next, i++)
|
||||
Con_SafePrintf (" %s\n", level->name);
|
||||
|
||||
if (i)
|
||||
Con_SafePrintf ("%i map(s)\n", i);
|
||||
Con_SafePrintf ("%" PRIi32 " map(s)\n", i);
|
||||
else
|
||||
Con_SafePrintf ("no maps found\n");
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ void DemoList_Init (void)
|
|||
char ignorepakdir[32];
|
||||
searchpath_t *search;
|
||||
pack_t *pak;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// we don't want to list the demos in id1 pakfiles,
|
||||
// because these are not "add-on" demos
|
||||
|
@ -378,14 +378,14 @@ list all potential mod directories (contain either a pak file or a progs.dat)
|
|||
*/
|
||||
void Host_Mods_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
filelist_item_t *mod;
|
||||
|
||||
for (mod = modlist, i=0; mod; mod = mod->next, i++)
|
||||
Con_SafePrintf (" %s\n", mod->name);
|
||||
|
||||
if (i)
|
||||
Con_SafePrintf ("%i mod(s)\n", i);
|
||||
Con_SafePrintf ("%" PRIi32 " mod(s)\n", i);
|
||||
else
|
||||
Con_SafePrintf ("no mods found\n");
|
||||
}
|
||||
|
@ -424,10 +424,10 @@ void Host_Status_f (void)
|
|||
void (*print_fn) (const char *fmt, ...)
|
||||
FUNCP_PRINTF(1,2);
|
||||
client_t *client;
|
||||
int seconds;
|
||||
int minutes;
|
||||
int hours = 0;
|
||||
int j;
|
||||
int32_t seconds;
|
||||
int32_t minutes;
|
||||
int32_t hours = 0;
|
||||
int32_t j;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
{
|
||||
|
@ -448,12 +448,12 @@ void Host_Status_f (void)
|
|||
if (ipxAvailable)
|
||||
print_fn ("ipx: %s\n", my_ipx_address);
|
||||
print_fn ("map: %s\n", sv.name);
|
||||
print_fn ("players: %i active (%i max)\n\n", net_activeconnections, svs.maxclients);
|
||||
print_fn ("players: %" PRIi32 " active (%" PRIi32 " max)\n\n", net_activeconnections, svs.maxclients);
|
||||
for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++)
|
||||
{
|
||||
if (!client->active)
|
||||
continue;
|
||||
seconds = (int)(net_time - NET_QSocketGetTime(client->netconnection));
|
||||
seconds = (int32_t)(net_time - NET_QSocketGetTime(client->netconnection));
|
||||
minutes = seconds / 60;
|
||||
if (minutes)
|
||||
{
|
||||
|
@ -464,7 +464,7 @@ void Host_Status_f (void)
|
|||
}
|
||||
else
|
||||
hours = 0;
|
||||
print_fn ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j+1, client->name, (int)client->edict->v.frags, hours, minutes, seconds);
|
||||
print_fn ("#%-2" PRIu32 " %-16.16s %3" PRIi32 " %2" PRIi32 ":%02" PRIi32 ":%02" PRIi32 "n", j+1, client->name, (int32_t)client->edict->v.frags, hours, minutes, seconds);
|
||||
print_fn (" %s\n", NET_QSocketGetAddressString(client->netconnection));
|
||||
}
|
||||
}
|
||||
|
@ -491,8 +491,8 @@ void Host_God_f (void)
|
|||
switch (Cmd_Argc())
|
||||
{
|
||||
case 1:
|
||||
sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE;
|
||||
if (!((int)sv_player->v.flags & FL_GODMODE) )
|
||||
sv_player->v.flags = (int32_t)sv_player->v.flags ^ FL_GODMODE;
|
||||
if (!((int32_t)sv_player->v.flags & FL_GODMODE) )
|
||||
SV_ClientPrintf ("godmode OFF\n");
|
||||
else
|
||||
SV_ClientPrintf ("godmode ON\n");
|
||||
|
@ -500,12 +500,12 @@ void Host_God_f (void)
|
|||
case 2:
|
||||
if (Q_atof(Cmd_Argv(1)))
|
||||
{
|
||||
sv_player->v.flags = (int)sv_player->v.flags | FL_GODMODE;
|
||||
sv_player->v.flags = (int32_t)sv_player->v.flags | FL_GODMODE;
|
||||
SV_ClientPrintf ("godmode ON\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
sv_player->v.flags = (int)sv_player->v.flags & ~FL_GODMODE;
|
||||
sv_player->v.flags = (int32_t)sv_player->v.flags & ~FL_GODMODE;
|
||||
SV_ClientPrintf ("godmode OFF\n");
|
||||
}
|
||||
break;
|
||||
|
@ -536,8 +536,8 @@ void Host_Notarget_f (void)
|
|||
switch (Cmd_Argc())
|
||||
{
|
||||
case 1:
|
||||
sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET;
|
||||
if (!((int)sv_player->v.flags & FL_NOTARGET) )
|
||||
sv_player->v.flags = (int32_t)sv_player->v.flags ^ FL_NOTARGET;
|
||||
if (!((int32_t)sv_player->v.flags & FL_NOTARGET) )
|
||||
SV_ClientPrintf ("notarget OFF\n");
|
||||
else
|
||||
SV_ClientPrintf ("notarget ON\n");
|
||||
|
@ -545,12 +545,12 @@ void Host_Notarget_f (void)
|
|||
case 2:
|
||||
if (Q_atof(Cmd_Argv(1)))
|
||||
{
|
||||
sv_player->v.flags = (int)sv_player->v.flags | FL_NOTARGET;
|
||||
sv_player->v.flags = (int32_t)sv_player->v.flags | FL_NOTARGET;
|
||||
SV_ClientPrintf ("notarget ON\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
sv_player->v.flags = (int)sv_player->v.flags & ~FL_NOTARGET;
|
||||
sv_player->v.flags = (int32_t)sv_player->v.flags & ~FL_NOTARGET;
|
||||
SV_ClientPrintf ("notarget OFF\n");
|
||||
}
|
||||
break;
|
||||
|
@ -561,7 +561,7 @@ void Host_Notarget_f (void)
|
|||
//johnfitz
|
||||
}
|
||||
|
||||
qboolean noclip_anglehack;
|
||||
bool noclip_anglehack;
|
||||
|
||||
/*
|
||||
==================
|
||||
|
@ -641,13 +641,13 @@ void Host_SetPos_f(void)
|
|||
SV_ClientPrintf(" setpos <x> <y> <z>\n");
|
||||
SV_ClientPrintf(" setpos <x> <y> <z> <pitch> <yaw> <roll>\n");
|
||||
SV_ClientPrintf("current values:\n");
|
||||
SV_ClientPrintf(" %i %i %i %i %i %i\n",
|
||||
(int)sv_player->v.origin[0],
|
||||
(int)sv_player->v.origin[1],
|
||||
(int)sv_player->v.origin[2],
|
||||
(int)sv_player->v.v_angle[0],
|
||||
(int)sv_player->v.v_angle[1],
|
||||
(int)sv_player->v.v_angle[2]);
|
||||
SV_ClientPrintf(" %" PRIi32 " %" PRIi32 " %" PRIi32 " %" PRIi32 " %" PRIi32 " %" PRIi32 "\n",
|
||||
(int32_t)sv_player->v.origin[0],
|
||||
(int32_t)sv_player->v.origin[1],
|
||||
(int32_t)sv_player->v.origin[2],
|
||||
(int32_t)sv_player->v.v_angle[0],
|
||||
(int32_t)sv_player->v.v_angle[1],
|
||||
(int32_t)sv_player->v.v_angle[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -739,7 +739,7 @@ Host_Ping_f
|
|||
*/
|
||||
void Host_Ping_f (void)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
float total;
|
||||
client_t *client;
|
||||
|
||||
|
@ -758,7 +758,7 @@ void Host_Ping_f (void)
|
|||
for (j = 0; j < NUM_PING_TIMES; j++)
|
||||
total+=client->ping_times[j];
|
||||
total /= NUM_PING_TIMES;
|
||||
SV_ClientPrintf ("%4i %s\n", (int)(total*1000), client->name);
|
||||
SV_ClientPrintf ("%4" PRIi32 " %s\n", (int32_t)(total*1000), client->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -782,7 +782,7 @@ command from the console. Active clients are kicked off.
|
|||
*/
|
||||
void Host_Map_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
char name[MAX_QPATH], *p;
|
||||
|
||||
if (Cmd_Argc() < 2) //no map name given
|
||||
|
@ -850,7 +850,7 @@ Loads a random map from the "maps" list.
|
|||
*/
|
||||
void Host_Randmap_f (void)
|
||||
{
|
||||
int i, randlevel, numlevels;
|
||||
int32_t i, randlevel, numlevels;
|
||||
filelist_item_t *level;
|
||||
|
||||
if (cmd_source != src_command)
|
||||
|
@ -998,13 +998,13 @@ Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current
|
|||
*/
|
||||
void Host_SavegameComment (char *text)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
char kills[20];
|
||||
|
||||
for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
||||
text[i] = ' ';
|
||||
memcpy (text, cl.levelname, q_min(strlen(cl.levelname),22)); //johnfitz -- only copy 22 chars.
|
||||
sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
||||
sprintf (kills,"kills:%3" PRIi32 "/%3" PRIi32 "", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
||||
memcpy (text+22, kills, strlen(kills));
|
||||
// convert space to _ to make stdio happy
|
||||
for (i = 0; i < SAVEGAME_COMMENT_LENGTH; i++)
|
||||
|
@ -1025,7 +1025,7 @@ void Host_Savegame_f (void)
|
|||
{
|
||||
char name[MAX_OSPATH];
|
||||
FILE *f;
|
||||
int i;
|
||||
int32_t i;
|
||||
char comment[SAVEGAME_COMMENT_LENGTH+1];
|
||||
|
||||
if (cmd_source != src_command)
|
||||
|
@ -1081,12 +1081,12 @@ void Host_Savegame_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
fprintf (f, "%i\n", SAVEGAME_VERSION);
|
||||
fprintf (f, "%" PRIi32 "\n", SAVEGAME_VERSION);
|
||||
Host_SavegameComment (comment);
|
||||
fprintf (f, "%s\n", comment);
|
||||
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
||||
fprintf (f, "%f\n", svs.clients->spawn_parms[i]);
|
||||
fprintf (f, "%d\n", current_skill);
|
||||
fprintf (f, "%" PRIi32 "\n", current_skill);
|
||||
fprintf (f, "%s\n", sv.name);
|
||||
fprintf (f, "%f\n",sv.time);
|
||||
|
||||
|
@ -1125,10 +1125,10 @@ void Host_Loadgame_f (void)
|
|||
char mapname[MAX_QPATH];
|
||||
float time, tfloat;
|
||||
const char *data;
|
||||
int i;
|
||||
int32_t i;
|
||||
edict_t *ent;
|
||||
int entnum;
|
||||
int version;
|
||||
int32_t entnum;
|
||||
int32_t version;
|
||||
float spawn_parms[NUM_SPAWN_PARMS];
|
||||
|
||||
if (cmd_source != src_command)
|
||||
|
@ -1174,7 +1174,7 @@ void Host_Loadgame_f (void)
|
|||
{
|
||||
free (start);
|
||||
start = NULL;
|
||||
Con_Printf ("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION);
|
||||
Con_Printf ("Savegame is version %" PRIi32 ", not %" PRIi32 "\n", version, SAVEGAME_VERSION);
|
||||
return;
|
||||
}
|
||||
data = COM_ParseStringNewline (data);
|
||||
|
@ -1182,7 +1182,7 @@ void Host_Loadgame_f (void)
|
|||
data = COM_ParseFloatNewline (data, &spawn_parms[i]);
|
||||
// this silliness is so we can load 1.06 save files, which have float skill values
|
||||
data = COM_ParseFloatNewline(data, &tfloat);
|
||||
current_skill = (int)(tfloat + 0.1);
|
||||
current_skill = (int32_t)(tfloat + 0.1);
|
||||
Cvar_SetValue ("skill", (float)current_skill);
|
||||
|
||||
data = COM_ParseStringNewline (data);
|
||||
|
@ -1310,15 +1310,15 @@ void Host_Name_f (void)
|
|||
MSG_WriteString (&sv.reliable_datagram, host_client->name);
|
||||
}
|
||||
|
||||
void Host_Say(qboolean teamonly)
|
||||
void Host_Say(bool teamonly)
|
||||
{
|
||||
int j;
|
||||
int32_t j;
|
||||
client_t *client;
|
||||
client_t *save;
|
||||
const char *p;
|
||||
char text[MAXCMDLINE], *p2;
|
||||
qboolean quoted;
|
||||
qboolean fromServer = false;
|
||||
bool quoted;
|
||||
bool fromServer = false;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
{
|
||||
|
@ -1351,8 +1351,8 @@ void Host_Say(qboolean teamonly)
|
|||
q_snprintf (text, sizeof(text), "\001<%s> %s", hostname.string, p);
|
||||
|
||||
// check length & truncate if necessary
|
||||
j = (int) strlen(text);
|
||||
if (j >= (int) sizeof(text) - 1)
|
||||
j = (int32_t) strlen(text);
|
||||
if (j >= (int32_t) sizeof(text) - 1)
|
||||
{
|
||||
text[sizeof(text) - 2] = '\n';
|
||||
text[sizeof(text) - 1] = '\0';
|
||||
|
@ -1402,12 +1402,12 @@ void Host_Say_Team_f(void)
|
|||
|
||||
void Host_Tell_f(void)
|
||||
{
|
||||
int j;
|
||||
int32_t j;
|
||||
client_t *client;
|
||||
client_t *save;
|
||||
const char *p;
|
||||
char text[MAXCMDLINE], *p2;
|
||||
qboolean quoted;
|
||||
bool quoted;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
{
|
||||
|
@ -1429,8 +1429,8 @@ void Host_Tell_f(void)
|
|||
q_snprintf (text, sizeof(text), "%s: %s", host_client->name, p);
|
||||
|
||||
// check length & truncate if necessary
|
||||
j = (int) strlen(text);
|
||||
if (j >= (int) sizeof(text) - 1)
|
||||
j = (int32_t) strlen(text);
|
||||
if (j >= (int32_t) sizeof(text) - 1)
|
||||
{
|
||||
text[sizeof(text) - 2] = '\n';
|
||||
text[sizeof(text) - 1] = '\0';
|
||||
|
@ -1472,12 +1472,12 @@ Host_Color_f
|
|||
*/
|
||||
void Host_Color_f(void)
|
||||
{
|
||||
int top, bottom;
|
||||
int playercolor;
|
||||
int32_t top, bottom;
|
||||
int32_t playercolor;
|
||||
|
||||
if (Cmd_Argc() == 1)
|
||||
{
|
||||
Con_Printf ("\"color\" is \"%i %i\"\n", ((int)cl_color.value) >> 4, ((int)cl_color.value) & 0x0f);
|
||||
Con_Printf ("\"color\" is \"%" PRIi32 " %" PRIi32 "\"\n", ((int32_t)cl_color.value) >> 4, ((int32_t)cl_color.value) & 0x0f);
|
||||
Con_Printf ("color <0-13> [0-13]\n");
|
||||
return;
|
||||
}
|
||||
|
@ -1617,7 +1617,7 @@ Host_Spawn_f
|
|||
*/
|
||||
void Host_Spawn_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
client_t *client;
|
||||
edict_t *ent;
|
||||
|
||||
|
@ -1761,8 +1761,8 @@ void Host_Kick_f (void)
|
|||
const char *who;
|
||||
const char *message = NULL;
|
||||
client_t *save;
|
||||
int i;
|
||||
qboolean byNumber = false;
|
||||
int32_t i;
|
||||
bool byNumber = false;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
{
|
||||
|
@ -1851,7 +1851,7 @@ Host_Give_f
|
|||
void Host_Give_f (void)
|
||||
{
|
||||
const char *t;
|
||||
int v;
|
||||
int32_t v;
|
||||
eval_t *val;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
|
@ -1884,21 +1884,21 @@ void Host_Give_f (void)
|
|||
if (t[0] == '6')
|
||||
{
|
||||
if (t[1] == 'a')
|
||||
sv_player->v.items = (int)sv_player->v.items | HIT_PROXIMITY_GUN;
|
||||
sv_player->v.items = (int32_t)sv_player->v.items | HIT_PROXIMITY_GUN;
|
||||
else
|
||||
sv_player->v.items = (int)sv_player->v.items | IT_GRENADE_LAUNCHER;
|
||||
sv_player->v.items = (int32_t)sv_player->v.items | IT_GRENADE_LAUNCHER;
|
||||
}
|
||||
else if (t[0] == '9')
|
||||
sv_player->v.items = (int)sv_player->v.items | HIT_LASER_CANNON;
|
||||
sv_player->v.items = (int32_t)sv_player->v.items | HIT_LASER_CANNON;
|
||||
else if (t[0] == '0')
|
||||
sv_player->v.items = (int)sv_player->v.items | HIT_MJOLNIR;
|
||||
sv_player->v.items = (int32_t)sv_player->v.items | HIT_MJOLNIR;
|
||||
else if (t[0] >= '2')
|
||||
sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
|
||||
sv_player->v.items = (int32_t)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (t[0] >= '2')
|
||||
sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
|
||||
sv_player->v.items = (int32_t)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2013,7 +2013,7 @@ void Host_Give_f (void)
|
|||
sv_player->v.armortype = 0.8;
|
||||
sv_player->v.armorvalue = v;
|
||||
sv_player->v.items = sv_player->v.items -
|
||||
((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||
((int32_t)(sv_player->v.items) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||
IT_ARMOR3;
|
||||
}
|
||||
else if (v > 100)
|
||||
|
@ -2021,7 +2021,7 @@ void Host_Give_f (void)
|
|||
sv_player->v.armortype = 0.6;
|
||||
sv_player->v.armorvalue = v;
|
||||
sv_player->v.items = sv_player->v.items -
|
||||
((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||
((int32_t)(sv_player->v.items) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||
IT_ARMOR2;
|
||||
}
|
||||
else if (v >= 0)
|
||||
|
@ -2029,7 +2029,7 @@ void Host_Give_f (void)
|
|||
sv_player->v.armortype = 0.3;
|
||||
sv_player->v.armorvalue = v;
|
||||
sv_player->v.items = sv_player->v.items -
|
||||
((int)(sv_player->v.items) & (int)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||
((int32_t)(sv_player->v.items) & (int32_t)(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) +
|
||||
IT_ARMOR1;
|
||||
}
|
||||
break;
|
||||
|
@ -2037,7 +2037,7 @@ void Host_Give_f (void)
|
|||
}
|
||||
|
||||
//johnfitz -- update currentammo to match new ammo (so statusbar updates correctly)
|
||||
switch ((int)(sv_player->v.weapon))
|
||||
switch ((int32_t)(sv_player->v.weapon))
|
||||
{
|
||||
case IT_SHOTGUN:
|
||||
case IT_SUPER_SHOTGUN:
|
||||
|
@ -2075,7 +2075,7 @@ void Host_Give_f (void)
|
|||
|
||||
edict_t *FindViewthing (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
edict_t *e;
|
||||
|
||||
for (i=0 ; i<sv.num_edicts ; i++)
|
||||
|
@ -2110,7 +2110,7 @@ void Host_Viewmodel_f (void)
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
edict_t *e;
|
||||
int f;
|
||||
int32_t f;
|
||||
qmodel_t *m;
|
||||
|
||||
e = FindViewthing ();
|
||||
if (!e)
|
||||
return;
|
||||
m = cl.model_precache[(int)e->v.modelindex];
|
||||
m = cl.model_precache[(int32_t)e->v.modelindex];
|
||||
|
||||
f = atoi(Cmd_Argv(1));
|
||||
if (f >= m->numframes)
|
||||
|
@ -2137,7 +2137,7 @@ void Host_Viewframe_f (void)
|
|||
}
|
||||
|
||||
|
||||
void PrintFrameName (qmodel_t *m, int frame)
|
||||
void PrintFrameName (qmodel_t *m, int32_t frame)
|
||||
{
|
||||
aliashdr_t *hdr;
|
||||
maliasframedesc_t *pframedesc;
|
||||
|
@ -2147,7 +2147,7 @@ void PrintFrameName (qmodel_t *m, int frame)
|
|||
return;
|
||||
pframedesc = &hdr->frames[frame];
|
||||
|
||||
Con_Printf ("frame %i: %s\n", frame, pframedesc->name);
|
||||
Con_Printf ("frame %" PRIi32 ": %s\n", frame, pframedesc->name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2163,7 +2163,7 @@ void Host_Viewnext_f (void)
|
|||
e = FindViewthing ();
|
||||
if (!e)
|
||||
return;
|
||||
m = cl.model_precache[(int)e->v.modelindex];
|
||||
m = cl.model_precache[(int32_t)e->v.modelindex];
|
||||
|
||||
e->v.frame = e->v.frame + 1;
|
||||
if (e->v.frame >= m->numframes)
|
||||
|
@ -2186,7 +2186,7 @@ void Host_Viewprev_f (void)
|
|||
if (!e)
|
||||
return;
|
||||
|
||||
m = cl.model_precache[(int)e->v.modelindex];
|
||||
m = cl.model_precache[(int32_t)e->v.modelindex];
|
||||
|
||||
e->v.frame = e->v.frame - 1;
|
||||
if (e->v.frame < 0)
|
||||
|
@ -2211,7 +2211,7 @@ Host_Startdemos_f
|
|||
*/
|
||||
void Host_Startdemos_f (void)
|
||||
{
|
||||
int i, c;
|
||||
int32_t i, c;
|
||||
|
||||
if (cls.state == ca_dedicated)
|
||||
return;
|
||||
|
@ -2219,10 +2219,10 @@ void Host_Startdemos_f (void)
|
|||
c = Cmd_Argc() - 1;
|
||||
if (c > MAX_DEMOS)
|
||||
{
|
||||
Con_Printf ("Max %i demos in demoloop\n", MAX_DEMOS);
|
||||
Con_Printf ("Max %" PRIi32 " demos in demoloop\n", MAX_DEMOS);
|
||||
c = MAX_DEMOS;
|
||||
}
|
||||
Con_Printf ("%i demo(s) in loop\n", c);
|
||||
Con_Printf ("%" PRIi32 " demo(s) in loop\n", c);
|
||||
|
||||
for (i = 1; i < c + 1; i++)
|
||||
q_strlcpy (cls.demos[i-1], Cmd_Argv(i), sizeof(cls.demos[0]));
|
||||
|
|
|
@ -39,8 +39,8 @@ static char loadfilename[MAX_OSPATH]; //file scope so that error messages can us
|
|||
typedef struct stdio_buffer_s {
|
||||
FILE *f;
|
||||
uint8_t buffer[1024];
|
||||
int size;
|
||||
int pos;
|
||||
int32_t size;
|
||||
int32_t pos;
|
||||
} stdio_buffer_t;
|
||||
|
||||
static stdio_buffer_t *Buf_Alloc(FILE *f)
|
||||
|
@ -55,7 +55,7 @@ static void Buf_Free(stdio_buffer_t *buf)
|
|||
free(buf);
|
||||
}
|
||||
|
||||
static inline int Buf_GetC(stdio_buffer_t *buf)
|
||||
static inline int32_t Buf_GetC(stdio_buffer_t *buf)
|
||||
{
|
||||
if (buf->pos >= buf->size)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ returns a pointer to hunk allocated RGBA data
|
|||
TODO: search order: tga png jpg pcx lmp
|
||||
============
|
||||
*/
|
||||
byte *Image_LoadImage (const char *name, int *width, int *height)
|
||||
byte *Image_LoadImage (const char *name, int32_t *width, int32_t *height)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
|
@ -113,7 +113,7 @@ typedef struct targaheader_s {
|
|||
|
||||
targaheader_t targa_header;
|
||||
|
||||
int fgetLittleShort (FILE *f)
|
||||
int32_t fgetLittleShort (FILE *f)
|
||||
{
|
||||
byte b1, b2;
|
||||
|
||||
|
@ -123,7 +123,7 @@ int fgetLittleShort (FILE *f)
|
|||
return (int16_t)(b1 + b2*256);
|
||||
}
|
||||
|
||||
int fgetLittleLong (FILE *f)
|
||||
int32_t fgetLittleLong (FILE *f)
|
||||
{
|
||||
byte b1, b2, b3, b4;
|
||||
|
||||
|
@ -144,9 +144,9 @@ returns true if successful
|
|||
TODO: support BGRA and BGR formats (since opengl can return them, and we don't have to swap)
|
||||
============
|
||||
*/
|
||||
qboolean Image_WriteTGA (const char *name, byte *data, int width, int height, int bpp, qboolean upsidedown)
|
||||
bool Image_WriteTGA (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, bool upsidedown)
|
||||
{
|
||||
int handle, i, size, temp, bytes;
|
||||
int32_t handle, i, size, temp, bytes;
|
||||
char pathname[MAX_OSPATH];
|
||||
byte header[TARGAHEADERSIZE];
|
||||
|
||||
|
@ -188,14 +188,14 @@ qboolean Image_WriteTGA (const char *name, byte *data, int width, int height, in
|
|||
Image_LoadTGA
|
||||
=============
|
||||
*/
|
||||
byte *Image_LoadTGA (FILE *fin, int *width, int *height)
|
||||
byte *Image_LoadTGA (FILE *fin, int32_t *width, int32_t *height)
|
||||
{
|
||||
int columns, rows, numPixels;
|
||||
int32_t columns, rows, numPixels;
|
||||
byte *pixbuf;
|
||||
int row, column;
|
||||
int32_t row, column;
|
||||
byte *targa_rgba;
|
||||
int realrow; //johnfitz -- fix for upside-down targas
|
||||
qboolean upside_down; //johnfitz -- fix for upside-down targas
|
||||
int32_t realrow; //johnfitz -- fix for upside-down targas
|
||||
bool upside_down; //johnfitz -- fix for upside-down targas
|
||||
stdio_buffer_t *buf;
|
||||
|
||||
targa_header.id_length = fgetc(fin);
|
||||
|
@ -371,8 +371,8 @@ byte *Image_LoadTGA (FILE *fin, int *width, int *height)
|
|||
Buf_Free(buf);
|
||||
fclose(fin);
|
||||
|
||||
*width = (int)(targa_header.width);
|
||||
*height = (int)(targa_header.height);
|
||||
*width = (int32_t)(targa_header.width);
|
||||
*height = (int32_t)(targa_header.height);
|
||||
return targa_rgba;
|
||||
}
|
||||
|
||||
|
@ -403,10 +403,10 @@ typedef struct
|
|||
Image_LoadPCX
|
||||
============
|
||||
*/
|
||||
byte *Image_LoadPCX (FILE *f, int *width, int *height)
|
||||
byte *Image_LoadPCX (FILE *f, int32_t *width, int32_t *height)
|
||||
{
|
||||
pcxheader_t pcx;
|
||||
int x, y, w, h, readbyte, runlength, start;
|
||||
int32_t x, y, w, h, readbyte, runlength, start;
|
||||
byte *p, *data;
|
||||
byte palette[768];
|
||||
stdio_buffer_t *buf;
|
||||
|
@ -424,7 +424,7 @@ byte *Image_LoadPCX (FILE *f, int *width, int *height)
|
|||
Sys_Error ("'%s' is not a valid PCX file", loadfilename);
|
||||
|
||||
if (pcx.version != 5)
|
||||
Sys_Error ("'%s' is version %i, should be 5", loadfilename, pcx.version);
|
||||
Sys_Error ("'%s' is version %" PRIi32 ", should be 5", loadfilename, pcx.version);
|
||||
|
||||
if (pcx.encoding != 1 || pcx.bits_per_pixel != 8 || pcx.color_planes != 1)
|
||||
Sys_Error ("'%s' has wrong encoding or bit depth", loadfilename);
|
||||
|
@ -485,9 +485,9 @@ byte *Image_LoadPCX (FILE *f, int *width, int *height)
|
|||
//
|
||||
//==============================================================================
|
||||
|
||||
static byte *CopyFlipped(const byte *data, int width, int height, int bpp)
|
||||
static byte *CopyFlipped(const byte *data, int32_t width, int32_t height, int32_t bpp)
|
||||
{
|
||||
int y, rowsize;
|
||||
int32_t y, rowsize;
|
||||
byte *flipped;
|
||||
|
||||
rowsize = width * (bpp / 8);
|
||||
|
@ -509,12 +509,12 @@ Image_WriteJPG -- writes using stb_image_write
|
|||
returns true if successful
|
||||
============
|
||||
*/
|
||||
qboolean Image_WriteJPG (const char *name, byte *data, int width, int height, int bpp, int quality, qboolean upsidedown)
|
||||
bool Image_WriteJPG (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, int32_t quality, bool upsidedown)
|
||||
{
|
||||
unsigned error;
|
||||
char pathname[MAX_OSPATH];
|
||||
byte *flipped;
|
||||
int bytes_per_pixel;
|
||||
int32_t bytes_per_pixel;
|
||||
|
||||
if (!(bpp == 32 || bpp == 24))
|
||||
Sys_Error ("bpp not 24 or 32");
|
||||
|
@ -540,7 +540,7 @@ qboolean Image_WriteJPG (const char *name, byte *data, int width, int height, in
|
|||
return (error != 0);
|
||||
}
|
||||
|
||||
qboolean Image_WritePNG (const char *name, byte *data, int width, int height, int bpp, qboolean upsidedown)
|
||||
bool Image_WritePNG (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, bool upsidedown)
|
||||
{
|
||||
unsigned error;
|
||||
char pathname[MAX_OSPATH];
|
||||
|
|
|
@ -26,13 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//image.h -- image reading / writing
|
||||
|
||||
//be sure to free the hunk after using these loading functions
|
||||
byte *Image_LoadTGA (FILE *f, int *width, int *height);
|
||||
byte *Image_LoadPCX (FILE *f, int *width, int *height);
|
||||
byte *Image_LoadImage (const char *name, int *width, int *height);
|
||||
byte *Image_LoadTGA (FILE *f, int32_t *width, int32_t *height);
|
||||
byte *Image_LoadPCX (FILE *f, int32_t *width, int32_t *height);
|
||||
byte *Image_LoadImage (const char *name, int32_t *width, int32_t *height);
|
||||
|
||||
qboolean Image_WriteTGA (const char *name, byte *data, int width, int height, int bpp, qboolean upsidedown);
|
||||
qboolean Image_WritePNG (const char *name, byte *data, int width, int height, int bpp, qboolean upsidedown);
|
||||
qboolean Image_WriteJPG (const char *name, byte *data, int width, int height, int bpp, int quality, qboolean upsidedown);
|
||||
bool Image_WriteTGA (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, bool upsidedown);
|
||||
bool Image_WritePNG (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, bool upsidedown);
|
||||
bool Image_WriteJPG (const char *name, byte *data, int32_t width, int32_t height, int32_t bpp, int32_t quality, bool upsidedown);
|
||||
|
||||
#endif /* GL_IMAGE_H */
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "quakedef.h"
|
||||
#include <SDL.h>
|
||||
|
||||
static qboolean textmode;
|
||||
static bool textmode;
|
||||
|
||||
static cvar_t in_debugkeys = {"in_debugkeys", "0", CVAR_NONE};
|
||||
|
||||
|
@ -54,9 +54,9 @@ cvar_t joy_enable = { "joy_enable", "1", CVAR_ARCHIVE };
|
|||
static SDL_JoystickID joy_active_instaceid = -1;
|
||||
static SDL_GameController *joy_active_controller = NULL;
|
||||
|
||||
static qboolean no_mouse = false;
|
||||
static bool no_mouse = false;
|
||||
|
||||
static int buttonremap[] =
|
||||
static int32_t buttonremap[] =
|
||||
{
|
||||
K_MOUSE1,
|
||||
K_MOUSE3, /* right button */
|
||||
|
@ -66,9 +66,9 @@ static int buttonremap[] =
|
|||
};
|
||||
|
||||
/* total accumulated mouse movement since last frame */
|
||||
static int total_dx, total_dy = 0;
|
||||
static int32_t total_dx, total_dy = 0;
|
||||
|
||||
static int SDLCALL IN_FilterMouseEvents (const SDL_Event *event)
|
||||
static int32_t SDLCALL IN_FilterMouseEvents (const SDL_Event *event)
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ static int SDLCALL IN_FilterMouseEvents (const SDL_Event *event)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int SDLCALL IN_SDL2_FilterMouseEvents (void *userdata, SDL_Event *event)
|
||||
static int32_t SDLCALL IN_SDL2_FilterMouseEvents (void *userdata, SDL_Event *event)
|
||||
{
|
||||
(void)userdata;
|
||||
return IN_FilterMouseEvents (event);
|
||||
|
@ -197,7 +197,7 @@ void IN_Activate (void)
|
|||
total_dy = 0;
|
||||
}
|
||||
|
||||
void IN_Deactivate (qboolean free_cursor)
|
||||
void IN_Deactivate (bool free_cursor)
|
||||
{
|
||||
if (no_mouse)
|
||||
return;
|
||||
|
@ -218,8 +218,8 @@ void IN_Deactivate (qboolean free_cursor)
|
|||
|
||||
void IN_StartupJoystick (void)
|
||||
{
|
||||
int i;
|
||||
int nummappings;
|
||||
int32_t i;
|
||||
int32_t nummappings;
|
||||
char controllerdb[MAX_OSPATH];
|
||||
SDL_GameController *gamecontroller;
|
||||
|
||||
|
@ -236,7 +236,7 @@ void IN_StartupJoystick (void)
|
|||
q_snprintf (controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", com_basedir);
|
||||
nummappings = SDL_GameControllerAddMappingsFromFile(controllerdb);
|
||||
if (nummappings > 0)
|
||||
Con_Printf("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
|
||||
Con_Printf("%" PRIi32 " mappings loaded from gamecontrollerdb.txt\n", nummappings);
|
||||
|
||||
// Also try host_parms->userdir
|
||||
if (host_parms->userdir != host_parms->basedir)
|
||||
|
@ -244,7 +244,7 @@ void IN_StartupJoystick (void)
|
|||
q_snprintf (controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", host_parms->userdir);
|
||||
nummappings = SDL_GameControllerAddMappingsFromFile(controllerdb);
|
||||
if (nummappings > 0)
|
||||
Con_Printf("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
|
||||
Con_Printf("%" PRIi32 " mappings loaded from gamecontrollerdb.txt\n", nummappings);
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_NumJoysticks(); i++)
|
||||
|
@ -322,7 +322,7 @@ extern cvar_t cl_maxpitch; /* johnfitz -- variable pitch clamping */
|
|||
extern cvar_t cl_minpitch; /* johnfitz -- variable pitch clamping */
|
||||
|
||||
|
||||
void IN_MouseMotion(int dx, int dy)
|
||||
void IN_MouseMotion(int32_t dx, int32_t dy)
|
||||
{
|
||||
total_dx += dx;
|
||||
total_dy += dy;
|
||||
|
@ -336,7 +336,7 @@ typedef struct joyaxis_s
|
|||
|
||||
typedef struct joy_buttonstate_s
|
||||
{
|
||||
qboolean buttondown[SDL_CONTROLLER_BUTTON_MAX];
|
||||
bool buttondown[SDL_CONTROLLER_BUTTON_MAX];
|
||||
} joybuttonstate_t;
|
||||
|
||||
typedef struct axisstate_s
|
||||
|
@ -449,7 +449,7 @@ static joyaxis_t IN_ApplyDeadzone(joyaxis_t axis, float deadzone)
|
|||
IN_KeyForControllerButton
|
||||
================
|
||||
*/
|
||||
static int IN_KeyForControllerButton(SDL_GameControllerButton button)
|
||||
static int32_t IN_KeyForControllerButton(SDL_GameControllerButton button)
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
|
@ -481,7 +481,7 @@ and generates key repeats if the button is held down.
|
|||
Adapted from DarkPlaces by lordhavoc
|
||||
================
|
||||
*/
|
||||
static void IN_JoyKeyEvent(qboolean wasdown, qboolean isdown, int key, double *timer)
|
||||
static void IN_JoyKeyEvent(bool wasdown, bool isdown, int32_t key, double *timer)
|
||||
{
|
||||
// we can't use `realtime` for key repeats because it is not monotomic
|
||||
const double currenttime = Sys_DoubleTime();
|
||||
|
@ -522,7 +522,7 @@ Emit key events for game controller buttons, including emulated buttons for anal
|
|||
void IN_Commands (void)
|
||||
{
|
||||
joyaxisstate_t newaxisstate;
|
||||
int i;
|
||||
int32_t i;
|
||||
const float stickthreshold = 0.9;
|
||||
const float triggerthreshold = joy_deadzone_trigger.value;
|
||||
|
||||
|
@ -535,8 +535,8 @@ void IN_Commands (void)
|
|||
// emit key events for controller buttons
|
||||
for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++)
|
||||
{
|
||||
qboolean newstate = SDL_GameControllerGetButton(joy_active_controller, (SDL_GameControllerButton)i);
|
||||
qboolean oldstate = joy_buttonstate.buttondown[i];
|
||||
bool newstate = SDL_GameControllerGetButton(joy_active_controller, (SDL_GameControllerButton)i);
|
||||
bool oldstate = joy_buttonstate.buttondown[i];
|
||||
|
||||
joy_buttonstate.buttondown[i] = newstate;
|
||||
|
||||
|
@ -627,7 +627,7 @@ void IN_JoyMove (usercmd_t *cmd)
|
|||
|
||||
void IN_MouseMove(usercmd_t *cmd)
|
||||
{
|
||||
int dmx, dmy;
|
||||
int32_t dmx, dmy;
|
||||
|
||||
dmx = total_dx * sensitivity.value;
|
||||
dmy = total_dy * sensitivity.value;
|
||||
|
@ -676,7 +676,7 @@ void IN_ClearStates (void)
|
|||
|
||||
void IN_UpdateInputMode (void)
|
||||
{
|
||||
qboolean want_textmode = Key_TextEntry();
|
||||
bool want_textmode = Key_TextEntry();
|
||||
if (textmode != want_textmode)
|
||||
{
|
||||
textmode = want_textmode;
|
||||
|
@ -695,7 +695,7 @@ void IN_UpdateInputMode (void)
|
|||
}
|
||||
}
|
||||
|
||||
static inline int IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode)
|
||||
static inline int32_t IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode)
|
||||
{
|
||||
switch (scancode)
|
||||
{
|
||||
|
@ -834,8 +834,8 @@ static void IN_DebugKeyEvent(SDL_Event *event)
|
|||
void IN_SendKeyEvents (void)
|
||||
{
|
||||
SDL_Event event;
|
||||
int key;
|
||||
qboolean down;
|
||||
int32_t key;
|
||||
bool down;
|
||||
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
|
@ -881,7 +881,7 @@ void IN_SendKeyEvents (void)
|
|||
if (event.button.button < 1 ||
|
||||
event.button.button > sizeof(buttonremap) / sizeof(buttonremap[0]))
|
||||
{
|
||||
Con_Printf ("Ignored event for mouse button %d\n",
|
||||
Con_Printf ("Ignored event for mouse button %" PRIi32 "\n",
|
||||
event.button.button);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ void IN_Commands (void);
|
|||
// oportunity for devices to stick commands on the script buffer
|
||||
|
||||
// mouse moved by dx and dy pixels
|
||||
void IN_MouseMotion(int dx, int dy);
|
||||
void IN_MouseMotion(int32_t dx, int32_t dy);
|
||||
|
||||
|
||||
void IN_SendKeyEvents (void);
|
||||
|
@ -51,7 +51,7 @@ void IN_ClearStates (void);
|
|||
void IN_Activate ();
|
||||
|
||||
// called when the app becomes inactive
|
||||
void IN_Deactivate (qboolean free_cursor);
|
||||
void IN_Deactivate (bool free_cursor);
|
||||
|
||||
#endif /* _QUAKE_INPUT_H */
|
||||
|
||||
|
|
|
@ -30,24 +30,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
char key_lines[CMDLINES][MAXCMDLINE];
|
||||
|
||||
int key_linepos;
|
||||
int key_insert; //johnfitz -- insert key toggle (for editing)
|
||||
int32_t key_linepos;
|
||||
int32_t key_insert; //johnfitz -- insert key toggle (for editing)
|
||||
double key_blinktime; //johnfitz -- fudge cursor blinking to make it easier to spot in certain cases
|
||||
|
||||
int edit_line = 0;
|
||||
int history_line = 0;
|
||||
int32_t edit_line = 0;
|
||||
int32_t history_line = 0;
|
||||
|
||||
keydest_t key_dest;
|
||||
|
||||
char *keybindings[MAX_KEYS];
|
||||
qboolean consolekeys[MAX_KEYS]; // if true, can't be rebound while in console
|
||||
qboolean menubound[MAX_KEYS]; // if true, can't be rebound while in menu
|
||||
qboolean keydown[MAX_KEYS];
|
||||
bool consolekeys[MAX_KEYS]; // if true, can't be rebound while in console
|
||||
bool menubound[MAX_KEYS]; // if true, can't be rebound while in menu
|
||||
bool keydown[MAX_KEYS];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
int keynum;
|
||||
int32_t keynum;
|
||||
} keyname_t;
|
||||
|
||||
keyname_t keynames[] =
|
||||
|
@ -185,7 +185,7 @@ keyname_t keynames[] =
|
|||
static void PasteToConsole (void)
|
||||
{
|
||||
char *cbd, *p, *workline;
|
||||
int mvlen, inslen;
|
||||
int32_t mvlen, inslen;
|
||||
|
||||
if (key_linepos == MAXCMDLINE - 1)
|
||||
return;
|
||||
|
@ -204,14 +204,14 @@ static void PasteToConsole (void)
|
|||
p++;
|
||||
}
|
||||
|
||||
inslen = (int) (p - cbd);
|
||||
inslen = (int32_t) (p - cbd);
|
||||
if (inslen + key_linepos > MAXCMDLINE - 1)
|
||||
inslen = MAXCMDLINE - 1 - key_linepos;
|
||||
if (inslen <= 0) goto done;
|
||||
|
||||
workline = key_lines[edit_line];
|
||||
workline += key_linepos;
|
||||
mvlen = (int) strlen(workline);
|
||||
mvlen = (int32_t) strlen(workline);
|
||||
if (mvlen + inslen + key_linepos > MAXCMDLINE - 1)
|
||||
{
|
||||
mvlen = MAXCMDLINE - 1 - key_linepos - inslen;
|
||||
|
@ -236,12 +236,12 @@ Interactive line editing and console scrollback
|
|||
====================
|
||||
*/
|
||||
extern char *con_text, key_tabpartial[MAXCMDLINE];
|
||||
extern int con_current, con_linewidth, con_vislines;
|
||||
extern int32_t con_current, con_linewidth, con_vislines;
|
||||
|
||||
void Key_Console (int key)
|
||||
void Key_Console (int32_t key)
|
||||
{
|
||||
static char current[MAXCMDLINE] = "";
|
||||
int history_line_last;
|
||||
int32_t history_line_last;
|
||||
size_t len;
|
||||
char *workline = key_lines[edit_line];
|
||||
|
||||
|
@ -304,7 +304,7 @@ void Key_Console (int key)
|
|||
if (keydown[K_CTRL])
|
||||
{
|
||||
//skip initial empty lines
|
||||
int i, x;
|
||||
int32_t i, x;
|
||||
char *line;
|
||||
|
||||
for (i = con_current - con_totallines + 1; i <= con_current; i++)
|
||||
|
@ -353,10 +353,10 @@ void Key_Console (int key)
|
|||
|
||||
case K_RIGHTARROW:
|
||||
len = strlen(workline);
|
||||
if ((int)len == key_linepos)
|
||||
if ((int32_t)len == key_linepos)
|
||||
{
|
||||
len = strlen(key_lines[(edit_line + 31) & 31]);
|
||||
if ((int)len <= key_linepos)
|
||||
if ((int32_t)len <= key_linepos)
|
||||
return; // no character to get
|
||||
workline += key_linepos;
|
||||
*workline = key_lines[(edit_line + 31) & 31][key_linepos];
|
||||
|
@ -442,14 +442,14 @@ void Key_Console (int key)
|
|||
}
|
||||
}
|
||||
|
||||
void Char_Console (int key)
|
||||
void Char_Console (int32_t key)
|
||||
{
|
||||
size_t len;
|
||||
char *workline = key_lines[edit_line];
|
||||
|
||||
if (key_linepos < MAXCMDLINE-1)
|
||||
{
|
||||
qboolean endpos = !workline[key_linepos];
|
||||
bool endpos = !workline[key_linepos];
|
||||
|
||||
key_tabpartial[0] = 0; //johnfitz
|
||||
// if inserting, move the text to the right
|
||||
|
@ -475,16 +475,16 @@ void Char_Console (int key)
|
|||
|
||||
//============================================================================
|
||||
|
||||
qboolean chat_team = false;
|
||||
bool chat_team = false;
|
||||
static char chat_buffer[MAXCMDLINE];
|
||||
static int chat_bufferlen = 0;
|
||||
static int32_t chat_bufferlen = 0;
|
||||
|
||||
const char *Key_GetChatBuffer (void)
|
||||
{
|
||||
return chat_buffer;
|
||||
}
|
||||
|
||||
int Key_GetChatMsgLen (void)
|
||||
int32_t Key_GetChatMsgLen (void)
|
||||
{
|
||||
return chat_bufferlen;
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ void Key_EndChat (void)
|
|||
chat_buffer[0] = 0;
|
||||
}
|
||||
|
||||
void Key_Message (int key)
|
||||
void Key_Message (int32_t key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -523,7 +523,7 @@ void Key_Message (int key)
|
|||
}
|
||||
}
|
||||
|
||||
void Char_Message (int key)
|
||||
void Char_Message (int32_t key)
|
||||
{
|
||||
if (chat_bufferlen == sizeof(chat_buffer) - 1)
|
||||
return; // all full
|
||||
|
@ -544,7 +544,7 @@ the given string. Single ascii characters return themselves, while
|
|||
the K_* names are matched up.
|
||||
===================
|
||||
*/
|
||||
int Key_StringToKeynum (const char *str)
|
||||
int32_t Key_StringToKeynum (const char *str)
|
||||
{
|
||||
keyname_t *kn;
|
||||
|
||||
|
@ -570,7 +570,7 @@ given keynum.
|
|||
FIXME: handle quote special (general escape sequence?)
|
||||
===================
|
||||
*/
|
||||
const char *Key_KeynumToString (int keynum)
|
||||
const char *Key_KeynumToString (int32_t keynum)
|
||||
{
|
||||
static char tinystr[2];
|
||||
keyname_t *kn;
|
||||
|
@ -599,7 +599,7 @@ const char *Key_KeynumToString (int keynum)
|
|||
Key_SetBinding
|
||||
===================
|
||||
*/
|
||||
void Key_SetBinding (int keynum, const char *binding)
|
||||
void Key_SetBinding (int32_t keynum, const char *binding)
|
||||
{
|
||||
if (keynum == -1)
|
||||
return;
|
||||
|
@ -623,7 +623,7 @@ Key_Unbind_f
|
|||
*/
|
||||
void Key_Unbind_f (void)
|
||||
{
|
||||
int b;
|
||||
int32_t b;
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
{
|
||||
|
@ -643,7 +643,7 @@ void Key_Unbind_f (void)
|
|||
|
||||
void Key_Unbindall_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < MAX_KEYS; i++)
|
||||
{
|
||||
|
@ -659,7 +659,7 @@ Key_Bindlist_f -- johnfitz
|
|||
*/
|
||||
void Key_Bindlist_f (void)
|
||||
{
|
||||
int i, count;
|
||||
int32_t i, count;
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < MAX_KEYS; i++)
|
||||
|
@ -670,7 +670,7 @@ void Key_Bindlist_f (void)
|
|||
count++;
|
||||
}
|
||||
}
|
||||
Con_SafePrintf ("%i bindings\n", count);
|
||||
Con_SafePrintf ("%" PRIi32 " bindings\n", count);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -680,7 +680,7 @@ Key_Bind_f
|
|||
*/
|
||||
void Key_Bind_f (void)
|
||||
{
|
||||
int i, c, b;
|
||||
int32_t i, c, b;
|
||||
char cmd[1024];
|
||||
|
||||
c = Cmd_Argc();
|
||||
|
@ -727,7 +727,7 @@ Writes lines containing "bind key value"
|
|||
*/
|
||||
void Key_WriteBindings (FILE *f)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// unbindall before loading stored bindings:
|
||||
if (cfg_unbindall.value)
|
||||
|
@ -742,7 +742,7 @@ void Key_WriteBindings (FILE *f)
|
|||
|
||||
void History_Init (void)
|
||||
{
|
||||
int i, c;
|
||||
int32_t i, c;
|
||||
FILE *hf;
|
||||
|
||||
for (i = 0; i < CMDLINES; i++)
|
||||
|
@ -786,7 +786,7 @@ void History_Init (void)
|
|||
|
||||
void History_Shutdown (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
FILE *hf;
|
||||
|
||||
hf = fopen(va("%s/%s", host_parms->userdir, HISTORY_FILE_NAME), "wt");
|
||||
|
@ -814,7 +814,7 @@ Key_Init
|
|||
*/
|
||||
void Key_Init (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
History_Init ();
|
||||
|
||||
|
@ -883,9 +883,9 @@ void Key_Init (void)
|
|||
}
|
||||
|
||||
static struct {
|
||||
qboolean active;
|
||||
int lastkey;
|
||||
int lastchar;
|
||||
bool active;
|
||||
int32_t lastkey;
|
||||
int32_t lastchar;
|
||||
} key_inputgrab = { false, -1, -1 };
|
||||
|
||||
/*
|
||||
|
@ -923,7 +923,7 @@ void Key_EndInputGrab (void)
|
|||
Key_GetGrabbedInput
|
||||
===================
|
||||
*/
|
||||
void Key_GetGrabbedInput (int *lastkey, int *lastchar)
|
||||
void Key_GetGrabbedInput (int32_t *lastkey, int32_t *lastchar)
|
||||
{
|
||||
if (lastkey)
|
||||
*lastkey = key_inputgrab.lastkey;
|
||||
|
@ -939,7 +939,7 @@ Called by the system between frames for both key up and key down events
|
|||
Should NOT be called during an interrupt!
|
||||
===================
|
||||
*/
|
||||
void Key_Event (int key, qboolean down)
|
||||
void Key_Event (int32_t key, bool down)
|
||||
{
|
||||
char *kb;
|
||||
char cmd[1024];
|
||||
|
@ -1018,7 +1018,7 @@ void Key_Event (int key, qboolean down)
|
|||
kb = keybindings[key];
|
||||
if (kb && kb[0] == '+')
|
||||
{
|
||||
sprintf (cmd, "-%s %i\n", kb+1, key);
|
||||
sprintf (cmd, "-%s %" PRIi32 "\n", kb+1, key);
|
||||
Cbuf_AddText (cmd);
|
||||
}
|
||||
return;
|
||||
|
@ -1041,7 +1041,7 @@ void Key_Event (int key, qboolean down)
|
|||
{
|
||||
if (kb[0] == '+')
|
||||
{ // button commands add keynum as a parm
|
||||
sprintf (cmd, "%s %i\n", kb, key);
|
||||
sprintf (cmd, "%s %" PRIi32 "\n", kb, key);
|
||||
Cbuf_AddText (cmd);
|
||||
}
|
||||
else
|
||||
|
@ -1081,7 +1081,7 @@ Char_Event
|
|||
Called by the backend when the user has input a character.
|
||||
===================
|
||||
*/
|
||||
void Char_Event (int key)
|
||||
void Char_Event (int32_t key)
|
||||
{
|
||||
if (key < 32 || key > 126)
|
||||
return;
|
||||
|
@ -1124,7 +1124,7 @@ void Char_Event (int key)
|
|||
Key_TextEntry
|
||||
===================
|
||||
*/
|
||||
qboolean Key_TextEntry (void)
|
||||
bool Key_TextEntry (void)
|
||||
{
|
||||
if (key_inputgrab.active)
|
||||
return true;
|
||||
|
@ -1153,7 +1153,7 @@ Key_ClearStates
|
|||
*/
|
||||
void Key_ClearStates (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < MAX_KEYS; i++)
|
||||
{
|
||||
|
@ -1169,7 +1169,7 @@ Key_UpdateForDest
|
|||
*/
|
||||
void Key_UpdateForDest (void)
|
||||
{
|
||||
static qboolean forced = false;
|
||||
static bool forced = false;
|
||||
|
||||
if (cls.state == ca_dedicated)
|
||||
return;
|
||||
|
|
|
@ -166,12 +166,12 @@ extern char *keybindings[MAX_KEYS];
|
|||
#define CMDLINES 64
|
||||
|
||||
extern char key_lines[CMDLINES][MAXCMDLINE];
|
||||
extern int edit_line;
|
||||
extern int key_linepos;
|
||||
extern int key_insert;
|
||||
extern int32_t edit_line;
|
||||
extern int32_t key_linepos;
|
||||
extern int32_t key_insert;
|
||||
extern double key_blinktime;
|
||||
|
||||
extern qboolean chat_team;
|
||||
extern bool chat_team;
|
||||
|
||||
void Key_Init (void);
|
||||
void Key_ClearStates (void);
|
||||
|
@ -179,19 +179,19 @@ void Key_UpdateForDest (void);
|
|||
|
||||
void Key_BeginInputGrab (void);
|
||||
void Key_EndInputGrab (void);
|
||||
void Key_GetGrabbedInput (int *lastkey, int *lastchar);
|
||||
void Key_GetGrabbedInput (int32_t *lastkey, int32_t *lastchar);
|
||||
|
||||
void Key_Event (int key, qboolean down);
|
||||
void Char_Event (int key);
|
||||
qboolean Key_TextEntry (void);
|
||||
void Key_Event (int32_t key, bool down);
|
||||
void Char_Event (int32_t key);
|
||||
bool Key_TextEntry (void);
|
||||
|
||||
void Key_SetBinding (int keynum, const char *binding);
|
||||
const char *Key_KeynumToString (int keynum);
|
||||
void Key_SetBinding (int32_t keynum, const char *binding);
|
||||
const char *Key_KeynumToString (int32_t keynum);
|
||||
void Key_WriteBindings (FILE *f);
|
||||
|
||||
void Key_EndChat (void);
|
||||
const char *Key_GetChatBuffer (void);
|
||||
int Key_GetChatMsgLen (void);
|
||||
int32_t Key_GetChatMsgLen (void);
|
||||
|
||||
void History_Init (void);
|
||||
void History_Shutdown (void);
|
||||
|
|
|
@ -673,10 +673,10 @@ Jyrki Katajainen, Alistair Moffat, Andrew Turpin, 1995.*/
|
|||
/*chain node for boundary package merge*/
|
||||
typedef struct BPMNode
|
||||
{
|
||||
int weight; /*the sum of all weights in this chain*/
|
||||
int32_t weight; /*the sum of all weights in this chain*/
|
||||
unsigned index; /*index of this leaf node (called "count" in the paper)*/
|
||||
struct BPMNode* tail; /*the next nodes in this chain (null if last)*/
|
||||
int in_use;
|
||||
int32_t in_use;
|
||||
} BPMNode;
|
||||
|
||||
/*lists of chains*/
|
||||
|
@ -695,7 +695,7 @@ typedef struct BPMLists
|
|||
} BPMLists;
|
||||
|
||||
/*creates a new chain node with the given parameters, from the memory in the lists */
|
||||
static BPMNode* bpmnode_create(BPMLists* lists, int weight, unsigned index, BPMNode* tail)
|
||||
static BPMNode* bpmnode_create(BPMLists* lists, int32_t weight, unsigned index, BPMNode* tail)
|
||||
{
|
||||
unsigned i;
|
||||
BPMNode* result;
|
||||
|
@ -755,7 +755,7 @@ static void bpmnode_sort(BPMNode* leaves, size_t num)
|
|||
}
|
||||
|
||||
/*Boundary Package Merge step, numpresent is the amount of leaves, and c is the current chain.*/
|
||||
static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int c, int num)
|
||||
static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int32_t c, int32_t num)
|
||||
{
|
||||
unsigned lastindex = lists->chains1[c]->index;
|
||||
|
||||
|
@ -768,7 +768,7 @@ static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int
|
|||
else
|
||||
{
|
||||
/*sum of the weights of the head nodes of the previous lookahead chains.*/
|
||||
int sum = lists->chains0[c - 1]->weight + lists->chains1[c - 1]->weight;
|
||||
int32_t sum = lists->chains0[c - 1]->weight + lists->chains1[c - 1]->weight;
|
||||
lists->chains0[c] = lists->chains1[c];
|
||||
if(lastindex < numpresent && sum > leaves[lastindex].weight)
|
||||
{
|
||||
|
@ -778,7 +778,7 @@ static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int
|
|||
lists->chains1[c] = bpmnode_create(lists, sum, lastindex, lists->chains1[c - 1]);
|
||||
/*in the end we are only interested in the chain of the last list, so no
|
||||
need to recurse if we're at the last one (this gives measurable speedup)*/
|
||||
if(num + 1 < (int)(2 * numpresent - 2))
|
||||
if(num + 1 < (int32_t)(2 * numpresent - 2))
|
||||
{
|
||||
boundaryPM(lists, leaves, numpresent, c - 1, num);
|
||||
boundaryPM(lists, leaves, numpresent, c - 1, num);
|
||||
|
@ -804,7 +804,7 @@ unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequen
|
|||
{
|
||||
if(frequencies[i] > 0)
|
||||
{
|
||||
leaves[numpresent].weight = (int)frequencies[i];
|
||||
leaves[numpresent].weight = (int32_t)frequencies[i];
|
||||
leaves[numpresent].index = i;
|
||||
++numpresent;
|
||||
}
|
||||
|
@ -857,7 +857,7 @@ unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequen
|
|||
}
|
||||
|
||||
/*each boundaryPM call adds one chain to the last list, and we need 2 * numpresent - 2 chains.*/
|
||||
for(i = 2; i != 2 * numpresent - 2; ++i) boundaryPM(&lists, leaves, numpresent, (int)maxbitlen - 1, (int)i);
|
||||
for(i = 2; i != 2 * numpresent - 2; ++i) boundaryPM(&lists, leaves, numpresent, (int32_t)maxbitlen - 1, (int32_t)i);
|
||||
|
||||
for(node = lists.chains1[maxbitlen - 1]; node; node = node->tail)
|
||||
{
|
||||
|
@ -1366,14 +1366,14 @@ static const unsigned HASH_BIT_MASK = 65535; /*HASH_NUM_VALUES - 1, but C90 does
|
|||
|
||||
typedef struct Hash
|
||||
{
|
||||
int* head; /*hash value to head circular pos - can be outdated if went around window*/
|
||||
int32_t* head; /*hash value to head circular pos - can be outdated if went around window*/
|
||||
/*circular pos to prev circular pos*/
|
||||
uint16_t* chain;
|
||||
int* val; /*circular pos to hash value*/
|
||||
int32_t* val; /*circular pos to hash value*/
|
||||
|
||||
/*TODO: do this not only for zeros but for any repeated byte. However for PNG
|
||||
it's always going to be the zeros that dominate, so not important for PNG*/
|
||||
int* headz; /*similar to head, but for chainz*/
|
||||
int32_t* headz; /*similar to head, but for chainz*/
|
||||
uint16_t* chainz; /*those with same amount of zeros*/
|
||||
uint16_t* zeros; /*length of zeros streak, used as a second hash chain*/
|
||||
} Hash;
|
||||
|
@ -1381,12 +1381,12 @@ typedef struct Hash
|
|||
static unsigned hash_init(Hash* hash, unsigned windowsize)
|
||||
{
|
||||
unsigned i;
|
||||
hash->head = (int*)lodepng_malloc(sizeof(int) * HASH_NUM_VALUES);
|
||||
hash->val = (int*)lodepng_malloc(sizeof(int) * windowsize);
|
||||
hash->head = (int32_t*)lodepng_malloc(sizeof(int32_t) * HASH_NUM_VALUES);
|
||||
hash->val = (int32_t*)lodepng_malloc(sizeof(int32_t) * windowsize);
|
||||
hash->chain = (uint16_t*)lodepng_malloc(sizeof(uint16_t) * windowsize);
|
||||
|
||||
hash->zeros = (uint16_t*)lodepng_malloc(sizeof(uint16_t) * windowsize);
|
||||
hash->headz = (int*)lodepng_malloc(sizeof(int) * (MAX_SUPPORTED_DEFLATE_LENGTH + 1));
|
||||
hash->headz = (int32_t*)lodepng_malloc(sizeof(int32_t) * (MAX_SUPPORTED_DEFLATE_LENGTH + 1));
|
||||
hash->chainz = (uint16_t*)lodepng_malloc(sizeof(uint16_t) * windowsize);
|
||||
|
||||
if(!hash->head || !hash->chain || !hash->val || !hash->headz|| !hash->chainz || !hash->zeros)
|
||||
|
@ -1453,7 +1453,7 @@ static unsigned countZeros(const uint8_t* data, size_t size, size_t pos)
|
|||
/*wpos = pos & (windowsize - 1)*/
|
||||
static void updateHashChain(Hash* hash, size_t wpos, unsigned hashval, uint16_t numzeros)
|
||||
{
|
||||
hash->val[wpos] = (int)hashval;
|
||||
hash->val[wpos] = (int32_t)hashval;
|
||||
if(hash->head[hashval] != -1) hash->chain[wpos] = hash->head[hashval];
|
||||
hash->head[hashval] = wpos;
|
||||
|
||||
|
@ -1578,7 +1578,7 @@ static unsigned encodeLZ77(uivector* out, Hash* hash,
|
|||
{
|
||||
hashpos = hash->chain[hashpos];
|
||||
/*outdated hash value, happens if particular value was not encountered in whole last window*/
|
||||
if(hash->val[hashpos] != (int)hashval) break;
|
||||
if(hash->val[hashpos] != (int32_t)hashval) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1746,7 +1746,7 @@ static unsigned deflateDynamic(ucvector* out, size_t* bp, Hash* hash,
|
|||
uivector frequencies_ll; /*frequency of lit,len codes*/
|
||||
uivector frequencies_d; /*frequency of dist codes*/
|
||||
uivector frequencies_cl; /*frequency of code length codes*/
|
||||
uivector bitlen_lld; /*lit,len,dist code lenghts (int bits), literally (without repeat codes).*/
|
||||
uivector bitlen_lld; /*lit,len,dist code lenghts (int32_t bits), literally (without repeat codes).*/
|
||||
uivector bitlen_lld_e; /*bitlen_lld encoded with repeat codes (this is a rudemtary run length compression)*/
|
||||
/*bitlen_cl is the code length code lengths ("clcl"). The bit lengths of codes to represent tree_cl
|
||||
(these are written as is in the file, it would be crazy to compress these using yet another huffman
|
||||
|
@ -2609,7 +2609,7 @@ unsigned lodepng_color_mode_copy(LodePNGColorMode* dest, const LodePNGColorMode*
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColorMode* b)
|
||||
static int32_t lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColorMode* b)
|
||||
{
|
||||
size_t i;
|
||||
if(a->colortype != b->colortype) return 0;
|
||||
|
@ -2980,19 +2980,19 @@ node has 16 instead of 8 children.
|
|||
struct ColorTree
|
||||
{
|
||||
ColorTree* children[16]; /*up to 16 pointers to ColorTree of next level*/
|
||||
int index; /*the payload. Only has a meaningful value if this is in the last level*/
|
||||
int32_t index; /*the payload. Only has a meaningful value if this is in the last level*/
|
||||
};
|
||||
|
||||
static void color_tree_init(ColorTree* tree)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for(i = 0; i != 16; ++i) tree->children[i] = 0;
|
||||
tree->index = -1;
|
||||
}
|
||||
|
||||
static void color_tree_cleanup(ColorTree* tree)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for(i = 0; i != 16; ++i)
|
||||
{
|
||||
if(tree->children[i])
|
||||
|
@ -3004,12 +3004,12 @@ static void color_tree_cleanup(ColorTree* tree)
|
|||
}
|
||||
|
||||
/*returns -1 if color not present, its index otherwise*/
|
||||
static int color_tree_get(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
static int32_t color_tree_get(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
{
|
||||
int bit = 0;
|
||||
int32_t bit = 0;
|
||||
for(bit = 0; bit < 8; ++bit)
|
||||
{
|
||||
int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1);
|
||||
int32_t i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1);
|
||||
if(!tree->children[i]) return -1;
|
||||
else tree = tree->children[i];
|
||||
}
|
||||
|
@ -3017,7 +3017,7 @@ static int color_tree_get(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint
|
|||
}
|
||||
|
||||
#ifdef LODEPNG_COMPILE_ENCODER
|
||||
static int color_tree_has(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
static int32_t color_tree_has(ColorTree* tree, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
{
|
||||
return color_tree_get(tree, r, g, b, a) >= 0;
|
||||
}
|
||||
|
@ -3028,10 +3028,10 @@ Index should be >= 0 (it's signed to be compatible with using -1 for "doesn't ex
|
|||
static void color_tree_add(ColorTree* tree,
|
||||
uint8_t r, uint8_t g, uint8_t b, uint8_t a, unsigned index)
|
||||
{
|
||||
int bit;
|
||||
int32_t bit;
|
||||
for(bit = 0; bit < 8; ++bit)
|
||||
{
|
||||
int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1);
|
||||
int32_t i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1);
|
||||
if(!tree->children[i])
|
||||
{
|
||||
tree->children[i] = (ColorTree*)lodepng_malloc(sizeof(ColorTree));
|
||||
|
@ -3039,7 +3039,7 @@ static void color_tree_add(ColorTree* tree,
|
|||
}
|
||||
tree = tree->children[i];
|
||||
}
|
||||
tree->index = (int)index;
|
||||
tree->index = (int32_t)index;
|
||||
}
|
||||
|
||||
/*put a pixel, given its RGBA color, into image of any color type*/
|
||||
|
@ -3076,7 +3076,7 @@ static unsigned rgba8ToPixel(uint8_t* out, size_t i,
|
|||
}
|
||||
else if(mode->colortype == LCT_PALETTE)
|
||||
{
|
||||
int index = color_tree_get(tree, r, g, b, a);
|
||||
int32_t index = color_tree_get(tree, r, g, b, a);
|
||||
if(index < 0) return 82; /*color not in palette*/
|
||||
if(mode->bitdepth == 8) out[i] = index;
|
||||
else addColorBits(out, i, mode->bitdepth, (unsigned)index);
|
||||
|
@ -3534,14 +3534,14 @@ void lodepng_color_profile_init(LodePNGColorProfile* profile)
|
|||
/*function used for debug purposes with C++*/
|
||||
/*void printColorProfile(LodePNGColorProfile* p)
|
||||
{
|
||||
std::cout << "colored: " << (int)p->colored << ", ";
|
||||
std::cout << "key: " << (int)p->key << ", ";
|
||||
std::cout << "key_r: " << (int)p->key_r << ", ";
|
||||
std::cout << "key_g: " << (int)p->key_g << ", ";
|
||||
std::cout << "key_b: " << (int)p->key_b << ", ";
|
||||
std::cout << "alpha: " << (int)p->alpha << ", ";
|
||||
std::cout << "numcolors: " << (int)p->numcolors << ", ";
|
||||
std::cout << "bits: " << (int)p->bits << std::endl;
|
||||
std::cout << "colored: " << (int32_t)p->colored << ", ";
|
||||
std::cout << "key: " << (int32_t)p->key << ", ";
|
||||
std::cout << "key_r: " << (int32_t)p->key_r << ", ";
|
||||
std::cout << "key_g: " << (int32_t)p->key_g << ", ";
|
||||
std::cout << "key_b: " << (int32_t)p->key_b << ", ";
|
||||
std::cout << "alpha: " << (int32_t)p->alpha << ", ";
|
||||
std::cout << "numcolors: " << (int32_t)p->numcolors << ", ";
|
||||
std::cout << "bits: " << (int32_t)p->bits << std::endl;
|
||||
}*/
|
||||
|
||||
/*Returns how many bits needed to represent given value (max 8 bit)*/
|
||||
|
|
|
@ -1524,7 +1524,7 @@ examples can be found on the LodePNG website.
|
|||
#include "lodepng.h"
|
||||
#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";
|
||||
|
||||
|
@ -1544,7 +1544,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
#include "lodepng.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int32_t main(int32_t argc, char *argv[])
|
||||
{
|
||||
unsigned error;
|
||||
uint8_t* image;
|
||||
|
@ -1553,7 +1553,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
error = lodepng_decode32_file(&image, &width, &height, filename);
|
||||
|
||||
if(error) printf("decoder error %u: %s\n", error, lodepng_error_text(error));
|
||||
if(error) printf("decoder error %" PRIu32 ": %s\n", error, lodepng_error_text(error));
|
||||
|
||||
/ * use image here * /
|
||||
|
||||
|
@ -1689,7 +1689,7 @@ symbol.
|
|||
C++ wrapper around this provides an interface almost identical to before.
|
||||
Having LodePNG be pure ISO C90 makes it more portable. The C and C++ code
|
||||
are together in these files but it works both for C and C++ compilers.
|
||||
*) 29 dec 2007: (!) changed most integer types to unsigned int + other tweaks
|
||||
*) 29 dec 2007: (!) changed most integer types to unsigned int32_t + other tweaks
|
||||
*) 30 aug 2007: bug fixed which makes this Borland C++ compatible
|
||||
*) 09 aug 2007: some VS2005 warnings removed again
|
||||
*) 21 jul 2007: deflate code placed in new namespace separate from zlib code
|
||||
|
|
|
@ -43,15 +43,15 @@ static void Sys_InitSDL (void)
|
|||
SDL_version *sdl_version = &v;
|
||||
SDL_GetVersion(&v);
|
||||
|
||||
Sys_Printf("Found SDL version %i.%i.%i\n",sdl_version->major,sdl_version->minor,sdl_version->patch);
|
||||
Sys_Printf("Found SDL version %" PRIi32 ".%" PRIi32 ".%" PRIi32 "\n",sdl_version->major,sdl_version->minor,sdl_version->patch);
|
||||
if (SDL_VERSIONNUM(sdl_version->major,sdl_version->minor,sdl_version->patch) < SDL_REQUIREDVERSION)
|
||||
{ /*reject running under older SDL versions */
|
||||
Sys_Error("You need at least v%d.%d.%d of SDL to run this game.", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
|
||||
Sys_Error("You need at least v%" PRIi32 ".%" PRIi32 ".%" PRIi32 " of SDL to run this game.", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
|
||||
}
|
||||
if (SDL_VERSIONNUM(sdl_version->major,sdl_version->minor,sdl_version->patch) >= SDL_NEW_VERSION_REJECT)
|
||||
{ /*reject running under newer (1.3.x) SDL */
|
||||
Sys_Error("Your version of SDL library is incompatible with me.\n"
|
||||
"You need a library version in the line of %d.%d.%d\n", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
|
||||
"You need a library version in the line of %" PRIi32 ".%" PRIi32 ".%" PRIi32 "\n", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
|
||||
}
|
||||
|
||||
if (SDL_Init(0) < 0)
|
||||
|
@ -71,9 +71,9 @@ static quakeparms_t parms;
|
|||
#define main SDL_main
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int32_t main(int32_t argc, char *argv[])
|
||||
{
|
||||
int t;
|
||||
int32_t t;
|
||||
double time, oldtime, newtime;
|
||||
|
||||
host_parms = &parms;
|
||||
|
|
|
@ -56,8 +56,8 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
|
|||
*/
|
||||
void PerpendicularVector( vec3_t dst, const vec3_t src )
|
||||
{
|
||||
int pos;
|
||||
int i;
|
||||
int32_t pos;
|
||||
int32_t i;
|
||||
float minelem = 1.0F;
|
||||
vec3_t tempvec;
|
||||
|
||||
|
@ -95,11 +95,11 @@ float anglemod(float a)
|
|||
{
|
||||
#if 0
|
||||
if (a >= 0)
|
||||
a -= 360*(int)(a/360);
|
||||
a -= 360*(int32_t)(a/360);
|
||||
else
|
||||
a += 360*( 1 + (int)(-a/360) );
|
||||
a += 360*( 1 + (int32_t)(-a/360) );
|
||||
#endif
|
||||
a = (360.0/65536) * ((int)(a*(65536/360.0)) & 65535);
|
||||
a = (360.0/65536) * ((int32_t)(a*(65536/360.0)) & 65535);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
@ -111,10 +111,10 @@ BoxOnPlaneSide
|
|||
Returns 1, 2, or 1 + 2
|
||||
==================
|
||||
*/
|
||||
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p)
|
||||
int32_t BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p)
|
||||
{
|
||||
float dist1, dist2;
|
||||
int sides;
|
||||
int32_t sides;
|
||||
|
||||
#if 0 // this is done by the BOX_ON_PLANE_SIDE macro before calling this
|
||||
// function
|
||||
|
@ -171,7 +171,7 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p)
|
|||
}
|
||||
|
||||
#if 0
|
||||
int i;
|
||||
int32_t i;
|
||||
vec3_t corners[2];
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
|
@ -250,9 +250,9 @@ void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
|
|||
up[2] = cr*cp;
|
||||
}
|
||||
|
||||
int VectorCompare (vec3_t v1, vec3_t v2)
|
||||
int32_t VectorCompare (vec3_t v1, vec3_t v2)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
if (v1[i] != v2[i])
|
||||
|
@ -340,9 +340,9 @@ void VectorScale (vec3_t in, vec_t scale, vec3_t out)
|
|||
}
|
||||
|
||||
|
||||
int Q_log2(int val)
|
||||
int32_t Q_log2(int32_t val)
|
||||
{
|
||||
int answer=0;
|
||||
int32_t answer=0;
|
||||
while (val>>=1)
|
||||
answer++;
|
||||
return answer;
|
||||
|
@ -421,10 +421,10 @@ quotient must fit in 32 bits.
|
|||
====================
|
||||
*/
|
||||
|
||||
void FloorDivMod (double numer, double denom, int *quotient,
|
||||
int *rem)
|
||||
void FloorDivMod (double numer, double denom, int32_t *quotient,
|
||||
int32_t *rem)
|
||||
{
|
||||
int q, r;
|
||||
int32_t q, r;
|
||||
double x;
|
||||
|
||||
#ifndef PARANOID
|
||||
|
@ -440,8 +440,8 @@ void FloorDivMod (double numer, double denom, int *quotient,
|
|||
{
|
||||
|
||||
x = floor(numer / denom);
|
||||
q = (int)x;
|
||||
r = (int)floor(numer - (x * denom));
|
||||
q = (int32_t)x;
|
||||
r = (int32_t)floor(numer - (x * denom));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -449,12 +449,12 @@ void FloorDivMod (double numer, double denom, int *quotient,
|
|||
// perform operations with positive values, and fix mod to make floor-based
|
||||
//
|
||||
x = floor(-numer / denom);
|
||||
q = -(int)x;
|
||||
r = (int)floor(-numer - (x * denom));
|
||||
q = -(int32_t)x;
|
||||
r = (int32_t)floor(-numer - (x * denom));
|
||||
if (r != 0)
|
||||
{
|
||||
q--;
|
||||
r = (int)denom - r;
|
||||
r = (int32_t)denom - r;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ void FloorDivMod (double numer, double denom, int *quotient,
|
|||
GreatestCommonDivisor
|
||||
====================
|
||||
*/
|
||||
int GreatestCommonDivisor (int i1, int i2)
|
||||
int32_t GreatestCommonDivisor (int32_t i1, int32_t i2)
|
||||
{
|
||||
if (i1 > i2)
|
||||
{
|
||||
|
@ -483,22 +483,3 @@ int GreatestCommonDivisor (int i1, int i2)
|
|||
return GreatestCommonDivisor (i1, i2 % i1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
Invert24To16
|
||||
|
||||
Inverts an 8.24 value to a 16.16 value
|
||||
====================
|
||||
*/
|
||||
|
||||
fixed16_t Invert24To16(fixed16_t val)
|
||||
{
|
||||
if (val < 256)
|
||||
return (0xFFFFFFFF);
|
||||
|
||||
return (fixed16_t)
|
||||
(((double)0x10000 * (double)0x1000000 / (double)val) + 0.5);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,16 +40,16 @@ extern vec3_t vec3_origin;
|
|||
|
||||
#define nanmask (255 << 23) /* 7F800000 */
|
||||
#if 0 /* macro is violating strict aliasing rules */
|
||||
#define IS_NAN(x) (((*(int *) (char *) &x) & nanmask) == nanmask)
|
||||
#define IS_NAN(x) (((*(int32_t *) (char *) &x) & nanmask) == nanmask)
|
||||
#else
|
||||
static inline int IS_NAN (float x) {
|
||||
union { float f; int i; } num;
|
||||
static inline int32_t IS_NAN (float x) {
|
||||
union { float f; int32_t i; } num;
|
||||
num.f = x;
|
||||
return ((num.i & nanmask) == nanmask);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define Q_rint(x) ((x) > 0 ? (int)((x) + 0.5) : (int)((x) - 0.5)) //johnfitz -- from joequake
|
||||
#define Q_rint(x) ((x) > 0 ? (int32_t)((x) + 0.5) : (int32_t)((x) - 0.5)) //johnfitz -- from joequake
|
||||
|
||||
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
|
||||
#define DoublePrecisionDotProduct(x,y) ((double)x[0]*y[0]+(double)x[1]*y[1]+(double)x[2]*y[2])
|
||||
|
@ -58,10 +58,10 @@ static inline int IS_NAN (float x) {
|
|||
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
|
||||
|
||||
//johnfitz -- courtesy of lordhavoc
|
||||
// QuakeSpasm: To avoid strict aliasing violations, use a float/int union instead of type punning.
|
||||
// QuakeSpasm: To avoid strict aliasing violations, use a float/int32_t union instead of type punning.
|
||||
#define VectorNormalizeFast(_v)\
|
||||
{\
|
||||
union { float f; int i; } _y, _number;\
|
||||
union { float f; int32_t i; } _y, _number;\
|
||||
_number.f = DotProduct(_v, _v);\
|
||||
if (_number.f != 0.0)\
|
||||
{\
|
||||
|
@ -81,24 +81,23 @@ void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);
|
|||
void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
|
||||
void _VectorCopy (vec3_t in, vec3_t out);
|
||||
|
||||
int VectorCompare (vec3_t v1, vec3_t v2);
|
||||
int32_t VectorCompare (vec3_t v1, vec3_t v2);
|
||||
vec_t VectorLength (vec3_t v);
|
||||
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
|
||||
float VectorNormalize (vec3_t v); // returns vector length
|
||||
void VectorInverse (vec3_t v);
|
||||
void VectorScale (vec3_t in, vec_t scale, vec3_t out);
|
||||
int Q_log2(int val);
|
||||
int32_t Q_log2(int32_t val);
|
||||
|
||||
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
|
||||
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
|
||||
|
||||
void FloorDivMod (double numer, double denom, int *quotient,
|
||||
int *rem);
|
||||
fixed16_t Invert24To16(fixed16_t val);
|
||||
int GreatestCommonDivisor (int i1, int i2);
|
||||
void FloorDivMod (double numer, double denom, int32_t *quotient,
|
||||
int32_t *rem);
|
||||
int32_t GreatestCommonDivisor (int32_t i1, int32_t i2);
|
||||
|
||||
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
|
||||
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane);
|
||||
int32_t BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane);
|
||||
float anglemod(float a);
|
||||
|
||||
|
||||
|
|
316
source/menu.c
316
source/menu.c
|
@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
void (*vid_menucmdfn)(void); //johnfitz
|
||||
void (*vid_menudrawfn)(void);
|
||||
void (*vid_menukeyfn)(int key);
|
||||
void (*vid_menukeyfn)(int32_t key);
|
||||
|
||||
enum m_state_e m_state;
|
||||
|
||||
|
@ -63,29 +63,29 @@ void M_Main_Draw (void);
|
|||
void M_Help_Draw (void);
|
||||
void M_Quit_Draw (void);
|
||||
|
||||
void M_Main_Key (int key);
|
||||
void M_SinglePlayer_Key (int key);
|
||||
void M_Load_Key (int key);
|
||||
void M_Save_Key (int key);
|
||||
void M_MultiPlayer_Key (int key);
|
||||
void M_Setup_Key (int key);
|
||||
void M_Net_Key (int key);
|
||||
void M_LanConfig_Key (int key);
|
||||
void M_GameOptions_Key (int key);
|
||||
void M_Search_Key (int key);
|
||||
void M_ServerList_Key (int key);
|
||||
void M_Options_Key (int key);
|
||||
void M_Keys_Key (int key);
|
||||
void M_Video_Key (int key);
|
||||
void M_Help_Key (int key);
|
||||
void M_Quit_Key (int key);
|
||||
void M_Main_Key (int32_t key);
|
||||
void M_SinglePlayer_Key (int32_t key);
|
||||
void M_Load_Key (int32_t key);
|
||||
void M_Save_Key (int32_t key);
|
||||
void M_MultiPlayer_Key (int32_t key);
|
||||
void M_Setup_Key (int32_t key);
|
||||
void M_Net_Key (int32_t key);
|
||||
void M_LanConfig_Key (int32_t key);
|
||||
void M_GameOptions_Key (int32_t key);
|
||||
void M_Search_Key (int32_t key);
|
||||
void M_ServerList_Key (int32_t key);
|
||||
void M_Options_Key (int32_t key);
|
||||
void M_Keys_Key (int32_t key);
|
||||
void M_Video_Key (int32_t key);
|
||||
void M_Help_Key (int32_t key);
|
||||
void M_Quit_Key (int32_t key);
|
||||
|
||||
qboolean m_entersound; // play after drawing a frame, so caching
|
||||
bool m_entersound; // play after drawing a frame, so caching
|
||||
// won't disrupt the sound
|
||||
qboolean m_recursiveDraw;
|
||||
bool m_recursiveDraw;
|
||||
|
||||
enum m_state_e m_return_state;
|
||||
qboolean m_return_onerror;
|
||||
bool m_return_onerror;
|
||||
char m_return_reason [32];
|
||||
|
||||
#define StartingGame (m_multiplayer_cursor == 1)
|
||||
|
@ -102,12 +102,12 @@ M_DrawCharacter
|
|||
Draws one solid graphics character
|
||||
================
|
||||
*/
|
||||
void M_DrawCharacter (int cx, int line, int num)
|
||||
void M_DrawCharacter (int32_t cx, int32_t line, int32_t num)
|
||||
{
|
||||
Draw_Character (cx, line, num);
|
||||
}
|
||||
|
||||
void M_Print (int cx, int cy, const char *str)
|
||||
void M_Print (int32_t cx, int32_t cy, const char *str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ void M_Print (int cx, int cy, const char *str)
|
|||
}
|
||||
}
|
||||
|
||||
void M_PrintWhite (int cx, int cy, const char *str)
|
||||
void M_PrintWhite (int32_t cx, int32_t cy, const char *str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
|
@ -127,26 +127,26 @@ void M_PrintWhite (int cx, int cy, const char *str)
|
|||
}
|
||||
}
|
||||
|
||||
void M_DrawTransPic (int x, int y, qpic_t *pic)
|
||||
void M_DrawTransPic (int32_t x, int32_t y, qpic_t *pic)
|
||||
{
|
||||
Draw_Pic (x, y, pic); //johnfitz -- simplified becuase centering is handled elsewhere
|
||||
}
|
||||
|
||||
void M_DrawPic (int x, int y, qpic_t *pic)
|
||||
void M_DrawPic (int32_t x, int32_t y, qpic_t *pic)
|
||||
{
|
||||
Draw_Pic (x, y, pic); //johnfitz -- simplified becuase centering is handled elsewhere
|
||||
}
|
||||
|
||||
void M_DrawTransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom) //johnfitz -- more parameters
|
||||
void M_DrawTransPicTranslate (int32_t x, int32_t y, qpic_t *pic, int32_t top, int32_t bottom) //johnfitz -- more parameters
|
||||
{
|
||||
Draw_TransPicTranslate (x, y, pic, top, bottom); //johnfitz -- simplified becuase centering is handled elsewhere
|
||||
}
|
||||
|
||||
void M_DrawTextBox (int x, int y, int width, int lines)
|
||||
void M_DrawTextBox (int32_t x, int32_t y, int32_t width, int32_t lines)
|
||||
{
|
||||
qpic_t *p;
|
||||
int cx, cy;
|
||||
int n;
|
||||
int32_t cx, cy;
|
||||
int32_t n;
|
||||
|
||||
// draw left side
|
||||
cx = x;
|
||||
|
@ -199,7 +199,7 @@ void M_DrawTextBox (int x, int y, int width, int lines)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
int m_save_demonum;
|
||||
int32_t m_save_demonum;
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -237,7 +237,7 @@ void M_ToggleMenu_f (void)
|
|||
//=============================================================================
|
||||
/* MAIN MENU */
|
||||
|
||||
int m_main_cursor;
|
||||
int32_t m_main_cursor;
|
||||
#define MAIN_ITEMS 5
|
||||
|
||||
|
||||
|
@ -257,7 +257,7 @@ void M_Menu_Main_f (void)
|
|||
|
||||
void M_Main_Draw (void)
|
||||
{
|
||||
int f;
|
||||
int32_t f;
|
||||
qpic_t *p;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
|
||||
|
@ -265,13 +265,13 @@ void M_Main_Draw (void)
|
|||
M_DrawPic ( (320-p->width)/2, 4, p);
|
||||
M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp") );
|
||||
|
||||
f = (int)(realtime * 10)%6;
|
||||
f = (int32_t)(realtime * 10)%6;
|
||||
|
||||
M_DrawTransPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
|
||||
M_DrawTransPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%" PRIi32 ".lmp", f+1 ) ) );
|
||||
}
|
||||
|
||||
|
||||
void M_Main_Key (int key)
|
||||
void M_Main_Key (int32_t key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -332,7 +332,7 @@ void M_Main_Key (int key)
|
|||
//=============================================================================
|
||||
/* SINGLE PLAYER MENU */
|
||||
|
||||
int m_singleplayer_cursor;
|
||||
int32_t m_singleplayer_cursor;
|
||||
#define SINGLEPLAYER_ITEMS 3
|
||||
|
||||
|
||||
|
@ -347,7 +347,7 @@ void M_Menu_SinglePlayer_f (void)
|
|||
|
||||
void M_SinglePlayer_Draw (void)
|
||||
{
|
||||
int f;
|
||||
int32_t f;
|
||||
qpic_t *p;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
|
||||
|
@ -355,13 +355,13 @@ void M_SinglePlayer_Draw (void)
|
|||
M_DrawPic ( (320-p->width)/2, 4, p);
|
||||
M_DrawTransPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp") );
|
||||
|
||||
f = (int)(realtime * 10)%6;
|
||||
f = (int32_t)(realtime * 10)%6;
|
||||
|
||||
M_DrawTransPic (54, 32 + m_singleplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
|
||||
M_DrawTransPic (54, 32 + m_singleplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%" PRIi32 ".lmp", f+1 ) ) );
|
||||
}
|
||||
|
||||
|
||||
void M_SinglePlayer_Key (int key)
|
||||
void M_SinglePlayer_Key (int32_t key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -417,28 +417,28 @@ void M_SinglePlayer_Key (int key)
|
|||
//=============================================================================
|
||||
/* LOAD/SAVE MENU */
|
||||
|
||||
int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
|
||||
int32_t load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
|
||||
|
||||
#define MAX_SAVEGAMES 20 /* johnfitz -- increased from 12 */
|
||||
char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
|
||||
int loadable[MAX_SAVEGAMES];
|
||||
int32_t loadable[MAX_SAVEGAMES];
|
||||
|
||||
void M_ScanSaves (void)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
char name[MAX_OSPATH];
|
||||
FILE *f;
|
||||
int version;
|
||||
int32_t version;
|
||||
|
||||
for (i = 0; i < MAX_SAVEGAMES; i++)
|
||||
{
|
||||
strcpy (m_filenames[i], "--- UNUSED SLOT ---");
|
||||
loadable[i] = false;
|
||||
q_snprintf (name, sizeof(name), "%s/s%i.sav", com_gamedir, i);
|
||||
q_snprintf (name, sizeof(name), "%s/s%" PRIi32 ".sav", com_gamedir, i);
|
||||
f = fopen (name, "r");
|
||||
if (!f)
|
||||
continue;
|
||||
fscanf (f, "%i\n", &version);
|
||||
fscanf (f, "%" PRIi32 "\n", &version);
|
||||
fscanf (f, "%79s\n", name);
|
||||
strncpy (m_filenames[i], name, sizeof(m_filenames[i])-1);
|
||||
|
||||
|
@ -483,7 +483,7 @@ void M_Menu_Save_f (void)
|
|||
|
||||
void M_Load_Draw (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
qpic_t *p;
|
||||
|
||||
p = Draw_CachePic ("gfx/p_load.lmp");
|
||||
|
@ -493,13 +493,13 @@ void M_Load_Draw (void)
|
|||
M_Print (16, 32 + 8*i, m_filenames[i]);
|
||||
|
||||
// line cursor
|
||||
M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (8, 32 + load_cursor*8, 12+((int32_t)(realtime*4)&1));
|
||||
}
|
||||
|
||||
|
||||
void M_Save_Draw (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
qpic_t *p;
|
||||
|
||||
p = Draw_CachePic ("gfx/p_save.lmp");
|
||||
|
@ -509,11 +509,11 @@ void M_Save_Draw (void)
|
|||
M_Print (16, 32 + 8*i, m_filenames[i]);
|
||||
|
||||
// line cursor
|
||||
M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (8, 32 + load_cursor*8, 12+((int32_t)(realtime*4)&1));
|
||||
}
|
||||
|
||||
|
||||
void M_Load_Key (int k)
|
||||
void M_Load_Key (int32_t k)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
|
@ -537,7 +537,7 @@ void M_Load_Key (int k)
|
|||
SCR_BeginLoadingPlaque ();
|
||||
|
||||
// issue the load command
|
||||
Cbuf_AddText (va ("load s%i\n", load_cursor) );
|
||||
Cbuf_AddText (va ("load s%" PRIi32 "\n", load_cursor) );
|
||||
return;
|
||||
|
||||
case K_UPARROW:
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -574,7 +574,7 @@ void M_Save_Key (int k)
|
|||
m_state = m_none;
|
||||
IN_Activate();
|
||||
key_dest = key_game;
|
||||
Cbuf_AddText (va("save s%i\n", load_cursor));
|
||||
Cbuf_AddText (va("save s%" PRIi32 "\n", load_cursor));
|
||||
return;
|
||||
|
||||
case K_UPARROW:
|
||||
|
@ -598,7 +598,7 @@ void M_Save_Key (int k)
|
|||
//=============================================================================
|
||||
/* MULTIPLAYER MENU */
|
||||
|
||||
int m_multiplayer_cursor;
|
||||
int32_t m_multiplayer_cursor;
|
||||
#define MULTIPLAYER_ITEMS 3
|
||||
|
||||
|
||||
|
@ -613,7 +613,7 @@ void M_Menu_MultiPlayer_f (void)
|
|||
|
||||
void M_MultiPlayer_Draw (void)
|
||||
{
|
||||
int f;
|
||||
int32_t f;
|
||||
qpic_t *p;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
|
||||
|
@ -621,9 +621,9 @@ void M_MultiPlayer_Draw (void)
|
|||
M_DrawPic ( (320-p->width)/2, 4, p);
|
||||
M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mp_menu.lmp") );
|
||||
|
||||
f = (int)(realtime * 10)%6;
|
||||
f = (int32_t)(realtime * 10)%6;
|
||||
|
||||
M_DrawTransPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
|
||||
M_DrawTransPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%" PRIi32 ".lmp", f+1 ) ) );
|
||||
|
||||
if (ipxAvailable || tcpipAvailable)
|
||||
return;
|
||||
|
@ -631,7 +631,7 @@ void M_MultiPlayer_Draw (void)
|
|||
}
|
||||
|
||||
|
||||
void M_MultiPlayer_Key (int key)
|
||||
void M_MultiPlayer_Key (int32_t key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -678,15 +678,15 @@ void M_MultiPlayer_Key (int key)
|
|||
//=============================================================================
|
||||
/* SETUP MENU */
|
||||
|
||||
int setup_cursor = 4;
|
||||
int setup_cursor_table[] = {40, 56, 80, 104, 140};
|
||||
int32_t setup_cursor = 4;
|
||||
int32_t setup_cursor_table[] = {40, 56, 80, 104, 140};
|
||||
|
||||
char setup_hostname[16];
|
||||
char setup_myname[16];
|
||||
int setup_oldtop;
|
||||
int setup_oldbottom;
|
||||
int setup_top;
|
||||
int setup_bottom;
|
||||
int32_t setup_oldtop;
|
||||
int32_t setup_oldbottom;
|
||||
int32_t setup_top;
|
||||
int32_t setup_bottom;
|
||||
|
||||
#define NUM_SETUP_CMDS 5
|
||||
|
||||
|
@ -698,8 +698,8 @@ void M_Menu_Setup_f (void)
|
|||
m_entersound = true;
|
||||
Q_strcpy(setup_myname, cl_name.string);
|
||||
Q_strcpy(setup_hostname, hostname.string);
|
||||
setup_top = setup_oldtop = ((int)cl_color.value) >> 4;
|
||||
setup_bottom = setup_oldbottom = ((int)cl_color.value) & 15;
|
||||
setup_top = setup_oldtop = ((int32_t)cl_color.value) >> 4;
|
||||
setup_bottom = setup_oldbottom = ((int32_t)cl_color.value) & 15;
|
||||
}
|
||||
|
||||
|
||||
|
@ -730,17 +730,17 @@ void M_Setup_Draw (void)
|
|||
p = Draw_CachePic ("gfx/menuplyr.lmp");
|
||||
M_DrawTransPicTranslate (172, 72, p, setup_top, setup_bottom);
|
||||
|
||||
M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int32_t)(realtime*4)&1));
|
||||
|
||||
if (setup_cursor == 0)
|
||||
M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (168 + 8*strlen(setup_hostname), setup_cursor_table [setup_cursor], 10+((int32_t)(realtime*4)&1));
|
||||
|
||||
if (setup_cursor == 1)
|
||||
M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int32_t)(realtime*4)&1));
|
||||
}
|
||||
|
||||
|
||||
void M_Setup_Key (int k)
|
||||
void M_Setup_Key (int32_t k)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
|
@ -798,7 +798,7 @@ forward:
|
|||
if (Q_strcmp(hostname.string, setup_hostname) != 0)
|
||||
Cvar_Set("hostname", setup_hostname);
|
||||
if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
|
||||
Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
|
||||
Cbuf_AddText( va ("color %" PRIi32 " %" PRIi32 "\n", setup_top, setup_bottom) );
|
||||
m_entersound = true;
|
||||
M_Menu_MultiPlayer_f ();
|
||||
break;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -855,7 +855,7 @@ void M_Setup_Char (int k)
|
|||
}
|
||||
|
||||
|
||||
qboolean M_Setup_TextEntry (void)
|
||||
bool M_Setup_TextEntry (void)
|
||||
{
|
||||
return (setup_cursor == 0 || setup_cursor == 1);
|
||||
}
|
||||
|
@ -863,8 +863,8 @@ qboolean M_Setup_TextEntry (void)
|
|||
//=============================================================================
|
||||
/* NET MENU */
|
||||
|
||||
int m_net_cursor;
|
||||
int m_net_items;
|
||||
int32_t m_net_cursor;
|
||||
int32_t m_net_items;
|
||||
|
||||
const char *net_helpMessage [] =
|
||||
{
|
||||
|
@ -897,7 +897,7 @@ void M_Menu_Net_f (void)
|
|||
|
||||
void M_Net_Draw (void)
|
||||
{
|
||||
int f;
|
||||
int32_t f;
|
||||
qpic_t *p;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
|
||||
|
@ -927,12 +927,12 @@ void M_Net_Draw (void)
|
|||
M_Print (f, 120, net_helpMessage[m_net_cursor*4+2]);
|
||||
M_Print (f, 128, net_helpMessage[m_net_cursor*4+3]);
|
||||
|
||||
f = (int)(realtime * 10)%6;
|
||||
M_DrawTransPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
|
||||
f = (int32_t)(realtime * 10)%6;
|
||||
M_DrawTransPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%" PRIi32 ".lmp", f+1 ) ) );
|
||||
}
|
||||
|
||||
|
||||
void M_Net_Key (int k)
|
||||
void M_Net_Key (int32_t k)
|
||||
{
|
||||
again:
|
||||
switch (k)
|
||||
|
@ -1007,7 +1007,7 @@ enum
|
|||
|
||||
#define SLIDER_RANGE 10
|
||||
|
||||
int options_cursor;
|
||||
int32_t options_cursor;
|
||||
|
||||
void M_Menu_Options_f (void)
|
||||
{
|
||||
|
@ -1018,9 +1018,9 @@ void M_Menu_Options_f (void)
|
|||
}
|
||||
|
||||
|
||||
void M_AdjustSliders (int dir)
|
||||
void M_AdjustSliders (int32_t dir)
|
||||
{
|
||||
int curr_alwaysrun, target_alwaysrun;
|
||||
int32_t curr_alwaysrun, target_alwaysrun;
|
||||
float f, l;
|
||||
|
||||
S_LocalSound ("misc/menu3.wav");
|
||||
|
@ -1134,9 +1134,9 @@ void M_AdjustSliders (int dir)
|
|||
}
|
||||
|
||||
|
||||
void M_DrawSlider (int x, int y, float range)
|
||||
void M_DrawSlider (int32_t x, int32_t y, float range)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (range < 0)
|
||||
range = 0;
|
||||
|
@ -1149,7 +1149,7 @@ void M_DrawSlider (int x, int y, float range)
|
|||
M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
|
||||
}
|
||||
|
||||
void M_DrawCheckbox (int x, int y, int on)
|
||||
void M_DrawCheckbox (int32_t x, int32_t y, int32_t on)
|
||||
{
|
||||
#if 0
|
||||
if (on)
|
||||
|
@ -1255,11 +1255,11 @@ void M_Options_Draw (void)
|
|||
M_Print (16, 32 + 8*OPT_VIDEO, " Video Options");
|
||||
|
||||
// cursor
|
||||
M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (200, 32 + options_cursor*8, 12+((int32_t)(realtime*4)&1));
|
||||
}
|
||||
|
||||
|
||||
void M_Options_Key (int k)
|
||||
void M_Options_Key (int32_t k)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
|
@ -1358,8 +1358,8 @@ const char *bindnames[][2] =
|
|||
|
||||
#define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
|
||||
|
||||
static int keys_cursor;
|
||||
static qboolean bind_grab;
|
||||
static int32_t keys_cursor;
|
||||
static bool bind_grab;
|
||||
|
||||
void M_Menu_Keys_f (void)
|
||||
{
|
||||
|
@ -1370,11 +1370,11 @@ void M_Menu_Keys_f (void)
|
|||
}
|
||||
|
||||
|
||||
void M_FindKeysForCommand (const char *command, int *threekeys)
|
||||
void M_FindKeysForCommand (const char *command, int32_t *threekeys)
|
||||
{
|
||||
int count;
|
||||
int j;
|
||||
int l;
|
||||
int32_t count;
|
||||
int32_t j;
|
||||
int32_t l;
|
||||
char *b;
|
||||
|
||||
threekeys[0] = threekeys[1] = threekeys[2] = -1;
|
||||
|
@ -1398,8 +1398,8 @@ void M_FindKeysForCommand (const char *command, int *threekeys)
|
|||
|
||||
void M_UnbindCommand (const char *command)
|
||||
{
|
||||
int j;
|
||||
int l;
|
||||
int32_t j;
|
||||
int32_t l;
|
||||
char *b;
|
||||
|
||||
l = strlen(command);
|
||||
|
@ -1418,8 +1418,8 @@ extern qpic_t *pic_up, *pic_down;
|
|||
|
||||
void M_Keys_Draw (void)
|
||||
{
|
||||
int i, x, y;
|
||||
int keys[3];
|
||||
int32_t i, x, y;
|
||||
int32_t keys[3];
|
||||
const char *name;
|
||||
qpic_t *p;
|
||||
|
||||
|
@ -1432,7 +1432,7 @@ void M_Keys_Draw (void)
|
|||
M_Print (18, 32, "Enter to change, backspace to clear");
|
||||
|
||||
// search for known bindings
|
||||
for (i = 0; i < (int)NUMCOMMANDS; i++)
|
||||
for (i = 0; i < (int32_t)NUMCOMMANDS; i++)
|
||||
{
|
||||
y = 48 + 8*i;
|
||||
|
||||
|
@ -1467,14 +1467,14 @@ void M_Keys_Draw (void)
|
|||
if (bind_grab)
|
||||
M_DrawCharacter (130, 48 + keys_cursor*8, '=');
|
||||
else
|
||||
M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int32_t)(realtime*4)&1));
|
||||
}
|
||||
|
||||
|
||||
void M_Keys_Key (int k)
|
||||
void M_Keys_Key (int32_t k)
|
||||
{
|
||||
char cmd[80];
|
||||
int keys[3];
|
||||
int32_t keys[3];
|
||||
|
||||
if (bind_grab)
|
||||
{ // defining a key
|
||||
|
@ -1509,7 +1509,7 @@ void M_Keys_Key (int k)
|
|||
case K_RIGHTARROW:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
keys_cursor++;
|
||||
if (keys_cursor >= (int)NUMCOMMANDS)
|
||||
if (keys_cursor >= (int32_t)NUMCOMMANDS)
|
||||
keys_cursor = 0;
|
||||
break;
|
||||
|
||||
|
@ -1547,7 +1547,7 @@ void M_Video_Draw (void)
|
|||
}
|
||||
|
||||
|
||||
void M_Video_Key (int key)
|
||||
void M_Video_Key (int32_t key)
|
||||
{
|
||||
(*vid_menukeyfn) (key);
|
||||
}
|
||||
|
@ -1555,7 +1555,7 @@ void M_Video_Key (int key)
|
|||
//=============================================================================
|
||||
/* HELP MENU */
|
||||
|
||||
int help_page;
|
||||
int32_t help_page;
|
||||
#define NUM_HELP_PAGES 6
|
||||
|
||||
|
||||
|
@ -1572,11 +1572,11 @@ void M_Menu_Help_f (void)
|
|||
|
||||
void M_Help_Draw (void)
|
||||
{
|
||||
M_DrawPic (0, 0, Draw_CachePic ( va("gfx/help%i.lmp", help_page)) );
|
||||
M_DrawPic (0, 0, Draw_CachePic ( va("gfx/help%" PRIi32 ".lmp", help_page)) );
|
||||
}
|
||||
|
||||
|
||||
void M_Help_Key (int key)
|
||||
void M_Help_Key (int32_t key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -1605,9 +1605,9 @@ void M_Help_Key (int key)
|
|||
//=============================================================================
|
||||
/* QUIT MENU */
|
||||
|
||||
int msgNumber;
|
||||
int32_t msgNumber;
|
||||
enum m_state_e m_quit_prevstate;
|
||||
qboolean wasInMenus;
|
||||
bool wasInMenus;
|
||||
|
||||
void M_Menu_Quit_f (void)
|
||||
{
|
||||
|
@ -1623,7 +1623,7 @@ void M_Menu_Quit_f (void)
|
|||
}
|
||||
|
||||
|
||||
void M_Quit_Key (int key)
|
||||
void M_Quit_Key (int32_t key)
|
||||
{
|
||||
if (key == K_ESCAPE)
|
||||
{
|
||||
|
@ -1642,7 +1642,7 @@ void M_Quit_Key (int key)
|
|||
}
|
||||
|
||||
|
||||
void M_Quit_Char (int key)
|
||||
void M_Quit_Char (int32_t key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -1675,7 +1675,7 @@ void M_Quit_Char (int key)
|
|||
}
|
||||
|
||||
|
||||
qboolean M_Quit_TextEntry (void)
|
||||
bool M_Quit_TextEntry (void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1686,7 +1686,7 @@ void M_Quit_Draw (void) //johnfitz -- modified for new quit message
|
|||
char msg1[40];
|
||||
char msg2[] = "by Ozkan, Ericw & Stevenaaus"; /* msg2/msg3 are mostly [40] */
|
||||
char msg3[] = "Press y to quit";
|
||||
int boxlen;
|
||||
int32_t boxlen;
|
||||
|
||||
if (wasInMenus)
|
||||
{
|
||||
|
@ -1714,11 +1714,11 @@ void M_Quit_Draw (void) //johnfitz -- modified for new quit message
|
|||
//=============================================================================
|
||||
/* LAN CONFIG MENU */
|
||||
|
||||
int lanConfig_cursor = -1;
|
||||
int lanConfig_cursor_table [] = {72, 92, 124};
|
||||
int32_t lanConfig_cursor = -1;
|
||||
int32_t lanConfig_cursor_table [] = {72, 92, 124};
|
||||
#define NUM_LANCONFIG_CMDS 3
|
||||
|
||||
int lanConfig_port;
|
||||
int32_t lanConfig_port;
|
||||
char lanConfig_portname[6];
|
||||
char lanConfig_joinname[22];
|
||||
|
||||
|
@ -1738,7 +1738,7 @@ void M_Menu_LanConfig_f (void)
|
|||
if (StartingGame && lanConfig_cursor == 2)
|
||||
lanConfig_cursor = 1;
|
||||
lanConfig_port = DEFAULTnet_hostport;
|
||||
sprintf(lanConfig_portname, "%u", lanConfig_port);
|
||||
sprintf(lanConfig_portname, "%" PRIu32 "", lanConfig_port);
|
||||
|
||||
m_return_onerror = false;
|
||||
m_return_reason[0] = 0;
|
||||
|
@ -1748,7 +1748,7 @@ void M_Menu_LanConfig_f (void)
|
|||
void M_LanConfig_Draw (void)
|
||||
{
|
||||
qpic_t *p;
|
||||
int basex;
|
||||
int32_t basex;
|
||||
const char *startJoin;
|
||||
const char *protocol;
|
||||
|
||||
|
@ -1791,22 +1791,22 @@ void M_LanConfig_Draw (void)
|
|||
M_Print (basex+8, lanConfig_cursor_table[1], "OK");
|
||||
}
|
||||
|
||||
M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int32_t)(realtime*4)&1));
|
||||
|
||||
if (lanConfig_cursor == 0)
|
||||
M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [0], 10+((int32_t)(realtime*4)&1));
|
||||
|
||||
if (lanConfig_cursor == 2)
|
||||
M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [2], 10+((int32_t)(realtime*4)&1));
|
||||
|
||||
if (*m_return_reason)
|
||||
M_PrintWhite (basex, 148, m_return_reason);
|
||||
}
|
||||
|
||||
|
||||
void M_LanConfig_Key (int key)
|
||||
void M_LanConfig_Key (int32_t key)
|
||||
{
|
||||
int l;
|
||||
int32_t l;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
|
@ -1891,13 +1891,13 @@ void M_LanConfig_Key (int key)
|
|||
l = lanConfig_port;
|
||||
else
|
||||
lanConfig_port = l;
|
||||
sprintf(lanConfig_portname, "%u", lanConfig_port);
|
||||
sprintf(lanConfig_portname, "%" PRIu32 "", lanConfig_port);
|
||||
}
|
||||
|
||||
|
||||
void M_LanConfig_Char (int key)
|
||||
void M_LanConfig_Char (int32_t key)
|
||||
{
|
||||
int l;
|
||||
int32_t l;
|
||||
|
||||
switch (lanConfig_cursor)
|
||||
{
|
||||
|
@ -1923,7 +1923,7 @@ void M_LanConfig_Char (int key)
|
|||
}
|
||||
|
||||
|
||||
qboolean M_LanConfig_TextEntry (void)
|
||||
bool M_LanConfig_TextEntry (void)
|
||||
{
|
||||
return (lanConfig_cursor == 0 || lanConfig_cursor == 2);
|
||||
}
|
||||
|
@ -2039,8 +2039,8 @@ level_t roguelevels[] =
|
|||
typedef struct
|
||||
{
|
||||
const char *description;
|
||||
int firstLevel;
|
||||
int levels;
|
||||
int32_t firstLevel;
|
||||
int32_t levels;
|
||||
} episode_t;
|
||||
|
||||
episode_t episodes[] =
|
||||
|
@ -2075,10 +2075,10 @@ episode_t rogueepisodes[] =
|
|||
{"Deathmatch Arena", 16, 1}
|
||||
};
|
||||
|
||||
int startepisode;
|
||||
int startlevel;
|
||||
int maxplayers;
|
||||
qboolean m_serverInfoMessage = false;
|
||||
int32_t startepisode;
|
||||
int32_t startlevel;
|
||||
int32_t maxplayers;
|
||||
bool m_serverInfoMessage = false;
|
||||
double m_serverInfoMessageTime;
|
||||
|
||||
void M_Menu_GameOptions_f (void)
|
||||
|
@ -2094,14 +2094,14 @@ void M_Menu_GameOptions_f (void)
|
|||
}
|
||||
|
||||
|
||||
int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
|
||||
int32_t gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 112, 120};
|
||||
#define NUM_GAMEOPTIONS 9
|
||||
int gameoptions_cursor;
|
||||
int32_t gameoptions_cursor;
|
||||
|
||||
void M_GameOptions_Draw (void)
|
||||
{
|
||||
qpic_t *p;
|
||||
int x;
|
||||
int32_t x;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
|
||||
p = Draw_CachePic ("gfx/p_multi.lmp");
|
||||
|
@ -2111,7 +2111,7 @@ void M_GameOptions_Draw (void)
|
|||
M_Print (160, 40, "begin game");
|
||||
|
||||
M_Print (0, 56, " Max players");
|
||||
M_Print (160, 56, va("%i", maxplayers) );
|
||||
M_Print (160, 56, va("%" PRIi32 "", maxplayers) );
|
||||
|
||||
M_Print (0, 64, " Game Type");
|
||||
if (coop.value)
|
||||
|
@ -2124,7 +2124,7 @@ void M_GameOptions_Draw (void)
|
|||
{
|
||||
const char *msg;
|
||||
|
||||
switch((int)teamplay.value)
|
||||
switch((int32_t)teamplay.value)
|
||||
{
|
||||
case 1: msg = "No Friendly Fire"; break;
|
||||
case 2: msg = "Friendly Fire"; break;
|
||||
|
@ -2140,7 +2140,7 @@ void M_GameOptions_Draw (void)
|
|||
{
|
||||
const char *msg;
|
||||
|
||||
switch((int)teamplay.value)
|
||||
switch((int32_t)teamplay.value)
|
||||
{
|
||||
case 1: msg = "No Friendly Fire"; break;
|
||||
case 2: msg = "Friendly Fire"; break;
|
||||
|
@ -2163,13 +2163,13 @@ void M_GameOptions_Draw (void)
|
|||
if (fraglimit.value == 0)
|
||||
M_Print (160, 88, "none");
|
||||
else
|
||||
M_Print (160, 88, va("%i frags", (int)fraglimit.value));
|
||||
M_Print (160, 88, va("%" PRIi32 " frags", (int32_t)fraglimit.value));
|
||||
|
||||
M_Print (0, 96, " Time Limit");
|
||||
if (timelimit.value == 0)
|
||||
M_Print (160, 96, "none");
|
||||
else
|
||||
M_Print (160, 96, va("%i minutes", (int)timelimit.value));
|
||||
M_Print (160, 96, va("%" PRIi32 " minutes", (int32_t)timelimit.value));
|
||||
|
||||
M_Print (0, 112, " Episode");
|
||||
// MED 01/06/97 added hipnotic episodes
|
||||
|
@ -2201,7 +2201,7 @@ void M_GameOptions_Draw (void)
|
|||
}
|
||||
|
||||
// line cursor
|
||||
M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int32_t)(realtime*4)&1));
|
||||
|
||||
if (m_serverInfoMessage)
|
||||
{
|
||||
|
@ -2223,9 +2223,9 @@ void M_GameOptions_Draw (void)
|
|||
}
|
||||
|
||||
|
||||
void M_NetStart_Change (int dir)
|
||||
void M_NetStart_Change (int32_t dir)
|
||||
{
|
||||
int count;
|
||||
int32_t count;
|
||||
float f;
|
||||
|
||||
switch (gameoptions_cursor)
|
||||
|
@ -2318,7 +2318,7 @@ void M_NetStart_Change (int dir)
|
|||
}
|
||||
}
|
||||
|
||||
void M_GameOptions_Key (int key)
|
||||
void M_GameOptions_Key (int32_t key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -2364,7 +2364,7 @@ void M_GameOptions_Key (int key)
|
|||
if (sv.active)
|
||||
Cbuf_AddText ("disconnect\n");
|
||||
Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
|
||||
Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
|
||||
Cbuf_AddText ( va ("maxplayers %" PRIu32 "\n", maxplayers) );
|
||||
SCR_BeginLoadingPlaque ();
|
||||
|
||||
if (hipnotic)
|
||||
|
@ -2385,7 +2385,7 @@ void M_GameOptions_Key (int key)
|
|||
//=============================================================================
|
||||
/* SEARCH MENU */
|
||||
|
||||
qboolean searchComplete = false;
|
||||
bool searchComplete = false;
|
||||
double searchCompleteTime;
|
||||
|
||||
void M_Menu_Search_f (void)
|
||||
|
@ -2405,7 +2405,7 @@ void M_Menu_Search_f (void)
|
|||
void M_Search_Draw (void)
|
||||
{
|
||||
qpic_t *p;
|
||||
int x;
|
||||
int32_t x;
|
||||
|
||||
p = Draw_CachePic ("gfx/p_multi.lmp");
|
||||
M_DrawPic ( (320-p->width)/2, 4, p);
|
||||
|
@ -2439,7 +2439,7 @@ void M_Search_Draw (void)
|
|||
}
|
||||
|
||||
|
||||
void M_Search_Key (int key)
|
||||
void M_Search_Key (int32_t key)
|
||||
{
|
||||
(void)key;
|
||||
}
|
||||
|
@ -2447,8 +2447,8 @@ void M_Search_Key (int key)
|
|||
//=============================================================================
|
||||
/* SLIST MENU */
|
||||
|
||||
int slist_cursor;
|
||||
qboolean slist_sorted;
|
||||
int32_t slist_cursor;
|
||||
bool slist_sorted;
|
||||
|
||||
void M_Menu_ServerList_f (void)
|
||||
{
|
||||
|
@ -2465,7 +2465,7 @@ void M_Menu_ServerList_f (void)
|
|||
|
||||
void M_ServerList_Draw (void)
|
||||
{
|
||||
int n;
|
||||
int32_t n;
|
||||
qpic_t *p;
|
||||
|
||||
if (!slist_sorted)
|
||||
|
@ -2478,14 +2478,14 @@ void M_ServerList_Draw (void)
|
|||
M_DrawPic ( (320-p->width)/2, 4, p);
|
||||
for (n = 0; n < hostCacheCount; n++)
|
||||
M_Print (16, 32 + 8*n, NET_SlistPrintServer (n));
|
||||
M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
|
||||
M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int32_t)(realtime*4)&1));
|
||||
|
||||
if (*m_return_reason)
|
||||
M_PrintWhite (16, 148, m_return_reason);
|
||||
}
|
||||
|
||||
|
||||
void M_ServerList_Key (int k)
|
||||
void M_ServerList_Key (int32_t k)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
|
@ -2663,7 +2663,7 @@ void M_Draw (void)
|
|||
}
|
||||
|
||||
|
||||
void M_Keydown (int key)
|
||||
void M_Keydown (int32_t key)
|
||||
{
|
||||
switch (m_state)
|
||||
{
|
||||
|
@ -2737,7 +2737,7 @@ void M_Keydown (int key)
|
|||
}
|
||||
|
||||
|
||||
void M_Charinput (int key)
|
||||
void M_Charinput (int32_t key)
|
||||
{
|
||||
switch (m_state)
|
||||
{
|
||||
|
@ -2756,7 +2756,7 @@ void M_Charinput (int key)
|
|||
}
|
||||
|
||||
|
||||
qboolean M_TextEntry (void)
|
||||
bool M_TextEntry (void)
|
||||
{
|
||||
switch (m_state)
|
||||
{
|
||||
|
|
|
@ -46,30 +46,30 @@ enum m_state_e {
|
|||
extern enum m_state_e m_state;
|
||||
extern enum m_state_e m_return_state;
|
||||
|
||||
extern qboolean m_entersound;
|
||||
extern bool m_entersound;
|
||||
|
||||
//
|
||||
// menus
|
||||
//
|
||||
void M_Init (void);
|
||||
void M_Keydown (int key);
|
||||
void M_Charinput (int key);
|
||||
qboolean M_TextEntry (void);
|
||||
void M_Keydown (int32_t key);
|
||||
void M_Charinput (int32_t key);
|
||||
bool M_TextEntry (void);
|
||||
void M_ToggleMenu_f (void);
|
||||
|
||||
void M_Menu_Main_f (void);
|
||||
void M_Menu_Options_f (void);
|
||||
void M_Menu_Quit_f (void);
|
||||
|
||||
void M_Print (int cx, int cy, const char *str);
|
||||
void M_PrintWhite (int cx, int cy, const char *str);
|
||||
void M_Print (int32_t cx, int32_t cy, const char *str);
|
||||
void M_PrintWhite (int32_t cx, int32_t cy, const char *str);
|
||||
|
||||
void M_Draw (void);
|
||||
void M_DrawCharacter (int cx, int line, int num);
|
||||
void M_DrawCharacter (int32_t cx, int32_t line, int32_t num);
|
||||
|
||||
void M_DrawPic (int x, int y, qpic_t *pic);
|
||||
void M_DrawTransPic (int x, int y, qpic_t *pic);
|
||||
void M_DrawCheckbox (int x, int y, int on);
|
||||
void M_DrawPic (int32_t x, int32_t y, qpic_t *pic);
|
||||
void M_DrawTransPic (int32_t x, int32_t y, qpic_t *pic);
|
||||
void M_DrawCheckbox (int32_t x, int32_t y, int32_t on);
|
||||
|
||||
#endif /* _QUAKE_MENU_H */
|
||||
|
||||
|
|
|
@ -62,34 +62,34 @@ typedef enum { ALIAS_SINGLE=0, ALIAS_GROUP } aliasframetype_t;
|
|||
typedef enum { ALIAS_SKIN_SINGLE=0, ALIAS_SKIN_GROUP } aliasskintype_t;
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
int version;
|
||||
int32_t ident;
|
||||
int32_t version;
|
||||
vec3_t scale;
|
||||
vec3_t scale_origin;
|
||||
float boundingradius;
|
||||
vec3_t eyeposition;
|
||||
int numskins;
|
||||
int skinwidth;
|
||||
int skinheight;
|
||||
int numverts;
|
||||
int numtris;
|
||||
int numframes;
|
||||
int32_t numskins;
|
||||
int32_t skinwidth;
|
||||
int32_t skinheight;
|
||||
int32_t numverts;
|
||||
int32_t numtris;
|
||||
int32_t numframes;
|
||||
synctype_t synctype;
|
||||
int flags;
|
||||
int32_t flags;
|
||||
float size;
|
||||
} mdl_t;
|
||||
|
||||
// TODO: could be shorts
|
||||
|
||||
typedef struct {
|
||||
int onseam;
|
||||
int s;
|
||||
int t;
|
||||
int32_t onseam;
|
||||
int32_t s;
|
||||
int32_t t;
|
||||
} stvert_t;
|
||||
|
||||
typedef struct dtriangle_s {
|
||||
int facesfront;
|
||||
int vertindex[3];
|
||||
int32_t facesfront;
|
||||
int32_t vertindex[3];
|
||||
} dtriangle_t;
|
||||
|
||||
#define DT_FACES_FRONT 0x0010
|
||||
|
@ -109,13 +109,13 @@ typedef struct {
|
|||
} daliasframe_t;
|
||||
|
||||
typedef struct {
|
||||
int numframes;
|
||||
int32_t numframes;
|
||||
trivertx_t bboxmin; // lightnormal isn't used
|
||||
trivertx_t bboxmax; // lightnormal isn't used
|
||||
} daliasgroup_t;
|
||||
|
||||
typedef struct {
|
||||
int numskins;
|
||||
int32_t numskins;
|
||||
} daliasskingroup_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
32
source/net.h
32
source/net.h
|
@ -36,14 +36,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define NET_MAXMESSAGE 64000 /* ericw -- was 32000 */
|
||||
|
||||
extern int DEFAULTnet_hostport;
|
||||
extern int net_hostport;
|
||||
extern int32_t DEFAULTnet_hostport;
|
||||
extern int32_t net_hostport;
|
||||
|
||||
extern cvar_t hostname;
|
||||
|
||||
extern double net_time;
|
||||
extern sizebuf_t net_message;
|
||||
extern int net_activeconnections;
|
||||
extern int32_t net_activeconnections;
|
||||
|
||||
|
||||
void NET_Init (void);
|
||||
|
@ -58,25 +58,25 @@ struct qsocket_s *NET_Connect (const char *host);
|
|||
double NET_QSocketGetTime (const struct qsocket_s *sock);
|
||||
const char *NET_QSocketGetAddressString (const struct qsocket_s *sock);
|
||||
|
||||
qboolean NET_CanSendMessage (struct qsocket_s *sock);
|
||||
bool NET_CanSendMessage (struct qsocket_s *sock);
|
||||
// Returns true or false if the given qsocket can currently accept a
|
||||
// message to be transmitted.
|
||||
|
||||
int NET_GetMessage (struct qsocket_s *sock);
|
||||
int32_t NET_GetMessage (struct qsocket_s *sock);
|
||||
// returns data in net_message sizebuf
|
||||
// returns 0 if no data is waiting
|
||||
// returns 1 if a message was received
|
||||
// returns 2 if an unreliable message was received
|
||||
// returns -1 if the connection died
|
||||
|
||||
int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||
int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||
int32_t NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||
int32_t NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||
// returns 0 if the message connot be delivered reliably, but the connection
|
||||
// is still considered valid
|
||||
// returns 1 if the message was sent properly
|
||||
// returns -1 if the connection died
|
||||
|
||||
int NET_SendToAll(sizebuf_t *data, double blocktime);
|
||||
int32_t NET_SendToAll(sizebuf_t *data, double blocktime);
|
||||
// This is a reliable *blocking* send to all attached clients.
|
||||
|
||||
void NET_Close (struct qsocket_s *sock);
|
||||
|
@ -92,22 +92,22 @@ void NET_Poll (void);
|
|||
|
||||
|
||||
// Server list related globals:
|
||||
extern qboolean slistInProgress;
|
||||
extern qboolean slistSilent;
|
||||
extern qboolean slistLocal;
|
||||
extern bool slistInProgress;
|
||||
extern bool slistSilent;
|
||||
extern bool slistLocal;
|
||||
|
||||
extern int hostCacheCount;
|
||||
extern int32_t hostCacheCount;
|
||||
|
||||
void NET_Slist_f (void);
|
||||
void NET_SlistSort (void);
|
||||
const char *NET_SlistPrintServer (int n);
|
||||
const char *NET_SlistPrintServerName (int n);
|
||||
const char *NET_SlistPrintServer (int32_t n);
|
||||
const char *NET_SlistPrintServerName (int32_t n);
|
||||
|
||||
|
||||
/* FIXME: driver related, but public:
|
||||
*/
|
||||
extern qboolean ipxAvailable;
|
||||
extern qboolean tcpipAvailable;
|
||||
extern bool ipxAvailable;
|
||||
extern bool tcpipAvailable;
|
||||
extern char my_ipx_address[NET_NAMELEN];
|
||||
extern char my_tcpip_address[NET_NAMELEN];
|
||||
|
||||
|
|
|
@ -134,24 +134,24 @@ typedef struct qsocket_s
|
|||
double lastMessageTime;
|
||||
double lastSendTime;
|
||||
|
||||
qboolean disconnected;
|
||||
qboolean canSend;
|
||||
qboolean sendNext;
|
||||
bool disconnected;
|
||||
bool canSend;
|
||||
bool sendNext;
|
||||
|
||||
int driver;
|
||||
int landriver;
|
||||
int32_t driver;
|
||||
int32_t landriver;
|
||||
sys_socket_t socket;
|
||||
void *driverdata;
|
||||
|
||||
uint32_t ackSequence;
|
||||
uint32_t sendSequence;
|
||||
uint32_t unreliableSendSequence;
|
||||
int sendMessageLength;
|
||||
int32_t sendMessageLength;
|
||||
byte sendMessage [NET_MAXMESSAGE];
|
||||
|
||||
uint32_t receiveSequence;
|
||||
uint32_t unreliableReceiveSequence;
|
||||
int receiveMessageLength;
|
||||
int32_t receiveMessageLength;
|
||||
byte receiveMessage [NET_MAXMESSAGE];
|
||||
|
||||
struct qsockaddr addr;
|
||||
|
@ -161,67 +161,67 @@ typedef struct qsocket_s
|
|||
|
||||
extern qsocket_t *net_activeSockets;
|
||||
extern qsocket_t *net_freeSockets;
|
||||
extern int net_numsockets;
|
||||
extern int32_t net_numsockets;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
qboolean initialized;
|
||||
bool initialized;
|
||||
sys_socket_t controlSock;
|
||||
sys_socket_t (*Init) (void);
|
||||
void (*Shutdown) (void);
|
||||
void (*Listen) (qboolean state);
|
||||
sys_socket_t (*Open_Socket) (int port);
|
||||
int (*Close_Socket) (sys_socket_t socketid);
|
||||
int (*Connect) (sys_socket_t socketid, struct qsockaddr *addr);
|
||||
void (*Listen) (bool state);
|
||||
sys_socket_t (*Open_Socket) (int32_t port);
|
||||
int32_t (*Close_Socket) (sys_socket_t socketid);
|
||||
int32_t (*Connect) (sys_socket_t socketid, struct qsockaddr *addr);
|
||||
sys_socket_t (*CheckNewConnections) (void);
|
||||
int (*Read) (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int (*Write) (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int (*Broadcast) (sys_socket_t socketid, byte *buf, int len);
|
||||
int32_t (*Read) (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr);
|
||||
int32_t (*Write) (sys_socket_t socketid, byte *buf, int32_t len, struct qsockaddr *addr);
|
||||
int32_t (*Broadcast) (sys_socket_t socketid, byte *buf, int32_t len);
|
||||
const char * (*AddrToString) (struct qsockaddr *addr);
|
||||
int (*StringToAddr) (const char *string, struct qsockaddr *addr);
|
||||
int (*GetSocketAddr) (sys_socket_t socketid, struct qsockaddr *addr);
|
||||
int (*GetNameFromAddr) (struct qsockaddr *addr, char *name);
|
||||
int (*GetAddrFromName) (const char *name, struct qsockaddr *addr);
|
||||
int (*AddrCompare) (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int (*GetSocketPort) (struct qsockaddr *addr);
|
||||
int (*SetSocketPort) (struct qsockaddr *addr, int port);
|
||||
int32_t (*StringToAddr) (const char *string, struct qsockaddr *addr);
|
||||
int32_t (*GetSocketAddr) (sys_socket_t socketid, struct qsockaddr *addr);
|
||||
int32_t (*GetNameFromAddr) (struct qsockaddr *addr, char *name);
|
||||
int32_t (*GetAddrFromName) (const char *name, struct qsockaddr *addr);
|
||||
int32_t (*AddrCompare) (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int32_t (*GetSocketPort) (struct qsockaddr *addr);
|
||||
int32_t (*SetSocketPort) (struct qsockaddr *addr, int32_t port);
|
||||
} net_landriver_t;
|
||||
|
||||
#define MAX_NET_DRIVERS 8
|
||||
extern net_landriver_t net_landrivers[];
|
||||
extern const int net_numlandrivers;
|
||||
extern const int32_t net_numlandrivers;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
qboolean initialized;
|
||||
int (*Init) (void);
|
||||
void (*Listen) (qboolean state);
|
||||
void (*SearchForHosts) (qboolean xmit);
|
||||
bool initialized;
|
||||
int32_t (*Init) (void);
|
||||
void (*Listen) (bool state);
|
||||
void (*SearchForHosts) (bool xmit);
|
||||
qsocket_t *(*Connect) (const char *host);
|
||||
qsocket_t *(*CheckNewConnections) (void);
|
||||
int (*QGetMessage) (qsocket_t *sock);
|
||||
int (*QSendMessage) (qsocket_t *sock, sizebuf_t *data);
|
||||
int (*SendUnreliableMessage) (qsocket_t *sock, sizebuf_t *data);
|
||||
qboolean (*CanSendMessage) (qsocket_t *sock);
|
||||
qboolean (*CanSendUnreliableMessage) (qsocket_t *sock);
|
||||
int32_t (*QGetMessage) (qsocket_t *sock);
|
||||
int32_t (*QSendMessage) (qsocket_t *sock, sizebuf_t *data);
|
||||
int32_t (*SendUnreliableMessage) (qsocket_t *sock, sizebuf_t *data);
|
||||
bool (*CanSendMessage) (qsocket_t *sock);
|
||||
bool (*CanSendUnreliableMessage) (qsocket_t *sock);
|
||||
void (*Close) (qsocket_t *sock);
|
||||
void (*Shutdown) (void);
|
||||
} net_driver_t;
|
||||
|
||||
extern net_driver_t net_drivers[];
|
||||
extern const int net_numdrivers;
|
||||
extern const int32_t net_numdrivers;
|
||||
|
||||
/* Loop driver must always be registered the first */
|
||||
#define IS_LOOP_DRIVER(p) ((p) == 0)
|
||||
|
||||
extern int net_driverlevel;
|
||||
extern int32_t net_driverlevel;
|
||||
|
||||
extern int messagesSent;
|
||||
extern int messagesReceived;
|
||||
extern int unreliableMessagesSent;
|
||||
extern int unreliableMessagesReceived;
|
||||
extern int32_t messagesSent;
|
||||
extern int32_t messagesReceived;
|
||||
extern int32_t unreliableMessagesSent;
|
||||
extern int32_t unreliableMessagesReceived;
|
||||
|
||||
qsocket_t *NET_NewQSocket (void);
|
||||
void NET_FreeQSocket(qsocket_t *);
|
||||
|
@ -235,14 +235,14 @@ typedef struct
|
|||
char name[16];
|
||||
char map[16];
|
||||
char cname[32];
|
||||
int users;
|
||||
int maxusers;
|
||||
int driver;
|
||||
int ldriver;
|
||||
int32_t users;
|
||||
int32_t maxusers;
|
||||
int32_t driver;
|
||||
int32_t ldriver;
|
||||
struct qsockaddr addr;
|
||||
} hostcache_t;
|
||||
|
||||
extern int hostCacheCount;
|
||||
extern int32_t hostCacheCount;
|
||||
extern hostcache_t hostcache[HOSTCACHESIZE];
|
||||
|
||||
|
||||
|
|
|
@ -33,15 +33,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define sfunc net_landrivers[sock->landriver]
|
||||
#define dfunc net_landrivers[net_landriverlevel]
|
||||
|
||||
static int net_landriverlevel;
|
||||
static int32_t net_landriverlevel;
|
||||
|
||||
/* statistic counters */
|
||||
static int packetsSent = 0;
|
||||
static int packetsReSent = 0;
|
||||
static int packetsReceived = 0;
|
||||
static int receivedDuplicateCount = 0;
|
||||
static int shortPacketCount = 0;
|
||||
static int droppedDatagrams;
|
||||
static int32_t packetsSent = 0;
|
||||
static int32_t packetsReSent = 0;
|
||||
static int32_t packetsReceived = 0;
|
||||
static int32_t receivedDuplicateCount = 0;
|
||||
static int32_t shortPacketCount = 0;
|
||||
static int32_t droppedDatagrams;
|
||||
|
||||
static struct
|
||||
{
|
||||
|
@ -50,9 +50,9 @@ static struct
|
|||
byte data[MAX_DATAGRAM];
|
||||
} packetBuffer;
|
||||
|
||||
static int myDriverLevel;
|
||||
static int32_t myDriverLevel;
|
||||
|
||||
extern qboolean m_return_onerror;
|
||||
extern bool m_return_onerror;
|
||||
extern char m_return_reason[32];
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ static char *StrAddr (struct qsockaddr *addr)
|
|||
{
|
||||
static char buf[34];
|
||||
byte *p = (byte *)addr;
|
||||
int n;
|
||||
int32_t n;
|
||||
|
||||
for (n = 0; n < 16; n++)
|
||||
sprintf (buf + n * 2, "%02x", *p++);
|
||||
|
@ -129,7 +129,7 @@ static void NET_Ban_f (void)
|
|||
#endif // BAN_TEST
|
||||
|
||||
|
||||
int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
int32_t Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
{
|
||||
uint32_t packetLen;
|
||||
uint32_t dataLen;
|
||||
|
@ -140,7 +140,7 @@ int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
|||
Sys_Error("Datagram_SendMessage: zero length message\n");
|
||||
|
||||
if (data->cursize > NET_MAXMESSAGE)
|
||||
Sys_Error("Datagram_SendMessage: message too big %u\n", data->cursize);
|
||||
Sys_Error("Datagram_SendMessage: message too big %" PRIu32 "\n", data->cursize);
|
||||
|
||||
if (sock->canSend == false)
|
||||
Sys_Error("SendMessage: called with canSend == false\n");
|
||||
|
@ -176,7 +176,7 @@ int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
|||
}
|
||||
|
||||
|
||||
static int SendMessageNext (qsocket_t *sock)
|
||||
static int32_t SendMessageNext (qsocket_t *sock)
|
||||
{
|
||||
uint32_t packetLen;
|
||||
uint32_t dataLen;
|
||||
|
@ -209,7 +209,7 @@ static int SendMessageNext (qsocket_t *sock)
|
|||
}
|
||||
|
||||
|
||||
static int ReSendMessage (qsocket_t *sock)
|
||||
static int32_t ReSendMessage (qsocket_t *sock)
|
||||
{
|
||||
uint32_t packetLen;
|
||||
uint32_t dataLen;
|
||||
|
@ -242,7 +242,7 @@ static int ReSendMessage (qsocket_t *sock)
|
|||
}
|
||||
|
||||
|
||||
qboolean Datagram_CanSendMessage (qsocket_t *sock)
|
||||
bool Datagram_CanSendMessage (qsocket_t *sock)
|
||||
{
|
||||
if (sock->sendNext)
|
||||
SendMessageNext (sock);
|
||||
|
@ -251,23 +251,23 @@ qboolean Datagram_CanSendMessage (qsocket_t *sock)
|
|||
}
|
||||
|
||||
|
||||
qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock)
|
||||
bool Datagram_CanSendUnreliableMessage (qsocket_t *sock)
|
||||
{
|
||||
(void)sock;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
int32_t Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
{
|
||||
int packetLen;
|
||||
int32_t packetLen;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (data->cursize == 0)
|
||||
Sys_Error("Datagram_SendUnreliableMessage: zero length message\n");
|
||||
|
||||
if (data->cursize > MAX_DATAGRAM)
|
||||
Sys_Error("Datagram_SendUnreliableMessage: message too big %u\n", data->cursize);
|
||||
Sys_Error("Datagram_SendUnreliableMessage: message too big %" PRIu32 "\n", data->cursize);
|
||||
#endif
|
||||
|
||||
packetLen = NET_HEADERSIZE + data->cursize;
|
||||
|
@ -284,11 +284,11 @@ int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
|||
}
|
||||
|
||||
|
||||
int Datagram_GetMessage (qsocket_t *sock)
|
||||
int32_t Datagram_GetMessage (qsocket_t *sock)
|
||||
{
|
||||
uint32_t length;
|
||||
uint32_t flags;
|
||||
int ret = 0;
|
||||
int32_t ret = 0;
|
||||
struct qsockaddr readaddr;
|
||||
uint32_t sequence;
|
||||
uint32_t count;
|
||||
|
@ -350,7 +350,7 @@ int Datagram_GetMessage (qsocket_t *sock)
|
|||
{
|
||||
count = sequence - sock->unreliableReceiveSequence;
|
||||
droppedDatagrams += count;
|
||||
Con_DPrintf("Dropped %u datagram(s)\n", count);
|
||||
Con_DPrintf("Dropped %" PRIu32 " datagram(s)\n", count);
|
||||
}
|
||||
sock->unreliableReceiveSequence = sequence + 1;
|
||||
|
||||
|
@ -436,9 +436,9 @@ int Datagram_GetMessage (qsocket_t *sock)
|
|||
|
||||
static void PrintStats(qsocket_t *s)
|
||||
{
|
||||
Con_Printf("canSend = %4u \n", s->canSend);
|
||||
Con_Printf("sendSeq = %4u ", s->sendSequence);
|
||||
Con_Printf("recvSeq = %4u \n", s->receiveSequence);
|
||||
Con_Printf("canSend = %4" PRIu32 " \n", s->canSend);
|
||||
Con_Printf("sendSeq = %4" PRIu32 " ", s->sendSequence);
|
||||
Con_Printf("recvSeq = %4" PRIu32 " \n", s->receiveSequence);
|
||||
Con_Printf("\n");
|
||||
}
|
||||
|
||||
|
@ -448,16 +448,16 @@ static void NET_Stats_f (void)
|
|||
|
||||
if (Cmd_Argc () == 1)
|
||||
{
|
||||
Con_Printf("unreliable messages sent = %i\n", unreliableMessagesSent);
|
||||
Con_Printf("unreliable messages recv = %i\n", unreliableMessagesReceived);
|
||||
Con_Printf("reliable messages sent = %i\n", messagesSent);
|
||||
Con_Printf("reliable messages received = %i\n", messagesReceived);
|
||||
Con_Printf("packetsSent = %i\n", packetsSent);
|
||||
Con_Printf("packetsReSent = %i\n", packetsReSent);
|
||||
Con_Printf("packetsReceived = %i\n", packetsReceived);
|
||||
Con_Printf("receivedDuplicateCount = %i\n", receivedDuplicateCount);
|
||||
Con_Printf("shortPacketCount = %i\n", shortPacketCount);
|
||||
Con_Printf("droppedDatagrams = %i\n", droppedDatagrams);
|
||||
Con_Printf("unreliable messages sent = %" PRIi32 "\n", unreliableMessagesSent);
|
||||
Con_Printf("unreliable messages recv = %" PRIi32 "\n", unreliableMessagesReceived);
|
||||
Con_Printf("reliable messages sent = %" PRIi32 "\n", messagesSent);
|
||||
Con_Printf("reliable messages received = %" PRIi32 "\n", messagesReceived);
|
||||
Con_Printf("packetsSent = %" PRIi32 "\n", packetsSent);
|
||||
Con_Printf("packetsReSent = %" PRIi32 "\n", packetsReSent);
|
||||
Con_Printf("packetsReceived = %" PRIi32 "\n", packetsReceived);
|
||||
Con_Printf("receivedDuplicateCount = %" PRIi32 "\n", receivedDuplicateCount);
|
||||
Con_Printf("shortPacketCount = %" PRIi32 "\n", shortPacketCount);
|
||||
Con_Printf("droppedDatagrams = %" PRIi32 "\n", droppedDatagrams);
|
||||
}
|
||||
else if (Q_strcmp(Cmd_Argv(1), "*") == 0)
|
||||
{
|
||||
|
@ -497,7 +497,7 @@ static const char *Strip_Port (const char *host)
|
|||
static char noport[MAX_QPATH];
|
||||
/* array size as in Host_Connect_f() */
|
||||
char *p;
|
||||
int port;
|
||||
int32_t port;
|
||||
|
||||
if (!host || !*host)
|
||||
return host;
|
||||
|
@ -509,15 +509,15 @@ static const char *Strip_Port (const char *host)
|
|||
if (port > 0 && port < 65536 && port != net_hostport)
|
||||
{
|
||||
net_hostport = port;
|
||||
Con_Printf("Port set to %d\n", net_hostport);
|
||||
Con_Printf("Port set to %" PRIi32 "\n", net_hostport);
|
||||
}
|
||||
return noport;
|
||||
}
|
||||
|
||||
|
||||
static qboolean testInProgress = false;
|
||||
static int testPollCount;
|
||||
static int testDriver;
|
||||
static bool testInProgress = false;
|
||||
static int32_t testPollCount;
|
||||
static int32_t testDriver;
|
||||
static sys_socket_t testSocket;
|
||||
|
||||
static void Test_Poll (void *);
|
||||
|
@ -526,13 +526,13 @@ static PollProcedure testPollProcedure = {NULL, 0.0, Test_Poll};
|
|||
static void Test_Poll (void *unused)
|
||||
{
|
||||
struct qsockaddr clientaddr;
|
||||
int control;
|
||||
int len;
|
||||
int32_t control;
|
||||
int32_t len;
|
||||
char name[32];
|
||||
char address[64];
|
||||
int colors;
|
||||
int frags;
|
||||
int connectTime;
|
||||
int32_t colors;
|
||||
int32_t frags;
|
||||
int32_t connectTime;
|
||||
|
||||
(void)unused;
|
||||
|
||||
|
@ -541,17 +541,17 @@ static void Test_Poll (void *unused)
|
|||
while (1)
|
||||
{
|
||||
len = dfunc.Read (testSocket, net_message.data, net_message.maxsize, &clientaddr);
|
||||
if (len < (int) sizeof(int))
|
||||
if (len < (int32_t) sizeof(int32_t))
|
||||
break;
|
||||
|
||||
net_message.cursize = len;
|
||||
|
||||
MSG_BeginReading ();
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
control = BigLong(*((int32_t *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
if (control == -1)
|
||||
break;
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
|
||||
break;
|
||||
if ((control & NETFLAG_LENGTH_MASK) != len)
|
||||
break;
|
||||
|
@ -566,7 +566,7 @@ static void Test_Poll (void *unused)
|
|||
connectTime = MSG_ReadLong();
|
||||
Q_strcpy(address, MSG_ReadString());
|
||||
|
||||
Con_Printf("%s\n frags:%3i colors:%d %d time:%d\n %s\n", name, frags, colors >> 4, colors & 0x0f, connectTime / 60, address);
|
||||
Con_Printf("%s\n frags:%3" PRIi32 " colors:%" PRIi32 " %" PRIi32 " time:%" PRIi32 "\n %s\n", name, frags, colors >> 4, colors & 0x0f, connectTime / 60, address);
|
||||
}
|
||||
|
||||
testPollCount--;
|
||||
|
@ -584,8 +584,8 @@ static void Test_Poll (void *unused)
|
|||
static void Test_f (void)
|
||||
{
|
||||
const char *host;
|
||||
int n;
|
||||
int maxusers = MAX_SCOREBOARD;
|
||||
int32_t n;
|
||||
int32_t maxusers = MAX_SCOREBOARD;
|
||||
struct qsockaddr sendaddr;
|
||||
|
||||
if (testInProgress)
|
||||
|
@ -643,7 +643,7 @@ JustDoIt:
|
|||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREQ_PLAYER_INFO);
|
||||
MSG_WriteByte(&net_message, n);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (testSocket, net_message.data, net_message.cursize, &sendaddr);
|
||||
}
|
||||
SZ_Clear(&net_message);
|
||||
|
@ -651,8 +651,8 @@ JustDoIt:
|
|||
}
|
||||
|
||||
|
||||
static qboolean test2InProgress = false;
|
||||
static int test2Driver;
|
||||
static bool test2InProgress = false;
|
||||
static int32_t test2Driver;
|
||||
static sys_socket_t test2Socket;
|
||||
|
||||
static void Test2_Poll (void *);
|
||||
|
@ -661,8 +661,8 @@ static PollProcedure test2PollProcedure = {NULL, 0.0, Test2_Poll};
|
|||
static void Test2_Poll (void *unused)
|
||||
{
|
||||
struct qsockaddr clientaddr;
|
||||
int control;
|
||||
int len;
|
||||
int32_t control;
|
||||
int32_t len;
|
||||
char name[256];
|
||||
char value[256];
|
||||
|
||||
|
@ -672,17 +672,17 @@ static void Test2_Poll (void *unused)
|
|||
name[0] = 0;
|
||||
|
||||
len = dfunc.Read (test2Socket, net_message.data, net_message.maxsize, &clientaddr);
|
||||
if (len < (int) sizeof(int))
|
||||
if (len < (int32_t) sizeof(int32_t))
|
||||
goto Reschedule;
|
||||
|
||||
net_message.cursize = len;
|
||||
|
||||
MSG_BeginReading ();
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
control = BigLong(*((int32_t *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
if (control == -1)
|
||||
goto Error;
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
|
||||
goto Error;
|
||||
if ((control & NETFLAG_LENGTH_MASK) != len)
|
||||
goto Error;
|
||||
|
@ -702,7 +702,7 @@ static void Test2_Poll (void *unused)
|
|||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREQ_RULE_INFO);
|
||||
MSG_WriteString(&net_message, name);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (test2Socket, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
|
||||
|
@ -721,7 +721,7 @@ Done:
|
|||
static void Test2_f (void)
|
||||
{
|
||||
const char *host;
|
||||
int n;
|
||||
int32_t n;
|
||||
struct qsockaddr sendaddr;
|
||||
|
||||
if (test2InProgress)
|
||||
|
@ -776,16 +776,16 @@ JustDoIt:
|
|||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREQ_RULE_INFO);
|
||||
MSG_WriteString(&net_message, "");
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (test2Socket, net_message.data, net_message.cursize, &sendaddr);
|
||||
SZ_Clear(&net_message);
|
||||
SchedulePollProcedure(&test2PollProcedure, 0.05);
|
||||
}
|
||||
|
||||
|
||||
int Datagram_Init (void)
|
||||
int32_t Datagram_Init (void)
|
||||
{
|
||||
int i, num_inited;
|
||||
int32_t i, num_inited;
|
||||
sys_socket_t csock;
|
||||
|
||||
#ifdef BAN_TEST
|
||||
|
@ -825,7 +825,7 @@ int Datagram_Init (void)
|
|||
|
||||
void Datagram_Shutdown (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
//
|
||||
// shutdown the lan drivers
|
||||
|
@ -847,9 +847,9 @@ void Datagram_Close (qsocket_t *sock)
|
|||
}
|
||||
|
||||
|
||||
void Datagram_Listen (qboolean state)
|
||||
void Datagram_Listen (bool state)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < net_numlandrivers; i++)
|
||||
{
|
||||
|
@ -867,10 +867,10 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
sys_socket_t acceptsock;
|
||||
qsocket_t *sock;
|
||||
qsocket_t *s;
|
||||
int len;
|
||||
int command;
|
||||
int control;
|
||||
int ret;
|
||||
int32_t len;
|
||||
int32_t command;
|
||||
int32_t control;
|
||||
int32_t ret;
|
||||
|
||||
acceptsock = dfunc.CheckNewConnections();
|
||||
if (acceptsock == INVALID_SOCKET)
|
||||
|
@ -879,16 +879,16 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
SZ_Clear(&net_message);
|
||||
|
||||
len = dfunc.Read (acceptsock, net_message.data, net_message.maxsize, &clientaddr);
|
||||
if (len < (int) sizeof(int))
|
||||
if (len < (int32_t) sizeof(int32_t))
|
||||
return NULL;
|
||||
net_message.cursize = len;
|
||||
|
||||
MSG_BeginReading ();
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
control = BigLong(*((int32_t *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
if (control == -1)
|
||||
return NULL;
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
|
||||
return NULL;
|
||||
if ((control & NETFLAG_LENGTH_MASK) != len)
|
||||
return NULL;
|
||||
|
@ -910,7 +910,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
MSG_WriteByte(&net_message, net_activeconnections);
|
||||
MSG_WriteByte(&net_message, svs.maxclients);
|
||||
MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
return NULL;
|
||||
|
@ -918,9 +918,9 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
|
||||
if (command == CCREQ_PLAYER_INFO)
|
||||
{
|
||||
int playerNumber;
|
||||
int activeNumber;
|
||||
int clientNumber;
|
||||
int32_t playerNumber;
|
||||
int32_t activeNumber;
|
||||
int32_t clientNumber;
|
||||
client_t *client;
|
||||
|
||||
playerNumber = MSG_ReadByte();
|
||||
|
@ -946,10 +946,10 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
MSG_WriteByte(&net_message, playerNumber);
|
||||
MSG_WriteString(&net_message, client->name);
|
||||
MSG_WriteLong(&net_message, client->colors);
|
||||
MSG_WriteLong(&net_message, (int)client->edict->v.frags);
|
||||
MSG_WriteLong(&net_message, (int)(net_time - client->netconnection->connecttime));
|
||||
MSG_WriteLong(&net_message, (int32_t)client->edict->v.frags);
|
||||
MSG_WriteLong(&net_message, (int32_t)(net_time - client->netconnection->connecttime));
|
||||
MSG_WriteString(&net_message, client->netconnection->address);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
|
||||
|
@ -975,7 +975,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
MSG_WriteString(&net_message, var->name);
|
||||
MSG_WriteString(&net_message, var->string);
|
||||
}
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
|
||||
|
@ -995,7 +995,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_REJECT);
|
||||
MSG_WriteString(&net_message, "Incompatible version.\n");
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
return NULL;
|
||||
|
@ -1014,7 +1014,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_REJECT);
|
||||
MSG_WriteString(&net_message, "You have been banned.\n");
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
return NULL;
|
||||
|
@ -1040,7 +1040,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
MSG_WriteByte(&net_message, CCREP_ACCEPT);
|
||||
dfunc.GetSocketAddr(s->socket, &newaddr);
|
||||
MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr));
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
return NULL;
|
||||
|
@ -1062,7 +1062,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_REJECT);
|
||||
MSG_WriteString(&net_message, "Server is full.\n");
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
return NULL;
|
||||
|
@ -1098,7 +1098,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
dfunc.GetSocketAddr(newsock, &newaddr);
|
||||
MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr));
|
||||
// MSG_WriteString(&net_message, dfunc.AddrToString(&newaddr));
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
|
||||
|
@ -1121,14 +1121,14 @@ qsocket_t *Datagram_CheckNewConnections (void)
|
|||
}
|
||||
|
||||
|
||||
static void _Datagram_SearchForHosts (qboolean xmit)
|
||||
static void _Datagram_SearchForHosts (bool xmit)
|
||||
{
|
||||
int ret;
|
||||
int n;
|
||||
int i;
|
||||
int32_t ret;
|
||||
int32_t n;
|
||||
int32_t i;
|
||||
struct qsockaddr readaddr;
|
||||
struct qsockaddr myaddr;
|
||||
int control;
|
||||
int32_t control;
|
||||
|
||||
dfunc.GetSocketAddr (dfunc.controlSock, &myaddr);
|
||||
if (xmit)
|
||||
|
@ -1139,14 +1139,14 @@ static void _Datagram_SearchForHosts (qboolean xmit)
|
|||
MSG_WriteByte(&net_message, CCREQ_SERVER_INFO);
|
||||
MSG_WriteString(&net_message, "QUAKE");
|
||||
MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Broadcast(dfunc.controlSock, net_message.data, net_message.cursize);
|
||||
SZ_Clear(&net_message);
|
||||
}
|
||||
|
||||
while ((ret = dfunc.Read (dfunc.controlSock, net_message.data, net_message.maxsize, &readaddr)) > 0)
|
||||
{
|
||||
if (ret < (int) sizeof(int))
|
||||
if (ret < (int32_t) sizeof(int32_t))
|
||||
continue;
|
||||
net_message.cursize = ret;
|
||||
|
||||
|
@ -1159,11 +1159,11 @@ static void _Datagram_SearchForHosts (qboolean xmit)
|
|||
continue;
|
||||
|
||||
MSG_BeginReading ();
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
control = BigLong(*((int32_t *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
if (control == -1)
|
||||
continue;
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
|
||||
continue;
|
||||
if ((control & NETFLAG_LENGTH_MASK) != ret)
|
||||
continue;
|
||||
|
@ -1223,7 +1223,7 @@ static void _Datagram_SearchForHosts (qboolean xmit)
|
|||
}
|
||||
}
|
||||
|
||||
void Datagram_SearchForHosts (qboolean xmit)
|
||||
void Datagram_SearchForHosts (bool xmit)
|
||||
{
|
||||
for (net_landriverlevel = 0; net_landriverlevel < net_numlandrivers; net_landriverlevel++)
|
||||
{
|
||||
|
@ -1241,10 +1241,10 @@ static qsocket_t *_Datagram_Connect (const char *host)
|
|||
struct qsockaddr readaddr;
|
||||
qsocket_t *sock;
|
||||
sys_socket_t newsock;
|
||||
int ret;
|
||||
int reps;
|
||||
int32_t ret;
|
||||
int32_t reps;
|
||||
double start_time;
|
||||
int control;
|
||||
int32_t control;
|
||||
const char *reason;
|
||||
|
||||
// see if we can resolve the host name
|
||||
|
@ -1281,7 +1281,7 @@ static qsocket_t *_Datagram_Connect (const char *host)
|
|||
MSG_WriteByte(&net_message, CCREQ_CONNECT);
|
||||
MSG_WriteString(&net_message, "QUAKE");
|
||||
MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
*((int32_t *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (newsock, net_message.data, net_message.cursize, &sendaddr);
|
||||
SZ_Clear(&net_message);
|
||||
do
|
||||
|
@ -1301,7 +1301,7 @@ static qsocket_t *_Datagram_Connect (const char *host)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ret < (int) sizeof(int))
|
||||
if (ret < (int32_t) sizeof(int32_t))
|
||||
{
|
||||
ret = 0;
|
||||
continue;
|
||||
|
@ -1310,14 +1310,14 @@ static qsocket_t *_Datagram_Connect (const char *host)
|
|||
net_message.cursize = ret;
|
||||
MSG_BeginReading ();
|
||||
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
control = BigLong(*((int32_t *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
if (control == -1)
|
||||
{
|
||||
ret = 0;
|
||||
continue;
|
||||
}
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != (int32_t)NETFLAG_CTL)
|
||||
{
|
||||
ret = 0;
|
||||
continue;
|
||||
|
|
|
@ -22,16 +22,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef __NET_DATAGRAM_H
|
||||
#define __NET_DATAGRAM_H
|
||||
|
||||
int Datagram_Init (void);
|
||||
void Datagram_Listen (qboolean state);
|
||||
void Datagram_SearchForHosts (qboolean xmit);
|
||||
int32_t Datagram_Init (void);
|
||||
void Datagram_Listen (bool state);
|
||||
void Datagram_SearchForHosts (bool xmit);
|
||||
qsocket_t *Datagram_Connect (const char *host);
|
||||
qsocket_t *Datagram_CheckNewConnections (void);
|
||||
int Datagram_GetMessage (qsocket_t *sock);
|
||||
int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
qboolean Datagram_CanSendMessage (qsocket_t *sock);
|
||||
qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock);
|
||||
int32_t Datagram_GetMessage (qsocket_t *sock);
|
||||
int32_t Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
int32_t Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
bool Datagram_CanSendMessage (qsocket_t *sock);
|
||||
bool Datagram_CanSendUnreliableMessage (qsocket_t *sock);
|
||||
void Datagram_Close (qsocket_t *sock);
|
||||
void Datagram_Shutdown (void);
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "net_defs.h"
|
||||
#include "net_loop.h"
|
||||
|
||||
static qboolean localconnectpending = false;
|
||||
static bool localconnectpending = false;
|
||||
static qsocket_t *loop_client = NULL;
|
||||
static qsocket_t *loop_server = NULL;
|
||||
|
||||
int Loop_Init (void)
|
||||
int32_t Loop_Init (void)
|
||||
{
|
||||
if (cls.state == ca_dedicated)
|
||||
return -1;
|
||||
|
@ -43,13 +43,13 @@ void Loop_Shutdown (void)
|
|||
}
|
||||
|
||||
|
||||
void Loop_Listen (qboolean state)
|
||||
void Loop_Listen (bool state)
|
||||
{
|
||||
(void)state;
|
||||
}
|
||||
|
||||
|
||||
void Loop_SearchForHosts (qboolean xmit)
|
||||
void Loop_SearchForHosts (bool xmit)
|
||||
{
|
||||
(void)xmit;
|
||||
|
||||
|
@ -125,16 +125,16 @@ qsocket_t *Loop_CheckNewConnections (void)
|
|||
}
|
||||
|
||||
|
||||
static int IntAlign(int value)
|
||||
static int32_t IntAlign(int32_t value)
|
||||
{
|
||||
return (value + (sizeof(int) - 1)) & (~(sizeof(int) - 1));
|
||||
return (value + (sizeof(int32_t) - 1)) & (~(sizeof(int32_t) - 1));
|
||||
}
|
||||
|
||||
|
||||
int Loop_GetMessage (qsocket_t *sock)
|
||||
int32_t Loop_GetMessage (qsocket_t *sock)
|
||||
{
|
||||
int ret;
|
||||
int length;
|
||||
int32_t ret;
|
||||
int32_t length;
|
||||
|
||||
if (sock->receiveMessageLength == 0)
|
||||
return 0;
|
||||
|
@ -158,10 +158,10 @@ int Loop_GetMessage (qsocket_t *sock)
|
|||
}
|
||||
|
||||
|
||||
int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
int32_t Loop_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
{
|
||||
byte *buffer;
|
||||
int *bufferLength;
|
||||
int32_t *bufferLength;
|
||||
|
||||
if (!sock->driverdata)
|
||||
return -1;
|
||||
|
@ -192,10 +192,10 @@ int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
|||
}
|
||||
|
||||
|
||||
int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
int32_t Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
{
|
||||
byte *buffer;
|
||||
int *bufferLength;
|
||||
int32_t *bufferLength;
|
||||
|
||||
if (!sock->driverdata)
|
||||
return -1;
|
||||
|
@ -224,7 +224,7 @@ int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
|||
}
|
||||
|
||||
|
||||
qboolean Loop_CanSendMessage (qsocket_t *sock)
|
||||
bool Loop_CanSendMessage (qsocket_t *sock)
|
||||
{
|
||||
if (!sock->driverdata)
|
||||
return false;
|
||||
|
@ -232,7 +232,7 @@ qboolean Loop_CanSendMessage (qsocket_t *sock)
|
|||
}
|
||||
|
||||
|
||||
qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock)
|
||||
bool Loop_CanSendUnreliableMessage (qsocket_t *sock)
|
||||
{
|
||||
(void)sock;
|
||||
return true;
|
||||
|
|
|
@ -23,16 +23,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define __NET_LOOP_H
|
||||
|
||||
// net_loop.h
|
||||
int Loop_Init (void);
|
||||
void Loop_Listen (qboolean state);
|
||||
void Loop_SearchForHosts (qboolean xmit);
|
||||
int32_t Loop_Init (void);
|
||||
void Loop_Listen (bool state);
|
||||
void Loop_SearchForHosts (bool xmit);
|
||||
qsocket_t *Loop_Connect (const char *host);
|
||||
qsocket_t *Loop_CheckNewConnections (void);
|
||||
int Loop_GetMessage (qsocket_t *sock);
|
||||
int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
qboolean Loop_CanSendMessage (qsocket_t *sock);
|
||||
qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock);
|
||||
int32_t Loop_GetMessage (qsocket_t *sock);
|
||||
int32_t Loop_SendMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
int32_t Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
bool Loop_CanSendMessage (qsocket_t *sock);
|
||||
bool Loop_CanSendUnreliableMessage (qsocket_t *sock);
|
||||
void Loop_Close (qsocket_t *sock);
|
||||
void Loop_Shutdown (void);
|
||||
|
||||
|
|
|
@ -27,24 +27,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
qsocket_t *net_activeSockets = NULL;
|
||||
qsocket_t *net_freeSockets = NULL;
|
||||
int net_numsockets = 0;
|
||||
int32_t net_numsockets = 0;
|
||||
|
||||
qboolean ipxAvailable = false;
|
||||
qboolean tcpipAvailable = false;
|
||||
bool ipxAvailable = false;
|
||||
bool tcpipAvailable = false;
|
||||
|
||||
int net_hostport;
|
||||
int DEFAULTnet_hostport = 26000;
|
||||
int32_t net_hostport;
|
||||
int32_t DEFAULTnet_hostport = 26000;
|
||||
|
||||
char my_ipx_address[NET_NAMELEN];
|
||||
char my_tcpip_address[NET_NAMELEN];
|
||||
|
||||
static qboolean listening = false;
|
||||
static bool listening = false;
|
||||
|
||||
qboolean slistInProgress = false;
|
||||
qboolean slistSilent = false;
|
||||
qboolean slistLocal = true;
|
||||
bool slistInProgress = false;
|
||||
bool slistSilent = false;
|
||||
bool slistLocal = true;
|
||||
static double slistStartTime;
|
||||
static int slistLastShown;
|
||||
static int32_t slistLastShown;
|
||||
|
||||
static void Slist_Send (void *);
|
||||
static void Slist_Poll (void *);
|
||||
|
@ -52,12 +52,12 @@ static PollProcedure slistSendProcedure = {NULL, 0.0, Slist_Send};
|
|||
static PollProcedure slistPollProcedure = {NULL, 0.0, Slist_Poll};
|
||||
|
||||
sizebuf_t net_message;
|
||||
int net_activeconnections = 0;
|
||||
int32_t net_activeconnections = 0;
|
||||
|
||||
int messagesSent = 0;
|
||||
int messagesReceived = 0;
|
||||
int unreliableMessagesSent = 0;
|
||||
int unreliableMessagesReceived = 0;
|
||||
int32_t messagesSent = 0;
|
||||
int32_t messagesReceived = 0;
|
||||
int32_t unreliableMessagesSent = 0;
|
||||
int32_t unreliableMessagesReceived = 0;
|
||||
|
||||
static cvar_t net_messagetimeout = {"net_messagetimeout","300",CVAR_NONE};
|
||||
cvar_t hostname = {"hostname", "UNNAMED", CVAR_NONE};
|
||||
|
@ -66,7 +66,7 @@ cvar_t hostname = {"hostname", "UNNAMED", CVAR_NONE};
|
|||
#define sfunc net_drivers[sock->driver]
|
||||
#define dfunc net_drivers[net_driverlevel]
|
||||
|
||||
int net_driverlevel;
|
||||
int32_t net_driverlevel;
|
||||
|
||||
double net_time;
|
||||
|
||||
|
@ -170,7 +170,7 @@ static void NET_Listen_f (void)
|
|||
{
|
||||
if (Cmd_Argc () != 2)
|
||||
{
|
||||
Con_Printf ("\"listen\" is \"%d\"\n", listening ? 1 : 0);
|
||||
Con_Printf ("\"listen\" is \"%" PRIi32 "\"\n", listening ? 1 : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -187,11 +187,11 @@ static void NET_Listen_f (void)
|
|||
|
||||
static void MaxPlayers_f (void)
|
||||
{
|
||||
int n;
|
||||
int32_t n;
|
||||
|
||||
if (Cmd_Argc () != 2)
|
||||
{
|
||||
Con_Printf ("\"maxplayers\" is \"%d\"\n", svs.maxclients);
|
||||
Con_Printf ("\"maxplayers\" is \"%" PRIi32 "\"\n", svs.maxclients);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ static void MaxPlayers_f (void)
|
|||
if (n > svs.maxclientslimit)
|
||||
{
|
||||
n = svs.maxclientslimit;
|
||||
Con_Printf ("\"maxplayers\" set to \"%d\"\n", n);
|
||||
Con_Printf ("\"maxplayers\" set to \"%" PRIi32 "\"\n", n);
|
||||
}
|
||||
|
||||
if ((n == 1) && listening)
|
||||
|
@ -226,11 +226,11 @@ static void MaxPlayers_f (void)
|
|||
|
||||
static void NET_Port_f (void)
|
||||
{
|
||||
int n;
|
||||
int32_t n;
|
||||
|
||||
if (Cmd_Argc () != 2)
|
||||
{
|
||||
Con_Printf ("\"port\" is \"%d\"\n", net_hostport);
|
||||
Con_Printf ("\"port\" is \"%" PRIi32 "\"\n", net_hostport);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -263,12 +263,12 @@ static void PrintSlistHeader(void)
|
|||
|
||||
static void PrintSlist(void)
|
||||
{
|
||||
int n;
|
||||
int32_t n;
|
||||
|
||||
for (n = slistLastShown; n < hostCacheCount; n++)
|
||||
{
|
||||
if (hostcache[n].maxusers)
|
||||
Con_Printf("%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
|
||||
Con_Printf("%-15.15s %-15.15s %2" PRIu32 "/%2" PRIu32 "\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
|
||||
else
|
||||
Con_Printf("%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ void NET_SlistSort (void)
|
|||
{
|
||||
if (hostCacheCount > 1)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
hostcache_t temp;
|
||||
for (i = 0; i < hostCacheCount; i++)
|
||||
{
|
||||
|
@ -328,7 +328,7 @@ void NET_SlistSort (void)
|
|||
}
|
||||
|
||||
|
||||
const char *NET_SlistPrintServer (int idx)
|
||||
const char *NET_SlistPrintServer (int32_t idx)
|
||||
{
|
||||
static char string[64];
|
||||
|
||||
|
@ -337,7 +337,7 @@ const char *NET_SlistPrintServer (int idx)
|
|||
|
||||
if (hostcache[idx].maxusers)
|
||||
{
|
||||
q_snprintf(string, sizeof(string), "%-15.15s %-15.15s %2u/%2u\n",
|
||||
q_snprintf(string, sizeof(string), "%-15.15s %-15.15s %2" PRIu32 "/%2" PRIu32 "\n",
|
||||
hostcache[idx].name, hostcache[idx].map,
|
||||
hostcache[idx].users, hostcache[idx].maxusers);
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ const char *NET_SlistPrintServer (int idx)
|
|||
}
|
||||
|
||||
|
||||
const char *NET_SlistPrintServerName (int idx)
|
||||
const char *NET_SlistPrintServerName (int32_t idx)
|
||||
{
|
||||
if (idx < 0 || idx >= hostCacheCount)
|
||||
return "";
|
||||
|
@ -411,14 +411,14 @@ NET_Connect
|
|||
===================
|
||||
*/
|
||||
|
||||
int hostCacheCount = 0;
|
||||
int32_t hostCacheCount = 0;
|
||||
hostcache_t hostcache[HOSTCACHESIZE];
|
||||
|
||||
qsocket_t *NET_Connect (const char *host)
|
||||
{
|
||||
qsocket_t *ret;
|
||||
int n;
|
||||
int numdrivers = net_numdrivers;
|
||||
int32_t n;
|
||||
int32_t numdrivers = net_numdrivers;
|
||||
|
||||
SetNetTime();
|
||||
|
||||
|
@ -554,9 +554,9 @@ returns 1 if a message was received
|
|||
returns -1 if connection is invalid
|
||||
=================
|
||||
*/
|
||||
int NET_GetMessage (qsocket_t *sock)
|
||||
int32_t NET_GetMessage (qsocket_t *sock)
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
|
||||
if (!sock)
|
||||
return -1;
|
||||
|
@ -608,9 +608,9 @@ returns 1 if the message was sent properly
|
|||
returns -1 if the connection died
|
||||
==================
|
||||
*/
|
||||
int NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
int32_t NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
{
|
||||
int r;
|
||||
int32_t r;
|
||||
|
||||
if (!sock)
|
||||
return -1;
|
||||
|
@ -630,9 +630,9 @@ int NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
|||
}
|
||||
|
||||
|
||||
int NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
int32_t NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
{
|
||||
int r;
|
||||
int32_t r;
|
||||
|
||||
if (!sock)
|
||||
return -1;
|
||||
|
@ -660,7 +660,7 @@ Returns true or false if the given qsocket can currently accept a
|
|||
message to be transmitted.
|
||||
==================
|
||||
*/
|
||||
qboolean NET_CanSendMessage (qsocket_t *sock)
|
||||
bool NET_CanSendMessage (qsocket_t *sock)
|
||||
{
|
||||
if (!sock)
|
||||
return false;
|
||||
|
@ -674,13 +674,13 @@ qboolean NET_CanSendMessage (qsocket_t *sock)
|
|||
}
|
||||
|
||||
|
||||
int NET_SendToAll (sizebuf_t *data, double blocktime)
|
||||
int32_t NET_SendToAll (sizebuf_t *data, double blocktime)
|
||||
{
|
||||
double start;
|
||||
int i;
|
||||
int count = 0;
|
||||
qboolean msg_init[MAX_SCOREBOARD]; /* did we write the message to the client's connection */
|
||||
qboolean msg_sent[MAX_SCOREBOARD]; /* did the msg arrive its destination (canSend state). */
|
||||
int32_t i;
|
||||
int32_t count = 0;
|
||||
bool msg_init[MAX_SCOREBOARD]; /* did we write the message to the client's connection */
|
||||
bool msg_sent[MAX_SCOREBOARD]; /* did the msg arrive its destination (canSend state). */
|
||||
|
||||
for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++)
|
||||
{
|
||||
|
@ -761,7 +761,7 @@ NET_Init
|
|||
|
||||
void NET_Init (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
qsocket_t *s;
|
||||
|
||||
i = COM_CheckParm ("-port");
|
||||
|
|
|
@ -61,15 +61,10 @@
|
|||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
||||
typedef int sys_socket_t;
|
||||
typedef int32_t sys_socket_t;
|
||||
#define INVALID_SOCKET (-1)
|
||||
#define SOCKET_ERROR (-1)
|
||||
|
||||
#if defined(__APPLE__) && defined(SO_NKE) && !defined(SO_NOADDRERR)
|
||||
/* ancient Mac OS X SDKs 10.2 and older are missing socklen_t */
|
||||
typedef int socklen_t; /* defining as signed int to match the old api */
|
||||
#endif /* ancient OSX SDKs */
|
||||
|
||||
#define SOCKETERRNO errno
|
||||
#define ioctlsocket ioctl
|
||||
#define closesocket close
|
||||
|
@ -100,20 +95,11 @@ _Static_assert(offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET,
|
|||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
||||
typedef int sys_socket_t;
|
||||
typedef int32_t sys_socket_t;
|
||||
#define INVALID_SOCKET (-1)
|
||||
#define SOCKET_ERROR (-1)
|
||||
|
||||
#if !(defined(__AROS__) || defined(__amigaos4__))
|
||||
typedef LONG socklen_t; /* int32_t */
|
||||
#endif
|
||||
#if !defined(__amigaos4__)
|
||||
#if (LONG_MAX <= 2147483647L)
|
||||
typedef unsigned long in_addr_t; /* u_int32_t */
|
||||
#else
|
||||
typedef uint32_t in_addr_t; /* u_int32_t */
|
||||
#endif
|
||||
#endif
|
||||
typedef uint32_t in_addr_t;
|
||||
|
||||
#define SOCKETERRNO Errno()
|
||||
#define ioctlsocket IoctlSocket
|
||||
|
@ -156,7 +142,7 @@ typedef u_long in_addr_t; /* uint32_t */
|
|||
|
||||
/* on windows, socklen_t is to be a winsock2 thing */
|
||||
#if !defined(IP_MSFILTER_SIZE)
|
||||
typedef int socklen_t;
|
||||
typedef int32_t socklen_t;
|
||||
#endif /* socklen_t type */
|
||||
|
||||
typedef SOCKET sys_socket_t;
|
||||
|
|
112
source/pr_cmds.c
112
source/pr_cmds.c
|
@ -32,7 +32,7 @@ static char *PR_GetTempString (void)
|
|||
return pr_string_temp[(STRINGTEMP_BUFFERS-1) & ++pr_string_tempindex];
|
||||
}
|
||||
|
||||
#define RETURN_EDICT(e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e))
|
||||
#define RETURN_EDICT(e) (((int32_t *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e))
|
||||
|
||||
#define MSG_BROADCAST 0 // unreliable to all
|
||||
#define MSG_ONE 1 // reliable to one (msg_entity)
|
||||
|
@ -47,9 +47,9 @@ static char *PR_GetTempString (void)
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
static char *PF_VarString (int first)
|
||||
static char *PF_VarString (int32_t first)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
static char out[1024];
|
||||
size_t s;
|
||||
|
||||
|
@ -68,7 +68,7 @@ static char *PF_VarString (int first)
|
|||
{
|
||||
if (!dev_overflows.varstring || dev_overflows.varstring + CONSOLE_RESPAM_TIME < realtime)
|
||||
{
|
||||
Con_DWarning("PF_VarString: %i characters exceeds standard limit of 255 (max = %d).\n", (int) s, (int)(sizeof(out) - 1));
|
||||
Con_DWarning("PF_VarString: %" PRIi32 " characters exceeds standard limit of 255 (max = %" PRIi32 ").\n", (int32_t) s, (int32_t)(sizeof(out) - 1));
|
||||
dev_overflows.varstring = realtime;
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ static void PF_setorigin (void)
|
|||
}
|
||||
|
||||
|
||||
static void SetMinMaxSize (edict_t *e, float *minvec, float *maxvec, qboolean rotate)
|
||||
static void SetMinMaxSize (edict_t *e, float *minvec, float *maxvec, bool rotate)
|
||||
{
|
||||
float *angles;
|
||||
vec3_t rmin, rmax;
|
||||
|
@ -174,7 +174,7 @@ static void SetMinMaxSize (edict_t *e, float *minvec, float *maxvec, qboolean ro
|
|||
float xvector[2], yvector[2];
|
||||
float a;
|
||||
vec3_t base, transformed;
|
||||
int i, j, k, l;
|
||||
int32_t i, j, k, l;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (minvec[i] > maxvec[i])
|
||||
|
@ -270,7 +270,7 @@ setmodel(entity, model)
|
|||
*/
|
||||
static void PF_setmodel (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
const char *m, **check;
|
||||
qmodel_t *mod;
|
||||
edict_t *e;
|
||||
|
@ -292,7 +292,7 @@ static void PF_setmodel (void)
|
|||
e->v.model = PR_SetEngineString(*check);
|
||||
e->v.modelindex = i; //SV_ModelIndex (m);
|
||||
|
||||
mod = sv.models[ (int)e->v.modelindex]; // Mod_ForName (m, true);
|
||||
mod = sv.models[ (int32_t)e->v.modelindex]; // Mod_ForName (m, true);
|
||||
|
||||
if (mod)
|
||||
//johnfitz -- correct physics cullboxes for bmodels
|
||||
|
@ -337,7 +337,7 @@ static void PF_sprint (void)
|
|||
{
|
||||
char *s;
|
||||
client_t *client;
|
||||
int entnum;
|
||||
int32_t entnum;
|
||||
|
||||
entnum = G_EDICTNUM(OFS_PARM0);
|
||||
s = PF_VarString(1);
|
||||
|
@ -368,7 +368,7 @@ static void PF_centerprint (void)
|
|||
{
|
||||
char *s;
|
||||
client_t *client;
|
||||
int entnum;
|
||||
int32_t entnum;
|
||||
|
||||
entnum = G_EDICTNUM(OFS_PARM0);
|
||||
s = PF_VarString(1);
|
||||
|
@ -455,7 +455,7 @@ static void PF_vectoyaw (void)
|
|||
yaw = 0;
|
||||
else
|
||||
{
|
||||
yaw = (int) (atan2(value1[1], value1[0]) * 180 / M_PI);
|
||||
yaw = (int32_t) (atan2(value1[1], value1[0]) * 180 / M_PI);
|
||||
if (yaw < 0)
|
||||
yaw += 360;
|
||||
}
|
||||
|
@ -489,12 +489,12 @@ static void PF_vectoangles (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
yaw = (int) (atan2(value1[1], value1[0]) * 180 / M_PI);
|
||||
yaw = (int32_t) (atan2(value1[1], value1[0]) * 180 / M_PI);
|
||||
if (yaw < 0)
|
||||
yaw += 360;
|
||||
|
||||
forward = sqrt (value1[0]*value1[0] + value1[1]*value1[1]);
|
||||
pitch = (int) (atan2(value1[2], forward) * 180 / M_PI);
|
||||
pitch = (int32_t) (atan2(value1[2], forward) * 180 / M_PI);
|
||||
if (pitch < 0)
|
||||
pitch += 360;
|
||||
}
|
||||
|
@ -554,8 +554,8 @@ static void PF_ambientsound (void)
|
|||
const char *samp, **check;
|
||||
float *pos;
|
||||
float vol, attenuation;
|
||||
int i, soundnum;
|
||||
int large = false; //johnfitz -- PROTOCOL_FITZQUAKE
|
||||
int32_t i, soundnum;
|
||||
int32_t large = false; //johnfitz -- PROTOCOL_FITZQUAKE
|
||||
|
||||
pos = G_VECTOR (OFS_PARM0);
|
||||
samp = G_STRING(OFS_PARM1);
|
||||
|
@ -627,9 +627,9 @@ Larger attenuations will drop off.
|
|||
static void PF_sound (void)
|
||||
{
|
||||
const char *sample;
|
||||
int channel;
|
||||
int32_t channel;
|
||||
edict_t *entity;
|
||||
int volume;
|
||||
int32_t volume;
|
||||
float attenuation;
|
||||
|
||||
entity = G_EDICT(OFS_PARM0);
|
||||
|
@ -639,13 +639,13 @@ static void PF_sound (void)
|
|||
attenuation = G_FLOAT(OFS_PARM4);
|
||||
|
||||
if (volume < 0 || volume > 255)
|
||||
Host_Error ("SV_StartSound: volume = %i", volume);
|
||||
Host_Error ("SV_StartSound: volume = %" PRIi32 "", volume);
|
||||
|
||||
if (attenuation < 0 || attenuation > 4)
|
||||
Host_Error ("SV_StartSound: attenuation = %f", attenuation);
|
||||
|
||||
if (channel < 0 || channel > 7)
|
||||
Host_Error ("SV_StartSound: channel = %i", channel);
|
||||
Host_Error ("SV_StartSound: channel = %" PRIi32 "", channel);
|
||||
|
||||
SV_StartSound (entity, channel, sample, volume, attenuation);
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ break()
|
|||
static void PF_break (void)
|
||||
{
|
||||
Con_Printf ("break statement\n");
|
||||
*(int *)-4 = 0; // dump to debugger
|
||||
*(int32_t *)-4 = 0; // dump to debugger
|
||||
// PR_RunError ("break statement");
|
||||
}
|
||||
|
||||
|
@ -679,7 +679,7 @@ static void PF_traceline (void)
|
|||
{
|
||||
float *v1, *v2;
|
||||
trace_t trace;
|
||||
int nomonsters;
|
||||
int32_t nomonsters;
|
||||
edict_t *ent;
|
||||
|
||||
v1 = G_VECTOR(OFS_PARM0);
|
||||
|
@ -691,7 +691,7 @@ static void PF_traceline (void)
|
|||
if (developer.value) {
|
||||
if (IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) ||
|
||||
IS_NAN(v2[0]) || IS_NAN(v2[1]) || IS_NAN(v2[2])) {
|
||||
Con_Warning ("NAN in traceline:\nv1(%f %f %f) v2(%f %f %f)\nentity %d\n",
|
||||
Con_Warning ("NAN in traceline:\nv1(%f %f %f) v2(%f %f %f)\nentity %" PRIi32 "\n",
|
||||
v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], NUM_FOR_EDICT(ent));
|
||||
}
|
||||
}
|
||||
|
@ -736,16 +736,16 @@ static void PF_checkpos (void)
|
|||
//============================================================================
|
||||
|
||||
static byte *checkpvs; //ericw -- changed to malloc
|
||||
static int checkpvs_capacity;
|
||||
static int32_t checkpvs_capacity;
|
||||
|
||||
static int PF_newcheckclient (int check)
|
||||
static int32_t PF_newcheckclient (int32_t check)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
byte *pvs;
|
||||
edict_t *ent;
|
||||
mleaf_t *leaf;
|
||||
vec3_t org;
|
||||
int pvsbytes;
|
||||
int32_t pvsbytes;
|
||||
|
||||
// cycle to the next one
|
||||
|
||||
|
@ -773,7 +773,7 @@ static int PF_newcheckclient (int check)
|
|||
continue;
|
||||
if (ent->v.health <= 0)
|
||||
continue;
|
||||
if ((int)ent->v.flags & FL_NOTARGET)
|
||||
if ((int32_t)ent->v.flags & FL_NOTARGET)
|
||||
continue;
|
||||
|
||||
// anything that is a client, or has a client as an enemy
|
||||
|
@ -791,7 +791,7 @@ static int PF_newcheckclient (int check)
|
|||
checkpvs_capacity = pvsbytes;
|
||||
checkpvs = (byte *) realloc (checkpvs, checkpvs_capacity);
|
||||
if (!checkpvs)
|
||||
Sys_Error ("PF_newcheckclient: realloc() failed on %d bytes", checkpvs_capacity);
|
||||
Sys_Error ("PF_newcheckclient: realloc() failed on %" PRIi32 " bytes", checkpvs_capacity);
|
||||
}
|
||||
memcpy (checkpvs, pvs, pvsbytes);
|
||||
|
||||
|
@ -814,12 +814,12 @@ name checkclient ()
|
|||
=================
|
||||
*/
|
||||
#define MAX_CHECK 16
|
||||
static int c_invis, c_notvis;
|
||||
static int32_t c_invis, c_notvis;
|
||||
static void PF_checkclient (void)
|
||||
{
|
||||
edict_t *ent, *self;
|
||||
mleaf_t *leaf;
|
||||
int l;
|
||||
int32_t l;
|
||||
vec3_t view;
|
||||
|
||||
// find a new check if on a new frame
|
||||
|
@ -868,7 +868,7 @@ stuffcmd (clientent, value)
|
|||
*/
|
||||
static void PF_stuffcmd (void)
|
||||
{
|
||||
int entnum;
|
||||
int32_t entnum;
|
||||
const char *str;
|
||||
client_t *old;
|
||||
|
||||
|
@ -948,7 +948,7 @@ static void PF_findradius (void)
|
|||
float rad;
|
||||
float *org;
|
||||
vec3_t eorg;
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
|
||||
chain = (edict_t *)sv.edicts;
|
||||
|
||||
|
@ -991,8 +991,8 @@ static void PF_ftos (void)
|
|||
|
||||
v = G_FLOAT(OFS_PARM0);
|
||||
s = PR_GetTempString();
|
||||
if (v == (int)v)
|
||||
sprintf (s, "%d",(int)v);
|
||||
if (v == (int32_t)v)
|
||||
sprintf (s, "%" PRIi32 "",(int32_t)v);
|
||||
else
|
||||
sprintf (s, "%5.1f",v);
|
||||
G_INT(OFS_RETURN) = PR_SetEngineString(s);
|
||||
|
@ -1035,8 +1035,8 @@ static void PF_Remove (void)
|
|||
// entity (entity start, .string field, string match) find = #5;
|
||||
static void PF_Find (void)
|
||||
{
|
||||
int e;
|
||||
int f;
|
||||
int32_t e;
|
||||
int32_t f;
|
||||
const char *s, *t;
|
||||
edict_t *ed;
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ static void PF_precache_file (void)
|
|||
static void PF_precache_sound (void)
|
||||
{
|
||||
const char *s;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (sv.state != ss_loading)
|
||||
PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions");
|
||||
|
@ -1103,7 +1103,7 @@ static void PF_precache_sound (void)
|
|||
static void PF_precache_model (void)
|
||||
{
|
||||
const char *s;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (sv.state != ss_loading)
|
||||
PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions");
|
||||
|
@ -1160,13 +1160,13 @@ static void PF_walkmove (void)
|
|||
float yaw, dist;
|
||||
vec3_t move;
|
||||
dfunction_t *oldf;
|
||||
int oldself;
|
||||
int32_t oldself;
|
||||
|
||||
ent = PROG_TO_EDICT(pr_global_struct->self);
|
||||
yaw = G_FLOAT(OFS_PARM0);
|
||||
dist = G_FLOAT(OFS_PARM1);
|
||||
|
||||
if ( !( (int)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) )
|
||||
if ( !( (int32_t)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) )
|
||||
{
|
||||
G_FLOAT(OFS_RETURN) = 0;
|
||||
return;
|
||||
|
@ -1216,7 +1216,7 @@ static void PF_droptofloor (void)
|
|||
{
|
||||
VectorCopy (trace.endpos, ent->v.origin);
|
||||
SV_LinkEdict (ent, false);
|
||||
ent->v.flags = (int)ent->v.flags | FL_ONGROUND;
|
||||
ent->v.flags = (int32_t)ent->v.flags | FL_ONGROUND;
|
||||
ent->v.groundentity = EDICT_TO_PROG(trace.ent);
|
||||
G_FLOAT(OFS_RETURN) = 1;
|
||||
}
|
||||
|
@ -1231,10 +1231,10 @@ void(float style, string value) lightstyle
|
|||
*/
|
||||
static void PF_lightstyle (void)
|
||||
{
|
||||
int style;
|
||||
int32_t style;
|
||||
const char *val;
|
||||
client_t *client;
|
||||
int j;
|
||||
int32_t j;
|
||||
|
||||
style = G_FLOAT(OFS_PARM0);
|
||||
val = G_STRING(OFS_PARM1);
|
||||
|
@ -1242,7 +1242,7 @@ static void PF_lightstyle (void)
|
|||
// bounds check to avoid clobbering sv struct
|
||||
if (style < 0 || style >= MAX_LIGHTSTYLES)
|
||||
{
|
||||
Con_DWarning("PF_lightstyle: invalid style %d\n", style);
|
||||
Con_DWarning("PF_lightstyle: invalid style %" PRIi32 "\n", style);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1269,9 +1269,9 @@ static void PF_rint (void)
|
|||
float f;
|
||||
f = G_FLOAT(OFS_PARM0);
|
||||
if (f > 0)
|
||||
G_FLOAT(OFS_RETURN) = (int)(f + 0.5);
|
||||
G_FLOAT(OFS_RETURN) = (int32_t)(f + 0.5);
|
||||
else
|
||||
G_FLOAT(OFS_RETURN) = (int)(f - 0.5);
|
||||
G_FLOAT(OFS_RETURN) = (int32_t)(f - 0.5);
|
||||
}
|
||||
|
||||
static void PF_floor (void)
|
||||
|
@ -1322,7 +1322,7 @@ entity nextent(entity)
|
|||
*/
|
||||
static void PF_nextent (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
edict_t *ent;
|
||||
|
||||
i = G_EDICTNUM(OFS_PARM0);
|
||||
|
@ -1356,7 +1356,7 @@ static void PF_aim (void)
|
|||
{
|
||||
edict_t *ent, *check, *bestent;
|
||||
vec3_t start, dir, end, bestdir;
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
trace_t tr;
|
||||
float dist, bestdist;
|
||||
float speed;
|
||||
|
@ -1477,8 +1477,8 @@ MESSAGE WRITING
|
|||
|
||||
static sizebuf_t *WriteDest (void)
|
||||
{
|
||||
int entnum;
|
||||
int dest;
|
||||
int32_t entnum;
|
||||
int32_t dest;
|
||||
edict_t *ent;
|
||||
|
||||
dest = G_FLOAT(OFS_PARM0);
|
||||
|
@ -1553,8 +1553,8 @@ static void PF_WriteEntity (void)
|
|||
static void PF_makestatic (void)
|
||||
{
|
||||
edict_t *ent;
|
||||
int i;
|
||||
int bits = 0; //johnfitz -- PROTOCOL_FITZQUAKE
|
||||
int32_t i;
|
||||
int32_t bits = 0; //johnfitz -- PROTOCOL_FITZQUAKE
|
||||
|
||||
ent = G_EDICT(OFS_PARM0);
|
||||
|
||||
|
@ -1568,7 +1568,7 @@ static void PF_makestatic (void)
|
|||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
if (sv.protocol == PROTOCOL_NETQUAKE)
|
||||
{
|
||||
if (SV_ModelIndex(PR_GetString(ent->v.model)) & 0xFF00 || (int)(ent->v.frame) & 0xFF00)
|
||||
if (SV_ModelIndex(PR_GetString(ent->v.model)) & 0xFF00 || (int32_t)(ent->v.frame) & 0xFF00)
|
||||
{
|
||||
ED_Free (ent);
|
||||
return; //can't display the correct model & frame, so don't show it at all
|
||||
|
@ -1578,7 +1578,7 @@ static void PF_makestatic (void)
|
|||
{
|
||||
if (SV_ModelIndex(PR_GetString(ent->v.model)) & 0xFF00)
|
||||
bits |= B_LARGEMODEL;
|
||||
if ((int)(ent->v.frame) & 0xFF00)
|
||||
if ((int32_t)(ent->v.frame) & 0xFF00)
|
||||
bits |= B_LARGEFRAME;
|
||||
if (ent->alpha != ENTALPHA_DEFAULT)
|
||||
bits |= B_ALPHA;
|
||||
|
@ -1630,7 +1630,7 @@ PF_setspawnparms
|
|||
static void PF_setspawnparms (void)
|
||||
{
|
||||
edict_t *ent;
|
||||
int i;
|
||||
int32_t i;
|
||||
client_t *client;
|
||||
|
||||
ent = G_EDICT(OFS_PARM0);
|
||||
|
@ -1761,5 +1761,5 @@ static builtin_t pr_builtin[] =
|
|||
};
|
||||
|
||||
builtin_t *pr_builtins = pr_builtin;
|
||||
int pr_numbuiltins = sizeof(pr_builtin)/sizeof(pr_builtin[0]);
|
||||
int32_t pr_numbuiltins = sizeof(pr_builtin)/sizeof(pr_builtin[0]);
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
// this file is shared by quake and qcc
|
||||
|
||||
typedef int func_t;
|
||||
typedef int string_t;
|
||||
typedef int32_t func_t;
|
||||
typedef int32_t string_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ typedef struct
|
|||
uint16_t type; // if DEF_SAVEGLOBAL bit is set
|
||||
// the variable needs to be saved in savegames
|
||||
uint16_t ofs;
|
||||
int s_name;
|
||||
int32_t s_name;
|
||||
} ddef_t;
|
||||
|
||||
#define DEF_SAVEGLOBAL (1<<15)
|
||||
|
@ -152,16 +152,16 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int first_statement; // negative numbers are builtins
|
||||
int parm_start;
|
||||
int locals; // total ints of parms + locals
|
||||
int32_t first_statement; // negative numbers are builtins
|
||||
int32_t parm_start;
|
||||
int32_t locals; // total ints of parms + locals
|
||||
|
||||
int profile; // runtime
|
||||
int32_t profile; // runtime
|
||||
|
||||
int s_name;
|
||||
int s_file; // source file defined in
|
||||
int32_t s_name;
|
||||
int32_t s_file; // source file defined in
|
||||
|
||||
int numparms;
|
||||
int32_t numparms;
|
||||
byte parm_size[MAX_PARMS];
|
||||
} dfunction_t;
|
||||
|
||||
|
@ -169,28 +169,28 @@ typedef struct
|
|||
#define PROG_VERSION 6
|
||||
typedef struct
|
||||
{
|
||||
int version;
|
||||
int crc; // check of header file
|
||||
int32_t version;
|
||||
int32_t crc; // check of header file
|
||||
|
||||
int ofs_statements;
|
||||
int numstatements; // statement 0 is an error
|
||||
int32_t ofs_statements;
|
||||
int32_t numstatements; // statement 0 is an error
|
||||
|
||||
int ofs_globaldefs;
|
||||
int numglobaldefs;
|
||||
int32_t ofs_globaldefs;
|
||||
int32_t numglobaldefs;
|
||||
|
||||
int ofs_fielddefs;
|
||||
int numfielddefs;
|
||||
int32_t ofs_fielddefs;
|
||||
int32_t numfielddefs;
|
||||
|
||||
int ofs_functions;
|
||||
int numfunctions; // function 0 is an empty
|
||||
int32_t ofs_functions;
|
||||
int32_t numfunctions; // function 0 is an empty
|
||||
|
||||
int ofs_strings;
|
||||
int numstrings; // first string is a null string
|
||||
int32_t ofs_strings;
|
||||
int32_t numstrings; // first string is a null string
|
||||
|
||||
int ofs_globals;
|
||||
int numglobals;
|
||||
int32_t ofs_globals;
|
||||
int32_t numglobals;
|
||||
|
||||
int entityfields;
|
||||
int32_t entityfields;
|
||||
} dprograms_t;
|
||||
|
||||
#endif /* __PR_COMP_H */
|
||||
|
|
|
@ -27,23 +27,23 @@ dprograms_t *progs;
|
|||
dfunction_t *pr_functions;
|
||||
|
||||
static char *pr_strings;
|
||||
static int pr_stringssize;
|
||||
static int32_t pr_stringssize;
|
||||
static const char **pr_knownstrings;
|
||||
static int pr_maxknownstrings;
|
||||
static int pr_numknownstrings;
|
||||
static int32_t pr_maxknownstrings;
|
||||
static int32_t pr_numknownstrings;
|
||||
static ddef_t *pr_fielddefs;
|
||||
static ddef_t *pr_globaldefs;
|
||||
|
||||
qboolean pr_alpha_supported; //johnfitz
|
||||
bool pr_alpha_supported; //johnfitz
|
||||
|
||||
dstatement_t *pr_statements;
|
||||
globalvars_t *pr_global_struct;
|
||||
float *pr_globals; // same as pr_global_struct
|
||||
int pr_edict_size; // in bytes
|
||||
int32_t pr_edict_size; // in bytes
|
||||
|
||||
uint16_t pr_crc;
|
||||
|
||||
int type_size[8] = {
|
||||
int32_t type_size[8] = {
|
||||
1, // ev_void
|
||||
1, // sizeof(string_t) / 4 // ev_string
|
||||
1, // ev_float
|
||||
|
@ -54,8 +54,8 @@ int type_size[8] = {
|
|||
1 // sizeof(void *) / 4 // ev_pointer
|
||||
};
|
||||
|
||||
static ddef_t *ED_FieldAtOfs (int ofs);
|
||||
static qboolean ED_ParseEpair (void *base, ddef_t *key, const char *s);
|
||||
static ddef_t *ED_FieldAtOfs (int32_t ofs);
|
||||
static bool ED_ParseEpair (void *base, ddef_t *key, const char *s);
|
||||
|
||||
#define MAX_FIELD_LEN 64
|
||||
#define GEFV_CACHESIZE 2
|
||||
|
@ -109,7 +109,7 @@ angles and bad trails.
|
|||
*/
|
||||
edict_t *ED_Alloc (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
edict_t *e;
|
||||
|
||||
for (i = svs.maxclients + 1; i < sv.num_edicts; i++)
|
||||
|
@ -125,7 +125,7 @@ edict_t *ED_Alloc (void)
|
|||
}
|
||||
|
||||
if (i == sv.max_edicts) //johnfitz -- use sv.max_edicts instead of MAX_EDICTS
|
||||
Host_Error ("ED_Alloc: no free edicts (max_edicts is %i)", sv.max_edicts);
|
||||
Host_Error ("ED_Alloc: no free edicts (max_edicts is %" PRIi32 ")", sv.max_edicts);
|
||||
|
||||
sv.num_edicts++;
|
||||
e = EDICT_NUM(i);
|
||||
|
@ -169,10 +169,10 @@ void ED_Free (edict_t *ed)
|
|||
ED_GlobalAtOfs
|
||||
============
|
||||
*/
|
||||
static ddef_t *ED_GlobalAtOfs (int ofs)
|
||||
static ddef_t *ED_GlobalAtOfs (int32_t ofs)
|
||||
{
|
||||
ddef_t *def;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < progs->numglobaldefs; i++)
|
||||
{
|
||||
|
@ -188,10 +188,10 @@ static ddef_t *ED_GlobalAtOfs (int ofs)
|
|||
ED_FieldAtOfs
|
||||
============
|
||||
*/
|
||||
static ddef_t *ED_FieldAtOfs (int ofs)
|
||||
static ddef_t *ED_FieldAtOfs (int32_t ofs)
|
||||
{
|
||||
ddef_t *def;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < progs->numfielddefs; i++)
|
||||
{
|
||||
|
@ -210,7 +210,7 @@ ED_FindField
|
|||
static ddef_t *ED_FindField (const char *name)
|
||||
{
|
||||
ddef_t *def;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < progs->numfielddefs; i++)
|
||||
{
|
||||
|
@ -230,7 +230,7 @@ ED_FindGlobal
|
|||
static ddef_t *ED_FindGlobal (const char *name)
|
||||
{
|
||||
ddef_t *def;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < progs->numglobaldefs; i++)
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ ED_FindFunction
|
|||
static dfunction_t *ED_FindFunction (const char *fn_name)
|
||||
{
|
||||
dfunction_t *func;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < progs->numfunctions; i++)
|
||||
{
|
||||
|
@ -269,8 +269,8 @@ GetEdictFieldValue
|
|||
eval_t *GetEdictFieldValue(edict_t *ed, const char *field)
|
||||
{
|
||||
ddef_t *def = NULL;
|
||||
int i;
|
||||
static int rep = 0;
|
||||
int32_t i;
|
||||
static int32_t rep = 0;
|
||||
|
||||
for (i = 0; i < GEFV_CACHESIZE; i++)
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ PR_ValueString
|
|||
Returns a string describing *data in a type specific manner
|
||||
=============
|
||||
*/
|
||||
static const char *PR_ValueString (int type, eval_t *val)
|
||||
static const char *PR_ValueString (int32_t type, eval_t *val)
|
||||
{
|
||||
static char line[512];
|
||||
ddef_t *def;
|
||||
|
@ -320,7 +320,7 @@ static const char *PR_ValueString (int type, eval_t *val)
|
|||
sprintf (line, "%s", PR_GetString(val->string));
|
||||
break;
|
||||
case ev_entity:
|
||||
sprintf (line, "entity %i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)) );
|
||||
sprintf (line, "entity %" PRIi32 "", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)) );
|
||||
break;
|
||||
case ev_function:
|
||||
f = pr_functions + val->function;
|
||||
|
@ -343,7 +343,7 @@ static const char *PR_ValueString (int type, eval_t *val)
|
|||
sprintf (line, "pointer");
|
||||
break;
|
||||
default:
|
||||
sprintf (line, "bad type %i", type);
|
||||
sprintf (line, "bad type %" PRIi32 "", type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ Returns a string describing *data in a type specific manner
|
|||
Easier to parse than PR_ValueString
|
||||
=============
|
||||
*/
|
||||
static const char *PR_UglyValueString (int type, eval_t *val)
|
||||
static const char *PR_UglyValueString (int32_t type, eval_t *val)
|
||||
{
|
||||
static char line[512];
|
||||
ddef_t *def;
|
||||
|
@ -373,7 +373,7 @@ static const char *PR_UglyValueString (int type, eval_t *val)
|
|||
sprintf (line, "%s", PR_GetString(val->string));
|
||||
break;
|
||||
case ev_entity:
|
||||
sprintf (line, "%i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
|
||||
sprintf (line, "%" PRIi32 "", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
|
||||
break;
|
||||
case ev_function:
|
||||
f = pr_functions + val->function;
|
||||
|
@ -393,7 +393,7 @@ static const char *PR_UglyValueString (int type, eval_t *val)
|
|||
sprintf (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
|
||||
break;
|
||||
default:
|
||||
sprintf (line, "bad type %i", type);
|
||||
sprintf (line, "bad type %" PRIi32 "", type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -408,22 +408,22 @@ Returns a string with a description and the contents of a global,
|
|||
padded to 20 field width
|
||||
============
|
||||
*/
|
||||
const char *PR_GlobalString (int ofs)
|
||||
const char *PR_GlobalString (int32_t ofs)
|
||||
{
|
||||
static char line[512];
|
||||
const char *s;
|
||||
int i;
|
||||
int32_t i;
|
||||
ddef_t *def;
|
||||
void *val;
|
||||
|
||||
val = (void *)&pr_globals[ofs];
|
||||
def = ED_GlobalAtOfs(ofs);
|
||||
if (!def)
|
||||
sprintf (line,"%i(?)", ofs);
|
||||
sprintf (line,"%" PRIi32 "(?)", ofs);
|
||||
else
|
||||
{
|
||||
s = PR_ValueString (def->type, (eval_t *)val);
|
||||
sprintf (line,"%i(%s)%s", ofs, PR_GetString(def->s_name), s);
|
||||
sprintf (line,"%" PRIi32 "(%s)%s", ofs, PR_GetString(def->s_name), s);
|
||||
}
|
||||
|
||||
i = strlen(line);
|
||||
|
@ -434,17 +434,17 @@ const char *PR_GlobalString (int ofs)
|
|||
return line;
|
||||
}
|
||||
|
||||
const char *PR_GlobalStringNoContents (int ofs)
|
||||
const char *PR_GlobalStringNoContents (int32_t ofs)
|
||||
{
|
||||
static char line[512];
|
||||
int i;
|
||||
int32_t i;
|
||||
ddef_t *def;
|
||||
|
||||
def = ED_GlobalAtOfs(ofs);
|
||||
if (!def)
|
||||
sprintf (line,"%i(?)", ofs);
|
||||
sprintf (line,"%" PRIi32 "(?)", ofs);
|
||||
else
|
||||
sprintf (line,"%i(%s)", ofs, PR_GetString(def->s_name));
|
||||
sprintf (line,"%" PRIi32 "(%s)", ofs, PR_GetString(def->s_name));
|
||||
|
||||
i = strlen(line);
|
||||
for ( ; i < 20; i++)
|
||||
|
@ -465,10 +465,10 @@ For debugging
|
|||
void ED_Print (edict_t *ed)
|
||||
{
|
||||
ddef_t *d;
|
||||
int *v;
|
||||
int i, j, l;
|
||||
int32_t *v;
|
||||
int32_t i, j, l;
|
||||
const char *name;
|
||||
int type;
|
||||
int32_t type;
|
||||
|
||||
if (ed->free)
|
||||
{
|
||||
|
@ -476,7 +476,7 @@ void ED_Print (edict_t *ed)
|
|||
return;
|
||||
}
|
||||
|
||||
Con_SafePrintf("\nEDICT %i:\n", NUM_FOR_EDICT(ed)); //johnfitz -- was Con_Printf
|
||||
Con_SafePrintf("\nEDICT %" PRIi32 ":\n", NUM_FOR_EDICT(ed)); //johnfitz -- was Con_Printf
|
||||
for (i = 1; i < progs->numfielddefs; i++)
|
||||
{
|
||||
d = &pr_fielddefs[i];
|
||||
|
@ -485,7 +485,7 @@ void ED_Print (edict_t *ed)
|
|||
if (l > 1 && name[l - 2] == '_')
|
||||
continue; // skip _x, _y, _z vars
|
||||
|
||||
v = (int *)((char *)&ed->v + d->ofs*4);
|
||||
v = (int32_t *)((char *)&ed->v + d->ofs*4);
|
||||
|
||||
// if the value is still all 0, skip the field
|
||||
type = d->type & ~DEF_SAVEGLOBAL;
|
||||
|
@ -516,10 +516,10 @@ For savegames
|
|||
void ED_Write (FILE *f, edict_t *ed)
|
||||
{
|
||||
ddef_t *d;
|
||||
int *v;
|
||||
int i, j;
|
||||
int32_t *v;
|
||||
int32_t i, j;
|
||||
const char *name;
|
||||
int type;
|
||||
int32_t type;
|
||||
|
||||
fprintf (f, "{\n");
|
||||
|
||||
|
@ -537,7 +537,7 @@ void ED_Write (FILE *f, edict_t *ed)
|
|||
if (j > 1 && name[j - 2] == '_')
|
||||
continue; // skip _x, _y, _z vars
|
||||
|
||||
v = (int *)((char *)&ed->v + d->ofs*4);
|
||||
v = (int32_t *)((char *)&ed->v + d->ofs*4);
|
||||
|
||||
// if the value is still all 0, skip the field
|
||||
type = d->type & ~DEF_SAVEGLOBAL;
|
||||
|
@ -561,7 +561,7 @@ void ED_Write (FILE *f, edict_t *ed)
|
|||
fprintf (f, "}\n");
|
||||
}
|
||||
|
||||
void ED_PrintNum (int ent)
|
||||
void ED_PrintNum (int32_t ent)
|
||||
{
|
||||
ED_Print (EDICT_NUM(ent));
|
||||
}
|
||||
|
@ -575,12 +575,12 @@ For debugging, prints all the entities in the current server
|
|||
*/
|
||||
void ED_PrintEdicts (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!sv.active)
|
||||
return;
|
||||
|
||||
Con_Printf ("%i entities\n", sv.num_edicts);
|
||||
Con_Printf ("%" PRIi32 " entities\n", sv.num_edicts);
|
||||
for (i = 0; i < sv.num_edicts; i++)
|
||||
ED_PrintNum (i);
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ For debugging, prints a single edicy
|
|||
*/
|
||||
static void ED_PrintEdict_f (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!sv.active)
|
||||
return;
|
||||
|
@ -618,7 +618,7 @@ For debugging
|
|||
static void ED_Count (void)
|
||||
{
|
||||
edict_t *ent;
|
||||
int i, active, models, solid, step;
|
||||
int32_t i, active, models, solid, step;
|
||||
|
||||
if (!sv.active)
|
||||
return;
|
||||
|
@ -638,11 +638,11 @@ static void ED_Count (void)
|
|||
step++;
|
||||
}
|
||||
|
||||
Con_Printf ("num_edicts:%3i\n", sv.num_edicts);
|
||||
Con_Printf ("active :%3i\n", active);
|
||||
Con_Printf ("view :%3i\n", models);
|
||||
Con_Printf ("touch :%3i\n", solid);
|
||||
Con_Printf ("step :%3i\n", step);
|
||||
Con_Printf ("num_edicts:%3" PRIi32 "\n", sv.num_edicts);
|
||||
Con_Printf ("active :%3" PRIi32 "\n", active);
|
||||
Con_Printf ("view :%3" PRIi32 "\n", models);
|
||||
Con_Printf ("touch :%3" PRIi32 "\n", solid);
|
||||
Con_Printf ("step :%3" PRIi32 "\n", step);
|
||||
}
|
||||
|
||||
|
||||
|
@ -663,9 +663,9 @@ ED_WriteGlobals
|
|||
void ED_WriteGlobals (FILE *f)
|
||||
{
|
||||
ddef_t *def;
|
||||
int i;
|
||||
int32_t i;
|
||||
const char *name;
|
||||
int type;
|
||||
int32_t type;
|
||||
|
||||
fprintf (f, "{\n");
|
||||
for (i = 0; i < progs->numglobaldefs; i++)
|
||||
|
@ -739,7 +739,7 @@ ED_NewString
|
|||
static string_t ED_NewString (const char *string)
|
||||
{
|
||||
char *new_p;
|
||||
int i, l;
|
||||
int32_t i, l;
|
||||
string_t num;
|
||||
|
||||
l = strlen(string) + 1;
|
||||
|
@ -771,9 +771,9 @@ Can parse either fields or globals
|
|||
returns false if error
|
||||
=============
|
||||
*/
|
||||
static qboolean 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];
|
||||
ddef_t *def;
|
||||
char *v, *w;
|
||||
|
@ -781,7 +781,7 @@ static qboolean ED_ParseEpair (void *base, ddef_t *key, const char *s)
|
|||
void *d;
|
||||
dfunction_t *func;
|
||||
|
||||
d = (void *)((int *)base + key->ofs);
|
||||
d = (void *)((int32_t *)base + key->ofs);
|
||||
|
||||
switch (key->type & ~DEF_SAVEGLOBAL)
|
||||
{
|
||||
|
@ -819,7 +819,7 @@ static qboolean ED_ParseEpair (void *base, ddef_t *key, const char *s)
|
|||
break;
|
||||
|
||||
case ev_entity:
|
||||
*(int *)d = EDICT_TO_PROG(EDICT_NUM(atoi (s)));
|
||||
*(int32_t *)d = EDICT_TO_PROG(EDICT_NUM(atoi (s)));
|
||||
break;
|
||||
|
||||
case ev_field:
|
||||
|
@ -831,7 +831,7 @@ static qboolean ED_ParseEpair (void *base, ddef_t *key, const char *s)
|
|||
Con_DPrintf ("Can't find field %s\n", s);
|
||||
return false;
|
||||
}
|
||||
*(int *)d = G_INT(def->ofs);
|
||||
*(int32_t *)d = G_INT(def->ofs);
|
||||
break;
|
||||
|
||||
case ev_function:
|
||||
|
@ -863,8 +863,8 @@ const char *ED_ParseEdict (const char *data, edict_t *ent)
|
|||
{
|
||||
ddef_t *key;
|
||||
char keyname[256];
|
||||
qboolean anglehack, init;
|
||||
int n;
|
||||
bool anglehack, init;
|
||||
int32_t n;
|
||||
|
||||
init = false;
|
||||
|
||||
|
@ -972,7 +972,7 @@ void ED_LoadFromFile (const char *data)
|
|||
{
|
||||
dfunction_t *func;
|
||||
edict_t *ent = NULL;
|
||||
int inhibit = 0;
|
||||
int32_t inhibit = 0;
|
||||
|
||||
pr_global_struct->time = sv.time;
|
||||
|
||||
|
@ -995,16 +995,16 @@ void ED_LoadFromFile (const char *data)
|
|||
// remove things from different skill levels or deathmatch
|
||||
if (deathmatch.value)
|
||||
{
|
||||
if (((int)ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH))
|
||||
if (((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH))
|
||||
{
|
||||
ED_Free (ent);
|
||||
inhibit++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if ((current_skill == 0 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_EASY))
|
||||
|| (current_skill == 1 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_MEDIUM))
|
||||
|| (current_skill >= 2 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_HARD)) )
|
||||
else if ((current_skill == 0 && ((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_EASY))
|
||||
|| (current_skill == 1 && ((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_MEDIUM))
|
||||
|| (current_skill >= 2 && ((int32_t)ent->v.spawnflags & SPAWNFLAG_NOT_HARD)) )
|
||||
{
|
||||
ED_Free (ent);
|
||||
inhibit++;
|
||||
|
@ -1037,7 +1037,7 @@ void ED_LoadFromFile (const char *data)
|
|||
PR_ExecuteProgram (func - pr_functions);
|
||||
}
|
||||
|
||||
Con_DPrintf ("%i entities inhibited\n", inhibit);
|
||||
Con_DPrintf ("%" PRIi32 " entities inhibited\n", inhibit);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ PR_LoadProgs
|
|||
*/
|
||||
void PR_LoadProgs (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// flush the non-C variable lookup cache
|
||||
for (i = 0; i < GEFV_CACHESIZE; i++)
|
||||
|
@ -1059,17 +1059,17 @@ void PR_LoadProgs (void)
|
|||
progs = (dprograms_t *)COM_LoadHunkFile ("progs.dat", NULL);
|
||||
if (!progs)
|
||||
Host_Error ("PR_LoadProgs: couldn't load progs.dat");
|
||||
Con_DPrintf ("Programs occupy %iK.\n", com_filesize/1024);
|
||||
Con_DPrintf ("Programs occupy %" PRIi32 "K.\n", com_filesize/1024);
|
||||
|
||||
for (i = 0; i < com_filesize; i++)
|
||||
CRC_ProcessByte (&pr_crc, ((byte *)progs)[i]);
|
||||
|
||||
// byte swap the header
|
||||
for (i = 0; i < (int) sizeof(*progs) / 4; i++)
|
||||
((int *)progs)[i] = LittleLong ( ((int *)progs)[i] );
|
||||
for (i = 0; i < (int32_t) sizeof(*progs) / 4; i++)
|
||||
((int32_t *)progs)[i] = LittleLong ( ((int32_t *)progs)[i] );
|
||||
|
||||
if (progs->version != PROG_VERSION)
|
||||
Host_Error ("progs.dat has wrong version number (%i should be %i)", progs->version, PROG_VERSION);
|
||||
Host_Error ("progs.dat has wrong version number (%" PRIi32 " should be %" PRIi32 ")", progs->version, PROG_VERSION);
|
||||
if (progs->crc != PROGHEADER_CRC)
|
||||
Host_Error ("progs.dat system vars have been modified, progdefs.h is out of date");
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ void PR_LoadProgs (void)
|
|||
}
|
||||
|
||||
for (i = 0; i < progs->numglobals; i++)
|
||||
((int *)pr_globals)[i] = LittleLong (((int *)pr_globals)[i]);
|
||||
((int32_t *)pr_globals)[i] = LittleLong (((int32_t *)pr_globals)[i]);
|
||||
|
||||
pr_edict_size = progs->entityfields * 4 + sizeof(edict_t) - sizeof(entvars_t);
|
||||
// round off to next highest whole word address (esp for Alpha)
|
||||
|
@ -1173,16 +1173,16 @@ void PR_Init (void)
|
|||
}
|
||||
|
||||
|
||||
edict_t *EDICT_NUM(int n)
|
||||
edict_t *EDICT_NUM(int32_t n)
|
||||
{
|
||||
if (n < 0 || n >= sv.max_edicts)
|
||||
Host_Error ("EDICT_NUM: bad number %i", n);
|
||||
Host_Error ("EDICT_NUM: bad number %" PRIi32 "", n);
|
||||
return (edict_t *)((byte *)sv.edicts + (n)*pr_edict_size);
|
||||
}
|
||||
|
||||
int NUM_FOR_EDICT(edict_t *e)
|
||||
int32_t NUM_FOR_EDICT(edict_t *e)
|
||||
{
|
||||
int b;
|
||||
int32_t b;
|
||||
|
||||
b = (byte *)e - (byte *)sv.edicts;
|
||||
b = b / pr_edict_size;
|
||||
|
@ -1200,11 +1200,11 @@ int NUM_FOR_EDICT(edict_t *e)
|
|||
static void PR_AllocStringSlots (void)
|
||||
{
|
||||
pr_maxknownstrings += PR_STRING_ALLOCSLOTS;
|
||||
Con_DPrintf2("PR_AllocStringSlots: realloc'ing for %d slots\n", pr_maxknownstrings);
|
||||
Con_DPrintf2("PR_AllocStringSlots: realloc'ing for %" PRIi32 " slots\n", pr_maxknownstrings);
|
||||
pr_knownstrings = (const char **) Z_Realloc ((void *)pr_knownstrings, pr_maxknownstrings * sizeof(char *));
|
||||
}
|
||||
|
||||
const char *PR_GetString (int num)
|
||||
const char *PR_GetString (int32_t num)
|
||||
{
|
||||
if (num >= 0 && num < pr_stringssize)
|
||||
return pr_strings + num;
|
||||
|
@ -1212,21 +1212,21 @@ const char *PR_GetString (int num)
|
|||
{
|
||||
if (!pr_knownstrings[-1 - num])
|
||||
{
|
||||
Host_Error ("PR_GetString: attempt to get a non-existant string %d\n", num);
|
||||
Host_Error ("PR_GetString: attempt to get a non-existant string %" PRIi32 "\n", num);
|
||||
return "";
|
||||
}
|
||||
return pr_knownstrings[-1 - num];
|
||||
}
|
||||
else
|
||||
{
|
||||
Host_Error("PR_GetString: invalid string offset %d\n", num);
|
||||
Host_Error("PR_GetString: invalid string offset %" PRIi32 "\n", num);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
int PR_SetEngineString (const char *s)
|
||||
int32_t PR_SetEngineString (const char *s)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!s)
|
||||
return 0;
|
||||
|
@ -1235,7 +1235,7 @@ int PR_SetEngineString (const char *s)
|
|||
Host_Error("PR_SetEngineString: \"%s\" in pr_strings area\n", s);
|
||||
#else
|
||||
if (s >= pr_strings && s <= pr_strings + pr_stringssize - 2)
|
||||
return (int)(s - pr_strings);
|
||||
return (int32_t)(s - pr_strings);
|
||||
#endif
|
||||
for (i = 0; i < pr_numknownstrings; i++)
|
||||
{
|
||||
|
@ -1261,9 +1261,9 @@ int PR_SetEngineString (const char *s)
|
|||
return -1 - i;
|
||||
}
|
||||
|
||||
int PR_AllocString (int size, char **ptr)
|
||||
int32_t PR_AllocString (int32_t size, char **ptr)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!size)
|
||||
return 0;
|
||||
|
|
|
@ -23,22 +23,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int s;
|
||||
int32_t s;
|
||||
dfunction_t *f;
|
||||
} prstack_t;
|
||||
|
||||
#define MAX_STACK_DEPTH 64 /* was 32 */
|
||||
static prstack_t pr_stack[MAX_STACK_DEPTH];
|
||||
static int pr_depth;
|
||||
static int32_t pr_depth;
|
||||
|
||||
#define LOCALSTACK_SIZE 2048
|
||||
static int localstack[LOCALSTACK_SIZE];
|
||||
static int localstack_used;
|
||||
static int32_t localstack[LOCALSTACK_SIZE];
|
||||
static int32_t localstack_used;
|
||||
|
||||
qboolean pr_trace;
|
||||
bool pr_trace;
|
||||
dfunction_t *pr_xfunction;
|
||||
int pr_xstatement;
|
||||
int pr_argc;
|
||||
int32_t pr_xstatement;
|
||||
int32_t pr_argc;
|
||||
|
||||
static const char *pr_opnames[] =
|
||||
{
|
||||
|
@ -129,8 +129,8 @@ static const char *pr_opnames[] =
|
|||
"BITOR"
|
||||
};
|
||||
|
||||
const char *PR_GlobalString (int ofs);
|
||||
const char *PR_GlobalStringNoContents (int ofs);
|
||||
const char *PR_GlobalString (int32_t ofs);
|
||||
const char *PR_GlobalStringNoContents (int32_t ofs);
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
@ -142,7 +142,7 @@ PR_PrintStatement
|
|||
*/
|
||||
static void PR_PrintStatement (dstatement_t *s)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if ((uint32_t)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0]))
|
||||
{
|
||||
|
@ -153,10 +153,10 @@ static void PR_PrintStatement (dstatement_t *s)
|
|||
}
|
||||
|
||||
if (s->op == OP_IF || s->op == OP_IFNOT)
|
||||
Con_Printf("%sbranch %i", PR_GlobalString(s->a), s->b);
|
||||
Con_Printf("%sbranch %" PRIi32 "", PR_GlobalString(s->a), s->b);
|
||||
else if (s->op == OP_GOTO)
|
||||
{
|
||||
Con_Printf("branch %i", s->a);
|
||||
Con_Printf("branch %" PRIi32 "", s->a);
|
||||
}
|
||||
else if ((uint32_t)(s->op-OP_STORE_F) < 6)
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ PR_StackTrace
|
|||
*/
|
||||
static void PR_StackTrace (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
dfunction_t *f;
|
||||
|
||||
if (pr_depth == 0)
|
||||
|
@ -215,8 +215,8 @@ PR_Profile_f
|
|||
*/
|
||||
void PR_Profile_f (void)
|
||||
{
|
||||
int i, num;
|
||||
int pmax;
|
||||
int32_t i, num;
|
||||
int32_t pmax;
|
||||
dfunction_t *f, *best;
|
||||
|
||||
if (!sv.active)
|
||||
|
@ -239,7 +239,7 @@ void PR_Profile_f (void)
|
|||
if (best)
|
||||
{
|
||||
if (num < 10)
|
||||
Con_Printf("%7i %s\n", best->profile, PR_GetString(best->s_name));
|
||||
Con_Printf("%7" PRIi32 " %s\n", best->profile, PR_GetString(best->s_name));
|
||||
num++;
|
||||
best->profile = 0;
|
||||
}
|
||||
|
@ -280,9 +280,9 @@ PR_EnterFunction
|
|||
Returns the new program statement counter
|
||||
====================
|
||||
*/
|
||||
static int PR_EnterFunction (dfunction_t *f)
|
||||
static int32_t PR_EnterFunction (dfunction_t *f)
|
||||
{
|
||||
int i, j, c, o;
|
||||
int32_t i, j, c, o;
|
||||
|
||||
pr_stack[pr_depth].s = pr_xstatement;
|
||||
pr_stack[pr_depth].f = pr_xfunction;
|
||||
|
@ -296,7 +296,7 @@ static int PR_EnterFunction (dfunction_t *f)
|
|||
PR_RunError("PR_ExecuteProgram: locals stack overflow\n");
|
||||
|
||||
for (i = 0; i < c ; i++)
|
||||
localstack[localstack_used + i] = ((int *)pr_globals)[f->parm_start + i];
|
||||
localstack[localstack_used + i] = ((int32_t *)pr_globals)[f->parm_start + i];
|
||||
localstack_used += c;
|
||||
|
||||
// copy parameters
|
||||
|
@ -305,7 +305,7 @@ static int PR_EnterFunction (dfunction_t *f)
|
|||
{
|
||||
for (j = 0; j < f->parm_size[i]; j++)
|
||||
{
|
||||
((int *)pr_globals)[o] = ((int *)pr_globals)[OFS_PARM0 + i*3 + j];
|
||||
((int32_t *)pr_globals)[o] = ((int32_t *)pr_globals)[OFS_PARM0 + i*3 + j];
|
||||
o++;
|
||||
}
|
||||
}
|
||||
|
@ -319,9 +319,9 @@ static int PR_EnterFunction (dfunction_t *f)
|
|||
PR_LeaveFunction
|
||||
====================
|
||||
*/
|
||||
static int PR_LeaveFunction (void)
|
||||
static int32_t PR_LeaveFunction (void)
|
||||
{
|
||||
int i, c;
|
||||
int32_t i, c;
|
||||
|
||||
if (pr_depth <= 0)
|
||||
Host_Error("prog stack underflow");
|
||||
|
@ -333,7 +333,7 @@ static int PR_LeaveFunction (void)
|
|||
PR_RunError("PR_ExecuteProgram: locals stack underflow");
|
||||
|
||||
for (i = 0; i < c; i++)
|
||||
((int *)pr_globals)[pr_xfunction->parm_start + i] = localstack[localstack_used + i];
|
||||
((int32_t *)pr_globals)[pr_xfunction->parm_start + i] = localstack[localstack_used + i];
|
||||
|
||||
// up stack
|
||||
pr_depth--;
|
||||
|
@ -358,9 +358,9 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
eval_t *ptr;
|
||||
dstatement_t *st;
|
||||
dfunction_t *f, *newf;
|
||||
int profile, startprofile;
|
||||
int32_t profile, startprofile;
|
||||
edict_t *ed;
|
||||
int exitdepth;
|
||||
int32_t exitdepth;
|
||||
|
||||
if (!fnum || fnum >= progs->numfunctions)
|
||||
{
|
||||
|
@ -436,11 +436,11 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
break;
|
||||
|
||||
case OP_BITAND:
|
||||
OPC->_float = (int)OPA->_float & (int)OPB->_float;
|
||||
OPC->_float = (int32_t)OPA->_float & (int32_t)OPB->_float;
|
||||
break;
|
||||
|
||||
case OP_BITOR:
|
||||
OPC->_float = (int)OPA->_float | (int)OPB->_float;
|
||||
OPC->_float = (int32_t)OPA->_float | (int32_t)OPB->_float;
|
||||
break;
|
||||
|
||||
case OP_GE:
|
||||
|
@ -552,7 +552,7 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
pr_xstatement = st - pr_statements;
|
||||
PR_RunError("assignment to world entity");
|
||||
}
|
||||
OPC->_int = (byte *)((int *)&ed->v + OPB->_int) - (byte *)sv.edicts;
|
||||
OPC->_int = (byte *)((int32_t *)&ed->v + OPB->_int) - (byte *)sv.edicts;
|
||||
break;
|
||||
|
||||
case OP_LOAD_F:
|
||||
|
@ -564,7 +564,7 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
#ifdef PARANOID
|
||||
NUM_FOR_EDICT(ed); // Make sure it's in range
|
||||
#endif
|
||||
OPC->_int = ((eval_t *)((int *)&ed->v + OPB->_int))->_int;
|
||||
OPC->_int = ((eval_t *)((int32_t *)&ed->v + OPB->_int))->_int;
|
||||
break;
|
||||
|
||||
case OP_LOAD_V:
|
||||
|
@ -572,7 +572,7 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
#ifdef PARANOID
|
||||
NUM_FOR_EDICT(ed); // Make sure it's in range
|
||||
#endif
|
||||
ptr = (eval_t *)((int *)&ed->v + OPB->_int);
|
||||
ptr = (eval_t *)((int32_t *)&ed->v + OPB->_int);
|
||||
OPC->vector[0] = ptr->vector[0];
|
||||
OPC->vector[1] = ptr->vector[1];
|
||||
OPC->vector[2] = ptr->vector[2];
|
||||
|
@ -610,9 +610,9 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
newf = &pr_functions[OPA->function];
|
||||
if (newf->first_statement < 0)
|
||||
{ // Built-in function
|
||||
int i = -newf->first_statement;
|
||||
int32_t i = -newf->first_statement;
|
||||
if (i >= pr_numbuiltins)
|
||||
PR_RunError("Bad builtin call number %d", i);
|
||||
PR_RunError("Bad builtin call number %" PRIi32 "", i);
|
||||
pr_builtins[i]();
|
||||
break;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ void PR_ExecuteProgram (func_t fnum)
|
|||
|
||||
default:
|
||||
pr_xstatement = st - pr_statements;
|
||||
PR_RunError("Bad opcode %i", st->op);
|
||||
PR_RunError("Bad opcode %" PRIi32 "", st->op);
|
||||
}
|
||||
} /* end of while(1) loop */
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
/* file generated by qcc, do not modify */
|
||||
|
||||
typedef struct
|
||||
{ int pad[28];
|
||||
int self;
|
||||
int other;
|
||||
int world;
|
||||
{ int32_t pad[28];
|
||||
int32_t self;
|
||||
int32_t other;
|
||||
int32_t world;
|
||||
float time;
|
||||
float frametime;
|
||||
float force_retouch;
|
||||
|
@ -43,10 +43,10 @@ typedef struct
|
|||
vec3_t trace_endpos;
|
||||
vec3_t trace_plane_normal;
|
||||
float trace_plane_dist;
|
||||
int trace_ent;
|
||||
int32_t trace_ent;
|
||||
float trace_inopen;
|
||||
float trace_inwater;
|
||||
int msg_entity;
|
||||
int32_t msg_entity;
|
||||
func_t main;
|
||||
func_t StartFrame;
|
||||
func_t PlayerPreThink;
|
||||
|
@ -86,7 +86,7 @@ typedef struct
|
|||
func_t think;
|
||||
func_t blocked;
|
||||
float nextthink;
|
||||
int groundentity;
|
||||
int32_t groundentity;
|
||||
float health;
|
||||
float frags;
|
||||
float weapon;
|
||||
|
@ -99,7 +99,7 @@ typedef struct
|
|||
float ammo_cells;
|
||||
float items;
|
||||
float takedamage;
|
||||
int chain;
|
||||
int32_t chain;
|
||||
float deadflag;
|
||||
vec3_t view_ofs;
|
||||
float button0;
|
||||
|
@ -110,7 +110,7 @@ typedef struct
|
|||
vec3_t v_angle;
|
||||
float idealpitch;
|
||||
string_t netname;
|
||||
int enemy;
|
||||
int32_t enemy;
|
||||
float flags;
|
||||
float colormap;
|
||||
float team;
|
||||
|
@ -122,15 +122,15 @@ typedef struct
|
|||
float watertype;
|
||||
float ideal_yaw;
|
||||
float yaw_speed;
|
||||
int aiment;
|
||||
int goalentity;
|
||||
int32_t aiment;
|
||||
int32_t goalentity;
|
||||
float spawnflags;
|
||||
string_t target;
|
||||
string_t targetname;
|
||||
float dmg_take;
|
||||
float dmg_save;
|
||||
int dmg_inflictor;
|
||||
int owner;
|
||||
int32_t dmg_inflictor;
|
||||
int32_t owner;
|
||||
vec3_t movedir;
|
||||
string_t message;
|
||||
float sounds;
|
||||
|
|
|
@ -32,22 +32,22 @@ typedef union eval_s
|
|||
float _float;
|
||||
float vector[3];
|
||||
func_t function;
|
||||
int _int;
|
||||
int edict;
|
||||
int32_t _int;
|
||||
int32_t edict;
|
||||
} eval_t;
|
||||
|
||||
#define MAX_ENT_LEAFS 32
|
||||
typedef struct edict_s
|
||||
{
|
||||
qboolean free;
|
||||
bool free;
|
||||
link_t area; /* linked to a division node or leaf */
|
||||
|
||||
int num_leafs;
|
||||
int leafnums[MAX_ENT_LEAFS];
|
||||
int32_t num_leafs;
|
||||
int32_t leafnums[MAX_ENT_LEAFS];
|
||||
|
||||
entity_state_t baseline;
|
||||
uint8_t alpha; /* johnfitz -- hack to support alpha since it's not part of entvars_t */
|
||||
qboolean sendinterval; /* johnfitz -- send time until nextthink to client for better lerp timing */
|
||||
bool sendinterval; /* johnfitz -- send time until nextthink to client for better lerp timing */
|
||||
|
||||
float freetime; /* sv.time when the object was freed */
|
||||
entvars_t v; /* C exported fields from progs */
|
||||
|
@ -65,7 +65,7 @@ extern dstatement_t *pr_statements;
|
|||
extern globalvars_t *pr_global_struct;
|
||||
extern float *pr_globals; /* same as pr_global_struct */
|
||||
|
||||
extern int pr_edict_size; /* in bytes */
|
||||
extern int32_t pr_edict_size; /* in bytes */
|
||||
|
||||
|
||||
void PR_Init (void);
|
||||
|
@ -73,9 +73,9 @@ void PR_Init (void);
|
|||
void PR_ExecuteProgram (func_t fnum);
|
||||
void PR_LoadProgs (void);
|
||||
|
||||
const char *PR_GetString (int num);
|
||||
int PR_SetEngineString (const char *s);
|
||||
int PR_AllocString (int bufferlength, char **ptr);
|
||||
const char *PR_GetString (int32_t num);
|
||||
int32_t PR_SetEngineString (const char *s);
|
||||
int32_t PR_AllocString (int32_t bufferlength, char **ptr);
|
||||
|
||||
void PR_Profile_f (void);
|
||||
|
||||
|
@ -95,8 +95,8 @@ void ED_LoadFromFile (const char *data);
|
|||
#define EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size))
|
||||
#define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts) / pr_edict_size)
|
||||
*/
|
||||
edict_t *EDICT_NUM(int n);
|
||||
int NUM_FOR_EDICT(edict_t *e);
|
||||
edict_t *EDICT_NUM(int32_t n);
|
||||
int32_t NUM_FOR_EDICT(edict_t *e);
|
||||
|
||||
#define NEXT_EDICT(e) ((edict_t *)( (byte *)e + pr_edict_size))
|
||||
|
||||
|
@ -104,39 +104,39 @@ int NUM_FOR_EDICT(edict_t *e);
|
|||
#define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e))
|
||||
|
||||
#define G_FLOAT(o) (pr_globals[o])
|
||||
#define G_INT(o) (*(int *)&pr_globals[o])
|
||||
#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int *)&pr_globals[o]))
|
||||
#define G_INT(o) (*(int32_t *)&pr_globals[o])
|
||||
#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int32_t *)&pr_globals[o]))
|
||||
#define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
|
||||
#define G_VECTOR(o) (&pr_globals[o])
|
||||
#define G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o]))
|
||||
#define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
|
||||
|
||||
#define E_FLOAT(e,o) (((float*)&e->v)[o])
|
||||
#define E_INT(e,o) (*(int *)&((float*)&e->v)[o])
|
||||
#define E_INT(e,o) (*(int32_t *)&((float*)&e->v)[o])
|
||||
#define E_VECTOR(e,o) (&((float*)&e->v)[o])
|
||||
#define E_STRING(e,o) (PR_GetString(*(string_t *)&((float*)&e->v)[o]))
|
||||
|
||||
extern int type_size[8];
|
||||
extern int32_t type_size[8];
|
||||
|
||||
typedef void (*builtin_t) (void);
|
||||
extern builtin_t *pr_builtins;
|
||||
extern int pr_numbuiltins;
|
||||
extern int32_t pr_numbuiltins;
|
||||
|
||||
extern int pr_argc;
|
||||
extern int32_t pr_argc;
|
||||
|
||||
extern qboolean pr_trace;
|
||||
extern bool pr_trace;
|
||||
extern dfunction_t *pr_xfunction;
|
||||
extern int pr_xstatement;
|
||||
extern int32_t pr_xstatement;
|
||||
|
||||
extern uint16_t pr_crc;
|
||||
|
||||
FUNC_NORETURN void PR_RunError (const char *error, ...) FUNC_PRINTF(1,2);
|
||||
noreturn void PR_RunError (const char *error, ...) FUNC_PRINTF(1,2);
|
||||
#ifdef __WATCOMC__
|
||||
#pragma aux PR_RunError aborts;
|
||||
#endif
|
||||
|
||||
void ED_PrintEdicts (void);
|
||||
void ED_PrintNum (int ent);
|
||||
void ED_PrintNum (int32_t ent);
|
||||
|
||||
eval_t *GetEdictFieldValue(edict_t *ed, const char *field);
|
||||
|
||||
|
|
|
@ -235,12 +235,12 @@ typedef struct
|
|||
{
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
uint16_t modelindex; //johnfitz -- was int
|
||||
uint16_t frame; //johnfitz -- was int
|
||||
uint8_t colormap; //johnfitz -- was int
|
||||
uint8_t skin; //johnfitz -- was int
|
||||
uint16_t modelindex; //johnfitz -- was int32_t
|
||||
uint16_t frame; //johnfitz -- was int32_t
|
||||
uint8_t colormap; //johnfitz -- was int32_t
|
||||
uint8_t skin; //johnfitz -- was int32_t
|
||||
uint8_t alpha; //johnfitz -- added
|
||||
int effects;
|
||||
int32_t effects;
|
||||
} entity_state_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -20,48 +20,48 @@
|
|||
#ifndef Q_CTYPE_H
|
||||
#define Q_CTYPE_H
|
||||
|
||||
static inline int q_isascii(int c)
|
||||
static inline int32_t q_isascii(int32_t c)
|
||||
{
|
||||
return ((c & ~0x7f) == 0);
|
||||
}
|
||||
|
||||
static inline int q_islower(int c)
|
||||
static inline int32_t q_islower(int32_t c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
static inline int q_isupper(int c)
|
||||
static inline int32_t q_isupper(int32_t c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
static inline int q_isalpha(int c)
|
||||
static inline int32_t q_isalpha(int32_t c)
|
||||
{
|
||||
return (q_islower(c) || q_isupper(c));
|
||||
}
|
||||
|
||||
static inline int q_isdigit(int c)
|
||||
static inline int32_t q_isdigit(int32_t c)
|
||||
{
|
||||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
static inline int q_isxdigit(int c)
|
||||
static inline int32_t q_isxdigit(int32_t c)
|
||||
{
|
||||
return (q_isdigit(c) || (c >= 'a' && c <= 'f') ||
|
||||
(c >= 'A' && c <= 'F'));
|
||||
}
|
||||
|
||||
static inline int q_isalnum(int c)
|
||||
static inline int32_t q_isalnum(int32_t c)
|
||||
{
|
||||
return (q_isalpha(c) || q_isdigit(c));
|
||||
}
|
||||
|
||||
static inline int q_isblank(int c)
|
||||
static inline int32_t q_isblank(int32_t c)
|
||||
{
|
||||
return (c == ' ' || c == '\t');
|
||||
}
|
||||
|
||||
static inline int q_isspace(int c)
|
||||
static inline int32_t q_isspace(int32_t c)
|
||||
{
|
||||
switch(c) {
|
||||
case ' ': case '\t':
|
||||
|
@ -71,27 +71,27 @@ static inline int q_isspace(int c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int q_isgraph(int c)
|
||||
static inline int32_t q_isgraph(int32_t c)
|
||||
{
|
||||
return (c > 0x20 && c <= 0x7e);
|
||||
}
|
||||
|
||||
static inline int q_isprint(int c)
|
||||
static inline int32_t q_isprint(int32_t c)
|
||||
{
|
||||
return (c >= 0x20 && c <= 0x7e);
|
||||
}
|
||||
|
||||
static inline int q_toascii(int c)
|
||||
static inline int32_t q_toascii(int32_t c)
|
||||
{
|
||||
return (c & 0x7f);
|
||||
}
|
||||
|
||||
static inline int q_tolower(int c)
|
||||
static inline int32_t q_tolower(int32_t c)
|
||||
{
|
||||
return ((q_isupper(c)) ? (c | ('a' - 'A')) : c);
|
||||
}
|
||||
|
||||
static inline int q_toupper(int c)
|
||||
static inline int32_t q_toupper(int32_t c)
|
||||
{
|
||||
return ((q_islower(c)) ? (c & ~('a' - 'A')) : c);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
/* !!! if this is changed, it must be changed in asm_i386.h too !!! */
|
||||
typedef struct
|
||||
{
|
||||
int left;
|
||||
int right;
|
||||
int32_t left;
|
||||
int32_t right;
|
||||
} portable_samplepair_t;
|
||||
|
||||
typedef struct sfx_s
|
||||
|
@ -41,23 +41,23 @@ typedef struct sfx_s
|
|||
/* !!! if this is changed, it must be changed in asm_i386.h too !!! */
|
||||
typedef struct
|
||||
{
|
||||
int length;
|
||||
int loopstart;
|
||||
int speed;
|
||||
int width;
|
||||
int stereo;
|
||||
int32_t length;
|
||||
int32_t loopstart;
|
||||
int32_t speed;
|
||||
int32_t width;
|
||||
int32_t stereo;
|
||||
byte data[1]; /* variable sized */
|
||||
} sfxcache_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int channels;
|
||||
int samples; /* mono samples in buffer */
|
||||
int submission_chunk; /* don't mix less than this # */
|
||||
int samplepos; /* in mono samples */
|
||||
int samplebits;
|
||||
int signed8; /* device opened for S8 format? (e.g. Amiga AHI) */
|
||||
int speed;
|
||||
int32_t channels;
|
||||
int32_t samples; /* mono samples in buffer */
|
||||
int32_t submission_chunk; /* don't mix less than this # */
|
||||
int32_t samplepos; /* in mono samples */
|
||||
int32_t samplebits;
|
||||
int32_t signed8; /* device opened for S8 format? (e.g. Amiga AHI) */
|
||||
int32_t speed;
|
||||
uint8_t *buffer;
|
||||
} dma_t;
|
||||
|
||||
|
@ -65,37 +65,37 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
sfx_t *sfx; /* sfx number */
|
||||
int leftvol; /* 0-255 volume */
|
||||
int rightvol; /* 0-255 volume */
|
||||
int end; /* end time in global paintsamples */
|
||||
int pos; /* sample position in sfx */
|
||||
int looping; /* where to loop, -1 = no looping */
|
||||
int entnum; /* to allow overriding a specific sound */
|
||||
int entchannel;
|
||||
int32_t leftvol; /* 0-255 volume */
|
||||
int32_t rightvol; /* 0-255 volume */
|
||||
int32_t end; /* end time in global paintsamples */
|
||||
int32_t pos; /* sample position in sfx */
|
||||
int32_t looping; /* where to loop, -1 = no looping */
|
||||
int32_t entnum; /* to allow overriding a specific sound */
|
||||
int32_t entchannel;
|
||||
vec3_t origin; /* origin of sound effect */
|
||||
vec_t dist_mult; /* distance multiplier (attenuation/clipK) */
|
||||
int master_vol; /* 0-255 master volume */
|
||||
int32_t master_vol; /* 0-255 master volume */
|
||||
} channel_t;
|
||||
|
||||
#define WAV_FORMAT_PCM 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int rate;
|
||||
int width;
|
||||
int channels;
|
||||
int loopstart;
|
||||
int samples;
|
||||
int dataofs; /* chunk starts this many bytes from file start */
|
||||
int32_t rate;
|
||||
int32_t width;
|
||||
int32_t channels;
|
||||
int32_t loopstart;
|
||||
int32_t samples;
|
||||
int32_t dataofs; /* chunk starts this many bytes from file start */
|
||||
} wavinfo_t;
|
||||
|
||||
void S_Init (void);
|
||||
void S_Startup (void);
|
||||
void S_Shutdown (void);
|
||||
void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void S_StartSound (int32_t entnum, int32_t entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
|
||||
void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void S_StopSound (int entnum, int entchannel);
|
||||
void S_StopAllSounds(qboolean clear);
|
||||
void S_StopSound (int32_t entnum, int32_t entchannel);
|
||||
void S_StopAllSounds(bool clear);
|
||||
void S_ClearBuffer (void);
|
||||
void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up);
|
||||
void S_ExtraUpdate (void);
|
||||
|
@ -108,24 +108,24 @@ void S_TouchSound (const char *sample);
|
|||
void S_ClearPrecache (void);
|
||||
void S_BeginPrecaching (void);
|
||||
void S_EndPrecaching (void);
|
||||
void S_PaintChannels (int endtime);
|
||||
void S_PaintChannels (int32_t endtime);
|
||||
void S_InitPaintChannels (void);
|
||||
|
||||
/* picks a channel based on priorities, empty slots, number of channels */
|
||||
channel_t *SND_PickChannel (int entnum, int entchannel);
|
||||
channel_t *SND_PickChannel (int32_t entnum, int32_t entchannel);
|
||||
|
||||
/* spatializes a channel */
|
||||
void SND_Spatialize (channel_t *ch);
|
||||
|
||||
/* music stream support */
|
||||
void S_RawSamples(int samples, int rate, int width, int channels, byte * data, float volume);
|
||||
void S_RawSamples(int32_t samples, int32_t rate, int32_t width, int32_t channels, byte * data, float volume);
|
||||
/* Expects data in signed 16 bit, or unsigned 8 bit format. */
|
||||
|
||||
/* initializes cycling through a DMA buffer and returns information on it */
|
||||
qboolean SNDDMA_Init(dma_t *dma);
|
||||
bool SNDDMA_Init(dma_t *dma);
|
||||
|
||||
/* gets the current DMA position */
|
||||
int SNDDMA_GetDMAPos(void);
|
||||
int32_t SNDDMA_GetDMAPos(void);
|
||||
|
||||
/* shutdown the DMA xfer. */
|
||||
void SNDDMA_Shutdown(void);
|
||||
|
@ -158,10 +158,10 @@ extern channel_t snd_channels[MAX_CHANNELS];
|
|||
|
||||
extern volatile dma_t *shm;
|
||||
|
||||
extern int total_channels;
|
||||
extern int soundtime;
|
||||
extern int paintedtime;
|
||||
extern int s_rawend;
|
||||
extern int32_t total_channels;
|
||||
extern int32_t soundtime;
|
||||
extern int32_t paintedtime;
|
||||
extern int32_t s_rawend;
|
||||
|
||||
extern vec3_t listener_origin;
|
||||
extern vec3_t listener_forward;
|
||||
|
@ -182,7 +182,7 @@ extern cvar_t bgmvolume;
|
|||
void S_LocalSound (const char *name);
|
||||
sfxcache_t *S_LoadSound (sfx_t *s);
|
||||
|
||||
wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength);
|
||||
wavinfo_t GetWavinfo (const char *name, byte *wav, int32_t wavlength);
|
||||
|
||||
void SND_InitScaletable (void);
|
||||
|
||||
|
|
|
@ -31,31 +31,16 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <limits.h>
|
||||
#ifndef _WIN32 /* others we support without sys/param.h? */
|
||||
#ifndef _WIN32
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* NOTES on TYPE SIZES:
|
||||
Quake/Hexen II engine relied on 32 bit int type size
|
||||
with ILP32 (not LP32) model in mind. We now support
|
||||
LP64 and LLP64, too. We expect:
|
||||
sizeof (char) == 1
|
||||
sizeof (short) == 2
|
||||
sizeof (int) == 4
|
||||
sizeof (float) == 4
|
||||
sizeof (long) == 4 / 8
|
||||
sizeof (pointer *) == 4 / 8
|
||||
For this, we need stdint.h (or inttypes.h)
|
||||
FIXME: On some platforms, only inttypes.h is available.
|
||||
FIXME: Properly replace certain short and int usage
|
||||
with int16_t and int32_t.
|
||||
*/
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
/* MS Visual Studio provides stdint.h only starting with
|
||||
* version 2010. Even in VS2010, there is no inttypes.h.. */
|
||||
#include "msinttypes/stdint.h"
|
||||
#else
|
||||
#include <stdint.h>
|
||||
|
@ -65,44 +50,22 @@
|
|||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
/* Make sure the types really have the right
|
||||
* sizes: These macros are from SDL headers.
|
||||
*/
|
||||
_Static_assert(sizeof(char) == 1, "char not correct size");
|
||||
_Static_assert(sizeof(float) == 4, "float not correct size");
|
||||
_Static_assert(sizeof(long) >= 4, "long 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 */
|
||||
typedef enum {
|
||||
THE_DUMMY_VALUE
|
||||
} THE_DUMMY_ENUM;
|
||||
_Static_assert(sizeof(THE_DUMMY_ENUM) == sizeof(int), "enum not sizeof(int)");
|
||||
|
||||
/*==========================================================================*/
|
||||
enum dummy_enum {
|
||||
dummy_value
|
||||
};
|
||||
_Static_assert(sizeof(enum dummy_enum) == sizeof(int32_t), "enum not sizeof(int32_t)");
|
||||
|
||||
typedef uint8_t byte;
|
||||
|
||||
typedef enum {
|
||||
false = 0,
|
||||
true = 1
|
||||
} qboolean;
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
/* math */
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec3_t[3];
|
||||
typedef vec_t vec4_t[4];
|
||||
typedef vec_t vec5_t[5];
|
||||
typedef int fixed4_t;
|
||||
typedef int fixed8_t;
|
||||
typedef int fixed16_t;
|
||||
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
/* MAX_OSPATH (max length of a filesystem pathname, i.e. PATH_MAX)
|
||||
* Note: See GNU Hurd and others' notes about brokenness of this:
|
||||
|
@ -124,21 +87,7 @@ typedef int fixed16_t;
|
|||
|
||||
#define MAX_OSPATH PATH_MAX
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
/* missing types */
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN64)
|
||||
#define ssize_t SSIZE_T
|
||||
#else
|
||||
typedef int ssize_t;
|
||||
#endif /* _WIN64 */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
/* function attributes, etc */
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define FUNC_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
|
||||
#else
|
||||
|
@ -152,47 +101,4 @@ typedef int ssize_t;
|
|||
#define FUNCP_PRINTF(x,y)
|
||||
#endif
|
||||
|
||||
/* llvm's optnone function attribute started with clang-3.5.0 */
|
||||
#if defined(__clang__) && \
|
||||
(__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 5))
|
||||
#define FUNC_NO_OPTIMIZE __attribute__((__optnone__))
|
||||
/* function optimize attribute is added starting with gcc 4.4.0 */
|
||||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 3))
|
||||
#define FUNC_NO_OPTIMIZE __attribute__((__optimize__("0")))
|
||||
#else
|
||||
#define FUNC_NO_OPTIMIZE
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define FUNC_NORETURN __attribute__((__noreturn__))
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
#define FUNC_NORETURN __declspec(noreturn)
|
||||
#elif defined(__WATCOMC__)
|
||||
#define FUNC_NORETURN /* use the 'aborts' aux pragma */
|
||||
#else
|
||||
#define FUNC_NORETURN
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
||||
#define FUNC_NOINLINE __attribute__((__noinline__))
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
#define FUNC_NOINLINE __declspec(noinline)
|
||||
#else
|
||||
#define FUNC_NOINLINE
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
||||
#define FUNC_NOCLONE __attribute__((__noclone__))
|
||||
#else
|
||||
#define FUNC_NOCLONE
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__cplusplus)
|
||||
#define inline __inline
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
|
||||
#endif /* __QSTDINC_H */
|
||||
|
||||
|
|
|
@ -36,11 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "q_stdinc.h"
|
||||
|
||||
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
|
||||
#define CACHE_SIZE 32 // used to align key data structures
|
||||
|
||||
#define Q_UNUSED(x) (x = x) // for pesky compiler / lint warnings
|
||||
|
||||
#define MINIMUM_MEMORY 0x550000
|
||||
#define MINIMUM_MEMORY_LEVELPAK (MINIMUM_MEMORY + 0x100000)
|
||||
|
||||
|
@ -60,7 +55,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define ON_EPSILON 0.1 // point on plane side epsilon
|
||||
|
||||
#define DIST_EPSILON (0.03125) // 1/32 epsilon to keep floating point happy (moved from world.c)
|
||||
#define DIST_EPSILON 0.03125 // 1/32 epsilon to keep floating point happy (moved from world.c)
|
||||
|
||||
#define MAX_MSGLEN 64000 // max length of a reliable message //ericw -- was 32000
|
||||
#define MAX_DATAGRAM 32000 // max length of unreliable message //johnfitz -- was 1024
|
||||
|
@ -180,12 +175,12 @@ typedef struct
|
|||
// if user directories are enabled, basedir
|
||||
// and userdir will point to different
|
||||
// memory locations, otherwise to the same.
|
||||
int argc;
|
||||
int32_t argc;
|
||||
char **argv;
|
||||
void *membase;
|
||||
int memsize;
|
||||
int numcpus;
|
||||
int errstate;
|
||||
int32_t memsize;
|
||||
int32_t numcpus;
|
||||
int32_t errstate;
|
||||
} quakeparms_t;
|
||||
|
||||
#include "common.h"
|
||||
|
@ -239,7 +234,7 @@ typedef struct
|
|||
// command line parms passed to the program, and the amount of memory
|
||||
// available for the program to use
|
||||
|
||||
extern qboolean noclip_anglehack;
|
||||
extern bool noclip_anglehack;
|
||||
|
||||
//
|
||||
// host
|
||||
|
@ -252,10 +247,10 @@ extern cvar_t sys_nostdout;
|
|||
extern cvar_t developer;
|
||||
extern cvar_t max_edicts; //johnfitz
|
||||
|
||||
extern qboolean host_initialized; // true if into command execution
|
||||
extern bool host_initialized; // true if into command execution
|
||||
extern double host_frametime;
|
||||
extern byte *host_colormap;
|
||||
extern int host_framecount; // incremented every frame, never reset
|
||||
extern int32_t host_framecount; // incremented every frame, never reset
|
||||
extern double realtime; // not bounded in any way, changed at
|
||||
// start of every frame, never reset
|
||||
|
||||
|
@ -275,8 +270,8 @@ void Host_InitCommands (void);
|
|||
void Host_Init (void);
|
||||
void Host_Shutdown(void);
|
||||
void Host_Callback_Notify (cvar_t *var); /* callback function for CVAR_NOTIFY */
|
||||
FUNC_NORETURN void Host_Error (const char *error, ...) FUNC_PRINTF(1,2);
|
||||
FUNC_NORETURN void Host_EndGame (const char *message, ...) FUNC_PRINTF(1,2);
|
||||
noreturn void Host_Error (const char *error, ...) FUNC_PRINTF(1,2);
|
||||
noreturn void Host_EndGame (const char *message, ...) FUNC_PRINTF(1,2);
|
||||
#ifdef __WATCOMC__
|
||||
#pragma aux Host_Error aborts;
|
||||
#pragma aux Host_EndGame aborts;
|
||||
|
@ -284,7 +279,7 @@ FUNC_NORETURN void Host_EndGame (const char *message, ...) FUNC_PRINTF(1,2);
|
|||
void Host_Frame (float time);
|
||||
void Host_Quit_f (void);
|
||||
void Host_ClientCommands (const char *fmt, ...) FUNC_PRINTF(1,2);
|
||||
void Host_ShutdownServer (qboolean crash);
|
||||
void Host_ShutdownServer (bool crash);
|
||||
void Host_WriteConfiguration (void);
|
||||
|
||||
void ExtraMaps_Init (void);
|
||||
|
@ -293,13 +288,11 @@ void DemoList_Init (void);
|
|||
|
||||
void DemoList_Rebuild (void);
|
||||
|
||||
extern int current_skill; // skill level for currently loaded level (in case
|
||||
extern int32_t current_skill; // skill level for currently loaded level (in case
|
||||
// the user changes the cvar while the level is
|
||||
// running, this reflects the level actually in use)
|
||||
|
||||
extern qboolean isDedicated;
|
||||
|
||||
extern int minimum_memory;
|
||||
extern bool isDedicated;
|
||||
|
||||
#endif /* QUAKEDEFS_H */
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ vec3_t shadevector;
|
|||
|
||||
float entalpha; //johnfitz
|
||||
|
||||
qboolean overbright; //johnfitz
|
||||
bool overbright; //johnfitz
|
||||
|
||||
qboolean shading = true; //johnfitz -- if false, disable vertex shading for various reasons (fullbright, r_lightmap, showtris, etc)
|
||||
bool shading = true; //johnfitz -- if false, disable vertex shading for various reasons (fullbright, r_lightmap, showtris, etc)
|
||||
|
||||
//johnfitz -- struct for passing lerp information to drawing functions
|
||||
typedef struct {
|
||||
|
@ -94,9 +94,9 @@ Returns the offset of the first vertex's meshxyz_t.xyz in the vbo for the given
|
|||
model and pose.
|
||||
=============
|
||||
*/
|
||||
static void *GLARB_GetXYZOffset (aliashdr_t *hdr, int pose)
|
||||
static void *GLARB_GetXYZOffset (aliashdr_t *hdr, int32_t pose)
|
||||
{
|
||||
const int xyzoffs = offsetof (meshxyz_t, xyz);
|
||||
const int32_t xyzoffs = offsetof (meshxyz_t, xyz);
|
||||
return (void *) (currententity->model->vboxyzofs + (hdr->numverts_vbo * pose * sizeof (meshxyz_t)) + xyzoffs);
|
||||
}
|
||||
|
||||
|
@ -108,9 +108,9 @@ Returns the offset of the first vertex's meshxyz_t.normal in the vbo for the
|
|||
given model and pose.
|
||||
=============
|
||||
*/
|
||||
static void *GLARB_GetNormalOffset (aliashdr_t *hdr, int pose)
|
||||
static void *GLARB_GetNormalOffset (aliashdr_t *hdr, int32_t pose)
|
||||
{
|
||||
const int normaloffs = offsetof (meshxyz_t, normal);
|
||||
const int32_t normaloffs = offsetof (meshxyz_t, normal);
|
||||
return (void *)(currententity->model->vboxyzofs + (hdr->numverts_vbo * pose * sizeof (meshxyz_t)) + normaloffs);
|
||||
}
|
||||
|
||||
|
@ -301,11 +301,11 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata)
|
|||
{
|
||||
float vertcolor[4];
|
||||
trivertx_t *verts1, *verts2;
|
||||
int *commands;
|
||||
int count;
|
||||
int32_t *commands;
|
||||
int32_t count;
|
||||
float u,v;
|
||||
float blend, iblend;
|
||||
qboolean lerping;
|
||||
bool lerping;
|
||||
|
||||
if (lerpdata.pose1 != lerpdata.pose2)
|
||||
{
|
||||
|
@ -326,7 +326,7 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata)
|
|||
blend = iblend = 0; // avoid bogus compiler warning
|
||||
}
|
||||
|
||||
commands = (int *)((byte *)paliashdr + paliashdr->commands);
|
||||
commands = (int32_t *)((byte *)paliashdr + paliashdr->commands);
|
||||
|
||||
vertcolor[3] = entalpha; //never changes, so there's no need to put this inside the loop
|
||||
|
||||
|
@ -408,14 +408,14 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata)
|
|||
R_SetupAliasFrame -- johnfitz -- rewritten to support lerping
|
||||
=================
|
||||
*/
|
||||
void R_SetupAliasFrame (aliashdr_t *paliashdr, int frame, lerpdata_t *lerpdata)
|
||||
void R_SetupAliasFrame (aliashdr_t *paliashdr, int32_t frame, lerpdata_t *lerpdata)
|
||||
{
|
||||
entity_t *e = currententity;
|
||||
int posenum, numposes;
|
||||
int32_t posenum, numposes;
|
||||
|
||||
if ((frame >= paliashdr->numframes) || (frame < 0))
|
||||
{
|
||||
Con_DPrintf ("R_AliasSetupFrame: no such frame %d for '%s'\n", frame, e->model->name);
|
||||
Con_DPrintf ("R_AliasSetupFrame: no such frame %" PRIi32 " for '%s'\n", frame, e->model->name);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ void R_SetupAliasFrame (aliashdr_t *paliashdr, int frame, lerpdata_t *lerpdata)
|
|||
if (numposes > 1)
|
||||
{
|
||||
e->lerptime = paliashdr->frames[frame].interval;
|
||||
posenum += (int)(cl.time / e->lerptime) % numposes;
|
||||
posenum += (int32_t)(cl.time / e->lerptime) % numposes;
|
||||
}
|
||||
else
|
||||
e->lerptime = 0.1;
|
||||
|
@ -481,7 +481,7 @@ void R_SetupEntityTransform (entity_t *e, lerpdata_t *lerpdata)
|
|||
{
|
||||
float blend;
|
||||
vec3_t d;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// if LERP_RESETMOVE, kill any lerps in progress
|
||||
if (e->lerpflags & LERP_RESETMOVE)
|
||||
|
@ -543,8 +543,8 @@ void R_SetupAliasLighting (entity_t *e)
|
|||
{
|
||||
vec3_t dist;
|
||||
float add;
|
||||
int i;
|
||||
int quantizedangle;
|
||||
int32_t i;
|
||||
int32_t quantizedangle;
|
||||
float radiansangle;
|
||||
|
||||
R_LightPoint (e->origin);
|
||||
|
@ -602,7 +602,7 @@ void R_SetupAliasLighting (entity_t *e)
|
|||
lightcolor[2] = 256.0f;
|
||||
}
|
||||
|
||||
quantizedangle = ((int)(e->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1);
|
||||
quantizedangle = ((int32_t)(e->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1);
|
||||
|
||||
//ericw -- shadevector is passed to the shader to compute shadedots inside the
|
||||
//shader, see GLAlias_CreateShaders()
|
||||
|
@ -625,10 +625,10 @@ R_DrawAliasModel -- johnfitz -- almost completely rewritten
|
|||
void R_DrawAliasModel (entity_t *e)
|
||||
{
|
||||
aliashdr_t *paliashdr;
|
||||
int i, anim, skinnum;
|
||||
int32_t i, anim, skinnum;
|
||||
gltexture_t *tx, *fb;
|
||||
lerpdata_t lerpdata;
|
||||
qboolean alphatest = !!(e->model->flags & MF_HOLEY);
|
||||
bool alphatest = !!(e->model->flags & MF_HOLEY);
|
||||
|
||||
//
|
||||
// setup pose/lerp data -- do it first so we don't miss updates due to culling
|
||||
|
@ -689,11 +689,11 @@ void R_DrawAliasModel (entity_t *e)
|
|||
// set up textures
|
||||
//
|
||||
GL_DisableMultitexture();
|
||||
anim = (int)(cl.time*10) & 3;
|
||||
anim = (int32_t)(cl.time*10) & 3;
|
||||
skinnum = e->skinnum;
|
||||
if ((skinnum >= paliashdr->numskins) || (skinnum < 0))
|
||||
{
|
||||
Con_DPrintf ("R_DrawAliasModel: no such skin # %d for '%s'\n", skinnum, e->model->name);
|
||||
Con_DPrintf ("R_DrawAliasModel: no such skin # %" PRIi32 " for '%s'\n", skinnum, e->model->name);
|
||||
// ericw -- display skin 0 for winquake compatibility
|
||||
skinnum = 0;
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ void R_DrawAliasModel (entity_t *e)
|
|||
glDisable (GL_TEXTURE_2D);
|
||||
GL_DrawAliasFrame (paliashdr, lerpdata);
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
srand((int) (cl.time * 1000)); //restore randomness
|
||||
srand((int32_t) (cl.time * 1000)); //restore randomness
|
||||
}
|
||||
else if (r_fullbright_cheatsafe)
|
||||
{
|
||||
|
|
110
source/r_brush.c
110
source/r_brush.c
|
@ -27,8 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
extern cvar_t gl_fullbrights, r_drawflat, gl_overbright, r_oldwater; //johnfitz
|
||||
extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix
|
||||
|
||||
int gl_lightmap_format;
|
||||
int lightmap_bytes;
|
||||
int32_t gl_lightmap_format;
|
||||
int32_t lightmap_bytes;
|
||||
|
||||
#define BLOCK_WIDTH 128
|
||||
#define BLOCK_HEIGHT 128
|
||||
|
@ -42,11 +42,11 @@ typedef struct glRect_s {
|
|||
} glRect_t;
|
||||
|
||||
glpoly_t *lightmap_polys[MAX_LIGHTMAPS];
|
||||
qboolean lightmap_modified[MAX_LIGHTMAPS];
|
||||
bool lightmap_modified[MAX_LIGHTMAPS];
|
||||
glRect_t lightmap_rectchange[MAX_LIGHTMAPS];
|
||||
|
||||
int allocated[MAX_LIGHTMAPS][BLOCK_WIDTH];
|
||||
int last_lightmap_allocated; //ericw -- optimization: remember the index of the last lightmap AllocBlock stored a surf in
|
||||
int32_t allocated[MAX_LIGHTMAPS][BLOCK_WIDTH];
|
||||
int32_t last_lightmap_allocated; //ericw -- optimization: remember the index of the last lightmap AllocBlock stored a surf in
|
||||
|
||||
// the lightmap texture data needs to be kept in
|
||||
// main memory so texsubimage can update properly
|
||||
|
@ -60,10 +60,10 @@ R_TextureAnimation -- johnfitz -- added "frame" param to eliminate use of "curre
|
|||
Returns the proper texture for a given time and base texture
|
||||
===============
|
||||
*/
|
||||
texture_t *R_TextureAnimation (texture_t *base, int frame)
|
||||
texture_t *R_TextureAnimation (texture_t *base, int32_t frame)
|
||||
{
|
||||
int relative;
|
||||
int count;
|
||||
int32_t relative;
|
||||
int32_t count;
|
||||
|
||||
if (frame)
|
||||
if (base->alternate_anims)
|
||||
|
@ -72,7 +72,7 @@ texture_t *R_TextureAnimation (texture_t *base, int frame)
|
|||
if (!base->anim_total)
|
||||
return base;
|
||||
|
||||
relative = (int)(cl.time*10) % base->anim_total;
|
||||
relative = (int32_t)(cl.time*10) % base->anim_total;
|
||||
|
||||
count = 0;
|
||||
while (base->anim_min > relative || base->anim_max <= relative)
|
||||
|
@ -95,7 +95,7 @@ DrawGLPoly
|
|||
void DrawGLPoly (glpoly_t *p)
|
||||
{
|
||||
float *v;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
glBegin (GL_POLYGON);
|
||||
v = p->verts[0];
|
||||
|
@ -115,7 +115,7 @@ DrawGLTriangleFan -- johnfitz -- like DrawGLPoly but for r_showtris
|
|||
void DrawGLTriangleFan (glpoly_t *p)
|
||||
{
|
||||
float *v;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
glBegin (GL_TRIANGLE_FAN);
|
||||
v = p->verts[0];
|
||||
|
@ -146,7 +146,7 @@ void R_DrawSequentialPoly (msurface_t *s)
|
|||
texture_t *t;
|
||||
float *v;
|
||||
float entalpha;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
t = R_TextureAnimation (s->texinfo->texture, currententity->frame);
|
||||
entalpha = ENTALPHA_DECODE(currententity->alpha);
|
||||
|
@ -183,17 +183,17 @@ void R_DrawSequentialPoly (msurface_t *s)
|
|||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glColor4f(1, 1, 1, entalpha);
|
||||
}
|
||||
|
||||
|
||||
if (s->flags & SURF_DRAWFENCE)
|
||||
glEnable (GL_ALPHA_TEST); // Flip on alpha test
|
||||
|
||||
|
||||
GL_Bind (t->gltexture);
|
||||
DrawGLPoly (s->polys);
|
||||
rs_brushpasses++;
|
||||
|
||||
|
||||
if (s->flags & SURF_DRAWFENCE)
|
||||
glDisable (GL_ALPHA_TEST); // Flip alpha test back off
|
||||
|
||||
|
||||
if (entalpha < 1)
|
||||
{
|
||||
glDepthMask(GL_TRUE);
|
||||
|
@ -317,10 +317,10 @@ void R_DrawSequentialPoly (msurface_t *s)
|
|||
}
|
||||
else
|
||||
glColor3f(1, 1, 1);
|
||||
|
||||
|
||||
if (s->flags & SURF_DRAWFENCE)
|
||||
glEnable (GL_ALPHA_TEST); // Flip on alpha test
|
||||
|
||||
|
||||
if (gl_overbright.value)
|
||||
{
|
||||
if (gl_texture_env_combine && gl_mtexable) //case 1: texture and lightmap in one pass, overbright using texture combiners
|
||||
|
@ -481,10 +481,10 @@ void R_DrawSequentialPoly (msurface_t *s)
|
|||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glColor3f(1, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
if (s->flags & SURF_DRAWFENCE)
|
||||
glDisable (GL_ALPHA_TEST); // Flip alpha test back off
|
||||
|
||||
|
||||
fullbrights:
|
||||
if (gl_fullbrights.value && t->fullbright)
|
||||
{
|
||||
|
@ -513,7 +513,7 @@ R_DrawBrushModel
|
|||
*/
|
||||
void R_DrawBrushModel (entity_t *e)
|
||||
{
|
||||
int i, k;
|
||||
int32_t i, k;
|
||||
msurface_t *psurf;
|
||||
float dot;
|
||||
mplane_t *pplane;
|
||||
|
@ -598,7 +598,7 @@ R_DrawBrushModel_ShowTris -- johnfitz
|
|||
*/
|
||||
void R_DrawBrushModel_ShowTris (entity_t *e)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *psurf;
|
||||
float dot;
|
||||
mplane_t *pplane;
|
||||
|
@ -669,9 +669,9 @@ called during rendering
|
|||
void R_RenderDynamicLightmaps (msurface_t *fa)
|
||||
{
|
||||
byte *base;
|
||||
int maps;
|
||||
int32_t maps;
|
||||
glRect_t *theRect;
|
||||
int smax, tmax;
|
||||
int32_t smax, tmax;
|
||||
|
||||
if (fa->flags & SURF_DRAWTILED) //johnfitz -- not a lightmapped surface
|
||||
return;
|
||||
|
@ -721,11 +721,11 @@ dynamic:
|
|||
AllocBlock -- returns a texture number and the position inside it
|
||||
========================
|
||||
*/
|
||||
int AllocBlock (int w, int h, int *x, int *y)
|
||||
int32_t AllocBlock (int32_t w, int32_t h, int32_t *x, int32_t *y)
|
||||
{
|
||||
int i, j;
|
||||
int best, best2;
|
||||
int texnum;
|
||||
int32_t i, j;
|
||||
int32_t best, best2;
|
||||
int32_t texnum;
|
||||
|
||||
// ericw -- rather than searching starting at lightmap 0 every time,
|
||||
// start at the last lightmap we allocated a surface in.
|
||||
|
@ -771,7 +771,7 @@ int AllocBlock (int w, int h, int *x, int *y)
|
|||
mvertex_t *r_pcurrentvertbase;
|
||||
qmodel_t *currentmodel;
|
||||
|
||||
int nColinElim;
|
||||
int32_t nColinElim;
|
||||
|
||||
/*
|
||||
========================
|
||||
|
@ -780,7 +780,7 @@ GL_CreateSurfaceLightmap
|
|||
*/
|
||||
void GL_CreateSurfaceLightmap (msurface_t *surf)
|
||||
{
|
||||
int smax, tmax;
|
||||
int32_t smax, tmax;
|
||||
byte *base;
|
||||
|
||||
smax = (surf->extents[0]>>4)+1;
|
||||
|
@ -799,7 +799,7 @@ BuildSurfaceDisplayList -- called at level load time
|
|||
*/
|
||||
void BuildSurfaceDisplayList (msurface_t *fa)
|
||||
{
|
||||
int i, lindex, lnumverts;
|
||||
int32_t i, lindex, lnumverts;
|
||||
medge_t *pedges, *r_pedge;
|
||||
float *vec;
|
||||
float s, t;
|
||||
|
@ -877,7 +877,7 @@ void GL_BuildLightmaps (void)
|
|||
{
|
||||
char name[16];
|
||||
byte *data;
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
qmodel_t *m;
|
||||
|
||||
memset (allocated, 0, sizeof(allocated));
|
||||
|
@ -938,7 +938,7 @@ void GL_BuildLightmaps (void)
|
|||
lightmap_rectchange[i].h = 0;
|
||||
|
||||
//johnfitz -- use texture manager
|
||||
sprintf(name, "lightmap%03i",i);
|
||||
sprintf(name, "lightmap%03" PRIi32 "",i);
|
||||
data = lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes;
|
||||
lightmap_textures[i] = TexMgr_LoadImage (cl.worldmodel, name, BLOCK_WIDTH, BLOCK_HEIGHT,
|
||||
SRC_LIGHTMAP, data, "", (src_offset_t)data, TEXPREF_LINEAR | TEXPREF_NOPICMIP);
|
||||
|
@ -947,7 +947,7 @@ void GL_BuildLightmaps (void)
|
|||
|
||||
//johnfitz -- warn about exceeding old limits
|
||||
if (i >= 64)
|
||||
Con_DWarning ("%i lightmaps exceeds standard limit of 64 (max = %d).\n", i, MAX_LIGHTMAPS);
|
||||
Con_DWarning ("%" PRIi32 " lightmaps exceeds standard limit of 64 (max = %" PRIi32 ").\n", i, MAX_LIGHTMAPS);
|
||||
//johnfitz
|
||||
}
|
||||
|
||||
|
@ -983,7 +983,7 @@ surfaces from world + all brush models
|
|||
void GL_BuildBModelVertexBuffer (void)
|
||||
{
|
||||
uint32_t numverts, varray_bytes, varray_index;
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
qmodel_t *m;
|
||||
float *varray;
|
||||
|
||||
|
@ -993,7 +993,7 @@ void GL_BuildBModelVertexBuffer (void)
|
|||
// ask GL for a name for our VBO
|
||||
GL_DeleteBuffersFunc (1, &gl_bmodel_vbo);
|
||||
GL_GenBuffersFunc (1, &gl_bmodel_vbo);
|
||||
|
||||
|
||||
// count all verts in all models
|
||||
numverts = 0;
|
||||
for (j=1 ; j<MAX_MODELS ; j++)
|
||||
|
@ -1007,12 +1007,12 @@ void GL_BuildBModelVertexBuffer (void)
|
|||
numverts += m->surfaces[i].numedges;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// build vertex array
|
||||
varray_bytes = VERTEXSIZE * sizeof(float) * numverts;
|
||||
varray = (float *) malloc (varray_bytes);
|
||||
varray_index = 0;
|
||||
|
||||
|
||||
for (j=1 ; j<MAX_MODELS ; j++)
|
||||
{
|
||||
m = cl.model_precache[j];
|
||||
|
@ -1032,7 +1032,7 @@ void GL_BuildBModelVertexBuffer (void)
|
|||
GL_BindBufferFunc (GL_ARRAY_BUFFER, gl_bmodel_vbo);
|
||||
GL_BufferDataFunc (GL_ARRAY_BUFFER, varray_bytes, varray, GL_STATIC_DRAW);
|
||||
free (varray);
|
||||
|
||||
|
||||
// invalidate the cached bindings
|
||||
GL_ClearBufferBindings ();
|
||||
}
|
||||
|
@ -1044,13 +1044,13 @@ R_AddDynamicLights
|
|||
*/
|
||||
void R_AddDynamicLights (msurface_t *surf)
|
||||
{
|
||||
int lnum;
|
||||
int sd, td;
|
||||
int32_t lnum;
|
||||
int32_t sd, td;
|
||||
float dist, rad, minlight;
|
||||
vec3_t impact, local;
|
||||
int s, t;
|
||||
int i;
|
||||
int smax, tmax;
|
||||
int32_t s, t;
|
||||
int32_t i;
|
||||
int32_t smax, tmax;
|
||||
mtexinfo_t *tex;
|
||||
//johnfitz -- lit support via lordhavoc
|
||||
float cred, cgreen, cblue, brightness;
|
||||
|
@ -1111,9 +1111,9 @@ void R_AddDynamicLights (msurface_t *surf)
|
|||
//johnfitz -- lit support via lordhavoc
|
||||
{
|
||||
brightness = rad - dist;
|
||||
bl[0] += (int) (brightness * cred);
|
||||
bl[1] += (int) (brightness * cgreen);
|
||||
bl[2] += (int) (brightness * cblue);
|
||||
bl[0] += (int32_t) (brightness * cred);
|
||||
bl[1] += (int32_t) (brightness * cgreen);
|
||||
bl[2] += (int32_t) (brightness * cblue);
|
||||
}
|
||||
bl += 3;
|
||||
//johnfitz
|
||||
|
@ -1130,14 +1130,14 @@ R_BuildLightMap -- johnfitz -- revised for lit support via lordhavoc
|
|||
Combine and scale multiple lightmaps into the 8.8 format in blocklights
|
||||
===============
|
||||
*/
|
||||
void R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
|
||||
void R_BuildLightMap (msurface_t *surf, byte *dest, int32_t stride)
|
||||
{
|
||||
int smax, tmax;
|
||||
int r,g,b;
|
||||
int i, j, size;
|
||||
int32_t smax, tmax;
|
||||
int32_t r,g,b;
|
||||
int32_t i, j, size;
|
||||
byte *lightmap;
|
||||
unsigned scale;
|
||||
int maps;
|
||||
int32_t maps;
|
||||
unsigned *bl;
|
||||
|
||||
surf->cached_dlight = (surf->dlightframe == r_framecount);
|
||||
|
@ -1250,7 +1250,7 @@ R_UploadLightmap -- johnfitz -- uploads the modified lightmap to opengl if neces
|
|||
assumes lightmap texture is already bound
|
||||
===============
|
||||
*/
|
||||
static void R_UploadLightmap(int lmap)
|
||||
static void R_UploadLightmap(int32_t lmap)
|
||||
{
|
||||
glRect_t *theRect;
|
||||
|
||||
|
@ -1272,7 +1272,7 @@ static void R_UploadLightmap(int lmap)
|
|||
|
||||
void R_UploadLightmaps (void)
|
||||
{
|
||||
int lmap;
|
||||
int32_t lmap;
|
||||
|
||||
for (lmap = 0; lmap < MAX_LIGHTMAPS; lmap++)
|
||||
{
|
||||
|
@ -1291,7 +1291,7 @@ R_RebuildAllLightmaps -- johnfitz -- called when gl_overbright gets toggled
|
|||
*/
|
||||
void R_RebuildAllLightmaps (void)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
qmodel_t *mod;
|
||||
msurface_t *fa;
|
||||
byte *base;
|
||||
|
|
|
@ -28,15 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's
|
||||
// on the command line
|
||||
|
||||
int ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61};
|
||||
int ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66};
|
||||
int ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
|
||||
int32_t ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61};
|
||||
int32_t ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66};
|
||||
int32_t ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
|
||||
|
||||
particle_t *active_particles, *free_particles, *particles;
|
||||
|
||||
vec3_t r_pright, r_pup, r_ppn;
|
||||
|
||||
int r_numparticles;
|
||||
int32_t r_numparticles;
|
||||
|
||||
gltexture_t *particletexture, *particletexture1, *particletexture2, *particletexture3, *particletexture4; //johnfitz
|
||||
float texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures
|
||||
|
@ -49,10 +49,10 @@ cvar_t r_quadparticles = {"r_quadparticles","1", CVAR_ARCHIVE}; //johnfitz
|
|||
R_ParticleTextureLookup -- johnfitz -- generate nice antialiased 32x32 circle for particles
|
||||
===============
|
||||
*/
|
||||
int R_ParticleTextureLookup (int x, int y, int sharpness)
|
||||
int32_t R_ParticleTextureLookup (int32_t x, int32_t y, int32_t sharpness)
|
||||
{
|
||||
int r; //distance from point x,y to circle origin, squared
|
||||
int a; //alpha value to return
|
||||
int32_t r; //distance from point x,y to circle origin, squared
|
||||
int32_t a; //alpha value to return
|
||||
|
||||
x -= 16;
|
||||
y -= 16;
|
||||
|
@ -70,7 +70,7 @@ R_InitParticleTextures -- johnfitz -- rewritten
|
|||
*/
|
||||
void R_InitParticleTextures (void)
|
||||
{
|
||||
int x,y;
|
||||
int32_t x,y;
|
||||
static byte particle1_data[64*64*4];
|
||||
static byte particle2_data[2*2*4];
|
||||
static byte particle3_data[64*64*4];
|
||||
|
@ -125,7 +125,7 @@ R_SetParticleTexture_f -- johnfitz
|
|||
static void R_SetParticleTexture_f (cvar_t *var)
|
||||
{
|
||||
(void)var;
|
||||
switch ((int)(r_particles.value))
|
||||
switch ((int32_t)(r_particles.value))
|
||||
{
|
||||
case 1:
|
||||
particletexture = particletexture1;
|
||||
|
@ -149,13 +149,13 @@ R_InitParticles
|
|||
*/
|
||||
void R_InitParticles (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
i = COM_CheckParm ("-particles");
|
||||
|
||||
if (i)
|
||||
{
|
||||
r_numparticles = (int)(Q_atoi(com_argv[i+1]));
|
||||
r_numparticles = (int32_t)(Q_atoi(com_argv[i+1]));
|
||||
if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
|
||||
r_numparticles = ABSOLUTE_MIN_PARTICLES;
|
||||
}
|
||||
|
@ -189,12 +189,12 @@ float timescale = 0.01;
|
|||
|
||||
void R_EntityParticles (entity_t *ent)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
particle_t *p;
|
||||
float angle;
|
||||
float sp, sy, cp, cy;
|
||||
// float sr, cr;
|
||||
// int count;
|
||||
// int32_t count;
|
||||
vec3_t forward;
|
||||
float dist;
|
||||
|
||||
|
@ -251,7 +251,7 @@ R_ClearParticles
|
|||
*/
|
||||
void R_ClearParticles (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
free_particles = &particles[0];
|
||||
active_particles = NULL;
|
||||
|
@ -270,8 +270,8 @@ void R_ReadPointFile_f (void)
|
|||
{
|
||||
FILE *f;
|
||||
vec3_t org;
|
||||
int r;
|
||||
int c;
|
||||
int32_t r;
|
||||
int32_t c;
|
||||
particle_t *p;
|
||||
char name[MAX_QPATH];
|
||||
|
||||
|
@ -315,7 +315,7 @@ void R_ReadPointFile_f (void)
|
|||
}
|
||||
|
||||
fclose (f);
|
||||
Con_Printf ("%i points read\n", c);
|
||||
Con_Printf ("%" PRIi32 " points read\n", c);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -328,7 +328,7 @@ Parse an effect out of the server message
|
|||
void R_ParseParticleEffect (void)
|
||||
{
|
||||
vec3_t org, dir;
|
||||
int i, count, msgcount, color;
|
||||
int32_t i, count, msgcount, color;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
org[i] = MSG_ReadCoord (cl.protocolflags);
|
||||
|
@ -352,7 +352,7 @@ R_ParticleExplosion
|
|||
*/
|
||||
void R_ParticleExplosion (vec3_t org)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
particle_t *p;
|
||||
|
||||
for (i=0 ; i<1024 ; i++)
|
||||
|
@ -393,11 +393,11 @@ void R_ParticleExplosion (vec3_t org)
|
|||
R_ParticleExplosion2
|
||||
===============
|
||||
*/
|
||||
void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
|
||||
void R_ParticleExplosion2 (vec3_t org, int32_t colorStart, int32_t colorLength)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
particle_t *p;
|
||||
int colorMod = 0;
|
||||
int32_t colorMod = 0;
|
||||
|
||||
for (i=0; i<512; i++)
|
||||
{
|
||||
|
@ -428,7 +428,7 @@ R_BlobExplosion
|
|||
*/
|
||||
void R_BlobExplosion (vec3_t org)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
particle_t *p;
|
||||
|
||||
for (i=0 ; i<1024 ; i++)
|
||||
|
@ -470,9 +470,9 @@ void R_BlobExplosion (vec3_t org)
|
|||
R_RunParticleEffect
|
||||
===============
|
||||
*/
|
||||
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
|
||||
void R_RunParticleEffect (vec3_t org, vec3_t dir, int32_t color, int32_t count)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
particle_t *p;
|
||||
|
||||
for (i=0 ; i<count ; i++)
|
||||
|
@ -529,7 +529,7 @@ R_LavaSplash
|
|||
*/
|
||||
void R_LavaSplash (vec3_t org)
|
||||
{
|
||||
int i, j, k;
|
||||
int32_t i, j, k;
|
||||
particle_t *p;
|
||||
float vel;
|
||||
vec3_t dir;
|
||||
|
@ -570,7 +570,7 @@ R_TeleportSplash
|
|||
*/
|
||||
void R_TeleportSplash (vec3_t org)
|
||||
{
|
||||
int i, j, k;
|
||||
int32_t i, j, k;
|
||||
particle_t *p;
|
||||
float vel;
|
||||
vec3_t dir;
|
||||
|
@ -611,14 +611,14 @@ R_RocketTrail
|
|||
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;
|
||||
float len;
|
||||
int j;
|
||||
int32_t j;
|
||||
particle_t *p;
|
||||
int dec;
|
||||
static int tracercount;
|
||||
int32_t dec;
|
||||
static int32_t tracercount;
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
@ -648,7 +648,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
|
|||
{
|
||||
case 0: // rocket trail
|
||||
p->ramp = (rand()&3);
|
||||
p->color = ramp3[(int)p->ramp];
|
||||
p->color = ramp3[(int32_t)p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->org[j] = start[j] + ((rand()%6)-3);
|
||||
|
@ -656,7 +656,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
|
|||
|
||||
case 1: // smoke smoke
|
||||
p->ramp = (rand()&3) + 2;
|
||||
p->color = ramp3[(int)p->ramp];
|
||||
p->color = ramp3[(int32_t)p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->org[j] = start[j] + ((rand()%6)-3);
|
||||
|
@ -722,7 +722,7 @@ CL_RunParticles -- johnfitz -- all the particle behavior, separated from R_DrawP
|
|||
void CL_RunParticles (void)
|
||||
{
|
||||
particle_t *p, *kill;
|
||||
int i;
|
||||
int32_t i;
|
||||
float time1, time2, time3, dvel, frametime, grav;
|
||||
extern cvar_t sv_gravity;
|
||||
|
||||
|
@ -774,7 +774,7 @@ void CL_RunParticles (void)
|
|||
if (p->ramp >= 6)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp3[(int)p->ramp];
|
||||
p->color = ramp3[(int32_t)p->ramp];
|
||||
p->vel[2] += grav;
|
||||
break;
|
||||
|
||||
|
@ -783,7 +783,7 @@ void CL_RunParticles (void)
|
|||
if (p->ramp >=8)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp1[(int)p->ramp];
|
||||
p->color = ramp1[(int32_t)p->ramp];
|
||||
for (i=0 ; i<3 ; i++)
|
||||
p->vel[i] += p->vel[i]*dvel;
|
||||
p->vel[2] -= grav;
|
||||
|
@ -794,7 +794,7 @@ void CL_RunParticles (void)
|
|||
if (p->ramp >=8)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp2[(int)p->ramp];
|
||||
p->color = ramp2[(int32_t)p->ramp];
|
||||
for (i=0 ; i<3 ; i++)
|
||||
p->vel[i] -= p->vel[i]*frametime;
|
||||
p->vel[2] -= grav;
|
||||
|
@ -868,12 +868,12 @@ void R_DrawParticles (void)
|
|||
scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures
|
||||
|
||||
//johnfitz -- particle transparency and fade out
|
||||
c = (GLubyte *) &d_8to24table[(int)p->color];
|
||||
c = (GLubyte *) &d_8to24table[(int32_t)p->color];
|
||||
color[0] = c[0];
|
||||
color[1] = c[1];
|
||||
color[2] = c[2];
|
||||
//alpha = CLAMP(0, p->die + 0.5 - cl.time, 1);
|
||||
color[3] = 255; //(int)(alpha * 255);
|
||||
color[3] = 255; //(int32_t)(alpha * 255);
|
||||
glColor4ubv(color);
|
||||
//johnfitz
|
||||
|
||||
|
@ -913,12 +913,12 @@ void R_DrawParticles (void)
|
|||
scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures
|
||||
|
||||
//johnfitz -- particle transparency and fade out
|
||||
c = (GLubyte *) &d_8to24table[(int)p->color];
|
||||
c = (GLubyte *) &d_8to24table[(int32_t)p->color];
|
||||
color[0] = c[0];
|
||||
color[1] = c[1];
|
||||
color[2] = c[2];
|
||||
//alpha = CLAMP(0, p->die + 0.5 - cl.time, 1);
|
||||
color[3] = 255; //(int)(alpha * 255);
|
||||
color[3] = 255; //(int32_t)(alpha * 255);
|
||||
glColor4ubv(color);
|
||||
//johnfitz
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currentent)
|
|||
msprite_t *psprite;
|
||||
mspritegroup_t *pspritegroup;
|
||||
mspriteframe_t *pspriteframe;
|
||||
int i, numframes, frame;
|
||||
int32_t i, numframes, frame;
|
||||
float *pintervals, fullinterval, targettime, time;
|
||||
|
||||
psprite = (msprite_t *) currentent->model->cache.data;
|
||||
|
@ -41,7 +41,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currentent)
|
|||
|
||||
if ((frame >= psprite->numframes) || (frame < 0))
|
||||
{
|
||||
Con_DPrintf ("R_DrawSprite: no such frame %d for '%s'\n", frame, currentent->model->name);
|
||||
Con_DPrintf ("R_DrawSprite: no such frame %" PRIi32 " for '%s'\n", frame, currentent->model->name);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currentent)
|
|||
|
||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||
// are positive, so we don't have to worry about division by 0
|
||||
targettime = time - ((int)(time / fullinterval)) * fullinterval;
|
||||
targettime = time - ((int32_t)(time / fullinterval)) * fullinterval;
|
||||
|
||||
for (i=0 ; i<(numframes-1) ; i++)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ extern glpoly_t *lightmap_polys[MAX_LIGHTMAPS];
|
|||
|
||||
byte *SV_FatPVS (vec3_t org, qmodel_t *worldmodel);
|
||||
|
||||
int vis_changed; //if true, force pvs to be refreshed
|
||||
int32_t vis_changed; //if true, force pvs to be refreshed
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
|
@ -48,7 +48,7 @@ clears the lightmap chains
|
|||
*/
|
||||
void R_ClearTextureChains (qmodel_t *mod, texchain_t chain)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// set all chains to null
|
||||
for (i=0 ; i<mod->numtextures ; i++)
|
||||
|
@ -81,8 +81,8 @@ void R_MarkSurfaces (void)
|
|||
mleaf_t *leaf;
|
||||
mnode_t *node;
|
||||
msurface_t *surf, **mark;
|
||||
int i, j;
|
||||
qboolean nearwaterportal;
|
||||
int32_t i, j;
|
||||
bool nearwaterportal;
|
||||
|
||||
// clear lightmap chains
|
||||
memset (lightmap_polys, 0, sizeof(lightmap_polys));
|
||||
|
@ -169,7 +169,7 @@ void R_MarkSurfaces (void)
|
|||
R_BackFaceCull -- johnfitz -- returns true if the surface is facing away from vieworg
|
||||
================
|
||||
*/
|
||||
qboolean R_BackFaceCull (msurface_t *surf)
|
||||
bool R_BackFaceCull (msurface_t *surf)
|
||||
{
|
||||
double dot;
|
||||
|
||||
|
@ -203,7 +203,7 @@ R_CullSurfaces -- johnfitz
|
|||
void R_CullSurfaces (void)
|
||||
{
|
||||
msurface_t *s;
|
||||
int i;
|
||||
int32_t i;
|
||||
texture_t *t;
|
||||
|
||||
if (!r_drawworld_cheatsafe)
|
||||
|
@ -245,7 +245,7 @@ void R_BuildLightmapChains (qmodel_t *model, texchain_t chain)
|
|||
{
|
||||
texture_t *t;
|
||||
msurface_t *s;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
// clear lightmap chains (already done in r_marksurfaces, but clearing them here to be safe becuase of r_stereo)
|
||||
memset (lightmap_polys, 0, sizeof(lightmap_polys));
|
||||
|
@ -309,7 +309,7 @@ R_DrawTextureChains_ShowTris -- johnfitz
|
|||
*/
|
||||
void R_DrawTextureChains_ShowTris (qmodel_t *model, texchain_t chain)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
glpoly_t *p;
|
||||
|
@ -347,7 +347,7 @@ R_DrawTextureChains_Drawflat -- johnfitz
|
|||
*/
|
||||
void R_DrawTextureChains_Drawflat (qmodel_t *model, texchain_t chain)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
glpoly_t *p;
|
||||
|
@ -383,7 +383,7 @@ void R_DrawTextureChains_Drawflat (qmodel_t *model, texchain_t chain)
|
|||
}
|
||||
}
|
||||
glColor3f (1,1,1);
|
||||
srand ((int) (cl.time * 1000));
|
||||
srand ((int32_t) (cl.time * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -393,11 +393,11 @@ R_DrawTextureChains_Glow -- johnfitz
|
|||
*/
|
||||
void R_DrawTextureChains_Glow (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
gltexture_t *glt;
|
||||
qboolean bound;
|
||||
bool bound;
|
||||
|
||||
for (i=0 ; i<model->numtextures ; i++)
|
||||
{
|
||||
|
@ -443,7 +443,7 @@ The number of indices it will write is given by R_NumTriangleIndicesForSurf.
|
|||
*/
|
||||
static void R_TriangleIndicesForSurf (msurface_t *s, uint32_t *dest)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for (i=2; i<s->numedges; i++)
|
||||
{
|
||||
*dest++ = s->vbo_firstvert;
|
||||
|
@ -493,7 +493,7 @@ using VBOs.
|
|||
*/
|
||||
static void R_BatchSurface (msurface_t *s)
|
||||
{
|
||||
int num_surf_indices;
|
||||
int32_t num_surf_indices;
|
||||
|
||||
num_surf_indices = R_NumTriangleIndicesForSurf (s);
|
||||
|
||||
|
@ -511,11 +511,11 @@ R_DrawTextureChains_Multitexture -- johnfitz
|
|||
*/
|
||||
void R_DrawTextureChains_Multitexture (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
float *v;
|
||||
qboolean bound;
|
||||
bool bound;
|
||||
|
||||
for (i=0 ; i<model->numtextures ; i++)
|
||||
{
|
||||
|
@ -566,10 +566,10 @@ draws surfs whose textures were missing from the BSP
|
|||
*/
|
||||
void R_DrawTextureChains_NoTexture (qmodel_t *model, texchain_t chain)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
qboolean bound;
|
||||
bool bound;
|
||||
|
||||
for (i=0 ; i<model->numtextures ; i++)
|
||||
{
|
||||
|
@ -601,10 +601,10 @@ R_DrawTextureChains_TextureOnly -- johnfitz
|
|||
*/
|
||||
void R_DrawTextureChains_TextureOnly (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
qboolean bound;
|
||||
bool bound;
|
||||
|
||||
for (i=0 ; i<model->numtextures ; i++)
|
||||
{
|
||||
|
@ -660,11 +660,11 @@ R_DrawTextureChains_Water -- johnfitz
|
|||
*/
|
||||
void R_DrawTextureChains_Water (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
glpoly_t *p;
|
||||
qboolean bound;
|
||||
bool bound;
|
||||
float entalpha;
|
||||
|
||||
if (r_drawflat_cheatsafe || r_lightmap_cheatsafe) // ericw -- !r_drawworld_cheatsafe check moved to R_DrawWorld_Water ()
|
||||
|
@ -741,7 +741,7 @@ R_DrawTextureChains_White -- johnfitz -- draw sky and water as white polys when
|
|||
*/
|
||||
void R_DrawTextureChains_White (qmodel_t *model, texchain_t chain)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
|
||||
|
@ -770,7 +770,7 @@ R_DrawLightmapChains -- johnfitz -- R_BlendLightmaps stripped down to almost not
|
|||
*/
|
||||
void R_DrawLightmapChains (void)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
glpoly_t *p;
|
||||
float *v;
|
||||
|
||||
|
@ -903,11 +903,11 @@ Requires 3 TMUs, OpenGL 2.0
|
|||
*/
|
||||
void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
msurface_t *s;
|
||||
texture_t *t;
|
||||
qboolean bound;
|
||||
int lastlightmap;
|
||||
bool bound;
|
||||
int32_t lastlightmap;
|
||||
gltexture_t *fullbright = NULL;
|
||||
float entalpha;
|
||||
|
||||
|
@ -939,7 +939,7 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
|||
GL_Uniform1iFunc (LMTexLoc, 1);
|
||||
GL_Uniform1iFunc (fullbrightTexLoc, 2);
|
||||
GL_Uniform1iFunc (useFullbrightTexLoc, 0);
|
||||
GL_Uniform1iFunc (useOverbrightLoc, (int)gl_overbright.value);
|
||||
GL_Uniform1iFunc (useOverbrightLoc, (int32_t)gl_overbright.value);
|
||||
GL_Uniform1iFunc (useAlphaTestLoc, 0);
|
||||
GL_Uniform1fFunc (alphaLoc, entalpha);
|
||||
|
||||
|
|
|
@ -48,9 +48,9 @@ typedef struct efrag_s
|
|||
|
||||
typedef struct entity_s
|
||||
{
|
||||
qboolean forcelink; // model changed
|
||||
bool forcelink; // model changed
|
||||
|
||||
int update_type;
|
||||
int32_t update_type;
|
||||
|
||||
entity_state_t baseline; // to fill in defaults in updates
|
||||
|
||||
|
@ -61,19 +61,19 @@ typedef struct entity_s
|
|||
vec3_t angles;
|
||||
struct qmodel_s *model; // NULL = no model
|
||||
struct efrag_s *efrag; // linked list of efrags
|
||||
int frame;
|
||||
int32_t frame;
|
||||
float syncbase; // for client-side animations
|
||||
byte *colormap;
|
||||
int effects; // light, particles, etc
|
||||
int skinnum; // for Alias models
|
||||
int visframe; // last frame this entity was
|
||||
int32_t effects; // light, particles, etc
|
||||
int32_t skinnum; // for Alias models
|
||||
int32_t visframe; // last frame this entity was
|
||||
// found in an active leaf
|
||||
|
||||
int dlightframe; // dynamic lighting
|
||||
int dlightbits;
|
||||
int32_t dlightframe; // dynamic lighting
|
||||
int32_t dlightbits;
|
||||
|
||||
// FIXME: could turn these into a union
|
||||
int trivial_accept;
|
||||
int32_t trivial_accept;
|
||||
struct mnode_s *topnode; // for bmodels, first world node
|
||||
// that splits bmodel, or NULL if
|
||||
// not split
|
||||
|
@ -99,14 +99,14 @@ typedef struct
|
|||
vrect_t vrect; // subwindow in video for refresh
|
||||
// FIXME: not need vrect next field here?
|
||||
vrect_t aliasvrect; // scaled Alias version
|
||||
int vrectright, vrectbottom; // right & bottom screen coords
|
||||
int aliasvrectright, aliasvrectbottom; // scaled Alias versions
|
||||
int32_t vrectright, vrectbottom; // right & bottom screen coords
|
||||
int32_t aliasvrectright, aliasvrectbottom; // scaled Alias versions
|
||||
float vrectrightedge; // rightmost right edge we care about,
|
||||
// for use in edge list
|
||||
float fvrectx, fvrecty; // for floating-point compares
|
||||
float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
|
||||
int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
|
||||
int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
|
||||
int32_t vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
|
||||
int32_t vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
|
||||
float fvrectright_adj, fvrectbottom_adj;
|
||||
// right and bottom edges, for clamping
|
||||
float fvrectright; // rightmost edge, for Alias clamping
|
||||
|
@ -121,14 +121,14 @@ typedef struct
|
|||
|
||||
float fov_x, fov_y;
|
||||
|
||||
int ambientlight;
|
||||
int32_t ambientlight;
|
||||
} refdef_t;
|
||||
|
||||
|
||||
//
|
||||
// refresh
|
||||
//
|
||||
extern int reinit_surfcache;
|
||||
extern int32_t reinit_surfcache;
|
||||
|
||||
|
||||
extern refdef_t r_refdef;
|
||||
|
@ -139,7 +139,7 @@ void R_Init (void);
|
|||
void R_InitTextures (void);
|
||||
void R_InitEfrags (void);
|
||||
void R_RenderView (void); // must set r_refdef first
|
||||
void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect);
|
||||
void R_ViewChanged (vrect_t *pvrect, int32_t lineadj, float aspect);
|
||||
// called whenever r_refdef or vid change
|
||||
//void R_InitSky (struct texture_s *mt); // called at level load
|
||||
|
||||
|
@ -150,12 +150,12 @@ void R_NewMap (void);
|
|||
|
||||
|
||||
void R_ParseParticleEffect (void);
|
||||
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
|
||||
void R_RocketTrail (vec3_t start, vec3_t end, int type);
|
||||
void R_RunParticleEffect (vec3_t org, vec3_t dir, int32_t color, int32_t count);
|
||||
void R_RocketTrail (vec3_t start, vec3_t end, int32_t type);
|
||||
void R_EntityParticles (entity_t *ent);
|
||||
void R_BlobExplosion (vec3_t org);
|
||||
void R_ParticleExplosion (vec3_t org);
|
||||
void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
|
||||
void R_ParticleExplosion2 (vec3_t org, int32_t colorStart, int32_t colorLength);
|
||||
void R_LavaSplash (vec3_t org);
|
||||
void R_TeleportSplash (vec3_t org);
|
||||
|
||||
|
@ -165,14 +165,14 @@ void R_PushDlights (void);
|
|||
//
|
||||
// surface cache related
|
||||
//
|
||||
extern int reinit_surfcache; // if 1, surface cache is currently empty and
|
||||
extern qboolean r_cache_thrash; // set if thrashing the surface cache
|
||||
extern int32_t reinit_surfcache; // if 1, surface cache is currently empty and
|
||||
extern bool r_cache_thrash; // set if thrashing the surface cache
|
||||
|
||||
int D_SurfaceCacheForRes (int width, int height);
|
||||
int32_t D_SurfaceCacheForRes (int32_t width, int32_t height);
|
||||
void D_FlushCaches (void);
|
||||
void D_DeleteSurfaceCache (void);
|
||||
void D_InitCaches (void *buffer, int size);
|
||||
void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
|
||||
void D_InitCaches (void *buffer, int32_t size);
|
||||
void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int32_t lineadj);
|
||||
|
||||
#endif /* _QUAKE_RENDER_H */
|
||||
|
||||
|
|
158
source/sbar.c
158
source/sbar.c
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
int sb_updates; // if >= vid.numpages, no update needed
|
||||
int32_t sb_updates; // if >= vid.numpages, no update needed
|
||||
|
||||
#define STAT_MINUS 10 // num frame for '-' stats digit
|
||||
|
||||
|
@ -46,9 +46,9 @@ qpic_t *sb_face_quad;
|
|||
qpic_t *sb_face_invuln;
|
||||
qpic_t *sb_face_invis_invuln;
|
||||
|
||||
qboolean 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_weapons[5];
|
||||
|
@ -59,13 +59,13 @@ qpic_t *rsb_teambord; // PGM 01/19/97 - team color border
|
|||
//MED 01/04/97 added two more weapons + 3 alternates for grenade launcher
|
||||
qpic_t *hsb_weapons[7][5]; // 0 is active, 1 is owned, 2-5 are flashes
|
||||
//MED 01/04/97 added array to simplify weapon parsing
|
||||
int hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT};
|
||||
int32_t hipweapons[4] = {HIT_LASER_CANNON_BIT,HIT_MJOLNIR_BIT,4,HIT_PROXIMITY_GUN_BIT};
|
||||
//MED 01/04/97 added hipnotic items array
|
||||
qpic_t *hsb_items[2];
|
||||
|
||||
void Sbar_MiniDeathmatchOverlay (void);
|
||||
void Sbar_DeathmatchOverlay (void);
|
||||
void M_DrawPic (int x, int y, qpic_t *pic);
|
||||
void M_DrawPic (int32_t x, int32_t y, qpic_t *pic);
|
||||
|
||||
/*
|
||||
===============
|
||||
|
@ -112,12 +112,12 @@ Sbar_LoadPics -- johnfitz -- load all the sbar pics
|
|||
*/
|
||||
void Sbar_LoadPics (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
sb_nums[0][i] = Draw_PicFromWad (va("num_%i",i));
|
||||
sb_nums[1][i] = Draw_PicFromWad (va("anum_%i",i));
|
||||
sb_nums[0][i] = Draw_PicFromWad (va("num_%" PRIi32 "",i));
|
||||
sb_nums[1][i] = Draw_PicFromWad (va("anum_%" PRIi32 "",i));
|
||||
}
|
||||
|
||||
sb_nums[0][10] = Draw_PicFromWad ("num_minus");
|
||||
|
@ -144,13 +144,13 @@ void Sbar_LoadPics (void)
|
|||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
sb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_shotgun",i+1));
|
||||
sb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_sshotgun",i+1));
|
||||
sb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_nailgun",i+1));
|
||||
sb_weapons[2+i][3] = Draw_PicFromWad (va("inva%i_snailgun",i+1));
|
||||
sb_weapons[2+i][4] = Draw_PicFromWad (va("inva%i_rlaunch",i+1));
|
||||
sb_weapons[2+i][5] = Draw_PicFromWad (va("inva%i_srlaunch",i+1));
|
||||
sb_weapons[2+i][6] = Draw_PicFromWad (va("inva%i_lightng",i+1));
|
||||
sb_weapons[2+i][0] = Draw_PicFromWad (va("inva%" PRIi32 "_shotgun",i+1));
|
||||
sb_weapons[2+i][1] = Draw_PicFromWad (va("inva%" PRIi32 "_sshotgun",i+1));
|
||||
sb_weapons[2+i][2] = Draw_PicFromWad (va("inva%" PRIi32 "_nailgun",i+1));
|
||||
sb_weapons[2+i][3] = Draw_PicFromWad (va("inva%" PRIi32 "_snailgun",i+1));
|
||||
sb_weapons[2+i][4] = Draw_PicFromWad (va("inva%" PRIi32 "_rlaunch",i+1));
|
||||
sb_weapons[2+i][5] = Draw_PicFromWad (va("inva%" PRIi32 "_srlaunch",i+1));
|
||||
sb_weapons[2+i][6] = Draw_PicFromWad (va("inva%" PRIi32 "_lightng",i+1));
|
||||
}
|
||||
|
||||
sb_ammo[0] = Draw_PicFromWad ("sb_shells");
|
||||
|
@ -211,11 +211,11 @@ void Sbar_LoadPics (void)
|
|||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
hsb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_laser",i+1));
|
||||
hsb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_mjolnir",i+1));
|
||||
hsb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_gren_prox",i+1));
|
||||
hsb_weapons[2+i][3] = Draw_PicFromWad (va("inva%i_prox_gren",i+1));
|
||||
hsb_weapons[2+i][4] = Draw_PicFromWad (va("inva%i_prox",i+1));
|
||||
hsb_weapons[2+i][0] = Draw_PicFromWad (va("inva%" PRIi32 "_laser",i+1));
|
||||
hsb_weapons[2+i][1] = Draw_PicFromWad (va("inva%" PRIi32 "_mjolnir",i+1));
|
||||
hsb_weapons[2+i][2] = Draw_PicFromWad (va("inva%" PRIi32 "_gren_prox",i+1));
|
||||
hsb_weapons[2+i][3] = Draw_PicFromWad (va("inva%" PRIi32 "_prox_gren",i+1));
|
||||
hsb_weapons[2+i][4] = Draw_PicFromWad (va("inva%" PRIi32 "_prox",i+1));
|
||||
}
|
||||
|
||||
hsb_items[0] = Draw_PicFromWad ("sb_wsuit");
|
||||
|
@ -269,7 +269,7 @@ void Sbar_Init (void)
|
|||
Sbar_DrawPic -- johnfitz -- rewritten now that GL_SetCanvas is doing the work
|
||||
=============
|
||||
*/
|
||||
void Sbar_DrawPic (int x, int y, qpic_t *pic)
|
||||
void Sbar_DrawPic (int32_t x, int32_t y, qpic_t *pic)
|
||||
{
|
||||
Draw_Pic (x, y + 24, pic);
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ void Sbar_DrawPic (int x, int y, qpic_t *pic)
|
|||
Sbar_DrawPicAlpha -- johnfitz
|
||||
=============
|
||||
*/
|
||||
void Sbar_DrawPicAlpha (int x, int y, qpic_t *pic, float alpha)
|
||||
void Sbar_DrawPicAlpha (int32_t x, int32_t y, qpic_t *pic, float alpha)
|
||||
{
|
||||
glDisable (GL_ALPHA_TEST);
|
||||
glEnable (GL_BLEND);
|
||||
|
@ -295,7 +295,7 @@ void Sbar_DrawPicAlpha (int x, int y, qpic_t *pic, float alpha)
|
|||
Sbar_DrawCharacter -- johnfitz -- rewritten now that GL_SetCanvas is doing the work
|
||||
================
|
||||
*/
|
||||
void Sbar_DrawCharacter (int x, int y, int num)
|
||||
void Sbar_DrawCharacter (int32_t x, int32_t y, int32_t num)
|
||||
{
|
||||
Draw_Character (x, y + 24, num);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ void Sbar_DrawCharacter (int x, int y, int num)
|
|||
Sbar_DrawString -- johnfitz -- rewritten now that GL_SetCanvas is doing the work
|
||||
================
|
||||
*/
|
||||
void Sbar_DrawString (int x, int y, const char *str)
|
||||
void Sbar_DrawString (int32_t x, int32_t y, const char *str)
|
||||
{
|
||||
Draw_String (x, y + 24, str);
|
||||
}
|
||||
|
@ -317,10 +317,10 @@ Sbar_DrawScrollString -- johnfitz
|
|||
scroll the string inside a glscissor region
|
||||
===============
|
||||
*/
|
||||
void Sbar_DrawScrollString (int x, int y, int width, const char *str)
|
||||
void Sbar_DrawScrollString (int32_t x, int32_t y, int32_t width, const char *str)
|
||||
{
|
||||
float scale;
|
||||
int len, ofs, left;
|
||||
int32_t len, ofs, left;
|
||||
|
||||
scale = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0);
|
||||
left = x * scale;
|
||||
|
@ -331,7 +331,7 @@ void Sbar_DrawScrollString (int x, int y, int width, const char *str)
|
|||
glScissor (left, 0, width * scale, glheight);
|
||||
|
||||
len = strlen(str)*8 + 40;
|
||||
ofs = ((int)(realtime*30))%len;
|
||||
ofs = ((int32_t)(realtime*30))%len;
|
||||
Sbar_DrawString (x - ofs, y, str);
|
||||
Sbar_DrawCharacter (x - ofs + len - 32, y, '/');
|
||||
Sbar_DrawCharacter (x - ofs + len - 24, y, '/');
|
||||
|
@ -346,11 +346,11 @@ void Sbar_DrawScrollString (int x, int y, int width, const char *str)
|
|||
Sbar_itoa
|
||||
=============
|
||||
*/
|
||||
int Sbar_itoa (int num, char *buf)
|
||||
int32_t Sbar_itoa (int32_t num, char *buf)
|
||||
{
|
||||
char *str;
|
||||
int pow10;
|
||||
int dig;
|
||||
int32_t pow10;
|
||||
int32_t dig;
|
||||
|
||||
str = buf;
|
||||
|
||||
|
@ -382,11 +382,11 @@ int Sbar_itoa (int num, char *buf)
|
|||
Sbar_DrawNum
|
||||
=============
|
||||
*/
|
||||
void Sbar_DrawNum (int x, int y, int num, int digits, int color)
|
||||
void Sbar_DrawNum (int32_t x, int32_t y, int32_t num, int32_t digits, int32_t color)
|
||||
{
|
||||
char str[12];
|
||||
char *ptr;
|
||||
int l, frame;
|
||||
int32_t l, frame;
|
||||
|
||||
num = q_min(999,num); //johnfitz -- cap high values rather than truncating number
|
||||
|
||||
|
@ -412,13 +412,13 @@ void Sbar_DrawNum (int x, int y, int num, int digits, int color)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
int fragsort[MAX_SCOREBOARD];
|
||||
int32_t fragsort[MAX_SCOREBOARD];
|
||||
|
||||
char scoreboardtext[MAX_SCOREBOARD][20];
|
||||
int scoreboardtop[MAX_SCOREBOARD];
|
||||
int scoreboardbottom[MAX_SCOREBOARD];
|
||||
int scoreboardcount[MAX_SCOREBOARD];
|
||||
int scoreboardlines;
|
||||
int32_t scoreboardtop[MAX_SCOREBOARD];
|
||||
int32_t scoreboardbottom[MAX_SCOREBOARD];
|
||||
int32_t scoreboardcount[MAX_SCOREBOARD];
|
||||
int32_t scoreboardlines;
|
||||
|
||||
/*
|
||||
===============
|
||||
|
@ -427,7 +427,7 @@ Sbar_SortFrags
|
|||
*/
|
||||
void Sbar_SortFrags (void)
|
||||
{
|
||||
int i, j, k;
|
||||
int32_t i, j, k;
|
||||
|
||||
// sort by frags
|
||||
scoreboardlines = 0;
|
||||
|
@ -454,7 +454,7 @@ void Sbar_SortFrags (void)
|
|||
}
|
||||
}
|
||||
|
||||
int Sbar_ColorForMap (int m)
|
||||
int32_t Sbar_ColorForMap (int32_t m)
|
||||
{
|
||||
return m < 128 ? m + 8 : m + 8;
|
||||
}
|
||||
|
@ -466,8 +466,8 @@ Sbar_UpdateScoreboard
|
|||
*/
|
||||
void Sbar_UpdateScoreboard (void)
|
||||
{
|
||||
int i, k;
|
||||
int top, bottom;
|
||||
int32_t i, k;
|
||||
int32_t top, bottom;
|
||||
scoreboard_t *s;
|
||||
|
||||
Sbar_SortFrags ();
|
||||
|
@ -479,7 +479,7 @@ void Sbar_UpdateScoreboard (void)
|
|||
{
|
||||
k = fragsort[i];
|
||||
s = &cl.scores[k];
|
||||
sprintf (&scoreboardtext[i][1], "%3i %s", s->frags, s->name);
|
||||
sprintf (&scoreboardtext[i][1], "%3" PRIi32 " %s", s->frags, s->name);
|
||||
|
||||
top = s->colors & 0xf0;
|
||||
bottom = (s->colors & 15) <<4;
|
||||
|
@ -496,18 +496,18 @@ Sbar_SoloScoreboard -- johnfitz -- new layout
|
|||
void Sbar_SoloScoreboard (void)
|
||||
{
|
||||
char str[256];
|
||||
int minutes, seconds, tens, units;
|
||||
int len;
|
||||
int32_t minutes, seconds, tens, units;
|
||||
int32_t len;
|
||||
|
||||
sprintf (str,"Kills: %i/%i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
||||
sprintf (str,"Kills: %" PRIi32 "/%" PRIi32 "", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
||||
Sbar_DrawString (8, 12, str);
|
||||
|
||||
sprintf (str,"Secrets: %i/%i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
|
||||
sprintf (str,"Secrets: %" PRIi32 "/%" PRIi32 "", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
|
||||
Sbar_DrawString (312 - strlen(str)*8, 12, str);
|
||||
|
||||
if (!fitzmode)
|
||||
{ /* QuakeSpasm customization: */
|
||||
q_snprintf (str, sizeof(str), "skill %i", (int)(skill.value + 0.5));
|
||||
q_snprintf (str, sizeof(str), "skill %" PRIi32 "", (int32_t)(skill.value + 0.5));
|
||||
Sbar_DrawString (160 - strlen(str)*4, 12, str);
|
||||
|
||||
q_snprintf (str, sizeof(str), "%s (%s)", cl.levelname, cl.mapname);
|
||||
|
@ -522,7 +522,7 @@ void Sbar_SoloScoreboard (void)
|
|||
seconds = cl.time - 60*minutes;
|
||||
tens = seconds / 10;
|
||||
units = seconds - 10*tens;
|
||||
sprintf (str,"%i:%i%i", minutes, tens, units);
|
||||
sprintf (str,"%" PRIi32 ":%" PRIi32 "%" PRIi32 "", minutes, tens, units);
|
||||
Sbar_DrawString (160 - strlen(str)*4, 12, str);
|
||||
|
||||
len = strlen (cl.levelname);
|
||||
|
@ -553,10 +553,10 @@ Sbar_DrawInventory
|
|||
*/
|
||||
void Sbar_DrawInventory (void)
|
||||
{
|
||||
int i, val;
|
||||
int32_t i, val;
|
||||
char num[6];
|
||||
float time;
|
||||
int flashon;
|
||||
int32_t flashon;
|
||||
|
||||
if (rogue)
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ void Sbar_DrawInventory (void)
|
|||
if (cl.items & (IT_SHOTGUN<<i) )
|
||||
{
|
||||
time = cl.item_gettime[i];
|
||||
flashon = (int)((cl.time - time)*10);
|
||||
flashon = (int32_t)((cl.time - time)*10);
|
||||
if (flashon >= 10)
|
||||
{
|
||||
if ( cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN<<i) )
|
||||
|
@ -598,13 +598,13 @@ void Sbar_DrawInventory (void)
|
|||
// hipnotic weapons
|
||||
if (hipnotic)
|
||||
{
|
||||
int grenadeflashing = 0;
|
||||
int32_t grenadeflashing = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (cl.items & (1<<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 (cl.stats[STAT_ACTIVEWEAPON] == (1<<hipweapons[i]))
|
||||
|
@ -672,7 +672,7 @@ void Sbar_DrawInventory (void)
|
|||
{
|
||||
val = cl.stats[STAT_SHELLS+i];
|
||||
val = (val < 0)? 0 : q_min(999,val);//johnfitz -- cap displayed value to 999
|
||||
sprintf (num, "%3i", val);
|
||||
sprintf (num, "%3" PRIi32 "", val);
|
||||
if (num[0] != ' ')
|
||||
Sbar_DrawCharacter ( (6*i+1)*8 + 2, -24, 18 + num[0] - '0');
|
||||
if (num[1] != ' ')
|
||||
|
@ -778,7 +778,7 @@ Sbar_DrawFrags -- johnfitz -- heavy revision
|
|||
*/
|
||||
void Sbar_DrawFrags (void)
|
||||
{
|
||||
int numscores, i, x, color;
|
||||
int32_t numscores, i, x, color;
|
||||
char num[12];
|
||||
scoreboard_t *s;
|
||||
|
||||
|
@ -804,7 +804,7 @@ void Sbar_DrawFrags (void)
|
|||
Draw_Fill (x + 10, 5, 28, 3, color, 1);
|
||||
|
||||
// number
|
||||
sprintf (num, "%3i", s->frags);
|
||||
sprintf (num, "%3" PRIi32 "", s->frags);
|
||||
Sbar_DrawCharacter (x + 12, -24, num[0]);
|
||||
Sbar_DrawCharacter (x + 20, -24, num[1]);
|
||||
Sbar_DrawCharacter (x + 28, -24, num[2]);
|
||||
|
@ -828,14 +828,14 @@ Sbar_DrawFace
|
|||
*/
|
||||
void Sbar_DrawFace (void)
|
||||
{
|
||||
int f, anim;
|
||||
int32_t f, anim;
|
||||
|
||||
// PGM 01/19/97 - team color drawing
|
||||
// PGM 03/02/97 - fixed so color swatch only appears in CTF modes
|
||||
if (rogue && (cl.maxclients != 1) && (teamplay.value>3) && (teamplay.value<7))
|
||||
{
|
||||
int top, bottom;
|
||||
int xofs;
|
||||
int32_t top, bottom;
|
||||
int32_t xofs;
|
||||
char num[12];
|
||||
scoreboard_t *s;
|
||||
|
||||
|
@ -857,7 +857,7 @@ void Sbar_DrawFace (void)
|
|||
|
||||
// draw number
|
||||
f = s->frags;
|
||||
sprintf (num, "%3i",f);
|
||||
sprintf (num, "%3" PRIi32 "",f);
|
||||
|
||||
if (top == 8)
|
||||
{
|
||||
|
@ -1071,11 +1071,11 @@ Sbar_IntermissionNumber
|
|||
|
||||
==================
|
||||
*/
|
||||
void Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
|
||||
void Sbar_IntermissionNumber (int32_t x, int32_t y, int32_t num, int32_t digits, int32_t color)
|
||||
{
|
||||
char str[12];
|
||||
char *ptr;
|
||||
int l, frame;
|
||||
int32_t l, frame;
|
||||
|
||||
l = Sbar_itoa (num, str);
|
||||
ptr = str;
|
||||
|
@ -1106,9 +1106,9 @@ Sbar_DeathmatchOverlay
|
|||
void Sbar_DeathmatchOverlay (void)
|
||||
{
|
||||
qpic_t *pic;
|
||||
int i, k, l;
|
||||
int top, bottom;
|
||||
int x, y, f;
|
||||
int32_t i, k, l;
|
||||
int32_t top, bottom;
|
||||
int32_t x, y, f;
|
||||
char num[12];
|
||||
scoreboard_t *s;
|
||||
|
||||
|
@ -1143,7 +1143,7 @@ void Sbar_DeathmatchOverlay (void)
|
|||
|
||||
// draw number
|
||||
f = s->frags;
|
||||
sprintf (num, "%3i",f);
|
||||
sprintf (num, "%3" PRIi32 "",f);
|
||||
|
||||
Draw_Character ( x+8 , y, num[0]); //johnfitz -- stretched overlays
|
||||
Draw_Character ( x+16 , y, num[1]); //johnfitz -- stretched overlays
|
||||
|
@ -1152,24 +1152,6 @@ void Sbar_DeathmatchOverlay (void)
|
|||
if (k == cl.viewentity - 1)
|
||||
Draw_Character ( x - 8, y, 12); //johnfitz -- stretched overlays
|
||||
|
||||
#if 0
|
||||
{
|
||||
int total;
|
||||
int n, minutes, tens, units;
|
||||
|
||||
// draw time
|
||||
total = cl.completed_time - s->entertime;
|
||||
minutes = (int)total/60;
|
||||
n = total - minutes*60;
|
||||
tens = n/10;
|
||||
units = n%10;
|
||||
|
||||
sprintf (num, "%3i:%i%i", minutes, tens, units);
|
||||
|
||||
M_Print ( x+48 , y, num); //johnfitz -- was Draw_String, changed for stretched overlays
|
||||
}
|
||||
#endif
|
||||
|
||||
// draw name
|
||||
M_Print (x+64, y, s->name); //johnfitz -- was Draw_String, changed for stretched overlays
|
||||
|
||||
|
@ -1186,7 +1168,7 @@ Sbar_MiniDeathmatchOverlay
|
|||
*/
|
||||
void Sbar_MiniDeathmatchOverlay (void)
|
||||
{
|
||||
int i, k, top, bottom, x, y, f, numlines;
|
||||
int32_t i, k, top, bottom, x, y, f, numlines;
|
||||
char num[12];
|
||||
float scale; //johnfitz
|
||||
scoreboard_t *s;
|
||||
|
@ -1236,7 +1218,7 @@ void Sbar_MiniDeathmatchOverlay (void)
|
|||
|
||||
// number
|
||||
f = s->frags;
|
||||
sprintf (num, "%3i",f);
|
||||
sprintf (num, "%3" PRIi32 "",f);
|
||||
Draw_Character (x+ 8, y, num[0]);
|
||||
Draw_Character (x+16, y, num[1]);
|
||||
Draw_Character (x+24, y, num[2]);
|
||||
|
@ -1261,8 +1243,8 @@ Sbar_IntermissionOverlay
|
|||
void Sbar_IntermissionOverlay (void)
|
||||
{
|
||||
qpic_t *pic;
|
||||
int dig;
|
||||
int num;
|
||||
int32_t dig;
|
||||
int32_t num;
|
||||
|
||||
if (cl.gametype == GAME_DEATHMATCH)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
// the status bar is only redrawn if something has changed, but if anything
|
||||
// does, the entire thing will be redrawn for the next vid.numpages frames.
|
||||
|
||||
extern int sb_lines; // scan lines to draw
|
||||
extern int32_t sb_lines; // scan lines to draw
|
||||
|
||||
void Sbar_Init (void);
|
||||
void Sbar_LoadPics (void);
|
||||
|
|
|
@ -39,16 +39,16 @@ void SCR_CenterPrint (const char *str);
|
|||
void SCR_BeginLoadingPlaque (void);
|
||||
void SCR_EndLoadingPlaque (void);
|
||||
|
||||
int SCR_ModalMessage (const char *text, float timeout); //johnfitz -- added timeout
|
||||
int32_t SCR_ModalMessage (const char *text, float timeout); //johnfitz -- added timeout
|
||||
|
||||
extern float scr_con_current;
|
||||
extern float scr_conlines; // lines of console to display
|
||||
|
||||
extern int sb_lines;
|
||||
extern int32_t sb_lines;
|
||||
|
||||
extern int clearnotify; // set to 0 whenever notify text is drawn
|
||||
extern qboolean scr_disabled_for_loading;
|
||||
extern qboolean scr_skipupdate;
|
||||
extern int32_t clearnotify; // set to 0 whenever notify text is drawn
|
||||
extern bool scr_disabled_for_loading;
|
||||
extern bool scr_skipupdate;
|
||||
|
||||
extern cvar_t scr_viewsize;
|
||||
|
||||
|
@ -78,7 +78,7 @@ extern cvar_t scr_scale;
|
|||
extern cvar_t scr_crosshairscale;
|
||||
//johnfitz
|
||||
|
||||
extern int scr_tileclear_updates; //johnfitz
|
||||
extern int32_t scr_tileclear_updates; //johnfitz
|
||||
|
||||
#endif /* _QUAKE_SCREEN_H */
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int maxclients;
|
||||
int maxclientslimit;
|
||||
int32_t maxclients;
|
||||
int32_t maxclientslimit;
|
||||
struct client_s *clients; // [maxclients]
|
||||
int serverflags; // episode completion information
|
||||
qboolean changelevel_issued; // cleared when at SV_SpawnServer
|
||||
int32_t serverflags; // episode completion information
|
||||
bool changelevel_issued; // cleared when at SV_SpawnServer
|
||||
} server_static_t;
|
||||
|
||||
//=============================================================================
|
||||
|
@ -40,14 +40,14 @@ typedef enum {ss_loading, ss_active} server_state_t;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
qboolean active; // false if only a net client
|
||||
bool active; // false if only a net client
|
||||
|
||||
qboolean paused;
|
||||
qboolean loadgame; // handle connections specially
|
||||
bool paused;
|
||||
bool loadgame; // handle connections specially
|
||||
|
||||
double time;
|
||||
|
||||
int lastcheck; // used by PF_checkclient
|
||||
int32_t lastcheck; // used by PF_checkclient
|
||||
double lastchecktime;
|
||||
|
||||
char name[64]; // map name
|
||||
|
@ -57,8 +57,8 @@ typedef struct
|
|||
struct qmodel_s *models[MAX_MODELS];
|
||||
const char *sound_precache[MAX_SOUNDS]; // NULL terminated
|
||||
const char *lightstyles[MAX_LIGHTSTYLES];
|
||||
int num_edicts;
|
||||
int max_edicts;
|
||||
int32_t num_edicts;
|
||||
int32_t max_edicts;
|
||||
edict_t *edicts; // can NOT be array indexed, because
|
||||
// edict_t is variable sized, but can
|
||||
// be used to reference the world ent
|
||||
|
@ -83,10 +83,10 @@ typedef struct
|
|||
|
||||
typedef struct client_s
|
||||
{
|
||||
qboolean active; // false = client is free
|
||||
qboolean spawned; // false = don't send datagrams
|
||||
qboolean dropasap; // has been told to go to another level
|
||||
qboolean sendsignon; // only valid before spawned
|
||||
bool active; // false = client is free
|
||||
bool spawned; // false = don't send datagrams
|
||||
bool dropasap; // has been told to go to another level
|
||||
bool sendsignon; // only valid before spawned
|
||||
|
||||
double last_message; // reliable messages must be sent
|
||||
// periodically
|
||||
|
@ -101,16 +101,16 @@ typedef struct client_s
|
|||
byte msgbuf[MAX_MSGLEN];
|
||||
edict_t *edict; // EDICT_NUM(clientnum+1)
|
||||
char name[32]; // for printing to other people
|
||||
int colors;
|
||||
int32_t colors;
|
||||
|
||||
float ping_times[NUM_PING_TIMES];
|
||||
int num_pings; // ping_times[num_pings%NUM_PING_TIMES]
|
||||
int32_t num_pings; // ping_times[num_pings%NUM_PING_TIMES]
|
||||
|
||||
// spawn parms are carried from level to level
|
||||
float spawn_parms[NUM_SPAWN_PARMS];
|
||||
|
||||
// client known data for deltas
|
||||
int old_frags;
|
||||
int32_t old_frags;
|
||||
} client_t;
|
||||
|
||||
|
||||
|
@ -193,16 +193,16 @@ extern edict_t *sv_player;
|
|||
|
||||
void SV_Init (void);
|
||||
|
||||
void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count);
|
||||
void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume,
|
||||
void SV_StartParticle (vec3_t org, vec3_t dir, int32_t color, int32_t count);
|
||||
void SV_StartSound (edict_t *entity, int32_t channel, const char *sample, int32_t volume,
|
||||
float attenuation);
|
||||
|
||||
void SV_DropClient (qboolean crash);
|
||||
void SV_DropClient (bool crash);
|
||||
|
||||
void SV_SendClientMessages (void);
|
||||
void SV_ClearDatagram (void);
|
||||
|
||||
int SV_ModelIndex (const char *name);
|
||||
int32_t SV_ModelIndex (const char *name);
|
||||
|
||||
void SV_SetIdealPitch (void);
|
||||
|
||||
|
@ -216,8 +216,8 @@ void SV_BroadcastPrintf (const char *fmt, ...) FUNC_PRINTF(1,2);
|
|||
|
||||
void SV_Physics (void);
|
||||
|
||||
qboolean SV_CheckBottom (edict_t *ent);
|
||||
qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink);
|
||||
bool SV_CheckBottom (edict_t *ent);
|
||||
bool SV_movestep (edict_t *ent, vec3_t move, bool relink);
|
||||
|
||||
void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg);
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ snd_stream_t *S_CodecOpenStreamAny (const char *filename)
|
|||
}
|
||||
}
|
||||
|
||||
qboolean S_CodecForwardStream (snd_stream_t *stream, uint32_t type)
|
||||
bool S_CodecForwardStream (snd_stream_t *stream, uint32_t type)
|
||||
{
|
||||
snd_codec_t *codec = codecs;
|
||||
|
||||
|
@ -246,12 +246,12 @@ void S_CodecCloseStream (snd_stream_t *stream)
|
|||
stream->codec->codec_close(stream);
|
||||
}
|
||||
|
||||
int S_CodecRewindStream (snd_stream_t *stream)
|
||||
int32_t S_CodecRewindStream (snd_stream_t *stream)
|
||||
{
|
||||
return stream->codec->codec_rewind(stream);
|
||||
}
|
||||
|
||||
int S_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
|
||||
int32_t S_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer)
|
||||
{
|
||||
return stream->codec->codec_read(stream, bytes, buffer);
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec)
|
|||
{
|
||||
snd_stream_t *stream;
|
||||
FILE *handle;
|
||||
qboolean pak;
|
||||
bool pak;
|
||||
long length;
|
||||
|
||||
/* Try to open the file */
|
||||
|
@ -294,7 +294,7 @@ void S_CodecUtilClose(snd_stream_t **stream)
|
|||
*stream = NULL;
|
||||
}
|
||||
|
||||
int S_CodecIsAvailable (uint32_t type)
|
||||
int32_t S_CodecIsAvailable (uint32_t type)
|
||||
{
|
||||
snd_codec_t *codec = codecs;
|
||||
while (codec)
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
|
||||
typedef struct snd_info_s
|
||||
{
|
||||
int rate;
|
||||
int bits, width;
|
||||
int channels;
|
||||
int samples;
|
||||
int blocksize;
|
||||
int size;
|
||||
int dataofs;
|
||||
int32_t rate;
|
||||
int32_t bits, width;
|
||||
int32_t channels;
|
||||
int32_t samples;
|
||||
int32_t blocksize;
|
||||
int32_t size;
|
||||
int32_t dataofs;
|
||||
} snd_info_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -49,7 +49,7 @@ typedef struct snd_codec_s snd_codec_t;
|
|||
typedef struct snd_stream_s
|
||||
{
|
||||
fshandle_t fh;
|
||||
qboolean pak;
|
||||
bool pak;
|
||||
char name[MAX_QPATH]; /* name of the source file */
|
||||
snd_info_t info;
|
||||
stream_status_t status;
|
||||
|
@ -76,8 +76,8 @@ snd_stream_t *S_CodecOpenStreamExt (const char *filename);
|
|||
* MUST have an extension. */
|
||||
|
||||
void S_CodecCloseStream (snd_stream_t *stream);
|
||||
int S_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer);
|
||||
int S_CodecRewindStream (snd_stream_t *stream);
|
||||
int32_t S_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer);
|
||||
int32_t S_CodecRewindStream (snd_stream_t *stream);
|
||||
|
||||
snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec);
|
||||
void S_CodecUtilClose(snd_stream_t **stream);
|
||||
|
@ -96,7 +96,7 @@ void S_CodecUtilClose(snd_stream_t **stream);
|
|||
#define CODECTYPE_WAVE CODECTYPE_WAV
|
||||
#define CODECTYPE_MIDI CODECTYPE_MID
|
||||
|
||||
int S_CodecIsAvailable (uint32_t type);
|
||||
int32_t S_CodecIsAvailable (uint32_t type);
|
||||
/* return 1 if available, 0 if codec failed init
|
||||
* or -1 if no such codec is present. */
|
||||
|
||||
|
|
|
@ -27,17 +27,17 @@
|
|||
#define _SND_CODECI_H_
|
||||
|
||||
/* Codec internals */
|
||||
typedef qboolean (*CODEC_INIT)(void);
|
||||
typedef bool (*CODEC_INIT)(void);
|
||||
typedef void (*CODEC_SHUTDOWN)(void);
|
||||
typedef qboolean (*CODEC_OPEN)(snd_stream_t *stream);
|
||||
typedef int (*CODEC_READ)(snd_stream_t *stream, int bytes, void *buffer);
|
||||
typedef int (*CODEC_REWIND)(snd_stream_t *stream);
|
||||
typedef bool (*CODEC_OPEN)(snd_stream_t *stream);
|
||||
typedef int32_t (*CODEC_READ)(snd_stream_t *stream, int32_t bytes, void *buffer);
|
||||
typedef int32_t (*CODEC_REWIND)(snd_stream_t *stream);
|
||||
typedef void (*CODEC_CLOSE)(snd_stream_t *stream);
|
||||
|
||||
struct snd_codec_s
|
||||
{
|
||||
uint32_t type; /* handled data type. (1U << n) */
|
||||
qboolean initialized; /* init succeedded */
|
||||
bool initialized; /* init succeedded */
|
||||
const char *ext; /* expected extension */
|
||||
CODEC_INIT initialize;
|
||||
CODEC_SHUTDOWN shutdown;
|
||||
|
@ -48,7 +48,7 @@ struct snd_codec_s
|
|||
snd_codec_t *next;
|
||||
};
|
||||
|
||||
qboolean S_CodecForwardStream (snd_stream_t *stream, uint32_t type);
|
||||
bool S_CodecForwardStream (snd_stream_t *stream, uint32_t type);
|
||||
/* Forward a stream to another codec of 'type' type. */
|
||||
|
||||
#endif /* _SND_CODECI_H_ */
|
||||
|
|
119
source/snd_dma.c
119
source/snd_dma.c
|
@ -32,7 +32,7 @@ static void S_Play (void);
|
|||
static void S_PlayVol (void);
|
||||
static void S_SoundList (void);
|
||||
static void S_Update_ (void);
|
||||
void S_StopAllSounds (qboolean clear);
|
||||
void S_StopAllSounds (bool clear);
|
||||
static void S_StopAllSoundsC (void);
|
||||
|
||||
// =======================================================================
|
||||
|
@ -40,10 +40,10 @@ static void S_StopAllSoundsC (void);
|
|||
// =======================================================================
|
||||
|
||||
channel_t snd_channels[MAX_CHANNELS];
|
||||
int total_channels;
|
||||
int32_t total_channels;
|
||||
|
||||
static int snd_blocked = 0;
|
||||
static qboolean snd_initialized = false;
|
||||
static int32_t snd_blocked = 0;
|
||||
static bool snd_initialized = false;
|
||||
|
||||
static dma_t sn;
|
||||
volatile dma_t *shm = NULL;
|
||||
|
@ -55,20 +55,20 @@ vec3_t listener_up;
|
|||
|
||||
#define sound_nominal_clip_dist 1000.0
|
||||
|
||||
int soundtime; // sample PAIRS
|
||||
int paintedtime; // sample PAIRS
|
||||
int32_t soundtime; // sample PAIRS
|
||||
int32_t paintedtime; // sample PAIRS
|
||||
|
||||
int s_rawend;
|
||||
int32_t s_rawend;
|
||||
portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES];
|
||||
|
||||
|
||||
#define MAX_SFX 1024
|
||||
static sfx_t *known_sfx = NULL; // hunk allocated [MAX_SFX]
|
||||
static int num_sfx;
|
||||
static int32_t num_sfx;
|
||||
|
||||
static sfx_t *ambient_sfx[NUM_AMBIENTS];
|
||||
|
||||
static qboolean sound_started = false;
|
||||
static bool sound_started = false;
|
||||
|
||||
cvar_t bgmvolume = {"bgmvolume", "1", CVAR_ARCHIVE};
|
||||
cvar_t sfxvolume = {"volume", "0.7", CVAR_ARCHIVE};
|
||||
|
@ -104,12 +104,12 @@ static void S_SoundInfo_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
Con_Printf("%d bit, %s, %d Hz\n", shm->samplebits,
|
||||
Con_Printf("%" PRIi32 " bit, %s, %" PRIi32 " Hz\n", shm->samplebits,
|
||||
(shm->channels == 2) ? "stereo" : "mono", shm->speed);
|
||||
Con_Printf("%5d samples\n", shm->samples);
|
||||
Con_Printf("%5d samplepos\n", shm->samplepos);
|
||||
Con_Printf("%5d submission_chunk\n", shm->submission_chunk);
|
||||
Con_Printf("%5d total_channels\n", total_channels);
|
||||
Con_Printf("%5" PRIi32 " samples\n", shm->samples);
|
||||
Con_Printf("%5" PRIi32 " samplepos\n", shm->samplepos);
|
||||
Con_Printf("%5" PRIi32 " submission_chunk\n", shm->submission_chunk);
|
||||
Con_Printf("%5" PRIi32 " total_channels\n", total_channels);
|
||||
Con_Printf("%p dma buffer\n", shm->buffer);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ void S_Startup (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
Con_Printf("Audio: %d bit, %s, %d Hz\n",
|
||||
Con_Printf("Audio: %" PRIi32 " bit, %s, %" PRIi32 " Hz\n",
|
||||
shm->samplebits,
|
||||
(shm->channels == 2) ? "stereo" : "mono",
|
||||
shm->speed);
|
||||
|
@ -163,7 +163,7 @@ S_Init
|
|||
*/
|
||||
void S_Init (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (snd_initialized)
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ S_FindName
|
|||
*/
|
||||
static sfx_t *S_FindName (const char *name)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
sfx_t *sfx;
|
||||
|
||||
if (!name)
|
||||
|
@ -350,11 +350,11 @@ SND_PickChannel
|
|||
picks a channel based on priorities, empty slots, number of channels
|
||||
=================
|
||||
*/
|
||||
channel_t *SND_PickChannel (int entnum, int entchannel)
|
||||
channel_t *SND_PickChannel (int32_t entnum, int32_t entchannel)
|
||||
{
|
||||
int ch_idx;
|
||||
int first_to_die;
|
||||
int life_left;
|
||||
int32_t ch_idx;
|
||||
int32_t first_to_die;
|
||||
int32_t life_left;
|
||||
|
||||
// Check for replacement sound, or find the best one to replace
|
||||
first_to_die = -1;
|
||||
|
@ -429,12 +429,12 @@ void SND_Spatialize (channel_t *ch)
|
|||
|
||||
// add in distance effect
|
||||
scale = (1.0 - dist) * rscale;
|
||||
ch->rightvol = (int) (ch->master_vol * scale);
|
||||
ch->rightvol = (int32_t) (ch->master_vol * scale);
|
||||
if (ch->rightvol < 0)
|
||||
ch->rightvol = 0;
|
||||
|
||||
scale = (1.0 - dist) * lscale;
|
||||
ch->leftvol = (int) (ch->master_vol * scale);
|
||||
ch->leftvol = (int32_t) (ch->master_vol * scale);
|
||||
if (ch->leftvol < 0)
|
||||
ch->leftvol = 0;
|
||||
}
|
||||
|
@ -444,12 +444,12 @@ void SND_Spatialize (channel_t *ch)
|
|||
// Start a sound effect
|
||||
// =======================================================================
|
||||
|
||||
void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation)
|
||||
void S_StartSound (int32_t entnum, int32_t entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation)
|
||||
{
|
||||
channel_t *target_chan, *check;
|
||||
sfxcache_t *sc;
|
||||
int ch_idx;
|
||||
int skip;
|
||||
int32_t ch_idx;
|
||||
int32_t skip;
|
||||
|
||||
if (!sound_started)
|
||||
return;
|
||||
|
@ -469,7 +469,7 @@ void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float
|
|||
memset (target_chan, 0, sizeof(*target_chan));
|
||||
VectorCopy(origin, target_chan->origin);
|
||||
target_chan->dist_mult = attenuation / sound_nominal_clip_dist;
|
||||
target_chan->master_vol = (int) (fvol * 255);
|
||||
target_chan->master_vol = (int32_t) (fvol * 255);
|
||||
target_chan->entnum = entnum;
|
||||
target_chan->entchannel = entchannel;
|
||||
SND_Spatialize(target_chan);
|
||||
|
@ -499,7 +499,7 @@ void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float
|
|||
if (check->sfx == sfx && !check->pos)
|
||||
{
|
||||
/*
|
||||
skip = rand () % (int)(0.1 * shm->speed);
|
||||
skip = rand () % (int32_t)(0.1 * shm->speed);
|
||||
if (skip >= target_chan->end)
|
||||
skip = target_chan->end - 1;
|
||||
*/
|
||||
|
@ -516,9 +516,9 @@ void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float
|
|||
}
|
||||
}
|
||||
|
||||
void S_StopSound (int entnum, int entchannel)
|
||||
void S_StopSound (int32_t entnum, int32_t entchannel)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < MAX_DYNAMIC_CHANNELS; i++)
|
||||
{
|
||||
|
@ -532,9 +532,9 @@ void S_StopSound (int entnum, int entchannel)
|
|||
}
|
||||
}
|
||||
|
||||
void S_StopAllSounds (qboolean clear)
|
||||
void S_StopAllSounds (bool clear)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (!sound_started)
|
||||
return;
|
||||
|
@ -560,7 +560,7 @@ static void S_StopAllSoundsC (void)
|
|||
|
||||
void S_ClearBuffer (void)
|
||||
{
|
||||
int clear;
|
||||
int32_t clear;
|
||||
|
||||
if (!sound_started || !shm)
|
||||
return;
|
||||
|
@ -616,7 +616,7 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation)
|
|||
|
||||
ss->sfx = sfx;
|
||||
VectorCopy (origin, ss->origin);
|
||||
ss->master_vol = (int)vol;
|
||||
ss->master_vol = (int32_t)vol;
|
||||
ss->dist_mult = (attenuation / 64) / sound_nominal_clip_dist;
|
||||
ss->end = paintedtime + sc->length;
|
||||
|
||||
|
@ -634,7 +634,7 @@ S_UpdateAmbientSounds
|
|||
static void S_UpdateAmbientSounds (void)
|
||||
{
|
||||
mleaf_t *l;
|
||||
int vol, ambient_channel;
|
||||
int32_t vol, ambient_channel;
|
||||
channel_t *chan;
|
||||
|
||||
// no ambients when disconnected
|
||||
|
@ -657,20 +657,20 @@ static void S_UpdateAmbientSounds (void)
|
|||
chan = &snd_channels[ambient_channel];
|
||||
chan->sfx = ambient_sfx[ambient_channel];
|
||||
|
||||
vol = (int) (ambient_level.value * l->ambient_sound_level[ambient_channel]);
|
||||
vol = (int32_t) (ambient_level.value * l->ambient_sound_level[ambient_channel]);
|
||||
if (vol < 8)
|
||||
vol = 0;
|
||||
|
||||
// don't adjust volume too fast
|
||||
if (chan->master_vol < vol)
|
||||
{
|
||||
chan->master_vol += (int) (host_frametime * ambient_fade.value);
|
||||
chan->master_vol += (int32_t) (host_frametime * ambient_fade.value);
|
||||
if (chan->master_vol > vol)
|
||||
chan->master_vol = vol;
|
||||
}
|
||||
else if (chan->master_vol > vol)
|
||||
{
|
||||
chan->master_vol -= (int) (host_frametime * ambient_fade.value);
|
||||
chan->master_vol -= (int32_t) (host_frametime * ambient_fade.value);
|
||||
if (chan->master_vol < vol)
|
||||
chan->master_vol = vol;
|
||||
}
|
||||
|
@ -690,18 +690,18 @@ Expects data in signed 16 bit, or unsigned
|
|||
8 bit format.
|
||||
===================
|
||||
*/
|
||||
void S_RawSamples (int samples, int rate, int width, int channels, byte *data, float volume)
|
||||
void S_RawSamples (int32_t samples, int32_t rate, int32_t width, int32_t channels, byte *data, float volume)
|
||||
{
|
||||
int i;
|
||||
int src, dst;
|
||||
int32_t i;
|
||||
int32_t src, dst;
|
||||
float scale;
|
||||
int intVolume;
|
||||
int32_t intVolume;
|
||||
|
||||
if (s_rawend < paintedtime)
|
||||
s_rawend = paintedtime;
|
||||
|
||||
scale = (float) rate / shm->speed;
|
||||
intVolume = (int) (256 * volume);
|
||||
intVolume = (int32_t) (256 * volume);
|
||||
|
||||
if (channels == 2 && width == 2)
|
||||
{
|
||||
|
@ -774,8 +774,8 @@ Called once each time through the main loop
|
|||
*/
|
||||
void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up)
|
||||
{
|
||||
int i, j;
|
||||
int total;
|
||||
int32_t i, j;
|
||||
int32_t total;
|
||||
channel_t *ch;
|
||||
channel_t *combine;
|
||||
|
||||
|
@ -851,12 +851,11 @@ void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up)
|
|||
{
|
||||
if (ch->sfx && (ch->leftvol || ch->rightvol) )
|
||||
{
|
||||
// Con_Printf ("%3i %3i %s\n", ch->leftvol, ch->rightvol, ch->sfx->name);
|
||||
total++;
|
||||
}
|
||||
}
|
||||
|
||||
Con_Printf ("----(%i)----\n", total);
|
||||
Con_Printf ("----(%" PRIi32 ")----\n", total);
|
||||
}
|
||||
|
||||
// add raw data from streamed samples
|
||||
|
@ -868,10 +867,10 @@ void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up)
|
|||
|
||||
static void GetSoundtime (void)
|
||||
{
|
||||
int samplepos;
|
||||
static int buffers;
|
||||
static int oldsamplepos;
|
||||
int fullsamples;
|
||||
int32_t samplepos;
|
||||
static int32_t buffers;
|
||||
static int32_t oldsamplepos;
|
||||
int32_t fullsamples;
|
||||
|
||||
fullsamples = shm->samples / shm->channels;
|
||||
|
||||
|
@ -905,7 +904,7 @@ void S_ExtraUpdate (void)
|
|||
static void S_Update_ (void)
|
||||
{
|
||||
uint32_t endtime;
|
||||
int samps;
|
||||
int32_t samps;
|
||||
|
||||
if (!sound_started || (snd_blocked > 0))
|
||||
return;
|
||||
|
@ -970,8 +969,8 @@ console functions
|
|||
|
||||
static void S_Play (void)
|
||||
{
|
||||
static int hash = 345;
|
||||
int i;
|
||||
static int32_t hash = 345;
|
||||
int32_t i;
|
||||
char name[256];
|
||||
sfx_t *sfx;
|
||||
|
||||
|
@ -991,8 +990,8 @@ static void S_Play (void)
|
|||
|
||||
static void S_PlayVol (void)
|
||||
{
|
||||
static int hash = 543;
|
||||
int i;
|
||||
static int32_t hash = 543;
|
||||
int32_t i;
|
||||
float vol;
|
||||
char name[256];
|
||||
sfx_t *sfx;
|
||||
|
@ -1014,10 +1013,10 @@ static void S_PlayVol (void)
|
|||
|
||||
static void S_SoundList (void)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
sfx_t *sfx;
|
||||
sfxcache_t *sc;
|
||||
int size, total;
|
||||
int32_t size, total;
|
||||
|
||||
total = 0;
|
||||
for (sfx = known_sfx, i = 0; i < num_sfx; i++, sfx++)
|
||||
|
@ -1031,9 +1030,9 @@ static void S_SoundList (void)
|
|||
Con_SafePrintf ("L"); //johnfitz -- was Con_Printf
|
||||
else
|
||||
Con_SafePrintf (" "); //johnfitz -- was Con_Printf
|
||||
Con_SafePrintf("(%2db) %6i : %s\n", sc->width*8, size, sfx->name); //johnfitz -- was Con_Printf
|
||||
Con_SafePrintf("(%2" PRIi32 "b) %6" PRIi32 " : %s\n", sc->width*8, size, sfx->name); //johnfitz -- was Con_Printf
|
||||
}
|
||||
Con_Printf ("%i sounds, %i bytes\n", num_sfx, total); //johnfitz -- added count
|
||||
Con_Printf ("%" PRIi32" PRIi32 "" sou" PRIi32 "ds, %" PRIi32 " bytes\n", num_sfx, total); //johnfitz -- added count
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ typedef struct {
|
|||
fshandle_t *file;
|
||||
snd_info_t *info;
|
||||
byte *buffer;
|
||||
int size, pos, error;
|
||||
int32_t size, pos, error;
|
||||
} flacfile_t;
|
||||
|
||||
/* CALLBACK FUNCTIONS: */
|
||||
|
@ -83,7 +83,7 @@ flac_error_func (const FLAC__StreamDecoder *decoder,
|
|||
(void)decoder;
|
||||
flacfile_t *ff = (flacfile_t *) client_data;
|
||||
ff->error = -1;
|
||||
Con_Printf ("FLAC: decoder error %i\n", status);
|
||||
Con_Printf ("FLAC: decoder error %" PRIi32 "\n", status);
|
||||
}
|
||||
|
||||
static FLAC__StreamDecoderReadStatus
|
||||
|
@ -232,7 +232,7 @@ flac_meta_func (const FLAC__StreamDecoder *decoder,
|
|||
}
|
||||
|
||||
|
||||
static qboolean S_FLAC_CodecInitialize (void)
|
||||
static bool S_FLAC_CodecInitialize (void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -241,10 +241,10 @@ static void S_FLAC_CodecShutdown (void)
|
|||
{
|
||||
}
|
||||
|
||||
static qboolean S_FLAC_CodecOpenStream (snd_stream_t *stream)
|
||||
static bool S_FLAC_CodecOpenStream (snd_stream_t *stream)
|
||||
{
|
||||
flacfile_t *ff;
|
||||
int rc;
|
||||
int32_t rc;
|
||||
|
||||
ff = (flacfile_t *) Z_Malloc(sizeof(flacfile_t));
|
||||
|
||||
|
@ -285,7 +285,7 @@ static qboolean S_FLAC_CodecOpenStream (snd_stream_t *stream)
|
|||
#endif
|
||||
if (rc != FLAC__STREAM_DECODER_INIT_STATUS_OK) /* unlikely */
|
||||
{
|
||||
Con_Printf ("FLAC: decoder init error %i\n", rc);
|
||||
Con_Printf ("FLAC: decoder init error %" PRIi32 "\n", rc);
|
||||
goto _fail;
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ static qboolean S_FLAC_CodecOpenStream (snd_stream_t *stream)
|
|||
if (rc == false || ff->error)
|
||||
{
|
||||
rc = FLAC__stream_decoder_get_state(ff->decoder);
|
||||
Con_Printf("%s not a valid flac file? (decoder state %i)\n",
|
||||
Con_Printf("%s not a valid flac file? (decoder state %" PRIi32 ")\n",
|
||||
stream->name, rc);
|
||||
goto _fail;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ static qboolean S_FLAC_CodecOpenStream (snd_stream_t *stream)
|
|||
}
|
||||
if (ff->info->channels != 1 && ff->info->channels != 2)
|
||||
{
|
||||
Con_Printf("Unsupported number of channels %d in %s\n",
|
||||
Con_Printf("Unsupported number of channels %" PRIi32 " in %s\n",
|
||||
ff->info->channels, stream->name);
|
||||
goto _fail;
|
||||
}
|
||||
|
@ -327,14 +327,14 @@ _fail:
|
|||
return false;
|
||||
}
|
||||
|
||||
static int S_FLAC_CodecReadStream (snd_stream_t *stream, int len, void *buffer)
|
||||
static int32_t S_FLAC_CodecReadStream (snd_stream_t *stream, int32_t len, void *buffer)
|
||||
{
|
||||
flacfile_t *ff = (flacfile_t *) stream->priv;
|
||||
byte *buf = (byte *) buffer;
|
||||
int count = 0;
|
||||
int32_t count = 0;
|
||||
|
||||
while (len) {
|
||||
int res = 0;
|
||||
int32_t res = 0;
|
||||
if (ff->size == ff->pos)
|
||||
FLAC__stream_decoder_process_single (ff->decoder);
|
||||
if (ff->error) return -1;
|
||||
|
@ -371,7 +371,7 @@ static void S_FLAC_CodecCloseStream (snd_stream_t *stream)
|
|||
S_CodecUtilClose(&stream);
|
||||
}
|
||||
|
||||
static int S_FLAC_CodecRewindStream (snd_stream_t *stream)
|
||||
static int32_t S_FLAC_CodecRewindStream (snd_stream_t *stream)
|
||||
{
|
||||
flacfile_t *ff = (flacfile_t *) stream->priv;
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
ResampleSfx
|
||||
================
|
||||
*/
|
||||
static void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data)
|
||||
static void ResampleSfx (sfx_t *sfx, int32_t inrate, int32_t inwidth, byte *data)
|
||||
{
|
||||
int outcount;
|
||||
int srcsample;
|
||||
int32_t outcount;
|
||||
int32_t srcsample;
|
||||
float stepscale;
|
||||
int i;
|
||||
int sample, samplefrac, fracstep;
|
||||
int32_t i;
|
||||
int32_t sample, samplefrac, fracstep;
|
||||
sfxcache_t *sc;
|
||||
|
||||
sc = (sfxcache_t *) Cache_Check (&sfx->cache);
|
||||
|
@ -60,7 +60,7 @@ static void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data)
|
|||
{
|
||||
// fast special case
|
||||
for (i = 0; i < outcount; i++)
|
||||
((int8_t *)sc->data)[i] = (int)( (uint8_t)(data[i]) - 128);
|
||||
((int8_t *)sc->data)[i] = (int32_t)( (uint8_t)(data[i]) - 128);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ static void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data)
|
|||
if (inwidth == 2)
|
||||
sample = LittleShort ( ((int16_t *)data)[srcsample] );
|
||||
else
|
||||
sample = (int)( (uint8_t)(data[srcsample]) - 128) << 8;
|
||||
sample = (int32_t)( (uint8_t)(data[srcsample]) - 128) << 8;
|
||||
if (sc->width == 2)
|
||||
((int16_t *)sc->data)[i] = sample;
|
||||
else
|
||||
|
@ -95,7 +95,7 @@ sfxcache_t *S_LoadSound (sfx_t *s)
|
|||
char namebuffer[256];
|
||||
byte *data;
|
||||
wavinfo_t info;
|
||||
int len;
|
||||
int32_t len;
|
||||
float stepscale;
|
||||
sfxcache_t *sc;
|
||||
byte stackbuf[1*1024]; // avoid dirtying the cache heap
|
||||
|
@ -105,7 +105,7 @@ sfxcache_t *S_LoadSound (sfx_t *s)
|
|||
if (sc)
|
||||
return sc;
|
||||
|
||||
// Con_Printf ("S_LoadSound: %x\n", (int)stackbuf);
|
||||
// Con_Printf ("S_LoadSound: %x\n", (int32_t)stackbuf);
|
||||
|
||||
// load it in
|
||||
q_strlcpy(namebuffer, "sound/", sizeof(namebuffer));
|
||||
|
@ -174,7 +174,7 @@ static byte *data_p;
|
|||
static byte *iff_end;
|
||||
static byte *last_chunk;
|
||||
static byte *iff_data;
|
||||
static int iff_chunk_len;
|
||||
static int32_t iff_chunk_len;
|
||||
|
||||
static int16_t GetLittleShort (void)
|
||||
{
|
||||
|
@ -185,9 +185,9 @@ static int16_t GetLittleShort (void)
|
|||
return val;
|
||||
}
|
||||
|
||||
static int GetLittleLong (void)
|
||||
static int32_t GetLittleLong (void)
|
||||
{
|
||||
int val = 0;
|
||||
int32_t val = 0;
|
||||
val = *data_p;
|
||||
val = val + (*(data_p+1)<<8);
|
||||
val = val + (*(data_p+2)<<16);
|
||||
|
@ -212,7 +212,7 @@ static void FindNextChunk (const char *name)
|
|||
if (iff_chunk_len < 0 || iff_chunk_len > iff_end - data_p)
|
||||
{
|
||||
data_p = NULL;
|
||||
Con_DPrintf2("bad \"%s\" chunk length (%d)\n", name, iff_chunk_len);
|
||||
Con_DPrintf2("bad \"%s\" chunk length (%" PRIi32 ")\n", name, iff_chunk_len);
|
||||
return;
|
||||
}
|
||||
last_chunk = data_p + ((iff_chunk_len + 1) & ~1);
|
||||
|
@ -240,7 +240,7 @@ static void DumpChunks (void)
|
|||
memcpy (str, data_p, 4);
|
||||
data_p += 4;
|
||||
iff_chunk_len = GetLittleLong();
|
||||
Con_Printf ("0x%x : %s (%d)\n", (int)(data_p - 4), str, iff_chunk_len);
|
||||
Con_Printf ("0x%x : %s (%" PRIi32 ")\n", (int32_t)(data_p - 4), str, iff_chunk_len);
|
||||
data_p += (iff_chunk_len + 1) & ~1;
|
||||
} while (data_p < iff_end);
|
||||
}
|
||||
|
@ -251,12 +251,12 @@ static void DumpChunks (void)
|
|||
GetWavinfo
|
||||
============
|
||||
*/
|
||||
wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength)
|
||||
wavinfo_t GetWavinfo (const char *name, byte *wav, int32_t wavlength)
|
||||
{
|
||||
wavinfo_t info;
|
||||
int i;
|
||||
int format;
|
||||
int samples;
|
||||
int32_t i;
|
||||
int32_t format;
|
||||
int32_t samples;
|
||||
|
||||
memset (&info, 0, sizeof(info));
|
||||
|
||||
|
@ -308,7 +308,7 @@ wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength)
|
|||
{
|
||||
data_p += 32;
|
||||
info.loopstart = GetLittleLong();
|
||||
// Con_Printf("loopstart=%d\n", sfx->loopstart);
|
||||
// Con_Printf("loopstart=%" PRIi32 "\n", sfx->loopstart);
|
||||
|
||||
// if the next chunk is a LIST chunk, look for a cue length marker
|
||||
FindNextChunk ("LIST");
|
||||
|
@ -319,7 +319,7 @@ wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength)
|
|||
data_p += 24;
|
||||
i = GetLittleLong(); // samples in loop
|
||||
info.samples = info.loopstart + i;
|
||||
// Con_Printf("looped length: %i\n", i);
|
||||
// Con_Printf("looped length: %" PRIi32 "\n", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ typedef struct _mik_priv {
|
|||
MODULE *module;
|
||||
} mik_priv_t;
|
||||
|
||||
static int MIK_Seek (MREADER *r, long ofs, int whence)
|
||||
static int32_t MIK_Seek (MREADER *r, long ofs, int32_t whence)
|
||||
{
|
||||
return FS_fseek(((mik_priv_t *)r)->fh, ofs, whence);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ static BOOL MIK_Read (MREADER *r, void *ptr, size_t siz)
|
|||
return !!FS_fread(ptr, siz, 1, ((mik_priv_t *)r)->fh);
|
||||
}
|
||||
|
||||
static int MIK_Get (MREADER *r)
|
||||
static int32_t MIK_Get (MREADER *r)
|
||||
{
|
||||
return FS_fgetc(((mik_priv_t *)r)->fh);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ static BOOL MIK_Eof (MREADER *r)
|
|||
return FS_feof(((mik_priv_t *)r)->fh);
|
||||
}
|
||||
|
||||
static qboolean S_MIKMOD_CodecInitialize (void)
|
||||
static bool S_MIKMOD_CodecInitialize (void)
|
||||
{
|
||||
if (mikmod_codec.initialized)
|
||||
return true;
|
||||
|
@ -126,7 +126,7 @@ static void S_MIKMOD_CodecShutdown (void)
|
|||
}
|
||||
}
|
||||
|
||||
static qboolean S_MIKMOD_CodecOpenStream (snd_stream_t *stream)
|
||||
static bool S_MIKMOD_CodecOpenStream (snd_stream_t *stream)
|
||||
{
|
||||
mik_priv_t *priv;
|
||||
|
||||
|
@ -160,16 +160,16 @@ static qboolean S_MIKMOD_CodecOpenStream (snd_stream_t *stream)
|
|||
stream->info.bits = (md_mode & DMODE_16BITS)? 16: 8;
|
||||
stream->info.width = stream->info.bits / 8;
|
||||
stream->info.channels = (md_mode & DMODE_STEREO)? 2 : 1;
|
||||
/* Con_DPrintf("Playing %s (%d chn)\n", priv->module->songname, priv->module->numchn);*/
|
||||
/* Con_DPrintf("Playing %s (%" PRIi32 " chn)\n", priv->module->songname, priv->module->numchn);*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int S_MIKMOD_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
|
||||
static int32_t S_MIKMOD_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer)
|
||||
{
|
||||
if (!Player_Active())
|
||||
return 0;
|
||||
return (int) VC_WriteBytes((SBYTE *)buffer, bytes);
|
||||
return (int32_t) VC_WriteBytes((SBYTE *)buffer, bytes);
|
||||
}
|
||||
|
||||
static void S_MIKMOD_CodecCloseStream (snd_stream_t *stream)
|
||||
|
@ -180,7 +180,7 @@ static void S_MIKMOD_CodecCloseStream (snd_stream_t *stream)
|
|||
S_CodecUtilClose(&stream);
|
||||
}
|
||||
|
||||
static int S_MIKMOD_CodecRewindStream (snd_stream_t *stream)
|
||||
static int32_t S_MIKMOD_CodecRewindStream (snd_stream_t *stream)
|
||||
{
|
||||
Player_SetPosition (0);
|
||||
return 0;
|
||||
|
|
|
@ -25,16 +25,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define PAINTBUFFER_SIZE 2048
|
||||
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
|
||||
int snd_scaletable[32][256];
|
||||
int *snd_p, snd_linear_count;
|
||||
int32_t snd_scaletable[32][256];
|
||||
int32_t *snd_p, snd_linear_count;
|
||||
int16_t *snd_out;
|
||||
|
||||
static int snd_vol;
|
||||
static int32_t snd_vol;
|
||||
|
||||
static void Snd_WriteLinearBlastStereo16 (void)
|
||||
{
|
||||
int i;
|
||||
int val;
|
||||
int32_t i;
|
||||
int32_t val;
|
||||
|
||||
for (i = 0; i < snd_linear_count; i += 2)
|
||||
{
|
||||
|
@ -56,12 +56,12 @@ static void Snd_WriteLinearBlastStereo16 (void)
|
|||
}
|
||||
}
|
||||
|
||||
static void S_TransferStereo16 (int endtime)
|
||||
static void S_TransferStereo16 (int32_t endtime)
|
||||
{
|
||||
int lpos;
|
||||
int lpaintedtime;
|
||||
int32_t lpos;
|
||||
int32_t lpaintedtime;
|
||||
|
||||
snd_p = (int *) paintbuffer;
|
||||
snd_p = (int32_t *) paintbuffer;
|
||||
lpaintedtime = paintedtime;
|
||||
|
||||
while (lpaintedtime < endtime)
|
||||
|
@ -85,11 +85,11 @@ static void S_TransferStereo16 (int endtime)
|
|||
}
|
||||
}
|
||||
|
||||
static void S_TransferPaintBuffer (int endtime)
|
||||
static void S_TransferPaintBuffer (int32_t endtime)
|
||||
{
|
||||
int out_idx, out_mask;
|
||||
int count, step, val;
|
||||
int *p;
|
||||
int32_t out_idx, out_mask;
|
||||
int32_t count, step, val;
|
||||
int32_t *p;
|
||||
|
||||
if (shm->samplebits == 16 && shm->channels == 2)
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ static void S_TransferPaintBuffer (int endtime)
|
|||
return;
|
||||
}
|
||||
|
||||
p = (int *) paintbuffer;
|
||||
p = (int32_t *) paintbuffer;
|
||||
count = (endtime - paintedtime) * shm->channels;
|
||||
out_mask = shm->samples - 1;
|
||||
out_idx = paintedtime * shm->channels & out_mask;
|
||||
|
@ -162,9 +162,9 @@ kernel has room for M+1 floats
|
|||
f_c is the filter cutoff frequency, as a fraction of the samplerate
|
||||
==============
|
||||
*/
|
||||
static void S_MakeBlackmanWindowKernel(float *kernel, int M, float f_c)
|
||||
static void S_MakeBlackmanWindowKernel(float *kernel, int32_t M, float f_c)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for (i = 0; i <= M; i++)
|
||||
{
|
||||
if (i == M/2)
|
||||
|
@ -197,13 +197,13 @@ static void S_MakeBlackmanWindowKernel(float *kernel, int M, float f_c)
|
|||
typedef struct {
|
||||
float *memory; // kernelsize floats
|
||||
float *kernel; // kernelsize floats
|
||||
int kernelsize; // M+1, rounded up to be a multiple of 16
|
||||
int M; // M value used to make kernel, even
|
||||
int parity; // 0-3
|
||||
int32_t kernelsize; // M+1, rounded up to be a multiple of 16
|
||||
int32_t M; // M value used to make kernel, even
|
||||
int32_t parity; // 0-3
|
||||
float f_c; // cutoff frequency, [0..1], fraction of sample rate
|
||||
} filter_t;
|
||||
|
||||
static void S_UpdateFilter(filter_t *filter, int M, float f_c)
|
||||
static void S_UpdateFilter(filter_t *filter, int32_t M, float f_c)
|
||||
{
|
||||
if (filter->f_c != f_c || filter->M != M)
|
||||
{
|
||||
|
@ -235,13 +235,13 @@ kernel is 4x faster, because we can skip 3/4 of the input samples that are
|
|||
known to be 0 and skip 3/4 of the filter kernel.
|
||||
==============
|
||||
*/
|
||||
static void S_ApplyFilter(filter_t *filter, int *data, int stride, int count)
|
||||
static void S_ApplyFilter(filter_t *filter, int32_t *data, int32_t stride, int32_t count)
|
||||
{
|
||||
int i, j;
|
||||
int32_t i, j;
|
||||
float *input;
|
||||
const int kernelsize = filter->kernelsize;
|
||||
const int32_t kernelsize = filter->kernelsize;
|
||||
const float *kernel = filter->kernel;
|
||||
int parity;
|
||||
int32_t parity;
|
||||
|
||||
input = (float *) malloc(sizeof(float) * (filter->kernelsize + count));
|
||||
|
||||
|
@ -295,13 +295,13 @@ assumes 44100Hz sample rate, and lowpasses at around 5kHz
|
|||
memory should be a zero-filled filter_t struct
|
||||
==============
|
||||
*/
|
||||
static void S_LowpassFilter(int *data, int stride, int count,
|
||||
static void S_LowpassFilter(int32_t *data, int32_t stride, int32_t count,
|
||||
filter_t *memory)
|
||||
{
|
||||
int M;
|
||||
int32_t M;
|
||||
float bw, f_c;
|
||||
|
||||
switch ((int)snd_filterquality.value)
|
||||
switch ((int32_t)snd_filterquality.value)
|
||||
{
|
||||
case 1:
|
||||
M = 126; bw = 0.900; break;
|
||||
|
@ -330,13 +330,13 @@ CHANNEL MIXING
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int endtime, int paintbufferstart);
|
||||
static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int endtime, int paintbufferstart);
|
||||
static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int32_t endtime, int32_t paintbufferstart);
|
||||
static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int32_t endtime, int32_t paintbufferstart);
|
||||
|
||||
void S_PaintChannels (int endtime)
|
||||
void S_PaintChannels (int32_t endtime)
|
||||
{
|
||||
int i;
|
||||
int end, ltime, count;
|
||||
int32_t i;
|
||||
int32_t end, ltime, count;
|
||||
channel_t *ch;
|
||||
sfxcache_t *sc;
|
||||
|
||||
|
@ -415,15 +415,15 @@ void S_PaintChannels (int endtime)
|
|||
if (sndspeed.value == 11025 && shm->speed == 44100)
|
||||
{
|
||||
static filter_t memory_l, memory_r;
|
||||
S_LowpassFilter((int *)paintbuffer, 2, end - paintedtime, &memory_l);
|
||||
S_LowpassFilter(((int *)paintbuffer) + 1, 2, end - paintedtime, &memory_r);
|
||||
S_LowpassFilter((int32_t *)paintbuffer, 2, end - paintedtime, &memory_l);
|
||||
S_LowpassFilter(((int32_t *)paintbuffer) + 1, 2, end - paintedtime, &memory_r);
|
||||
}
|
||||
|
||||
// paint in the music
|
||||
if (s_rawend >= paintedtime)
|
||||
{ // copy from the streaming sound source
|
||||
int s;
|
||||
int stop;
|
||||
int32_t s;
|
||||
int32_t stop;
|
||||
|
||||
stop = (end < s_rawend) ? end : s_rawend;
|
||||
|
||||
|
@ -448,8 +448,8 @@ void S_PaintChannels (int endtime)
|
|||
|
||||
void SND_InitScaletable (void)
|
||||
{
|
||||
int i, j;
|
||||
int scale;
|
||||
int32_t i, j;
|
||||
int32_t scale;
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
|
@ -469,12 +469,12 @@ void SND_InitScaletable (void)
|
|||
}
|
||||
|
||||
|
||||
static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count, int paintbufferstart)
|
||||
static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int32_t count, int32_t paintbufferstart)
|
||||
{
|
||||
int data;
|
||||
int *lscale, *rscale;
|
||||
int32_t data;
|
||||
int32_t *lscale, *rscale;
|
||||
uint8_t *sfx;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (ch->leftvol > 255)
|
||||
ch->leftvol = 255;
|
||||
|
@ -495,13 +495,13 @@ static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count, int
|
|||
ch->pos += count;
|
||||
}
|
||||
|
||||
static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count, int paintbufferstart)
|
||||
static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int32_t count, int32_t paintbufferstart)
|
||||
{
|
||||
int data;
|
||||
int left, right;
|
||||
int leftvol, rightvol;
|
||||
int32_t data;
|
||||
int32_t left, right;
|
||||
int32_t leftvol, rightvol;
|
||||
int16_t *sfx;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
leftvol = ch->leftvol * snd_vol;
|
||||
rightvol = ch->rightvol * snd_vol;
|
||||
|
|
350
source/snd_mp3.c
350
source/snd_mp3.c
|
@ -56,18 +56,18 @@ static mad_timer_t const mad_timer_zero_stub = {0, 0};
|
|||
typedef struct _mp3_priv_t
|
||||
{
|
||||
uint8_t mp3_buffer[MP3_BUFFER_SIZE];
|
||||
struct mad_stream Stream;
|
||||
struct mad_frame Frame;
|
||||
struct mad_synth Synth;
|
||||
mad_timer_t Timer;
|
||||
struct mad_stream stream;
|
||||
struct mad_frame frame;
|
||||
struct mad_synth synth;
|
||||
mad_timer_t timer;
|
||||
ptrdiff_t cursamp;
|
||||
size_t FrameCount;
|
||||
size_t frame_count;
|
||||
} mp3_priv_t;
|
||||
|
||||
/* This function merges the functions tagtype() and id3_tag_query()
|
||||
* from MAD's libid3tag, so we don't have to link to it
|
||||
* Returns 0 if the frame is not an ID3 tag, tag length if it is */
|
||||
static inline qboolean tag_is_id3v1(const uint8_t *data, size_t length)
|
||||
static inline bool tag_is_id3v1(const uint8_t *data, size_t length)
|
||||
{
|
||||
if (length >= 3 &&
|
||||
data[0] == 'T' && data[1] == 'A' && data[2] == 'G')
|
||||
|
@ -77,7 +77,7 @@ static inline qboolean tag_is_id3v1(const uint8_t *data, size_t length)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline qboolean tag_is_id3v2(const uint8_t *data, size_t length)
|
||||
static inline bool tag_is_id3v2(const uint8_t *data, size_t length)
|
||||
{
|
||||
if (length >= 10 &&
|
||||
(data[0] == 'I' && data[1] == 'D' && data[2] == '3') &&
|
||||
|
@ -93,7 +93,7 @@ static inline qboolean tag_is_id3v2(const uint8_t *data, size_t length)
|
|||
* http://wiki.hydrogenaud.io/index.php?title=APEv2_specification
|
||||
* Detect an APEv2 tag. (APEv1 has no header, so no luck.)
|
||||
*/
|
||||
static inline qboolean tag_is_apetag(const uint8_t *data, size_t length)
|
||||
static inline bool tag_is_apetag(const uint8_t *data, size_t length)
|
||||
{
|
||||
uint32_t v;
|
||||
|
||||
|
@ -140,29 +140,29 @@ static size_t mp3_tagsize(const uint8_t *data, size_t length)
|
|||
/* Attempts to read an ID3 tag at the current location in stream and
|
||||
* consume it all. Returns -1 if no tag is found. Its up to caller
|
||||
* to recover. */
|
||||
static int mp3_inputtag(snd_stream_t *stream)
|
||||
static int32_t mp3_inputtag(snd_stream_t *stream)
|
||||
{
|
||||
mp3_priv_t *p = (mp3_priv_t *) stream->priv;
|
||||
int rc = -1;
|
||||
int32_t rc = -1;
|
||||
size_t remaining;
|
||||
size_t tagsize;
|
||||
|
||||
/* FIXME: This needs some more work if we are to ever
|
||||
* look at the ID3 frame. This is because the Stream
|
||||
* look at the ID3 frame. This is because the stream
|
||||
* may not be able to hold the complete ID3 frame.
|
||||
* We should consume the whole frame inside tagtype()
|
||||
* instead of outside of tagframe(). That would support
|
||||
* recovering when Stream contains less then 8-bytes (header)
|
||||
* and also when ID3v2 is bigger then Stream buffer size.
|
||||
* recovering when stream contains less then 8-bytes (header)
|
||||
* and also when ID3v2 is bigger then stream buffer size.
|
||||
* Need to pass in stream so that buffer can be
|
||||
* consumed as well as letting additional data to be
|
||||
* read in.
|
||||
*/
|
||||
remaining = p->Stream.bufend - p->Stream.next_frame;
|
||||
tagsize = mp3_tagsize(p->Stream.this_frame, remaining);
|
||||
remaining = p->stream.bufend - p->stream.next_frame;
|
||||
tagsize = mp3_tagsize(p->stream.this_frame, remaining);
|
||||
if (tagsize != 0)
|
||||
{
|
||||
mad_stream_skip(&p->Stream, tagsize);
|
||||
mad_stream_skip(&p->stream, tagsize);
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ static int mp3_inputtag(snd_stream_t *stream)
|
|||
* so help libmad out and go back into frame seek mode.
|
||||
* This is true whether an ID3 tag was found or not.
|
||||
*/
|
||||
mad_stream_sync(&p->Stream);
|
||||
mad_stream_sync(&p->stream);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -178,13 +178,13 @@ static int mp3_inputtag(snd_stream_t *stream)
|
|||
/* (Re)fill the stream buffer that is to be decoded. If any data
|
||||
* still exists in the buffer then they are first shifted to be
|
||||
* front of the stream buffer. */
|
||||
static int mp3_inputdata(snd_stream_t *stream)
|
||||
static int32_t mp3_inputdata(snd_stream_t *stream)
|
||||
{
|
||||
mp3_priv_t *p = (mp3_priv_t *) stream->priv;
|
||||
size_t bytes_read;
|
||||
size_t remaining;
|
||||
|
||||
remaining = p->Stream.bufend - p->Stream.next_frame;
|
||||
remaining = p->stream.bufend - p->stream.next_frame;
|
||||
|
||||
/* libmad does not consume all the buffer it's given. Some
|
||||
* data, part of a truncated frame, is left unused at the
|
||||
|
@ -196,28 +196,28 @@ static int mp3_inputdata(snd_stream_t *stream)
|
|||
* TODO: Is 2016 bytes the size of the largest frame?
|
||||
* (448000*(1152/32000))/8
|
||||
*/
|
||||
memmove(p->mp3_buffer, p->Stream.next_frame, remaining);
|
||||
memmove(p->mp3_buffer, p->stream.next_frame, remaining);
|
||||
|
||||
bytes_read = FS_fread(p->mp3_buffer + remaining, 1,
|
||||
MP3_BUFFER_SIZE - remaining, &stream->fh);
|
||||
if (bytes_read == 0)
|
||||
return -1;
|
||||
|
||||
mad_stream_buffer(&p->Stream, p->mp3_buffer, bytes_read+remaining);
|
||||
p->Stream.error = MAD_ERROR_NONE;
|
||||
mad_stream_buffer(&p->stream, p->mp3_buffer, bytes_read+remaining);
|
||||
p->stream.error = MAD_ERROR_NONE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mp3_startread(snd_stream_t *stream)
|
||||
static int32_t mp3_startread(snd_stream_t *stream)
|
||||
{
|
||||
mp3_priv_t *p = (mp3_priv_t *) stream->priv;
|
||||
size_t ReadSize;
|
||||
|
||||
mad_stream_init(&p->Stream);
|
||||
mad_frame_init(&p->Frame);
|
||||
mad_synth_init(&p->Synth);
|
||||
mad_timer_reset(&p->Timer);
|
||||
mad_stream_init(&p->stream);
|
||||
mad_frame_init(&p->frame);
|
||||
mad_synth_init(&p->synth);
|
||||
mad_timer_reset(&p->timer);
|
||||
|
||||
/* Decode at least one valid frame to find out the input
|
||||
* format. The decoded frame will be saved off so that it
|
||||
|
@ -227,17 +227,17 @@ static int mp3_startread(snd_stream_t *stream)
|
|||
if (!ReadSize || FS_ferror(&stream->fh))
|
||||
return -1;
|
||||
|
||||
mad_stream_buffer(&p->Stream, p->mp3_buffer, ReadSize);
|
||||
mad_stream_buffer(&p->stream, p->mp3_buffer, ReadSize);
|
||||
|
||||
/* Find a valid frame before starting up. This makes sure
|
||||
* that we have a valid MP3 and also skips past ID3v2 tags
|
||||
* at the beginning of the audio file.
|
||||
*/
|
||||
p->Stream.error = MAD_ERROR_NONE;
|
||||
while (mad_frame_decode(&p->Frame,&p->Stream))
|
||||
p->stream.error = MAD_ERROR_NONE;
|
||||
while (mad_frame_decode(&p->frame,&p->stream))
|
||||
{
|
||||
/* check whether input buffer needs a refill */
|
||||
if (p->Stream.error == MAD_ERROR_BUFLEN)
|
||||
if (p->stream.error == MAD_ERROR_BUFLEN)
|
||||
{
|
||||
if (mp3_inputdata(stream) == -1)
|
||||
return -1;/* EOF with no valid data */
|
||||
|
@ -253,33 +253,33 @@ static int mp3_startread(snd_stream_t *stream)
|
|||
* frame. In that case we can abort early without
|
||||
* scanning the whole file.
|
||||
*/
|
||||
p->Stream.error = MAD_ERROR_NONE;
|
||||
p->stream.error = MAD_ERROR_NONE;
|
||||
}
|
||||
|
||||
if (p->Stream.error)
|
||||
if (p->stream.error)
|
||||
{
|
||||
Con_Printf("MP3: No valid MP3 frame found\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(p->Frame.header.mode)
|
||||
switch(p->frame.header.mode)
|
||||
{
|
||||
case MAD_MODE_SINGLE_CHANNEL:
|
||||
case MAD_MODE_DUAL_CHANNEL:
|
||||
case MAD_MODE_JOINT_STEREO:
|
||||
case MAD_MODE_STEREO:
|
||||
stream->info.channels = MAD_NCHANNELS(&p->Frame.header);
|
||||
stream->info.channels = MAD_NCHANNELS(&p->frame.header);
|
||||
break;
|
||||
default:
|
||||
Con_Printf("MP3: Cannot determine number of channels\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
p->FrameCount = 1;
|
||||
p->frame_count = 1;
|
||||
|
||||
mad_timer_add(&p->Timer,p->Frame.header.duration);
|
||||
mad_synth_frame(&p->Synth,&p->Frame);
|
||||
stream->info.rate = p->Synth.pcm.samplerate;
|
||||
mad_timer_add(&p->timer,p->frame.header.duration);
|
||||
mad_synth_frame(&p->synth,&p->frame);
|
||||
stream->info.rate = p->synth.pcm.samplerate;
|
||||
stream->info.bits = MP3_MAD_SAMPLEBITS;
|
||||
stream->info.width = MP3_MAD_SAMPLEWIDTH;
|
||||
|
||||
|
@ -288,27 +288,27 @@ static int mp3_startread(snd_stream_t *stream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Read up to len samples from p->Synth
|
||||
/* Read up to len samples from p->synth
|
||||
* If needed, read some more MP3 data, decode them and synth them
|
||||
* Place in buf[].
|
||||
* Return number of samples read. */
|
||||
static int mp3_decode(snd_stream_t *stream, byte *buf, int len)
|
||||
static int32_t mp3_decode(snd_stream_t *stream, byte *buf, int32_t len)
|
||||
{
|
||||
mp3_priv_t *p = (mp3_priv_t *) stream->priv;
|
||||
int donow, i, done = 0;
|
||||
int32_t donow, i, done = 0;
|
||||
mad_fixed_t sample;
|
||||
int chan, x;
|
||||
int32_t chan, x;
|
||||
|
||||
do
|
||||
{
|
||||
x = (p->Synth.pcm.length - p->cursamp) * stream->info.channels;
|
||||
x = (p->synth.pcm.length - p->cursamp) * stream->info.channels;
|
||||
donow = q_min(len, x);
|
||||
i = 0;
|
||||
while (i < donow)
|
||||
{
|
||||
for (chan = 0; chan < stream->info.channels; chan++)
|
||||
{
|
||||
sample = p->Synth.pcm.samples[chan][p->cursamp];
|
||||
sample = p->synth.pcm.samples[chan][p->cursamp];
|
||||
/* convert from fixed to int16_t,
|
||||
* write in host-endian format. */
|
||||
if (sample <= -MAD_F_ONE)
|
||||
|
@ -339,7 +339,7 @@ static int mp3_decode(snd_stream_t *stream, byte *buf, int len)
|
|||
break;
|
||||
|
||||
/* check whether input buffer needs a refill */
|
||||
if (p->Stream.error == MAD_ERROR_BUFLEN)
|
||||
if (p->stream.error == MAD_ERROR_BUFLEN)
|
||||
{
|
||||
if (mp3_inputdata(stream) == -1)
|
||||
{
|
||||
|
@ -349,167 +349,46 @@ static int mp3_decode(snd_stream_t *stream, byte *buf, int len)
|
|||
}
|
||||
}
|
||||
|
||||
if (mad_frame_decode(&p->Frame, &p->Stream))
|
||||
if (mad_frame_decode(&p->frame, &p->stream))
|
||||
{
|
||||
if (MAD_RECOVERABLE(p->Stream.error))
|
||||
if (MAD_RECOVERABLE(p->stream.error))
|
||||
{
|
||||
mp3_inputtag(stream);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->Stream.error == MAD_ERROR_BUFLEN)
|
||||
if (p->stream.error == MAD_ERROR_BUFLEN)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
Con_Printf("MP3: unrecoverable frame level error (%s)\n",
|
||||
mad_stream_errorstr(&p->Stream));
|
||||
mad_stream_errorstr(&p->stream));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
p->FrameCount++;
|
||||
mad_timer_add(&p->Timer, p->Frame.header.duration);
|
||||
mad_synth_frame(&p->Synth, &p->Frame);
|
||||
p->frame_count++;
|
||||
mad_timer_add(&p->timer, p->frame.header.duration);
|
||||
mad_synth_frame(&p->synth, &p->frame);
|
||||
p->cursamp = 0;
|
||||
} while (1);
|
||||
|
||||
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;
|
||||
|
||||
mad_synth_finish(&p->Synth);
|
||||
mad_frame_finish(&p->Frame);
|
||||
mad_stream_finish(&p->Stream);
|
||||
mad_synth_finish(&p->synth);
|
||||
mad_frame_finish(&p->frame);
|
||||
mad_stream_finish(&p->stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mp3_madseek(snd_stream_t *stream, unsigned long offset)
|
||||
{
|
||||
mp3_priv_t *p = (mp3_priv_t *) stream->priv;
|
||||
size_t initial_bitrate = p->Frame.header.bitrate;
|
||||
size_t tagsize = 0, consumed = 0;
|
||||
int vbr = 0; /* Variable Bit Rate, bool */
|
||||
qboolean depadded = false;
|
||||
unsigned long to_skip_samples = 0;
|
||||
|
||||
/* Reset all */
|
||||
FS_rewind(&stream->fh);
|
||||
mad_timer_reset(&p->Timer);
|
||||
p->FrameCount = 0;
|
||||
|
||||
/* They where opened in startread */
|
||||
mad_synth_finish(&p->Synth);
|
||||
mad_frame_finish(&p->Frame);
|
||||
mad_stream_finish(&p->Stream);
|
||||
|
||||
mad_stream_init(&p->Stream);
|
||||
mad_frame_init(&p->Frame);
|
||||
mad_synth_init(&p->Synth);
|
||||
|
||||
offset /= stream->info.channels;
|
||||
to_skip_samples = offset;
|
||||
|
||||
while (1) /* Read data from the MP3 file */
|
||||
{
|
||||
int bytes_read, padding = 0;
|
||||
size_t leftover = p->Stream.bufend - p->Stream.next_frame;
|
||||
|
||||
memcpy(p->mp3_buffer, p->Stream.this_frame, leftover);
|
||||
bytes_read = FS_fread(p->mp3_buffer + leftover, (size_t) 1,
|
||||
MP3_BUFFER_SIZE - leftover, &stream->fh);
|
||||
if (bytes_read <= 0)
|
||||
{
|
||||
Con_DPrintf("seek failure. unexpected EOF (frames=%lu leftover=%lu)\n",
|
||||
(unsigned long)p->FrameCount, (unsigned long)leftover);
|
||||
break;
|
||||
}
|
||||
for ( ; !depadded && padding < bytes_read && !p->mp3_buffer[padding]; ++padding)
|
||||
;
|
||||
depadded = true;
|
||||
mad_stream_buffer(&p->Stream, p->mp3_buffer + padding, leftover + bytes_read - padding);
|
||||
|
||||
while (1) /* Decode frame headers */
|
||||
{
|
||||
static uint16_t samples;
|
||||
p->Stream.error = MAD_ERROR_NONE;
|
||||
|
||||
/* Not an audio frame */
|
||||
if (mad_header_decode(&p->Frame.header, &p->Stream) == -1)
|
||||
{
|
||||
if (p->Stream.error == MAD_ERROR_BUFLEN)
|
||||
break; /* Normal behaviour; get some more data from the file */
|
||||
if (!MAD_RECOVERABLE(p->Stream.error))
|
||||
{
|
||||
Con_DPrintf("unrecoverable MAD error\n");
|
||||
break;
|
||||
}
|
||||
if (p->Stream.error == MAD_ERROR_LOSTSYNC)
|
||||
{
|
||||
unsigned long available = (p->Stream.bufend - p->Stream.this_frame);
|
||||
tagsize = mp3_tagsize(p->Stream.this_frame, (size_t) available);
|
||||
if (tagsize)
|
||||
{ /* It's some ID3 tags, so just skip */
|
||||
if (tagsize >= available)
|
||||
{
|
||||
FS_fseek(&stream->fh, (long)(tagsize - available), SEEK_CUR);
|
||||
depadded = false;
|
||||
}
|
||||
mad_stream_skip(&p->Stream, q_min(tagsize, available));
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_DPrintf("MAD lost sync\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_DPrintf("recoverable MAD error\n");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
consumed += p->Stream.next_frame - p->Stream.this_frame;
|
||||
vbr |= (p->Frame.header.bitrate != initial_bitrate);
|
||||
|
||||
samples = 32 * MAD_NSBSAMPLES(&p->Frame.header);
|
||||
|
||||
p->FrameCount++;
|
||||
mad_timer_add(&p->Timer, p->Frame.header.duration);
|
||||
|
||||
if (to_skip_samples <= samples)
|
||||
{
|
||||
mad_frame_decode(&p->Frame,&p->Stream);
|
||||
mad_synth_frame(&p->Synth, &p->Frame);
|
||||
p->cursamp = to_skip_samples;
|
||||
return 0;
|
||||
}
|
||||
else to_skip_samples -= samples;
|
||||
|
||||
/* If not VBR, we can extrapolate frame size */
|
||||
if (p->FrameCount == 64 && !vbr)
|
||||
{
|
||||
p->FrameCount = offset / samples;
|
||||
to_skip_samples = offset % samples;
|
||||
if (0 != FS_fseek(&stream->fh, (p->FrameCount * consumed / 64) + tagsize, SEEK_SET))
|
||||
return -1;
|
||||
|
||||
/* Reset Stream for refilling buffer */
|
||||
mad_stream_finish(&p->Stream);
|
||||
mad_stream_init(&p->Stream);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static qboolean S_MP3_CodecInitialize (void)
|
||||
static bool S_MP3_CodecInitialize (void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -518,9 +397,9 @@ static void S_MP3_CodecShutdown (void)
|
|||
{
|
||||
}
|
||||
|
||||
static qboolean 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));
|
||||
if (!stream->priv)
|
||||
|
@ -535,7 +414,7 @@ static qboolean S_MP3_CodecOpenStream (snd_stream_t *stream)
|
|||
}
|
||||
else if (stream->info.channels != 1 && stream->info.channels != 2)
|
||||
{
|
||||
Con_Printf("Unsupported number of channels %d in %s\n",
|
||||
Con_Printf("Unsupported number of channels %" PRIi32 " in %s\n",
|
||||
stream->info.channels, stream->name);
|
||||
}
|
||||
else
|
||||
|
@ -546,9 +425,9 @@ static qboolean S_MP3_CodecOpenStream (snd_stream_t *stream)
|
|||
return false;
|
||||
}
|
||||
|
||||
static int S_MP3_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
|
||||
static int32_t S_MP3_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer)
|
||||
{
|
||||
int res = mp3_decode(stream, (byte *)buffer, bytes / stream->info.width);
|
||||
int32_t res = mp3_decode(stream, (byte *)buffer, bytes / stream->info.width);
|
||||
return res * stream->info.width;
|
||||
}
|
||||
|
||||
|
@ -559,14 +438,105 @@ static void S_MP3_CodecCloseStream (snd_stream_t *stream)
|
|||
S_CodecUtilClose(&stream);
|
||||
}
|
||||
|
||||
static int S_MP3_CodecRewindStream (snd_stream_t *stream)
|
||||
static int32_t S_MP3_CodecRewindStream (snd_stream_t *stream)
|
||||
{
|
||||
/*
|
||||
mp3_stopread(stream);
|
||||
mp3_priv_t *p = (mp3_priv_t *) stream->priv;
|
||||
size_t initial_bitrate = p->frame.header.bitrate;
|
||||
size_t tagsize = 0, consumed = 0;
|
||||
int32_t vbr = 0; /* Variable Bit Rate, bool */
|
||||
bool depadded = false;
|
||||
|
||||
/* Reset all */
|
||||
FS_rewind(&stream->fh);
|
||||
return mp3_startread(stream);
|
||||
*/
|
||||
return mp3_madseek(stream, 0);
|
||||
mad_timer_reset(&p->timer);
|
||||
p->frame_count = 0;
|
||||
|
||||
/* They where opened in startread */
|
||||
mad_synth_finish(&p->synth);
|
||||
mad_frame_finish(&p->frame);
|
||||
mad_stream_finish(&p->stream);
|
||||
|
||||
mad_stream_init(&p->stream);
|
||||
mad_frame_init(&p->frame);
|
||||
mad_synth_init(&p->synth);
|
||||
|
||||
while (1) /* Read data from the MP3 file */
|
||||
{
|
||||
int32_t bytes_read, padding = 0;
|
||||
size_t leftover = p->stream.bufend - p->stream.next_frame;
|
||||
|
||||
memcpy(p->mp3_buffer, p->stream.this_frame, leftover);
|
||||
bytes_read = FS_fread(p->mp3_buffer + leftover, (size_t) 1,
|
||||
MP3_BUFFER_SIZE - leftover, &stream->fh);
|
||||
if (bytes_read <= 0)
|
||||
{
|
||||
Con_DPrintf("seek failure. unexpected EOF (frames=%" PRIu32 " leftover=%" PRIu32 ")\n",
|
||||
p->frame_count, leftover);
|
||||
break;
|
||||
}
|
||||
for ( ; !depadded && padding < bytes_read && !p->mp3_buffer[padding]; ++padding)
|
||||
;
|
||||
depadded = true;
|
||||
mad_stream_buffer(&p->stream, p->mp3_buffer + padding, leftover + bytes_read - padding);
|
||||
|
||||
while (1) /* Decode frame headers */
|
||||
{
|
||||
static uint16_t samples;
|
||||
p->stream.error = MAD_ERROR_NONE;
|
||||
|
||||
/* Not an audio frame */
|
||||
if (mad_header_decode(&p->frame.header, &p->stream) == -1)
|
||||
{
|
||||
if (p->stream.error == MAD_ERROR_BUFLEN)
|
||||
break; /* Normal behaviour; get some more data from the file */
|
||||
if (!MAD_RECOVERABLE(p->stream.error))
|
||||
{
|
||||
Con_DPrintf("unrecoverable MAD error\n");
|
||||
break;
|
||||
}
|
||||
if (p->stream.error == MAD_ERROR_LOSTSYNC)
|
||||
{
|
||||
size_t available = (p->stream.bufend - p->stream.this_frame);
|
||||
tagsize = mp3_tagsize(p->stream.this_frame, (size_t) available);
|
||||
if (tagsize)
|
||||
{ /* It's some ID3 tags, so just skip */
|
||||
if (tagsize >= available)
|
||||
{
|
||||
FS_fseek(&stream->fh,
|
||||
(ptrdiff_t)tagsize - (ptrdiff_t)available,
|
||||
SEEK_CUR);
|
||||
depadded = false;
|
||||
}
|
||||
mad_stream_skip(&p->stream, q_min(tagsize, available));
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_DPrintf("MAD lost sync\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_DPrintf("recoverable MAD error\n");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
consumed += p->stream.next_frame - p->stream.this_frame;
|
||||
vbr |= (p->frame.header.bitrate != initial_bitrate);
|
||||
|
||||
samples = 32 * MAD_NSBSAMPLES(&p->frame.header);
|
||||
|
||||
p->frame_count++;
|
||||
mad_timer_add(&p->timer, p->frame.header.duration);
|
||||
|
||||
mad_frame_decode(&p->frame,&p->stream);
|
||||
mad_synth_frame(&p->synth, &p->frame);
|
||||
p->cursamp = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
snd_codec_t mp3_codec =
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
/* Private data */
|
||||
typedef struct _mp3_priv_t
|
||||
{
|
||||
int handle_newed, handle_opened;
|
||||
int32_t handle_newed, handle_opened;
|
||||
mpg123_handle* handle;
|
||||
} mp3_priv_t;
|
||||
|
||||
|
@ -53,7 +53,7 @@ static ssize_t mp3_read (void *f, void *buf, size_t size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static off_t mp3_seek (void *f, off_t offset, int whence)
|
||||
static off_t mp3_seek (void *f, off_t offset, int32_t whence)
|
||||
{
|
||||
if (f == NULL) return (-1);
|
||||
if (FS_fseek((fshandle_t *)f, (long) offset, whence) < 0)
|
||||
|
@ -61,7 +61,7 @@ static off_t mp3_seek (void *f, off_t offset, int whence)
|
|||
return (off_t) FS_ftell((fshandle_t *)f);
|
||||
}
|
||||
|
||||
static qboolean S_MP3_CodecInitialize (void)
|
||||
static bool S_MP3_CodecInitialize (void)
|
||||
{
|
||||
if (!mp3_codec.initialized)
|
||||
{
|
||||
|
@ -86,10 +86,10 @@ static void S_MP3_CodecShutdown (void)
|
|||
}
|
||||
}
|
||||
|
||||
static qboolean S_MP3_CodecOpenStream (snd_stream_t *stream)
|
||||
static bool S_MP3_CodecOpenStream (snd_stream_t *stream)
|
||||
{
|
||||
long rate = 0;
|
||||
int encoding = 0, channels = 0;
|
||||
int32_t encoding = 0, channels = 0;
|
||||
mp3_priv_t *priv = NULL;
|
||||
|
||||
stream->priv = Z_Malloc(sizeof(mp3_priv_t));
|
||||
|
@ -125,7 +125,7 @@ static qboolean S_MP3_CodecOpenStream (snd_stream_t *stream)
|
|||
stream->info.channels = 2;
|
||||
break;
|
||||
default:
|
||||
Con_Printf("Unsupported number of channels %d in %s\n", channels, stream->name);
|
||||
Con_Printf("Unsupported number of channels %" PRIi32 " in %s\n", channels, stream->name);
|
||||
goto _fail;
|
||||
}
|
||||
|
||||
|
@ -176,17 +176,17 @@ _fail:
|
|||
return false;
|
||||
}
|
||||
|
||||
static int S_MP3_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
|
||||
static int32_t S_MP3_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer)
|
||||
{
|
||||
mp3_priv_t *priv = (mp3_priv_t *) stream->priv;
|
||||
size_t bytes_read = 0;
|
||||
int res = mpg123_read (priv->handle, (uint8_t *)buffer, (size_t)bytes, &bytes_read);
|
||||
int32_t res = mpg123_read (priv->handle, (uint8_t *)buffer, (size_t)bytes, &bytes_read);
|
||||
switch (res)
|
||||
{
|
||||
case MPG123_DONE:
|
||||
Con_DPrintf("mp3 EOF\n");
|
||||
case MPG123_OK:
|
||||
return (int)bytes_read;
|
||||
return (int32_t)bytes_read;
|
||||
}
|
||||
return -1; /* error */
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ static void S_MP3_CodecCloseStream (snd_stream_t *stream)
|
|||
S_CodecUtilClose(&stream);
|
||||
}
|
||||
|
||||
static int S_MP3_CodecRewindStream (snd_stream_t *stream)
|
||||
static int32_t S_MP3_CodecRewindStream (snd_stream_t *stream)
|
||||
{
|
||||
mp3_priv_t *priv = (mp3_priv_t *) stream->priv;
|
||||
off_t res = mpg123_seek(priv->handle, 0, SEEK_SET);
|
||||
|
|
|
@ -34,15 +34,15 @@
|
|||
|
||||
/* CALLBACK FUNCTIONS: */
|
||||
|
||||
static int opc_fclose (void *f)
|
||||
static int32_t opc_fclose (void *f)
|
||||
{
|
||||
(void)f;
|
||||
return 0; /* we fclose() elsewhere. */
|
||||
}
|
||||
|
||||
static int opc_fread (void *f, uint8_t *buf, int size)
|
||||
static int32_t opc_fread (void *f, uint8_t *buf, int32_t size)
|
||||
{
|
||||
int ret;
|
||||
int32_t ret;
|
||||
|
||||
if (size < 0)
|
||||
{
|
||||
|
@ -50,13 +50,13 @@ static int opc_fread (void *f, uint8_t *buf, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
ret = (int) FS_fread(buf, 1, (size_t)size, (fshandle_t *)f);
|
||||
ret = (int32_t) FS_fread(buf, 1, (size_t)size, (fshandle_t *)f);
|
||||
if (ret == 0 && errno != 0)
|
||||
ret = -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int opc_fseek (void *f, opus_int64 off, int whence)
|
||||
static int32_t opc_fseek (void *f, opus_int64 off, int32_t whence)
|
||||
{
|
||||
if (f == NULL) return (-1);
|
||||
return FS_fseek((fshandle_t *)f, (long) off, whence);
|
||||
|
@ -69,13 +69,13 @@ static opus_int64 opc_ftell (void *f)
|
|||
|
||||
static const OpusFileCallbacks opc_qfs =
|
||||
{
|
||||
(int (*)(void *, uint8_t *, int)) opc_fread,
|
||||
(int (*)(void *, opus_int64, int)) opc_fseek,
|
||||
(int32_t (*)(void *, uint8_t *, int32_t)) opc_fread,
|
||||
(int32_t (*)(void *, opus_int64, int32_t)) opc_fseek,
|
||||
(opus_int64 (*)(void *)) opc_ftell,
|
||||
(int (*)(void *)) opc_fclose
|
||||
(int32_t (*)(void *)) opc_fclose
|
||||
};
|
||||
|
||||
static qboolean S_OPUS_CodecInitialize (void)
|
||||
static bool S_OPUS_CodecInitialize (void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -84,17 +84,17 @@ static void S_OPUS_CodecShutdown (void)
|
|||
{
|
||||
}
|
||||
|
||||
static qboolean S_OPUS_CodecOpenStream (snd_stream_t *stream)
|
||||
static bool S_OPUS_CodecOpenStream (snd_stream_t *stream)
|
||||
{
|
||||
OggOpusFile *opFile;
|
||||
const OpusHead *op_info;
|
||||
long numstreams;
|
||||
int res;
|
||||
int32_t res;
|
||||
|
||||
opFile = op_open_callbacks(&stream->fh, &opc_qfs, NULL, 0, &res);
|
||||
if (!opFile)
|
||||
{
|
||||
Con_Printf("%s is not a valid Opus file (error %i).\n",
|
||||
Con_Printf("%s is not a valid Opus file (error %" PRIi32 ").\n",
|
||||
stream->name, res);
|
||||
goto _fail;
|
||||
}
|
||||
|
@ -118,14 +118,14 @@ static qboolean S_OPUS_CodecOpenStream (snd_stream_t *stream)
|
|||
numstreams = op_info->stream_count;
|
||||
if (numstreams != 1)
|
||||
{
|
||||
Con_Printf("More than one (%ld) stream in %s\n",
|
||||
Con_Printf("More than one (%" PRIi64 ") stream in %s\n",
|
||||
(long)op_info->stream_count, stream->name);
|
||||
goto _fail;
|
||||
}
|
||||
|
||||
if (op_info->channel_count != 1 && op_info->channel_count != 2)
|
||||
{
|
||||
Con_Printf("Unsupported number of channels %d in %s\n",
|
||||
Con_Printf("Unsupported number of channels %" PRIi32 " in %s\n",
|
||||
op_info->channel_count, stream->name);
|
||||
goto _fail;
|
||||
}
|
||||
|
@ -147,10 +147,10 @@ _fail:
|
|||
return false;
|
||||
}
|
||||
|
||||
static int S_OPUS_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
|
||||
static int32_t S_OPUS_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer)
|
||||
{
|
||||
int section; /* FIXME: handle section changes */
|
||||
int cnt, res, rem;
|
||||
int32_t section; /* FIXME: handle section changes */
|
||||
int32_t cnt, res, rem;
|
||||
opus_int16 * ptr;
|
||||
|
||||
rem = bytes / stream->info.width;
|
||||
|
@ -188,7 +188,7 @@ static void S_OPUS_CodecCloseStream (snd_stream_t *stream)
|
|||
S_CodecUtilClose(&stream);
|
||||
}
|
||||
|
||||
static int S_OPUS_CodecRewindStream (snd_stream_t *stream)
|
||||
static int32_t S_OPUS_CodecRewindStream (snd_stream_t *stream)
|
||||
{
|
||||
return op_pcm_seek ((OggOpusFile *)stream->priv, 0);
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@
|
|||
|
||||
#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;
|
||||
int len1, len2;
|
||||
int32_t pos, tobufend;
|
||||
int32_t len1, len2;
|
||||
|
||||
(void)unused;
|
||||
|
||||
|
@ -72,10 +72,10 @@ static void SDLCALL paint_audio (void *unused, Uint8 *stream, int len)
|
|||
shm->samplepos = 0;
|
||||
}
|
||||
|
||||
qboolean SNDDMA_Init (dma_t *dma)
|
||||
bool SNDDMA_Init (dma_t *dma)
|
||||
{
|
||||
SDL_AudioSpec desired, obtained;
|
||||
int tmp, val;
|
||||
int32_t tmp, val;
|
||||
char drivername[128];
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
|
||||
|
@ -118,7 +118,7 @@ qboolean SNDDMA_Init (dma_t *dma)
|
|||
/* Supported */
|
||||
break;
|
||||
default:
|
||||
Con_Printf ("Unsupported audio format received (%u)\n", obtained.format);
|
||||
Con_Printf ("Unsupported audio format received (%" PRIu32 ")\n", obtained.format);
|
||||
SDL_CloseAudio();
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
return false;
|
||||
|
@ -131,7 +131,7 @@ qboolean SNDDMA_Init (dma_t *dma)
|
|||
shm->samplebits = (obtained.format & 0xFF); /* first byte of format is bits */
|
||||
shm->signed8 = (obtained.format == AUDIO_S8);
|
||||
if (obtained.freq != tmp)
|
||||
Con_Printf ("Warning: Rate set (%d) didn't match requested rate (%d)!\n", obtained.freq, tmp);
|
||||
Con_Printf ("Warning: Rate set (%" PRIi32 ") didn't match requested rate (%" PRIi32 ")!\n", obtained.freq, tmp);
|
||||
shm->speed = obtained.freq;
|
||||
shm->channels = obtained.channels;
|
||||
tmp = (obtained.samples * obtained.channels) * 10;
|
||||
|
@ -147,7 +147,7 @@ qboolean SNDDMA_Init (dma_t *dma)
|
|||
shm->samplepos = 0;
|
||||
shm->submission_chunk = 1;
|
||||
|
||||
Con_Printf ("SDL audio spec : %d Hz, %d samples, %d channels\n",
|
||||
Con_Printf ("SDL audio spec : %" PRIi32 " Hz, %" PRIi32 " samples, %" PRIi32 " channels\n",
|
||||
obtained.freq, obtained.samples, obtained.channels);
|
||||
{
|
||||
const char *driver = SDL_GetCurrentAudioDriver();
|
||||
|
@ -157,7 +157,7 @@ qboolean SNDDMA_Init (dma_t *dma)
|
|||
device != NULL ? device : "(UNKNOWN)");
|
||||
}
|
||||
buffersize = shm->samples * (shm->samplebits / 8);
|
||||
Con_Printf ("SDL audio driver: %s, %d bytes buffer\n", drivername, buffersize);
|
||||
Con_Printf ("SDL audio driver: %s, %" PRIi32 " bytes buffer\n", drivername, buffersize);
|
||||
|
||||
shm->buffer = (uint8_t *) calloc (1, buffersize);
|
||||
if (!shm->buffer)
|
||||
|
@ -174,7 +174,7 @@ qboolean SNDDMA_Init (dma_t *dma)
|
|||
return true;
|
||||
}
|
||||
|
||||
int SNDDMA_GetDMAPos (void)
|
||||
int32_t SNDDMA_GetDMAPos (void)
|
||||
{
|
||||
return shm->samplepos;
|
||||
}
|
||||
|
|
|
@ -85,10 +85,10 @@ static const char *mustype[] = {
|
|||
* also see Unreal Wiki:
|
||||
* http://wiki.beyondunreal.com/Legacy:Package_File_Format/Data_Details
|
||||
*/
|
||||
static fci_t get_fci (const char *in, int *pos)
|
||||
static fci_t get_fci (const char *in, int32_t *pos)
|
||||
{
|
||||
int32_t a;
|
||||
int size;
|
||||
int32_t size;
|
||||
|
||||
size = 1;
|
||||
a = in[0] & 0x3f;
|
||||
|
@ -121,7 +121,7 @@ static fci_t get_fci (const char *in, int *pos)
|
|||
return a;
|
||||
}
|
||||
|
||||
static int get_objtype (fshandle_t *f, int32_t ofs, int type)
|
||||
static int32_t get_objtype (fshandle_t *f, int32_t ofs, int32_t type)
|
||||
{
|
||||
char sig[16];
|
||||
_retry:
|
||||
|
@ -177,11 +177,11 @@ _retry:
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int read_export (fshandle_t *f, const struct upkg_hdr *hdr,
|
||||
static int32_t read_export (fshandle_t *f, const struct upkg_hdr *hdr,
|
||||
int32_t *ofs, int32_t *objsize)
|
||||
{
|
||||
char buf[40];
|
||||
int idx = 0, t;
|
||||
int32_t idx = 0, t;
|
||||
|
||||
FS_fseek(f, *ofs, SEEK_SET);
|
||||
if (FS_fread(buf, 4, 10, f) < 10)
|
||||
|
@ -198,10 +198,10 @@ static int read_export (fshandle_t *f, const struct upkg_hdr *hdr,
|
|||
return t; /* return type_name index */
|
||||
}
|
||||
|
||||
static int read_typname(fshandle_t *f, const struct upkg_hdr *hdr,
|
||||
int idx, char *out)
|
||||
static int32_t read_typname(fshandle_t *f, const struct upkg_hdr *hdr,
|
||||
int32_t idx, char *out)
|
||||
{
|
||||
int i, s;
|
||||
int32_t i, s;
|
||||
long l;
|
||||
char buf[64];
|
||||
|
||||
|
@ -224,10 +224,10 @@ static int read_typname(fshandle_t *f, const struct upkg_hdr *hdr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int probe_umx (fshandle_t *f, const struct upkg_hdr *hdr,
|
||||
static int32_t probe_umx (fshandle_t *f, const struct upkg_hdr *hdr,
|
||||
int32_t *ofs, int32_t *objsize)
|
||||
{
|
||||
int i, idx, t;
|
||||
int32_t i, idx, t;
|
||||
int32_t s, pos;
|
||||
long fsiz;
|
||||
char buf[64];
|
||||
|
@ -278,7 +278,7 @@ static int32_t probe_header (void *header)
|
|||
struct upkg_hdr *hdr;
|
||||
uint8_t *p;
|
||||
uint32_t *swp;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
/* byte swap the header - all members are 32 bit LE values */
|
||||
p = (uint8_t *) header;
|
||||
|
@ -318,11 +318,11 @@ static int32_t probe_header (void *header)
|
|||
return 0;
|
||||
}
|
||||
|
||||
Con_DPrintf("Unknown upkg version %d\n", hdr->file_version);
|
||||
Con_DPrintf("Unknown upkg version %" PRIi32 "\n", hdr->file_version);
|
||||
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];
|
||||
|
||||
|
@ -334,7 +334,7 @@ static int process_upkg (fshandle_t *f, int32_t *ofs, int32_t *objsize)
|
|||
return probe_umx(f, (struct upkg_hdr *)header, ofs, objsize);
|
||||
}
|
||||
|
||||
static qboolean S_UMX_CodecInitialize (void)
|
||||
static bool S_UMX_CodecInitialize (void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -343,9 +343,9 @@ static void S_UMX_CodecShutdown (void)
|
|||
{
|
||||
}
|
||||
|
||||
static qboolean 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;
|
||||
|
||||
type = process_upkg(&stream->fh, &ofs, &size);
|
||||
|
@ -354,7 +354,7 @@ static qboolean S_UMX_CodecOpenStream (snd_stream_t *stream)
|
|||
return false;
|
||||
}
|
||||
|
||||
Con_DPrintf("%s: %s data @ 0x%x, %d bytes\n", stream->name, mustype[type], ofs, size);
|
||||
Con_DPrintf("%s: %s data @ 0x%x, %" PRIi32 " bytes\n", stream->name, mustype[type], ofs, size);
|
||||
/* hack the fshandle_t start pos and length members so
|
||||
* that only the relevant data is accessed from now on */
|
||||
stream->fh.start += ofs;
|
||||
|
@ -373,7 +373,7 @@ static qboolean S_UMX_CodecOpenStream (snd_stream_t *stream)
|
|||
return false;
|
||||
}
|
||||
|
||||
static int S_UMX_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
|
||||
static int32_t S_UMX_CodecReadStream (snd_stream_t *stream, int32_t bytes, void *buffer)
|
||||
{
|
||||
(void)stream, (void)bytes, (void)buffer;
|
||||
return -1;
|
||||
|
@ -384,7 +384,7 @@ static void S_UMX_CodecCloseStream (snd_stream_t *stream)
|
|||
S_CodecUtilClose(&stream);
|
||||
}
|
||||
|
||||
static int S_UMX_CodecRewindStream (snd_stream_t *stream)
|
||||
static int32_t S_UMX_CodecRewindStream (snd_stream_t *stream)
|
||||
{
|
||||
(void)stream;
|
||||
return -1;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue