Add in visual novel audio pitch and BGM change commands. Add in XP bonus when completing stages. Release Build 7706.

pull/35/head
sigonasr2 11 months ago
parent fa8dfd3c6f
commit 0c619aa4f6
  1. 1
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 2
      Adventures in Lestoria/LevelCompleteWindow.cpp
  3. 1
      Adventures in Lestoria/PauseMenu.cpp
  4. 1
      Adventures in Lestoria/Player.cpp
  5. 14
      Adventures in Lestoria/State_LevelComplete.cpp
  6. 2
      Adventures in Lestoria/TODO.txt
  7. 2
      Adventures in Lestoria/Version.h
  8. 28
      Adventures in Lestoria/VisualNovel.cpp
  9. 22
      Adventures in Lestoria/VisualNovel.h
  10. 18
      Adventures in Lestoria/assets/config/audio/bgm.txt
  11. 11
      Adventures in Lestoria/assets/config/story/Chapter 1.txt
  12. BIN
      x64/Release/Adventures in Lestoria.exe

@ -2019,6 +2019,7 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
ItemDrop::drops.clear();
GameEvent::events.clear();
Audio::SetBGMPitch(1.f);
Audio::SetAudioEvent("Default Volume");
game->view.SetZoom(1.f,game->view.WorldToScreen(game->camera.GetViewPosition()));
SetMosaicEffect(1U);
worldColor=WHITE;

@ -78,7 +78,7 @@ void Menu::InitializeLevelCompleteWindow(){
return true;
};
levelCompleteWindow->ADD("Level Details Outline",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,32},{71,72}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END;
levelCompleteWindow->ADD("Level Details Outline",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,32},{71,72}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE|ButtonAttr::FIT_TO_LABEL)END;
levelCompleteWindow->ADD("Level EXP Gain Outline",MenuLabel)(geom2d::rect<float>{{windowSize.size.x-72.f,104},{71,36}},"+ Exp",1,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
levelCompleteWindow->ADD("Next Button",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,144},{71,32}},"Proceed\nto Camp",nextButtonAction,ButtonAttr::FIT_TO_LABEL)END;

@ -69,6 +69,7 @@ void Menu::InitializePauseWindow(){
},ButtonAttr::FIT_TO_LABEL)END;
pauseWindow->ADD("Return to Camp Button",MenuComponent)(geom2d::rect<float>{{6.f,112.f},{84.f,24.f}},"Return to Camp",[](MenuFuncData data){
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Summary");
Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("");
GameState::ChangeState(States::LEVEL_COMPLETE,0.4f);
return true;
},ButtonAttr::FIT_TO_LABEL)END;

@ -983,6 +983,7 @@ void Player::CheckEndZoneCollision(){
endZoneStandTime+=game->GetElapsedTime();
if(endZoneStandTime>="Player.End Zone Wait Time"_F){
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Completed");
Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("Complete Bonus\n +10% XP");
if(Unlock::IsUnlocked("HUB")){
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->SetLabel("Proceed\nto Camp");
}else{

@ -57,11 +57,10 @@ void State_LevelComplete::OnStateChange(GameState*prevState){
Menu::CloseAllMenus();
}
levelUpTextPos={-100.f,-100.f};
Component<MenuLabel>(MenuType::LEVEL_COMPLETE,"Level EXP Gain Outline")->SetLabel(std::format("+{} Exp",game->GetPlayer()->GetAccumulatedXP()));
Component<ProgressBar>(MenuType::LEVEL_COMPLETE,"XP Bar")->ResetProgressBar(game->GetPlayer()->CurrentXP(),game->GetPlayer()->NextLevelXPRequired());
accumulatedXP=game->GetPlayer()->GetAccumulatedXP();
game->GetPlayer()->AddXP(game->GetPlayer()->GetAccumulatedXP());
float xpBonus=1.1f; //10% XP bonus for finishing a stage.
if(Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->GetLabel()!="Stage Summary"){ //If the label says stage summary, we didn't actually the level. Don't reward any stage items to the player.
for(const ItemMapData&data:game->GetCurrentMap().GetStageLoot()){
uint8_t amountDiff=data.maxAmt-data.minAmt;
@ -75,7 +74,16 @@ void State_LevelComplete::OnStateChange(GameState*prevState){
}
}
}
xpBonus=1.0f;
}
accumulatedXP*=xpBonus;
Component<MenuLabel>(MenuType::LEVEL_COMPLETE,"Level EXP Gain Outline")->SetLabel(std::format("+{} Exp",accumulatedXP));
game->GetPlayer()->AddXP(game->GetPlayer()->GetAccumulatedXP());
game->GetPlayer()->SetState(State::NORMAL);
Menu::OpenMenu(LEVEL_COMPLETE);
};

@ -2,8 +2,6 @@ February 28th -> Begin Internal Game Playtesting
March 6th -> Discord/Friend Playtesting
March 30th -> Public Demo Release
Add Bonus XP when completing a stage
- Hide mouse cursor during controller play. Reveal it again during mouse play.
- Auto aim causes retreat-type moves to aim away from the auto target, and prefer the direction the player's moving in.

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

@ -139,6 +139,14 @@ void VisualNovel::Initialize(){
if(line.find("{PAUSE")!=std::string::npos){//Pause command
if(arguments.size()!=0)ERR("Arguments size is "<<arguments.size()<<". Expecting no arguments.")
data.push_back(std::make_unique<PauseCommand>());
}else
if(line.find("{AUDIOPITCH")!=std::string::npos){//Pause command
if(arguments.size()!=1)ERR("Arguments size is "<<arguments.size()<<". Expecting only 1 argument.")
data.push_back(std::make_unique<AudioPitchCommand>(arguments[0]));
}else
if(line.find("{BGM")!=std::string::npos){//Pause command
if(arguments.size()!=1)ERR("Arguments size is "<<arguments.size()<<". Expecting only 1 argument.")
data.push_back(std::make_unique<BGMCommand>(arguments[0]));
}else{
ERR("Unknown command "<<line<<". Could not parse!");
}
@ -181,12 +189,14 @@ void VisualNovel::LoadVisualNovel(std::string storyLevelName){
for(std::unique_ptr<Command>&command:storyLevelData.at(storyLevelName)){
novel.commands.push_back(command.get());
}
Audio::PlayBGM("story");
GameState::ChangeState(States::STORY,0.5f,10U);
novel.ExecuteNextCommand();
novel.prevTheme=Menu::GetCurrentTheme().GetThemeName();
Menu::themeSelection="Purple";
}
void VisualNovel::Update(){
Audio::SetBGMPitch(audioPitch);
if(transitionTime==0&&game->KEY_CONFIRM.Pressed()){
activeText=U"";
novel.ExecuteNextCommand();
@ -383,4 +393,20 @@ CommandType::CommandType DialogCommand::GetType(){return CommandType::DIALOG;}
void PauseCommand::Execute(VisualNovel&vn){}
PauseCommand::PauseCommand(){}
CommandType::CommandType PauseCommand::GetType(){return CommandType::PAUSE;}
CommandType::CommandType PauseCommand::GetType(){return CommandType::PAUSE;}
void AudioPitchCommand::Execute(VisualNovel&vn){
vn.audioPitch=pitch;
vn.ExecuteNextCommand();
}
AudioPitchCommand::AudioPitchCommand(std::string pitch)
:pitch(std::stof(pitch)){}
CommandType::CommandType AudioPitchCommand::GetType(){return CommandType::AUDIOPITCH;}
void BGMCommand::Execute(VisualNovel&vn){
Audio::PlayBGM(songName);
vn.ExecuteNextCommand();
}
BGMCommand::BGMCommand(std::string songName)
:songName(songName){}
CommandType::CommandType BGMCommand::GetType(){return CommandType::BGM;}

@ -52,7 +52,9 @@ namespace CommandType{
BACKGROUND,
RIGHT,
LEFT,
LOCATION
LOCATION,
AUDIOPITCH,
BGM,
};
}
@ -122,6 +124,22 @@ public:
CommandType::CommandType GetType()final override;
};
class AudioPitchCommand final:public Command{
float pitch;
public:
void Execute(VisualNovel&vn)override;
AudioPitchCommand(std::string pitch);
CommandType::CommandType GetType()final override;
};
class BGMCommand final:public Command{
std::string songName;
public:
void Execute(VisualNovel&vn)override;
BGMCommand(std::string songName);
CommandType::CommandType GetType()final override;
};
class VisualNovel{
friend class State_Story;
friend class AiL;
@ -133,6 +151,7 @@ class VisualNovel{
friend class SpeakerCommand;
friend class DialogCommand;
friend class PauseCommand;
friend class AudioPitchCommand;
std::string storyLevel;
std::u32string speakerDisplayName=U"";
std::u32string actualSpeakerName=U"";
@ -153,6 +172,7 @@ class VisualNovel{
float backgroundScrollAmt=0;
float prevBackgroundScrollAmt=0;
static constexpr float maxTextScrollTime=1.0f;
float audioPitch=1.f;
public:
static Font font,narratorFont,locationFont;
private:

@ -111,4 +111,22 @@ BGM
Default Volume = 0%,70%,0%,0%,70%,70%,0%
}
}
story
{
Track Name = Foresty Story
channel[0]=foresty1_1_drums.ogg
channel[1]=foresty1_1_flute.ogg
channel[2]=foresty1_1_strings.ogg
channel[3]=foresty1_1_xtra perc.ogg
# Transition time between one phase to the next.
Fade Time = 2.0
Events
{
Default Volume = 20%,70%,70%,70%
}
}
}

@ -1,6 +1,9 @@
===STORY_1_1===
{LOCATION Bleakport Outskirts}
{BACKGROUND sea.png}
{BGM story}
{AUDIOPITCH 0.4}
[]
You are on your way from Bleakport to the Lestorian Forest, where slimes can be found.
@ -124,6 +127,7 @@ You keep an eye on Sherman as he recovers.
The next day you wake to find Sherman no longer lying down but is instead sitting on the grass.
{AUDIOPITCH 1.0}
{BACKGROUND commercial_assets/Forest Clearing Campsite_Day.png}
[Sherman]
@ -178,6 +182,7 @@ Guess I have to take that answer for now. I am on my way to the Forest then. Bye
===STORY_1_2===
{LOCATION Lestorian Forest}
{BACKGROUND sea.png}
{BGM story}
[?,Greg]
Did you defeat the Monsters?
@ -286,6 +291,8 @@ See you later.
===STORY_1_3===
{LOCATION Stone Wall}
{BACKGROUND sea.png}
{BGM story}
{AUDIOPITCH 0.4}
[]
You see a crack in the Stone Wall.
@ -329,6 +336,7 @@ Then...
{RIGHT}
*click*
{BACKGROUND cave_dark.png}
{AUDIOPITCH 0.05}
Darkness.
The Stone Cube is still glowing in your hand, but the glow is now very faint.
@ -345,6 +353,9 @@ Returning seems to be no problem, until...
Halfway back you suddenly feel a movement.
{BGM foresty_boss}
{AUDIOPITCH 1.0}
An #C72500Earthquake#FFFFFF!
It's not a strong one but presents a threat remaining inside a cavern.

Loading…
Cancel
Save