mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 12:01:47 +00:00
Cleanup of boss info in anticipation of merger.
* Actually add descriptions for the boss-related functions into k_boss.h. * Introduce K_ResetBossInfo, an internal-only function for handling situations where it needs to be cleared. * Fix a bug where bossinfo wasn't reset when using the map command to go to a battle map after having been in a boss. * Fix some bugs where you could provide magnitudes out of the desired range to K_InitBossHealthBar and K_UpdateBossHealthBar.
This commit is contained in:
parent
590d236b66
commit
5c77516aab
5 changed files with 77 additions and 19 deletions
|
|
@ -930,11 +930,7 @@ void D_StartTitle(void)
|
||||||
memset(&grandprixinfo, 0, sizeof(struct grandprixinfo));
|
memset(&grandprixinfo, 0, sizeof(struct grandprixinfo));
|
||||||
|
|
||||||
// Reset boss info
|
// Reset boss info
|
||||||
if (bossinfo.enemyname)
|
K_ResetBossInfo();
|
||||||
Z_Free(bossinfo.enemyname);
|
|
||||||
if (bossinfo.subtitle)
|
|
||||||
Z_Free(bossinfo.subtitle);
|
|
||||||
memset(&bossinfo, 0, sizeof(struct bossinfo));
|
|
||||||
|
|
||||||
// empty maptol so mario/etc sounds don't play in sound test when they shouldn't
|
// empty maptol so mario/etc sounds don't play in sound test when they shouldn't
|
||||||
maptol = 0;
|
maptol = 0;
|
||||||
|
|
|
||||||
|
|
@ -2749,17 +2749,11 @@ static void Command_Map_f(void)
|
||||||
if (newgametype == GT_BATTLE)
|
if (newgametype == GT_BATTLE)
|
||||||
{
|
{
|
||||||
grandprixinfo.gp = false;
|
grandprixinfo.gp = false;
|
||||||
|
K_ResetBossInfo();
|
||||||
|
|
||||||
if (mapheaderinfo[newmapnum-1] &&
|
if (mapheaderinfo[newmapnum-1] &&
|
||||||
mapheaderinfo[newmapnum-1]->typeoflevel & TOL_BOSS)
|
mapheaderinfo[newmapnum-1]->typeoflevel & TOL_BOSS)
|
||||||
{
|
{
|
||||||
// Reset boss info
|
|
||||||
if (bossinfo.enemyname)
|
|
||||||
Z_Free(bossinfo.enemyname);
|
|
||||||
if (bossinfo.subtitle)
|
|
||||||
Z_Free(bossinfo.subtitle);
|
|
||||||
memset(&bossinfo, 0, sizeof(struct bossinfo));
|
|
||||||
|
|
||||||
bossinfo.boss = true;
|
bossinfo.boss = true;
|
||||||
bossinfo.encore = newencoremode;
|
bossinfo.encore = newencoremode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
src/k_boss.c
22
src/k_boss.c
|
|
@ -22,6 +22,18 @@
|
||||||
|
|
||||||
struct bossinfo bossinfo;
|
struct bossinfo bossinfo;
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
void K_ClearBossInfo(void)
|
||||||
|
|
||||||
|
See header file for description.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
void K_ResetBossInfo(void)
|
||||||
|
{
|
||||||
|
Z_Free(bossinfo.enemyname);
|
||||||
|
Z_Free(bossinfo.subtitle);
|
||||||
|
memset(&bossinfo, 0, sizeof(struct bossinfo));
|
||||||
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
void K_BossInfoTicker(void)
|
void K_BossInfoTicker(void)
|
||||||
|
|
||||||
|
|
@ -118,6 +130,11 @@ void K_InitBossHealthBar(const char *enemyname, const char *subtitle, sfxenum_t
|
||||||
bossinfo.barlen = BOSSHEALTHBARLEN;
|
bossinfo.barlen = BOSSHEALTHBARLEN;
|
||||||
K_UpdateBossHealthBar(FRACUNIT, 0);
|
K_UpdateBossHealthBar(FRACUNIT, 0);
|
||||||
|
|
||||||
|
if (pinchmagnitude > FRACUNIT)
|
||||||
|
pinchmagnitude = FRACUNIT;
|
||||||
|
else if (pinchmagnitude < 0)
|
||||||
|
pinchmagnitude = 0;
|
||||||
|
|
||||||
bossinfo.healthbarpinch = FixedMul(pinchmagnitude, BOSSHEALTHBARLEN*FRACUNIT)>>FRACBITS;
|
bossinfo.healthbarpinch = FixedMul(pinchmagnitude, BOSSHEALTHBARLEN*FRACUNIT)>>FRACBITS;
|
||||||
|
|
||||||
// we do this here so we can fudge our working a bit
|
// we do this here so we can fudge our working a bit
|
||||||
|
|
@ -143,6 +160,11 @@ void K_InitBossHealthBar(const char *enemyname, const char *subtitle, sfxenum_t
|
||||||
|
|
||||||
void K_UpdateBossHealthBar(fixed_t magnitude, tic_t jitterlen)
|
void K_UpdateBossHealthBar(fixed_t magnitude, tic_t jitterlen)
|
||||||
{
|
{
|
||||||
|
if (magnitude > FRACUNIT)
|
||||||
|
magnitude = FRACUNIT;
|
||||||
|
else if (magnitude < 0)
|
||||||
|
magnitude = 0;
|
||||||
|
|
||||||
if (jitterlen > bossinfo.visualbarimpact)
|
if (jitterlen > bossinfo.visualbarimpact)
|
||||||
bossinfo.visualbarimpact = jitterlen;
|
bossinfo.visualbarimpact = jitterlen;
|
||||||
bossinfo.healthbar = FixedMul(magnitude, BOSSHEALTHBARLEN);
|
bossinfo.healthbar = FixedMul(magnitude, BOSSHEALTHBARLEN);
|
||||||
|
|
|
||||||
52
src/k_boss.h
52
src/k_boss.h
|
|
@ -55,9 +55,61 @@ extern struct bossinfo
|
||||||
char *subtitle; ///< The subtitle under the titlecard
|
char *subtitle; ///< The subtitle under the titlecard
|
||||||
} bossinfo;
|
} bossinfo;
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
void K_ResetBossInfo(void);
|
||||||
|
|
||||||
|
Resets boss information to a clean slate.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
|
||||||
|
void K_ResetBossInfo(void);
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
void K_ResetBossInfo(void);
|
||||||
|
|
||||||
|
Updates boss information and timers for this level tic.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
|
||||||
void K_BossInfoTicker(void);
|
void K_BossInfoTicker(void);
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
void K_InitBossHealthBar(const char *enemyname, const char *subtitle, sfxenum_t titlesound, fixed_t pinchmagnitude, UINT8 divisions);
|
||||||
|
|
||||||
|
Initialises boss information for opponent spawn, including filling the health bar.
|
||||||
|
|
||||||
|
Input Arguments:-
|
||||||
|
enemyname - Zone memory string for HUD/titlecard name.
|
||||||
|
subtitle - Zone memory string for titlecard subtitle.
|
||||||
|
titlesound - Sound effect enum for titlecard typewriting.
|
||||||
|
pinchmagnitude - 0-FRACUNIT range for healthbar to display pinch status at.
|
||||||
|
divisions - # of segments on healthbar.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
|
||||||
void K_InitBossHealthBar(const char *enemyname, const char *subtitle, sfxenum_t titlesound, fixed_t pinchmagnitude, UINT8 divisions);
|
void K_InitBossHealthBar(const char *enemyname, const char *subtitle, sfxenum_t titlesound, fixed_t pinchmagnitude, UINT8 divisions);
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
void K_UpdateBossHealthBar(fixed_t magnitude, tic_t jitterlen);
|
||||||
|
|
||||||
|
Updates boss healthbar to a new magnitude.
|
||||||
|
|
||||||
|
Input Arguments:-
|
||||||
|
magnitude - 0-FRACUNIT range for healthbar to update to.
|
||||||
|
jitterlen - Duration healthbar should vibrate for.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
|
||||||
void K_UpdateBossHealthBar(fixed_t magnitude, tic_t jitterlen);
|
void K_UpdateBossHealthBar(fixed_t magnitude, tic_t jitterlen);
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
void K_DeclareWeakspot(mobj_t *spot, spottype_t spottype, UINT16 color, boolean minimap);
|
||||||
|
|
||||||
|
Updates the list of Weakspots for the HUD/minimap object tracking.
|
||||||
|
|
||||||
|
Input Arguments:-
|
||||||
|
spot - mobj_t reference.
|
||||||
|
spottype - Type of spot.
|
||||||
|
color - Color of associated UI elements.
|
||||||
|
minimap - If true, appear on minimap.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
|
||||||
void K_DeclareWeakspot(mobj_t *spot, spottype_t spottype, UINT16 color, boolean minimap);
|
void K_DeclareWeakspot(mobj_t *spot, spottype_t spottype, UINT16 color, boolean minimap);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7839,13 +7839,7 @@ static void M_StartBoss(INT32 choice)
|
||||||
|
|
||||||
M_ClearMenus(true);
|
M_ClearMenus(true);
|
||||||
|
|
||||||
// Reset boss info
|
K_ResetBossInfo();
|
||||||
if (bossinfo.enemyname)
|
|
||||||
Z_Free(bossinfo.enemyname);
|
|
||||||
if (bossinfo.subtitle)
|
|
||||||
Z_Free(bossinfo.subtitle);
|
|
||||||
memset(&bossinfo, 0, sizeof(struct bossinfo));
|
|
||||||
|
|
||||||
bossinfo.boss = true;
|
bossinfo.boss = true;
|
||||||
bossinfo.encore = (boolean)(cv_dummygpencore.value);
|
bossinfo.encore = (boolean)(cv_dummygpencore.value);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue