61 return mColor[nComponent];
70 void SetColor(
int nComponent,
unsigned char nValue) {
71 mColor[nComponent] = nValue;
76 unsigned char mColor[3];
120 static void GetPartTypes(
int nPart, std::vector<const char *> *pTypes);
403 unsigned char mVersion;
405 unsigned char mEmblem;
409 const char *mBaseAnim;
411 const char *mPoseAnim;
429 void AcquirePlayer();
442 int CountDifferences(
Avatar *pAvatar)
const;
450 static float sLastTime;
static void GetPartTypes(int nPart, std::vector< const char * > *pTypes)
List the choices of a part.
static unsigned char ColorToByte(float fComponent)
Convert a colour component to a byte.
bool IsIncomplete() const
Report whether a part that every avatar needs has no choice.
static DataArray * GetParts()
Prepare the avatars and find the parts array.
Definition avatarpartset.h:86
const char * PartName(int nPart) const
Report the name of the choice of a part.
void Clear()
Remove every part but the instrument and the emblem, grey the colours, and return the avatar player.
~AvatarPartSet()
Return the avatar player and destroy the set.
static float ByteToColor(unsigned char nByte)
Convert a byte to a colour component.
AvatarPartSet(const AvatarPartSet &other)=default
Copy every member of another set, the avatar player included.
void ClearAnims()
Stop the animations of the avatar player and forget mBaseAnim and mPoseAnim.
Color PartColor(int nPart) const
Report the colour of a part.
void CatchGem(int nLane, int nCatch)
Pass a gem catch to the avatar player, when a player draws the set.
void Save(BinStream &stream) const
Write the choices and the colours to the packets of a session.
static int FindPartType(int nPart, const char *pszType)
Find a choice of a part.
void SetColor(int nPart, const Color *pColor)
Colour a part, and the part of the avatar player that draws it.
static int FindEmblem(const char *pszEmblem)
Find an emblem.
const char * EmblemName() const
Report the name of the emblem.
void ReleasePlayer()
Return the avatar player that draws the set, if any.
void SetEmblem(const char *pszEmblem)
Choose the emblem of the torso.
bool UpdatePlayer()
Apply the pending parts to the avatar player once their files have loaded.
void Load(DataArray *pData)
Read the choices and the colours from a description such as a prefab.
static void Terminate()
Delete the avatars.
void Load(BinStream &stream)
Read the choices and the colours Save() wrote.
void Render(const Rect *pScreenRect)
Apply the parts to the avatar and render it into the avatar texture.
bool IsWinAnim() const
Report whether the animation the avatar player plays is a win animation.
Part
The parts of an avatar, the indices of mParts and the keys of the parts array.
Definition avatarpartset.h:26
@ kPartTorso
Definition avatarpartset.h:30
@ kPartHead
Definition avatarpartset.h:29
@ kNumParts
Definition avatarpartset.h:35
@ kPartHeadGear
Definition avatarpartset.h:32
@ kPartLowerBody
Definition avatarpartset.h:31
@ kPartRightArm
Definition avatarpartset.h:28
@ kPartInstrument
Definition avatarpartset.h:34
@ kPartLeftArm
Definition avatarpartset.h:27
@ kPartFaceGear
Definition avatarpartset.h:33
void SetPose(const char *pszPose)
Show a pose on the avatar player, when there is one, and record it in mPoseAnim.
static void Poll(float fTime)
Advance the avatars to a time once the time changes, and take each avatar back from a set that has no...
void SetBaseAnim(const char *pszAnim, int nFlags)
Choose the animation the avatar player plays, and start it at once when a player draws the set.
void SetPart(int nPart, const char *pszType)
Choose a part.
AvatarPartSet & operator=(const AvatarPartSet &other)
Copy the choices and the colours of another set, and return the avatar player.
AvatarPartSet()
Construct the set from the default_settings of the avatar entry of the "db" section.
static void GetEmblemTypes(std::vector< const char * > *pTypes)
List the emblems.
One of the avatars the game can draw at a time, lent to the AvatarPartSet that shows.
Definition avatar.h:24
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Reference-counted array of script data nodes.
Definition dataarray.h:20
The choice and the colour of one part.
Definition avatarpartset.h:39
unsigned char GetType() const
Definition avatarpartset.h:41
unsigned char GetColor(int nComponent) const
Report one byte of the colour.
Definition avatarpartset.h:60
void SetType(unsigned char nType)
Set the index of the choice.
Definition avatarpartset.h:50
void SetColor(int nComponent, unsigned char nValue)
Set one byte of the colour.
Definition avatarpartset.h:70
Linear colour with four float components.
Definition color.h:12
Axis-aligned rectangle given by a corner and a size.
Definition rect.h:11