- Tamany i portes de l'habitacio editables

This commit is contained in:
2023-06-06 13:02:11 +02:00
parent 0460efc64a
commit 6e166c5e77
3 changed files with 45 additions and 7 deletions

View File

@@ -9,11 +9,16 @@
draw::surface *surf;
actor::actor_t *box;
int room_w = 0;
int room_h = 0;
int room_xp = 0;
int room_xn = 0;
int room_yp = 0;
int room_yn = 0;
void restart()
{
actor::clear();
room::load(room_w,3);
room::load(room_w, room_h, room_xp, room_xn, room_yp, room_yn);
box = actor::create("ASCENSOR",{16,32,0}, {8,8,4}, {64,0,32,24}, {0,24});
box->flags = FLAG_MOVING;
@@ -91,6 +96,38 @@ bool game::loop()
restart();
}
draw::print("ROOM HEIGHT:", 330, 28, 15, 0);
if (ui::button(SDL_itoa(room_h, buffer, 10), 380, 25, 28, 11))
{
room_h++;if(room_h>3)room_h=0;
restart();
}
draw::print("DOOR XP:", 330, 53, 15, 0);
if (ui::button(SDL_itoa(room_xp, buffer, 10), 380, 50, 28, 11))
{
room_xp++;if(room_xp>5)room_xp=-1;
restart();
}
draw::print("DOOR XN:", 330, 68, 15, 0);
if (ui::button(SDL_itoa(room_xn, buffer, 10), 380, 65, 28, 11))
{
room_xn++;if(room_xn>5)room_xn=-1;
restart();
}
draw::print("DOOR YP:", 330, 83, 15, 0);
if (ui::button(SDL_itoa(room_yp, buffer, 10), 380, 80, 28, 11))
{
room_yp++;if(room_yp>5)room_yp=-1;
restart();
}
draw::print("DOOR YN:", 330, 98, 15, 0);
if (ui::button(SDL_itoa(room_yn, buffer, 10), 380, 95, 28, 11))
{
room_yn++;if(room_yn>5)room_yn=-1;
restart();
}
draw::render();
return true;

View File

@@ -13,17 +13,18 @@ namespace room
static uint8_t doors = DOOR_XP /*| DOOR_YP*/ ;
static uint8_t door_height[4];
void load(int x, int y)
void load(int x, int y, int8_t xp, int8_t xn, int8_t yp, int8_t yn)
{
size = {(x+1)*2,(y+1)*2,3};
tmin = {3-x,3-y,0};
tmax = {4+x,4+y,3};
min = {tmin.x*8,tmin.y*8,0};
max = {tmax.x*8,tmax.y*8,24};
door_height[0] = 2; //XP
door_height[1] = 3; //XN
door_height[2] = 2; //YP
door_height[3] = 5; //YN
doors = (xp>=0?DOOR_XP:0) | (xn>=0?DOOR_XN:0) | (yp>=0?DOOR_YP:0) | (yn>=0?DOOR_YN:0);
door_height[0] = xp; //XP
door_height[1] = xn; //XN
door_height[2] = yp; //YP
door_height[3] = yn; //YN
if (doors & DOOR_YP)
{

View File

@@ -8,7 +8,7 @@
namespace room
{
void load(int x, int y);
void load(int x, int y, int8_t xp, int8_t xn, int8_t yp, int8_t yn);
void draw();
void draw2();