Sort all layers before splitting them into upper and lower in preparation for sorted rendering.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/35/head
sigonasr2, Sig, Sigo 9 months ago
parent 5035dd5af9
commit 3e180c26d2
  1. 12
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 3
      Adventures in Lestoria/Audio.cpp
  3. 14
      emscripten_build.sh

@ -788,6 +788,13 @@ void AiL::PopulateRenderLists(){
tileForegroundList.clear();
Player*pl=GetPlayer();
std::sort(MONSTER_LIST.begin(),MONSTER_LIST.end(),[](Monster&m1,Monster&m2){return m1->GetPos().y<m2->GetPos().y;});
std::sort(ItemDrop::drops.begin(),ItemDrop::drops.end(),[](ItemDrop&id1,ItemDrop&id2){return id1.GetPos().y<id2.GetPos().y;});
std::sort(BULLET_LIST.begin(),BULLET_LIST.end(),[](std::unique_ptr<Bullet>&b1,std::unique_ptr<Bullet>&b2){return b1->pos.y<b2->pos.y;});
std::sort(foregroundEffects.begin(),foregroundEffects.end(),[](std::unique_ptr<Effect>&e1,std::unique_ptr<Effect>&e2){return e1->pos.y<e2->pos.y;});
std::sort(backgroundEffects.begin(),backgroundEffects.end(),[](std::unique_ptr<Effect>&e1,std::unique_ptr<Effect>&e2){return e1->pos.y<e2->pos.y;});
for(auto it=MONSTER_LIST.begin();it!=MONSTER_LIST.end();++it){
Monster&m=*it;
if(m.GetPos().y<pl->GetPos().y){//This monster renders before the player does (behind the player)
@ -852,11 +859,6 @@ void AiL::PopulateRenderLists(){
endZones.push_back(zone);
}
}
std::sort(monstersBeforeUpper.begin(),monstersBeforeUpper.end(),[](Monster*m1,Monster*m2){return m1->GetPos().y<m2->GetPos().y;});
std::sort(monstersBeforeLower.begin(),monstersBeforeLower.end(),[](Monster*m1,Monster*m2){return m1->GetPos().y<m2->GetPos().y;});
std::sort(monstersAfterUpper.begin(),monstersAfterUpper.end(),[](Monster*m1,Monster*m2){return m1->GetPos().y<m2->GetPos().y;});
std::sort(monstersAfterLower.begin(),monstersAfterLower.end(),[](Monster*m1,Monster*m2){return m1->GetPos().y<m2->GetPos().y;});
}
void AiL::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2d tileSheetPos){

@ -132,6 +132,9 @@ void Audio::PlayBGM(const std::string_view sound,const bool loop){
void Audio::StopBGM(){
if(Self().BGMIsPlaying()){
BGM&currentTrack=Self().bgm[Self().currentBGM];
for(int trackID:currentTrack.GetChannelIDs()){
Engine().SetVolume(trackID,0.f);
}
for(int trackID:currentTrack.GetChannelIDs()){
Engine().Stop(trackID);
}

@ -1,4 +1,18 @@
clear
mkdir bin
mkdir bin/assets
cp -R "Adventures in Lestoria/assets/Campaigns" bin/assets
cp -R "Adventures in Lestoria/assets/config" bin/assets
cp -R "Adventures in Lestoria/assets/maps" bin/assets
rm -R bin/assets/maps/commercial_assets
cp -R "Adventures in Lestoria/assets/monsters" bin/assets
cp -R "Adventures in Lestoria/assets/music" bin/assets
cp -R "Adventures in Lestoria/assets/npcs" bin/assets
cp -R "Adventures in Lestoria/assets/sounds" bin/assets
cp -R "Adventures in Lestoria/assets/gamepack.pak" bin/assets
source ./emsdk/emsdk_env.sh
emcmake cmake -DCMAKE_BUILD_TYPE=Release .
cmake --build . -j 20
Loading…
Cancel
Save