|
NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
|
#include <game/bases/d_wm_csvdata.hpp>
Loader for world map point / route data.
This class reads the CSV files located in WorldMap/RouteInfo.arc, which describe the structure of the world map - how the nodes (points) are connected, which course unlocks which other course, and which world map enemies are present.
Each line in the point CSV file contains a number of fields, separated by commas. If no more non-empty fields are present, the line may be terminated early with a carriage return and newline character.
The fields are as follows:
| Field | Description |
|---|---|
| Line number | A sequential number starting from 1 for each line in the file, ignored by the game. |
| Point name | The name of the point. |
| Point types | A comma-separated list of the point's properties. See PointFlag_e. |
| Open point names (Regular exit) | A comma-separated list of point names which are unlocked when the player completes the course at this point. |
| Open route names (Regular exit) | A comma-separated list of route names which are unlocked when the player completes the course at this point. |
| Flag data (Regular exit) | Seems to never be used in the vanilla world maps, but is referenced in: |
| Open point names (Secret exit) | A comma-separated list of point names which are unlocked when the player completes the secret exit of the course at this point. |
| Open route names (Secret exit) | A comma-separated list of route names which are unlocked when the player completes the secret exit of the course at this point. |
| Flag data (Secret exit) | See the regular exit version of this. |
Each line in the route CSV file contains a number of fields, separated by commas.
The fields are as follows:
| Field | Description |
|---|---|
| Route name | The name of the route, in the format Rxxxxyyyy, where xxxx and yyyy denote the two connected points. |
| Route action type | The route type. This determines the animation of the player when they traverse the route. See ActionType_e. |
| Route flags | A comma-separated list of flags for the route. Only used in World 5 for the moving vines. |
Definition at line 23 of file d_wm_csvdata.hpp.
Classes | |
| struct | Point_s |
| Contains the data for a single point on the world map. More... | |
| struct | SubRoute_s |
| Contains the data for a point-to-point route on the world map. More... | |
| struct | Route_s |
| Contains the points of a route on the world map. More... | |
Public Types | |
| enum | PointFlag_e { POINT_URA = BIT_FLAG(0) , POINT_STOP = BIT_FLAG(1) , POINT_LINK1 = BIT_FLAG(2) , POINT_LINK2 = BIT_FLAG(3) , POINT_LINK3 = BIT_FLAG(4) , POINT_LINK4 = BIT_FLAG(5) , POINT_LINK5 = BIT_FLAG(6) , POINT_SCROLL = BIT_FLAG(7) , POINT_SCALE = BIT_FLAG(8) , POINT_DOKAN = BIT_FLAG(10) , POINT_SWITCH = BIT_FLAG(11) , POINT_ANCHOR_X = BIT_FLAG(12) , POINT_ANCHOR_Y = BIT_FLAG(13) , POINT_TILT = BIT_FLAG(14) , POINT_DEMO1 = BIT_FLAG(15) , POINT_DEMO2 = BIT_FLAG(16) , POINT_DEMO3 = BIT_FLAG(17) , POINT_CROSSROAD = BIT_FLAG(18) , POINT_FOCUS = BIT_FLAG(19) , POINT_BOARD = BIT_FLAG(20) , POINT_DEMOSTOP = BIT_FLAG(21) , POINT_SCROLL_Y = BIT_FLAG(22) , POINT_SAND = BIT_FLAG(23) , POINT_ICE = BIT_FLAG(24) , POINT_DEMO4 = BIT_FLAG(25) , POINT_DEMO5 = BIT_FLAG(26) , POINT_DEMO6 = BIT_FLAG(27) , POINT_DEMO7 = BIT_FLAG(28) , POINT_CAMSTOP = BIT_FLAG(29) , POINT_NOSHIFT = BIT_FLAG(30) , POINT_SCROLL_A = BIT_FLAG(31) } |
| enum | EnemyFlag_e { ENEMY_KURIBO1 = BIT_FLAG(1) , ENEMY_KURIBO2 = BIT_FLAG(2) , ENEMY_PUKU1 = BIT_FLAG(3) , ENEMY_PUKU2 = BIT_FLAG(4) , ENEMY_PAK1 = BIT_FLAG(5) , ENEMY_PAK2 = BIT_FLAG(6) , ENEMY_PAK3 = BIT_FLAG(7) , ENEMY_HBROS1 = BIT_FLAG(8) , ENEMY_TRAP1 = BIT_FLAG(10) , ENEMY_TRAP2 = BIT_FLAG(11) } |
| enum | ActionType_e { ACTION_TYPE_NONE = -1 , ACTION_TYPE_0 , ACTION_TYPE_1 , ACTION_TYPE_ROAD , ACTION_TYPE_LADDER , ACTION_TYPE_JUMP , ACTION_TYPE_5 , ACTION_TYPE_VINE , ACTION_TYPE_SLOPE , ACTION_TYPE_ICE_SLOPE , ACTION_TYPE_SWITCH_BLOCK = 14 , ACTION_TYPE_SAND , ACTION_TYPE_QUICKSAND , ACTION_TYPE_SNOW , ACTION_TYPE_ICE , ACTION_TYPE_CLOUD , ACTION_TYPE_WATER , ACTION_TYPE_LEFT_LADDER , ACTION_TYPE_RIGHT_LADDER , ACTION_TYPE_DIRT , ACTION_TYPE_ROCK_LADDER , ACTION_TYPE_ROPE_LADDER , ACTION_TYPE_WOOD } |
Public Member Functions | |
| virtual | ~dCsvData_c () |
| Destroys the class. | |
| void | initialize (int world, int subworld) |
| Initializes the class and loads the CSV data for the specified world and subworld. | |
| void | RouteInfoInit () |
| Resets all currently loaded point and route data. | |
| void | ReadCsvData () |
| Loads the CSV point and route data for the specified world and subworld. | |
| void | ReadPointName (char *csv, int &pos) |
| Reads a point name from a CSV entry. | |
| void | ReadPointType (char *csv, int &pos) |
| Reads a point type from a CSV entry. | |
| void | ReadOpenPointName (char *csv, int &pos, bool regularExit) |
| Reads an open point name from a CSV entry. | |
| void | ReadOpenRouteName (char *csv, int &pos, bool regularExit) |
| Reads an open route name from a CSV entry. | |
| void | ReadFlagData (char *csv, int &pos, bool regularExit) |
| Reads the point flag data from a CSV entry. | |
| void | ReadAnimeRouteName (char *csv, int &pos) |
| Reads a route name from a CSV entry. | |
| void | ReadAction (char *csv, int &pos) |
| Reads a route action type from a CSV entry. | |
| void | ReadRouteFlag (char *csv, int &pos) |
| Reads the route flag data from a CSV entry. | |
| ActionType_e | GetActionLabel (const char *route) |
| Gets the action type for a given route name. | |
| int | GetIndexFromPointName (const char *pointName) |
| Gets the index of a point. | |
| void | addKeyPoint (const m3d::mdl_c &model) |
| Adds a key point from a model. | |
| void | SetRouteInfo (const m3d::mdl_c &model) |
| Creates a route from a model and adds it to the route list. | |
| const char * | GetPointName (int idx) const |
| Returns the name of a point at the specified index. | |
| const char * | GetOpenPointName (bool regularExit, int idx, int openPointIdx) const |
| Returns the name of a point that is opened from a regular or secret exit from this point. | |
| int | GetOpenPointNum (bool regularExit, int idx) const |
| Returns the number of points that are opened from a regular or secret exit from this point. | |
| const char * | GetOpenRouteName (bool regularExit, int idx, int openRouteIdx) const |
| Returns the name of a route that is opened from a regular or secret exit from this point. | |
| int | GetOpenRouteNum (bool regularExit, int idx) const |
| Returns the number of routes that are opened from a regular or secret exit from this point. | |
| u32 | GetPointFlags (int idx, PointFlag_e flags) const |
Returns the flags ANDed with flags. | |
| u32 | GetEnemyPointFlags (int idx, EnemyFlag_e flags) const |
Returns the enemy flags ANDed with flags. | |
| u32 | GetPointParam (int idx) |
| Returns the parameter value for this point. | |
| const char * | GetRouteName (int idx) |
| Returns the name of a route at the specified index. | |
| const char * | GetChildPointName (int idx, int childIdx) |
| Returns the name of a point that is part of a route at the specified index. | |
| const char * | GetSubRouteName (int idx) |
| Returns the name of a subroute at the specified index. | |
| int | GetSubRouteIdx (const char *pointA, const char *pointB) |
| Returns the index of a route connecting two points. | |
| int | GetPointNum (int idx) |
| Returns the number of points that are part of a route at the specified index. | |
| u32 | GetSubRouteFlag (int idx) |
| Returns the flags for a route at the specified index. | |
| int | GetRouteAnimNum (bool regularExit, int idx) |
| Returns the number of flag data entries for a point. | |
| const char * | GetRouteAnimName (bool regularExit, int idx, int animIdx) |
| Returns the value of a flag data entry for a point. | |
| bool | findSubRoutesForRoute (const char *startPointName, const char *endPointName, Route_s *route, int maxLevel, bool resetLevel=true) |
Searches the subroute graph for a path between two points and writes the length of the path to route. | |
| bool | appendChildFromSubRoute (const char *startPointName, const char *endPointName, Route_s *route, int maxLevel, bool resetLevel=true) |
Searches the subroute graph for a path between two points and appends the child points to route. | |
| void | appendChildFromModel (const nw4r::g3d::ResNode &node, int) |
Appends the child points of a route from a model to route. | |
| void | adjustChildInfo (Route_s *route) |
| Reverses the order of the child points of a route. | |
| bool | isLineEnd (char *csv, int pos) |
| Returns whether the the CSV has a line ending at the specified position. | |
Static Public Member Functions | |
| static void | initRouteStruct (Route_s *route, int childCount) |
| Initializes a route with the specified number of child points. | |
| static void | destroyRouteStruct (Route_s *route) |
| Destroys a route and frees its child point data. | |
Static Public Attributes | |
| static const int | c_COURSE_ID = STAGE_1 |
| static const int | c_GHOST_ID = STAGE_GHOST_HOUSE |
| static const int | c_TOWER_ID = STAGE_TOWER |
| static const int | c_CASTLE_ID = STAGE_CASTLE |
| static const int | c_KINOKO_ID = STAGE_KINOKO_HOUSE |
| static const int | c_ENEMY_ID = STAGE_ENEMY |
| static const int | c_CANON_ID = STAGE_CANNON |
| static const int | c_TRSHIP_ID = STAGE_TRSHIP |
| static const int | c_AIRSHIP_ID = STAGE_AIRSHIP |
| static const int | c_START_ID = STAGE_START_KINOKO_HOUSE |
| static const int | c_PEACH_ID = STAGE_PEACH_CASTLE |
Private Attributes | |
| int | mWorld |
| The world number for which to load the point and route data. | |
| int | mSubworld |
| The subworld number for which to load the point and route data. | |
| int | mPointCount |
| The number of loaded points in mPoints. | |
| int | mSubrouteCount |
| The number of loaded subroutes in mSubRoutes. | |
| int | mRouteCount |
| The number of loaded routes in mRoutes. | |
| Point_s | mPoints [(192)] |
| The loaded point data. | |
| SubRoute_s | mSubRoutes [(160)] |
| The loaded subroute data. | |
| Route_s | mRoutes [(64)] |
| The loaded route data. | |
Definition at line 26 of file d_wm_csvdata.hpp.
Definition at line 61 of file d_wm_csvdata.hpp.
| Enumerator | |
|---|---|
| ACTION_TYPE_0 | |
| ACTION_TYPE_1 | |
| ACTION_TYPE_5 | |
Definition at line 75 of file d_wm_csvdata.hpp.
|
virtual |
Destroys the class.
Definition at line 50 of file d_wm_csvdata.cpp.
Initializes the class and loads the CSV data for the specified world and subworld.
Definition at line 58 of file d_wm_csvdata.cpp.
| void dCsvData_c::RouteInfoInit | ( | ) |
Resets all currently loaded point and route data.
Definition at line 65 of file d_wm_csvdata.cpp.
| void dCsvData_c::ReadCsvData | ( | ) |
Loads the CSV point and route data for the specified world and subworld.
Definition at line 117 of file d_wm_csvdata.cpp.
| void dCsvData_c::ReadPointName | ( | char * | csv, |
| int & | pos ) |
Reads a point name from a CSV entry.
Definition at line 212 of file d_wm_csvdata.cpp.
| void dCsvData_c::ReadPointType | ( | char * | csv, |
| int & | pos ) |
Reads a point type from a CSV entry.
Definition at line 216 of file d_wm_csvdata.cpp.
| void dCsvData_c::ReadOpenPointName | ( | char * | csv, |
| int & | pos, | ||
| bool | regularExit ) |
Reads an open point name from a CSV entry.
Definition at line 361 of file d_wm_csvdata.cpp.
| void dCsvData_c::ReadOpenRouteName | ( | char * | csv, |
| int & | pos, | ||
| bool | regularExit ) |
Reads an open route name from a CSV entry.
Definition at line 414 of file d_wm_csvdata.cpp.
| void dCsvData_c::ReadFlagData | ( | char * | csv, |
| int & | pos, | ||
| bool | regularExit ) |
Reads the point flag data from a CSV entry.
Definition at line 471 of file d_wm_csvdata.cpp.
| void dCsvData_c::ReadAnimeRouteName | ( | char * | csv, |
| int & | pos ) |
Reads a route name from a CSV entry.
Definition at line 520 of file d_wm_csvdata.cpp.
| void dCsvData_c::ReadAction | ( | char * | csv, |
| int & | pos ) |
Reads a route action type from a CSV entry.
Definition at line 540 of file d_wm_csvdata.cpp.
| void dCsvData_c::ReadRouteFlag | ( | char * | csv, |
| int & | pos ) |
Reads the route flag data from a CSV entry.
Definition at line 604 of file d_wm_csvdata.cpp.
| dCsvData_c::ActionType_e dCsvData_c::GetActionLabel | ( | const char * | route | ) |
Gets the action type for a given route name.
Definition at line 646 of file d_wm_csvdata.cpp.
| int dCsvData_c::GetIndexFromPointName | ( | const char * | pointName | ) |
Gets the index of a point.
Definition at line 655 of file d_wm_csvdata.cpp.
| void dCsvData_c::addKeyPoint | ( | const m3d::mdl_c & | model | ) |
Adds a key point from a model.
Definition at line 664 of file d_wm_csvdata.cpp.
| void dCsvData_c::SetRouteInfo | ( | const m3d::mdl_c & | model | ) |
Creates a route from a model and adds it to the route list.
Definition at line 676 of file d_wm_csvdata.cpp.
| const char * dCsvData_c::GetPointName | ( | int | idx | ) | const |
Returns the name of a point at the specified index.
Definition at line 704 of file d_wm_csvdata.cpp.
Returns the name of a point that is opened from a regular or secret exit from this point.
Definition at line 708 of file d_wm_csvdata.cpp.
Returns the number of points that are opened from a regular or secret exit from this point.
Definition at line 716 of file d_wm_csvdata.cpp.
Returns the name of a route that is opened from a regular or secret exit from this point.
Definition at line 724 of file d_wm_csvdata.cpp.
Returns the number of routes that are opened from a regular or secret exit from this point.
Definition at line 732 of file d_wm_csvdata.cpp.
| u32 dCsvData_c::GetPointFlags | ( | int | idx, |
| PointFlag_e | flags ) const |
Returns the flags ANDed with flags.
Definition at line 740 of file d_wm_csvdata.cpp.
| u32 dCsvData_c::GetEnemyPointFlags | ( | int | idx, |
| EnemyFlag_e | flags ) const |
Returns the enemy flags ANDed with flags.
Definition at line 744 of file d_wm_csvdata.cpp.
| u32 dCsvData_c::GetPointParam | ( | int | idx | ) |
Returns the parameter value for this point.
Definition at line 748 of file d_wm_csvdata.cpp.
| const char * dCsvData_c::GetRouteName | ( | int | idx | ) |
Returns the name of a route at the specified index.
Definition at line 752 of file d_wm_csvdata.cpp.
Returns the name of a point that is part of a route at the specified index.
Definition at line 756 of file d_wm_csvdata.cpp.
| const char * dCsvData_c::GetSubRouteName | ( | int | idx | ) |
Returns the name of a subroute at the specified index.
Definition at line 760 of file d_wm_csvdata.cpp.
| int dCsvData_c::GetSubRouteIdx | ( | const char * | pointA, |
| const char * | pointB ) |
Returns the index of a route connecting two points.
Definition at line 764 of file d_wm_csvdata.cpp.
Returns the number of points that are part of a route at the specified index.
Definition at line 780 of file d_wm_csvdata.cpp.
| u32 dCsvData_c::GetSubRouteFlag | ( | int | idx | ) |
Returns the flags for a route at the specified index.
Definition at line 784 of file d_wm_csvdata.cpp.
Returns the number of flag data entries for a point.
Definition at line 788 of file d_wm_csvdata.cpp.
Returns the value of a flag data entry for a point.
Definition at line 796 of file d_wm_csvdata.cpp.
| bool dCsvData_c::findSubRoutesForRoute | ( | const char * | startPointName, |
| const char * | endPointName, | ||
| Route_s * | route, | ||
| int | maxLevel, | ||
| bool | resetLevel = true ) |
Searches the subroute graph for a path between two points and writes the length of the path to route.
| startPointName | The name of the starting point. |
| endPointName | The name of the ending point. |
| route | The route to write the path length to. |
| maxLevel | The maximum depth of the search. |
| resetLevel | Whether to reset the search depth counter. Should be true for the initial call and false for recursive calls. |
Definition at line 859 of file d_wm_csvdata.cpp.
| bool dCsvData_c::appendChildFromSubRoute | ( | const char * | startPointName, |
| const char * | endPointName, | ||
| Route_s * | route, | ||
| int | maxLevel, | ||
| bool | resetLevel = true ) |
Searches the subroute graph for a path between two points and appends the child points to route.
This function assumes the length of the path has already been determined with findSubRoutesForRoute.
| startPointName | The name of the starting point. |
| endPointName | The name of the ending point. |
| route | The route to write the points to. |
| maxLevel | The maximum depth of the search. |
| resetLevel | Whether to reset the search depth counter. Should be true for the initial call and false for recursive calls. |
Definition at line 817 of file d_wm_csvdata.cpp.
| void dCsvData_c::appendChildFromModel | ( | const nw4r::g3d::ResNode & | node, |
| int | routeIdx ) |
Appends the child points of a route from a model to route.
Definition at line 897 of file d_wm_csvdata.cpp.
| void dCsvData_c::adjustChildInfo | ( | Route_s * | route | ) |
Reverses the order of the child points of a route.
Definition at line 922 of file d_wm_csvdata.cpp.
| bool dCsvData_c::isLineEnd | ( | char * | csv, |
| int | pos ) |
Returns whether the the CSV has a line ending at the specified position.
Definition at line 936 of file d_wm_csvdata.cpp.
Initializes a route with the specified number of child points.
| route | The route to initialize. |
| childCount | The number of child points to allocate for the route. |
Definition at line 804 of file d_wm_csvdata.cpp.
|
static |
Destroys a route and frees its child point data.
Definition at line 813 of file d_wm_csvdata.cpp.
|
private |
The world number for which to load the point and route data.
Definition at line 217 of file d_wm_csvdata.hpp.
|
private |
The subworld number for which to load the point and route data.
Definition at line 218 of file d_wm_csvdata.hpp.
|
private |
The number of loaded points in mPoints.
Definition at line 219 of file d_wm_csvdata.hpp.
|
private |
The number of loaded subroutes in mSubRoutes.
Definition at line 220 of file d_wm_csvdata.hpp.
|
private |
The number of loaded routes in mRoutes.
Definition at line 221 of file d_wm_csvdata.hpp.
|
private |
The loaded point data.
Definition at line 222 of file d_wm_csvdata.hpp.
|
private |
The loaded subroute data.
Definition at line 223 of file d_wm_csvdata.hpp.
|
private |
The loaded route data.
Definition at line 224 of file d_wm_csvdata.hpp.
|
static |
Definition at line 227 of file d_wm_csvdata.hpp.
|
static |
Definition at line 228 of file d_wm_csvdata.hpp.
|
static |
Definition at line 229 of file d_wm_csvdata.hpp.
|
static |
Definition at line 230 of file d_wm_csvdata.hpp.
|
static |
Definition at line 231 of file d_wm_csvdata.hpp.
|
static |
Definition at line 232 of file d_wm_csvdata.hpp.
|
static |
Definition at line 233 of file d_wm_csvdata.hpp.
|
static |
Definition at line 234 of file d_wm_csvdata.hpp.
|
static |
Definition at line 235 of file d_wm_csvdata.hpp.
|
static |
Definition at line 236 of file d_wm_csvdata.hpp.
|
static |
Definition at line 237 of file d_wm_csvdata.hpp.