From 0b1d786f358d9a4f35cc6c918730e0cf1e2673f0 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 30 Mar 2015 05:57:11 +0000 Subject: [PATCH] Move handling of ud.drawweapon from G_DrawWeaponTileWithID() to P_DisplayWeapon(). This fixes it not being applied to the quick kick and mighty foot. git-svn-id: https://svn.eduke32.com/eduke32@5117 1a8010ca-5511-0410-912e-c29ae57300e0 --- .../package/sdk/samples/weapons.con.sample | 7 +-- polymer/eduke32/source/player.c | 58 +++++++++---------- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/polymer/eduke32/package/sdk/samples/weapons.con.sample b/polymer/eduke32/package/sdk/samples/weapons.con.sample index b17bfc5ec..7aac9d6cf 100644 --- a/polymer/eduke32/package/sdk/samples/weapons.con.sample +++ b/polymer/eduke32/package/sdk/samples/weapons.con.sample @@ -1606,14 +1606,11 @@ onevent EVENT_DISPLAYWEAPON // P_DisplayWeapon case SHOTGUN_WEAPON setvar hud_tilenum SHOTGUNSPRITE break + case KNEE_WEAPON + break default addlogvar currentweapon break - /* - case KNEE_WEAPON - setvar hud_tilenum -1 - break - */ endswitch ifvarn hud_tilenum -1 diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index d2754262a..82801e1b2 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -1827,37 +1827,20 @@ static void G_DrawWeaponTile(int32_t x, int32_t y, int32_t tilenum, int32_t shad palf[slot] = p; - switch (ud.drawweapon) - { - case 1: #ifdef USE_OPENGL - if (getrendermode() >= REND_POLYMOST) - if (tilenum >= CHAINGUN + 1 && tilenum <= CHAINGUN + 4) - if (!usemodels || md_tilehasmodel(tilenum, p) < 0) - { - // HACK: Draw the upper part of the chaingun two screen - // pixels (not texels; multiplied by weapon scale) lower - // first, preventing ugly horizontal seam. - g_dts_yadd = tabledivide32_noinline(65536 * 2 * 200, ydim); - G_DrawTileScaled(x, y, tilenum, shadef[slot], orientation, p); - g_dts_yadd = 0; - } + if (getrendermode() >= REND_POLYMOST) + if (tilenum >= CHAINGUN + 1 && tilenum <= CHAINGUN + 4) + if (!usemodels || md_tilehasmodel(tilenum, p) < 0) + { + // HACK: Draw the upper part of the chaingun two screen + // pixels (not texels; multiplied by weapon scale) lower + // first, preventing ugly horizontal seam. + g_dts_yadd = tabledivide32_noinline(65536 * 2 * 200, ydim); + G_DrawTileScaled(x, y, tilenum, shadef[slot], orientation, p); + g_dts_yadd = 0; + } #endif - G_DrawTileScaled(x, y, tilenum, shadef[slot], orientation, p); - return; - - case 2: - { - const DukePlayer_t *const ps = g_player[screenpeek].ps; - const int32_t sc = scale(65536, ud.statusbarscale, 100); - - if ((unsigned)hudweap.cur < MAX_WEAPONS && hudweap.cur != KNEE_WEAPON) - rotatesprite_win(160 << 16, (180 + (ps->weapon_pos * ps->weapon_pos)) << 16, sc, 0, - hudweap.cur == GROW_WEAPON ? GROWSPRITEICON : WeaponPickupSprites[hudweap.cur], 0, - 0, 2); - return; - } - } + G_DrawTileScaled(x, y, tilenum, shadef[slot], orientation, p); } static inline void G_DrawWeaponTileWithID(int32_t id, int32_t x, int32_t y, int32_t tilenum, int32_t shade, @@ -2160,7 +2143,7 @@ void P_DisplayWeapon(void) if (VM_OnEvent(EVENT_DISPLAYWEAPON, p->i, screenpeek) == 0) { j = 14-p->quick_kick; - if (j != 14 || p->last_quick_kick) + if ((j != 14 || p->last_quick_kick) && ud.drawweapon == 1) { pal = P_GetHudPal(p); if (pal == 0) @@ -2198,6 +2181,20 @@ void P_DisplayWeapon(void) } else { + switch (ud.drawweapon) + { + case 1: + break; + + case 2: + if ((unsigned)hudweap.cur < MAX_WEAPONS && hudweap.cur != KNEE_WEAPON) + rotatesprite_win(160 << 16, (180 + (p->weapon_pos * p->weapon_pos)) << 16, scale(65536, ud.statusbarscale, 100), 0, + hudweap.cur == GROW_WEAPON ? GROWSPRITEICON : WeaponPickupSprites[hudweap.cur], 0, + 0, 2); + default: + goto enddisplayweapon; + } + const int doanim = !(sprite[p->i].pal == 1 || ud.pause_on || g_player[myconnectindex].ps->gm&MODE_MENU); const int hla = p->look_ang >> 1; @@ -2567,6 +2564,7 @@ void P_DisplayWeapon(void) } } +enddisplayweapon: P_DisplaySpit(); }