Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // A function to prevent Link from phasing through solid
- // combos, 'solid' ffc, and through water, if knocked back.
- // Prevention of hookshot and ladder spots is here, but
- // disabled, as this *should* be handled by the ZC engine
- // internally.
- //2.50.x Version
- const int CF_NO_KNOCKBACK = 101; //Generic flag to prevent knockback on a square.
- void KnockbackSolidity
- {
- int x, int y;
- if ( Link->HitDir > -1 )
- {
- if (Link->HitDir == DIR_LEFT )
- {
- x = Link->X-1; y = Link->Y+8;
- }
- else if (Link->HitDir == DIR_RIGHT )
- {
- x = Link->X+17; y = Link->Y+8;
- }
- else if (Link->HitDir == DIR_UP )
- {
- x = Link->X+8; y = Link->Y+7; break;
- }
- else if (Link->HitDir == DIR_DOWN )
- {
- x = Link->X-1; y = Link->Y+8;
- }
- else
- {
- return; //invalid direction.
- }
- if ( Screen->isSolid(x,y) )
- {
- Link->HitDir = -1;
- }
- if ( IsSolidFFC(x,y) )
- {
- Link->HitDir = -1;
- }
- if ( Screen->ComboF[ComboAt(x,y)] == CF_NO_KNOCKBACK )
- {
- Link->HitDir = -1;
- }
- if ( Screen->ComboI[ComboAt(x,y)] == CF_NO_KNOCKBACK )
- {
- Link->HitDir = -1;
- }
- if ( Link->Action == LA_GOTHURTLAND )
- {
- if ( Screen->ComboT[ComboAt(x,y)] == CT_WATER )
- {
- Link->HitDir = -1;
- }
- /*
- if ( Screen->ComboT[ComboAt(x,y)] == CT_LADDER )
- {
- Link->HitDir = -1;
- }
- if ( Screen->ComboT[ComboAt(x,y)] == CT_LADDER_HOOKSHOT )
- {
- Link->HitDir = -1;
- }
- if ( Screen->ComboF[ComboAt(x,y)] == CF_LADDER )
- {
- Link->HitDir = -1;
- }
- if ( Screen->ComboF[ComboAt(x,y)] == CF_LADDER_HOOKSHOT )
- {
- Link->HitDir = -1;
- }
- */
- }
- else //Link is swimming
- {
- if ( Screen->ComboT[ComboAt(x,y)] != CT_WATER )
- {
- Link->HitDir = -1;
- }
- }
- }
- }
- // Utility function to check for ffc solidity at an arbitrary pixel.
- // There *must* be a faster way to do this...
- bool IsSolidFFC(int x, int y)
- {
- ffc f; int q = 1;
- for ( ; q < 33; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Flags&FFCF_SOLID )
- {
- if ( RectCollision(f->X, f->Y, f->X+f->EffectWidth, f->Y+f->EffectHeight, x, y, x, y) )
- {
- return true;
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement