147 lines
5.2 KiB
C++
147 lines
5.2 KiB
C++
#ifndef __CONSTANTS_H__
|
|
#define __CONSTANTS_H__
|
|
#include <vector>
|
|
#include <ncurses.h>
|
|
#include <string>
|
|
#include "position.h"
|
|
#include "fraction.h"
|
|
|
|
static const int INF = 0x3F3F3F3F;
|
|
|
|
// TODO: update result to include subject
|
|
// fine will waste a turn
|
|
enum result : int {fine, died, go_down, go_up, hit, moved,
|
|
miss, terminate, applied, applied_nothing,
|
|
toggle_the_world, restart_game, unknown
|
|
};
|
|
|
|
struct long_result {
|
|
result res;
|
|
std::string msg;
|
|
};
|
|
|
|
enum game_status : int {terminated, main_menu, in_game, options,
|
|
dead, won, escaped, restart
|
|
};
|
|
|
|
enum game_command : int {game_command_terminate = 0,
|
|
move_north, move_south, move_east, move_west,
|
|
move_northeast, move_northwest,
|
|
move_southeast, move_southwest,
|
|
apply_north, apply_south, apply_east, apply_west,
|
|
apply_northeast, apply_northwest,
|
|
apply_southeast, apply_southwest,
|
|
apply_panic, // for curses_input specifically
|
|
attack_north, attack_south, attack_east, attack_west,
|
|
attack_northeast, attack_northwest,
|
|
attack_southeast, attack_southwest,
|
|
up_stairs, down_stairs,
|
|
the_world, game_restart,
|
|
game_command_pass, game_command_panic,
|
|
enter
|
|
};
|
|
|
|
// Character generation related
|
|
static const int RACE_CNT = 13;
|
|
enum race : int {rshade = 0, rdrow, rvampire, rtroll,
|
|
rgoblin, rhuman, rdwarf, relf,
|
|
rorc, rmerchant, rdragon, rhalfling,
|
|
rt_800
|
|
};
|
|
|
|
static const char CHAR_REP[RACE_CNT] = {
|
|
's', 'd', 'v', 't', 'g', 'H', 'W', 'E', 'O', 'M', 'D', 'L', 't'
|
|
};
|
|
|
|
static const int MAX_HP[RACE_CNT] = {
|
|
125, 150, INF, 120, 110, 140, 100, 140, 180, 30, 150, 100, 500
|
|
};
|
|
static const int STARTING_HP[RACE_CNT] = {
|
|
125, 150, 50, 120, 110, 140, 100, 140, 180, 30, 150, 100, 500
|
|
};
|
|
static const int STARTING_ATK[RACE_CNT] = {
|
|
25, 25, 25, 25, 15, 20, 20, 30, 30, 70, 20, 15, 40
|
|
};
|
|
static const int STARTING_DEF[RACE_CNT] = {
|
|
25, 15, 25, 15, 20, 20, 30, 10, 25, 5, 20, 20, 50
|
|
};
|
|
static const fraction STARTING_HR[RACE_CNT] = {
|
|
{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},
|
|
{1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
|
|
{1, 1}
|
|
};
|
|
|
|
|
|
// Potion-related
|
|
static const int POTION_TYPE_CNT = 6;
|
|
static const int DEFAULT_POTION_TYPE_CNT = 6;
|
|
enum potion_type : int {restore_health = 0, boost_atk, boost_def,
|
|
poison_health, wound_atk, wound_def
|
|
};
|
|
|
|
// Calculation priorities
|
|
static const int CALC_ADD_BASE = 0;
|
|
static const int CALC_MUL_BASE = 1;
|
|
static const int CALC_ADD_LATER = 2;
|
|
static const int CALC_MUL_LATER = 3;
|
|
static const int CALC_ADD_FIXED = 4;
|
|
|
|
|
|
static const int DIRECTION_CNT = 8;
|
|
// IMPORTANT: east is positive for x and SOUTH is positive for y
|
|
// initializes all directions to an int
|
|
enum direction : int { north = 0, south, east, west, northeast,
|
|
northwest, southeast, southwest
|
|
};
|
|
|
|
static const position MOVE[DIRECTION_CNT] = {
|
|
{0, -1}, {0, 1}, {1, 0}, {-1, 0},
|
|
{1, -1}, {-1, -1}, {1, 1}, {-1, 1}
|
|
};
|
|
|
|
static const int MAP_HEIGHT = 25;
|
|
static const int MAP_WIDTH = 79;
|
|
static const int DISPLAY_HEIGHT = 30;
|
|
static const int DISPLAY_WIDTH = 79;
|
|
static const int DISPLAY_BUFFER_SIZE = DISPLAY_HEIGHT * DISPLAY_WIDTH +
|
|
DISPLAY_WIDTH * 3;
|
|
|
|
// TODO: list all extra features
|
|
// using constants to keep track of features
|
|
// method: features: FEATURE_XXX | FEATURE_YYY
|
|
// That is: use bit manipulation
|
|
// check if feature is enabled:
|
|
// features & FEATURE_XXX
|
|
typedef unsigned int feature; // can extend to unsigned long (long) if needed
|
|
static const feature FEATURE_NCURSES = 1 << 0;
|
|
static const feature FEATURE_RAND_MAP = 1 << 1;
|
|
static const feature FEATURE_ENEMIES_CHASE = 1 << 2;
|
|
static const feature FEATURE_INVENTORY = 1 << 3;
|
|
static const feature FEATURE_THROW = 1 << 4;
|
|
static const feature FEATURE_REVISIT = 1 << 5;
|
|
static const feature FEATURE_WALK_OVER = 1 << 6;
|
|
static const feature FEATURE_SEED = 1 << 7;
|
|
static const feature FEATURE_IN_FILE = 1 << 8;
|
|
static const feature FEATURE_OUT_FILE = 1 << 9;
|
|
static const feature FEATURE_EXTRA_STUFF = 1 << 10;
|
|
static const feature FEATURE_EXTRA_LEVELS = 1 << 11;
|
|
static const feature FEATURE_DOORS = 1 << 12;
|
|
|
|
static const feature FEATURE_PANIC_SEED = 1 << 27;
|
|
static const feature FEATURE_PANIC_FILE = 1 << 28;
|
|
static const feature FEATURE_PANIC = 1 << 29;
|
|
static const feature FEATURE_CONFLICT = 1 << 30;
|
|
static const feature FEATURE_LIST_ARGS = 1 << 31;
|
|
|
|
static const int RETURN_FINE = 0;
|
|
static const int RETURN_PANICKED = 1;
|
|
|
|
static const int COLOR_BLACK_ON_WHITE = 8;
|
|
|
|
static const int GOLD_SMALL = 1;
|
|
static const int GOLD_NORMAL = 2;
|
|
static const int GOLD_MERCHANT = 4;
|
|
static const int GOLD_DRAGON = 6;
|
|
|
|
#endif
|