diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 4c9fa5c5..31913010 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2084,6 +2084,8 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ Inventory::Clear("Stage Loot"); Inventory::ResetLoadoutItemsUsed(); + + Input::SetLightbar({255,0,255}); GetPlayer()->hp=GetPlayer()->GetMaxHealth(); GetPlayer()->mana=GetPlayer()->GetMaxMana(); GetPlayer()->SetState(State::NORMAL); @@ -2092,6 +2094,11 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ GetPlayer()->SetIframes(0.f); GetPlayer()->SetInvisible(false); GetPlayer()->ResetVelocity(); + + if(SteamInput()){ //This is kind of a hack to refresh the in-game controls handle and button icons if for some reason it's not setup correctly. + Input::LoadSteamButtonIcons(); + Input::ingameControlsHandle=SteamInput()->GetActionSetHandle("InGameControls"); + } ZONE_LIST=game->MAP_DATA[game->GetCurrentLevel()].ZoneData; return true; diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index 8d215d12..dd757123 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -174,14 +174,16 @@ void Input::Initialize(){ void Input::LoadSteamButtonIcons(){ GFX.Unlock(); - LOG(std::format("Steam Icons may be required... Loading in {} icons",int(k_EInputActionOrigin_Count))); for(int i=1;iGetGlyphPNGForActionOrigin(EInputActionOrigin(i),k_ESteamInputGlyphSize_Small,0U)}; if(imageName!=nullptr){ std::string loadImage{imageName}; - if(loadImage.length()>0&&!GFX.count(loadImage)){ + if(loadImage.length()>0&&(!GFX.count(loadImage)||GFX.at(loadImage).Decal()==nullptr)){ LOG(std::format("Loading steam image {}",loadImage)); - GFX[loadImage].Load(loadImage); + if(!GFX.count(loadImage))GFX[loadImage]; + if(GFX.at(loadImage).Load(loadImage)!=rcode::OK){ + LOG(std::format("WARNING! Failed to load steam image {}!",loadImage)); + } } } } diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index b8113924..dda05af3 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -748,7 +748,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){ hurtRumbleTime="Player.Hurt Rumble Time"_F; Input::StartVibration(); - Input::SetLightbar(PixelLerp(GREEN,DARK_RED,GetHealth()/GetMaxHealth())); + Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealth()/GetMaxHealth())); if(lastHitTimer>0){ damageNumberPtr.get()->damage+=int(mod_dmg); @@ -1017,7 +1017,7 @@ bool Player::Heal(int damage,bool suppressDamageNumber){ if(!suppressDamageNumber&&damage>0){ DAMAGENUMBER_LIST.push_back(std::make_shared(GetPos(),damage,true,HEALTH_GAIN)); } - Input::SetLightbar(PixelLerp(GREEN,DARK_RED,GetHealth()/GetMaxHealth())); + Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealth()/GetMaxHealth())); return true; } diff --git a/Adventures in Lestoria/State_Death.cpp b/Adventures in Lestoria/State_Death.cpp index 0d7dfbf7..1c5d2010 100644 --- a/Adventures in Lestoria/State_Death.cpp +++ b/Adventures in Lestoria/State_Death.cpp @@ -83,7 +83,7 @@ void State_Death::OnUserUpdate(AiL*game){ Menu::OpenMenu(MenuType::DEATH); } game->SetMosaicEffect(uint8_t(util::lerp(9.f,1.f,(gameSlowdownPct-7)/3.f))); - Input::SetLightbar(PixelLerp(BLACK,DARK_RED,sin((1.5*game->GetRuntime())/2.f)+0.5f)); + Input::SetLightbar(PixelLerp(BLACK,DARK_RED,sin(1.5f*game->GetRuntime())/2.f+0.5f)); } if(gameSlowdownPct<10.f){ diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 37f0b66a..1d9cda44 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -14,10 +14,8 @@ Equip Gear using Start menu tutorial Steam Controller SDK Steam Rich Presence Add in vsync system option -Remove Unlock All Button Sword attack should linger -Add game file debug logging ============================================ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index f08b01d3..f73ecec1 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 0 #define VERSION_PATCH 0 -#define VERSION_BUILD 8413 +#define VERSION_BUILD 8418 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/olcPGEX_ViewPort.h b/Adventures in Lestoria/olcPGEX_ViewPort.h index 09387635..40c4c303 100644 --- a/Adventures in Lestoria/olcPGEX_ViewPort.h +++ b/Adventures in Lestoria/olcPGEX_ViewPort.h @@ -636,6 +636,7 @@ void olc::ViewPort::DrawStringDecal(const olc::vf2d& pos, std::string_view sText } if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=sText){ //If the text key already exists, don't have to recreate the decal, just update the expire time. vi2d imageSize=pge->GetWrappedTextSize(sText,width,scale); + if(imageSize.x<1||imageSize.y<1)return; Decal*newDecal=nullptr; if(!pge->garbageCollector.count(key)){ newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.y/scale.x)); @@ -678,6 +679,7 @@ void olc::ViewPort::DrawStringPropDecal(const olc::vf2d& pos, std::string_view s } if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=sText){ //If the text key already exists, don't have to recreate the decal, just update the expire time. vi2d imageSize=pge->GetWrappedTextSizeProp(sText,width,scale); + if(imageSize.x<1||imageSize.y<1)return; Decal*newDecal=nullptr; if(!pge->garbageCollector.count(key)){ newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.y/scale.x)); @@ -705,6 +707,7 @@ void olc::ViewPort::DrawShadowStringDecal(const olc::vf2d& pos, std::string_view } if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=sText){ //If the text key already exists, don't have to recreate the decal, just update the expire time. vi2d imageSize=pge->GetWrappedTextSize(sText,width,scale); + if(imageSize.x<1||imageSize.y<1)return; Decal*newDecal=nullptr; if(!pge->garbageCollector.count(key)){ newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.x/scale.x)); @@ -752,6 +755,7 @@ void olc::ViewPort::DrawShadowStringPropDecal(const olc::vf2d& pos, std::string_ } if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=sText){ //If the text key already exists, don't have to recreate the decal, just update the expire time. vi2d imageSize=pge->GetWrappedTextSizeProp(sText,width,scale); + if(imageSize.x<1||imageSize.y<1)return; Decal*newDecal=nullptr; if(!pge->garbageCollector.count(key)){ newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.x/scale.x)); diff --git a/Adventures in Lestoria/olcPixelGameEngine.h b/Adventures in Lestoria/olcPixelGameEngine.h index 91d6ddf5..7b84d975 100644 --- a/Adventures in Lestoria/olcPixelGameEngine.h +++ b/Adventures in Lestoria/olcPixelGameEngine.h @@ -3581,6 +3581,7 @@ namespace olc } if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=sText){ //If the text key already exists, don't have to recreate the decal, just update the expire time. vi2d imageSize=GetWrappedTextSize(sText,width,scale); + if(imageSize.x<1||imageSize.y<1)return; Decal*newDecal=nullptr; if(!garbageCollector.count(key)){ newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.y/scale.x)); @@ -3609,6 +3610,7 @@ namespace olc } if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=sText){ //If the text key already exists, don't have to recreate the decal, just update the expire time. vi2d imageSize=GetWrappedTextSizeProp(sText,width,scale); + if(imageSize.x<1||imageSize.y<1)return; Decal*newDecal=nullptr; if(!garbageCollector.count(key)){ newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.y/scale.x)); @@ -3636,6 +3638,7 @@ namespace olc } if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=sText){ //If the text key already exists, don't have to recreate the decal, just update the expire time. vi2d imageSize=GetWrappedTextSize(sText,width,scale); + if(imageSize.x<1||imageSize.y<1)return; Decal*newDecal=nullptr; if(!garbageCollector.count(key)){ newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.x/scale.x)); @@ -3738,6 +3741,7 @@ namespace olc } if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=sText){ //If the text key already exists, don't have to recreate the decal, just update the expire time. vi2d imageSize=GetWrappedTextSizeProp(sText,width,scale); + if(imageSize.x<1||imageSize.y<1)return; Decal*newDecal=nullptr; if(!garbageCollector.count(key)){ newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.x/scale.x)); diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index e3e0dbd7..c464239b 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