2020-05-19 22:35:52 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
2020-06-28 07:03:31 +00:00
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
aint with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
|
|
|
|
EDuke enhancements integrated: 04/13/2003 - Matt Saettler
|
|
|
|
|
|
|
|
Note: EDuke source was in transition. Changes are in-progress in the
|
|
|
|
source as it is released.
|
|
|
|
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
#include "global.h"
|
2020-07-03 21:56:14 +00:00
|
|
|
#include "names_d.h"
|
2020-10-23 18:42:20 +00:00
|
|
|
#include "dukeactor.h"
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-04-15 03:35:42 +00:00
|
|
|
inline static double getavel(int snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-04-15 06:34:24 +00:00
|
|
|
return PlayerInputAngVel(snum) * (2048. / 360.);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-07-16 11:23:26 +00:00
|
|
|
inline static void hud_drawpal(double x, double y, int tilenum, int shade, int orientation, int p)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-07-25 07:02:47 +00:00
|
|
|
hud_drawsprite(x, y, 65536, 0, tilenum, shade, p, 2 | orientation);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
void displayloogie(player_struct* p)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-05-12 15:33:33 +00:00
|
|
|
double a, y;
|
|
|
|
int z;
|
2020-08-02 04:09:54 +00:00
|
|
|
double x;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
if (p->loogcnt == 0) return;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
y = (p->loogcnt << 2);
|
2021-05-12 15:33:33 +00:00
|
|
|
for (int i = 0; i < p->numloogs; i++)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-05-12 15:33:33 +00:00
|
|
|
a = fabs(bsinf((p->loogcnt + i) << 5, -5));
|
2021-04-15 06:34:24 +00:00
|
|
|
z = 4096 + ((p->loogcnt + i) << 9);
|
2021-08-30 06:08:33 +00:00
|
|
|
x = -getavel(p->GetPlayerNum()) + bsinf((p->loogcnt + i) << 6, -10);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-12-30 11:45:53 +00:00
|
|
|
hud_drawsprite((p->loogie[i].X + x), (200 + p->loogiey[i] - y), z - (i << 8), 256 - a, LOOGIE, 0, 0, 2);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
int animatefist(int gs, player_struct* p, double look_anghalf, double looking_arc, double plravel, int fistpal)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-11-13 10:15:09 +00:00
|
|
|
int fisti = min(p->fist_incs, short(32));
|
2020-05-19 22:35:52 +00:00
|
|
|
if (fisti <= 0) return 0;
|
|
|
|
|
2020-07-06 13:52:09 +00:00
|
|
|
hud_drawsprite(
|
2021-04-15 03:35:42 +00:00
|
|
|
(-fisti + 222 + plravel),
|
2021-11-13 10:15:09 +00:00
|
|
|
(looking_arc + 194 + bsinf((6 + fisti) << 7, -9)),
|
|
|
|
clamp(65536. - bcosf(fisti << 6, 2), 40920., 90612.), 0, FIST, gs, fistpal, 2);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
int animateknee(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->spr.extra <= 0) return 0;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-11-07 12:30:32 +00:00
|
|
|
static const int8_t knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 };
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
looking_arc += knee_y[p->knee_incs];
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
hud_drawpal(105 + plravel - look_anghalf + (knee_y[p->knee_incs] >> 2), looking_arc + 280 - horiz16th, KNEE, gs, 4, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
int animateknuckles(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (isWW2GI() || p->over_shoulder_on != 0 || p->knuckle_incs == 0 || p->GetActor()->spr.extra <= 0) return 0;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-11-07 12:30:32 +00:00
|
|
|
static const uint8_t knuckle_frames[] = { 0,1,2,2,3,3,3,2,2,1,0 };
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
hud_drawpal(160 + plravel - look_anghalf, looking_arc + 180 - horiz16th, CRACKKNUCKLES + knuckle_frames[p->knuckle_incs >> 1], gs, 4, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-04-15 05:49:36 +00:00
|
|
|
void displaymasks_d(int snum, int p, double)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
if (ps[snum].scuba_on)
|
|
|
|
{
|
2020-11-23 07:39:49 +00:00
|
|
|
int y = 200 - tileHeight(SCUBAMASK);
|
|
|
|
hud_drawsprite(44, y, 65536, 0, SCUBAMASK, 0, p, 2 + 16);
|
|
|
|
hud_drawsprite((320 - 43), y, 65536, 0, SCUBAMASK, 0, p, 2 + 4 + 16);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
static int animatetip(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-04-15 06:34:24 +00:00
|
|
|
if (p->tipincs == 0) return 0;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-11-07 12:30:32 +00:00
|
|
|
static const int8_t tip_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16 };
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-04-15 03:35:42 +00:00
|
|
|
hud_drawpal(170 + plravel - look_anghalf,
|
2021-04-15 06:34:24 +00:00
|
|
|
(tip_y[p->tipincs] >> 1) + looking_arc + 240 - horiz16th, TIP + ((26 - p->tipincs) >> 4), gs, 0, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-04-23 17:36:55 +00:00
|
|
|
int animateaccess(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if(p->access_incs == 0 || p->GetActor()->spr.extra <= 0) return 0;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-11-07 12:30:32 +00:00
|
|
|
static const int8_t access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16};
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
looking_arc += access_y[p->access_incs];
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-04-23 17:36:55 +00:00
|
|
|
int pal;
|
|
|
|
if (p->access_spritenum != nullptr)
|
2021-12-21 17:19:45 +00:00
|
|
|
pal = p->access_spritenum->spr.pal;
|
2021-04-23 17:36:55 +00:00
|
|
|
else pal = 0;
|
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
if((p->access_incs-3) > 0 && (p->access_incs-3)>>3)
|
|
|
|
hud_drawpal(170 + plravel - look_anghalf + (access_y[p->access_incs] >> 2), looking_arc + 266 - horiz16th, HANDHOLDINGLASER + (p->access_incs >> 3), gs, 0, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
else
|
2021-04-15 06:34:24 +00:00
|
|
|
hud_drawpal(170 + plravel - look_anghalf + (access_y[p->access_incs] >> 2), looking_arc + 266 - horiz16th, HANDHOLDINGACCESS, gs, 4, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-02 03:43:45 +00:00
|
|
|
void displayweapon_d(int snum, double smoothratio)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-08-02 04:51:53 +00:00
|
|
|
int cw;
|
2020-08-02 04:54:17 +00:00
|
|
|
int i, j;
|
2021-04-15 05:49:36 +00:00
|
|
|
int o, pal;
|
2021-04-15 03:35:42 +00:00
|
|
|
double weapon_sway, weapon_xoffset, gun_pos, looking_arc, kickback_pic, random_club_frame, hard_landing, look_anghalf, horiz16th, plravel;
|
2021-11-07 11:43:00 +00:00
|
|
|
int8_t shade;
|
2020-05-19 22:35:52 +00:00
|
|
|
struct player_struct *p;
|
|
|
|
|
|
|
|
p = &ps[snum];
|
|
|
|
auto kb = &p->kickback_pic;
|
|
|
|
int pin = 0;
|
|
|
|
|
|
|
|
o = 0;
|
|
|
|
|
2021-04-15 03:35:42 +00:00
|
|
|
if (cl_hudinterpolation)
|
|
|
|
{
|
|
|
|
weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio);
|
|
|
|
kickback_pic = interpolatedvaluef(p->okickback_pic, p->kickback_pic, smoothratio);
|
|
|
|
random_club_frame = interpolatedvaluef(p->orandom_club_frame, p->random_club_frame, smoothratio);
|
|
|
|
hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio);
|
|
|
|
gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
weapon_sway = p->weapon_sway;
|
|
|
|
kickback_pic = p->kickback_pic;
|
|
|
|
random_club_frame = p->random_club_frame;
|
|
|
|
hard_landing = p->hard_landing;
|
|
|
|
gun_pos = 80 - (p->weapon_pos * p->weapon_pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
plravel = getavel(snum) * (1. / 16.);
|
2021-04-20 11:12:17 +00:00
|
|
|
horiz16th = p->horizon.horizsumfrac(smoothratio);
|
|
|
|
look_anghalf = p->angle.look_anghalf(smoothratio);
|
|
|
|
looking_arc = p->angle.looking_arc(smoothratio);
|
2021-04-15 03:35:42 +00:00
|
|
|
hard_landing *= 8.;
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
gun_pos -= fabs(p->GetActor()->spr.xrepeat < 32 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10));
|
2021-04-15 03:35:42 +00:00
|
|
|
gun_pos -= hard_landing;
|
|
|
|
|
|
|
|
weapon_xoffset = (160)-90;
|
|
|
|
weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.);
|
|
|
|
weapon_xoffset -= 58 + p->weapon_ang;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
shade = p->GetActor()->spr.shade;
|
2020-11-29 13:05:53 +00:00
|
|
|
if(shade > 24) shade = 24;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
pal = !p->insector() ? 0 : p->GetActor()->spr.pal == 1 ? 1 : p->cursector->floorpal;
|
2021-04-15 05:49:36 +00:00
|
|
|
if (pal == 0)
|
|
|
|
pal = p->palookup;
|
|
|
|
|
2021-04-15 03:35:42 +00:00
|
|
|
auto adjusted_arc = looking_arc - hard_landing;
|
2021-12-21 17:19:45 +00:00
|
|
|
bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->spr.pal != 1 && p->GetActor()->spr.extra <= 0);
|
2021-04-15 06:34:24 +00:00
|
|
|
bool playerAnims = animatefist(shade, p, look_anghalf, looking_arc, plravel, pal) || animateknuckles(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal) ||
|
2021-04-23 17:36:55 +00:00
|
|
|
animatetip(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal) || animateaccess(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel);
|
2020-08-03 07:06:28 +00:00
|
|
|
|
|
|
|
if(playerVars || playerAnims)
|
2020-05-19 22:35:52 +00:00
|
|
|
return;
|
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
animateknee(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
if (isWW2GI())
|
|
|
|
{
|
|
|
|
if (p->last_weapon >= 0)
|
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
cw = aplWeaponWorksLike(p->last_weapon, snum);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
cw = aplWeaponWorksLike(p->curr_weapon, snum);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p->last_weapon >= 0)
|
|
|
|
cw = p->last_weapon;
|
|
|
|
else cw = p->curr_weapon;
|
|
|
|
}
|
|
|
|
|
|
|
|
// onevent should go here..
|
|
|
|
|
|
|
|
// rest of code should be moved to CON..
|
|
|
|
|
|
|
|
j = 14-p->quick_kick;
|
2020-07-26 08:18:55 +00:00
|
|
|
if (j != 14 || p->last_quick_kick)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
if (j < 5 || j > 9)
|
2020-07-26 08:18:55 +00:00
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 80 - look_anghalf, looking_arc + 250 - gun_pos, KNEE, shade, o | 4, pal);
|
2020-07-26 08:18:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 160 - 16 - look_anghalf, looking_arc + 214 - gun_pos, KNEE + 1, shade, o | 4, pal);
|
2020-07-26 08:18:55 +00:00
|
|
|
}
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->GetActor()->spr.xrepeat < 40)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
static int fistsign;
|
|
|
|
//shrunken..
|
|
|
|
if (p->jetpack_on == 0)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
i = p->GetActor()->spr.xvel;
|
2020-05-19 22:35:52 +00:00
|
|
|
looking_arc += 32 - (i >> 1);
|
|
|
|
fistsign += i >> 1;
|
|
|
|
}
|
2021-05-12 15:33:33 +00:00
|
|
|
double owo = weapon_xoffset;
|
2020-11-22 10:29:58 +00:00
|
|
|
weapon_xoffset += bsinf(fistsign, -10);
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_draw(weapon_xoffset + 250 - look_anghalf,
|
2020-11-22 10:29:58 +00:00
|
|
|
looking_arc + 258 - fabs(bsinf(fistsign, -8)),
|
2020-11-29 13:05:53 +00:00
|
|
|
FIST, shade, o);
|
2021-05-12 15:33:33 +00:00
|
|
|
weapon_xoffset = owo;
|
2020-11-22 10:29:58 +00:00
|
|
|
weapon_xoffset -= bsinf(fistsign, -10);
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_draw(weapon_xoffset + 40 - look_anghalf,
|
2020-11-22 10:29:58 +00:00
|
|
|
looking_arc + 200 + fabs(bsinf(fistsign, -8)),
|
2020-11-29 13:05:53 +00:00
|
|
|
FIST, shade, o | 4);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displayknee = [&]()
|
|
|
|
{
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb > 0)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb < 5 || *kb > 9)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 220 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 250 - gun_pos, KNEE, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 160 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 214 - gun_pos, KNEE + 1, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displaytripbomb = [&]()
|
|
|
|
{
|
|
|
|
weapon_xoffset += 8;
|
|
|
|
gun_pos -= 10;
|
|
|
|
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb > 6)
|
|
|
|
looking_arc += kickback_pic * 8.;
|
|
|
|
else if (*kb < 4)
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 142 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 234 - gun_pos, HANDHOLDINGLASER + 3, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 130 - look_anghalf,
|
2020-05-19 22:35:52 +00:00
|
|
|
looking_arc + 249 - gun_pos,
|
2020-11-29 13:05:53 +00:00
|
|
|
HANDHOLDINGLASER + (*kb >> 2), shade, o, pal);
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 152 - look_anghalf,
|
2020-05-19 22:35:52 +00:00
|
|
|
looking_arc + 249 - gun_pos,
|
2020-11-29 13:05:53 +00:00
|
|
|
HANDHOLDINGLASER + (*kb >> 2), shade, o | 4, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displayrpg = [&]()
|
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
pin = ((gs.displayflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R;
|
|
|
|
auto rpgpic = RPGGUN;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2020-11-22 10:29:58 +00:00
|
|
|
weapon_xoffset -= bsinf(768 + (kickback_pic * 128.), -11);
|
|
|
|
gun_pos += bsinf(768 + (kickback_pic * 128.), -11);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
if (*kb > 0)
|
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
if (*kb < (isWW2GI() ? aplWeaponTotalTime(RPG_WEAPON, snum) : 8))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-08-02 04:51:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 164, (looking_arc * 2.) + 176 - gun_pos,
|
2020-11-29 13:05:53 +00:00
|
|
|
RPGGUN + (*kb >> 1), shade, o | pin, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else if (isWW2GI())
|
|
|
|
{
|
|
|
|
// else we are in 'reload time'
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(
|
2021-12-05 12:43:31 +00:00
|
|
|
(aplWeaponReload(p->curr_weapon, snum) - aplWeaponTotalTime(p->curr_weapon, snum)) / 2
|
|
|
|
+ aplWeaponTotalTime(p->curr_weapon, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// down
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (kickback_pic - aplWeaponTotalTime(p->curr_weapon, snum)); //D
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// move back down
|
|
|
|
|
|
|
|
// up and left
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (aplWeaponReload(p->curr_weapon, snum) - kickback_pic); //U
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 164, (looking_arc * 2.) + 176 - gun_pos, rpgpic, shade, o | pin, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displayshotgun_ww = [&]()
|
|
|
|
{
|
|
|
|
if (*kb > 0)
|
|
|
|
{
|
2020-11-22 10:29:58 +00:00
|
|
|
gun_pos -= bsinf(kickback_pic * 128., -12);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (*kb > 0 && p->GetActor()->spr.pal != 1)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
weapon_xoffset += 1 - (rand() & 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
weapon_xoffset -= 8;
|
|
|
|
|
|
|
|
if (*kb == 0)
|
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 146 - look_anghalf, looking_arc + 202 - gun_pos, SHOTGUN, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2021-12-05 12:43:31 +00:00
|
|
|
else if (*kb <= aplWeaponTotalTime(SHOTGUN_WEAPON, snum))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 146 - look_anghalf, looking_arc + 202 - gun_pos, SHOTGUN + 1, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
// else we are in 'reload time'
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(
|
2021-12-05 12:43:31 +00:00
|
|
|
(aplWeaponReload(p->curr_weapon, snum) - aplWeaponTotalTime(p->curr_weapon, snum)) / 2
|
|
|
|
+ aplWeaponTotalTime(p->curr_weapon, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// down
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (kickback_pic - aplWeaponTotalTime(p->curr_weapon, snum)); //D
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 146 - look_anghalf, looking_arc + 202 - gun_pos, SHOTGUN, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// move back down
|
|
|
|
|
|
|
|
// up and left
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (aplWeaponReload(p->curr_weapon, snum) - kickback_pic); //U
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 146 - look_anghalf, looking_arc + 202 - gun_pos, SHOTGUN, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displayshotgun = [&]()
|
|
|
|
{
|
|
|
|
weapon_xoffset -= 8;
|
|
|
|
|
2020-08-03 04:21:30 +00:00
|
|
|
switch(*kb)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
case 2:
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 168 - look_anghalf,looking_arc + 201 - gun_pos, SHOTGUN + 2,-128,o,pal);
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-19 22:35:52 +00:00
|
|
|
case 0:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 146 - look_anghalf,looking_arc + 202 - gun_pos, SHOTGUN,shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
|
|
|
if (*kb > 1 && *kb < 5)
|
|
|
|
{
|
|
|
|
gun_pos -= 40;
|
|
|
|
weapon_xoffset += 20;
|
|
|
|
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 178 - look_anghalf,looking_arc + 194 - gun_pos, SHOTGUN + 1 + ((*(kb)-1) >> 1),-128,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 158 - look_anghalf,looking_arc + 220 - gun_pos, SHOTGUN + 3,shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(32 + weapon_xoffset + 166 - look_anghalf,looking_arc + 210 - gun_pos, SHOTGUN + 4,shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
case 17:
|
|
|
|
case 18:
|
|
|
|
case 19:
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(64 + weapon_xoffset + 170 - look_anghalf,looking_arc + 196 - gun_pos, SHOTGUN + 5,shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
break;
|
|
|
|
case 20:
|
|
|
|
case 21:
|
|
|
|
case 22:
|
|
|
|
case 23:
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(64 + weapon_xoffset + 176 - look_anghalf,looking_arc + 196 - gun_pos, SHOTGUN + 6,shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
case 25:
|
|
|
|
case 26:
|
|
|
|
case 27:
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(64 + weapon_xoffset + 170 - look_anghalf,looking_arc + 196 - gun_pos, SHOTGUN + 5,shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
break;
|
|
|
|
case 28:
|
|
|
|
case 29:
|
|
|
|
case 30:
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(32 + weapon_xoffset + 156 - look_anghalf,looking_arc + 206 - gun_pos, SHOTGUN + 4,shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displaychaingun_ww = [&]()
|
|
|
|
{
|
|
|
|
if (*kb > 0)
|
2020-11-22 10:29:58 +00:00
|
|
|
gun_pos -= bsinf(kickback_pic * 128., -12);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (*kb > 0 && p->GetActor()->spr.pal != 1) weapon_xoffset += 1 - (rand() & 3);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
if (*kb == 0)
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
// hud_drawpal(weapon_xoffset+168-look_anghalf,looking_arc+260-gun_pos,
|
2020-05-19 22:35:52 +00:00
|
|
|
// CHAINGUN,gs,o,pal);
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 178 - look_anghalf, looking_arc + 233 - gun_pos, CHAINGUN + 1, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2021-12-05 12:43:31 +00:00
|
|
|
else if (*kb <= aplWeaponTotalTime(CHAINGUN_WEAPON, snum))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf, looking_arc + 243 - gun_pos, CHAINGUN + 2, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
// else we are in 'reload time'
|
|
|
|
// divide reload time into fifths.
|
|
|
|
// 1) move weapon up/right, hand on clip (2519)
|
|
|
|
// 2) move weapon up/right, hand removing clip (2518)
|
|
|
|
// 3) hold weapon up/right, hand removed clip (2517)
|
|
|
|
// 4) hold weapon up/right, hand inserting clip (2518)
|
|
|
|
// 5) move weapon down/left, clip inserted (2519)
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
int iFifths = (aplWeaponReload(p->curr_weapon, snum) - aplWeaponTotalTime(p->curr_weapon, snum)) / 5;
|
2020-05-19 22:35:52 +00:00
|
|
|
if (iFifths < 1)
|
|
|
|
{
|
|
|
|
iFifths = 1;
|
|
|
|
}
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(iFifths
|
2021-12-05 12:43:31 +00:00
|
|
|
+ aplWeaponTotalTime(p->curr_weapon, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// first segment
|
|
|
|
//
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos += 80 - (10 * (aplWeaponTotalTime(p->curr_weapon, snum) + iFifths - kickback_pic));
|
|
|
|
weapon_xoffset += 80 - (10 * (aplWeaponTotalTime(p->curr_weapon, snum) + iFifths - kickback_pic));
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 168 - look_anghalf, looking_arc + 260 - gun_pos, 2519, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(iFifths * 2
|
2021-12-05 12:43:31 +00:00
|
|
|
+ aplWeaponTotalTime(p->curr_weapon, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// second segment
|
|
|
|
// down
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos += 80; //5*(iFifthsp->kickback_pic-aplWeaponTotalTime(p->curr_weapon, snum)); //D
|
|
|
|
weapon_xoffset += 80; //80*(*kb-aplWeaponTotalTime(p->curr_weapon, snum));
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 168 - look_anghalf, looking_arc + 260 - gun_pos, 2518, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(iFifths * 3
|
2021-12-05 12:43:31 +00:00
|
|
|
+ aplWeaponTotalTime(p->curr_weapon, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// third segment
|
|
|
|
// up
|
|
|
|
gun_pos += 80;//5*(iFifths*2);
|
2021-12-05 12:43:31 +00:00
|
|
|
weapon_xoffset += 80; //80*(*kb-aplWeaponTotalTime(p->curr_weapon, snum));
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 168 - look_anghalf, looking_arc + 260 - gun_pos, 2517, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(iFifths * 4
|
2021-12-05 12:43:31 +00:00
|
|
|
+ aplWeaponTotalTime(p->curr_weapon, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// fourth segment
|
|
|
|
// down
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos += 80; //5*(aplWeaponTotalTime(p->curr_weapon, snum)- p->kickback_pic); //D
|
|
|
|
weapon_xoffset += 80; //80*(*kb-aplWeaponTotalTime(p->curr_weapon, snum));
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 168 - look_anghalf, looking_arc + 260 - gun_pos, 2518, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// move back down
|
|
|
|
|
|
|
|
// up and left
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos += 10 * (aplWeaponReload(p->curr_weapon, snum) - kickback_pic);
|
|
|
|
weapon_xoffset += 10 * (aplWeaponReload(p->curr_weapon, snum) - kickback_pic);
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 168 - look_anghalf, looking_arc + 260 - gun_pos, 2519, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displaychaingun = [&]
|
|
|
|
{
|
|
|
|
if (*kb > 0)
|
2020-11-22 10:29:58 +00:00
|
|
|
gun_pos -= bsinf(kickback_pic * 128., -12);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (*kb > 0 && p->GetActor()->spr.pal != 1) weapon_xoffset += 1 - (rand() & 3);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 168 - look_anghalf, looking_arc + 260 - gun_pos, CHAINGUN, shade, o, pal);
|
2020-08-03 04:21:30 +00:00
|
|
|
switch(*kb)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
case 0:
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 178 - look_anghalf,looking_arc + 233 - gun_pos, CHAINGUN + 1,shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (*kb > 4 && *kb < 12)
|
|
|
|
{
|
|
|
|
i = 0;
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->GetActor()->spr.pal != 1) i = rand() & 7;
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(i + weapon_xoffset - 4 + 140 - look_anghalf,i + looking_arc - (kickback_pic / 2.) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),shade,o,pal);
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->GetActor()->spr.pal != 1) i = rand() & 7;
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(i + weapon_xoffset - 4 + 184 - look_anghalf,i + looking_arc - (kickback_pic / 2.) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
if (*kb < 8)
|
|
|
|
{
|
|
|
|
i = rand() & 7;
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(i + weapon_xoffset - 4 + 162 - look_anghalf,i + looking_arc - (kickback_pic / 2.) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 2) / 5),shade,o,pal);
|
|
|
|
hud_drawpal(weapon_xoffset + 178 - look_anghalf,looking_arc + 233 - gun_pos, CHAINGUN + 1 + (*kb >> 1),shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-11-29 13:05:53 +00:00
|
|
|
else hud_drawpal(weapon_xoffset + 178 - look_anghalf,looking_arc + 233 - gun_pos, CHAINGUN + 1,shade,o,pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displaypistol = [&]()
|
|
|
|
{
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb < 5)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-11-07 12:30:32 +00:00
|
|
|
static const uint8_t kb_frames[] = { 0,1,2,0,0 };
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2020-08-02 04:11:07 +00:00
|
|
|
double l = 195 - 12 + weapon_xoffset;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb == 2)
|
2020-05-19 22:35:52 +00:00
|
|
|
l -= 3;
|
|
|
|
{
|
|
|
|
hud_drawpal(
|
2020-09-28 06:55:59 +00:00
|
|
|
(l - look_anghalf),
|
|
|
|
(looking_arc + 244 - gun_pos),
|
|
|
|
FIRSTGUN + kb_frames[*kb],
|
2020-11-29 13:05:53 +00:00
|
|
|
shade, 2, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
pin = (isWW2GI() || (gs.displayflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R;
|
|
|
|
auto pic_5 = FIRSTGUN+5;
|
2020-05-20 08:38:56 +00:00
|
|
|
|
2020-05-19 22:35:52 +00:00
|
|
|
const int WEAPON2_RELOAD_TIME = 50;
|
2021-12-05 12:43:31 +00:00
|
|
|
auto reload_time = isWW2GI() ? aplWeaponReload(PISTOL_WEAPON, snum) : WEAPON2_RELOAD_TIME;
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb < 10)
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(194 - look_anghalf, looking_arc + 230 - gun_pos, FIRSTGUN + 4, shade, o|pin, pal);
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb < 15)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(244 - (kickback_pic * 8.) - look_anghalf, looking_arc + 130 - gun_pos + (kickback_pic * 16.), FIRSTGUN + 6, shade, o | pin, pal);
|
|
|
|
hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic_5, shade, o | pin, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb < 20)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(124 + (kickback_pic * 2.) - look_anghalf, looking_arc + 430 - gun_pos - (kickback_pic * 8.), FIRSTGUN + 6, shade, o | pin, pal);
|
|
|
|
hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic_5, shade, o | pin, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-09-28 06:55:59 +00:00
|
|
|
else if (*kb < (isNamWW2GI()? (reload_time - 12) : 23))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(184 - look_anghalf, looking_arc + 235 - gun_pos, FIRSTGUN + 8, shade, o | pin, pal);
|
|
|
|
hud_drawpal(224 - look_anghalf, looking_arc + 210 - gun_pos, pic_5, shade, o | pin, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-09-28 06:55:59 +00:00
|
|
|
else if (*kb < (isNamWW2GI()? (reload_time - 6) : 25))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(164 - look_anghalf, looking_arc + 245 - gun_pos, FIRSTGUN + 8, shade, o | pin, pal);
|
|
|
|
hud_drawpal(224 - look_anghalf, looking_arc + 220 - gun_pos, pic_5, shade, o | pin, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-09-28 06:55:59 +00:00
|
|
|
else if (*kb < (isNamWW2GI()? reload_time : 27))
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(194 - look_anghalf, looking_arc + 235 - gun_pos, pic_5, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displayhandbomb = [&]()
|
|
|
|
{
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
static const uint8_t throw_frames[]
|
|
|
|
= { 0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2 };
|
|
|
|
|
|
|
|
if (isWW2GI())
|
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
if (*kb <= aplWeaponFireDelay(HANDBOMB_WEAPON, snum))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
// it holds here
|
2021-11-09 23:05:42 +00:00
|
|
|
gun_pos -= 5 * kickback_pic; //D
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(
|
2021-12-05 12:43:31 +00:00
|
|
|
(aplWeaponTotalTime(HANDBOMB_WEAPON, snum) - aplWeaponFireDelay(HANDBOMB_WEAPON, snum)) / 2
|
|
|
|
+ aplWeaponFireDelay(HANDBOMB_WEAPON, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// up and left
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos += 10 * (kickback_pic - aplWeaponFireDelay(HANDBOMB_WEAPON, snum)); //U
|
|
|
|
weapon_xoffset += 80 * (kickback_pic - aplWeaponFireDelay(HANDBOMB_WEAPON, snum));
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2021-12-05 12:43:31 +00:00
|
|
|
else if (*kb < aplWeaponTotalTime(HANDBOMB_WEAPON, snum))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
gun_pos += 240; // start high
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 12 * (kickback_pic - aplWeaponFireDelay(HANDBOMB_WEAPON, snum)); //D
|
2020-05-19 22:35:52 +00:00
|
|
|
// move left
|
2021-12-05 12:43:31 +00:00
|
|
|
weapon_xoffset += 90 - (5 * (aplWeaponTotalTime(HANDBOMB_WEAPON, snum) - kickback_pic));
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb < 7)
|
|
|
|
gun_pos -= 10 * kickback_pic; //D
|
|
|
|
else if (*kb < 12)
|
|
|
|
gun_pos += 20 * (kickback_pic - 10); //U
|
|
|
|
else if (*kb < 20)
|
|
|
|
gun_pos -= 9 * (kickback_pic - 14); //D
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 190 - look_anghalf, looking_arc + 250 - gun_pos, HANDTHROW + throw_frames[*kb], shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 190 - look_anghalf, looking_arc + 260 - gun_pos, HANDTHROW, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displayhandremote = [&]()
|
|
|
|
{
|
2021-11-07 11:43:00 +00:00
|
|
|
int8_t remote_frames[] = { 0,1,1,2,1,1,0,0,0,0,0 };
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
weapon_xoffset = -48;
|
|
|
|
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb)
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 150 - look_anghalf, looking_arc + 258 - gun_pos, HANDREMOTE + remote_frames[*kb], shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
else
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 150 - look_anghalf, looking_arc + 258 - gun_pos, HANDREMOTE, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displaydevastator_ww = [&]
|
|
|
|
{
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
if (*kb < aplWeaponTotalTime(p->curr_weapon, snum))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-01-04 12:35:33 +00:00
|
|
|
i = Sgn(*kb >> 2);
|
2020-05-19 22:35:52 +00:00
|
|
|
if (p->ammo_amount[p->curr_weapon] & 1)
|
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 30 - look_anghalf, looking_arc + 240 - gun_pos, DEVISTATOR, shade, o | 4, pal);
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 268 - look_anghalf, looking_arc + 238 - gun_pos, DEVISTATOR + i, -32, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 30 - look_anghalf, looking_arc + 240 - gun_pos, DEVISTATOR + i, -32, o | 4, pal);
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 268 - look_anghalf, looking_arc + 238 - gun_pos, DEVISTATOR, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// else we are in 'reload time'
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(
|
2021-12-05 12:43:31 +00:00
|
|
|
(aplWeaponReload(p->curr_weapon, snum) - aplWeaponTotalTime(p->curr_weapon, snum)) / 2
|
|
|
|
+ aplWeaponTotalTime(p->curr_weapon, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// down
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (kickback_pic - aplWeaponTotalTime(p->curr_weapon, snum)); //D
|
2020-05-19 22:35:52 +00:00
|
|
|
// weapon_xoffset+=80*(*kb-aplWeaponTotalTime[cw][snum]);
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 268 - look_anghalf, looking_arc + 238 - gun_pos, DEVISTATOR, shade, o, pal);
|
|
|
|
hud_drawpal(weapon_xoffset + 30 - look_anghalf, looking_arc + 240 - gun_pos, DEVISTATOR, shade, o | 4, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// move back down
|
|
|
|
|
|
|
|
// up and left
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (aplWeaponReload(p->curr_weapon, snum) - kickback_pic); //U
|
2020-05-19 22:35:52 +00:00
|
|
|
// weapon_xoffset+=80*(*kb-aplWeaponTotalTime[cw][snum]);
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 268 - look_anghalf, looking_arc + 238 - gun_pos, DEVISTATOR, shade, o, pal);
|
|
|
|
hud_drawpal(weapon_xoffset + 30 - look_anghalf, looking_arc + 240 - gun_pos, DEVISTATOR, shade, o | 4, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 268 - look_anghalf, looking_arc + 238 - gun_pos, DEVISTATOR, shade, o, pal);
|
|
|
|
hud_drawpal(weapon_xoffset + 30 - look_anghalf, looking_arc + 240 - gun_pos, DEVISTATOR, shade, o | 4, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displaydevastator = [&]
|
|
|
|
{
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-11-07 11:53:48 +00:00
|
|
|
static const uint8_t cycloidy[] = { 0,4,12,24,12,4,0 };
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-01-04 12:35:33 +00:00
|
|
|
i = Sgn(*kb >> 2);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
if (p->hbomb_hold_delay)
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal((cycloidy[*kb] >> 1) + weapon_xoffset + 268 - look_anghalf, cycloidy[*kb] + looking_arc + 238 - gun_pos, DEVISTATOR + i, -32, o, pal);
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 30 - look_anghalf, looking_arc + 240 - gun_pos, DEVISTATOR, shade, o | 4, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(-(cycloidy[*kb] >> 1) + weapon_xoffset + 30 - look_anghalf, cycloidy[*kb] + looking_arc + 240 - gun_pos, DEVISTATOR + i, -32, o | 4, pal);
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 268 - look_anghalf, looking_arc + 238 - gun_pos, DEVISTATOR, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 268 - look_anghalf, looking_arc + 238 - gun_pos, DEVISTATOR, shade, o, pal);
|
|
|
|
hud_drawpal(weapon_xoffset + 30 - look_anghalf, looking_arc + 240 - gun_pos, DEVISTATOR, shade, o | 4, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displayfreezer = [&]
|
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
pin = (isWW2GI() || (gs.displayflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R;
|
|
|
|
auto pic = FREEZE;
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-11-07 11:53:48 +00:00
|
|
|
static const uint8_t cat_frames[] = { 0,0,1,1,2,2 };
|
2020-05-19 22:35:52 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->GetActor()->spr.pal != 1)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
weapon_xoffset += rand() & 3;
|
|
|
|
looking_arc += rand() & 3;
|
|
|
|
}
|
|
|
|
gun_pos -= 16;
|
2021-11-14 14:03:50 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, pic + 2, -32, o|pin, pal);
|
|
|
|
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 235 - gun_pos, pic + 3 + cat_frames[*kb % 6], -32, o | pin, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
2021-11-14 14:03:50 +00:00
|
|
|
else hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, pic, shade, o | pin, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displayshrinker_ww = [&]
|
|
|
|
{
|
|
|
|
weapon_xoffset += 28;
|
|
|
|
looking_arc += 18;
|
2021-04-15 05:49:36 +00:00
|
|
|
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb == 0)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
// the 'at rest' display
|
2021-04-15 06:34:24 +00:00
|
|
|
if (p->ammo_amount[cw] <= 0) //p->last_weapon >= 0)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 184 - look_anghalf,
|
2020-08-03 04:21:30 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 3 + (*kb & 3), -32,
|
2020-05-19 22:35:52 +00:00
|
|
|
o, 0);
|
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 1, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 184 - look_anghalf,
|
2020-05-19 22:35:52 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 2,
|
2020-11-22 10:29:58 +00:00
|
|
|
16 - xs_CRoundToInt(bsinf(random_club_frame, -10)),
|
2020-05-19 22:35:52 +00:00
|
|
|
o, 0);
|
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// the 'active' display.
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->GetActor()->spr.pal != 1)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
weapon_xoffset += rand() & 3;
|
|
|
|
gun_pos += (rand() & 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-05 12:43:31 +00:00
|
|
|
if (*kb < aplWeaponTotalTime(p->curr_weapon, snum))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
if (*kb < aplWeaponFireDelay(p->curr_weapon, snum))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
// before fire time.
|
|
|
|
// nothing to modify
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// after fire time.
|
|
|
|
|
|
|
|
// lower weapon to reload cartridge (not clip)
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (aplWeaponTotalTime(p->curr_weapon, snum) - kickback_pic);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// else we are in 'reload time'
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(
|
2021-12-05 12:43:31 +00:00
|
|
|
(aplWeaponReload(p->curr_weapon, snum) - aplWeaponTotalTime(p->curr_weapon, snum)) / 2
|
|
|
|
+ aplWeaponTotalTime(p->curr_weapon, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// down
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (kickback_pic - aplWeaponTotalTime(p->curr_weapon, snum)); //D
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// up
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (aplWeaponReload(p->curr_weapon, snum) - kickback_pic); //U
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// draw weapon
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 184 - look_anghalf,
|
2020-08-03 04:21:30 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 3 + (*kb & 3), -32,
|
2020-05-19 22:35:52 +00:00
|
|
|
o, 0);
|
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 1, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displaygrower_ww = [&]
|
|
|
|
{
|
|
|
|
weapon_xoffset += 28;
|
|
|
|
looking_arc += 18;
|
2021-04-15 05:49:36 +00:00
|
|
|
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb == 0)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER - 2, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->GetActor()->spr.pal != 1)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
weapon_xoffset += rand() & 3;
|
|
|
|
gun_pos += (rand() & 3);
|
|
|
|
}
|
|
|
|
|
2021-12-05 12:43:31 +00:00
|
|
|
if (*kb < aplWeaponTotalTime(p->curr_weapon, snum))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
2021-12-05 12:43:31 +00:00
|
|
|
if (*kb < aplWeaponFireDelay(p->curr_weapon, snum))
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
// before fire time.
|
|
|
|
// nothing to modify
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// after fire time.
|
|
|
|
|
|
|
|
// lower weapon to reload cartridge (not clip)
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 15 * (aplWeaponTotalTime(p->curr_weapon, snum) - kickback_pic);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// else we are in 'reload time'
|
2020-08-03 04:21:30 +00:00
|
|
|
else if (*kb <
|
2020-05-19 22:35:52 +00:00
|
|
|
(
|
2021-12-05 12:43:31 +00:00
|
|
|
(aplWeaponReload(p->curr_weapon, snum) - aplWeaponTotalTime(p->curr_weapon, snum)) / 2
|
|
|
|
+ aplWeaponTotalTime(p->curr_weapon, snum)
|
2020-05-19 22:35:52 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// down
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 5 * (kickback_pic - aplWeaponTotalTime(p->curr_weapon, snum)); //D
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// up
|
2021-12-05 12:43:31 +00:00
|
|
|
gun_pos -= 10 * (aplWeaponReload(p->curr_weapon, snum) - kickback_pic); //U
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// display weapon
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 184 - look_anghalf,
|
2020-08-03 04:21:30 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 3 + (*kb & 3), -32,
|
2020-05-19 22:35:52 +00:00
|
|
|
o, 2);
|
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER - 1, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
auto displayshrinker = [&]
|
|
|
|
{
|
2020-09-10 21:12:52 +00:00
|
|
|
auto shrinker = /*isWorldTour() ? SHRINKERWIDE :*/ SHRINKER;
|
2020-05-19 22:35:52 +00:00
|
|
|
weapon_xoffset += 28;
|
|
|
|
looking_arc += 18;
|
2021-04-15 05:49:36 +00:00
|
|
|
|
2020-08-03 04:21:30 +00:00
|
|
|
if (*kb == 0)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
if (cw == GROW_WEAPON)
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 184 - look_anghalf,
|
2020-05-19 22:35:52 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 2,
|
2020-11-22 10:29:58 +00:00
|
|
|
16 - xs_CRoundToInt(bsinf(random_club_frame, -10)),
|
2020-05-19 22:35:52 +00:00
|
|
|
o, 2);
|
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 240 - gun_pos, shrinker - 2, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 184 - look_anghalf,
|
2020-05-19 22:35:52 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 2,
|
2020-11-22 10:29:58 +00:00
|
|
|
16 - xs_CRoundToInt(bsinf(random_club_frame, -10)),
|
2020-05-19 22:35:52 +00:00
|
|
|
o, 0);
|
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 240 - gun_pos, shrinker, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->GetActor()->spr.pal != 1)
|
2020-05-19 22:35:52 +00:00
|
|
|
{
|
|
|
|
weapon_xoffset += rand() & 3;
|
|
|
|
gun_pos += (rand() & 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cw == GROW_WEAPON)
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 184 - look_anghalf,
|
2020-08-03 04:21:30 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 3 + (*kb & 3), -32,
|
2020-05-19 22:35:52 +00:00
|
|
|
o, 2);
|
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 240 - gun_pos, shrinker - 1, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 184 - look_anghalf,
|
2020-08-03 04:21:30 +00:00
|
|
|
looking_arc + 240 - gun_pos, SHRINKER + 3 + (*kb & 3), -32,
|
2020-05-19 22:35:52 +00:00
|
|
|
o, 0);
|
|
|
|
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 188 - look_anghalf,
|
2020-11-29 13:05:53 +00:00
|
|
|
looking_arc + 240 - gun_pos, shrinker + 1, shade, o, pal);
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-20 22:23:55 +00:00
|
|
|
auto displayflamethrower = [&]()
|
|
|
|
{
|
2021-11-21 07:56:39 +00:00
|
|
|
if (*kb < 1 || p->cursector->lotag == 2)
|
2020-05-20 22:23:55 +00:00
|
|
|
{
|
2020-11-29 13:05:53 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, FLAMETHROWER, shade, o, pal);
|
|
|
|
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, FLAMETHROWERPILOT, shade, o, pal);
|
2020-05-20 22:23:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
static const uint8_t cat_frames[] = { 0, 0, 1, 1, 2, 2 };
|
2021-12-21 17:19:45 +00:00
|
|
|
if (p->GetActor()->spr.pal != 1)
|
2020-05-20 22:23:55 +00:00
|
|
|
{
|
|
|
|
weapon_xoffset += krand() & 1;
|
|
|
|
looking_arc += krand() & 1;
|
|
|
|
}
|
|
|
|
gun_pos -= 16;
|
2020-09-08 20:50:38 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, FLAMETHROWER + 1, -32, o, pal);
|
2020-08-03 06:27:14 +00:00
|
|
|
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 235 - gun_pos, FLAMETHROWER + 2 + cat_frames[*kb % 6], -32, o, pal);
|
2020-05-20 22:23:55 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
switch (cw)
|
|
|
|
{
|
|
|
|
case KNEE_WEAPON:
|
|
|
|
displayknee();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TRIPBOMB_WEAPON:
|
|
|
|
displaytripbomb();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RPG_WEAPON:
|
|
|
|
displayrpg();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOTGUN_WEAPON:
|
|
|
|
if (isWW2GI()) displayshotgun_ww();
|
|
|
|
else displayshotgun();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CHAINGUN_WEAPON:
|
|
|
|
if (isWW2GI()) displaychaingun_ww();
|
|
|
|
else displaychaingun();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PISTOL_WEAPON:
|
|
|
|
displaypistol();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HANDBOMB_WEAPON:
|
|
|
|
displayhandbomb();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HANDREMOTE_WEAPON:
|
|
|
|
displayhandremote();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEVISTATOR_WEAPON:
|
|
|
|
if (isWW2GI()) displaydevastator_ww();
|
|
|
|
else displaydevastator();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FREEZE_WEAPON:
|
|
|
|
displayfreezer();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHRINKER_WEAPON:
|
|
|
|
if (isWW2GI()) displayshrinker_ww();
|
|
|
|
else displayshrinker();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GROW_WEAPON:
|
|
|
|
if (isWW2GI()) displaygrower_ww();
|
|
|
|
else displayshrinker();
|
|
|
|
break;
|
2020-05-20 22:23:55 +00:00
|
|
|
|
|
|
|
case FLAMETHROWER_WEAPON:
|
|
|
|
displayflamethrower();
|
|
|
|
break;
|
2020-05-19 22:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-15 06:34:24 +00:00
|
|
|
displayloogie(p);
|
2020-05-19 22:35:52 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
END_DUKE_NS
|