Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f697bb244 | ||
|
|
8332bb879e | ||
|
|
b4508b84a7 | ||
|
|
cbdcbdd40e | ||
|
|
6cc71cf7c4 | ||
|
|
7c19cb8a6b | ||
|
|
2adc4a37a7 | ||
|
|
497f6d4487 | ||
|
|
616cef608a | ||
|
|
1dafcae9d6 | ||
|
|
4aae7a0e52 | ||
|
|
7b6a74f429 | ||
|
|
080ab50d84 | ||
|
|
e505aee537 | ||
|
|
b9ca6de322 | ||
|
|
1562681f0a | ||
|
|
5fdb457f8e |
No files matched your search
@@ -152,3 +152,16 @@ jobs:
|
||||
fi
|
||||
gh release upload "$tag" "build/downloads/wurm-v$VERSION.apk" "build/downloads/wurm-$VERSION-fdroid.apk" "build/downloads/wurm-web-v$VERSION.zip" --clobber
|
||||
gh release edit "$tag" --draft=false --latest
|
||||
# Arcade follows this release now, not at its next timer, and Breeze
|
||||
# then publishes it to the node. RELEASE_FOLLOW_TOKEN may only start
|
||||
# workflows in Arcade and Breeze; Game updates takes no input and finds
|
||||
# the newest game releases itself. Without it Arcade's timer follows.
|
||||
- name: Start Arcade's game update
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.RELEASE_FOLLOW_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$GH_TOKEN" ]; then
|
||||
echo "No RELEASE_FOLLOW_TOKEN: Arcade's Game updates picks this release up on its timer."
|
||||
exit 0
|
||||
fi
|
||||
gh workflow run game-updates.yml -R waozixyz/arcade --ref master
|
||||
@@ -0,0 +1,93 @@
|
||||
name: Google Play bundle
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: wurm-play-bundle
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
bundle:
|
||||
name: Signed Google Play App Bundle
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 75
|
||||
env:
|
||||
ZIRAN_PAR_THREADS: '1'
|
||||
MAKEFLAGS: -j1
|
||||
OMP_NUM_THREADS: '1'
|
||||
YUE_DESKTOP_RECOVERY: '0'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: waozixyz/wurm
|
||||
steps:
|
||||
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||
with:
|
||||
path: waozixyz/wurm
|
||||
persist-credentials: false
|
||||
- name: Read the locked compiler and release version
|
||||
id: version
|
||||
run: |
|
||||
python3 - <<'PY' >> "$GITHUB_OUTPUT"
|
||||
import json
|
||||
from pathlib import Path
|
||||
print('compiler=' + json.loads(Path('ziran.lock').read_text())['toolchain']['commit'])
|
||||
print('version=' + json.loads(Path('version.json').read_text())['version'])
|
||||
PY
|
||||
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
|
||||
with:
|
||||
repository: ziranlang/ziran
|
||||
ref: ${{ steps.version.outputs.compiler }}
|
||||
path: ziranlang/ziran
|
||||
persist-credentials: false
|
||||
- name: Install native build tools
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends build-essential cmake pkg-config python3-pil python3-numpy libssl-dev
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- name: Install the pinned Android SDK tools
|
||||
run: |
|
||||
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" 'ndk;28.2.13676358' 'build-tools;36.0.0' 'platforms;android-36' 'cmake;3.22.1'
|
||||
- name: Build the locked compiler
|
||||
working-directory: ziranlang/ziran
|
||||
run: |
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY make -j1
|
||||
echo "$PWD/build/bin" >> "$GITHUB_PATH"
|
||||
- name: Fetch only locked packages
|
||||
run: ziran fetch --locked
|
||||
- name: Verify release metadata
|
||||
run: |
|
||||
sh update_version.sh
|
||||
git diff --exit-code -- version.json
|
||||
- name: Build both ARM architectures in one Google Play edition bundle
|
||||
run: python3 tools/build_android.py --bundle --abi universal
|
||||
- name: Sign with the Apfelwurm upload key and verify
|
||||
env:
|
||||
KEYSTORE: ${{ secrets.WURM_ANDROID_KEYSTORE }}
|
||||
PASSWORD: ${{ secrets.WURM_ANDROID_KEYSTORE_PASSWORD }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$KEYSTORE" && test -n "$PASSWORD"
|
||||
curl --fail --show-error --location --retry 3 \
|
||||
https://github.com/google/bundletool/releases/download/1.18.3/bundletool-all-1.18.3.jar \
|
||||
--output "$RUNNER_TEMP/bundletool.jar"
|
||||
umask 077
|
||||
trap 'rm -f "$RUNNER_TEMP/wurm-release.p12" "$RUNNER_TEMP/wurm-password"' EXIT
|
||||
printf '%s' "$KEYSTORE" | base64 -d > "$RUNNER_TEMP/wurm-release.p12"
|
||||
printf '%s\n' "$PASSWORD" > "$RUNNER_TEMP/wurm-password"
|
||||
python3 tools/android_release.py sign build/android/Apfelwurm-release-unsigned.aab \
|
||||
--keystore "$RUNNER_TEMP/wurm-release.p12" --password-file "$RUNNER_TEMP/wurm-password" \
|
||||
--bundletool "$RUNNER_TEMP/bundletool.jar"
|
||||
cat backup/android-release/play-verification.json
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wurm-play-${{ steps.version.outputs.version }}
|
||||
path: waozixyz/wurm/build/downloads/wurm-v${{ steps.version.outputs.version }}-gplay.aab
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
@@ -1,5 +1,38 @@
|
||||
# Changelog
|
||||
|
||||
## [0.2.8] - 2026-10-27
|
||||
|
||||
- After the meadow, a new idea arrives every few dozen levels and keeps coming back: squirrels that dash and sit from level 45, hedgehogs that curl into a spiky ball as you come close from 85, keys that open a gate from 101, frogs that hop two tiles from 125, switch stones that open and close a gate from 141, rolling stones from 165 and portal rooms, reached only through a ring, from 181.
|
||||
- Each new idea takes every other board for ten levels. After that, the ideas you have met take turns, with no more than two plain boards in a row.
|
||||
- A gate closes a doorway up to four tiles wide. Its key opens it for good and is worth 2 points; a switch stone flips it each time you arrive on it. Boards with a gate or a portal room score more.
|
||||
- New pictures for the squirrel, hedgehog, frog, rolling stone, key, switch stone and gate.
|
||||
|
||||
## [0.2.7] - 2026-10-27
|
||||
|
||||
- On the desktop, Play starts right away with mouse steering; the keyboard always works, and Pause still switches to the direction pad.
|
||||
- wurm.waozi.xyz opens faster with a much lighter loading picture.
|
||||
|
||||
## [0.2.6] - 2026-10-27
|
||||
|
||||
- Glowing portals arrive from level 61: first on a few boards, then more often, with two pairs late in the mountains. Steer into one ring to come out of its partner, keeping your direction. Each ring stands in open ground, so you can always go around it.
|
||||
- See your best run on the Profile leaderboard: the furthest level you reached and your highest score, as separate Level and Score columns ranked against your friends.
|
||||
- Sign in once for every waozi.xyz site: a profile signed in on Arcade, Dew or here is used by the others in the same browser.
|
||||
- Buy Dew inside the Google Play version through Google Play, priced in your own currency. The direct download and F-Droid versions keep buying Dew with Monero.
|
||||
- The privacy page explains Google Play purchases and how to delete your account.
|
||||
|
||||
## [0.2.5] - 2026-10-27
|
||||
|
||||
- Score more on harder boards: each level's apples are worth one to nine points by how many creatures roam it, how many apples it asks for and how tight its walls are. Extra lives still come about every 33 apples.
|
||||
- The Profile always opens. If it cannot start on this device, it says why instead of doing nothing, and a saved account key that cannot be read is kept aside.
|
||||
|
||||
## [0.2.4] - 2026-10-27
|
||||
|
||||
- Play on the whole page at wurm.waozi.xyz, without a title bar above the game.
|
||||
|
||||
## [0.2.3] - 2026-10-27
|
||||
|
||||
- Top up in the Profile opens dew.waozi.xyz, where you can buy Dew with Monero in any amount or with almost any other coin.
|
||||
|
||||
## [0.2.2] - 2026-10-27
|
||||
|
||||
- Set an account alias with capitals, an @ or spaces; a taken alias now says so.
|
||||
|
||||
|
After Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 104 KiB |
@@ -31,6 +31,7 @@
|
||||
Records :: #import "entity/entity_records";
|
||||
Dew :: #import "entity/entity_dew";
|
||||
Shop :: #import "entity/game_shop_native";
|
||||
Leaderboard :: #import "entity/leaderboard_native";
|
||||
Files :: #import "entity/native_files";
|
||||
File :: #import "std/file";
|
||||
#import "std/text_buffer"
|
||||
@@ -38,6 +39,9 @@
|
||||
#import "kryon/tree_input"
|
||||
#import "kryon/key_input"
|
||||
#import "kryon/text_input_props"
|
||||
#import "kryon/text_props"
|
||||
#import "kryon/text_align"
|
||||
#import "kryon/text_widget"
|
||||
#import "kryon/open_uri"
|
||||
#if #defined(ANDROID_BUILD) {
|
||||
#import "kryon/android_jni"
|
||||
@@ -82,17 +86,42 @@
|
||||
if name == "entity.records" { return Records.EntityRecordsAnswer(request) }
|
||||
if name == "entity.dew" { return Dew.EntityDewAnswer(request) }
|
||||
if name == "entity.game-shop" { return Shop.EntityGameShopAnswer(request) }
|
||||
// The best run, on the board Arcade names after the game's catalog id.
|
||||
if name == "leaderboard" {
|
||||
saved := Leaderboard.EntityLeaderboardReport("wurm", "Apfelwurm", "xyz.waozi.wurm", "Apfelwurm", request)
|
||||
return ifx saved then "saved" else "rejected"
|
||||
}
|
||||
if name == "entity.profile" && request == "open" { OpenProfile(); return "available" }
|
||||
return ""
|
||||
}
|
||||
OpenProfile :: () { if ready { Entity.EntityHostReload(); visible = true } }
|
||||
// The Profile always opens. One that could not start tries again and,
|
||||
// if it still cannot, says why instead of doing nothing.
|
||||
OpenProfile :: () {
|
||||
if !ready && started && profile_bytes != "" {
|
||||
root: [4096]u8
|
||||
ready = Entity.EntityHostOpen(profile_bytes, Root(root[:]), "arcade", true)
|
||||
}
|
||||
if ready { Entity.EntityHostReload() }
|
||||
visible = true
|
||||
}
|
||||
ProfileVisible :: () -> bool { return visible }
|
||||
DrawProfile :: (session: Session, bounds: Rectangle, key: s32, dark: bool) {
|
||||
if !ready {
|
||||
problem := Entity.EntityHostProblem()
|
||||
if problem == "" { problem = "The profile could not start. Reload the page to try again." }
|
||||
unused Text(session, TextProps.{.key = 29010, .text = problem, .font = 18, .wrap = TextWrap.TextWrapAuto,
|
||||
.align = TextAlign.TextAlignCenter,
|
||||
.bounds = Rectangle.{bounds.x + 24.0, bounds.y + 48.0, bounds.width - 48.0, 120.0}})
|
||||
return
|
||||
}
|
||||
typed: [1024]u8
|
||||
input := TextFieldInputFor(key, KeyboardModifiers(session), TypedTextTake(session, typed[:]))
|
||||
unused Entity.EntityHostFrame(session, bounds, key, KeyboardModifiers(session), input, dark)
|
||||
}
|
||||
Back :: () { if !Entity.EntityHostBack() && Entity.EntityHostSave() { visible = false } }
|
||||
Back :: () {
|
||||
if !ready { visible = false; return }
|
||||
if !Entity.EntityHostBack() && Entity.EntityHostSave() { visible = false }
|
||||
}
|
||||
VisitWebsite :: () -> bool { return OpenUri("https://waozi.xyz/") }
|
||||
} else {
|
||||
#import "kryon/open_uri"
|
||||
|
||||
@@ -693,6 +693,32 @@ AppleFlash :: (session: Session, stage: Rectangle) {
|
||||
.shape = StarIcon.Shape, .color = Color.{255, 227, 116, 220}})
|
||||
}
|
||||
|
||||
// Each portal pair glows in its own colour and breathes slowly, so the two
|
||||
// rings that belong together are easy to tell apart.
|
||||
portal_frame: s32;
|
||||
DrawPortals :: (session: Session, stage: Rectangle) {
|
||||
if game.portal_count == 0 { return }
|
||||
portal_frame = (portal_frame + 1) % 120
|
||||
scale := stage.width / (cast(float32)board_columns * 16.0)
|
||||
breath := cast(float32)(ifx portal_frame < 60 then portal_frame else 120 - portal_frame) / 60.0
|
||||
for pair: 0..game.portal_count - 1 {
|
||||
glow := ifx pair == 0 then Color.{150, 112, 255, 255} else Color.{255, 160, 70, 255}
|
||||
core := ifx pair == 0 then Color.{58, 30, 120, 235} else Color.{120, 58, 12, 235}
|
||||
for end: 0..1 {
|
||||
centre := ifx end == 0 then game.portals[pair].a else game.portals[pair].b
|
||||
key := 12000 + cast(u64)pair * 8 + cast(u64)end * 4
|
||||
outer := (13.0 + 2.0 * breath) * scale
|
||||
inner := 8.0 * scale
|
||||
x := stage.x + cast(float32)centre.x * scale
|
||||
y := stage.y + cast(float32)centre.y * scale
|
||||
unused Box(session, BoxProps.{.key = key, .bounds = Rectangle.{x - outer, y - outer, outer * 2.0, outer * 2.0},
|
||||
.fill = Color.{glow.r, glow.g, glow.b, cast(u8)(70.0 + 50.0 * breath)}, .radius = outer})
|
||||
unused Box(session, BoxProps.{.key = key + 1, .bounds = Rectangle.{x - inner, y - inner, inner * 2.0, inner * 2.0},
|
||||
.fill = core, .border = glow, .radius = inner})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stone posts mark each open gate throughout the journey. Their tiles and the
|
||||
// centre opening keep their existing collision data and width.
|
||||
DrawGatePosts :: (session: Session, stage: Rectangle) {
|
||||
@@ -722,6 +748,20 @@ DrawBoard :: (session: Session, stage: Rectangle) {
|
||||
}
|
||||
}
|
||||
DrawGatePosts(session, stage)
|
||||
DrawPortals(session, stage)
|
||||
// A closed gate, the key that opens it or the switch stone that flips it.
|
||||
if game.gate >= 0 && !game.gate_open {
|
||||
for part: 0..game.gate_span - 1 {
|
||||
cell := game.gate + cast(s32)part * game.gate_step
|
||||
Sprite(session, 12110 + cast(u64)part, stage, Point.{(cell % board_columns) * 16 + 8, (cell / board_columns) * 16 + 8},
|
||||
Rectangle.{(ifx game.gate_step == 1 then 11.0 else 12.0) * 16.0, 64.0, 16.0, 16.0}, sprites)
|
||||
}
|
||||
}
|
||||
if game.key.x >= 0 { Sprite(session, 12101, stage, game.key, Rectangle.{8.0 * 16.0, 64.0, 16.0, 16.0}, sprites) }
|
||||
if game.switch_stone.x >= 0 {
|
||||
Sprite(session, 12102, stage, game.switch_stone,
|
||||
Rectangle.{(ifx game.gate_open then 10.0 else 9.0) * 16.0, 64.0, 16.0, 16.0}, sprites)
|
||||
}
|
||||
if game.apples > 0 && game.apple.x >= 0 {
|
||||
Sprite(session, 1400, stage, game.apple, Rectangle.{0.0, 112.0, 16.0, 16.0}, sprites)
|
||||
AppleFlash(session, stage)
|
||||
@@ -749,10 +789,18 @@ DrawBoard :: (session: Session, stage: Rectangle) {
|
||||
Rectangle.{cast(float32)game.direction * 16.0, 48.0, 16.0, 16.0}, sprites, WORM_HEAD_SIZE)
|
||||
}
|
||||
for monster: 0..game.monster_count - 1 {
|
||||
column := game.monsters[monster].kind - 1
|
||||
if game.monsters[monster].kind == 1 { column = 6 + enemy_frame }
|
||||
Sprite(session, 6000 + cast(u64)monster, stage, game.monsters[monster].position,
|
||||
Rectangle.{cast(float32)column * 16.0, 32.0, 16.0, 16.0}, sprites)
|
||||
creature := game.monsters[monster]
|
||||
column := creature.kind - 1
|
||||
row: float32 = 32.0
|
||||
if creature.kind == 1 { column = 6 + enemy_frame }
|
||||
// The animals met after the meadow share row four of every sheet.
|
||||
if creature.animal != ANIMAL_CLASSIC { row = 64.0 }
|
||||
if creature.animal == ANIMAL_SQUIRREL { column = (creature.timer / 4) % 2 }
|
||||
if creature.animal == ANIMAL_HEDGEHOG { column = ifx creature.timer < 0 then 3 else 2 }
|
||||
if creature.animal == ANIMAL_FROG { column = ifx creature.timer >= 14 && creature.timer % 14 < 4 then 5 else 4 }
|
||||
if creature.animal == ANIMAL_STONE { column = 6 + (creature.timer / 3) % 2 }
|
||||
Sprite(session, 6000 + cast(u64)monster, stage, creature.position,
|
||||
Rectangle.{cast(float32)column * 16.0, row, 16.0, 16.0}, sprites)
|
||||
}
|
||||
for particle: 0..99 {
|
||||
life := game.particles[particle].life
|
||||
@@ -1625,15 +1673,20 @@ Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
if game.mode == MODE_FINISHED && !editor.playtest && recorded_level != game.level {
|
||||
Progress.Complete(game.level)
|
||||
if Progress.Begin(game.level + 1, game.lives, game.score) { recorded_level = game.level }
|
||||
Progress.RecordRun(game.level + 2, game.score)
|
||||
}
|
||||
// The run keeps each lost life; a game over or the finished journey
|
||||
// starts the next run at level one.
|
||||
if !editor.playtest && game.lives < lives_before {
|
||||
if game.mode == MODE_DIED { unused Progress.Restart() }
|
||||
if game.mode == MODE_DIED {
|
||||
Progress.RecordRun(game.level + 1, game.score)
|
||||
unused Progress.Restart()
|
||||
}
|
||||
else { unused Progress.LoseLife() }
|
||||
}
|
||||
if game.mode == MODE_VICTORY && !editor.playtest && recorded_level != game.level {
|
||||
Progress.Complete(game.level)
|
||||
Progress.RecordRun(LEVEL_COUNT, game.score)
|
||||
if Progress.Restart() { recorded_level = game.level }
|
||||
}
|
||||
Audio.UpdateAudio(game.mode == MODE_PLAYING || game.mode == MODE_PAUSED,
|
||||
|
||||
@@ -59,6 +59,13 @@ Load :: () {
|
||||
bytes: [2]u8
|
||||
count := ReadRecord("controls.dat", bytes[:])
|
||||
if count == 1 && bytes[0] <= 1 { mode = cast(s32)bytes[0] }
|
||||
// A desktop always has a keyboard, and a mouse drag steers like a swipe,
|
||||
// so it starts with swipe steering instead of asking. Phones, browsers
|
||||
// and hosted copies still ask.
|
||||
#if #defined(ANDROID_BUILD) || #defined(PLATFORM_WEB) || #defined(WURM_PORTABLE) {
|
||||
} else {
|
||||
if mode < 0 { mode = 0 }
|
||||
}
|
||||
}
|
||||
Chosen :: () -> bool { Load(); return mode >= 0 }
|
||||
Pad :: () -> bool { Load(); return mode == 1 }
|
||||
|
||||
@@ -45,7 +45,13 @@ TickInterval :: (level: s32) -> s64 {
|
||||
}
|
||||
|
||||
Point :: struct { x: s32; y: s32; }
|
||||
Monster :: struct { position: Point; kind: s32; direction: s32; }
|
||||
// Two rings joined: stepping into one comes out of the other.
|
||||
Portal :: struct { a: Point; b: Point; }
|
||||
PORTAL_PAIRS :: 2;
|
||||
// The certificate drives routes on the plain boards; animals stay active.
|
||||
features_enabled: bool = true;
|
||||
// animal: one of ANIMAL_*; timer counts the creature's own ticks.
|
||||
Monster :: struct { position: Point; kind: s32; direction: s32; animal: s32; timer: s32; }
|
||||
Particle :: struct { position: Point; life: s32; }
|
||||
Game :: struct {
|
||||
mode: s32
|
||||
@@ -64,6 +70,23 @@ Game :: struct {
|
||||
apple: Point
|
||||
apple_flash: s32
|
||||
monster_count: s32
|
||||
// Points per apple on this board; see LevelMultiplier.
|
||||
multiplier: s32
|
||||
// Portal pairs on this board and the ticks before the next jump.
|
||||
portal_count: s32
|
||||
portals: [PORTAL_PAIRS]Portal
|
||||
portal_wait: s32
|
||||
// This board's puzzle idea: a gate (a doorway up to four cells across,
|
||||
// gate_span cells gate_step apart), its key or switch stone.
|
||||
feature: s32
|
||||
gate: s32
|
||||
gate_span: s32
|
||||
gate_step: s32
|
||||
gate_tiles: [4]u8
|
||||
gate_open: bool
|
||||
key: Point
|
||||
switch_stone: Point
|
||||
on_switch: bool
|
||||
monsters: [MONSTER_LIMIT]Monster
|
||||
particles: [100]Particle
|
||||
death_ticks: s32
|
||||
@@ -120,7 +143,7 @@ SpawnApple :: (game: *Game) {
|
||||
// the permanent interior floor, never inside those gate cells.
|
||||
candidate := Point.{16 + Random(game, (board_columns - 2) * 16),
|
||||
16 + Random(game, (board_rows - 2) * 16)}
|
||||
if TileAt(game, candidate) < 20 && !WormNear(game, candidate, 0, 10) {
|
||||
if TileAt(game, candidate) < 20 && !WormNear(game, candidate, 0, 10) && !OnPortal(game, candidate) {
|
||||
game.apple = candidate
|
||||
game.apple_flash = 128
|
||||
return
|
||||
@@ -129,7 +152,7 @@ SpawnApple :: (game: *Game) {
|
||||
for at: 0..CELLS - 1 {
|
||||
candidate := Point.{cast(s32)(at % board_columns) * 16 + 8, cast(s32)(at / board_columns) * 16 + 8}
|
||||
if candidate.x < 16 || candidate.y < 16 || candidate.x >= (board_columns - 1) * 16 || candidate.y >= (board_rows - 1) * 16 { continue }
|
||||
if TileAt(game, candidate) < 20 && !WormNear(game, candidate, 0, 10) {
|
||||
if TileAt(game, candidate) < 20 && !WormNear(game, candidate, 0, 10) && !OnPortal(game, candidate) {
|
||||
game.apple = candidate
|
||||
game.apple_flash = 128
|
||||
return
|
||||
@@ -179,6 +202,11 @@ LoadLevelData :: (game: *Game, level: s32, now: s64, board: []u8, apples: s32, c
|
||||
game.monsters[index].position = Point.{cast(s32)x * 16 + 8, cast(s32)y * 16 + 8}
|
||||
game.monsters[index].kind = kind
|
||||
game.monsters[index].direction = ifx kind == 1 then Random(game, 4) else kind - 2
|
||||
animal: s32 = ANIMAL_CLASSIC
|
||||
if kind == 1 { animal = RoamerAnimal(level, index) }
|
||||
else if kind >= 2 && kind <= 5 { animal = PatrolAnimal(level, index) }
|
||||
game.monsters[index].animal = animal
|
||||
game.monsters[index].timer = 0
|
||||
game.monster_count += 1
|
||||
game.board[Index(x, y)] = tile & 128
|
||||
}
|
||||
@@ -188,7 +216,403 @@ LoadLevelData :: (game: *Game, level: s32, now: s64, board: []u8, apples: s32, c
|
||||
// Carve the entrance before the apple chooses its spot, so it can never
|
||||
// land on a cell the carving turns into wall.
|
||||
Respawn(game)
|
||||
PlaceIdeas(game)
|
||||
SpawnApple(game)
|
||||
game.multiplier = LevelMultiplier(game)
|
||||
}
|
||||
|
||||
// New ideas arrive one at a time, about twenty levels apart, and keep coming
|
||||
// back afterwards in a clean mix: squirrels from level 45, portals from 61,
|
||||
// hedgehogs from 85, keys and gates from 101, frogs from 125, switch stones
|
||||
// from 141, rolling stones from 165 and portal rooms from 181. A board's ideas
|
||||
// follow from its number and layout alone, so every player meets the same.
|
||||
IDEA_SQUIRREL :: 44
|
||||
IDEA_PORTALS :: 60
|
||||
IDEA_HEDGEHOG :: 84
|
||||
IDEA_KEY :: 100
|
||||
IDEA_FROG :: 124
|
||||
IDEA_SWITCH :: 140
|
||||
IDEA_STONE :: 164
|
||||
IDEA_PORTAL_ROOM :: 180
|
||||
// At most one puzzle idea per board.
|
||||
FEATURE_NONE :: 0
|
||||
FEATURE_PORTALS :: 1
|
||||
FEATURE_KEY :: 2
|
||||
FEATURE_SWITCH :: 3
|
||||
FEATURE_PORTAL_ROOM :: 4
|
||||
ANIMAL_CLASSIC :: 0
|
||||
ANIMAL_SQUIRREL :: 1
|
||||
ANIMAL_HEDGEHOG :: 2
|
||||
ANIMAL_FROG :: 3
|
||||
ANIMAL_STONE :: 4
|
||||
HEDGEHOG_CURL :: 60
|
||||
|
||||
// A well-spread number for each value, the same on every platform: no step
|
||||
// overflows 63 bits.
|
||||
Mix :: (value: s64) -> s32 {
|
||||
mixed := (value % 2147483648 + 2147483648) % 2147483648
|
||||
for round: 0..1 {
|
||||
mixed = (mixed * 1103515245 + 12345) % 2147483648
|
||||
mixed = mixed ^ (mixed >> 16)
|
||||
}
|
||||
return cast(s32)(mixed % 1000003)
|
||||
}
|
||||
|
||||
// A new puzzle idea takes every other board for its first ten levels; then
|
||||
// the ideas so far take turns, with up to two plain boards between them.
|
||||
IdeaIntros: [4]s32 = .[IDEA_PORTALS, IDEA_KEY, IDEA_SWITCH, IDEA_PORTAL_ROOM];
|
||||
IdeasMet :: (level: s32) -> s32 {
|
||||
count: s32 = 0
|
||||
for index: 0..3 { if level >= IdeaIntros[index] { count = cast(s32)index + 1 } }
|
||||
return count
|
||||
}
|
||||
BoardFeature :: (level: s32) -> s32 {
|
||||
count := IdeasMet(level)
|
||||
if count == 0 { return FEATURE_NONE }
|
||||
newest := IdeaIntros[count - 1]
|
||||
if level - newest < 10 { return ifx (level - newest) % 2 == 0 then count else FEATURE_NONE }
|
||||
// Never more than two plain boards in a row.
|
||||
plain := Mix(cast(s64)level) % 10 < 4
|
||||
if plain && !(PlainMix(level - 1) && PlainMix(level - 2)) { return FEATURE_NONE }
|
||||
return 1 + Mix(cast(s64)level * 7 + 3) % count
|
||||
}
|
||||
PlainMix :: (level: s32) -> bool {
|
||||
count := IdeasMet(level)
|
||||
return count == 0 || level - IdeaIntros[count - 1] < 10 || Mix(cast(s64)level) % 10 < 4
|
||||
}
|
||||
|
||||
AnimalIntro :: (animal: s32) -> s32 {
|
||||
if animal == ANIMAL_SQUIRREL { return IDEA_SQUIRREL }
|
||||
if animal == ANIMAL_HEDGEHOG { return IDEA_HEDGEHOG }
|
||||
if animal == ANIMAL_FROG { return IDEA_FROG }
|
||||
if animal == ANIMAL_STONE { return IDEA_STONE }
|
||||
return 0
|
||||
}
|
||||
|
||||
// Wanderers: a landscape's own animal fills its first ten boards, then the
|
||||
// animals met so far mix with the classic flames.
|
||||
RoamerAnimal :: (level: s32, index: s32) -> s32 {
|
||||
available: [3]s32
|
||||
count: s32 = 0
|
||||
if level >= IDEA_SQUIRREL { available[count] = ANIMAL_SQUIRREL; count += 1 }
|
||||
if level >= IDEA_HEDGEHOG { available[count] = ANIMAL_HEDGEHOG; count += 1 }
|
||||
if level >= IDEA_FROG { available[count] = ANIMAL_FROG; count += 1 }
|
||||
if count == 0 { return ANIMAL_CLASSIC }
|
||||
stage := StageOf(level)
|
||||
native: s32 = ifx stage == 1 then ANIMAL_SQUIRREL else ifx stage == 2 then ANIMAL_HEDGEHOG else ifx stage == 3 then ANIMAL_FROG else ANIMAL_CLASSIC
|
||||
ready := native != ANIMAL_CLASSIC && level >= AnimalIntro(native)
|
||||
if ready && level - AnimalIntro(native) < 10 { return native }
|
||||
roll := Mix(cast(s64)level * 131 + cast(s64)index) % 10
|
||||
if roll < 3 { return ANIMAL_CLASSIC }
|
||||
if ready && roll < 7 { return native }
|
||||
return available[Mix(cast(s64)level * 17 + cast(s64)index) % count]
|
||||
}
|
||||
|
||||
// Patrols become rolling stones in the mountains.
|
||||
PatrolAnimal :: (level: s32, index: s32) -> s32 {
|
||||
if level < IDEA_STONE { return ANIMAL_CLASSIC }
|
||||
if level - IDEA_STONE < 10 || Mix(cast(s64)level * 29 + cast(s64)index) % 2 == 0 { return ANIMAL_STONE }
|
||||
return ANIMAL_CLASSIC
|
||||
}
|
||||
|
||||
Passable :: (game: *Game, at: s32) -> bool {
|
||||
tile := game.board[at]
|
||||
return tile < 20 || tile >= 128
|
||||
}
|
||||
|
||||
// Every cell the worm can reach from the entrance with a doorway closed: span
|
||||
// cells from door, step apart.
|
||||
FloodFrom :: (game: *Game, start: s32, door: s32, reached: []bool, span: s32 = 1, step: s32 = 1) -> s32 {
|
||||
closed: [CELLS]bool
|
||||
for at: 0..CELLS - 1 { reached[at] = false; closed[at] = false }
|
||||
if door >= 0 { for cell: 0..span - 1 { closed[door + cast(s32)cell * step] = true } }
|
||||
if !Passable(game, start) || closed[start] { return 0 }
|
||||
queue: [CELLS]s32
|
||||
head: s32 = 0
|
||||
tail: s32 = 1
|
||||
queue[0] = start
|
||||
reached[start] = true
|
||||
while head < tail {
|
||||
at := queue[head]
|
||||
head += 1
|
||||
x := at % board_columns
|
||||
y := at / board_columns
|
||||
neighbours: [4]s32 = .[ifx x > 0 then at - 1 else -1, ifx x < board_columns - 1 then at + 1 else -1,
|
||||
ifx y > 0 then at - board_columns else -1, ifx y < board_rows - 1 then at + board_columns else -1]
|
||||
for next: neighbours {
|
||||
if next < 0 || closed[next] || reached[next] || !Passable(game, next) { continue }
|
||||
reached[next] = true
|
||||
queue[tail] = next
|
||||
tail += 1
|
||||
}
|
||||
}
|
||||
return tail
|
||||
}
|
||||
|
||||
// A doorway: a straight run of one to four floor cells across a corridor,
|
||||
// walled at both ends and open on both sides, that once closed cuts the board
|
||||
// into two sizable halves, the far one holding the exit when the board allows.
|
||||
// reached marks the entrance side.
|
||||
Floor :: (game: *Game, x: s32, y: s32) -> bool { return Inside(x, y) && Passable(game, Index(x, y)) && game.board[Index(x, y)] < 128 }
|
||||
Solid :: (game: *Game, x: s32, y: s32) -> bool { return Inside(x, y) && !Passable(game, Index(x, y)) }
|
||||
DoorwaySpan :: (game: *Game, x: s32, y: s32, dx: s32, dy: s32) -> s32 {
|
||||
half := board_columns / 2
|
||||
if !Solid(game, x - dx, y - dy) { return 0 }
|
||||
for span: 1..4 {
|
||||
cx := x + dx * cast(s32)(span - 1)
|
||||
cy := y + dy * cast(s32)(span - 1)
|
||||
if cy < 2 || cy > board_rows - 4 || (Abs(cx - half) <= 3 && (cy <= 3 || cy >= board_rows - 4)) { return 0 }
|
||||
if !Floor(game, cx, cy) || !Floor(game, cx - dy, cy - dx) || !Floor(game, cx + dy, cy + dx) { return 0 }
|
||||
if Solid(game, cx + dx, cy + dy) { return cast(s32)span }
|
||||
}
|
||||
return 0
|
||||
}
|
||||
FindDoorway :: (game: *Game, reached: []bool, span: *s32, step: *s32, feature: s32) -> s32 {
|
||||
half := board_columns / 2
|
||||
start := Index(half, board_rows - 2)
|
||||
exit := Index(half, 1)
|
||||
firsts: [2 * CELLS]s32
|
||||
spans: [2 * CELLS]s32
|
||||
steps: [2 * CELLS]s32
|
||||
count: s32 = 0
|
||||
for y: 2..board_rows - 4 {
|
||||
for x: 1..board_columns - 2 {
|
||||
across := DoorwaySpan(game, cast(s32)x, cast(s32)y, 1, 0)
|
||||
if across > 0 { firsts[count] = Index(x, y); spans[count] = across; steps[count] = 1; count += 1 }
|
||||
down := DoorwaySpan(game, cast(s32)x, cast(s32)y, 0, 1)
|
||||
if down > 0 { firsts[count] = Index(x, y); spans[count] = down; steps[count] = board_columns; count += 1 }
|
||||
}
|
||||
}
|
||||
if count == 0 { return -1 }
|
||||
total: s32 = 0
|
||||
for at: 0..CELLS - 1 { if Passable(game, cast(s32)at) { total += 1 } }
|
||||
fallback: s32 = -1
|
||||
offset := Mix(cast(s64)game.level) % count
|
||||
for attempt: 0..count - 1 {
|
||||
pick := (offset + cast(s32)attempt) % count
|
||||
near := FloodFrom(game, start, firsts[pick], reached, spans[pick], steps[pick])
|
||||
far := total - near - spans[pick]
|
||||
if near < 24 || far < 24 { continue }
|
||||
exit_beyond := Passable(game, exit) && !reached[exit]
|
||||
if !exit_beyond && fallback >= 0 { continue }
|
||||
if !IdeaFits(game, reached, firsts[pick], feature) { continue }
|
||||
if exit_beyond { span.* = spans[pick]; step.* = steps[pick]; return firsts[pick] }
|
||||
fallback = pick
|
||||
}
|
||||
if fallback < 0 { return -1 }
|
||||
unused FloodFrom(game, start, firsts[fallback], reached, spans[fallback], steps[fallback])
|
||||
span.* = spans[fallback]
|
||||
step.* = steps[fallback]
|
||||
return firsts[fallback]
|
||||
}
|
||||
|
||||
// Whether this board's idea has its spots once the doorway closes: a key or
|
||||
// switch stone before it, a portal on each side of a portal room.
|
||||
IdeaFits :: (game: *Game, reached: []bool, door: s32, feature: s32) -> bool {
|
||||
if feature == FEATURE_PORTAL_ROOM {
|
||||
spots: [CELLS]s32
|
||||
return OpenSpots(game, reached, 1, spots[:]) > 0 && OpenSpots(game, reached, 0, spots[:]) > 0
|
||||
}
|
||||
return SideSpot(game, reached, door, feature == FEATURE_KEY).x >= 0
|
||||
}
|
||||
|
||||
// Open spots for portals, keys and switch stones: the middle of open floor,
|
||||
// clear of the entrance and exit lanes and of the board's creatures. A key
|
||||
// or switch stone may also lie in a corridor (loose).
|
||||
OpenAround :: (game: *Game, x: s32, y: s32) -> bool {
|
||||
for dy: -1..1 {
|
||||
for dx: -1..1 {
|
||||
if !Inside(x + dx, y + dy) || game.board[Index(x + dx, y + dy)] >= 20 { return false }
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
OpenFloor :: (game: *Game, x: s32, y: s32) -> bool { return Inside(x, y) && game.board[Index(x, y)] < 20 }
|
||||
InCorridor :: (game: *Game, x: s32, y: s32) -> bool {
|
||||
if !OpenFloor(game, x, y) { return false }
|
||||
open: s32 = 0
|
||||
if OpenFloor(game, x - 1, y) { open += 1 }
|
||||
if OpenFloor(game, x + 1, y) { open += 1 }
|
||||
if OpenFloor(game, x, y - 1) { open += 1 }
|
||||
if OpenFloor(game, x, y + 1) { open += 1 }
|
||||
return open >= 3
|
||||
}
|
||||
// side: 1 only the entrance side, 0 only the far side, -1 anywhere.
|
||||
OpenSpots :: (game: *Game, reached: []bool, side: s32, output: []s32, loose: bool = false) -> s32 {
|
||||
count: s32 = 0
|
||||
half := board_columns / 2
|
||||
for y: 3..board_rows - 4 {
|
||||
for x: 2..board_columns - 3 {
|
||||
if Abs(cast(s32)x - half) <= 2 && (y <= 5 || y >= board_rows - 6) { continue }
|
||||
if !OpenAround(game, cast(s32)x, cast(s32)y) && !(loose && InCorridor(game, cast(s32)x, cast(s32)y)) { continue }
|
||||
at := Index(x, y)
|
||||
if side >= 0 && reached[at] != (side == 1) { continue }
|
||||
centre := Point.{cast(s32)x * 16 + 8, cast(s32)y * 16 + 8}
|
||||
crowded := false
|
||||
for index: 0..game.monster_count - 1 {
|
||||
if Near(centre, game.monsters[index].position, 32) { crowded = true }
|
||||
}
|
||||
if !crowded { output[count] = at; count += 1 }
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
PortalCentre :: (cell: s32) -> Point {
|
||||
return Point.{(cell % board_columns) * 16 + 8, (cell / board_columns) * 16 + 8}
|
||||
}
|
||||
CellsApart :: (first: s32, second: s32) -> s32 {
|
||||
return Abs(first % board_columns - second % board_columns) + Abs(first / board_columns - second / board_columns)
|
||||
}
|
||||
// Pairs far apart in the open; a portal room joins one spot on each side.
|
||||
PlacePortals :: (game: *Game, pairs: s32, reached: []bool, room: bool) -> bool {
|
||||
near_spots: [CELLS]s32
|
||||
far_spots: [CELLS]s32
|
||||
near := OpenSpots(game, reached, ifx room then 1 else -1, near_spots[:])
|
||||
far := ifx room then OpenSpots(game, reached, 0, far_spots[:]) else 0
|
||||
if !room { far_spots = near_spots; far = near }
|
||||
if near < 1 || far < 1 { return false }
|
||||
taken: [4]s32
|
||||
taken_count: s32 = 0
|
||||
for pair: 0..pairs - 1 {
|
||||
first: s32 = -1
|
||||
for attempt: 0..near - 1 {
|
||||
cell := near_spots[(Mix(cast(s64)game.level * 7919 + cast(s64)pair * 31) + cast(s32)attempt) % near]
|
||||
free := true
|
||||
for index: 0..taken_count - 1 { if CellsApart(cell, taken[index]) < 6 { free = false } }
|
||||
if free { first = cell; break }
|
||||
}
|
||||
if first < 0 { break }
|
||||
second: s32 = -1
|
||||
farthest: s32 = ifx room then 0 else 13
|
||||
for index: 0..far - 1 {
|
||||
cell := far_spots[index]
|
||||
apart := CellsApart(cell, first)
|
||||
if apart <= farthest { continue }
|
||||
free := true
|
||||
for other: 0..taken_count - 1 { if CellsApart(cell, taken[other]) < 6 { free = false } }
|
||||
if free { second = cell; farthest = apart }
|
||||
}
|
||||
if second < 0 { break }
|
||||
game.portals[pair] = Portal.{PortalCentre(first), PortalCentre(second)}
|
||||
taken[taken_count] = first
|
||||
taken[taken_count + 1] = second
|
||||
taken_count += 2
|
||||
game.portal_count += 1
|
||||
}
|
||||
return game.portal_count > 0
|
||||
}
|
||||
// The spot on the entrance side farthest from the entrance, for a key; a
|
||||
// switch stone takes a spot partway there.
|
||||
SideSpot :: (game: *Game, reached: []bool, door: s32, farthest: bool) -> Point {
|
||||
spots: [CELLS]s32
|
||||
count := OpenSpots(game, reached, 1, spots[:], true)
|
||||
start := Index(board_columns / 2, board_rows - 2)
|
||||
best: s32 = -1
|
||||
best_apart: s32 = -1
|
||||
for index: 0..count - 1 {
|
||||
cell := spots[index]
|
||||
if CellsApart(cell, door) < 4 || CellsApart(cell, start) < 6 { continue }
|
||||
apart := CellsApart(cell, start)
|
||||
if !farthest { apart = 100 - Abs(apart - 14) }
|
||||
if apart > best_apart { best = cell; best_apart = apart }
|
||||
}
|
||||
if best < 0 { return Point.{-1, -1} }
|
||||
return PortalCentre(best)
|
||||
}
|
||||
OpenGate :: (game: *Game, open: bool) {
|
||||
if game.gate < 0 { return }
|
||||
for cell: 0..game.gate_span - 1 {
|
||||
game.board[game.gate + cast(s32)cell * game.gate_step] = ifx open then game.gate_tiles[cell] else 20
|
||||
}
|
||||
game.gate_open = open
|
||||
}
|
||||
PlaceIdeas :: (game: *Game) {
|
||||
game.portal_count = 0
|
||||
game.portal_wait = 0
|
||||
game.feature = FEATURE_NONE
|
||||
game.gate = -1
|
||||
game.gate_span = 0
|
||||
game.gate_step = 1
|
||||
game.gate_open = false
|
||||
game.key = Point.{-1, -1}
|
||||
game.switch_stone = Point.{-1, -1}
|
||||
game.on_switch = false
|
||||
if !features_enabled { return }
|
||||
feature := BoardFeature(game.level)
|
||||
reached: [CELLS]bool
|
||||
if feature == FEATURE_PORTALS {
|
||||
pairs: s32 = ifx game.level >= IDEA_PORTAL_ROOM && Mix(cast(s64)game.level * 3) % 2 == 1 then PORTAL_PAIRS else 1
|
||||
if PlacePortals(game, pairs, reached[:], false) { game.feature = feature }
|
||||
return
|
||||
}
|
||||
if feature == FEATURE_NONE {
|
||||
// A new gate idea that found no doorway on the board before moves
|
||||
// on to this one.
|
||||
newest := IdeasMet(game.level)
|
||||
if newest < FEATURE_KEY || game.level - IdeaIntros[newest - 1] >= 10 || HostsIdea(game.level - 1, newest) { return }
|
||||
if PlaceGate(game, newest, reached[:]) { game.feature = newest }
|
||||
return
|
||||
}
|
||||
// A board without a doorway for its idea takes another gate idea met
|
||||
// so far, or else portals.
|
||||
ideas: [3]s32 = .[feature, FEATURE_SWITCH, FEATURE_KEY]
|
||||
intros: [3]s32 = .[0, IDEA_SWITCH, IDEA_KEY]
|
||||
for index: 0..2 {
|
||||
idea := ideas[index]
|
||||
if (index > 0 && idea == feature) || game.level < intros[index] { continue }
|
||||
if PlaceGate(game, idea, reached[:]) { game.feature = idea; return }
|
||||
}
|
||||
if PlacePortals(game, 1, reached[:], false) { game.feature = FEATURE_PORTALS }
|
||||
}
|
||||
// Whether a level's board has a doorway for a gate idea, loaded aside.
|
||||
HostsIdea :: (level: s32, feature: s32) -> bool {
|
||||
columns := board_columns
|
||||
rows := board_rows
|
||||
enabled := features_enabled
|
||||
features_enabled = false
|
||||
aside: Game
|
||||
aside.random = 1
|
||||
LoadLevel(*aside, level, 0)
|
||||
reached: [CELLS]bool
|
||||
span: s32 = 0
|
||||
step: s32 = 1
|
||||
hosts := FindDoorway(*aside, reached[:], *span, *step, feature) >= 0
|
||||
features_enabled = enabled
|
||||
BoardSize(columns, rows)
|
||||
return hosts
|
||||
}
|
||||
PlaceGate :: (game: *Game, feature: s32, reached: []bool) -> bool {
|
||||
span: s32 = 0
|
||||
step: s32 = 1
|
||||
door := FindDoorway(game, reached, *span, *step, feature)
|
||||
if door < 0 { return false }
|
||||
game.gate = door
|
||||
game.gate_span = span
|
||||
game.gate_step = step
|
||||
for cell: 0..span - 1 { game.gate_tiles[cell] = game.board[door + cast(s32)cell * step] }
|
||||
OpenGate(game, false)
|
||||
if feature == FEATURE_KEY { game.key = SideSpot(game, reached, door, true) }
|
||||
if feature == FEATURE_SWITCH { game.switch_stone = SideSpot(game, reached, door, false) }
|
||||
placed := (feature == FEATURE_KEY && game.key.x >= 0) || (feature == FEATURE_SWITCH && game.switch_stone.x >= 0) ||
|
||||
(feature == FEATURE_PORTAL_ROOM && PlacePortals(game, 1, reached, true))
|
||||
if !placed {
|
||||
OpenGate(game, true)
|
||||
game.gate = -1
|
||||
game.gate_span = 0
|
||||
game.key = Point.{-1, -1}
|
||||
game.switch_stone = Point.{-1, -1}
|
||||
game.portal_count = 0
|
||||
return false
|
||||
}
|
||||
// A portal room's doorway stays a plain hedge for good.
|
||||
if feature == FEATURE_PORTAL_ROOM { game.gate = -1; game.gate_span = 0 }
|
||||
return true
|
||||
}
|
||||
OnPortal :: (game: *Game, position: Point) -> bool {
|
||||
for pair: 0..game.portal_count - 1 {
|
||||
if Near(position, game.portals[pair].a, 12) || Near(position, game.portals[pair].b, 12) { return true }
|
||||
}
|
||||
return Near(position, game.key, 12) || Near(position, game.switch_stone, 12)
|
||||
}
|
||||
// The complete playable campaign is designed and certified. The recovered
|
||||
// 99-level archive stays an independent, untouched historical reference.
|
||||
@@ -453,21 +877,96 @@ MoveMonster :: (game: *Game, index: s32) {
|
||||
if !MonsterBlocked(game, index, candidate) { monster.position = candidate }
|
||||
return
|
||||
}
|
||||
monster.timer += 1
|
||||
if monster.animal == ANIMAL_STONE {
|
||||
// A rolling stone keeps its patrol at twice the pace.
|
||||
PatrolStep(game, index)
|
||||
PatrolStep(game, index)
|
||||
return
|
||||
}
|
||||
if monster.kind == 1 && monster.animal == ANIMAL_SQUIRREL {
|
||||
// A squirrel dashes at twice the pace for a moment, then sits still.
|
||||
phase := monster.timer % 16
|
||||
if phase >= 8 { return }
|
||||
if phase == 0 { monster.direction = Random(game, 4) }
|
||||
for step: 0..1 {
|
||||
candidate := MonsterNext(monster.position, monster.direction)
|
||||
if MonsterBlocked(game, index, candidate) || candidate.y < 16 {
|
||||
monster.direction = Random(game, 4)
|
||||
return
|
||||
}
|
||||
monster.position = candidate
|
||||
}
|
||||
return
|
||||
}
|
||||
if monster.kind == 1 && monster.animal == ANIMAL_HEDGEHOG {
|
||||
// A hedgehog ambles at half pace and curls into a still, spiky ball
|
||||
// for a while when the worm's head comes close.
|
||||
if monster.timer < 0 { return }
|
||||
if game.length > 0 && Near(game.worm[0], monster.position, 40) { monster.timer = -HEDGEHOG_CURL; return }
|
||||
if monster.timer % 2 == 1 { return }
|
||||
RoamerStep(game, index)
|
||||
return
|
||||
}
|
||||
if monster.kind == 1 && monster.animal == ANIMAL_FROG {
|
||||
// A frog sits, then hops two tiles at once, even over a hedge.
|
||||
if monster.timer % 14 != 0 { return }
|
||||
direction := Random(game, 4)
|
||||
landing := monster.position
|
||||
for step: 0..31 { landing = MonsterNext(landing, direction) }
|
||||
if landing.y >= 16 && landing.x >= 16 && landing.x < (board_columns - 1) * 16 && landing.y < (board_rows - 1) * 16 &&
|
||||
!MonsterBlocked(game, index, landing) {
|
||||
monster.position = landing
|
||||
monster.direction = direction
|
||||
}
|
||||
return
|
||||
}
|
||||
if monster.kind == 1 { RoamerStep(game, index) }
|
||||
else { PatrolStep(game, index) }
|
||||
}
|
||||
RoamerStep :: (game: *Game, index: s32) {
|
||||
monster := *game.monsters[index]
|
||||
candidate := MonsterNext(monster.position, monster.direction)
|
||||
blocked := MonsterBlocked(game, index, candidate)
|
||||
if monster.kind == 1 {
|
||||
if !blocked { blocked = Random(game, 25) == 0 || candidate.y < 16 }
|
||||
if blocked { monster.direction = Random(game, 4) }
|
||||
else { monster.position = candidate }
|
||||
} else if blocked {
|
||||
if !blocked { blocked = Random(game, 25) == 0 || candidate.y < 16 }
|
||||
if blocked { monster.direction = Random(game, 4) }
|
||||
else { monster.position = candidate }
|
||||
}
|
||||
PatrolStep :: (game: *Game, index: s32) {
|
||||
monster := *game.monsters[index]
|
||||
candidate := MonsterNext(monster.position, monster.direction)
|
||||
if MonsterBlocked(game, index, candidate) {
|
||||
monster.direction = (monster.direction + 2) % 4
|
||||
monster.kind = monster.direction + 2
|
||||
} else { monster.position = candidate }
|
||||
}
|
||||
AddScore :: (game: *Game, amount: s32) {
|
||||
previous := game.score / 33
|
||||
game.score += amount
|
||||
if game.score / 33 > previous { game.lives += 1 }
|
||||
// Points follow how hard a board is: its enemies (wandering ones count
|
||||
// twice), the apples it asks for, how tightly its walls close in and its
|
||||
// speed. The first meadows are worth one point an apple, the hardest boards
|
||||
// nine. Every player gets the same multiplier for the same board.
|
||||
LevelMultiplier :: (game: *Game) -> s32 {
|
||||
roamers: s32 = 0
|
||||
for index: 0..game.monster_count - 1 { if game.monsters[index].kind == 1 { roamers += 1 } }
|
||||
walls: s32 = 0
|
||||
for at: 0..board_columns * board_rows - 1 {
|
||||
if game.board[at] >= 20 && (game.board[at] & 128) == 0 { walls += 1 }
|
||||
}
|
||||
tightness := ifx walls > 300 then (walls - 300) * 10 / 150 else 0
|
||||
difficulty := 10 * game.monster_count + 10 * roamers + 5 * (game.apples - 5) + tightness +
|
||||
5 * (32 - cast(s32)TickInterval(game.level))
|
||||
if game.feature >= FEATURE_KEY { difficulty += 10 }
|
||||
if difficulty < 0 { difficulty = 0 }
|
||||
return 1 + difficulty / 20
|
||||
}
|
||||
|
||||
AddScore :: (game: *Game, points: s32) {
|
||||
multiplier := ifx game.multiplier > 0 then game.multiplier else 1
|
||||
// The extra-life step grows with the points, so a life still comes
|
||||
// about every 33 apples at any level.
|
||||
step := 33 * multiplier
|
||||
previous := game.score / step
|
||||
game.score += points * multiplier
|
||||
if game.score / step > previous { game.lives += 1 }
|
||||
}
|
||||
|
||||
AddParticle :: (game: *Game, position: Point) {
|
||||
@@ -517,6 +1016,38 @@ Tick :: (game: *Game) {
|
||||
else if game.direction == DIR_UP { next.y -= 4 }
|
||||
else if game.direction == DIR_RIGHT { next.x += 4 }
|
||||
else { next.y += 4 }
|
||||
// A head reaching a ring's centre comes out of its partner, keeping its
|
||||
// course; the body follows through the same rings.
|
||||
if game.portal_wait > 0 { game.portal_wait -= 1 }
|
||||
else {
|
||||
for pair: 0..game.portal_count - 1 {
|
||||
portal := game.portals[pair]
|
||||
from := portal.a
|
||||
to := portal.b
|
||||
if Abs(next.x - portal.b.x) <= 4 && Abs(next.y - portal.b.y) <= 4 { from = portal.b; to = portal.a }
|
||||
else if Abs(next.x - portal.a.x) > 4 || Abs(next.y - portal.a.y) > 4 { continue }
|
||||
for spark: 0..3 { AddParticle(game, from); AddParticle(game, to) }
|
||||
next = Point.{to.x + next.x - from.x, to.y + next.y - from.y}
|
||||
game.portal_wait = 5
|
||||
break
|
||||
}
|
||||
}
|
||||
// The key opens its gate for good; a switch stone flips it each time the
|
||||
// head arrives on it.
|
||||
if game.key.x >= 0 && Near(next, game.key, 10) {
|
||||
for spark: 0..5 { AddParticle(game, game.key) }
|
||||
game.key = Point.{-1, -1}
|
||||
OpenGate(game, true)
|
||||
AddScore(game, 2)
|
||||
}
|
||||
if game.switch_stone.x >= 0 {
|
||||
over := Near(next, game.switch_stone, 8)
|
||||
if over && !game.on_switch {
|
||||
OpenGate(game, !game.gate_open)
|
||||
for spark: 0..3 { AddParticle(game, game.switch_stone) }
|
||||
}
|
||||
game.on_switch = over
|
||||
}
|
||||
if game.apples == 0 && next.y < 0 {
|
||||
count := game.length
|
||||
if count > 100 { count = 100 }
|
||||
|
||||
@@ -19,6 +19,12 @@ completed: [200]u8;
|
||||
dirty: bool;
|
||||
poll_at: s64;
|
||||
record_name: [112]u8;
|
||||
// The best run for the leaderboard: the furthest level reached and the
|
||||
// highest score of any run. Each account keeps its own.
|
||||
best_level: s32;
|
||||
best_score: s32;
|
||||
reported_level: s32 = -1;
|
||||
reported_score: s32 = -1;
|
||||
RecordName :: (name: string) -> string {
|
||||
if owner[0] == 0 { return name }
|
||||
at: s64 = 0
|
||||
@@ -74,6 +80,44 @@ Load :: () {
|
||||
if Records.ReadRecord(RecordName("completed.dat"), earned[:]) == 200 {
|
||||
for index: 0..199 { completed[index] = ifx earned[index] == 1 then 1 else 0 }
|
||||
}
|
||||
best: [9]u8
|
||||
if Records.ReadRecord(RecordName("best.dat"), best[:]) == 8 {
|
||||
best_level = cast(s32)best[0] | (cast(s32)best[1] << 8)
|
||||
best_score = cast(s32)best[4] | (cast(s32)best[5] << 8) | (cast(s32)best[6] << 16) | (cast(s32)(best[7] & 127) << 24)
|
||||
if best_level > LEVELS { best_level = LEVELS }
|
||||
}
|
||||
}
|
||||
|
||||
// A finished level, a game over or the end of the journey: keep the best run
|
||||
// and tell the leaderboard when it improves.
|
||||
RecordRun :: (reached: s32, run_score: s32) {
|
||||
Load()
|
||||
level_reached := ifx reached > LEVELS then LEVELS else reached
|
||||
if level_reached <= best_level && run_score <= best_score { return }
|
||||
if level_reached > best_level { best_level = level_reached }
|
||||
if run_score > best_score { best_score = run_score }
|
||||
bytes: [8]u8 = .[cast(u8)(best_level & 255), cast(u8)((best_level >> 8) & 255), 0, 0,
|
||||
cast(u8)(best_score & 255), cast(u8)((best_score >> 8) & 255), cast(u8)((best_score >> 16) & 255), cast(u8)((best_score >> 24) & 127)]
|
||||
unused Records.WriteRecord(RecordName("best.dat"), bytes[:])
|
||||
Report()
|
||||
}
|
||||
|
||||
// "run LEVEL SCORE" to the host's leaderboard, once per change.
|
||||
Report :: () {
|
||||
if best_level == 0 || (best_level == reported_level && best_score == reported_score) { return }
|
||||
shown := ifx best_score > 100000 then 100000 else best_score
|
||||
out: Vec(u8)
|
||||
BuilderPrint(*out, "run % %", best_level, shown)
|
||||
answer := Account.Service("leaderboard", TextView(VecSlice(out, 0, out.count)))
|
||||
VecFree(out)
|
||||
saved := false
|
||||
for index: 0..answer.count - 5 {
|
||||
if answer[index:index + 5] == "saved" { saved = true }
|
||||
}
|
||||
if saved {
|
||||
reported_level = best_level
|
||||
reported_score = best_score
|
||||
}
|
||||
}
|
||||
|
||||
SaveUnlocked :: () -> bool {
|
||||
@@ -134,6 +178,9 @@ Complete :: (at: s32) {
|
||||
Pump :: (now: s64) -> bool {
|
||||
if now < poll_at { return false }
|
||||
poll_at = now + 5000
|
||||
// A best run recorded before the leaderboard could take it goes now.
|
||||
Load()
|
||||
Report()
|
||||
status := Account.Service("entity.records", "{\"operation\":\"status\"}")
|
||||
current: [65]u8
|
||||
if ReadStringText(status, FieldAt(status, 0, "account"), current[:]) < 0 { return false }
|
||||
@@ -142,6 +189,7 @@ Pump :: (now: s64) -> bool {
|
||||
owner = current
|
||||
loaded = false
|
||||
level = 0; lives = START_LIVES; score = 0; unlocked = 0
|
||||
best_level = 0; best_score = 0; reported_level = -1; reported_score = -1
|
||||
completed = .{}
|
||||
dirty = false
|
||||
Load()
|
||||
|
||||
@@ -9,22 +9,36 @@
|
||||
<link rel="canonical" href="https://wurm.waozi.xyz/">
|
||||
<meta property="og:title" content="Apfelwurm — 200 levels, one little worm">
|
||||
<meta property="og:description" content="Meadow, woodland, lake and mountains. A little orange worm. A long apple adventure. Play free online.">
|
||||
<meta property="og:image" content="https://wurm.waozi.xyz/assets/art/title.png">
|
||||
<meta property="og:image" content="https://wurm.waozi.xyz/social.jpg">
|
||||
<meta property="og:url" content="https://wurm.waozi.xyz/">
|
||||
<style>
|
||||
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;background:#202b26;color:#e0e7d9;font:16px system-ui,sans-serif;overscroll-behavior:none}
|
||||
body{display:flex;flex-direction:column}header{height:48px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 max(16px,env(safe-area-inset-right));background:#303c33;border-bottom:1px solid #52634f}
|
||||
a{color:inherit;text-decoration:none}a:hover{text-decoration:underline}nav{display:flex;gap:20px;font-size:14px}#canvas-frame{flex:1;min-height:0;position:relative}canvas{display:block;width:100%;height:100%;touch-action:none;outline:none}
|
||||
#loading{position:absolute;inset:0;display:grid;place-content:center;gap:16px;text-align:center;background:linear-gradient(#303c33e8,#202b26e8),url('assets/art/title.png') center/cover;font-size:18px}#loading strong{font-size:32px}#loading[hidden]{display:none}
|
||||
@media(max-width:500px){header{height:42px}nav{gap:12px;font-size:12px}}
|
||||
body{overflow:hidden}#canvas-frame{position:fixed;inset:0}canvas{display:block;width:100%;height:100%;touch-action:none;outline:none}
|
||||
#loading{position:absolute;inset:0;display:grid;place-content:center;gap:16px;text-align:center;background:linear-gradient(#303c33e8,#202b26e8),url('loading.webp') center/cover;font-size:18px}#loading strong{font-size:32px}#loading[hidden]{display:none}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header><a href="https://waozi.xyz/studio/#apfelwurm"><strong>Apfelwurm</strong> · Waozi</a><nav><a href="https://github.com/waozixyz/wurm/releases/latest">Android</a><a href="https://github.com/waozixyz/wurm">Source</a><a href="privacy.html">Privacy</a></nav></header>
|
||||
<main id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Apfelwurm game: choose swipe or direction pad, collect apples, then leave through the top gate."></canvas><div id="loading" role="status"><strong>A little worm.<br>A long journey.</strong><span>Opening Apfelwurm…</span></div></main>
|
||||
<script>
|
||||
var Module={canvas:document.getElementById('canvas'),onRuntimeInitialized(){document.getElementById('loading').hidden=true;Module.canvas.focus()},onAbort(){document.getElementById('loading').hidden=false;document.getElementById('loading').textContent='The game could not open. Please reload to try again.'},printErr(text){console.error(text)}};
|
||||
// One sign-in for every waozi.xyz site: account.waozi.xyz hands over the
|
||||
// shared profile before the game starts, or the game starts without it.
|
||||
(function () {
|
||||
var started = false;
|
||||
function start() {
|
||||
if (started) return;
|
||||
started = true;
|
||||
var game = document.createElement('script');
|
||||
game.src = 'game.js';
|
||||
document.body.appendChild(game);
|
||||
}
|
||||
var shared = document.createElement('script');
|
||||
shared.src = 'https://account.waozi.xyz/share.js';
|
||||
shared.onload = function () { WaoziAccount.attach(Module, 2500).then(start, start); };
|
||||
shared.onerror = start;
|
||||
setTimeout(start, 4000);
|
||||
document.head.appendChild(shared);
|
||||
})();
|
||||
</script>
|
||||
<script src="game.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Apfelwurm · Privacy</title><style>body{max-width:650px;margin:8vh auto;padding:24px;color:#e0e7d9;background:#202b26;font:18px/1.7 system-ui}a{color:inherit}</style><h1>Your journey stays with you.</h1><p>Updated 26 October 2026.</p><p>Apfelwurm stores your run, preferences and edited levels on this device. Every level can be unlocked by playing, without an account or payment. There are no ads or analytics.</p><h2>Optional accounts</h2><p>Profile uses the same Entity account provider as Shovey. You can create an account, import your account key or link another device. Private keys stay in the host's private storage. Keep exported keys and recovery codes private.</p><p>When signed in, completion marks, active playtime, website-visit unlocks, the selected skin and preferences are synced through your selected node. Account records are encrypted by the host. An unfinished run and editor drafts remain on this device. Each account's game records stay separate.</p><h2>Dew and skins</h2><p>Three optional skins cost 10, 20 or 30 Dew. Purchases require sign-in and confirmation. The Waozi node processes the account, product, price and an idempotent receipt key so retrying cannot charge twice. Purchased ownership is restored from that account's Dew ledger. You can also earn skins by playing for five hours, reaching level 40 or opening <a href="https://waozi.xyz/">waozi.xyz</a>. The website unlock records that you opened the link; it does not track your browsing.</p><p>The default node is <a href="https://api.waozi.xyz">api.waozi.xyz</a>. It receives the connection and account information needed for authentication, synchronization and Dew. Another node has its own operator and policies. Offline play does not require a network connection.</p><h2>Your data</h2><p>Profile offers key backup, device linking, logout and remote-data management on supported hosts. Logging out does not delete remote records. Clearing this site's browser data removes local saves and keys. Back up your account key before clearing browser data. For account deletion or privacy questions, contact <a href="mailto:[email protected]?subject=Apfelwurm%20account%20deletion">[email protected]</a> with your public account ID and node address. Never send your private key or recovery code.</p><p>Cloudflare hosts this site and receives ordinary connection information when you load it.</p><p><a href="/">Back to Apfelwurm</a> · <a href="https://waozi.xyz/privacy.html">Waozi privacy policy</a></p></html>
|
||||
<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Apfelwurm · Privacy</title><style>body{max-width:650px;margin:8vh auto;padding:24px;color:#e0e7d9;background:#202b26;font:18px/1.7 system-ui}a{color:inherit}</style><h1>Your journey stays with you.</h1><p>Updated 27 October 2026.</p><p>Apfelwurm stores your run, preferences and edited levels on this device. Every level can be unlocked by playing, without an account or payment. There are no ads or analytics.</p><h2>Optional accounts</h2><p>Profile uses the same Entity account provider as Shovey. You can create an account, import your account key or link another device. Private keys stay in the host's private storage. Keep exported keys and recovery codes private.</p><p>When signed in, completion marks, active playtime, website-visit unlocks, the selected skin and preferences are synced through your selected node. Account records are encrypted by the host. An unfinished run and editor drafts remain on this device. Each account's game records stay separate.</p><h2>Dew and skins</h2><p>Three optional skins cost 10, 20 or 30 Dew. Purchases require sign-in and confirmation. The Waozi node processes the account, product, price and an idempotent receipt key so retrying cannot charge twice. Purchased ownership is restored from that account's Dew ledger. You can also earn skins by playing for five hours, reaching level 40 or opening <a href="https://waozi.xyz/">waozi.xyz</a>. The website unlock records that you opened the link; it does not track your browsing.</p><p>In the Google Play version, Dew is bought through Google Play. Google processes the payment; the Waozi node receives the order number, the Dew pack and Google's purchase token to confirm the purchase and add the Dew to your account. Waozi never receives your payment details. The direct download and F-Droid versions buy Dew with Monero at <a href="https://dew.waozi.xyz/">dew.waozi.xyz</a>.</p><p>The default node is <a href="https://api.waozi.xyz">api.waozi.xyz</a>. It receives the connection and account information needed for authentication, synchronization and Dew. Another node has its own operator and policies. Offline play does not require a network connection.</p><h2>Your data</h2><p>Profile offers key backup, device linking, logout and remote-data management on supported hosts. Logging out does not delete remote records. Clearing this site's browser data, or uninstalling the Android app, removes local saves and keys. Back up your account key first.</p><h2 id="delete-account">Delete your account</h2><p>You can request deletion of your account and the data Waozi's node holds for it without reinstalling Apfelwurm. Email <a href="mailto:[email protected]?subject=Apfelwurm%20account%20deletion">[email protected]</a> with the subject Apfelwurm account deletion, your public account ID and the node address. We verify that you control the account before acting. Never send your private key or recovery code. For another node, contact its operator. Deletion does not erase local saves or exported files on your devices.</p><p>Cloudflare hosts this site and receives ordinary connection information when you load it.</p><p><a href="/">Back to Apfelwurm</a> · <a href="https://waozi.xyz/privacy.html">Waozi privacy policy</a></p></html>
|
||||
@@ -1,9 +1,9 @@
|
||||
#import, file "../src/game.zi";
|
||||
// campaign-cases:begin
|
||||
// Generated from campaign_cases.json by tools/design_levels.py.
|
||||
CampaignSeeds: [400]u32 = .[1, 1, 65538, 65538, 131075, 131075, 196612, 196612, 262149, 262149, 327686, 327686, 393223, 401142, 466679, 458760, 532216, 540135, 589834, 597753, 655371, 679128, 728827, 720908, 786445, 786445, 867820, 851982, 917519, 917519, 1014732, 983056, 1064431, 1064431, 1114130, 1114130, 1195505, 1211343, 1245204, 1261042, 1318660, 1326579, 1384197, 1392116, 1441815, 1544762, 1586542, 1546947, 1596646, 1572889, 1638426, 1638426, 1703963, 1703963, 2070422, 1824933, 1898389, 1850875, 1932250, 1900574, 1966111, 1974030, 2039567, 2047486, 2303079, 2105104, 2202317, 2210236, 2252016, 2236178, 2293796, 2301715, 2367252, 2391009, 2440708, 2456546, 4525590, 3155603, 2595539, 2650972, 2637319, 2621481, 2726613, 2900831, 2752555, 2752555, 2857687, 2826011, 2891548, 2891548, 3178817, 2996680, 3014703, 3244354, 3080240, 3088159, 3201210, 3145777, 3401370, 3211314, 3292689, 3276851, 3342388, 3350307, 3439601, 3423763, 3473462, 3631842, 3538999, 3538999, 3612455, 3762916, 3773020, 3677992, 3751448, 3751448, 3848661, 5677950, 3874603, 3866684, 5975323, 4051006, 4005677, 4013596, 4118728, 4205837, 4279293, 4366402, 4194369, 4233964, 6350522, 4378691, 4420471, 4388795, 4390980, 4438494, 4464436, 4496112, 4577487, 4545811, 4619267, 4643024, 4668966, 4661047, 4766179, 4750341, 4879230, 4807959, 5895047, 4857658, 6966297, 6950459, 5004570, 5099598, 5062188, 5101783, 5135644, 5230672, 5391237, 5185343, 5290475, 5290475, 5356012, 5332255, 5389873, 5405711, 5534600, 5447491, 5600137, 5766436, 5934920, 6623873, 5652021, 5644102, 5883857, 5780910, 5870204, 6060260, 6189149, 10441652, 6056711, 6032954, 5971787, 6019301, 6061081, 6037324, 6316674, 6213727, 6231750, 6215912, 6233935, 6249773, 6331148, 8516792, 7299451, 8479382, 15513639, 59852120, 9006406, 7691852, 7084274, 6846704, 6666752, 6761780, 7128239, 7452918, 6845340, 6766150, 6831687, 6895039, 6889305, 8916569, 7129060, 6970680, 11177854, 8358690, 7648165, 7426433, 7484051, 8022543, 7470398, 8230622, 7551773, 8098184, 8203316, 7474768, 13146957, 8070878, 7494976, 7502895, 7766407, 8882986, 7784430, 7697321, 7675749, 7699506, 7772962, 7780881, 18988451, 9778654, 7872360, 7959469, 7929978, 8032925, 8066786, 8415222, 8076890, 8061052, 8142427, 8134508, 8809808, 8390101, 8265582, 8257663, 8505337, 8766664, 20655268, 10012132, 8470112, 8517626, 8575244, 8551487, 8585348, 8617024, 8650885, 8650885, 8763936, 8756017, 8797797, 8924501, 8918767, 8990038, 8913033, 9055575, 9802146, 16176941, 19924813, 9059945, 9212591, 9117563, 9183100, 9191019, 9280313, 9248637, 9322093, 9314174, 9561848, 9443063, 9524438, 9453167, 9613732, 9518704, 9576322, 9568403, 9689373, 10132837, 9739072, 9723234, 9907556, 9883799, 9830551, 9838470, 9911926, 9927764, 9977463, 9969544, 10027162, 10074676, 10092699, 10092699, 10166155, 10229507, 10295044, 10247530, 10471447, 10368500, 11685239, 10925015, 10436222, 10523331, 10485921, 10565111, 11034517, 10630648, 10616995, 10807051, 10682532, 10682532, 11056910, 10779745, 10813606, 10837363, 11417635, 11385959, 10960518, 10960518, 11224030, 11026055, 11535056, 11297486, 11204643, 11165048, 11761158, 11222666, 11367393, 11454502, 11345821, 11432930, 11870660, 11949850, 11849088, 11540247, 11582027, 11621622, 12486978, 12629520, 11673506, 11689344, 11739043, 11739043, 13261676, 11796661, 12004740, 11917631, 11951492, 11935654, 12143733, 12207085, 12122161, 12082566, 12298564, 13399305, 12237397, 12189883, 12255420, 12271258, 12352633, 12368471, 13518911, 16258885, 12483707, 12491626, 12541325, 13087736, 12614781, 12844432, 12672399, 12648642, 17323037, 76295830, 12779716, 12827230, 12900686, 12861091, 13924422, 13781880, 135023955, 87216952, 17452747, 13984225];
|
||||
CampaignRoutes: [400]s32 = .[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 52, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 4, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 4, 62, 0, 0, 0, 0, 1, 0, 120, 73, 4, 0];
|
||||
CampaignReverse: [400]s32 = .[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1];
|
||||
CampaignSeeds: [400]u32 = .[1, 1, 65538, 65538, 131075, 131075, 196612, 196612, 262149, 262149, 327686, 327686, 393223, 401142, 466679, 458760, 532216, 540135, 589834, 597753, 655371, 679128, 728827, 720908, 786445, 786445, 867820, 851982, 917519, 917519, 1014732, 983056, 1064431, 1064431, 1114130, 1114130, 1195505, 1211343, 1245204, 1261042, 1318660, 1326579, 1384197, 1392116, 1441815, 1544762, 1586542, 1546947, 1596646, 1572889, 1638426, 1638426, 1703963, 1703963, 2070422, 1824933, 1898389, 1850875, 1932250, 1900574, 1966111, 1974030, 2039567, 2047486, 2303079, 2105104, 2202317, 2210236, 2252016, 2236178, 2293796, 2301715, 2367252, 2391009, 2440708, 2456546, 4525590, 3155603, 2595539, 2650972, 2637319, 2621481, 2726613, 2900831, 2752555, 2752555, 2857687, 2826011, 2891548, 2891548, 2949166, 2949166, 3030541, 3022622, 3080240, 3088159, 3201210, 3153696, 3211314, 3235071, 3292689, 3276851, 3342388, 3350307, 3439601, 3423763, 3473462, 3631842, 3538999, 3538999, 3604536, 3762916, 3670073, 3670073, 3751448, 3767286, 3809066, 3816985, 3874603, 3866684, 4003492, 4003492, 4005677, 3997758, 4118728, 4205837, 4279293, 4366402, 4210207, 4233964, 4299501, 4299501, 4349200, 4325443, 4390980, 4406818, 4464436, 4496112, 4577487, 4545811, 4619267, 4643024, 4668966, 4661047, 4766179, 4750341, 4879230, 4815878, 5895047, 4849739, 6966297, 6950459, 5004570, 4980813, 5062188, 5101783, 5135644, 5230672, 5256614, 5399156, 5250880, 5242961, 5356012, 5332255, 5389873, 5405711, 5534600, 5463329, 5505109, 5560542, 5633998, 5784459, 5652021, 5652021, 5717558, 5812586, 5767257, 5767257, 6315853, 6426719, 5898331, 5953764, 5979706, 6019301, 6061081, 6037324, 6094942, 6094942, 6168398, 6160479, 6233935, 6241854, 6845883, 7827839, 7299451, 6626336, 6478060, 7103661, 6543597, 6488164, 7084274, 6846704, 6619238, 6761780, 7128239, 7452918, 6845340, 6766150, 6831687, 6926715, 6889305, 6936819, 7129060, 6970680, 8627936, 8279500, 7173025, 7196782, 7689945, 7872082, 7612940, 7351613, 7298365, 7892290, 7411416, 7474768, 8633127, 10715824, 7487057, 7502895, 7560513, 8106924, 7736916, 7602293, 7675749, 7683668, 7772962, 8160993, 11085289, 12455276, 7911955, 8054497, 8025006, 8436794, 8027191, 8145976, 8076890, 8068971, 8134508, 8158265, 8643509, 8564319, 8281420, 8257663, 8394471, 8552851, 12783782, 9980456, 8454274, 8881900, 8527730, 8535649, 8617024, 8617024, 8658804, 8872617, 8866883, 8771855, 8797797, 8813635, 8918767, 9203851, 8944709, 9055575, 13294425, 14632736, 11491078, 9107459, 9220510, 9172996, 9191019, 9175181, 9280313, 9565397, 9306255, 9314174, 9514334, 9743985, 9476924, 9508600, 9613732, 9708760, 9576322, 9584241, 9816077, 9903186, 9865776, 9762829, 9947151, 10343101, 9830551, 9838470, 9911926, 9911926, 10009139, 9977463, 10027162, 10130109, 10092699, 10092699, 10205750, 10308697, 10683075, 10302963, 10344743, 10289310, 10536984, 10639931, 10444141, 10555007, 10485921, 10604706, 10717757, 10630648, 11092135, 10862484, 10706289, 10690451, 10819340, 10803502, 10861120, 10971986, 11417635, 11758152, 11047627, 11023870, 11176516, 11422005, 11083673, 11202458, 11212562, 11141291, 11222666, 11262261, 11351555, 11723748, 11417092, 11377497, 11466791, 11680604, 11532328, 11500652, 11550351, 11558270, 12447383, 11972243, 11681425, 11665587, 11739043, 11826152, 12303477, 11820418, 12424447, 12273986, 11927735, 11927735, 12001191, 12207085, 12454759, 12066728, 12251050, 13486414, 12221559, 12197802, 12287096, 12271258, 12423904, 12360552, 12608226, 19949139, 12483707, 12491626, 12580920, 12881842, 12662295, 13002812, 12775346, 12648642, 15002770, 17291361, 12795554, 12803473, 12861091, 12845253, 12926628, 13243388, 131452486, 33446942, 13659546, 15124561];
|
||||
CampaignRoutes: [400]s32 = .[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 116, 20, 0, 2];
|
||||
CampaignReverse: [400]s32 = .[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0];
|
||||
// campaign-cases:end
|
||||
libc :: #system_library "libc";
|
||||
ParseNumber :: (text: *u8) -> s32 #foreign libc "atoi";
|
||||
@@ -235,6 +235,9 @@ Replay :: (level: s32, portrait: bool, seed: u32, route: []Point) -> bool {
|
||||
replay_deaths: s32;
|
||||
#program_export
|
||||
main :: (argc: s32, argv: **u8) -> s32 {
|
||||
// The certificate proves every board can be won without its puzzle idea
|
||||
// (portals, gates and switches); the animals stay active.
|
||||
features_enabled = false
|
||||
search := argc > 1
|
||||
first: s32 = ifx argc > 2 then ParseNumber(argv[2]) - 1 else 0
|
||||
last: s32 = ifx argc > 3 then ParseNumber(argv[3]) - 1 else LEVEL_COUNT - 1
|
||||
|
||||
@@ -73,6 +73,7 @@ main :: () -> s32 {
|
||||
Expect(StageOf(first - 1) == stage && StageOf(first) == stage + 1, "landscape boundary")
|
||||
Expect(StageNumber(first) == 1 && StageLevels(cast(s32)stage) == 40, "chapter numbering")
|
||||
StartGame(*game, first - 1, 0)
|
||||
multiplier := game.multiplier
|
||||
game.score = 12
|
||||
game.apples = 0
|
||||
game.worm[0] = Point.{328, 0}
|
||||
@@ -80,7 +81,7 @@ main :: () -> s32 {
|
||||
for i: 0..49 { Tick(*game) }
|
||||
Expect(game.mode == MODE_FINISHED, "landscapes connect without ending the run")
|
||||
LoadLevel(*game, first, 2000)
|
||||
Expect(game.level == first && game.mode == MODE_PLAYING && game.lives == 3 && game.score == 17,
|
||||
Expect(game.level == first && game.mode == MODE_PLAYING && game.lives == 3 && game.score == 12 + 5 * multiplier,
|
||||
"next landscape preserves lives and score")
|
||||
}
|
||||
|
||||
@@ -95,9 +96,155 @@ main :: () -> s32 {
|
||||
game.score = 32
|
||||
AddScore(*game, 1)
|
||||
Expect(game.lives == 4, "extra life every 33 points")
|
||||
// Points follow each board's difficulty, not its number.
|
||||
lowest: s32 = 100
|
||||
highest: s32 = 0
|
||||
meadow_low: s32 = 100
|
||||
meadow_high: s32 = 0
|
||||
for level: 0..LEVEL_COUNT - 1 {
|
||||
StartGame(*game, cast(s32)level, 0)
|
||||
if game.multiplier < lowest { lowest = game.multiplier }
|
||||
if game.multiplier > highest { highest = game.multiplier }
|
||||
if level < 40 && game.multiplier < meadow_low { meadow_low = game.multiplier }
|
||||
if level < 40 && game.multiplier > meadow_high { meadow_high = game.multiplier }
|
||||
}
|
||||
StartGame(*game, 0, 0)
|
||||
Expect(game.multiplier == 1 && lowest == 1 && highest >= 8 && highest <= 9 && meadow_high > meadow_low,
|
||||
"harder boards are worth more")
|
||||
StartGame(*game, 120, 0)
|
||||
multiplier := game.multiplier
|
||||
AddScore(*game, 1)
|
||||
Expect(game.score == multiplier, "an apple scores the board's multiplier")
|
||||
game.score = 33 * multiplier - 1
|
||||
lives := game.lives
|
||||
AddScore(*game, 1)
|
||||
Expect(game.lives == lives + 1, "extra lives keep pace with the multiplier")
|
||||
game.death_ticks = 1
|
||||
Tick(*game)
|
||||
Expect(game.lives == 3 && game.worm[0].y == 496, "death consumes a life and respawns")
|
||||
|
||||
// New ideas open one at a time and come back in a mix.
|
||||
for level: 0..IDEA_PORTALS - 1 { Expect(BoardFeature(cast(s32)level) == FEATURE_NONE, "no puzzle idea before level 61") }
|
||||
Expect(BoardFeature(IDEA_PORTALS) == FEATURE_PORTALS && BoardFeature(IDEA_PORTALS + 1) == FEATURE_NONE &&
|
||||
BoardFeature(IDEA_KEY) == FEATURE_KEY && BoardFeature(IDEA_SWITCH) == FEATURE_SWITCH &&
|
||||
BoardFeature(IDEA_PORTAL_ROOM) == FEATURE_PORTAL_ROOM, "each puzzle idea opens on its own board")
|
||||
for level: 0..IDEA_SQUIRREL - 1 { Expect(RoamerAnimal(cast(s32)level, 0) == ANIMAL_CLASSIC, "no new animals in the meadow") }
|
||||
Expect(RoamerAnimal(IDEA_SQUIRREL, 0) == ANIMAL_SQUIRREL && RoamerAnimal(IDEA_HEDGEHOG, 0) == ANIMAL_HEDGEHOG &&
|
||||
RoamerAnimal(IDEA_FROG, 0) == ANIMAL_FROG && PatrolAnimal(IDEA_STONE, 0) == ANIMAL_STONE &&
|
||||
PatrolAnimal(IDEA_STONE - 1, 0) == ANIMAL_CLASSIC, "each animal opens in its own landscape")
|
||||
placed: [5]s32
|
||||
later_animals: [5]s32
|
||||
key_level: s32 = -1
|
||||
switch_level: s32 = -1
|
||||
room_level: s32 = -1
|
||||
portal_level: s32 = -1
|
||||
reached: [CELLS]bool
|
||||
for level: 0..LEVEL_COUNT - 1 {
|
||||
StartGame(*game, cast(s32)level, 0)
|
||||
placed[game.feature] += 1
|
||||
for index: 0..game.monster_count - 1 {
|
||||
if level >= IDEA_PORTAL_ROOM { later_animals[game.monsters[index].animal] += 1 }
|
||||
}
|
||||
start := Index(board_columns / 2, board_rows - 2)
|
||||
unused FloodFrom(*game, start, -1, reached[:])
|
||||
if game.feature == FEATURE_PORTALS && portal_level < 0 { portal_level = cast(s32)level }
|
||||
for pair: 0..game.portal_count - 1 {
|
||||
a := game.portals[pair].a
|
||||
b := game.portals[pair].b
|
||||
Expect(OpenAround(*game, a.x / 16, a.y / 16) && OpenAround(*game, b.x / 16, b.y / 16), "portals stand in open floor")
|
||||
Expect(!Near(game.apple, a, 12) && !Near(game.apple, b, 12), "apples never land on a portal")
|
||||
}
|
||||
if game.feature == FEATURE_KEY || game.feature == FEATURE_SWITCH {
|
||||
Expect(game.gate >= 0 && !game.gate_open && game.board[game.gate] == 20, "a gate starts closed")
|
||||
spot := ifx game.feature == FEATURE_KEY then game.key else game.switch_stone
|
||||
Expect(reached[Index(spot.x / 16, spot.y / 16)], "its key or switch lies on the entrance side")
|
||||
if game.feature == FEATURE_KEY && key_level < 0 { key_level = cast(s32)level }
|
||||
if game.feature == FEATURE_SWITCH && switch_level < 0 { switch_level = cast(s32)level }
|
||||
}
|
||||
if game.feature == FEATURE_PORTAL_ROOM {
|
||||
a := game.portals[0].a
|
||||
b := game.portals[0].b
|
||||
Expect(reached[Index(a.x / 16, a.y / 16)] && !reached[Index(b.x / 16, b.y / 16)], "a portal room is reached only through its portal")
|
||||
if room_level < 0 { room_level = cast(s32)level }
|
||||
}
|
||||
}
|
||||
print("Ideas placed: portals % keys % switches % rooms %; animals after 180: flames % squirrels % hedgehogs % frogs % stones %\n",
|
||||
placed[1], placed[2], placed[3], placed[4], later_animals[0], later_animals[1], later_animals[2], later_animals[3], later_animals[4])
|
||||
Expect(placed[FEATURE_PORTALS] >= 20 && placed[FEATURE_KEY] >= 8 && placed[FEATURE_SWITCH] >= 6 && placed[FEATURE_PORTAL_ROOM] >= 3,
|
||||
"every puzzle idea comes back in later levels")
|
||||
Expect(later_animals[1] > 0 && later_animals[2] > 0 && later_animals[3] > 0 && later_animals[4] > 0, "the last boards mix every animal")
|
||||
Expect(key_level >= 0 && switch_level >= 0 && room_level >= 0 && portal_level >= 0, "every puzzle idea is placed somewhere")
|
||||
if key_level < 0 || switch_level < 0 || portal_level < 0 { print("Gameplay failures: %\n", failures); return failures }
|
||||
// The key opens its gate for good.
|
||||
StartGame(*game, key_level, 0)
|
||||
game.apples = 3
|
||||
game.worm[0] = Point.{game.key.x, game.key.y + 4}
|
||||
game.direction = DIR_UP
|
||||
game.next_direction = DIR_UP
|
||||
Tick(*game)
|
||||
Expect(game.key.x < 0 && game.gate_open && game.board[game.gate] == game.gate_tiles[0], "the key opens its gate")
|
||||
// A switch stone flips its gate each time the head arrives on it.
|
||||
StartGame(*game, switch_level, 0)
|
||||
game.apples = 3
|
||||
stone := game.switch_stone
|
||||
game.worm[0] = Point.{stone.x, stone.y + 8}
|
||||
game.direction = DIR_UP
|
||||
game.next_direction = DIR_UP
|
||||
Tick(*game)
|
||||
Expect(game.gate_open, "a switch stone opens its gate")
|
||||
Tick(*game)
|
||||
Tick(*game)
|
||||
Tick(*game)
|
||||
Expect(game.gate_open && game.on_switch == false, "it stays open as the head moves on")
|
||||
game.worm[0] = Point.{stone.x, stone.y + 8}
|
||||
Tick(*game)
|
||||
Expect(!game.gate_open && game.board[game.gate] == 20, "arriving again closes it")
|
||||
// A head stepping into a ring comes out of its partner.
|
||||
StartGame(*game, portal_level, 0)
|
||||
portal := game.portals[0]
|
||||
game.apples = 3
|
||||
game.worm[0] = Point.{portal.a.x, portal.a.y + 4}
|
||||
game.direction = DIR_UP
|
||||
game.next_direction = DIR_UP
|
||||
Tick(*game)
|
||||
Expect(game.worm[0].x == portal.b.x && game.worm[0].y == portal.b.y, "the worm comes out of the partner ring")
|
||||
Tick(*game)
|
||||
Expect(game.worm[0].x == portal.b.x && game.worm[0].y == portal.b.y - 4 && game.death_ticks == 0, "it keeps its course out of the ring")
|
||||
// A squirrel sits between dashes; a frog hops two tiles or not at all.
|
||||
StartGame(*game, IDEA_SQUIRREL, 0)
|
||||
for index: 0..game.monster_count - 1 {
|
||||
if game.monsters[index].animal != ANIMAL_SQUIRREL { continue }
|
||||
game.monsters[index].timer = 8
|
||||
before := game.monsters[index].position
|
||||
MoveMonster(*game, cast(s32)index)
|
||||
Expect(game.monsters[index].position.x == before.x && game.monsters[index].position.y == before.y, "a squirrel sits between dashes")
|
||||
}
|
||||
// A hedgehog curls into a still ball as the worm's head comes close.
|
||||
StartGame(*game, IDEA_HEDGEHOG, 0)
|
||||
curled := false
|
||||
for index: 0..game.monster_count - 1 {
|
||||
if game.monsters[index].animal != ANIMAL_HEDGEHOG { continue }
|
||||
curled = true
|
||||
before := game.monsters[index].position
|
||||
game.worm[0] = Point.{before.x + 24, before.y}
|
||||
for tick: 0..HEDGEHOG_CURL - 2 { MoveMonster(*game, cast(s32)index) }
|
||||
Expect(game.monsters[index].timer < 0 && game.monsters[index].position.x == before.x &&
|
||||
game.monsters[index].position.y == before.y, "a hedgehog curls up and keeps still")
|
||||
game.worm[0] = Point.{-100, -100}
|
||||
for tick: 0..3 { MoveMonster(*game, cast(s32)index) }
|
||||
Expect(game.monsters[index].timer >= 0, "it uncurls once the worm has gone")
|
||||
break
|
||||
}
|
||||
Expect(curled, "the first hedgehog board has a hedgehog")
|
||||
StartGame(*game, IDEA_FROG, 0)
|
||||
for index: 0..game.monster_count - 1 {
|
||||
if game.monsters[index].animal != ANIMAL_FROG { continue }
|
||||
game.monsters[index].timer = 13
|
||||
before := game.monsters[index].position
|
||||
MoveMonster(*game, cast(s32)index)
|
||||
moved := Abs(game.monsters[index].position.x - before.x) + Abs(game.monsters[index].position.y - before.y)
|
||||
Expect(moved == 0 || moved == 32, "a frog hops two tiles")
|
||||
}
|
||||
game.lives = 1
|
||||
game.death_ticks = 1
|
||||
Tick(*game)
|
||||
@@ -118,7 +265,7 @@ main :: () -> s32 {
|
||||
|
||||
StartGame(*game, 0, 0)
|
||||
game.monster_count = 1
|
||||
game.monsters[0] = Monster.{Point.{168, 168}, 3, 1}
|
||||
game.monsters[0] = Monster.{Point.{168, 168}, 3, 1, 0, 0}
|
||||
game.board[Index(10, 10)] = 0
|
||||
MoveMonster(*game, 0)
|
||||
Expect(game.monsters[0].position.x == 169, "monster moves one pixel")
|
||||
|
||||
@@ -107,12 +107,10 @@ def main():
|
||||
assert ((title_pixels.max(axis=2) > 40).mean()) > 0.95, "title artwork is missing or black"
|
||||
# Launch from build/, as the actual desktop launcher does, then use
|
||||
# the single Play button. Q from a paused level returns to the title.
|
||||
# A desktop has a keyboard, so Play starts swipe steering without
|
||||
# asking, straight into level 1: no controls, stage or level menu.
|
||||
pointer(480, 530)
|
||||
time.sleep(0.15)
|
||||
capture("controls-choice")
|
||||
pointer(340, 428)
|
||||
assert (level_directory / "controls.dat").read_bytes() == bytes([0]), "swipe choice was not persisted"
|
||||
# The choice goes straight into level 1: no stage or level menu.
|
||||
assert not (level_directory / "controls.dat").exists(), "the desktop asked for controls"
|
||||
time.sleep(0.2)
|
||||
key("space")
|
||||
time.sleep(0.15)
|
||||
|
||||
@@ -25,7 +25,7 @@ main :: () -> s32 {
|
||||
unused File.CreateDirectory("build/progress-test-data")
|
||||
unused File.RemoveFile("build/progress-test-data/controls.dat")
|
||||
Clear()
|
||||
Expect(!Controls.Chosen(), "first play asks for controls")
|
||||
Expect(Controls.Chosen() && !Controls.Pad(), "a desktop starts with swipe steering without asking")
|
||||
Expect(Controls.SetPad(true) && Controls.Pad(), "choose direction pad")
|
||||
Controls.mode = -2
|
||||
Expect(Controls.Chosen() && Controls.Pad(), "pad survives restart")
|
||||
|
||||
@@ -26,8 +26,8 @@ try{
|
||||
const click=async(x,y)=>{await command('Input.dispatchMouseEvent',{type:'mouseMoved',x,y});await delay(80);await command('Input.dispatchMouseEvent',{type:'mousePressed',x,y,button:'left',clickCount:1});await delay(80);await command('Input.dispatchMouseEvent',{type:'mouseReleased',x,y,button:'left',clickCount:1});await delay(180);};
|
||||
await until("typeof Module!=='undefined' && Module.FS && document.getElementById('loading').hidden");await until("(()=>{try{return Module.FS.stat('/kryon-apps').mode>0}catch{return false}})()");await delay(1800);await capture('title');
|
||||
const colorful=await evaluate("(()=>{const c=document.getElementById('canvas'),p=c.getContext('2d').getImageData(0,0,c.width,c.height).data,s=new Set();for(let i=0;i<p.length;i+=80)s.add(p[i]+','+p[i+1]+','+p[i+2]);return s.size})()");if(colorful<200)throw new Error('Title artwork did not render: '+colorful);
|
||||
await click(1018,82);await delay(400);await capture('profile');await click(48,78);await delay(200);
|
||||
await click(1066,82);await delay(200);await capture('settings');await key('Escape',27);
|
||||
await click(1018,34);await delay(400);await capture('profile');await click(48,30);await delay(200);
|
||||
await click(1066,34);await delay(200);await capture('settings');await key('Escape',27);
|
||||
await key('Enter',13);await delay(200);await capture('controls');await key('1',49);await until("(()=>{try{return Module.FS.readFile('/kryon-apps/wurm/controls.dat')[0]===0}catch{return false}})()");await delay(300);await capture('level-1');
|
||||
await key('ArrowRight',39);await delay(150);await key(' ',32);await capture('playing');
|
||||
await command('Emulation.setDeviceMetricsOverride',{width:390,height:844,deviceScaleFactor:1,mobile:true});await delay(400);await capture('portrait');
|
||||
@@ -61,9 +61,9 @@ try{
|
||||
if(await gridFingerprint()===beforeScroll)throw new Error('Browser selector did not scroll under touch drag');
|
||||
if(!await evaluate("Module.FS.readFile('/kryon-apps/wurm/run.dat')[0]===57"))throw new Error('Dragging the selector started a level');
|
||||
await capture('level-selector-scrolled');
|
||||
await click(354,138);await click(90,280); // Future Pinewood shows only locks.
|
||||
await click(354,96);await click(90,238); // Future Pinewood shows only locks.
|
||||
if(!await evaluate("Module.FS.readFile('/kryon-apps/wurm/run.dat')[0]===57"))throw new Error('A locked browser level started');
|
||||
await capture('locked-levels');await click(36,138);await click(90,280);
|
||||
await capture('locked-levels');await click(36,96);await click(90,238);
|
||||
await until("JSON.stringify(Array.from(Module.FS.readFile('/kryon-apps/wurm/run.dat')))==='[40,3,0,0,0,0]'");
|
||||
if(!await evaluate("Module.FS.readFile('/kryon-apps/wurm/unlocked.dat')[0]===57"))throw new Error('Level selection erased progress');
|
||||
await key(' ',32);await key('q',81);await key('l',76);await key('Escape',27);await key('c',67);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Sign and verify both Apfelwurm Android download names, as Shovey does."""
|
||||
"""Sign and verify both Apfelwurm Android download names and the Google Play bundle, as Shovey does."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
@@ -9,6 +9,7 @@ import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import xml.etree.ElementTree as ET
|
||||
import zipfile
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
@@ -66,6 +67,47 @@ def verify(apk):
|
||||
sha256=hashlib.sha256(apk.read_bytes()).hexdigest(), certificate_sha256=expected)
|
||||
|
||||
|
||||
def verify_bundle(bundle, bundletool):
|
||||
version = json.loads((ROOT / 'version.json').read_text())
|
||||
subprocess.run(['java', '-jar', str(bundletool), 'validate', '--bundle=' + str(bundle)],
|
||||
check=True, stdout=subprocess.DEVNULL)
|
||||
manifest = ET.fromstring(subprocess.check_output(['java', '-jar', str(bundletool), 'dump', 'manifest',
|
||||
'--bundle=' + str(bundle)], text=True))
|
||||
android = '{http://schemas.android.com/apk/res/android}'
|
||||
assert manifest.get('package') == 'xyz.waozi.wurm'
|
||||
assert manifest.get(android + 'versionName') == version['version']
|
||||
assert int(manifest.get(android + 'versionCode')) == version['version_code']
|
||||
assert int(manifest.find('uses-sdk').get(android + 'targetSdkVersion')) >= 35, 'Google Play needs a current target SDK'
|
||||
assert manifest.find('application').get(android + 'debuggable') != 'true', 'A debug bundle cannot be released'
|
||||
environment = dict(os.environ, LC_ALL='C')
|
||||
assert 'jar verified.' in subprocess.check_output(['jarsigner', '-verify', str(bundle)], text=True, env=environment)
|
||||
certificate = subprocess.check_output(['openssl', 'x509', '-in', str(ROOT / 'packaging/android/certificate.pem'), '-outform', 'DER'])
|
||||
expected = hashlib.sha256(certificate).hexdigest()
|
||||
found = re.findall(r'SHA256:\s*([A-Fa-f0-9:]+)', subprocess.check_output(
|
||||
['keytool', '-printcert', '-jarfile', str(bundle)], text=True, env=environment))
|
||||
assert found and {item.replace(':', '').lower() for item in found} == {expected}, 'Unexpected upload certificate'
|
||||
with zipfile.ZipFile(bundle) as archive:
|
||||
abis = sorted({name.split('/')[2] for name in archive.namelist() if re.fullmatch(r'base/lib/[^/]+/libmain\.so', name)})
|
||||
assert abis == ['arm64-v8a', 'armeabi-v7a'], 'Both ARM architectures are required'
|
||||
with tempfile.TemporaryDirectory(dir=ROOT / 'build') as directory:
|
||||
for name in archive.namelist():
|
||||
if not name.startswith('base/lib/arm64-v8a/') or not name.endswith('.so'):
|
||||
continue
|
||||
library = Path(directory) / Path(name).name
|
||||
library.write_bytes(archive.read(name))
|
||||
headers = subprocess.check_output(['readelf', '-lW', str(library)], text=True)
|
||||
loads = [line.split() for line in headers.splitlines() if line.strip().startswith('LOAD ')]
|
||||
assert loads and all(int(parts[-1], 16) >= 16384 for parts in loads), 'Native libraries require 16 KB load alignment'
|
||||
for name in ('title.png', 'title-portrait.png', 'stage-covers.png'):
|
||||
assert archive.read('base/assets/assets/art/' + name) == (ROOT / 'assets/art' / name).read_bytes(), name
|
||||
assert not any(name.startswith('base/assets/assets/campaign-levels/') for name in archive.namelist()), 'Personal campaign edits must stay private'
|
||||
assert archive.read('base/assets/assets/entity.zx') == (ROOT / 'build/profile/entity.zx').read_bytes(), 'The shared Profile must be packaged'
|
||||
dex = b''.join(archive.read(name) for name in archive.namelist() if name.startswith('base/dex/'))
|
||||
assert b'Lorg/kryonlabs/play/PlayBilling;' in dex, 'The Google Play edition must include Play Billing'
|
||||
return dict(version=version['version'], version_code=version['version_code'], package='xyz.waozi.wurm', abis=abis,
|
||||
sha256=hashlib.sha256(bundle.read_bytes()).hexdigest(), certificate_sha256=expected)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('action', choices=('sign', 'verify'))
|
||||
@@ -73,7 +115,32 @@ def main():
|
||||
parser.add_argument('--keystore', type=Path, default=ROOT / 'backup/android-signing/wurm-release.p12')
|
||||
parser.add_argument('--password-file', type=Path, default=ROOT / 'backup/android-signing/password')
|
||||
parser.add_argument('--output', type=Path, default=ROOT / 'build/downloads')
|
||||
parser.add_argument('--bundletool', type=Path, help='Google bundletool JAR, required for .aab files')
|
||||
args = parser.parse_args()
|
||||
if args.apk.suffix == '.aab':
|
||||
assert args.bundletool, '--bundletool is required for a Google Play bundle'
|
||||
bundle = args.apk.resolve(strict=True)
|
||||
if args.action == 'sign':
|
||||
args.output.mkdir(parents=True, exist_ok=True)
|
||||
version = json.loads((ROOT / 'version.json').read_text())['version']
|
||||
bundle = args.output / f'wurm-v{version}-gplay.aab'
|
||||
temporary = args.output / 'wurm.new.aab'
|
||||
try:
|
||||
subprocess.run(['jarsigner', '-keystore', str(args.keystore.resolve(strict=True)),
|
||||
'-storepass:file', str(args.password_file.resolve(strict=True)),
|
||||
'-signedjar', str(temporary), str(args.apk.resolve(strict=True)), 'wurm'], check=True)
|
||||
result = verify_bundle(temporary, args.bundletool.resolve(strict=True))
|
||||
temporary.replace(bundle)
|
||||
finally:
|
||||
temporary.unlink(missing_ok=True)
|
||||
else:
|
||||
result = verify_bundle(bundle, args.bundletool.resolve(strict=True))
|
||||
records = ROOT / 'backup/android-release'
|
||||
records.mkdir(parents=True, exist_ok=True)
|
||||
(records / 'play-verification.json').write_text(json.dumps(result, indent=2) + '\n')
|
||||
print(f'Apfelwurm {result["version"]} ({result["version_code"]}): Google Play bundle identity, version, '
|
||||
'both ARM architectures, upload signature, alignment and current assets verified.')
|
||||
return
|
||||
if args.action == 'verify':
|
||||
verify(args.apk)
|
||||
else:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build Apfelwurm's native debug APK, including its art, scores and levels."""
|
||||
"""Build Apfelwurm's native APK or Google Play bundle, including its art, scores and levels."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
@@ -23,6 +23,8 @@ def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--abi', choices=('arm64-v8a', 'armeabi-v7a', 'universal'), default='arm64-v8a')
|
||||
parser.add_argument('--release', action='store_true', help='build the unsigned production APK for signing')
|
||||
parser.add_argument('--bundle', action='store_true',
|
||||
help="build the unsigned Google Play edition's App Bundle for signing")
|
||||
parser.add_argument('--verification', action='store_true',
|
||||
help='build a separate test install without replacing the normal game')
|
||||
args = parser.parse_args()
|
||||
@@ -56,8 +58,8 @@ def main():
|
||||
# The account provider uses the same native cryptography on both ABIs.
|
||||
# These changes belong to this app's generated scaffold, never Kryon's.
|
||||
cmake = ROOT / 'droid/app/src/main/cpp/CMakeLists.txt'
|
||||
text = cmake.read_text().replace('set(APP_ZIRAN_DEFINES --define ANDROID_BUILD)',
|
||||
'set(APP_ZIRAN_DEFINES --define ANDROID_BUILD --define WURM_ACCOUNTS)')
|
||||
text = re.sub(r'set\(APP_ZIRAN_DEFINES --define ANDROID_BUILD[^)]*\)',
|
||||
'set(APP_ZIRAN_DEFINES --define ANDROID_BUILD --define WURM_ACCOUNTS)', cmake.read_text(), count=1)
|
||||
text = text.split('\n# Apfelwurm account libraries\n')[0]
|
||||
text += f'''
|
||||
# Apfelwurm account libraries
|
||||
@@ -95,14 +97,23 @@ target_link_libraries(main oqs)
|
||||
aapt = sdk / 'build-tools/36.0.0/aapt2'
|
||||
assert aapt.exists(), 'Install Android build-tools 36.0.0'
|
||||
abis = 'arm64-v8a,armeabi-v7a' if args.abi == 'universal' else args.abi
|
||||
task = 'assembleRelease' if args.release else 'assembleDebug'
|
||||
task = 'bundleRelease' if args.bundle else 'assembleRelease' if args.release else 'assembleDebug'
|
||||
command = ['sh', 'droid/gradlew', '-p', 'droid', '--no-daemon', '--max-workers=1', task,
|
||||
'-Pkryon.dir=' + str(kryon), '-Pziran.dir=' + str(ziran), '-Praylib.dir=' + str(raylib / 'src'),
|
||||
'-Papp.abis=' + abis, '-Papp.minSdk=21', '-Papp.codegen=c99',
|
||||
'-Pandroid.aapt2FromMavenOverride=' + str(aapt)]
|
||||
# Kryon's Google Play edition adds Play Billing, so Dew is bought through Play.
|
||||
if args.bundle:
|
||||
command += ['-Papp.edition=gplay', '-Pandroid.useAndroidX=true']
|
||||
install_id = 'xyz.waozi.wurm.verification' if args.verification else 'xyz.waozi.wurm'
|
||||
command.append('-Papp.installId=' + install_id)
|
||||
subprocess.run(command, cwd=ROOT, env=environment, check=True)
|
||||
if args.bundle:
|
||||
target = ROOT / 'build/android/Apfelwurm-release-unsigned.aab'
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(ROOT / 'droid/app/build/outputs/bundle/release/app-release.aab', target)
|
||||
print('Built ' + str(target))
|
||||
return
|
||||
label = 'Apfelwurm-verification-' if args.verification else 'Apfelwurm-'
|
||||
variant = 'release' if args.release else 'debug'
|
||||
suffix = '-release-unsigned.apk' if args.release else '-debug.apk'
|
||||
|
||||
@@ -43,13 +43,15 @@ def main():
|
||||
subprocess.run([str(compiler / 'build/bin/zi2c'), '--define', 'PLATFORM_WEB', '--root', str(ir),
|
||||
'-o', str(code), *map(str, ir.glob('*.zir'))], cwd=ROOT, env=env, check=True)
|
||||
art = OUT / 'assets/art'
|
||||
# Legacy cover studies are not used by the game. Keep the browser preload
|
||||
# Legacy cover studies and the old level previews (the game shows
|
||||
# campaign-previews) are not used by the game. Keep the browser preload
|
||||
# below Pages' per-file limit without changing the published artwork.
|
||||
unused_art = ('*.argb', 'garden-cover.png', 'space-cover.png', 'factory-cover.png', 'stage-covers.png')
|
||||
shutil.copytree(ROOT / 'assets/art', art, dirs_exist_ok=True,
|
||||
ignore=shutil.ignore_patterns(*unused_art))
|
||||
ignore=shutil.ignore_patterns(*unused_art, 'previews'))
|
||||
for name in unused_art[1:]:
|
||||
(art / name).unlink(missing_ok=True)
|
||||
shutil.rmtree(art / 'previews', ignore_errors=True)
|
||||
emcc = (env.get('EMCC') or shutil.which('emcc', path=env.get('PATH'))
|
||||
or str(Path.home() / 'emsdk/upstream/emscripten/emcc'))
|
||||
subprocess.run([emcc, '-O2', '-Wno-parentheses-equality', '-I' + str(compiler / 'include'),
|
||||
@@ -76,6 +78,12 @@ def main():
|
||||
for source in (ROOT / 'src/web').iterdir():
|
||||
if source.is_file():
|
||||
shutil.copy2(source, OUT / source.name)
|
||||
# The page shows the title art while the game loads and in link previews.
|
||||
# Small copies keep that first paint fast; the game keeps the original.
|
||||
from PIL import Image
|
||||
title = Image.open(ROOT / 'assets/art/title.png').convert('RGB')
|
||||
title.resize((1280, 853), Image.Resampling.LANCZOS).save(OUT / 'loading.webp', 'WEBP', quality=86, method=6)
|
||||
title.resize((1200, 800), Image.Resampling.LANCZOS).save(OUT / 'social.jpg', 'JPEG', quality=88, optimize=True, progressive=True)
|
||||
version = json.loads((ROOT / 'version.json').read_text())['version']
|
||||
revision = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=ROOT, text=True).strip()
|
||||
(OUT / 'version.json').write_text(json.dumps({'version': version, 'revision': revision,
|
||||
|
||||
@@ -139,11 +139,18 @@ def main():
|
||||
# keep the previous campaign and its cached art while development runs.
|
||||
fire = cells(SOURCE / 'fire.png', 2, 2)
|
||||
assert Image.open(SOURCE / 'fire.png').getchannel('A').getextrema()[0] == 0
|
||||
# Row four: squirrel, hedgehog, frog and rolling stone frames, then the
|
||||
# key, the switch stone off and on, and the gate across and down.
|
||||
creatures = cells(SOURCE / 'journey-creatures.png', 4, 3)
|
||||
assert Image.open(SOURCE / 'journey-creatures.png').getchannel('A').getextrema()[0] == 0
|
||||
creatures.append(creatures[11].rotate(90))
|
||||
for row, (stage, _, _) in enumerate(STAGES):
|
||||
sheet = journey_sheet(base, journey[row * 4:row * 4 + 4])
|
||||
sheet.paste(fire[0], (0, 2 * CELL))
|
||||
for frame, image in enumerate(fire):
|
||||
sheet.paste(image, ((6 + frame) * CELL, 2 * CELL))
|
||||
for column, image in enumerate(creatures):
|
||||
sheet.paste(image, (column * CELL, 4 * CELL))
|
||||
save(sheet, ART / ('campaign-' + stage + '.png'), args.check)
|
||||
covers = Image.open(SOURCE / 'stage-covers.png').convert('RGBA').resize((960, 1600), Image.Resampling.LANCZOS)
|
||||
save(covers, ART / 'stage-covers.png', args.check)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"version": "0.2.2",
|
||||
"version_code": 12
|
||||
"version": "0.2.8",
|
||||
"version_code": 18
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
"packages": [
|
||||
{
|
||||
"commit": "dc1cfe389905c63c0bb453727d06d72afc1fa0b0",
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p3127065409ca96f6"},
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p974af619ca377b85"},
|
||||
"id": "p00b93f1ddcd2802f",
|
||||
"name": "Apps",
|
||||
"ref": "master",
|
||||
@@ -17,14 +17,6 @@
|
||||
"ref": "master",
|
||||
"url": "https://github.com/ziranlang/qrcode.git"
|
||||
},
|
||||
{
|
||||
"commit": "0931212f92d5f1a3f8b1be80abab7a9695bda50e",
|
||||
"dependencies": {"raylib": "p5a77c9c35110e925"},
|
||||
"id": "p3127065409ca96f6",
|
||||
"name": "kryon",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
},
|
||||
{
|
||||
"commit": "e1f480f382d9443c4412133b55948374c77a5c21",
|
||||
"dependencies": {},
|
||||
@@ -34,14 +26,6 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/open-quantum-safe/liboqs.git"
|
||||
},
|
||||
{
|
||||
"commit": "ca637d08b0d6b54ab6bb56bbfd9a25d7fb70f56c",
|
||||
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p3127065409ca96f6", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
|
||||
"id": "p52862c0351d05875",
|
||||
"name": "Entity",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/waozixyz/entity.git"
|
||||
},
|
||||
{
|
||||
"commit": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e",
|
||||
"dependencies": {},
|
||||
@@ -68,6 +52,14 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/LoupVaillant/Monocypher.git"
|
||||
},
|
||||
{
|
||||
"commit": "3fad22341997f7c58ed1b11b1e88217358e51af5",
|
||||
"dependencies": {"raylib": "p5a77c9c35110e925"},
|
||||
"id": "p974af619ca377b85",
|
||||
"name": "kryon",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
},
|
||||
{
|
||||
"commit": "25d9f649c43a8de44a5fea602d2835e33e6ca999",
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "oqs": "p7098ac9cd92f7e5f"},
|
||||
@@ -76,6 +68,14 @@
|
||||
"ref": "master",
|
||||
"url": "https://github.com/ziranlang/daochi-client.git"
|
||||
},
|
||||
{
|
||||
"commit": "dc4946f0be5c15c15f79bd7cd69df8222e6c1b0d",
|
||||
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p974af619ca377b85", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
|
||||
"id": "pa3f5fd1ab5a1f780",
|
||||
"name": "Entity",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/waozixyz/entity.git"
|
||||
},
|
||||
{
|
||||
"commit": "944826f70779a6b6cd53f6b06a75b36f4d8a2558",
|
||||
"dependencies": {},
|
||||
@@ -94,11 +94,11 @@
|
||||
}
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {"apps": "p00b93f1ddcd2802f", "entity": "p52862c0351d05875", "kryon": "p3127065409ca96f6", "mingcute": "pe1027b9d16704793"},
|
||||
"dependencies": {"apps": "p00b93f1ddcd2802f", "entity": "pa3f5fd1ab5a1f780", "kryon": "p974af619ca377b85", "mingcute": "pe1027b9d16704793"},
|
||||
"name": "Apfelwurm"
|
||||
},
|
||||
"toolchain": {
|
||||
"commit": "79ad8431baaa8d3c948ade12909fe721c551e217",
|
||||
"commit": "7c883e8458f9a728ff390d40e9c8b094a2683bab",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/ziranlang/ziran.git"
|
||||
}
|
||||
|
||||