Map names now stored based on stage plate names provided. Made unlock conditions based on their actual unlock conditions and not the names of the plates.
This commit is contained in:
parent
008f6a28f6
commit
ce3be8b05d
@ -1246,6 +1246,7 @@ void Crawler::InitializeLevel(std::string mapFile,MapName map){
|
||||
|
||||
for(ConnectionPoint&cp:State_OverworldMap::connections){
|
||||
if(LEVEL_NAMES.count(cp.map)&&&MapHelper::MapFromString(cp.map)==&MAP_DATA[map]){
|
||||
MAP_DATA[map].name=cp.name;
|
||||
for(int spawn:MAP_DATA[map].spawns){
|
||||
cp.spawns.push_back(spawn);
|
||||
}
|
||||
|
@ -101,9 +101,9 @@
|
||||
"CAMPAIGN_1_6",
|
||||
"CAMPAIGN_1_7",
|
||||
"CAMPAIGN_1_8",
|
||||
"SHOP_1_1",
|
||||
"SHOP_1_2",
|
||||
"SHOP_1_3",
|
||||
"STORY_1_1",
|
||||
"STORY_1_2",
|
||||
"STORY_1_3",
|
||||
"BOSS_1",
|
||||
"BLACKSMITH"
|
||||
],
|
||||
|
@ -29,11 +29,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
#include "Crawler.h"
|
||||
#include "GameState.h"
|
||||
#include "State_GameRun.h"
|
||||
#include "State_OverworldMap.h"
|
||||
#include "State_MainMenu.h"
|
||||
|
||||
INCLUDE_game
|
||||
|
||||
#define NEW_STATE(state,class) GameState::states[state]=NEW class();
|
||||
|
||||
void GameState::Initialize(){
|
||||
@ -44,4 +47,14 @@ void GameState::Initialize(){
|
||||
GameState::ChangeState(States::OVERWORLD_MAP);
|
||||
}
|
||||
|
||||
void GameState::ChangeState(States::State newState){
|
||||
GameState*prevState=STATE;
|
||||
if(!states.count(newState)){
|
||||
ERR("WARNING! State not defined for state "<<newState<<"!")
|
||||
}
|
||||
STATE=states.at(newState);
|
||||
game->camera.SetTarget(game->GetPlayer()->GetPos());
|
||||
STATE->OnStateChange(prevState);
|
||||
}
|
||||
|
||||
GameState::~GameState(){}
|
@ -32,10 +32,9 @@ SUCH DAMAGE.
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include "Crawler.h"
|
||||
#include "Error.h"
|
||||
|
||||
INCLUDE_game
|
||||
class Crawler;
|
||||
|
||||
namespace States{
|
||||
enum State{
|
||||
@ -54,13 +53,5 @@ public:
|
||||
virtual void OnStateChange(GameState*prevState)=0;
|
||||
virtual void OnUserUpdate(Crawler*game)=0;
|
||||
virtual void Draw(Crawler*game)=0;
|
||||
static inline void ChangeState(States::State newState){
|
||||
GameState*prevState=STATE;
|
||||
if(!states.count(newState)){
|
||||
ERR("WARNING! State not defined for state "<<newState<<"!")
|
||||
}
|
||||
STATE=states.at(newState);
|
||||
game->camera.SetTarget(game->GetPlayer()->GetPos());
|
||||
STATE->OnStateChange(prevState);
|
||||
}
|
||||
static void ChangeState(States::State newState);
|
||||
};
|
@ -33,7 +33,7 @@ SUCH DAMAGE.
|
||||
#include "GameState.h"
|
||||
|
||||
class State_GameRun:public GameState{
|
||||
virtual void OnStateChange(GameState*prevState)override;
|
||||
virtual void OnUserUpdate(Crawler*game)override;
|
||||
virtual void Draw(Crawler*game)override;
|
||||
virtual void OnStateChange(GameState*prevState)override final;
|
||||
virtual void OnUserUpdate(Crawler*game)override final;
|
||||
virtual void Draw(Crawler*game)override final;
|
||||
};
|
@ -32,7 +32,7 @@ SUCH DAMAGE.
|
||||
#include "GameState.h"
|
||||
|
||||
class State_MainMenu:public GameState{
|
||||
virtual void OnStateChange(GameState*prevState)override;
|
||||
virtual void OnUserUpdate(Crawler*game)override;
|
||||
virtual void Draw(Crawler*game)override;
|
||||
virtual void OnStateChange(GameState*prevState)override final;
|
||||
virtual void OnUserUpdate(Crawler*game)override final;
|
||||
virtual void Draw(Crawler*game)override final;
|
||||
};
|
@ -45,8 +45,8 @@ public:
|
||||
static ConnectionPoint&GetCurrentConnectionPoint();
|
||||
void SetStageMarker(std::string connectionName);
|
||||
static ConnectionPoint&ConnectionPointFromIndex(int ind);
|
||||
virtual void OnStateChange(GameState*prevState)override;
|
||||
virtual void OnUserUpdate(Crawler*game)override;
|
||||
virtual void Draw(Crawler*game)override;
|
||||
virtual void OnStateChange(GameState*prevState)override final;
|
||||
virtual void OnUserUpdate(Crawler*game)override final;
|
||||
virtual void Draw(Crawler*game)override final;
|
||||
static void StartLevel();
|
||||
};
|
@ -78,6 +78,7 @@ struct SpawnerTag{
|
||||
|
||||
struct Map{
|
||||
MapTag MapData;
|
||||
std::string name;
|
||||
Renderable*optimizedTile=nullptr;
|
||||
std::vector<XMLTag> TilesetData;
|
||||
std::vector<LayerTag> LayerData;
|
||||
|
@ -34,10 +34,7 @@ SUCH DAMAGE.
|
||||
std::set<std::string>Unlock::unlocks;
|
||||
|
||||
void Unlock::Initialize(){
|
||||
UnlockArea("Stage I-I");
|
||||
UnlockArea("Shop I");
|
||||
UnlockArea("Blacksmith I");
|
||||
UnlockArea("Stage I-II");
|
||||
UnlockArea("WORLD_MAP");
|
||||
}
|
||||
|
||||
void Unlock::UnlockArea(std::string unlock){
|
||||
@ -48,5 +45,5 @@ bool Unlock::IsUnlocked(std::string unlock){
|
||||
}
|
||||
|
||||
bool Unlock::IsUnlocked(ConnectionPoint&cp){
|
||||
return unlocks.count(cp.name);
|
||||
return unlocks.count(cp.unlockCondition);
|
||||
}
|
@ -33,7 +33,7 @@ SUCH DAMAGE.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 2876
|
||||
#define VERSION_BUILD 2886
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -560,21 +560,21 @@
|
||||
<property name="Connection 1" type="object" value="4"/>
|
||||
<property name="Connection 2" type="object" value="5"/>
|
||||
<property name="Map" propertytype="Level" value="CAMPAIGN_1_1"/>
|
||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_1"/>
|
||||
<property name="Unlock Condition" propertytype="Level" value="WORLD_MAP"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="4" name="Stage I-II" type="StagePlate" x="248" y="552" width="44" height="16">
|
||||
<properties>
|
||||
<property name="Connection 1" type="object" value="7"/>
|
||||
<property name="Map" value="CAMPAIGN_1_2"/>
|
||||
<property name="Unlock Condition" value="CAMPAIGN_1_1"/>
|
||||
<property name="Map" propertytype="Level" value="CAMPAIGN_1_2"/>
|
||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_1"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="5" name="Shop I" type="StagePlate" x="344" y="476" width="20" height="24">
|
||||
<object id="5" name="Story I" type="StagePlate" x="344" y="476" width="20" height="24">
|
||||
<properties>
|
||||
<property name="Connection 1" type="object" value="8"/>
|
||||
<property name="Map" value="SHOP_1_1"/>
|
||||
<property name="Unlock Condition" value="CAMPAIGN_1_1"/>
|
||||
<property name="Map" propertytype="Level" value="STORY_1_1"/>
|
||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_1"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="6" name="Stage III" type="StagePlate" x="196" y="636" width="44" height="16">
|
||||
@ -586,17 +586,17 @@
|
||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_2"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="7" name="Shop II" type="StagePlate" x="236" y="592" width="20" height="24">
|
||||
<object id="7" name="Story II" type="StagePlate" x="236" y="592" width="20" height="24">
|
||||
<properties>
|
||||
<property name="Connection 1" type="object" value="6"/>
|
||||
<property name="Map" value="SHOP_1_2"/>
|
||||
<property name="Unlock Condition" value="CAMPAIGN_1_2"/>
|
||||
<property name="Map" propertytype="Level" value="STORY_1_2"/>
|
||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_2"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="8" name="Blacksmith I" type="StagePlate" x="416" y="416" width="20" height="24">
|
||||
<properties>
|
||||
<property name="Map" value="BLACKSMITH"/>
|
||||
<property name="Unlock Condition" value="CAMPAIGN_1_3"/>
|
||||
<property name="Map" propertytype="Level" value="BLACKSMITH"/>
|
||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_3"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="9" name="Stage IV" type="StagePlate" x="172" y="580" width="44" height="16">
|
||||
@ -610,7 +610,8 @@
|
||||
<object id="11" name="Boss I" type="StagePlate" x="156" y="644" width="32" height="24">
|
||||
<properties>
|
||||
<property name="Connection 1" type="object" value="0"/>
|
||||
<property name="Unlock Condition" type="object" value="0"/>
|
||||
<property name="Map" propertytype="Level" value="BOSS_1"/>
|
||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_8"/>
|
||||
</properties>
|
||||
</object>
|
||||
</objectgroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user