Various strict warnings cleanup, bug #50; from Scott A. Colcord
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3688 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -307,7 +307,7 @@ void TFB_GL_UploadTransitionScreen (void)
|
|||||||
GL_Screens[TFB_SCREEN_TRANSITION].dirty = TRUE;
|
GL_Screens[TFB_SCREEN_TRANSITION].dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
TFB_GL_ScanLines (void)
|
TFB_GL_ScanLines (void)
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ int zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int smooth)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static
|
||||||
int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst)
|
int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst)
|
||||||
{
|
{
|
||||||
Uint32 sx, sy, *sax, *say, *csax, *csay, csx, csy;
|
Uint32 sx, sy, *sax, *say, *csax, *csay, csx, csy;
|
||||||
@@ -342,6 +343,7 @@ int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static
|
||||||
void transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int smooth)
|
void transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int smooth)
|
||||||
{
|
{
|
||||||
int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
|
int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
|
||||||
@@ -497,6 +499,7 @@ void transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy,
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static
|
||||||
void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos)
|
void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos)
|
||||||
{
|
{
|
||||||
int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh;
|
int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh;
|
||||||
@@ -557,6 +560,7 @@ void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int
|
|||||||
|
|
||||||
/* Local rotozoom-size function with trig result return */
|
/* Local rotozoom-size function with trig result return */
|
||||||
|
|
||||||
|
static
|
||||||
void rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoom, int *dstwidth, int *dstheight,
|
void rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoom, int *dstwidth, int *dstheight,
|
||||||
double *canglezoom, double *sanglezoom)
|
double *canglezoom, double *sanglezoom)
|
||||||
{
|
{
|
||||||
@@ -578,8 +582,8 @@ void rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoom, i
|
|||||||
cy = *canglezoom * y;
|
cy = *canglezoom * y;
|
||||||
sx = *sanglezoom * x;
|
sx = *sanglezoom * x;
|
||||||
sy = *sanglezoom * y;
|
sy = *sanglezoom * y;
|
||||||
dstwidthhalf = MAX((int) ceil(fabs(cx) + fabs(sy)), 1);
|
dstwidthhalf = MAX(ceil(fabs(cx) + fabs(sy)), 1);
|
||||||
dstheighthalf = MAX((int) ceil(fabs(sx) + fabs(cy)), 1);
|
dstheighthalf = MAX(ceil(fabs(sx) + fabs(cy)), 1);
|
||||||
*dstwidth = 2 * dstwidthhalf;
|
*dstwidth = 2 * dstwidthhalf;
|
||||||
*dstheight = 2 * dstheighthalf;
|
*dstheight = 2 * dstheighthalf;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ GetLastCharacter (void)
|
|||||||
|
|
||||||
volatile int MouseButtonDown = 0;
|
volatile int MouseButtonDown = 0;
|
||||||
|
|
||||||
void
|
static void
|
||||||
ProcessMouseEvent (const SDL_Event *e)
|
ProcessMouseEvent (const SDL_Event *e)
|
||||||
{
|
{
|
||||||
switch (e->type)
|
switch (e->type)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
* tragedy. */
|
* tragedy. */
|
||||||
|
|
||||||
typedef struct vcontrol_keyname {
|
typedef struct vcontrol_keyname {
|
||||||
/* const */ char *name;
|
const char *name;
|
||||||
int code;
|
int code;
|
||||||
} keyname;
|
} keyname;
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ static keyname keynames[] = {
|
|||||||
{"Unknown", 0}};
|
{"Unknown", 0}};
|
||||||
/* Last element must have code zero */
|
/* Last element must have code zero */
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
VControl_code2name (int code)
|
VControl_code2name (int code)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -198,12 +198,12 @@ VControl_code2name (int code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
VControl_name2code (char *name)
|
VControl_name2code (const char *name)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
char *test = keynames[i].name;
|
const char *test = keynames[i].name;
|
||||||
int code = keynames[i].code;
|
int code = keynames[i].code;
|
||||||
if (!strcasecmp(test, name) || !code)
|
if (!strcasecmp(test, name) || !code)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,6 +17,6 @@
|
|||||||
#ifndef _KEYNAMES_H_
|
#ifndef _KEYNAMES_H_
|
||||||
#define _KEYNAMES_H_
|
#define _KEYNAMES_H_
|
||||||
|
|
||||||
char *VControl_code2name (int code);
|
const char *VControl_code2name (int code);
|
||||||
int VControl_name2code (char *code);
|
int VControl_name2code (const char *code);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -184,8 +184,10 @@ static void
|
|||||||
key_init (void)
|
key_init (void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
int num_keys; // Temp to match type of param for SDL_GetKeyState().
|
||||||
pool = allocate_key_chunk ();
|
pool = allocate_key_chunk ();
|
||||||
(void)SDL_GetKeyState (&num_sdl_keys);
|
(void)SDL_GetKeyState (&num_keys);
|
||||||
|
num_sdl_keys = num_keys;
|
||||||
bindings = (keybinding **) HMalloc (sizeof (keybinding *) * num_sdl_keys);
|
bindings = (keybinding **) HMalloc (sizeof (keybinding *) * num_sdl_keys);
|
||||||
for (i = 0; i < num_sdl_keys; i++)
|
for (i = 0; i < num_sdl_keys; i++)
|
||||||
bindings[i] = NULL;
|
bindings[i] = NULL;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ typedef struct
|
|||||||
|
|
||||||
static const TFB_DecoderFormats* duka_formats = NULL;
|
static const TFB_DecoderFormats* duka_formats = NULL;
|
||||||
|
|
||||||
sint32
|
static sint32
|
||||||
duka_readAudFrameHeader (TFB_DuckSoundDecoder* duka, uint32 iframe,
|
duka_readAudFrameHeader (TFB_DuckSoundDecoder* duka, uint32 iframe,
|
||||||
DukAud_AudSubframe* aud)
|
DukAud_AudSubframe* aud)
|
||||||
{
|
{
|
||||||
@@ -246,7 +246,7 @@ decode_nibbles (sint16 *output, sint32 output_size, sint32 channels,
|
|||||||
}
|
}
|
||||||
// *** END part copied from MPlayer ***
|
// *** END part copied from MPlayer ***
|
||||||
|
|
||||||
sint32
|
static sint32
|
||||||
duka_decodeFrame (TFB_DuckSoundDecoder* duka, DukAud_AudSubframe* header,
|
duka_decodeFrame (TFB_DuckSoundDecoder* duka, DukAud_AudSubframe* header,
|
||||||
uint8* input)
|
uint8* input)
|
||||||
{
|
{
|
||||||
@@ -273,7 +273,7 @@ duka_decodeFrame (TFB_DuckSoundDecoder* duka, DukAud_AudSubframe* header,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sint32
|
static sint32
|
||||||
duka_readNextFrame (TFB_DuckSoundDecoder* duka)
|
duka_readNextFrame (TFB_DuckSoundDecoder* duka)
|
||||||
{
|
{
|
||||||
DukAud_FrameHeader hdr;
|
DukAud_FrameHeader hdr;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ static void* buffer;
|
|||||||
static ULONG bufsize;
|
static ULONG bufsize;
|
||||||
static ULONG written;
|
static ULONG written;
|
||||||
|
|
||||||
ULONG*
|
static ULONG*
|
||||||
moda_mmout_SetOutputBuffer (void* buf, ULONG size)
|
moda_mmout_SetOutputBuffer (void* buf, ULONG size)
|
||||||
{
|
{
|
||||||
buffer = buf;
|
buffer = buf;
|
||||||
@@ -132,12 +132,18 @@ moda_mmout_Reset (void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char MDRIVER_name[] = "Mem Buffer";
|
||||||
|
static char MDRIVER_version[] = "Mem Buffer driver v1.1";
|
||||||
|
static char MDRIVER_alias[] = "membuf";
|
||||||
|
|
||||||
static MDRIVER moda_mmout_drv =
|
static MDRIVER moda_mmout_drv =
|
||||||
{ NULL,
|
{
|
||||||
"Mem Buffer", // Name
|
NULL,
|
||||||
"Mem Buffer driver v1.1", // Version
|
//xxx libmikmod does not declare these fields const; it probably should.
|
||||||
|
MDRIVER_name, // Name
|
||||||
|
MDRIVER_version, // Version
|
||||||
0, 255, // Voice limits
|
0, 255, // Voice limits
|
||||||
"membuf", // Alias
|
MDRIVER_alias, // Alias
|
||||||
|
|
||||||
// The minimum mikmod version we support is 3.1.8
|
// The minimum mikmod version we support is 3.1.8
|
||||||
#if (LIBMIKMOD_VERSION_MAJOR > 3) || \
|
#if (LIBMIKMOD_VERSION_MAJOR > 3) || \
|
||||||
@@ -215,7 +221,7 @@ moda_uioReader_Tell (MREADER* reader)
|
|||||||
return uio_ftell (((MUIOREADER*)reader)->file);
|
return uio_ftell (((MUIOREADER*)reader)->file);
|
||||||
}
|
}
|
||||||
|
|
||||||
MREADER*
|
static MREADER*
|
||||||
moda_new_uioReader (uio_Stream* fp)
|
moda_new_uioReader (uio_Stream* fp)
|
||||||
{
|
{
|
||||||
MUIOREADER* reader = (MUIOREADER*) HMalloc (sizeof(MUIOREADER));
|
MUIOREADER* reader = (MUIOREADER*) HMalloc (sizeof(MUIOREADER));
|
||||||
@@ -231,7 +237,7 @@ moda_new_uioReader (uio_Stream* fp)
|
|||||||
return (MREADER*)reader;
|
return (MREADER*)reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
moda_delete_uioReader (MREADER* reader)
|
moda_delete_uioReader (MREADER* reader)
|
||||||
{
|
{
|
||||||
if (reader)
|
if (reader)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ struct tfb_soundsample
|
|||||||
uint32 num_buffers;
|
uint32 num_buffers;
|
||||||
TFB_SoundTag *buffer_tag;
|
TFB_SoundTag *buffer_tag;
|
||||||
sint32 offset; // initial offset
|
sint32 offset; // initial offset
|
||||||
intptr_t data; // user-defined data
|
void* data; // user-defined data
|
||||||
TFB_SoundCallbacks callbacks; // user-defined callbacks
|
TFB_SoundCallbacks callbacks; // user-defined callbacks
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ void SetSpeechVolume (float volume);
|
|||||||
TFB_SoundSample *TFB_CreateSoundSample (TFB_SoundDecoder*, uint32 num_buffers,
|
TFB_SoundSample *TFB_CreateSoundSample (TFB_SoundDecoder*, uint32 num_buffers,
|
||||||
const TFB_SoundCallbacks* /* can be NULL */);
|
const TFB_SoundCallbacks* /* can be NULL */);
|
||||||
void TFB_DestroySoundSample (TFB_SoundSample*);
|
void TFB_DestroySoundSample (TFB_SoundSample*);
|
||||||
void TFB_SetSoundSampleData (TFB_SoundSample*, intptr_t data);
|
void TFB_SetSoundSampleData (TFB_SoundSample*, void* data);
|
||||||
intptr_t TFB_GetSoundSampleData (TFB_SoundSample*);
|
void* TFB_GetSoundSampleData (TFB_SoundSample*);
|
||||||
void TFB_SetSoundSampleCallbacks (TFB_SoundSample*,
|
void TFB_SetSoundSampleCallbacks (TFB_SoundSample*,
|
||||||
const TFB_SoundCallbacks* /* can be NULL */);
|
const TFB_SoundCallbacks* /* can be NULL */);
|
||||||
TFB_SoundDecoder* TFB_GetSoundSampleDecoder (TFB_SoundSample*);
|
TFB_SoundDecoder* TFB_GetSoundSampleDecoder (TFB_SoundSample*);
|
||||||
|
|||||||
@@ -225,12 +225,12 @@ TFB_DestroySoundSample (TFB_SoundSample *sample)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_SetSoundSampleData (TFB_SoundSample *sample, intptr_t data)
|
TFB_SetSoundSampleData (TFB_SoundSample *sample, void* data)
|
||||||
{
|
{
|
||||||
sample->data = data;
|
sample->data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t
|
void*
|
||||||
TFB_GetSoundSampleData (TFB_SoundSample *sample)
|
TFB_GetSoundSampleData (TFB_SoundSample *sample)
|
||||||
{
|
{
|
||||||
return sample->data;
|
return sample->data;
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ TFB_PlayVideo (VIDEO_REF vid, uint32 x, uint32 y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TFB_SetSoundSampleCallbacks (*vid->hAudio, &vp_AudioCBs);
|
TFB_SetSoundSampleCallbacks (*vid->hAudio, &vp_AudioCBs);
|
||||||
TFB_SetSoundSampleData (*vid->hAudio, (intptr_t)vid);
|
TFB_SetSoundSampleData (*vid->hAudio, vid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the first frame
|
// get the first frame
|
||||||
@@ -432,7 +432,7 @@ vp_SetTimer (TFB_VideoDecoder* decoder, uint32 msecs)
|
|||||||
static bool
|
static bool
|
||||||
vp_AudioStart (TFB_SoundSample* sample)
|
vp_AudioStart (TFB_SoundSample* sample)
|
||||||
{
|
{
|
||||||
TFB_VideoClip* vid = (TFB_VideoClip*) TFB_GetSoundSampleData (sample);
|
TFB_VideoClip* vid = TFB_GetSoundSampleData (sample);
|
||||||
TFB_SoundDecoder *decoder;
|
TFB_SoundDecoder *decoder;
|
||||||
|
|
||||||
assert (sizeof (intptr_t) >= sizeof (vid));
|
assert (sizeof (intptr_t) >= sizeof (vid));
|
||||||
@@ -450,7 +450,7 @@ vp_AudioStart (TFB_SoundSample* sample)
|
|||||||
static void
|
static void
|
||||||
vp_AudioEnd (TFB_SoundSample* sample)
|
vp_AudioEnd (TFB_SoundSample* sample)
|
||||||
{
|
{
|
||||||
TFB_VideoClip* vid = (TFB_VideoClip*) TFB_GetSoundSampleData (sample);
|
TFB_VideoClip* vid = TFB_GetSoundSampleData (sample);
|
||||||
|
|
||||||
assert (vid != NULL);
|
assert (vid != NULL);
|
||||||
|
|
||||||
@@ -462,7 +462,7 @@ vp_AudioEnd (TFB_SoundSample* sample)
|
|||||||
static void
|
static void
|
||||||
vp_BufferTag (TFB_SoundSample* sample, TFB_SoundTag* tag)
|
vp_BufferTag (TFB_SoundSample* sample, TFB_SoundTag* tag)
|
||||||
{
|
{
|
||||||
TFB_VideoClip* vid = (TFB_VideoClip*) TFB_GetSoundSampleData (sample);
|
TFB_VideoClip* vid = TFB_GetSoundSampleData (sample);
|
||||||
uint32 frame = (uint32) tag->data;
|
uint32 frame = (uint32) tag->data;
|
||||||
|
|
||||||
assert (sizeof (tag->data) >= sizeof (frame));
|
assert (sizeof (tag->data) >= sizeof (frame));
|
||||||
|
|||||||
+6
-1
@@ -27,6 +27,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <errno.h>
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/graphics/cmap.h"
|
#include "libs/graphics/cmap.h"
|
||||||
#include "libs/sound/sound.h"
|
#include "libs/sound/sound.h"
|
||||||
@@ -279,7 +280,11 @@ main (int argc, char *argv[])
|
|||||||
if (options.logFile != NULL)
|
if (options.logFile != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
freopen (options.logFile, "w", stderr);
|
if (!freopen (options.logFile, "w", stderr))
|
||||||
|
{
|
||||||
|
printf ("Error %d calling freopen() on stderr\n", errno);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
#ifdef UNBUFFERED_LOGFILE
|
#ifdef UNBUFFERED_LOGFILE
|
||||||
setbuf (stderr, NULL);
|
setbuf (stderr, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+11
-2
@@ -31,6 +31,15 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
// A wrapper function for weapon_collision that discards the return value.
|
||||||
|
// This makes its signature match ElementCollisionFunc.
|
||||||
|
static void
|
||||||
|
weapon_collision_cb (ELEMENT *WeaponElementPtr, POINT *pWPt,
|
||||||
|
ELEMENT *HitElementPtr, POINT *pHPt)
|
||||||
|
{
|
||||||
|
weapon_collision (WeaponElementPtr, pWPt, HitElementPtr, pHPt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HELEMENT
|
HELEMENT
|
||||||
initialize_laser (LASER_BLOCK *pLaserBlock)
|
initialize_laser (LASER_BLOCK *pLaserBlock)
|
||||||
@@ -50,7 +59,7 @@ initialize_laser (LASER_BLOCK *pLaserBlock)
|
|||||||
LaserElementPtr->state_flags = APPEARING | FINITE_LIFE
|
LaserElementPtr->state_flags = APPEARING | FINITE_LIFE
|
||||||
| pLaserBlock->flags;
|
| pLaserBlock->flags;
|
||||||
LaserElementPtr->life_span = LASER_LIFE;
|
LaserElementPtr->life_span = LASER_LIFE;
|
||||||
LaserElementPtr->collision_func = weapon_collision;
|
LaserElementPtr->collision_func = weapon_collision_cb;
|
||||||
LaserElementPtr->blast_offset = 1;
|
LaserElementPtr->blast_offset = 1;
|
||||||
|
|
||||||
LaserElementPtr->current.location.x = pLaserBlock->cx
|
LaserElementPtr->current.location.x = pLaserBlock->cx
|
||||||
@@ -100,7 +109,7 @@ initialize_missile (MISSILE_BLOCK *pMissileBlock)
|
|||||||
SetAbsFrameIndex (pMissileBlock->farray[0],
|
SetAbsFrameIndex (pMissileBlock->farray[0],
|
||||||
pMissileBlock->index);
|
pMissileBlock->index);
|
||||||
MissileElementPtr->preprocess_func = pMissileBlock->preprocess_func;
|
MissileElementPtr->preprocess_func = pMissileBlock->preprocess_func;
|
||||||
MissileElementPtr->collision_func = weapon_collision;
|
MissileElementPtr->collision_func = weapon_collision_cb;
|
||||||
MissileElementPtr->blast_offset = (BYTE)pMissileBlock->blast_offs;
|
MissileElementPtr->blast_offset = (BYTE)pMissileBlock->blast_offs;
|
||||||
|
|
||||||
angle = FACING_TO_ANGLE (pMissileBlock->face);
|
angle = FACING_TO_ANGLE (pMissileBlock->face);
|
||||||
|
|||||||
Reference in New Issue
Block a user