mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- wallmove.cpp
This commit is contained in:
parent
10ea8b0fb5
commit
21af63dfcc
3 changed files with 22 additions and 27 deletions
|
@ -2136,7 +2136,7 @@ void ScaleRandomPoint(SECTOR_OBJECTp sop,short k,short ang,int x,int y,int *dx,i
|
||||||
void CopySectorMatch(short match); // copysect.c
|
void CopySectorMatch(short match); // copysect.c
|
||||||
|
|
||||||
int DoWallMoveMatch(short match); // wallmove.c
|
int DoWallMoveMatch(short match); // wallmove.c
|
||||||
int DoWallMove(SPRITEp sp); // wallmove.c
|
int DoWallMove(DSWActor* sp); // wallmove.c
|
||||||
bool CanSeeWallMove(SPRITEp wp,short match); // wallmove.c
|
bool CanSeeWallMove(SPRITEp wp,short match); // wallmove.c
|
||||||
|
|
||||||
void DoSpikeOperate(short sectnum); // spike.c
|
void DoSpikeOperate(short sectnum); // spike.c
|
||||||
|
|
|
@ -38,16 +38,17 @@ BEGIN_SW_NS
|
||||||
|
|
||||||
SECTOR_OBJECTp DetectSectorObjectByWall(WALLp);
|
SECTOR_OBJECTp DetectSectorObjectByWall(WALLp);
|
||||||
|
|
||||||
void SOwallmove(SECTOR_OBJECTp sop, SPRITEp sp, WALLp find_wallp, int dist, int *nx, int *ny)
|
void SOwallmove(SECTOR_OBJECTp sop, DSWActor* actor, WALLp find_wallp, int dist, int *nx, int *ny)
|
||||||
{
|
{
|
||||||
int j,k,wallcount;
|
int j,k,wallcount;
|
||||||
WALLp wp;
|
WALLp wp;
|
||||||
short startwall,endwall;
|
short startwall,endwall;
|
||||||
SECTORp *sectp;
|
SECTORp *sectp;
|
||||||
|
|
||||||
if (TEST(sop->flags, SOBJ_SPRITE_OBJ))
|
if (!actor->hasU() || TEST(sop->flags, SOBJ_SPRITE_OBJ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto u = actor->u();
|
||||||
wallcount = 0;
|
wallcount = 0;
|
||||||
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||||
{
|
{
|
||||||
|
@ -62,8 +63,7 @@ void SOwallmove(SECTOR_OBJECTp sop, SPRITEp sp, WALLp find_wallp, int dist, int
|
||||||
{
|
{
|
||||||
short ang;
|
short ang;
|
||||||
// move orig x and y in saved angle
|
// move orig x and y in saved angle
|
||||||
ASSERT(User[sp - sprite].Data());
|
ang = u->sang;
|
||||||
ang = User[sp - sprite]->sang;
|
|
||||||
|
|
||||||
*nx = MulScale(dist, bcos(ang), 14);
|
*nx = MulScale(dist, bcos(ang), 14);
|
||||||
*ny = MulScale(dist, bsin(ang), 14);
|
*ny = MulScale(dist, bsin(ang), 14);
|
||||||
|
@ -80,7 +80,7 @@ void SOwallmove(SECTOR_OBJECTp sop, SPRITEp sp, WALLp find_wallp, int dist, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoWallMove(SPRITEp sp)
|
int DoWallMove(DSWActor* actor)
|
||||||
{
|
{
|
||||||
int dist,nx,ny;
|
int dist,nx,ny;
|
||||||
short shade1,shade2,ang,picnum1,picnum2;
|
short shade1,shade2,ang,picnum1,picnum2;
|
||||||
|
@ -90,6 +90,8 @@ int DoWallMove(SPRITEp sp)
|
||||||
short dang;
|
short dang;
|
||||||
bool SOsprite = false;
|
bool SOsprite = false;
|
||||||
|
|
||||||
|
auto sp = &actor->s();
|
||||||
|
|
||||||
dist = SP_TAG13(sp);
|
dist = SP_TAG13(sp);
|
||||||
ang = SP_TAG4(sp);
|
ang = SP_TAG4(sp);
|
||||||
picnum1 = SP_TAG5(sp);
|
picnum1 = SP_TAG5(sp);
|
||||||
|
@ -115,7 +117,7 @@ int DoWallMove(SPRITEp sp)
|
||||||
SECTOR_OBJECTp sop;
|
SECTOR_OBJECTp sop;
|
||||||
sop = DetectSectorObjectByWall(wallp);
|
sop = DetectSectorObjectByWall(wallp);
|
||||||
ASSERT(sop);
|
ASSERT(sop);
|
||||||
SOwallmove(sop, sp, wallp, dist, &nx, &ny);
|
SOwallmove(sop, actor, wallp, dist, &nx, &ny);
|
||||||
|
|
||||||
SOsprite = true;
|
SOsprite = true;
|
||||||
}
|
}
|
||||||
|
@ -143,15 +145,15 @@ int DoWallMove(SPRITEp sp)
|
||||||
SP_TAG9(sp)--;
|
SP_TAG9(sp)--;
|
||||||
if ((signed char)SP_TAG9(sp) <= 0)
|
if ((signed char)SP_TAG9(sp) <= 0)
|
||||||
{
|
{
|
||||||
KillSprite(short(sp - sprite));
|
KillActor(actor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (SOsprite)
|
if (SOsprite)
|
||||||
{
|
{
|
||||||
// move the sprite offset from center
|
// move the sprite offset from center
|
||||||
User[sp - sprite]->sx -= nx;
|
actor->u()->sx -= nx;
|
||||||
User[sp - sprite]->sy -= ny;
|
actor->u()->sy -= ny;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -169,44 +171,37 @@ bool CanSeeWallMove(SPRITEp wp, short match)
|
||||||
bool found = false;
|
bool found = false;
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
|
|
||||||
StatIterator it(STAT_WALL_MOVE_CANSEE);
|
SWStatIterator it(STAT_WALL_MOVE_CANSEE);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &sprite[i];
|
sp = &actor->s();
|
||||||
|
|
||||||
if (SP_TAG2(sp) == match)
|
if (SP_TAG2(sp) == match)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
if (cansee(wp->x,wp->y,wp->z,wp->sectnum,sp->x,sp->y,sp->z,sp->sectnum))
|
if (cansee(wp->x, wp->y, wp->z, wp->sectnum, sp->x, sp->y, sp->z, sp->sectnum))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found)
|
return !found;
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoWallMoveMatch(short match)
|
int DoWallMoveMatch(short match)
|
||||||
{
|
{
|
||||||
SPRITEp sp;
|
|
||||||
int i;
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
// just all with the same matching tags
|
// just all with the same matching tags
|
||||||
StatIterator it(STAT_WALL_MOVE);
|
SWStatIterator it(STAT_WALL_MOVE);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &sprite[i];
|
if (SP_TAG2(&actor->s()) == match)
|
||||||
|
|
||||||
if (SP_TAG2(sp) == match)
|
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
DoWallMove(sp);
|
DoWallMove(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7846,7 +7846,7 @@ int DoExpDamageTest(DSWActor* actor)
|
||||||
if (SP_TAG2(found_sp) == 0)
|
if (SP_TAG2(found_sp) == 0)
|
||||||
{
|
{
|
||||||
// just do one
|
// just do one
|
||||||
DoWallMove(found_sp);
|
DoWallMove(&swActors[found_sp - sprite]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue