- [NEW] mòdul editor per a handlechar tot lo relacionat en l'editor
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
16
source/editor.cpp
Normal file
16
source/editor.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "editor.h"
|
||||
|
||||
namespace editor
|
||||
{
|
||||
static bool editing = true;
|
||||
|
||||
void setEditing(const bool value)
|
||||
{
|
||||
editing = value;
|
||||
}
|
||||
|
||||
const bool isEditing()
|
||||
{
|
||||
return editing;
|
||||
}
|
||||
}
|
||||
7
source/editor.h
Normal file
7
source/editor.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace editor
|
||||
{
|
||||
void setEditing(const bool value);
|
||||
const bool isEditing();
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "actor.h"
|
||||
#include "room.h"
|
||||
#include "jui.h"
|
||||
|
||||
#include "editor.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
@@ -26,8 +26,6 @@ int room_walldoors = 0;
|
||||
|
||||
std::vector<std::string> gifs;
|
||||
|
||||
bool editing = true;
|
||||
|
||||
void restart()
|
||||
{
|
||||
room::load(0); //room_w, room_h, room_xp, room_xn, room_yp, room_yn, room_color, room_floor, room_walls, room_doors, room_walldoors);
|
||||
@@ -291,7 +289,7 @@ bool game::loop()
|
||||
|
||||
|
||||
// WHILE EDITING...
|
||||
if (editing)
|
||||
if (editor::isEditing())
|
||||
{
|
||||
editor_move_selected();
|
||||
actor::updateEditor(actor::getFirst());
|
||||
|
||||
Reference in New Issue
Block a user