1
0
Fork 0
forked from len0rd/rockbox

SDL: Silence a large number of compile warnings (WIP)

There are some real bugs in here, but we're drowning in warnings.

Change-Id: I7c2c0eafc8426327521bdd8a3ac2d3742ac16864
This commit is contained in:
Solomon Peachy 2020-04-04 20:24:33 -04:00
parent 2ad6c3438e
commit e28d1fe916
44 changed files with 424 additions and 395 deletions

View file

@ -244,7 +244,7 @@ static void init_new_res_vars(int32_t davidoption)
qsetmode = surface->h;
activepage = visualpage = 0;
frameoffset = frameplace = (uint8_t*)surface->pixels;
if (screen != NULL)
@ -259,7 +259,7 @@ static void init_new_res_vars(int32_t davidoption)
{
case 1:i = xdim*ydim; break;
case 2: xdim = 320; ydim = 200; i = xdim*ydim; break;
default: assert(0);
}
j = ydim*4*sizeof(int32_t); /* Leave room for horizlookup&horizlookup2 */
@ -269,13 +269,13 @@ static void init_new_res_vars(int32_t davidoption)
if(horizlookup2)
free(horizlookup2);
horizlookup = (int32_t*)malloc(j);
horizlookup2 = (int32_t*)malloc(j);
j = 0;
//Build lookup table (X screespace -> frambuffer offset.
//Build lookup table (X screespace -> frambuffer offset.
for(i = 0; i <= ydim; i++)
{
ylookup[i] = j;
@ -290,16 +290,16 @@ static void init_new_res_vars(int32_t davidoption)
//Let the Assembly module how many pixels to skip when drawing a column
setBytesPerLine(bytesperline);
setview(0L,0L,xdim-1,ydim-1);
setbrightness(curbrightness, palette);
if (searchx < 0) {
searchx = halfxdimen;
searchy = (ydimen>>1);
}
}
@ -370,17 +370,17 @@ static int sdl_mouse_motion_filter(SDL_Event const *event)
}
else
{
if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
{
mouse_relative_x += event->motion.xrel;
mouse_relative_y += event->motion.yrel;
//printf("sdl_mouse_motion_filter: mrx=%d, mry=%d, mx=%d, my=%d\n",
// mouse_relative_x, mouse_relative_y, event->motion.xrel, event->motion.yrel);
// mouse_relative_* is already reset in
// mouse_relative_* is already reset in
// readmousexy(). It must not be
// reset here because calling this function does not mean
// we always handle the mouse.
// we always handle the mouse.
// FIX_00001: Mouse speed is uneven and slower in windowed mode vs fullscreen mode.
}
else
@ -431,12 +431,12 @@ static __inline int handle_keypad_enter_hack(const SDL_Event *event)
void fullscreen_toggle_and_change_driver(void)
{
// FIX_00002: New Toggle Windowed/FullScreen system now simpler and will
// dynamically change for Windib or Directx driver. Windowed/Fullscreen
// FIX_00002: New Toggle Windowed/FullScreen system now simpler and will
// dynamically change for Windib or Directx driver. Windowed/Fullscreen
// toggle also made available from menu.
// Replace attempt_fullscreen_toggle(SDL_Surface **surface, Uint32 *flags)
int32_t x,y;
x = surface->w;
y = surface->h;
@ -462,8 +462,8 @@ static int sdl_key_filter(const SDL_Event *event)
// FIX_00005: Mouse pointer can be toggled on/off (see mouse menu or use CTRL-M)
// This is usefull to move the duke window when playing in window mode.
if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
{
SDL_WM_GrabInput(SDL_GRAB_OFF);
SDL_ShowCursor(1);
@ -491,9 +491,9 @@ static int sdl_key_filter(const SDL_Event *event)
lastkey=(scancodes[SDLK_LALT]&0xff)+0x80; // Simulating Key up (not extended)
keyhandler();
SDL_SetModState(KMOD_NONE); // SDL doesnt see we are releasing the ALT-ENTER keys
return(0);
}
return(0);
}
if (!handle_keypad_enter_hack(event))
lastkey = scancodes[event->key.keysym.sym];
@ -546,7 +546,7 @@ static int root_sdl_event_filter(const SDL_Event *event)
return(sdl_mouse_button_filter((const SDL_MouseButtonEvent*)event));
case SDL_QUIT:
/* !!! rcg TEMP */
Error(EXIT_SUCCESS, "Exit through SDL\n");
Error(EXIT_SUCCESS, "Exit through SDL\n");
default:
//printf("This event is not handled: %d\n",event->type);
break;
@ -662,7 +662,7 @@ int _joystick_update(void)
int _joystick_axis(int axis)
{
if (joystick == NULL)
{
{
return(0);
}
@ -672,7 +672,7 @@ int _joystick_axis(int axis)
int _joystick_hat(int hat)
{
if (joystick == NULL)
{
{
return(-1);
}
@ -753,28 +753,28 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
//TODO:
//TODO ( "[Todo: handle -netmode <int>]" )
Setup_StableNetworking();
}
}
}
if (SDL_Init(SDL_INIT_VIDEO) == -1){
Error(EXIT_FAILURE, "BUILDSDL: SDL_Init() failed!\nBUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError());
}
}
// Set up the correct renderer
// Becarfull setenv can't reach dll in VC++
// A way to proceed is to integrate the SDL libs
// in the exe instead.
// FIX_00004: SDL.dll and SDL_Mixer.dll are now integrated within the exe
// (this also makes the Windib/Directx driver switching easier with SDL)
// (this also makes the Windib/Directx driver switching easier with SDL)
// This requires to recompile the whole sdl and sdl mixer with the lib
// switch instead of the default dll switch.
putenv("SDL_VIDEO_CENTERED=1");
if (title == NULL)
@ -895,12 +895,12 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
scancodes[SDLK_PAGEDOWN] = 0xE051;
scancodes[SDLK_INSERT] = 0xE052;
scancodes[SDLK_DELETE] = 0xE053;
output_sdl_versions();
output_driver_info();
printf("Video Driver: '%s'.\n", SDL_VideoDriverName(dummyString, 20));
@ -909,11 +909,11 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
// Capture BMP of the current frame
int screencapture(char *filename, uint8_t inverseit)
{
// FIX_00006: better naming system for screenshots + message when pic is taken.
// FIX_00006: better naming system for screenshots + message when pic is taken.
// Use ./screenshots folder. Screenshot code rerwritten. Faster and
// makes smaller files. Doesn't freeze or lag the game anymore.
SDL_SaveBMP(surface, filename);
SDL_SaveBMP(surface, filename);
return 0;
} /* screencapture */
@ -928,7 +928,7 @@ void setvmode(int mode)
} else
printf("setvmode(0x%x) is unsupported in SDL driver.\n", mode);
}
}
int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim)
{
@ -941,13 +941,13 @@ int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim)
colorkey = 0; // index in this image to be transparent
SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey);
SDL_WM_SetIcon(image,NULL);
if (daxdim > MAXXDIM || daydim > MAXYDIM)
{
printf("Resolution %dx%d is too high. Changed to %dx%d\n", daxdim, daydim, MAXXDIM,MAXYDIM);
daxdim = MAXXDIM;
daydim = MAXYDIM;
}
}
getvalidvesamodes();
@ -1052,8 +1052,8 @@ static __inline void add_user_defined_resolution(void)
/* rockbox hack */
add_vesa_mode("rockbox", LCD_WIDTH, LCD_HEIGHT);
add_vesa_mode("rockbox", LCD_HEIGHT, LCD_WIDTH);
if (envr == NULL)
return;
@ -1111,7 +1111,7 @@ static __inline void cull_large_vesa_modes(void)
int32_t max_w;
int32_t max_h;
int i;
get_max_screen_res(&max_w, &max_h);
printf("Setting resolution ceiling to (%dx%d).\n", max_w, max_h);
@ -1139,7 +1139,7 @@ static __inline void cull_duplicate_vesa_modes(void)
}
}
}
}
}
#define swap_macro(tmp, x, y) { tmp = x; x = y; y = tmp; }
@ -1196,7 +1196,7 @@ static __inline void output_vesa_modelist(void)
} /* for */
printf("Final sorted modelist:%s", buffer);
}
}
void getvalidvesamodes(void)
@ -1233,37 +1233,37 @@ void getvalidvesamodes(void)
/* print it out for debugging purposes... */
output_vesa_modelist();
}
}
uint8_t lastPalette[768];
void WriteTranslucToFile(void){
uint8_t buffer[65535*4];
uint8_t tga_header[18];
uint8_t* transPointer = transluc;
uint8_t* bufferPointer = buffer;
int i;
FILE* file;
for (i=0; i < 65535; i++) {
bufferPointer[0] = (lastPalette[(*transPointer)*3+0]) / 63.0 * 255;
bufferPointer[1] = (lastPalette[(*transPointer)*3+1]) / 63.0 * 255;
bufferPointer[2] = (lastPalette[(*transPointer)*3+2]) / 63.0 * 255;
bufferPointer[3] = 255;
printf("%d,",*transPointer);
if (i%255 ==0)
printf("\n");
transPointer +=1;
bufferPointer+=4;
}
file = fopen("/transluc.tga", "w");
memset(tga_header, 0, 18);
tga_header[2] = 2;
tga_header[12] = (256 & 0x00FF);
@ -1271,23 +1271,23 @@ void WriteTranslucToFile(void){
tga_header[14] = (256 & 0x00FF) ;
tga_header[15] =(256 & 0xFF00) / 256;
tga_header[16] = 32 ;
fwrite(&tga_header, 18, sizeof(uint8_t), file);
fwrite(buffer, 65535, 4, file);
fclose(file);
}
void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int height){
uint8_t tga_header[18];
uint8_t* buffer;
uint8_t* palettePointer = palette;
uint8_t* bufferPointer ;
int i;
FILE* file = fopen(filename, "w");
memset(tga_header, 0, 18);
tga_header[2] = 2;
tga_header[12] = (width & 0x00FF);
@ -1295,30 +1295,30 @@ void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int hei
tga_header[14] = (height & 0x00FF) ;
tga_header[15] =(height & 0xFF00) / 256;
tga_header[16] = 32 ;
fwrite(&tga_header, 18, sizeof(uint8_t), file);
bufferPointer = buffer = malloc(width*height*4);
for (i = 0 ; i < width*height ; i++)
{
bufferPointer[0] = palettePointer[0] / 63.0 * 255;
bufferPointer[1] = palettePointer[1] / 63.0 * 255;
bufferPointer[2] = palettePointer[2] / 63.0 * 255;
bufferPointer[3] = 255;
bufferPointer += 4;
palettePointer+= 3;
}
fwrite(buffer, width*height, 4, file);
fclose(file);
free(buffer);
}
void WriteLastPaletteToFile(){
void WriteLastPaletteToFile(void){
WritePaletteToFile(lastPalette,"lastPalette.tga",16,16);
}
@ -1342,18 +1342,18 @@ int VBE_setPalette(uint8_t *palettebuffer)
uint8_t *p = palettebuffer;
int i;
//static updated=0;
//if (updated >=1 )
// return ;
//WritePaletteToFile(palettebuffer,"lastPalette.tga",16,16);
//updated++;
//CODE EXPLORATION
//Used only to write the last palette to file.
memcpy(lastPalette, palettebuffer, 768);
for (i = 0; i < 256; i++){
/* doesn't map perfectly */
sdlp->b = (Uint8) (*p << 2) | (*p >> 4);
@ -1383,10 +1383,10 @@ int VBE_getPalette(int32_t start, int32_t num, uint8_t *palettebuffer)
*p++ = (Uint8) ((((float) sdlp->r) / 255.0) * 63.0);
*p++ = sdlp->unused; /* This byte is unused in both SDL and BUILD. */
sdlp++;
}
}
return(1);
}
}
void _uninitengine(void)
@ -1464,13 +1464,13 @@ void _nextpage(void)
_handle_events();
SDL_UpdateRect(surface, 0, 0, 0, 0);
//sprintf(bmpName,"%d.bmp",counter++);
//SDL_SaveBMP(surface,bmpName);
//if (CLEAR_FRAMEBUFFER)
// SDL_FillRect(surface,NULL,0);
@ -1480,15 +1480,15 @@ void _nextpage(void)
total_rendered_frames = 0;
total_render_time = 1;
last_render_ticks = ticks;
}
}
total_rendered_frames++;
}
}
uint8_t readpixel(uint8_t * offset)
{
return *offset;
}
}
void drawpixel(uint8_t * location, uint8_t pixel)
{
@ -1519,7 +1519,7 @@ void fillscreen16(int32_t offset, int32_t color, int32_t blocksize)
pixels = get_framebuffer();
/* Make this function pageoffset aware - DDOI */
if (!pageoffset) {
if (!pageoffset) {
offset = offset << 3;
offset += 640*336;
}
@ -1584,7 +1584,7 @@ void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint
dx = XEnd-XStart;
dy = YEnd-YStart;
//Analyse the slope
if (dx >= 0)
{
@ -1803,7 +1803,7 @@ void (*installusertimercallback(void (*callback)(void)))(void)
inittimer() -- initialise timer
FCS: The tickspersecond parameter is a ratio value that helps replicating
oldschool DOS tick per seconds.
The way the timer work is:
float newSystemTickPerSecond = [0,1]
tickPerSecond on a DOS system = tickspersecond * newSystemTickPerSecond ;
@ -1812,8 +1812,8 @@ void (*installusertimercallback(void (*callback)(void)))(void)
int inittimer(int tickspersecond)
{
int64_t t;
if (timerfreq) return 0; // already installed
//printf("Initialising timer, with tickPerSecond=%d\n",tickspersecond);
@ -1831,7 +1831,7 @@ int inittimer(int tickspersecond)
timerlastsample = (int32_t)(t*timerticspersec / timerfreq);
usertimercallback = NULL;
return 0;
}
@ -1853,12 +1853,12 @@ void sampletimer(void)
{
int64_t i;
int32_t n;
if (!timerfreq) return;
TIMER_GetPlatformTicks(&i);
n = (int32_t)(i*timerticspersec / timerfreq) - timerlastsample;
if (n>0) {
totalclock += n;
@ -1907,10 +1907,9 @@ int TIMER_GetPlatformTicksInOneSecond(int64_t* t)
*t = 1000;
return 1;
}
void TIMER_GetPlatformTicks(int64_t* t)
{
*t = SDL_GetTicks();
}
/* end of sdl_driver.c ... */

View file

@ -96,7 +96,7 @@ void timerhandler(void);
/* resolution inits. sdl_driver.c ... */
int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim);
uint32_t getticks();
uint32_t getticks(void);
void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint8_t Color);
void setcolor16(uint8_t color);
@ -106,5 +106,3 @@ void setcolor16(uint8_t color);
void initmultiplayers(uint8_t damultioption, uint8_t dacomrateoption, uint8_t dapriority);
#endif

View file

@ -11,8 +11,8 @@
#include "platform.h"
void Setup_UnstableNetworking();
void Setup_StableNetworking();
void Setup_UnstableNetworking(void);
void Setup_StableNetworking(void);
void callcommit(void);
void initcrc(void);

View file

@ -56,8 +56,12 @@
#define IP_RECVERR SO_BROADCAST
*/
#ifndef stricmp
#define stricmp strcasecmp
#endif
#ifndef strcmpi
#define strcmpi strcasecmp
#endif
#define S_IREAD S_IRUSR

View file

@ -17,7 +17,7 @@ static int FB_SRC_A, FB_SRC_B, IIR_DEST_A0, IIR_DEST_A1, ACC_SRC_A0, ACC_SRC_A1,
ACC_SRC_B1, IIR_SRC_A0, IIR_SRC_A1, IIR_DEST_B0, IIR_DEST_B1, ACC_SRC_C0,
ACC_SRC_C1, ACC_SRC_D0, ACC_SRC_D1, IIR_SRC_B1, IIR_SRC_B0, MIX_DEST_A0,
MIX_DEST_A1, MIX_DEST_B0, MIX_DEST_B1;
//static long IIR_ALPHA, ACC_COEF_A, ACC_COEF_B, ACC_COEF_C, ACC_COEF_D, IIR_COEF, FB_ALPHA, FB_X,
// IN_COEF_L, IN_COEF_R;
@ -51,7 +51,7 @@ static inline int cnv_offset(int src)
// extern __stdcall OutputDebugStringA(char *);
static inline void check_buffer()
static inline void check_buffer(void)
{
int new_delay = cnv_offset(MV_ReverbDelay);
@ -99,7 +99,7 @@ static inline long g_buffer(int iOff, long *ptr) // get
}
iOff=(iOff*4)+CurrAddr;
while(iOff>correctDelay-1)
while(iOff>correctDelay-1)
{
iOff=iOff-correctDelay;
}
@ -141,11 +141,11 @@ static inline void s_buffer1(int iOff,long iVal, long *ptr) // se
}
iOff=(iOff*4)+CurrAddr+1;
while(iOff>correctDelay-1)
while(iOff>correctDelay-1)
{
iOff=iOff-correctDelay;
}
while(iOff<0)
while(iOff<0)
{
iOff=correctDelay-(0-iOff);
}
@ -155,12 +155,12 @@ static inline void s_buffer1(int iOff,long iVal, long *ptr) // se
static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long *ptr)
{
long ACC0,ACC1,FB_A0,FB_A1,FB_B0,FB_B1;
const long IIR_INPUT_A0 = (fp_mul(g_buffer(IIR_SRC_A0, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_L, IN_COEF_L, FRACBITS));
const long IIR_INPUT_A1 = (fp_mul(g_buffer(IIR_SRC_A1, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_R, IN_COEF_R, FRACBITS));
const long IIR_INPUT_B0 = (fp_mul(g_buffer(IIR_SRC_B0, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_L, IN_COEF_L, FRACBITS));
const long IIR_INPUT_B1 = (fp_mul(g_buffer(IIR_SRC_B1, ptr), IIR_COEF, FRACBITS) + fp_mul(INPUT_SAMPLE_R, IN_COEF_R, FRACBITS));
const long one = (1 << FRACBITS);
const long IIR_A0 = fp_mul(IIR_INPUT_A0, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A0, ptr), (one - IIR_ALPHA), FRACBITS);
const long IIR_A1 = fp_mul(IIR_INPUT_A1, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A1, ptr), (one - IIR_ALPHA), FRACBITS);
@ -171,7 +171,7 @@ static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long
s_buffer1(IIR_DEST_A1, IIR_A1, ptr);
s_buffer1(IIR_DEST_B0, IIR_B0, ptr);
s_buffer1(IIR_DEST_B1, IIR_B1, ptr);
ACC0 = (fp_mul(g_buffer(ACC_SRC_A0, ptr), ACC_COEF_A, FRACBITS) +
fp_mul(g_buffer(ACC_SRC_B0, ptr), ACC_COEF_B, FRACBITS) +
fp_mul(g_buffer(ACC_SRC_C0, ptr), ACC_COEF_C, FRACBITS) +
@ -180,24 +180,24 @@ static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long
fp_mul(g_buffer(ACC_SRC_B1, ptr), ACC_COEF_B, FRACBITS) +
fp_mul(g_buffer(ACC_SRC_C1, ptr), ACC_COEF_C, FRACBITS) +
fp_mul(g_buffer(ACC_SRC_D1, ptr), ACC_COEF_D, FRACBITS));
FB_A0 = g_buffer(MIX_DEST_A0 - FB_SRC_A, ptr);
FB_A1 = g_buffer(MIX_DEST_A1 - FB_SRC_A, ptr);
FB_B0 = g_buffer(MIX_DEST_B0 - FB_SRC_B, ptr);
FB_B1 = g_buffer(MIX_DEST_B1 - FB_SRC_B, ptr);
s_buffer(MIX_DEST_A0, ACC0 - fp_mul(FB_A0 , FB_ALPHA, FRACBITS), ptr);
s_buffer(MIX_DEST_A1, ACC1 - fp_mul(FB_A1 , FB_ALPHA, FRACBITS), ptr);
s_buffer(MIX_DEST_B0, fp_mul(FB_ALPHA , ACC0, FRACBITS) - fp_mul(FB_A0, (FB_ALPHA - one), FRACBITS) - fp_mul(FB_B0, FB_X, FRACBITS), ptr);
s_buffer(MIX_DEST_B1, fp_mul(FB_ALPHA , ACC1, FRACBITS) - fp_mul(FB_A1, (FB_ALPHA - one), FRACBITS) - fp_mul(FB_B1, FB_X, FRACBITS), ptr);
iRVBLeft = (g_buffer(MIX_DEST_A0, ptr)+g_buffer(MIX_DEST_B0, ptr)) / 3;
iRVBRight = (g_buffer(MIX_DEST_A1, ptr)+g_buffer(MIX_DEST_B1, ptr)) / 3;
CurrAddr++;
if(CurrAddr>delay-1) CurrAddr=0;
return (long)iRVBLeft;
}
@ -228,7 +228,7 @@ void MV_FPReverb(int volume)
// OutputDebugStringA(err);
long scale = (volume << FRACBITS) / MV_MaxVolume;
if (MV_Channels == 1)
{
for (i = 0; i < count; i++)
@ -308,7 +308,7 @@ void MV_16BitReverbFast( const char *src, char *dest, int count, int shift )
short *pdest = (short *)dest;
const short *psrc = (const short *)src;
for (i = 0; i < count; i++) {
pdest[i] = readLE16(psrc + i) >> shift;
}
@ -319,11 +319,11 @@ void MV_8BitReverbFast( const signed char *src, signed char *dest, int count, in
int i;
unsigned char sh = 0x80 - (0x80 >> shift);
for (i = 0; i < count; i++) {
unsigned char a = ((unsigned char) src[i]) >> shift;
unsigned char c = (((unsigned char) src[i]) ^ 0x80) >> 7;
dest[i] = (signed char) (a + sh + c);
}
}

View file

@ -23,8 +23,8 @@ typedef struct console_element
// Private member functions
void CONSOLE_InsertUsedCommand(const char * szUsedCommand);
void CONSOLE_ClearUsedCommandList();
void CONSOLE_RecalculateDirtyBuffer();
void CONSOLE_ClearUsedCommandList(void);
void CONSOLE_RecalculateDirtyBuffer(void);
// console argument tracker
int argc;
@ -50,7 +50,7 @@ int nConsole_Active = 0;
void CVAR_RegisterDefaultCvarBindings(void);
// Initialize the console
void CONSOLE_Init()
void CONSOLE_Init(void)
{
CONSOLE_Reset();
@ -63,7 +63,7 @@ void CONSOLE_Init()
CONSOLE_Printf("Type \'HELP\' for help with console Commands.");
}
void CONSOLE_Reset()
void CONSOLE_Reset(void)
{
CONSOLEELEMENT *pElement;
CONSOLEELEMENT *pDelElement;
@ -144,7 +144,7 @@ void CONSOLE_HandleInput()
{
ud.pause_on = 0;
}
}
}
}
else
// Bug fix: make sure the frag bar displays after console
@ -153,7 +153,7 @@ void CONSOLE_HandleInput()
{
if ( ud.multimode > 1 && ud.coop != 1 )
{
displayfragbar();
displayfragbar();
}
if(numplayers<2)
ud.pause_on = 0;
@ -169,7 +169,7 @@ void CONSOLE_HandleInput()
return;
}
switch(KB_GetLastScanCode())
switch(KB_GetLastScanCode())
{
case sc_Space:
{
@ -221,7 +221,7 @@ void CONSOLE_HandleInput()
case sc_kpad_Enter:
case sc_Enter:
{
//If console_buffer[0] strlen() != 0
//If console_buffer[0] strlen() != 0
//1. Push the dirty_buffer unto the console_buffer
//2. parse the text
rb->kbd_input(dirty_buffer, sizeof(dirty_buffer));
@ -278,7 +278,7 @@ void CONSOLE_HandleInput()
if(p_console_current_view->next != NULL)
{
p_console_current_view = p_console_current_view->next;
}
}
else
{
break;
@ -351,10 +351,10 @@ void CONSOLE_HandleInput()
}
KB_ClearLastScanCode();
KB_ClearLastScanCode();
}
void CONSOLE_Render()
void CONSOLE_Render(void)
{
if(g_CV_classic)
{
@ -371,7 +371,7 @@ void CONSOLE_Render()
int iYOffset = 3; //offset for the console text
CONSOLEELEMENT *pElement;
y1 = 0;
y1 = 0;
y2 = (ydim / 2) - ((ydim / 2)/12);
// Draw console background
@ -418,9 +418,9 @@ void CONSOLE_Render()
minitext(283, iCurHeight, BUILD_NUMBER, 17,10+16);
// Draw the cursor //Change the color every second
minitext(iCurWidth, iCurHeight,"_",(time(NULL)%2)+1,10+16);
minitext(iCurWidth, iCurHeight,"_",(time(NULL)%2)+1,10+16);
}
else
else
if(g_CV_num_console_lines > 0)
{
int i, iYOffset = 3; //offset for the console text
@ -517,7 +517,7 @@ void CONSOLE_InsertUsedCommand(const char * szUsedCommand)
}
}
void CONSOLE_ClearUsedCommandList()
void CONSOLE_ClearUsedCommandList(void)
{
CONSOLEELEMENT *pElement;
CONSOLEELEMENT *pDelElement;
@ -537,7 +537,7 @@ void CONSOLE_ClearUsedCommandList()
}
void CONSOLE_RecalculateDirtyBuffer()
void CONSOLE_RecalculateDirtyBuffer(void)
{
int len;
int l;
@ -605,7 +605,7 @@ void CONSOLE_Printf(const char *newmsg, ...)
}
// Get the current number of args for this keyword
int CONSOLE_GetArgc()
int CONSOLE_GetArgc(void)
{
return argc;
}
@ -617,9 +617,9 @@ char * CONSOLE_GetArgv(unsigned int var)
}
// Is our console showing?
int CONSOLE_IsActive()
int CONSOLE_IsActive(void)
{
return nConsole_Active;
}
@ -627,4 +627,4 @@ int CONSOLE_IsActive()
void CONSOLE_SetActive(int i)
{
nConsole_Active = (i == 0) ? 0 : 1;
}
}

View file

@ -3,17 +3,17 @@
// Public member functions
void CONSOLE_Init();
void CONSOLE_Reset();
void CONSOLE_Term();
void CONSOLE_ParseStartupScript();
void CONSOLE_HandleInput();
void CONSOLE_Render();
void CONSOLE_Init(void);
void CONSOLE_Reset(void);
void CONSOLE_Term(void);
void CONSOLE_ParseStartupScript(void);
void CONSOLE_HandleInput(void);
void CONSOLE_Render(void);
void CONSOLE_ParseCommand(char * command);
void CONSOLE_Printf(const char *newmsg, ...);
int CONSOLE_GetArgc();
int CONSOLE_GetArgc(void);
char * CONSOLE_GetArgv(unsigned int var);
int CONSOLE_IsActive();
void CONSOLE_SetActive(int i);
int CONSOLE_IsActive(void);
void CONSOLE_SetActive(int i);
#endif

View file

@ -3,8 +3,8 @@
#include <inttypes.h>
void CVARDEFS_Init();
void CVARDEFS_Render();
void CVARDEFS_Init(void);
void CVARDEFS_Render(void);
//
// Function declarations
//

View file

@ -18,8 +18,8 @@ typedef struct t_cvar_binding
void CVAR_RegisterCvar(const char * varname, const char * varhelp, void* variable, function_t function);
int CVAR_GetNumCvarBindings();
int CVAR_GetNumCvarBindings(void);
cvar_binding* CVAR_GetCvarBinding(unsigned int nBinding);
void CVAR_Render();
void CVAR_Render(void);
#endif
#endif

View file

@ -31,6 +31,7 @@ void Shutdown(void);
#endif
#ifdef ROCKBOX
#undef BYTE_ORDER
#ifdef ROCKBOX_LITTLE_ENDIAN
#define BYTE_ORDER LITTLE_ENDIAN
#else

View file

@ -67,8 +67,12 @@ typedef float64 appfloat;
//
//***************************************************************************
#ifndef true
#define true ( 1 == 1 )
#endif
#ifndef false
#define false ( ! true )
#endif
//***************************************************************************
//

View file

@ -11,7 +11,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -60,7 +60,7 @@ int16 IntelShort (int16 l);
int32_t Motoint32_t (int32_t l);
int32_t Intelint32_t (int32_t l);
void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)());
//void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)());
#ifdef __cplusplus
};

View file

@ -172,35 +172,36 @@ float CL_KeyState (kbutton_t *key)
{
float val;
qboolean impulsedown, impulseup, down;
impulsedown = key->state & 2;
impulseup = key->state & 4;
down = key->state & 1;
val = 0;
if (impulsedown && !impulseup)
if (impulsedown && !impulseup) {
if (down)
val = 0.5; // pressed and held this frame
else
val = 0; // I_Error ();
if (impulseup && !impulsedown)
} else if (impulseup && !impulsedown) {
if (down)
val = 0; // I_Error ();
else
val = 0; // released this frame
if (!impulsedown && !impulseup)
} else if (!impulsedown && !impulseup) {
if (down)
val = 1.0; // held the entire frame
else
val = 0; // up the entire frame
if (impulsedown && impulseup)
} else if (impulsedown && impulseup) {
if (down)
val = 0.75; // released and re-pressed this frame
else
val = 0.25; // pressed and released this frame
}
key->state &= 1; // clear impulses
return val;
}

View file

@ -182,6 +182,9 @@ extern byte *r_skysource;
#define DR_TRANSPARENT 1
// !!! must be kept the same as in quakeasm.h !!!
#ifdef TRANSPARENT_COLOR
#undef TRANSPARENT_COLOR
#endif
#define TRANSPARENT_COLOR 0xFF
extern void *acolormap; // FIXME: should go away

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -69,11 +69,13 @@ void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
//void VectorNormalizeNoRet (vec3_t v); // uses finvsqrt
//float VectorNormalize (vec3_t v); // returns vector length
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
static inline float InvSqrt( float number ) {
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
@ -84,13 +86,14 @@ static inline float InvSqrt( float number ) {
return y;
}
#pragma GCC diagnostic pop
static inline void VectorNormalizeNoRet (vec3_t v)
{
float length, ilength;
ilength = InvSqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;
@ -110,7 +113,7 @@ static inline float VectorNormalize (vec3_t v)
v[1] *= ilength;
v[2] *= ilength;
}
return length;
}

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -126,7 +126,7 @@ typedef struct qsocket_s
qboolean disconnected;
qboolean canSend;
qboolean sendNext;
int driver;
int landriver;
int socket;
@ -314,7 +314,7 @@ typedef struct _PollProcedure
{
struct _PollProcedure *next;
double nextTime;
void (*procedure)();
void (*procedure)(void *);
void *arg;
} PollProcedure;

