From 78bbc31851ce51741a1a963893612fa9eb8fb385 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Nov 2021 17:56:04 +0100 Subject: [PATCH] - deal with a few ->sectnum's in SW. --- source/games/sw/src/skel.cpp | 2 +- source/games/sw/src/sprite.cpp | 3 +-- source/games/sw/src/weapon.cpp | 11 +++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/source/games/sw/src/skel.cpp b/source/games/sw/src/skel.cpp index 92c54eb2f5c..6851065f6c9 100644 --- a/source/games/sw/src/skel.cpp +++ b/source/games/sw/src/skel.cpp @@ -570,7 +570,7 @@ int DoSkelTeleport(DSWActor* actor) SetActorZ(actor, &sp->pos); - if (sp->sectnum != -1) + if (sp->insector()) break; } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 55353b1d184..c04e1a86d11 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -4767,7 +4767,6 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange) DSWActor* highActor; DSWActor* lowActor; SECTORp lo_sectp, hi_sectp; - short sectnum; short dist; int cliptype = CLIPMASK_ACTOR; @@ -4789,7 +4788,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange) highActor = u->highActor; lo_sectp = u->lo_sectp; hi_sectp = u->hi_sectp; - sectnum = sp->sectnum; + auto sect = sp->sector(); u->coll = move_sprite(actor, xchange, ychange, zchange, u->ceiling_dist, u->floor_dist, cliptype, ACTORMOVETICS); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 18924030cac..849f34640e5 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -10264,7 +10264,7 @@ void SpawnBreakStaticFlames(DSWActor* actor) nu->Radius = 200; nu->floor_dist = nu->ceiling_dist = 0; - np->z = getflorzofslope(np->sectnum,np->x,np->y); + np->z = getflorzofslopeptr(np->sector(), np->x, np->y); PlaySound(DIGI_FIRE1,actorNew,v3df_dontpan|v3df_doppler); } @@ -10892,7 +10892,7 @@ void SpawnExpZadjust(DSWActor* actor, DSWActor* expActor, int upper_zsize, int l { int cz,fz; - getzsofslope(exp->sectnum, exp->x, exp->y, &cz, &fz); + getzsofslopeptr(exp->sector(), exp->x, exp->y, &cz, &fz); tos_z = exp->z - upper_zsize; bos_z = exp->z + lower_zsize; @@ -11397,7 +11397,6 @@ int DoBloodWorm(DSWActor* actor) int xvect,yvect; int bx,by; int amt; - int sectnum; u->coll = move_ground_missile(actor, u->xchange, u->ychange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -11460,9 +11459,9 @@ int DoBloodWorm(DSWActor* actor) sp->x += MulScale(amt,xvect, 15); sp->y += MulScale(amt,yvect, 15); - sectnum = sp->sectnum; - updatesectorz(sp->x, sp->y, sp->z, §num); - if (sectnum >= 0) + auto sect = sp->sector(); + updatesectorz(sp->x, sp->y, sp->z, §); + if (sect) { GlobalSkipZrange = true; InitBloodSpray(actor, false, 1);