Add results screen

This commit is contained in:
Sally Coolatta 2023-03-03 17:30:35 -05:00
parent 35d0cb8eaa
commit c4525a61a2
7 changed files with 186 additions and 1 deletions

View file

@ -50,6 +50,7 @@ extern "C" {
#include "../m_cond.h"
#include "../r_skins.h"
#include "../k_battle.h"
#include "../k_podium.h"
}
#include "call-funcs.hpp"
@ -1393,3 +1394,17 @@ bool CallFunc_PodiumPosition(ACSVM::Thread *thread, const ACSVM::Word *argV, ACS
return false;
}
/*--------------------------------------------------
bool CallFunc_PodiumFinish(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Ends the podium sequence. Doesn't do anything
outside of podium maps.
--------------------------------------------------*/
bool CallFunc_PodiumFinish(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
(void)argV;
(void)argC;
K_FinishCeremony();
return false;
}

View file

@ -86,5 +86,6 @@ bool CallFunc_LowestLap(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::W
bool CallFunc_EncoreMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PodiumPosition(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PodiumFinish(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
#endif // __SRB2_ACS_CALL_FUNCS_HPP__

View file

@ -164,6 +164,7 @@ Environment::Environment()
addFuncDataACS0( 500, addCallFunc(CallFunc_CameraWait));
addFuncDataACS0( 501, addCallFunc(CallFunc_PodiumPosition));
addFuncDataACS0( 502, addCallFunc(CallFunc_PodiumFinish));
}
ACSVM::Thread *Environment::allocThread()

View file

@ -76,6 +76,7 @@
#include "m_random.h" // P_ClearRandom
#include "k_specialstage.h"
#include "acs/interface.h"
#include "k_podium.h"
#ifdef HWRENDER
#include "hardware/hw_main.h" // 3D View Rendering
@ -580,6 +581,11 @@ static void D_Display(void)
F_TitleScreenDrawer();
break;
}
case GS_CEREMONY:
{
K_CeremonyDrawer();
break;
}
default:
{
break;

View file

@ -1471,6 +1471,8 @@ void G_DoLoadLevelEx(boolean resetplayer, gamestate_t newstate)
if (gamestate == GS_VOTING)
Y_EndVote();
K_ResetCeremony();
// cleanup
// Is this actually necessary? Doesn't F_StartTitleScreen already do a significantly more comprehensive check?
if (newstate == GS_TITLESCREEN)
@ -1724,7 +1726,11 @@ boolean G_Responder(event_t *ev)
return true; // chat ate the event
}
// todo
if (K_CeremonyResponder(ev))
{
D_StartTitle();
return true;
}
}
else if (gamestate == GS_CONTINUING)
{

View file

@ -46,6 +46,8 @@
#include "k_menu.h"
#include "k_grandprix.h"
static boolean s_podiumDone = false;
/*--------------------------------------------------
boolean K_PodiumSequence(void)
@ -103,6 +105,31 @@ boolean K_StartCeremony(void)
return false;
}
/*--------------------------------------------------
void K_FinishCeremony(void)
See header file for description.
--------------------------------------------------*/
void K_FinishCeremony(void)
{
if (K_PodiumSequence() == false)
{
return;
}
s_podiumDone = true;
}
/*--------------------------------------------------
void K_ResetCeremony(void)
See header file for description.
--------------------------------------------------*/
void K_ResetCeremony(void)
{
s_podiumDone = false;
}
/*--------------------------------------------------
void K_CeremonyTicker(boolean run)
@ -130,3 +157,83 @@ void K_CeremonyTicker(boolean run)
camera[0].subsector = titlemapcam.mobj->subsector;
}
}
/*--------------------------------------------------
boolean K_CeremonyResponder(event_t *event)
See header file for description.
--------------------------------------------------*/
boolean K_CeremonyResponder(event_t *event)
{
INT32 key = event->data1;
if (s_podiumDone == false)
{
return false;
}
// remap virtual keys (mouse & joystick buttons)
switch (key)
{
case KEY_MOUSE1:
key = KEY_ENTER;
break;
case KEY_MOUSE1 + 1:
key = KEY_BACKSPACE;
break;
case KEY_JOY1:
case KEY_JOY1 + 2:
key = KEY_ENTER;
break;
case KEY_JOY1 + 3:
key = 'n';
break;
case KEY_JOY1 + 1:
key = KEY_BACKSPACE;
break;
case KEY_HAT1:
key = KEY_UPARROW;
break;
case KEY_HAT1 + 1:
key = KEY_DOWNARROW;
break;
case KEY_HAT1 + 2:
key = KEY_LEFTARROW;
break;
case KEY_HAT1 + 3:
key = KEY_RIGHTARROW;
break;
}
if (event->type != ev_keydown)
{
return false;
}
if (key != KEY_ESCAPE && key != KEY_ENTER && key != KEY_BACKSPACE)
{
return false;
}
return true;
}
/*--------------------------------------------------
void K_CeremonyDrawer(void)
See header file for description.
--------------------------------------------------*/
void K_CeremonyDrawer(void)
{
if (s_podiumDone == true)
{
V_DrawFadeScreen(0xFF00, 16);
V_DrawCenteredString(BASEVIDWIDTH / 2, 64, 0, "STUFF GOES HERE");
}
if (timeinmap < 16)
{
// Level fade-in
V_DrawCustomFadeScreen(((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), 31-(timeinmap*2));
}
}

View file

@ -54,6 +54,27 @@ boolean K_PodiumSequence(void);
boolean K_StartCeremony(void);
/*--------------------------------------------------
void K_FinishCeremony(void);
Called at the end of the podium cutscene,
displays the ranking screen and starts
accepting input.
--------------------------------------------------*/
void K_FinishCeremony(void);
/*--------------------------------------------------
void K_ResetCeremony(void);
Called on level load, to reset all of the
podium variables.
--------------------------------------------------*/
void K_ResetCeremony(void);
/*--------------------------------------------------
void K_CeremonyTicker(boolean run);
@ -72,6 +93,34 @@ boolean K_StartCeremony(void);
void K_CeremonyTicker(boolean run);
/*--------------------------------------------------
void K_CeremonyResponder(event_t *ev);
Responder function to be ran during the podium
cutscene mode gamestate. Handles key presses
ending the podium scene.
Input Arguments:-
ev - The player input event.
Return:-
true to end the podium cutscene and return
to the title screen, otherwise false.
--------------------------------------------------*/
boolean K_CeremonyResponder(event_t *ev);
/*--------------------------------------------------
void K_CeremonyDrawer(void);
Handles the ranking screen and other HUD for
the podium cutscene.
--------------------------------------------------*/
void K_CeremonyDrawer(void);
#ifdef __cplusplus
} // extern "C"
#endif