sky_camera: Fix not taking different camera position vectors into account,

this broke by accident a few commits ago. Apologies.
This commit is contained in:
Marco Cawthorne 2020-12-20 02:19:52 +01:00
parent ebdd55d397
commit 3d700a4fd7
3 changed files with 20 additions and 16 deletions

View file

@ -166,7 +166,7 @@ CSQC_UpdateView(float w, float h, float focus)
setproperty(VF_ENVMAP, "$whiteimage"); setproperty(VF_ENVMAP, "$whiteimage");
setproperty(VF_ORIGIN, g_vecCubePos); setproperty(VF_ORIGIN, g_vecCubePos);
setproperty(VF_AFOV, 90); setproperty(VF_AFOV, 90);
SkyCamera_Setup(); SkyCamera_Setup(g_vecCubePos);
renderscene(); renderscene();
return; return;
} }
@ -290,7 +290,7 @@ CSQC_UpdateView(float w, float h, float focus)
} }
setproperty(VF_DRAWWORLD, 1); setproperty(VF_DRAWWORLD, 1);
SkyCamera_Setup(); SkyCamera_Setup(getproperty(VF_ORIGIN));
/* draw the viewmodel in a second pass if desired */ /* draw the viewmodel in a second pass if desired */
if (autocvar_r_viewmodelpass) { if (autocvar_r_viewmodelpass) {

View file

@ -89,7 +89,6 @@ void
View_CalcBob(void) View_CalcBob(void)
{ {
float cycle; float cycle;
vector vel; vector vel;
if (self.flags & FL_ONGROUND == -1) { if (self.flags & FL_ONGROUND == -1) {
@ -133,7 +132,8 @@ Really convoluted function that makes the gun,
muzzleflash, dynamic lights and so on appear muzzleflash, dynamic lights and so on appear
==================== ====================
*/ */
void View_DrawViewModel(void) void
View_DrawViewModel(void)
{ {
entity m_eViewModel = pSeat->m_eViewModel; entity m_eViewModel = pSeat->m_eViewModel;
entity m_eMuzzleflash = pSeat->m_eMuzzleflash; entity m_eMuzzleflash = pSeat->m_eMuzzleflash;
@ -207,7 +207,8 @@ void View_DrawViewModel(void)
} }
} }
void View_PostDraw(void) void
View_PostDraw(void)
{ {
entity m_eMuzzleflash = pSeat->m_eMuzzleflash; entity m_eMuzzleflash = pSeat->m_eMuzzleflash;
@ -217,7 +218,8 @@ void View_PostDraw(void)
} }
} }
void View_Stairsmooth(void) void
View_Stairsmooth(void)
{ {
vector currentpos = pSeat->m_vecPredictedOrigin; vector currentpos = pSeat->m_vecPredictedOrigin;
vector endpos = currentpos; vector endpos = currentpos;
@ -253,14 +255,16 @@ Resets the timeline and plays a new sequence
onto the view model onto the view model
==================== ====================
*/ */
void View_PlayAnimation(int iSequence) void
View_PlayAnimation(int iSequence)
{ {
pSeat->m_eViewModel.frame = (float)iSequence; pSeat->m_eViewModel.frame = (float)iSequence;
player pl = (player)pSeat->m_ePlayer; player pl = (player)pSeat->m_ePlayer;
pl.weapontime = 0.0f; pl.weapontime = 0.0f;
} }
int View_GetAnimation(void) int
View_GetAnimation(void)
{ {
return pSeat->m_eViewModel.frame; return pSeat->m_eViewModel.frame;
} }

View file

@ -62,20 +62,20 @@ sky_camera::sky_camera(void)
} }
void void
SkyCamera_Setup(void) SkyCamera_Setup(vector org)
{ {
if (g_skyscale != 0 && g_skypos) { if (g_skyscale != 0 && g_skypos) {
vector porg; vector porg;
vector realpos; vector realpos;
if (autocvar_dev_skyscale) { if (autocvar_dev_skyscale) {
realpos[0] = g_vecCubePos[0] / autocvar_dev_skyscale; realpos[0] = org[0] / autocvar_dev_skyscale;
realpos[1] = g_vecCubePos[1] / autocvar_dev_skyscale; realpos[1] = org[1] / autocvar_dev_skyscale;
realpos[2] = g_vecCubePos[2] / autocvar_dev_skyscale; realpos[2] = org[2] / autocvar_dev_skyscale;
} else { } else {
realpos[0] = g_vecCubePos[0] / g_skyscale; realpos[0] = org[0] / g_skyscale;
realpos[1] = g_vecCubePos[1] / g_skyscale; realpos[1] = org[1] / g_skyscale;
realpos[2] = g_vecCubePos[2] / g_skyscale; realpos[2] = org[2] / g_skyscale;
} }
setproperty(VF_SKYROOM_CAMERA, g_skypos + realpos); setproperty(VF_SKYROOM_CAMERA, g_skypos + realpos);
} }