diff --git a/doomsday/client/src/audio/s_mus.cpp b/doomsday/client/src/audio/s_mus.cpp index 891e48cd3a..ac7e5de6de 100644 --- a/doomsday/client/src/audio/s_mus.cpp +++ b/doomsday/client/src/audio/s_mus.cpp @@ -245,7 +245,7 @@ int Mus_GetExt(ded_music_t *def, ddstring_t *retPath) } LOG_AUDIO_WARNING("Music file \"%s\" not found (id '%s')") - << *reinterpret_cast(def->path) << def->id; + << *def->path << def->id; } // Try the resource locator? diff --git a/doomsday/client/src/def_main.cpp b/doomsday/client/src/def_main.cpp index 0750fb8c7a..b43cd3b82f 100644 --- a/doomsday/client/src/def_main.cpp +++ b/doomsday/client/src/def_main.cpp @@ -363,7 +363,7 @@ ded_ptcgen_t *Def_GetGenerator(de::Uri const &uri) if(!def->material) continue; // Is this suitable? - if(reinterpret_cast(*def->material) == uri) + if(*def->material == uri) return def; #if 0 /// @todo $revise-texture-animation @@ -821,7 +821,7 @@ static ded_group_t *findGroupDefByFrameTextureUri(de::Uri const &uri) if(!gm.material) continue; - if(reinterpret_cast(*gm.material) == uri) + if(*gm.material == uri) { // Found one. return &grp; @@ -866,7 +866,7 @@ static void rebuildMaterialLayers(Material &material, ded_material_t const &def) // Determine the start frame. int startFrame = 0; while(!grp->members[startFrame].material || - reinterpret_cast(*grp->members[startFrame].material) != textureUri) + *grp->members[startFrame].material != textureUri) { startFrame++; } @@ -887,7 +887,7 @@ static void rebuildMaterialLayers(Material &material, ded_material_t const &def) try { - Texture &texture = App_ResourceSystem().texture(reinterpret_cast(*gm.material)); + Texture &texture = App_ResourceSystem().texture(*gm.material); layer0->addStage(Material::Layer::Stage(&texture, gm.tics, gm.randomTics / float( gm.tics ))); } catch(TextureManifest::MissingTextureError const &) @@ -924,7 +924,7 @@ static void rebuildMaterialLayers(Material &material, ded_material_t const &def) // Add a new stage. try { - Texture &texture = App_ResourceSystem().textureScheme("Details").findByResourceUri(*reinterpret_cast(detailDef->stage.texture)).texture(); + Texture &texture = App_ResourceSystem().textureScheme("Details").findByResourceUri(*detailDef->stage.texture).texture(); dlayer->addStage(Material::DetailLayer::Stage(&texture, stage->tics, stage->variance, detailDef->stage.scale, detailDef->stage.strength, detailDef->stage.maxDistance)); @@ -974,7 +974,7 @@ static void rebuildMaterialLayers(Material &material, ded_material_t const &def) try { Texture &texture = App_ResourceSystem().textureScheme("Reflections") - .findByResourceUri(reinterpret_cast(*shineDef->stage.texture)).texture(); + .findByResourceUri(*shineDef->stage.texture).texture(); Texture *maskTexture = 0; if(shineDef->stage.maskTexture) @@ -982,7 +982,7 @@ static void rebuildMaterialLayers(Material &material, ded_material_t const &def) try { maskTexture = &App_ResourceSystem().textureScheme("Masks") - .findByResourceUri(reinterpret_cast(*shineDef->stage.maskTexture)).texture(); + .findByResourceUri(*shineDef->stage.maskTexture).texture(); } catch(TextureManifest::MissingTextureError const &) {} // Ignore this error. @@ -1037,19 +1037,19 @@ static void rebuildMaterialDecorations(Material &material, ded_material_t const if(stage->up) { - defineLightmap(*reinterpret_cast(stage->up)); + defineLightmap(*stage->up); } if(stage->down) { - defineLightmap(*reinterpret_cast(stage->down)); + defineLightmap(*stage->down); } if(stage->sides) { - defineLightmap(*reinterpret_cast(stage->sides)); + defineLightmap(*stage->sides); } if(stage->flare) { - defineFlaremap(*reinterpret_cast(stage->flare)); + defineFlaremap(*stage->flare); } } @@ -1096,8 +1096,7 @@ static void interpretMaterialDef(ded_material_t const &def) try { // Create/retrieve a manifest for the would-be material. - MaterialManifest *manifest = - &App_ResourceSystem().declareMaterial(*reinterpret_cast(def.uri)); + MaterialManifest *manifest = &App_ResourceSystem().declareMaterial(*def.uri); // Update manifest classification: manifest->setFlags(MaterialManifest::AutoGenerated, def.autoGenerated? SetFlags : UnsetFlags); @@ -1109,7 +1108,7 @@ static void interpretMaterialDef(ded_material_t const &def) { try { - Texture &texture = App_ResourceSystem().texture(*reinterpret_cast(firstLayer.stages[0].texture)); + Texture &texture = App_ResourceSystem().texture(*firstLayer.stages[0].texture); if(texture.isFlagged(Texture::Custom)) { manifest->setFlags(MaterialManifest::Custom); @@ -1119,8 +1118,8 @@ static void interpretMaterialDef(ded_material_t const &def) { // Log but otherwise ignore this error. LOG_RES_WARNING("Ignoring unknown texture \"%s\" in Material \"%s\" (layer %i stage %i): %s") - << *reinterpret_cast(firstLayer.stages[0].texture) - << *reinterpret_cast(def.uri) + << *firstLayer.stages[0].texture + << *def.uri << 0 << 0 << er.asText(); } @@ -1149,12 +1148,12 @@ static void interpretMaterialDef(ded_material_t const &def) catch(ResourceSystem::UnknownSchemeError const &er) { LOG_RES_WARNING("Failed to declare material \"%s\": %s") - << *reinterpret_cast(def.uri) << er.asText(); + << *def.uri << er.asText(); } catch(MaterialScheme::InvalidPathError const &er) { LOG_RES_WARNING("Failed to declare material \"%s\": %s") - << *reinterpret_cast(def.uri) << er.asText(); + << *def.uri << er.asText(); } } @@ -1315,19 +1314,19 @@ void Def_Read() if(dl->stage.up) { - defineLightmap(*reinterpret_cast(dl->stage.up)); + defineLightmap(*dl->stage.up); } if(dl->stage.down) { - defineLightmap(*reinterpret_cast(dl->stage.down)); + defineLightmap(*dl->stage.down); } if(dl->stage.sides) { - defineLightmap(*reinterpret_cast(dl->stage.sides)); + defineLightmap(*dl->stage.sides); } if(dl->stage.flare) { - defineFlaremap(*reinterpret_cast(dl->stage.flare)); + defineFlaremap(*dl->stage.flare); } } } @@ -1344,7 +1343,7 @@ void Def_Read() if(!dtl->stage.texture) continue; - App_ResourceSystem().defineTexture("Details", reinterpret_cast(*dtl->stage.texture)); + App_ResourceSystem().defineTexture("Details", *dtl->stage.texture); } // Surface reflections (Define textures). @@ -1359,11 +1358,11 @@ void Def_Read() if(ref->stage.texture) { - App_ResourceSystem().defineTexture("Reflections", reinterpret_cast(*ref->stage.texture)); + App_ResourceSystem().defineTexture("Reflections", *ref->stage.texture); } if(ref->stage.maskTexture) { - App_ResourceSystem().defineTexture("Masks", reinterpret_cast(*ref->stage.maskTexture), + App_ResourceSystem().defineTexture("Masks", *ref->stage.maskTexture, Vector2i(ref->stage.maskWidth, ref->stage.maskHeight)); } } @@ -1597,7 +1596,7 @@ static void initMaterialGroup(ded_group_t &def) try { - MaterialManifest &manifest = App_ResourceSystem().materialManifest(*reinterpret_cast(gm->material)); + MaterialManifest &manifest = App_ResourceSystem().materialManifest(*gm->material); if(def.flags & AGF_PRECACHE) // A precache group. { @@ -1626,7 +1625,7 @@ static void initMaterialGroup(ded_group_t &def) { // Log but otherwise ignore this error. LOG_RES_WARNING("Unknown material \"%s\" in group def %i: %s") - << *reinterpret_cast(gm->material) + << *gm->material << i << er.asText(); } } @@ -1682,23 +1681,23 @@ void Def_PostInit() // Lights. for(int i = 0; i < defs.lights.size(); ++i) { - ded_light_t* lig = &defs.lights[i]; + ded_light_t *lig = &defs.lights[i]; if(lig->up) { - defineLightmap(*reinterpret_cast(lig->up)); + defineLightmap(*lig->up); } if(lig->down) { - defineLightmap(*reinterpret_cast(lig->down)); + defineLightmap(*lig->down); } if(lig->sides) { - defineLightmap(*reinterpret_cast(lig->sides)); + defineLightmap(*lig->sides); } if(lig->flare) { - defineFlaremap(*reinterpret_cast(lig->flare)); + defineFlaremap(*lig->flare); } } @@ -1797,7 +1796,7 @@ void Def_CopyLineType(linetype_t* l, ded_linetype_t* def) { try { - l->actMaterial = App_ResourceSystem().materialManifest(*reinterpret_cast(def->actMaterial)).id(); + l->actMaterial = App_ResourceSystem().materialManifest(*def->actMaterial).id(); } catch(ResourceSystem::MissingManifestError const &) {} // Ignore this error. @@ -1807,7 +1806,7 @@ void Def_CopyLineType(linetype_t* l, ded_linetype_t* def) { try { - l->deactMaterial = App_ResourceSystem().materialManifest(*reinterpret_cast(def->deactMaterial)).id(); + l->deactMaterial = App_ResourceSystem().materialManifest(*def->deactMaterial).id(); } catch(ResourceSystem::MissingManifestError const &) {} // Ignore this error. diff --git a/doomsday/client/src/render/r_things.cpp b/doomsday/client/src/render/r_things.cpp index a3e2a9b53a..af4d141da8 100644 --- a/doomsday/client/src/render/r_things.cpp +++ b/doomsday/client/src/render/r_things.cpp @@ -517,7 +517,7 @@ void R_ProjectSprite(mobj_t *mo) if(def && def->flare) { - de::Uri const &flaremapResourceUri = *reinterpret_cast(def->flare); + de::Uri const &flaremapResourceUri = *def->flare; if(flaremapResourceUri.path().toStringRef().compareWithoutCase("-")) { vis->data.flare.tex = GL_PrepareFlaremap(flaremapResourceUri); diff --git a/doomsday/client/src/render/sky.cpp b/doomsday/client/src/render/sky.cpp index 0457a3cb4a..5e3d4dbef0 100644 --- a/doomsday/client/src/render/sky.cpp +++ b/doomsday/client/src/render/sky.cpp @@ -571,7 +571,7 @@ void Sky::configure(ded_sky_t *def) .setFadeoutLimit(lyrDef.colorLimit) .enable(); - if(de::Uri *matUri = reinterpret_cast(lyrDef.material)) + if(de::Uri *matUri = lyrDef.material) { try { diff --git a/doomsday/client/src/resource/compositebitmapfont.cpp b/doomsday/client/src/resource/compositebitmapfont.cpp index 28bb86ed99..5341a12535 100644 --- a/doomsday/client/src/resource/compositebitmapfont.cpp +++ b/doomsday/client/src/resource/compositebitmapfont.cpp @@ -222,7 +222,7 @@ CompositeBitmapFont *CompositeBitmapFont::fromDef(FontManifest &manifest, if(!def.charMap[i].path) continue; try { - String glyphPatchPath = reinterpret_cast(*def.charMap[i].path).resolved(); + String glyphPatchPath = def.charMap[i].path->resolved(); font->glyphSetPatch(def.charMap[i].ch, glyphPatchPath); } catch(de::Uri::ResolveError const &er) @@ -259,7 +259,7 @@ void CompositeBitmapFont::rebuildFromDef(ded_compositefont_t const &newDef) try { - String glyphPatchPath = reinterpret_cast(*d->def->charMap[i].path).resolved(); + String glyphPatchPath = d->def->charMap[i].path->resolved(); glyphSetPatch(d->def->charMap[i].ch, glyphPatchPath); } catch(de::Uri::ResolveError const& er) diff --git a/doomsday/client/src/resource/material.cpp b/doomsday/client/src/resource/material.cpp index 35788aaf38..2a61db5fe1 100644 --- a/doomsday/client/src/resource/material.cpp +++ b/doomsday/client/src/resource/material.cpp @@ -46,7 +46,7 @@ static Texture *findTextureForLayerStage(ded_material_layer_stage_t const &def) { if(def.texture) { - return &App_ResourceSystem().texture(*reinterpret_cast(def.texture)); + return &App_ResourceSystem().texture(*def.texture); } } catch(TextureManifest::MissingTextureError const &) @@ -104,7 +104,7 @@ static Texture *findTextureForDetailLayerStage(ded_detail_stage_t const &def) if(def.texture) { return &App_ResourceSystem().textureScheme("Details") - .findByResourceUri(*reinterpret_cast(def.texture)).texture(); + .findByResourceUri(*def.texture).texture(); } } catch(TextureManifest::MissingTextureError const &) @@ -163,7 +163,7 @@ static Texture *findTextureForShineLayerStage(ded_shine_stage_t const &def, bool if(def.maskTexture) { return &App_ResourceSystem().textureScheme("Masks") - .findByResourceUri(*reinterpret_cast(def.maskTexture)).texture(); + .findByResourceUri(*def.maskTexture).texture(); } } else @@ -171,7 +171,7 @@ static Texture *findTextureForShineLayerStage(ded_shine_stage_t const &def, bool if(def.texture) { return &App_ResourceSystem().textureScheme("Reflections") - .findByResourceUri(*reinterpret_cast(def.texture)).texture(); + .findByResourceUri(*def.texture).texture(); } } } @@ -220,16 +220,16 @@ Material::ShineLayer::Stages const &Material::ShineLayer::stages() const Material::Decoration::Stage *Material::Decoration::Stage::fromDef(ded_decorlight_stage_t const &def) { - Texture *upTexture = App_ResourceSystem().texture("Lightmaps", reinterpret_cast(def.up)); - Texture *downTexture = App_ResourceSystem().texture("Lightmaps", reinterpret_cast(def.down)); - Texture *sidesTexture = App_ResourceSystem().texture("Lightmaps", reinterpret_cast(def.sides)); + Texture *upTexture = App_ResourceSystem().texture("Lightmaps", def.up); + Texture *downTexture = App_ResourceSystem().texture("Lightmaps", def.down); + Texture *sidesTexture = App_ResourceSystem().texture("Lightmaps", def.sides); Texture *flareTexture = 0; int sysFlareIdx = def.sysFlareIdx; if(def.flare && !def.flare->isEmpty()) { - de::Uri const *resourceUri = reinterpret_cast(def.flare); + de::Uri const *resourceUri = def.flare; // Select a system flare by numeric identifier? if(resourceUri->path().length() == 1 && diff --git a/doomsday/client/src/resource/resourcesystem.cpp b/doomsday/client/src/resource/resourcesystem.cpp index d7361be6e3..abddcb2dff 100644 --- a/doomsday/client/src/resource/resourcesystem.cpp +++ b/doomsday/client/src/resource/resourcesystem.cpp @@ -3104,7 +3104,7 @@ AbstractFont *ResourceSystem::newFontFromDef(ded_compositefont_t const &def) LOG_AS("ResourceSystem::newFontFromDef"); if(!def.uri) return 0; - de::Uri const &uri = *reinterpret_cast(def.uri); + de::Uri const &uri = *def.uri; try { diff --git a/doomsday/client/src/world/map.cpp b/doomsday/client/src/world/map.cpp index 744d6f787a..dfa310aa00 100644 --- a/doomsday/client/src/world/map.cpp +++ b/doomsday/client/src/world/map.cpp @@ -1450,7 +1450,7 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) { try { - Material *defMat = &App_ResourceSystem().material(*reinterpret_cast(def->material)); + Material *defMat = &App_ResourceSystem().material(*def->material); Material *mat = gen->plane->surface().materialPtr(); if(def->flags & Generator::SpawnFloor) diff --git a/doomsday/libdoomsday/src/defs/ded.cpp b/doomsday/libdoomsday/src/defs/ded.cpp index 9eaf977057..fd0541e547 100644 --- a/doomsday/libdoomsday/src/defs/ded.cpp +++ b/doomsday/libdoomsday/src/defs/ded.cpp @@ -371,10 +371,12 @@ ded_material_t *ded_s::findMaterialDef(de::Uri const &uri) const for(int i = materials.size() - 1; i >= 0; i--) { ded_material_t *def = &materials[i]; - if(!def->uri || uri != reinterpret_cast(*def->uri)) continue; - return def; + if(def->uri && uri == *def->uri) + { + return def; + } } - return NULL; + return 0; // Not found. } ded_material_t* ded_s::getMaterial(char const *uriCString) const