-+-+-+-+-+-+-+-+ START OF PART 75 -+-+-+-+-+-+-+-+ X but still treat it like an unsigned character, let's just avoid it, X any variable which can ever hold a negative value must be 16 or 32 bits * V/ X X#define VTYPESIZ`0980 X#define BIGVTYPESIZ`09160 Xtypedef char vtype`5BVTYPESIZ`5D; X/* note that since its output can easily exceed 80 characters, objdes must X always be called with a bigvtype as the first paramter */ Xtypedef char bigvtype`5BBIGVTYPESIZ`5D; Xtypedef char stat_type`5B7`5D; X X/* Many of the character fields used to be fixed length, which greatly X increased the size of the executable. I have replaced many fixed X length fields with variable length ones. */ X X/* all fields are given the smallest possbile type, and all fields are X aligned within the structure to their natural size boundary, so that X the structures contain no padding and are minimum size */ X X/* bit fields are only used where they would cause a large reduction in X data size, they should not be used otherwise because their use X results in larger and slower code */ X Xtypedef struct creature_type X`7B X char *name;`09`09/* Descrip of creature`09*/ X int32u cmove;`09`09/* Bit field`09`09*/ X int32u spells;`09/* Creature spells`09*/ X int16u cdefense;`09/* Bit field`09`09*/ X int16u mexp;`09`09/* Exp value for kill`09*/ X int8u sleep;`09`09/* Inactive counter/10`09*/ X int8u aaf;`09`09/* Area affect radius`09*/ X int8u ac;`09`09/* AC`09`09`09*/ X int8u speed;`09`09/* Movement speed+10`09*/ X int8u cchar;`09`09/* Character rep.`09*/ X int8u hd`5B2`5D;`09`09/* Creatures hit die`09*/ X int8u damage`5B4`5D;`09/* Type attack and damage*/ X int8u level;`09`09/* Level of creature`09*/ X`7D creature_type; X Xtypedef struct m_attack_type`09/* Monster attack and damage types */ X `7B X int8u attack_type; X int8u attack_desc; X int8u attack_dice; X int8u attack_sides; X `7D m_attack_type; X Xtypedef struct recall_type`09/* Monster memories. -CJS- */ X `7B X int32u r_cmove; X int32u r_spells; X int16u r_kills, r_deaths; X int16u r_cdefense; X int8u r_wake, r_ignore; X int8u r_attacks`5BMAX_MON_NATTACK`5D; X `7D recall_type; X Xtypedef struct monster_type X`7B X int16 hp;`09`09/* Hit points`09`09*/ X int16 csleep;`09`09/* Inactive counter`09*/ X int16 cspeed;`09`09/* Movement speed`09*/ X int16u mptr;`09`09/* Pointer into creature*/ X /* Note: fy, fx, and cdis constrain dungeon size to less than 256 by 256 * V/ X int8u fy;`09`09/* Y Pointer into map`09*/ X int8u fx;`09`09/* X Pointer into map`09*/ X int8u cdis;`09`09/* Cur dis from player`09*/ X int8u ml; X int8u stunned; X int8u confused; X`7D monster_type; X Xtypedef struct treasure_type X`7B X char *name;`09`09/* Object name`09`09*/ X int32u flags;`09`09/* Special flags`09*/ X int8u tval;`09`09/* Category number`09*/ X int8u tchar;`09`09/* Character representation*/ X int16 p1;`09`09/* Misc. use variable`09*/ X int32 cost;`09`09/* Cost of item`09`09*/ X int8u subval;`09`09/* Sub-category number`09*/ X int8u number;`09`09/* Number of items`09*/ X int16u weight;`09/* Weight`09`09*/ X int16 tohit;`09`09/* Plusses to hit`09*/ X int16 todam;`09`09/* Plusses to damage`09*/ X int16 ac;`09`09/* Normal AC`09`09*/ X int16 toac;`09`09/* Plusses to AC`09*/ X int8u damage`5B2`5D;`09/* Damage when hits`09*/ X int8u level;`09`09/* Level item first found */ X`7D treasure_type; X X/* only damage, ac, and tchar are constant; level could possibly be made X constant by changing index instead; all are used rarely */ X/* extra fields x and y for location in dungeon would simplify pusht() */ X/* making inscrip a pointer and mallocing space does not work, there are X two many places where inven_types are copied, which results in dangling X pointers, so we use a char array for them instead */ X#define INSCRIP_SIZE 13 /* notice alignment, must be 4*x + 1 */ Xtypedef struct inven_type X`7B X int16u index;`09`09/* Index to object_list */ X int8u name2;`09`09/* Object special name */ X char inscrip`5BINSCRIP_SIZE`5D; /* Object inscription */ X int32u flags;`09`09/* Special flags`09*/ X int8u tval;`09`09/* Category number`09*/ X int8u tchar;`09`09/* Character representation*/ X int16 p1;`09`09/* Misc. use variable`09*/ X int32 cost;`09`09/* Cost of item`09`09*/ X int8u subval;`09`09/* Sub-category number`09*/ X int8u number;`09`09/* Number of items`09*/ X int16u weight;`09/* Weight`09`09*/ X int16 tohit;`09`09/* Plusses to hit`09*/ X int16 todam;`09`09/* Plusses to damage`09*/ X int16 ac;`09`09/* Normal AC`09`09*/ X int16 toac;`09`09/* Plusses to AC`09*/ X int8u damage`5B2`5D;`09/* Damage when hits`09*/ X int8u level;`09`09/* Level item first found */ X int8u ident;`09`09/* Identify information */ X`7D inven_type; X X#define PLAYER_NAME_SIZE 27 X Xtypedef struct player_type X`7B X struct misc X `7B X char name`5BPLAYER_NAME_SIZE`5D;`09/* Name of character`09*/ X int8u male;`09/* Sex of character`09*/ X int32 au;`09`09/* Gold`09`09`09*/ X int32 max_exp;`09/* Max experience`09*/ X int32 exp;`09/* Cur experience`09*/ X int16u exp_frac;`09/* Cur exp fraction * 2`5E16 */ X int16u age;`09/* Characters age`09*/ X int16u ht;`09/* Height`09`09*/ X int16u wt;`09/* Weight`09`09*/ X int16u lev;`09/* Level`09`09*/ X int16u max_dlv;`09/* Max level explored`09*/ X int16 srh;`09/* Chance in search`09*/ X int16 fos;`09/* Frenq of search`09*/ X int16 bth;`09/* Base to hit`09`09*/ X int16 bthb;`09/* BTH with bows`09*/ X int16 mana;`09/* Mana points`09`09*/ X int16 mhp;`09/* Max hit pts`09`09*/ X int16 ptohit;`09/* Plusses to hit`09*/ X int16 ptodam;`09/* Plusses to dam`09*/ X int16 pac;`09/* Total AC`09`09*/ X int16 ptoac;`09/* Magical AC`09`09*/ X int16 dis_th;`09/* Display +ToHit`09*/ X int16 dis_td;`09/* Display +ToDam`09*/ X int16 dis_ac;`09/* Display +ToAC`09*/ X int16 dis_tac;`09/* Display +ToTAC`09*/ X int16 disarm;`09/* % to Disarm`09`09*/ X int16 save;`09/* Saving throw`09`09*/ X int16 sc;`09`09/* Social Class`09`09*/ X int16 stl;`09/* Stealth factor`09*/ X int8u pclass;`09/* # of class`09`09*/ X int8u prace;`09/* # of race`09`09*/ X int8u hitdie;`09/* Char hit die`09`09*/ X int8u expfact;`09/* Experience factor`09*/ X int16 cmana;`09/* Cur mana pts`09`09*/ X int16u cmana_frac; /* Cur mana fraction * 2`5E16 */ X int16 chp;`09/* Cur hit pts`09`09*/ X int16u chp_frac;`09/* Cur hit fraction * 2`5E16 */ X char history`5B4`5D`5B60`5D; /* History record`09*/ X `7D misc; X /* Stats now kept in arrays, for more efficient access. -CJS- */ X struct stats X `7B X int8u max_stat`5B6`5D;`09/* What is restored */ X int8u cur_stat`5B6`5D;`09/* What is natural */ X int16 mod_stat`5B6`5D;`09/* What is modified, may be +/- */ X int8u use_stat`5B6`5D;`09/* What is used */ X `7D stats; X struct flags X `7B X int32u status;`09`09/* Status of player */ X int16 rest;`09`09/* Rest counter`09 */ X int16 blind;`09`09/* Blindness counter */ X int16 paralysis;`09`09/* Paralysis counter */ X int16 confused;`09`09/* Confusion counter */ X int16 food;`09`09/* Food counter`09 */ X int16 food_digested;`09/* Food per round */ X int16 protection;`09`09/* Protection fr. evil */ X int16 speed;`09`09/* Cur speed adjust */ X int16 fast;`09`09/* Temp speed change */ X int16 slow;`09`09/* Temp speed change */ X int16 afraid;`09`09/* Fear`09`09 */ X int16 poisoned;`09`09/* Poisoned`09 */ X int16 image;`09`09/* Hallucinate`09 */ X int16 protevil;`09`09/* Protect VS evil */ X int16 invuln;`09`09/* Increases AC`09 */ X int16 hero;`09`09/* Heroism`09 */ X int16 shero;`09`09/* Super Heroism */ X int16 blessed;`09`09/* Blessed`09 */ X int16 resist_heat;`09/* Timed heat resist */ X int16 resist_cold;`09/* Timed cold resist */ X int16 detect_inv;`09`09/* Timed see invisible */ X int16 word_recall;`09/* Timed teleport level*/ X int16 see_infra;`09`09/* See warm creatures */ X int16 tim_infra;`09`09/* Timed infra vision */ X int8u see_inv;`09`09/* Can see invisible */ X int8u teleport;`09`09/* Random teleportation*/ X int8u free_act;`09`09/* Never paralyzed */ X int8u slow_digest;`09/* Lower food needs */ X int8u aggravate;`09`09/* Aggravate monsters */ X int8u fire_resist;`09/* Resistance to fire */ X int8u cold_resist;`09/* Resistance to cold */ X int8u acid_resist;`09/* Resistance to acid */ X int8u regenerate;`09`09/* Regenerate hit pts */ X int8u lght_resist;`09/* Resistance to light */ X int8u ffall;`09`09/* No damage falling */ X int8u sustain_str;`09/* Keep strength */ X int8u sustain_int;`09/* Keep intelligence */ X int8u sustain_wis;`09/* Keep wisdom`09 */ X int8u sustain_con;`09/* Keep constitution */ X int8u sustain_dex;`09/* Keep dexterity */ X int8u sustain_chr;`09/* Keep charisma */ X int8u confuse_monster;`09/* Glowing hands. */ X int8u new_spells;`09`09/* Number of spells can learn. */ X `7D flags; X`7D player_type; X Xtypedef struct spell_type X`7B /* spell name is stored in spell_names`5B`5D array at index i, +31 if p Vriest */ X int8u slevel; X int8u smana; X int8u sfail; X int8u sexp;`09/* 1/4 of exp gained for learning spell */ X`7D spell_type; X Xtypedef struct race_type X`7B X char`09*trace;`09`09/* Type of race`09`09`09*/ X int16 str_adj;`09/* adjustments`09`09`09*/ X int16 int_adj; X int16 wis_adj; X int16 dex_adj; X int16 con_adj; X int16 chr_adj; X int8u b_age;`09 /* Base age of character`09`09*/ X int8u m_age;`09 /* Maximum age of character`09*/ X int8u m_b_ht;`09 /* base height for males`09`09*/ X int8u m_m_ht;`09 /* mod height for males`09`09*/ X int8u m_b_wt;`09 /* base weight for males`09`09*/ X int8u m_m_wt;`09 /* mod weight for males`09`09*/ X int8u f_b_ht;`09 /* base height females`09`09*/ X int8u f_m_ht;`09 /* mod height for females`09*/ X int8u f_b_wt;`09 /* base weight for female`09*/ X int8u f_m_wt;`09 /* mod weight for females`09*/ X int16 b_dis;`09 /* base chance to disarm`09`09*/ X int16 srh;`09 /* base chance for search`09*/ X int16 stl;`09 /* Stealth of character`09`09*/ X int16 fos;`09 /* frequency of auto search`09*/ X int16 bth;`09 /* adj base chance to hit`09*/ X int16 bthb;`09 /* adj base to hit with bows`09*/ X int16 bsav;`09 /* Race base for saving throw`09*/ X int8u bhitdie;`09 /* Base hit points for race`09*/ X int8u infra;`09 /* See infra-red`09`09`09*/ X int8u b_exp;`09 /* Base experience factor`09*/ X int8u rtclass; /* Bit field for class types`09*/ X`7D race_type; X Xtypedef struct class_type X`7B X char *title;`09`09/* type of class`09`09*/ X int8u adj_hd;`09`09/* Adjust hit points`09`09*/ X int8u mdis;`09`09/* mod disarming traps`09`09*/ X int8u msrh;`09`09/* modifier to searching`09*/ X int8u mstl;`09`09/* modifier to stealth`09`09*/ X int8u mfos;`09`09/* modifier to freq-of-search`09*/ X int8u mbth;`09`09/* modifier to base to hit`09*/ X int8u mbthb;`09`09/* modifier to base to hit - bows*/ X int8u msav;`09`09/* Class modifier to save`09*/ X int16 madj_str;`09/* Class modifier for strength`09*/ X int16 madj_int;`09/* Class modifier for intelligence*/ X int16 madj_wis;`09/* Class modifier for wisdom`09*/ X int16 madj_dex;`09/* Class modifier for dexterity */ X int16 madj_con;`09/* Class modifier for constitution*/ X int16 madj_chr;`09/* Class modifier for charisma`09*/ X int8u spell;`09`09/* class use mage spells`09*/ X int8u m_exp;`09`09/* Class experience factor`09*/ X int8u first_spell_lev;/* First level where class can use spells. */ X`7D class_type; X Xtypedef struct background_type X`7B X char *info;`09`09/* History information`09`09*/ X int8u roll;`09`09/* Die roll needed for history`09*/ X int8u chart;`09`09/* Table number`09`09`09*/ X int8u next;`09`09/* Pointer to next table`09*/ X int8u bonus;`09`09/* Bonus to the Social Class+50`09*/ X`7D background_type; X Xtypedef struct cave_type X`7B X#ifdef AMIGA X /* This reduces the size from 64 bits to 32 bits. */ X unsigned int cptr : 8; X unsigned int tptr : 8; X unsigned int fval : 8; X#else X int8u cptr; X int8u tptr; X int8u fval; X#endif X#if !defined(MSDOS) && !defined(ATARIST_MWC) X unsigned int lr : 1; /* room should be lit with perm light, walls with X`09`09`09 this set should be perm lit after tunneled out */ X unsigned int fm : 1;`09/* field mark, used for traps/doors/stairs, object V is X`09`09`09 hidden if fm is FALSE */ X unsigned int pl : 1;`09/* permanent light, used for walls and lighted room Vs */ X unsigned int tl : 1;`09/* temporary light, used for player's lamp light,et Vc.*/ X#else X#ifndef __TURBOC__ X /* this is not legal ANSI C, this is a MSC extension, which will use 1 byt Ve X for the bitfields whereas MSC uses 2 bytes for the bitfields above */ X /* this is also a MWC extension on the Atari ST */ X unsigned char lr : 1; X unsigned char fm : 1; X unsigned char pl : 1; X unsigned char tl : 1; X#else X unsigned lr : 1; X unsigned fm : 1; X unsigned pl : 1; X unsigned tl : 1; X#endif X#endif X`7D cave_type; X Xtypedef struct owner_type X`7B X char *owner_name; X int16 max_cost; X int8u max_inflate; X int8u min_inflate; X int8u haggle_per; X int8u owner_race; X int8u insult_max; X`7D owner_type; X Xtypedef struct inven_record X`7B X int32 scost; X inven_type sitem; X`7D inven_record; X Xtypedef struct store_type X`7B X int32 store_open; X int16 insult_cur; X int8u owner; X int8u store_ctr; X int16u good_buy; X int16u bad_buy; X inven_record store_inven`5BSTORE_INVEN_MAX`5D; X`7D store_type; X X/* 64 bytes for this structure */ Xtypedef struct high_scores X`7B X int32 points; X int32 birth_date; X int16 uid; X int16 mhp; X int16 chp; X int8u dun_level; X int8u lev; X int8u max_dlv; X int8u sex; X int8u race; X int8u class; X char name`5BPLAYER_NAME_SIZE`5D; X char died_from`5B25`5D; X`7D high_scores; $ GOTO PART76