- Dev Mode i Game Mode

This commit is contained in:
2024-07-02 19:31:19 +02:00
parent 3e83fcdaa8
commit eed4ec899c
7 changed files with 360 additions and 372 deletions

View File

@@ -2,9 +2,20 @@
namespace editor namespace editor
{ {
static bool editing = true; static bool devMode = false;
static bool editing = false;
static int current_template = 0; static int current_template = 0;
void setDevMode()
{
devMode = editing = true;
}
const bool isDevMode()
{
return devMode;
}
void setEditing(const bool value) void setEditing(const bool value)
{ {
editing = value; editing = value;

View File

@@ -2,6 +2,9 @@
namespace editor namespace editor
{ {
void setDevMode();
const bool isDevMode();
void setEditing(const bool value); void setEditing(const bool value);
const bool isEditing(); const bool isEditing();

View File

@@ -5,16 +5,28 @@
namespace game namespace game
{ {
static int param_count = 0;
static char **params = nullptr;
static unsigned int ticks_per_frame = 1000/60; static unsigned int ticks_per_frame = 1000/60;
void setUpdateTicks(const int ticks) void setUpdateTicks(const int ticks)
{ {
ticks_per_frame = ticks; ticks_per_frame = ticks;
} }
const char* getParams(const int index)
{
if (index<param_count) return params[index];
return nullptr;
}
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
game::param_count = argc;
game::params = argv;
game::init(); game::init();
input::init(draw::getZoom()); input::init(draw::getZoom());

View File

@@ -8,4 +8,5 @@ namespace game
bool loop(); bool loop();
const char* getParams(const int index);
} }

View File

@@ -31,7 +31,7 @@ int treeview_scroll = 0;
void restart() void restart()
{ {
actor::hero::init(); actor::hero::init();
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); room::load(1); //room_w, room_h, room_xp, room_xn, room_yp, room_yn, room_color, room_floor, room_walls, room_doors, room_walldoors);
/* /*
@@ -52,7 +52,12 @@ void restart()
void game::init() void game::init()
{ {
draw::init("The Pool", 520, 240, 3); if (game::getParams(1) && strcmp(game::getParams(1), "editor")==0) editor::setDevMode();
if (editor::isDevMode())
draw::init("The Pool", 520, 240, 3);
else
draw::init("The Pool", 320, 240, 3);
//room::init(); //room::init();
surf = draw::getSurface("test.gif"); surf = draw::getSurface("test.gif");
@@ -362,10 +367,10 @@ bool game::loop()
draw::resetViewport(); draw::resetViewport();
draw::cls(2); draw::cls(2);
draw::setViewport(100,0,320,240); if (editor::isDevMode()) draw::setViewport(100,0,320,240);
actor::reorder(); actor::reorder();
editor_select_by_keyboard(); if (editor::isEditing()) editor_select_by_keyboard();
room::draw(); room::draw();
actor::draw(actor::getFirst()); actor::draw(actor::getFirst());
@@ -400,136 +405,130 @@ bool game::loop()
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);
*/ */
if (!editor::isDevMode())
/* {
if (section==0) { draw::render();
draw::print("ROOM", 334, 13, YELLOW, LIGHT+BLACK); return true;
if (ui::button("ACTORS", 365, 10, 30, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE)) section=1;
} else {
if (ui::button("ROOM", 330, 10, 30, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE)) section=0;
draw::print("ACTORS", 369, 13, YELLOW, BLACK);
} }
*/
actor::actor_t *act = nullptr; actor::actor_t *act = nullptr;
/* draw::setViewport(0,0,100,240);
switch (section) { draw::color(WHITE);
case 0: draw::fillrect(0, 0, 100, 240);
*/
draw::setViewport(0,0,100,240);
draw::color(WHITE);
draw::fillrect(0, 0, 100, 240);
//if (ui::button("+ACTOR", 2, 2, 28, 11)) int result = ui::combo(actor::templates::get(editor::getCurrentTemplate())->name, 2, 2, 76, 11);
//{ if (result)
//room::load(room::editor::getCurrentRoom()); {
//editor::setEditing(!editor::isEditing()); int new_current_template = editor::getCurrentTemplate() + (result-2);
//} if (new_current_template >= actor::templates::size()) new_current_template = 0;
int result = ui::combo(actor::templates::get(editor::getCurrentTemplate())->name, 2, 2, 76, 11); if (new_current_template < 0) new_current_template = actor::templates::size()-1;
if (result) editor::setCurrentTemplate(new_current_template);
{ }
int new_current_template = editor::getCurrentTemplate() + (result-2); if (ui::button("NEW", 78, 2, 20, 11))
if (new_current_template >= actor::templates::size()) new_current_template = 0; {
if (new_current_template < 0) new_current_template = actor::templates::size()-1; actor::actor_t *new_act = actor::duplicate(actor::templates::get(editor::getCurrentTemplate()));
editor::setCurrentTemplate(new_current_template); actor::setUniqueName(new_act);
} actor::setDirty(new_act, true);
if (ui::button("NEW", 78, 2, 20, 11)) actor::select(new_act);
{ room::editor::modify();
actor::actor_t *new_act = actor::duplicate(actor::templates::get(editor::getCurrentTemplate())); }
actor::setUniqueName(new_act);
actor::setDirty(new_act, true);
actor::select(new_act);
room::editor::modify();
}
draw::color(LIGHT+WHITE); draw::color(LIGHT+WHITE);
draw::fillrect(2, 15, 96, 223); draw::fillrect(2, 15, 96, 223);
draw::color(PAPER); draw::color(PAPER);
draw::rect(2, 15, 96, 223); draw::rect(2, 15, 96, 223);
draw::setViewport(0, 15, 100, 222); draw::setViewport(0, 15, 100, 222);
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());
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3); const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
if (mx>=0 && mx <=100 && my>=0 && my<=221) if (mx>=0 && mx <=100 && my>=0 && my<=221)
{ {
treeview_scroll -= input::mouseWheel(); treeview_scroll -= input::mouseWheel();
if (treeview_scroll<0) treeview_scroll=0; if (treeview_scroll<0) treeview_scroll=0;
} }
switch (section) switch (section)
{ {
case SECTION_GENERAL: treeview_scroll = 0; break; case SECTION_GENERAL: treeview_scroll = 0; break;
case SECTION_ROOM: if (treeview_scroll > room::editor::getCurrentRoom()+1) treeview_scroll = room::editor::getCurrentRoom()+1; case SECTION_ROOM: if (treeview_scroll > room::editor::getCurrentRoom()+1) treeview_scroll = room::editor::getCurrentRoom()+1;
} }
int line = -treeview_scroll; int line = -treeview_scroll;
if (section==SECTION_GENERAL) if (section==SECTION_GENERAL)
{
draw::color(LIGHT+BLUE);
draw::fillrect(4, 2+line*9, 92, 9);
}
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
section = SECTION_GENERAL;
}
draw::print("-THE POOL", 6, 4+line*9, LIGHT+WHITE, BLACK);
line++;
for (int i=0;i<64;++i)
{
if (room::editor::roomExists(i))
{
if (section==SECTION_ROOM && i == room::editor::getCurrentRoom())
{ {
draw::color(LIGHT+BLUE); draw::color(LIGHT+BLUE);
draw::fillrect(4, 2+line*9, 92, 9); draw::fillrect(4, 2+line*9, 92, 9);
} }
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) { if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
section = SECTION_GENERAL; room::load(i);
section = SECTION_ROOM;
} }
draw::print("-THE POOL", 6, 4+line*9, LIGHT+WHITE, BLACK); char num[] = "+ROOM 00";
line++; num[6] = int(i/10)+48;
for (int i=0;i<64;++i) num[7] = (i%10)+48;
{ draw::print(num, 10, 4+line*9, LIGHT+WHITE, BLACK); line++;
if (room::editor::roomExists(i))
{
if (section==SECTION_ROOM && i == room::editor::getCurrentRoom())
{
draw::color(LIGHT+BLUE);
draw::fillrect(4, 2+line*9, 92, 9);
}
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
room::load(i);
section = SECTION_ROOM;
}
char num[] = "+ROOM 00";
num[6] = int(i/10)+48;
num[7] = (i%10)+48;
draw::print(num, 10, 4+line*9, LIGHT+WHITE, BLACK); line++;
if (i==room::editor::getCurrentRoom()) if (i==room::editor::getCurrentRoom())
{ {
act = actor::getFirst(); act = actor::getFirst();
while (act) { while (act) {
if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR && (act->flags&FLAG_HERO)!=FLAG_HERO) { if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR && (act->flags&FLAG_HERO)!=FLAG_HERO) {
if (section==SECTION_ACTOR && act==actor::getSelected()) { if (section==SECTION_ACTOR && act==actor::getSelected()) {
draw::color(LIGHT+BLUE); draw::color(LIGHT+BLUE);
draw::fillrect(4, 2+line*9, 92, 9); draw::fillrect(4, 2+line*9, 92, 9);
}
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
actor::select(act);
section = SECTION_ACTOR;
}
draw::print(act->name, 14, 4+line*9, LIGHT+WHITE, BLACK);
line++;
}
act = act->next;
} }
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
actor::select(act);
section = SECTION_ACTOR;
}
draw::print(act->name, 14, 4+line*9, LIGHT+WHITE, BLACK);
line++;
} }
act = act->next;
} }
}
if ((line+treeview_scroll)>24)
{
const float total_size = float(line+treeview_scroll);
int ascensor_length = 222.0f/(total_size/24.0f);
int ascensor_pos = 222.0f/(total_size/treeview_scroll);
draw::color(WHITE);
draw::fillrect(95, ascensor_pos, 2, ascensor_length);
} }
/* }
break; }
case 1:
*/ if ((line+treeview_scroll)>24)
{
const float total_size = float(line+treeview_scroll);
int ascensor_length = 222.0f/(total_size/24.0f);
int ascensor_pos = 222.0f/(total_size/treeview_scroll);
draw::color(WHITE);
draw::fillrect(95, ascensor_pos, 2, ascensor_length);
}
draw::setViewport(420, 0, 100, 240); draw::setViewport(420, 0, 100, 240);
draw::color(WHITE); draw::color(WHITE);
draw::fillrect(0, 0, 100, 240); draw::fillrect(0, 0, 100, 240);
@@ -541,277 +540,239 @@ bool game::loop()
editor::setEditing(!editor::isEditing()); editor::setEditing(!editor::isEditing());
} }
//draw::color(PAPER); // el borde del propertyview es pinta al final de tot
//draw::rect(2, 22, 96, 216);
draw::setViewport(420, 15, 100, 225); draw::setViewport(420, 15, 100, 225);
bool changed = false; bool changed = false;
switch (section) switch (section)
{ {
case SECTION_GENERAL: case SECTION_GENERAL:
break; break;
case SECTION_ROOM: case SECTION_ROOM:
draw::color(LIGHT+WHITE);
draw::fillrect(2, 0, 96, 223);
line = 0;
//changed |= btn("ROOM WIDTH:", 10, 40, room::editor::refWidth(), 0, 3);
//changed |= btn("ROOM HEIGHT:", 10, 55, room::editor::refHeight(), 0, 3);
ui::label("ROOM DIMENSIONS", 2, line, 96, 11, GRAY); line+=10;
ui::label("WIDTH", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refWidth(), 0, 3, 50);
line += 10;
ui::label("HEIGHT", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refHeight(), 0, 3, 50);
line += 10;
ui::label("DOOR HEIGHTS", 2, line, 96, 11, GRAY); line+=10;
ui::label("XN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoor(XN), -1, 5, 50);
line += 10;
ui::label("YP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoor(YP), -1, 5, 50);
line += 10;
ui::label("XP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoor(XP), -1, 5, 50);
line += 10;
ui::label("YN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoor(YN), -1, 5, 50);
line += 10;
ui::label("TEXTURES", 2, line, 96, 11, GRAY); line+=10;
changed |= btn_opt("COLOR", 2, line, room::editor::refColor(), {0, 1, 2, 3, 4}, {"PURPLE", "GREEN", "CYAN", "YELLOW", "WHITE"}, 47); //ui::label("COLOR", 2, line, 64, 11);
//changed |= btn_small(64, line, room::editor::refColor(), 5, 11);
line += 10;
ui::label("FLOOR", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refFloorTex(), 0, room::getFloorCount()-1, 50);
line += 10;
ui::label("WALL", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refWallTex(), 0, room::getWallsCount()-1, 50);
line += 10;
ui::label("DOOR", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoorTex(), 0, room::getDoorCount()-1, 50);
line += 10;
ui::label("UNDER DOOR", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refWallDoorTex(), 0, room::getWallsCount()-1, 50);
line += 10;
ui::label("EXITS", 2, line, 96, 11, GRAY); line+=10;
ui::label("XN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(XN), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(XN));
line += 10;
ui::label("YP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(YP), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(YP));
line += 10;
ui::label("XP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(XP), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(XP));
line += 10;
ui::label("YN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(YN), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(YN));
line += 10;
ui::label("ZP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(ZP), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(ZP));
line += 10;
ui::label("ZN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(ZN), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(ZN));
line += 10;
/*changed |= btn("COLOR:", 10, 140, room::editor::refColor(), 5, 11);
changed |= btn("FLOOR:", 10, 155, room::editor::refFloorTex(), 0, 5);
changed |= btn("WALLS:", 10, 170, room::editor::refWallTex(), 0, 5);
changed |= btn("DOORS:", 10, 185, room::editor::refDoorTex(), 0, 4);
changed |= btn("WDOORS:", 10, 200, room::editor::refWallDoorTex(), 0, 5);*/
if (changed) { room::editor::modify(); room::update(); }
draw::color(PAPER);
draw::rect(2, 0, 96, 223);
break;
case SECTION_ACTOR:
draw::color(LIGHT+WHITE);
draw::fillrect(2, 0, 96, 153);
changed = false;
act = actor::getSelected();
if (act)
{
line = 0;
//draw::setViewport(420, 90, 100, 150);
changed |= btn_txt("NAME", 2, line, act->name); line+=10;
ui::label("LOCATION", 2, line, 96, 11, GRAY); line+=10;
ui::label("POS", 2, line, 48, 11);
changed |= btn_small(49, line, act->pos.x, 0, 512);
changed |= btn_small(65, line, act->pos.y, 0, 512);
changed |= btn_small(81, line, act->pos.z, 0, 512);
line+=10;
ui::label("SIZE", 2, line, 48, 11);
changed |= btn_small(49, line, act->size.x, 0, 512);
changed |= btn_small(65, line, act->size.y, 0, 512);
changed |= btn_small(81, line, act->size.z, 0, 512);
line+=10;
ui::label("BITMAP", 2, line, 96, 11, GRAY); line+=10;
if (btn_opt2("FILE", 2, line, act->bmp, gifs)) {
//draw::freeSurface(act->surface);
act->surface = draw::getSurface(act->bmp);
changed = true;
}
line+=10;
ui::label("POS", 2, line, 48, 11);
changed |= btn_small(49, line, act->bmp_rect.x, 0, 512, 25);
changed |= btn_small(73, line, act->bmp_rect.y, 0, 512, 25);
line+=10;
ui::label("SIZE", 2, line, 48, 11);
changed |= btn_small(49, line, act->bmp_rect.w, 0, 512, 25);
changed |= btn_small(73, line, act->bmp_rect.h, 0, 512, 25);
line+=10;
ui::label("OFFSET", 2, line, 48, 11);
changed |= btn_small(49, line, act->bmp_offset.x, -32, 64, 25);
changed |= btn_small(73, line, act->bmp_offset.y, -32, 64, 25);
line+=10;
ui::label("FLAGS", 2, line, 96, 11, GRAY);
changed |= btn_check(74, line, "SPEC", act->flags, FLAG_SPECIAL);
line+=10;
changed |= btn_check(2, line, "PICK", act->flags, FLAG_PICKABLE);
changed |= btn_check(26, line, "PUSH", act->flags, FLAG_PUSHABLE);
changed |= btn_check(50, line, "REAC", act->flags, FLAG_REACTIVE);
changed |= btn_check(74, line, "MOVI", act->flags, FLAG_MOVING);
line+=10;
changed |= btn_check(2, line, "ANIM", act->flags, FLAG_ANIMATED);
changed |= btn_check(26, line, "ORIE", act->flags, FLAG_ORIENTABLE);
changed |= btn_check(50, line, "DEAD", act->flags, FLAG_DEADLY);
changed |= btn_check(74, line, "GRAV", act->flags, FLAG_GRAVITY);
line+=11;
ui::label("PROPERTIES", 2, line, 96, 11, GRAY); line+=10;
if (btn_opt("ORIENT", 2, line, act->orient, {PUSH_NONE, PUSH_XP, PUSH_XN, PUSH_YP, PUSH_YN, PUSH_ZP, PUSH_ZN}, {"NONE", "XP", "XN", "YP", "YN", "ZP", "ZN"}, 48))
{
act->mov_push = act->orient;
changed = true;
}
line+=10;
changed |= btn_opt("MOVEMNT", 2, line, act->movement, {MOV_NONE, MOV_X, MOV_Y, MOV_Z, MOV_CW, MOV_CCW, MOV_RAND, MOV_HUNT}, {"NONE", "X", "Y", "Z", "CW", "CCW", "RAND", "HUNT"}, 48);
line+=10;
changed |= btn_opt("ANIMCYC", 2, line, act->anim_cycle, {0, 1, 2}, {"0 1 0 2", "0 1 2 3", "0 1 2"}, 48);
line+=10;
//draw::print("ANIM SPEED:", 2, 156, 15, 0);
ui::label("ANMSPED", 2, line, 49, 11);
changed |= btn_small(49, line, act->anim_wait, 0, 10, 49);
line+=10;
ui::label("MASKS", 2, line, 96, 11, GRAY); line+=10;
ui::label("RMASK", 2, line, 24, 11);
changed |= btn_check(24+2, line, "XP", act->react_mask, PUSH_XP, 12);
changed |= btn_check(24+14, line, "XN", act->react_mask, PUSH_XN, 12);
changed |= btn_check(24+26, line, "YP", act->react_mask, PUSH_YP, 12);
changed |= btn_check(24+38, line, "YN", act->react_mask, PUSH_YN, 12);
changed |= btn_check(24+50, line, "ZP", act->react_mask, PUSH_ZP, 12);
changed |= btn_check(24+62, line, "ZN", act->react_mask, PUSH_ZN, 12);
line+=11;
ui::label("RPUSH", 2, line, 24, 11);
changed |= btn_check(24+2, line, "XP", act->react_push, PUSH_XP, 12);
changed |= btn_check(24+14, line, "XN", act->react_push, PUSH_XN, 12);
changed |= btn_check(24+26, line, "YP", act->react_push, PUSH_YP, 12);
changed |= btn_check(24+38, line, "YN", act->react_push, PUSH_YN, 12);
changed |= btn_check(24+50, line, "ZP", act->react_push, PUSH_ZP, 12);
changed |= btn_check(24+62, line, "ZN", act->react_push, PUSH_ZN, 12);
line+=12;
draw::color(PAPER);
draw::rect(2, 0, 96, 204);
if (ui::button("DUPLICATE", 2, line, 48, 11))
{
actor::actor_t *new_act = actor::duplicate(act);
actor::setUniqueName(new_act);
new_act->pos.x++; new_act->pos.y++;
actor::setDirty(new_act, true);
actor::select(new_act);
changed = true;
}
if (ui::button("DELETE", 48, line, 48, 11))
{
actor::remove(act);
act = nullptr;
changed = true;
}
line+=10;
if (changed) { room::editor::modify(); }
if (ui::button("ADD TO TEMPLATES", 2, line, 96, 11))
{
if (act) actor::templates::add(act);
}
//changed |= btn_opt("ANIMCYC", 2, 106, act->anim_cycle, {0, 1}, {"0 1 0 2", "0 1 2 3"});
}
break;
};
/*
break;
}
*/
/* case 2:
draw::setViewport(320, 38, 100, 100);
draw::color(LIGHT+WHITE); draw::color(LIGHT+WHITE);
draw::fillrect(2, 0, 96, 100); draw::fillrect(2, 0, 96, 223);
line = 0;
//changed |= btn("ROOM WIDTH:", 10, 40, room::editor::refWidth(), 0, 3);
//changed |= btn("ROOM HEIGHT:", 10, 55, room::editor::refHeight(), 0, 3);
ui::label("ROOM DIMENSIONS", 2, line, 96, 11, GRAY); line+=10;
ui::label("WIDTH", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refWidth(), 0, 3, 50);
line += 10;
ui::label("HEIGHT", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refHeight(), 0, 3, 50);
line += 10;
ui::label("DOOR HEIGHTS", 2, line, 96, 11, GRAY); line+=10;
ui::label("XN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoor(XN), -1, 5, 50);
line += 10;
ui::label("YP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoor(YP), -1, 5, 50);
line += 10;
ui::label("XP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoor(XP), -1, 5, 50);
line += 10;
ui::label("YN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoor(YN), -1, 5, 50);
line += 10;
ui::label("TEXTURES", 2, line, 96, 11, GRAY); line+=10;
changed |= btn_opt("COLOR", 2, line, room::editor::refColor(), {0, 1, 2, 3, 4}, {"PURPLE", "GREEN", "CYAN", "YELLOW", "WHITE"}, 47); //ui::label("COLOR", 2, line, 64, 11);
//changed |= btn_small(64, line, room::editor::refColor(), 5, 11);
line += 10;
ui::label("FLOOR", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refFloorTex(), 0, room::getFloorCount()-1, 50);
line += 10;
ui::label("WALL", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refWallTex(), 0, room::getWallsCount()-1, 50);
line += 10;
ui::label("DOOR", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refDoorTex(), 0, room::getDoorCount()-1, 50);
line += 10;
ui::label("UNDER DOOR", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refWallDoorTex(), 0, room::getWallsCount()-1, 50);
line += 10;
ui::label("EXITS", 2, line, 96, 11, GRAY); line+=10;
ui::label("XN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(XN), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(XN));
line += 10;
ui::label("YP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(YP), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(YP));
line += 10;
ui::label("XP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(XP), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(XP));
line += 10;
ui::label("YN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(YN), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(YN));
line += 10;
ui::label("ZP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(ZP), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(ZP));
line += 10;
ui::label("ZN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(ZN), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(ZN));
line += 10;
/*changed |= btn("COLOR:", 10, 140, room::editor::refColor(), 5, 11);
changed |= btn("FLOOR:", 10, 155, room::editor::refFloorTex(), 0, 5);
changed |= btn("WALLS:", 10, 170, room::editor::refWallTex(), 0, 5);
changed |= btn("DOORS:", 10, 185, room::editor::refDoorTex(), 0, 4);
changed |= btn("WDOORS:", 10, 200, room::editor::refWallDoorTex(), 0, 5);*/
if (changed) { room::editor::modify(); room::update(); }
draw::color(PAPER); draw::color(PAPER);
draw::rect(2, 0, 96, 100); draw::rect(2, 0, 96, 223);
const int mx = draw::getLocalX(input::mouseX()); break;
const int my = draw::getLocalY(input::mouseY());
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
int line = 0; case SECTION_ACTOR:
act = actor::getFirst(); draw::color(LIGHT+WHITE);
while (act) { draw::fillrect(2, 0, 96, 153);
if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR) {
if (act==actor::getSelected()) { changed = false;
draw::color(LIGHT+BLUE); act = actor::getSelected();
draw::fillrect(4, 2+line*9, 92, 9); if (act)
} {
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) { line = 0;
actor::select(act); //draw::setViewport(420, 90, 100, 150);
//section=1;
} changed |= btn_txt("NAME", 2, line, act->name); line+=10;
draw::print(act->name, 6, 4+line*9, LIGHT+WHITE, BLACK);
line++; ui::label("LOCATION", 2, line, 96, 11, GRAY); line+=10;
ui::label("POS", 2, line, 48, 11);
changed |= btn_small(49, line, act->pos.x, 0, 512);
changed |= btn_small(65, line, act->pos.y, 0, 512);
changed |= btn_small(81, line, act->pos.z, 0, 512);
line+=10;
ui::label("SIZE", 2, line, 48, 11);
changed |= btn_small(49, line, act->size.x, 0, 512);
changed |= btn_small(65, line, act->size.y, 0, 512);
changed |= btn_small(81, line, act->size.z, 0, 512);
line+=10;
ui::label("BITMAP", 2, line, 96, 11, GRAY); line+=10;
if (btn_opt2("FILE", 2, line, act->bmp, gifs)) {
//draw::freeSurface(act->surface);
act->surface = draw::getSurface(act->bmp);
changed = true;
} }
act = act->next; line+=10;
ui::label("POS", 2, line, 48, 11);
changed |= btn_small(49, line, act->bmp_rect.x, 0, 512, 25);
changed |= btn_small(73, line, act->bmp_rect.y, 0, 512, 25);
line+=10;
ui::label("SIZE", 2, line, 48, 11);
changed |= btn_small(49, line, act->bmp_rect.w, 0, 512, 25);
changed |= btn_small(73, line, act->bmp_rect.h, 0, 512, 25);
line+=10;
ui::label("OFFSET", 2, line, 48, 11);
changed |= btn_small(49, line, act->bmp_offset.x, -32, 64, 25);
changed |= btn_small(73, line, act->bmp_offset.y, -32, 64, 25);
line+=10;
ui::label("FLAGS", 2, line, 96, 11, GRAY);
changed |= btn_check(74, line, "SPEC", act->flags, FLAG_SPECIAL);
line+=10;
changed |= btn_check(2, line, "PICK", act->flags, FLAG_PICKABLE);
changed |= btn_check(26, line, "PUSH", act->flags, FLAG_PUSHABLE);
changed |= btn_check(50, line, "REAC", act->flags, FLAG_REACTIVE);
changed |= btn_check(74, line, "MOVI", act->flags, FLAG_MOVING);
line+=10;
changed |= btn_check(2, line, "ANIM", act->flags, FLAG_ANIMATED);
changed |= btn_check(26, line, "ORIE", act->flags, FLAG_ORIENTABLE);
changed |= btn_check(50, line, "DEAD", act->flags, FLAG_DEADLY);
changed |= btn_check(74, line, "GRAV", act->flags, FLAG_GRAVITY);
line+=11;
ui::label("PROPERTIES", 2, line, 96, 11, GRAY); line+=10;
if (btn_opt("ORIENT", 2, line, act->orient, {PUSH_NONE, PUSH_XP, PUSH_XN, PUSH_YP, PUSH_YN, PUSH_ZP, PUSH_ZN}, {"NONE", "XP", "XN", "YP", "YN", "ZP", "ZN"}, 48))
{
act->mov_push = act->orient;
changed = true;
}
line+=10;
changed |= btn_opt("MOVEMNT", 2, line, act->movement, {MOV_NONE, MOV_X, MOV_Y, MOV_Z, MOV_CW, MOV_CCW, MOV_RAND, MOV_HUNT}, {"NONE", "X", "Y", "Z", "CW", "CCW", "RAND", "HUNT"}, 48);
line+=10;
changed |= btn_opt("ANIMCYC", 2, line, act->anim_cycle, {0, 1, 2}, {"0 1 0 2", "0 1 2 3", "0 1 2"}, 48);
line+=10;
//draw::print("ANIM SPEED:", 2, 156, 15, 0);
ui::label("ANMSPED", 2, line, 49, 11);
changed |= btn_small(49, line, act->anim_wait, 0, 10, 49);
line+=10;
ui::label("MASKS", 2, line, 96, 11, GRAY); line+=10;
ui::label("RMASK", 2, line, 24, 11);
changed |= btn_check(24+2, line, "XP", act->react_mask, PUSH_XP, 12);
changed |= btn_check(24+14, line, "XN", act->react_mask, PUSH_XN, 12);
changed |= btn_check(24+26, line, "YP", act->react_mask, PUSH_YP, 12);
changed |= btn_check(24+38, line, "YN", act->react_mask, PUSH_YN, 12);
changed |= btn_check(24+50, line, "ZP", act->react_mask, PUSH_ZP, 12);
changed |= btn_check(24+62, line, "ZN", act->react_mask, PUSH_ZN, 12);
line+=11;
ui::label("RPUSH", 2, line, 24, 11);
changed |= btn_check(24+2, line, "XP", act->react_push, PUSH_XP, 12);
changed |= btn_check(24+14, line, "XN", act->react_push, PUSH_XN, 12);
changed |= btn_check(24+26, line, "YP", act->react_push, PUSH_YP, 12);
changed |= btn_check(24+38, line, "YN", act->react_push, PUSH_YN, 12);
changed |= btn_check(24+50, line, "ZP", act->react_push, PUSH_ZP, 12);
changed |= btn_check(24+62, line, "ZN", act->react_push, PUSH_ZN, 12);
line+=12;
draw::color(PAPER);
draw::rect(2, 0, 96, 204);
if (ui::button("DUPLICATE", 2, line, 48, 11))
{
actor::actor_t *new_act = actor::duplicate(act);
actor::setUniqueName(new_act);
new_act->pos.x++; new_act->pos.y++;
actor::setDirty(new_act, true);
actor::select(new_act);
changed = true;
}
if (ui::button("DELETE", 48, line, 48, 11))
{
actor::remove(act);
act = nullptr;
changed = true;
}
line+=10;
if (changed) { room::editor::modify(); }
if (ui::button("ADD TO TEMPLATES", 2, line, 96, 11))
{
if (act) actor::templates::add(act);
}
//changed |= btn_opt("ANIMCYC", 2, 106, act->anim_cycle, {0, 1}, {"0 1 0 2", "0 1 2 3"});
} }
break; break;
*/ };
draw::render(); draw::render();
return true; return true;
} }

View File

@@ -7,7 +7,7 @@
namespace room namespace room
{ {
static int current_room = 0; static int current_room = 1;
static int inner_w = 2; static int inner_w = 2;
static int inner_h = 2; static int inner_h = 2;

View File

@@ -44,7 +44,7 @@ x Gràfics de bancada de cuina
x Implementar eixides per dalt x Implementar eixides per dalt
x Implementar eixides per baix x Implementar eixides per baix
x Implementar pickar objectes x Implementar pickar objectes
- Implementar inventari x Implementar inventari
- Menus - Menus
- Molt bàsics, com els del Batman de Spectrum - Molt bàsics, com els del Batman de Spectrum