diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-04-24 09:53:48 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-04-24 09:53:48 -0400 |
commit | 2473bc452959f1c84b03c4b9202d601b3325143d (patch) | |
tree | da66fe0ca2dc01308c7d7e5271090afa25dc99aa /src/world.cpp | |
parent | cc2230e0039f06a7478878adcbc9ef028a223243 (diff) |
library-ized ticks
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/world.cpp b/src/world.cpp index 37d899d..c5ed9d0 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -10,6 +10,7 @@ // local game headers #include <ui.hpp> +#include <gametime.hpp> // local library headers #include <tinyxml2.h> @@ -36,7 +37,6 @@ extern World *currentWorld; // main.cpp extern World *currentWorldToLeft; // main.cpp extern World *currentWorldToRight; // main.cpp extern bool inBattle; // ui.cpp? -extern unsigned int tickCount; // main.cpp extern std::string xmlFolder; @@ -543,6 +543,8 @@ singleDetect(Entity *e) unsigned int i; int l; + auto deltaTime = gtime::getDeltaTime(); + // kill dead entities if (!e->isAlive()) { return; @@ -1356,7 +1358,7 @@ singleDetect(Entity *e) } if (e->vel.y > -2) - e->vel.y -= GRAVITY_CONSTANT * deltaTime; + e->vel.y -= GRAVITY_CONSTANT * gtime::getDeltaTime(); if (e->ground) { e->loc.y = ceil(e->loc.y); @@ -1761,7 +1763,7 @@ loadWorldFromXMLNoSave(std::string path) { } else if (name == "hill") { tmp->addHill(ivec2 { wxml->IntAttribute("peakx"), wxml->IntAttribute("peaky") }, wxml->UnsignedAttribute("width")); } else if (name == "time") { - tickCount = std::stoi(wxml->GetText()); + gtime::setTickCount(std::stoi(wxml->GetText())); } else if (Indoor && name == "floor") { if (wxml->QueryFloatAttribute("start",&spawnx) == XML_NO_ERROR) Indoorp(tmp)->addFloor(wxml->UnsignedAttribute("width"), spawnx); |