summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/sdl/progs')
-rw-r--r--apps/plugins/sdl/progs/duke3d/Engine/src/display.c185
-rw-r--r--apps/plugins/sdl/progs/duke3d/Engine/src/display.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Engine/src/network.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c34
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/console.c40
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/console.h18
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/cvars.h6
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/global.h1
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/types.h4
-rw-r--r--apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h4
-rw-r--r--apps/plugins/sdl/progs/quake/cl_input.c15
-rw-r--r--apps/plugins/sdl/progs/quake/d_iface.h3
-rw-r--r--apps/plugins/sdl/progs/quake/mathlib.h11
-rw-r--r--apps/plugins/sdl/progs/quake/net.h6
-rw-r--r--apps/plugins/sdl/progs/quake/server.h2
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_in.h10
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_pm.h16
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_us.h2
-rw-r--r--apps/plugins/sdl/progs/wolf3d/id_vh.h4
-rw-r--r--apps/plugins/sdl/progs/wolf3d/wl_def.h14
-rw-r--r--apps/plugins/sdl/progs/wolf3d/wl_draw.c8
-rw-r--r--apps/plugins/sdl/progs/wolf3d/wl_menu.h4
24 files changed, 208 insertions, 195 deletions
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/display.c b/apps/plugins/sdl/progs/duke3d/Engine/src/display.c
index c16c8fb25c..5a92c3c9ab 100644
--- a/apps/plugins/sdl/progs/duke3d/Engine/src/display.c
+++ b/apps/plugins/sdl/progs/duke3d/Engine/src/display.c
@@ -244,7 +244,7 @@ static void init_new_res_vars(int32_t davidoption)
244 qsetmode = surface->h; 244 qsetmode = surface->h;
245 activepage = visualpage = 0; 245 activepage = visualpage = 0;
246 246
247 247
248 frameoffset = frameplace = (uint8_t*)surface->pixels; 248 frameoffset = frameplace = (uint8_t*)surface->pixels;
249 249
250 if (screen != NULL) 250 if (screen != NULL)
@@ -259,7 +259,7 @@ static void init_new_res_vars(int32_t davidoption)
259 { 259 {
260 case 1:i = xdim*ydim; break; 260 case 1:i = xdim*ydim; break;
261 case 2: xdim = 320; ydim = 200; i = xdim*ydim; break; 261 case 2: xdim = 320; ydim = 200; i = xdim*ydim; break;
262 262
263 default: assert(0); 263 default: assert(0);
264 } 264 }
265 j = ydim*4*sizeof(int32_t); /* Leave room for horizlookup&horizlookup2 */ 265 j = ydim*4*sizeof(int32_t); /* Leave room for horizlookup&horizlookup2 */
@@ -269,13 +269,13 @@ static void init_new_res_vars(int32_t davidoption)
269 269
270 if(horizlookup2) 270 if(horizlookup2)
271 free(horizlookup2); 271 free(horizlookup2);
272 272
273 horizlookup = (int32_t*)malloc(j); 273 horizlookup = (int32_t*)malloc(j);
274 horizlookup2 = (int32_t*)malloc(j); 274 horizlookup2 = (int32_t*)malloc(j);
275 275
276 j = 0; 276 j = 0;
277 277
278 //Build lookup table (X screespace -> frambuffer offset. 278 //Build lookup table (X screespace -> frambuffer offset.
279 for(i = 0; i <= ydim; i++) 279 for(i = 0; i <= ydim; i++)
280 { 280 {
281 ylookup[i] = j; 281 ylookup[i] = j;
@@ -290,16 +290,16 @@ static void init_new_res_vars(int32_t davidoption)
290 //Let the Assembly module how many pixels to skip when drawing a column 290 //Let the Assembly module how many pixels to skip when drawing a column
291 setBytesPerLine(bytesperline); 291 setBytesPerLine(bytesperline);
292 292
293 293
294 setview(0L,0L,xdim-1,ydim-1); 294 setview(0L,0L,xdim-1,ydim-1);
295 295
296 setbrightness(curbrightness, palette); 296 setbrightness(curbrightness, palette);
297 297
298 if (searchx < 0) { 298 if (searchx < 0) {
299 searchx = halfxdimen; 299 searchx = halfxdimen;
300 searchy = (ydimen>>1); 300 searchy = (ydimen>>1);
301 } 301 }
302 302
303} 303}
304 304
305 305
@@ -370,17 +370,17 @@ static int sdl_mouse_motion_filter(SDL_Event const *event)
370 } 370 }
371 else 371 else
372 { 372 {
373 if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON) 373 if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
374 { 374 {
375 mouse_relative_x += event->motion.xrel; 375 mouse_relative_x += event->motion.xrel;
376 mouse_relative_y += event->motion.yrel; 376 mouse_relative_y += event->motion.yrel;
377 //printf("sdl_mouse_motion_filter: mrx=%d, mry=%d, mx=%d, my=%d\n", 377 //printf("sdl_mouse_motion_filter: mrx=%d, mry=%d, mx=%d, my=%d\n",
378 // mouse_relative_x, mouse_relative_y, event->motion.xrel, event->motion.yrel); 378 // mouse_relative_x, mouse_relative_y, event->motion.xrel, event->motion.yrel);
379 379
380 // mouse_relative_* is already reset in 380 // mouse_relative_* is already reset in
381 // readmousexy(). It must not be 381 // readmousexy(). It must not be
382 // reset here because calling this function does not mean 382 // reset here because calling this function does not mean
383 // we always handle the mouse. 383 // we always handle the mouse.
384 // FIX_00001: Mouse speed is uneven and slower in windowed mode vs fullscreen mode. 384 // FIX_00001: Mouse speed is uneven and slower in windowed mode vs fullscreen mode.
385 } 385 }
386 else 386 else
@@ -431,12 +431,12 @@ static __inline int handle_keypad_enter_hack(const SDL_Event *event)
431 431
432void fullscreen_toggle_and_change_driver(void) 432void fullscreen_toggle_and_change_driver(void)
433{ 433{
434 434
435// FIX_00002: New Toggle Windowed/FullScreen system now simpler and will 435// FIX_00002: New Toggle Windowed/FullScreen system now simpler and will
436// dynamically change for Windib or Directx driver. Windowed/Fullscreen 436// dynamically change for Windib or Directx driver. Windowed/Fullscreen
437// toggle also made available from menu. 437// toggle also made available from menu.
438// Replace attempt_fullscreen_toggle(SDL_Surface **surface, Uint32 *flags) 438// Replace attempt_fullscreen_toggle(SDL_Surface **surface, Uint32 *flags)
439 439
440 int32_t x,y; 440 int32_t x,y;
441 x = surface->w; 441 x = surface->w;
442 y = surface->h; 442 y = surface->h;
@@ -462,8 +462,8 @@ static int sdl_key_filter(const SDL_Event *event)
462 462
463 // FIX_00005: Mouse pointer can be toggled on/off (see mouse menu or use CTRL-M) 463 // FIX_00005: Mouse pointer can be toggled on/off (see mouse menu or use CTRL-M)
464 // This is usefull to move the duke window when playing in window mode. 464 // This is usefull to move the duke window when playing in window mode.
465 465
466 if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON) 466 if (SDL_WM_GrabInput(SDL_GRAB_QUERY)==SDL_GRAB_ON)
467 { 467 {
468 SDL_WM_GrabInput(SDL_GRAB_OFF); 468 SDL_WM_GrabInput(SDL_GRAB_OFF);
469 SDL_ShowCursor(1); 469 SDL_ShowCursor(1);
@@ -491,9 +491,9 @@ static int sdl_key_filter(const SDL_Event *event)
491 lastkey=(scancodes[SDLK_LALT]&0xff)+0x80; // Simulating Key up (not extended) 491 lastkey=(scancodes[SDLK_LALT]&0xff)+0x80; // Simulating Key up (not extended)
492 keyhandler(); 492 keyhandler();
493 SDL_SetModState(KMOD_NONE); // SDL doesnt see we are releasing the ALT-ENTER keys 493 SDL_SetModState(KMOD_NONE); // SDL doesnt see we are releasing the ALT-ENTER keys
494 494
495 return(0); 495 return(0);
496 } 496 }
497 497
498 if (!handle_keypad_enter_hack(event)) 498 if (!handle_keypad_enter_hack(event))
499 lastkey = scancodes[event->key.keysym.sym]; 499 lastkey = scancodes[event->key.keysym.sym];
@@ -546,7 +546,7 @@ static int root_sdl_event_filter(const SDL_Event *event)
546 return(sdl_mouse_button_filter((const SDL_MouseButtonEvent*)event)); 546 return(sdl_mouse_button_filter((const SDL_MouseButtonEvent*)event));
547 case SDL_QUIT: 547 case SDL_QUIT:
548 /* !!! rcg TEMP */ 548 /* !!! rcg TEMP */
549 Error(EXIT_SUCCESS, "Exit through SDL\n"); 549 Error(EXIT_SUCCESS, "Exit through SDL\n");
550 default: 550 default:
551 //printf("This event is not handled: %d\n",event->type); 551 //printf("This event is not handled: %d\n",event->type);
552 break; 552 break;
@@ -662,7 +662,7 @@ int _joystick_update(void)
662int _joystick_axis(int axis) 662int _joystick_axis(int axis)
663{ 663{
664 if (joystick == NULL) 664 if (joystick == NULL)
665 { 665 {
666 return(0); 666 return(0);
667 } 667 }
668 668
@@ -672,7 +672,7 @@ int _joystick_axis(int axis)
672int _joystick_hat(int hat) 672int _joystick_hat(int hat)
673{ 673{
674 if (joystick == NULL) 674 if (joystick == NULL)
675 { 675 {
676 return(-1); 676 return(-1);
677 } 677 }
678 678
@@ -753,28 +753,28 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
753 //TODO: 753 //TODO:
754//TODO ( "[Todo: handle -netmode <int>]" ) 754//TODO ( "[Todo: handle -netmode <int>]" )
755 Setup_StableNetworking(); 755 Setup_StableNetworking();
756 756
757 } 757 }
758 } 758 }
759 } 759 }
760 760
761 761
762 if (SDL_Init(SDL_INIT_VIDEO) == -1){ 762 if (SDL_Init(SDL_INIT_VIDEO) == -1){
763 Error(EXIT_FAILURE, "BUILDSDL: SDL_Init() failed!\nBUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError()); 763 Error(EXIT_FAILURE, "BUILDSDL: SDL_Init() failed!\nBUILDSDL: SDL_GetError() says \"%s\".\n", SDL_GetError());
764 } 764 }
765 765
766 766
767 // Set up the correct renderer 767 // Set up the correct renderer
768 // Becarfull setenv can't reach dll in VC++ 768 // Becarfull setenv can't reach dll in VC++
769 // A way to proceed is to integrate the SDL libs 769 // A way to proceed is to integrate the SDL libs
770 // in the exe instead. 770 // in the exe instead.
771 771
772 // FIX_00004: SDL.dll and SDL_Mixer.dll are now integrated within the exe 772 // FIX_00004: SDL.dll and SDL_Mixer.dll are now integrated within the exe
773 // (this also makes the Windib/Directx driver switching easier with SDL) 773 // (this also makes the Windib/Directx driver switching easier with SDL)
774 774
775 // This requires to recompile the whole sdl and sdl mixer with the lib 775 // This requires to recompile the whole sdl and sdl mixer with the lib
776 // switch instead of the default dll switch. 776 // switch instead of the default dll switch.
777 777
778 putenv("SDL_VIDEO_CENTERED=1"); 778 putenv("SDL_VIDEO_CENTERED=1");
779 779
780 if (title == NULL) 780 if (title == NULL)
@@ -895,12 +895,12 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
895 scancodes[SDLK_PAGEDOWN] = 0xE051; 895 scancodes[SDLK_PAGEDOWN] = 0xE051;
896 scancodes[SDLK_INSERT] = 0xE052; 896 scancodes[SDLK_INSERT] = 0xE052;
897 scancodes[SDLK_DELETE] = 0xE053; 897 scancodes[SDLK_DELETE] = 0xE053;
898 898
899 899
900 900
901 output_sdl_versions(); 901 output_sdl_versions();
902 output_driver_info(); 902 output_driver_info();
903 903
904 904
905 printf("Video Driver: '%s'.\n", SDL_VideoDriverName(dummyString, 20)); 905 printf("Video Driver: '%s'.\n", SDL_VideoDriverName(dummyString, 20));
906 906
@@ -909,11 +909,11 @@ void _platform_init(int argc, char **argv, const char *title, const char *ico
909// Capture BMP of the current frame 909// Capture BMP of the current frame
910int screencapture(char *filename, uint8_t inverseit) 910int screencapture(char *filename, uint8_t inverseit)
911{ 911{
912// FIX_00006: better naming system for screenshots + message when pic is taken. 912// FIX_00006: better naming system for screenshots + message when pic is taken.
913// Use ./screenshots folder. Screenshot code rerwritten. Faster and 913// Use ./screenshots folder. Screenshot code rerwritten. Faster and
914// makes smaller files. Doesn't freeze or lag the game anymore. 914// makes smaller files. Doesn't freeze or lag the game anymore.
915 915
916 SDL_SaveBMP(surface, filename); 916 SDL_SaveBMP(surface, filename);
917 return 0; 917 return 0;
918} /* screencapture */ 918} /* screencapture */
919 919
@@ -928,7 +928,7 @@ void setvmode(int mode)
928 } else 928 } else
929 printf("setvmode(0x%x) is unsupported in SDL driver.\n", mode); 929 printf("setvmode(0x%x) is unsupported in SDL driver.\n", mode);
930 930
931} 931}
932 932
933int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim) 933int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim)
934{ 934{
@@ -941,13 +941,13 @@ int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim)
941 colorkey = 0; // index in this image to be transparent 941 colorkey = 0; // index in this image to be transparent
942 SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey); 942 SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey);
943 SDL_WM_SetIcon(image,NULL); 943 SDL_WM_SetIcon(image,NULL);
944 944
945 if (daxdim > MAXXDIM || daydim > MAXYDIM) 945 if (daxdim > MAXXDIM || daydim > MAXYDIM)
946 { 946 {
947 printf("Resolution %dx%d is too high. Changed to %dx%d\n", daxdim, daydim, MAXXDIM,MAXYDIM); 947 printf("Resolution %dx%d is too high. Changed to %dx%d\n", daxdim, daydim, MAXXDIM,MAXYDIM);
948 daxdim = MAXXDIM; 948 daxdim = MAXXDIM;
949 daydim = MAXYDIM; 949 daydim = MAXYDIM;
950 } 950 }
951 951
952 getvalidvesamodes(); 952 getvalidvesamodes();
953 953
@@ -1052,8 +1052,8 @@ static __inline void add_user_defined_resolution(void)
1052 /* rockbox hack */ 1052 /* rockbox hack */
1053 add_vesa_mode("rockbox", LCD_WIDTH, LCD_HEIGHT); 1053 add_vesa_mode("rockbox", LCD_WIDTH, LCD_HEIGHT);
1054 add_vesa_mode("rockbox", LCD_HEIGHT, LCD_WIDTH); 1054 add_vesa_mode("rockbox", LCD_HEIGHT, LCD_WIDTH);
1055 1055
1056 1056
1057 if (envr == NULL) 1057 if (envr == NULL)
1058 return; 1058 return;
1059 1059
@@ -1111,7 +1111,7 @@ static __inline void cull_large_vesa_modes(void)
1111 int32_t max_w; 1111 int32_t max_w;
1112 int32_t max_h; 1112 int32_t max_h;
1113 int i; 1113 int i;
1114 1114
1115 get_max_screen_res(&max_w, &max_h); 1115 get_max_screen_res(&max_w, &max_h);
1116 printf("Setting resolution ceiling to (%dx%d).\n", max_w, max_h); 1116 printf("Setting resolution ceiling to (%dx%d).\n", max_w, max_h);
1117 1117
@@ -1139,7 +1139,7 @@ static __inline void cull_duplicate_vesa_modes(void)
1139 } 1139 }
1140 } 1140 }
1141 } 1141 }
1142} 1142}
1143 1143
1144 1144
1145#define swap_macro(tmp, x, y) { tmp = x; x = y; y = tmp; } 1145#define swap_macro(tmp, x, y) { tmp = x; x = y; y = tmp; }
@@ -1196,7 +1196,7 @@ static __inline void output_vesa_modelist(void)
1196 } /* for */ 1196 } /* for */
1197 1197
1198 printf("Final sorted modelist:%s", buffer); 1198 printf("Final sorted modelist:%s", buffer);
1199} 1199}
1200 1200
1201 1201
1202void getvalidvesamodes(void) 1202void getvalidvesamodes(void)
@@ -1233,37 +1233,37 @@ void getvalidvesamodes(void)
1233 1233
1234 /* print it out for debugging purposes... */ 1234 /* print it out for debugging purposes... */
1235 output_vesa_modelist(); 1235 output_vesa_modelist();
1236} 1236}
1237 1237
1238uint8_t lastPalette[768]; 1238uint8_t lastPalette[768];
1239void WriteTranslucToFile(void){ 1239void WriteTranslucToFile(void){
1240 1240
1241 uint8_t buffer[65535*4]; 1241 uint8_t buffer[65535*4];
1242 uint8_t tga_header[18]; 1242 uint8_t tga_header[18];
1243 uint8_t* transPointer = transluc; 1243 uint8_t* transPointer = transluc;
1244 uint8_t* bufferPointer = buffer; 1244 uint8_t* bufferPointer = buffer;
1245 int i; 1245 int i;
1246 FILE* file; 1246 FILE* file;
1247 1247
1248 for (i=0; i < 65535; i++) { 1248 for (i=0; i < 65535; i++) {
1249 1249
1250 bufferPointer[0] = (lastPalette[(*transPointer)*3+0]) / 63.0 * 255; 1250 bufferPointer[0] = (lastPalette[(*transPointer)*3+0]) / 63.0 * 255;
1251 bufferPointer[1] = (lastPalette[(*transPointer)*3+1]) / 63.0 * 255; 1251 bufferPointer[1] = (lastPalette[(*transPointer)*3+1]) / 63.0 * 255;
1252 bufferPointer[2] = (lastPalette[(*transPointer)*3+2]) / 63.0 * 255; 1252 bufferPointer[2] = (lastPalette[(*transPointer)*3+2]) / 63.0 * 255;
1253 bufferPointer[3] = 255; 1253 bufferPointer[3] = 255;
1254 1254
1255 printf("%d,",*transPointer); 1255 printf("%d,",*transPointer);
1256 if (i%255 ==0) 1256 if (i%255 ==0)
1257 printf("\n"); 1257 printf("\n");
1258 1258
1259 transPointer +=1; 1259 transPointer +=1;
1260 bufferPointer+=4; 1260 bufferPointer+=4;
1261 } 1261 }
1262 1262
1263 1263
1264 1264
1265 file = fopen("/transluc.tga", "w"); 1265 file = fopen("/transluc.tga", "w");
1266 1266
1267 memset(tga_header, 0, 18); 1267 memset(tga_header, 0, 18);
1268 tga_header[2] = 2; 1268 tga_header[2] = 2;
1269 tga_header[12] = (256 & 0x00FF); 1269 tga_header[12] = (256 & 0x00FF);
@@ -1271,23 +1271,23 @@ void WriteTranslucToFile(void){
1271 tga_header[14] = (256 & 0x00FF) ; 1271 tga_header[14] = (256 & 0x00FF) ;
1272 tga_header[15] =(256 & 0xFF00) / 256; 1272 tga_header[15] =(256 & 0xFF00) / 256;
1273 tga_header[16] = 32 ; 1273 tga_header[16] = 32 ;
1274 1274
1275 fwrite(&tga_header, 18, sizeof(uint8_t), file); 1275 fwrite(&tga_header, 18, sizeof(uint8_t), file);
1276 fwrite(buffer, 65535, 4, file); 1276 fwrite(buffer, 65535, 4, file);
1277 fclose(file); 1277 fclose(file);
1278} 1278}
1279 1279
1280void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int height){ 1280void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int height){
1281 1281
1282 uint8_t tga_header[18]; 1282 uint8_t tga_header[18];
1283 uint8_t* buffer; 1283 uint8_t* buffer;
1284 uint8_t* palettePointer = palette; 1284 uint8_t* palettePointer = palette;
1285 uint8_t* bufferPointer ; 1285 uint8_t* bufferPointer ;
1286 int i; 1286 int i;
1287 1287
1288 FILE* file = fopen(filename, "w"); 1288 FILE* file = fopen(filename, "w");
1289 1289
1290 1290
1291 memset(tga_header, 0, 18); 1291 memset(tga_header, 0, 18);
1292 tga_header[2] = 2; 1292 tga_header[2] = 2;
1293 tga_header[12] = (width & 0x00FF); 1293 tga_header[12] = (width & 0x00FF);
@@ -1295,30 +1295,30 @@ void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int hei
1295 tga_header[14] = (height & 0x00FF) ; 1295 tga_header[14] = (height & 0x00FF) ;
1296 tga_header[15] =(height & 0xFF00) / 256; 1296 tga_header[15] =(height & 0xFF00) / 256;
1297 tga_header[16] = 32 ; 1297 tga_header[16] = 32 ;
1298 1298
1299 fwrite(&tga_header, 18, sizeof(uint8_t), file); 1299 fwrite(&tga_header, 18, sizeof(uint8_t), file);
1300 1300
1301 bufferPointer = buffer = malloc(width*height*4); 1301 bufferPointer = buffer = malloc(width*height*4);
1302 1302
1303 for (i = 0 ; i < width*height ; i++) 1303 for (i = 0 ; i < width*height ; i++)
1304 { 1304 {
1305 bufferPointer[0] = palettePointer[0] / 63.0 * 255; 1305 bufferPointer[0] = palettePointer[0] / 63.0 * 255;
1306 bufferPointer[1] = palettePointer[1] / 63.0 * 255; 1306 bufferPointer[1] = palettePointer[1] / 63.0 * 255;
1307 bufferPointer[2] = palettePointer[2] / 63.0 * 255; 1307 bufferPointer[2] = palettePointer[2] / 63.0 * 255;
1308 bufferPointer[3] = 255; 1308 bufferPointer[3] = 255;
1309 1309
1310 bufferPointer += 4; 1310 bufferPointer += 4;
1311 palettePointer+= 3; 1311 palettePointer+= 3;
1312 } 1312 }
1313 1313
1314 fwrite(buffer, width*height, 4, file); 1314 fwrite(buffer, width*height, 4, file);
1315 fclose(file); 1315 fclose(file);
1316 1316
1317 free(buffer); 1317 free(buffer);
1318} 1318}
1319 1319
1320 1320
1321void WriteLastPaletteToFile(){ 1321void WriteLastPaletteToFile(void){
1322 WritePaletteToFile(lastPalette,"lastPalette.tga",16,16); 1322 WritePaletteToFile(lastPalette,"lastPalette.tga",16,16);
1323} 1323}
1324 1324
@@ -1342,18 +1342,18 @@ int VBE_setPalette(uint8_t *palettebuffer)
1342 uint8_t *p = palettebuffer; 1342 uint8_t *p = palettebuffer;
1343 int i; 1343 int i;
1344 //static updated=0; 1344 //static updated=0;
1345 1345
1346 //if (updated >=1 ) 1346 //if (updated >=1 )
1347 // return ; 1347 // return ;
1348 1348
1349 //WritePaletteToFile(palettebuffer,"lastPalette.tga",16,16); 1349 //WritePaletteToFile(palettebuffer,"lastPalette.tga",16,16);
1350 //updated++; 1350 //updated++;
1351 1351
1352 1352
1353 //CODE EXPLORATION 1353 //CODE EXPLORATION
1354 //Used only to write the last palette to file. 1354 //Used only to write the last palette to file.
1355 memcpy(lastPalette, palettebuffer, 768); 1355 memcpy(lastPalette, palettebuffer, 768);
1356 1356
1357 for (i = 0; i < 256; i++){ 1357 for (i = 0; i < 256; i++){
1358 /* doesn't map perfectly */ 1358 /* doesn't map perfectly */
1359 sdlp->b = (Uint8) (*p << 2) | (*p >> 4); 1359 sdlp->b = (Uint8) (*p << 2) | (*p >> 4);
@@ -1383,10 +1383,10 @@ int VBE_getPalette(int32_t start, int32_t num, uint8_t *palettebuffer)
1383 *p++ = (Uint8) ((((float) sdlp->r) / 255.0) * 63.0); 1383 *p++ = (Uint8) ((((float) sdlp->r) / 255.0) * 63.0);
1384 *p++ = sdlp->unused; /* This byte is unused in both SDL and BUILD. */ 1384 *p++ = sdlp->unused; /* This byte is unused in both SDL and BUILD. */
1385 sdlp++; 1385 sdlp++;
1386 } 1386 }
1387 1387
1388 return(1); 1388 return(1);
1389} 1389}
1390 1390
1391 1391
1392void _uninitengine(void) 1392void _uninitengine(void)
@@ -1464,13 +1464,13 @@ void _nextpage(void)
1464 1464
1465 _handle_events(); 1465 _handle_events();
1466 1466
1467 1467
1468 SDL_UpdateRect(surface, 0, 0, 0, 0); 1468 SDL_UpdateRect(surface, 0, 0, 0, 0);
1469 1469
1470 //sprintf(bmpName,"%d.bmp",counter++); 1470 //sprintf(bmpName,"%d.bmp",counter++);
1471 //SDL_SaveBMP(surface,bmpName); 1471 //SDL_SaveBMP(surface,bmpName);
1472 1472
1473 1473
1474 //if (CLEAR_FRAMEBUFFER) 1474 //if (CLEAR_FRAMEBUFFER)
1475 // SDL_FillRect(surface,NULL,0); 1475 // SDL_FillRect(surface,NULL,0);
1476 1476
@@ -1480,15 +1480,15 @@ void _nextpage(void)
1480 total_rendered_frames = 0; 1480 total_rendered_frames = 0;
1481 total_render_time = 1; 1481 total_render_time = 1;
1482 last_render_ticks = ticks; 1482 last_render_ticks = ticks;
1483 } 1483 }
1484 total_rendered_frames++; 1484 total_rendered_frames++;
1485} 1485}
1486 1486
1487 1487
1488uint8_t readpixel(uint8_t * offset) 1488uint8_t readpixel(uint8_t * offset)
1489{ 1489{
1490 return *offset; 1490 return *offset;
1491} 1491}
1492 1492
1493void drawpixel(uint8_t * location, uint8_t pixel) 1493void drawpixel(uint8_t * location, uint8_t pixel)
1494{ 1494{
@@ -1519,7 +1519,7 @@ void fillscreen16(int32_t offset, int32_t color, int32_t blocksize)
1519 pixels = get_framebuffer(); 1519 pixels = get_framebuffer();
1520 1520
1521 /* Make this function pageoffset aware - DDOI */ 1521 /* Make this function pageoffset aware - DDOI */
1522 if (!pageoffset) { 1522 if (!pageoffset) {
1523 offset = offset << 3; 1523 offset = offset << 3;
1524 offset += 640*336; 1524 offset += 640*336;
1525 } 1525 }
@@ -1584,7 +1584,7 @@ void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint
1584 1584
1585 dx = XEnd-XStart; 1585 dx = XEnd-XStart;
1586 dy = YEnd-YStart; 1586 dy = YEnd-YStart;
1587 1587
1588 //Analyse the slope 1588 //Analyse the slope
1589 if (dx >= 0) 1589 if (dx >= 0)
1590 { 1590 {
@@ -1803,7 +1803,7 @@ void (*installusertimercallback(void (*callback)(void)))(void)
1803 inittimer() -- initialise timer 1803 inittimer() -- initialise timer
1804 FCS: The tickspersecond parameter is a ratio value that helps replicating 1804 FCS: The tickspersecond parameter is a ratio value that helps replicating
1805 oldschool DOS tick per seconds. 1805 oldschool DOS tick per seconds.
1806 1806
1807 The way the timer work is: 1807 The way the timer work is:
1808 float newSystemTickPerSecond = [0,1] 1808 float newSystemTickPerSecond = [0,1]
1809 tickPerSecond on a DOS system = tickspersecond * newSystemTickPerSecond ; 1809 tickPerSecond on a DOS system = tickspersecond * newSystemTickPerSecond ;
@@ -1812,8 +1812,8 @@ void (*installusertimercallback(void (*callback)(void)))(void)
1812int inittimer(int tickspersecond) 1812int inittimer(int tickspersecond)
1813{ 1813{
1814 int64_t t; 1814 int64_t t;
1815 1815
1816 1816
1817 if (timerfreq) return 0; // already installed 1817 if (timerfreq) return 0; // already installed
1818 1818
1819 //printf("Initialising timer, with tickPerSecond=%d\n",tickspersecond); 1819 //printf("Initialising timer, with tickPerSecond=%d\n",tickspersecond);
@@ -1831,7 +1831,7 @@ int inittimer(int tickspersecond)
1831 timerlastsample = (int32_t)(t*timerticspersec / timerfreq); 1831 timerlastsample = (int32_t)(t*timerticspersec / timerfreq);
1832 1832
1833 usertimercallback = NULL; 1833 usertimercallback = NULL;
1834 1834
1835 return 0; 1835 return 0;
1836} 1836}
1837 1837
@@ -1853,12 +1853,12 @@ void sampletimer(void)
1853{ 1853{
1854 int64_t i; 1854 int64_t i;
1855 int32_t n; 1855 int32_t n;
1856 1856
1857 if (!timerfreq) return; 1857 if (!timerfreq) return;
1858 1858
1859 TIMER_GetPlatformTicks(&i); 1859 TIMER_GetPlatformTicks(&i);
1860 1860
1861 1861
1862 n = (int32_t)(i*timerticspersec / timerfreq) - timerlastsample; 1862 n = (int32_t)(i*timerticspersec / timerfreq) - timerlastsample;
1863 if (n>0) { 1863 if (n>0) {
1864 totalclock += n; 1864 totalclock += n;
@@ -1907,10 +1907,9 @@ int TIMER_GetPlatformTicksInOneSecond(int64_t* t)
1907 *t = 1000; 1907 *t = 1000;
1908 return 1; 1908 return 1;
1909} 1909}
1910 1910
1911void TIMER_GetPlatformTicks(int64_t* t) 1911void TIMER_GetPlatformTicks(int64_t* t)
1912{ 1912{
1913 *t = SDL_GetTicks(); 1913 *t = SDL_GetTicks();
1914} 1914}
1915/* end of sdl_driver.c ... */ 1915/* end of sdl_driver.c ... */
1916
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/display.h b/apps/plugins/sdl/progs/duke3d/Engine/src/display.h
index 791d6b9692..53091ed385 100644
--- a/apps/plugins/sdl/progs/duke3d/Engine/src/display.h
+++ b/apps/plugins/sdl/progs/duke3d/Engine/src/display.h
@@ -96,7 +96,7 @@ void timerhandler(void);
96/* resolution inits. sdl_driver.c ... */ 96/* resolution inits. sdl_driver.c ... */
97int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim); 97int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim);
98 98
99uint32_t getticks(); 99uint32_t getticks(void);
100 100
101void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint8_t Color); 101void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint8_t Color);
102void setcolor16(uint8_t color); 102void setcolor16(uint8_t color);
@@ -106,5 +106,3 @@ void setcolor16(uint8_t color);
106void initmultiplayers(uint8_t damultioption, uint8_t dacomrateoption, uint8_t dapriority); 106void initmultiplayers(uint8_t damultioption, uint8_t dacomrateoption, uint8_t dapriority);
107 107
108#endif 108#endif
109
110
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/network.h b/apps/plugins/sdl/progs/duke3d/Engine/src/network.h
index 2d6f6e2e2a..34f16e268a 100644
--- a/apps/plugins/sdl/progs/duke3d/Engine/src/network.h
+++ b/apps/plugins/sdl/progs/duke3d/Engine/src/network.h
@@ -11,8 +11,8 @@
11 11
12#include "platform.h" 12#include "platform.h"
13 13
14void Setup_UnstableNetworking(); 14void Setup_UnstableNetworking(void);
15void Setup_StableNetworking(); 15void Setup_StableNetworking(void);
16 16
17void callcommit(void); 17void callcommit(void);
18void initcrc(void); 18void initcrc(void);
diff --git a/apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h b/apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h
index 90a5676f8b..3e7993d4ea 100644
--- a/apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h
+++ b/apps/plugins/sdl/progs/duke3d/Engine/src/rockbox_compat.h
@@ -56,8 +56,12 @@
56#define IP_RECVERR SO_BROADCAST 56#define IP_RECVERR SO_BROADCAST
57*/ 57*/
58 58
59#ifndef stricmp
59#define stricmp strcasecmp 60#define stricmp strcasecmp
61#endif
62#ifndef strcmpi
60#define strcmpi strcasecmp 63#define strcmpi strcasecmp
64#endif
61 65
62#define S_IREAD S_IRUSR 66#define S_IREAD S_IRUSR
63 67
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c
index 4c82f6eec0..cd6311801d 100644
--- a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c
+++ b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/mvreverb.c
@@ -17,7 +17,7 @@ static int FB_SRC_A, FB_SRC_B, IIR_DEST_A0, IIR_DEST_A1, ACC_SRC_A0, ACC_SRC_A1,
17 ACC_SRC_B1, IIR_SRC_A0, IIR_SRC_A1, IIR_DEST_B0, IIR_DEST_B1, ACC_SRC_C0, 17 ACC_SRC_B1, IIR_SRC_A0, IIR_SRC_A1, IIR_DEST_B0, IIR_DEST_B1, ACC_SRC_C0,
18 ACC_SRC_C1, ACC_SRC_D0, ACC_SRC_D1, IIR_SRC_B1, IIR_SRC_B0, MIX_DEST_A0, 18 ACC_SRC_C1, ACC_SRC_D0, ACC_SRC_D1, IIR_SRC_B1, IIR_SRC_B0, MIX_DEST_A0,
19 MIX_DEST_A1, MIX_DEST_B0, MIX_DEST_B1; 19 MIX_DEST_A1, MIX_DEST_B0, MIX_DEST_B1;
20 20
21//static long IIR_ALPHA, ACC_COEF_A, ACC_COEF_B, ACC_COEF_C, ACC_COEF_D, IIR_COEF, FB_ALPHA, FB_X, 21//static long IIR_ALPHA, ACC_COEF_A, ACC_COEF_B, ACC_COEF_C, ACC_COEF_D, IIR_COEF, FB_ALPHA, FB_X,
22// IN_COEF_L, IN_COEF_R; 22// IN_COEF_L, IN_COEF_R;
23 23
@@ -51,7 +51,7 @@ static inline int cnv_offset(int src)
51 51
52// extern __stdcall OutputDebugStringA(char *); 52// extern __stdcall OutputDebugStringA(char *);
53 53
54static inline void check_buffer() 54static inline void check_buffer(void)
55{ 55{
56 int new_delay = cnv_offset(MV_ReverbDelay); 56 int new_delay = cnv_offset(MV_ReverbDelay);
57 57
@@ -99,7 +99,7 @@ static inline long g_buffer(int iOff, long *ptr) // get
99 } 99 }
100 100
101 iOff=(iOff*4)+CurrAddr; 101 iOff=(iOff*4)+CurrAddr;
102 while(iOff>correctDelay-1) 102 while(iOff>correctDelay-1)
103 { 103 {
104 iOff=iOff-correctDelay; 104 iOff=iOff-correctDelay;
105 } 105 }
@@ -141,11 +141,11 @@ static inline void s_buffer1(int iOff,long iVal, long *ptr) // se
141 } 141 }
142 142
143 iOff=(iOff*4)+CurrAddr+1; 143 iOff=(iOff*4)+CurrAddr+1;
144 while(iOff>correctDelay-1) 144 while(iOff>correctDelay-1)
145 { 145 {
146 iOff=iOff-correctDelay; 146 iOff=iOff-correctDelay;
147 } 147 }
148 while(iOff<0) 148 while(iOff<0)
149 { 149 {
150 iOff=correctDelay-(0-iOff); 150 iOff=correctDelay-(0-iOff);
151 } 151 }
@@ -155,12 +155,12 @@ static inline void s_buffer1(int iOff,long iVal, long *ptr) // se
155static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long *ptr) 155static inline long MixREVERBLeft(long INPUT_SAMPLE_L, long INPUT_SAMPLE_R, long *ptr)
156{ 156{
157 long ACC0,ACC1,FB_A0,FB_A1,FB_B0,FB_B1; 157 long ACC0,ACC1,FB_A0,FB_A1,FB_B0,FB_B1;
158 158
159 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)); 159 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));
160 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)); 160 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));
161 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)); 161 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));
162 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)); 162 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));
163 163
164 const long one = (1 << FRACBITS); 164 const long one = (1 << FRACBITS);
165 const long IIR_A0 = fp_mul(IIR_INPUT_A0, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A0, ptr), (one - IIR_ALPHA), FRACBITS); 165 const long IIR_A0 = fp_mul(IIR_INPUT_A0, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A0, ptr), (one - IIR_ALPHA), FRACBITS);
166 const long IIR_A1 = fp_mul(IIR_INPUT_A1, IIR_ALPHA, FRACBITS) + fp_mul(g_buffer(IIR_DEST_A1, ptr), (one - IIR_ALPHA), FRACBITS); 166 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
171 s_buffer1(IIR_DEST_A1, IIR_A1, ptr); 171 s_buffer1(IIR_DEST_A1, IIR_A1, ptr);
172 s_buffer1(IIR_DEST_B0, IIR_B0, ptr); 172 s_buffer1(IIR_DEST_B0, IIR_B0, ptr);
173 s_buffer1(IIR_DEST_B1, IIR_B1, ptr); 173 s_buffer1(IIR_DEST_B1, IIR_B1, ptr);
174 174
175 ACC0 = (fp_mul(g_buffer(ACC_SRC_A0, ptr), ACC_COEF_A, FRACBITS) + 175 ACC0 = (fp_mul(g_buffer(ACC_SRC_A0, ptr), ACC_COEF_A, FRACBITS) +
176 fp_mul(g_buffer(ACC_SRC_B0, ptr), ACC_COEF_B, FRACBITS) + 176 fp_mul(g_buffer(ACC_SRC_B0, ptr), ACC_COEF_B, FRACBITS) +
177 fp_mul(g_buffer(ACC_SRC_C0, ptr), ACC_COEF_C, FRACBITS) + 177 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
180 fp_mul(g_buffer(ACC_SRC_B1, ptr), ACC_COEF_B, FRACBITS) + 180 fp_mul(g_buffer(ACC_SRC_B1, ptr), ACC_COEF_B, FRACBITS) +
181 fp_mul(g_buffer(ACC_SRC_C1, ptr), ACC_COEF_C, FRACBITS) + 181 fp_mul(g_buffer(ACC_SRC_C1, ptr), ACC_COEF_C, FRACBITS) +
182 fp_mul(g_buffer(ACC_SRC_D1, ptr), ACC_COEF_D, FRACBITS)); 182 fp_mul(g_buffer(ACC_SRC_D1, ptr), ACC_COEF_D, FRACBITS));
183 183
184 FB_A0 = g_buffer(MIX_DEST_A0 - FB_SRC_A, ptr); 184 FB_A0 = g_buffer(MIX_DEST_A0 - FB_SRC_A, ptr);
185 FB_A1 = g_buffer(MIX_DEST_A1 - FB_SRC_A, ptr); 185 FB_A1 = g_buffer(MIX_DEST_A1 - FB_SRC_A, ptr);
186 FB_B0 = g_buffer(MIX_DEST_B0 - FB_SRC_B, ptr); 186 FB_B0 = g_buffer(MIX_DEST_B0 - FB_SRC_B, ptr);
187 FB_B1 = g_buffer(MIX_DEST_B1 - FB_SRC_B, ptr); 187 FB_B1 = g_buffer(MIX_DEST_B1 - FB_SRC_B, ptr);
188 188
189 s_buffer(MIX_DEST_A0, ACC0 - fp_mul(FB_A0 , FB_ALPHA, FRACBITS), ptr); 189 s_buffer(MIX_DEST_A0, ACC0 - fp_mul(FB_A0 , FB_ALPHA, FRACBITS), ptr);
190 s_buffer(MIX_DEST_A1, ACC1 - fp_mul(FB_A1 , FB_ALPHA, FRACBITS), ptr); 190 s_buffer(MIX_DEST_A1, ACC1 - fp_mul(FB_A1 , FB_ALPHA, FRACBITS), ptr);
191 191
192 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); 192 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);
193 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); 193 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);
194 194
195 iRVBLeft = (g_buffer(MIX_DEST_A0, ptr)+g_buffer(MIX_DEST_B0, ptr)) / 3; 195 iRVBLeft = (g_buffer(MIX_DEST_A0, ptr)+g_buffer(MIX_DEST_B0, ptr)) / 3;
196 iRVBRight = (g_buffer(MIX_DEST_A1, ptr)+g_buffer(MIX_DEST_B1, ptr)) / 3; 196 iRVBRight = (g_buffer(MIX_DEST_A1, ptr)+g_buffer(MIX_DEST_B1, ptr)) / 3;
197 197
198 CurrAddr++; 198 CurrAddr++;
199 if(CurrAddr>delay-1) CurrAddr=0; 199 if(CurrAddr>delay-1) CurrAddr=0;
200 200
201 return (long)iRVBLeft; 201 return (long)iRVBLeft;
202} 202}
203 203
@@ -228,7 +228,7 @@ void MV_FPReverb(int volume)
228// OutputDebugStringA(err); 228// OutputDebugStringA(err);
229 229
230 long scale = (volume << FRACBITS) / MV_MaxVolume; 230 long scale = (volume << FRACBITS) / MV_MaxVolume;
231 231
232 if (MV_Channels == 1) 232 if (MV_Channels == 1)
233 { 233 {
234 for (i = 0; i < count; i++) 234 for (i = 0; i < count; i++)
@@ -308,7 +308,7 @@ void MV_16BitReverbFast( const char *src, char *dest, int count, int shift )
308 308
309 short *pdest = (short *)dest; 309 short *pdest = (short *)dest;
310 const short *psrc = (const short *)src; 310 const short *psrc = (const short *)src;
311 311
312 for (i = 0; i < count; i++) { 312 for (i = 0; i < count; i++) {
313 pdest[i] = readLE16(psrc + i) >> shift; 313 pdest[i] = readLE16(psrc + i) >> shift;
314 } 314 }
@@ -319,11 +319,11 @@ void MV_8BitReverbFast( const signed char *src, signed char *dest, int count, in
319 int i; 319 int i;
320 320
321 unsigned char sh = 0x80 - (0x80 >> shift); 321 unsigned char sh = 0x80 - (0x80 >> shift);
322 322
323 for (i = 0; i < count; i++) { 323 for (i = 0; i < count; i++) {
324 unsigned char a = ((unsigned char) src[i]) >> shift; 324 unsigned char a = ((unsigned char) src[i]) >> shift;
325 unsigned char c = (((unsigned char) src[i]) ^ 0x80) >> 7; 325 unsigned char c = (((unsigned char) src[i]) ^ 0x80) >> 7;
326 326
327 dest[i] = (signed char) (a + sh + c); 327 dest[i] = (signed char) (a + sh + c);
328 } 328 }
329} 329}
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/console.c b/apps/plugins/sdl/progs/duke3d/Game/src/console.c
index 229bb3b564..c4a465eda3 100644
--- a/apps/plugins/sdl/progs/duke3d/Game/src/console.c
+++ b/apps/plugins/sdl/progs/duke3d/Game/src/console.c
@@ -23,8 +23,8 @@ typedef struct console_element
23 23
24// Private member functions 24// Private member functions
25void CONSOLE_InsertUsedCommand(const char * szUsedCommand); 25void CONSOLE_InsertUsedCommand(const char * szUsedCommand);
26void CONSOLE_ClearUsedCommandList(); 26void CONSOLE_ClearUsedCommandList(void);
27void CONSOLE_RecalculateDirtyBuffer(); 27void CONSOLE_RecalculateDirtyBuffer(void);
28 28
29// console argument tracker 29// console argument tracker
30int argc; 30int argc;
@@ -50,7 +50,7 @@ int nConsole_Active = 0;
50 50
51void CVAR_RegisterDefaultCvarBindings(void); 51void CVAR_RegisterDefaultCvarBindings(void);
52// Initialize the console 52// Initialize the console
53void CONSOLE_Init() 53void CONSOLE_Init(void)
54{ 54{
55 CONSOLE_Reset(); 55 CONSOLE_Reset();
56 56
@@ -63,7 +63,7 @@ void CONSOLE_Init()
63 CONSOLE_Printf("Type \'HELP\' for help with console Commands."); 63 CONSOLE_Printf("Type \'HELP\' for help with console Commands.");
64} 64}
65 65
66void CONSOLE_Reset() 66void CONSOLE_Reset(void)
67{ 67{
68 CONSOLEELEMENT *pElement; 68 CONSOLEELEMENT *pElement;
69 CONSOLEELEMENT *pDelElement; 69 CONSOLEELEMENT *pDelElement;
@@ -144,7 +144,7 @@ void CONSOLE_HandleInput()
144 { 144 {
145 ud.pause_on = 0; 145 ud.pause_on = 0;
146 } 146 }
147 } 147 }
148 } 148 }
149 else 149 else
150 // Bug fix: make sure the frag bar displays after console 150 // Bug fix: make sure the frag bar displays after console
@@ -153,7 +153,7 @@ void CONSOLE_HandleInput()
153 { 153 {
154 if ( ud.multimode > 1 && ud.coop != 1 ) 154 if ( ud.multimode > 1 && ud.coop != 1 )
155 { 155 {
156 displayfragbar(); 156 displayfragbar();
157 } 157 }
158 if(numplayers<2) 158 if(numplayers<2)
159 ud.pause_on = 0; 159 ud.pause_on = 0;
@@ -169,7 +169,7 @@ void CONSOLE_HandleInput()
169 return; 169 return;
170 } 170 }
171 171
172 switch(KB_GetLastScanCode()) 172 switch(KB_GetLastScanCode())
173 { 173 {
174 case sc_Space: 174 case sc_Space:
175 { 175 {
@@ -221,7 +221,7 @@ void CONSOLE_HandleInput()
221 case sc_kpad_Enter: 221 case sc_kpad_Enter:
222 case sc_Enter: 222 case sc_Enter:
223 { 223 {
224 //If console_buffer[0] strlen() != 0 224 //If console_buffer[0] strlen() != 0
225 //1. Push the dirty_buffer unto the console_buffer 225 //1. Push the dirty_buffer unto the console_buffer
226 //2. parse the text 226 //2. parse the text
227 rb->kbd_input(dirty_buffer, sizeof(dirty_buffer)); 227 rb->kbd_input(dirty_buffer, sizeof(dirty_buffer));
@@ -278,7 +278,7 @@ void CONSOLE_HandleInput()
278 if(p_console_current_view->next != NULL) 278 if(p_console_current_view->next != NULL)
279 { 279 {
280 p_console_current_view = p_console_current_view->next; 280 p_console_current_view = p_console_current_view->next;
281 } 281 }
282 else 282 else
283 { 283 {
284 break; 284 break;
@@ -351,10 +351,10 @@ void CONSOLE_HandleInput()
351 } 351 }
352 352
353 353
354 KB_ClearLastScanCode(); 354 KB_ClearLastScanCode();
355} 355}
356 356
357void CONSOLE_Render() 357void CONSOLE_Render(void)
358{ 358{
359 if(g_CV_classic) 359 if(g_CV_classic)
360 { 360 {
@@ -371,7 +371,7 @@ void CONSOLE_Render()
371 int iYOffset = 3; //offset for the console text 371 int iYOffset = 3; //offset for the console text
372 CONSOLEELEMENT *pElement; 372 CONSOLEELEMENT *pElement;
373 373
374 y1 = 0; 374 y1 = 0;
375 y2 = (ydim / 2) - ((ydim / 2)/12); 375 y2 = (ydim / 2) - ((ydim / 2)/12);
376 376
377 // Draw console background 377 // Draw console background
@@ -418,9 +418,9 @@ void CONSOLE_Render()
418 minitext(283, iCurHeight, BUILD_NUMBER, 17,10+16); 418 minitext(283, iCurHeight, BUILD_NUMBER, 17,10+16);
419 419
420 // Draw the cursor //Change the color every second 420 // Draw the cursor //Change the color every second
421 minitext(iCurWidth, iCurHeight,"_",(time(NULL)%2)+1,10+16); 421 minitext(iCurWidth, iCurHeight,"_",(time(NULL)%2)+1,10+16);
422 } 422 }
423 else 423 else
424 if(g_CV_num_console_lines > 0) 424 if(g_CV_num_console_lines > 0)
425 { 425 {
426 int i, iYOffset = 3; //offset for the console text 426 int i, iYOffset = 3; //offset for the console text
@@ -517,7 +517,7 @@ void CONSOLE_InsertUsedCommand(const char * szUsedCommand)
517 } 517 }
518} 518}
519 519
520void CONSOLE_ClearUsedCommandList() 520void CONSOLE_ClearUsedCommandList(void)
521{ 521{
522 CONSOLEELEMENT *pElement; 522 CONSOLEELEMENT *pElement;
523 CONSOLEELEMENT *pDelElement; 523 CONSOLEELEMENT *pDelElement;
@@ -537,7 +537,7 @@ void CONSOLE_ClearUsedCommandList()
537} 537}
538 538
539 539
540void CONSOLE_RecalculateDirtyBuffer() 540void CONSOLE_RecalculateDirtyBuffer(void)
541{ 541{
542 int len; 542 int len;
543 int l; 543 int l;
@@ -605,7 +605,7 @@ void CONSOLE_Printf(const char *newmsg, ...)
605} 605}
606 606
607// Get the current number of args for this keyword 607// Get the current number of args for this keyword
608int CONSOLE_GetArgc() 608int CONSOLE_GetArgc(void)
609{ 609{
610 return argc; 610 return argc;
611} 611}
@@ -617,9 +617,9 @@ char * CONSOLE_GetArgv(unsigned int var)
617} 617}
618 618
619// Is our console showing? 619// Is our console showing?
620int CONSOLE_IsActive() 620int CONSOLE_IsActive(void)
621{ 621{
622 622
623 return nConsole_Active; 623 return nConsole_Active;
624} 624}
625 625
@@ -627,4 +627,4 @@ int CONSOLE_IsActive()
627void CONSOLE_SetActive(int i) 627void CONSOLE_SetActive(int i)
628{ 628{
629 nConsole_Active = (i == 0) ? 0 : 1; 629 nConsole_Active = (i == 0) ? 0 : 1;
630} \ No newline at end of file 630}
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/console.h b/apps/plugins/sdl/progs/duke3d/Game/src/console.h
index 58c0e34b25..955c41d885 100644
--- a/apps/plugins/sdl/progs/duke3d/Game/src/console.h
+++ b/apps/plugins/sdl/progs/duke3d/Game/src/console.h
@@ -3,17 +3,17 @@
3 3
4 4
5// Public member functions 5// Public member functions
6void CONSOLE_Init(); 6void CONSOLE_Init(void);
7void CONSOLE_Reset(); 7void CONSOLE_Reset(void);
8void CONSOLE_Term(); 8void CONSOLE_Term(void);
9void CONSOLE_ParseStartupScript(); 9void CONSOLE_ParseStartupScript(void);
10void CONSOLE_HandleInput(); 10void CONSOLE_HandleInput(void);
11void CONSOLE_Render(); 11void CONSOLE_Render(void);
12void CONSOLE_ParseCommand(char * command); 12void CONSOLE_ParseCommand(char * command);
13void CONSOLE_Printf(const char *newmsg, ...); 13void CONSOLE_Printf(const char *newmsg, ...);
14int CONSOLE_GetArgc(); 14int CONSOLE_GetArgc(void);
15char * CONSOLE_GetArgv(unsigned int var); 15char * CONSOLE_GetArgv(unsigned int var);
16int CONSOLE_IsActive(); 16int CONSOLE_IsActive(void);
17void CONSOLE_SetActive(int i); 17void CONSOLE_SetActive(int i);
18 18
19#endif 19#endif
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h b/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h
index 1e6319c807..55102d791c 100644
--- a/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h
+++ b/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h
@@ -3,8 +3,8 @@
3 3
4#include <inttypes.h> 4#include <inttypes.h>
5 5
6void CVARDEFS_Init(); 6void CVARDEFS_Init(void);
7void CVARDEFS_Render(); 7void CVARDEFS_Render(void);
8// 8//
9// Function declarations 9// Function declarations
10// 10//
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h b/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h
index 206e16a9c4..91077c8656 100644
--- a/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h
+++ b/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h
@@ -18,8 +18,8 @@ typedef struct t_cvar_binding
18 18
19 19
20void CVAR_RegisterCvar(const char * varname, const char * varhelp, void* variable, function_t function); 20void CVAR_RegisterCvar(const char * varname, const char * varhelp, void* variable, function_t function);
21int CVAR_GetNumCvarBindings(); 21int CVAR_GetNumCvarBindings(void);
22cvar_binding* CVAR_GetCvarBinding(unsigned int nBinding); 22cvar_binding* CVAR_GetCvarBinding(unsigned int nBinding);
23void CVAR_Render(); 23void CVAR_Render(void);
24 24
25#endif \ No newline at end of file 25#endif
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/global.h b/apps/plugins/sdl/progs/duke3d/Game/src/global.h
index a9a00002f0..e8aaca0d3a 100644
--- a/apps/plugins/sdl/progs/duke3d/Game/src/global.h
+++ b/apps/plugins/sdl/progs/duke3d/Game/src/global.h
@@ -31,6 +31,7 @@ void Shutdown(void);
31#endif 31#endif
32 32
33#ifdef ROCKBOX 33#ifdef ROCKBOX
34#undef BYTE_ORDER
34#ifdef ROCKBOX_LITTLE_ENDIAN 35#ifdef ROCKBOX_LITTLE_ENDIAN
35#define BYTE_ORDER LITTLE_ENDIAN 36#define BYTE_ORDER LITTLE_ENDIAN
36#else 37#else
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/types.h b/apps/plugins/sdl/progs/duke3d/Game/src/types.h
index 93d6f80c86..b5e98b04e0 100644
--- a/apps/plugins/sdl/progs/duke3d/Game/src/types.h
+++ b/apps/plugins/sdl/progs/duke3d/Game/src/types.h
@@ -67,8 +67,12 @@ typedef float64 appfloat;
67// 67//
68//*************************************************************************** 68//***************************************************************************
69 69
70#ifndef true
70#define true ( 1 == 1 ) 71#define true ( 1 == 1 )
72#endif
73#ifndef false
71#define false ( ! true ) 74#define false ( ! true )
75#endif
72 76
73//*************************************************************************** 77//***************************************************************************
74// 78//
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h b/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h
index 6519331b77..5085e64fae 100644
--- a/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h
+++ b/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h
@@ -11,7 +11,7 @@ of the License, or (at your option) any later version.
11 11
12This program is distributed in the hope that it will be useful, 12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of 13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 15
16See the GNU General Public License for more details. 16See the GNU General Public License for more details.
17 17
@@ -60,7 +60,7 @@ int16 IntelShort (int16 l);
60int32_t Motoint32_t (int32_t l); 60int32_t Motoint32_t (int32_t l);
61int32_t Intelint32_t (int32_t l); 61int32_t Intelint32_t (int32_t l);
62 62
63void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)()); 63//void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)());
64 64
65#ifdef __cplusplus 65#ifdef __cplusplus
66}; 66};
diff --git a/apps/plugins/sdl/progs/quake/cl_input.c b/apps/plugins/sdl/progs/quake/cl_input.c
index 5327b7363e..613ca431b9 100644
--- a/apps/plugins/sdl/progs/quake/cl_input.c
+++ b/apps/plugins/sdl/progs/quake/cl_input.c
@@ -172,35 +172,36 @@ float CL_KeyState (kbutton_t *key)
172{ 172{
173 float val; 173 float val;
174 qboolean impulsedown, impulseup, down; 174 qboolean impulsedown, impulseup, down;
175 175
176 impulsedown = key->state & 2; 176 impulsedown = key->state & 2;
177 impulseup = key->state & 4; 177 impulseup = key->state & 4;
178 down = key->state & 1; 178 down = key->state & 1;
179 val = 0; 179 val = 0;
180 180
181 if (impulsedown && !impulseup) 181 if (impulsedown && !impulseup) {
182 if (down) 182 if (down)
183 val = 0.5; // pressed and held this frame 183 val = 0.5; // pressed and held this frame
184 else 184 else
185 val = 0; // I_Error (); 185 val = 0; // I_Error ();
186 if (impulseup && !impulsedown) 186 } else if (impulseup && !impulsedown) {
187 if (down) 187 if (down)
188 val = 0; // I_Error (); 188 val = 0; // I_Error ();
189 else 189 else
190 val = 0; // released this frame 190 val = 0; // released this frame
191 if (!impulsedown && !impulseup) 191 } else if (!impulsedown && !impulseup) {
192 if (down) 192 if (down)
193 val = 1.0; // held the entire frame 193 val = 1.0; // held the entire frame
194 else 194 else
195 val = 0; // up the entire frame 195 val = 0; // up the entire frame
196 if (impulsedown && impulseup) 196 } else if (impulsedown && impulseup) {
197 if (down) 197 if (down)
198 val = 0.75; // released and re-pressed this frame 198 val = 0.75; // released and re-pressed this frame
199 else 199 else
200 val = 0.25; // pressed and released this frame 200 val = 0.25; // pressed and released this frame
201 }
201 202
202 key->state &= 1; // clear impulses 203 key->state &= 1; // clear impulses
203 204
204 return val; 205 return val;
205} 206}
206 207
diff --git a/apps/plugins/sdl/progs/quake/d_iface.h b/apps/plugins/sdl/progs/quake/d_iface.h
index 8dc5ce94bc..1dbc7f3580 100644
--- a/apps/plugins/sdl/progs/quake/d_iface.h
+++ b/apps/plugins/sdl/progs/quake/d_iface.h
@@ -182,6 +182,9 @@ extern byte *r_skysource;
182#define DR_TRANSPARENT 1 182#define DR_TRANSPARENT 1
183 183
184// !!! must be kept the same as in quakeasm.h !!! 184// !!! must be kept the same as in quakeasm.h !!!
185#ifdef TRANSPARENT_COLOR
186#undef TRANSPARENT_COLOR
187#endif
185#define TRANSPARENT_COLOR 0xFF 188#define TRANSPARENT_COLOR 0xFF
186 189
187extern void *acolormap; // FIXME: should go away 190extern void *acolormap; // FIXME: should go away
diff --git a/apps/plugins/sdl/progs/quake/mathlib.h b/apps/plugins/sdl/progs/quake/mathlib.h
index 5f7ae430f1..4a91274589 100644
--- a/apps/plugins/sdl/progs/quake/mathlib.h
+++ b/apps/plugins/sdl/progs/quake/mathlib.h
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
8 8
9This program is distributed in the hope that it will be useful, 9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of 10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 12
13See the GNU General Public License for more details. 13See the GNU General Public License for more details.
14 14
@@ -69,11 +69,13 @@ void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
69//void VectorNormalizeNoRet (vec3_t v); // uses finvsqrt 69//void VectorNormalizeNoRet (vec3_t v); // uses finvsqrt
70//float VectorNormalize (vec3_t v); // returns vector length 70//float VectorNormalize (vec3_t v); // returns vector length
71 71
72#pragma GCC diagnostic push
73#pragma GCC diagnostic ignored "-Wstrict-aliasing"
72static inline float InvSqrt( float number ) { 74static inline float InvSqrt( float number ) {
73 long i; 75 long i;
74 float x2, y; 76 float x2, y;
75 const float threehalfs = 1.5F; 77 const float threehalfs = 1.5F;
76 78
77 x2 = number * 0.5F; 79 x2 = number * 0.5F;
78 y = number; 80 y = number;
79 i = * ( long * ) &y; // evil floating point bit level hacking 81 i = * ( long * ) &y; // evil floating point bit level hacking
@@ -84,13 +86,14 @@ static inline float InvSqrt( float number ) {
84 86
85 return y; 87 return y;
86} 88}
89#pragma GCC diagnostic pop
87 90
88static inline void VectorNormalizeNoRet (vec3_t v) 91static inline void VectorNormalizeNoRet (vec3_t v)
89{ 92{
90 float length, ilength; 93 float length, ilength;
91 94
92 ilength = InvSqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); 95 ilength = InvSqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
93 96
94 v[0] *= ilength; 97 v[0] *= ilength;
95 v[1] *= ilength; 98 v[1] *= ilength;
96 v[2] *= ilength; 99 v[2] *= ilength;
@@ -110,7 +113,7 @@ static inline float VectorNormalize (vec3_t v)
110 v[1] *= ilength; 113 v[1] *= ilength;
111 v[2] *= ilength; 114 v[2] *= ilength;
112 } 115 }
113 116
114 return length; 117 return length;
115 118
116} 119}
diff --git a/apps/plugins/sdl/progs/quake/net.h b/apps/plugins/sdl/progs/quake/net.h
index 813472c0c6..6b6be3d36e 100644
--- a/apps/plugins/sdl/progs/quake/net.h
+++ b/apps/plugins/sdl/progs/quake/net.h
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
8 8
9This program is distributed in the hope that it will be useful, 9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of 10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 12
13See the GNU General Public License for more details. 13See the GNU General Public License for more details.
14 14
@@ -126,7 +126,7 @@ typedef struct qsocket_s
126 qboolean disconnected; 126 qboolean disconnected;
127 qboolean canSend; 127 qboolean canSend;
128 qboolean sendNext; 128 qboolean sendNext;
129 129
130 int driver; 130 int driver;
131 int landriver; 131 int landriver;
132 int socket; 132 int socket;
@@ -314,7 +314,7 @@ typedef struct _PollProcedure
314{ 314{
315 struct _PollProcedure *next; 315 struct _PollProcedure *next;
316 double nextTime; 316 double nextTime;
317 void (*procedure)(); 317 void (*procedure)(void *);
318 void *arg; 318 void *arg;
319} PollProcedure; 319} PollProcedure;
320 320
diff --git a/apps/plugins/sdl/progs/quake/server.h b/apps/plugins/sdl/progs/quake/server.h
index 5fe33deca0..c0d879ec7d 100644
--- a/apps/plugins/sdl/progs/quake/server.h
+++ b/apps/plugins/sdl/progs/quake/server.h
@@ -250,7 +250,7 @@ void SV_MoveToGoal (void);
250 250
251void SV_CheckForNewClients (void); 251void SV_CheckForNewClients (void);
252void SV_RunClients (void); 252void SV_RunClients (void);
253void SV_SaveSpawnparms (); 253void SV_SaveSpawnparms (void);
254#ifdef QUAKE2 254#ifdef QUAKE2
255void SV_SpawnServer (char *server, char *startspot); 255void SV_SpawnServer (char *server, char *startspot);
256#else 256#else
diff --git a/apps/plugins/sdl/progs/wolf3d/id_in.h b/apps/plugins/sdl/progs/wolf3d/id_in.h
index 90e0c05109..31c79ef61b 100644
--- a/apps/plugins/sdl/progs/wolf3d/id_in.h
+++ b/apps/plugins/sdl/progs/wolf3d/id_in.h
@@ -165,12 +165,12 @@ extern ScanCode IN_WaitForKey(void);
165extern word IN_GetJoyButtonsDB(word joy); 165extern word IN_GetJoyButtonsDB(word joy);
166extern const char *IN_GetScanName(ScanCode); 166extern const char *IN_GetScanName(ScanCode);
167 167
168void IN_WaitAndProcessEvents(); 168void IN_WaitAndProcessEvents(void);
169void IN_ProcessEvents(); 169void IN_ProcessEvents(void);
170 170
171int IN_MouseButtons (void); 171int IN_MouseButtons (void);
172 172
173boolean IN_JoyPresent(); 173boolean IN_JoyPresent(void);
174void IN_SetJoyCurrent(int joyIndex); 174void IN_SetJoyCurrent(int joyIndex);
175int IN_JoyButtons (void); 175int IN_JoyButtons (void);
176void IN_GetJoyDelta(int *dx,int *dy); 176void IN_GetJoyDelta(int *dx,int *dy);
@@ -178,6 +178,6 @@ void IN_GetJoyFineDelta(int *dx, int *dy);
178 178
179void IN_StartAck(void); 179void IN_StartAck(void);
180boolean IN_CheckAck (void); 180boolean IN_CheckAck (void);
181bool IN_IsInputGrabbed(); 181bool IN_IsInputGrabbed(void);
182void IN_CenterMouse(); 182void IN_CenterMouse(void);
183#endif 183#endif
diff --git a/apps/plugins/sdl/progs/wolf3d/id_pm.h b/apps/plugins/sdl/progs/wolf3d/id_pm.h
index bbedb78c78..f8c4ae26b0 100644
--- a/apps/plugins/sdl/progs/wolf3d/id_pm.h
+++ b/apps/plugins/sdl/progs/wolf3d/id_pm.h
@@ -17,40 +17,40 @@ extern bool PMSoundInfoPagePadded;
17// The last pointer points one byte after the last page. 17// The last pointer points one byte after the last page.
18extern uint8_t **PMPages; 18extern uint8_t **PMPages;
19 19
20void PM_Startup(); 20void PM_Startup(void);
21void PM_Shutdown(); 21void PM_Shutdown(void);
22 22
23static uint32_t PM_GetPageSize(int page) 23static inline uint32_t PM_GetPageSize(int page)
24{ 24{
25 if(page < 0 || page >= ChunksInFile) 25 if(page < 0 || page >= ChunksInFile)
26 Quit("PM_GetPageSize: Tried to access illegal page: %i", page); 26 Quit("PM_GetPageSize: Tried to access illegal page: %i", page);
27 return (uint32_t) (PMPages[page + 1] - PMPages[page]); 27 return (uint32_t) (PMPages[page + 1] - PMPages[page]);
28} 28}
29 29
30static uint8_t *PM_GetPage(int page) 30static inline uint8_t *PM_GetPage(int page)
31{ 31{
32 if(page < 0 || page >= ChunksInFile) 32 if(page < 0 || page >= ChunksInFile)
33 Quit("PM_GetPage: Tried to access illegal page: %i", page); 33 Quit("PM_GetPage: Tried to access illegal page: %i", page);
34 return PMPages[page]; 34 return PMPages[page];
35} 35}
36 36
37static uint8_t *PM_GetEnd() 37static inline uint8_t *PM_GetEnd(void)
38{ 38{
39 return PMPages[ChunksInFile]; 39 return PMPages[ChunksInFile];
40} 40}
41 41
42static byte *PM_GetTexture(int wallpic) 42static inline byte *PM_GetTexture(int wallpic)
43{ 43{
44 return PM_GetPage(wallpic); 44 return PM_GetPage(wallpic);
45} 45}
46 46
47static uint16_t *PM_GetSprite(int shapenum) 47static inline uint16_t *PM_GetSprite(int shapenum)
48{ 48{
49 // correct alignment is enforced by PM_Startup() 49 // correct alignment is enforced by PM_Startup()
50 return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum); 50 return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum);
51} 51}
52 52
53static byte *PM_GetSound(int soundpagenum) 53static inline byte *PM_GetSound(int soundpagenum)
54{ 54{
55 return PM_GetPage(PMSoundStart + soundpagenum); 55 return PM_GetPage(PMSoundStart + soundpagenum);
56} 56}
diff --git a/apps/plugins/sdl/progs/wolf3d/id_us.h b/apps/plugins/sdl/progs/wolf3d/id_us.h
index 84958631f7..6a1f7ea3ff 100644
--- a/apps/plugins/sdl/progs/wolf3d/id_us.h
+++ b/apps/plugins/sdl/progs/wolf3d/id_us.h
@@ -96,6 +96,6 @@ void USL_PrintInCenter(const char *s,Rect r);
96char *USL_GiveSaveName(word game); 96char *USL_GiveSaveName(word game);
97 97
98void US_InitRndT(int randomize); 98void US_InitRndT(int randomize);
99int US_RndT(); 99int US_RndT(void);
100 100
101#endif 101#endif
diff --git a/apps/plugins/sdl/progs/wolf3d/id_vh.h b/apps/plugins/sdl/progs/wolf3d/id_vh.h
index 814e28d49c..fc9f738fe9 100644
--- a/apps/plugins/sdl/progs/wolf3d/id_vh.h
+++ b/apps/plugins/sdl/progs/wolf3d/id_vh.h
@@ -64,7 +64,7 @@ void VWB_Vlin (int y1, int y2, int x, int color);
64#define VWB_HlinScaledCoord VW_Hlin 64#define VWB_HlinScaledCoord VW_Hlin
65#define VWB_VlinScaledCoord VW_Vlin 65#define VWB_VlinScaledCoord VW_Vlin
66 66
67void VH_UpdateScreen(); 67void VH_UpdateScreen(void);
68#define VW_UpdateScreen VH_UpdateScreen 68#define VW_UpdateScreen VH_UpdateScreen
69 69
70// 70//
@@ -91,7 +91,7 @@ void LatchDrawPic (unsigned x, unsigned y, unsigned picnum);
91void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum); 91void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum);
92void LoadLatchMem (void); 92void LoadLatchMem (void);
93 93
94void VH_Startup(); 94void VH_Startup(void);
95boolean FizzleFade (SDL_Surface *source, int x1, int y1, 95boolean FizzleFade (SDL_Surface *source, int x1, int y1,
96 unsigned width, unsigned height, unsigned frames, boolean abortable); 96 unsigned width, unsigned height, unsigned frames, boolean abortable);
97 97
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_def.h b/apps/plugins/sdl/progs/wolf3d/wl_def.h
index af74a5315c..63cd22f4e8 100644
--- a/apps/plugins/sdl/progs/wolf3d/wl_def.h
+++ b/apps/plugins/sdl/progs/wolf3d/wl_def.h
@@ -961,7 +961,7 @@ void DrawPlayBorder (void);
961void DrawStatusBorder (byte color); 961void DrawStatusBorder (byte color);
962void DrawPlayScreen (void); 962void DrawPlayScreen (void);
963void DrawPlayBorderSides (void); 963void DrawPlayBorderSides (void);
964void ShowActStatus(); 964void ShowActStatus(void);
965 965
966void PlayDemo (int demonumber); 966void PlayDemo (int demonumber);
967void RecordDemo (void); 967void RecordDemo (void);
@@ -1372,7 +1372,7 @@ void GP2X_ButtonUp(int button);
1372============================================================================= 1372=============================================================================
1373*/ 1373*/
1374 1374
1375static fixed FixedMul(fixed a, fixed b) 1375static inline fixed FixedMul(fixed a, fixed b)
1376{ 1376{
1377 return (fixed)(((int64_t)a * b + 0x8000) >> 16); 1377 return (fixed)(((int64_t)a * b + 0x8000) >> 16);
1378} 1378}
@@ -1394,13 +1394,13 @@ static fixed FixedMul(fixed a, fixed b)
1394 1394
1395#define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__) 1395#define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__)
1396 1396
1397static char* itoa(int value, char* string, int radix) 1397static inline char* itoa(int value, char* string, int radix)
1398{ 1398{
1399 sprintf(string, "%d", value); 1399 sprintf(string, "%d", value);
1400 return string; 1400 return string;
1401} 1401}
1402 1402
1403static char* ltoa(long value, char* string, int radix) 1403static inline char* ltoa(long value, char* string, int radix)
1404{ 1404{
1405 sprintf(string, "%ld", value); 1405 sprintf(string, "%ld", value);
1406 return string; 1406 return string;
@@ -1409,14 +1409,14 @@ static char* ltoa(long value, char* string, int radix)
1409#define lengthof(x) (sizeof(x) / sizeof(*(x))) 1409#define lengthof(x) (sizeof(x) / sizeof(*(x)))
1410#define endof(x) ((x) + lengthof(x)) 1410#define endof(x) ((x) + lengthof(x))
1411 1411
1412static word READWORD(byte **ptr) 1412static inline word READWORD(byte **ptr)
1413{ 1413{
1414 word val = (*ptr)[0] | (*ptr)[1] << 8; 1414 word val = (*ptr)[0] | (*ptr)[1] << 8;
1415 *ptr += 2; 1415 *ptr += 2;
1416 return val; 1416 return val;
1417} 1417}
1418 1418
1419static longword READLONGWORD(byte **ptr) 1419static inline longword READLONGWORD(byte **ptr)
1420{ 1420{
1421 longword val = (*ptr)[0] | (*ptr)[1] << 8 | (*ptr)[2] << 16 | (*ptr)[3] << 24; 1421 longword val = (*ptr)[0] | (*ptr)[1] << 8 | (*ptr)[2] << 16 | (*ptr)[3] << 24;
1422 *ptr += 4; 1422 *ptr += 4;
@@ -1454,7 +1454,7 @@ static longword READLONGWORD(byte **ptr)
1454 *************************************************************/ 1454 *************************************************************/
1455 1455
1456 // The feature flags are stored as a wall in the upper right corner of each level 1456 // The feature flags are stored as a wall in the upper right corner of each level
1457 static word GetFeatureFlags() 1457 static inline word GetFeatureFlags()
1458 { 1458 {
1459 return ffDataTopRight; 1459 return ffDataTopRight;
1460 } 1460 }
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_draw.c b/apps/plugins/sdl/progs/wolf3d/wl_draw.c
index 625e93dc0a..09db5af05d 100644
--- a/apps/plugins/sdl/progs/wolf3d/wl_draw.c
+++ b/apps/plugins/sdl/progs/wolf3d/wl_draw.c
@@ -251,7 +251,7 @@ boolean TransformTile (int tx, int ty, short *dispx, short *dispheight)
251==================== 251====================
252*/ 252*/
253 253
254int CalcHeight() 254int CalcHeight(void)
255{ 255{
256 fixed z = FixedMul(xintercept - viewx, viewcos) 256 fixed z = FixedMul(xintercept - viewx, viewcos)
257 - FixedMul(yintercept - viewy, viewsin); 257 - FixedMul(yintercept - viewy, viewsin);
@@ -275,7 +275,7 @@ byte *postsource;
275int postx; 275int postx;
276int postwidth; 276int postwidth;
277 277
278void ScalePost() 278void ScalePost(void)
279{ 279{
280 int ywcount, yoffs, yw, yd, yendoffs; 280 int ywcount, yoffs, yw, yd, yendoffs;
281 byte col; 281 byte col;
@@ -1091,7 +1091,7 @@ void CalcTics (void)
1091 1091
1092//========================================================================== 1092//==========================================================================
1093 1093
1094void AsmRefresh() 1094void AsmRefresh(void)
1095{ 1095{
1096 int32_t xstep,ystep; 1096 int32_t xstep,ystep;
1097 longword xpartial,ypartial; 1097 longword xpartial,ypartial;
@@ -1517,7 +1517,7 @@ void WallRefresh (void)
1517 ScalePost (); // no more optimization on last post 1517 ScalePost (); // no more optimization on last post
1518} 1518}
1519 1519
1520void CalcViewVariables() 1520void CalcViewVariables(void)
1521{ 1521{
1522 viewangle = player->angle; 1522 viewangle = player->angle;
1523 midangle = viewangle*(FINEANGLES/ANGLES); 1523 midangle = viewangle*(FINEANGLES/ANGLES);
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_menu.h b/apps/plugins/sdl/progs/wolf3d/wl_menu.h
index c56fd7f576..2d5a5fe4c3 100644
--- a/apps/plugins/sdl/progs/wolf3d/wl_menu.h
+++ b/apps/plugins/sdl/progs/wolf3d/wl_menu.h
@@ -118,10 +118,10 @@ extern CP_iteminfo MainItems;
118 118
119void US_ControlPanel(ScanCode); 119void US_ControlPanel(ScanCode);
120 120
121void EnableEndGameMenuItem(); 121void EnableEndGameMenuItem(void);
122 122
123void SetupControlPanel(void); 123void SetupControlPanel(void);
124void SetupSaveGames(); 124void SetupSaveGames(void);
125void CleanupControlPanel(void); 125void CleanupControlPanel(void);
126 126
127void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items); 127void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items);