//TileCollision.zh bool DrawTileCollision(npc n, int layer, int x, int y, int tile, int blockw, int blockh, int cset, int rx, int ry, int rangle, int flip, bool transparency, int opacity){ int objx = n->X; int objy = n->Y int onbx = n->Z; //We should have a separate function with int UseZ, for this. bool matchX; bool matchY; DrawTile(layer, x, y, tile, blockw, blockh, cset, -1, -1, rx, ry, rangle, flip, transparency, opacity); int collBoxX = x + (blockw*16); int collBoxY = y + (blockh*16); if ( ( objx <= collBoxX-4 && objx > collBoxX-5 ) || ( objx >= collBoxX +12 && objx < collBoxX+13 ) ) matchX = true; if ( ( objy <= collBoxY-4 && objy > collBoxY-5 ) || ( objy >= collBoxY +12 && objy < collBoxY+13 ) ) matchY = true; if ( matchX && matchY ) return true; //here, we need to consider the collision box of the npc, and calculate X/Y offsets for that, too. } bool DrawTileCollision(ffc f, int layer, int x, int y, int tile, int blockw, int blockh, int cset, int rx, int ry, int rangle, int flip, bool transparency, int opacity){ int objx = f->X; int objy = f->Y int onbx = f->Z; //We should have a separate function with int UseZ, for this. bool matchX; bool matchY; DrawTile(layer, x, y, tile, blockw, blockh, cset, -1, -1, rx, ry, rangle, flip, transparency, opacity); int collBoxX = x + (blockw*16); int collBoxY = y + (blockh*16); if ( ( objx <= collBoxX-4 && objx > collBoxX-5 ) || ( objx >= collBoxX +12 && objx < collBoxX+13 ) ) matchX = true; if ( ( objy <= collBoxY-4 && objy > collBoxY-5 ) || ( objy >= collBoxY +12 && objy < collBoxY+13 ) ) matchY = true; if ( matchX && matchY ) return true; //here, we need to consider the collision box, size, and other attributes of the ffc, and calculate X/Y offsets for that, too. } bool DrawTileCollision(lweapon l, int layer, int x, int y, int tile, int blockw, int blockh, int cset, int rx, int ry, int rangle, int flip, bool transparency, int opacity){ int objx = l->X; int objy = l->Y int onbx = l->Z; //We should have a separate function with int UseZ, for this. bool matchX; bool matchY; DrawTile(layer, x, y, tile, blockw, blockh, cset, -1, -1, rx, ry, rangle, flip, transparency, opacity); int collBoxX = x + (blockw*16); int collBoxY = y + (blockh*16); if ( ( objx <= collBoxX-4 && objx > collBoxX-5 ) || ( objx >= collBoxX +12 && objx < collBoxX+13 ) ) matchX = true; if ( ( objy <= collBoxY-4 && objy > collBoxY-5 ) || ( objy >= collBoxY +12 && objy < collBoxY+13 ) ) matchY = true; if ( matchX && matchY ) return true; //here, we need to consider the collision box of the object, and calculate X/Y offsets for that, too. } bool DrawTileCollision(eweapon e, int layer, int x, int y, int tile, int blockw, int blockh, int cset, int rx, int ry, int rangle, int flip, bool transparency, int opacity){ int objx = e->X; int objy = e->Y int onbx = e->Z; //We should have a separate function with int UseZ, for this. bool matchX; bool matchY; DrawTile(layer, x, y, tile, blockw, blockh, cset, -1, -1, rx, ry, rangle, flip, transparency, opacity); int collBoxX = x + (blockw*16); int collBoxY = y + (blockh*16); if ( ( objx <= collBoxX-4 && objx > collBoxX-5 ) || ( objx >= collBoxX +12 && objx < collBoxX+13 ) ) matchX = true; if ( ( objy <= collBoxY-4 && objy > collBoxY-5 ) || ( objy >= collBoxY +12 && objy < collBoxY+13 ) ) matchY = true; if ( matchX && matchY ) return true; //here, we need to consider the collision box of the object, and calculate X/Y offsets for that, too. } //Draws block of tiles and returns if Link is in Collision with them. bool DrawTileCollision(layer, int x, int y, int tile, int blockw, int blockh, int cset, int rx, int ry, int rangle, int flip, bool transparency, int opacity){ int lx = Link->X; //So that we can modify them to adjust for things, if needed. int ly = Link->Y; int lx = Link->Z; //We should have a separate function with int UseZ, for this. bool matchX; bool matchY; DrawTile(layer, x, y, tile, blockw, blockh, cset, -1, -1, rx, ry, rangle, flip, transparency, opacity); int collBoxX = x + (blockw*16); int collBoxY = y + (blockh*16); if ( ( lx <= collBoxX-4 && lx > collBoxX-5 ) || ( lx >= collBoxX +12 && lx < collBoxX+13 ) ) matchX = true; if ( ( ly <= collBoxY-4 && ly > collBoxY-5 ) || ( ly >= collBoxY +12 && ly < collBoxY+13 ) ) matchY = true; if ( matchX && matchY ) return true; } //We need additional args to constrain hit size of box. int CollWidthX and int CollWidthY //DrawCombbo Collision bool DrawComboCollision( int layer, int x, int y, int combo, int w, int h, int cset, int rx, int ry, int rangle, int frame, int flip, bool transparency, int opacity){ int lx = Link->X; //So that we can modify them to adjust for things, if needed. int ly = Link->Y; int lx = Link->Z; //We should have a separate function with int UseZ, for this. bool matchX; bool matchY; DrawCombo(layer, x, y, combo, w, h, cset, -1, -1, rx, ry, rangle, frame, flip, transparency opacity); int collBoxX = x + (w*16); int collBoxY = y + (h*16); if ( ( lx <= collBoxX-4 && lx > collBoxX-5 ) || ( lx >= collBoxX +12 && lx < collBoxX+13 ) ) matchX = true; if ( ( ly <= collBoxY-4 && ly > collBoxY-5 ) || ( ly >= collBoxY +12 && ly < collBoxY+13 ) ) matchY = true; if ( matchX && matchY ) return true; } bool DrawComboCollision( int layer, int x, int y, int combo, int w, int h, int cset, int rx, int ry, int rangle, int frame, int flip, bool transparency, int opacity, int collWidthX, int collWidthY){ int lx = Link->X; //So that we can modify them to adjust for things, if needed. int ly = Link->Y; int lx = Link->Z; //We should have a separate function with int UseZ, for this. bool matchX; bool matchY; DrawCombo(layer, x, y, combo, w, h, cset, -1, -1, rx, ry, rangle, frame, flip, transparency opacity); int collBoxX = x + (w*16) + collWidthX; int collBoxY = y + (h*16) + collWidthY; if ( ( lx <= collBoxX-4 && lx > collBoxX-5 ) || ( lx >= collBoxX +12 && lx < collBoxX+13 ) ) matchX = true; if ( ( ly <= collBoxY-4 && ly > collBoxY-5 ) || ( ly >= collBoxY +12 && ly < collBoxY+13 ) ) matchY = true; if ( matchX && matchY ) return true; } bool DrawCircularComboCollision( int layer, int x, int y, int combo, int w, int h, int cset, int rx, int ry, int rangle, int frame, int flip, bool transparency, int opacity){ int lx = Link->X; //So that we can modify them to adjust for things, if needed. int ly = Link->Y; int lx = Link->Z; //We should have a separate function with int UseZ, for this. int cmbX = x+w; int cmbY = x+h; int xrad = cmbx / 2; //Use these to gauge distance from the effect. int yrad = cmbY / 2; bool matchX; bool matchY; DrawCombo(layer, x, y, combo, w, h, cset, -1, -1, rx, ry, rangle, frame, flip, transparency opacity); int collBoxX = x + (w*16); int collBoxY = y + (h*16); //if ( ( lx <= collBoxX-4 && lx > collBoxX-5 ) || ( lx >= collBoxX +12 && lx < collBoxX+13 ) ) matchX = true; //if ( ( ly <= collBoxY-4 && ly > collBoxY-5 ) || ( ly >= collBoxY +12 && ly < collBoxY+13 ) ) matchY = true; //if ( matchX && matchY ) return true; if ( Distance( LinkCenterX(), LinkCenterY(), cmbX, cmbY ) <= 8+xrad ) return true; }