From 67df4c8d8e37b4843af5ec262a89f267f4fd93d4 Mon Sep 17 00:00:00 2001 From: Ryan Flegel Date: Fri, 28 May 2004 07:31:25 +0000 Subject: [PATCH] - added unisolid patch from Upsilon SVN-Revision: 1344 --- src/collision.cpp | 7 +++++++ src/collision.h | 1 + src/player.cpp | 5 ++++- src/tile.cpp | 2 ++ src/tile.h | 3 +++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/collision.cpp b/src/collision.cpp index 5f087566d..58c48c6bd 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -251,6 +251,13 @@ bool issolid(float x, float y) return tile && tile->solid; } +bool isunisolid(float x, float y) +{ + Tile* tile = gettile(x,y); + return tile && tile->unisolid; +} + + bool isbrick(float x, float y) { Tile* tile = gettile(x,y); diff --git a/src/collision.h b/src/collision.h index b6c243e2e..a30451b9f 100644 --- a/src/collision.h +++ b/src/collision.h @@ -53,6 +53,7 @@ Tile* gettile(float x, float y); // Some little helper function to check for tile properties bool issolid(float x, float y); +bool isunisolid(float x, float y); bool isbrick(float x, float y); bool isice(float x, float y); bool isspike(float x, float y); diff --git a/src/player.cpp b/src/player.cpp index 27d909e66..2dad2903e 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -312,7 +312,10 @@ Player::on_ground() { return ( issolid(base.x + base.width / 2, base.y + base.height) || issolid(base.x + 1, base.y + base.height) || - issolid(base.x + base.width - 1, base.y + base.height) ); + issolid(base.x + base.width - 1, base.y + base.height) || + isunisolid(base.x + base.width / 2, base.y + base.height) || + isunisolid(base.x + 1, base.y + base.height) || + isunisolid(base.x + base.width - 1, base.y + base.height) ); } bool diff --git a/src/tile.cpp b/src/tile.cpp index 19a514fb3..3cb7427d0 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -88,6 +88,7 @@ void TileManager::load_tileset(std::string filename) Tile* tile = new Tile; tile->id = -1; tile->solid = false; + tile->unisolid = false; tile->brick = false; tile->ice = false; tile->water = false; @@ -102,6 +103,7 @@ void TileManager::load_tileset(std::string filename) LispReader reader(lisp_cdr(element)); assert(reader.read_int("id", &tile->id)); reader.read_bool("solid", &tile->solid); + reader.read_bool("unisolid", &tile->unisolid); reader.read_bool("brick", &tile->brick); reader.read_bool("ice", &tile->ice); reader.read_bool("water", &tile->water); diff --git a/src/tile.h b/src/tile.h index a94a19c36..9123422c5 100644 --- a/src/tile.h +++ b/src/tile.h @@ -50,6 +50,9 @@ public: /** solid tile that is indestructable by Tux */ bool solid; + /** uni-directional solid tile */ + bool unisolid; + /** a brick that can be destroyed by jumping under it */ bool brick; -- 2.11.0