- Treballant en el guardat de mapes (peta, revisar)
This commit is contained in:
@@ -27,6 +27,8 @@ namespace room
|
||||
static int doors_type = 0; // Textura per a les portes
|
||||
static int walldoors_type = 0; // Textura per a baix de les portes
|
||||
|
||||
static bool modified = false;
|
||||
|
||||
// Surface on se guarden els gràfics de cada cosa
|
||||
static draw::surface *floor_surf = nullptr;
|
||||
static draw::surface *walls_surf = nullptr;
|
||||
@@ -93,6 +95,8 @@ namespace room
|
||||
//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)
|
||||
{
|
||||
if (modified) editor::save();
|
||||
|
||||
if (room > 64) { perror("ERROR: Nombre d'habitació massa gran! Eixint..."); exit(1); }
|
||||
init();
|
||||
|
||||
@@ -370,6 +374,52 @@ namespace room
|
||||
}
|
||||
|
||||
int getCurrentRoom() { return current_room; }
|
||||
|
||||
const char *numToColor(uint8_t value)
|
||||
{
|
||||
const char* colors[7] = {"blue", "red", "purple", "green", "cyan", "yellow", "white"};
|
||||
return colors[value-5];
|
||||
}
|
||||
|
||||
void modify() { modified = true; }
|
||||
|
||||
void save()
|
||||
{
|
||||
char filename[] = "data/rooms/00.txt";
|
||||
filename[6] = int(current_room/10)+48;
|
||||
filename[7] = (current_room%10)+48;
|
||||
FILE *f = fopen(filename, "w");
|
||||
|
||||
fprintf(f, "width: %i\n", inner_w);
|
||||
fprintf(f, "height: %i\n", inner_h);
|
||||
fprintf(f, "door-height-xp: %i\n", door_height[XP]);
|
||||
fprintf(f, "door-height-xn: %i\n", door_height[XN]);
|
||||
fprintf(f, "door-height-yp: %i\n", door_height[YP]);
|
||||
fprintf(f, "door-height-yn: %i\n", door_height[YN]);
|
||||
|
||||
fprintf(f, "color: %s\n", numToColor(color));
|
||||
fprintf(f, "floor-texture: %i\n", floor_type);
|
||||
fprintf(f, "wall-texture: %i\n", walls_type);
|
||||
fprintf(f, "door-texture: %i\n", doors_type);
|
||||
fprintf(f, "under-door-texture: %i\n", walldoors_type);
|
||||
|
||||
fprintf(f, "exit-xp: %i\n", exits[XP]);
|
||||
fprintf(f, "exit-xn: %i\n", exits[XN]);
|
||||
fprintf(f, "exit-yp: %i\n", exits[YP]);
|
||||
fprintf(f, "exit-yn: %i\n", exits[YN]);
|
||||
fprintf(f, "exit-zp: %i\n", exits[ZP]);
|
||||
fprintf(f, "exit-zn: %i\n", exits[ZN]);
|
||||
|
||||
actor::actor_t *act = actor::getFirst();
|
||||
while (act)
|
||||
{
|
||||
actor::saveToFile(f, act);
|
||||
act = act->next;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
modified = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user