#include <float.h>
#include <sstream>
-#include "yeti.h"
-#include "object/camera.h"
-#include "yeti_stalactite.h"
-#include "bouncing_snowball.h"
-#include "game_session.h"
-#include "scripting/script_interpreter.h"
+#include <memory>
+#include "yeti.hpp"
+#include "object/camera.hpp"
+#include "yeti_stalactite.hpp"
+#include "bouncing_snowball.hpp"
+#include "game_session.hpp"
+#include "scripting/script_interpreter.hpp"
static const float JUMP_VEL1 = 250;
static const float JUMP_VEL2 = 700;
sprite->set_action("right");
state = INIT;
side = LEFT;
+#if 0
sound_manager->preload_sound("yeti_gna");
sound_manager->preload_sound("yeti_roar");
+#endif
hit_points = INITIAL_HITPOINTS;
reader.get("dead-script", dead_script);
countMe = false;
Yeti::draw(DrawingContext& context)
{
// we blink when we are safe
- if(safe_timer.started() && size_t(global_time*40)%2)
+ if(safe_timer.started() && size_t(game_time*40)%2)
return;
BadGuy::draw(context);
case ANGRY_JUMPING:
if(timer.check()) {
// jump
- sound_manager->play_sound("yeti_gna");
+ sound_manager->play("sounds/yeti_gna.wav");
physic.set_velocity_y(JUMP_VEL1);
}
break;
return true;
player.bounce(*this);
- sound_manager->play_sound("yeti_roar");
+ sound_manager->play("sounds/yeti_roar.wav");
hit_points--;
if(hit_points <= 0) {
sprite->set_action("dead");
// start script
if(dead_script != "") {
- try {
- ScriptInterpreter* interpreter
- = new ScriptInterpreter(GameSession::current()->get_working_directory());
- interpreter->register_sector(Sector::current());
- std::istringstream in(dead_script);
- interpreter->load_script(in, "Yeti - dead-script");
- interpreter->start_script();
- Sector::current()->add_object(interpreter);
- } catch(std::exception& e) {
- std::cerr << "Couldn't execute yeti dead script: " << e.what() << "\n";
- }
+ ScriptInterpreter::add_script_object(Sector::current(),
+ "Yeti - dead-script", dead_script);
}
} else {
safe_timer.start(SAFE_TIME);