mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-16 01:31:30 +00:00
Attempt 1: Guesstimate sphere pop rate and use that as the Capsule handling duration
This commit is contained in:
parent
56d8f47aaa
commit
7cdce4324b
2 changed files with 28 additions and 7 deletions
|
@ -8751,8 +8751,11 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
nummaprings = -1; // no perfect bonus, rings are free
|
||||
break;
|
||||
case MT_EGGCAPSULE:
|
||||
mobj->extravalue1 = -1; // sphere timer for how long a player has been at the capsule
|
||||
mobj->extravalue2 = -1; // tic timer for how long a player has been at the capsule
|
||||
mobj->extravalue1 = -1; // sphere timer for how long a player has been at the capsule
|
||||
mobj->extravalue2 = -1; // tic timer for how long a player has been at the capsule
|
||||
mobj->lastlook = -1;
|
||||
mobj->cusval = -1;
|
||||
mobj->movecount = -1;
|
||||
break;
|
||||
case MT_REDTEAMRING:
|
||||
mobj->color = skincolor_redteam;
|
||||
|
|
28
src/p_user.c
28
src/p_user.c
|
@ -5995,14 +5995,32 @@ static void P_DoNiGHTSCapsule(player_t *player)
|
|||
&& player->mo->y == player->capsule->y
|
||||
&& player->mo->z == player->capsule->z+(player->capsule->height/3))
|
||||
{
|
||||
if (player->capsule->lastlook < 0)
|
||||
{
|
||||
INT32 popduration = max(60 - player->capsule->extravalue2, 1);
|
||||
INT32 spherecount = min(player->spheres, player->capsule->health);
|
||||
player->capsule->lastlook = max(FixedRound(FixedDiv(spherecount, popduration))/FRACUNIT, 1);
|
||||
player->capsule->cusval = max(FixedFloor(FixedDiv(popduration, spherecount))/FRACUNIT, 1);
|
||||
player->capsule->movecount = player->capsule->extravalue2;
|
||||
}
|
||||
|
||||
if (player->spheres > 0)
|
||||
{
|
||||
player->spheres--;
|
||||
player->capsule->health--;
|
||||
player->capsule->extravalue1++;
|
||||
if (!((player->capsule->extravalue2 - player->capsule->movecount) % player->capsule->cusval))
|
||||
{
|
||||
player->spheres -= player->capsule->lastlook;
|
||||
player->capsule->health -= player->capsule->lastlook;
|
||||
player->capsule->extravalue1 += player->capsule->lastlook;
|
||||
}
|
||||
|
||||
if (player->spheres < 0)
|
||||
player->spheres = 0;
|
||||
|
||||
if (player->capsule->health < 0)
|
||||
player->capsule->health = 0;
|
||||
|
||||
// Spawn a 'pop' for every 5 rings you deposit
|
||||
if (!(player->capsule->extravalue1 % 5))
|
||||
if (!((player->capsule->extravalue2 - player->capsule->movecount) % 5))
|
||||
S_StartSound(P_SpawnMobj(player->capsule->x + ((P_SignedRandom()/2)<<FRACBITS),
|
||||
player->capsule->y + ((P_SignedRandom()/2)<<FRACBITS),
|
||||
player->capsule->z + (player->capsule->height/2) + ((P_SignedRandom()/2)<<FRACBITS),
|
||||
|
@ -6090,7 +6108,7 @@ static void P_DoNiGHTSCapsule(player_t *player)
|
|||
player->texttimer = 4*TICRATE;
|
||||
player->textvar = 3; // Get more rings!
|
||||
player->capsule->reactiontime = 0;
|
||||
player->capsule->extravalue1 = player->capsule->extravalue2 = -1;
|
||||
player->capsule->extravalue1 = player->capsule->extravalue2 = player->capsule->lastlook = player->capsule->cusval = player->capsule->movecount = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue