- [NEW] Easier room creation
This commit is contained in:
@@ -94,10 +94,39 @@ namespace room
|
||||
actor::reorder();
|
||||
}
|
||||
|
||||
//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)
|
||||
void load(const int room)
|
||||
const int find_next_room()
|
||||
{
|
||||
if (room > 64 || room < 0) { return; }
|
||||
char filename[] = "rooms/00.txt";
|
||||
int room=0;
|
||||
while ( file::fileExists(filename) )
|
||||
{
|
||||
room++;
|
||||
filename[6] = int(room/10)+48;
|
||||
filename[7] = (room%10)+48;
|
||||
}
|
||||
return room;
|
||||
}
|
||||
|
||||
const int inverse_door(const int door)
|
||||
{
|
||||
if (door==XP) return XN;
|
||||
if (door==XN) return XP;
|
||||
if (door==YP) return YN;
|
||||
if (door==YN) return YP;
|
||||
if (door==ZP) return ZN;
|
||||
if (door==ZN) return ZP;
|
||||
return XN;
|
||||
}
|
||||
|
||||
//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)
|
||||
void load(int room, const int door)
|
||||
{
|
||||
if (room > 64 || room < 0) {
|
||||
room = find_next_room();
|
||||
exits[inverse_door(door)] = room;
|
||||
if (door<4 && door_height[door]==-1) door_height[door]=0;
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (modified && ::editor::isEditing()) editor::save();
|
||||
|
||||
@@ -110,7 +139,7 @@ namespace room
|
||||
// Primer carreguem els valors per defecte
|
||||
inner_w = inner_h = 2;
|
||||
for (int i=0;i<4;++i) door_height[i] = -1;
|
||||
color = 9;
|
||||
color = 2;
|
||||
floor_type = walls_type = doors_type = walldoors_type = 0;
|
||||
for (int i=0;i<6;++i) exits[i] = -1;
|
||||
|
||||
@@ -214,7 +243,17 @@ namespace room
|
||||
}
|
||||
}
|
||||
free(original_buffer);
|
||||
} else {
|
||||
if (door != -1)
|
||||
{
|
||||
exits[door] = current_room;
|
||||
if (door < 4) door_height[door] = 0;
|
||||
}
|
||||
current_room = room;
|
||||
editor::save();
|
||||
editor::updateRoomList();
|
||||
}
|
||||
|
||||
current_room = room;
|
||||
refresh();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user