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))))
|
||||
|
||||
// Kart features
|
||||
//#define USE_FTRANSFORM_ANGLEZ
|
||||
//#define USE_FTRANSFORM_MIRROR
|
||||
#define USE_FTRANSFORM_MIRROR
|
||||
|
||||
// Vanilla features
|
||||
#define USE_MODEL_NEXTFRAME
|
||||
|
@ -103,11 +102,7 @@ typedef struct FVector
|
|||
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;
|
||||
|
|
|
@ -1642,22 +1642,18 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
p.rollflip *= -1;
|
||||
}
|
||||
|
||||
p.anglez = 0.0f;
|
||||
p.anglex = 0.0f;
|
||||
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
// Slope rotation from Kart
|
||||
p.anglez = 0.0f;
|
||||
if (spr->mobj->modeltilt)
|
||||
if (spr->mobj->pitch)
|
||||
{
|
||||
fixed_t tempz = spr->mobj->modeltilt->normal.z;
|
||||
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));
|
||||
p.anglez = FIXED_TO_FLOAT(tempangle);
|
||||
tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
|
||||
p.anglex = FIXED_TO_FLOAT(tempangle);
|
||||
p.anglez = FIXED_TO_FLOAT(-AngleFixed(spr->mobj->pitch));
|
||||
}
|
||||
|
||||
if (spr->mobj->roll)
|
||||
{
|
||||
p.anglex = FIXED_TO_FLOAT(AngleFixed(spr->mobj->roll));
|
||||
}
|
||||
#endif
|
||||
|
||||
// SRB2CBTODO: MD2 scaling support
|
||||
finalscale *= FIXED_TO_FLOAT(interp.scale);
|
||||
|
|
|
@ -2815,9 +2815,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
|||
if (hflipped)
|
||||
scalez = -scalez;
|
||||
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
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->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_ExplodeMissile(mobj_t *mo);
|
||||
void P_CheckGravity(mobj_t *mo, boolean affect);
|
||||
void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope);
|
||||
|
||||
#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)
|
||||
{
|
||||
thing->standingslope = tmfloorslope;
|
||||
#ifdef HWRENDER
|
||||
thing->modeltilt = thing->standingslope;
|
||||
#endif
|
||||
P_SetPitchRollFromSlope(thing, thing->standingslope);
|
||||
|
||||
if (thing->momz == 0 && thing->player && !startingonground)
|
||||
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)
|
||||
{
|
||||
thing->standingslope = tmceilingslope;
|
||||
#ifdef HWRENDER
|
||||
thing->modeltilt = thing->standingslope;
|
||||
#endif
|
||||
P_SetPitchRollFromSlope(thing, thing->standingslope);
|
||||
|
||||
if (thing->momz == 0 && thing->player && !startingonground)
|
||||
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)
|
||||
|
||||
//
|
||||
|
@ -1985,9 +2005,7 @@ void P_XYMovement(mobj_t *mo)
|
|||
// 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
|
||||
mo->standingslope = oldslope;
|
||||
#ifdef HWRENDER
|
||||
mo->modeltilt = mo->standingslope;
|
||||
#endif
|
||||
P_SetPitchRollFromSlope(mo, mo->standingslope);
|
||||
P_SlopeLaunch(mo);
|
||||
|
||||
//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))
|
||||
{
|
||||
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
|
||||
#ifdef HWRENDER
|
||||
mo->modeltilt = mo->standingslope;
|
||||
#endif
|
||||
P_SetPitchRollFromSlope(mo, mo->standingslope);
|
||||
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||
}
|
||||
|
||||
|
|
|
@ -394,9 +394,6 @@ typedef struct mobj_s
|
|||
INT32 cvmem;
|
||||
|
||||
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 colorized; // Whether the mobj uses the rainbow colormap
|
||||
|
|
|
@ -2996,11 +2996,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
if (diff2 & MD2_HPREV)
|
||||
mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p);
|
||||
if (diff2 & MD2_SLOPE)
|
||||
{
|
||||
mobj->standingslope = P_SlopeById(READUINT16(save_p));
|
||||
#ifdef HWRENDER
|
||||
mobj->modeltilt = mobj->standingslope;
|
||||
#endif
|
||||
if (diff2 & MD2_COLORIZED)
|
||||
mobj->colorized = READUINT8(save_p);
|
||||
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
|
||||
{
|
||||
thing->standingslope = slope;
|
||||
#ifdef HWRENDER
|
||||
thing->modeltilt = thing->standingslope;
|
||||
#endif
|
||||
P_SetPitchRollFromSlope(thing, slope);
|
||||
|
||||
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
||||
thing->momz = -P_MobjFlip(thing);
|
||||
}
|
||||
|
@ -918,9 +917,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope)
|
|||
thing->momx = mom.x;
|
||||
thing->momy = mom.y;
|
||||
thing->standingslope = slope;
|
||||
#ifdef HWRENDER
|
||||
thing->modeltilt = thing->standingslope;
|
||||
#endif
|
||||
P_SetPitchRollFromSlope(thing, slope);
|
||||
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
||||
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->angle = (mobj->player ? mobj->player->drawangle : mobj->angle);
|
||||
ghost->roll = mobj->roll;
|
||||
ghost->pitch = mobj->pitch;
|
||||
ghost->rollangle = mobj->rollangle;
|
||||
|
||||
ghost->sprite = mobj->sprite;
|
||||
|
@ -1996,9 +1998,6 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
|||
ghost->fuse = ghost->info->damage;
|
||||
ghost->skin = mobj->skin;
|
||||
ghost->standingslope = mobj->standingslope;
|
||||
#ifdef HWRENDER
|
||||
ghost->modeltilt = mobj->modeltilt;
|
||||
#endif
|
||||
|
||||
if (mobj->flags2 & MF2_OBJECTFLIP)
|
||||
ghost->flags |= MF2_OBJECTFLIP;
|
||||
|
|
Loading…
Reference in a new issue