From f7e7a1eea2e66ea507fc5a2b0813ec02493133a9 Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 23 Mar 2011 21:39:58 +0100 Subject: added HUD support and some more debug stuff --- include/game.h | 10 ++++---- kamek_ntsc.x | 8 +++++++ kamek_ntsc2.x | 8 +++++++ kamek_pal.x | 8 +++++++ kamek_pal2.x | 8 +++++++ src/scene.S | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/wm_hud.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++ src/wm_map.cpp | 19 +++++++++++++++- src/wm_player.cpp | 49 --------------------------------------- src/worldmap.cpp | 52 ++++++++++++++++++++++++++++++++++++++++-- src/worldmap.h | 27 ++++++++++++++++++++++ worldmap.yaml | 6 +++++ 12 files changed, 262 insertions(+), 58 deletions(-) create mode 100644 src/wm_hud.cpp diff --git a/include/game.h b/include/game.h index 691f568..ac5318d 100755 --- a/include/game.h +++ b/include/game.h @@ -712,7 +712,7 @@ namespace m2d { Base_c(); virtual ~Base_c(); - virtual void draw(); + virtual void draw(); // don't call this directly void scheduleForDrawing(); @@ -1222,10 +1222,10 @@ namespace m2d { EmbedLayoutBase_c(); ~EmbedLayoutBase_c(); - void draw(); + void draw(); // don't call this directly virtual void update(); - virtual bool build(const char *brlytPath, ResAcc_c *resAcc); + virtual bool build(const char *brlytPath, ResAcc_c *resAcc = 0); nw4r::lyt::Pane *getRootPane(); nw4r::lyt::Pane *findPaneByName(const char *name) const; @@ -1255,7 +1255,7 @@ namespace m2d { EmbedLayout_c(); ~EmbedLayout_c(); - bool build(const char *brlytPath, ResAcc_c *resAcc); + bool build(const char *brlytPath, ResAcc_c *resAcc = 0); bool loadArc(const char *name, bool isLangSpecific); bool loadArc(const char *name, u8 unk, bool isLangSpecific); @@ -1264,6 +1264,8 @@ namespace m2d { // there's also a NedEU one, but should it really be listed here...? + bool free(); + // does NSMBW even use consts? I have no idea. maybe not void getPanes(const char **names, nw4r::lyt::Pane *output, int count) const; diff --git a/kamek_ntsc.x b/kamek_ntsc.x index 258b588..865402e 100644 --- a/kamek_ntsc.x +++ b/kamek_ntsc.x @@ -173,6 +173,13 @@ SECTIONS { DrawAllLayoutsAfterX__Fi = 0x80163390; DrawAllLayoutsAfterXandBeforeY__Fii = 0x80163420; + __ct__Q23m2d13EmbedLayout_cFv = 0x800C8950; + __dt__Q23m2d13EmbedLayout_cFv = 0x800C89A0; + loadArc__Q23m2d13EmbedLayout_cFPCcb = 0x800C8CB0; + free__Q23m2d13EmbedLayout_cFv = 0x800C9930; + execAnimations__Q23m2d13EmbedLayout_cFv = 0x800C9560; + scheduleForDrawing__Q23m2d6Base_cFv = 0x80163850; + RenderEffects__Fii = 0x80093F10; RemoveAllFromScnRoot__Fv = 0x80164E70; @@ -258,6 +265,7 @@ SECTIONS { QueueArcLoad = 0x800DF840; RetrieveFileFromArc = 0x800DF180; RetrieveFileFromArcAlt = 0x800DF3C0; + SpawnSprite = 0x80064610; StoreObjectState = 0x800B1100; TriggerEventFlag = 0x800E4A30; diff --git a/kamek_ntsc2.x b/kamek_ntsc2.x index 2186096..b0956d0 100644 --- a/kamek_ntsc2.x +++ b/kamek_ntsc2.x @@ -173,6 +173,13 @@ SECTIONS { DrawAllLayoutsAfterX__Fi = 0x80163390; DrawAllLayoutsAfterXandBeforeY__Fii = 0x80163420; + __ct__Q23m2d13EmbedLayout_cFv = 0x800C8950; + __dt__Q23m2d13EmbedLayout_cFv = 0x800C89A0; + loadArc__Q23m2d13EmbedLayout_cFPCcb = 0x800C8CB0; + free__Q23m2d13EmbedLayout_cFv = 0x800C9930; + execAnimations__Q23m2d13EmbedLayout_cFv = 0x800C9560; + scheduleForDrawing__Q23m2d6Base_cFv = 0x80163850; + RenderEffects__Fii = 0x80093F10; RemoveAllFromScnRoot__Fv = 0x80164E70; @@ -258,6 +265,7 @@ SECTIONS { QueueArcLoad = 0x800DF840; RetrieveFileFromArc = 0x800DF180; RetrieveFileFromArcAlt = 0x800DF3C0; + SpawnSprite = 0x80064610; StoreObjectState = 0x800B1100; TriggerEventFlag = 0x800E4A30; diff --git a/kamek_pal.x b/kamek_pal.x index 244af05..a078e12 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -173,6 +173,13 @@ SECTIONS { DrawAllLayoutsAfterX__Fi = 0x801634D0; DrawAllLayoutsAfterXandBeforeY__Fii = 0x80163560; + __ct__Q23m2d13EmbedLayout_cFv = 0x800C89A0; + __dt__Q23m2d13EmbedLayout_cFv = 0x800C89F0; + loadArc__Q23m2d13EmbedLayout_cFPCcb = 0x800C8D00; + free__Q23m2d13EmbedLayout_cFv = 0x800C9A20; + execAnimations__Q23m2d13EmbedLayout_cFv = 0x800C9650; + scheduleForDrawing__Q23m2d6Base_cFv = 0x80163990; + RenderEffects__Fii = 0x80093F10; RemoveAllFromScnRoot__Fv = 0x80164FB0; @@ -258,6 +265,7 @@ SECTIONS { QueueArcLoad = 0x800DF930; RetrieveFileFromArc = 0x800DF270; RetrieveFileFromArcAlt = 0x800DF4B0; + SpawnSprite = 0x80064610; StoreObjectState = 0x800B1100; TriggerEventFlag = 0x800E4B20; diff --git a/kamek_pal2.x b/kamek_pal2.x index 9d386bd..5807478 100644 --- a/kamek_pal2.x +++ b/kamek_pal2.x @@ -173,6 +173,13 @@ SECTIONS { DrawAllLayoutsAfterX__Fi = 0xDEADBEEF; DrawAllLayoutsAfterXandBeforeY__Fii = 0xDEADBEEF; + __ct__Q23m2d13EmbedLayout_cFv = 0xDEADBEEF; + __dt__Q23m2d13EmbedLayout_cFv = 0xDEADBEEF; + loadArc__Q23m2d13EmbedLayout_cFPCcb = 0xDEADBEEF; + free__Q23m2d13EmbedLayout_cFv = 0xDEADBEEF; + execAnimations__Q23m2d13EmbedLayout_cFv = 0xDEADBEEF; + scheduleForDrawing__Q23m2d6Base_cFv = 0xDEADBEEF; + RenderEffects__Fii = 0xDEADBEEF; RemoveAllFromScnRoot__Fv = 0xDEADBEEF; @@ -258,6 +265,7 @@ SECTIONS { QueueArcLoad = 0xDEADBEEF; RetrieveFileFromArc = 0xDEADBEEF; RetrieveFileFromArcAlt = 0xDEADBEEF; + SpawnSprite = 0xDEADBEEF; StoreObjectState = 0xDEADBEEF; TriggerEventFlag = 0xDEADBEEF; diff --git a/src/scene.S b/src/scene.S index 8a8404c..d4e1ac8 100644 --- a/src/scene.S +++ b/src/scene.S @@ -8,6 +8,7 @@ .extern AssignAnmScnToLightInfo .extern LoadBlight .extern LoadBlmap +.extern OSReport .text @@ -22,8 +23,16 @@ LoadMapScene: stw r0, 0x34(sp) stw r31, 0x2C(sp) + stw r30, 0x28(sp) + stw r29, 0x24(sp) + lis r30, m_str@h + ori r30, r30, m_str@l + mr r3, r30 + li r4, 1 + crclr 4*cr1+eq + bl OSReport lis r3, currentHeap@h ori r3, r3, currentHeap@l @@ -37,6 +46,10 @@ LoadMapScene: bl MakeScene + mr r3, r30 + li r4, 2 + crclr 4*cr1+eq + bl OSReport # Now make the actual scene! # Get light info @@ -44,9 +57,15 @@ LoadMapScene: bl GetSceneLightInfo mr r31, r3 + mr r3, r30 + li r4, 3 + crclr 4*cr1+eq + bl OSReport + # Get scene/scene.brres lis r3, DVDClass@h ori r3, r3, DVDClass@l + lwz r3, 0(r3) addi r3, r3, 4 lis r4, EnvWorld@h @@ -60,17 +79,32 @@ LoadMapScene: # Got that, now get the AnmScn we want (MainSelect) stw r3, 0x0C(sp) #ResFile + mr r3, r30 + li r4, 4 + crclr 4*cr1+eq + bl OSReport + addi r3, sp, 0xC lis r4, MainSelect@h ori r4, r4, MainSelect@l bl GetAnmScn stw r3, 0x10(sp) + mr r3, r30 + li r4, 5 + crclr 4*cr1+eq + bl OSReport + # Bind it addi r3, sp, 0x10 addi r4, sp, 0x10 bl BindAnmScn + mr r3, r30 + li r4, 6 + crclr 4*cr1+eq + bl OSReport + # Add it to lightinfo mr r3, r31 #This addi r4, sp, 0x10 #AnmScn pointer @@ -83,11 +117,16 @@ LoadMapScene: bl AssignAnmScnToLightInfo + mr r3, r30 + li r4, 7 + crclr 4*cr1+eq + bl OSReport # Now set up the rest of the scene # Get blight lis r3, DVDClass@h ori r3, r3, DVDClass@l + lwz r3, 0(r3) addi r3, r3, 4 lis r4, EnvWorld@h @@ -97,17 +136,28 @@ LoadMapScene: ori r5, r5, BlightW1@l bl GetRes + mr r29, r3 + + mr r3, r30 + li r4, 8 + crclr 4*cr1+eq + bl OSReport # Load it into lightinfo - mr r4, r3 mr r3, r31 + mr r4, r29 bl LoadBlight + mr r3, r30 + li r4, 9 + crclr 4*cr1+eq + bl OSReport # Do the same for blmap lis r3, DVDClass@h ori r3, r3, DVDClass@l + lwz r3, 0(r3) addi r3, r3, 4 lis r4, EnvWorld@h @@ -117,14 +167,26 @@ LoadMapScene: ori r5, r5, BlmapW1@l bl GetRes + mr r29, r3 + + mr r3, r30 + li r4, 10 + crclr 4*cr1+eq + bl OSReport # Load it into its class - mr r4, r3 lwz r3, 0x14(r31) + mr r4, r29 bl LoadBlmap + mr r3, r30 + li r4, 11 + crclr 4*cr1+eq + bl OSReport # DONE!! + lwz r29, 0x24(sp) + lwz r30, 0x28(sp) lwz r31, 0x2C(sp) lwz r0, 0x34(sp) @@ -145,5 +207,7 @@ Zero: .float 0.0 BlightW1: .string "light/W8.blight" BlmapW1: .string "light/W8.blmap" +m_str: .string "LMS:%d\n" + .align 4 diff --git a/src/wm_hud.cpp b/src/wm_hud.cpp new file mode 100644 index 0000000..670683c --- /dev/null +++ b/src/wm_hud.cpp @@ -0,0 +1,57 @@ +#include "worldmap.h" + +dWMHud_c *dWMHud_c::instance = 0; + +dWMHud_c *dWMHud_c::build() { + OSReport("Creating WM_Hud\n"); + + void *buffer = AllocFromGameHeap1(sizeof(dWMHud_c)); + dWMHud_c *c = new(buffer) dWMHud_c; + + OSReport("Created WM_Hud @ %p\n", c); + + instance = c; + return c; +} + + + +dWMHud_c::dWMHud_c() { + layoutLoaded = false; +} + + +int dWMHud_c::onCreate() { + if (!layoutLoaded) { + bool gotFile = layout.loadArc("maphud.arc", false); + if (!gotFile) + return false; + + layout.build("banner.brlyt"); + + layoutLoaded = true; + } + + return true; +} + + +int dWMHud_c::onDelete() { + return layout.free(); +} + + +int dWMHud_c::onExecute() { + layout.execAnimations(); + layout.update(); + + return true; +} + + +int dWMHud_c::onDraw() { + layout.scheduleForDrawing(); + + return true; +} + diff --git a/src/wm_map.cpp b/src/wm_map.cpp index 83ed637..ad3500d 100644 --- a/src/wm_map.cpp +++ b/src/wm_map.cpp @@ -16,8 +16,9 @@ dWMMap_c *dWMMap_c::build() { - int dWMMap_c::onCreate() { + SpammyReport("dWMMap_c::onCreate() called\n"); + // Get the resource void *scnRes = dScNewerWorldMap_c::instance->resMng['SCN0']; if (scnRes == 0) { @@ -25,12 +26,17 @@ int dWMMap_c::onCreate() { return false; } + testID++; + data = (WMSceneDataHeader*)scnRes; + SpammyReport("Loaded resource: %d nodes\n", data->nodeCount); // load up all the nodes, and fix up all the name offsets while we're at it + SpammyReport("Allocating node array\n"); nodes = new WMSceneNode[data->nodeCount]; // link the mHeapAllocator so it can be used for models + SpammyReport("Linking allocator\n"); allocator.link(-1, GameHeaps[0], 0, 0x20); for (int i = 0; i < data->nodeCount; i++) { @@ -41,8 +47,10 @@ int dWMMap_c::onCreate() { node->loadFrom(nodeData, &allocator); } + SpammyReport("Unlinking allocator\n"); allocator.unlink(); + SpammyReport("dWMMap_c::onCreate() completed\n"); return true; } @@ -60,10 +68,14 @@ int dWMMap_c::onExecute() { int dWMMap_c::onDraw() { + SpammyReport("dWMMap_c::onDraw() called\n"); + for (int i = 0; i < data->nodeCount; i++) { + SpammyReport("Drawing node %d\n", i); nodes[i].draw(); } + SpammyReport("dWMMap_c::onDraw() completed\n"); return true; } @@ -88,12 +100,17 @@ void WMSceneNode::loadFrom(WMSceneDataNode *data, mHeapAllocator_c *allocator) { MapReport(model.setup(&mdl, allocator, 0, 1, 0) ? "Success\n" : "Fail\n"); // todo: more types + SpammyReport("Setting up lightmaps\n"); + if (data->lmType == 0) SetupTextures_Map(&model, 1); else if (data->lmType == 1) SetupTextures_MapObj(&model, 1); + SpammyReport("Lightmaps done\n"); + model.setDrawMatrix(data->matrix); + SpammyReport("Node is ready\n"); } diff --git a/src/wm_player.cpp b/src/wm_player.cpp index ef838a2..a7c150a 100644 --- a/src/wm_player.cpp +++ b/src/wm_player.cpp @@ -19,51 +19,6 @@ int daWMPlayer_c::onCreate() { current_param = 0; - /*//#define BRRES_NAME "fruits_kusa_gake" - //#define MODEL_NAME "fruits_kusa_gake_S" - - #define BRRES_NAME "bgB_4502" - #define MODEL_NAME BRRES_NAME - - OSReport("Loading nw4r model\n"); - //LoadFile(&this->nw4rMdlFH, "/Object/" BRRES_NAME ".arc"); - LoadFile(&this->nw4rMdlFH, "/Object/CrapMap.arc"); - OSReport("Loaded. Reading arc\n"); - ARCHandle arc; - ARCFileInfo keyinfo; - ARCInitHandle(this->nw4rMdlFH.filePtr, &arc); - //bool arcres = ARCOpen(&arc, "g3d/" BRRES_NAME ".brres", &keyinfo); - bool arcres = ARCOpen(&arc, "g3d/model.brres", &keyinfo); - OSReport(arcres ? "Success\n" : "Fail\n"); - - OSReport("Getting nw4r model\n"); - //void *brres = DVD_GetFile(GetDVDClass2(), "fruits_kusa_gake", "g3d/fruits_kusa_gake.brres"); - - OSReport("Done. Constructing model\n"); - void *brres = ARCGetStartAddrInMem(&keyinfo); - OSReport("brres @ %p\n", brres); - nw4r::g3d::ResFile resfile(brres); - OSReport(resfile.CheckRevision() ? "Success\n" : "Fail\n"); - resfile.Init(); - OSReport(resfile.Bind(resfile) ? "Success\n" : "Fail\n"); - //void *mdl = resfile.GetResMdl(MODEL_NAME); - void *mdl = resfile.GetResMdl("CrapMap"); - OSReport("MDL @ %p, %d\n", mdl, 1099); - //this->nw4rMdlTest = nw4r::g3d::ConstructScnMdl(mdl, 0x20, 1); - //this->nw4rMdlTest = nw4r::g3d::ConstructScnMdlSimple(mdl, 1); - OSReport(this->allocator.link(-1, GameHeaps[0], 0, 0x20) ? "Success\n" : "Fail\n"); - OSReport(this->nw4rMdl.setup(&mdl, &this->allocator, 0, 1, 0) ? "Success\n" : "Fail\n"); - //this->nw4rMdl.sub_80064BF0(); - //this->nw4rMdl.oneSetupType(); - OSReport("Unlink returned %d\n", this->allocator.unlink()); - OSReport("Done!\n"); - - Mtx asdf; - MTXIdentity(asdf); - this->nw4rMdl.setDrawMatrix(asdf); - - ARCClose(&keyinfo);*/ - return true; } @@ -157,10 +112,6 @@ int daWMPlayer_c::onExecute() { int daWMPlayer_c::onDraw() { this->modelHandler->draw(); - //OSReport("Adding to scene\n"); - //this->nw4rMdl.scheduleForDrawing(); - //OSReport("done\n"); - return true; } diff --git a/src/worldmap.cpp b/src/worldmap.cpp index 12c3486..4f8b0c5 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -97,11 +97,15 @@ dScNewerWorldMap_c::dScNewerWorldMap_c() { #define CONT_UNK3(cont) (*((bool*)(((u32)(cont))+0x2E0))) bool WMInit_StartLoading(void *ptr) { + SpammyReport("WMInit_StartLoading called\n"); + DVD_Start(); return true; } bool WMInit_LoadSIAnims(void *ptr) { + SpammyReport("WMInit_LoadSIAnims called\n"); + DVD_LoadFile(GetDVDClass(), "WorldMap", "SI_kinoko", 0); DVD_LoadFile(GetDVDClass(), "WorldMap", "SI_fireflower", 0); DVD_LoadFile(GetDVDClass(), "WorldMap", "SI_iceflower", 0); @@ -112,19 +116,28 @@ bool WMInit_LoadSIAnims(void *ptr) { } bool WMInit_EndLoading(void *ptr) { - if (DVD_StillLoading(GetDVDClass2())) + SpammyReport("WMInit_EndLoading called\n"); + + if (DVD_StillLoading(GetDVDClass2())) { + SpammyReport("WMInit_EndLoading returning false\n"); return false; + } DVD_End(); + SpammyReport("WMInit_EndLoading returning true\n"); return true; } bool WMInit_LoadResources(void *ptr) { + SpammyReport("WMInit_LoadResources returning true\n"); + dScNewerWorldMap_c *wm = (dScNewerWorldMap_c*)ptr; return wm->resMng.loadSet("MMFullWorld"); } bool WMInit_SetupWait(void *ptr) { + SpammyReport("WMInit_SetupWait called\n"); + dScNewerWorldMap_c *wm = (dScNewerWorldMap_c*)ptr; bool success = true; @@ -142,6 +155,8 @@ bool WMInit_SetupWait(void *ptr) { } bool WMInit_SetupExtra(void *ptr) { + SpammyReport("WMInit_SetupExtra called\n"); + // ok, now we can set up other required shit dScNewerWorldMap_c *wm = (dScNewerWorldMap_c*)ptr; @@ -176,16 +191,22 @@ bool WMInit_SetupExtra(void *ptr) { // is last param correct? must check :/ wm->map = (dWMMap_c*)CreateParentedObject(WM_MAP, wm, 0, 0); + wm->hud = (dWMHud_c*)CreateParentedObject(WM_HUD, wm, 0, 0); return true; } bool WMInit_SetupWipe(void *ptr) { + SpammyReport("WMInit_SetupWipe called\n"); + dScNewerWorldMap_c *wm = (dScNewerWorldMap_c*)ptr; - if (wm->hasUninitialisedProcesses()) + if (wm->hasUninitialisedProcesses()) { + SpammyReport("WMInit_SetupWipe returning false\n"); return false; + } + SpammyReport("WMInit_SetupWipe returning true\n"); return true; } @@ -255,19 +276,35 @@ void dScNewerWorldMap_c::StartLevel(LevelInfo::Entry *entry) { int dScNewerWorldMap_c::onCreate() { + SpammyReport("onCreate() called\n"); + + SpammyReport("LoadMapScene()\n"); LoadMapScene(); + + SpammyReport("GameSetup__LoadScene(0)\n"); GameSetup__LoadScene(0); // lol, stolen from GAME_SETUP + SpammyReport("select cursor\n"); this->selectCursor = CreateParentedObject(SELECT_CURSOR, this, 0, 0); + + SpammyReport("cs menu\n"); this->csMenu = CreateParentedObject(COURSE_SELECT_MENU, this, 0, 0); + + SpammyReport("yes no window\n"); this->yesNoWindow = CreateParentedObject(YES_NO_WINDOW, this, 0, 0); + + SpammyReport("number of people change\n"); this->numPeopleChange = CreateParentedObject(NUMBER_OF_PEOPLE_CHANGE, this, 0, 0); for (int i = 0; i < 4; i++) { + SpammyReport("ccsb %d\n", i); void *ccsb = CreateParentedObject(CHARACTER_CHANGE_SELECT_BASE, this, i, 0); + SpammyReport("ccsc %d\n", i); void *ccsc = CreateParentedObject(CHARACTER_CHANGE_SELECT_CONTENTS, this, i, 0); + SpammyReport("ccsa %d\n", i); void *ccsa = CreateParentedObject(CHARACTER_CHANGE_SELECT_ARROW, this, i, 0); + SpammyReport("ccsi %d\n", i); void *cci = CreateParentedObject(CHARACTER_CHANGE_INDICATOR, this, i, 0); NPCHG_CCSB(this->numPeopleChange, i) = ccsb; @@ -276,32 +313,43 @@ int dScNewerWorldMap_c::onCreate() { NPCHG_CCI(this->numPeopleChange, i) = cci; } + SpammyReport("continue\n"); this->continueObj = CreateParentedObject(CONTINUE, this, 0, 0); // check if we need to handle Continue if (CheckIfContinueShouldBeActivated()) { + SpammyReport("continue is activated\n"); this->state = STATE_CONTINUE_WAIT; CONT_UNK1(this->continueObj) = true; CONT_UNK2(this->continueObj) = true; CONT_UNK3(this->continueObj) = false; } else { + SpammyReport("continue is not activated\n"); this->state = STATE_NORMAL; } + SpammyReport("stock item\n"); this->stockItem = CreateParentedObject(STOCK_ITEM, this, 0, 0); + SpammyReport("stock item shadow\n"); this->stockItemShadow = CreateParentedObject(STOCK_ITEM_SHADOW, this, 0, 0); STKI_SHADOW(this->stockItem) = this->stockItemShadow; + SpammyReport("easy pairing\n"); this->easyPairing = CreateParentedObject(EASY_PAIRING, this, 0, 0); + SpammyReport("world camera\n"); CreateParentedObject(WORLD_CAMERA, this, 0, 0); + SpammyReport("setting NewerMapDrawFunc\n"); *CurrentDrawFunc = NewerMapDrawFunc; // level info + SpammyReport("loading level info file\n"); levelInfoFile.open("/NewerRes/LevelInfo.bin"); + SpammyReport("preparing level info\n"); levelInfo.load(levelInfoFile.ptr()); + SpammyReport("onCreate() completed\n"); return true; } diff --git a/src/worldmap.h b/src/worldmap.h index 5378c73..553abdd 100644 --- a/src/worldmap.h +++ b/src/worldmap.h @@ -12,6 +12,7 @@ #define __NEWER_WORLDMAP_H #define WM_DEBUGGING +#define WM_SPAMMY_DEBUGGING #include #include @@ -36,9 +37,34 @@ enum WMDirection { inline void MapReport(const char *str, ...) { } #endif +#ifdef WM_SPAMMY_DEBUGGING +#define SpammyReport OSReport +#else +inline void SpammyReport(const char *str, ...) { } +#endif + void NewerMapDrawFunc(); +// Replacing some process IDs +#define WM_HUD WM_ANTLION + + +class dWMHud_c : public dBase_c { +public: + dWMHud_c(); + + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + bool layoutLoaded; + m2d::EmbedLayout_c layout; + + static dWMHud_c *build(); + static dWMHud_c *instance; +}; class dWorldCamera_c : public dBase_c { @@ -108,6 +134,7 @@ public: daWMPlayer_c *player; dWMMap_c *map; + dWMHud_c *hud; bool isMoving; WMPathPoint *currentPoint; diff --git a/worldmap.yaml b/worldmap.yaml index 292006f..679b81e 100644 --- a/worldmap.yaml +++ b/worldmap.yaml @@ -3,6 +3,7 @@ source_files: - ../src/worldmap.cpp - ../src/wm_player.cpp - ../src/wm_map.cpp + - ../src/wm_hud.cpp - ../src/world_camera.cpp - ../src/worldmapdata.cpp - ../src/wmresourcemng.cpp @@ -33,6 +34,11 @@ hooks: src_addr_pal: 0x80984710 target_func: 'dWMMap_c::build(void)' + - name: BuildWMHud + type: add_func_pointer + src_addr_pal: 0x80981A3C + target_func: 'dWMHud_c::build(void)' + # fix the STOCK_ITEM references - name: StockItemFix type: patch -- cgit v1.2.3