From 508fa70b67208ad8481c8673057b6463da2f3cf2 Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 25 Jan 2013 23:58:47 +0100 Subject: shop fixes --- src/koopatlas/shop.cpp | 22 ++++++++++++++++++---- src/koopatlas/shop.h | 4 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src/koopatlas') diff --git a/src/koopatlas/shop.cpp b/src/koopatlas/shop.cpp index 63d23e2..e3cade7 100644 --- a/src/koopatlas/shop.cpp +++ b/src/koopatlas/shop.cpp @@ -10,9 +10,9 @@ void dWMShop_c::ShopModel_c::setupItem(float x, float y, ItemTypes type) { static const char* Produce[ITEM_TYPE_COUNT][4] = { { "I_kinoko", "g3d/I_kinoko.brres", "I_kinoko", "wait2" }, { "I_fireflower", "g3d/I_fireflower.brres", "I_fireflower", "wait2" }, + { "I_propeller", "g3d/I_propeller.brres", "I_propeller_model", "wait2" }, { "I_iceflower", "g3d/I_iceflower.brres", "I_iceflower", "wait2" }, { "I_penguin", "g3d/I_penguin.brres", "I_penguin", "wait2" }, - { "I_propeller", "g3d/I_propeller.brres", "I_propeller_model", "wait2" }, { "I_kinoko_bundle","g3d/I_mini_kinoko.brres", "I_mini_kinoko", "wait2" }, { "I_star", "g3d/I_star.brres", "I_star", "wait2" }, { "I_hammer", "g3d/I_fireflower.brres", "I_fireflower", "wait2" }, @@ -62,6 +62,7 @@ void dWMShop_c::ShopModel_c::setupLakitu(int id) { animation.setup(mdlRes, anmChr, &allocator, 0); playAnim("idle", 1.0f, 0); + playingNotEnough = false; allocator.unlink(); } @@ -82,6 +83,10 @@ void dWMShop_c::ShopModel_c::execute() { OSReport("Setting animation to idle"); playAnim("idle", 1.0f, 0); this->animation.setCurrentFrame(0.0); + if (playingNotEnough) { + OSReport("Detected Not Enough animation as being over\n"); + playingNotEnough = false; + } } } } @@ -347,7 +352,10 @@ void dWMShop_c::executeState_Wait() { newSelection = selected + 1; } else if (nowPressed & WPAD_TWO) { - buyItem(selected); + if (!lakituModel->playingNotEnough) + buyItem(selected); + else + OSReport("Not Enough is still playing!\n"); } if (newSelection > -1) { @@ -527,6 +535,10 @@ void dWMShop_c::loadInfo() { int scCount = getUnspentStarCoinCount(); WriteNumberToTextBox(&scCount, CoinCount, false); WriteNumberToTextBox(&scCount, CoinCountShadow, false); + + + WriteBMGToTextBox(BackText, GetBMG(), 2, 58, 0); + WriteBMGToTextBox(BuyText, GetBMG(), 302, 4, 0); } @@ -540,6 +552,8 @@ void dWMShop_c::buyItem(int item) { int cost = itemDefs[item][0], cash = getUnspentStarCoinCount(); if (cost > cash) { + OSReport("Started playing Not Enough\n"); + lakituModel->playingNotEnough = true; lakituModel->playAnim("notenough", 1.0f, 1); MapSoundPlayer(SoundRelatedClass, SE_SYS_INVALID, 1); return; @@ -559,7 +573,7 @@ void dWMShop_c::buyItem(int item) { int invStartIndex = itemDefs[item][1], invCount = itemDefs[item][2]; for (int i = 0; i < invCount; i++) - appliedItems[(int)Inventory[shopKind][invStartIndex]]++; + appliedItems[(int)Inventory[shopKind][invStartIndex+i]]++; // TODO: Make this work with hammers for (int i = 0; i < 8; i++) { @@ -568,7 +582,7 @@ void dWMShop_c::buyItem(int item) { if (block->powerups_available[i] > 99) block->powerups_available[i] = 99; - dScKoopatlas_c::instance->stockItem->counts[i] = block->powerups_available[i]; + dScKoopatlas_c::instance->stockItem->newCounts[i] = block->powerups_available[i]; } // Apply lives to everyone diff --git a/src/koopatlas/shop.h b/src/koopatlas/shop.h index 4a79861..1e88e72 100644 --- a/src/koopatlas/shop.h +++ b/src/koopatlas/shop.h @@ -37,9 +37,9 @@ class dWMShop_c : public dActor_c { enum ItemTypes { MUSHROOM = 0, FIRE_FLOWER, + PROPELLER, ICE_FLOWER, PENGUIN, - PROPELLER, MINI_SHROOM, STARMAN, HAMMER, @@ -75,7 +75,7 @@ class dWMShop_c : public dActor_c { m3d::anmChr_c animation; float x, y, scaleFactor, scaleEase; - bool isLakitu; + bool isLakitu, playingNotEnough; void setupItem(float x, float y, ItemTypes type); void setupLakitu(int id); -- cgit v1.2.3