mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-04 15:31:05 +00:00
Rotate All MD2s to match their standing slopes
Needs to be tested in gravity flip Also flips the normal on linedef based slopes so that it's facing the correct direction Also makes it so slopelaunch doesn't always remove the standingslope (going down some slopes would cause it to be constantly unset and reset)
This commit is contained in:
parent
92d5a6b8fb
commit
683ebec120
6 changed files with 22 additions and 7 deletions
|
@ -104,7 +104,7 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
FLOAT x,y,z; // position
|
||||
FLOAT anglex,angley; // aimingangle / viewangle
|
||||
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
||||
FLOAT scalex,scaley,scalez;
|
||||
FLOAT fovxangle, fovyangle;
|
||||
UINT8 splitscreen;
|
||||
|
|
|
@ -5968,6 +5968,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
|
|||
// It should replace all other gr_viewxxx when finished
|
||||
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
atransform.anglez = 0.0f;
|
||||
|
||||
if (*type == postimg_flip)
|
||||
atransform.flip = true;
|
||||
|
@ -6230,6 +6231,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
|||
// It should replace all other gr_viewxxx when finished
|
||||
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
atransform.anglez = 0.0f;
|
||||
|
||||
if (*type == postimg_flip)
|
||||
atransform.flip = true;
|
||||
|
|
|
@ -1389,6 +1389,18 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
|||
p.angley = FIXED_TO_FLOAT(anglef);
|
||||
}
|
||||
p.anglex = 0.0f;
|
||||
p.anglez = 0.0f;
|
||||
if (spr->mobj->standingslope)
|
||||
{
|
||||
fixed_t tempz = spr->mobj->standingslope->normal.z;
|
||||
fixed_t tempy = spr->mobj->standingslope->normal.y;
|
||||
fixed_t tempx = spr->mobj->standingslope->normal.x;
|
||||
fixed_t tempangle = AngleFixed(R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
|
||||
p.anglez = FIXED_TO_FLOAT(tempangle);
|
||||
tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
|
||||
p.anglex = FIXED_TO_FLOAT(tempangle);
|
||||
}
|
||||
|
||||
|
||||
color[0] = Surf.FlatColor.s.red;
|
||||
color[1] = Surf.FlatColor.s.green;
|
||||
|
|
|
@ -1962,8 +1962,9 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration,
|
|||
pglTranslatef(pos->x, pos->z, pos->y);
|
||||
if (flipped)
|
||||
scaley = -scaley;
|
||||
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
|
||||
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f);
|
||||
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
|
||||
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
|
||||
|
||||
val = *gl_cmd_buffer++;
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ static UINT16 slopecount = 0;
|
|||
// Calculate line normal
|
||||
void P_CalculateSlopeNormal(pslope_t *slope) {
|
||||
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
||||
slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x);
|
||||
slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
|
||||
slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.x);
|
||||
slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.y);
|
||||
}
|
||||
|
||||
// With a vertex slope that has its vertices set, configure relevant slope info
|
||||
|
@ -812,11 +812,11 @@ void P_SlopeLaunch(mobj_t *mo)
|
|||
mo->momy = slopemom.y;
|
||||
mo->momz = slopemom.z;
|
||||
#endif
|
||||
}
|
||||
|
||||
//CONS_Printf("Launched off of slope.\n");
|
||||
mo->standingslope = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Function to help handle landing on slopes
|
||||
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope)
|
||||
|
|
Loading…
Reference in a new issue