- player.i, part 2

# Conflicts:
#	source/games/duke/src/sectors_r.cpp
This commit is contained in:
Christoph Oelckers 2020-11-02 20:23:30 +01:00
parent 770897b8b9
commit cc0a668da3
4 changed files with 40 additions and 38 deletions

View file

@ -176,7 +176,7 @@ void getglobalz(DDukeActor* s);
void OnEvent(int id, int pnum = -1, DDukeActor* snum = nullptr, int dist = -1); void OnEvent(int id, int pnum = -1, DDukeActor* snum = nullptr, int dist = -1);
short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, short s_ow, signed char s_ss); short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, short s_ow, signed char s_ss);
void ceilingglass(int snum, int sectnum, int cnt); void ceilingglass(DDukeActor* snum, int sectnum, int cnt);
void spriteglass(DDukeActor* snum, int cnt); void spriteglass(DDukeActor* snum, int cnt);
void lotsofcolourglass(DDukeActor* snum, int wallNum, int cnt); void lotsofcolourglass(DDukeActor* snum, int wallNum, int cnt);
void lotsofglass(int snum, int wallnum, int cnt); void lotsofglass(int snum, int wallnum, int cnt);

View file

@ -599,7 +599,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act)
if (act && (flags & SF_TALK) == 0) if (act && (flags & SF_TALK) == 0)
S_PlaySound3D(hitag, act, &v); S_PlaySound3D(hitag, act, &v);
else else
S_PlayActorSound(hitag, ps[snum].i); S_PlayActorSound(hitag, ps[snum].GetActor());
} }
return 1; return 1;
@ -961,8 +961,8 @@ bool checkhitceiling_d(int sn)
case TECHLIGHT2: case TECHLIGHT2:
case TECHLIGHT4: case TECHLIGHT4:
ceilingglass(ps[myconnectindex].i, sn, 10); ceilingglass(ps[myconnectindex].GetActor(), sn, 10);
S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].i); S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].GetActor());
if (sector[sn].ceilingpicnum == WALLLIGHT1) if (sector[sn].ceilingpicnum == WALLLIGHT1)
sector[sn].ceilingpicnum = WALLLIGHTBUST1; sector[sn].ceilingpicnum = WALLLIGHTBUST1;
@ -1499,6 +1499,7 @@ void checksectors_d(int snum)
int neartaghitdist; int neartaghitdist;
p = &ps[snum]; p = &ps[snum];
auto pact = p->GetActor();
switch (sector[p->cursectnum].lotag) switch (sector[p->cursectnum].lotag)
{ {
@ -1521,7 +1522,7 @@ void checksectors_d(int snum)
if (sector[p->cursectnum].lotag >= 10000 && sector[p->cursectnum].lotag < 16383) if (sector[p->cursectnum].lotag >= 10000 && sector[p->cursectnum].lotag < 16383)
{ {
if (snum == screenpeek || ud.coop == 1) if (snum == screenpeek || ud.coop == 1)
S_PlayActorSound(sector[p->cursectnum].lotag - 10000, p->i); S_PlayActorSound(sector[p->cursectnum].lotag - 10000, pact);
sector[p->cursectnum].lotag = 0; sector[p->cursectnum].lotag = 0;
} }
break; break;
@ -1569,7 +1570,7 @@ void checksectors_d(int snum)
if (i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR) if (i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR)
if (wall[hitscanwall].lotag > 0 && S_CheckSoundPlaying(wall[hitscanwall].lotag) == 0 && snum == screenpeek) if (wall[hitscanwall].lotag > 0 && S_CheckSoundPlaying(wall[hitscanwall].lotag) == 0 && snum == screenpeek)
{ {
S_PlayActorSound(wall[hitscanwall].lotag, p->i); S_PlayActorSound(wall[hitscanwall].lotag, pact);
return; return;
} }
@ -1693,7 +1694,7 @@ void checksectors_d(int snum)
} }
return; return;
case PLUG: case PLUG:
S_PlayActorSound(SHORT_CIRCUIT, p->i); S_PlayActorSound(SHORT_CIRCUIT, pact);
p->GetActor()->s.extra -= 2 + (krand() & 3); p->GetActor()->s.extra -= 2 + (krand() & 3);
SetPlayerPal(p, PalEntry(32, 48, 48, 64)); SetPlayerPal(p, PalEntry(32, 48, 48, 64));
break; break;
@ -1758,8 +1759,8 @@ void checksectors_d(int snum)
if (abs(hits(p->GetActor())) < 512) if (abs(hits(p->GetActor())) < 512)
{ {
if ((krand() & 255) < 16) if ((krand() & 255) < 16)
S_PlayActorSound(DUKE_SEARCH2, p->i); S_PlayActorSound(DUKE_SEARCH2, pact);
else S_PlayActorSound(DUKE_SEARCH, p->i); else S_PlayActorSound(DUKE_SEARCH, pact);
return; return;
} }

