From 6d5d415ea5abeac53a9925450af68eaabf535e9e Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 15 Nov 2012 14:28:11 +0000 Subject: [PATCH] Split r3159..r3161, part 6: code conditional on __cplusplus. Note the type change of vplce[] in engine.c: int32_t -> uint32_t. git-svn-id: https://svn.eduke32.com/eduke32@3172 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 12 ++++++++++++ polymer/eduke32/build/src/a-c.c | 3 ++- polymer/eduke32/build/src/baselayer.c | 12 +++++++++++- polymer/eduke32/build/src/engine.c | 24 ++++++++++++++++-------- polymer/eduke32/build/src/engine_priv.h | 12 ++++++++++-- polymer/eduke32/source/game.c | 8 +++++++- 6 files changed, 58 insertions(+), 13 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 847ebfe43..19a7699b3 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -407,7 +407,13 @@ EXTERN spritetype *tspriteptr[MAXSPRITESONSCREEN + 1]; EXTERN int32_t xdim, ydim, numpages; EXTERN int32_t yxaspect, viewingrange; +#ifdef __cplusplus +extern "C" { +#endif EXTERN intptr_t ylookup[MAXYDIM+1]; +#ifdef __cplusplus +}; +#endif #define MAXVALIDMODES 256 EXTERN int32_t validmodecnt; @@ -469,8 +475,14 @@ EXTERN int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES]; EXTERN int16_t tilesizx[MAXTILES], tilesizy[MAXTILES]; EXTERN char picsiz[MAXTILES]; EXTERN char walock[MAXTILES]; +#ifdef __cplusplus +extern "C" { +#endif EXTERN char pow2char[8]; EXTERN int32_t pow2long[32]; +#ifdef __cplusplus +}; +#endif EXTERN int32_t picanm[MAXTILES]; EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA diff --git a/polymer/eduke32/build/src/a-c.c b/polymer/eduke32/build/src/a-c.c index 51ef6bce8..31b0919b3 100644 --- a/polymer/eduke32/build/src/a-c.c +++ b/polymer/eduke32/build/src/a-c.c @@ -132,7 +132,8 @@ int32_t vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, in extern intptr_t palookupoffse[4]; -extern int32_t vplce[4], vince[4]; +extern uint32_t vplce[4]; +extern int32_t vince[4]; extern intptr_t bufplce[4]; // cnt >= 1 diff --git a/polymer/eduke32/build/src/baselayer.c b/polymer/eduke32/build/src/baselayer.c index 69ac98379..7678b9157 100644 --- a/polymer/eduke32/build/src/baselayer.c +++ b/polymer/eduke32/build/src/baselayer.c @@ -383,10 +383,20 @@ int32_t baselayer_init(void) # include #endif +#if !defined(NOASM) && !defined(GEKKO) && !defined(__ANDROID__) +#ifdef __cplusplus +extern "C" { +#endif +extern int32_t dep_begin, dep_end; +#ifdef __cplusplus +}; +#endif +#endif + void makeasmwriteable(void) { #if !defined(NOASM) && !defined(GEKKO) && !defined(__ANDROID__) - extern int32_t dep_begin, dep_end; +// extern int32_t dep_begin, dep_end; # if defined _WIN32 DWORD oldprot; if (!VirtualProtect((LPVOID)&dep_begin, (SIZE_T)&dep_end - (SIZE_T)&dep_begin, PAGE_EXECUTE_READWRITE, &oldprot)) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 59e1f282a..8e0c06b80 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -130,7 +130,22 @@ static int16_t *dotp1[MAXYDIM], *dotp2[MAXYDIM]; static int8_t tempbuf[MAXWALLS]; +// referenced from asm +#ifdef __cplusplus +extern "C" { +#endif int32_t ebpbak, espbak; +int32_t reciptable[2048], fpuasm; +intptr_t asm1, asm2, asm3, asm4, palookupoffse[4]; +uint32_t vplce[4]; +int32_t vince[4]; +intptr_t bufplce[4]; +int32_t globaltilesizy; +int32_t globalx1, globaly2, globalx3, globaly3; +#ifdef __cplusplus +}; +#endif + static intptr_t slopalookup[16384]; // was 2048 #if defined(USE_OPENGL) palette_t palookupfog[MAXPALOOKUPS]; @@ -198,8 +213,6 @@ void initialize_engine_globals(void) pow2long[31] = 2147483647L; } -int32_t reciptable[2048], fpuasm; - char britable[16][256]; // JBF 20040207: full 8bit precision extern char textfont[2048], smalltextfont[2048]; @@ -1252,6 +1265,7 @@ static walltype *loadwall, *loadwallinv; static spritetype *loadsprite; // sectoidx bits +#undef CM_NONE #define CM_NONE (CM_MAX<<1) #define CM_SOME (CM_NONE-1) #define CM_OUTER (CM_MAX) // sector surrounds clipping sector @@ -2265,9 +2279,6 @@ static int32_t globalhisibility, globalpisibility, globalcisibility; int32_t xyaspect; static int32_t viewingrangerecip; -intptr_t asm1, asm2, asm3, asm4, palookupoffse[4]; -int32_t vplce[4], vince[4]; -intptr_t bufplce[4]; static char globalxshift, globalyshift; static int32_t globalxpanning, globalypanning; int32_t globalshade, globalorientation; @@ -2277,9 +2288,6 @@ static int32_t globalzd, globalyscale; static int32_t globalxspan, globalyspan, globalispow2=1; // true if texture has power-of-two x and y size static intptr_t globalbufplc; -int32_t globaltilesizy; - -int32_t globalx1, globaly2, globalx3, globaly3; static int32_t globaly1, globalx2, globalzx; static int32_t globalx, globaly, globalz; diff --git a/polymer/eduke32/build/src/engine_priv.h b/polymer/eduke32/build/src/engine_priv.h index 8cc8e0950..b7d32d10e 100644 --- a/polymer/eduke32/build/src/engine_priv.h +++ b/polymer/eduke32/build/src/engine_priv.h @@ -17,6 +17,15 @@ # define YAX_MAXDRAWS 8 #endif +#ifdef __cplusplus +extern "C" { +#endif + extern intptr_t asm1, asm2, asm3, asm4; + extern int32_t globalx1, globaly2; +#ifdef __cplusplus +}; +#endif + //#define OBSOLETE_RENDMODES extern uint8_t basepalcount; @@ -34,10 +43,9 @@ extern int32_t globalpal, cosglobalang, singlobalang; extern int32_t cosviewingrangeglobalang, sinviewingrangeglobalang; extern int32_t globalvisibility; extern int32_t xyaspect; -extern intptr_t asm1, asm2, asm3, asm4; extern int32_t globalshade; extern int16_t globalpicnum; -extern int32_t globalx1, globaly2; + extern int32_t globalorientation; extern int16_t editstatus; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3ff1a8751..088c6f6c2 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9951,7 +9951,13 @@ int32_t app_main(int32_t argc, const char **argv) wm_setapptitle(tempbuf); //initprintf("sizeof(mapstate_t)=%d\n", (int32_t)sizeof(mapstate_t)); - initprintf(HEAD2 " %s\n", s_buildRev); + initprintf(HEAD2 " %s %s\n", s_buildRev, +#ifdef __cplusplus + "C++ build" +#else + "" +#endif + ); initprintf("Compiled %s\n", __DATE__" "__TIME__); #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)