mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-28 02:32:48 +00:00
Merge branch 'terrain-lump' into 'master'
TERRAIN lump See merge request KartKrew/Kart!480
This commit is contained in:
commit
69fa93f980
24 changed files with 2302 additions and 109 deletions
|
|
@ -111,4 +111,5 @@ k_botitem.c
|
|||
k_botsearch.c
|
||||
k_grandprix.c
|
||||
k_hud.c
|
||||
k_terrain.c
|
||||
k_brightmap.c
|
||||
|
|
|
|||
46
src/k_kart.c
46
src/k_kart.c
|
|
@ -33,6 +33,7 @@
|
|||
#include "k_waypoint.h"
|
||||
#include "k_bot.h"
|
||||
#include "k_hud.h"
|
||||
#include "k_terrain.h"
|
||||
|
||||
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
|
||||
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
|
||||
|
|
@ -1605,6 +1606,7 @@ static UINT8 K_CheckOffroadCollide(mobj_t *mo)
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
return 0; // couldn't find any offroad
|
||||
}
|
||||
|
||||
|
|
@ -1616,7 +1618,17 @@ static UINT8 K_CheckOffroadCollide(mobj_t *mo)
|
|||
*/
|
||||
static void K_UpdateOffroad(player_t *player)
|
||||
{
|
||||
fixed_t offroadstrength = (K_CheckOffroadCollide(player->mo) << FRACBITS);
|
||||
terrain_t *terrain = player->mo->terrain;
|
||||
fixed_t offroadstrength = 0;
|
||||
|
||||
if (terrain != NULL && terrain->offroad > 0)
|
||||
{
|
||||
offroadstrength = (terrain->offroad << FRACBITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
offroadstrength = (K_CheckOffroadCollide(player->mo) << FRACBITS);
|
||||
}
|
||||
|
||||
// If you are in offroad, a timer starts.
|
||||
if (offroadstrength)
|
||||
|
|
@ -4345,7 +4357,7 @@ void K_SpawnSparkleTrail(mobj_t *mo)
|
|||
sparkle->color = mo->color;
|
||||
}
|
||||
|
||||
void K_SpawnWipeoutTrail(mobj_t *mo, boolean offroad)
|
||||
void K_SpawnWipeoutTrail(mobj_t *mo)
|
||||
{
|
||||
mobj_t *dust;
|
||||
angle_t aoff;
|
||||
|
|
@ -4372,13 +4384,6 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean offroad)
|
|||
dust->destscale = mo->scale;
|
||||
P_SetScale(dust, mo->scale);
|
||||
K_FlipFromObject(dust, mo);
|
||||
|
||||
if (offroad) // offroad effect
|
||||
{
|
||||
dust->momx = mo->momx/2;
|
||||
dust->momy = mo->momy/2;
|
||||
dust->momz = P_GetMobjZMovement(mo)/2;
|
||||
}
|
||||
}
|
||||
|
||||
void K_SpawnDraftDust(mobj_t *mo)
|
||||
|
|
@ -5074,7 +5079,7 @@ void K_DoSneaker(player_t *player, INT32 type)
|
|||
{
|
||||
const fixed_t intendedboost = FRACUNIT/2;
|
||||
|
||||
if (!player->floorboost || player->floorboost == 3)
|
||||
if (player->floorboost == 0 || player->floorboost == 3)
|
||||
{
|
||||
const sfxenum_t normalsfx = sfx_cdfm01;
|
||||
const sfxenum_t smallsfx = sfx_cdfm40;
|
||||
|
|
@ -5097,7 +5102,7 @@ void K_DoSneaker(player_t *player, INT32 type)
|
|||
player->numsneakers++;
|
||||
}
|
||||
|
||||
if (!player->sneakertimer)
|
||||
if (player->sneakertimer == 0)
|
||||
{
|
||||
if (type == 2)
|
||||
{
|
||||
|
|
@ -5131,13 +5136,12 @@ void K_DoSneaker(player_t *player, INT32 type)
|
|||
{
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
K_PlayBoostTaunt(player->mo);
|
||||
|
||||
}
|
||||
|
||||
player->sneakertimer = sneakertime;
|
||||
|
||||
// set angle for spun out players:
|
||||
player->boostangle = (INT32)player->mo->angle;
|
||||
player->boostangle = player->mo->angle;
|
||||
}
|
||||
|
||||
static void K_DoShrink(player_t *user)
|
||||
|
|
@ -5219,6 +5223,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
|
|||
return;
|
||||
|
||||
mo->standingslope = NULL;
|
||||
mo->terrain = NULL;
|
||||
|
||||
mo->eflags |= MFE_SPRUNG;
|
||||
|
||||
|
|
@ -6662,7 +6667,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
// update boost angle if not spun out
|
||||
if (!player->spinouttimer && !player->wipeoutslow)
|
||||
player->boostangle = (INT32)player->mo->angle;
|
||||
player->boostangle = player->mo->angle;
|
||||
|
||||
K_GetKartBoostPower(player);
|
||||
|
||||
|
|
@ -6710,16 +6715,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
ghost->renderflags |= RF_DONTDRAW;
|
||||
}
|
||||
|
||||
// Could probably be moved somewhere else.
|
||||
K_HandleFootstepParticles(player->mo);
|
||||
|
||||
if (P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
// Offroad dust
|
||||
if (player->boostpower < FRACUNIT)
|
||||
{
|
||||
K_SpawnWipeoutTrail(player->mo, true);
|
||||
if (leveltime % 6 == 0)
|
||||
S_StartSound(player->mo, sfx_cdfm70);
|
||||
}
|
||||
|
||||
// Draft dust
|
||||
if (player->draftpower >= FRACUNIT)
|
||||
{
|
||||
|
|
@ -6935,7 +6935,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
if (player->sneakertimer && player->wipeoutslow > 0 && player->wipeoutslow < wipeoutslowtime+1)
|
||||
player->wipeoutslow = wipeoutslowtime+1;
|
||||
|
||||
if (player->floorboost)
|
||||
if (player->floorboost > 0)
|
||||
player->floorboost--;
|
||||
|
||||
if (player->driftboost)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ void K_RunFinishLineBeam(void);
|
|||
UINT16 K_DriftSparkColor(player_t *player, INT32 charge);
|
||||
void K_SpawnBoostTrail(player_t *player);
|
||||
void K_SpawnSparkleTrail(mobj_t *mo);
|
||||
void K_SpawnWipeoutTrail(mobj_t *mo, boolean offroad);
|
||||
void K_SpawnWipeoutTrail(mobj_t *mo);
|
||||
void K_SpawnDraftDust(mobj_t *mo);
|
||||
void K_DriftDustHandling(mobj_t *spawner);
|
||||
void K_Squish(mobj_t *mo);
|
||||
|
|
|
|||
1532
src/k_terrain.c
Normal file
1532
src/k_terrain.c
Normal file
File diff suppressed because it is too large
Load diff
459
src/k_terrain.h
Normal file
459
src/k_terrain.h
Normal file
|
|
@ -0,0 +1,459 @@
|
|||
// DR. ROBOTNIK'S RING RACERS
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2021 by ZDoom + GZDoom teams, and contributors
|
||||
// Copyright (C) 2021 by Sally "TehRealSalt" Cochenour
|
||||
// Copyright (C) 2021 by Kart Krew
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file k_terrain.h
|
||||
/// \brief Implementation of a TERRAIN-style lump for DRRR, ala GZDoom's codebase.
|
||||
|
||||
#ifndef __K_TERRAIN_H__
|
||||
#define __K_TERRAIN_H__
|
||||
|
||||
#include "doomdata.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
#include "m_fixed.h"
|
||||
#include "p_mobj.h"
|
||||
|
||||
#define TERRAIN_NAME_LEN 32
|
||||
|
||||
typedef struct t_splash_s
|
||||
{
|
||||
// Splash definition.
|
||||
// These are particles spawned when hitting the floor.
|
||||
|
||||
char name[TERRAIN_NAME_LEN]; // Lookup name.
|
||||
|
||||
UINT16 mobjType; // Thing type. MT_NULL to not spawn anything.
|
||||
UINT16 sfx; // Sound to play.
|
||||
fixed_t scale; // Thing scale multiplier.
|
||||
UINT16 color; // Colorize effect. SKINCOLOR_NONE has no colorize.
|
||||
|
||||
fixed_t pushH; // Push-out horizontal multiplier.
|
||||
fixed_t pushV; // Push-out vertical multiplier.
|
||||
fixed_t spread; // Randomized spread distance.
|
||||
angle_t cone; // Randomized angle of the push-out.
|
||||
|
||||
UINT8 numParticles; // Number of particles to spawn.
|
||||
} t_splash_t;
|
||||
|
||||
typedef struct t_footstep_s
|
||||
{
|
||||
// Footstep definition.
|
||||
// These are particles spawned when moving fast enough on a floor.
|
||||
|
||||
char name[TERRAIN_NAME_LEN]; // Lookup name.
|
||||
|
||||
UINT16 mobjType; // Thing type. MT_NULL to not spawn anything.
|
||||
UINT16 sfx; // Sound to play.
|
||||
fixed_t scale; // Thing scale multiplier.
|
||||
UINT16 color; // Colorize effect. SKINCOLOR_NONE has no colorize.
|
||||
|
||||
fixed_t pushH; // Push-out horizontal multiplier.
|
||||
fixed_t pushV; // Push-out vertical multiplier.
|
||||
fixed_t spread; // Randomized spread distance.
|
||||
angle_t cone; // Randomized angle of the push-out.
|
||||
|
||||
tic_t sfxFreq; // How frequently to play the sound.
|
||||
tic_t frequency; // How frequently to spawn the particles.
|
||||
fixed_t requiredSpeed; // Speed percentage you need to be at to trigger the particles.
|
||||
} t_footstep_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// Terrain flag values.
|
||||
TRF_LIQUID = 1, // Texture water properties (wavy, slippery, etc)
|
||||
TRF_SNEAKERPANEL = 1<<1, // Texture is a booster
|
||||
TRF_STAIRJANK = 1<<2, // Texture is bumpy road
|
||||
TRF_TRIPWIRE = 1<<3 // Texture is a tripwire when used as a midtexture
|
||||
} terrain_flags_t;
|
||||
|
||||
typedef struct terrain_s
|
||||
{
|
||||
// Terrain definition.
|
||||
// These are all of the properties that the floor gets.
|
||||
|
||||
char name[TERRAIN_NAME_LEN]; // Lookup name.
|
||||
|
||||
size_t splashID; // Splash defintion ID.
|
||||
size_t footstepID; // Footstep defintion ID.
|
||||
|
||||
fixed_t friction; // The default friction of this texture.
|
||||
UINT8 offroad; // The default offroad level of this texture.
|
||||
INT16 damageType; // The default damage type of this texture. (Negative means no damage).
|
||||
UINT8 trickPanel; // Trick panel strength
|
||||
UINT32 flags; // Flag values (see: terrain_flags_t)
|
||||
} terrain_t;
|
||||
|
||||
typedef struct t_floor_s
|
||||
{
|
||||
// Terrain floor definition.
|
||||
// Ties texture names to a .
|
||||
|
||||
// (Could be optimized by using texture IDs instead of names,
|
||||
// but was concerned because I recall sooomething about those not being netsafe?
|
||||
// Someone confirm if I just hallucinated that. :V)
|
||||
|
||||
char textureName[9]; // Floor texture name.
|
||||
size_t terrainID; // Terrain definition ID.
|
||||
} t_floor_t;
|
||||
|
||||
/*--------------------------------------------------
|
||||
size_t K_GetSplashHeapIndex(t_splash_t *splash);
|
||||
|
||||
Returns a splash defintion's index in the
|
||||
splash definition heap.
|
||||
|
||||
Input Arguments:-
|
||||
splash - The splash definition to return the index of.
|
||||
|
||||
Return:-
|
||||
The splash heap index, SIZE_MAX if the splash was invalid.
|
||||
--------------------------------------------------*/
|
||||
|
||||
size_t K_GetSplashHeapIndex(t_splash_t *splash);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
size_t K_GetNumSplashDefs(void);
|
||||
|
||||
Returns the number of splash definitions.
|
||||
|
||||
Input Arguments:-
|
||||
None
|
||||
|
||||
Return:-
|
||||
Length of splashDefs.
|
||||
--------------------------------------------------*/
|
||||
|
||||
size_t K_GetNumSplashDefs(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
t_splash_t *K_GetSplashByIndex(size_t checkIndex);
|
||||
|
||||
Retrieves a splash definition by its heap index.
|
||||
|
||||
Input Arguments:-
|
||||
checkIndex - The heap index to retrieve.
|
||||
|
||||
Return:-
|
||||
The splash definition, NULL if it didn't exist.
|
||||
--------------------------------------------------*/
|
||||
|
||||
t_splash_t *K_GetSplashByIndex(size_t checkIndex);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
t_splash_t *K_GetSplashByName(const char *checkName);
|
||||
|
||||
Retrieves a splash definition by its lookup name.
|
||||
|
||||
Input Arguments:-
|
||||
checkName - The lookup name to retrieve.
|
||||
|
||||
Return:-
|
||||
The splash definition, NULL if it didn't exist.
|
||||
--------------------------------------------------*/
|
||||
|
||||
t_splash_t *K_GetSplashByName(const char *checkName);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
size_t K_GetFootstepHeapIndex(t_footstep_t *footstep);
|
||||
|
||||
Returns a footstep defintion's index in the
|
||||
footstep definition heap.
|
||||
|
||||
Input Arguments:-
|
||||
footstep - The footstep definition to return the index of.
|
||||
|
||||
Return:-
|
||||
The footstep heap index, SIZE_MAX if the footstep was invalid.
|
||||
--------------------------------------------------*/
|
||||
|
||||
size_t K_GetFootstepHeapIndex(t_footstep_t *footstep);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
size_t K_GetNumFootstepDefs(void);
|
||||
|
||||
Returns the number of footstep definitions.
|
||||
|
||||
Input Arguments:-
|
||||
None
|
||||
|
||||
Return:-
|
||||
Length of footstepDefs.
|
||||
--------------------------------------------------*/
|
||||
|
||||
size_t K_GetNumFootstepDefs(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
t_footstep_t *K_GetFootstepByIndex(size_t checkIndex);
|
||||
|
||||
Retrieves a footstep definition by its heap index.
|
||||
|
||||
Input Arguments:-
|
||||
checkIndex - The heap index to retrieve.
|
||||
|
||||
Return:-
|
||||
The footstep definition, NULL if it didn't exist.
|
||||
--------------------------------------------------*/
|
||||
|
||||
t_footstep_t *K_GetFootstepByIndex(size_t checkIndex);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
t_footstep_t *K_GetFootstepByName(const char *checkName);
|
||||
|
||||
Retrieves a footstep definition by its lookup name.
|
||||
|
||||
Input Arguments:-
|
||||
checkName - The lookup name to retrieve.
|
||||
|
||||
Return:-
|
||||
The footstep definition, NULL if it didn't exist.
|
||||
--------------------------------------------------*/
|
||||
|
||||
t_footstep_t *K_GetFootstepByName(const char *checkName);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
size_t K_GetTerrainHeapIndex(terrain_t *terrain);
|
||||
|
||||
Returns a terrain defintion's index in the
|
||||
terrain definition heap.
|
||||
|
||||
Input Arguments:-
|
||||
terrain - The terrain definition to return the index of.
|
||||
|
||||
Return:-
|
||||
The terrain heap index, SIZE_MAX if the terrain was invalid.
|
||||
--------------------------------------------------*/
|
||||
|
||||
size_t K_GetTerrainHeapIndex(terrain_t *terrain);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
size_t K_GetNumTerrainDefs(void);
|
||||
|
||||
Returns the number of terrain definitions.
|
||||
|
||||
Input Arguments:-
|
||||
None
|
||||
|
||||
Return:-
|
||||
Length of terrainDefs.
|
||||
--------------------------------------------------*/
|
||||
|
||||
size_t K_GetNumTerrainDefs(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
terrain_t *K_GetTerrainByIndex(size_t checkIndex);
|
||||
|
||||
Retrieves a terrain definition by its heap index.
|
||||
|
||||
Input Arguments:-
|
||||
checkIndex - The heap index to retrieve.
|
||||
|
||||
Return:-
|
||||
The terrain definition, NULL if it didn't exist.
|
||||
--------------------------------------------------*/
|
||||
|
||||
terrain_t *K_GetTerrainByIndex(size_t checkIndex);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
terrain_t *K_GetTerrainByName(const char *checkName);
|
||||
|
||||
Retrieves a terrain definition by its lookup name.
|
||||
|
||||
Input Arguments:-
|
||||
checkName - The lookup name to retrieve.
|
||||
|
||||
Return:-
|
||||
The terrain definition, NULL if it didn't exist.
|
||||
--------------------------------------------------*/
|
||||
|
||||
terrain_t *K_GetTerrainByName(const char *checkName);
|
||||
|
||||
/*--------------------------------------------------
|
||||
terrain_t *K_GetDefaultTerrain(void);
|
||||
|
||||
Returns the default terrain definition, used
|
||||
in cases where terrain is not set for a texture.
|
||||
|
||||
Input Arguments:-
|
||||
None
|
||||
|
||||
Return:-
|
||||
The default terrain definition, NULL if it didn't exist.
|
||||
--------------------------------------------------*/
|
||||
|
||||
terrain_t *K_GetDefaultTerrain(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
terrain_t *K_GetTerrainForTextureName(const char *checkName);
|
||||
|
||||
Returns the terrain definition applied to
|
||||
the texture name inputted.
|
||||
|
||||
Input Arguments:-
|
||||
checkName - The texture's name.
|
||||
|
||||
Return:-
|
||||
The texture's terrain definition if it exists,
|
||||
otherwise the default terrain if it exists,
|
||||
otherwise NULL.
|
||||
--------------------------------------------------*/
|
||||
|
||||
terrain_t *K_GetTerrainForTextureName(const char *checkName);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
terrain_t *K_GetTerrainForTextureNum(INT32 textureNum);
|
||||
|
||||
Returns the terrain definition applied to
|
||||
the texture ID inputted.
|
||||
|
||||
Input Arguments:-
|
||||
textureNum - The texture's ID.
|
||||
|
||||
Return:-
|
||||
The texture's terrain definition if it exists,
|
||||
otherwise the default terrain if it exists,
|
||||
otherwise NULL.
|
||||
--------------------------------------------------*/
|
||||
|
||||
terrain_t *K_GetTerrainForTextureNum(INT32 textureNum);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
terrain_t *K_GetTerrainForFlatNum(INT32 flatID);
|
||||
|
||||
Returns the terrain definition applied to
|
||||
the level flat ID.
|
||||
|
||||
Input Arguments:-
|
||||
flatID - The level flat's ID.
|
||||
|
||||
Return:-
|
||||
The level flat's terrain definition if it exists,
|
||||
otherwise the default terrain if it exists,
|
||||
otherwise NULL.
|
||||
--------------------------------------------------*/
|
||||
|
||||
terrain_t *K_GetTerrainForFlatNum(INT32 flatID);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_UpdateMobjTerrain(mobj_t *mo, INT32 flatID);
|
||||
|
||||
Updates an object's terrain pointer, based on
|
||||
the level flat ID supplied. Intended to be called
|
||||
when the object moves to new floors.
|
||||
|
||||
Input Arguments:-
|
||||
mo - The object to update.
|
||||
flatID - The level flat ID the object is standing on.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_UpdateMobjTerrain(mobj_t *mo, INT32 flatID);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_ProcessTerrainEffect(mobj_t *mo);
|
||||
|
||||
Handles applying terrain effects to the object,
|
||||
intended to be called in a thinker.
|
||||
|
||||
Currently only intended for players, but
|
||||
could be modified to be inclusive of all
|
||||
object types.
|
||||
|
||||
Input Arguments:-
|
||||
mo - The object to apply effects to.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_ProcessTerrainEffect(mobj_t *mo);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_SetDefaultFriction(mobj_t *mo);
|
||||
|
||||
Resets an object to their default friction values.
|
||||
If they are on terrain with different friction,
|
||||
they will update to that value.
|
||||
|
||||
Input Arguments:-
|
||||
mo - The object to reset the friction values of.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_SetDefaultFriction(mobj_t *mo);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_SpawnSplashForMobj(mobj_t *mo, fixed_t impact);
|
||||
|
||||
Spawns the splash particles for an object's
|
||||
terrain type. Intended to be called when hitting a floor.
|
||||
|
||||
Input Arguments:-
|
||||
mo - The object to spawn a splash for.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
void K_SpawnSplashForMobj(mobj_t *mo, fixed_t impact);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_HandleFootstepParticles(mobj_t *mo);
|
||||
|
||||
Spawns the footstep particles for an object's
|
||||
terrain type. Intended to be called every tic.
|
||||
|
||||
Input Arguments:-
|
||||
mo - The object to spawn footsteps for.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_HandleFootstepParticles(mobj_t *mo);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_InitTerrain(UINT16 wadNum);
|
||||
|
||||
Finds the TERRAIN lumps in a WAD/PK3, and
|
||||
processes all of them.
|
||||
|
||||
Input Arguments:-
|
||||
wadNum - WAD file ID to process.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_InitTerrain(UINT16 wadNum);
|
||||
|
||||
#endif // __K_TERRAIN_H__
|
||||
|
|
@ -3624,11 +3624,10 @@ static int lib_kSpawnSparkleTrail(lua_State *L)
|
|||
static int lib_kSpawnWipeoutTrail(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
boolean offroad = lua_optboolean(L, 2);
|
||||
NOHUD
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpawnWipeoutTrail(mo, offroad);
|
||||
K_SpawnWipeoutTrail(mo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -494,9 +494,6 @@ static int mobj_set(lua_State *L)
|
|||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter mobj_t in CMD building code!");
|
||||
|
||||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter mobj_t in BuildCMD code!");
|
||||
|
||||
switch(field)
|
||||
{
|
||||
case mobj_valid:
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ static int player_get(lua_State *L)
|
|||
else if (fastcmp(field,"handleboost"))
|
||||
lua_pushinteger(L, plr->handleboost);
|
||||
else if (fastcmp(field,"boostangle"))
|
||||
lua_pushinteger(L, plr->boostangle);
|
||||
lua_pushangle(L, plr->boostangle);
|
||||
else if (fastcmp(field,"draftpower"))
|
||||
lua_pushinteger(L, plr->draftpower);
|
||||
else if (fastcmp(field,"draftleeway"))
|
||||
|
|
@ -499,9 +499,6 @@ static int player_set(lua_State *L)
|
|||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter player_t in CMD building code!");
|
||||
|
||||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter player_t in BuildCMD code!");
|
||||
|
||||
if (fastcmp(field,"mo")) {
|
||||
mobj_t *newmo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
plr->mo->player = NULL; // remove player pointer from old mobj
|
||||
|
|
@ -626,7 +623,7 @@ static int player_set(lua_State *L)
|
|||
else if (fastcmp(field,"handleboost"))
|
||||
plr->handleboost = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"boostangle"))
|
||||
plr->boostangle = luaL_checkinteger(L, 3);
|
||||
plr->boostangle = luaL_checkangle(L, 3);
|
||||
else if (fastcmp(field,"draftpower"))
|
||||
plr->draftpower = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"draftleeway"))
|
||||
|
|
@ -861,7 +858,7 @@ static int karthud_set(lua_State *L)
|
|||
if (hud_running)
|
||||
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
||||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter player_t in BuildCMD code!");
|
||||
return luaL_error(L, "Do not alter player_t in CMD building code!");
|
||||
karthud[ks] = i;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1054,6 +1054,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
target->flags |= MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY;
|
||||
P_SetThingPosition(target);
|
||||
target->standingslope = NULL;
|
||||
target->terrain = NULL;
|
||||
target->pmomz = 0;
|
||||
|
||||
target->player->playerstate = PST_DEAD;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec);
|
|||
boolean P_IsObjectOnRealGround(mobj_t *mo, sector_t *sec); // SRB2Kart
|
||||
#define P_IsObjectFlipped(o) ((o)->eflags & MFE_VERTICALFLIP)
|
||||
boolean P_InQuicksand(mobj_t *mo);
|
||||
boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff);
|
||||
boolean P_PlayerHitFloor(player_t *player, boolean fromAir);
|
||||
|
||||
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
||||
void P_RestoreMusic(player_t *player);
|
||||
|
|
@ -385,6 +385,7 @@ extern camera_t *mapcampointer;
|
|||
extern fixed_t tmx;
|
||||
extern fixed_t tmy;
|
||||
extern pslope_t *tmfloorslope, *tmceilingslope;
|
||||
extern INT32 tmfloorpic, tmceilingpic;
|
||||
|
||||
/* cphipps 2004/08/30 */
|
||||
extern void P_MapStart(void);
|
||||
|
|
|
|||
51
src/p_map.c
51
src/p_map.c
|
|
@ -24,12 +24,13 @@
|
|||
#include "r_sky.h"
|
||||
#include "s_sound.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
#include "k_kart.h" // SRB2kart 011617
|
||||
#include "k_collide.h"
|
||||
#include "k_respawn.h"
|
||||
|
||||
#include "hu_stuff.h" // SRB2kart
|
||||
#include "i_system.h" // SRB2kart
|
||||
#include "k_terrain.h"
|
||||
|
||||
#include "r_splats.h"
|
||||
|
||||
|
|
@ -60,6 +61,7 @@ mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz
|
|||
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
||||
ffloor_t *tmfloorrover, *tmceilingrover;
|
||||
pslope_t *tmfloorslope, *tmceilingslope;
|
||||
INT32 tmfloorpic, tmceilingpic;
|
||||
static fixed_t tmfloorstep;
|
||||
static fixed_t tmceilingstep;
|
||||
|
||||
|
|
@ -325,6 +327,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
}
|
||||
|
||||
object->standingslope = NULL; // Okay, now we know it's not going to be relevant - no launching off at silly angles for you.
|
||||
object->terrain = NULL;
|
||||
|
||||
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
|
||||
|
|
@ -466,6 +469,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
|||
}
|
||||
|
||||
object->standingslope = NULL; // No launching off at silly angles for you.
|
||||
object->terrain = NULL;
|
||||
|
||||
switch (spring->type)
|
||||
{
|
||||
|
|
@ -1452,6 +1456,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
tmfloorz = thing->z + thing->height;
|
||||
tmfloorrover = NULL;
|
||||
tmfloorslope = NULL;
|
||||
tmfloorpic = -1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1471,6 +1476,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
tmfloorz = tmceilingz = topz; // block while in air
|
||||
tmceilingrover = NULL;
|
||||
tmceilingslope = NULL;
|
||||
tmceilingpic = -1;
|
||||
tmfloorthing = thing; // needed for side collision
|
||||
}
|
||||
else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height)
|
||||
|
|
@ -1478,6 +1484,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
tmceilingz = topz;
|
||||
tmceilingrover = NULL;
|
||||
tmceilingslope = NULL;
|
||||
tmceilingpic = -1;
|
||||
tmfloorthing = thing; // thing we may stand on
|
||||
}
|
||||
}
|
||||
|
|
@ -1493,6 +1500,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
tmceilingz = thing->z;
|
||||
tmceilingrover = NULL;
|
||||
tmceilingslope = NULL;
|
||||
tmceilingpic = -1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1512,6 +1520,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
tmfloorz = tmceilingz = topz; // block while in air
|
||||
tmfloorrover = NULL;
|
||||
tmfloorslope = NULL;
|
||||
tmfloorpic = -1;
|
||||
tmfloorthing = thing; // needed for side collision
|
||||
}
|
||||
else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z)
|
||||
|
|
@ -1519,6 +1528,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
tmfloorz = topz;
|
||||
tmfloorrover = NULL;
|
||||
tmfloorslope = NULL;
|
||||
tmfloorpic = -1;
|
||||
tmfloorthing = thing; // thing we may stand on
|
||||
}
|
||||
}
|
||||
|
|
@ -1698,6 +1708,7 @@ static boolean PIT_CheckLine(line_t *ld)
|
|||
ceilingline = ld;
|
||||
tmceilingrover = openceilingrover;
|
||||
tmceilingslope = opentopslope;
|
||||
tmceilingpic = opentoppic;
|
||||
tmceilingstep = openceilingstep;
|
||||
if (thingtop == tmthing->ceilingz)
|
||||
{
|
||||
|
|
@ -1710,6 +1721,7 @@ static boolean PIT_CheckLine(line_t *ld)
|
|||
tmfloorz = openbottom;
|
||||
tmfloorrover = openfloorrover;
|
||||
tmfloorslope = openbottomslope;
|
||||
tmfloorpic = openbottompic;
|
||||
tmfloorstep = openfloorstep;
|
||||
if (tmthing->z == tmthing->floorz)
|
||||
{
|
||||
|
|
@ -1806,6 +1818,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
tmceilingrover = NULL;
|
||||
tmfloorslope = newsubsec->sector->f_slope;
|
||||
tmceilingslope = newsubsec->sector->c_slope;
|
||||
tmfloorpic = newsubsec->sector->floorpic;
|
||||
tmceilingpic = newsubsec->sector->ceilingpic;
|
||||
|
||||
tmfloorstep = 0;
|
||||
tmceilingstep = 0;
|
||||
|
|
@ -1859,6 +1873,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
tmfloorz = topheight - sinklevel;
|
||||
tmfloorrover = rover;
|
||||
tmfloorslope = *rover->t_slope;
|
||||
tmfloorpic = *rover->toppic;
|
||||
}
|
||||
}
|
||||
else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0)
|
||||
|
|
@ -1867,6 +1882,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
tmceilingz = bottomheight + sinklevel;
|
||||
tmceilingrover = rover;
|
||||
tmceilingslope = *rover->b_slope;
|
||||
tmceilingpic = *rover->bottompic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1890,6 +1906,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
tmfloorz = thing->z;
|
||||
tmfloorrover = rover;
|
||||
tmfloorslope = NULL;
|
||||
tmfloorpic = *rover->toppic;
|
||||
}
|
||||
}
|
||||
// Quicksand blocks never change heights otherwise.
|
||||
|
|
@ -1907,6 +1924,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
tmfloorz = tmdropoffz = topheight;
|
||||
tmfloorrover = rover;
|
||||
tmfloorslope = *rover->t_slope;
|
||||
tmfloorpic = *rover->toppic;
|
||||
}
|
||||
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
|
||||
&& !(rover->flags & FF_PLATFORM)
|
||||
|
|
@ -1915,6 +1933,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
tmceilingz = tmdrpoffceilz = bottomheight;
|
||||
tmceilingrover = rover;
|
||||
tmceilingslope = *rover->b_slope;
|
||||
tmceilingpic = *rover->bottompic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1989,12 +2008,14 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
tmfloorz = tmdropoffz = polytop;
|
||||
tmfloorslope = NULL;
|
||||
tmfloorrover = NULL;
|
||||
tmfloorpic = polysec->ceilingpic;
|
||||
}
|
||||
|
||||
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) {
|
||||
tmceilingz = tmdrpoffceilz = polybottom;
|
||||
tmceilingslope = NULL;
|
||||
tmceilingrover = NULL;
|
||||
tmceilingpic = polysec->floorpic;
|
||||
}
|
||||
}
|
||||
plink = (polymaplink_t *)(plink->link.next);
|
||||
|
|
@ -2412,6 +2433,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
|
|||
ffloor_t *oldceilrover = tmceilingrover;
|
||||
pslope_t *oldfslope = tmfloorslope;
|
||||
pslope_t *oldcslope = tmceilingslope;
|
||||
INT32 oldfpic = tmfloorpic;
|
||||
INT32 oldcpic = tmceilingpic;
|
||||
|
||||
// Move the player
|
||||
P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true);
|
||||
|
|
@ -2428,6 +2451,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
|
|||
tmceilingrover = oldceilrover;
|
||||
tmfloorslope = oldfslope;
|
||||
tmceilingslope = oldcslope;
|
||||
tmfloorpic = oldfpic;
|
||||
tmceilingpic = oldcpic;
|
||||
thing->momz = stand->momz;
|
||||
}
|
||||
else
|
||||
|
|
@ -2677,9 +2702,14 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
if (!(thing->flags & MF_NOCLIPHEIGHT))
|
||||
{
|
||||
// Assign thing's standingslope if needed
|
||||
if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP)) {
|
||||
if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP))
|
||||
{
|
||||
K_UpdateMobjTerrain(thing, tmfloorpic);
|
||||
|
||||
if (!startingonground && tmfloorslope)
|
||||
{
|
||||
P_HandleSlopeLanding(thing, tmfloorslope);
|
||||
}
|
||||
|
||||
if (thing->momz <= 0)
|
||||
{
|
||||
|
|
@ -2687,12 +2717,19 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
P_SetPitchRollFromSlope(thing, thing->standingslope);
|
||||
|
||||
if (thing->momz == 0 && thing->player && !startingonground)
|
||||
{
|
||||
P_PlayerHitFloor(thing->player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) {
|
||||
else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP))
|
||||
{
|
||||
K_UpdateMobjTerrain(thing, tmceilingpic);
|
||||
|
||||
if (!startingonground && tmceilingslope)
|
||||
{
|
||||
P_HandleSlopeLanding(thing, tmceilingslope);
|
||||
}
|
||||
|
||||
if (thing->momz >= 0)
|
||||
{
|
||||
|
|
@ -2700,12 +2737,18 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
P_SetPitchRollFromSlope(thing, thing->standingslope);
|
||||
|
||||
if (thing->momz == 0 && thing->player && !startingonground)
|
||||
{
|
||||
P_PlayerHitFloor(thing->player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // don't set standingslope if you're not going to clip against it
|
||||
else
|
||||
{
|
||||
// don't set standingslope if you're not going to clip against it
|
||||
thing->standingslope = NULL;
|
||||
thing->terrain = NULL;
|
||||
}
|
||||
|
||||
/* FIXME: slope step down (even up) has some false
|
||||
positives, so just ignore them entirely. */
|
||||
|
|
|
|||
|
|
@ -342,6 +342,7 @@ fixed_t openceilingstep;
|
|||
fixed_t openceilingdrop;
|
||||
fixed_t openfloorstep;
|
||||
fixed_t openfloordrop;
|
||||
INT32 opentoppic, openbottompic;
|
||||
|
||||
// P_CameraLineOpening
|
||||
// P_LineOpening, but for camera
|
||||
|
|
@ -537,6 +538,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
highceiling = INT32_MIN;
|
||||
lowfloor = INT32_MAX;
|
||||
opentopslope = openbottomslope = NULL;
|
||||
opentoppic = openbottompic = -1;
|
||||
openceilingstep = 0;
|
||||
openceilingdrop = 0;
|
||||
openfloorstep = 0;
|
||||
|
|
@ -556,6 +558,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
opentop = height[lo];
|
||||
highceiling = height[hi];
|
||||
opentopslope = sector[lo]->c_slope;
|
||||
opentoppic = sector[lo]->ceilingpic;
|
||||
|
||||
if (mobj)
|
||||
{
|
||||
|
|
@ -575,6 +578,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
openbottom = height[hi];
|
||||
lowfloor = height[lo];
|
||||
openbottomslope = sector[hi]->f_slope;
|
||||
openbottompic = sector[hi]->floorpic;
|
||||
|
||||
if (mobj)
|
||||
{
|
||||
|
|
@ -747,6 +751,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
if (bottomheight < open[FRONT].top) {
|
||||
open[FRONT].top = bottomheight;
|
||||
opentopslope = *rover->b_slope;
|
||||
opentoppic = *rover->bottompic;
|
||||
open[FRONT].ceilingrover = rover;
|
||||
}
|
||||
else if (bottomheight < highceiling)
|
||||
|
|
@ -758,6 +763,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
if (topheight > open[FRONT].bottom) {
|
||||
open[FRONT].bottom = topheight;
|
||||
openbottomslope = *rover->t_slope;
|
||||
openbottompic = *rover->toppic;
|
||||
open[FRONT].floorrover = rover;
|
||||
}
|
||||
else if (topheight > lowfloor)
|
||||
|
|
@ -789,6 +795,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
if (bottomheight < open[BACK].top) {
|
||||
open[BACK].top = bottomheight;
|
||||
opentopslope = *rover->b_slope;
|
||||
opentoppic = *rover->bottompic;
|
||||
open[BACK].ceilingrover = rover;
|
||||
}
|
||||
else if (bottomheight < highceiling)
|
||||
|
|
@ -800,6 +807,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
if (topheight > open[BACK].bottom) {
|
||||
open[BACK].bottom = topheight;
|
||||
openbottomslope = *rover->t_slope;
|
||||
openbottompic = *rover->toppic;
|
||||
open[BACK].floorrover = rover;
|
||||
}
|
||||
else if (topheight > lowfloor)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ extern fixed_t openceilingstep;
|
|||
extern fixed_t openceilingdrop;
|
||||
extern fixed_t openfloorstep;
|
||||
extern fixed_t openfloordrop;
|
||||
extern INT32 opentoppic, openbottompic;
|
||||
|
||||
void P_LineOpening(line_t *plinedef, mobj_t *mobj);
|
||||
|
||||
|
|
|
|||
196
src/p_mobj.c
196
src/p_mobj.c
|
|
@ -40,6 +40,7 @@
|
|||
#include "k_color.h"
|
||||
#include "k_respawn.h"
|
||||
#include "k_bot.h"
|
||||
#include "k_terrain.h"
|
||||
|
||||
static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_movebob = CVAR_INIT ("movebob", "1.0", CV_FLOAT|CV_SAVE, CV_BobSpeed, NULL);
|
||||
|
|
@ -1340,7 +1341,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
|||
mo->momy = FixedMul(mo->momy, mo->friction);
|
||||
}
|
||||
|
||||
mo->friction = ORIG_FRICTION;
|
||||
K_SetDefaultFriction(mo);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1505,7 +1506,10 @@ void P_XYMovement(mobj_t *mo)
|
|||
oldy = mo->y;
|
||||
|
||||
if (mo->flags & MF_NOCLIPHEIGHT)
|
||||
{
|
||||
mo->standingslope = NULL;
|
||||
mo->terrain = NULL;
|
||||
}
|
||||
|
||||
// adjust various things based on slope
|
||||
if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) {
|
||||
|
|
@ -1671,6 +1675,7 @@ void P_XYMovement(mobj_t *mo)
|
|||
{
|
||||
mo->momz = transfermomz;
|
||||
mo->standingslope = NULL;
|
||||
mo->terrain = NULL;
|
||||
P_SetPitchRoll(mo, ANGLE_90,
|
||||
transferslope->xydirection
|
||||
+ (transferslope->zangle
|
||||
|
|
@ -1782,6 +1787,7 @@ void P_XYMovement(mobj_t *mo)
|
|||
mo->momz = P_MobjFlip(mo)*FRACUNIT/2;
|
||||
mo->z = predictedz + P_MobjFlip(mo);
|
||||
mo->standingslope = NULL;
|
||||
mo->terrain = NULL;
|
||||
//CONS_Printf("Launched off of flat surface running into downward slope\n");
|
||||
}
|
||||
}
|
||||
|
|
@ -2274,6 +2280,8 @@ boolean P_ZMovement(mobj_t *mo)
|
|||
}
|
||||
|
||||
P_CheckPosition(mo, mo->x, mo->y); // Sets mo->standingslope correctly
|
||||
K_UpdateMobjTerrain(mo, ((mo->eflags & MFE_VERTICALFLIP) ? tmceilingpic : tmfloorpic));
|
||||
|
||||
if (((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) && (mo->type != MT_STEAM))
|
||||
{
|
||||
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
|
||||
|
|
@ -2503,12 +2511,17 @@ boolean P_ZMovement(mobj_t *mo)
|
|||
if (mo->type == MT_STEAM)
|
||||
return true;
|
||||
}
|
||||
else if (!(mo->flags & MF_NOGRAVITY)) // Gravity here!
|
||||
else
|
||||
{
|
||||
/// \todo may not be needed (done in P_MobjThinker normally)
|
||||
mo->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
mo->terrain = NULL;
|
||||
|
||||
P_CheckGravity(mo, true);
|
||||
if (!(mo->flags & MF_NOGRAVITY)) // Gravity here!
|
||||
{
|
||||
/// \todo may not be needed (done in P_MobjThinker normally)
|
||||
mo->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
|
||||
P_CheckGravity(mo, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (((mo->z + mo->height > mo->ceilingz && !(mo->eflags & MFE_VERTICALFLIP))
|
||||
|
|
@ -2712,20 +2725,29 @@ void P_PlayerZMovement(mobj_t *mo)
|
|||
if (onground && !(mo->flags & MF_NOCLIPHEIGHT))
|
||||
{
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
mo->z = mo->ceilingz - mo->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
mo->z = mo->floorz;
|
||||
}
|
||||
|
||||
K_UpdateMobjTerrain(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingpic : tmfloorpic));
|
||||
|
||||
// Get up if you fell.
|
||||
if (mo->player->panim == PA_HURT && mo->player->spinouttimer == 0 && mo->player->tumbleBounces == 0)
|
||||
{
|
||||
P_SetPlayerMobjState(mo, S_KART_STILL);
|
||||
}
|
||||
|
||||
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) {
|
||||
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope))
|
||||
{
|
||||
// Handle landing on slope during Z movement
|
||||
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope));
|
||||
}
|
||||
|
||||
if (P_MobjFlip(mo)*mo->momz < 0) // falling
|
||||
if (P_MobjFlip(mo) * mo->momz < 0) // falling
|
||||
{
|
||||
boolean clipmomz = !(P_CheckDeathPitCollide(mo));
|
||||
|
||||
|
|
@ -2736,29 +2758,38 @@ void P_PlayerZMovement(mobj_t *mo)
|
|||
P_PlayerPolyObjectZMovement(mo);
|
||||
|
||||
if (clipmomz)
|
||||
{
|
||||
mo->momz = (tmfloorthing ? tmfloorthing->momz : 0);
|
||||
}
|
||||
}
|
||||
else if (tmfloorthing)
|
||||
mo->momz = tmfloorthing->momz;
|
||||
}
|
||||
else if (!(mo->flags & MF_NOGRAVITY)) // Gravity here!
|
||||
{
|
||||
if (P_IsObjectInGoop(mo) && !(mo->flags & MF_NOCLIPHEIGHT))
|
||||
{
|
||||
if (mo->z < mo->floorz)
|
||||
{
|
||||
mo->z = mo->floorz;
|
||||
mo->momz = 0;
|
||||
}
|
||||
else if (mo->z + mo->height > mo->ceilingz)
|
||||
{
|
||||
mo->z = mo->ceilingz - mo->height;
|
||||
mo->momz = 0;
|
||||
}
|
||||
mo->momz = tmfloorthing->momz;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mo->terrain = NULL;
|
||||
|
||||
if (!(mo->flags & MF_NOGRAVITY)) // Gravity here!
|
||||
{
|
||||
if (P_IsObjectInGoop(mo) && !(mo->flags & MF_NOCLIPHEIGHT))
|
||||
{
|
||||
if (mo->z < mo->floorz)
|
||||
{
|
||||
mo->z = mo->floorz;
|
||||
mo->momz = 0;
|
||||
}
|
||||
else if (mo->z + mo->height > mo->ceilingz)
|
||||
{
|
||||
mo->z = mo->ceilingz - mo->height;
|
||||
mo->momz = 0;
|
||||
}
|
||||
}
|
||||
/// \todo may not be needed (done in P_MobjThinker normally)
|
||||
mo->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
P_CheckGravity(mo, true);
|
||||
}
|
||||
/// \todo may not be needed (done in P_MobjThinker normally)
|
||||
mo->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
P_CheckGravity(mo, true);
|
||||
}
|
||||
|
||||
if (((mo->eflags & MFE_VERTICALFLIP && mo->z < mo->floorz) || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z + mo->height > mo->ceilingz))
|
||||
|
|
@ -3048,6 +3079,26 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
}
|
||||
}
|
||||
|
||||
if (mobj->terrain != NULL)
|
||||
{
|
||||
if (mobj->terrain->flags & TRF_LIQUID)
|
||||
{
|
||||
// This floor is water.
|
||||
mobj->eflags |= MFE_TOUCHWATER;
|
||||
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
mobj->watertop = thingtop + height;
|
||||
mobj->waterbottom = thingtop;
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj->watertop = mobj->z;
|
||||
mobj->waterbottom = mobj->z - height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mobj->watertop > top2)
|
||||
mobj->watertop = top2;
|
||||
|
||||
|
|
@ -3056,7 +3107,9 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
|
||||
// Spectators and dead players don't get to do any of the things after this.
|
||||
if (p && (p->spectator || p->playerstate != PST_LIVE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// The rest of this code only executes on a water state change.
|
||||
if (!!(mobj->eflags & MFE_UNDERWATER) == wasinwater)
|
||||
|
|
@ -3073,6 +3126,30 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
|| ((mobj->info->flags & MF_PUSHABLE) && mobj->fuse) // Previously pushable, might be moving still
|
||||
)
|
||||
{
|
||||
fixed_t waterZ = INT32_MAX;
|
||||
fixed_t solidZ = INT32_MAX;
|
||||
fixed_t diff = INT32_MAX;
|
||||
|
||||
fixed_t thingZ = INT32_MAX;
|
||||
boolean splashValid = false;
|
||||
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
waterZ = mobj->waterbottom;
|
||||
solidZ = mobj->ceilingz;
|
||||
}
|
||||
else
|
||||
{
|
||||
waterZ = mobj->watertop;
|
||||
solidZ = mobj->floorz;
|
||||
}
|
||||
|
||||
diff = waterZ - solidZ;
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
diff = -diff;
|
||||
}
|
||||
|
||||
// Time to spawn the bubbles!
|
||||
{
|
||||
INT32 i;
|
||||
|
|
@ -3131,12 +3208,15 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
|
||||
// Check to make sure you didn't just cross into a sector to jump out of
|
||||
// that has shallower water than the block you were originally in.
|
||||
if ((!(mobj->eflags & MFE_VERTICALFLIP) && mobj->watertop-mobj->floorz <= height>>1)
|
||||
|| ((mobj->eflags & MFE_VERTICALFLIP) && mobj->ceilingz-mobj->waterbottom <= height>>1))
|
||||
if (diff <= (height >> 1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (mobj->eflags & MFE_GOOWATER || wasingoo) { // Decide what happens to your momentum when you enter/leave goopy water.
|
||||
if (P_MobjFlip(mobj)*mobj->momz > 0)
|
||||
if (mobj->eflags & MFE_GOOWATER || wasingoo)
|
||||
{
|
||||
// Decide what happens to your momentum when you enter/leave goopy water.
|
||||
if (P_MobjFlip(mobj) * mobj->momz > 0)
|
||||
{
|
||||
mobj->momz -= (mobj->momz/8); // cut momentum a little bit to prevent multiple bobs
|
||||
//CONS_Printf("leaving\n");
|
||||
|
|
@ -3148,25 +3228,42 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
//CONS_Printf("entering\n");
|
||||
}
|
||||
}
|
||||
else if (wasinwater && P_MobjFlip(mobj)*mobj->momz > 0)
|
||||
mobj->momz = FixedMul(mobj->momz, FixedDiv(780*FRACUNIT, 457*FRACUNIT)); // Give the mobj a little out-of-water boost.
|
||||
|
||||
if (P_MobjFlip(mobj)*mobj->momz < 0)
|
||||
else if (wasinwater && P_MobjFlip(mobj) * mobj->momz > 0)
|
||||
{
|
||||
if ((mobj->eflags & MFE_VERTICALFLIP && thingtop-(height>>1)-mobj->momz <= mobj->waterbottom)
|
||||
|| (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z+(height>>1)-mobj->momz >= mobj->watertop))
|
||||
// Give the mobj a little out-of-water boost.
|
||||
mobj->momz = FixedMul(mobj->momz, FixedDiv(780*FRACUNIT, 457*FRACUNIT));
|
||||
}
|
||||
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
thingZ = thingtop - (height >> 1);
|
||||
splashValid = (thingZ - mobj->momz <= waterZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
thingZ = mobj->z + (height >> 1);
|
||||
splashValid = (thingZ - mobj->momz >= waterZ);
|
||||
}
|
||||
|
||||
if (P_MobjFlip(mobj) * mobj->momz <= 0)
|
||||
{
|
||||
if (splashValid == true)
|
||||
{
|
||||
// Spawn a splash
|
||||
mobj_t *splish;
|
||||
mobjtype_t splishtype = (mobj->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH;
|
||||
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[splishtype].height, mobj->scale), splishtype);
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, waterZ - FixedMul(mobjinfo[splishtype].height, mobj->scale), splishtype);
|
||||
splish->flags2 |= MF2_OBJECTFLIP;
|
||||
splish->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
else
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, splishtype);
|
||||
{
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, waterZ, splishtype);
|
||||
}
|
||||
|
||||
splish->destscale = mobj->scale;
|
||||
P_SetScale(splish, mobj->scale);
|
||||
}
|
||||
|
|
@ -3175,40 +3272,37 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
if (p && p->waterskip < 2
|
||||
&& ((p->speed/3 > abs(mobj->momz)) // Going more forward than horizontal, so you can skip across the water.
|
||||
|| (p->speed > 20*mapobjectscale && p->waterskip)) // Already skipped once, so you can skip once more!
|
||||
&& ((!(mobj->eflags & MFE_VERTICALFLIP) && thingtop - mobj->momz > mobj->watertop)
|
||||
|| ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z - mobj->momz < mobj->waterbottom)))
|
||||
&& (splashValid == true))
|
||||
{
|
||||
const fixed_t hop = 5<<FRACBITS;
|
||||
const fixed_t hop = 5 * mobj->scale;
|
||||
|
||||
mobj->momx = (4*mobj->momx)/5;
|
||||
mobj->momy = (4*mobj->momy)/5;
|
||||
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
mobj->momz = FixedMul(-hop, mobj->scale);
|
||||
else
|
||||
mobj->momz = FixedMul(hop, mobj->scale);
|
||||
mobj->momz = hop * P_MobjFlip(mobj);
|
||||
|
||||
p->waterskip++;
|
||||
}
|
||||
|
||||
}
|
||||
else if (P_MobjFlip(mobj)*mobj->momz > 0)
|
||||
else if (P_MobjFlip(mobj) * mobj->momz > 0)
|
||||
{
|
||||
if (((mobj->eflags & MFE_VERTICALFLIP && thingtop-(height>>1)-mobj->momz > mobj->waterbottom)
|
||||
|| (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z+(height>>1)-mobj->momz < mobj->watertop))
|
||||
&& !(mobj->eflags & MFE_UNDERWATER)) // underwater check to prevent splashes on opposite side
|
||||
if (splashValid == true && !(mobj->eflags & MFE_UNDERWATER)) // underwater check to prevent splashes on opposite side
|
||||
{
|
||||
// Spawn a splash
|
||||
mobj_t *splish;
|
||||
mobjtype_t splishtype = (mobj->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH;
|
||||
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[splishtype].height, mobj->scale), splishtype);
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, waterZ - FixedMul(mobjinfo[splishtype].height, mobj->scale), splishtype);
|
||||
splish->flags2 |= MF2_OBJECTFLIP;
|
||||
splish->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
else
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, splishtype);
|
||||
{
|
||||
splish = P_SpawnMobj(mobj->x, mobj->y, waterZ, splishtype);
|
||||
}
|
||||
|
||||
splish->destscale = mobj->scale;
|
||||
P_SetScale(splish, mobj->scale);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -397,6 +397,7 @@ typedef struct mobj_s
|
|||
|
||||
fixed_t sprxoff, spryoff, sprzoff; // Sprite offsets in real space, does NOT affect position or collision
|
||||
|
||||
struct terrain_s *terrain; // Terrain definition of the floor this object last hit. NULL when in the air.
|
||||
INT32 hitlag; // Sal-style hit lag, straight from Captain Fetch's jowls
|
||||
|
||||
// WARNING: New fields must be added separately to savegame and Lua.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
// SRB2Kart
|
||||
#include "k_battle.h"
|
||||
#include "k_pwrlv.h"
|
||||
#include "k_terrain.h"
|
||||
|
||||
savedata_t savedata;
|
||||
UINT8 *save_p;
|
||||
|
|
@ -1540,6 +1541,7 @@ typedef enum
|
|||
MD2_KITEMCAP = 1<<26,
|
||||
MD2_ITNEXT = 1<<27,
|
||||
MD2_LASTMOMZ = 1<<28,
|
||||
MD2_TERRAIN = 1<<29,
|
||||
} mobj_diff2_t;
|
||||
|
||||
typedef enum
|
||||
|
|
@ -1782,6 +1784,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
diff2 |= MD2_ITNEXT;
|
||||
if (mobj->lastmomz)
|
||||
diff2 |= MD2_LASTMOMZ;
|
||||
if (mobj->terrain != NULL)
|
||||
diff2 |= MD2_TERRAIN;
|
||||
|
||||
if (diff2 != 0)
|
||||
diff |= MD_MORE;
|
||||
|
|
@ -1979,6 +1983,10 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
{
|
||||
WRITEINT32(save_p, mobj->lastmomz);
|
||||
}
|
||||
if (diff2 & MD2_TERRAIN)
|
||||
{
|
||||
WRITEUINT32(save_p, K_GetTerrainHeapIndex(mobj->terrain));
|
||||
}
|
||||
|
||||
WRITEUINT32(save_p, mobj->mobjnum);
|
||||
}
|
||||
|
|
@ -3077,6 +3085,14 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
{
|
||||
mobj->lastmomz = READINT32(save_p);
|
||||
}
|
||||
if (diff2 & MD2_TERRAIN)
|
||||
{
|
||||
mobj->terrain = (terrain_t *)(size_t)READUINT32(save_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj->terrain = NULL;
|
||||
}
|
||||
|
||||
if (diff & MD_REDFLAG)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@
|
|||
#include "k_waypoint.h"
|
||||
#include "k_bot.h"
|
||||
#include "k_grandprix.h"
|
||||
#include "k_terrain.h" // TRF_TRIPWIRE
|
||||
#include "k_brightmap.h"
|
||||
|
||||
// Replay names have time
|
||||
|
|
@ -1940,18 +1941,15 @@ static void P_ProcessLinedefsAfterSidedefs(void)
|
|||
size_t i = numlines;
|
||||
register line_t *ld = lines;
|
||||
|
||||
const INT32 TEX_TRIPWIRE = R_TextureNumForName("TRIPWIRE");
|
||||
const INT32 TEX_4RIPWIRE = R_TextureNumForName("4RIPWIRE");
|
||||
|
||||
for (; i--; ld++)
|
||||
{
|
||||
INT32 midtexture = sides[ld->sidenum[0]].midtexture;
|
||||
terrain_t *terrain = K_GetTerrainForTextureNum(midtexture);
|
||||
|
||||
ld->frontsector = sides[ld->sidenum[0]].sector; //e6y: Can't be -1 here
|
||||
ld->backsector = ld->sidenum[1] != 0xffff ? sides[ld->sidenum[1]].sector : 0;
|
||||
|
||||
if (midtexture == TEX_TRIPWIRE ||
|
||||
midtexture == TEX_4RIPWIRE)
|
||||
if (terrain != NULL && (terrain->flags & TRF_TRIPWIRE))
|
||||
{
|
||||
ld->tripwire = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -850,6 +850,7 @@ void P_SlopeLaunch(mobj_t *mo)
|
|||
|
||||
//CONS_Printf("Launched off of slope.\n");
|
||||
mo->standingslope = NULL;
|
||||
mo->terrain = NULL;
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "k_kart.h"
|
||||
#include "console.h" // CON_LogMessage
|
||||
#include "k_respawn.h"
|
||||
#include "k_terrain.h"
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
|
|
@ -4333,7 +4334,9 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
|||
|
||||
// Conveyor stuff
|
||||
if (section3 == 2 || section3 == 4)
|
||||
{
|
||||
player->onconveyor = section3;
|
||||
}
|
||||
|
||||
special = section1;
|
||||
|
||||
|
|
@ -4657,7 +4660,7 @@ DoneSection2:
|
|||
case 6: // SRB2kart 190117 - Sneaker Panel
|
||||
if (roversector || P_MobjReadyToTrigger(player->mo, sector))
|
||||
{
|
||||
if (!player->floorboost)
|
||||
if (player->floorboost == 0)
|
||||
player->floorboost = 3;
|
||||
else
|
||||
player->floorboost = 2;
|
||||
|
|
@ -5050,6 +5053,7 @@ void P_PlayerInSpecialSector(player_t *player)
|
|||
if (!player->mo)
|
||||
return;
|
||||
|
||||
K_ProcessTerrainEffect(player->mo);
|
||||
originalsector = player->mo->subsector->sector;
|
||||
|
||||
P_PlayerOnSpecial3DFloor(player, originalsector); // Handle FOFs first.
|
||||
|
|
|
|||
16
src/p_user.c
16
src/p_user.c
|
|
@ -52,6 +52,7 @@
|
|||
#include "k_respawn.h"
|
||||
#include "k_bot.h"
|
||||
#include "k_grandprix.h"
|
||||
#include "k_terrain.h" // K_SpawnSplashForMobj
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
|
|
@ -1274,17 +1275,18 @@ void P_DoPlayerExit(player_t *player)
|
|||
//
|
||||
// Handles player hitting floor surface.
|
||||
// Returns whether to clip momz.
|
||||
boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
|
||||
boolean P_PlayerHitFloor(player_t *player, boolean fromAir)
|
||||
{
|
||||
boolean clipmomz;
|
||||
|
||||
(void)dorollstuff;
|
||||
|
||||
I_Assert(player->mo != NULL);
|
||||
|
||||
clipmomz = !(P_CheckDeathPitCollide(player->mo));
|
||||
|
||||
// SRB2Kart: removed lots of really vanilla-specific code here
|
||||
if (fromAir == true && clipmomz == true)
|
||||
{
|
||||
K_SpawnSplashForMobj(player->mo, abs(player->mo->momz));
|
||||
}
|
||||
|
||||
return clipmomz;
|
||||
}
|
||||
|
|
@ -2138,8 +2140,6 @@ void P_MovePlayer(player_t *player)
|
|||
player->mo->rollangle = 0;
|
||||
}
|
||||
|
||||
player->mo->movefactor = FRACUNIT; // We're not going to do any more with this, so let's change it back for the next frame.
|
||||
|
||||
//{ SRB2kart
|
||||
|
||||
// Drifting sound
|
||||
|
|
@ -2267,7 +2267,7 @@ void P_MovePlayer(player_t *player)
|
|||
K_SpawnSparkleTrail(player->mo);
|
||||
|
||||
if (player->wipeoutslow > 1 && (leveltime & 1))
|
||||
K_SpawnWipeoutTrail(player->mo, false);
|
||||
K_SpawnWipeoutTrail(player->mo);
|
||||
|
||||
K_DriftDustHandling(player->mo);
|
||||
|
||||
|
|
@ -4502,8 +4502,6 @@ void P_PlayerThink(player_t *player)
|
|||
P_MovePlayer(player);
|
||||
}
|
||||
|
||||
player->mo->movefactor = FRACUNIT; // We're not going to do any more with this, so let's change it back for the next frame.
|
||||
|
||||
// Unset statis flag after moving.
|
||||
// In other words, if you manually set stasis via code,
|
||||
// it lasts for one tic.
|
||||
|
|
|
|||
32
src/r_bsp.c
32
src/r_bsp.c
|
|
@ -23,6 +23,8 @@
|
|||
#include "z_zone.h" // Check R_Prep3DFloors
|
||||
#include "taglist.h"
|
||||
|
||||
#include "k_terrain.h"
|
||||
|
||||
seg_t *curline;
|
||||
side_t *sidedef;
|
||||
line_t *linedef;
|
||||
|
|
@ -67,11 +69,35 @@ boolean R_IsRipplePlane(sector_t *sector, ffloor_t *rover, int ceiling)
|
|||
|
||||
static void R_PlaneLightOverride(sector_t *sector, boolean ceiling, INT32 *lightlevel)
|
||||
{
|
||||
if (GETSECSPECIAL(sector->special, 4) == 6) // Fullbright sneaker panels
|
||||
terrain_t *t = NULL;
|
||||
|
||||
if (ceiling == true)
|
||||
{
|
||||
if ((ceiling && (sector->flags & SF_FLIPSPECIAL_CEILING))
|
||||
|| (!ceiling && (sector->flags & SF_FLIPSPECIAL_FLOOR)))
|
||||
t = K_GetTerrainForFlatNum(sector->ceilingpic);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = K_GetTerrainForFlatNum(sector->floorpic);
|
||||
}
|
||||
|
||||
if (t != NULL)
|
||||
{
|
||||
if (t->flags & TRF_SNEAKERPANEL)
|
||||
{
|
||||
*lightlevel = 255;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sector effect sneaker panels (DEPRECATED)
|
||||
if (GETSECSPECIAL(sector->special, 4) == 6)
|
||||
{
|
||||
if ((ceiling && (sector->flags & SF_FLIPSPECIAL_CEILING))
|
||||
|| (!ceiling && (sector->flags & SF_FLIPSPECIAL_FLOOR)))
|
||||
{
|
||||
*lightlevel = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
10
src/tables.c
10
src/tables.c
|
|
@ -185,6 +185,16 @@ INT32 AngleDeltaSigned(angle_t a1, angle_t a2)
|
|||
return (INT32)(a1) - (INT32)(a2);
|
||||
}
|
||||
|
||||
float AngleToFloat(angle_t x)
|
||||
{
|
||||
return x / (float)ANG1;
|
||||
}
|
||||
|
||||
angle_t FloatToAngle(float f)
|
||||
{
|
||||
return (angle_t)(f * ANG1);
|
||||
}
|
||||
|
||||
#include "t_ftan.c"
|
||||
|
||||
#include "t_fsin.c"
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ FUNCMATH angle_t FixedAngleC(fixed_t fa, fixed_t factor);
|
|||
// difference between two angle_t
|
||||
FUNCMATH INT32 AngleDelta(angle_t a1, angle_t a2);
|
||||
FUNCMATH INT32 AngleDeltaSigned(angle_t a1, angle_t a2);
|
||||
FUNCMATH float AngleToFloat(angle_t x);
|
||||
FUNCMATH angle_t FloatToAngle(float f);
|
||||
|
||||
/// The FixedAcos function
|
||||
FUNCMATH angle_t FixedAcos(fixed_t x);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@
|
|||
#include "m_misc.h" // M_MapNumber
|
||||
#include "g_game.h" // G_SetGameModified
|
||||
|
||||
#include "k_terrain.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#include "hardware/hw_glob.h"
|
||||
|
|
@ -866,6 +868,8 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
|
|||
break;
|
||||
}
|
||||
|
||||
K_InitTerrain(numwadfiles - 1);
|
||||
|
||||
if (refreshdirmenu & REFRESHDIR_GAMEDATA)
|
||||
G_LoadGameData();
|
||||
DEH_UpdateMaxFreeslots();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue