- access_spritenum

This commit is contained in:
Christoph Oelckers 2020-10-25 06:34:25 +01:00
parent b891646c37
commit 29b08b2115
8 changed files with 29 additions and 25 deletions

View file

@ -578,8 +578,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_ACCESS_SPRITENUM:
if (bSet) ps[iPlayer].access_spritenum = lValue;
else SetGameVarID((int)lVar2, ps[iPlayer].access_spritenum, sActor, sPlayer);
if (bSet) ps[iPlayer].access_spritenum = ScriptIndexToActor(lValue);
else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].access_spritenum), sActor, sPlayer);
break;
case PLAYER_KICKBACK_PIC:

View file

@ -247,8 +247,8 @@ int animateaccess(int gs,int snum,double hard_landing,double look_anghalf,double
looking_arc = access_y[ps[snum].access_incs] + (fabs(look_anghalf) / 4.5);
looking_arc -= hard_landing * 8.;
if(ps[snum].access_spritenum >= 0)
p = sprite[ps[snum].access_spritenum].pal;
if(ps[snum].access_spritenum != nullptr)
p = ps[snum].access_spritenum->s.pal;
else p = 0;
if((ps[snum].access_incs-3) > 0 && (ps[snum].access_incs-3)>>3)

View file

@ -1291,10 +1291,10 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum
if (j == HANDBOMB_WEAPON && p->ammo_amount[HANDBOMB_WEAPON] == 0)
{
StatIterator it(STAT_ACTOR);
while ((k = it.NextIndex()) >= 0)
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
{
if (sprite[k].picnum == HEAVYHBOMB && sprite[k].owner == p->i)
if (act->s.picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor())
{
p->gotweapon.Set(HANDBOMB_WEAPON);
j = HANDREMOTE_WEAPON;
@ -1515,16 +1515,16 @@ int doincrements_d(struct player_struct* p)
p->access_incs = 12;
if (p->access_incs == 12)
{
if (p->access_spritenum >= 0)
if (p->access_spritenum != nullptr)
{
fi.checkhitswitch(snum, p->access_spritenum, 1);
switch (sprite[p->access_spritenum].pal)
fi.checkhitswitch(snum, p->access_spritenum->GetIndex(), 1);
switch (p->access_spritenum->s.pal)
{
case 0:p->got_access &= (0xffff - 0x1); break;
case 21:p->got_access &= (0xffff - 0x2); break;
case 23:p->got_access &= (0xffff - 0x4); break;
}
p->access_spritenum = -1;
p->access_spritenum = nullptr;
}
else
{
@ -2613,7 +2613,8 @@ static void processweapon(int snum, ESyncBits actions, int psect)
{
auto p = &ps[snum];
int pi = p->i;
auto s = &sprite[pi];
auto pact = p->GetActor();
auto s = &pact->s;
int shrunk = (s->yrepeat < 32);
// Set maximum for pistol slightly higher if playing with `cl_showmagamount 1`.
@ -2721,7 +2722,8 @@ void processinput_d(int snum)
p = &ps[snum];
pi = p->i;
s = &sprite[pi];
auto pact = p->GetActor();
s = &pact->s;
p->horizon.resetadjustment();
p->angle.resetadjustment();

View file

@ -1054,10 +1054,10 @@ void selectweapon_r(int snum, int weap)
if (j == DYNAMITE_WEAPON && p->ammo_amount[DYNAMITE_WEAPON] == 0)
{
StatIterator it(STAT_ACTOR);
while ((k = it.NextIndex()) >= 0)
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
{
if (sprite[k].picnum == HEAVYHBOMB && sprite[k].owner == p->i)
if (act->s.picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor())
{
p->gotweapon.Set(DYNAMITE_WEAPON);
j = THROWINGDYNAMITE_WEAPON;
@ -1367,16 +1367,16 @@ int doincrements_r(struct player_struct* p)
p->access_incs = 12;
if (p->access_incs == 12)
{
if (p->access_spritenum >= 0)
if (p->access_spritenum != nullptr)
{
fi.checkhitswitch(snum, p->access_spritenum, 1);
switch (sprite[p->access_spritenum].pal)
fi.checkhitswitch(snum, p->access_spritenum->GetIndex(), 1);
switch (p->access_spritenum->s.pal)
{
case 0:p->keys[1] = 1; break;
case 21:p->keys[2] = 1; break;
case 23:p->keys[3] = 1; break;
}
p->access_spritenum = -1;
p->access_spritenum = nullptr;
}
else
{

View file

@ -121,7 +121,7 @@ void resetplayerstats(int snum)
p->airleft = 15*26;
p->rapid_fire_hold = 0;
p->toggle_key_flag = 0;
p->access_spritenum = -1;
p->access_spritenum = nullptr;
if(ud.multimode > 1 && ud.coop != 1 )
p->got_access = 7;
else p->got_access = 0;

View file

@ -233,6 +233,7 @@ bool checkhitswitch_d(int snum, int w, int switchtype)
correctdips = 1;
numdips = 0;
auto act = &hittype[w];
if (switchtype == SWITCH_SPRITE) // A wall sprite
{
lotag = sprite[w].lotag;
@ -309,7 +310,7 @@ bool checkhitswitch_d(int snum, int w, int switchtype)
if (switchtype == SWITCH_WALL)
ps[snum].access_wallnum = w;
else
ps[snum].access_spritenum = w;
ps[snum].access_spritenum = act;
}
return 0;

View file

@ -353,6 +353,7 @@ bool checkhitswitch_r(int snum, int w, int switchtype)
correctdips = 1;
numdips = 0;
auto act = &hittype[w];
if (switchtype == 1) // A wall sprite
{
lotag = sprite[w].lotag; if (lotag == 0) return 0;
@ -423,7 +424,7 @@ bool checkhitswitch_r(int snum, int w, int switchtype)
if (switchtype == 0)
ps[snum].access_wallnum = w;
else
ps[snum].access_spritenum = w;
ps[snum].access_spritenum = act;
}
return 0;

View file

@ -204,14 +204,14 @@ struct player_struct
short curr_weapon, last_weapon, tipincs, wantweaponfire;
short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay;
short jumping_counter, airleft, knee_incs, access_incs;
short ftq, access_wallnum, access_spritenum;
short ftq, access_wallnum;
short got_access, weapon_ang, firstaid_amount;
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, *access_spritenum;
short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag;