From 9d0d02c0c222f1f9fa9eb36cd7e71f2e0e4b018a Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Tue, 30 Jul 2024 18:27:14 +0200 Subject: [PATCH] - Ja funciona el selector de templates --- data/rooms/02.txt | 129 ++++++++++++++++++++++++++++++++++ data/rooms/05.txt | 13 ++++ data/templates.txt | 41 +++++++++-- source/m_editor_templates.cpp | 25 ++++--- source/m_game.cpp | 3 +- 5 files changed, 196 insertions(+), 15 deletions(-) diff --git a/data/rooms/02.txt b/data/rooms/02.txt index a9e356f..6e1c6f7 100644 --- a/data/rooms/02.txt +++ b/data/rooms/02.txt @@ -9,3 +9,132 @@ door-texture: 0 under-door-texture: 0 exit-xn: 1 exit-yn: 3 + +actor{ + name: BOX02 + bmp: caixes.gif + bmp-rect: 64 32 24 32 + bmp-offset: -8 36 + pos: 4 8 0 + size: 8 4 8 + movement: CW +} + +actor{ + name: BOX02 + bmp: caixes.gif + bmp-rect: 96 32 24 32 + bmp-offset: -8 36 + pos: 4 8 8 + size: 8 4 8 + movement: CW +} + +actor{ + name: BOX + bmp: caixes.gif + bmp-rect: 64 32 24 32 + bmp-offset: -8 36 + pos: 16 8 0 + size: 8 4 8 + movement: CW +} + +actor{ + name: BOX01 + bmp: caixes.gif + bmp-rect: 96 32 24 32 + bmp-offset: -8 36 + pos: 16 8 8 + size: 8 4 8 + movement: CW +} + +actor{ + name: KALLAX-A + bmp: altres.gif + bmp-rect: 0 48 24 27 + bmp-offset: 0 31 + pos: 0 12 0 + size: 4 8 8 + movement: CW +} + +actor{ + name: ROOMBA01 + bmp: caixes.gif + bmp-rect: 160 0 32 32 + bmp-offset: 0 34 + pos: 8 24 0 + size: 8 8 2 + orient: YP + flags: MOVING + movement: CW +} + +actor{ + name: ROOMBA02 + bmp: altres.gif + bmp-rect: 0 108 22 22 + bmp-offset: -5 24 + pos: 28 32 0 + size: 8 8 2 + orient: XN + flags: PUSHABLE INERTIA + movement: CCW +} + +actor{ + name: LLIT + bmp: altres.gif + bmp-rect: 48 0 57 47 + bmp-offset: 11 32 + pos: 40 8 0 + size: 16 16 8 + movement: CW +} + +actor{ + name: MESITA + bmp: caixes.gif + bmp-rect: 0 64 32 32 + bmp-offset: 0 32 + pos: 56 8 0 + size: 8 8 4 + movement: CW +} + +actor{ + name: BOOSTER + bmp: objectes.gif + bmp-rect: 114 78 15 18 + bmp-offset: -8 22 + pos: 56 8 6 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: ANIMATED SPECIAL + movement: CW +} + +actor{ + name: KALLAX-A01 + bmp: altres.gif + bmp-rect: 0 48 24 27 + bmp-offset: 0 31 + pos: 0 12 8 + size: 4 12 8 + movement: CW +} + +actor{ + name: ROOMBA + bmp: caixes.gif + bmp-rect: 160 0 32 32 + bmp-offset: 0 34 + pos: 56 24 0 + size: 8 8 2 + orient: YP + flags: MOVING + movement: CCW +} diff --git a/data/rooms/05.txt b/data/rooms/05.txt index ebd42e5..fe752f4 100644 --- a/data/rooms/05.txt +++ b/data/rooms/05.txt @@ -7,3 +7,16 @@ wall-texture: 0 door-texture: 0 under-door-texture: 0 exit-xp: 4 + +actor{ + name: GAT-NEGRE + bmp: gat.gif + bmp-rect: 0 0 24 28 + bmp-offset: -4 32 + pos: 8 8 0 + size: 8 8 8 + orient: XP + anim-wait: 2 + flags: MOVING ANIMATED ORIENTABLE + movement: CCW +} diff --git a/data/templates.txt b/data/templates.txt index b7e295d..230b366 100644 --- a/data/templates.txt +++ b/data/templates.txt @@ -213,12 +213,13 @@ actor{ actor{ name: GAT-NEGRE bmp: gat.gif - bmp-rect: 0 0 24 26 - bmp-offset: 0 32 - pos: 32 32 0 + bmp-rect: 0 0 24 28 + bmp-offset: -4 32 + pos: 8 8 0 size: 8 8 8 + orient: XP anim-wait: 2 - flags: ANIMATED + flags: MOVING ANIMATED ORIENTABLE movement: CW } @@ -233,3 +234,35 @@ actor{ flags: ORIENTABLE movement: CW } + +actor{ + name: MESITA + bmp: caixes.gif + bmp-rect: 0 64 32 32 + bmp-offset: 0 32 + pos: 0 16 0 + size: 8 8 4 + movement: CW +} + +actor{ + name: LAMPARA + bmp: altres.gif + bmp-rect: 128 0 20 41 + bmp-offset: -6 45 + pos: 1 41 0 + size: 6 6 16 + movement: CW +} + +actor{ + name: ROOMBA + bmp: caixes.gif + bmp-rect: 160 0 32 32 + bmp-offset: 0 34 + pos: 56 24 0 + size: 8 8 2 + orient: XN + flags: MOVING + movement: CCW +} diff --git a/source/m_editor_templates.cpp b/source/m_editor_templates.cpp index 6625314..32fef44 100644 --- a/source/m_editor_templates.cpp +++ b/source/m_editor_templates.cpp @@ -5,6 +5,7 @@ #include #include "actor.h" #include +#include "room.h" namespace modules { @@ -28,26 +29,32 @@ namespace modules draw::cls(2); - draw::stencil::enable(); - draw::stencil::clear(255); + //draw::stencil::enable(); + //draw::stencil::clear(255); int x=0, y=0; for (int i=0; iname, (x*40), (y*40)+30, LIGHT+WHITE, BLACK); - x++; if (x==13) { x=0;y++; } + actor::drawAt(templates[i], x*65, y*40); + draw::print(templates[i]->name, (x*65), (y*40)+30, LIGHT+WHITE, BLACK); + x++; if (x==8) { x=0;y++; } } draw::render(); if (input::mouseClk(1)) { - const int clicked = draw::stencil::query(input::mouseX(), input::mouseY()); - if (clicked!=255) { - //room::load(clicked); + //const int clicked = draw::stencil::query(input::mouseX(), input::mouseY()); + const int clicked = (input::mouseX()/65) + (input::mouseY()/40) * 8; + if (clicked<=actor::templates::size()) { + actor::actor_t *new_act = actor::duplicate(actor::templates::get(clicked)); + actor::setUniqueName(new_act); + actor::setDirty(new_act, true); + actor::select(new_act); + room::editor::modify(); + return false; } } diff --git a/source/m_game.cpp b/source/m_game.cpp index 75da86a..cbf1111 100644 --- a/source/m_game.cpp +++ b/source/m_game.cpp @@ -378,7 +378,6 @@ namespace modules return GAME_NONE; } - draw::print2(room::getExit(XN), -2, 1, 1, TEAL, FONT_ZOOM_NONE); draw::print2(room::getExit(YN), -2, 38, 1, TEAL, FONT_ZOOM_NONE); draw::print2(room::getExit(XP), -2, 38, 28, TEAL, FONT_ZOOM_NONE); @@ -771,7 +770,7 @@ namespace modules { actor::actor_t *new_act = actor::duplicate(act); actor::setUniqueName(new_act); - new_act->pos.x++; new_act->pos.y++; + //new_act->pos.x++; new_act->pos.y++; actor::setDirty(new_act, true); actor::select(new_act); changed = true;