diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index 7ee2a8f2f..dfab7af22 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -268,6 +268,7 @@ typedef struct s_pranimatespritesinfo { // EXTERNAL FUNCTIONS int32_t polymer_init(void); +void polymer_uninit(void); void polymer_glinit(void); void polymer_loadboard(void); void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum); @@ -284,7 +285,7 @@ static void polymer_displayrooms(int16_t sectnum); static void polymer_drawplane(_prplane* plane); static inline void polymer_inb4mirror(GLfloat* buffer, GLfloat* plane); static void polymer_animatesprites(void); -static void polymer_clearmapdata(void); +static void polymer_freeboard(void); static void polymer_editorselect(void); // SECTORS static int32_t polymer_initsector(int16_t sectnum); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 601f915af..608da35de 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -5698,6 +5698,9 @@ void uninitengine(void) polymost_glreset(); hicinit(); freeallmodels(); +#ifdef POLYMER + polymer_uninit(); +#endif /* if (cachefilehandle > -1) Bclose(cachefilehandle); if (cacheindexptr != NULL) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 1fc9dfcf1..2cc6789e9 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -625,6 +625,11 @@ int32_t polymer_init(void) return (1); } +void polymer_uninit(void) +{ + polymer_freeboard(); +} + void polymer_glinit(void) { bglClearColor(0.0f, 0.0f, 0.0f, 1.0f); @@ -668,7 +673,7 @@ void polymer_loadboard(void) { int32_t i; - polymer_clearmapdata(); + polymer_freeboard(); i = 0; while (i < numsectors) @@ -1563,7 +1568,7 @@ static void polymer_animatesprites(void) asi.animatesprites(globalposx, globalposy, viewangle, asi.smoothratio); } -static void polymer_clearmapdata(void) +static void polymer_freeboard(void) { int32_t i; diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index c4e73501a..34285eafa 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -341,7 +341,7 @@ void initprintf(const char *f, ...) va_end(va); OSD_Printf(buf); - Bprintf(buf); + Bprintf("%s", buf); if (Bstrlen(dabuf) + Bstrlen(buf) > 1022) { diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 149df3ffd..7031a5b10 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -38,7 +38,7 @@ #include "build.h" #include "a.h" #include "osd.h" - +#include "mmulti.h" // undefine to restrict windowed resolutions to conventional sizes #define ANY_WINDOWED_SIZE @@ -626,7 +626,7 @@ void initprintf(const char *f, ...) Bstrcat(dabuf,buf); - if (++cnt < 16 || flushlogwindow || Bstrlen(dabuf) > 768) + if (++cnt < 16 || flushlogwindow || Bstrlen(dabuf) > 768 || numplayers > 1) { startwin_puts(dabuf); handleevents(); diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index f3160d138..3edd7324b 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2285,6 +2285,8 @@ static void G_MoveWeapons(void) // if( g_sounds[WIERDSHOT_FLY].num == 0 ) // A_PlaySound(WIERDSHOT_FLY,i); + Bmemcpy(&davect,s,sizeof(vec3_t)); + if (ActorExtra[i].projectile.flashcolor) G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, ActorExtra[i].projectile.flashcolor,PR_LIGHT_PRIO_LOW_GAME); @@ -2299,7 +2301,7 @@ static void G_MoveWeapons(void) { k = A_Spawn(i,ActorExtra[i].projectile.spawns); - Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); +// Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); /* sprite[k].x = dax; sprite[k].y = day; @@ -2350,8 +2352,6 @@ static void G_MoveWeapons(void) ll = s->zvel>>1; } - Bmemcpy(&davect,s,sizeof(vec3_t)); - A_GetZLimits(i); qq = CLIPMASK1; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 3fae07fb7..dfa40643f 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -50,7 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #endif -#define BUILDDATE " 20090512" +#define BUILDDATE " 20090522" static int32_t floor_over_floor; @@ -166,10 +166,11 @@ void create_map_snapshot(void) while (next->prev) { next = next->prev; - if (next->next->sectors && next->next->sectors != next->sectors) Bfree(next->next->sectors); - if (next->next->walls && next->next->walls != next->walls) Bfree(next->next->walls); - if (next->next->sprites && next->next->sprites != next->sprites) Bfree(next->next->sprites); + if (next->next->sectors && (next->next->sectors != next->sectors)) Bfree(next->next->sectors); + if (next->next->walls && (next->next->walls != next->walls)) Bfree(next->next->walls); + if (next->next->sprites && (next->next->sprites != next->sprites)) Bfree(next->next->sprites); Bfree(next->next); + next->next = NULL; } } @@ -265,14 +266,18 @@ void map_undoredo_free(void) while (next->prev) { next = next->prev; - if (next->next->sectors && next->next->sectors != next->sectors) Bfree(next->next->sectors); - if (next->next->walls && next->next->walls != next->walls) Bfree(next->next->walls); - if (next->next->sprites && next->next->sprites != next->sprites) Bfree(next->next->sprites); + if (next->next->sectors && (next->next->sectors != next->sectors)) Bfree(next->next->sectors); + if (next->next->walls && (next->next->walls != next->walls)) Bfree(next->next->walls); + if (next->next->sprites && (next->next->sprites != next->sprites)) Bfree(next->next->sprites); + if (next->next == mapstate) + mapstate = NULL; Bfree(next->next); + next->next = NULL; } } - Bfree(mapstate); + if (mapstate) + Bfree(mapstate); mapstate = NULL; } diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 23f307a35..991e66ae3 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -196,7 +196,7 @@ void CONFIG_SetDefaults(void) #endif ud.config.useprecache = 1; ud.config.ForceSetup = 1; - ud.config.NoAutoLoad = 0; + ud.config.NoAutoLoad = 1; ud.config.AmbienceToggle = 1; ud.config.AutoAim = 1; ud.config.FXDevice = 0; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 43db47c4a..6d52b9a54 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1011,6 +1011,7 @@ void C_FreeHashes(void) hash_free(&labelH); } +// "magic" number for { and }, overrides line number in compiled code for later detection #define IFELSE_MAGIC 31337 static int32_t g_ifElseAborted; @@ -1097,12 +1098,17 @@ static int32_t C_SetScriptSize(int32_t size) // Bmemset(&bitptr[osize],0,size-osize); Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((osize+7)>>3)); } - else if (size < osize) + else Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((size+7)>>3)); Bfree(bitptr); bitptr = newbitptr; - script = newscript; + if (script != newscript) + { + initprintf("Relocating compiled code from to 0x%x to 0x%x\n", script, newscript); + script = newscript; + } + g_scriptPtr = (intptr_t *)(script+oscriptPtr); // initprintf("script: %d, bitptr: %d\n",script,bitptr); @@ -1122,7 +1128,7 @@ static int32_t C_SetScriptSize(int32_t size) } } - if (size > osize) + if (size >= osize) { for (i=g_scriptSize-(size-osize)-1; i>=0; i--) if (scriptptrs[i]) diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index e19c52666..9ab764677 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //------------------------------------------------------------------------- #include "duke3d.h" -const char *s_buildDate = "20090512"; +const char *s_buildDate = "20090522"; char *MusicPtr = NULL; int32_t g_musicSize; @@ -115,7 +115,7 @@ char *label; char ActorType[MAXTILES]; intptr_t *script = NULL; -int32_t g_scriptSize = 16384; +int32_t g_scriptSize = 1048576; char typebuflen,typebuf[141];