Add in lower bridge tile zones (horizontal blocks on lower level). Use official map instead of test map.

This commit is contained in:
sigonasr2 2023-07-07 17:44:06 -05:00
parent d494be6970
commit 9a2af45245
5 changed files with 1081 additions and 3936 deletions

View File

@ -31,9 +31,7 @@ Crawler::Crawler()
bool Crawler::OnUserCreate(){
InitializeLevel("assets/Campaigns/1_1_test.tmx",CAMPAIGN_1_1);
ConsoleCaptureStdOut(true);
InitializeLevel("assets/Campaigns/1_1.tmx",CAMPAIGN_1_1);
ClassData::InitializeClassData();
@ -1144,6 +1142,15 @@ bool Crawler::IsBridgeLayer(LayerTag&layer){
geom2d::rect<int>Crawler::GetTileCollision(MapName map,vf2d pos,bool upperLevel){
if(pos.x<0||pos.y<0||pos.x>=WORLD_SIZE.x*24||pos.y>=WORLD_SIZE.y*24)return NO_COLLISION;
#pragma region Lower Bridge Collision Check
if(!upperLevel){ //We are looking for lower bridge collisions.
for(geom2d::rect<int>&zone:MAP_DATA[map].ZoneData["LowerBridgeCollision"]){
if(geom2d::contains(zone,pos)){
return {{0,0},{32,32}};
}
}
}
#pragma endregion
//The logic here is, if there's a tile on the bridge, we respect that tile instead if we're on the upper level. So we don't check other layers when we are on the upper level and there is a tile below us.
if(upperLevel&&bridgeLayerIndex!=-1){
int tileID=MAP_DATA[map].LayerData[bridgeLayerIndex].tiles[int(pos.y)/24][int(pos.x)/24]-1;

View File

@ -217,7 +217,11 @@ typedef std::map<std::string,std::vector<geom2d::rect<int>>> ZoneData;
if (newTag.tag=="object"&&newTag.data["type"]=="PlayerSpawnLocation") {
parsedMapInfo.MapData.playerSpawnLocation={newTag.GetInteger("x")-newTag.GetInteger("width")/2,newTag.GetInteger("y")-newTag.GetInteger("height")/2};
} else
if (newTag.tag=="object"&&newTag.data.find("type")!=newTag.data.end()){
if (newTag.tag=="object"&&newTag.data.find("type")!=newTag.data.end()
&&newTag.data.find("x")!=newTag.data.end()
&&newTag.data.find("y")!=newTag.data.end()
&&newTag.data.find("width")!=newTag.data.end()
&&newTag.data.find("height")!=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<geom2d::rect<int>>&zones=parsedMapInfo.ZoneData[newTag.data["type"]];

View File

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 522
#define VERSION_BUILD 528
#define stringify(a) stringify_(a)
#define stringify_(a) #a

File diff suppressed because it is too large Load Diff

View File

@ -3574,10 +3574,10 @@ namespace olc
vConsoleCursor.y++; vConsoleCursor.x = 0;
}
if (vConsoleCursor.y >= 1000)
if (vConsoleCursor.y >= vConsoleSize.y)
{
vConsoleCursor.y = vConsoleSize.y - 1;
for (size_t i = 1; i < 1000; i++)
for (size_t i = 1; i < vConsoleSize.y; i++)
sConsoleLines[i - 1] = sConsoleLines[i];
sConsoleLines[vConsoleCursor.y].clear();
}
@ -3590,13 +3590,6 @@ namespace olc
TypeCharacter(c);
}
if(GetMouseWheel()>0||GetKey(olc::PG_UP).bPressed)){
nConsoleScroll=std::clamp(nConsoleScroll+vConsoleSize.y,0,1000-vConsoleSize.y);
} else
if(GetMouseWheel()<0||GetKey(olc::PG_DN).bPressed)){
nConsoleScroll=std::clamp(nConsoleScroll-vConsoleSize.y,0,1000-vConsoleSize.y);
}
// Draw Shadow
GradientFillRectDecal({ 0,0 }, olc::vf2d(vScreenSize), olc::PixelF(0, 0, 0.5f, 0.5f), olc::PixelF(0, 0, 0.25f, 0.5f), olc::PixelF(0, 0, 0.25f, 0.5f), olc::PixelF(0, 0, 0.25f, 0.5f));