From 2226bfeb0dc0892e7aaa9a507031c42515c0ef00 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Fri, 27 Jul 2012 19:14:06 -0500 Subject: Fixed up Starcoin menu --- src/koopatlas/starcoin.cpp | 95 +++++++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 44 deletions(-) (limited to 'src/koopatlas/starcoin.cpp') diff --git a/src/koopatlas/starcoin.cpp b/src/koopatlas/starcoin.cpp index f47d342..22fd044 100644 --- a/src/koopatlas/starcoin.cpp +++ b/src/koopatlas/starcoin.cpp @@ -1,5 +1,5 @@ #include "koopatlas/starcoin.h" - +#include int getStarCoinCountCoins() { SaveBlock *save = GetSaveFile()->GetBlock(-1); @@ -48,13 +48,14 @@ int dWMStarCoin::onCreate() { if (!gotFile) return false; - currentItem = 0; - static const char *brlanNames[2] = {"coin_inWindow.brlan", "coin_outWindow.brlan"}; static const char *groupNames[2] = {"A00_Window", "A00_Window"}; bool output = layout.build("coin.brlyt"); + nw4r::lyt::Pane *red = layout.findPictureByName("red"); + red->alpha = 0; + if (!IsWideScreen()) { layout.clippingEnabled = true; layout.clipX = 0; @@ -116,9 +117,9 @@ int dWMStarCoin::onDraw() { void dWMStarCoin::specialDraw1() { if (!isHidden) { - Vec pos = {250.0f, 170.0f, 1000.0f}; - S16Vec rot = {rotation,0,0}; - Vec scale = {1.0f, 1.0f, 1.0f}; + Vec pos = {330.0f, 250.0f, -1000.0f}; + S16Vec rot = {0,rotation,0}; + Vec scale = {2.0f, 2.0f, 2.0f}; matrix.translation(pos.x, pos.y, pos.z); matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); @@ -137,7 +138,7 @@ void dWMStarCoin::LoadCoinsForWorld(int world) { if (!isHidden) { return; } - u8 levelArray[] = { + int levelArray[14][2][8] = { { {1,2,3,4,15}, {5,6,7,8,25,38} @@ -207,7 +208,7 @@ void dWMStarCoin::LoadCoinsForWorld(int world) { {19,22,23,24,25}, {} } - } + }; // Handle showing it MapSoundPlayer(SoundRelatedClass, SE_SYS_DIALOGUE_IN, 1); @@ -220,7 +221,7 @@ void dWMStarCoin::LoadCoinsForWorld(int world) { res.data = getResource("star_coin", "g3d/star_coin.brres"); nw4r::g3d::ResMdl mdl = res.GetResMdl("star_coinA"); shopkeep.setup(mdl, &allocator, 0x224, 1, 0); - SetupTextures_Item(&shopkeep, 1); + SetupTextures_MapObj(&shopkeep, 1); allocator.unlink(); @@ -235,7 +236,7 @@ void dWMStarCoin::LoadCoinsForWorld(int world) { // Display World Name - setWorldName(int world); + setWorldName(world); // Display Per level coins @@ -247,28 +248,40 @@ void dWMStarCoin::LoadCoinsForWorld(int world) { SaveBlock *save = GetSaveFile()->GetBlock(-1); for (int l = 0; l < 2; l++) { - while (levelArray[world-1][l][i]) { + for (int i = 0; i < 8; i++) { + + int levelNum = levelArray[world][l][i]; - dLevelInfo_c *li = &dScKoopatlas_c::instance->levelInfo; - dLevelInfo_c::entry_s *entry = li->search(world - 1, levelArray[world-1][l][i] - 1); + char levelPane[11]; + sprintf(levelPane, "T_level_%02d", i+j); - setText(li->getNameForLevel(entry);, "T_level_01"); + if (levelArray[world][l][i]) { + levelNum--; + dLevelInfo_c *li = &dScKoopatlas_c::instance->levelInfo; + dLevelInfo_c::entry_s *entry = li->search(world, levelNum); + + setText(li->getNameForLevel(entry), levelPane); + totalCoins += 3; + } + else { + setText(" ", levelPane); + } bool collect; - collect = CheckIfCoinCollected(world - 1, l, 0); + u32 conds = save->GetLevelCondition(world, i+j); + + collect = conds & COND_COIN1; setCoin(collect, 1, i+j); if (collect) { currentCoins++; } - collect = CheckIfCoinCollected(world - 1, l, 1); + collect = conds & COND_COIN2; setCoin(collect, 2, i+j); if (collect) { currentCoins++; } - collect = CheckIfCoinCollected(world - 1, l, 2); + collect = conds & COND_COIN3; setCoin(collect, 3, i+j); if (collect) { currentCoins++; } - totalCoins += 3; - i++; } j += 8; i = 0; @@ -289,28 +302,21 @@ void dWMStarCoin::LoadCoinsForWorld(int world) { void dWMStarCoin::setCoin(bool on, int coin, int slot) { + char coinOn[16]; + char coinOff[16]; if (coin == 1) { - char coinOn [14]; sprintf(coinOn, "P_first_on_%02d", slot); - - char coinOff [15]; sprintf(coinOff, "P_first_off_%02d", slot); - } else if { - char coinOn [15]; + } else if (coin == 2) { sprintf(coinOn, "P_second_on_%02d", slot); - - char coinOff [16]; sprintf(coinOff, "P_second_off_%02d", slot); - } else if { - char coinOn [14]; + } else if (coin == 3) { sprintf(coinOn, "P_third_on_%02d", slot); - - char coinOff [15]; sprintf(coinOff, "P_third_off_%02d", slot); } else { return; } - nw4r::lyt::Pane picOn = layout.findPictureByName(coinOn); - nw4r::lyt::Pane picOff = layout.findPictureByName(coinOff); + nw4r::lyt::Pane *picOn = layout.findPictureByName(coinOn); + nw4r::lyt::Pane *picOff = layout.findPictureByName(coinOff); if (on) { picOn->alpha = 0xFF; @@ -348,60 +354,61 @@ void dWMStarCoin::setText(const char *str, const char *name) { float width = tw.CalcStringWidth(newString, wlength); SpammyReport("Text width: %f\n", width); + OSReport("Setting text: %s", newString); box->SetString(newString); } void dWMStarCoin::setWorldName(int world) { - switch (world) { + switch (world+1) { case 1: setText("Yoshi's Island", "T_lefttitle_01"); - setText("Yoshi's Island", "T_righttitle_01")l + setText("Yoshi's Island", "T_righttitle_01"); break; case 2: setText("Soggy Sewers", "T_lefttitle_01"); - setText("Rubble Ruins", "T_righttitle_01")l + setText("Rubble Ruins", "T_righttitle_01"); break; case 3: setText("Mushroom Peaks", "T_lefttitle_01"); - setText("Mushroom Peaks", "T_righttitle_01")l + setText("Mushroom Peaks", "T_righttitle_01"); break; case 4: setText("Sakura Village", "T_lefttitle_01"); - setText("Sakura Village", "T_righttitle_01")l + setText("Sakura Village", "T_righttitle_01"); break; case 5: setText("FreezeFlame Valley", "T_lefttitle_01"); - setText("FreezeFlame Volcano", "T_righttitle_01")l + setText("FreezeFlame Volcano", "T_righttitle_01"); break; case 6: setText("Pumpkin Boneyard", "T_lefttitle_01"); - setText("Pumpkin Boneyard", "T_righttitle_01")l + setText("Pumpkin Boneyard", "T_righttitle_01"); break; case 7: setText("Sky Mountain", "T_lefttitle_01"); - setText("Starry Skies", "T_righttitle_01")l + setText("Starry Skies", "T_righttitle_01"); break; case 8: setText("Koopa Planet", "T_lefttitle_01"); - setText("Koopa Core", "T_righttitle_01")l + setText("Koopa Core", "T_righttitle_01"); break; case 9: setText("Bonus Land", "T_lefttitle_01"); - setText("Bonus Land", "T_righttitle_01")l + setText("Bonus Land", "T_righttitle_01"); break; case 10: setText("Goldwood Forest", "T_lefttitle_01"); - setText(" ", "T_righttitle_01")l + setText(" ", "T_righttitle_01"); // if ((level < 6) || (level == 33) || (level == 34)) // setWorldText("Goldwood\nForest"); @@ -417,7 +424,7 @@ void dWMStarCoin::setWorldName(int world) { default: setText("Unknown World", "T_lefttitle_01"); - setText("Unknown World", "T_righttitle_01")l + setText("Unknown World", "T_righttitle_01"); break; } -- cgit v1.2.3