-sorting out z pushing problems
This commit is contained in:
@@ -90,6 +90,8 @@ namespace actor
|
|||||||
if (input::keyDown(SDL_SCANCODE_RIGHT) && act->pos.x<56) { act->push |= PUSH_XP; moving = true; }
|
if (input::keyDown(SDL_SCANCODE_RIGHT) && act->pos.x<56) { act->push |= PUSH_XP; moving = true; }
|
||||||
if (input::keyDown(SDL_SCANCODE_UP) && act->pos.y>0) { act->push |= PUSH_YN; moving = true; }
|
if (input::keyDown(SDL_SCANCODE_UP) && act->pos.y>0) { act->push |= PUSH_YN; moving = true; }
|
||||||
if (input::keyDown(SDL_SCANCODE_DOWN) && act->pos.y<56) { act->push |= PUSH_YP; moving = true; }
|
if (input::keyDown(SDL_SCANCODE_DOWN) && act->pos.y<56) { act->push |= PUSH_YP; moving = true; }
|
||||||
|
if (input::keyDown(SDL_SCANCODE_Z) && act->pos.z>0) { act->push |= PUSH_ZN; moving = true; }
|
||||||
|
if (input::keyDown(SDL_SCANCODE_A) && act->pos.z<56) { act->push |= PUSH_ZP; moving = true; }
|
||||||
if (moving)
|
if (moving)
|
||||||
{
|
{
|
||||||
act->flags |= FLAG_ANIMATED;
|
act->flags |= FLAG_ANIMATED;
|
||||||
@@ -153,6 +155,22 @@ namespace actor
|
|||||||
|
|
||||||
void updatePushable(actor_t *act)
|
void updatePushable(actor_t *act)
|
||||||
{
|
{
|
||||||
|
if (act->push & PUSH_ZP) {
|
||||||
|
act->pos.z++;
|
||||||
|
actor::actor_t *other = actor::get_collision(act);
|
||||||
|
if (other && other->flags & FLAG_PUSHABLE)
|
||||||
|
other->push |= PUSH_ZP;
|
||||||
|
if (act->pos.z>56)
|
||||||
|
{
|
||||||
|
act->pos.z--;
|
||||||
|
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
actor::setDirty(act);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (act->push & PUSH_XN) {
|
if (act->push & PUSH_XN) {
|
||||||
act->pos.x--;
|
act->pos.x--;
|
||||||
actor::actor_t *other = actor::get_collision(act);
|
actor::actor_t *other = actor::get_collision(act);
|
||||||
@@ -228,20 +246,6 @@ namespace actor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (act->push & PUSH_ZP) {
|
|
||||||
act->pos.z++;
|
|
||||||
actor::actor_t *other = actor::get_collision(act);
|
|
||||||
if (other && other->flags & FLAG_PUSHABLE) other->push |= PUSH_ZP;
|
|
||||||
if (act->pos.z>56)
|
|
||||||
{
|
|
||||||
act->pos.z--;
|
|
||||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
actor::setDirty(act);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateReactive(actor_t *act)
|
void updateReactive(actor_t *act)
|
||||||
|
|||||||
Reference in New Issue
Block a user