2016-05-18 00:42:11 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
2014-11-19 00:45:57 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
2024-01-30 02:55:12 +00:00
|
|
|
// Copyright (C) 2009 by Stephen McGranahan.
|
2023-03-31 12:53:31 +00:00
|
|
|
// Copyright (C) 2015-2023 by Sonic Team Junior.
|
2014-11-19 00:45:57 +00:00
|
|
|
//
|
2016-05-18 00:42:11 +00:00
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
2014-11-19 00:45:57 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
2016-05-18 00:42:11 +00:00
|
|
|
/// \file p_slopes.c
|
|
|
|
/// \brief ZDoom + Eternity Engine Slopes, ported and enhanced by Kalaron
|
2014-11-19 00:45:57 +00:00
|
|
|
|
2019-04-21 16:05:16 +00:00
|
|
|
#ifndef P_SLOPES_H__
|
|
|
|
#define P_SLOPES_H__
|
|
|
|
|
2024-01-30 01:08:22 +00:00
|
|
|
#include "m_fixed.h"
|
2019-04-19 12:14:43 +00:00
|
|
|
|
|
|
|
extern pslope_t *slopelist;
|
|
|
|
extern UINT16 slopecount;
|
|
|
|
|
2020-04-18 14:55:56 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TMSP_FRONTFLOOR,
|
|
|
|
TMSP_FRONTCEILING,
|
|
|
|
TMSP_BACKFLOOR,
|
|
|
|
TMSP_BACKCEILING,
|
|
|
|
} textmapslopeplane_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TMSC_FRONTTOBACKFLOOR = 1,
|
|
|
|
TMSC_BACKTOFRONTFLOOR = 1<<1,
|
|
|
|
TMSC_FRONTTOBACKCEILING = 1<<2,
|
|
|
|
TMSC_BACKTOFRONTCEILING = 1<<3,
|
|
|
|
} textmapslopecopy_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TMS_NONE,
|
|
|
|
TMS_FRONT,
|
|
|
|
TMS_BACK,
|
|
|
|
} textmapside_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TMSL_NOPHYSICS = 1,
|
2021-12-30 07:10:20 +00:00
|
|
|
TMSL_DYNAMIC = 1<<1,
|
|
|
|
TMSL_COPY = 1<<2,
|
2020-04-18 14:55:56 +00:00
|
|
|
} textmapslopeflags_t;
|
|
|
|
|
2019-04-20 11:06:06 +00:00
|
|
|
void P_LinkSlopeThinkers (void);
|
|
|
|
|
2016-03-03 05:47:06 +00:00
|
|
|
void P_CalculateSlopeNormal(pslope_t *slope);
|
2024-01-30 17:29:38 +00:00
|
|
|
void P_CalculateSlopeVectors(pslope_t *slope);
|
2021-06-02 08:57:57 +00:00
|
|
|
void P_InitSlopes(void);
|
2020-01-04 09:39:45 +00:00
|
|
|
void P_SpawnSlopes(const boolean fromsave);
|
2014-11-19 00:45:57 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// P_CopySectorSlope
|
|
|
|
//
|
|
|
|
// Searches through tagged sectors and copies
|
|
|
|
//
|
|
|
|
void P_CopySectorSlope(line_t *line);
|
|
|
|
|
2015-08-03 23:06:42 +00:00
|
|
|
pslope_t *P_SlopeById(UINT16 id);
|
|
|
|
|
2014-11-19 00:45:57 +00:00
|
|
|
// Returns the height of the sloped plane at (x, y) as a fixed_t
|
2020-05-18 13:23:56 +00:00
|
|
|
fixed_t P_GetSlopeZAt(const pslope_t *slope, fixed_t x, fixed_t y);
|
2020-03-22 14:17:16 +00:00
|
|
|
|
2020-05-18 13:23:56 +00:00
|
|
|
// Like P_GetSlopeZAt but falls back to z if slope is NULL
|
|
|
|
fixed_t P_GetZAt(const pslope_t *slope, fixed_t x, fixed_t y, fixed_t z);
|
2020-03-22 14:17:16 +00:00
|
|
|
|
|
|
|
// Returns the height of the sector at (x, y)
|
|
|
|
fixed_t P_GetSectorFloorZAt (const sector_t *sector, fixed_t x, fixed_t y);
|
|
|
|
fixed_t P_GetSectorCeilingZAt(const sector_t *sector, fixed_t x, fixed_t y);
|
|
|
|
|
|
|
|
// Returns the height of the FOF at (x, y)
|
|
|
|
fixed_t P_GetFFloorTopZAt (const ffloor_t *ffloor, fixed_t x, fixed_t y);
|
|
|
|
fixed_t P_GetFFloorBottomZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y);
|
|
|
|
|
|
|
|
// Returns the height of the light list at (x, y)
|
|
|
|
fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y);
|
2014-11-19 00:45:57 +00:00
|
|
|
|
2015-04-29 05:35:54 +00:00
|
|
|
// Lots of physics-based bullshit
|
2015-05-23 03:07:07 +00:00
|
|
|
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
|
2016-06-12 18:27:34 +00:00
|
|
|
void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
|
2015-04-29 05:35:54 +00:00
|
|
|
void P_SlopeLaunch(mobj_t *mo);
|
2017-01-23 01:39:12 +00:00
|
|
|
fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope);
|
2015-05-13 21:15:32 +00:00
|
|
|
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope);
|
2015-04-29 05:35:54 +00:00
|
|
|
void P_ButteredSlope(mobj_t *mo);
|
|
|
|
|
2024-01-30 01:08:22 +00:00
|
|
|
pslope_t *P_MakeSlopeViaEquationConstants(const double a, const double b, const double c, const double d);
|
2019-04-19 12:14:43 +00:00
|
|
|
|
|
|
|
/// Dynamic plane type enum for the thinker. Will have a different functionality depending on this.
|
|
|
|
typedef enum {
|
|
|
|
DP_FRONTFLOOR,
|
|
|
|
DP_FRONTCEIL,
|
|
|
|
DP_BACKFLOOR,
|
|
|
|
DP_BACKCEIL,
|
|
|
|
} dynplanetype_t;
|
|
|
|
|
|
|
|
/// Permit slopes to be dynamically altered through a thinker.
|
2019-04-18 12:43:34 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
thinker_t thinker;
|
2021-12-29 12:53:38 +00:00
|
|
|
pslope_t *slope;
|
2019-04-19 12:14:43 +00:00
|
|
|
dynplanetype_t type;
|
2021-12-29 12:53:38 +00:00
|
|
|
line_t *sourceline;
|
2019-04-19 12:14:43 +00:00
|
|
|
fixed_t extent;
|
2021-12-29 12:53:38 +00:00
|
|
|
} dynlineplanethink_t;
|
2019-04-19 12:14:43 +00:00
|
|
|
|
2021-12-29 12:53:38 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
thinker_t thinker;
|
|
|
|
pslope_t *slope;
|
2021-12-29 14:29:59 +00:00
|
|
|
sector_t *secs[3];
|
2019-04-19 12:14:43 +00:00
|
|
|
vector3_t vex[3];
|
2021-12-29 14:29:59 +00:00
|
|
|
fixed_t origsecheights[3];
|
|
|
|
fixed_t origvecheights[3];
|
|
|
|
UINT8 relative;
|
2021-12-29 12:53:38 +00:00
|
|
|
} dynvertexplanethink_t;
|
2014-11-19 00:45:57 +00:00
|
|
|
|
2021-12-29 12:53:38 +00:00
|
|
|
void T_DynamicSlopeLine (dynlineplanethink_t* th);
|
|
|
|
void T_DynamicSlopeVert (dynvertexplanethink_t* th);
|
2019-04-21 16:05:16 +00:00
|
|
|
#endif // #ifndef P_SLOPES_H__
|