summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-05 18:59:53 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-05 18:59:53 +0300
commitb19a1c6d50c2c0f4233972f20c9354efca5ccb66 (patch)
tree34e2c6c432e732fa75226c1195ecc229bd3a7711 /src/being/being.cpp
parent1c34872aea8d196708aec8277017b467d01d09b0 (diff)
downloadmv-b19a1c6d50c2c0f4233972f20c9354efca5ccb66.tar.gz
mv-b19a1c6d50c2c0f4233972f20c9354efca5ccb66.tar.bz2
mv-b19a1c6d50c2c0f4233972f20c9354efca5ccb66.tar.xz
mv-b19a1c6d50c2c0f4233972f20c9354efca5ccb66.zip
Change calculated speed in being from float to int.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index fadf254a9..2e1302fb7 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1704,15 +1704,15 @@ void Being::nextTile() restrict2
return;
}
- mActionTime += CAST_S32(mSpeed / 10);
+ mActionTime += mSpeed / 10;
if ((mType != ActorType::Player || mUseDiagonal)
&& mX != pos.x && mY != pos.y)
{
- mSpeed = static_cast<float>(mWalkSpeed) * 1.4F;
+ mSpeed = mWalkSpeed * 14 / 10;
}
else
{
- mSpeed = static_cast<float>(mWalkSpeed);
+ mSpeed = mWalkSpeed;
}
if (mX != pos.x || mY != pos.y)
@@ -1783,11 +1783,8 @@ void Being::logic() restrict2
case BeingAction::MOVE:
{
- if (static_cast<float>(get_elapsed_time(
- mActionTime)) >= mSpeed)
- {
+ if (get_elapsed_time(mActionTime) >= mSpeed)
nextTile();
- }
break;
}
@@ -1855,9 +1852,10 @@ void Being::logic() restrict2
if (frameCount < 10)
frameCount = 10;
- if (!isAlive() && mSpeed && gameHandler->removeDeadBeings()
- && CAST_S32 ((static_cast<float>(get_elapsed_time(mActionTime))
- / mSpeed)) >= frameCount)
+ if (!isAlive() &&
+ mSpeed &&
+ gameHandler->removeDeadBeings() &&
+ get_elapsed_time(mActionTime) / mSpeed >= frameCount)
{
if (mType != ActorType::Player && actorManager)
actorManager->destroy(this);
@@ -2172,10 +2170,8 @@ int Being::getOffset(const signed char pos,
const int time = get_elapsed_time(mActionTime);
offset = (pos == BeingDirection::LEFT
&& neg == BeingDirection::RIGHT) ?
- CAST_S32((static_cast<float>(time)
- * static_cast<float>(mMap->getTileWidth())) / mSpeed) :
- CAST_S32((static_cast<float>(time)
- * static_cast<float>(mMap->getTileHeight())) / mSpeed);
+ (time * mMap->getTileWidth() / mSpeed) :
+ (time * mMap->getTileHeight() / mSpeed);
}
// We calculate the offset _from_ the _target_ location