diff options
Diffstat (limited to 'apps/plugins/sdl/progs/duke3d/Game')
18 files changed, 34 insertions, 785 deletions
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/dpmi.h b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/dpmi.h index 0ca6b93a6a..adfb216f03 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/dpmi.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/dpmi.h | |||
@@ -33,11 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
33 | 33 | ||
34 | #include "SDL.h" | 34 | #include "SDL.h" |
35 | 35 | ||
36 | #ifdef _WIN32 | ||
37 | #include "../../../Engine/src/windows/inttypes.h" | ||
38 | #else | ||
39 | #include <inttypes.h> | 36 | #include <inttypes.h> |
40 | #endif | ||
41 | 37 | ||
42 | enum DPMI_Errors | 38 | enum DPMI_Errors |
43 | { | 39 | { |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/fx_man.h b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/fx_man.h index c8361716e3..9e74a381e4 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/fx_man.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/fx_man.h | |||
@@ -32,11 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
32 | #define __FX_MAN_H | 32 | #define __FX_MAN_H |
33 | 33 | ||
34 | #include "sndcards.h" | 34 | #include "sndcards.h" |
35 | #ifdef _WIN32 | 35 | #include <inttypes.h> |
36 | #include "../../Engine/src/windows/inttypes.h" | ||
37 | #else | ||
38 | #include <inttypes.h> | ||
39 | #endif | ||
40 | 36 | ||
41 | typedef struct | 37 | typedef struct |
42 | { | 38 | { |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/task_man.c b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/task_man.c index c39135fedb..c6e2cd6e9e 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/task_man.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/audiolib/task_man.c | |||
@@ -856,121 +856,3 @@ int TS_LockMemory | |||
856 | } | 856 | } |
857 | 857 | ||
858 | #endif | 858 | #endif |
859 | |||
860 | /* | ||
861 | // Converts a hex byte to an integer | ||
862 | |||
863 | static int btoi | ||
864 | ( | ||
865 | unsigned char bcd | ||
866 | ) | ||
867 | |||
868 | { | ||
869 | unsigned b; | ||
870 | unsigned c; | ||
871 | unsigned d; | ||
872 | |||
873 | b = bcd / 16; | ||
874 | c = bcd - b * 16; | ||
875 | d = b * 10 + c; | ||
876 | return( d ); | ||
877 | } | ||
878 | |||
879 | |||
880 | static void RestoreRealTimeClock | ||
881 | ( | ||
882 | void | ||
883 | ) | ||
884 | |||
885 | { | ||
886 | int read; | ||
887 | int i; | ||
888 | int hr; | ||
889 | int min; | ||
890 | int sec; | ||
891 | int cent; | ||
892 | int yr; | ||
893 | int mo; | ||
894 | int day; | ||
895 | int year; | ||
896 | union REGS inregs; | ||
897 | |||
898 | // Read Real Time Clock Time. | ||
899 | read = FALSE; | ||
900 | inregs.h.ah = 0x02; | ||
901 | for( i = 1; i <= 3; i++ ) | ||
902 | { | ||
903 | int386( 0x1A, &inregs, &inregs ); | ||
904 | if ( inregs.x.cflag == 0 ) | ||
905 | { | ||
906 | read = TRUE; | ||
907 | } | ||
908 | } | ||
909 | |||
910 | if ( read ) | ||
911 | { | ||
912 | //and convert BCD to integer format | ||
913 | hr = btoi( inregs.h.ch ); | ||
914 | min = btoi( inregs.h.cl ); | ||
915 | sec = btoi( inregs.h.dh ); | ||
916 | |||
917 | // Read Real Time Clock Date. | ||
918 | inregs.h.ah = 0x04; | ||
919 | int386( 0x1A, &inregs, &inregs ); | ||
920 | if ( inregs.x.cflag == 0 ) | ||
921 | { | ||
922 | //and convert BCD to integer format | ||
923 | cent = btoi( inregs.h.ch ); | ||
924 | yr = btoi( inregs.h.cl ); | ||
925 | mo = btoi( inregs.h.dh ); | ||
926 | day = btoi( inregs.h.dl ); | ||
927 | year = cent * 100 + yr; | ||
928 | |||
929 | // Set System Time. | ||
930 | inregs.h.ch = hr; | ||
931 | inregs.h.cl = min; | ||
932 | inregs.h.dh = sec; | ||
933 | inregs.h.dl = 0; | ||
934 | inregs.h.ah = 0x2D; | ||
935 | int386( 0x21, &inregs, &inregs ); | ||
936 | |||
937 | // Set System Date. | ||
938 | inregs.w.cx = year; | ||
939 | inregs.h.dh = mo; | ||
940 | inregs.h.dl = day; | ||
941 | inregs.h.ah = 0x2B; | ||
942 | int386( 0x21, &inregs, &inregs ); | ||
943 | } | ||
944 | } | ||
945 | } | ||
946 | */ | ||
947 | /* | ||
948 | struct dostime_t time; | ||
949 | struct dosdate_t date; | ||
950 | |||
951 | outp(0x70,0); | ||
952 | time.second=inp(0x71); | ||
953 | outp(0x70,2); | ||
954 | time.minute=inp(0x71); | ||
955 | outp(0x70,4); | ||
956 | time.hour=inp(0x71); | ||
957 | |||
958 | outp(0x70,7); | ||
959 | date.day=inp(0x71); | ||
960 | outp(0x70,8); | ||
961 | date.month=inp(0x71); | ||
962 | outp(0x70,9); | ||
963 | date.year=inp(0x71); | ||
964 | |||
965 | time.second=(time.second&0x0f)+((time.second>>4)*10); | ||
966 | time.minute=(time.minute&0x0f)+((time.minute>>4)*10); | ||
967 | time.hour=(time.hour&0x0f)+((time.hour>>4)*10); | ||
968 | |||
969 | date.day=(date.day&0x0f)+((date.day>>4)*10); | ||
970 | date.month=(date.month&0x0f)+((date.month>>4)*10); | ||
971 | date.year=(date.year&0x0f)+((date.year>>4)*10); | ||
972 | |||
973 | _dos_settime(&time); | ||
974 | _dos_setdate(&date); | ||
975 | |||
976 | */ | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/config.c b/apps/plugins/sdl/progs/duke3d/Game/src/config.c index 1649c40b07..f3d05d093c 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/config.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/config.c | |||
@@ -24,11 +24,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
24 | */ | 24 | */ |
25 | //------------------------------------------------------------------------- | 25 | //------------------------------------------------------------------------- |
26 | 26 | ||
27 | #if PLATFORM_DOS | ||
28 | #include <conio.h> | ||
29 | #include <dos.h> | ||
30 | #endif | ||
31 | |||
32 | #include <stdio.h> | 27 | #include <stdio.h> |
33 | #include <string.h> | 28 | #include <string.h> |
34 | #include <stdlib.h> | 29 | #include <stdlib.h> |
@@ -698,18 +693,11 @@ void CONFIG_ReadSetup( void ) | |||
698 | } | 693 | } |
699 | SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXDevice",&FXDevice); | 694 | SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXDevice",&FXDevice); |
700 | 695 | ||
701 | #if !PLATFORM_DOS // reimplementation of ASS expects a "SoundScape". | ||
702 | if (FXDevice != NumSoundCards) | 696 | if (FXDevice != NumSoundCards) |
703 | FXDevice = SoundScape; | 697 | FXDevice = SoundScape; |
704 | #endif | ||
705 | 698 | ||
706 | SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicDevice",&MusicDevice); | 699 | SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicDevice",&MusicDevice); |
707 | 700 | ||
708 | //#if !PLATFORM_DOS // reimplementation of ASS expects a "SoundScape". | ||
709 | // if (MusicDevice != NumSoundCards) | ||
710 | // MusicDevice = SoundScape; | ||
711 | //#endif | ||
712 | |||
713 | // FIX_00015: Forced NumVoices=8, NumChannels=2, NumBits=16, MixRate=44100, ScreenMode = x( | 701 | // FIX_00015: Forced NumVoices=8, NumChannels=2, NumBits=16, MixRate=44100, ScreenMode = x( |
714 | // (ScreenMode has no meaning anymore) | 702 | // (ScreenMode has no meaning anymore) |
715 | 703 | ||
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 054cb96914..1e6319c807 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/cvar_defs.h | |||
@@ -1,11 +1,7 @@ | |||
1 | #ifndef _CVARDEFS_H_ | 1 | #ifndef _CVARDEFS_H_ |
2 | #define _CVARDEFS_H_ | 2 | #define _CVARDEFS_H_ |
3 | 3 | ||
4 | #ifdef _WIN32 | 4 | #include <inttypes.h> |
5 | #include "../../Engine/src/windows/inttypes.h" | ||
6 | #else | ||
7 | #include <inttypes.h> | ||
8 | #endif | ||
9 | 5 | ||
10 | void CVARDEFS_Init(); | 6 | void CVARDEFS_Init(); |
11 | void CVARDEFS_Render(); | 7 | void CVARDEFS_Render(); |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h b/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h index 2ad341e58e..206e16a9c4 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/cvars.h | |||
@@ -4,11 +4,7 @@ | |||
4 | #define REGCONVAR(varname, varhelp, variable, function) CVAR_RegisterCvar(varname, varhelp, &variable, &function) | 4 | #define REGCONVAR(varname, varhelp, variable, function) CVAR_RegisterCvar(varname, varhelp, &variable, &function) |
5 | #define REGCONFUNC(varname, varhelp, function) CVAR_RegisterCvar(varname, varhelp, NULL, &function) | 5 | #define REGCONFUNC(varname, varhelp, function) CVAR_RegisterCvar(varname, varhelp, NULL, &function) |
6 | 6 | ||
7 | #ifdef _WIN32 | 7 | #include <inttypes.h> |
8 | #include "../../Engine/src/windows/inttypes.h" | ||
9 | #else | ||
10 | #include <inttypes.h> | ||
11 | #endif | ||
12 | 8 | ||
13 | typedef void (*function_t) (void* binding); | 9 | typedef void (*function_t) (void* binding); |
14 | 10 | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/duke3d.h b/apps/plugins/sdl/progs/duke3d/Game/src/duke3d.h index fee94d961a..02c88a42c7 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/duke3d.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/duke3d.h | |||
@@ -28,11 +28,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
28 | 28 | ||
29 | #include "platform.h" | 29 | #include "platform.h" |
30 | 30 | ||
31 | #ifdef _WIN32 | ||
32 | #include "../../Engine/src/windows/inttypes.h" | ||
33 | #else | ||
34 | #include <inttypes.h> | 31 | #include <inttypes.h> |
35 | #endif | ||
36 | 32 | ||
37 | #include <fcntl.h> | 33 | #include <fcntl.h> |
38 | #include <time.h> | 34 | #include <time.h> |
@@ -50,26 +46,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
50 | #endif | 46 | #endif |
51 | #endif | 47 | #endif |
52 | 48 | ||
53 | #if PLATFORM_DOS | ||
54 | #include <dos.h> | ||
55 | #include <bios.h> | ||
56 | #include <io.h> | ||
57 | #define PATH_SEP_CHAR '\\' | ||
58 | #define PATH_SEP_STR "\\" | ||
59 | #endif | ||
60 | |||
61 | #if PLATFORM_UNIX && !defined(ROCKBOX) | ||
62 | #include "dukeunix.h" | ||
63 | #endif | ||
64 | |||
65 | #if PLATFORM_MACOSX | ||
66 | #include "dukeunix.h" | ||
67 | #endif | ||
68 | |||
69 | #if PLATFORM_WIN32 | ||
70 | #include "dukewin.h" | ||
71 | #endif | ||
72 | |||
73 | #ifdef ROCKBOX | 49 | #ifdef ROCKBOX |
74 | #define PLATFORM_ROCKBOX 1 | 50 | #define PLATFORM_ROCKBOX 1 |
75 | #endif | 51 | #endif |
@@ -524,11 +500,6 @@ extern struct player_struct ps[MAXPLAYERS]; | |||
524 | extern struct player_orig po[MAXPLAYERS]; | 500 | extern struct player_orig po[MAXPLAYERS]; |
525 | extern struct user_defs ud; | 501 | extern struct user_defs ud; |
526 | 502 | ||
527 | // ported build engine has this, too. --ryan. | ||
528 | #if PLATFORM_DOS | ||
529 | extern short int moustat; | ||
530 | #endif | ||
531 | |||
532 | extern short int global_random; | 503 | extern short int global_random; |
533 | extern int32_t scaredfallz; | 504 | extern int32_t scaredfallz; |
534 | extern char buf[80]; //My own generic input buffer | 505 | extern char buf[80]; //My own generic input buffer |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/dukerockbox.h b/apps/plugins/sdl/progs/duke3d/Game/src/dukerockbox.h index 9035336b8a..a5806b14b9 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/dukerockbox.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/dukerockbox.h | |||
@@ -32,25 +32,6 @@ | |||
32 | #define O_BINARY 0 | 32 | #define O_BINARY 0 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | struct find_t | ||
36 | { | ||
37 | DIR *dir; | ||
38 | char pattern[MAX_PATH]; | ||
39 | char name[MAX_PATH]; | ||
40 | }; | ||
41 | int _dos_findfirst(char *filename, int x, struct find_t *f); | ||
42 | int _dos_findnext(struct find_t *f); | ||
43 | |||
44 | struct dosdate_t | ||
45 | { | ||
46 | uint8_t day; | ||
47 | uint8_t month; | ||
48 | unsigned int year; | ||
49 | uint8_t dayofweek; | ||
50 | }; | ||
51 | |||
52 | void _dos_getdate(struct dosdate_t *date); | ||
53 | |||
54 | #ifndef min | 35 | #ifndef min |
55 | #define min(x, y) ((x) < (y) ? (x) : (y)) | 36 | #define min(x, y) ((x) < (y) ? (x) : (y)) |
56 | #endif | 37 | #endif |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/dukeunix.h b/apps/plugins/sdl/progs/duke3d/Game/src/dukeunix.h deleted file mode 100644 index 451d174785..0000000000 --- a/apps/plugins/sdl/progs/duke3d/Game/src/dukeunix.h +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | // | ||
2 | // dukeunix.h | ||
3 | // Duke3D | ||
4 | // | ||
5 | // Created by fabien sanglard on 12-12-12. | ||
6 | // Copyright (c) 2012 fabien sanglard. All rights reserved. | ||
7 | // | ||
8 | |||
9 | #ifndef Duke3D_dukeunix_h | ||
10 | #define Duke3D_dukeunix_h | ||
11 | |||
12 | |||
13 | #define cdecl | ||
14 | #define __far | ||
15 | #define __interrupt | ||
16 | |||
17 | |||
18 | //#define STUBBED(x) | ||
19 | #ifdef __SUNPRO_C | ||
20 | #define STUBBED(x) fprintf(stderr,"STUB: %s (??? %s:%d)\n",x,__FILE__,__LINE__) | ||
21 | #else | ||
22 | #define STUBBED(x) fprintf(stderr,"STUB: %s (%s, %s:%d)\n",x,__FUNCTION__,__FILE__,__LINE__) | ||
23 | #endif | ||
24 | |||
25 | #define PATH_SEP_CHAR '/' | ||
26 | #define PATH_SEP_STR "/" | ||
27 | #define ROOTDIR "/" | ||
28 | #define CURDIR "./" | ||
29 | |||
30 | #ifndef O_BINARY | ||
31 | #define O_BINARY 0 | ||
32 | #endif | ||
33 | |||
34 | #include <unistd.h> | ||
35 | #include <fcntl.h> | ||
36 | #include <sys/stat.h> | ||
37 | #include <sys/types.h> | ||
38 | #include <dirent.h> | ||
39 | #include <assert.h> | ||
40 | |||
41 | struct find_t | ||
42 | { | ||
43 | DIR *dir; | ||
44 | char pattern[MAX_PATH]; | ||
45 | char name[MAX_PATH]; | ||
46 | }; | ||
47 | int _dos_findfirst(char *filename, int x, struct find_t *f); | ||
48 | int _dos_findnext(struct find_t *f); | ||
49 | |||
50 | struct dosdate_t | ||
51 | { | ||
52 | uint8_t day; | ||
53 | uint8_t month; | ||
54 | unsigned int year; | ||
55 | uint8_t dayofweek; | ||
56 | }; | ||
57 | |||
58 | void _dos_getdate(struct dosdate_t *date); | ||
59 | |||
60 | #ifndef min | ||
61 | #define min(x, y) ((x) < (y) ? (x) : (y)) | ||
62 | #endif | ||
63 | |||
64 | #ifndef max | ||
65 | #define max(x, y) ((x) > (y) ? (x) : (y)) | ||
66 | #endif | ||
67 | |||
68 | |||
69 | |||
70 | #ifndef strcmpi | ||
71 | #define strcmpi(x, y) strcasecmp(x, y) | ||
72 | #endif | ||
73 | |||
74 | #ifdef DC | ||
75 | #undef stderr | ||
76 | #undef stdout | ||
77 | #undef getchar | ||
78 | /* kos compat */ | ||
79 | #define stderr ((FILE*)2) | ||
80 | #define stdout ((FILE*)2) | ||
81 | #define Z_AvailHeap() ((10 * 1024) * 1024) | ||
82 | #else | ||
83 | // 64 megs should be enough for anybody. :) --ryan. | ||
84 | #define Z_AvailHeap() ((64 * 1024) * 1024) | ||
85 | #endif | ||
86 | |||
87 | #define printchrasm(x,y,ch) printf("%c", (uint8_t ) (ch & 0xFF)) | ||
88 | |||
89 | #ifdef __GNUC__ | ||
90 | #define GCC_PACK1_EXT __attribute__((packed,aligned(1))) | ||
91 | #endif | ||
92 | |||
93 | |||
94 | // FCS: Game.c features calls to mkdir without the proper flags. | ||
95 | // Giving all access is ugly but it is just game OK ! | ||
96 | #define mkdir(X) mkdir(X,0777) | ||
97 | |||
98 | #define getch getchar | ||
99 | |||
100 | #endif | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/dukewin.h b/apps/plugins/sdl/progs/duke3d/Game/src/dukewin.h deleted file mode 100644 index f35becb401..0000000000 --- a/apps/plugins/sdl/progs/duke3d/Game/src/dukewin.h +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | #ifndef _INCL_DUKEWIN_H_ | ||
2 | #define _INCL_DUKEWIN_H_ 1 | ||
3 | |||
4 | #ifndef _MSC_VER /* might need this. */ | ||
5 | typedef int32_t int32_t __int64; | ||
6 | #endif | ||
7 | |||
8 | #pragma warning(disable:4761) | ||
9 | |||
10 | #if USE_SDL | ||
11 | #include "SDL.h" | ||
12 | #endif | ||
13 | |||
14 | #ifdef _DEBUG | ||
15 | #define STUBBED(x) printf("STUB: %s in %s:%d\n", x, __FILE__, __LINE__) | ||
16 | #else | ||
17 | #define STUBBED(x) | ||
18 | #endif | ||
19 | |||
20 | #define PATH_SEP_CHAR '\\' | ||
21 | #define PATH_SEP_STR "\\" | ||
22 | |||
23 | #include <sys/stat.h> | ||
24 | #include <io.h> | ||
25 | #include <assert.h> | ||
26 | |||
27 | struct find_t | ||
28 | { | ||
29 | int32_t handle; | ||
30 | struct _finddata_t data; | ||
31 | uint8_t name[MAX_PATH]; | ||
32 | }; | ||
33 | int _dos_findfirst(uint8_t *filename, int x, struct find_t *f); | ||
34 | int _dos_findnext(struct find_t *f); | ||
35 | |||
36 | struct dosdate_t | ||
37 | { | ||
38 | uint8_t day; | ||
39 | uint8_t month; | ||
40 | unsigned int year; | ||
41 | uint8_t dayofweek; | ||
42 | }; | ||
43 | |||
44 | void _dos_getdate(struct dosdate_t *date); | ||
45 | |||
46 | #ifndef min | ||
47 | #define min(x, y) ((x) < (y) ? (x) : (y)) | ||
48 | #endif | ||
49 | |||
50 | #ifndef max | ||
51 | #define max(x, y) ((x) > (y) ? (x) : (y)) | ||
52 | #endif | ||
53 | |||
54 | #ifdef FP_OFF | ||
55 | #undef FP_OFF | ||
56 | #endif | ||
57 | #define FP_OFF(x) ((int32_t) (x)) | ||
58 | |||
59 | // 64 megs should be enough for anybody. :) --ryan. | ||
60 | #define Z_AvailHeap() ((64 * 1024) * 1024) | ||
61 | |||
62 | #define printchrasm(x,y,ch) printf("%c", (uint8_t ) (ch & 0xFF)) | ||
63 | |||
64 | #define cdecl | ||
65 | |||
66 | #define open _open | ||
67 | #define O_BINARY _O_BINARY | ||
68 | #define O_RDONLY _O_RDONLY | ||
69 | #define O_WRONLY _O_WRONLY | ||
70 | #define O_RDWR _O_RDWR | ||
71 | #define O_TRUNC _O_TRUNC | ||
72 | #define O_CREAT _O_CREAT | ||
73 | #define S_IREAD _S_IREAD | ||
74 | #define S_IWRITE _S_IWRITE | ||
75 | #define S_IRDWR _S_IRDWR | ||
76 | |||
77 | #define S_IRUSR S_IREAD | ||
78 | #define S_IWUSR S_IWRITE | ||
79 | #define S_IRGRP 0 | ||
80 | #define S_IWGRP 0 | ||
81 | |||
82 | #define F_OK 0 | ||
83 | |||
84 | #define HAVE_PRAGMA_PACK 1 | ||
85 | |||
86 | #endif | ||
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/game.c b/apps/plugins/sdl/progs/duke3d/Game/src/game.c index 0cb1d95b86..8b2c0e959f 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/game.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/game.c | |||
@@ -24,11 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | //------------------------------------------------------------------------- | 25 | //------------------------------------------------------------------------- |
26 | 26 | ||
27 | #ifdef _WIN32 | ||
28 | #include <windows.h> | ||
29 | #else | ||
30 | #include "SDL.h" | 27 | #include "SDL.h" |
31 | #endif | ||
32 | 28 | ||
33 | #include "types.h" | 29 | #include "types.h" |
34 | 30 | ||
@@ -113,38 +109,12 @@ void pitch_test( void ); | |||
113 | uint8_t restorepalette,screencapt,nomorelogohack; | 109 | uint8_t restorepalette,screencapt,nomorelogohack; |
114 | int sendmessagecommand = -1; | 110 | int sendmessagecommand = -1; |
115 | 111 | ||
116 | #if PLATFORM_DOS | ||
117 | task *TimerPtr=NULL; | ||
118 | #endif | ||
119 | |||
120 | extern int32_t lastvisinc; | 112 | extern int32_t lastvisinc; |
121 | 113 | ||
122 | // Build Engine port implements this. --ryan. | ||
123 | #if PLATFORM_DOS | ||
124 | static void timerhandler(task *unused) | ||
125 | { | ||
126 | totalclock++; | ||
127 | } | ||
128 | |||
129 | void inittimer() | ||
130 | { | ||
131 | TimerPtr = TS_ScheduleTask( timerhandler,TICRATE, 1, NULL ); | ||
132 | TS_Dispatch(); | ||
133 | } | ||
134 | |||
135 | void uninittimer(void) | ||
136 | { | ||
137 | if (TimerPtr) | ||
138 | TS_Terminate( TimerPtr ); | ||
139 | TimerPtr = NULL; | ||
140 | TS_Shutdown(); | ||
141 | } | ||
142 | #else | ||
143 | void timerhandler(void) | 114 | void timerhandler(void) |
144 | { | 115 | { |
145 | totalclock++; | 116 | totalclock++; |
146 | } | 117 | } |
147 | #endif | ||
148 | 118 | ||
149 | int gametext(int x,int y,char *t,uint8_t s,short dabits) | 119 | int gametext(int x,int y,char *t,uint8_t s,short dabits) |
150 | { | 120 | { |
@@ -2471,11 +2441,7 @@ GOTOHERE: | |||
2471 | if(true) | 2441 | if(true) |
2472 | { | 2442 | { |
2473 | if(*t == ' ' && *(t+1) == 0) *t = 0; | 2443 | if(*t == ' ' && *(t+1) == 0) *t = 0; |
2474 | #if PLATFORM_DOS // Is there a good reason for this? --ryan. | ||
2475 | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); | ||
2476 | #else | ||
2477 | printf("\n%s\n",t); | 2444 | printf("\n%s\n",t); |
2478 | #endif | ||
2479 | } | 2445 | } |
2480 | // CTW END - MODIFICATION | 2446 | // CTW END - MODIFICATION |
2481 | } | 2447 | } |
@@ -7818,18 +7784,11 @@ void Startup(void) | |||
7818 | if(networkmode == 255) | 7784 | if(networkmode == 255) |
7819 | networkmode = 1; | 7785 | networkmode = 1; |
7820 | 7786 | ||
7821 | #ifdef PLATFORM_DOS | ||
7822 | puts("Checking music inits."); | ||
7823 | MusicStartup(); | ||
7824 | puts("Checking sound inits."); | ||
7825 | SoundStartup(); | ||
7826 | #else | ||
7827 | /* SBF - wasn't sure if swapping them would harm anything. */ | 7787 | /* SBF - wasn't sure if swapping them would harm anything. */ |
7828 | puts("Checking sound inits."); | 7788 | puts("Checking sound inits."); |
7829 | SoundStartup(); | 7789 | SoundStartup(); |
7830 | puts("Checking music inits."); | 7790 | puts("Checking music inits."); |
7831 | MusicStartup(); | 7791 | MusicStartup(); |
7832 | #endif | ||
7833 | 7792 | ||
7834 | // AutoAim | 7793 | // AutoAim |
7835 | if(nHostForceDisableAutoaim) | 7794 | if(nHostForceDisableAutoaim) |
@@ -8019,64 +7978,6 @@ void getnames(void) | |||
8019 | 7978 | ||
8020 | 7979 | ||
8021 | const char* const baseDir="duke3d*.grp"; | 7980 | const char* const baseDir="duke3d*.grp"; |
8022 | #ifdef _WIN32 | ||
8023 | |||
8024 | void findGRPToUse(uint8_t * groupfilefullpath) | ||
8025 | { | ||
8026 | WIN32_FIND_DATA FindFileData; | ||
8027 | HANDLE hFind = INVALID_HANDLE_VALUE; | ||
8028 | int i=0,kbdKey ; | ||
8029 | char groupfile[9][512]; | ||
8030 | int grpID ; | ||
8031 | |||
8032 | if(getGameDir()[0] != '\0') | ||
8033 | { | ||
8034 | sprintf(groupfilefullpath, "%s\\%s", getGameDir(), baseDir); | ||
8035 | hFind = FindFirstFile(groupfilefullpath, &FindFileData); | ||
8036 | if (hFind == INVALID_HANDLE_VALUE) | ||
8037 | { | ||
8038 | sprintf(groupfilefullpath, "%s", baseDir); | ||
8039 | } | ||
8040 | else | ||
8041 | FindClose(hFind); | ||
8042 | } | ||
8043 | else | ||
8044 | sprintf(groupfilefullpath, "%s", baseDir); | ||
8045 | |||
8046 | printf("Searching '%d':\n\n",groupfilefullpath); | ||
8047 | hFind = FindFirstFile(groupfilefullpath,&FindFileData); | ||
8048 | |||
8049 | if ( hFind==INVALID_HANDLE_VALUE ) | ||
8050 | Error(EXIT_SUCCESS, "Can't find '%s'\n", groupfilefullpath); | ||
8051 | |||
8052 | do | ||
8053 | { | ||
8054 | i++; | ||
8055 | sprintf(groupfile[i-1], "%s", FindFileData.cFileName); | ||
8056 | printf("Found GRP #%d:\t%d Bytes\t %s \n", i, FindFileData.nFileSizeLow, groupfile[i-1]); | ||
8057 | } while ( FindNextFile(hFind, &FindFileData) && i < 9 ); | ||
8058 | |||
8059 | if(i==1) | ||
8060 | grpID = 0; | ||
8061 | else | ||
8062 | { | ||
8063 | printf("\n-> Choose a base GRP file from 1 to %c: ",'0' + i); | ||
8064 | do | ||
8065 | kbdKey = getch(); | ||
8066 | while(kbdKey < '1' || kbdKey > ('0' + i)); | ||
8067 | printf("%c\n", kbdKey); | ||
8068 | grpID = groupfile[kbdKey-'1']; | ||
8069 | |||
8070 | } | ||
8071 | |||
8072 | FindClose(hFind); | ||
8073 | if (strlen(getGameDir()) == 0) | ||
8074 | sprintf(groupfilefullpath, "./%s", groupfile[grpID]); | ||
8075 | else | ||
8076 | sprintf(groupfilefullpath, "%s//%s", getGameDir(), groupfile[grpID]); | ||
8077 | } | ||
8078 | |||
8079 | #else | ||
8080 | 7981 | ||
8081 | int dukeGRP_Match(char* filename,int length) | 7982 | int dukeGRP_Match(char* filename,int length) |
8082 | { | 7983 | { |
@@ -8126,8 +8027,6 @@ void findGRPToUse(char * groupfilefullpath){ | |||
8126 | } | 8027 | } |
8127 | } | 8028 | } |
8128 | 8029 | ||
8129 | #endif | ||
8130 | |||
8131 | static int load_duke3d_groupfile(void) | 8030 | static int load_duke3d_groupfile(void) |
8132 | { | 8031 | { |
8133 | // FIX_00032: Added multi base GRP manager. Use duke3d*.grp to handle multiple grp. | 8032 | // FIX_00032: Added multi base GRP manager. Use duke3d*.grp to handle multiple grp. |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/gamedef.c b/apps/plugins/sdl/progs/duke3d/Game/src/gamedef.c index 52e2abaed6..af58c45deb 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/gamedef.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/gamedef.c | |||
@@ -1155,11 +1155,7 @@ uint8_t parsecommand(int readfromGRP) | |||
1155 | break; | 1155 | break; |
1156 | } | 1156 | } |
1157 | } | 1157 | } |
1158 | #ifdef PLATFORM_UNIX | ||
1159 | volume_names[j][i] = '\0'; | 1158 | volume_names[j][i] = '\0'; |
1160 | #else | ||
1161 | volume_names[j][i-1] = '\0'; | ||
1162 | #endif | ||
1163 | return 0; | 1159 | return 0; |
1164 | case 108: | 1160 | case 108: |
1165 | scriptptr--; | 1161 | scriptptr--; |
@@ -1182,11 +1178,7 @@ uint8_t parsecommand(int readfromGRP) | |||
1182 | break; | 1178 | break; |
1183 | } | 1179 | } |
1184 | } | 1180 | } |
1185 | #if defined(PLATFORM_UNIX) || defined(PLATFORM_ROCKBOX) | ||
1186 | skill_names[j][i] = '\0'; | 1181 | skill_names[j][i] = '\0'; |
1187 | #else | ||
1188 | skill_names[j][i-1] = '\0'; | ||
1189 | #endif | ||
1190 | return 0; | 1182 | return 0; |
1191 | 1183 | ||
1192 | case 0: | 1184 | case 0: |
@@ -1212,11 +1204,7 @@ uint8_t parsecommand(int readfromGRP) | |||
1212 | break; | 1204 | break; |
1213 | } | 1205 | } |
1214 | } | 1206 | } |
1215 | #if defined(PLATFORM_UNIX) || defined(PLATFORM_ROCKBOX) | ||
1216 | level_names[j*11+k][i] = '\0'; | 1207 | level_names[j*11+k][i] = '\0'; |
1217 | #else | ||
1218 | level_names[j*11+k][i-1] = '\0'; | ||
1219 | #endif | ||
1220 | while( *textptr == ' ' ) textptr++; | 1208 | while( *textptr == ' ' ) textptr++; |
1221 | 1209 | ||
1222 | partime[j*11+k] = | 1210 | partime[j*11+k] = |
@@ -1247,11 +1235,7 @@ uint8_t parsecommand(int readfromGRP) | |||
1247 | break; | 1235 | break; |
1248 | } | 1236 | } |
1249 | } | 1237 | } |
1250 | #ifdef PLATFORM_UNIX | ||
1251 | level_names[j*11+k][i] = '\0'; | 1238 | level_names[j*11+k][i] = '\0'; |
1252 | #else | ||
1253 | level_names[j*11+k][i-1] = '\0'; | ||
1254 | #endif | ||
1255 | return 0; | 1239 | return 0; |
1256 | 1240 | ||
1257 | case 79: | 1241 | case 79: |
@@ -1570,11 +1554,7 @@ void loadefs(char *filenam, char *mptr, int readfromGRP) | |||
1570 | //ud.conCRC[0] = crc32_update((uint8_t *)textptr, fs, ud.conCRC[0]); | 1554 | //ud.conCRC[0] = crc32_update((uint8_t *)textptr, fs, ud.conCRC[0]); |
1571 | } | 1555 | } |
1572 | 1556 | ||
1573 | #ifdef PLATFORM_UNIX | ||
1574 | textptr[fs - 1] = 0; | 1557 | textptr[fs - 1] = 0; |
1575 | #else | ||
1576 | textptr[fs - 2] = 0; | ||
1577 | #endif | ||
1578 | 1558 | ||
1579 | clearbuf(actorscrptr,MAXSPRITES,0L); | 1559 | clearbuf(actorscrptr,MAXSPRITES,0L); |
1580 | clearbufbyte(actortype,MAXSPRITES,0L); | 1560 | clearbufbyte(actortype,MAXSPRITES,0L); |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/global.c b/apps/plugins/sdl/progs/duke3d/Game/src/global.c index 57c561edd6..b0f4442d32 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/global.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/global.c | |||
@@ -76,11 +76,6 @@ int32_t gc,neartaghitdist,lockclock,max_player_health,max_armour_amount,max_ammo | |||
76 | struct weaponhit hittype[MAXSPRITES]; | 76 | struct weaponhit hittype[MAXSPRITES]; |
77 | short spriteq[1024],spriteqloc,spriteqamount=64; | 77 | short spriteq[1024],spriteqloc,spriteqamount=64; |
78 | 78 | ||
79 | // ported build engine has this, too. --ryan. | ||
80 | #if PLATFORM_DOS | ||
81 | short moustat = 0; | ||
82 | #endif | ||
83 | |||
84 | struct animwalltype animwall[MAXANIMWALLS]; | 79 | struct animwalltype animwall[MAXANIMWALLS]; |
85 | short numanimwalls; | 80 | short numanimwalls; |
86 | int32_t *animateptr[MAXANIMATES], animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt; | 81 | int32_t *animateptr[MAXANIMATES], animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt; |
@@ -232,7 +227,6 @@ int32_t *curipos[MAXINTERPOLATIONS]; | |||
232 | 227 | ||
233 | void FixFilePath(char *filename) | 228 | void FixFilePath(char *filename) |
234 | { | 229 | { |
235 | #if PLATFORM_UNIX || PLATFORM_ROCKBOX | ||
236 | uint8_t *ptr; | 230 | uint8_t *ptr; |
237 | uint8_t *lastsep = filename; | 231 | uint8_t *lastsep = filename; |
238 | 232 | ||
@@ -304,74 +298,8 @@ void FixFilePath(char *filename) | |||
304 | return; | 298 | return; |
305 | } | 299 | } |
306 | } | 300 | } |
307 | #endif | ||
308 | } | ||
309 | |||
310 | |||
311 | #if PLATFORM_DOS | ||
312 | /* no-op. */ | ||
313 | |||
314 | #elif PLATFORM_WIN32 | ||
315 | int _dos_findfirst(uint8_t *filename, int x, struct find_t *f) | ||
316 | { | ||
317 | int32_t rc = _findfirst(filename, &f->data); | ||
318 | f->handle = rc; | ||
319 | if (rc != -1) | ||
320 | { | ||
321 | strncpy(f->name, f->data.name, sizeof (f->name) - 1); | ||
322 | f->name[sizeof (f->name) - 1] = '\0'; | ||
323 | return(0); | ||
324 | } | ||
325 | return(1); | ||
326 | } | ||
327 | |||
328 | int _dos_findnext(struct find_t *f) | ||
329 | { | ||
330 | int rc = 0; | ||
331 | if (f->handle == -1) | ||
332 | return(1); /* invalid handle. */ | ||
333 | |||
334 | rc = _findnext(f->handle, &f->data); | ||
335 | if (rc == -1) | ||
336 | { | ||
337 | _findclose(f->handle); | ||
338 | f->handle = -1; | ||
339 | return(1); | ||
340 | } | ||
341 | |||
342 | strncpy(f->name, f->data.name, sizeof (f->name) - 1); | ||
343 | f->name[sizeof (f->name) - 1] = '\0'; | ||
344 | return(0); | ||
345 | } | ||
346 | |||
347 | #elif defined(PLATFORM_UNIX) || defined(PLATFORM_MACOSX) || defined(PLATFORM_ROCKBOX) | ||
348 | int _dos_findfirst(char *filename, int x, struct find_t *f) | ||
349 | { | ||
350 | char *ptr; | ||
351 | |||
352 | if (strlen(filename) >= sizeof (f->pattern)) | ||
353 | return(1); | ||
354 | |||
355 | strcpy(f->pattern, filename); | ||
356 | FixFilePath(f->pattern); | ||
357 | ptr = strrchr(f->pattern, PATH_SEP_CHAR); | ||
358 | |||
359 | if (ptr == NULL) | ||
360 | { | ||
361 | ptr = filename; | ||
362 | f->dir = opendir(CURDIR); | ||
363 | } | ||
364 | else | ||
365 | { | ||
366 | *ptr = '\0'; | ||
367 | f->dir = opendir(f->pattern); | ||
368 | memmove(f->pattern, ptr + 1, strlen(ptr + 1) + 1); | ||
369 | } | ||
370 | |||
371 | return(_dos_findnext(f)); | ||
372 | } | 301 | } |
373 | 302 | ||
374 | |||
375 | static int check_pattern_nocase(const char *x, const char *y) | 303 | static int check_pattern_nocase(const char *x, const char *y) |
376 | { | 304 | { |
377 | if ((x == NULL) || (y == NULL)) | 305 | if ((x == NULL) || (y == NULL)) |
@@ -409,53 +337,6 @@ static int check_pattern_nocase(const char *x, const char *y) | |||
409 | return(*x == *y); /* it's a match (both should be EOS). */ | 337 | return(*x == *y); /* it's a match (both should be EOS). */ |
410 | } | 338 | } |
411 | 339 | ||
412 | int _dos_findnext(struct find_t *f) | ||
413 | { | ||
414 | struct dirent *dent; | ||
415 | |||
416 | if (f->dir == NULL) | ||
417 | return(1); /* no such dir or we're just done searching. */ | ||
418 | |||
419 | while ((dent = readdir(f->dir)) != NULL) | ||
420 | { | ||
421 | if (check_pattern_nocase(f->pattern, dent->d_name)) | ||
422 | { | ||
423 | if (strlen(dent->d_name) < sizeof (f->name)) | ||
424 | { | ||
425 | strcpy(f->name, dent->d_name); | ||
426 | return(0); /* match. */ | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | |||
431 | closedir(f->dir); | ||
432 | f->dir = NULL; | ||
433 | return(1); /* no match in whole directory. */ | ||
434 | } | ||
435 | #else | ||
436 | #error please define for your platform. | ||
437 | #endif | ||
438 | |||
439 | |||
440 | #if !PLATFORM_DOS | ||
441 | void _dos_getdate(struct dosdate_t *date) | ||
442 | { | ||
443 | time_t curtime = time(NULL); | ||
444 | |||
445 | if (date == NULL) { | ||
446 | return; | ||
447 | } | ||
448 | |||
449 | memset(date, 0, sizeof(struct dosdate_t)); | ||
450 | |||
451 | date->day = 1; | ||
452 | date->month = 1; | ||
453 | date->year = 1970; | ||
454 | date->dayofweek = 4; | ||
455 | } | ||
456 | #endif | ||
457 | |||
458 | |||
459 | int FindDistance2D(int ix, int iy) | 340 | int FindDistance2D(int ix, int iy) |
460 | { | 341 | { |
461 | int t; | 342 | int t; |
@@ -560,11 +441,7 @@ int32 SafeOpenAppend (const char *_filename, int32 filetype) | |||
560 | filename[sizeof (filename) - 1] = '\0'; | 441 | filename[sizeof (filename) - 1] = '\0'; |
561 | FixFilePath(filename); | 442 | FixFilePath(filename); |
562 | 443 | ||
563 | #if (defined PLATFORM_WIN32) | ||
564 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND ); | ||
565 | #else | ||
566 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND , 0666); | 444 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND , 0666); |
567 | #endif | ||
568 | 445 | ||
569 | if (handle == -1) | 446 | if (handle == -1) |
570 | Error (EXIT_FAILURE, "Error opening for append %s: %s",filename,strerror(errno)); | 447 | Error (EXIT_FAILURE, "Error opening for append %s: %s",filename,strerror(errno)); |
@@ -579,11 +456,7 @@ boolean SafeFileExists ( const char * _filename ) | |||
579 | filename[sizeof (filename) - 1] = '\0'; | 456 | filename[sizeof (filename) - 1] = '\0'; |
580 | FixFilePath(filename); | 457 | FixFilePath(filename); |
581 | 458 | ||
582 | #if( defined PLATFORM_WIN32) | 459 | return(rb->file_exists(filename)); |
583 | return(access(filename, 6) == 0); | ||
584 | #else | ||
585 | return(rb->file_exists(filename)); | ||
586 | #endif | ||
587 | } | 460 | } |
588 | 461 | ||
589 | 462 | ||
@@ -595,12 +468,8 @@ int32 SafeOpenWrite (const char *_filename, int32 filetype) | |||
595 | filename[sizeof (filename) - 1] = '\0'; | 468 | filename[sizeof (filename) - 1] = '\0'; |
596 | FixFilePath(filename); | 469 | FixFilePath(filename); |
597 | 470 | ||
598 | #if (defined PLATFORM_WIN32) | ||
599 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC ); | ||
600 | #else | ||
601 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC | 471 | handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC |
602 | , 0666); | 472 | , 0666); |
603 | #endif | ||
604 | 473 | ||
605 | if (handle == -1) | 474 | if (handle == -1) |
606 | Error (EXIT_FAILURE, "Error opening %s: %s",filename,strerror(errno)); | 475 | Error (EXIT_FAILURE, "Error opening %s: %s",filename,strerror(errno)); |
@@ -783,7 +652,6 @@ void SwapIntelShortArray(short *s, int num) | |||
783 | Stolen for Duke3D, too. | 652 | Stolen for Duke3D, too. |
784 | */ | 653 | */ |
785 | 654 | ||
786 | #if PLATFORM_UNIX | ||
787 | uint8_t *strlwr(uint8_t *s) | 655 | uint8_t *strlwr(uint8_t *s) |
788 | { | 656 | { |
789 | uint8_t *p = s; | 657 | uint8_t *p = s; |
@@ -858,13 +726,11 @@ uint8_t *ultoa(uint32_t value, uint8_t *string, int radix) | |||
858 | 726 | ||
859 | return string; | 727 | return string; |
860 | } | 728 | } |
861 | #endif | ||
862 | 729 | ||
863 | char ApogeePath[256]; | 730 | char ApogeePath[256]; |
864 | 731 | ||
865 | int setup_homedir (void) | 732 | int setup_homedir (void) |
866 | { | 733 | { |
867 | #if PLATFORM_UNIX | ||
868 | int err; | 734 | int err; |
869 | 735 | ||
870 | snprintf (ApogeePath, sizeof (ApogeePath), "%s/.duke3d/", getenv ("HOME")); | 736 | snprintf (ApogeePath, sizeof (ApogeePath), "%s/.duke3d/", getenv ("HOME")); |
@@ -877,9 +743,6 @@ int setup_homedir (void) | |||
877 | strerror (errno)); | 743 | strerror (errno)); |
878 | return -1; | 744 | return -1; |
879 | } | 745 | } |
880 | #else | ||
881 | sprintf(ApogeePath, ".%s", PATH_SEP_STR); | ||
882 | #endif | ||
883 | 746 | ||
884 | return 0; | 747 | return 0; |
885 | } | 748 | } |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/global.h b/apps/plugins/sdl/progs/duke3d/Game/src/global.h index e0be16f500..ab7d6eb634 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/global.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/global.h | |||
@@ -18,23 +18,11 @@ int FindDistance3D(int ix, int iy, int iz); | |||
18 | void Shutdown(void); | 18 | void Shutdown(void); |
19 | 19 | ||
20 | #ifndef LITTLE_ENDIAN | 20 | #ifndef LITTLE_ENDIAN |
21 | #ifdef __APPLE__ | 21 | #define LITTLE_ENDIAN 1234 |
22 | #else | ||
23 | #define LITTLE_ENDIAN 1234 | ||
24 | #endif | ||
25 | #endif | 22 | #endif |
26 | 23 | ||
27 | #ifndef BIG_ENDIAN | 24 | #ifndef BIG_ENDIAN |
28 | #ifdef __APPLE__ | 25 | #define BIG_ENDIAN 4321 |
29 | #else | ||
30 | #define BIG_ENDIAN 4321 | ||
31 | #endif | ||
32 | #endif | ||
33 | |||
34 | #if PLATFORM_WIN32 | ||
35 | #ifndef BYTE_ORDER | ||
36 | #define BYTE_ORDER LITTLE_ENDIAN | ||
37 | #endif | ||
38 | #endif | 26 | #endif |
39 | 27 | ||
40 | #ifdef ROCKBOX | 28 | #ifdef ROCKBOX |
@@ -45,15 +33,6 @@ void Shutdown(void); | |||
45 | #endif | 33 | #endif |
46 | #endif | 34 | #endif |
47 | 35 | ||
48 | #ifdef __APPLE__ | ||
49 | #if __powerpc__ | ||
50 | #define BYTE_ORDER BIG_ENDIAN | ||
51 | #else | ||
52 | // Defined in endian.h | ||
53 | // #define BYTE_ORDER LITTLE_ENDIAN | ||
54 | #endif | ||
55 | #endif | ||
56 | |||
57 | #ifndef BYTE_ORDER | 36 | #ifndef BYTE_ORDER |
58 | #error Please define your platform. | 37 | #error Please define your platform. |
59 | #endif | 38 | #endif |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/menues.c b/apps/plugins/sdl/progs/duke3d/Game/src/menues.c index 3585600f43..66ce4123bf 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/menues.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/menues.c | |||
@@ -1245,83 +1245,10 @@ void dispnames(void) | |||
1245 | 1245 | ||
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | |||
1249 | // This is the same thing as was in build.c ... | ||
1250 | // We DO have a _dos_findfirst implementation now...maybe use that instead? | ||
1251 | // --ryan. | ||
1252 | #if ORIGINAL_DUKE3D_GETFILENAMES | ||
1253 | int getfilenames(uint8_t kind[6]) | ||
1254 | { | ||
1255 | short type; | ||
1256 | struct find_t fileinfo; | ||
1257 | |||
1258 | if (strcmp(kind,"SUBD") == 0) | ||
1259 | { | ||
1260 | strcpy(kind,"*.*"); | ||
1261 | if (_dos_findfirst(kind,_A_SUBDIR,&fileinfo) != 0) | ||
1262 | return(-1); | ||
1263 | type = 1; | ||
1264 | } | ||
1265 | else | ||
1266 | { | ||
1267 | if (_dos_findfirst(kind,_A_NORMAL,&fileinfo) != 0) | ||
1268 | return(-1); | ||
1269 | type = 0; | ||
1270 | } | ||
1271 | do | ||
1272 | { | ||
1273 | if ((type == 0) || ((fileinfo.attrib&16) > 0)) | ||
1274 | if ((fileinfo.name[0] != '.') || (fileinfo.name[1] != 0)) | ||
1275 | { | ||
1276 | strcpy(menuname[menunamecnt],fileinfo.name); | ||
1277 | menuname[menunamecnt][16] = type; | ||
1278 | menunamecnt++; | ||
1279 | } | ||
1280 | } | ||
1281 | while (_dos_findnext(&fileinfo) == 0); | ||
1282 | |||
1283 | return(0); | ||
1284 | } | ||
1285 | |||
1286 | #else | ||
1287 | |||
1288 | int getfilenames(char kind[6]) | 1248 | int getfilenames(char kind[6]) |
1289 | { | 1249 | { |
1290 | /* !!! FIXME: Visual C? */ | ||
1291 | #if (defined __WATCOMC__) | ||
1292 | short type; | ||
1293 | struct find_t fileinfo; | ||
1294 | |||
1295 | if (strcmp(kind,"SUBD") == 0) | ||
1296 | { | ||
1297 | strcpy(kind,"*.*"); | ||
1298 | if (_dos_findfirst(kind,_A_SUBDIR,&fileinfo) != 0) | ||
1299 | return(-1); | ||
1300 | type = 1; | ||
1301 | } | ||
1302 | else | ||
1303 | { | ||
1304 | if (_dos_findfirst(kind,_A_NORMAL,&fileinfo) != 0) | ||
1305 | return(-1); | ||
1306 | type = 0; | ||
1307 | } | ||
1308 | do | ||
1309 | { | ||
1310 | if ((type == 0) || ((fileinfo.attrib&16) > 0)) | ||
1311 | if ((fileinfo.name[0] != '.') || (fileinfo.name[1] != 0)) | ||
1312 | { | ||
1313 | strcpy(menuname[menunamecnt],fileinfo.name); | ||
1314 | menuname[menunamecnt][16] = type; | ||
1315 | menunamecnt++; | ||
1316 | } | ||
1317 | } | ||
1318 | while (_dos_findnext(&fileinfo) == 0); | ||
1319 | |||
1320 | #elif (defined PLATFORM_UNIX) | ||
1321 | |||
1322 | DIR *dir; | 1250 | DIR *dir; |
1323 | struct dirent *dent; | 1251 | struct dirent *dent; |
1324 | struct stat statbuf; | ||
1325 | int add_this; | 1252 | int add_this; |
1326 | uint8_t *ptr = NULL; | 1253 | uint8_t *ptr = NULL; |
1327 | int len = 0; | 1254 | int len = 0; |
@@ -1330,7 +1257,7 @@ int getfilenames(char kind[6]) | |||
1330 | if (strcmp(kind,"SUBD") == 0) | 1257 | if (strcmp(kind,"SUBD") == 0) |
1331 | subdirs = 1; | 1258 | subdirs = 1; |
1332 | 1259 | ||
1333 | dir = opendir(getGamedir()); | 1260 | dir = opendir(getGameDir()); |
1334 | if (dir == NULL) | 1261 | if (dir == NULL) |
1335 | return(-1); | 1262 | return(-1); |
1336 | 1263 | ||
@@ -1340,46 +1267,39 @@ int getfilenames(char kind[6]) | |||
1340 | dent = readdir(dir); | 1267 | dent = readdir(dir); |
1341 | if (dent != NULL) | 1268 | if (dent != NULL) |
1342 | { | 1269 | { |
1343 | if (stat(dent->d_name, &statbuf) == 0) | 1270 | if (subdirs) |
1344 | { | 1271 | { |
1345 | if (subdirs) | 1272 | if (rb->dir_exists(dent->d_name)) |
1346 | { | 1273 | add_this = 1; |
1347 | if (S_ISDIR(statbuf.st_mode)) | 1274 | } /* if */ |
1348 | add_this = 1; | 1275 | else |
1349 | } /* if */ | 1276 | { |
1350 | else | 1277 | /* need to expand support if this assertion ever fails. */ |
1351 | { | 1278 | assert(stricmp(kind, "*.MAP") == 0); |
1352 | /* need to expand support if this assertion ever fails. */ | 1279 | len = strlen(dent->d_name); |
1353 | assert(stricmp(kind, "*.MAP") == 0); | 1280 | if (len >= 5) |
1354 | len = strlen(dent->d_name); | 1281 | { |
1355 | if (len >= 5) | 1282 | ptr = ((uint8_t *) dent->d_name) + len; |
1356 | { | 1283 | ptr += strlen(ptr) - 4; |
1357 | ptr = ((uint8_t *) dent->d_name) + len; | 1284 | if (stricmp(ptr, ".MAP") == 0) |
1358 | ptr += strlen(ptr) - 4; | 1285 | add_this = 1; |
1359 | if (stricmp(ptr, ".MAP") == 0) | 1286 | } /* if */ |
1360 | add_this = 1; | 1287 | } /* else */ |
1361 | } /* if */ | 1288 | |
1362 | } /* else */ | 1289 | if (add_this) |
1363 | 1290 | { | |
1364 | if (add_this) | 1291 | strcpy(menuname[menunamecnt],dent->d_name); |
1365 | { | 1292 | menuname[menunamecnt][16] = subdirs; |
1366 | strcpy(menuname[menunamecnt],dent->d_name); | 1293 | menunamecnt++; |
1367 | menuname[menunamecnt][16] = subdirs; | 1294 | } /* if */ |
1368 | menunamecnt++; | ||
1369 | } /* if */ | ||
1370 | } /* if */ | ||
1371 | } /* if */ | 1295 | } /* if */ |
1372 | } while (dent != NULL); | 1296 | } while (dent != NULL); |
1373 | 1297 | ||
1374 | closedir(dir); | 1298 | closedir(dir); |
1375 | 1299 | ||
1376 | #endif | ||
1377 | return(0); | 1300 | return(0); |
1378 | } | 1301 | } |
1379 | 1302 | ||
1380 | #endif | ||
1381 | |||
1382 | |||
1383 | void sortfilenames() | 1303 | void sortfilenames() |
1384 | { | 1304 | { |
1385 | uint8_t sortbuffer[17]; | 1305 | uint8_t sortbuffer[17]; |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/sounds.c b/apps/plugins/sdl/progs/duke3d/Game/src/sounds.c index 0e3c8f6fa9..14d705bb5c 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/sounds.c +++ b/apps/plugins/sdl/progs/duke3d/Game/src/sounds.c | |||
@@ -24,10 +24,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
24 | */ | 24 | */ |
25 | //------------------------------------------------------------------------- | 25 | //------------------------------------------------------------------------- |
26 | 26 | ||
27 | #if PLATFORM_DOS | ||
28 | #include <conio.h> | ||
29 | #endif | ||
30 | |||
31 | #include <stdio.h> | 27 | #include <stdio.h> |
32 | #include <string.h> | 28 | #include <string.h> |
33 | #include "../../Game/src/types.h" | 29 | #include "../../Game/src/types.h" |
diff --git a/apps/plugins/sdl/progs/duke3d/Game/src/types.h b/apps/plugins/sdl/progs/duke3d/Game/src/types.h index 017c851a18..93d6f80c86 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/types.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/types.h | |||
@@ -27,11 +27,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
27 | #ifndef _types_public | 27 | #ifndef _types_public |
28 | #define _types_public | 28 | #define _types_public |
29 | 29 | ||
30 | #ifdef _WIN32 | 30 | #include <inttypes.h> |
31 | #include "../../Engine/src/windows/inttypes.h" | ||
32 | #else | ||
33 | #include <inttypes.h> | ||
34 | #endif | ||
35 | 31 | ||
36 | #ifdef __cplusplus | 32 | #ifdef __cplusplus |
37 | extern "C" { | 33 | extern "C" { |
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 bf9e22d2a6..6519331b77 100644 --- a/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h +++ b/apps/plugins/sdl/progs/duke3d/Game/src/util_lib.h | |||
@@ -30,11 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms | |||
30 | // | 30 | // |
31 | //*************************************************************************** | 31 | //*************************************************************************** |
32 | 32 | ||
33 | #ifdef _WIN32 | 33 | #include <inttypes.h> |
34 | #include "../../Engine/src/windows/inttypes.h" | ||
35 | #else | ||
36 | #include <inttypes.h> | ||
37 | #endif | ||
38 | 34 | ||
39 | #ifndef _util_lib_public | 35 | #ifndef _util_lib_public |
40 | #define _util_lib_public | 36 | #define _util_lib_public |