- 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 else
{ {
if (p->holoduke_on == -1) if (p->holoduke_on == nullptr)
{ {
deletesprite(i); deletesprite(i);
continue; continue;
@ -4974,7 +4974,7 @@ void alterang(int a, int g_i, int g_p)
g_sp->ang = WindDir; g_sp->ang = WindDir;
else if (a & seekplayer) 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... // 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; break;
case PLAYER_HOLODUKE_ON: case PLAYER_HOLODUKE_ON:
if (bSet) ps[iPlayer].holoduke_on = lValue; if (bSet) ps[iPlayer].holoduke_on = ScriptIndexToActor(lValue);
else SetGameVarID((int)lVar2, ps[iPlayer].holoduke_on, sActor, sPlayer); else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].holoduke_on), sActor, sPlayer);
break; break;
case PLAYER_PYCOUNT: case PLAYER_PYCOUNT:
@ -1454,9 +1454,9 @@ static bool ifcansee(int g_i, int g_p)
// select sprite for monster to target // select sprite for monster to target
// if holoduke is on, let them target holoduke first. // 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, 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); s->x, s->y, s->z, s->sectnum);

View file

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

View file

@ -136,7 +136,7 @@ void resetplayerstats(int snum)
} }
p->heat_on = 0; p->heat_on = 0;
p->jetpack_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.olook_ang = p->angle.look_ang = buildlook(512 - ((currentLevel->levelNumber & 1) << 10));
p->angle.orotscrnang = p->angle.rotscrnang = buildlook(0); p->angle.orotscrnang = p->angle.rotscrnang = buildlook(0);
@ -320,7 +320,7 @@ void resetinventory(int snum)
p->jetpack_on = 0; p->jetpack_on = 0;
p->jetpack_amount = 0; p->jetpack_amount = 0;
p->shield_amount = max_armour_amount; p->shield_amount = max_armour_amount;
p->holoduke_on = -1; p->holoduke_on = nullptr;
p->holoduke_amount = 0; p->holoduke_amount = 0;
p->firstaid_amount = 0; p->firstaid_amount = 0;
p->steroids_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) switch (p->inven_icon)
{ {
case ICON_HOLODUKE: case ICON_HOLODUKE:
onstate = p->holoduke_on; onstate = p->holoduke_on != nullptr;
break; break;
case ICON_JETPACK: case ICON_JETPACK:
onstate = p->jetpack_on; onstate = p->jetpack_on;

View file

@ -208,14 +208,14 @@ struct player_struct
short cheat_phase; short cheat_phase;
short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick; short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick;
short heat_amount, timebeforeexit, customexitsound; 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; short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag; unsigned int interface_toggle_flag;
short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang
short scuba_amount, jetpack_amount, steroids_amount, shield_amount; 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; short transporter_hold, last_full_weapon, footprintshade, boot_amount;
unsigned char on_warping_sector, footprintcount; unsigned char on_warping_sector, footprintcount;