mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-02-02 16:23:57 +03:00
Added alt assets
This commit is contained in:
parent
6869fce01a
commit
d0fb09f25c
@ -45,6 +45,7 @@
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
extern "C" {
|
||||
bool prevAltAssets = false;
|
||||
float gInterpolationStep = 0.0f;
|
||||
#include <sf64thread.h>
|
||||
#include <macros.h>
|
||||
@ -172,6 +173,9 @@ GameEngine::GameEngine() {
|
||||
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinarySoundFontV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"SoundFont", static_cast<uint32_t>(SF64::ResourceType::SoundFont), 0);
|
||||
|
||||
prevAltAssets = CVarGetInteger("gEnhancements.Mods.AlternateAssets", 0);
|
||||
context->GetResourceManager()->SetAltAssetsEnabled(prevAltAssets);
|
||||
}
|
||||
|
||||
void GameEngine::Create() {
|
||||
@ -191,8 +195,6 @@ void GameEngine::Destroy() {
|
||||
free(MemoryPool.memory);
|
||||
}
|
||||
|
||||
bool ShouldClearTextureCacheAtEndOfFrame = false;
|
||||
|
||||
void GameEngine::StartFrame() const {
|
||||
using Ship::KbScancode;
|
||||
const int32_t dwScancode = this->context->GetWindow()->GetLastScancode();
|
||||
@ -201,8 +203,7 @@ void GameEngine::StartFrame() const {
|
||||
switch (dwScancode) {
|
||||
case KbScancode::LUS_KB_TAB: {
|
||||
// Toggle HD Assets
|
||||
CVarSetInteger("gAltAssets", !CVarGetInteger("gAltAssets", 0));
|
||||
ShouldClearTextureCacheAtEndOfFrame = true;
|
||||
CVarSetInteger("gEnhancements.Mods.AlternateAssets", !CVarGetInteger("gEnhancements.Mods.AlternateAssets", 0));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -326,9 +327,11 @@ void GameEngine::RunCommands(Gfx* Commands, const std::vector<std::unordered_map
|
||||
gfx_end_frame();
|
||||
}
|
||||
|
||||
if (ShouldClearTextureCacheAtEndOfFrame) {
|
||||
bool curAltAssets = CVarGetInteger("gEnhancements.Mods.AlternateAssets", 0);
|
||||
if (prevAltAssets != curAltAssets) {
|
||||
prevAltAssets = curAltAssets;
|
||||
Ship::Context::GetInstance()->GetResourceManager()->SetAltAssetsEnabled(curAltAssets);
|
||||
gfx_texture_cache_clear();
|
||||
ShouldClearTextureCacheAtEndOfFrame = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,6 +371,8 @@ void DrawSettingsMenu(){
|
||||
UIWidgets::Tooltip("Allows windows to be able to be dragged off of the main game window. Requires a reload to take effect.");
|
||||
}
|
||||
|
||||
UIWidgets::PaddedEnhancementCheckbox("Enable Alternative Assets", "gEnhancements.Mods.AlternateAssets");
|
||||
|
||||
// If more filters are added to LUS, make sure to add them to the filters list here
|
||||
ImGui::Text("Texture Filter (Needs reload)");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user