mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Remove modeltilt, use roll & pitch instead
Broken currently, about half of the slopes you can go into have the wrong tilt
This commit is contained in:
parent
95cbee52c6
commit
ae233b000f
10 changed files with 41 additions and 48 deletions
|
@ -94,8 +94,7 @@ typedef struct FVector
|
||||||
//BP: transform order : scale(rotation_x(rotation_y(translation(v))))
|
//BP: transform order : scale(rotation_x(rotation_y(translation(v))))
|
||||||
|
|
||||||
// Kart features
|
// Kart features
|
||||||
//#define USE_FTRANSFORM_ANGLEZ
|
#define USE_FTRANSFORM_MIRROR
|
||||||
//#define USE_FTRANSFORM_MIRROR
|
|
||||||
|
|
||||||
// Vanilla features
|
// Vanilla features
|
||||||
#define USE_MODEL_NEXTFRAME
|
#define USE_MODEL_NEXTFRAME
|
||||||
|
@ -103,11 +102,7 @@ typedef struct FVector
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
FLOAT x,y,z; // position
|
FLOAT x,y,z; // position
|
||||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
|
||||||
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
||||||
#else
|
|
||||||
FLOAT anglex,angley; // aimingangle / viewangle
|
|
||||||
#endif
|
|
||||||
FLOAT scalex,scaley,scalez;
|
FLOAT scalex,scaley,scalez;
|
||||||
FLOAT fovxangle, fovyangle;
|
FLOAT fovxangle, fovyangle;
|
||||||
UINT8 splitscreen;
|
UINT8 splitscreen;
|
||||||
|
|
|
@ -1642,22 +1642,18 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
||||||
p.rollflip *= -1;
|
p.rollflip *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.anglez = 0.0f;
|
||||||
p.anglex = 0.0f;
|
p.anglex = 0.0f;
|
||||||
|
|
||||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
if (spr->mobj->pitch)
|
||||||
// Slope rotation from Kart
|
|
||||||
p.anglez = 0.0f;
|
|
||||||
if (spr->mobj->modeltilt)
|
|
||||||
{
|
{
|
||||||
fixed_t tempz = spr->mobj->modeltilt->normal.z;
|
p.anglez = FIXED_TO_FLOAT(-AngleFixed(spr->mobj->pitch));
|
||||||
fixed_t tempy = spr->mobj->modeltilt->normal.y;
|
}
|
||||||
fixed_t tempx = spr->mobj->modeltilt->normal.x;
|
|
||||||
fixed_t tempangle = AngleFixed(R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
|
if (spr->mobj->roll)
|
||||||
p.anglez = FIXED_TO_FLOAT(tempangle);
|
{
|
||||||
tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
|
p.anglex = FIXED_TO_FLOAT(AngleFixed(spr->mobj->roll));
|
||||||
p.anglex = FIXED_TO_FLOAT(tempangle);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// SRB2CBTODO: MD2 scaling support
|
// SRB2CBTODO: MD2 scaling support
|
||||||
finalscale *= FIXED_TO_FLOAT(interp.scale);
|
finalscale *= FIXED_TO_FLOAT(interp.scale);
|
||||||
|
|
|
@ -2815,9 +2815,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||||
if (hflipped)
|
if (hflipped)
|
||||||
scalez = -scalez;
|
scalez = -scalez;
|
||||||
|
|
||||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
|
||||||
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f); // rotate by slope from Kart
|
pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f); // rotate by slope from Kart
|
||||||
#endif
|
|
||||||
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
|
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
|
||||||
pglRotatef(pos->anglex, 1.0f, 0.0f, 0.0f);
|
pglRotatef(pos->anglex, 1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
|
|
@ -537,5 +537,6 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move);
|
||||||
void P_DoSuperTransformation(player_t *player, boolean giverings);
|
void P_DoSuperTransformation(player_t *player, boolean giverings);
|
||||||
void P_ExplodeMissile(mobj_t *mo);
|
void P_ExplodeMissile(mobj_t *mo);
|
||||||
void P_CheckGravity(mobj_t *mo, boolean affect);
|
void P_CheckGravity(mobj_t *mo, boolean affect);
|
||||||
|
void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope);
|
||||||
|
|
||||||
#endif // __P_LOCAL__
|
#endif // __P_LOCAL__
|
||||||
|
|
10
src/p_map.c
10
src/p_map.c
|
@ -2928,9 +2928,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
if (thing->momz <= 0)
|
if (thing->momz <= 0)
|
||||||
{
|
{
|
||||||
thing->standingslope = tmfloorslope;
|
thing->standingslope = tmfloorslope;
|
||||||
#ifdef HWRENDER
|
P_SetPitchRollFromSlope(thing, thing->standingslope);
|
||||||
thing->modeltilt = thing->standingslope;
|
|
||||||
#endif
|
|
||||||
if (thing->momz == 0 && thing->player && !startingonground)
|
if (thing->momz == 0 && thing->player && !startingonground)
|
||||||
P_PlayerHitFloor(thing->player, true);
|
P_PlayerHitFloor(thing->player, true);
|
||||||
}
|
}
|
||||||
|
@ -2942,9 +2941,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
if (thing->momz >= 0)
|
if (thing->momz >= 0)
|
||||||
{
|
{
|
||||||
thing->standingslope = tmceilingslope;
|
thing->standingslope = tmceilingslope;
|
||||||
#ifdef HWRENDER
|
P_SetPitchRollFromSlope(thing, thing->standingslope);
|
||||||
thing->modeltilt = thing->standingslope;
|
|
||||||
#endif
|
|
||||||
if (thing->momz == 0 && thing->player && !startingonground)
|
if (thing->momz == 0 && thing->player && !startingonground)
|
||||||
P_PlayerHitFloor(thing->player, true);
|
P_PlayerHitFloor(thing->player, true);
|
||||||
}
|
}
|
||||||
|
|
28
src/p_mobj.c
28
src/p_mobj.c
|
@ -1551,6 +1551,26 @@ void P_CheckGravity(mobj_t *mo, boolean affect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// P_SetPitchRollFromSlope
|
||||||
|
//
|
||||||
|
void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope)
|
||||||
|
{
|
||||||
|
if (slope)
|
||||||
|
{
|
||||||
|
fixed_t tempz = slope->normal.z;
|
||||||
|
fixed_t tempy = slope->normal.y;
|
||||||
|
fixed_t tempx = slope->normal.x;
|
||||||
|
|
||||||
|
mo->pitch = -R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx);
|
||||||
|
mo->roll = -R_PointToAngle2(0, 0, tempz, tempy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mo->pitch = mo->roll = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define STOPSPEED (FRACUNIT)
|
#define STOPSPEED (FRACUNIT)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1985,9 +2005,7 @@ void P_XYMovement(mobj_t *mo)
|
||||||
// Now compare the Zs of the different quantizations
|
// Now compare the Zs of the different quantizations
|
||||||
if (oldangle-newangle > ANG30 && oldangle-newangle < ANGLE_180) { // Allow for a bit of sticking - this value can be adjusted later
|
if (oldangle-newangle > ANG30 && oldangle-newangle < ANGLE_180) { // Allow for a bit of sticking - this value can be adjusted later
|
||||||
mo->standingslope = oldslope;
|
mo->standingslope = oldslope;
|
||||||
#ifdef HWRENDER
|
P_SetPitchRollFromSlope(mo, mo->standingslope);
|
||||||
mo->modeltilt = mo->standingslope;
|
|
||||||
#endif
|
|
||||||
P_SlopeLaunch(mo);
|
P_SlopeLaunch(mo);
|
||||||
|
|
||||||
//CONS_Printf("launched off of slope - ");
|
//CONS_Printf("launched off of slope - ");
|
||||||
|
@ -2560,9 +2578,7 @@ boolean P_ZMovement(mobj_t *mo)
|
||||||
if (((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) && (mo->type != MT_STEAM))
|
if (((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) && (mo->type != MT_STEAM))
|
||||||
{
|
{
|
||||||
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
|
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
|
||||||
#ifdef HWRENDER
|
P_SetPitchRollFromSlope(mo, mo->standingslope);
|
||||||
mo->modeltilt = mo->standingslope;
|
|
||||||
#endif
|
|
||||||
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -394,9 +394,6 @@ typedef struct mobj_s
|
||||||
INT32 cvmem;
|
INT32 cvmem;
|
||||||
|
|
||||||
struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?)
|
struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?)
|
||||||
#ifdef HWRENDER
|
|
||||||
struct pslope_s *modeltilt; // Slope used for model tilting. Also is not synched, this is totally visual.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
boolean resetinterp; // if true, some fields should not be interpolated (see R_InterpolateMobjState implementation)
|
boolean resetinterp; // if true, some fields should not be interpolated (see R_InterpolateMobjState implementation)
|
||||||
boolean colorized; // Whether the mobj uses the rainbow colormap
|
boolean colorized; // Whether the mobj uses the rainbow colormap
|
||||||
|
|
|
@ -2996,11 +2996,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
||||||
if (diff2 & MD2_HPREV)
|
if (diff2 & MD2_HPREV)
|
||||||
mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p);
|
mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p);
|
||||||
if (diff2 & MD2_SLOPE)
|
if (diff2 & MD2_SLOPE)
|
||||||
{
|
|
||||||
mobj->standingslope = P_SlopeById(READUINT16(save_p));
|
mobj->standingslope = P_SlopeById(READUINT16(save_p));
|
||||||
#ifdef HWRENDER
|
|
||||||
mobj->modeltilt = mobj->standingslope;
|
|
||||||
#endif
|
|
||||||
if (diff2 & MD2_COLORIZED)
|
if (diff2 & MD2_COLORIZED)
|
||||||
mobj->colorized = READUINT8(save_p);
|
mobj->colorized = READUINT8(save_p);
|
||||||
if (diff2 & MD2_MIRRORED)
|
if (diff2 & MD2_MIRRORED)
|
||||||
|
|
|
@ -899,9 +899,8 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope)
|
||||||
if (P_MobjFlip(thing)*(thing->momz) < 0) // falling, land on slope
|
if (P_MobjFlip(thing)*(thing->momz) < 0) // falling, land on slope
|
||||||
{
|
{
|
||||||
thing->standingslope = slope;
|
thing->standingslope = slope;
|
||||||
#ifdef HWRENDER
|
P_SetPitchRollFromSlope(thing, slope);
|
||||||
thing->modeltilt = thing->standingslope;
|
|
||||||
#endif
|
|
||||||
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
||||||
thing->momz = -P_MobjFlip(thing);
|
thing->momz = -P_MobjFlip(thing);
|
||||||
}
|
}
|
||||||
|
@ -918,9 +917,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope)
|
||||||
thing->momx = mom.x;
|
thing->momx = mom.x;
|
||||||
thing->momy = mom.y;
|
thing->momy = mom.y;
|
||||||
thing->standingslope = slope;
|
thing->standingslope = slope;
|
||||||
#ifdef HWRENDER
|
P_SetPitchRollFromSlope(thing, slope);
|
||||||
thing->modeltilt = thing->standingslope;
|
|
||||||
#endif
|
|
||||||
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
||||||
thing->momz = -P_MobjFlip(thing);
|
thing->momz = -P_MobjFlip(thing);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1976,6 +1976,8 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||||
ghost->colorized = mobj->colorized; // alternatively, "true" for sonic advance style colourisation
|
ghost->colorized = mobj->colorized; // alternatively, "true" for sonic advance style colourisation
|
||||||
|
|
||||||
ghost->angle = (mobj->player ? mobj->player->drawangle : mobj->angle);
|
ghost->angle = (mobj->player ? mobj->player->drawangle : mobj->angle);
|
||||||
|
ghost->roll = mobj->roll;
|
||||||
|
ghost->pitch = mobj->pitch;
|
||||||
ghost->rollangle = mobj->rollangle;
|
ghost->rollangle = mobj->rollangle;
|
||||||
|
|
||||||
ghost->sprite = mobj->sprite;
|
ghost->sprite = mobj->sprite;
|
||||||
|
@ -1996,9 +1998,6 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||||
ghost->fuse = ghost->info->damage;
|
ghost->fuse = ghost->info->damage;
|
||||||
ghost->skin = mobj->skin;
|
ghost->skin = mobj->skin;
|
||||||
ghost->standingslope = mobj->standingslope;
|
ghost->standingslope = mobj->standingslope;
|
||||||
#ifdef HWRENDER
|
|
||||||
ghost->modeltilt = mobj->modeltilt;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mobj->flags2 & MF2_OBJECTFLIP)
|
if (mobj->flags2 & MF2_OBJECTFLIP)
|
||||||
ghost->flags |= MF2_OBJECTFLIP;
|
ghost->flags |= MF2_OBJECTFLIP;
|
||||||
|
|
Loading…
Reference in a new issue