Instead of embedding specific textures to be tripwire in hardcode ... make it a TERRAIN flag!

This commit is contained in:
Sally Coolatta 2021-12-09 15:54:22 -05:00
parent 35a72e56dc
commit b3d3135c58
6 changed files with 24 additions and 17 deletions

View file

@ -5063,7 +5063,7 @@ void K_DoSneaker(player_t *player, INT32 type)
{ {
const fixed_t intendedboost = FRACUNIT/2; 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 normalsfx = sfx_cdfm01;
const sfxenum_t smallsfx = sfx_cdfm40; const sfxenum_t smallsfx = sfx_cdfm40;
@ -5086,7 +5086,7 @@ void K_DoSneaker(player_t *player, INT32 type)
player->numsneakers++; player->numsneakers++;
} }
if (!player->sneakertimer) if (player->sneakertimer == 0)
{ {
if (type == 2) if (type == 2)
{ {
@ -5120,13 +5120,12 @@ void K_DoSneaker(player_t *player, INT32 type)
{ {
player->pflags |= PF_ATTACKDOWN; player->pflags |= PF_ATTACKDOWN;
K_PlayBoostTaunt(player->mo); K_PlayBoostTaunt(player->mo);
} }
player->sneakertimer = sneakertime; player->sneakertimer = sneakertime;
// set angle for spun out players: // set angle for spun out players:
player->boostangle = (INT32)player->mo->angle; player->boostangle = player->mo->angle;
} }
static void K_DoShrink(player_t *user) static void K_DoShrink(player_t *user)
@ -6646,7 +6645,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
// update boost angle if not spun out // update boost angle if not spun out
if (!player->spinouttimer && !player->wipeoutslow) if (!player->spinouttimer && !player->wipeoutslow)
player->boostangle = (INT32)player->mo->angle; player->boostangle = player->mo->angle;
K_GetKartBoostPower(player); K_GetKartBoostPower(player);
@ -6919,7 +6918,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->sneakertimer && player->wipeoutslow > 0 && player->wipeoutslow < wipeoutslowtime+1) if (player->sneakertimer && player->wipeoutslow > 0 && player->wipeoutslow < wipeoutslowtime+1)
player->wipeoutslow = wipeoutslowtime+1; player->wipeoutslow = wipeoutslowtime+1;
if (player->floorboost) if (player->floorboost > 0)
player->floorboost--; player->floorboost--;
if (player->driftboost) if (player->driftboost)

View file

@ -274,7 +274,7 @@ terrain_t *K_GetTerrainForTextureName(const char *checkName)
{ {
t_floor_t *f = &terrainFloorDefs[i]; t_floor_t *f = &terrainFloorDefs[i];
if (stricmp(checkName, f->textureName) == 0) if (strncasecmp(checkName, f->textureName, 8) == 0)
{ {
return K_GetTerrainByIndex(f->terrainID); return K_GetTerrainByIndex(f->terrainID);
} }
@ -387,7 +387,7 @@ void K_ProcessTerrainEffect(mobj_t *mo)
// Sneaker panel // Sneaker panel
if (terrain->flags & TRF_SNEAKERPANEL) if (terrain->flags & TRF_SNEAKERPANEL)
{ {
if (!player->floorboost) if (player->floorboost == 0)
player->floorboost = 3; player->floorboost = 3;
else else
player->floorboost = 2; player->floorboost = 2;
@ -734,6 +734,14 @@ static void K_ParseTerrainParameter(UINT32 i, char *param, char *val)
{ {
K_FlagBoolean(&terrain->flags, TRF_SNEAKERPANEL, val); K_FlagBoolean(&terrain->flags, TRF_SNEAKERPANEL, val);
} }
else if (stricmp(param, "bumpy") == 0 || stricmp(param, "stairJank") == 0)
{
K_FlagBoolean(&terrain->flags, TRF_STAIRJANK, val);
}
else if (stricmp(param, "tripwire") == 0)
{
K_FlagBoolean(&terrain->flags, TRF_TRIPWIRE, val);
}
} }
/*-------------------------------------------------- /*--------------------------------------------------

View file

@ -48,7 +48,9 @@ typedef enum
{ {
// Terrain flag values. // Terrain flag values.
TRF_LIQUID = 1, // Texture water properties (wavy, slippery, etc) TRF_LIQUID = 1, // Texture water properties (wavy, slippery, etc)
TRF_SNEAKERPANEL = 1<<1 // Texture is a booster 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; } terrain_flags_t;
typedef struct terrain_s typedef struct terrain_s

View file

@ -281,7 +281,7 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"handleboost")) else if (fastcmp(field,"handleboost"))
lua_pushinteger(L, plr->handleboost); lua_pushinteger(L, plr->handleboost);
else if (fastcmp(field,"boostangle")) else if (fastcmp(field,"boostangle"))
lua_pushinteger(L, plr->boostangle); lua_pushangle(L, plr->boostangle);
else if (fastcmp(field,"draftpower")) else if (fastcmp(field,"draftpower"))
lua_pushinteger(L, plr->draftpower); lua_pushinteger(L, plr->draftpower);
else if (fastcmp(field,"draftleeway")) else if (fastcmp(field,"draftleeway"))
@ -626,7 +626,7 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"handleboost")) else if (fastcmp(field,"handleboost"))
plr->handleboost = luaL_checkinteger(L, 3); plr->handleboost = luaL_checkinteger(L, 3);
else if (fastcmp(field,"boostangle")) else if (fastcmp(field,"boostangle"))
plr->boostangle = luaL_checkinteger(L, 3); plr->boostangle = luaL_checkangle(L, 3);
else if (fastcmp(field,"draftpower")) else if (fastcmp(field,"draftpower"))
plr->draftpower = luaL_checkinteger(L, 3); plr->draftpower = luaL_checkinteger(L, 3);
else if (fastcmp(field,"draftleeway")) else if (fastcmp(field,"draftleeway"))

View file

@ -91,6 +91,7 @@
#include "k_waypoint.h" #include "k_waypoint.h"
#include "k_bot.h" #include "k_bot.h"
#include "k_grandprix.h" #include "k_grandprix.h"
#include "k_terrain.h" // TRF_TRIPWIRE
// Replay names have time // Replay names have time
#if !defined (UNDER_CE) #if !defined (UNDER_CE)
@ -1939,18 +1940,15 @@ static void P_ProcessLinedefsAfterSidedefs(void)
size_t i = numlines; size_t i = numlines;
register line_t *ld = lines; register line_t *ld = lines;
const INT32 TEX_TRIPWIRE = R_TextureNumForName("TRIPWIRE");
const INT32 TEX_4RIPWIRE = R_TextureNumForName("4RIPWIRE");
for (; i--; ld++) for (; i--; ld++)
{ {
INT32 midtexture = sides[ld->sidenum[0]].midtexture; 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->frontsector = sides[ld->sidenum[0]].sector; //e6y: Can't be -1 here
ld->backsector = ld->sidenum[1] != 0xffff ? sides[ld->sidenum[1]].sector : 0; ld->backsector = ld->sidenum[1] != 0xffff ? sides[ld->sidenum[1]].sector : 0;
if (midtexture == TEX_TRIPWIRE || if (terrain != NULL && (terrain->flags & TRF_TRIPWIRE))
midtexture == TEX_4RIPWIRE)
{ {
ld->tripwire = true; ld->tripwire = true;
} }

View file

@ -4660,7 +4660,7 @@ DoneSection2:
case 6: // SRB2kart 190117 - Sneaker Panel case 6: // SRB2kart 190117 - Sneaker Panel
if (roversector || P_MobjReadyToTrigger(player->mo, sector)) if (roversector || P_MobjReadyToTrigger(player->mo, sector))
{ {
if (!player->floorboost) if (player->floorboost == 0)
player->floorboost = 3; player->floorboost = 3;
else else
player->floorboost = 2; player->floorboost = 2;