Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jan 7, 2013
1 parent d3a6621 commit a32bf82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
17 changes: 4 additions & 13 deletions doomsday/engine/src/def_main.cpp
Expand Up @@ -570,20 +570,11 @@ ded_ptcgen_t* Def_GetGenerator(material_t *mat, boolean hasExternal, boolean isC
* A search is necessary only if we know both the used material and
* the specified material in this definition are in *a* group.
*/
if(Material_IsGroupAnimated(defMat) && Material_IsGroupAnimated(mat))
if(Material_IsGroupAnimated(defMat) && Material_IsGroupAnimated(mat) &&
&Material_AnimGroup(defMat) == &Material_AnimGroup(mat))
{
Materials::AnimGroups const &anims = App_Materials()->allAnimGroups();
DENG2_FOR_EACH_CONST(Materials::AnimGroups, k, anims)
{
MaterialAnim const &anim = *k;

if(anim.hasFrameForMaterial(*defMat) &&
anim.hasFrameForMaterial(*mat))
{
// Both are in this group! This def will do.
return def;
}
}
// Both are in this group! This def will do.
return def;
}
}

Expand Down
22 changes: 4 additions & 18 deletions doomsday/engine/src/map/p_particle.cpp
Expand Up @@ -1411,25 +1411,11 @@ static int findDefForGenerator(ptcgen_t *gen, void *parameters)
if(def->flags & PGF_GROUP)
{
// Generator triggered by all materials in the animation.

/**
* A search is necessary only if we know both the used material and
* the specified material in this definition are in *a* animation.
*/
if(Material_IsGroupAnimated(defMat) && Material_IsGroupAnimated(mat))
if(Material_IsGroupAnimated(defMat) && Material_IsGroupAnimated(mat) &&
&Material_AnimGroup(defMat) == &Material_AnimGroup(mat))
{
Materials::AnimGroups const &anims = App_Materials()->allAnimGroups();
DENG2_FOR_EACH_CONST(Materials::AnimGroups, k, anims)
{
MaterialAnim const &anim = *k;

if(anim.hasFrameForMaterial(*defMat) &&
anim.hasFrameForMaterial(*mat))
{
// Both are in this animation! This def will do.
return i + 1; // 1-based index.
}
}
// Both are in this animation! This def will do.
return i + 1; // 1-based index.
}
}
}
Expand Down
1 change: 1 addition & 0 deletions doomsday/engine/src/resource/material.cpp
Expand Up @@ -453,6 +453,7 @@ de::MaterialAnim &Material_AnimGroup(material_t *mat)
}
}

/// @throw Material::NoAnimGroupError The material is not group-animated.
throw Material::NoAnimGroupError("Material_AnimGroup", QString("Material [%p] is not group-animated")
.arg(de::dintptr(mat)));
}
Expand Down

0 comments on commit a32bf82

Please sign in to comment.