Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Ornamental Shelf for Triforce Knight Cane Leve
- //By: ZoriaRPG, for BigJoe
- const int FFC_CANE_LEVEL_DOOR_FLAG_OPEN_DOOR = 0000000001b;
- const int FFC_CANE_LEVEL_DOOR_FLAG_STAY_OPEN = 0000000010b;
- ffc script CaneLevelDoor
- {
- void run(int reg, float px_dist_per_frame, int frame_timer, int open_grind_sfx,
- int stay_open, int fully_open_x)
- {
- int q[256];
- ffc lnk = Screen->LoadFFC(this->Link); //Get the second half.
- open_grind_sfx = ( open_grind_sfx << 0 );
- //
- // q[0] - q[4] : Loop reservations. (unused)
- //
- // Hell, we'll just go bitwise.
- //
- // q[5] timer
- // q[6] state that the door is open fully.
- //
- //Trace(Game->GetCurScreen());
- q[5] = frame_timer; //I might want to evaluate this in seconds.
- //TraceB(GetScreenDBit(119, reg, FFC_CANE_LEVEL_DOOR_FLAG_OPEN_DOOR));
- //If the door has been opened in the past and set not to animate on revisiting, open it fully.
- //This requires running on screen init.
- if ( GetScreenDBit(119, reg, FFC_CANE_LEVEL_DOOR_FLAG_OPEN_DOOR) && stay_open )
- {
- this->X = fully_open_x;
- lnk->X = fully_open_x+64;
- Screen->Door[DOOR_UP] = D_OPEN; //Change the solid wall, to a door.
- Quit();
- }
- //else { this->X = this->X; this->Y = this->Y; }
- while(true)
- {
- if ( Screen->NumNPCs() ) { Waitframe(); } //Do not freeze Link and allow him to be murdered.
- if ( !GetScreenDBit(Game->GetCurScreen(), reg, FFC_CANE_LEVEL_DOOR_FLAG_OPEN_DOOR))
- {
- //If the external device has not set a bit on this screen, wait and do nothing.
- this->X = this->X; this->Y = this->Y;
- Waitframe();
- }
- else
- {
- while(Link->Action == LA_SCROLLING) { Waitframe(); continue; }
- // Set draw over for both ffcs here.
- this->Flags[FFCF_OVERLAY] = true;
- lnk->Flags[FFCF_OVERLAY] = true;
- Screen->Door[DOOR_UP] = D_OPEN; //Change the solid wall, to a door.
- //Otherwise, the trigger event has occurred.
- if ( !q[6] )
- {
- if ( open_grind_sfx > 0 && open_grind_sfx < 256 ) Game->PlaySound(open_grind_sfx);
- //If the sound is set, play it.
- while( q[5]-- || this->X < fully_open_x )
- {
- //Open the door
- this->X -= px_dist_per_frame;
- lnk->X -= px_dist_per_frame;
- WaitNoAction(); //Link does not move. He is stunned by the animation effects.
- }
- q[6] = 1; //The door is open.
- this->Flags[FFCF_OVERLAY] = false;
- lnk->Flags[FFCF_OVERLAY] = false;
- if ( stay_open )
- {
- //If the animation does not repeat on revisiting the screen
- //which is a terrible shame...
- SetScreenDFlag( reg, FFC_CANE_LEVEL_DOOR_FLAG_STAY_OPEN, true );
- break;
- }
- }
- }
- Waitframe();
- } //End of main loop.
- //Any clean-up?
- Quit();
- }
- }
- ffc script SetCaneDoorBit
- {
- void run(int reg, int screen, int enemies, int sfx)
- {
- if ( screen == -1 ) screen = 119;
- //what is the trigger?
- Waitframes( 5 ); //Wait for npcs to spawn.
- while(true)
- {
- if ( !enemies && !Screen->State[ST_SECRET] ) { Waitframe(); continue; }
- if ( enemies && Screen->NumNPCs() ) { Waitframe(); continue; }
- //We shall presume that the trigger is a secret state for the present.
- break;
- }
- if ( sfx && !GetScreenDBit(screen, reg, FFC_CANE_LEVEL_DOOR_FLAG_OPEN_DOOR) ) Game->PlaySound( sfx ); //Play the sound only one time.
- //Set the remote bit and exit.
- SetScreenDBit(screen, reg, FFC_CANE_LEVEL_DOOR_FLAG_OPEN_DOOR, true);
- //Drawscreen the screen witht he secret?
- //TraceB(GetScreenDBit(119, reg, FFC_CANE_LEVEL_DOOR_FLAG_OPEN_DOOR));
- this->Data = 0; this->Script = 0; Quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement