summaryrefslogtreecommitdiff
path: root/src/koopatlas/shop.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-01-17 09:23:55 +0100
committerTreeki <treeki@gmail.com>2013-01-17 09:23:55 +0100
commit1e2fe2181af8215e6da3f55d0350385d0af2f7e0 (patch)
tree697f2105ceedd031f901c896d2747ccdfc2b43bb /src/koopatlas/shop.cpp
parent4a51200b922d2ed0896562d95d1d9e390a014db3 (diff)
downloadkamek-1e2fe2181af8215e6da3f55d0350385d0af2f7e0.tar.gz
kamek-1e2fe2181af8215e6da3f55d0350385d0af2f7e0.zip
myriad updates and fixes to EVERYTHING
Diffstat (limited to '')
-rw-r--r--src/koopatlas/shop.cpp70
1 files changed, 35 insertions, 35 deletions
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);
}