Skip to content

Commit

Permalink
Refactor: Dumped the unnecessary resource namespace name macros
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Nov 26, 2012
1 parent 05750e8 commit d185262
Show file tree
Hide file tree
Showing 31 changed files with 130 additions and 173 deletions.
50 changes: 3 additions & 47 deletions doomsday/engine/api/dd_share.h
Expand Up @@ -1274,26 +1274,10 @@ typedef struct {
#define AGF_PRECACHE 0x4000 // Group is just for precaching.
/**@}*/

/**
* @defgroup scheme Schemes
* @ingroup resource
*/

/**
/*
* Material Schemes
*/

/**
* @defgroup materialSchemeNames Material Scheme Names
* @ingroup scheme
*/
///@{
#define MS_SYSTEM_NAME "System"
#define MS_FLATS_NAME "Flats"
#define MS_TEXTURES_NAME "Textures"
#define MS_SPRITES_NAME "Sprites"
///@}

typedef enum materialschemeid_e {
MS_ANY = -1,
MATERIALSCHEME_FIRST = 1000,
Expand All @@ -1310,29 +1294,10 @@ typedef enum materialschemeid_e {
/// @c true= val can be interpreted as a valid material scheme identifier.
#define VALID_MATERIALSCHEMEID(val) ((val) >= MATERIALSCHEME_FIRST && (val) <= MATERIALSCHEME_LAST)

/**
/*
* Texture Schemes
*/

/**
* @defgroup textureSchemeNames Texture Scheme Names
* @ingroup scheme
*/
///@{
#define TS_SYSTEM_NAME "System"
#define TS_FLATS_NAME "Flats"
#define TS_TEXTURES_NAME "Textures"
#define TS_SPRITES_NAME "Sprites"
#define TS_PATCHES_NAME "Patches"
#define TS_DETAILS_NAME "Details"
#define TS_REFLECTIONS_NAME "Reflections"
#define TS_MASKS_NAME "Masks"
#define TS_MODELSKINS_NAME "ModelSkins"
#define TS_MODELREFLECTIONSKINS_NAME "ModelReflectionSkins"
#define TS_LIGHTMAPS_NAME "Lightmaps"
#define TS_FLAREMAPS_NAME "Flaremaps"
///@}

/// Texture scheme identifiers. @ingroup scheme
typedef enum textureschemeid_e {
TS_ANY = -1,
Expand All @@ -1358,19 +1323,10 @@ typedef enum textureschemeid_e {
/// @c true= val can be interpreted as a valid texture scheme identifier.
#define VALID_TEXTURESCHEMEID(val) ((val) >= TEXTURESCHEME_FIRST && (val) <= TEXTURESCHEME_LAST)

/**
/*
* Font Schemes
*/

/**
* @defgroup fontSchemeNames Font Scheme Names
* @ingroup scheme
*/
///@{
#define FN_SYSTEM_NAME "System"
#define FN_GAME_NAME "Game"
///@}

/// Font scheme identifier. @ingroup scheme
typedef enum fontschemeid_e {
FS_ANY = -1,
Expand Down
3 changes: 2 additions & 1 deletion doomsday/engine/include/render/r_sky.h
Expand Up @@ -29,6 +29,7 @@
#ifndef LIBDENG_REFRESH_SKY_H
#define LIBDENG_REFRESH_SKY_H

#include "color.h"
#include "resource/models.h"

#define MAX_SKY_LAYERS ( 2 )
Expand All @@ -37,7 +38,7 @@
#define DEFAULT_SKY_HEIGHT ( .666667f )
#define DEFAULT_SKY_HORIZON_OFFSET ( 0 )
#define DEFAULT_SKY_SPHERE_XOFFSET ( 0 )
#define DEFAULT_SKY_SPHERE_MATERIAL ( MS_TEXTURES_NAME":SKY1" )
#define DEFAULT_SKY_SPHERE_MATERIAL ( "Textures:SKY1" )
#define DEFAULT_SKY_SPHERE_FADEOUT_LIMIT ( .3f )

typedef struct skymodel_s {
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/src/con_main.c
Expand Up @@ -2575,7 +2575,7 @@ D_CMD(Font)
{
Uri* uri = Fonts_ComposeUri(newFont);
Con_SetFont(newFont);
if(!Str_CompareIgnoreCase(Uri_Scheme(uri), FN_GAME_NAME))
if(!Str_CompareIgnoreCase(Uri_Scheme(uri), "Game"))
{
Con_SetFontScale(1.5f, 2);
Con_SetFontLeading(1.25f);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/src/dd_main.cpp
Expand Up @@ -627,7 +627,7 @@ void DD_StartTitle(void)
Window_Height(theWindow));
for(i = 1; i <= FIPAGE_NUM_PREDEFINED_FONTS; ++i)
{
Str_Appendf(&setupCmds, "prefont %i "FN_SYSTEM_NAME":%s\n", i, fontName);
Str_Appendf(&setupCmds, "prefont %i System:%s\n", i, fontName);
}

// Configure the predefined colors.
Expand Down
16 changes: 8 additions & 8 deletions doomsday/engine/src/def_main.cpp
Expand Up @@ -399,16 +399,16 @@ ded_material_t* Def_GetMaterial(char const* uriCString)
// Caller doesn't care which scheme - use a priority search order.
de::Uri temp = de::Uri(uri);

temp.setScheme(MS_SPRITES_NAME);
temp.setScheme("Sprites");
def = findMaterialDef(temp);
if(!def)
{
temp.setScheme(MS_TEXTURES_NAME);
temp.setScheme("Textures");
def = findMaterialDef(temp);
}
if(!def)
{
temp.setScheme(MS_FLATS_NAME);
temp.setScheme("Flats");
def = findMaterialDef(temp);
}
}
Expand Down Expand Up @@ -444,11 +444,11 @@ ded_compositefont_t* Def_GetCompositeFont(char const* uriCString)
// Caller doesn't care which scheme - use a priority search order.
de::Uri temp = de::Uri(uri);

temp.setScheme(FN_GAME_NAME);
temp.setScheme("Game");
def = findCompositeFontDef(temp);
if(!def)
{
temp.setScheme(FN_SYSTEM_NAME);
temp.setScheme("System");
def = findCompositeFontDef(temp);
}
}
Expand Down Expand Up @@ -964,7 +964,7 @@ static int generateMaterialDefForPatchCompositeTexture(textureid_t texId, void*
mat->autoGenerated = true;

mat->uri = Uri_Dup(texUri);
Uri_SetScheme(mat->uri, MS_TEXTURES_NAME);
Uri_SetScheme(mat->uri, "Textures");

tex = Textures_ToTexture(texId);
if(tex)
Expand Down Expand Up @@ -1004,7 +1004,7 @@ static int generateMaterialDefForFlatTexture(textureid_t texId, void* parameters
mat->autoGenerated = true;

mat->uri = Uri_Dup(texUri);
Uri_SetScheme(mat->uri, MS_FLATS_NAME);
Uri_SetScheme(mat->uri, "Flats");

stage = DED_AddMaterialLayerStage(&mat->layers[0]);
st = &mat->layers[0].stages[stage];
Expand Down Expand Up @@ -1042,7 +1042,7 @@ static int generateMaterialDefForSpriteTexture(textureid_t texId, void* paramete
mat->autoGenerated = true;

mat->uri = Uri_Dup(texUri);
Uri_SetScheme(mat->uri, MS_SPRITES_NAME);
Uri_SetScheme(mat->uri, "Sprites");

stage = DED_AddMaterialLayerStage(&mat->layers[0]);
st = &mat->layers[0].stages[stage];
Expand Down
32 changes: 16 additions & 16 deletions doomsday/engine/src/def_read.cpp
Expand Up @@ -1520,7 +1520,7 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
{
READLABEL;
RV_URI("Material", &sl->material, 0)
RV_URI("Texture", &sl->material, MS_TEXTURES_NAME )
RV_URI("Texture", &sl->material, "Textures" )
RV_FLAGS("Flags", sl->flags, "slf_")
RV_FLT("Offset", sl->offset)
RV_FLT("Color limit", sl->colorLimit)
Expand Down Expand Up @@ -1631,7 +1631,7 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
{
READLABEL;
RV_URI("Material", &sl->material, 0)
RV_URI("Texture", &sl->material, MS_TEXTURES_NAME)
RV_URI("Texture", &sl->material, "Textures")
RV_FLAGS("Flags", sl->flags, "slf_")
RV_FLT("Offset", sl->offset)
RV_FLT("Color limit", sl->colorLimit)
Expand Down Expand Up @@ -1730,7 +1730,7 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
{
// A new material path.
ddstring_t schemeName; Str_Init(&schemeName);
Str_Set(&schemeName, ISLABEL("Material")? "" : ISLABEL("Texture")? MS_TEXTURES_NAME : MS_FLATS_NAME);
Str_Set(&schemeName, ISLABEL("Material")? "" : ISLABEL("Texture")? "Textures" : "Flats");
mn = (uri_s**) DED_NewEntry((void**)&tenv->materials, &tenv->count, sizeof(*mn));
FINDBEGIN;
for(;;)
Expand Down Expand Up @@ -1764,7 +1764,7 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
READLABEL;
if(ISLABEL("ID"))
{
READURI(&cfont->uri, FN_GAME_NAME)
READURI(&cfont->uri, "Game")
CHECKSC;
}
else if(M_IsStringValidInt(label))
Expand Down Expand Up @@ -1926,15 +1926,15 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
RV_FLAGS("Flags", dtl->flags, "dtf_")
if(ISLABEL("Texture"))
{
READURI(&dtl->material1, MS_TEXTURES_NAME)
READURI(&dtl->material1, "Textures")
}
else if(ISLABEL("Wall")) // Alias
{
READURI(&dtl->material1, MS_TEXTURES_NAME)
READURI(&dtl->material1, "Textures")
}
else if(ISLABEL("Flat"))
{
READURI(&dtl->material2, MS_FLATS_NAME)
READURI(&dtl->material2, "Flats")
}
else if(ISLABEL("Lump"))
{
Expand Down Expand Up @@ -1991,11 +1991,11 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
}
else if(ISLABEL("Texture"))
{
READURI(&ref->material, MS_TEXTURES_NAME)
READURI(&ref->material, "Textures")
}
else if(ISLABEL("Flat"))
{
READURI(&ref->material, MS_FLATS_NAME)
READURI(&ref->material, "Flats")
}
else RV_END
CHECKSC;
Expand Down Expand Up @@ -2040,11 +2040,11 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
}
else if(ISLABEL("Flat"))
{
READURI(&gen->material, MS_FLATS_NAME)
READURI(&gen->material, "Flats")
}
else if(ISLABEL("Texture"))
{
READURI(&gen->material, MS_TEXTURES_NAME)
READURI(&gen->material, "Textures")
}
else
RV_STR("Mobj", gen->type)
Expand Down Expand Up @@ -2205,11 +2205,11 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
}
else if(ISLABEL("Texture"))
{
READURI(&decor->material, MS_TEXTURES_NAME)
READURI(&decor->material, "Textures")
}
else if(ISLABEL("Flat"))
{
READURI(&decor->material, MS_FLATS_NAME)
READURI(&decor->material, "Flats")
}
else if(ISLABEL("Light"))
{
Expand Down Expand Up @@ -2283,7 +2283,7 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
{
ded_group_member_t* memb;
ddstring_t schemeName; Str_Init(&schemeName);
Str_Set(&schemeName, ISLABEL("Texture")? MS_TEXTURES_NAME : MS_FLATS_NAME);
Str_Set(&schemeName, ISLABEL("Texture")? "Textures" : "Flats");

// Need to allocate new stage?
if(sub >= grp->count.num)
Expand Down Expand Up @@ -2420,15 +2420,15 @@ static int DED_ReadData(ded_t* ded, const char* buffer, const char* _sourceFile)
}
else if(ISLABEL("Act texture")) // Alias
{
READURI(&l->actMaterial, MS_TEXTURES_NAME)
READURI(&l->actMaterial, "Textures")
}
else if(ISLABEL("Deact material"))
{
READURI(&l->deactMaterial, 0)
}
else if(ISLABEL("Deact texture")) // Alias
{
READURI(&l->deactMaterial, MS_TEXTURES_NAME)
READURI(&l->deactMaterial, "Textures")
}
else
RV_INT("Act type", l->actLineType)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/src/map/r_world.c
Expand Up @@ -1735,7 +1735,7 @@ static material_t* chooseFixMaterial(SideDef* s, SideDefSection section)
if(choice2) return choice2;

// We'll assign the special "missing" material...
return Materials_ToMaterial(Materials_ResolveUriCString(MS_SYSTEM_NAME":missing"));
return Materials_ToMaterial(Materials_ResolveUriCString("System:missing"));
}

static void addMissingMaterial(SideDef* s, SideDefSection section)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/src/render/r_main.c
Expand Up @@ -171,7 +171,7 @@ static fontid_t loadSystemFont(const char* name)
assert(name && name[0]);

// Compose the resource name.
uri = Uri_NewWithPath2(FN_SYSTEM_NAME":", RC_NULL);
uri = Uri_NewWithPath2("System:", RC_NULL);
Uri_SetPath(uri, name);

// Compose the resource data path.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/src/render/r_things.c
Expand Up @@ -372,7 +372,7 @@ static int buildSpriteRotationsWorker(textureid_t texId, void* parameters)
link = true;
}

uri = Uri_NewWithPath2(MS_SPRITES_NAME":", RC_NULL);
uri = Uri_NewWithPath2("Sprites:", RC_NULL);
Uri_SetPath(uri, Str_Text(path));
frame->mat = Materials_ToMaterial(Materials_ResolveUri(uri));
Uri_Delete(uri);
Expand Down
10 changes: 5 additions & 5 deletions doomsday/engine/src/render/rend_main.c
Expand Up @@ -1675,13 +1675,13 @@ static boolean rendHEdgeSection(HEdge* hedge, SideDefSection section,
if(renderTextures == 2)
{
// Lighting debug mode; render using System:gray.
mat = Materials_ToMaterial(Materials_ResolveUriCString(MS_SYSTEM_NAME":gray"));
mat = Materials_ToMaterial(Materials_ResolveUriCString("System:gray"));
}
else if(!surface->material ||
((surface->inFlags & SUIF_FIX_MISSING_MATERIAL) && devNoTexFix))
{
// Missing material debug mode; render using System:missing.
mat = Materials_ToMaterial(Materials_ResolveUriCString(MS_SYSTEM_NAME":missing"));
mat = Materials_ToMaterial(Materials_ResolveUriCString("System:missing"));
}
else
{
Expand Down Expand Up @@ -2796,10 +2796,10 @@ static void Rend_RenderPlanes(void)
else if(texMode == 1)
// For debug, render the "missing" texture instead of the texture
// chosen for surfaces to fix the HOMs.
mat = Materials_ToMaterial(Materials_ResolveUriCString(MS_SYSTEM_NAME":missing"));
mat = Materials_ToMaterial(Materials_ResolveUriCString("System:missing"));
else
// For lighting debug, render all solid surfaces using the gray texture.
mat = Materials_ToMaterial(Materials_ResolveUriCString(MS_SYSTEM_NAME":gray"));
mat = Materials_ToMaterial(Materials_ResolveUriCString("System:gray"));

V2f_Copy(texOffset, suf->visOffset);
// Add the Y offset to orient the Y flipped texture.
Expand Down Expand Up @@ -3970,7 +3970,7 @@ static void Rend_RenderBoundingBoxes(void)
glEnable(GL_TEXTURE_2D);
glDisable(GL_CULL_FACE);

mat = Materials_ToMaterial(Materials_ResolveUriCString(MS_SYSTEM_NAME":bbox"));
mat = Materials_ToMaterial(Materials_ResolveUriCString("System:bbox"));
spec = Materials_VariantSpecificationForContext(MC_SPRITE, 0, 0, 0, 0,
GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, 1, -2, -1, true, true, true, false);
ms = Materials_Prepare(mat, spec, true);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/src/render/rend_model.c
Expand Up @@ -1161,7 +1161,7 @@ static void Mod_RenderSubModel(uint number, const rendmodelparams_t* params)
if(renderTextures == 2)
{
// For lighting debug, render all surfaces using the gray texture.
material_t* mat = Materials_ToMaterial(Materials_ResolveUriCString(MS_SYSTEM_NAME":gray"));
material_t* mat = Materials_ToMaterial(Materials_ResolveUriCString("System:gray"));
if(mat)
{
const materialvariantspecification_t* spec = Materials_VariantSpecificationForContext(
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/src/render/rend_sky.c
Expand Up @@ -255,14 +255,14 @@ static void configureRenderHemisphereStateForLayer(int layer, hemispherecap_t se

if(renderTextures == 2)
{
mat = Materials_ToMaterial(Materials_ResolveUriCString(MS_SYSTEM_NAME":gray"));
mat = Materials_ToMaterial(Materials_ResolveUriCString("System:gray"));
}
else
{
mat = R_SkyLayerMaterial(layer);
if(!mat)
{
mat = Materials_ToMaterial(Materials_ResolveUriCString(MS_SYSTEM_NAME":missing"));
mat = Materials_ToMaterial(Materials_ResolveUriCString("System:missing"));
rs.texXFlip = false;
}
}
Expand Down

0 comments on commit d185262

Please sign in to comment.