mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Too much stuff for one commit.
engine: * sector-like sprite clipping now works with x- xor y-flipped actual sprites mapster32: * corruption checker has been hooked up to loading/saving routines to inform/warn the user * also warn if mouse pointer is over corrupt wall which is shown in pink then: you should not move such a wall! * faster map loading by deferring polymer_loadboard to 3d mode entrance (also removes some 'glGetTexLevelParameteriv returned GL_FALSE' warnings) * more logical maphack light handling, the logic is still a bit dodgy though * some menu and misc. function fixup * redundancy elimination... API: * added consts various for 'char *filename' parameters * loadboard() now accepts bit 4 for flags (formerly 'fromwhere') git-svn-id: https://svn.eduke32.com/eduke32@1760 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
8d01b7f403
commit
51eb2c7cd3
11 changed files with 749 additions and 537 deletions
|
@ -435,13 +435,14 @@ int32_t preinitengine(void); // a partial setup of the engine used for launch
|
|||
int32_t initengine(void);
|
||||
void uninitengine(void);
|
||||
void initspritelists(void);
|
||||
int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
|
||||
int32_t loadmaphack(char *filename);
|
||||
int32_t clipmapinfo_load(char *filename);
|
||||
int32_t saveboard(char *filename, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
|
||||
int32_t loadpics(char *filename, int32_t askedsize);
|
||||
int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
|
||||
int32_t loadmaphack(const char *filename);
|
||||
void delete_maphack_lights();
|
||||
int32_t clipmapinfo_load(const char *filename);
|
||||
int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
|
||||
int32_t loadpics(const char *filename, int32_t askedsize);
|
||||
void loadtile(int16_t tilenume);
|
||||
int32_t qloadkvx(int32_t voxindex, char *filename);
|
||||
int32_t qloadkvx(int32_t voxindex, const char *filename);
|
||||
int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
|
||||
void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2);
|
||||
void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat);
|
||||
|
@ -491,6 +492,7 @@ void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) ATTRIBUT
|
|||
int32_t inside(int32_t x, int32_t y, int16_t sectnum);
|
||||
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day);
|
||||
void setfirstwall(int16_t sectnum, int16_t newfirstwall);
|
||||
int32_t checksectorpointer(int16_t i, int16_t sectnum);
|
||||
|
||||
void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3)));
|
||||
int32_t krand(void);
|
||||
|
@ -563,7 +565,7 @@ int32_t changespritesect(int16_t spritenum, int16_t newsectnum);
|
|||
int32_t changespritestat(int16_t spritenum, int16_t newstatnum);
|
||||
int32_t setsprite(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2)));
|
||||
|
||||
int32_t screencapture(char *filename, char inverseit) ATTRIBUTE((nonnull(1)));
|
||||
int32_t screencapture(const char *filename, char inverseit) ATTRIBUTE((nonnull(1)));
|
||||
|
||||
int32_t getclosestcol(int32_t r, int32_t g, int32_t b);
|
||||
|
||||
|
@ -648,7 +650,7 @@ void hicinit(void);
|
|||
// effect bitset: 1 = greyscale, 2 = invert
|
||||
void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect);
|
||||
// flags bitset: 1 = don't compress
|
||||
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, char *filen, float alphacut, float xscale, float yscale, float specpower, float specfactor, char flags);
|
||||
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut, float xscale, float yscale, float specpower, float specfactor, char flags);
|
||||
int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6]);
|
||||
int32_t hicclearsubst(int32_t picnum, int32_t palnum);
|
||||
|
||||
|
@ -688,7 +690,7 @@ int32_t md_definehud (int32_t modelid, int32_t tilex, double xadd, double yadd,
|
|||
int32_t md_undefinetile(int32_t tile);
|
||||
int32_t md_undefinemodel(int32_t modelid);
|
||||
|
||||
int32_t loaddefinitionsfile(char *fn);
|
||||
int32_t loaddefinitionsfile(const char *fn);
|
||||
|
||||
extern int32_t mapversion; // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy
|
||||
int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
|
||||
|
|
|
@ -106,6 +106,15 @@ extern void ExtEditWallData(int16_t wallnum);
|
|||
extern void ExtEditSpriteData(int16_t spritenum);
|
||||
extern const char *ExtGetSectorType(int32_t lotag);
|
||||
|
||||
extern int32_t LoadBoard(const char *filename, uint32_t flags);
|
||||
extern const char *SaveBoard(const char *fn, uint32_t flags);
|
||||
|
||||
#define CORRUPT_SECTOR (1<<17)
|
||||
#define CORRUPT_WALL (1<<18)
|
||||
#define CORRUPT_SPRITE (1<<19)
|
||||
#define CORRUPT_MASK (CORRUPT_SECTOR|CORRUPT_WALL|CORRUPT_SPRITE)
|
||||
#define MAXCORRUPTTHINGS 64
|
||||
extern int32_t numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
|
||||
extern int32_t autocorruptcheck;
|
||||
extern int32_t CheckMapCorruption(int32_t printfromlev);
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ int8_t sideview_reversehrot = 0;
|
|||
|
||||
char lastpm16buf[156];
|
||||
|
||||
static int32_t checksectorpointer_warn = 0;
|
||||
//static int32_t checksectorpointer_warn = 0;
|
||||
|
||||
char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck);
|
||||
static int32_t adjustmark(int32_t *xplc, int32_t *yplc, int16_t danumwalls);
|
||||
|
@ -217,7 +217,6 @@ static void flipwalls(int16_t numwalls, int16_t newnumwalls);
|
|||
static void insertpoint(int16_t linehighlight, int32_t dax, int32_t day);
|
||||
static void deletepoint(int16_t point);
|
||||
static int32_t deletesector(int16_t sucksect);
|
||||
int32_t checksectorpointer(int16_t i, int16_t sectnum);
|
||||
void fixrepeats(int16_t i);
|
||||
static int16_t loopinside(int32_t x, int32_t y, int16_t startwall);
|
||||
int32_t fillsector(int16_t sectnum, char fillcolor);
|
||||
|
@ -237,11 +236,11 @@ void AutoAlignWalls(int32_t nWall0, int32_t ply);
|
|||
int32_t gettile(int32_t tilenum);
|
||||
|
||||
static int32_t menuselect(void);
|
||||
static int32_t menuselect_pk(int32_t); //PK
|
||||
static int32_t menuselect_auto(int32_t); //PK
|
||||
|
||||
static int32_t getfilenames(const char *path, const char *kind);
|
||||
static void clearfilenames(void);
|
||||
void loadmhk();
|
||||
void loadmhk(int32_t domessage);
|
||||
extern int32_t map_revision;
|
||||
extern int32_t map_undoredo(int32_t dir);
|
||||
extern void map_undoredo_free(void);
|
||||
|
@ -466,15 +465,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
if (k>0)
|
||||
initprintf("There was an error loading the sprite clipping map (status %d).\n", k);
|
||||
|
||||
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;
|
||||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
loadmhk();
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
if (i < 0)
|
||||
if (LoadBoard(boardfilename, 1))
|
||||
{
|
||||
initspritelists();
|
||||
pos.x = 32768;
|
||||
|
@ -485,18 +476,6 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
numwalls = 0;
|
||||
cursectnum = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExtLoadMap(boardfilename);
|
||||
}
|
||||
|
||||
updatenumsprites();
|
||||
|
||||
startposx = pos.x;
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum; // TX 20050225: moved to loadboard
|
||||
|
||||
totalclock = 0;
|
||||
|
||||
|
@ -549,6 +528,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
|
||||
setbrightness(GAMMA_CALC,palette,0);
|
||||
}
|
||||
|
||||
CANCEL:
|
||||
quitflag = 0;
|
||||
while (quitflag == 0)
|
||||
|
@ -638,8 +618,10 @@ CANCEL:
|
|||
|
||||
if (asksave)
|
||||
{
|
||||
i = CheckMapCorruption(4);
|
||||
|
||||
begindrawing(); //{{{
|
||||
printext256(0,8,whitecol,0,"Save changes?",0);
|
||||
printext256(0,8,whitecol,0,i<4?"Save changes?":"Map is heavily corrupt. Save changes?",0);
|
||||
showframe(1); //}}}
|
||||
|
||||
while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]|keystatus[0x2e]) == 0)
|
||||
|
@ -649,29 +631,16 @@ CANCEL:
|
|||
|
||||
if (keystatus[0x15] || keystatus[0x1c]) // Y or ENTER
|
||||
{
|
||||
char *f;
|
||||
keystatus[0x15] = 0;
|
||||
keystatus[0x1c] = 0;
|
||||
fixspritesectors();
|
||||
updatesector(startposx,startposy,&startsectnum);
|
||||
ExtPreSaveMap();
|
||||
if (pathsearchmode) f = boardfilename;
|
||||
else
|
||||
{
|
||||
// virtual filesystem mode can't save to directories so drop the file into
|
||||
// the current directory
|
||||
f = Bstrrchr(boardfilename, '/');
|
||||
if (!f) f = boardfilename; else f++;
|
||||
}
|
||||
saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
ExtSaveMap(f);
|
||||
keystatus[0x15] = keystatus[0x1c] = 0;
|
||||
|
||||
SaveBoard(NULL, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (keystatus[1]||keystatus[0x2e])
|
||||
{
|
||||
keystatus[1] = 0;
|
||||
keystatus[0x2e] = 0;
|
||||
keystatus[1] = keystatus[0x2e] = 0;
|
||||
quitevent = 0;
|
||||
goto CANCEL;
|
||||
}
|
||||
|
@ -703,12 +672,13 @@ void showmouse(void)
|
|||
*/
|
||||
|
||||
static int32_t mhk=0;
|
||||
void loadmhk()
|
||||
void loadmhk(int32_t domessage)
|
||||
{
|
||||
char *p; char levname[BMAX_PATH];
|
||||
|
||||
if (!mhk)
|
||||
return;
|
||||
|
||||
Bstrcpy(levname, boardfilename);
|
||||
p = Bstrrchr(levname,'.');
|
||||
if (!p)
|
||||
|
@ -720,9 +690,20 @@ void loadmhk()
|
|||
p[3]='k';
|
||||
p[4]=0;
|
||||
}
|
||||
|
||||
if (!loadmaphack(levname))
|
||||
{
|
||||
if (domessage)
|
||||
message("Loaded map hack file '%s'",levname);
|
||||
else
|
||||
initprintf("Loaded map hack file '%s'\n",levname);
|
||||
else mhk=2;
|
||||
}
|
||||
else
|
||||
{
|
||||
mhk=2;
|
||||
if (domessage)
|
||||
message("No maphack found for map '%s'",boardfilename);
|
||||
}
|
||||
}
|
||||
|
||||
void editinput(void)
|
||||
|
@ -897,13 +878,14 @@ void editinput(void)
|
|||
{
|
||||
Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES);
|
||||
Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID));
|
||||
delete_maphack_lights();
|
||||
mhk = 0;
|
||||
initprintf("Maphacks disabled\n");
|
||||
message("Maphacks disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
loadmhk();
|
||||
mhk = 1;
|
||||
loadmhk(1);
|
||||
}
|
||||
|
||||
keystatus[0x43] = 0;
|
||||
|
@ -1403,7 +1385,7 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo)
|
|||
|
||||
// reconstruct wall connections
|
||||
numsectors=newnumsectors; // needed now for checksectorpointer
|
||||
checksectorpointer_warn = 0;
|
||||
// checksectorpointer_warn = 0;
|
||||
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
|
||||
for (i=onumsectors; i<newnumsectors; i++)
|
||||
{
|
||||
|
@ -1413,7 +1395,7 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo)
|
|||
}
|
||||
for (i=numwalls; i<newnumwalls; i++)
|
||||
wall[i].x -= editorgridextent<<2;
|
||||
checksectorpointer_warn = 1;
|
||||
// checksectorpointer_warn = 1;
|
||||
|
||||
// insert sprites
|
||||
for (i=0; i<mapinfo->numsprites; i++)
|
||||
|
@ -1677,6 +1659,8 @@ void m32_setkeyfilter(int32_t on)
|
|||
after_handleevents_hook = 0;
|
||||
}
|
||||
|
||||
static int32_t ask_if_sure(const char *query, int32_t quit_is_yes);
|
||||
|
||||
void overheadeditor(void)
|
||||
{
|
||||
char buffer[80], *dabuffer, ch;
|
||||
|
@ -2110,11 +2094,23 @@ void overheadeditor(void)
|
|||
drawline16(searchx,0, searchx,8, editorcolors[15]);
|
||||
drawline16(0,searchy, 8,searchy, editorcolors[15]);
|
||||
|
||||
// draw mouse pointer
|
||||
////// draw mouse pointer
|
||||
col = editorcolors[15 - 3*gridlock];
|
||||
if (joinsector[0] >= 0)
|
||||
col = editorcolors[11];
|
||||
|
||||
if (numcorruptthings>0 && (pointhighlight&16384)==0)
|
||||
{
|
||||
for (i=0; i<numcorruptthings; i++)
|
||||
if ((corruptthings[i]&CORRUPT_MASK)==CORRUPT_WALL &&
|
||||
(corruptthings[i]&(MAXWALLS-1))==pointhighlight)
|
||||
{
|
||||
col = editorcolors[13];
|
||||
printext16(searchx+6,searchy-6-8,editorcolors[13],editorcolors[0],"corrupt wall",0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((keystatus[0x36] || keystatus[0xb8]) && !eitherCTRL) // RSHIFT || RALT
|
||||
{
|
||||
if (keystatus[0x27] || keystatus[0x28]) // ' and ;
|
||||
|
@ -2136,7 +2132,7 @@ void overheadeditor(void)
|
|||
drawline16base(searchx,searchy, +2,+0, +9,+0, col);
|
||||
drawline16base(searchx,searchy, +2,+1, +9,+1, col);
|
||||
|
||||
//Draw the white pixel closest to mouse cursor on linehighlight
|
||||
////// Draw the white pixel closest to mouse cursor on linehighlight
|
||||
if (linehighlight>=0 && !m32_sideview)
|
||||
{
|
||||
getclosestpointonwall(mousxplc,mousyplc,(int32_t)linehighlight,&dax,&day);
|
||||
|
@ -4699,54 +4695,26 @@ SKIP:
|
|||
{
|
||||
nextmap:
|
||||
// bad = 0;
|
||||
i = menuselect_pk(keystatus[0x2a] ? 0:1); // Left Shift: prev map
|
||||
i = menuselect_auto(keystatus[0x2a] ? 0:1); // Left Shift: prev map
|
||||
if (i < 0)
|
||||
{
|
||||
if (i == -2)
|
||||
printmessage16("No .MAP files found.");
|
||||
if (i == -1)
|
||||
message("No more map files.");
|
||||
else if (i == -2)
|
||||
message("No .MAP files found.");
|
||||
else if (i == -3)
|
||||
printmessage16("Load map first!");
|
||||
message("Load map first!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Bstrcpy(boardfilename, selectedboardfilename);
|
||||
|
||||
highlightcnt = -1;
|
||||
Bmemset(show2dwall, 0, sizeof(show2dwall)); //Clear all highlights
|
||||
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
|
||||
if (LoadBoard(NULL, 4))
|
||||
goto nextmap;
|
||||
|
||||
sectorhighlightstat = -1;
|
||||
newnumwalls = -1;
|
||||
joinsector[0] = -1;
|
||||
circlewall = -1;
|
||||
circlepoints = 7;
|
||||
|
||||
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;
|
||||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
oposz = pos.z;
|
||||
if (i < 0)
|
||||
{
|
||||
// printmessage16("Invalid map format.");
|
||||
goto nextmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExtLoadMap(boardfilename);
|
||||
|
||||
if (mapversion < 7) printmessage16("Map %s loaded successfully and autoconverted to V7!",boardfilename);
|
||||
else printmessage16("Map %s loaded successfully.",boardfilename);
|
||||
}
|
||||
updatenumsprites();
|
||||
startposx = pos.x; //this is same
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum;
|
||||
}
|
||||
showframe(1);
|
||||
keystatus[0x1c] = 0;
|
||||
|
@ -4757,7 +4725,6 @@ nextmap:
|
|||
}
|
||||
// ^^^ PK ------------------------------------
|
||||
|
||||
CANCEL:
|
||||
if (keystatus[1] && joinsector[0] >= 0)
|
||||
{
|
||||
keystatus[1]=0;
|
||||
|
@ -4765,6 +4732,7 @@ CANCEL:
|
|||
printmessage16("No sectors joined.");
|
||||
}
|
||||
|
||||
CANCEL:
|
||||
if (keystatus[1])
|
||||
{
|
||||
m32_setkeyfilter(0);
|
||||
|
@ -4779,10 +4747,8 @@ CANCEL:
|
|||
if (handleevents())
|
||||
{
|
||||
if (quitevent)
|
||||
{
|
||||
quitevent = 0;
|
||||
}
|
||||
}
|
||||
idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
@ -4796,19 +4762,10 @@ CANCEL:
|
|||
else if (ch == 'n' || ch == 'N') //N
|
||||
{
|
||||
bad = 0;
|
||||
_printmessage16("Are you sure you want to start a new board? (Y/N)");
|
||||
showframe(1);
|
||||
bflushchars(); ch = 0;
|
||||
while (keystatus[1] == 0)
|
||||
{
|
||||
if (handleevents())
|
||||
quitevent = 0;
|
||||
|
||||
idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
if (ch == 'Y' || ch == 'y')
|
||||
if (!ask_if_sure("Are you sure you want to start a new board? (Y/N)", 0))
|
||||
break;
|
||||
else
|
||||
{
|
||||
int32_t bakstat=-1;
|
||||
mapinfofull_t bakmap;
|
||||
|
@ -4855,11 +4812,7 @@ CANCEL:
|
|||
|
||||
break;
|
||||
}
|
||||
else if (ch == 'N' || ch == 'n' || ch == 13 || ch == ' ')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// printmessage16("");
|
||||
showframe(1);
|
||||
}
|
||||
|
@ -4877,40 +4830,22 @@ CANCEL:
|
|||
int32_t bakstat=-1;
|
||||
mapinfofull_t bakmap;
|
||||
|
||||
Bstrcpy(boardfilename, selectedboardfilename);
|
||||
|
||||
if (highlightsectorcnt > 0)
|
||||
bakstat = backup_highlighted_map(&bakmap);
|
||||
// __old_mapcopy_2__
|
||||
highlightcnt = -1;
|
||||
Bmemset(show2dwall, 0, sizeof(show2dwall)); //Clear all highlights
|
||||
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
|
||||
|
||||
sectorhighlightstat = -1;
|
||||
newnumwalls = -1;
|
||||
joinsector[0] = -1;
|
||||
circlewall = -1;
|
||||
circlepoints = 7;
|
||||
|
||||
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;
|
||||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
loadmhk();
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
oposz = pos.z;
|
||||
if (i < 0)
|
||||
if (LoadBoard(NULL, 4))
|
||||
{
|
||||
printmessage16("Invalid map format.");
|
||||
|
||||
if (bakstat==0)
|
||||
mapinfofull_free(&bakmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExtLoadMap(boardfilename);
|
||||
sectorhighlightstat = -1;
|
||||
joinsector[0] = -1;
|
||||
circlewall = -1;
|
||||
circlepoints = 7;
|
||||
oposz = pos.z;
|
||||
|
||||
if (bakstat==0)
|
||||
{
|
||||
|
@ -4918,23 +4853,15 @@ CANCEL:
|
|||
if (bakstat == -1)
|
||||
message("Can't copy highlighted portion of old map: limits exceeded.");
|
||||
}
|
||||
// __old_mapcopy_2__
|
||||
if (mapversion < 7) printmessage16("Map %s loaded successfully and autoconverted to V7!",boardfilename);
|
||||
else printmessage16("Map %s loaded successfully.",boardfilename);
|
||||
}
|
||||
|
||||
updatenumsprites();
|
||||
startposx = pos.x; //this is same
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum;
|
||||
}
|
||||
showframe(1);
|
||||
keystatus[0x1c] = 0;
|
||||
}
|
||||
else if (ch == 'a' || ch == 'A') //A
|
||||
{
|
||||
int32_t corrupt = CheckMapCorruption(4);
|
||||
|
||||
bad = 0;
|
||||
|
||||
Bstrcpy(selectedboardfilename, boardfilename);
|
||||
|
@ -4951,7 +4878,8 @@ CANCEL:
|
|||
bflushchars();
|
||||
while (bad == 0)
|
||||
{
|
||||
_printmessage16("Save as: ^011%s%s", boardfilename, (totalclock&32)?"_":"");
|
||||
_printmessage16("%sSave as: ^011%s%s", corrupt>=4?"(map corrupt) ":"",
|
||||
boardfilename, (totalclock&32)?"_":"");
|
||||
showframe(1);
|
||||
|
||||
if (handleevents())
|
||||
|
@ -4987,7 +4915,9 @@ CANCEL:
|
|||
}
|
||||
else if (bad == 2)
|
||||
{
|
||||
char *f; int32_t res;
|
||||
const char *f;
|
||||
char *slash;
|
||||
|
||||
keystatus[0x1c] = 0;
|
||||
|
||||
boardfilename[i] = '.';
|
||||
|
@ -4996,52 +4926,43 @@ CANCEL:
|
|||
boardfilename[i+3] = 'p';
|
||||
boardfilename[i+4] = 0;
|
||||
|
||||
if (Bstrrchr(selectedboardfilename,'/'))
|
||||
Bstrcpy(Bstrrchr(selectedboardfilename, '/')+1, boardfilename);
|
||||
else
|
||||
Bstrcpy(selectedboardfilename, boardfilename);
|
||||
if (pathsearchmode) f = selectedboardfilename;
|
||||
else
|
||||
{
|
||||
// virtual filesystem mode can't save to directories so drop the file into
|
||||
// the current directory
|
||||
f = Bstrrchr(selectedboardfilename, '/');
|
||||
if (!f) f = selectedboardfilename; else f++;
|
||||
}
|
||||
_printmessage16("Saving to %s...",f);
|
||||
slash = Bstrrchr(selectedboardfilename,'/');
|
||||
Bstrcpy(slash ? slash+1 : selectedboardfilename, boardfilename);
|
||||
|
||||
_printmessage16("Saving board...");
|
||||
showframe(1);
|
||||
|
||||
fixspritesectors(); //Do this before saving!
|
||||
updatesector(startposx,startposy,&startsectnum);
|
||||
ExtPreSaveMap();
|
||||
res=saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
ExtSaveMap(f);
|
||||
printmessage16((res==0)?"Board saved.":"Saving board failed.");
|
||||
f = SaveBoard(selectedboardfilename, 0);
|
||||
|
||||
if (f)
|
||||
printmessage16("Saved board to %s.", f);
|
||||
else
|
||||
printmessage16("Saving board failed.");
|
||||
|
||||
Bstrcpy(boardfilename, selectedboardfilename);
|
||||
}
|
||||
bad = 0;
|
||||
}
|
||||
else if (ch == 's' || ch == 'S') //S
|
||||
{
|
||||
char *f;
|
||||
int32_t res;
|
||||
const char *f;
|
||||
|
||||
bad = 0;
|
||||
|
||||
if (CheckMapCorruption(4)>=4)
|
||||
if (!ask_if_sure("Map is corrupt. Are you sure you want to save?", 0))
|
||||
break;
|
||||
|
||||
_printmessage16("Saving board...");
|
||||
showframe(1);
|
||||
fixspritesectors(); //Do this before saving!
|
||||
updatesector(startposx,startposy,&startsectnum);
|
||||
if (pathsearchmode) f = boardfilename;
|
||||
|
||||
f = SaveBoard(NULL, 0);
|
||||
|
||||
if (f)
|
||||
printmessage16("Saved board to %s.", f);
|
||||
else
|
||||
{
|
||||
// virtual filesystem mode can't save to directories so drop the file into
|
||||
// the current directory
|
||||
f = Bstrrchr(boardfilename, '/');
|
||||
if (!f) f = boardfilename; else f++;
|
||||
}
|
||||
ExtPreSaveMap();
|
||||
res=saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
ExtSaveMap(f);
|
||||
printmessage16((res==0)?"Board saved.":"Saving board failed.");
|
||||
printmessage16("Saving board failed.");
|
||||
|
||||
showframe(1);
|
||||
}
|
||||
else if (ch == 't' || ch == 'T')
|
||||
|
@ -5063,58 +4984,16 @@ CANCEL:
|
|||
else if (ch == 'q' || ch == 'Q') //Q
|
||||
{
|
||||
bad = 0;
|
||||
_printmessage16("Are you sure you want to quit?");
|
||||
showframe(1);
|
||||
bflushchars();
|
||||
while ((keystatus[1]|keystatus[0x2e]) == 0)
|
||||
{
|
||||
if (handleevents())
|
||||
{
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
if (ch == 'y' || ch == 'Y')
|
||||
if (ask_if_sure("Are you sure you want to quit?", 0))
|
||||
{
|
||||
//QUIT!
|
||||
|
||||
_printmessage16("Save changes?");
|
||||
showframe(1);
|
||||
while ((keystatus[1]|keystatus[0x2e]) == 0)
|
||||
{
|
||||
if (handleevents())
|
||||
{
|
||||
if (quitevent) break; // like saying no
|
||||
}
|
||||
idle();
|
||||
int32_t corrupt = CheckMapCorruption(4);
|
||||
|
||||
ch = bgetchar();
|
||||
if (ask_if_sure(corrupt<4?"Save changes?":"Map corrupt. Save changes?", corrupt<4?0:1))
|
||||
SaveBoard(NULL, 0);
|
||||
|
||||
if (ch == 'y' || ch == 'Y')
|
||||
{
|
||||
char *f;
|
||||
fixspritesectors(); //Do this before saving!
|
||||
updatesector(startposx,startposy,&startsectnum);
|
||||
ExtPreSaveMap();
|
||||
if (pathsearchmode) f = boardfilename;
|
||||
else
|
||||
{
|
||||
// virtual filesystem mode can't save to directories so drop the file into
|
||||
// the current directory
|
||||
f = Bstrrchr(boardfilename, '/');
|
||||
if (!f) f = boardfilename; else f++;
|
||||
}
|
||||
saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
ExtSaveMap(f);
|
||||
break;
|
||||
}
|
||||
else if (ch == 'n' || ch == 'N' || ch == 13 || ch == ' ')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (keystatus[1] || keystatus[0x2e])
|
||||
{
|
||||
keystatus[1] = 0;
|
||||
|
@ -5124,6 +5003,7 @@ CANCEL:
|
|||
showframe(1);
|
||||
goto CANCEL;
|
||||
}
|
||||
|
||||
clearfilenames();
|
||||
uninittimer();
|
||||
uninitinput();
|
||||
|
@ -5131,9 +5011,7 @@ CANCEL:
|
|||
uninitengine();
|
||||
exit(0);
|
||||
}
|
||||
else if (ch == 'n' || ch == 'N' || ch == 13 || ch == ' ')
|
||||
break;
|
||||
}
|
||||
|
||||
// printmessage16("");
|
||||
showframe(1);
|
||||
}
|
||||
|
@ -5185,6 +5063,140 @@ CANCEL:
|
|||
VM_OnEvent(EVENT_ENTER3DMODE, -1);
|
||||
}
|
||||
|
||||
static int32_t ask_if_sure(const char *query, int32_t quit_is_yes)
|
||||
{
|
||||
char ch;
|
||||
|
||||
if (!query)
|
||||
_printmessage16("Are you sure?");
|
||||
else
|
||||
_printmessage16("%s", query);
|
||||
showframe(1);
|
||||
bflushchars();
|
||||
while ((keystatus[1]|keystatus[0x2e]) == 0)
|
||||
{
|
||||
if (handleevents())
|
||||
{
|
||||
if (quitevent)
|
||||
{
|
||||
if (quit_is_yes)
|
||||
return 1;
|
||||
else
|
||||
quitevent = 0;
|
||||
}
|
||||
}
|
||||
idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
if (ch == 'y' || ch == 'Y')
|
||||
return 1;
|
||||
else if (ch == 'n' || ch == 'N' || ch == 13 || ch == ' ')
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// flags: 1:no ExSaveMap (backup.map)
|
||||
const char *SaveBoard(const char *fn, uint32_t flags)
|
||||
{
|
||||
const char *f;
|
||||
int32_t ret;
|
||||
|
||||
if (!fn)
|
||||
fn = boardfilename;
|
||||
|
||||
if (pathsearchmode)
|
||||
f = fn;
|
||||
else
|
||||
{
|
||||
// virtual filesystem mode can't save to directories so drop the file into
|
||||
// the current directory
|
||||
f = Bstrrchr(fn, '/');
|
||||
if (!f)
|
||||
f = fn;
|
||||
else
|
||||
f++;
|
||||
}
|
||||
|
||||
fixspritesectors(); //Do this before saving!
|
||||
updatesector(startposx,startposy,&startsectnum);
|
||||
ExtPreSaveMap();
|
||||
ret = saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
if ((flags&1)==0)
|
||||
ExtSaveMap(f);
|
||||
|
||||
if (ret)
|
||||
return f;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// flags: 1: for running on Mapster32 init
|
||||
// 4: passed to loadboard flags (no polymer_loadboard); implies no maphack loading
|
||||
int32_t LoadBoard(const char *filename, uint32_t flags)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
if (!filename)
|
||||
filename = selectedboardfilename;
|
||||
|
||||
if (filename != boardfilename)
|
||||
Bstrcpy(boardfilename, filename);
|
||||
|
||||
if ((flags&1)==0)
|
||||
{
|
||||
highlightcnt = -1;
|
||||
Bmemset(show2dwall, 0, sizeof(show2dwall)); //Clear all highlights
|
||||
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
|
||||
|
||||
newnumwalls = -1;
|
||||
}
|
||||
|
||||
/// sectorhighlightstat = -1;
|
||||
/// joinsector[0] = -1;
|
||||
/// circlewall = -1;
|
||||
/// circlepoints = 7;
|
||||
|
||||
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;
|
||||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(boardfilename,(flags&4)|(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
if ((flags&4)==0)
|
||||
loadmhk(0);
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
if (i < 0)
|
||||
{
|
||||
// printmessage16("Invalid map format.");
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExtLoadMap(boardfilename);
|
||||
|
||||
if (mapversion < 7) message("Map %s loaded successfully and autoconverted to V7!",boardfilename);
|
||||
else
|
||||
{
|
||||
i = CheckMapCorruption(4);
|
||||
message("Loaded map %s %s",boardfilename, i==0?"successfully":
|
||||
(i<4 ? "(moderate corruption)" : "(HEAVY corruption)"));
|
||||
}
|
||||
}
|
||||
updatenumsprites();
|
||||
startposx = pos.x; //this is same
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum;
|
||||
|
||||
/// oposz = pos.z;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y)
|
||||
{
|
||||
bclamp(&pos.x, -editorgridextent, editorgridextent);
|
||||
|
@ -5594,58 +5606,6 @@ static int32_t movewalls(int32_t start, int32_t offs)
|
|||
return(0);
|
||||
}
|
||||
|
||||
int32_t checksectorpointer(int16_t i, int16_t sectnum)
|
||||
{
|
||||
int32_t j, k, startwall, endwall, x1, y1, x2, y2, numnewwalls=0;
|
||||
|
||||
if (checksectorpointer_warn && (i<0 || i>=max(numwalls,newnumwalls)))
|
||||
{
|
||||
char buf[128];
|
||||
Bsprintf(buf, "WARN: checksectorpointer called with i=%d but (new)numwalls=%d", i, max(numwalls,newnumwalls));
|
||||
OSD_Printf("%s\n", buf);
|
||||
printmessage16("%s", buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
x1 = wall[i].x;
|
||||
y1 = wall[i].y;
|
||||
x2 = POINT2(i).x;
|
||||
y2 = POINT2(i).y;
|
||||
|
||||
if (wall[i].nextwall >= 0) //Check for early exit
|
||||
{
|
||||
k = wall[i].nextwall;
|
||||
if (wall[k].x == x2 && wall[k].y == y2)
|
||||
if (POINT2(k).x == x1 && POINT2(k).y == y1)
|
||||
return(0);
|
||||
}
|
||||
|
||||
wall[i].nextsector = -1;
|
||||
wall[i].nextwall = -1;
|
||||
for (j=0; j<numsectors; j++)
|
||||
{
|
||||
startwall = sector[j].wallptr;
|
||||
endwall = startwall + sector[j].wallnum - 1;
|
||||
for (k=startwall; k<=endwall; k++)
|
||||
{
|
||||
if (wall[k].x == x2 && wall[k].y == y2)
|
||||
if (POINT2(k).x == x1 && POINT2(k).y == y1)
|
||||
if (j != sectnum)
|
||||
{
|
||||
if (sectnum != -2) // -2 means dry run
|
||||
{
|
||||
wall[i].nextsector = j;
|
||||
wall[i].nextwall = k;
|
||||
wall[k].nextsector = sectnum;
|
||||
wall[k].nextwall = i;
|
||||
}
|
||||
numnewwalls++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(numnewwalls);
|
||||
}
|
||||
|
||||
void fixrepeats(int16_t i)
|
||||
{
|
||||
int32_t dist = wallength(i);
|
||||
|
@ -6018,12 +5978,14 @@ static int32_t getfilenames(const char *path, const char *kind)
|
|||
// copied off menuselect
|
||||
|
||||
static const char *g_oldpath=NULL;
|
||||
static int32_t menuselect_pk(int32_t direction) // 20080104: jump to next (direction!=0) or prev (direction==0) file
|
||||
static int32_t menuselect_auto(int32_t direction) // 20080104: jump to next (direction!=0) or prev (direction==0) file
|
||||
{
|
||||
const char *chptr;
|
||||
const char *boardbasename;
|
||||
|
||||
if (!g_oldpath) return -3;
|
||||
else Bmemcpy(selectedboardfilename, g_oldpath, BMAX_PATH);
|
||||
if (!g_oldpath)
|
||||
return -3; // not inited
|
||||
else
|
||||
Bmemcpy(selectedboardfilename, g_oldpath, BMAX_PATH);
|
||||
|
||||
if (pathsearchmode)
|
||||
Bcanonicalisefilename(selectedboardfilename, 1); // clips off the last token and compresses relative path
|
||||
|
@ -6031,25 +5993,35 @@ static int32_t menuselect_pk(int32_t direction) // 20080104: jump to next (direc
|
|||
Bcorrectfilename(selectedboardfilename, 1);
|
||||
|
||||
getfilenames(selectedboardfilename, "*.map");
|
||||
if (numfiles==0)
|
||||
return -2;
|
||||
|
||||
boardbasename = Bstrrchr(boardfilename,'/'); // PK
|
||||
if (!boardbasename)
|
||||
boardbasename=boardfilename;
|
||||
else
|
||||
boardbasename++;
|
||||
|
||||
chptr = Bstrrchr(boardfilename,'/'); // PK
|
||||
if (!chptr) chptr=boardfilename; else chptr++;
|
||||
for (; findfileshigh; findfileshigh=findfileshigh->next)
|
||||
{
|
||||
if (!Bstrcmp(findfileshigh->name,chptr)) break;
|
||||
}
|
||||
if (!Bstrcmp(findfileshigh->name,boardbasename))
|
||||
break;
|
||||
|
||||
if (!findfileshigh) findfileshigh=findfiles;
|
||||
if (!findfileshigh)
|
||||
findfileshigh=findfiles;
|
||||
|
||||
if (direction)
|
||||
{
|
||||
if (findfileshigh->next)
|
||||
findfileshigh=findfileshigh->next;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (findfileshigh->prev)
|
||||
findfileshigh=findfileshigh->prev;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
Bstrcat(selectedboardfilename, findfileshigh->name);
|
||||
|
@ -6062,12 +6034,12 @@ static int32_t menuselect(void)
|
|||
{
|
||||
int32_t listsize;
|
||||
int32_t i;
|
||||
char ch, buffer[96], /*PK*/ *chptr;
|
||||
char ch, buffer[96], /*PK*/ *boardbasename;
|
||||
static char oldpath[BMAX_PATH];
|
||||
CACHE1D_FIND_REC *dir;
|
||||
int32_t bakpathsearchmode = pathsearchmode;
|
||||
|
||||
g_oldpath=oldpath; //PK: need it in menuselect_pk
|
||||
g_oldpath=oldpath; //PK: need it in menuselect_auto
|
||||
|
||||
Bstrcpy(selectedboardfilename, oldpath);
|
||||
if (pathsearchmode)
|
||||
|
@ -6078,13 +6050,18 @@ static int32_t menuselect(void)
|
|||
getfilenames(selectedboardfilename, "*.map");
|
||||
|
||||
// PK 20080103: start with last selected map
|
||||
chptr = Bstrrchr(boardfilename,'/');
|
||||
if (!chptr) chptr=boardfilename; else chptr++;
|
||||
boardbasename = Bstrrchr(boardfilename,'/');
|
||||
if (!boardbasename)
|
||||
boardbasename=boardfilename;
|
||||
else
|
||||
boardbasename++;
|
||||
|
||||
for (; findfileshigh; findfileshigh=findfileshigh->next)
|
||||
{
|
||||
if (!Bstrcmp(findfileshigh->name,chptr)) break;
|
||||
}
|
||||
if (!findfileshigh) findfileshigh=findfiles;
|
||||
if (!Bstrcmp(findfileshigh->name,boardbasename))
|
||||
break;
|
||||
|
||||
if (!findfileshigh)
|
||||
findfileshigh=findfiles;
|
||||
|
||||
begindrawing();
|
||||
_printmessage16("Select map file with arrow keys and enter.");
|
||||
|
@ -6100,9 +6077,9 @@ static int32_t menuselect(void)
|
|||
CLEARLINES2D(0, ydim16, 0);
|
||||
|
||||
if (pathsearchmode)
|
||||
Bstrcpy(buffer,"Local filesystem mode; press F for game filesystem.");
|
||||
Bstrcpy(buffer,"Local filesystem mode. Ctrl-F: game filesystem");
|
||||
else
|
||||
Bsprintf(buffer,"Game filesystem %smode; press F for local filesystem or G for %s.",
|
||||
Bsprintf(buffer,"Game filesystem %smode. Ctrl-F: local filesystem, Ctrl-G: %s",
|
||||
grponlymode?"GRP-only ":"", grponlymode?"all files":"GRP contents only");
|
||||
|
||||
printext16(halfxdim16-(8*Bstrlen(buffer)/2), 4, editorcolors[12],editorcolors[0],buffer,0);
|
||||
|
@ -6183,6 +6160,7 @@ static int32_t menuselect(void)
|
|||
idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
{
|
||||
// JBF 20040208: seek to first name matching pressed character
|
||||
CACHE1D_FIND_REC *seeker = currentlist ? findfiles : finddirs;
|
||||
|
@ -6220,13 +6198,18 @@ static int32_t menuselect(void)
|
|||
else
|
||||
{
|
||||
char ch2;
|
||||
if (ch > 0 && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')))
|
||||
if (ch > 0 && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
|
||||
(ch >= '0' && ch <= '9') || (ch=='_')))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (ch >= 'a') ch -= ('a'-'A');
|
||||
#endif
|
||||
while (seeker)
|
||||
{
|
||||
ch2 = seeker->name[0];
|
||||
#ifdef _WIN32
|
||||
if (ch2 >= 'a' && ch2 <= 'z') ch2 -= ('a'-'A');
|
||||
#endif
|
||||
if (ch2 == ch) break;
|
||||
seeker = seeker->next;
|
||||
}
|
||||
|
@ -6245,7 +6228,7 @@ static int32_t menuselect(void)
|
|||
if (keystatus[0xd0]) ch = 80; // down arr
|
||||
}
|
||||
|
||||
if (ch == 'f' || ch == 'F')
|
||||
if (ch==6) // Ctrl-F
|
||||
{
|
||||
currentlist = 0;
|
||||
pathsearchmode = 1-pathsearchmode;
|
||||
|
@ -6259,7 +6242,7 @@ static int32_t menuselect(void)
|
|||
getfilenames(selectedboardfilename, "*.map");
|
||||
Bstrcpy(oldpath,selectedboardfilename);
|
||||
}
|
||||
else if (ch == 'g' || ch == 'G')
|
||||
else if (ch==7) // Ctrl-G
|
||||
{
|
||||
if (!pathsearchmode)
|
||||
{
|
||||
|
|
|
@ -629,6 +629,9 @@ int32_t kopen4load(const char *filename, char searchfirst)
|
|||
char bad, *gfileptr;
|
||||
intptr_t i;
|
||||
|
||||
if (filename==NULL)
|
||||
return -1;
|
||||
|
||||
while (filehan[newhandle] != -1)
|
||||
{
|
||||
newhandle--;
|
||||
|
|
|
@ -1908,7 +1908,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
}
|
||||
|
||||
|
||||
int32_t loaddefinitionsfile(char *fn)
|
||||
int32_t loaddefinitionsfile(const char *fn)
|
||||
{
|
||||
scriptfile *script;
|
||||
int32_t f = flushlogwindow;
|
||||
|
|
|
@ -168,6 +168,10 @@ qlz_state_decompress *state_decompress = NULL;
|
|||
|
||||
int32_t whitecol;
|
||||
|
||||
#ifdef POLYMER
|
||||
static int16_t maphacklightcnt=0;
|
||||
static int16_t maphacklight[PR_MAXLIGHTS];
|
||||
#endif
|
||||
|
||||
////////// editor side view //////////
|
||||
int32_t m32_sideview = 0;
|
||||
|
@ -230,7 +234,7 @@ static int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index
|
|||
static int16_t *tempictoidx;
|
||||
|
||||
static sectortype *loadsector;
|
||||
static walltype *loadwall;
|
||||
static walltype *loadwall, *loadwallinv;
|
||||
static spritetype *loadsprite;
|
||||
|
||||
// sectoidx bits
|
||||
|
@ -273,6 +277,7 @@ static void clipmapinfo_init()
|
|||
|
||||
if (loadsector) { Bfree(loadsector); loadsector=NULL; }
|
||||
if (loadwall) { Bfree(loadwall); loadwall=NULL; }
|
||||
if (loadwallinv) { Bfree(loadwallinv); loadwallinv=NULL; }
|
||||
if (loadsprite) { Bfree(loadsprite); loadsprite=NULL; }
|
||||
|
||||
clipmapinfo.numsectors = clipmapinfo.numwalls = 0;
|
||||
|
@ -285,7 +290,7 @@ static void clipmapinfo_init()
|
|||
|
||||
// loads the clip maps 0 through 9.
|
||||
// this should be called before any real map is loaded.
|
||||
int32_t clipmapinfo_load(char *filename)
|
||||
int32_t clipmapinfo_load(const char *filename)
|
||||
{
|
||||
int32_t i,k,w, px,py,pz;
|
||||
int16_t ang,cs;
|
||||
|
@ -635,6 +640,56 @@ int32_t clipmapinfo_load(char *filename)
|
|||
Bmemcpy(loadsector, sector, ournumsectors*sizeof(sectortype));
|
||||
Bmemcpy(loadwall, wall, ournumwalls*sizeof(walltype));
|
||||
|
||||
// loadwallinv will contain all walls with inverted orientation for x/y-flip handling
|
||||
loadwallinv = Bmalloc(ournumwalls*sizeof(walltype));
|
||||
if (!loadwallinv)
|
||||
{
|
||||
clipmapinfo_init();
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
int32_t j, loopstart, loopend, numloopwalls;
|
||||
|
||||
// invert walls!
|
||||
loopstart = 0;
|
||||
for (j=0; j<ournumwalls; j++)
|
||||
{
|
||||
wall[j].nextsector = wall[j].nextwall = -1;
|
||||
|
||||
if (wall[j].point2 < j)
|
||||
{
|
||||
loopend = j+1;
|
||||
numloopwalls = loopend-loopstart;
|
||||
|
||||
if (numloopwalls<3)
|
||||
{
|
||||
loopstart = loopend;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (k=0; k<numloopwalls; k++)
|
||||
{
|
||||
wall[loopstart+k].x = loadwall[loopstart + (numloopwalls+1-k)%numloopwalls].x;
|
||||
wall[loopstart+k].y = loadwall[loopstart + (numloopwalls+1-k)%numloopwalls].y;
|
||||
|
||||
CM_WALL_X(loopstart+k) = wall[loopstart+k].x;
|
||||
CM_WALL_Y(loopstart+k) = wall[loopstart+k].y;
|
||||
}
|
||||
|
||||
loopstart = loopend;
|
||||
}
|
||||
}
|
||||
|
||||
// reconstruct wall connections
|
||||
for (i=0; i<ournumsectors; i++)
|
||||
{
|
||||
for (j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
|
||||
checksectorpointer(j, i);
|
||||
}
|
||||
}
|
||||
Bmemcpy(loadwallinv, wall, ournumwalls*sizeof(walltype));
|
||||
|
||||
clipmapinfo.numsectors = numsectors;
|
||||
clipmapinfo.sector = loadsector;
|
||||
clipmapinfo.numwalls = numwalls;
|
||||
|
@ -652,6 +707,7 @@ int32_t clipmapinfo_load(char *filename)
|
|||
// don't let other code be distracted by the temporary map we constructed
|
||||
numsectors = 0;
|
||||
numwalls = 0;
|
||||
initspritelists();
|
||||
|
||||
initprintf("Loaded clip map%s %s.\n", lwcp==loadedwhich+1?"":"s", loadedwhich);
|
||||
|
||||
|
@ -661,6 +717,61 @@ int32_t clipmapinfo_load(char *filename)
|
|||
////// //////
|
||||
|
||||
|
||||
int32_t checksectorpointer(int16_t i, int16_t sectnum)
|
||||
{
|
||||
int32_t j, k, startwall, endwall, x1, y1, x2, y2, numnewwalls=0;
|
||||
|
||||
#if 0
|
||||
if (checksectorpointer_warn && (i<0 || i>=max(numwalls,newnumwalls)))
|
||||
{
|
||||
char buf[128];
|
||||
Bsprintf(buf, "WARN: checksectorpointer called with i=%d but (new)numwalls=%d", i, max(numwalls,newnumwalls));
|
||||
OSD_Printf("%s\n", buf);
|
||||
printmessage16("%s", buf);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
x1 = wall[i].x;
|
||||
y1 = wall[i].y;
|
||||
x2 = (wall[wall[i].point2]).x;
|
||||
y2 = (wall[wall[i].point2]).y;
|
||||
|
||||
if (wall[i].nextwall >= 0) //Check for early exit
|
||||
{
|
||||
k = wall[i].nextwall;
|
||||
if (wall[k].x == x2 && wall[k].y == y2)
|
||||
if ((wall[wall[k].point2]).x == x1 && (wall[wall[k].point2]).y == y1)
|
||||
return(0);
|
||||
}
|
||||
|
||||
wall[i].nextsector = -1;
|
||||
wall[i].nextwall = -1;
|
||||
for (j=0; j<numsectors; j++)
|
||||
{
|
||||
startwall = sector[j].wallptr;
|
||||
endwall = startwall + sector[j].wallnum - 1;
|
||||
for (k=startwall; k<=endwall; k++)
|
||||
{
|
||||
if (wall[k].x == x2 && wall[k].y == y2)
|
||||
if ((wall[wall[k].point2]).x == x1 && (wall[wall[k].point2]).y == y1)
|
||||
if (j != sectnum)
|
||||
{
|
||||
if (sectnum != -2) // -2 means dry run
|
||||
{
|
||||
wall[i].nextsector = j;
|
||||
wall[i].nextwall = k;
|
||||
wall[k].nextsector = sectnum;
|
||||
wall[k].nextwall = i;
|
||||
}
|
||||
numnewwalls++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(numnewwalls);
|
||||
}
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && !defined(NOASM)
|
||||
|
||||
//
|
||||
|
@ -7087,14 +7198,19 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
|||
//
|
||||
// loadboard
|
||||
//
|
||||
int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz,
|
||||
// flags: 1, 2: former parameter "fromwhere"
|
||||
// 4: don't call polymer_loadboard
|
||||
int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy, int32_t *daposz,
|
||||
int16_t *daang, int16_t *dacursectnum)
|
||||
{
|
||||
int16_t fil, i, numsprites, dq[MAXSPRITES], dnum = 0;
|
||||
char myflags = flags&(~3);
|
||||
|
||||
flags &= 3;
|
||||
|
||||
i = strlen(filename)-1;
|
||||
if (filename[i] == 255) { filename[i] = 0; fromwhere = 1; } // JBF 20040119: "compatibility"
|
||||
if ((fil = kopen4load(filename,fromwhere)) == -1)
|
||||
if (filename[i] == 255) { filename[i] = 0; flags = 1; } // JBF 20040119: "compatibility"
|
||||
if ((fil = kopen4load(filename,flags)) == -1)
|
||||
{ mapversion = 7L; return(-1); }
|
||||
|
||||
kread(fil,&mapversion,4); mapversion = B_LITTLE32(mapversion);
|
||||
|
@ -7261,7 +7377,10 @@ int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *dapo
|
|||
|
||||
# ifdef POLYMER
|
||||
if (rendmode == 4)
|
||||
{
|
||||
if ((myflags&4)==0)
|
||||
polymer_loadboard();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -7728,12 +7847,26 @@ int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *d
|
|||
return(0);
|
||||
}
|
||||
|
||||
#ifdef POLYMER
|
||||
void delete_maphack_lights()
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<maphacklightcnt; i++)
|
||||
{
|
||||
polymer_deletelight(maphacklight[i]);
|
||||
maphacklight[i] = -1;
|
||||
}
|
||||
maphacklightcnt = 0;
|
||||
}
|
||||
#else
|
||||
void delete_maphack_lights() {}
|
||||
#endif
|
||||
|
||||
//
|
||||
// loadmaphack
|
||||
//
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
int32_t loadmaphack(char *filename)
|
||||
int32_t loadmaphack(const char *filename)
|
||||
{
|
||||
enum
|
||||
{
|
||||
|
@ -7781,6 +7914,11 @@ int32_t loadmaphack(char *filename)
|
|||
int32_t whichsprite = -1;
|
||||
static char fn[BMAX_PATH];
|
||||
|
||||
#ifdef POLYMER
|
||||
for (i=0; i<PR_MAXLIGHTS; i++)
|
||||
maphacklight[i] = -1;
|
||||
#endif
|
||||
|
||||
if (filename)
|
||||
{
|
||||
memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES);
|
||||
|
@ -7955,6 +8093,7 @@ int32_t loadmaphack(char *filename)
|
|||
case T_LIGHT: // light sector x y z range r g b radius faderadius angle horiz minshade maxshade priority tilenum
|
||||
{
|
||||
int32_t value;
|
||||
int16_t lightid;
|
||||
#pragma pack(push,1)
|
||||
_prlight light;
|
||||
#pragma pack(pop)
|
||||
|
@ -7992,7 +8131,11 @@ int32_t loadmaphack(char *filename)
|
|||
light.tilenum = value;
|
||||
|
||||
if (rendmode == 4)
|
||||
polymer_addlight(&light);
|
||||
{
|
||||
lightid = polymer_addlight(&light);
|
||||
if (lightid>=0)
|
||||
maphacklight[maphacklightcnt++] = lightid;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -8015,7 +8158,7 @@ int32_t loadmaphack(char *filename) { UNREFERENCED_PARAMETER(filename); return -
|
|||
//
|
||||
// saveboard
|
||||
//
|
||||
int32_t saveboard(char *filename, int32_t *daposx, int32_t *daposy, int32_t *daposz,
|
||||
int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_t *daposz,
|
||||
int16_t *daang, int16_t *dacursectnum)
|
||||
{
|
||||
int16_t fil, i, j, numsprites, ts;
|
||||
|
@ -8028,7 +8171,10 @@ int32_t saveboard(char *filename, int32_t *daposx, int32_t *daposy, int32_t *dap
|
|||
spritetype *spri;
|
||||
|
||||
if ((fil = Bopen(filename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{
|
||||
initprintf("Couldn't open \"%s\" for writing: %s\n", filename, strerror(errno));
|
||||
return(-1);
|
||||
}
|
||||
|
||||
for (j=0; j<MAXSPRITES; j++)if ((unsigned)sprite[j].statnum>MAXSTATUS)
|
||||
{
|
||||
|
@ -8362,7 +8508,7 @@ void nextpage(void)
|
|||
//
|
||||
// loadpics
|
||||
//
|
||||
int32_t loadpics(char *filename, int32_t askedsize)
|
||||
int32_t loadpics(const char *filename, int32_t askedsize)
|
||||
{
|
||||
int32_t offscount, localtilestart, localtileend, dasiz;
|
||||
int16_t fil, i, j, k;
|
||||
|
@ -8613,7 +8759,7 @@ void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, in
|
|||
// qloadkvx
|
||||
//
|
||||
#ifdef SUPERBUILD
|
||||
int32_t qloadkvx(int32_t voxindex, char *filename)
|
||||
int32_t qloadkvx(int32_t voxindex, const char *filename)
|
||||
{
|
||||
int32_t i, fil, dasiz, lengcnt, lengtot;
|
||||
char *ptr;
|
||||
|
@ -9602,7 +9748,11 @@ static int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t
|
|||
rotang = (curspr->ang - sector[j].CM_ANG)&2047;
|
||||
dorot = !CM_NOROTS(j);
|
||||
if (dorot)
|
||||
{
|
||||
flipmul = flipx*flipy;
|
||||
if (flipmul==-1)
|
||||
wall = loadwallinv;
|
||||
}
|
||||
|
||||
if ((curspr->cstat&128) != (sector[j].CM_CSTAT&128))
|
||||
daz += (((curspr->cstat&128)>>6)-1)*(((int32_t)tilesizy[curspr->picnum]*(int32_t)curspr->yrepeat)<<1);
|
||||
|
@ -9633,9 +9783,6 @@ static int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t
|
|||
|
||||
wal->x += curspr->x;
|
||||
wal->y += curspr->y;
|
||||
|
||||
if (flipmul==-1)
|
||||
wal->x = vect->x - (wal->x-vect->x);
|
||||
}
|
||||
|
||||
if (inside(vect->x, vect->y, j)==1)
|
||||
|
@ -9679,7 +9826,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
int32_t hitwall, cnt, clipyou;
|
||||
|
||||
spritetype *curspr=NULL; // non-NULL when handling sprite with sector-like clipping
|
||||
int32_t curidx=-1, warned=0, clipspritecnt, mulxdir=1;
|
||||
int32_t curidx=-1, warned=0, clipspritecnt;
|
||||
|
||||
if (((xvect|yvect) == 0) || (*sectnum < 0)) return(0);
|
||||
retval = 0;
|
||||
|
@ -9741,7 +9888,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
continue;
|
||||
}
|
||||
|
||||
mulxdir = clipsprite_initindex(curidx, curspr, &clipsectcnt, vect);
|
||||
clipsprite_initindex(curidx, curspr, &clipsectcnt, vect);
|
||||
}
|
||||
|
||||
|
||||
|
@ -9775,7 +9922,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
{
|
||||
int32_t basez;
|
||||
|
||||
if (rintersect(vect->x,vect->y,0, gx*mulxdir,gy,0, x1,y1, x2,y2, &dax,&day,&daz) == 0)
|
||||
if (rintersect(vect->x,vect->y,0, gx,gy,0, x1,y1, x2,y2, &dax,&day,&daz) == 0)
|
||||
dax = vect->x, day = vect->y;
|
||||
daz = getflorzofslope((int16_t)dasect,dax,day);
|
||||
daz2 = getflorzofslope(wal->nextsector,dax,day);
|
||||
|
@ -9826,20 +9973,10 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
if (!curspr)
|
||||
objtype = (int16_t)j+32768;
|
||||
else
|
||||
{
|
||||
objtype = (int16_t)(curspr-sprite)+49152;
|
||||
if (mulxdir==-1)
|
||||
{
|
||||
x1 = vect->x - (x1-vect->x);
|
||||
x2 = vect->x - (x2-vect->x);
|
||||
swaplong(&x1,&x2);
|
||||
swaplong(&y1,&y2);
|
||||
dx *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
//Add 2 boxes at endpoints
|
||||
bsz = walldist; if (gx*mulxdir < 0) bsz = -bsz;
|
||||
bsz = walldist; if (gx < 0) bsz = -bsz;
|
||||
addclipline(x1-bsz,y1-bsz,x1-bsz,y1+bsz,objtype);
|
||||
addclipline(x2-bsz,y2-bsz,x2-bsz,y2+bsz,objtype);
|
||||
bsz = walldist; if (gy < 0) bsz = -bsz;
|
||||
|
@ -12802,10 +12939,25 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
|
|||
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize)
|
||||
{
|
||||
int32_t stx, i, x, y, charxsiz, ocol = col, obackcol = backcol;
|
||||
int32_t ymin=0, ymax=7;
|
||||
char *fontptr, *letptr, *ptr;
|
||||
char smallbuf[4];
|
||||
|
||||
stx = xpos;
|
||||
|
||||
if (ypos<0)
|
||||
{
|
||||
ymin = 0-ypos;
|
||||
if (ymin>7)
|
||||
return 0;
|
||||
}
|
||||
else if (ypos+7 >= ydim)
|
||||
{
|
||||
ymax = ydim-ypos-1;
|
||||
if (ymax<0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fontsize & 2) printext16(xpos+1, ypos+1, 0, -1, name, (fontsize & ~2) | 4);
|
||||
if (fontsize & 1) { fontptr = smalltextfont; charxsiz = 4; }
|
||||
else { fontptr = textfont; charxsiz = 8; }
|
||||
|
@ -12880,20 +13032,30 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, con
|
|||
}
|
||||
}
|
||||
|
||||
if (stx<0)
|
||||
{
|
||||
stx += charxsiz;
|
||||
continue;
|
||||
}
|
||||
|
||||
letptr = &fontptr[name[i]<<3];
|
||||
ptr = (char *)(bytesperline*(ypos+7)+(stx-(fontsize&1))+frameplace);
|
||||
for (y=7; y>=0; y--)
|
||||
ptr = (char *)(bytesperline*ypos + (stx-(fontsize&1)) + frameplace);
|
||||
for (y=ymin; y<=ymax; y++)
|
||||
{
|
||||
for (x=charxsiz-1; x>=0; x--)
|
||||
for (x=0; x<charxsiz; x++)
|
||||
{
|
||||
if (stx+x >= xdim)
|
||||
break;
|
||||
if (letptr[y]&pow2char[7-(fontsize&1)-x])
|
||||
ptr[x] = (uint8_t)col;
|
||||
else if (backcol >= 0)
|
||||
ptr[x] = (uint8_t)backcol;
|
||||
}
|
||||
ptr -= bytesperline;
|
||||
ptr += bytesperline;
|
||||
}
|
||||
stx += charxsiz;
|
||||
if (stx >= xdim)
|
||||
break;
|
||||
}
|
||||
enddrawing(); //}}}
|
||||
|
||||
|
@ -13021,7 +13183,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const
|
|||
//
|
||||
// screencapture
|
||||
//
|
||||
int32_t screencapture_tga(char *filename, char inverseit)
|
||||
int32_t screencapture_tga(const char *filename, char inverseit)
|
||||
{
|
||||
int32_t i,j;
|
||||
char *ptr, head[18] = { 0,1,1,0,0,0,1,24,0,0,0,0,0/*wlo*/,0/*whi*/,0/*hlo*/,0/*hhi*/,8,0 };
|
||||
|
@ -13203,7 +13365,7 @@ static void writepcxline(char *buf, int32_t bytes, int32_t step, BFILE *fp)
|
|||
if (bytes&1) writepcxbyte(0, 1, fp);
|
||||
}
|
||||
|
||||
int32_t screencapture_pcx(char *filename, char inverseit)
|
||||
int32_t screencapture_pcx(const char *filename, char inverseit)
|
||||
{
|
||||
int32_t i,j,bpl;
|
||||
char *ptr, head[128];
|
||||
|
@ -13339,7 +13501,7 @@ int32_t screencapture_pcx(char *filename, char inverseit)
|
|||
return(0);
|
||||
}
|
||||
|
||||
int32_t screencapture(char *filename, char inverseit)
|
||||
int32_t screencapture(const char *filename, char inverseit)
|
||||
{
|
||||
if (captureformat == 0) return screencapture_tga(filename,inverseit);
|
||||
else return screencapture_pcx(filename,inverseit);
|
||||
|
|
|
@ -117,7 +117,7 @@ void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect)
|
|||
// hicsetsubsttex(picnum,pal,filen,alphacut)
|
||||
// Specifies a replacement graphic file for an ART tile.
|
||||
//
|
||||
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, char *filen, float alphacut, float xscale, float yscale, float specpower, float specfactor, char flags)
|
||||
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut, float xscale, float yscale, float specpower, float specfactor, char flags)
|
||||
{
|
||||
hicreplctyp *hr, *hrn;
|
||||
|
||||
|
@ -296,7 +296,7 @@ int32_t hicclearsubst(int32_t picnum, int32_t palnum)
|
|||
#include "inttypes.h"
|
||||
|
||||
void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect) { }
|
||||
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, char *filen, float alphacut) { return 0; }
|
||||
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut) { return 0; }
|
||||
int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6]) { return 0; }
|
||||
int32_t hicclearsubst(int32_t picnum, int32_t palnum) { return 0; }
|
||||
|
||||
|
|
|
@ -57,12 +57,6 @@ Notes:
|
|||
* The clipping will not change with rendering modes or options.
|
||||
|
||||
|
||||
Known bugs:
|
||||
-----------
|
||||
|
||||
* Flipping doesn't work correctly
|
||||
|
||||
|
||||
Predicted bugs:
|
||||
---------------
|
||||
|
||||
|
|
|
@ -101,6 +101,9 @@ int32_t showambiencesounds=2;
|
|||
|
||||
int32_t autocorruptcheck = 0;
|
||||
static int32_t corruptchecktimer;
|
||||
static int32_t curcorruptthing=-1;
|
||||
|
||||
int32_t numcorruptthings=0, corruptthings[MAXCORRUPTTHINGS];
|
||||
|
||||
static uint32_t templenrepquot;
|
||||
static void fixxrepeat(int16_t i, uint32_t lenrepquot)
|
||||
|
@ -192,6 +195,17 @@ static int16_t tilemarked[(MAXTILES+7)>>3];
|
|||
#ifdef POLYMER
|
||||
static int16_t spritelightid[MAXSPRITES];
|
||||
_prlight *spritelightptr[MAXSPRITES];
|
||||
|
||||
static void DeletePolymerLights()
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
if (spritelightptr[i] != NULL)
|
||||
{
|
||||
polymer_deletelight(spritelightid[i]);
|
||||
spritelightptr[i] = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
extern int32_t graphicsmode;
|
||||
|
||||
|
@ -5508,12 +5522,7 @@ static void Keys3d(void)
|
|||
S_ClearSoundLocks();
|
||||
|
||||
#ifdef POLYMER
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
if (spritelightptr[i] != NULL)
|
||||
{
|
||||
polymer_deletelight(spritelightid[i]);
|
||||
spritelightptr[i] = NULL;
|
||||
}
|
||||
DeletePolymerLights();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -5540,12 +5549,7 @@ static void Keys3d(void)
|
|||
message("Map shade preview %s", shadepreview?"enabled":"disabled");
|
||||
|
||||
#ifdef POLYMER
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
if (spritelightptr[i] != NULL)
|
||||
{
|
||||
polymer_deletelight(spritelightid[i]);
|
||||
spritelightptr[i] = NULL;
|
||||
}
|
||||
DeletePolymerLights();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -6593,7 +6597,7 @@ static void Keys3d(void)
|
|||
|
||||
static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards
|
||||
{
|
||||
char did_wrap = 0;
|
||||
char did_wrap = 0, outofgrid=0;
|
||||
int32_t i, j, k = 0;
|
||||
|
||||
dir = 1-2*(dir<0);
|
||||
|
@ -6672,12 +6676,20 @@ static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards
|
|||
}
|
||||
|
||||
// found matching sprite
|
||||
if (pos.x >= -editorgridextent && pos.x <= editorgridextent &&
|
||||
pos.y >= -editorgridextent && pos.y <= editorgridextent)
|
||||
{
|
||||
pos.x = sprite[gs_cursprite].x;
|
||||
pos.y = sprite[gs_cursprite].y;
|
||||
if (pos.z >= -editorgridextent<<4 && pos.z <= editorgridextent<<4)
|
||||
pos.z = sprite[gs_cursprite].z;
|
||||
ang = sprite[gs_cursprite].ang;
|
||||
}
|
||||
else
|
||||
outofgrid = 1;
|
||||
|
||||
printmessage16("%s Sprite seach%s: found sprite %d", dir<0 ? "<" : ">",
|
||||
did_wrap ? " (wrap)" : "", gs_cursprite);
|
||||
printmessage16("%s Sprite seach%s: found sprite %d%s", dir<0 ? "<" : ">",
|
||||
did_wrap ? " (wrap)" : "", gs_cursprite, outofgrid?"(outside grid)":"");
|
||||
did_wrap = 0;
|
||||
return;
|
||||
|
||||
|
@ -6694,19 +6706,20 @@ static void Keys2d(void)
|
|||
int32_t i=0, j, k;
|
||||
int32_t smooshy, changedir;
|
||||
static int32_t repeatcnt[2] = {0,0}; // was repeatcountx, repeatcounty
|
||||
int32_t tcursectornum;
|
||||
|
||||
// for(i=0;i<0x50;i++) if(keystatus[i]==1) Bsprintf(tempbuf,"key %d",i); printmessage16(tempbuf);
|
||||
|
||||
cursectornum = -1;
|
||||
tcursectornum = -1;
|
||||
for (i=0; i<numsectors; i++)
|
||||
{
|
||||
if (inside(mousxplc,mousyplc,i) == 1)
|
||||
{
|
||||
cursectornum = i;
|
||||
tcursectornum = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
searchsector = cursectornum;
|
||||
searchsector = tcursectornum;
|
||||
|
||||
if (eitherCTRL && PRESSED_KEYSC(Z)) // CTRL+Z
|
||||
{
|
||||
|
@ -6731,16 +6744,16 @@ static void Keys2d(void)
|
|||
drawgradient();
|
||||
showspritedata(pointhighlight&16383, 0);
|
||||
}
|
||||
else if (linehighlight >= 0 /* && ((bstatus&1) || sectorofwall(linehighlight)==cursectornum)*/)
|
||||
else if (linehighlight >= 0 /* && ((bstatus&1) || sectorofwall(linehighlight)==tcursectornum)*/)
|
||||
{
|
||||
drawgradient();
|
||||
showwalldata(linehighlight, 0);
|
||||
}
|
||||
}
|
||||
else if (cursectornum >= 0)
|
||||
else if (tcursectornum >= 0)
|
||||
{
|
||||
drawgradient();
|
||||
showsectordata(cursectornum, 0);
|
||||
showsectordata(tcursectornum, 0);
|
||||
}
|
||||
}
|
||||
else if (!(keystatus[KEYSC_F5]|keystatus[KEYSC_F6]|keystatus[KEYSC_F7]|keystatus[KEYSC_F8]) && !eitherSHIFT)
|
||||
|
@ -6750,7 +6763,7 @@ static void Keys2d(void)
|
|||
/*
|
||||
static int32_t opointhighlight, olinehighlight, ocursectornum;
|
||||
|
||||
if (pointhighlight == opointhighlight && linehighlight == olinehighlight && cursectornum == ocursectornum)
|
||||
if (pointhighlight == opointhighlight && linehighlight == olinehighlight && tcursectornum == ocursectornum)
|
||||
*/
|
||||
if (omx == mousxplc && omy == mousyplc)
|
||||
{
|
||||
|
@ -6766,7 +6779,7 @@ static void Keys2d(void)
|
|||
/*
|
||||
opointhighlight = pointhighlight;
|
||||
olinehighlight = linehighlight;
|
||||
ocursectornum = cursectornum;
|
||||
ocursectornum = tcursectornum;
|
||||
*/
|
||||
|
||||
|
||||
|
@ -6782,10 +6795,10 @@ static void Keys2d(void)
|
|||
if (sprite[i].picnum==SECTOREFFECTOR)
|
||||
_printmessage16("^10%s", SectorEffectorText(i));
|
||||
}
|
||||
else if (linehighlight >= 0 && ((bstatus&1) || sectorofwall(linehighlight)==cursectornum))
|
||||
else if (linehighlight >= 0 && ((bstatus&1) || sectorofwall(linehighlight)==tcursectornum))
|
||||
showwalldata(linehighlight, 1);
|
||||
else if (cursectornum >= 0)
|
||||
showsectordata(cursectornum, 1);
|
||||
else if (tcursectornum >= 0)
|
||||
showsectordata(tcursectornum, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7032,7 +7045,70 @@ static void Keys2d(void)
|
|||
|
||||
if (tsign)
|
||||
{
|
||||
if (wallsprite==0)
|
||||
if (numcorruptthings>0)
|
||||
{
|
||||
int32_t wrap=0, x, y, z;
|
||||
|
||||
if (curcorruptthing<0 || curcorruptthing>=numcorruptthings)
|
||||
curcorruptthing = 0;
|
||||
else
|
||||
{
|
||||
curcorruptthing += tsign;
|
||||
wrap = (curcorruptthing<0 || curcorruptthing>=numcorruptthings);
|
||||
curcorruptthing += numcorruptthings;
|
||||
curcorruptthing %= numcorruptthings;
|
||||
}
|
||||
|
||||
k = corruptthings[curcorruptthing];
|
||||
j = -1;
|
||||
switch (k&CORRUPT_MASK)
|
||||
{
|
||||
case 0:
|
||||
printmessage16("MAP LIMITS EXCEEDED!");
|
||||
break;
|
||||
case CORRUPT_SECTOR:
|
||||
i = k&(MAXSECTORS-1);
|
||||
j = 0;
|
||||
x = wall[sector[i].wallptr].x;
|
||||
y = wall[sector[i].wallptr].y;
|
||||
z = pos.z;
|
||||
break;
|
||||
case CORRUPT_WALL:
|
||||
i = k&(MAXWALLS-1);
|
||||
j = 1;
|
||||
x = wall[i].x;
|
||||
y = wall[i].y;
|
||||
z = pos.z;
|
||||
break;
|
||||
case CORRUPT_SPRITE:
|
||||
i = k&(MAXSPRITES-1);
|
||||
j = 2;
|
||||
x = sprite[i].x;
|
||||
y = sprite[i].y;
|
||||
z = sprite[i].z;
|
||||
break;
|
||||
default:
|
||||
k = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (k)
|
||||
{
|
||||
static const char *secwalspr[3] = {"sector", "wall", "sprite"};
|
||||
if (x>=-editorgridextent && x<=editorgridextent &&
|
||||
y>=-editorgridextent && y<=editorgridextent)
|
||||
{
|
||||
pos.x = x;
|
||||
pos.y = y;
|
||||
pos.z = z;
|
||||
}
|
||||
else x=editorgridextent+1;
|
||||
|
||||
printmessage16("%s Corrupt %s %d%s", tsign<0?"<":">", secwalspr[j], i,
|
||||
(x==editorgridextent+1) ? " (outside grid)" : (wrap ? " (wrap)" : ""));
|
||||
}
|
||||
}
|
||||
else if (wallsprite==0)
|
||||
SearchSectors(tsign);
|
||||
else if (wallsprite==1)
|
||||
{
|
||||
|
@ -7047,6 +7123,7 @@ static void Keys2d(void)
|
|||
{
|
||||
pos.x = wall[i].x - (wall[i].x-POINT2(i).x)/2;
|
||||
pos.y = wall[i].y - (wall[i].y-POINT2(i).y)/2;
|
||||
pos.z = getflorzofslope(sectorofwall(i), pos.x, pos.y);
|
||||
printmessage16("%s Wall search: found", tsign<0?"<":">");
|
||||
return;
|
||||
}
|
||||
|
@ -9138,25 +9215,13 @@ void app_crashhandler(void)
|
|||
{
|
||||
if (levelname[0])
|
||||
{
|
||||
char *f;
|
||||
fixspritesectors(); //Do this before saving!
|
||||
updatesector(startposx,startposy,&startsectnum);
|
||||
if (pathsearchmode)
|
||||
f = levelname;
|
||||
else
|
||||
{
|
||||
// virtual filesystem mode can't save to directories so drop the file into
|
||||
// the current directory
|
||||
f = Bstrrchr(levelname, '/');
|
||||
if (!f) f = levelname; else f++;
|
||||
}
|
||||
f=strstr(levelname,".map");
|
||||
char *f = strstr(levelname,".map");
|
||||
|
||||
if (f)
|
||||
Bstrcpy(f,"_crash.map");
|
||||
else Bstrcat(f,"_crash.map");
|
||||
ExtPreSaveMap();
|
||||
saveboard(levelname,&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
ExtSaveMap(levelname);
|
||||
|
||||
SaveBoard(f, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -9737,16 +9802,6 @@ static void Keys2d3d(void)
|
|||
|
||||
if (eitherCTRL) //CTRL
|
||||
{
|
||||
char *f;
|
||||
if (pathsearchmode) f = levelname;
|
||||
else
|
||||
{
|
||||
// virtual filesystem mode can't save to directories so drop the file into
|
||||
// the current directory
|
||||
f = Bstrrchr(levelname, '/');
|
||||
if (!f) f = levelname; else f++;
|
||||
}
|
||||
|
||||
if (PRESSED_KEYSC(P)) // Ctrl-P: Map playtesting
|
||||
{
|
||||
if (qsetmode != 200)
|
||||
|
@ -9758,56 +9813,50 @@ static void Keys2d3d(void)
|
|||
if (levelname[0])
|
||||
{
|
||||
keystatus[KEYSC_S] = 0;
|
||||
fixspritesectors(); //Do this before saving!
|
||||
updatesector(startposx,startposy,&startsectnum);
|
||||
ExtPreSaveMap();
|
||||
saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
ExtSaveMap(f);
|
||||
|
||||
i = CheckMapCorruption(4);
|
||||
if (i<4)
|
||||
{
|
||||
SaveBoard(levelname, 0);
|
||||
|
||||
message("Board saved");
|
||||
asksave = 0;
|
||||
lastsave=totalclock;
|
||||
}
|
||||
else
|
||||
message("Map is heavily corrupted, not saving. See OSD for details.");
|
||||
}
|
||||
}
|
||||
if (keystatus[KEYSC_L]) // L
|
||||
{
|
||||
extern int32_t grponlymode;
|
||||
extern void loadmhk();
|
||||
|
||||
if (totalclock < (lastsave + 120*10) || !AskIfSure("Are you sure you want to load the last saved map?"))
|
||||
{
|
||||
int32_t sposx=pos.x,sposy=pos.y,sposz=pos.z,sang=ang;
|
||||
char *f;
|
||||
|
||||
if (pathsearchmode) f = levelname;
|
||||
else
|
||||
{
|
||||
// virtual filesystem mode can't save to directories so drop the file into
|
||||
// the current directory
|
||||
f = Bstrrchr(levelname, '/');
|
||||
if (!f) f = levelname; else f++;
|
||||
}
|
||||
|
||||
lastsave=totalclock;
|
||||
highlightcnt = -1;
|
||||
// sectorhighlightstat = -1;
|
||||
// newnumwalls = -1;
|
||||
// joinsector[0] = -1;
|
||||
// circlewall = -1;
|
||||
// circlepoints = 7;
|
||||
|
||||
for (i=MAXSECTORS-1; i>=0; i--) sector[i].extra = -1;
|
||||
for (i=MAXWALLS-1; i>=0; i--) wall[i].extra = -1;
|
||||
for (i=MAXSPRITES-1; i>=0; i--) sprite[i].extra = -1;
|
||||
if (LoadBoard(f, 0))
|
||||
message("Invalid map format.");
|
||||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(f,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
loadmhk();
|
||||
if (i == -2) i = loadoldboard(f,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
if (i < 0) printmessage16("Invalid map format.");
|
||||
else
|
||||
{
|
||||
ExtLoadMap(f);
|
||||
if (mapversion < 7) message("Map %s loaded successfully and autoconverted to V7!",f);
|
||||
else message("Map %s loaded successfully",f);
|
||||
}
|
||||
updatenumsprites();
|
||||
startposx = pos.x;
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum;
|
||||
pos.x=sposx; pos.y=sposy; pos.z=sposz; ang=sang;
|
||||
keystatus[KEYSC_L]=0;
|
||||
updatesectorz(pos.x, pos.y, pos.z, &cursectnum);
|
||||
|
||||
keystatus[KEYSC_L] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9917,7 +9966,8 @@ void ExtCheckKeys(void)
|
|||
|
||||
if (autocorruptcheck>0 && totalclock > corruptchecktimer)
|
||||
{
|
||||
CheckMapCorruption(0);
|
||||
if (CheckMapCorruption(3)>=4)
|
||||
message("Corruption detected. See OSD for details.");
|
||||
corruptchecktimer = totalclock + 120*autocorruptcheck;
|
||||
}
|
||||
}
|
||||
|
@ -9934,12 +9984,17 @@ void ExtCheckKeys(void)
|
|||
{
|
||||
if (asksave == 3)
|
||||
{
|
||||
fixspritesectors(); //Do this before saving!
|
||||
// updatesector(startposx,startposy,&startsectnum);
|
||||
ExtPreSaveMap();
|
||||
saveboard("autosave.map",&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
ExtSaveMap("autosave.map");
|
||||
if (CheckMapCorruption(6)>=4)
|
||||
{
|
||||
SaveBoard("autosave_corrupt.map", 1);
|
||||
message("Board autosaved to AUTOSAVE_CORRUPT.MAP");
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveBoard("autosave.map", 0);
|
||||
message("Board autosaved to AUTOSAVE.MAP");
|
||||
}
|
||||
|
||||
asksave = 4;
|
||||
}
|
||||
autosavetimer = totalclock+120*autosave;
|
||||
|
@ -9955,14 +10010,13 @@ void ExtCheckKeys(void)
|
|||
|
||||
//// port of a.m32's corruptchk ////
|
||||
// returns value from 0 (all OK) to 5 (panic!)
|
||||
#define CORRUPTCHK_PRINT(errlev, fmt, ...) do \
|
||||
#define CORRUPTCHK_PRINT(errlev, what, fmt, ...) do \
|
||||
{ \
|
||||
bad = max(bad, errlev); \
|
||||
if (numcorruptthings<MAXCORRUPTTHINGS) \
|
||||
corruptthings[numcorruptthings++] = what; \
|
||||
if (errlev >= printfromlev) \
|
||||
{ \
|
||||
OSD_Printf(fmt "\n", ## __VA_ARGS__); \
|
||||
if (qsetmode!=200) printmessage16(fmt, ## __VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
int32_t CheckMapCorruption(int32_t printfromlev)
|
||||
|
@ -9972,11 +10026,13 @@ int32_t CheckMapCorruption(int32_t printfromlev)
|
|||
|
||||
int32_t errlevel=0, bad=0;
|
||||
|
||||
numcorruptthings = 0;
|
||||
|
||||
if (numsectors>MAXSECTORS)
|
||||
CORRUPTCHK_PRINT(5, "PANIC!!! SECTOR LIMIT EXCEEDED (MAXSECTORS=%d)!!!", MAXSECTORS);
|
||||
CORRUPTCHK_PRINT(5, 0, "PANIC!!! SECTOR LIMIT EXCEEDED (MAXSECTORS=%d)!!!", MAXSECTORS);
|
||||
|
||||
if (numwalls>MAXWALLS)
|
||||
CORRUPTCHK_PRINT(5, "PANIC!!! WALL LIMIT EXCEEDED (MAXWALLS=%d)!!!", MAXWALLS);
|
||||
CORRUPTCHK_PRINT(5, 0, "PANIC!!! WALL LIMIT EXCEEDED (MAXWALLS=%d)!!!", MAXWALLS);
|
||||
|
||||
if (numsectors>MAXSECTORS || numwalls>MAXWALLS)
|
||||
return bad;
|
||||
|
@ -9989,21 +10045,21 @@ int32_t CheckMapCorruption(int32_t printfromlev)
|
|||
numw = sector[i].wallnum;
|
||||
|
||||
if (w0 < 0 || w0 > numwalls)
|
||||
CORRUPTCHK_PRINT(4, "SECTOR[%d].WALLPTR=%d out of range (numwalls=%d)", i, w0, numw);
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d out of range (numwalls=%d)", i, w0, numw);
|
||||
|
||||
if (w0 != ewall)
|
||||
CORRUPTCHK_PRINT(4, "SECTOR[%d].WALLPTR=%d inconsistent, expected %d", i, w0, ewall);
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d inconsistent, expected %d", i, w0, ewall);
|
||||
|
||||
if (numw <= 1)
|
||||
CORRUPTCHK_PRINT(5, "PANIC!!! SECTOR[%d].WALLNUM=%d INVALID!!!", i, numw);
|
||||
CORRUPTCHK_PRINT(5, CORRUPT_SECTOR|i, "PANIC!!! SECTOR[%d].WALLNUM=%d INVALID!!!", i, numw);
|
||||
else if (numw==2)
|
||||
CORRUPTCHK_PRINT(3, "SECTOR[%d].WALLNUM=2, expected at least 3", i);
|
||||
CORRUPTCHK_PRINT(3, CORRUPT_SECTOR|i, "SECTOR[%d].WALLNUM=2, expected at least 3", i);
|
||||
|
||||
ewall += numw;
|
||||
|
||||
endwall = w0 + numw;
|
||||
if (endwall > numwalls)
|
||||
CORRUPTCHK_PRINT(4, "SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d", i, endwall, numwalls);
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d", i, endwall, numwalls);
|
||||
|
||||
if (bad)
|
||||
errlevel = max(errlevel, bad);
|
||||
|
@ -10016,37 +10072,37 @@ int32_t CheckMapCorruption(int32_t printfromlev)
|
|||
bad = 0;
|
||||
|
||||
if (wall[j].point2 < w0 || wall[j].point2 > endwall)
|
||||
CORRUPTCHK_PRINT(4, "WALL[%d].POINT2=%d out of range [%d, %d]",
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].POINT2=%d out of range [%d, %d]",
|
||||
j, wall[j].point2, w0, endwall);
|
||||
|
||||
nw = wall[j].nextwall;
|
||||
ns = wall[j].nextsector;
|
||||
|
||||
if (nw >= numwalls)
|
||||
CORRUPTCHK_PRINT(4, "WALL[%d].NEXTWALL=%d out of range: numwalls=%d",
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d out of range: numwalls=%d",
|
||||
j, nw, numwalls);
|
||||
|
||||
if (ns >= numsectors)
|
||||
CORRUPTCHK_PRINT(4, "WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d",
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d",
|
||||
j, ns, numsectors);
|
||||
|
||||
if (ns == i)
|
||||
CORRUPTCHK_PRINT(4, "WALL[%d].NEXTSECTOR is its own sector", j);
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR is its own sector", j);
|
||||
|
||||
if (nw>=w0 && nw<=endwall)
|
||||
CORRUPTCHK_PRINT(4, "WALL[%d].NEXTWALL is its own sector's wall", j);
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL is its own sector's wall", j);
|
||||
|
||||
if (bad)
|
||||
errlevel = max(errlevel, bad);
|
||||
else
|
||||
if (!bad)
|
||||
{
|
||||
if (ns>=0 || (ns^nw)<0)
|
||||
{
|
||||
if ((ns^nw)<0 || nw<sector[ns].wallptr || nw>=sector[ns].wallptr+sector[ns].wallnum)
|
||||
CORRUPTCHK_PRINT(4, "WALL[%d].NEXTSECTOR=%d and .NEXTWALL=%d inconsistent",
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d and .NEXTWALL=%d inconsistent",
|
||||
j, ns, nw);
|
||||
}
|
||||
}
|
||||
|
||||
errlevel = max(errlevel, bad);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10058,19 +10114,22 @@ int32_t CheckMapCorruption(int32_t printfromlev)
|
|||
continue;
|
||||
|
||||
if (sprite[i].sectnum<0 || sprite[i].sectnum>=numsectors)
|
||||
CORRUPTCHK_PRINT(2, "SPRITE[%d].SECTNUM=%d. Expect problems!", i, sprite[i].sectnum);
|
||||
CORRUPTCHK_PRINT(2, CORRUPT_SPRITE|i, "SPRITE[%d].SECTNUM=%d. Expect problems!", i, sprite[i].sectnum);
|
||||
|
||||
if (sprite[i].picnum<0 || sprite[i].picnum>=MAXTILES)
|
||||
{
|
||||
sprite[i].picnum = 0;
|
||||
CORRUPTCHK_PRINT(0, "SPRITE[%d].PICNUM=%d out of range, resetting to 0", i, sprite[i].picnum);
|
||||
CORRUPTCHK_PRINT(0, CORRUPT_SPRITE|i, "SPRITE[%d].PICNUM=%d out of range, resetting to 0", i, sprite[i].picnum);
|
||||
}
|
||||
}
|
||||
|
||||
errlevel = max(errlevel, bad);
|
||||
|
||||
if (errlevel)
|
||||
OSD_Printf("--\n");
|
||||
{
|
||||
if (printfromlev<=errlevel)
|
||||
OSD_Printf("-- corruption level: %d\n", errlevel);
|
||||
}
|
||||
|
||||
return errlevel;
|
||||
}
|
||||
|
@ -10126,9 +10185,9 @@ static void SearchSectors(int32_t dir) // <0: backwards, >=0: forwards
|
|||
pos.x = wall[sector[ii].wallptr].x;
|
||||
pos.y = wall[sector[ii].wallptr].y;
|
||||
printmessage16("%s Sector search: found", dir<0?"<":">");
|
||||
cursectornum = ii;
|
||||
return;
|
||||
}
|
||||
cursectornum += dir;
|
||||
}
|
||||
}
|
||||
printmessage16("%s Sector search: none found", dir<0?"<":">");
|
||||
|
|
|
@ -2864,7 +2864,7 @@ dodefault:
|
|||
int32_t col=Gv_GetVarX(*insptr++), odrawlinepat=drawlinepat;
|
||||
int32_t xofs=0, yofs=0, eccen=16384;
|
||||
|
||||
if (tw==CON_DRAWCIRCLE16B)
|
||||
if (tw==CON_DRAWCIRCLE16B || tw==CON_DRAWCIRCLE16Z)
|
||||
{
|
||||
screencoords(&x1,&y1, x1-pos.x,y1-pos.y, zoom);
|
||||
if (m32_sideview)
|
||||
|
|
|
@ -78,7 +78,7 @@ static int32_t lastmessagetime=-1;
|
|||
static char tempbuf[1024];
|
||||
static int32_t numsprite[MAXSPRITES], multisprite[MAXSPRITES];
|
||||
static char lo[64];
|
||||
static char levelname[255];
|
||||
static char levelname[BMAX_PATH];
|
||||
static int16_t curwall=0, curwallnum=0;
|
||||
static int16_t /*cursearchsprite=0,*/ cursearchspritenum=0, cursector_lotag=0, cursectornum=0;
|
||||
static int16_t search_lotag=0,search_hitag=0;
|
||||
|
|
Loading…
Reference in a new issue