Skip to content

Commit

Permalink
add more flags
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed May 12, 2024
1 parent 754eadc commit 8e89920
Show file tree
Hide file tree
Showing 10 changed files with 453 additions and 1,233 deletions.
86 changes: 50 additions & 36 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,37 @@ using Config = class Config_
bool mouse_wheel_lr_negated = {};
bool mouse_wheel_ud_negated = {};

int16_t config_pix_height = {};
int16_t config_pix_width = {};
uint32_t config_pix_height = {};
uint32_t config_pix_width = {};
//
// The pixel perfect screen
//
int16_t game_pix_height = {};
int16_t game_pix_width = {};
uint32_t game_pix_height = {};
uint32_t game_pix_width = {};
//
// This is the size of the game map within the game FBO
//
int16_t map_pix_height = {};
int16_t map_pix_width = {};
uint32_t map_pix_height = {};
uint32_t map_pix_width = {};
//
// The user interface that can be higher res than the game
//
int16_t ui_pix_height = {};
int16_t ui_pix_width = {};
uint32_t ui_pix_height = {};
uint32_t ui_pix_width = {};
//
// The actual display res
//
int16_t window_pix_height = {};
int16_t window_pix_width = {};
uint32_t window_pix_height = {};
uint32_t window_pix_width = {};

uint16_t ascii_gl_height = {};
uint16_t ascii_gl_width = {};
//
// The number of tiles on screen.
//
uint32_t tiles_visible_across;
uint32_t tiles_visible_down;

uint32_t ascii_gl_height = {};
uint32_t ascii_gl_width = {};
uint32_t music_volume = {};
uint32_t sdl_delay = {};
uint32_t sound_volume = {};
Expand Down Expand Up @@ -255,6 +261,8 @@ void Config::reset(void)
aspect_ratio = {};
window_pix_height = {};
window_pix_width = {};
tiles_visible_across = {};
tiles_visible_down = {};

key_attack.sym = SDLK_SPACE;
key_help.sym = SDLK_h;
Expand Down Expand Up @@ -483,6 +491,12 @@ void game_visible_map_mouse_set(class Game *game, int visible_map_mouse_x, int v
game->visible_map_mouse_y = visible_map_mouse_y;
}

uint32_t game_tiles_visible_across_get(class Game *) { return game->config.tiles_visible_across; }
void game_tiles_visible_across_set(class Game *, uint32_t val) { game->config.tiles_visible_across = val; }

uint32_t game_tiles_visible_down_get(class Game *) { return game->config.tiles_visible_down; }
void game_tiles_visible_down_set(class Game *, uint32_t val) { game->config.tiles_visible_down = val; }

uint32_t game_last_mouse_down_get(class Game *game) { return game->last_mouse_down; }
void game_last_mouse_down_set(class Game *game, uint32_t val) { game->last_mouse_down = val; }

Expand Down Expand Up @@ -531,41 +545,41 @@ void game_mouse_wheel_lr_negated_set(class Game *, bool val) { game->config.mous
bool game_mouse_wheel_ud_negated_get(class Game *) { return game->config.mouse_wheel_ud_negated; }
void game_mouse_wheel_ud_negated_set(class Game *, bool val) { game->config.mouse_wheel_ud_negated = val; }

int16_t game_config_pix_height_get(class Game *) { return game->config.config_pix_height; }
void game_config_pix_height_set(class Game *, int16_t val) { game->config.config_pix_height = val; }
uint32_t game_config_pix_height_get(class Game *) { return game->config.config_pix_height; }
void game_config_pix_height_set(class Game *, uint32_t val) { game->config.config_pix_height = val; }

int16_t game_config_pix_width_get(class Game *) { return game->config.config_pix_width; }
void game_config_pix_width_set(class Game *, int16_t val) { game->config.config_pix_width = val; }
uint32_t game_config_pix_width_get(class Game *) { return game->config.config_pix_width; }
void game_config_pix_width_set(class Game *, uint32_t val) { game->config.config_pix_width = val; }

int16_t game_pix_height_get(class Game *) { return game->config.game_pix_height; }
void game_pix_height_set(class Game *, int16_t val) { game->config.game_pix_height = val; }
uint32_t game_pix_height_get(class Game *) { return game->config.game_pix_height; }
void game_pix_height_set(class Game *, uint32_t val) { game->config.game_pix_height = val; }

int16_t game_pix_width_get(class Game *) { return game->config.game_pix_width; }
void game_pix_width_set(class Game *, int16_t val) { game->config.game_pix_width = val; }
uint32_t game_pix_width_get(class Game *) { return game->config.game_pix_width; }
void game_pix_width_set(class Game *, uint32_t val) { game->config.game_pix_width = val; }

int16_t game_map_pix_height_get(class Game *) { return game->config.map_pix_height; }
void game_map_pix_height_set(class Game *, int16_t val) { game->config.map_pix_height = val; }
uint32_t game_map_pix_height_get(class Game *) { return game->config.map_pix_height; }
void game_map_pix_height_set(class Game *, uint32_t val) { game->config.map_pix_height = val; }

int16_t game_map_pix_width_get(class Game *) { return game->config.map_pix_width; }
void game_map_pix_width_set(class Game *, int16_t val) { game->config.map_pix_width = val; }
uint32_t game_map_pix_width_get(class Game *) { return game->config.map_pix_width; }
void game_map_pix_width_set(class Game *, uint32_t val) { game->config.map_pix_width = val; }

int16_t game_ui_pix_height_get(class Game *) { return game->config.ui_pix_height; }
void game_ui_pix_height_set(class Game *, int16_t val) { game->config.ui_pix_height = val; }
uint32_t game_ui_pix_height_get(class Game *) { return game->config.ui_pix_height; }
void game_ui_pix_height_set(class Game *, uint32_t val) { game->config.ui_pix_height = val; }

int16_t game_ui_pix_width_get(class Game *) { return game->config.ui_pix_width; }
void game_ui_pix_width_set(class Game *, int16_t val) { game->config.ui_pix_width = val; }
uint32_t game_ui_pix_width_get(class Game *) { return game->config.ui_pix_width; }
void game_ui_pix_width_set(class Game *, uint32_t val) { game->config.ui_pix_width = val; }

int16_t game_window_pix_height_get(class Game *) { return game->config.window_pix_height; }
void game_window_pix_height_set(class Game *, int16_t val) { game->config.window_pix_height = val; }
uint32_t game_window_pix_height_get(class Game *) { return game->config.window_pix_height; }
void game_window_pix_height_set(class Game *, uint32_t val) { game->config.window_pix_height = val; }

int16_t game_window_pix_width_get(class Game *) { return game->config.window_pix_width; }
void game_window_pix_width_set(class Game *, int16_t val) { game->config.window_pix_width = val; }
uint32_t game_window_pix_width_get(class Game *) { return game->config.window_pix_width; }
void game_window_pix_width_set(class Game *, uint32_t val) { game->config.window_pix_width = val; }

uint16_t game_ascii_gl_height_get(class Game *) { return game->config.ascii_gl_height; }
void game_ascii_gl_height_set(class Game *, uint16_t val) { game->config.ascii_gl_height = val; }
uint32_t game_ascii_gl_height_get(class Game *) { return game->config.ascii_gl_height; }
void game_ascii_gl_height_set(class Game *, uint32_t val) { game->config.ascii_gl_height = val; }

uint16_t game_ascii_gl_width_get(class Game *) { return game->config.ascii_gl_width; }
void game_ascii_gl_width_set(class Game *, uint16_t val) { game->config.ascii_gl_width = val; }
uint32_t game_ascii_gl_width_get(class Game *) { return game->config.ascii_gl_width; }
void game_ascii_gl_width_set(class Game *, uint32_t val) { game->config.ascii_gl_width = val; }

uint32_t game_music_volume_get(class Game *) { return game->config.music_volume; }
void game_music_volume_set(class Game *, uint32_t val) { game->config.music_volume = val; }
Expand Down
20 changes: 12 additions & 8 deletions src/game_load.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,20 @@ std::istream &operator>>(std::istream &in, Bits< Config & > my)

in >> bits(my.t.ascii_gl_height);
in >> bits(my.t.ascii_gl_width);
in >> bits(my.t.aspect_ratio);
in >> bits(my.t.config_pix_height);
in >> bits(my.t.config_pix_width);
in >> bits(my.t.debug_mode);
in >> bits(my.t.fps_counter);
in >> bits(my.t.game_pix_height);
in >> bits(my.t.game_pix_width);
in >> bits(my.t.map_pix_height);
in >> bits(my.t.map_pix_width);
in >> bits(my.t.gfx_allow_highdpi);
in >> bits(my.t.gfx_borderless);
in >> bits(my.t.gfx_fullscreen);
in >> bits(my.t.gfx_fullscreen_desktop);
in >> bits(my.t.gfx_vsync_enable);
in >> bits(my.t.mouse_wheel_lr_negated);
in >> bits(my.t.mouse_wheel_ud_negated);
in >> bits(my.t.key_attack);
in >> bits(my.t.key_console);
in >> bits(my.t.key_unused1);
in >> bits(my.t.key_help);
in >> bits(my.t.key_load);
in >> bits(my.t.key_move_down);
Expand All @@ -83,14 +79,20 @@ std::istream &operator>>(std::istream &in, Bits< Config & > my)
in >> bits(my.t.key_quit);
in >> bits(my.t.key_save);
in >> bits(my.t.key_screenshot);
in >> bits(my.t.key_unused1);
in >> bits(my.t.map_pix_height);
in >> bits(my.t.map_pix_width);
in >> bits(my.t.mouse_wheel_lr_negated);
in >> bits(my.t.mouse_wheel_ud_negated);
in >> bits(my.t.music_volume);
in >> bits(my.t.sdl_delay);
in >> bits(my.t.sound_volume);
in >> bits(my.t.ui_pix_height);
in >> bits(my.t.ui_pix_width);
in >> bits(my.t.tiles_visible_across);
in >> bits(my.t.tiles_visible_down);
in >> bits(my.t.ui_gfx_term_height);
in >> bits(my.t.ui_gfx_term_width);
in >> bits(my.t.aspect_ratio);
in >> bits(my.t.ui_pix_height);
in >> bits(my.t.ui_pix_width);
in >> bits(my.t.window_pix_height);
in >> bits(my.t.window_pix_width);

Expand All @@ -115,6 +117,8 @@ std::istream &operator>>(std::istream &in, Bits< Config & > my)
LOG("Read config: music_volume = %d", my.t.music_volume);
LOG("Read config: sdl_delay = %d", my.t.sdl_delay);
LOG("Read config: sound_volume = %d", my.t.sound_volume);
LOG("Read config: tiles_visible_across = %d", my.t.tiles_visible_across);
LOG("Read config: tiles_visible_down = %d", my.t.tiles_visible_down);
LOG("Read config: ui_pix_height = %d", my.t.ui_pix_height);
LOG("Read config: ui_pix_width = %d", my.t.ui_pix_width);
LOG("Read config: window_pix_height = %d", my.t.window_pix_height);
Expand Down
18 changes: 10 additions & 8 deletions src/game_save.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,20 @@ std::ostream &operator<<(std::ostream &out, Bits< const Config & > const my)

out << bits(my.t.ascii_gl_height);
out << bits(my.t.ascii_gl_width);
out << bits(my.t.aspect_ratio);
out << bits(my.t.config_pix_height);
out << bits(my.t.config_pix_width);
out << bits(my.t.debug_mode);
out << bits(my.t.fps_counter);
out << bits(my.t.game_pix_height);
out << bits(my.t.game_pix_width);
out << bits(my.t.map_pix_height);
out << bits(my.t.map_pix_width);
out << bits(my.t.gfx_allow_highdpi);
out << bits(my.t.gfx_borderless);
out << bits(my.t.gfx_fullscreen);
out << bits(my.t.gfx_fullscreen_desktop);
out << bits(my.t.gfx_vsync_enable);
out << bits(my.t.mouse_wheel_lr_negated);
out << bits(my.t.mouse_wheel_ud_negated);
out << bits(my.t.key_attack);
out << bits(my.t.key_console);
out << bits(my.t.key_unused1);
out << bits(my.t.key_help);
out << bits(my.t.key_load);
out << bits(my.t.key_move_down);
Expand All @@ -69,14 +65,20 @@ std::ostream &operator<<(std::ostream &out, Bits< const Config & > const my)
out << bits(my.t.key_quit);
out << bits(my.t.key_save);
out << bits(my.t.key_screenshot);
out << bits(my.t.key_unused1);
out << bits(my.t.map_pix_height);
out << bits(my.t.map_pix_width);
out << bits(my.t.mouse_wheel_lr_negated);
out << bits(my.t.mouse_wheel_ud_negated);
out << bits(my.t.music_volume);
out << bits(my.t.sdl_delay);
out << bits(my.t.sound_volume);
out << bits(my.t.ui_pix_height);
out << bits(my.t.ui_pix_width);
out << bits(my.t.tiles_visible_across);
out << bits(my.t.tiles_visible_down);
out << bits(my.t.ui_gfx_term_height);
out << bits(my.t.ui_gfx_term_width);
out << bits(my.t.aspect_ratio);
out << bits(my.t.ui_pix_height);
out << bits(my.t.ui_pix_width);
out << bits(my.t.window_pix_height);
out << bits(my.t.window_pix_width);

Expand Down
8 changes: 0 additions & 8 deletions src/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ bool g_opt_debug3; // As above but show the entire level

std::string g_opt_seed_name;

//
// The number of tiles on screen.
//
int TILES_VISIBLE_ACROSS;
int TILES_VISIBLE_DOWN;

int g_last_logged_callframes_depth;

void reset_globals(void)
{
g_opt_debug1 = false;
Expand Down
Loading

0 comments on commit 8e89920

Please sign in to comment.