diff --git a/data/rooms/06.txt b/data/rooms/06.txt index d491063..04a089b 100644 --- a/data/rooms/06.txt +++ b/data/rooms/06.txt @@ -9,6 +9,31 @@ under-door-texture: 0 exit-xn: 5 exit-zp: 7 +actor{ + name: B1 + bmp: objectes.gif + bmp-rect: 114 78 15 18 + bmp-offset: -8 22 + pos: 0 0 0 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: ANIMATED SPECIAL + movement: CW +} + +actor{ + name: LIFT + bmp: caixes.gif + bmp-rect: 32 32 32 24 + bmp-offset: 0 24 + pos: 56 0 0 + size: 8 8 4 + orient: ZP + flags: MOVING + movement: Z +} + actor{ name: YONKI bmp: caixes.gif @@ -54,15 +79,3 @@ actor{ size: 8 8 8 movement: CW } - -actor{ - name: LIFT - bmp: caixes.gif - bmp-rect: 32 32 32 24 - bmp-offset: 0 24 - pos: 56 0 0 - size: 8 8 4 - orient: ZP - flags: MOVING - movement: Z -} diff --git a/data/templates.txt b/data/templates.txt index fce7075..b7e8c06 100644 --- a/data/templates.txt +++ b/data/templates.txt @@ -53,3 +53,16 @@ actor{ flags: MOVING movement: Z } + +actor{ + name: BOOSTER + bmp: objectes.gif + bmp-rect: 114 78 15 18 + bmp-offset: -8 22 + pos: 0 0 0 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: ANIMATED SPECIAL + movement: CW +} diff --git a/source/actor.cpp b/source/actor.cpp index 56f5b3e..3aa39e9 100644 --- a/source/actor.cpp +++ b/source/actor.cpp @@ -429,6 +429,15 @@ namespace actor if ( (act->flags & FLAG_REACTIVE) && (act->react_mask & push) ) result = act->react_push; if (act->flags & FLAG_DEADLY) result |= PUSH_KILL; + if (act->flags & FLAG_SPECIAL) + { + if (act->name[0]=='B') // Es un booster + { + hero::setBooster(act->name[1]-48); + actor::remove(act); + } + } + return result; } @@ -642,6 +651,7 @@ namespace actor //if ((act->flags&FLAG_HERO) && (act->pos.x>max.x || act->pos.xpos.y>max.y || act->pos.yflags&FLAG_HERO) && (hero::getBooster()==BOOST_RUN) ? 2 : 1; if (act->push & PUSH_ZP) { if (act->pos.z>=max.z) @@ -689,12 +699,12 @@ namespace actor } if (act->push & PUSH_XN) { - act->pos.x--; + act->pos.x-=vel; actor::actor_t *other = actor::get_collision(act); if (other || ( act->pos.xpos.y!=28) || (act->pos.z!=room::getDoor(XN)*4) || !(act->flags&FLAG_HERO) ) )) { if (other) act->push |= push(other, PUSH_XN); - act->pos.x++; + act->pos.x+=vel; if (act->flags & FLAG_MOVING) changeMoving(act); } else @@ -718,12 +728,12 @@ namespace actor } if (act->push & PUSH_XP) { - act->pos.x++; + act->pos.x+=vel; actor::actor_t *other = actor::get_collision(act); if (other || ((act->pos.x+act->size.x)>max.x && ( !(room::getDoors()&DOOR_XP) || (act->pos.y!=28) || !(act->flags&FLAG_HERO) ) )) { if (other) act->push |= push(other, PUSH_XP); - act->pos.x--; + act->pos.x-=vel; if (act->flags & FLAG_MOVING) changeMoving(act); } else @@ -745,12 +755,12 @@ namespace actor } if (act->push & PUSH_YN) { - act->pos.y--; + act->pos.y-=vel; actor::actor_t *other = actor::get_collision(act); if (other || ( act->pos.ypos.x!=28) || (act->pos.z!=room::getDoor(YN)*4) || !(act->flags&FLAG_HERO) ) )) { if (other) act->push |= push(other, PUSH_YN); - act->pos.y++; + act->pos.y+=vel; if (act->flags & FLAG_MOVING) changeMoving(act); } else @@ -772,12 +782,12 @@ namespace actor } if (act->push & PUSH_YP) { - act->pos.y++; + act->pos.y+=vel; actor::actor_t *other = actor::get_collision(act); if (other || ( (act->pos.y+act->size.y)>max.y && ( !(room::getDoors()&DOOR_YP) || (act->pos.x!=28) || !(act->flags&FLAG_HERO) ) )) { if (other) act->push |= push(other, PUSH_YP); - act->pos.y--; + act->pos.y-=vel; if (act->flags & FLAG_MOVING) changeMoving(act); } else @@ -1217,4 +1227,41 @@ namespace actor save(); } } + + namespace hero + { + int boosters = BOOST_NONE; + int skills = SKILL_NONE; + int parts = PART_NONE; + + void setBooster(int booster) + { + boosters = booster; + } + + int getBooster() + { + return boosters; + } + + void giveSkill(int skill) + { + skills |= skill; + } + + int getSkills() + { + return skills; + } + + void pickPart(int part) + { + parts |= part; + } + + int getParts() + { + return parts; + } + } } diff --git a/source/actor.h b/source/actor.h index bf8b5b1..fe19fd7 100644 --- a/source/actor.h +++ b/source/actor.h @@ -42,6 +42,28 @@ #define MOV_RAND 6 // Es mou en direcció aleatòria #define MOV_HUNT 7 // Persegueix al heroi +// Boosters +#define BOOST_NONE 0 +#define BOOST_RUN 1 +#define BOOST_GOD 2 +#define BOOST_LONG_JUMP 3 +#define BOOST_TALL_JUMP 4 + +// Skills +#define SKILL_NONE 0 +#define SKILL_SHOES 1 +#define SKILL_GLOVES 2 +#define SKILL_PANTS 4 +#define SKILL_BAG 8 + +// Parts +#define PART_NONE 0 +#define PART_FILTER 1 +#define PART_PUMP 2 +#define PART_TIMER 4 +#define PART_SALT 8 +#define PART_PIPE 16 +#define PART_ELBOW 32 namespace actor { @@ -142,4 +164,16 @@ namespace actor void copy(actor_t *dest, actor_t *source); void add(actor_t *act); } + + namespace hero + { + void setBooster(int booster); + int getBooster(); + + void giveSkill(int skill); + int getSkills(); + + void pickPart(int part); + int getParts(); + } } \ No newline at end of file diff --git a/todo.txt b/todo.txt index c237a24..43670ae 100644 --- a/todo.txt +++ b/todo.txt @@ -35,7 +35,7 @@ x Gràfics de bancada de cuina x Tubo x Codo -- Implementar eixides per dalt +x Implementar eixides per dalt x Implementar eixides per baix x Implementar pickar objectes - Implementar inventari