|
|
/* $Id$ */
|
|
|
|
|
|
/** @file company_manager_face.h Functionality related to the company manager's face */
|
|
|
|
|
|
#ifndef COMPANY_MANAGER_FACE_H
|
|
|
#define COMPANY_MANAGER_FACE_H
|
|
|
|
|
|
#include "core/random_func.hpp"
|
|
|
#include "core/bitmath_func.hpp"
|
|
|
#include "table/sprites.h"
|
|
|
#include "company_type.h"
|
|
|
|
|
|
/** The gender/race combinations that we have faces for */
|
|
|
enum GenderEthnicity {
|
|
|
GENDER_FEMALE = 0, ///< This bit set means a female, otherwise male
|
|
|
ETHNICITY_BLACK = 1, ///< This bit set means black, otherwise white
|
|
|
|
|
|
GE_WM = 0, ///< A male of Caucasian origin (white)
|
|
|
GE_WF = 1 << GENDER_FEMALE, ///< A female of Caucasian origin (white)
|
|
|
GE_BM = 1 << ETHNICITY_BLACK, ///< A male of African origin (black)
|
|
|
GE_BF = 1 << ETHNICITY_BLACK | 1 << GENDER_FEMALE, ///< A female of African origin (black)
|
|
|
GE_END,
|
|
|
};
|
|
|
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity); ///< See GenderRace as a bitset
|
|
|
|
|
|
/** Bitgroups of the CompanyManagerFace variable */
|
|
|
enum CompanyManagerFaceVariable {
|
|
|
CMFV_GENDER,
|
|
|
CMFV_ETHNICITY,
|
|
|
CMFV_GEN_ETHN,
|
|
|
CMFV_HAS_MOUSTACHE,
|
|
|
CMFV_HAS_TIE_EARRING,
|
|
|
CMFV_HAS_GLASSES,
|
|
|
CMFV_EYE_COLOUR,
|
|
|
CMFV_CHEEKS,
|
|
@@ -207,28 +209,27 @@ static inline void RandomCompanyManagerF
|
|
|
} else {
|
|
|
SetCompanyManagerFaceBits(cmf, CMFV_GENDER, ge, HasBit(ge, GENDER_FEMALE));
|
|
|
}
|
|
|
|
|
|
/* scales all company manager's face bits to the correct scope */
|
|
|
ScaleAllCompanyManagerFaceBits(cmf);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Gets the sprite to draw for the given company manager's face variable
|
|
|
* @param cmf the face to extract the data from
|
|
|
* @param cmfv the face variable to get the sprite of
|
|
|
* @param ge the gender and ethnicity of the face
|
|
|
* @pre _cmf_info[cmfv].valid_values[ge] != 0
|
|
|
* @return sprite to draw
|
|
|
*/
|
|
|
static inline SpriteID GetCompanyManagerFaceSprite(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge)
|
|
|
{
|
|
|
assert(_cmf_info[cmfv].valid_values[ge] != 0);
|
|
|
|
|
|
return _cmf_info[cmfv].first_sprite[ge] + GB(cmf, _cmf_info[cmfv].offset, _cmf_info[cmfv].length);
|
|
|
}
|
|
|
|
|
|
void DrawCompanyManagerFace(CompanyManagerFace face, int color, int x, int y);
|
|
|
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32 face);
|
|
|
bool IsValidCompanyManagerFace(CompanyManagerFace cmf);
|
|
|
|
|
|
#endif /* COMPANY_MANAGER_FACE_H */
|