Added dynamic labels for gamepad controls input helper. Fixed wrapping bug for pressing right on monster loot scrollable container. Added XP gain sound effect. Release Build 7112.

pull/35/head
sigonasr2 10 months ago
parent 8afd66632a
commit bacd879e12
  1. 5
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 6
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  3. 17
      Adventures in Lestoria/InputHelper.cpp
  4. 5
      Adventures in Lestoria/InputHelper.h
  5. 67
      Adventures in Lestoria/LevelCompleteWindow.cpp
  6. 4
      Adventures in Lestoria/Menu.cpp
  7. 10
      Adventures in Lestoria/Menu.h
  8. 42
      Adventures in Lestoria/MenuDefinitions.cpp
  9. 59
      Adventures in Lestoria/MenuDefinitions.h
  10. 7
      Adventures in Lestoria/State_LevelComplete.cpp
  11. 1
      Adventures in Lestoria/State_LevelComplete.h
  12. 2
      Adventures in Lestoria/Version.h
  13. BIN
      Adventures in Lestoria/assets/sounds/xpgain.ogg
  14. BIN
      x64/Release/Adventures in Lestoria.exe

@ -379,6 +379,7 @@
<SubType> <SubType>
</SubType> </SubType>
</ClInclude> </ClInclude>
<ClInclude Include="MenuDefinitions.h" />
<ClInclude Include="MenuType.h"> <ClInclude Include="MenuType.h">
<SubType> <SubType>
</SubType> </SubType>
@ -635,6 +636,10 @@
<ClCompile Include="Menu.cpp" /> <ClCompile Include="Menu.cpp" />
<ClCompile Include="MenuAnimatedIconButton.h" /> <ClCompile Include="MenuAnimatedIconButton.h" />
<ClCompile Include="MenuComponent.cpp" /> <ClCompile Include="MenuComponent.cpp" />
<ClCompile Include="MenuDefinitions.cpp">
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="Merchant.cpp"> <ClCompile Include="Merchant.cpp">
<SubType> <SubType>
</SubType> </SubType>

@ -456,6 +456,9 @@
<ClInclude Include="ProgressBar.h"> <ClInclude Include="ProgressBar.h">
<Filter>Header Files\Interface</Filter> <Filter>Header Files\Interface</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="MenuDefinitions.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Player.cpp"> <ClCompile Include="Player.cpp">
@ -797,6 +800,9 @@
<ClCompile Include="PauseMenu.cpp"> <ClCompile Include="PauseMenu.cpp">
<Filter>Source Files\Interface</Filter> <Filter>Source Files\Interface</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="MenuDefinitions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="cpp.hint" /> <None Include="cpp.hint" />

