Fix crash with emscripten version during story scenes. Fix inproper Blacksmith equipment displays for crafting menu (chapter check missing, wrong enhancement level checks). Fix Blacksmith trigger not unlocking on the right node. Fix Chapter 2 trigger. Fix emscripten build scripts. Release Version 7848.

This commit is contained in:
sigonasr2 2024-02-29 05:54:23 -06:00
parent 93e5921e57
commit aa4d35d754
15 changed files with 241 additions and 194 deletions

View File

@ -140,7 +140,7 @@ std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)>
[](InventoryScrollableWindowComponent&component,ITCategory cat){ [](InventoryScrollableWindowComponent&component,ITCategory cat){
std::vector<std::weak_ptr<Item>>weapons; std::vector<std::weak_ptr<Item>>weapons;
std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(weapons),[](std::shared_ptr<Item>item){return item->IsWeapon();}); std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(weapons),[](std::shared_ptr<Item>item){return item->IsWeapon();});
std::copy_if(Inventory::blacksmithInventory.begin(),Inventory::blacksmithInventory.end(),std::back_inserter(weapons),[](std::shared_ptr<Item>item){return item->CanEnhanceItem()&&item->GetClass()==game->GetPlayer()->GetClassName()&&item->IsWeapon();}); std::copy_if(Inventory::blacksmithInventory.begin(),Inventory::blacksmithInventory.end(),std::back_inserter(weapons),[](std::shared_ptr<Item>item){return item->GetEnhancementInfo().size()>0&&game->GetCurrentChapter()>=item->GetEnhancementInfo()[0].chapterAvailable&&item->GetClass()==game->GetPlayer()->GetClassName()&&item->IsWeapon();});
std::sort(weapons.begin(),weapons.end(),[](const std::weak_ptr<Item>&it1,const std::weak_ptr<Item>&it2){ std::sort(weapons.begin(),weapons.end(),[](const std::weak_ptr<Item>&it1,const std::weak_ptr<Item>&it2){
return ItemSortRules::GetItemSortRanking(it1)<ItemSortRules::GetItemSortRanking(it2); return ItemSortRules::GetItemSortRanking(it1)<ItemSortRules::GetItemSortRanking(it2);
@ -181,7 +181,7 @@ std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)>
[](InventoryScrollableWindowComponent&component,ITCategory cat){ [](InventoryScrollableWindowComponent&component,ITCategory cat){
std::vector<std::weak_ptr<Item>>armor; std::vector<std::weak_ptr<Item>>armor;
std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(armor),[](std::shared_ptr<Item>item){return item->IsArmor();}); std::copy_if(Inventory::get("Equipment").begin(),Inventory::get("Equipment").end(),std::back_inserter(armor),[](std::shared_ptr<Item>item){return item->IsArmor();});
std::copy_if(Inventory::blacksmithInventory.begin(),Inventory::blacksmithInventory.end(),std::back_inserter(armor),[](std::shared_ptr<Item>item){return item->CanEnhanceItem()&&item->GetClass()==game->GetPlayer()->GetClassName()&&item->IsArmor();}); std::copy_if(Inventory::blacksmithInventory.begin(),Inventory::blacksmithInventory.end(),std::back_inserter(armor),[](std::shared_ptr<Item>item){return item->GetEnhancementInfo().size()>0&&game->GetCurrentChapter()>=item->GetEnhancementInfo()[0].chapterAvailable&&item->GetClass()==game->GetPlayer()->GetClassName()&&item->IsArmor();});
std::sort(armor.begin(),armor.end(),[](const std::weak_ptr<Item>&it1,const std::weak_ptr<Item>&it2){ std::sort(armor.begin(),armor.end(),[](const std::weak_ptr<Item>&it1,const std::weak_ptr<Item>&it2){
return ItemSortRules::GetItemSortRanking(it1)<ItemSortRules::GetItemSortRanking(it2); return ItemSortRules::GetItemSortRanking(it1)<ItemSortRules::GetItemSortRanking(it2);

View File

@ -149,9 +149,9 @@ protected:
} }
private: private:
inline void CalculateWrappedLabel(){ inline void CalculateWrappedLabel(){
lines.clear();
offsets.clear();
if(multiLineCentered){ if(multiLineCentered){
lines.clear();
offsets.clear();
wrappedLabel=util::WrapText(game,GetLabel(),rect.size.x,true,{1.f,1.f}); wrappedLabel=util::WrapText(game,GetLabel(),rect.size.x,true,{1.f,1.f});
int labelInd=0; int labelInd=0;
float largestWidth=0; float largestWidth=0;
@ -172,11 +172,11 @@ private:
float width=game->GetTextSizeProp(text).x; float width=game->GetTextSizeProp(text).x;
offsets.push_back(rect.size.x/2.f-width/2); offsets.push_back(rect.size.x/2.f-width/2);
} }
} //Recalculate label height based on line count.
//Recalculate label height based on line count. rect.size.y=lines.size()*10.f;
rect.size.y=lines.size()*10.f; if(!parentComponent.expired()){
if(!parentComponent.expired()){ parentComponent.lock()->CalculateBounds();
parentComponent.lock()->CalculateBounds(); }
} }
} }
}; };

View File

@ -38,7 +38,7 @@ All rights reserved.
#include "AdventuresInLestoria.h" #include "AdventuresInLestoria.h"
#include "DEFINES.h" #include "DEFINES.h"
#include "Menu.h" #include "Menu.h"
#include "EncountersSpawnListScrollableWindowComponent.h"a #include "EncountersSpawnListScrollableWindowComponent.h"
#include "MenuLabel.h" #include "MenuLabel.h"
#include "MenuComponent.h" #include "MenuComponent.h"
#include "State_OverworldMap.h" #include "State_OverworldMap.h"
@ -63,7 +63,7 @@ void Menu::InitializeOverworldMapLevelWindow(){
levelSelectWindow->ADD("Spawns List",EncountersSpawnListScrollableWindowComponent)(geom2d::rect<float>{{1,64},{windowSize.x-2,84}},ComponentAttr::BACKGROUND)END; levelSelectWindow->ADD("Spawns List",EncountersSpawnListScrollableWindowComponent)(geom2d::rect<float>{{1,64},{windowSize.x-2,84}},ComponentAttr::BACKGROUND)END;
levelSelectWindow->ADD("Enter Button",MenuComponent)(geom2d::rect<float>{{0,166},{windowSize.x-1,16}},"Enter",[](MenuFuncData data){ levelSelectWindow->ADD("Enter Button",MenuComponent)(geom2d::rect<float>{{0,166},{windowSize.x-1,16}},"Enter",[](MenuFuncData data){
if(State_OverworldMap::GetCurrentConnectionPoint().map=="HUB"&&Unlock::IsUnlocked("CAMPAIGN_1_3")&&!Tutorial::TaskIsComplete(TutorialTaskName::BLACKSMITH)){ if(State_OverworldMap::GetCurrentConnectionPoint().map=="HUB"&&Unlock::IsUnlocked("STORY_1_2")&&!Tutorial::TaskIsComplete(TutorialTaskName::BLACKSMITH)){
Tutorial::SetNextTask(TutorialTaskName::BLACKSMITH); Tutorial::SetNextTask(TutorialTaskName::BLACKSMITH);
} }

View File

@ -62,6 +62,11 @@ State_OverworldMap::State_OverworldMap(){
void State_OverworldMap::OnStateChange(GameState*prevState){ void State_OverworldMap::OnStateChange(GameState*prevState){
Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut(false); Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut(false);
SaveFile::SaveGame(); SaveFile::SaveGame();
if(Unlock::IsUnlocked("STORY_1_3")){
game->SetChapter(2);
}
game->LoadLevel("WORLD_MAP"); game->LoadLevel("WORLD_MAP");
}; };
void State_OverworldMap::OnLevelLoad(){ void State_OverworldMap::OnLevelLoad(){

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 4 #define VERSION_MINOR 4
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 7841 #define VERSION_BUILD 7848
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

View File

@ -275,12 +275,14 @@ void VisualNovel::Draw(){
vf2d dialogDisplaySize={game->GetScreenSize().x-48.f,20.f}; vf2d dialogDisplaySize={game->GetScreenSize().x-48.f,20.f};
Menu::DrawThemedWindow(dialogDisplayPos,dialogDisplaySize); Menu::DrawThemedWindow(dialogDisplayPos,dialogDisplaySize);
FontRect dialogTextSize=font.GetStringBounds(activeText); FontRect dialogTextSize=font.GetStringBounds(activeText);
FontRect speakerTextSize=font.GetStringBounds(displayedName); if(dialogTextSize.size.x>0&&dialogTextSize.size.y>0){
if(displayedName.length()>0){ if(displayedName.length()>0){
game->DrawShadowStringDecal(font,nameDisplayPos-vf2d{10,7}+(nameDisplayWindowSize+vf2d{24,0})/2-speakerTextSize.size/2+speakerTextSize.offset/2,displayedName); FontRect speakerTextSize=font.GetStringBounds(displayedName);
game->DrawShadowStringDecal(font,dialogDisplayPos-vf2d{10,6}+dialogTextSize.offset,activeText); game->DrawShadowStringDecal(font,nameDisplayPos-vf2d{10,7}+(nameDisplayWindowSize+vf2d{24,0})/2-speakerTextSize.size/2+speakerTextSize.offset/2,displayedName);
}else{ game->DrawShadowStringDecal(font,dialogDisplayPos-vf2d{10,6}+dialogTextSize.offset,activeText);
game->DrawDropShadowStringDecal(narratorFont,dialogDisplayPos-vf2d{10,6}+dialogTextSize.offset,activeText,{190,190,220}); }else{
game->DrawDropShadowStringDecal(narratorFont,dialogDisplayPos-vf2d{10,6}+dialogTextSize.offset,activeText,{190,190,220});
}
} }
float yOffset=util::lerp(dialogDisplaySize.y+12,-8,textScrollTime/maxTextScrollTime); float yOffset=util::lerp(dialogDisplaySize.y+12,-8,textScrollTime/maxTextScrollTime);
game->DrawPolygonDecal( game->DrawPolygonDecal(

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@ Equipment
{ {
# When this crafting recipe is available. # When this crafting recipe is available.
AvailableChapter = 1 AvailableChapter = 1
Item[0] = Wolf Skin,1 Item[0] = Logs,1
Gold = 5 Gold = 5
@ -161,7 +161,7 @@ Equipment
{ {
# When this crafting recipe is available. # When this crafting recipe is available.
AvailableChapter = 1 AvailableChapter = 1
Item[0] = Wolf Skin,1 Item[0] = Logs,1
Gold = 5 Gold = 5
@ -284,7 +284,7 @@ Equipment
{ {
# When this crafting recipe is available. # When this crafting recipe is available.
AvailableChapter = 1 AvailableChapter = 1
Item[0] = Wolf Skin,1 Item[0] = Logs,1
Gold = 5 Gold = 5

View File

@ -35,7 +35,7 @@ var Module = {
})(), })(),
}; };
</script> </script>
<script async type="text/javascript" src="_REPLACEME_"></script> <script async type="text/javascript" src="AdventuresInLestoria.js"></script>
<script type="text/javascript"> <script type="text/javascript">
Module.canvas.addEventListener("resize", (e) => { Module.canvas.addEventListener("resize", (e) => {

View File

@ -1,4 +1,4 @@
$ErrorActionPreference = "Stop"
cd .. cd ..
./emscripten_build.ps1 ./emscripten_build.ps1
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {

View File

@ -1,4 +1,4 @@
$ErrorActionPreference = "Stop"
cd .. cd ..
./emscripten_debug_build.ps1 ./emscripten_debug_build.ps1
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {

View File

@ -1,3 +1,5 @@
rm -R bin
mkdir bin mkdir bin
mkdir bin/assets mkdir bin/assets

View File

@ -1,3 +1,22 @@
clear clear
rm -R bin
mkdir bin
mkdir bin/assets
$ErrorActionPreference = "Stop"
cp -R 'Adventures in Lestoria/buildtemplate.html' bin/index.html
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
cp -R "Adventures in Lestoria/assets/backgrounds" bin/assets
rm -R bin/assets/backgrounds/commercial_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/themes" bin/assets
cp -R "Adventures in Lestoria/assets/gamepack.pak" bin/assets
cp -R "Adventures in Lestoria/assets/*.ttf" bin/assets
emcmake cmake -DCMAKE_BUILD_TYPE=Release . emcmake cmake -DCMAKE_BUILD_TYPE=Release .
cmake --build . -j 20 cmake --build . -j 20

View File

@ -1,3 +1,22 @@
clear clear
rm -R bin
mkdir bin
mkdir bin/assets
$ErrorActionPreference = "Stop"
cp -R 'Adventures in Lestoria/buildtemplate.html' bin/index.html
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
cp -R "Adventures in Lestoria/assets/backgrounds" bin/assets
rm -R bin/assets/backgrounds/commercial_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
cp -R "Adventures in Lestoria/assets/themes" bin/assets
cp -R "Adventures in Lestoria/assets/*.ttf" bin/assets
emcmake cmake -DCMAKE_BUILD_TYPE=Debug -D_DEBUG=1 . emcmake cmake -DCMAKE_BUILD_TYPE=Debug -D_DEBUG=1 .
cmake --build . -j 20 cmake --build . -j 20