|
wavelength 1.0.0
|
Parts and colours of a player's avatar, the Freq the Freq maker edits. More...
#include <avatarpartset.h>
Classes | |
| struct | PartSetting |
| The choice and the colour of one part. More... | |
Public Types | |
| enum | Part { kPartLeftArm = 0 , kPartRightArm = 1 , kPartHead = 2 , kPartTorso = 3 , kPartLowerBody = 4 , kPartHeadGear = 5 , kPartFaceGear = 6 , kPartInstrument = 7 , kNumParts = 8 } |
| The parts of an avatar, the indices of mParts and the keys of the parts array. More... | |
Public Member Functions | |
| AvatarPartSet () | |
| Construct the set from the default_settings of the avatar entry of the "db" section. | |
| AvatarPartSet (const AvatarPartSet &other)=default | |
| Copy every member of another set, the avatar player included. | |
| ~AvatarPartSet () | |
| Return the avatar player and destroy the set. | |
| AvatarPartSet & | operator= (const AvatarPartSet &other) |
| Copy the choices and the colours of another set, and return the avatar player. | |
| void | Load (DataArray *pData) |
| Read the choices and the colours from a description such as a prefab. | |
| void | SetPart (int nPart, const char *pszType) |
| Choose a part. | |
| void | SetColor (int nPart, const Color *pColor) |
| Colour a part, and the part of the avatar player that draws it. | |
| void | SetEmblem (const char *pszEmblem) |
| Choose the emblem of the torso. | |
| bool | IsIncomplete () const |
| Report whether a part that every avatar needs has no choice. | |
| void | Clear () |
| Remove every part but the instrument and the emblem, grey the colours, and return the avatar player. | |
| void | ReleasePlayer () |
| Return the avatar player that draws the set, if any. | |
| void | Save (BinStream &stream) const |
| Write the choices and the colours to the packets of a session. | |
| void | Load (BinStream &stream) |
| Read the choices and the colours Save() wrote. | |
| bool | UpdatePlayer () |
| Apply the pending parts to the avatar player once their files have loaded. | |
| void | CatchGem (int nLane, int nCatch) |
| Pass a gem catch to the avatar player, when a player draws the set. | |
| 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 | SetPose (const char *pszPose) |
| Show a pose on the avatar player, when there is one, and record it in mPoseAnim. | |
| void | ClearAnims () |
| Stop the animations of the avatar player and forget mBaseAnim and mPoseAnim. | |
| bool | IsWinAnim () const |
| Report whether the animation the avatar player plays is a win animation. | |
| void | Render (const Rect *pScreenRect) |
| Apply the parts to the avatar and render it into the avatar texture. | |
| const char * | EmblemName () const |
| Report the name of the emblem. | |
| const char * | PartName (int nPart) const |
| Report the name of the choice of a part. | |
| Color | PartColor (int nPart) const |
| Report the colour of a part. | |
Static Public Member Functions | |
| static DataArray * | GetParts () |
| Prepare the avatars and find the parts array. | |
| static void | Init () |
| static void | Terminate () |
| Delete the avatars. | |
| 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 not drawn it for more than one frame. | |
| static void | GetPartTypes (int nPart, std::vector< const char * > *pTypes) |
| List the choices of a part. | |
| static void | GetEmblemTypes (std::vector< const char * > *pTypes) |
| List the emblems. | |
| static unsigned char | ColorToByte (float fComponent) |
| Convert a colour component to a byte. | |
| static float | ByteToColor (unsigned char nByte) |
| Convert a byte to a colour component. | |
| static int | FindPartType (int nPart, const char *pszType) |
| Find a choice of a part. | |
| static int | FindEmblem (const char *pszEmblem) |
| Find an emblem. | |
Parts and colours of a player's avatar, the Freq the Freq maker edits.
The class is not polymorphic and has no RTTI. The name is inferred. Each Campaign stores one at +0x74, and the object is 0x3c bytes. The parts come from the parts array of the avatar entry of the "db" section. Each part of that array has a types array that lists the choices, and the torso part also has an emblem array with another types array. The set records a choice as its index in the types array, less one, and a colour as three bytes.
While the set shows, it borrows an Avatar that draws it. Every change returns the avatar.
| enum AvatarPartSet::Part |
The parts of an avatar, the indices of mParts and the keys of the parts array.
| AvatarPartSet::AvatarPartSet | ( | ) |
Construct the set from the default_settings of the avatar entry of the "db" section.
|
default |
Copy every member of another set, the avatar player included.
| other | The set to copy. |
| AvatarPartSet::~AvatarPartSet | ( | ) |
Return the avatar player and destroy the set.
|
inlinestatic |
Prepare the avatars and find the parts array.
|
static |
|
static |
Delete the avatars.
|
static |
Advance the avatars to a time once the time changes, and take each avatar back from a set that has not drawn it for more than one frame.
The name is inferred.
| fTime | The time in milliseconds. |
|
static |
List the choices of a part.
| nPart | One of Part. |
| pTypes | Receives the symbols of the choices, in the order of the types array. |
|
static |
List the emblems.
| pTypes | Receives the symbols of the emblems, in the order of the types array. |
| AvatarPartSet & AvatarPartSet::operator= | ( | const AvatarPartSet & | other | ) |
Copy the choices and the colours of another set, and return the avatar player.
| other | The set to copy. |
| void AvatarPartSet::Load | ( | DataArray * | pData | ) |
Read the choices and the colours from a description such as a prefab.
Each entry after the first is an array that starts with the part and has a type, an optional color (grey when absent), and for the torso an emblem.
| pData | The description. |
| void AvatarPartSet::SetPart | ( | int | nPart, |
| const char * | pszType ) |
Choose a part.
Choosing the left arm chooses the same right arm.
| nPart | One of Part. |
| pszType | The name of the choice. |
| void AvatarPartSet::SetColor | ( | int | nPart, |
| const Color * | pColor ) |
Colour a part, and the part of the avatar player that draws it.
Colouring the left arm colours the right arm.
| nPart | One of Part. |
| pColor | The colour. The alpha is not stored. |
| void AvatarPartSet::SetEmblem | ( | const char * | pszEmblem | ) |
Choose the emblem of the torso.
| pszEmblem | The name of the emblem. |
| bool AvatarPartSet::IsIncomplete | ( | ) | const |
Report whether a part that every avatar needs has no choice.
The gear and the instrument are not checked.
| void AvatarPartSet::Clear | ( | ) |
Remove every part but the instrument and the emblem, grey the colours, and return the avatar player.
|
static |
Convert a colour component to a byte.
| fComponent | The component, from 0 to 1. |
|
static |
Convert a byte to a colour component.
| nByte | The byte. |
|
static |
Find a choice of a part.
| nPart | One of Part. |
| pszType | The choice, a symbol. |
|
static |
Find an emblem.
| pszEmblem | The emblem, a symbol. |
| void AvatarPartSet::ReleasePlayer | ( | ) |
Return the avatar player that draws the set, if any.
| void AvatarPartSet::Save | ( | BinStream & | stream | ) | const |
Write the choices and the colours to the packets of a session.
The name is inferred.
| stream | The stream. |
| void AvatarPartSet::Load | ( | BinStream & | stream | ) |
Read the choices and the colours Save() wrote.
The name is inferred.
| stream | The stream. |
| bool AvatarPartSet::UpdatePlayer | ( | ) |
Apply the pending parts to the avatar player once their files have loaded.
The name is inferred.
| void AvatarPartSet::CatchGem | ( | int | nLane, |
| int | nCatch ) |
Pass a gem catch to the avatar player, when a player draws the set.
The name is inferred.
| nLane | The lane of the gem. |
| nCatch | The flag the trigger file gave. |
| void AvatarPartSet::SetBaseAnim | ( | const char * | pszAnim, |
| int | nFlags ) |
Choose the animation the avatar player plays, and start it at once when a player draws the set.
The name is inferred.
| pszAnim | The animation. |
| nFlags | Stored in mBaseAnimFlags. |
| void AvatarPartSet::SetPose | ( | const char * | pszPose | ) |
Show a pose on the avatar player, when there is one, and record it in mPoseAnim.
The name is inferred.
| pszPose | The pose. |
| void AvatarPartSet::ClearAnims | ( | ) |
Stop the animations of the avatar player and forget mBaseAnim and mPoseAnim.
The name is inferred.
| bool AvatarPartSet::IsWinAnim | ( | ) | const |
Report whether the animation the avatar player plays is a win animation.
The name is inferred.
| void AvatarPartSet::Render | ( | const Rect * | pScreenRect | ) |
Apply the parts to the avatar and render it into the avatar texture.
| pScreenRect | The part of the screen the avatar fills, or null for the projector. |
| const char * AvatarPartSet::EmblemName | ( | ) | const |
Report the name of the emblem.
| const char * AvatarPartSet::PartName | ( | int | nPart | ) | const |
Report the name of the choice of a part.
| nPart | One of Part. |
| Color AvatarPartSet::PartColor | ( | int | nPart | ) | const |
Report the colour of a part.
| nPart | One of Part. |