@ -38,6 +38,7 @@ All rights reserved.
#include "InputHelper.h" #include "InputHelper.h"
#include "AdventuresInLestoria.h" #include "AdventuresInLestoria.h"
#include "Menu.h" #include "Menu.h"
#include "MenuComponent.h"
INCLUDE_game INCLUDE_game
INCLUDE_GFX INCLUDE_GFX
@ -70,8 +71,22 @@ void InputHelper::Draw(){
std::vector<std::variant<Decal*,std::string>>buttonImgs; //Store decals for buttons that actually have images, and strings for buttons that have labels. std::vector<std::variant<Decal*,std::string>>buttonImgs; //Store decals for buttons that actually have images, and strings for buttons that have labels.
std::vector<std::string>buttonDescriptions; std::vector<std::string>buttonDescriptions;
#pragma region Populate all buttons to display #pragma region Populate all buttons to display
for(auto&[group,displayName]:inputGroups){ for(auto&[group,display]:inputGroups){
auto&primaryKey=group.GetPrimaryKey(mode); auto&primaryKey=group.GetPrimaryKey(mode);
std::string displayName;
if(std::holds_alternative<std::string>(display))displayName=std::get<std::string>(display);
else
if(std::holds_alternative<std::function<std::string(MenuFuncData)>>(display)){
std::weak_ptr<ScrollableWindowComponent>parentComponent;
if(!Menu::stack.back()->GetSelection().expired()){
parentComponent=Menu::stack.back()->GetSelection().lock()->parentComponent;
}
displayName=std::get<std::function<std::string(MenuFuncData)>>(display)(MenuFuncData{*Menu::stack.back(),game,Menu::stack.back()->GetSelection(),parentComponent});
}
else ERR("WARNING! display contains a variant alternative that does not exist. THIS SHOULD NOT BE HAPPENING!");
if(displayName.length()>0&&primaryKey.has_value()){ if(displayName.length()>0&&primaryKey.has_value()){
if(primaryKey.value().HasIcon()){ if(primaryKey.value().HasIcon()){
buttonImgWidth+=primaryKey.value().GetIcon().Sprite()->width+"Interface.InputHelperSpacing"_I; buttonImgWidth+=primaryKey.value().GetIcon().Sprite()->width+"Interface.InputHelperSpacing"_I;

@ -41,10 +41,7 @@ All rights reserved.
#include <functional> #include <functional>
#include "Key.h" #include "Key.h"
#include "MenuType.h" #include "MenuType.h"
#include "MenuDefinitions.h"
using InputGroupActionDisplayName=std::string;
using ButtonName=std::string;
using MenuInputGroups=std::map<InputEngageGroup,std::pair<InputGroupActionDisplayName,std::variant<ButtonName,std::function<void(MenuType)>>>>;
class InputHelper{ class InputHelper{
std::map<InputGroup,InputGroupActionDisplayName>inputGroups; std::map<InputGroup,InputGroupActionDisplayName>inputGroups;

@ -43,6 +43,7 @@ All rights reserved.
#include "Unlock.h" #include "Unlock.h"
#include "State_OverworldMap.h" #include "State_OverworldMap.h"
#include "ProgressBar.h" #include "ProgressBar.h"
#include "SoundEffect.h"
INCLUDE_game INCLUDE_game
@ -97,22 +98,56 @@ void Menu::InitializeLevelCompleteWindow(){
} }
}, },
{ //Button Key { //Button Key
{{game->KEY_SHOULDER,Pressed},{"Scroll",[](MenuType type){}}}, {{game->KEY_SHOULDER,Pressed},{[](MenuFuncData data){
{{game->KEY_FASTSCROLLDOWN,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){ auto monsterLoot=Component<InventoryScrollableWindowComponent>(data.menu.GetType(),"Monster Loot Window");
auto selection=Menu::menus[type]->GetSelection(); auto stageLoot=Component<InventoryScrollableWindowComponent>(data.menu.GetType(),"Stage Loot Window");
if(!data.parentComponent.expired()){
if(data.parentComponent.lock()->GetName()=="Monster Loot Window"&&monsterLoot->GetComponents().size()>0){
return "Stage Loot";
}else
if(monsterLoot->GetComponents().size()>0){
return "Monster Loot";
}
}
return "";
},[](MenuType type){}}},
{{game->KEY_FASTSCROLLUP,Pressed},{"",[](MenuType type){
auto monsterLoot=Component<InventoryScrollableWindowComponent>(type,"Monster Loot Window");
auto stageLoot=Component<InventoryScrollableWindowComponent>(type,"Stage Loot Window");
auto selection=Menu::stack.back()->GetSelection();
if(!selection.expired()){ if(!selection.expired()){
auto parentComponent=DYNAMIC_POINTER_CAST<InventoryScrollableWindowComponent>(selection.lock()->parentComponent); auto parent=selection.lock()->parentComponent;
int invWidth=int((parentComponent->rect.size.x-12)/(float(parentComponent->options.size.x)+parentComponent->options.padding)); if(!parent.expired()){
parentComponent->IncreaseSelectionIndex(invWidth*3.f); if(parent.lock()->GetName()=="Monster Loot Window"&&stageLoot->GetComponents().size()>0){
Menu::stack.back()->SetSelection(stageLoot->GetComponents()[0]);
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED);
}else
if(monsterLoot->GetComponents().size()>0){
Menu::stack.back()->SetSelection(monsterLoot->GetComponents()[0]);
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED);
}
}
} }
return "";
}}}, }}},
{{game->KEY_FASTSCROLLUP,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){ {{game->KEY_FASTSCROLLDOWN,Pressed},{"",[](MenuType type){
auto selection=Menu::menus[type]->GetSelection(); auto monsterLoot=Component<InventoryScrollableWindowComponent>(type,"Monster Loot Window");
auto stageLoot=Component<InventoryScrollableWindowComponent>(type,"Stage Loot Window");
auto selection=Menu::stack.back()->GetSelection();
if(!selection.expired()){ if(!selection.expired()){
auto parentComponent=DYNAMIC_POINTER_CAST<InventoryScrollableWindowComponent>(selection.lock()->parentComponent); auto parent=selection.lock()->parentComponent;
int invWidth=int((parentComponent->rect.size.x-12)/(float(parentComponent->options.size.x)+parentComponent->options.padding)); if(!parent.expired()){
parentComponent->IncreaseSelectionIndex(invWidth*-3.f); if(parent.lock()->GetName()=="Monster Loot Window"&&stageLoot->GetComponents().size()>0){
Menu::stack.back()->SetSelection(stageLoot->GetComponents()[0]);
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED);
}else
if(monsterLoot->GetComponents().size()>0){
Menu::stack.back()->SetSelection(monsterLoot->GetComponents()[0]);
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED);
}
}
} }
return "";
}}}, }}},
{game->KEY_SCROLL,{"View Items",[](MenuType type){}}}, {game->KEY_SCROLL,{"View Items",[](MenuType type){}}},
{game->KEY_START,{"Continue",[](MenuType type){ {game->KEY_START,{"Continue",[](MenuType type){
@ -154,7 +189,7 @@ void Menu::InitializeLevelCompleteWindow(){
DetectInventory(InventoryScrollableWindowComponent,type,"Monster Loot Window") DetectInventory(InventoryScrollableWindowComponent,type,"Monster Loot Window")
{ //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory. { //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory.
//By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping. //By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping.
int colIndex=selectedButton.lock()->inventoryIndex; //Negative index, so we have to loop around. int colIndex=selectedButton.lock()->inventoryIndex%invWidth; //Negative index, so we have to loop around.
//Get the base row index of the new inventory. //Get the base row index of the new inventory.
auto stageLootWindow=Component<InventoryScrollableWindowComponent>(type,"Stage Loot Window"); auto stageLootWindow=Component<InventoryScrollableWindowComponent>(type,"Stage Loot Window");
if(stageLootWindow->GetComponents().size()>0){ if(stageLootWindow->GetComponents().size()>0){
@ -207,7 +242,7 @@ void Menu::InitializeLevelCompleteWindow(){
DetectInventory(InventoryScrollableWindowComponent,type,"Monster Loot Window") DetectInventory(InventoryScrollableWindowComponent,type,"Monster Loot Window")
{ //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory. { //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory.
//By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping. //By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping.
int colIndex=selectedButton.lock()->inventoryIndex; int colIndex=selectedButton.lock()->inventoryIndex%invWidth;
//Get the base row index of the new inventory. //Get the base row index of the new inventory.
auto stageLootWindow=Component<InventoryScrollableWindowComponent>(type,"Stage Loot Window"); auto stageLootWindow=Component<InventoryScrollableWindowComponent>(type,"Stage Loot Window");
if(stageLootWindow->GetComponents().size()>0){ if(stageLootWindow->GetComponents().size()>0){
@ -278,7 +313,7 @@ void Menu::InitializeLevelCompleteWindow(){
int rowBaseIndex=(selectedButton.lock()->inventoryIndex/invWidth)*invWidth; \ int rowBaseIndex=(selectedButton.lock()->inventoryIndex/invWidth)*invWidth; \
int newRowIndex=selectedButton.lock()->inventoryIndex+1; \ int newRowIndex=selectedButton.lock()->inventoryIndex+1; \
int newRowBaseIndex = (newRowIndex / invWidth) * invWidth; \ int newRowBaseIndex = (newRowIndex / invWidth) * invWidth; \
if(rowBaseIndex!=newRowBaseIndex) if(rowBaseIndex!=newRowBaseIndex||newRowIndex>=itemsList.size())
#define DefaultBehavior \ #define DefaultBehavior \
newRowIndex=std::clamp(newRowIndex,0,int(itemsList.size()-1)); \ newRowIndex=std::clamp(newRowIndex,0,int(itemsList.size()-1)); \
newRowIndex=std::min(int(itemsList.size())-1,newRowIndex); \ newRowIndex=std::min(int(itemsList.size())-1,newRowIndex); \
@ -338,7 +373,7 @@ void Menu::InitializeLevelCompleteWindow(){
DetectInventory(InventoryScrollableWindowComponent,type,"Stage Loot Window") DetectInventory(InventoryScrollableWindowComponent,type,"Stage Loot Window")
{ //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory. { //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory.
//By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping. //By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping.
int colIndex=selectedButton.lock()->inventoryIndex; int colIndex=selectedButton.lock()->inventoryIndex%invWidth;
//Get the base row index of the new inventory. //Get the base row index of the new inventory.
auto stageLootWindow=Component<InventoryScrollableWindowComponent>(type,"Monster Loot Window"); auto stageLootWindow=Component<InventoryScrollableWindowComponent>(type,"Monster Loot Window");
if(stageLootWindow->GetComponents().size()>0){ if(stageLootWindow->GetComponents().size()>0){
@ -391,7 +426,7 @@ void Menu::InitializeLevelCompleteWindow(){
DetectInventory(InventoryScrollableWindowComponent,type,"Stage Loot Window") DetectInventory(InventoryScrollableWindowComponent,type,"Stage Loot Window")
{ //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory. { //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory.
//By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping. //By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping.
int colIndex=selectedButton.lock()->inventoryIndex; int colIndex=selectedButton.lock()->inventoryIndex%invWidth;
//Get the base row index of the new inventory. //Get the base row index of the new inventory.
auto stageLootWindow=Component<InventoryScrollableWindowComponent>(type,"Monster Loot Window"); auto stageLootWindow=Component<InventoryScrollableWindowComponent>(type,"Monster Loot Window");
if(stageLootWindow->GetComponents().size()>0){ if(stageLootWindow->GetComponents().size()>0){

@ -656,10 +656,6 @@ void Menu::AddChapterListener(std::weak_ptr<MenuComponent>component){
chapterListeners.push_back(component); chapterListeners.push_back(component);
} }
MenuFuncData::MenuFuncData(Menu&menu,AiL*const game,std::weak_ptr<MenuComponent>component,std::weak_ptr<ScrollableWindowComponent>parentComponent)
:menu(menu),game(game),component(component),parentComponent(parentComponent){}
ToggleFuncData::ToggleFuncData(Menu&menu,AiL*const game,std::weak_ptr<MenuComponent>component,std::weak_ptr<ScrollableWindowComponent>parentComponent,bool checked) ToggleFuncData::ToggleFuncData(Menu&menu,AiL*const game,std::weak_ptr<MenuComponent>component,std::weak_ptr<ScrollableWindowComponent>parentComponent,bool checked)
:MenuFuncData(menu,game,component,parentComponent),checked(checked){} :MenuFuncData(menu,game,component,parentComponent),checked(checked){}

@ -43,6 +43,8 @@ All rights reserved.
#include "Attributable.h" #include "Attributable.h"
#include "olcUTIL_Geometry2D.h" #include "olcUTIL_Geometry2D.h"
#include "olcPGEX_ViewPort.h" #include "olcPGEX_ViewPort.h"
#include "MenuType.h"
#include "MenuDefinitions.h"
#include "InputHelper.h" #include "InputHelper.h"
class AiL; class AiL;
@ -53,14 +55,6 @@ struct Navigation;
class Menu; class Menu;
struct MenuFuncData{
Menu&menu;
AiL*const game;
const std::weak_ptr<MenuComponent> component;
const std::weak_ptr<ScrollableWindowComponent> parentComponent={};
MenuFuncData(Menu&menu,AiL*const game,std::weak_ptr<MenuComponent> component,std::weak_ptr<ScrollableWindowComponent>parentComponent={});
};
struct ToggleFuncData:public MenuFuncData{ struct ToggleFuncData:public MenuFuncData{
bool checked; bool checked;
ToggleFuncData(Menu&menu,AiL*const game,std::weak_ptr<MenuComponent>component,std::weak_ptr<ScrollableWindowComponent>parentComponent,bool checked); ToggleFuncData(Menu&menu,AiL*const game,std::weak_ptr<MenuComponent>component,std::weak_ptr<ScrollableWindowComponent>parentComponent,bool checked);

@ -0,0 +1,42 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2024 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "MenuDefinitions.h"
MenuFuncData::MenuFuncData(Menu&menu,AiL*const game,std::weak_ptr<MenuComponent>component,std::weak_ptr<ScrollableWindowComponent>parentComponent)
:menu(menu),game(game),component(component),parentComponent(parentComponent){}

@ -0,0 +1,59 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2024 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#pragma once
#include <memory>
#include <variant>
#include "Key.h"
#include "MenuType.h"
class Menu;
class AiL;
class MenuComponent;
class ScrollableWindowComponent;
struct MenuFuncData{
Menu&menu;
AiL*const game;
const std::weak_ptr<MenuComponent> component;
const std::weak_ptr<ScrollableWindowComponent> parentComponent={};
MenuFuncData(Menu&menu,AiL*const game,std::weak_ptr<MenuComponent> component,std::weak_ptr<ScrollableWindowComponent>parentComponent={});
};
using InputGroupActionDisplayName=std::variant<std::string,std::function<std::string(MenuFuncData)>>;
using ButtonName=std::string;
using MenuInputGroups=std::map<InputEngageGroup,std::pair<InputGroupActionDisplayName,std::variant<ButtonName,std::function<void(MenuType)>>>>;

@ -48,6 +48,10 @@ INCLUDE_MONSTER_LIST
INCLUDE_game INCLUDE_game
void State_LevelComplete::OnStateChange(GameState*prevState){ void State_LevelComplete::OnStateChange(GameState*prevState){
if(xpGainSound==std::numeric_limits<size_t>::max()){
xpGainSound=Audio::LoadAndPlay("xpgain.ogg"_SFX,true);
Audio::Engine().SetVolume(xpGainSound,0.f);
}
if(Menu::IsMenuOpen()){ if(Menu::IsMenuOpen()){
Menu::CloseAllMenus(); Menu::CloseAllMenus();
} }
@ -84,6 +88,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);
while(lastXPChangeTimer<=0.f){ while(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;
@ -97,6 +102,8 @@ void State_LevelComplete::OnUserUpdate(AiL*game){
} }
lastXPChangeTimer+="Interface.HUD XP Bar Tick Rate"_F; lastXPChangeTimer+="Interface.HUD XP Bar Tick Rate"_F;
} }
}else{
Audio::Engine().SetVolume(xpGainSound,0.f);
} }
}; };
void State_LevelComplete::Draw(AiL*game){ void State_LevelComplete::Draw(AiL*game){

@ -43,6 +43,7 @@ class State_LevelComplete:public GameState{
float lastXPChangeTimer=0.f; float lastXPChangeTimer=0.f;
vf2d levelUpTextPos={-100.f,-100.f}; vf2d levelUpTextPos={-100.f,-100.f};
float levelUpTimer=0.f; float levelUpTimer=0.f;
size_t xpGainSound=std::numeric_limits<size_t>::max();
virtual void OnStateChange(GameState*prevState)override final; virtual void OnStateChange(GameState*prevState)override final;
virtual void OnUserUpdate(AiL*game)override final; virtual void OnUserUpdate(AiL*game)override final;
virtual void Draw(AiL*game)override final; virtual void Draw(AiL*game)override final;

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 7095 #define VERSION_BUILD 7112
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Loading…
Cancel
Save