- [FIX] Correcció per a poder arrimar a la pared els objectes mes xicotets de 8 en x o y.
This commit is contained in:
@@ -407,7 +407,7 @@ namespace actor
|
||||
if ( input::keyDown(SDL_SCANCODE_LEFT) )
|
||||
{
|
||||
act->orient=PUSH_XN;
|
||||
if ( (act->pos.x>min.x && act->pos.y>=min.y && act->pos.y<=max.y) || ( (room::getDoors()&DOOR_XN) && (act->pos.y>=24) && (act->pos.y<=32) ) )
|
||||
if ( (act->pos.x>min.x && act->pos.y>=min.y && (act->pos.y+act->size.y)<=max.y) || ( (room::getDoors()&DOOR_XN) && (act->pos.y>=24) && (act->pos.y<=32) ) )
|
||||
{
|
||||
moving = true;
|
||||
if ( (act->pos.x<=min.x) && (act->pos.z==room::getDoor(XN)*4) && (room::getDoors()&DOOR_XN) ) {
|
||||
@@ -424,10 +424,10 @@ namespace actor
|
||||
if ( input::keyDown(SDL_SCANCODE_RIGHT) )
|
||||
{
|
||||
act->orient=PUSH_XP;
|
||||
if ( (act->pos.x<max.x && act->pos.y>=min.y && act->pos.y<=max.y) || ( (room::getDoors()&DOOR_XP) && (act->pos.y>=24) && (act->pos.y<=32) ) )
|
||||
if ( ((act->pos.x+act->size.x)<max.x && act->pos.y>=min.y && (act->pos.y+act->size.y)<=max.y) || ( (room::getDoors()&DOOR_XP) && (act->pos.y>=24) && (act->pos.y<=32) ) )
|
||||
{
|
||||
moving = true;
|
||||
if ( (act->pos.x>=max.x) && (act->pos.z==room::getDoor(XP)*4) && (room::getDoors()&DOOR_XP) ) {
|
||||
if ( ((act->pos.x+act->size.x)>=max.x) && (act->pos.z==room::getDoor(XP)*4) && (room::getDoors()&DOOR_XP) ) {
|
||||
if (act->pos.y<28)
|
||||
act->push |= PUSH_YP;
|
||||
else if (act->pos.y>28)
|
||||
@@ -441,7 +441,7 @@ namespace actor
|
||||
if ( input::keyDown(SDL_SCANCODE_UP) )
|
||||
{
|
||||
act->orient=PUSH_YN;
|
||||
if ( (act->pos.y>min.y && act->pos.x>=min.x && act->pos.x<=max.x) || ( (room::getDoors()&DOOR_YN) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
||||
if ( (act->pos.y>min.y && act->pos.x>=min.x && (act->pos.x+act->size.x)<=max.x) || ( (room::getDoors()&DOOR_YN) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
||||
{
|
||||
moving = true;
|
||||
if ( (act->pos.y<=min.y) && (act->pos.z==room::getDoor(YN)*4) && (room::getDoors()&DOOR_YN) ) {
|
||||
@@ -458,10 +458,10 @@ namespace actor
|
||||
if ( input::keyDown(SDL_SCANCODE_DOWN) )
|
||||
{
|
||||
act->orient=PUSH_YP;
|
||||
if ( (act->pos.y<max.y && act->pos.x>=min.x && act->pos.x<=max.x) || ( (room::getDoors()&DOOR_YP) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
||||
if ( ((act->pos.y+act->size.y)<max.y && act->pos.x>=min.x && (act->pos.x+act->size.x)<=max.x) || ( (room::getDoors()&DOOR_YP) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
||||
{
|
||||
moving = true;
|
||||
if ( (act->pos.y>=max.y) && (act->pos.z==room::getDoor(YP)*4) && (room::getDoors()&DOOR_YP) ) {
|
||||
if ( ((act->pos.y+act->size.y)>=max.y) && (act->pos.z==room::getDoor(YP)*4) && (room::getDoors()&DOOR_YP) ) {
|
||||
if (act->pos.x<28)
|
||||
act->push |= PUSH_XP;
|
||||
else if (act->pos.x>28)
|
||||
@@ -472,7 +472,7 @@ namespace actor
|
||||
act->push |= PUSH_YP;
|
||||
}
|
||||
}
|
||||
if ( input::keyDown(SDL_SCANCODE_SPACE) && act->pos.y<=max.y && act->pos.y>=min.y && act->pos.x<=max.x && act->pos.x>=min.x && act->react_mask==0 && (act->pos.z==0 || act->below))
|
||||
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))
|
||||
{
|
||||
// [RZC 14/05/2024] hack usant react_mask i react_push del heroi. Llegir més avall.
|
||||
act->react_mask=1; // =1 estic botant (anant cap amunt)
|
||||
@@ -494,7 +494,7 @@ namespace actor
|
||||
if (act->react_mask)
|
||||
{
|
||||
// Si topetem en una vora de l'habitació, s'acabat el bot
|
||||
if (act->pos.x>max.x || act->pos.x<min.x || act->pos.y>max.y || act->pos.y<min.y) act->react_push=9;
|
||||
if ((act->pos.x+act->size.x)>max.x || act->pos.x<min.x || (act->pos.y+act->size.y)>max.y || act->pos.y<min.y) act->react_push=9;
|
||||
|
||||
// Si encara està botant (react_push < 8)...
|
||||
if (act->react_push<9)
|
||||
@@ -640,7 +640,7 @@ namespace actor
|
||||
if (act->push & PUSH_XP) {
|
||||
act->pos.x++;
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || (act->pos.x>max.x && ( !(room::getDoors()&DOOR_XP) || (act->pos.y!=28) || !(act->flags&FLAG_HERO) ) ))
|
||||
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--;
|
||||
@@ -652,7 +652,7 @@ namespace actor
|
||||
push(act->above, PUSH_XP);
|
||||
}
|
||||
|
||||
if (act->pos.x>max.x+4) {
|
||||
if ((act->pos.x+act->size.x)>max.x+4) {
|
||||
room::load(room::getExit(XP));
|
||||
act->pos.x = room::getMin().x-3;
|
||||
act->pos.z = room::getDoor(XN)*4;
|
||||
@@ -692,7 +692,7 @@ namespace actor
|
||||
if (act->push & PUSH_YP) {
|
||||
act->pos.y++;
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || ( act->pos.y>max.y && ( !(room::getDoors()&DOOR_YP) || (act->pos.x!=28) || !(act->flags&FLAG_HERO) ) ))
|
||||
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--;
|
||||
@@ -704,7 +704,7 @@ namespace actor
|
||||
push(act->above, PUSH_YP);
|
||||
}
|
||||
|
||||
if (act->pos.y>max.y+4) {
|
||||
if ((act->pos.y+act->size.y)>max.y+4) {
|
||||
room::load(room::getExit(YP));
|
||||
act->pos.y = room::getMin().y-3;
|
||||
act->pos.z = room::getDoor(YN)*4;
|
||||
@@ -752,7 +752,7 @@ namespace actor
|
||||
}
|
||||
|
||||
// Si estem dins d'una porta, no caiguem. [TODO] Revisar
|
||||
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;
|
||||
if (act->flags&FLAG_HERO && ((act->pos.x+act->size.x)>max.x || act->pos.x<min.x || (act->pos.y+act->size.y)>max.y || act->pos.y<min.y) ) return;
|
||||
|
||||
// Si arribem fins ací, podem moure la posició
|
||||
act->push &= ~PUSH_ZN;
|
||||
|
||||
Reference in New Issue
Block a user