View file

@ -250,7 +250,7 @@ void SV_MoveToGoal (void);
void SV_CheckForNewClients (void);
void SV_RunClients (void);
void SV_SaveSpawnparms ();
void SV_SaveSpawnparms (void);
#ifdef QUAKE2
void SV_SpawnServer (char *server, char *startspot);
#else

View file

@ -165,12 +165,12 @@ extern ScanCode IN_WaitForKey(void);
extern word IN_GetJoyButtonsDB(word joy);
extern const char *IN_GetScanName(ScanCode);
void IN_WaitAndProcessEvents();
void IN_ProcessEvents();
void IN_WaitAndProcessEvents(void);
void IN_ProcessEvents(void);
int IN_MouseButtons (void);
boolean IN_JoyPresent();
boolean IN_JoyPresent(void);
void IN_SetJoyCurrent(int joyIndex);
int IN_JoyButtons (void);
void IN_GetJoyDelta(int *dx,int *dy);
@ -178,6 +178,6 @@ void IN_GetJoyFineDelta(int *dx, int *dy);
void IN_StartAck(void);
boolean IN_CheckAck (void);
bool IN_IsInputGrabbed();
void IN_CenterMouse();
bool IN_IsInputGrabbed(void);
void IN_CenterMouse(void);
#endif

View file

@ -17,40 +17,40 @@ extern bool PMSoundInfoPagePadded;
// The last pointer points one byte after the last page.
extern uint8_t **PMPages;
void PM_Startup();
void PM_Shutdown();
void PM_Startup(void);
void PM_Shutdown(void);
static uint32_t PM_GetPageSize(int page)
static inline uint32_t PM_GetPageSize(int page)
{
if(page < 0 || page >= ChunksInFile)
Quit("PM_GetPageSize: Tried to access illegal page: %i", page);
return (uint32_t) (PMPages[page + 1] - PMPages[page]);
}
static uint8_t *PM_GetPage(int page)
static inline uint8_t *PM_GetPage(int page)
{
if(page < 0 || page >= ChunksInFile)
Quit("PM_GetPage: Tried to access illegal page: %i", page);
return PMPages[page];
}
static uint8_t *PM_GetEnd()
static inline uint8_t *PM_GetEnd(void)
{
return PMPages[ChunksInFile];
}
static byte *PM_GetTexture(int wallpic)
static inline byte *PM_GetTexture(int wallpic)
{
return PM_GetPage(wallpic);
}
static uint16_t *PM_GetSprite(int shapenum)
static inline uint16_t *PM_GetSprite(int shapenum)
{
// correct alignment is enforced by PM_Startup()
return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum);
}
static byte *PM_GetSound(int soundpagenum)
static inline byte *PM_GetSound(int soundpagenum)
{
return PM_GetPage(PMSoundStart + soundpagenum);
}

View file

@ -96,6 +96,6 @@ void USL_PrintInCenter(const char *s,Rect r);
char *USL_GiveSaveName(word game);
void US_InitRndT(int randomize);
int US_RndT();
int US_RndT(void);
#endif

View file

@ -64,7 +64,7 @@ void VWB_Vlin (int y1, int y2, int x, int color);
#define VWB_HlinScaledCoord VW_Hlin
#define VWB_VlinScaledCoord VW_Vlin
void VH_UpdateScreen();
void VH_UpdateScreen(void);
#define VW_UpdateScreen VH_UpdateScreen
//
@ -91,7 +91,7 @@ void LatchDrawPic (unsigned x, unsigned y, unsigned picnum);
void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum);
void LoadLatchMem (void);
void VH_Startup();
void VH_Startup(void);
boolean FizzleFade (SDL_Surface *source, int x1, int y1,
unsigned width, unsigned height, unsigned frames, boolean abortable);

View file

@ -961,7 +961,7 @@ void DrawPlayBorder (void);
void DrawStatusBorder (byte color);
void DrawPlayScreen (void);
void DrawPlayBorderSides (void);
void ShowActStatus();
void ShowActStatus(void);
void PlayDemo (int demonumber);
void RecordDemo (void);
@ -1372,7 +1372,7 @@ void GP2X_ButtonUp(int button);
=============================================================================
*/
static fixed FixedMul(fixed a, fixed b)
static inline fixed FixedMul(fixed a, fixed b)
{
return (fixed)(((int64_t)a * b + 0x8000) >> 16);
}
@ -1394,13 +1394,13 @@ static fixed FixedMul(fixed a, fixed b)
#define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__)
static char* itoa(int value, char* string, int radix)
static inline char* itoa(int value, char* string, int radix)
{
sprintf(string, "%d", value);
return string;
}
static char* ltoa(long value, char* string, int radix)
static inline char* ltoa(long value, char* string, int radix)
{
sprintf(string, "%ld", value);
return string;
@ -1409,14 +1409,14 @@ static char* ltoa(long value, char* string, int radix)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define endof(x) ((x) + lengthof(x))
static word READWORD(byte **ptr)
static inline word READWORD(byte **ptr)
{
word val = (*ptr)[0] | (*ptr)[1] << 8;
*ptr += 2;
return val;
}
static longword READLONGWORD(byte **ptr)
static inline longword READLONGWORD(byte **ptr)
{
longword val = (*ptr)[0] | (*ptr)[1] << 8 | (*ptr)[2] << 16 | (*ptr)[3] << 24;
*ptr += 4;
@ -1454,7 +1454,7 @@ static longword READLONGWORD(byte **ptr)
*************************************************************/
// The feature flags are stored as a wall in the upper right corner of each level
static word GetFeatureFlags()
static inline word GetFeatureFlags()
{
return ffDataTopRight;
}

View file

@ -251,7 +251,7 @@ boolean TransformTile (int tx, int ty, short *dispx, short *dispheight)
====================
*/
int CalcHeight()
int CalcHeight(void)
{
fixed z = FixedMul(xintercept - viewx, viewcos)
- FixedMul(yintercept - viewy, viewsin);
@ -275,7 +275,7 @@ byte *postsource;
int postx;
int postwidth;
void ScalePost()
void ScalePost(void)
{
int ywcount, yoffs, yw, yd, yendoffs;
byte col;
@ -1091,7 +1091,7 @@ void CalcTics (void)
//==========================================================================
void AsmRefresh()
void AsmRefresh(void)
{
int32_t xstep,ystep;
longword xpartial,ypartial;
@ -1517,7 +1517,7 @@ void WallRefresh (void)
ScalePost (); // no more optimization on last post
}
void CalcViewVariables()
void CalcViewVariables(void)
{
viewangle = player->angle;
midangle = viewangle*(FINEANGLES/ANGLES);

View file

@ -118,10 +118,10 @@ extern CP_iteminfo MainItems;
void US_ControlPanel(ScanCode);
void EnableEndGameMenuItem();
void EnableEndGameMenuItem(void);
void SetupControlPanel(void);
void SetupSaveGames();
void SetupSaveGames(void);
void CleanupControlPanel(void);
void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items);