diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index c8a8ab7d3..eff4b0815 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -149,6 +149,12 @@ ifneq ($(USE_LIBVPX),0) GAMEOBJS+= $(OBJ)/animvpx.$o endif +ifneq (0,$(DISABLEINLINING)) + GAMEOBJS+= $(OBJ)/game_inline.$o \ + $(OBJ)/actors_inline.$o \ + $(OBJ)/sector_inline.$o +endif + MISCGAMEDEPS= @@ -163,7 +169,7 @@ ifneq (0,$(LUNATIC)) ifeq ($(PLATFORM),WINDOWS) OURCFLAGS+= -I$(LUAJIT_WIN_SRC) else - OURCFLAGS+= -I/usr/local/include/luajit-2.0 + OURCFLAGS+= -I/usr/include/luajit-2.0 endif OURCFLAGS+= -I$(SRC)/lunatic -DLUNATIC @@ -319,6 +325,11 @@ ifeq ($(PLATFORM),WII) # -msdata=eabi endif +INVOCATION=$(CC) $(OURCONLYFLAGS) +ifneq ($(CPLUSPLUS),0) + INVOCATION=$(CXX) $(OURCXXFLAGS) +endif + ifeq ($(PRETTY_OUTPUT),1) .SILENT: endif @@ -343,7 +354,7 @@ notice: $(EDUKE32): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) $(MISCGAMEDEPS) $(LINK_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -o $@ $^ $(OURLDFLAGS) $(GAMELDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -o $@ $^ $(OURLDFLAGS) $(GAMELDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi ifeq (1,$(RELEASE)) ifeq (0,$(DEBUGANYWAY)) ifneq ($(PLATFORM),WII) @@ -359,7 +370,7 @@ endif $(MAPSTER32): $(EDITOROBJS) $(EOBJ)/$(EDITORLIB) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(LINK_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -o $@ $^ $(OURLDFLAGS) $(EDITORLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -o $@ $^ $(OURLDFLAGS) $(EDITORLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB); then $(LINK_OK); else $(LINK_FAILED); fi ifeq (1,$(RELEASE)) ifeq (0,$(DEBUGANYWAY)) ifneq ($(PLATFORM),WII) @@ -410,7 +421,7 @@ endif # RULES $(EBACKTRACEDLL): Windows/src/backtrace.c - if $(CC) -O2 -shared -Wall -Wextra -I$(EINC) -o $@ $^ -lbfd -liberty -limagehlp; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(CC) $(OURCONLYFLAGS) -O2 -shared -Wall -Wextra -I$(EINC) -o $@ $^ -lbfd -liberty -limagehlp; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/%.$o: $(SRC)/%.nasm $(COMPILE_STATUS) @@ -418,7 +429,7 @@ $(OBJ)/%.$o: $(SRC)/%.nasm $(OBJ)/%.$o: $(SRC)/%.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi #### Lunatic @@ -435,11 +446,11 @@ endif $(OBJ)/%.$o: $(SRC)/lunatic/%.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/%.$o: $(SRC)/xdelta3/%.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi # TODO: _m32 # List of exported symbols, OS X @@ -459,7 +470,7 @@ $(SRC)/lunatic/eduke32.def: $(SRC)/lunatic/dynsymlist $(OBJ)/%.$o: Apple/%.m $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/%.$o: $(SRC)/%.cc $(COMPILE_STATUS) @@ -475,27 +486,23 @@ $(OBJ)/%.$o: $(SRC)/%.cxx $(OBJ)/%.$o: $(SRC)/jmact/%.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/%.$o: $(SRC)/misc/%.rc $(COMPILE_STATUS) if $(RC) -i $< -o $@ --include-dir=$(EINC) --include-dir=$(SRC) -DPOLYMER=$(POLYMER); then $(COMPILE_OK); else $(COMPILE_FAILED); fi -$(OBJ)/%.$o: $(SRC)/util/%.c - $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - $(OBJ)/%.$o: $(RSRC)/%.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/game_banner.$o: $(RSRC)/game_banner.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(RSRC)/game_banner.c: $(RSRC)/game.bmp echo "#include " > $@ diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index cd62d93d3..39f493106 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -17,8 +17,8 @@ STRIP=strip CLANG?=0 ifneq (0,$(CLANG)) - CC=clang -std=gnu89 - CXX=clang + CC=clang -x c -std=gnu89 + CXX=clang -x c++ # AR=llvm-ar # RANLIB=llvm-ranlib endif @@ -103,22 +103,26 @@ endif # Debugging/Build options +# CPLUSPLUS - 1 = enable C++ building # RELEASE - 1 = no debugging # DEBUGANYWAY - 1 = include debug symbols even when generating release code +# DISABLEINLINING - 1 = compile inline functions as extern instead of static inline # KRANDDEBUG - 1 = include logging of krand() calls for debugging the demo system # EFENCE - 1 = compile with Electric Fence for malloc() debugging # OPTLEVEL - 0..3 = GCC optimization strategy # LTO - 1 = enable link-time optimization, for GCC 4.5 and up # +CPLUSPLUS?=0 RELEASE?=1 DEBUGANYWAY?=0 KRANDDEBUG?=0 +DISABLEINLINING?=0 EFENCE?=0 DMALLOC?=0 OPTLEVEL?=2 PROFILER?=0 MUDFLAP?=0 -LTO?=0 +LTO?=1 ifeq (4,$(GCC_MAJOR)) F_NO_STACK_PROTECTOR := -fno-stack-protector @@ -187,7 +191,7 @@ endif # compiler flags etc. BASECONLYFLAGS=-Wimplicit -Wdeclaration-after-statement -BASECXXFLAGS= -fno-exceptions -fno-rtti +BASECXXFLAGS= -fno-exceptions -fno-rtti -fpermissive BASEASFLAGS=-s #-g BASELDFLAGS= @@ -285,6 +289,10 @@ ifneq (0,$(CLANG)) BASECFLAGS+= -Wno-unused-value -Wno-parentheses endif +ifneq (0,$(DISABLEINLINING)) + BASECFLAGS+= -DDISABLE_INLINING +endif + BASELDFLAGS+= $(OPTOPT) # This should come from the environment: diff --git a/polymer/eduke32/build/Makefile b/polymer/eduke32/build/Makefile index a3ebfff8a..7c8609b66 100644 --- a/polymer/eduke32/build/Makefile +++ b/polymer/eduke32/build/Makefile @@ -174,6 +174,11 @@ endif OURCFLAGS+= $(BUILDCFLAGS) +INVOCATION=$(CC) $(OURCONLYFLAGS) +ifneq ($(CPLUSPLUS),0) + INVOCATION=$(CXX) $(OURCXXFLAGS) +endif + .SILENT: .PHONY: clean cleanutils veryclean all utils enginelib editorlib @@ -296,15 +301,15 @@ $(OBJ)/%.$o: $(SRC)/%.nasm # comment out to debug a-c.o $(OBJ)/a-c.$o: $(SRC)/a-c.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(subst -O0,-O2,$(subst -fcatch-undefined-behavior,,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(subst -O0,-O2,$(subst -fcatch-undefined-behavior,,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/%.$o: $(SRC)/%.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/%.$o: $(SRC)/%.m $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/%.$o: $(SRC)/%.cc $(COMPILE_STATUS) @@ -344,7 +349,7 @@ $(OBJ)/%.$o: $(SRC)/util/%.cxx $(OBJ)/%.$o: $(RSRC)/%.c $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi $(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c echo "#include " > $@ diff --git a/polymer/eduke32/build/Makefile.shared b/polymer/eduke32/build/Makefile.shared index ba04aad56..6b12037d9 100644 --- a/polymer/eduke32/build/Makefile.shared +++ b/polymer/eduke32/build/Makefile.shared @@ -249,9 +249,9 @@ endif ifeq ($(PRETTY_OUTPUT),1) -BUILD_SETTINGS_COMPILER = \033[1;33mcompiler: \033[0;33m\"$(CC) $(OURCFLAGS) $(OURCONLYFLAGS) $(OURCXXFLAGS)\" -BUILD_SETTINGS_ASSEMBLER = \033[1;33massembler: \033[0;33m\"$(AS) $(OURASFLAGS)\" -BUILD_SETTINGS_LINKER = \033[1;33mlinker: \033[0;33m\"$(OURLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB)\" +BUILD_SETTINGS_COMPILER = \033[1;36mcompiler: \033[0;36m\"$(INVOCATION) $(OURCFLAGS)\" +BUILD_SETTINGS_ASSEMBLER = \033[1;36massembler: \033[0;36m\"$(AS) $(OURASFLAGS)\" +BUILD_SETTINGS_LINKER = \033[1;36mlinker: \033[0;36m\"$(OURLDFLAGS) $(LIBS) $(STATICSTDCPP) $(STDCPPLIB)\" ifeq (0,$(NOASM)) BUILD_SETTINGS = printf "$(BUILD_SETTINGS_COMPILER)\n$(BUILD_SETTINGS_ASSEMBLER)\n$(BUILD_SETTINGS_LINKER)\033[0m\n" else diff --git a/polymer/eduke32/build/include/a.h b/polymer/eduke32/build/include/a.h index 6f71115dd..5f0ad9f7b 100644 --- a/polymer/eduke32/build/include/a.h +++ b/polymer/eduke32/build/include/a.h @@ -14,6 +14,11 @@ #define __cdecl #endif +#ifdef __cplusplus +extern "C" +{ +#endif + extern int32_t __cdecl mmxoverlay(); extern int32_t __cdecl sethlinesizes(int32_t,int32_t,int32_t); extern int32_t __cdecl setpalookupaddress(char *); @@ -61,8 +66,17 @@ extern int32_t __cdecl setupdrawslab(int32_t,int32_t); extern int32_t __cdecl drawslab(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); extern void __cdecl stretchhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); +#ifdef __cplusplus +} +#endif + #elif defined(_MSC_VER) && !defined(NOASM) // __GNUC__ && __i386__ +#ifdef __cplusplus +extern "C" +{ +#endif + extern int32_t _cdecl mmxoverlay(); extern int32_t _cdecl sethlinesizes(int32_t,int32_t,int32_t); extern int32_t _cdecl setpalookupaddress(char *); @@ -110,6 +124,10 @@ extern int32_t _cdecl setupdrawslab(int32_t,int32_t); extern int32_t _cdecl drawslab(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); extern void _cdecl stretchhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); +#ifdef __cplusplus +} +#endif + #else // _MSC_VER #define ENGINE_USING_A_C diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index 088546b90..8bb6b1ea4 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -8,7 +8,7 @@ #include "compat.h" #include "osd.h" -#ifdef __cplusplus +#ifdef EXTERNC extern "C" { #endif @@ -107,9 +107,6 @@ void debugprintf(const char *,...) ATTRIBUTE((format(printf,1,2))); int32_t handleevents(void); int32_t handleevents_peekkeys(void); -extern inline void idle(void); -extern inline void idle_waitevent(void); -extern inline void idle_waitevent_timeout(uint32_t timeout); extern void (*keypresscallback)(int32_t,int32_t); extern void (*mousepresscallback)(int32_t,int32_t); @@ -180,7 +177,7 @@ int32_t baselayer_init(); void makeasmwriteable(void); -#ifdef __cplusplus +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 3ebc266fe..e665eaade 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -12,7 +12,7 @@ #include "compat.h" #include "pragmas.h" -#ifdef __cplusplus +#ifdef EXTERNC extern "C" { #endif @@ -274,13 +274,15 @@ typedef struct { uint8_t filler; float alpha; spritetype *tspr; + + #if !defined UINTPTR_MAX # error Need UINTPTR_MAX define to select between 32- and 64-bit structs #endif #if UINTPTR_MAX == 0xffffffff /* On a 32-bit build, pad the struct so it has the same size everywhere. * REMINDER: Will break savegames. */ - const intptr_t dummy_; + intptr_t dummy_; #endif } spriteext_t; @@ -387,7 +389,8 @@ EXTERN int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES]; EXTERN int16_t tilesizx[MAXTILES], tilesizy[MAXTILES]; EXTERN char picsiz[MAXTILES]; EXTERN char walock[MAXTILES]; -EXTERN const int32_t pow2long[32]; +EXTERN char pow2char[8]; +EXTERN int32_t pow2long[32]; EXTERN int32_t picanm[MAXTILES]; EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA @@ -718,8 +721,8 @@ int32_t deletesprite(int16_t spritenum); int32_t changespritesect(int16_t spritenum, int16_t newsectnum); int32_t changespritestat(int16_t spritenum, int16_t newstatnum); -int32_t setsprite(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2))); -int32_t setspritez(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2))); +int32_t setsprite(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2))); +int32_t setspritez(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2))); void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs, int32_t alsotileyofs); @@ -902,7 +905,9 @@ void hash_delete(hashtable_t *t, const char *s); #endif #endif -#ifdef __cplusplus +extern void initialize_engine_globals(void); + +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/build/include/cache1d.h b/polymer/eduke32/build/include/cache1d.h index 22de54fe4..cddb2bcc0 100644 --- a/polymer/eduke32/build/include/cache1d.h +++ b/polymer/eduke32/build/include/cache1d.h @@ -6,7 +6,7 @@ #include "compat.h" #include "mutex.h" -#ifdef __cplusplus +#ifdef EXTERNC extern "C" { #endif @@ -66,7 +66,7 @@ void kdfwrite(const void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil); #endif void dfwrite(const void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil); -#ifdef __cplusplus +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/build/include/common.h b/polymer/eduke32/build/include/common.h index beeadf981..07a17e921 100644 --- a/polymer/eduke32/build/include/common.h +++ b/polymer/eduke32/build/include/common.h @@ -10,6 +10,9 @@ #include "scriptfile.h" #include "cache1d.h" +#ifdef EXTERNC +extern "C" { +#endif //// TYPES struct strllist @@ -69,4 +72,8 @@ int32_t maybe_append_ext(char *wbuf, int32_t wbufsiz, const char *fn, const char #define EDUKE32_TMRTIC t[ti++]=getticks() #define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii # include #elif defined(_MSC_VER) # include "msvc/inttypes.h" // from http://code.google.com/p/msinttypes/ @@ -55,7 +59,7 @@ // library will need to wrap these functions with suitable emulations. #define __compat_h_macrodef__ -#ifdef __cplusplus +#ifdef EXTERNC # include # ifdef __compat_h_macrodef__ # include @@ -69,7 +73,7 @@ #endif #ifdef __compat_h_macrodef__ -# ifndef __cplusplus +# ifndef EXTERNC # include # include # include @@ -124,6 +128,14 @@ static inline float nearbyintf(float x) # define DEBUG_MAIN_ARRAYS #endif +#ifndef DISABLE_INLINING +# define EXTERN_INLINE static inline +# define EXTERN_INLINE_HEADER static inline +#else +# define EXTERN_INLINE +# define EXTERN_INLINE_HEADER extern +#endif + #if !defined DEBUG_MAIN_ARRAYS # define HAVE_CLIPSHAPE_FEATURE #endif @@ -240,7 +252,7 @@ static inline float nearbyintf(float x) # error Unknown endianness #endif -#ifdef __cplusplus +#ifdef EXTERNC # ifndef SCREWED_UP_CPP // using namespace std; @@ -633,7 +645,7 @@ char *Bstrlwr(char *); char *Bstrupr(char *); #endif -#ifdef __cplusplus +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/build/include/crc32.h b/polymer/eduke32/build/include/crc32.h index 690067cb7..844bb3737 100644 --- a/polymer/eduke32/build/include/crc32.h +++ b/polymer/eduke32/build/include/crc32.h @@ -3,7 +3,7 @@ #include "compat.h" -#ifdef __cplusplus +#ifdef EXTERNC extern "C" { #endif @@ -32,7 +32,7 @@ static inline uint32_t crc32finish(uint32_t *crcvar) return *crcvar; } -#ifdef __cplusplus +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 5f574701e..d2ce1d286 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -7,8 +7,8 @@ #include -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif #define VERSION "2.0.0devel" @@ -318,7 +318,7 @@ extern int32_t scripthistend; #define AIMING_AT_WALL_OR_MASK (AIMING_AT_WALL || AIMING_AT_MASKWALL) #define AIMING_AT_CEILING_OR_FLOOR (AIMING_AT_CEILING || AIMING_AT_FLOOR) -#ifdef __cplusplus +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/build/include/glext.h b/polymer/eduke32/build/include/glext.h index 09400215b..e04537b1c 100644 --- a/polymer/eduke32/build/include/glext.h +++ b/polymer/eduke32/build/include/glext.h @@ -1,7 +1,7 @@ #ifndef __glext_h_ #define __glext_h_ -#ifdef __cplusplus +#ifdef EXTERNC extern "C" { #endif @@ -11481,7 +11481,7 @@ typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLe #endif -#ifdef __cplusplus +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/build/include/kplib.h b/polymer/eduke32/build/include/kplib.h index 531cd55ed..955882dd2 100644 --- a/polymer/eduke32/build/include/kplib.h +++ b/polymer/eduke32/build/include/kplib.h @@ -1,3 +1,7 @@ +#ifdef EXTERNC +extern "C" { +#endif + //High-level (easy) picture loading function: extern void kpzload (const char *, intptr_t *, int32_t *, int32_t *, int32_t *); //Low-level PNG/JPG functions: @@ -19,3 +23,7 @@ extern void kzclose (); extern void kzfindfilestart (const char *); //pass wildcard string extern int32_t kzfindfile (char *); //you alloc buf, returns 1:found,0:~found + +#ifdef EXTERNC +} +#endif diff --git a/polymer/eduke32/build/include/mutex.h b/polymer/eduke32/build/include/mutex.h index bd0f2b7a5..0ef2600be 100644 --- a/polymer/eduke32/build/include/mutex.h +++ b/polymer/eduke32/build/include/mutex.h @@ -12,6 +12,10 @@ # include #endif +#ifdef EXTERNC +extern "C" { +#endif + #if defined(_WIN32) typedef HANDLE mutex_t; #elif !defined GEKKO @@ -26,4 +30,9 @@ extern int32_t mutex_init(mutex_t *mutex); extern int32_t mutex_lock(mutex_t *mutex); extern int32_t mutex_unlock(mutex_t *mutex); + +#ifdef EXTERNC +} +#endif + #endif diff --git a/polymer/eduke32/build/include/osd.h b/polymer/eduke32/build/include/osd.h index 005d18ff7..b73ced1f6 100644 --- a/polymer/eduke32/build/include/osd.h +++ b/polymer/eduke32/build/include/osd.h @@ -5,6 +5,9 @@ #ifndef __osd_h__ #define __osd_h__ +#ifdef EXTERNC +extern "C" { +#endif typedef struct { int32_t numparms; @@ -22,7 +25,7 @@ typedef struct _symbol int32_t (*func)(const osdfuncparm_t *); } symbol_t; -symbol_t *symbols; +extern symbol_t *symbols; const char *OSD_StripColors(char *out, const char *in); @@ -198,5 +201,9 @@ extern char osdhistorybuf[OSD_HISTORYDEPTH][OSD_EDITLENGTH+1]; // history strin extern int32_t osdhistorysize; // number of entries in history extern int32_t osdhistorytotal; // number of total history entries +#ifdef EXTERNC +} +#endif + #endif // __osd_h__ diff --git a/polymer/eduke32/build/include/pragmas.h b/polymer/eduke32/build/include/pragmas.h index 948dbfde1..e53954ad6 100644 --- a/polymer/eduke32/build/include/pragmas.h +++ b/polymer/eduke32/build/include/pragmas.h @@ -5,7 +5,7 @@ #ifndef __pragmas_h__ #define __pragmas_h__ -#ifdef __cplusplus +#ifdef EXTERNC extern "C" { #endif @@ -2293,7 +2293,7 @@ void copybufreverse(const void *S, void *D, int32_t c); #endif -#ifdef __cplusplus +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/build/include/quicklz.h b/polymer/eduke32/build/include/quicklz.h index 33a5c0c06..9addedcbf 100644 --- a/polymer/eduke32/build/include/quicklz.h +++ b/polymer/eduke32/build/include/quicklz.h @@ -122,8 +122,7 @@ typedef struct } qlz_state_decompress; #endif - -#if defined (__cplusplus) +#ifdef EXTERNC extern "C" { #endif @@ -137,7 +136,7 @@ int qlz_get_setting(int setting); extern qlz_state_compress *state_compress; extern qlz_state_decompress *state_decompress; -#if defined (__cplusplus) +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/build/include/scriptfile.h b/polymer/eduke32/build/include/scriptfile.h index 05042630a..a2d008524 100644 --- a/polymer/eduke32/build/include/scriptfile.h +++ b/polymer/eduke32/build/include/scriptfile.h @@ -2,6 +2,10 @@ #ifndef BUILD_SCRIPTFILE_H_ #define BUILD_SCRIPTFILE_H_ +#ifdef EXTERNC +extern "C" { +#endif + typedef struct { char *textbuf; uint32_t textlength; @@ -30,4 +34,8 @@ int32_t scriptfile_getsymbolvalue(char *name, int32_t *val); int32_t scriptfile_addsymbolvalue(char *name, int32_t val); void scriptfile_clearsymbols(void); +#ifdef EXTERNC +} +#endif + #endif diff --git a/polymer/eduke32/build/include/sdlayer.h b/polymer/eduke32/build/include/sdlayer.h index 44b329c99..d8d205511 100644 --- a/polymer/eduke32/build/include/sdlayer.h +++ b/polymer/eduke32/build/include/sdlayer.h @@ -5,6 +5,8 @@ #ifndef __build_interface_layer__ #define __build_interface_layer__ SDL +#include "sdl_inc.h" +#include "compat.h" #include "baselayer.h" struct sdlappicon { @@ -13,6 +15,21 @@ struct sdlappicon { uint8_t *mask; }; +static inline void idle_waitevent_timeout(uint32_t timeout) +{ + SDL_WaitEventTimeout(NULL, timeout); +} + +static inline void idle_waitevent(void) +{ + SDL_WaitEvent(NULL); +} + +static inline void idle(void) +{ + usleep(1000); +} + #else #if (__build_interface_layer__ != SDL) #error "Already using the " __build_interface_layer__ ". Can't now use SDL." diff --git a/polymer/eduke32/build/include/winlayer.h b/polymer/eduke32/build/include/winlayer.h index 1ca6a4a68..a67ff2617 100644 --- a/polymer/eduke32/build/include/winlayer.h +++ b/polymer/eduke32/build/include/winlayer.h @@ -18,6 +18,18 @@ int32_t win_gethinstance(void); void win_allowtaskswitching(int32_t onf); int32_t win_checkinstance(void); +extern void idle_waitevent_timeout(uint32_t timeout); + +static inline void idle_waitevent(void) +{ + idle_waitevent_timeout(100); +} + +static inline void idle(void) +{ + idle_waitevent(); +} + #include "baselayer.h" #else diff --git a/polymer/eduke32/build/src/baselayer.c b/polymer/eduke32/build/src/baselayer.c index 7dd4be45a..69ac98379 100644 --- a/polymer/eduke32/build/src/baselayer.c +++ b/polymer/eduke32/build/src/baselayer.c @@ -370,6 +370,8 @@ int32_t baselayer_init(void) polymost_initosdfuncs(); #endif + initialize_engine_globals(); + return 0; } diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 0578f6153..fd9bc57a9 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -16,6 +16,8 @@ #include "baselayer.h" #ifdef RENDERTYPEWIN #include "winlayer.h" +#else +#include "sdlayer.h" #endif #include "m32script.h" diff --git a/polymer/eduke32/build/src/cache1d.c b/polymer/eduke32/build/src/cache1d.c index fb970959d..e51f7d786 100644 --- a/polymer/eduke32/build/src/cache1d.c +++ b/polymer/eduke32/build/src/cache1d.c @@ -78,7 +78,25 @@ static int32_t lockrecip[200]; int32_t cacnum = 0; cactype cac[MAXCACHEOBJECTS]; -static char toupperlookup[256]; +static char toupperlookup[256] = +{ + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, + 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, + 0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, + 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x7b,0x7c,0x7d,0x7e,0x7f, + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, + 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, + 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf, + 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf, + 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, + 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, + 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff +}; static void reportandexit(const char *errormessage); @@ -485,26 +503,6 @@ BFILE *fopenfrompath(const char *fn, const char *mode) return h; } -static char toupperlookup[256] = -{ - 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, - 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, - 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, - 0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, - 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x7b,0x7c,0x7d,0x7e,0x7f, - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, - 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf, - 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, - 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf, - 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, - 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, - 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff -}; - int32_t numgroupfiles = 0; static int32_t gnumfiles[MAXGROUPFILES]; static int32_t groupfil[MAXGROUPFILES] = {-1,-1,-1,-1,-1,-1,-1,-1}; diff --git a/polymer/eduke32/build/src/compat.c b/polymer/eduke32/build/src/compat.c index 2611d78ab..1dcabe005 100644 --- a/polymer/eduke32/build/src/compat.c +++ b/polymer/eduke32/build/src/compat.c @@ -338,11 +338,14 @@ char *Bgetcwd(char *buf, bsize_t size) // // Stuff which must be a function // +#ifdef _WIN32 +typedef BOOL (WINAPI * aSHGetSpecialFolderPathAtype)(HWND, LPTSTR, int, BOOL); +#endif char *Bgethomedir(void) { #ifdef _WIN32 - FARPROC aSHGetSpecialFolderPathA; + aSHGetSpecialFolderPathAtype aSHGetSpecialFolderPathA; TCHAR appdata[MAX_PATH]; int32_t loaded = 0; HMODULE hShell32 = GetModuleHandle("shell32.dll"); @@ -356,7 +359,7 @@ char *Bgethomedir(void) if (hShell32 == NULL) return NULL; - aSHGetSpecialFolderPathA = GetProcAddress(hShell32, "SHGetSpecialFolderPathA"); + aSHGetSpecialFolderPathA = (aSHGetSpecialFolderPathAtype)GetProcAddress(hShell32, "SHGetSpecialFolderPathA"); if (aSHGetSpecialFolderPathA != NULL) if (SUCCEEDED(aSHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE))) { @@ -811,6 +814,10 @@ char *Bstrupr(char *s) // // Bgetsysmemsize() -- gets the amount of system memory in the machine // +#ifdef _WIN32 +typedef BOOL (WINAPI *aGlobalMemoryStatusExType)(LPMEMORYSTATUSEX); +#endif + uint32_t Bgetsysmemsize(void) { #ifdef _WIN32 @@ -819,8 +826,8 @@ uint32_t Bgetsysmemsize(void) if (lib) { - BOOL (WINAPI *aGlobalMemoryStatusEx)(LPMEMORYSTATUSEX) = - (void *)GetProcAddress(lib, "GlobalMemoryStatusEx"); + aGlobalMemoryStatusExType aGlobalMemoryStatusEx = + (aGlobalMemoryStatusExType)GetProcAddress(lib, "GlobalMemoryStatusEx"); if (aGlobalMemoryStatusEx) { diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 969ce7eb1..beae55cea 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -138,7 +138,6 @@ palette_t palookupfog[MAXPALOOKUPS]; static int32_t artversion; int32_t mapversion=7; // JBF 20040211: default mapversion to 7 -char picsiz[MAXTILES]; static void *pic = NULL; static char tilefilenum[MAXTILES]; static int32_t tilefileoffs[MAXTILES]; @@ -149,28 +148,62 @@ static int32_t artsize = 0, cachesize = 0; // Whole ART file contents loaded from ZIPs in memory. static char *artptrs[MAXTILEFILES]; -// GCC 4.6 LTO build fix -#ifdef USING_LTO -# define B_ENGINE_STATIC -#else -# define B_ENGINE_STATIC static -#endif - static int32_t no_radarang2 = 0; static int16_t radarang[1280], radarang2[MAXXDIM]; -B_ENGINE_STATIC uint16_t ATTRIBUTE((used)) sqrtable[4096], ATTRIBUTE((used)) shlookup[4096+256]; -const char pow2char[8] = {1,2,4,8,16,32,64,128}; -const int32_t pow2long[32] = + +uint16_t ATTRIBUTE((used)) sqrtable[4096], ATTRIBUTE((used)) shlookup[4096+256]; + +void initialize_engine_globals(void) { - 1L,2L,4L,8L, - 16L,32L,64L,128L, - 256L,512L,1024L,2048L, - 4096L,8192L,16384L,32768L, - 65536L,131072L,262144L,524288L, - 1048576L,2097152L,4194304L,8388608L, - 16777216L,33554432L,67108864L,134217728L, - 268435456L,536870912L,1073741824L,2147483647L -}; + pow2char[0] = 1; + pow2char[1] = 2; + pow2char[2] = 4; + pow2char[3] = 8; + pow2char[4] = 16; + pow2char[5] = 32; + pow2char[6] = 64; + pow2char[7] = 128; + + pow2long[0] = 1L; + pow2long[1] = 2L; + pow2long[2] = 4L; + pow2long[3] = 8L; + pow2long[4] = 16L; + pow2long[5] = 32L; + pow2long[6] = 64L; + pow2long[7] = 128L; + pow2long[8] = 256L; + pow2long[9] = 512L; + pow2long[10] = 1024L; + pow2long[11] = 2048L; + pow2long[12] = 4096L; + pow2long[13] = 8192L; + pow2long[14] = 16384L; + pow2long[15] = 32768L; + pow2long[16] = 65536L; + pow2long[17] = 131072L; + pow2long[18] = 262144L; + pow2long[19] = 524288L; + pow2long[20] = 1048576L; + pow2long[21] = 2097152L; + pow2long[22] = 4194304L; + pow2long[23] = 8388608L; + pow2long[24] = 16777216L; + pow2long[25] = 33554432L; + pow2long[26] = 67108864L; + pow2long[27] = 134217728L; + pow2long[28] = 268435456L; + pow2long[29] = 536870912L; + pow2long[30] = 1073741824L; + pow2long[31] = 2147483647L; + +#ifdef USE_OPENGL + mdinited = 0; + mdpause = 0; + nextmodelid = 0; +#endif +} + int32_t reciptable[2048], fpuasm; char britable[16][256]; // JBF 20040207: full 8bit precision @@ -1180,7 +1213,7 @@ typedef struct walltype *wall; } mapinfo_t; -static void mapinfo_set(mapinfo_t *bak, mapinfo_t *new) +static void mapinfo_set(mapinfo_t *bak, mapinfo_t *newmap) { if (bak) { @@ -1190,12 +1223,12 @@ static void mapinfo_set(mapinfo_t *bak, mapinfo_t *new) bak->wall = wall; } - if (new) + if (newmap) { - numsectors = new->numsectors; - numwalls = new->numwalls; - sector = new->sector; - wall = new->wall; + numsectors = newmap->numsectors; + numwalls = newmap->numwalls; + sector = newmap->sector; + wall = newmap->wall; } } @@ -2195,7 +2228,6 @@ static int32_t yb1[MAXWALLSB], xb2[MAXWALLSB], yb2[MAXWALLSB]; int32_t rx1[MAXWALLSB], ry1[MAXWALLSB]; static int32_t rx2[MAXWALLSB], ry2[MAXWALLSB]; int16_t p2[MAXWALLSB], thesector[MAXWALLSB]; -int16_t thewall[MAXWALLSB]; int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; @@ -2205,11 +2237,9 @@ static int32_t smoststart[MAXWALLSB]; static char smostwalltype[MAXWALLSB]; static int32_t smostwall[MAXWALLSB], smostwallcnt = -1; -int16_t maskwall[MAXWALLSB], maskwallcnt; static int32_t spritesx[MAXSPRITESONSCREEN]; static int32_t spritesy[MAXSPRITESONSCREEN+1]; static int32_t spritesz[MAXSPRITESONSCREEN]; -spritetype *tspriteptr[MAXSPRITESONSCREEN + 1]; static int16_t umost[MAXXDIM], dmost[MAXXDIM]; static int16_t bakumost[MAXXDIM], bakdmost[MAXXDIM]; @@ -10845,14 +10875,14 @@ void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs, int32_t alsotile // // setsprite // -int32_t setsprite(int16_t spritenum, const vec3_t *new) +int32_t setsprite(int16_t spritenum, const vec3_t *newpos) { int16_t tempsectnum = sprite[spritenum].sectnum; - if ((void *)new != (void *)&sprite[spritenum]) - Bmemcpy(&sprite[spritenum], new, sizeof(vec3_t)); + if ((void *)newpos != (void *)&sprite[spritenum]) + Bmemcpy(&sprite[spritenum], newpos, sizeof(vec3_t)); - updatesector(new->x,new->y,&tempsectnum); + updatesector(newpos->x,newpos->y,&tempsectnum); if (tempsectnum < 0) return(-1); @@ -10862,14 +10892,14 @@ int32_t setsprite(int16_t spritenum, const vec3_t *new) return(0); } -int32_t setspritez(int16_t spritenum, const vec3_t *new) +int32_t setspritez(int16_t spritenum, const vec3_t *newpos) { int16_t tempsectnum = sprite[spritenum].sectnum; - if ((void *)new != (void *)&sprite[spritenum]) - Bmemcpy(&sprite[spritenum], new, sizeof(vec3_t)); + if ((void *)newpos != (void *)&sprite[spritenum]) + Bmemcpy(&sprite[spritenum], newpos, sizeof(vec3_t)); - updatesectorz(new->x,new->y,new->z,&tempsectnum); + updatesectorz(newpos->x,newpos->y,newpos->z,&tempsectnum); if (tempsectnum < 0) return(-1); diff --git a/polymer/eduke32/build/src/engine_priv.h b/polymer/eduke32/build/src/engine_priv.h index f3863ebab..8b42f2d11 100644 --- a/polymer/eduke32/build/src/engine_priv.h +++ b/polymer/eduke32/build/src/engine_priv.h @@ -19,13 +19,9 @@ //#define OBSOLETE_RENDMODES - extern uint8_t basepalcount; extern uint8_t curbasepal; -extern const char pow2char[8]; -extern const int32_t pow2int[32]; - extern int16_t thesector[MAXWALLSB], thewall[MAXWALLSB]; extern int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; extern int16_t maskwall[MAXWALLSB], maskwallcnt; diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index cb74c0b40..c5f9cafb2 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -17,7 +17,6 @@ #include -voxmodel_t *voxmodels[MAXVOXELS]; static int32_t curextra=MAXTILES; // nedpool *model_data_pool; // #define MODEL_POOL_SIZE 20971520 @@ -76,12 +75,8 @@ int32_t Ptile2tile(int32_t tile,int32_t pallet) return t; } -int32_t mdinited=0; -int32_t mdpause=0; - #define MODELALLOCGROUP 256 static int32_t nummodelsalloced = 0; -int32_t nextmodelid = 0; static int32_t maxmodelverts = 0, allocmodelverts = 0; static int32_t maxmodeltris = 0, allocmodeltris = 0; diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index d190ffea1..364d7f59b 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -1784,13 +1784,9 @@ int32_t OSD_Dispatch(const char *cmd) ofp.parms = (const char **)parms; ofp.raw = cmd; - switch ((intptr_t)symb->func) - { - case(intptr_t)OSD_ALIAS: + if ((intptr_t)symb->func == (intptr_t)OSD_ALIAS) OSD_Dispatch(symb->help); - case(intptr_t)OSD_UNALIASED: - break; - default: + else if ((intptr_t)symb->func != (intptr_t)OSD_UNALIASED) switch (symb->func(&ofp)) { case OSDCMD_OK: @@ -1800,7 +1796,6 @@ int32_t OSD_Dispatch(const char *cmd) break; } break; - } state = wtp; } diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 7d06b778d..46aeaeaa5 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -4,6 +4,8 @@ // // Use SDL 1.2 or 1.3 from http://www.libsdl.org +#define __STDC_FORMAT_MACROS +#define __STDC_LIMIT_MACROS #include #include // pow #include @@ -2241,16 +2243,6 @@ int32_t handleevents(void) return rv; } -inline void idle(void) -{ - usleep(1000); -} - -inline void idle_waitevent(void) -{ - SDL_WaitEvent(NULL); -} - #if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2 // from SDL HG, modified static int32_t SDL_WaitEventTimeout(SDL_Event *event, int32_t timeout) @@ -2287,11 +2279,6 @@ static int32_t SDL_WaitEventTimeout(SDL_Event *event, int32_t timeout) } #endif -inline void idle_waitevent_timeout(uint32_t timeout) -{ - SDL_WaitEventTimeout(NULL, timeout); -} - #if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2 static int32_t buildkeytranslationtable(void) { diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 047de30c7..324a1a118 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -5,12 +5,21 @@ #define DIRECTDRAW_VERSION 0x0600 #define _WIN32_WINNT 0x0501 #define WIN32_LEAN_AND_MEAN +#define CINTERFACE + +// bug in the dx headers +#define bMAKEDIPROP(prop) ((REFGUID)(prop)) +#define bDIPROP_BUFFERSIZE bMAKEDIPROP(1) +#define bDIPROP_DEADZONE bMAKEDIPROP(5) +#define bDIPROP_SATURATION bMAKEDIPROP(6) + #include #include #include #ifndef DIK_PAUSE # define DIK_PAUSE 0xC5 #endif + #include // pow #ifdef _MSC_VER @@ -18,6 +27,8 @@ #endif #include "dxdidf.h" // comment this out if c_dfDI* is being reported as multiply defined +#define __STDC_FORMAT_MACROS +#define __STDC_LIMIT_MACROS #include #include #include @@ -856,7 +867,7 @@ void uninitinput(void) } -inline void idle_waitevent_timeout(uint32_t timeout) +void idle_waitevent_timeout(uint32_t timeout) { // timeout becomes a completion deadline timeout += getticks(); @@ -876,15 +887,6 @@ inline void idle_waitevent_timeout(uint32_t timeout) while (timeout > (getticks() + 10)); } -inline void idle_waitevent(void) -{ - idle_waitevent_timeout(100); -} - -inline void idle(void) -{ - idle_waitevent(); -} // // setjoydeadzone() -- sets the dead and saturation zones for the joystick @@ -916,7 +918,7 @@ void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur) } dipdw.dwData = dead; - result = IDirectInputDevice7_SetProperty(lpDID, DIPROP_DEADZONE, &dipdw.diph); + result = IDirectInputDevice7_SetProperty(lpDID, bDIPROP_DEADZONE, &dipdw.diph); if (FAILED(result)) { //ShowDInputErrorBox("Failed setting joystick dead zone", result); @@ -926,7 +928,7 @@ void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur) dipdw.dwData = satur; - result = IDirectInputDevice7_SetProperty(lpDID, DIPROP_SATURATION, &dipdw.diph); + result = IDirectInputDevice7_SetProperty(lpDID, bDIPROP_SATURATION, &dipdw.diph); if (FAILED(result)) { //ShowDInputErrorBox("Failed setting joystick saturation point", result); @@ -962,7 +964,7 @@ void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur) dipdw.diph.dwHow = DIPH_BYOFFSET; } - result = IDirectInputDevice7_GetProperty(lpDID, DIPROP_DEADZONE, &dipdw.diph); + result = IDirectInputDevice7_GetProperty(lpDID, bDIPROP_DEADZONE, &dipdw.diph); if (FAILED(result)) { //ShowDInputErrorBox("Failed getting joystick dead zone", result); @@ -972,7 +974,7 @@ void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur) *dead = dipdw.dwData; - result = IDirectInputDevice7_GetProperty(lpDID, DIPROP_SATURATION, &dipdw.diph); + result = IDirectInputDevice7_GetProperty(lpDID, bDIPROP_SATURATION, &dipdw.diph); if (FAILED(result)) { //ShowDInputErrorBox("Failed getting joystick saturation point", result); @@ -1167,7 +1169,7 @@ static BOOL InitDirectInput(void) dipdw.diph.dwHow = DIPH_DEVICE; dipdw.dwData = INPUT_BUFFER_SIZE; - result = IDirectInputDevice7_SetProperty(dev2, DIPROP_BUFFERSIZE, &dipdw.diph); + result = IDirectInputDevice7_SetProperty(dev2, bDIPROP_BUFFERSIZE, &dipdw.diph); if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting buffering", result); } else if (result != DI_OK) initprintf(" Set buffering with warning: %s\n",GetDInputError(result)); diff --git a/polymer/eduke32/osxbuild.sh b/polymer/eduke32/osxbuild.sh index 9fb57d443..b86a45eae 100755 --- a/polymer/eduke32/osxbuild.sh +++ b/polymer/eduke32/osxbuild.sh @@ -168,7 +168,7 @@ fi if [ -n "$rev" ]; then # throw the svn revision into a header. this is ugly. - echo "const char *s_buildRev = \"r$rev\";" > source/rev.h + echo "s_buildRev = \"r$rev\";" > source/rev.h else rev=unknown vc=none diff --git a/polymer/eduke32/source/_functio.h b/polymer/eduke32/source/_functio.h index 900227fcf..6b0de6c7a 100644 --- a/polymer/eduke32/source/_functio.h +++ b/polymer/eduke32/source/_functio.h @@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _function_private_ #define _function_private_ -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] = { @@ -503,7 +503,7 @@ static const char * joystickdigitaldefaults[] = #endif #endif -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 2b4deeb37..f3e3038bb 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -26,10 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "gameexec.h" #if KRANDDEBUG -# define ACTOR_INLINE # define ACTOR_STATIC #else -# define ACTOR_INLINE inline # define ACTOR_STATIC static #endif @@ -38,12 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern int32_t g_numEnvSoundsPlaying; extern int32_t g_noEnemies; -inline void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings -{ - int32_t i=g_numInterpolations-1; - for (; i>=0; i--) oldipos[i] = *curipos[i]; -} - void G_SetInterpolation(int32_t *posptr) { int32_t i=g_numInterpolations-1; @@ -89,26 +81,6 @@ void G_DoInterpolations(int32_t smoothratio) //Stick at beginning of draws } } -inline void G_RestoreInterpolations(void) //Stick at end of drawscreen -{ - int32_t i=g_numInterpolations-1; - - if (--g_interpolationLock) - return; - - for (; i>=0; i--) *curipos[i] = bakipos[i]; -} - -inline int32_t G_CheckForSpaceCeiling(int32_t sectnum) -{ - return ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 && (sector[sectnum].ceilingpicnum==MOONSKY1 || sector[sectnum].ceilingpicnum==BIGORBIT1)?1:0); -} - -inline int32_t G_CheckForSpaceFloor(int32_t sectnum) -{ - return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1))?1:0); -} - void G_ClearCameraView(DukePlayer_t *ps) { int32_t k; @@ -476,15 +448,6 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) return(retval); } -ACTOR_INLINE int32_t A_SetSprite(int32_t i,uint32_t cliptype) -{ - vec3_t davect = {(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, - (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14, - sprite[i].zvel - }; - return (A_MoveSprite(i,&davect,cliptype)==0); -} - int32_t block_deletesprite = 0; #ifdef POLYMER @@ -8223,11 +8186,6 @@ int32_t A_CheckEnemyTile(int32_t pn) return 0; } -inline int32_t A_CheckEnemySprite(const spritetype *s) -{ - return(A_CheckEnemyTile(s->picnum)); -} - int32_t A_CheckSwitchTile(int32_t i) { int32_t j; diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index a0f6e298c..f3ca5f279 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -131,14 +131,14 @@ typedef struct { #if UINTPTR_MAX == 0xffffffff /* 32-bit */ # ifndef LUNATIC - const int8_t filler[20]; + int8_t filler[20]; # else - const int8_t filler[4]; + int8_t filler[4]; # endif #else /* 64-bit */ # ifndef LUNATIC - const int8_t filler[16]; + int8_t filler[16]; # else /* no padding */ #endif @@ -265,7 +265,6 @@ static inline void set_move_members(int32_t i) #endif void A_AddToDeleteQueue(int32_t i); -int32_t A_CheckEnemySprite(const spritetype *s); int32_t A_CheckEnemyTile(int32_t pn); int32_t A_CheckSwitchTile(int32_t i); void A_DeleteSprite(int32_t s); @@ -277,22 +276,19 @@ void A_MoveDummyPlayers(void); int32_t A_MoveSprite(int32_t spritenum,const vec3_t *change,uint32_t cliptype); void A_PlayAlertSound(int32_t i); void A_RadiusDamage(int32_t i,int32_t r,int32_t hp1,int32_t hp2,int32_t hp3,int32_t hp4); -int32_t A_SetSprite(int32_t i,uint32_t cliptype); void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n); void G_AddGameLight(int32_t radius,int32_t srcsprite,int32_t zoffset,int32_t range,int32_t color,int32_t priority); -int32_t G_CheckForSpaceCeiling(int32_t sectnum); -int32_t G_CheckForSpaceFloor(int32_t sectnum); void G_ClearCameraView(DukePlayer_t *ps); void G_DoInterpolations(int32_t smoothratio); void G_MoveWorld(void); -extern inline void G_RestoreInterpolations(void); void G_SetInterpolation(int32_t *posptr); void G_StopInterpolation(int32_t *posptr); -extern inline void G_UpdateInterpolations(void); // PK 20110701: changed input argument: int32_t i (== sprite, whose sectnum...) --> sectnum directly void Sect_ClearInterpolation(int32_t sectnum); void Sect_SetInterpolation(int32_t sectnum); +#include "actors_inline.h" + #endif diff --git a/polymer/eduke32/source/actors_inline.c b/polymer/eduke32/source/actors_inline.c new file mode 100644 index 000000000..25b6de7d0 --- /dev/null +++ b/polymer/eduke32/source/actors_inline.c @@ -0,0 +1,74 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 2010 EDuke32 developers and contributors + +This file is part of EDuke32. + +EDuke32 is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +//------------------------------------------------------------------------- + +#ifndef __actors_inline_c__ +#define __actors_inline_c__ + +#include "compat.h" +#include "build.h" +#include "global.h" +#include "duke3d.h" +#include "actors_inline.h" + +ACTOR_INLINE int32_t A_SetSprite(int32_t i,uint32_t cliptype) +{ + vec3_t davect = {(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, + (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14, + sprite[i].zvel + }; + return (A_MoveSprite(i,&davect,cliptype)==0); +} + + +EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings +{ + int32_t i=g_numInterpolations-1; + for (; i>=0; i--) oldipos[i] = *curipos[i]; +} + + +EXTERN_INLINE void G_RestoreInterpolations(void) //Stick at end of drawscreen +{ + int32_t i=g_numInterpolations-1; + + if (--g_interpolationLock) + return; + + for (; i>=0; i--) *curipos[i] = bakipos[i]; +} + +EXTERN_INLINE int32_t G_CheckForSpaceCeiling(int32_t sectnum) +{ + return ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 && (sector[sectnum].ceilingpicnum==MOONSKY1 || sector[sectnum].ceilingpicnum==BIGORBIT1)?1:0); +} + +EXTERN_INLINE int32_t G_CheckForSpaceFloor(int32_t sectnum) +{ + return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1))?1:0); +} + +EXTERN_INLINE int32_t A_CheckEnemySprite(const spritetype *s) +{ + return(A_CheckEnemyTile(s->picnum)); +} + +#endif diff --git a/polymer/eduke32/source/actors_inline.h b/polymer/eduke32/source/actors_inline.h new file mode 100644 index 000000000..8628783a0 --- /dev/null +++ b/polymer/eduke32/source/actors_inline.h @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 2010 EDuke32 developers and contributors + +This file is part of EDuke32. + +EDuke32 is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +//------------------------------------------------------------------------- + +#ifndef __actors_inline_h__ +#define __actors_inline_h__ + +#if KRANDDEBUG +# define ACTOR_INLINE +# define ACTOR_INLINE_HEADER extern +#else +# define ACTOR_INLINE EXTERN_INLINE +# define ACTOR_INLINE_HEADER EXTERN_INLINE_HEADER +#endif + +ACTOR_INLINE_HEADER int32_t A_SetSprite(int32_t i,uint32_t cliptype); + +EXTERN_INLINE_HEADER void G_UpdateInterpolations(void); +EXTERN_INLINE_HEADER void G_RestoreInterpolations(void); + +EXTERN_INLINE_HEADER int32_t G_CheckForSpaceCeiling(int32_t sectnum); +EXTERN_INLINE_HEADER int32_t G_CheckForSpaceFloor(int32_t sectnum); + +EXTERN_INLINE_HEADER int32_t A_CheckEnemySprite(const spritetype *s); + +#ifndef DISABLE_INLINING +#include "actors_inline.c" +#endif + +#endif diff --git a/polymer/eduke32/source/animvpx.c b/polymer/eduke32/source/animvpx.c index c3583115f..6b15f3992 100644 --- a/polymer/eduke32/source/animvpx.c +++ b/polymer/eduke32/source/animvpx.c @@ -1,5 +1,9 @@ /* ANM file replacement with VP8 video */ +#define __STDC_FORMAT_MACROS +#define __STDC_LIMIT_MACROS + + #include #include "compat.h" diff --git a/polymer/eduke32/source/animvpx.h b/polymer/eduke32/source/animvpx.h index 16472a3e1..ce05960af 100644 --- a/polymer/eduke32/source/animvpx.h +++ b/polymer/eduke32/source/animvpx.h @@ -29,7 +29,7 @@ typedef struct } animvpx_ivf_header_t; #pragma pack(pop) -const char *animvpx_read_ivf_header_errmsg[7]; +extern const char *animvpx_read_ivf_header_errmsg[7]; int32_t animvpx_read_ivf_header(int32_t inhandle, animvpx_ivf_header_t *hdr); @@ -77,7 +77,7 @@ typedef struct int32_t animvpx_init_codec(const animvpx_ivf_header_t *info, int32_t inhandle, animvpx_codec_ctx *codec); int32_t animvpx_uninit_codec(animvpx_codec_ctx *codec); -const char *animvpx_nextpic_errmsg[8]; +extern const char *animvpx_nextpic_errmsg[8]; int32_t animvpx_nextpic(animvpx_codec_ctx *codec, uint8_t **pic); void animvpx_setup_glstate(void); diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 4589fcc01..b847346d1 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -24,7 +24,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "build.h" #include "editor.h" #include "pragmas.h" + +#ifdef RENDERTYPEWIN +#include "winlayer.h" +#else +#include "sdlayer.h" +#endif + #include "baselayer.h" + #include "osd.h" #include "cache1d.h" @@ -53,7 +61,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # include "lunatic_m32.h" #endif -#include "rev.h" +static const char *s_buildRev; #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN @@ -8893,6 +8901,8 @@ int32_t ExtPreInit(int32_t argc,const char **argv) //chdir(tempbuf); #endif + #include "rev.h" + OSD_SetLogFile("mapster32.log"); OSD_SetVersion("Mapster32" " " VERSION,0,2); initprintf("Mapster32 %s %s\n", VERSION, s_buildRev); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 71969b5fa..99942e2e8 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __duke3d_h__ #define __duke3d_h__ -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif // JBF @@ -131,7 +131,7 @@ extern "C" { #include "gameexec.h" #include "gamevars.h" -#ifdef __cplusplus +#ifdef EXTERNC } #endif #endif diff --git a/polymer/eduke32/source/enet/Makefile b/polymer/eduke32/source/enet/Makefile index a2dc31c18..d05a652f6 100644 --- a/polymer/eduke32/source/enet/Makefile +++ b/polymer/eduke32/source/enet/Makefile @@ -17,6 +17,11 @@ OURCXXFLAGS=$(BASECXXFLAGS) OURLDFLAGS=$(BASELDFLAGS) OURASFLAGS=$(BASEASFLAGS) +INVOCATION=$(CC) $(OURCONLYFLAGS) +ifneq ($(CPLUSPLUS),0) + INVOCATION=$(CXX) $(OURCXXFLAGS) +endif + OBJECTS=$(OBJ)/callbacks.o \ $(OBJ)/host.o \ @@ -44,7 +49,7 @@ $(OBJNAME): $(OBJECTS) $(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c $(INC)/enet/*.h -mkdir -p $(OBJ) $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi ifeq ($(PRETTY_OUTPUT),1) .SILENT: diff --git a/polymer/eduke32/source/enet/include/enet/enet.h b/polymer/eduke32/source/enet/include/enet/enet.h index c1d0dddcc..54278de5b 100644 --- a/polymer/eduke32/source/enet/include/enet/enet.h +++ b/polymer/eduke32/source/enet/include/enet/enet.h @@ -6,8 +6,7 @@ #define __ENET_ENET_H__ #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #include diff --git a/polymer/eduke32/source/function.h b/polymer/eduke32/source/function.h index 1671437df..b96f6262e 100644 --- a/polymer/eduke32/source/function.h +++ b/polymer/eduke32/source/function.h @@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _function_public_ #define _function_public_ -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif #define NUMKEYENTRIES 56 @@ -101,7 +101,7 @@ enum GameFunction_t gamefunc_Dpad_Select, gamefunc_Dpad_Aiming }; -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index e5dda6a4c..18d34a2cc 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -22,6 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "duke3d.h" +#ifdef RENDERTYPEWIN +#include "winlayer.h" +#else +#include "sdlayer.h" +#endif + #include "scriplib.h" #include "file_lib.h" #include "mathutil.h" @@ -247,11 +253,6 @@ enum gametokens }; -inline void G_SetStatusBarScale(int32_t sc) -{ - ud.statusbarscale = min(100,max(10,sc)); - G_UpdateScreenArea(); -} static int32_t sbarx(int32_t x) { @@ -9871,6 +9872,8 @@ int32_t app_main(int32_t argc, const char **argv) Bassert(offsetof(actor_t, lightId) == sizeof(netactor_t)); Bassert(sizeof(DukePlayer_t)%4 == 0); + initialize_globals(); + #ifdef GEKKO L2Enhance(); CON_EnableGecko(1, 1); diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 65296b8cf..236619172 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -288,7 +288,6 @@ void G_HandleSpecialKeys(void); void G_PrintGameQuotes(int32_t snum); //void G_SE40(int32_t smoothratio); void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); -void G_SetStatusBarScale(int32_t sc); void G_Shutdown(void); void G_UpdatePlayerFromMenu(void); void M32RunScript(const char *s); @@ -459,4 +458,6 @@ enum cheatindex_t ) >= ((int32_t)size)-1 \ ) +#include "game_inline.h" + #endif diff --git a/polymer/eduke32/source/game_inline.c b/polymer/eduke32/source/game_inline.c new file mode 100644 index 000000000..91ab8e3e0 --- /dev/null +++ b/polymer/eduke32/source/game_inline.c @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 2010 EDuke32 developers and contributors + +This file is part of EDuke32. + +EDuke32 is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +//------------------------------------------------------------------------- + +#ifndef __game_inline_c__ +#define __game_inline_c__ + +#include "compat.h" +#include "duke3d.h" +#include "premap.h" +#include "game.h" +#include "game_inline.h" + +EXTERN_INLINE void G_SetStatusBarScale(int32_t sc) +{ + ud.statusbarscale = min(100,max(10,sc)); + G_UpdateScreenArea(); +} + +#endif diff --git a/polymer/eduke32/source/game_inline.h b/polymer/eduke32/source/game_inline.h new file mode 100644 index 000000000..3ce1c3d15 --- /dev/null +++ b/polymer/eduke32/source/game_inline.h @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 2010 EDuke32 developers and contributors + +This file is part of EDuke32. + +EDuke32 is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +//------------------------------------------------------------------------- + +#ifndef __game_inline_h__ +#define __game_inline_h__ + +EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc); + +#ifndef DISABLE_INLINING +#include "game_inline.c" +#endif + +#endif diff --git a/polymer/eduke32/source/gamedefs.h b/polymer/eduke32/source/gamedefs.h index 209d7f4a2..ab7c8fc0e 100644 --- a/polymer/eduke32/source/gamedefs.h +++ b/polymer/eduke32/source/gamedefs.h @@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _gamedefs_public_ #define _gamedefs_public_ -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif //**************************************************************************** @@ -187,7 +187,7 @@ enum }; -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index ebcc7d3ea..bb3d7176b 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -23,160 +23,73 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __global_c__ #include "global.h" #include "duke3d.h" -#include "rev.h" -const char *s_buildDate = "20120522"; -char *MusicPtr = NULL; -int32_t g_musicSize; - -int16_t g_globalRandom; -int16_t neartagsector, neartagwall, neartagsprite; - -int32_t neartaghitdist,lockclock,g_startArmorAmount; -// JBF: g_spriteGravity modified to default to Atomic ed. default when using 1.3d CONs -int32_t g_spriteGravity=176; - -actor_t actor[MAXSPRITES]; -tiledata_t g_tile[MAXTILES]; - -int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos,g_spriteDeleteQueueSize=64; -animwalltype animwall[MAXANIMWALLS]; -int16_t g_numAnimWalls; -int32_t *animateptr[MAXANIMATES]; -int32_t animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount; -int16_t animatesect[MAXANIMATES]; -int32_t msx[2048],msy[2048]; -int16_t cyclers[MAXCYCLERS][6],g_numCyclers; - -char *ScriptQuotes[MAXQUOTES], *ScriptQuoteRedefinitions[MAXQUOTES]; - -char tempbuf[MAXSECTORS<<1], packbuf[PACKBUF_SIZE], menutextbuf[128], buf[1024]; - -int16_t camsprite; -int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount; - -int32_t g_currentMenu; - -map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music -sound_t g_sounds[ MAXSOUNDS ]; -volatile char g_soundlocks[MAXSOUNDS]; - -char EpisodeNames[MAXVOLUMES][33] = { "L.A. Meltdown", "Lunar Apocalypse", "Shrapnel City" }; -char SkillNames[MAXSKILLS][33] = { "Piece Of Cake", "Let's Rock", "Come Get Some", "Damn I'm Good" }; - -char GametypeNames[MAXGAMETYPES][33] = { "DukeMatch (Spawn)","Cooperative Play","DukeMatch (No Spawn)","Team DM (Spawn)","Team DM (No Spawn)"}; - -int32_t GametypeFlags[MAXGAMETYPES] = +void initialize_globals(void) { - /*4+*/8+16+1024+2048+16384, - 1+2+32+64+128+256+512+4096+8192+32768, - 2+/*4+*/8+16+16384, - /*4+*/8+16+1024+2048+16384+65536+131072, - 2+/*4+*/8+16+16384+65536+131072 -}; -char g_numGametypes = 5; + #include "rev.h" + s_buildDate = "20120522"; -int32_t g_currentFrameRate; + // JBF: g_spriteGravity modified to default to Atomic ed. default when using 1.3d CONs + g_spriteGravity = 176; -char g_numVolumes = 3; + g_spriteDeleteQueueSize = 64; -int32_t g_timerTicsPerSecond=TICRATE; + strcpy(EpisodeNames[0], "L.A. Meltdown"); + strcpy(EpisodeNames[1], "Lunar Apocalypse"); + strcpy(EpisodeNames[2], "Shrapnel City"); -int8_t g_numPlayerSprites; -char g_loadFromGroupOnly=0, g_earthquakeTime; + strcpy(SkillNames[0], "Piece Of Cake"); + strcpy(SkillNames[1], "Let's Rock"); + strcpy(SkillNames[2], "Come Get Some"); + strcpy(SkillNames[3], "Damn I'm Good"); -int32_t playerswhenstarted; + strcpy(GametypeNames[0], "DukeMatch (Spawn)"); + strcpy(GametypeNames[1], "Cooperative Play"); + strcpy(GametypeNames[2], "DukeMatch (No Spawn)"); + strcpy(GametypeNames[3], "Team DM (Spawn)"); + strcpy(GametypeNames[4], "Team DM (No Spawn)"); -int32_t fricxv,fricyv; -#pragma pack(push,1) -playerdata_t g_player[MAXPLAYERS]; -input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; -playerspawn_t g_playerSpawnPoints[MAXPLAYERS]; -#pragma pack(pop) -user_defs ud; + GametypeFlags[0] = /*4+*/8+16+1024+2048+16384; + GametypeFlags[1] = 1+2+32+64+128+256+512+4096+8192+32768; + GametypeFlags[2] = 2+/*4+*/8+16+16384; + GametypeFlags[3] = /*4+*/8+16+1024+2048+16384+65536+131072; + GametypeFlags[4] = 2+/*4+*/8+16+16384+65536+131072; -char pus, pub; + g_numGametypes = 5; -input_t loc; -input_t recsync[RECSYNCBUFSIZ]; -input_t avg; + g_numVolumes = 3; -//Multiplayer syncing variables -int32_t screenpeek; + g_timerTicsPerSecond = TICRATE; -//Game recording variables -char ready2send; -int32_t vel, svel, angvel, horiz, ototalclock, g_actorRespawnTime=768, g_itemRespawnTime=768, g_groupFileHandle; + g_actorRespawnTime = 768; + g_itemRespawnTime = 768; -intptr_t *g_scriptPtr,*insptr; -int32_t *labelcode, *labeltype; -int32_t g_numLabels,g_numDefaultLabels; -intptr_t *g_parsingActorPtr; -char *label; -intptr_t *script = NULL; + g_scriptSize = 1048576; -int32_t g_scriptSize = 1048576; + BlimpSpawnSprites[0] = RPGSPRITE__STATIC; + BlimpSpawnSprites[1] = CHAINGUNSPRITE__STATIC; + BlimpSpawnSprites[2] = DEVISTATORAMMO__STATIC; + BlimpSpawnSprites[3] = RPGAMMO__STATIC; + BlimpSpawnSprites[4] = RPGAMMO__STATIC; + BlimpSpawnSprites[5] = JETPACK__STATIC; + BlimpSpawnSprites[6] = SHIELD__STATIC; + BlimpSpawnSprites[7] = FIRSTAID__STATIC; + BlimpSpawnSprites[8] = STEROIDS__STATIC; + BlimpSpawnSprites[9] = RPGAMMO__STATIC; + BlimpSpawnSprites[10] = RPGAMMO__STATIC; + BlimpSpawnSprites[11] = RPGSPRITE__STATIC; + BlimpSpawnSprites[12] = RPGAMMO__STATIC; + BlimpSpawnSprites[13] = FREEZESPRITE__STATIC; + BlimpSpawnSprites[14] = FREEZEAMMO__STATIC; -char typebuflen,typebuf[141]; + g_playerFriction = 0xcc00; -int32_t g_musicIndex; -char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH]; -char g_RTSPlaying; + g_numFreezeBounces=3; + g_lastSaveSlot = -1; -int16_t BlimpSpawnSprites[15] = -{ - RPGSPRITE__STATIC, - CHAINGUNSPRITE__STATIC, - DEVISTATORAMMO__STATIC, - RPGAMMO__STATIC, - RPGAMMO__STATIC, - JETPACK__STATIC, - SHIELD__STATIC, - FIRSTAID__STATIC, - STEROIDS__STATIC, - RPGAMMO__STATIC, - RPGAMMO__STATIC, - RPGSPRITE__STATIC, - RPGAMMO__STATIC, - FREEZESPRITE__STATIC, - FREEZEAMMO__STATIC -}; + CheatKeys[0] = sc_D; + CheatKeys[1] = sc_N; -int32_t g_impactDamage, g_maxPlayerHealth; -int32_t g_scriptDebug; - -//GLOBAL.C - replace the end "my's" with this -vec3_t my, omy, myvel; -int16_t myhoriz, omyhoriz, myhorizoff, omyhorizoff; -int16_t myang, omyang, mycursectnum, myjumpingcounter; - -char myjumpingtoggle, myonground, myhardlanding, myreturntocenter; - -int32_t g_playerFriction = 0xcc00, g_showShareware; - -char szPlayerName[32]; -int32_t g_damageCameras,g_freezerSelfDamage=0,g_tripbombLaserMode=0; -int32_t g_gameQuit = 0; -uint32_t everyothertime; -int32_t g_numFreezeBounces=3,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBlastRadius, - g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius; -DukeStatus_t sbar; - -int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128]; -int32_t cloudtotalclock = 0; -int32_t g_numInterpolations = 0, startofdynamicinterpolations = 0; -int32_t g_interpolationLock = 0; -int32_t oldipos[MAXINTERPOLATIONS]; -int32_t bakipos[MAXINTERPOLATIONS]; -int32_t *curipos[MAXINTERPOLATIONS]; - -projectile_t SpriteProjectile[MAXSPRITES]; - -char CheatKeys[2] = { sc_D, sc_N }; -char setupfilename[BMAX_PATH]= SETUPFILENAME; - -int32_t g_doQuickSave = 0; -uint32_t g_moveThingsCount = 0; - -int32_t g_restorePalette = 0, g_screenCapture = 0, g_noEnemies = 0; + strcpy(setupfilename, SETUPFILENAME); +} diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index d47a68db5..9f1af1189 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -23,24 +23,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __global_h__ #define __global_h__ -#include "duke3d.h" -#include "sector.h" - #ifdef __global_c__ #define G_EXTERN #else #define G_EXTERN extern #endif -// duke3d global soup :( - #define MAXINTERPOLATIONS MAXSPRITES // KEEPINSYNC lunatic/con_lang.lua #define MAXSKILLS 7 -G_EXTERN int32_t myconnectindex, numplayers; +// duke3d global soup :( + +#include "compat.h" +#include "build.h" + +G_EXTERN int32_t g_numInterpolations; +G_EXTERN int32_t g_interpolationLock; +G_EXTERN int32_t oldipos[MAXINTERPOLATIONS]; +G_EXTERN int32_t *curipos[MAXINTERPOLATIONS]; +G_EXTERN int32_t bakipos[MAXINTERPOLATIONS]; G_EXTERN int32_t connectpoint2[MAXPLAYERS]; +#include "duke3d.h" +#include "sector.h" +#include "quotes.h" + +void initialize_globals(void); + +G_EXTERN int32_t myconnectindex, numplayers; + G_EXTERN const char *s_buildRev; G_EXTERN DukeStatus_t sbar; G_EXTERN actor_t actor[MAXSPRITES]; @@ -68,7 +80,6 @@ G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],menutextbuf[128],buf[ G_EXTERN char typebuflen,typebuf[141]; G_EXTERN const char *s_buildDate; G_EXTERN input_t avg; -G_EXTERN input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; G_EXTERN input_t loc; G_EXTERN input_t recsync[RECSYNCBUFSIZ]; G_EXTERN int16_t BlimpSpawnSprites[15]; @@ -84,10 +95,8 @@ G_EXTERN int16_t myang,omyang,mycursectnum,myjumpingcounter; G_EXTERN int16_t myhoriz,omyhoriz,myhorizoff,omyhorizoff; G_EXTERN int16_t neartagsector,neartagwall,neartagsprite; G_EXTERN int32_t *animateptr[MAXANIMATES]; -G_EXTERN int32_t *curipos[MAXINTERPOLATIONS]; G_EXTERN int32_t GametypeFlags[MAXGAMETYPES]; G_EXTERN int32_t animategoal[MAXANIMATES],animatevel[MAXANIMATES],g_animateCount; -G_EXTERN int32_t bakipos[MAXINTERPOLATIONS]; G_EXTERN int32_t cloudtotalclock; G_EXTERN int32_t fricxv,fricyv; G_EXTERN int32_t g_currentFrameRate; @@ -98,11 +107,9 @@ G_EXTERN char g_earthquakeTime; G_EXTERN int32_t g_gameQuit; G_EXTERN int32_t g_groupFileHandle; G_EXTERN int32_t g_impactDamage,g_maxPlayerHealth; -G_EXTERN int32_t g_interpolationLock; G_EXTERN int32_t g_lastSaveSlot; G_EXTERN int32_t g_musicSize; G_EXTERN int32_t g_numFreezeBounces; -G_EXTERN int32_t g_numInterpolations; G_EXTERN int32_t g_numLabels,g_numDefaultLabels; G_EXTERN int32_t g_numRealPalettes; G_EXTERN int32_t g_playerFriction; @@ -111,10 +118,10 @@ G_EXTERN int32_t g_scriptSize; G_EXTERN int32_t g_showShareware; G_EXTERN int32_t g_spriteGravity; G_EXTERN int32_t g_timerTicsPerSecond; +G_EXTERN int8_t g_numPlayerSprites; G_EXTERN int32_t g_tripbombLaserMode; G_EXTERN int32_t msx[2048],msy[2048]; G_EXTERN int32_t neartaghitdist,lockclock,g_startArmorAmount; -G_EXTERN int32_t oldipos[MAXINTERPOLATIONS]; G_EXTERN int32_t playerswhenstarted; G_EXTERN int32_t screenpeek; G_EXTERN int32_t startofdynamicinterpolations; @@ -124,8 +131,11 @@ G_EXTERN intptr_t *g_scriptPtr,*insptr; G_EXTERN int32_t *labelcode,*labeltype; G_EXTERN intptr_t *script; G_EXTERN map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music +#pragma pack(push,1) G_EXTERN playerdata_t g_player[MAXPLAYERS]; G_EXTERN playerspawn_t g_playerSpawnPoints[MAXPLAYERS]; +G_EXTERN input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; +#pragma pack(pop) G_EXTERN projectile_t SpriteProjectile[MAXSPRITES]; G_EXTERN sound_t g_sounds[MAXSOUNDS]; G_EXTERN uint32_t everyothertime; diff --git a/polymer/eduke32/source/grpscan.h b/polymer/eduke32/source/grpscan.h index dec6fc11e..77e5cc93e 100644 --- a/polymer/eduke32/source/grpscan.h +++ b/polymer/eduke32/source/grpscan.h @@ -25,13 +25,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // List of internally-known GRP files #define NUMGRPFILES 9 -struct grpfile { +typedef struct grpfile { const char *name; int32_t crcval; int32_t size; int32_t game; struct grpfile *next; -} grpfiles[NUMGRPFILES], *foundgrps; +} grpfile_type; + +extern struct grpfile grpfiles[NUMGRPFILES]; +extern struct grpfile *foundgrps; int32_t ScanGroups(void); void FreeGroups(void); diff --git a/polymer/eduke32/source/jaudiolib/Makefile b/polymer/eduke32/source/jaudiolib/Makefile index b655c446f..35cfd07d7 100644 --- a/polymer/eduke32/source/jaudiolib/Makefile +++ b/polymer/eduke32/source/jaudiolib/Makefile @@ -36,6 +36,11 @@ ifeq ($(PLATFORM),DARWIN) endif endif +INVOCATION=$(CC) $(OURCONLYFLAGS) +ifneq ($(CPLUSPLUS),0) + INVOCATION=$(CXX) $(OURCXXFLAGS) +endif + OBJECTS=$(OBJ)/drivers.o \ $(OBJ)/fx_man.o \ @@ -69,7 +74,7 @@ $(OBJNAME): $(OBJECTS) $(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c -mkdir -p $(OBJ) $(COMPILE_STATUS) - if $(CC) $(OURCONLYFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi + if $(INVOCATION) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi ifeq ($(PRETTY_OUTPUT),1) .SILENT: diff --git a/polymer/eduke32/source/jaudiolib/include/fx_man.h b/polymer/eduke32/source/jaudiolib/include/fx_man.h index e9c4b34f4..62b8202a7 100644 --- a/polymer/eduke32/source/jaudiolib/include/fx_man.h +++ b/polymer/eduke32/source/jaudiolib/include/fx_man.h @@ -35,6 +35,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "limits.h" #include "sndcards.h" +#ifdef __cplusplus +extern "C" { +#endif + enum FX_ERRORS { FX_Warning = -2, @@ -111,4 +115,9 @@ int32_t FX_StartDemandFeedPlayback( void ( *function )( char **ptr, uint32_t *le int32_t FX_SetVoiceCallback(int32_t handle, uint32_t callbackval); int32_t FX_SetPrintf(void (*function)(const char *, ...)); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/polymer/eduke32/source/jaudiolib/include/msvc/stdint.h b/polymer/eduke32/source/jaudiolib/include/msvc/stdint.h index 11d8dbfd5..eafc0fee3 100644 --- a/polymer/eduke32/source/jaudiolib/include/msvc/stdint.h +++ b/polymer/eduke32/source/jaudiolib/include/msvc/stdint.h @@ -46,11 +46,11 @@ // compiling for ARM we should wrap include with 'extern "C++" {}' // or compiler give many errors like this: // error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus +#ifdef EXTERNC extern "C" { #endif # include -#ifdef __cplusplus +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/source/jaudiolib/src/driver_directsound.c b/polymer/eduke32/source/jaudiolib/src/driver_directsound.c index 5051ecf4f..95767fdbc 100644 --- a/polymer/eduke32/source/jaudiolib/src/driver_directsound.c +++ b/polymer/eduke32/source/jaudiolib/src/driver_directsound.c @@ -24,6 +24,7 @@ #define WIN32_LEAN_AND_MEAN #define DIRECTSOUND_VERSION 0x0700 +#define CINTERFACE #include #include #include diff --git a/polymer/eduke32/source/jaudiolib/src/linklist.h b/polymer/eduke32/source/jaudiolib/src/linklist.h index e4ebd8ad5..99d5de50c 100644 --- a/polymer/eduke32/source/jaudiolib/src/linklist.h +++ b/polymer/eduke32/source/jaudiolib/src/linklist.h @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __linklist_h #define __linklist_h -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif @@ -112,7 +112,7 @@ extern "C" { #define LL_Move LL_MoveNode -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/jmact/_control.h b/polymer/eduke32/source/jmact/_control.h index 149297168..45329d033 100644 --- a/polymer/eduke32/source/jmact/_control.h +++ b/polymer/eduke32/source/jmact/_control.h @@ -34,8 +34,8 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #ifndef _control_private #define _control_private -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif @@ -223,7 +223,7 @@ static int32_t CONTROL_GetTime( void ); void CONTROL_AxisFunctionState( int32_t * state ); void CONTROL_GetJoyMovement( ControlInfo * info ); -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/jmact/_scrplib.h b/polymer/eduke32/source/jmact/_scrplib.h index 89e72bd83..60dedb0b3 100644 --- a/polymer/eduke32/source/jmact/_scrplib.h +++ b/polymer/eduke32/source/jmact/_scrplib.h @@ -31,8 +31,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #ifndef _scriplib_private #define _scriplib_private -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif #define SCRIPTSECTIONSTART ('[') @@ -203,7 +203,7 @@ void SCRIPT_AddEntry void SCRIPT_DecodeToken ( int32_t scripthandle, char * str ); -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/jmact/animlib.h b/polymer/eduke32/source/jmact/animlib.h index ada347d6a..a1fcb57cf 100644 --- a/polymer/eduke32/source/jmact/animlib.h +++ b/polymer/eduke32/source/jmact/animlib.h @@ -33,8 +33,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #ifndef _animlib_public_ #define _animlib_public_ -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif //**************************************************************************** @@ -86,7 +86,7 @@ uint8_t * ANIM_DrawFrame(int32_t framenumber); uint8_t * ANIM_GetPalette(void); -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/jmact/control.h b/polymer/eduke32/source/jmact/control.h index ecc0b79a4..8a23f9c05 100644 --- a/polymer/eduke32/source/jmact/control.h +++ b/polymer/eduke32/source/jmact/control.h @@ -33,8 +33,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #ifndef _control_public #define _control_public -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif @@ -219,7 +219,7 @@ void CONTROL_ProcessBinds(void); extern int32_t extinput[CONTROL_NUM_FLAGS]; extern int32_t control_smoothmouse; -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/jmact/file_lib.h b/polymer/eduke32/source/jmact/file_lib.h index 1cc34375b..e096e787d 100644 --- a/polymer/eduke32/source/jmact/file_lib.h +++ b/polymer/eduke32/source/jmact/file_lib.h @@ -26,8 +26,8 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #ifndef _file_lib_public #define _file_lib_public -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif enum @@ -254,7 +254,7 @@ int32_t ChangeDrive (char *drive); #endif -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/jmact/joystick.h b/polymer/eduke32/source/jmact/joystick.h index 98c507172..8fb377479 100644 --- a/polymer/eduke32/source/jmact/joystick.h +++ b/polymer/eduke32/source/jmact/joystick.h @@ -2,8 +2,8 @@ #ifndef __joystick_h #define __joystick_h -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif #if defined(GEKKO) @@ -50,7 +50,7 @@ int32_t JOYSTICK_GetAxis( int32_t a ); void JOYSTICK_ClearAxis( int32_t a ); void JOYSTICK_ClearAllAxes( void ); -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif /* __joystick_h */ diff --git a/polymer/eduke32/source/jmact/keyboard.h b/polymer/eduke32/source/jmact/keyboard.h index b5ad6e145..1a80c2800 100644 --- a/polymer/eduke32/source/jmact/keyboard.h +++ b/polymer/eduke32/source/jmact/keyboard.h @@ -27,8 +27,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #ifndef _keyboard_public #define _keyboard_public -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif #include "baselayer.h" // for the keyboard stuff @@ -103,7 +103,7 @@ void KB_Shutdown( void ); #define KB_FlushKeyBoardQueue KB_FlushKeyboardQueue #define KB_GetCh KB_Getch -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/jmact/mathutil.h b/polymer/eduke32/source/jmact/mathutil.h index b4aafa7d4..48839c2a4 100644 --- a/polymer/eduke32/source/jmact/mathutil.h +++ b/polymer/eduke32/source/jmact/mathutil.h @@ -26,8 +26,8 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms */ //------------------------------------------------------------------------- -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif extern int32_t FindDistance2D(int32_t dx, int32_t dy); @@ -35,6 +35,6 @@ extern int32_t FindDistance3D(int32_t dx, int32_t dy, int32_t dz); extern int32_t FindDistance3D_HP(int32_t dx, int32_t dy, int32_t dz); extern int32_t ArcTangentAppx(int32_t dx, int32_t dy); -#ifdef __cplusplus +#ifdef EXTERNC } #endif diff --git a/polymer/eduke32/source/jmact/mouse.h b/polymer/eduke32/source/jmact/mouse.h index c53c838a2..ac7790b3d 100644 --- a/polymer/eduke32/source/jmact/mouse.h +++ b/polymer/eduke32/source/jmact/mouse.h @@ -27,8 +27,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #ifndef __mouse_h #define __mouse_h -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif #define LEFT_MOUSE 1 @@ -50,7 +50,7 @@ int32_t MOUSE_ClearButton( int32_t b ); void MOUSE_ClearAllButtons(void); void MOUSE_GetDelta( int32_t*x, int32_t*y ); -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif /* __mouse_h */ diff --git a/polymer/eduke32/source/jmact/scriplib.h b/polymer/eduke32/source/jmact/scriplib.h index 25eec2d2c..87509d0b6 100644 --- a/polymer/eduke32/source/jmact/scriplib.h +++ b/polymer/eduke32/source/jmact/scriplib.h @@ -28,8 +28,8 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #ifndef _scriplib_public #define _scriplib_public -#ifdef __cplusplus -extern "C" { +#ifdef EXTERNC +{ #endif /* @@ -287,7 +287,7 @@ void SCRIPT_PutDouble ); -#ifdef __cplusplus +#ifdef EXTERNC }; #endif #endif diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 1885fa950..0100d5361 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -654,7 +654,6 @@ static savehead_t savehead; //static int32_t volnum,levnum,plrskl,numplr; //static char brdfn[BMAX_PATH]; -int32_t g_lastSaveSlot = -1; static void M_DrawBackground(void) { diff --git a/polymer/eduke32/source/net.c b/polymer/eduke32/source/net.c index 42a5a75b5..63e68550d 100644 --- a/polymer/eduke32/source/net.c +++ b/polymer/eduke32/source/net.c @@ -39,6 +39,8 @@ or else fragmentation will occur */ #define SYNCPACKETSIZE 1344 +newgame_t pendingnewgame; + uint32_t g_netMapRevision = 0; ENetHost *g_netServer = NULL; ENetHost *g_netClient = NULL; @@ -1006,7 +1008,7 @@ void Net_RecieveVersion(uint8_t *pbuf, int32_t packbufleng) // Challenge Packets // sends a simple crc32 of the current password, verified by the server before the connection can continue -void Net_SendChallenge(ENetPeer *client) +void Net_SendChallenge() { int32_t l = 1; diff --git a/polymer/eduke32/source/net.h b/polymer/eduke32/source/net.h index 8651560c0..b8ab30b52 100644 --- a/polymer/eduke32/source/net.h +++ b/polymer/eduke32/source/net.h @@ -175,7 +175,7 @@ typedef struct { } newgame_t; #pragma pack(pop) -newgame_t pendingnewgame; +extern newgame_t pendingnewgame; // Connect/Disconnect void Net_Connect(const char *srvaddr); diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 435256bdb..2359dba2b 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -42,7 +42,6 @@ extern El_State g_ElState; #endif static int32_t g_whichPalForPlayer = 9; -int32_t g_numRealPalettes; static uint8_t precachehightile[2][MAXTILES>>3]; static int32_t g_precacheCount; diff --git a/polymer/eduke32/source/premap.h b/polymer/eduke32/source/premap.h index c1392102f..e0ce6cf8b 100644 --- a/polymer/eduke32/source/premap.h +++ b/polymer/eduke32/source/premap.h @@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __premap_h__ #define __premap_h__ -extern const char pow2char[]; - extern int32_t g_levelTextTime; extern int32_t g_numRealPalettes; extern int32_t voting,vote_map,vote_episode; diff --git a/polymer/eduke32/source/rev.h b/polymer/eduke32/source/rev.h index 24e51dcc3..bc3ea3e89 100644 --- a/polymer/eduke32/source/rev.h +++ b/polymer/eduke32/source/rev.h @@ -1 +1 @@ -const char *s_buildRev = "rXXXX"; +s_buildRev = "rXXXX"; diff --git a/polymer/eduke32/source/sdlmusic.c b/polymer/eduke32/source/sdlmusic.c index 441beb9e9..8ee0b04ff 100644 --- a/polymer/eduke32/source/sdlmusic.c +++ b/polymer/eduke32/source/sdlmusic.c @@ -451,7 +451,9 @@ int32_t MUSIC_PlaySong(char *song, int32_t loopflag) if (!sigchld_handler_set) { - struct sigaction sa = { .sa_handler=sigchld_handler, .sa_flags=0 }; + struct sigaction sa; + sa.sa_handler=sigchld_handler; + sa.sa_flags=0; sigemptyset(&sa.sa_mask); if (sigaction(SIGCHLD, &sa, NULL)==-1) diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 6f228274c..df9440696 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -192,15 +192,6 @@ int32_t isanearoperator(int32_t lotag) return 0; } -inline int32_t G_CheckPlayerInSector(int32_t sect) -{ - int32_t i; - for (TRAVERSE_CONNECT(i)) - if ((unsigned)g_player[i].ps->i < MAXSPRITES && sprite[g_player[i].ps->i].sectnum == sect) - return i; - return -1; -} - int32_t ldist(const spritetype *s1, const spritetype *s2) { int32_t x= klabs(s1->x-s2->x); diff --git a/polymer/eduke32/source/sector.h b/polymer/eduke32/source/sector.h index 20d953529..af009f3cf 100644 --- a/polymer/eduke32/source/sector.h +++ b/polymer/eduke32/source/sector.h @@ -109,7 +109,6 @@ void G_AnimateCamSprite(void); void G_AnimateWalls(void); int32_t G_ActivateWarpElevators(int32_t s,int32_t d); int32_t G_CheckActivatorMotion(int32_t lotag); -extern inline int32_t G_CheckPlayerInSector(int32_t sect); void G_DoSectorAnimations(void); void G_OperateActivators(int32_t low,int32_t snum); void G_OperateForceFields(int32_t s,int32_t low); @@ -127,4 +126,6 @@ void P_CheckSectors(int32_t snum); int32_t Sect_DamageCeiling(int32_t sn); int32_t SetAnimation(int32_t animsect,int32_t *animptr,int32_t thegoal,int32_t thevel); +#include "sector_inline.h" + #endif diff --git a/polymer/eduke32/source/sector_inline.c b/polymer/eduke32/source/sector_inline.c new file mode 100644 index 000000000..a5a9ee7ff --- /dev/null +++ b/polymer/eduke32/source/sector_inline.c @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 2010 EDuke32 developers and contributors + +This file is part of EDuke32. + +EDuke32 is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +//------------------------------------------------------------------------- + +#ifndef __sector_inline_c__ +#define __sector_inline_c__ + +#include "compat.h" +#include "build.h" +#include "global.h" +#include "duke3d.h" +#include "macros.h" +#include "player.h" +#include "sector_inline.h" + +EXTERN_INLINE int32_t G_CheckPlayerInSector(int32_t sect) +{ + int32_t i; + for (TRAVERSE_CONNECT(i)) + if ((unsigned)g_player[i].ps->i < MAXSPRITES && sprite[g_player[i].ps->i].sectnum == sect) + return i; + return -1; +} + +#endif diff --git a/polymer/eduke32/source/sector_inline.h b/polymer/eduke32/source/sector_inline.h new file mode 100644 index 000000000..b5d26ea06 --- /dev/null +++ b/polymer/eduke32/source/sector_inline.h @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 2010 EDuke32 developers and contributors + +This file is part of EDuke32. + +EDuke32 is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +//------------------------------------------------------------------------- + +#ifndef __sector_inline_h__ +#define __sector_inline_h__ + +EXTERN_INLINE_HEADER int32_t G_CheckPlayerInSector(int32_t sect); + +#ifndef DISABLE_INLINING +#include "sector_inline.c" +#endif + +#endif diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index cd9fd0a75..0d4104632 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //------------------------------------------------------------------------- +#define __STDC_FORMAT_MACROS +#define __STDC_LIMIT_MACROS + #include #include diff --git a/polymer/eduke32/source/startgtk.game.c b/polymer/eduke32/source/startgtk.game.c index bf1603b66..2a316d225 100644 --- a/polymer/eduke32/source/startgtk.game.c +++ b/polymer/eduke32/source/startgtk.game.c @@ -260,6 +260,9 @@ static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpo // -- SUPPORT FUNCTIONS ------------------------------------------------------- +extern "C" { + extern const GdkPixdata startbanner_pixdata; +} static GdkPixbuf *load_banner(void) { diff --git a/polymer/eduke32/wiibuild.bat b/polymer/eduke32/wiibuild.bat index 962093044..9c1af0cd9 100644 --- a/polymer/eduke32/wiibuild.bat +++ b/polymer/eduke32/wiibuild.bat @@ -9,7 +9,7 @@ if not "%rev%"=="" set vc=svn if "%rev%"=="" for /f "delims=" %%G in ('git svn info 2^>^&1 ^| grep Revision ^| cut -d " " -f 2') do @set rev=r%%G if not "%rev%"=="" set vc=git if "%rev%"=="" set vc=none -if not "%rev%"=="" echo const char *s_buildRev = "%rev%";>source\rev.h +if not "%rev%"=="" echo s_buildRev = "%rev%";>source\rev.h if "%rev%"=="" set rev=rXXXX :: Get the current date: diff --git a/polymer/synthesis.sh b/polymer/synthesis.sh index 3bf8a103f..3c4d414ae 100755 --- a/polymer/synthesis.sh +++ b/polymer/synthesis.sh @@ -74,7 +74,7 @@ then rm mapster32.debug.exe # throw the svn revision into a header. this is ugly. - echo "const char *s_buildRev = \"r$head\";" > source/rev.h + echo "s_buildRev = \"r$head\";" > source/rev.h # clean the tree and build debug first echo "${make[@]}" RELEASE=0 $clean all