Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Tamamo's Holes, Lava, and Platforms
- /// and Barriers + Followers, for Nightmeres (on PZC)
- /// Combined together for ease of use, and streamlined for stack efficiency.
- /// Global Constants, Arrays, and Variables
- //Common Constant, only need to define once per script file.
- const int BIG_LINK = 0; //Set this constant to 1 if using the Large Link Hit Box feature.
- const int DIAGONAL_MOVEMENT = 1; //Enable the option and change this to 0 for nes movement.
- //Constants used by Bottomless Pits & Lava.
- const int CT_HOLELAVA = 128; //Combo type to use for pit holes and lava."No Ground Enemies by default"
- const int CF_PIT = 101; //The combo flag to register combos as pits.
- const int CF_LAVA = 102; //The combo flag to register combos as lava.
- const int WPS_LINK_FALL = 89; //The weapon sprite to display when Link falls into a pit. "Sprite 88 by default"
- const int WPS_LINK_LAVA = 90; //The weapon sprite to display when Link drowns in lava. "Sprite 89 by default"
- const int SFX_LINK_FALL = 38; //The sound to play when Link falls into a pit. "SFX_FALL by default"
- const int SFX_LINK_LAVA = 55; //The sound to play when Link drowns in Lava. "SFX_SPLASH by default.
- const int CMB_AUTOWARP = 48; //The first of your four transparent autowarp combos.
- const int HOLELAVA_DAMAGE = 8; //Damage in hit points to inflict on link. "One Heart Container is worth 16 hit points"
- //Global variables used by Bottomless Pits & Lava.
- float PitsLava[256];
- //These need to be turned into array indices:
- int olddmap;
- int oldscreen;
- int startx;
- int starty;
- int startdir;
- const int HL_FALLING = 0;
- const int HL_WARPING = 1;
- const int HL_ONPLATFORM = 3;
- const int CMB_FFC_INVIS = 1; //Combo higher than ID 0 with an invisible tile.
- // ID's of barrier-related combos
- // Barriers in raised state
- const int BARRIER_A_RAISED = 15036;
- const int BARRIER_B_RAISED = 15038;
- // Barriers in lowered state
- const int BARRIER_A_LOWERED = 15037;
- const int BARRIER_B_LOWERED = 15039;
- // Barriers animating to raised state
- const int BARRIER_A_ANIMRAISE = 15041;
- const int BARRIER_B_ANIMRAISE = 15043;
- // Barriers animating to lowered state
- const int BARRIER_A_ANIMLOWER = 15040;
- const int BARRIER_B_ANIMLOWER = 15042;
- // Raised barriers that Link can walk on
- const int BARRIER_A_WALKABLE = 15044;
- const int BARRIER_B_WALKABLE = 15045;
- // Barrier switches
- const int BARRIER_A_SWITCH = 15046;
- const int BARRIER_B_SWITCH = 15047;
- const int BARRIER_SWITCH_DUMMY = 191; // ID of a switch hit detection dummy enemy
- const int BARRIER_SWITCH_DUMMY_HP = 32767;
- // Global array to store the state of barriers per dmap
- // If you have more than 16 dmaps you can change the capacity in the []'s
- // You may change the states in other scripts, but the changes will not be visible
- // until there is a new screen, so set them before Barriers_NewScreen() is called.
- bool barriers[255]; // false = blue barriers raised, true = red barriers raised
- bool firstCheck; //used by follower script
- int curscreen = -1; //Used by barriers, and should be converted to an array index
- int switch_index; // and this should be in the same array
- //Follower script constants.
- const int FOLLOWER_FFC_INDEX = 32; //The number of the FFC used. This script will "hijack" this one, so don't use it for anything else on screens when you expect the player to have a follower.
- const int FOLLOWER_FIRST_COMBO_ID = 23568; //combo of the first combo. In order, the concecutive combos must be "still up", "still down", "still left", "still right", "moving up", "moving down", "moving left", "moving right".
- const int FOLLOWER_CSET = 11;
- const int FOLLOWER_REQUIRED_ITEM = 158; //Item that makes the FFC follower follow you
- //Barriers array indices.
- const int BAR_PASTX = 14; //followerX[]
- const int BAR_PASTY = 14; //followerY[] //why not one array? -Z
- //Global Variables for Sideview Ladder, GB Shield, and Power Bracelet
- float GB_Shield[256]; //Array to hold shield values. Set to an arbitrarily large size. Min [3]
- //sideview ladder
- bool onLadder = false;
- //power bracelets
- bool throw_disabled;
- int holding_block;
- bool holding_bush;
- int link_catching;
- //Shield Sound Effects
- const int SFX_GBSHIELD = 17; //Shield active SFX
- //Array indices of GB_Shield[]
- const int SHIELD_ITEM = 0;
- const int SHIELD_BUTTON = 1;
- const int SHIELD_ENABLED = 2;
- //NPC constants
- const int RESET_NPC_LAYER_ON_ENTRY = 1; //This fix will replace all CMB_NPC_SOLID tiles with CMB_NPC_HIDDEN
- //when entering the screen. This should prevent problems with shared
- //layers. If you don't want this fix, set it to 0.
- const int LAYER_NPC = 2; //The layer NPCs use for solid combos
- const int CMB_NPC_HIDDEN = 41; //Non-solid combo used for hidden NPCs
- const int CMB_NPC_SOLID = 42; //Solid combo placed under visible NPCs
- const int LAYER_NPC_CANTALK = 4; //The layer used for the speech bubble
- const int CMB_NPC_CANTALK = 37; //The combo used for the speech bubble
- const int CS_NPC_CANTALK = 8; //The CSet used for the speech bubble
- const int NPCBT_NONE = 0; //Regular NPCs
- const int NPCBT_FACELINK = 1; //NPCs that turn to face Link
- const int NPCBT_GUARDH = 2; //NPCs that move along a horizontal path
- const int NPCBT_GUARDV = 3; //NPCs that move along a vertical path
- //Alternate NPC constant
- const int CMB_AUTOWARPD = 0; //Only include this once in the script file. Set to the number of an Autowarp-type combo you create, preferably transparent.
- //Bracelet constants
- const int CF_PICK = 98; // SCRIPT1, bracelet
- const int SCRIPT_POWERBRACELET = 9; // set this to the ffc script slot assigned to PowerBracelet script when compiling
- const int LTM_CATCHING = 123; // LTM for Link catching a block with the Power Bracelet
- const int LTM_PULLING = 125; // LTM for Link pulling a block with the Power Bracelet
- const int LTM_HOLDING = 124; // LTM for Link holding a block with the Power Bracelet
- const int BLOCK_VH=4; //thrown block/bush horizontal initial velocity
- const int BLOCK_VV=0; //thrown block/bush vertical initial velocity
- const int BLOCK_DMG=8; //damage dealt to enemies by thrown block/bush
- const int LW_BLOCK = 31; //id of a lweapon to be used as thrown block
- const float BLOCK_FALL = 0.5; //gravity acceleration for block in sideview screens
- const int PB_PULL_TIME=14; // num of frames to wait for pickup with PB
- const int PB_UNDERCOMBO=0; // combo to set after picking up a block; set a negative value to have a shift of the original combo
- const int SFX_PICKUP_BLOCK = 45; // sfx played when link picks up the block
- const int SFX_THROW_BLOCK = 51; // sfx played when the block is thrown
- const int SFX_CRASH_BLOCK = 11; // sfx of a block crashing
- const int INV_COMBO_ID = 0; // id of an invisible combo
- const int INV_TILE_ID = 4; // id of an invisible tile
- const int CRASH_SPR = 88; // sprite for a block crashing at ground
- const int BUSH_SPR = 54; // sprite for a bush crashing at ground
- const int LAYER_OVER = 4; // an overhead layer
- const int NPC_ITEMSET = 182; // id of a dummy enemy with type different from "none"
- // Sideview Ladder constant
- const int CT_SVLADDER = 142; // CT_SCRIPT1, ComboType for Sideview Ladder
- const int CF_SVLADDER = 99; // CF_SCRIPT2, ComboFlag for Sideview Ladder
- /// FFC Scripts
- ffc script Holelava
- {
- void run(int warp, bool position, int damage)
- {
- while(true)
- {
- while(!PitsLava[HL_WARPING] || OnPlatform()) Waitframe();
- if(warp > 0)
- {
- this->Data = CMB_AUTOWARP+warp-1;
- this->Flags[FFCF_CARRYOVER] = true;
- Waitframe();
- this->Data = FFCS_INVISIBLE_COMBO;
- this->Flags[FFCF_CARRYOVER] = false;
- Link->Z = Link->Y;
- PitsLava[HL_WARPING] = 0;
- Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000, 1000);
- Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000, 1000);
- Quit();
- }
- if(position)
- {
- Link->X = this->X;
- Link->Y = this->Y;
- }
- else
- {
- Link->X = this->InitD[6];
- Link->Y = this->InitD[7];
- }
- if(damage)
- {
- Link->HP -= damage;
- Link->Action = LA_GOTHURTLAND;
- Link->HitDir = -1;
- Game->PlaySound(SFX_OUCH);
- }
- Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000, 1000);
- Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000, 1000);
- PitsLava[HL_WARPING] = 0;
- Waitframe();
- }
- }
- }
- ffc script MovingPlatform {
- void run(){
- float oldx = this->X;
- float oldy = this->Y;
- float linkx;
- float linky;
- while(true){
- if ( OnPlatform() == FFCNum(this) ){
- linkx += this->X - oldx;
- linky += this->Y - oldy;
- if ( linkx << 0 != 0 ) {
- Link->X += linkx << 0;
- linkx -= linkx << 0;
- }
- if ( linky << 0 != 0 ){
- Link->Y += linky << 0;
- linky -= linky << 0;
- }
- }
- else {
- linkx = 0;
- linky = 0;
- }
- oldx = this->X;
- oldy = this->Y;
- Waitframe();
- }
- }
- }
- /// Global Scripts
- global script active
- {
- void run()
- {
- // Initialize variables used to listen on screen changes
- curscreen = -1;
- firstCheck = false; //leave this alone
- ffc follower;
- int followerX[15];
- int followerY[15];
- switch_index = 0;
- StartGhostZH();
- InitHoleLava();
- while(true){
- UpdateGhostZH1();
- GameboyShield(); //Handles the gameboy style shield, by MM.
- PowerBracelet();
- _Do_Barriers();
- GLB_Sideview_Ladder();
- _Follower(follower, followerX, followerY);
- NesMovementFix();
- Waitdraw();
- UpdateGhostZH2();
- LREx1Ex2ItemSwitch();
- MovingPlatforms();
- RunHoleLava();
- UpdateLadders();
- Waitframe();
- }//end whileloop
- }//end run
- }//end global slot2
- global script OnContinue{
- void run()
- {
- Link->Item[LTM_CATCHING] = false;
- Link->Item[LTM_HOLDING] = false;
- Link->Item[LTM_PULLING] = false;
- holding_block = 0;
- holding_bush = false;
- link_catching = 0;
- }
- }
- /// Global Functions
- //Sets or returns if we are on a platform.
- int OnPlatform(){return PitsLava[HL_ONPLATFORM];}
- void OnPlatform(int a){ PitsLava[HL_ONPLATFORM] = a; }
- bool OnPlatform (ffc this)
- {
- if(CenterLinkX() < this->X - 4) return false;
- else if(CenterLinkX() >= this->X + this->EffectWidth + 4) return false;
- else if(CenterLinkY() < this->Y - 4) return false;
- else if(CenterLinkY() >= this->Y + this->EffectHeight + 4) return false;
- else return true;
- }
- //Used to determine if Link is on a Pit or Lava combo.
- int OnPitCombo()
- {
- int moving_platform[] = "MovingPlatform";
- int script_num = Game->GetFFCScript(moving_platform);
- int comboLoc = ComboAt(Link->X+8, Link->Y + Cond(BIG_LINK==0, 12, 8));
- for (int i = 1; i <= 32; i++)
- {
- ffc f = Screen->LoadFFC(i);
- if (f->Script == script_num && OnPlatform(f))
- return 0;
- }
- if(Screen->ComboT[comboLoc] != CT_HOLELAVA)
- return 0;
- else if(Screen->ComboI[comboLoc] == CF_PIT || Screen->ComboI[comboLoc] == CF_LAVA)
- return Screen->ComboI[comboLoc];
- else if(Screen->ComboF[comboLoc] == CF_PIT || Screen->ComboF[comboLoc] == CF_LAVA)
- return Screen->ComboF[comboLoc];
- else
- return 0;
- }
- //Snaps Link to the combo so he appears completely over pit and lava combos.
- void SnaptoGrid()
- {
- int x = Link->X;
- int y = Link->Y + Cond(BIG_LINK==0, 8, 0);
- int comboLoc = ComboAt(x, y);
- //X Axis
- if(Screen->ComboT[comboLoc] == CT_HOLELAVA && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc+1] != CT_HOLELAVA))
- Link->X = ComboX(comboLoc);
- else if(Screen->ComboT[comboLoc+1] == CT_HOLELAVA && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc] != CT_HOLELAVA))
- Link->X = ComboX(comboLoc+1);
- if(Cond(y % 16 == 0, false, Screen->ComboT[comboLoc+16] == CT_HOLELAVA) && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc+17] != CT_HOLELAVA))
- Link->X = ComboX(comboLoc+16);
- else if(Cond(y % 16 == 0, false, Screen->ComboT[comboLoc+17] == CT_HOLELAVA) && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc+16] != CT_HOLELAVA))
- Link->X = ComboX(comboLoc+17);
- //Y Axis
- if(Screen->ComboT[comboLoc] == CT_HOLELAVA && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc+16] != CT_HOLELAVA))
- Link->Y = ComboY(comboLoc);
- else if(Screen->ComboT[comboLoc+16] == CT_HOLELAVA && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc] != CT_HOLELAVA))
- Link->Y = ComboY(comboLoc+16);
- if(Cond(x % 16 == 0, false, Screen->ComboT[comboLoc+1] == CT_HOLELAVA) && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc+17] != CT_HOLELAVA))
- Link->Y = ComboY(comboLoc+1);
- else if(Cond(x % 16 == 0, false, Screen->ComboT[comboLoc+17] == CT_HOLELAVA) && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc+1] != CT_HOLELAVA))
- Link->Y = ComboY(comboLoc+17);
- }
- void LREx1Ex2ItemSwitch()
- {
- if (Link->PressL && Link->Action != LA_SCROLLING)
- {
- Link->SelectBWeapon(DIR_LEFT);
- }
- if (Link->PressR && Link->Action != LA_SCROLLING)
- {
- Link->SelectBWeapon(DIR_RIGHT);
- }
- if (Link->PressEx1 && Link->Action != LA_SCROLLING)
- {
- Link->SelectAWeapon(DIR_LEFT);
- }
- if (Link->PressEx2 && Link->Action != LA_SCROLLING)
- {
- Link->SelectAWeapon(DIR_RIGHT);
- }
- }
- //Hole_Lava Init. Call before Waitdraw().
- void InitHoleLava(){
- //Initialize variables used to store Link's strating position on Screen Init.
- olddmap = Game->GetCurDMap();
- oldscreen = Game->GetCurDMapScreen();
- startx = Link->X;
- starty = Link->Y;
- startdir = Link->Dir;
- //Clear global variables used by Bottomless pits.
- PitsLava[HL_FALLING] = 0;
- PitsLava[HL_WARPING] = 0;
- }
- //Main Hole_Lava Rountine. Call after Waitdraw().
- void RunHoleLava(){
- if(Link->Action != LA_SCROLLING)
- {
- Update_HoleLava(startx, starty, olddmap, oldscreen, startdir);
- if(Link->Z==0 && !PitsLava[HL_FALLING] && (oldscreen != Game->GetCurDMapScreen() || olddmap != Game->GetCurDMap()))
- {
- olddmap = Game->GetCurDMap();
- oldscreen = Game->GetCurDMapScreen();
- startx = Link->X;
- starty = Link->Y;
- startdir = Link->Dir;
- }
- }
- }
- //Handles Pit Combo Functionality.
- void Update_HoleLava(int x, int y, int dmap, int scr, int dir)
- {
- lweapon hookshot = LoadLWeaponOf(LW_HOOKSHOT);
- if(hookshot->isValid()) return;
- if(PitsLava[HL_FALLING])
- {
- if(IsSideview()) Link->Jump=0;
- PitsLava[HL_FALLING]--;
- if(PitsLava[HL_FALLING] == 1)
- {
- int buffer[] = "Holelava";
- if(CountFFCsRunning(Game->GetFFCScript(buffer)))
- {
- ffc f = Screen->LoadFFC(FindFFCRunning(Game->GetFFCScript(buffer)));
- PitsLava[HL_WARPING] = 1;
- if(f->InitD[1]==0)
- {
- f->InitD[6] = x;
- f->InitD[7] = y;
- }
- }
- else
- {
- Link->X = x;
- Link->Y = y;
- Link->Dir = dir;
- Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000, 1000);
- Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000, 1000);
- Link->HP -= HOLELAVA_DAMAGE;
- Link->Action = LA_GOTHURTLAND;
- Link->HitDir = -1;
- Game->PlaySound(SFX_OUCH);
- if(Game->GetCurDMap()!=dmap || Game->GetCurDMapScreen()!=scr)
- Link->PitWarp(dmap, scr);
- }
- NoAction();
- Link->Action = LA_NONE;
- }
- }
- else if(Link->Z==0 && OnPitCombo() && !PitsLava[HL_WARPING] && !OnPlatform())
- {
- Link->DrawXOffset += Cond(Link->DrawXOffset < 0, -1000, 1000);
- Link->HitXOffset += Cond(Link->HitXOffset < 0, -1000, 1000);
- int comboflag = OnPitCombo();
- SnaptoGrid();
- Game->PlaySound(Cond(comboflag == CF_PIT, SFX_LINK_FALL, SFX_LINK_LAVA));
- lweapon dummy = CreateLWeaponAt(LW_SCRIPT10, Link->X, Link->Y);
- dummy->UseSprite(Cond(comboflag == CF_PIT, WPS_LINK_FALL, WPS_LINK_LAVA));
- dummy->DeadState = dummy->NumFrames*dummy->ASpeed;
- dummy->DrawXOffset = 0;
- dummy->DrawYOffset = 0;
- PitsLava[HL_FALLING] = dummy->DeadState;
- NoAction();
- Link->Action = LA_NONE;
- }
- }
- //Handles moving platforms
- void MovingPlatforms(){
- OnPlatform(0);
- if ( Link->Z == 0 ) {
- int buffer[] = "MovingPlatform";
- for(int i = 1; i <= 32; i++) {
- ffc f = Screen->LoadFFC(i);
- if(f->Script != Game->GetFFCScript(buffer)) continue;
- if(Abs(Link->X + 8 - CenterX(f)) >= f->TileWidth*8) continue;
- if(Abs(Link->Y + 12 - CenterY(f)) >= f->TileHeight*8) continue;
- OnPlatform(FFCNum(f));
- break;
- }
- }
- }
- //Used if we are using NES movement
- void NesMovementFix(){
- if(DIAGONAL_MOVEMENT==0 && (Link->InputUp || Link->InputDown)){
- Link->InputLeft = false;
- Link->InputRight = false;
- }
- }
- // Function that makes preparations for barriers on each screen and starts an FFC script
- void Barriers_NewScreen()
- {
- int cd; int cd2; int i; int j;
- // Search for a barrier-related combo
- for (i = 0; i <= 175; ++i)
- {
- cd = Screen->ComboD[i];
- if (cd == BARRIER_A_RAISED || cd == BARRIER_A_LOWERED || cd == BARRIER_A_SWITCH ||
- cd == BARRIER_B_RAISED || cd == BARRIER_B_LOWERED || cd == BARRIER_B_SWITCH)
- {
- // A barrier-related combo was found
- // Make initial changes to combos
- if (barriers[Game->GetCurLevel()])
- {
- for (j = i; j <= 175; ++j)
- {
- cd2 = Screen->ComboD[j];
- if (cd2 == BARRIER_A_RAISED) Screen->ComboD[j] = BARRIER_A_LOWERED;
- else if (cd2 == BARRIER_B_LOWERED) Screen->ComboD[j] = BARRIER_B_RAISED;
- else if (cd2 == BARRIER_A_SWITCH) Screen->ComboD[j] = BARRIER_B_SWITCH;
- }
- }
- else
- {
- for (j = i; j <= 175; ++j)
- {
- cd2 = Screen->ComboD[j];
- if (cd2 == BARRIER_B_RAISED) Screen->ComboD[j] = BARRIER_B_LOWERED;
- else if (cd2 == BARRIER_A_LOWERED) Screen->ComboD[j] = BARRIER_A_RAISED;
- else if (cd2 == BARRIER_B_SWITCH) Screen->ComboD[j] = BARRIER_A_SWITCH;
- }
- }
- // So run FFCscript to control barriers
- int fif[]="Barriers";
- ffc f = Screen->LoadFFC(FOLLOWER_FFC_INDEX);
- f->Script = Game->GetFFCScript(fif);
- f->Data = CMB_FFC_INVIS;
- f->X = -100;
- f->Y = -100;
- f->Flags[FFCF_PRELOAD] = true;
- break;
- }
- }
- }
- // This lets you toggle barriers on any dmap
- bool ToggleBarriers(int dmap)
- {
- if (dmap == Game->GetCurLevel()) ToggleBarriers();
- else barriers[dmap] = !barriers[dmap];
- return barriers[dmap];
- }
- // This toggles barriers on the current dmap
- bool ToggleBarriers()
- {
- int cd;
- int curdmap = Game->GetCurLevel();
- if (!barriers[curdmap])
- {
- barriers[curdmap] = true;
- for (int i = 0; i <= 175; ++i)
- {
- cd = Screen->ComboD[i];
- if (cd == BARRIER_A_RAISED || cd == BARRIER_A_WALKABLE || cd == BARRIER_A_ANIMRAISE)
- {
- Screen->ComboD[i] = BARRIER_A_ANIMLOWER;
- }
- else if (cd == BARRIER_B_LOWERED || cd == BARRIER_B_ANIMLOWER)
- {
- Screen->ComboD[i] = BARRIER_B_ANIMRAISE;
- }
- else if (cd == BARRIER_A_SWITCH)
- {
- Screen->ComboD[i] = BARRIER_B_SWITCH;
- }
- }
- }
- else
- {
- barriers[curdmap] = false;
- for (int i = 0; i <= 175; ++i)
- {
- cd = Screen->ComboD[i];
- if (cd == BARRIER_B_RAISED || cd == BARRIER_B_WALKABLE || cd == BARRIER_B_ANIMRAISE) #
- {
- Screen->ComboD[i] = BARRIER_B_ANIMLOWER;
- }
- else if (cd == BARRIER_A_LOWERED || cd == BARRIER_A_ANIMLOWER)
- {
- Screen->ComboD[i] = BARRIER_A_ANIMRAISE;
- }
- else if (cd == BARRIER_B_SWITCH)
- {
- Screen->ComboD[i] = BARRIER_A_SWITCH;
- }
- }
- }
- return barriers[curdmap];
- }
- // This script controls barriers on the screen
- // The FFC is automatically created by Barriers_NewScreen()
- ffc script Barriers
- {
- void run()
- {
- // Initialize storage for bswitch hit dummies
- int bswitch_count;
- npc bswitch[8]; int i; int j;
- for (i = 0; i <= 175; ++i)
- {
- if (Screen->ComboD[i] == BARRIER_A_SWITCH || Screen->ComboD[i] == BARRIER_B_SWITCH)
- {
- npc bs = CreateNPCAt(BARRIER_SWITCH_DUMMY, ComboX(i), ComboY(i));
- bs->HitWidth = 8; // Smaller hit box to avoid annoying collisions with Link
- bs->HitHeight = 8;
- bs->HP = BARRIER_SWITCH_DUMMY_HP;
- bswitch[bswitch_count++] = bs;
- }
- }
- // Change raised barriers to walkable ones if Link enters screen on a raised barrier
- int lcombo = LinkOnComboD();
- bool onbarrier = (lcombo == BARRIER_A_RAISED || lcombo == BARRIER_B_RAISED);
- if (onbarrier)
- {
- for (i = 0; i < 176; ++i)
- {
- if (Screen->ComboD[i] == BARRIER_A_RAISED)
- {
- Screen->ComboD[i] = BARRIER_A_WALKABLE;
- }
- else if (Screen->ComboD[i] == BARRIER_B_RAISED)
- {
- Screen->ComboD[i] = BARRIER_B_WALKABLE;
- }
- }
- }
- while (true)
- {
- // Detect hits on bswitches, and change combos accordingly
- for (j = 0; j < bswitch_count; ++j)
- {
- if (bswitch[j]->HP < BARRIER_SWITCH_DUMMY_HP)
- {
- bswitch[j]->HP = BARRIER_SWITCH_DUMMY_HP;
- ToggleBarriers();
- break; //break so that only one bswitch hit may register per frame
- }
- }
- // Make barriers walkable if Link is on raised barriers, or unwalkable if not
- lcombo = LinkOnComboD();
- if (!onbarrier && (lcombo == BARRIER_A_RAISED || lcombo == BARRIER_B_RAISED))
- {
- onbarrier = true;
- for (i = 0; i <= 175; ++i)
- {
- if (Screen->ComboD[i] == BARRIER_A_RAISED)
- {
- Screen->ComboD[i] = BARRIER_A_WALKABLE;
- }
- else if (Screen->ComboD[i] == BARRIER_B_RAISED)
- {
- Screen->ComboD[i] = BARRIER_B_WALKABLE;
- }
- }
- }
- else if (onbarrier && !(lcombo == BARRIER_A_WALKABLE || lcombo == BARRIER_B_WALKABLE))
- {
- onbarrier = false;
- for (i = 0; i <= 175; ++i)
- {
- if (Screen->ComboD[i] == BARRIER_A_WALKABLE)
- {
- Screen->ComboD[i] = BARRIER_A_RAISED;
- }
- else if (Screen->ComboD[i] == BARRIER_B_WALKABLE)
- {
- Screen->ComboD[i] = BARRIER_B_RAISED;
- }
- }
- }
- Waitframe();
- }
- }
- }
- // A utility function that returns the ID of the combo that Link appears to stand on
- int LinkOnComboD() {
- return Screen->ComboD[ComboAt(Link->X+8, Link->Y+13)];
- }
- void _Follower(ffc follower, int followerX, int followerY)
- {
- if(Link->Item[FOLLOWER_REQUIRED_ITEM])
- {
- if(Link->Action != LA_SCROLLING && follower->Data==0)
- {
- follower = Screen->LoadFFC(FOLLOWER_FFC_INDEX);
- follower->Data = FOLLOWER_FIRST_COMBO_ID;
- follower->CSet = FOLLOWER_CSET;
- followerX[BAR_PASTX] = Link->X;
- follower->X = Link->X;
- followerY[BAR_PASTY] = Link->Y;
- follower->Y = Link->Y;
- for ( int i = 0; i < 13; i++ )
- {
- followerX[i] = Link->X;
- followerY[i] = Link->Y;
- }
- firstCheck = true;
- }
- if(Link->Action != LA_SCROLLING)
- {
- if((Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft)&&(!(Link->InputA || Link->InputB)))
- {
- followerX[BAR_PASTX] = follower->X;
- follower->X = followerX[0];
- for(switch_index=0; switch_index<12; switch_index++)
- {
- followerX[switch_index] = followerX[switch_index + 1];
- }
- followerX[12] = Link->X;
- followerY[BAR_PASTY] = follower->Y;
- follower->Y = followerY[0];
- for(switch_index=0; switch_index<12; switch_index++)
- {
- followerY[switch_index] = followerY[switch_index + 1];
- }
- followerY[12] = Link->Y;
- }
- if(follower->Y > followerY[BAR_PASTY])
- {
- follower->Data = FOLLOWER_FIRST_COMBO_ID + 5;
- }
- else if(follower->Y < followerY[BAR_PASTY])
- {
- follower->Data = FOLLOWER_FIRST_COMBO_ID + 4;
- }
- else if(follower->X > followerX[BAR_PASTX])
- {
- follower->Data = FOLLOWER_FIRST_COMBO_ID + 7;
- }
- else if(follower->X < followerX[BAR_PASTX])
- {
- follower->Data = FOLLOWER_FIRST_COMBO_ID + 6;
- }
- if(!(Link->InputUp || Link->InputDown || Link->InputRight || Link->InputLeft))
- {
- if((follower->Data == (FOLLOWER_FIRST_COMBO_ID + 4))||(follower->Data == (FOLLOWER_FIRST_COMBO_ID + 5))||(follower->Data == (FOLLOWER_FIRST_COMBO_ID + 6))||(follower->Data == (FOLLOWER_FIRST_COMBO_ID + 7)))
- {
- follower->Data = follower->Data - 4;
- }
- else if((follower->Data == (FOLLOWER_FIRST_COMBO_ID + 3))||(follower->Data == (FOLLOWER_FIRST_COMBO_ID + 2))||(follower->Data == (FOLLOWER_FIRST_COMBO_ID + 1))||(follower->Data == (FOLLOWER_FIRST_COMBO_ID)))
- {
- //empty else if ??? -Z
- }
- else
- {
- follower->Data = FOLLOWER_FIRST_COMBO_ID;
- }
- }
- }
- if(Link->Action == LA_SCROLLING)
- {
- firstCheck = false;
- }
- }
- }
- void _Do_Barriers()
- {
- // Keep track of screen changes
- // Run a Barrier script on every screen change
- if (Game->GetCurScreen() != curscreen)
- {
- curscreen = Game->GetCurScreen();
- Barriers_NewScreen();
- }
- }
- void UpdateLadders()
- {
- if (onLadder) Link->Dir = DIR_UP;
- }
- void PowerBracelet()
- {
- if(Link->Item[LTM_HOLDING])
- {
- if(CountFFCsRunning(SCRIPT_POWERBRACELET)==0 && holding_block>0)
- {
- holding_block = 0;
- Link->Item[LTM_HOLDING] = false;
- Link->Item[LTM_CATCHING] = false;
- Link->Item[LTM_PULLING] = false;
- }
- }
- }
- // Global function that doesn't get us stuck as always climbing when leaving an FFC sideview ladder screen while climbing
- // sets onLadder to false if it isn't Sideview, or if the Sideview Ladder FFC script isn't present on new screen
- void FFCBugFix_SVLadder(int oldscreen, int olddmap)
- {
- if(!IsSideview()) onLadder = false;
- else
- {
- int buffer[] = "Sideview_Ladder";
- if(CountFFCsRunning(Game->GetFFCScript(buffer)) == 0) onLadder = false;
- }
- }
- // Global version of Sideview Ladder script.
- // If you have lots of screens using the sideview ladder this will save you the hassle of having to place the FFC on each one
- // If using the global, DON'T use the FFC.
- void GLB_Sideview_Ladder()
- {
- onLadder = false;
- if(!IsSideview()) return;
- itemdata feather = Game->LoadItemData(I_ROCSFEATHER);
- if( isSVLadder(Link->X+8, Link->Y+6) || isSVLadder(Link->X+8, Link->Y+15) )
- {
- // Link is on SV ladder
- onLadder = true;
- if(Link->Jump < 0) Link->Jump=0;
- if(Link->InputUp)
- {
- if( !isSolid(Link->X+1, Link->Y-1) && !isSolid(Link->X+8, Link->Y-1) && !isSolid(Link->X+14, Link->Y-1) )
- Link->Y--;
- }
- else if(Link->InputDown)
- {
- if( !isSolid(Link->X+1, Link->Y+16) && !isSolid(Link->X+8, Link->Y+16) && !isSolid(Link->X+14, Link->Y+16) )
- Link->Y++;
- }
- if( (Link->InputRight || Link->InputLeft) && useFeather() && Link->Jump == 0)
- {
- if( !isSolid(Link->X+1, Link->Y-1) && !isSolid(Link->X+8, Link->Y-1) && !isSolid(Link->X+14, Link->Y-1) )
- {
- Game->PlaySound(feather->UseSound);
- Link->Jump = 1.6 + (feather->Power*0.8);
- }
- }
- if(isSolid(Link->X+8, Link->Y+16) && isSolid(Link->X+8, Link->Y+16) && isSolid(Link->X+14, Link->Y+16) )
- {
- // Link is standing on solid ground at the base of SV Ladder
- onLadder = false;
- if(useFeather())
- {
- Game->PlaySound(feather->UseSound);
- Link->Jump = 1.6 + (feather->Power*0.8);
- }
- }
- }
- else if( isSVLadder(Link->X+8,Link->Y+16) )
- {
- // Link is standing on top of SV Ladder
- Link->Jump=0;
- if(Link->InputDown)
- {
- Link->Y++;
- onLadder = true;
- }
- else if(useFeather())
- {
- Game->PlaySound(feather->UseSound);
- Link->Jump = 1.6 + (feather->Power*0.8);
- }
- }
- else if( isSVLadder(Link->X+8,Link->Y+17) || isSVLadder(Link->X+8,Link->Y+18) )
- {
- // Link is falling above SV Ladder, snap him to grid so we don't miss
- Link->Jump = 0;
- Link->Y += 16 - (Link->Y%16);
- }
- }//end GLB_Sideview_Ladder
- // ----------------------------------------------------------------------
- // Utility functions used by Sideview Ladder
- // Useful for other scripts to call for script interactions
- // Returns true if x,y is both the SV Ladder flag and type
- bool isSVLadder(int x, int y)
- {
- int loc = ComboAt(x,y);
- return( Screen->ComboT[loc] == CT_SVLADDER && ComboFI(loc, CF_SVLADDER) );
- }
- bool isSVLadder(int loc)
- {
- return( Screen->ComboT[loc] == CT_SVLADDER && ComboFI(loc, CF_SVLADDER) );
- }
- // returns true if feather is equipped and being used
- // could add more checks for more Roc Items in here, or some other type of jumping method, eg L-button.
- bool useFeather()
- {
- if(GetEquipmentA()==I_ROCSFEATHER && Link->PressA) return true;
- if(GetEquipmentB()==I_ROCSFEATHER && Link->PressB) return true;
- return false;
- }
- //When will I be done editing/fixing these same three scripts as a courtesy for users?! I didn't even write the things! -Z
- //----------------------------------------------------------------
- // F1.3 Circular Motion
- ffc script CircularMotion
- {
- void run(int radius, int speed, int angle, int radius2, int angle2)
- {
- if(radius2 == 0) radius2 = radius; //Circle
- if(angle < 0) angle = Rand(360); //Random Start
- int cx = this->X;
- int cy = this->Y;
- while(true)
- {
- angle += speed;
- if(angle < -360)angle+=360; //Wrap if below -360.
- else if(angle > 360)angle-=360; //Wrap if above 360.
- if(angle2==0)
- {
- this->X = cx + radius*Cos(angle);
- this->Y = cy + radius2*Sin(angle);
- }
- else //Rotate at center.
- {
- this->X = cx + radius*Cos(angle)*Cos(angle2) - radius2*Sin(angle)*Sin(angle2);
- this->Y = cy + radius2*Sin(angle)*Cos(angle2) + radius*Cos(angle)*Sin(angle2);
- }
- Waitframe();
- }
- }
- }
- // -------------
- // Item script
- item script PowerBracelet
- {
- void run()
- {
- // if(holding_block==0 && holding_item==0 && holding_bomb==0)
- if(holding_block==0) // use this line if not using GB_Shop and GB_Bombs
- {
- if(!link_catching && isSolid(TouchedX(),TouchedY()))
- {
- link_catching=1;
- int args[] = {0,0,0,0,0,0,0,0};
- int id = RunFFCScript(SCRIPT_POWERBRACELET, args);
- }
- }
- }
- }
- // FFC script (automatically called by the item script - you don't have to place any ffc on the screen for this)
- ffc script UsePowerBracelet
- {
- void run(int input)
- {
- // initialization
- this->Data = INV_COMBO_ID;
- this->X = -16;
- this->Y = -16;
- int counter = 0;
- while(Link->InputA || Link->InputB)
- {
- // set link catching the wall / block / bush
- if(!Link->Item[LTM_CATCHING]) Link->Item[LTM_CATCHING] = true;
- // to fix a bug...
- if(!isSolid(TouchedX(),TouchedY())) break;
- // if pressing opposite direction, set link pulling
- if(OppositeDir())
- {
- if(!Link->Item[LTM_PULLING]) Link->Item[LTM_PULLING] = true;
- counter ++;
- }
- else
- {
- if(Link->Item[LTM_PULLING]) Link->Item[LTM_PULLING] = false;
- counter = 0;
- }
- // if pulling a block or bush for 15 frames or more, pick it up
- if(counter>PB_PULL_TIME)
- {
- int loc=TouchedComboLoc();
- if(Screen->ComboF[loc]==CF_PICK || Screen->ComboI[loc]==CF_PICK)
- {
- link_catching = 0;
- int combo = Screen->ComboD[loc];
- int cset = Screen->ComboC[loc];
- if(isBush(Screen->ComboT[loc])) holding_bush = true;
- else holding_bush = false;
- if(PB_UNDERCOMBO<0) Screen->ComboD[loc] += (-PB_UNDERCOMBO);
- else Screen->ComboD[loc] = PB_UNDERCOMBO;
- ItemSetAt(IS_DEFAULT,loc);
- Game->PlaySound(SFX_PICKUP_BLOCK);
- throw_disabled = true;
- // mid-air block
- for(int i=0;i<16;i++)
- {
- int blockX = (Link->X+ComboX(loc))/2;
- int blockY = Link->Y-7;
- Screen->FastCombo(LAYER_OVER, blockX, blockY, combo, cset, 128 );
- WaitNoAction();
- }
- // set link holding
- holding_block = 1;
- if(!Link->Item[LTM_HOLDING]) Link->Item[LTM_HOLDING] = true;
- while(throw_disabled || (!Link->InputA && !Link->InputB))
- {
- if(!Link->InputA && !Link->InputB) throw_disabled = false;
- Screen->FastCombo(LAYER_OVER, Link->X, Link->Y - 14, combo, cset, 128 );
- if(Link->Invisible || (Link->Action != LA_NONE && Link->Action != LA_WALKING)) break; // break if falling in pit or water!
- Waitframe();
- }
- if(Link->Invisible || (Link->Action != LA_NONE && Link->Action != LA_WALKING)) break; // break if falling in pit or water!
- counter = 0;
- holding_block = 0;
- if(Link->Item[LTM_CATCHING]) Link->Item[LTM_CATCHING] = false;
- if(Link->Item[LTM_PULLING]) Link->Item[LTM_PULLING] = false;
- if(Link->Item[LTM_HOLDING]) Link->Item[LTM_HOLDING] = false;
- // throw block
- lweapon w = CreateLWeaponAt(LW_SCRIPT1,Link->X,Link->Y);
- w->Damage = BLOCK_DMG;
- w->OriginalTile = INV_TILE_ID;
- w->NumFrames = 1;
- w->Dir = Link->Dir;
- w->Step = Floor(BLOCK_VH*100);
- w->DrawYOffset = -14;
- w->HitXOffset = -4;
- w->HitYOffset = -4;
- w->HitWidth = 16 + 8;
- w->HitHeight = 16 + 8;
- w->HitZHeight = 16 + 8;
- Game->PlaySound(SFX_THROW_BLOCK);
- while(w->DrawYOffset<0 && !isSolid(w->X+8,w->Y+ 8) && !isOutOfScreen(w->X,w->Y,16,16))
- {
- if(counter<4) Link->Action = LA_ATTACKING;
- w->DrawYOffset += Floor(counter*GRAVITY) - BLOCK_VV;
- Screen->FastCombo(LAYER_OVER, w->X, w->Y + w->DrawYOffset, combo, cset, 128 );
- Waitframe();
- counter ++;
- }
- if(holding_bush) Game->PlaySound(SFX_GRASSCUT);
- else Game->PlaySound(SFX_CRASH_BLOCK);
- if(w->isValid())
- {
- w->DeadState = WDS_DEAD;
- if(holding_bush) CreateGraphicAt(BUSH_SPR,w->X,w->Y + w->DrawYOffset);
- else CreateGraphicAt(CRASH_SPR,w->X,w->Y + w->DrawYOffset);
- }
- break;
- }
- }
- NoMoveAction();
- Waitframe();
- }
- link_catching = 0;
- holding_block = 0;
- counter = 0;
- if(Link->Item[LTM_CATCHING]) Link->Item[LTM_CATCHING] = false;
- if(Link->Item[LTM_PULLING]) Link->Item[LTM_PULLING] = false;
- if(Link->Item[LTM_HOLDING]) Link->Item[LTM_HOLDING] = false;
- this->Data = 0;
- Quit();
- }
- }
- // utility functions
- bool isBush(int ct)
- {
- if(ct==CT_BUSH) return true;
- if(ct==CT_BUSHC) return true;
- if(ct==CT_BUSHNEXT) return true;
- if(ct==CT_BUSHNEXTC) return true;
- if(ct==CT_FLOWERS) return true;
- if(ct==CT_FLOWERSC) return true;
- return false;
- }
- // ------------------------------------------
- // x touched by Link
- int TouchedX()
- {
- int x;
- if(Link->Dir == DIR_UP) x = Link->X+8;
- else if(Link->Dir == DIR_DOWN) x = Link->X+8;
- else if(Link->Dir == DIR_LEFT) x = Link->X-2;
- else if(Link->Dir == DIR_RIGHT) x = Link->X+18;
- return x;
- }
- // y touched by Link
- int TouchedY()
- {
- int y;
- if(Link->Dir == DIR_UP) y = Link->Y+6;
- else if(Link->Dir == DIR_DOWN) y = Link->Y+18;
- else if(Link->Dir == DIR_LEFT) y = Link->Y+8;
- else if(Link->Dir == DIR_RIGHT) y = Link->Y+8;
- return y;
- }
- // location of the touched combo
- int TouchedComboLoc()
- {
- int loc;
- loc = ComboAt( TouchedX(), TouchedY() );
- return loc;
- }
- // create a dummy npc and kill it, giving an item
- void ItemSetAt(int itemset,int loc)
- {
- npc e = Screen->CreateNPC(NPC_ITEMSET);
- e->ItemSet = itemset;
- if(e->isValid())
- {
- e->X = loc%16*16;
- e->Y = loc-loc%16;
- }
- e->HP = HP_SILENT;
- }
- // function to test if (x,y) is out of the screen
- bool isOutOfScreen(int x, int y, int dx, int dy)
- {
- if((x+dx) > 16*16) return true;
- else if(x < 0) return true;
- else if((y+dy) > 16*11) return true;
- else if(y < 0) return true;
- else return false;
- }
- // create a sprite
- int CreateGraphicAt(int sprite, int x, int y)
- {
- eweapon e = Screen->CreateEWeapon(EW_SCRIPT1);
- e->HitXOffset = 500;
- e->UseSprite(sprite);
- e->DeadState = e->NumFrames*e->ASpeed;
- e->X = x;
- e->Y = y;
- return e->DeadState;
- }
- // inhibit all the movement actions
- void NoMoveAction()
- {
- Link->InputUp = false;
- Link->InputDown = false;
- Link->InputLeft = false;
- Link->InputRight = false;
- }
- // this utility routine by Saffith checks for walkability of combos
- bool isSolid(int x, int y)
- {
- if(x<0 || x>255 || y<0 || y>175) return false;
- int mask=1111b;
- if(x%16< 8) mask&=0011b;
- else mask&=1100b;
- if(y%16< 8) mask&=0101b;
- else mask&=1010b;
- return (!(Screen->ComboS[ComboAt(x, y)]&mask)==0);
- }
- // gives true if Link pushes the opposite direction of his facing direction
- bool OppositeDir()
- {
- if(Link->InputDown && Link->Dir==DIR_UP) return true;
- if(Link->InputUp && Link->Dir==DIR_DOWN) return true;
- if(Link->InputRight && Link->Dir==DIR_LEFT) return true;
- if(Link->InputLeft && Link->Dir==DIR_RIGHT) return true;
- else return false;
- }
- // -----------------------------
- //F1.4 Moosh NPC
- //Useful for...? Stuff.
- //Solid, but needs to be aligned to grid, pixel-perfect
- ffc script NPCScript{
- void run(int String, int ItemCheck, int Type, int Arg1, int Arg2, int NoSolid, int Script){
- //Stores the NPC's combo, hides it
- int Combo = this->Data;
- this->Data = CMB_NPC_HIDDEN;
- //Waits until the NPC should appear and shows it
- if(ItemCheck<0){
- while(!Link->Item[Abs(ItemCheck)]){
- Waitframe();
- }
- this->Data = Combo;
- if(Type==NPCBT_FACELINK){
- this->Data = Combo + Arg1;
- }
- }
- else if(ItemCheck>0){
- if(!Link->Item[Abs(ItemCheck)]){
- this->Data = Combo;
- if(Type==NPCBT_FACELINK){
- this->Data = Combo + Arg1;
- }
- }
- }
- else if(ItemCheck==0){
- this->Data = Combo;
- if(Type==NPCBT_FACELINK){
- this->Data = Combo + Arg1;
- }
- }
- //Saves the width and height of the FFC for collision checks
- int Width = 16;
- int Height = 16;
- if(this->EffectWidth!=16)
- Width = this->EffectWidth;
- else if(this->TileWidth>1)
- Width = this->TileWidth*16;
- if(this->EffectHeight!=16)
- Height = this->EffectHeight;
- else if(this->TileHeight>1)
- Height = this->TileHeight*16;
- //Wait until the screen is done scrolling to avoid a weird ZC crashing bug
- Waitframe();
- while(Link->Action==LA_SCROLLING){
- Waitframe();
- }
- //Shared Layer Fix
- if(RESET_NPC_LAYER_ON_ENTRY==1){
- if(Screen->LoadFFC(FindFFCRunning(this->Script))==this){
- for(int i=0; i<176; i++){
- if(GetLayerComboD(LAYER_NPC, i)==CMB_NPC_SOLID){
- SetLayerComboD(LAYER_NPC, i, CMB_NPC_HIDDEN);
- }
- }
- }
- }
- //Sets the space below the NPC or the space a guard NPC occupies to be solid
- if(LAYER_NPC>-1&&NoSolid==0){
- if(Type==NPCBT_GUARDH){
- for(int x=Arg1; x<=Arg2+this->TileWidth-1; x++){
- for(int y=Floor(this->Y/16); y<=Floor(this->Y/16)+this->TileHeight-1; y++){
- SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_SOLID);
- }
- }
- }
- else if(Type==NPCBT_GUARDV){
- for(int x=Floor(this->X/16); x<=Floor(this->X/16)+this->TileWidth-1; x++){
- for(int y=Arg1; y<=Arg2+this->TileHeight-1; y++){
- SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_SOLID);
- }
- }
- }
- else{
- for(int x=Floor(this->X/16); x<=Floor(this->X/16)+this->TileWidth-1; x++){
- for(int y=Floor(this->Y/16); y<=Floor(this->Y/16)+this->TileHeight-1; y++){
- SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_SOLID);
- }
- }
- }
- }
- while(true){
- //Removes NPCs if Link has the required item
- if(ItemCheck>0){
- if(Link->Item[ItemCheck]){
- this->Data = CMB_NPC_HIDDEN;
- if(LAYER_NPC>-1&&NoSolid==0){
- if(Type==NPCBT_GUARDH){
- for(int x=Arg1; x<=Arg2+this->TileWidth-1; x++){
- for(int y=Floor(this->Y/16); y<=Floor(this->Y/16)+this->TileHeight-1; y++){
- SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_HIDDEN);
- }
- }
- }
- else if(Type==NPCBT_GUARDV){
- for(int x=Floor(this->X/16); x<=Floor(this->X/16)+this->TileWidth-1; x++){
- for(int y=Arg1; y<=Arg2+this->TileHeight-1; y++){
- SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_HIDDEN);
- }
- }
- }
- else{
- for(int x=Floor(this->X/16); x<=Floor(this->X/16)+this->TileWidth-1; x++){
- for(int y=Floor(this->Y/16); y<=Floor(this->Y/16)+this->TileHeight-1; y++){
- SetLayerComboD(LAYER_NPC, y*16+x, CMB_NPC_HIDDEN);
- }
- }
- }
- }
- Quit();
- }
- }
- //Handles animation for turning NPCs
- if(Type==NPCBT_FACELINK&&(Link->X>0&&Link->X<240&&Link->Y>0&&Link->Y<160)){
- if(Distance(CenterLinkX(), CenterLinkY(), CenterX(this), CenterY(this))<Arg2)
- this->Data = Combo + AngleDir4(Angle(CenterX(this), CenterY(this), CenterLinkX(), CenterLinkY()));
- else
- this->Data = Combo + Arg1;
- }
- //Handles movement for guard NPCs
- else if(Type==NPCBT_GUARDH){
- if(Link->X>16*Arg1-32&&Link->X<16*Arg2+32&&Link->Y>this->Y-32&&Link->Y<this->Y+32){
- this->X = Clamp(this->X+(-this->X + Link->X)/4, 16*Arg1, 16*Arg2);
- }
- }
- else if(Type==NPCBT_GUARDV){
- if(Link->X>this->X-32&&Link->X<this->X+32&&Link->Y>16*Arg1-32&&Link->Y<16*Arg2+32){
- this->Y = Clamp(this->Y+(-this->Y + Link->Y)/4, 16*Arg1, 16*Arg2);
- }
- }
- //Facing Up
- if(Link->Dir==DIR_UP&&Link->Y>=this->Y&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-8&&Link->X<=this->X+Width-8){
- if(CMB_NPC_CANTALK>0)
- Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
- if(Link->PressA){
- Link->InputA = false;
- Link->PressA = false;
- Screen->Message(String);
- if(Script>0){
- RunFFCScript(Script, 0);
- }
- }
- }
- //Facing Down
- else if(Link->Dir==DIR_DOWN&&Link->Y>=this->Y-16&&Link->Y<=this->Y+Height-16&&Link->X>=this->X-8&&Link->X<=this->X+Width-8){
- if(CMB_NPC_CANTALK>0)
- Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
- if(Link->PressA){
- Link->InputA = false;
- Link->PressA = false;
- Screen->Message(String);
- if(Script>0){
- RunFFCScript(Script, 0);
- }
- }
- }
- //Facing Left
- else if(Link->Dir==DIR_LEFT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X&&Link->X<=this->X+Width){
- if(CMB_NPC_CANTALK>0)
- Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
- if(Link->PressA){
- Link->InputA = false;
- Link->PressA = false;
- Screen->Message(String);
- if(Script>0){
- RunFFCScript(Script, 0);
- }
- }
- }
- //Facing Right
- else if(Link->Dir==DIR_RIGHT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-16&&Link->X<=this->X+Width-16){
- if(CMB_NPC_CANTALK>0)
- Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
- if(Link->PressA){
- Link->InputA = false;
- Link->PressA = false;
- Screen->Message(String);
- if(Script>0){
- RunFFCScript(Script, 0);
- }
- }
- }
- Waitframe();
- }
- }
- }
- ffc script NPCScript_Simple{
- void run(int String, int Script, int D0, int D1, int D2, int D3, int D4, int D5){
- //Saves the width and height of the FFC for collision checks
- int Width = 16;
- int Height = 16;
- if(this->EffectWidth!=16)
- Width = this->EffectWidth;
- else if(this->TileWidth>1)
- Width = this->TileWidth*16;
- if(this->EffectHeight!=16)
- Height = this->EffectHeight;
- else if(this->TileHeight>1)
- Height = this->TileHeight*16;
- while(true){
- //Facing Up
- if(Link->Dir==DIR_UP&&Link->Y>=this->Y&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-8&&Link->X<=this->X+Width-8){
- if(CMB_NPC_CANTALK>0)
- Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
- if(Link->PressA){
- Link->InputA = false;
- Link->PressA = false;
- Screen->Message(String);
- if(Script>0){
- int Args[8] = {D0, D1, D2, D3, D4, D5};
- RunFFCScript(Script, Args);
- }
- }
- }
- //Facing Down
- else if(Link->Dir==DIR_DOWN&&Link->Y>=this->Y-16&&Link->Y<=this->Y+Height-16&&Link->X>=this->X-8&&Link->X<=this->X+Width-8){
- if(CMB_NPC_CANTALK>0)
- Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
- if(Link->PressA){
- Link->InputA = false;
- Link->PressA = false;
- Screen->Message(String);
- if(Script>0){
- int Args[8] = {D0, D1, D2, D3, D4, D5};
- RunFFCScript(Script, Args);
- }
- }
- }
- //Facing Left
- else if(Link->Dir==DIR_LEFT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X&&Link->X<=this->X+Width){
- if(CMB_NPC_CANTALK>0)
- Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
- if(Link->PressA){
- Link->InputA = false;
- Link->PressA = false;
- Screen->Message(String);
- if(Script>0){
- int Args[8] = {D0, D1, D2, D3, D4, D5};
- RunFFCScript(Script, Args);
- }
- }
- }
- //Facing Right
- else if(Link->Dir==DIR_RIGHT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-16&&Link->X<=this->X+Width-16){
- if(CMB_NPC_CANTALK>0)
- Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
- if(Link->PressA){
- Link->InputA = false;
- Link->PressA = false;
- Screen->Message(String);
- if(Script>0){
- int Args[8] = {D0, D1, D2, D3, D4, D5};
- RunFFCScript(Script, Args);
- }
- }
- }
- Waitframe();
- }
- }
- }
- const int D_TRADE = 0; //Screen->D value used for the trade sequence state
- ffc script TradeSequence{
- void run(int CheckItem, int TradeItem, int NoItemString, int HasItemString, int TradedString){
- //Check if the player has already traded
- if(Screen->D[D_TRADE]==0){
- //If player hasn't traded and has the required item, play HasItemString, give the new item, and take the old item
- if(Link->Item[CheckItem]){
- Screen->Message(HasItemString);
- WaitNoAction();
- item itm = CreateItemAt(TradeItem, Link->X, Link->Y);
- itm->Pickup = IP_HOLDUP;
- Link->Item[CheckItem] = false;
- Screen->D[D_TRADE] = 1;
- WaitNoAction();
- }
- //If player hasn't traded and doesn't have the required item, play NoItemString
- else{
- Screen->Message(NoItemString);
- WaitNoAction();
- }
- }
- //If the player has already traded, play TradedString
- else{
- Screen->Message(TradedString);
- WaitNoAction();
- }
- }
- }
- //---------------------------------------------------------------
- //F1.5 Alternate NPC
- //Useful for triggering stuff
- //No NPC solidarity
- // FFC script for talking NPCs with different functions
- // It's pretty much a sign you can approach from any side.
- // d0: String number to be displayed
- // D1: Set to anything other than zero. Tells the ffc that this NPC has more than one message. Use string control codes to determine what message to display. Use \3\x\y\z at the beginning of your string where X is Zero, Y is one and Z is the string to switch to.
- // D2: If you want the NPC to warp you to another screen after you talk to it. Set to anything other than zero to activate. Uses Sidewarp D to set destination.
- // D3: If you want the NPC to heal you fully after you talk to it. Set to anything other than zero to activate.
- // D4: The counter to check for amount listed in D5. If requirements are met, screen secrets are triggered. Check std_constants for countertypes.
- // D5: Used to test in-game counters. Can be used for collectibles, either existing or created. Set to Zero if this NPC doesn't require certain items.
- ffc script altnpcscript
- {
- void run(int message, int differentmessage, int warpoccurs, int healoccurs, int countertype, int amount)
- {
- // So that people don't have to be pixel perfect on placing npcs.
- this->X = Round(this->X / 8) * 8;
- this->Y = Round(this->Y / 8) * 8;
- while(true)
- {
- // Set up some values to make the if statement smaller.
- int LinkX = Link->X + 8;
- int LinkY = Link->Y + 8;
- int thisX = Round(this->X / 8) * 8;
- int thisY = Round(this->Y / 8) * 8;
- int centerX = thisX + this->EffectWidth / 2;
- int centerY = thisY + this->EffectHeight / 2;
- // If Link is on one of the sides of the NPC and facing it
- if(
- ((Abs(LinkX - centerX) < this->EffectWidth / 2 && Abs(LinkY - centerY) <= this->EffectHeight / 2 + 12 && LinkY < centerY && Link->Dir == DIR_DOWN) ||
- (Abs(LinkX - centerX) < this->EffectWidth / 2 && Abs(LinkY - centerY) <= this->EffectHeight / 2 + 4 && LinkY > centerY && Link->Dir == DIR_UP) ||
- (Abs(LinkY + 3 - centerY) < this->EffectHeight / 2 && Abs(LinkX - centerX) <= this->EffectWidth / 2 + 12 && LinkX < centerX && Link->Dir == DIR_RIGHT) ||
- (Abs(LinkY + 3- centerY) < this->EffectHeight / 2 && Abs(LinkX - centerX) <= this->EffectWidth / 2 + 12 && LinkX > centerX && Link->Dir == DIR_LEFT)))
- {
- // If the player talks to the NPC. Automatically uses L to reduce arguments on NPCs. can be changed to the button of your choice.
- if(Link->InputA)
- {
- // Show the message
- int perm;//A variable which will be zero until you speak with the NPC.
- //If this NPC says more than one thing, this code runs.
- if(differentmessage !=0 && Screen->D[perm] == 1){
- Screen->Message(message);
- //Check to see if you've spoken to this NPC and it wants a certain # of items.
- if ( Game->Counter[countertype] >= amount && Screen->State[ST_SECRET] == false && Screen->D[perm] == 1 && amount != 0) {
- Game->PlaySound(27);
- Screen->TriggerSecrets();
- Screen->State[ST_SECRET] = true;
- }
- //Heals Link if this NPC does that.
- if(healoccurs != 0){
- Link->HP = Link->MaxHP;
- Link->MP = Link->MaxMP;
- }
- //Warps Link if this NPC does that.
- if(warpoccurs != 0){
- Waitframe();
- this->Data = CMB_AUTOWARPD;
- }
- }
- //All other NPC functions.
- else{
- Screen->Message(message);
- if (Screen->D[perm]){
- return;
- }
- else{
- Waitframe();
- Screen->D[perm] = 1;
- }
- //Heals Link if this NPC does that.
- if(healoccurs != 0){
- Link->HP = Link->MaxHP;
- Link->MP = Link->MaxMP;
- }
- //Warps Link if this NPC does that.
- if(warpoccurs != 0){
- Waitframe();
- this->Data = CMB_AUTOWARPD;
- }
- }
- // Wait a bit before letting the npc trigger again.
- Waitframes(30);
- } // End of if Link triggered npc
- } // End of Link positioning
- Waitframe();
- } // End of while(true)
- } // End of void run(int message)
- } // End of ffc script altnpcscript
- //-----------------------------------------------------------------
- //F1.6 RealNPC
- //Solid, non-grid-aligned
- ffc script real_npcV2 {
- void run(int m, int gmitem, int f, int d, int def_dir, int npcissolid, int gm_min, int gm_max) {
- int d_x;
- int d_y;
- int a_x;
- int a_y;
- int ir;
- int tho=(this->TileHeight*16-16);
- int orig_d = this->Data;
- int Apressed2;
- int Appr2;
- int onscreenedge;
- if(d == 0) d = 48;
- while(true) {
- //This detects if link is on the edge of the screen
- if (Link->X<8 || Link->Y<8 || Link->X>232 || Link->Y>152){onscreenedge=1;} else {onscreenedge=0;}
- //This checks if you're above or below the NPC to create an overhead effect
- if (Link->Y<this->Y-8+tho && onscreenedge==0){this->Flags[FFCF_OVERLAY] = true;} else {this->Flags[FFCF_OVERLAY] = false;}
- //This detects if A was pressed, allowing you to exit messages with the A button
- if (Link->InputA)
- {
- if (Apressed2==1){Apressed2=0;}
- else
- {
- if (Appr2==0){Apressed2=1; Appr2=1;}}
- }
- else
- {
- Apressed2=0;
- Appr2=0;
- }
- d_x = this->X - Link->X;
- d_y = this->Y+(this->TileHeight*16-16) - Link->Y;
- a_x = Abs(d_x);
- a_y = Abs(d_y);
- if(f != 0) {
- if(a_x < d && a_y < d) {
- if(a_x <= a_y) {
- if(d_y >= 0) {
- this->Data = orig_d + DIR_DOWN;
- } else {
- this->Data = orig_d + DIR_UP;
- }
- } else {
- if(d_x >= 0) {
- this->Data = orig_d + DIR_LEFT;
- } else {
- this->Data = orig_d + DIR_RIGHT;
- }
- }
- } else {
- this->Data = orig_d + def_dir;
- }
- }
- //This checks if you have item D1, and makes the NPC disappear if you do.
- if (Link->Item[gmitem] == true){this->X=-256; this->Y=-256;}
- else
- {
- //This enables horizontal guard mode.
- if (gm_max>0)
- {
- if (Link->X>gm_min-32 && Link->X<gm_max+32 && Link->Y>this->Y+tho-32 && Link->Y<this->Y+tho+32) {ir=1;}
- else {ir=0;}
- if (Link->X<this->X-2 && this->X>gm_min && ir==1)
- {
- if (Link->X>gm_min){this->Vx= (- this->X + Link->X)/4;}
- else{this->Vx= (- this->X + gm_min)/4;}
- }
- if (Link->X>this->X+2 && this->X<gm_max && ir==1)
- {
- if (Link->X<gm_max){this->Vx= (Link->X - this->X)/4;}
- else{this->Vx= (gm_max - this->X)/4;}
- }
- if (Link->X<this->X+2 && Link->X>this->X-2){this->Vx=0;}
- if (ir==0){this->Vx=0;}
- if (this->X<gm_min+1){
- if (this->Vx<0) this->Vx=0;
- this->X=gm_min;
- }
- if (this->X>gm_max-1){
- if (this->Vx>0) this->Vx=0;
- this->X=gm_max;
- }
- }
- //This enables vertical guard mode.
- if (gm_max<0)
- {
- if (Link->Y>-gm_min-32 && Link->Y<-gm_max+32 && Link->X>this->X-32 && Link->X<this->X+32) {ir=1;}
- else {ir=0;}
- if (Link->Y<this->Y-2+tho && this->Y+tho>-gm_min && ir==1)
- {
- if (Link->Y>-gm_min){this->Vy= (- this->Y-tho + Link->Y)/4;}
- else {this->Vy= (- this->Y-tho + -gm_min)/4;}
- }
- if (Link->Y>this->Y+2+tho && this->Y+tho<-gm_max && ir==1)
- {
- if (Link->Y<-gm_max){this->Vy= (Link->Y - this->Y-tho)/4;}
- else {this->Vy= (-gm_max - this->Y-tho)/4;}
- }
- if (Link->Y<this->Y+2+tho && Link->Y>this->Y-2+tho){this->Vy=0;}
- if (ir==0){this->Vy=0;}
- if (this->Y+tho<-gm_min+1){
- if (this->Vy<0)this->Vy=0;
- this->Y=-gm_min-tho;
- }
- if (this->Y+tho>-gm_max-1){
- if (this->Vy>0)this->Vy=0;
- this->Y=-gm_max-tho;
- }
- }
- }
- if (this->Vy>0)this->Data = orig_d + DIR_UP;
- if (this->Vy<0)this->Data = orig_d + DIR_DOWN;
- if (this->Vx>0)this->Data = orig_d + DIR_RIGHT;
- if (this->Vx<0)this->Data = orig_d + DIR_LEFT;
- if(Apressed2==1 && a_x < 24 && a_y < 24) {
- //This is all checking if Link is facing the NPC while to the left, to the right, above, or below the NPC
- if (Link->X<this->X-8 && Link->Y>this->Y+tho-12 && Link->Y<this->Y+tho+8 && Link->Dir == DIR_RIGHT || Link->X>this->X+8 && Link->Y>this->Y+tho-12 && Link->Y<this->Y+tho+8 && Link->Dir == DIR_LEFT || Link->Y<this->Y+tho-8 && Link->X>this->X-8 && Link->X<this->X+8 && Link->Dir == DIR_DOWN || Link->Y>this->Y+tho+8 && Link->X>this->X-8 && Link->X<this->X+8 && Link->Dir == DIR_UP){
- Apressed2=0;
- Screen->Message(m);
- Link->InputA = false;
- }
- }
- //This enables the NPC to be solid without having to lay a solid combo under it.
- if (npcissolid>0){
- if ((Abs(Link->X - this->X) < 10) &&
- (Link->Y <= this->Y+tho + 12) && (Link->Y > this->Y+tho+8)){Link->Y = this->Y+tho+12;}
- if ((Abs(Link->Y - this->Y-tho) < 10) &&
- (Link->X >= this->X - 12) && (Link->X < this->X-8)){Link->X = this->X-12;}
- if ((Abs(Link->X - this->X) < 10) &&
- (Link->Y >= this->Y+tho - 12) && (Link->Y < this->Y+tho-8)){Link->Y = this->Y+tho-12;}
- if ((Abs(Link->Y - this->Y-tho) < 10) &&
- (Link->X <= this->X + 12) && (Link->X > this->X+8)){Link->X = this->X+12;}
- }
- Waitframe();
- }
- }
- }
- //Handles MoscowModder's Gameboy Shield
- void GameboyShield(){
- if( !ShieldOn() && ShieldItem() ){ //Enable shield when using dummy
- ShieldOn(true); //Set shield state to on
- if ( !Link->Item[ ShieldItem() ] ) Link->Item[ ShieldItem() ] = true; //Give the shield
- Game->PlaySound(SFX_GBSHIELD); //Play the sound
- }
- else if( ( ( ShieldButton() && !Link->InputA )||(!ShieldButton() && !Link->InputB)) //When button is released
- && ShieldOn() ){ //And shield is still on
- Link->Item[ ShieldItem() ]=false; //Remove shield
- ShieldItem(0); //Reset shield item variable
- ShieldOn(false); //Set shield state to off
- }
- }
- /////////////////////////////////////
- /// Global Accessors ///////////////
- /// Setter and Getters for Arrays ///
- /////////////////////////////////////
- //Global setter/getter functions for shield script.
- //Returns if shield is enabled.
- bool ShieldOn(){
- return ( GB_Shield[SHIELD_ENABLED] != 0 );
- }
- //Sets if shield is enabled.
- bool ShieldOn(bool state){
- if ( state ) GB_Shield[SHIELD_ENABLED] = 1;
- else GB_Shield[SHIELD_ENABLED] = 0;
- }
- //Returns if shield is on Button-A
- bool ShieldButton(){
- return ( GB_Shield[SHIELD_BUTTON] != 0 );
- }
- //Sets if shield is on Button-A
- bool ShieldButton(bool buttonA){
- if ( buttonA ) GB_Shield[SHIELD_BUTTON] = 1;
- else GB_Shield[SHIELD_BUTTON] = 0;
- }
- //Returns the item used as the shield in inventory.
- int ShieldItem(){
- return GB_Shield[SHIELD_ITEM];
- }
- //Sets the inventory item to use as a shield.
- void ShieldItem(int itm){
- GB_Shield[SHIELD_ITEM] = itm;
- }
- ////////////////////
- /// Item Scripts ///
- ////////////////////
- //MoscowModder's Shield Script
- //D0: "Real" shield item to give
- item script gbshield{
- void run ( int shield ){
- ShieldItem(shield);
- if ( Link->PressB ) ShieldButton(false);
- else if ( Link->PressA ) ShieldButton(true);
- }
- }
- // F1.0-F1.1 Sideview Ladder and Global
- // ----------------------------------------------------------------------
- // Setup
- //
- // 1. Modify the constants to fit your needs. It looks for both, so they can potentially be used by other scripts.
- // If so, the other script will probably want to make sure it isn't both. isSVLadder function is helpful for this.
- // 2. Use one of the existing globals (see step#3) if no other global scripts.
- // Or see the samp` le globals at the bottom of the script to see how to combine.
- // 3. Decide if using the global version or FFC version. DON'T USE BOTH!!!!
- // Global - if you have lots of screens with the sideview ladder combos
- // FFC - only a few sideview ladder screens, or want more flexibility reusing the Script ComboTypes/Flags.
- // Both versions require adding things to the global script. Each has its own sample global script at the bottom.
- // 3a. If using the FFC version, just place the Sideview_Ladder FFC on that screen. Won't run on non-SV screens.
- // See the sample global, as there are numerous things to add to global for the FFC version.
- // 3b. If using the global version, add or uncomment the GLB_Sideview_Ladder(); part of the global script.
- // See the sample global for what needs to be included.
- // 4. Watch out for compile conflicts with the isSolid function that many other scripts use.
- // Optional Setup
- //
- // Roc's Feather
- // 1. The script looks for only the default Roc Feather item#.
- // So if you've changed that, or have multiple levels of Roc items, you'll need to mod that part of the script.
- //
- // Item use on ladder
- // 1. A/B buttons are still enabled, allowing item use on the ladder
- // Expect weird behavior with certain items due to the script changing Link's direction.
- // i.e. can stab sword to the side while facing up
- // If you use the hookshot, you're likely going to need to modify the script to make it work right, or disable it.
- // ----------------------------------------------------------------------
- // Sideview Ladder functions (FFC and global versions)
- // Place the FFC version on any screen with your sideview ladders. won't run on non Sideview screens
- // DON'T use this AND the global version
- ffc script Sideview_Ladder{
- void run(){
- onLadder = false;
- if(!IsSideview()) Quit();
- itemdata feather = Game->LoadItemData(I_ROCSFEATHER);
- while(true){
- onLadder = false;
- if( isSVLadder(Link->X+8, Link->Y+6) || isSVLadder(Link->X+8, Link->Y+15) ){
- // Link is on SV ladder
- onLadder = true;
- if(Link->Jump < 0) Link->Jump=0;
- if(Link->InputUp){
- if( !isSolid(Link->X+1, Link->Y-1) && !isSolid(Link->X+8, Link->Y-1) && !isSolid(Link->X+14, Link->Y-1) )
- Link->Y--;
- }
- else if(Link->InputDown){
- if( !isSolid(Link->X+1, Link->Y+16) && !isSolid(Link->X+8, Link->Y+16) && !isSolid(Link->X+14, Link->Y+16) )
- Link->Y++;
- }
- if( (Link->InputRight || Link->InputLeft) && useFeather() && Link->Jump == 0){
- if( !isSolid(Link->X+1, Link->Y-1) && !isSolid(Link->X+8, Link->Y-1) && !isSolid(Link->X+14, Link->Y-1) ){
- Game->PlaySound(feather->UseSound);
- Link->Jump = 1.6 + (feather->Power*0.8);
- }
- }
- if(isSolid(Link->X+8, Link->Y+16) && isSolid(Link->X+8, Link->Y+16) && isSolid(Link->X+14, Link->Y+16) ){
- // Link is standing on solid ground at the base of SV Ladder
- onLadder = false;
- if(useFeather()){
- Game->PlaySound(feather->UseSound);
- Link->Jump = 1.6 + (feather->Power*0.8);
- }
- }
- }
- else if( isSVLadder(Link->X+8,Link->Y+16) ){
- // Link is standing on top of SV Ladder
- Link->Jump=0;
- if(Link->InputDown){
- Link->Y++;
- onLadder = true;
- }else if(useFeather()){
- Game->PlaySound(feather->UseSound);
- Link->Jump = 1.6 + (feather->Power*0.8);
- }
- }
- else if( isSVLadder(Link->X+8,Link->Y+17) || isSVLadder(Link->X+8,Link->Y+18) ){
- // Link is falling above SV Ladder, snap him to grid so we don't miss
- Link->Jump = 0;
- Link->Y += 16 - (Link->Y%16);
- }
- Waitframe();
- }// end whileloop
- }//end run
- }//end ffc Sideview_Ladder
- //end merge (2nd Feb, 2018, Z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement