Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int GameVars[65536];
- const int RING_COUNT = 53;//How many rings you have
- const int RING_SET = 54;//What ring is equipped
- const int RING_TILE = 1000;//First index to store ring tiles
- const int RING_CSET = 1010;//First index to store ring Csets
- const int RING_OBTAINED = 1020;//Frist index to store ring ids
- const int NUM_RINGS = 9;//Max number of rings you can get.
- //Due to how things work in arrays, this is one less than actual max
- const int RING_MESSAGE = 507;//First of ten messages describing rings
- void RingSystem(){
- int ring_set = GameVars[RING_SET];//Save what ring is equipped
- int old_ring= GameVars[RING_OBTAINED+ring_set];//Save item id of ring
- int ring= old_ring;//Store separately for later comparison
- int RingMessage[]= "Press left or right to change equipped ring";//It's a string!
- //You have a ring
- if(GameVars[RING_COUNT]){
- int Message[256];//Buffer for loading messages
- int string;//Message to load
- //You press right
- if(Link->PressRight){
- //Damp inputs
- Link->PressRight= false;
- Link->InputRight= false;
- //Cycle through all indices
- do{
- ring_set++;
- if(ring_set==NUM_RINGS+1)//You've reached the end of the available indices
- ring_set=0;//Set back to start
- }
- while(!GameVars[RING_OBTAINED+ring_set])
- //Reset ring id to new value
- ring= GameVars[RING_OBTAINED+ring_set];
- Game->PlaySound(SFX_MENU_SELECT);
- }
- //You press left
- else if(Link->PressLeft){
- Link->PressLeft= false;
- Link->InputLeft= false;
- do{
- ring_set--;
- if(ring_set==-1)//If you go below zero
- ring_set=NUM_RINGS;//Set to max ring
- }
- while(!GameVars[RING_OBTAINED+ring_set])
- ring= GameVars[RING_OBTAINED+ring_set];
- Game->PlaySound(SFX_MENU_SELECT);
- }
- //The ring id has changed
- if(ring!=old_ring){
- //Take away old ring
- Link->Item[old_ring]= false;
- //Give new ring
- Link->Item[ring]= true;
- }
- //Determine what index to point to
- GameVars[RING_SET]= ring_set;
- //Determine what message to point to
- string= RING_MESSAGE+ring_set;
- //Load message into buffer
- GetMessage(string, Message);
- //You have assigned a ring
- if(GameVars[RING_SET]!=-1){
- //Draw decscription of ring
- Screen->DrawString(1,24,4,FONT_GBLA,0x08,0x69,TF_NORMAL,Message,128);
- //Draw tile of ring
- Screen->FastTile(1,28,19,GameVars[RING_TILE+ring_set],
- GameVars[RING_CSET+ring_set],OP_OPAQUE);
- }
- //You have more than one ring
- if(GameVars[RING_COUNT]>=2)
- //Display a string
- Screen->DrawString(1,8,136,FONT_GBLA,0x08,0x69,TF_NORMAL,RingMessage,128);
- }
- }
- //D0- Message to show
- //D1- Index of array to store data
- // 0-Number of Rings
- //D2- Tile of ring
- //D3- CSet of ring
- //D4- Item id of ring
- item script Ring_Item{
- void run(int message, int ring, int tile, int cset,int ring_id){
- GameVars[RING_OBTAINED+ring]= ring_id;
- GameVars[RING_TILE+ring]= tile;
- GameVars[RING_CSET+ring]= cset;
- GameVars[RING_COUNT]++;
- GameVars[RING_SET]= ring;
- Screen->Message(message);
- }
- }
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement