From ae6bea7285a9643e7b9efd4d9c31f0d4bb543087 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 21 Apr 2013 19:55:22 +0000 Subject: [PATCH] Mapster32: tweak the 'loaded map' message a bit. - colorize the trailing part if there is corruption or (new) if sprites were removed - also corrupt-check when loading ','?',0,'*',0,32,0,0,0,0,0,0, - 0,0,0,0,0,0,0,'7','8','9','-','4','5','6','+','1', - '2','3','0','.',0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -}; -*/ - #define eitherALT (keystatus[0x38]|keystatus[0xb8]) #define eitherCTRL (keystatus[0x1d]|keystatus[0x9d]) #define eitherSHIFT (keystatus[0x2a]|keystatus[0x36]) @@ -212,6 +188,10 @@ char lastpm16buf[156]; //static int32_t checksectorpointer_warn = 0; static int32_t saveboard_savedtags, saveboard_fixedsprites; +static int32_t backup_highlighted_map(mapinfofull_t *mapinfo); +static int32_t restore_highlighted_map(mapinfofull_t *mapinfo, int32_t forreal); +static void SaveBoardAndPrintMessage(const char *fn); + static int32_t adjustmark(int32_t *xplc, int32_t *yplc, int16_t danumwalls); static void locktogrid(int32_t *dax, int32_t *day); static int32_t checkautoinsert(int32_t dax, int32_t day, int16_t danumwalls); @@ -240,6 +220,7 @@ static void correct_ornamented_sprite(int32_t i, int32_t hitw); static int32_t getfilenames(const char *path, const char *kind); + void clearkeys(void) { Bmemset(keystatus,0,sizeof(keystatus)); @@ -8055,11 +8036,6 @@ int32_t LoadBoard(const char *filename, uint32_t flags) if (filename != boardfilename) Bstrcpy(boardfilename, filename); - // XXX: This is pointless unless loading fails. - for (i=0; i= 4) + Bstrcpy(msgtail, "^12(HEAVY corruption)"); + else if (i > 0) + Bsprintf(msgtail, "^14(removed %d sprites)", i); + else if (ci >= 1 && ci < 4) + Bstrcpy(msgtail, "^14(moderate corruption)"); + else + Bstrcpy(msgtail, "successfully"); + + message("Loaded V%d map %s%s %s", mapversion, boardfilename, tagstat==0?" w/tags":"", msgtail); } startpos = pos; //this is same diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index c3d4827ae..bdf951d31 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -2317,8 +2317,6 @@ static int32_t globalx, globaly, globalz; int16_t sectorborder[256], sectorbordercnt; int32_t ydim16, qsetmode = 0; -vec3_t startpos; -int16_t startang, startsectnum; int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0; #ifndef OBSOLETE_RENDMODES static int32_t lastx[MAXYDIM]; @@ -9595,13 +9593,13 @@ static void prepare_loadboard(int32_t fil, vec3_t *dapos, int16_t *daang, int16_ kread(fil,&dapos->x,4); dapos->x = B_LITTLE32(dapos->x); kread(fil,&dapos->y,4); dapos->y = B_LITTLE32(dapos->y); kread(fil,&dapos->z,4); dapos->z = B_LITTLE32(dapos->z); - kread(fil,daang,2); *daang = B_LITTLE16(*daang); + kread(fil,daang,2); *daang = B_LITTLE16(*daang) & 2047; kread(fil,dacursectnum,2); *dacursectnum = B_LITTLE16(*dacursectnum); } -static void finish_loadboard(const vec3_t *dapos, int16_t *dacursectnum, int16_t numsprites, char myflags) +static int32_t finish_loadboard(const vec3_t *dapos, int16_t *dacursectnum, int16_t numsprites, char myflags) { - int32_t i, realnumsprites=numsprites; + int32_t i, realnumsprites=numsprites, numremoved; #if !defined USE_OPENGL || !defined POLYMER UNREFERENCED_PARAMETER(myflags); @@ -9644,6 +9642,7 @@ static void finish_loadboard(const vec3_t *dapos, int16_t *dacursectnum, int16_t } } + numremoved = (numsprites-realnumsprites); numsprites = realnumsprites; Bassert(numsprites == Numsprites); @@ -9670,6 +9669,8 @@ static void finish_loadboard(const vec3_t *dapos, int16_t *dacursectnum, int16_t } guniqhudid = 0; + + return numremoved; } @@ -9855,13 +9856,7 @@ int32_t loadboard(char *filename, char flags, vec3_t *dapos, int16_t *daang, int yax_updategrays(dapos->z); #endif - finish_loadboard(dapos, dacursectnum, numsprites, myflags); - - startpos = *dapos; - startang = *daang; - startsectnum = *dacursectnum; - - return(0); + return finish_loadboard(dapos, dacursectnum, numsprites, myflags); } @@ -10046,9 +10041,7 @@ int32_t loadoldboard(char *filename, char fromwhere, vec3_t *dapos, int16_t *daa kclose(fil); // Done reading file. - finish_loadboard(dapos, dacursectnum, numsprites, 0); - - return(0); + return finish_loadboard(dapos, dacursectnum, numsprites, 0); } #endif