mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-01 07:11:02 +00:00
Hide/add Kart FTransform mirror and anglez behind ifdef
This commit is contained in:
parent
bbc3d27cee
commit
6653b9697f
3 changed files with 37 additions and 3 deletions
|
@ -101,15 +101,26 @@ typedef struct
|
|||
|
||||
//Hurdler: Transform (coords + angles)
|
||||
//BP: transform order : scale(rotation_x(rotation_y(translation(v))))
|
||||
|
||||
// Kart features
|
||||
#define USE_FTRANSFORM_ANGLEZ
|
||||
#define USE_FTRANSFORM_MIRROR
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FLOAT x,y,z; // position
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
||||
#else
|
||||
FLOAT anglex,angley; // aimingangle / viewangle
|
||||
#endif
|
||||
FLOAT scalex,scaley,scalez;
|
||||
FLOAT fovxangle, fovyangle;
|
||||
UINT8 splitscreen;
|
||||
boolean flip; // screenflip
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
boolean mirror; // SRB2Kart: Encore Mode
|
||||
#endif
|
||||
} FTransform;
|
||||
|
||||
// Transformed vector, as passed to HWR API
|
||||
|
|
|
@ -1048,6 +1048,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
|||
p.angley = FIXED_TO_FLOAT(anglef);
|
||||
}
|
||||
p.anglex = 0.0f;
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
// Slope rotation from Kart
|
||||
p.anglez = 0.0f;
|
||||
if (spr->mobj->standingslope)
|
||||
{
|
||||
|
@ -1059,6 +1061,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
|||
tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
|
||||
p.anglex = FIXED_TO_FLOAT(tempangle);
|
||||
}
|
||||
#endif
|
||||
|
||||
color[0] = Surf.FlatColor.s.red;
|
||||
color[1] = Surf.FlatColor.s.green;
|
||||
|
@ -1069,7 +1072,9 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
|||
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
|
||||
p.flip = atransform.flip;
|
||||
p.mirror = atransform.mirror;
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, color);
|
||||
}
|
||||
|
|
|
@ -1971,6 +1971,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
|
||||
pglEnable(GL_CULL_FACE);
|
||||
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
// flipped is if the object is flipped
|
||||
// pos->flip is if the screen is flipped vertically
|
||||
// pos->mirror is if the screen is flipped horizontally
|
||||
|
@ -1982,6 +1983,17 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
else
|
||||
pglCullFace(GL_BACK);
|
||||
}
|
||||
#else
|
||||
// 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
pglCullFace(GL_BACK);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef KOS_GL_COMPATIBILITY
|
||||
pglLightfv(GL_LIGHT0, GL_POSITION, LightPos);
|
||||
|
@ -2006,7 +2018,9 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
pglTranslatef(pos->x, pos->z, pos->y);
|
||||
if (flipped)
|
||||
scaley = -scaley;
|
||||
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f);
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f); // rotate by slope from Kart
|
||||
#endif
|
||||
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
|
||||
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
|
||||
|
||||
|
@ -2182,9 +2196,13 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
|||
// keep a trace of the transformation for md2
|
||||
memcpy(&md2_transform, stransform, sizeof (md2_transform));
|
||||
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
// mirroring from Kart
|
||||
if (stransform->mirror)
|
||||
pglScalef(-stransform->scalex, stransform->scaley, -stransform->scalez);
|
||||
else if (stransform->flip)
|
||||
else
|
||||
#endif
|
||||
if (stransform->flip)
|
||||
pglScalef(stransform->scalex, -stransform->scaley, -stransform->scalez);
|
||||
else
|
||||
pglScalef(stransform->scalex, stransform->scaley, -stransform->scalez);
|
||||
|
|
Loading…
Reference in a new issue