From 0671a89d431a722f4b5f916466fb5a91f799e277 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sat, 24 Jun 2023 21:30:33 +1000 Subject: [PATCH] Added node scaling, and a few utility functions --- Box | 2 +- assets/{scripts => airport-demo}/airplane.toy | 0 assets/airport-demo/init.toy | 42 ++++ .../little_plane.png | Bin assets/scripts/demo/scene.toy | 65 ----- .../scripts/demo/tilemap/layer-background.toy | 65 ----- assets/scripts/demo/tilemap/layer-walls.toy | 69 ------ assets/scripts/demo/tilemap/tilemap.toy | 35 --- assets/scripts/gameplay/drone.toy | 108 ++++----- assets/scripts/gameplay/lejana.toy | 225 ++++++++---------- assets/scripts/gameplay/scene.toy | 132 +++++----- assets/scripts/gameplay/step-counter.toy | 34 +-- assets/scripts/gameplay/text.toy | 13 +- assets/scripts/gameplay/tilemap.toy | 150 ++++++------ assets/scripts/init.toy | 25 +- assets/sprites/frametest.png | Bin 404 -> 0 bytes assets/sprites/tile-background.png | Bin 179 -> 0 bytes assets/sprites/tile-wall.png | Bin 179 -> 0 bytes 18 files changed, 377 insertions(+), 588 deletions(-) rename assets/{scripts => airport-demo}/airplane.toy (100%) create mode 100644 assets/airport-demo/init.toy rename assets/{sprites => airport-demo}/little_plane.png (100%) delete mode 100644 assets/scripts/demo/scene.toy delete mode 100644 assets/scripts/demo/tilemap/layer-background.toy delete mode 100644 assets/scripts/demo/tilemap/layer-walls.toy delete mode 100644 assets/scripts/demo/tilemap/tilemap.toy delete mode 100644 assets/sprites/frametest.png delete mode 100644 assets/sprites/tile-background.png delete mode 100644 assets/sprites/tile-wall.png diff --git a/Box b/Box index 78f6eb7..c330ba9 160000 --- a/Box +++ b/Box @@ -1 +1 @@ -Subproject commit 78f6eb79fae6680f82f695fdc07b765d05b4ac65 +Subproject commit c330ba9831ba41112b143b8c927c98e5d7acff10 diff --git a/assets/scripts/airplane.toy b/assets/airport-demo/airplane.toy similarity index 100% rename from assets/scripts/airplane.toy rename to assets/airport-demo/airplane.toy diff --git a/assets/airport-demo/init.toy b/assets/airport-demo/init.toy new file mode 100644 index 0000000..242f0e1 --- /dev/null +++ b/assets/airport-demo/init.toy @@ -0,0 +1,42 @@ +//A quirk of the setup is that anything defined in the root of `init.toy` becomes a global object +//To resolve that, the configuration is inside a block scope +{ + import engine; + import input; + + + //input settings, mapping SDL2's virtual keys to event names + mapInputEventToKeyDown("character_up", "w"); //event, keysym + mapInputEventToKeyDown("character_left", "a"); //event, keysym + mapInputEventToKeyDown("character_down", "s"); //event, keysym + mapInputEventToKeyDown("character_right", "d"); //event, keysym + + mapInputEventToKeyUp("character_up", "w"); //event, keysym + mapInputEventToKeyUp("character_left", "a"); //event, keysym + mapInputEventToKeyUp("character_down", "s"); //event, keysym + mapInputEventToKeyUp("character_right", "d"); //event, keysym + + mapInputEventToKeyDown("character_up", "up"); //event, keysym + mapInputEventToKeyDown("character_left", "left"); //event, keysym + mapInputEventToKeyDown("character_down", "down"); //event, keysym + mapInputEventToKeyDown("character_right", "right"); //event, keysym + + mapInputEventToKeyUp("character_up", "up"); //event, keysym + mapInputEventToKeyUp("character_left", "left"); //event, keysym + mapInputEventToKeyUp("character_down", "down"); //event, keysym + mapInputEventToKeyUp("character_right", "right"); //event, keysym + + mapInputEventToKeyDown("character_attack", "space"); //event, keysym + + //TODO: escape to kill the game + + + //this function must always be called, or the engine won't run + initWindow("Airport", 800, 600, false); //TODO: custom FPS setting + + //kick off the logic of the scene graph + loadRootNode("scripts:/airplane.toy"); +} + +//Globals go here + diff --git a/assets/sprites/little_plane.png b/assets/airport-demo/little_plane.png similarity index 100% rename from assets/sprites/little_plane.png rename to assets/airport-demo/little_plane.png diff --git a/assets/scripts/demo/scene.toy b/assets/scripts/demo/scene.toy deleted file mode 100644 index 5cdeab3..0000000 --- a/assets/scripts/demo/scene.toy +++ /dev/null @@ -1,65 +0,0 @@ -//the overarching scene -import engine; -import node; - -//debugging tools -var stepCounter: int = 0; -var stepTracker: [int] = [0, 0, 0]; - - -//util to generate and init a child node of a given parent -fn makeChild(parent: opaque, fname: string) { - var child: opaque = loadNode(fname); - parent.pushNode(child); - return child; -} - -//lifecycle functions -fn onLoad(node: opaque) { - //load the tile map node - var tilemapNode = node.makeChild("scripts:/demo/tilemap/tilemap.toy"); - - tilemapNode.callNodeFn("loadLayer", "layer-background.toy"); - tilemapNode.callNodeFn("loadLayer", "layer-walls.toy"); - tilemapNode.callNodeFn("loadLayer", "layer-walls.toy"); - //tilemapNode.callNodeFn("loadLayer", "layer-walls.toy"); //TODO: remove this - //tilemapNode.callNodeFn("loadLayer", "layer-maze.toy"); -} - -//debugging code -fn onStep(node: opaque) { - stepCounter++; -} - -fn onDraw(node: opaque) { - //round off - too many skips means it's crappy anyway - if (stepCounter > stepTracker.length() - 1) { - stepCounter = stepTracker.length() - 1; - } - - //This logic is just a debugging tool - stepTracker[stepCounter] = stepTracker[stepCounter] + 1; - print stepTracker; - stepCounter = 0; -} - -fn onMouseButtonDown(node: opaque, x: int, y: int, button: string) { - //reload the scene on click - if (button == "left") { - loadRootNode("scripts:/demo/scene.toy"); - } -} - -//global accessors -fn getTileWidth(node: opaque): int { return 64; } -fn getTileHeight(node: opaque): int { return 64; } - -fn getRoomWidth(node: opaque): int { return 10; } -fn getRoomHeight(node: opaque): int { return 10; } - -fn getLevelXCount(node: opaque): int { return 9; } -fn getLevelYCount(node: opaque): int { return 9; } - -//TODO: move this into the engine -fn getScreenWidth(node: opaque): int { return 1080; } -fn getScreenHeight(node: opaque): int { return 720; } diff --git a/assets/scripts/demo/tilemap/layer-background.toy b/assets/scripts/demo/tilemap/layer-background.toy deleted file mode 100644 index 2bf833c..0000000 --- a/assets/scripts/demo/tilemap/layer-background.toy +++ /dev/null @@ -1,65 +0,0 @@ -//this is one layer -import standard; -import engine; -import node; - - -//TODO: replace with an empty node function (polyfill) -fn loadChildEmpty(parent: opaque) { - var child: opaque = loadNode("scripts:/empty.toy"); - parent.pushNode(child); - return child; -} - - -fn onLoad(node: opaque) { - //load the child node, with the tiling back image - node.loadChildEmpty(); -} - -fn onInit(node: opaque) { - node.getChildNode(0).loadTexture("sprites:/tile-background.png"); -} - - -//drawing util -fn drawLayer(node: opaque, camX, camY, camW, camH, depth) { - //get the constants from root - var root: opaque = getRootNode(); - - var tileWidth: int const = root.callNodeFn("getTileWidth"); - var tileHeight: int const = root.callNodeFn("getTileHeight"); - - var roomWidth: int const = root.callNodeFn("getRoomWidth"); - var roomHeight: int const = root.callNodeFn("getRoomHeight"); - - var levelXCount: int const = root.callNodeFn("getLevelXCount"); - var levelYCount: int const = root.callNodeFn("getLevelYCount"); - - //calc the modifier ratio to offset things - var mod: float = float tileWidth / (tileWidth - depth); - - var tileWidth_mod: float = tileWidth * mod; - var tileHeight_mod: float = tileHeight * mod; - var camX_mod: float = (camX - camW) * mod + camW/2; - var camY_mod: float = (camY - camH) * mod + camH/2; - - //calc the region to render - var lowerX: int = round((camX - camW/2.0) / tileWidth); - var upperX: int = round((camX - camW*1.5) / tileWidth); - var lowerY: int = round((camY - camH/2.0) / tileHeight); - var upperY: int = round((camY - camH*1.5) / tileHeight); - - //bounds check - lowerX = max(0, abs(lowerX)); - upperX = min(upperX < 0 ? abs(upperX) : 0, levelXCount * roomWidth); - lowerY = max(0, abs(lowerY)); - upperY = min(upperY < 0 ? abs(upperY) : 0, levelYCount * roomHeight); - - //render each tile - for (var j = lowerY; j <= upperY; j++) { - for (var i = lowerX; i <= upperX; i++) { - node.getChildNode(0).drawNode(round(camX_mod + i * tileWidth_mod), round(camY_mod + j * tileHeight_mod), round(tileWidth_mod), round(tileHeight_mod)); - } - } -} diff --git a/assets/scripts/demo/tilemap/layer-walls.toy b/assets/scripts/demo/tilemap/layer-walls.toy deleted file mode 100644 index 432d7f8..0000000 --- a/assets/scripts/demo/tilemap/layer-walls.toy +++ /dev/null @@ -1,69 +0,0 @@ -//this is one layer -import standard; -import engine; -import node; - - -//TODO: replace with an empty node function (polyfill) -fn loadChildEmpty(parent: opaque) { - var child: opaque = loadNode("scripts:/empty.toy"); - parent.pushNode(child); - return child; -} - - -fn onLoad(node: opaque) { - //load the child node, with the tiling back image - node.loadChildEmpty(); -} - -fn onInit(node: opaque) { - node.getChildNode(0).loadTexture("sprites:/tile-wall.png"); -} - - -//drawing util -fn drawLayer(node: opaque, camX, camY, camW, camH, depth) { - //get the constants from root - var root: opaque = getRootNode(); - - var tileWidth: int const = root.callNodeFn("getTileWidth"); - var tileHeight: int const = root.callNodeFn("getTileHeight"); - - var roomWidth: int const = root.callNodeFn("getRoomWidth"); - var roomHeight: int const = root.callNodeFn("getRoomHeight"); - - var levelXCount: int const = root.callNodeFn("getLevelXCount"); - var levelYCount: int const = root.callNodeFn("getLevelYCount"); - - //calc the modifier ratio to offset things - var mod: float = float tileWidth / (tileWidth - depth); - - var tileWidth_mod: int = round(tileWidth * mod); - var tileHeight_mod: int = round(tileHeight * mod); - var camX_mod: int = round((camX - camW) * mod + camW/2); - var camY_mod: int = round((camY - camH) * mod + camH/2); - - //calc the region to render - var lowerX: int = round((camX - camW/2.0) / tileWidth); - var upperX: int = round((camX - camW*1.5) / tileWidth); - var lowerY: int = round((camY - camH/2.0) / tileHeight); - var upperY: int = round((camY - camH*1.5) / tileHeight); - - //bounds check - lowerX = max(0, abs(lowerX)); - upperX = min(upperX < 0 ? abs(upperX) : 0, levelXCount * roomWidth); - lowerY = max(0, abs(lowerY)); - upperY = min(upperY < 0 ? abs(upperY) : 0, levelYCount * roomHeight); - - //render each tile - for (var j = lowerY; j <= upperY; j++) { - for (var i = lowerX; i <= upperX; i++) { - if ( !(int i % int roomWidth == 0 || int i % int roomWidth == roomWidth - 1) && !(int j % int roomHeight == 0 || int j % int roomHeight == roomHeight - 1) ) { - continue; - } - - node.getChildNode(0).drawNode(camX_mod + i * tileWidth_mod, camY_mod + j * tileHeight_mod, tileWidth_mod, tileHeight_mod); - } - } -} diff --git a/assets/scripts/demo/tilemap/tilemap.toy b/assets/scripts/demo/tilemap/tilemap.toy deleted file mode 100644 index 2c47573..0000000 --- a/assets/scripts/demo/tilemap/tilemap.toy +++ /dev/null @@ -1,35 +0,0 @@ -//this file manages the tilemap-related utilities -import standard; -import engine; -import node; - -var camX: float = 0; -var camY: float = 0; - -//util to generate a child node of a given parent -fn loadChild(parent: opaque, fname: string) { - var child: opaque = loadNode(fname); - parent.pushNode(child); - return child; -} - -fn loadLayer(node: opaque, layerName: string) { - //load the given layer as a child - var layerNode = node.loadChild("scripts:/demo/tilemap/" + layerName); -} - -//lifecycle functions -fn onStep(node: opaque) { - camX--; - camY--; -} - -fn onDraw(node: opaque) { - var screenWidth: int const = getRootNode().callNodeFn("getScreenWidth"); - var screenHeight: int const = getRootNode().callNodeFn("getScreenHeight"); - - //iterate over each layer, passing in the screen dimensions - for (var c = 0; c < node.getChildNodeCount(); c++) { - node.getChildNode(c).callNodeFn("drawLayer", camX, camY, screenWidth, screenHeight, c * 4.0); - } -} diff --git a/assets/scripts/gameplay/drone.toy b/assets/scripts/gameplay/drone.toy index d1d65cf..5fbf047 100644 --- a/assets/scripts/gameplay/drone.toy +++ b/assets/scripts/gameplay/drone.toy @@ -2,40 +2,23 @@ import standard; import node; import random; -//constants -var SPEED: int const = 4; - -var SPRITE_WIDTH: int const = 64; -var SPRITE_HEIGHT: int const = 64; - -var TILE_WIDTH: int const = 32; -var TILE_HEIGHT: int const = 32; - - //variables -var parent: opaque = null; //cache the parent for quick access - -var gridX: int = 1; //position on the game grid -var gridY: int = 1; - -var realX: int = 0; //will change until realX = gridX * SPRITE_WIDTH -var realY: int = 0; - -var motionX: int = 0; //normalized movement direction -var motionY: int = 0; +var gridPositionX: int = 1; +var gridPositionY: int = 1; var direction: int = null; //BUGFIX: animation not looping properly var stepAI: int = 0; -//polyfills - animating different cycles on one image -var stepCount: int = 0; +//polyfills - animating different cycles on one image +var walkAnimationCounter: int = 0; fn faceDown(node: opaque) { if (direction == 0) return; direction = 0; node.setNodeRect(0, 0, 32, 32); node.setNodeFrames(2); + walkAnimationCounter = 12; } fn faceUp(node: opaque) { @@ -43,6 +26,7 @@ fn faceUp(node: opaque) { direction = 1; node.setNodeRect(32 * 2, 0, 32, 32); node.setNodeFrames(2); + walkAnimationCounter = 12; } fn faceRight(node: opaque) { @@ -50,6 +34,7 @@ fn faceRight(node: opaque) { direction = 2; node.setNodeRect(32 * 4, 0, 32, 32); node.setNodeFrames(2); + walkAnimationCounter = 12; } fn faceLeft(node: opaque) { @@ -57,34 +42,25 @@ fn faceLeft(node: opaque) { direction = 3; node.setNodeRect(32 * 6, 0, 32, 32); node.setNodeFrames(2); + walkAnimationCounter = 12; } //accessors & mutators -fn setGridPos(node: opaque, x: int, y: int) { - gridX = x; - gridY = y; +fn setGridPosition(node: opaque, x: int, y: int) { + gridPositionX = x; + gridPositionY = y; - if (realX == null) { - realX = gridX * TILE_WIDTH; - } - - if (realY == null) { - realY = gridY * TILE_HEIGHT; - } + node.setNodePositionX(floor( gridPositionX * node.getNodeRectW() / node.getNodeScaleX() )); + node.setNodePositionY(floor( gridPositionY * node.getNodeRectH() / node.getNodeScaleY() )); } -fn setRealPos(node: opaque, x: int, y: int) { - realX = x; - realY = y; +fn getGridPositionX(node: opaque) { + return gridPositionX; } -fn getGridPos(node: opaque) { - return [gridX, gridY]; -} - -fn getRealPos(node: opaque) { - return [realX, realY]; +fn getGridPositionY(node: opaque) { + return gridPositionY; } @@ -92,28 +68,23 @@ fn getRealPos(node: opaque) { fn onLoad(node: opaque) { node.loadNodeTexture("sprites:/drone.png"); node.faceDown(); -} - -fn onInit(node: opaque) { - parent = node.getParentNode(); + + node.setNodeScaleX(CAMERA_SCALE_X); + node.setNodeScaleY(CAMERA_SCALE_Y); } fn onStep(node: opaque) { - if (++stepCount >= 5) { + if (++walkAnimationCounter >= 12) { node.incrementCurrentNodeFrame(); - stepCount = 0; + walkAnimationCounter = 0; } - //calc movement - var distX = gridX * TILE_WIDTH - realX; - var distY = gridY * TILE_HEIGHT - realY; + //move in realspace + var distX = gridPositionX * TILE_PIXEL_WIDTH - node.getNodePositionX(); + var distY = gridPositionY * TILE_PIXEL_HEIGHT - node.getNodePositionY(); - motionX = normalize(distX); - motionY = normalize(distY); - - //make movement - realX += abs(distX) > SPEED ? SPEED * motionX : distX; - realY += abs(distY) > SPEED ? SPEED * motionY : distY; + node.setNodeMotionX( normalize(distX) ); + node.setNodeMotionY( normalize(distY) ); } fn onFree(node: opaque) { @@ -121,10 +92,23 @@ fn onFree(node: opaque) { } fn onDraw(node: opaque) { - var camera = parent.callNodeFn("getCameraPos"); - node.drawNode(realX + camera[0] - SPRITE_WIDTH / 4, realY + camera[1] - SPRITE_HEIGHT / 2, SPRITE_WIDTH, SPRITE_HEIGHT); -} + var posX: int = node.getNodeWorldPositionX(); + var posY: int = node.getNodeWorldPositionY(); + var scaleX: float = node.getNodeWorldScaleX(); + var scaleY: float = node.getNodeWorldScaleY(); + + //this offset is because the sprite cell for lejana is twice as big as the sprite cell for the floor tiles + var originOffsetX: int = node.getNodeRectW() * int scaleX / 4; + var originOffsetY: int = node.getNodeRectH() * int scaleY / 2; + + node.drawNode( + floor(posX * scaleX) - originOffsetX, + floor(posY * scaleY) - originOffsetY, + floor(node.getNodeRectW() * scaleX), + floor(node.getNodeRectH() * scaleY) + ); +} //gameplay functions fn runAI(node: opaque, rng: opaque) { @@ -155,9 +139,9 @@ fn runAI(node: opaque, rng: opaque) { node.faceLeft(); } - if (parent.callNodeFn("getCollisionAt", gridX + moveX, gridY + moveY)) { - gridX += moveX; - gridY += moveY; + if (node.getParentNode().callNodeFn("getWalkableAt", gridPositionX + moveX, gridPositionY + moveY)) { + gridPositionX += moveX; + gridPositionY += moveY; } } } diff --git a/assets/scripts/gameplay/lejana.toy b/assets/scripts/gameplay/lejana.toy index 510b9e3..26ffefc 100644 --- a/assets/scripts/gameplay/lejana.toy +++ b/assets/scripts/gameplay/lejana.toy @@ -1,43 +1,26 @@ import standard; import node; -//constants -var SPEED: int const = 4; - -var SPRITE_WIDTH: int const = 64; -var SPRITE_HEIGHT: int const = 64; - -var TILE_WIDTH: int const = 32; -var TILE_HEIGHT: int const = 32; - - -//variables -var parent: opaque = null; //cache the parent for quick access - -var gridX: int = 1; //position on the game grid -var gridY: int = 1; - -var realX: int = null; //will change until realX = gridX * SPRITE_WIDTH -var realY: int = null; - -var motionX: int = 0; //normalized movement direction -var motionY: int = 0; +var gridPositionX: int = 1; //position on the game grid +var gridPositionY: int = 1; var inputX: int = 0; //cache the keyboard input var inputY: int = 0; var direction: int = null; //BUGFIX: animation not looping properly -var enableMovementCounter: int = 30 * 3; //BUGFIX: freeze while drones reach their starting spot -var attackCounter: int = 0; +var enableMovementCounter: int = 60 * 3; //BUGFIX: freeze while drones reach their starting spot //polyfills - animating different cycles on one image -var stepCount: int = 0; +var walkAnimationCounter: int = 0; +var attackAnimationCounter: int = 0; +//utils for facing different directions (idling) fn faceDown(node: opaque) { if (direction == 0) return; direction = 0; node.setNodeRect(0, 0, 32, 32); node.setNodeFrames(4); + walkAnimationCounter = 12; } fn faceUp(node: opaque) { @@ -45,6 +28,7 @@ fn faceUp(node: opaque) { direction = 1; node.setNodeRect(32 * 4, 0, 32, 32); node.setNodeFrames(4); + walkAnimationCounter = 12; } fn faceRight(node: opaque) { @@ -52,6 +36,7 @@ fn faceRight(node: opaque) { direction = 2; node.setNodeRect(32 * 8, 0, 32, 32); node.setNodeFrames(4); + walkAnimationCounter = 12; } fn faceLeft(node: opaque) { @@ -59,45 +44,33 @@ fn faceLeft(node: opaque) { direction = 3; node.setNodeRect(32 * 12, 0, 32, 32); node.setNodeFrames(4); + walkAnimationCounter = 12; } - //accessors & mutators -fn setGridPos(node: opaque, x: int, y: int) { - gridX = x; - gridY = y; +fn setGridPosition(node: opaque, x: int, y: int) { + gridPositionX = x; + gridPositionY = y; - if (realX == null) { - realX = gridX * TILE_WIDTH; - } - - if (realY == null) { - realY = gridY * TILE_HEIGHT; - } + node.setNodePositionX(floor( gridPositionX * node.getNodeRectW() / node.getNodeScaleX() )); + node.setNodePositionY(floor( gridPositionY * node.getNodeRectH() / node.getNodeScaleY() )); } -fn setRealPos(node: opaque, x: int, y: int) { - realX = x; - realY = y; +fn getGridPositionX(node: opaque) { + return gridPositionX; } -fn getGridPos(node: opaque) { - return [gridX, gridY]; +fn getGridPositionY(node: opaque) { + return gridPositionY; } -fn getRealPos(node: opaque) { - return [realX, realY]; -} - - //lifecycle functions fn onLoad(node: opaque) { - node.loadNodeTexture("sprites:/lejana.png"); + node.loadNodeTexture("sprites:/lejana.png"); //NOTE: all of this script is mapped to this sprite sheet node.faceDown(); -} -fn onInit(node: opaque) { - parent = node.getParentNode(); + node.setNodeScaleX(CAMERA_SCALE_X); + node.setNodeScaleY(CAMERA_SCALE_Y); } fn onStep(node: opaque) { @@ -106,91 +79,82 @@ fn onStep(node: opaque) { enableMovementCounter--; return; } - - //process input when aligned to a grid - if (realX / TILE_WIDTH == gridX && realY / TILE_HEIGHT == gridY && motionX == 0 && motionY == 0) { - //facing - if (inputY > 0) { - node.faceDown(); - } - if (inputY < 0) { - node.faceUp(); - } - - if (inputX > 0) { - node.faceRight(); - } - - if (inputX < 0) { - node.faceLeft(); - } - - //disallow wall phasing - if (inputX != 0 && parent.callNodeFn("getCollisionAt", gridX + inputX, gridY) != true) { - inputX = 0; - } - - if (inputY != 0 && parent.callNodeFn("getCollisionAt", gridX, gridY + inputY) != true) { - inputY = 0; - } - - //disallow diagonal movement - if (abs(inputX) != 0) { - gridX += inputX; - } - else { - gridY += inputY; - } - - //trigger the world - if (inputX != 0 || inputY != 0) { - parent.callNodeFn("runAI"); - } - } - - //actually animate - if (++stepCount >= 5) { - if (motionX == 0 && motionY == 0 && inputX == 0 && inputY == 0) { - stepCount = 0; - } - - if (attackCounter > 0) { - attackCounter--; - } - - node.incrementCurrentNodeFrame(); - } - - //animation - standing still - if (attackCounter == 0 && stepCount == 0) { + //animation - start idling + if (attackAnimationCounter == 0) { //move to standing state if (node.getNodeRectY() != 0) { node.setNodeRect(direction * 32 * 4, 0, 32, 32); node.setNodeFrames(4); + walkAnimationCounter = 12; } } - //animation - attacking - if (attackCounter > 0 && stepCount == 0) { + //animation - start attacking + if (--attackAnimationCounter >= 0) { //move to attacking state if (node.getNodeRectY() != 32) { node.setNodeRect(direction * 32 * 4, 32, 32, 32); node.setNodeFrames(3); - stepCount = 0; } + + if ((attackAnimationCounter+1) % 4 == 0) { //+1 for a bugfix + node.incrementCurrentNodeFrame(); + } + + //skip out + return; } - //calc movement - var distX = gridX * TILE_WIDTH - realX; - var distY = gridY * TILE_HEIGHT - realY; + //facing + if (inputY > 0) { + node.faceDown(); + } - motionX = normalize(distX); - motionY = normalize(distY); + else if (inputY < 0) { + node.faceUp(); + } - //make movement - realX += abs(distX) > SPEED ? SPEED * motionX : distX; - realY += abs(distY) > SPEED ? SPEED * motionY : distY; + else if (inputX > 0) { + node.faceRight(); + } + + else if (inputX < 0) { + node.faceLeft(); + } + + //BUGFIX for smooth animation fo + var lesser = 0; + if ((inputX != 0 || inputY != 0) && attackAnimationCounter == 0) { + lesser = 6; + } + + //actually animate + if (--walkAnimationCounter <= lesser) { + node.incrementCurrentNodeFrame(); + walkAnimationCounter = 12; + } + + var parent = node.getParentNode(); //check for collisions from the parent + + if (parent.callNodeFn("getWalkableAt", gridPositionX + inputX, gridPositionY + inputY) && abs(inputX) != abs(inputY)) { + //calc movement + gridPositionX += inputX; + gridPositionY += inputY; + + parent.callNodeFn("runAI"); + } + + //move in realspace + var distX = gridPositionX * TILE_PIXEL_WIDTH - node.getNodePositionX(); + var distY = gridPositionY * TILE_PIXEL_HEIGHT - node.getNodePositionY(); + + node.setNodeMotionX( normalize(distX) ); + node.setNodeMotionY( normalize(distY) ); + + //reset input + inputX = 0; + inputY = 0; } fn onFree(node: opaque) { @@ -198,8 +162,22 @@ fn onFree(node: opaque) { } fn onDraw(node: opaque) { - var camera = parent.callNodeFn("getCameraPos"); - node.drawNode(realX + camera[0] - SPRITE_WIDTH / 4, realY + camera[1] - SPRITE_HEIGHT / 2, SPRITE_WIDTH, SPRITE_HEIGHT); + var posX: int = node.getNodeWorldPositionX(); + var posY: int = node.getNodeWorldPositionY(); + + var scaleX: float = node.getNodeWorldScaleX(); + var scaleY: float = node.getNodeWorldScaleY(); + + //this offset is because the sprite cell for lejana is twice as big as the sprite cell for the floor tiles + var originOffsetX: int = node.getNodeRectW() * int scaleX / 4; + var originOffsetY: int = node.getNodeRectH() * int scaleY / 2; + + node.drawNode( + floor(posX * scaleX) - originOffsetX, + floor(posY * scaleY) - originOffsetY, + floor(node.getNodeRectW() * scaleX), + floor(node.getNodeRectH() * scaleY) + ); } @@ -210,8 +188,14 @@ fn onKeyDown(node: opaque, event: string) { return; } + //enable attack if (event == "character_attack" && inputX == 0 && inputY == 0) { - attackCounter = 3; + attackAnimationCounter = 12; + return; + } + + //if moving, don't take any more input + if (node.getNodeMotionX() != 0 || node.getNodeMotionY() != 0) { return; } @@ -258,7 +242,6 @@ fn onKeyUp(node: opaque, event: string) { } } - //polyfills - move these to standard fn normalize(x): int { if (x > 0) { diff --git a/assets/scripts/gameplay/scene.toy b/assets/scripts/gameplay/scene.toy index 484faeb..d3b85e8 100644 --- a/assets/scripts/gameplay/scene.toy +++ b/assets/scripts/gameplay/scene.toy @@ -2,45 +2,42 @@ import standard; import node; import random; -//consts -var TILE_WIDTH: int const = 32; -var TILE_HEIGHT: int const = 32; - -var MAP_WIDTH: int const = 16; -var MAP_HEIGHT: int const = 16; - -var CAMERA_X: int const = 0; -var CAMERA_Y: int const = 32; - +//persistent members var tilemap: opaque = null; -var player: opaque = null; var stepCounter: opaque = null; +var player: opaque = null; +var enemies: [opaque] = null; -var enemies: [opaque] = []; - -var collisionMap: [bool] = null; //cache this, since it won't change during a level - -var rng: opaque = null; +var collisionDataCache: [bool] = null; +var rng: opaque = null; //TODO: does this have an opaque tag? //lifecycle functions -fn onLoad(node: opaque) { - var empty = node.loadChild("scripts:/empty.toy"); - - tilemap = empty.loadChild("scripts:/gameplay/tilemap.toy"); - stepCounter = empty.loadChild("scripts:/gameplay/step-counter.toy"); - - player = node.loadChild("scripts:/gameplay/lejana.toy"); -} - fn onInit(node: opaque) { - node.generateLevel(clock().hash(), MAP_WIDTH, MAP_HEIGHT); + //load the map stuff + tilemap = node.loadChild("scripts:/gameplay/tilemap.toy"); + node.generateScene(clock().hash(), MAP_GRID_WIDTH, MAP_GRID_HEIGHT); + + //load and initialize the UI (depends on map stuff) + stepCounter = node.loadChild("scripts:/gameplay/step-counter.toy"); + stepCounter.setNodeRect( + 0, + 0, + floor(TILE_PIXEL_WIDTH * MAP_GRID_WIDTH * tilemap.getNodeWorldScaleX()), //width - stretches along the top of the tilemap + stepCounter.getNodeRectH() //default height + ); stepCounter.callNodeFn("setMaxSteps", 100); + + //offset the scene node, so it shows the map outside separate from the UI + node.setNodePositionY(16); } fn onFree(node: opaque) { - rng.freeRandomGenerator(); + //cleanup + if (rng != null) { + rng.freeRandomGenerator(); + } } //fn onStep(node: opaque) { @@ -48,36 +45,32 @@ fn onFree(node: opaque) { //} fn onDraw(node: opaque) { + //use the onDraw to sort - skip too many steps node.sortChildrenNode(depthComparator); - stepCounter.callNodeFn("customOnDraw", 0, 0, TILE_WIDTH * MAP_WIDTH, 32); -} - -//utils - polyfills -fn loadChild(parent: opaque, fname: string) { - var child: opaque = loadNode(fname); - parent.pushNode(child); - return child; } //gameplay functions -fn generateLevel(node: opaque, seed: int, width: int, height: int) { +fn generateScene(node: opaque, seed: int, width: int, height: int) { //reset the array enemies = []; - if (rng != null) rng.freeRandomGenerator(); + if (rng != null) { + rng.freeRandomGenerator(); + } rng = createRandomGenerator(seed); - //place player - player.callNodeFn("setGridPos", 1, 1); - //generate map - tilemap.callNodeFn("generateFromRng", rng, 16, 16); - collisionMap = tilemap.callNodeFn("getCollisionMap"); + tilemap.callNodeFn("generateFromRng", rng, width, height); + collisionDataCache = tilemap.callNodeFn("getCollisionData"); + + //place player here, so drop dropping can avoid the player + player = node.loadChild("scripts:/gameplay/lejana.toy"); + player.callNodeFn("setGridPosition", 1, 1); //generate drones var droneCount: int const = rng.generateRandomNumber() % 2 + 20; for (var i = 0; i < droneCount; i++) { - var d = node.loadChild("scripts:/gameplay/drone.toy"); + var d: opaque = node.loadChild("scripts:/gameplay/drone.toy"); d.initNode(); enemies.push(d); @@ -86,36 +79,40 @@ fn generateLevel(node: opaque, seed: int, width: int, height: int) { var y = 0; //while generated spot is a collision, or too close to the player - while (x == 0 && y == 0 || node.getCollisionAt(x, y) == false || x < width / 6 * 2 && y < height / 6 * 2) { + while (x == 0 && y == 0 || node.getWalkableAt(x, y) == false || x < width / 6 * 2 && y < height / 6 * 2) { x = rng.generateRandomNumber() % width; y = rng.generateRandomNumber() % height; } - d.callNodeFn("setGridPos", x, y); - d.callNodeFn("setRealPos", (width -1) * TILE_WIDTH, (height - 1) * TILE_HEIGHT); + d.callNodeFn("setGridPosition", x, y); + d.setNodePositionX(MAP_GRID_WIDTH * TILE_PIXEL_WIDTH); + d.setNodePositionY(MAP_GRID_HEIGHT * TILE_PIXEL_HEIGHT); } } -fn getCollisionAt(node: opaque, x: int, y: int) { - if (collisionMap == null || x == null || y == null) { +fn getWalkableAt(node: opaque, x: int, y: int) { + if (collisionDataCache == null || x == null || y == null) { return false; } //entities - var pos = player.callNodeFn("getGridPos"); - if (x == pos[0] && y == pos[1]) { + if (x == player.callNodeFn("getGridPositionX") && y == player.callNodeFn("getGridPositionY")) { return false; } for (var i = 0; i < enemies.length(); i++) { - var pos = enemies[i].callNodeFn("getGridPos"); - if (x == pos[0] && y == pos[1]) { + if (x == enemies[i].callNodeFn("getGridPositionX") && y == enemies[i].callNodeFn("getGridPositionY")) { return false; } } + //outside the grid + if (y * MAP_GRID_WIDTH + x < 0 || y * MAP_GRID_WIDTH + x >= collisionDataCache.length()) { + return false; + } + //default - return collisionMap[y * MAP_WIDTH + x]; + return collisionDataCache[y * MAP_GRID_WIDTH + x]; } fn runAI(node: opaque) { @@ -126,21 +123,28 @@ fn runAI(node: opaque) { stepCounter.callNodeFn("alterRemainingSteps", -1); } -fn depthComparator(lhs: opaque, rhs: opaque) { //for sorting by depth - var lhsPos = lhs.callNodeFn("getRealPos"); - var rhsPos = rhs.callNodeFn("getRealPos"); +//utils - polyfills +fn loadChild(parent: opaque, fname: string) { + //TODO: add this to the API proper + var child: opaque = loadNode(fname); + parent.pushNode(child); + return child; +} - if (lhsPos == null || rhsPos == null) { //BUGFIX: children without that function +fn depthComparator(lhs: opaque, rhs: opaque) { //for sorting by depth + var lhsPositionY = lhs.getNodeWorldPositionY(); + var rhsPositionY = rhs.getNodeWorldPositionY(); + + if (lhsPositionY == null || rhsPositionY == null) { //BUGFIX: children without that function return true; } - if (lhsPos[1] == rhsPos[1]) { //BUGFIX: prevent z-fighting - return lhsPos[0] <= rhsPos[0]; + if (lhsPositionY == rhsPositionY) { //BUGFIX: prevent z-fighting + var lhsPositionX = lhs.getNodeWorldPositionX(); + var rhsPositionX = rhs.getNodeWorldPositionX(); + + return lhsPositionX < rhsPositionX; } - return lhsPos[1] < rhsPos[1]; + return lhsPositionY < rhsPositionY; } - -fn getCameraPos(node: opaque) { - return [CAMERA_X, CAMERA_Y]; -} \ No newline at end of file diff --git a/assets/scripts/gameplay/step-counter.toy b/assets/scripts/gameplay/step-counter.toy index 3aaeeab..642388a 100644 --- a/assets/scripts/gameplay/step-counter.toy +++ b/assets/scripts/gameplay/step-counter.toy @@ -1,9 +1,19 @@ import node; -//utils +//members var maxSteps: int = 0; var remainingSteps: int = 0; +//accessors +fn getMaxSteps(node: opaque) { + return maxSteps; +} + +fn getRemainingSteps(node: opaque) { + return remainingSteps; +} + +//mutators fn setMaxSteps(node: opaque, steps: int) { maxSteps = steps; remainingSteps = steps; @@ -13,14 +23,7 @@ fn setRemainingSteps(node: opaque, steps: int) { remainingSteps = steps; } -fn getMaxSteps(node: opaque) { - return maxSteps; -} - -fn getRemainingSteps(node: opaque) { - return remainingSteps; -} - +//utility mutators fn alterRemainingSteps(node: opaque, increment: int) { remainingSteps += increment; if (remainingSteps > maxSteps) { @@ -47,21 +50,18 @@ fn onLoad(node: opaque) { node .loadChild("scripts:/gameplay/text.toy") - .setNodeText("fonts:/alphbeta.ttf", 32, "Water", 0, 60, 240, 255); + .setNodeText("fonts:/alphbeta.ttf", 32, "Water", 0, 60, 240, 255); //rgba } fn onFree(node: opaque) { node.freeNodeTexture(); } -fn customOnDraw(node: opaque, x: int, y: int, w: int, h: int) { +fn onDraw(node: opaque) { if (remainingSteps > 0 && maxSteps > 0) { - var tmp = float remainingSteps / maxSteps * w; + var tmp = float remainingSteps / maxSteps * node.getNodeRectW(); + var h = node.getNodeRectH(); - node.drawNode(x, y, int tmp, h); - - for (var i: int = 0; i < node.getChildNodeCount(); i++) { - node.getChildNode(i).callNodeFn("customOnDraw", x, y); - } + node.drawNode(node.getNodePositionX(), node.getNodePositionY(), int tmp, h); } } \ No newline at end of file diff --git a/assets/scripts/gameplay/text.toy b/assets/scripts/gameplay/text.toy index a03cd04..3b5004f 100644 --- a/assets/scripts/gameplay/text.toy +++ b/assets/scripts/gameplay/text.toy @@ -2,10 +2,17 @@ import node; //this is a child of the step counter, which simply renders text -fn customOnDraw(node: opaque, parentX: int, parentY: int) { - node.drawNode(parentX, parentY); +fn onDraw(node: opaque) { + var posX: int = node.getNodePositionX(); + var posY: int = node.getNodePositionY(); + var scaleX: float = node.getNodeScaleX(); + var scaleY: float = node.getNodeScaleY(); + + node.drawNode(floor(posX * scaleX), floor(posY * scaleY)); } fn onFree(node: opaque) { node.freeNodeTexture(); -} \ No newline at end of file +} + +//TODO: polyfill? \ No newline at end of file diff --git a/assets/scripts/gameplay/tilemap.toy b/assets/scripts/gameplay/tilemap.toy index 6acbd7d..9ee4372 100644 --- a/assets/scripts/gameplay/tilemap.toy +++ b/assets/scripts/gameplay/tilemap.toy @@ -1,22 +1,8 @@ import standard; import node; -//consts -var TILE_WIDTH: int const = 32; -var TILE_HEIGHT: int const = 32; - - -//vars -var mapWidth: int = 0; -var mapHeight: int = 0; - -//map between the identity and position on the sprite sheet -var rawmap: [[string]] = null; - -var tilemap: [int] = null; // [x0, y0, x1, y1, ...] -var collisions: [bool] = null; - -var tileset: [string : [int]] = [ +//constants mapped to the given file "tileset.png" +var tileset: [string : [int]] const = [ "pillar": [0, 0, 0], "floor-0": [0, 1, 1], @@ -40,57 +26,61 @@ var tileset: [string : [int]] = [ "edge-br": [3, 4, 0] ]; +//raw string data +var rawmap: [[string]] = null; -var parent: opaque = null; +//baked and usable blobs of data +var tilemap: [int] = null; // [x0, y0, x1, y1, ...] +var collisions: [bool] = null; +//metadata about the above blobs +var tilemapGridWidth: int = 0; +var tilemapGridHeight: int = 0; -//debug vars - what are these for? -var camX = 0; -var camY = 0; -var camW = 1080; -var camH = 720; +//fast accessors +fn getTilemapData(node: opaque) { + return tilemap; +} +fn getCollisionData(node: opaque) { + return collisions; +} //lifecycle functions fn onLoad(node: opaque) { node.loadNodeTexture("sprites:/tileset.png"); -} -fn onInit(node: opaque) { - //find root - parent = node; - while (parent.getParentNode() != null) { - parent = parent.getParentNode(); - } + node.setNodeScaleX(CAMERA_SCALE_X); + node.setNodeScaleY(CAMERA_SCALE_Y); } fn onDraw(node: opaque) { - if (tilemap == null) { - return; - } - - var camera = parent.callNodeFn("getCameraPos"); + assert tilemap, "tilemap is null"; - //calc the region to render - var lowerX: int = round((camX - camW/2.0) / TILE_WIDTH); - var upperX: int = round((camX - camW*1.5) / TILE_WIDTH); - var lowerY: int = round((camY - camH/2.0) / TILE_HEIGHT); - var upperY: int = round((camY - camH*1.5) / TILE_HEIGHT); + var posX: int const = node.getNodeWorldPositionX(); + var posY: int const = node.getNodeWorldPositionY(); - //bounds check - lowerX = max(0, lowerX); - upperX = min(upperX < 0 ? abs(upperX) : 0, mapWidth); - lowerY = max(0, lowerY); - upperY = min(upperY < 0 ? abs(upperY) : 0, mapHeight); - - var runner: int = 0; + //draw everything at twice the original size + var scaleX: float const = node.getNodeWorldScaleX(); + var scaleY: float const = node.getNodeWorldScaleY(); //draw the tilemap - for (var j = lowerY; j < upperY; j++) { - for (var i = lowerX; i < upperX; i++) { - node.setNodeRect(tilemap[j * mapWidth * 2 + i * 2] * 16, tilemap[j * mapWidth * 2 + i * 2 + 1] * 16, 16, 16); + for (var j = 0; j < tilemapGridHeight; j++) { + for (var i = 0; i < tilemapGridWidth; i++) { + //set the rect of the node on the tilesheet - the "tilemap" var is a single blob of data + node.setNodeRect( + tilemap[j * tilemapGridWidth * 2 + i * 2] * TILE_PIXEL_WIDTH, + tilemap[j * tilemapGridWidth * 2 + i * 2 + 1] * TILE_PIXEL_HEIGHT, + TILE_PIXEL_WIDTH, TILE_PIXEL_HEIGHT + ); - node.drawNode(i * TILE_WIDTH + camera[0], j * TILE_HEIGHT + camera[1], TILE_WIDTH, TILE_HEIGHT); + //draw to the screen + node.drawNode( + floor((i * TILE_PIXEL_WIDTH + posX) * scaleX), + floor((j * TILE_PIXEL_HEIGHT + posY) * scaleY), + floor(TILE_PIXEL_WIDTH * scaleX), + floor(TILE_PIXEL_HEIGHT * scaleY) + ); } } } @@ -98,36 +88,38 @@ fn onDraw(node: opaque) { //utils functions for map generation fn generateFromRng(node: opaque, rng: opaque, width: int, height: int) { - rawmap = generateRawTilemap(rng, width, height); + //use debug room for now + rawmap = generateRawTilemapDebugRoom(rng, width, height); tilemap = bakeTilemap(rawmap, width, height); collisions = bakeCollisionMap(rawmap, width, height); - mapWidth = width; - mapHeight = height; + tilemapGridWidth = width; + tilemapGridHeight = height; + //debugging print tilemap; print collisions; } -fn generateRawTilemap(rng: opaque, width: int, height: int) { +//"raw" tilemaps are not usable, they are just a 2d array of strings +fn generateRawTilemapDebugRoom(rng: opaque, width: int, height: int): [[string]] const { import random; - //generate an empty grid + //generate a grid filled with only pillar tiles, as a starting point var result: [[string]] = []; var row: [string] = []; for (var j: int = 0; j < height; j++) { row.push("pillar"); } - for (var i: int = 0; i < width; i++) { result.push(row); } - //generate the contents of the grid - floor + //generate the walkable tiles of the grid - floor tiles for (var j: int = 1; j < height - 1; j++) { for (var i: int = 1; i < width - 1; i++) { - //select a random floor tile + //select a random floor tile (graphical effect only) var x: int = rng.generateRandomNumber() % 4; var t: string = "floor-" + string x; @@ -153,45 +145,41 @@ fn generateRawTilemap(rng: opaque, width: int, height: int) { result[0][height - 1] = "corner-bl"; result[width - 1][height - 1] = "corner-br"; - //debug + //debugging result[4][4] = "pillar"; result[width - 5][4] = "pillar"; result[4][height - 5] = "pillar"; result[width - 5][height - 5] = "pillar"; + //return the raw result of strings return result; } -fn bakeCollisionMap(tilemap: [[string]], width: int, height: int) { - //generate an empty grid - var result: [bool] = []; - - //extract the collision map - for (var j: int = 0; j < height; j++) { - for (var i: int = 0; i < width; i++) { - //almost - you still need one pair of parentheses - result.push(tileset[ tilemap[i][j] ][2] != 0); - } - } - - return result; -} - -fn bakeTilemap(tilemap: [[string]], width: int, height: int) { - //generate an empty grid +//"baking" converts raw tilemaps into usable blobs of data +fn bakeTilemap(tilemap: [[string]] const, width: int, height: int): [int] const { var result: [int] = []; - //extract the position map + //extract the positions from the tileset for (var j: int = 0; j < height; j++) { for (var i: int = 0; i < width; i++) { result.push(tileset[ tilemap[i][j] ][0]); result.push(tileset[ tilemap[i][j] ][1]); } } - + return result; } -fn getCollisionMap(node: opaque) { - return collisions; -} \ No newline at end of file +//this bakes the collision map as a separate object +fn bakeCollisionMap(tilemap: [[string]] const, width: int, height: int): [bool] const { + var result: [bool] = []; + + //extract the walkable state + for (var j: int = 0; j < height; j++) { + for (var i: int = 0; i < width; i++) { + result.push(tileset[ tilemap[i][j] ][2] != 0); + } + } + + return result; +} diff --git a/assets/scripts/init.toy b/assets/scripts/init.toy index 242f0e1..793ca11 100644 --- a/assets/scripts/init.toy +++ b/assets/scripts/init.toy @@ -1,6 +1,19 @@ +//Globals go here +var TILE_PIXEL_WIDTH: int const = 16; +var TILE_PIXEL_HEIGHT: int const = 16; + +var MAP_GRID_WIDTH: int const = 16; +var MAP_GRID_HEIGHT: int const = 16; + +var CAMERA_SCALE_X: float const = 2.0; +var CAMERA_SCALE_Y: float const = 2.0; + + + //A quirk of the setup is that anything defined in the root of `init.toy` becomes a global object //To resolve that, the configuration is inside a block scope { + import standard; import engine; import input; @@ -32,11 +45,13 @@ //this function must always be called, or the engine won't run - initWindow("Airport", 800, 600, false); //TODO: custom FPS setting + initWindow( + "Airport", + floor(TILE_PIXEL_WIDTH * MAP_GRID_WIDTH * CAMERA_SCALE_X), + floor(TILE_PIXEL_HEIGHT * MAP_GRID_HEIGHT * CAMERA_SCALE_Y) + 32, //32 is UI space + false); + //TODO: custom FPS setting //kick off the logic of the scene graph - loadRootNode("scripts:/airplane.toy"); + loadRootNode("scripts:/gameplay/scene.toy"); } - -//Globals go here - diff --git a/assets/sprites/frametest.png b/assets/sprites/frametest.png deleted file mode 100644 index 844f1c7d1d4ac844545b608920ecd5b403fa260e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 404 zcmV;F0c-w=P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0VzpDK~!i%?b$&N zgCG!vVU`}lqj?*T;L>BdY{w3cBN0R@2n>JHjp^#k3u;t-->Y9;*Uj_%X&qDJI3f@P zM*4DVOTmvD!JyiXcqO$yUMd_+_`l^_j-oif3crfJgukkiOi-0l_kbulg9-$qs^8SVK$KewE79vQ zAk2peD+TLeAf7*#QC4;lfsDeu0PEcsopeCFV661ZdI!i+Zijt#Ks?8b4wQx|YapI` zS@E!n0iqmIF__8&!jcWDR3Ki!J<(sV1|TdFQ$0Y`T`6F4Jd0KcblI(AULp|Y$s`vD yvptK_H$mw@JY!R6)PT%5)A~hTUv9B>Bc;9p1NS4U=G}Mz0000!lvI6;>1s;*b3=DinK$vl=HlH+5(8JTkF(ktM?R7_91_d6LgUrPq2e_F&1aYol zX3BVAx7%~_H}m^yp2huZnI+cVdtJP={nPDSMxaJy@a%g`l!XqP^)lnF${=x1S3j3^ HP6!lvI6;>1s;*b3=DinK$vl=HlH+5(8JTkF(ktM?R7(51_d6Mi_GkAI-Il??NVms zSkM^#&wtjI+tIUC&f0F{OK{nL{kd1}sr>CA!;ry@`^A}zYo4%Kvn_kP6(r&5>gTe~ HDWM4fKMpY&