coastline 0.0.4
Loading...
Searching...
No Matches
season.h File Reference

The progress of a season of the championship on the PC port: its round, its year, and its class, and their saving and restoring. More...

#include "common/profile.h"
#include "common/vehicle.h"
Include dependency graph for season.h:

Go to the source code of this file.

Classes

struct  SeasonRacePlayerResult
 A local player's retained championship race result. More...
struct  SeasonRaceResult
 The result record retained when returning from a championship race. More...
struct  SeasonResumeState
 The result prefix and additional state reset when returning from a race. More...
struct  SeasonSaveSettings
 The menu settings appended to a saved season. More...

Macros

#define SEASON_ROUND_LABEL_SIZE   32
 The size of g_szSeasonRoundLabel.
#define SEASON_RESUME_STATE_RESTART   5
 The resume state that starts a season again at its first round.
#define SEASON_YEAR_LABEL_SIZE   32
 The year label's buffer size.
#define SEASON_SAVE_PAYLOAD_SIZE   512
 The bytes of profile memory written to a season file.
#define SEASON_SAVE_SLOT_NAME_SIZE   128
 The bytes reserved for the saved slot label.
#define SEASON_LOAD_CURRENT   0
 Apply g_SeasonProgress without reading a file.
#define SEASON_LOAD_FILE   4
 Read the saved profile and its trailing menu settings.
#define g_pPrimarySeasonSave   (g_aVehicles[0].GetProfile())
 The profile used to save progress for the first player.
#define g_pSecondarySeasonSave   (g_aVehicles[1].GetProfile())
 The profile used to save progress for the second player.

Functions

void ShutdownGameSessionToSeasonMenu (void)
 Shut down the race with the season restart state selected.
void ExitRaceSessionToMenu (void)
 Clear race resume data and shut down the session with exit state eight.
void ShutdownGameSession (void)
 Release the active race session and restore front-end display settings.
void ExitRaceAndProcessSeasonResults (void)
 Save championship results when applicable, then shut down the race session.
void ApplyLoadedSeasonSettings (bool bUpdatePoints)
 Apply profile progress and equipment to the game and update the year and round labels.
bool LoadSeasonSaveFile (int nMode, bool bAllowFailure)
 Apply g_SeasonProgress for SEASON_LOAD_CURRENT or validate a saved file for other modes.
bool SaveSeasonSaveFile (void)
 Write the first player's profile, checksum, settings, and slot label to g_szSeasonSaveFileName.
int ResetSeasonSaveBuffers (void)
 Clear both players' save profiles, using static buffers for unassigned profiles.
void SyncSeasonProgress (void)
 Copy the season, the round, and the settings of the car and the input device into the progress of the season, choose the track and the weather of the round in the championship, and add the cars and tracks the progress unlocked.
bool RestoreSeasonProgressState (void)
 Restore the progress of the season from the race just run.
void SaveAutoSaveSeason (void)
 Save the progress of the season to the file of the automatic save.
void LoadAutoSaveSeason (void)
 Reset championship menus and restore the automatic save when its file exists.
int LoadSeasonUI_OnSlotSelected (MenuItemList *pUnused, int *pnSlot)
 Reset championship menus and load the selected season slot.

Variables

SeasonRaceResult g_LastRaceResultCopy
 The previous complete result record.
float g_afLastRaceLapTimes [12]
 The lap times copied out of the most recent result.
u8 g_abSeasonRoundPlace [SEASON_RACES]
 The place displayed for each round, from one.
u16 g_awSeasonRoundPoints [SEASON_RACES]
 The points displayed for each round.
char g_szSeasonYearLabel [SEASON_YEAR_LABEL_SIZE]
 The displayed championship year.
int g_dwSeasonSavedRound
 The round backed up when applying a profile.
int g_dwLastRaceResultField18
 The retained result value displayed with the last race.
int g_dwSeasonTotalPoints
 The total points displayed for the current class.
PlayerProfile g_SeasonProgressPrev
 The profile before the race's progress was applied.
int g_dwUnusedSeasonMenuValue
 An unused value reset with championship menus.
int g_dwRaceResultsSelectedLap
 The lap selected on race result menus.
int g_dwLoadSeasonSlotValid
 Whether a saved championship slot has been opened.
int g_dwSeasonFailed
 Whether the front end reports a failed season.
int g_dwSeasonRoundQualified
 Whether the current class's round records were cleared for another attempt.
SeasonSaveSettings g_LoadedSeasonSettings
 The settings read from the end of a season file.
char g_szSecondarySeasonSaveSlotName [SEASON_SAVE_SLOT_NAME_SIZE]
 The slot label copied for the second player after loading.
int g_dwSaveSlotPlayerIndex
 The player whose profile is being loaded, 0 or 1.
u8 g_abSaveFileReadBuffer [SEASON_SAVE_PAYLOAD_SIZE]
 The shared buffer for profile and configuration file reads.
const char g_szSeasonSaveMagic [4]
 The four-byte signature of a saved season.
const char g_szAutoSaveBrf []
 The path used for automatic season saves.
char g_szSeasonSaveSlotName [SEASON_SAVE_SLOT_NAME_SIZE]
 The label appended to a saved season.
SeasonResumeState g_SeasonResumeState
 The result and resume state used when returning to championship menus.
int g_dwSeasonRound
 The round of the season the menus show.
char g_szSeasonRoundLabel [SEASON_ROUND_LABEL_SIZE]
 The label of the round of the season.
int g_dwSeasonLoaded
 Whether a season is loaded.
int g_dwSeasonYear
 The progress of the championship across its years that the menus show.
s8 g_bSeasonClass
 The season of the championship the menus show, from 0.

Detailed Description

The progress of a season of the championship on the PC port: its round, its year, and its class, and their saving and restoring.

Macro Definition Documentation

◆ SEASON_ROUND_LABEL_SIZE

#define SEASON_ROUND_LABEL_SIZE   32

The size of g_szSeasonRoundLabel.

◆ SEASON_RESUME_STATE_RESTART

#define SEASON_RESUME_STATE_RESTART   5

The resume state that starts a season again at its first round.

◆ SEASON_YEAR_LABEL_SIZE

#define SEASON_YEAR_LABEL_SIZE   32

The year label's buffer size.

◆ SEASON_SAVE_PAYLOAD_SIZE

#define SEASON_SAVE_PAYLOAD_SIZE   512

The bytes of profile memory written to a season file.

◆ SEASON_SAVE_SLOT_NAME_SIZE

#define SEASON_SAVE_SLOT_NAME_SIZE   128

The bytes reserved for the saved slot label.

◆ SEASON_LOAD_CURRENT

#define SEASON_LOAD_CURRENT   0

Apply g_SeasonProgress without reading a file.

◆ SEASON_LOAD_FILE

#define SEASON_LOAD_FILE   4

Read the saved profile and its trailing menu settings.

◆ g_pPrimarySeasonSave

#define g_pPrimarySeasonSave   (g_aVehicles[0].GetProfile())

The profile used to save progress for the first player.

Ghidra address:
BRD3D: 0x10aced34
Ghidra address:
BRGlide: 0x10af2094

◆ g_pSecondarySeasonSave

#define g_pSecondarySeasonSave   (g_aVehicles[1].GetProfile())

The profile used to save progress for the second player.

Ghidra address:
BRD3D: 0x10ad189c
Ghidra address:
BRGlide: 0x10af4bfc

Function Documentation

◆ ShutdownGameSessionToSeasonMenu()

void ShutdownGameSessionToSeasonMenu ( void )

Shut down the race with the season restart state selected.

Ghidra address:
BRD3D: 0x10071120
Ghidra address:
BRGlide: 0x1006a070

◆ ExitRaceSessionToMenu()

void ExitRaceSessionToMenu ( void )

Clear race resume data and shut down the session with exit state eight.

Ghidra address:
BRD3D: 0x10039000
Ghidra address:
BRGlide: 0x10032680

◆ ShutdownGameSession()

void ShutdownGameSession ( void )

Release the active race session and restore front-end display settings.

Ghidra address:
BRD3D: 0x10035bd1
Ghidra address:
BRGlide: 0x1002f282

◆ ExitRaceAndProcessSeasonResults()

void ExitRaceAndProcessSeasonResults ( void )

Save championship results when applicable, then shut down the race session.

Ghidra address:
BRD3D: 0x10002140
Ghidra address:
BRGlide: 0x10002460

◆ ApplyLoadedSeasonSettings()

void ApplyLoadedSeasonSettings ( bool bUpdatePoints)

Apply profile progress and equipment to the game and update the year and round labels.

Parameters
bUpdatePointsWhether to recalculate the current class's points.
Ghidra address:
BRD3D: 0x1005fbc0
Ghidra address:
BRGlide: 0x10058900

◆ LoadSeasonSaveFile()

bool LoadSeasonSaveFile ( int nMode,
bool bAllowFailure )

Apply g_SeasonProgress for SEASON_LOAD_CURRENT or validate a saved file for other modes.

SEASON_LOAD_FILE also restores trailing menu settings. Other modes preserve the other player's controls while replacing both profiles.

Parameters
nModeThe profile source and restoration mode.
bAllowFailureWhether open, header, payload, and checksum failures return success.
Returns
Whether loading succeeded or an allowed file failure occurred.
Ghidra address:
BRD3D: 0x10070610
Ghidra address:
BRGlide: 0x100695c0

◆ SaveSeasonSaveFile()

bool SaveSeasonSaveFile ( void )

Write the first player's profile, checksum, settings, and slot label to g_szSeasonSaveFileName.

Returns
Whether the file opened and all checked writes completed. Settings writes and close errors are ignored.
Ghidra address:
BRD3D: 0x100709a0
Ghidra address:
BRGlide: 0x10069930

◆ ResetSeasonSaveBuffers()

int ResetSeasonSaveBuffers ( void )

Clear both players' save profiles, using static buffers for unassigned profiles.

Returns
Always 1.
Ghidra address:
BRD3D: 0x1003e1d0
Ghidra address:
BRGlide: 0x10037870

◆ SyncSeasonProgress()

void SyncSeasonProgress ( void )

Copy the season, the round, and the settings of the car and the input device into the progress of the season, choose the track and the weather of the round in the championship, and add the cars and tracks the progress unlocked.

Ghidra address:
BRD3D: 0x1005fcf0
Ghidra address:
BRGlide: 0x10058a30

◆ RestoreSeasonProgressState()

bool RestoreSeasonProgressState ( void )

Restore the progress of the season from the race just run.

Returns
Whether the progress was restored.
Ghidra address:
BRD3D: 0x1005f940
Ghidra address:
BRGlide: 0x10058680

◆ SaveAutoSaveSeason()

void SaveAutoSaveSeason ( void )

Save the progress of the season to the file of the automatic save.

Ghidra address:
BRD3D: 0x10041b50
Ghidra address:
BRGlide: 0x1003b0b0

◆ LoadAutoSaveSeason()

void LoadAutoSaveSeason ( void )

Reset championship menus and restore the automatic save when its file exists.

Ghidra address:
BRD3D: 0x10041bd0
Ghidra address:
BRGlide: 0x1003b130

◆ LoadSeasonUI_OnSlotSelected()

int LoadSeasonUI_OnSlotSelected ( MenuItemList * pUnused,
int * pnSlot )

Reset championship menus and load the selected season slot.

Parameters
pUnusedNot read.
pnSlotThe selected slot index.
Returns
Zero when the file does not open, otherwise one.
Ghidra address:
BRD3D: 0x10042170
Ghidra address:
BRGlide: 0x1003b6d0

Variable Documentation

◆ g_LastRaceResultCopy

SeasonRaceResult g_LastRaceResultCopy
extern

The previous complete result record.

Ghidra address:
BRD3D: 0x10aa25d0
Ghidra address:
BRGlide: 0x10ac5928

◆ g_afLastRaceLapTimes

float g_afLastRaceLapTimes[12]
extern

The lap times copied out of the most recent result.

Ghidra address:
BRD3D: 0x10aa25a0
Ghidra address:
BRGlide: 0x10ac58f8

◆ g_abSeasonRoundPlace

u8 g_abSeasonRoundPlace[SEASON_RACES]
extern

The place displayed for each round, from one.

Ghidra address:
BRD3D: 0x10aa26e8
Ghidra address:
BRGlide: 0x10ac5a40

◆ g_awSeasonRoundPoints

u16 g_awSeasonRoundPoints[SEASON_RACES]
extern

The points displayed for each round.

Ghidra address:
BRD3D: 0x10a9d068
Ghidra address:
BRGlide: 0x10ac40f8

◆ g_szSeasonYearLabel

char g_szSeasonYearLabel[SEASON_YEAR_LABEL_SIZE]
extern

The displayed championship year.

Ghidra address:
BRD3D: 0x10aa2518
Ghidra address:
BRGlide: 0x10ac5870

◆ g_dwSeasonSavedRound

int g_dwSeasonSavedRound
extern

The round backed up when applying a profile.

Ghidra address:
BRD3D: 0x10aa28ac
Ghidra address:
BRGlide: 0x10ac5c04

◆ g_dwLastRaceResultField18

int g_dwLastRaceResultField18
extern

The retained result value displayed with the last race.

Ghidra address:
BRD3D: 0x10aa28c0
Ghidra address:
BRGlide: 0x10ac5c18

◆ g_dwSeasonTotalPoints

int g_dwSeasonTotalPoints
extern

The total points displayed for the current class.

Ghidra address:
BRD3D: 0x10aa28c4
Ghidra address:
BRGlide: 0x10ac5c1c

◆ g_SeasonProgressPrev

PlayerProfile g_SeasonProgressPrev
extern

The profile before the race's progress was applied.

Ghidra address:
BRD3D: 0x10a9dbd8
Ghidra address:
BRGlide: 0x10ac4c60

