Skip to content

Commit

Permalink
Hexen: The mapinfo definition database is now indexed by map URI
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jan 25, 2014
1 parent f202aab commit 7411514
Show file tree
Hide file tree
Showing 17 changed files with 258 additions and 243 deletions.
2 changes: 1 addition & 1 deletion doomsday/plugins/common/include/hexlex.h
Expand Up @@ -79,7 +79,7 @@ class HexLex

int readSoundIndex();
uint readMapNumber();
Uri *readUri(char const *defaultScheme);
Uri *readUri(char const *defaultScheme = "");

/**
* Returns the line number at the current position in the script.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/include/p_mapsetup.h
Expand Up @@ -46,7 +46,7 @@ void P_FinalizeMapChange(Uri const *uri);
*/
void P_SetupMap(Uri *uri);

char const *P_MapAuthor(uint episode, uint map, dd_bool supressGameAuthor);
char const *P_MapAuthor(Uri const *mapUri, dd_bool supressGameAuthor);
char const *P_MapTitle(uint episode, uint map);
patchid_t P_MapTitlePatch(uint episode, uint map);

Expand Down
6 changes: 3 additions & 3 deletions doomsday/plugins/common/include/p_sound.h
Expand Up @@ -33,7 +33,7 @@ extern "C" {
/**
* Start the song for the specified map.
*/
void S_MapMusic(uint episode, uint map);
void S_MapMusic(Uri const *mapUri);

/**
* Doom-like sector sounds: when a new sound starts, stop any existing sounds from
Expand All @@ -42,12 +42,12 @@ void S_MapMusic(uint episode, uint map);
* @param sec Sector to use as the origin of the sound.
* @param id ID number of the sound to be played.
*/
void S_SectorSound(Sector* sec, int id);
void S_SectorSound(Sector *sec, int id);

/**
* @param sec Sector in which to stop sounds.
*/
void S_SectorStopSounds(Sector* sec);
void S_SectorStopSounds(Sector *sec);

/**
* Doom-like sector sounds: when a new sound starts, stop any existing sounds from
Expand Down
2 changes: 0 additions & 2 deletions doomsday/plugins/common/src/animdefsparser.cpp
Expand Up @@ -23,8 +23,6 @@
#include "animdefsparser.h"

#include "hexlex.h"
#include "p_mapsetup.h"
#include "p_mapspec.h"

static char const *textureScheme(Str const *string)
{
Expand Down
77 changes: 30 additions & 47 deletions doomsday/plugins/common/src/fi_lib.c
@@ -1,34 +1,23 @@
/**\file fi_lib.c
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
/** @file fi_lib.c InFine Helper routines and LIFO "script stack".
*
*\author Copyright © 2006-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2006-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

/**
* Helper routines and LIFO "script stack" functionality for use with
* Doomsday's InFine API.
* <small>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 the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/

// HEADER FILES ------------------------------------------------------------

#include <string.h>
#include <assert.h>

Expand All @@ -44,10 +33,6 @@

#include "fi_lib.h"

// MACROS ------------------------------------------------------------------

// TYPES -------------------------------------------------------------------

typedef struct {
byte secret:1;
byte leave_hub:1;
Expand All @@ -69,25 +54,13 @@ typedef struct {
char defId[64];
} fi_state_t;

// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------

// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------

D_CMD(StartFinale);
D_CMD(StopFinale);

int Hook_FinaleScriptStop(int hookType, int finaleId, void* paramaters);
int Hook_FinaleScriptTicker(int hookType, int finalId, void* paramaters);
int Hook_FinaleScriptEvalIf(int hookType, int finaleId, void* paramaters);

// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------

// EXTERNAL DATA DECLARATIONS ----------------------------------------------

// PUBLIC DATA DEFINITIONS -------------------------------------------------

// PRIVATE DATA DEFINITIONS ------------------------------------------------

/// Script state stack.
static dd_bool finaleStackInited = false;
static uint finaleStackSize = 0;
Expand All @@ -103,16 +76,14 @@ static ccmdtemplate_t ccmds[] = {
{ NULL }
};

// CODE --------------------------------------------------------------------

void FI_StackRegister(void)
{
int i;
for(i = 0; ccmds[i].name; ++i)
Con_AddCommand(ccmds + i);
}

static void initStateConditions(fi_state_t* s)
static void initStateConditions(fi_state_t *s)
{
// Only the server is able to figure out the truth values of all the conditions.
if(IS_CLIENT)
Expand All @@ -127,7 +98,15 @@ static void initStateConditions(fi_state_t* s)
s->conditions.secret = false;

// Current hub has been completed?
s->conditions.leave_hub = (P_MapInfo(gameMap)->cluster != P_MapInfo(nextMap)->cluster);
{
Uri *currentMapUri = G_ComposeMapUri(gameEpisode, gameMap);
Uri *nextMapUri = G_ComposeMapUri(gameEpisode, nextMap);

s->conditions.leave_hub = (P_MapInfo(currentMapUri)->cluster != P_MapInfo(nextMapUri)->cluster);

Uri_Delete(nextMapUri);
Uri_Delete(currentMapUri);
}

App_Log(DE2_DEV_SCR_VERBOSE, "Infine state condition: leave_hub=%i", s->conditions.leave_hub);
#else
Expand Down Expand Up @@ -470,10 +449,14 @@ int Hook_FinaleScriptStop(int hookType, int finaleId, void* parameters)
else if(mode == FIMODE_BEFORE) // A briefing has ended.
{
// Its time to start the map; que music and begin!
S_MapMusic(gameEpisode, gameMap);
Uri *mapUri = G_ComposeMapUri(gameEpisode, gameMap);

S_MapMusic(mapUri);
HU_WakeWidgets(-1 /* all players */);
G_BeginMap();
Pause_End(); // skip forced period

Uri_Delete(mapUri);
}
return true;
}
Expand Down

0 comments on commit 7411514

Please sign in to comment.