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