mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@1208 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
16084e989e
commit
18896fd0cd
18 changed files with 3702 additions and 3570 deletions
|
@ -402,6 +402,17 @@ OTHER VARIABLES:
|
|||
you call the loadboard function.
|
||||
***************************************************************************/
|
||||
|
||||
typedef struct BPACK {
|
||||
int32_t x, y, z;
|
||||
} vec3_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t pos;
|
||||
int16_t hitsprite;
|
||||
int16_t hitwall;
|
||||
int16_t hitsect;
|
||||
} hitdata_t;
|
||||
|
||||
int32_t preinitengine(void); // a partial setup of the engine used for launch windows
|
||||
int32_t initengine(void);
|
||||
void uninitengine(void);
|
||||
|
@ -443,12 +454,12 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
|
|||
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize);
|
||||
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize);
|
||||
|
||||
int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype);
|
||||
int32_t clipmove(vec3_t *vect, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype);
|
||||
int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist);
|
||||
int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t walldist);
|
||||
int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype);
|
||||
void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype);
|
||||
int32_t hitscan(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, int16_t *hitsect, int16_t *hitwall, int16_t *hitsprite, int32_t *hitx, int32_t *hity, int32_t *hitz, uint32_t cliptype);
|
||||
int32_t pushmove(vec3_t *vect, int16_t *sectnum, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype);
|
||||
void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype);
|
||||
int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, hitdata_t *hitinfo, uint32_t cliptype);
|
||||
int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, char tagsearch);
|
||||
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
|
||||
void updatesector(int32_t x, int32_t y, int16_t *sectnum);
|
||||
|
@ -476,7 +487,7 @@ int32_t insertsprite(int16_t sectnum, int16_t statnum);
|
|||
int32_t deletesprite(int16_t spritenum);
|
||||
int32_t changespritesect(int16_t spritenum, int16_t newsectnum);
|
||||
int32_t changespritestat(int16_t spritenum, int16_t newstatnum);
|
||||
int32_t setsprite(int16_t spritenum, int32_t newx, int32_t newy, int32_t newz);
|
||||
int32_t setsprite(int16_t spritenum, vec3_t *new);
|
||||
|
||||
int32_t screencapture(char *filename, char inverseit);
|
||||
|
||||
|
|
|
@ -66,7 +66,8 @@ uint8_t buildkeys[NUMBUILDKEYS] =
|
|||
0x9c,0x1c,0xd,0xc,0xf,0x29
|
||||
};
|
||||
|
||||
int32_t posx, posy, posz, horiz = 100;
|
||||
vec3_t pos;
|
||||
int32_t horiz = 100;
|
||||
int32_t mousexsurp = 0, mouseysurp = 0;
|
||||
int16_t ang, cursectnum;
|
||||
int32_t hvel;
|
||||
|
@ -394,15 +395,15 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
for (i=0;i<MAXSPRITES;i++) sprite[i].extra = -1;
|
||||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
loadmhk();
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
if (i < 0)
|
||||
{
|
||||
initspritelists();
|
||||
posx = 32768;
|
||||
posy = 32768;
|
||||
posz = 0;
|
||||
pos.x = 32768;
|
||||
pos.y = 32768;
|
||||
pos.z = 0;
|
||||
ang = 1536;
|
||||
numsectors = 0;
|
||||
numwalls = 0;
|
||||
|
@ -415,15 +416,15 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
|
||||
updatenumsprites();
|
||||
|
||||
startposx = posx;
|
||||
startposy = posy;
|
||||
startposz = posz;
|
||||
startposx = pos.x;
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum; // TX 20050225: moved to loadboard
|
||||
|
||||
totalclock = 0;
|
||||
|
||||
updatesector(posx,posy,&cursectnum);
|
||||
updatesector(pos.x,pos.y,&cursectnum);
|
||||
|
||||
if (cursectnum == -1)
|
||||
{
|
||||
|
@ -452,7 +453,7 @@ CANCEL:
|
|||
|
||||
ExtPreCheckKeys();
|
||||
|
||||
drawrooms(posx,posy,posz,ang,horiz,cursectnum);
|
||||
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
|
||||
#ifdef SUPERBUILD
|
||||
ExtAnalyzeSprites();
|
||||
#endif
|
||||
|
@ -593,8 +594,8 @@ void editinput(void)
|
|||
int32_t mousz, bstatus;
|
||||
int32_t i, j, k, /*cnt,*/ tempint=0, doubvel/*, changedir, wallfind[2], daz[2]*/;
|
||||
int32_t /*dashade[2],*/ goalz, xvect, yvect,/*PK*/ zvect, hiz, loz;
|
||||
int16_t hitsect, hitwall, hitsprite;
|
||||
int32_t hitx, hity, hitz, dax, day, hihit, lohit;
|
||||
hitdata_t hitinfo;
|
||||
int32_t dax, day, hihit, lohit;
|
||||
|
||||
// 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46
|
||||
// F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL
|
||||
|
@ -654,11 +655,11 @@ void editinput(void)
|
|||
|
||||
if (noclip)
|
||||
{
|
||||
posx += xvect>>14;
|
||||
posy += yvect>>14;
|
||||
updatesector(posx,posy,&cursectnum);
|
||||
pos.x += xvect>>14;
|
||||
pos.y += yvect>>14;
|
||||
updatesector(pos.x,pos.y,&cursectnum);
|
||||
}
|
||||
else clipmove(&posx,&posy,&posz,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
else clipmove(&pos,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
}
|
||||
else if (!mlook && (bstatus&2) && !(bstatus&(1|4)))
|
||||
{
|
||||
|
@ -669,14 +670,14 @@ void editinput(void)
|
|||
zmode = 2;
|
||||
xvect = -((mousx*(int32_t)sintable[(ang+2048)&2047])<<pk_uedaccel);
|
||||
yvect = -((mousx*(int32_t)sintable[(ang+1536)&2047])<<pk_uedaccel);
|
||||
posz += mousy<<(4+pk_uedaccel);
|
||||
pos.z += mousy<<(4+pk_uedaccel);
|
||||
if (noclip)
|
||||
{
|
||||
posx += xvect>>14;
|
||||
posy += yvect>>14;
|
||||
updatesectorz(posx,posy,posz,&cursectnum);
|
||||
pos.x += xvect>>14;
|
||||
pos.y += yvect>>14;
|
||||
updatesectorz(pos.x,pos.y,pos.z,&cursectnum);
|
||||
}
|
||||
else clipmove(&posx,&posy,&posz,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
else clipmove(&pos,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
}
|
||||
else if (bstatus&4)
|
||||
{
|
||||
|
@ -696,14 +697,14 @@ void editinput(void)
|
|||
|
||||
zvect = mousy*(((int32_t)sintable[(tempint+2048)&2047])>>(10-pk_uedaccel));
|
||||
|
||||
posz += zvect;
|
||||
pos.z += zvect;
|
||||
if (noclip)
|
||||
{
|
||||
posx += xvect>>16;
|
||||
posy += yvect>>16;
|
||||
updatesectorz(posx,posy,posz,&cursectnum);
|
||||
pos.x += xvect>>16;
|
||||
pos.y += yvect>>16;
|
||||
updatesectorz(pos.x,pos.y,pos.z,&cursectnum);
|
||||
}
|
||||
else clipmove(&posx,&posy,&posz,&cursectnum,xvect>>2,yvect>>2,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
else clipmove(&pos,&cursectnum,xvect>>2,yvect>>2,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -747,10 +748,10 @@ void editinput(void)
|
|||
|
||||
// showmouse();
|
||||
|
||||
// if (keystatus[0x3b] > 0) posx--;
|
||||
// if (keystatus[0x3c] > 0) posx++;
|
||||
// if (keystatus[0x3d] > 0) posy--;
|
||||
// if (keystatus[0x3e] > 0) posy++;
|
||||
// if (keystatus[0x3b] > 0) pos.x--;
|
||||
// if (keystatus[0x3c] > 0) pos.x++;
|
||||
// if (keystatus[0x3d] > 0) pos.y--;
|
||||
// if (keystatus[0x3e] > 0) pos.y++;
|
||||
// if (keystatus[0x43] > 0) ang--;
|
||||
// if (keystatus[0x44] > 0) ang++;
|
||||
|
||||
|
@ -799,19 +800,19 @@ void editinput(void)
|
|||
}
|
||||
if (noclip)
|
||||
{
|
||||
posx += xvect>>14;
|
||||
posy += yvect>>14;
|
||||
updatesector(posx,posy,&cursectnum);
|
||||
pos.x += xvect>>14;
|
||||
pos.y += yvect>>14;
|
||||
updatesector(pos.x,pos.y,&cursectnum);
|
||||
}
|
||||
else clipmove(&posx,&posy,&posz,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
else clipmove(&pos,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
}
|
||||
getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0);
|
||||
getzrange(&pos,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0);
|
||||
|
||||
/* if (keystatus[0x3a] > 0)
|
||||
{
|
||||
zmode++;
|
||||
if (zmode == 3) zmode = 0;
|
||||
if (zmode == 1) zlock = (loz-posz)&0xfffffc00;
|
||||
if (zmode == 1) zlock = (loz-pos.z)&0xfffffc00;
|
||||
keystatus[0x3a] = 0;
|
||||
}*/
|
||||
|
||||
|
@ -848,19 +849,19 @@ void editinput(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (goalz != posz)
|
||||
if (goalz != pos.z)
|
||||
{
|
||||
if (posz < goalz) hvel += 64;
|
||||
if (posz > goalz) hvel = ((goalz-posz)>>3);
|
||||
if (pos.z < goalz) hvel += 64;
|
||||
if (pos.z > goalz) hvel = ((goalz-pos.z)>>3);
|
||||
|
||||
posz += hvel;
|
||||
if (posz > loz-(4<<8)) posz = loz-(4<<8), hvel = 0;
|
||||
if (posz < hiz+(4<<8)) posz = hiz+(4<<8), hvel = 0;
|
||||
pos.z += hvel;
|
||||
if (pos.z > loz-(4<<8)) pos.z = loz-(4<<8), hvel = 0;
|
||||
if (pos.z < hiz+(4<<8)) pos.z = hiz+(4<<8), hvel = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
goalz = posz;
|
||||
goalz = pos.z;
|
||||
if (keystatus[buildkeys[BK_MOVEUP]]) //A
|
||||
{
|
||||
if (keystatus[0x1d]|keystatus[0x9d])
|
||||
|
@ -903,21 +904,21 @@ void editinput(void)
|
|||
}
|
||||
if (zmode == 1) goalz = loz-zlock;
|
||||
if (!noclip && (goalz < hiz+(4<<8))) goalz = ((loz+hiz)>>1); //ceiling&floor too close
|
||||
if (zmode == 1) posz = goalz;
|
||||
if (zmode == 1) pos.z = goalz;
|
||||
|
||||
if (goalz != posz)
|
||||
if (goalz != pos.z)
|
||||
{
|
||||
//if (posz < goalz) hvel += (32<<keystatus[buildkeys[BK_RUN]]);
|
||||
//if (posz > goalz) hvel -= (32<<keystatus[buildkeys[BK_RUN]]);
|
||||
if (posz < goalz) hvel = ((synctics* 192)<<keystatus[buildkeys[BK_RUN]]);
|
||||
if (posz > goalz) hvel = ((synctics*-192)<<keystatus[buildkeys[BK_RUN]]);
|
||||
//if (pos.z < goalz) hvel += (32<<keystatus[buildkeys[BK_RUN]]);
|
||||
//if (pos.z > goalz) hvel -= (32<<keystatus[buildkeys[BK_RUN]]);
|
||||
if (pos.z < goalz) hvel = ((synctics* 192)<<keystatus[buildkeys[BK_RUN]]);
|
||||
if (pos.z > goalz) hvel = ((synctics*-192)<<keystatus[buildkeys[BK_RUN]]);
|
||||
|
||||
posz += hvel;
|
||||
pos.z += hvel;
|
||||
|
||||
if (!noclip)
|
||||
{
|
||||
if (posz > loz-(4<<8)) posz = loz-(4<<8), hvel = 0;
|
||||
if (posz < hiz+(4<<8)) posz = hiz+(4<<8), hvel = 0;
|
||||
if (pos.z > loz-(4<<8)) pos.z = loz-(4<<8), hvel = 0;
|
||||
if (pos.z < hiz+(4<<8)) pos.z = hiz+(4<<8), hvel = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -936,19 +937,19 @@ void editinput(void)
|
|||
day = divscale14(searchx-(xdim>>1),xdim>>1);
|
||||
rotatepoint(0,0,dax,day,ang,&dax,&day);
|
||||
|
||||
hitscan(posx,posy,posz,cursectnum, //Start position
|
||||
hitscan((const vec3_t *)&pos,cursectnum, //Start position
|
||||
dax,day,(scale(searchy,200,ydim)-horiz)*2000, //vector of 3D ang
|
||||
&hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1);
|
||||
&hitinfo,CLIPMASK1);
|
||||
|
||||
if (hitsect >= 0)
|
||||
if (hitinfo.hitsect >= 0)
|
||||
{
|
||||
dax = hitx;
|
||||
day = hity;
|
||||
dax = hitinfo.pos.x;
|
||||
day = hitinfo.pos.x;
|
||||
if ((gridlock > 0) && (grid > 0))
|
||||
{
|
||||
if ((searchstat == 0) || (searchstat == 4))
|
||||
{
|
||||
hitz = (hitz&0xfffffc00);
|
||||
hitinfo.pos.y = (hitinfo.pos.y&0xfffffc00);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -957,7 +958,7 @@ void editinput(void)
|
|||
}
|
||||
}
|
||||
|
||||
i = insertsprite(hitsect,0);
|
||||
i = insertsprite(hitinfo.hitsect,0);
|
||||
sprite[i].x = dax, sprite[i].y = day;
|
||||
sprite[i].cstat = defaultspritecstat;
|
||||
sprite[i].shade = 0;
|
||||
|
@ -1011,22 +1012,27 @@ void editinput(void)
|
|||
|
||||
j = ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1);
|
||||
if ((sprite[i].cstat&128) == 0)
|
||||
sprite[i].z = min(max(hitz,getceilzofslope(hitsect,hitx,hity)+(j<<1)),getflorzofslope(hitsect,hitx,hity));
|
||||
sprite[i].z = min(max(hitinfo.pos.y,
|
||||
getceilzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)+(j<<1)),
|
||||
getflorzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y));
|
||||
else
|
||||
sprite[i].z = min(max(hitz,getceilzofslope(hitsect,hitx,hity)+j),getflorzofslope(hitsect,hitx,hity)-j);
|
||||
sprite[i].z = min(max(hitinfo.pos.y,
|
||||
getceilzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)+j),
|
||||
getflorzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)-j);
|
||||
|
||||
if ((searchstat == 0) || (searchstat == 4))
|
||||
{
|
||||
sprite[i].cstat = (sprite[i].cstat&~48)|(16+64);
|
||||
if (hitwall >= 0)
|
||||
sprite[i].ang = ((getangle(wall[wall[hitwall].point2].x-wall[hitwall].x,wall[wall[hitwall].point2].y-wall[hitwall].y)+512)&2047);
|
||||
if (hitinfo.hitwall >= 0)
|
||||
sprite[i].ang = ((getangle(wall[wall[hitinfo.hitwall].point2].x-wall[hitinfo.hitwall].x,
|
||||
wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y)+512)&2047);
|
||||
|
||||
//Make sure sprite's in right sector
|
||||
if (inside(sprite[i].x,sprite[i].y,sprite[i].sectnum) == 0)
|
||||
{
|
||||
j = wall[hitwall].point2;
|
||||
sprite[i].x -= ksgn(wall[j].y-wall[hitwall].y);
|
||||
sprite[i].y += ksgn(wall[j].x-wall[hitwall].x);
|
||||
j = wall[hitinfo.hitwall].point2;
|
||||
sprite[i].x -= ksgn(wall[j].y-wall[hitinfo.hitwall].y);
|
||||
sprite[i].y += ksgn(wall[j].x-wall[hitinfo.hitwall].x);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1448,10 +1454,9 @@ void overheadeditor(void)
|
|||
int16_t circlepoints, circleang1, circleang2, circleangdir;
|
||||
int32_t sectorhighlightx=0, sectorhighlighty=0;
|
||||
int16_t cursectorhighlight, sectorhighlightstat;
|
||||
int16_t hitsect, hitwall, hitsprite;
|
||||
int32_t hitx, hity, hitz;
|
||||
walltype *wal;
|
||||
int32_t prefixarg = 0;
|
||||
hitdata_t hitinfo;
|
||||
|
||||
//qsetmode640480();
|
||||
qsetmodeany(xdim2d,ydim2d);
|
||||
|
@ -1463,7 +1468,7 @@ void overheadeditor(void)
|
|||
|
||||
searchx = scale(searchx,xdim2d,xdimgame);
|
||||
searchy = scale(searchy,ydim2d-STATUS2DSIZ,ydimgame);
|
||||
oposz = posz;
|
||||
oposz = pos.z;
|
||||
|
||||
begindrawing(); //{{{
|
||||
clearbuf((char *)(frameplace + (ydim16*bytesperline)), (bytesperline*STATUS2DSIZ) >> 2, 0x00000000l);
|
||||
|
@ -1560,10 +1565,10 @@ void overheadeditor(void)
|
|||
if (searchy < 8) searchy = 8;
|
||||
if (searchy > ydim-8-1) searchy = ydim-8-1;
|
||||
|
||||
/* if (keystatus[0x3b] > 0) posx--, keystatus[0x3b] = 0;
|
||||
if (keystatus[0x3c] > 0) posx++, keystatus[0x3c] = 0;
|
||||
if (keystatus[0x3d] > 0) posy--, keystatus[0x3d] = 0;
|
||||
if (keystatus[0x3e] > 0) posy++, keystatus[0x3e] = 0;
|
||||
/* if (keystatus[0x3b] > 0) pos.x--, keystatus[0x3b] = 0;
|
||||
if (keystatus[0x3c] > 0) pos.x++, keystatus[0x3c] = 0;
|
||||
if (keystatus[0x3d] > 0) pos.y--, keystatus[0x3d] = 0;
|
||||
if (keystatus[0x3e] > 0) pos.y++, keystatus[0x3e] = 0;
|
||||
if (keystatus[0x43] > 0) ang--, keystatus[0x43] = 0;
|
||||
if (keystatus[0x44] > 0) ang++, keystatus[0x44] = 0; */
|
||||
if (angvel != 0) //ang += angvel * constant
|
||||
|
@ -1593,11 +1598,11 @@ void overheadeditor(void)
|
|||
}
|
||||
if (noclip)
|
||||
{
|
||||
posx += xvect>>14;
|
||||
posy += yvect>>14;
|
||||
updatesector(posx,posy,&cursectnum);
|
||||
pos.x += xvect>>14;
|
||||
pos.y += yvect>>14;
|
||||
updatesector(pos.x,pos.y,&cursectnum);
|
||||
}
|
||||
else clipmove(&posx,&posy,&posz,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
else clipmove(&pos,&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK0);
|
||||
}
|
||||
|
||||
getpoint(searchx,searchy,&mousxplc,&mousyplc);
|
||||
|
@ -1634,18 +1639,18 @@ void overheadeditor(void)
|
|||
if (graphicsmode == 2)
|
||||
totalclocklock = totalclock;
|
||||
|
||||
drawmapview(posx, posy, zoom, 1536);
|
||||
drawmapview(pos.x, pos.y, zoom, 1536);
|
||||
yxaspect = i;
|
||||
ydim = j;
|
||||
xyaspect = ii;
|
||||
}
|
||||
|
||||
draw2dgrid(posx,posy,ang,zoom,grid);
|
||||
draw2dgrid(pos.x,pos.y,ang,zoom,grid);
|
||||
|
||||
ExtPreCheckKeys();
|
||||
|
||||
x2 = mulscale14(startposx-posx,zoom); //Draw brown arrow (start)
|
||||
y2 = mulscale14(startposy-posy,zoom);
|
||||
x2 = mulscale14(startposx-pos.x,zoom); //Draw brown arrow (start)
|
||||
y2 = mulscale14(startposy-pos.y,zoom);
|
||||
if (((halfxdim16+x2) >= 2) && ((halfxdim16+x2) <= xdim-3))
|
||||
if (((midydim16+y2) >= 2) && ((midydim16+y2) <= ydim16-3))
|
||||
{
|
||||
|
@ -1658,7 +1663,7 @@ void overheadeditor(void)
|
|||
enddrawing(); //}}}
|
||||
}
|
||||
|
||||
draw2dscreen(posx,posy,ang,zoom,grid);
|
||||
draw2dscreen(pos.x,pos.y,ang,zoom,grid);
|
||||
|
||||
begindrawing(); //{{{
|
||||
if (showtags == 1)
|
||||
|
@ -1684,8 +1689,8 @@ void overheadeditor(void)
|
|||
day /= (endwall-startwall+1);
|
||||
}
|
||||
|
||||
dax = mulscale14(dax-posx,zoom);
|
||||
day = mulscale14(day-posy,zoom);
|
||||
dax = mulscale14(dax-pos.x,zoom);
|
||||
day = mulscale14(day-pos.y,zoom);
|
||||
|
||||
x1 = halfxdim16+dax-(Bstrlen(dabuffer)<<1);
|
||||
y1 = midydim16+day-4;
|
||||
|
@ -1704,10 +1709,10 @@ void overheadeditor(void)
|
|||
}
|
||||
}
|
||||
|
||||
x3 = divscale14(-halfxdim16,zoom)+posx;
|
||||
y3 = divscale14(-(midydim16-4),zoom)+posy;
|
||||
x4 = divscale14(halfxdim16,zoom)+posx;
|
||||
y4 = divscale14(ydim16-(midydim16-4),zoom)+posy;
|
||||
x3 = divscale14(-halfxdim16,zoom)+pos.x;
|
||||
y3 = divscale14(-(midydim16-4),zoom)+pos.y;
|
||||
x4 = divscale14(halfxdim16,zoom)+pos.x;
|
||||
y4 = divscale14(ydim16-(midydim16-4),zoom)+pos.y;
|
||||
|
||||
if (newnumwalls >= 0)
|
||||
{
|
||||
|
@ -1728,8 +1733,8 @@ void overheadeditor(void)
|
|||
dabuffer = (char *)ExtGetWallCaption(i);
|
||||
if (dabuffer[0] != 0)
|
||||
{
|
||||
dax = mulscale14(dax-posx,zoom);
|
||||
day = mulscale14(day-posy,zoom);
|
||||
dax = mulscale14(dax-pos.x,zoom);
|
||||
day = mulscale14(day-pos.y,zoom);
|
||||
x1 = halfxdim16+dax-(Bstrlen(dabuffer)<<1);
|
||||
y1 = midydim16+day-4;
|
||||
x2 = x1 + (Bstrlen(dabuffer)<<2)+2;
|
||||
|
@ -1761,8 +1766,8 @@ void overheadeditor(void)
|
|||
dax = sprite[i].x;
|
||||
day = sprite[i].y;
|
||||
|
||||
dax = mulscale14(dax-posx,zoom);
|
||||
day = mulscale14(day-posy,zoom);
|
||||
dax = mulscale14(dax-pos.x,zoom);
|
||||
day = mulscale14(day-pos.y,zoom);
|
||||
x1 = halfxdim16+dax-(Bstrlen(dabuffer)<<1);
|
||||
y1 = midydim16+day-4;
|
||||
x2 = x1 + (Bstrlen(dabuffer)<<2)+2;
|
||||
|
@ -1797,7 +1802,7 @@ void overheadeditor(void)
|
|||
}
|
||||
}
|
||||
|
||||
printcoords16(posx,posy,ang);
|
||||
printcoords16(pos.x,pos.y,ang);
|
||||
|
||||
numwalls = tempint;
|
||||
|
||||
|
@ -1840,8 +1845,8 @@ void overheadeditor(void)
|
|||
if (linehighlight>=0)
|
||||
{
|
||||
getclosestpointonwall(mousxplc,mousyplc,(int32_t)linehighlight,&dax,&day);
|
||||
x2 = mulscale14(dax-posx,zoom);
|
||||
y2 = mulscale14(day-posy,zoom);
|
||||
x2 = mulscale14(dax-pos.x,zoom);
|
||||
y2 = mulscale14(day-pos.y,zoom);
|
||||
if (wall[linehighlight].nextsector >= 0)
|
||||
drawline16(halfxdim16+x2,midydim16+y2,halfxdim16+x2,midydim16+y2,editorcolors[15]);
|
||||
else
|
||||
|
@ -2102,8 +2107,8 @@ void overheadeditor(void)
|
|||
/*
|
||||
j = ydim16; ydim16 = ydim;
|
||||
clear2dscreen();
|
||||
draw2dgrid(posx,posy,ang,zoom,grid);
|
||||
draw2dscreen(posx,posy,ang,zoom,grid);
|
||||
draw2dgrid(pos.x,pos.y,ang,zoom,grid);
|
||||
draw2dscreen(pos.x,pos.y,ang,zoom,grid);
|
||||
*/
|
||||
|
||||
screencapture("captxxxx.tga",keystatus[0x2a]|keystatus[0x36]);
|
||||
|
@ -2111,8 +2116,8 @@ void overheadeditor(void)
|
|||
/*
|
||||
ydim16 = j;
|
||||
clear2dscreen();
|
||||
draw2dgrid(posx,posy,ang,zoom,grid);
|
||||
draw2dscreen(posx,posy,ang,zoom,grid);
|
||||
draw2dgrid(pos.x,pos.y,ang,zoom,grid);
|
||||
draw2dscreen(pos.x,pos.y,ang,zoom,grid);
|
||||
*/
|
||||
showframe(1);
|
||||
}
|
||||
|
@ -2164,25 +2169,24 @@ void overheadeditor(void)
|
|||
asksave = 1;
|
||||
i = (pointhighlight&16383);
|
||||
|
||||
hitscan(sprite[i].x,sprite[i].y,sprite[i].z,sprite[i].sectnum,
|
||||
hitscan((const vec3_t *)&sprite[i],sprite[i].sectnum,
|
||||
sintable[(sprite[i].ang+2560+1024)&2047],
|
||||
sintable[(sprite[i].ang+2048+1024)&2047],
|
||||
0,
|
||||
&hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1);
|
||||
0,&hitinfo,CLIPMASK1);
|
||||
|
||||
sprite[i].x = hitx;
|
||||
sprite[i].y = hity;
|
||||
sprite[i].z = hitz;
|
||||
changespritesect(i,hitsect);
|
||||
if (hitwall >= 0)
|
||||
sprite[i].ang = ((getangle(wall[wall[hitwall].point2].x-wall[hitwall].x,wall[wall[hitwall].point2].y-wall[hitwall].y)+512)&2047);
|
||||
sprite[i].x = hitinfo.pos.x;
|
||||
sprite[i].y = hitinfo.pos.y;
|
||||
sprite[i].z = hitinfo.pos.z;
|
||||
changespritesect(i,hitinfo.hitsect);
|
||||
if (hitinfo.hitwall >= 0)
|
||||
sprite[i].ang = ((getangle(wall[wall[hitinfo.hitwall].point2].x-wall[hitinfo.hitwall].x,wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y)+512)&2047);
|
||||
|
||||
//Make sure sprite's in right sector
|
||||
if (inside(sprite[i].x,sprite[i].y,sprite[i].sectnum) == 0)
|
||||
{
|
||||
j = wall[hitwall].point2;
|
||||
sprite[i].x -= ksgn(wall[j].y-wall[hitwall].y);
|
||||
sprite[i].y += ksgn(wall[j].x-wall[hitwall].x);
|
||||
j = wall[hitinfo.hitwall].point2;
|
||||
sprite[i].x -= ksgn(wall[j].y-wall[hitinfo.hitwall].y);
|
||||
sprite[i].y += ksgn(wall[j].x-wall[hitinfo.hitwall].x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2388,9 +2392,9 @@ void overheadeditor(void)
|
|||
}
|
||||
if (keystatus[0x46]) //Scroll lock (set starting position)
|
||||
{
|
||||
startposx = posx;
|
||||
startposy = posy;
|
||||
startposz = posz;
|
||||
startposx = pos.x;
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum;
|
||||
keystatus[0x46] = 0;
|
||||
|
@ -2799,7 +2803,7 @@ void overheadeditor(void)
|
|||
{
|
||||
j = (highlight[i]&16383);
|
||||
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
|
||||
tempint = ((tilesizy[sprite[j].picnum]*sprite[j].yrepeat)<<2);
|
||||
sprite[j].z = max(sprite[j].z,getceilzofslope(sprite[j].sectnum,sprite[j].x,sprite[j].y)+tempint);
|
||||
|
@ -2811,7 +2815,7 @@ void overheadeditor(void)
|
|||
{
|
||||
j = (pointhighlight&16383);
|
||||
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
|
||||
tempint = ((tilesizy[sprite[j].picnum]*sprite[j].yrepeat)<<2);
|
||||
|
||||
|
@ -3041,8 +3045,8 @@ SKIP:
|
|||
{
|
||||
searchx = halfxdim16;
|
||||
searchy = midydim16;
|
||||
posx = mousxplc;
|
||||
posy = mousyplc;
|
||||
pos.x = mousxplc;
|
||||
pos.y = mousyplc;
|
||||
}
|
||||
|
||||
if (circlewall != -1 && (keystatus[0x4a] || (bstatus&32 && !(keystatus[0x1d]|keystatus[0x9d])))) // -
|
||||
|
@ -3070,8 +3074,8 @@ SKIP:
|
|||
{
|
||||
searchx = halfxdim16;
|
||||
searchy = midydim16;
|
||||
posx = mousxplc;
|
||||
posy = mousyplc;
|
||||
pos.x = mousxplc;
|
||||
pos.y = mousyplc;
|
||||
}
|
||||
if (zoom > 16384) zoom = 16384;
|
||||
printmessage16("Zoom: %d",zoom);
|
||||
|
@ -3083,8 +3087,8 @@ SKIP:
|
|||
{
|
||||
searchx = halfxdim16;
|
||||
searchy = midydim16;
|
||||
posx = mousxplc;
|
||||
posy = mousyplc;
|
||||
pos.x = mousxplc;
|
||||
pos.y = mousyplc;
|
||||
}
|
||||
if (zoom < 8) zoom = 8;
|
||||
printmessage16("Zoom: %d",zoom);
|
||||
|
@ -3442,7 +3446,7 @@ SKIP:
|
|||
j = insertsprite(sprite[k].sectnum,sprite[k].statnum);
|
||||
Bmemcpy(&sprite[j],&sprite[k],sizeof(spritetype));
|
||||
sprite[j].sectnum = sprite[k].sectnum; //Don't let memcpy overwrite sector!
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
}
|
||||
updatenumsprites();
|
||||
printmessage16("Sprites duplicated and stamped.");
|
||||
|
@ -3481,8 +3485,8 @@ SKIP:
|
|||
centerx = (((x1+x2) + scale(y1-y2,tempint1,tempint2))>>1);
|
||||
centery = (((y1+y2) + scale(x2-x1,tempint1,tempint2))>>1);
|
||||
|
||||
dax = mulscale14(centerx-posx,zoom);
|
||||
day = mulscale14(centery-posy,zoom);
|
||||
dax = mulscale14(centerx-pos.x,zoom);
|
||||
day = mulscale14(centery-pos.y,zoom);
|
||||
drawline16(halfxdim16+dax-2,midydim16+day-2,halfxdim16+dax+2,midydim16+day+2,editorcolors[14]);
|
||||
drawline16(halfxdim16+dax-2,midydim16+day+2,halfxdim16+dax+2,midydim16+day-2,editorcolors[14]);
|
||||
|
||||
|
@ -3518,8 +3522,8 @@ SKIP:
|
|||
insertpoint(circlewall,dax,day);
|
||||
circlewall += m;
|
||||
}
|
||||
dax = mulscale14(dax-posx,zoom);
|
||||
day = mulscale14(day-posy,zoom);
|
||||
dax = mulscale14(dax-pos.x,zoom);
|
||||
day = mulscale14(day-pos.y,zoom);
|
||||
drawline16(halfxdim16+dax-pointsize,midydim16+day-pointsize,halfxdim16+dax+pointsize,midydim16+day-pointsize,editorcolors[14]);
|
||||
drawline16(halfxdim16+dax+pointsize,midydim16+day-pointsize,halfxdim16+dax+pointsize,midydim16+day+pointsize,editorcolors[14]);
|
||||
drawline16(halfxdim16+dax+pointsize,midydim16+day+pointsize,halfxdim16+dax-pointsize,midydim16+day+pointsize,editorcolors[14]);
|
||||
|
@ -3966,7 +3970,7 @@ SKIP:
|
|||
while (j != -1)
|
||||
{
|
||||
k = nextspritesect[j];
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
j = k;
|
||||
}
|
||||
}
|
||||
|
@ -4278,7 +4282,7 @@ SKIP:
|
|||
j = insertsprite(sprite[k].sectnum,sprite[k].statnum);
|
||||
Bmemcpy(&sprite[j],&sprite[k],sizeof(spritetype));
|
||||
sprite[j].sectnum = sprite[k].sectnum; //Don't let memcpy overwrite sector!
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
}
|
||||
updatenumsprites();
|
||||
printmessage16("Sprites duplicated and stamped.");
|
||||
|
@ -4363,7 +4367,7 @@ SKIP:
|
|||
|
||||
if (keystatus[buildkeys[BK_MODE2D_3D]])
|
||||
{
|
||||
updatesector(posx,posy,&cursectnum);
|
||||
updatesector(pos.x,pos.y,&cursectnum);
|
||||
if (cursectnum >= 0)
|
||||
keystatus[buildkeys[BK_MODE2D_3D]] = 2;
|
||||
else
|
||||
|
@ -4403,9 +4407,9 @@ nextmap:
|
|||
for (i=0;i<MAXSPRITES;i++) sprite[i].extra = -1;
|
||||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
oposz = posz;
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
oposz = pos.z;
|
||||
if (i < 0)
|
||||
{
|
||||
// printmessage16("Invalid map format.");
|
||||
|
@ -4419,9 +4423,9 @@ nextmap:
|
|||
else printmessage16("Map %s loaded successfully.",boardfilename);
|
||||
}
|
||||
updatenumsprites();
|
||||
startposx = posx; //this is same
|
||||
startposy = posy;
|
||||
startposz = posz;
|
||||
startposx = pos.x; //this is same
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum;
|
||||
}
|
||||
|
@ -4502,9 +4506,9 @@ CANCEL:
|
|||
circlewall = -1;
|
||||
circlepoints = 7;
|
||||
|
||||
posx = 32768; //new board!
|
||||
posy = 32768;
|
||||
posz = 0;
|
||||
pos.x = 32768; //new board!
|
||||
pos.y = 32768;
|
||||
pos.z = 0;
|
||||
ang = 1536;
|
||||
numsectors = 0;
|
||||
numwalls = 0;
|
||||
|
@ -4606,10 +4610,10 @@ CANCEL:
|
|||
for (i=0;i<MAXSPRITES;i++) sprite[i].extra = -1;
|
||||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
loadmhk();
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
oposz = posz;
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
oposz = pos.z;
|
||||
if (i < 0)
|
||||
{
|
||||
printmessage16("Invalid map format.");
|
||||
|
@ -4674,9 +4678,9 @@ CANCEL:
|
|||
else printmessage16("Map %s loaded successfully.",boardfilename);
|
||||
}
|
||||
updatenumsprites();
|
||||
startposx = posx; //this is same
|
||||
startposy = posy;
|
||||
startposz = posz;
|
||||
startposx = pos.x; //this is same
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum;
|
||||
}
|
||||
|
@ -4911,20 +4915,20 @@ CANCEL:
|
|||
|
||||
setbrightness(brightness,palette,0);
|
||||
|
||||
posz = oposz;
|
||||
pos.z = oposz;
|
||||
searchx = scale(searchx,xdimgame,xdim2d);
|
||||
searchy = scale(searchy,ydimgame,ydim2d-STATUS2DSIZ);
|
||||
}
|
||||
|
||||
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y)
|
||||
{
|
||||
if (posx <= -editorgridextent) posx = -editorgridextent;
|
||||
if (posx >= editorgridextent) posx = editorgridextent;
|
||||
if (posy <= -editorgridextent) posy = -editorgridextent;
|
||||
if (posy >= editorgridextent) posy = editorgridextent;
|
||||
if (pos.x <= -editorgridextent) pos.x = -editorgridextent;
|
||||
if (pos.x >= editorgridextent) pos.x = editorgridextent;
|
||||
if (pos.y <= -editorgridextent) pos.y = -editorgridextent;
|
||||
if (pos.y >= editorgridextent) pos.y = editorgridextent;
|
||||
|
||||
*x = posx + divscale14(searchxe-halfxdim16,zoom);
|
||||
*y = posy + divscale14(searchye-midydim16,zoom);
|
||||
*x = pos.x + divscale14(searchxe-halfxdim16,zoom);
|
||||
*y = pos.y + divscale14(searchye-midydim16,zoom);
|
||||
|
||||
if (*x <= -editorgridextent) *x = -editorgridextent;
|
||||
if (*x >= editorgridextent) *x = editorgridextent;
|
||||
|
@ -5462,7 +5466,7 @@ int32_t _getnumber256(char *namestart, int32_t num, int32_t maxnumber, char sign
|
|||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
|
||||
drawrooms(posx,posy,posz,ang,horiz,cursectnum);
|
||||
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
|
||||
#ifdef SUPERBUILD
|
||||
ExtAnalyzeSprites();
|
||||
#endif
|
||||
|
@ -5885,8 +5889,8 @@ int32_t fillsector(int16_t sectnum, char fillcolor)
|
|||
endwall = startwall + sector[sectnum].wallnum - 1;
|
||||
for (z=startwall;z<=endwall;z++)
|
||||
{
|
||||
y1 = (((wall[z].y-posy)*zoom)>>14)+midydim16;
|
||||
y2 = (((wall[wall[z].point2].y-posy)*zoom)>>14)+midydim16;
|
||||
y1 = (((wall[z].y-pos.y)*zoom)>>14)+midydim16;
|
||||
y2 = (((wall[wall[z].point2].y-pos.y)*zoom)>>14)+midydim16;
|
||||
if (y1 < miny) miny = y1;
|
||||
if (y2 < miny) miny = y2;
|
||||
if (y1 > maxy) maxy = y1;
|
||||
|
@ -5897,7 +5901,7 @@ int32_t fillsector(int16_t sectnum, char fillcolor)
|
|||
|
||||
for (sy=miny+((totalclock>>2)&3);sy<=maxy;sy+=3) // JBF 20040116: numframes%3 -> (totalclock>>2)&3
|
||||
{
|
||||
y = posy+(((sy-midydim16)<<14)/zoom);
|
||||
y = pos.y+(((sy-midydim16)<<14)/zoom);
|
||||
|
||||
fillist[0] = lborder; fillcnt = 1;
|
||||
for (z=startwall;z<=endwall;z++)
|
||||
|
@ -5913,7 +5917,7 @@ int32_t fillsector(int16_t sectnum, char fillcolor)
|
|||
//if (x1*(y-y2) + x2*(y1-y) <= 0)
|
||||
{
|
||||
dax = x1+scale(y-y1,x2-x1,y2-y1);
|
||||
dax = (((dax-posx)*zoom)>>14)+halfxdim16;
|
||||
dax = (((dax-pos.x)*zoom)>>14)+halfxdim16;
|
||||
if (dax >= lborder)
|
||||
fillist[fillcnt++] = dax;
|
||||
}
|
||||
|
@ -6464,7 +6468,7 @@ void keytimerstuff(void)
|
|||
if (vel < 0) vel = min(vel+6,0);
|
||||
if (vel > 0) vel = max(vel-6,0);
|
||||
/* if(mlook)
|
||||
posz -= (horiz-101)*(vel/40); */
|
||||
pos.z -= (horiz-101)*(vel/40); */
|
||||
}
|
||||
|
||||
void _printmessage16(const char *fmt, ...)
|
||||
|
|
|
@ -8265,16 +8265,19 @@ int32_t krecip(int32_t num)
|
|||
//
|
||||
// setsprite
|
||||
//
|
||||
int32_t setsprite(int16_t spritenum, int32_t newx, int32_t newy, int32_t newz)
|
||||
int32_t setsprite(int16_t spritenum, vec3_t *new)
|
||||
{
|
||||
int16_t tempsectnum;
|
||||
|
||||
Bmemcpy(&sprite[spritenum], new, sizeof(vec3_t));
|
||||
/*
|
||||
sprite[spritenum].x = newx;
|
||||
sprite[spritenum].y = newy;
|
||||
sprite[spritenum].z = newz;
|
||||
*/
|
||||
|
||||
tempsectnum = sprite[spritenum].sectnum;
|
||||
updatesector(newx,newy,&tempsectnum);
|
||||
updatesector(new->x,new->y,&tempsectnum);
|
||||
|
||||
if (tempsectnum < 0)
|
||||
return(-1);
|
||||
|
@ -8284,16 +8287,14 @@ int32_t setsprite(int16_t spritenum, int32_t newx, int32_t newy, int32_t newz)
|
|||
return(0);
|
||||
}
|
||||
|
||||
int32_t setspritez(int16_t spritenum, int32_t newx, int32_t newy, int32_t newz)
|
||||
int32_t setspritez(int16_t spritenum, vec3_t *new)
|
||||
{
|
||||
int16_t tempsectnum;
|
||||
|
||||
sprite[spritenum].x = newx;
|
||||
sprite[spritenum].y = newy;
|
||||
sprite[spritenum].z = newz;
|
||||
Bmemcpy(&sprite[spritenum], new, sizeof(vec3_t));
|
||||
|
||||
tempsectnum = sprite[spritenum].sectnum;
|
||||
updatesectorz(newx,newy,newz,&tempsectnum);
|
||||
updatesectorz(new->x,new->y,new->z,&tempsectnum);
|
||||
|
||||
if (tempsectnum < 0)
|
||||
return(-1);
|
||||
|
@ -8473,9 +8474,8 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, in
|
|||
//
|
||||
// hitscan
|
||||
//
|
||||
int32_t hitscan(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz,
|
||||
int16_t *hitsect, int16_t *hitwall, int16_t *hitsprite,
|
||||
int32_t *hitx, int32_t *hity, int32_t *hitz, uint32_t cliptype)
|
||||
int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz,
|
||||
hitdata_t *hitinfo, uint32_t cliptype)
|
||||
{
|
||||
sectortype *sec;
|
||||
walltype *wal, *wal2;
|
||||
|
@ -8489,10 +8489,10 @@ int32_t hitscan(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int32_t vx,
|
|||
int16_t nextsector;
|
||||
char clipyou;
|
||||
|
||||
*hitsect = -1; *hitwall = -1; *hitsprite = -1;
|
||||
hitinfo->hitsect = -1; hitinfo->hitwall = -1; hitinfo->hitsprite = -1;
|
||||
if (sectnum < 0) return(-1);
|
||||
|
||||
*hitx = hitscangoalx; *hity = hitscangoaly;
|
||||
hitinfo->pos.x = hitscangoalx; hitinfo->pos.y = hitscangoaly;
|
||||
|
||||
dawalclipmask = (cliptype&65535);
|
||||
dasprclipmask = (cliptype>>16);
|
||||
|
@ -8515,239 +8515,239 @@ int32_t hitscan(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int32_t vx,
|
|||
j = (vz<<8)-dmulscale15(dax,vy,-day,vx);
|
||||
if (j != 0)
|
||||
{
|
||||
i = ((sec->ceilingz-zs)<<8)+dmulscale15(dax,ys-wal->y,-day,xs-wal->x);
|
||||
i = ((sec->ceilingz-sv->z)<<8)+dmulscale15(dax,sv->y-wal->y,-day,sv->x-wal->x);
|
||||
if (((i^j) >= 0) && ((klabs(i)>>1) < klabs(j)))
|
||||
{
|
||||
i = divscale30(i,j);
|
||||
x1 = xs + mulscale30(vx,i);
|
||||
y1 = ys + mulscale30(vy,i);
|
||||
z1 = zs + mulscale30(vz,i);
|
||||
x1 = sv->x + mulscale30(vx,i);
|
||||
y1 = sv->y + mulscale30(vy,i);
|
||||
z1 = sv->z + mulscale30(vz,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((vz < 0) && (zs >= sec->ceilingz))
|
||||
else if ((vz < 0) && (sv->z >= sec->ceilingz))
|
||||
{
|
||||
z1 = sec->ceilingz; i = z1-zs;
|
||||
z1 = sec->ceilingz; i = z1-sv->z;
|
||||
if ((klabs(i)>>1) < -vz)
|
||||
{
|
||||
i = divscale30(i,vz);
|
||||
x1 = xs + mulscale30(vx,i);
|
||||
y1 = ys + mulscale30(vy,i);
|
||||
x1 = sv->x + mulscale30(vx,i);
|
||||
y1 = sv->y + mulscale30(vy,i);
|
||||
}
|
||||
}
|
||||
if ((x1 != 0x7fffffff) && (klabs(x1-xs)+klabs(y1-ys) < klabs((*hitx)-xs)+klabs((*hity)-ys)))
|
||||
if ((x1 != 0x7fffffff) && (klabs(x1-sv->x)+klabs(y1-sv->y) < klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)))
|
||||
if (inside(x1,y1,dasector) != 0)
|
||||
{
|
||||
*hitsect = dasector; *hitwall = -1; *hitsprite = -1;
|
||||
*hitx = x1; *hity = y1; *hitz = z1;
|
||||
hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = -1;
|
||||
hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1;
|
||||
}
|
||||
|
||||
x1 = 0x7fffffff;
|
||||
if (sec->floorstat&2)
|
||||
{
|
||||
wal = &wall[sec->wallptr]; wal2 = &wall[wal->point2];
|
||||
dax = wal2->x-wal->x; day = wal2->y-wal->y;
|
||||
i = nsqrtasm(dax*dax+day*day); if (i == 0) continue;
|
||||
i = divscale15(sec->floorheinum,i);
|
||||
dax *= i; day *= i;
|
||||
|
||||
j = (vz<<8)-dmulscale15(dax,vy,-day,vx);
|
||||
if (j != 0)
|
||||
x1 = 0x7fffffff;
|
||||
if (sec->floorstat&2)
|
||||
{
|
||||
i = ((sec->floorz-zs)<<8)+dmulscale15(dax,ys-wal->y,-day,xs-wal->x);
|
||||
if (((i^j) >= 0) && ((klabs(i)>>1) < klabs(j)))
|
||||
wal = &wall[sec->wallptr]; wal2 = &wall[wal->point2];
|
||||
dax = wal2->x-wal->x; day = wal2->y-wal->y;
|
||||
i = nsqrtasm(dax*dax+day*day); if (i == 0) continue;
|
||||
i = divscale15(sec->floorheinum,i);
|
||||
dax *= i; day *= i;
|
||||
|
||||
j = (vz<<8)-dmulscale15(dax,vy,-day,vx);
|
||||
if (j != 0)
|
||||
{
|
||||
i = divscale30(i,j);
|
||||
x1 = xs + mulscale30(vx,i);
|
||||
y1 = ys + mulscale30(vy,i);
|
||||
z1 = zs + mulscale30(vz,i);
|
||||
i = ((sec->floorz-sv->z)<<8)+dmulscale15(dax,sv->y-wal->y,-day,sv->x-wal->x);
|
||||
if (((i^j) >= 0) && ((klabs(i)>>1) < klabs(j)))
|
||||
{
|
||||
i = divscale30(i,j);
|
||||
x1 = sv->x + mulscale30(vx,i);
|
||||
y1 = sv->y + mulscale30(vy,i);
|
||||
z1 = sv->z + mulscale30(vz,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((vz > 0) && (zs <= sec->floorz))
|
||||
{
|
||||
z1 = sec->floorz; i = z1-zs;
|
||||
if ((klabs(i)>>1) < vz)
|
||||
else if ((vz > 0) && (sv->z <= sec->floorz))
|
||||
{
|
||||
i = divscale30(i,vz);
|
||||
x1 = xs + mulscale30(vx,i);
|
||||
y1 = ys + mulscale30(vy,i);
|
||||
}
|
||||
}
|
||||
if ((x1 != 0x7fffffff) && (klabs(x1-xs)+klabs(y1-ys) < klabs((*hitx)-xs)+klabs((*hity)-ys)))
|
||||
if (inside(x1,y1,dasector) != 0)
|
||||
{
|
||||
*hitsect = dasector; *hitwall = -1; *hitsprite = -1;
|
||||
*hitx = x1; *hity = y1; *hitz = z1;
|
||||
z1 = sec->floorz; i = z1-sv->z;
|
||||
if ((klabs(i)>>1) < vz)
|
||||
{
|
||||
i = divscale30(i,vz);
|
||||
x1 = sv->x + mulscale30(vx,i);
|
||||
y1 = sv->y + mulscale30(vy,i);
|
||||
}
|
||||
}
|
||||
if ((x1 != 0x7fffffff) && (klabs(x1-sv->x)+klabs(y1-sv->y) < klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)))
|
||||
if (inside(x1,y1,dasector) != 0)
|
||||
{
|
||||
hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = -1;
|
||||
hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1;
|
||||
}
|
||||
|
||||
startwall = sec->wallptr; endwall = startwall + sec->wallnum;
|
||||
for (z=startwall,wal=&wall[startwall];z<endwall;z++,wal++)
|
||||
{
|
||||
wal2 = &wall[wal->point2];
|
||||
x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y;
|
||||
startwall = sec->wallptr; endwall = startwall + sec->wallnum;
|
||||
for (z=startwall,wal=&wall[startwall];z<endwall;z++,wal++)
|
||||
{
|
||||
wal2 = &wall[wal->point2];
|
||||
x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y;
|
||||
|
||||
if ((x1-xs)*(y2-ys) < (x2-xs)*(y1-ys)) continue;
|
||||
if (rintersect(xs,ys,zs,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue;
|
||||
if ((x1-sv->x)*(y2-sv->y) < (x2-sv->x)*(y1-sv->y)) continue;
|
||||
if (rintersect(sv->x,sv->y,sv->z,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue;
|
||||
|
||||
if (klabs(intx-xs)+klabs(inty-ys) >= klabs((*hitx)-xs)+klabs((*hity)-ys)) continue;
|
||||
if (klabs(intx-sv->x)+klabs(inty-sv->y) >= klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue;
|
||||
|
||||
nextsector = wal->nextsector;
|
||||
if ((nextsector < 0) || (wal->cstat&dawalclipmask))
|
||||
{
|
||||
*hitsect = dasector; *hitwall = z; *hitsprite = -1;
|
||||
*hitx = intx; *hity = inty; *hitz = intz;
|
||||
continue;
|
||||
}
|
||||
getzsofslope(nextsector,intx,inty,&daz,&daz2);
|
||||
if ((intz <= daz) || (intz >= daz2))
|
||||
{
|
||||
*hitsect = dasector; *hitwall = z; *hitsprite = -1;
|
||||
*hitx = intx; *hity = inty; *hitz = intz;
|
||||
continue;
|
||||
}
|
||||
nextsector = wal->nextsector;
|
||||
if ((nextsector < 0) || (wal->cstat&dawalclipmask))
|
||||
{
|
||||
hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1;
|
||||
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz;
|
||||
continue;
|
||||
}
|
||||
getzsofslope(nextsector,intx,inty,&daz,&daz2);
|
||||
if ((intz <= daz) || (intz >= daz2))
|
||||
{
|
||||
hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1;
|
||||
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (zz=tempshortnum-1;zz>=0;zz--)
|
||||
if (clipsectorlist[zz] == nextsector) break;
|
||||
if (zz < 0) clipsectorlist[tempshortnum++] = nextsector;
|
||||
}
|
||||
for (zz=tempshortnum-1;zz>=0;zz--)
|
||||
if (clipsectorlist[zz] == nextsector) break;
|
||||
if (zz < 0) clipsectorlist[tempshortnum++] = nextsector;
|
||||
}
|
||||
|
||||
for (z=headspritesect[dasector];z>=0;z=nextspritesect[z])
|
||||
{
|
||||
spr = &sprite[z];
|
||||
cstat = spr->cstat;
|
||||
for (z=headspritesect[dasector];z>=0;z=nextspritesect[z])
|
||||
{
|
||||
spr = &sprite[z];
|
||||
cstat = spr->cstat;
|
||||
#ifdef POLYMOST
|
||||
if (!hitallsprites)
|
||||
if (!hitallsprites)
|
||||
#endif
|
||||
if ((cstat&dasprclipmask) == 0) continue;
|
||||
if ((cstat&dasprclipmask) == 0) continue;
|
||||
|
||||
x1 = spr->x; y1 = spr->y; z1 = spr->z;
|
||||
switch (cstat&48)
|
||||
{
|
||||
case 0:
|
||||
topt = vx*(x1-xs) + vy*(y1-ys); if (topt <= 0) continue;
|
||||
bot = vx*vx + vy*vy; if (bot == 0) continue;
|
||||
x1 = spr->x; y1 = spr->y; z1 = spr->z;
|
||||
switch (cstat&48)
|
||||
{
|
||||
case 0:
|
||||
topt = vx*(x1-sv->x) + vy*(y1-sv->y); if (topt <= 0) continue;
|
||||
bot = vx*vx + vy*vy; if (bot == 0) continue;
|
||||
|
||||
intz = zs+scale(vz,topt,bot);
|
||||
intz = sv->z+scale(vz,topt,bot);
|
||||
|
||||
i = (tilesizy[spr->picnum]*spr->yrepeat<<2);
|
||||
if (cstat&128) z1 += (i>>1);
|
||||
if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
|
||||
if ((intz > z1) || (intz < z1-i)) continue;
|
||||
topu = vx*(y1-ys) - vy*(x1-xs);
|
||||
i = (tilesizy[spr->picnum]*spr->yrepeat<<2);
|
||||
if (cstat&128) z1 += (i>>1);
|
||||
if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
|
||||
if ((intz > z1) || (intz < z1-i)) continue;
|
||||
topu = vx*(y1-sv->y) - vy*(x1-sv->x);
|
||||
|
||||
offx = scale(vx,topu,bot);
|
||||
offy = scale(vy,topu,bot);
|
||||
dist = offx*offx + offy*offy;
|
||||
i = tilesizx[spr->picnum]*spr->xrepeat; i *= i;
|
||||
if (dist > (i>>7)) continue;
|
||||
intx = xs + scale(vx,topt,bot);
|
||||
inty = ys + scale(vy,topt,bot);
|
||||
offx = scale(vx,topu,bot);
|
||||
offy = scale(vy,topu,bot);
|
||||
dist = offx*offx + offy*offy;
|
||||
i = tilesizx[spr->picnum]*spr->xrepeat; i *= i;
|
||||
if (dist > (i>>7)) continue;
|
||||
intx = sv->x + scale(vx,topt,bot);
|
||||
inty = sv->y + scale(vy,topt,bot);
|
||||
|
||||
if (klabs(intx-xs)+klabs(inty-ys) > klabs((*hitx)-xs)+klabs((*hity)-ys)) continue;
|
||||
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue;
|
||||
|
||||
*hitsect = dasector; *hitwall = -1; *hitsprite = z;
|
||||
*hitx = intx; *hity = inty; *hitz = intz;
|
||||
break;
|
||||
case 16:
|
||||
//These lines get the 2 points of the rotated sprite
|
||||
//Given: (x1, y1) starts out as the center point
|
||||
tilenum = spr->picnum;
|
||||
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
|
||||
if ((cstat&4) > 0) xoff = -xoff;
|
||||
k = spr->ang; l = spr->xrepeat;
|
||||
dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l;
|
||||
l = tilesizx[tilenum]; k = (l>>1)+xoff;
|
||||
x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l);
|
||||
y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l);
|
||||
hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z;
|
||||
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz;
|
||||
break;
|
||||
case 16:
|
||||
//These lines get the 2 points of the rotated sprite
|
||||
//Given: (x1, y1) starts out as the center point
|
||||
tilenum = spr->picnum;
|
||||
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
|
||||
if ((cstat&4) > 0) xoff = -xoff;
|
||||
k = spr->ang; l = spr->xrepeat;
|
||||
dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l;
|
||||
l = tilesizx[tilenum]; k = (l>>1)+xoff;
|
||||
x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l);
|
||||
y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l);
|
||||
|
||||
if ((cstat&64) != 0) //back side of 1-way sprite
|
||||
if ((x1-xs)*(y2-ys) < (x2-xs)*(y1-ys)) continue;
|
||||
if ((cstat&64) != 0) //back side of 1-way sprite
|
||||
if ((x1-sv->x)*(y2-sv->y) < (x2-sv->x)*(y1-sv->y)) continue;
|
||||
|
||||
if (rintersect(xs,ys,zs,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue;
|
||||
if (rintersect(sv->x,sv->y,sv->z,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue;
|
||||
|
||||
if (klabs(intx-xs)+klabs(inty-ys) > klabs((*hitx)-xs)+klabs((*hity)-ys)) continue;
|
||||
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue;
|
||||
|
||||
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 ((intz < daz) && (intz > daz-k))
|
||||
{
|
||||
*hitsect = dasector; *hitwall = -1; *hitsprite = z;
|
||||
*hitx = intx; *hity = inty; *hitz = intz;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
if (vz == 0) continue;
|
||||
intz = z1;
|
||||
if (((intz-zs)^vz) < 0) continue;
|
||||
if ((cstat&64) != 0)
|
||||
if ((zs > intz) == ((cstat&8)==0)) continue;
|
||||
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 ((intz < daz) && (intz > daz-k))
|
||||
{
|
||||
hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z;
|
||||
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
if (vz == 0) continue;
|
||||
intz = z1;
|
||||
if (((intz-sv->z)^vz) < 0) continue;
|
||||
if ((cstat&64) != 0)
|
||||
if ((sv->z > intz) == ((cstat&8)==0)) continue;
|
||||
|
||||
#if 1 // Abyss crash prevention code ((intz-zs)*zx overflowing a 8-bit word)
|
||||
zz=(int32_t)((intz-zs)*vx);
|
||||
intx = xs+scale(zz,1,vz);
|
||||
zz=(int32_t)((intz-zs)*vy);
|
||||
inty = ys+scale(zz,1,vz);
|
||||
#if 1 // Abyss crash prevention code ((intz-sv->z)*zx overflowing a 8-bit word)
|
||||
zz=(int32_t)((intz-sv->z)*vx);
|
||||
intx = sv->x+scale(zz,1,vz);
|
||||
zz=(int32_t)((intz-sv->z)*vy);
|
||||
inty = sv->y+scale(zz,1,vz);
|
||||
#else
|
||||
intx = xs+scale(intz-zs,vx,vz);
|
||||
inty = ys+scale(intz-zs,vy,vz);
|
||||
intx = sv->x+scale(intz-sv->z,vx,vz);
|
||||
inty = sv->y+scale(intz-sv->z,vy,vz);
|
||||
#endif
|
||||
|
||||
if (klabs(intx-xs)+klabs(inty-ys) > klabs((*hitx)-xs)+klabs((*hity)-ys)) continue;
|
||||
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue;
|
||||
|
||||
tilenum = spr->picnum;
|
||||
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
|
||||
yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
|
||||
if ((cstat&4) > 0) xoff = -xoff;
|
||||
if ((cstat&8) > 0) yoff = -yoff;
|
||||
tilenum = spr->picnum;
|
||||
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
|
||||
yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
|
||||
if ((cstat&4) > 0) xoff = -xoff;
|
||||
if ((cstat&8) > 0) yoff = -yoff;
|
||||
|
||||
ang = spr->ang;
|
||||
cosang = sintable[(ang+512)&2047]; sinang = sintable[ang];
|
||||
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
||||
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
||||
ang = spr->ang;
|
||||
cosang = sintable[(ang+512)&2047]; sinang = sintable[ang];
|
||||
xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
|
||||
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
||||
|
||||
dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat;
|
||||
x1 += dmulscale16(sinang,dax,cosang,day)-intx;
|
||||
y1 += dmulscale16(sinang,day,-cosang,dax)-inty;
|
||||
l = xspan*xrepeat;
|
||||
x2 = x1 - mulscale16(sinang,l);
|
||||
y2 = y1 + mulscale16(cosang,l);
|
||||
l = yspan*yrepeat;
|
||||
k = -mulscale16(cosang,l); x3 = x2+k; x4 = x1+k;
|
||||
k = -mulscale16(sinang,l); y3 = y2+k; y4 = y1+k;
|
||||
dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat;
|
||||
x1 += dmulscale16(sinang,dax,cosang,day)-intx;
|
||||
y1 += dmulscale16(sinang,day,-cosang,dax)-inty;
|
||||
l = xspan*xrepeat;
|
||||
x2 = x1 - mulscale16(sinang,l);
|
||||
y2 = y1 + mulscale16(cosang,l);
|
||||
l = yspan*yrepeat;
|
||||
k = -mulscale16(cosang,l); x3 = x2+k; x4 = x1+k;
|
||||
k = -mulscale16(sinang,l); y3 = y2+k; y4 = y1+k;
|
||||
|
||||
clipyou = 0;
|
||||
if ((y1^y2) < 0)
|
||||
{
|
||||
if ((x1^x2) < 0) clipyou ^= (x1*y2<x2*y1)^(y1<y2);
|
||||
else if (x1 >= 0) clipyou ^= 1;
|
||||
}
|
||||
if ((y2^y3) < 0)
|
||||
{
|
||||
if ((x2^x3) < 0) clipyou ^= (x2*y3<x3*y2)^(y2<y3);
|
||||
else if (x2 >= 0) clipyou ^= 1;
|
||||
}
|
||||
if ((y3^y4) < 0)
|
||||
{
|
||||
if ((x3^x4) < 0) clipyou ^= (x3*y4<x4*y3)^(y3<y4);
|
||||
else if (x3 >= 0) clipyou ^= 1;
|
||||
}
|
||||
if ((y4^y1) < 0)
|
||||
{
|
||||
if ((x4^x1) < 0) clipyou ^= (x4*y1<x1*y4)^(y4<y1);
|
||||
else if (x4 >= 0) clipyou ^= 1;
|
||||
}
|
||||
clipyou = 0;
|
||||
if ((y1^y2) < 0)
|
||||
{
|
||||
if ((x1^x2) < 0) clipyou ^= (x1*y2<x2*y1)^(y1<y2);
|
||||
else if (x1 >= 0) clipyou ^= 1;
|
||||
}
|
||||
if ((y2^y3) < 0)
|
||||
{
|
||||
if ((x2^x3) < 0) clipyou ^= (x2*y3<x3*y2)^(y2<y3);
|
||||
else if (x2 >= 0) clipyou ^= 1;
|
||||
}
|
||||
if ((y3^y4) < 0)
|
||||
{
|
||||
if ((x3^x4) < 0) clipyou ^= (x3*y4<x4*y3)^(y3<y4);
|
||||
else if (x3 >= 0) clipyou ^= 1;
|
||||
}
|
||||
if ((y4^y1) < 0)
|
||||
{
|
||||
if ((x4^x1) < 0) clipyou ^= (x4*y1<x1*y4)^(y4<y1);
|
||||
else if (x4 >= 0) clipyou ^= 1;
|
||||
}
|
||||
|
||||
if (clipyou != 0)
|
||||
{
|
||||
*hitsect = dasector; *hitwall = -1; *hitsprite = z;
|
||||
*hitx = intx; *hity = inty; *hitz = intz;
|
||||
if (clipyou != 0)
|
||||
{
|
||||
hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z;
|
||||
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
tempshortcnt++;
|
||||
tempshortcnt++;
|
||||
}
|
||||
while (tempshortcnt < tempshortnum);
|
||||
return(0);
|
||||
|
@ -8967,9 +8967,9 @@ int32_t clipmoveboxtracenum = 3;
|
|||
//
|
||||
// clipmove
|
||||
//
|
||||
int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
||||
int32_t xvect, int32_t yvect,
|
||||
int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype)
|
||||
int32_t clipmove(vec3_t *vect, int16_t *sectnum,
|
||||
int32_t xvect, int32_t yvect,
|
||||
int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype)
|
||||
{
|
||||
walltype *wal, *wal2;
|
||||
spritetype *spr;
|
||||
|
@ -8988,16 +8988,16 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
oxvect = xvect;
|
||||
oyvect = yvect;
|
||||
|
||||
goalx = (*x) + (xvect>>14);
|
||||
goaly = (*y) + (yvect>>14);
|
||||
goalx = (vect->x) + (xvect>>14);
|
||||
goaly = (vect->y) + (yvect>>14);
|
||||
|
||||
|
||||
clipnum = 0;
|
||||
|
||||
cx = (((*x)+goalx)>>1);
|
||||
cy = (((*y)+goaly)>>1);
|
||||
cx = (((vect->x)+goalx)>>1);
|
||||
cy = (((vect->y)+goaly)>>1);
|
||||
//Extra walldist for sprites on sector lines
|
||||
gx = goalx-(*x); gy = goaly-(*y);
|
||||
gx = goalx-(vect->x); gy = goaly-(vect->y);
|
||||
rad = nsqrtasm(gx*gx + gy*gy) + MAXCLIPDIST+walldist + 8;
|
||||
xmin = cx-rad; ymin = cy-rad;
|
||||
xmax = cx+rad; ymax = cy+rad;
|
||||
|
@ -9023,7 +9023,7 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y;
|
||||
|
||||
dx = x2-x1; dy = y2-y1;
|
||||
if (dx*((*y)-y1) < ((*x)-x1)*dy) continue; //If wall's not facing you
|
||||
if (dx*((vect->y)-y1) < ((vect->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);
|
||||
|
@ -9033,22 +9033,22 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
if ((wal->nextsector < 0) || (wal->cstat&dawalclipmask)) clipyou = 1;
|
||||
else if (editstatus == 0)
|
||||
{
|
||||
if (rintersect(*x,*y,0,gx,gy,0,x1,y1,x2,y2,&dax,&day,&daz) == 0)
|
||||
dax = *x, day = *y;
|
||||
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);
|
||||
|
||||
sec2 = §or[wal->nextsector];
|
||||
if (daz2 < daz-(1<<8))
|
||||
if ((sec2->floorstat&1) == 0)
|
||||
if ((*z) >= daz2-(flordist-1)) clipyou = 1;
|
||||
if ((vect->z) >= daz2-(flordist-1)) clipyou = 1;
|
||||
if (clipyou == 0)
|
||||
{
|
||||
daz = getceilzofslope((int16_t)dasect,dax,day);
|
||||
daz2 = getceilzofslope(wal->nextsector,dax,day);
|
||||
if (daz2 > daz+(1<<8))
|
||||
if ((sec2->ceilingstat&1) == 0)
|
||||
if ((*z) <= daz2+(ceildist-1)) clipyou = 1;
|
||||
if ((vect->z) <= daz2+(ceildist-1)) clipyou = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9088,7 +9088,7 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, 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 (((*z) < daz+ceildist) && ((*z) > daz-k-flordist))
|
||||
if (((vect->z) < daz+ceildist) && ((vect->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);
|
||||
|
@ -9103,7 +9103,7 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, 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 (((*z) < daz) && ((*z) > daz2))
|
||||
if (((vect->z) < daz) && ((vect->z) > daz2))
|
||||
{
|
||||
//These lines get the 2 points of the rotated sprite
|
||||
//Given: (x1, y1) starts out as the center point
|
||||
|
@ -9120,7 +9120,7 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
dax = mulscale14(sintable[(spr->ang+256+512)&2047],walldist);
|
||||
day = mulscale14(sintable[(spr->ang+256)&2047],walldist);
|
||||
|
||||
if ((x1-(*x))*(y2-(*y)) >= (x2-(*x))*(y1-(*y))) //Front
|
||||
if ((x1-(vect->x))*(y2-(vect->y)) >= (x2-(vect->x))*(y1-(vect->y))) //Front
|
||||
{
|
||||
addclipline(x1+dax,y1+day,x2+day,y2-dax,(int16_t)j+49152);
|
||||
}
|
||||
|
@ -9131,20 +9131,20 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
}
|
||||
|
||||
//Side blocker
|
||||
if ((x2-x1)*((*x)-x1) + (y2-y1)*((*y)-y1) < 0)
|
||||
{ addclipline(x1-day,y1+dax,x1+dax,y1+day,(int16_t)j+49152); }
|
||||
else if ((x1-x2)*((*x)-x2) + (y1-y2)*((*y)-y2) < 0)
|
||||
{ addclipline(x2+day,y2-dax,x2-dax,y2-day,(int16_t)j+49152); }
|
||||
if ((x2-x1)*((vect->x)-x1) + (y2-y1)*((vect->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)
|
||||
{ addclipline(x2+day,y2-dax,x2-dax,y2-day,(int16_t)j+49152); }
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
daz = spr->z+ceildist;
|
||||
daz2 = spr->z-flordist;
|
||||
if (((*z) < daz) && ((*z) > daz2))
|
||||
if (((vect->z) < daz) && ((vect->z) > daz2))
|
||||
{
|
||||
if ((cstat&64) != 0)
|
||||
if (((*z) > spr->z) == ((cstat&8)==0)) continue;
|
||||
if (((vect->z) > spr->z) == ((cstat&8)==0)) continue;
|
||||
|
||||
tilenum = spr->picnum;
|
||||
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
|
||||
|
@ -9170,23 +9170,23 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist);
|
||||
day = mulscale14(sintable[(spr->ang-256)&2047],walldist);
|
||||
|
||||
if ((rxi[0]-(*x))*(ryi[1]-(*y)) < (rxi[1]-(*x))*(ryi[0]-(*y)))
|
||||
if ((rxi[0]-(vect->x))*(ryi[1]-(vect->y)) < (rxi[1]-(vect->x))*(ryi[0]-(vect->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]-(*x))*(ryi[3]-(*y)) < (rxi[3]-(*x))*(ryi[2]-(*y)))
|
||||
else if ((rxi[2]-(vect->x))*(ryi[3]-(vect->y)) < (rxi[3]-(vect->x))*(ryi[2]-(vect->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]-(*x))*(ryi[2]-(*y)) < (rxi[2]-(*x))*(ryi[1]-(*y)))
|
||||
if ((rxi[1]-(vect->x))*(ryi[2]-(vect->y)) < (rxi[2]-(vect->x))*(ryi[1]-(vect->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]-(*x))*(ryi[0]-(*y)) < (rxi[0]-(*x))*(ryi[3]-(*y)))
|
||||
else if ((rxi[3]-(vect->x))*(ryi[0]-(vect->y)) < (rxi[0]-(vect->x))*(ryi[3]-(vect->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);
|
||||
|
@ -9204,7 +9204,7 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
do
|
||||
{
|
||||
intx = goalx; inty = goaly;
|
||||
if ((hitwall = raytrace(*x, *y, &intx, &inty)) >= 0)
|
||||
if ((hitwall = raytrace(vect->x, vect->y, &intx, &inty)) >= 0)
|
||||
{
|
||||
lx = clipit[hitwall].x2-clipit[hitwall].x1;
|
||||
ly = clipit[hitwall].y2-clipit[hitwall].y1;
|
||||
|
@ -9228,7 +9228,7 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
tempint2 = dmulscale6(clipit[j].x2-clipit[j].x1,oxvect,clipit[j].y2-clipit[j].y1,oyvect);
|
||||
if ((tempint1^tempint2) < 0)
|
||||
{
|
||||
updatesector(*x,*y,sectnum);
|
||||
updatesector(vect->x,vect->y,sectnum);
|
||||
return(retval);
|
||||
}
|
||||
}
|
||||
|
@ -9242,58 +9242,58 @@ int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
}
|
||||
cnt--;
|
||||
|
||||
*x = intx;
|
||||
*y = inty;
|
||||
vect->x = intx;
|
||||
vect->y = inty;
|
||||
}
|
||||
while (((xvect|yvect) != 0) && (hitwall >= 0) && (cnt > 0));
|
||||
|
||||
for (j=0;j<clipsectnum;j++)
|
||||
if (inside(*x,*y,clipsectorlist[j]) == 1)
|
||||
if (inside(vect->x,vect->y,clipsectorlist[j]) == 1)
|
||||
{
|
||||
*sectnum = clipsectorlist[j];
|
||||
return(retval);
|
||||
}
|
||||
|
||||
*sectnum = -1; tempint1 = 0x7fffffff;
|
||||
for (j=numsectors-1;j>=0;j--)
|
||||
if (inside(*x,*y,j) == 1)
|
||||
{
|
||||
if (sector[j].ceilingstat&2)
|
||||
tempint2 = (getceilzofslope((int16_t)j,*x,*y)-(*z));
|
||||
else
|
||||
tempint2 = (sector[j].ceilingz-(*z));
|
||||
|
||||
if (tempint2 > 0)
|
||||
*sectnum = -1; tempint1 = 0x7fffffff;
|
||||
for (j=numsectors-1;j>=0;j--)
|
||||
if (inside(vect->x,vect->y,j) == 1)
|
||||
{
|
||||
if (tempint2 < tempint1)
|
||||
{ *sectnum = j; tempint1 = tempint2; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sector[j].floorstat&2)
|
||||
tempint2 = ((*z)-getflorzofslope((int16_t)j,*x,*y));
|
||||
if (sector[j].ceilingstat&2)
|
||||
tempint2 = (getceilzofslope((int16_t)j,vect->x,vect->y)-(vect->z));
|
||||
else
|
||||
tempint2 = ((*z)-sector[j].floorz);
|
||||
tempint2 = (sector[j].ceilingz-(vect->z));
|
||||
|
||||
if (tempint2 <= 0)
|
||||
if (tempint2 > 0)
|
||||
{
|
||||
*sectnum = j;
|
||||
return(retval);
|
||||
}
|
||||
if (tempint2 < tempint1)
|
||||
if (tempint2 < tempint1)
|
||||
{ *sectnum = j; tempint1 = tempint2; }
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sector[j].floorstat&2)
|
||||
tempint2 = ((vect->z)-getflorzofslope((int16_t)j,vect->x,vect->y));
|
||||
else
|
||||
tempint2 = ((vect->z)-sector[j].floorz);
|
||||
|
||||
return(retval);
|
||||
if (tempint2 <= 0)
|
||||
{
|
||||
*sectnum = j;
|
||||
return(retval);
|
||||
}
|
||||
if (tempint2 < tempint1)
|
||||
{ *sectnum = j; tempint1 = tempint2; }
|
||||
}
|
||||
}
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// pushmove
|
||||
//
|
||||
int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
||||
int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype)
|
||||
int32_t pushmove(vec3_t *vect, int16_t *sectnum,
|
||||
int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype)
|
||||
{
|
||||
sectortype *sec, *sec2;
|
||||
walltype *wal;
|
||||
|
@ -9320,35 +9320,35 @@ int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
/*Push FACE sprites
|
||||
for(i=headspritesect[clipsectorlist[clipsectcnt]];i>=0;i=nextspritesect[i])
|
||||
{
|
||||
spr = &sprite[i];
|
||||
if (((spr->cstat&48) != 0) && ((spr->cstat&48) != 48)) continue;
|
||||
if ((spr->cstat&dasprclipmask) == 0) continue;
|
||||
spr = &sprite[i];
|
||||
if (((spr->cstat&48) != 0) && ((spr->cstat&48) != 48)) continue;
|
||||
if ((spr->cstat&dasprclipmask) == 0) continue;
|
||||
|
||||
dax = (*x)-spr->x; day = (*y)-spr->y;
|
||||
t = (spr->clipdist<<2)+walldist;
|
||||
if ((klabs(dax) < t) && (klabs(day) < t))
|
||||
{
|
||||
t = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
|
||||
if (spr->cstat&128) daz = spr->z+(t>>1); else daz = spr->z;
|
||||
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
|
||||
if (((*z) < daz+ceildist) && ((*z) > daz-t-flordist))
|
||||
{
|
||||
t = (spr->clipdist<<2)+walldist;
|
||||
dax = (vect->x)-spr->x; day = (vect->y)-spr->y;
|
||||
t = (spr->clipdist<<2)+walldist;
|
||||
if ((klabs(dax) < t) && (klabs(day) < t))
|
||||
{
|
||||
t = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
|
||||
if (spr->cstat&128) daz = spr->z+(t>>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-t-flordist))
|
||||
{
|
||||
t = (spr->clipdist<<2)+walldist;
|
||||
|
||||
j = getangle(dax,day);
|
||||
dx = (sintable[(j+512)&2047]>>11);
|
||||
dy = (sintable[(j)&2047]>>11);
|
||||
bad2 = 16;
|
||||
do
|
||||
{
|
||||
*x = (*x) + dx; *y = (*y) + dy;
|
||||
bad2--; if (bad2 == 0) break;
|
||||
} while ((klabs((*x)-spr->x) < t) && (klabs((*y)-spr->y) < t));
|
||||
bad = -1;
|
||||
k--; if (k <= 0) return(bad);
|
||||
updatesector(*x,*y,sectnum);
|
||||
}
|
||||
}
|
||||
j = getangle(dax,day);
|
||||
dx = (sintable[(j+512)&2047]>>11);
|
||||
dy = (sintable[(j)&2047]>>11);
|
||||
bad2 = 16;
|
||||
do
|
||||
{
|
||||
vect->x = (vect->x) + dx; vect->y = (vect->y) + dy;
|
||||
bad2--; if (bad2 == 0) break;
|
||||
} while ((klabs((vect->x)-spr->x) < t) && (klabs((vect->y)-spr->y) < t));
|
||||
bad = -1;
|
||||
k--; if (k <= 0) return(bad);
|
||||
updatesector(vect->x,vect->y,sectnum);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
sec = §or[clipsectorlist[clipsectcnt]];
|
||||
|
@ -9358,7 +9358,7 @@ int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
endwall = sec->wallptr, startwall = endwall + sec->wallnum;
|
||||
|
||||
for (i=startwall,wal=&wall[startwall];i!=endwall;i+=dir,wal+=dir)
|
||||
if (clipinsidebox(*x,*y,i,walldist-4) == 1)
|
||||
if (clipinsidebox(vect->x,vect->y,i,walldist-4) == 1)
|
||||
{
|
||||
j = 0;
|
||||
if (wal->nextsector < 0) j = 1;
|
||||
|
@ -9368,10 +9368,10 @@ int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
sec2 = §or[wal->nextsector];
|
||||
|
||||
|
||||
//Find closest point on wall (dax, day) to (*x, *y)
|
||||
//Find closest point on wall (dax, day) to (vect->x, vect->y)
|
||||
dax = wall[wal->point2].x-wal->x;
|
||||
day = wall[wal->point2].y-wal->y;
|
||||
daz = dax*((*x)-wal->x) + day*((*y)-wal->y);
|
||||
daz = dax*((vect->x)-wal->x) + day*((vect->y)-wal->y);
|
||||
if (daz <= 0)
|
||||
t = 0;
|
||||
else
|
||||
|
@ -9386,12 +9386,12 @@ int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
daz = getflorzofslope(clipsectorlist[clipsectcnt],dax,day);
|
||||
daz2 = getflorzofslope(wal->nextsector,dax,day);
|
||||
if ((daz2 < daz-(1<<8)) && ((sec2->floorstat&1) == 0))
|
||||
if (*z >= daz2-(flordist-1)) j = 1;
|
||||
if (vect->z >= daz2-(flordist-1)) j = 1;
|
||||
|
||||
daz = getceilzofslope(clipsectorlist[clipsectcnt],dax,day);
|
||||
daz2 = getceilzofslope(wal->nextsector,dax,day);
|
||||
if ((daz2 > daz+(1<<8)) && ((sec2->ceilingstat&1) == 0))
|
||||
if (*z <= daz2+(ceildist-1)) j = 1;
|
||||
if (vect->z <= daz2+(ceildist-1)) j = 1;
|
||||
}
|
||||
if (j != 0)
|
||||
{
|
||||
|
@ -9401,13 +9401,13 @@ int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
bad2 = 16;
|
||||
do
|
||||
{
|
||||
*x = (*x) + dx; *y = (*y) + dy;
|
||||
vect->x = (vect->x) + dx; vect->y = (vect->y) + dy;
|
||||
bad2--; if (bad2 == 0) break;
|
||||
}
|
||||
while (clipinsidebox(*x,*y,i,walldist-4) != 0);
|
||||
while (clipinsidebox(vect->x,vect->y,i,walldist-4) != 0);
|
||||
bad = -1;
|
||||
k--; if (k <= 0) return(bad);
|
||||
updatesector(*x,*y,sectnum);
|
||||
updatesector(vect->x,vect->y,sectnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -9417,7 +9417,7 @@ int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
|
|||
}
|
||||
}
|
||||
|
||||
clipsectcnt++;
|
||||
clipsectcnt++;
|
||||
}
|
||||
while (clipsectcnt < clipsectnum);
|
||||
dir = -dir;
|
||||
|
@ -9548,7 +9548,7 @@ int32_t krand(void)
|
|||
//
|
||||
// getzrange
|
||||
//
|
||||
void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
||||
void getzrange(const vec3_t *vect, int16_t sectnum,
|
||||
int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit,
|
||||
int32_t walldist, uint32_t cliptype)
|
||||
{
|
||||
|
@ -9560,6 +9560,7 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
int32_t x1, y1, x2, y2, x3, y3, x4, y4, ang, cosang, sinang;
|
||||
int32_t xspan, yspan, xrepeat, yrepeat, dasprclipmask, dawalclipmask;
|
||||
int16_t cstat;
|
||||
|
||||
char clipyou;
|
||||
|
||||
if (sectnum < 0)
|
||||
|
@ -9571,10 +9572,10 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
|
||||
//Extra walldist for sprites on sector lines
|
||||
i = walldist+MAXCLIPDIST+1;
|
||||
xmin = x-i; ymin = y-i;
|
||||
xmax = x+i; ymax = y+i;
|
||||
xmin = vect->x-i; ymin = vect->y-i;
|
||||
xmax = vect->x+i; ymax = vect->y+i;
|
||||
|
||||
getzsofslope(sectnum,x,y,ceilz,florz);
|
||||
getzsofslope(sectnum,vect->x,vect->y,ceilz,florz);
|
||||
*ceilhit = sectnum+16384; *florhit = sectnum+16384;
|
||||
|
||||
dawalclipmask = (cliptype&65535);
|
||||
|
@ -9601,7 +9602,7 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
if ((y1 > ymax) && (y2 > ymax)) continue;
|
||||
|
||||
dx = x2-x1; dy = y2-y1;
|
||||
if (dx*(y-y1) < (x-x1)*dy) continue; //back
|
||||
if (dx*(vect->y-y1) < (vect->x-x1)*dy) continue; //back
|
||||
if (dx > 0) dax = dx*(ymin-y1); else dax = dx*(ymax-y1);
|
||||
if (dy > 0) day = dy*(xmax-x1); else day = dy*(xmin-x1);
|
||||
if (dax >= day) continue;
|
||||
|
@ -9610,8 +9611,8 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
sec = §or[k];
|
||||
if (editstatus == 0)
|
||||
{
|
||||
if (((sec->ceilingstat&1) == 0) && (z <= sec->ceilingz+(3<<8))) continue;
|
||||
if (((sec->floorstat&1) == 0) && (z >= sec->floorz-(3<<8))) continue;
|
||||
if (((sec->ceilingstat&1) == 0) && (vect->z <= sec->ceilingz+(3<<8))) continue;
|
||||
if (((sec->floorstat&1) == 0) && (vect->z >= sec->floorz-(3<<8))) continue;
|
||||
}
|
||||
|
||||
for (i=clipsectnum-1;i>=0;i--) if (clipsectorlist[i] == k) break;
|
||||
|
@ -9626,7 +9627,7 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
if (dax >= day) continue;
|
||||
|
||||
//It actually got here, through all the continue's!!!
|
||||
getzsofslope((int16_t)k,x,y,&daz,&daz2);
|
||||
getzsofslope((int16_t)k,vect->x,vect->y,&daz,&daz2);
|
||||
if (daz > *ceilz) { *ceilz = daz; *ceilhit = k+16384; }
|
||||
if (daz2 < *florz) { *florz = daz2; *florhit = k+16384; }
|
||||
}
|
||||
|
@ -9650,7 +9651,7 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
{
|
||||
case 0:
|
||||
k = walldist+(spr->clipdist<<2)+1;
|
||||
if ((klabs(x1-x) <= k) && (klabs(y1-y) <= k))
|
||||
if ((klabs(x1-vect->x) <= k) && (klabs(y1-vect->y) <= k))
|
||||
{
|
||||
daz = spr->z;
|
||||
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
|
||||
|
@ -9669,7 +9670,7 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
l = tilesizx[tilenum]; k = (l>>1)+xoff;
|
||||
x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l);
|
||||
y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l);
|
||||
if (clipinsideboxline(x,y,x1,y1,x2,y2,walldist+1) != 0)
|
||||
if (clipinsideboxline(vect->x,vect->y,x1,y1,x2,y2,walldist+1) != 0)
|
||||
{
|
||||
daz = spr->z; k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
|
||||
if (cstat&128) daz += k;
|
||||
|
@ -9682,7 +9683,7 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
daz = spr->z; daz2 = daz;
|
||||
|
||||
if ((cstat&64) != 0)
|
||||
if ((z > daz) == ((cstat&8)==0)) continue;
|
||||
if ((vect->z > daz) == ((cstat&8)==0)) continue;
|
||||
|
||||
tilenum = spr->picnum;
|
||||
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
|
||||
|
@ -9696,8 +9697,8 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
|
||||
|
||||
dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat;
|
||||
x1 += dmulscale16(sinang,dax,cosang,day)-x;
|
||||
y1 += dmulscale16(sinang,day,-cosang,dax)-y;
|
||||
x1 += dmulscale16(sinang,dax,cosang,day)-vect->x;
|
||||
y1 += dmulscale16(sinang,day,-cosang,dax)-vect->y;
|
||||
l = xspan*xrepeat;
|
||||
x2 = x1 - mulscale16(sinang,l);
|
||||
y2 = y1 + mulscale16(cosang,l);
|
||||
|
@ -9735,8 +9736,8 @@ void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
|
||||
if (clipyou != 0)
|
||||
{
|
||||
if ((z > daz) && (daz > *ceilz)) { *ceilz = daz; *ceilhit = j+49152; }
|
||||
if ((z < daz2) && (daz2 < *florz)) { *florz = daz2; *florhit = j+49152; }
|
||||
if ((vect->z > daz) && (daz > *ceilz)) { *ceilz = daz; *ceilhit = j+49152; }
|
||||
if ((vect->z < daz2) && (daz2 < *florz)) { *florz = daz2; *florhit = j+49152; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4421,9 +4421,10 @@ void polymost_drawrooms()
|
|||
|
||||
if (searchit == 2)
|
||||
{
|
||||
int16_t hitsect, hitwall, hitsprite;
|
||||
int32_t vx, vy, vz, hitx, hity, hitz;
|
||||
int32_t vx, vy, vz;
|
||||
int32_t cz, fz;
|
||||
hitdata_t hitinfo;
|
||||
vec3_t vect;
|
||||
double ratio = 1.05;
|
||||
|
||||
if (glwidescreen == 1)
|
||||
|
@ -4458,37 +4459,41 @@ void polymost_drawrooms()
|
|||
vy = (int32_t)(ox2*((float)singlobalang) + oy2*((float)cosglobalang));
|
||||
vz = (int32_t)(oz2*16384.0);
|
||||
|
||||
vect.x = globalposx;
|
||||
vect.y = globalposy;
|
||||
vect.z = globalposz;
|
||||
|
||||
hitallsprites = 1;
|
||||
hitscan(globalposx,globalposy,globalposz,globalcursectnum, //Start position
|
||||
vx>>12,vy>>12,vz>>8,&hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,0xffff0030);
|
||||
getzsofslope(hitsect,hitx,hity,&cz,&fz);
|
||||
hitscan((const vec3_t *)&vect,globalcursectnum, //Start position
|
||||
vx>>12,vy>>12,vz>>8,&hitinfo,0xffff0030);
|
||||
getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz);
|
||||
hitallsprites = 0;
|
||||
|
||||
searchsector = hitsect;
|
||||
if (hitz<cz) searchstat = 1;else
|
||||
if (hitz>fz) searchstat = 2;else
|
||||
if (hitwall >= 0)
|
||||
searchsector = hitinfo.hitsect;
|
||||
if (hitinfo.pos.z<cz) searchstat = 1;else
|
||||
if (hitinfo.pos.z>fz) searchstat = 2;else
|
||||
if (hitinfo.hitwall >= 0)
|
||||
{
|
||||
searchwall = hitwall; searchstat = 0;
|
||||
if (wall[hitwall].nextwall >= 0)
|
||||
searchwall = hitinfo.hitwall; searchstat = 0;
|
||||
if (wall[hitinfo.hitwall].nextwall >= 0)
|
||||
{
|
||||
int32_t cz, fz;
|
||||
getzsofslope(wall[hitwall].nextsector,hitx,hity,&cz,&fz);
|
||||
if (hitz > fz)
|
||||
getzsofslope(wall[hitinfo.hitwall].nextsector,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz);
|
||||
if (hitinfo.pos.z > fz)
|
||||
{
|
||||
if (wall[hitwall].cstat&2) //'2' bottoms of walls
|
||||
searchwall = wall[hitwall].nextwall;
|
||||
if (wall[hitinfo.hitwall].cstat&2) //'2' bottoms of walls
|
||||
searchwall = wall[hitinfo.hitwall].nextwall;
|
||||
}
|
||||
else if ((hitz > cz) && (wall[hitwall].cstat&(16+32))) //masking or 1-way
|
||||
else if ((hitinfo.pos.z > cz) && (wall[hitinfo.hitwall].cstat&(16+32))) //masking or 1-way
|
||||
searchstat = 4;
|
||||
}
|
||||
}
|
||||
else if (hitsprite >= 0) { searchwall = hitsprite; searchstat = 3; }
|
||||
else if (hitinfo.hitsprite >= 0) { searchwall = hitinfo.hitsprite; searchstat = 3; }
|
||||
else
|
||||
{
|
||||
int32_t cz, fz;
|
||||
getzsofslope(hitsect,hitx,hity,&cz,&fz);
|
||||
if ((hitz<<1) < cz+fz) searchstat = 1; else searchstat = 2;
|
||||
getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz);
|
||||
if ((hitinfo.pos.z<<1) < cz+fz) searchstat = 1; else searchstat = 2;
|
||||
//if (vz < 0) searchstat = 1; else searchstat = 2; //Won't work for slopes :/
|
||||
}
|
||||
searchit = 0;
|
||||
|
@ -4563,6 +4568,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
|
|||
float fy, x0, x1, sx0, sy0, sx1, sy1, xp0, yp0, xp1, yp1, oxp0, oyp0, ryp0, ryp1;
|
||||
float r, t, t0, t1, csy[4], fsy[4];
|
||||
int32_t i, j, n, n2, z, sectnum, z1, z2, cz[4], fz[4], method;
|
||||
int32_t m0, m1;
|
||||
sectortype *sec, *nsec;
|
||||
walltype *wal, *wal2;
|
||||
|
||||
|
@ -4604,10 +4610,14 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
|
|||
if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; yp1 = SCISDIST; }
|
||||
else { t1 = 1.f; }
|
||||
|
||||
getzsofslope(sectnum,(int32_t)((wal2->x-wal->x)*t0+wal->x),(int32_t)((wal2->y-wal->y)*t0+wal->y),&cz[0],&fz[0]);
|
||||
getzsofslope(wal->nextsector,(int32_t)((wal2->x-wal->x)*t0+wal->x),(int32_t)((wal2->y-wal->y)*t0+wal->y),&cz[1],&fz[1]);
|
||||
getzsofslope(sectnum,(int32_t)((wal2->x-wal->x)*t1+wal->x),(int32_t)((wal2->y-wal->y)*t1+wal->y),&cz[2],&fz[2]);
|
||||
getzsofslope(wal->nextsector,(int32_t)((wal2->x-wal->x)*t1+wal->x),(int32_t)((wal2->y-wal->y)*t1+wal->y),&cz[3],&fz[3]);
|
||||
m0 = (int32_t)((wal2->x-wal->x)*t0+wal->x);
|
||||
m1 = (int32_t)((wal2->y-wal->y)*t0+wal->y);
|
||||
getzsofslope(sectnum,m0,m1,&cz[0],&fz[0]);
|
||||
getzsofslope(wal->nextsector,m0,m1,&cz[1],&fz[1]);
|
||||
m0 = (int32_t)((wal2->x-wal->x)*t1+wal->x);
|
||||
m1 = (int32_t)((wal2->y-wal->y)*t1+wal->y);
|
||||
getzsofslope(sectnum,m0,m1,&cz[2],&fz[2]);
|
||||
getzsofslope(wal->nextsector,m0,m1,&cz[3],&fz[3]);
|
||||
|
||||
ryp0 = 1.f/yp0; ryp1 = 1.f/yp1;
|
||||
|
||||
|
|
|
@ -475,10 +475,11 @@ BOLT:
|
|||
|
||||
int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
|
||||
{
|
||||
int32_t daz, oldx, oldy;
|
||||
int32_t oldx, oldy;
|
||||
int32_t retval;
|
||||
int16_t dasectnum, cd;
|
||||
int32_t bg = A_CheckEnemySprite(&sprite[spritenum]);
|
||||
int32_t dazoff = ((tilesizy[sprite[spritenum].picnum]*sprite[spritenum].yrepeat)<<1);
|
||||
|
||||
if (sprite[spritenum].statnum == 5 || (bg && sprite[spritenum].xrepeat < 4))
|
||||
{
|
||||
|
@ -486,13 +487,13 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
|
|||
sprite[spritenum].y += (change->y*TICSPERFRAME)>>2;
|
||||
sprite[spritenum].z += (change->z*TICSPERFRAME)>>2;
|
||||
if (bg)
|
||||
setsprite(spritenum,sprite[spritenum].x,sprite[spritenum].y,sprite[spritenum].z);
|
||||
setsprite(spritenum,(vec3_t *)&sprite[spritenum]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dasectnum = sprite[spritenum].sectnum;
|
||||
|
||||
daz = sprite[spritenum].z - ((tilesizy[sprite[spritenum].picnum]*sprite[spritenum].yrepeat)<<1);
|
||||
// daz = sprite[spritenum].z - ;
|
||||
|
||||
if (bg)
|
||||
{
|
||||
|
@ -500,7 +501,11 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
|
|||
oldy = sprite[spritenum].y;
|
||||
|
||||
if (sprite[spritenum].xrepeat > 60)
|
||||
retval = clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype);
|
||||
{
|
||||
sprite[spritenum].z -= dazoff;
|
||||
retval = clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype);
|
||||
sprite[spritenum].z += dazoff;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sprite[spritenum].picnum == LIZMAN)
|
||||
|
@ -510,7 +515,9 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
|
|||
else
|
||||
cd = 192L;
|
||||
|
||||
retval = clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype);
|
||||
sprite[spritenum].z -= dazoff;
|
||||
retval = clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype);
|
||||
sprite[spritenum].z += dazoff;
|
||||
}
|
||||
|
||||
if (dasectnum < 0 || (dasectnum >= 0 &&
|
||||
|
@ -523,11 +530,13 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
|
|||
{
|
||||
sprite[spritenum].x = oldx;
|
||||
sprite[spritenum].y = oldy;
|
||||
/* if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && sprite[spritenum].picnum == LIZMAN)
|
||||
sprite[spritenum].ang = (krand()&2047);
|
||||
else if ((ActorExtra[spritenum].temp_data[0]&3) == 1 && sprite[spritenum].picnum != COMMANDER)
|
||||
sprite[spritenum].ang = (krand()&2047); */
|
||||
setsprite(spritenum,oldx,oldy,sprite[spritenum].z);
|
||||
/*
|
||||
if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && sprite[spritenum].picnum == LIZMAN)
|
||||
sprite[spritenum].ang = (krand()&2047);
|
||||
else if ((ActorExtra[spritenum].temp_data[0]&3) == 1 && sprite[spritenum].picnum != COMMANDER)
|
||||
sprite[spritenum].ang = (krand()&2047);
|
||||
*/
|
||||
setsprite(spritenum,(vec3_t *)&sprite[spritenum]);
|
||||
if (dasectnum < 0) dasectnum = 0;
|
||||
return (16384+dasectnum);
|
||||
}
|
||||
|
@ -535,22 +544,28 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
|
|||
}
|
||||
else
|
||||
{
|
||||
sprite[spritenum].z -= dazoff;
|
||||
if (sprite[spritenum].statnum == 4)
|
||||
retval =
|
||||
clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype);
|
||||
clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype);
|
||||
else
|
||||
retval =
|
||||
clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),(int32_t)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype);
|
||||
clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),(int32_t)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype);
|
||||
sprite[spritenum].z += dazoff;
|
||||
}
|
||||
|
||||
if (dasectnum >= 0)
|
||||
if ((dasectnum != sprite[spritenum].sectnum))
|
||||
changespritesect(spritenum,dasectnum);
|
||||
daz = sprite[spritenum].z + ((change->z*TICSPERFRAME)>>3);
|
||||
if ((daz > ActorExtra[spritenum].ceilingz) && (daz <= ActorExtra[spritenum].floorz))
|
||||
sprite[spritenum].z = daz;
|
||||
else if (retval == 0)
|
||||
return(16384+dasectnum);
|
||||
{
|
||||
int32_t daz;
|
||||
|
||||
if (dasectnum >= 0)
|
||||
if ((dasectnum != sprite[spritenum].sectnum))
|
||||
changespritesect(spritenum,dasectnum);
|
||||
daz = sprite[spritenum].z + ((change->z*TICSPERFRAME)>>3);
|
||||
if ((daz > ActorExtra[spritenum].ceilingz) && (daz <= ActorExtra[spritenum].floorz))
|
||||
sprite[spritenum].z = daz;
|
||||
else if (retval == 0)
|
||||
return(16384+dasectnum);
|
||||
}
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
@ -1023,7 +1038,7 @@ void A_MoveDummyPlayers(void)
|
|||
|
||||
SX += (g_player[p].ps->posx-g_player[p].ps->oposx);
|
||||
SY += (g_player[p].ps->posy-g_player[p].ps->oposy);
|
||||
setsprite(i,SX,SY,SZ);
|
||||
setsprite(i,(vec3_t *)&sprite[i]);
|
||||
|
||||
BOLT:
|
||||
|
||||
|
@ -1054,7 +1069,7 @@ static void G_MovePlayers(void) //Players
|
|||
s->y = p->oposy;
|
||||
ActorExtra[i].bposz = s->z = p->oposz+PHEIGHT;
|
||||
s->ang = p->oang;
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1155,7 +1170,7 @@ static void G_MovePlayers(void) //Players
|
|||
else
|
||||
{
|
||||
s->ang = 2047-p->ang;
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1408,10 +1423,18 @@ static void G_MoveStandables(void)
|
|||
case 2:
|
||||
case 6:
|
||||
case 10:
|
||||
{
|
||||
vec3_t vect;
|
||||
|
||||
vect.x = msx[t[4]+1];
|
||||
vect.y = msy[t[4]+1];
|
||||
vect.z = sprite[j].z;
|
||||
s->ang = getangle(msx[t[4]+1]-s->x,msy[t[4]+1]-s->y);
|
||||
setsprite(j,msx[t[4]+1],msy[t[4]+1],sprite[j].z);
|
||||
setsprite(j,&vect);
|
||||
t[0]++;
|
||||
goto BOLT;
|
||||
|
||||
}
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
|
@ -1465,7 +1488,7 @@ static void G_MoveStandables(void)
|
|||
s->picnum++;
|
||||
if (s->picnum == (CRANE+2))
|
||||
{
|
||||
p = CheckPlayerInSector(t[1]);
|
||||
p = G_CheckPlayerInSector(t[1]);
|
||||
if (p >= 0 && g_player[p].ps->on_ground)
|
||||
{
|
||||
s->owner = -2;
|
||||
|
@ -1527,7 +1550,13 @@ static void G_MoveStandables(void)
|
|||
else if (t[0]==9)
|
||||
t[0] = 0;
|
||||
|
||||
setsprite(msy[t[4]+2],s->x,s->y,s->z-(34<<8));
|
||||
{
|
||||
vec3_t vect;
|
||||
Bmemcpy(&vect,s,sizeof(vec3_t));
|
||||
vect.z -= (34<<8);
|
||||
setsprite(msy[t[4]+2],&vect);
|
||||
}
|
||||
|
||||
|
||||
if (s->owner != -1)
|
||||
{
|
||||
|
@ -1545,7 +1574,7 @@ static void G_MoveStandables(void)
|
|||
|
||||
if (s->owner >= 0)
|
||||
{
|
||||
setsprite(s->owner,s->x,s->y,s->z);
|
||||
setsprite(s->owner,(vec3_t *)s);
|
||||
|
||||
ActorExtra[s->owner].bposx = s->x;
|
||||
ActorExtra[s->owner].bposy = s->y;
|
||||
|
@ -1555,10 +1584,17 @@ static void G_MoveStandables(void)
|
|||
}
|
||||
else if (s->owner == -2)
|
||||
{
|
||||
vec3_t vect;
|
||||
|
||||
g_player[p].ps->oposx = g_player[p].ps->posx = s->x-(sintable[(g_player[p].ps->ang+512)&2047]>>6);
|
||||
g_player[p].ps->oposy = g_player[p].ps->posy = s->y-(sintable[g_player[p].ps->ang&2047]>>6);
|
||||
g_player[p].ps->oposz = g_player[p].ps->posz = s->z+(2<<8);
|
||||
setsprite(g_player[p].ps->i,g_player[p].ps->posx,g_player[p].ps->posy,g_player[p].ps->posz);
|
||||
|
||||
vect.x = g_player[p].ps->posx;
|
||||
vect.y = g_player[p].ps->posy;
|
||||
vect.z = g_player[p].ps->posz;
|
||||
|
||||
setsprite(g_player[p].ps->i,&vect);
|
||||
g_player[p].ps->cursectnum = sprite[g_player[p].ps->i].sectnum;
|
||||
}
|
||||
}
|
||||
|
@ -1711,7 +1747,7 @@ static void G_MoveStandables(void)
|
|||
s->x += sintable[(T6+512)&2047]>>9;
|
||||
s->y += sintable[(T6)&2047]>>9;
|
||||
s->z -= (3<<8);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
x = A_CheckHitSprite(i,&m);
|
||||
|
||||
|
@ -1729,7 +1765,7 @@ static void G_MoveStandables(void)
|
|||
while (x > 0)
|
||||
{
|
||||
j = A_Spawn(i,LASERLINE);
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
sprite[j].hitag = s->hitag;
|
||||
ActorExtra[j].temp_data[1] = sprite[j].z;
|
||||
|
||||
|
@ -1748,7 +1784,7 @@ static void G_MoveStandables(void)
|
|||
s->x = T4;
|
||||
s->y = T5;
|
||||
s->z += (3<<8);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
T4 = 0;
|
||||
// if( m >= 0 && lTripBombControl & TRIPBOMB_TRIPWIRE)
|
||||
if (m >= 0 && ActorExtra[i].temp_data[6] != 1)
|
||||
|
@ -1769,14 +1805,14 @@ static void G_MoveStandables(void)
|
|||
s->x += sintable[(T6+512)&2047]>>9;
|
||||
s->y += sintable[(T6)&2047]>>9;
|
||||
s->z -= (3<<8);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
x = A_CheckHitSprite(i,&m);
|
||||
|
||||
s->x = T4;
|
||||
s->y = T5;
|
||||
s->z += (3<<8);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
// if( ActorExtra[i].lastvx != x && lTripBombControl & TRIPBOMB_TRIPWIRE)
|
||||
if (ActorExtra[i].lastvx != x && ActorExtra[i].temp_data[6] != 1)
|
||||
|
@ -2211,7 +2247,7 @@ CLEAR_THE_BOLT:
|
|||
else
|
||||
{
|
||||
sector[sect].floorz += sector[sect].extra;
|
||||
p = CheckPlayerInSector(sect);
|
||||
p = G_CheckPlayerInSector(sect);
|
||||
if (p >= 0) g_player[p].ps->posz += sector[sect].extra;
|
||||
}
|
||||
}
|
||||
|
@ -2225,7 +2261,7 @@ CLEAR_THE_BOLT:
|
|||
else
|
||||
{
|
||||
sector[sect].floorz -= sector[sect].extra;
|
||||
p = CheckPlayerInSector(sect);
|
||||
p = G_CheckPlayerInSector(sect);
|
||||
if (p >= 0)
|
||||
g_player[p].ps->posz -= sector[sect].extra;
|
||||
}
|
||||
|
@ -2235,7 +2271,7 @@ CLEAR_THE_BOLT:
|
|||
|
||||
if (t[5] == 1) goto BOLT;
|
||||
|
||||
p = CheckPlayerInSector(sect);
|
||||
p = G_CheckPlayerInSector(sect);
|
||||
if (p >= 0 && (g_player[p].ps->on_ground || s->ang == 512))
|
||||
{
|
||||
if (t[0] == 0 && !G_CheckActivatorMotion(s->lotag))
|
||||
|
@ -2680,10 +2716,10 @@ static void G_MoveWeapons(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
vec3_t tmpvect;
|
||||
setsprite(i,davect.x,davect.y,davect.z);
|
||||
Bmemcpy(&tmpvect, s, sizeof(int32_t) * 3);
|
||||
A_DamageWall(i,j,&tmpvect,s->picnum);
|
||||
// vec3_t tmpvect;
|
||||
setsprite(i,&davect);
|
||||
// Bmemcpy(&tmpvect, s, sizeof(int32_t) * 3);
|
||||
A_DamageWall(i,j,(vec3_t *)s,s->picnum);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS)
|
||||
{
|
||||
|
@ -2709,7 +2745,7 @@ static void G_MoveWeapons(void)
|
|||
}
|
||||
else if ((j&49152) == 16384)
|
||||
{
|
||||
setsprite(i,davect.x,davect.y,davect.z);
|
||||
setsprite(i,&davect);
|
||||
|
||||
if (s->zvel < 0)
|
||||
{
|
||||
|
@ -3002,7 +3038,7 @@ static void G_MoveWeapons(void)
|
|||
else
|
||||
{
|
||||
vec3_t tmpvect;
|
||||
setsprite(i,davect.x,davect.y,davect.z);
|
||||
setsprite(i,&davect);
|
||||
Bmemcpy(&tmpvect, s, sizeof(int32_t) * 3);
|
||||
A_DamageWall(i,j,&tmpvect,s->picnum);
|
||||
|
||||
|
@ -3024,7 +3060,7 @@ static void G_MoveWeapons(void)
|
|||
}
|
||||
else if ((j&49152) == 16384)
|
||||
{
|
||||
setsprite(i,davect.x,davect.y,davect.z);
|
||||
setsprite(i,&davect);
|
||||
|
||||
if (s->zvel < 0)
|
||||
{
|
||||
|
@ -3284,6 +3320,7 @@ static void G_MoveTransports(void)
|
|||
|
||||
if (k == 1)
|
||||
{
|
||||
vec3_t vect;
|
||||
g_player[p].ps->oposx = g_player[p].ps->posx += sprite[OW].x-SX;
|
||||
g_player[p].ps->oposy = g_player[p].ps->posy += sprite[OW].y-SY;
|
||||
|
||||
|
@ -3292,7 +3329,12 @@ static void G_MoveTransports(void)
|
|||
g_player[p].ps->cursectnum = sprite[OW].sectnum;
|
||||
|
||||
changespritesect(j,sprite[OW].sectnum);
|
||||
setsprite(g_player[p].ps->i,g_player[p].ps->posx,g_player[p].ps->posy,g_player[p].ps->posz+PHEIGHT);
|
||||
|
||||
vect.x = g_player[p].ps->posx;
|
||||
vect.y = g_player[p].ps->posy;
|
||||
vect.z = g_player[p].ps->posz+PHEIGHT;
|
||||
|
||||
setsprite(g_player[p].ps->i,&vect);
|
||||
|
||||
P_UpdateScreenPal(g_player[p].ps);
|
||||
|
||||
|
@ -3387,7 +3429,7 @@ static void G_MoveTransports(void)
|
|||
case 0:
|
||||
if (onfloorz)
|
||||
{
|
||||
if (sprite[j].statnum == 4 || (CheckPlayerInSector(sect) == -1 && CheckPlayerInSector(sprite[OW].sectnum) == -1))
|
||||
if (sprite[j].statnum == 4 || (G_CheckPlayerInSector(sect) == -1 && G_CheckPlayerInSector(sprite[OW].sectnum) == -1))
|
||||
{
|
||||
sprite[j].x += (sprite[OW].x-SX);
|
||||
sprite[j].y += (sprite[OW].y-SY);
|
||||
|
@ -3627,7 +3669,7 @@ static void G_MoveActors(void)
|
|||
j = nextj;
|
||||
}
|
||||
|
||||
j = clipmove(&s->x,&s->y,&s->z,&s->sectnum,
|
||||
j = clipmove((vec3_t *)s,&s->sectnum,
|
||||
(((s->xvel*(sintable[(s->ang+512)&2047]))>>14)*TICSPERFRAME)<<11,
|
||||
(((s->xvel*(sintable[s->ang&2047]))>>14)*TICSPERFRAME)<<11,
|
||||
24L,(4<<8),(4<<8),CLIPMASK1);
|
||||
|
@ -4037,7 +4079,7 @@ static void G_MoveActors(void)
|
|||
goto BOLT;
|
||||
}
|
||||
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
s->ang = g_player[p].ps->ang;
|
||||
|
||||
|
@ -5017,7 +5059,7 @@ static void G_MoveMisc(void) // STATNUM 5
|
|||
A_SetSprite(i,CLIPMASK0);
|
||||
|
||||
if ((krand()&3) == 0)
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
if (s->sectnum == -1) KILLIT(i);
|
||||
l = getflorzofslope(s->sectnum,s->x,s->y);
|
||||
|
@ -5068,7 +5110,7 @@ static void G_MoveMisc(void) // STATNUM 5
|
|||
|
||||
if (s->zvel > 1024 && s->zvel < 1280)
|
||||
{
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
sect = s->sectnum;
|
||||
}
|
||||
|
||||
|
@ -5298,7 +5340,7 @@ static void G_MoveMisc(void) // STATNUM 5
|
|||
s->xrepeat >>= 1;
|
||||
s->yrepeat >>= 1;
|
||||
if (rnd(96))
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
t[0]++;//Number of bounces
|
||||
}
|
||||
else if (t[0] == 3) KILLIT(i);
|
||||
|
@ -5323,7 +5365,7 @@ static void G_MoveMisc(void) // STATNUM 5
|
|||
|
||||
if (s->zvel > 1024 && s->zvel < 1280)
|
||||
{
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
sect = s->sectnum;
|
||||
}
|
||||
|
||||
|
@ -5357,7 +5399,7 @@ static void G_MoveMisc(void) // STATNUM 5
|
|||
if (s->picnum == SCRAP1 && s->yvel > 0)
|
||||
{
|
||||
j = A_Spawn(i,s->yvel);
|
||||
setsprite(j,s->x,s->y,s->z);
|
||||
setsprite(j,(vec3_t *)s);
|
||||
A_GetZLimits(j);
|
||||
sprite[j].hitag = sprite[j].lotag = 0;
|
||||
}
|
||||
|
@ -5678,7 +5720,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
g_player[p].ps->posy = s->y;
|
||||
g_player[p].ps->cursectnum = s->sectnum;
|
||||
|
||||
setsprite(g_player[p].ps->i,s->x,s->y,s->z);
|
||||
setsprite(g_player[p].ps->i,(vec3_t *)s);
|
||||
P_QuickKill(g_player[p].ps);
|
||||
}
|
||||
}
|
||||
|
@ -5742,7 +5784,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
}
|
||||
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
if ((sc->floorz-sc->ceilingz) < (108<<8))
|
||||
{
|
||||
|
@ -5758,7 +5800,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
g_player[p].ps->oposy = g_player[p].ps->posy = s->y;
|
||||
g_player[p].ps->cursectnum = s->sectnum;
|
||||
|
||||
setsprite(g_player[p].ps->i,s->x,s->y,s->z);
|
||||
setsprite(g_player[p].ps->i,(vec3_t *)s);
|
||||
P_QuickKill(g_player[p].ps);
|
||||
}
|
||||
}
|
||||
|
@ -5857,7 +5899,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
g_player[p].ps->posy = s->y;
|
||||
g_player[p].ps->cursectnum = s->sectnum;
|
||||
|
||||
setsprite(g_player[p].ps->i,s->x,s->y,s->z);
|
||||
setsprite(g_player[p].ps->i,(vec3_t *)s);
|
||||
P_QuickKill(g_player[p].ps);
|
||||
}
|
||||
}
|
||||
|
@ -5910,7 +5952,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
}
|
||||
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
if ((sc->floorz-sc->ceilingz) < (108<<8))
|
||||
{
|
||||
|
@ -5930,7 +5972,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
|
||||
g_player[p].ps->cursectnum = s->sectnum;
|
||||
|
||||
setsprite(g_player[p].ps->i,s->x,s->y,s->z);
|
||||
setsprite(g_player[p].ps->i,(vec3_t *)s);
|
||||
P_QuickKill(g_player[p].ps);
|
||||
}
|
||||
}
|
||||
|
@ -6018,12 +6060,12 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
{
|
||||
sprite[j].x+=m;
|
||||
sprite[j].y+=x;
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -6203,7 +6245,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
sc->ceilingz += s->zvel;
|
||||
sector[t[0]].ceilingz += s->zvel;
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
break;
|
||||
|
||||
|
||||
|
@ -6343,7 +6385,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
t[2]-=k;
|
||||
t[4]-=k;
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
goto BOLT;
|
||||
}
|
||||
k = nextspritestat[k];
|
||||
|
@ -6354,14 +6396,14 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
t[2]+=k;
|
||||
t[4]+=k;
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
if (t[4] <= -511 || t[4] >= 512)
|
||||
{
|
||||
t[4] = 0;
|
||||
t[2] &= 0xffffff00;
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -6527,7 +6569,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
}
|
||||
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -6562,7 +6604,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
else sc->ceilingz-=512;
|
||||
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -6671,7 +6713,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
ActorExtra[k].bposz = sprite[k].z;
|
||||
|
||||
changespritesect(k,sprite[j].sectnum);
|
||||
setsprite(k,sprite[k].x,sprite[k].y,sprite[k].z);
|
||||
setsprite(k,(vec3_t *)&sprite[k]);
|
||||
|
||||
ActorExtra[k].floorz = sector[sprite[j].sectnum].floorz;
|
||||
ActorExtra[k].ceilingz = sector[sprite[j].sectnum].ceilingz;
|
||||
|
@ -6889,7 +6931,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
{
|
||||
sprite[j].x += x;
|
||||
sprite[j].y += l;
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
if (sector[sprite[j].sectnum].floorstat&2)
|
||||
if (sprite[j].statnum == 2)
|
||||
A_Fall(j);
|
||||
|
@ -6903,13 +6945,19 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
TRAVERSE_CONNECT(p)
|
||||
if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground)
|
||||
{
|
||||
vec3_t vect;
|
||||
|
||||
g_player[p].ps->posx += x;
|
||||
g_player[p].ps->posy += l;
|
||||
|
||||
g_player[p].ps->oposx = g_player[p].ps->posx;
|
||||
g_player[p].ps->oposy = g_player[p].ps->posy;
|
||||
|
||||
setsprite(g_player[p].ps->i,g_player[p].ps->posx,g_player[p].ps->posy,g_player[p].ps->posz+PHEIGHT);
|
||||
vect.x = g_player[p].ps->posx;
|
||||
vect.y = g_player[p].ps->posy;
|
||||
vect.z = g_player[p].ps->posz+PHEIGHT;
|
||||
|
||||
setsprite(g_player[p].ps->i,&vect);
|
||||
}
|
||||
|
||||
sc->floorxpanning-=x>>3;
|
||||
|
@ -7024,7 +7072,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
sprite[j].x += x>>2;
|
||||
sprite[j].y += l>>2;
|
||||
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
|
||||
if (sector[sprite[j].sectnum].floorstat&2)
|
||||
if (sprite[j].statnum == 2)
|
||||
|
@ -7056,7 +7104,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
k = A_Spawn(i,SMALLSMOKE);
|
||||
sprite[k].xvel = 96+(krand()&127);
|
||||
A_SetSprite(k,CLIPMASK0);
|
||||
setsprite(k,sprite[k].x,sprite[k].y,sprite[k].z);
|
||||
setsprite(k,(vec3_t *)&sprite[k]);
|
||||
if (rnd(16))
|
||||
A_Spawn(i,EXPLOSION2);
|
||||
}
|
||||
|
@ -7135,7 +7183,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
sprite[j].y += x;
|
||||
|
||||
sprite[j].z += s->zvel;
|
||||
setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(j,(vec3_t *)&sprite[j]);
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
|
@ -7152,7 +7200,7 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
g_player[p].ps->posz += s->zvel;
|
||||
|
||||
ms(i);
|
||||
setsprite(i,s->x,s->y,s->z);
|
||||
setsprite(i,(vec3_t *)s);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
#define BUILDDATE " 20090105"
|
||||
#define BUILDDATE " 20090112"
|
||||
#define VERSION " 1.2.0devel"
|
||||
|
||||
static int32_t floor_over_floor;
|
||||
|
@ -323,7 +323,7 @@ void ExtLoadMap(const char *mapname)
|
|||
void ExtSaveMap(const char *mapname)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(mapname);
|
||||
saveboard("backup.map",&posx,&posy,&posz,&ang,&cursectnum);
|
||||
saveboard("backup.map",&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
}
|
||||
|
||||
int32_t getTileGroup(const char *groupName)
|
||||
|
@ -3091,7 +3091,7 @@ void getnumberptr256(char *namestart, void *num, int32_t bytes, int32_t maxnumbe
|
|||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
|
||||
drawrooms(posx,posy,posz,ang,horiz,cursectnum);
|
||||
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
|
||||
#ifdef SUPERBUILD
|
||||
ExtAnalyzeSprites();
|
||||
#endif
|
||||
|
@ -3186,28 +3186,28 @@ void getnumberptr256(char *namestart, void *num, int32_t bytes, int32_t maxnumbe
|
|||
static void DoSpriteOrnament(int32_t i)
|
||||
{
|
||||
int32_t j;
|
||||
int32_t hitx, hity, hitz;
|
||||
int16_t hitsect, hitwall, hitsprite;
|
||||
hitdata_t hitinfo;
|
||||
|
||||
hitscan(sprite[i].x,sprite[i].y,sprite[i].z,sprite[i].sectnum,
|
||||
hitscan((const vec3_t *)&sprite[i],sprite[i].sectnum,
|
||||
sintable[(sprite[i].ang+2560+1024)&2047],
|
||||
sintable[(sprite[i].ang+2048+1024)&2047],
|
||||
0,
|
||||
&hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1);
|
||||
&hitinfo,CLIPMASK1);
|
||||
|
||||
sprite[i].x = hitx;
|
||||
sprite[i].y = hity;
|
||||
sprite[i].z = hitz;
|
||||
changespritesect(i,hitsect);
|
||||
if (hitwall >= 0)
|
||||
sprite[i].ang = ((getangle(wall[wall[hitwall].point2].x-wall[hitwall].x,wall[wall[hitwall].point2].y-wall[hitwall].y)+512)&2047);
|
||||
sprite[i].x = hitinfo.pos.x;
|
||||
sprite[i].y = hitinfo.pos.y;
|
||||
sprite[i].z = hitinfo.pos.z;
|
||||
changespritesect(i,hitinfo.hitsect);
|
||||
if (hitinfo.hitwall >= 0)
|
||||
sprite[i].ang = ((getangle(wall[wall[hitinfo.hitwall].point2].x-wall[hitinfo.hitwall].x,
|
||||
wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y)+512)&2047);
|
||||
|
||||
//Make sure sprite's in right sector
|
||||
if (inside(sprite[i].x,sprite[i].y,sprite[i].sectnum) == 0)
|
||||
{
|
||||
j = wall[hitwall].point2;
|
||||
sprite[i].x -= ksgn(wall[j].y-wall[hitwall].y);
|
||||
sprite[i].y += ksgn(wall[j].x-wall[hitwall].x);
|
||||
j = wall[hitinfo.hitwall].point2;
|
||||
sprite[i].x -= ksgn(wall[j].y-wall[hitinfo.hitwall].y);
|
||||
sprite[i].y += ksgn(wall[j].x-wall[hitinfo.hitwall].x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3359,7 +3359,7 @@ ENDFOR1:
|
|||
if (sprite[linebegspr].pal>0) sprite[linebegspr].pal--;
|
||||
}
|
||||
|
||||
drawrooms(posx,posy,posz,ang,horiz,cursectnum);
|
||||
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
|
||||
#ifdef SUPERBUILD
|
||||
ExtAnalyzeSprites();
|
||||
#endif
|
||||
|
@ -3392,10 +3392,13 @@ ENDFOR1:
|
|||
}
|
||||
|
||||
j = sp->xrepeat*(hgap+tilesizx[sp->picnum]+2);
|
||||
setsprite(cursor,
|
||||
dax + ((j*sintable[daang])>>17),
|
||||
day - ((j*sintable[(daang+512)&2047])>>17),
|
||||
sp->z);
|
||||
{
|
||||
vec3_t vect;
|
||||
vect.x = dax + ((j*sintable[daang])>>17);
|
||||
vect.y = day - ((j*sintable[(daang+512)&2047])>>17);
|
||||
vect.z = sp->z;
|
||||
setsprite(cursor,&vect);
|
||||
}
|
||||
|
||||
if (ch>=33 && ch<=126 && alphabets[alphidx].pic[ch-33] >= 0)
|
||||
{
|
||||
|
@ -4000,13 +4003,13 @@ static void Keys3d(void)
|
|||
noclip = i;
|
||||
}
|
||||
|
||||
getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0);
|
||||
getzrange(&pos,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0);
|
||||
|
||||
if (keystatus[KEYSC_CAPS] || (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_Z]))
|
||||
{
|
||||
zmode++;
|
||||
if (zmode == 3) zmode = 0;
|
||||
else if (zmode == 1) zlock = (loz-posz)&0xfffffc00;
|
||||
else if (zmode == 1) zlock = (loz-pos.z)&0xfffffc00;
|
||||
switch (zmode)
|
||||
{
|
||||
case 0: message("Zmode = Gravity");break;
|
||||
|
@ -4056,7 +4059,7 @@ static void Keys3d(void)
|
|||
{
|
||||
sprite[searchwall].cstat &= ~8;
|
||||
if ((i&64) > 0)
|
||||
if (posz > sprite[searchwall].z)
|
||||
if (pos.z > sprite[searchwall].z)
|
||||
sprite[searchwall].cstat |= 8;
|
||||
}
|
||||
asksave = 1;
|
||||
|
@ -5840,9 +5843,9 @@ static void Keys3d(void)
|
|||
int16_t cursectnum=sprite[searchwall].sectnum;
|
||||
xvect = -((mousex*(int32_t)sintable[(ang+2048)&2047])<<3);
|
||||
yvect = -((mousex*(int32_t)sintable[(ang+1536)&2047])<<3);
|
||||
clipmove(&sprite[searchwall].x,&sprite[searchwall].y,&sprite[searchwall].z,
|
||||
clipmove((vec3_t *)&sprite[searchwall],
|
||||
&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,spnoclip?1:CLIPMASK0);
|
||||
setsprite(searchwall,sprite[searchwall].x,sprite[searchwall].y,sprite[searchwall].z);
|
||||
setsprite(searchwall,(vec3_t *)&sprite[searchwall]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5946,9 +5949,9 @@ static void Keys3d(void)
|
|||
int16_t cursectnum=sprite[searchwall].sectnum;
|
||||
xvect = -((mousey*(int32_t)sintable[(ang+2560)&2047])<<3);
|
||||
yvect = -((mousey*(int32_t)sintable[(ang+2048)&2047])<<3);
|
||||
clipmove(&sprite[searchwall].x,&sprite[searchwall].y,&sprite[searchwall].z,
|
||||
clipmove((vec3_t *)&sprite[searchwall],
|
||||
&cursectnum,xvect,yvect,128L,4L<<8,4L<<8,spnoclip?1:CLIPMASK0);
|
||||
setsprite(searchwall,sprite[searchwall].x,sprite[searchwall].y,sprite[searchwall].z);
|
||||
setsprite(searchwall,(vec3_t *)&sprite[searchwall]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6562,8 +6565,8 @@ static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards
|
|||
}
|
||||
|
||||
// found matching sprite
|
||||
posx = sprite[gs_cursprite].x;
|
||||
posy = sprite[gs_cursprite].y;
|
||||
pos.x = sprite[gs_cursprite].x;
|
||||
pos.y = sprite[gs_cursprite].y;
|
||||
ang = sprite[gs_cursprite].ang;
|
||||
|
||||
printmessage16("%s Sprite seach%s: found sprite %d", dir<0 ? "<" : ">",
|
||||
|
@ -6965,8 +6968,8 @@ static void Keys2d(void)
|
|||
(search_hitag!=0 && search_hitag==wall[i].hitag))
|
||||
)
|
||||
{
|
||||
posx=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2);
|
||||
posy=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2);
|
||||
pos.x=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2);
|
||||
pos.y=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2);
|
||||
printmessage16("< Wall search: found");
|
||||
// curwallnum--;
|
||||
keystatus[KEYSC_LBRACK]=0;
|
||||
|
@ -6995,8 +6998,8 @@ static void Keys2d(void)
|
|||
(search_hitag!=0 && search_hitag==sprite[i].hitag))
|
||||
)
|
||||
{
|
||||
posx=sprite[i].x;
|
||||
posy=sprite[i].y;
|
||||
pos.x=sprite[i].x;
|
||||
pos.y=sprite[i].y;
|
||||
ang= sprite[i].ang;
|
||||
printmessage16("< Sprite search: found");
|
||||
// curspritenum--;
|
||||
|
@ -7031,8 +7034,8 @@ static void Keys2d(void)
|
|||
(search_hitag!=0 && search_hitag==wall[i].hitag))
|
||||
)
|
||||
{
|
||||
posx=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2);
|
||||
posy=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2);
|
||||
pos.x=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2);
|
||||
pos.y=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2);
|
||||
printmessage16("> Wall search: found");
|
||||
// curwallnum++;
|
||||
keystatus[KEYSC_RBRACK]=0;
|
||||
|
@ -7058,8 +7061,8 @@ static void Keys2d(void)
|
|||
(search_hitag!=0 && search_hitag==sprite[i].hitag))
|
||||
)
|
||||
{
|
||||
posx=sprite[i].x;
|
||||
posy=sprite[i].y;
|
||||
pos.x=sprite[i].x;
|
||||
pos.y=sprite[i].y;
|
||||
ang= sprite[i].ang;
|
||||
printmessage16("> Sprite search: found");
|
||||
// curspritenum++;
|
||||
|
@ -7195,7 +7198,7 @@ static void Keys2d(void)
|
|||
{
|
||||
editstatus = 0;
|
||||
zmode = 2;
|
||||
posz = ((sector[cursectnum].ceilingz+sector[cursectnum].floorz)>>1);
|
||||
pos.z = ((sector[cursectnum].ceilingz+sector[cursectnum].floorz)>>1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7229,9 +7232,9 @@ static void Keys2d(void)
|
|||
|
||||
if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_J]) // ' J
|
||||
{
|
||||
posx=getnumber16("X-coordinate: ",posx,131072L,1);
|
||||
posy=getnumber16("Y-coordinate: ",posy,131072L,1);
|
||||
Bsprintf(tempbuf,"Current pos now (%d, %d)",posx,posy);
|
||||
pos.x=getnumber16("X-coordinate: ",pos.x,131072L,1);
|
||||
pos.y=getnumber16("Y-coordinate: ",pos.y,131072L,1);
|
||||
Bsprintf(tempbuf,"Current pos now (%d, %d)",pos.x,pos.y);
|
||||
printmessage16(tempbuf);
|
||||
keystatus[KEYSC_J]=0;
|
||||
}
|
||||
|
@ -8802,7 +8805,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
|||
}
|
||||
}
|
||||
}
|
||||
if (floor_over_floor) SE40Code(posx,posy,posz,ang,horiz);
|
||||
if (floor_over_floor) SE40Code(pos.x,pos.y,pos.z,ang,horiz);
|
||||
if (purpleon) clearview(255);
|
||||
if (sidemode != 0)
|
||||
{
|
||||
|
@ -8882,7 +8885,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
|||
if (frames!=0)
|
||||
{
|
||||
if (frames==10) frames=0;
|
||||
k = 1536;//getangle(tspr->x-posx,tspr->y-posy);
|
||||
k = 1536;//getangle(tspr->x-pos.x,tspr->y-pos.y);
|
||||
k = (((sprite[i].ang+3072+128-k)&2047)>>8)&7;
|
||||
//This guy has only 5 pictures for 8 angles (3 are x-flipped)
|
||||
if (k <= 4)
|
||||
|
@ -8915,8 +8918,8 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
|||
|
||||
}
|
||||
|
||||
xp1 = mulscale14(sprite[i].x-posx,zoom);
|
||||
yp1 = mulscale14(sprite[i].y-posy-(tilesizy[picnum]<<2),zoom);
|
||||
xp1 = mulscale14(sprite[i].x-pos.x,zoom);
|
||||
yp1 = mulscale14(sprite[i].y-pos.y-(tilesizy[picnum]<<2),zoom);
|
||||
if (i+16384 != pointhighlight || !(totalclock&32))
|
||||
{
|
||||
shade = sprite[i].shade;
|
||||
|
@ -8937,8 +8940,8 @@ void ExtPreCheckKeys(void) // just before drawrooms
|
|||
for (i=0;i<numsprites;i++)
|
||||
if (sprite[i].picnum == 5 /*&& zoom >= 256*/ && sprite[i].sectnum != MAXSECTORS)
|
||||
{
|
||||
xp1 = mulscale14(sprite[i].x-posx,zoom);
|
||||
yp1 = mulscale14(sprite[i].y-posy,zoom);
|
||||
xp1 = mulscale14(sprite[i].x-pos.x,zoom);
|
||||
yp1 = mulscale14(sprite[i].y-pos.y,zoom);
|
||||
|
||||
radius = mulscale14(sprite[i].hitag,zoom);
|
||||
col = 6;
|
||||
|
@ -9059,7 +9062,7 @@ void ExtAnalyzeSprites(void)
|
|||
if (frames!=0)
|
||||
{
|
||||
if (frames==10) frames=0;
|
||||
k = getangle(tspr->x-posx,tspr->y-posy);
|
||||
k = getangle(tspr->x-pos.x,tspr->y-pos.y);
|
||||
k = (((tspr->ang+3072+128-k)&2047)>>8)&7;
|
||||
//This guy has only 5 pictures for 8 angles (3 are x-flipped)
|
||||
if (k <= 4)
|
||||
|
@ -9162,7 +9165,7 @@ static void Keys2d3d(void)
|
|||
keystatus[KEYSC_P] = 0;
|
||||
|
||||
if (!eitherALT)
|
||||
updatesector(posx, posy, &cursectnum);
|
||||
updatesector(pos.x, pos.y, &cursectnum);
|
||||
else
|
||||
updatesector(startposx, startposy, &startsectnum);
|
||||
|
||||
|
@ -9225,7 +9228,7 @@ static void Keys2d3d(void)
|
|||
if (eitherALT)
|
||||
saveboard("autosave.map",&startposx,&startposy,&startposz,&startang,&startsectnum);
|
||||
else
|
||||
saveboard("autosave.map",&posx,&posy,&posz,&ang,&cursectnum);
|
||||
saveboard("autosave.map",&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
message("Board saved to AUTOSAVE.MAP. Starting the game...");
|
||||
|
||||
uninitmouse();
|
||||
|
@ -9284,7 +9287,7 @@ static void Keys2d3d(void)
|
|||
|
||||
if (totalclock < (lastsave + 120*10) || !AskIfSure("Are you sure you want to load the last saved map?"))
|
||||
{
|
||||
int32_t sposx=posx,sposy=posy,sposz=posz,sang=ang;
|
||||
int32_t sposx=pos.x,sposy=pos.y,sposz=pos.z,sang=ang;
|
||||
|
||||
lastsave=totalclock;
|
||||
highlightcnt = -1;
|
||||
|
@ -9299,9 +9302,9 @@ static void Keys2d3d(void)
|
|||
for (i=MAXSPRITES-1;i>=0;i--) sprite[i].extra = -1;
|
||||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(f,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
i = loadboard(f,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
loadmhk();
|
||||
if (i == -2) i = loadoldboard(f,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
if (i == -2) i = loadoldboard(f,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
|
||||
if (i < 0) printmessage16("Invalid map format.");
|
||||
else
|
||||
{
|
||||
|
@ -9310,12 +9313,12 @@ static void Keys2d3d(void)
|
|||
else message("Map %s loaded successfully",f);
|
||||
}
|
||||
updatenumsprites();
|
||||
startposx = posx;
|
||||
startposy = posy;
|
||||
startposz = posz;
|
||||
startposx = pos.x;
|
||||
startposy = pos.y;
|
||||
startposz = pos.z;
|
||||
startang = ang;
|
||||
startsectnum = cursectnum;
|
||||
posx=sposx;posy=sposy;posz=sposz;ang=sang;
|
||||
pos.x=sposx;pos.y=sposy;pos.z=sposz;ang=sang;
|
||||
keystatus[KEYSC_L]=0;
|
||||
}
|
||||
}
|
||||
|
@ -9468,11 +9471,12 @@ void faketimerhandler(void)
|
|||
return;
|
||||
ototalclock = totalclock;
|
||||
|
||||
oposx = posx;
|
||||
oposy = posy;
|
||||
hitwall = clipmove(&posx,&posy,&posz,&cursectnum,xvel,yvel,128L,4L<<8,4L<<8,0);
|
||||
xvel = ((posx-oposx)<<14);
|
||||
yvel = ((posy-oposy)<<14);
|
||||
oposx = pos.x;
|
||||
oposy = pos.y;
|
||||
|
||||
hitwall = clipmove(&pos,&cursectnum,xvel,yvel,128L,4L<<8,4L<<8,0);
|
||||
xvel = ((pos.x-oposx)<<14);
|
||||
yvel = ((pos.y-oposy)<<14);
|
||||
|
||||
yvel += 80000;
|
||||
if ((hitwall&0xc000) == 32768)
|
||||
|
@ -9506,18 +9510,18 @@ void faketimerhandler(void)
|
|||
ang = ((ang+((timoff+32-ototalclock)>>4))&2047);
|
||||
}
|
||||
|
||||
getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,0);
|
||||
getzrange(&pos,cursectnum,&hiz,&hihit,&loz,&lohit,128L,0);
|
||||
|
||||
oposx -= posx;
|
||||
oposy -= posy;
|
||||
oposx -= pos.x;
|
||||
oposy -= pos.y;
|
||||
|
||||
dist = ksqrt(oposx*oposx+oposy*oposy);
|
||||
if (ototalclock > timoff+32) dist = 0;
|
||||
|
||||
daang = mulscale(dist,angvel,9);
|
||||
posz += (daang<<6);
|
||||
if (posz > loz-(4<<8)) posz = loz-(4<<8), hvel = 0;
|
||||
if (posz < hiz+(4<<8)) posz = hiz+(4<<8), hvel = 0;
|
||||
pos.z += (daang<<6);
|
||||
if (pos.z > loz-(4<<8)) pos.z = loz-(4<<8), hvel = 0;
|
||||
if (pos.z < hiz+(4<<8)) pos.z = hiz+(4<<8), hvel = 0;
|
||||
|
||||
horiz = ((horiz*7+(100-(daang>>1)))>>3);
|
||||
if (horiz < 100) horiz++;
|
||||
|
@ -9572,8 +9576,8 @@ static void SearchSectorsForward()
|
|||
{
|
||||
if (sector[ii].lotag==cursector_lotag)
|
||||
{
|
||||
posx=wall[sector[ii].wallptr].x;
|
||||
posy=wall[sector[ii].wallptr].y;
|
||||
pos.x=wall[sector[ii].wallptr].x;
|
||||
pos.y=wall[sector[ii].wallptr].y;
|
||||
printmessage16("> Sector search: found");
|
||||
// cursectornum++;
|
||||
keystatus[KEYSC_RBRACK]=0; // ]
|
||||
|
@ -9595,8 +9599,8 @@ static void SearchSectorsBackward()
|
|||
{
|
||||
if (sector[ii].lotag==cursector_lotag)
|
||||
{
|
||||
posx=wall[sector[ii].wallptr].x;
|
||||
posy=wall[sector[ii].wallptr].y;
|
||||
pos.x=wall[sector[ii].wallptr].x;
|
||||
pos.y=wall[sector[ii].wallptr].y;
|
||||
printmessage16("< Sector search: found");
|
||||
// cursectornum--;
|
||||
keystatus[KEYSC_LBRACK]=0; // [
|
||||
|
|
|
@ -368,6 +368,7 @@ typedef struct {
|
|||
} config_t;
|
||||
|
||||
typedef struct {
|
||||
int32_t camerax,cameray,cameraz;
|
||||
int32_t const_visibility,uw_framerate;
|
||||
int32_t camera_time,folfvel,folavel,folx,foly,fola;
|
||||
int32_t reccnt,crosshairscale;
|
||||
|
@ -386,7 +387,6 @@ typedef struct {
|
|||
int32_t m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode;
|
||||
int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
|
||||
|
||||
int32_t camerax,cameray,cameraz;
|
||||
int32_t configversion;
|
||||
|
||||
int16_t cameraang, camerasect, camerahoriz;
|
||||
|
@ -420,13 +420,13 @@ extern int32_t fricxv,fricyv;
|
|||
// mywhatever type globals
|
||||
|
||||
typedef struct {
|
||||
int32_t zoom, exitx, exity;
|
||||
int32_t posx, posy, posz, horiz, ohoriz, ohorizoff, invdisptime;
|
||||
int32_t bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff;
|
||||
int32_t posxv, posyv, poszv, last_pissed_time, truefz, truecz;
|
||||
int32_t player_par, visibility;
|
||||
int32_t bobcounter, weapon_sway;
|
||||
int32_t pals_time, randomflamex, crack_time;
|
||||
int32_t zoom, exitx, exity;
|
||||
|
||||
uint32_t interface_toggle_flag;
|
||||
|
||||
|
@ -574,10 +574,6 @@ extern int32_t movefifoplc, vel,svel,angvel,horiz;
|
|||
|
||||
extern int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
|
||||
|
||||
typedef struct {
|
||||
int32_t x, y, z;
|
||||
} vec3_t;
|
||||
|
||||
#include "funct.h"
|
||||
|
||||
extern int32_t g_screenCapture;
|
||||
|
@ -630,7 +626,8 @@ extern int32_t g_networkBroadcastMode;
|
|||
extern char lumplockbyte[11];
|
||||
|
||||
//DUKE3D.H - replace the end "my's" with this
|
||||
extern int32_t myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
|
||||
extern vec3_t my;
|
||||
extern vec3_t my, omy, myvel;
|
||||
extern int16_t myhoriz, omyhoriz, myhorizoff, omyhorizoff, g_skillSoundID;
|
||||
extern int16_t myang, omyang, mycursectnum, myjumpingcounter;
|
||||
extern char myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
|
||||
|
|
|
@ -56,7 +56,7 @@ extern int32_t G_CheckActivatorMotion(int32_t lotag);
|
|||
extern int32_t CheckDoorTile(int32_t dapic);
|
||||
extern int32_t isanunderoperator(int32_t lotag);
|
||||
extern int32_t isanearoperator(int32_t lotag);
|
||||
extern inline int32_t CheckPlayerInSector(int32_t sect);
|
||||
extern inline int32_t G_CheckPlayerInSector(int32_t sect);
|
||||
extern int32_t ldist(spritetype *s1,spritetype *s2);
|
||||
extern int32_t dist(spritetype *s1,spritetype *s2);
|
||||
extern int32_t __fastcall A_FindPlayer(spritetype *s,int32_t *d);
|
||||
|
|
|
@ -3742,8 +3742,8 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
{
|
||||
if (screenpeek == myconnectindex && numplayers > 1)
|
||||
{
|
||||
cposx = omyx+mulscale16((int32_t)(myx-omyx),smoothratio);
|
||||
cposy = omyy+mulscale16((int32_t)(myy-omyy),smoothratio);
|
||||
cposx = omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio);
|
||||
cposy = omy.y+mulscale16((int32_t)(my.y-omy.y),smoothratio);
|
||||
cang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio);
|
||||
}
|
||||
else
|
||||
|
@ -3954,20 +3954,21 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
G_FadePalette(tempTint.r,tempTint.g,tempTint.b,tempTint.f|128);
|
||||
}
|
||||
|
||||
static void G_DoThirdPerson(DukePlayer_t *pp, int32_t *vx, int32_t *vy,int32_t *vz,int16_t *vsectnum, int32_t ang, int32_t horiz)
|
||||
static void G_DoThirdPerson(DukePlayer_t *pp, vec3_t *vect,int16_t *vsectnum, int32_t ang, int32_t horiz)
|
||||
{
|
||||
spritetype *sp = &sprite[pp->i];
|
||||
int32_t i, hx, hy, hitx, hity, hitz;
|
||||
int32_t i, hx, hy;
|
||||
int32_t nx = (sintable[(ang+1536)&2047]>>4);
|
||||
int32_t ny = (sintable[(ang+1024)&2047]>>4);
|
||||
int32_t nz = (horiz-100)*128;
|
||||
int16_t hitsect, hitwall, hitsprite, daang;
|
||||
int16_t daang;
|
||||
int16_t bakcstat = sp->cstat;
|
||||
hitdata_t hitinfo;
|
||||
|
||||
sp->cstat &= (int16_t)~0x101;
|
||||
|
||||
updatesectorz(*vx,*vy,*vz,vsectnum);
|
||||
hitscan(*vx,*vy,*vz,*vsectnum,nx,ny,nz,&hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1);
|
||||
updatesectorz(vect->x,vect->y,vect->z,vsectnum);
|
||||
hitscan((const vec3_t *)&vect,*vsectnum,nx,ny,nz,&hitinfo,CLIPMASK1);
|
||||
|
||||
if (*vsectnum < 0)
|
||||
{
|
||||
|
@ -3975,21 +3976,21 @@ static void G_DoThirdPerson(DukePlayer_t *pp, int32_t *vx, int32_t *vy,int32_t *
|
|||
return;
|
||||
}
|
||||
|
||||
hx = hitx-(*vx);
|
||||
hy = hity-(*vy);
|
||||
hx = hitinfo.pos.x-(vect->x);
|
||||
hy = hitinfo.pos.y-(vect->y);
|
||||
if (klabs(nx)+klabs(ny) > klabs(hx)+klabs(hy))
|
||||
{
|
||||
*vsectnum = hitsect;
|
||||
if (hitwall >= 0)
|
||||
*vsectnum = hitinfo.hitsect;
|
||||
if (hitinfo.hitwall >= 0)
|
||||
{
|
||||
daang = getangle(wall[wall[hitwall].point2].x-wall[hitwall].x,
|
||||
wall[wall[hitwall].point2].y-wall[hitwall].y);
|
||||
daang = getangle(wall[wall[hitinfo.hitwall].point2].x-wall[hitinfo.hitwall].x,
|
||||
wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y);
|
||||
|
||||
i = nx*sintable[daang]+ny*sintable[(daang+1536)&2047];
|
||||
if (klabs(nx) > klabs(ny)) hx -= mulscale28(nx,i);
|
||||
else hy -= mulscale28(ny,i);
|
||||
}
|
||||
else if (hitsprite < 0)
|
||||
else if (hitinfo.hitsprite < 0)
|
||||
{
|
||||
if (klabs(nx) > klabs(ny)) hx -= (nx>>5);
|
||||
else hy -= (ny>>5);
|
||||
|
@ -3998,14 +3999,14 @@ static void G_DoThirdPerson(DukePlayer_t *pp, int32_t *vx, int32_t *vy,int32_t *
|
|||
else i = divscale16(hy,ny);
|
||||
if (i < g_cameraDistance) g_cameraDistance = i;
|
||||
}
|
||||
*vx = (*vx)+mulscale16(nx,g_cameraDistance);
|
||||
*vy = (*vy)+mulscale16(ny,g_cameraDistance);
|
||||
*vz = (*vz)+mulscale16(nz,g_cameraDistance);
|
||||
vect->x = (vect->x)+mulscale16(nx,g_cameraDistance);
|
||||
vect->y = (vect->y)+mulscale16(ny,g_cameraDistance);
|
||||
vect->z = (vect->z)+mulscale16(nz,g_cameraDistance);
|
||||
|
||||
g_cameraDistance = min(g_cameraDistance+((totalclock-g_cameraClock)<<10),65536);
|
||||
g_cameraClock = totalclock;
|
||||
|
||||
updatesectorz(*vx,*vy,*vz,vsectnum);
|
||||
updatesectorz(vect->x,vect->y,vect->z,vsectnum);
|
||||
|
||||
sp->cstat = bakcstat;
|
||||
}
|
||||
|
@ -4459,9 +4460,9 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
|
|||
|
||||
if ((snum == myconnectindex) && (numplayers > 1))
|
||||
{
|
||||
ud.camerax = omyx+mulscale16((int32_t)(myx-omyx),smoothratio);
|
||||
ud.cameray = omyy+mulscale16((int32_t)(myy-omyy),smoothratio);
|
||||
ud.cameraz = omyz+mulscale16((int32_t)(myz-omyz),smoothratio);
|
||||
ud.camerax = omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio);
|
||||
ud.cameray = omy.y+mulscale16((int32_t)(my.y-omy.y),smoothratio);
|
||||
ud.cameraz = omy.z+mulscale16((int32_t)(my.z-omy.z),smoothratio);
|
||||
ud.cameraang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio);
|
||||
ud.camerahoriz = omyhoriz+omyhorizoff+mulscale16((int32_t)(myhoriz+myhorizoff-omyhoriz-omyhorizoff),smoothratio);
|
||||
ud.camerasect = mycursectnum;
|
||||
|
@ -4491,7 +4492,7 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
|
|||
if (ud.viewbob)
|
||||
ud.cameraz += p->opyoff+mulscale16((int32_t)(p->pyoff-p->opyoff),smoothratio);
|
||||
}
|
||||
else G_DoThirdPerson(p,&ud.camerax,&ud.cameray,&ud.cameraz,&ud.camerasect,ud.cameraang,ud.camerahoriz);
|
||||
else G_DoThirdPerson(p,(vec3_t *)&ud,&ud.camerasect,ud.cameraang,ud.camerahoriz);
|
||||
|
||||
cz = ActorExtra[p->i].ceilingz;
|
||||
fz = ActorExtra[p->i].floorz;
|
||||
|
@ -4960,7 +4961,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
case WATERSPLASH2__STATIC:
|
||||
if (j >= 0)
|
||||
{
|
||||
setsprite(i,sprite[j].x,sprite[j].y,sprite[j].z);
|
||||
setsprite(i,(vec3_t *)&sprite[j]);
|
||||
sp->xrepeat = sp->yrepeat = 8+(krand()&7);
|
||||
}
|
||||
else sp->xrepeat = sp->yrepeat = 16+(krand()&15);
|
||||
|
@ -5054,7 +5055,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
sp->xvel = 128;
|
||||
changespritestat(i,5);
|
||||
A_SetSprite(i,CLIPMASK0);
|
||||
setsprite(i,sp->x,sp->y,sp->z);
|
||||
setsprite(i,(vec3_t *)sp);
|
||||
break;
|
||||
|
||||
case FRAMEEFFECT1_13__STATIC:
|
||||
|
@ -5672,7 +5673,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
sprite[s].z = sp->z;
|
||||
sprite[s].shade = sp->shade;
|
||||
|
||||
setsprite(s,sprite[s].x,sprite[s].y,sprite[s].z);
|
||||
setsprite(s,(vec3_t *)&sprite[s]);
|
||||
break;
|
||||
}
|
||||
s = nextspritestat[s];
|
||||
|
@ -7044,9 +7045,9 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
|
|||
t->cstat |= 2;
|
||||
if (screenpeek == myconnectindex && numplayers >= 2)
|
||||
{
|
||||
t->x = omyx+mulscale16((int32_t)(myx-omyx),smoothratio);
|
||||
t->y = omyy+mulscale16((int32_t)(myy-omyy),smoothratio);
|
||||
t->z = omyz+mulscale16((int32_t)(myz-omyz),smoothratio)+(40<<8);
|
||||
t->x = omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio);
|
||||
t->y = omy.y+mulscale16((int32_t)(my.y-omy.y),smoothratio);
|
||||
t->z = omy.z+mulscale16((int32_t)(my.z-omy.z),smoothratio)+(40<<8);
|
||||
t->ang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio);
|
||||
t->sectnum = mycursectnum;
|
||||
}
|
||||
|
@ -12074,15 +12075,15 @@ static void Net_CorrectPrediction(void)
|
|||
if (p->posx == myxbak[i] && p->posy == myybak[i] && p->posz == myzbak[i]
|
||||
&& p->horiz == myhorizbak[i] && p->ang == myangbak[i]) return;
|
||||
|
||||
myx = p->posx;
|
||||
omyx = p->oposx;
|
||||
myxvel = p->posxv;
|
||||
myy = p->posy;
|
||||
omyy = p->oposy;
|
||||
myyvel = p->posyv;
|
||||
myz = p->posz;
|
||||
omyz = p->oposz;
|
||||
myzvel = p->poszv;
|
||||
my.x = p->posx;
|
||||
omy.x = p->oposx;
|
||||
myvel.x = p->posxv;
|
||||
my.y = p->posy;
|
||||
omy.y = p->oposy;
|
||||
myvel.y = p->posyv;
|
||||
my.z = p->posz;
|
||||
omy.z = p->oposz;
|
||||
myvel.z = p->poszv;
|
||||
myang = p->ang;
|
||||
omyang = p->oang;
|
||||
mycursectnum = p->cursectnum;
|
||||
|
@ -12127,31 +12128,31 @@ static void Net_DoPrediction(void)
|
|||
|
||||
if (ud.clipping == 0 && (sector[psect].floorpicnum == MIRROR || psect < 0 || psect >= MAXSECTORS))
|
||||
{
|
||||
myx = omyx;
|
||||
myy = omyy;
|
||||
my.x = omy.x;
|
||||
my.y = omy.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
omyx = myx;
|
||||
omyy = myy;
|
||||
omy.x = my.x;
|
||||
omy.y = my.y;
|
||||
}
|
||||
|
||||
omyhoriz = myhoriz;
|
||||
omyhorizoff = myhorizoff;
|
||||
omyz = myz;
|
||||
omy.z = my.z;
|
||||
omyang = myang;
|
||||
|
||||
getzrange(myx,myy,myz,psect,&cz,&hz,&fz,&lz,163L,CLIPMASK0);
|
||||
getzrange(&my,psect,&cz,&hz,&fz,&lz,163L,CLIPMASK0);
|
||||
|
||||
j = getflorzofslope(psect,myx,myy);
|
||||
j = getflorzofslope(psect,my.x,my.y);
|
||||
|
||||
if ((lz&49152) == 16384 && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8))
|
||||
if ((lz&49152) == 16384 && psectlotag == 1 && klabs(my.z-j) > PHEIGHT+(16<<8))
|
||||
psectlotag = 0;
|
||||
|
||||
if (p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2))
|
||||
{
|
||||
x = myx+(sintable[(myang+512)&2047]>>5);
|
||||
y = myy+(sintable[myang&2047]>>5);
|
||||
x = my.x+(sintable[(myang+512)&2047]>>5);
|
||||
y = my.y+(sintable[myang&2047]>>5);
|
||||
tempsect = psect;
|
||||
updatesector(x,y,&tempsect);
|
||||
if (tempsect >= 0)
|
||||
|
@ -12172,7 +12173,7 @@ static void Net_DoPrediction(void)
|
|||
if (sprite[hz].statnum == 1 && sprite[hz].extra >= 0)
|
||||
{
|
||||
hz = 0;
|
||||
cz = getceilzofslope(psect,myx,myy);
|
||||
cz = getceilzofslope(psect,my.x,my.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12186,9 +12187,9 @@ static void Net_DoPrediction(void)
|
|||
}
|
||||
if (A_CheckEnemySprite(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(sprite[p->i].z-sprite[j].z) < (84<<8))
|
||||
{
|
||||
j = getangle(sprite[j].x-myx,sprite[j].y-myy);
|
||||
myxvel -= sintable[(j+512)&2047]<<4;
|
||||
myyvel -= sintable[j&2047]<<4;
|
||||
j = getangle(sprite[j].x-my.x,sprite[j].y-my.y);
|
||||
myvel.x -= sintable[(j+512)&2047]<<4;
|
||||
myvel.y -= sintable[j&2047]<<4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12198,14 +12199,14 @@ static void Net_DoPrediction(void)
|
|||
{
|
||||
if (p->on_warping_sector == 0)
|
||||
{
|
||||
if (klabs(myz-fz) > (PHEIGHT>>1))
|
||||
myz += 348;
|
||||
if (klabs(my.z-fz) > (PHEIGHT>>1))
|
||||
my.z += 348;
|
||||
}
|
||||
clipmove(&myx,&myy,&myz,&mycursectnum,0,0,164L,(4L<<8),(4L<<8),CLIPMASK0);
|
||||
clipmove(&my,&mycursectnum,0,0,164L,(4L<<8),(4L<<8),CLIPMASK0);
|
||||
}
|
||||
|
||||
updatesector(myx,myy,&mycursectnum);
|
||||
pushmove(&myx,&myy,&myz,&mycursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0);
|
||||
updatesector(my.x,my.y,&mycursectnum);
|
||||
pushmove(&my,&mycursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0);
|
||||
|
||||
myhoriz = 100;
|
||||
myhorizoff = 0;
|
||||
|
@ -12227,43 +12228,43 @@ static void Net_DoPrediction(void)
|
|||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_JUMP))
|
||||
{
|
||||
if (myzvel > 0) myzvel = 0;
|
||||
myzvel -= 348;
|
||||
if (myzvel < -(256*6)) myzvel = -(256*6);
|
||||
if (myvel.z > 0) myvel.z = 0;
|
||||
myvel.z -= 348;
|
||||
if (myvel.z < -(256*6)) myvel.z = -(256*6);
|
||||
}
|
||||
else if (TEST_SYNC_KEY(sb_snum, SK_CROUCH))
|
||||
{
|
||||
if (myzvel < 0) myzvel = 0;
|
||||
myzvel += 348;
|
||||
if (myzvel > (256*6)) myzvel = (256*6);
|
||||
if (myvel.z < 0) myvel.z = 0;
|
||||
myvel.z += 348;
|
||||
if (myvel.z > (256*6)) myvel.z = (256*6);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (myzvel < 0)
|
||||
if (myvel.z < 0)
|
||||
{
|
||||
myzvel += 256;
|
||||
if (myzvel > 0)
|
||||
myzvel = 0;
|
||||
myvel.z += 256;
|
||||
if (myvel.z > 0)
|
||||
myvel.z = 0;
|
||||
}
|
||||
if (myzvel > 0)
|
||||
if (myvel.z > 0)
|
||||
{
|
||||
myzvel -= 256;
|
||||
if (myzvel < 0)
|
||||
myzvel = 0;
|
||||
myvel.z -= 256;
|
||||
if (myvel.z < 0)
|
||||
myvel.z = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (myzvel > 2048) myzvel >>= 1;
|
||||
if (myvel.z > 2048) myvel.z >>= 1;
|
||||
|
||||
myz += myzvel;
|
||||
my.z += myvel.z;
|
||||
|
||||
if (myz > (fz-(15<<8)))
|
||||
myz += ((fz-(15<<8))-myz)>>1;
|
||||
if (my.z > (fz-(15<<8)))
|
||||
my.z += ((fz-(15<<8))-my.z)>>1;
|
||||
|
||||
if (myz < (cz+(4<<8)))
|
||||
if (my.z < (cz+(4<<8)))
|
||||
{
|
||||
myz = cz+(4<<8);
|
||||
myzvel = 0;
|
||||
my.z = cz+(4<<8);
|
||||
myvel.z = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12274,23 +12275,23 @@ static void Net_DoPrediction(void)
|
|||
myhardlanding = 0;
|
||||
|
||||
if (p->jetpack_on < 11)
|
||||
myz -= (p->jetpack_on<<7); //Goin up
|
||||
my.z -= (p->jetpack_on<<7); //Goin up
|
||||
|
||||
if (shrunk) j = 512;
|
||||
else j = 2048;
|
||||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_JUMP)) //A
|
||||
myz -= j;
|
||||
my.z -= j;
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_CROUCH)) //Z
|
||||
myz += j;
|
||||
my.z += j;
|
||||
|
||||
if (shrunk == 0 && (psectlotag == 0 || psectlotag == 2)) k = 32;
|
||||
else k = 16;
|
||||
|
||||
if (myz > (fz-(k<<8)))
|
||||
myz += ((fz-(k<<8))-myz)>>1;
|
||||
if (myz < (cz+(18<<8)))
|
||||
myz = cz+(18<<8);
|
||||
if (my.z > (fz-(k<<8)))
|
||||
my.z += ((fz-(k<<8))-my.z)>>1;
|
||||
if (my.z < (cz+(18<<8)))
|
||||
my.z = cz+(18<<8);
|
||||
}
|
||||
else if (psectlotag != 2)
|
||||
{
|
||||
|
@ -12299,49 +12300,49 @@ static void Net_DoPrediction(void)
|
|||
if (shrunk == 0) i = 34;
|
||||
else i = 12;
|
||||
}
|
||||
if (myz < (fz-(i<<8)) && (G_CheckForSpaceFloor(psect)|G_CheckForSpaceCeiling(psect)) == 0) //falling
|
||||
if (my.z < (fz-(i<<8)) && (G_CheckForSpaceFloor(psect)|G_CheckForSpaceCeiling(psect)) == 0) //falling
|
||||
{
|
||||
if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && !TEST_SYNC_KEY(sb_snum, SK_CROUCH) &&
|
||||
myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8)))
|
||||
myz = fz-(i<<8);
|
||||
myonground && (sector[psect].floorstat&2) && my.z >= (fz-(i<<8)-(16<<8)))
|
||||
my.z = fz-(i<<8);
|
||||
else
|
||||
{
|
||||
myonground = 0;
|
||||
|
||||
myzvel += (g_spriteGravity+80);
|
||||
myvel.z += (g_spriteGravity+80);
|
||||
|
||||
if (myzvel >= (4096+2048)) myzvel = (4096+2048);
|
||||
if (myvel.z >= (4096+2048)) myvel.z = (4096+2048);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (psectlotag != 1 && psectlotag != 2 && myonground == 0 && myzvel > (6144>>1))
|
||||
myhardlanding = myzvel>>10;
|
||||
if (psectlotag != 1 && psectlotag != 2 && myonground == 0 && myvel.z > (6144>>1))
|
||||
myhardlanding = myvel.z>>10;
|
||||
myonground = 1;
|
||||
|
||||
if (i==40)
|
||||
{
|
||||
//Smooth on the ground
|
||||
|
||||
k = ((fz-(i<<8))-myz)>>1;
|
||||
k = ((fz-(i<<8))-my.z)>>1;
|
||||
if (klabs(k) < 256) k = 0;
|
||||
myz += k; // ((fz-(i<<8))-myz)>>1;
|
||||
myzvel -= 768; // 412;
|
||||
if (myzvel < 0) myzvel = 0;
|
||||
my.z += k; // ((fz-(i<<8))-my.z)>>1;
|
||||
myvel.z -= 768; // 412;
|
||||
if (myvel.z < 0) myvel.z = 0;
|
||||
}
|
||||
else if (myjumpingcounter == 0)
|
||||
{
|
||||
myz += ((fz-(i<<7))-myz)>>1; //Smooth on the water
|
||||
if (p->on_warping_sector == 0 && myz > fz-(16<<8))
|
||||
my.z += ((fz-(i<<7))-my.z)>>1; //Smooth on the water
|
||||
if (p->on_warping_sector == 0 && my.z > fz-(16<<8))
|
||||
{
|
||||
myz = fz-(16<<8);
|
||||
myzvel >>= 1;
|
||||
my.z = fz-(16<<8);
|
||||
myvel.z >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_CROUCH))
|
||||
myz += (2048+768);
|
||||
my.z += (2048+768);
|
||||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_JUMP) == 0 && myjumpingtoggle == 1)
|
||||
myjumpingtoggle = 0;
|
||||
|
@ -12369,11 +12370,11 @@ static void Net_DoPrediction(void)
|
|||
if (psectlotag == 1 && myjumpingcounter > 768)
|
||||
{
|
||||
myjumpingcounter = 0;
|
||||
myzvel = -512;
|
||||
myvel.z = -512;
|
||||
}
|
||||
else
|
||||
{
|
||||
myzvel -= (sintable[(2048-128+myjumpingcounter)&2047])/12;
|
||||
myvel.z -= (sintable[(2048-128+myjumpingcounter)&2047])/12;
|
||||
myjumpingcounter += 180;
|
||||
|
||||
myonground = 0;
|
||||
|
@ -12382,18 +12383,18 @@ static void Net_DoPrediction(void)
|
|||
else
|
||||
{
|
||||
myjumpingcounter = 0;
|
||||
myzvel = 0;
|
||||
myvel.z = 0;
|
||||
}
|
||||
}
|
||||
|
||||
myz += myzvel;
|
||||
my.z += myvel.z;
|
||||
|
||||
if (myz < (cz+(4<<8)))
|
||||
if (my.z < (cz+(4<<8)))
|
||||
{
|
||||
myjumpingcounter = 0;
|
||||
if (myzvel < 0) myxvel = myyvel = 0;
|
||||
myzvel = 128;
|
||||
myz = cz+(4<<8);
|
||||
if (myvel.z < 0) myvel.x = myvel.y = 0;
|
||||
myvel.z = 128;
|
||||
my.z = cz+(4<<8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12407,8 +12408,8 @@ static void Net_DoPrediction(void)
|
|||
p->kickback_pic < 4))
|
||||
{
|
||||
doubvel = 0;
|
||||
myxvel = 0;
|
||||
myyvel = 0;
|
||||
myvel.x = 0;
|
||||
myvel.y = 0;
|
||||
}
|
||||
else if (syn->avel) //p->ang += syncangvel * constant
|
||||
{
|
||||
|
@ -12421,42 +12422,42 @@ static void Net_DoPrediction(void)
|
|||
myang &= 2047;
|
||||
}
|
||||
|
||||
if (myxvel || myyvel || syn->fvel || syn->svel)
|
||||
if (myvel.x || myvel.y || syn->fvel || syn->svel)
|
||||
{
|
||||
if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400)
|
||||
doubvel <<= 1;
|
||||
|
||||
myxvel += ((syn->fvel*doubvel)<<6);
|
||||
myyvel += ((syn->svel*doubvel)<<6);
|
||||
myvel.x += ((syn->fvel*doubvel)<<6);
|
||||
myvel.y += ((syn->svel*doubvel)<<6);
|
||||
|
||||
if ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && myonground) || (myonground && TEST_SYNC_KEY(sb_snum, SK_CROUCH)))
|
||||
{
|
||||
myxvel = mulscale16(myxvel,p->runspeed-0x2000);
|
||||
myyvel = mulscale16(myyvel,p->runspeed-0x2000);
|
||||
myvel.x = mulscale16(myvel.x,p->runspeed-0x2000);
|
||||
myvel.y = mulscale16(myvel.y,p->runspeed-0x2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (psectlotag == 2)
|
||||
{
|
||||
myxvel = mulscale16(myxvel,p->runspeed-0x1400);
|
||||
myyvel = mulscale16(myyvel,p->runspeed-0x1400);
|
||||
myvel.x = mulscale16(myvel.x,p->runspeed-0x1400);
|
||||
myvel.y = mulscale16(myvel.y,p->runspeed-0x1400);
|
||||
}
|
||||
else
|
||||
{
|
||||
myxvel = mulscale16(myxvel,p->runspeed);
|
||||
myyvel = mulscale16(myyvel,p->runspeed);
|
||||
myvel.x = mulscale16(myvel.x,p->runspeed);
|
||||
myvel.y = mulscale16(myvel.y,p->runspeed);
|
||||
}
|
||||
}
|
||||
|
||||
if (klabs(myxvel) < 2048 && klabs(myyvel) < 2048)
|
||||
myxvel = myyvel = 0;
|
||||
if (klabs(myvel.x) < 2048 && klabs(myvel.y) < 2048)
|
||||
myvel.x = myvel.y = 0;
|
||||
|
||||
if (shrunk)
|
||||
{
|
||||
myxvel =
|
||||
mulscale16(myxvel,(p->runspeed)-(p->runspeed>>1)+(p->runspeed>>2));
|
||||
myyvel =
|
||||
mulscale16(myyvel,(p->runspeed)-(p->runspeed>>1)+(p->runspeed>>2));
|
||||
myvel.x =
|
||||
mulscale16(myvel.x,(p->runspeed)-(p->runspeed>>1)+(p->runspeed>>2));
|
||||
myvel.y =
|
||||
mulscale16(myvel.y,(p->runspeed)-(p->runspeed>>1)+(p->runspeed>>2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12464,11 +12465,11 @@ FAKEHORIZONLY:
|
|||
if (psectlotag == 1 || spritebridge == 1) i = (4L<<8);
|
||||
else i = (20L<<8);
|
||||
|
||||
clipmove(&myx,&myy,&myz,&mycursectnum,myxvel,myyvel,164L,4L<<8,i,CLIPMASK0);
|
||||
pushmove(&myx,&myy,&myz,&mycursectnum,164L,4L<<8,4L<<8,CLIPMASK0);
|
||||
clipmove(&my,&mycursectnum,myvel.x,myvel.y,164L,4L<<8,i,CLIPMASK0);
|
||||
pushmove(&my,&mycursectnum,164L,4L<<8,4L<<8,CLIPMASK0);
|
||||
|
||||
if (p->jetpack_on == 0 && psectlotag != 1 && psectlotag != 2 && shrunk)
|
||||
myz += 30<<8;
|
||||
my.z += 30<<8;
|
||||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_CENTER_VIEW) || myhardlanding)
|
||||
myreturntocenter = 9;
|
||||
|
@ -12530,9 +12531,9 @@ ENDFAKEPROCESSINPUT:
|
|||
|
||||
X_OnEvent(EVENT_FAKEDOMOVETHINGS, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
|
||||
myxbak[predictfifoplc&(MOVEFIFOSIZ-1)] = myx;
|
||||
myybak[predictfifoplc&(MOVEFIFOSIZ-1)] = myy;
|
||||
myzbak[predictfifoplc&(MOVEFIFOSIZ-1)] = myz;
|
||||
myxbak[predictfifoplc&(MOVEFIFOSIZ-1)] = my.x;
|
||||
myybak[predictfifoplc&(MOVEFIFOSIZ-1)] = my.y;
|
||||
myzbak[predictfifoplc&(MOVEFIFOSIZ-1)] = my.z;
|
||||
myangbak[predictfifoplc&(MOVEFIFOSIZ-1)] = myang;
|
||||
myhorizbak[predictfifoplc&(MOVEFIFOSIZ-1)] = myhoriz;
|
||||
predictfifoplc++;
|
||||
|
@ -12612,29 +12613,30 @@ static int32_t G_DoMoveThings(void)
|
|||
|
||||
if (ud.idplayers && ud.multimode > 1)
|
||||
{
|
||||
int32_t sx,sy,sz;
|
||||
int16_t sect,hw,hs;
|
||||
hitdata_t hitinfo;
|
||||
|
||||
for (i=0;i<ud.multimode;i++)
|
||||
if (g_player[i].ps->holoduke_on != -1)
|
||||
sprite[g_player[i].ps->holoduke_on].cstat ^= 256;
|
||||
|
||||
hitscan(g_player[screenpeek].ps->posx,g_player[screenpeek].ps->posy,g_player[screenpeek].ps->posz,g_player[screenpeek].ps->cursectnum,
|
||||
hitscan((vec3_t *)g_player[screenpeek].ps,g_player[screenpeek].ps->cursectnum,
|
||||
sintable[(g_player[screenpeek].ps->ang+512)&2047],
|
||||
sintable[g_player[screenpeek].ps->ang&2047],
|
||||
(100-g_player[screenpeek].ps->horiz-g_player[screenpeek].ps->horizoff)<<11,§,&hw,&hs,&sx,&sy,&sz,0xffff0030);
|
||||
(100-g_player[screenpeek].ps->horiz-g_player[screenpeek].ps->horizoff)<<11,&hitinfo,0xffff0030);
|
||||
|
||||
for (i=0;i<ud.multimode;i++)
|
||||
if (g_player[i].ps->holoduke_on != -1)
|
||||
sprite[g_player[i].ps->holoduke_on].cstat ^= 256;
|
||||
|
||||
if ((hs >= 0) && !(g_player[myconnectindex].ps->gm & MODE_MENU) && sprite[hs].picnum == APLAYER && sprite[hs].yvel != screenpeek && g_player[sprite[hs].yvel].ps->dead_flag == 0)
|
||||
if ((hitinfo.hitsprite >= 0) && !(g_player[myconnectindex].ps->gm & MODE_MENU) &&
|
||||
sprite[hitinfo.hitsprite].picnum == APLAYER && sprite[hitinfo.hitsprite].yvel != screenpeek &&
|
||||
g_player[sprite[hitinfo.hitsprite].yvel].ps->dead_flag == 0)
|
||||
{
|
||||
if (g_player[screenpeek].ps->fta == 0 || g_player[screenpeek].ps->ftq == 117)
|
||||
{
|
||||
if (ldist(&sprite[g_player[screenpeek].ps->i],&sprite[hs]) < 9216)
|
||||
if (ldist(&sprite[g_player[screenpeek].ps->i],&sprite[hitinfo.hitsprite]) < 9216)
|
||||
{
|
||||
Bsprintf(ScriptQuotes[117],"%s",&g_player[sprite[hs].yvel].user_name[0]);
|
||||
Bsprintf(ScriptQuotes[117],"%s",&g_player[sprite[hitinfo.hitsprite].yvel].user_name[0]);
|
||||
g_player[screenpeek].ps->fta = 12, g_player[screenpeek].ps->ftq = 117;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,19 +202,20 @@ int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs)
|
|||
|
||||
{
|
||||
int32_t furthest_angle=0;
|
||||
int16_t hitsect,hitwall,hitspr;
|
||||
int32_t hx, hy, hz, d;
|
||||
int32_t d;
|
||||
int32_t greatestd = -(1<<30);
|
||||
int32_t angincs = 2048/angs,j;
|
||||
hitdata_t hitinfo;
|
||||
|
||||
for (j=s->ang;j<(2048+s->ang);j+=angincs)
|
||||
{
|
||||
hitscan(s->x, s->y, s->z-(8<<8), s->sectnum,
|
||||
s->z -= (8<<8);
|
||||
hitscan((const vec3_t *)s, s->sectnum,
|
||||
sintable[(j+512)&2047],
|
||||
sintable[j&2047],0,
|
||||
&hitsect,&hitwall,&hitspr,&hx,&hy,&hz,CLIPMASK1);
|
||||
|
||||
d = klabs(hx-s->x) + klabs(hy-s->y);
|
||||
&hitinfo,CLIPMASK1);
|
||||
s->z += (8<<8);
|
||||
d = klabs(hitinfo.pos.x-s->x) + klabs(hitinfo.pos.y-s->y);
|
||||
|
||||
if (d > greatestd)
|
||||
{
|
||||
|
@ -230,10 +231,10 @@ int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_
|
|||
{
|
||||
if ((ActorExtra[iActor].temp_data[0]&63)) return -1;
|
||||
{
|
||||
int16_t hitsect,hitwall,hitspr, angincs;
|
||||
int32_t hx, hy, hz, d, da;//, d, cd, ca,tempx,tempy,cx,cy;
|
||||
int32_t j;
|
||||
int32_t d, da;//, d, cd, ca,tempx,tempy,cx,cy;
|
||||
int32_t j, angincs;
|
||||
spritetype *s = &sprite[iActor];
|
||||
hitdata_t hitinfo;
|
||||
|
||||
if (ud.multimode < 2 && ud.player_skill < 3)
|
||||
angincs = 2048/2;
|
||||
|
@ -241,20 +242,24 @@ int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_
|
|||
|
||||
for (j=ts->ang;j<(2048+ts->ang);j+=(angincs-(krand()&511)))
|
||||
{
|
||||
hitscan(ts->x, ts->y, ts->z-(16<<8), ts->sectnum,
|
||||
ts->z -= (16<<8);
|
||||
hitscan((const vec3_t *)ts, ts->sectnum,
|
||||
sintable[(j+512)&2047],
|
||||
sintable[j&2047],16384-(krand()&32767),
|
||||
&hitsect,&hitwall,&hitspr,&hx,&hy,&hz,CLIPMASK1);
|
||||
&hitinfo,CLIPMASK1);
|
||||
|
||||
d = klabs(hx-ts->x)+klabs(hy-ts->y);
|
||||
da = klabs(hx-s->x)+klabs(hy-s->y);
|
||||
ts->z += (16<<8);
|
||||
|
||||
if (d < da && hitsect > -1)
|
||||
if (cansee(hx,hy,hz,hitsect,s->x,s->y,s->z-(16<<8),s->sectnum))
|
||||
d = klabs(hitinfo.pos.x-ts->x)+klabs(hitinfo.pos.y-ts->y);
|
||||
da = klabs(hitinfo.pos.x-s->x)+klabs(hitinfo.pos.y-s->y);
|
||||
|
||||
if (d < da && hitinfo.hitsect > -1)
|
||||
if (cansee(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,
|
||||
hitinfo.hitsect,s->x,s->y,s->z-(16<<8),s->sectnum))
|
||||
{
|
||||
*dax = hx;
|
||||
*day = hy;
|
||||
return hitsect;
|
||||
*dax = hitinfo.pos.x;
|
||||
*day = hitinfo.pos.y;
|
||||
return hitinfo.hitsect;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
@ -272,7 +277,9 @@ void A_GetZLimits(int32_t iActor)
|
|||
if (s->statnum == 4)
|
||||
zr = 4L;
|
||||
|
||||
getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&ActorExtra[iActor].ceilingz,&hz,&ActorExtra[iActor].floorz,&lz,zr,CLIPMASK0);
|
||||
s->z -= FOURSLEIGHT;
|
||||
getzrange((vec3_t *)s,s->sectnum,&ActorExtra[iActor].ceilingz,&hz,&ActorExtra[iActor].floorz,&lz,zr,CLIPMASK0);
|
||||
s->z += FOURSLEIGHT;
|
||||
|
||||
if ((lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0)
|
||||
{
|
||||
|
@ -321,7 +328,11 @@ void A_Fall(int32_t iActor)
|
|||
}
|
||||
|
||||
if ((s->statnum == 1 || s->statnum == 10 || s->statnum == 2 || s->statnum == 6))
|
||||
getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&ActorExtra[iActor].ceilingz,&hz,&ActorExtra[iActor].floorz,&lz,127L,CLIPMASK0);
|
||||
{
|
||||
s->z -= FOURSLEIGHT;
|
||||
getzrange((vec3_t *)s,s->sectnum,&ActorExtra[iActor].ceilingz,&hz,&ActorExtra[iActor].floorz,&lz,127L,CLIPMASK0);
|
||||
s->z += FOURSLEIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
ActorExtra[iActor].ceilingz = sector[s->sectnum].ceilingz;
|
||||
|
@ -445,7 +456,7 @@ static void X_Move(void)
|
|||
{
|
||||
ActorExtra[vm.g_i].bposx = vm.g_sp->x;
|
||||
ActorExtra[vm.g_i].bposy = vm.g_sp->y;
|
||||
setsprite(vm.g_i,vm.g_sp->x,vm.g_sp->y,vm.g_sp->z);
|
||||
setsprite(vm.g_i,(vec3_t *)vm.g_sp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1078,7 +1089,7 @@ static int32_t X_DoExecute(void)
|
|||
else if (vm.g_sp->zvel > 2048 && sector[vm.g_sp->sectnum].lotag != 1)
|
||||
{
|
||||
j = vm.g_sp->sectnum;
|
||||
pushmove(&vm.g_sp->x,&vm.g_sp->y,&vm.g_sp->z,(int16_t*)&j,128L,(4L<<8),(4L<<8),CLIPMASK0);
|
||||
pushmove((vec3_t *)vm.g_sp,(int16_t*)&j,128L,(4L<<8),(4L<<8),CLIPMASK0);
|
||||
if (j != vm.g_sp->sectnum && j >= 0 && j < MAXSECTORS)
|
||||
changespritesect(vm.g_i,j);
|
||||
A_PlaySound(THUD,vm.g_i);
|
||||
|
@ -2276,48 +2287,62 @@ static int32_t X_DoExecute(void)
|
|||
case CON_GETZRANGE:
|
||||
insptr++;
|
||||
{
|
||||
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z=Gv_GetVarX(*insptr++);
|
||||
int32_t sectnum=Gv_GetVarX(*insptr++);
|
||||
int32_t ceilzvar=*insptr++, ceilhitvar=*insptr++, florzvar=*insptr++, florhitvar=*insptr++;
|
||||
int32_t walldist=Gv_GetVarX(*insptr++), clipmask=Gv_GetVarX(*insptr++);
|
||||
int32_t ceilz, ceilhit, florz, florhit;
|
||||
vec3_t vect;
|
||||
|
||||
vect.x = Gv_GetVarX(*insptr++);
|
||||
vect.y = Gv_GetVarX(*insptr++);
|
||||
vect.z = Gv_GetVarX(*insptr++);
|
||||
|
||||
if ((sectnum<0 || sectnum>=numsectors) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
|
||||
break;
|
||||
int32_t sectnum=Gv_GetVarX(*insptr++);
|
||||
int32_t ceilzvar=*insptr++, ceilhitvar=*insptr++, florzvar=*insptr++, florhitvar=*insptr++;
|
||||
int32_t walldist=Gv_GetVarX(*insptr++), clipmask=Gv_GetVarX(*insptr++);
|
||||
int32_t ceilz, ceilhit, florz, florhit;
|
||||
|
||||
|
||||
if ((sectnum<0 || sectnum>=numsectors) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
|
||||
break;
|
||||
}
|
||||
getzrange(&vect, sectnum, &ceilz, &ceilhit, &florz, &florhit, walldist, clipmask);
|
||||
Gv_SetVarX(ceilzvar, ceilz);
|
||||
Gv_SetVarX(ceilhitvar, ceilhit);
|
||||
Gv_SetVarX(florzvar, florz);
|
||||
Gv_SetVarX(florhitvar, florhit);
|
||||
}
|
||||
getzrange(x, y, z, sectnum, &ceilz, &ceilhit, &florz, &florhit, walldist, clipmask);
|
||||
Gv_SetVarX(ceilzvar, ceilz);
|
||||
Gv_SetVarX(ceilhitvar, ceilhit);
|
||||
Gv_SetVarX(florzvar, florz);
|
||||
Gv_SetVarX(florhitvar, florhit);
|
||||
break;
|
||||
}
|
||||
|
||||
case CON_HITSCAN:
|
||||
insptr++;
|
||||
{
|
||||
int32_t xs=Gv_GetVarX(*insptr++), ys=Gv_GetVarX(*insptr++), zs=Gv_GetVarX(*insptr++);
|
||||
int32_t sectnum=Gv_GetVarX(*insptr++);
|
||||
int32_t vx=Gv_GetVarX(*insptr++), vy=Gv_GetVarX(*insptr++), vz=Gv_GetVarX(*insptr++);
|
||||
int32_t hitsectvar=*insptr++, hitwallvar=*insptr++, hitspritevar=*insptr++;
|
||||
int32_t hitxvar=*insptr++, hityvar=*insptr++, hitzvar=*insptr++, cliptype=Gv_GetVarX(*insptr++);
|
||||
int16_t hitsect, hitwall, hitsprite;
|
||||
int32_t hitx, hity, hitz;
|
||||
vec3_t vect;
|
||||
hitdata_t hitinfo;
|
||||
|
||||
vect.x = Gv_GetVarX(*insptr++);
|
||||
vect.x = Gv_GetVarX(*insptr++);
|
||||
vect.z = Gv_GetVarX(*insptr++);
|
||||
|
||||
if ((sectnum<0 || sectnum>=numsectors) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
|
||||
break;
|
||||
int32_t sectnum=Gv_GetVarX(*insptr++);
|
||||
int32_t vx=Gv_GetVarX(*insptr++), vy=Gv_GetVarX(*insptr++), vz=Gv_GetVarX(*insptr++);
|
||||
int32_t hitsectvar=*insptr++, hitwallvar=*insptr++, hitspritevar=*insptr++;
|
||||
int32_t hitxvar=*insptr++, hityvar=*insptr++, hitzvar=*insptr++, cliptype=Gv_GetVarX(*insptr++);
|
||||
|
||||
if ((sectnum<0 || sectnum>=numsectors) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
|
||||
break;
|
||||
}
|
||||
hitscan((const vec3_t *)&vect, sectnum, vx, vy, vz, &hitinfo, cliptype);
|
||||
Gv_SetVarX(hitsectvar, hitinfo.hitsect);
|
||||
Gv_SetVarX(hitwallvar, hitinfo.hitwall);
|
||||
Gv_SetVarX(hitspritevar, hitinfo.hitsprite);
|
||||
Gv_SetVarX(hitxvar, hitinfo.pos.x);
|
||||
Gv_SetVarX(hityvar, hitinfo.pos.y);
|
||||
Gv_SetVarX(hitzvar, hitinfo.pos.z);
|
||||
}
|
||||
hitscan(xs, ys, zs, sectnum, vx, vy, vz, &hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, cliptype);
|
||||
Gv_SetVarX(hitsectvar, hitsect);
|
||||
Gv_SetVarX(hitwallvar, hitwall);
|
||||
Gv_SetVarX(hitspritevar, hitsprite);
|
||||
Gv_SetVarX(hitxvar, hitx);
|
||||
Gv_SetVarX(hityvar, hity);
|
||||
Gv_SetVarX(hitzvar, hitz);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2423,7 +2448,7 @@ static int32_t X_DoExecute(void)
|
|||
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum);
|
||||
break;
|
||||
}
|
||||
setsprite(spritenum, davector.x, davector.y, davector.z);
|
||||
setsprite(spritenum, &davector);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2620,12 +2645,17 @@ static int32_t X_DoExecute(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
vec3_t tmpvect;
|
||||
|
||||
tmpvect.x = g_player[vm.g_p].ps->posx;
|
||||
tmpvect.y = g_player[vm.g_p].ps->posy;
|
||||
tmpvect.z = g_player[vm.g_p].ps->posz+PHEIGHT;
|
||||
P_RandomSpawnPoint(vm.g_p);
|
||||
vm.g_sp->x = ActorExtra[vm.g_i].bposx = g_player[vm.g_p].ps->bobposx = g_player[vm.g_p].ps->oposx = g_player[vm.g_p].ps->posx;
|
||||
vm.g_sp->y = ActorExtra[vm.g_i].bposy = g_player[vm.g_p].ps->bobposy = g_player[vm.g_p].ps->oposy =g_player[vm.g_p].ps->posy;
|
||||
vm.g_sp->z = ActorExtra[vm.g_i].bposy = g_player[vm.g_p].ps->oposz =g_player[vm.g_p].ps->posz;
|
||||
updatesector(g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,&g_player[vm.g_p].ps->cursectnum);
|
||||
setsprite(g_player[vm.g_p].ps->i,g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,g_player[vm.g_p].ps->posz+PHEIGHT);
|
||||
setsprite(g_player[vm.g_p].ps->i,&tmpvect);
|
||||
vm.g_sp->cstat = 257;
|
||||
|
||||
vm.g_sp->shade = -12;
|
||||
|
|
|
@ -1501,15 +1501,15 @@ static void Gv_AddSystemVars(void)
|
|||
Gv_NewVar("cameradist",(intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("cameraclock",(intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
|
||||
Gv_NewVar("myx",(intptr_t)&myx, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myy",(intptr_t)&myy, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myz",(intptr_t)&myz, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("omyx",(intptr_t)&omyx, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("omyy",(intptr_t)&omyy, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("omyz",(intptr_t)&omyz, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myxvel",(intptr_t)&myxvel, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myyvel",(intptr_t)&myyvel, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myzvel",(intptr_t)&myzvel, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myx",(intptr_t)&my.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myy",(intptr_t)&my.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myz",(intptr_t)&my.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("omyx",(intptr_t)&omy.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("omyy",(intptr_t)&omy.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("omyz",(intptr_t)&omy.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myvelx",(intptr_t)&myvel.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myvely",(intptr_t)&myvel.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myvelz",(intptr_t)&myvel.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
|
||||
|
||||
Gv_NewVar("myhoriz",(intptr_t)&myhoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK);
|
||||
Gv_NewVar("myhorizoff",(intptr_t)&myhorizoff, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK);
|
||||
|
@ -1651,15 +1651,15 @@ void Gv_RefreshPointers(void)
|
|||
aGameVars[Gv_GetVarIndex("cameradist")].val.lValue = (intptr_t)&g_cameraDistance;
|
||||
aGameVars[Gv_GetVarIndex("cameraclock")].val.lValue = (intptr_t)&g_cameraClock;
|
||||
|
||||
aGameVars[Gv_GetVarIndex("myx")].val.lValue = (intptr_t)&myx;
|
||||
aGameVars[Gv_GetVarIndex("myy")].val.lValue = (intptr_t)&myy;
|
||||
aGameVars[Gv_GetVarIndex("myz")].val.lValue = (intptr_t)&myz;
|
||||
aGameVars[Gv_GetVarIndex("omyx")].val.lValue = (intptr_t)&omyx;
|
||||
aGameVars[Gv_GetVarIndex("omyy")].val.lValue = (intptr_t)&omyy;
|
||||
aGameVars[Gv_GetVarIndex("omyz")].val.lValue = (intptr_t)&omyz;
|
||||
aGameVars[Gv_GetVarIndex("myxvel")].val.lValue = (intptr_t)&myxvel;
|
||||
aGameVars[Gv_GetVarIndex("myyvel")].val.lValue = (intptr_t)&myyvel;
|
||||
aGameVars[Gv_GetVarIndex("myzvel")].val.lValue = (intptr_t)&myzvel;
|
||||
aGameVars[Gv_GetVarIndex("myx")].val.lValue = (intptr_t)&my.x;
|
||||
aGameVars[Gv_GetVarIndex("myy")].val.lValue = (intptr_t)&my.y;
|
||||
aGameVars[Gv_GetVarIndex("myz")].val.lValue = (intptr_t)&my.z;
|
||||
aGameVars[Gv_GetVarIndex("omyx")].val.lValue = (intptr_t)&omy.x;
|
||||
aGameVars[Gv_GetVarIndex("omyy")].val.lValue = (intptr_t)&omy.y;
|
||||
aGameVars[Gv_GetVarIndex("omyz")].val.lValue = (intptr_t)&omy.z;
|
||||
aGameVars[Gv_GetVarIndex("myvelx")].val.lValue = (intptr_t)&myvel.x;
|
||||
aGameVars[Gv_GetVarIndex("myvely")].val.lValue = (intptr_t)&myvel.y;
|
||||
aGameVars[Gv_GetVarIndex("myvelz")].val.lValue = (intptr_t)&myvel.z;
|
||||
|
||||
aGameVars[Gv_GetVarIndex("myhoriz")].val.lValue = (intptr_t)&myhoriz;
|
||||
aGameVars[Gv_GetVarIndex("myhorizoff")].val.lValue = (intptr_t)&myhorizoff;
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
#include "duke3d.h"
|
||||
|
||||
const char *s_buildDate = "20090105";
|
||||
const char *s_buildDate = "20090112";
|
||||
char *MusicPtr = NULL;
|
||||
int32_t g_musicSize;
|
||||
|
||||
|
@ -147,7 +147,7 @@ int32_t g_impactDamage;
|
|||
int32_t g_scriptDebug;
|
||||
|
||||
//GLOBAL.C - replace the end "my's" with this
|
||||
int32_t myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
|
||||
vec3_t my, omy, myvel;
|
||||
int16_t myhoriz, omyhoriz, myhorizoff, omyhorizoff;
|
||||
int16_t myang, omyang, mycursectnum, myjumpingcounter;
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ char *defsfilename = "duke3d.def";
|
|||
|
||||
extern char keystatus[];
|
||||
extern int16_t defaultspritecstat;
|
||||
extern int32_t posx, posy, posz, horiz, qsetmode;
|
||||
extern int32_t horiz, qsetmode;
|
||||
extern vec3_t pos;
|
||||
extern int16_t ang, cursectnum;
|
||||
extern int16_t ceilingheinum, floorheinum;
|
||||
extern char names[MAXTILES][25];
|
||||
|
|
|
@ -515,11 +515,11 @@ static int32_t osdcmd_setweaponscale(const osdfuncparm_t *parm)
|
|||
|
||||
static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
|
||||
{
|
||||
int32_t x=0,y=0,z=0;
|
||||
uint16_t cstat=0,picnum=0;
|
||||
char pal=0;
|
||||
int16_t ang=0;
|
||||
int16_t set=0, idx;
|
||||
vec3_t vect;
|
||||
|
||||
if (numplayers > 1 || !(g_player[myconnectindex].ps->gm & MODE_GAME))
|
||||
{
|
||||
|
@ -530,9 +530,9 @@ static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
|
|||
switch (parm->numparms)
|
||||
{
|
||||
case 7: // x,y,z
|
||||
x = Batol(parm->parms[4]);
|
||||
y = Batol(parm->parms[5]);
|
||||
z = Batol(parm->parms[6]);
|
||||
vect.x = Batol(parm->parms[4]);
|
||||
vect.y = Batol(parm->parms[5]);
|
||||
vect.z = Batol(parm->parms[6]);
|
||||
set |= 8;
|
||||
case 4: // ang
|
||||
ang = Batol(parm->parms[3]) & 2047;
|
||||
|
@ -589,7 +589,7 @@ static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
|
|||
if (set & 4) sprite[idx].ang = ang;
|
||||
if (set & 8)
|
||||
{
|
||||
if (setsprite(idx, x,y,z) < 0)
|
||||
if (setsprite(idx, &vect) < 0)
|
||||
{
|
||||
OSD_Printf("spawn: Sprite can't be spawned into null space\n");
|
||||
deletesprite(idx);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1629,10 +1629,10 @@ void clearfifo(void)
|
|||
|
||||
void Net_ResetPrediction(void)
|
||||
{
|
||||
myx = omyx = g_player[myconnectindex].ps->posx;
|
||||
myy = omyy = g_player[myconnectindex].ps->posy;
|
||||
myz = omyz = g_player[myconnectindex].ps->posz;
|
||||
myxvel = myyvel = myzvel = 0;
|
||||
my.x = omy.x = g_player[myconnectindex].ps->posx;
|
||||
my.y = omy.y = g_player[myconnectindex].ps->posy;
|
||||
my.z = omy.z = g_player[myconnectindex].ps->posz;
|
||||
myvel.x = myvel.y = myvel.z = 0;
|
||||
myang = omyang = g_player[myconnectindex].ps->ang;
|
||||
myhoriz = omyhoriz = g_player[myconnectindex].ps->horiz;
|
||||
myhorizoff = omyhorizoff = g_player[myconnectindex].ps->horizoff;
|
||||
|
|
|
@ -188,7 +188,7 @@ int32_t isanearoperator(int32_t lotag)
|
|||
return 0;
|
||||
}
|
||||
|
||||
inline int32_t CheckPlayerInSector(int32_t sect)
|
||||
inline int32_t G_CheckPlayerInSector(int32_t sect)
|
||||
{
|
||||
int32_t i = connecthead;
|
||||
for (;i>=0;i=connectpoint2[i])
|
||||
|
@ -329,8 +329,8 @@ void G_DoSectorAnimations(void)
|
|||
g_player[p].ps->poszv = 0;
|
||||
if (p == myconnectindex)
|
||||
{
|
||||
myz += v;
|
||||
myzvel = 0;
|
||||
my.z += v;
|
||||
myvel.z = 0;
|
||||
myzbak[((movefifoplc-1)&(MOVEFIFOSIZ-1))] = g_player[p].ps->posz;
|
||||
}
|
||||
}
|
||||
|
@ -2456,7 +2456,7 @@ void A_DamageObject(int32_t i,int32_t sn)
|
|||
SA = (sprite[sn].ang+1024)&2047;
|
||||
sprite[i].xvel = -(sprite[sn].extra<<2);
|
||||
j = SECT;
|
||||
pushmove(&SX,&SY,&SZ,&j,128L,(4L<<8),(4L<<8),CLIPMASK0);
|
||||
pushmove((vec3_t *)&sprite[i],&j,128L,(4L<<8),(4L<<8),CLIPMASK0);
|
||||
if (j != SECT && j >= 0 && j < MAXSECTORS)
|
||||
changespritesect(i,j);
|
||||
}
|
||||
|
@ -3201,38 +3201,41 @@ CHECKINV1:
|
|||
}
|
||||
}
|
||||
|
||||
int32_t A_CheckHitSprite(int32_t i,int16_t *hitsp)
|
||||
int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp)
|
||||
{
|
||||
int32_t sx,sy,sz,zoff;
|
||||
int16_t sect,hw;
|
||||
hitdata_t hitinfo;
|
||||
int32_t zoff = 0;
|
||||
|
||||
if (A_CheckEnemySprite(&sprite[i]))
|
||||
zoff = (42<<8);
|
||||
else if (PN == APLAYER) zoff = (39<<8);
|
||||
else zoff = 0;
|
||||
|
||||
hitscan(SX,SY,SZ-zoff,SECT,
|
||||
SZ -= zoff;
|
||||
hitscan((const vec3_t *)&sprite[i],SECT,
|
||||
sintable[(SA+512)&2047],
|
||||
sintable[SA&2047],
|
||||
0,§,&hw,hitsp,&sx,&sy,&sz,CLIPMASK1);
|
||||
0,&hitinfo,CLIPMASK1);
|
||||
|
||||
if (hw >= 0 && (wall[hw].cstat&16) && A_CheckEnemySprite(&sprite[i]))
|
||||
SZ += zoff;
|
||||
*hitsp = hitinfo.hitsprite;
|
||||
if (hitinfo.hitwall >= 0 && (wall[hitinfo.hitwall].cstat&16) && A_CheckEnemySprite(&sprite[i]))
|
||||
return((1<<30));
|
||||
|
||||
return (FindDistance2D(sx-SX,sy-SY));
|
||||
return (FindDistance2D(hitinfo.pos.x-SX,hitinfo.pos.y-SY));
|
||||
}
|
||||
|
||||
static int32_t hitawall(DukePlayer_t *p,int16_t *hitw)
|
||||
{
|
||||
int32_t sx,sy,sz;
|
||||
int16_t sect,hs;
|
||||
hitdata_t hitinfo;
|
||||
|
||||
hitscan(p->posx,p->posy,p->posz,p->cursectnum,
|
||||
hitscan((const vec3_t *)p,p->cursectnum,
|
||||
sintable[(p->ang+512)&2047],
|
||||
sintable[p->ang&2047],
|
||||
0,§,hitw,&hs,&sx,&sy,&sz,CLIPMASK0);
|
||||
0,&hitinfo,CLIPMASK0);
|
||||
|
||||
return (FindDistance2D(sx-p->posx,sy-p->posy));
|
||||
*hitw = hitinfo.hitwall;
|
||||
|
||||
return (FindDistance2D(hitinfo.pos.x-p->posx,hitinfo.pos.y-p->posy));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -513,10 +513,11 @@ int32_t A_PlaySound(uint32_t num, int32_t i)
|
|||
return 0;
|
||||
}
|
||||
{
|
||||
vec3_t davector;
|
||||
Bmemcpy(&davector,&sprite[i],sizeof(intptr_t) * 3);
|
||||
/*
|
||||
vec3_t davector;
|
||||
Bmemcpy(&davector,&sprite[i],sizeof(intptr_t) * 3); */
|
||||
// OSD_Printf("x: %d y: %d z: %d\n",davector.x,davector.y,davector.z);
|
||||
return S_PlaySoundXYZ(num,i, &davector);
|
||||
return S_PlaySoundXYZ(num,i, (vec3_t *)&sprite[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue