- [NEW] Ja funcionen els skills
- Treballant en les parts
This commit is contained in:
@@ -422,22 +422,30 @@ namespace actor
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t push(actor_t *act, uint8_t push)
|
||||
uint8_t push(actor_t *source, actor_t *act, uint8_t push)
|
||||
{
|
||||
uint8_t result = 0;
|
||||
if (act->flags & FLAG_PUSHABLE) act->push |= push;
|
||||
if ( (act->flags & FLAG_PUSHABLE) && ( !(source->flags&FLAG_HERO) || (hero::getSkills()&SKILL_GLOVES) ) ) act->push |= push;
|
||||
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 (source->flags&FLAG_HERO)
|
||||
{
|
||||
if (act->name[0]=='B') // Es un booster
|
||||
if (act->flags & FLAG_SPECIAL)
|
||||
{
|
||||
hero::collectBooster(act->name[1]-48, (act->name[3]-48)*10+(act->name[4]-48));
|
||||
actor::remove(act);
|
||||
// [TODO 02/07/2024] Fer que faça un fumet o algo al desapareixer les coses
|
||||
if (act->name[0]=='B') { // Es un booster
|
||||
hero::collectBooster(act->name[1]-48, (act->name[3]-48)*10+(act->name[4]-48));
|
||||
actor::remove(act);
|
||||
} else if (act->name[0]=='S') { // Es un skill
|
||||
hero::giveSkill(&act->name[2]);
|
||||
actor::remove(act);
|
||||
} else if ( (act->name[0]=='P') && (hero::getSkills()&SKILL_BAG) ) { // Es una part
|
||||
hero::pickPart(&act->name[2]);
|
||||
actor::remove(act);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -519,7 +527,7 @@ namespace actor
|
||||
act->push |= PUSH_YP;
|
||||
}
|
||||
}
|
||||
if (input::keyPressed(SDL_SCANCODE_RETURN))
|
||||
if (input::keyPressed(SDL_SCANCODE_RETURN) && (hero::getSkills()&SKILL_PANTS))
|
||||
{
|
||||
if (picked)
|
||||
{
|
||||
@@ -547,7 +555,7 @@ namespace actor
|
||||
if (!input::keyDown(SDL_SCANCODE_SPACE)) act->pos.z -= height;
|
||||
}
|
||||
}
|
||||
if ( input::keyDown(SDL_SCANCODE_SPACE) && (act->pos.y+act->size.y)<=max.y && act->pos.y>=min.y && (act->pos.x+act->size.x)<=max.x && act->pos.x>=min.x && act->react_mask==0 && (act->pos.z==0 || act->below))
|
||||
if ( input::keyDown(SDL_SCANCODE_SPACE) && (hero::getSkills()&SKILL_SHOES) && (act->pos.y+act->size.y)<=max.y && act->pos.y>=min.y && (act->pos.x+act->size.x)<=max.x && act->pos.x>=min.x && act->react_mask==0 && (act->pos.z==0 || act->below))
|
||||
{
|
||||
// [RZC 14/05/2024] hack usant react_mask i react_push del heroi. Llegir més avall.
|
||||
act->react_mask=hero::getBoostJump()>0 ? 2 : 1; // =1 estic botant (anant cap amunt)
|
||||
@@ -710,7 +718,7 @@ namespace actor
|
||||
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);
|
||||
if (other) act->push |= push(act, other, PUSH_XN);
|
||||
act->pos.x+=vel;
|
||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||
}
|
||||
@@ -718,7 +726,7 @@ namespace actor
|
||||
{
|
||||
// Si tenim a algú damunt, el movem també
|
||||
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
||||
push(act->above, PUSH_XN);
|
||||
push(act, act->above, PUSH_XN);
|
||||
}
|
||||
|
||||
// Si ja havem atravesat la porta, ens movem a la porta de l'altra costat
|
||||
@@ -739,14 +747,14 @@ namespace actor
|
||||
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);
|
||||
if (other) act->push |= push(act, other, PUSH_XP);
|
||||
act->pos.x-=vel;
|
||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
||||
push(act->above, PUSH_XP);
|
||||
push(act, act->above, PUSH_XP);
|
||||
}
|
||||
|
||||
if ((act->pos.x+act->size.x)>max.x+4) {
|
||||
@@ -766,14 +774,14 @@ namespace actor
|
||||
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);
|
||||
if (other) act->push |= push(act, other, PUSH_YN);
|
||||
act->pos.y+=vel;
|
||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
||||
push(act->above, PUSH_YN);
|
||||
push(act, act->above, PUSH_YN);
|
||||
}
|
||||
|
||||
if (act->pos.y<min.y-4) {
|
||||
@@ -793,14 +801,14 @@ namespace actor
|
||||
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);
|
||||
if (other) act->push |= push(act, other, PUSH_YP);
|
||||
act->pos.y-=vel;
|
||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
||||
push(act->above, PUSH_YP);
|
||||
push(act, act->above, PUSH_YP);
|
||||
}
|
||||
|
||||
if ((act->pos.y+act->size.y)>max.y+4) {
|
||||
@@ -836,7 +844,7 @@ namespace actor
|
||||
// ...i encara està baix...
|
||||
if (is_above(act, act->below)) {
|
||||
// ...li pase a ell el push, neteje el meu flag, canvie direcció si pertoca i me ane
|
||||
act->push |= push(act->below, PUSH_ZN);
|
||||
act->push |= push(act, act->below, PUSH_ZN);
|
||||
act->push &= ~PUSH_ZN;
|
||||
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
||||
return;
|
||||
@@ -856,7 +864,7 @@ namespace actor
|
||||
act->below = below;
|
||||
below->above = act;
|
||||
// ... i li passem el push, netejem el meu flag i gonnem
|
||||
act->push |= push(act->below, PUSH_ZN);
|
||||
act->push |= push(act, act->below, PUSH_ZN);
|
||||
act->push &= ~PUSH_ZN;
|
||||
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
||||
return;
|
||||
@@ -1299,9 +1307,27 @@ namespace actor
|
||||
}
|
||||
|
||||
|
||||
void giveSkill(int skill)
|
||||
const int getSkillFromString(char *skill)
|
||||
{
|
||||
skills |= skill;
|
||||
static const char *skillset_name[4] = {"SHOES", "GLOBES", "PANTS", "BAG"};
|
||||
for (int i=0;i<4;++i)
|
||||
{
|
||||
if (strcmp(skill, skillset_name[i])==0)
|
||||
{
|
||||
return 1<<i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void giveSkill(char *skill)
|
||||
{
|
||||
skills |= getSkillFromString(skill);
|
||||
}
|
||||
|
||||
bool wasSkillCollected(char *skill)
|
||||
{
|
||||
return skills & getSkillFromString(skill);
|
||||
}
|
||||
|
||||
int getSkills()
|
||||
@@ -1309,9 +1335,27 @@ namespace actor
|
||||
return skills;
|
||||
}
|
||||
|
||||
void pickPart(int part)
|
||||
const int getPartFromString(char *part)
|
||||
{
|
||||
parts |= part;
|
||||
static const char *partset_name[6] = {"FILTER", "PUMP", "TIMER", "SALT", "PIPE", "ELBOW"};
|
||||
for (int i=0;i<4;++i)
|
||||
{
|
||||
if (strcmp(part, partset_name[i])==0)
|
||||
{
|
||||
return 1<<i;
|
||||
}
|
||||
}
|
||||
return PART_NONE;
|
||||
}
|
||||
|
||||
void pickPart(char *part)
|
||||
{
|
||||
parts |= getPartFromString(part);
|
||||
}
|
||||
|
||||
bool wasPartCollected(char *part)
|
||||
{
|
||||
return parts & getPartFromString(part);
|
||||
}
|
||||
|
||||
int getParts()
|
||||
|
||||
Reference in New Issue
Block a user