- holoduke_on is now a pointer as well.

This commit is contained in:
Christoph Oelckers 2020-10-21 10:48:38 +02:00
parent d7604a3160
commit e94274a543
8 changed files with 19 additions and 17 deletions

View file

@ -493,7 +493,7 @@ void moveplayers(void) //Players
}
else
{
if (p->holoduke_on == -1)
if (p->holoduke_on == nullptr)
{
deletesprite(i);
continue;
@ -4974,7 +4974,7 @@ void alterang(int a, int g_i, int g_p)
g_sp->ang = WindDir;
else if (a & seekplayer)
{
j = !isRR()? ps[g_p].holoduke_on : -1;
j = !isRR()? ps[g_p].holoduke_on->GetIndex() : -1;
// NOTE: looks like 'owner' is set to target sprite ID...

View file

@ -732,8 +732,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
break;
case PLAYER_HOLODUKE_ON:
if (bSet) ps[iPlayer].holoduke_on = lValue;
else SetGameVarID((int)lVar2, ps[iPlayer].holoduke_on, sActor, sPlayer);
if (bSet) ps[iPlayer].holoduke_on = ScriptIndexToActor(lValue);
else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].holoduke_on), sActor, sPlayer);
break;
case PLAYER_PYCOUNT:
@ -1454,9 +1454,9 @@ static bool ifcansee(int g_i, int g_p)
// select sprite for monster to target
// if holoduke is on, let them target holoduke first.
//
if (ps[g_p].holoduke_on >= 0 && !isRR())
if (ps[g_p].holoduke_on != nullptr && !isRR())
{
s = &sprite[ps[g_p].holoduke_on];
s = &ps[g_p].holoduke_on->s;
j = cansee(g_sp->x, g_sp->y, g_sp->z - (krand() & ((32 << 8) - 1)), g_sp->sectnum,
s->x, s->y, s->z, s->sectnum);

View file

@ -37,6 +37,7 @@ source as it is released.
#include "global.h"
#include "gamecontrol.h"
#include "v_video.h"
#include "dukeactor.h"
BEGIN_DUKE_NS
@ -276,18 +277,19 @@ void hud_input(int snum)
{
if (!isRR())
{
if (p->holoduke_on == -1)
if (p->holoduke_on == nullptr)
{
if (p->holoduke_amount > 0)
{
p->inven_icon = 3;
p->holoduke_on = i =
i =
EGS(p->cursectnum,
p->posx,
p->posy,
p->posz + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.asbuild(), 0, 0, -1, 10);
hittype[i].temp_data[3] = hittype[i].temp_data[4] = 0;
p->holoduke_on = &hittype[i];
sprite[i].yvel = snum;
sprite[i].extra = 0;
FTA(QUOTE_HOLODUKE_ON, p);
@ -299,7 +301,7 @@ void hud_input(int snum)
else
{
S_PlayActorSound(TELEPORTER, p->holoduke_on);
p->holoduke_on = -1;
p->holoduke_on = nullptr;
FTA(QUOTE_HOLODUKE_OFF, p);
}
}

View file

@ -594,7 +594,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
p->dead_flag = (512 - ((krand() & 1) << 10) + (krand() & 255) - 512) & 2047;
p->jetpack_on = 0;
p->holoduke_on = -1;
p->holoduke_on = nullptr;
if (!isRR())S_StopSound(DUKE_JETPACK_IDLE, pi);
S_StopSound(-1, pi, CHAN_VOICE);

View file

@ -1465,13 +1465,13 @@ int doincrements_d(struct player_struct* p)
}
}
if (p->holoduke_on >= 0)
if (p->holoduke_on != nullptr)
{
p->holoduke_amount--;
if (p->holoduke_amount <= 0)
{
S_PlayActorSound(TELEPORTER, p->i);
p->holoduke_on = -1;
p->holoduke_on = nullptr;
checkavailinven(p);
}
}

View file

@ -136,7 +136,7 @@ void resetplayerstats(int snum)
}
p->heat_on = 0;
p->jetpack_on = 0;
p->holoduke_on = -1;
p->holoduke_on = nullptr;
p->angle.olook_ang = p->angle.look_ang = buildlook(512 - ((currentLevel->levelNumber & 1) << 10));
p->angle.orotscrnang = p->angle.rotscrnang = buildlook(0);
@ -320,7 +320,7 @@ void resetinventory(int snum)
p->jetpack_on = 0;
p->jetpack_amount = 0;
p->shield_amount = max_armour_amount;
p->holoduke_on = -1;
p->holoduke_on = nullptr;
p->holoduke_amount = 0;
p->firstaid_amount = 0;
p->steroids_amount = 0;

View file

@ -98,7 +98,7 @@ std::pair<const char*, EColorRange> DDukeCommonStatusBar::ontext(struct player_s
switch (p->inven_icon)
{
case ICON_HOLODUKE:
onstate = p->holoduke_on;
onstate = p->holoduke_on != nullptr;
break;
case ICON_JETPACK:
onstate = p->jetpack_on;

View file

@ -208,14 +208,14 @@ struct player_struct
short cheat_phase;
short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick;
short heat_amount, timebeforeexit, customexitsound;
DDukeActor* actorsqu, *on_crane;//, *wackedbyactor, *holoduke_on, *somethingonplayer;
DDukeActor* actorsqu, *on_crane, *holoduke_on;//, *wackedbyactor, *somethingonplayer;
short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag;
short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang
short scuba_amount, jetpack_amount, steroids_amount, shield_amount;
short holoduke_on, pycount, frag_ps;
short pycount, frag_ps;
short transporter_hold, last_full_weapon, footprintshade, boot_amount;
unsigned char on_warping_sector, footprintcount;