#include "koopatlas/starcoin.h" #include dWMStarCoin_c *dWMStarCoin_c::instance = 0; dWMStarCoin_c *dWMStarCoin_c::build() { void *buffer = AllocFromGameHeap1(sizeof(dWMStarCoin_c)); dWMStarCoin_c *c = new(buffer) dWMStarCoin_c; instance = c; return c; } dWMStarCoin_c::dWMStarCoin_c() { layoutLoaded = false; visible = false; } int dWMStarCoin_c::onCreate() { if (!layoutLoaded) { bool gotFile = layout.loadArc("StarCoins.arc", false); if (!gotFile) return false; bool output = layout.build("StarCoins.brlyt"); layout.layout.rootPane->trans.x = -112.0f; if (IsWideScreen()) { layout.layout.rootPane->scale.x = 0.735f; } else { layout.clippingEnabled = true; layout.clipX = 0; layout.clipY = 52; layout.clipWidth = 640; layout.clipHeight = 352; layout.layout.rootPane->scale.x = 0.7711f; layout.layout.rootPane->scale.y = 0.7711f; } static const char *brlanNames[] = { "StarCoins_Show.brlan", "StarCoins_ShowSection.brlan", "StarCoins_HideSection.brlan", "StarCoins_ShowArrow.brlan", "StarCoins_HideArrow.brlan", }; static const char *groupNames[] = { "base", "section", "section", "leftArrow", "leftArrow", "rightArrow", "rightArrow" }; layout.loadAnimations(brlanNames, 5); layout.loadGroups(groupNames, (int[7]){0, 1, 2, 3, 4, 3, 4}, 7); layout.disableAllAnimations(); layout.drawOrder = 1; for (int col = 0; col < COLUMN_COUNT; col++) { for (int shine = 0; shine < SHINE_COUNT; shine++) { char name[8]; sprintf(name, "Shine%d%d", col, shine); Shine[col][shine] = layout.findPictureByName(name); } for (int row = 0; row < ROW_COUNT; row++) { char lname[12]; sprintf(lname, "LevelName%d%d", col, row); LevelName[col][row] = layout.findTextBoxByName(lname); char coname[16], cname[8]; for (int i = 0; i < 3; i++) { sprintf(coname, "CoinOutline%d%d%d", col, row, i); CoinOutline[col][row][i] = layout.findPictureByName(coname); sprintf(cname, "Coin%d%d%d", col, row, i); Coin[col][row][i] = layout.findPictureByName(cname); } } } static const char *tbNames[] = { "LeftTitle", "RightTitle", "TotalCoinCount", "UnspentCoinCount", "EarnedCoinCount", "EarnedCoinMax", "BtnWorldSelText", "BtnBackText", }; layout.getTextBoxes(tbNames, &LeftTitle, 8); WriteBMGToTextBox(BtnBackText, GetBMG(), 3, 1, 0); WriteBMGToTextBox(BtnWorldSelText, GetBMG(), 4, 11, 0); layoutLoaded = true; } return true; } int dWMStarCoin_c::onDelete() { return layout.free(); } void dWMStarCoin_c::show() { visible = true; layout.enableNonLoopAnim(SHOW_ALL); } int dWMStarCoin_c::onExecute() { if (visible) { layout.execAnimations(); layout.update(); int nowPressed = Remocon_GetPressed(GetActiveRemocon()); if (!layout.isAnyAnimOn()) { if (nowPressed & WPAD_B) { MapSoundPlayer(SoundRelatedClass, SE_SYS_DIALOGUE_OUT_AUTO, 1); layout.enableNonLoopAnim(1); } } } return true; } int dWMStarCoin_c::onDraw() { if (visible) layout.scheduleForDrawing(); return true; }