mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Fix more overheadmap crashes, this time with 'Last Pissed Time'. Mapster32 now asks to jump to a sector, wall, sprite, or coordinates with 'J. Also fix crash when pressing '-' (not KP-) when aiming at something with tile 0.
git-svn-id: https://svn.eduke32.com/eduke32@1874 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c7280a140b
commit
9c3889e59b
7 changed files with 388 additions and 161 deletions
|
@ -121,12 +121,14 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
|
||||||
// bit 4: 1 = x-flip "F"
|
// bit 4: 1 = x-flip "F"
|
||||||
// bit 5: 1 = y-flip "F"
|
// bit 5: 1 = y-flip "F"
|
||||||
// bit 6: 1 = Align texture to first wall of sector "R"
|
// bit 6: 1 = Align texture to first wall of sector "R"
|
||||||
// bits 7-8: "T"
|
// bits 8-7: "T"
|
||||||
// 00 = normal floors
|
// 00 = normal floors
|
||||||
// 01 = masked floors
|
// 01 = masked floors
|
||||||
// 10 = transluscent masked floors
|
// 10 = transluscent masked floors
|
||||||
// 11 = reverse transluscent masked floors
|
// 11 = reverse transluscent masked floors
|
||||||
// bits 9-15: reserved
|
// bit 9: 1 = blocking ceiling/floor
|
||||||
|
// bit 10: 1 = YAX'ed ceiling/floor
|
||||||
|
// bits 11-15: reserved
|
||||||
|
|
||||||
//40 bytes
|
//40 bytes
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -173,6 +173,8 @@ extern int32_t lastpm16time;
|
||||||
|
|
||||||
extern char lastpm16buf[156];
|
extern char lastpm16buf[156];
|
||||||
|
|
||||||
|
int32_t editor_ask_function(const char *question, char *dachars, int32_t numchars);
|
||||||
|
|
||||||
void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr);
|
void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr);
|
||||||
void DoSpriteOrnament(int32_t i);
|
void DoSpriteOrnament(int32_t i);
|
||||||
|
|
||||||
|
|
|
@ -2413,6 +2413,8 @@ void overheadeditor(void)
|
||||||
{
|
{
|
||||||
int16_t secshort = i;
|
int16_t secshort = i;
|
||||||
|
|
||||||
|
YAX_SKIPSECTOR(i);
|
||||||
|
|
||||||
dabuffer = ExtGetSectorCaption(i);
|
dabuffer = ExtGetSectorCaption(i);
|
||||||
if (dabuffer[0] == 0)
|
if (dabuffer[0] == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2447,6 +2449,8 @@ void overheadeditor(void)
|
||||||
if (zoom < 768 && !(wal->cstat & (1<<14)))
|
if (zoom < 768 && !(wal->cstat & (1<<14)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
YAX_SKIPWALL(i);
|
||||||
|
|
||||||
//Get average point of wall
|
//Get average point of wall
|
||||||
// if ((dax > x3) && (dax < x4) && (day > y3) && (day < y4))
|
// if ((dax > x3) && (dax < x4) && (day > y3) && (day < y4))
|
||||||
{
|
{
|
||||||
|
@ -2461,20 +2465,23 @@ void overheadeditor(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0; j = numsprites; k=0;
|
|
||||||
if (zoom >= 768)
|
if (zoom >= 768)
|
||||||
while (j > 0 && i < MAXSPRITES && (!m32_sideview || k<m32_swcnt))
|
for (i=0, k=0; (m32_sideview && k<m32_swcnt) || (!m32_sideview && i<MAXSPRITES); i++, k++)
|
||||||
{
|
{
|
||||||
if (m32_sideview)
|
if (m32_sideview)
|
||||||
{
|
{
|
||||||
i = m32_wallsprite[k++];
|
i = m32_wallsprite[k];
|
||||||
if (i<MAXWALLS)
|
if (i<MAXWALLS)
|
||||||
continue;
|
continue;
|
||||||
i = i-MAXWALLS;
|
i = i-MAXWALLS;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (sprite[i].statnum == MAXSTATUS)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!m32_sideview && sprite[i].sectnum >= 0)
|
||||||
|
YAX_SKIPSECTOR(sprite[i].sectnum);
|
||||||
|
|
||||||
if (sprite[i].statnum < MAXSTATUS)
|
|
||||||
{
|
|
||||||
dabuffer = ExtGetSpriteCaption(i);
|
dabuffer = ExtGetSpriteCaption(i);
|
||||||
if (dabuffer[0] != 0)
|
if (dabuffer[0] != 0)
|
||||||
{
|
{
|
||||||
|
@ -2490,9 +2497,6 @@ void overheadeditor(void)
|
||||||
drawsmallabel(dabuffer, editorcolors[0], editorcolors[col],
|
drawsmallabel(dabuffer, editorcolors[0], editorcolors[col],
|
||||||
sprite[i].x, sprite[i].y, sprite[i].z);
|
sprite[i].x, sprite[i].y, sprite[i].z);
|
||||||
}
|
}
|
||||||
j--;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5474,7 +5478,7 @@ CANCEL:
|
||||||
// __old_mapcopy_2__
|
// __old_mapcopy_2__
|
||||||
if (LoadBoard(NULL, 4))
|
if (LoadBoard(NULL, 4))
|
||||||
{
|
{
|
||||||
printmessage16("Invalid map format.");
|
message("Invalid map format, nothing loaded.");
|
||||||
if (bakstat==0)
|
if (bakstat==0)
|
||||||
mapinfofull_free(&bakmap);
|
mapinfofull_free(&bakmap);
|
||||||
}
|
}
|
||||||
|
@ -5743,17 +5747,17 @@ static int32_t ask_if_sure(const char *query, uint32_t flags)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef YAX_ENABLE
|
int32_t editor_ask_function(const char *question, char *dachars, int32_t numchars)
|
||||||
static int32_t ask_above_or_below(void)
|
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
int32_t ret=-1;
|
int32_t i, ret=-1;
|
||||||
|
|
||||||
_printmessage16("Extend above (a) or below (z)?");
|
_printmessage16("%s", question);
|
||||||
|
|
||||||
showframe(1);
|
showframe(1);
|
||||||
bflushchars();
|
bflushchars();
|
||||||
|
|
||||||
|
// 'c' is cancel too, but can be overridden
|
||||||
while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1)
|
while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1)
|
||||||
{
|
{
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
|
@ -5762,16 +5766,22 @@ static int32_t ask_above_or_below(void)
|
||||||
idle();
|
idle();
|
||||||
ch = bgetchar();
|
ch = bgetchar();
|
||||||
|
|
||||||
if (ch == 'a' || ch == 'A')
|
for (i=0; i<numchars; i++)
|
||||||
ret = 0;
|
if (ch==Btolower(dachars[i]) || ch==Btoupper(dachars[i]))
|
||||||
else if (ch == 'z' || ch == 'Z')
|
ret = i;
|
||||||
ret = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clearkeys();
|
clearkeys();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
static int32_t ask_above_or_below(void)
|
||||||
|
{
|
||||||
|
char dachars[2] = {'a', 'z'};
|
||||||
|
return editor_ask_function("Extend above (a) or below (z)?", dachars, 2);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// flags: 1:no ExSaveMap (backup.map) and no taglabels saving
|
// flags: 1:no ExSaveMap (backup.map) and no taglabels saving
|
||||||
|
@ -6581,11 +6591,12 @@ int32_t getnumber_autocomplete(const char *namestart, char ch, int32_t *danum, i
|
||||||
// 1: sign
|
// 1: sign
|
||||||
// 2: autocomplete names
|
// 2: autocomplete names
|
||||||
// 4: autocomplete taglabels
|
// 4: autocomplete taglabels
|
||||||
|
// 8: return -1 if cancelled
|
||||||
int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t))
|
int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t))
|
||||||
{
|
{
|
||||||
char buffer[80], ch;
|
char buffer[80], ch;
|
||||||
int32_t n, danum, oldnum;
|
int32_t n, danum, oldnum;
|
||||||
uint8_t flags = (sign>>1)&3;
|
uint8_t flags = (sign>>1)&7;
|
||||||
sign &= 1;
|
sign &= 1;
|
||||||
|
|
||||||
danum = num;
|
danum = num;
|
||||||
|
@ -6627,6 +6638,9 @@ int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (keystatus[0x1] && (flags&4))
|
||||||
|
oldnum = -1;
|
||||||
|
|
||||||
clearkeys();
|
clearkeys();
|
||||||
|
|
||||||
return oldnum;
|
return oldnum;
|
||||||
|
|
|
@ -126,7 +126,7 @@ palette_t palookupfog[MAXPALOOKUPS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char permanentlock = 255;
|
static char permanentlock = 255;
|
||||||
int32_t artversion, mapversion=7L; // JBF 20040211: default mapversion to 7
|
int32_t artversion, mapversion=7; // JBF 20040211: default mapversion to 7
|
||||||
void *pic = NULL;
|
void *pic = NULL;
|
||||||
char picsiz[MAXTILES], tilefilenum[MAXTILES];
|
char picsiz[MAXTILES], tilefilenum[MAXTILES];
|
||||||
int32_t lastageclock;
|
int32_t lastageclock;
|
||||||
|
@ -181,6 +181,8 @@ static int16_t maphacklight[PR_MAXLIGHTS];
|
||||||
inline int32_t getscreenvdisp(int32_t bz, int32_t zoome);
|
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);
|
void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome);
|
||||||
|
|
||||||
|
static void scansector(int16_t sectnum);
|
||||||
|
|
||||||
int16_t editstatus = 0;
|
int16_t editstatus = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -190,6 +192,8 @@ int16_t editstatus = 0;
|
||||||
// all references to floor/ceiling bunchnums should be through the
|
// all references to floor/ceiling bunchnums should be through the
|
||||||
// get/set functions!
|
// get/set functions!
|
||||||
|
|
||||||
|
static int32_t scansector_retfast = 0;
|
||||||
|
|
||||||
// game-time YAX data structures
|
// game-time YAX data structures
|
||||||
static int16_t yax_bunchnum[MAXSECTORS][2];
|
static int16_t yax_bunchnum[MAXSECTORS][2];
|
||||||
static int16_t yax_nextwall[MAXWALLS][2];
|
static int16_t yax_nextwall[MAXWALLS][2];
|
||||||
|
@ -396,7 +400,7 @@ void yax_updategrays(int32_t posze)
|
||||||
if (cb<0 && fb<0)
|
if (cb<0 && fb<0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
k = ((cb<0 || sector[i].ceilingz < posze) && (fb<0 || posze < sector[i].floorz));
|
k = ((cb<0 || sector[i].ceilingz < posze) && (fb<0 || posze <= sector[i].floorz));
|
||||||
if (!k) // outside bounds, gray out!
|
if (!k) // outside bounds, gray out!
|
||||||
{
|
{
|
||||||
graysectbitmap[i>>3] |= (1<<(i&7));
|
graysectbitmap[i>>3] |= (1<<(i&7));
|
||||||
|
@ -452,7 +456,7 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
|
||||||
static uint8_t havebunch[2][YAX_MAXBUNCHES>>3];
|
static uint8_t havebunch[2][YAX_MAXBUNCHES>>3];
|
||||||
static int16_t bunches[2][YAX_MAXBUNCHES];
|
static int16_t bunches[2][YAX_MAXBUNCHES];
|
||||||
|
|
||||||
int32_t i, j, k, head, cf, diddraw = 0;
|
int32_t i, j, k, cf, diddraw = 0;
|
||||||
int32_t bnchcnt, bnchnum[2] = {0,0};
|
int32_t bnchcnt, bnchnum[2] = {0,0};
|
||||||
int16_t ourbunch[2] = {-1,-1};
|
int16_t ourbunch[2] = {-1,-1};
|
||||||
|
|
||||||
|
@ -503,11 +507,24 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
k = headsectbunch[!cf][j];
|
{
|
||||||
|
scansector_retfast = 1;
|
||||||
|
for (k = headsectbunch[!cf][j]; k != -1; k = nextsectbunch[!cf][k])
|
||||||
|
{
|
||||||
|
numscans = numbunches = 0;
|
||||||
|
scansector(k);
|
||||||
|
if (numbunches > 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
scansector_retfast = 0;
|
||||||
|
|
||||||
|
if (k < 0)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// tweak picnums vvv
|
// tweak picnums vvv
|
||||||
head = headsectbunch[cf][j];
|
for (i=headsectbunch[cf][j]; i!=-1; i=nextsectbunch[cf][i])
|
||||||
for (i=head; i!=-1; i=nextsectbunch[cf][i])
|
{
|
||||||
if ((SECTORFLD(i,stat, cf)&(128+256))==0)
|
if ((SECTORFLD(i,stat, cf)&(128+256))==0)
|
||||||
{
|
{
|
||||||
opicnum[i] = SECTORFLD(i,picnum, cf);
|
opicnum[i] = SECTORFLD(i,picnum, cf);
|
||||||
|
@ -516,11 +533,11 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
|
||||||
else
|
else
|
||||||
SECTORFLD(i,picnum, cf) = 13; //FOF;
|
SECTORFLD(i,picnum, cf) = 13; //FOF;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (allgotsector[k>>3]&(1<<(k&7)))
|
if (allgotsector[k>>3]&(1<<(k&7)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// TODO: make this better
|
|
||||||
drawrooms(globalposx,globalposy,globalposz,globalang,horiz,k+MAXSECTORS); // +MAXSECTORS: force
|
drawrooms(globalposx,globalposy,globalposz,globalang,horiz,k+MAXSECTORS); // +MAXSECTORS: force
|
||||||
ExtAnalyzeSprites();
|
ExtAnalyzeSprites();
|
||||||
drawmasks();
|
drawmasks();
|
||||||
|
@ -1769,7 +1786,13 @@ skipitaddwall:
|
||||||
|
|
||||||
for (z=numscansbefore; z<numscans; z++)
|
for (z=numscansbefore; z<numscans; z++)
|
||||||
if ((wall[thewall[z]].point2 != thewall[p2[z]]) || (xb2[z] >= xb1[p2[z]]))
|
if ((wall[thewall[z]].point2 != thewall[p2[z]]) || (xb2[z] >= xb1[p2[z]]))
|
||||||
|
{
|
||||||
bunchfirst[numbunches++] = p2[z], p2[z] = -1;
|
bunchfirst[numbunches++] = p2[z], p2[z] = -1;
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
if (scansector_retfast)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
for (z=bunchfrst; z<numbunches; z++)
|
for (z=bunchfrst; z<numbunches; z++)
|
||||||
{
|
{
|
||||||
|
@ -5255,6 +5278,11 @@ static void fillpolygon(int32_t npoints)
|
||||||
int16_t *ptr, *ptr2;
|
int16_t *ptr, *ptr2;
|
||||||
intptr_t p;
|
intptr_t p;
|
||||||
|
|
||||||
|
// fix for bad next-point (xb1) values...
|
||||||
|
for (z=0; z<npoints; z++)
|
||||||
|
if ((unsigned)xb1[z] >= (unsigned)npoints)
|
||||||
|
xb1[z] = 0;
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (rendmode >= 3 && qsetmode == 200) { polymost_fillpolygon(npoints); return; }
|
if (rendmode >= 3 && qsetmode == 200) { polymost_fillpolygon(npoints); return; }
|
||||||
#endif
|
#endif
|
||||||
|
@ -5275,8 +5303,8 @@ static void fillpolygon(int32_t npoints)
|
||||||
for (z=npoints-1; z>=0; z--)
|
for (z=npoints-1; z>=0; z--)
|
||||||
{
|
{
|
||||||
zz = xb1[z];
|
zz = xb1[z];
|
||||||
y1 = ry1[z]; day1 = (y1>>12);
|
y1 = ry1[z]; day1 = clamp(y1>>12, 0, ydim-1); // clamp: crash prevention...
|
||||||
y2 = ry1[zz]; day2 = (y2>>12);
|
y2 = ry1[zz]; day2 = clamp(y2>>12, 0, ydim-1);
|
||||||
if (day1 != day2)
|
if (day1 != day2)
|
||||||
{
|
{
|
||||||
x1 = rx1[z]; x2 = rx1[zz];
|
x1 = rx1[z]; x2 = rx1[zz];
|
||||||
|
@ -7004,7 +7032,7 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
|
||||||
// *can* be negative, so let's just quit here in that case...
|
// *can* be negative, so let's just quit here in that case...
|
||||||
if (globalcursectnum<0)
|
if (globalcursectnum<0)
|
||||||
{
|
{
|
||||||
enddrawing();
|
enddrawing(); //!!!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7023,7 +7051,10 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
|
||||||
// to draw it, but scansector gets zero bunches. Result: big screwup!
|
// to draw it, but scansector gets zero bunches. Result: big screwup!
|
||||||
// Leave inpreparesector as is, it's restored by completemirror.
|
// Leave inpreparesector as is, it's restored by completemirror.
|
||||||
if (numbunches==0)
|
if (numbunches==0)
|
||||||
|
{
|
||||||
|
enddrawing(); //!!!
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
inpreparemirror = 0;
|
inpreparemirror = 0;
|
||||||
|
|
||||||
|
@ -7745,10 +7776,13 @@ int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy,
|
||||||
i = Bstrlen(filename)-1;
|
i = Bstrlen(filename)-1;
|
||||||
if (filename[i] == 255) { filename[i] = 0; flags = 1; } // JBF 20040119: "compatibility"
|
if (filename[i] == 255) { filename[i] = 0; flags = 1; } // JBF 20040119: "compatibility"
|
||||||
if ((fil = kopen4load(filename,flags)) == -1)
|
if ((fil = kopen4load(filename,flags)) == -1)
|
||||||
{ mapversion = 7L; return(-1); }
|
{ mapversion = 7; return(-1); }
|
||||||
|
|
||||||
kread(fil,&mapversion,4); mapversion = B_LITTLE32(mapversion);
|
kread(fil,&mapversion,4); mapversion = B_LITTLE32(mapversion);
|
||||||
if (mapversion != 7L && mapversion != 8L) { kclose(fil); return(-2); }
|
#ifdef YAX_ENABLE
|
||||||
|
if (mapversion != 9)
|
||||||
|
#endif
|
||||||
|
if (mapversion != 7 && mapversion != 8) { kclose(fil); return(-2); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Enable this for doing map checksum tests
|
// Enable this for doing map checksum tests
|
||||||
|
@ -7763,13 +7797,13 @@ int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy,
|
||||||
|
|
||||||
initspritelists();
|
initspritelists();
|
||||||
|
|
||||||
#define MYMAXSECTORS (mapversion==7l?MAXSECTORSV7:MAXSECTORSV8)
|
#define MYMAXSECTORS (mapversion==7?MAXSECTORSV7:MAXSECTORSV8)
|
||||||
#define MYMAXWALLS (mapversion==7l?MAXWALLSV7:MAXWALLSV8)
|
#define MYMAXWALLS (mapversion==7?MAXWALLSV7:MAXWALLSV8)
|
||||||
#define MYMAXSPRITES (mapversion==7l?MAXSPRITESV7:MAXSPRITESV8)
|
#define MYMAXSPRITES (mapversion==7?MAXSPRITESV7:MAXSPRITESV8)
|
||||||
|
|
||||||
clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L);
|
Bmemset(show2dsector, 0, sizeof(show2dsector));
|
||||||
clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L);
|
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
|
||||||
clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L);
|
Bmemset(show2dwall, 0, sizeof(show2dwall));
|
||||||
|
|
||||||
kread(fil,daposx,4); *daposx = B_LITTLE32(*daposx);
|
kread(fil,daposx,4); *daposx = B_LITTLE32(*daposx);
|
||||||
kread(fil,daposy,4); *daposy = B_LITTLE32(*daposy);
|
kread(fil,daposy,4); *daposy = B_LITTLE32(*daposy);
|
||||||
|
@ -7850,7 +7884,7 @@ int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
yax_update(0);
|
yax_update(mapversion<9);
|
||||||
if (editstatus)
|
if (editstatus)
|
||||||
yax_updategrays(*daposz);
|
yax_updategrays(*daposz);
|
||||||
#endif
|
#endif
|
||||||
|
@ -8715,7 +8749,8 @@ int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j=0; j<MAXSPRITES; j++)if ((unsigned)sprite[j].statnum>MAXSTATUS)
|
for (j=0; j<MAXSPRITES; j++)
|
||||||
|
if ((unsigned)sprite[j].statnum>MAXSTATUS)
|
||||||
{
|
{
|
||||||
initprintf("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n",j,sprite[j].x,sprite[j].y,sprite[j].statnum);
|
initprintf("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n",j,sprite[j].x,sprite[j].y,sprite[j].statnum);
|
||||||
changespritestat(j,0);
|
changespritestat(j,0);
|
||||||
|
@ -8740,6 +8775,11 @@ int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
if (numyaxbunches > 0)
|
||||||
|
mapversion = 9;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
if (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 || numsprites > MAXSPRITESV7)
|
if (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 || numsprites > MAXSPRITESV7)
|
||||||
mapversion = 8;
|
mapversion = 8;
|
||||||
else
|
else
|
||||||
|
@ -11600,6 +11640,7 @@ restart_grand:
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
if (numyaxbunches > 0)
|
if (numyaxbunches > 0)
|
||||||
{
|
{
|
||||||
|
int32_t dasecclipmask = (dawalclipmask&1)<<9; // blocking: walstat&1 --> secstat&512
|
||||||
int16_t cb, fb, didchange;
|
int16_t cb, fb, didchange;
|
||||||
yax_getbunches(sectnum, &cb, &fb);
|
yax_getbunches(sectnum, &cb, &fb);
|
||||||
|
|
||||||
|
@ -11615,9 +11656,20 @@ restart_grand:
|
||||||
didchange = 0;
|
didchange = 0;
|
||||||
if (cb>=0 && mcf==0 && *ceilhit==sectnum+16384)
|
if (cb>=0 && mcf==0 && *ceilhit==sectnum+16384)
|
||||||
{
|
{
|
||||||
|
for (i=0; i<origclipsectnum; i++)
|
||||||
|
{
|
||||||
|
j = origclipsectorlist[i];
|
||||||
|
if (yax_getbunch(j, YAX_CEILING) >= 0)
|
||||||
|
if (sector[j].ceilingstat&dasecclipmask)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i==origclipsectnum)
|
||||||
for (i=0; i<origclipsectnum; i++)
|
for (i=0; i<origclipsectnum; i++)
|
||||||
{
|
{
|
||||||
cb = yax_getbunch(origclipsectorlist[i], YAX_CEILING);
|
cb = yax_getbunch(origclipsectorlist[i], YAX_CEILING);
|
||||||
|
if (cb < 0)
|
||||||
|
continue;
|
||||||
for (j=headsectbunch[YAX_FLOOR][cb]; j!=-1; j=nextsectbunch[YAX_FLOOR][j])
|
for (j=headsectbunch[YAX_FLOOR][cb]; j!=-1; j=nextsectbunch[YAX_FLOOR][j])
|
||||||
if (inside(pos->x,pos->y, j)==1)
|
if (inside(pos->x,pos->y, j)==1)
|
||||||
{
|
{
|
||||||
|
@ -11637,10 +11689,21 @@ restart_grand:
|
||||||
didchange = 0;
|
didchange = 0;
|
||||||
if (fb>=0 && mcf==1 && *florhit==sectnum+16384)
|
if (fb>=0 && mcf==1 && *florhit==sectnum+16384)
|
||||||
{
|
{
|
||||||
|
for (i=0; i<origclipsectnum; i++)
|
||||||
|
{
|
||||||
|
j = origclipsectorlist[i];
|
||||||
|
if (yax_getbunch(j, YAX_FLOOR) >= 0)
|
||||||
|
if (sector[j].floorstat&dasecclipmask)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// (almost) same as above, but with floors...
|
// (almost) same as above, but with floors...
|
||||||
|
if (i==origclipsectnum)
|
||||||
for (i=0; i<origclipsectnum; i++)
|
for (i=0; i<origclipsectnum; i++)
|
||||||
{
|
{
|
||||||
fb = yax_getbunch(origclipsectorlist[i], YAX_FLOOR);
|
fb = yax_getbunch(origclipsectorlist[i], YAX_FLOOR);
|
||||||
|
if (fb < 0)
|
||||||
|
continue;
|
||||||
for (j=headsectbunch[YAX_CEILING][fb]; j!=-1; j=nextsectbunch[YAX_CEILING][j])
|
for (j=headsectbunch[YAX_CEILING][fb]; j!=-1; j=nextsectbunch[YAX_CEILING][j])
|
||||||
if (inside(pos->x,pos->y, j)==1)
|
if (inside(pos->x,pos->y, j)==1)
|
||||||
{
|
{
|
||||||
|
@ -13726,6 +13789,9 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
|
||||||
for (j=0; j<MAXSPRITES; j++)
|
for (j=0; j<MAXSPRITES; j++)
|
||||||
if (sprite[j].statnum<MAXSTATUS && (editstatus == 1 || (show2dsprite[j>>3]&pow2char[j&7])))
|
if (sprite[j].statnum<MAXSTATUS && (editstatus == 1 || (show2dsprite[j>>3]&pow2char[j&7])))
|
||||||
{
|
{
|
||||||
|
if (!m32_sideview && sprite[j].sectnum >= 0)
|
||||||
|
YAX_SKIPSECTOR(sprite[j].sectnum);
|
||||||
|
|
||||||
if (!m32_sideview)
|
if (!m32_sideview)
|
||||||
drawscreen_drawsprite(j,posxe,posye,posze,zoome);
|
drawscreen_drawsprite(j,posxe,posye,posze,zoome);
|
||||||
else
|
else
|
||||||
|
|
|
@ -593,6 +593,7 @@ int32_t map_undoredo(int32_t dir)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define M32_NUM_SPRITE_MODES ((signed)(sizeof(SpriteMode)/sizeof(SpriteMode[0])))
|
||||||
static const char *SpriteMode[]=
|
static const char *SpriteMode[]=
|
||||||
{
|
{
|
||||||
"NONE",
|
"NONE",
|
||||||
|
@ -625,7 +626,7 @@ static const char *SPRDSPMODE[MAXNOSPRITES]=
|
||||||
"Sprite display: NO EFFECTORS OR ACTORS"
|
"Sprite display: NO EFFECTORS OR ACTORS"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAXHELP3D (int32_t)(sizeof(Help3d)/sizeof(Help3d[0]))
|
#define MAXHELP3D ((signed)(sizeof(Help3d)/sizeof(Help3d[0])))
|
||||||
static const char *Help3d[]=
|
static const char *Help3d[]=
|
||||||
{
|
{
|
||||||
"Mapster32 3D mode help",
|
"Mapster32 3D mode help",
|
||||||
|
@ -2052,7 +2053,7 @@ static void IntegratedHelp(void)
|
||||||
for (j = (i==curhp)?(curline+1):0; j<helppage[i]->numlines; j++)
|
for (j = (i==curhp)?(curline+1):0; j<helppage[i]->numlines; j++)
|
||||||
{
|
{
|
||||||
// entering an empty pattern will search with the last used pattern
|
// entering an empty pattern will search with the last used pattern
|
||||||
if (strstr(helppage[i]->line[j], pattern[0]?pattern:oldpattern))
|
if (Bstrstr(helppage[i]->line[j], pattern[0]?pattern:oldpattern))
|
||||||
{
|
{
|
||||||
curhp = i;
|
curhp = i;
|
||||||
|
|
||||||
|
@ -3563,7 +3564,7 @@ static int32_t m32gettile(int32_t idInitialTile)
|
||||||
Bstrupr(buf[1]);
|
Bstrupr(buf[1]);
|
||||||
|
|
||||||
if ((searchstr[0]=='^' && !Bstrncmp(buf[1], buf[0]+1, slen)) ||
|
if ((searchstr[0]=='^' && !Bstrncmp(buf[1], buf[0]+1, slen)) ||
|
||||||
(searchstr[0]!='^' && strstr(buf[1], buf[0])))
|
(searchstr[0]!='^' && Bstrstr(buf[1], buf[0])))
|
||||||
{
|
{
|
||||||
SelectAllTiles(i);
|
SelectAllTiles(i);
|
||||||
iTile = i;
|
iTile = i;
|
||||||
|
@ -5032,7 +5033,7 @@ static void Keys3d(void)
|
||||||
|
|
||||||
visval = getnumber256("Visibility of selected sectors: ", sector[searchsector].visibility, 255, 0);
|
visval = getnumber256("Visibility of selected sectors: ", sector[searchsector].visibility, 255, 0);
|
||||||
|
|
||||||
if (AskIfSure(0))
|
if (AskIfSure("Are you sure to change the visibility of all selected sectors?"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i=0; i<highlightsectorcnt; i++)
|
for (i=0; i<highlightsectorcnt; i++)
|
||||||
|
@ -5488,64 +5489,49 @@ static void Keys3d(void)
|
||||||
{
|
{
|
||||||
k=eitherSHIFT?1:16;
|
k=eitherSHIFT?1:16;
|
||||||
|
|
||||||
if (highlightsectorcnt >= 0)
|
if (highlightsectorcnt > 0 && (hlsectorbitmap[searchsector>>3]&(1<<(searchsector&7))))
|
||||||
for (i=0; i<highlightsectorcnt; i++)
|
|
||||||
if (highlightsector[i] == searchsector)
|
|
||||||
{
|
{
|
||||||
while (k > 0)
|
while (k-- > 0)
|
||||||
{
|
{
|
||||||
for (i=0; i<highlightsectorcnt; i++)
|
for (i=0; i<highlightsectorcnt; i++)
|
||||||
{
|
{
|
||||||
sector[highlightsector[i]].visibility += tsign;
|
j = highlightsector[i];
|
||||||
|
sector[j].visibility += tsign;
|
||||||
|
|
||||||
if (tsign==1)
|
if (tsign==1 && sector[j].visibility == 240)
|
||||||
|
sector[j].visibility = 239;
|
||||||
|
else if (tsign==-1 && sector[j].visibility == 239)
|
||||||
|
sector[j].visibility = 240;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (sector[highlightsector[i]].visibility == 240)
|
while (k-- > 0)
|
||||||
sector[highlightsector[i]].visibility = 239;
|
|
||||||
}
|
|
||||||
else if (sector[highlightsector[i]].visibility == 239)
|
|
||||||
sector[highlightsector[i]].visibility = 240;
|
|
||||||
}
|
|
||||||
k--;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (k > 0)
|
|
||||||
{
|
{
|
||||||
sector[searchsector].visibility += tsign;
|
sector[searchsector].visibility += tsign;
|
||||||
|
|
||||||
if (tsign==1)
|
if (tsign==1 && sector[searchsector].visibility == 240)
|
||||||
{
|
|
||||||
if (sector[searchsector].visibility == 240)
|
|
||||||
sector[searchsector].visibility = 239;
|
sector[searchsector].visibility = 239;
|
||||||
}
|
else if (tsign==-1 && sector[searchsector].visibility == 239)
|
||||||
else if (sector[searchsector].visibility == 239)
|
|
||||||
sector[searchsector].visibility = 240;
|
sector[searchsector].visibility = 240;
|
||||||
k--;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
message("Sector %d visibility %d",searchsector,sector[searchsector].visibility);
|
message("Sector %d visibility %d",searchsector,sector[searchsector].visibility);
|
||||||
asksave = 1;
|
asksave = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // if !eitherALT
|
else // if !eitherALT
|
||||||
{
|
{
|
||||||
k = 0;
|
k = (highlightsectorcnt>0 && (hlsectorbitmap[searchsector>>3]&(1<<(searchsector&7))));
|
||||||
if (highlightsectorcnt >= 0)
|
tsign *= (1+3*eitherCTRL);
|
||||||
{
|
|
||||||
for (i=0; i<highlightsectorcnt; i++)
|
|
||||||
if (highlightsector[i] == searchsector)
|
|
||||||
{
|
|
||||||
k = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (k == 0)
|
if (k == 0)
|
||||||
{
|
{
|
||||||
if (ASSERT_AIMING)
|
if (ASSERT_AIMING)
|
||||||
{
|
{
|
||||||
AIMED_CF_SEL(shade) += tsign*(1+3*eitherCTRL);
|
AIMED_CF_SEL(shade) += tsign;
|
||||||
message("%s %d shade %d", Typestr[searchstat], i, AIMED_CF_SEL(shade));
|
message("%s %d shade %d", Typestr[searchstat], i, AIMED_CF_SEL(shade));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5555,22 +5541,19 @@ static void Keys3d(void)
|
||||||
{
|
{
|
||||||
dasector = highlightsector[i];
|
dasector = highlightsector[i];
|
||||||
|
|
||||||
sector[dasector].ceilingshade += tsign; //sector shade
|
// sector shade
|
||||||
|
sector[dasector].ceilingshade += tsign;
|
||||||
sector[dasector].floorshade += tsign;
|
sector[dasector].floorshade += tsign;
|
||||||
|
|
||||||
startwall = sector[dasector].wallptr; //wall shade
|
// wall shade
|
||||||
endwall = startwall + sector[dasector].wallnum - 1;
|
for (WALLS_OF_SECTOR(dasector, j))
|
||||||
|
|
||||||
for (j=startwall; j<=endwall; j++)
|
|
||||||
wall[j].shade += tsign;
|
wall[j].shade += tsign;
|
||||||
|
|
||||||
j = headspritesect[dasector]; //sprite shade
|
// sprite shade
|
||||||
while (j != -1)
|
for (j=headspritesect[dasector]; j!=-1; j=nextspritesect[j])
|
||||||
{
|
|
||||||
sprite[j].shade += tsign;
|
sprite[j].shade += tsign;
|
||||||
j = nextspritesect[j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
message("Highlighted sector shade changed by %d", tsign);
|
||||||
}
|
}
|
||||||
asksave = 1;
|
asksave = 1;
|
||||||
}
|
}
|
||||||
|
@ -5586,7 +5569,7 @@ static void Keys3d(void)
|
||||||
|
|
||||||
while (!tilesizx[AIMED_SELOVR_PICNUM] || !tilesizy[AIMED_SELOVR_PICNUM] || j)
|
while (!tilesizx[AIMED_SELOVR_PICNUM] || !tilesizy[AIMED_SELOVR_PICNUM] || j)
|
||||||
{
|
{
|
||||||
AIMED_SELOVR_PICNUM += i;
|
AIMED_SELOVR_PICNUM += i+MAXTILES;
|
||||||
AIMED_SELOVR_PICNUM %= MAXTILES;
|
AIMED_SELOVR_PICNUM %= MAXTILES;
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
|
@ -6274,7 +6257,18 @@ static void Keys3d(void)
|
||||||
message("Sprite %d blocking bit %s", searchwall, ONOFF(sprite[searchwall].cstat&1));
|
message("Sprite %d blocking bit %s", searchwall, ONOFF(sprite[searchwall].cstat&1));
|
||||||
asksave = 1;
|
asksave = 1;
|
||||||
}
|
}
|
||||||
else if (ASSERT_AIMING)
|
else if (AIMING_AT_WALL_OR_MASK || AIMING_AT_CEILING_OR_FLOOR)
|
||||||
|
{
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
if (AIMING_AT_CEILING_OR_FLOOR && yax_getbunch(searchsector, AIMING_AT_FLOOR)>=0)
|
||||||
|
{
|
||||||
|
SECTORFLD(searchsector,stat, AIMING_AT_FLOOR) ^= 512;
|
||||||
|
message("Sector %d's %s blocking bit %s", searchsector, typestr[searchstat],
|
||||||
|
ONOFF(SECTORFLD(searchsector,stat, AIMING_AT_FLOOR)&512));
|
||||||
|
asksave = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
wall[searchwall].cstat ^= 1;
|
wall[searchwall].cstat ^= 1;
|
||||||
// wall[searchwall].cstat &= ~64;
|
// wall[searchwall].cstat &= ~64;
|
||||||
|
@ -6288,6 +6282,7 @@ static void Keys3d(void)
|
||||||
asksave = 1;
|
asksave = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// N (set "spritenoshade" bit)
|
// N (set "spritenoshade" bit)
|
||||||
if (PRESSED_KEYSC(N) && !eitherCTRL && !keystatus[KEYSC_QUOTE])
|
if (PRESSED_KEYSC(N) && !eitherCTRL && !keystatus[KEYSC_QUOTE])
|
||||||
|
@ -6606,7 +6601,8 @@ static void Keys3d(void)
|
||||||
{
|
{
|
||||||
while (updownunits--)
|
while (updownunits--)
|
||||||
wall[searchwall].xrepeat = changechar(wall[searchwall].xrepeat, changedir, smooshyalign, 1);
|
wall[searchwall].xrepeat = changechar(wall[searchwall].xrepeat, changedir, smooshyalign, 1);
|
||||||
silentmessage("Wall %d repeat: %d, %d", searchwall, wall[searchwall].xrepeat, wall[searchwall].yrepeat);
|
silentmessage("Wall %d repeat: %d, %d", searchwall,
|
||||||
|
wall[searchwall].xrepeat, wall[searchwall].yrepeat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6658,7 +6654,8 @@ static void Keys3d(void)
|
||||||
sprite[searchwall].xrepeat = changechar(sprite[searchwall].xrepeat, changedir, smooshyalign, 1);
|
sprite[searchwall].xrepeat = changechar(sprite[searchwall].xrepeat, changedir, smooshyalign, 1);
|
||||||
if (sprite[searchwall].xrepeat < 4)
|
if (sprite[searchwall].xrepeat < 4)
|
||||||
sprite[searchwall].xrepeat = 4;
|
sprite[searchwall].xrepeat = 4;
|
||||||
silentmessage("Sprite %d repeat: %d, %d", searchwall, sprite[searchwall].xrepeat, sprite[searchwall].yrepeat);
|
silentmessage("Sprite %d repeat: %d, %d", searchwall,
|
||||||
|
sprite[searchwall].xrepeat, sprite[searchwall].yrepeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
asksave = 1;
|
asksave = 1;
|
||||||
|
@ -6725,7 +6722,8 @@ static void Keys3d(void)
|
||||||
{
|
{
|
||||||
while (updownunits--)
|
while (updownunits--)
|
||||||
wall[searchwall].yrepeat = changechar(wall[searchwall].yrepeat, changedir, smooshyalign, 1);
|
wall[searchwall].yrepeat = changechar(wall[searchwall].yrepeat, changedir, smooshyalign, 1);
|
||||||
silentmessage("Wall %d repeat: %d, %d", searchwall, wall[searchwall].xrepeat, wall[searchwall].yrepeat);
|
silentmessage("Wall %d repeat: %d, %d", searchwall,
|
||||||
|
wall[searchwall].xrepeat, wall[searchwall].yrepeat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6763,7 +6761,8 @@ static void Keys3d(void)
|
||||||
sprite[searchwall].yrepeat = changechar(sprite[searchwall].yrepeat, changedir, smooshyalign, 1);
|
sprite[searchwall].yrepeat = changechar(sprite[searchwall].yrepeat, changedir, smooshyalign, 1);
|
||||||
if (sprite[searchwall].yrepeat < 4)
|
if (sprite[searchwall].yrepeat < 4)
|
||||||
sprite[searchwall].yrepeat = 4;
|
sprite[searchwall].yrepeat = 4;
|
||||||
silentmessage("Sprite %d repeat: %d, %d", searchwall, sprite[searchwall].xrepeat, sprite[searchwall].yrepeat);
|
silentmessage("Sprite %d repeat: %d, %d", searchwall,
|
||||||
|
sprite[searchwall].xrepeat, sprite[searchwall].yrepeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
asksave = 1;
|
asksave = 1;
|
||||||
|
@ -7275,7 +7274,7 @@ paste_ceiling_or_floor:
|
||||||
if (PRESSED_KEYSC(D)) //Alt-D (adjust sprite[].clipdist)
|
if (PRESSED_KEYSC(D)) //Alt-D (adjust sprite[].clipdist)
|
||||||
{
|
{
|
||||||
if (eitherALT && AIMING_AT_SPRITE)
|
if (eitherALT && AIMING_AT_SPRITE)
|
||||||
sprite[searchwall].clipdist = getnumber256("Sprite clipdist: ", sprite[searchwall].clipdist, 256L, 0);
|
sprite[searchwall].clipdist = getnumber256("Sprite clipdist: ", sprite[searchwall].clipdist, 255, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_OnEvent(EVENT_KEYS3D, -1);
|
VM_OnEvent(EVENT_KEYS3D, -1);
|
||||||
|
@ -7488,12 +7487,55 @@ static void Keys2d(void)
|
||||||
|
|
||||||
///__bigcomment__
|
///__bigcomment__
|
||||||
|
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
if (!m32_sideview && numyaxbunches>0)
|
||||||
|
{
|
||||||
|
int32_t zsign=0, bestzdiff=INT32_MAX, hiz=0, loz=0, bottomp=0;
|
||||||
|
|
||||||
|
if (PRESSED_KEYSC(PGDN) || (eitherCTRL && PRESSED_KEYSC(DOWN)))
|
||||||
|
zsign = 1;
|
||||||
|
else if (PRESSED_KEYSC(PGUP) || (eitherCTRL && PRESSED_KEYSC(UP)))
|
||||||
|
zsign = -1;
|
||||||
|
|
||||||
|
if (zsign)
|
||||||
|
{
|
||||||
|
for (i=0; i<numsectors; i++)
|
||||||
|
{
|
||||||
|
if (yax_getbunch(i, YAX_FLOOR) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
loz = min(loz, sector[i].floorz);
|
||||||
|
hiz = max(hiz, sector[i].floorz);
|
||||||
|
|
||||||
|
// TODO: see if at least one sector point inside sceeen
|
||||||
|
j = (sector[i].floorz-pos.z)*zsign;
|
||||||
|
if (j>0 && j < bestzdiff)
|
||||||
|
bestzdiff = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zsign==1 && bestzdiff==INT_MAX)
|
||||||
|
bottomp=1, bestzdiff = (hiz+1024 - pos.z);
|
||||||
|
|
||||||
|
if (bestzdiff != INT32_MAX)
|
||||||
|
{
|
||||||
|
pos.z += zsign*bestzdiff;
|
||||||
|
yax_updategrays(pos.z);
|
||||||
|
|
||||||
|
printmessage16("Z position: %d%s", pos.z,
|
||||||
|
bottomp ? " (bottom)":(pos.z==loz ? " (top)":""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(Z)) // ' z
|
if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(Z)) // ' z
|
||||||
{
|
{
|
||||||
editorzrange[0] = getnumber16("Upper Z range: ", editorzrange[0], INT32_MAX, 1);
|
editorzrange[0] = getnumber16("Upper Z range: ", editorzrange[0], INT32_MAX, 1);
|
||||||
editorzrange[1] = getnumber16("Lower Z range: ", editorzrange[1], INT32_MAX, 1);
|
editorzrange[1] = getnumber16("Lower Z range: ", editorzrange[1], INT32_MAX, 1);
|
||||||
// printmessage16("");
|
// printmessage16("");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (PRESSED_KEYSC(T)) // T (tag)
|
if (PRESSED_KEYSC(T)) // T (tag)
|
||||||
{
|
{
|
||||||
|
@ -7542,10 +7584,10 @@ static void Keys2d(void)
|
||||||
if (inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc,i) == 1)
|
if (inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc,i) == 1)
|
||||||
{
|
{
|
||||||
Bsprintf(buffer,"Sector (%d) Lo-tag: ",i);
|
Bsprintf(buffer,"Sector (%d) Lo-tag: ",i);
|
||||||
j = qsetmode;
|
// j = qsetmode;
|
||||||
qsetmode = 200;
|
// qsetmode = 200;
|
||||||
sector[i].lotag = _getnumber16(buffer, sector[i].lotag, BTAG_MAX, 0, (void *)ExtGetSectorType);
|
sector[i].lotag = _getnumber16(buffer, sector[i].lotag, BTAG_MAX, 0, (void *)ExtGetSectorType);
|
||||||
qsetmode = j;
|
// qsetmode = j;
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7684,7 +7726,8 @@ static void Keys2d(void)
|
||||||
{
|
{
|
||||||
uint8_t *repeat = (k==0) ? &sprite[cursprite].xrepeat : &sprite[cursprite].yrepeat;
|
uint8_t *repeat = (k==0) ? &sprite[cursprite].xrepeat : &sprite[cursprite].yrepeat;
|
||||||
*repeat = max(4, changechar(*repeat, changedir, smooshy, 1));
|
*repeat = max(4, changechar(*repeat, changedir, smooshy, 1));
|
||||||
silentmessage("Sprite %d repeat: %d, %d", cursprite, sprite[cursprite].xrepeat, sprite[cursprite].yrepeat);
|
silentmessage("Sprite %d repeat: %d, %d", cursprite,
|
||||||
|
sprite[cursprite].xrepeat, sprite[cursprite].yrepeat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7696,7 +7739,8 @@ static void Keys2d(void)
|
||||||
{
|
{
|
||||||
uint8_t *panning = (k==0) ? §or[i].floorxpanning : §or[i].floorypanning;
|
uint8_t *panning = (k==0) ? §or[i].floorxpanning : §or[i].floorypanning;
|
||||||
*panning = changechar(*panning, changedir, smooshy, 0);
|
*panning = changechar(*panning, changedir, smooshy, 0);
|
||||||
silentmessage("Sector %d floor panning: %d, %d", searchsector, sector[i].floorxpanning, sector[i].floorypanning);
|
silentmessage("Sector %d floor panning: %d, %d", searchsector,
|
||||||
|
sector[i].floorxpanning, sector[i].floorypanning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7920,10 +7964,8 @@ static void Keys2d(void)
|
||||||
|
|
||||||
if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(3)) // ' 3
|
if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(3)) // ' 3
|
||||||
{
|
{
|
||||||
onnames = (onnames+1)%8;
|
onnames = (onnames+1)%M32_NUM_SPRITE_MODES;
|
||||||
printmessage16("Mode %d %s", onnames, SpriteMode[onnames]);
|
printmessage16("Mode %d %s", onnames, SpriteMode[onnames]);
|
||||||
// clearmidstatbar16();
|
|
||||||
// for(i=0;i<MAXMODE32D;i++) {printext16(0*8,ydim16+32+(i*8),15,-1,SpriteMode[i],0);
|
|
||||||
}
|
}
|
||||||
// Ver();
|
// Ver();
|
||||||
|
|
||||||
|
@ -7953,22 +7995,59 @@ static void Keys2d(void)
|
||||||
|
|
||||||
if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(J)) // ' J
|
if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(J)) // ' J
|
||||||
{
|
{
|
||||||
|
char dachars[4] = {'s', 'w', 'i', 'c'};
|
||||||
|
|
||||||
|
fade_editor_screen(-1);
|
||||||
|
i = editor_ask_function("Jump to (s)ector, (w)all, spr(i)te, or (c)oordinates?", dachars, 4);
|
||||||
|
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
if (numsectors > 0)
|
||||||
|
{
|
||||||
|
j = getnumber16("Sector: ", 0, numsectors-1, 0+8);
|
||||||
|
if (j < 0)
|
||||||
|
break;
|
||||||
|
pos.x = wall[sector[j].wallptr].x;
|
||||||
|
pos.y = wall[sector[j].wallptr].y;
|
||||||
|
printmessage16("Current pos now on sector %d's first wall-point", j);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (numwalls > 0)
|
||||||
|
{
|
||||||
|
j = getnumber16("Wall: ", 0, numwalls-1, 0+8);
|
||||||
|
if (j < 0)
|
||||||
|
break;
|
||||||
|
pos.x = wall[j].x;
|
||||||
|
pos.y = wall[j].y;
|
||||||
|
printmessage16("Current pos now on wall %d's point", j);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
j = getnumber16("Sprite: ", 0, MAXSPRITES-1, 0+8);
|
||||||
|
if (j < 0 || sprite[j].statnum==MAXSTATUS)
|
||||||
|
break;
|
||||||
|
pos.x = sprite[j].x;
|
||||||
|
pos.y = sprite[j].y;
|
||||||
|
printmessage16("Current pos now on sprite %d", j);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
pos.x = getnumber16("X-coordinate: ", pos.x, editorgridextent, 1);
|
pos.x = getnumber16("X-coordinate: ", pos.x, editorgridextent, 1);
|
||||||
pos.y = getnumber16("Y-coordinate: ", pos.y, editorgridextent, 1);
|
pos.y = getnumber16("Y-coordinate: ", pos.y, editorgridextent, 1);
|
||||||
printmessage16("Current pos now (%d, %d)", pos.x, pos.y);
|
printmessage16("Current pos now (%d, %d)", pos.x, pos.y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}// end key2d
|
}// end key2d
|
||||||
|
|
||||||
static void InitCustomColors(void)
|
static void InitCustomColors(void)
|
||||||
{
|
{
|
||||||
/* blue */
|
|
||||||
/* vgapal16[9*4+0] = 63;
|
|
||||||
vgapal16[9*4+1] = 31;
|
|
||||||
vgapal16[9*4+2] = 7; */
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
palette_t *edcol;
|
palette_t *edcol;
|
||||||
/*
|
|
||||||
|
|
||||||
|
/*
|
||||||
char vgapal16[4*256] =
|
char vgapal16[4*256] =
|
||||||
{
|
{
|
||||||
00,00,00,00, 42,00,00,00, 00,42,00,00, 42,42,00,00, 00,00,42,00,
|
00,00,00,00, 42,00,00,00, 00,42,00,00, 42,42,00,00, 00,00,42,00,
|
||||||
|
@ -7985,6 +8064,7 @@ static void InitCustomColors(void)
|
||||||
editorcolors[5] = getclosestcol(0,0,0);
|
editorcolors[5] = getclosestcol(0,0,0);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* blue */
|
||||||
vgapal16[9*4+0] = 63;
|
vgapal16[9*4+0] = 63;
|
||||||
vgapal16[9*4+1] = 31;
|
vgapal16[9*4+1] = 31;
|
||||||
vgapal16[9*4+2] = 7;
|
vgapal16[9*4+2] = 7;
|
||||||
|
@ -10007,7 +10087,7 @@ void app_crashhandler(void)
|
||||||
{
|
{
|
||||||
if (levelname[0])
|
if (levelname[0])
|
||||||
{
|
{
|
||||||
char *f = strstr(levelname,".map");
|
char *f = Bstrstr(levelname,".map");
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
Bstrcpy(f,"_crash.map");
|
Bstrcpy(f,"_crash.map");
|
||||||
|
|
|
@ -3212,6 +3212,14 @@ void G_SE40(int32_t smoothratio)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
static int32_t g_yax_smoothratio;
|
||||||
|
static void G_AnalyzeSprites(void)
|
||||||
|
{
|
||||||
|
G_DoSpriteAnimations(ud.camera.x,ud.camera.y,ud.cameraang,g_yax_smoothratio);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
||||||
{
|
{
|
||||||
int32_t dst,j,fz,cz;
|
int32_t dst,j,fz,cz;
|
||||||
|
@ -3463,7 +3471,10 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
drawrooms(ud.camera.x,ud.camera.y,ud.camera.z,ud.cameraang,ud.camerahoriz,ud.camerasect);
|
drawrooms(ud.camera.x,ud.camera.y,ud.camera.z,ud.cameraang,ud.camerahoriz,ud.camerasect);
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
g_yax_smoothratio = smoothratio;
|
||||||
|
yax_drawrooms(G_AnalyzeSprites, ud.camerahoriz, ud.camerasect);
|
||||||
|
#endif
|
||||||
// dupe the sprites touching the portal to the other sector
|
// dupe the sprites touching the portal to the other sector
|
||||||
|
|
||||||
if (ror_sprite != -1)
|
if (ror_sprite != -1)
|
||||||
|
|
|
@ -4472,6 +4472,44 @@ int32_t P_DoFist(DukePlayer_t *p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
static void getzsofslope_player(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
|
||||||
|
{
|
||||||
|
int32_t i, didceil=0, didflor=0;
|
||||||
|
|
||||||
|
if ((sector[sectnum].ceilingstat&512)==0)
|
||||||
|
{
|
||||||
|
i = yax_getneighborsect(dax, day, sectnum, YAX_CEILING, NULL);
|
||||||
|
if (i >= 0)
|
||||||
|
{
|
||||||
|
*ceilz = getceilzofslope(i, dax,day);
|
||||||
|
didceil = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sector[sectnum].floorstat&512)==0)
|
||||||
|
{
|
||||||
|
i = yax_getneighborsect(dax, day, sectnum, YAX_FLOOR, NULL);
|
||||||
|
if (i >= 0)
|
||||||
|
{
|
||||||
|
*florz = getflorzofslope(i, dax,day);
|
||||||
|
didflor = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!didceil || !didflor)
|
||||||
|
{
|
||||||
|
int32_t cz, fz;
|
||||||
|
getzsofslope(sectnum, dax, day, &cz, &fz);
|
||||||
|
|
||||||
|
if (!didceil)
|
||||||
|
*ceilz = cz;
|
||||||
|
if (!didflor)
|
||||||
|
*florz = fz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void P_ProcessInput(int32_t snum)
|
void P_ProcessInput(int32_t snum)
|
||||||
{
|
{
|
||||||
DukePlayer_t *p = g_player[snum].ps;
|
DukePlayer_t *p = g_player[snum].ps;
|
||||||
|
@ -4509,7 +4547,11 @@ void P_ProcessInput(int32_t snum)
|
||||||
shrunk = (s->yrepeat < 32);
|
shrunk = (s->yrepeat < 32);
|
||||||
getzrange((vec3_t *)p,p->cursectnum,&cz,&hz,&fz,&lz,163L,CLIPMASK0);
|
getzrange((vec3_t *)p,p->cursectnum,&cz,&hz,&fz,&lz,163L,CLIPMASK0);
|
||||||
|
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
getzsofslope_player(p->cursectnum,p->pos.x,p->pos.y,&p->truecz,&p->truefz);
|
||||||
|
#else
|
||||||
getzsofslope(p->cursectnum,p->pos.x,p->pos.y,&p->truecz,&p->truefz);
|
getzsofslope(p->cursectnum,p->pos.x,p->pos.y,&p->truecz,&p->truefz);
|
||||||
|
#endif
|
||||||
j = p->truefz;
|
j = p->truefz;
|
||||||
|
|
||||||
truefdist = klabs(p->pos.z-j);
|
truefdist = klabs(p->pos.z-j);
|
||||||
|
@ -4920,7 +4962,6 @@ void P_ProcessInput(int32_t snum)
|
||||||
p->pos.z += ((fz-(k<<8))-p->pos.z)>>1;
|
p->pos.z += ((fz-(k<<8))-p->pos.z)>>1;
|
||||||
if (p->pos.z < (actor[p->i].ceilingz+(18<<8)))
|
if (p->pos.z < (actor[p->i].ceilingz+(18<<8)))
|
||||||
p->pos.z = actor[p->i].ceilingz+(18<<8);
|
p->pos.z = actor[p->i].ceilingz+(18<<8);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (psectlotag != 2)
|
else if (psectlotag != 2)
|
||||||
{
|
{
|
||||||
|
@ -5311,11 +5352,22 @@ HORIZONLY:
|
||||||
{
|
{
|
||||||
p->pos.x += p->vel.x>>14;
|
p->pos.x += p->vel.x>>14;
|
||||||
p->pos.y += p->vel.y>>14;
|
p->pos.y += p->vel.y>>14;
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
// TODO: only if ceiling/floor bunchnum >= 0
|
||||||
|
updatesectorz(p->pos.x,p->pos.y,p->pos.z,&p->cursectnum);
|
||||||
|
#else
|
||||||
updatesector(p->pos.x,p->pos.y,&p->cursectnum);
|
updatesector(p->pos.x,p->pos.y,&p->cursectnum);
|
||||||
|
#endif
|
||||||
changespritesect(p->i,p->cursectnum);
|
changespritesect(p->i,p->cursectnum);
|
||||||
}
|
}
|
||||||
else if ((j = clipmove((vec3_t *)p,&p->cursectnum, p->vel.x,p->vel.y,164L,(4L<<8),i,CLIPMASK0)))
|
else
|
||||||
|
{
|
||||||
|
#ifdef YAX_ENABLE
|
||||||
|
updatesectorz(p->pos.x,p->pos.y,p->pos.z,&p->cursectnum);
|
||||||
|
#endif
|
||||||
|
if ((j = clipmove((vec3_t *)p,&p->cursectnum, p->vel.x,p->vel.y,164L,(4L<<8),i,CLIPMASK0)))
|
||||||
P_CheckTouchDamage(p, j);
|
P_CheckTouchDamage(p, j);
|
||||||
|
}
|
||||||
|
|
||||||
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
|
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
|
||||||
p->pos.z += 32<<8;
|
p->pos.z += 32<<8;
|
||||||
|
|
Loading…
Reference in a new issue