Add in floating-point support for collision boxes. Remove ceil() calls for transformed view DrawRectDecal and FillRectDecal functions (why are they there?)

This commit is contained in:
2024-01-11 01:26:58 -06:00
parent 6d11eb5048
commit 20928b6867
11 changed files with 54 additions and 35 deletions
+2 -2
View File
@@ -107,7 +107,7 @@ void Player::ForceSetPos(vf2d pos){
bool Player::SetX(float x){
vf2d newPos={x,pos.y};
vi2d tilePos=vi2d(newPos/float(game->GetCurrentMapData().tilewidth))*game->GetCurrentMapData().tilewidth;
geom2d::rect<int>collisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel);
geom2d::rect<float>collisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel);
#pragma region lambdas
auto NoTileCollisionExistsHere=[&](){return collisionRect.pos==game->NO_COLLISION.pos&&collisionRect.size==game->NO_COLLISION.size;};
#pragma endregion
@@ -133,7 +133,7 @@ bool Player::SetX(float x){
bool Player::SetY(float y){
vf2d newPos={pos.x,y};
vi2d tilePos=vi2d(newPos/float(game->GetCurrentMapData().tilewidth))*game->GetCurrentMapData().tilewidth;
geom2d::rect<int>collisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel);
geom2d::rect<float>collisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel);
#pragma region lambdas
auto NoTileCollisionExistsHere=[&](){return collisionRect.pos==game->NO_COLLISION.pos&&collisionRect.size==game->NO_COLLISION.size;};
#pragma endregion