Merge branch 'skybox-hotfix' into 'next'

Skybox hotfix

This branch fixes how, for a skybox with both a centerpoint and viewpoint, the first person view code did not take the centerpoint's angle into account. So when the centerpoint's angle is NOT 0 (or a multiple of 360), this results in the skybox "moving the wrong way" when you're viewing the skybox this way and moving about.

...yeah sorry guys, I commited to a copy of next again, whoops. Cherry-pick the relevant commit into master if this works out fine - after all, this shouldn't affect netgames I think (it's purely about rendering after all)

See merge request !56
This commit is contained in:
Inuyasha 2016-04-20 16:56:22 -04:00
commit 5a6f538618
1 changed files with 32 additions and 4 deletions

View File

@ -971,14 +971,42 @@ void R_SkyboxFrame(player_t *player)
{
if (skyboxmo[1])
{
fixed_t x = 0, y = 0;
if (mh->skybox_scalex > 0)
viewx += (player->mo->x - skyboxmo[1]->x) / mh->skybox_scalex;
x = (player->mo->x - skyboxmo[1]->x) / mh->skybox_scalex;
else if (mh->skybox_scalex < 0)
viewx += (player->mo->x - skyboxmo[1]->x) * -mh->skybox_scalex;
x = (player->mo->x - skyboxmo[1]->x) * -mh->skybox_scalex;
if (mh->skybox_scaley > 0)
viewy += (player->mo->y - skyboxmo[1]->y) / mh->skybox_scaley;
y = (player->mo->y - skyboxmo[1]->y) / mh->skybox_scaley;
else if (mh->skybox_scaley < 0)
viewy += (player->mo->y - skyboxmo[1]->y) * -mh->skybox_scaley;
y = (player->mo->y - skyboxmo[1]->y) * -mh->skybox_scaley;
if (viewmobj->angle == 0)
{
viewx += x;
viewy += y;
}
else if (viewmobj->angle == ANGLE_90)
{
viewx -= y;
viewy += x;
}
else if (viewmobj->angle == ANGLE_180)
{
viewx -= x;
viewy -= y;
}
else if (viewmobj->angle == ANGLE_270)
{
viewx += y;
viewy -= x;
}
else
{
angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT;
viewx += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
viewy += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
}
}
if (mh->skybox_scalez > 0)
viewz += player->viewz / mh->skybox_scalez;