- Comencem a implementar els actors especials

- [NEW] Run booster implementat
This commit is contained in:
2024-07-01 14:06:23 +02:00
parent 2b5a124ddf
commit 8789bea813
5 changed files with 128 additions and 21 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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.x<min.x || act->pos.y>max.y || act->pos.y<min.y) )
//return;
int vel = (act->flags&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.x<min.x && ( !(room::getDoors()&DOOR_XN) || (act->pos.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.y<min.y && ( !(room::getDoors()&DOOR_YN) || (act->pos.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;
}
}
}

View File

@@ -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();
}
}

View File

@@ -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