From f60d3b7058e23129411d9a4526a202f3fb8a27f4 Mon Sep 17 00:00:00 2001 From: Martin Read Date: Mon, 30 Sep 2013 21:33:01 +0100 Subject: [PATCH] Updates for how to say the player resists a thing and for colour names --- combat.cc | 10 ++++----- combat.hh | 2 +- display-nc.cc | 66 +++++++++++++++++++++++++++---------------------------- display.hh | 16 -------------- misc.cc | 2 ++ monsters.hh | 3 ++- permons.cc | 54 ++++++++++++++++++++++----------------------- sorcery.cc | 4 ++-- u.cc | 6 ++--- victrix-abyssi.hh | 30 ++++++++++++++++++++----- 10 files changed, 100 insertions(+), 93 deletions(-) diff --git a/combat.cc b/combat.cc index c54ebcf..2269e32 100644 --- a/combat.cc +++ b/combat.cc @@ -197,7 +197,7 @@ int ushootm(int sy, int sx) return 0; } -int mhitu(int mon, enum damtyp dtype) +int mhitu(int mon, Damtyp dtype) { int tohit; int damage; @@ -223,7 +223,7 @@ int mhitu(int mon, enum damtyp dtype) return 0; } damage = one_die(mptr->mdam); - unaffected = player_resists_dtype(dtype); + unaffected = u.resists(dtype); print_mon_name(mon, 3); print_msg(" hits you.\n"); if (u.armourmelt && (!zero_die(3))) @@ -289,7 +289,7 @@ test_unaffected: break; } print_msg("You take %d damage.\n", damage); - if ((mptr->mon_id == PM_VAMPIRE) && !player_resists_dtype(DT_NECRO)) + if ((mptr->mon_id == PM_VAMPIRE) && !u.resists(DT_NECRO)) { heal_mon(mon, damage * 2 / 5, 1); } else if ((tohit - u.defence >= 5) && (mptr->mon_id == PM_SNAKE)) @@ -317,7 +317,7 @@ int mshootu(int mon) int damage; int evasion; int defence; - enum damtyp dtype; + Damtyp dtype; mptr = monsters + mon; y = mptr->y; x = mptr->x; @@ -368,7 +368,7 @@ int mshootu(int mon) { done = 1; print_msg("It hits you!\n"); - unaffected = player_resists_dtype(dtype); + unaffected = u.resists(dtype); if (unaffected) { if (unaffected & RESIST_RING) diff --git a/combat.hh b/combat.hh index c5995ed..55e1668 100644 --- a/combat.hh +++ b/combat.hh @@ -39,7 +39,7 @@ /* XXX combat.c data and funcs */ extern int throw_flask(int obj, int sy, int sx); extern int player_attack(int dy, int dx); -extern int mhitu(int mon, enum damtyp dtyp); +extern int mhitu(int mon, Damtyp dtyp); extern int uhitm(int mon); extern int mshootu(int mon); extern int ushootm(int sy, int sx); diff --git a/display-nc.cc b/display-nc.cc index c70e671..baba660 100644 --- a/display-nc.cc +++ b/display-nc.cc @@ -80,20 +80,20 @@ attr_t colour_attrs[15] = short colour_cpairs[15] = { 0, - DBCLR_D_GREY, - DBCLR_RED, - DBCLR_BLUE, - DBCLR_GREEN, - DBCLR_PURPLE, - DBCLR_BROWN, - DBCLR_CYAN, + Gcol_d_grey, + Gcol_red, + Gcol_blue, + Gcol_green, + Gcol_purple, + Gcol_brown, + Gcol_cyan, 0, - DBCLR_RED, - DBCLR_BLUE, - DBCLR_GREEN, - DBCLR_PURPLE, - DBCLR_BROWN, - DBCLR_CYAN, + Gcol_red, + Gcol_blue, + Gcol_green, + Gcol_purple, + Gcol_brown, + Gcol_cyan, }; wchar_t terrain_wchars[NUM_TERRAINS] = @@ -103,8 +103,8 @@ wchar_t terrain_wchars[NUM_TERRAINS] = short terrain_cpairs[NUM_TERRAINS] = { - DBCLR_BROWN, 0, 0, 0, - 0, 0, DBCLR_RED, DBCLR_BLUE + Gcol_brown, 0, 0, 0, + 0, 0, Gcol_red, Gcol_blue }; attr_t terrain_attrs[NUM_TERRAINS] = @@ -238,7 +238,7 @@ static void draw_world(void) mvwadd_wch(world_window, i, j, back_buffer[y][x]); if (!player_fov.affected[i][j]) { - mvwchgat(world_window, i, j, 1, A_BOLD, DBCLR_D_GREY, NULL); + mvwchgat(world_window, i, j, 1, A_BOLD, Gcol_d_grey, NULL); } front_buffer[i][j] = back_buffer[y][x]; } @@ -303,15 +303,15 @@ int display_init(void) noecho(); cbreak(); start_color(); - init_pair(DBCLR_BROWN, COLOR_YELLOW, COLOR_BLACK); - init_pair(DBCLR_RED, COLOR_RED, COLOR_BLACK); - init_pair(DBCLR_GREEN, COLOR_GREEN, COLOR_BLACK); - init_pair(DBCLR_BLUE, COLOR_BLUE, COLOR_BLACK); - init_pair(DBCLR_D_GREY, COLOR_BLACK, COLOR_BLACK); - init_pair(DBCLR_PURPLE, COLOR_MAGENTA, COLOR_BLACK); - init_pair(DBCLR_CYAN, COLOR_CYAN, COLOR_BLACK); - wall_colour = DBCLR_BROWN; - you_colour = DBCLR_WHITE; + init_pair(Gcol_brown, COLOR_YELLOW, COLOR_BLACK); + init_pair(Gcol_red, COLOR_RED, COLOR_BLACK); + init_pair(Gcol_green, COLOR_GREEN, COLOR_BLACK); + init_pair(Gcol_blue, COLOR_BLUE, COLOR_BLACK); + init_pair(Gcol_d_grey, COLOR_BLACK, COLOR_BLACK); + init_pair(Gcol_purple, COLOR_MAGENTA, COLOR_BLACK); + init_pair(Gcol_cyan, COLOR_CYAN, COLOR_BLACK); + wall_colour = Gcol_brown; + you_colour = Gcol_white; { wchar_t wch[2]; wch[0] = L'@'; @@ -351,7 +351,7 @@ int display_init(void) message_panel = new_panel(message_window); inventory_window = newwin(22, 58, 0, 22); inventory_panel = new_panel(inventory_window); - wattrset(inventory_window, colour_attrs[DBCLR_L_GREY]); + wattrset(inventory_window, colour_attrs[Gcol_l_grey]); hide_panel(inventory_panel); clear(); wclear(status_window); @@ -418,7 +418,7 @@ void set_inventory_message(const char *s, bool allow_nil) void reset_inventory_message(void) { - wattrset(inventory_window, colour_attrs[DBCLR_L_GREY]); + wattrset(inventory_window, colour_attrs[Gcol_l_grey]); mvwprintw(inventory_window, 0, 0, " === INVENTORY ==="); mvwprintw(inventory_window, 20, 0, " "); } @@ -442,12 +442,12 @@ void update_inv(enum poclass_num filter) { int i; char inv_line[60]; - wattr_set(inventory_window, colour_attrs[DBCLR_D_GREY], DBCLR_D_GREY, NULL); + wattr_set(inventory_window, colour_attrs[Gcol_d_grey], Gcol_d_grey, NULL); for (i = 0; i < 19; i++) { if (u.inventory[i] == -1) { - wattr_set(inventory_window, colour_attrs[DBCLR_D_GREY], DBCLR_D_GREY, NULL); + wattr_set(inventory_window, colour_attrs[Gcol_d_grey], Gcol_d_grey, NULL); mvwprintw(inventory_window, i + 1, 0, "%c) -----\n", 'a' + i); } else @@ -455,11 +455,11 @@ void update_inv(enum poclass_num filter) if ((filter == POCLASS_NONE) || (permobjs[objects[u.inventory[i]].obj_id].poclass == filter)) { - wattr_set(inventory_window, colour_attrs[DBCLR_L_GREY], DBCLR_L_GREY, NULL); + wattr_set(inventory_window, colour_attrs[Gcol_l_grey], Gcol_l_grey, NULL); } else { - wattr_set(inventory_window, colour_attrs[DBCLR_D_GREY], DBCLR_D_GREY, NULL); + wattr_set(inventory_window, colour_attrs[Gcol_d_grey], Gcol_d_grey, NULL); } sprintf(inv_line, "%c) ", 'a' + i); sprint_obj_name(inv_line + 3, u.inventory[i], 45); @@ -496,11 +496,11 @@ int inv_select(enum poclass_num filter, const char *action, int accept_blank) print_msg("You have nothing to %s.\n", action); return -1; } - wattrset(inventory_window, colour_attrs[DBCLR_L_GREY]); + wattrset(inventory_window, colour_attrs[Gcol_l_grey]); snprintf(msg, 58, "What do you want to %s?\n", action); set_inventory_message(msg, accept_blank); update_inv(filter); - wattrset(inventory_window, colour_attrs[DBCLR_L_GREY]); + wattrset(inventory_window, colour_attrs[Gcol_l_grey]); mvwprintw(inventory_window, 21, 17, "[ESC or SPACE to cancel]"); show_inv(); tryagain: diff --git a/display.hh b/display.hh index 2af53c1..05262f6 100644 --- a/display.hh +++ b/display.hh @@ -29,22 +29,6 @@ #ifndef DISPLAY_HH #define DISPLAY_HH -#define DBCLR_L_GREY 0 -#define DBCLR_D_GREY 1 -#define DBCLR_RED 2 -#define DBCLR_BLUE 3 -#define DBCLR_GREEN 4 -#define DBCLR_PURPLE 5 -#define DBCLR_BROWN 6 -#define DBCLR_CYAN 7 -#define DBCLR_WHITE 8 -#define DBCLR_L_RED 9 -#define DBCLR_L_BLUE 10 -#define DBCLR_L_GREEN 11 -#define DBCLR_L_PURPLE 12 -#define DBCLR_YELLOW 13 -#define DBCLR_L_CYAN 14 - extern void print_msg(const char *fmt, ...); extern int read_input(char *buffer, int length); extern void print_help(void); diff --git a/misc.cc b/misc.cc index ee6a077..b2289b0 100644 --- a/misc.cc +++ b/misc.cc @@ -35,6 +35,8 @@ const char *damtype_names[DT_COUNT] = { "electricity", "necromantic force", "poison", + "knockback", + "drowning", }; /* main.c */ diff --git a/monsters.hh b/monsters.hh index 6cea8d0..0154c63 100644 --- a/monsters.hh +++ b/monsters.hh @@ -73,7 +73,7 @@ struct permon { int rtohit; /* Improved by OOD rating at 1:3. */ int mdam; /* Improved by OOD rating at 1:5. */ int rdam; /* Improved by OOD rating at 1:5. */ - enum damtyp rdtyp; /* type of damage used by ranged attack. */ + Damtyp rdtyp; /* type of damage used by ranged attack. */ const char shootverb[48]; /* shooting verb e.g. "fires an arrow", "breathes". */ int defence; /* Improved by OOD rating at 1:3. */ int exp; /* Unaffected by OOD rating. */ @@ -100,6 +100,7 @@ struct mon { int rdam; /* Improved by OOD rating at 1:5. */ int awake; int next_summon; + bool resists(Damtyp dt) const; }; extern struct mon monsters[MONSTERS_IN_PLAY]; diff --git a/permons.cc b/permons.cc index 59f33d3..825e758 100644 --- a/permons.cc +++ b/permons.cc @@ -33,101 +33,101 @@ */ struct permon permons[NUM_OF_PERMONS] = { { - "newt", "newts", 'n', DBCLR_RED, 20, 1, 3, 0, -1, 2, -1, DT_PHYS, "", 1, 1, 0, PMF_STUPID + "newt", "newts", 'n', Gcol_red, 20, 1, 3, 0, -1, 2, -1, DT_PHYS, "", 1, 1, 0, PMF_STUPID }, { - "rat", "rats", 'r', DBCLR_BROWN, 15, 1, 4, 0, -1, 2, -1, DT_PHYS, "", 4, 2, 2, PMF_STUPID + "rat", "rats", 'r', Gcol_brown, 15, 1, 4, 0, -1, 2, -1, DT_PHYS, "", 4, 2, 2, PMF_STUPID }, { - "wolf", "wolves", 'c', DBCLR_BROWN, 30, 6, 20, 8, -1, 10, -1, DT_PHYS, "", 6, 15, 2, 0 + "wolf", "wolves", 'c', Gcol_brown, 30, 6, 20, 8, -1, 10, -1, DT_PHYS, "", 6, 15, 2, 0 }, { /* Saps one Body on a really good hit */ - "snake", "snakes", 's', DBCLR_RED, 20, 6, 15, 10, -1, 3, -1, DT_PHYS, "", 9, 40, 2, PMF_STUPID + "snake", "snakes", 's', Gcol_red, 20, 6, 15, 10, -1, 3, -1, DT_PHYS, "", 9, 40, 2, PMF_STUPID }, { /* may drop a mace or leather armour */ - "thug", "thugs", 't', DBCLR_BROWN, 30, 1, 8, 5, -1, 5, -1, DT_PHYS, "", 4, 5, 1, 0 + "thug", "thugs", 't', Gcol_brown, 30, 1, 8, 5, -1, 5, -1, DT_PHYS, "", 4, 5, 1, 0 }, { - "goon", "goons", 't', DBCLR_YELLOW, 20, 3, 15, 6, -1, 7, -1, DT_PHYS, "", 8, 10, 1, 0 + "goon", "goons", 't', Gcol_yellow, 20, 3, 15, 6, -1, 7, -1, DT_PHYS, "", 8, 10, 1, 0 }, { /* Has a ranged attack - arrows */ - "hunter", "hunters", 'h', DBCLR_GREEN, 30, 9, 40, 6, 20, 6, 10, DT_PHYS, "shoots an arrow", 10, 50, 1, PMF_ARCHER + "hunter", "hunters", 'h', Gcol_green, 30, 9, 40, 6, 20, 6, 10, DT_PHYS, "shoots an arrow", 10, 50, 1, PMF_ARCHER }, { - "duellist", "duellists", 'f', DBCLR_RED, 40, 12, 60, 30, -1, 15, -1, DT_PHYS, "", 15, 130, 1, PMF_SMART + "duellist", "duellists", 'f', Gcol_red, 40, 12, 60, 30, -1, 15, -1, DT_PHYS, "", 15, 130, 1, PMF_SMART }, { - "warlord", "warlords", 'f', DBCLR_L_RED, 30, 15, 80, 25, -1, 20, -1, DT_PHYS, "", 20, 400, 2, PMF_SMART + "warlord", "warlords", 'f', Gcol_l_red, 30, 15, 80, 25, -1, 20, -1, DT_PHYS, "", 20, 400, 2, PMF_SMART }, { /* may drop a dagger */ - "goblin", "goblins", 'g', DBCLR_BROWN, 20, 1, 6, 1, -1, 3, -1, DT_PHYS, "", 3, 3, 1, 0 + "goblin", "goblins", 'g', Gcol_brown, 20, 1, 6, 1, -1, 3, -1, DT_PHYS, "", 3, 3, 1, 0 }, { - "bad elf", "bad elves", 'e', DBCLR_L_GREY, 40, 3, 15, 10, -1, 6, -1, DT_PHYS, "", 8, 15, 2, PMF_SMART + "bad elf", "bad elves", 'e', Gcol_l_grey, 40, 3, 15, 10, -1, 6, -1, DT_PHYS, "", 8, 15, 2, PMF_SMART }, { - "troll", "trolls", 'T', DBCLR_GREEN, 20, 12, 80, 15, -1, 15, -1, DT_PHYS, "", 13, 150, 1, PMF_STUPID + "troll", "trolls", 'T', Gcol_green, 20, 12, 80, 15, -1, 15, -1, DT_PHYS, "", 13, 150, 1, PMF_STUPID }, { - "giant", "giants", 'H', DBCLR_BROWN, 20, 21, 80, 15, -1, 25, -1, DT_PHYS, "", 20, 500, 1, PMF_STUPID + "giant", "giants", 'H', Gcol_brown, 20, 21, 80, 15, -1, 25, -1, DT_PHYS, "", 20, 500, 1, PMF_STUPID }, { - "giant jarl", "giant jarls", 'H', DBCLR_L_GREY, 80, 25, 160, 20, -1, 30, -1, DT_PHYS, "", 22, 1000, 1, 0 + "giant jarl", "giant jarls", 'H', Gcol_l_grey, 80, 25, 160, 20, -1, 30, -1, DT_PHYS, "", 22, 1000, 1, 0 }, { /* Uses sorcery against you; see sorcery.c for details. */ - "wizard", "wizards", 'w', DBCLR_BLUE, 80, 12, 40, 10, 20, 10, 10, DT_ELEC, "casts", 15, 200, 1, PMF_SMART | PMF_MAGICIAN + "wizard", "wizards", 'w', Gcol_blue, 80, 12, 40, 10, 20, 10, 10, DT_ELEC, "casts", 15, 200, 1, PMF_SMART | PMF_MAGICIAN }, { /* Uses sorcery against you; see sorcery.c for details. */ - "archmage", "archmagi", 'w', DBCLR_L_BLUE, 80, 24, 80, 15, 30, 15, 15, DT_ELEC, "casts", 15, 1500, 1, PMF_SMART | PMF_MAGICIAN | PMF_RESIST_ELEC + "archmage", "archmagi", 'w', Gcol_l_blue, 80, 24, 80, 15, 30, 15, 15, DT_ELEC, "casts", 15, 1500, 1, PMF_SMART | PMF_MAGICIAN | PMF_RESIST_ELEC }, { - "zombie", "zombies", 'z', DBCLR_L_GREY, 25, 3, 30, 2, -1, 20, -1, DT_PHYS, "", 1, 7, 0, PMF_STUPID | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR + "zombie", "zombies", 'z', Gcol_l_grey, 25, 3, 30, 2, -1, 20, -1, DT_PHYS, "", 1, 7, 0, PMF_STUPID | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR }, { - "wraith", "wraiths", 'W', DBCLR_WHITE, 25, 12, 40, 25, -1, 5, -1, DT_PHYS, "", 5, 100, 0, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR + "wraith", "wraiths", 'W', Gcol_white, 25, 12, 40, 25, -1, 5, -1, DT_PHYS, "", 5, 100, 0, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR }, { /* Uses sorcery against you; see sorcery.c for details. */ - "lich", "liches", 'L', DBCLR_L_GREY, 70, 15, 70, 15, 25, 15, 15, DT_NECRO, "casts", 15, 250, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_MAGICIAN | PMF_RESIST_POIS | PMF_RESIST_NECR + "lich", "liches", 'L', Gcol_l_grey, 70, 15, 70, 15, 25, 15, 15, DT_NECRO, "casts", 15, 250, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_MAGICIAN | PMF_RESIST_POIS | PMF_RESIST_NECR }, { /* Master liches use sorcery against you, more powerfully * than lesser practitioners. */ - "master lich", "master liches", 'L', DBCLR_PURPLE, 60, 30, 150, 30, 30, 20, 30, DT_NECRO, "", 30, 3000, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_MAGICIAN | PMF_RESIST_POIS | PMF_RESIST_NECR + "master lich", "master liches", 'L', Gcol_purple, 60, 30, 150, 30, 30, 20, 30, DT_NECRO, "", 30, 3000, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_MAGICIAN | PMF_RESIST_POIS | PMF_RESIST_NECR }, { /* Vampires heal by hitting you. */ - "vampire", "vampires", 'V', DBCLR_RED, 55, 18, 70, 25, -1, 15, -1, DT_PHYS, "", 22, 750, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR + "vampire", "vampires", 'V', Gcol_red, 55, 18, 70, 25, -1, 15, -1, DT_PHYS, "", 22, 750, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR }, { /* Demons summon more demons if you don't kill them * quickly. */ - "demon", "demons", '&', DBCLR_RED, 60, 18, 40, 25, -1, 20, -1, DT_PHYS, "", 15, 500, 1, PMF_SMART | PMF_DEMONIC | PMF_RESIST_FIRE + "demon", "demons", '&', Gcol_red, 60, 18, 40, 25, -1, 20, -1, DT_PHYS, "", 15, 500, 1, PMF_SMART | PMF_DEMONIC | PMF_RESIST_FIRE }, { /* Defilers use sorcery (mostly curses) against you. */ - "defiler", "defilers", '&', DBCLR_L_GREEN, 65, 27, 120, 30, 30, 20, 30, DT_FIRE, "", 25, 2000, 1, PMF_SMART | PMF_DEMONIC | PMF_RESIST_FIRE | PMF_MAGICIAN | PMF_RESIST_POIS + "defiler", "defilers", '&', Gcol_l_green, 65, 27, 120, 30, 30, 20, 30, DT_FIRE, "", 25, 2000, 1, PMF_SMART | PMF_DEMONIC | PMF_RESIST_FIRE | PMF_MAGICIAN | PMF_RESIST_POIS }, { - "centaur", "centaurs", 'C', DBCLR_BROWN, 30, 9, 40, 15, -1, 10, -1, DT_PHYS, "", 10, 50, 2, 0 + "centaur", "centaurs", 'C', Gcol_brown, 30, 9, 40, 15, -1, 10, -1, DT_PHYS, "", 10, 50, 2, 0 }, { /* Fires ice blasts. */ - "ice monster", "ice monsters", 'I', DBCLR_WHITE, 50, 6, 40, 10, 20, 15, 15, DT_COLD, "launches a blast of", 10, 35, 0, PMF_RESIST_COLD | PMF_ARCHER + "ice monster", "ice monsters", 'I', Gcol_white, 50, 6, 40, 10, 20, 15, 15, DT_COLD, "launches a blast of", 10, 35, 0, PMF_RESIST_COLD | PMF_ARCHER }, { /* Breathes fire. */ - "dragon", "dragons", 'D', DBCLR_RED, 50, 15, 80, 20, 20, 20, 20, DT_FIRE, "breathes", 18, 300, 1, PMF_RESIST_FIRE | PMF_ARCHER + "dragon", "dragons", 'D', Gcol_red, 50, 15, 80, 20, 20, 20, 20, DT_FIRE, "breathes", 18, 300, 1, PMF_RESIST_FIRE | PMF_ARCHER }, { /* Breathes eldritchness represented as cold. I should work on that. */ - "moondrake", "moondrakes", 'D', DBCLR_L_CYAN, 50, 15, 80, 20, 20, 20, 20, DT_COLD, "breathes", 24, 500, 1, PMF_RESIST_FIRE | PMF_RESIST_COLD | PMF_RESIST_NECR | PMF_ARCHER + "moondrake", "moondrakes", 'D', Gcol_l_cyan, 50, 15, 80, 20, 20, 20, 20, DT_COLD, "breathes", 24, 500, 1, PMF_RESIST_FIRE | PMF_RESIST_COLD | PMF_RESIST_NECR | PMF_ARCHER }, }; diff --git a/sorcery.cc b/sorcery.cc index 80ad9fa..a2dc180 100644 --- a/sorcery.cc +++ b/sorcery.cc @@ -443,7 +443,7 @@ int mon_use_sorcery(int mon) case MS_NECRO_SMITE: mon_curses(mon); - if (player_resists_dtype(DT_NECRO)) + if (u.resists(DT_NECRO)) { print_msg("Darkness reaches towards you, but dissolves.\n"); } @@ -457,7 +457,7 @@ int mon_use_sorcery(int mon) case MS_FIRE_COLUMN: mon_curses(mon); print_msg("The fires of hell "); - if (player_resists_dtype(DT_FIRE)) + if (u.resists(DT_FIRE)) { print_msg("lightly singe you.\n"); damage_u(dice(1, 5), DEATH_KILLED_MON, permons[monsters[mon].mon_id].name); diff --git a/u.cc b/u.cc index 9374013..67ea6c1 100644 --- a/u.cc +++ b/u.cc @@ -32,7 +32,7 @@ #include #include -struct player u; +struct Player u; void recalc_defence(void) { @@ -674,9 +674,9 @@ void update_player(void) display_update(); } -int player_resists_dtype(enum damtyp dtype) +bool Player::resists(Damtyp dtype) const { - return u.resistances[dtype]; + return resistances[dtype]; } // vim:cindent diff --git a/victrix-abyssi.hh b/victrix-abyssi.hh index 4575293..93504a7 100644 --- a/victrix-abyssi.hh +++ b/victrix-abyssi.hh @@ -38,6 +38,10 @@ #include #include +#ifndef COORD_HH +#include "coord.hh" +#endif + /* change WIZARD_MODE to 1 if you want the wizard mode commands. */ #define WIZARD_MODE 0 @@ -45,10 +49,26 @@ /* XXX ENUMERATED TYPES XXX */ +/*! \brief Defines the displayable colour of things in the game. + * + * Game colours after Gcol_l_cyan may alias to a colour in the range l_grey + * through l_cyan depending on your display. + */ +enum Gamecolour +{ + /* l_cyan is the last "core" colour. Colours after it may alias to one + * of the core colours depending on the nature of your display. */ + Gcol_l_grey, Gcol_d_grey, Gcol_red, Gcol_blue, + Gcol_green, Gcol_purple, Gcol_brown, Gcol_cyan, + Gcol_white, Gcol_l_red, Gcol_l_blue, Gcol_l_green, + Gcol_l_purple, Gcol_yellow, Gcol_l_cyan +}; /* XXX enum damtyp - types of damage. */ -enum damtyp { - DT_PHYS = 0, DT_COLD, DT_FIRE, DT_NECRO, DT_ELEC, DT_POISON, DT_COUNT +enum Damtyp { + DT_PHYS = 0, DT_COLD, DT_FIRE, DT_NECRO, + DT_ELEC, DT_POISON, DT_KNOCKBACK, DT_DROWNING }; +#define DT_COUNT (1 + DT_DROWNING) /* XXX enum game_cmd - player actions. */ enum game_cmd { @@ -77,7 +97,7 @@ enum death { /* XXX STRUCTURES XXX */ /* XXX struct player */ -struct player { +struct Player { char name[17]; /* including '\0' the fencepost. */ int y; /* y-coord */ int x; /* x-coord */ @@ -102,6 +122,7 @@ struct player { int weapon; /* For now, you can only wield one weapon. */ int armour; /* For now, you can only wear one item of armour. */ int ring; /* For now, you can only wear one magic ring. */ + bool resists(Damtyp dtype) const; }; #ifndef MONSTERS_HH @@ -176,9 +197,8 @@ extern int reloc_player(int y, int x); extern void recalc_defence(void); extern int teleport_u(void); extern void update_player(void); -extern int player_resists_dtype(enum damtyp dtype); -extern struct player u; +extern struct Player u; #endif /* victrix-abyssi.hh */ -- 2.11.0