Fix lightbar settings, add failsafe retry loading for icons and action button handles when the icons fail to load for reasons. Fix sin wave breathing for lightbar on death screen, misplaced division operation. Release Build 8418.

This commit is contained in:
sigonasr2 2024-03-25 17:23:13 -05:00
parent 758696d28b
commit 6e03f99543
9 changed files with 24 additions and 9 deletions

View File

@ -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;

View File

@ -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;i<k_EInputActionOrigin_Count;i++){
const char*imageName{SteamInput()->GetGlyphPNGForActionOrigin(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));
}
}
}
}

View File

@ -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<DamageNumber>(GetPos(),damage,true,HEALTH_GAIN));
}
Input::SetLightbar(PixelLerp(GREEN,DARK_RED,GetHealth()/GetMaxHealth()));
Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealth()/GetMaxHealth()));
return true;
}

View File

@ -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){

View File

@ -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
============================================

View File

@ -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

View File

@ -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));

View File

@ -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));