--- a/Project.xml
+++ b/Project.xml
@@ -17,11 +17,13 @@
+
+
--- a/shim/zero/flxutil/controllers/ZBaseController.hx
+++ b/shim/zero/flxutil/controllers/ZBaseController.hx
@@ -0,0 +1,30 @@
+package zero.flxutil.controllers;
+
+import flixel.FlxBasic;
+import flixel.FlxG;
+
+typedef ZDpad = { l:Bool, r:Bool, u:Bool, d:Bool }
+typedef ZFace = { a:Bool, x:Bool, a_p:Bool, x_p:Bool }
+typedef ZControllerState = { dpad:ZDpad, face:ZFace }
+
+/**
+ * Web port: the little part of zerolib's 2018 controller classes that the game uses (the state of the d-pad and of
+ * the A and X buttons, with "just pressed" flags), written again because zerolib 0.2.3 has another interface.
+ */
+class ZBaseController extends FlxBasic
+{
+ public var state:ZControllerState = {
+ dpad: { l: false, r: false, u: false, d: false },
+ face: { a: false, x: false, a_p: false, x_p: false }
+ };
+
+ public function new()
+ {
+ super();
+ }
+
+ public function add():Void
+ {
+ FlxG.state.add(this);
+ }
+}
--- a/shim/zero/flxutil/controllers/ZPlayerController.hx
+++ b/shim/zero/flxutil/controllers/ZPlayerController.hx
@@ -0,0 +1,48 @@
+package zero.flxutil.controllers;
+
+import flixel.FlxG;
+import flixel.input.gamepad.FlxGamepadInputID;
+
+/**
+ * Web port: keyboard (arrows, Z = A, X = X) and the first gamepad (d-pad or left stick, A, X).
+ */
+class ZPlayerController extends ZBaseController
+{
+ var id:Int;
+
+ public function new(id:Int = 0)
+ {
+ super();
+ this.id = id;
+ }
+
+ override public function update(elapsed:Float):Void
+ {
+ super.update(elapsed);
+ var k = FlxG.keys.pressed;
+ var pad = FlxG.gamepads.getByID(id);
+ var l = k.LEFT;
+ var r = k.RIGHT;
+ var u = k.UP;
+ var d = k.DOWN;
+ var a = k.Z;
+ var x = k.X;
+ if (pad != null)
+ {
+ l = l || pad.pressed.DPAD_LEFT || pad.analog.value.LEFT_STICK_X < -0.5;
+ r = r || pad.pressed.DPAD_RIGHT || pad.analog.value.LEFT_STICK_X > 0.5;
+ u = u || pad.pressed.DPAD_UP || pad.analog.value.LEFT_STICK_Y < -0.5;
+ d = d || pad.pressed.DPAD_DOWN || pad.analog.value.LEFT_STICK_Y > 0.5;
+ a = a || pad.pressed.A;
+ x = x || pad.pressed.X;
+ }
+ state.face.a_p = a && !state.face.a;
+ state.face.x_p = x && !state.face.x;
+ state.face.a = a;
+ state.face.x = x;
+ state.dpad.l = l;
+ state.dpad.r = r;
+ state.dpad.u = u;
+ state.dpad.d = d;
+ }
+}
--- a/shim/zero/flxutil/states/ZState.hx
+++ b/shim/zero/flxutil/states/ZState.hx
@@ -0,0 +1,12 @@
+package zero.flxutil.states;
+
+/**
+ * Web port: the game was written against a 2018 build of zerolib that had this class; zerolib 0.2.3 calls it State.
+ */
+class ZState extends State
+{
+ public function new(mouse_visible:Bool = false, esc_exits:Bool = false)
+ {
+ super(mouse_visible, esc_exits);
+ }
+}
--- a/source/import.hx
+++ b/source/import.hx
@@ -26,14 +26,14 @@
import zero.flxutil.controllers.ZBaseController;
import zero.flxutil.controllers.ZPlayerController;
-import zero.flxutil.particles.ZParticle;
-import zero.flxutil.particles.ZParticleGroup;
+
+
import zero.flxutil.states.ZState;
import zero.flxutil.ui.ZBitmapText;
import zero.util.IntPoint;
-import zero.util.Range;
-import zero.util.Vector;
+
+
using Math;
using zero.ext.FloatExt;
--- a/source/objects/CopCar.hx
+++ b/source/objects/CopCar.hx
@@ -95,7 +95,7 @@
PlayState.i.tiles.findPath(
base.getMidpoint(),
target,
- false, false
+ flixel.path.FlxPathfinder.FlxPathSimplifier.NONE
),
car_speed
);
@@ -114,7 +114,7 @@
PlayState.i.tiles.findPath(
base.getMidpoint(),
PlayState.i.car.getMidpoint(),
- false, false
+ flixel.path.FlxPathfinder.FlxPathSimplifier.NONE
),
car_speed
);
@@ -134,7 +134,7 @@
PlayState.i.tiles.findPath(
base.getMidpoint(),
target,
- false, false
+ flixel.path.FlxPathfinder.FlxPathSimplifier.NONE
),
car_speed
);
@@ -170,7 +170,7 @@
PlayState.i.tiles.findPath(
base.getMidpoint(),
target,
- false, false
+ flixel.path.FlxPathfinder.FlxPathSimplifier.NONE
),
car_speed
);
@@ -185,7 +185,7 @@
PlayState.i.tiles.findPath(
base.getMidpoint(),
target,
- false, false
+ flixel.path.FlxPathfinder.FlxPathSimplifier.NONE
),
80
);
--- a/source/states/PlayState.hx
+++ b/source/states/PlayState.hx
@@ -232,7 +232,7 @@
function make_game_over_text()
{
- var t = ['BAD DRIVER +1', 'GAME OVER', 'YOU BLEW IT', 'YOU STINK', 'NICE JOB', 'GO FRICK URSELF', 'WOW', 'LITERALLY THE WORST', 'GO AWAY', 'GIVE UP VIDEO GAMES'].get_random();
+ var t = ['BAD DRIVER +1', 'GAME OVER', 'YOU BLEW IT', 'YOU STINK', 'NICE JOB', 'WOW', 'LITERALLY THE WORST', 'GO AWAY', 'GIVE UP VIDEO GAMES'].get_random();
var c = [0xfffc301d, 0xffff7e2b, 0xffffc702, 0x760046, 0xff59ff9b, 0xff00a093, 0xff4ba8ff, 0xffb1d61b, 0xff13b517].get_random();
var text = new ZBitmapText(0.get_random(0, FlxG.width - 64), FlxG.height.get_random(0), Assets.getText(AssetsData.letters__txt), FlxPoint.get(7, 9), AssetsImg.font__png, FlxTextAlign.CENTER, 64, -2, -1);
text.text = t;