diff options
Diffstat (limited to 'src/entities.cpp')
-rw-r--r-- | src/entities.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 5084fd6..14e1503 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -143,8 +143,6 @@ void Entity::setCooldown(unsigned int c) hitCooldown = c; } - - void Entity::handleHits(void) { hitCooldown = fmax(hitCooldown - game::time::getDeltaTime(), 0); @@ -203,6 +201,9 @@ Player::Player() : Entity() }); inv = new Inventory(PLAYER_INV_SIZE); + dim2 tmpDim = Texture::imageDim(tex.getTexturePath(0)); + width = HLINES(tmpDim.x/2); + height = HLINES(tmpDim.y/2); } Player::~Player() @@ -230,6 +231,10 @@ NPC::NPC() : Entity() randDialog = rand() % RAND_DIALOG_COUNT - 1; dialogIndex = 0; dialogCount = 0; + + dim2 tmpDim = Texture::imageDim(tex.getTexturePath(0)); + width = HLINES(tmpDim.x/2); + height = HLINES(tmpDim.y/2); } NPC::~NPC() @@ -261,6 +266,10 @@ Merchant::Merchant() : NPC() //randDialog = rand() % RAND_DIALOG_COUNT - 1; dialogIndex = 0; + + dim2 tmpDim = Texture::imageDim(tex.getTexturePath(0)); + width = HLINES(tmpDim.x/2); + height = HLINES(tmpDim.y/2); } Merchant::~Merchant() @@ -832,14 +841,14 @@ unsigned int Structures::spawn(BUILD_SUB sub, float x, float y) { case STALL_MARKET: tex = TextureIterator({ textureLoc }); dim = Texture::imageDim(textureLoc); - width = dim.x; - height = dim.y; + width = HLINES(dim.x/2); + height = HLINES(dim.y/2); break; default: tex = TextureIterator({ textureLoc }); dim = Texture::imageDim(textureLoc); - width = dim.x; - height = dim.y; + width = HLINES(dim.x/2); + height = HLINES(dim.y/2); inv = NULL; break; } |