From b3d3135c5871e27742fbdc97c0095c88f5a7a75d Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 9 Dec 2021 15:54:22 -0500 Subject: [PATCH] Instead of embedding specific textures to be tripwire in hardcode ... make it a TERRAIN flag! --- src/k_kart.c | 11 +++++------ src/k_terrain.c | 12 ++++++++++-- src/k_terrain.h | 4 +++- src/lua_playerlib.c | 4 ++-- src/p_setup.c | 8 +++----- src/p_spec.c | 2 +- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index de660b812..812b856ce 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5063,7 +5063,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; @@ -5086,7 +5086,7 @@ void K_DoSneaker(player_t *player, INT32 type) player->numsneakers++; } - if (!player->sneakertimer) + if (player->sneakertimer == 0) { if (type == 2) { @@ -5120,13 +5120,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) @@ -6646,7 +6645,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); @@ -6919,7 +6918,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) diff --git a/src/k_terrain.c b/src/k_terrain.c index 9ba13757d..dfd059893 100644 --- a/src/k_terrain.c +++ b/src/k_terrain.c @@ -274,7 +274,7 @@ terrain_t *K_GetTerrainForTextureName(const char *checkName) { t_floor_t *f = &terrainFloorDefs[i]; - if (stricmp(checkName, f->textureName) == 0) + if (strncasecmp(checkName, f->textureName, 8) == 0) { return K_GetTerrainByIndex(f->terrainID); } @@ -387,7 +387,7 @@ void K_ProcessTerrainEffect(mobj_t *mo) // Sneaker panel if (terrain->flags & TRF_SNEAKERPANEL) { - if (!player->floorboost) + if (player->floorboost == 0) player->floorboost = 3; else player->floorboost = 2; @@ -734,6 +734,14 @@ static void K_ParseTerrainParameter(UINT32 i, char *param, char *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); + } } /*-------------------------------------------------- diff --git a/src/k_terrain.h b/src/k_terrain.h index 0e36388ea..e53a72358 100644 --- a/src/k_terrain.h +++ b/src/k_terrain.h @@ -48,7 +48,9 @@ typedef enum { // Terrain flag values. 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; typedef struct terrain_s diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index f7c20ab64..23e2e2b67 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -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")) @@ -626,7 +626,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")) diff --git a/src/p_setup.c b/src/p_setup.c index fab5429b8..30323c70e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -91,6 +91,7 @@ #include "k_waypoint.h" #include "k_bot.h" #include "k_grandprix.h" +#include "k_terrain.h" // TRF_TRIPWIRE // Replay names have time #if !defined (UNDER_CE) @@ -1939,18 +1940,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; } diff --git a/src/p_spec.c b/src/p_spec.c index cd6f0f6ae..a52cfe932 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4660,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;