Legend:
- Unmodified
- Added
- Removed
-
trunk/src/externs.h
r1376 r1405 322 322 /* files.c */ 323 323 extern void html_screenshot(cptr name, int mode); 324 extern void player_flags(u32b *f1, u32b *f2, u32b *f3);324 extern void player_flags(u32b f[OBJ_FLAG_N]); 325 325 extern void display_player(int mode); 326 326 extern void display_player_stat_info(void); -
trunk/src/files.c
r1346 r1405 105 105 * Obtain the "flags" for the player as if he was an item 106 106 */ 107 void player_flags(u32b *f1, u32b *f2, u32b *f3) 108 { 109 /* Clear */ 110 (*f1) = (*f2) = (*f3) = 0L; 111 107 void player_flags(u32b f[OBJ_FLAG_N]) 108 { 112 109 /* Add racial flags */ 113 (*f1) |= rp_ptr->flags1; 114 (*f2) |= rp_ptr->flags2; 115 (*f3) |= rp_ptr->flags3; 110 memcpy(f, rp_ptr->flags, sizeof(rp_ptr->flags)); 116 111 117 112 /* Some classes become immune to fear at a certain plevel */ 118 if (cp_ptr->flags & CF_BRAVERY_30) 119 { 120 if (p_ptr->lev >= 30) (*f2) |= (TR1_RES_FEAR); 121 } 113 if ((cp_ptr->flags & CF_BRAVERY_30) && p_ptr->lev >= 30) 114 f[1] |= TR1_RES_FEAR; 122 115 } 123 116 … … 245 238 else 246 239 { 247 player_flags( &f[0], &f[1], &f[2]);240 player_flags(f); 248 241 249 242 /* If the race has innate infravision, force the corresponding flag … … 251 244 function will think the infravision is caused by equipment. */ 252 245 if (rp_ptr->infra > 0) 253 {254 246 f[0] |= (TR0_INFRA); 255 }256 247 } 257 248 … … 470 461 471 462 /* Player flags */ 472 player_flags(&f [0], &f[1], &f[2]);463 player_flags(&f); 473 464 474 465 /* Check stats */ -
trunk/src/init1.c
r1374 r1405 1390 1390 * Grab one flag in an object_kind from a textual string 1391 1391 */ 1392 static errr grab_one_kind_flag(object_kind *k_ptr, cptr what) 1393 { 1394 if (grab_one_flag(&k_ptr->flags[0], k_info_flags1, what) == 0) 1395 return (0); 1396 1397 if (grab_one_flag(&k_ptr->flags[1], k_info_flags2, what) == 0) 1398 return (0); 1399 1400 if (grab_one_flag(&k_ptr->flags[2], k_info_flags3, what) == 0) 1392 static errr grab_one_object_flag(u32b flags[OBJ_FLAG_N], cptr what) 1393 { 1394 if (grab_one_flag(&flags[0], k_info_flags1, what) == 0 && 1395 grab_one_flag(&flags[1], k_info_flags2, what) == 0 && 1396 grab_one_flag(&flags[2], k_info_flags3, what) == 0) 1401 1397 return (0); 1402 1398 … … 1645 1641 1646 1642 /* Parse this entry */ 1647 if (0 != grab_one_ kind_flag(k_ptr, s))1643 if (0 != grab_one_object_flag(k_ptr->flags, s)) 1648 1644 return (PARSE_ERROR_INVALID_FLAG); 1649 1645 … … 1687 1683 } 1688 1684 1689 1690 /*1691 * Grab one flag in an artifact_type from a textual string1692 */1693 static errr grab_one_artifact_flag(artifact_type *a_ptr, cptr what)1694 {1695 if (grab_one_flag(&a_ptr->flags[0], k_info_flags1, what) == 0)1696 return (0);1697 1698 if (grab_one_flag(&a_ptr->flags[1], k_info_flags2, what) == 0)1699 return (0);1700 1701 if (grab_one_flag(&a_ptr->flags[2], k_info_flags3, what) == 0)1702 return (0);1703 1704 /* Oops */1705 msg_format("Unknown artifact flag '%s'.", what);1706 1707 /* Error */1708 return (PARSE_ERROR_INVALID_FLAG);1709 }1710 1685 1711 1686 … … 1866 1841 1867 1842 /* Parse this entry */ 1868 if (0 != grab_one_ artifact_flag(a_ptr, s))1843 if (0 != grab_one_object_flag(a_ptr->flags, s)) 1869 1844 return (PARSE_ERROR_INVALID_FLAG); 1870 1845 … … 1920 1895 return (0); 1921 1896 } 1922 1923 1924 /*1925 * Grab one flag in a ego-item_type from a textual string1926 */1927 static bool grab_one_ego_item_flag(ego_item_type *e_ptr, cptr what)1928 {1929 if (grab_one_flag(&e_ptr->flags[0], k_info_flags1, what) == 0)1930 return (0);1931 1932 if (grab_one_flag(&e_ptr->flags[1], k_info_flags2, what) == 0)1933 return (0);1934 1935 if (grab_one_flag(&e_ptr->flags[2], k_info_flags3, what) == 0)1936 return (0);1937 1938 /* Oops */1939 msg_format("Unknown ego-item flag '%s'.", what);1940 1941 /* Error */1942 return (PARSE_ERROR_INVALID_FLAG);1943 }1944 1945 1897 1946 1898 … … 2098 2050 2099 2051 /* Parse this entry */ 2100 if (0 != grab_one_ ego_item_flag(e_ptr, s))2052 if (0 != grab_one_object_flag(e_ptr->flags, s)) 2101 2053 return (PARSE_ERROR_INVALID_FLAG); 2102 2054 … … 2445 2397 } 2446 2398 2447 2448 /*2449 * Grab one flag in a player_race from a textual string2450 */2451 static errr grab_one_racial_flag(player_race *pr_ptr, cptr what)2452 {2453 if (grab_one_flag(&pr_ptr->flags1, k_info_flags1, what) == 0)2454 return (0);2455 2456 if (grab_one_flag(&pr_ptr->flags2, k_info_flags2, what) == 0)2457 return (0);2458 2459 if (grab_one_flag(&pr_ptr->flags3, k_info_flags3, what) == 0)2460 return (0);2461 2462 /* Oops */2463 msg_format("Unknown player flag '%s'.", what);2464 2465 /* Error */2466 return (PARSE_ERROR_INVALID_FLAG);2467 }2468 2399 2469 2400 /* … … 2682 2613 2683 2614 /* Parse this entry */ 2684 if (0 != grab_one_ racial_flag(pr_ptr, s))2615 if (0 != grab_one_object_flag(pr_ptr->flags, s)) 2685 2616 return (PARSE_ERROR_INVALID_FLAG); 2686 2617 -
trunk/src/player/calcs.c
r1404 r1405 613 613 614 614 /* Extract the player flags */ 615 player_flags( &collect_f[0], &collect_f[1], &collect_f[2]);615 player_flags(collect_f); 616 616 617 617 -
trunk/src/player/types.h
r1370 r1405 245 245 } player_type; 246 246 247 248 249 250 /* 251 * Player sex info 252 */ 253 typedef struct 254 { 255 cptr title; /* Type of sex */ 256 cptr winner; /* Name of winner */ 257 } player_sex; 258 259 260 /* 261 * Player racial info 262 */ 263 typedef struct 264 { 265 u32b name; /* Name (offset) */ 266 u32b text; /* Text (offset) */ 267 268 s16b r_adj[A_MAX]; /* Racial stat bonuses */ 269 270 s16b r_skills[SKILL_MAX]; /* racial skills */ 271 272 byte r_mhp; /* Race hit-dice modifier */ 273 byte r_exp; /* Race experience factor */ 274 275 byte b_age; /* base age */ 276 byte m_age; /* mod age */ 277 278 byte m_b_ht; /* base height (males) */ 279 byte m_m_ht; /* mod height (males) */ 280 byte m_b_wt; /* base weight (males) */ 281 byte m_m_wt; /* mod weight (males) */ 282 283 byte f_b_ht; /* base height (females) */ 284 byte f_m_ht; /* mod height (females) */ 285 byte f_b_wt; /* base weight (females) */ 286 byte f_m_wt; /* mod weight (females) */ 287 288 byte infra; /* Infra-vision range */ 289 290 byte choice; /* Legal class choices */ 291 292 s16b hist; /* Starting history index */ 293 294 u32b flags[OBJ_FLAG_N]; /* Racial flags */ 295 } player_race; 296 297 298 /* 299 * Starting equipment entry 300 */ 301 typedef struct 302 { 303 byte tval; /* Item's tval */ 304 byte sval; /* Item's sval */ 305 byte min; /* Minimum starting amount */ 306 byte max; /* Maximum starting amount */ 307 } start_item; 308 309 310 /* 311 * A structure to hold class-dependent information on spells. 312 */ 313 typedef struct 314 { 315 byte slevel; /* Required level (to learn) */ 316 byte smana; /* Required mana (to cast) */ 317 byte sfail; /* Minimum chance of failure */ 318 byte sexp; /* Encoded experience bonus */ 319 } magic_type; 320 321 322 /* 323 * Information about the player's "magic" 324 * 325 * Note that a player with a "spell_book" of "zero" is illiterate. 326 */ 327 typedef struct 328 { 329 magic_type info[PY_MAX_SPELLS]; /* The available spells */ 330 } player_magic; 331 332 333 /* 334 * Player class info 335 */ 336 typedef struct 337 { 338 u32b name; /* Name (offset) */ 339 340 u32b title[10]; /* Titles - offset */ 341 342 s16b c_adj[A_MAX]; /* Class stat modifier */ 343 344 s16b c_skills[SKILL_MAX]; /* class skills */ 345 s16b x_skills[SKILL_MAX]; /* extra skills */ 346 347 s16b c_mhp; /* Class hit-dice adjustment */ 348 s16b c_exp; /* Class experience factor */ 349 350 u32b flags; /* Class Flags */ 351 352 u16b max_attacks; /* Maximum possible attacks */ 353 u16b min_weight; /* Minimum weapon weight for calculations */ 354 u16b att_multiply; /* Multiplier for attack calculations */ 355 356 byte spell_book; /* Tval of spell books (if any) */ 357 u16b spell_stat; /* Stat for spells (if any) */ 358 u16b spell_first; /* Level of first spell */ 359 u16b spell_weight; /* Weight that hurts spells */ 360 361 u32b sense_base; /* Base pseudo-id value */ 362 u16b sense_div; /* Pseudo-id divisor */ 363 364 start_item start_items[MAX_START_ITEMS];/**< The starting inventory */ 365 366 player_magic spells; /* Magic spells */ 367 } player_class; 368 369 370 /* 371 * Player background information 372 */ 373 typedef struct 374 { 375 u32b text; /* Text (offset) */ 376 377 byte roll; /* Frequency of this entry */ 378 byte chart; /* Chart index */ 379 byte next; /* Next chart index */ 380 byte bonus; /* Social Class Bonus + 50 */ 381 } hist_type; 382 383 384 385 /* 386 * Some more player information 387 * 388 * This information is retained across player lives 389 */ 390 typedef struct 391 { 392 char full_name[32]; /* Full name */ 393 char base_name[32]; /* Base name */ 394 395 bool opt[OPT_MAX]; /* Options */ 396 397 u32b window_flag[ANGBAND_TERM_MAX]; /* Window flags */ 398 399 byte hitpoint_warn; /* Hitpoint warning (0 to 9) */ 400 401 byte delay_factor; /* Delay factor (0 to 9) */ 402 } player_other; 403 404 405 247 406 #endif /* INCLUDED_PLAYER_TYPES_H */ -
trunk/src/spells2.c
r1353 r1405 431 431 432 432 /* And flags from the player */ 433 player_flags( &t[0], &t[1], &t[2]);433 player_flags(t); 434 434 435 435 /* Extract flags */ -
trunk/src/types.h
r1131 r1405 43 43 typedef struct owner_type owner_type; 44 44 typedef struct store_type store_type; 45 typedef struct magic_type magic_type;46 typedef struct player_magic player_magic;47 45 typedef struct spell_type spell_type; 48 typedef struct player_sex player_sex;49 typedef struct player_race player_race;50 typedef struct player_class player_class;51 typedef struct hist_type hist_type;52 typedef struct player_other player_other;53 typedef struct start_item start_item;54 46 typedef struct autoinscription autoinscription; 55 47 typedef struct history_info history_info; … … 175 167 176 168 177 178 /*179 * A structure to hold class-dependent information on spells.180 */181 struct magic_type182 {183 byte slevel; /* Required level (to learn) */184 byte smana; /* Required mana (to cast) */185 byte sfail; /* Minimum chance of failure */186 byte sexp; /* Encoded experience bonus */187 };188 189 190 /*191 * Information about the player's "magic"192 *193 * Note that a player with a "spell_book" of "zero" is illiterate.194 */195 struct player_magic196 {197 magic_type info[PY_MAX_SPELLS]; /* The available spells */198 };199 200 201 169 /* 202 170 * And here's the structure for the "fixed" spell information … … 213 181 214 182 byte spell_index; /* Index into player_magic array */ 215 };216 217 218 /*219 * Player sex info220 */221 struct player_sex222 {223 cptr title; /* Type of sex */224 225 cptr winner; /* Name of winner */226 };227 228 229 /*230 * Player racial info231 */232 struct player_race233 {234 u32b name; /* Name (offset) */235 u32b text; /* Text (offset) */236 237 s16b r_adj[A_MAX]; /* Racial stat bonuses */238 239 s16b r_skills[SKILL_MAX]; /* racial skills */240 241 byte r_mhp; /* Race hit-dice modifier */242 byte r_exp; /* Race experience factor */243 244 byte b_age; /* base age */245 byte m_age; /* mod age */246 247 byte m_b_ht; /* base height (males) */248 byte m_m_ht; /* mod height (males) */249 byte m_b_wt; /* base weight (males) */250 byte m_m_wt; /* mod weight (males) */251 252 byte f_b_ht; /* base height (females) */253 byte f_m_ht; /* mod height (females) */254 byte f_b_wt; /* base weight (females) */255 byte f_m_wt; /* mod weight (females) */256 257 byte infra; /* Infra-vision range */258 259 byte choice; /* Legal class choices */260 261 s16b hist; /* Starting history index */262 263 u32b flags1; /* Racial Flags, set 1 */264 u32b flags2; /* Racial Flags, set 2 */265 u32b flags3; /* Racial Flags, set 3 */266 };267 268 269 /*270 * Starting equipment entry271 */272 struct start_item273 {274 byte tval; /* Item's tval */275 byte sval; /* Item's sval */276 byte min; /* Minimum starting amount */277 byte max; /* Maximum starting amount */278 };279 280 281 /*282 * Player class info283 */284 struct player_class285 {286 u32b name; /* Name (offset) */287 288 u32b title[10]; /* Titles - offset */289 290 s16b c_adj[A_MAX]; /* Class stat modifier */291 292 s16b c_skills[SKILL_MAX]; /* class skills */293 s16b x_skills[SKILL_MAX]; /* extra skills */294 295 s16b c_mhp; /* Class hit-dice adjustment */296 s16b c_exp; /* Class experience factor */297 298 u32b flags; /* Class Flags */299 300 u16b max_attacks; /* Maximum possible attacks */301 u16b min_weight; /* Minimum weapon weight for calculations */302 u16b att_multiply; /* Multiplier for attack calculations */303 304 byte spell_book; /* Tval of spell books (if any) */305 u16b spell_stat; /* Stat for spells (if any) */306 u16b spell_first; /* Level of first spell */307 u16b spell_weight; /* Weight that hurts spells */308 309 u32b sense_base; /* Base pseudo-id value */310 u16b sense_div; /* Pseudo-id divisor */311 312 start_item start_items[MAX_START_ITEMS];/**< The starting inventory */313 314 player_magic spells; /* Magic spells */315 };316 317 318 /*319 * Player background information320 */321 struct hist_type322 {323 u32b text; /* Text (offset) */324 325 byte roll; /* Frequency of this entry */326 byte chart; /* Chart index */327 byte next; /* Next chart index */328 byte bonus; /* Social Class Bonus + 50 */329 };330 331 332 333 /*334 * Some more player information335 *336 * This information is retained across player lives337 */338 struct player_other339 {340 char full_name[32]; /* Full name */341 char base_name[32]; /* Base name */342 343 bool opt[OPT_MAX]; /* Options */344 345 u32b window_flag[ANGBAND_TERM_MAX]; /* Window flags */346 347 byte hitpoint_warn; /* Hitpoint warning (0 to 9) */348 349 byte delay_factor; /* Delay factor (0 to 9) */350 183 }; 351 184
