Update Stage Plates to include the level type. Created Overworld Menu, and Initialized Character Menu. Story and shops no longer have the change loadout buttons.
This commit is contained in:
parent
25b6dc0299
commit
4463fbbae5
46
Crawler/CharacterMenuWindow.cpp
Normal file
46
Crawler/CharacterMenuWindow.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#pragma region License
|
||||||
|
/*
|
||||||
|
License (OLC-3)
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Copyright 2018 - 2023 OneLoneCoder.com
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions or derivations of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions or derivative works in binary form must reproduce the above
|
||||||
|
copyright notice. This list of conditions and the following disclaimer must be
|
||||||
|
reproduced in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors may
|
||||||
|
be used to endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
|
||||||
|
Portions of this software are copyright © 2023 The FreeType
|
||||||
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
#pragma endregion
|
||||||
|
#include "Menu.h"
|
||||||
|
#include "MenuComponent.h"
|
||||||
|
#include "Crawler.h"
|
||||||
|
|
||||||
|
INCLUDE_game
|
||||||
|
|
||||||
|
void Menu::InitializeCharacterMenuWindow(){
|
||||||
|
Menu*characterMenuWindow=CreateMenu(CHARACTER_MENU,CENTERED,game->GetScreenSize()-vf2d{52,52});
|
||||||
|
}
|
||||||
@ -40,14 +40,15 @@ All rights reserved.
|
|||||||
|
|
||||||
struct ConnectionPoint{
|
struct ConnectionPoint{
|
||||||
geom2d::rect<float>rect;
|
geom2d::rect<float>rect;
|
||||||
|
std::string type;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string map;
|
std::string map;
|
||||||
std::string unlockCondition;
|
std::string unlockCondition;
|
||||||
std::array<int,8>neighbors; //Indices into the connectionPoint array.
|
std::array<int,8>neighbors; //Indices into the connectionPoint array.
|
||||||
std::vector<int>spawns;
|
std::vector<int>spawns;
|
||||||
bool levelDataExists=false;
|
bool levelDataExists=false;
|
||||||
inline ConnectionPoint(geom2d::rect<float>rect,std::string name,std::string map,std::string unlockCondition,std::vector<int>spawns)
|
inline ConnectionPoint(geom2d::rect<float>rect,std::string type,std::string name,std::string map,std::string unlockCondition,std::vector<int>spawns)
|
||||||
:rect(rect),name(name),map(map),unlockCondition(unlockCondition),spawns(spawns){
|
:rect(rect),type(type),name(name),map(map),unlockCondition(unlockCondition),spawns(spawns){
|
||||||
neighbors.fill(-1);
|
neighbors.fill(-1);
|
||||||
}
|
}
|
||||||
bool IsNeighbor(ConnectionPoint&testPoint);
|
bool IsNeighbor(ConnectionPoint&testPoint);
|
||||||
|
|||||||
@ -86,6 +86,7 @@ InputGroup Crawler::KEY_UP;
|
|||||||
InputGroup Crawler::KEY_DOWN;
|
InputGroup Crawler::KEY_DOWN;
|
||||||
InputGroup Crawler::KEY_ATTACK;
|
InputGroup Crawler::KEY_ATTACK;
|
||||||
InputGroup Crawler::KEY_CONFIRM;
|
InputGroup Crawler::KEY_CONFIRM;
|
||||||
|
InputGroup Crawler::KEY_MENU;
|
||||||
|
|
||||||
float Crawler::SIZE_CHANGE_SPEED=1;
|
float Crawler::SIZE_CHANGE_SPEED=1;
|
||||||
|
|
||||||
@ -213,7 +214,7 @@ bool Crawler::OnUserUpdate(float fElapsedTime){
|
|||||||
RenderMenu();
|
RenderMenu();
|
||||||
RenderFadeout();
|
RenderFadeout();
|
||||||
RenderVersionInfo();
|
RenderVersionInfo();
|
||||||
return true;
|
return !gameEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Crawler::LeftHeld(){
|
bool Crawler::LeftHeld(){
|
||||||
@ -1933,6 +1934,7 @@ void Crawler::InitializeDefaultKeybinds(){
|
|||||||
KEY_DOWN.AddKeybind({KEY,S});
|
KEY_DOWN.AddKeybind({KEY,S});
|
||||||
KEY_CONFIRM.AddKeybind({MOUSE,Mouse::LEFT});
|
KEY_CONFIRM.AddKeybind({MOUSE,Mouse::LEFT});
|
||||||
KEY_CONFIRM.AddKeybind({KEY,ENTER});
|
KEY_CONFIRM.AddKeybind({KEY,ENTER});
|
||||||
|
KEY_MENU.AddKeybind({KEY,ESCAPE});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crawler::SetBossNameDisplay(std::string name,float time){
|
void Crawler::SetBossNameDisplay(std::string name,float time){
|
||||||
@ -2000,10 +2002,8 @@ void Crawler::RenderMenu(){
|
|||||||
Menu::stack.back()->Update(this);
|
Menu::stack.back()->Update(this);
|
||||||
}
|
}
|
||||||
if(Menu::stack.size()>0){
|
if(Menu::stack.size()>0){
|
||||||
if(Menu::cover){
|
|
||||||
FillRectDecal({0,0},WINDOW_SIZE,{0,0,0,uint8_t(255*0.4)});
|
|
||||||
}
|
|
||||||
for(Menu*menu:Menu::stack){
|
for(Menu*menu:Menu::stack){
|
||||||
|
if(menu->cover)FillRectDecal({0,0},WINDOW_SIZE,{0,0,0,uint8_t(255*0.4)});
|
||||||
menu->Draw(this);
|
menu->Draw(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2216,4 +2216,8 @@ void Crawler::RenderFadeout(){
|
|||||||
|
|
||||||
bool Crawler::GamePaused(){
|
bool Crawler::GamePaused(){
|
||||||
return fadeOutDuration>0;
|
return fadeOutDuration>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Crawler::EndGame(){
|
||||||
|
gameEnd=true;
|
||||||
}
|
}
|
||||||
@ -65,6 +65,7 @@ public:
|
|||||||
static InputGroup KEY_RIGHT;
|
static InputGroup KEY_RIGHT;
|
||||||
static InputGroup KEY_UP;
|
static InputGroup KEY_UP;
|
||||||
static InputGroup KEY_DOWN;
|
static InputGroup KEY_DOWN;
|
||||||
|
static InputGroup KEY_MENU;
|
||||||
static float SIZE_CHANGE_SPEED;
|
static float SIZE_CHANGE_SPEED;
|
||||||
float levelTime;
|
float levelTime;
|
||||||
Camera2D camera;
|
Camera2D camera;
|
||||||
@ -107,7 +108,7 @@ private:
|
|||||||
float fadeOutTotalTime=0;
|
float fadeOutTotalTime=0;
|
||||||
float fadeInDuration=0;
|
float fadeInDuration=0;
|
||||||
States::State transitionState=States::State::GAME_RUN;
|
States::State transitionState=States::State::GAME_RUN;
|
||||||
|
bool gameEnd=false;
|
||||||
std::vector<Monster>monstersToBeSpawned;
|
std::vector<Monster>monstersToBeSpawned;
|
||||||
|
|
||||||
void ValidateGameStatus();
|
void ValidateGameStatus();
|
||||||
@ -195,6 +196,7 @@ public:
|
|||||||
void ClearLoadoutItem(int slot);
|
void ClearLoadoutItem(int slot);
|
||||||
void RenderFadeout();
|
void RenderFadeout();
|
||||||
bool GamePaused();
|
bool GamePaused();
|
||||||
|
void EndGame();
|
||||||
|
|
||||||
struct TileGroupData{
|
struct TileGroupData{
|
||||||
vi2d tilePos;
|
vi2d tilePos;
|
||||||
|
|||||||
@ -294,6 +294,12 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"value": "CAMPAIGN_1_1"
|
"value": "CAMPAIGN_1_1"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Type",
|
||||||
|
"propertyType": "StageType",
|
||||||
|
"type": "string",
|
||||||
|
"value": "DUNGEON"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Unlock Condition",
|
"name": "Unlock Condition",
|
||||||
"propertyType": "Level",
|
"propertyType": "Level",
|
||||||
@ -308,6 +314,19 @@
|
|||||||
"object"
|
"object"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": 26,
|
||||||
|
"name": "StageType",
|
||||||
|
"storageType": "string",
|
||||||
|
"type": "enum",
|
||||||
|
"values": [
|
||||||
|
"DUNGEON",
|
||||||
|
"BOSS",
|
||||||
|
"STORY",
|
||||||
|
"SHOP"
|
||||||
|
],
|
||||||
|
"valuesAsFlags": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"color": "#ffffaa00",
|
"color": "#ffffaa00",
|
||||||
"drawFill": true,
|
"drawFill": true,
|
||||||
|
|||||||
@ -366,6 +366,10 @@
|
|||||||
<ClCompile Include="Arrow.cpp" />
|
<ClCompile Include="Arrow.cpp" />
|
||||||
<ClCompile Include="Bullet.cpp" />
|
<ClCompile Include="Bullet.cpp" />
|
||||||
<ClCompile Include="CharacterInfoWindow.cpp" />
|
<ClCompile Include="CharacterInfoWindow.cpp" />
|
||||||
|
<ClCompile Include="CharacterMenuWindow.cpp">
|
||||||
|
<SubType>
|
||||||
|
</SubType>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="ChargedArrow.cpp" />
|
<ClCompile Include="ChargedArrow.cpp" />
|
||||||
<ClCompile Include="ClassSelectionWindow.cpp" />
|
<ClCompile Include="ClassSelectionWindow.cpp" />
|
||||||
<ClCompile Include="ConnectionPoint.cpp" />
|
<ClCompile Include="ConnectionPoint.cpp" />
|
||||||
@ -393,6 +397,10 @@
|
|||||||
<ClCompile Include="MenuComponent.cpp" />
|
<ClCompile Include="MenuComponent.cpp" />
|
||||||
<ClCompile Include="Meteor.cpp" />
|
<ClCompile Include="Meteor.cpp" />
|
||||||
<ClCompile Include="OverworldMapLevelWindow.cpp" />
|
<ClCompile Include="OverworldMapLevelWindow.cpp" />
|
||||||
|
<ClCompile Include="OverworldMenuWindow.cpp">
|
||||||
|
<SubType>
|
||||||
|
</SubType>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="RunAway.cpp" />
|
<ClCompile Include="RunAway.cpp" />
|
||||||
<ClCompile Include="RunTowards.cpp" />
|
<ClCompile Include="RunTowards.cpp" />
|
||||||
<ClCompile Include="Pathfinding.cpp" />
|
<ClCompile Include="Pathfinding.cpp" />
|
||||||
|
|||||||
@ -464,6 +464,12 @@
|
|||||||
<ClCompile Include="State_Story.cpp">
|
<ClCompile Include="State_Story.cpp">
|
||||||
<Filter>Source Files\Game States</Filter>
|
<Filter>Source Files\Game States</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="OverworldMenuWindow.cpp">
|
||||||
|
<Filter>Source Files\Interface</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="CharacterMenuWindow.cpp">
|
||||||
|
<Filter>Source Files\Interface</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
|
|||||||
@ -65,7 +65,6 @@ std::vector<MenuComponent*>Menu::unhandledComponents;
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
MenuType Menu::lastMenuTypeCreated;
|
MenuType Menu::lastMenuTypeCreated;
|
||||||
std::string Menu::lastRegisteredComponent;
|
std::string Menu::lastRegisteredComponent;
|
||||||
bool Menu::cover;
|
|
||||||
|
|
||||||
INCLUDE_game
|
INCLUDE_game
|
||||||
INCLUDE_GFX
|
INCLUDE_GFX
|
||||||
@ -96,6 +95,8 @@ void Menu::InitializeMenus(){
|
|||||||
InitializeOverworldMapLevelWindow();
|
InitializeOverworldMapLevelWindow();
|
||||||
InitializeItemLoadoutWindow();
|
InitializeItemLoadoutWindow();
|
||||||
InitializeLevelCompleteWindow();
|
InitializeLevelCompleteWindow();
|
||||||
|
InitializeOverworldMenuWindow();
|
||||||
|
InitializeCharacterMenuWindow();
|
||||||
|
|
||||||
for(MenuType type=TEST;type<MenuType::ENUM_END;type=MenuType(int(type+1))){
|
for(MenuType type=TEST;type<MenuType::ENUM_END;type=MenuType(int(type+1))){
|
||||||
if(menus.count(type)==0){
|
if(menus.count(type)==0){
|
||||||
@ -384,8 +385,7 @@ void Menu::Draw(Crawler*game){
|
|||||||
};
|
};
|
||||||
|
|
||||||
void Menu::OpenMenu(MenuType menu,bool cover){
|
void Menu::OpenMenu(MenuType menu,bool cover){
|
||||||
Menu::cover=cover;
|
menus[menu]->cover=cover;
|
||||||
stack.clear();
|
|
||||||
stack.push_back(menus[menu]);
|
stack.push_back(menus[menu]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,6 +57,8 @@ enum MenuType{
|
|||||||
OVERWORLD_LEVEL_SELECT,
|
OVERWORLD_LEVEL_SELECT,
|
||||||
ITEM_LOADOUT,
|
ITEM_LOADOUT,
|
||||||
LEVEL_COMPLETE,
|
LEVEL_COMPLETE,
|
||||||
|
OVERWORLD_MENU,
|
||||||
|
CHARACTER_MENU,
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
/*DO NOT REMOVE!!*/ENUM_END////////////////////////////////
|
/*DO NOT REMOVE!!*/ENUM_END////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -133,6 +135,8 @@ private:
|
|||||||
static void InitializeOverworldMapLevelWindow();
|
static void InitializeOverworldMapLevelWindow();
|
||||||
static void InitializeItemLoadoutWindow();
|
static void InitializeItemLoadoutWindow();
|
||||||
static void InitializeLevelCompleteWindow();
|
static void InitializeLevelCompleteWindow();
|
||||||
|
static void InitializeOverworldMenuWindow();
|
||||||
|
static void InitializeCharacterMenuWindow();
|
||||||
|
|
||||||
void KeyboardButtonNavigation(Crawler*game,vf2d menuPos);
|
void KeyboardButtonNavigation(Crawler*game,vf2d menuPos);
|
||||||
static void DrawScaledWindowBackground(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor);
|
static void DrawScaledWindowBackground(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor);
|
||||||
@ -145,7 +149,7 @@ private:
|
|||||||
|
|
||||||
Pixel GetRenderColor();
|
Pixel GetRenderColor();
|
||||||
static bool MOUSE_NAVIGATION;
|
static bool MOUSE_NAVIGATION;
|
||||||
static bool cover; //A black cover for when a menu pops up to fade out the stuff behind it.
|
bool cover; //A black cover for when a menu pops up to fade out the stuff behind it.
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
58
Crawler/OverworldMenuWindow.cpp
Normal file
58
Crawler/OverworldMenuWindow.cpp
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#pragma region License
|
||||||
|
/*
|
||||||
|
License (OLC-3)
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Copyright 2018 - 2023 OneLoneCoder.com
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions or derivations of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions or derivative works in binary form must reproduce the above
|
||||||
|
copyright notice. This list of conditions and the following disclaimer must be
|
||||||
|
reproduced in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors may
|
||||||
|
be used to endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
|
||||||
|
Portions of this software are copyright © 2023 The FreeType
|
||||||
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
#pragma endregion
|
||||||
|
#include "Menu.h"
|
||||||
|
#include "MenuComponent.h"
|
||||||
|
#include "Crawler.h"
|
||||||
|
|
||||||
|
INCLUDE_game
|
||||||
|
|
||||||
|
void Menu::InitializeOverworldMenuWindow(){
|
||||||
|
Menu*overworldMenuWindow=CreateMenu(OVERWORLD_MENU,CENTERED,vi2d{96,164});
|
||||||
|
|
||||||
|
MenuComponent*resumeButton=NEW MenuComponent(OVERWORLD_MENU,{{4,12+28*0},{88,24}},"Resume",[](MenuFuncData data){Menu::CloseMenu();return true;});
|
||||||
|
MenuComponent*characterButton=NEW MenuComponent(OVERWORLD_MENU,{{4,12+28*1},{88,24}},"Character",[](MenuFuncData data){Menu::OpenMenu(CHARACTER_MENU);return true;});
|
||||||
|
MenuComponent*inventoryButton=NEW MenuComponent(OVERWORLD_MENU,{{4,12+28*2},{88,24}},"Inventory",[](MenuFuncData data){/*Menu::OpenMenu(INVENTORY_MENU);*/return true;});
|
||||||
|
MenuComponent*settingsButton=NEW MenuComponent(OVERWORLD_MENU,{{4,12+28*3},{88,24}},"Settings",[](MenuFuncData data){/*Menu::OpenMenu(SETTINGS_MENU);*/return true;});
|
||||||
|
MenuComponent*quitButton=NEW MenuComponent(OVERWORLD_MENU,{{4,12+28*4},{88,24}},"Quit Game",[](MenuFuncData data){game->EndGame();return true;});
|
||||||
|
|
||||||
|
overworldMenuWindow->AddComponent("Resume Button",resumeButton);
|
||||||
|
overworldMenuWindow->AddComponent("Character Button",characterButton);
|
||||||
|
overworldMenuWindow->AddComponent("Inventory Button",inventoryButton);
|
||||||
|
overworldMenuWindow->AddComponent("Settings Button",settingsButton);
|
||||||
|
overworldMenuWindow->AddComponent("Quit Button",quitButton);
|
||||||
|
}
|
||||||
@ -85,34 +85,41 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ConnectionPoint&cp:connections){
|
if(Crawler::KEY_MENU.Pressed()){
|
||||||
if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)){
|
Menu::OpenMenu(OVERWORLD_MENU);
|
||||||
for(int neighborInd:currentConnectionPoint->neighbors){
|
}
|
||||||
if(neighborInd==-1)continue;
|
|
||||||
ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd);
|
#pragma region Handle Connection Point Clicking and Movement
|
||||||
if(Unlock::IsUnlocked(neighbor.unlockCondition)&&&cp==&neighbor){
|
for(ConnectionPoint&cp:connections){
|
||||||
currentConnectionPoint=&neighbor;
|
if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)){
|
||||||
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
|
for(int neighborInd:currentConnectionPoint->neighbors){
|
||||||
float angleTo=util::angleTo(game->GetPlayer()->GetPos(),playerTargetPos);
|
if(neighborInd==-1)continue;
|
||||||
if(angleTo>=-3*PI/4&&angleTo<-PI/4){
|
ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd);
|
||||||
game->GetPlayer()->UpdateWalkingAnimation(UP);
|
if(Unlock::IsUnlocked(neighbor.unlockCondition)&&&cp==&neighbor){
|
||||||
}else
|
currentConnectionPoint=&neighbor;
|
||||||
if(angleTo<PI/4&&angleTo>=-PI/4){
|
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
|
||||||
game->GetPlayer()->UpdateWalkingAnimation(RIGHT);
|
float angleTo=util::angleTo(game->GetPlayer()->GetPos(),playerTargetPos);
|
||||||
}else
|
if(angleTo>=-3*PI/4&&angleTo<-PI/4){
|
||||||
if(angleTo>=PI/4&&angleTo<3*PI/4){
|
game->GetPlayer()->UpdateWalkingAnimation(UP);
|
||||||
game->GetPlayer()->UpdateWalkingAnimation(DOWN);
|
}else
|
||||||
}else{
|
if(angleTo<PI/4&&angleTo>=-PI/4){
|
||||||
game->GetPlayer()->UpdateWalkingAnimation(LEFT);
|
game->GetPlayer()->UpdateWalkingAnimation(RIGHT);
|
||||||
|
}else
|
||||||
|
if(angleTo>=PI/4&&angleTo<3*PI/4){
|
||||||
|
game->GetPlayer()->UpdateWalkingAnimation(DOWN);
|
||||||
|
}else{
|
||||||
|
game->GetPlayer()->UpdateWalkingAnimation(LEFT);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
#pragma endregion
|
||||||
};
|
};
|
||||||
void State_OverworldMap::Draw(Crawler*game){
|
void State_OverworldMap::Draw(Crawler*game){
|
||||||
currentTime+=game->GetElapsedTime();
|
currentTime+=game->GetElapsedTime();
|
||||||
|
|||||||
@ -249,8 +249,6 @@ class TMXParser{
|
|||||||
return parsedMapInfo;
|
return parsedMapInfo;
|
||||||
}
|
}
|
||||||
void TMXParser::ParseTag(std::string tag) {
|
void TMXParser::ParseTag(std::string tag) {
|
||||||
|
|
||||||
|
|
||||||
auto ReadNextTag=[&](){
|
auto ReadNextTag=[&](){
|
||||||
XMLTag newTag;
|
XMLTag newTag;
|
||||||
//First character is a '<' so we discard it.
|
//First character is a '<' so we discard it.
|
||||||
@ -342,9 +340,6 @@ class TMXParser{
|
|||||||
parsedMapInfo.MapData.playerSpawnLocation={newTag.GetInteger("x")-newTag.GetInteger("width")/2,newTag.GetInteger("y")-newTag.GetInteger("height")/2};
|
parsedMapInfo.MapData.playerSpawnLocation={newTag.GetInteger("x")-newTag.GetInteger("width")/2,newTag.GetInteger("y")-newTag.GetInteger("height")/2};
|
||||||
} else
|
} else
|
||||||
if (newTag.tag=="object"&&newTag.data["type"]=="Monster") {
|
if (newTag.tag=="object"&&newTag.data["type"]=="Monster") {
|
||||||
//XMLTag monsterTag=ReadNextTag();
|
|
||||||
//XMLTag spawnerLinkTag=ReadNextTag();
|
|
||||||
//newTag.data["value"]=monsterTag.GetInteger("value"); //Value now contains which monster name this spawn represents.
|
|
||||||
monsterTag=newTag;
|
monsterTag=newTag;
|
||||||
monsterPropertyTagCount=0;
|
monsterPropertyTagCount=0;
|
||||||
} else
|
} else
|
||||||
@ -458,7 +453,7 @@ class TMXParser{
|
|||||||
for(auto key:stagePlates){
|
for(auto key:stagePlates){
|
||||||
StagePlate&plate=key.second;
|
StagePlate&plate=key.second;
|
||||||
idToIndexMap[plate.tag.GetInteger("id")]=int(State_OverworldMap::connections.size());
|
idToIndexMap[plate.tag.GetInteger("id")]=int(State_OverworldMap::connections.size());
|
||||||
ConnectionPoint newConnection={{{plate.tag.GetFloat("x"),plate.tag.GetFloat("y")},{plate.tag.GetFloat("width"),plate.tag.GetFloat("height")}},plate.tag.data["name"],plate.properties["Map"].value,plate.properties["Unlock Condition"].value,{}};
|
ConnectionPoint newConnection={{{plate.tag.GetFloat("x"),plate.tag.GetFloat("y")},{plate.tag.GetFloat("width"),plate.tag.GetFloat("height")}},plate.properties["Type"].value,plate.tag.data["name"],plate.properties["Map"].value,plate.properties["Unlock Condition"].value,{}};
|
||||||
int iterationCount=0;
|
int iterationCount=0;
|
||||||
for(auto key2:plate.properties){
|
for(auto key2:plate.properties){
|
||||||
if(key2.first.starts_with("Connection ")){
|
if(key2.first.starts_with("Connection ")){
|
||||||
|
|||||||
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 1
|
#define VERSION_PATCH 1
|
||||||
#define VERSION_BUILD 3321
|
#define VERSION_BUILD 3326
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
|||||||
@ -560,6 +560,7 @@
|
|||||||
<property name="Connection 1" type="object" value="4"/>
|
<property name="Connection 1" type="object" value="4"/>
|
||||||
<property name="Connection 2" type="object" value="5"/>
|
<property name="Connection 2" type="object" value="5"/>
|
||||||
<property name="Map" propertytype="Level" value="CAMPAIGN_1_1"/>
|
<property name="Map" propertytype="Level" value="CAMPAIGN_1_1"/>
|
||||||
|
<property name="Type" propertytype="StageType" value="DUNGEON"/>
|
||||||
<property name="Unlock Condition" propertytype="Level" value="WORLD_MAP"/>
|
<property name="Unlock Condition" propertytype="Level" value="WORLD_MAP"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
@ -567,6 +568,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<property name="Connection 1" type="object" value="7"/>
|
<property name="Connection 1" type="object" value="7"/>
|
||||||
<property name="Map" propertytype="Level" value="CAMPAIGN_1_2"/>
|
<property name="Map" propertytype="Level" value="CAMPAIGN_1_2"/>
|
||||||
|
<property name="Type" propertytype="StageType" value="DUNGEON"/>
|
||||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_1"/>
|
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_1"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
@ -574,6 +576,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<property name="Connection 1" type="object" value="8"/>
|
<property name="Connection 1" type="object" value="8"/>
|
||||||
<property name="Map" propertytype="Level" value="STORY_1_1"/>
|
<property name="Map" propertytype="Level" value="STORY_1_1"/>
|
||||||
|
<property name="Type" propertytype="StageType" value="STORY"/>
|
||||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_1"/>
|
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_1"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
@ -583,6 +586,7 @@
|
|||||||
<property name="Connection 2" type="object" value="0"/>
|
<property name="Connection 2" type="object" value="0"/>
|
||||||
<property name="Connection 3" type="object" value="0"/>
|
<property name="Connection 3" type="object" value="0"/>
|
||||||
<property name="Map" propertytype="Level" value="CAMPAIGN_1_3"/>
|
<property name="Map" propertytype="Level" value="CAMPAIGN_1_3"/>
|
||||||
|
<property name="Type" propertytype="StageType" value="DUNGEON"/>
|
||||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_2"/>
|
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_2"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
@ -590,12 +594,14 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<property name="Connection 1" type="object" value="6"/>
|
<property name="Connection 1" type="object" value="6"/>
|
||||||
<property name="Map" propertytype="Level" value="STORY_1_2"/>
|
<property name="Map" propertytype="Level" value="STORY_1_2"/>
|
||||||
|
<property name="Type" propertytype="StageType" value="DUNGEON"/>
|
||||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_2"/>
|
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_2"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
<object id="8" name="Blacksmith I" type="StagePlate" x="416" y="416" width="20" height="24">
|
<object id="8" name="Blacksmith I" type="StagePlate" x="416" y="416" width="20" height="24">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="Map" propertytype="Level" value="BLACKSMITH"/>
|
<property name="Map" propertytype="Level" value="BLACKSMITH"/>
|
||||||
|
<property name="Type" propertytype="StageType" value="SHOP"/>
|
||||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_3"/>
|
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_3"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
@ -604,6 +610,7 @@
|
|||||||
<property name="Connection 1" type="object" value="0"/>
|
<property name="Connection 1" type="object" value="0"/>
|
||||||
<property name="Connection 2" type="object" value="0"/>
|
<property name="Connection 2" type="object" value="0"/>
|
||||||
<property name="Map" propertytype="Level" value="CAMPAIGN_1_4"/>
|
<property name="Map" propertytype="Level" value="CAMPAIGN_1_4"/>
|
||||||
|
<property name="Type" propertytype="StageType" value="DUNGEON"/>
|
||||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_3"/>
|
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_3"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user