Skip to content

Commit

Permalink
API|Definitions|Cleanup: Removed DD_DEF_STATE, DD_SPRITE and DD_FRAME…
Browse files Browse the repository at this point in the history
… constants

The DED definition database is now visible globally, so we no longer
need the Def_Get/Set() API for querying this info.
  • Loading branch information
danij-deng committed Jul 11, 2015
1 parent 028e2a8 commit d83d7ee
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 38 deletions.
6 changes: 3 additions & 3 deletions doomsday/apps/api/dd_share.h
Expand Up @@ -186,7 +186,7 @@ enum {
DD_OLD_GAME_ID,
DD_DEF_MOBJ,
DD_DEF_MOBJ_BY_NAME,
DD_DEF_STATE,
DD_UNUSED29, // DD_DEF_STATE
DD_DEF_SPRITE,
DD_DEF_SOUND,
DD_UNUSED14, // DD_DEF_MUSIC
Expand All @@ -208,8 +208,8 @@ enum {
DD_UNUSED16, // DD_ID
DD_LUMP,
DD_UNUSED17, // DD_CD_TRACK
DD_SPRITE,
DD_FRAME,
DD_UNUSED30, // DD_SPRITE
DD_UNUSED31, // DD_FRAME
DD_GAME_CONFIG, ///< String: dm/co-op, jumping, etc.
DD_PLUGIN_NAME, ///< (e.g., jdoom, jheretic etc..., suitable for use with filepaths)
DD_PLUGIN_NICENAME, ///< (e.g., jDoom, MyGame:Episode2 etc..., fancy name)
Expand Down
32 changes: 0 additions & 32 deletions doomsday/apps/client/src/def_main.cpp
Expand Up @@ -1970,9 +1970,6 @@ dint Def_Get(dint type, char const *id, void *out)
case DD_DEF_MOBJ_BY_NAME:
return Def_GetMobjNumForName(id);

case DD_DEF_STATE:
return Def_GetStateNum(id);

case DD_DEF_ACTION:
return Def_GetActionNum(id);

Expand Down Expand Up @@ -2046,35 +2043,6 @@ dint Def_Set(dint type, dint index, dint value, void const *ptr)

switch(type)
{
case DD_DEF_STATE: {
if(index < 0 || index >= ::defs.states.size())
{
DENG2_ASSERT(!"Def_Set: State index is invalid");
return false;
}
defn::State state = ::defs.states[index];
switch(value)
{
case DD_SPRITE: {
dint sprite = *(dint *) ptr;

if(sprite < 0 || sprite >= defs.sprites.size())
{
LOGDEV_RES_WARNING("Unknown sprite index %i") << sprite;
break;
}

state.def().set("sprite", defs.sprites[value].id);
break; }

case DD_FRAME:
state.def().set("frame", *(dint *)ptr);
break;

default: break;
}
break; }

case DD_DEF_SOUND:
if(index < 0 || index >= ::runtimeDefs.sounds.size())
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/ui/infine/finaleinterpreter.cpp
Expand Up @@ -1794,7 +1794,7 @@ DEFFC(StateAnim)
DENG2_UNUSED(anim);
#endif

int stateId = Def_Get(DD_DEF_STATE, OP_CSTRING(1), 0);
int stateId = Def_GetStateNum(OP_CSTRING(1));
int count = OP_INT(2);

// Animate N states starting from the given one.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/plugins/common/src/d_netcl.cpp
Expand Up @@ -933,7 +933,7 @@ void NetCl_LocalMobjState(reader_s *msg)
ddstring_t* stateName = Str_New();

Str_Read(stateName, msg);
newState = Def_Get(DD_DEF_STATE, Str_Text(stateName), 0);
newState = Defs().getStateNum(Str_Text(stateName));
Str_Delete(stateName);

special1 = Reader_ReadInt32(msg);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/plugins/common/src/g_defs.cpp
Expand Up @@ -54,7 +54,7 @@ void GetDefState(char const *def, int *val)
return;

// Get the state number.
*val = Def_Get(DD_DEF_STATE, data, 0);
*val = Defs().getStateNum(data);
if(*val < 0) *val = 0;
}

Expand Down

0 comments on commit d83d7ee

Please sign in to comment.