Skip to content

Commit

Permalink
Added All games: The Help screens shown when selecting "ReadThis" for…
Browse files Browse the repository at this point in the history
… the menu or using the (default) F1 shortcut are now defined as InFine scripts for customization in mods.
  • Loading branch information
danij-deng committed Apr 24, 2010
1 parent 2e2b358 commit 96de7e2
Show file tree
Hide file tree
Showing 21 changed files with 215 additions and 354 deletions.
7 changes: 5 additions & 2 deletions doomsday/plugins/common/include/g_common.h
Expand Up @@ -3,8 +3,8 @@
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2009 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2009 Daniel Swanson <danij@dengine.net>
*\author Copyright © 2003-2010 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2010 Daniel Swanson <danij@dengine.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -60,6 +60,9 @@ void G_Register(void);
void G_PreInit(void);
void G_PostInit(void);
void G_StartTitle(void);
#if __JDOOM__ || __JHERETIC__ || __JHEXEN__
void G_StartHelp(void);
#endif

gamestate_t G_GetGameState(void);
void G_ChangeGameState(gamestate_t state);
Expand Down
9 changes: 3 additions & 6 deletions doomsday/plugins/common/include/m_defs.h
Expand Up @@ -3,8 +3,8 @@
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2009 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2009 Daniel Swanson <danij@dengine.net>
*\author Copyright © 2003-2010 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2010 Daniel Swanson <danij@dengine.net>
*\author Copyright © 1993-1996 by id Software, Inc.
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -54,8 +54,7 @@ typedef struct {

// Menu flags
#define MNF_NOHOTKEYS 0x00000001 // Hotkeys are disabled.
#define MNF_NOSCALE 0x00000002 // Menu wont be scaled (e.g. readthis).
#define MNF_DELETEFUNC 0x00000004 // MCMD_DELETE causes a call to item's func
#define MNF_DELETEFUNC 0x00000002 // MCMD_DELETE causes a call to item's func

typedef struct unscaledmenustate_s {
int numVisItems;
Expand All @@ -73,8 +72,6 @@ typedef struct {
int prevMenu; // menutype_t
gamefontid_t font; // Font for menu items.
float* color;
char* background; // Background lump name for this menu (if any).
boolean backgroundIsRaw;
int itemHeight;
// For multipage menus.
int firstItem, numVisItems;
Expand Down
5 changes: 2 additions & 3 deletions doomsday/plugins/common/src/am_map.c
Expand Up @@ -3,8 +3,8 @@
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2009 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2009 Daniel Swanson <danij@dengine.net>
*\author Copyright © 2003-2010 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2010 Daniel Swanson <danij@dengine.net>
*\author Copyright © 1993-1996 by id Software, Inc.
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -1753,7 +1753,6 @@ menu_t MapDef = {
0, MENU_OPTIONS,
GF_FONTA,
cfg.menuColor2,
NULL, false,
LINEHEIGHT_A,
#if __JHERETIC__ || __JHEXEN__
0, 11
Expand Down
67 changes: 39 additions & 28 deletions doomsday/plugins/common/src/f_infine.c
Expand Up @@ -3,8 +3,8 @@
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2009 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2009 Daniel Swanson <danij@dengine.net>
*\author Copyright © 2003-2010 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2010 Daniel Swanson <danij@dengine.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -135,6 +135,7 @@ typedef struct fistate_s {
char* script; // A copy of the script.
char* cp; // The command cursor.
infinemode_t mode;
gamestate_t lastGameState; // Game state before the script began.
int overlayGameState; // Overlay scripts run only in one gameMode.
int timer;
boolean conditions[NUM_FICONDS];
Expand Down Expand Up @@ -567,7 +568,7 @@ void FI_Reset(void)
*/
void FI_Start(char *finalescript, infinemode_t mode)
{
int i;
int i;

if(mode == FIMODE_LOCAL && IS_DEDICATED)
{
Expand All @@ -585,6 +586,7 @@ void FI_Start(char *finalescript, infinemode_t mode)
// Init InFine state.
FI_NewState(finalescript);
fi->mode = mode;
fi->lastGameState = G_GetGameState();
// Clear the message queue for all local players.
for(i = 0; i < MAXPLAYERS; ++i)
Hu_LogEmpty(i);
Expand Down Expand Up @@ -639,12 +641,14 @@ void FI_Start(char *finalescript, infinemode_t mode)
*/
void FI_End(void)
{
int oldMode;
int oldMode;
gamestate_t lastGameState;

if(!fiActive || !fi->canSkip)
return;

oldMode = fi->mode;
lastGameState = fi->lastGameState;

// This'll set fi to NULL.
FI_PopState();
Expand All @@ -659,35 +663,42 @@ void FI_End(void)
NetSv_Finale(FINF_END, 0, NULL, 0);
}

// If no more scripts are left, go to the next game mode.
if(!fiActive)
if(fiActive)
return;

/**
* No more scripts are left.
*/

// Return to the last game state?
if(oldMode == FIMODE_LOCAL)
{
if(oldMode == FIMODE_AFTER) // A map has been completed.
G_ChangeGameState(lastGameState);
return;
}

// Go to the next game mode?
if(oldMode == FIMODE_AFTER) // A map has been completed.
{
if(IS_CLIENT)
{
if(IS_CLIENT)
{
#if __JHEXEN__ || __JSTRIFE__
Draw_TeleportIcon();
Draw_TeleportIcon();
#endif
return;
}
G_SetGameAction(GA_MAPCOMPLETED);

// Don't play the debriefing again.
briefDisabled = true;
}
else if(oldMode == FIMODE_BEFORE)
{
// Enter the map, this was a briefing.
G_ChangeGameState(GS_MAP);
S_MapMusic(gameEpisode, gameMap);
mapStartTic = (int) GAMETIC;
mapTime = actualMapTime = 0;
}
else if(oldMode == FIMODE_LOCAL)
{
G_ChangeGameState(GS_WAITING);
return;
}
G_SetGameAction(GA_MAPCOMPLETED);

// Don't play the debriefing again.
briefDisabled = true;
}
else if(oldMode == FIMODE_BEFORE)
{
// Enter the map, this was a briefing.
G_ChangeGameState(GS_MAP);
S_MapMusic(gameEpisode, gameMap);
mapStartTic = (int) GAMETIC;
mapTime = actualMapTime = 0;
}
}

Expand Down
29 changes: 25 additions & 4 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -3,8 +3,8 @@
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 1999-2009 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2009 Daniel Swanson <danij@dengine.net>
*\author Copyright © 1999-2010 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2010 Daniel Swanson <danij@dengine.net>
*\author Copyright © 1999 Activision
*\author Copyright © 1993-1996 by id Software, Inc.
*
Expand Down Expand Up @@ -831,8 +831,8 @@ VERBOSE(Con_Message("G_ChangeGameState: New state %s.\n",
*/
void G_StartTitle(void)
{
char *name = "title";
void *script;
char* name = "title";
void* script;

G_StopDemo();
userGame = false;
Expand All @@ -846,6 +846,27 @@ void G_StartTitle(void)
FI_Start(script, FIMODE_LOCAL);
}

#if __JDOOM__ || __JHERETIC__ || __JHEXEN__
/**
* Begin the helpscreen animation sequence.
*/
void G_StartHelp(void)
{
char* name = "help";
void* script;

Hu_MenuCommand(MCMD_CLOSEFAST);

// The help script must always be defined.
if(!Def_Get(DD_DEF_FINALE, name, &script))
{
Con_Error("G_StartHelp: Script \"%s\" not defined.\n", name);
}

FI_Start(script, FIMODE_LOCAL);
}
#endif

void G_DoLoadMap(void)
{
int i;
Expand Down

0 comments on commit 96de7e2

Please sign in to comment.