- RR-movement + dummyplayersprite

This commit is contained in:
Christoph Oelckers 2020-10-25 07:21:33 +01:00
parent 60ec6b8c7d
commit 635b53f78f
7 changed files with 31 additions and 34 deletions

View file

@ -371,7 +371,7 @@ void movedummyplayers(void)
if ((!isRR() && ps[p].on_crane != nullptr) || sector[ps[p].cursectnum].lotag != 1 || ps->GetActor()->s.extra <= 0) if ((!isRR() && ps[p].on_crane != nullptr) || sector[ps[p].cursectnum].lotag != 1 || ps->GetActor()->s.extra <= 0)
{ {
ps[p].dummyplayersprite = -1; ps[p].dummyplayersprite = nullptr;
deletesprite(act); deletesprite(act);
continue; continue;
} }

View file

@ -1768,7 +1768,7 @@ static void weaponcommon_d(DDukeActor* proj)
{ {
auto s = &proj->s; auto s = &proj->s;
if (s->picnum == COOLEXPLOSION1) if (s->picnum == COOLEXPLOSION1)
if (!S_CheckSoundPlaying(proj->GetIndex(), WIERDSHOT_FLY)) if (!S_CheckActorSoundPlaying(proj, WIERDSHOT_FLY))
S_PlayActorSound(WIERDSHOT_FLY, proj); S_PlayActorSound(WIERDSHOT_FLY, proj);
int p = -1; int p = -1;
@ -3598,7 +3598,7 @@ static void handle_se28(DDukeActor* actor)
x = ldist(psa, act2); x = ldist(psa, act2);
if (x < 768) if (x < 768)
{ {
if (S_CheckSoundPlaying(psa->GetIndex(), DUKE_LONGTERM_PAIN) < 1) if (S_CheckActorSoundPlaying(psa, DUKE_LONGTERM_PAIN) < 1)
S_PlayActorSound(DUKE_LONGTERM_PAIN, psa); S_PlayActorSound(DUKE_LONGTERM_PAIN, psa);
S_PlayActorSound(SHORT_CIRCUIT, psa); S_PlayActorSound(SHORT_CIRCUIT, psa);
psa->s.extra -= 8 + (krand() & 7); psa->s.extra -= 8 + (krand() & 7);

View file

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

View file

@ -1746,9 +1746,8 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
{ {
if (p->on_ground == 1) if (p->on_ground == 1)
{ {
if (p->dummyplayersprite == -1) if (p->dummyplayersprite == nullptr)
p->dummyplayersprite = p->dummyplayersprite = spawn(pact, PLAYERONWATER);
fi.spawn(pact->GetIndex(), PLAYERONWATER);
p->footprintcount = 6; p->footprintcount = 6;
if (sector[p->cursectnum].floorpicnum == FLOORSLIME) if (sector[p->cursectnum].floorpicnum == FLOORSLIME)
@ -1907,7 +1906,6 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz) static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz)
{ {
int j;
auto p = &ps[snum]; auto p = &ps[snum];
auto pact = p->GetActor(); auto pact = p->GetActor();
int psectlotag = sector[psect].lotag; int psectlotag = sector[psect].lotag;

View file

@ -2157,8 +2157,8 @@ static void onBoat(int snum, ESyncBits &actions)
static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int shrunk, int truefdist, int psectlotag) static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int shrunk, int truefdist, int psectlotag)
{ {
auto p = &ps[snum]; auto p = &ps[snum];
auto pi = p->i; auto pact = p->GetActor();
auto s = &sprite[pi]; auto s = &pact->s;
if (p->airleft != 15 * 26) if (p->airleft != 15 * 26)
p->airleft = 15 * 26; //Aprox twenty seconds. p->airleft = 15 * 26; //Aprox twenty seconds.
@ -2182,9 +2182,8 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
{ {
if (p->on_ground == 1) if (p->on_ground == 1)
{ {
if (p->dummyplayersprite == -1) if (p->dummyplayersprite == nullptr)
p->dummyplayersprite = p->dummyplayersprite = spawn(pact, PLAYERONWATER);
fi.spawn(pi, PLAYERONWATER);
p->footprintcount = 6; p->footprintcount = 6;
if (sector[p->cursectnum].floorpicnum == FLOORSLIME) if (sector[p->cursectnum].floorpicnum == FLOORSLIME)
@ -2226,15 +2225,15 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
p->moto_bump_fast = 1; p->moto_bump_fast = 1;
p->poszv -= gc * (p->MotoSpeed >> 4); p->poszv -= gc * (p->MotoSpeed >> 4);
p->MotoOnGround = 0; p->MotoOnGround = 0;
if (S_CheckActorSoundPlaying(pi, 188)) if (S_CheckActorSoundPlaying(pact, 188))
S_StopSound(188, pi); S_StopSound(188, pact);
S_PlayActorSound(189, pi); S_PlayActorSound(189, pact);
} }
else else
{ {
p->poszv += gc - 80 + (120 - p->MotoSpeed); p->poszv += gc - 80 + (120 - p->MotoSpeed);
if (!S_CheckActorSoundPlaying(pi, 189) && !S_CheckActorSoundPlaying(pi, 190)) if (!S_CheckActorSoundPlaying(pact, 189) && !S_CheckActorSoundPlaying(pact, 190))
S_PlayActorSound(190, pi); S_PlayActorSound(190, pact);
} }
} }
else else
@ -2244,13 +2243,13 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
if (p->poszv > 2400 && p->falling_counter < 255) if (p->poszv > 2400 && p->falling_counter < 255)
{ {
p->falling_counter++; p->falling_counter++;
if (p->falling_counter == 38 && !S_CheckActorSoundPlaying(pi, DUKE_SCREAM)) if (p->falling_counter == 38 && !S_CheckActorSoundPlaying(pact, DUKE_SCREAM))
S_PlayActorSound(DUKE_SCREAM, pi); S_PlayActorSound(DUKE_SCREAM, pact);
} }
if ((p->posz + p->poszv) >= (fz - (i << 8))) // hit the ground if ((p->posz + p->poszv) >= (fz - (i << 8))) // hit the ground
{ {
S_StopSound(DUKE_SCREAM, pi); S_StopSound(DUKE_SCREAM, pact);
if (sector[p->cursectnum].lotag != 1) if (sector[p->cursectnum].lotag != 1)
{ {
if (isRRRA()) p->MotoOnGround = 1; if (isRRRA()) p->MotoOnGround = 1;
@ -2263,12 +2262,12 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
s->extra -= j - (krand() & 3); s->extra -= j - (krand() & 3);
if (s->extra <= 0) if (s->extra <= 0)
{ {
S_PlayActorSound(SQUISHED, pi); S_PlayActorSound(SQUISHED, pact);
} }
else else
{ {
S_PlayActorSound(DUKE_LAND, pi); S_PlayActorSound(DUKE_LAND, pact);
S_PlayActorSound(DUKE_LAND_HURT, pi); S_PlayActorSound(DUKE_LAND_HURT, pact);
} }
SetPlayerPal(p, PalEntry(32, 16, 0, 0)); SetPlayerPal(p, PalEntry(32, 16, 0, 0));
@ -2277,16 +2276,16 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
{ {
if (p->OnMotorcycle) if (p->OnMotorcycle)
{ {
if (S_CheckActorSoundPlaying(pi, 190)) if (S_CheckActorSoundPlaying(pact, 190))
S_StopSound(pi, 190); S_StopSound(190, pact);
S_PlayActorSound(191, pi); S_PlayActorSound(191, pact);
p->TurbCount = 12; p->TurbCount = 12;
} }
else S_PlayActorSound(DUKE_LAND, pi); else S_PlayActorSound(DUKE_LAND, pact);
} }
else if (p->poszv > 1024 && p->OnMotorcycle) else if (p->poszv > 1024 && p->OnMotorcycle)
{ {
S_PlayActorSound(DUKE_LAND, pi); S_PlayActorSound(DUKE_LAND, pact);
p->TurbCount = 12; p->TurbCount = 12;
} }
} }
@ -2297,7 +2296,7 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
else else
{ {
p->falling_counter = 0; p->falling_counter = 0;
S_StopSound(-1, pi, CHAN_VOICE); S_StopSound(-1, pact, CHAN_VOICE);
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->poszv > (6144 >> 1)) if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->poszv > (6144 >> 1))
p->hard_landing = p->poszv >> 10; p->hard_landing = p->poszv >> 10;

View file

@ -101,7 +101,7 @@ void resetplayerstats(int snum)
// p->select_dir = 0; // p->select_dir = 0;
p->extra_extra8 = 0; p->extra_extra8 = 0;
p->show_empty_weapon= 0; p->show_empty_weapon= 0;
p->dummyplayersprite=-1; p->dummyplayersprite=nullptr;
p->crack_time = 0; p->crack_time = 0;
p->hbomb_hold_delay = 0; p->hbomb_hold_delay = 0;
p->transporter_hold = 0; p->transporter_hold = 0;

View file

@ -209,9 +209,9 @@ struct player_struct
short i, one_parallax_sectnum; short i, one_parallax_sectnum;
short over_shoulder_on, fist_incs; short over_shoulder_on, fist_incs;
short cheat_phase; short cheat_phase;
short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick; short extra_extra8, quick_kick, last_quick_kick;
short heat_amount, timebeforeexit, customexitsound; short heat_amount, timebeforeexit, customexitsound;
DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer, *access_spritenum; DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer, *access_spritenum, *dummyplayersprite;
short weaprecs[256], weapreccnt; short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag; unsigned int interface_toggle_flag;