chore: Log missing texture when both TPC and TGA are not found

This commit is contained in:
Vsevolod Kremianskii 2021-01-08 15:36:21 +07:00
parent 67e090e62d
commit 516de927d1
3 changed files with 17 additions and 9 deletions

View file

@ -52,7 +52,10 @@ SaveLoad::SaveLoad(Game *game) :
_game(game) {
_resRef = getResRef("saveload");
_backgroundType = BackgroundType::Menu;
if (_version == GameVersion::KotOR) {
_backgroundType = BackgroundType::Menu;
}
initForGame();
}

View file

@ -143,13 +143,13 @@ void Control::loadBorder(const GffStruct &gffs) {
_border = make_shared<Border>();
if (!corner.empty()) {
if (!corner.empty() && corner != "0") {
_border->corner = Textures::instance().get(corner, TextureType::GUI);
}
if (!edge.empty()) {
if (!edge.empty() && edge != "0") {
_border->edge = Textures::instance().get(edge, TextureType::GUI);
}
if (!fill.empty()) {
if (!fill.empty() && fill != "0") {
_border->fill = Textures::instance().get(fill, TextureType::GUI);
}
@ -174,13 +174,13 @@ void Control::loadHilight(const GffStruct &gffs) {
_hilight = make_shared<Border>();
if (!corner.empty()) {
if (!corner.empty() && corner != "0") {
_hilight->corner = Textures::instance().get(corner, TextureType::GUI);
}
if (!edge.empty()) {
if (!edge.empty() && edge != "0") {
_hilight->edge = Textures::instance().get(edge, TextureType::GUI);
}
if (!fill.empty()) {
if (!fill.empty() && fill != "0") {
_hilight->fill = Textures::instance().get(fill, TextureType::GUI);
}

View file

@ -17,6 +17,7 @@
#include "textures.h"
#include "../common/log.h"
#include "../common/streamutil.h"
#include "../resource/resources.h"
@ -60,7 +61,7 @@ shared_ptr<Texture> Textures::doGet(const string &resRef, TextureType type) {
bool tryTpc = _version == GameVersion::TheSithLords || type != TextureType::Lightmap;
if (tryTpc) {
shared_ptr<ByteArray> tpcData(Resources::instance().get(resRef, ResourceType::Texture));
shared_ptr<ByteArray> tpcData(Resources::instance().get(resRef, ResourceType::Texture, false));
if (tpcData) {
TpcFile tpc(resRef, type);
tpc.load(wrap(tpcData));
@ -69,7 +70,7 @@ shared_ptr<Texture> Textures::doGet(const string &resRef, TextureType type) {
}
if (!texture) {
shared_ptr<ByteArray> tgaData(Resources::instance().get(resRef, ResourceType::Tga));
shared_ptr<ByteArray> tgaData(Resources::instance().get(resRef, ResourceType::Tga, false));
if (tgaData) {
TgaFile tga(resRef, type);
tga.load(wrap(tgaData));
@ -77,6 +78,10 @@ shared_ptr<Texture> Textures::doGet(const string &resRef, TextureType type) {
}
}
if (!texture) {
warn("Textures: not found: " + resRef);
}
return move(texture);
}