Fixed vector expansion memory ref bug when loading configuration files. Add in Audio Engine class skeleton.

pull/28/head
sigonasr2 1 year ago
parent 1e3a2ecabb
commit 9d3be5395c
  1. 8
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 5
      Adventures in Lestoria/AdventuresInLestoria.cpp
  3. 3
      Adventures in Lestoria/AdventuresInLestoria.h
  4. 46
      Adventures in Lestoria/Audio.cpp
  5. 45
      Adventures in Lestoria/Audio.h
  6. 4
      Adventures in Lestoria/State_OverworldMap.cpp
  7. 2
      Adventures in Lestoria/Version.h
  8. 6
      Adventures in Lestoria/assets/config/configuration.txt
  9. BIN
      Adventures in Lestoria/assets/sounds/sfx100v2_loop_water_01.mp3
  10. BIN
      Adventures in Lestoria/assets/title_icon_32.png

@ -309,6 +309,10 @@
<SubType> <SubType>
</SubType> </SubType>
</ClInclude> </ClInclude>
<ClInclude Include="Audio.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="BitwiseEnum.h"> <ClInclude Include="BitwiseEnum.h">
<SubType> <SubType>
</SubType> </SubType>
@ -489,6 +493,10 @@
<SubType> <SubType>
</SubType> </SubType>
</ClCompile> </ClCompile>
<ClCompile Include="Audio.cpp">
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="BlacksmithCraftingWindow.cpp"> <ClCompile Include="BlacksmithCraftingWindow.cpp">
<SubType> <SubType>
</SubType> </SubType>

@ -112,7 +112,7 @@ AiL::AiL()
std::string GFX_CONFIG = CONFIG_PATH + "gfx_config"_S; std::string GFX_CONFIG = CONFIG_PATH + "gfx_config"_S;
utils::datafile::Read(DATA,GFX_CONFIG); utils::datafile::Read(DATA,GFX_CONFIG);
WINDOW_SIZE={"WINDOW_SIZE"_i[0],"WINDOW_SIZE"_i[1]}; WINDOW_SIZE={"WINDOW_SIZE"_i[0],"WINDOW_SIZE"_i[1]};
std::string MAP_CONFIG = CONFIG_PATH + "map_config"_S; std::string MAP_CONFIG = CONFIG_PATH + "map_config"_S;
utils::datafile::Read(DATA,MAP_CONFIG); utils::datafile::Read(DATA,MAP_CONFIG);
@ -144,7 +144,8 @@ AiL::AiL()
DEBUG_PATHFINDING="debug_pathfinding"_I; DEBUG_PATHFINDING="debug_pathfinding"_I;
for(const std::string&cl:DATA.GetProperty("class_list").GetValues()){ std::vector<std::string>values=DATA.GetProperty("class_list").GetValues();
for(const std::string&cl:values){
std::cout<<cl<<std::endl; std::cout<<cl<<std::endl;
utils::datafile::Read(DATA,CONFIG_PATH + "class_directory"_S + cl + ".txt"); utils::datafile::Read(DATA,CONFIG_PATH + "class_directory"_S + cl + ".txt");
} }

@ -53,6 +53,7 @@ All rights reserved.
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
#include "discord.h" #include "discord.h"
#endif #endif
#include "Audio.h"
class AiL : public olc::PixelGameEngine class AiL : public olc::PixelGameEngine
{ {
@ -60,6 +61,7 @@ class AiL : public olc::PixelGameEngine
friend class State_GameRun; friend class State_GameRun;
friend class SaveFile; friend class SaveFile;
friend class sig::Animation; friend class sig::Animation;
friend class Audio;
std::unique_ptr<Player>player; std::unique_ptr<Player>player;
public: public:
Pathfinding pathfinder; Pathfinding pathfinder;
@ -121,6 +123,7 @@ private:
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
::discord::Result SetupDiscord(); ::discord::Result SetupDiscord();
#endif #endif
Audio audioEngine;
public: public:
AiL(); AiL();
bool OnUserCreate() override; bool OnUserCreate() override;

@ -0,0 +1,46 @@
#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 © 2023 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Audio.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
INCLUDE_game
MiniAudio&Audio::Engine(){
return game->audioEngine.audioEngine;
}

@ -0,0 +1,45 @@
#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 © 2023 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#pragma once
#include "olcPGEX_MiniAudio.h"
class Audio{
MiniAudio audioEngine;
public:
static MiniAudio&Engine();
};

@ -105,6 +105,10 @@ void State_OverworldMap::OnUserUpdate(AiL*game){
Menu::OpenMenu(CRAFT_CONSUMABLE); Menu::OpenMenu(CRAFT_CONSUMABLE);
} }
if(game->GetKey(K1).bPressed){
Audio::Engine().Play("sfx_directory"_S+"sfx100v2_loop_water_01.mp3");
}
#pragma region Handle Connection Point Clicking and Movement #pragma region Handle Connection Point Clicking and Movement
for(ConnectionPoint&cp:connections){ for(ConnectionPoint&cp:connections){
if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)){ if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)){

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 5339 #define VERSION_BUILD 5350
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -59,6 +59,12 @@ item_img_directory = items/
# Path to story files # Path to story files
story_directory = config/story/ story_directory = config/story/
# Path to sound effect files
sfx_directory = assets/sounds/
# Path to bgm files
bgm_directory = assets/music/
# Path to character images # Path to character images
character_image_location = characters/ character_image_location = characters/

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Loading…
Cancel
Save