Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ffc script sparkle
- {
- enum { x, y, lwdmap, lwmap, screen, dwdmap, valid, LAST };
- int loc[LAST];
- const int FFID = 30; //ffc index
- const int CMB = 2000; //sparkle combo
- void set(int lwdmap, int lwmap, int scr, int dworld)
- {
- loc[x] = Hero->X;
- loc[y] = Hero->Y;
- loc[lwdmap] = Game->GetCurDMap();
- loc[lwmap] = Game->GetCurMap();
- loc[screen] = Game->GetCurScreen();
- loc[dwdmap] = dworld;
- }
- void clear()
- {
- mapdata m = Game->LoadMapData(loc[map], loc[screen]);
- m->FFCData[FFID] = 0;
- m->FFCScript[FFID] = 0;
- }
- void setvalid(){loc[valid] = 1;}
- bool isvalid() { return (loc[valid]); }
- void create() //Need to call in Link.init if there is a valid mirror sparkle.
- {
- if ( !isvalid() ) return; //because the init script sets it, it needs to be valid.
- mapdata m = Game->LoadMapData(loc[map], loc[screen]);
- m->FFCData[FFID] = CMB;
- m->FFCX[FFID] = loc[x];
- m->FFCY[FFID] = loc[y];
- m->FFCScript[FFIC] = id;
- }
- void draw() //
- {
- if ( Game->GetCurDMap() == loc[dmap] )
- {
- if ( Game->GetCurScreen() == loc[screen] )
- {
- ffc f = Screen->LoadFFC(FFID);
- f->Data = CMB;
- f->X = loc[x];
- f->Y = loc[y];
- }
- }
- }
- int id() { return ( Game->GetFFCScript("sparkle");
- void run()
- {
- while(1)
- {
- if ( Link->Misc[mirror.LM_WARPTIMER] )
- {
- --Link->Misc[mirror.LM_WARPTIMER];
- Waitframe();
- continue;
- }
- if ( Collision(this) )
- {
- //warp back
- Link->WarpEx(loc[dmap], Game->GetCurScreen(), loc[x], loc[y], mirror.WARPSFX, mirror.WARPVISUAL, ... ); //IDR the args order right now.
- }
- Waitframe();
- }
- }
- }
- item script mirror
- {
- enum { LIGHT1, DARK1, MAX_PAIR }
- const int ERRSOUND = 64;
- const int NOWARP_TIME = 150;
- const int LM_WARPTIMER = 30; ///Link->Misc index to store the timer to prevent warping Link
- const int WARPSFX = 65;
- const int WARPVISUAL = 2;
- int maps[MAX_PAIR] =
- {
- 1, 2 //light, then dark, in pairs
- };
- int lightdmap()
- {
- for ( int q = 0; q < MAX_PAIR; ++q )
- {
- if ( maps[q] == Game->GetCurDMap() ) return maps[q-1];
- }
- return -1;
- }
- int dungeons[]= { 3 }; /List of dungeons.
- void run()
- {
- int destdmap = lightdmap();
- if ( destmap == -1 ) //error, can;t warp out
- {
- Audio->PlaySound(ERRSOUND);
- Quit();
- }
- mapdata destmap = Game->LoadMapData(DMapMap[destdmap], Game->GetCurScreen());
- if ( destmap->isSolid(Link->X, Link->Y) )
- {
- Audio->PlaySound(ERRSOUND);
- //show visual effect, drawing screen to layer
- Quit()
- }
- sparkle.clear();
- sparkle.set(destdmap, DMapMap[destdmap], Game->GetCurScreen(), Game->GetCurDMap());
- sparkle.setvalid();
- sparkle.create();
- Link->Misc[LM_WARPTIMER] = NOWARP_TIME;
- Link->WarpEx(destdmap, Game->GetCurScreen(), Link->X, Link->Y, ... ); //IDR the args order right now.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement