From 7f9e4157fa4ac76c795a7d5f2b2ad1d533e4d57c Mon Sep 17 00:00:00 2001 From: hnt_ts Date: Fri, 30 May 2008 09:07:50 +0000 Subject: [PATCH] 1. Mapster32 saves autosave variable in the cfg. 2. Autosaving interval is configurable. 3. Sprite noclip is on by default(CTRL+N to toggle). 4. Fixed the devastator crash. Thanks to Nukey for helping me to track it down. Notes about the devastator crash. The yvel of projectile may point to an already removed sprite(its sectnum is MAXSECT). If some code tries to access the sector of the removed sprite, the crash might happen. How to reproduce crashes. True story: Nukey recorded a demo(*.dmo) and send me his demo and map so that I could easily reproduce it and eventually fix the crash. git-svn-id: https://svn.eduke32.com/eduke32@744 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/editor.h | 1 + polymer/build/src/config.c | 7 ++++++- polymer/eduke32/source/actors.c | 4 ++-- polymer/eduke32/source/astub.c | 8 ++++---- polymer/eduke32/source/mapster32.h | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/polymer/build/include/editor.h b/polymer/build/include/editor.h index 9e3fe8218..ec34367ec 100644 --- a/polymer/build/include/editor.h +++ b/polymer/build/include/editor.h @@ -48,6 +48,7 @@ extern int ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup; extern char unrealedlook, quickmapcycling; extern int pk_turnaccel,pk_turndecel,pk_uedaccel; extern int revertCTRL,scrollamount; +extern unsigned char autosave; extern int ExtInit(void); diff --git a/polymer/build/src/config.c b/polymer/build/src/config.c index 73a0324b7..ef904c585 100644 --- a/polymer/build/src/config.c +++ b/polymer/build/src/config.c @@ -213,6 +213,8 @@ int loadsetup(const char *fn) if (readconfig(fp, "turndecel", val, VL) > 0) pk_turndecel = Batoi(val); + if (readconfig(fp, "autosave", val, VL) > 0) autosave = Batoi(val); + for (i=0;i<256;i++)remap[i]=i; remapinit=1; if (readconfig(fp, "remap", val, VL) > 0) @@ -340,6 +342,9 @@ int writesetup(const char *fn) "; Turning deceleration\n" "turndecel = %d\n" "\n" + "; Autosave map interval (minutes)\n" + "autosave = %d\n" + "\n" #if 1 "; Key Settings\n" "; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n" @@ -400,7 +405,7 @@ int writesetup(const char *fn) option[7]>>4, option[2], #endif option[3], msens, unrealedlook, pk_uedaccel, quickmapcycling, - revertCTRL,scrollamount,pk_turnaccel,pk_turndecel, + revertCTRL,scrollamount,pk_turnaccel,pk_turndecel,autosave, #if 1 keys[0], keys[1], keys[2], keys[3], keys[4], keys[5], keys[6], keys[7], keys[8], keys[9], keys[10], keys[11], diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index acace328a..a52cbdacf 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2403,7 +2403,7 @@ static void moveweapons(void) if (j)break; } - if (!(hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) && s->yvel >= 0) + if (!(hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) && s->yvel >= 0 && sprite[s->yvel].sectnum < MAXSECTORS) if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256) j = 49152|s->yvel; @@ -2861,7 +2861,7 @@ static void moveweapons(void) j = movesprite(i,(k*(sintable[(s->ang+512)&2047]))>>14,(k*(sintable[s->ang&2047]))>>14,ll,qq); - if (s->picnum == RPG && s->yvel >= 0) + if (s->picnum == RPG && s->yvel >= 0 && sprite[s->yvel].sectnum < MAXSECTORS) if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256) j = 49152|s->yvel; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 9f2229794..08f14da35 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -48,8 +48,8 @@ static char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp"; static char *duke3dgrp = defaultduke3dgrp; static int fixmapbeforesaving = 1; static int lastsave = -180*60; -static int spnoclip=0; static int NoAutoLoad = 0; +int spnoclip=1; #if !defined(_WIN32) static int usecwd = 0; @@ -7291,7 +7291,7 @@ int ExtInit(void) getmessagetimeoff = 0; Bstrcpy(apptitle, "Mapster32"VERSION""); - autosavetimer = totalclock+120*180; + autosavetimer = totalclock+120*autosave*3; #if defined(_WIN32) && defined(DUKEOSD) OSD_SetFunctions( @@ -7520,7 +7520,7 @@ static void Keys2d3d(void) if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_A]) // ' a { keystatus[KEYSC_A] = 0; - autosave=!autosave; + autosave=autosave?0:3; if (autosave) message("Autosave ON"); else message("Autosave OFF"); } @@ -7552,7 +7552,7 @@ static void Keys2d3d(void) ExtSaveMap("autosave.map"); message("Board autosaved to AUTOSAVE.MAP"); } - autosavetimer = totalclock+120*180; + autosavetimer = totalclock+120*autosave*3; } if (eitherCTRL) //CTRL diff --git a/polymer/eduke32/source/mapster32.h b/polymer/eduke32/source/mapster32.h index bb06707dc..b2cddbbd9 100644 --- a/polymer/eduke32/source/mapster32.h +++ b/polymer/eduke32/source/mapster32.h @@ -93,7 +93,7 @@ short cursprite; int mousxplc, mousyplc, ppointhighlight; int counter=0; unsigned char nosprites=0,purpleon=0,skill=4; -unsigned char framerateon=1,shadepreview=0,autosave=1,sidemode=0; +unsigned char framerateon=1,shadepreview=0,autosave=3,sidemode=0; extern int vel, svel, hvel, angvel; int xvel, yvel, timoff;