- Treballant en el editor

This commit is contained in:
2024-06-10 21:44:10 +02:00
parent 63e53c1e68
commit 042dd3c505
3 changed files with 125 additions and 62 deletions

View File

@@ -6,6 +6,8 @@
namespace room
{
static int current_room = 0;
static int inner_w = 2;
static int inner_h = 2;
@@ -15,15 +17,15 @@ namespace room
static vec3_t min = {0,0,0}; // primer "pixel isometric" en cada coordenada
static vec3_t max = {56,56,56}; // ultim "pixel isometric" en cada coordenada
static uint8_t doors = NO_DOOR; // Portes obertes
static uint8_t door_height[4]; // Altura de cada porta
static int8_t exits[6]; // Habitació destí a la que du cada porta (piso i sostre inclosos)
static uint8_t color = 5; // Color de l'habitació
static int doors = NO_DOOR; // Portes obertes
static int door_height[4]; // Altura de cada porta
static int exits[6]; // Habitació destí a la que du cada porta (piso i sostre inclosos)
static int color = 5; // Color de l'habitació
static uint8_t floor_type = 0; // Tile per al piso
static uint8_t walls_type = 0; // Tile per a les pareds
static uint8_t doors_type = 0; // Textura per a les portes
static uint8_t walldoors_type = 0; // Textura per a baix de les portes
static int floor_type = 0; // Tile per al piso
static int walls_type = 0; // Tile per a les pareds
static int doors_type = 0; // Textura per a les portes
static int walldoors_type = 0; // Textura per a baix de les portes
// Surface on se guarden els gràfics de cada cosa
static draw::surface *floor_surf = nullptr;
@@ -46,6 +48,8 @@ namespace room
walls_surf = draw::loadSurface("walls.gif");
doors_surf = draw::loadSurface("doors.gif");
aux_surf = draw::loadSurface("roomaux.gif");
editor::updateRoomList();
}
void refresh()
@@ -171,7 +175,7 @@ namespace room
}
free(original_buffer);
}
current_room = room;
refresh();
}
@@ -337,33 +341,35 @@ namespace room
namespace editor
{
static bool room_exists[256];
int &refWidth() { return inner_w; }
int &refHeight() { return inner_h; }
uint8_t &refDoor(const int which) { return door_height[which]; }
int &refDoor(const int which) { return door_height[which]; }
void setWidth(const int value) { inner_w = value; update(); }
void setHeight(const int value) { inner_h = value; update(); }
void setDoor(const int which, const int value) { door_height[which] = value; update(); }
int &refColor() { return color; }
int &refFloorTex() { return floor_type; }
int &refWallTex() { return walls_type; }
int &refDoorTex() { return doors_type; }
int &refWallDoorTex() { return walldoors_type; }
void setColor(const int value) { color = value; update(); }
void setFloorTex(const int value) { floor_type = value; update(); }
void setWallTex(const int value) { walls_type = value; update(); }
void setDoorTex(const int value) { doors_type = value; update(); }
void setWallDoorTex(const int value) { walldoors_type = value; update(); }
void setExit(const int which, const int value) { exits[which] = value; update(); }
int &refExit(const int which) { return exits[which]; }
const int getWidth() { return inner_w; }
const int getHeight() { return inner_h; }
const int getDoor(const int which) { return door_height[which]; }
bool roomExists(const int which) { return room_exists[which]; }
const int getColor() { return color; }
const int getFloorTex() { return floor_type; }
const int getWallTex() { return walls_type; }
const int getDoorTex() { return doors_type; }
const int getWallDoorTex() { return walldoors_type; }
void updateRoomList()
{
for (int room=0; room<64; ++room)
{
char filename[] = "rooms/00.txt";
filename[6] = int(room/10)+48;
filename[7] = (room%10)+48;
room_exists[room] = (file::fileExists(filename));
};
}
const int getExit(const int which) { return exits[which]; }
int getCurrentRoom() { return current_room; }
}
}