From 72329eb01bcb9d8fbe01f3c3773ff90e56e1e311 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 21 Oct 2020 10:52:51 +0200 Subject: [PATCH] - wackedbyactor, too. --- source/games/duke/src/actors.cpp | 4 ++-- source/games/duke/src/actors_d.cpp | 4 ++-- source/games/duke/src/actors_r.cpp | 2 +- source/games/duke/src/gameexec.cpp | 6 +++--- source/games/duke/src/premap.cpp | 2 +- source/games/duke/src/types.h | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 41bb35b40..9e6f9eeb2 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -483,9 +483,9 @@ void moveplayers(void) //Players p->newowner = -1; - if (p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS) + if (p->wackedbyactor != nullptr && p->wackedbyactor->s.statnum < MAXSTATUS) { - p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), gethiq16angle(sprite[p->wackedbyactor].x - p->posx, sprite[p->wackedbyactor].y - p->posy)) >> 1)); + p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), gethiq16angle(p->wackedbyactor->s.x - p->posx, p->wackedbyactor->s.y - p->posy)) >> 1)); } } s->ang = p->angle.ang.asbuild(); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 2fa7d36a0..6f0a366c4 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -891,7 +891,7 @@ int ifhitbyweapon_d(int sn) { spr->extra = 0; - ps[p].wackedbyactor = j; + ps[p].wackedbyactor = &hittype[j]; if (htowner->picnum == APLAYER && p != htowner->yvel) { @@ -963,7 +963,7 @@ int ifhitbyweapon_d(int sn) { p = spr->yvel; spr->extra = 0; - ps[p].wackedbyactor = (short)ht->owner; + ps[p].wackedbyactor = ht->GetHitOwner(); if (htowner->picnum == APLAYER && p != ht->owner) ps[p].frag_ps = (short)ht->owner; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index c8b7c3634..14fdfd867 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -717,7 +717,7 @@ int ifhitbyweapon_r(int sn) { npc->extra = 0; - ps[p].wackedbyactor = j; + ps[p].wackedbyactor = &hittype[j]; if (sprite[hittype[sn].owner].picnum == APLAYER && p != sprite[hittype[sn].owner].yvel) { diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 5c6a5f5e1..d3d9e585a 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -497,8 +497,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl break; case PLAYER_WACKEDBYACTOR: - if (bSet) ps[iPlayer].wackedbyactor = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].wackedbyactor, sActor, sPlayer); + if (bSet) ps[iPlayer].wackedbyactor = ScriptIndexToActor(lValue); + else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].wackedbyactor), sActor, sPlayer); break; case PLAYER_FRAG: @@ -2263,7 +2263,7 @@ int ParseState::parse(void) ps[g_p].frag_ps = g_p; ps[g_p].horizon.ohorizoff = ps[g_p].horizon.horizoff = q16horiz(0); ps[g_p].opyoff = 0; - ps[g_p].wackedbyactor = -1; + ps[g_p].wackedbyactor = nullptr; ps[g_p].shield_amount = max_armour_amount; ps[g_p].dead_flag = 0; ps[g_p].pals.a = 0; diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 0396a1da8..59208de7b 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -78,7 +78,7 @@ void resetplayerstats(int snum) gFullMap = 0; p->dead_flag = 0; - p->wackedbyactor = -1; + p->wackedbyactor = nullptr; p->falling_counter = 0; p->quick_kick = 0; p->subweapon = 0; diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index ec2d3d108..cbe70a078 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -196,7 +196,7 @@ struct player_struct int aim_mode, auto_aim, ftt; short cursectnum, last_extra, subweapon; - short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself; + short ammo_amount[MAX_WEAPONS], frag, fraggedself; short curr_weapon, last_weapon, tipincs, wantweaponfire; short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay; @@ -208,7 +208,7 @@ struct player_struct short cheat_phase; short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick; short heat_amount, timebeforeexit, customexitsound; - DDukeActor* actorsqu, *on_crane, *holoduke_on;//, *wackedbyactor, *somethingonplayer; + DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on;//, *somethingonplayer; short weaprecs[256], weapreccnt; unsigned int interface_toggle_flag;