176 lines
6.5 KiB
C++
176 lines
6.5 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,
|
|
inventory, thrown
|
|
};
|
|
|
|
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, toggle_inventory,
|
|
throw_north, throw_south, throw_east, throw_west,
|
|
throw_northeast, throw_northwest,
|
|
throw_southeast, throw_southwest,
|
|
select_shade, select_drow, select_vampire,
|
|
select_goblin, select_troll
|
|
};
|
|
|
|
// Character generation related
|
|
static const int RACE_CNT = 23;
|
|
enum race : int {rshade = 0, rdrow, rvampire, rtroll,
|
|
rgoblin, rhuman, rdwarf, relf,
|
|
rorc, rmerchant, rdragon, rhalfling,
|
|
rt_800, rmr_goose, rmonk, rbrawler,
|
|
rassassin, rviking, rswordsman,
|
|
rleprechaun, rwitch, rhacker, rbaby_dragon
|
|
};
|
|
|
|
static const char CHAR_REP[RACE_CNT] = {
|
|
's', 'd', 'v', 't', 'g', 'H', 'W', 'E', 'O', 'M', 'D', 'L',
|
|
't', 'g', 'm', 'b', 'a',
|
|
'V', 'S', 'l', 'Z', 'h', 'B'
|
|
};
|
|
|
|
static const int MAX_HP[RACE_CNT] = {
|
|
125, 150, INF, 120, 110, 140, 100, 140, 180, 30, 150, 100,
|
|
600, 130, 125, 120, 100,
|
|
150, 100, 80, 100, 90, 140
|
|
};
|
|
static const int STARTING_HP[RACE_CNT] = {
|
|
125, 150, 50, 120, 110, 140, 100, 140, 180, 30, 150, 100,
|
|
600, 130, 100, 120, 100,
|
|
150, 100, 80, 100, 90, 140
|
|
};
|
|
static const int STARTING_ATK[RACE_CNT] = {
|
|
25, 25, 25, 25, 15, 20, 20, 30, 30, 70, 20, 15,
|
|
40, 25, 70, 20, 30,
|
|
30, 25, 10, 20, 15, 20
|
|
};
|
|
static const int STARTING_DEF[RACE_CNT] = {
|
|
25, 15, 25, 15, 20, 20, 30, 10, 25, 5, 20, 20,
|
|
50, 20, 0, 20, 10,
|
|
25, 15, 15, 15, 30, 40
|
|
};
|
|
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},
|
|
{2, 3}, {INF, 1}, {1, 1}, {3, 4}, {1, 1},
|
|
{1, 3}, {1, 1}, {1, 2}, {1, 2}, {1, 2}, {1, 3}
|
|
};
|
|
|
|
|
|
// Potion-related
|
|
static const int POTION_TYPE_CNT = 14;
|
|
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,
|
|
continuous_restoration, savage_strike,
|
|
echoing_resilience, tempest_tantrum,
|
|
bezerk_brew, borrow_life,
|
|
fine_booze, ironclad_ward
|
|
};
|
|
|
|
// Calculation priorities
|
|
static const int CALC_BASE = 0;
|
|
static const int CALC_MID = 1;
|
|
static const int CALC_LAST = 2;
|
|
|
|
|
|
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_LIST_COMMANDS = 1 << 23;
|
|
static const feature FEATURE_LIST_RACES = 1 << 24;
|
|
static const feature FEATURE_LIST_ENEMIES = 1 << 25;
|
|
static const feature FEATURE_LIST_POTIONS = 1 << 26;
|
|
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;
|
|
|
|
static const size_t WHAT_ENEMY = 1 << 29;
|
|
static const size_t WHAT_WALL = 1 << 30;
|
|
static const size_t WHAT_SPACE = 1 << 31;
|
|
|
|
#endif
|