◆ g_dwUnusedSeasonMenuValue

int g_dwUnusedSeasonMenuValue
extern

An unused value reset with championship menus.

Ghidra address:
BRD3D: 0x10aa28bc
Ghidra address:
BRGlide: 0x10ac5c14

◆ g_dwRaceResultsSelectedLap

int g_dwRaceResultsSelectedLap
extern

The lap selected on race result menus.

Ghidra address:
BRD3D: 0x10aa28d0
Ghidra address:
BRGlide: 0x10ac5c28

◆ g_dwLoadSeasonSlotValid

int g_dwLoadSeasonSlotValid
extern

Whether a saved championship slot has been opened.

Ghidra address:
BRD3D: 0x10aa28e0
Ghidra address:
BRGlide: 0x10ac5c38

◆ g_dwSeasonFailed

int g_dwSeasonFailed
extern

Whether the front end reports a failed season.

Ghidra address:
BRD3D: 0x10aa28b0
Ghidra address:
BRGlide: 0x10ac5c08

◆ g_dwSeasonRoundQualified

int g_dwSeasonRoundQualified
extern

Whether the current class's round records were cleared for another attempt.

Ghidra address:
BRD3D: 0x10aa28b4
Ghidra address:
BRGlide: 0x10ac5c0c

◆ g_LoadedSeasonSettings

SeasonSaveSettings g_LoadedSeasonSettings
extern

The settings read from the end of a season file.

Ghidra address:
BRD3D: 0x10ad0978
Ghidra address:
BRGlide: 0x10af3cd8

◆ g_szSecondarySeasonSaveSlotName

char g_szSecondarySeasonSaveSlotName[SEASON_SAVE_SLOT_NAME_SIZE]
extern

The slot label copied for the second player after loading.

Ghidra address:
BRD3D: 0x10ad34f8
Ghidra address:
BRGlide: 0x10af6858

◆ g_dwSaveSlotPlayerIndex

int g_dwSaveSlotPlayerIndex
extern

The player whose profile is being loaded, 0 or 1.

Ghidra address:
BRD3D: 0x10690a18
Ghidra address:
BRGlide: 0x105ccbc4

◆ g_abSaveFileReadBuffer

u8 g_abSaveFileReadBuffer[SEASON_SAVE_PAYLOAD_SIZE]
extern

The shared buffer for profile and configuration file reads.

Ghidra address:
BRD3D: 0x11782e28
Ghidra address:
BRGlide: 0x117a6188

◆ g_szSeasonSaveMagic

const char g_szSeasonSaveMagic[4]
extern

The four-byte signature of a saved season.

Ghidra address:
BRD3D: 0x100b5d94
Ghidra address:
BRGlide: 0x100b559c

◆ g_szAutoSaveBrf

const char g_szAutoSaveBrf[]
extern

The path used for automatic season saves.

Ghidra address:
BRD3D: 0x100ad310
Ghidra address:
BRGlide: 0x100acae8

◆ g_szSeasonSaveSlotName

char g_szSeasonSaveSlotName[SEASON_SAVE_SLOT_NAME_SIZE]
extern

The label appended to a saved season.

Ghidra address:
BRD3D: 0x10ad0990
Ghidra address:
BRGlide: 0x10af3cf0

◆ g_SeasonResumeState

SeasonResumeState g_SeasonResumeState
extern

The result and resume state used when returning to championship menus.

Ghidra address:
BRD3D: 0x10220b20
Ghidra address:
BRGlide: 0x1021c650

◆ g_dwSeasonRound

int g_dwSeasonRound
extern

The round of the season the menus show.

Ghidra address:
BRD3D: 0x10aa28a4
Ghidra address:
BRGlide: 0x10ac5bfc

◆ g_szSeasonRoundLabel

char g_szSeasonRoundLabel[SEASON_ROUND_LABEL_SIZE]
extern

The label of the round of the season.

Ghidra address:
BRD3D: 0x10a9d618
Ghidra address:
BRGlide: 0x10ac46a0

◆ g_dwSeasonLoaded

int g_dwSeasonLoaded
extern

Whether a season is loaded.

Ghidra address:
BRD3D: 0x10aa289c
Ghidra address:
BRGlide: 0x10ac5bf4

◆ g_dwSeasonYear

int g_dwSeasonYear
extern

The progress of the championship across its years that the menus show.

Ghidra address:
BRD3D: 0x10aa28a0
Ghidra address:
BRGlide: 0x10ac5bf8

◆ g_bSeasonClass

s8 g_bSeasonClass
extern

The season of the championship the menus show, from 0.

Ghidra address:
BRD3D: 0x10aa28b8
Ghidra address:
BRGlide: 0x10ac5c10