mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 05:41:42 +00:00
Merge branch 'master' of https://github.com/Sryder13/SRB2
This commit is contained in:
commit
40d1898806
4 changed files with 58 additions and 25 deletions
|
@ -108,6 +108,7 @@ typedef struct
|
||||||
FLOAT scalex,scaley,scalez;
|
FLOAT scalex,scaley,scalez;
|
||||||
FLOAT fovxangle, fovyangle;
|
FLOAT fovxangle, fovyangle;
|
||||||
INT32 splitscreen;
|
INT32 splitscreen;
|
||||||
|
boolean flip; // screenflip
|
||||||
} FTransform;
|
} FTransform;
|
||||||
|
|
||||||
// Transformed vector, as passed to HWR API
|
// Transformed vector, as passed to HWR API
|
||||||
|
|
|
@ -4475,6 +4475,12 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
|
||||||
// It should replace all other gr_viewxxx when finished
|
// It should replace all other gr_viewxxx when finished
|
||||||
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||||
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||||
|
|
||||||
|
if (postimgtype == postimg_flip)
|
||||||
|
atransform.flip = true;
|
||||||
|
else
|
||||||
|
atransform.flip = false;
|
||||||
|
|
||||||
atransform.x = gr_viewx; // FIXED_TO_FLOAT(viewx)
|
atransform.x = gr_viewx; // FIXED_TO_FLOAT(viewx)
|
||||||
atransform.y = gr_viewy; // FIXED_TO_FLOAT(viewy)
|
atransform.y = gr_viewy; // FIXED_TO_FLOAT(viewy)
|
||||||
atransform.z = gr_viewz; // FIXED_TO_FLOAT(viewz)
|
atransform.z = gr_viewz; // FIXED_TO_FLOAT(viewz)
|
||||||
|
@ -4488,6 +4494,12 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
|
||||||
// Transform for sprites
|
// Transform for sprites
|
||||||
stransform.anglex = 0.0f;
|
stransform.anglex = 0.0f;
|
||||||
stransform.angley = -270.0f;
|
stransform.angley = -270.0f;
|
||||||
|
|
||||||
|
if (postimgtype == postimg_flip)
|
||||||
|
stransform.flip = true;
|
||||||
|
else
|
||||||
|
stransform.flip = false;
|
||||||
|
|
||||||
stransform.x = 0.0f;
|
stransform.x = 0.0f;
|
||||||
stransform.y = 0.0f;
|
stransform.y = 0.0f;
|
||||||
stransform.z = 0.0f;
|
stransform.z = 0.0f;
|
||||||
|
@ -4687,6 +4699,12 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
||||||
// It should replace all other gr_viewxxx when finished
|
// It should replace all other gr_viewxxx when finished
|
||||||
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||||
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||||
|
|
||||||
|
if (postimgtype == postimg_flip)
|
||||||
|
atransform.flip = true;
|
||||||
|
else
|
||||||
|
atransform.flip = false;
|
||||||
|
|
||||||
atransform.x = gr_viewx; // FIXED_TO_FLOAT(viewx)
|
atransform.x = gr_viewx; // FIXED_TO_FLOAT(viewx)
|
||||||
atransform.y = gr_viewy; // FIXED_TO_FLOAT(viewy)
|
atransform.y = gr_viewy; // FIXED_TO_FLOAT(viewy)
|
||||||
atransform.z = gr_viewz; // FIXED_TO_FLOAT(viewz)
|
atransform.z = gr_viewz; // FIXED_TO_FLOAT(viewz)
|
||||||
|
@ -4700,6 +4718,12 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
||||||
// Transform for sprites
|
// Transform for sprites
|
||||||
stransform.anglex = 0.0f;
|
stransform.anglex = 0.0f;
|
||||||
stransform.angley = -270.0f;
|
stransform.angley = -270.0f;
|
||||||
|
|
||||||
|
if (postimgtype == postimg_flip)
|
||||||
|
stransform.flip = true;
|
||||||
|
else
|
||||||
|
stransform.flip = false;
|
||||||
|
|
||||||
stransform.x = 0.0f;
|
stransform.x = 0.0f;
|
||||||
stransform.y = 0.0f;
|
stransform.y = 0.0f;
|
||||||
stransform.z = 0.0f;
|
stransform.z = 0.0f;
|
||||||
|
@ -5312,25 +5336,12 @@ void HWR_DoPostProcessor(player_t *player)
|
||||||
}
|
}
|
||||||
HWD.pfnPostImgRedraw(v);
|
HWD.pfnPostImgRedraw(v);
|
||||||
disStart += 1;
|
disStart += 1;
|
||||||
}
|
|
||||||
else if (postimgtype == postimg_flip) //We like our screens inverted.
|
|
||||||
{
|
|
||||||
// 10 by 10 grid. 2 coordinates (xy)
|
|
||||||
float v[SCREENVERTS][SCREENVERTS][2];
|
|
||||||
UINT8 x, y;
|
|
||||||
UINT8 flipy;
|
|
||||||
|
|
||||||
for (x = 0; x < SCREENVERTS; x++)
|
// Capture the screen again for screen waving on the intermission
|
||||||
{
|
if(gamestate != GS_INTERMISSION)
|
||||||
for (y = 0, flipy = SCREENVERTS; y < SCREENVERTS; y++, flipy--)
|
HWD.pfnMakeScreenTexture();
|
||||||
{
|
|
||||||
// Flip the screen.
|
|
||||||
v[x][y][0] = (x/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
|
|
||||||
v[x][y][1] = (flipy/((float)(SCREENVERTS-1.0f)/9.0f))-5.5f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HWD.pfnPostImgRedraw(v);
|
|
||||||
}
|
}
|
||||||
|
// Flipping of the screen isn't done here anymore
|
||||||
#endif // SHUFFLE
|
#endif // SHUFFLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1132,6 +1132,9 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
spriteframe_t *sprframe;
|
spriteframe_t *sprframe;
|
||||||
float finalscale;
|
float finalscale;
|
||||||
|
|
||||||
|
if (tics > durs)
|
||||||
|
durs = tics;
|
||||||
|
|
||||||
if (spr->mobj->flags2 & MF2_SHADOW)
|
if (spr->mobj->flags2 & MF2_SHADOW)
|
||||||
{
|
{
|
||||||
Surf.FlatColor.s.alpha = 0x40;
|
Surf.FlatColor.s.alpha = 0x40;
|
||||||
|
@ -1241,6 +1244,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
// SRB2CBTODO: MD2 scaling support
|
// SRB2CBTODO: MD2 scaling support
|
||||||
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
||||||
|
|
||||||
|
if (postimgtype == postimg_flip)
|
||||||
|
p.flip = true;
|
||||||
|
else
|
||||||
|
p.flip = false;
|
||||||
|
|
||||||
HWD.pfnDrawMD2i(buff, curr, durs, tics, next, &p, finalscale, flip, color);
|
HWD.pfnDrawMD2i(buff, curr, durs, tics, next, &p, finalscale, flip, color);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -628,9 +628,6 @@ void SetStates(void)
|
||||||
#ifdef GL_LIGHT_MODEL_AMBIENT
|
#ifdef GL_LIGHT_MODEL_AMBIENT
|
||||||
GLfloat LightDiffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
GLfloat LightDiffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||||
#endif
|
#endif
|
||||||
#ifndef KOS_GL_COMPATIBILITY
|
|
||||||
GLfloat LightPos[] = {0.0f, 1.0f, 0.0f, 0.0f};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DBG_Printf("SetStates()\n");
|
DBG_Printf("SetStates()\n");
|
||||||
|
|
||||||
|
@ -693,9 +690,6 @@ void SetStates(void)
|
||||||
pglLightModelfv(GL_LIGHT_MODEL_AMBIENT, LightDiffuse);
|
pglLightModelfv(GL_LIGHT_MODEL_AMBIENT, LightDiffuse);
|
||||||
pglEnable(GL_LIGHT0);
|
pglEnable(GL_LIGHT0);
|
||||||
#endif
|
#endif
|
||||||
#ifndef KOS_GL_COMPATIBILITY
|
|
||||||
pglLightfv(GL_LIGHT0, GL_POSITION, LightPos);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// bp : when no t&l :)
|
// bp : when no t&l :)
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
|
@ -1720,6 +1714,11 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
|
||||||
float scalex, scaley, scalez;
|
float scalex, scaley, scalez;
|
||||||
scalex = scaley = scalez = scale;
|
scalex = scaley = scalez = scale;
|
||||||
|
|
||||||
|
// Because Otherwise, scaling the screen negatively vertically breaks the lighting
|
||||||
|
#ifndef KOS_GL_COMPATIBILITY
|
||||||
|
GLfloat LightPos[] = {0.0f, 1.0f, 0.0f, 0.0f};
|
||||||
|
#endif
|
||||||
|
|
||||||
if (duration == 0)
|
if (duration == 0)
|
||||||
duration = 1;
|
duration = 1;
|
||||||
|
|
||||||
|
@ -1760,10 +1759,19 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
|
||||||
|
|
||||||
pglEnable(GL_CULL_FACE);
|
pglEnable(GL_CULL_FACE);
|
||||||
|
|
||||||
if (flipped)
|
// pos->flip is if the screen is flipped too
|
||||||
|
if (flipped != pos->flip) // If either are active, but not both, invert the model's culling
|
||||||
|
{
|
||||||
pglCullFace(GL_FRONT);
|
pglCullFace(GL_FRONT);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pglCullFace(GL_BACK);
|
pglCullFace(GL_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef KOS_GL_COMPATIBILITY
|
||||||
|
pglLightfv(GL_LIGHT0, GL_POSITION, LightPos);
|
||||||
|
#endif
|
||||||
|
|
||||||
pglShadeModel(GL_SMOOTH);
|
pglShadeModel(GL_SMOOTH);
|
||||||
if (color)
|
if (color)
|
||||||
|
@ -1872,7 +1880,12 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||||
{
|
{
|
||||||
// keep a trace of the transformation for md2
|
// keep a trace of the transformation for md2
|
||||||
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
||||||
pglScalef(stransform->scalex, stransform->scaley, -stransform->scalez);
|
|
||||||
|
if (stransform->flip)
|
||||||
|
pglScalef(stransform->scalex, -stransform->scaley, -stransform->scalez);
|
||||||
|
else
|
||||||
|
pglScalef(stransform->scalex, stransform->scaley, -stransform->scalez);
|
||||||
|
|
||||||
pglRotatef(stransform->anglex , 1.0f, 0.0f, 0.0f);
|
pglRotatef(stransform->anglex , 1.0f, 0.0f, 0.0f);
|
||||||
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
|
pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
|
||||||
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
|
pglTranslatef(-stransform->x, -stransform->z, -stransform->y);
|
||||||
|
|
Loading…
Reference in a new issue