- ->s in non-gameplay files.

This commit is contained in:
Christoph Oelckers 2021-12-21 21:35:07 +01:00
parent edf3fd0f82
commit f816f2fb22
5 changed files with 29 additions and 37 deletions

View file

@ -129,7 +129,7 @@ void GameInterface::UpdateSounds()
//assert(primaryLevel->Zones.Size() > listenactor->Sector->ZoneNumber);
listener.Environment = 0;// primaryLevel->Zones[listenactor->Sector->ZoneNumber].Environment;
listener.ListenerObject = gMe->pSprite;
listener.ListenerObject = gMe;
soundEngine->SetListener(listener);
soundEngine->UpdateSounds(I_GetTime());
}

View file

@ -25,15 +25,14 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
DukeStatIterator it(STAT_RAROR);
while (auto act = it.Next())
{
auto spr = act->s;
if (
spr->picnum == SECTOREFFECTOR &&
spr->lotag == fofmode &&
spr->hitag == floor1->hitag
act->spr.picnum == SECTOREFFECTOR &&
act->spr.lotag == fofmode &&
act->spr.hitag == floor1->hitag
)
{
floor1 = spr;
fofmode = spr->lotag;
fofmode = act->spr.lotag;
ok++;
break;
}
@ -45,11 +44,10 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
it.Reset(STAT_RAROR);
while (auto act = it.Next())
{
auto spr = act->s;
if (
spr->picnum == SECTOREFFECTOR &&
spr->lotag == k &&
spr->hitag == floor1->hitag
act->spr.picnum == SECTOREFFECTOR &&
act->spr.lotag == k &&
act->spr.hitag == floor1->hitag
)
{
floor2 = spr;
@ -63,13 +61,12 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
it.Reset(STAT_RAROR);
while (auto act = it.Next())
{
auto spr = act->s;
if (spr->picnum == SECTOREFFECTOR &&
spr->lotag == k + 2 &&
spr->hitag == floor1->hitag
if (act->spr.picnum == SECTOREFFECTOR &&
act->spr.lotag == k + 2 &&
act->spr.hitag == floor1->hitag
)
{
auto sect = spr->sector();
auto sect = act->spr.sector();
// repurpose otherwise unused fields in sectortype as temporary storage.
if (k == tag + 0)
{
@ -98,13 +95,12 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
it.Reset(STAT_RAROR);
while (auto act = it.Next())
{
auto spr = act->s;
if (spr->picnum == 1 &&
spr->lotag == k + 2 &&
spr->hitag == floor1->hitag
if (act->spr.picnum == 1 &&
act->spr.lotag == k + 2 &&
act->spr.hitag == floor1->hitag
)
{
auto sect = spr->sector();
auto sect = act->spr.sector();
if (k == tag + 0)
{
sect->floorz = sect->Flag;

View file

@ -504,7 +504,6 @@ void resetpspritevars(int g)
int i, j;
int circ;
int firstx, firsty;
spritetype* s;
int aimmode[MAXPLAYERS];
STATUSBARTYPE tsbar[MAXPLAYERS];

View file

@ -97,13 +97,11 @@ void GameInterface::UpdateCameras(double smoothratio)
return;
auto p = &ps[screenpeek];
auto sp = camsprite->s;
if (p->newOwner != nullptr) camsprite->SetOwner(p->newOwner);
if (camsprite->GetOwner() && dist(p->GetActor(), camsprite) < VIEWSCREEN_ACTIVE_DISTANCE)
{
auto tex = tileGetTexture(sp->picnum);
auto tex = tileGetTexture(camsprite->spr.picnum);
TileFiles.MakeCanvas(TILE_VIEWSCR, (int)tex->GetDisplayWidth(), (int)tex->GetDisplayHeight());
auto canvas = renderSetTarget(TILE_VIEWSCR);
@ -111,7 +109,7 @@ void GameInterface::UpdateCameras(double smoothratio)
screen->RenderTextureView(canvas, [=](IntRect& rect)
{
auto camera = camsprite->GetOwner()->s;
auto camera = &camsprite->GetOwner()->spr;
auto ang = buildang(camera->interpolatedang(smoothratio));
display_mirror = 1; // should really be 'display external view'.
if (!testnewrenderer)
@ -284,7 +282,7 @@ void displayrooms(int snum, double smoothratio)
if (ud.cameraactor)
{
spritetype* s = ud.cameraactor->s;
spritetype* s = &ud.cameraactor->spr;
if (s->yvel < 0) s->yvel = -100;
else if (s->yvel > 199) s->yvel = 300;
@ -349,7 +347,7 @@ void displayrooms(int snum, double smoothratio)
spritetype* viewer;
if (p->newOwner != nullptr)
{
auto spr = p->newOwner->s;
auto spr = &p->newOwner->spr;
cang = buildang(spr->interpolatedang(smoothratio));
choriz = buildhoriz(spr->shade);
cposx = spr->pos.x;
@ -363,18 +361,18 @@ void displayrooms(int snum, double smoothratio)
else if (p->over_shoulder_on == 0)
{
if (cl_viewbob) cposz += interpolatedvalue(p->opyoff, p->pyoff, smoothratio);
viewer = p->GetActor()->s;
viewer = &p->GetActor()->spr;
}
else
{
cposz -= isRR() ? 3840 : 3072;
if (!calcChaseCamPos(&cposx, &cposy, &cposz, p->GetActor()->s, &sect, cang, choriz, smoothratio))
viewer = &p->GetActor()->spr;
if (!calcChaseCamPos(&cposx, &cposy, &cposz, viewer, &sect, cang, choriz, smoothratio))
{
cposz += isRR() ? 3840 : 3072;
calcChaseCamPos(&cposx, &cposy, &cposz, p->GetActor()->s, &sect, cang, choriz, smoothratio);
calcChaseCamPos(&cposx, &cposy, &cposz, viewer, &sect, cang, choriz, smoothratio);
}
viewer = p->GetActor()->s;
}
cz = p->GetActor()->ceilingz;

View file

@ -257,7 +257,6 @@ static int GetPositionInfo(DDukeActor* actor, int soundNum, sectortype* sect,
// There's a lot of hackery going on here that could be mapped to rolloff and attenuation parameters.
// However, ultimately rolloff would also just reposition the sound source so this can remain as it is.
auto sp = actor->s;
int orgsndist = 0, sndist = 0;
auto const* snd = soundEngine->GetUserData(soundNum + 1);
int userflags = snd ? snd[kFlags] : 0;
@ -266,18 +265,18 @@ static int GetPositionInfo(DDukeActor* actor, int soundNum, sectortype* sect,
FVector3 sndorg = GetSoundPos(pos);
FVector3 campos = GetSoundPos(cam);
if (sp->picnum != TILE_APLAYER || sp->yvel != screenpeek)
if (actor->spr.picnum != TILE_APLAYER || actor->spr.yvel != screenpeek)
{
orgsndist = sndist = int(16 * (sndorg - campos).Length());
if ((userflags & (SF_GLOBAL | SF_DTAG)) != SF_GLOBAL && sp->picnum == MUSICANDSFX && sp->lotag < 999 && (sp->sector()->lotag & 0xff) < ST_9_SLIDING_ST_DOOR)
sndist = DivScale(sndist, sp->hitag + 1, 14);
if ((userflags & (SF_GLOBAL | SF_DTAG)) != SF_GLOBAL && actor->spr.picnum == MUSICANDSFX && actor->spr.lotag < 999 && (actor->spr.sector()->lotag & 0xff) < ST_9_SLIDING_ST_DOOR)
sndist = DivScale(sndist, actor->spr.hitag + 1, 14);
}
sndist += dist_adjust;
if (sndist < 0) sndist = 0;
if (sect!= nullptr && sndist && sp->picnum != MUSICANDSFX && !cansee(cam->x, cam->y, cam->z - (24 << 8), sect, sp->x, sp->y, sp->z - (24 << 8), sp->sector()))
if (sect!= nullptr && sndist && actor->spr.picnum != MUSICANDSFX && !cansee(cam->x, cam->y, cam->z - (24 << 8), sect, actor->spr.x, actor->spr.y, actor->spr.z - (24 << 8), actor->spr.sector()))
sndist += sndist >> (isRR() ? 2 : 5);
// Here the sound distance was clamped to a minimum of 144*4.
@ -417,7 +416,7 @@ void GameInterface::UpdateSounds(void)
listener.Environment = nullptr;
listener.valid = false;
}
listener.ListenerObject = ud.cameraactor == nullptr ? nullptr : ud.cameraactor->s;
listener.ListenerObject = ud.cameraactor == nullptr ? nullptr : ud.cameraactor;
soundEngine->SetListener(listener);
}