1 /* NetHack 3.7 context.h $NHDT-Date: 1596498530 2020/08/03 23:48:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.41 $ */ 2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3 /*-Copyright (c) Michael Allison, 2006. */ 4 /* NetHack may be freely redistributed. See license for details. */ 5 6 /* If you change the context structure make sure you increment EDITLEVEL in */ 7 /* patchlevel.h if needed. */ 8 9 #ifndef CONTEXT_H 10 #define CONTEXT_H 11 12 #define CONTEXTVERBSZ 30 13 14 /* 15 * The context structure houses things that the game tracks 16 * or adjusts during the game, to preserve game state or context. 17 * 18 * The entire structure is saved with the game. 19 * 20 */ 21 22 struct dig_info { /* apply.c, hack.c */ 23 int effort; 24 d_level level; 25 coord pos; 26 long lastdigtime; 27 boolean down, chew, warned, quiet; 28 }; 29 30 struct tin_info { 31 struct obj *tin; 32 unsigned o_id; /* o_id of tin in save file */ 33 int usedtime, reqtime; 34 }; 35 36 struct book_info { 37 struct obj *book; /* last/current book being xscribed */ 38 unsigned o_id; /* o_id of book in save file */ 39 schar delay; /* moves left for this spell */ 40 }; 41 42 struct crystalball_info { 43 struct obj* ball; 44 unsigned o_id; 45 xchar looktime; 46 }; 47 48 struct takeoff_info { 49 long mask; 50 long what; 51 int delay; 52 boolean cancelled_don; 53 char disrobing[CONTEXTVERBSZ + 1]; 54 }; 55 56 struct victual_info { 57 struct obj *piece; /* the thing being eaten, or last thing that 58 * was partially eaten, unless that thing was 59 * a tin, which uses the tin structure above, 60 * in which case this should be 0 */ 61 unsigned o_id; /* o_id of food object in save file */ 62 /* doeat() initializes these when piece is valid */ 63 int usedtime, /* turns spent eating */ 64 reqtime; /* turns required to eat */ 65 int nmod; /* coded nutrition per turn */ 66 Bitfield(canchoke, 1); /* was satiated at beginning */ 67 68 /* start_eating() initializes these */ 69 Bitfield(fullwarn, 1); /* have warned about being full */ 70 Bitfield(eating, 1); /* victual currently being eaten */ 71 Bitfield(doreset, 1); /* stop eating at end of turn */ 72 }; 73 74 struct engrave_info { 75 char text[BUFSZ]; /* actual text being engraved - doengrave() handles all 76 the possible mutations of this */ 77 char *nextc; /* next character(s) in text[] to engrave */ 78 struct obj *stylus; /* object doing the writing */ 79 xchar type; /* type of engraving (DUST, MARK, etc) */ 80 coord pos; /* location the engraving is being placed on */ 81 int actionct; /* nth turn spent engraving */ 82 }; 83 84 struct warntype_info { 85 unsigned long obj; /* object warn_of_mon monster type M2 */ 86 unsigned short obj_mlet; /* object warn_of_mon S_FOO monster letter */ 87 unsigned long polyd; /* warn_of_mon monster type M2 due to poly */ 88 struct permonst *species; /* particular species due to poly */ 89 short speciesidx; /* index of above in mons[] (for save/restore) */ 90 }; 91 92 struct polearm_info { 93 struct monst *hitmon; /* the monster we tried to hit last */ 94 unsigned m_id; /* monster id of hitmon, in save file */ 95 }; 96 97 struct obj_split { 98 unsigned parent_oid, /* set: splitobj(), */ 99 child_oid; /* reset: clear_splitobjs() */ 100 }; 101 102 struct tribute_info { 103 size_t tributesz; /* make it possible to skip this in future */ 104 boolean enabled; /* Do we have tributes turned on? */ 105 Bitfield(bookstock, 1); /* Have we stocked the book? */ 106 Bitfield(Deathnotice,1); /* Did Death notice the book? */ 107 /* Markers for other tributes can go here */ 108 /* 30 free bits */ 109 }; 110 111 struct novel_tracking { /* for choosing random passage when reading novel */ 112 unsigned id; /* novel oid from previous passage selection */ 113 int count; /* number of passage indices available in pasg[] */ 114 xchar pasg[30]; /* pasg[0..count-1] are passage indices */ 115 /* tribute file is allowed to have more than 30 passages for a novel; 116 if it does, reading will first choose a random subset of 30 of them; 117 reading all 30 or switching to a different novel and then back again 118 will pick a new subset, independent of previous ones so might not 119 contain all--or even any--of the ones left out of the prior subset; 120 chatting with Death works the same as reading a novel except that 121 sometimes he delivers one of a few hardcoded messages rather than a 122 passage from the Death Quotes section of dat/tribute */ 123 }; 124 125 struct achievement_tracking { 126 unsigned mines_prize_oid, /* luckstone->o_id */ 127 soko_prize_oid, /* {bag or amulet}->o_id */ 128 castle_prize_old; /* wand->o_id; not yet implemented */ 129 boolean minetn_reached; /* avoid redundant checking for town entry */ 130 }; 131 132 struct context_info { 133 unsigned ident; /* social security number for each monster */ 134 unsigned no_of_wizards; /* 0, 1 or 2 (wizard and his shadow) */ 135 unsigned run; /* 0: h (etc), 1: H (etc), 2: fh (etc) */ 136 /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */ 137 /* 8: travel */ 138 unsigned startingpet_mid; /* monster id number for initial pet */ 139 int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */ 140 int mysteryforce; /* adjusts how often "mysterious force" kicks in */ 141 int rndencode; /* randomized escape sequence introducer */ 142 int warnlevel; /* threshold (digit) to warn about unseen mons */ 143 long next_attrib_check; /* next attribute check */ 144 long seer_turn; /* when random clairvoyance will next kick in */ 145 long stethoscope_move; /* when a stethoscope was last used */ 146 short stethoscope_movement; /* to track multiple moves on same turn */ 147 boolean travel; /* find way automatically to u.tx,u.ty */ 148 boolean travel1; /* first travel step */ 149 boolean forcefight; 150 boolean nopick; /* do not pickup objects (as when running) */ 151 boolean made_amulet; 152 boolean mon_moving; /* monsters' turn to move */ 153 boolean move; 154 boolean mv; 155 boolean bypasses; /* bypass flag is set on at least one fobj */ 156 boolean botl; /* partially redo status line */ 157 boolean botlx; /* print an entirely new bottom line */ 158 boolean door_opened; /* set to true if door was opened during test_move */ 159 boolean enhance_tip; /* player is informed about #enhance */ 160 struct dig_info digging; 161 struct victual_info victual; 162 struct engrave_info engraving; 163 struct tin_info tin; 164 struct book_info spbook; 165 struct crystalball_info crystal; 166 struct takeoff_info takeoff; 167 struct warntype_info warntype; 168 struct polearm_info polearm; 169 struct obj_split objsplit; /* track most recently split object stack */ 170 struct tribute_info tribute; 171 struct novel_tracking novel; 172 struct achievement_tracking achieveo; 173 }; 174 175 #endif /* CONTEXT_H */ 176