Skip to content

Commit

Permalink
Remove more deprecated refs (#455)
Browse files Browse the repository at this point in the history
* remove dir int cast

* remove deprecated refs

* remove FlxMouseControl and FlxRaycastTilemap

* prepare for 4.0.0
  • Loading branch information
Geokureli authored Feb 1, 2025
1 parent cff2640 commit ef0abbc
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 299 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
3.3.2 (January 31, 2025)
# 4.0.0 (TBD)
Removed deprecated classes
- `FlxRayCastTilemap`: `FlxBaseTilemap` has an all-around better `ray()` method ([#455](https://github.com/HaxeFlixel/flixel-addons/pull/455))
- `FlxMouseControl`: Use `FlxMouseEvent`, instead ([#455](https://github.com/HaxeFlixel/flixel-addons/pull/455))

## 3.3.2 (January 31, 2025)
------------------------------
- Fix dox, attempt 2

Expand Down
274 changes: 0 additions & 274 deletions flixel/addons/plugin/FlxMouseControl.hx

This file was deleted.

49 changes: 28 additions & 21 deletions flixel/addons/tile/FlxRayCastTilemap.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package flixel.addons.tile;
import flixel.tile.FlxTilemap;
import flixel.math.FlxPoint;

#if (flixel < version("5.9.0"))
/**
* @author greglieberman
*/
@:deprecated("FlxRayCastTilemap is deprecated, use FlxTilemap.ray or rayStep, instead")// for flixel 5.9.0
@:deprecated("FlxRayCastTilemap is deprecated, use FlxTilemap.ray or rayStep, instead")
class FlxRayCastTilemap extends FlxTilemap
{
/**
Expand Down Expand Up @@ -74,8 +75,8 @@ class FlxRayCastTilemap extends FlxTilemap
}

// Find the tile at the start position of the ray
cx = coordsToTileX(Start.x);
cy = coordsToTileY(Start.y);
cx = getColumnAt(Start.x);
cy = getRowAt(Start.y);

if (!inTileRange(cx, cy))
{
Expand All @@ -86,7 +87,7 @@ class FlxRayCastTilemap extends FlxTilemap
return false;
}

if (getTile(Std.int(cx), Std.int(cy)) > 0)
if (getTileIndex(Std.int(cx), Std.int(cy)) > 0)
{
// start point is inside a block
Result.x = Start.x;
Expand Down Expand Up @@ -155,7 +156,7 @@ class FlxRayCastTilemap extends FlxTilemap
if (tMaxX < tMaxY)
{
cx = cx + stepX;
if (getTile(Std.int(cx), Std.int(cy)) > 0)
if (getTileIndex(Std.int(cx), Std.int(cy)) > 0)
{
hitTile = true;
break;
Expand All @@ -173,7 +174,7 @@ class FlxRayCastTilemap extends FlxTilemap
{
cy = cy + stepY;

if (getTile(Std.int(cx), Std.int(cy)) > 0)
if (getTileIndex(Std.int(cx), Std.int(cy)) > 0)
{
hitTile = true;
break;
Expand Down Expand Up @@ -210,36 +211,42 @@ class FlxRayCastTilemap extends FlxTilemap
return (TileX >= 0 && TileX < widthInTiles && TileY >= 0 && TileY < heightInTiles);
}

public function tileAt(CoordX:Float, CoordY:Float):Int
@:deprecated("tileAt is deprecated, use getTileIndexAt, instead")
public function tileAt(worldX:Float, worldY:Float):Int
{
return getTile(Std.int((CoordX - x) / scaledTileWidth), Std.int((CoordY - y) / scaledTileHeight));
return getTileIndexAt(worldX, worldY);
}

public function tileIndexAt(CoordX:Float, CoordY:Float):Int
@:deprecated("tileIndexAt is deprecated, use getMapIndexAt, instead")
public function tileIndexAt(worldX:Float, worldY:Float):Int
{
var X:Int = Std.int((CoordX - x) / scaledTileWidth);
var Y:Int = Std.int((CoordY - y) / scaledTileHeight);

return Y * widthInTiles + X;
return getMapIndexAt(worldX, worldY);
}

public function coordsToTileX(CoordX:Float):Float
@:deprecated("coordsToTileX is deprecated, use getColumnAt, instead")
public function coordsToTileX(worldX:Float):Float
{
return Std.int((CoordX - x) / scaledTileWidth);
return getColumnAt(worldX);
}

public function coordsToTileY(CoordY:Float):Float
@:deprecated("coordsToTileY is deprecated, use getRowAt, instead")
public function coordsToTileY(worldY:Float):Float
{
return Std.int((CoordY - y) / scaledTileHeight);
return getRowAt(worldY);
}

public function indexToCoordX(Index:Int):Float
@:deprecated("indexToCoordX is deprecated, use getColumnPos(getColumn(mapIndex)), instead")
public function indexToCoordX(mapIndex:Int):Float
{
return (Index % widthInTiles) * scaledTileWidth + scaledTileWidth / 2;
return getColumnPos(getColumn(mapIndex));
}

public function indexToCoordY(Index:Int):Float
@:deprecated("indexToCoordY is deprecated, use getRowPos(getRow(mapIndex)), instead")
public function indexToCoordY(mapIndex:Int):Float
{
return Std.int(Index / widthInTiles) * scaledTileHeight + scaledTileHeight / 2;
return getRowPos(getRow(mapIndex));
}
}
#elseif FLX_NO_COVERAGE_TEST
#error "FlxRayCastTilemap has been removed in flixel-addons 4.0.0, use FlxTilemap.ray or rayStep, instead"
#end
Loading

0 comments on commit ef0abbc

Please sign in to comment.