Tied level entry button to map loading and gameplay.

pull/28/head
sigonasr2 1 year ago
parent 2594078794
commit c6c5efbc74
  1. 1
      Crawler/Crawler.cpp
  2. 2
      Crawler/EncountersSpawnListScrollableWindowComponent.h
  3. 2
      Crawler/OverworldMapLevelWindow.cpp
  4. 7
      Crawler/State_OverworldMap.cpp
  5. 1
      Crawler/State_OverworldMap.h
  6. 2
      Crawler/Version.h
  7. 3873
      Crawler/assets/Campaigns/1_2.tmx

@ -399,7 +399,6 @@ void Crawler::UpdateCamera(float fElapsedTime){
}
worldShake=player->GetPos()+worldShakeVel;
}
worldShakeTime=std::max(0.f,worldShakeTime-fElapsedTime);
camera.Update(fElapsedTime);
view.SetWorldOffset(camera.GetViewPosition());
}

@ -1,4 +1,5 @@
#pragma once
#include "State_OverworldMap.h"
#include "Menu.h"
#include "SpawnEncounterLabel.h"
#include "Crawler.h"
@ -7,6 +8,7 @@
#include "Error.h"
INCLUDE_MONSTER_DATA
INCLUDE_LEVEL_NAMES
class EncountersSpawnListScrollableWindowComponent:public ScrollableWindowComponent{
protected:

@ -45,7 +45,7 @@ void Menu::InitializeOverworldMapLevelWindow(){
levelSelectWindow->AddComponent("Spawns List",spawns);
MenuComponent*changeLoadoutButton=NEW MenuComponent(OVERWORLD_LEVEL_SELECT,{{0,152},{windowSize.x-1,12}},"Change Loadout",INVENTORY,[](MenuFuncData data){return true;});
MenuComponent*enterButton=NEW MenuComponent(OVERWORLD_LEVEL_SELECT,{{0,166},{windowSize.x-1,16}},"Enter",[](MenuFuncData data){return true;});
MenuComponent*enterButton=NEW MenuComponent(OVERWORLD_LEVEL_SELECT,{{0,166},{windowSize.x-1,16}},"Enter",[](MenuFuncData data){State_OverworldMap::StartLevel();return true;});
levelSelectWindow->AddComponent("Change Loadout Button",changeLoadoutButton);
levelSelectWindow->AddComponent("Enter Button",enterButton);

@ -30,6 +30,7 @@ void State_OverworldMap::OnStateChange(GameState*prevState){
COMPONENT(MenuLabel,OVERWORLD_LEVEL_SELECT,"Chapter Label")->SetLabel("Chapter "+std::to_string(game->GetCurrentChapter()));
COMPONENT(MenuLabel,OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name);
COMPONENT(EncountersSpawnListScrollableWindowComponent,OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns);
COMPONENT(MenuComponent,OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists);
Menu::OpenMenu(OVERWORLD_LEVEL_SELECT,false);
};
void State_OverworldMap::OnUserUpdate(Crawler*game){
@ -67,6 +68,7 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){
}
COMPONENT(MenuLabel,OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name);
COMPONENT(EncountersSpawnListScrollableWindowComponent,OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns);
COMPONENT(MenuComponent,OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists);
break;
}
}
@ -133,4 +135,9 @@ ConnectionPoint&State_OverworldMap::ConnectionPointFromIndex(int ind){
ConnectionPoint&State_OverworldMap::GetCurrentConnectionPoint(){
return *((State_OverworldMap*)(GameState::states.at(States::OVERWORLD_MAP)))->currentConnectionPoint;
}
void State_OverworldMap::StartLevel(){
game->LoadLevel(LEVEL_NAMES.at(State_OverworldMap::GetCurrentConnectionPoint().map));
GameState::ChangeState(States::GAME_RUN);
}

@ -17,4 +17,5 @@ public:
virtual void OnStateChange(GameState*prevState)override;
virtual void OnUserUpdate(Crawler*game)override;
virtual void Draw(Crawler*game)override;
static void StartLevel();
};

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_BUILD 2783
#define VERSION_BUILD 2790
#define stringify(a) stringify_(a)
#define stringify_(a) #a

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save