1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-13 00:24:24 +02:00

#22 add Nathla Mines cabin

This commit is contained in:
XProger
2017-09-25 05:25:31 +03:00
parent 2942053b7d
commit 936839062a
3 changed files with 35 additions and 1 deletions

View File

@@ -173,7 +173,7 @@
E( UNUSED_12 ) \
E( SMOKE ) \
E( STATUE ) \
E( SHACK ) \
E( CABIN ) \
E( MUTANT_EGG_SMALL ) \
E( RICOCHET ) \
E( SPARKLES ) \

View File

@@ -439,6 +439,9 @@ struct Level : IGame {
case TR::Entity::TRAP_LAVA :
entity.controller = new TrapLava(this, i);
break;
case TR::Entity::CABIN :
entity.controller = new Cabin(this, i);
break;
default :
if (entity.modelIndex > 0)
entity.controller = new Controller(this, i);

View File

@@ -710,6 +710,37 @@ struct TrapLava : Controller {
};
struct Cabin : Controller {
enum {
STATE_UP,
STATE_DOWN_1,
STATE_DOWN_2,
STATE_DOWN_3,
STATE_GROUND,
};
Cabin(IGame *game, int entity) : Controller(game, entity) {}
virtual void update() {
TR::Entity &e = getEntity();
if (e.flags.active == TR::ACTIVE) {
if (state >= STATE_UP && state <= STATE_DOWN_2)
animation.setState(state + 1);
e.flags.active = 0;
}
if (state == STATE_GROUND) {
e.flags.invisible = true;
level->flipmap[3].active = TR::ACTIVE;
level->isFlipped = !level->isFlipped;
deactivate(true);
}
updateAnimation(true);
}
};
struct KeyHole : Controller {
KeyHole(IGame *game, int entity) : Controller(game, entity) {}