- Reorganització de part del codi abans de implementar la càrrega de nivells des d'arxiu

This commit is contained in:
2024-06-05 08:21:29 +02:00
parent 5fdbb217e3
commit 873a0aff74
3 changed files with 7 additions and 11 deletions

View File

@@ -769,7 +769,7 @@ namespace actor
hero->above = hero->below = hero->next = hero->prev = nullptr;
dirty = hero;
}
selected = nullptr;
}
namespace templates

View File

@@ -26,12 +26,6 @@ std::vector<std::string> gifs;
void restart()
{
//actor::clear();
actor::remove(actor::find("DOOR_YP1"));
actor::remove(actor::find("DOOR_YP2"));
actor::remove(actor::find("DOOR_XP1"));
actor::remove(actor::find("DOOR_XP2"));
room::load(room_w, room_h, room_xp, room_xn, room_yp, room_yn, room_color, room_floor, room_walls, room_doors, room_walldoors);
/*
@@ -47,7 +41,7 @@ void restart()
//box->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED;
//actor::setDirty(box, true);
actor::reorder();
//actor::reorder();
}
void game::init()
@@ -74,7 +68,7 @@ void game::init()
hero->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED;
actor::setDirty(hero, true);
actor::clear();
restart();
actor::actor_t *box = actor::create("BOX", {32,32,16}, {8,8,8}, "test.gif", {32,0,32,32}, {0,32});
box->flags = FLAG_PUSHABLE | FLAG_GRAVITY;
@@ -88,8 +82,6 @@ void game::init()
box->mov_push = PUSH_XN;
actor::setDirty(box, true);
restart();
actor::select(actor::find("BOX"));
}

View File

@@ -26,6 +26,8 @@ namespace room
void init()
{
actor::clear();
if (floor_surf) draw::freeSurface(floor_surf);
if (walls_surf) draw::freeSurface(walls_surf);
if (doors_surf) draw::freeSurface(doors_surf);
@@ -77,6 +79,8 @@ namespace room
act->flags = FLAG_NOEDITOR;
actor::setDirty(act, true);
}
actor::reorder();
}
void draw()