mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- interpolate p->weapon_sway
.
This commit is contained in:
parent
4499e05b06
commit
3a4a224877
4 changed files with 11 additions and 7 deletions
|
@ -271,9 +271,10 @@ int animateaccess(int gs,int snum)
|
|||
|
||||
void displayweapon_d(int snum, double smoothratio)
|
||||
{
|
||||
int gun_pos, looking_arc, cw;
|
||||
int weapon_xoffset, i, j;
|
||||
int looking_arc, cw;
|
||||
int i, j;
|
||||
int o,pal;
|
||||
double weapon_sway, weapon_xoffset, gun_pos;
|
||||
signed char gs;
|
||||
struct player_struct *p;
|
||||
|
||||
|
@ -284,6 +285,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
o = 0;
|
||||
|
||||
looking_arc = abs(p->getlookang())/9;
|
||||
weapon_sway = p->oweapon_sway + (((p->weapon_sway - p->oweapon_sway) * smoothratio) / MaxSmoothRatio);
|
||||
|
||||
gs = sprite[p->i].shade;
|
||||
if(gs > 24) gs = 24;
|
||||
|
@ -296,11 +298,11 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
gun_pos = 80-(p->weapon_pos*p->weapon_pos);
|
||||
|
||||
weapon_xoffset = (160)-90;
|
||||
weapon_xoffset -= (sintable[((p->weapon_sway>>1)+512)&2047]/(1024+512));
|
||||
weapon_xoffset -= (sintable[((xs_CRoundToInt(weapon_sway)>>1)+512)&2047]/(1024+512));
|
||||
weapon_xoffset -= 58 + p->weapon_ang;
|
||||
if( sprite[p->i].xrepeat < 32 )
|
||||
gun_pos -= abs(sintable[(p->weapon_sway<<2)&2047]>>9);
|
||||
else gun_pos -= abs(sintable[(p->weapon_sway>>1)&2047]>>10);
|
||||
gun_pos -= abs(sintable[(xs_CRoundToInt(weapon_sway)<<2)&2047]>>9);
|
||||
else gun_pos -= abs(sintable[(xs_CRoundToInt(weapon_sway)>>1)&2047]>>10);
|
||||
|
||||
gun_pos -= (p->hard_landing<<3);
|
||||
|
||||
|
|
|
@ -2732,13 +2732,14 @@ void processinput_d(int snum)
|
|||
if (p->on_crane >= 0)
|
||||
goto HORIZONLY;
|
||||
|
||||
p->oweapon_sway = p->weapon_sway;
|
||||
if (s->xvel < 32 || p->on_ground == 0 || p->bobcounter == 1024)
|
||||
{
|
||||
if ((p->weapon_sway & 2047) > (1024 + 96))
|
||||
p->weapon_sway -= 96;
|
||||
else if ((p->weapon_sway & 2047) < (1024 - 96))
|
||||
p->weapon_sway += 96;
|
||||
else p->weapon_sway = 1024;
|
||||
else p->oweapon_sway = p->weapon_sway = 1024;
|
||||
}
|
||||
else p->weapon_sway = p->bobcounter;
|
||||
|
||||
|
|
|
@ -3627,6 +3627,7 @@ void processinput_r(int snum)
|
|||
if (p->on_crane >= 0)
|
||||
goto HORIZONLY;
|
||||
|
||||
p->oweapon_sway = p->weapon_sway;
|
||||
if (s->xvel < 32 || p->on_ground == 0 || p->bobcounter == 1024)
|
||||
{
|
||||
if ((p->weapon_sway & 2047) > (1024 + 96))
|
||||
|
|
|
@ -122,7 +122,7 @@ struct player_struct
|
|||
int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff;
|
||||
int posxv, posyv, poszv, last_pissed_time, truefz, truecz;
|
||||
int player_par, visibility;
|
||||
int bobcounter, weapon_sway;
|
||||
int bobcounter, weapon_sway, oweapon_sway;
|
||||
int pals_time, randomflamex, crack_time;
|
||||
|
||||
int aim_mode, auto_aim, ftt;
|
||||
|
|
Loading…
Reference in a new issue