Fix player starting with no items if they first load another file and then return to the main menu to begin another character. Fix player stats not being reset proper when loading another file and then returning to the main menu and beginning another character. Fix potential infinite XP bar gain loop. Added Return to Map option on level completion screen. Equip Stat labels now show live stats (changes on application of buffs, etc.). Release Build 7886. Patch version 0.4.4.

mac-build
sigonasr2 9 months ago
parent 9afff3a8e5
commit 20a76315cc
  1. 13
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 2
      Adventures in Lestoria/AdventuresInLestoria.h
  3. 51
      Adventures in Lestoria/CharacterMenuWindow.cpp
  4. 5
      Adventures in Lestoria/ClassSelectionWindow.cpp
  5. 8
      Adventures in Lestoria/EquipSlotButton.h
  6. 2
      Adventures in Lestoria/Item.cpp
  7. 20
      Adventures in Lestoria/LevelCompleteWindow.cpp
  8. 8
      Adventures in Lestoria/PauseMenu.cpp
  9. 4
      Adventures in Lestoria/Player.cpp
  10. 4
      Adventures in Lestoria/ProgressBar.h
  11. 16
      Adventures in Lestoria/StatLabel.h
  12. 4
      Adventures in Lestoria/State_Death.cpp
  13. 4
      Adventures in Lestoria/State_GameRun.cpp
  14. 6
      Adventures in Lestoria/State_LevelComplete.cpp
  15. 1
      Adventures in Lestoria/State_MainMenu.cpp
  16. 4
      Adventures in Lestoria/Version.h
  17. 2
      Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
  18. 2
      Adventures in Lestoria/assets/Campaigns/1_8.tmx
  19. BIN
      x64/Release/Adventures in Lestoria.exe

