- [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;
|
||||
|
||||
@@ -331,9 +331,9 @@ void editor_move_selected()
|
||||
vec3_t max = room::getMax();
|
||||
|
||||
if ( input::keyDown(SDL_SCANCODE_LEFT) && selected->pos.x>min.x ) { selected->pos.x--; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_RIGHT) && selected->pos.x<max.x ) { selected->pos.x++; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_RIGHT) && (selected->pos.x+selected->size.x)<max.x ) { selected->pos.x++; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_UP) && selected->pos.y>min.y ) { selected->pos.y--; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_DOWN) && selected->pos.y<max.y ) { selected->pos.y++; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_DOWN) && (selected->pos.y+selected->size.y)<max.y ) { selected->pos.y++; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_PAGEDOWN) && selected->pos.z>min.z ) { selected->pos.z--; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_PAGEUP) /*&& selected->pos.z<max.z*/ ) { selected->pos.z++; actor::setDirty(selected); room::editor::modify(); }
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace room
|
||||
static vec3_t tmin = {0,0,0}; // primer tile en cada coordenada
|
||||
static vec3_t tmax = {7,7,7}; // ultim tile en cada coordenada
|
||||
static vec3_t min = {0,0,0}; // primer "pixel isometric" en cada coordenada
|
||||
static vec3_t max = {56,56,56}; // ultim "pixel isometric" en cada coordenada
|
||||
static vec3_t max = {64,64,64}; // ultim "pixel isometric" en cada coordenada
|
||||
|
||||
static int doors = NO_DOOR; // Portes obertes
|
||||
static int door_height[4]; // Altura de cada porta
|
||||
@@ -61,7 +61,7 @@ namespace room
|
||||
tmin = {3-inner_w,3-inner_h,0};
|
||||
tmax = {4+inner_w,4+inner_h,3};
|
||||
min = {tmin.x*8,tmin.y*8,0};
|
||||
max = {tmax.x*8,tmax.y*8,24};
|
||||
max = {(tmax.x+1)*8,(tmax.y+1)*8,24};
|
||||
doors = (door_height[XP]>=0?DOOR_XP:0) | (door_height[XN]>=0?DOOR_XN:0) | (door_height[YP]>=0?DOOR_YP:0) | (door_height[YN]>=0?DOOR_YN:0);
|
||||
//door_height[0] = inner_xp; //XP
|
||||
//door_height[1] = inner_xn; //XN
|
||||
|
||||
Reference in New Issue
Block a user