Split hmon_hitmon into multiple functions

hmon_hitmon was the biggest function by far; this makes it far more
manageable.

There should be no change in functionality, and although I didn't
test every case, this was just moving chunks of code and changing
variable names until compiler did not complain anymore.
This commit is contained in:
Pasi Kallinen
2023-01-24 15:23:28 +02:00
parent 641065ee74
commit 2f40a8c9aa
2 changed files with 858 additions and 670 deletions

View File

@@ -481,6 +481,48 @@ struct you {
schar uachieved[N_ACH]; /* list of achievements in the order attained */
}; /* end of `struct you' */
/* _hitmon_data: Info for when hero hits a monster */
/* The basic reason we need all these booleans is that we don't want
* a "hit" message when a monster dies, so we have to know how much
* damage it did _before_ outputting a hit message, but any messages
* associated with the damage don't come out until _after_ outputting
* a hit message.
*
* More complications: first_weapon_hit() should be called before
* xkilled() in order to have the gamelog messages in the right order.
* So it can't be deferred until end of known_hitum() as was originally
* done.
*/
struct _hitmon_data {
int tmp; /* damage value? */
int thrown;
int dieroll;
struct permonst *mdat;
boolean use_weapon_skill;
boolean train_weapon_skill;
int barehand_silver_rings;
boolean silvermsg;
boolean silverobj;
boolean lightobj;
int material;
int jousting;
boolean hittxt;
boolean get_dmg_bonus;
boolean unarmed;
boolean hand_to_hand;
boolean ispoisoned;
boolean unpoisonmsg;
boolean needpoismsg;
boolean poiskilled;
boolean already_killed;
boolean destroyed;
boolean dryit;
boolean doreturn;
boolean retval;
char saved_oname[BUFSZ];
};
#define Upolyd (u.umonnum != u.umonster)
#define Ugender ((Upolyd ? u.mfemale : flags.female) ? 1 : 0)

File diff suppressed because it is too large Load Diff