- Ja funciona el selector de templates

This commit is contained in:
2024-07-30 18:27:14 +02:00
parent 1cd08b1110
commit 9d0d02c0c2
5 changed files with 196 additions and 15 deletions

View File

@@ -9,3 +9,132 @@ door-texture: 0
under-door-texture: 0 under-door-texture: 0
exit-xn: 1 exit-xn: 1
exit-yn: 3 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
}

View File

@@ -7,3 +7,16 @@ wall-texture: 0
door-texture: 0 door-texture: 0
under-door-texture: 0 under-door-texture: 0
exit-xp: 4 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
}

View File

@@ -213,12 +213,13 @@ actor{
actor{ actor{
name: GAT-NEGRE name: GAT-NEGRE
bmp: gat.gif bmp: gat.gif
bmp-rect: 0 0 24 26 bmp-rect: 0 0 24 28
bmp-offset: 0 32 bmp-offset: -4 32
pos: 32 32 0 pos: 8 8 0
size: 8 8 8 size: 8 8 8
orient: XP
anim-wait: 2 anim-wait: 2
flags: ANIMATED flags: MOVING ANIMATED ORIENTABLE
movement: CW movement: CW
} }
@@ -233,3 +234,35 @@ actor{
flags: ORIENTABLE flags: ORIENTABLE
movement: CW 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
}

View File

@@ -5,6 +5,7 @@
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "actor.h" #include "actor.h"
#include <vector> #include <vector>
#include "room.h"
namespace modules namespace modules
{ {
@@ -28,26 +29,32 @@ namespace modules
draw::cls(2); draw::cls(2);
draw::stencil::enable(); //draw::stencil::enable();
draw::stencil::clear(255); //draw::stencil::clear(255);
int x=0, y=0; int x=0, y=0;
for (int i=0; i<templates.size(); ++i) for (int i=0; i<templates.size(); ++i)
{ {
draw::stencil::set(i); //draw::stencil::set(i);
draw::swapcol(1, TEAL); draw::swapcol(1, TEAL);
actor::drawAt(templates[i], x*40, y*40); actor::drawAt(templates[i], x*65, y*40);
draw::print(templates[i]->name, (x*40), (y*40)+30, LIGHT+WHITE, BLACK); draw::print(templates[i]->name, (x*65), (y*40)+30, LIGHT+WHITE, BLACK);
x++; if (x==13) { x=0;y++; } x++; if (x==8) { x=0;y++; }
} }
draw::render(); draw::render();
if (input::mouseClk(1)) { if (input::mouseClk(1)) {
const int clicked = draw::stencil::query(input::mouseX(), input::mouseY()); //const int clicked = draw::stencil::query(input::mouseX(), input::mouseY());
if (clicked!=255) { const int clicked = (input::mouseX()/65) + (input::mouseY()/40) * 8;
//room::load(clicked); 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; return false;
} }
} }

View File

@@ -378,7 +378,6 @@ namespace modules
return GAME_NONE; return GAME_NONE;
} }
draw::print2(room::getExit(XN), -2, 1, 1, TEAL, FONT_ZOOM_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(YN), -2, 38, 1, TEAL, FONT_ZOOM_NONE);
draw::print2(room::getExit(XP), -2, 38, 28, 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::actor_t *new_act = actor::duplicate(act);
actor::setUniqueName(new_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::setDirty(new_act, true);
actor::select(new_act); actor::select(new_act);
changed = true; changed = true;