|
|
@ -2,41 +2,49 @@ |
|
|
|
#include "textures.hpp" |
|
|
|
#include "textures.hpp" |
|
|
|
#include "sound.hpp" |
|
|
|
#include "sound.hpp" |
|
|
|
#include "autowalker.hpp" |
|
|
|
#include "autowalker.hpp" |
|
|
|
|
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) { |
|
|
|
int main(int argc, char* argv[]) { |
|
|
|
textures::init(); |
|
|
|
try { |
|
|
|
sound::init(); |
|
|
|
textures::init(); |
|
|
|
sound::mute(false); |
|
|
|
sound::init(); |
|
|
|
gui::FSM main; |
|
|
|
sound::mute(false); |
|
|
|
main.event(gui::Event::STARTED); |
|
|
|
gui::FSM main; |
|
|
|
Autowalker walker(main); |
|
|
|
main.event(gui::Event::STARTED); |
|
|
|
|
|
|
|
Autowalker walker(main); |
|
|
|
|
|
|
|
|
|
|
|
sound::play("ambient_1", true); |
|
|
|
sound::play("ambient_1", true); |
|
|
|
|
|
|
|
|
|
|
|
if(argc > 1 && argv[1][0] == 't') { |
|
|
|
if(argc > 1 && argv[1][0] == 't') { |
|
|
|
walker.start_autowalk(); |
|
|
|
walker.start_autowalk(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
while(main.active()) { |
|
|
|
while(main.active()) { |
|
|
|
main.render(); |
|
|
|
main.render(); |
|
|
|
|
|
|
|
|
|
|
|
// ZED: need to sort out how to deal with this in the FSM
|
|
|
|
// ZED: need to sort out how to deal with this in the FSM
|
|
|
|
if(main.in_state(gui::State::IDLE) |
|
|
|
if(main.in_state(gui::State::IDLE) |
|
|
|
|| main.in_state(gui::State::NEXT_LEVEL) |
|
|
|
|| main.in_state(gui::State::NEXT_LEVEL) |
|
|
|
|| main.in_state(gui::State::MAPPING) |
|
|
|
|| main.in_state(gui::State::MAPPING) |
|
|
|
|| main.in_state(gui::State::IN_COMBAT)) |
|
|
|
|| main.in_state(gui::State::IN_COMBAT)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(main.autowalking) { |
|
|
|
if(main.autowalking) { |
|
|
|
walker.autowalk(); |
|
|
|
walker.autowalk(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
main.keyboard_mouse(); |
|
|
|
main.keyboard_mouse(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else{ |
|
|
|
|
|
|
|
main.event(gui::Event::TICK); |
|
|
|
} |
|
|
|
} |
|
|
|
} else{ |
|
|
|
|
|
|
|
main.event(gui::Event::TICK); |
|
|
|
main.handle_world_events(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
main.handle_world_events(); |
|
|
|
return 0; |
|
|
|
|
|
|
|
} catch(const std::system_error& e) { |
|
|
|
|
|
|
|
std::cout << "WARNING: On OSX you'll get this error on shutdown.\n"; |
|
|
|
|
|
|
|
std::cout << "Caught system_error with code " |
|
|
|
|
|
|
|
"[" << e.code() << "] meaning " |
|
|
|
|
|
|
|
"[" << e.what() << "]\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|