mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
Propagate 'smoothratio' to scenes drawn from the position of a camera.
That is, make interpolation work properly there -- both when 'using' a VIEWSCREEN and when rendering the scene onto a TILE_VIEWSCR. This makes a difference only if the camera is in a moving sector. git-svn-id: https://svn.eduke32.com/eduke32@4847 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
33addad941
commit
2494c56768
3 changed files with 27 additions and 11 deletions
|
@ -4415,7 +4415,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
|||
CAMERA(sect) = p->cursectnum;
|
||||
|
||||
G_DoInterpolations(smoothratio);
|
||||
G_AnimateCamSprite();
|
||||
G_AnimateCamSprite(smoothratio);
|
||||
|
||||
if (ud.camerasprite >= 0)
|
||||
{
|
||||
|
@ -4595,12 +4595,13 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
vec3_t cam = G_GetCameraPosition(p->newowner, smoothratio);
|
||||
|
||||
// looking through viewscreen
|
||||
Bmemcpy(&CAMERA(pos), &p->pos, sizeof(vec3_t));
|
||||
Bmemcpy(&CAMERA(pos), &cam, sizeof(vec3_t));
|
||||
CAMERA(ang) = p->ang + p->look_ang;
|
||||
CAMERA(horiz) = 100+sprite[p->newowner].shade;
|
||||
CAMERA(sect) = sprite[p->newowner].sectnum;
|
||||
smoothratio = 65536;
|
||||
}
|
||||
|
||||
cz = actor[p->i].ceilingz;
|
||||
|
@ -11641,7 +11642,6 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
// getpackets();
|
||||
|
||||
MAIN_LOOP_RESTART:
|
||||
|
||||
M_ChangeMenu(MENU_MAIN);
|
||||
|
||||
if (g_networkMode != NET_DEDICATED_SERVER)
|
||||
|
|
|
@ -363,18 +363,20 @@ int32_t SetAnimation(int32_t animsect,int32_t *animptr, int32_t thegoal, int32_t
|
|||
return j;
|
||||
}
|
||||
|
||||
static void G_SetupCamTile(int32_t i, int32_t wn)
|
||||
static void G_SetupCamTile(int32_t i, int32_t wn, int32_t smoothratio)
|
||||
{
|
||||
vec3_t cam = G_GetCameraPosition(i, smoothratio);
|
||||
|
||||
const int32_t mir = display_mirror;
|
||||
//if (waloff[wn] == 0) loadtile(wn);
|
||||
setviewtotile(wn, tilesiz[wn].y, tilesiz[wn].x);
|
||||
|
||||
yax_preparedrawrooms();
|
||||
drawrooms(SX, SY, SZ, SA, 100+sprite[i].shade, SECT);
|
||||
yax_drawrooms(G_DoSpriteAnimations, SECT, 0, 65536);
|
||||
drawrooms(cam.x, cam.y, cam.z, SA, 100+sprite[i].shade, SECT);
|
||||
yax_drawrooms(G_DoSpriteAnimations, SECT, 0, smoothratio);
|
||||
|
||||
display_mirror = 3;
|
||||
G_DoSpriteAnimations(SX, SY, SA, 65536L);
|
||||
G_DoSpriteAnimations(cam.x, cam.y, SA, smoothratio);
|
||||
display_mirror = mir;
|
||||
drawmasks();
|
||||
|
||||
|
@ -383,7 +385,7 @@ static void G_SetupCamTile(int32_t i, int32_t wn)
|
|||
invalidatetile(wn, -1, 255);
|
||||
}
|
||||
|
||||
void G_AnimateCamSprite(void)
|
||||
void G_AnimateCamSprite(int32_t smoothratio)
|
||||
{
|
||||
const int32_t i = g_curViewscreen;
|
||||
|
||||
|
@ -407,7 +409,7 @@ void G_AnimateCamSprite(void)
|
|||
else
|
||||
walock[TILE_VIEWSCR] = 255;
|
||||
|
||||
G_SetupCamTile(OW, TILE_VIEWSCR);
|
||||
G_SetupCamTile(OW, TILE_VIEWSCR, smoothratio);
|
||||
#ifdef POLYMER
|
||||
// Force texture update on viewscreen sprite in Polymer!
|
||||
if (getrendermode() == REND_POLYMER)
|
||||
|
|
|
@ -117,7 +117,7 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith
|
|||
int32_t __fastcall A_FindPlayer(const spritetype *s,int32_t *d);
|
||||
void G_AlignWarpElevators(void);
|
||||
int32_t CheckDoorTile(int32_t dapic);
|
||||
void G_AnimateCamSprite(void);
|
||||
void G_AnimateCamSprite(int32_t smoothratio);
|
||||
void G_AnimateWalls(void);
|
||||
int32_t G_ActivateWarpElevators(int32_t s,int32_t d);
|
||||
int32_t G_CheckActivatorMotion(int32_t lotag);
|
||||
|
@ -149,6 +149,20 @@ static inline int32_t G_GetForcefieldPicnum(int32_t wallnum)
|
|||
return picnum;
|
||||
}
|
||||
|
||||
// Returns the interpolated position of the camera that the player is looking
|
||||
// through (using a viewscreen). <i> should be the player's ->newowner member.
|
||||
static inline vec3_t G_GetCameraPosition(int32_t i, int32_t smoothratio)
|
||||
{
|
||||
const spritetype *const cs = &sprite[i];
|
||||
const actor_t *const ca = &actor[i];
|
||||
|
||||
vec3_t cam = { ca->bpos.x + mulscale16(cs->x - ca->bpos.x, smoothratio),
|
||||
ca->bpos.y + mulscale16(cs->y - ca->bpos.y, smoothratio),
|
||||
ca->bpos.z + mulscale16(cs->z - ca->bpos.z, smoothratio)
|
||||
};
|
||||
return cam;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue