finished the bulk of game

This commit is contained in:
2024-07-14 21:32:41 -04:00
parent b3475b7530
commit af8bc4112c
110 changed files with 1876 additions and 1481 deletions

View File

@ -3,11 +3,12 @@
#include <vector>
#include <string>
#include <utility>
#include "constants.h"
#include "display.h"
#include "position.h"
#include "rng.h"
#include "fraction.h"
#include "player.h"
#include "characters.h"
class game_map final {
@ -18,8 +19,8 @@ private:
static const int MAX_ROOM_WIDTH = 20;
static const int MAX_ROOM_HEIGHT = 5;
// setup safezones
static const int ACTUAL_MAP_WIDTH = MAP_WIDTH - 6;
static const int ACTUAL_MAP_HEIGHT = MAP_HEIGHT - 5;
static const int ACTUAL_MAP_WIDTH = 73;
static const int ACTUAL_MAP_HEIGHT = 20;
static const int MAP_PADDING = 3;
static const int MIN_ROOM_SPACING = 3;
static const int WIDTH_RESERVED = 6;
@ -72,16 +73,10 @@ public:
int get_down_stairs_room() const;
int get_room_cnt() const;
room get_room(std::size_t idx) const;
private:
std::vector<room> room_data;
position remap_index(const int idx) const {
return {idx % MAP_WIDTH, idx / MAP_WIDTH};
}
int remap_position(const position &pos) const {
return pos.y * MAP_WIDTH + pos.x;
}
position remap_index(const int idx) const;
int remap_position(const position &pos) const;
position random_size(int min_width, int min_height,
int max_width, int max_height,
@ -113,6 +108,7 @@ private:
bool hit_room(const position &a, const room &r);
void gen_stairs(int player_room, RNG *rng);
room get_room(std::size_t idx) const;
};
const std::string default_map =