Skip to content

Commit

Permalink
Added a presently unused rflags argument to DD_AddGameResource, it be…
Browse files Browse the repository at this point in the history
… needed sooner or later.
  • Loading branch information
danij-deng committed Dec 9, 2010
1 parent 93a8580 commit 210d7c5
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 87 deletions.
105 changes: 53 additions & 52 deletions doomsday/engine/api/doomsday.h
Expand Up @@ -74,58 +74,59 @@ extern "C" {
//
//------------------------------------------------------------------------

/**
* Registers a new game.
*
* \note Game registration order defines the order of the automatic game identification/selection logic.
*
* @param identityKey Unique game mode key/identifier, 16 chars max (e.g., "doom1-ultimate").
* - Used during resource location for mode-specific assets.
* - Sent out in netgames (a client can't connect unless mode strings match).
* @param dataPath The base directory for all data-class resources.
* @param defsPath The base directory for all defs-class resources.
* @param mainDef The name of the main/top-level definition file. Can be @c NULL.
* @param mainConfig The name of the main game config file. Can be @c NULL.
* @param defaultTitle Default game title. May be overridden later.
* @param defaultAuthor Default game author. May be overridden later. Used for (e.g.) the map author name
* if not specified in a Map Info definition.
* @param cmdlineFlag Command-line game selection override argument (e.g., "ultimate"). Can be @c NULL.
* @param cmdlineFlag2 Alternative override. Can be @c NULL.
*
* @return Unique identifier/name assigned to the game.
*/
gameid_t DD_AddGame(const char* identityKey, const char* dataPath, const char* defsPath, const char* mainDef,
const char* mainConfig, const char* defaultTitle, const char* defaultAuthor, const char* cmdlineFlag,
const char* cmdlineFlag2);

/**
* Registers a new resource for the specified game.
*
* \note Resource registration order defines the load order of resources (among those of the same type).
*
* @param game Unique identifier/name of the game.
* @param rclass Class of resource being added.
* @param names One or more known potential names, seperated by semicolon e.g., "name1;name2".
* Names may include valid absolute, or relative file paths. These paths include
* valid symbolbolic escape tokens, predefined symbols into the virtual file system.
*/
void DD_AddGameResource(gameid_t game, resourceclass_t rclass, const char* names, void* params);

/**
* Retrieve extended info about the specified game.
*
* @param game Unique identifier/name of the game.
* @param info Info structure to be populated.
*/
void DD_GetGameInfo2(gameid_t game, ddgameinfo_t* info);

/**
* Retrieve extended info about the current game.
*
* @param info Info structure to be populated.
* @return @c true if successful else @c false (i.e., no game loaded).
*/
boolean DD_GetGameInfo(ddgameinfo_t* info);
/**
* Registers a new game.
*
* \note Game registration order defines the order of the automatic game identification/selection logic.
*
* @param identityKey Unique game mode key/identifier, 16 chars max (e.g., "doom1-ultimate").
* - Used during resource location for mode-specific assets.
* - Sent out in netgames (a client can't connect unless mode strings match).
* @param dataPath The base directory for all data-class resources.
* @param defsPath The base directory for all defs-class resources.
* @param mainDef The name of the main/top-level definition file. Can be @c NULL.
* @param mainConfig The name of the main game config file. Can be @c NULL.
* @param defaultTitle Default game title. May be overridden later.
* @param defaultAuthor Default game author. May be overridden later. Used for (e.g.) the map author name
* if not specified in a Map Info definition.
* @param cmdlineFlag Command-line game selection override argument (e.g., "ultimate"). Can be @c NULL.
* @param cmdlineFlag2 Alternative override. Can be @c NULL.
*
* @return Unique identifier/name assigned to the game.
*/
gameid_t DD_AddGame(const char* identityKey, const char* dataPath, const char* defsPath, const char* mainDef,
const char* mainConfig, const char* defaultTitle, const char* defaultAuthor, const char* cmdlineFlag,
const char* cmdlineFlag2);

/**
* Registers a new resource for the specified game.
*
* \note Resource registration order defines the load order of resources (among those of the same type).
*
* @param game Unique identifier/name of the game.
* @param rclass Class of resource being added.
* @param rflags Presently unused. Reserved for future use.
* @param names One or more known potential names, seperated by semicolon e.g., "name1;name2".
* Names may include valid absolute, or relative file paths. These paths include
* valid symbolbolic escape tokens, predefined symbols into the virtual file system.
*/
void DD_AddGameResource(gameid_t game, resourceclass_t rclass, int rflags, const char* names, void* params);

/**
* Retrieve extended info about the specified game.
*
* @param game Unique identifier/name of the game.
* @param info Info structure to be populated.
*/
void DD_GetGameInfo2(gameid_t game, ddgameinfo_t* info);

/**
* Retrieve extended info about the current game.
*
* @param info Info structure to be populated.
* @return @c true if successful else @c false (i.e., no game loaded).
*/
boolean DD_GetGameInfo(ddgameinfo_t* info);

int _DECALL DD_GetInteger(int ddvalue);
void DD_SetInteger(int ddvalue, int parm);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/dd_main.c
Expand Up @@ -285,7 +285,7 @@ static void addIdentityKeyToResourceRecord(gameresource_record_t* rec, const dds
}
}

void DD_AddGameResource(gameid_t gameId, resourceclass_t rclass, const char* _names, void* params)
void DD_AddGameResource(gameid_t gameId, resourceclass_t rclass, int rflags, const char* _names, void* params)
{
gameinfo_t* info = findGameInfoForId(gameId);
ddstring_t names, name;
Expand Down
40 changes: 24 additions & 16 deletions doomsday/plugins/jdoom/src/d_main.c
Expand Up @@ -55,6 +55,8 @@

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

#define GID(v) (toGameId(v))

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

// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
Expand Down Expand Up @@ -114,6 +116,12 @@ static boolean autoStart;

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

static __inline gameid_t toGameId(int gamemode)
{
assert(gamemode >= 0 && gamemode < NUM_GAME_MODES);
return gameIds[(gamemode_t) gamemode];
}

/**
* Get a 32-bit integer value.
*/
Expand Down Expand Up @@ -189,43 +197,43 @@ int G_RegisterGames(int hookType, int parm, void* data)

/* HacX */
gameIds[doom2_hacx] = DD_AddGame("hacx", DATAPATH, DEFSPATH, "hacx.ded", MAINCONFIG, "HACX - Twitch 'n Kill", "Banjo Software", "hacx", 0);
DD_AddGameResource(gameIds[doom2_hacx], RC_PACKAGE, "hacx.wad", "HACX-R");
DD_AddGameResource(gameIds[doom2_hacx], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(doom2_hacx), RC_PACKAGE, 0, "hacx.wad", "HACX-R");
DD_AddGameResource(GID(doom2_hacx), RC_PACKAGE, 0, STARTUPPK3, 0);

/* Chex Quest */
gameIds[doom_chex] = DD_AddGame("chex", DATAPATH, DEFSPATH, "chex.ded", MAINCONFIG, "Chex(R) Quest", "Digital Cafe", "chex", 0);
DD_AddGameResource(gameIds[doom_chex], RC_PACKAGE, "chex.wad", "E1M1;E4M1;_DEUTEX_;POSSH0M0");
DD_AddGameResource(gameIds[doom_chex], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(doom_chex), RC_PACKAGE, 0, "chex.wad", "E1M1;E4M1;_DEUTEX_;POSSH0M0");
DD_AddGameResource(GID(doom_chex), RC_PACKAGE, 0, STARTUPPK3, 0);

/* DOOM2 (TNT) */
gameIds[doom2_tnt] = DD_AddGame("doom2-tnt", DATAPATH, DEFSPATH, "doom2-tnt.ded", MAINCONFIG, "Final DOOM: TNT: Evilution", "Team TNT", "tnt", 0);
DD_AddGameResource(gameIds[doom2_tnt], RC_PACKAGE, "tnt.wad", "CAVERN5;CAVERN7;STONEW1");
DD_AddGameResource(gameIds[doom2_tnt], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(doom2_tnt), RC_PACKAGE, 0, "tnt.wad", "CAVERN5;CAVERN7;STONEW1");
DD_AddGameResource(GID(doom2_tnt), RC_PACKAGE, 0, STARTUPPK3, 0);

/* DOOM2 (Plutonia) */
gameIds[doom2_plut] = DD_AddGame("doom2-plut", DATAPATH, DEFSPATH, "doom2-plut.ded", MAINCONFIG, "Final DOOM: The Plutonia Experiment", "Dario Casali and Milo Casali", "plutonia", "plut");
DD_AddGameResource(gameIds[doom2_plut], RC_PACKAGE, "plutonia.wad", "_DEUTEX_;MAP01;MAP25;MC5;MC11;MC16;MC20");
DD_AddGameResource(gameIds[doom2_plut], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(doom2_plut), RC_PACKAGE, 0, "plutonia.wad", "_DEUTEX_;MAP01;MAP25;MC5;MC11;MC16;MC20");
DD_AddGameResource(GID(doom2_plut), RC_PACKAGE, 0, STARTUPPK3, 0);

/* DOOM2 */
gameIds[doom2] = DD_AddGame("doom2", DATAPATH, DEFSPATH, "doom2.ded", MAINCONFIG, "DOOM 2: Hell on Earth", "id Software", "doom2", 0);
DD_AddGameResource(gameIds[doom2], RC_PACKAGE, "doom2f.wad;doom2.wad", "MAP01;MAP02;MAP03;MAP04;MAP10;MAP20;MAP25;MAP30;VILEN1;VILEO1;VILEQ1;GRNROCK");
DD_AddGameResource(gameIds[doom2], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(doom2), RC_PACKAGE, 0, "doom2f.wad;doom2.wad", "MAP01;MAP02;MAP03;MAP04;MAP10;MAP20;MAP25;MAP30;VILEN1;VILEO1;VILEQ1;GRNROCK");
DD_AddGameResource(GID(doom2), RC_PACKAGE, 0, STARTUPPK3, 0);

/* DOOM (Ultimate) */
gameIds[doom_ultimate] = DD_AddGame("doom1-ultimate", DATAPATH, DEFSPATH, "doom1-ultimate.ded", MAINCONFIG, "The Ultimate DOOM", "id Software", "ultimatedoom", "udoom");
DD_AddGameResource(gameIds[doom_ultimate], RC_PACKAGE, "doomu.wad;doom.wad", "E4M1;E4M2;E4M3;E4M4;E4M5;E4M6;E4M7;E4M8;E4M9;M_EPI4");
DD_AddGameResource(gameIds[doom_ultimate], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(doom_ultimate), RC_PACKAGE, 0, "doomu.wad;doom.wad", "E4M1;E4M2;E4M3;E4M4;E4M5;E4M6;E4M7;E4M8;E4M9;M_EPI4");
DD_AddGameResource(GID(doom_ultimate), RC_PACKAGE, 0, STARTUPPK3, 0);

/* DOOM */
gameIds[doom] = DD_AddGame("doom1", DATAPATH, DEFSPATH, "doom1.ded", MAINCONFIG, "DOOM Registered", "id Software", "doom", 0);
DD_AddGameResource(gameIds[doom], RC_PACKAGE, "doom.wad", "E2M1;E2M2;E2M3;E2M4;E2M5;E2M6;E2M7;E2M8;E2M9;E3M1;E3M2;E3M3;E3M4;E3M5;E3M6;E3M7;E3M8;E3M9;CYBRE1;CYBRD8;FLOOR7_2");
DD_AddGameResource(gameIds[doom], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(doom), RC_PACKAGE, 0, "doom.wad", "E2M1;E2M2;E2M3;E2M4;E2M5;E2M6;E2M7;E2M8;E2M9;E3M1;E3M2;E3M3;E3M4;E3M5;E3M6;E3M7;E3M8;E3M9;CYBRE1;CYBRD8;FLOOR7_2");
DD_AddGameResource(GID(doom), RC_PACKAGE, 0, STARTUPPK3, 0);

/* DOOM (Shareware) */
gameIds[doom_shareware] = DD_AddGame("doom1-share", DATAPATH, DEFSPATH, "doom1-share.ded", MAINCONFIG, "DOOM Shareware", "id Software", "sdoom", 0);
DD_AddGameResource(gameIds[doom_shareware], RC_PACKAGE, "doom1.wad", "E1M1;E1M2;E1M3;E1M4;E1M5;E1M6;E1M7;E1M8;E1M9;D_E1M1;FLOOR4_8;FLOOR7_2");
DD_AddGameResource(gameIds[doom_shareware], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(doom_shareware), RC_PACKAGE, 0, "doom1.wad", "E1M1;E1M2;E1M3;E1M4;E1M5;E1M6;E1M7;E1M8;E1M9;D_E1M1;FLOOR4_8;FLOOR7_2");
DD_AddGameResource(GID(doom_shareware), RC_PACKAGE, 0, STARTUPPK3, 0);
return true;

#undef STARTUPPK3
Expand Down
17 changes: 12 additions & 5 deletions doomsday/plugins/jdoom64/src/d_main.c
Expand Up @@ -33,6 +33,7 @@

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

#include "jdoom64.h"

Expand All @@ -57,6 +58,8 @@

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

#define GID(v) (toGameId(v))

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

typedef struct {
Expand Down Expand Up @@ -120,6 +123,12 @@ static boolean autoStart;

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

static __inline gameid_t toGameId(int gamemode)
{
assert(gamemode >= 0 && gamemode < NUM_GAME_MODES);
return gameIds[(gamemode_t) gamemode];
}

/**
* Get a 32-bit integer value.
*/
Expand Down Expand Up @@ -191,18 +200,16 @@ int G_RegisterGames(int hookType, int parm, void* data)
{
#define DATAPATH DD_BASEPATH_DATA PLUGIN_NAMETEXT "\\"
#define DEFSPATH DD_BASEPATH_DEFS PLUGIN_NAMETEXT "\\"
#define MAINDEF PLUGIN_NAMETEXT ".ded"
#define MAINCONFIG PLUGIN_NAMETEXT ".cfg"
#define STARTUPPK3 PLUGIN_NAMETEXT ".pk3"

gameIds[doom64] = DD_AddGame("doom64", DATAPATH, DEFSPATH, MAINDEF, MAINCONFIG, "Doom 64", "Midway Software", "doom64", 0);
DD_AddGameResource(gameIds[doom64], RC_PACKAGE, "doom64.wad", "MAP01;MAP020;MAP38;F_SUCK");
DD_AddGameResource(gameIds[doom64], RC_PACKAGE, STARTUPPK3, 0);
gameIds[doom64] = DD_AddGame("doom64", DATAPATH, DEFSPATH, PLUGIN_NAMETEXT ".ded", MAINCONFIG, "Doom 64", "Midway Software", "doom64", 0);
DD_AddGameResource(GID(doom64), RC_PACKAGE, 0, "doom64.wad", "MAP01;MAP020;MAP38;F_SUCK");
DD_AddGameResource(GID(doom64), RC_PACKAGE, 0, STARTUPPK3, 0);
return true;

#undef STARTUPPK3
#undef MAINCONFIG
#undef MAINDEF
#undef DEFSPATH
#undef DATAPATH
}
Expand Down
21 changes: 15 additions & 6 deletions doomsday/plugins/jheretic/src/h_main.c
Expand Up @@ -33,6 +33,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#include "jheretic.h"

Expand All @@ -56,6 +57,8 @@

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

#define GID(v) (toGameId(v))

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

// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
Expand Down Expand Up @@ -116,6 +119,12 @@ static boolean autoStart;

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

static __inline gameid_t toGameId(int gamemode)
{
assert(gamemode >= 0 && gamemode < NUM_GAME_MODES);
return gameIds[(gamemode_t) gamemode];
}

/**
* Get a 32-bit integer value.
*/
Expand Down Expand Up @@ -194,18 +203,18 @@ int G_RegisterGames(int hookType, int parm, void* data)

/* Heretic (Extended) */
gameIds[heretic_extended] = DD_AddGame("heretic-ext", DATAPATH, DEFSPATH, "heretic-ext.ded", MAINCONFIG, "Heretic: Shadow of the Serpent Riders", "Raven Software", "hereticext", "xheretic");
DD_AddGameResource(gameIds[heretic_extended], RC_PACKAGE, "heretic.wad", "EXTENDED;E5M2;E5M7;E6M2;MUMSIT;WIZACT;MUS_CPTD;CHKNC5;SPAXA1A5");
DD_AddGameResource(gameIds[heretic_extended], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(heretic_extended), RC_PACKAGE, 0, "heretic.wad", "EXTENDED;E5M2;E5M7;E6M2;MUMSIT;WIZACT;MUS_CPTD;CHKNC5;SPAXA1A5");
DD_AddGameResource(GID(heretic_extended), RC_PACKAGE, 0, STARTUPPK3, 0);

/* Heretic */
gameIds[heretic] = DD_AddGame("heretic", DATAPATH, DEFSPATH, "heretic.ded", MAINCONFIG, "Heretic Registered", "Raven Software", "heretic", 0);
DD_AddGameResource(gameIds[heretic], RC_PACKAGE, "heretic.wad", "E2M2;E3M6;MUMSIT;WIZACT;MUS_CPTD;CHKNC5;SPAXA1A5");
DD_AddGameResource(gameIds[heretic], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(heretic), RC_PACKAGE, 0, "heretic.wad", "E2M2;E3M6;MUMSIT;WIZACT;MUS_CPTD;CHKNC5;SPAXA1A5");
DD_AddGameResource(GID(heretic), RC_PACKAGE, 0, STARTUPPK3, 0);

/* Heretic (Shareware) */
gameIds[heretic_shareware] = DD_AddGame("heretic-share", DATAPATH, DEFSPATH, "heretic-share.ded", MAINCONFIG, "Heretic Shareware", "Raven Software", "sheretic", 0);
DD_AddGameResource(gameIds[heretic_shareware], RC_PACKAGE, "heretic1.wad", "E1M1;MUMSIT;WIZACT;MUS_CPTD;CHKNC5;SPAXA1A5");
DD_AddGameResource(gameIds[heretic_shareware], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(heretic_shareware), RC_PACKAGE, 0, "heretic1.wad", "E1M1;MUMSIT;WIZACT;MUS_CPTD;CHKNC5;SPAXA1A5");
DD_AddGameResource(GID(heretic_shareware), RC_PACKAGE, 0, STARTUPPK3, 0);
return true;

#undef STARTUPPK3
Expand Down
23 changes: 16 additions & 7 deletions doomsday/plugins/jhexen/src/h2_main.c
Expand Up @@ -31,6 +31,7 @@
// HEADER FILES ------------------------------------------------------------

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

#include "jhexen.h"

Expand All @@ -52,6 +53,8 @@

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

#define GID(v) (toGameId(v))

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

// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
Expand Down Expand Up @@ -116,6 +119,12 @@ static skillmode_t startSkill = SM_MEDIUM;

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

static __inline gameid_t toGameId(int gamemode)
{
assert(gamemode >= 0 && gamemode < NUM_GAME_MODES);
return gameIds[(gamemode_t) gamemode];
}

/**
* Get a 32-bit integer value.
*/
Expand Down Expand Up @@ -192,19 +201,19 @@ int G_RegisterGames(int hookType, int parm, void* data)

/* Hexen (Death Kings) */
gameIds[hexen_deathkings] = DD_AddGame("hexen-dk", DATAPATH, DEFSPATH, "hexen-dk.ded", MAINCONFIG, "Hexen (Deathkings of the Dark Citadel)", "Raven Software", "deathkings", "dk");
DD_AddGameResource(gameIds[hexen_deathkings], RC_PACKAGE, "hexen.wad", "MAP08;MAP22;TINTTAB;FOGMAP;TRANTBLA;DARTA1;ARTIPORK;SKYFOG;TALLYTOP;GROVER");
DD_AddGameResource(gameIds[hexen_deathkings], RC_PACKAGE, "hexdd.wad", "MAP59;MAP60");
DD_AddGameResource(gameIds[hexen_deathkings], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(hexen_deathkings), RC_PACKAGE, 0, "hexen.wad", "MAP08;MAP22;TINTTAB;FOGMAP;TRANTBLA;DARTA1;ARTIPORK;SKYFOG;TALLYTOP;GROVER");
DD_AddGameResource(GID(hexen_deathkings), RC_PACKAGE, 0, "hexdd.wad", "MAP59;MAP60");
DD_AddGameResource(GID(hexen_deathkings), RC_PACKAGE, 0, STARTUPPK3, 0);

/* Hexen */
gameIds[hexen] = DD_AddGame("hexen", DATAPATH, DEFSPATH, "hexen.ded", MAINCONFIG, "Hexen", "Raven Software", "hexen", 0);
DD_AddGameResource(gameIds[hexen], RC_PACKAGE, "hexen.wad", "MAP08;MAP22;TINTTAB;FOGMAP;TRANTBLA;DARTA1;ARTIPORK;SKYFOG;TALLYTOP;GROVER");
DD_AddGameResource(gameIds[hexen], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(hexen), RC_PACKAGE, 0, "hexen.wad", "MAP08;MAP22;TINTTAB;FOGMAP;TRANTBLA;DARTA1;ARTIPORK;SKYFOG;TALLYTOP;GROVER");
DD_AddGameResource(GID(hexen), RC_PACKAGE, 0, STARTUPPK3, 0);

/* Hexen (Demo) */
gameIds[hexen_demo] = DD_AddGame("hexen-demo", DATAPATH, DEFSPATH, "hexen-demo.ded", MAINCONFIG, "Hexen 4-map Beta Demo", "Raven Software", "dhexen", 0);
DD_AddGameResource(gameIds[hexen_demo], RC_PACKAGE, "hexen.wad", "MAP01;MAP04;TINTTAB;FOGMAP;TRANTBLA;DARTA1;ARTIPORK;SKYFOG;TALLYTOP;GROVER");
DD_AddGameResource(gameIds[hexen_demo], RC_PACKAGE, STARTUPPK3, 0);
DD_AddGameResource(GID(hexen_demo), RC_PACKAGE, 0, "hexen.wad", "MAP01;MAP04;TINTTAB;FOGMAP;TRANTBLA;DARTA1;ARTIPORK;SKYFOG;TALLYTOP;GROVER");
DD_AddGameResource(GID(hexen_demo), RC_PACKAGE, 0, STARTUPPK3, 0);
return true;

#undef STARTUPPK3
Expand Down

0 comments on commit 210d7c5

Please sign in to comment.