author | KUDr |
Fri, 20 Apr 2007 19:43:06 +0000 | |
changeset 6513 | 454347ca3dfb |
parent 6345 | d04400b59b30 |
child 7734 | 627817106768 |
permissions | -rw-r--r-- |
6190
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
2 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
3 |
/** @file player_face.h Functionality related to the player's face */ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
4 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
5 |
#ifndef PLAYER_FACE_H |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
6 |
#define PLAYER_FACE_H |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
7 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
8 |
/** The gender/race combinations that we have faces for */ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
9 |
enum GenderEthnicity { |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
10 |
GENDER_FEMALE = 0, ///< This bit set means a female, otherwise male |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
11 |
ETHNICITY_BLACK = 1, ///< This bit set means black, otherwise white |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
12 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
13 |
GE_WM = 0, ///< A male of Caucasian origin (white) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
14 |
GE_WF = 1 << GENDER_FEMALE, ///< A female of Caucasian origin (white) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
15 |
GE_BM = 1 << ETHNICITY_BLACK, ///< A male of African origin (black) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
16 |
GE_BF = 1 << ETHNICITY_BLACK | 1 << GENDER_FEMALE, ///< A female of African origin (black) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
17 |
GE_END, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
18 |
}; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
19 |
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity); ///< See GenderRace as a bitset |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
20 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
21 |
/** Bitgroups of the PlayerFace variable */ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
22 |
enum PlayerFaceVariable { |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
23 |
PFV_GENDER, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
24 |
PFV_ETHNICITY, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
25 |
PFV_GEN_ETHN, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
26 |
PFV_HAS_MOUSTACHE, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
27 |
PFV_HAS_TIE_EARRING, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
28 |
PFV_HAS_GLASSES, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
29 |
PFV_EYE_COLOUR, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
30 |
PFV_CHEEKS, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
31 |
PFV_CHIN, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
32 |
PFV_EYEBROWS, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
33 |
PFV_MOUSTACHE, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
34 |
PFV_LIPS, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
35 |
PFV_NOSE, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
36 |
PFV_HAIR, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
37 |
PFV_JACKET, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
38 |
PFV_COLLAR, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
39 |
PFV_TIE_EARRING, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
40 |
PFV_GLASSES, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
41 |
PFV_END |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
42 |
}; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
43 |
DECLARE_POSTFIX_INCREMENT(PlayerFaceVariable); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
44 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
45 |
/** Information about the valid values of PlayerFace bitgroups as well as the sprites to draw */ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
46 |
struct PlayerFaceBitsInfo { |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
47 |
byte offset; ///< Offset in bits into the PlayerFace |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
48 |
byte length; ///< Number of bits used in the PlayerFace |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
49 |
byte valid_values[GE_END]; ///< The number of valid values per gender/ethnicity |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
50 |
SpriteID first_sprite[GE_END]; ///< The first sprite per gender/ethnicity |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
51 |
}; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
52 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
53 |
/** Lookup table for indices into the PlayerFace, valid ranges and sprites */ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
54 |
static const PlayerFaceBitsInfo _pf_info[] = { |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
55 |
/* Index off len WM WF BM BF WM WF BM BF */ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
56 |
/* PFV_GENDER */ { 0, 1, { 2, 2, 2, 2 }, { 0, 0, 0, 0 } }, ///< 0 = male, 1 = female |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
57 |
/* PFV_ETHNICITY */ { 1, 2, { 2, 2, 2, 2 }, { 0, 0, 0, 0 } }, ///< 0 = (Western-)Caucasian, 1 = African(-American)/Black |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
58 |
/* PFV_GEN_ETHN */ { 0, 3, { 4, 4, 4, 4 }, { 0, 0, 0, 0 } }, ///< Shortcut to get/set gender _and_ ethnicity |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
59 |
/* PFV_HAS_MOUSTACHE */ { 3, 1, { 2, 0, 2, 0 }, { 0, 0, 0, 0 } }, ///< Females do not have a moustache |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
60 |
/* PFV_HAS_TIE_EARRING */ { 3, 1, { 0, 2, 0, 2 }, { 0, 0, 0, 0 } }, ///< Draw the earring for females or not. For males the tie is always drawn. |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
61 |
/* PFV_HAS_GLASSES */ { 4, 1, { 2, 2, 2, 2 }, { 0, 0, 0, 0 } }, ///< Whether to draw glasses or not |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
62 |
/* PFV_EYE_COLOUR */ { 5, 2, { 3, 3, 3, 3 }, { 0, 0, 0, 0 } }, ///< Palette modification |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
63 |
/* PFV_CHEEKS */ { 0, 0, { 1, 1, 1, 1 }, { 0x325, 0x326, 0x390, 0x3B0 } }, ///< Cheeks are only indexed by their gender/ethnicity |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
64 |
/* PFV_CHIN */ { 7, 2, { 4, 1, 2, 2 }, { 0x327, 0x327, 0x391, 0x3B1 } }, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
65 |
/* PFV_EYEBROWS */ { 9, 4, { 12, 16, 11, 16 }, { 0x32B, 0x337, 0x39A, 0x3B8 } }, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
66 |
/* PFV_MOUSTACHE */ { 13, 2, { 3, 0, 3, 0 }, { 0x367, 0, 0x397, 0 } }, ///< Depends on PFV_HAS_MOUSTACHE |
6345
d04400b59b30
(svn r9376) -Fix (r8969): off-by-one error for the amount of mouth pieces for men.
rubidium
parents:
6190
diff
changeset
|
67 |
/* PFV_LIPS */ { 13, 4, { 12, 10, 9, 9 }, { 0x35B, 0x351, 0x3A5, 0x3C8 } }, ///< Depends on !PFV_HAS_MOUSTACHE |
6190
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
68 |
/* PFV_NOSE */ { 17, 3, { 8, 4, 4, 5 }, { 0x349, 0x34C, 0x393, 0x3B3 } }, ///< Depends on !PFV_HAS_MOUSTACHE |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
69 |
/* PFV_HAIR */ { 20, 4, { 9, 5, 5, 4 }, { 0x382, 0x38B, 0x3D4, 0x3D9 } }, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
70 |
/* PFV_JACKET */ { 24, 2, { 3, 3, 3, 3 }, { 0x36B, 0x378, 0x36B, 0x378 } }, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
71 |
/* PFV_COLLAR */ { 26, 2, { 4, 4, 4, 4 }, { 0x36E, 0x37B, 0x36E, 0x37B } }, |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
72 |
/* PFV_TIE_EARRING */ { 28, 3, { 6, 3, 6, 3 }, { 0x372, 0x37F, 0x372, 0x3D1 } }, ///< Depends on PFV_HAS_TIE_EARRING |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
73 |
/* PFV_GLASSES */ { 31, 1, { 2, 2, 2, 2 }, { 0x347, 0x347, 0x3AE, 0x3AE } } ///< Depends on PFV_HAS_GLASSES |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
74 |
}; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
75 |
assert_compile(lengthof(_pf_info) == PFV_END); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
76 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
77 |
/** |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
78 |
* Gets the player's face bits for the given player face variable |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
79 |
* @param pf the face to extract the bits from |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
80 |
* @param pfv the face variable to get the data of |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
81 |
* @param ge the gender and ethnicity of the face |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
82 |
* @pre _pf_info[pfv].valid_values[ge] != 0 |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
83 |
* @return the requested bits |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
84 |
*/ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
85 |
static inline uint GetPlayerFaceBits(PlayerFace pf, PlayerFaceVariable pfv, GenderEthnicity ge) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
86 |
{ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
87 |
assert(_pf_info[pfv].valid_values[ge] != 0); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
88 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
89 |
return GB(pf, _pf_info[pfv].offset, _pf_info[pfv].length); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
90 |
} |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
91 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
92 |
/** |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
93 |
* Sets the player's face bits for the given player face variable |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
94 |
* @param pf the face to write the bits to |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
95 |
* @param pfv the face variable to write the data of |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
96 |
* @param ge the gender and ethnicity of the face |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
97 |
* @param val the new value |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
98 |
* @pre val < _pf_info[pfv].valid_values[ge] |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
99 |
*/ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
100 |
static inline void SetPlayerFaceBits(PlayerFace &pf, PlayerFaceVariable pfv, GenderEthnicity ge, uint val) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
101 |
{ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
102 |
assert(val < _pf_info[pfv].valid_values[ge]); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
103 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
104 |
SB(pf, _pf_info[pfv].offset, _pf_info[pfv].length, val); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
105 |
} |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
106 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
107 |
/** |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
108 |
* Checks whether the player bits have a valid range |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
109 |
* @param pf the face to extract the bits from |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
110 |
* @param pfv the face variable to get the data of |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
111 |
* @param ge the gender and ethnicity of the face |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
112 |
* @return true if and only if the bits are valid |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
113 |
*/ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
114 |
static inline bool ArePlayerFaceBitsValid(PlayerFace pf, PlayerFaceVariable pfv, GenderEthnicity ge) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
115 |
{ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
116 |
return GB(pf, _pf_info[pfv].offset, _pf_info[pfv].length) < _pf_info[pfv].valid_values[ge]; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
117 |
} |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
118 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
119 |
/** |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
120 |
* Scales a player face bits variable to the correct scope |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
121 |
* @param pfv the face variable to write the data of |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
122 |
* @param ge the gender and ethnicity of the face |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
123 |
* @param val the to value to scale |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
124 |
* @pre val < (1U << _pf_info[pfv].length), i.e. val has a value of 0..2^(bits used for this variable)-1 |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
125 |
* @return the scaled value |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
126 |
*/ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
127 |
static inline uint ScalePlayerFaceValue(PlayerFaceVariable pfv, GenderEthnicity ge, uint val) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
128 |
{ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
129 |
assert(val < (1U << _pf_info[pfv].length)); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
130 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
131 |
return (val * _pf_info[pfv].valid_values[ge]) >> _pf_info[pfv].length; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
132 |
} |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
133 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
134 |
/** |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
135 |
* Gets the sprite to draw for the given player face variable |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
136 |
* @param pf the face to extract the data from |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
137 |
* @param pfv the face variable to get the sprite of |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
138 |
* @param ge the gender and ethnicity of the face |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
139 |
* @pre _pf_info[pfv].valid_values[ge] != 0 |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
140 |
* @return sprite to draw |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
141 |
*/ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
142 |
static inline SpriteID GetPlayerFaceSprite(PlayerFace pf, PlayerFaceVariable pfv, GenderEthnicity ge) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
143 |
{ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
144 |
assert(_pf_info[pfv].valid_values[ge] != 0); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
145 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
146 |
return _pf_info[pfv].first_sprite[ge] + GB(pf, _pf_info[pfv].offset, _pf_info[pfv].length); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
147 |
} |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
148 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
149 |
void DrawPlayerFace(PlayerFace face, int color, int x, int y); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
150 |
PlayerFace ConvertFromOldPlayerFace(uint32 face); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
151 |
bool IsValidPlayerFace(PlayerFace pf); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
152 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
diff
changeset
|
153 |
#endif /* PLAYER_FACE_H */ |