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 <V7 map
- move start{pos,ang,sectnum} to build.c
- remove pointless ...[].extra = -1 before loading map, scantoasc*[] comment

git-svn-id: https://svn.eduke32.com/eduke32@3697 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-04-21 19:55:22 +00:00
parent 520b608094
commit ae6bea7285
2 changed files with 31 additions and 55 deletions

View file

@ -47,6 +47,11 @@ uint8_t buildkeys[NUMBUILDKEYS] =
0x9c,0x1c,0xd,0xc,0xf,0x29
};
// Start position
vec3_t startpos;
int16_t startang, startsectnum;
// Current position
vec3_t pos;
int32_t horiz = 100;
int16_t ang, cursectnum;
@ -162,35 +167,6 @@ typedef struct
int32_t g_doScreenShot;
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 char scantoasc[128] =
{
0,0,'1','2','3','4','5','6','7','8','9','0','-','=',0,0,
'q','w','e','r','t','y','u','i','o','p','[',']',0,0,'a','s',
'd','f','g','h','j','k','l',';',39,'`',0,92,'z','x','c','v',
'b','n','m',',','.','/',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,
};
static char scantoascwithshift[128] =
{
0,0,'!','@','#','$','%','^','&','*','(',')','_','+',0,0,
'Q','W','E','R','T','Y','U','I','O','P','{','}',0,0,'A','S',
'D','F','G','H','J','K','L',':',34,'~',0,'|','Z','X','C','V',
'B','N','M','<','>','?',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<MAXSECTORS; i++) sector[i].extra = -1;
for (i=0; i<MAXWALLS; i++) wall[i].extra = -1;
for (i=0; i<MAXSPRITES; i++) sprite[i].extra = -1;
editorzrange[0] = INT32_MIN;
editorzrange[1] = INT32_MAX;
@ -8087,13 +8063,20 @@ int32_t LoadBoard(const char *filename, uint32_t flags)
tagstat = taglab_load(boardfilename, loadingflags);
ExtLoadMap(boardfilename);
if (mapversion < 7)
message("Map %s loaded successfully and autoconverted to V7!",boardfilename);
else
{
i = CheckMapCorruption(4, 0);
message("Loaded map %s%s %s", boardfilename, tagstat==0?" w/tags":"",
i==0?"successfully": (i<4 ? "(moderate corruption)" : "(HEAVY corruption)"));
char msgtail[64];
const int32_t ci = CheckMapCorruption(4, 0);
if (ci >= 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

View file

@ -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