summaryrefslogtreecommitdiff
path: root/src/koopatlas/shop.h
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-10-25 00:05:35 +0200
committerTreeki <treeki@gmail.com>2012-10-25 00:05:35 +0200
commit63bde25084daafeb0aeaa584d3624f0c77ec043d (patch)
tree0fe3aacd52415be927b48aee2ff103f6590d2fdc /src/koopatlas/shop.h
parentad21da0675fe04c23bbb88763d4683648e812b8f (diff)
downloadkamek-63bde25084daafeb0aeaa584d3624f0c77ec043d.tar.gz
kamek-63bde25084daafeb0aeaa584d3624f0c77ec043d.zip
committing my untested and slightly unfinished shop
Diffstat (limited to 'src/koopatlas/shop.h')
-rw-r--r--src/koopatlas/shop.h119
1 files changed, 76 insertions, 43 deletions
diff --git a/src/koopatlas/shop.h b/src/koopatlas/shop.h
index cf78b36..719a087 100644
--- a/src/koopatlas/shop.h
+++ b/src/koopatlas/shop.h
@@ -3,13 +3,11 @@
#include "koopatlas/core.h"
-extern "C" void *SoundRelatedClass;
-extern "C" void *MapSoundPlayer(void *SoundClass, int soundID, int unk);
-
-class dShopItem;
-
-class dWMShop_c : public dActor_c {
+class dWMShop_c : public dBase_c {
public:
+ static dWMShop_c *build();
+ static dWMShop_c *instance;
+
dWMShop_c();
int onCreate();
@@ -21,43 +19,78 @@ class dWMShop_c : public dActor_c {
bool layoutLoaded;
m2d::EmbedLayout_c layout;
- mHeapAllocator_c allocator;
- nw4r::g3d::ResFile res;
- m3d::mdl_c shopkeep;
- m3d::anmChr_c ska;
- mMtx matrix;
-
- mEf::es2 effect;
-
- char currentItem;
- bool isHidden;
- bool wasOff;
- int world;
-
- dShopItem *itemA;
- dShopItem *itemB;
- dShopItem *itemC;
- dShopItem *itemD;
-
- dShopItem *itemEA;
- dShopItem *itemEB;
- dShopItem *itemEC;
-
- dShopItem *itemFA;
- dShopItem *itemFB;
- dShopItem *itemFC;
- dShopItem *itemFD;
- dShopItem *itemFE;
-
-
- void LoadShopForWorld(int world);
- void CloseUpShop();
- void BuyItem(int item);
-
- void changeItem(int last, int current);
-
- static dWMShop_c *build();
- static dWMShop_c *instance;
+ bool visible;
+
+ int selected, lastTopRowChoice;
+ int shopKind;
+
+ enum Animation {
+ SHOW_ALL = 0,
+ HIDE_ALL = 1,
+ ACTIVATE_BUTTON = 2, // 3, 4, 5, 6, 7
+ DEACTIVATE_BUTTON = 8, // 9, 10, 11, 12, 13
+ };
+
+ enum ItemTypes {
+ MUSHROOM = 0,
+ FIRE_FLOWER,
+ ICE_FLOWER,
+ PENGUIN,
+ PROPELLER,
+ MINI_SHROOM,
+ STARMAN,
+ HAMMER,
+ ONE_UP,
+ COINS,
+ ITEM_TYPE_COUNT
+ };
+
+ enum _Constants {
+ ITEM_COUNT = 12,
+ };
+
+ static const ItemTypes Inventory[10][12];
+
+ nw4r::lyt::TextBox
+ *Title, *TitleShadow,
+ *CoinCount, *CoinCountShadow,
+ *BackText, *BuyText;
+
+ class ShopModel_c {
+ public:
+ mHeapAllocator_c allocator;
+
+ nw4r::g3d::ResFile res;
+ m3d::mdl_c model;
+ m3d::anmChr_c animation;
+
+ float x, y;
+
+ void setupItem(float x, float y, ItemTypes type);
+ void setupLakitu(int id);
+ void execute();
+ void draw();
+ void playAnim(const char *name, float rate);
+ };
+
+ ShopModel_c *itemModels;
+ ShopModel_c *lakituModel;
+
+ void show(int shopNumber);
+
+ void loadModels();
+ void deleteModels();
+
+ void buyItem(int item);
+
+ dStateWrapper_c<dWMShop_c> state;
+
+ USING_STATES(dWMShop_c);
+ DECLARE_STATE(Hidden);
+ DECLARE_STATE(ShowWait);
+ DECLARE_STATE(ButtonActivateWait);
+ DECLARE_STATE(Wait);
+ DECLARE_STATE(HideWait);
};
#endif