@ -281,9 +281,6 @@ bool AiL::OnUserCreate(){
Menu::InitializeMenus(); Menu::InitializeMenus();
Inventory::AddItem("Minor Health Potion"s,3);
Inventory::AddItem("Bandages"s,10);
ChangePlayerClass(WARRIOR); ChangePlayerClass(WARRIOR);
GameState::Initialize(); GameState::Initialize();
@ -928,7 +925,7 @@ void AiL::RenderWorld(float fElapsedTime){
view.DrawPartialRotatedDecal(pos+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)},player->GetFrame().GetSourceImage()->Decal(),player->GetSpinAngle(),{12,12},player->GetFrame().GetSourceRect().pos,player->GetFrame().GetSourceRect().size,playerScale*scale,attackBuffs.size()>0?Pixel{255,uint8_t(255*abs(sin(1.4*attackBuffs[0].duration))),uint8_t(255*abs(sin(1.4*attackBuffs[0].duration)))}:WHITE); view.DrawPartialRotatedDecal(pos+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)},player->GetFrame().GetSourceImage()->Decal(),player->GetSpinAngle(),{12,12},player->GetFrame().GetSourceRect().pos,player->GetFrame().GetSourceRect().size,playerScale*scale,attackBuffs.size()>0?Pixel{255,uint8_t(255*abs(sin(1.4*attackBuffs[0].duration))),uint8_t(255*abs(sin(1.4*attackBuffs[0].duration)))}:WHITE);
SetDecalMode(DecalMode::NORMAL); SetDecalMode(DecalMode::NORMAL);
if(player->GetState()==State::BLOCK){ if(player->GetState()==State::BLOCK){
view.DrawDecal(player->GetPos()-vf2d{12,12},GFX["block.png"].Decal()); view.DrawDecal(player->GetPos()+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)}-vf2d{12,12},GFX["block.png"].Decal());
} }
}; };
@ -3477,25 +3474,29 @@ void AiL::InitializePlayerLevelCap(){
std::cout<<"Level cap detected as "<<int(player->levelCap)<<std::endl; std::cout<<"Level cap detected as "<<int(player->levelCap)<<std::endl;
} }
void AiL::ResetGame(){ void AiL::ResetGame(bool changeToMainMenu){
if(changeToMainMenu){
GameState::ChangeState(States::MAIN_MENU,0.5f); GameState::ChangeState(States::MAIN_MENU,0.5f);
}
for(int i=int(EquipSlot::HELMET);i<=int(EquipSlot::RING2);i<<=1){ for(int i=int(EquipSlot::HELMET);i<=int(EquipSlot::RING2);i<<=1){
Inventory::UnequipItem(EquipSlot(i)); Inventory::UnequipItem(EquipSlot(i));
} }
for(auto&[cat,items]:ITEM_CATEGORIES){ for(auto&[cat,items]:ITEM_CATEGORIES){
Inventory::Clear(cat); Inventory::Clear(cat);
} }
game->SetRuntime(0.0);
player->level=1; player->level=1;
player->stats.Reset(); player->stats.Reset();
player->ResetAccumulatedXP(); player->ResetAccumulatedXP();
player->totalXPEarned=0; player->totalXPEarned=0;
player->SetMoney(100U); player->SetMoney(100U);
player->Initialize();
for(int i=0;i<GetLoadoutSize();i++){ for(int i=0;i<GetLoadoutSize();i++){
game->ClearLoadoutItem(i); game->ClearLoadoutItem(i);
} }
Unlock::unlocks.clear(); Unlock::unlocks.clear();
Unlock::Initialize(); Unlock::Initialize();
State_OverworldMap::SetStageMarker("Stage I-I"); State_OverworldMap::SetStageMarker("Story I");
State_OverworldMap::UpdateCurrentConnectionPoint(*State_OverworldMap::currentConnectionPoint); State_OverworldMap::UpdateCurrentConnectionPoint(*State_OverworldMap::currentConnectionPoint);
State_OverworldMap::ResetConnectionPoints(); State_OverworldMap::ResetConnectionPoints();
SetChapter(1); SetChapter(1);

@ -284,7 +284,7 @@ public:
void EndGame(); void EndGame();
void UpdateDiscordStatus(std::string levelName,std::string className); void UpdateDiscordStatus(std::string levelName,std::string className);
void InitializePlayerLevelCap(); void InitializePlayerLevelCap();
void ResetGame(); void ResetGame(bool changeToMainMenu=true);
void OnRequestCompleted(const std::string_view receivedData)const override; void OnRequestCompleted(const std::string_view receivedData)const override;
void DisableFadeIn(const bool disable); void DisableFadeIn(const bool disable);
//vi2d provides a tile in world coords. //vi2d provides a tile in world coords.

@ -68,14 +68,19 @@ void Menu::InitializeCharacterMenuWindow(){
characterMenuWindow->ADD("Level Class Display",MenuLabel)(geom2d::rect<float>{vf2d{126.f,windowSize.y-28},{118.f,8.f}},std::format("Lv{} {}",game->GetPlayer()->Level(),game->GetPlayer()->GetClassName()),1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END; characterMenuWindow->ADD("Level Class Display",MenuLabel)(geom2d::rect<float>{vf2d{126.f,windowSize.y-28},{118.f,8.f}},std::format("Lv{} {}",game->GetPlayer()->Level(),game->GetPlayer()->GetClassName()),1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
characterMenuWindow->ADD("XP Bar",ProgressBar)(geom2d::rect<float>{vf2d{126.f,10.f+windowSize.y-28},{118.f,8.f}},Pixel{247,183,82},BLACK,game->GetPlayer()->CurrentXP(),game->GetPlayer()->NextLevelXPRequired(),"xp")END; characterMenuWindow->ADD("XP Bar",ProgressBar)(geom2d::rect<float>{vf2d{126.f,10.f+windowSize.y-28},{118.f,8.f}},Pixel{247,183,82},BLACK,game->GetPlayer()->CurrentXP(),game->GetPlayer()->NextLevelXPRequired(),"xp")END;
const static std::array<std::string,7>displayAttrs{ struct AttributeData{
"Health", std::string attrName;
"Attack", const std::function<int()>calcFunc;
"Defense", };
"Move Spd %",
"CDR", const static std::array<AttributeData,7>displayAttrs{
"Crit Rate", AttributeData{"Health",[&]()->int{return game->GetPlayer()->GetHealth();}},
"Crit Dmg", AttributeData{"Attack",[&]()->int{return game->GetPlayer()->GetAttack();}},
AttributeData{"Defense",[&]()->int{return game->GetPlayer()->GetStat("Defense");}},
AttributeData{"Move Spd %",[&]()->int{return ceil(game->GetPlayer()->GetMoveSpdMult()*100);}},
AttributeData{"CDR",[&]()->int{return ceil(game->GetPlayer()->GetCooldownReductionPct()*100);}},
AttributeData{"Crit Rate",[&]()->int{return ceil(game->GetPlayer()->GetCritRatePct()*100);}},
AttributeData{"Crit Dmg",[&]()->int{return ceil(game->GetPlayer()->GetCritDmgPct()*100);}},
}; };
const static std::array<std::string,8>slotNames{"Helmet","Weapon","Armor","Gloves","Pants","Shoes","Ring 1","Ring 2"}; const static std::array<std::string,8>slotNames{"Helmet","Weapon","Armor","Gloves","Pants","Shoes","Ring 1","Ring 2"};
@ -93,8 +98,8 @@ void Menu::InitializeCharacterMenuWindow(){
Component<MenuComponent>(data.component.lock()->parentMenu,"Equip Selection Bottom Outline")->Disable(); Component<MenuComponent>(data.component.lock()->parentMenu,"Equip Selection Bottom Outline")->Disable();
Component<MenuComponent>(data.component.lock()->parentMenu,"Equip Selection Select Button")->Disable(); Component<MenuComponent>(data.component.lock()->parentMenu,"Equip Selection Select Button")->Disable();
Component<CharacterRotatingDisplay>(data.component.lock()->parentMenu,"Character Rotating Display")->Enable(); Component<CharacterRotatingDisplay>(data.component.lock()->parentMenu,"Character Rotating Display")->Enable();
for(int counter=0;const std::string&attribute:displayAttrs){ for(int counter=0;const AttributeData&attribute:displayAttrs){
std::weak_ptr<StatLabel>statDisplayLabel=Component<StatLabel>(CHARACTER_MENU,"Attribute "+std::string(ItemAttribute::Get(attribute).Name())+" Label"); std::weak_ptr<StatLabel>statDisplayLabel=Component<StatLabel>(CHARACTER_MENU,"Attribute "+std::string(ItemAttribute::Get(attribute.attrName).Name())+" Label");
statDisplayLabel.lock()->SetStatChangeAmt(0); statDisplayLabel.lock()->SetStatChangeAmt(0);
} }
data.menu.SetSelection(std::string_view(std::format("Equip Slot {}",slotNames[std::bit_width(unsigned(data.menu.I(A::EQUIP_TYPE)))-1]))); data.menu.SetSelection(std::string_view(std::format("Equip Slot {}",slotNames[std::bit_width(unsigned(data.menu.I(A::EQUIP_TYPE)))-1])));
@ -165,8 +170,8 @@ void Menu::InitializeCharacterMenuWindow(){
comp.lock()->SetSelected(false); comp.lock()->SetSelected(false);
} }
comp.lock()->SetSelected(true); comp.lock()->SetSelected(true);
for(int counter=0;const std::string&attribute:displayAttrs){ for(int counter=0;const AttributeData&attribute:displayAttrs){
std::shared_ptr<StatLabel>statDisplayLabel=Component<StatLabel>(CHARACTER_MENU,"Attribute "+std::string(ItemAttribute::Get(attribute).Name())+" Label"); std::shared_ptr<StatLabel>statDisplayLabel=Component<StatLabel>(CHARACTER_MENU,"Attribute "+std::string(ItemAttribute::Get(attribute.attrName).Name())+" Label");
statDisplayLabel->SetStatChangeAmt(0); statDisplayLabel->SetStatChangeAmt(0);
} }
std::shared_ptr<MenuItemItemButton>equipButton=Component<MenuItemItemButton>(CHARACTER_MENU,"Equip Slot "+slotNames[data.parentComponent.lock()->I(A::INDEXED_THEME)]); std::shared_ptr<MenuItemItemButton>equipButton=Component<MenuItemItemButton>(CHARACTER_MENU,"Equip Slot "+slotNames[data.parentComponent.lock()->I(A::INDEXED_THEME)]);
@ -185,8 +190,8 @@ void Menu::InitializeCharacterMenuWindow(){
const std::weak_ptr<Item>buttonItem=button.lock()->GetItem(); const std::weak_ptr<Item>buttonItem=button.lock()->GetItem();
std::vector<float>statsBeforeEquip; std::vector<float>statsBeforeEquip;
EquipSlot slot=EquipSlot(button.lock()->I(Attribute::EQUIP_TYPE)); EquipSlot slot=EquipSlot(button.lock()->I(Attribute::EQUIP_TYPE));
for(const std::string&attribute:displayAttrs){ for(const AttributeData&attribute:displayAttrs){
statsBeforeEquip.push_back(game->GetPlayer()->GetStat(attribute)); statsBeforeEquip.push_back(attribute.calcFunc());
} }
std::weak_ptr<Item>equippedItem=Inventory::GetEquip(slot); std::weak_ptr<Item>equippedItem=Inventory::GetEquip(slot);
@ -196,9 +201,9 @@ void Menu::InitializeCharacterMenuWindow(){
if(slot==EquipSlot::RING2)otherItem=Inventory::GetEquip(EquipSlot::RING1); if(slot==EquipSlot::RING2)otherItem=Inventory::GetEquip(EquipSlot::RING1);
if(OppositeRingSlotDoesNotMatchCurrentEquip(button.lock())){ //If we find that the opposite ring slot is equipped to us, this would be an item swap or the exact same ring, therefore no stat calculations apply. if(OppositeRingSlotDoesNotMatchCurrentEquip(button.lock())){ //If we find that the opposite ring slot is equipped to us, this would be an item swap or the exact same ring, therefore no stat calculations apply.
Inventory::EquipItem(buttonItem,slot); Inventory::EquipItem(buttonItem,slot);
for(int counter=0;const std::string&attribute:displayAttrs){ for(int counter=0;const AttributeData&attribute:displayAttrs){
std::weak_ptr<StatLabel>statDisplayLabel=Component<StatLabel>(CHARACTER_MENU,"Attribute "+std::string(ItemAttribute::Get(attribute).Name())+" Label"); std::weak_ptr<StatLabel>statDisplayLabel=Component<StatLabel>(CHARACTER_MENU,"Attribute "+std::string(ItemAttribute::Get(attribute.attrName).Name())+" Label");
int statChangeAmt=game->GetPlayer()->GetStat(attribute)-statsBeforeEquip[counter]; int statChangeAmt=attribute.calcFunc()-statsBeforeEquip[counter];
statDisplayLabel.lock()->SetStatChangeAmt(statChangeAmt); statDisplayLabel.lock()->SetStatChangeAmt(statChangeAmt);
counter++; counter++;
} }
@ -219,8 +224,8 @@ void Menu::InitializeCharacterMenuWindow(){
}); });
equip->SetMouseOutFunc( equip->SetMouseOutFunc(
[](MenuFuncData data){ [](MenuFuncData data){
for(int counter=0;const std::string&attribute:displayAttrs){ for(int counter=0;const AttributeData&attribute:displayAttrs){
std::weak_ptr<StatLabel>statDisplayLabel=Component<StatLabel>(CHARACTER_MENU,"Attribute "+std::string(ItemAttribute::Get(attribute).Name())+" Label"); std::weak_ptr<StatLabel>statDisplayLabel=Component<StatLabel>(CHARACTER_MENU,"Attribute "+std::string(ItemAttribute::Get(attribute.attrName).Name())+" Label");
statDisplayLabel.lock()->SetStatChangeAmt(0); statDisplayLabel.lock()->SetStatChangeAmt(0);
counter++; counter++;
} }
@ -298,10 +303,10 @@ void Menu::InitializeCharacterMenuWindow(){
characterMenuWindow->ADD("Stat Display Outline",MenuComponent)(geom2d::rect<float>{{245,28},{62,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END; characterMenuWindow->ADD("Stat Display Outline",MenuComponent)(geom2d::rect<float>{{245,28},{62,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END;
int yOffset=0; int yOffset=0;
for(const std::string&attribute:displayAttrs){ for(const AttributeData&attribute:displayAttrs){
std::string attrStr=GetLabelText(ItemAttribute::Get(attribute)); std::string attrStr=GetLabelText(ItemAttribute::Get(attribute.attrName));
auto attrLabel=characterMenuWindow->ADD("Attribute "+std::string(ItemAttribute::Get(attribute).Name())+" Label",StatLabel)(geom2d::rect<float>{{245,28+2+float(yOffset)},{62,18}},ItemAttribute::Get(attribute),1,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END; auto attrLabel=characterMenuWindow->ADD("Attribute "+std::string(ItemAttribute::Get(attribute.attrName).Name())+" Label",StatLabel)(geom2d::rect<float>{{245,28+2+float(yOffset)},{62,18}},ItemAttribute::Get(attribute.attrName),attribute.calcFunc,1,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;
Menu::AddEquipStatListener(attrLabel); //Menu::AddEquipStatListener(attrLabel);
yOffset+=20; yOffset+=20;
} }

@ -77,6 +77,11 @@ void Menu::InitializeClassSelectionWindow(){
classSelectionWindow->ADD("Confirm",MenuComponent)(geom2d::rect<float>{{outlineSize.x+4-navigationButtonSize.x-2,outlineSize.y+29-navigationButtonSize.y-14},navigationButtonSize},"Confirm",[](MenuFuncData data){ classSelectionWindow->ADD("Confirm",MenuComponent)(geom2d::rect<float>{{outlineSize.x+4-navigationButtonSize.x-2,outlineSize.y+29-navigationButtonSize.y-14},navigationButtonSize},"Confirm",[](MenuFuncData data){
std::string selectedClass=data.component.lock()->S(A::CLASS_SELECTION); std::string selectedClass=data.component.lock()->S(A::CLASS_SELECTION);
//Player starting items.
Inventory::AddItem("Minor Health Potion"s,3);
Inventory::AddItem("Bandages"s,10);
data.game->ChangePlayerClass(classutils::StringToClass(selectedClass)); data.game->ChangePlayerClass(classutils::StringToClass(selectedClass));
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
if(SaveFile::IsOnline()){ if(SaveFile::IsOnline()){

@ -62,4 +62,12 @@ public:
inline const EquipSlot GetSlot()const{ inline const EquipSlot GetSlot()const{
return slot; return slot;
} }
inline virtual void DrawDecal(ViewPort&window,bool focused)override final{
MenuItemItemButton::DrawDecal(window,focused);
if(!itemRef.expired()&&itemRef.lock()->EnhancementLevel()>0){
const std::string enhanceLevelStr="+"+std::to_string(itemRef.lock()->EnhancementLevel());
vi2d enhanceLevelStrSize=game->GetTextSize(enhanceLevelStr)*0.75f;
window.DrawShadowStringDecal(rect.pos+rect.size-enhanceLevelStrSize,enhanceLevelStr,GREEN,BLACK,vf2d{0.75f,0.75f});
}
}
}; };

@ -638,7 +638,7 @@ const std::string Item::DisplayName()const{
if(_IsBlank())return BLANK_ITEM_NAME; if(_IsBlank())return BLANK_ITEM_NAME;
std::string name=ActualName(); std::string name=ActualName();
if(IsEquippable()&&EnhancementLevel()>0){ if(IsEquippable()&&EnhancementLevel()>0){
name+=" [+"+std::to_string(EnhancementLevel())+"]"; name+=" [#00FF00+"+std::to_string(EnhancementLevel())+"#FFFFFF]";
} }
return name; return name;
} }

@ -67,20 +67,26 @@ void Menu::InitializeLevelCompleteWindow(){
auto stageLootWindow=levelCompleteWindow->ADD("Stage Loot Window",InventoryScrollableWindowComponent)(geom2d::rect<float>{{0,120},{windowSize.size.x-80.f,60}},"Stage Loot Popup Item Name","Stage Loot Popup Item Description",DO_NOTHING,InventoryCreator::Player_InventoryUpdate)END; auto stageLootWindow=levelCompleteWindow->ADD("Stage Loot Window",InventoryScrollableWindowComponent)(geom2d::rect<float>{{0,120},{windowSize.size.x-80.f,60}},"Stage Loot Popup Item Name","Stage Loot Popup Item Description",DO_NOTHING,InventoryCreator::Player_InventoryUpdate)END;
Menu::AddInventoryListener(stageLootWindow,"Stage Loot"); Menu::AddInventoryListener(stageLootWindow,"Stage Loot");
auto overworldMapAction=[](MenuFuncData data){
if(Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->GetLabel()!="Stage Summary"){ //If the label says stage summary, we didn't actually complete the level. Don't unlock anything new for the player.
Unlock::UnlockArea(State_OverworldMap::GetCurrentConnectionPoint().map);
Merchant::RandomizeTravelingMerchant();
}
GameState::ChangeState(States::OVERWORLD_MAP,0.25f);
return true;
};
auto nextButtonAction=[](MenuFuncData data){ auto nextButtonAction=[](MenuFuncData data){
Unlock::UnlockArea(State_OverworldMap::GetCurrentConnectionPoint().map); Unlock::UnlockArea(State_OverworldMap::GetCurrentConnectionPoint().map);
Merchant::RandomizeTravelingMerchant(); Merchant::RandomizeTravelingMerchant();
if(Unlock::IsUnlocked("STORY_1_1")){
GameState::ChangeState(States::GAME_HUB,0.25f); GameState::ChangeState(States::GAME_HUB,0.25f);
}else{
GameState::ChangeState(States::OVERWORLD_MAP,0.25f);
}
return true; return true;
}; };
levelCompleteWindow->ADD("Level Details Outline",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,32},{71,72}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE|ButtonAttr::FIT_TO_LABEL)END; levelCompleteWindow->ADD("Level Details Outline",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,32},{71,56}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE|ButtonAttr::FIT_TO_LABEL)END;
levelCompleteWindow->ADD("Level EXP Gain Outline",MenuLabel)(geom2d::rect<float>{{windowSize.size.x-72.f,104},{71,36}},"+ Exp",1,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; levelCompleteWindow->ADD("Level EXP Gain Outline",MenuLabel)(geom2d::rect<float>{{windowSize.size.x-72.f,88},{71,36}},"+ Exp",1,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
levelCompleteWindow->ADD("Next Button",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,144},{71,32}},"Proceed\nto Camp",nextButtonAction,ButtonAttr::FIT_TO_LABEL)END; levelCompleteWindow->ADD("Overworld Button",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,128},{71,24}},"Return\nto Map",overworldMapAction,ButtonAttr::FIT_TO_LABEL)END;
levelCompleteWindow->ADD("Next Button",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,156},{71,24}},"Proceed\nto Camp",nextButtonAction,ButtonAttr::FIT_TO_LABEL)END;
levelCompleteWindow->ADD("Monster Loot Popup Item Name",PopupMenuLabel)(geom2d::rect<float>{{0,108},{windowSize.size.x-80.f,12}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; levelCompleteWindow->ADD("Monster Loot Popup Item Name",PopupMenuLabel)(geom2d::rect<float>{{0,108},{windowSize.size.x-80.f,12}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
levelCompleteWindow->ADD("Monster Loot Popup Item Description",PopupMenuLabel)(geom2d::rect<float>{{0,120},{windowSize.size.x-80.f,60}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; levelCompleteWindow->ADD("Monster Loot Popup Item Description",PopupMenuLabel)(geom2d::rect<float>{{0,120},{windowSize.size.x-80.f,60}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;

@ -43,6 +43,7 @@ All rights reserved.
#include "AdventuresInLestoria.h" #include "AdventuresInLestoria.h"
#include "CharacterRotatingDisplay.h" #include "CharacterRotatingDisplay.h"
#include "ClassInfo.h" #include "ClassInfo.h"
#include "Unlock.h"
INCLUDE_game INCLUDE_game
INCLUDE_GFX INCLUDE_GFX
@ -69,9 +70,14 @@ void Menu::InitializePauseWindow(){
Menu::OpenMenu(SETTINGS); Menu::OpenMenu(SETTINGS);
return true; return true;
},ButtonAttr::FIT_TO_LABEL)END; },ButtonAttr::FIT_TO_LABEL)END;
pauseWindow->ADD("Return to Camp Button",MenuComponent)(geom2d::rect<float>{{6.f,112.f},{84.f,24.f}},"Return to Camp",[](MenuFuncData data){ pauseWindow->ADD("Return to Camp Button",MenuComponent)(geom2d::rect<float>{{6.f,112.f},{84.f,24.f}},"Leave Area",[](MenuFuncData data){
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Summary"); Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Summary");
Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel(""); Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("");
if(Unlock::IsUnlocked("STORY_1_1")){
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->Enable();
}else{
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->Disable();
}
GameState::ChangeState(States::LEVEL_COMPLETE,0.4f); GameState::ChangeState(States::LEVEL_COMPLETE,0.4f);
return true; return true;
},ButtonAttr::FIT_TO_LABEL)END; },ButtonAttr::FIT_TO_LABEL)END;

@ -1035,9 +1035,9 @@ void Player::CheckEndZoneCollision(){
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Completed"); Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Completed");
Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("Complete Bonus\n +10% XP"); Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("Complete Bonus\n +10% XP");
if(Unlock::IsUnlocked("STORY_1_1")){ if(Unlock::IsUnlocked("STORY_1_1")){
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->SetLabel("Proceed\nto Camp"); Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->Enable();
}else{ }else{
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->SetLabel("Proceed"); Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->Disable();
} }
GameState::ChangeState(States::LEVEL_COMPLETE); GameState::ChangeState(States::LEVEL_COMPLETE);
} }

@ -69,8 +69,8 @@ public:
this->subText=subText; this->subText=subText;
} }
inline virtual void DrawDecal(ViewPort&window,bool focused)override final{ inline virtual void DrawDecal(ViewPort&window,bool focused)override final{
float barPct=0.f;
float barPct=float(currentProgress)/float(finalProgress); if(finalProgress>0.01f)barPct=float(currentProgress)/float(finalProgress);
vf2d barSize=rect.size-vf2d{2.f,2.f}; vf2d barSize=rect.size-vf2d{2.f,2.f};
Pixel lighterCol=backCol; Pixel lighterCol=backCol;
lighterCol.r=std::min(255U,lighterCol.r+30U); lighterCol.r=std::min(255U,lighterCol.r+30U);

@ -45,16 +45,17 @@ INCLUDE_game
class StatLabel:public MenuLabel{ class StatLabel:public MenuLabel{
private: private:
const std::function<int()>statCalculation;
ItemAttribute stat; ItemAttribute stat;
int value=0; int value=0;
int statChangeAmt=0; int statChangeAmt=0;
public: public:
inline StatLabel(geom2d::rect<float>rect,ItemAttribute stat,int scale=1,ComponentAttr attributes=ComponentAttr::NONE) inline StatLabel(geom2d::rect<float>rect,ItemAttribute stat,const std::function<int()>statCalculation,int scale=1,ComponentAttr attributes=ComponentAttr::NONE)
:MenuLabel(rect,"",scale,attributes),stat(stat){ :MenuLabel(rect,"",scale,attributes),stat(stat),statCalculation(statCalculation){
border=attributes&ComponentAttr::OUTLINE; border=attributes&ComponentAttr::OUTLINE;
this->background=attributes&ComponentAttr::BACKGROUND; this->background=attributes&ComponentAttr::BACKGROUND;
showDefaultLabel=false; showDefaultLabel=false;
SetValue(game->GetPlayer()->GetStat(stat)); SetValue(statCalculation());
} }
void SetValue(int value){ void SetValue(int value){
this->value=value; this->value=value;
@ -68,9 +69,6 @@ protected:
inline void SetLabel(std::string text)override final{ inline void SetLabel(std::string text)override final{
MenuLabel::SetLabel(text); MenuLabel::SetLabel(text);
} }
inline void OnEquipStatsUpdate()override final{
SetValue(game->GetPlayer()->GetStat(stat));
}
inline void UpdateLabel(){ inline void UpdateLabel(){
std::string attrStr=std::string(stat.Name())+"\n "; std::string attrStr=std::string(stat.Name())+"\n ";
attrStr+=std::to_string(value); attrStr+=std::to_string(value);
@ -85,4 +83,10 @@ protected:
} }
SetLabel(attrStr); SetLabel(attrStr);
} }
inline virtual void Update(AiL*game)override final{
MenuLabel::Update(game);
SetValue(statCalculation());
UpdateLabel();
}
}; };

@ -64,9 +64,7 @@ void State_Death::OnStateChange(GameState*prevState){
accTime=0.f; accTime=0.f;
} }
void State_Death::OnLevelLoad(){ void State_Death::OnLevelLoad(){
Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut( Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut(false);
!Unlock::IsUnlocked("STORY_1_1")||game->GetCurrentMapName()=="HUB"
);
} }
void State_Death::OnUserUpdate(AiL*game){ void State_Death::OnUserUpdate(AiL*game){
accTime+=game->GetElapsedTime(); accTime+=game->GetElapsedTime();

@ -77,9 +77,7 @@ void State_GameRun::OnStateChange(GameState*prevState){
game->LoadLevel(State_OverworldMap::GetCurrentConnectionPoint().map); game->LoadLevel(State_OverworldMap::GetCurrentConnectionPoint().map);
} }
void State_GameRun::OnLevelLoad(){ void State_GameRun::OnLevelLoad(){
Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut( Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut(false);
!Unlock::IsUnlocked("STORY_1_1")||game->GetCurrentMapName()=="HUB"
);
if(!Tutorial::TaskIsComplete(TutorialTaskName::MOVE_AROUND)){ if(!Tutorial::TaskIsComplete(TutorialTaskName::MOVE_AROUND)){
Tutorial::SetNextTask(TutorialTaskName::MOVE_AROUND); Tutorial::SetNextTask(TutorialTaskName::MOVE_AROUND);
} }

@ -61,7 +61,7 @@ void State_LevelComplete::OnStateChange(GameState*prevState){
accumulatedXP=game->GetPlayer()->GetAccumulatedXP(); accumulatedXP=game->GetPlayer()->GetAccumulatedXP();
float xpBonus=1.1f; //10% XP bonus for finishing a stage. float xpBonus=1.1f; //10% XP bonus for finishing a stage.
if(Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->GetLabel()!="Stage Summary"){ //If the label says stage summary, we didn't actually the level. Don't reward any stage items to the player. if(Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->GetLabel()!="Stage Summary"){ //If the label says stage summary, we didn't actually complete the level. Don't reward any stage items to the player.
for(const ItemMapData&data:game->GetCurrentMap().GetStageLoot()){ for(const ItemMapData&data:game->GetCurrentMap().GetStageLoot()){
uint8_t amountDiff=data.maxAmt-data.minAmt; uint8_t amountDiff=data.maxAmt-data.minAmt;
uint8_t randomAmt=data.maxAmt; uint8_t randomAmt=data.maxAmt;
@ -102,7 +102,7 @@ void State_LevelComplete::OnUserUpdate(AiL*game){
if(accumulatedXP>0){ if(accumulatedXP>0){
lastXPChangeTimer-=game->GetElapsedTime(); lastXPChangeTimer-=game->GetElapsedTime();
Audio::Engine().SetVolume(xpGainSound,0.6f); Audio::Engine().SetVolume(xpGainSound,0.6f);
while(lastXPChangeTimer<=0.f){ if(lastXPChangeTimer<=0.f){
int incrementAmt=int(accumulatedXP/(1/"Interface.HUD XP Bar Tick Rate"_F))+1; int incrementAmt=int(accumulatedXP/(1/"Interface.HUD XP Bar Tick Rate"_F))+1;
accumulatedXP-=incrementAmt; accumulatedXP-=incrementAmt;
auto progressBar=Component<ProgressBar>(MenuType::LEVEL_COMPLETE,"XP Bar"); auto progressBar=Component<ProgressBar>(MenuType::LEVEL_COMPLETE,"XP Bar");
@ -113,7 +113,7 @@ void State_LevelComplete::OnUserUpdate(AiL*game){
progressBar->ResetProgressBar(progressBar->GetCurrentProgress()-progressBar->GetFinalProgress(),game->GetPlayer()->NextLevelXPRequired()); progressBar->ResetProgressBar(progressBar->GetCurrentProgress()-progressBar->GetFinalProgress(),game->GetPlayer()->NextLevelXPRequired());
SoundEffect::PlaySFX("Level Up",SoundEffect::CENTERED); SoundEffect::PlaySFX("Level Up",SoundEffect::CENTERED);
} }
lastXPChangeTimer+="Interface.HUD XP Bar Tick Rate"_F; lastXPChangeTimer="Interface.HUD XP Bar Tick Rate"_F;
} }
}else{ }else{
Audio::Engine().SetVolume(xpGainSound,0.f); Audio::Engine().SetVolume(xpGainSound,0.f);

@ -55,6 +55,7 @@ void State_MainMenu::OnLevelLoad(){
game->GetPlayer()->SetIframes(999999.f); game->GetPlayer()->SetIframes(999999.f);
game->GetPlayer()->SetInvisible(true); game->GetPlayer()->SetInvisible(true);
SelectAndMoveToNewFocusArea(); SelectAndMoveToNewFocusArea();
game->ResetGame(false);
} }
void State_MainMenu::OnUserUpdate(AiL*game){ void State_MainMenu::OnUserUpdate(AiL*game){
game->GetPlayer()->SetIframes(999999.f); game->GetPlayer()->SetIframes(999999.f);

@ -38,8 +38,8 @@ All rights reserved.
#pragma once #pragma once
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 4 #define VERSION_MINOR 4
#define VERSION_PATCH 3 #define VERSION_PATCH 4
#define VERSION_BUILD 7885 #define VERSION_BUILD 7886
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="205" height="205" tilewidth="24" tileheight="24" infinite="0" backgroundcolor="#475500" nextlayerid="10" nextobjectid="178"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="205" height="205" tilewidth="24" tileheight="24" infinite="0" backgroundcolor="#475500" nextlayerid="10" nextobjectid="179">
<properties> <properties>
<property name="Backdrop" propertytype="Backdrop" value="forest"/> <property name="Backdrop" propertytype="Backdrop" value="forest"/>
<property name="Background Music" propertytype="BGM" value="foresty1_1"/> <property name="Background Music" propertytype="BGM" value="foresty1_1"/>

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="250" height="127" tilewidth="24" tileheight="24" infinite="0" nextlayerid="6" nextobjectid="86"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="250" height="127" tilewidth="24" tileheight="24" infinite="0" nextlayerid="6" nextobjectid="87">
<properties> <properties>
<property name="Backdrop" propertytype="Backdrop" value="forest"/> <property name="Backdrop" propertytype="Backdrop" value="forest"/>
<property name="Background Music" propertytype="BGM" value="foresty1_1"/> <property name="Background Music" propertytype="BGM" value="foresty1_1"/>

Loading…
Cancel
Save