2 Commits

Author SHA1 Message Date
434014d708 - Treballant en les vides... 2024-07-03 13:58:26 +02:00
8be12f5ec0 - [NEW] Easier room creation 2024-07-03 13:58:03 +02:00
5 changed files with 65 additions and 11 deletions

View File

@@ -1245,6 +1245,7 @@ namespace actor
namespace hero
{
int lives = 8;
int boost_jumps = 0;
int boost_steps = 0;
int boost_god = 0;
@@ -1255,11 +1256,22 @@ namespace actor
void init()
{
boost_jumps = boost_steps = boost_god = 0;
lives = 8;
skills = SKILL_NONE;
parts = PART_NONE;
for (int i=0; i<100; ++i) boosters_collected[i] = false;
}
int getLives()
{
return lives;
}
void setLives(int value)
{
lives = value;
}
const int getBoosterFromString(char *booster)
{
static const char *boostset_name[3] = {"RUN", "GOD", "JUMP"};

View File

@@ -167,6 +167,9 @@ namespace actor
namespace hero
{
void init();
int getLives();
void setLives(int value);
bool giveBooster(char *booster);
void collectBooster(int booster, int id);
bool wasBoosterCollected(int id);

View File

@@ -553,27 +553,27 @@ bool game::loop()
ui::label("XN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(XN), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(XN));
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(XN), XP);
line += 10;
ui::label("YP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(YP), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(YP));
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(YP), YN);
line += 10;
ui::label("XP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(XP), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(XP));
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(XP), XN);
line += 10;
ui::label("YN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(YN), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(YN));
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(YN), YP);
line += 10;
ui::label("ZP", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(ZP), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(ZP));
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(ZP), ZN);
line += 10;
ui::label("ZN", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refExit(ZN), -1, 64, 36);
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(ZN));
if (ui::button("GO", 84, line, 13, 11)) room::load(room::editor::refExit(ZN), ZP);
line += 10;
/*changed |= btn("COLOR:", 10, 140, room::editor::refColor(), 5, 11);

View File

@@ -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();

View File

@@ -18,7 +18,7 @@
namespace room
{
void init();
void load(const int room);
void load(int room, const int door=-1);
//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 doorwall);
void update();
void draw();