Skip to content

Commit

Permalink
Refactor: Relocated DED parser and data structure to libdoomsday
Browse files Browse the repository at this point in the history
Also cleaned up the code a little by removing internal use of
opaque Uri instances, since everything is now C++ and can use de::Uri
directly.
  • Loading branch information
skyjake committed May 4, 2014
1 parent 94e8c7b commit 01a23b7
Show file tree
Hide file tree
Showing 35 changed files with 2,061 additions and 2,053 deletions.
3 changes: 0 additions & 3 deletions doomsday/client/client.pro
Expand Up @@ -226,7 +226,6 @@ DENG_HEADERS += \
include/de_resource.h \
include/de_system.h \
include/de_ui.h \
include/def_data.h \
include/def_main.h \
include/edit_bias.h \
include/edit_map.h \
Expand Down Expand Up @@ -543,9 +542,7 @@ SOURCES += \
src/dd_pinit.cpp \
src/dd_plugin.cpp \
src/dd_wad.cpp \
src/def_data.cpp \
src/def_main.cpp \
src/def_read.cpp \
src/edit_bias.cpp \
src/face.cpp \
src/game.cpp \
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/audio/s_environ.h
Expand Up @@ -22,7 +22,7 @@
#ifndef DENG_SOUND_ENVIRON
#define DENG_SOUND_ENVIRON

#include "api_uri.h"
#include <doomsday/uri.h>

