mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Oops, r1801 crashed Mapster in the undo system. Also less/better automatic wall[].xrepeat resizing on things like attaching a wall to another.
git-svn-id: https://svn.eduke32.com/eduke32@1803 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
043bb208b3
commit
73d6ad1d04
5 changed files with 109 additions and 97 deletions
|
@ -85,6 +85,10 @@ extern inline int32_t getscreenvdisp(int32_t bz, int32_t zoome);
|
|||
extern void setup_sideview_sincos(void);
|
||||
extern void m32_setkeyfilter(int32_t on);
|
||||
|
||||
extern int32_t wallength(int16_t i);
|
||||
extern void fixrepeats(int16_t i);
|
||||
extern void fixxrepeat(int16_t i, uint32_t lenrepquot);
|
||||
|
||||
extern int32_t ExtInit(void);
|
||||
extern int32_t ExtPreInit(int32_t argc,const char **argv);
|
||||
extern void ExtUnInit(void);
|
||||
|
@ -175,21 +179,6 @@ void test_map(int32_t mode);
|
|||
#define POINT2(i) (wall[wall[i].point2])
|
||||
#define SPRITESEC(j) (sector[sprite[j].sectnum])
|
||||
|
||||
static inline int32_t wallength(int16_t i)
|
||||
{
|
||||
int64_t dax = POINT2(i).x - wall[i].x;
|
||||
int64_t day = POINT2(i).y - wall[i].y;
|
||||
#if 1 //def POLYMOST
|
||||
int64_t hypsq = dax*dax + day*day;
|
||||
if (hypsq > (int64_t)INT_MAX)
|
||||
return (int32_t)sqrt((double)hypsq);
|
||||
else
|
||||
return ksqrt((int32_t)hypsq);
|
||||
#else
|
||||
return ksqrt(dax*dax + day*day);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define CLEARLINES2D(Startline, Numlines, Color) clearbuf((char *)(frameplace + ((Startline)*bytesperline)), (bytesperline*(Numlines))>>2, (Color))
|
||||
|
||||
#define SCRIPTHISTSIZ 32 // should be the same as OSD_HISTORYDEPTH for maximum win, should be a power of two
|
||||
|
|
|
@ -1380,7 +1380,7 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo)
|
|||
for (i=numwalls; i<newnumwalls; i++)
|
||||
{
|
||||
wall[i].point2 += numwalls;
|
||||
wall[i].x += editorgridextent<<2;
|
||||
wall[i].x += BXY_MAX*2;
|
||||
}
|
||||
|
||||
// reconstruct wall connections
|
||||
|
@ -1394,7 +1394,7 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo)
|
|||
hlsectorbitmap[i>>3] |= (1<<(i&7));
|
||||
}
|
||||
for (i=numwalls; i<newnumwalls; i++)
|
||||
wall[i].x -= editorgridextent<<2;
|
||||
wall[i].x -= BXY_MAX*2;
|
||||
// checksectorpointer_warn = 1;
|
||||
|
||||
// insert sprites
|
||||
|
@ -3026,7 +3026,7 @@ outtathis:
|
|||
if (((bstatus&1) < (oldmousebstatus&1)) && highlightsectorcnt < 0) //after dragging
|
||||
{
|
||||
int32_t wallsdrawn = newnumwalls-numwalls, runi;
|
||||
walltype *tmpwall;
|
||||
walltype *tmpwall = NULL;
|
||||
|
||||
if (newnumwalls != -1)
|
||||
{
|
||||
|
@ -3103,7 +3103,7 @@ outtathis:
|
|||
|| (POINT2(i).x == dax && POINT2(i).y == day))
|
||||
{
|
||||
checksectorpointer(i, sectorofwall(i));
|
||||
fixrepeats(i);
|
||||
// fixrepeats(i);
|
||||
asksave = 1;
|
||||
}
|
||||
}
|
||||
|
@ -4658,7 +4658,7 @@ end_space_handling:
|
|||
if ((wall[i].x == dax && wall[i].y == day) || (POINT2(i).x == dax && POINT2(i).y == day))
|
||||
{
|
||||
checksectorpointer(i, sectorofwall(i));
|
||||
fixrepeats(i);
|
||||
// fixrepeats(i);
|
||||
}
|
||||
}
|
||||
//if (j != 0)
|
||||
|
@ -5480,22 +5480,25 @@ static void insertpoint(int16_t linehighlight, int32_t dax, int32_t day)
|
|||
{
|
||||
int16_t sucksect;
|
||||
int32_t i, j, k;
|
||||
uint32_t templenrepquot;
|
||||
|
||||
j = linehighlight;
|
||||
sucksect = sectorofwall(j);
|
||||
templenrepquot = divscale12(wallength(j), wall[j].xrepeat);
|
||||
templenrepquot = max(1, templenrepquot);
|
||||
|
||||
sector[sucksect].wallnum++;
|
||||
for (i=sucksect+1; i<numsectors; i++)
|
||||
sector[i].wallptr++;
|
||||
|
||||
movewalls(j+1, +1);
|
||||
Bmemcpy(&wall[j+1],&wall[j],sizeof(walltype));
|
||||
Bmemcpy(&wall[j+1], &wall[j], sizeof(walltype));
|
||||
|
||||
wall[j].point2 = j+1;
|
||||
wall[j+1].x = dax;
|
||||
wall[j+1].y = day;
|
||||
fixrepeats(j);
|
||||
fixrepeats(j+1);
|
||||
fixxrepeat(j, templenrepquot);
|
||||
fixxrepeat(j+1, templenrepquot);
|
||||
|
||||
if (wall[j].nextwall >= 0)
|
||||
{
|
||||
|
@ -5513,8 +5516,8 @@ static void insertpoint(int16_t linehighlight, int32_t dax, int32_t day)
|
|||
wall[k].point2 = k+1;
|
||||
wall[k+1].x = dax;
|
||||
wall[k+1].y = day;
|
||||
fixrepeats(k);
|
||||
fixrepeats(k+1);
|
||||
fixxrepeat(k, templenrepquot);
|
||||
fixxrepeat(k+1, templenrepquot);
|
||||
|
||||
j = wall[k].nextwall;
|
||||
wall[j].nextwall = k+1;
|
||||
|
@ -5651,6 +5654,21 @@ static int32_t movewalls(int32_t start, int32_t offs)
|
|||
return(0);
|
||||
}
|
||||
|
||||
int32_t wallength(int16_t i)
|
||||
{
|
||||
int64_t dax = POINT2(i).x - wall[i].x;
|
||||
int64_t day = POINT2(i).y - wall[i].y;
|
||||
#if 1 //def POLYMOST
|
||||
int64_t hypsq = dax*dax + day*day;
|
||||
if (hypsq > (int64_t)INT_MAX)
|
||||
return (int32_t)sqrt((double)hypsq);
|
||||
else
|
||||
return ksqrt((int32_t)hypsq);
|
||||
#else
|
||||
return ksqrt(dax*dax + day*day);
|
||||
#endif
|
||||
}
|
||||
|
||||
void fixrepeats(int16_t i)
|
||||
{
|
||||
int32_t dist = wallength(i);
|
||||
|
@ -5659,6 +5677,12 @@ void fixrepeats(int16_t i)
|
|||
wall[i].xrepeat = clamp(mulscale10(dist,day), 1, 255);
|
||||
}
|
||||
|
||||
void fixxrepeat(int16_t i, uint32_t lenrepquot) // lenrepquot: divscale12(wallength,xrepeat)
|
||||
{
|
||||
if (lenrepquot != 0)
|
||||
wall[i].xrepeat = clamp(divscale12(wallength(i), lenrepquot), 1, 255);
|
||||
}
|
||||
|
||||
|
||||
int32_t overridepm16y = -1;
|
||||
|
||||
|
|
|
@ -9848,7 +9848,7 @@ static void addclipline(int32_t dax1, int32_t day1, int32_t dax2, int32_t day2,
|
|||
//
|
||||
// clipmove
|
||||
//
|
||||
int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
||||
int32_t clipmove(vec3_t *pos, int16_t *sectnum,
|
||||
int32_t xvect, int32_t yvect,
|
||||
int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype)
|
||||
{
|
||||
|
@ -9874,16 +9874,16 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
oxvect = xvect;
|
||||
oyvect = yvect;
|
||||
|
||||
goalx = (vect->x) + (xvect>>14);
|
||||
goaly = (vect->y) + (yvect>>14);
|
||||
goalx = pos->x + (xvect>>14);
|
||||
goaly = pos->y + (yvect>>14);
|
||||
|
||||
|
||||
clipnum = 0;
|
||||
|
||||
cx = (((vect->x)+goalx)>>1);
|
||||
cy = (((vect->y)+goaly)>>1);
|
||||
cx = (pos->x+goalx)>>1;
|
||||
cy = (pos->y+goaly)>>1;
|
||||
//Extra walldist for sprites on sector lines
|
||||
gx = goalx-(vect->x); gy = goaly-(vect->y);
|
||||
gx = goalx-(pos->x); gy = goaly-(pos->y);
|
||||
rad = nsqrtasm(gx*gx + gy*gy) + MAXCLIPDIST+walldist + 8;
|
||||
xmin = cx-rad; ymin = cy-rad;
|
||||
xmax = cx+rad; ymax = cy+rad;
|
||||
|
@ -9928,7 +9928,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
continue;
|
||||
}
|
||||
|
||||
clipsprite_initindex(curidx, curspr, &clipsectcnt, vect);
|
||||
clipsprite_initindex(curidx, curspr, &clipsectcnt, pos);
|
||||
}
|
||||
|
||||
|
||||
|
@ -9949,7 +9949,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y;
|
||||
|
||||
dx = x2-x1; dy = y2-y1;
|
||||
if (dx*((vect->y)-y1) < ((vect->x)-x1)*dy) continue; //If wall's not facing you
|
||||
if (dx*((pos->y)-y1) < ((pos->x)-x1)*dy) continue; //If wall's not facing you
|
||||
|
||||
if (dx > 0) dax = dx*(ymin-y1); else dax = dx*(ymax-y1);
|
||||
if (dy > 0) day = dy*(xmax-x1); else day = dy*(xmin-x1);
|
||||
|
@ -9962,25 +9962,25 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
{
|
||||
int32_t basez;
|
||||
|
||||
if (rintersect(vect->x,vect->y,0, gx,gy,0, x1,y1, x2,y2, &dax,&day,&daz) == 0)
|
||||
dax = vect->x, day = vect->y;
|
||||
daz = getflorzofslope((int16_t)dasect,dax,day);
|
||||
daz2 = getflorzofslope(wal->nextsector,dax,day);
|
||||
basez = getflorzofslope(sectq[clipinfo[curidx].qend],dax,day);
|
||||
if (rintersect(pos->x,pos->y,0, gx,gy,0, x1,y1, x2,y2, &dax,&day,&daz) == 0)
|
||||
dax = pos->x, day = pos->y;
|
||||
daz = getflorzofslope(dasect, dax,day);
|
||||
daz2 = getflorzofslope(wal->nextsector, dax,day);
|
||||
basez = getflorzofslope(sectq[clipinfo[curidx].qend], dax,day);
|
||||
|
||||
sec2 = §or[wal->nextsector];
|
||||
if ((sec2->floorstat&1) == 0)
|
||||
// if (dasect==sectq[clipinfo[curidx].qend] || daz2 < daz-(1<<8))
|
||||
if (daz2-(flordist-1) <= vect->z && vect->z <= basez+(flordist-1))
|
||||
if (daz2-(flordist-1) <= pos->z && pos->z <= basez+(flordist-1))
|
||||
clipyou = 1;
|
||||
if (clipyou == 0)
|
||||
{
|
||||
daz = getceilzofslope((int16_t)dasect,dax,day);
|
||||
daz2 = getceilzofslope(wal->nextsector,dax,day);
|
||||
basez = getceilzofslope(sectq[clipinfo[curidx].qend],dax,day);
|
||||
daz = getceilzofslope(dasect, dax,day);
|
||||
daz2 = getceilzofslope(wal->nextsector, dax,day);
|
||||
basez = getceilzofslope(sectq[clipinfo[curidx].qend], dax,day);
|
||||
if ((sec2->ceilingstat&1) == 0)
|
||||
// if (dasect==sectq[clipinfo[curidx].qend] || daz2 > daz+(1<<8))
|
||||
if (basez-(ceildist-1) <= vect->z && vect->z <= daz2+(ceildist-1))
|
||||
if (basez-(ceildist-1) <= pos->z && pos->z <= daz2+(ceildist-1))
|
||||
clipyou = 1;
|
||||
}
|
||||
}
|
||||
|
@ -9988,22 +9988,22 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
else if ((wal->nextsector < 0) || (wal->cstat&dawalclipmask)) clipyou = 1;
|
||||
else if (editstatus == 0)
|
||||
{
|
||||
if (rintersect(vect->x,vect->y,0,gx,gy,0,x1,y1,x2,y2,&dax,&day,&daz) == 0)
|
||||
dax = vect->x, day = vect->y;
|
||||
daz = getflorzofslope((int16_t)dasect,dax,day);
|
||||
daz2 = getflorzofslope(wal->nextsector,dax,day);
|
||||
if (rintersect(pos->x,pos->y,0,gx,gy,0,x1,y1,x2,y2,&dax,&day,&daz) == 0)
|
||||
dax = pos->x, day = pos->y;
|
||||
daz = getflorzofslope(dasect, dax,day);
|
||||
daz2 = getflorzofslope(wal->nextsector, dax,day);
|
||||
|
||||
sec2 = §or[wal->nextsector];
|
||||
if (daz2 < daz-(1<<8))
|
||||
if ((sec2->floorstat&1) == 0)
|
||||
if ((vect->z) >= daz2-(flordist-1)) clipyou = 1;
|
||||
if ((pos->z) >= daz2-(flordist-1)) clipyou = 1;
|
||||
if (clipyou == 0)
|
||||
{
|
||||
daz = getceilzofslope((int16_t)dasect,dax,day);
|
||||
daz2 = getceilzofslope(wal->nextsector,dax,day);
|
||||
daz = getceilzofslope(dasect, dax,day);
|
||||
daz2 = getceilzofslope(wal->nextsector, dax,day);
|
||||
if (daz2 > daz+(1<<8))
|
||||
if ((sec2->ceilingstat&1) == 0)
|
||||
if ((vect->z) <= daz2+(ceildist-1)) clipyou = 1;
|
||||
if ((pos->z) <= daz2+(ceildist-1)) clipyou = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10017,15 +10017,15 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
|
||||
//Add 2 boxes at endpoints
|
||||
bsz = walldist; if (gx < 0) bsz = -bsz;
|
||||
addclipline(x1-bsz,y1-bsz,x1-bsz,y1+bsz,objtype);
|
||||
addclipline(x2-bsz,y2-bsz,x2-bsz,y2+bsz,objtype);
|
||||
addclipline(x1-bsz,y1-bsz, x1-bsz,y1+bsz, objtype);
|
||||
addclipline(x2-bsz,y2-bsz, x2-bsz,y2+bsz, objtype);
|
||||
bsz = walldist; if (gy < 0) bsz = -bsz;
|
||||
addclipline(x1+bsz,y1-bsz,x1-bsz,y1-bsz,objtype);
|
||||
addclipline(x2+bsz,y2-bsz,x2-bsz,y2-bsz,objtype);
|
||||
addclipline(x1+bsz,y1-bsz, x1-bsz,y1-bsz, objtype);
|
||||
addclipline(x2+bsz,y2-bsz, x2-bsz,y2-bsz, objtype);
|
||||
|
||||
dax = walldist; if (dy > 0) dax = -dax;
|
||||
day = walldist; if (dx < 0) day = -day;
|
||||
addclipline(x1+dax,y1+day,x2+dax,y2+day,objtype);
|
||||
addclipline(x1+dax,y1+day, x2+dax,y2+day, objtype);
|
||||
}
|
||||
else if (wal->nextsector>=0)
|
||||
{
|
||||
|
@ -10057,7 +10057,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
|
||||
if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z;
|
||||
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
|
||||
if (((vect->z) < daz+ceildist) && ((vect->z) > daz-k-flordist))
|
||||
if (((pos->z) < daz+ceildist) && ((pos->z) > daz-k-flordist))
|
||||
{
|
||||
bsz = (spr->clipdist<<2)+walldist; if (gx < 0) bsz = -bsz;
|
||||
addclipline(x1-bsz,y1-bsz,x1-bsz,y1+bsz,(int16_t)j+49152);
|
||||
|
@ -10072,7 +10072,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
|
||||
daz2 = daz-k;
|
||||
daz += ceildist; daz2 -= flordist;
|
||||
if (((vect->z) < daz) && ((vect->z) > daz2))
|
||||
if (((pos->z) < daz) && ((pos->z) > daz2))
|
||||
{
|
||||
//These lines get the 2 points of the rotated sprite
|
||||
//Given: (x1, y1) starts out as the center point
|
||||
|
@ -10089,7 +10089,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
dax = mulscale14(sintable[(spr->ang+256+512)&2047],walldist);
|
||||
day = mulscale14(sintable[(spr->ang+256)&2047],walldist);
|
||||
|
||||
if ((x1-(vect->x))*(y2-(vect->y)) >= (x2-(vect->x))*(y1-(vect->y))) //Front
|
||||
if ((x1-(pos->x))*(y2-(pos->y)) >= (x2-(pos->x))*(y1-(pos->y))) //Front
|
||||
{
|
||||
addclipline(x1+dax,y1+day,x2+day,y2-dax,(int16_t)j+49152);
|
||||
}
|
||||
|
@ -10100,9 +10100,9 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
}
|
||||
|
||||
//Side blocker
|
||||
if ((x2-x1)*((vect->x)-x1) + (y2-y1)*((vect->y)-y1) < 0)
|
||||
if ((x2-x1)*((pos->x)-x1) + (y2-y1)*((pos->y)-y1) < 0)
|
||||
{ addclipline(x1-day,y1+dax,x1+dax,y1+day,(int16_t)j+49152); }
|
||||
else if ((x1-x2)*((vect->x)-x2) + (y1-y2)*((vect->y)-y2) < 0)
|
||||
else if ((x1-x2)*((pos->x)-x2) + (y1-y2)*((pos->y)-y2) < 0)
|
||||
{ addclipline(x2+day,y2-dax,x2-dax,y2-day,(int16_t)j+49152); }
|
||||
}
|
||||
}
|
||||
|
@ -10110,10 +10110,10 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
case 32:
|
||||
daz = spr->z+ceildist;
|
||||
daz2 = spr->z-flordist;
|
||||
if (((vect->z) < daz) && ((vect->z) > daz2))
|
||||
if (((pos->z) < daz) && ((pos->z) > daz2))
|
||||
{
|
||||
if ((cstat&64) != 0)
|
||||
if (((vect->z) > spr->z) == ((cstat&8)==0)) continue;
|
||||
if (((pos->z) > spr->z) == ((cstat&8)==0)) continue;
|
||||
|
||||
tilenum = spr->picnum;
|
||||
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
|
||||
|
@ -10139,23 +10139,23 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist);
|
||||
day = mulscale14(sintable[(spr->ang-256)&2047],walldist);
|
||||
|
||||
if ((rxi[0]-(vect->x))*(ryi[1]-(vect->y)) < (rxi[1]-(vect->x))*(ryi[0]-(vect->y)))
|
||||
if ((rxi[0]-(pos->x))*(ryi[1]-(pos->y)) < (rxi[1]-(pos->x))*(ryi[0]-(pos->y)))
|
||||
{
|
||||
if (clipinsideboxline(cx,cy,rxi[1],ryi[1],rxi[0],ryi[0],rad) != 0)
|
||||
addclipline(rxi[1]-day,ryi[1]+dax,rxi[0]+dax,ryi[0]+day,(int16_t)j+49152);
|
||||
}
|
||||
else if ((rxi[2]-(vect->x))*(ryi[3]-(vect->y)) < (rxi[3]-(vect->x))*(ryi[2]-(vect->y)))
|
||||
else if ((rxi[2]-(pos->x))*(ryi[3]-(pos->y)) < (rxi[3]-(pos->x))*(ryi[2]-(pos->y)))
|
||||
{
|
||||
if (clipinsideboxline(cx,cy,rxi[3],ryi[3],rxi[2],ryi[2],rad) != 0)
|
||||
addclipline(rxi[3]+day,ryi[3]-dax,rxi[2]-dax,ryi[2]-day,(int16_t)j+49152);
|
||||
}
|
||||
|
||||
if ((rxi[1]-(vect->x))*(ryi[2]-(vect->y)) < (rxi[2]-(vect->x))*(ryi[1]-(vect->y)))
|
||||
if ((rxi[1]-(pos->x))*(ryi[2]-(pos->y)) < (rxi[2]-(pos->x))*(ryi[1]-(pos->y)))
|
||||
{
|
||||
if (clipinsideboxline(cx,cy,rxi[2],ryi[2],rxi[1],ryi[1],rad) != 0)
|
||||
addclipline(rxi[2]-dax,ryi[2]-day,rxi[1]-day,ryi[1]+dax,(int16_t)j+49152);
|
||||
}
|
||||
else if ((rxi[3]-(vect->x))*(ryi[0]-(vect->y)) < (rxi[0]-(vect->x))*(ryi[3]-(vect->y)))
|
||||
else if ((rxi[3]-(pos->x))*(ryi[0]-(pos->y)) < (rxi[0]-(pos->x))*(ryi[3]-(pos->y)))
|
||||
{
|
||||
if (clipinsideboxline(cx,cy,rxi[0],ryi[0],rxi[3],ryi[3],rad) != 0)
|
||||
addclipline(rxi[0]+dax,ryi[0]+day,rxi[3]+day,ryi[3]-dax,(int16_t)j+49152);
|
||||
|
@ -10181,7 +10181,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
do
|
||||
{
|
||||
intx = goalx; inty = goaly;
|
||||
hitwall = raytrace(vect->x, vect->y, &intx, &inty);
|
||||
hitwall = raytrace(pos->x, pos->y, &intx, &inty);
|
||||
if (hitwall >= 0)
|
||||
{
|
||||
lx = clipit[hitwall].x2-clipit[hitwall].x1;
|
||||
|
@ -10198,6 +10198,8 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
goalx = mulscale20(lx,i)+intx;
|
||||
goaly = mulscale20(ly,i)+inty;
|
||||
}
|
||||
// else if (tempint2<0)
|
||||
// Bprintf("!! tempint2<0 !!\n");
|
||||
|
||||
tempint1 = dmulscale6(lx,oxvect,ly,oyvect);
|
||||
for (i=cnt+1; i<=clipmoveboxtracenum; i++)
|
||||
|
@ -10206,7 +10208,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
tempint2 = dmulscale6(clipit[j].x2-clipit[j].x1,oxvect,clipit[j].y2-clipit[j].y1,oyvect);
|
||||
if ((tempint1^tempint2) < 0)
|
||||
{
|
||||
updatesector(vect->x,vect->y,sectnum);
|
||||
updatesector(pos->x,pos->y,sectnum);
|
||||
return(retval);
|
||||
}
|
||||
}
|
||||
|
@ -10220,13 +10222,13 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
}
|
||||
cnt--;
|
||||
|
||||
vect->x = intx;
|
||||
vect->y = inty;
|
||||
pos->x = intx;
|
||||
pos->y = inty;
|
||||
}
|
||||
while (((xvect|yvect) != 0) && (hitwall >= 0) && (cnt > 0));
|
||||
|
||||
for (j=0; j<clipsectnum; j++)
|
||||
if (inside(vect->x,vect->y,clipsectorlist[j]) == 1)
|
||||
if (inside(pos->x,pos->y,clipsectorlist[j]) == 1)
|
||||
{
|
||||
*sectnum = clipsectorlist[j];
|
||||
return(retval);
|
||||
|
@ -10234,12 +10236,12 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
|
||||
*sectnum = -1; tempint1 = 0x7fffffff;
|
||||
for (j=numsectors-1; j>=0; j--)
|
||||
if (inside(vect->x,vect->y,j) == 1)
|
||||
if (inside(pos->x,pos->y,j) == 1)
|
||||
{
|
||||
if (sector[j].ceilingstat&2)
|
||||
tempint2 = (getceilzofslope((int16_t)j,vect->x,vect->y)-(vect->z));
|
||||
tempint2 = (getceilzofslope((int16_t)j,pos->x,pos->y)-(pos->z));
|
||||
else
|
||||
tempint2 = (sector[j].ceilingz-(vect->z));
|
||||
tempint2 = (sector[j].ceilingz-(pos->z));
|
||||
|
||||
if (tempint2 > 0)
|
||||
{
|
||||
|
@ -10249,9 +10251,9 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
|||
else
|
||||
{
|
||||
if (sector[j].floorstat&2)
|
||||
tempint2 = ((vect->z)-getflorzofslope((int16_t)j,vect->x,vect->y));
|
||||
tempint2 = ((pos->z)-getflorzofslope((int16_t)j,pos->x,pos->y));
|
||||
else
|
||||
tempint2 = ((vect->z)-sector[j].floorz);
|
||||
tempint2 = ((pos->z)-sector[j].floorz);
|
||||
|
||||
if (tempint2 <= 0)
|
||||
{
|
||||
|
|
|
@ -105,12 +105,7 @@ static int32_t curcorruptthing=-1;
|
|||
|
||||
int32_t corruptlevel=0, numcorruptthings=0, corruptthings[MAXCORRUPTTHINGS];
|
||||
|
||||
static uint32_t templenrepquot;
|
||||
static void fixxrepeat(int16_t i, uint32_t lenrepquot)
|
||||
{
|
||||
if (lenrepquot != 0)
|
||||
wall[i].xrepeat = clamp(divscale12(wallength(i), lenrepquot), 1, 255);
|
||||
}
|
||||
static uint32_t templenrepquot=1;
|
||||
|
||||
//////////////////// Key stuff ////////////////////
|
||||
|
||||
|
@ -384,20 +379,21 @@ void create_map_snapshot(void)
|
|||
else
|
||||
{
|
||||
int32_t i = 0;
|
||||
spritetype *tspri = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites),
|
||||
spritetype *tspri = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites + 1),
|
||||
*spri = &tspri[0];
|
||||
mapstate->sprites = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites);
|
||||
mapstate->sprites = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites + QADDNSZ);
|
||||
|
||||
for (j=0; j<MAXSPRITES && i < numsprites; j++)
|
||||
{
|
||||
if (sprite[j].statnum != MAXSTATUS)
|
||||
{
|
||||
Bmemcpy(spri++,&sprite[j],sizeof(spritetype));
|
||||
Bmemcpy(spri++, &sprite[j], sizeof(spritetype));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
mapstate->spritesiz = j = qlz_compress(&tspri[0], (char *)&mapstate->sprites[0],
|
||||
sizeof(spritetype) * numsprites + QADDNSZ, state_compress);
|
||||
sizeof(spritetype) * numsprites, state_compress);
|
||||
mapstate->sprites = (spritetype *)Brealloc(mapstate->sprites, j);
|
||||
mapstate->spritecrc = tempcrc;
|
||||
Bfree(tspri);
|
||||
|
@ -5182,8 +5178,7 @@ static void Keys3d(void)
|
|||
|
||||
for (j=0; j<(k?k:1); j++, sect=highlightsector[j])
|
||||
{
|
||||
i = headspritesect[sect];
|
||||
while (i != -1)
|
||||
for (i=headspritesect[sect]; i!=-1; i=nextspritesect[i])
|
||||
{
|
||||
tempint = getceilzofslope(sect, sprite[i].x, sprite[i].y);
|
||||
tempint += (tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2;
|
||||
|
@ -5193,8 +5188,6 @@ static void Keys3d(void)
|
|||
|
||||
if (sprite[i].z == tempint)
|
||||
sprite[i].z += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128
|
||||
|
||||
i = nextspritesect[i];
|
||||
}
|
||||
|
||||
sector[sect].ceilingz += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128
|
||||
|
@ -5207,8 +5200,7 @@ static void Keys3d(void)
|
|||
|
||||
for (j=0; j<(k?k:1); j++, sect=highlightsector[j])
|
||||
{
|
||||
i = headspritesect[sect];
|
||||
while (i != -1)
|
||||
for (i=headspritesect[sect]; i!=-1; i=nextspritesect[i])
|
||||
{
|
||||
tempint = getflorzofslope(sect,sprite[i].x,sprite[i].y);
|
||||
|
||||
|
@ -5217,8 +5209,6 @@ static void Keys3d(void)
|
|||
|
||||
if (sprite[i].z == tempint)
|
||||
sprite[i].z += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128
|
||||
|
||||
i = nextspritesect[i];
|
||||
}
|
||||
|
||||
sector[sect].floorz += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128
|
||||
|
@ -6476,7 +6466,7 @@ static void Keys3d(void)
|
|||
wall[w].xrepeat = 8;
|
||||
wall[w].yrepeat = 8;
|
||||
wall[w].cstat = 0;
|
||||
fixrepeats((int16_t)searchwall);
|
||||
fixrepeats(searchwall);
|
||||
}
|
||||
else if (AIMING_AT_CEILING_OR_FLOOR)
|
||||
{
|
||||
|
@ -10255,6 +10245,14 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
|
|||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
// this one usually appears together with the "already referenced" corruption
|
||||
else if (wall[nw].nextsector != i || wall[nw].nextwall != j)
|
||||
{
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_WALL|nw, "WALL %d nextwall's backreferences inconsistent. Expected nw=%d, ns=%d; got nw=%d, ns=%d",
|
||||
nw, i, j, wall[nw].nextsector, wall[nw].nextwall);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ extern void updatenumsprites(void);
|
|||
|
||||
extern int32_t lastpm16time, synctics;
|
||||
extern int32_t halfxdim16, midydim16, zoom;
|
||||
extern void fixrepeats(int16_t i);
|
||||
|
||||
static char autospritehelp=0,autosecthelp=0;
|
||||
//int16_t MinRate=24, MinD=3;
|
||||
|
|
Loading…
Reference in a new issue