mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
SW: hitscan
git-svn-id: https://svn.eduke32.com/eduke32@5202 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
acba32caf4
commit
a97d9c5916
19 changed files with 948 additions and 998 deletions
|
@ -316,8 +316,7 @@ CanHitPlayer(short SpriteNum)
|
|||
{
|
||||
USERp u = User[SpriteNum], hu;
|
||||
SPRITEp sp = User[SpriteNum]->SpriteP, hp;
|
||||
int hitx, hity, hitz;
|
||||
short hitsect, hitwall, hitsprite;
|
||||
hitdata_t hitinfo;
|
||||
int xvect,yvect,zvect;
|
||||
short ang,ret=FALSE;
|
||||
// if actor can still see the player
|
||||
|
@ -357,12 +356,12 @@ CanHitPlayer(short SpriteNum)
|
|||
xvect,
|
||||
yvect,
|
||||
zvect,
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
if (hitsect < 0)
|
||||
if (hitinfo.sect < 0)
|
||||
return FALSE;
|
||||
|
||||
if (hitsprite == u->tgt_sp - sprite)
|
||||
if (hitinfo.sprite == u->tgt_sp - sprite)
|
||||
return TRUE;
|
||||
|
||||
////DSPRINTF(ds,"CanHit %s",ret ? "TRUE" : "FALSE");
|
||||
|
|
|
@ -555,7 +555,7 @@ short FindBreakSpriteMatch(short match)
|
|||
// WALL
|
||||
//
|
||||
|
||||
int AutoBreakWall(WALLp wallp, int hitx, int hity, int hitz, short ang, short type)
|
||||
int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short type)
|
||||
{
|
||||
BREAK_INFOp break_info;
|
||||
short BreakSprite;
|
||||
|
@ -597,8 +597,9 @@ int AutoBreakWall(WALLp wallp, int hitx, int hity, int hitz, short ang, short ty
|
|||
// Check to see if it should break with current weapon type
|
||||
if (!CheckBreakToughness(break_info, type)) return FALSE;
|
||||
|
||||
if (hitx != MAXLONG)
|
||||
if (hit_x != MAXLONG)
|
||||
{
|
||||
vec3_t hit_pos = { hit_x, hit_y, hit_z };
|
||||
// need correct location for spawning shrap
|
||||
BreakSprite = COVERinsertsprite(0, STAT_DEFAULT);
|
||||
ASSERT(BreakSprite >= 0);
|
||||
|
@ -608,7 +609,7 @@ int AutoBreakWall(WALLp wallp, int hitx, int hity, int hitz, short ang, short ty
|
|||
bsp->ang = ang;
|
||||
bsp->picnum = ST1;
|
||||
bsp->xrepeat = bsp->yrepeat = 64;
|
||||
setspritez(BreakSprite, hitx, hity, hitz);
|
||||
setspritez(BreakSprite, &hit_pos);
|
||||
|
||||
// pass Break Info Globally
|
||||
GlobBreakInfo = break_info;
|
||||
|
@ -751,7 +752,7 @@ SWBOOL UserBreakWall(WALLp wp, short UNUSED(ang))
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
int WallBreakPosition(short hitwall, short *sectnum, int *x, int *y, int *z, short *ang)
|
||||
int WallBreakPosition(short hit_wall, short *sectnum, int *x, int *y, int *z, short *ang)
|
||||
{
|
||||
short w,nw;
|
||||
WALLp wp;
|
||||
|
@ -759,7 +760,7 @@ int WallBreakPosition(short hitwall, short *sectnum, int *x, int *y, int *z, sho
|
|||
short wall_ang;
|
||||
int ret=0;
|
||||
|
||||
w = hitwall;
|
||||
w = hit_wall;
|
||||
wp = &wall[w];
|
||||
|
||||
nw = wall[w].point2;
|
||||
|
@ -818,7 +819,7 @@ int WallBreakPosition(short hitwall, short *sectnum, int *x, int *y, int *z, sho
|
|||
}
|
||||
|
||||
// If the tough parameter is not set, then it can't break tough walls and sprites
|
||||
SWBOOL HitBreakWall(WALLp wp, int hitx, int hity, int hitz, short ang, short type)
|
||||
SWBOOL HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short type)
|
||||
{
|
||||
short SpriteNum;
|
||||
short match = wp->hitag;
|
||||
|
@ -829,13 +830,13 @@ SWBOOL HitBreakWall(WALLp wp, int hitx, int hity, int hitz, short ang, short typ
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
//if (hitx == MAXLONG)
|
||||
//if (hit_x == MAXLONG)
|
||||
{
|
||||
short sectnum;
|
||||
WallBreakPosition(wp - wall, §num, &hitx, &hity, &hitz, &ang);
|
||||
WallBreakPosition(wp - wall, §num, &hit_x, &hit_y, &hit_z, &ang);
|
||||
}
|
||||
|
||||
AutoBreakWall(wp, hitx, hity, hitz, ang, type);
|
||||
AutoBreakWall(wp, hit_x, hit_y, hit_z, ang, type);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ short FindBreakSpriteMatch(short match);
|
|||
SWBOOL HitBreakWall(WALLp wp, int, int, int, short ang, short type);
|
||||
int HitBreakSprite(short BreakSprite, short type);
|
||||
SWBOOL CheckBreakToughness(BREAK_INFOp break_info, short ID);
|
||||
int WallBreakPosition(short hitwall, short *sectnum, int *x, int *y, int *z, short *ang);
|
||||
int WallBreakPosition(short hit_wall, short *sectnum, int *x, int *y, int *z, short *ang);
|
||||
void SortBreakInfo(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -977,9 +977,9 @@ DoBunnyQuickJump(short SpriteNum)
|
|||
// Random Chance of like sexes fighting
|
||||
if (u->lo_sp)
|
||||
{
|
||||
short hitsprite = u->lo_sp - sprite;
|
||||
short hit_sprite = u->lo_sp - sprite;
|
||||
SPRITEp tsp = u->lo_sp;
|
||||
USERp tu = User[hitsprite];
|
||||
USERp tu = User[hit_sprite];
|
||||
|
||||
if (!tu || tu->ID != BUNNY_RUN_R0) return FALSE;
|
||||
|
||||
|
@ -999,14 +999,14 @@ DoBunnyQuickJump(short SpriteNum)
|
|||
tu->Health = 0;
|
||||
|
||||
// Blood fountains
|
||||
InitBloodSpray(hitsprite,TRUE,-1);
|
||||
InitBloodSpray(hit_sprite,TRUE,-1);
|
||||
|
||||
if (SpawnShrap(hitsprite, SpriteNum))
|
||||
if (SpawnShrap(hit_sprite, SpriteNum))
|
||||
{
|
||||
SetSuicide(hitsprite);
|
||||
SetSuicide(hit_sprite);
|
||||
}
|
||||
else
|
||||
DoActorDie(hitsprite, SpriteNum);
|
||||
DoActorDie(hit_sprite, SpriteNum);
|
||||
|
||||
Bunny_Count--; // Bunny died
|
||||
|
||||
|
@ -1019,9 +1019,9 @@ DoBunnyQuickJump(short SpriteNum)
|
|||
// Get layed!
|
||||
if (u->lo_sp && u->spal == PALETTE_PLAYER8) // Only males check this
|
||||
{
|
||||
short hitsprite = u->lo_sp - sprite;
|
||||
short hit_sprite = u->lo_sp - sprite;
|
||||
SPRITEp tsp = u->lo_sp;
|
||||
USERp tu = User[hitsprite];
|
||||
USERp tu = User[hit_sprite];
|
||||
|
||||
|
||||
if (!tu || tu->ID != BUNNY_RUN_R0) return FALSE;
|
||||
|
@ -1088,7 +1088,7 @@ DoBunnyQuickJump(short SpriteNum)
|
|||
tu->Vis = tsp->ang;
|
||||
|
||||
NewStateGroup(SpriteNum, sg_BunnyScrew);
|
||||
NewStateGroup(hitsprite, sg_BunnyScrew);
|
||||
NewStateGroup(hit_sprite, sg_BunnyScrew);
|
||||
if (gs.ParentalLock || Global_PLock)
|
||||
{
|
||||
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible
|
||||
|
|
|
@ -1110,11 +1110,11 @@ ViewOutsidePlayerRecurse(PLAYERp pp, int32_t* vx, int32_t* vy, int32_t* vz, int1
|
|||
{
|
||||
case HIT_SPRITE:
|
||||
{
|
||||
short hitsprite;
|
||||
short hit_sprite;
|
||||
SPRITEp sp;
|
||||
|
||||
hitsprite = NORM_SPRITE(ret);
|
||||
sp = &sprite[hitsprite];
|
||||
hit_sprite = NORM_SPRITE(ret);
|
||||
sp = &sprite[hit_sprite];
|
||||
|
||||
// if you hit a sprite that's not a wall sprite - try again
|
||||
if (!TEST(sp->cstat, CSTAT_SPRITE_WALL))
|
||||
|
@ -1149,9 +1149,11 @@ ViewOutsidePlayerRecurse(PLAYERp pp, int32_t* vx, int32_t* vy, int32_t* vz, int1
|
|||
void
|
||||
BackView(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
||||
{
|
||||
vec3_t n = { *nx, *ny, *nz };
|
||||
SPRITEp sp;
|
||||
int i, vx, vy, vz, hx, hy, hz, hitx, hity, hitz;
|
||||
short bakcstat, hitsect, hitwall, hitsprite, daang;
|
||||
hitdata_t hitinfo;
|
||||
int i, vx, vy, vz, hx, hy, hz;
|
||||
short bakcstat, daang;
|
||||
PLAYERp pp = &Player[screenpeek];
|
||||
short ang;
|
||||
|
||||
|
@ -1173,25 +1175,25 @@ BackView(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
|||
// Make sure sector passed to FAFhitscan is correct
|
||||
//COVERupdatesector(*nx, *ny, vsect);
|
||||
|
||||
hitscan(*nx, *ny, *nz, *vsect, vx, vy, vz,
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_PLAYER);
|
||||
hitscan(&n, *vsect, vx, vy, vz,
|
||||
&hitinfo, CLIPMASK_PLAYER);
|
||||
|
||||
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
||||
|
||||
sp->cstat = bakcstat; // Restore cstat
|
||||
|
||||
hx = hitx - (*nx);
|
||||
hy = hity - (*ny);
|
||||
hx = hitinfo.pos.x - (*nx);
|
||||
hy = hitinfo.pos.y - (*ny);
|
||||
|
||||
// If something is in the way, make pp->camera_dist lower if necessary
|
||||
if (klabs(vx) + klabs(vy) > klabs(hx) + klabs(hy))
|
||||
{
|
||||
if (hitwall >= 0) // Push you a little bit off the wall
|
||||
if (hitinfo.wall >= 0) // Push you a little bit off the wall
|
||||
{
|
||||
*vsect = hitsect;
|
||||
*vsect = hitinfo.sect;
|
||||
|
||||
daang = getangle(wall[wall[hitwall].point2].x - wall[hitwall].x,
|
||||
wall[wall[hitwall].point2].y - wall[hitwall].y);
|
||||
daang = getangle(wall[wall[hitinfo.wall].point2].x - wall[hitinfo.wall].x,
|
||||
wall[wall[hitinfo.wall].point2].y - wall[hitinfo.wall].y);
|
||||
|
||||
i = vx * sintable[daang] + vy * sintable[NORM_ANGLE(daang + 1536)];
|
||||
if (klabs(vx) > klabs(vy))
|
||||
|
@ -1199,9 +1201,9 @@ BackView(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
|||
else
|
||||
hy -= mulscale28(vy, i);
|
||||
}
|
||||
else if (hitsprite < 0) // Push you off the ceiling/floor
|
||||
else if (hitinfo.sprite < 0) // Push you off the ceiling/floor
|
||||
{
|
||||
*vsect = hitsect;
|
||||
*vsect = hitinfo.sect;
|
||||
|
||||
if (klabs(vx) > klabs(vy))
|
||||
hx -= (vx >> 5);
|
||||
|
@ -1210,7 +1212,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
|||
}
|
||||
else
|
||||
{
|
||||
SPRITEp hsp = &sprite[hitsprite];
|
||||
SPRITEp hsp = &sprite[hitinfo.sprite];
|
||||
int flag_backup;
|
||||
|
||||
// if you hit a sprite that's not a wall sprite - try again
|
||||
|
@ -1266,9 +1268,11 @@ BackView(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
|||
void
|
||||
CircleCamera(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
||||
{
|
||||
vec3_t n = { *nx, *ny, *nz };
|
||||
SPRITEp sp;
|
||||
int i, vx, vy, vz, hx, hy, hz, hitx, hity, hitz;
|
||||
short bakcstat, hitsect, hitwall, hitsprite, daang;
|
||||
hitdata_t hitinfo;
|
||||
int i, vx, vy, vz, hx, hy, hz;
|
||||
short bakcstat, daang;
|
||||
PLAYERp pp = &Player[screenpeek];
|
||||
short ang;
|
||||
|
||||
|
@ -1293,24 +1297,24 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
|||
// Make sure sector passed to hitscan is correct
|
||||
//COVERupdatesector(*nx, *ny, vsect);
|
||||
|
||||
hitscan(*nx, *ny, *nz, *vsect, vx, vy, vz,
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
hitscan(&n, *vsect, vx, vy, vz,
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
sp->cstat = bakcstat; // Restore cstat
|
||||
//ASSERT(hitsect >= 0);
|
||||
//ASSERT(hitinfo.sect >= 0);
|
||||
|
||||
hx = hitx - (*nx);
|
||||
hy = hity - (*ny);
|
||||
hx = hitinfo.pos.x - (*nx);
|
||||
hy = hitinfo.pos.y - (*ny);
|
||||
|
||||
// If something is in the way, make pp->circle_camera_dist lower if necessary
|
||||
if (klabs(vx) + klabs(vy) > klabs(hx) + klabs(hy))
|
||||
{
|
||||
if (hitwall >= 0) // Push you a little bit off the wall
|
||||
if (hitinfo.wall >= 0) // Push you a little bit off the wall
|
||||
{
|
||||
*vsect = hitsect;
|
||||
*vsect = hitinfo.sect;
|
||||
|
||||
daang = getangle(wall[wall[hitwall].point2].x - wall[hitwall].x,
|
||||
wall[wall[hitwall].point2].y - wall[hitwall].y);
|
||||
daang = getangle(wall[wall[hitinfo.wall].point2].x - wall[hitinfo.wall].x,
|
||||
wall[wall[hitinfo.wall].point2].y - wall[hitinfo.wall].y);
|
||||
|
||||
i = vx * sintable[daang] + vy * sintable[NORM_ANGLE(daang + 1536)];
|
||||
if (klabs(vx) > klabs(vy))
|
||||
|
@ -1318,9 +1322,9 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
|||
else
|
||||
hy -= mulscale28(vy, i);
|
||||
}
|
||||
else if (hitsprite < 0) // Push you off the ceiling/floor
|
||||
else if (hitinfo.sprite < 0) // Push you off the ceiling/floor
|
||||
{
|
||||
*vsect = hitsect;
|
||||
*vsect = hitinfo.sect;
|
||||
|
||||
if (klabs(vx) > klabs(vy))
|
||||
hx -= (vx >> 5);
|
||||
|
@ -1329,7 +1333,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
|||
}
|
||||
else
|
||||
{
|
||||
SPRITEp hsp = &sprite[hitsprite];
|
||||
SPRITEp hsp = &sprite[hitinfo.sprite];
|
||||
int flag_backup;
|
||||
|
||||
// if you hit a sprite that's not a wall sprite - try again
|
||||
|
@ -1444,27 +1448,26 @@ void PrintSpriteInfo(PLAYERp pp)
|
|||
int y = windowy1+2;
|
||||
SPRITEp sp;
|
||||
USERp u;
|
||||
short hitsprite;
|
||||
|
||||
if (SpriteInfo && !LocationInfo)
|
||||
{
|
||||
hitsprite = DoPickTarget(pp->SpriteP, 32, 2);
|
||||
short hit_sprite = DoPickTarget(pp->SpriteP, 32, 2);
|
||||
|
||||
sp = &sprite[hitsprite];
|
||||
u = User[hitsprite];
|
||||
sp = &sprite[hit_sprite];
|
||||
u = User[hit_sprite];
|
||||
|
||||
sp->hitag = 9997; // Special tag to make the actor glow red for one frame
|
||||
|
||||
y += Y_STEP;
|
||||
|
||||
if (hitsprite == -1)
|
||||
if (hit_sprite == -1)
|
||||
{
|
||||
sprintf(buffer, "SPRITENUM: NONE TARGETED");
|
||||
printext256(x, y, 1, -1, buffer, 1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
sprintf(buffer, "SPRITENUM:%d", hitsprite);
|
||||
sprintf(buffer, "SPRITENUM:%d", hit_sprite);
|
||||
|
||||
printext256(x, y, 1, -1, buffer, 1);
|
||||
y += Y_STEP;
|
||||
|
@ -1821,22 +1824,22 @@ void DrawCrosshair(PLAYERp pp)
|
|||
if (gs.AutoAim)
|
||||
{
|
||||
int daz;
|
||||
short hitsprite, daang;
|
||||
short hit_sprite, daang;
|
||||
static int handle=-1;
|
||||
|
||||
daz = pp->posz + pp->bob_z;
|
||||
daang = 32;
|
||||
if ((hitsprite = WeaponAutoAimHitscan(pp->SpriteP, &daz, &daang, FALSE)) != -1)
|
||||
if ((hit_sprite = WeaponAutoAimHitscan(pp->SpriteP, &daz, &daang, FALSE)) != -1)
|
||||
{
|
||||
SPRITEp hp = &sprite[hitsprite];
|
||||
USERp hu = User[hitsprite];
|
||||
SPRITEp hp = &sprite[hit_sprite];
|
||||
USERp hu = User[hit_sprite];
|
||||
int dx,dy,dz;
|
||||
|
||||
|
||||
// Find the delta coordinates from player to monster that is targeted
|
||||
dx = hp->x - pp->posx;
|
||||
dy = hp->y - pp->posy;
|
||||
dz = ((hp->z - (SPRITE_SIZE_Z(hitsprite)/2)) - pp->posz) >> 4;
|
||||
dz = ((hp->z - (SPRITE_SIZE_Z(hit_sprite)/2)) - pp->posz) >> 4;
|
||||
|
||||
rotatepoint(0,0,dx,dy,(-pp->pang)&2047,&dx,&dy);
|
||||
|
||||
|
|
|
@ -830,12 +830,12 @@ typedef enum {WATER_FOOT, BLOOD_FOOT} FOOT_TYPE;
|
|||
extern FOOT_TYPE FootMode;
|
||||
extern SWBOOL InGame; // Declared in game.c
|
||||
extern SWBOOL Global_PLock; // Game.c
|
||||
int QueueFloorBlood(short hitsprite); // Weapon.c
|
||||
int QueueFootPrint(short hitsprite); // Weapon.c
|
||||
int QueueFloorBlood(short hit_sprite); // Weapon.c
|
||||
int QueueFootPrint(short hit_sprite); // Weapon.c
|
||||
int QueueGeneric(short SpriteNum, short pic); // Weapon.c
|
||||
int QueueLoWangs(short SpriteNum); // Weapon.c
|
||||
int SpawnShell(short SpriteNum, short ShellNum); // Weapon.c
|
||||
void UnlockKeyLock(short key_num, short hitsprite); // JSector.c
|
||||
void UnlockKeyLock(short key_num, short hit_sprite); // JSector.c
|
||||
|
||||
#define MAX_PAIN 5
|
||||
extern int PlayerPainVocs[MAX_PAIN];
|
||||
|
@ -2166,8 +2166,7 @@ SWBOOL PlayerFloorHit(PLAYERp pp, int zlimit);
|
|||
|
||||
void FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
||||
int32_t xvect, int32_t yvect, int32_t zvect,
|
||||
int16_t* hitsect, int16_t* hitwall, int16_t* hitsprite,
|
||||
int32_t* hitx, int32_t* hity, int32_t* hitz, int32_t clipmask);
|
||||
hitdata_t* hitinfo, int32_t clipmask);
|
||||
|
||||
SWBOOL FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, int32_t xe, int32_t ye, int32_t ze, int16_t secte);
|
||||
|
||||
|
|
|
@ -415,10 +415,10 @@ char dashow2dsector[(MAXSECTORS+7)>>3];
|
|||
|
||||
void computergetinput(int snum, SW_PACKET *syn)
|
||||
{
|
||||
int i, j, k, l, x1, y1, z1, x2, y2, z2, x3, y3, z3, dx, dy, nextj;
|
||||
int i, j, k, l, x1, y1, z1, x2, y2, z2, dx, dy, nextj;
|
||||
int dist, daang, zang, fightdist, damyang, damysect;
|
||||
int startsect, endsect, splc, send, startwall, endwall;
|
||||
short dasect, dawall, daspr;
|
||||
hitdata_t hitinfo;
|
||||
PLAYERp p;
|
||||
walltype *wal;
|
||||
int myx, myy, myz, myang, mycursectnum;
|
||||
|
@ -535,33 +535,33 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
}
|
||||
if (k)
|
||||
{
|
||||
x3 = sprite[j].x;
|
||||
y3 = sprite[j].y;
|
||||
z3 = sprite[j].z;
|
||||
hitinfo.pos.x = sprite[j].x;
|
||||
hitinfo.pos.y = sprite[j].y;
|
||||
hitinfo.pos.z = sprite[j].z;
|
||||
for (l=0; l<=8; l++)
|
||||
{
|
||||
if (tmulscale11(x3-x1,x3-x1,y3-y1,y3-y1,(z3-z1)>>4,(z3-z1)>>4) < 3072)
|
||||
if (tmulscale11(hitinfo.pos.x-x1,hitinfo.pos.x-x1,hitinfo.pos.y-y1,hitinfo.pos.y-y1,(hitinfo.pos.z-z1)>>4,(hitinfo.pos.z-z1)>>4) < 3072)
|
||||
{
|
||||
dx = sintable[(sprite[j].ang+512)&2047];
|
||||
dy = sintable[sprite[j].ang&2047];
|
||||
if ((x1-x3)*dy > (y1-y3)*dx) i = -k*512; else i = k*512;
|
||||
if ((x1-hitinfo.pos.x)*dy > (y1-hitinfo.pos.y)*dx) i = -k*512; else i = k*512;
|
||||
syn->vel -= mulscale17(dy,i);
|
||||
syn->svel += mulscale17(dx,i);
|
||||
}
|
||||
|
||||
if (l < 7)
|
||||
{
|
||||
x3 += (mulscale14(sprite[j].xvel,sintable[(sprite[j].ang+512)&2047])<<2);
|
||||
y3 += (mulscale14(sprite[j].xvel,sintable[sprite[j].ang&2047])<<2);
|
||||
z3 += (sprite[j].zvel<<2);
|
||||
hitinfo.pos.x += (mulscale14(sprite[j].xvel,sintable[(sprite[j].ang+512)&2047])<<2);
|
||||
hitinfo.pos.y += (mulscale14(sprite[j].xvel,sintable[sprite[j].ang&2047])<<2);
|
||||
hitinfo.pos.z += (sprite[j].zvel<<2);
|
||||
}
|
||||
else
|
||||
{
|
||||
hitscan(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,
|
||||
hitscan((vec3_t *)&sprite[j],sprite[j].sectnum,
|
||||
mulscale14(sprite[j].xvel,sintable[(sprite[j].ang+512)&2047]),
|
||||
mulscale14(sprite[j].xvel,sintable[sprite[j].ang&2047]),
|
||||
(int)sprite[j].zvel,
|
||||
&dasect,&dawall,&daspr,&x3,&y3,&z3,CLIPMASK1);
|
||||
&hitinfo,CLIPMASK1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -596,10 +596,10 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
// Only fire explosive type weaps if you are not too close to the target!
|
||||
if (u->WeaponNum == WPN_MICRO || u->WeaponNum == WPN_GRENADE || u->WeaponNum == WPN_RAIL)
|
||||
{
|
||||
int x4,y4,z4;
|
||||
hitscan(x1,y1,z1-PLAYER_HEIGHT,damysect,sintable[(damyang+512)&2047],sintable[damyang&2047],
|
||||
(100-p->horiz-p->horizoff)*32,&dasect,&dawall,&daspr,&x4,&y4,&z4,CLIPMASK1);
|
||||
if ((x4-x1)*(x4-x1)+(y4-y1)*(y4-y1) < 2560*2560) syn->bits &= ~(1<<SK_SHOOT);
|
||||
vec3_t hit_pos = { x1, y1, z1-PLAYER_HEIGHT };
|
||||
hitscan(&hit_pos,damysect,sintable[(damyang+512)&2047],sintable[damyang&2047],
|
||||
(100-p->horiz-p->horizoff)*32,&hitinfo,CLIPMASK1);
|
||||
if ((hitinfo.pos.x-x1)*(hitinfo.pos.x-x1)+(hitinfo.pos.y-y1)*(hitinfo.pos.y-y1) < 2560*2560) syn->bits &= ~(1<<SK_SHOOT);
|
||||
}
|
||||
|
||||
// Get fighting distance based on you and your opponents current weapons
|
||||
|
@ -613,10 +613,10 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
zang = 100-((z2-z1)*8)/dist;
|
||||
fightdist = max(fightdist,(klabs(z2-z1)>>4));
|
||||
|
||||
x3 = x2+((x1-x2)*fightdist/dist);
|
||||
y3 = y2+((y1-y2)*fightdist/dist);
|
||||
syn->vel += (x3-x1)*2047/dist;
|
||||
syn->svel += (y3-y1)*2047/dist;
|
||||
hitinfo.pos.x = x2+((x1-x2)*fightdist/dist);
|
||||
hitinfo.pos.y = y2+((y1-y2)*fightdist/dist);
|
||||
syn->vel += (hitinfo.pos.x-x1)*2047/dist;
|
||||
syn->svel += (hitinfo.pos.y-y1)*2047/dist;
|
||||
|
||||
//Strafe attack
|
||||
if (fightdist)
|
||||
|
@ -703,14 +703,14 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
goalsect[snum] = searchsect[k];
|
||||
startwall = sector[goalsect[snum]].wallptr;
|
||||
endwall = startwall+sector[goalsect[snum]].wallnum;
|
||||
x3 = y3 = 0;
|
||||
hitinfo.pos.x = hitinfo.pos.y = 0;
|
||||
for (i=startwall; i<endwall; i++)
|
||||
{
|
||||
x3 += wall[i].x;
|
||||
y3 += wall[i].y;
|
||||
hitinfo.pos.x += wall[i].x;
|
||||
hitinfo.pos.y += wall[i].y;
|
||||
}
|
||||
x3 /= (endwall-startwall);
|
||||
y3 /= (endwall-startwall);
|
||||
hitinfo.pos.x /= (endwall-startwall);
|
||||
hitinfo.pos.y /= (endwall-startwall);
|
||||
|
||||
startwall = sector[startsect].wallptr;
|
||||
endwall = startwall+sector[startsect].wallnum;
|
||||
|
@ -723,8 +723,8 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
|
||||
//if (dx*(y1-wall[i].y) <= dy*(x1-wall[i].x))
|
||||
// if (dx*(y2-wall[i].y) >= dy*(x2-wall[i].x))
|
||||
if ((x3-x1)*(wall[i].y-y1) <= (y3-y1)*(wall[i].x-x1))
|
||||
if ((x3-x1)*(wall[wall[i].point2].y-y1) >= (y3-y1)*(wall[wall[i].point2].x-x1))
|
||||
if ((hitinfo.pos.x-x1)*(wall[i].y-y1) <= (hitinfo.pos.y-y1)*(wall[i].x-x1))
|
||||
if ((hitinfo.pos.x-x1)*(wall[wall[i].point2].y-y1) >= (hitinfo.pos.y-y1)*(wall[wall[i].point2].x-x1))
|
||||
{ k = i; break; }
|
||||
|
||||
dist = ksqrt(dx*dx+dy*dy);
|
||||
|
@ -814,12 +814,12 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
goalsprite[snum] = -1;
|
||||
#endif
|
||||
|
||||
x3 = p->posx; y3 = p->posy; z3 = p->posz; dasect = p->cursectnum;
|
||||
i = clipmove_old(&x3,&y3,&z3,&dasect,p->xvect,p->yvect,164L,4L<<8,4L<<8,CLIPMASK0);
|
||||
hitinfo.pos.x = p->posx; hitinfo.pos.y = p->posy; hitinfo.pos.z = p->posz; hitinfo.sect = p->cursectnum;
|
||||
i = clipmove(&hitinfo.pos,&hitinfo.sect,p->xvect,p->yvect,164L,4L<<8,4L<<8,CLIPMASK0);
|
||||
if (!i)
|
||||
{
|
||||
x3 = p->posx; y3 = p->posy; z3 = p->posz+(24<<8); dasect = p->cursectnum;
|
||||
i = clipmove_old(&x3,&y3,&z3,&dasect,p->xvect,p->yvect,164L,4L<<8,4L<<8,CLIPMASK0);
|
||||
hitinfo.pos.x = p->posx; hitinfo.pos.y = p->posy; hitinfo.pos.z = p->posz+(24<<8); hitinfo.sect = p->cursectnum;
|
||||
i = clipmove(&hitinfo.pos,&hitinfo.sect,p->xvect,p->yvect,164L,4L<<8,4L<<8,CLIPMASK0);
|
||||
}
|
||||
if (i)
|
||||
{
|
||||
|
|
|
@ -1406,7 +1406,7 @@ JS_ToggleLockouts(void)
|
|||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
UnlockKeyLock(short key_num, short hitsprite)
|
||||
UnlockKeyLock(short key_num, short hit_sprite)
|
||||
{
|
||||
SPRITEp sp;
|
||||
int SpriteNum = 0, NextSprite = 0, color = 0;
|
||||
|
@ -1450,7 +1450,7 @@ UnlockKeyLock(short key_num, short hitsprite)
|
|||
if (sp->pal == color)
|
||||
{
|
||||
PlaySound(DIGI_UNLOCK, &sp->x, &sp->y, &sp->z, v3df_doppler | v3df_dontpan);
|
||||
if (SpriteNum == hitsprite)
|
||||
if (SpriteNum == hit_sprite)
|
||||
sp->picnum = SKEL_UNLOCKED;
|
||||
}
|
||||
break;
|
||||
|
@ -1465,7 +1465,7 @@ UnlockKeyLock(short key_num, short hitsprite)
|
|||
if (sp->pal == color)
|
||||
{
|
||||
PlaySound(DIGI_RAMUNLOCK, &sp->x, &sp->y, &sp->z, v3df_doppler | v3df_dontpan);
|
||||
if (SpriteNum == hitsprite)
|
||||
if (SpriteNum == hit_sprite)
|
||||
sp->picnum = CARD_UNLOCKED;
|
||||
else
|
||||
sp->picnum = CARD_UNLOCKED+1;
|
||||
|
|
|
@ -425,14 +425,9 @@ DoBloodSpray(int16_t Weapon)
|
|||
case HIT_SPRITE:
|
||||
{
|
||||
short wall_ang, dang;
|
||||
short hitsprite = -2;
|
||||
SPRITEp hsp;
|
||||
USERp hu;
|
||||
|
||||
|
||||
hitsprite = NORM_SPRITE(u->ret);
|
||||
hsp = &sprite[hitsprite];
|
||||
hu = User[hitsprite];
|
||||
short hit_sprite = NORM_SPRITE(u->ret);
|
||||
SPRITEp hsp = &sprite[hit_sprite];
|
||||
USERp hu = User[hit_sprite];
|
||||
|
||||
if (TEST(hsp->cstat, CSTAT_SPRITE_WALL))
|
||||
{
|
||||
|
@ -457,12 +452,12 @@ DoBloodSpray(int16_t Weapon)
|
|||
|
||||
case HIT_WALL:
|
||||
{
|
||||
short hitwall, nw, wall_ang, dang;
|
||||
short hit_wall, nw, wall_ang, dang;
|
||||
WALLp wph;
|
||||
short wb;
|
||||
|
||||
hitwall = NORM_WALL(u->ret);
|
||||
wph = &wall[hitwall];
|
||||
hit_wall = NORM_WALL(u->ret);
|
||||
wph = &wall[hit_wall];
|
||||
|
||||
if (wph->lotag == TAG_WALL_BREAK)
|
||||
{
|
||||
|
@ -472,7 +467,7 @@ DoBloodSpray(int16_t Weapon)
|
|||
}
|
||||
|
||||
|
||||
nw = wall[hitwall].point2;
|
||||
nw = wall[hit_wall].point2;
|
||||
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512);
|
||||
|
||||
SpawnMidSplash(Weapon);
|
||||
|
@ -497,7 +492,7 @@ DoBloodSpray(int16_t Weapon)
|
|||
sp->y = sprite[wb].y;
|
||||
|
||||
// !FRANK! bit of a hack
|
||||
// yvel is the hitwall
|
||||
// yvel is the hit_wall
|
||||
if (sprite[wb].yvel >= 0)
|
||||
{
|
||||
short wallnum = sprite[wb].yvel;
|
||||
|
@ -520,8 +515,6 @@ DoBloodSpray(int16_t Weapon)
|
|||
|
||||
case HIT_SECTOR:
|
||||
{
|
||||
SWBOOL hitwall;
|
||||
|
||||
// hit floor
|
||||
if (sp->z > DIV2(u->hiz + u->loz))
|
||||
{
|
||||
|
@ -646,14 +639,14 @@ DoPhosphorus(int16_t Weapon)
|
|||
case HIT_SPRITE:
|
||||
{
|
||||
short wall_ang, dang;
|
||||
short hitsprite = -2;
|
||||
short hit_sprite = -2;
|
||||
SPRITEp hsp;
|
||||
USERp hu;
|
||||
|
||||
|
||||
hitsprite = NORM_SPRITE(u->ret);
|
||||
hsp = &sprite[hitsprite];
|
||||
hu = User[hitsprite];
|
||||
hit_sprite = NORM_SPRITE(u->ret);
|
||||
hsp = &sprite[hit_sprite];
|
||||
hu = User[hit_sprite];
|
||||
|
||||
if (TEST(hsp->cstat, CSTAT_SPRITE_WALL))
|
||||
{
|
||||
|
@ -666,10 +659,10 @@ DoPhosphorus(int16_t Weapon)
|
|||
if (TEST(hsp->extra, SPRX_BURNABLE))
|
||||
{
|
||||
if (!hu)
|
||||
hu = SpawnUser(hitsprite, hsp->picnum, NULL);
|
||||
hu = SpawnUser(hit_sprite, hsp->picnum, NULL);
|
||||
SpawnFireballExp(Weapon);
|
||||
if (hu)
|
||||
SpawnFireballFlames(Weapon, hitsprite);
|
||||
SpawnFireballFlames(Weapon, hit_sprite);
|
||||
DoFlamesDamageTest(Weapon);
|
||||
}
|
||||
u->xchange = u->ychange = 0;
|
||||
|
@ -683,11 +676,11 @@ DoPhosphorus(int16_t Weapon)
|
|||
|
||||
case HIT_WALL:
|
||||
{
|
||||
short hitwall, nw, wall_ang, dang;
|
||||
short hit_wall, nw, wall_ang, dang;
|
||||
WALLp wph;
|
||||
|
||||
hitwall = NORM_WALL(u->ret);
|
||||
wph = &wall[hitwall];
|
||||
hit_wall = NORM_WALL(u->ret);
|
||||
wph = &wall[hit_wall];
|
||||
|
||||
if (wph->lotag == TAG_WALL_BREAK)
|
||||
{
|
||||
|
@ -697,7 +690,7 @@ DoPhosphorus(int16_t Weapon)
|
|||
}
|
||||
|
||||
|
||||
nw = wall[hitwall].point2;
|
||||
nw = wall[hit_wall].point2;
|
||||
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512);
|
||||
|
||||
WallBounce(Weapon, wall_ang);
|
||||
|
@ -707,11 +700,11 @@ DoPhosphorus(int16_t Weapon)
|
|||
|
||||
case HIT_SECTOR:
|
||||
{
|
||||
SWBOOL hitwall;
|
||||
SWBOOL did_hit_wall;
|
||||
|
||||
if (SlopeBounce(Weapon, &hitwall))
|
||||
if (SlopeBounce(Weapon, &did_hit_wall))
|
||||
{
|
||||
if (hitwall)
|
||||
if (did_hit_wall)
|
||||
{
|
||||
// hit a wall
|
||||
ScaleSpriteVector(Weapon, 28000);
|
||||
|
@ -873,14 +866,14 @@ DoChemBomb(int16_t Weapon)
|
|||
case HIT_SPRITE:
|
||||
{
|
||||
short wall_ang, dang;
|
||||
short hitsprite = -2;
|
||||
short hit_sprite;
|
||||
SPRITEp hsp;
|
||||
|
||||
if (!TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE))
|
||||
PlaySound(DIGI_CHEMBOUNCE, &sp->x, &sp->y, &sp->z, v3df_dontpan);
|
||||
|
||||
hitsprite = NORM_SPRITE(u->ret);
|
||||
hsp = &sprite[hitsprite];
|
||||
hit_sprite = NORM_SPRITE(u->ret);
|
||||
hsp = &sprite[hit_sprite];
|
||||
|
||||
if (TEST(hsp->cstat, CSTAT_SPRITE_WALL))
|
||||
{
|
||||
|
@ -910,11 +903,11 @@ DoChemBomb(int16_t Weapon)
|
|||
|
||||
case HIT_WALL:
|
||||
{
|
||||
short hitwall, nw, wall_ang, dang;
|
||||
short hit_wall, nw, wall_ang, dang;
|
||||
WALLp wph;
|
||||
|
||||
hitwall = NORM_WALL(u->ret);
|
||||
wph = &wall[hitwall];
|
||||
hit_wall = NORM_WALL(u->ret);
|
||||
wph = &wall[hit_wall];
|
||||
|
||||
if (wph->lotag == TAG_WALL_BREAK)
|
||||
{
|
||||
|
@ -926,7 +919,7 @@ DoChemBomb(int16_t Weapon)
|
|||
if (!TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE))
|
||||
PlaySound(DIGI_CHEMBOUNCE, &sp->x, &sp->y, &sp->z, v3df_dontpan);
|
||||
|
||||
nw = wall[hitwall].point2;
|
||||
nw = wall[hit_wall].point2;
|
||||
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512);
|
||||
|
||||
WallBounce(Weapon, wall_ang);
|
||||
|
@ -936,11 +929,11 @@ DoChemBomb(int16_t Weapon)
|
|||
|
||||
case HIT_SECTOR:
|
||||
{
|
||||
SWBOOL hitwall;
|
||||
SWBOOL did_hit_wall;
|
||||
|
||||
if (SlopeBounce(Weapon, &hitwall))
|
||||
if (SlopeBounce(Weapon, &did_hit_wall))
|
||||
{
|
||||
if (hitwall)
|
||||
if (did_hit_wall)
|
||||
{
|
||||
// hit a wall
|
||||
ScaleSpriteVector(Weapon, 28000);
|
||||
|
@ -1132,13 +1125,13 @@ DoCaltrops(int16_t Weapon)
|
|||
case HIT_SPRITE:
|
||||
{
|
||||
short wall_ang, dang;
|
||||
short hitsprite = -2;
|
||||
short hit_sprite;
|
||||
SPRITEp hsp;
|
||||
|
||||
PlaySound(DIGI_CALTROPS, &sp->x, &sp->y, &sp->z, v3df_dontpan);
|
||||
|
||||
hitsprite = NORM_SPRITE(u->ret);
|
||||
hsp = &sprite[hitsprite];
|
||||
hit_sprite = NORM_SPRITE(u->ret);
|
||||
hsp = &sprite[hit_sprite];
|
||||
|
||||
if (TEST(hsp->cstat, CSTAT_SPRITE_WALL))
|
||||
{
|
||||
|
@ -1158,11 +1151,11 @@ DoCaltrops(int16_t Weapon)
|
|||
|
||||
case HIT_WALL:
|
||||
{
|
||||
short hitwall, nw, wall_ang, dang;
|
||||
short hit_wall, nw, wall_ang, dang;
|
||||
WALLp wph;
|
||||
|
||||
hitwall = NORM_WALL(u->ret);
|
||||
wph = &wall[hitwall];
|
||||
hit_wall = NORM_WALL(u->ret);
|
||||
wph = &wall[hit_wall];
|
||||
|
||||
if (wph->lotag == TAG_WALL_BREAK)
|
||||
{
|
||||
|
@ -1173,7 +1166,7 @@ DoCaltrops(int16_t Weapon)
|
|||
|
||||
PlaySound(DIGI_CALTROPS, &sp->x, &sp->y, &sp->z, v3df_dontpan);
|
||||
|
||||
nw = wall[hitwall].point2;
|
||||
nw = wall[hit_wall].point2;
|
||||
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512);
|
||||
|
||||
WallBounce(Weapon, wall_ang);
|
||||
|
@ -1183,11 +1176,11 @@ DoCaltrops(int16_t Weapon)
|
|||
|
||||
case HIT_SECTOR:
|
||||
{
|
||||
SWBOOL hitwall;
|
||||
SWBOOL did_hit_wall;
|
||||
|
||||
if (SlopeBounce(Weapon, &hitwall))
|
||||
if (SlopeBounce(Weapon, &did_hit_wall))
|
||||
{
|
||||
if (hitwall)
|
||||
if (did_hit_wall)
|
||||
{
|
||||
// hit a wall
|
||||
ScaleSpriteVector(Weapon, 1000);
|
||||
|
@ -1385,7 +1378,7 @@ PlayerInitChemBomb(PLAYERp pp)
|
|||
USERp wu;
|
||||
SPRITEp wp;
|
||||
int nx, ny, nz;
|
||||
short w, hitsprite;
|
||||
short w, hit_sprite;
|
||||
short oclipdist;
|
||||
int dist;
|
||||
|
||||
|
@ -1469,7 +1462,7 @@ InitSpriteChemBomb(int16_t SpriteNum)
|
|||
USERp wu;
|
||||
SPRITEp sp = &sprite[SpriteNum], wp;
|
||||
int nx, ny, nz;
|
||||
short w, hitsprite;
|
||||
short w, hit_sprite;
|
||||
short oclipdist;
|
||||
int dist;
|
||||
|
||||
|
@ -1525,7 +1518,7 @@ InitChemBomb(short SpriteNum)
|
|||
USERp wu;
|
||||
SPRITEp wp;
|
||||
int nx, ny, nz;
|
||||
short w, hitsprite;
|
||||
short w, hit_sprite;
|
||||
short oclipdist;
|
||||
int dist;
|
||||
|
||||
|
@ -1830,7 +1823,7 @@ PlayerInitCaltrops(PLAYERp pp)
|
|||
USERp wu;
|
||||
SPRITEp wp;
|
||||
int nx, ny, nz;
|
||||
short w, hitsprite;
|
||||
short w, hit_sprite;
|
||||
short oclipdist, i;
|
||||
int dist;
|
||||
|
||||
|
@ -1912,7 +1905,7 @@ InitCaltrops(int16_t SpriteNum)
|
|||
USERp wu;
|
||||
SPRITEp wp;
|
||||
int nx, ny, nz;
|
||||
short w, hitsprite;
|
||||
short w, hit_sprite;
|
||||
short oclipdist, i;
|
||||
int dist;
|
||||
|
||||
|
@ -1965,7 +1958,7 @@ InitPhosphorus(int16_t SpriteNum)
|
|||
USERp wu;
|
||||
SPRITEp wp;
|
||||
int nx, ny, nz;
|
||||
short w, hitsprite;
|
||||
short w, hit_sprite;
|
||||
short oclipdist, i, daang;
|
||||
int dist;
|
||||
|
||||
|
@ -2025,7 +2018,7 @@ InitBloodSpray(int16_t SpriteNum, SWBOOL dogib, short velocity)
|
|||
USERp wu;
|
||||
SPRITEp wp;
|
||||
int nx, ny, nz;
|
||||
short w, hitsprite;
|
||||
short w, hit_sprite;
|
||||
short oclipdist, i, cnt, ang, vel, rnd;
|
||||
int dist;
|
||||
|
||||
|
@ -2449,13 +2442,13 @@ DoFlag(int16_t Weapon)
|
|||
{
|
||||
SPRITEp sp = &sprite[Weapon];
|
||||
USERp u = User[Weapon];
|
||||
int16_t hitsprite = -1;
|
||||
int16_t hit_sprite = -1;
|
||||
|
||||
hitsprite = DoFlagRangeTest(Weapon, 1000);
|
||||
hit_sprite = DoFlagRangeTest(Weapon, 1000);
|
||||
|
||||
if (hitsprite != -1)
|
||||
if (hit_sprite != -1)
|
||||
{
|
||||
SPRITEp hsp = &sprite[hitsprite];
|
||||
SPRITEp hsp = &sprite[hit_sprite];
|
||||
|
||||
SetCarryFlag(Weapon);
|
||||
|
||||
|
@ -2464,7 +2457,7 @@ DoFlag(int16_t Weapon)
|
|||
{
|
||||
// attach weapon to sprite
|
||||
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
SetAttach(hitsprite, Weapon);
|
||||
SetAttach(hit_sprite, Weapon);
|
||||
u->sz = hsp->z - DIV2(SPRITEp_SIZE_Z(hsp));
|
||||
//u->sz = hsp->z - SPRITEp_MID(hsp); // Set mid way up who it hit
|
||||
}
|
||||
|
@ -2481,7 +2474,7 @@ InitShell(int16_t SpriteNum, int16_t ShellNum)
|
|||
USERp wu;
|
||||
SPRITEp sp = &sprite[SpriteNum], wp;
|
||||
int nx, ny, nz;
|
||||
short w, hitsprite;
|
||||
short w;
|
||||
short oclipdist,id=0,velocity=0;
|
||||
int dist;
|
||||
STATEp p=NULL;
|
||||
|
|
|
@ -1917,7 +1917,7 @@ DoNinjaHariKari(short SpriteNum)
|
|||
{
|
||||
USERp u = User[SpriteNum];
|
||||
SPRITEp sp = User[SpriteNum]->SpriteP;
|
||||
int SpawnBlood(short SpriteNum, short Weapon, short hitang, int hitx, int hity, int hitz);
|
||||
int SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, int hit_z);
|
||||
short cnt,i;
|
||||
|
||||
UpdateSinglePlayKills(SpriteNum);
|
||||
|
@ -1948,7 +1948,7 @@ DoNinjaGrabThroat(short SpriteNum)
|
|||
{
|
||||
USERp u = User[SpriteNum];
|
||||
SPRITEp sp = User[SpriteNum]->SpriteP;
|
||||
int SpawnBlood(short SpriteNum, short Weapon, short hitang, int hitx, int hity, int hitz);
|
||||
int SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, int hit_z);
|
||||
short cnt,i;
|
||||
|
||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
|
||||
|
|
|
@ -3330,8 +3330,7 @@ DoPlayerMoveTank(PLAYERp pp)
|
|||
if (RectClip)
|
||||
{
|
||||
int nx,ny;
|
||||
int hitx,hity,hitz;
|
||||
short hitsect, hitwall, hitsprite;
|
||||
hitdata_t hitinfo;
|
||||
int vel;
|
||||
int ret;
|
||||
|
||||
|
@ -3349,23 +3348,22 @@ DoPlayerMoveTank(PLAYERp pp)
|
|||
|
||||
if (vel > 13000)
|
||||
{
|
||||
nx = DIV2(x[0] + x[1]);
|
||||
ny = DIV2(y[0] + y[1]);
|
||||
vec3_t hit_pos = { DIV2(x[0] + x[1]), DIV2(y[0] + y[1]), sector[pp->cursectnum].floorz - Z(10) };
|
||||
|
||||
hitscan(nx, ny, sector[pp->cursectnum].floorz - Z(10), pp->cursectnum,
|
||||
hitscan(&hit_pos, pp->cursectnum,
|
||||
//pp->xvect, pp->yvect, 0,
|
||||
MOVEx(256, pp->pang), MOVEy(256, pp->pang), 0,
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_PLAYER);
|
||||
&hitinfo, CLIPMASK_PLAYER);
|
||||
|
||||
////DSPRINTF(ds,"hitsect %d, hitwall %d, hitx %d, hity %d, hitz %d",hitsect, hitwall, hitx, hity, hitz);
|
||||
////DSPRINTF(ds,"hitinfo.sect %d, hitinfo.wall %d, hitinfo.pos.x %d, hitinfo.pos.y %d, hitinfo.pos.z %d",hitinfo.sect, hitinfo.wall, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z);
|
||||
//MONO_PRINT(ds);
|
||||
|
||||
if (FindDistance2D(hitx - nx, hity - ny) < 800)
|
||||
if (FindDistance2D(hitinfo.pos.x - hit_pos.x, hitinfo.pos.y - hit_pos.y) < 800)
|
||||
{
|
||||
if (hitwall >= 0)
|
||||
u->ret = hitwall|HIT_WALL;
|
||||
else if (hitsprite >= 0)
|
||||
u->ret = hitsprite|HIT_SPRITE;
|
||||
if (hitinfo.wall >= 0)
|
||||
u->ret = hitinfo.wall|HIT_WALL;
|
||||
else if (hitinfo.sprite >= 0)
|
||||
u->ret = hitinfo.sprite|HIT_SPRITE;
|
||||
else
|
||||
u->ret = 0;
|
||||
|
||||
|
@ -4095,8 +4093,7 @@ DoPlayerClimb(PLAYERp pp)
|
|||
int
|
||||
DoPlayerWadeSuperJump(PLAYERp pp)
|
||||
{
|
||||
int hitx, hity, hitz;
|
||||
short hitsect, hitwall, hitsprite;
|
||||
hitdata_t hitinfo;
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
unsigned i;
|
||||
//short angs[3];
|
||||
|
@ -4111,15 +4108,15 @@ DoPlayerWadeSuperJump(PLAYERp pp)
|
|||
sintable[NORM_ANGLE(pp->pang + angs[i] + 512)], // X vector of 3D ang
|
||||
sintable[NORM_ANGLE(pp->pang + angs[i])], // Y vector of 3D ang
|
||||
0, // Z vector of 3D ang
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
if (hitwall >= 0 && hitsect >= 0)
|
||||
if (hitinfo.wall >= 0 && hitinfo.sect >= 0)
|
||||
{
|
||||
hitsect = wall[hitwall].nextsector;
|
||||
hitinfo.sect = wall[hitinfo.wall].nextsector;
|
||||
|
||||
if (labs(sector[hitsect].floorz - pp->posz) < Z(50))
|
||||
if (labs(sector[hitinfo.sect].floorz - pp->posz) < Z(50))
|
||||
{
|
||||
if (Distance(pp->posx, pp->posy, hitx, hity) < ((((int)pp->SpriteP->clipdist)<<2) + 256))
|
||||
if (Distance(pp->posx, pp->posy, hitinfo.pos.x, hitinfo.pos.y) < ((((int)pp->SpriteP->clipdist)<<2) + 256))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -4542,8 +4539,7 @@ PlayerOnLadder(PLAYERp pp)
|
|||
unsigned i;
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
SPRITEp lsp;
|
||||
int hitx,hity,hitz;
|
||||
short hitsprite,hitsect,hitwall;
|
||||
hitdata_t hitinfo;
|
||||
int dir;
|
||||
|
||||
int neartaghitdist;
|
||||
|
@ -4582,16 +4578,16 @@ PlayerOnLadder(PLAYERp pp)
|
|||
sintable[NORM_ANGLE(pp->pang + angles[i] + 512)],
|
||||
sintable[NORM_ANGLE(pp->pang + angles[i])],
|
||||
0,
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
dist = DIST(pp->posx, pp->posy, hitx, hity);
|
||||
dist = DIST(pp->posx, pp->posy, hitinfo.pos.x, hitinfo.pos.y);
|
||||
|
||||
if (hitsprite >= 0)
|
||||
if (hitinfo.sprite >= 0)
|
||||
{
|
||||
// if the sprite blocking you hit is not a wall sprite there is something between
|
||||
// you and the ladder
|
||||
if (TEST(sprite[hitsprite].cstat, CSTAT_SPRITE_BLOCK) &&
|
||||
!TEST(sprite[hitsprite].cstat, CSTAT_SPRITE_WALL))
|
||||
if (TEST(sprite[hitinfo.sprite].cstat, CSTAT_SPRITE_BLOCK) &&
|
||||
!TEST(sprite[hitinfo.sprite].cstat, CSTAT_SPRITE_WALL))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -4599,7 +4595,7 @@ PlayerOnLadder(PLAYERp pp)
|
|||
else
|
||||
{
|
||||
// if you hit a wall and it is not a climb wall - forget it
|
||||
if (hitwall >= 0 && wall[hitwall].lotag != TAG_WALL_CLIMB)
|
||||
if (hitinfo.wall >= 0 && wall[hitinfo.wall].lotag != TAG_WALL_CLIMB)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -7065,13 +7061,13 @@ void DoPlayerDeathMoveHead(PLAYERp pp)
|
|||
case HIT_SPRITE:
|
||||
{
|
||||
short wall_ang, dang;
|
||||
short hitsprite = -2;
|
||||
short hit_sprite = -2;
|
||||
SPRITEp hsp;
|
||||
|
||||
//PlaySound(DIGI_DHCLUNK, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan);
|
||||
|
||||
hitsprite = NORM_SPRITE(u->ret);
|
||||
hsp = &sprite[hitsprite];
|
||||
hit_sprite = NORM_SPRITE(u->ret);
|
||||
hsp = &sprite[hit_sprite];
|
||||
|
||||
if (!TEST(hsp->cstat, CSTAT_SPRITE_WALL))
|
||||
break;
|
||||
|
@ -7086,13 +7082,12 @@ void DoPlayerDeathMoveHead(PLAYERp pp)
|
|||
}
|
||||
case HIT_WALL:
|
||||
{
|
||||
short hitwall,w,nw,wall_ang,dang;
|
||||
short w,nw,wall_ang,dang;
|
||||
|
||||
//PlaySound(DIGI_DHCLUNK, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan);
|
||||
|
||||
hitwall = NORM_WALL(u->ret);
|
||||
w = NORM_WALL(u->ret);
|
||||
|
||||
w = hitwall;
|
||||
nw = wall[w].point2;
|
||||
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y)-512);
|
||||
|
||||
|
|
|
@ -943,9 +943,7 @@ InitRipperHang(short SpriteNum)
|
|||
int dist;
|
||||
short ang2;
|
||||
|
||||
short hitwall;
|
||||
short hitsprite = -2, hitsect = -2;
|
||||
int hitx, hity, hitz;
|
||||
hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 };
|
||||
|
||||
SWBOOL Found = FALSE;
|
||||
short dang, tang;
|
||||
|
@ -958,15 +956,15 @@ InitRipperHang(short SpriteNum)
|
|||
sintable[NORM_ANGLE(tang + 512)], // X vector of 3D ang
|
||||
sintable[tang], // Y vector of 3D ang
|
||||
0, // Z vector of 3D ang
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
//ASSERT(hitsect >= 0);
|
||||
if (hitsect < 0)
|
||||
//ASSERT(hitinfo.sect >= 0);
|
||||
if (hitinfo.sect < 0)
|
||||
continue;
|
||||
|
||||
dist = Distance(sp->x, sp->y, hitx, hity);
|
||||
dist = Distance(sp->x, sp->y, hitinfo.pos.x, hitinfo.pos.y);
|
||||
|
||||
if (hitwall < 0 || dist < 2000 || dist > 7000)
|
||||
if (hitinfo.wall < 0 || dist < 2000 || dist > 7000)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1033,16 +1031,16 @@ DoRipperMoveHang(short SpriteNum)
|
|||
{
|
||||
case HIT_WALL:
|
||||
{
|
||||
short hitwall;
|
||||
short hit_wall;
|
||||
short w, nw;
|
||||
|
||||
hitwall = NORM_WALL(u->ret);
|
||||
hit_wall = NORM_WALL(u->ret);
|
||||
|
||||
NewStateGroup(SpriteNum, u->ActorActionSet->Special[1]);
|
||||
u->WaitTics = 2 + ((RANDOM_P2(4 << 8) >> 8) * 120);
|
||||
|
||||
// hang flush with the wall
|
||||
w = hitwall;
|
||||
w = hit_wall;
|
||||
nw = wall[w].point2;
|
||||
sp->ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y) - 512);
|
||||
|
||||
|
|
|
@ -942,9 +942,7 @@ InitRipper2Hang(short SpriteNum)
|
|||
int dist;
|
||||
short ang2;
|
||||
|
||||
short hitwall;
|
||||
short hitsprite = -2, hitsect = -2;
|
||||
int hitx, hity, hitz;
|
||||
hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 };
|
||||
|
||||
SWBOOL Found = FALSE;
|
||||
short dang, tang;
|
||||
|
@ -957,14 +955,14 @@ InitRipper2Hang(short SpriteNum)
|
|||
sintable[NORM_ANGLE(tang + 512)], // X vector of 3D ang
|
||||
sintable[tang], // Y vector of 3D ang
|
||||
0, // Z vector of 3D ang
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
if (hitsect < 0)
|
||||
if (hitinfo.sect < 0)
|
||||
continue;
|
||||
|
||||
dist = Distance(sp->x, sp->y, hitx, hity);
|
||||
dist = Distance(sp->x, sp->y, hitinfo.pos.x, hitinfo.pos.y);
|
||||
|
||||
if (hitwall < 0 || dist < 2000 || dist > 7000)
|
||||
if (hitinfo.wall < 0 || dist < 2000 || dist > 7000)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1032,14 +1030,14 @@ DoRipper2MoveHang(short SpriteNum)
|
|||
{
|
||||
case HIT_WALL:
|
||||
{
|
||||
short hitwall;
|
||||
short hit_wall;
|
||||
short w, nw;
|
||||
|
||||
// Don't keep clinging and going ever higher!
|
||||
if (abs(sp->z - u->tgt_sp->z) > (4000<<4))
|
||||
break;
|
||||
|
||||
hitwall = NORM_WALL(u->ret);
|
||||
hit_wall = NORM_WALL(u->ret);
|
||||
|
||||
NewStateGroup(SpriteNum, u->ActorActionSet->Special[1]);
|
||||
if (RANDOM_P2(1024<<8)>>8 > 500)
|
||||
|
@ -1048,7 +1046,7 @@ DoRipper2MoveHang(short SpriteNum)
|
|||
u->WaitTics = 0; // Double jump
|
||||
|
||||
// hang flush with the wall
|
||||
w = hitwall;
|
||||
w = hit_wall;
|
||||
nw = wall[w].point2;
|
||||
sp->ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y) - 512);
|
||||
|
||||
|
|
|
@ -149,56 +149,50 @@ void ResetWallWarpHitscan(short sectnum)
|
|||
void
|
||||
FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
||||
int32_t xvect, int32_t yvect, int32_t zvect,
|
||||
int16_t* hitsect, int16_t* hitwall, int16_t* hitsprite,
|
||||
int32_t* hitx, int32_t* hity, int32_t* hitz, int32_t clipmask)
|
||||
hitdata_t* hitinfo, int32_t clipmask)
|
||||
{
|
||||
vec3_t firstpos = { x, y, z };
|
||||
int loz, hiz;
|
||||
short newsectnum = sectnum;
|
||||
int startclipmask = 0;
|
||||
SWBOOL plax_found = FALSE;
|
||||
int sx,sy,sz;
|
||||
|
||||
if (clipmask == CLIPMASK_MISSILE)
|
||||
startclipmask = CLIPMASK_WARP_HITSCAN;
|
||||
|
||||
hitscan(x, y, z, sectnum, xvect, yvect, zvect,
|
||||
hitsect, hitwall, hitsprite,
|
||||
hitx, hity, hitz, startclipmask);
|
||||
hitscan(&firstpos, sectnum, xvect, yvect, zvect,
|
||||
hitinfo, startclipmask);
|
||||
|
||||
if (*hitsect < 0)
|
||||
if (hitinfo->sect < 0)
|
||||
return;
|
||||
|
||||
if (*hitwall >= 0)
|
||||
if (hitinfo->wall >= 0)
|
||||
{
|
||||
// hitscan warping
|
||||
if (TEST(wall[*hitwall].cstat, CSTAT_WALL_WARP_HITSCAN))
|
||||
if (TEST(wall[hitinfo->wall].cstat, CSTAT_WALL_WARP_HITSCAN))
|
||||
{
|
||||
short src_sect = *hitsect;
|
||||
short src_sect = hitinfo->sect;
|
||||
short dest_sect;
|
||||
|
||||
sx = *hitx;
|
||||
sy = *hity;
|
||||
sz = *hitz;
|
||||
|
||||
//DSPRINTF(ds,"sx %d, sy %d, sz %d, xvect %d, yvect %d",sx, sy, sz,xvect,yvect);
|
||||
MONO_PRINT(ds);
|
||||
|
||||
// back it up a bit to get a correct warp location
|
||||
*hitx -= xvect>>9;
|
||||
*hity -= yvect>>9;
|
||||
hitinfo->pos.x -= xvect>>9;
|
||||
hitinfo->pos.y -= yvect>>9;
|
||||
|
||||
// warp to new x,y,z, sectnum
|
||||
if (Warp(hitx, hity, hitz, hitsect))
|
||||
if (Warp(&hitinfo->pos.x, &hitinfo->pos.y, &hitinfo->pos.z, &hitinfo->sect))
|
||||
{
|
||||
dest_sect = *hitsect;
|
||||
vec3_t pos = hitinfo->pos;
|
||||
|
||||
dest_sect = hitinfo->sect;
|
||||
|
||||
// hitscan needs to pass through dest sect
|
||||
ResetWallWarpHitscan(dest_sect);
|
||||
|
||||
// NOTE: This could be recursive I think if need be
|
||||
hitscan(*hitx, *hity, *hitz, *hitsect, xvect, yvect, zvect,
|
||||
hitsect, hitwall, hitsprite,
|
||||
hitx, hity, hitz, startclipmask);
|
||||
hitscan(&pos, hitinfo->sect, xvect, yvect, zvect,
|
||||
hitinfo, startclipmask);
|
||||
|
||||
// reset hitscan block for dest sect
|
||||
SetWallWarpHitscan(dest_sect);
|
||||
|
@ -207,7 +201,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
}
|
||||
else
|
||||
{
|
||||
//DSPRINTF(ds,"hitx %d, hity %d, hitz %d",*hitx, *hity, *hitz);
|
||||
//DSPRINTF(ds,"hitinfo->pos.x %d, hitinfo->pos.y %d, hitinfo->pos.z %d",hitinfo->pos.x, hitinfo->pos.y, hitinfo->pos.z);
|
||||
MONO_PRINT(ds);
|
||||
ASSERT(TRUE == FALSE);
|
||||
}
|
||||
|
@ -215,49 +209,49 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
}
|
||||
|
||||
// make sure it hit JUST a sector before doing a check
|
||||
if (*hitwall < 0 && *hitsprite < 0)
|
||||
if (hitinfo->wall < 0 && hitinfo->sprite < 0)
|
||||
{
|
||||
if (TEST(sector[*hitsect].extra, SECTFX_WARP_SECTOR))
|
||||
if (TEST(sector[hitinfo->sect].extra, SECTFX_WARP_SECTOR))
|
||||
{
|
||||
if (TEST(wall[sector[*hitsect].wallptr].cstat, CSTAT_WALL_WARP_HITSCAN))
|
||||
if (TEST(wall[sector[hitinfo->sect].wallptr].cstat, CSTAT_WALL_WARP_HITSCAN))
|
||||
{
|
||||
// hit the floor of a sector that is a warping sector
|
||||
if (Warp(hitx, hity, hitz, hitsect))
|
||||
if (Warp(&hitinfo->pos.x, &hitinfo->pos.y, &hitinfo->pos.z, &hitinfo->sect))
|
||||
{
|
||||
hitscan(*hitx, *hity, *hitz, *hitsect, xvect, yvect, zvect,
|
||||
hitsect, hitwall, hitsprite,
|
||||
hitx, hity, hitz, clipmask);
|
||||
vec3_t pos = hitinfo->pos;
|
||||
hitscan(&pos, hitinfo->sect, xvect, yvect, zvect,
|
||||
hitinfo, clipmask);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WarpPlane(hitx, hity, hitz, hitsect))
|
||||
if (WarpPlane(&hitinfo->pos.x, &hitinfo->pos.y, &hitinfo->pos.z, &hitinfo->sect))
|
||||
{
|
||||
hitscan(*hitx, *hity, *hitz, *hitsect, xvect, yvect, zvect,
|
||||
hitsect, hitwall, hitsprite,
|
||||
hitx, hity, hitz, clipmask);
|
||||
vec3_t pos = hitinfo->pos;
|
||||
hitscan(&pos, hitinfo->sect, xvect, yvect, zvect,
|
||||
hitinfo, clipmask);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getzsofslope(*hitsect, *hitx, *hity, &hiz, &loz);
|
||||
if (labs(*hitz - loz) < Z(4))
|
||||
getzsofslope(hitinfo->sect, hitinfo->pos.x, hitinfo->pos.y, &hiz, &loz);
|
||||
if (labs(hitinfo->pos.z - loz) < Z(4))
|
||||
{
|
||||
if (FAF_ConnectFloor(*hitsect) && !TEST(sector[*hitsect].floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN))
|
||||
if (FAF_ConnectFloor(hitinfo->sect) && !TEST(sector[hitinfo->sect].floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN))
|
||||
{
|
||||
updatesectorz(*hitx, *hity, *hitz + Z(12), &newsectnum);
|
||||
updatesectorz(hitinfo->pos.x, hitinfo->pos.y, hitinfo->pos.z + Z(12), &newsectnum);
|
||||
plax_found = TRUE;
|
||||
}
|
||||
}
|
||||
else if (labs(*hitz - hiz) < Z(4))
|
||||
else if (labs(hitinfo->pos.z - hiz) < Z(4))
|
||||
{
|
||||
if (FAF_ConnectCeiling(*hitsect) && !TEST(sector[*hitsect].floorstat, CEILING_STAT_FAF_BLOCK_HITSCAN))
|
||||
if (FAF_ConnectCeiling(hitinfo->sect) && !TEST(sector[hitinfo->sect].floorstat, CEILING_STAT_FAF_BLOCK_HITSCAN))
|
||||
{
|
||||
updatesectorz(*hitx, *hity, *hitz - Z(12), &newsectnum);
|
||||
updatesectorz(hitinfo->pos.x, hitinfo->pos.y, hitinfo->pos.z - Z(12), &newsectnum);
|
||||
plax_found = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -265,9 +259,9 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
|
||||
if (plax_found)
|
||||
{
|
||||
hitscan(*hitx, *hity, *hitz, newsectnum, xvect, yvect, zvect,
|
||||
hitsect, hitwall, hitsprite,
|
||||
hitx, hity, hitz, clipmask);
|
||||
vec3_t pos = hitinfo->pos;
|
||||
hitscan(&pos, newsectnum, xvect, yvect, zvect,
|
||||
hitinfo, clipmask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,10 +273,10 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects,
|
|||
short newsectnum = sects;
|
||||
int xvect, yvect, zvect;
|
||||
short ang;
|
||||
short hitsect, hitwall, hitsprite;
|
||||
int hitx, hity, hitz;
|
||||
hitdata_t hitinfo;
|
||||
int dist;
|
||||
SWBOOL plax_found = FALSE;
|
||||
vec3_t s = { xs, ys, zs };
|
||||
|
||||
ASSERT(sects >= 0 && secte >= 0);
|
||||
|
||||
|
@ -291,9 +285,6 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects,
|
|||
{
|
||||
return cansee(xs,ys,zs,sects,xe,ye,ze,secte);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
// get angle
|
||||
ang = getangle(xe - xs, ye - ys);
|
||||
|
@ -317,30 +308,29 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects,
|
|||
else
|
||||
zvect = 0;
|
||||
|
||||
hitscan(xs, ys, zs, sects, xvect, yvect, zvect,
|
||||
&hitsect, &hitwall, &hitsprite,
|
||||
&hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
hitscan(&s, sects, xvect, yvect, zvect,
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
if (hitsect < 0)
|
||||
if (hitinfo.sect < 0)
|
||||
return FALSE;
|
||||
|
||||
// make sure it hit JUST a sector before doing a check
|
||||
if (hitwall < 0 && hitsprite < 0)
|
||||
if (hitinfo.wall < 0 && hitinfo.sprite < 0)
|
||||
{
|
||||
getzsofslope(hitsect, hitx, hity, &hiz, &loz);
|
||||
if (labs(hitz - loz) < Z(4))
|
||||
getzsofslope(hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, &hiz, &loz);
|
||||
if (labs(hitinfo.pos.z - loz) < Z(4))
|
||||
{
|
||||
if (FAF_ConnectFloor(hitsect))
|
||||
if (FAF_ConnectFloor(hitinfo.sect))
|
||||
{
|
||||
updatesectorz(hitx, hity, hitz + Z(12), &newsectnum);
|
||||
updatesectorz(hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z + Z(12), &newsectnum);
|
||||
plax_found = TRUE;
|
||||
}
|
||||
}
|
||||
else if (labs(hitz - hiz) < Z(4))
|
||||
else if (labs(hitinfo.pos.z - hiz) < Z(4))
|
||||
{
|
||||
if (FAF_ConnectCeiling(hitsect))
|
||||
if (FAF_ConnectCeiling(hitinfo.sect))
|
||||
{
|
||||
updatesectorz(hitx, hity, hitz - Z(12), &newsectnum);
|
||||
updatesectorz(hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z - Z(12), &newsectnum);
|
||||
plax_found = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +341,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects,
|
|||
}
|
||||
|
||||
if (plax_found)
|
||||
return cansee(hitx,hity,hitz,newsectnum,xe,ye,ze,secte);
|
||||
return cansee(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,newsectnum,xe,ye,ze,secte);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -392,19 +382,19 @@ SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz)
|
|||
{
|
||||
case HIT_SECTOR:
|
||||
{
|
||||
short hitsector = NORM_SECTOR(florhit);
|
||||
short hit_sector = NORM_SECTOR(florhit);
|
||||
|
||||
// don't jack with connect sectors
|
||||
if (FAF_ConnectFloor(hitsector))
|
||||
if (FAF_ConnectFloor(hit_sector))
|
||||
{
|
||||
// rippers were dying through the floor in $rock
|
||||
if (TEST(sector[hitsector].floorstat, CEILING_STAT_FAF_BLOCK_HITSCAN))
|
||||
if (TEST(sector[hit_sector].floorstat, CEILING_STAT_FAF_BLOCK_HITSCAN))
|
||||
break;
|
||||
|
||||
if (TEST(sector[hitsector].extra, SECTFX_Z_ADJUST))
|
||||
if (TEST(sector[hit_sector].extra, SECTFX_Z_ADJUST))
|
||||
{
|
||||
// see if a z adjust ST1 is around
|
||||
z_amt = GetZadjustment(hitsector, FLOOR_Z_ADJUST);
|
||||
z_amt = GetZadjustment(hit_sector, FLOOR_Z_ADJUST);
|
||||
|
||||
if (z_amt)
|
||||
{
|
||||
|
@ -417,11 +407,11 @@ SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!TEST(sector[hitsector].extra, SECTFX_Z_ADJUST))
|
||||
if (!TEST(sector[hit_sector].extra, SECTFX_Z_ADJUST))
|
||||
break;
|
||||
|
||||
// see if a z adjust ST1 is around
|
||||
z_amt = GetZadjustment(hitsector, FLOOR_Z_ADJUST);
|
||||
z_amt = GetZadjustment(hit_sector, FLOOR_Z_ADJUST);
|
||||
|
||||
if (z_amt)
|
||||
{
|
||||
|
@ -430,7 +420,7 @@ SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz)
|
|||
}
|
||||
else
|
||||
// default adjustment for plax
|
||||
if (TEST(sector[hitsector].floorstat, FLOOR_STAT_PLAX))
|
||||
if (TEST(sector[hit_sector].floorstat, FLOOR_STAT_PLAX))
|
||||
{
|
||||
*loz += PlaxFloorGlobZadjust;
|
||||
}
|
||||
|
@ -446,15 +436,15 @@ SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz)
|
|||
{
|
||||
case HIT_SECTOR:
|
||||
{
|
||||
short hitsector = NORM_SECTOR(ceilhit);
|
||||
short hit_sector = NORM_SECTOR(ceilhit);
|
||||
|
||||
// don't jack with connect sectors
|
||||
if (FAF_ConnectCeiling(hitsector))
|
||||
if (FAF_ConnectCeiling(hit_sector))
|
||||
{
|
||||
if (TEST(sector[hitsector].extra, SECTFX_Z_ADJUST))
|
||||
if (TEST(sector[hit_sector].extra, SECTFX_Z_ADJUST))
|
||||
{
|
||||
// see if a z adjust ST1 is around
|
||||
z_amt = GetZadjustment(hitsector, CEILING_Z_ADJUST);
|
||||
z_amt = GetZadjustment(hit_sector, CEILING_Z_ADJUST);
|
||||
|
||||
if (z_amt)
|
||||
{
|
||||
|
@ -467,11 +457,11 @@ SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!TEST(sector[hitsector].extra, SECTFX_Z_ADJUST))
|
||||
if (!TEST(sector[hit_sector].extra, SECTFX_Z_ADJUST))
|
||||
break;
|
||||
|
||||
// see if a z adjust ST1 is around
|
||||
z_amt = GetZadjustment(hitsector, CEILING_Z_ADJUST);
|
||||
z_amt = GetZadjustment(hit_sector, CEILING_Z_ADJUST);
|
||||
|
||||
if (z_amt)
|
||||
{
|
||||
|
@ -480,7 +470,7 @@ SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz)
|
|||
}
|
||||
else
|
||||
// default adjustment for plax
|
||||
if (TEST(sector[hitsector].ceilingstat, CEILING_STAT_PLAX))
|
||||
if (TEST(sector[hit_sector].ceilingstat, CEILING_STAT_PLAX))
|
||||
{
|
||||
*hiz -= PlaxCeilGlobZadjust;
|
||||
}
|
||||
|
@ -566,7 +556,7 @@ void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
{
|
||||
case HIT_SECTOR:
|
||||
{
|
||||
short hitsector = NORM_SECTOR(*florhit);
|
||||
short hit_sector = NORM_SECTOR(*florhit);
|
||||
break;
|
||||
}
|
||||
case HIT_SPRITE:
|
||||
|
|
|
@ -2469,37 +2469,33 @@ SWBOOL NearThings(PLAYERp pp)
|
|||
}
|
||||
// This only gets called if nothing else worked, check for nearness to a wall
|
||||
{
|
||||
short hitsect, hitwall, hitsprite, dang;
|
||||
int hitx, hity, hitz;
|
||||
|
||||
|
||||
hitsect = hitwall = hitsprite = 0;
|
||||
dang = pp->pang;
|
||||
hitdata_t hitinfo = { { 0, 0, 0 }, 0, 0, 0 };
|
||||
short dang = pp->pang;
|
||||
|
||||
FAFhitscan(pp->posx, pp->posy, pp->posz - Z(30), pp->cursectnum, // Start position
|
||||
sintable[NORM_ANGLE(dang + 512)], // X vector of 3D ang
|
||||
sintable[NORM_ANGLE(dang)], // Y vector of 3D ang
|
||||
0, // Z vector of 3D ang
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
if (hitsect < 0)
|
||||
if (hitinfo.sect < 0)
|
||||
return FALSE;
|
||||
|
||||
if (Distance(hitx, hity, pp->posx, pp->posy) > 1500)
|
||||
if (Distance(hitinfo.pos.x, hitinfo.pos.y, pp->posx, pp->posy) > 1500)
|
||||
return FALSE;
|
||||
|
||||
// hit a sprite?
|
||||
if (hitsprite >= 0)
|
||||
if (hitinfo.sprite >= 0)
|
||||
return FALSE;
|
||||
|
||||
if (neartagsect >= 0)
|
||||
return TRUE;
|
||||
|
||||
if (hitwall >= 0)
|
||||
if (hitinfo.wall >= 0)
|
||||
{
|
||||
WALLp wp;
|
||||
|
||||
wp = &wall[hitwall];
|
||||
wp = &wall[hitinfo.wall];
|
||||
|
||||
// Near a plain old vanilla wall. Can't do anything but grunt.
|
||||
if (!TEST(wp->extra, WALLFX_DONT_STICK) && pp == Player+myconnectindex)
|
||||
|
|
|
@ -2104,22 +2104,22 @@ SpriteSetup(void)
|
|||
case SECT_WALL_PAN_SPEED:
|
||||
{
|
||||
short i, found = FALSE;
|
||||
short hitsect, hitwall, hitsprite;
|
||||
int hitx, hity, hitz;
|
||||
vec3_t hit_pos = { sp->x, sp->y, sp->z - Z(8) };
|
||||
hitdata_t hitinfo;
|
||||
|
||||
hitscan(sp->x, sp->y, sp->z - Z(8), sp->sectnum, // Start position
|
||||
hitscan(&hit_pos, sp->sectnum, // Start position
|
||||
sintable[NORM_ANGLE(sp->ang + 512)], // X vector of 3D ang
|
||||
sintable[sp->ang], // Y vector of 3D ang
|
||||
0, // Z vector of 3D ang
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
if (hitwall == -1)
|
||||
if (hitinfo.wall == -1)
|
||||
{
|
||||
KillSprite(SpriteNum);
|
||||
break;
|
||||
}
|
||||
|
||||
sp->owner = hitwall;
|
||||
sp->owner = hitinfo.wall;
|
||||
// if moves with SO
|
||||
if (TEST_BOOL1(sp))
|
||||
sp->xvel = 0;
|
||||
|
@ -2127,29 +2127,29 @@ SpriteSetup(void)
|
|||
sp->xvel = sp->lotag;
|
||||
sp->ang = SP_TAG6(sp);
|
||||
// attach to the sector that contains the wall
|
||||
changespritesect(SpriteNum, hitsect);
|
||||
changespritesect(SpriteNum, hitinfo.sect);
|
||||
change_sprite_stat(SpriteNum, STAT_WALL_PAN);
|
||||
break;
|
||||
}
|
||||
|
||||
case WALL_DONT_STICK:
|
||||
{
|
||||
short hitsect, hitwall, hitsprite;
|
||||
int hitx, hity, hitz;
|
||||
vec3_t hit_pos = { sp->x, sp->y, sp->z - Z(8) };
|
||||
hitdata_t hitinfo;
|
||||
|
||||
hitscan(sp->x, sp->y, sp->z - Z(8), sp->sectnum, // Start position
|
||||
hitscan(&hit_pos, sp->sectnum, // Start position
|
||||
sintable[NORM_ANGLE(sp->ang + 512)], // X vector of 3D ang
|
||||
sintable[sp->ang], // Y vector of 3D ang
|
||||
0, // Z vector of 3D ang
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
if (hitwall == -1)
|
||||
if (hitinfo.wall == -1)
|
||||
{
|
||||
KillSprite(SpriteNum);
|
||||
break;
|
||||
}
|
||||
|
||||
SET(wall[hitwall].extra, WALLFX_DONT_STICK);
|
||||
SET(wall[hitinfo.wall].extra, WALLFX_DONT_STICK);
|
||||
KillSprite(SpriteNum);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3142,7 +3142,7 @@ ScanToWall
|
|||
sintable[NORM_ANGLE(lsp->ang + 1024 + 512)],
|
||||
sintable[lsp->ang + 1024],
|
||||
0,
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz);
|
||||
&hitinfo);
|
||||
*/
|
||||
|
||||
|
||||
|
@ -3271,8 +3271,8 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
|
|||
{
|
||||
int DoActorMoveJump(short SpriteNum);
|
||||
int PickJumpSpeed(short SpriteNum, int pix_height);
|
||||
short hitsect, hitwall, hitsprite;
|
||||
int hitx, hity, hitz, zdiff;
|
||||
int zdiff;
|
||||
hitdata_t hitinfo;
|
||||
|
||||
sp->ang = tpoint->ang;
|
||||
|
||||
|
@ -3291,19 +3291,19 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
|
|||
sintable[NORM_ANGLE(sp->ang + 512)], // X vector of 3D ang
|
||||
sintable[sp->ang], // Y vector of 3D ang
|
||||
0, // Z vector of 3D ang
|
||||
&hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK_MISSILE);
|
||||
&hitinfo, CLIPMASK_MISSILE);
|
||||
|
||||
SET(sp->cstat, CSTAT_SPRITE_BLOCK);
|
||||
|
||||
ASSERT(hitsect >= 0);
|
||||
ASSERT(hitinfo.sect >= 0);
|
||||
|
||||
if (hitsprite >= 0)
|
||||
if (hitinfo.sprite >= 0)
|
||||
return FALSE;
|
||||
|
||||
if (hitwall < 0)
|
||||
if (hitinfo.wall < 0)
|
||||
return FALSE;
|
||||
|
||||
zdiff = labs(sp->z - sector[wall[hitwall].nextsector].floorz) >> 8;
|
||||
zdiff = labs(sp->z - sector[wall[hitinfo.wall].nextsector].floorz) >> 8;
|
||||
|
||||
u->jump_speed = PickJumpSpeed(SpriteNum, zdiff);
|
||||
}
|
||||
|
@ -3602,8 +3602,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
|
|||
|
||||
if (u->ActorActionSet->Jump)
|
||||
{
|
||||
int hitx, hity, hitz;
|
||||
short hitsect, hitwall, hitsprite;
|
||||
short hit_sect, hit_wall, hit_sprite;
|
||||
int bos_z,nx,ny;
|
||||
int dist;
|
||||
SPRITEp lsp;
|
||||
|
@ -3636,26 +3635,26 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
|
|||
|
||||
neartag(sp->x, sp->y, SPRITEp_TOS(sp) - DIV2(SPRITEp_SIZE_Z(sp)), sp->sectnum,
|
||||
sp->ang,
|
||||
&hitsect, &hitwall, &hitsprite,
|
||||
&hit_sect, &hit_wall, &hit_sprite,
|
||||
&dist, 600L, NTAG_SEARCH_LO_HI, NULL);
|
||||
|
||||
if (hitwall < 0)
|
||||
if (hit_wall < 0)
|
||||
{
|
||||
ActorLeaveTrack(SpriteNum);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if (wall[hitwall].nextsector < 0)
|
||||
if (wall[hit_wall].nextsector < 0)
|
||||
{
|
||||
TerminateGame();
|
||||
printf("Take out white wall ladder x = %d, y = %d",wall[hitwall].x, wall[hitwall].y);
|
||||
printf("Take out white wall ladder x = %d, y = %d",wall[hit_wall].x, wall[hit_wall].y);
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
// destination z for climbing
|
||||
u->sz = sector[wall[hitwall].nextsector].floorz;
|
||||
u->sz = sector[wall[hit_wall].nextsector].floorz;
|
||||
|
||||
DoActorZrange(SpriteNum);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -67,11 +67,11 @@ void DoPlayerBeginRecoil(PLAYERp pp, short pix_amt);
|
|||
SECTOR_OBJECTp DetectSectorObject(SECTORp);
|
||||
SECTOR_OBJECTp DetectSectorObjectByWall(WALLp);
|
||||
void ScaleSpriteVector(short SpriteNum, int scale);
|
||||
int QueueHole(short ang, short hitsect, short hitwall, int hitx, int hity, int hitz);
|
||||
int QueueWallBlood(short hitsprite,short ang);
|
||||
SWBOOL SlopeBounce(short SpriteNum, SWBOOL *hitwall);
|
||||
SWBOOL HitscanSpriteAdjust(short SpriteNum, short hitwall);
|
||||
int SpawnSwordSparks(PLAYERp pp, short hitsect, short hitwall, int hitx, int hity, int hitz, short hitang);
|
||||
int QueueHole(short ang, short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z);
|
||||
int QueueWallBlood(short hit_sprite, short ang);
|
||||
SWBOOL SlopeBounce(short SpriteNum, SWBOOL *hit_wall);
|
||||
SWBOOL HitscanSpriteAdjust(short SpriteNum, short hit_wall);
|
||||
int SpawnSwordSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z, short hit_ang);
|
||||
int SpawnBubble(short SpriteNum);
|
||||
int SpawnFireballExp(int16_t Weapon);
|
||||
int SpawnFireballFlames(int16_t SpriteNum,int16_t enemy);
|
||||
|
@ -152,7 +152,7 @@ extern short target_ang;
|
|||
|
||||
SWBOOL SpriteOverlap(short, short);
|
||||
|
||||
int SpawnShotgunSparks(PLAYERp pp, short hitsect, short hitwall, int hitx, int hity, int hitz, short hitang);
|
||||
int SpawnShotgunSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z, short hit_ang);
|
||||
int DoActorBeginSlide(short SpriteNum, short ang, short vel, short dec);
|
||||
int GetOverlapSector(int x, int y, short *over, short *under);
|
||||
SWBOOL MissileHitDiveArea(short SpriteNum);
|
||||
|
@ -230,7 +230,7 @@ int SpawnNuclearExp(int16_t Weapon);
|
|||
int SpawnBoltExp(int16_t Weapon);
|
||||
int SpawnTracerExp(int16_t Weapon);
|
||||
int SpawnGoroFireballExp(int16_t Weapon);
|
||||
SWBOOL MissileHitMatch(short Weapon,short WeaponNum,short hitsprite);
|
||||
SWBOOL MissileHitMatch(short Weapon,short WeaponNum,short hit_sprite);
|
||||
int DoItemFly(int16_t SpriteNum);
|
||||
int SpawnVehicleSmoke(short SpriteNum);
|
||||
short PrevWall(short wall_num);
|
||||
|
|
Loading…
Reference in a new issue