diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-05-13 08:47:23 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-05-13 08:47:23 -0400 |
commit | 0e24afb4cd060701348398b16f2b1d89b8935b81 (patch) | |
tree | 33ab55972910818b9f1b295feb093fd78fe018eb /src/entities.cpp | |
parent | 8ca58835d157cdc58111a68b090bb7e0d85c46a1 (diff) | |
parent | c852b713dcc39599493b07dd709f7990bc7443f5 (diff) |
Merge branch 'master' of https://github.com/tcsullivan/gamedev
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 dc1a45a..6b5e1d3 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -144,8 +144,6 @@ void Entity::setCooldown(unsigned int c) hitCooldown = c; } - - void Entity::handleHits(void) { hitCooldown = fmax(hitCooldown - game::time::getDeltaTime(), 0); @@ -204,6 +202,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() @@ -231,6 +232,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() @@ -262,6 +267,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() @@ -843,14 +852,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; } |