From c90e7d9b5f5246ec431970af8cafd31cc6cd8787 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 3 Nov 2020 00:01:35 +0100 Subject: [PATCH] - almost the last owners --- source/games/duke/src/animatesprites_d.cpp | 14 +++++++------- source/games/duke/src/animatesprites_r.cpp | 14 +++++++------- source/games/duke/src/dukeactor.h | 5 ----- source/games/duke/src/spawn_d.cpp | 13 ++++++------- source/games/duke/src/spawn_r.cpp | 8 ++++---- 5 files changed, 24 insertions(+), 30 deletions(-) diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index ca2f7769d..dc1ae6419 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -174,7 +174,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio) } if (t->statnum == 99) continue; - if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && s->owner >= 0) + if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && h->GetOwner()) { t->x -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx); t->y -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy); @@ -337,7 +337,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio) } } - if ((display_mirror == 1 || screenpeek != p || s->owner == -1) && ud.multimode > 1 && ud.showweapons && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) + if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && ud.showweapons && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) { auto newtspr = &tsprite[spritesortcnt]; memcpy(newtspr, t, sizeof(spritetype)); @@ -368,7 +368,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio) case DEVISTATOR_WEAPON: newtspr->picnum = DEVISTATORSPRITE; break; } - if (s->owner >= 0) + if (h->GetOwner()) newtspr->z = ps[p].posz - (12 << 8); else newtspr->z = s->z - (51 << 8); if (ps[p].curr_weapon == HANDBOMB_WEAPON) @@ -385,7 +385,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio) spritesortcnt++; } - if (s->owner == -1) + if (!h->GetOwner()) { /*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) { k = 0; @@ -425,7 +425,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio) } if (ud.cameraactor == nullptr && ps[p].newowner == -1) - if (s->owner >= 0 && display_mirror == 0 && ps[p].over_shoulder_on == 0) + if (h->GetOwner() && display_mirror == 0 && ps[p].over_shoulder_on == 0) if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek)) { t->owner = -1; @@ -438,7 +438,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio) if (sector[sect].floorpal) t->pal = sector[sect].floorpal; - if (s->owner == -1) continue; + if (!h->GetOwner()) continue; if (t->z > h->floorz && t->xrepeat < 32) t->z = h->floorz; @@ -565,7 +565,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio) t->cstat |= 4; } - if (s->statnum == STAT_DUMMYPLAYER || badguy(s) || (s->picnum == APLAYER && s->owner >= 0)) + if (s->statnum == STAT_DUMMYPLAYER || badguy(s) || (s->picnum == APLAYER && h->GetOwner())) if (t->statnum != 99 && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE) if (s->picnum != HOTMEAT) { diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index c484bc69e..09c572321 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -159,7 +159,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio) } if (t->statnum == 99) continue; - if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && s->owner >= 0) + if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && h->GetOwner()) { t->x -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx); t->y -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy); @@ -384,7 +384,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio) } } - if ((display_mirror == 1 || screenpeek != p || s->owner == -1) && ud.multimode > 1 && ud.showweapons && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) + if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && ud.showweapons && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) { auto newtspr = &tsprite[spritesortcnt]; memcpy(newtspr, t, sizeof(spritetype)); @@ -414,7 +414,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio) case TIT_WEAPON: newtspr->picnum = FREEZESPRITE; break; } - if (s->owner >= 0) + if (h->GetOwner()) newtspr->z = ps[p].posz - (12 << 8); else newtspr->z = s->z - (51 << 8); if (ps[p].curr_weapon == HANDBOMB_WEAPON) @@ -436,7 +436,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio) spritesortcnt++; } - if (s->owner == -1) + if (!h->GetOwner()) { /*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) { k = 0; @@ -476,7 +476,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio) } if (ud.cameraactor == nullptr && ps[p].newowner == -1) - if (s->owner >= 0 && display_mirror == 0 && ps[p].over_shoulder_on == 0) + if (h->GetOwner() && display_mirror == 0 && ps[p].over_shoulder_on == 0) if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek)) { t->owner = -1; @@ -489,7 +489,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio) if (sector[sect].floorpal) t->pal = sector[sect].floorpal; - if (s->owner == -1) continue; + if (!h->GetOwner()) continue; if (t->z > h->floorz && t->xrepeat < 32) t->z = h->floorz; @@ -720,7 +720,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio) if (!isRRRA() && s->picnum == SBMOVE) t->shade = -127; - if (s->statnum == 13 || badguy(s) || (s->picnum == APLAYER && s->owner >= 0)) + if (s->statnum == 13 || badguy(s) || (s->picnum == APLAYER && h->GetOwner())) if ((s->cstat & 48) == 0 && t->statnum != 99) if (s->picnum != EXPLOSION2 && s->picnum != DOMELITE && s->picnum != TORNADO && s->picnum != EXPLOSION3 && (s->picnum != SBMOVE || isRRRA())) { diff --git a/source/games/duke/src/dukeactor.h b/source/games/duke/src/dukeactor.h index a7003e084..611269542 100644 --- a/source/games/duke/src/dukeactor.h +++ b/source/games/duke/src/dukeactor.h @@ -145,11 +145,6 @@ inline DDukeActor* ScriptIndexToActor(int index) return &hittype[index]; } -inline bool wallswitchcheck(DDukeActor* s) -{ - return !!(tileinfo[s->s.picnum].flags & TFLAG_WALLSWITCH); -} - int spawn_d(int j, int pn); int spawn_r(int j, int pn); diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 6cd904e4b..bda23f9f1 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -1115,7 +1115,6 @@ int spawn_d(int j, int pn) else sp->cstat = 1+256; sp->extra = impact_damage<<2; act->SetOwner(act); - changespritestat(act, STAT_STANDABLE); break; @@ -1143,8 +1142,8 @@ int spawn_d(int j, int pn) } sp->pal = 0; - sp->owner = i; - changespritestat(i,6); + act->SetOwner(act); + changespritestat(act, STAT_STANDABLE); sp->xvel = 8; ssp(act, CLIPMASK0); break; @@ -1154,7 +1153,7 @@ int spawn_d(int j, int pn) sp->lotag = 1; sp->cstat |= 257; sp->clipdist = 8; - sp->owner = i; + act->SetOwner(act); break; case CANWITHSOMETHING: case CANWITHSOMETHING2: @@ -1175,9 +1174,9 @@ int spawn_d(int j, int pn) sp->xrepeat = sp->yrepeat = 32; sp->clipdist = 72; makeitfall(act); - if(j >= 0) - sp->owner = j; - else sp->owner = i; + if(j >= 0) act->SetOwner(actj); + else act->SetOwner(act); + case EGG: if( ud.monsters_off == 1 && sp->picnum == EGG ) { diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 50f72ad26..22217de0a 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -1439,7 +1439,7 @@ int spawn_r(int j, int pn) sp->lotag = 1; sp->cstat |= 257; sp->clipdist = 8; - sp->owner = i; + act->SetOwner(act); break; case CANWITHSOMETHING: case RUBBERCAN: @@ -1457,9 +1457,9 @@ int spawn_r(int j, int pn) sp->xrepeat = sp->yrepeat = 32; sp->clipdist = 72; makeitfall(act); - if(j >= 0) - sp->owner = j; - else sp->owner = i; + if(j >= 0) act->SetOwner(actj); + else act->SetOwner(act); + case EGG: if( ud.monsters_off == 1 && sp->picnum == EGG ) {