View file

@ -1399,7 +1399,7 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll)
p->GetActor()->s.extra -= 5; p->GetActor()->s.extra -= 5;
p->hurt_delay = 16; p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0)); SetPlayerPal(p, PalEntry(32, 32, 0, 0));
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->i); S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
} }
break; break;
} }
@ -1449,8 +1449,8 @@ bool checkhitceiling_r(int sn)
case RRTILE2898: case RRTILE2898:
ceilingglass(ps[myconnectindex].i, sn, 10); ceilingglass(ps[myconnectindex].GetActor(), sn, 10);
S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].i); S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].GetActor());
if (sector[sn].ceilingpicnum == WALLLIGHT1) if (sector[sn].ceilingpicnum == WALLLIGHT1)
sector[sn].ceilingpicnum = WALLLIGHTBUST1; sector[sn].ceilingpicnum = WALLLIGHTBUST1;
@ -2439,6 +2439,7 @@ void checksectors_r(int snum)
int neartaghitdist; int neartaghitdist;
p = &ps[snum]; p = &ps[snum];
auto pact = p->GetActor();
switch (sector[p->cursectnum].lotag) switch (sector[p->cursectnum].lotag)
{ {
@ -2465,7 +2466,7 @@ void checksectors_r(int snum)
if (sector[p->cursectnum].lotag >= 10000) if (sector[p->cursectnum].lotag >= 10000)
{ {
if (snum == screenpeek || ud.coop == 1) if (snum == screenpeek || ud.coop == 1)
S_PlayActorSound(sector[p->cursectnum].lotag - 10000, p->i); S_PlayActorSound(sector[p->cursectnum].lotag - 10000, pact);
sector[p->cursectnum].lotag = 0; sector[p->cursectnum].lotag = 0;
} }
break; break;
@ -2496,20 +2497,20 @@ void checksectors_r(int snum)
if (hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR && snum == screenpeek) if (hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR && snum == screenpeek)
if (numplayers == 1) if (numplayers == 1)
{ {
if (S_CheckActorSoundPlaying(p->i, 27) == 0 && S_CheckActorSoundPlaying(p->i, 28) == 0 && S_CheckActorSoundPlaying(p->i, 29) == 0 if (S_CheckActorSoundPlaying(pact, 27) == 0 && S_CheckActorSoundPlaying(pact, 28) == 0 && S_CheckActorSoundPlaying(pact, 29) == 0
&& S_CheckActorSoundPlaying(p->i, 257) == 0 && S_CheckActorSoundPlaying(p->i, 258) == 0) && S_CheckActorSoundPlaying(pact, 257) == 0 && S_CheckActorSoundPlaying(pact, 258) == 0)
{ {
short snd = krand() % 5; short snd = krand() % 5;
if (snd == 0) if (snd == 0)
S_PlayActorSound(27, p->i); S_PlayActorSound(27, pact);
else if (snd == 1) else if (snd == 1)
S_PlayActorSound(28, p->i); S_PlayActorSound(28, pact);
else if (snd == 2) else if (snd == 2)
S_PlayActorSound(29, p->i); S_PlayActorSound(29, pact);
else if (snd == 3) else if (snd == 3)
S_PlayActorSound(257, p->i); S_PlayActorSound(257, pact);
else if (snd == 4) else if (snd == 4)
S_PlayActorSound(258, p->i); S_PlayActorSound(258, pact);
} }
return; return;
} }
@ -2517,9 +2518,9 @@ void checksectors_r(int snum)
else else
{ {
if (hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR) if (hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR)
if (wall[hitscanwall].lotag > 0 && S_CheckActorSoundPlaying(p->i, wall[hitscanwall].lotag) == 0 && snum == screenpeek) if (wall[hitscanwall].lotag > 0 && S_CheckActorSoundPlaying(pact, wall[hitscanwall].lotag) == 0 && snum == screenpeek)
{ {
S_PlayActorSound(wall[hitscanwall].lotag, p->i); S_PlayActorSound(wall[hitscanwall].lotag, pact);
return; return;
} }
} }
@ -2663,7 +2664,7 @@ void checksectors_r(int snum)
case RRTILE2122: case RRTILE2122:
if (p->last_pissed_time == 0) if (p->last_pissed_time == 0)
{ {
S_PlayActorSound(435, p->i); S_PlayActorSound(435, pact);
p->last_pissed_time = 26 * 220; p->last_pissed_time = 26 * 220;
p->transporter_hold = 29 * 2; p->transporter_hold = 29 * 2;
@ -2680,8 +2681,8 @@ void checksectors_r(int snum)
else if (p->GetActor()->s.extra < max_player_health) else if (p->GetActor()->s.extra < max_player_health)
p->GetActor()->s.extra = max_player_health; p->GetActor()->s.extra = max_player_health;
} }
else if (S_CheckActorSoundPlaying(p->i, DUKE_GRUNT) == 0) else if (S_CheckActorSoundPlaying(pact, DUKE_GRUNT) == 0)
S_PlayActorSound(DUKE_GRUNT, p->i); S_PlayActorSound(DUKE_GRUNT, pact);
return; return;
case WATERFOUNTAIN: case WATERFOUNTAIN:
if (neartagsprite->temp_data[0] != 1) if (neartagsprite->temp_data[0] != 1)
@ -2692,12 +2693,12 @@ void checksectors_r(int snum)
if (p->GetActor()->s.extra < max_player_health) if (p->GetActor()->s.extra < max_player_health)
{ {
p->GetActor()->s.extra++; p->GetActor()->s.extra++;
S_PlayActorSound(DUKE_DRINKING, p->i); S_PlayActorSound(DUKE_DRINKING, pact);
} }
} }
return; return;
case PLUG: case PLUG:
S_PlayActorSound(SHORT_CIRCUIT, p->i); S_PlayActorSound(SHORT_CIRCUIT, pact);
p->GetActor()->s.extra -= 2 + (krand() & 3); p->GetActor()->s.extra -= 2 + (krand() & 3);
SetPlayerPal(p, PalEntry(32, 48, 48, 64)); SetPlayerPal(p, PalEntry(32, 48, 48, 64));
break; break;
@ -2710,8 +2711,8 @@ void checksectors_r(int snum)
if (abs(hits(p->GetActor())) < 512) if (abs(hits(p->GetActor())) < 512)
{ {
if ((krand() & 255) < 16) if ((krand() & 255) < 16)
S_PlayActorSound(DUKE_SEARCH2, p->i); S_PlayActorSound(DUKE_SEARCH2, pact);
else S_PlayActorSound(DUKE_SEARCH, p->i); else S_PlayActorSound(DUKE_SEARCH, pact);
return; return;
} }
@ -2739,9 +2740,9 @@ void checksectors_r(int snum)
else else
{ {
if (neartagsprite->spriteextra > 3) if (neartagsprite->spriteextra > 3)
S_PlayActorSound(99, p->i); S_PlayActorSound(99, pact);
else else
S_PlayActorSound(419, p->i); S_PlayActorSound(419, pact);
FTA(41, p); FTA(41, p);
} }
} }
@ -2759,9 +2760,9 @@ void checksectors_r(int snum)
else else
{ {
if (neartagsprite->spriteextra > 3) if (neartagsprite->spriteextra > 3)
S_PlayActorSound(99, p->i); S_PlayActorSound(99, pact);
else else
S_PlayActorSound(419, p->i); S_PlayActorSound(419, pact);
FTA(41, p); FTA(41, p);
} }
} }
@ -2832,8 +2833,8 @@ void dofurniture(int wl, int sect, int snum)
var_C = 0; var_C = 0;
if (var_C) if (var_C)
{ {
if (S_CheckActorSoundPlaying(ps[snum].i, 389) == 0) if (S_CheckActorSoundPlaying(ps[snum].GetActor(), 389) == 0)
S_PlayActorSound(389, ps[snum].i); S_PlayActorSound(389, ps[snum].GetActor());
for (i = startwall; i < endwall; i++) for (i = startwall; i < endwall; i++)
{ {
x = wall[i].x; x = wall[i].x;

View file

@ -1168,11 +1168,11 @@ void spriteglass(DDukeActor* actor, int n)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void ceilingglass(int i, int sectnum, int n) void ceilingglass(DDukeActor* actor, int sectnum, int n)
{ {
int j, xv, yv, z, x1, y1; int j, xv, yv, z, x1, y1;
int a, s, startwall, endwall; int a, s, startwall, endwall;
auto sp = &sprite[i]; auto sp = &actor->s;
startwall = sector[sectnum].wallptr; startwall = sector[sectnum].wallptr;
endwall = startwall + sector[sectnum].wallnum; endwall = startwall + sector[sectnum].wallnum;
@ -1191,7 +1191,7 @@ void ceilingglass(int i, int sectnum, int n)
y1 += yv; y1 += yv;
a = krand() & 2047; a = krand() & 2047;
z = sector[sectnum].ceilingz + ((krand() & 15) << 8); z = sector[sectnum].ceilingz + ((krand() & 15) << 8);
EGS(sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, (krand() & 31), 0, i, 5); EGS(sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, (krand() & 31), 0, actor, 5);
} }
} }
} }