- [NEW] mòdul editor per a handlechar tot lo relacionat en l'editor

This commit is contained in:
2024-06-13 07:40:51 +02:00
parent 3e37be8a3a
commit ad4cef1cd1
4 changed files with 45 additions and 23 deletions

View File

@@ -4,6 +4,7 @@
#include "jfile.h"
#include "jutil.h"
#include "room.h"
#include "editor.h"
#include <vector>
namespace actor
@@ -792,29 +793,29 @@ namespace actor
void draw(actor_t *act, const bool draw_all)
{
if (!act) return;
//if (act==first)order=0;
//order++;
const int x = 148-act->bmp_offset.x + act->pos.x*2 - act->pos.y*2;
const int y = 91-act->bmp_offset.y + act->pos.x + act->pos.y - act->pos.z*2;
if (!editor::isEditing() || ( (act->flags&FLAG_HERO)==0))
{
const int x = 148-act->bmp_offset.x + act->pos.x*2 - act->pos.y*2;
const int y = 91-act->bmp_offset.y + act->pos.x + act->pos.y - act->pos.z*2;
const bool flip = ( (act->flags & FLAG_ORIENTABLE) && (act->orient==PUSH_XN || act->orient==PUSH_YP) ) ? DRAW_FLIP_HORIZONTAL : DRAW_FLIP_NONE;
const int oo = ( (act->flags & FLAG_ORIENTABLE) && (act->orient==PUSH_XN || act->orient==PUSH_YN) ) ? act->bmp_rect.h : 0;
const bool flip = ( (act->flags & FLAG_ORIENTABLE) && (act->orient==PUSH_XN || act->orient==PUSH_YP) ) ? DRAW_FLIP_HORIZONTAL : DRAW_FLIP_NONE;
const int oo = ( (act->flags & FLAG_ORIENTABLE) && (act->orient==PUSH_XN || act->orient==PUSH_YN) ) ? act->bmp_rect.h : 0;
const int ao = (act->flags & FLAG_ANIMATED) ? anims[act->anim_cycle][act->anim_frame]*act->bmp_rect.w : 0;
const int ao = (act->flags & FLAG_ANIMATED) ? anims[act->anim_cycle][act->anim_frame]*act->bmp_rect.w : 0;
draw::pushSource();
draw::setSource(act->surface);
if (act==selected) draw::swapcol(1, room::getColor()==9?11:9); // Si està seleccionat, que canvie de color
draw::draw(x, y, act->bmp_rect.w, act->bmp_rect.h, act->bmp_rect.x+ao, act->bmp_rect.y+oo, flip);
draw::swapcol(1, room::getColor()); // Tornem al color per defecte
draw::popSource();
//print(x+5,y,act->pos.x);
//print(x+5,y+6,act->pos.y);
//print(x+5,y+12,act->pos.z);
//print(x+5,y+12,order);
//print(x+5,y,act->flags);
draw::pushSource();
draw::setSource(act->surface);
if (act==selected) draw::swapcol(1, room::getColor()==9?11:9); // Si està seleccionat, que canvie de color
draw::draw(x, y, act->bmp_rect.w, act->bmp_rect.h, act->bmp_rect.x+ao, act->bmp_rect.y+oo, flip);
draw::swapcol(1, room::getColor()); // Tornem al color per defecte
draw::popSource();
//print(x+5,y,act->pos.x);
//print(x+5,y+6,act->pos.y);
//print(x+5,y+12,act->pos.z);
//print(x+5,y+12,order);
//print(x+5,y,act->flags);
}
if (draw_all && act->next) draw(act->next);
}