/* * Newer Super Mario Bros. Wii * World Maps * * Wish me luck. That's all I'm saying. --Treeki * Started: 03/06/2010; 11:52pm */ // TODO: add Save Error state //#define WM_DEBUGGING #include #include #include "fileload.h" #include "levelinfo.h" #include "worldmapdata.h" #include enum WMDirection { LEFT, RIGHT, UP, DOWN }; #ifdef WM_DEBUGGING #define MapReport OSReport #else inline void MapReport(const char *str, ...) { } #endif void NewerMapDrawFunc(); struct WMResSetEntry { u32 key; u32 offset; }; struct WMResSetHeader { u32 magic; u32 count; WMResSetEntry entries[1]; // dynamic size char *getName(int index) { return (char*)((u32)this + entries[index].offset); } }; class dWMResourceMng_c { private: bool hasSetPath; bool isSetLoaded; bool isLoadingComplete; char setPath[0x40]; dDvdLoader_c setLoader; dDvdLoader_c *resLoaders; WMResSetHeader *setData; public: dWMResourceMng_c(); ~dWMResourceMng_c(); bool loadSet(const char *setName); void *operator[](u32 key); bool isLoaded(); u32 resCount() { return setData->count; } u32 keyForIndex(u32 index) { return setData->entries[index].key; } void *dataForIndex(u32 index) { return resLoaders[index].buffer; } }; class dWMMap_c : public dBase_c { public: int onCreate(); int onDelete(); int onExecute(); int onDraw(); static dWMMap_c *build(); static dWMMap_c *instance; }; class dWorldCamera_c : public dBase_c { public: int onCreate(); int onDelete(); int onExecute(); int onDraw(); Point3d camPos; Vec camRotate; static dWorldCamera_c *build(); static dWorldCamera_c *instance; }; class daWMPlayer_c : public dActor_c { public: dPlayerModelHandler_c *modelHandler; int onCreate(); int onDelete(); int onExecute(); int onDraw(); int current_param; int currentAnim; float currentFrame; float currentUnk; float currentUpdateRate; void startAnimation(int id, float frame, float unk, float updateRate); static daWMPlayer_c *build(); static daWMPlayer_c *instance; }; // WORLD MAP CLASS LAYOUT class dScNewerWorldMap_c : public dScene_c { public: int state; void *csMenu; void *selectCursor; void *numPeopleChange; void *yesNoWindow; void *continueObj; void *stockItem; void *stockItemShadow; void *easyPairing; void *levelInfo; FileHandle levelInfoFH; mHeapAllocator_c allocator; File modelFile; m3d::mdl_c model; void LoadModel(); daWMPlayer_c *player; WorldMapData wmData; bool isMoving; WMPathPoint *currentPoint; WMPathPoint *nextPoint; WMPathDef *currentPath; WMPathSegment *currentSegment; int currentSegmentID; bool reverseThroughPath; // direction we are going through the path void HandleMovement(); void StartMovementTo(WMDirection direction); void MoveToSegment(int id); void MoveThroughPath(); void ActivatePoint(); void StartLevel(LevelInfo_Entry *entry); int onCreate(); int onDelete(); int onExecute(); int onDraw(); static dScNewerWorldMap_c *build(); static dScNewerWorldMap_c *instance; };