mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-28 23:21:58 +00:00
Render skybox from proper place for cutaway view
(Disclaimer: I don't know C at all)
This commit is contained in:
parent
8e2378b15d
commit
766f4c4acb
1 changed files with 48 additions and 1 deletions
49
src/r_main.c
49
src/r_main.c
|
@ -798,7 +798,54 @@ void R_SkyboxFrame(player_t *player)
|
|||
if (mapheaderinfo[gamemap-1])
|
||||
{
|
||||
mapheader_t *mh = mapheaderinfo[gamemap-1];
|
||||
if (thiscam->chase)
|
||||
if (player->awayviewtics)
|
||||
{
|
||||
if (skyboxmo[1])
|
||||
{
|
||||
fixed_t x = 0, y = 0;
|
||||
if (mh->skybox_scalex > 0)
|
||||
x = (player->awayviewmobj->x - skyboxmo[1]->x) / mh->skybox_scalex;
|
||||
else if (mh->skybox_scalex < 0)
|
||||
x = (player->awayviewmobj->x - skyboxmo[1]->x) * -mh->skybox_scalex;
|
||||
|
||||
if (mh->skybox_scaley > 0)
|
||||
y = (player->awayviewmobj->y - skyboxmo[1]->y) / mh->skybox_scaley;
|
||||
else if (mh->skybox_scaley < 0)
|
||||
y = (player->awayviewmobj->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->awayviewmobj->z / mh->skybox_scalez;
|
||||
else if (mh->skybox_scalez < 0)
|
||||
viewz += player->awayviewmobj->z * -mh->skybox_scalez;
|
||||
}
|
||||
else if (thiscam->chase)
|
||||
{
|
||||
if (skyboxmo[1])
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue