fixes: various ones accumulated in the forum (falling into infinity, stuck in doors), crash in polymer mouse picker when in void space, creation of surplus loops on sector split when sector has weird geometry.

addition: disable sprite sectnum checking with m32script expert mode enabled.

git-svn-id: https://svn.eduke32.com/eduke32@1843 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-03-13 11:59:32 +00:00
parent 0c2157f5eb
commit 16557ff1bb
7 changed files with 457 additions and 439 deletions

View file

@ -69,7 +69,9 @@ extern "C" {
#define YAX_SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (&sector[Sect].floor##Fld) : (&sector[Sect].ceiling##Fld)))
int16_t yax_getbunch(int16_t i, int16_t cf);
void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb);
void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum);
void yax_setbunches(int16_t i, int16_t cb, int16_t fb);
#define CLIPMASK0 (((1L)<<16)+1L)

View file

@ -123,6 +123,8 @@ extern int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
extern int32_t autocorruptcheck;
extern int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing);
extern int32_t m32_script_expertmode; // if true, make read-only vars writable
extern void showsectordata(int16_t sectnum, int16_t small);
extern void showwalldata(int16_t wallnum, int16_t small);
extern void showspritedata(int16_t spritenum, int16_t small);

View file

@ -172,7 +172,6 @@ extern uint32_t m32_drawlinepat;
extern int32_t g_iReturnVar;
extern int32_t m32_sortvar1, m32_sortvar2;
extern int32_t m32_script_expertmode; // if true, make read-only vars writable
//extern int32_t g_numRealPalettes;
//extern int32_t g_scriptDebug;

File diff suppressed because it is too large Load diff

View file

@ -173,24 +173,45 @@ static int16_t maphacklight[PR_MAXLIGHTS];
inline int32_t getscreenvdisp(int32_t bz, int32_t zoome);
void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome);
int16_t editstatus = 0;
////////// YAX //////////
#define YAX_BUNCHNUM(Sect, Cf) (*(int16_t *)(&sector[Sect].ceilingxpanning + 6*Cf))
#ifdef YAX_ENABLE
// all references to floor/ceiling bunchnums should be through the
// get/set functions!
// game-time YAX data structures
static int16_t yax_bunchnum[MAXSECTORS][2];
#define YAX_BUNCHNUM(Sect, Cf) (*(int16_t *)(&sector[Sect].ceilingxpanning + 6*Cf))
int16_t yax_getbunch(int16_t i, int16_t cf)
{
if (editstatus==0)
return yax_bunchnum[i][cf];
if (((*(&sector[i].ceilingstat + cf))&YAX_BIT)==0)
return -1;
return YAX_BUNCHNUM(i, cf);
}
void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb)
{
*cb = yax_getbunch(i, YAX_CEILING);
*fb = yax_getbunch(i, YAX_FLOOR);
}
void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum)
{
if (i<0)
if (editstatus==0)
yax_bunchnum[i][cf] = bunchnum;
if (bunchnum<0)
{
*(&sector[i].ceilingstat + cf) &= ~YAX_BIT;
YAX_BUNCHNUM(i, cf) = 0;
// YAX_BUNCHNUM(i, cf) = 0;
return;
}
@ -198,6 +219,15 @@ void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum)
YAX_BUNCHNUM(i, cf) = bunchnum;
}
void yax_setbunches(int16_t i, int16_t cb, int16_t fb)
{
yax_setbunch(i, YAX_CEILING, cb);
yax_setbunch(i, YAX_FLOOR, fb);
}
#undef YAX_BUNCHNUM
#endif
////////// editor side view //////////
int32_t m32_sideview = 0;
@ -1147,7 +1177,7 @@ static char tablesloaded = 0;
int32_t pageoffset, ydim16, qsetmode = 0;
int32_t startposx, startposy, startposz;
int16_t startang, startsectnum;
int16_t pointhighlight, linehighlight, highlightcnt;
int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0;
int32_t lastx[MAXYDIM];
char *transluc = NULL, paletteloaded = 0;
@ -1196,7 +1226,6 @@ char vgapal16[4*256] =
63,63,63,00
};
int16_t editstatus = 0;
int16_t searchit;
int32_t searchx = -1, searchy; //search input
int16_t searchsector, searchwall, searchstat; //search output
@ -6215,7 +6244,7 @@ int32_t preinitengine(void)
{
dynarray[0].size += M32_FIXME_SECTORS*sizeof(sectortype); // join sectors needs a temp. sector
dynarray[1].size += M32_FIXME_WALLS*sizeof(walltype);
Bprintf("FIXME: Allocating additional space beyond wall[] for editor bugs.\n");
// Bprintf("FIXME: Allocating additional space beyond wall[] for editor bugs.\n");
}
for (i=0; i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++)
@ -6318,10 +6347,6 @@ int32_t initengine(void)
clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L);
automapping = 0;
pointhighlight = -1;
linehighlight = -1;
highlightcnt = 0;
totalclock = 0;
visibility = 512;
parallaxvisibility = 512;

View file

@ -1148,10 +1148,17 @@ void polymer_editorpick(void)
scrvxz[0] = x-scrx;
scrvxz[1] = z-scrz;
if (searchstat==1)
pl = &prsectors[searchsector]->ceil.plane[0];
if (prsectors[searchsector]==NULL)
{
//OSD_Printf("polymer_editorpick: prsectors[searchsector]==NULL !!!\n");
searchwall = sector[num].wallptr;
}
else
pl = &prsectors[searchsector]->floor.plane[0];
{
if (searchstat==1)
pl = &(prsectors[searchsector]->ceil.plane[0]);
else
pl = &(prsectors[searchsector]->floor.plane[0]);
t = dot3f(pl,scrv);
svcoeff = -(dot3f(pl,scr)+pl[3])/t;
@ -1197,6 +1204,7 @@ void polymer_editorpick(void)
searchwall = sector[searchsector].wallptr + bestk;
}
}
// :P
// searchwall = sector[num].wallptr;

View file

@ -206,7 +206,7 @@ extern int16_t capturecount;
extern int32_t editorgridextent; // in engine.c
extern char game_executable[BMAX_PATH];
extern int32_t fillsector(int16_t sectnum, char fillcolor);
//extern int32_t fillsector(int16_t sectnum, char fillcolor);
static void drawgradient()
{
@ -9294,13 +9294,13 @@ void app_crashhandler(void)
void ExtUnInit(void)
{
int32_t i;
// int32_t i;
// setvmode(0x03);
writesetup(setupfilename);
S_SoundShutdown();
uninitgroupfile();
#if 0
for (i = MAX_TILE_GROUPS-1; i >= 0; i--)
{
if (s_TileGroups[i].pIds != NULL)
@ -9310,6 +9310,7 @@ void ExtUnInit(void)
}
for (i = numhelppages-1; i >= 0; i--) Bfree(helppage[i]);
if (helppage) Bfree(helppage);
#endif
}
void ExtPreCheckKeys(void) // just before drawrooms