Added intro camera movement and transition changing. Release Build 7603.

pull/35/head
sigonasr2 9 months ago
parent 99049d6fa0
commit 57bad057ed
  1. 4
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 1
      Adventures in Lestoria/AdventuresInLestoria.h
  3. 6
      Adventures in Lestoria/ItemDrop.cpp
  4. 6
      Adventures in Lestoria/Monster.cpp
  5. 6
      Adventures in Lestoria/Player.cpp
  6. 39
      Adventures in Lestoria/State_MainMenu.cpp
  7. 8
      Adventures in Lestoria/State_MainMenu.h
  8. 27
      Adventures in Lestoria/TMXParser.h
  9. 2
      Adventures in Lestoria/TODO.txt
  10. 4
      Adventures in Lestoria/Test.cpp
  11. 2
      Adventures in Lestoria/Version.h
  12. 10
      Adventures in Lestoria/assets/Campaigns/Intro_Map.tmx
  13. BIN
      x64/Release/Adventures in Lestoria.exe

@ -2288,10 +2288,6 @@ const MapName&AiL::GetCurrentLevel()const{
return currentLevel;
}
std::map<std::string,std::vector<ZoneData>>&AiL::GetZoneData(MapName map){
return MAP_DATA[map].ZoneData;
}
void AiL::ChangePlayerClass(Class cl){
Ability itemAbility1=player->useItem1;
Ability itemAbility2=player->useItem2;

@ -231,7 +231,6 @@ public:
bool HasTileCollision(MapName map,vf2d pos,bool upperLevel=false);
const MapName&GetCurrentLevel()const;
bool IsBridgeLayer(LayerTag&layer);
std::map<std::string,std::vector<ZoneData>>&GetZoneData(MapName map);
void PopulateRenderLists();
void ChangePlayerClass(Class cl);
std::string GetString(std::string key);

@ -118,13 +118,13 @@ void ItemDrop::UpdateDrops(float fElapsedTime){
#pragma region Handle Upper/Lower Level Zone Intersecting
if(drop.speed.mag()>0){
std::map<std::string,std::vector<ZoneData>>&zoneData=game->GetZoneData(game->GetCurrentLevel());
for(ZoneData&upperLevelZone:zoneData["UpperZone"]){
const std::map<std::string,std::vector<ZoneData>>&zoneData=game->GetZones(game->GetCurrentLevel());
for(const ZoneData&upperLevelZone:zoneData.at("UpperZone")){
if(geom2d::overlaps(upperLevelZone.zone,drop.pos)){
drop.upperLevel=true;
}
}
for(ZoneData&lowerLevelZone:zoneData["LowerZone"]){
for(const ZoneData&lowerLevelZone:zoneData.at("LowerZone")){
if(geom2d::overlaps(lowerLevelZone.zone,drop.pos)){
drop.upperLevel=false;
}

@ -455,13 +455,13 @@ bool Monster::SetPos(vf2d pos){
return resultX||resultY;
}
void Monster::Moved(){
std::map<std::string,std::vector<ZoneData>>&zoneData=game->GetZoneData(game->GetCurrentLevel());
for(ZoneData&upperLevelZone:zoneData["UpperZone"]){
const std::map<std::string,std::vector<ZoneData>>&zoneData=game->GetZones(game->GetCurrentLevel());
for(const ZoneData&upperLevelZone:zoneData.at("UpperZone")){
if(geom2d::overlaps(upperLevelZone.zone,pos)){
upperLevel=true;
}
}
for(ZoneData&lowerLevelZone:zoneData["LowerZone"]){
for(const ZoneData&lowerLevelZone:zoneData.at("LowerZone")){
if(geom2d::overlaps(lowerLevelZone.zone,pos)){
upperLevel=false;
}

@ -783,13 +783,13 @@ void Player::Moved(){
spawner.SetTriggered(true);
}
}
std::map<std::string,std::vector<ZoneData>>&zoneData=game->GetZoneData(game->GetCurrentLevel());
for(ZoneData&upperLevelZone:zoneData["UpperZone"]){
const std::map<std::string,std::vector<ZoneData>>&zoneData=game->GetZones(game->GetCurrentLevel());
for(const ZoneData&upperLevelZone:zoneData.at("UpperZone")){
if(geom2d::overlaps(upperLevelZone.zone,pos)){
upperLevel=true;
}
}
for(ZoneData&lowerLevelZone:zoneData["LowerZone"]){
for(const ZoneData&lowerLevelZone:zoneData.at("LowerZone")){
if(geom2d::overlaps(lowerLevelZone.zone,pos)){
upperLevel=false;
}

@ -41,6 +41,7 @@ All rights reserved.
#include "TitleScreen.h"
#include "Key.h"
#include "ItemDrop.h"
#include "util.h"
INCLUDE_game
@ -53,8 +54,12 @@ void State_MainMenu::OnStateChange(GameState*prevState){
void State_MainMenu::OnLevelLoad(){
game->GetPlayer()->SetIframes(999999.f);
game->GetPlayer()->SetInvisible(true);
SelectAndMoveToNewFocusArea();
}
void State_MainMenu::OnUserUpdate(AiL*game){
game->GetPlayer()->ForceSetPos(game->GetPlayer()->GetPos()+cameraMoveDir*8*game->GetElapsedTime());
lastMoveTime+=game->GetElapsedTime();
if(lastMoveTime>8.f)SelectAndMoveToNewFocusArea();
TitleScreen::Update();
if(AiL::KEY_CONFIRM.Released()){
TitleScreen::Skip();
@ -71,3 +76,37 @@ void State_MainMenu::OnUserUpdate(AiL*game){
void State_MainMenu::Draw(AiL*game){
TitleScreen::Draw();
};
const ZoneData&State_MainMenu::ChooseRandomFocusArea(){
//std::vector<ZoneData>
if(game->GetZones().count("Focus Area")>0){
const std::vector<ZoneData>&zones=game->GetZones().at("Focus Area");
newSelectedFocusAreaIndex=util::random()%zones.size();
return zones[newSelectedFocusAreaIndex];
}else ERR("WARNING! No focus areas included in the intro map!");
return game->GetZones().at("Focus Area")[0];
}
void State_MainMenu::SelectAndMoveToNewFocusArea(){
const ZoneData&newFocusArea=ChooseRandomFocusArea();
if(lastSelectedFocusAreaIndex==newSelectedFocusAreaIndex)return;
game->camera.MoveCamera(newFocusArea.zone.pos);
game->GetPlayer()->ForceSetPos(newFocusArea.zone.pos);
cameraMoveDir={};
for(const XMLTag&tag:newFocusArea.properties){
if(tag.data.at("name")=="Scroll Direction"){
std::string_view dir=tag.data.at("value");
if(dir=="NORTH"sv)cameraMoveDir={0.f,-1.f};else
if(dir=="NORTHEAST"sv)cameraMoveDir={1.f,-1.f};else
if(dir=="EAST"sv)cameraMoveDir={1.f,0.f};else
if(dir=="SOUTHEAST"sv)cameraMoveDir={1.f,1.f};else
if(dir=="SOUTH"sv)cameraMoveDir={0.f,1.f};else
if(dir=="SOUTHWEST"sv)cameraMoveDir={-1.f,1.f};else
if(dir=="WEST"sv)cameraMoveDir={-1.f,0.f};else
if(dir=="NORTHWEST"sv)cameraMoveDir={-1.f,-1.f};
}
}
lastMoveTime=0.f;
lastSelectedFocusAreaIndex=newSelectedFocusAreaIndex;
}

@ -36,10 +36,18 @@ All rights reserved.
*/
#pragma endregion
#include "GameState.h"
#include "TMXParser.h"
class State_MainMenu:public GameState{
virtual void OnStateChange(GameState*prevState)override final;
virtual void OnUserUpdate(AiL*game)override final;
virtual void Draw(AiL*game)override final;
virtual void OnLevelLoad()override final;
const ZoneData&ChooseRandomFocusArea();
vf2d cameraMoveDir;
float lastMoveTime=0.f;
size_t newSelectedFocusAreaIndex=0;
size_t lastSelectedFocusAreaIndex=0;
void SelectAndMoveToNewFocusArea();
};

@ -98,6 +98,7 @@ struct SpawnerTag{
struct ZoneData{
geom2d::rect<int>zone;
bool isUpper=false;
std::vector<XMLTag>properties;
};
struct NPCData{
@ -517,23 +518,19 @@ class TMXParser{
if(newTag.tag=="property"&&currentStagePlate!=nullptr){
currentStagePlate->properties[newTag.data["name"]]={newTag.data["name"],newTag.data["value"]};
}else
if(newTag.tag=="property"&&prevZoneData!=nullptr){
//This is a property for a zone that doesn't fit into the other categories, we add it to the previous zone data encountered.
prevZoneData->properties.push_back(newTag);
}else
if (newTag.tag=="object"&&newTag.data.find("type")!=newTag.data.end()){
//This is an object with a type that doesn't fit into other categories, we can add it to ZoneData.
if(parsedMapInfo.ZoneData.find(newTag.data["type"])!=parsedMapInfo.ZoneData.end()){
std::vector<ZoneData>&zones=parsedMapInfo.ZoneData.at(newTag.data["type"]);
float width=1.f;
float height=1.f;
if(newTag.data.count("width")>0)width=newTag.GetFloat("width");
if(newTag.data.count("height")>0)height=newTag.GetFloat("height");
zones.emplace_back(geom2d::rect<int>{{newTag.GetInteger("x"),newTag.GetInteger("y")},{int(width),int(height)}});
prevZoneData=&zones.back();
} else {
if(newTag.data["width"].length()>0&&newTag.data["height"].length()>0){ //This ensures the zone is valid to begin with.
std::vector<ZoneData>&zones=parsedMapInfo.ZoneData[newTag.data["type"]];
zones.emplace_back(geom2d::rect<int>{{newTag.GetInteger("x"),newTag.GetInteger("y")},{newTag.GetInteger("width"),newTag.GetInteger("height")}});
prevZoneData=&zones.back();
}
}
std::vector<ZoneData>&zones=parsedMapInfo.ZoneData[newTag.data["type"]];
float width=1.f;
float height=1.f;
if(newTag.data.count("width")>0)width=newTag.GetFloat("width");
if(newTag.data.count("height")>0)height=newTag.GetFloat("height");
zones.emplace_back(geom2d::rect<int>{{newTag.GetInteger("x"),newTag.GetInteger("y")},{int(width),int(height)}});
prevZoneData=&zones.back();
}else{
#ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Unsupported tag format! Ignoring."<<"\n";

@ -13,8 +13,6 @@ March 30th -> Public Demo Release
Add Bonus XP when completing a stage
- Title Screen setpieces
- 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.

@ -54,8 +54,8 @@ void Test::is(std::string conditionStr,bool testResult){
void Test::RunMapTests(){
is("There are two LowerBridgeCollision zones in Campaign I-I",
game->GetZoneData("CAMPAIGN_1_1").count("LowerBridgeCollision")
&&game->GetZoneData("CAMPAIGN_1_1").at("LowerBridgeCollision").size()>=2);
game->GetZones("CAMPAIGN_1_1").count("LowerBridgeCollision")
&&game->GetZones("CAMPAIGN_1_1").at("LowerBridgeCollision").size()>=2);
for(auto&[key,value]:game->MAP_DATA){
is("A Map type has been selected for map "+key,
value.GetMapType()!=""&&value.GetMapType()!="Unspecified");

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

@ -1285,7 +1285,7 @@
</data>
</layer>
<objectgroup id="23" name="Spawn Zones">
<object id="9" name="Spawn 15" type="SpawnGroup" x="2989" y="2105" width="358" height="358">
<object id="9" name="Spawn 15" type="SpawnGroup" x="2611" y="1915" width="1130" height="668">
<ellipse/>
</object>
<object id="10" name="Windhound" type="Monster" x="3142" y="2233">
@ -1330,7 +1330,7 @@
</properties>
<point/>
</object>
<object id="16" name="Spawn 15" type="SpawnGroup" x="2629" y="2091" width="358" height="358">
<object id="16" name="Spawn 15" type="SpawnGroup" x="2629" y="1921" width="1104" height="655">
<ellipse/>
</object>
<object id="22" name="Bear" type="Monster" x="2748.5" y="2237.5">
@ -1347,7 +1347,7 @@
</properties>
<point/>
</object>
<object id="24" name="Spawn 15" type="SpawnGroup" x="3352" y="2120" width="358" height="358">
<object id="24" name="Spawn 15" type="SpawnGroup" x="2638" y="1912" width="1072" height="664">
<ellipse/>
</object>
<object id="25" name="Bear" type="Monster" x="3471.5" y="2266.5">
@ -1364,7 +1364,7 @@
</properties>
<point/>
</object>
<object id="27" name="Spawn 15" type="SpawnGroup" x="1607" y="288" width="358" height="358">
<object id="27" name="Spawn 15" type="SpawnGroup" x="849" y="34" width="2028" height="808">
<ellipse/>
</object>
<object id="28" name="Green Slime" type="Monster" x="2285.5" y="401.5">
@ -1555,7 +1555,7 @@
<object id="66" type="EndZone" x="733" y="780"/>
</objectgroup>
<objectgroup id="22" name="Environmental Sounds">
<object id="1" name="Spawn 12" type="SpawnGroup" x="353" y="2381" width="498" height="402">
<object id="1" name="Spawn 12" type="SpawnGroup" x="86" y="1890" width="1058" height="893">
<ellipse/>
</object>
<object id="2" name="Frog" type="Monster" x="562.33" y="2518.33">

Loading…
Cancel
Save