mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- Duke: fixed camera views glitching when changing their targets.
A nearly typical problem of this code. Not all relevant properties of the camera target were changed at once - there was a two frame discrepancy in which the camera pointed in some undefined direction after the change. Fixes #15
This commit is contained in:
parent
cef1f8275b
commit
9615308fb3
2 changed files with 26 additions and 6 deletions
|
@ -581,17 +581,37 @@ void displayrooms(int snum, double smoothratio)
|
|||
|
||||
if (p->newowner >= 0)
|
||||
{
|
||||
fixed_t oang = hittype[p->newowner].oq16ang;
|
||||
cang = q16ang(oang + xs_CRoundToInt(fmulscale16(((p->q16ang + dang - oang) & 0x7FFFFFF) - dang, smoothratio)));
|
||||
fixed_t a = IntToFixed(sprite[p->newowner].ang);
|
||||
if (p->newowner != p->oldowner)
|
||||
{
|
||||
p->oldowner = p->newowner;
|
||||
hittype[p->newowner].oq16ang = a;
|
||||
cang = q16ang(a);
|
||||
p->camchangecnt = 3;
|
||||
}
|
||||
else if (p->camchangecnt > 0)
|
||||
{
|
||||
hittype[p->newowner].oq16ang = a;
|
||||
cang = q16ang(a);
|
||||
p->camchangecnt--;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_t oang = hittype[p->newowner].oq16ang;
|
||||
cang = q16ang(oang + xs_CRoundToInt(fmulscale16(((a + dang - oang) & 0x7FFFFFF) - dang, smoothratio)));
|
||||
}
|
||||
cang = q16ang(a);
|
||||
choriz = q16horiz(p->q16horiz + p->q16horizoff);
|
||||
cposx = p->posx;
|
||||
cposy = p->posy;
|
||||
cposz = p->posz;
|
||||
cposx = sprite[p->newowner].pos.x;
|
||||
cposy = sprite[p->newowner].pos.y;
|
||||
cposz = sprite[p->newowner].pos.z;
|
||||
sect = sprite[p->newowner].sectnum;
|
||||
smoothratio = MaxSmoothRatio;
|
||||
}
|
||||
else if (p->over_shoulder_on == 0)
|
||||
{
|
||||
p->camchangecnt = 0;
|
||||
p->oldowner = -1;
|
||||
if (cl_viewbob) cposz += p->opyoff + xs_CRoundToInt(fmulscale16(p->pyoff - p->opyoff, smoothratio));
|
||||
}
|
||||
else view(p, &cposx, &cposy, &cposz, §, cang.asbuild(), choriz.asbuild(), smoothratio);
|
||||
|
|
|
@ -137,7 +137,7 @@ struct player_struct
|
|||
short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself;
|
||||
|
||||
short curr_weapon, last_weapon, tipincs, wantweaponfire;
|
||||
short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay;
|
||||
short holoduke_amount, newowner, oldowner, camchangecnt, hurt_delay, hbomb_hold_delay;
|
||||
short jumping_counter, airleft, knee_incs, access_incs;
|
||||
short ftq, access_wallnum, access_spritenum;
|
||||
short got_access, weapon_ang, firstaid_amount;
|
||||
|
|
Loading…
Reference in a new issue