From 6f4a0c94e8cb35dbe0eb5ff705ba52e2d4535f4f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 17 Oct 2020 11:10:12 +0200 Subject: [PATCH] - something on player is now a pointer as well --- source/games/duke/src/actors_d.cpp | 12 ++++++------ source/games/duke/src/gameexec.cpp | 4 ++-- source/games/duke/src/premap.cpp | 2 +- source/games/duke/src/types.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 6f0a366c4..77a0e821f 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -2516,8 +2516,8 @@ static void greenslime(int i) } ps[p].actors_killed++; t[0] = -3; - if (ps[p].somethingonplayer == i) - ps[p].somethingonplayer = -1; + if (ps[p].somethingonplayer == &hittype[i]) + ps[p].somethingonplayer = nullptr; deletesprite(i); return; } @@ -2584,9 +2584,9 @@ static void greenslime(int i) else if (s->xvel < 64 && x < 768) { - if (ps[p].somethingonplayer == -1) + if (ps[p].somethingonplayer == nullptr) { - ps[p].somethingonplayer = i; + ps[p].somethingonplayer = &hittype[i]; if (t[0] == 3 || t[0] == 2) //Falling downward t[2] = (12 << 8); else t[2] = -(13 << 8); //Climbing up duke @@ -2598,8 +2598,8 @@ static void greenslime(int i) { S_PlayActorSound(SLIM_DYING, i); - if (ps[p].somethingonplayer == i) - ps[p].somethingonplayer = -1; + if (ps[p].somethingonplayer == &hittype[i]) + ps[p].somethingonplayer = nullptr; if (j == FREEZEBLAST) { diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index d3d9e585a..5381509bf 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -602,8 +602,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl break; case PLAYER_SOMETHINGONPLAYER: - if (bSet) ps[iPlayer].somethingonplayer = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].somethingonplayer, sActor, sPlayer); + if (bSet) ps[iPlayer].somethingonplayer = ScriptIndexToActor(lValue); + else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].somethingonplayer), sActor, sPlayer); break; case PLAYER_ON_CRANE: diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 59208de7b..a43a0e9a4 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -149,7 +149,7 @@ void resetplayerstats(int snum) p->poszv = 0; p->fric.x = 0; p->fric.y = 0; - p->somethingonplayer =-1; + p->somethingonplayer =nullptr; p->angle.spin = bamlook(0); p->on_crane = nullptr; diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index cbe70a078..0ffd23f8d 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -203,12 +203,12 @@ struct player_struct short jumping_counter, airleft, knee_incs, access_incs; short ftq, access_wallnum, access_spritenum; short got_access, weapon_ang, firstaid_amount; - short somethingonplayer, i, one_parallax_sectnum; + short i, one_parallax_sectnum; short over_shoulder_on, fist_incs; short cheat_phase; short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick; short heat_amount, timebeforeexit, customexitsound; - DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on;//, *somethingonplayer; + DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer; short weaprecs[256], weapreccnt; unsigned int interface_toggle_flag;