Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af296359a1 | ||
|
|
d3f0a52556 | ||
|
|
30b84c5144 | ||
|
|
06da4cd505 | ||
|
|
2ccacdea5b | ||
|
|
cd565b99e1 |
No files matched your search
@@ -1,5 +1,14 @@
|
||||
# Changelog
|
||||
|
||||
## [0.2.26] - 2026-10-29
|
||||
|
||||
- The new skins have calmer, plainer bodies.
|
||||
|
||||
## [0.2.25] - 2026-10-29
|
||||
|
||||
- Mint, Berry, Rose, Night owl, Golden apple and Explorer have new hand-painted looks; skins you own stay yours.
|
||||
- Runs in the newest Inner Breeze.
|
||||
|
||||
## [0.2.24] - 2026-10-29
|
||||
|
||||
- Keep the entrance area free of enemies: none start there or wander in, so nothing vanishes when you lose a life.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 654 KiB |
+1
-1
@@ -5,7 +5,7 @@
|
||||
"kind": "game",
|
||||
"contract_version": 1,
|
||||
"module_api": 2,
|
||||
"host_api": 12,
|
||||
"host_api": 41,
|
||||
"save_schema": 1,
|
||||
"build_defines": ["WURM_PORTABLE"],
|
||||
"prepare_assets": "tools/portable_assets.py",
|
||||
|
||||
+27
-59
@@ -47,7 +47,6 @@ StarIcon :: #import "mingcute/mingcute_filled_star";
|
||||
ProfileIcon :: #import "mingcute/mingcute_regular_user_4";
|
||||
DewIcon :: #import "mingcute/mingcute_filled_drop";
|
||||
LockIcon :: #import "mingcute/mingcute_filled_lock";
|
||||
MoonIcon :: #import "mingcute/mingcute_filled_moon";
|
||||
Input :: #import "kryon/input_protocol";
|
||||
#if #defined(WURM_PORTABLE) {
|
||||
Timer :: #import "portable_runtime";
|
||||
@@ -409,20 +408,11 @@ SkinName :: (id: s32) -> string {
|
||||
if id == 8 { return "Winter cheer" }
|
||||
return "Apfelwurm"
|
||||
}
|
||||
SkinColor :: (id: s32) -> Color {
|
||||
if id == 1 { return Color.{94, 192, 151, 255} }
|
||||
if id == 2 { return Color.{154, 119, 207, 255} }
|
||||
if id == 3 { return Color.{221, 133, 151, 255} }
|
||||
if id == 4 { return Color.{107, 139, 199, 255} }
|
||||
if id == 5 { return Color.{227, 185, 80, 255} }
|
||||
if id == 6 { return Color.{135, 173, 91, 255} }
|
||||
return Color.{236, 151, 67, 255}
|
||||
}
|
||||
CharacterPreview :: (session: Session, key: u64, bounds: Rectangle, id: s32) {
|
||||
for segment: 0..2 {
|
||||
special := id == 7 || id == 8
|
||||
size := (ifx special then 27.0 else 21.0) + cast(float32)segment * 4.0
|
||||
x := bounds.x + cast(float32)segment * (ifx special then 12.0 else 16.0)
|
||||
painted := id != 0
|
||||
size := (ifx painted then 27.0 else 21.0) + cast(float32)segment * 4.0
|
||||
x := bounds.x + cast(float32)segment * (ifx painted then 12.0 else 16.0)
|
||||
y := bounds.y + 22.0 - cast(float32)segment * 5.0
|
||||
Character(session, key + cast(u64)segment * 8, Rectangle.{x, y, size, size}, id, false)
|
||||
}
|
||||
@@ -435,58 +425,36 @@ Character :: (session: Session, key: u64, bounds: Rectangle, id: s32, head: bool
|
||||
Rectangle.{cast(float32)column * 16.0, 48.0, 16.0, 16.0}, alpha)
|
||||
return
|
||||
}
|
||||
// Every other skin is painted: a head facing right and a round body
|
||||
// segment. Skins 1-6 share skins.png in 180px cells, one row each; the
|
||||
// two specials keep their own sheet.
|
||||
path := "assets/art/skins.png"
|
||||
source := Rectangle.{ifx head then 0.0 else 180.0, cast(float32)(id - 1) * 180.0, 180.0, 180.0}
|
||||
if id == 7 || id == 8 {
|
||||
column := ifx id == 7 then 0 else 2
|
||||
if !head { column += 1 }
|
||||
crops: [4]Rectangle = .[Rectangle.{47.0, 81.0, 496.0, 627.0}, Rectangle.{543.0, 15.0, 543.0, 709.0},
|
||||
Rectangle.{1086.0, 87.0, 524.0, 617.0}, Rectangle.{1638.0, 6.0, 498.0, 718.0}]
|
||||
source := crops[column]
|
||||
height := bounds.height
|
||||
width := height * source.width / source.height
|
||||
if width > bounds.width { width = bounds.width; height = width * source.height / source.width }
|
||||
cx := bounds.x + bounds.width / 2.0
|
||||
cy := bounds.y + bounds.height / 2.0
|
||||
corners: [4]Vector2
|
||||
for corner: 0..3 {
|
||||
dx := (ifx corner % 2 == 0 then -width else width) / 2.0
|
||||
dy := (ifx corner < 2 then -height else height) / 2.0
|
||||
if head && direction == 0 { dx = -dx; dy = -dy }
|
||||
else if head && direction == 1 { previous := dx; dx = dy; dy = -previous }
|
||||
else if head && direction == 3 { previous := dx; dx = -dy; dy = previous }
|
||||
corners[corner] = Vector2.{cx + dx, cy + dy}
|
||||
}
|
||||
unused Image(session, ImageProps.{.key = key, .asset_path = "assets/art/special-skins.png",
|
||||
.bounds = bounds, .source = source, .mesh = ImageMesh.{2, 2, corners[:]},
|
||||
.tint = cast(u32)0xffffff00 | cast(u32)alpha, .smooth = true, .alt_text = Locale.Text(SkinName(id))})
|
||||
return
|
||||
path = "assets/art/special-skins.png"
|
||||
source = crops[column]
|
||||
}
|
||||
size := bounds.width
|
||||
if bounds.height < size { size = bounds.height }
|
||||
color := SkinColor(id)
|
||||
color.a = alpha
|
||||
unused Box(session, BoxProps.{.key = key, .bounds = bounds, .fill = color, .radius = size / 2.0,
|
||||
.border = Color.{30, 48, 35, cast(u8)(cast(s32)alpha * 100 / 255)}})
|
||||
if !head { return }
|
||||
dx: float32 = ifx direction == 0 then -1.0 else ifx direction == 2 then 1.0 else 0.0
|
||||
dy: float32 = ifx direction == 1 then -1.0 else ifx direction == 3 then 1.0 else 0.0
|
||||
cx := bounds.x + bounds.width / 2.0 + dx * size * 0.14
|
||||
cy := bounds.y + bounds.height / 2.0 + dy * size * 0.14
|
||||
eye := size * 0.18
|
||||
for side: 0..1 {
|
||||
sign: float32 = ifx side == 0 then -1.0 else 1.0
|
||||
x := cx - dy * size * 0.2 * sign - eye / 2.0
|
||||
y := cy + dx * size * 0.2 * sign - eye / 2.0
|
||||
unused Box(session, BoxProps.{.key = key + 1 + cast(u64)side, .bounds = Rectangle.{x, y, eye, eye},
|
||||
.fill = Color.{246, 244, 223, alpha}, .radius = eye / 2.0})
|
||||
unused Box(session, BoxProps.{.key = key + 3 + cast(u64)side,
|
||||
.bounds = Rectangle.{x + eye * 0.3, y + eye * 0.3, eye * 0.5, eye * 0.5},
|
||||
.fill = Color.{28, 44, 35, alpha}, .radius = eye / 2.0})
|
||||
}
|
||||
if id >= 4 {
|
||||
shape := ifx id == 4 then MoonIcon.Shape else ifx id == 5 then StarIcon.Shape else "S2rr:M3 19L9 5L15 15L18 10L22 19Z"
|
||||
SvgIcon(session, SvgIconProps.{.bounds = Rectangle.{bounds.x + size * 0.3, bounds.y - size * 0.18, size * 0.4, size * 0.4},
|
||||
.shape = shape, .color = Color.{249, 229, 157, alpha}})
|
||||
height := bounds.height
|
||||
width := height * source.width / source.height
|
||||
if width > bounds.width { width = bounds.width; height = width * source.height / source.width }
|
||||
cx := bounds.x + bounds.width / 2.0
|
||||
cy := bounds.y + bounds.height / 2.0
|
||||
corners: [4]Vector2
|
||||
for corner: 0..3 {
|
||||
dx := (ifx corner % 2 == 0 then -width else width) / 2.0
|
||||
dy := (ifx corner < 2 then -height else height) / 2.0
|
||||
if head && direction == 0 { dx = -dx; dy = -dy }
|
||||
else if head && direction == 1 { previous := dx; dx = dy; dy = -previous }
|
||||
else if head && direction == 3 { previous := dx; dx = -dy; dy = previous }
|
||||
corners[corner] = Vector2.{cx + dx, cy + dy}
|
||||
}
|
||||
unused Image(session, ImageProps.{.key = key, .asset_path = path,
|
||||
.bounds = bounds, .source = source, .mesh = ImageMesh.{2, 2, corners[:]},
|
||||
.tint = cast(u32)0xffffff00 | cast(u32)alpha, .smooth = true, .alt_text = Locale.Text(SkinName(id))})
|
||||
}
|
||||
shop_scroll: s32;
|
||||
buy_skin: s32;
|
||||
@@ -898,7 +866,7 @@ DrawBoard :: (session: Session, stage: Rectangle) {
|
||||
// tail first leaves the larger face cleanly above the neck.
|
||||
fade: float32 = ifx game.death_ticks > 0 then cast(float32)game.death_ticks / 20.0 else 1.0
|
||||
alpha := cast(u8)(255.0 * fade * fade * (3.0 - 2.0 * fade))
|
||||
draw_step: s32 = ifx Wardrobe.skin == 7 || Wardrobe.skin == 8 then 2 else WORM_DRAW_STEP
|
||||
draw_step: s32 = ifx Wardrobe.skin != 0 then 2 else WORM_DRAW_STEP
|
||||
index := game.length - 1
|
||||
while index > 0 {
|
||||
column := 4
|
||||
|
||||
@@ -16,13 +16,11 @@
|
||||
File :: #import "std/file_linux";
|
||||
}
|
||||
Originals :: #import, file "original_levels.zi";
|
||||
#import "std/c_string"
|
||||
#import "std/number_text"
|
||||
#import "std/text_buffer"
|
||||
|
||||
#if !#defined(WURM_PORTABLE) {
|
||||
libc :: #system_library "libc";
|
||||
GetEnvironment :: (name: *u8) -> *u8 #foreign libc "getenv";
|
||||
#import "std/environment_linux"
|
||||
}
|
||||
|
||||
LEVEL_FILE_BYTES :: 1201;
|
||||
@@ -72,12 +70,10 @@ CustomSetRoot :: (path: string) -> bool {
|
||||
|
||||
ApplyEnvironmentRoot :: () {
|
||||
#if !#defined(WURM_PORTABLE) {
|
||||
name: [32]u8
|
||||
if !CopyCString("WURM_LEVEL_DIR", name[:]) { return }
|
||||
value := GetEnvironment(*name[0])
|
||||
if value == null { return }
|
||||
value := EnvironmentText("WURM_LEVEL_DIR")
|
||||
if value == "" { return }
|
||||
length: s32 = 0
|
||||
while value[length] != 0 && length < custom_root.count - 1 {
|
||||
while length < value.count && length < custom_root.count - 1 {
|
||||
custom_root[length] = value[length]
|
||||
length += 1
|
||||
}
|
||||
|
||||
+23
-118
@@ -1,134 +1,39 @@
|
||||
// The desktop entry. Kryon's default host opens a fixed 960x600 window;
|
||||
// this one sizes the window from WURM_WINDOW=WxH (default 1280x760) so the
|
||||
// mobile-first layout can be checked in landscape and portrait. The frame
|
||||
// loop mirrors the default host: poll, feed the session, draw one frame.
|
||||
#import "std/c_string"
|
||||
#import "kryon/Desktop"
|
||||
#import "kryon/session"
|
||||
#import "kryon/tree"
|
||||
#import "kryon/tree_input"
|
||||
#import "kryon/Frame"
|
||||
#import "kryon/TestDriver"
|
||||
File :: #import "std/file_linux";
|
||||
// The desktop entry. It runs Kryon's desktop loop in a 1280x760 window, or
|
||||
// the size WURM_WINDOW=WxH gives, so the mobile-first layout can be checked
|
||||
// in landscape and portrait.
|
||||
#import "kryon/desktop_loop"
|
||||
#import "std/environment_linux"
|
||||
#import "std/number_text"
|
||||
App :: #import "app";
|
||||
|
||||
libc :: #system_library "libc";
|
||||
GetEnvironment :: (name: *u8) -> *u8 #foreign libc "getenv";
|
||||
ParseNumber :: (text: *u8) -> s32 #foreign libc "atoi";
|
||||
ChangeDirectory :: (path: *u8) -> s32 #foreign libc "chdir";
|
||||
ReadExecutableLink :: (path: *u8, output: *u8, capacity: u64) -> s64 #foreign libc "readlink";
|
||||
|
||||
// A direct desktop launch starts beside the executable in build/. Resolve
|
||||
// its asset root before any image, sound or saved level is opened.
|
||||
FindAssets :: () -> bool {
|
||||
if File.PathExists("assets/art/title.png") { return true }
|
||||
link: [32]u8
|
||||
path: [4096]u8
|
||||
if !CopyCString("/proc/self/exe", link[:]) { return false }
|
||||
count := ReadExecutableLink(*link[0], *path[0], 4095)
|
||||
if count <= 0 { return false }
|
||||
index := cast(s32)count - 1
|
||||
while index > 0 && path[index] != #char "/" { index -= 1 }
|
||||
if index <= 0 { return false }
|
||||
path[index] = 0
|
||||
if ChangeDirectory(*path[0]) != 0 { return false }
|
||||
if File.PathExists("assets/art/title.png") { return true }
|
||||
for parent: 0..2 {
|
||||
if !CopyCString("..", link[:]) || ChangeDirectory(*link[0]) != 0 { return false }
|
||||
if File.PathExists("assets/art/title.png") { return true }
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
window_width: s32;
|
||||
window_height: s32;
|
||||
|
||||
WindowSize :: () {
|
||||
window_width = 1280
|
||||
window_height = 760
|
||||
name: [32]u8
|
||||
if !CopyCString("WURM_WINDOW", name[:]) { return }
|
||||
value := GetEnvironment(*name[0])
|
||||
if value == null { return }
|
||||
width := ParseNumber(value)
|
||||
if width < 240 { return }
|
||||
index: s32 = 0
|
||||
while value[index] != 0 && value[index] != 120 && index < 15 { index += 1 }
|
||||
if value[index] != 120 { return }
|
||||
height := ParseNumber(*value[index + 1])
|
||||
if height < 240 { return }
|
||||
window_width = width
|
||||
window_height = height
|
||||
// The window size WURM_WINDOW asks for, when both sides are at least 240.
|
||||
WindowSize :: () -> (width: s32, height: s32) {
|
||||
text := EnvironmentText("WURM_WINDOW")
|
||||
width, count := IntegerPrefix(text)
|
||||
if count == 0 || width < 240 || count >= cast(s64)text.count || text[count] != #char "x" { return 1280, 760 }
|
||||
height, digits := IntegerPrefix(text[count + 1:text.count])
|
||||
if digits == 0 || height < 240 { return 1280, 760 }
|
||||
return cast(s32)width, cast(s32)height
|
||||
}
|
||||
|
||||
// WURM_START=editor opens straight into the level editor, optionally at
|
||||
// WURM_LEVEL=n (1-based), instead of the stage screen.
|
||||
StartScreen :: () {
|
||||
name: [32]u8
|
||||
if !CopyCString("WURM_START", name[:]) { return }
|
||||
value := GetEnvironment(*name[0])
|
||||
if value == null { return }
|
||||
editor: bool
|
||||
for index: 0..5 {
|
||||
editor = value[index] == #char "e" || value[index] == #char "E"
|
||||
if editor { break }
|
||||
}
|
||||
if !editor { return }
|
||||
level: s32 = 0
|
||||
if CopyCString("WURM_LEVEL", name[:]) {
|
||||
number := GetEnvironment(*name[0])
|
||||
if number != null && ParseNumber(number) > 1 { level = ParseNumber(number) - 1 }
|
||||
}
|
||||
App.EditorAtStartup(level)
|
||||
}
|
||||
|
||||
DrawFrame :: (session: Session) -> bool {
|
||||
BeginDesktopFrame()
|
||||
viewport := DesktopViewport()
|
||||
pointer := TestDriverPointer(session, PollPointer())
|
||||
TreePointerUpdate(session, pointer)
|
||||
TreeSecondaryPointerUpdate(session, PollSecondaryPointer())
|
||||
wheel := TestDriverWheel(DesktopWheelMove())
|
||||
PointerWheelSend(session, pointer.x, pointer.y, wheel)
|
||||
if cast(s32)BeginFrame(session, 1, viewport) != 0 { return false }
|
||||
if App.Frame(session, viewport) != 0 {
|
||||
TreeCancel(session)
|
||||
return false
|
||||
}
|
||||
if cast(s32)EndFrame(session) != 0 { return false }
|
||||
TestDriverFrame(session)
|
||||
unused DesktopCursor(session)
|
||||
return EndDesktopFrame()
|
||||
start := EnvironmentText("WURM_START")
|
||||
if start.count == 0 || (start[0] != #char "e" && start[0] != #char "E") { return }
|
||||
level := EnvironmentNumber("WURM_LEVEL", 1) - 1
|
||||
if level < 0 { level = 0 }
|
||||
App.EditorAtStartup(cast(s32)level)
|
||||
}
|
||||
|
||||
#program_export
|
||||
main :: () -> s32 {
|
||||
if !FindAssets() {
|
||||
// A direct launch starts beside the executable in build/.
|
||||
if !DesktopStartBeside("assets/art/title.png") {
|
||||
print("Apfelwurm could not find assets/art/title.png beside the game or its parent directory.\n")
|
||||
return 1
|
||||
}
|
||||
WindowSize()
|
||||
if !OpenDesktopSized(window_width, window_height) {
|
||||
CloseDesktop()
|
||||
return 1
|
||||
}
|
||||
defer { CloseDesktop() }
|
||||
session := SessionOpen()
|
||||
if !SessionValid(session) { return 1 }
|
||||
defer { CloseSession(session) }
|
||||
StartScreen()
|
||||
ok := true
|
||||
while ok && PollDesktop() {
|
||||
KeyboardModifiersSend(session, DesktopModifiers())
|
||||
key := DesktopPressedKey()
|
||||
if key != 0 { KeyboardSend(session, key) }
|
||||
codepoint := DesktopTypedCodepoint()
|
||||
while codepoint != 0 {
|
||||
TypedCodepointSend(session, codepoint)
|
||||
codepoint = DesktopTypedCodepoint()
|
||||
}
|
||||
ok = DrawFrame(session)
|
||||
if ok { PauseDesktop() }
|
||||
}
|
||||
return ifx ok then 0 else 1
|
||||
width, height := WindowSize()
|
||||
return RunDesktop(width, height)
|
||||
}
|
||||
+3
-8
@@ -3,10 +3,7 @@
|
||||
#if #defined(PLATFORM_WEB) {
|
||||
#import "std/web"
|
||||
} else #if !#defined(WURM_PORTABLE) {
|
||||
#import "std/c_string"
|
||||
#import "std/byte_text_linux"
|
||||
libc :: #system_library "libc";
|
||||
LocaleEnvironment :: (name: *u8) -> *u8 #foreign libc "getenv";
|
||||
#import "std/environment_linux"
|
||||
}
|
||||
language: [3]u8;
|
||||
ready: bool;
|
||||
@@ -25,10 +22,8 @@ Detect :: () {
|
||||
SetLanguage(TextUntilNul(bytes[:]))
|
||||
WebEnd(scope)
|
||||
} else #if !#defined(WURM_PORTABLE) {
|
||||
key: [16]u8
|
||||
unused CopyCString("LANG", key[:])
|
||||
value := LocaleEnvironment(*key[0])
|
||||
if value != null { SetLanguage(TextFromCString(value)) }
|
||||
value := EnvironmentText("LANG")
|
||||
if value != "" { SetLanguage(value) }
|
||||
}
|
||||
}
|
||||
Text :: (source: string) -> string {
|
||||
|
||||
@@ -5,7 +5,6 @@ using UI :: #import "kryon/Widgets";
|
||||
#import "kryon/tree"
|
||||
#import "kryon/tree_input"
|
||||
#import "kryon/Frame"
|
||||
#import "std/c_string"
|
||||
Timer :: #import "std/timer_linux";
|
||||
App :: #import "app";
|
||||
Progress :: #import, file "progress.zi";
|
||||
@@ -13,16 +12,12 @@ Controls :: #import, file "controls.zi";
|
||||
Wardrobe :: #import, file "wardrobe.zi";
|
||||
Input :: #import "kryon/input_protocol";
|
||||
#import, file "game.zi";
|
||||
#import "std/environment_linux"
|
||||
libc :: #system_library "libc";
|
||||
GetEnvironment :: (name: *u8) -> *u8 #foreign libc "getenv";
|
||||
ParseNumber :: (text: *u8) -> s32 #foreign libc "atoi";
|
||||
Flush :: (stream: *void) -> s32 #foreign libc "fflush";
|
||||
|
||||
Number :: (name: string, fallback: s32) -> s32 {
|
||||
buffer: [64]u8
|
||||
if !CopyCString(name, buffer[:]) { return fallback }
|
||||
value := GetEnvironment(*buffer[0])
|
||||
return ifx value == null then fallback else ParseNumber(value)
|
||||
return cast(s32)EnvironmentNumber(name, fallback)
|
||||
}
|
||||
|
||||
ProbeFrame :: (session: Session) -> bool {
|
||||
|
||||
+14
-19
@@ -1,30 +1,25 @@
|
||||
#import "apps/node_types"
|
||||
#import "apps/node_app"
|
||||
#import "kryon/geometry"
|
||||
App :: #import, file "app.zi";
|
||||
Runtime :: #import "portable_runtime";
|
||||
Locale :: #import, file "localization.zi";
|
||||
host_api :: #system_library "host_api";
|
||||
ReadAppHost :: () -> AppMessage #foreign host_api;
|
||||
WriteAppHost :: (message: AppMessage) #foreign host_api;
|
||||
ReadAppUiHost :: () -> AppUiFrame #foreign host_api;
|
||||
|
||||
#program_export
|
||||
Main :: () -> s32 {
|
||||
message := ReadAppHost()
|
||||
Main :: () -> s32 { return RunNodeApp(WurmFrame, WurmBack) }
|
||||
|
||||
WurmFrame :: (message: AppMessage) -> bool {
|
||||
Locale.SetLanguage(message.locale)
|
||||
if message.abi != MODULE_ABI { return -1 }
|
||||
if message.action == MODULE_IDENTIFY { return MODULE_NODE_APP }
|
||||
message.succeeded = message.action == APP_ROUTE
|
||||
if message.action == APP_FRAME {
|
||||
frame := ReadAppUiHost()
|
||||
Runtime.FrameTime(frame.now)
|
||||
area := Rectangle.{0.0, cast(float32)frame.top, cast(float32)frame.width,
|
||||
cast(float32)(frame.height - frame.top - frame.bottom)}
|
||||
message.succeeded = App.Frame(frame.session, area) == 0
|
||||
}
|
||||
if message.action == APP_BACK {
|
||||
message.succeeded = App.NavigateBack(Runtime.MonotonicMilliseconds())
|
||||
}
|
||||
WriteAppHost(message)
|
||||
return 0
|
||||
frame := ReadAppUiHost()
|
||||
Runtime.FrameTime(frame.now)
|
||||
area := Rectangle.{0.0, cast(float32)frame.top, cast(float32)frame.width,
|
||||
cast(float32)(frame.height - frame.top - frame.bottom)}
|
||||
return App.Frame(frame.session, area) == 0
|
||||
}
|
||||
|
||||
WurmBack :: (message: AppMessage) -> bool {
|
||||
Locale.SetLanguage(message.locale)
|
||||
return App.NavigateBack(Runtime.MonotonicMilliseconds())
|
||||
}
|
||||
+2
-7
@@ -205,13 +205,10 @@ Pump :: (now: s64) -> bool {
|
||||
Report()
|
||||
if current[0] == 0 { return changed }
|
||||
reply := Account.Service("entity.records", "{\"operation\":\"get\",\"kind\":\"game-progress\",\"game\":\"wurm\"}")
|
||||
at := FieldAt(reply, 0, "document")
|
||||
end := ValueEnd(reply, at, 0)
|
||||
record: Shared.GameProgressRecord
|
||||
unused CopyCString("wurm", record.game[:])
|
||||
record.unlocked = 1
|
||||
if at >= 0 && end > at && Shared.GameProgressRead(reply[at:end], *record) &&
|
||||
TextUntilNul(record.game[:]) == "wurm" {
|
||||
if Shared.GameProgressReply(reply, *record) && TextUntilNul(record.game[:]) == "wurm" {
|
||||
if record.unlocked - 1 > unlocked && record.unlocked <= LEVELS { unlocked = record.unlocked - 1; unused SaveUnlocked() }
|
||||
for index: 0..199 {
|
||||
if record.completed[index] == #char "1" { completed[index] = 1 }
|
||||
@@ -233,9 +230,7 @@ Pump :: (now: s64) -> bool {
|
||||
record.completed[200] = 0
|
||||
if record.unlocked > LEVELS { record.unlocked = LEVELS }
|
||||
out: Vec(u8)
|
||||
BuilderPrint(*out, "{\"operation\":\"put\",\"kind\":\"game-progress\",\"schema\":\"entity.game-progress.v1\",\"document\":")
|
||||
Shared.GameProgressWrite(*record, *out)
|
||||
BuilderPrint(*out, "}")
|
||||
Shared.GameProgressPutRequest(*record, *out)
|
||||
saved := Account.Service("entity.records", TextView(VecSlice(out, 0, out.count)))
|
||||
bytes: [16]u8
|
||||
dirty = ReadStringText(saved, FieldAt(saved, 0, "status"), bytes[:]) < 0 || TextUntilNul(bytes[:]) != "done"
|
||||
|
||||
+12
-25
@@ -10,10 +10,7 @@ App :: #import "app";
|
||||
Game :: #import, file "game.zi";
|
||||
File :: #import "std/file_linux";
|
||||
using Vectors :: #import "std/vec";
|
||||
#import "std/c_string";
|
||||
libc :: #system_library "libc";
|
||||
GetEnvironment :: (name: *u8) -> *u8 #foreign libc "getenv";
|
||||
ParseNumber :: (text: *u8) -> s32 #foreign libc "atoi";
|
||||
#import "std/environment_linux"
|
||||
|
||||
U32 :: (bytes: []u8, at: s32) -> u32 {
|
||||
return cast(u32)bytes[at] | (cast(u32)bytes[at + 1] << 8) |
|
||||
@@ -85,46 +82,36 @@ main :: () -> s32 {
|
||||
!PixmapSetImage(8, "assets/art/title-portrait.png", title_portrait_w, title_portrait_h, VecSlice(title_portrait, 0, title_portrait.count)) ||
|
||||
!PixmapSetImage(9, "assets/art/forest-canopy.png", forest_canopy_w, forest_canopy_h, VecSlice(forest_canopy, 0, forest_canopy.count)) ||
|
||||
!PixmapSetImage(10, "assets/art/forest-canopy-portrait.png", forest_canopy_portrait_w, forest_canopy_portrait_h, VecSlice(forest_canopy_portrait, 0, forest_canopy_portrait.count)) { return 1 }
|
||||
name: [32]u8
|
||||
unused CopyCString("WORM_SHOT_LEVEL", name[:])
|
||||
level := GetEnvironment(*name[0])
|
||||
if level != null {
|
||||
Game.StartGame(*App.game, ParseNumber(level) - 1, 0)
|
||||
level := cast(s32)EnvironmentNumber("WORM_SHOT_LEVEL", 0)
|
||||
if level > 0 {
|
||||
Game.StartGame(*App.game, level - 1, 0)
|
||||
for i: 0..31 { Game.Tick(*App.game) }
|
||||
App.game.mode = Game.MODE_PAUSED
|
||||
}
|
||||
unused CopyCString("WORM_SHOT_BOARD", name[:])
|
||||
if GetEnvironment(*name[0]) != null {
|
||||
if EnvironmentText("WORM_SHOT_BOARD") != "" {
|
||||
App.game.started = true
|
||||
App.game.mode = Game.MODE_PLAYING
|
||||
App.game.next_step = 9223372036854775000
|
||||
}
|
||||
unused CopyCString("WORM_SHOT_VOLUME", name[:])
|
||||
if GetEnvironment(*name[0]) != null { App.sound_popup = true }
|
||||
unused CopyCString("WORM_SHOT_STAGES", name[:])
|
||||
if GetEnvironment(*name[0]) != null {
|
||||
if EnvironmentText("WORM_SHOT_VOLUME") != "" { App.sound_popup = true }
|
||||
if EnvironmentText("WORM_SHOT_STAGES") != "" {
|
||||
App.game.started = true
|
||||
App.OpenStages()
|
||||
}
|
||||
unused CopyCString("WORM_SHOT_EDITOR", name[:])
|
||||
if GetEnvironment(*name[0]) != null {
|
||||
if EnvironmentText("WORM_SHOT_EDITOR") != "" {
|
||||
// WORM_SHOT_LEVEL picks which level the editor frame shows; the
|
||||
// started flag keeps Frame's first-run OpenStages from overriding it.
|
||||
App.game.started = true
|
||||
if level != null { App.OpenEditor(ParseNumber(level) - 1) }
|
||||
else { App.OpenEditor(0) }
|
||||
unused CopyCString("WORM_SHOT_BROWSER", name[:])
|
||||
if GetEnvironment(*name[0]) != null { App.editor.browsing = true }
|
||||
unused CopyCString("WORM_SHOT_TURN", name[:])
|
||||
if GetEnvironment(*name[0]) != null { App.EditorTurn() }
|
||||
App.OpenEditor(ifx level > 0 then level - 1 else 0)
|
||||
if EnvironmentText("WORM_SHOT_BROWSER") != "" { App.editor.browsing = true }
|
||||
if EnvironmentText("WORM_SHOT_TURN") != "" { App.EditorTurn() }
|
||||
}
|
||||
session := SessionOpen()
|
||||
if !SessionValid(session) { return 2 }
|
||||
defer { PixmapCloseWorkers(); CloseSession(session) }
|
||||
width: s32 = PixmapWidth
|
||||
height: s32 = PixmapHeight
|
||||
unused CopyCString("WORM_SHOT_PORTRAIT", name[:])
|
||||
portrait := GetEnvironment(*name[0]) != null
|
||||
portrait := EnvironmentText("WORM_SHOT_PORTRAIT") != ""
|
||||
if portrait { width = 390; height = 780 }
|
||||
pixels: [390 * 780]u32
|
||||
viewport := Rectangle.{0.0, 0.0, cast(float32)width, cast(float32)height}
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
// Generated by update_version.sh from CHANGELOG.md.
|
||||
AppVersion :: "0.2.24"
|
||||
AppVersion :: "0.2.26"
|
||||
+3
-8
@@ -23,10 +23,7 @@ def generate():
|
||||
#if #defined(PLATFORM_WEB) {
|
||||
#import "std/web"
|
||||
} else #if !#defined(WURM_PORTABLE) {
|
||||
#import "std/c_string"
|
||||
#import "std/byte_text_linux"
|
||||
libc :: #system_library "libc";
|
||||
LocaleEnvironment :: (name: *u8) -> *u8 #foreign libc "getenv";
|
||||
#import "std/environment_linux"
|
||||
}
|
||||
language: [3]u8;
|
||||
ready: bool;
|
||||
@@ -45,10 +42,8 @@ Detect :: () {
|
||||
SetLanguage(TextUntilNul(bytes[:]))
|
||||
WebEnd(scope)
|
||||
} else #if !#defined(WURM_PORTABLE) {
|
||||
key: [16]u8
|
||||
unused CopyCString("LANG", key[:])
|
||||
value := LocaleEnvironment(*key[0])
|
||||
if value != null { SetLanguage(TextFromCString(value)) }
|
||||
value := EnvironmentText("LANG")
|
||||
if value != "" { SetLanguage(value) }
|
||||
}
|
||||
}
|
||||
Text :: (source: string) -> string {
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"version": "0.2.24",
|
||||
"version_code": 34
|
||||
"version": "0.2.26",
|
||||
"version_code": 36
|
||||
}
|
||||
+36
-36
@@ -1,14 +1,6 @@
|
||||
{
|
||||
"format": 1,
|
||||
"packages": [
|
||||
{
|
||||
"commit": "dc1cfe389905c63c0bb453727d06d72afc1fa0b0",
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p77028198b0e09537"},
|
||||
"id": "p00b93f1ddcd2802f",
|
||||
"name": "Apps",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/waozixyz/apps.git"
|
||||
},
|
||||
{
|
||||
"commit": "2944b2e668e735438d8ce24e47a39be3f5c36af5",
|
||||
"dependencies": {},
|
||||
@@ -17,6 +9,39 @@
|
||||
"ref": "master",
|
||||
"url": "https://github.com/ziranlang/qrcode.git"
|
||||
},
|
||||
{
|
||||
"commit": "6c274894cd98cd37f727c06ed7a5bce768a0cbda",
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p31868b412b407f25"},
|
||||
"id": "p1e4e4f044a26528c",
|
||||
"name": "Apps",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/waozixyz/apps.git"
|
||||
},
|
||||
{
|
||||
"commit": "16fede501eaab8aedfe2d184813317be08554f6e",
|
||||
"dependencies": {"raylib": "p5a77c9c35110e925"},
|
||||
"id": "p31868b412b407f25",
|
||||
"name": "kryon",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
},
|
||||
{
|
||||
"commit": "02a1dfbba9eef37c8ac9f201eb583b097ccf12d8",
|
||||
"dependencies": {"daochi_client": "pf7b24c15869d6839", "kryon": "p31868b412b407f25", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
|
||||
"id": "p4fd05d3b01b94ee1",
|
||||
"name": "Entity",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/waozixyz/entity.git"
|
||||
},
|
||||
{
|
||||
"commit": "9fb80ab00d4b37503e66eb7ee7cdec6b305adf8e",
|
||||
"dependencies": {},
|
||||
"id": "p563eec337af1337e",
|
||||
"name": "liboqs",
|
||||
"ref": "main",
|
||||
"source": true,
|
||||
"url": "https://github.com/open-quantum-safe/liboqs.git"
|
||||
},
|
||||
{
|
||||
"commit": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e",
|
||||
"dependencies": {},
|
||||
@@ -28,20 +53,12 @@
|
||||
},
|
||||
{
|
||||
"commit": "22d2ddbdc236796953c905a05a2cebf5ab1b4ff3",
|
||||
"dependencies": {"liboqs": "pecdb097af6ab16f7"},
|
||||
"dependencies": {"liboqs": "p563eec337af1337e"},
|
||||
"id": "p7098ac9cd92f7e5f",
|
||||
"name": "Oqs",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/ziranlang/oqs.git"
|
||||
},
|
||||
{
|
||||
"commit": "1d987043bf1c07bde429d3f8a30b74d5401bea45",
|
||||
"dependencies": {"raylib": "p5a77c9c35110e925"},
|
||||
"id": "p77028198b0e09537",
|
||||
"name": "kryon",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
},
|
||||
{
|
||||
"commit": "f5f0a19a5dc6c14a49adb3cd63ea79a60f6ba77b",
|
||||
"dependencies": {},
|
||||
@@ -51,14 +68,6 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/LoupVaillant/Monocypher.git"
|
||||
},
|
||||
{
|
||||
"commit": "74229f6d61260c65c73b32edf2921885d08ffc02",
|
||||
"dependencies": {"daochi_client": "pf7b24c15869d6839", "kryon": "p77028198b0e09537", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
|
||||
"id": "p9e47632a2df70833",
|
||||
"name": "Entity",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/waozixyz/entity.git"
|
||||
},
|
||||
{
|
||||
"commit": "944826f70779a6b6cd53f6b06a75b36f4d8a2558",
|
||||
"dependencies": {},
|
||||
@@ -75,15 +84,6 @@
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/mingcute.git"
|
||||
},
|
||||
{
|
||||
"commit": "4778aa5044bf119c30df54219fa89357080af27f",
|
||||
"dependencies": {},
|
||||
"id": "pecdb097af6ab16f7",
|
||||
"name": "liboqs",
|
||||
"ref": "main",
|
||||
"source": true,
|
||||
"url": "https://github.com/open-quantum-safe/liboqs.git"
|
||||
},
|
||||
{
|
||||
"commit": "e948c3f280e2e3fa3ef7317dfaca27bd36a4900b",
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "oqs": "p7098ac9cd92f7e5f"},
|
||||
@@ -94,11 +94,11 @@
|
||||
}
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {"apps": "p00b93f1ddcd2802f", "entity": "p9e47632a2df70833", "kryon": "p77028198b0e09537", "mingcute": "pe1027b9d16704793"},
|
||||
"dependencies": {"apps": "p1e4e4f044a26528c", "entity": "p4fd05d3b01b94ee1", "kryon": "p31868b412b407f25", "mingcute": "pe1027b9d16704793"},
|
||||
"name": "Apfelwurm"
|
||||
},
|
||||
"toolchain": {
|
||||
"commit": "7c883e8458f9a728ff390d40e9c8b094a2683bab",
|
||||
"commit": "8c9665bf12665944ad705dd914259dcf4bacc497",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/ziranlang/ziran.git"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user