diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 6be0f916..f69b78cc 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -1911,7 +1911,7 @@ geom2d::rectAiL::GetTileCollision(MapName map,vf2d pos,bool upperLevel){ bool hasTerrain=false; for(const LayerTag&layer:GetCurrentMap().LayerData){ //Figure out if any tile at this position is terrain. If so, we have a collision box to check. - int tileID=layer.tiles[pos.y/24][pos.x/24]-1; + int tileID=layer.tiles[pos.y/GetCurrentMapData().tilewidth][pos.x/GetCurrentMapData().tilewidth]-1; if(tileID==-1)continue; const TilesheetData&data=GetTileSheet(GetCurrentLevel(),tileID); if(data.tileset->isTerrain){ @@ -1919,7 +1919,7 @@ geom2d::rectAiL::GetTileCollision(MapName map,vf2d pos,bool upperLevel){ break; } } - if(!hasTerrain)return geom2d::rect({0,0},{24,24}); //We assume no terrain means we can't walk on this. + if(!hasTerrain)return geom2d::rect({0,0},{GetCurrentMapData().tilewidth,GetCurrentMapData().tilewidth}); //We assume no terrain means we can't walk on this. #pragma region Lower Bridge Collision Check if(!upperLevel){ //We are looking for lower bridge collisions. @@ -1932,7 +1932,7 @@ geom2d::rectAiL::GetTileCollision(MapName map,vf2d pos,bool upperLevel){ #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)/game->GetCurrentMapData().tilewidth][int(pos.x)/game->GetCurrentMapData().tilewidth]-1; + int tileID=MAP_DATA[map].LayerData[bridgeLayerIndex].tiles[int(pos.y)/GetCurrentMapData().tilewidth][int(pos.x)/GetCurrentMapData().tilewidth]-1; if(tileID!=-1){ if (GetTileSheet(map,tileID%1000000).tileset->collision.find(tileID%1000000-GetTileSheet(map,tileID%1000000).firstgid+1)!=GetTileSheet(map,tileID%1000000).tileset->collision.end()){ return GetTileSheet(map,tileID%1000000).tileset->collision[tileID%1000000-GetTileSheet(map,tileID%1000000).firstgid+1].collision; @@ -1944,7 +1944,7 @@ geom2d::rectAiL::GetTileCollision(MapName map,vf2d pos,bool upperLevel){ for(int counter=0;LayerTag&layer:MAP_DATA[map].LayerData){ //auto HasNoClass=[&](){return layer.tag.data.find("class")==layer.tag.data.end();}; if(counter!=bridgeLayerIndex){ - int tileID=layer.tiles[int(pos.y)/game->GetCurrentMapData().tilewidth][int(pos.x)/game->GetCurrentMapData().tilewidth]-1; + int tileID=layer.tiles[int(pos.y)/GetCurrentMapData().tilewidth][int(pos.x)/GetCurrentMapData().tilewidth]-1; if(tileID!=-1&&GetTileSheet(map,tileID%1000000).tileset->collision.find(tileID%1000000-GetTileSheet(map,tileID%1000000).firstgid+1)!=GetTileSheet(map,tileID%1000000).tileset->collision.end()){ geom2d::rectcollisionRect=GetTileSheet(map,tileID%1000000).tileset->collision[tileID%1000000-GetTileSheet(map,tileID%1000000).firstgid+1].collision; if(foundRect.pos==NO_COLLISION.pos&&foundRect.size==NO_COLLISION.size){ diff --git a/Adventures in Lestoria/State_OverworldMap.cpp b/Adventures in Lestoria/State_OverworldMap.cpp index df9aebaf..32bc98b4 100644 --- a/Adventures in Lestoria/State_OverworldMap.cpp +++ b/Adventures in Lestoria/State_OverworldMap.cpp @@ -63,7 +63,7 @@ void State_OverworldMap::OnStateChange(GameState*prevState){ if(Menu::IsMenuOpen()){ Menu::CloseAllMenus(); } - game->GetPlayer()->SetPos(currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16}); + game->GetPlayer()->ForceSetPos(currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16}); playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16}; game->GetPlayer()->UpdateWalkingAnimation(DOWN); game->GetPlayer()->SetState(State::FORCE_WALK); diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 19970cb2..72d3c35e 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -13,9 +13,6 @@ Settings Menu -Click on title screen should not process as input immediately. -Investigate why frame rate matters for intro screen. --Faster main menu screen transition --Simplify map collision tiles by removing the requirement for hidden boundaries. --Loading should happen on fadeout. January 31st ============ diff --git a/Adventures in Lestoria/TitleScreen.cpp b/Adventures in Lestoria/TitleScreen.cpp index 89914785..c7420c25 100644 --- a/Adventures in Lestoria/TitleScreen.cpp +++ b/Adventures in Lestoria/TitleScreen.cpp @@ -49,8 +49,12 @@ using Particle=TitleScreen::Particle; std::vectorTitleScreen::particles; TitleScreen::State TitleScreen::state=State::BUILDING; -const float TitleScreen::animationTime=16.0f; +const float TitleScreen::animationTime=5.0f; float TitleScreen::currentAnimationTime=0.0f; +float TitleScreen::pixelMoveTime=0.0f; + +TitleScreen::Particle::Particle(vf2d pos,float scale,Pixel col,float rot,vf2d targetPos) + :pos(pos),scale(scale),col(col),rot(rot),targetPos(targetPos),originalPos(pos){} void TitleScreen::Initialize(){ Sprite*titleBackSpr=GFX["title_back.png"].Sprite(); @@ -86,18 +90,20 @@ void TitleScreen::Reset(){ p.pos.x=util::random(game->ScreenWidth()); }break; } + p.originalPos=p.pos; p.rot=util::random(4*PI)-2*PI; p.scale=util::random(5)+5; } - currentAnimationTime=0.0f; + pixelMoveTime=currentAnimationTime=0.0f; } void TitleScreen::Update(){ + pixelMoveTime=std::clamp(pixelMoveTime+game->GetElapsedTime(),0.f,3.f); currentAnimationTime=std::clamp(currentAnimationTime+game->GetElapsedTime(),0.f,5.f); switch(state){ case BUILDING:{ - double t=currentAnimationTime/animationTime; + double t=pixelMoveTime/(animationTime-2); for(Particle&p:particles){ - p.pos=p.pos.lerp(p.targetPos,t); + p.pos=p.originalPos.lerp(p.targetPos,sqrt(t)); p.rot=util::lerp(p.rot,0,t); p.scale=util::lerp(p.scale,1,t); } diff --git a/Adventures in Lestoria/TitleScreen.h b/Adventures in Lestoria/TitleScreen.h index c3448fab..0ed8ef20 100644 --- a/Adventures in Lestoria/TitleScreen.h +++ b/Adventures in Lestoria/TitleScreen.h @@ -47,6 +47,8 @@ public: Pixel col; float rot; vf2d targetPos; + vf2d originalPos; + Particle(vf2d pos,float scale,Pixel col,float rot,vf2d targetPos); }; enum State{ @@ -56,6 +58,7 @@ public: }; const static float animationTime; + static float pixelMoveTime; const static float waitTime; static float currentAnimationTime; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 52d22ac3..733683ee 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 5556 +#define VERSION_BUILD 5568 #define stringify(a) stringify_(a) #define stringify_(a) #a