From 16cd3c353d9d1550102fc7892f0c2e604147802d Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 29 Sep 2008 02:12:53 +0000 Subject: [PATCH] Fixes git-svn-id: https://svn.eduke32.com/eduke32@1082 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/engine.c | 3 ++- polymer/eduke32/source/config.c | 1 + polymer/eduke32/source/duke3d.h | 1 + polymer/eduke32/source/game.c | 2 +- polymer/eduke32/source/gamedef.c | 5 +++-- polymer/eduke32/source/gamedef.h | 1 + polymer/eduke32/source/gamestructures.c | 9 +++++++++ polymer/eduke32/source/savegame.c | 9 ++++++--- 8 files changed, 24 insertions(+), 7 deletions(-) diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 40a6b05bc..1ac36dd26 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -8950,7 +8950,8 @@ void dragpoint(short pointhighlight, int dax, int day) wall[pointhighlight].x = dax; wall[pointhighlight].y = day; wall[pointhighlight].cstat |= (1<<14); - wall[linehighlight].cstat |= (1<<14); + if (linehighlight >= 0 && linehighlight < MAXWALLS) + wall[linehighlight].cstat |= (1<<14); wall[lastwall(pointhighlight)].cstat |= (1<<14); cnt = MAXWALLS; diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 5561d4f1e..b14cd2fa7 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -247,6 +247,7 @@ void CONFIG_SetDefaults(void) ud.config.UseMouse = 1; ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM ud.display_bonus_screen = 1; + ud.show_level_text = 1; ud.configversion = 0; Bstrcpy(ud.rtsname, "DUKE.RTS"); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 112fe13e3..c9f25e6f9 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -429,6 +429,7 @@ typedef struct { char savegame[10][22]; char pwlockout[128],rtsname[128]; char display_bonus_screen; + char show_level_text; config_t config; } user_defs; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index d573ff2b5..dfc9a28a3 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3787,7 +3787,7 @@ void displayrest(int smoothratio) operatefta(); - if (hud_showmapname && leveltexttime > 1) + if (ud.show_level_text && hud_showmapname && leveltexttime > 1) { int bits = 10+16; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index c3a1793e4..7c4dbc5dc 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -913,6 +913,7 @@ const memberlabel_t userdefslabels[]= { "crosshairscale", USERDEFS_CROSSHAIRSCALE, 0, 0 }, { "althud", USERDEFS_ALTHUD, 0, 0 }, { "display_bonus_screen", USERDEFS_DISPLAY_BONUS_SCREEN, 0, 0 }, + { "show_level_text", USERDEFS_SHOW_LEVEL_TEXT, 0, 0 }, { "", -1, 0, 0 } // END OF LIST }; @@ -1090,7 +1091,7 @@ static int increasescriptsize(int size) newscript = (intptr_t *)Brealloc(script, g_ScriptSize * sizeof(intptr_t)); // bitptr = (char *)Brealloc(bitptr, g_ScriptSize * sizeof(char)); - newbitptr = Bcalloc(1,((size+7)>>3) * sizeof(char)); + newbitptr = Bcalloc(1,(((size+7)>>3)+1) * sizeof(char)); if (newscript == NULL || newbitptr == NULL) { @@ -5681,7 +5682,7 @@ void loadefs(const char *filenam) Bfree(script); script = Bcalloc(1,g_ScriptSize * sizeof(intptr_t)); - bitptr = Bcalloc(1,((g_ScriptSize+7)>>3) * sizeof(char)); + bitptr = Bcalloc(1,(((g_ScriptSize+7)>>3)+1) * sizeof(char)); // initprintf("script: %d, bitptr: %d\n",script,bitptr); labelcnt = defaultlabelcnt = 0; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 37fffc052..c114dc8a7 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -368,6 +368,7 @@ enum userdefslabels USERDEFS_CROSSHAIRSCALE, USERDEFS_ALTHUD, USERDEFS_DISPLAY_BONUS_SCREEN, + USERDEFS_SHOW_LEVEL_TEXT, USERDEFS_END }; diff --git a/polymer/eduke32/source/gamestructures.c b/polymer/eduke32/source/gamestructures.c index 62d0ef657..ebe58c337 100644 --- a/polymer/eduke32/source/gamestructures.c +++ b/polymer/eduke32/source/gamestructures.c @@ -877,6 +877,15 @@ void DoUserDef(int iSet, int lLabelID, int lVar2) SetGameVarID(lVar2, ud.display_bonus_screen, g_i, g_p); return; + case USERDEFS_SHOW_LEVEL_TEXT: + if (iSet) + { + ud.show_level_text = lValue; + return; + } + SetGameVarID(lVar2, ud.show_level_text, g_i, g_p); + return; + default: return; } diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 13beee3cd..0dce3500a 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -277,7 +277,9 @@ int loadplayer(int spot) if (kdfread(&g_ScriptSize,sizeof(g_ScriptSize),1,fil) != 1) goto corrupt; if (!g_ScriptSize) goto corrupt; scriptptrs = Bcalloc(1,g_ScriptSize * sizeof(scriptptrs)); - if (kdfread(&bitptr[0],sizeof(bitptr),(g_ScriptSize+7)>>3,fil) != ((g_ScriptSize+7)>>3)) goto corrupt; + Bfree(bitptr); + bitptr = Bcalloc(1,(((g_ScriptSize+7)>>3)+1) * sizeof(char)); + if (kdfread(&bitptr[0],sizeof(char),(g_ScriptSize+7)>>3,fil) != ((g_ScriptSize+7)>>3)) goto corrupt; if (script != NULL) Bfree(script); script = Bcalloc(1,g_ScriptSize * sizeof(intptr_t)); @@ -662,7 +664,7 @@ int saveplayer(int spot) } // dfwrite(&scriptptrs[0],sizeof(scriptptrs),g_ScriptSize,fil); - dfwrite(&bitptr[0],sizeof(bitptr),(g_ScriptSize+7)>>3,fil); + dfwrite(&bitptr[0],sizeof(char),(g_ScriptSize+7)>>3,fil); dfwrite(&script[0],sizeof(script),g_ScriptSize,fil); for (i=0;i