- Les vores de baix de les portes son configurables

- En les portes de davant, si el piso està a ras tenen el mateix floor, sinó tenen el primer (per a que contraste)
This commit is contained in:
2023-09-12 19:13:44 +02:00
parent 7023419151
commit ed27bd2680
3 changed files with 26 additions and 20 deletions

View File

@@ -17,6 +17,7 @@ namespace room
static uint8_t floor_type = 0;
static uint8_t walls_type = 0;
static uint8_t doors_type = 0;
static uint8_t walldoors_type = 0;
static draw::surface *floor_surf = nullptr;
static draw::surface *walls_surf = nullptr;
@@ -36,13 +37,14 @@ namespace room
aux_surf = draw::loadSurface("roomaux.gif");
}
void load(int x, int y, int8_t xp, int8_t xn, int8_t yp, int8_t yn, uint8_t col, uint8_t floor, uint8_t walls, uint8_t door)
void load(int x, int y, int8_t xp, int8_t xn, int8_t yp, int8_t yn, uint8_t col, uint8_t floor, uint8_t walls, uint8_t door, uint8_t walldoor)
{
init();
color = col;
floor_type = floor;
walls_type = walls;
doors_type = door;
walldoors_type = walldoor;
size = {(x+1)*2,(y+1)*2,3};
tmin = {3-x,3-y,0};
tmax = {4+x,4+y,3};
@@ -56,20 +58,22 @@ namespace room
if (doors & DOOR_YP)
{
actor::actor_t *act = actor::create("DOOR_YP1", {24,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, {0,1,32,15}, {0,15+door_height[2]*8});
uint8_t actual_floor = door_height[2]>0?0:floor_type*32;
actor::actor_t *act = actor::create("DOOR_YP1", {24,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, "floor.gif", {actual_floor,1,32,15}, {0,15+door_height[2]*8});
act->flags = FLAG_NONE;
actor::setDirty(act, true);
act = actor::create("DOOR_YP2", {32,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, {0,1,32,15}, {0,15+door_height[2]*8});
act = actor::create("DOOR_YP2", {32,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, "floor.gif", {actual_floor,1,32,15}, {0,15+door_height[2]*8});
act->flags = FLAG_NONE;
actor::setDirty(act, true);
}
if (doors & DOOR_XP)
{
actor::actor_t *act = actor::create("DOOR_XP1", {(tmax.x+1)*8,24,0}, {8,8,(door_height[0])*4}, {0,1,32,15}, {0,15+door_height[0]*8});
uint8_t actual_floor = door_height[0]>0?0:floor_type*32;
actor::actor_t *act = actor::create("DOOR_XP1", {(tmax.x+1)*8,24,0}, {8,8,(door_height[0])*4}, "floor.gif", {actual_floor,1,32,15}, {0,15+door_height[0]*8});
act->flags = FLAG_NONE;
actor::setDirty(act, true);
act = actor::create("DOOR_XP2", {(tmax.x+1)*8,32,0}, {8,8,(door_height[0])*4}, {0,1,32,15}, {0,15+door_height[0]*8});
act = actor::create("DOOR_XP2", {(tmax.x+1)*8,32,0}, {8,8,(door_height[0])*4}, "floor.gif", {actual_floor,1,32,15}, {0,15+door_height[0]*8});
act->flags = FLAG_NONE;
actor::setDirty(act, true);
}
@@ -86,8 +90,8 @@ namespace room
// Si la porta està elevada, pintar la part frontal de baix de la porta
if (door_height[3] > 0) {
draw::setSource(walls_surf);
draw::draw( 164+3*16-tmin.y*16, (36+3*8+tmin.y*8) + (5-door_height[3])*8, 16, 48-(5-door_height[3])*8, walls_type*16, (5-door_height[3])*8);
draw::draw( 164+4*16-tmin.y*16, (36+4*8+tmin.y*8) + (5-door_height[3])*8, 16, 48-(5-door_height[3])*8, walls_type*16, (5-door_height[3])*8);
draw::draw( 164+3*16-tmin.y*16, (36+3*8+tmin.y*8) + (5-door_height[3])*8, 16, 48-(5-door_height[3])*8, walldoors_type*16, (5-door_height[3])*8);
draw::draw( 164+4*16-tmin.y*16, (36+4*8+tmin.y*8) + (5-door_height[3])*8, 16, 48-(5-door_height[3])*8, walldoors_type*16, (5-door_height[3])*8);
}
// Pintem els dos tiles baix de la porta
@@ -108,8 +112,8 @@ namespace room
// Si la porta està elevada, pintar la part frontal de baix de la porta
if (door_height[1] > 0) {
draw::setSource(walls_surf);
draw::draw(148+tmin.x*16-3*16, (36+tmin.x*8+3*8)+(5-door_height[1])*8, 16, 48-(5-door_height[1])*8, walls_type*16, (5-door_height[1])*8, DRAW_FLIP_HORIZONTAL);
draw::draw(148+tmin.x*16-4*16, (36+tmin.x*8+4*8)+(5-door_height[1])*8, 16, 48-(5-door_height[1])*8, walls_type*16, (5-door_height[1])*8, DRAW_FLIP_HORIZONTAL);
draw::draw(148+tmin.x*16-3*16, (36+tmin.x*8+3*8)+(5-door_height[1])*8, 16, 48-(5-door_height[1])*8, walldoors_type*16, (5-door_height[1])*8, DRAW_FLIP_HORIZONTAL);
draw::draw(148+tmin.x*16-4*16, (36+tmin.x*8+4*8)+(5-door_height[1])*8, 16, 48-(5-door_height[1])*8, walldoors_type*16, (5-door_height[1])*8, DRAW_FLIP_HORIZONTAL);
}
// Pintem els dos tiles baix de la porta
@@ -162,9 +166,9 @@ namespace room
{
// Pintem les voreres dels dos tiles extra per a la porta YP
draw::setSource(walls_surf);
draw::draw(164+4*16-(tmax.y+1)*16, -door_height[2]*8+84+4*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walls_type*16, 1, DRAW_FLIP_HORIZONTAL);
draw::draw(148+3*16-(tmax.y+1)*16, -door_height[2]*8+84+3*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walls_type*16, 1);
draw::draw(148+4*16-(tmax.y+1)*16, -door_height[2]*8+84+4*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walls_type*16, 1);
draw::draw(164+4*16-(tmax.y+1)*16, -door_height[2]*8+84+4*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walldoors_type*16, 1, DRAW_FLIP_HORIZONTAL);
draw::draw(148+3*16-(tmax.y+1)*16, -door_height[2]*8+84+3*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walldoors_type*16, 1);
draw::draw(148+4*16-(tmax.y+1)*16, -door_height[2]*8+84+4*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walldoors_type*16, 1);
draw::setSource(aux_surf);
draw::draw(164+4*16-(tmax.y+1)*16, 91+4*8+(tmax.y+1)*8, 16, 8, 16, 0);
@@ -179,9 +183,9 @@ namespace room
{
// Pintem les voreres dels dos tiles extra per a la porta XP
draw::setSource(walls_surf);
draw::draw(148+(tmax.x+1)*16-4*16, -door_height[0]*8+84+(tmax.x+1)*8+4*8,16,15+door_height[0]*8,walls_type*16, 1);
draw::draw(164+(tmax.x+1)*16-3*16, -door_height[0]*8+84+(tmax.x+1)*8+3*8,16,15+door_height[0]*8,walls_type*16, 1, DRAW_FLIP_HORIZONTAL);
draw::draw(164+(tmax.x+1)*16-4*16, -door_height[0]*8+84+(tmax.x+1)*8+4*8,16,15+door_height[0]*8,walls_type*16, 1, DRAW_FLIP_HORIZONTAL);
draw::draw(148+(tmax.x+1)*16-4*16, -door_height[0]*8+84+(tmax.x+1)*8+4*8,16,15+door_height[0]*8,walldoors_type*16, 1);
draw::draw(164+(tmax.x+1)*16-3*16, -door_height[0]*8+84+(tmax.x+1)*8+3*8,16,15+door_height[0]*8,walldoors_type*16, 1, DRAW_FLIP_HORIZONTAL);
draw::draw(164+(tmax.x+1)*16-4*16, -door_height[0]*8+84+(tmax.x+1)*8+4*8,16,15+door_height[0]*8,walldoors_type*16, 1, DRAW_FLIP_HORIZONTAL);
draw::setSource(aux_surf);
draw::draw(148+(tmax.x+1)*16-4*16, 91+(tmax.x+1)*8+4*8,16,8,0,0);