- [NEW] Mode d'edició flotant (amb tecla M).
- [FIX] la copa de actors (sobre tot per a templates) també copia la surface. - [FIX] El push de reacció se li ha de passar al que espenta, no al aspentat. - [FIX] La posició del cursor en l'editor de posició en bitmap ha de resetejar-se al soltar el botó. - [NEW] Gràfics del cabronet. - [NEW] Montons de objectes "templatechats" pa anar editant més apresa.
This commit is contained in:
BIN
data/batman.gif
BIN
data/batman.gif
Binary file not shown.
|
Before Width: | Height: | Size: 643 B After Width: | Height: | Size: 643 B |
@@ -1,5 +1,6 @@
|
|||||||
abad.gif
|
abad.gif
|
||||||
altres.gif
|
altres.gif
|
||||||
|
batman.gif
|
||||||
caixes.gif
|
caixes.gif
|
||||||
doors.gif
|
doors.gif
|
||||||
floor.gif
|
floor.gif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
width: 2
|
width: 3
|
||||||
height: 2
|
height: 3
|
||||||
door-height-yn: 0
|
door-height-yn: 0
|
||||||
color: CYAN
|
color: CYAN
|
||||||
floor-texture: 0
|
floor-texture: 0
|
||||||
@@ -7,3 +7,96 @@ wall-texture: 0
|
|||||||
door-texture: 0
|
door-texture: 0
|
||||||
under-door-texture: 0
|
under-door-texture: 0
|
||||||
exit-yn: 9
|
exit-yn: 9
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BLOCMATA
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 0 133 32 27
|
||||||
|
bmp-offset: 0 27
|
||||||
|
pos: 16 16 0
|
||||||
|
size: 8 8 6
|
||||||
|
flags: REACTIVE DEADLY
|
||||||
|
react-mask: XP XN YP YN ZP ZN
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BUBBLE
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 20 75 28 26
|
||||||
|
bmp-offset: -2 28
|
||||||
|
pos: 56 56 0
|
||||||
|
size: 8 8 8
|
||||||
|
flags: PUSHABLE INERTIA
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: CONV-XP
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 0 128 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 0 0 0
|
||||||
|
size: 8 8 4
|
||||||
|
orient: XP
|
||||||
|
anim-cycle: MIN
|
||||||
|
flags: REACTIVE ANIMATED ORIENTABLE
|
||||||
|
react-mask: ZN
|
||||||
|
react-push: XP
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: GAT-BATMAN
|
||||||
|
bmp: gat.gif
|
||||||
|
bmp-rect: 0 0 24 28
|
||||||
|
bmp-offset: -4 32
|
||||||
|
pos: 48 1 0
|
||||||
|
size: 8 8 8
|
||||||
|
orient: YN
|
||||||
|
anim-wait: 1
|
||||||
|
flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY
|
||||||
|
react-mask: XP XN YP YN ZP ZN
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: SPECTRUM
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 128 0 32 32
|
||||||
|
bmp-offset: -4 34
|
||||||
|
pos: 24 40 8
|
||||||
|
size: 8 6 2
|
||||||
|
flags: PUSHABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: TAULA-A
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 128 32 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 16 40 0
|
||||||
|
size: 8 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: TAULA-B
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 160 32 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 24 40 0
|
||||||
|
size: 8 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: TV
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 32 64 32 32
|
||||||
|
bmp-offset: -4 34
|
||||||
|
pos: 16 40 8
|
||||||
|
size: 8 6 8
|
||||||
|
flags: PUSHABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,30 +2,6 @@
|
|||||||
category{
|
category{
|
||||||
name: DEFAULT
|
name: DEFAULT
|
||||||
|
|
||||||
actor{
|
|
||||||
name: BOX
|
|
||||||
bmp: caixes.gif
|
|
||||||
bmp-rect: 32 0 32 32
|
|
||||||
bmp-offset: 0 32
|
|
||||||
pos: 32 32 0
|
|
||||||
size: 8 8 8
|
|
||||||
flags: PUSHABLE
|
|
||||||
movement: CW
|
|
||||||
}
|
|
||||||
|
|
||||||
actor{
|
|
||||||
name: BARREL
|
|
||||||
bmp: caixes.gif
|
|
||||||
bmp-rect: 96 64 18 32
|
|
||||||
bmp-offset: -7 37
|
|
||||||
pos: 25 9 0
|
|
||||||
size: 6 6 12
|
|
||||||
anim-cycle: SEQ
|
|
||||||
anim-wait: 1
|
|
||||||
flags: PUSHABLE ANIMATED GRAVITY
|
|
||||||
movement: CW
|
|
||||||
}
|
|
||||||
|
|
||||||
actor{
|
actor{
|
||||||
name: NEVERA1
|
name: NEVERA1
|
||||||
bmp: caixes.gif
|
bmp: caixes.gif
|
||||||
@@ -106,19 +82,6 @@ category{
|
|||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
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: CW
|
|
||||||
}
|
|
||||||
|
|
||||||
actor{
|
actor{
|
||||||
name: CUADRO
|
name: CUADRO
|
||||||
bmp: altres.gif
|
bmp: altres.gif
|
||||||
@@ -131,19 +94,6 @@ category{
|
|||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
actor{
|
|
||||||
name: ROOMBA
|
|
||||||
bmp: caixes.gif
|
|
||||||
bmp-rect: 160 0 32 32
|
|
||||||
bmp-offset: 0 34
|
|
||||||
pos: 32 32 0
|
|
||||||
size: 8 8 2
|
|
||||||
orient: XN
|
|
||||||
flags: REACTIVE MOVING DEADLY
|
|
||||||
react-mask: XP XN YP YN ZP ZN
|
|
||||||
movement: CCW
|
|
||||||
}
|
|
||||||
|
|
||||||
actor{
|
actor{
|
||||||
name: WC
|
name: WC
|
||||||
bmp: altres.gif
|
bmp: altres.gif
|
||||||
@@ -164,6 +114,20 @@ category{
|
|||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: CONV-XP
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 0 128 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 0 0 0
|
||||||
|
size: 8 8 4
|
||||||
|
orient: XP
|
||||||
|
anim-cycle: MIN
|
||||||
|
flags: REACTIVE ANIMATED ORIENTABLE
|
||||||
|
react-mask: ZN
|
||||||
|
react-push: XP
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
category{
|
category{
|
||||||
@@ -242,6 +206,26 @@ category{
|
|||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: TAULA-A
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 128 32 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 32 40 0
|
||||||
|
size: 8 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: TAULA-B
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 160 32 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 40 40 0
|
||||||
|
size: 8 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
category{
|
category{
|
||||||
@@ -326,3 +310,189 @@ category{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
category{
|
||||||
|
name: MALOTES
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BLOCMATA
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 0 133 32 27
|
||||||
|
bmp-offset: 0 27
|
||||||
|
pos: 16 16 0
|
||||||
|
size: 8 8 6
|
||||||
|
flags: REACTIVE DEADLY
|
||||||
|
react-mask: XP XN YP YN ZP ZN
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: ROOMBA
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 160 0 32 32
|
||||||
|
bmp-offset: 0 34
|
||||||
|
pos: 32 32 0
|
||||||
|
size: 8 8 2
|
||||||
|
orient: XN
|
||||||
|
flags: REACTIVE MOVING DEADLY
|
||||||
|
react-mask: XP XN YP YN ZP ZN
|
||||||
|
movement: CCW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: GAT-BATMAN
|
||||||
|
bmp: gat.gif
|
||||||
|
bmp-rect: 0 0 24 28
|
||||||
|
bmp-offset: -4 32
|
||||||
|
pos: 32 32 0
|
||||||
|
size: 8 8 8
|
||||||
|
orient: XP
|
||||||
|
anim-wait: 1
|
||||||
|
flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY
|
||||||
|
react-mask: XP XN YP YN ZP ZN
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: GAT-ROBIN
|
||||||
|
bmp: gat2.gif
|
||||||
|
bmp-rect: 0 0 24 28
|
||||||
|
bmp-offset: -4 32
|
||||||
|
pos: 32 32 0
|
||||||
|
size: 8 8 8
|
||||||
|
orient: XP
|
||||||
|
anim-wait: 1
|
||||||
|
flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY
|
||||||
|
react-mask: XP XN YP YN ZP ZN
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: ABAD
|
||||||
|
bmp: abad.gif
|
||||||
|
bmp-rect: 0 0 20 33
|
||||||
|
bmp-offset: -6 38
|
||||||
|
pos: 0 0 0
|
||||||
|
size: 8 8 8
|
||||||
|
orient: XP
|
||||||
|
anim-wait: 1
|
||||||
|
flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY
|
||||||
|
react-mask: XP XN YP YN ZP ZN
|
||||||
|
movement: CCW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BATMAN
|
||||||
|
bmp: batman.gif
|
||||||
|
bmp-rect: 0 0 21 32
|
||||||
|
bmp-offset: -5 35
|
||||||
|
pos: 0 0 0
|
||||||
|
size: 8 8 8
|
||||||
|
orient: YP
|
||||||
|
anim-wait: 1
|
||||||
|
flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY
|
||||||
|
react-mask: XP XN YP YN ZP ZN
|
||||||
|
movement: CCW
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
category{
|
||||||
|
name: MISC
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BARREL
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 96 64 18 32
|
||||||
|
bmp-offset: -7 37
|
||||||
|
pos: 25 9 0
|
||||||
|
size: 6 6 12
|
||||||
|
anim-cycle: SEQ
|
||||||
|
anim-wait: 1
|
||||||
|
flags: PUSHABLE ANIMATED GRAVITY
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BUBBLE
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 20 75 28 26
|
||||||
|
bmp-offset: -2 28
|
||||||
|
pos: 48 32 0
|
||||||
|
size: 8 8 8
|
||||||
|
flags: PUSHABLE INERTIA
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
category{
|
||||||
|
name: CAIXES
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BOX-A
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 0 0 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 32 32 0
|
||||||
|
size: 8 8 8
|
||||||
|
flags: PUSHABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BOX-B
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 32 0 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 32 32 0
|
||||||
|
size: 8 8 8
|
||||||
|
flags: PUSHABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BOX-C
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 64 0 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 32 32 0
|
||||||
|
size: 8 8 8
|
||||||
|
flags: PUSHABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: NES
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 96 0 32 32
|
||||||
|
bmp-offset: -2 33
|
||||||
|
pos: 0 0 0
|
||||||
|
size: 8 7 6
|
||||||
|
flags: PUSHABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: SPECTRUM
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 128 0 32 32
|
||||||
|
bmp-offset: -4 34
|
||||||
|
pos: 0 0 0
|
||||||
|
size: 8 6 2
|
||||||
|
flags: PUSHABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: TV
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 32 64 32 32
|
||||||
|
bmp-offset: -4 34
|
||||||
|
pos: 0 0 0
|
||||||
|
size: 8 6 8
|
||||||
|
flags: PUSHABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
BIN
data/test.gif
BIN
data/test.gif
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
@@ -26,6 +26,7 @@ namespace actor
|
|||||||
draw::surface *brilli;
|
draw::surface *brilli;
|
||||||
|
|
||||||
int current_tag = 0;
|
int current_tag = 0;
|
||||||
|
bool floating_editing = false;
|
||||||
|
|
||||||
void resetTag()
|
void resetTag()
|
||||||
{
|
{
|
||||||
@@ -96,7 +97,7 @@ namespace actor
|
|||||||
{
|
{
|
||||||
actor_t *new_act = createEmptyActor();
|
actor_t *new_act = createEmptyActor();
|
||||||
actor::templates::copy(new_act, act);
|
actor::templates::copy(new_act, act);
|
||||||
new_act->surface = draw::getSurface(new_act->bmp);
|
//new_act->surface = draw::getSurface(new_act->bmp);
|
||||||
new_act->prev = new_act->next = new_act->above = new_act->below = nullptr;
|
new_act->prev = new_act->next = new_act->above = new_act->below = nullptr;
|
||||||
return new_act;
|
return new_act;
|
||||||
}
|
}
|
||||||
@@ -997,7 +998,7 @@ namespace actor
|
|||||||
// ...i encara està baix...
|
// ...i encara està baix...
|
||||||
if (is_above(act, act->below)) {
|
if (is_above(act, act->below)) {
|
||||||
// ...li pase a ell el push, neteje el meu flag, canvie direcció si pertoca i me ane
|
// ...li pase a ell el push, neteje el meu flag, canvie direcció si pertoca i me ane
|
||||||
act->below->push |= push(act, act->below, PUSH_ZN);
|
act->push |= push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia
|
||||||
act->push &= ~PUSH_ZN;
|
act->push &= ~PUSH_ZN;
|
||||||
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
||||||
return;
|
return;
|
||||||
@@ -1017,7 +1018,7 @@ namespace actor
|
|||||||
act->below = below;
|
act->below = below;
|
||||||
below->above = act;
|
below->above = act;
|
||||||
// ... i li passem el push, netejem el meu flag i gonnem
|
// ... i li passem el push, netejem el meu flag i gonnem
|
||||||
act->below->push |= push(act, act->below, PUSH_ZN);
|
act->push |= push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia
|
||||||
act->push &= ~PUSH_ZN;
|
act->push &= ~PUSH_ZN;
|
||||||
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
||||||
return;
|
return;
|
||||||
@@ -1317,6 +1318,15 @@ namespace actor
|
|||||||
selected = nullptr;
|
selected = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setFloatingEditing(const bool value)
|
||||||
|
{
|
||||||
|
floating_editing = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool getFloatingEditing()
|
||||||
|
{
|
||||||
|
return floating_editing;
|
||||||
|
}
|
||||||
namespace templates
|
namespace templates
|
||||||
{
|
{
|
||||||
std::vector<actor_t> templates;
|
std::vector<actor_t> templates;
|
||||||
@@ -1447,6 +1457,7 @@ namespace actor
|
|||||||
dest->react_push = source->react_push;
|
dest->react_push = source->react_push;
|
||||||
dest->movement = source->movement;
|
dest->movement = source->movement;
|
||||||
dest->template_category = source->template_category;
|
dest->template_category = source->template_category;
|
||||||
|
dest->surface = source->surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(actor_t *act)
|
void add(actor_t *act)
|
||||||
@@ -1454,8 +1465,7 @@ namespace actor
|
|||||||
// Fem una copia del actor
|
// Fem una copia del actor
|
||||||
actor_t new_template;
|
actor_t new_template;
|
||||||
copy(&new_template, act);
|
copy(&new_template, act);
|
||||||
// Li fiquem la categoria per defecte
|
|
||||||
new_template.template_category = 0;
|
|
||||||
// Netejem el nom de numerets
|
// Netejem el nom de numerets
|
||||||
cleanName(&new_template);
|
cleanName(&new_template);
|
||||||
|
|
||||||
@@ -1464,9 +1474,11 @@ namespace actor
|
|||||||
{
|
{
|
||||||
// ... la actualitzem amb les dades del actor seleccionat
|
// ... la actualitzem amb les dades del actor seleccionat
|
||||||
actor_t *existing_template = actor::templates::getByName(act->name);
|
actor_t *existing_template = actor::templates::getByName(act->name);
|
||||||
|
new_template.template_category = existing_template->template_category; // Li fiquem la categoria que tenia abans
|
||||||
copy(existing_template, &new_template);
|
copy(existing_template, &new_template);
|
||||||
} else {
|
} else {
|
||||||
// ... i sinó, afegim el actor seleccionat a la llista de plantilles
|
// ... i sinó, afegim el actor seleccionat a la llista de plantilles
|
||||||
|
new_template.template_category = 0; // Li fiquem la categoria per defecte
|
||||||
templates.push_back(new_template);
|
templates.push_back(new_template);
|
||||||
}
|
}
|
||||||
save();
|
save();
|
||||||
|
|||||||
@@ -173,6 +173,10 @@ namespace actor
|
|||||||
|
|
||||||
void clear(const bool all = false);
|
void clear(const bool all = false);
|
||||||
|
|
||||||
|
void setFloatingEditing(const bool value);
|
||||||
|
|
||||||
|
const bool getFloatingEditing();
|
||||||
|
|
||||||
namespace templates
|
namespace templates
|
||||||
{
|
{
|
||||||
void load();
|
void load();
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ namespace modules
|
|||||||
sel->bmp_rect.h += dy;
|
sel->bmp_rect.h += dy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
lastMB = false;
|
||||||
}
|
}
|
||||||
const int tx = (520-surf->w)/2;
|
const int tx = (520-surf->w)/2;
|
||||||
const int ty = (240-surf->h)/2;
|
const int ty = (240-surf->h)/2;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace modules
|
|||||||
{
|
{
|
||||||
namespace editor_bitmap_file
|
namespace editor_bitmap_file
|
||||||
{
|
{
|
||||||
std::vector<std::string> gifs = { "abad.gif", "altres.gif", "caixes.gif", "gat.gif", "gat2.gif", "objectes.gif", "obrer.gif" };
|
std::vector<std::string> gifs = { "abad.gif", "batman.gif", "altres.gif", "caixes.gif", "gat.gif", "gat2.gif", "objectes.gif", "obrer.gif" };
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace modules
|
|||||||
|
|
||||||
bool loop()
|
bool loop()
|
||||||
{
|
{
|
||||||
if (input::keyPressed(SDL_SCANCODE_ESCAPE) || input::keyPressed(SDL_SCANCODE_TAB)) return false;
|
if (input::keyPressed(SDL_SCANCODE_ESCAPE) || input::keyPressed(SDL_SCANCODE_TAB) || input::keyPressed(SDL_SCANCODE_GRAVE)) return false;
|
||||||
|
|
||||||
if (edit_mode == EDITING_NORMAL)
|
if (edit_mode == EDITING_NORMAL)
|
||||||
{
|
{
|
||||||
@@ -144,6 +144,7 @@ namespace modules
|
|||||||
actor::setUniqueName(new_act);
|
actor::setUniqueName(new_act);
|
||||||
actor::setDirty(new_act, true);
|
actor::setDirty(new_act, true);
|
||||||
actor::select(new_act);
|
actor::select(new_act);
|
||||||
|
actor::setFloatingEditing(true);
|
||||||
room::editor::modify();
|
room::editor::modify();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace modules
|
|||||||
|
|
||||||
std::vector<std::string> getGifs() { return gifs; }
|
std::vector<std::string> getGifs() { return gifs; }
|
||||||
|
|
||||||
|
vec2_t floating_position = {3,3};
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
actor::clear(true);
|
actor::clear(true);
|
||||||
@@ -295,6 +297,31 @@ namespace modules
|
|||||||
if (editor::isDevMode()) draw::setViewport(100,0,320,240);
|
if (editor::isDevMode()) draw::setViewport(100,0,320,240);
|
||||||
|
|
||||||
room::draw();
|
room::draw();
|
||||||
|
|
||||||
|
actor::actor_t *selected = actor::getSelected();
|
||||||
|
if (editor::isDevMode() && selected && input::keyPressed(SDL_SCANCODE_M)) actor::setFloatingEditing(true);
|
||||||
|
|
||||||
|
if (editor::isDevMode() && actor::getFloatingEditing() && selected) {
|
||||||
|
draw::swapcol(1, GREEN+LIGHT);
|
||||||
|
draw::setSource(draw::getSurface("test.gif"));
|
||||||
|
const float px = draw::getLocalX(input::mouseX())-148-16;
|
||||||
|
const float py = draw::getLocalY(input::mouseY())-75;
|
||||||
|
const int x = int(py/16.0f + px/32.0f);
|
||||||
|
const int y = int(py/16.0f - px/32.0f);
|
||||||
|
|
||||||
|
//draw::print2(x, -3, 1, 6, PURPLE, FONT_ZOOM_NONE);
|
||||||
|
//draw::print2(y, -3, 1, 7, PURPLE, FONT_ZOOM_NONE);
|
||||||
|
|
||||||
|
if (x>=room::getTMin().x && y>=room::getTMin().y && x<room::getTMax().x && y<room::getTMax().y)
|
||||||
|
{
|
||||||
|
floating_position = {x, y};
|
||||||
|
selected->pos.x = floating_position.x*8;
|
||||||
|
selected->pos.y = floating_position.y*8;
|
||||||
|
}
|
||||||
|
draw::draw(148+floating_position.x*16-floating_position.y*16,75+floating_position.x*8+floating_position.y*8,32,16,160,0);
|
||||||
|
if (input::mouseClk(1)) actor::setFloatingEditing(false);
|
||||||
|
}
|
||||||
|
|
||||||
draw::stencil::enable();
|
draw::stencil::enable();
|
||||||
draw::stencil::clear(255);
|
draw::stencil::clear(255);
|
||||||
actor::draw(actor::getFirst());
|
actor::draw(actor::getFirst());
|
||||||
@@ -303,7 +330,8 @@ namespace modules
|
|||||||
draw::swapcol(1, WHITE+LIGHT);
|
draw::swapcol(1, WHITE+LIGHT);
|
||||||
actor::draw(actor::getPicked(), false);
|
actor::draw(actor::getPicked(), false);
|
||||||
|
|
||||||
if (editor::isDevMode() && input::mouseBtn(1))
|
// Si estem en el editor, fent click en els actors els seleccionem
|
||||||
|
if (editor::isDevMode() && input::mouseBtn(1) && !actor::getFloatingEditing())
|
||||||
{
|
{
|
||||||
const uint8_t val = draw::stencil::query(input::mouseX(), input::mouseY());
|
const uint8_t val = draw::stencil::query(input::mouseX(), input::mouseY());
|
||||||
if (val != 255)
|
if (val != 255)
|
||||||
@@ -313,6 +341,7 @@ namespace modules
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Si estem jugant, o estem en el editor pero NO en mode edició, pinta els marcadors
|
||||||
if (!editor::isEditing())
|
if (!editor::isEditing())
|
||||||
{
|
{
|
||||||
const int col1 = room::getColor(1);
|
const int col1 = room::getColor(1);
|
||||||
@@ -350,6 +379,7 @@ namespace modules
|
|||||||
|
|
||||||
draw::stencil::disable();
|
draw::stencil::disable();
|
||||||
|
|
||||||
|
// Si estem en el editor, fent click en els skills del marcador els obtenim
|
||||||
if (editor::isDevMode() && input::mouseClk(1))
|
if (editor::isDevMode() && input::mouseClk(1))
|
||||||
{
|
{
|
||||||
const uint8_t val = draw::stencil::query(input::mouseX(), input::mouseY());
|
const uint8_t val = draw::stencil::query(input::mouseX(), input::mouseY());
|
||||||
@@ -364,6 +394,8 @@ namespace modules
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
print(0,0,input::mouseX());
|
print(0,0,input::mouseX());
|
||||||
print(0,20,input::mouseY());
|
print(0,20,input::mouseY());
|
||||||
@@ -371,6 +403,8 @@ namespace modules
|
|||||||
print(0,40,input::mouseBtn(2)?1:0);
|
print(0,40,input::mouseBtn(2)?1:0);
|
||||||
print(0,50,input::mouseBtn(3)?1:0);
|
print(0,50,input::mouseBtn(3)?1:0);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Si no estem en el editor, pintem la consola (si es el cas), renderitzem i eixim
|
||||||
if (!editor::isDevMode())
|
if (!editor::isDevMode())
|
||||||
{
|
{
|
||||||
console::draw();
|
console::draw();
|
||||||
@@ -378,6 +412,7 @@ namespace modules
|
|||||||
return GAME_NONE;
|
return GAME_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Si estem en el editor, pintem els numerets de les eixides
|
||||||
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);
|
||||||
@@ -385,8 +420,11 @@ namespace modules
|
|||||||
draw::print2(room::getExit(ZP), -2, 19, 1, TEAL, FONT_ZOOM_NONE);
|
draw::print2(room::getExit(ZP), -2, 19, 1, TEAL, FONT_ZOOM_NONE);
|
||||||
draw::print2(room::getExit(ZN), -2, 19, 28, TEAL, FONT_ZOOM_NONE);
|
draw::print2(room::getExit(ZN), -2, 19, 28, TEAL, FONT_ZOOM_NONE);
|
||||||
|
|
||||||
|
// ...i l'habitació actual
|
||||||
draw::print2(room::getCurrent(), -2, 4, 3, WHITE, FONT_ZOOM_BOTH);
|
draw::print2(room::getCurrent(), -2, 4, 3, WHITE, FONT_ZOOM_BOTH);
|
||||||
|
|
||||||
|
// ...i fent click en els numerets de les eixides anem a l'habitació corresponent
|
||||||
|
// Es més. Si no hi ha habitació enllaçada en una eixida i li fem ctrl+click, se crea una nova habitació per eixa eixida
|
||||||
if (input::mouseClk(1)) {
|
if (input::mouseClk(1)) {
|
||||||
const int mx = draw::getLocalX(input::mouseX());
|
const int mx = draw::getLocalX(input::mouseX());
|
||||||
const int my = draw::getLocalY(input::mouseY());
|
const int my = draw::getLocalY(input::mouseY());
|
||||||
@@ -419,6 +457,8 @@ namespace modules
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pintem tota la UI del editor
|
||||||
|
// ================================================================================
|
||||||
ui::start();
|
ui::start();
|
||||||
|
|
||||||
actor::actor_t *act = nullptr;
|
actor::actor_t *act = nullptr;
|
||||||
|
|||||||
@@ -466,6 +466,16 @@ namespace room
|
|||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec3_t getTMin()
|
||||||
|
{
|
||||||
|
return tmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3_t getTMax()
|
||||||
|
{
|
||||||
|
return tmax;
|
||||||
|
}
|
||||||
|
|
||||||
int getDoors()
|
int getDoors()
|
||||||
{
|
{
|
||||||
return doors;
|
return doors;
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ namespace room
|
|||||||
vec3_t getSize();
|
vec3_t getSize();
|
||||||
vec3_t getMin();
|
vec3_t getMin();
|
||||||
vec3_t getMax();
|
vec3_t getMax();
|
||||||
|
vec3_t getTMin();
|
||||||
|
vec3_t getTMax();
|
||||||
int getDoors();
|
int getDoors();
|
||||||
int getDoor(const int d);
|
int getDoor(const int d);
|
||||||
int getExit(const int d);
|
int getExit(const int d);
|
||||||
|
|||||||
Reference in New Issue
Block a user