Polymost:

* rudimentary TROR support
 * free mixing of multi- and single-tile pskies
 * Don't cull models behind you. That is, treat them like floor sprites in that respect. This way large models like corpses don't disappear from the view unexpectedly.

Classic:
 * tweak the last row and column of the translucency table so that e.g. a transparent sprite against a FANSPRITE wall doesn't show up purple (only if Duke3D table is found)

Misc.:
 * fixes TROR-nextwall corruption when deleting sectors
 * tile selector 'goto' now has also completion
 * I forgot a file for the non-OpenGL build last time


git-svn-id: https://svn.eduke32.com/eduke32@1892 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-05-22 21:52:22 +00:00
parent 8e75a11188
commit e92099b2f7
12 changed files with 488 additions and 218 deletions

View File

@ -676,8 +676,8 @@ int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum);
#define STATUS2DSIZ 144
#define STATUS2DSIZ2 26
void qsetmode640350(void);
void qsetmode640480(void);
//void qsetmode640350(void);
//void qsetmode640480(void);
void qsetmodeany(int32_t,int32_t);
void clear2dscreen(void);
void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride);

View File

@ -79,7 +79,7 @@ extern int32_t pk_turnaccel,pk_turndecel,pk_uedaccel;
extern int32_t revertCTRL,scrollamount;
extern int32_t autosave;
extern int32_t mlook;
extern int16_t prefixtiles[16];
extern int16_t prefixtiles[10];
extern int32_t numsprites;
extern int32_t showfirstwall;

View File

@ -122,10 +122,10 @@ static int32_t currentlist=0;
static int32_t fillist[640];
// used for fillsector and point selection in side-view mode:
static int32_t tempxyar[MAXWALLS][2];
static int32_t tempxyar[MAXWALLS][2] ATTRIBUTE((aligned(8)));
static int32_t mousx, mousy;
int16_t prefixtiles[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int16_t prefixtiles[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
uint8_t hlsectorbitmap[MAXSECTORS>>3]; // show2dsector is already taken...
static uint8_t visited[MAXWALLS>>3]; // used for AlignWalls and trace_loop
@ -2228,10 +2228,9 @@ void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int3
{
Bmemset(bitmap, 0, (maxnum+7)>>3);
*eltnumptr = 0;
list[*eltnumptr] = firstelt;
bitmap[*eltnumptr>>3] |= (1<<(*eltnumptr&7));
(*eltnumptr)++;
list[0] = firstelt;
bitmap[firstelt>>3] |= (1<<(firstelt&7));
*eltnumptr = 1;
}
void bfirst_search_try(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int16_t elt)
@ -2248,13 +2247,27 @@ void bfirst_search_try(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int16
}
#ifdef YAX_ENABLE
// whether all highlighted sectors are in one connected component
// wrt the nextsector relation
static int32_t highlighted_sectors_in_one_component()
static int32_t collnumsects[2];
static int16_t collsectlist[2][MAXSECTORS];
static uint8_t collsectbitmap[2][MAXSECTORS>>3];
static void collect_sectors1(int16_t *sectlist, uint8_t *sectbitmap, int32_t *numsectptr, int16_t startsec)
{
int32_t j, k, startwall, endwall, sectcnt, sectnum;
static int16_t sectlist[MAXSECTORS];
static uint8_t sectbitmap[MAXSECTORS>>3];
int32_t j, startwall, endwall, sectcnt;
bfirst_search_init(sectlist, sectbitmap, numsectptr, MAXSECTORS, startsec);
for (sectcnt=0; sectcnt<*numsectptr; sectcnt++)
for (WALLS_OF_SECTOR(sectlist[sectcnt], j))
bfirst_search_try(sectlist, sectbitmap, numsectptr, wall[j].nextsector);
}
// whether all highlighted sectors are in one (returns 1), two (2)
// or more (>2) connected components wrt the nextsector relation
// -1 means error
static int32_t highlighted_sectors_components(void)
{
int32_t j, k, tmp;
if (highlightsectorcnt<1)
return 0;
@ -2262,21 +2275,54 @@ static int32_t highlighted_sectors_in_one_component()
if (highlightsectorcnt==1)
return 1;
bfirst_search_init(sectlist, sectbitmap, &sectnum, MAXSECTORS, highlightsector[0]);
for (sectcnt=0; sectcnt<sectnum; sectcnt++)
for (WALLS_OF_SECTOR(sectlist[sectcnt], j))
bfirst_search_try(sectlist, sectbitmap, &sectnum, wall[j].nextsector);
collect_sectors1(collsectlist[0], collsectbitmap[0], &collnumsects[0], highlightsector[0]);
for (k=0; k<highlightsectorcnt; k++)
{
j = highlightsector[k];
if ((sectbitmap[j>>3]&(1<<(j&7)))==0)
return 0;
if ((collsectbitmap[0][j>>3]&(1<<(j&7)))==0)
{
// sector j not collected --> more than 1 conn. comp.
collect_sectors1(collsectlist[1], collsectbitmap[1], &collnumsects[1], j);
break;
}
}
if (k == highlightsectorcnt)
return 1;
for (k=0; k<highlightsectorcnt; k++)
{
j = highlightsector[k];
tmp = (((collsectbitmap[0][j>>3]&(1<<(j&7)))!=0) + (((collsectbitmap[1][j>>3]&(1<<(j&7)))!=0)<<1));
if (tmp==3)
return -1; // components only weakly connected
if (tmp==0)
return 3; // sector j not reached
}
return 2;
}
#if 0
static int cmpgeomwal1(const int16_t *w1, const int16_t *w2)
{
const walltype *wal1 = &wall[*w1];
const walltype *wal2 = &wall[*w2];
if (wal1->x == wal2->x)
return wal1->y - wal2->y;
return wal1->x - wal2->x;
}
static void sort_walls_geometrically(int16_t *wallist, int32_t nwalls)
{
qsort(wallist, nwalls, sizeof(int16_t), (int(*)(const void *, const void *))&cmpgeomwal1);
}
#endif
#endif
void overheadeditor(void)
@ -2303,7 +2349,6 @@ void overheadeditor(void)
m32_setkeyfilter(1);
//qsetmode640480();
qsetmodeany(xdim2d,ydim2d);
xdim2d = xdim;
ydim2d = ydim;
@ -3125,7 +3170,7 @@ void overheadeditor(void)
goto end_yax;
}
if (!highlighted_sectors_in_one_component())
if (highlighted_sectors_components() != 1)
{
message("Sectors to extend must be in one connected component");
goto end_yax;
@ -3239,7 +3284,7 @@ void overheadeditor(void)
update_highlightsector();
message("Extended %ss of highlighted sectors, creating bunch %d",
cfs[cf], numyaxbunches);
cfs[cf], numyaxbunches-1);
asksave = 1;
end_yax: ;
}
@ -4223,6 +4268,126 @@ end_point_dragging:
goto end_join_sectors;
}
#if 0
//def YAX_ENABLE
if (highlightsectorcnt > 0 && eitherCTRL)
{
// [component][ceiling(0) or floor(1)]
// compstat: &1: "has extension", &2: "differ in z", &4: "sloped"
int32_t cf, comp, compstat[2][2]={{0,0},{0,0}}, compcfz[2][2];
// joinstat:
// &1: ceil(comp 0) <-> flor(comp 1), &2: flor(comp 0) <-> ceil(comp 1)
// (doesn't yet say which is stationary)
int32_t joinstat, needsdisp, dx,dy,dz;
// tempxyar: int32_t [MAXWALLS][2]
int32_t numouterwalls[2] = {0,0}, numowals;
int16_t *const outerwall[2] = { (int16_t *)tempxyar, ((int16_t *)tempxyar)+MAXWALLS };
const walltype *wal0, *wal1;
// join sector ceilings/floors to a new bunch
if (numyaxbunches==YAX_MAXBUNCHES)
{
message("Bunch limit of %d reached, cannot join", YAX_MAXBUNCHES);
goto end_join_sectors;
}
// first, see whether we have exactly two connected components
// wrt wall[].nextsector
if (highlighted_sectors_components() != 2)
{
message("Sectors must be partitioned in two components to join");
goto end_join_sectors;
}
for (k=0; k<highlightsectorcnt; k++)
{
j = highlightsector[k];
comp = !!(collsectbitmap[1][j>>3]&(1<<(j&7)));
for (cf=0; cf<2; cf++)
{
if (k==0)
compcfz[comp][cf] = SECTORFLD(j,z, cf);
if (yax_getbunch(j, cf)>=0)
compstat[comp][cf] |= 1;
if (SECTORFLD(j,z, cf) != compcfz[comp][cf])
compstat[comp][cf] |= 2;
if (SECTORFLD(j,stat, cf)&2)
compstat[comp][cf] |= 4;
compcfz[comp][cf] = SECTORFLD(j,z, cf);
}
}
// check for consistency
joinstat = 0;
if (!compstat[0][YAX_CEILING] && !compstat[1][YAX_FLOOR])
joinstat |= 1;
if (!compstat[0][YAX_FLOOR] && !compstat[1][YAX_CEILING])
joinstat |= 2;
if (joinstat==0)
{
message("No consistent joining combination found");
goto end_join_sectors;
}
if (joinstat==3)
{
if (compcfz[0][YAX_CEILING] != compstat[1][YAX_FLOOR])
joinstat &= 1;
if (compcfz[0][YAX_CEILING] != compstat[1][YAX_FLOOR])
joinstat &= 2;
if (joinstat == 0)
joinstat = 3; // we couldn't disambiguate
}
for (comp=0; comp<2; comp++)
for (k=0; k<collnumsects[comp]; k++)
{
i = collsectlist[comp][k];
for (WALLS_OF_SECTOR(i, j))
if (wall[j].nextwall < 0)
outerwall[comp][numouterwalls[comp]++] = j;
}
if (numouterwalls[0] != numouterwalls[1])
{
message("Number of outer walls must be equal for both components");
goto end_join_sectors;
}
numowals = numouterwalls[0];
// now sort outer walls 'geometrically'
for (comp=0; comp<2; comp++)
sort_walls_geometrically(outerwall[comp], numouterwalls[comp]);
needsdisp = 0;
for (k=0; k<numowals; k++)
{
wal0 = &wall[outerwall[0][k]];
wal1 = &wall[outerwall[1][k]];
if (k==0)
{
dx = wal1->x - wal0->x;
dy = wal1->y - wal0->y;
}
if (wal1->x - wal0->x != dx || wal1->y - wal0->y != dy ||
wall[wal1->point2].x - wall[wal0->point2].x != dx ||
wall[wal1->point2].y - wall[wal0->point2].y != dy)
{
message("Outer wall coordinates must coincide for both components");
goto end_join_sectors;
}
}
}
else
#endif // defined YAX_ENABLE
if (joinsector[0] < 0)
{
joinsector[0] = -1;
@ -6547,6 +6712,10 @@ static int32_t deletesector(int16_t sucksect)
endwall = startwall + sector[sucksect].wallnum - 1;
j = sector[sucksect].wallnum;
#ifdef YAX_ENABLE
yax_setbunches(sucksect, -1, -1);
#endif
for (i=sucksect; i<numsectors-1; i++)
{
k = headspritesect[i+1];
@ -6563,11 +6732,13 @@ static int32_t deletesector(int16_t sucksect)
numsectors--;
for (i=startwall; i<=endwall; i++)
{
if (wall[i].nextwall >= 0)
{
NEXTWALL(i).nextwall = -1;
NEXTWALL(i).nextsector = -1;
}
}
movewalls(startwall, -j);
for (i=0; i<numwalls; i++)
@ -6930,11 +7101,22 @@ int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char
return oldnum;
}
static void getnumber_clearline(void)
{
char cbuf[128];
int32_t i;
for (i=0; i<min(xdim>>3, (signed)sizeof(cbuf)-1); i++)
cbuf[i] = ' ';
cbuf[i] = 0;
printext256(0, 0, whitecol, 0, cbuf, 0);
}
// sign: |16: don't draw scene
int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t))
{
char buffer[80], ch;
int32_t danum, oldnum;
uint8_t flags = (sign>>1)&3;
uint8_t flags = (sign>>1)&(3|8);
sign &= 1;
danum = num;
@ -6946,6 +7128,8 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha
if (handleevents())
quitevent = 0;
if ((flags&8)==0)
{
yax_preparedrawrooms();
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
yax_drawrooms(ExtAnalyzeSprites, horiz, cursectnum);
@ -6962,6 +7146,7 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha
drawmasks();
}
#endif
}
ch = bgetchar();
if (keystatus[0x1])
@ -6972,8 +7157,11 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha
searchx = osearchx;
searchy = osearchy;
if ((flags&8)==0)
ExtCheckKeys();
getnumber_clearline();
Bsprintf(buffer,"%s%d",namestart,danum);
if (totalclock & 32) Bstrcat(buffer,"_ ");
printmessage256(0, 0, buffer);
@ -6986,7 +7174,7 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha
showframe(1);
if (getnumber_internal1(ch, &danum, maxnumber, sign) ||
getnumber_autocomplete(namestart, ch, &danum, flags))
getnumber_autocomplete(namestart, ch, &danum, flags&(1+2)))
{
if (danum != oldnum)
asksave = 1;
@ -7041,14 +7229,7 @@ const char *getstring_simple(const char *querystr, const char *defaultstr, int32
while (1)
{
if (qsetmode==200)
{
char cbuf[128];
int32_t i;
for (i=0; i<min(xdim>>3, (signed)sizeof(cbuf)-1); i++)
cbuf[i] = ' ';
cbuf[i] = 0;
printext256(0, 0, whitecol, 0, cbuf, 0);
}
getnumber_clearline();
if (qsetmode==200)
printext256(0, 0, whitecol, 0, buf, 0);

View File

@ -188,16 +188,6 @@ int16_t editstatus = 0;
////////// YAX //////////
#ifdef YAX_DEBUG
extern char m32_debugstr[64][128];
extern int32_t m32_numdebuglines;
# define yaxdebug(fmt, ...) do { if (m32_numdebuglines<64) Bsnprintf(m32_debugstr[m32_numdebuglines++], 128, fmt, ##__VA_ARGS__); } while (0)
# define yaxprintf(fmt, ...) do { initprintf(fmt, ##__VA_ARGS__); } while (0)
#else
# define yaxdebug(fmt, ...)
# define yaxprintf(fmt, ...)
#endif
uint8_t graysectbitmap[MAXSECTORS>>3];
uint8_t graywallbitmap[MAXWALLS>>3];
int32_t autogray = 0;
@ -263,7 +253,7 @@ void yax_updategrays(int32_t posze)
// get/set functions!
static int32_t g_nodraw = 0;
static int32_t scansector_retfast = 0;
int32_t scansector_retfast = 0;
static int32_t scansector_collectsprites = 1;
static int32_t yax_globalcf = -1;
static int32_t yax_globallev = YAX_MAXDRAWS;
@ -317,11 +307,17 @@ void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum)
if (bunchnum<0)
{
int32_t j;
int16_t ynw;
// TODO: for in-game too?
for (j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
{
yax_setnextwall(j, YAX_CEILING, -1);
yax_setnextwall(j, YAX_FLOOR, -1);
ynw = yax_getnextwall(j, cf);
if (ynw >= 0)
{
yax_setnextwall(ynw, !cf, -1);
yax_setnextwall(j, cf, -1);
}
}
*(&sector[i].ceilingstat + cf) &= ~YAX_BIT;
@ -608,7 +604,12 @@ static void yax_scanbunches(int32_t bbeg, int32_t numhere, const uint8_t *lastgo
if (checkthisec)
{
numscans = numbunches = 0;
if (getrendermode()==0)
scansector(k);
#ifdef USE_OPENGL
else
polymost_scansector(k);
#endif
if (numbunches > 0)
{
bestsec = k;
@ -705,9 +706,10 @@ static void yax_copytsprite(int32_t curbunchnum, int32_t resetsortcnt)
}
}
void yax_preparedrawrooms(void)
{
if (getrendermode()!=0 || numyaxbunches==0)
if (getrendermode()==4 || numyaxbunches==0)
return;
g_nodraw = 1;
@ -745,7 +747,7 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
int32_t t;
#endif
if (getrendermode()!=0 || numyaxbunches==0)
if (getrendermode()==4 || numyaxbunches==0)
{
#ifdef ENGINE_SCREENSHOT_DEBUG
engine_screenshot = 0;
@ -872,13 +874,19 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
scansector_collectsprites = 0;
#ifdef ENGINE_CLEAR_SCREEN
if (rendmode==0)
if (getrendermode()==0)
{
begindrawing();
for (i=0; i<xdim*ydim; i++)
for (i=0; i<xdimen*ydimen; i++)
*((char *)frameplace + i) = i;
enddrawing();
}
#ifdef USE_OPENGL
else
{
bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
}
#endif
#endif
for (cf=0; cf<2; cf++)
@ -944,7 +952,7 @@ void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectn
#endif
#ifdef YAX_DEBUG_YMOSTS
if (rendmode==0)
if (getrendermode()==0)
{
begindrawing();
for (i=0; i<numyaxbunches; i++)
@ -2078,47 +2086,20 @@ static inline int32_t getpalookup(int32_t davis, int32_t dashade)
}
//
// scansector (internal)
//
static void scansector(int16_t sectnum)
// returns: 0=continue;
// 1=break;
int32_t engine_addtsprite(int16_t z, int16_t sectnum)
{
walltype *wal, *wal2;
spritetype *spr;
int32_t xs, ys, x1, y1, x2, y2, xp1, yp1, xp2=0, yp2=0, tempint;
int16_t z, zz, startwall, endwall, numscansbefore, scanfirst, bunchfrst;
int16_t nextsectnum;
spritetype *spr = &sprite[z];
#ifdef YAX_ENABLE
int16_t cb, fb, *sortcnt;
int32_t spheight, spzofs;
#endif
if (sectnum < 0) return;
// if (automapping) show2dsector[sectnum>>3] |= pow2char[sectnum&7];
sectorborder[0] = sectnum, sectorbordercnt = 1;
do
{
sectnum = sectorborder[--sectorbordercnt];
#ifdef YAX_ENABLE
if (scansector_collectsprites)
#endif
for (z=headspritesect[sectnum]; z>=0; z=nextspritesect[z])
{
spr = &sprite[z];
if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) &&
(spr->xrepeat > 0) && (spr->yrepeat > 0))
{
xs = spr->x-globalposx; ys = spr->y-globalposy;
if ((spr->cstat&48) || (xs*cosglobalang+ys*singlobalang > 0))
{
#ifdef YAX_ENABLE
if (g_nodraw==0)
{
#endif
if (spritesortcnt >= MAXSPRITESONSCREEN)
break;
return 1;
copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype));
spriteext[z].tspr = (spritetype *)&tsprite[spritesortcnt];
@ -2129,18 +2110,18 @@ static void scansector(int16_t sectnum)
{
sortcnt = &yax_spritesortcnt[yax_globallev];
if (*sortcnt >= MAXSPRITESONSCREEN)
break;
return 0;
yax_tsprite[yax_globallev][*sortcnt] = z;
(*sortcnt)++;
// now check whether the tsprite needs duplication into another level
if ((spr->cstat&48)==32)
continue;
return 0;
yax_getbunches(sectnum, &cb, &fb);
if (cb < 0 && fb < 0)
continue;
return 0;
spriteheightofs(z, &spheight, &spzofs);
@ -2165,7 +2146,42 @@ static void scansector(int16_t sectnum)
}
}
#endif
}
return 0;
}
//
// scansector (internal)
//
static void scansector(int16_t sectnum)
{
walltype *wal, *wal2;
spritetype *spr;
int32_t xs, ys, x1, y1, x2, y2, xp1, yp1, xp2=0, yp2=0, tempint;
int16_t z, zz, startwall, endwall, numscansbefore, scanfirst, bunchfrst;
int16_t nextsectnum;
if (sectnum < 0) return;
// if (automapping) show2dsector[sectnum>>3] |= pow2char[sectnum&7];
sectorborder[0] = sectnum, sectorbordercnt = 1;
do
{
sectnum = sectorborder[--sectorbordercnt];
#ifdef YAX_ENABLE
if (scansector_collectsprites)
#endif
for (z=headspritesect[sectnum]; z>=0; z=nextspritesect[z])
{
spr = &sprite[z];
if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) &&
(spr->xrepeat > 0) && (spr->yrepeat > 0))
{
xs = spr->x-globalposx; ys = spr->y-globalposy;
if ((spr->cstat&48) || (xs*cosglobalang+ys*singlobalang > 0))
if (engine_addtsprite(z, sectnum))
break;
}
}
@ -6979,6 +6995,19 @@ static void loadpalette(void)
kread(fil,palookup[globalpal],numpalookups<<8);
kread(fil,transluc,65536);
if (crc32once((uint8_t *)transluc, 65536)==0x94a1fac6)
{
int32_t i;
// fix up translucency table so that transluc(255,x)
// and transluc(x,255) is black instead of purple
for (i=0; i<256; i++)
{
transluc[(255<<8) + i] = transluc[i];
transluc[255 + (i<<8)] = transluc[i<<8];
}
}
kclose(fil);
initfastcolorlookup(30L,59L,11L);
@ -7676,7 +7705,7 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
if (!g_nodraw)
#endif
if (numyaxbunches==0)
for (i=0; i<xdim*ydim; i++)
for (i=0; i<xdimen*ydimen; i++)
*((char *)frameplace + i) = i;
#endif
@ -7948,7 +7977,7 @@ static inline int32_t sameside(_equation *eq, _point2d *p1, _point2d *p2
//
void drawmasks(void)
{
int32_t i, j, k, l, gap, xs, ys, xp, yp, yoff, yspan;
int32_t i, j, k, l, gap, xs, ys, xp, yp, yoff, yspan, modelp=0;
// PLAG: sorting stuff
_equation maskeq, p1eq, p2eq;
_point2d dot, dot2, middle, pos, spr;
@ -7966,6 +7995,9 @@ void drawmasks(void)
{
xs = tspriteptr[i]->x-globalposx; ys = tspriteptr[i]->y-globalposy;
yp = dmulscale6(xs,cosviewingrangeglobalang,ys,sinviewingrangeglobalang);
#ifdef USE_OPENGL
modelp = (usemodels && tile2model[tspriteptr[i]->picnum].modelid >= 0);
#endif
if (yp > (4<<8))
{
xp = dmulscale6(ys,cosglobalang,-xs,singlobalang);
@ -7975,6 +8007,8 @@ void drawmasks(void)
else if ((tspriteptr[i]->cstat&48) == 0)
{
killsprite:
if (!modelp)
{
spritesortcnt--; //Delete face sprite if on wrong side!
if (i == spritesortcnt) continue;
tspriteptr[i] = tspriteptr[spritesortcnt];
@ -7982,6 +8016,7 @@ killsprite:
spritesy[i] = spritesy[spritesortcnt];
continue;
}
}
spritesy[i] = yp;
}
@ -13725,7 +13760,7 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col)
}
}
#if 0
//
// qsetmode640350
//
@ -13787,7 +13822,7 @@ void qsetmode640480(void)
qsetmode = 480;
}
#endif
//
// qsetmodeany

View File

@ -70,6 +70,24 @@ extern palette_t palookupfog[MAXPALOOKUPS];
int32_t wallfront(int32_t l1, int32_t l2);
int32_t animateoffs(int16_t tilenum, int16_t fakevar);
////// yax'y stuff //////
#ifdef USE_OPENGL
extern void polymost_scansector(int32_t sectnum);
#endif
int32_t engine_addtsprite(int16_t z, int16_t sectnum);
int32_t scansector_retfast;
#ifdef YAX_DEBUG
extern char m32_debugstr[64][128];
extern int32_t m32_numdebuglines;
# define yaxdebug(fmt, ...) do { if (m32_numdebuglines<64) Bsnprintf(m32_debugstr[m32_numdebuglines++], 128, fmt, ##__VA_ARGS__); } while (0)
# define yaxprintf(fmt, ...) do { initprintf(fmt, ##__VA_ARGS__); } while (0)
#else
# define yaxdebug(fmt, ...)
# define yaxprintf(fmt, ...)
#endif
extern int32_t indrawroomsandmasks;

View File

@ -3066,7 +3066,7 @@ void domost(float x0, float y0, float x1, float y1)
}
}
static void polymost_scansector(int32_t sectnum);
void polymost_scansector(int32_t sectnum);
// variables that are set to ceiling- or floor-members, depending
// on which one is processed right now
@ -3219,6 +3219,10 @@ static void polymost_drawalls(int32_t bunch)
int32_t i, x, y, z, cz, fz, wallnum, sectnum, nextsectnum;
int32_t ypan,yoffs; // for panning correction
int16_t dapskybits;
static const int16_t zeropskyoff[MAXPSKYTILES];
const int16_t *dapskyoff;
sectnum = thesector[bunchfirst[bunch]]; sec = &sector[sectnum];
#if 0 // USE_OPENGL
@ -3289,17 +3293,36 @@ static void polymost_drawalls(int32_t bunch)
cy1 = ((float)(cz-globalposz))*ryp1 + ghoriz;
fy1 = ((float)(fz-globalposz))*ryp1 + ghoriz;
globalpicnum = sec->floorpicnum; globalshade = sec->floorshade; globalpal = (int32_t)((uint8_t)sec->floorpal);
globalorientation = sec->floorstat;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,sectnum);
// multi-psky stuff
dapskyoff = zeropskyoff;
dapskybits = pskybits;
for (i=0; i<pskynummultis; i++)
{
if (globalpicnum == pskymultilist[i])
{
dapskybits = pskymultibits[i];
dapskyoff = pskymultioff[i];
break;
}
}
//
global_cf_shade = sec->floorshade, global_cf_pal = sec->floorpal; global_cf_z = sec->floorz; // REFACT
global_cf_xpanning = sec->floorxpanning; global_cf_ypanning = sec->floorypanning, global_cf_heinum = sec->floorheinum;
global_getzofslope_func = &getflorzofslope;
if (!(globalorientation&1))
{
#ifdef YAX_ENABLE
if (globalposz <= sec->floorz || yax_getbunch(sectnum, YAX_FLOOR) < 0 || yax_getnextwall(wallnum, YAX_FLOOR) >= 0)
#endif
polymost_internal_nonparallaxed(nx0, ny0, nx1, ny1, ryp0, ryp1, x0, x1, fy0, fy1, 1, sectnum);
}
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1)))
{
//Parallaxing sky... hacked for Ken's mountain texture; paper-sky only :/
@ -3321,15 +3344,15 @@ static void polymost_drawalls(int32_t bunch)
}
//Use clamping for tiled sky textures
for (i=(1<<pskybits)-1; i>0; i--)
if (pskyoff[i] != pskyoff[i-1])
for (i=(1<<dapskybits)-1; i>0; i--)
if (dapskyoff[i] != dapskyoff[i-1])
{ skyclamphack = r_parallaxskyclamping; break; }
}
#endif
if (bpp == 8 || !usehightile || !hicfindsubst(globalpicnum,globalpal,1))
{
dd[0] = (float)xdimen*.0000001; //Adjust sky depth based on screen size!
t = (double)((1<<(picsiz[globalpicnum]&15))<<pskybits);
t = (double)((1<<(picsiz[globalpicnum]&15))<<dapskybits);
vv[1] = dd[0]*((double)xdimscale*(double)viewingrange)/(65536.0*65536.0);
vv[0] = dd[0]*((double)((tilesizy[globalpicnum]>>1)+parallaxyoffs)) - vv[1]*ghoriz;
i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i;
@ -3364,20 +3387,19 @@ static void polymost_drawalls(int32_t bunch)
i = globalpicnum; r = (fy1-fy0)/(x1-x0); //slope of line
oy = ((double)viewingrange)/(ghalfx*256.0); oz = 1/oy;
y = ((((int32_t)((x0-ghalfx)*oy))+globalang)>>(11-pskybits));
y = ((((int32_t)((x0-ghalfx)*oy))+globalang)>>(11-dapskybits));
fx = x0;
do
{
globalpicnum = pskyoff[y&((1<<pskybits)-1)]+i;
guo = gdo*(t*((double)(globalang-(y<<(11-pskybits))))/2048.0 + (double)((r_parallaxskypanning)?sec->floorxpanning:0)) - gux*ghalfx;
globalpicnum = dapskyoff[y&((1<<dapskybits)-1)]+i;
guo = gdo*(t*((double)(globalang-(y<<(11-dapskybits))))/2048.0 + (double)((r_parallaxskypanning)?sec->floorxpanning:0)) - gux*ghalfx;
y++;
ox = fx; fx = ((double)((y<<(11-pskybits))-globalang))*oz+ghalfx;
ox = fx; fx = ((double)((y<<(11-dapskybits))-globalang))*oz+ghalfx;
if (fx > x1) { fx = x1; i = -1; }
pow2xsplit = 0; domost(ox,(ox-x0)*r+fy0,fx,(fx-x0)*r+fy0); //flor
}
while (i >= 0);
}
else //NOTE: code copied from ceiling code... lots of duplicated stuff :/
{
@ -3567,12 +3589,32 @@ static void polymost_drawalls(int32_t bunch)
globalorientation = sec->ceilingstat;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,sectnum);
// multi-psky stuff
dapskyoff = zeropskyoff;
dapskybits = pskybits;
for (i=0; i<pskynummultis; i++)
{
if (globalpicnum == pskymultilist[i])
{
dapskybits = pskymultibits[i];
dapskyoff = pskymultioff[i];
break;
}
}
//
global_cf_shade = sec->ceilingshade, global_cf_pal = sec->ceilingpal; global_cf_z = sec->ceilingz; // REFACT
global_cf_xpanning = sec->ceilingxpanning; global_cf_ypanning = sec->ceilingypanning, global_cf_heinum = sec->ceilingheinum;
global_getzofslope_func = &getceilzofslope;
if (!(globalorientation&1))
{
#ifdef YAX_ENABLE
if (globalposz >= sec->ceilingz || yax_getbunch(sectnum, YAX_CEILING) < 0 || yax_getnextwall(wallnum, YAX_CEILING) >= 0)
#endif
polymost_internal_nonparallaxed(nx0, ny0, nx1, ny1, ryp0, ryp1, x0, x1, cy0, cy1, 0, sectnum);
}
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1)))
{
#ifdef USE_OPENGL
@ -3592,8 +3634,8 @@ static void polymost_drawalls(int32_t bunch)
bglFogfv(GL_FOG_COLOR,fogcol);
}
//Use clamping for tiled sky textures
for (i=(1<<pskybits)-1; i>0; i--)
if (pskyoff[i] != pskyoff[i-1])
for (i=(1<<dapskybits)-1; i>0; i--)
if (dapskyoff[i] != dapskyoff[i-1])
{ skyclamphack = r_parallaxskyclamping; break; }
}
#endif
@ -3602,7 +3644,7 @@ static void polymost_drawalls(int32_t bunch)
{
//Render for parallaxtype == 0 / paper-sky
dd[0] = (float)xdimen*.0000001; //Adjust sky depth based on screen size!
t = (double)((1<<(picsiz[globalpicnum]&15))<<pskybits);
t = (double)((1<<(picsiz[globalpicnum]&15))<<dapskybits);
vv[1] = dd[0]*((double)xdimscale*(double)viewingrange)/(65536.0*65536.0);
vv[0] = dd[0]*((double)((tilesizy[globalpicnum]>>1)+parallaxyoffs)) - vv[1]*ghoriz;
i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i;
@ -3636,14 +3678,14 @@ static void polymost_drawalls(int32_t bunch)
i = globalpicnum; r = (cy1-cy0)/(x1-x0); //slope of line
oy = ((double)viewingrange)/(ghalfx*256.0); oz = 1/oy;
y = ((((int32_t)((x0-ghalfx)*oy))+globalang)>>(11-pskybits));
y = ((((int32_t)((x0-ghalfx)*oy))+globalang)>>(11-dapskybits));
fx = x0;
do
{
globalpicnum = pskyoff[y&((1<<pskybits)-1)]+i;
guo = gdo*(t*((double)(globalang-(y<<(11-pskybits))))/2048.0 + (double)((r_parallaxskypanning)?sec->ceilingxpanning:0)) - gux*ghalfx;
globalpicnum = dapskyoff[y&((1<<dapskybits)-1)]+i;
guo = gdo*(t*((double)(globalang-(y<<(11-dapskybits))))/2048.0 + (double)((r_parallaxskypanning)?sec->ceilingxpanning:0)) - gux*ghalfx;
y++;
ox = fx; fx = ((double)((y<<(11-pskybits))-globalang))*oz+ghalfx;
ox = fx; fx = ((double)((y<<(11-dapskybits))-globalang))*oz+ghalfx;
if (fx > x1) { fx = x1; i = -1; }
pow2xsplit = 0; domost(fx,(fx-x0)*r+cy0,ox,(ox-x0)*r+cy0); //ceil
}
@ -4068,7 +4110,7 @@ static int32_t polymost_bunchfront(int32_t b1, int32_t b2)
return(wallfront(i,b2f));
}
static void polymost_scansector(int32_t sectnum)
void polymost_scansector(int32_t sectnum)
{
double d, xp1, yp1, xp2, yp2;
walltype *wal, *wal2;
@ -4088,15 +4130,13 @@ static void polymost_scansector(int32_t sectnum)
{
spr = &sprite[z];
if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) &&
(spr->xrepeat > 0) && (spr->yrepeat > 0) &&
(spritesortcnt < MAXSPRITESONSCREEN))
(spr->xrepeat > 0) && (spr->yrepeat > 0))
{
xs = spr->x-globalposx; ys = spr->y-globalposy;
if ((spr->cstat&48) || (xs*gcosang+ys*gsinang > 0))
if ((spr->cstat&48) || (xs*gcosang+ys*gsinang > 0) || (usemodels && tile2model[spr->picnum].modelid>=0))
{
copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype));
spriteext[z].tspr = (spritetype *)&tsprite[spritesortcnt];
tsprite[spritesortcnt++].owner = z;
if (engine_addtsprite(z, sectnum))
break;
}
}
}
@ -4119,7 +4159,7 @@ static void polymost_scansector(int32_t sectnum)
if ((nextsectnum >= 0) && (!(wal->cstat&32)) && (!(gotsector[nextsectnum>>3]&pow2char[nextsectnum&7])))
{
d = (double)x1*(double)y2 - (double)x2*(double)y1; xp1 = (double)(x2-x1); yp1 = (double)(y2-y1);
if (d *d <= (xp1*xp1 + yp1*yp1)*(SCISDIST*SCISDIST*260.0))
if (d*d <= (xp1*xp1 + yp1*yp1)*(SCISDIST*SCISDIST*260.0))
sectorborder[sectorbordercnt++] = nextsectnum;
}
@ -4152,7 +4192,13 @@ static void polymost_scansector(int32_t sectnum)
for (z=numscansbefore; z<numscans; z++)
if ((wall[thewall[z]].point2 != thewall[p2[z]]) || (dxb2[z] > dxb1[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++)
{

View File

@ -3861,50 +3861,10 @@ static int32_t OnSaveTileGroup(void)
static int32_t OnGotoTile(int32_t iTile)
{
int32_t iTemp, iNewTile;
char ch;
char szTemp[128];
//Automatically press 'V'
iTile = SelectAllTiles(iTile);
bflushchars();
iNewTile = iTemp = 0; //iTile; //PK
while (keystatus[KEYSC_ESC] == 0)
{
if (handleevents())
quitevent = 0;
idle_waitevent();
ch = bgetchar();
Bsprintf(szTemp, "Goto tile: %d_ ", iNewTile);
printext256(0, 0, whitecol, 0, szTemp, 0);
showframe(1);
if (ch >= '0' && ch <= '9')
{
iTemp = (iNewTile*10) + (ch-'0');
if (iTemp < MAXTILES)
iNewTile = iTemp;
}
else if (ch == 8)
{
iNewTile /= 10;
}
else if (ch == 13)
{
iTile = iNewTile;
break;
}
}
clearkeys();
return iTile;
return getnumber256("Goto tile: ", 0, MAXTILES-1, 0+2+16);
}
@ -7923,14 +7883,14 @@ static void Keys2d(void)
j = 0;
x = wall[sector[i].wallptr].x;
y = wall[sector[i].wallptr].y;
z = sector[i].floorz;
z = getflorzofslope(i, x, y);
break;
case CORRUPT_WALL:
i = k&(MAXWALLS-1);
j = 1;
x = wall[i].x;
y = wall[i].y;
z = sector[sectorofwall(i)].floorz;
z = getflorzofslope(sectorofwall(i), x, y);
break;
case CORRUPT_SPRITE:
i = k&(MAXSPRITES-1);

View File

@ -750,7 +750,7 @@ int32_t CONFIG_ReadSetup(void)
Bsprintf(buf,"WeaponChoice%d",i);
dummy = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", buf, &dummy);
if (dummy >= 0) g_player[0].wchoice[i] = dummy;
if (dummy >= 0 && dummy<10) g_player[0].wchoice[i] = dummy;
}
#ifdef _WIN32

View File

@ -2533,6 +2533,27 @@ static void G_ShowScores(void)
}
#undef SCORESHEETOFFSET
#ifdef YAX_DEBUG
// ugh...
char m32_debugstr[64][128];
int32_t m32_numdebuglines=0;
static void M32_drawdebug(void)
{
int i, col=getclosestcol(63,63,63);
int x=4, y=8;
if (m32_numdebuglines>0)
{
begindrawing();
for (i=0; i<m32_numdebuglines && y<ydim-8; i++, y+=8)
printext256(x,y,col,0,m32_debugstr[i],xdim>640?0:1);
enddrawing();
}
m32_numdebuglines=0;
}
#endif
void G_DisplayRest(int32_t smoothratio)
{
int32_t a, i, j;
@ -2800,6 +2821,10 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.coords)
G_PrintCoords(screenpeek);
#ifdef YAX_DEBUG
M32_drawdebug();
#endif
#ifdef USE_OPENGL
{
extern int32_t mdpause;
@ -3473,10 +3498,17 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
j = visibility;
visibility = (j>>1) + (j>>2);
if (getrendermode()==0)
{
yax_preparedrawrooms();
drawrooms(tposx,tposy,ud.camera.z,tang,ud.camerahoriz,g_mirrorSector[i]+MAXSECTORS);
g_yax_smoothratio = smoothratio;
yax_drawrooms(G_AnalyzeSprites, ud.camerahoriz, g_mirrorSector[i]+MAXSECTORS);
}
#ifdef USE_OPENGL
else
drawrooms(tposx,tposy,ud.camera.z,tang,ud.camerahoriz,g_mirrorSector[i]+MAXSECTORS);
#endif
display_mirror = 1;
G_DoSpriteAnimations(tposx,tposy,tang,smoothratio);

View File

@ -1856,7 +1856,7 @@ static int32_t C_CountCaseStatements()
static int32_t C_ParseCommand(int32_t loop)
{
int32_t i, j=0, k=0, done, tw, otw;
int32_t i, j=0, k=0, tw, otw;
char *temptextptr;
intptr_t *tempscrptr = NULL;

View File

@ -496,6 +496,10 @@ const memberlabel_t SpriteLabels[]=
{ "", -1, 0, 0, 0 } // END OF LIST
};
#ifndef POLYMER
# define PR_MAXLIGHTPRIORITY 6
#endif
const memberlabel_t LightLabels[]=
{
{ "x", LIGHT_X, 0, -BXY_MAX, BXY_MAX },
@ -1103,9 +1107,7 @@ static void C_GetNextVarType(int32_t type)
if (*textptr == '[') //read of array as a gamevar
{
int32_t lLabelID = -1, aridx;
#ifdef POLYMER
int32_t lightp = 0;
#endif
textptr++;
flags |= M32_FLAG_ARRAY;

View File

@ -5355,11 +5355,7 @@ HORIZONLY:
{
p->pos.x += p->vel.x>>14;
p->pos.y += p->vel.y>>14;
#ifdef YAX_ENABLE
updatesectorz(p->pos.x,p->pos.y,p->pos.z,&p->cursectnum);
#else
updatesector(p->pos.x,p->pos.y,&p->cursectnum);
#endif
changespritesect(p->i,p->cursectnum);
}
else