diff --git a/src/format.h b/src/format.h index cabac10..258ed90 100644 --- a/src/format.h +++ b/src/format.h @@ -277,9 +277,10 @@ namespace TR { SND_INV_PAGE = 115, SND_HEALTH = 116, - SND_EFFECT_8 = 119, + SND_STAIRS2SLOPE = 119, SND_DART = 151, + SND_EXPLOSION = 170, SND_SECRET = 173, }; diff --git a/src/lara.h b/src/lara.h index 4deb977..dfaaa74 100644 --- a/src/lara.h +++ b/src/lara.h @@ -466,11 +466,13 @@ struct Lara : Character { //reset(19, vec3(33368, 19968, 45643), 270 * DEG2RAD); // level 4 (damocles) //reset(24, vec3(45609, 18176, 41500), 90 * DEG2RAD); // level 4 (thor) //reset(99, vec3(45562, -3328, 63366), 225 * DEG2RAD); // level 7a (flipmap) + //reset(90, vec3(19438, 3840, 78341), 90 * DEG2RAD); // level 7a (statues) //reset(57, vec3(54844, -3328, 53145), 0); // level 8b (bridge switch) //reset(12, vec3(34236, -2415, 14974), 0); // level 8b (sphinx) //reset(0, vec3(40913, -1012, 42252), PI); // level 8c //reset(30, vec3(69689, -8448, 34922), 330 * DEG2RAD); // Level 10a (cabin) //reset(27, vec3(52631, -4352, 57893), 270 * DEG2RAD); // Level 10a (drill) + //reset(44, vec3(75803, -11008, 21097), 90 * DEG2RAD); // Level 10a (boat) //reset(50, vec3(53703, -18688, 13769), PI); // Level 10c (scion holder) //reset(19, vec3(35364, -512, 40199), PI * 0.5f); // Level 10c (lava flow) //reset(9, vec3(69074, -14592, 25192), 0); // Level 10c (trap slam) diff --git a/src/level.h b/src/level.h index e1db377..f263c1d 100644 --- a/src/level.h +++ b/src/level.h @@ -188,29 +188,31 @@ struct Level : IGame { } virtual void setEffect(TR::Effect effect, float param) { - if (effect == TR::Effect::NONE) - return; - - if (effect == TR::Effect::FLOOR_SHAKE) { - camera->shake = param; - return; - } - - if (effect == TR::Effect::FLICKER) - flickerIdx = 0; - - if (effect == TR::Effect::FLOOD) { - Sound::Sample *sample = playSound(TR::SND_FLOOD, vec3(), 0); - if (sample) - sample->setVolume(0.0f, 4.0f); - } - - if (effect == TR::Effect::STAIRS2SLOPE) { - playSound(TR::SND_EFFECT_8, vec3(), 0); - } - this->effect = effect; this->effectTimer = 0.0f; + + switch (effect) { + case TR::Effect::NONE : return; + case TR::Effect::FLOOR_SHAKE : + camera->shake = param; + return; + case TR::Effect::FLICKER : + flickerIdx = 0; + break; + case TR::Effect::FLOOD : { + Sound::Sample *sample = playSound(TR::SND_FLOOD, vec3(), 0); + if (sample) + sample->setVolume(0.0f, 4.0f); + break; + } + case TR::Effect::STAIRS2SLOPE : + playSound(TR::SND_STAIRS2SLOPE, vec3(), 0); + break; + case TR::Effect::EXPLOSION : + playSound(TR::SND_EXPLOSION, vec3(0), 0); + camera->shake = 1.0f; + break; + } } virtual void checkTrigger(Controller *controller, bool heavy) { @@ -449,6 +451,9 @@ struct Level : IGame { case TR::Entity::CABIN : entity.controller = new Cabin(this, i); break; + case TR::Entity::BOAT : + entity.controller = new Boat(this, i); + break; default : if (entity.modelIndex > 0) entity.controller = new Controller(this, i); diff --git a/src/trigger.h b/src/trigger.h index c01d2cb..4249490 100644 --- a/src/trigger.h +++ b/src/trigger.h @@ -762,6 +762,28 @@ struct Cabin : Controller { } }; + +struct Boat : Controller { + enum { + STATE_IDLE = 1, + STATE_MOVE, + STATE_STOP, + }; + + Boat(IGame *game, int entity) : Controller(game, entity) {} + + virtual void update() { + switch (state) { + case STATE_IDLE : animation.setState(STATE_MOVE); break; + case STATE_MOVE : animation.setState(STATE_STOP); break; + case STATE_STOP : deactivate(true); getEntity().flags.invisible = true; break; + } + updateAnimation(true); + pos = pos + getDir() * (animation.getSpeed() * Core::deltaTime * 30.0f); + } +}; + + struct KeyHole : Controller { KeyHole(IGame *game, int entity) : Controller(game, entity) {}