Skip to content

Commit

Permalink
game: Avoid appearing WP_KI, a bit used as main ki ammo, in the weapo…
Browse files Browse the repository at this point in the history
…ns when using 'give all' cheat command. Set 10000 ki when using 'give all'. Change the order of WP_KI bit and fix stunned status when trying to jump and going up underwater
  • Loading branch information
LegendaryGuard committed Nov 29, 2024
1 parent be33013 commit 00f0bac
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
21 changes: 19 additions & 2 deletions source/game/bg_pmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,12 +770,27 @@ static void PM_WaterMove( void ) {
wishvel[1] = 0;
wishvel[2] = -60; // sink towards bottom
} else {
for (i=0 ; i<3 ; i++)
for (i=0 ; i<3 ; i++) {
wishvel[i] = scale * pml.forward[i]*pm->cmd.forwardmove + scale * pml.right[i]*pm->cmd.rightmove;

// BFP - Avoid going up, keep sinking
if ( i == 2
&& ( pm->ps->weaponstate == WEAPON_KIEXPLOSIONWAVE || pm->ps->weaponstate == WEAPON_STUN
|| ( pm->ps->pm_flags & PMF_HITSTUN ) ) ) {
wishvel[2] = 0;
}
}

wishvel[2] += scale * pm->cmd.upmove;
}

// BFP - Sink on stunned status
if ( pm->ps->weaponstate == WEAPON_KIEXPLOSIONWAVE || pm->ps->weaponstate == WEAPON_STUN
|| ( pm->ps->pm_flags & PMF_HITSTUN ) ) {
wishvel[2] -= pm->ps->gravity * pml.frametime;
PM_SlideMove( qtrue );
}

VectorCopy (wishvel, wishdir);
wishspeed = VectorNormalize(wishdir);

Expand Down Expand Up @@ -1435,7 +1450,9 @@ PM_ControlJumpOnGround
=============
*/
static void PM_ControlJumpOnGround() { // BFP - A control to handle user movement intentions when jumping off the ground
if ( pm->ps->groundEntityNum != ENTITYNUM_NONE
if ( !pml.walking // don't use on walking
&& pm->ps->weaponstate != WEAPON_STUN
&& pm->ps->groundEntityNum != ENTITYNUM_NONE
&& pm->ps->powerups[PW_FLIGHT] <= 0
&& ( pm->cmd.upmove > 0 || ( pm->ps->pm_flags & PMF_JUMP_HELD ) )
&& ( pm->cmd.forwardmove > 0 || pm->cmd.forwardmove < 0
Expand Down
2 changes: 1 addition & 1 deletion source/game/bg_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ typedef enum {
typedef enum {
WP_NONE,

WP_KI, // BFP - Ammo bit used for ki
WP_GAUNTLET,
WP_MACHINEGUN,
WP_SHOTGUN,
Expand All @@ -341,6 +340,7 @@ typedef enum {
WP_PLASMAGUN,
WP_BFG,
WP_GRAPPLING_HOOK,
WP_KI, // BFP - Ammo bit used for ki

WP_NUM_WEAPONS
} weapon_t;
Expand Down
9 changes: 8 additions & 1 deletion source/game/g_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,23 @@ void Cmd_Give_f (gentity_t *ent)
if (give_all || Q_stricmp(name, "weapons") == 0)
{
ent->client->ps.stats[STAT_WEAPONS] = (1 << WP_NUM_WEAPONS) - 1 -
( 1 << WP_GRAPPLING_HOOK ) - ( 1 << WP_NONE );
( 1 << WP_GRAPPLING_HOOK ) - ( 1 << WP_NONE ) - ( 1 << WP_KI );
if (!give_all)
return;
}

if (give_all || Q_stricmp(name, "ammo") == 0)
{
// BFP - TODO: Don't give all ammo to all weapons, that part is supposed to be removed in the future
#if 1
for ( i = 0 ; i < MAX_WEAPONS ; i++ ) {
if ( i == WP_KI ) continue;
ent->client->ps.ammo[i] = 999;
}
#endif
// BFP - TODO: If the player is a monster in Monster gametype, give 20000
ent->client->ps.ammo[WP_KI] = 10000;

if (!give_all)
return;
}
Expand Down

0 comments on commit 00f0bac

Please sign in to comment.