Skip to content

Commit

Permalink
Merge branch 'master' into common-episode-definition
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Oct 3, 2014
2 parents 1b146e7 + e4c9618 commit 423b991
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion doomsday/client/src/render/rend_particle.cpp
Expand Up @@ -142,7 +142,7 @@ static byte loadParticleTexture(uint particleTex)
image_t image;
if(!GL_LoadImage(image, foundPath.toUtf8().constData()))
{
LOG_RES_WARNING("Failed to load \"%s\"") << foundPath;
LOG_RES_WARNING("Failed to load \"%s\"") << NativePath(foundPath).pretty();
return 0;
}

Expand Down
8 changes: 3 additions & 5 deletions doomsday/client/src/resource/model.cpp
Expand Up @@ -756,7 +756,8 @@ int Model::skinNumber(String name) const
{
if(!name.isEmpty())
{
for(int i = 0; i < d->skins.count(); ++i)
// Reverse iteration so that later skins override earlier ones.
for(int i = d->skins.count(); i--> 0; )
{
Skin const &skin = d->skins.at(i);
if(!skin.name.compareWithoutCase(name))
Expand All @@ -779,10 +780,7 @@ Model::Skin &Model::skin(int number) const
Model::Skin &Model::newSkin(String name)
{
LOG_AS("Model");
if(int index = skinNumber(name) > 0)
{
return skin(index);
}
// Allow duplicates so that skin indices remain unchanged for selection by index.
d->skins.append(ModelSkin(name));
return d->skins.last();
}
Expand Down
24 changes: 16 additions & 8 deletions doomsday/client/src/resource/resourcesystem.cpp
Expand Up @@ -1150,7 +1150,7 @@ DENG2_PIMPL(ResourceSystem)
if(!mdl) continue;

// Load all skins.
foreach(ModelSkin const &skin, mdl->skins())
for(ModelSkin const &skin : mdl->skins())
{
if(Texture *tex = skin.texture)
{
Expand Down Expand Up @@ -1682,10 +1682,6 @@ DENG2_PIMPL(ResourceSystem)
for(int i = 0; i < mdl.skinCount(); ++i)
{
ModelSkin &skin = mdl.skin(i);

if(skin.name.isEmpty())
continue;

try
{
de::Uri foundResourceUri(Path(findSkinPath(skin.name, modelFilePath)));
Expand All @@ -1695,18 +1691,17 @@ DENG2_PIMPL(ResourceSystem)
// We have found one more skin for this model.
numFoundSkins += 1;
}
catch(FS1::NotFoundError const&)
catch(FS1::NotFoundError const &)
{
LOG_RES_WARNING("Failed to locate \"%s\" (#%i) for model \"%s\"")
<< skin.name << i << NativePath(modelFilePath).pretty();
<< skin.name << i << NativePath(modelFilePath).pretty();
}
}

if(!numFoundSkins)
{
// Lastly try a skin named similarly to the model in the same directory.
de::Uri searchPath(modelFilePath.fileNamePath() / modelFilePath.fileNameWithoutExtension(), RC_GRAPHIC);

try
{
String foundPath = fileSys().findPath(searchPath, RLF_DEFAULT,
Expand All @@ -1731,6 +1726,19 @@ DENG2_PIMPL(ResourceSystem)
LOG_RES_WARNING("Model \"%s\" will be rendered without a skin (none found)")
<< NativePath(modelFilePath).pretty();
}

#ifdef DENG2_DEBUG
LOGDEV_RES_XVERBOSE("Model \"%s\" skins:") << NativePath(modelFilePath).pretty();
int skinIdx = 0;
for(ModelSkin const &skin : mdl.skins())
{
TextureManifest const *texManifest = skin.texture? &skin.texture->manifest() : 0;
LOGDEV_RES_XVERBOSE(" %i: %s %s")
<< (skinIdx++) << skin.name
<< (texManifest? (String("\"") + texManifest->composeUri() + "\"") : "(missing texture)")
<< (texManifest? (String(" => \"") + NativePath(texManifest->resourceUri().compose()).pretty() + "\"") : "");
}
#endif
}

/**
Expand Down
19 changes: 7 additions & 12 deletions doomsday/liblegacy/src/smoother.cpp
Expand Up @@ -200,14 +200,9 @@ dd_bool Smoother_EvaluateComponent(Smoother const *sm, int component, coord_t *v

dd_bool Smoother_Evaluate(Smoother const *sm, coord_t *xyz)
{
const pos_t *past;
const pos_t *now;
float t;
int i;

DENG_ASSERT(sm);
past = &sm->past;
now = &sm->now;
DENG2_ASSERT(sm);
pos_t const *past = &sm->past;
pos_t const *now = &sm->now;

if(!Smoother_IsValid(sm))
return false;
Expand All @@ -218,7 +213,7 @@ dd_bool Smoother_Evaluate(Smoother const *sm, coord_t *xyz)
xyz[VX] = past->xyz[VX];
xyz[VY] = past->xyz[VY];
xyz[VZ] = past->xyz[VZ];
LOGDEV_XVERBOSE("Smoother %p falling behind") << sm;
//LOGDEV_XVERBOSE("Smoother %p falling behind") << sm;
return true;
}
//DENG_ASSERT(sm->at <= now->time);
Expand All @@ -228,13 +223,13 @@ dd_bool Smoother_Evaluate(Smoother const *sm, coord_t *xyz)
xyz[VX] = now->xyz[VX];
xyz[VY] = now->xyz[VY];
xyz[VZ] = now->xyz[VZ];
LOGDEV_XVERBOSE("Smoother %p stalling") << sm;
//LOGDEV_XVERBOSE("Smoother %p stalling") << sm;
return true;
}

// We're somewhere between past and now.
t = (sm->at - past->time) / (now->time - past->time);
for(i = 0; i < 3; ++i)
float const t = (sm->at - past->time) / (now->time - past->time);
for(int i = 0; i < 3; ++i)
{
// Linear interpolation.
xyz[i] = now->xyz[i] * t + past->xyz[i] * (1-t);
Expand Down
16 changes: 8 additions & 8 deletions doomsday/plugins/dehread/src/dehreader.cpp
Expand Up @@ -426,26 +426,26 @@ class DehReader
skipToNextLine();
parseStrings();
}
else if(line.beginsWith("[HELPER]", Qt::CaseInsensitive)) // BEX
else if(line.beginsWith("[HELPER]", Qt::CaseInsensitive)) // Eternity
{
// Not yet supported (Helper Dogs from MBF).
//skipToNextLine();
parseHelper();
skipToNextSection();
}
else if(line.beginsWith("[SPRITES]", Qt::CaseInsensitive)) // BEX
else if(line.beginsWith("[SPRITES]", Qt::CaseInsensitive)) // Eternity
{
// Not yet supported.
//skipToNextLine();
parseSprites();
skipToNextSection();
}
else if(line.beginsWith("[SOUNDS]", Qt::CaseInsensitive)) // BEX
else if(line.beginsWith("[SOUNDS]", Qt::CaseInsensitive)) // Eternity
{
skipToNextLine();
parseSounds();
}
else if(line.beginsWith("[MUSIC]", Qt::CaseInsensitive)) // BEX
else if(line.beginsWith("[MUSIC]", Qt::CaseInsensitive)) // Eternity
{
skipToNextLine();
parseMusic();
Expand Down Expand Up @@ -1473,19 +1473,19 @@ class DehReader
}
}

void parseHelper() // BEX
void parseHelper() // Eternity
{
LOG_AS("parseHelper");
LOG_WARNING("DeHackEd [HELPER] patches are not supported.");
}

void parseSprites() // BEX
void parseSprites() // Eternity
{
LOG_AS("parseSprites");
LOG_WARNING("DeHackEd [SPRITES] patches are not supported.");
}

void parseSounds() // BEX
void parseSounds() // Eternity
{
LOG_AS("parseSounds");
// BEX doesn't follow the same rules as .deh
Expand Down Expand Up @@ -1515,7 +1515,7 @@ class DehReader
}
}

void parseMusic() // BEX
void parseMusic() // Eternity
{
LOG_AS("parseMusic");
// BEX doesn't follow the same rules as .deh
Expand Down

0 comments on commit 423b991

Please sign in to comment.