enum AudioEnvironmentId
{
Expand Down Expand Up @@ -60,6 +60,6 @@ AudioEnvironment const &S_AudioEnvironment(AudioEnvironmentId id);
* Lookup the audio environment associated with material @a uri. If no environment
* is defined then @c AE_NONE is returned.
*/
AudioEnvironmentId S_AudioEnvironmentId(Uri const *uri);
AudioEnvironmentId S_AudioEnvironmentId(de::Uri const *uri);

#endif // DENG_SOUND_ENVIRON
6 changes: 4 additions & 2 deletions doomsday/client/include/de_defs.h
Expand Up @@ -24,8 +24,10 @@
#ifndef __DOOMSDAY_DEFINITIONS_H__
#define __DOOMSDAY_DEFINITIONS_H__

#include "def_main.h"
#include "def_data.h"
#include "def_share.h"
#include "def_main.h"
#include <doomsday/defs/ded.h>
#include <doomsday/defs/dedfile.h>
#include <doomsday/defs/dedparser.h>

#endif
3 changes: 0 additions & 3 deletions doomsday/client/include/def_main.h
Expand Up @@ -23,7 +23,6 @@
#ifndef LIBDENG_DEFINITIONS_MAIN_H
#define LIBDENG_DEFINITIONS_MAIN_H

#include "def_data.h"
#include "Material"
#include <de/stringarray.h>

Expand Down Expand Up @@ -83,7 +82,6 @@ void Def_Destroy(void);
* state, mobjinfo, sound, music, text and mapinfo databases accordingly.
*/
void Def_Read(void);
void Def_ReadProcessDED(const char* fileName);

int Def_GetMobjNum(const char* id);
int Def_GetMobjNumForName(const char* name);
Expand Down Expand Up @@ -131,7 +129,6 @@ extern "C" {

ded_ptcgen_t* Def_GetDamageGenerator(int mobjType);

int Def_EvalFlags2(char const *string);
int Def_EvalFlags(char *string);

/**
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/render/sky.h
Expand Up @@ -26,7 +26,7 @@
#include <de/Error>
#include <de/Observers>
#include <de/Vector>
#include <doomsday/defs/database.h>
#include <doomsday/defs/ded.h>
#include <QFlags>

#define MAX_SKY_LAYERS ( 2 )
Expand Down
1 change: 0 additions & 1 deletion doomsday/client/include/resource/compositebitmapfont.h
Expand Up @@ -21,7 +21,6 @@
#define CLIENT_RESOURCE_COMPOSITEBITMAPFONT_H

#include "abstractfont.h"
#include "def_main.h"
#include "Texture"
#include <de/Rectangle>
#include <de/String>
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/resource/material.h
Expand Up @@ -22,14 +22,14 @@
#define DENG_RESOURCE_MATERIAL_H

#include "MapElement"
#include "def_data.h"
#include "audio/s_environ.h"
#include "world/dmuargs.h"
#ifdef __CLIENT__
# include "MaterialContext"
#endif
#include "Texture"
#include <doomsday/uri.h>
#include <doomsday/defs/ded.h>
#include <de/Error>
#include <de/Observers>
#include <de/Vector>
Expand Down
1 change: 0 additions & 1 deletion doomsday/client/include/resource/materialvariantspec.h
Expand Up @@ -24,7 +24,6 @@
# error "resource/materialvariantspec.h only exists in the Client"
#endif

#include "def_data.h"
#include "MaterialContext"
#include "Texture" // TextureVariantSpec

Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/resource/modeldef.h
Expand Up @@ -23,8 +23,8 @@

#include <vector>
#include <de/Vector>
#include <doomsday/defs/ded.h>

#include "def_data.h"
#include "resource/model.h"

/**
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/resource/resourcesystem.h
Expand Up @@ -19,7 +19,7 @@
#ifndef DENG_RESOURCESYSTEM_H
#define DENG_RESOURCESYSTEM_H

#include "def_data.h"
#include <doomsday/defs/ded.h>
#include <doomsday/resource/resourceclass.h>
#include "resource/animgroup.h"
#include "resource/colorpalette.h"
Expand Down
1 change: 0 additions & 1 deletion doomsday/client/include/world/generator.h
Expand Up @@ -21,7 +21,6 @@
#ifndef DENG_CLIENT_WORLD_GENERATOR_H
#define DENG_CLIENT_WORLD_GENERATOR_H

#include "def_data.h"
#include "map.h"
#include <de/Vector>

Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/world/p_object.h
Expand Up @@ -26,14 +26,14 @@
#endif

#include "api_map.h"
#include "def_data.h"
#ifdef __CLIENT__
# include "ModelDef"
# include "Sprite"
#endif
#include <de/Vector>
#include <de/aabox.h>
#include <doomsday/world/mobj.h>
#include <doomsday/defs/ded.h>

class BspLeaf;
class Plane;
Expand Down
6 changes: 3 additions & 3 deletions doomsday/client/src/audio/s_environ.cpp
Expand Up @@ -50,7 +50,7 @@ AudioEnvironment const &S_AudioEnvironment(AudioEnvironmentId id)
return envInfo[1 + int(id)];
}

AudioEnvironmentId S_AudioEnvironmentId(uri_s const *uri)
AudioEnvironmentId S_AudioEnvironmentId(de::Uri const *uri)
{
if(uri)
{
Expand All @@ -59,8 +59,8 @@ AudioEnvironmentId S_AudioEnvironmentId(uri_s const *uri)
{
for(int k = 0; k < env->count.num; ++k)
{
uri_s *ref = env->materials[k];
if(!ref || !Uri_Equality(ref, uri)) continue;
de::Uri *ref = env->materials[k];
if(!ref || *ref != *uri) continue;

// Is this a known environment?
for(int m = 0; m < NUM_AUDIO_ENVIRONMENTS; ++m)
Expand Down
8 changes: 4 additions & 4 deletions doomsday/client/src/audio/s_mus.cpp
Expand Up @@ -231,11 +231,11 @@ int Mus_GetExt(ded_music_t *def, ddstring_t *retPath)

if(!musAvail || !AudioDriver_Music_Available() || !def) return false;

if(def->path && !Str_IsEmpty(Uri_Path(def->path)))
if(def->path && !def->path->path().isEmpty())
{
// All external music files are specified relative to the base path.
AutoStr *fullPath = AutoStr_NewStd();
F_PrependBasePath(fullPath, Uri_Path(def->path));
F_PrependBasePath(fullPath, def->path->pathStr());
F_FixSlashes(fullPath, fullPath);

if(F_Access(Str_Text(fullPath)))
Expand Down Expand Up @@ -281,8 +281,8 @@ int Mus_GetCD(ded_music_t *def)
if(def->cdTrack)
return def->cdTrack;

if(def->path && !stricmp(Str_Text(Uri_Scheme(def->path)), "cd"))
return atoi(Str_Text(Uri_Path(def->path)));
if(def->path && !stricmp(def->path->schemeCStr(), "cd"))
return atoi(def->path->pathCStr());

return 0;
}
Expand Down

0 comments on commit 01a23b7

Please sign in to comment.