From 7d4e4c0b34a613dd3c0220475ae4e448197522c1 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 12 Mar 2011 23:17:12 +0100 Subject: initial commit. now I can start playing with stuff! --- src/worldmap.h | 211 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 src/worldmap.h (limited to 'src/worldmap.h') diff --git a/src/worldmap.h b/src/worldmap.h new file mode 100644 index 0000000..1f8a9a3 --- /dev/null +++ b/src/worldmap.h @@ -0,0 +1,211 @@ +/* + * 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 MARIO_OPTIONS +//#define WM_DEBUGGING +//#define LEVEL_MENU + +#include +#include + +#ifdef LEVEL_MENU +#include "layoutlib.h" +#endif + +#include "fileload.h" +#include "levelinfo.h" +#include "3dlib/treeki3d.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: + #ifdef LEVEL_MENU + Layout *layout; + int currentPage; + int *selections; + #endif + int state; + void *csMenu; + void *selectCursor; + void *numPeopleChange; + void *yesNoWindow; + void *continueObj; + void *stockItem; + void *stockItemShadow; + void *easyPairing; + + void *levelInfo; + FileHandle levelInfoFH; + + #ifndef LEVEL_MENU + 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(); + #endif + + void StartLevel(LevelInfo_Entry *entry); + + #ifdef LEVEL_MENU + void StartLevel(); + void GenText(); + void SetTitle(const char *text); + #endif + + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + static dScNewerWorldMap_c *build(); + static dScNewerWorldMap_c *instance; +}; + -- cgit v1.2.3