* Lazy hightile loading in Mapster32 tile selector (first display all as lowtiles, then load each one while allowing movement)

* Consolidate the various, slightly different, methods of bounding a sprite between a sector's ceiling and floor into one common function
* Fixes for accumulated bugs: shade preview, r_shadescale_unbounded, and a couple of unreported ones
* Yaks, gnus, and bisons...


git-svn-id: https://svn.eduke32.com/eduke32@1854 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-03-23 17:41:01 +00:00
parent a01f69c8e3
commit 46964b322b
11 changed files with 1010 additions and 627 deletions

View file

@ -62,16 +62,18 @@ extern "C" {
#define PR_LIGHT_PRIO_LOW_GAME 5
////////// yax defs //////////
#define YAX_MAXBUNCHES (MAXSECTORS>>1)
#define YAX_BIT 1024
#define YAX_CEILING 0
#define YAX_FLOOR 1
#define YAX_CEILING 0 // don't change!
#define YAX_FLOOR 1 // don't change!
#define YAX_SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (&sector[Sect].floor##Fld) : (&sector[Sect].ceiling##Fld)))
#define 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);
void yax_update(int32_t onlyreset);
#define CLIPMASK0 (((1L)<<16)+1L)
@ -232,6 +234,19 @@ struct validmode_t {
};
EXTERN struct validmode_t validmode[MAXVALIDMODES];
EXTERN int32_t numyaxbunches;
#ifdef YAX_ENABLE
// Singly-linked list of sectnums grouped by bunches and ceiling (0)/floor (1)
// Usage e.g.:
// int16_t bunchnum = yax_getbunch(somesector, YAX_CEILING);
// Iteration over all sectors whose floor bunchnum equals 'bunchnum' (i.e. "all
// floors of the other side"):
// for (i=headsectbunch[1][bunchnum]; i!=-1; i=nextsectbunch[1][i])
// <do stuff with sector i...>
EXTERN int16_t headsectbunch[2][YAX_MAXBUNCHES], nextsectbunch[2][MAXSECTORS];
#endif
EXTERN int16_t numsectors, numwalls;
EXTERN char display_mirror;
EXTERN /*volatile*/ int32_t totalclock;
@ -279,7 +294,7 @@ EXTERN int32_t windowpos, windowx, windowy;
EXTERN char show2dsector[(MAXSECTORS+7)>>3];
EXTERN char show2dwall[(MAXWALLS+7)>>3];
EXTERN char show2dsprite[(MAXSPRITES+7)>>3];
EXTERN char automapping;
//EXTERN char automapping;
EXTERN char gotpic[(MAXTILES+7)>>3];
EXTERN char gotsector[(MAXSECTORS+7)>>3];
@ -589,7 +604,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 spriteheight(int16_t i, int32_t *basez);
void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs);
int32_t screencapture(const char *filename, char inverseit, const char *versionstr) ATTRIBUTE((nonnull(1)));
@ -640,7 +655,8 @@ int32_t animateoffs(int16_t tilenum, int16_t fakevar);
void setpolymost2dview(void); // sets up GL for 2D drawing
int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom);
int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom,
int32_t usehitile, uint8_t *loadedhitile);
void polymost_glreset(void);
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype);

View file

@ -367,7 +367,11 @@ static inline void dtol(double d, int32_t *a)
# define max(a,b) ( ((a) > (b)) ? (a) : (b) )
#endif
#if __GNUC__ >= 4
static inline __attribute__((warn_unused_result)) int clamp(int in, int min, int max)
#else
static inline int clamp(int in, int min, int max)
#endif
{
return in <= min ? min : in >= max ? max : in;
}

View file

@ -140,6 +140,7 @@ int32_t writesetup(const char *fn); // from config.c
void editinput(void);
void clearmidstatbar16(void);
void fade_editor_screen(void);
int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t));
#define getnumber256(namestart, num, maxnumber, sign) _getnumber256(namestart, num, maxnumber, sign, NULL)
@ -160,6 +161,7 @@ extern int32_t lastpm16time;
extern char lastpm16buf[156];
void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr);
void DoSpriteOrnament(int32_t i);
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y);
@ -237,4 +239,10 @@ static inline int32_t atoi_safe(const char *str)
return (int32_t)strtol(str, NULL, 10);
}
static inline void inpclamp(int32_t *x, int32_t mi, int32_t ma)
{
if (*x>ma) *x=ma;
if (*x<mi) *x=mi;
}
#endif

View file

@ -126,8 +126,6 @@ int16_t highlight[MAXWALLS+MAXSPRITES];
int16_t highlightsector[MAXSECTORS], highlightsectorcnt = -1;
extern char textfont[128][8];
char pskysearch[MAXSECTORS];
int32_t temppicnum, tempcstat, templotag, temphitag, tempextra;
uint32_t temppal, tempvis, tempxrepeat, tempyrepeat;
int32_t tempshade, tempxvel, tempyvel, tempzvel;
@ -253,12 +251,6 @@ extern void map_undoredo_free(void);
void clearkeys(void) { Bmemset(keystatus,0,sizeof(keystatus)); }
static inline void bclamp(int32_t *x, int32_t mi, int32_t ma)
{
if (*x>ma) *x=ma;
if (*x<mi) *x=mi;
}
#ifdef USE_OPENGL
static int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
{
@ -371,7 +363,39 @@ static void yax_resetbunchnums(void)
for (i=0; i<MAXSECTORS; i++)
yax_setbunches(i, -1, -1);
numyaxbunches = 0;
}
static void setslope(int32_t sectnum, int32_t cf, int16_t slope)
{
if (slope==0)
{
SECTORFLD(sectnum,stat, cf) &= ~2;
SECTORFLD(sectnum,heinum, cf) = 0;
}
else
{
SECTORFLD(sectnum,stat, cf) |= 2;
SECTORFLD(sectnum,heinum, cf) = slope;
}
}
// whether a wall is unconstrained by sector extensions
static int32_t yax_isinnerwall(int16_t sec, int16_t line)
{
int16_t cb,fb, cbn,fbn;
int16_t ns = wall[line].nextsector;
yax_getbunches(sec, &cb, &fb);
if (ns < 0)
return (cb==-1 && fb==-1);
yax_getbunches(ns, &cbn, &fbn);
return (cb==cbn && fb==fbn);
}
# define DEFAULT_YAX_HEIGHT 32768
#endif
static void reset_default_mapstate(void)
@ -380,10 +404,12 @@ static void reset_default_mapstate(void)
pos.y = 32768;
pos.z = 0;
ang = 1536;
cursectnum = -1;
numsectors = 0;
numwalls = 0;
numsprites = 0;
cursectnum = -1;
initspritelists();
#ifdef YAX_ENABLE
yax_resetbunchnums();
@ -566,12 +592,12 @@ CANCEL:
OSD_DispatchQueued();
ExtPreCheckKeys();
nextpage();
synctics = totalclock-lockclock;
lockclock += synctics;
ExtPreCheckKeys();
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
ExtAnalyzeSprites();
drawmasks();
@ -726,6 +752,20 @@ void loadmhk(int32_t domessage)
}
}
// this is spriteon{ceiling,ground}z from astub.c packed into
// one convenient function
void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr)
{
int32_t cz,fz, height, zofs;
getzsofslope(sprite[i].sectnum, sprite[i].x,sprite[i].y, &cz, &fz);
spriteheightofs(i, &height, &zofs);
if (czptr)
*czptr = cz + height - zofs;
if (fzptr)
*fzptr = fz - zofs;
}
static void move_and_update(int32_t xvect, int32_t yvect, int32_t addshr)
{
@ -740,7 +780,7 @@ static void move_and_update(int32_t xvect, int32_t yvect, int32_t addshr)
128,4<<8,4<<8, CLIPMASK0);
}
static void mainloop_move()
static void mainloop_move(void)
{
int32_t xvect, yvect, doubvel;
@ -888,7 +928,7 @@ void editinput(void)
ang++;
*/
bclamp(&horiz, -99, 299);
inpclamp(&horiz, -99, 299);
if (mlook == 1)
{
@ -905,8 +945,8 @@ void editinput(void)
searchx += mousx;
searchy += mousy;
bclamp(&searchx, 12, xdim-13);
bclamp(&searchy, 12, ydim-13);
inpclamp(&searchx, 12, xdim-13);
inpclamp(&searchy, 12, ydim-13);
}
}
@ -1005,7 +1045,7 @@ void editinput(void)
}
if (!noclip)
bclamp(&goalz, hiz+(4<<8), loz-(4<<8));
inpclamp(&goalz, hiz+(4<<8), loz-(4<<8));
if (zmode == 1) goalz = loz-zlock;
if (!noclip && (goalz < hiz+(4<<8)))
@ -1068,7 +1108,7 @@ void editinput(void)
day = hitinfo.pos.y;
if (gridlock && grid > 0)
{
if (searchstat == 0 || searchstat == 4)
if (AIMING_AT_WALL || AIMING_AT_MASKWALL)
hitinfo.pos.z &= 0xfffffc00;
else
locktogrid(&dax, &day);
@ -1106,17 +1146,10 @@ void editinput(void)
getzsofslope(hitinfo.hitsect, hitinfo.pos.x, hitinfo.pos.y, &cz, &fz);
j = spriteheight(i, NULL)>>1;
sprite[i].z = hitinfo.pos.z;
if ((sprite[i].cstat&48)!=32)
{
if ((sprite[i].cstat&128) == 0)
bclamp(&sprite[i].z, cz+(j<<1), fz);
else
bclamp(&sprite[i].z, cz+j, fz-j);
}
spriteoncfz(i, &cz, &fz);
sprite[i].z = clamp(hitinfo.pos.z, cz, fz);
if (searchstat == 0 || searchstat == 4)
if (AIMING_AT_WALL || AIMING_AT_MASKWALL)
{
sprite[i].cstat &= ~48;
sprite[i].cstat |= (16+64);
@ -1142,13 +1175,13 @@ void editinput(void)
{
switch (searchstat)
{
case 1:
case 2:
case SEARCH_CEILING:
case SEARCH_FLOOR:
ExtShowSectorData(searchsector); break;
case 0:
case 4:
case SEARCH_WALL:
case SEARCH_MASKWALL:
ExtShowWallData(searchwall); break;
case 3:
case SEARCH_SPRITE:
ExtShowSpriteData(searchwall); break;
}
@ -1158,13 +1191,13 @@ void editinput(void)
{
switch (searchstat)
{
case 1:
case 2:
case SEARCH_CEILING:
case SEARCH_FLOOR:
ExtEditSectorData(searchsector); break;
case 0:
case 4:
case SEARCH_WALL:
case SEARCH_MASKWALL:
ExtEditWallData(searchwall); break;
case 3:
case SEARCH_SPRITE:
ExtEditSpriteData(searchwall); break;
}
@ -1449,7 +1482,7 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo)
static int32_t newnumwalls=-1;
static void ovh_whiteoutgrab()
static void ovh_whiteoutgrab(void)
{
int32_t i, j, k, startwall, endwall;
@ -1480,7 +1513,7 @@ static void ovh_whiteoutgrab()
}
}
static void duplicate_selected_sectors()
static void duplicate_selected_sectors(void)
{
int32_t i, j, startwall, endwall, newnumsectors, newwalls = 0;
int32_t minx=INT_MAX, maxx=INT_MIN, miny=INT_MAX, maxy=INT_MIN, dx, dy;
@ -1581,7 +1614,7 @@ static void duplicate_selected_sectors()
}
}
static void duplicate_selected_sprites()
static void duplicate_selected_sprites(void)
{
int32_t i, j, k=0;
@ -1645,7 +1678,7 @@ void DoSpriteOrnament(int32_t i)
correct_ornamented_sprite(i, hitinfo.hitwall);
}
void update_highlight()
void update_highlight(void)
{
int32_t i;
@ -1666,7 +1699,7 @@ void update_highlight()
highlightcnt = -1;
}
void update_highlightsector()
void update_highlightsector(void)
{
int32_t i;
@ -1790,7 +1823,7 @@ void correct_sprite_yoffset(int32_t i)
sprite[i].yoffset = 0;
}
static void fade_screen()
void fade_editor_screen(void)
{
char blackcol=editorcolors[0], greycol=whitecol-25, *cp;
int32_t i;
@ -1861,19 +1894,15 @@ static void updatesprite1(int16_t i)
if (sprite[i].sectnum>=0)
{
int32_t tempint, cz, fz;
tempint = spriteheight(i, NULL);
if (sprite[i].cstat&128)
tempint >>= 1;
getzsofslope(sprite[i].sectnum, sprite[i].x, sprite[i].y, &cz, &fz);
sprite[i].z = max(sprite[i].z, cz+tempint);
sprite[i].z = min(sprite[i].z, fz);
int32_t cz, fz;
spriteoncfz(i, &cz, &fz);
inpclamp(&sprite[i].z, cz, fz);
}
}
static int32_t ask_if_sure(const char *query, uint32_t flags);
#ifdef YAX_ENABLE
static int32_t ask_above_or_below();
static int32_t ask_above_or_below(void);
#endif
// returns:
@ -2136,8 +2165,8 @@ void overheadeditor(void)
searchx += mousx;
searchy += mousy;
bclamp(&searchx, 8, xdim-8-1);
bclamp(&searchy, 8, ydim-8-1);
inpclamp(&searchx, 8, xdim-8-1);
inpclamp(&searchy, 8, ydim-8-1);
mainloop_move();
@ -2806,7 +2835,7 @@ void overheadeditor(void)
if (cf==-1)
goto end_yax;
thez = YAX_SECTORFLD(highlightsector[0],z, cf);
thez = SECTORFLD(highlightsector[0],z, cf);
for (i=0; i<highlightsectorcnt; i++)
{
if (yax_getbunch(highlightsector[i], cf) >= 0)
@ -2815,15 +2844,13 @@ void overheadeditor(void)
goto end_yax;
}
if (i==0)
continue;
if (YAX_SECTORFLD(highlightsector[i],z, cf) != thez)
if (SECTORFLD(highlightsector[i],z, cf) != thez)
{
message("All sectors must have the same %s height", cfs[cf]);
goto end_yax;
}
if ((YAX_SECTORFLD(highlightsector[i],stat, cf)&2)!=0)
if (highlightsectorcnt>1 && SECTORFLD(highlightsector[i],stat, cf)&2)
{
message("Sector %ss must not be sloped", cfs[cf]);
goto end_yax;
@ -2849,27 +2876,27 @@ void overheadeditor(void)
numwalls = k;
}
// create new sector based on first highlighted one
i = highlightsector[0];
Bmemcpy(&sector[numsectors], &sector[i], sizeof(sectortype));
sector[numsectors].wallptr = m;
sector[numsectors].wallnum = numwalls-m;
if (YAX_SECTORFLD(i,stat, cf)&2)
{
YAX_SECTORFLD(numsectors,stat, !cf) |= 2;
YAX_SECTORFLD(numsectors,heinum, !cf) = YAX_SECTORFLD(i,heinum, cf);
}
if (SECTORFLD(i,stat, cf)&2)
setslope(numsectors, !cf, SECTORFLD(i,heinum, cf));
else
setslope(numsectors, !cf, 0);
setslope(numsectors, cf, 0);
YAX_SECTORFLD(numsectors,z, !cf) = YAX_SECTORFLD(i,z, cf);
YAX_SECTORFLD(numsectors,z, cf) = YAX_SECTORFLD(i,z, cf) - (1-2*cf)*16384;
SECTORFLD(numsectors,z, !cf) = SECTORFLD(i,z, cf);
SECTORFLD(numsectors,z, cf) = SECTORFLD(i,z, cf) - (1-2*cf)*DEFAULT_YAX_HEIGHT;
k = -1; // nextbunchnum
for (i=0; i<numsectors; i++)
{
j = yax_getbunch(i,YAX_CEILING);
k = max(k, j);
j = yax_getbunch(i,YAX_FLOOR);
k = max(k, j);
int16_t cb, fb;
yax_getbunches(i, &cb, &fb);
k = max(k, max(cb, fb));
}
k++;
@ -2893,11 +2920,12 @@ void overheadeditor(void)
newnumwalls = -1;
numsectors++;
yax_update(0);
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
update_highlightsector();
message("Extended %ss of highlighted sectors, created new bunch %d", cfs[cf], k);
message("Extended %ss of highlighted sectors, creating bunch %d", cfs[cf], k);
end_yax: ;
}
#endif
@ -3110,7 +3138,7 @@ end_yax: ;
else
{
int32_t didmakered = (highlightsectorcnt<0), hadouterpoint=0;
int16_t tmprefsect;
int16_t tmprefsect = -1;
for (i=0; i<highlightsectorcnt; i++)
{
@ -3132,7 +3160,7 @@ end_yax: ;
if (!didmakered && !hadouterpoint && newnumwalls<0)
{
// fade the screen to have the user's attention
fade_screen();
fade_editor_screen();
didmakered |= !ask_if_sure("Insert outer loop and make red walls?", 0);
clearkeys();
@ -3781,7 +3809,9 @@ end_point_dragging:
else
{
int16_t joink;
#ifdef YAX_ENABLE
int16_t cb0,fb0, cb1,fb1;
#endif
joinsector[1] = -1;
for (i=0; i<numsectors; i++)
@ -3795,16 +3825,37 @@ end_point_dragging:
break;
joinsector[1] = i;
#ifdef YAX_ENABLE
yax_getbunches(joinsector[0], &cb0, &fb0);
yax_getbunches(joinsector[1], &cb1, &fb1);
#endif
// pressing J into the same sector is the same as saying 'no'
// v----------------v
if (j == endwall && i != joinsector[0])
{
fade_screen();
#ifdef YAX_ENABLE
if (cb0>=0 || fb0>=0 || cb1>=0 || fb0>=0)
{
printmessage16("Joining non-adjacent extended sectors not allowed!");
joinsector[0] = joinsector[1] = -1;
goto end_join_sectors;
}
#endif
{
fade_editor_screen();
if (!ask_if_sure("Join non-adjacent sectors? (Y/N)", 0))
joinsector[1] = joinsector[0];
}
}
#ifdef YAX_ENABLE
if (cb0!=cb1 || fb0!=fb1)
{
printmessage16("Joining of extended sectors with different bunches not allowed!");
joinsector[0] = joinsector[1] = -1;
goto end_join_sectors;
}
#endif
break;
}
}
@ -3999,9 +4050,6 @@ end_join_sectors:
else
{
sprite[i].z = getflorzofslope(sucksect,dax,day);
// if (sprite[i].cstat&128)
// sprite[i].z -= spriteheight(i, NULL)>>1;
// PK
if (prefixarg)
{
@ -4058,8 +4106,15 @@ end_join_sectors:
else
{
if (linehighlight >= 0)
{
#ifdef YAX_ENABLE
if (!yax_isinnerwall(sectorofwall(linehighlight), linehighlight))
printmessage16("Can't make circle in wall constrained by sector extension.");
else
#endif
circlewall = linehighlight;
}
}
keystatus[0x2e] = 0;
}
@ -4109,8 +4164,8 @@ end_join_sectors:
dax = centerx + mulscale14(sintable[(j+512)&2047],circlerad);
day = centery + mulscale14(sintable[j],circlerad);
bclamp(&dax, -editorgridextent, editorgridextent);
bclamp(&day, -editorgridextent, editorgridextent);
inpclamp(&dax, -editorgridextent, editorgridextent);
inpclamp(&day, -editorgridextent, editorgridextent);
if (bad > 0 && goodtogo)
{
@ -4892,10 +4947,17 @@ end_space_handling:
}
else
{
#ifdef YAX_ENABLE
if (!yax_isinnerwall(sectorofwall(linehighlight), linehighlight))
printmessage16("Inserting point in constrained wall: not implemented!");
else
#endif
{
insertpoint(linehighlight, dax,day);
printmessage16("Point inserted.");
}
}
}
backup_drawn_walls(1);
@ -5330,7 +5392,7 @@ static int32_t ask_if_sure(const char *query, uint32_t flags)
}
#ifdef YAX_ENABLE
static int32_t ask_above_or_below()
static int32_t ask_above_or_below(void)
{
char ch;
int32_t ret=-1;
@ -5459,8 +5521,8 @@ int32_t LoadBoard(const char *filename, uint32_t flags)
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y)
{
bclamp(&pos.x, -editorgridextent, editorgridextent);
bclamp(&pos.y, -editorgridextent, editorgridextent);
inpclamp(&pos.x, -editorgridextent, editorgridextent);
inpclamp(&pos.y, -editorgridextent, editorgridextent);
searchxe -= halfxdim16;
searchye -= midydim16;
@ -5475,8 +5537,8 @@ void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y)
*x = pos.x + divscale14(searchxe,zoom);
*y = pos.y + divscale14(searchye,zoom);
bclamp(x, -editorgridextent, editorgridextent);
bclamp(y, -editorgridextent, editorgridextent);
inpclamp(x, -editorgridextent, editorgridextent);
inpclamp(y, -editorgridextent, editorgridextent);
}
static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line)
@ -5825,7 +5887,7 @@ static int32_t deletesector(int16_t sucksect)
void fixspritesectors(void)
{
int32_t i, j, dax, day, daz;
int32_t i, j, dax, day, cz, fz;
for (i=numsectors-1; i>=0; i--)
if (sector[i].wallnum <= 0 || sector[i].wallptr >= numwalls)
@ -5842,18 +5904,21 @@ void fixspritesectors(void)
if (inside(dax,day,sprite[i].sectnum) != 1)
{
daz = spriteheight(i, NULL);
spriteoncfz(i, &cz, &fz);
for (j=0; j<numsectors; j++)
if (inside(dax,day, j) == 1
&& sprite[i].z >= getceilzofslope(j,dax,day)
&& sprite[i].z-daz <= getflorzofslope(j,dax,day))
{
if (inside(dax,day, j) != 1)
continue;
if (cz <= sprite[i].z && sprite[i].z <= fz)
{
changespritesect(i, j);
break;
}
}
}
}
}
static int32_t movewalls(int32_t start, int32_t offs)
@ -6922,7 +6987,8 @@ void printcoords16(int32_t posxe, int32_t posye, int16_t ange)
{
char snotbuf[80];
int32_t i, m;
int32_t v8 = (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 || numsprites > MAXSPRITESV7);
int32_t v8 = (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 ||
numsprites > MAXSPRITESV7 || numyaxbunches > 0);
Bsprintf(snotbuf,"x:%d y:%d ang:%d r%d",posxe,posye,ange,map_revision-1);
i = 0;
@ -6941,8 +7007,9 @@ void printcoords16(int32_t posxe, int32_t posye, int16_t ange)
if (highlightcnt<=0 && highlightsectorcnt<=0)
{
Bsprintf(snotbuf,"%d/%d sect. %d/%d walls %d/%d spri.",
Bsprintf(snotbuf,"%d/%d %s. %d/%d walls %d/%d spri.",
numsectors, v8?MAXSECTORSV8:MAXSECTORSV7,
numyaxbunches>0 ? "SECT":"sect",
numwalls, v8?MAXWALLSV8:MAXWALLSV7,
numsprites, v8?MAXSPRITESV8:MAXSPRITESV7);
}
@ -7112,23 +7179,43 @@ void showsectordata(int16_t sectnum, int16_t small)
DOPRINT(32, "^10CEILING:^O");
DOPRINT(48, "Flags (hex): %x", sec->ceilingstat);
DOPRINT(56, "(X,Y)pan: %d, %d", sec->ceilingxpanning, sec->ceilingypanning);
{
int32_t xp=sec->ceilingxpanning, yp=sec->ceilingypanning;
#ifdef YAX_ENABLE
if (yax_getbunch(searchsector, YAX_CEILING) >= 0)
xp = yp = 0;
#endif
DOPRINT(56, "(X,Y)pan: %d, %d", xp, yp);
}
DOPRINT(64, "Shade byte: %d", sec->ceilingshade);
DOPRINT(72, "Z-coordinate: %d", sec->ceilingz);
DOPRINT(80, "Tile number: %d", sec->ceilingpicnum);
DOPRINT(88, "Ceiling heinum: %d", sec->ceilingheinum);
DOPRINT(96, "Palookup number: %d", sec->ceilingpal);
#ifdef YAX_ENABLE
DOPRINT(104, "Bunch number: %d", yax_getbunch(sectnum, YAX_CEILING));
#endif
col++;
DOPRINT(32, "^10FLOOR:^O");
DOPRINT(48, "Flags (hex): %x", sec->floorstat);
DOPRINT(56, "(X,Y)pan: %d, %d", sec->floorxpanning, sec->floorypanning);
{
int32_t xp=sec->floorxpanning, yp=sec->floorypanning;
#ifdef YAX_ENABLE
if (yax_getbunch(searchsector, YAX_FLOOR) >= 0)
xp = yp = 0;
#endif
DOPRINT(56, "(X,Y)pan: %d, %d", xp, yp);
}
DOPRINT(64, "Shade byte: %d", sec->floorshade);
DOPRINT(72, "Z-coordinate: %d", sec->floorz);
DOPRINT(80, "Tile number: %d", sec->floorpicnum);
DOPRINT(88, "Floor heinum: %d", sec->floorheinum);
DOPRINT(96, "Palookup number: %d", sec->floorpal);
#ifdef YAX_ENABLE
DOPRINT(104, "Bunch number: %d", yax_getbunch(sectnum, YAX_FLOOR));
#endif
}
void showwalldata(int16_t wallnum, int16_t small)

View file

@ -219,7 +219,7 @@ void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum)
if (bunchnum<0)
{
*(&sector[i].ceilingstat + cf) &= ~YAX_BIT;
// YAX_BUNCHNUM(i, cf) = 0;
YAX_BUNCHNUM(i, cf) = 0;
return;
}
@ -233,6 +233,63 @@ void yax_setbunches(int16_t i, int16_t cb, int16_t fb)
yax_setbunch(i, YAX_FLOOR, fb);
}
void yax_update(int32_t onlyreset)
{
int32_t i, oeditstatus=editstatus;
int16_t cb, fb, tmpsect;
numyaxbunches = 0;
for (i=0; i<MAXSECTORS; i++)
{
yax_bunchnum[i][0] = yax_bunchnum[i][1] = -1;
nextsectbunch[0][i] = nextsectbunch[1][i] = -1;
}
for (i=0; i<YAX_MAXBUNCHES; i++)
headsectbunch[0][i] = headsectbunch[1][i] = -1;
if (onlyreset)
return;
// constuct singly linked list of sectors-of-bunch
editstatus = 1; // read bunchnums directly from the sector struct!
for (i=numsectors-1; i>=0; i--)
{
yax_getbunches(i, &cb, &fb);
yax_bunchnum[i][0] = cb;
yax_bunchnum[i][1] = fb;
if (cb >= 0)
{
if (headsectbunch[0][cb] == -1)
{
headsectbunch[0][cb] = i;
// not duplicated in floors, since every extended ceiling
// must have a corresponding floor:
numyaxbunches++;
}
else
{
tmpsect = headsectbunch[0][cb];
headsectbunch[0][cb] = i;
nextsectbunch[0][i] = tmpsect;
}
}
if (fb >= 0)
{
if (headsectbunch[1][fb] == -1)
headsectbunch[1][fb] = i;
else
{
tmpsect = headsectbunch[1][fb];
headsectbunch[1][fb] = i;
nextsectbunch[1][i] = tmpsect;
}
}
}
editstatus = oeditstatus;
}
#undef YAX_BUNCHNUM
#endif
@ -1306,7 +1363,7 @@ static void scansector(int16_t sectnum)
if (sectnum < 0) return;
if (automapping) show2dsector[sectnum>>3] |= pow2char[sectnum&7];
// if (automapping) show2dsector[sectnum>>3] |= pow2char[sectnum&7];
sectorborder[0] = sectnum, sectorbordercnt = 1;
do
@ -4687,7 +4744,7 @@ static void drawsprite(int32_t snum)
#endif
drawvox(tspr->x,tspr->y,tspr->z,i,(int32_t)tspr->xrepeat,(int32_t)tspr->yrepeat,vtilenum,tspr->shade,tspr->pal,lwall,swall);
}
if (automapping == 1) show2dsprite[spritenum>>3] |= pow2char[spritenum&7];
// if (automapping == 1) show2dsprite[spritenum>>3] |= pow2char[spritenum&7];
}
@ -6360,7 +6417,7 @@ int32_t initengine(void)
clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L);
automapping = 0;
// automapping = 0;
totalclock = 0;
visibility = 512;
@ -6477,7 +6534,7 @@ void initspritelists(void)
void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
int16_t daang, int32_t dahoriz, int16_t dacursectnum)
{
int32_t i, j, z, cz, fz, closest;
int32_t i, j, cz, fz, closest;
int16_t *shortptr1, *shortptr2;
beforedrawrooms = 0;
@ -6629,11 +6686,11 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
drawalls(closest);
if (automapping)
{
for (z=bunchfirst[closest]; z>=0; z=p2[z])
show2dwall[thewall[z]>>3] |= pow2char[thewall[z]&7];
}
// if (automapping)
// {
// for (z=bunchfirst[closest]; z>=0; z=p2[z])
// show2dwall[thewall[z]>>3] |= pow2char[thewall[z]&7];
// }
numbunches--;
bunchfirst[closest] = bunchfirst[numbunches];
@ -8984,25 +9041,27 @@ int32_t krecip(int32_t num)
return(krecipasm(num));
}
int32_t spriteheight(int16_t i, int32_t *basez)
void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs)
{
int32_t hei, flooraligned=((sprite[i].cstat&48)==32);
if (zofs)
*zofs = 0;
if (flooraligned)
{
if (basez)
*basez = sprite[i].z;
return 0;
if (height)
*height = 0;
return;
}
hei = (tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2;
if (basez)
if (zofs)
{
*basez = sprite[i].z;
if (sprite[i].cstat&128)
*basez -= (hei>>1);
*zofs = hei>>1;
}
return hei;
*height = hei;
}
//
@ -10531,7 +10590,7 @@ void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *
walltype *wal;
int32_t i, j;
if (!(excludesectbitmap[*sectnum>>3]&(1<<(*sectnum&7))) && inside(x,y,*sectnum) == 1)
if (*sectnum>=0 && !(excludesectbitmap[*sectnum>>3]&(1<<(*sectnum&7))) && inside(x,y,*sectnum) == 1)
return;
if ((*sectnum >= 0) && (*sectnum < numsectors))
@ -10745,7 +10804,7 @@ void getzrange(const vec3_t *vect, int16_t sectnum,
if (0)
{
beginagain:
beginagain:
// replace sector and wall with clip map
mapinfo_set(&origmapinfo, &clipmapinfo);
clipsectcnt = clipsectnum; // should be a nop, "safety"...

View file

@ -2186,7 +2186,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
{
float pc[4];
int32_t shadebound = shadescale_unbounded ? numpalookups : 31;
int32_t shadebound = (shadescale_unbounded || globalshade>31) ? numpalookups : 31;
f = ((float)(numpalookups-min(max((globalshade * shadescale),0),shadebound)))/((float)numpalookups);
pc[0] = pc[1] = pc[2] = f;
switch (method&3)
@ -4077,7 +4077,7 @@ static void polymost_scansector(int32_t sectnum)
int32_t xs, ys, x1, y1, x2, y2;
if (sectnum < 0) return;
if (automapping) show2dsector[sectnum>>3] |= pow2char[sectnum&7];
// if (automapping) show2dsector[sectnum>>3] |= pow2char[sectnum&7];
sectorborder[0] = sectnum, sectorbordercnt = 1;
do
@ -5788,7 +5788,7 @@ void polymost_fillpolygon(int32_t npoints)
pthtyp *pth;
float f,a=0.0;
int32_t i;
int32_t shadebound = shadescale_unbounded ? numpalookups-1 : 31;
int32_t shadebound = (shadescale_unbounded || globalshade>31) ? numpalookups : 31;
globalx1 = mulscale16(globalx1,xyaspect);
globaly2 = mulscale16(globaly2,xyaspect);
@ -5829,7 +5829,8 @@ void polymost_fillpolygon(int32_t npoints)
}
#endif
int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom)
int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom,
int32_t usehitile, uint8_t *loadedhitile)
{
#ifdef USE_OPENGL
float xdime, ydime, xdimepad, ydimepad, scx, scy, ratio = 1.0;
@ -5860,11 +5861,22 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i
{
scx = (float)dimen;
scy = (float)dimen;
if (xdime < ydime) scx *= xdime/ydime; else scy *= ydime/xdime;
if (xdime < ydime)
scx *= xdime/ydime;
else
scy *= ydime/xdime;
}
{
int32_t ousehightile = usehightile;
usehightile = usehitile && usehightile;
pth = gltexcache(wallnum,0,4);
bglBindTexture(GL_TEXTURE_2D,pth ? pth->glpic : 0);
if (usehightile)
loadedhitile[wallnum>>3] |= (1<<(wallnum&7));
usehightile = ousehightile;
}
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
bglDisable(GL_ALPHA_TEST);
@ -5902,7 +5914,7 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i
bglTexCoord2f(0, 0); bglVertex2f((float)tilex ,(float)tiley);
bglTexCoord2f(xdimepad, 0); bglVertex2f((float)tilex+(scx*ratio),(float)tiley);
bglTexCoord2f(xdimepad,ydimepad); bglVertex2f((float)tilex+(scx*ratio),(float)tiley+(scy*ratio));
bglTexCoord2f(0,ydimepad); bglVertex2f((float)tilex ,(float)tiley+(scy*ratio));
bglTexCoord2f(0, ydimepad); bglVertex2f((float)tilex ,(float)tiley+(scy*ratio));
bglEnd();
return(0);
@ -6621,7 +6633,11 @@ int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf,
#else /* POLYMOST */
#include "inttypes.h"
int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen) { return -1; }
int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen,
int32_t usehitile, uint8_t *loadedhitile)
{
return -1;
}
#endif

View file

@ -417,13 +417,13 @@ RIGHT smooth scrolling
sector Hi=X
SE 3 in affected sector:
Hi=X
Shades:
Shades/pals:
sectors/walls: when off
SE: when on
^3SE 4: RANDOM LIGHTS
Hi: random blink num. ^0(research!)
Shades:
Shades/pals:
sectors/walls: when off
SE: when on

View file

@ -875,7 +875,7 @@ onevent EVENT_KEYS3D
}
// teleporter -- works on SE7 and SE17 (elevator)
ifeitherctrl ifaimingsprite
ifeitheralt ifaimingsprite
ifholdkey KEY_SPACE
{
ife sprite[searchwall].picnum SECTOREFFECTOR

File diff suppressed because it is too large Load diff

View file

@ -562,6 +562,9 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
Gv_NewVar("numsprites",(intptr_t)&numsprites, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("numtiles",(intptr_t)&numtiles, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
#ifdef YAX_ENABLE
Gv_NewVar("numbunches",(intptr_t)&numyaxbunches, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
#endif
#ifdef USE_OPENGL
Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
@ -665,7 +668,12 @@ static void Gv_AddSystemVars(void)
Gv_NewArray("hstat", (void *)headspritestat, MAXSTATUS+1, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
Gv_NewArray("nstat", (void *)prevspritestat, MAXSPRITES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
Gv_NewArray("pstat", (void *)nextspritestat, MAXSPRITES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
#ifdef YAX_ENABLE
Gv_NewArray("headsectbunchc", (void *)headsectbunch[0], YAX_MAXBUNCHES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
Gv_NewArray("nextsectbunchc", (void *)nextsectbunch[0], MAXSECTORS, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
Gv_NewArray("headsectbunchf", (void *)headsectbunch[1], YAX_MAXBUNCHES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
Gv_NewArray("nextsectbunchf", (void *)nextsectbunch[1], MAXSECTORS, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
#endif
Gv_NewArray("tilesizx", (void *)tilesizx, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
Gv_NewArray("tilesizy", (void *)tilesizy, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
// Gv_NewArray("picsiz", (void *)picsiz, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);

View file

@ -1843,7 +1843,7 @@ int32_t G_EnterLevel(int32_t g)
resetpspritevars(g);
//cachedebug = 0;
automapping = 0;
// automapping = 0;
G_FadeLoad(0,0,0, 63, 0, -7);
G_CacheMapData();