Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script typedef struct ffc;
- struct script items
- {
- const int SLOT_A = 0;
- const int SLOT_B = 1;
- const int I_A = 100;
- const int I_B = 101; //The only two action items in our quest.
- void run(){}
- enum { LAST = 2048 };
- int Have[LAST*2]; //Inventory; ownership
- int Tile[LAST];
- int Scripts[LAST*3];
- int Power[LAST];
- int Class[LAST];
- void init(int id, int tile, int scriptid, int wpnscript, int pscript, int power, int itemclass)
- {
- Tile[id] = tile;
- Scripts[id] = scriptid;
- Scripts[id+LAST] = wpnscript;
- Scripts[id+(LAST*2)] = pscript;
- Power[id] = power;
- Class[id] = itemclass;
- }
- int _max(int a, int b) { return ( a < b ) ? a : b ); }
- //Custom subscreen calls this when changing the active item in any slot.
- void set(int slot, int id)
- {
- slot = _max(slot);
- itemdata a = Game->LoadItemData(I_A+slot);
- a->Tile = Tiles[id];
- a->Scipt = Scripts[id];
- a->WeaponScipt = Scripts[LAST+id];
- a->PScipt = Scripts[(LAST*2)+id];
- a->Power = Power[id];
- a->Family = Class[id];
- }
- void Own(int id, bool state)
- {
- Have[id*LAST] = ( state ) ? 1 : 0;
- Have[id] = ( state ) ? 1 : 0;
- }
- bool Owns(int id) { return Have[id*LAST} }
- void Give(int id) { Have[id] = 1; }
- void Take(int id) { Have[id] = 0; }
- void DoScript(int slot, int id, untyped args)
- {
- itemdata a = Game->LoadItemData(I_A+slot);
- a->RunScript();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement