From: Martin Read Date: Sat, 18 Jan 2014 14:35:44 +0000 (+0000) Subject: Resolving impact of the changes to item database handling X-Git-Tag: printmsg-purged~39 X-Git-Url: http://git.blackswordsonics.com/?a=commitdiff_plain;h=38d0879531bcf7b1024ac5c19430c95d17b21d2c;p=victrix-abyssi Resolving impact of the changes to item database handling --- diff --git a/combat.cc b/combat.cc index 3d4cc58..bd37a43 100644 --- a/combat.cc +++ b/combat.cc @@ -53,7 +53,7 @@ int uhitm(int mon) { Mon *mp; Obj *wep; - struct permobj *pwep; + Permobj *pwep; Obj *ring; int tohit; int damage; @@ -83,7 +83,7 @@ int uhitm(int mon) ring = objects + u.ring; switch (ring->obj_id) { - case PO_RING_FIRE: + case PO_FIRE_RING: if (!pmon_resists_fire(mp->mon_id)) { print_msg("Your ring burns "); @@ -92,7 +92,7 @@ int uhitm(int mon) damage += (damage + 1) / 2 + dice(2, 4); } break; - case PO_RING_VAMPIRE: + case PO_VAMPIRE_RING: if (!pmon_is_undead(mp->mon_id)) { print_msg("Your ring drains "); @@ -103,7 +103,7 @@ int uhitm(int mon) heal_u(healing, 0, 1); } break; - case PO_RING_FROST: + case PO_FROST_RING: if (!pmon_resists_cold(mp->mon_id)) { print_msg("Your ring freezes "); @@ -133,7 +133,7 @@ int ushootm(Offset step) int mon; Mon *mptr; Obj *wep; - struct permobj *pwep; + Permobj *pwep; int damage; wep = objects + u.weapon; pwep = permobjs + wep->obj_id; @@ -261,7 +261,7 @@ test_unaffected: break; case DT_NECRO: print_msg("Its touch makes you feel no deader.\n"); - if (objects[u.ring].obj_id == PO_RING_VAMPIRE) + if (objects[u.ring].obj_id == PO_VAMPIRE_RING) { print_msg("Your ring shrieks.\n"); } @@ -371,19 +371,19 @@ int mshootu(int mon) switch (dtype) { case DT_COLD: - if (objects[u.ring].obj_id == PO_RING_FROST) + if (objects[u.ring].obj_id == PO_FROST_RING) { print_msg("Your ring flashes blue.\n"); } break; case DT_FIRE: - if (objects[u.ring].obj_id == PO_RING_FIRE) + if (objects[u.ring].obj_id == PO_FIRE_RING) { print_msg("Your ring flashes red.\n"); } break; case DT_NECRO: - if (objects[u.ring].obj_id == PO_RING_VAMPIRE) + if (objects[u.ring].obj_id == PO_VAMPIRE_RING) { print_msg("Your ring shrieks.\n"); } @@ -457,6 +457,7 @@ int mshootu(int mon) return 0; } +#if 0 static void flask_effect_weakness(Mon *mptr) { if (!pmon_is_undead(mptr->mon_id)) @@ -495,6 +496,7 @@ static void flask_effect_fire(Mon *mptr) print_msg("... to little effect.\n"); } } +#endif Action_cost throw_flask(int obj, Offset step) { @@ -504,6 +506,7 @@ Action_cost throw_flask(int obj, Offset step) void (*flask_effect)(Mon *); switch (objects[obj].obj_id) { +#if 0 case PO_FLASK_WEAKNESS: flask_effect = flask_effect_weakness; break; @@ -513,6 +516,7 @@ Action_cost throw_flask(int obj, Offset step) case PO_FLASK_FIRE: flask_effect = flask_effect_fire; break; +#endif default: print_msg("internal error: attempt to throw non-flask.\n"); return Cost_none; diff --git a/display-nc.cc b/display-nc.cc index 4403a58..0c4df74 100644 --- a/display-nc.cc +++ b/display-nc.cc @@ -680,7 +680,7 @@ Pass_fail select_dir(Offset *pstep) * * \todo Consider redesigning in a way friendlier to non-terminal platforms */ -enum game_cmd get_command(void) +Game_cmd get_command(void) { int ch; while (1) diff --git a/display.hh b/display.hh index c32fdad..6a185d9 100644 --- a/display.hh +++ b/display.hh @@ -38,7 +38,7 @@ extern int display_shutdown(void); extern void newsym(Coord c); extern void touch_back_buffer(void); extern int inv_select(enum poclass_num filter, char const *action, int accept_blank); -extern enum game_cmd get_command(void); +extern Game_cmd get_command(void); extern Pass_fail select_dir(Offset *pstep); extern int getYN(char const *msg); extern int getyn(char const *msg); diff --git a/main.cc b/main.cc index 7ad1a8b..1ac8e66 100644 --- a/main.cc +++ b/main.cc @@ -94,7 +94,7 @@ void save_game(void) fp = fopen("victrix-abyssi.sav", "wb"); fwrite(lvl.terrain, 1, sizeof lvl.terrain, fp); fwrite(lvl.flags, 1, sizeof lvl.flags, fp); - fwrite(permobjs, NUM_OF_PERMOBJS, sizeof (struct permobj), fp); + fwrite(permobjs, NUM_OF_PERMOBJS, sizeof (Permobj), fp); fwrite(monsters, MONSTERS_IN_PLAY, sizeof (Mon), fp); fwrite(objects, OBJECTS_IN_PLAY, sizeof (Obj), fp); /* Write out the depth */ @@ -119,7 +119,7 @@ void load_game(void) fp = fopen("victrix-abyssi.sav", "rb"); fread(lvl.terrain, 1, sizeof lvl.terrain, fp); fread(lvl.flags, 1, sizeof lvl.flags, fp); - fread(permobjs, NUM_OF_PERMOBJS, sizeof (struct permobj), fp); + fread(permobjs, NUM_OF_PERMOBJS, sizeof (Permobj), fp); fread(monsters, MONSTERS_IN_PLAY, sizeof (Mon), fp); fread(objects, OBJECTS_IN_PLAY, sizeof (Obj), fp); rebuild_mapobjs(); @@ -225,7 +225,7 @@ void new_game(void) print_msg("Initialisation complete.\n"); } -Action_cost do_command(enum game_cmd cmd) +Action_cost do_command(Game_cmd cmd) { int i; int j; @@ -303,7 +303,7 @@ Action_cost do_command(enum game_cmd cmd) { u.armour = u.inventory[slot]; recalc_defence(); - if (objects[u.armour].obj_id == PO_RIBBONS) + if (objects[u.armour].obj_id == PO_SET_OF_RIBBONS) { print_msg("You grit your teeth, trying to get used to the tingle of\nthe ribbons' magic against your skin.\n"); } @@ -427,7 +427,7 @@ Action_cost do_command(enum game_cmd cmd) { print_msg("That ring is your only current source of fire resistance. Removing\nit here would incinerate you.\n"); } - else if ((objects[u.ring].obj_id == PO_RING_FROST) && (lvl.terrain_at(u.pos) == WATER)) + else if ((objects[u.ring].obj_id == PO_FROST_RING) && (lvl.terrain_at(u.pos) == WATER)) { print_msg("Since nobody ever taught you to swim, removing that ring\nhere would result in your death by drowning.\n"); } @@ -572,7 +572,7 @@ Action_cost do_command(enum game_cmd cmd) void main_loop(void) { - enum game_cmd cmd; + Game_cmd cmd; int i; int action_speed; print_msg("Welcome to the Abyss, Princess %s.\n", u.name); diff --git a/objects.cc b/objects.cc index c08278c..9059a47 100644 --- a/objects.cc +++ b/objects.cc @@ -60,14 +60,14 @@ Action_cost read_scroll(int obj) int i; switch (optr->obj_id) { - case PO_SCR_TELEPORT: + case PO_TELEPORT_SCROLL: teleport_u(); break; - case PO_SCR_FIRE: + case PO_FIRE_SCROLL: print_msg("The scroll explodes in flames!\n"); if (u.resistances[DT_FIRE]) { - if (objects[u.ring].obj_id == PO_RING_FIRE) + if (objects[u.ring].obj_id == PO_FIRE_RING) { print_msg("Your ring glows, and the flames seem cool.\n"); break; @@ -94,7 +94,7 @@ Action_cost read_scroll(int obj) } } break; - case PO_SCR_PROTECTION: + case PO_PROTECTION_SCROLL: print_msg("You feel like something is helping you.\n"); if (!u.protection) { @@ -219,20 +219,20 @@ Action_cost quaff_potion(int obj) Obj *optr = objects + obj; switch (optr->obj_id) { - case PO_POT_BODY: + case PO_BODY_POTION: gain_body(1, 1); break; - case PO_POT_AGILITY: + case PO_AGILITY_POTION: gain_agility(1, 1); break; - case PO_POT_HEAL: + case PO_HEALING_POTION: { int healpercent = inclusive_flat(30, 50); int healamount = (healpercent * ((u.hpmax > 60) ? u.hpmax : 60)) / 100; heal_u(healamount, 1, 1); } break; - case PO_POT_RESTORATION: + case PO_RESTORATION_POTION: print_msg("This potion makes you feel warm all over.\n"); status_updated = 1; if (!zero_die(2)) @@ -296,11 +296,11 @@ void flavours_init(void) i++; } } - permobjs[PO_RING_REGEN].power = colour_choices[0]; - permobjs[PO_RING_FIRE].power = colour_choices[1]; - permobjs[PO_RING_VAMPIRE].power = colour_choices[2]; - permobjs[PO_RING_FROST].power = colour_choices[3]; - permobjs[PO_RING_TELEPORT].power = colour_choices[4]; + permobjs[PO_REGENERATION_RING].power = colour_choices[0]; + permobjs[PO_FIRE_RING].power = colour_choices[1]; + permobjs[PO_VAMPIRE_RING].power = colour_choices[2]; + permobjs[PO_FROST_RING].power = colour_choices[3]; + permobjs[PO_TELEPORT_RING].power = colour_choices[4]; /* Scrolls */ for (i = 0; i < 10;) { @@ -318,9 +318,9 @@ void flavours_init(void) i++; } } - permobjs[PO_SCR_FIRE].power = colour_choices[0]; - permobjs[PO_SCR_TELEPORT].power = colour_choices[1]; - permobjs[PO_SCR_PROTECTION].power = colour_choices[2]; + permobjs[PO_FIRE_SCROLL].power = colour_choices[0]; + permobjs[PO_TELEPORT_SCROLL].power = colour_choices[1]; + permobjs[PO_PROTECTION_SCROLL].power = colour_choices[2]; /* Potions */ for (i = 0; i < 10;) { @@ -338,10 +338,10 @@ void flavours_init(void) i++; } } - permobjs[PO_POT_HEAL].power = colour_choices[0]; - permobjs[PO_POT_BODY].power = colour_choices[1]; - permobjs[PO_POT_AGILITY].power = colour_choices[2]; - permobjs[PO_POT_RESTORATION].power = colour_choices[3]; + permobjs[PO_HEALING_POTION].power = colour_choices[0]; + permobjs[PO_BODY_POTION].power = colour_choices[1]; + permobjs[PO_AGILITY_POTION].power = colour_choices[2]; + permobjs[PO_RESTORATION_POTION].power = colour_choices[3]; } int create_obj_class(enum poclass_num po_class, int quantity, bool with_you, Coord c) @@ -464,7 +464,7 @@ int create_obj(int po_idx, int quantity, bool with_you, Coord c) void sprint_obj_name(char *buf, int obj, int len) { Obj *optr; - struct permobj *poptr; + Permobj *poptr; optr = objects + obj; poptr = permobjs + optr->obj_id; if (optr->quan > 1) @@ -489,7 +489,7 @@ void sprint_obj_name(char *buf, int obj, int len) void fprint_obj_name(FILE *fp, int obj) { Obj *optr; - struct permobj *poptr; + Permobj *poptr; optr = objects + obj; poptr = permobjs + optr->obj_id; if (optr->quan > 1) @@ -514,7 +514,7 @@ void fprint_obj_name(FILE *fp, int obj) void print_obj_name(int obj) { Obj *optr; - struct permobj *poptr; + Permobj *poptr; optr = objects + obj; poptr = permobjs + optr->obj_id; if (optr->quan > 1) @@ -644,7 +644,7 @@ void damage_obj(int obj) { switch (objects[obj].obj_id) { - case PO_RIBBONS: + case PO_SET_OF_RIBBONS: if (u.food < 500) { int shortfall = (u.food < 0) ? 500 : 500 - u.food; @@ -683,7 +683,7 @@ void damage_obj(int obj) void describe_object(int obj) { Obj *optr; - struct permobj *poptr; + Permobj *poptr; print_obj_name(obj); optr = objects + obj; poptr = permobjs + optr->obj_id; @@ -706,7 +706,7 @@ Action_cost magic_ring(void) Obj *optr = objects + u.ring; switch (optr->obj_id) { - case PO_RING_TELEPORT: + case PO_TELEPORT_RING: if (u.food >= 50) { u.food -= 50; @@ -731,7 +731,7 @@ Action_cost emanate_armour(void) Action_cost cost = Cost_none; switch (optr->obj_id) { - case PO_RIBBONS: + case PO_SET_OF_RIBBONS: if (optr->durability < OBJ_MAX_DUR) { if (u.food < 5 * (OBJ_MAX_DUR - optr->durability)) diff --git a/objects.hh b/objects.hh index 8230ca3..40c1506 100644 --- a/objects.hh +++ b/objects.hh @@ -29,74 +29,44 @@ #ifndef OBJECTS_HH #define OBJECTS_HH +/*! \brief Quality level of object. + */ +enum Item_quality +{ + Quality_bad, //!< Useless or hypothetically actively harmful + Quality_normal, //!< Useful + Quality_good, + Quality_excellent, + Quality_legendary +}; + /* XXX enum poclass_num */ /* Categories of permanent object. */ enum poclass_num { POCLASS_NONE = 0, POCLASS_WEAPON, POCLASS_POTION, POCLASS_SCROLL, POCLASS_FLASK, POCLASS_ARMOUR, POCLASS_RING, - POCLASS_FOOD -}; - -/* XXX enum Permobj_nums */ -enum Permobj_nums -{ - // weapons - PO_DAGGER=0, PO_LONG_SWORD, PO_MACE, PO_RUNESWORD, PO_TORMENTORS_LASH, - PO_STAFF_OF_FIRE, - PO_BOW, PO_CROSSBOW, PO_THUNDERBOW, - // potions - PO_POT_HEAL, PO_POT_BODY, PO_POT_AGILITY, PO_POT_RESTORATION, - // flasks - PO_FLASK_POISON, PO_FLASK_FIRE, PO_FLASK_WEAKNESS, - // scrolls - PO_SCR_TELEPORT, PO_SCR_FIRE, PO_SCR_PROTECTION, - // armour - PO_LEATHER_ARMOUR, PO_CHAINMAIL, PO_PLATE_ARMOUR, PO_MAGE_ARMOUR, PO_ROBE, - PO_ROBE_SWIFTNESS, PO_ROBE_SHADOWS, PO_DRAGON_ARMOUR, PO_METEOR_ARMOUR, - PO_SACRED_MAIL, PO_RAGGED_SHIFT, PO_BATTLE_BALLGOWN, PO_IMPERATRIX_GOWN, - PO_RIBBONS, - // rings - PO_RING_REGEN, PO_RING_FIRE, PO_RING_VAMPIRE, PO_RING_FROST, - PO_RING_TELEPORT, - // food - PO_IRON_RATION, PO_DRIED_FRUIT, PO_ELVEN_BREAD, PO_DEVIL_SPLEEN + POCLASS_FOOD, POCLASS_CARRION }; -#define PO_FIRST_WEAPON PO_DAGGER -#define PO_LAST_WEAPON PO_STAFF_OF_FIRE -#define PO_FIRST_POTION PO_POT_HEAL -#define PO_LAST_POTION PO_POT_RESTORATION -#define PO_FIRST_FLASK PO_FLASK_POISON -#define PO_LAST_FLASK PO_FLASK_WEAKNESS -#define PO_FIRST_SCROLL PO_SCR_TELEPORT -#define PO_LAST_SCROLL PO_SCR_PROTECTION -#define PO_FIRST_ARMOUR PO_LEATHER_ARMOUR -#define PO_LAST_ARMOUR PO_RIBBONS -#define PO_FIRST_RING PO_RING_REGEN -#define PO_LAST_RING PO_RING_TELEPORT -#define PO_FIRST_FOOD PO_IRON_RATION -#define PO_LAST_FOOD PO_DEVIL_SPLEEN -#define NUM_OF_PERMOBJS ((PO_LAST_FOOD) + 1) +#include "pobj_id.hh" -/* XXX struct permobj */ -struct permobj { - char const name[48]; - char const plural[48]; - char const *description; - enum poclass_num poclass; - int rarity; /* Chance in 100 of being thrown away and regen'd. */ - char sym; /* ASCII */ - char const *unicode; /* UTF-8 */ - Gamecolour colour; - int power; /* AC for armour; damage for weapons; colour/title for - * scrolls and potions and rings and such. */ - int power2; /* evasion for armour */ - int depth; /* If greater than 1, this item cannot be given out - * by get_random_pobj() before the specified depth. */ +/*! \brief The 'permanent object' database */ +struct Permobj { + char const name[48]; //!< English-language name of item + char const plural[48]; //!< English-language plural of item + char const *description; //!< English-language description of item + enum poclass_num poclass; //!< Category of item + int rarity; //!< Chance in 100 of being thrown away and regen'd. + char sym; //!< must be in range 32...126 + char const *unicode; //!< must be a C-style string in UTF-8 encoding + Gamecolour colour; //!< colour used for terminal display + int power; //!< first POCLASS-specific data field + int power2; //!< second POCLASS-specific data field + int depth; //!< shallowest depth at which item can be randomly gen'd }; #define NO_POBJ (-1) -extern struct permobj permobjs[NUM_OF_PERMOBJS]; +extern Permobj permobjs[NUM_OF_PERMOBJS]; /* XXX Obj */ #define OBJ_MAX_DUR 100 diff --git a/permobj.cc b/permobj.cc deleted file mode 100644 index 2da6bd5..0000000 --- a/permobj.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* \file permobj.cc - * \brief object database for Victrix Abyssi - */ - -/* Copyright 2005-2013 Martin Read - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#define PERMOBJ_CC -#include "victrix-abyssi.hh" - -struct permobj permobjs[NUM_OF_PERMOBJS] = -{ - { "dagger", "daggers", "A long knife, designed for stabbing.", POCLASS_WEAPON, 25, ')', ")", Gcol_iron, 4, 0, 1 }, - { "long sword", "long swords", "A steel sword of simple but sturdy construction; the\nblade is three feet long.", POCLASS_WEAPON, 30, ')', ")", Gcol_iron, 10, 0, 4 }, - { "mace", "maces", "A flanged lump of iron on an iron haft.", POCLASS_WEAPON, 30, ')', ")", Gcol_iron, 7, 0, 2 }, - { "runesword", "runeswords", "An eerily glowing sword engraved with many strange\nrunes.", POCLASS_WEAPON, 80, ')', ")", Gcol_l_cyan, 20, 0, 12 }, - { "tormentor's lash", "tormentor's lash", "A bone-handled whip that crackles with malefic energies.", POCLASS_WEAPON, 80, ')', ")", Gcol_white, 20, 0, 30 }, - { "staff of fire", "staff of fire", "A jet-black staff with a glowing ruby in its headpiece.", POCLASS_WEAPON, 80, ')', ")", Gcol_d_grey, 10, 0, 20 }, - { "bow", "bows", "A recurve composite bow.", POCLASS_WEAPON, 45, '(', "(", Gcol_brown, 8, 0, 1 }, - { "crossbow", "crossbows", "A crossbow.", POCLASS_WEAPON, 70, '(', "(", Gcol_brown, 16, 0, 6 }, - { "thunderbow", "thunderbows", "A recurve composite bow decorated with eldritch signs.\nArrows fired with this bow strike with staggering force.", POCLASS_WEAPON, 70, '(', "(", Gcol_l_cyan, 16, 0, 30 }, - { "healing potion", "healing potions", "This magic elixir restores some lost hit points.", POCLASS_POTION, 10, '!', "!", Gcol_l_grey, 0, 0, 1 }, - { "body potion", "body potions", "This magic elixir will improve your physique.", POCLASS_POTION, 70, '!', "!", Gcol_l_grey, 0, 0, 5 }, - { "agility potion", "agility potions", "This magic elixir will sharpen your reflexes.", POCLASS_POTION, 70, '!', "!", Gcol_l_grey, 0, 0, 5 }, - { "restoration potion", "restoration potions", "This magic elixir cures temporary damage to one's\nabilities.", POCLASS_POTION, 70, '!', "!", Gcol_l_grey, 0, 0, 1 }, - { "poison flask", "poison flask", "This fragile bottle is full of contact poison.", POCLASS_FLASK, 10, '~', "~", Gcol_l_grey, 0, 0, 1 }, - { "fire flask", "fire flasks", "The volatile, phosphorus-laced liquid in this sealed\nflask will ignite spontaneously when exposed to the air.", POCLASS_FLASK, 40, '~', "~", Gcol_l_grey, 0, 0, 20 }, - { "weakness flask", "weakness flasks", "Dousing the living in this vile liquid causes immediate\nand severe physical degeneration.", POCLASS_FLASK, 40, '~', "~", Gcol_l_grey, 0, 0, 20 }, - { "teleport scroll", "teleport scrolls", "Reading this scroll will teleport you to a random\nlocation.", POCLASS_SCROLL, 40, '?', "?", Gcol_l_grey, 0, 0, 1 }, - { "fire scroll", "fire scrolls", "Reading this scroll will engulf all nearby creatures\n(including you) in flames.", POCLASS_SCROLL, 30, '?', "?", Gcol_l_grey, 0, 0, 1 }, - { "protection scroll", "protection scrolls", "Reading this scroll will dispel any curses afflicting\nyou and protect you from curses for a time.", POCLASS_SCROLL, 80, '?', "?", Gcol_l_grey, 0, 0, 8 }, - { "leather armour", "suits of leather armour", "A heavy leather jerkin and breeches, providing some\nprotection.", POCLASS_ARMOUR, 25, '[', "[", Gcol_brown, 3, 10, 1 }, - { "chainmail", "suits of chainmail", "A suit of interlocking metal rings, providing better\nprotection than leather.", POCLASS_ARMOUR, 30, '[', "[", Gcol_iron, 6, 25, 3 }, - { "plate armour", "suits of plate armour", "A suit of steel plates, providing better protection than\nchainmail.", POCLASS_ARMOUR, 40, '[', "[", Gcol_iron, 10, 40, 6 }, - { "mage armour", "suits of mage armour", "A suit of glowing steel plates bearing enchantments of\ndefence.", POCLASS_ARMOUR, 70, '[', "[", Gcol_l_cyan, 15, 40, 12 }, - { "mundane robe", "mundane robes", "A simple woolen robe. It's better protection than your\nskin, but not by much.", POCLASS_ARMOUR, 50, '[', "[", Gcol_green, 2, 5, 1 }, - { "robe of swiftness", "robes of swiftness", "A simple woolen robe that bears a potent enchantment,\nprotecting the wearer and making him unnaturally swift.", POCLASS_ARMOUR, 70, '[', "[", Gcol_green, 8, 0, 8 }, - { "robe of shadows", "robes of shadows", "A dusky grey woolen robe that bears an awesome enchantment,\nprotecting the wearer better than steel plate.", POCLASS_ARMOUR, 90, '[', "[", Gcol_d_grey, 14, -15, 18 }, - { "dragonhide armour", "suits of dragonhide armour", "The skin of a dragon, formed into a jerkin and breeches;\nit turns blows like steel plate and turns away\nflames.", POCLASS_ARMOUR, 90, '[', "[", Gcol_red, 12, 10, 21 }, - { "meteoric plate armour", "suits of meteoric plate armour", "This plate armour has been forged out of metal taken from\na fallen star.", POCLASS_ARMOUR, 90, '[', "[", Gcol_iron, 18, 40, 27 }, - { "sacred chainmail", "suits of sacred chainmail", "This suit of interlocking rings has been consecrated to\nthe gods of the Light.", POCLASS_ARMOUR, 90, '[', "[", Gcol_white, 15, 25, 24 }, - { "ragged shift", "ragged shifts", "This sorry-looking collection of rags is all that remains\nof an imposing armoured dress.", POCLASS_ARMOUR, 100, '[', "[", Gcol_l_grey, 1, 0, 1 }, - { "battle ballgown", "battle ballgowns", "Partially armoured dresses such as this are a\ntraditional part of a princess's wardrobe.", POCLASS_ARMOUR, 95, '[', "[", Gcol_green, 3, 10, 1 }, - { "imperatrix gown", "imperatrix gowns", "This armoured, enchanted, and elaborately decorated dress\nwould be worthy of an empress regnant.", POCLASS_ARMOUR, 95, '[', "[", Gcol_purple, 15, 10, 24 }, - { "set of ribbons", "sets of ribbons", "These ribbons, arranged as if to form an alleged\ngarment, make your fingers tingle with magic.", POCLASS_ARMOUR, 90, '[', "[", Gcol_l_purple, 15, -15, 30 }, - { "regeneration ring", "regeneration rings", "This magical ring increases the wearer's healing rate,\nbut also increases the rate at which they must consume\nfood.", POCLASS_RING, 70, '=', "=", Gcol_l_grey, 0, 0, 1 }, - { "fire ring", "fire rings", "This magical ring protects the wearer from mundane and\nmagical fire, and imbues their blows in combat with the\npower of fire.", POCLASS_RING, 50, '=', "=", Gcol_l_grey, 0, 0, 1 }, - { "vampire ring", "vampire rings", "This magical ring protects the wearer from necromantic\nenergies, and imbues their blows in combat with such\nenergies as well.", POCLASS_RING, 90, '=', "=", Gcol_l_grey, 0, 0, 12 }, - { "frost ring", "frost rings", "This magical ring protects the wearer from mundane and\nmagical cold, and imbues their blows in combat with the\npower of cold. Rumour suggests it might also allow walking\non water.\n", POCLASS_RING, 40, '=', "=", Gcol_l_grey, 0, 0, 1 }, - { "teleport ring", "teleport rings", "This magical ring allows the wearer to teleport for a\nmodest cost in nutrition.", POCLASS_RING, 70, '=', "=", Gcol_l_grey, 0, 0, 1 }, - { "iron ration", "iron rations", "A parcel of hardtack and beef jerky. Dull but nutritious.", POCLASS_FOOD, 75, '%', "%", Gcol_brown, 0, 0, 1 }, - { "parcel of dried fruit", "parcels of dried fruit", "A parcel of mixed dried fruit. It sure beats hardtack\nand beef jerky.", POCLASS_FOOD, 75, '%', "%", Gcol_yellow, 0, 0, 1 }, - { "round of elven waybread", "rounds of elven waybread", "A tasty, filling, nutritious piece of elven waybread.", POCLASS_FOOD, 85, '%', "%", Gcol_white, 0, 0, 1 }, - { "devil spleen", "devil spleens", "A weirdly pulsing organ ripped from the torso of a devil.", POCLASS_FOOD, 100, '%', "%", Gcol_l_red, 0, 0, 1 } -}; - -/* permobj.c */ -// vim:cindent diff --git a/u.cc b/u.cc index 90f6113..7e02d3d 100644 --- a/u.cc +++ b/u.cc @@ -49,11 +49,11 @@ void recalc_defence(void) u.defence += u.withering ? (u.agility / 10) : (u.agility / 5); switch (objects[u.armour].obj_id) { - case PO_DRAGON_ARMOUR: - case PO_METEOR_ARMOUR: + case PO_DRAGONHIDE_ARMOUR: + case PO_METEORIC_PLATE_ARMOUR: u.resistances[DT_FIRE] |= RESIST_ARMOUR; break; - case PO_ROBE_SWIFTNESS: + case PO_ROBE_OF_SWIFTNESS: u.speed++; break; default: @@ -68,13 +68,13 @@ void recalc_defence(void) { switch (objects[u.ring].obj_id) { - case PO_RING_FIRE: + case PO_FIRE_RING: u.resistances[DT_FIRE] |= RESIST_RING; break; - case PO_RING_FROST: + case PO_FROST_RING: u.resistances[DT_COLD] |= RESIST_RING; break; - case PO_RING_VAMPIRE: + case PO_VAMPIRE_RING: u.resistances[DT_NECRO] |= RESIST_RING; break; } @@ -142,7 +142,7 @@ Action_cost move_player(Offset delta) return Cost_none; } case WATER: - if ((u.ring != NO_OBJ) && (objects[u.ring].obj_id == PO_RING_FROST)) + if ((u.ring != NO_OBJ) && (objects[u.ring].obj_id == PO_FROST_RING)) { if (lvl.terrain_at(u.pos) != WATER) { @@ -282,7 +282,7 @@ int drain_agility(int amount, char const *what, int permanent) return 0; } -int damage_u(int amount, enum death d, char const *what) +int damage_u(int amount, Death d, char const *what) { u.hpcur -= amount; status_updated = 1; @@ -327,7 +327,7 @@ void heal_u(int amount, int boost, int loud) return; } -int do_death(enum death d, char const *what) +int do_death(Death d, char const *what) { FILE *fp; int really = 0; @@ -598,7 +598,7 @@ void update_player(void) * working, and like normal regen, it won't raise you above 75% HP if * your food counter is negative. */ if (((game_tick % 10) == 5) && - (objects[u.ring].obj_id == PO_RING_REGEN) && + (objects[u.ring].obj_id == PO_REGENERATION_RING) && (u.hpcur < ((u.food >= 0) ? u.hpmax : ((u.hpmax * 3) / 4))) && (u.food > MIN_FOOD)) { @@ -611,7 +611,7 @@ void update_player(void) { int food_use = 1; int squeal = 0; - if ((objects[u.ring].obj_id == PO_RING_REGEN) && !(game_tick % 2) && (u.food > MIN_FOOD)) + if ((objects[u.ring].obj_id == PO_REGENERATION_RING) && !(game_tick % 2) && (u.food > MIN_FOOD)) { /* If you are still less hungry than MIN_FOOD nutrition, * use one more food every second tick if you are diff --git a/victrix-abyssi.hh b/victrix-abyssi.hh index 4a43920..2f96877 100644 --- a/victrix-abyssi.hh +++ b/victrix-abyssi.hh @@ -93,8 +93,8 @@ enum Damtyp { }; #define DT_COUNT (1 + DT_DROWNING) -/* XXX enum game_cmd - player actions. */ -enum game_cmd { +/* XXX enum Game_cmd - player actions. */ +enum Game_cmd { DROP_ITEM, SAVE_GAME, MOVE_WEST, MOVE_SOUTH, MOVE_NORTH, MOVE_EAST, MOVE_NW, MOVE_NE, MOVE_SW, MOVE_SE, @@ -106,9 +106,9 @@ enum game_cmd { WIZARD_LEVELUP, WIZARD_DESCEND }; -/* XXX enum death */ +/* XXX enum Death */ /* Sadly, there are not 52 kinds of way to die. */ -enum death { +enum Death { DEATH_KILLED, DEATH_KILLED_MON, DEATH_BODY, DEATH_AGILITY, DEATH_LASH, DEATH_RIBBONS }; @@ -147,6 +147,14 @@ struct Player { bool resists(Damtyp dtype) const; }; +/*! \brief Represent an in-game action in more detail than Game_cmd + */ +struct Action +{ + Game_cmd cmd; + uint32_t details[8]; +}; + #define MIN_FOOD (-1950) #define SLOT_CANCEL (-1) #define SLOT_NOTHING (-2) @@ -171,6 +179,10 @@ struct Player { #include "fov.hh" #endif +#ifndef ACTION_HH +#include "action.hh" +#endif + /* XXX main.c data and funcs */ extern int zero_die(int sides); /* 0..n-1 */ extern int one_die(int sides); /* 1..n */ @@ -180,7 +192,7 @@ extern int inclusive_flat(int lower, int upper); /* l ... u */ extern Offset random_step(void); extern Coord inclusive_boxed(Coord topleft, Coord botright); extern Coord exclusive_boxed(Coord topleft, Coord botright); -extern Action_cost do_command(enum game_cmd command); +extern Action_cost do_command(Game_cmd command); extern uint32_t convert_range(int dy, int dx); extern int game_finished; extern int game_tick; @@ -204,9 +216,9 @@ extern void rng_init(void); /* XXX u.c data and funcs */ extern void u_init(void); extern void write_char_dump(void); -extern int do_death(enum death d, char const *what); +extern int do_death(Death d, char const *what); extern void heal_u(int amount, int boost, int loud); -extern int damage_u(int amount, enum death d, char const *what); +extern int damage_u(int amount, Death d, char const *what); extern int gain_body(int amount, int loud); extern int gain_agility(int amount, int loud); extern int drain_body(int amount, char const *what, int permanent);