diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index d0d634b44..75cabaf84 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -4461,8 +4461,9 @@ finish_qsprintf: int32_t *tmpar = Xmalloc(numbytes); kread(fil, tmpar, numbytes); #endif - aGameArrays[j].plValues = (intptr_t *)Xrealloc( - aGameArrays[j].plValues, numelts * GAR_ELTSZ); + Baligned_free(aGameArrays[j].plValues); + aGameArrays[j].plValues = (intptr_t *)Xaligned_alloc( + ACTOR_VAR_ALIGNMENT, numelts * GAR_ELTSZ); aGameArrays[j].size = numelts; #ifdef BITNESS64 for (int32_t i=0; i 0) { /*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n", aGameArrays[j].szLabel, aGameArrays[j].size, asize);*/ - aGameArrays[j].plValues = (intptr_t *)Xrealloc(aGameArrays[j].plValues, GAR_ELTSZ * asize); + Baligned_free(aGameArrays[j].plValues); + aGameArrays[j].plValues = (intptr_t *)Xaligned_alloc(ACTOR_VAR_ALIGNMENT, GAR_ELTSZ * asize); aGameArrays[j].size = asize; } continue; diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index afcbd124e..14543b3fd 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -30,9 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define _gamevars_c_ -#define PLAYER_VAR_ALIGNMENT (sizeof(intptr_t)) -#define ACTOR_VAR_ALIGNMENT 16 - #ifdef LUNATIC int32_t g_noResetVars; LUNATIC_CB void (*A_ResetVars)(int32_t iActor); diff --git a/polymer/eduke32/source/gamevars.h b/polymer/eduke32/source/gamevars.h index 7e31f27f7..ac8d7dd0a 100644 --- a/polymer/eduke32/source/gamevars.h +++ b/polymer/eduke32/source/gamevars.h @@ -50,6 +50,10 @@ enum GamevarFlags_t { #if !defined LUNATIC +// Alignments for per-player and per-across variables. +#define PLAYER_VAR_ALIGNMENT (sizeof(intptr_t)) +#define ACTOR_VAR_ALIGNMENT 16 + # define MAXGAMEARRAYS (MAXGAMEVARS>>2) // must be lower than MAXGAMEVARS # define MAXARRAYLABEL MAXVARLABEL