1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add event manager and use it to trigger sounds

This commit is contained in:
Perttu Ahola 2012-03-23 20:23:03 +02:00
parent e53794868e
commit 6c14025b2d
15 changed files with 388 additions and 14 deletions

View file

@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "noise.h" // easeCurve
#include "gamedef.h"
#include "sound.h"
#include "event.h"
Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
IGameDef *gamedef):
@ -177,8 +178,10 @@ void Camera::step(f32 dtime)
bool step = (was == 0 ||
(was < 0.5f && m_view_bobbing_anim >= 0.5f) ||
(was > 0.5f && m_view_bobbing_anim <= 0.5f));
if(step)
m_gamedef->sound()->playSound("default_grass_walk", false, 1.0);
if(step){
MtEvent *e = new SimpleTriggerEvent("ViewBobbingStep");
m_gamedef->event()->put(e);
}
}
}
@ -190,7 +193,8 @@ void Camera::step(f32 dtime)
{
m_digging_anim = 0;
m_digging_button = -1;
m_gamedef->sound()->playSound("dig", false, 1.0);
MtEvent *e = new SimpleTriggerEvent("CameraDig");
m_gamedef->event()->put(e);
}
}
}