diff --git a/data/rooms/01.txt b/data/rooms/01.txt index df5afb4..3f837b4 100644 --- a/data/rooms/01.txt +++ b/data/rooms/01.txt @@ -20,6 +20,18 @@ actor{ movement: CW } +actor{ + name: TAULA01 + bmp: caixes.gif + bmp-rect: 128 32 32 32 + bmp-offset: 0 32 + pos: 8 24 0 + size: 8 8 8 + orient: YP + flags: ORIENTABLE + movement: CW +} + actor{ name: TAULETA bmp: caixes.gif @@ -30,6 +42,19 @@ actor{ movement: CW } +actor{ + name: S-SHOES + bmp: objectes.gif + bmp-rect: 162 0 28 22 + bmp-offset: -3 24 + pos: 48 8 0 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: SPECIAL + movement: CW +} + actor{ name: ARMARI02 bmp: caixes.gif @@ -62,18 +87,6 @@ actor{ movement: CW } -actor{ - name: TAULA01 - bmp: caixes.gif - bmp-rect: 128 32 32 32 - bmp-offset: 0 32 - pos: 8 24 0 - size: 8 8 8 - orient: YP - flags: ORIENTABLE - movement: CW -} - actor{ name: TAULA02 bmp: caixes.gif diff --git a/data/templates.txt b/data/templates.txt index b7e8c06..01454d7 100644 --- a/data/templates.txt +++ b/data/templates.txt @@ -66,3 +66,16 @@ actor{ flags: ANIMATED SPECIAL movement: CW } + +actor{ + name: S-SHOES + bmp: objectes.gif + bmp-rect: 162 0 28 22 + bmp-offset: -3 24 + pos: 48 8 0 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: SPECIAL + movement: CW +} diff --git a/source/actor.cpp b/source/actor.cpp index 283f75e..38ed588 100644 --- a/source/actor.cpp +++ b/source/actor.cpp @@ -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.xpos.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.ypos.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.ypos.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<flags & FLAG_SPECIAL) { - if (act->name[0]=='B') // Es un booster - { + if (act->name[0]=='B') { // Es un booster if (actor::hero::wasBoosterCollected((act->name[3]-48)*10+(act->name[4]-48))) { actor::remove(act); act = nullptr; } + } else if (act->name[0]=='S') { // Es un skill + if (actor::hero::wasSkillCollected(&act->name[2])) + { + actor::remove(act); + act = nullptr; + } + } else if (act->name[0]=='P') { // Es una part + if (actor::hero::wasPartCollected(&act->name[2])) + { + actor::remove(act); + act = nullptr; + } } } if (act) actor::setDirty(act, true);