- Les portes nomes deixen passar en la Z correcta

- Les vores de les portes espenten cap a la porta
This commit is contained in:
2023-06-06 18:05:42 +02:00
parent 845772ed16
commit 4986e76864
4 changed files with 69 additions and 14 deletions

View File

@@ -168,8 +168,16 @@ namespace actor
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) ) )
{
act->push |= PUSH_XN;
moving = true;
if ( (act->pos.x<=min.x) && (act->pos.z==room::getDoor(XN)*4) && (room::getDoors()&DOOR_XN) ) {
if (act->pos.y<28)
act->push |= PUSH_YP;
else if (act->pos.y>28)
act->push |= PUSH_YN;
else
act->push |= PUSH_XN;
} else
act->push |= PUSH_XN;
}
}
if ( input::keyDown(SDL_SCANCODE_RIGHT) )
@@ -177,8 +185,16 @@ namespace actor
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) ) )
{
act->push |= PUSH_XP;
moving = true;
if ( (act->pos.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)
act->push |= PUSH_YN;
else
act->push |= PUSH_XP;
} else
act->push |= PUSH_XP;
}
}
if ( input::keyDown(SDL_SCANCODE_UP) )
@@ -186,8 +202,16 @@ namespace actor
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) ) )
{
act->push |= PUSH_YN;
moving = true;
if ( (act->pos.y<=min.y) && (act->pos.z==room::getDoor(YN)*4) && (room::getDoors()&DOOR_YN) ) {
if (act->pos.x<28)
act->push |= PUSH_XP;
else if (act->pos.x>28)
act->push |= PUSH_XN;
else
act->push |= PUSH_YN;
} else
act->push |= PUSH_YN;
}
}
if ( input::keyDown(SDL_SCANCODE_DOWN) )
@@ -195,8 +219,16 @@ namespace actor
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) ) )
{
act->push |= PUSH_YP;
moving = true;
if ( (act->pos.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)
act->push |= PUSH_XN;
else
act->push |= PUSH_YP;
} else
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))
@@ -215,6 +247,8 @@ namespace actor
if (act->react_mask)
{
if (act->pos.x>max.x || act->pos.x<min.x || act->pos.y>max.y || act->pos.y<min.y) act->react_push=8;
if (act->react_push<8)
{
act->pos.z++;
@@ -294,6 +328,9 @@ namespace actor
vec3_t min = room::getMin();
vec3_t max = room::getMax();
//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->push & PUSH_ZP) {
if (act->pos.z>=max.z)
{
@@ -316,7 +353,7 @@ namespace actor
if (act->push & PUSH_XN) {
act->pos.x--;
actor::actor_t *other = actor::get_collision(act);
if (other || ( act->pos.x<min.x && ( !(room::getDoors()&DOOR_XN) || (act->pos.y!=28) || !(act->flags&FLAG_HERO) ) ))
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 && other->flags & FLAG_PUSHABLE) other->push |= PUSH_XN;
act->pos.x++;
@@ -370,7 +407,7 @@ namespace actor
if (act->push & PUSH_YN) {
act->pos.y--;
actor::actor_t *other = actor::get_collision(act);
if (other || ( act->pos.y<min.y && ( !(room::getDoors()&DOOR_YN) || (act->pos.x!=28) || !(act->flags&FLAG_HERO) ) ))
if (other || ( act->pos.y<min.y && ( !(room::getDoors()&DOOR_YN) || (act->pos.x!=28) || (act->pos.z!=room::getDoor(XN)*4) || !(act->flags&FLAG_HERO) ) ))
{
if (other && other->flags & FLAG_PUSHABLE) other->push |= PUSH_YN;
act->pos.y++;
@@ -424,7 +461,7 @@ namespace actor
if (act->push & PUSH_ZN) {
act->pos.z--;
actor::actor_t *other = actor::get_collision(act);
if (act->pos.z<0 || other)
if (other || act->pos.z<0 || act->pos.x>max.x || act->pos.x<min.x || act->pos.y>max.y || act->pos.y<min.y)
{
//if (other && other->flags & FLAG_PUSHABLE) other->push |= PUSH_ZN;
act->pos.z++;
@@ -469,6 +506,10 @@ namespace actor
below->above = act;
return;
}
vec3_t min = room::getMin();
vec3_t max = room::getMax();
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;
act->pos.z--;
}