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

Saved settings and progress of one player, among them the controller bindings. More...

#include <campaign.h>

Public Types

enum  Flag {
  kFlagAutocatcher = 0 , kFlagMultiplier = 1 , kFlagSlowdown = 2 , kFlagFreestyle = 3 ,
  kFlagFreestyleTip = 4 , kFlagNone = 5
}
 Bits of mFlags. More...
enum  Medal {
  kMedalNone = 0 , kMedalFinished = 1 , kMedalFirst = 2 , kMedalSecond = 3 ,
  kMedalThird = 4
}
 Values of GetMedal() and GetMedalForScore(), one more than the goals of the score_goal of the song a score passes. More...

Public Member Functions

bool CompletesTier (const char *pszSong, int nSkillLevel)
 Report whether a song is the one song of its campaign tier the player has not yet won.
InputMap * GetInputMap ()
 Report the controller bindings.
void SetInputMap (const InputMap *pMap)
 Replace the controller bindings and mark the profile modified.
int HasSeenFreestyleTip ()
 Report whether the tip about the freestyle lap has shown.
void SetSeenFreestyleTip ()
 Record that the tip about the freestyle lap has shown.
const char * FindFirstUnfinishedSong (int nSkillLevel)
 Report the first song of the unlocked arenas the player has not finished at a skill level.
void GetClearedSongs (int nSkillLevel, const char *pszGroup, std::vector< bool > *pCleared)
 Report which songs of a group the player has cleared at a skill level.
bool IsUnlocked (const char *pszItem, int nSkillLevel)
 Report whether the player has unlocked an item at a skill level.
void GetUnlockedParts (int nPart, std::vector< const char * > *pTypes)
 List the choices of an avatar part the player may use.
void GetUnlockedEmblems (std::vector< const char * > *pTypes)
 List the emblems the player may use.
void RemoveLockedItems (std::vector< const char * > *pItems)
 Remove the items the player has not unlocked at any skill level from a list.
int GetSoloOption () const
 Report the display option the player chose for the solo game.
int GetOnlineOption () const
 Report the display option the player chose for the online game.
void SetSoloOption (int nOption)
 Record the display option for the solo game and mark the profile changed.
void SetOnlineOption (int nOption)
 Record the display option for the online game.
 Campaign ()
 Construct a profile with the default settings and the unlocks of the always entries.
 Campaign (const Campaign &other)
 Copy a profile.
 ~Campaign ()
 Destroy the profile.
Campaign & operator= (const Campaign &other)
 Copy another profile into this one.
bool IsSongFinished (const char *pszSong, int nSkillLevel)
 Report whether a song was finished at a skill level.
bool HasBeatenGame (int nSkillLevel)
 Report whether the player has beaten the game at a skill level, the symbol beat_game among the unlocks of that level.
int GetHighestBeatenSkillLevel ()
 Report the highest skill level at which the player has beaten the game.
void GetSongStats (const char *pszSong, int nSkillLevel, SongStats *pRecord)
 Copy the record of a song at a skill level.
void RecordResult (const SongStats *pRecord, std::vector< UnlockableItem > *pUnlocks)
 Record the result of a song and collect the items it unlocks.
int GetArenaScore (const char *pszArena, int nSkillLevel)
 Report the sum of the best scores of the songs of an arena.
int GetArenaScoreToBeat (const char *pszArena, int nSkillLevel)
 Report the arena score to beat, from the arena_scores of the "db" section.
int GetMedal (const char *pszSong, int nSkillLevel)
 Report the medal of a song at a skill level.
int GetMedalForScore (const char *pszSong, int nSkillLevel, int nScore, int nPercent)
 Report the medal a score earns on a song at a skill level.
const char * TakePendingPowerup (int nSkillLevel)
 Grant the power-up of mPendingPowerup once it is unlocked at a skill level, and clear it.
int IsModified () const
 Report mModified.
void SetModified (int nModified)
 Set mModified.
void Save (BinStream &stream) const
 Write the profile, at version 6.
void Load (BinStream &stream)
 Read a profile Save() wrote, and rebuild the unlocks from the records.
const String & GetPassword () const
void SetPassword (const char *pszPassword)
int GetNameLocked () const
void SetNameLocked (int nNameLocked)
const String & GetName () const
void SetName (const char *pszName)
int GetCustom () const
void SetCustom (int nCustom)
const DateTime & GetBorn () const
DateTime & GetBorn ()
const AvatarPartSet & GetAvatar () const
AvatarPartSet & GetAvatar ()
void SetAvatar (const AvatarPartSet &avatar)

Static Public Member Functions

static void UnlockAllParts ()
 Count every avatar part and emblem as unlocked for every profile.
static void UnlockAllSongs ()
 Count every song as unlocked for every profile, by setting g_dwUnlockAllSongs.

Detailed Description

Saved settings and progress of one player, among them the controller bindings.

The class is not polymorphic. The name comes from the RTTI of the vectors that store it. Each player entry of GameDb stores one at +0x10. The object is 0xf8 bytes.

Member Enumeration Documentation

◆ Flag

Bits of mFlags.

The names are inferred.

Enumerator
kFlagAutocatcher 

The autocatcher power-up was granted.

kFlagMultiplier 

The multiplier power-up was granted.

kFlagSlowdown 

The slowdown power-up was granted.

kFlagFreestyle 

The freestyle power-up was granted.

kFlagFreestyleTip 

The tip about the freestyle lap has shown.

kFlagNone 

The bit GetPowerupBit() reports for an unknown power-up.

◆ Medal

Values of GetMedal() and GetMedalForScore(), one more than the goals of the score_goal of the song a score passes.

The names are inferred.

Enumerator
kMedalNone 

The song was not finished, or it has no goals.

kMedalFinished 

The song was finished below the first goal.

kMedalFirst 

The score passed the first goal.

kMedalSecond 

The score passed the second goal.

kMedalThird 

The score passed the third goal.

Constructor & Destructor Documentation

◆ Campaign() [1/2]

Campaign::Campaign ( )

Construct a profile with the default settings and the unlocks of the always entries.

Ghidra address:
NTSC-U/C: 0x00276e68
Ghidra address:
PAL: 0x002808f8

◆ Campaign() [2/2]

Campaign::Campaign ( const Campaign & other)

Copy a profile.

Parameters
otherThe profile to copy.
Ghidra address:
NTSC-U/C: 0x002771d8
Ghidra address:
PAL: 0x00280c68

◆ ~Campaign()

Campaign::~Campaign ( )

Destroy the profile.

Ghidra address:
NTSC-U/C: 0x002772d8
Ghidra address:
PAL: 0x00280d68

Member Function Documentation

◆ CompletesTier()

bool Campaign::CompletesTier ( const char * pszSong,
int nSkillLevel )

Report whether a song is the one song of its campaign tier the player has not yet won.

Bonus songs and secret songs do not count. The name is inferred.

Parameters
pszSongThe song.
nSkillLevelThe skill level.
Returns
True when winning the song completes the tier.
Ghidra address:
NTSC-U/C: 0x00279660
Ghidra address:
PAL: 0x002830f0

◆ GetInputMap()

InputMap * Campaign::GetInputMap ( )

Report the controller bindings.

Returns
The bindings.
Ghidra address:
NTSC-U/C: 0x0027afc8
Ghidra address:
PAL: 0x00284a58

◆ SetInputMap()

void Campaign::SetInputMap ( const InputMap * pMap)

Replace the controller bindings and mark the profile modified.

Parameters
pMapThe bindings to copy.
Ghidra address:
NTSC-U/C: 0x0027afd8
Ghidra address:
PAL: 0x00284a68

◆ HasSeenFreestyleTip()

int Campaign::HasSeenFreestyleTip ( )

Report whether the tip about the freestyle lap has shown.

The name is inferred.

Returns
Non-zero once the tip has shown.
Ghidra address:
NTSC-U/C: 0x0027aea8
Ghidra address:
PAL: 0x00284938

◆ SetSeenFreestyleTip()

void Campaign::SetSeenFreestyleTip ( )

Record that the tip about the freestyle lap has shown.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x0027aec8
Ghidra address:
PAL: 0x00284958

◆ FindFirstUnfinishedSong()

const char * Campaign::FindFirstUnfinishedSong ( int nSkillLevel)

Report the first song of the unlocked arenas the player has not finished at a skill level.

Bonus songs and secret songs do not count.

Parameters
nSkillLevelThe skill level.
Returns
The song, or null when every song is finished.
Ghidra address:
NTSC-U/C: 0x00279450
Ghidra address:
PAL: 0x00282ee0

◆ GetClearedSongs()

void Campaign::GetClearedSongs ( int nSkillLevel,
const char * pszGroup,
std::vector< bool > * pCleared )

Report which songs of a group the player has cleared at a skill level.

Only the songs of type SongEntry::kTypeNormal available at the skill level count.

Parameters
nSkillLevelThe skill level.
pszGroupThe group, the name of an arena.
pClearedReceives one flag for each song of the group.
Ghidra address:
NTSC-U/C: 0x00279cb8
Ghidra address:
PAL: 0x00283748

◆ IsUnlocked()

bool Campaign::IsUnlocked ( const char * pszItem,
int nSkillLevel )

Report whether the player has unlocked an item at a skill level.

An item unlocked for every skill level counts at each.

Parameters
pszItemThe item.
nSkillLevelThe skill level, or GameDb::kSkillAny for any.
Returns
Whether the item is unlocked.
Ghidra address:
NTSC-U/C: 0x0027aee8
Ghidra address:
PAL: 0x00284978

◆ GetUnlockedParts()

void Campaign::GetUnlockedParts ( int nPart,
std::vector< const char * > * pTypes )

List the choices of an avatar part the player may use.

Every choice qualifies while g_dwUnlockAllParts is set. The name is inferred.

Parameters
nPartOne of AvatarPartSet::Part.
pTypesReceives the symbols of the choices.
Ghidra address:
NTSC-U/C: 0x0027aaf0
Ghidra address:
PAL: 0x00284580

◆ GetUnlockedEmblems()

void Campaign::GetUnlockedEmblems ( std::vector< const char * > * pTypes)

List the emblems the player may use.

Every emblem qualifies while g_dwUnlockAllParts is set. The name is inferred.

Parameters
pTypesReceives the symbols of the emblems.
Ghidra address:
NTSC-U/C: 0x0027ab48
Ghidra address:
PAL: 0x002845d8

◆ RemoveLockedItems()

void Campaign::RemoveLockedItems ( std::vector< const char * > * pItems)

Remove the items the player has not unlocked at any skill level from a list.

The name is inferred.

Parameters
pItemsThe symbols of the items.
Ghidra address:
NTSC-U/C: 0x0027ace8
Ghidra address:
PAL: 0x00284778

◆ GetSoloOption()

int Campaign::GetSoloOption ( ) const

Report the display option the player chose for the solo game.

Returns
The option.
Ghidra address:
NTSC-U/C: 0x0027afc0
Ghidra address:
PAL: 0x00284a50

◆ GetOnlineOption()

int Campaign::GetOnlineOption ( ) const

Report the display option the player chose for the online game.

Returns
The option.
Ghidra address:
NTSC-U/C: 0x0027afd0
Ghidra address:
PAL: 0x00284a60

◆ SetSoloOption()

void Campaign::SetSoloOption ( int nOption)

Record the display option for the solo game and mark the profile changed.

Parameters
nOptionThe option.
Ghidra address:
NTSC-U/C: 0x0027b008
Ghidra address:
PAL: 0x00284a98

◆ SetOnlineOption()

void Campaign::SetOnlineOption ( int nOption)

Record the display option for the online game.

Parameters
nOptionThe option.
Ghidra address:
NTSC-U/C: 0x0027b018
Ghidra address:
PAL: 0x00284aa8

◆ UnlockAllParts()

void Campaign::UnlockAllParts ( )
static

Count every avatar part and emblem as unlocked for every profile.

Ghidra address:
NTSC-U/C: 0x0027b040
Ghidra address:
PAL: 0x00284ad0

◆ UnlockAllSongs()

void Campaign::UnlockAllSongs ( )
static

Count every song as unlocked for every profile, by setting g_dwUnlockAllSongs.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x0027b030
Ghidra address:
PAL: 0x00284ac0

◆ operator=()

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

Copy another profile into this one.

Parameters
otherThe profile to copy.
Returns
The profile.
Ghidra address:
NTSC-U/C: 0x00277498
Ghidra address:
PAL: 0x00280f28

◆ IsSongFinished()

bool Campaign::IsSongFinished ( const char * pszSong,
int nSkillLevel )

Report whether a song was finished at a skill level.

A song counts when its record shows the whole song played. Skill level 4 accepts a finished record at any skill level. Every song counts while the unlock-all setting is on. The name is inferred.

Parameters
pszSongThe song.
nSkillLevelThe skill level, or 4 for any.
Returns
Whether the song was finished.
Ghidra address:
NTSC-U/C: 0x00279960
Ghidra address:
PAL: 0x002833f0

◆ HasBeatenGame()

bool Campaign::HasBeatenGame ( int nSkillLevel)

Report whether the player has beaten the game at a skill level, the symbol beat_game among the unlocks of that level.

Every level counts while the unlock-all setting is on. The name is inferred.

Parameters
nSkillLevelThe skill level.
Returns
Whether the game was beaten.
Ghidra address:
NTSC-U/C: 0x00279888
Ghidra address:
PAL: 0x00283318

◆ GetHighestBeatenSkillLevel()

int Campaign::GetHighestBeatenSkillLevel ( )

Report the highest skill level at which the player has beaten the game.

The name is inferred.

Returns
The skill level, or -1 when the game was not beaten.
Ghidra address:
NTSC-U/C: 0x00279908
Ghidra address:
PAL: 0x00283398

◆ GetSongStats()

void Campaign::GetSongStats ( const char * pszSong,
int nSkillLevel,
SongStats * pRecord )

Copy the record of a song at a skill level.

Without a record, the copy is a cleared record of the song and the skill level.

Parameters
pszSongThe song.
nSkillLevelThe skill level.
pRecordThe record to fill.
Ghidra address:
NTSC-U/C: 0x00279a48
Ghidra address:
PAL: 0x002834d8

◆ RecordResult()

void Campaign::RecordResult ( const SongStats * pRecord,
std::vector< UnlockableItem > * pUnlocks )

Record the result of a song and collect the items it unlocks.

While the unlock-all-songs cheat is on, the result is not recorded and the list is emptied.

Parameters
pRecordThe result.
pUnlocksReceives the items the result unlocks.
Ghidra address:
NTSC-U/C: 0x002778e8
Ghidra address:
PAL: 0x00281378

◆ GetArenaScore()

int Campaign::GetArenaScore ( const char * pszArena,
int nSkillLevel )

Report the sum of the best scores of the songs of an arena.

The name is inferred.

Parameters
pszArenaThe arena.
nSkillLevelThe skill level.
Returns
The sum.
Ghidra address:
NTSC-U/C: 0x00279b08
Ghidra address:
PAL: 0x00283598

◆ GetArenaScoreToBeat()

int Campaign::GetArenaScoreToBeat ( const char * pszArena,
int nSkillLevel )

Report the arena score to beat, from the arena_scores of the "db" section.

The profile itself is not read. The name is inferred.

Parameters
pszArenaThe arena.
nSkillLevelThe skill level.
Returns
The score.
Ghidra address:
NTSC-U/C: 0x00279c40
Ghidra address:
PAL: 0x002836d0

◆ GetMedal()

int Campaign::GetMedal ( const char * pszSong,
int nSkillLevel )

Report the medal of a song at a skill level.

The name is inferred.

Parameters
pszSongThe song.
nSkillLevelThe skill level.
Returns
One of Medal.
Ghidra address:
NTSC-U/C: 0x0027ab98
Ghidra address:
PAL: 0x00284628

◆ GetMedalForScore()

int Campaign::GetMedalForScore ( const char * pszSong,
int nSkillLevel,
int nScore,
int nPercent )

Report the medal a score earns on a song at a skill level.

The name is inferred.

Parameters
pszSongThe song.
nSkillLevelThe skill level.
nScoreThe score.
nPercentThe share of the song played, in percent. Only 100 earns a medal.
Returns
One of Medal.
Ghidra address:
NTSC-U/C: 0x0027ac08
Ghidra address:
PAL: 0x00284698

◆ TakePendingPowerup()

const char * Campaign::TakePendingPowerup ( int nSkillLevel)

Grant the power-up of mPendingPowerup once it is unlocked at a skill level, and clear it.

The name is inferred.

Parameters
nSkillLevelThe skill level.
Returns
The power-up granted, or null.
Ghidra address:
NTSC-U/C: 0x0027ae38
Ghidra address:
PAL: 0x002848c8

◆ IsModified()

int Campaign::IsModified ( ) const

Report mModified.

Returns
Non-zero when the profile changed since it was saved.
Ghidra address:
NTSC-U/C: 0x0027b020
Ghidra address:
PAL: 0x00284ab0

◆ SetModified()

void Campaign::SetModified ( int nModified)

Set mModified.

Parameters
nModifiedNon-zero when the profile changed since it was saved.
Ghidra address:
NTSC-U/C: 0x0027b028
Ghidra address:
PAL: 0x00284ab8

◆ Save()

void Campaign::Save ( BinStream & stream) const

Write the profile, at version 6.

Parameters
streamThe stream.
Ghidra address:
NTSC-U/C: 0x0027b058
Ghidra address:
PAL: 0x00284ae8

◆ Load()

void Campaign::Load ( BinStream & stream)

Read a profile Save() wrote, and rebuild the unlocks from the records.

Versions before 4 take the bindings of the input_map of the "db" section, versions before 5 clear mFlags, and versions before 6 reset the last unlock of each kind.

Parameters
streamThe stream.
Ghidra address:
NTSC-U/C: 0x0027b1e8
Ghidra address:
PAL: 0x00284c48

◆ GetPassword()

const String & Campaign::GetPassword ( ) const
inline
Returns
The online password, or empty when it is not saved.

◆ SetPassword()

void Campaign::SetPassword ( const char * pszPassword)
inline
Parameters
pszPasswordThe online password, or empty when it is not saved.

◆ GetNameLocked()

int Campaign::GetNameLocked ( ) const
inline
Returns
Non-zero when the player may not rename the Freq.

◆ SetNameLocked()

void Campaign::SetNameLocked ( int nNameLocked)
inline
Parameters
nNameLockedNon-zero when the player may not rename the Freq.

◆ GetName()

const String & Campaign::GetName ( ) const
inline
Returns
The player's name.

◆ SetName()

void Campaign::SetName ( const char * pszName)
inline
Parameters
pszNameThe player's name.

◆ GetCustom()

int Campaign::GetCustom ( ) const
inline
Returns
Non-zero for a player's own profile, not a default one.

◆ SetCustom()

void Campaign::SetCustom ( int nCustom)
inline
Parameters
nCustomNon-zero for a player's own profile, not a default one.

◆ GetBorn() [1/2]

const DateTime & Campaign::GetBorn ( ) const
inline
Returns
The date the Freq was created.

◆ GetBorn() [2/2]

DateTime & Campaign::GetBorn ( )
inline
Returns
The date the Freq was created.

◆ GetAvatar() [1/2]

const AvatarPartSet & Campaign::GetAvatar ( ) const
inline
Returns
The Freq's parts and colours.

◆ GetAvatar() [2/2]

AvatarPartSet & Campaign::GetAvatar ( )
inline
Returns
The Freq's parts and colours.

◆ SetAvatar()

void Campaign::SetAvatar ( const AvatarPartSet & avatar)
inline
Parameters
avatarThe Freq's parts and colours.

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