Skip to content

Commit

Permalink
Expose interface screen size settings outside of compatibility mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammie committed Oct 6, 2024
1 parent 37cf3ff commit b6991b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/libs/core/src/core_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ void CoreImpl::ProcessEngineIniFile()
}

loadCompatibilitySettings(*engine_ini);
determineScreenSize(*engine_ini);

res = engine_ini->ReadString(nullptr, "run", String, sizeof(String), "");
if (res)
Expand All @@ -290,7 +291,7 @@ void CoreImpl::ProcessEngineIniFile()
throw std::runtime_error("fail to run program");

// Script version test
if (targetVersion_ >= storm::ENGINE_VERSION::LATEST)
if (targetVersion_ == storm::ENGINE_VERSION::TO_EACH_HIS_OWN)
{
int32_t iScriptVersion = 0xFFFFFFFF;
auto *pVScriptVersion = static_cast<VDATA *>(core_internal.GetScriptVariable("iScriptVersion"));
Expand Down Expand Up @@ -926,15 +927,7 @@ storm::ENGINE_VERSION CoreImpl::GetTargetEngineVersion() const noexcept

ScreenSize CoreImpl::GetScreenSize() const noexcept
{
switch (targetVersion_)
{
case storm::ENGINE_VERSION::PIRATES_OF_THE_CARIBBEAN: {
return {640, 480};
}
default: {
return {800, 600};
}
}
return screenSize_;
}

void CoreImpl::stopFrameProcessing()
Expand Down Expand Up @@ -1042,3 +1035,16 @@ void CoreImpl::loadCompatibilitySettings(INIFILE &inifile)
targetVersion_ = ENGINE_VERSION::LATEST;
}
}

void CoreImpl::determineScreenSize(INIFILE &inifile)
{
if (targetVersion_ <= storm::ENGINE_VERSION::PIRATES_OF_THE_CARIBBEAN) {
screenSize_ = {640, 480};
}
else {
screenSize_ = {800, 600};
}

screenSize_.width = inifile.GetInt("interface", "screen_width", screenSize_.width);
screenSize_.height = inifile.GetInt("interface", "screen_height", screenSize_.height);
}
2 changes: 2 additions & 0 deletions src/libs/core/src/core_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ class CoreImpl final : public CorePrivate

private:
void loadCompatibilitySettings(INIFILE &inifile);
void determineScreenSize(INIFILE &inifile);

EntityManager entity_manager_;

storm::ENGINE_VERSION targetVersion_ = storm::ENGINE_VERSION::LATEST;
ScreenSize screenSize_;

bool stopFrameProcessing_ = false;

Expand Down

0 comments on commit b6991b7

Please sign in to comment.