wavelength 1.0.0
Loading...
Searching...
No Matches
AvatarPartSet Class Reference

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.

Detailed Description

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.

Member Enumeration Documentation

◆ Part

The parts of an avatar, the indices of mParts and the keys of the parts array.

Enumerator
kPartLeftArm 

The left arm. Setting it also sets the right arm.

kPartRightArm 

The right arm.

kPartHead 

The head.

kPartTorso 

The torso, with the emblem.

kPartLowerBody 

The legs.

kPartHeadGear 

The head gear. It may be absent.

kPartFaceGear 

The face gear. It may be absent.

kPartInstrument 

The instrument. The Freq maker does not edit it.

kNumParts 

The number of parts.

Constructor & Destructor Documentation

◆ AvatarPartSet() [1/2]

AvatarPartSet::AvatarPartSet ( )

Construct the set from the default_settings of the avatar entry of the "db" section.

Ghidra address:
NTSC-U/C: 0x002719c0
Ghidra address:
PAL: 0x0027b570

◆ AvatarPartSet() [2/2]

AvatarPartSet::AvatarPartSet ( const AvatarPartSet & other)
default

Copy every member of another set, the avatar player included.

Parameters
otherThe set to copy.

◆ ~AvatarPartSet()

AvatarPartSet::~AvatarPartSet ( )

Return the avatar player and destroy the set.

Ghidra address:
NTSC-U/C: 0x00271a58
Ghidra address:
PAL: 0x0027b608

Member Function Documentation

◆ GetParts()

DataArray * AvatarPartSet::GetParts ( )
inlinestatic

Prepare the avatars and find the parts array.

Ghidra address:
NTSC-U/C: 0x002718a0
Ghidra address:
PAL: 0x0027b450
Returns
The parts array of the avatar entry, as Init() finds it. Borrowed.

◆ Init()

void AvatarPartSet::Init ( )
static

◆ Terminate()

void AvatarPartSet::Terminate ( )
static

Delete the avatars.

Ghidra address:
NTSC-U/C: 0x00271908
Ghidra address:
PAL: 0x0027b4b8

◆ Poll()

void AvatarPartSet::Poll ( float fTime)
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.

Parameters
fTimeThe time in milliseconds.
Ghidra address:
NTSC-U/C: 0x00271928
Ghidra address:
PAL: 0x0027b4d8

◆ GetPartTypes()

void AvatarPartSet::GetPartTypes ( int nPart,
std::vector< const char * > * pTypes )
static

List the choices of a part.

Parameters
nPartOne of Part.
pTypesReceives the symbols of the choices, in the order of the types array.
Ghidra address:
NTSC-U/C: 0x00271690
Ghidra address:
PAL: 0x0027b240

◆ GetEmblemTypes()

void AvatarPartSet::GetEmblemTypes ( std::vector< const char * > * pTypes)
static

List the emblems.

Parameters
pTypesReceives the symbols of the emblems, in the order of the types array.
Ghidra address:
NTSC-U/C: 0x00271790
Ghidra address:
PAL: 0x0027b340

◆ operator=()

AvatarPartSet & AvatarPartSet::operator= ( const AvatarPartSet & other)

Copy the choices and the colours of another set, and return the avatar player.

Parameters
otherThe set to copy.
Returns
The set.
Ghidra address:
NTSC-U/C: 0x00271aa0
Ghidra address:
PAL: 0x0027b650

◆ Load() [1/2]

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.

Parameters
pDataThe description.
Ghidra address:
NTSC-U/C: 0x00271b48
Ghidra address:
PAL: 0x0027b6f8

◆ SetPart()

void AvatarPartSet::SetPart ( int nPart,
const char * pszType )

Choose a part.

Choosing the left arm chooses the same right arm.

Parameters
nPartOne of Part.
pszTypeThe name of the choice.
Ghidra address:
NTSC-U/C: 0x00271cd8
Ghidra address:
PAL: 0x0027b888

◆ SetColor()

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.

Parameters
nPartOne of Part.
pColorThe colour. The alpha is not stored.
Ghidra address:
NTSC-U/C: 0x00271d50
Ghidra address:
PAL: 0x0027b900

◆ SetEmblem()

void AvatarPartSet::SetEmblem ( const char * pszEmblem)

Choose the emblem of the torso.

Parameters
pszEmblemThe name of the emblem.
Ghidra address:
NTSC-U/C: 0x00271e20
Ghidra address:
PAL: 0x0027b9d0

◆ IsIncomplete()

bool AvatarPartSet::IsIncomplete ( ) const

Report whether a part that every avatar needs has no choice.

The gear and the instrument are not checked.

Returns
True when an arm, the head, the torso, or the legs are missing.
Ghidra address:
NTSC-U/C: 0x00271e60
Ghidra address:
PAL: 0x0027ba10

◆ Clear()

void AvatarPartSet::Clear ( )

Remove every part but the instrument and the emblem, grey the colours, and return the avatar player.

Ghidra address:
NTSC-U/C: 0x00271ea0
Ghidra address:
PAL: 0x0027ba50

◆ ColorToByte()

unsigned char AvatarPartSet::ColorToByte ( float fComponent)
static

Convert a colour component to a byte.

Parameters
fComponentThe component, from 0 to 1.
Returns
The byte.
Ghidra address:
NTSC-U/C: 0x00271f00
Ghidra address:
PAL: 0x0027bab0

◆ ByteToColor()

float AvatarPartSet::ByteToColor ( unsigned char nByte)
static

Convert a byte to a colour component.

Parameters
nByteThe byte.
Returns
The component, from 0 to 1.
Ghidra address:
NTSC-U/C: 0x00271f20
Ghidra address:
PAL: 0x0027bad0

◆ FindPartType()

int AvatarPartSet::FindPartType ( int nPart,
const char * pszType )
static

Find a choice of a part.

Parameters
nPartOne of Part.
pszTypeThe choice, a symbol.
Returns
The index of the choice in the types array less one, or -1 with a warning.
Ghidra address:
NTSC-U/C: 0x00271f60
Ghidra address:
PAL: 0x0027bb10

◆ FindEmblem()

int AvatarPartSet::FindEmblem ( const char * pszEmblem)
static

Find an emblem.

Parameters
pszEmblemThe emblem, a symbol.
Returns
The index of the emblem in its types array less one, or -1 with a warning.
Ghidra address:
NTSC-U/C: 0x00272020
Ghidra address:
PAL: 0x0027bbd0

◆ ReleasePlayer()

void AvatarPartSet::ReleasePlayer ( )

Return the avatar player that draws the set, if any.

Ghidra address:
NTSC-U/C: 0x002721c8
Ghidra address:
PAL: 0x0027bd78

◆ Save()

void AvatarPartSet::Save ( BinStream & stream) const

Write the choices and the colours to the packets of a session.

The name is inferred.

Parameters
streamThe stream.
Ghidra address:
NTSC-U/C: 0x00272808
Ghidra address:
PAL: 0x0027c3b8

◆ Load() [2/2]

void AvatarPartSet::Load ( BinStream & stream)

Read the choices and the colours Save() wrote.

The name is inferred.

Parameters
streamThe stream.
Ghidra address:
NTSC-U/C: 0x00272938
Ghidra address:
PAL: 0x0027c4a0

◆ UpdatePlayer()

bool AvatarPartSet::UpdatePlayer ( )

Apply the pending parts to the avatar player once their files have loaded.

The name is inferred.

Returns
Whether no part is left pending.
Ghidra address:
NTSC-U/C: 0x002723a0
Ghidra address:
PAL: 0x0027bf50

◆ CatchGem()

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.

Parameters
nLaneThe lane of the gem.
nCatchThe flag the trigger file gave.
Ghidra address:
NTSC-U/C: 0x00272638
Ghidra address:
PAL: 0x0027c1e8

◆ SetBaseAnim()

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.

Parameters
pszAnimThe animation.
nFlagsStored in mBaseAnimFlags.
Ghidra address:
NTSC-U/C: 0x002725e0
Ghidra address:
PAL: 0x0027c190

◆ SetPose()

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.

Parameters
pszPoseThe pose.
Ghidra address:
NTSC-U/C: 0x00272598
Ghidra address:
PAL: 0x0027c148

◆ ClearAnims()

void AvatarPartSet::ClearAnims ( )

Stop the animations of the avatar player and forget mBaseAnim and mPoseAnim.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00272660
Ghidra address:
PAL: 0x0027c210

◆ IsWinAnim()

bool AvatarPartSet::IsWinAnim ( ) const

Report whether the animation the avatar player plays is a win animation.

The name is inferred.

Returns
Whether mBaseAnim starts with win.
Ghidra address:
NTSC-U/C: 0x00272b10
Ghidra address:
PAL: 0x0027c630

◆ Render()

void AvatarPartSet::Render ( const Rect * pScreenRect)

Apply the parts to the avatar and render it into the avatar texture.

Parameters
pScreenRectThe part of the screen the avatar fills, or null for the projector.
Ghidra address:
NTSC-U/C: 0x00272518
Ghidra address:
PAL: 0x0027c0c8

◆ EmblemName()

const char * AvatarPartSet::EmblemName ( ) const

Report the name of the emblem.

Returns
The symbol.
Ghidra address:
NTSC-U/C: 0x002726a0
Ghidra address:
PAL: 0x0027c250

◆ PartName()

const char * AvatarPartSet::PartName ( int nPart) const

Report the name of the choice of a part.

Parameters
nPartOne of Part.
Returns
The symbol.
Ghidra address:
NTSC-U/C: 0x00272718
Ghidra address:
PAL: 0x0027c2c8

◆ PartColor()

Color AvatarPartSet::PartColor ( int nPart) const

Report the colour of a part.

Parameters
nPartOne of Part.
Returns
The colour, opaque.
Ghidra address:
NTSC-U/C: 0x00272778
Ghidra address:
PAL: 0x0027c328

The documentation for this class was generated from the following file: