mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 03:51:50 +00:00
Battle: flash emeralds on screen when someone wins by collecting all 7
- Modifies netsave
This commit is contained in:
parent
6431ef8250
commit
a759626335
7 changed files with 55 additions and 0 deletions
|
|
@ -2,4 +2,5 @@ target_sources(SRB2SDL2 PRIVATE
|
|||
powerup.cpp
|
||||
spectator.cpp
|
||||
timer.cpp
|
||||
emerald-win.cpp
|
||||
)
|
||||
|
|
|
|||
41
src/hud/emerald-win.cpp
Normal file
41
src/hud/emerald-win.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include "../v_draw.hpp"
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../i_time.h"
|
||||
#include "../k_hud.h"
|
||||
#include "../screen.h"
|
||||
|
||||
using srb2::Draw;
|
||||
|
||||
void K_drawEmeraldWin(void)
|
||||
{
|
||||
constexpr float kScale = 0.25;
|
||||
constexpr int kH = 72 * kScale;
|
||||
constexpr int kYPad = 12;
|
||||
constexpr int kWidth = 34 + 4;
|
||||
|
||||
if (I_GetTime() % 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Draw row = Draw(BASEVIDWIDTH / 2, BASEVIDHEIGHT / 2).scale(kScale).flags(V_ADD);
|
||||
//Draw(0, row.y()).size(BASEVIDWIDTH, 1).fill(35);
|
||||
|
||||
Draw top = row.y(-kYPad);
|
||||
Draw bot = row.xy(-kWidth / 2, kH + kYPad);
|
||||
|
||||
auto put = [](Draw& row, int x, int n)
|
||||
{
|
||||
row.x(x * kWidth).colormap(static_cast<skincolornum_t>(SKINCOLOR_CHAOSEMERALD1 + n)).patch("EMRCA0");
|
||||
};
|
||||
|
||||
put(top, -1, 3);
|
||||
put(top, 0, 0);
|
||||
put(top, 1, 4);
|
||||
|
||||
put(bot, -1, 5);
|
||||
put(bot, 0, 1);
|
||||
put(bot, 1, 2);
|
||||
put(bot, 2, 6);
|
||||
}
|
||||
|
|
@ -41,6 +41,9 @@ INT32 numgotboxes = 0;
|
|||
UINT8 maptargets = 0; // Capsules in map
|
||||
UINT8 numtargets = 0; // Capsules busted
|
||||
|
||||
// Battle: someone won by collecting all 7 Chaos Emeralds
|
||||
boolean g_emeraldWin = false;
|
||||
|
||||
INT32 K_StartingBumperCount(void)
|
||||
{
|
||||
if (tutorialchallenge == TUTORIALSKIP_INPROGRESS)
|
||||
|
|
@ -194,6 +197,7 @@ void K_CheckEmeralds(player_t *player)
|
|||
player->roundscore = 100; // lmao
|
||||
|
||||
P_DoAllPlayersExit(0, false);
|
||||
g_emeraldWin = true;
|
||||
}
|
||||
|
||||
UINT16 K_GetChaosEmeraldColor(UINT32 emeraldType)
|
||||
|
|
@ -855,6 +859,8 @@ void K_BattleInit(boolean singleplayercontext)
|
|||
|
||||
g_battleufo.due = starttime;
|
||||
g_battleufo.previousId = Obj_RandomBattleUFOSpawnerID() - 1;
|
||||
|
||||
g_emeraldWin = false;
|
||||
}
|
||||
|
||||
UINT8 K_Bumpers(player_t *player)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ extern struct battleufo
|
|||
extern boolean battleprisons;
|
||||
extern INT32 nummapboxes, numgotboxes; // keep track of spawned battle mode items
|
||||
extern UINT8 maptargets, numtargets;
|
||||
extern boolean g_emeraldWin;
|
||||
|
||||
INT32 K_StartingBumperCount(void);
|
||||
boolean K_IsPlayerWanted(player_t *player);
|
||||
|
|
|
|||
|
|
@ -5663,6 +5663,9 @@ void K_drawKartHUD(void)
|
|||
if ((gametyperules & GTR_KARMA) && !r_splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM *
|
||||
V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem);
|
||||
|
||||
if (g_emeraldWin)
|
||||
K_drawEmeraldWin();
|
||||
|
||||
// Draw FREE PLAY.
|
||||
K_drawKartFreePlay();
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ void K_drawSpectatorHUD(boolean director);
|
|||
void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, UINT8 mode);
|
||||
void K_drawKart2PTimestamp(void);
|
||||
void K_drawKart4PTimestamp(void);
|
||||
void K_drawEmeraldWin(void);
|
||||
void K_DrawMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, UINT16 map, const UINT8 *colormap);
|
||||
void K_DrawLikeMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, patch_t *patch, const UINT8 *colormap);
|
||||
void K_drawTargetHUD(const vector3_t *origin, player_t *player);
|
||||
|
|
|
|||
|
|
@ -6433,6 +6433,7 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
|||
WRITEINT32(save->p, numgotboxes);
|
||||
WRITEUINT8(save->p, numtargets);
|
||||
WRITEUINT8(save->p, battleprisons);
|
||||
WRITEUINT8(save->p, g_emeraldWin);
|
||||
|
||||
WRITEUINT8(save->p, gamespeed);
|
||||
WRITEUINT8(save->p, numlaps);
|
||||
|
|
@ -6617,6 +6618,7 @@ static boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
|
|||
numgotboxes = READINT32(save->p);
|
||||
numtargets = READUINT8(save->p);
|
||||
battleprisons = (boolean)READUINT8(save->p);
|
||||
g_emeraldWin = (boolean)READUINT8(save->p);
|
||||
|
||||
gamespeed = READUINT8(save->p);
|
||||
numlaps = READUINT8(save->p);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue