mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Titlecard CEcho
This commit is contained in:
parent
c41d0dee32
commit
d755d6edb9
8 changed files with 105 additions and 2 deletions
|
|
@ -565,6 +565,25 @@ bool CallFunc_EndPrint(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Wo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
bool CallFunc_EndPrintTitlecard(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
|
||||||
|
|
||||||
|
One of the ACS wrappers for Titlecard CEcho. This
|
||||||
|
version only prints if the activator is a
|
||||||
|
display player.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
bool CallFunc_EndPrintTitlecard(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
|
||||||
|
{
|
||||||
|
(void)argV;
|
||||||
|
(void)argC;
|
||||||
|
|
||||||
|
if (ACS_ActivatorIsLocal(thread) == true)
|
||||||
|
HU_DoTitlecardCEcho(thread->printBuf.data());
|
||||||
|
|
||||||
|
thread->printBuf.drop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
bool CallFunc_PlayerCount(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
|
bool CallFunc_PlayerCount(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
|
||||||
|
|
||||||
|
|
@ -935,6 +954,23 @@ bool CallFunc_EndPrintBold(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
bool CallFunc_EndPrintBoldTitlecard(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
|
||||||
|
|
||||||
|
One of the ACS wrappers for Titlecard CEcho. This
|
||||||
|
version prints for all players.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
bool CallFunc_EndPrintBoldTitlecard(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
|
||||||
|
{
|
||||||
|
(void)argV;
|
||||||
|
(void)argC;
|
||||||
|
|
||||||
|
HU_DoTitlecardCEcho(thread->printBuf.data());
|
||||||
|
|
||||||
|
thread->printBuf.drop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
bool CallFunc_PlayerTeam(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
|
bool CallFunc_PlayerTeam(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ bool CallFunc_ChangeCeiling(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSV
|
||||||
bool CallFunc_LineSide(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_LineSide(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_ClearLineSpecial(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_ClearLineSpecial(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_EndPrint(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_EndPrint(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
|
bool CallFunc_EndPrintTitlecard(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_PlayerCount(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_PlayerCount(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_GameType(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_GameType(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_GameSpeed(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_GameSpeed(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
|
|
@ -65,6 +66,7 @@ bool CallFunc_SetLineTexture(ACSVM::Thread *thread, const ACSVM::Word *argV, ACS
|
||||||
bool CallFunc_SetLineSpecial(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_SetLineSpecial(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_ThingSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_ThingSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_EndPrintBold(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_EndPrintBold(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
|
bool CallFunc_EndPrintBoldTitlecard(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_PlayerTeam(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_PlayerTeam(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_PlayerRings(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_PlayerRings(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
bool CallFunc_PlayerScore(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
bool CallFunc_PlayerScore(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,11 @@ Environment::Environment()
|
||||||
|
|
||||||
addCodeDataACS0(122, {"", 0, addCallFunc(CallFunc_PlayerScore)});
|
addCodeDataACS0(122, {"", 0, addCallFunc(CallFunc_PlayerScore)});
|
||||||
|
|
||||||
|
// Lat: Titlecard CEcho. I'm not sure if I should be putting it here.
|
||||||
|
// @TODO: Confirm this is fine?
|
||||||
|
addCodeDataACS0( 123, {"", 0, addCallFunc(CallFunc_EndPrintTitlecard)});
|
||||||
|
addCodeDataACS0( 124, {"", 0, addCallFunc(CallFunc_EndPrintBoldTitlecard)});
|
||||||
|
|
||||||
// 136 to 137: Implemented by ACSVM
|
// 136 to 137: Implemented by ACSVM
|
||||||
|
|
||||||
// 157: Implemented by ACSVM
|
// 157: Implemented by ACSVM
|
||||||
|
|
|
||||||
|
|
@ -3145,6 +3145,7 @@ void G_ExitLevel(void)
|
||||||
|
|
||||||
// Remove CEcho text on round end.
|
// Remove CEcho text on round end.
|
||||||
HU_ClearCEcho();
|
HU_ClearCEcho();
|
||||||
|
HU_ClearTitlecardCEcho();
|
||||||
|
|
||||||
// Don't save demos immediately here! Let standings write first
|
// Don't save demos immediately here! Let standings write first
|
||||||
}
|
}
|
||||||
|
|
@ -4124,6 +4125,7 @@ void G_AfterIntermission(void)
|
||||||
gamecomplete = 1;
|
gamecomplete = 1;
|
||||||
|
|
||||||
HU_ClearCEcho();
|
HU_ClearCEcho();
|
||||||
|
HU_ClearTitlecardCEcho();
|
||||||
|
|
||||||
if (demo.playback)
|
if (demo.playback)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,11 @@ static tic_t cechotimer = 0;
|
||||||
static tic_t cechoduration = 5*TICRATE;
|
static tic_t cechoduration = 5*TICRATE;
|
||||||
static INT32 cechoflags = 0;
|
static INT32 cechoflags = 0;
|
||||||
|
|
||||||
|
static char tcechotext[48]; // the text is wide so only 48 chars should do.
|
||||||
|
static tic_t tcechotimer = 0; // goes up by 1 each frame this is active
|
||||||
|
static tic_t tcechoduration = 0; // Set automatically
|
||||||
|
|
||||||
|
|
||||||
static tic_t resynch_ticker = 0;
|
static tic_t resynch_ticker = 0;
|
||||||
|
|
||||||
static huddrawlist_h luahuddrawlist_scores;
|
static huddrawlist_h luahuddrawlist_scores;
|
||||||
|
|
@ -1036,6 +1041,13 @@ void HU_Ticker(void)
|
||||||
if (cechotimer)
|
if (cechotimer)
|
||||||
cechotimer--;
|
cechotimer--;
|
||||||
|
|
||||||
|
if (tcechotimer)
|
||||||
|
{
|
||||||
|
tcechotimer++;
|
||||||
|
if (tcechotimer > tcechoduration)
|
||||||
|
tcechotimer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (gamestate != GS_LEVEL)
|
if (gamestate != GS_LEVEL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -2000,6 +2012,15 @@ static void HU_DrawCEcho(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void HU_DrawTitlecardCEcho(void)
|
||||||
|
{
|
||||||
|
if (tcechotimer)
|
||||||
|
{
|
||||||
|
INT32 w = V_TitleCardStringWidth(tcechotext);
|
||||||
|
V_DrawTitleCardString(160 -w/2, 90, tcechotext, 0, false, tcechotimer, TICRATE*4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// demo info stuff
|
// demo info stuff
|
||||||
//
|
//
|
||||||
|
|
@ -2145,6 +2166,9 @@ drawontop:
|
||||||
|
|
||||||
if (cechotimer)
|
if (cechotimer)
|
||||||
HU_DrawCEcho();
|
HU_DrawCEcho();
|
||||||
|
|
||||||
|
if (tcechotimer)
|
||||||
|
HU_DrawTitlecardCEcho();
|
||||||
}
|
}
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
@ -2598,3 +2622,20 @@ void HU_DoCEcho(const char *msg)
|
||||||
cechotext[sizeof(cechotext) - 1] = '\0';
|
cechotext[sizeof(cechotext) - 1] = '\0';
|
||||||
cechotimer = cechoduration;
|
cechotimer = cechoduration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simply set the timer to 0 to clear it.
|
||||||
|
// No need to bother clearing the buffer or anything.
|
||||||
|
void HU_ClearTitlecardCEcho(void)
|
||||||
|
{
|
||||||
|
tcechotimer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Similar but for titlecard CEcho and also way less convoluted because I have no clue whatever the fuck they were trying above.
|
||||||
|
void HU_DoTitlecardCEcho(const char *msg)
|
||||||
|
{
|
||||||
|
I_OutputMsg("%s\n", msg); // print to log
|
||||||
|
|
||||||
|
strncpy(tcechotext, msg, sizeof(tcechotext));
|
||||||
|
tcechotimer = 1;
|
||||||
|
tcechoduration = TICRATE*6 + strlen(tcechotext);
|
||||||
|
}
|
||||||
|
|
@ -153,6 +153,10 @@ void HU_SetCEchoDuration(INT32 seconds);
|
||||||
void HU_SetCEchoFlags(INT32 flags);
|
void HU_SetCEchoFlags(INT32 flags);
|
||||||
void HU_DoCEcho(const char *msg);
|
void HU_DoCEcho(const char *msg);
|
||||||
|
|
||||||
|
// Titlecard CECHO shite
|
||||||
|
void HU_DoTitlecardCEcho(const char *msg);
|
||||||
|
void HU_ClearTitlecardCEcho(void);
|
||||||
|
|
||||||
// Demo playback info
|
// Demo playback info
|
||||||
extern UINT32 hu_demotime;
|
extern UINT32 hu_demotime;
|
||||||
extern UINT32 hu_demolap;
|
extern UINT32 hu_demolap;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include "k_menu.h" // Player Setup menu color stuff
|
#include "k_menu.h" // Player Setup menu color stuff
|
||||||
#include "p_spec.h" // P_StartQuake
|
#include "p_spec.h" // P_StartQuake
|
||||||
#include "i_system.h" // I_GetPreciseTime, I_GetPrecisePrecision
|
#include "i_system.h" // I_GetPreciseTime, I_GetPrecisePrecision
|
||||||
|
#include "hu_stuff.h" // for the cecho
|
||||||
|
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "lua_libs.h"
|
#include "lua_libs.h"
|
||||||
|
|
@ -3879,6 +3880,14 @@ static int lib_getTimeMicros(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_startTitlecardCecho(lua_State *L)
|
||||||
|
{
|
||||||
|
const char *str = luaL_checkstring(L, 1);
|
||||||
|
HU_DoTitlecardCEcho(str);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static luaL_Reg lib[] = {
|
static luaL_Reg lib[] = {
|
||||||
{"print", lib_print},
|
{"print", lib_print},
|
||||||
{"chatprint", lib_chatprint},
|
{"chatprint", lib_chatprint},
|
||||||
|
|
@ -4161,6 +4170,9 @@ static luaL_Reg lib[] = {
|
||||||
{"K_UpdateBossHealthBar", lib_kUpdateBossHealthBar},
|
{"K_UpdateBossHealthBar", lib_kUpdateBossHealthBar},
|
||||||
{"K_DeclareWeakspot", lib_kDeclareWeakspot},
|
{"K_DeclareWeakspot", lib_kDeclareWeakspot},
|
||||||
|
|
||||||
|
// hu_stuff technically?
|
||||||
|
{"HU_DoTitlecardCEcho", lib_startTitlecardCecho},
|
||||||
|
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7515,6 +7515,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||||
|
|
||||||
// Clear CECHO messages
|
// Clear CECHO messages
|
||||||
HU_ClearCEcho();
|
HU_ClearCEcho();
|
||||||
|
HU_ClearTitlecardCEcho();
|
||||||
|
|
||||||
if (mapheaderinfo[gamemap-1]->runsoc[0] != '#')
|
if (mapheaderinfo[gamemap-1]->runsoc[0] != '#')
|
||||||
P_RunSOC(mapheaderinfo[gamemap-1]->runsoc);
|
P_RunSOC(mapheaderinfo[gamemap-1]->runsoc);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue