Port salty hop, changes for new terraindefs in assets

This commit is contained in:
NepDisk 2025-05-20 17:07:13 -04:00
parent 869255f9ec
commit deb447aec7
10 changed files with 163 additions and 18 deletions

View file

@ -86,8 +86,8 @@
#define ASSET_HASH_TEXTURES_KART 0xb4211b2f32b6a291
#define ASSET_HASH_CHARS_KART 0x1e68a3e01aa5c68b
#define ASSET_HASH_MAPS_KART 0x38558ed00da41ce9
#define ASSET_HASH_MAIN_PK3 0x7ec7eac23ac1dfdc
#define ASSET_HASH_MAPPATCH_PK3 0x16726c0303d699fb
#define ASSET_HASH_MAIN_PK3 0x90bc93435f9aa4c4
#define ASSET_HASH_MAPPATCH_PK3 0xc789aadf69a0bcf9
#ifdef USE_PATCH_FILE
#define ASSET_HASH_PATCH_PK3 0x0000000000000000
#endif

View file

@ -503,6 +503,16 @@ struct boostinfo_t {
UINT8 grade;
};
// player_t struct for saltyhop related variables
struct saltyhop_t
{
boolean jump; // Player has the ability to do the hop
boolean ready; // Saltyhop is ready
boolean tapping; // Player is tapping the drift button
fixed_t momz, zoffset; // erm... the mechanism....
};
// ========================================================================
// PLAYER STRUCTURE
// ========================================================================
@ -804,6 +814,10 @@ struct player_t
tic_t linktimer;
INT32 maxlink; // maximum link obtained
saltyhop_t salty;
boolean prevonground;
#ifdef HWRENDER
fixed_t fovadd; // adjust FOV for hw rendering
#endif

View file

@ -72,6 +72,7 @@ consvar_t cv_kartdriftsounds = CVAR_INIT ("kartdriftsounds", "On", CV_SAVE, CV_O
consvar_t cv_kartdriftefx = CVAR_INIT ("kartdriftefx", "On", CV_SAVE, CV_OnOff, NULL);
static CV_PossibleValue_t driftsparkpulse_cons_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
consvar_t cv_driftsparkpulse = CVAR_INIT ("driftsparkpulse", "1.4", CV_SAVE|CV_FLOAT, driftsparkpulse_cons_t, NULL);
consvar_t cv_saltyhop = CVAR_INIT ("hardcodehop", "Off", CV_SAVE, CV_OnOff, NULL);
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
@ -342,6 +343,7 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_kartdriftsounds);
CV_RegisterVar(&cv_kartdriftefx);
CV_RegisterVar(&cv_driftsparkpulse);
CV_RegisterVar(&cv_saltyhop);
}
//}
@ -3590,17 +3592,6 @@ static void K_GetKartBoostPower(player_t *player)
if (player->bananadrag > TICRATE)
boostpower = (4*boostpower)/5;
// Banana drag/offroad dust
if (boostpower < FRACUNIT
&& player->mo && P_IsObjectOnGround(player->mo)
&& player->speed > 0
&& !player->spectator)
{
K_SpawnWipeoutTrail(player->mo, true);
if (leveltime % 6 == 0)
S_StartSound(player->mo, sfx_cdfm70);
}
if (player->sneakertimer) // Sneaker
{
UINT8 i;
@ -4928,7 +4919,7 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent)
}
if (translucent)
dust->renderflags |= RF_TRANS50;
dust->renderflags |= RF_GHOSTLY;
}
// K_DriftDustHandling
@ -7818,6 +7809,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->breathTimer < UINT16_MAX)
player->breathTimer++;
}
// Do a funny hop!
K_QuiteSaltyHop(player);
player->prevonground = P_IsObjectOnGround(player->mo);
}
void K_KartResetPlayerColor(player_t *player)
@ -11136,4 +11132,89 @@ void K_UpdateMobjItemOverlay(mobj_t *part, SINT8 itemType, UINT8 itemCount)
}
}
void K_QuiteSaltyHop(player_t *player)
{
if (player->mo == NULL || P_MobjWasRemoved(player->mo))
return;
if (cv_saltyhop.value == 0)
{
// reset before we leave
player->salty.jump = player->salty.ready = player->salty.tapping = false;
player->salty.momz = player->salty.zoffset = 0;
return;
}
const boolean onground = P_IsObjectOnGround(player->mo);
// k_jmp is gone so just check for drift here
// TODO: Rework this shit. this is awful
if (!(player->pflags & PF_DRIFTINPUT))
{
player->salty.ready = true;
player->salty.tapping = false;
}
else if (player->salty.ready)
{
player->salty.ready = false;
player->salty.tapping = true;
}
else
{
player->salty.tapping = false;
}
if (player->salty.jump)
{
if (player->mo->eflags & MFE_JUSTHITFLOOR)
player->salty.zoffset = 0;
else if (onground)
{
player->salty.zoffset += player->salty.momz;
player->salty.momz -= (3*FRACUNIT)/2;
}
else
{
// Originally (49/50)*FRACUNIT. tf was i on
player->salty.zoffset *= FRACUNIT;
player->salty.momz = 0;
}
// zoffset is back to zero...
if (player->salty.zoffset <= 0)
{
// play the sound
if (!(player->mo->eflags & MFE_JUSTHITFLOOR) && onground)
S_StartSound(player->mo, sfx_s268);
player->salty.jump = false;
player->salty.zoffset = 0;
player->salty.momz = 0;
// small squish upon landing
//player->mo->spritexscale = FRACUNIT*14/10;
//player->mo->spriteyscale = FRACUNIT*6/10;
}
else if (player->salty.zoffset > 0)
{
// stretch the funny
//player->mo->spritexscale -= (FRACUNIT/30);
//player->mo->spriteyscale += (FRACUNIT/30);
}
// Apply the z offset!
player->mo->spriteyoffset = player->salty.zoffset;
// Stop any and all drift sounds when hopping.
if (S_SoundPlaying(player->mo, sfx_screec))
S_StopSoundByID(player->mo, sfx_screec);
if (S_SoundPlaying(player->mo, sfx_drift))
S_StopSoundByID(player->mo, sfx_drift);
}
else if (player->salty.tapping && onground && !P_PlayerInPain(player))
{
player->salty.jump = true;
player->salty.zoffset = 0;
player->salty.momz = 6*FRACUNIT;
S_StartSound(player->mo, sfx_s25a);
}
}
//}

View file

@ -270,6 +270,8 @@ typedef enum
void K_AwardScaledPlayerRings(player_t *player, SINT8 mode);
void K_QuiteSaltyHop(player_t *player);
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -852,6 +852,11 @@ static void K_SpawnSplashParticles(mobj_t *mo, t_splash_t *s, fixed_t impact)
dust->color = s->color;
}
if (s->mobjType == MT_WIPEOUTTRAIL)
{
dust->renderflags = RF_GHOSTLY;
}
if (s->sfx != sfx_None)
{
S_StartSound(mo, s->sfx);
@ -1012,6 +1017,12 @@ static void K_SpawnFootstepParticle(mobj_t *mo, t_footstep_t *fs, tic_t timer)
dust->color = fs->color;
}
// Make offroad dust transparent
if (K_GetFootstepHeapIndex(fs) == defaultOffroadFootstep)
{
dust->renderflags |= RF_GHOSTLY;
}
if ((fs->sfx != sfx_None) && (fs->sfxFreq > 0) && (timer % fs->sfxFreq == 0))
{
S_StartSound(mo, fs->sfx);
@ -1073,7 +1084,7 @@ offroadhandle:
// - Being affected by offroad
// Using acutal offroad check here to prevent lua boostpower modifications from spawning the offroad particles - Nep
if (!(K_ApplyOffroad(mo->player) && mo->player->offroad > 0))
if (!(mo->player->bananadrag > TICRATE) && !(K_ApplyOffroad(mo->player) && mo->player->offroad > 0))
{
return;
}

View file

@ -1859,7 +1859,7 @@ void P_XYMovement(mobj_t *mo)
else if (predictedz-mo->z > abs(slopemom.z/2)
&& P_CanApplySlopePhysics(mo, mo->standingslope) == true // Now check if we were supposed to stick to this slope
&& ((!(mo->eflags & MFE_VERTICALFLIP) && (mo->z <= mo->floorz)) // mo->z <= mo->floorz means 'only do this if we did a stairstep up'
|| ((mo->eflags & MFE_VERTICALFLIP) && (mo->z+mo->height >= mo->ceilingz)))) // Always do this for old demos
|| ((mo->eflags & MFE_VERTICALFLIP) && (mo->z+mo->height >= mo->ceilingz))))
{
// Now check if we were supposed to stick to this slope
//CONS_Printf("%d-%d > %d\n", (predictedz), (mo->z), (slopemom.z/2));
@ -9095,7 +9095,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->sloperoll = mobj->target->sloperoll;
P_MoveOrigin(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
mobj->angle = mobj->target->angle;
mobj->angle = K_MomentumAngle(mobj->target);
break;
}
case MT_ROCKETSNEAKER:

View file

@ -423,6 +423,9 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT32(save->p, players[i].linktimer);
WRITEINT32(save->p, players[i].maxlink);
// Fix janky landing particle
WRITEUINT8(save->p, players[i].prevonground);
}
TracyCZoneEnd(__zone);
}
@ -753,6 +756,9 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].linktimer = READUINT32(save->p);
players[i].maxlink = READINT32(save->p);
// Fix janky landing particle
players[i].prevonground = READUINT8(save->p);
//players[i].viewheight = P_GetPlayerViewHeight(players[i]); // scale cannot be factored in at this point
}
TracyCZoneEnd(__zone);

View file

@ -47,6 +47,7 @@
#include "console.h" // CON_LogMessage
#include "k_terrain.h"
#include "acs/interface.h"
#include "blan/b_soc.h"
#ifdef HW3SOUND
#include "hardware/hw3sound.h"
@ -5167,6 +5168,12 @@ static void P_ProcessSpeedPad(player_t *player, sector_t *sector, sector_t *rove
fixed_t sfxnum;
size_t i;
if (player->mo->terrain && player->mo->terrain->speedPad > 0 && B_UseTerrainDef())
{
// Don't double process Speed Pads.
return;
}
if (player->dashpadcooldown != 0)
return;
@ -5258,6 +5265,12 @@ static void P_ProcessSpeedPad(player_t *player, sector_t *sector, sector_t *rove
static void P_ProcessPogoSpring(player_t *player, boolean isTouching, int type)
{
if (player->mo->terrain && player->mo->terrain->pogoSpring > 0 && B_UseTerrainDef())
{
// Don't double process Pogo Springs.
return;
}
const fixed_t hscale = mapobjectscale + (mapobjectscale - player->mo->scale);
const fixed_t minspeed = 24*hscale;
const fixed_t maxspeed = 28*hscale;
@ -5281,6 +5294,23 @@ static void P_ProcessPogoSpring(player_t *player, boolean isTouching, int type)
static void P_ProcessBoostPanel(player_t *player, boolean isTouching, int type)
{
if (player->mo->terrain && B_UseTerrainDef())
{
if (player->mo->terrain->flags & TRF_SNEAKERPANEL)
{
// Don't double process sneakerpanels.
return;
}
if (player->mo->terrain->flags & TRF_WATERRUNPANEL)
{
// Don't double process waterpanels.
return;
}
}
if (isTouching)
{
if (!player->floorboost)

View file

@ -1364,7 +1364,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean fromAir)
clipmomz = !(P_CheckDeathPitCollide(player->mo));
if (fromAir == true && clipmomz == true)
if (player->prevonground == false && fromAir == true && clipmomz == true)
{
K_SpawnSplashForMobj(player->mo, abs(player->mo->momz));
}

View file

@ -47,6 +47,7 @@ TYPEDEF (boostinfo_t);
TYPEDEF (player_t);
TYPEDEF (sonicloopcamvars_t);
TYPEDEF (sonicloopvars_t);
TYPEDEF (saltyhop_t);
// d_clisrv.h
TYPEDEF (clientcmd_pak);