diff options
| author | Nicholas Estelami <NEstelami@users.noreply.github.com> | 2023-04-29 21:19:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-29 21:19:27 -0400 |
| commit | 546f01cbfe2f1d7ed7f3e69f967ad84c10e7b10b (patch) | |
| tree | 5c2f3fb0e79f5ac5ecc7e57815bf64fb2a0acad5 | |
| parent | 1c0178b0e5311188d24986c2667c72b0ae0d184f (diff) | |
Added setting for ZBackground screen width/height (#278)
| -rw-r--r-- | ZAPD/Declaration.h | 2 | ||||
| -rw-r--r-- | ZAPD/GameConfig.cpp | 1 | ||||
| -rw-r--r-- | ZAPD/GameConfig.h | 1 | ||||
| -rw-r--r-- | ZAPD/ZBackground.cpp | 9 |
4 files changed, 10 insertions, 3 deletions
diff --git a/ZAPD/Declaration.h b/ZAPD/Declaration.h index 4a743b5..c2fe410 100644 --- a/ZAPD/Declaration.h +++ b/ZAPD/Declaration.h @@ -42,7 +42,7 @@ public: bool isArray = false; bool forceArrayCnt = false; size_t arrayItemCnt = 0; - std::string arrayItemCntStr = ""; + std::string arrayItemCntStr = ""; // Can be used to put a specific string inside an array declaration's brackets std::vector<segptr_t> references; bool isUnaccounted = false; bool isPlaceholder = false; diff --git a/ZAPD/GameConfig.cpp b/ZAPD/GameConfig.cpp index 777cf9d..b27e816 100644 --- a/ZAPD/GameConfig.cpp +++ b/ZAPD/GameConfig.cpp @@ -124,6 +124,7 @@ void GameConfig::ConfigFunc_BGConfig(const tinyxml2::XMLElement& element) { bgScreenWidth = element.IntAttribute("ScreenWidth", 320); bgScreenHeight = element.IntAttribute("ScreenHeight", 240); + useScreenWidthHeightConstants = element.BoolAttribute("UseScreenWidthHeightConstants", true); } void GameConfig::ConfigFunc_ExternalXMLFolder(const tinyxml2::XMLElement& element) diff --git a/ZAPD/GameConfig.h b/ZAPD/GameConfig.h index 2a783d1..25b94cb 100644 --- a/ZAPD/GameConfig.h +++ b/ZAPD/GameConfig.h @@ -37,6 +37,7 @@ public: // ZBackground uint32_t bgScreenWidth = 320, bgScreenHeight = 240; + bool useScreenWidthHeightConstants = true; // If true, ZBackground's will be declared with SCREEN_WIDTH * SCREEN_HEIGHT in the C file // ExternalFile fs::path externalXmlFolder; diff --git a/ZAPD/ZBackground.cpp b/ZAPD/ZBackground.cpp index 0ed1eb7..fc72563 100644 --- a/ZAPD/ZBackground.cpp +++ b/ZAPD/ZBackground.cpp @@ -132,8 +132,13 @@ Declaration* ZBackground::DeclareVar(const std::string& prefix, Declaration* decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(), GetSourceTypeName(), auxName, 0); - decl->arrayItemCntStr = "SCREEN_WIDTH * SCREEN_HEIGHT / 4"; - decl->forceArrayCnt = true; + + if (Globals::Instance->cfg.useScreenWidthHeightConstants) + { + decl->arrayItemCntStr = "SCREEN_WIDTH * SCREEN_HEIGHT / 4"; + decl->forceArrayCnt = true; + } + decl->staticConf = staticConf; return decl; } |
