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

Persisted result for one skill setting of one level. More...

#include <skillstats.h>

Public Member Functions

 SkillStats ()
 Construct a record with no defined contents.
virtual ~SkillStats ()
virtual void Save (OBStream &stream)
 Write this record.
virtual void Load (IBStream &stream)
 Read this record.
void Clear ()
 Zero both members, the high score first.

Public Attributes

int mBeaten
 Non-zero once the level is beaten at this difficulty.
int mHighScore
 The best score at this difficulty.

Detailed Description

Persisted result for one skill setting of one level.

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

LevelStats stores exactly three of these and Save() at 0x00142760 writes all three without a loop, so the count is fixed in the source rather than computed.

Save() emits the beaten flag as a single truth byte and the high score as a 16-bit halfword, and the version 1 branch of Load() reads the high score as a full word, so the narrowing arrived with record version 2.

Both members are public, because CampaignStats reads and writes them directly and the image has no accessor for either.

The assignment at 0x001453e0 copies the two members and not the vptr. It is the implicit one and is not written. LevelStats::Assign() uses it.

Constructor & Destructor Documentation

◆ SkillStats()

SkillStats::SkillStats ( )
inline

Construct a record with no defined contents.

Defined in the header rather than compiled out of line. Every construction in the image stores only the vtable pointer, which is what establishes both that the constructor exists and that it initialises neither member. LevelStats::Load() relies on that: it builds three of these on the stack and hands each straight to Load().

◆ ~SkillStats()

virtual SkillStats::~SkillStats ( )
virtual
Ghidra address:
NTSC-U/C: 0x001452f8
Ghidra address:
PAL: 0x00145e10

Member Function Documentation

◆ Save()

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

Write this record.

Vtable slot 2. The version byte 2 precedes the payload, and it is written whether or not the reader will consult it, because Load() branches on the version CampaignStats::Load() stored in g_nStatsRecordVersion rather than on this byte.

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

◆ Load()

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

Read this record.

Vtable slot 3. The branch is on g_nStatsRecordVersion, which CampaignStats::Load() fills before it arrives at any element. A version other than 1 or 2 reads nothing, and both members retain their previous values.

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

◆ Clear()

void SkillStats::Clear ( )

Zero both members, the high score first.

LevelStats::Reset() runs it on each of the three records it appends, after the inline constructor has stored only the vtable pointer. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00145328
Ghidra address:
PAL: 0x00145e40

Member Data Documentation

◆ mBeaten

int SkillStats::mBeaten

Non-zero once the level is beaten at this difficulty.

CampaignStats::RecordLevelBeaten() sets it. +0x00

◆ mHighScore

int SkillStats::mHighScore

The best score at this difficulty.

CampaignStats::RecordHighScore() raises it. +0x04


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