diff options
author | Treeki <treeki@gmail.com> | 2013-01-17 09:23:55 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2013-01-17 09:23:55 +0100 |
commit | 1e2fe2181af8215e6da3f55d0350385d0af2f7e0 (patch) | |
tree | 697f2105ceedd031f901c896d2747ccdfc2b43bb /src | |
parent | 4a51200b922d2ed0896562d95d1d9e390a014db3 (diff) | |
download | kamek-1e2fe2181af8215e6da3f55d0350385d0af2f7e0.tar.gz kamek-1e2fe2181af8215e6da3f55d0350385d0af2f7e0.zip |
myriad updates and fixes to EVERYTHING
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/core.cpp | 42 | ||||
-rw-r--r-- | src/koopatlas/core.h | 4 | ||||
-rw-r--r-- | src/koopatlas/hud.cpp | 27 | ||||
-rw-r--r-- | src/koopatlas/hud.h | 3 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 1 | ||||
-rw-r--r-- | src/koopatlas/shop.cpp | 70 | ||||
-rw-r--r-- | src/koopatlas/shop.h | 4 | ||||
-rw-r--r-- | src/poweruphax.S | 373 | ||||
-rw-r--r-- | src/poweruphax.cpp | 78 |
9 files changed, 540 insertions, 62 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index e9ae989..f0a57af 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -109,14 +109,6 @@ dScKoopatlas_c::dScKoopatlas_c() : state(this) { #define NPCHG_CCI(npc,idx) (((void**)(((u32)(npc))+0xA4))[(idx)]) #define NPCHG_2DPLAYER(npc,idx) (((void**)(((u32)(npc))+0x64C))[(idx)]) -#define STKI_SETUP_DONE(si) (*((bool*)(((u32)(si))+0x310))) -#define STKI_SHADOW(si) (*((void**)(((u32)(si))+0x310))) -#define STKI_2DPLAYER(si,idx) (((void**)(((u32)(si))+0x2E4))[(idx)]) -#define STKI_ITEM(si,idx) (((void**)(((u32)(si))+0x2F4))[(idx)]) -#define STKI_SHOW(si) (*((bool*)(((u32)(si))+0x8DD))) - -#define SIS_SETUP_DONE(sis) (*((bool*)(((u32)(sis))+0x260))) - #define CCSB_ACTIVE(ccsb) (*((bool*)(((u32)(ccsb))+0x29C))) #define CCSC_ACTIVE(ccsc) (*((bool*)(((u32)(ccsc))+0x2A1))) @@ -218,8 +210,8 @@ bool WMInit_SetupWait(void *ptr) { success &= NPCHG_SETUP_DONE(wm->numPeopleChange); success &= YESNO_SETUP_DONE(wm->yesNoWindow); success &= CONT_SETUP_DONE(wm->continueObj); - success &= STKI_SETUP_DONE(wm->stockItem); - success &= SIS_SETUP_DONE(wm->stockItemShadow); + success &= wm->stockItem->layoutLoaded; + success &= wm->stockItemShadow->layoutLoaded; success &= EASYP_SETUP_DONE(wm->easyPairing); return success; @@ -243,14 +235,14 @@ bool WMInit_SetupExtra(void *ptr) { // first up: player models for Stocked Items for (int i = 0; i < 4; i++) { void *obj = CreateChildObject(WM_2D_PLAYER, wm, i, 0, 0); - STKI_2DPLAYER(wm->stockItem,i) = obj; + wm->stockItem->player2d[i] = obj; NPCHG_2DPLAYER(wm->numPeopleChange,i) = obj; } // next: items for the Powerup screen - for (int i = 0; i < 7; i++) { - void *obj = CreateChildObject(WM_ITEM, wm, i, 0, 0); - STKI_ITEM(wm->stockItem,i) = obj; + for (int i = 0; i < 8; i++) { + void *obj = CreateChildObject(WM_ITEM, wm, i==7?6:i, 0, 0); + wm->stockItem->newItemPtr[i] = obj; } // need Player before we can set up paths @@ -398,10 +390,10 @@ int dScKoopatlas_c::onCreate() { this->continueObj = CreateParentedObject(CONTINUE, this, 0, 0); SpammyReport("stock item\n"); - this->stockItem = CreateParentedObject(STOCK_ITEM, this, 0, 0); + this->stockItem = (dStockItem_c*)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; + this->stockItemShadow = (dStockItemShadow_c*)CreateParentedObject(STOCK_ITEM_SHADOW, this, 0, 0); + stockItem->shadow = stockItemShadow; SpammyReport("easy pairing\n"); this->easyPairing = CreateParentedObject(EASY_PAIRING, this, 0, 0); @@ -516,11 +508,13 @@ void dScKoopatlas_c::executeState_Normal() { // Nothing related to the menu is going on if (nowPressed & WPAD_ONE) { - STKI_SHOW(this->stockItem) = true; + stockItem->show = true; state.setState(&StateID_PowerupsWait); + hud->hideAll(); } else if (nowPressed & WPAD_PLUS) { CSMENU_ACTIVE(this->csMenu) = true; state.setState(&StateID_CSMenu); + hud->hideAll(); } else if (nowPressed & WPAD_MINUS) { pathManager.unlockAllPaths(2); } else if (nowPressed & WPAD_A) { @@ -582,6 +576,7 @@ void dScKoopatlas_c::executeState_CSMenu() { } else { // Ok, change back to STATE_Normal + hud->unhideAll(); state.setState(&StateID_Normal); } } @@ -637,6 +632,7 @@ void dScKoopatlas_c::executeState_TitleConfirmHitWait() { if (!YESNO_OPENING(this->yesNoWindow)) { if (YESNO_CURRENT(this->yesNoWindow) == 1) { state.setState(&StateID_Normal); + hud->unhideAll(); } else { state.setState(&StateID_Limbo); StartTitleScreenStage(false, 0); @@ -680,6 +676,7 @@ void dScKoopatlas_c::executeState_PlayerChangeWait() { } state.setState(&StateID_Normal); + hud->unhideAll(); } } @@ -712,10 +709,11 @@ void dScKoopatlas_c::executeState_EasyPairingWait() { // STATE_PowerupsWait : Wait for the user to exit the Powerups screen. void dScKoopatlas_c::executeState_PowerupsWait() { - if (!STKI_SHOW(this->stockItem)) { + if (!stockItem->show) { player->modelHandler->mdlClass->setPowerup(Player_Powerup[0]); state.setState(&StateID_Normal); + hud->unhideAll(); } } @@ -727,6 +725,7 @@ void dScKoopatlas_c::executeState_ShopWait() { if (!shop->visible) { state.setState(&StateID_Normal); + hud->unhideAll(); } } @@ -738,6 +737,7 @@ void dScKoopatlas_c::executeState_CoinsWait() { if (!coins->visible) { state.setState(&StateID_Normal); + hud->unhideAll(); } } @@ -793,6 +793,7 @@ void dScKoopatlas_c::executeState_SaveWindowClose() { if (!YESNO_VISIBLE(this->yesNoWindow)) { if (YESNO_CURRENT(this->yesNoWindow) == 1) { state.setState(&StateID_Normal); + hud->unhideAll(); } else { state.setState(&StateID_SaveDo); SaveGame(0, false); @@ -836,6 +837,7 @@ void dScKoopatlas_c::executeState_SaveEndCloseWait() { if (!YESNO_OPENING(this->yesNoWindow)) { state.setState(&StateID_Normal); + hud->unhideAll(); } } @@ -891,6 +893,7 @@ void dScKoopatlas_c::executeState_QuickSaveWindowClose() { if (!YESNO_VISIBLE(this->yesNoWindow)) { if (YESNO_CURRENT(this->yesNoWindow) == 1) { state.setState(&StateID_Normal); + hud->unhideAll(); } else { state.setState(&StateID_QuickSaveDo); SaveGame(0, true); @@ -934,6 +937,7 @@ void dScKoopatlas_c::executeState_QuickSaveEndCloseWait() { if (!YESNO_OPENING(this->yesNoWindow)) { if (YESNO_CURRENT(this->yesNoWindow) == 1) { state.setState(&StateID_Normal); + hud->unhideAll(); } else { state.setState(&StateID_Limbo); StartTitleScreenStage(false, 0); diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 93cc257..788ad62 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -86,8 +86,8 @@ class dScKoopatlas_c : public dScene_c { void *numPeopleChange; void *yesNoWindow; void *continueObj; - void *stockItem; - void *stockItemShadow; + dStockItem_c *stockItem; + dStockItemShadow_c *stockItemShadow; void *easyPairing; diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 4d678c6..1032512 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -24,7 +24,9 @@ dWMHud_c::dWMHud_c() { enum WMHudAnimation { SHOW_LIVES = 0, SHOW_HEADER, - SHOW_FOOTER + SHOW_FOOTER, + HIDE_ALL, + UNHIDE_ALL, }; @@ -46,16 +48,23 @@ int dWMHud_c::onCreate() { layout.layout.rootPane->scale.y = 0.7711f; } - static const char *brlanNames[2] = {"MapHUD_ShowMain.brlan", "MapHUD_ShowHeader.brlan"}; - static const char *groupNames[3] = {"G_Lives", "G_Header", "G_Footer"}; + static const char *brlanNames[] = { + "MapHUD_ShowMain.brlan", "MapHUD_ShowHeader.brlan", + "MapHUD_HideAll.brlan", "MapHUD_UnhideAll.brlan", + }; + static const char *groupNames[] = { + "G_Lives", "G_Header", "G_Footer", + "G_Hideables", "G_Hideables", + }; - layout.loadAnimations(brlanNames, 2); - layout.loadGroups(groupNames, (int[3]){0, 1, 0}, 3); + layout.loadAnimations(brlanNames, 4); + layout.loadGroups(groupNames, (int[5]){0, 1, 0, 2, 3}, 5); layout.disableAllAnimations(); layout.enableNonLoopAnim(SHOW_LIVES); layout.resetAnim(SHOW_FOOTER); layout.resetAnim(SHOW_HEADER); + layout.resetAnim(HIDE_ALL); static const char *tbNames[2] = {"MenuButtonInfo", "ItemsButtonInfo"}; layout.setLangStrings(tbNames, (int[2]){12, 15}, 4, 2); @@ -162,6 +171,14 @@ int dWMHud_c::onDraw() { } +void dWMHud_c::hideAll() { + layout.enableNonLoopAnim(HIDE_ALL); +} +void dWMHud_c::unhideAll() { + layout.enableNonLoopAnim(UNHIDE_ALL); +} + + void dWMHud_c::playShowAnim(int id) { diff --git a/src/koopatlas/hud.h b/src/koopatlas/hud.h index 32a09be..982b38a 100644 --- a/src/koopatlas/hud.h +++ b/src/koopatlas/hud.h @@ -27,6 +27,9 @@ class dWMHud_c : public dBase_c { void setupLives(); + void hideAll(); + void unhideAll(); + private: void playShowAnim(int id); void playHideAnim(int id); diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 6cff759..7f4b754 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -861,6 +861,7 @@ void dWMPathManager_c::activatePoint() { if (l == 98) { dWMShop_c::instance->show(w); + dWMHud_c::instance->hideAll(); dScKoopatlas_c::instance->state.setState(&dScKoopatlas_c::instance->StateID_ShopWait); return; } diff --git a/src/koopatlas/shop.cpp b/src/koopatlas/shop.cpp index 025a7d9..63d23e2 100644 --- a/src/koopatlas/shop.cpp +++ b/src/koopatlas/shop.cpp @@ -17,7 +17,6 @@ void dWMShop_c::ShopModel_c::setupItem(float x, float y, ItemTypes type) { { "I_star", "g3d/I_star.brres", "I_star", "wait2" }, { "I_hammer", "g3d/I_fireflower.brres", "I_fireflower", "wait2" }, { "I_kinoko_bundle","g3d/I_life_kinoko.brres", "I_life_kinoko", "wait2" }, - { "obj_coin", "g3d/obj_coin.brres", "obj_coin", "wait2" } }; this->x = x; @@ -33,12 +32,7 @@ void dWMShop_c::ShopModel_c::setupItem(float x, float y, ItemTypes type) { nw4r::g3d::ResMdl mdlRes = res.GetResMdl(Produce[id][2]); model.setup(mdlRes, &allocator, 0x224, 1, 0); - if (type == COINS) { - SetupTextures_MapObj(&model, 1); - this->y += 20.0f; - scaleFactor = 2.7f; - } else - SetupTextures_Item(&model, 1); + SetupTextures_Item(&model, 1); nw4r::g3d::ResAnmChr anmChr = res.GetResAnmChr(Produce[id][3]); animation.setup(mdlRes, anmChr, &allocator, 0); @@ -194,6 +188,11 @@ int dWMShop_c::onCreate() { name[8] = crap[i*2]; name[9] = crap[i*2+1]; BtnRight[i] = layout.findPictureByName(name); + + strcpy(name, "BtnXX"); + name[3] = crap[i*2]; + name[4] = crap[i*2+1]; + Buttons[i] = layout.findPaneByName(name); } leftCol.setTexMap(BtnLeft[0]->material->texMaps); @@ -206,6 +205,8 @@ int dWMShop_c::onCreate() { rightCol.applyAlso(BtnRight[i]->material->texMaps); } + Buttons[5]->size.x = 252.0f; // don't feel like editing rlyt + layoutLoaded = true; } @@ -301,7 +302,9 @@ void dWMShop_c::executeState_ButtonActivateWait() { if (!layout.isAnyAnimOn()) state.setState(&StateID_Wait); } -void dWMShop_c::endState_ButtonActivateWait() { OSReport("Wait"); } +void dWMShop_c::endState_ButtonActivateWait() { + UpdateSelectCursor(Buttons[0], 0, false); +} // Wait void dWMShop_c::beginState_Wait() { timer = 1; MapSoundPlayer(SoundRelatedClass, SE_OBJ_CLOUD_BLOCK_TO_JUGEM, 1); } @@ -352,6 +355,7 @@ void dWMShop_c::executeState_Wait() { layout.enableNonLoopAnim(DEACTIVATE_BUTTON+selected); layout.enableNonLoopAnim(ACTIVATE_BUTTON+newSelection); + UpdateSelectCursor(Buttons[newSelection], 0, false); selected = newSelection; if (newSelection <= 3) @@ -368,6 +372,8 @@ void dWMShop_c::beginState_HideWait() { timer = 26; MapSoundPlayer(SoundRelatedClass, SE_OBJ_CS_KINOHOUSE_DISAPP, 1); + + HideSelectCursor(SelectCursorPointer, 0); } void dWMShop_c::executeState_HideWait() { if (timer > 0) { @@ -394,7 +400,6 @@ void dWMShop_c::endState_HideWait() { // 6 = Starman - 2 // 7 = Hammer - 3 // 8 = 1-ups - 2 -// 9 = Coins - 1 // // Format: 1coin, 1coin, 2coins, 3coins, 5coins[3] (Value 6-9), 8coins[5] (Value 10-15) // @@ -403,37 +408,37 @@ void dWMShop_c::endState_HideWait() { const dWMShop_c::ItemTypes dWMShop_c::Inventory[10][12] = { { // Yoshi's Island - COINS, MUSHROOM, FIRE_FLOWER, PROPELLER, + MUSHROOM, FIRE_FLOWER, ICE_FLOWER, PROPELLER, FIRE_FLOWER, ICE_FLOWER, FIRE_FLOWER, MUSHROOM, MUSHROOM, ONE_UP, PROPELLER, PROPELLER }, { // Desert - COINS, MUSHROOM, FIRE_FLOWER, PROPELLER, + MUSHROOM, FIRE_FLOWER, ICE_FLOWER, PROPELLER, FIRE_FLOWER, STARMAN, FIRE_FLOWER, MUSHROOM, FIRE_FLOWER, FIRE_FLOWER, PROPELLER, PROPELLER }, { // Mountain - COINS, MUSHROOM, MINI_SHROOM, PROPELLER, + MUSHROOM, FIRE_FLOWER, MINI_SHROOM, PROPELLER, MUSHROOM, MINI_SHROOM, PROPELLER, MUSHROOM, MINI_SHROOM, PROPELLER, PROPELLER, HAMMER }, { // Japan - COINS, MUSHROOM, ONE_UP, HAMMER, + MUSHROOM, FIRE_FLOWER, ONE_UP, HAMMER, ONE_UP, ONE_UP, ONE_UP, PROPELLER, ICE_FLOWER, ONE_UP, FIRE_FLOWER, PROPELLER }, { // FreezeFlame - COINS, MUSHROOM, ICE_FLOWER, PENGUIN, + MUSHROOM, FIRE_FLOWER, ICE_FLOWER, PENGUIN, ICE_FLOWER, PENGUIN, ICE_FLOWER, ICE_FLOWER, PENGUIN, PENGUIN, PENGUIN, ICE_FLOWER }, { // Ghost - COINS, MUSHROOM, STARMAN, PROPELLER, + MUSHROOM, FIRE_FLOWER, STARMAN, PROPELLER, MINI_SHROOM, PROPELLER, MINI_SHROOM, - PROPELLER, PROPELLER, COINS, PROPELLER, PROPELLER + PROPELLER, PROPELLER, MUSHROOM, PROPELLER, PROPELLER }, { // Space - COINS, MUSHROOM, STARMAN, HAMMER, + MUSHROOM, STARMAN, ONE_UP, HAMMER, STARMAN, STARMAN, STARMAN, HAMMER, HAMMER, ONE_UP, HAMMER, HAMMER }, @@ -443,12 +448,12 @@ const dWMShop_c::ItemTypes dWMShop_c::Inventory[10][12] = { PROPELLER, HAMMER, PROPELLER, HAMMER, PROPELLER }, { // Unknown - COINS, MUSHROOM, FIRE_FLOWER, PENGUIN, + MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM }, { // Goldwood - MUSHROOM, ONE_UP, FIRE_FLOWER, MINI_SHROOM, + MUSHROOM, FIRE_FLOWER, ONE_UP, PENGUIN, FIRE_FLOWER, PROPELLER, FIRE_FLOWER, FIRE_FLOWER, FIRE_FLOWER, STARMAN, FIRE_FLOWER, FIRE_FLOWER } @@ -528,7 +533,7 @@ void dWMShop_c::loadInfo() { void dWMShop_c::buyItem(int item) { static int itemDefs[6][3] = { // Cost, Start Index, Count - {1, 0, 1}, {1, 1, 1}, {2, 2, 1}, {3, 3, 1}, + {1, 0, 1}, {2, 1, 1}, {2, 2, 1}, {3, 3, 1}, {5, 4, 3}, {8, 7, 5} }; @@ -542,7 +547,6 @@ void dWMShop_c::buyItem(int item) { MapSoundPlayer(SoundRelatedClass, SE_SYS_DECIDE, 1); - SaveFile *file = GetSaveFile(); SaveBlock *block = file->GetBlock(file->header.current_file); @@ -558,32 +562,28 @@ void dWMShop_c::buyItem(int item) { appliedItems[(int)Inventory[shopKind][invStartIndex]]++; // TODO: Make this work with hammers - for (int i = 0; i < 7; i++) { + for (int i = 0; i < 8; i++) { block->powerups_available[i] += appliedItems[i]; if (block->powerups_available[i] > 99) block->powerups_available[i] = 99; + + dScKoopatlas_c::instance->stockItem->counts[i] = block->powerups_available[i]; } - // Apply coins and lives to everyone + // Apply lives to everyone for (int i = 0; i < 4; i++) { - block->player_coins[i] += (appliedItems[(int)COINS] * 50); - - while (block->player_coins[i] >= 100) { - block->player_coins[i] -= 100; - block->player_lives[i]++; - } - - block->player_lives[i] += appliedItems[(int)ONE_UP]; - if (block->player_lives[i] > 99) - block->player_lives[i] = 99; + Player_Lives[i] += appliedItems[(int)ONE_UP]; + if (Player_Lives[i] > 99) + Player_Lives[i] = 99; } + if (appliedItems[(int)ONE_UP] > 0) + MapSoundPlayer(SoundRelatedClass, SE_SYS_100COIN_ONE_UP, 1); + // load the coin count int scCount = getUnspentStarCoinCount(); WriteNumberToTextBox(&scCount, CoinCount, false); WriteNumberToTextBox(&scCount, CoinCountShadow, false); - - state.setState(&StateID_HideWait); } diff --git a/src/koopatlas/shop.h b/src/koopatlas/shop.h index fb948a9..4a79861 100644 --- a/src/koopatlas/shop.h +++ b/src/koopatlas/shop.h @@ -44,7 +44,6 @@ class dWMShop_c : public dActor_c { STARMAN, HAMMER, ONE_UP, - COINS, ITEM_TYPE_COUNT }; @@ -62,6 +61,9 @@ class dWMShop_c : public dActor_c { nw4r::lyt::Picture *BtnLeft[6], *BtnMid[6], *BtnRight[6]; + nw4r::lyt::Pane + *Buttons[6]; + dTexMapColouriser_c leftCol, midCol, rightCol; class ShopModel_c { diff --git a/src/poweruphax.S b/src/poweruphax.S index ef957e2..16800e6 100644 --- a/src/poweruphax.S +++ b/src/poweruphax.S @@ -1044,3 +1044,376 @@ StrongboxGiveBattleItem: .data IndexItemsForStockItem: .byte 0,1,2,4,5,6,3,7 + + +SLGWindow: .string "A00_Window" +SLGBtn0: .string "B00_itemButton" +SLGBtn1: .string "B01_itemButton" +SLGBtn2: .string "B02_itemButton" +SLGBtn3: .string "B03_itemButton" +SLGBtn4: .string "B04_itemButton" +SLGBtn5: .string "B05_itemButton" +SLGBtn6: .string "B06_itemButton" +SLGBtn7: .string "HammerGroup" +SLButtonBase00: .string "P_buttonBase_00" +SLButtonBase01: .string "P_buttonBase_01" +SLButtonBase02: .string "P_buttonBase_02" +SLButtonBase03: .string "P_buttonBase_03" +SLButtonBase04: .string "P_buttonBase_04" +SLButtonBase05: .string "P_buttonBase_05" +SLButtonBase06: .string "P_buttonBase_06" +SLButtonBase07: .string "P_buttonBase_07" +SLIcon0: .string "P_iconKinoko_00" +SLIcon1: .string "P_iconFlower_00" +SLIcon2: .string "P_iconPro_00" +SLIcon3: .string "P_iconIce_00" +SLIcon4: .string "P_iconPen_00" +SLIcon5: .string "P_mameKinoko_00" +SLIcon6: .string "P_iconStar_00" +SLIcon7: .string "P_iconHammer_00" +SLIconPane0: .string "N_iconKinoko_00" +SLIconPane1: .string "N_iconFlower_00" +SLIconPane2: .string "N_iconPro_00" +SLIconPane3: .string "N_iconIce_00" +SLIconPane4: .string "N_iconPen_00" +SLIconPane5: .string "N_mameKinoko_00" +SLIconPane6: .string "N_iconStar_00" +SLIconPane7: .string "N_iconHammer_00" +.align 4 +SILayoutGroupNames: +.long SLGWindow +.long SLGBtn0,SLGBtn1,SLGBtn2,SLGBtn6,SLGBtn4,SLGBtn5,SLGBtn3 +.long SLGBtn0,SLGBtn1,SLGBtn2,SLGBtn6,SLGBtn4,SLGBtn5,SLGBtn3 +.long SLGBtn0,SLGBtn1,SLGBtn2,SLGBtn6,SLGBtn4,SLGBtn5,SLGBtn3 +.long SLGBtn0,SLGBtn1,SLGBtn2,SLGBtn6,SLGBtn4,SLGBtn5,SLGBtn3 +.long SLGWindow +.long SLGBtn7,SLGBtn7,SLGBtn7 +SILayoutGroupIDs: +.long 0 +.long 1,1,1,1,1,1,1 +.long 2,2,2,2,2,2,2 +.long 3,3,3,3,3,3,3 +.long 4,4,4,4,4,4,4 +.long 5 +.long 1,3,4 + +SILayoutButtonBases: +.long SLButtonBase00,SLButtonBase01,SLButtonBase02,SLButtonBase06 +.long SLButtonBase04,SLButtonBase05,SLButtonBase03,SLButtonBase07 +SILayoutIconPictures: +.long SLIcon0,SLIcon1,SLIcon2,SLIcon3 +.long SLIcon4,SLIcon5,SLIcon6,SLIcon7 +SILayoutIconPanes: +.long SLIconPane0,SLIconPane1,SLIconPane2,SLIconPane3 +.long SLIconPane4,SLIconPane5,SLIconPane6,SLIconPane7 + +.text +.global SILayoutGroupParams +SILayoutGroupParams: + lis r4, SILayoutGroupNames@h + ori r4, r4, SILayoutGroupNames@l + lis r5, SILayoutGroupIDs@h + ori r5, r5, SILayoutGroupIDs@l + li r6, 0x21 + blr + +# - 0x920 : Button Bases +# - 0x940 : Icon Panes +# - 0x960 : Icon Pictures +.extern getPanes__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt4Panei +.extern getPictures__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt7Picturei +.extern ContinueFromSILayoutExtraStuffs +.global SILayoutExtraStuffs +SILayoutExtraStuffs: + addi r3, r30, 0x74 + lis r4, SILayoutButtonBases@h + ori r4, r4, SILayoutButtonBases@l + addi r5, r30, 0x920 + li r6, 8 + bl getPictures__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt7Picturei + + addi r3, r30, 0x74 + lis r4, SILayoutIconPanes@h + ori r4, r4, SILayoutIconPanes@l + addi r5, r30, 0x940 + li r6, 8 + bl getPanes__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt4Panei + + addi r3, r30, 0x74 + lis r4, SILayoutIconPictures@h + ori r4, r4, SILayoutIconPictures@l + addi r5, r30, 0x960 + li r6, 8 + bl getPictures__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt7Picturei + + li r3, 1 + b ContinueFromSILayoutExtraStuffs + +.global HideItemsByDefault +.extern ContinueFromHideItemsByDefault +HideItemsByDefault: + li r3, 8 + mtctr r3 + mr r4, r31 +meNext: + lwz r9, 0x960(r4) + lbz r5, 0xBB(r9) + rlwinm r5, r5, 0,24,30 + stb r5, 0xBB(r9) + addi r4, r4, 4 + bdnz meNext + + li r8, 0 + li r7, 1 + li r6, 4 + li r5, 0xE + li r0, 0xF + li r3, 1 + b ContinueFromHideItemsByDefault + +.global AddHammerPowerupFinalValue +AddHammerPowerupFinalValue: + li r24, 0 + lis r22, OutputPowerupsByItemID@h + ori r22, r22, OutputPowerupsByItemID@l + blr + +.data +OutputPowerupsByItemID: +.long 1, 2, 4, 6, 5, 3, -1, 7 + +.text +.global FixStockItemEffectPlayer +FixStockItemEffectPlayer: + lwz r0, 0x8A0(r30) + slwi r0, r0, 2 + add r5, r30, r0 + lwz r28, 0x940(r5) + blr + +.global FixStockItemEffectPlayer2 +FixStockItemEffectPlayer2: + lwz r0, 0x8A0(r30) + stw r0, 0x8D0(r30) + blr + +.global FixMoreSIEffectRelatedCrap +FixMoreSIEffectRelatedCrap: + lwz r0, 0x8D0(r31) + slwi r0, r0, 2 + add r3, r31, r0 + lwz r29, 0x940(r3) + blr + + +.global AddHammerSuitAddSound +.extern MakeSFISound +.extern ContinueFromSIAddSound +AddHammerSuitAddSound: + cmpwi r0, 7 + beq _MakeSFISound + b ContinueFromSIAddSound + _MakeSFISound: + b MakeSFISound + +.extern resetAnim__Q23m2d13EmbedLayout_cFib +.extern ContinueFromResetHammerAnimOnOpen +.global ResetHammerAnimOnOpen +ResetHammerAnimOnOpen: + addi r3, r28, 0x74 + li r4, 0x1E + li r5, 0 + bl resetAnim__Q23m2d13EmbedLayout_cFib + addi r3, r28, 0x74 + b ContinueFromResetHammerAnimOnOpen + +.extern ChosenStartChoice +.global PickHammerAsPossibleStartChoice +PickHammerAsPossibleStartChoice: + lwz r0, 0x918(r30) + li r3, 6 + cmpwi r0, 0 + beq notGoodEnough + stw r3, 0x8A0(r30) + b ChosenStartChoice +notGoodEnough: + lwz r0, 0x91C(r30) + li r3, 7 + cmpwi r0, 0 + b _ChosenStartChoice + stw r3, 0x8A0(r30) + _ChosenStartChoice: + b ChosenStartChoice + + +.global ChooseOldButtonOffAnim +ChooseOldButtonOffAnim: + cmpwi r4, 7 + beq useHammerOffAnim + addi r4, r4, 0x16 + blr +useHammerOffAnim: + li r4, 0x20 + blr + +.global ChooseOldButtonOffAnim2 +ChooseOldButtonOffAnim2: + cmpwi r3, 7 + beq useHammerOffAnim2 + addi r0, r3, 0x16 + blr +useHammerOffAnim2: + li r0, 0x20 + blr + +.global ChooseButtonOnAnim +ChooseButtonOnAnim: + cmpwi r4, 7 + beq useHammerOnAnim + addi r4, r4, 1 + blr +useHammerOnAnim: + li r4, 0x1E + blr + +.global DoSISelectCursor +.extern UpdateSelectCursor +DoSISelectCursor: + slwi r0, r0, 2 + add r3, r3, r0 + lwz r3, 0x920(r3) + b UpdateSelectCursor + + +.global ChooseHitButtonAnim +ChooseHitButtonAnim: + cmpwi r4, 7 + beq useHammerHitAnim + addi r4, r4, 0xF + blr +useHammerHitAnim: + li r4, 0x1F + blr + + + +.global UpdateCalcPowerupResult +.extern ContinueFromCalcPowerupResult +UpdateCalcPowerupResult: + cmpwi r3, 7 + bne cprIsDone + li r6, 7 + stb r0, 0xF(r1) +cprIsDone: + b ContinueFromCalcPowerupResult + + + + +.global SISLayoutExtraStuffs +.extern ContinueFromSISLayoutExtraStuffs +.extern findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc +.extern findPictureByName__Q23m2d17EmbedLayoutBase_cCFPCc +SISLayoutExtraStuffs: + addi r3, r30, 0x70 + lis r4, whatever_s@h + ori r4, r4, whatever_s@l + bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc + stw r3, 0x288(r30) + + addi r3, r30, 0x70 + lis r4, fuck_brlyts@h + ori r4, r4, fuck_brlyts@l + bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc + stw r3, 0x284(r30) + + addi r3, r30, 0x70 + lis r4, im_tired_of_this@h + ori r4, r4, im_tired_of_this@l + bl findPictureByName__Q23m2d17EmbedLayoutBase_cCFPCc + stw r3, 0x28C(r30) + + li r3, 1 + b ContinueFromSISLayoutExtraStuffs + +.data +whatever_s: .string "whatever" +fuck_brlyts: .string "fuck_brlyts" +im_tired_of_this: .string "im_tired_of_this" + +.text +.global UpdateSIS +.extern ContinueFromUpdateSIS +.extern WriteNumberToTextBox__FPiPCiPQ34nw4r3lyt7TextBoxb +UpdateSIS: + cmpwi r0, 0 + beq DontUpdateSIS + subi r25, r25, 0x1C + + # replicate this shit + lwz r0, 0x280(r25) + cmpwi r0, 0 + lwz r3, 0x28C(r25) + lbz r0, 0xBB(r3) + beq theresNone + + li r4, 1 + rlwinm r0, r0, 0,24,30 + b changedBase +theresNone: + li r4, 0 + ori r0, r0, 1 +changedBase: + stb r0, 0xBB(r3) + slwi r29, r4, 2 + addi r5, r1, 0x14 + lwzx r27, r26, r29 + li r4, 0 + stw r27, 0x14(r1) + lwz r3, 0x284(r25) + lwz r12, 0(r3) + lwz r12, 0x28(r12) + mtctr r12 + bctrl + + lwzx r29, r28, r29 + addi r5, r1, 0x10 + stw r29, 0x10(r1) + li r4, 2 + lwz r3, 0x284(r25) + lwz r12, 0(r3) + lwz r12, 0x28(r12) + mtctr r12 + bctrl + + addi r5, r1, 0x14 + li r4, 0 + lwz r3, 0x288(r25) + lwz r12, 0(r3) + lwz r12, 0x28(r12) + mtctr r12 + bctrl + + addi r5, r1, 0x10 + li r4, 2 + lwz r3, 0x288(r25) + lwz r12, 0(r3) + lwz r12, 0x28(r12) + mtctr r12 + bctrl + + lwz r5, 0x284(r25) + addi r3, r25, 0x280 + lis r4, ptrToTwo@h + ori r4, r4, ptrToTwo@l + li r6, 1 + bl WriteNumberToTextBox__FPiPCiPQ34nw4r3lyt7TextBoxb + +DontUpdateSIS: + addi r11, r1, 0x40 + b ContinueFromUpdateSIS + +.data +.align 4 +ptrToTwo: .long 2 + diff --git a/src/poweruphax.cpp b/src/poweruphax.cpp index e1dbb87..5140843 100644 --- a/src/poweruphax.cpp +++ b/src/poweruphax.cpp @@ -97,3 +97,81 @@ void dHammerSuitRenderer_c::draw() { shell.scheduleForDrawing(); } + + + + + + + +// NEW VERSION +void CrapUpPositions(Vec *out, const Vec *in); + +void dStockItem_c::setScalesOfSomeThings() { + nw4r::lyt::Pane *ppos = N_forUse_PPos[playerCount]; + + int howManyPlayers = 0; + for (int i = 0; i < 4; i++) { + if (isPlayerActive[i]) { + int picID = getIconPictureIDforPlayer(i); + int charID = Player_ID[i]; + + if (picID != 24) { + nw4r::lyt::Picture *pic = P_icon[picID]; + + Vec in, out; + + in.x = pic->effectiveMtx[0][3]; + in.y = pic->effectiveMtx[1][3]; + in.z = pic->effectiveMtx[2][3]; + + CrapUpPositions(&out, &in); + + u8 *wmp = (u8*)player2d[charID]; + *((float*)(wmp+0xAC)) = out.x; + *((float*)(wmp+0xB0)) = out.y; + *((float*)(wmp+0xB4)) = out.z; + *((float*)(wmp+0x220)) = 0.89999998f; + *((float*)(wmp+0x224)) = 0.89999998f; + *((float*)(wmp+0x228)) = 0.89999998f; + *((float*)(wmp+0x25C)) = 26.0f; + } + howManyPlayers++; + } + } + + + for (int i = 0; i < 8; i++) { + u8 *item = (u8*)newItemPtr[i]; + + nw4r::lyt::Pane *icon = newIconPanes[i]; + + Vec in, out; + in.x = icon->effectiveMtx[0][3]; + in.y = icon->effectiveMtx[1][3]; + in.z = icon->effectiveMtx[2][3]; + + CrapUpPositions(&out, &in); + + *((float*)(item+0xAC)) = out.x; + *((float*)(item+0xB0)) = out.y; + *((float*)(item+0xB4)) = out.z; + *((float*)(item+0x1F4)) = P_buttonBase[i]->scale.x; + *((float*)(item+0x1F8)) = P_buttonBase[i]->scale.y; + *((float*)(item+0x1FC)) = 1.0f; + } + + + nw4r::lyt::Pane *shdRoot = shadow->rootPane; + shdRoot->trans.x = N_stockItem->effectiveMtx[0][3]; + shdRoot->trans.y = N_stockItem->effectiveMtx[1][3]; + shdRoot->trans.z = N_stockItem->effectiveMtx[2][3]; + shdRoot->scale.x = N_stockItem_01->effectiveMtx[0][0]; + shdRoot->scale.y = N_stockItem_01->effectiveMtx[1][1]; + + for (int i = 0; i < 7; i++) + shadow->buttonBases[i]->scale = newButtonBase[i]->scale; + shadow->hammerButtonBase->scale = newButtonBase[7]->scale; +} + + |