- 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

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