From 2b5a124ddf821182d29977d661f143b7cb0b34ca Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Mon, 1 Jul 2024 13:32:14 +0200 Subject: [PATCH] - [NEW][FIX] Ja funcionen correctament tant les eixides per dalt com per baix --- data/rooms/06.txt | 13 +++++++++++++ data/rooms/07.txt | 20 ++++++++++++++++++++ data/templates.txt | 12 ++++++++++++ source/actor.cpp | 21 ++++++++++++++++++++- 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 data/rooms/07.txt diff --git a/data/rooms/06.txt b/data/rooms/06.txt index 5dc9ec5..d491063 100644 --- a/data/rooms/06.txt +++ b/data/rooms/06.txt @@ -7,6 +7,7 @@ wall-texture: 0 door-texture: 0 under-door-texture: 0 exit-xn: 5 +exit-zp: 7 actor{ name: YONKI @@ -53,3 +54,15 @@ actor{ size: 8 8 8 movement: CW } + +actor{ + name: LIFT + bmp: caixes.gif + bmp-rect: 32 32 32 24 + bmp-offset: 0 24 + pos: 56 0 0 + size: 8 8 4 + orient: ZP + flags: MOVING + movement: Z +} diff --git a/data/rooms/07.txt b/data/rooms/07.txt new file mode 100644 index 0000000..f8fdc82 --- /dev/null +++ b/data/rooms/07.txt @@ -0,0 +1,20 @@ +width: 3 +height: 3 +color: CYAN +floor-texture: 0 +wall-texture: 0 +door-texture: 0 +under-door-texture: 0 +exit-zn: 6 + +actor{ + name: LIFT + bmp: caixes.gif + bmp-rect: 32 32 32 24 + bmp-offset: 0 24 + pos: 56 0 0 + size: 8 8 4 + orient: ZP + flags: MOVING + movement: Z +} diff --git a/data/templates.txt b/data/templates.txt index 360c280..fce7075 100644 --- a/data/templates.txt +++ b/data/templates.txt @@ -41,3 +41,15 @@ actor{ size: 8 8 8 movement: CW } + +actor{ + name: LIFT + bmp: caixes.gif + bmp-rect: 32 32 32 24 + bmp-offset: 0 24 + pos: 56 0 0 + size: 8 8 4 + orient: ZP + flags: MOVING + movement: Z +} diff --git a/source/actor.cpp b/source/actor.cpp index 2734283..56f5b3e 100644 --- a/source/actor.cpp +++ b/source/actor.cpp @@ -647,6 +647,15 @@ namespace actor if (act->pos.z>=max.z) { if (act->flags & FLAG_MOVING) changeMoving(act); + + if ( ((act->flags&FLAG_HERO)!=0) && (room::getExit(ZP)!=-1) ) + { + room::load(room::getExit(ZP)); + act->pos.z = 4; + actor::setDirty(act); + room_changed = true; + return; + } } else { @@ -659,6 +668,14 @@ namespace actor do { actor::actor_t *other = actor::any_above_me(now); if (!other || (other->flags & FLAG_PUSHABLE)) now->pos.z++; + if ( (now->pos.z>=max.z) && (now->flags&FLAG_HERO)!=0 && (room::getExit(ZP)!=-1) ) + { + room::load(room::getExit(ZP)); + now->pos.z = 4; + actor::setDirty(now); + room_changed = true; + return; + } now = other; if (now && !(now->flags & FLAG_PUSHABLE)) { if (act->flags & FLAG_MOVING) changeMoving(act); @@ -782,9 +799,11 @@ namespace actor } if (act->push & PUSH_ZN) { - // Si estic sobre el piso, no faig res [TODO]: Si no hi ha piso ha de caure + // Si estic sobre el piso, no faig res if (act->pos.z == 0) { + if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act); + act->push &= ~PUSH_ZN; if ( ((act->flags&FLAG_HERO)==0) || (room::getExit(ZN)==-1) ) return; room::load(room::getExit(ZN));