From fd3e63b43c7a43051dff5d550c413954488ccfa8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Nov 2021 12:00:45 +0100 Subject: [PATCH] - yet again3 spawns in shootgun --- source/games/whaven/src/weapons.cpp | 117 ++++++++++++++-------------- 1 file changed, 60 insertions(+), 57 deletions(-) diff --git a/source/games/whaven/src/weapons.cpp b/source/games/whaven/src/weapons.cpp index 95e76db57..1a901f009 100644 --- a/source/games/whaven/src/weapons.cpp +++ b/source/games/whaven/src/weapons.cpp @@ -2034,76 +2034,79 @@ void shootgun(PLAYER& plr, float ang, int guntype) { if (plr.weapon[plr.currweapon] == 3) { j = insertsprite(plr.sector, MISSILE); + auto& spawned = sprite[j]; throwpikesprite[throwpikecnt] = j; - sprite[j].x = plr.x; - sprite[j].y = plr.y; - sprite[j].z = plr.z + (24 << 8); - sprite[j].cstat = 21; - sprite[j].picnum = THROWPIKE; - sprite[j].ang = (short) daang; + spawned.x = plr.x; + spawned.y = plr.y; + spawned.z = plr.z + (24 << 8); + spawned.cstat = 21; + spawned.picnum = THROWPIKE; + spawned.ang = (short) daang; - sprite[j].xrepeat = 24; - sprite[j].yrepeat = 24; - sprite[j].clipdist = 32; - sprite[j].extra = (short) daang; + spawned.xrepeat = 24; + spawned.yrepeat = 24; + spawned.clipdist = 32; + spawned.extra = (short) daang; - sprite[j].shade = -15; - sprite[j].xvel = (short) ((krand() & 256) - 128); - sprite[j].yvel = (short) ((krand() & 256) - 128); - sprite[j].zvel = plr.horizon.horiz.asq16() >> 12; - sprite[j].owner = sprite[plr.spritenum].owner; - sprite[j].lotag = 1024; - sprite[j].hitag = 0; - sprite[j].pal = 0; - movesprite((short) j, (bcos(sprite[j].extra) * TICSPERFRAME) << 3, - (bsin(sprite[j].extra) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0); - setsprite((short) j, sprite[j].x, sprite[j].y, sprite[j].z); + spawned.shade = -15; + spawned.xvel = (short) ((krand() & 256) - 128); + spawned.yvel = (short) ((krand() & 256) - 128); + spawned.zvel = plr.horizon.horiz.asq16() >> 12; + spawned.owner = sprite[plr.spritenum].owner; + spawned.lotag = 1024; + spawned.hitag = 0; + spawned.pal = 0; + movesprite((short) j, (bcos(spawned.extra) * TICSPERFRAME) << 3, + (bsin(spawned.extra) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0); + setsprite((short) j, spawned.x, spawned.y, spawned.z); } else { j = insertsprite(plr.sector, MISSILE); + auto& spawned = sprite[j]; throwpikesprite[throwpikecnt] = j; - sprite[j].x = plr.x; - sprite[j].y = plr.y; - sprite[j].z = plr.z + (24 << 8); - sprite[j].cstat = 21; - sprite[j].picnum = THROWPIKE; - sprite[j].ang = ((plr.angle.ang.asbuild() + 2048 + 96) - 512) & 2047; - sprite[j].xrepeat = 24; - sprite[j].yrepeat = 24; - sprite[j].clipdist = 32; - sprite[j].extra = plr.angle.ang.asbuild(); - sprite[j].shade = -15; - sprite[j].xvel = (short) ((krand() & 256) - 128); - sprite[j].yvel = (short) ((krand() & 256) - 128); - sprite[j].zvel = plr.horizon.horiz.asq16() >> 12; - sprite[j].owner = sprite[plr.spritenum].owner; - sprite[j].lotag = 1024; - sprite[j].hitag = 0; - sprite[j].pal = 0; + spawned.x = plr.x; + spawned.y = plr.y; + spawned.z = plr.z + (24 << 8); + spawned.cstat = 21; + spawned.picnum = THROWPIKE; + spawned.ang = ((plr.angle.ang.asbuild() + 2048 + 96) - 512) & 2047; + spawned.xrepeat = 24; + spawned.yrepeat = 24; + spawned.clipdist = 32; + spawned.extra = plr.angle.ang.asbuild(); + spawned.shade = -15; + spawned.xvel = (short) ((krand() & 256) - 128); + spawned.yvel = (short) ((krand() & 256) - 128); + spawned.zvel = plr.horizon.horiz.asq16() >> 12; + spawned.owner = sprite[plr.spritenum].owner; + spawned.lotag = 1024; + spawned.hitag = 0; + spawned.pal = 0; } } else { j = insertsprite(plr.sector, MISSILE); + auto& spawned = sprite[j]; - sprite[j].x = plr.x; - sprite[j].y = plr.y; - sprite[j].z = plr.z; + spawned.x = plr.x; + spawned.y = plr.y; + spawned.z = plr.z; - sprite[j].cstat = 21; + spawned.cstat = 21; - sprite[j].picnum = THROWPIKE; - sprite[j].ang = BClampAngle(plr.angle.ang.asbuild() - 512); - sprite[j].xrepeat = 24; - sprite[j].yrepeat = 24; - sprite[j].clipdist = 24; + spawned.picnum = THROWPIKE; + spawned.ang = BClampAngle(plr.angle.ang.asbuild() - 512); + spawned.xrepeat = 24; + spawned.yrepeat = 24; + spawned.clipdist = 24; - sprite[j].extra = plr.angle.ang.asbuild(); - sprite[j].shade = -15; - sprite[j].xvel = (short) ((krand() & 256) - 128); - sprite[j].yvel = (short) ((krand() & 256) - 128); - sprite[j].zvel = (short) ((krand() & 256) - 128); - sprite[j].owner = sprite[plr.spritenum].owner; - sprite[j].lotag = 1024; - sprite[j].hitag = 0; - sprite[j].pal = 0; + spawned.extra = plr.angle.ang.asbuild(); + spawned.shade = -15; + spawned.xvel = (short) ((krand() & 256) - 128); + spawned.yvel = (short) ((krand() & 256) - 128); + spawned.zvel = (short) ((krand() & 256) - 128); + spawned.owner = sprite[plr.spritenum].owner; + spawned.lotag = 1024; + spawned.hitag = 0; + spawned.pal = 0; } }