Add new events at various points that display hardcoded screens.

New event "EVENT_MAINMENUSCREEN"

Triggered before the main menu is displayed. Set RETURN to -1 to disable the screens that appear before the main menu.

New event "EVENT_NEWGAMESCREEN"

Triggered when a new game is started. Set RETURN to -1 to disable The Birth intro animation.

New event "EVENT_ENDLEVELSCREEN"

Triggered when a level ends. Set RETURN to -1 to disable the bonus and deathmatch score screens after a level ends.

New event "EVENT_EXITGAMESCREEN"

Triggered when a running game is ended. Set RETURN to -1 to disable the deathmatch score screen when you quit mid-game.

New event "EVENT_EXITPROGRAMSCREEN"

Triggered when the program is closed. Set RETURN to -1 to disable the shareware or TEN screen,sif they were enabled in LOGO_FLAGS.

Patch from Fox.

git-svn-id: https://svn.eduke32.com/eduke32@6584 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-01-26 04:34:38 +00:00
parent 29543fd087
commit cf64b480f1
5 changed files with 48 additions and 26 deletions

View file

@ -135,6 +135,11 @@ enum GameEvent_t {
EVENT_UPDATESCREENAREA,
EVENT_DISPLAYBORDER,
EVENT_SETDEFAULTS,
EVENT_MAINMENUSCREEN,
EVENT_NEWGAMESCREEN,
EVENT_ENDLEVELSCREEN,
EVENT_EXITGAMESCREEN,
EVENT_EXITPROGRAMSCREEN,
#ifdef LUNATIC
EVENT_ANIMATEALLSPRITES,
#endif

View file

@ -281,13 +281,16 @@ void G_GameExit(const char *msg)
if (!g_quickExit)
{
if (g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
if (VM_OnEventWithReturn(EVENT_EXITGAMESCREEN, g_player[myconnectindex].ps->i, myconnectindex, 0) == 0 &&
g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
{
G_BonusScreen(1);
setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP);
}
if (*msg != 0 && *(msg+1) != 'V' && *(msg+1) != 'Y')
// shareware and TEN screens
if (VM_OnEventWithReturn(EVENT_EXITPROGRAMSCREEN, g_player[myconnectindex].ps->i, myconnectindex, 0) == 0 &&
*msg != 0 && *(msg+1) != 'V' && *(msg+1) != 'Y')
G_DisplayExtraScreens();
}
@ -5995,7 +5998,8 @@ static int G_EndOfLevel(void)
ready2send = 0;
if (ud.display_bonus_screen == 1)
if ((VM_OnEventWithReturn(EVENT_ENDLEVELSCREEN, g_player[myconnectindex].ps->i, myconnectindex, 0)) == 0 &&
ud.display_bonus_screen == 1)
{
int32_t i = ud.screen_size;
ud.screen_size = 0;

View file

@ -731,6 +731,11 @@ const char *EventNames[MAXEVENTS] =
"EVENT_UPDATESCREENAREA",
"EVENT_DISPLAYBORDER",
"EVENT_SETDEFAULTS",
"EVENT_MAINMENUSCREEN",
"EVENT_NEWGAMESCREEN",
"EVENT_ENDLEVELSCREEN",
"EVENT_EXITGAMESCREEN",
"EVENT_EXITPROGRAMSCREEN",
#ifdef LUNATIC
"EVENT_ANIMATEALLSPRITES",
#endif

View file

@ -1356,6 +1356,11 @@ static void prelevel(char g)
}
static inline int G_HaveUserMap(void)
{
return (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0);
}
void G_NewGame(int volumeNum, int levelNum, int skillNum)
{
DukePlayer_t *const pPlayer = g_player[0].ps;
@ -1372,11 +1377,31 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
ready2send = 0;
if (ud.m_recstat != 2 && ud.last_level >= 0 && (g_netServer || ud.multimode > 1) && (ud.coop&GAMETYPE_SCORESHEET))
if (ud.m_recstat != 2 && ud.last_level >= 0 &&
VM_OnEventWithReturn(EVENT_EXITGAMESCREEN, g_player[myconnectindex].ps->i, myconnectindex, 0) == 0 &&
(g_netServer || ud.multimode > 1) && (ud.coop&GAMETYPE_SCORESHEET))
G_BonusScreen(1);
if (levelNum == 0 && volumeNum == 3 && (!g_netServer && ud.multimode < 2) && ud.lockout == 0
&& (G_GetLogoFlags() & LOGO_NOE4CUTSCENE)==0)
g_showShareware = GAMETICSPERSEC*34;
ud.level_number = levelNum;
ud.volume_number = volumeNum;
ud.player_skill = skillNum;
ud.secretlevel = 0;
ud.from_bonus = 0;
ud.last_level = -1;
g_lastAutoSaveArbitraryID = -1;
g_lastautosave.reset();
g_lastusersave.reset();
g_quickload = nullptr;
int const UserMap = G_HaveUserMap();
// we don't want the intro to play after the multiplayer setup screen
if ((!g_netServer && ud.multimode < 2) && UserMap == 0 &&
VM_OnEventWithReturn(EVENT_NEWGAMESCREEN, g_player[myconnectindex].ps->i, myconnectindex, 0) == 0 &&
levelNum == 0 && volumeNum == 3 && ud.lockout == 0 && (G_GetLogoFlags() & LOGO_NOE4CUTSCENE)==0)
{
S_PlayMusic(g_mapInfo[MUS_BRIEFING].musicfn);
@ -1405,20 +1430,6 @@ end_vol4a:
FX_StopAllSounds();
}
g_showShareware = GAMETICSPERSEC*34;
ud.level_number = levelNum;
ud.volume_number = volumeNum;
ud.player_skill = skillNum;
ud.secretlevel = 0;
ud.from_bonus = 0;
ud.last_level = -1;
g_lastAutoSaveArbitraryID = -1;
g_lastautosave.reset();
g_lastusersave.reset();
g_quickload = nullptr;
#ifdef EDUKE32_TOUCH_DEVICES
pPlayer->zoom = 360;
#else
@ -1779,11 +1790,6 @@ void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName, int levelNum
realloc_copy(&g_mapInfo[levelNum].musicfn, "dethtoll.mid");
}
static inline int G_HaveUserMap(void)
{
return (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0);
}
int G_EnterLevel(int gameMode)
{
int32_t i, mii;

View file

@ -1470,7 +1470,9 @@ void G_DisplayLogo(void)
S_StopMusic();
FX_StopAllSounds(); // JBF 20031228
S_ClearSoundLocks(); // JBF 20031228
if ((!g_netServer && ud.multimode < 2) && (logoflags & LOGO_ENABLED) && !g_noLogo)
if (!g_noLogo /* && (!g_netServer && ud.multimode < 2) */ &&
VM_OnEventWithReturn(EVENT_MAINMENUSCREEN, g_player[myconnectindex].ps->i, myconnectindex, 0) == 0 &&
(logoflags & LOGO_ENABLED))
{
if (
#ifndef EDUKE32_TOUCH_DEVICES