Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
WorldScripts Class Reference

Per-map script progress values (the in-progress state of each map's script). More...

#include <worldscripts.h>

Inheritance diagram for WorldScripts:
Collaboration diagram for WorldScripts:

Public Member Functions

 WorldScripts (SaveFile *saveFile=nullptr)
virtual ~WorldScripts ()
void load (SaveFile *saveFile=nullptr)
 Expand the script values from the save.
void save (SaveFile *saveFile)
 Flatten the script values to the save.
int scriptsCount ()
 Number of script values (scriptCount).
int scriptsAt (int ind)
 Script value for map index ind.
void scriptsSet (int ind, int val)
 Set the script value for ind.
protected::void curScriptsChanged ()
void reset ()
 Zero all script values.
void randomize ()
 Randomize the script values.

Public Attributes

var16 curScripts [scriptCount]
 Per-map script-progress values.

Detailed Description

Per-map script progress values (the in-progress state of each map's script).

Each map has a script "step" counter tracking how far its events have advanced; this holds all scriptCount of them as a curScripts array. Unlike the boolean event/missable flags these are small integers, so the QML accessors take and return int. Standard expanded-node convention (see SaveFileExpanded).

See also
World, AreaMap::curMapScript (the current map's live script index).

Definition at line 37 of file worldscripts.h.

Constructor & Destructor Documentation

◆ WorldScripts()

WorldScripts::WorldScripts ( SaveFile * saveFile = nullptr)

Definition at line 30 of file worldscripts.cpp.

References load().

◆ ~WorldScripts()

WorldScripts::~WorldScripts ( )
virtual

Definition at line 35 of file worldscripts.cpp.

Member Function Documentation

◆ curScriptsChanged()

protected::void WorldScripts::curScriptsChanged ( )

References randomize(), and reset().

Referenced by load(), reset(), and scriptsSet().

◆ load()

void WorldScripts::load ( SaveFile * saveFile = nullptr)

Expand the script values from the save.

Definition at line 37 of file worldscripts.cpp.

References curScripts, curScriptsChanged(), ScriptsDB::inst(), SaveFile::iterator(), SaveFileIterator::offsetTo(), and reset().

Referenced by WorldScripts().

◆ randomize()

void WorldScripts::randomize ( )

Randomize the script values.

Definition at line 105 of file worldscripts.cpp.

References reset().

Referenced by curScriptsChanged().

◆ reset()

void WorldScripts::reset ( )

Zero all script values.

Definition at line 98 of file worldscripts.cpp.

References curScripts, curScriptsChanged(), and scriptCount.

Referenced by curScriptsChanged(), load(), and randomize().

◆ save()

void WorldScripts::save ( SaveFile * saveFile)

Flatten the script values to the save.

Definition at line 63 of file worldscripts.cpp.

References curScripts, ScriptsDB::inst(), SaveFile::iterator(), and SaveFileIterator::offsetTo().

◆ scriptsAt()

int WorldScripts::scriptsAt ( int ind)

Script value for map index ind.

Definition at line 87 of file worldscripts.cpp.

References curScripts.

◆ scriptsCount()

int WorldScripts::scriptsCount ( )

Number of script values (scriptCount).

Definition at line 82 of file worldscripts.cpp.

References scriptCount.

◆ scriptsSet()

void WorldScripts::scriptsSet ( int ind,
int val )

Set the script value for ind.

Definition at line 92 of file worldscripts.cpp.

References curScripts, and curScriptsChanged().

Member Data Documentation

◆ curScripts

var16 WorldScripts::curScripts[scriptCount]

Per-map script-progress values.

Definition at line 60 of file worldscripts.h.

Referenced by load(), reset(), save(), scriptsAt(), and scriptsSet().


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