diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index f3ee8979a..63218bd20 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1721,7 +1721,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p a = s->ang; s->ang = actor->tempang; if (attacksnd >= 0) S_PlayActorSound(attacksnd, actor); - fi.shoot(actor->GetIndex(), firelaser); + fi.shoot(actor, firelaser); s->ang = a; } if (t[2] > (26 * 3) || !cansee(s->x, s->y, s->z - (16 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum)) @@ -1755,7 +1755,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p else if ((t[2] & 15) == 0 && attacksnd >= 0) { S_PlayActorSound(attacksnd, actor); - fi.shoot(actor->GetIndex(), firelaser); + fi.shoot(actor, firelaser); } } s->ang += getincangle(s->ang, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) >> 2; @@ -2885,7 +2885,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) { j = s->ang; s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy); - fi.shoot(actor->GetIndex(), RPG); + fi.shoot(actor, RPG); s->ang = j; } } @@ -3437,7 +3437,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER) { j = s->ang; s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy); - fi.shoot(actor->GetIndex(), FIRELASER); + fi.shoot(actor, FIRELASER); s->ang = j; } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 41b78ee56..a7cbd08c0 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3775,7 +3775,7 @@ void moveeffectors_d(void) //STATNUM 3 if (act->temp_data[0]) { if (act->temp_data[0] == 1) - fi.shoot(act->GetIndex(), sc->extra); + fi.shoot(act, sc->extra); else if (act->temp_data[0] == 26 * 5) act->temp_data[0] = 0; act->temp_data[0]++; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 16d5fc616..81b034211 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -3656,7 +3656,7 @@ void moveeffectors_r(void) //STATNUM 3 if (t[0]) { if (t[0] == 1) - fi.shoot(act->GetIndex(), sc->extra); + fi.shoot(act, sc->extra); else if (t[0] == 26 * 5) t[0] = 0; t[0]++; diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 9ef693690..9d5b671ef 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -90,8 +90,8 @@ int spawn_d(int j, int pn); int spawn_r(int j, int pn); void incur_damage_d(struct player_struct* p); void incur_damage_r(struct player_struct* p); -void shoot_d(int i, int atwith); -void shoot_r(int i, int atwith); +void shoot_d(DDukeActor* i, int atwith); +void shoot_r(DDukeActor* i, int atwith); void selectweapon_d(int snum, int j); void selectweapon_r(int snum, int j); int doincrements_d(struct player_struct* p); diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index d527a2ddb..499cba76b 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -104,7 +104,7 @@ struct Dispatcher // player void (*incur_damage)(struct player_struct* p); - void (*shoot)(int, int); + void (*shoot)(DDukeActor*, int); void (*selectweapon)(int snum, int j); int (*doincrements)(struct player_struct* p); void (*checkweapons)(struct player_struct* p); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 833453c7d..4460e1da6 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1758,7 +1758,7 @@ int ParseState::parse(void) break; case concmd_shoot: insptr++; - fi.shoot(g_ac->GetIndex(), (short)*insptr); + fi.shoot(g_ac, (short)*insptr); insptr++; break; case concmd_ifsoundid: diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 6ff0d5ce7..3ed725c04 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -993,9 +993,8 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int // //--------------------------------------------------------------------------- -void shoot_d(int i_, int atwith) +void shoot_d(DDukeActor* actor, int atwith) { - auto actor = &hittype[i_]; spritetype* const s = &actor->s; short sect, l, j; @@ -1128,7 +1127,7 @@ void shoot_d(int i_, int atwith) EGS(sect, sx + (sintable[(512 + sa + 512) & 2047] >> 8), sy + (sintable[(sa + 512) & 2047] >> 8), - sz + (6 << 8), atwith, -64, 32, 32, sa, vel, zvel, i, 1); + sz + (6 << 8), atwith, -64, 32, 32, sa, vel, zvel, actor, 1); break; case GROWSPARK: @@ -1136,10 +1135,11 @@ void shoot_d(int i_, int atwith) break; case SHRINKER: + { if (s->extra >= 0) s->shade = -96; if (p >= 0) { - auto aimed = isNamWW2GI()? nullptr : aim(actor, AUTO_AIM_ANGLE); + auto aimed = isNamWW2GI() ? nullptr : aim(actor, AUTO_AIM_ANGLE); if (aimed) { dal = ((aimed->s.xrepeat * tilesiz[aimed->s.picnum].y) << 1); @@ -1156,17 +1156,18 @@ void shoot_d(int i_, int atwith) } else zvel = 0; - j = EGS(sect, + auto j = EGS(sect, sx + (sintable[(512 + sa + 512) & 2047] >> 12), sy + (sintable[(sa + 512) & 2047] >> 12), - sz + (2 << 8), SHRINKSPARK, -16, 28, 28, sa, 768, zvel, i, 4); + sz + (2 << 8), SHRINKSPARK, -16, 28, 28, sa, 768, zvel, actor, 4); - sprite[j].cstat = 128; - sprite[j].clipdist = 32; + j->s.cstat = 128; + j->s.clipdist = 32; return; } + } return; } @@ -1502,7 +1503,7 @@ int doincrements_d(struct player_struct* p) p->last_quick_kick = p->quick_kick + 1; p->quick_kick--; if (p->quick_kick == 8) - fi.shoot(p->i, KNEE); + fi.shoot(p->GetActor(), KNEE); } else if (p->last_quick_kick > 0) p->last_quick_kick--; @@ -2158,8 +2159,8 @@ static void fireweapon(int snum) static void operateweapon(int snum, ESyncBits actions, int psect) { auto p = &ps[snum]; - int pi = p->i; - int i, j, k; + auto pact = p->GetActor(); + int i, k; // already firing... @@ -2187,29 +2188,29 @@ static void operateweapon(int snum, ESyncBits actions, int psect) i = -512 - mulscale16(p->horizon.sum().asq16(), 20); } - j = EGS(p->cursectnum, + auto spawned = EGS(p->cursectnum, p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6), p->posz, HEAVYHBOMB, -16, 9, 9, - p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, pi, 1); + p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, pact, 1); if (isNam()) { - sprite[j].extra = mulscale(krand(), NAM_GRENADE_LIFETIME_VAR, 14); + spawned->s.extra = mulscale(krand(), NAM_GRENADE_LIFETIME_VAR, 14); } if (k == 15) { - sprite[j].yvel = 3; - sprite[j].z += (8 << 8); + spawned->s.yvel = 3; + spawned->s.z += (8 << 8); } - k = hits(p->GetActor()); + k = hits(pact); if (k < 512) { - sprite[j].ang += 1024; - sprite[j].zvel /= 3; - sprite[j].xvel /= 3; + spawned->s.ang += 1024; + spawned->s.zvel /= 3; + spawned->s.xvel /= 3; } p->hbomb_on = 1; @@ -2257,14 +2258,14 @@ static void operateweapon(int snum, ESyncBits actions, int psect) case PISTOL_WEAPON: // m-16 in NAM if (p->kickback_pic == 1) { - fi.shoot(pi, SHOTSPARK1); - S_PlayActorSound(PISTOL_FIRE, pi); + fi.shoot(pact, SHOTSPARK1); + S_PlayActorSound(PISTOL_FIRE, pact); lastvisinc = ud.levelclock + 32; p->visibility = 0; } else if (p->kickback_pic == 2) - fi.spawn(pi, SHELL); + spawn(pact, SHELL); p->kickback_pic++; @@ -2280,14 +2281,14 @@ static void operateweapon(int snum, ESyncBits actions, int psect) switch (p->kickback_pic) { case 5: - S_PlayActorSound(EJECT_CLIP, pi); + S_PlayActorSound(EJECT_CLIP, pact); break; //#ifdef NAM // case WEAPON2_RELOAD_TIME - 15: //#else case 8: //#endif - S_PlayActorSound(INSERT_CLIP, pi); + S_PlayActorSound(INSERT_CLIP, pact); break; } } @@ -2307,16 +2308,11 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic == 4) { - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); + for(int i = 0; i < 7; i++) + fi.shoot(pact, SHOTGUN); p->ammo_amount[SHOTGUN_WEAPON]--; - S_PlayActorSound(SHOTGUN_FIRE, pi); + S_PlayActorSound(SHOTGUN_FIRE, pact); lastvisinc = ud.levelclock + 32; p->visibility = 0; @@ -2329,19 +2325,21 @@ static void operateweapon(int snum, ESyncBits actions, int psect) checkavailweapon(p); break; case 15: - S_PlayActorSound(SHOTGUN_COCK, pi); + S_PlayActorSound(SHOTGUN_COCK, pact); break; case 17: case 20: p->kickback_pic++; break; case 24: - j = fi.spawn(pi, SHOTGUNSHELL); - sprite[j].ang += 1024; + { + auto j = spawn(pact, SHOTGUNSHELL); + j->s.ang += 1024; ssp(j, CLIPMASK0); - sprite[j].ang += 1024; + j->s.ang += 1024; p->kickback_pic++; break; + } case 31: p->okickback_pic = p->kickback_pic = 0; return; @@ -2360,17 +2358,17 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if ((p->kickback_pic % 3) == 0) { - j = fi.spawn(pi, SHELL); + auto j = spawn(pact, SHELL); - sprite[j].ang += 1024; - sprite[j].ang &= 2047; - sprite[j].xvel += 32; - sprite[j].z += (3 << 8); + j->s.ang += 1024; + j->s.ang &= 2047; + j->s.xvel += 32; + j->s.z += (3 << 8); ssp(j, CLIPMASK0); } - S_PlayActorSound(CHAINGUN_FIRE, pi); - fi.shoot(pi, CHAINGUN); + S_PlayActorSound(CHAINGUN_FIRE, pact); + fi.shoot(pact, CHAINGUN); lastvisinc = ud.levelclock + 32; p->visibility = 0; checkavailweapon(p); @@ -2414,7 +2412,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) else p->okickback_pic = p->kickback_pic = 0; p->ammo_amount[p->curr_weapon]--; - fi.shoot(pi, GROWSPARK); + fi.shoot(pact, GROWSPARK); //#ifdef NAM //#else @@ -2449,7 +2447,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) else p->okickback_pic = p->kickback_pic = 0; p->ammo_amount[SHRINKER_WEAPON]--; - fi.shoot(pi, SHRINKER); + fi.shoot(pact, SHRINKER); if (!isNam()) { @@ -2482,7 +2480,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) { p->visibility = 0; lastvisinc = ud.levelclock + 32; - fi.shoot(pi, RPG); + fi.shoot(pact, RPG); p->ammo_amount[DEVISTATOR_WEAPON]--; checkavailweapon(p); } @@ -2492,7 +2490,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) { p->visibility = 0; lastvisinc = ud.levelclock + 32; - fi.shoot(pi, RPG); + fi.shoot(pact, RPG); p->ammo_amount[DEVISTATOR_WEAPON]--; checkavailweapon(p); if (p->ammo_amount[DEVISTATOR_WEAPON] <= 0) p->okickback_pic = p->kickback_pic = 0; @@ -2512,10 +2510,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->visibility = 0; lastvisinc = ud.levelclock + 32; - fi.shoot(pi, FREEZEBLAST); + fi.shoot(pact, FREEZEBLAST); checkavailweapon(p); } - if (p->GetActor()->s.xrepeat < 32) + if (pact->s.xrepeat < 32) { p->okickback_pic = p->kickback_pic = 0; break; } @@ -2525,7 +2523,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (actions & SB_FIRE) { p->okickback_pic = p->kickback_pic = 1; - S_PlayActorSound(CAT_FIRE, pi); + S_PlayActorSound(CAT_FIRE, pact); } else p->okickback_pic = p->kickback_pic = 0; } @@ -2542,7 +2540,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->ammo_amount[FLAMETHROWER_WEAPON]--; if (snum == screenpeek) g_visibility = 0; - fi.shoot(pi, FIREBALL); + fi.shoot(pact, FIREBALL); } checkavailweapon(p); } @@ -2551,7 +2549,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if ((actions & SB_FIRE) != 0) { p->okickback_pic = p->kickback_pic = 1; - S_PlayActorSound(FLAMETHROWER_INTRO, pi); + S_PlayActorSound(FLAMETHROWER_INTRO, pact); } else p->okickback_pic = p->kickback_pic = 0; @@ -2564,7 +2562,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->posz = p->oposz; p->poszv = 0; if (p->kickback_pic == 3) - fi.shoot(pi, HANDHOLDINGLASER); + fi.shoot(pact, HANDHOLDINGLASER); } if (p->kickback_pic == 16) { @@ -2577,7 +2575,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) case KNEE_WEAPON: p->kickback_pic++; - if (p->kickback_pic == 7) fi.shoot(pi, KNEE); + if (p->kickback_pic == 7) fi.shoot(pact, KNEE); else if (p->kickback_pic == 14) { if (actions & SB_FIRE) @@ -2596,7 +2594,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->ammo_amount[RPG_WEAPON]--; lastvisinc = ud.levelclock + 32; p->visibility = 0; - fi.shoot(pi, RPG); + fi.shoot(pact, RPG); checkavailweapon(p); } else if (p->kickback_pic == (cl_dukefixrpgrecoil ? 13 : 20)) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 73beabd02..e6afc2fb5 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -835,13 +835,13 @@ static void shootwhip(int i, int p, int sx, int sy, int sz, int sa, int atwith) // //--------------------------------------------------------------------------- -void shoot_r(int i, int atwith) +void shoot_r(DDukeActor* actor, int atwith) { + spritetype* const s = &actor->s; + short sect, sa, p, j; int sx, sy, sz, vel, zvel, x; - auto actor = &hittype[i]; - spritetype* const s = &actor->s; sect = s->sectnum; zvel = 0; @@ -880,6 +880,7 @@ void shoot_r(int i, int atwith) return; } + int i = actor->GetIndex(); switch (atwith) { case BLOODSPLAT1: @@ -903,19 +904,21 @@ void shoot_r(int i, int atwith) return; case TRIPBOMBSPRITE: - j = fi.spawn(i, atwith); - sprite[j].xvel = 32; - sprite[j].ang = sprite[i].ang; - sprite[j].z -= (5 << 8); + { + auto j = spawn(actor, atwith); + j->s.xvel = 32; + j->s.ang = s->ang; + j->s.z -= (5 << 8); break; - + } case BOWLINGBALL: - j = fi.spawn(i, atwith); - sprite[j].xvel = 250; - sprite[j].ang = sprite[i].ang; - sprite[j].z -= (15 << 8); + { + auto j = spawn(actor, atwith); + j->s.xvel = 250; + j->s.ang = s->ang; + j->s.z -= (15 << 8); break; - + } case OWHIP: case UWHIP: shootwhip(i, p, sx, sy, sz, sa, atwith); @@ -2817,8 +2820,8 @@ static void fireweapon(int snum) static void operateweapon(int snum, ESyncBits actions, int psect) { auto p = &ps[snum]; - int pi = p->i; - int i, j, k; + auto pact = p->GetActor(); + int i, k; int psectlotag = sector[psect].lotag; if (!isRRRA() && p->curr_weapon >= MOTORCYCLE_WEAPON) return; @@ -2876,24 +2879,24 @@ static void operateweapon(int snum, ESyncBits actions, int psect) i = -512 - -mulscale16(p->horizon.sum().asq16(), 20); } - j = EGS(p->cursectnum, + auto spawned = EGS(p->cursectnum, p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6), p->posz, HEAVYHBOMB, -16, 9, 9, - p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pi, 1); + p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pact, 1); if (k == 15) { - sprite[j].yvel = 3; - sprite[j].z += (8 << 8); + spawned->s.yvel = 3; + spawned->s.z += (8 << 8); } k = hits(p->GetActor()); if (k < 512) { - sprite[j].ang += 1024; - sprite[j].zvel /= 3; - sprite[j].xvel /= 3; + spawned->s.ang += 1024; + spawned->s.zvel /= 3; + spawned->s.xvel /= 3; } p->hbomb_on = 1; @@ -2920,8 +2923,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect) case PISTOL_WEAPON: if (p->kickback_pic == 1) { - fi.shoot(pi, SHOTSPARK1); - S_PlayActorSound(PISTOL_FIRE, pi); + fi.shoot(pact, SHOTSPARK1); + S_PlayActorSound(PISTOL_FIRE, pact); p->noise_radius = 8192; madenoise(snum); @@ -2955,10 +2958,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect) switch (p->kickback_pic) { case 24: - S_PlayActorSound(EJECT_CLIP, pi); + S_PlayActorSound(EJECT_CLIP, pact); break; case 30: - S_PlayActorSound(INSERT_CLIP, pi); + S_PlayActorSound(INSERT_CLIP, pact); break; } } @@ -2986,20 +2989,20 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic == 4) { - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); p->ammo_amount[SHOTGUN_WEAPON]--; - S_PlayActorSound(SHOTGUN_FIRE, pi); + S_PlayActorSound(SHOTGUN_FIRE, pact); p->noise_radius = 8192; madenoise(snum); @@ -3012,20 +3015,20 @@ static void operateweapon(int snum, ESyncBits actions, int psect) { if (p->shotgun_state[1]) { - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); - fi.shoot(pi, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); + fi.shoot(pact, SHOTGUN); p->ammo_amount[SHOTGUN_WEAPON]--; - S_PlayActorSound(SHOTGUN_FIRE, pi); + S_PlayActorSound(SHOTGUN_FIRE, pact); if (psectlotag != 857) { @@ -3048,7 +3051,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) checkavailweapon(p); break; case 17: - S_PlayActorSound(SHOTGUN_COCK, pi); + S_PlayActorSound(SHOTGUN_COCK, pact); break; case 28: p->okickback_pic = p->kickback_pic = 0; @@ -3065,7 +3068,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) checkavailweapon(p); break; case 27: - S_PlayActorSound(SHOTGUN_COCK, pi); + S_PlayActorSound(SHOTGUN_COCK, pact); break; case 38: p->okickback_pic = p->kickback_pic = 0; @@ -3102,17 +3105,17 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if ((p->kickback_pic % 3) == 0) { - j = fi.spawn(pi, SHELL); + auto j = spawn(pact, SHELL); - sprite[j].ang += 1024; - sprite[j].ang &= 2047; - sprite[j].xvel += 32; - sprite[j].z += (3 << 8); + j->s.ang += 1024; + j->s.ang &= 2047; + j->s.xvel += 32; + j->s.z += (3 << 8); ssp(j, CLIPMASK0); } - S_PlayActorSound(CHAINGUN_FIRE, pi); - fi.shoot(pi, CHAINGUN); + S_PlayActorSound(CHAINGUN_FIRE, pact); + fi.shoot(pact, CHAINGUN); p->noise_radius = 8192; madenoise(snum); lastvisinc = ud.levelclock + 32; @@ -3145,7 +3148,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic > 3) { p->okickback_pic = p->kickback_pic = 0; - fi.shoot(pi, GROWSPARK); + fi.shoot(pact, GROWSPARK); p->noise_radius = 1024; madenoise(snum); checkavailweapon(p); @@ -3158,7 +3161,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic == 1) { p->ammo_amount[THROWSAW_WEAPON]--; - fi.shoot(pi, SHRINKSPARK); + fi.shoot(pact, SHRINKSPARK); checkavailweapon(p); } p->kickback_pic++; @@ -3172,8 +3175,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect) { p->visibility = 0; lastvisinc = ud.levelclock + 32; - S_PlayActorSound(CHAINGUN_FIRE, pi); - fi.shoot(pi, SHOTSPARK1); + S_PlayActorSound(CHAINGUN_FIRE, pact); + fi.shoot(pact, SHOTSPARK1); p->noise_radius = 16384; madenoise(snum); p->ammo_amount[TIT_WEAPON]--; @@ -3199,8 +3202,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect) { p->visibility = 0; lastvisinc = ud.levelclock + 32; - S_PlayActorSound(CHAINGUN_FIRE, pi); - fi.shoot(pi, CHAINGUN); + S_PlayActorSound(CHAINGUN_FIRE, pact); + fi.shoot(pact, CHAINGUN); p->noise_radius = 16384; madenoise(snum); p->ammo_amount[MOTORCYCLE_WEAPON]--; @@ -3227,7 +3230,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) { p->MotoSpeed -= 20; p->ammo_amount[BOAT_WEAPON]--; - fi.shoot(pi, RRTILE1790); + fi.shoot(pact, RRTILE1790); } p->kickback_pic++; if (p->kickback_pic > 20) @@ -3244,11 +3247,11 @@ static void operateweapon(int snum, ESyncBits actions, int psect) case ALIENBLASTER_WEAPON: p->kickback_pic++; if (p->kickback_pic >= 7 && p->kickback_pic <= 11) - fi.shoot(pi, FIRELASER); + fi.shoot(pact, FIRELASER); if (p->kickback_pic == 5) { - S_PlayActorSound(CAT_FIRE, pi); + S_PlayActorSound(CAT_FIRE, pact); p->noise_radius = 2048; madenoise(snum); } @@ -3286,11 +3289,11 @@ static void operateweapon(int snum, ESyncBits actions, int psect) i = -512 - mulscale16(p->horizon.sum().asq16(), 20); } - j = EGS(p->cursectnum, + EGS(p->cursectnum, p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6), p->posz, TRIPBOMBSPRITE, -16, 9, 9, - p->angle.ang.asbuild(), k * 2, i, pi, 1); + p->angle.ang.asbuild(), k * 2, i, pact, 1); } p->kickback_pic++; if (p->kickback_pic > 20) @@ -3304,8 +3307,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic == 30) { p->ammo_amount[BOWLING_WEAPON]--; - S_PlayActorSound(354, pi); - fi.shoot(pi, BOWLINGBALL); + S_PlayActorSound(354, pact); + fi.shoot(pact, BOWLINGBALL); p->noise_radius = 1024; madenoise(snum); } @@ -3326,10 +3329,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect) case KNEE_WEAPON: p->kickback_pic++; if (p->kickback_pic == 3) - S_PlayActorSound(426, pi); + S_PlayActorSound(426, pact); if (p->kickback_pic == 12) { - fi.shoot(pi, KNEE); + fi.shoot(pact, KNEE); p->noise_radius = 1024; madenoise(snum); } @@ -3344,10 +3347,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect) case SLINGBLADE_WEAPON: p->kickback_pic++; if (p->kickback_pic == 3) - S_PlayActorSound(252, pi); + S_PlayActorSound(252, pact); if (p->kickback_pic == 8) { - fi.shoot(pi, SLINGBLADE); + fi.shoot(pact, SLINGBLADE); p->noise_radius = 1024; madenoise(snum); } @@ -3367,13 +3370,13 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->ammo_amount[DYNAMITE_WEAPON]--; lastvisinc = ud.levelclock + 32; p->visibility = 0; - fi.shoot(pi, RPG); + fi.shoot(pact, RPG); p->noise_radius = 32768; madenoise(snum); checkavailweapon(p); } else if (p->kickback_pic == 16) - S_PlayActorSound(450, pi); + S_PlayActorSound(450, pact); else if (p->kickback_pic == 34) p->okickback_pic = p->kickback_pic = 0; break; @@ -3385,13 +3388,13 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->ammo_amount[CHICKEN_WEAPON]--; lastvisinc = ud.levelclock + 32; p->visibility = 0; - fi.shoot(pi, RPG2); + fi.shoot(pact, RPG2); p->noise_radius = 32768; madenoise(snum); checkavailweapon(p); } else if (p->kickback_pic == 16) - S_PlayActorSound(450, pi); + S_PlayActorSound(450, pact); else if (p->kickback_pic == 34) p->okickback_pic = p->kickback_pic = 0; break; diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index f2dbaadb1..7299cd82c 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -65,10 +65,10 @@ void DoFire(struct player_struct *p, short snum) SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum); SetGameVarID(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->GetActor(), snum); - fi.shoot(p->i,aplWeaponShoots[p->curr_weapon][snum]); + fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]); for(i=1;icurr_weapon][snum];i++) { - fi.shoot(p->i,aplWeaponShoots[p->curr_weapon][snum]); + fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]); if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AMMOPERSHOT) { p->ammo_amount[p->curr_weapon]--; @@ -406,7 +406,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect) } SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum); SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], p->GetActor(), snum); - fi.shoot(pi, aplWeaponShoots[p->curr_weapon][snum]); + fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]); } } diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index bacc68d57..0a918a3b7 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1208,7 +1208,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) case FETUSBROKE: for (j = 0; j < 48; j++) { - fi.shoot(targ->GetIndex(), BLOODSPLAT1); + fi.shoot(targ, BLOODSPLAT1); s->ang += 333; } S_PlayActorSound(GLASS_HEAVYBREAK, targ); @@ -1326,23 +1326,22 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) { s->extra -= pspr->extra; if (s->extra > 0) break; - int i = targ->GetIndex(); s->ang = krand() & 2047; - fi.shoot(i, BLOODSPLAT1); + fi.shoot(targ, BLOODSPLAT1); s->ang = krand() & 2047; - fi.shoot(i, BLOODSPLAT2); + fi.shoot(targ, BLOODSPLAT2); s->ang = krand() & 2047; - fi.shoot(i, BLOODSPLAT3); + fi.shoot(targ, BLOODSPLAT3); s->ang = krand() & 2047; - fi.shoot(i, BLOODSPLAT4); + fi.shoot(targ, BLOODSPLAT4); s->ang = krand() & 2047; - fi.shoot(i, BLOODSPLAT1); + fi.shoot(targ, BLOODSPLAT1); s->ang = krand() & 2047; - fi.shoot(i, BLOODSPLAT2); + fi.shoot(targ, BLOODSPLAT2); s->ang = krand() & 2047; - fi.shoot(i, BLOODSPLAT3); + fi.shoot(targ, BLOODSPLAT3); s->ang = krand() & 2047; - fi.shoot(i, BLOODSPLAT4); + fi.shoot(targ, BLOODSPLAT4); fi.guts(targ, JIBS1, 1, myconnectindex); fi.guts(targ, JIBS2, 2, myconnectindex); fi.guts(targ, JIBS3, 3, myconnectindex); @@ -1407,11 +1406,10 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) if (j >= 0 && sprite[j].picnum == APLAYER && s->picnum != ROTATEGUN && s->picnum != DRONE) if (ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON) { - int i = targ->GetIndex(); - fi.shoot(i, BLOODSPLAT3); - fi.shoot(i, BLOODSPLAT1); - fi.shoot(i, BLOODSPLAT2); - fi.shoot(i, BLOODSPLAT4); + fi.shoot(targ, BLOODSPLAT3); + fi.shoot(targ, BLOODSPLAT1); + fi.shoot(targ, BLOODSPLAT2); + fi.shoot(targ, BLOODSPLAT4); } if (s->picnum != TANK && !bossguy(targ) && s->picnum != RECON && s->picnum != ROTATEGUN) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 348a17792..3da8c3bf3 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2368,11 +2368,10 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) if (j >= 0 && sprite[j].picnum == APLAYER && s->picnum != DRONE) if (ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON) { - int i = targ->GetIndex(); - fi.shoot(i, BLOODSPLAT3); - fi.shoot(i, BLOODSPLAT1); - fi.shoot(i, BLOODSPLAT2); - fi.shoot(i, BLOODSPLAT4); + fi.shoot(targ, BLOODSPLAT3); + fi.shoot(targ, BLOODSPLAT1); + fi.shoot(targ, BLOODSPLAT2); + fi.shoot(targ, BLOODSPLAT4); } if (s->statnum == 2)