Linux fixes. Make sure audio doesn't require loading from filesystem (Use resource packs instead)

demo
sigonasr2 3 months ago
parent d9f84336f2
commit c15b45b975
  1. 10
      Adventures in Lestoria/AdventuresInLestoria.h
  2. 12
      Adventures in Lestoria/Audio.cpp
  3. 4
      Adventures in Lestoria/ItemEnchant.h
  4. 4
      Adventures in Lestoria/MonsterSoul.cpp
  5. 1
      debugGame.sh
  6. 2
      release.sh

@ -60,6 +60,12 @@ All rights reserved.
#include "Overlay.h" #include "Overlay.h"
#include <variant> #include <variant>
#undef KEY_MENU
#undef KEY_SELECT
#undef KEY_SCROLLDOWN
#undef KEY_SCROLLUP
#undef KEY_ENTER
class SteamKeyboardCallbackHandler; class SteamKeyboardCallbackHandler;
class SteamStatsReceivedHandler; class SteamStatsReceivedHandler;
@ -161,6 +167,7 @@ public:
double levelTime=0.; double levelTime=0.;
Camera2D camera; Camera2D camera;
std::map<MapName,Map>MAP_DATA; std::map<MapName,Map>MAP_DATA;
ResourcePack gamepack;
private: private:
std::vector<std::unique_ptr<Effect>>foregroundEffects,backgroundEffects,foregroundEffectsToBeInserted,backgroundEffectsToBeInserted; std::vector<std::unique_ptr<Effect>>foregroundEffects,backgroundEffects,foregroundEffectsToBeInserted,backgroundEffectsToBeInserted;
std::vector<TileRenderData*>tilesWithCollision,tilesWithoutCollision; std::vector<TileRenderData*>tilesWithCollision,tilesWithoutCollision;
@ -215,7 +222,6 @@ private:
float lastMouseMovement=0.f; //Amount of time since the last time the cursor was moved or interacted with. float lastMouseMovement=0.f; //Amount of time since the last time the cursor was moved or interacted with.
vi2d lastMousePos={}; vi2d lastMousePos={};
bool gameInitialized=false; bool gameInitialized=false;
ResourcePack gamepack;
uint8_t mosaicEffectTransition=1U; uint8_t mosaicEffectTransition=1U;
float saveGameDisplayTime=0.f; float saveGameDisplayTime=0.f;
float loadingWaitTime=0.f; float loadingWaitTime=0.f;
@ -423,4 +429,4 @@ public:
return layer<rhs.layer||(layer==rhs.layer&&tilePos<rhs.tilePos); return layer<rhs.layer||(layer==rhs.layer&&tilePos<rhs.tilePos);
} }
}; };
}; };

@ -70,10 +70,12 @@ void Audio::Initialize(){
while(data.HasProperty(std::format("channel[{}]",channelCounter))){ while(data.HasProperty(std::format("channel[{}]",channelCounter))){
std::string channelName=data[std::format("channel[{}]",channelCounter)].GetString(); std::string channelName=data[std::format("channel[{}]",channelCounter)].GetString();
if(!std::filesystem::exists("bgm_directory"_S+channelName))ERR(std::format("WARNING! Could not load file {} for track {}",channelName,songFileName)); if(!game->gamepack.Loaded()){
if(!game->gamepack.Loaded()&&"GENERATE_GAMEPACK"_B){ if(!std::filesystem::exists("bgm_directory"_S+channelName))ERR(std::format("WARNING! Could not load file {} for track {}",channelName,songFileName));
game->gamepack.AddFile("bgm_directory"_S+channelName); if("GENERATE_GAMEPACK"_B){
} game->gamepack.AddFile("bgm_directory"_S+channelName);
}
}
bgm.AddChannel(channelName); bgm.AddChannel(channelName);
channelCounter++; channelCounter++;
} }
@ -428,4 +430,4 @@ int Audio::GetPrepareBGMLoopIterations(std::string_view sound){
void Audio::BGM::SetLoopStartTime(const float loopStartTime){ void Audio::BGM::SetLoopStartTime(const float loopStartTime){
this->loopStartTime=loopStartTime; this->loopStartTime=loopStartTime;
} }

@ -115,11 +115,11 @@ public:
std::map<ItemAttribute,float>::const_iterator begin()const; std::map<ItemAttribute,float>::const_iterator begin()const;
std::map<ItemAttribute,float>::const_iterator end()const; std::map<ItemAttribute,float>::const_iterator end()const;
const Pixel&DisplayCol()const; const Pixel&DisplayCol()const;
const std::optional<std::reference_wrapper<Ability>>Ability()const; const std::optional<std::reference_wrapper<::Ability>>Ability()const;
private: private:
void UpdateDescription(); void UpdateDescription();
const ItemEnchantInfo&GetEnchantInfo()const; const ItemEnchantInfo&GetEnchantInfo()const;
std::string enchantName; std::string enchantName;
std::string description; std::string description;
ItemAttributable stats; ItemAttributable stats;
}; };

@ -38,7 +38,7 @@ All rights reserved.
#include "Effect.h" #include "Effect.h"
#include "util.h" #include "util.h"
#include "AdventuresinLestoria.h" #include "AdventuresInLestoria.h"
#include "SoundEffect.h" #include "SoundEffect.h"
INCLUDE_game INCLUDE_game
@ -89,4 +89,4 @@ void MonsterSoul::Draw(const Pixel blendCol)const{
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()},GFX["monstersoulglow.png"].Decal(),0.f,GFX["monstersoulglow.png"].Sprite()->Size()/2,size*util::lerp(0.6f,1.4f,abs(sin(2*PI*lifetime)))); game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()},GFX["monstersoulglow.png"].Decal(),0.f,GFX["monstersoulglow.png"].Sprite()->Size()/2,size*util::lerp(0.6f,1.4f,abs(sin(2*PI*lifetime))));
game->SetDecalMode(DecalMode::NORMAL); game->SetDecalMode(DecalMode::NORMAL);
Effect::Draw(blendCol); Effect::Draw(blendCol);
} }

@ -1,4 +1,5 @@
cd "Adventures in Lestoria" cd "Adventures in Lestoria"
mkdir "Adventures in Lestoria" mkdir "Adventures in Lestoria"
cp "discord_game_sdk.so" "Adventures in Lestoria" cp "discord_game_sdk.so" "Adventures in Lestoria"
cp "Adventures in Lestoria/"*.so "release/Adventures in Lestoria"
gdb ../bin/AdventuresInLestoria gdb ../bin/AdventuresInLestoria

@ -1,2 +1,2 @@
git update-index --assume-unchanged "Adventures in Lestoria/packkey.cpp" git update-index --assume-unchanged "Adventures in Lestoria/packkey.cpp"
cmake -DCMAKE_BUILD_TYPE=Release .;make -j 8 cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release .;make -j 8

Loading…
Cancel
Save