- [FIX] Nomes l'heroi pot fer que els blocs que desapareixen desapareguen

- [NEW] Flag en l'editor de habitació completada, per a no tornar-me loco
- Més habitacions
This commit is contained in:
2024-10-01 10:44:58 +02:00
parent 093cd5916b
commit 231a81a9e5
54 changed files with 213 additions and 19 deletions

View File

@@ -527,7 +527,7 @@ namespace actor
else
result = act->react_push;
}
if (act->flags & FLAG_DISAPPEAR)
if ( (source->flags & FLAG_HERO) && (act->flags & FLAG_DISAPPEAR) )
{
act = actor::replaceWithTemplate(act, "EXPLOSION");
act->name[0]='_';

View File

@@ -23,6 +23,7 @@ namespace modules
uint8_t color;
uint8_t exits[6];
uint32_t specials;
uint8_t editor_done;
};
miniroom_t minirooms[64];
@@ -55,7 +56,7 @@ namespace modules
if ( (x>=-32) && (x<520) && (y>=-16) && (y<240) )
{
draw::stencil::set(room);
draw::swapcol(1, !shadow ? minirooms[room].color : 2);
draw::swapcol(1, !shadow ? minirooms[room].color : minirooms[room].editor_done==1 ? 2 : RED);
draw::draw(x-16, y-8, 32, 16, minirooms[room].w*32, minirooms[room].h*16);
if (!shadow)
@@ -86,6 +87,7 @@ namespace modules
minirooms[room].w = (room::getSize().x >> 1)-1;
minirooms[room].h = (room::getSize().y >> 1)-1;
minirooms[room].specials = 0;
minirooms[room].editor_done = room::editor::refEditorDone();
// Recolectem els especials de l'habitació per a mostrar-los
actor::actor_t *act = actor::getFirst();

View File

@@ -458,6 +458,15 @@ namespace modules
// ...i l'habitació actual
draw::print2(room::getCurrent(), -2, 4, 3, WHITE, FONT_ZOOM_BOTH);
// ...i la marca de habitació completada
draw::color(WHITE);
draw::rect(250, 24, 20, 20);
if (room::editor::refEditorDone())
{
draw::color(RED);
draw::fillrect(252, 26, 16, 16);
}
// ...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)) {
@@ -489,6 +498,12 @@ namespace modules
int room = room::editor::refExit(ZN);
if (room>=0 || input::keyDown(SDL_SCANCODE_LCTRL)) room::load(room, ZP);
}
if (mx>=250 && mx<270 && my>=24 && my<44) {
room::editor::refEditorDone() = room::editor::refEditorDone() ? 0 : 1;
room::editor::modify(); room::update();
}
}
}

View File

@@ -30,6 +30,8 @@ namespace room
static int doors_type = 0; // Textura per a les portes
static int walldoors_type = 0; // Textura per a baix de les portes
static int editor_done = 0; // Nomes per al editor, per a marcar les habitacions completades i no tornarme loco
static bool modified = false;
// Surface on se guarden els gràfics de cada cosa
@@ -175,7 +177,7 @@ namespace room
for (int i=0;i<4;++i) door_height[i] = -1;
color = original_color = 2;
num_color_cycles = 0;
floor_type = walls_type = doors_type = walldoors_type = 0;
floor_type = walls_type = doors_type = walldoors_type = editor_done = 0;
for (int i=0;i<6;++i) exits[i] = -1;
// Després intentem carregar els valors segons el arxiu que toca, si existeix
@@ -242,6 +244,9 @@ namespace room
} else if (util::strcomp(key, "exit-zn:")) {
const int val = file::readInt(&buffer);
exits[5] = SDL_clamp(val, 0, 64);
} else if (util::strcomp(key, "editor-done:")) {
const int val = file::readInt(&buffer);
editor_done = SDL_clamp(val, 0, 1);
} else if (util::strcomp(key, "actor{")) {
actor::actor_t *act = actor::createFromFile(&buffer);
@@ -579,6 +584,8 @@ namespace room
int &refExit(const int which) { return exits[which]; }
int &refEditorDone() { return editor_done; }
bool roomExists(const int which) { return room_exists[which]; }
void updateRoomList()
@@ -636,6 +643,8 @@ namespace room
if (exits[ZP]!=-1) fprintf(f, "exit-zp: %i\n", exits[ZP]);
if (exits[ZN]!=-1) fprintf(f, "exit-zn: %i\n", exits[ZN]);
if (editor_done!=0) fprintf(f, "editor-done: %i\n", editor_done);
actor::actor_t *act = actor::alphaOrder(actor::getFirst());
while (act)
{

View File

@@ -59,6 +59,8 @@ namespace room
int &refExit(const int which);
int &refEditorDone();
bool roomExists(const int which);
void updateRoomList();