resonance 1.0.1
Loading...
Searching...
No Matches
LevelStats Class Reference

Persisted result for one level, across every skill setting. More...

#include <levelstats.h>

Collaboration diagram for LevelStats:

Public Member Functions

 LevelStats ()
 Construct an empty record.
virtual ~LevelStats ()
virtual void Save (OBStream &stream)
 Write this record.
virtual void Load (IBStream &stream)
 Read this record.
void Reset ()
 Empty the name, clear mStage, and replace the skills with three cleared records.
void Assign (const LevelStats &other)
 Copy another record's name, stage, and skills into this one.
void Print (std::ostream &stream) const
 Write this record to a text stream.

Public Attributes

HxStr mName
 Identity of the level this record belongs to.
int mStage
 The album stage the level belongs to, counted from 1.
std::vector< SkillStats > mSkills
 One result per difficulty, exactly three once a record has been read.

Detailed Description

Persisted result for one level, across every skill setting.

Its RTTI descriptor is at 0x007d3da8. It has no base. The compiler places the vptr after the data at +0x18, and the class is 0x1c bytes. Its vtable is at 0x007d3d48 and runs the type function, the destructor, Save(), and Load().

CampaignStats stores a vector of these and resolves one by name, so mName is the record's key.

Save() writes exactly three skill records and the version 2 branch of Load() reads exactly three, each built on the stack and appended, so the three are written out in the source rather than looped over.

Constructor & Destructor Documentation

◆ LevelStats()

LevelStats::LevelStats ( )

Construct an empty record.

The out-of-line body zeroes the name and the vector and stores the vtable pointer, all of which the compiler generates, so the written body is empty. mStage is not among the members it initialises.

Ghidra address:
NTSC-U/C: 0x001448b8
Ghidra address:
PAL: 0x001453b8

◆ ~LevelStats()

virtual LevelStats::~LevelStats ( )
virtual
Ghidra address:
NTSC-U/C: 0x001424e8
Ghidra address:
PAL: 0x00142fd8

Member Function Documentation

◆ Save()

virtual void LevelStats::Save ( OBStream & stream)
virtual

Write this record.

Vtable slot 2. The version byte 2 precedes the payload. The name goes out as its length followed by its bytes, and an empty name hands g_szEmptyString to the stream in place of a null buffer.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x00142760
Ghidra address:
PAL: 0x00143260

◆ Load()

virtual void LevelStats::Load ( IBStream & stream)
virtual

Read this record.

Vtable slot 3. The branch is on g_nStatsRecordVersion. Version 1 reads a leading word that it discards, then the name, then mStage as a full word, then a skill count it resizes the vector to. Version 2 reads a version byte, the name, mStage as a single byte, and then exactly three skill records into a cleared vector. A version other than 1 or 2 reads nothing.

Parameters
streamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x00142880
Ghidra address:
PAL: 0x00143380

◆ Reset()

void LevelStats::Reset ( )

Empty the name, clear mStage, and replace the skills with three cleared records.

CampaignStats::RebuildLevelList() and MergeLevelList() run it on the record they append. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00142610
Ghidra address:
PAL: 0x00143110

◆ Assign()

void LevelStats::Assign ( const LevelStats & other)

Copy another record's name, stage, and skills into this one.

The skill vector is emptied, resized to the other's length with default records, and then assigned element by element. CampaignStats::Assign() is the one caller. The routine writes no return value, so it is not an assignment operator. The title is inferred.

Parameters
otherThe record to copy.
Ghidra address:
NTSC-U/C: 0x00142d70
Ghidra address:
PAL: 0x00143870

◆ Print()

void LevelStats::Print ( std::ostream & stream) const

Write this record to a text stream.

The body is empty. CampaignStats::PrintLevels() calls it for each level. The title is inferred.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x001452f0
Ghidra address:
PAL: 0x00145e08

Member Data Documentation

◆ mName

HxStr LevelStats::mName

Identity of the level this record belongs to.

CampaignStats::FindLevelIndex() at 0x00144ba8 compares this member directly with HxStr::operator==() and no accessor stands between the two, which is what makes the member public rather than private. A friend declaration on CampaignStats fits the image equally well. The level's name. +0x00

◆ mStage

int LevelStats::mStage

The album stage the level belongs to, counted from 1.

+0x08

CampaignStats::RebuildStageLevels() subtracts 1 and files the level's index under that stage, and RebuildLevelList() and MergeLevelList() store GetAlbumLevelStage() of the name here. Save() writes it as a single byte, and Load() reads it back as a byte under record version 2 and as a word under version 1. The constructor does not initialise it. Public because CampaignStats reads and writes it directly and the image has no accessor.

◆ mSkills

std::vector<SkillStats> LevelStats::mSkills

One result per difficulty, exactly three once a record has been read.

+0x0c

Public because CampaignStats reads and writes the entries directly from its level lookups and recounts, and the image has no accessor for the vector.


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