// Enable full math definitions
#define _USE_MATH_DEFINES
+#include "Game.hpp"
+
+#include "Animation/Animation.hpp"
+#include "Audio/openal_wrapper.hpp"
+#include "Devtools/ConsoleCmds.hpp"
+#include "Level/Awards.hpp"
+#include "Level/Campaign.hpp"
+#include "Level/Dialog.hpp"
+#include "Level/Hotspot.hpp"
+#include "Menu/Menu.hpp"
+#include "User/Settings.hpp"
+#include "Utils/Folders.hpp"
+#include "Utils/Input.hpp"
+
#if PLATFORM_UNIX
#include <sys/stat.h>
#include <sys/types.h>
#include <direct.h>
#endif
-
-#include <limits>
-#include <ctime>
+#include <algorithm>
#include <cmath>
+#include <ctime>
#include <dirent.h>
-#include "Game.h"
-#include "openal_wrapper.h"
-#include "Settings.h"
-#include "Input.h"
-#include "Animation/Animation.h"
-#include "Awards.h"
-#include "Menu.h"
-#include "ConsoleCmds.h"
-#include "Dialog.h"
-#include "Utils/Folders.h"
-#include "Hotspot.h"
-#include "Campaign.h"
-
-#include <algorithm>
+#include <limits>
#include <set>
using namespace std;
extern float viewdistance;
extern bool freeze;
extern XYZ windvector;
-extern bool debugmode;
+extern bool devtools;
int leveltheme;
extern int mainmenu;
extern int oldmainmenu;
damagedealt = 0;
damagetaken = 0;
- if (accountactive)
- difficulty = accountactive->getDifficulty();
+ if (Account::hasActive()) {
+ difficulty = Account::active().getDifficulty();
+ }
Hotspot::hotspots.clear();
Hotspot::current = -1;
if (numplayers > maxplayers) {
cout << "Warning: this level contains more players than allowed" << endl;
}
+ unsigned j = 1;
for (int i = 1; i < numplayers; i++) {
- unsigned j = 1;
try {
Person::players.push_back(shared_ptr<Person>(new Person(tfile, mapvers, j)));
j++;
} catch (InvalidPersonException e) {
+ cerr << "Invalid Person found in " << name << endl;
}
}
if (visibleloading)
firstload = 1;
leveltime = 0;
+ wonleveltime = 0;
visibleloading = 0;
}
}
}
-void doDebugKeys()
+void doDevKeys()
{
float headprop, bodyprop, armprop, legprop;
- if (!debugmode) {
+ if (!devtools) {
return;
}
leveltime += multiplier;
//keys
- if (Input::isKeyDown(SDL_SCANCODE_LALT) && Input::isKeyPressed(SDL_SCANCODE_V) && debugmode) {
+ if (Input::isKeyDown(SDL_SCANCODE_LALT) && Input::isKeyPressed(SDL_SCANCODE_V) && devtools) {
freeze = !freeze;
if (freeze) {
OPENAL_SetFrequency(OPENAL_ALL);
}
}
- if (Input::isKeyPressed(consolekey) && debugmode) {
+ if (Input::isKeyPressed(consolekey) && devtools) {
console = !console;
if (console) {
OPENAL_SetFrequency(OPENAL_ALL);
hawkcalldelay = 16 + abs(Random() % 8);
}
- doDebugKeys();
+ doDevKeys();
doAttacks();
(whichlevel != -2 &&
(Input::isKeyDown(SDL_SCANCODE_Z) &&
Input::isKeyDown(SDL_SCANCODE_LGUI) &&
- debugmode) ||
+ devtools) ||
(Input::isKeyDown(jumpkey) &&
!respawnkeydown &&
!oldattackkey &&
Person::players[i]->crouchtogglekeydown = 1;
} else Person::players[i]->velocity.y = 5;
- if (mousejump && i == 0 && debugmode) {
+ if (mousejump && i == 0 && devtools) {
if (!Person::players[i]->isLanding())
Person::players[i]->tempdeltav = deltav;
if (Person::players[i]->tempdeltav < 0)
if (Person::players[i]->animTarget == jumpupanim &&
(((!floatjump &&
!editorenabled) ||
- !debugmode) ||
+ !devtools) ||
Person::players[i]->aitype != playercontrolled)) {
if (Person::players[i]->jumppower > multiplier * 6) {
Person::players[i]->velocity.y += multiplier * 6;
Person::players[i]->jumppower = 0;
}
}
- if (((floatjump || editorenabled) && debugmode) && i == 0)
+ if (((floatjump || editorenabled) && devtools) && i == 0)
Person::players[i]->velocity.y += multiplier * 30;
}
if (changedelay > 0 && !Person::players[0]->dead && !won) {
//high scores, awards, win
if (campaign) {
- accountactive->winCampaignLevel(whichchoice, bonustotal, leveltime);
+ Account::active().winCampaignLevel(whichchoice, bonustotal, leveltime);
scoreadded = 1;
} else {
- accountactive->winLevel(whichlevel, bonustotal - startbonustotal, leveltime);
+ wonleveltime = leveltime;
+ Account::active().winLevel(whichlevel, bonustotal - startbonustotal, leveltime);
}
won = 1;
}
fireSound(firestartsound);
- Loadlevel(campaignlevels[accountactive->getCampaignChoicesMade()].mapname.c_str());
+ Loadlevel(campaignlevels[Account::active().getCampaignChoicesMade()].mapname.c_str());
fireSound();