- Treballant en les portes

This commit is contained in:
2023-03-10 18:57:04 +01:00
parent 2ef01a14d9
commit 5a089b3333
3 changed files with 90 additions and 6 deletions

View File

@@ -161,15 +161,49 @@ namespace actor
vec3_t max = room::getMax();
bool moving = false;
if (input::keyDown(SDL_SCANCODE_LEFT) && act->pos.x>min.x) { act->push |= PUSH_XN; act->orient=PUSH_XN; moving = true; }
if (input::keyDown(SDL_SCANCODE_RIGHT) && act->pos.x<max.x) { act->push |= PUSH_XP; act->orient=PUSH_XP; moving = true; }
if (input::keyDown(SDL_SCANCODE_UP) && act->pos.y>min.y) { act->push |= PUSH_YN; act->orient=PUSH_YN; moving = true; }
if (input::keyDown(SDL_SCANCODE_DOWN) && act->pos.y<max.y) { act->push |= PUSH_YP; act->orient=PUSH_YP; moving = true; }
if (input::keyDown(SDL_SCANCODE_SPACE) && act->react_mask==0 && (act->pos.z==0 || act->below)) {
if ( input::keyDown(SDL_SCANCODE_LEFT) )
{
act->orient=PUSH_XN;
if (act->pos.x>min.x)
{
act->push |= PUSH_XN;
moving = true;
}
}
if ( input::keyDown(SDL_SCANCODE_RIGHT) )
{
act->orient=PUSH_XP;
if (act->pos.x<max.x)
{
act->push |= PUSH_XP;
moving = true;
}
}
if ( input::keyDown(SDL_SCANCODE_UP) )
{
act->orient=PUSH_YN;
if (act->pos.y>min.y)
{
act->push |= PUSH_YN;
moving = true;
}
}
if ( input::keyDown(SDL_SCANCODE_DOWN) )
{
act->orient=PUSH_YP;
if (act->pos.y<max.y)
{
act->push |= PUSH_YP;
moving = true;
}
}
if ( input::keyDown(SDL_SCANCODE_SPACE) && act->react_mask==0 && (act->pos.z==0 || act->below))
{
act->react_mask=1;
act->react_push=0;
act->flags &= uint8_t(~FLAG_GRAVITY);
if (act->below) {
if (act->below)
{
act->below->above = nullptr;
act->below = nullptr;
}