mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'caltropcalstop' into 'master'
Caltrop calstop (resolves #114) Closes #114 See merge request KartKrew/Kart!381
This commit is contained in:
commit
465bc55219
5 changed files with 21 additions and 18 deletions
|
|
@ -1195,8 +1195,8 @@ static int lib_pGivePlayerRings(lua_State *L)
|
|||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_GivePlayerRings(player, num_rings);
|
||||
return 0;
|
||||
lua_pushinteger(L, P_GivePlayerRings(player, num_rings));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pGivePlayerLives(lua_State *L)
|
||||
|
|
|
|||
|
|
@ -4186,10 +4186,8 @@ void A_AttractChase(mobj_t *actor)
|
|||
{
|
||||
if (actor->extravalue1 >= 16)
|
||||
{
|
||||
if (actor->target->player->rings >= 20)
|
||||
if (!P_GivePlayerRings(actor->target->player, 1)) // returns 0 if addition failed
|
||||
actor->target->player->kartstuff[k_ringboost] += K_GetKartRingPower(actor->target->player)+3;
|
||||
else
|
||||
P_GivePlayerRings(actor->target->player, 1);
|
||||
|
||||
if (actor->cvmem) // caching
|
||||
S_StartSound(actor->target, sfx_s1c5);
|
||||
|
|
|
|||
|
|
@ -2211,15 +2211,14 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
|||
if (K_GetShieldFromItem(player->kartstuff[k_itemtype]) != KSHIELD_NONE)
|
||||
return;
|
||||
|
||||
// 20 is the ring cap in kart
|
||||
// 20 is the maximum number of rings that can be taken from you at once - half the span of your counter
|
||||
if (num_rings > 20)
|
||||
num_rings = 20;
|
||||
else if (num_rings <= 0)
|
||||
return;
|
||||
|
||||
num_fling_rings = min(num_rings, player->rings);
|
||||
|
||||
P_GivePlayerRings(player, -num_rings);
|
||||
num_rings = -P_GivePlayerRings(player, -num_rings);
|
||||
num_fling_rings = num_rings+min(0, player->rings);
|
||||
|
||||
// determine first angle
|
||||
fa = player->mo->angle + ((P_RandomByte() & 1) ? -ANGLE_90 : ANGLE_90);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ boolean P_EndingMusic(player_t *player);
|
|||
void P_SpawnShieldOrb(player_t *player);
|
||||
void P_SwitchShield(player_t *player, UINT16 shieldtype);
|
||||
mobj_t *P_SpawnGhostMobj(mobj_t *mobj);
|
||||
void P_GivePlayerRings(player_t *player, INT32 num_rings);
|
||||
INT32 P_GivePlayerRings(player_t *player, INT32 num_rings);
|
||||
void P_GivePlayerSpheres(player_t *player, INT32 num_spheres);
|
||||
void P_GivePlayerLives(player_t *player, INT32 numlives);
|
||||
UINT8 P_GetNextEmerald(void);
|
||||
|
|
|
|||
22
src/p_user.c
22
src/p_user.c
|
|
@ -487,23 +487,29 @@ void P_ResetPlayer(player_t *player)
|
|||
//
|
||||
// Gives rings to the player, and does any special things required.
|
||||
// Call this function when you want to increment the player's health.
|
||||
// Returns the number of rings successfully given (or taken).
|
||||
//
|
||||
|
||||
void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
||||
INT32 P_GivePlayerRings(player_t *player, INT32 num_rings)
|
||||
{
|
||||
INT32 test;
|
||||
|
||||
if (!player->mo)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
if ((gametyperules & GTR_BUMPERS)) // No rings in Battle Mode
|
||||
return;
|
||||
return 0;
|
||||
|
||||
test = player->rings + num_rings;
|
||||
if (test > 20) // Caps at 20 rings, sorry!
|
||||
num_rings -= (test-20);
|
||||
else if (test < -20) // Chaotix ring debt!
|
||||
num_rings -= (test+20);
|
||||
|
||||
player->rings += num_rings;
|
||||
//player->totalring += num_rings; // Used for GP lives later
|
||||
//player->totalring += num_rings; // Used for GP lives later -- maybe you might want to move this earlier to discourage ring debt...
|
||||
|
||||
if (player->rings > 20)
|
||||
player->rings = 20; // Caps at 20 rings, sorry!
|
||||
else if (player->rings < -20)
|
||||
player->rings = -20; // Chaotix ring debt!
|
||||
return num_rings;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue