mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- - sector, sound, track, rotator
This commit is contained in:
parent
d62a65b6e3
commit
7f07be0d6d
4 changed files with 25 additions and 43 deletions
|
@ -256,7 +256,7 @@ int DoRotator(DSWActor* actor)
|
|||
USERp u = actor->u();
|
||||
ROTATORp r;
|
||||
short ndx,w,startwall,endwall;
|
||||
SPRITEp pivot = nullptr;
|
||||
DSWActor* pivot = nullptr;
|
||||
vec2_t nxy;
|
||||
int dist,closest;
|
||||
bool kill = false;
|
||||
|
@ -337,14 +337,13 @@ int DoRotator(DSWActor* actor)
|
|||
SWStatIterator it(STAT_ROTATOR_PIVOT);
|
||||
while (auto itActor = it.Next())
|
||||
{
|
||||
auto itsp = &itActor->s();
|
||||
if (itsp->lotag == actor->spr.lotag)
|
||||
if (itActor->spr.lotag == actor->spr.lotag)
|
||||
{
|
||||
dist = Distance(actor->spr.pos.X, actor->spr.pos.Y, itsp->pos.X, itsp->pos.Y);
|
||||
dist = Distance(actor->spr.pos.X, actor->spr.pos.Y, itActor->spr.pos.X, itActor->spr.pos.Y);
|
||||
if (dist < closest)
|
||||
{
|
||||
closest = dist;
|
||||
pivot = itsp;
|
||||
pivot = itActor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +356,7 @@ int DoRotator(DSWActor* actor)
|
|||
for(auto& wal : wallsofsector(actor->spr.sector()))
|
||||
{
|
||||
vec2_t const orig = { r->origX[ndx], r->origY[ndx] };
|
||||
rotatepoint(pivot->pos.vec2, orig, r->pos, &nxy);
|
||||
rotatepoint(pivot->spr.pos.vec2, orig, r->pos, &nxy);
|
||||
|
||||
dragpoint(&wal, nxy.X, nxy.Y);
|
||||
ndx++;
|
||||
|
|
|
@ -112,23 +112,19 @@ void SetSectorWallBits(sectortype* sect, int bit_mask, bool set_sectwall, bool s
|
|||
|
||||
void WallSetupDontMove(void)
|
||||
{
|
||||
SPRITEp spu, spl;
|
||||
WALLp wallp;
|
||||
|
||||
SWStatIterator it(STAT_WALL_DONT_MOVE_UPPER);
|
||||
while (auto iActor = it.Next())
|
||||
{
|
||||
spu = &iActor->s();
|
||||
SWStatIterator it1(STAT_WALL_DONT_MOVE_LOWER);
|
||||
while (auto jActor = it1.Next())
|
||||
{
|
||||
spl = &jActor->s();
|
||||
|
||||
if (spu->lotag == spl->lotag)
|
||||
if (iActor->spr.lotag == jActor->spr.lotag)
|
||||
{
|
||||
for(auto& wal : wall)
|
||||
{
|
||||
if (wal.pos.X < spl->pos.X && wal.pos.X > spu->pos.X && wal.pos.Y < spl->pos.Y && wal.pos.Y > spu->pos.Y)
|
||||
if (wal.pos.X < jActor->spr.pos.X && wal.pos.X > iActor->spr.pos.X && wal.pos.Y < jActor->spr.pos.Y && wal.pos.Y > iActor->spr.pos.Y)
|
||||
{
|
||||
SET(wal.extra, WALLFX_DONT_MOVE);
|
||||
}
|
||||
|
@ -834,8 +830,6 @@ int AnimateSwitch(DSWActor* actor, int tgt_value)
|
|||
void SectorExp(DSWActor* actor, sectortype* sectp, short orig_ang, int zh)
|
||||
{
|
||||
USERp u = actor->u();
|
||||
SPRITEp exp;
|
||||
USERp eu;
|
||||
int x,y,z;
|
||||
|
||||
RESET(actor->spr.cstat, CSTAT_SPRITE_ALIGNMENT_WALL|CSTAT_SPRITE_ALIGNMENT_FLOOR);
|
||||
|
@ -856,15 +850,13 @@ void SectorExp(DSWActor* actor, sectortype* sectp, short orig_ang, int zh)
|
|||
getzsofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, &u->hiz, &u->loz);
|
||||
|
||||
// spawn explosion
|
||||
auto explosion = SpawnSectorExp(actor);
|
||||
if (!explosion) return;
|
||||
exp = &explosion->s();
|
||||
eu = explosion->u();
|
||||
auto exp = SpawnSectorExp(actor);
|
||||
if (!exp) return;
|
||||
|
||||
exp->xrepeat += (RANDOM_P2(32<<8)>>8) - 16;
|
||||
exp->yrepeat += (RANDOM_P2(32<<8)>>8) - 16;
|
||||
eu->xchange = MOVEx(92, exp->ang);
|
||||
eu->ychange = MOVEy(92, exp->ang);
|
||||
exp->spr.xrepeat += (RANDOM_P2(32<<8)>>8) - 16;
|
||||
exp->spr.yrepeat += (RANDOM_P2(32<<8)>>8) - 16;
|
||||
exp->user.xchange = MOVEx(92, exp->spr.ang);
|
||||
exp->user.ychange = MOVEy(92, exp->spr.ang);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1148,7 +1140,6 @@ void KillMatchingCrackSprites(short match)
|
|||
|
||||
void WeaponExplodeSectorInRange(DSWActor* wActor)
|
||||
{
|
||||
SPRITEp wp = &wActor->s();
|
||||
USERp wu = wActor->u();
|
||||
int dist;
|
||||
int radius;
|
||||
|
@ -1157,7 +1148,7 @@ void WeaponExplodeSectorInRange(DSWActor* wActor)
|
|||
while (auto actor = it.Next())
|
||||
{
|
||||
// test to see if explosion is close to crack sprite
|
||||
dist = FindDistance3D(wp->pos.X - actor->spr.pos.X, wp->pos.Y - actor->spr.pos.Y, wp->pos.Z - actor->spr.pos.Z);
|
||||
dist = FindDistance3D(wActor->spr.pos.X - actor->spr.pos.X, wActor->spr.pos.Y - actor->spr.pos.Y, wActor->spr.pos.Z - actor->spr.pos.Z);
|
||||
|
||||
if (actor->spr.clipdist == 0)
|
||||
continue;
|
||||
|
@ -1167,7 +1158,7 @@ void WeaponExplodeSectorInRange(DSWActor* wActor)
|
|||
if ((unsigned int)dist > (wu->Radius/2) + radius)
|
||||
continue;
|
||||
|
||||
if (!FAFcansee(wp->pos.X,wp->pos.Y,wp->pos.Z,wp->sector(),actor->spr.pos.X,actor->spr.pos.Y,actor->spr.pos.Z,actor->spr.sector()))
|
||||
if (!FAFcansee(wActor->spr.pos.X,wActor->spr.pos.Y,wActor->spr.pos.Z,wActor->spr.sector(),actor->spr.pos.X,actor->spr.pos.Y,actor->spr.pos.Z,actor->spr.sector()))
|
||||
continue;
|
||||
|
||||
|
||||
|
|
|
@ -289,8 +289,7 @@ void StartAmbientSound(void)
|
|||
SWStatIterator it(STAT_AMBIENT);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
InitAmbient(sp->lotag, actor);
|
||||
InitAmbient(actor->spr.lotag, actor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -599,9 +598,9 @@ void GameInterface::UpdateSounds(void)
|
|||
binangle tang;
|
||||
if (pp->sop_remote)
|
||||
{
|
||||
auto rsp = &pp->remoteActor->s();
|
||||
DSWActor* rsp = pp->remoteActor;
|
||||
if (TEST_BOOL1(rsp))
|
||||
tang = buildang(rsp->ang);
|
||||
tang = buildang(rsp->spr.ang);
|
||||
else
|
||||
tang = bvectangbam(pp->sop_remote->xmid - pp->pos.X, pp->sop_remote->ymid - pp->pos.Y);
|
||||
}
|
||||
|
@ -744,8 +743,7 @@ void DeleteNoSoundOwner(DSWActor* actor)
|
|||
|
||||
void DeleteNoFollowSoundOwner(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
soundEngine->StopSound(SOURCE_Actor, sp, -1); // all non-follow sounds are SOURCE_Unattached
|
||||
soundEngine->StopSound(SOURCE_Actor, actor, -1); // all non-follow sounds are SOURCE_Unattached
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -611,8 +611,7 @@ void TrackSetup(void)
|
|||
int i;
|
||||
it.Reset(STAT_TRACK + ndx);
|
||||
auto itActor = it.Next();
|
||||
auto const sp = &itActor->s();
|
||||
Printf("WARNING: Did not find first point of Track Number %d, x %d, y %d\n", ndx, sp->pos.X, sp->pos.Y);
|
||||
Printf("WARNING: Did not find first point of Track Number %d, x %d, y %d\n", ndx, itActor->spr.pos.X, itActor->spr.pos.Y);
|
||||
it.Reset(STAT_TRACK + ndx);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
|
@ -970,17 +969,15 @@ cont:
|
|||
// between the zmid and the sp->z
|
||||
if (TEST(sop->flags, SOBJ_SPRITE_OBJ))
|
||||
{
|
||||
SPRITEp sp;
|
||||
int zmid = -9999999;
|
||||
|
||||
// choose the lowest sprite for the zmid
|
||||
for (i = 0; sop->so_actors[i] != nullptr; i++)
|
||||
{
|
||||
sp = &sop->so_actors[i]->s();
|
||||
u = sop->so_actors[i]->u();
|
||||
auto actor = sop->so_actors[i];
|
||||
|
||||
if (sp->pos.Z > zmid)
|
||||
zmid = sp->pos.Z;
|
||||
if (actor->spr.pos.Z > zmid)
|
||||
zmid = actor->spr.pos.Z;
|
||||
}
|
||||
|
||||
ASSERT(zmid != -9999999);
|
||||
|
@ -989,12 +986,9 @@ cont:
|
|||
|
||||
for (i = 0; sop->so_actors[i] != nullptr; i++)
|
||||
{
|
||||
sp = &sop->so_actors[i]->s();
|
||||
u = sop->so_actors[i]->u();
|
||||
|
||||
u->sz = sop->zmid - sp->pos.Z;
|
||||
auto actor = sop->so_actors[i];
|
||||
actor->user.sz = sop->zmid - actor->spr.pos.Z;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue