/// Combo Collision with Efficiency Improvements -Z //Check for collision between ffc 'f' and a combo at location 'cmb'. bool Collision(int cmb, ffc f) { int cx = ComboX(cmb); int cy = ComboY(cmb); return RectCollision( cx, cy, cx+16, cy+16, f->X, f->Y, f->X+f->EffectWidth, f->Y+f->EffectHeight ); } //Check for collision between lweapon 'l' and a combo at location 'cmb'. bool Collision(int cmb, lweapon l) { int cx = ComboX(cmb); int cy = ComboY(cmb); return RectCollision( cx, cy, cx+16, cy+16, (l->X)+l->HitXOffset, (l->Y)+l->HitYOffset+l, (l->X)+l->HitXOffset+l->HitWidth, (l->Y)+l->HitYOffset+l->HitHeight); } //Check for collision between eweapon 'l' and a combo at location 'cmb'. bool Collision(int cmb, eweapon l) { int cx = ComboX(cmb); int cy = ComboY(cmb); return RectCollision( cx, cy, cx+16, cy+16, (l->X)+l->HitXOffset, (l->Y)+l->HitYOffset+l, (l->X)+l->HitXOffset+l->HitWidth, (l->Y)+l->HitYOffset+l->HitHeight); } //Check for collision between item 'l' and a combo at location 'cmb'. bool Collision(int cmb, item l) { int cx = ComboX(cmb); int cy = ComboY(cmb); return RectCollision( cx, cy, cx+16, cy+16, (l->X)+l->HitXOffset, (l->Y)+l->HitYOffset+l, (l->X)+l->HitXOffset+l->HitWidth, (l->Y)+l->HitYOffset+l->HitHeight); } //Check for collision between npc 'l' and a combo at location 'cmb'. bool Collision(int cmb, npc l) { int cx = ComboX(cmb); int cy = ComboY(cmb); return RectCollision( cx, cy, cx+16, cy+16, (l->X)+l->HitXOffset, (l->Y)+l->HitYOffset+l, (l->X)+l->HitXOffset+l->HitWidth, (l->Y)+l->HitYOffset+l->HitHeight); } //Check for collision between Link and a combo at location 'cmb'. bool Collision(int cmb) { int cx = ComboX(cmb); int cy = ComboY(cmb); if ( RectCollision( cx, cy, cx+16, cy+16, Link->X+Link->HitXOffset, Link->Y+Link->HitYOffset, Link->X+Link->HitXOffset+Link->HitWidth, Link->Y+Link->HitYOffset+Link->HitWidth) ) return true; else if ( (Distance(CenterLinkX(), CenterLinkY(), cx+8, cy+8) < 8) ) return true; return false; } //Constants for AdjacentCombo() //This now uses DIR_* constants, so you can do AdjacentCombo(cmb,Link->Dir) //Returns the Nth combo index of a combo based on a central point, and a direction. //For example, combo 22 + COMBO_UPRIGHT returns '7', //as combo 7 is to the upper-right of combo 22. int AdjacentCombo(int cmb, int dir) { int combooffsets[13]={-0x10, 0x10, -1, 1, -0x11, -0x0F, 0x0F, 0x11}; if ( cmb % 16 == 0 ) combooffsets[9] = 1; if ( (cmb & 15) == 1 ) combooffsets[10] = 1; if ( cmb < 0x10 ) combooffsets[11] = 1; //if it's the top row if ( cmb > 0x9F ) combooffsets[12] = 1; //if it's on the bottom row if ( combooffsets[9] && ( dir == DIR_LEFT || dir == DIR_LEFTUP || dir == DIR_LEFTDOWN ) ) return 0; //if the left columb if ( combooffsets[10] && ( dir == DIR_RIGHT || dir == DIR_RIGHTUP || dir == DIR_RIGHTDOWN ) ) return 0; //if the right column if ( combooffsets[11] && ( dir == DIR_UP || dir == DIR_RIGHTUP || dir == DIR_LEFTUP ) ) return 0; //if the top row if ( combooffsets[12] && ( dir == DIR_DOWN || dir == DIR_RIGHTDOWN || dir == DIR_LEFTDOWN ) ) return 0; //if the bottom row else if ( cmb >= 0 && cmb <= 176 ) return cmb + combooffsets[dir]; else return -1; } ///March 2016 //! One of the following two AdjancentCombo(dist) functions is older, and bugged, and IDR which. I think it is the second one. -Z //Constants for AdjacentCombo() //This now uses DIR_* constants, so you can do AdjacentCombo(cmb,Link->Dir) //Returns the Nth combo index of a combo based on a central point, and a direction. //For example, combo 22 + COMBO_UPRIGHT returns '7', //as combo 7 is to the upper-right of combo 22. //dist is the number of combos away from cmb //! rETURNS THE COMBO id OF A COMBO BASED ON A LOCATION, IN A GIVEM DIRECTION, n COMBOS AWAY. int AdjacentCombo(int cmb, int dir, int dist){ int combooffsets[13]={-0x10, 0x10, -1, 1, -0x11, -0x0F, 0x0F, 0x11}; if ( cmb % 16 == 0 ) combooffsets[9] = 1; if ( (cmb & 15) == 1 ) combooffsets[10] = 1; if ( cmb < 0x10 ) combooffsets[11] = 1; //if it's the top row if ( cmb > 0x9F ) combooffsets[12] = 1; //if it's on the bottom row if ( combooffsets[9] && ( dir == CMB_LEFT || dir == CMB_UPLEFT || dir == CMB_DOWNLEFT || dir == CMB_LEFTUP ) ) return 0; //if the left columb if ( combooffsets[10] && ( dir == CMB_RIGHT || dir == CMB_UPRIGHT || dir == CMB_DOWNRIGHT ) ) return 0; //if the right column if ( combooffsets[11] && ( dir == CMB_UP || dir == CMB_UPRIGHT || dir == CMB_UPLEFT || dir == CMB_LEFTUP ) ) return 0; //if the top row if ( combooffsets[12] && ( dir == CMB_DOWN || dir == CMB_DOWNRIGHT || dir == CMB_DOWNLEFT ) ) return 0; //if the bottom row else if ( cmb >= 0 && cmb <= 176 ) { int cmbs[2];//needs a for loop to ensure that t returns the most valid combo for ( cmbs[1] = 0; cmbs[1] < dist; cmbs[1]++ ) { cmbs[0] = cmb; cmb += (combooffsets[dir]); if ( cmb < 0 || cmb > 175 ) return cmbs[0]; if ( cmb % 16 == 0 ) combooffsets[9] = 1; if ( (cmb & 15) == 1 ) combooffsets[10] = 1; if ( cmb < 0x10 ) combooffsets[11] = 1; //if it's the top row if ( cmb > 0x9F ) combooffsets[12] = 1; //if it's on the bottom row if ( combooffsets[9] && ( dir == CMB_LEFT || dir == CMB_UPLEFT || dir == CMB_DOWNLEFT || dir == CMB_LEFTUP ) ) return cmbs[0]; //if the left columb if ( combooffsets[10] && ( dir == CMB_RIGHT || dir == CMB_UPRIGHT || dir == CMB_DOWNRIGHT ) ) return cmbs[0]; //if the right column if ( combooffsets[11] && ( dir == CMB_UP || dir == CMB_UPRIGHT || dir == CMB_UPLEFT || dir == CMB_LEFTUP ) ) return cmbs[0]; //if the top row if ( combooffsets[12] && ( dir == CMB_DOWN || dir == CMB_DOWNRIGHT || dir == CMB_DOWNLEFT ) ) return cmbs[0]; //if the bottom row } return cmb; } else return -1; } int AdjacentCombo2(int cmb, int dir, int dist) { int combooffsets[13]={-0x10, 0x10, -1, 1, -0x11, -0x0F, 0x0F, 0x11}; if ( cmb % 16 == 0 ) combooffsets[9] = 1; if ( (cmb & 15) == 1 ) combooffsets[10] = 1; if ( cmb < 0x10 ) combooffsets[11] = 1; //if it's the top row if ( cmb > 0x9F ) combooffsets[12] = 1; //if it's on the bottom row if ( combooffsets[9] && ( dir == DIR_LEFT || dir == DIR_LEFTUP || dir == DIR_LEFTDOWN ) ) { return 0; //if the left columb } if ( combooffsets[10] && ( dir == DIR_RIGHT || dir == DIR_RIGHTUP || dir == DIR_RIGHTDOWN ) ) { return 0; //if the left columb } if ( combooffsets[11] && ( dir == DIR_UP || dir == DIR_RIGHTUP || dir == DIR_LEFTUP ) ) { return 0; //if the left columb } if ( combooffsets[12] && ( dir == DIR_DOWN || dir == DIR_RIGHTDOWN || dir == DIR_LEFTDOWN ) ) { return 0; //if the left columb } int cmbs[2];//needs a for loop to ensure that t returns the most valid combo if ( cmb >= 0 && cmb < 176 ) { cmbs[0] = cmb; for ( cmbs[1] = 0; cmbs[1] < dist; ++cmbs[1] ) { if ( dir == DIR_LEFT && ComboX(cmbs[0]) == 0 ) return cmbs[0]; if ( dir == DIR_RIGHT && ComboX(cmbs[0]) == 240 ) return cmbs[0]; if ( dir == DIR_UP && ComboY(cmbs[0]) == 0 ) return cmbs[0]; if ( dir == DIR_DOWN && ComboY(cmbs[0]) == 160 ) return cmbs[0]; cmbs[0] += (combooffsets[dir]); if ( cmbs[0] < 0 || cmbs[0] > 175 ) return cmbs[0]; //Did I mean -1 here? -Z if ( cmb % 16 == 0 ) combooffsets[9] = 1; if ( (cmb & 15) == 1 ) combooffsets[10] = 1; if ( cmb < 0x10 ) combooffsets[11] = 1; //if it's the top row if ( cmb > 0x9F ) combooffsets[12] = 1; //if it's on the bottom row if ( combooffsets[9] && ( dir == DIR_LEFT || dir == DIR_LEFTUP || dir == DIR_LEFTDOWN || dir == DIR_LEFTUP ) ) return cmbs[0]; //if the left columb if ( combooffsets[10] && ( dir == DIR_RIGHT || dir == DIR_RIGHTUP || dir == DIR_RIGHTDOWN ) ) return cmbs[0]; //if the right column if ( combooffsets[11] && ( dir == DIR_UP || dir == DIR_RIGHTUP || dir == DIR_LEFTUP || dir == DIR_LEFTUP ) ) return cmbs[0]; //if the top row if ( combooffsets[12] && ( dir == DIR_DOWN || dir == DIR_RIGHTDOWN || dir == DIR_LEFTDOWN ) ) return cmbs[0]; //if the bottom row } return cmbs[0]; } else return -1; }