mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-10 00:34:32 +00:00
LSZ bungee: first pass
This commit is contained in:
parent
35e530be3d
commit
ea8e871176
6 changed files with 134 additions and 3 deletions
|
|
@ -11833,7 +11833,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
K_KartDrift(player, onground);
|
||||
K_KartSpindash(player);
|
||||
|
||||
if (onground == false)
|
||||
if (onground == false
|
||||
&& !player->bungee // if this list of condition ever gets bigger, maybe this should become a function.
|
||||
)
|
||||
{
|
||||
K_AirFailsafe(player);
|
||||
}
|
||||
|
|
@ -11841,8 +11843,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
{
|
||||
player->pflags &= ~PF_AIRFAILSAFE;
|
||||
}
|
||||
|
||||
|
||||
Obj_RingShooterInput(player);
|
||||
Obj_playerBungeeThink(player);
|
||||
}
|
||||
|
||||
void K_CheckSpectateStatus(boolean considermapreset)
|
||||
|
|
|
|||
|
|
@ -231,6 +231,9 @@ void Obj_RideroidNodeSpawn(mobj_t *mo);
|
|||
void Obj_RideroidNodeThink(mobj_t *mo);
|
||||
void Obj_getPlayerOffRideroid(mobj_t *mo); // used in p_map.c to get off of em when passing transfer lines.
|
||||
|
||||
/* LSZ Bungee */
|
||||
void Obj_BungeeSpecial(mobj_t *mo, player_t *p); // used when the player touches the bungee, to be used in p_inter.c
|
||||
void Obj_playerBungeeThink(player_t *p); // player interaction with the bungee. The bungee is to be stored in p->mo->tracer.
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
|
|
@ -30,4 +30,5 @@ target_sources(SRB2SDL2 PRIVATE
|
|||
emerald.c
|
||||
checkpoint.cpp
|
||||
rideroid.c
|
||||
bungee.c
|
||||
)
|
||||
|
|
|
|||
120
src/objects/bungee.c
Normal file
120
src/objects/bungee.c
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
// DR. ROBOTNIK'S RING RACERS
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2022 by Sally "TehRealSalt" Cochenour
|
||||
// Copyright (C) 2022 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 bungee.c
|
||||
/// \brief Leaf Storm bungee interaction/behaviour code to be used in other files.
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../doomstat.h"
|
||||
#include "../info.h"
|
||||
#include "../k_kart.h"
|
||||
#include "../k_objects.h"
|
||||
#include "../m_random.h"
|
||||
#include "../p_local.h"
|
||||
#include "../r_main.h"
|
||||
#include "../s_sound.h"
|
||||
#include "../g_game.h"
|
||||
#include "../z_zone.h"
|
||||
#include "../k_waypoint.h"
|
||||
#include "../k_respawn.h"
|
||||
#include "../k_collide.h"
|
||||
|
||||
#define BUNGEE_NONE 0
|
||||
#define BUNGEE_LATCH 1
|
||||
#define BUNGEE_LAUNCH 2
|
||||
|
||||
// Touching the bungee, used in p_inter.c
|
||||
void Obj_BungeeSpecial(mobj_t *mo, player_t *p)
|
||||
{
|
||||
|
||||
mobj_t *latch;
|
||||
|
||||
if (p->bungee || P_IsObjectOnGround(p->mo) || p->springstars)
|
||||
return;
|
||||
|
||||
P_InstaThrust(p->mo, 0, 0);
|
||||
p->bungee = BUNGEE_LATCH;
|
||||
p->mo->flags |= MF_NOCLIPTHING; // prevent players from bumping if they latch onto the same bungee.
|
||||
p->pflags |= PF_NOFASTFALL; // didn't know this flag existed but it's very convenient!!
|
||||
|
||||
latch = P_SpawnMobj(p->mo->x, p->mo->y, p->mo->z, MT_THOK);
|
||||
P_SetMobjState(latch, S_INVISIBLE);
|
||||
latch->angle = mo->angle;
|
||||
|
||||
S_StartSound(mo, sfx_s3k5a);
|
||||
P_SetTarget(&p->mo->tracer, latch);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// this is the thinker to call on the player when they get bungee'd.
|
||||
void Obj_playerBungeeThink(player_t *p)
|
||||
{
|
||||
|
||||
mobj_t *bungee = p->mo->tracer;
|
||||
UINT8 i;
|
||||
|
||||
// someone removed it
|
||||
if (!bungee || !P_MobjWasRemoved(bungee))
|
||||
return;
|
||||
|
||||
bungee->tics = 4; // we set this to a low value so that it despawns if the player vanishes for some reason.
|
||||
|
||||
if (p->bungee == BUNGEE_LATCH)
|
||||
{
|
||||
// rr has super high gravity which gets in the way.
|
||||
p->mo->flags |= MF_NOGRAVITY;
|
||||
p->mo->momz = (p->mo->momz*9)/10;
|
||||
|
||||
if (abs(p->mo->momz) < 6*mapobjectscale)
|
||||
{
|
||||
p->bungee = BUNGEE_LAUNCH;
|
||||
p->mo->momz = P_MobjFlip(p->mo)*mapobjectscale;
|
||||
S_StartSound(p->mo, sfx_s3k81);
|
||||
}
|
||||
}
|
||||
else if (p->bungee == BUNGEE_LAUNCH)
|
||||
{
|
||||
p->mo->momz = (p->mo->momz*12)/10;
|
||||
|
||||
// if we go above/below (depending on our flip flags) the bungee, release us!
|
||||
if ((p->mo->eflags & MFE_VERTICALFLIP && p->mo->z < bungee->z)
|
||||
|| (!(p->mo->eflags & MFE_VERTICALFLIP) && p->mo->z > bungee->z ))
|
||||
{
|
||||
|
||||
p->mo->flags &= ~MF_NOGRAVITY;
|
||||
p->mo->flags &= ~MF_NOCLIPTHING;
|
||||
p->mo->pflags &= ~PF_NOFASTFALL;
|
||||
p->bungee = BUNGEE_NONE;
|
||||
P_InstaThrust(p->mo, bungee->angle, p->mo->momz/8);
|
||||
p->mo->momz = (p->mo->momz*3)/4;
|
||||
|
||||
p->springstars = TICRATE; // these are used as a buffer not to latch to vines again.
|
||||
p->springcolor = SKINCOLOR_EMERALD;
|
||||
|
||||
P_RemoveMobj(bungee);
|
||||
P_SetTarget(&p->mo->tracer, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// basic visuals (but hey they work fine enough!)
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
fixed_t xpos = -(bungee->x - p->mo->x) /8 *i;
|
||||
fixed_t ypos = -(bungee->y - p->mo->y) /8 *i;
|
||||
fixed_t zpos = -(bungee->z - p->mo->z) /8 *i;
|
||||
|
||||
mobj_t *seg = P_SpawnMobj(bungee->x + xpos, bungee->y + ypos, bungee->z + zpos, MT_THOK);
|
||||
|
||||
P_SetScale(seg, mapobjectscale/3);
|
||||
seg->color = SKINCOLOR_EMERALD;
|
||||
seg->fuse = 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -757,6 +757,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
case MT_LSZ_BUNGEE:
|
||||
Obj_BungeeSpecial(special, player);
|
||||
return;
|
||||
|
||||
// CTF Flags
|
||||
case MT_REDFLAG:
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
WRITEFIXED(save->p, players[i].rdaddmomy);
|
||||
WRITEFIXED(save->p, players[i].rdaddmomz);
|
||||
|
||||
WRITEUINT8(save->, players[i].bungee);
|
||||
WRITEUINT8(save->p, players[i].bungee);
|
||||
|
||||
// respawnvars_t
|
||||
WRITEUINT8(save->p, players[i].respawn.state);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue