crimsonland 0.1.0.dev1__py3-none-any.whl → 0.1.0.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crimson/cli.py +5 -2
- crimson/views/arsenal_debug.py +9 -30
- crimson/views/audio_bootstrap.py +47 -0
- crimson/views/projectile_render_debug.py +9 -30
- {crimsonland-0.1.0.dev1.dist-info → crimsonland-0.1.0.dev2.dist-info}/METADATA +1 -1
- {crimsonland-0.1.0.dev1.dist-info → crimsonland-0.1.0.dev2.dist-info}/RECORD +8 -7
- {crimsonland-0.1.0.dev1.dist-info → crimsonland-0.1.0.dev2.dist-info}/WHEEL +0 -0
- {crimsonland-0.1.0.dev1.dist-info → crimsonland-0.1.0.dev2.dist-info}/entry_points.txt +0 -0
crimson/cli.py
CHANGED
|
@@ -202,8 +202,9 @@ def cmd_view(
|
|
|
202
202
|
run_view(view, width=width, height=height, title=title, fps=fps)
|
|
203
203
|
|
|
204
204
|
|
|
205
|
-
@app.
|
|
205
|
+
@app.callback(invoke_without_command=True)
|
|
206
206
|
def cmd_game(
|
|
207
|
+
ctx: typer.Context,
|
|
207
208
|
width: int | None = typer.Option(None, help="window width (default: use crimson.cfg)"),
|
|
208
209
|
height: int | None = typer.Option(None, help="window height (default: use crimson.cfg)"),
|
|
209
210
|
fps: int = typer.Option(60, help="target fps"),
|
|
@@ -221,7 +222,9 @@ def cmd_game(
|
|
|
221
222
|
help="assets root (default: base-dir; missing .paq files are downloaded)",
|
|
222
223
|
),
|
|
223
224
|
) -> None:
|
|
224
|
-
"""Run the reimplementation game flow."""
|
|
225
|
+
"""Run the reimplementation game flow (default command)."""
|
|
226
|
+
if ctx.invoked_subcommand:
|
|
227
|
+
return
|
|
225
228
|
from .game import GameConfig, run_game
|
|
226
229
|
|
|
227
230
|
config = GameConfig(
|
crimson/views/arsenal_debug.py
CHANGED
|
@@ -5,9 +5,7 @@ import random
|
|
|
5
5
|
|
|
6
6
|
import pyray as rl
|
|
7
7
|
|
|
8
|
-
from grim.audio import AudioState,
|
|
9
|
-
from grim.config import ensure_crimson_cfg
|
|
10
|
-
from grim.console import ConsoleLog, ConsoleState
|
|
8
|
+
from grim.audio import AudioState, shutdown_audio, update_audio
|
|
11
9
|
from grim.fonts.small import SmallFontData, draw_small_text, load_small_font
|
|
12
10
|
from grim.view import View, ViewContext
|
|
13
11
|
|
|
@@ -15,7 +13,6 @@ from ..creatures.spawn import SpawnId
|
|
|
15
13
|
from ..game_modes import GameMode
|
|
16
14
|
from ..game_world import GameWorld
|
|
17
15
|
from ..gameplay import PlayerInput, weapon_assign_player
|
|
18
|
-
from ..paths import default_runtime_dir
|
|
19
16
|
from ..projectiles import ProjectileTypeId
|
|
20
17
|
from ..ui.cursor import draw_aim_cursor
|
|
21
18
|
from ..weapon_sfx import resolve_weapon_sfx_ref
|
|
@@ -25,6 +22,7 @@ from ..weapons import (
|
|
|
25
22
|
Weapon,
|
|
26
23
|
projectile_type_id_from_weapon_id,
|
|
27
24
|
)
|
|
25
|
+
from .audio_bootstrap import init_view_audio
|
|
28
26
|
from .registry import register_view
|
|
29
27
|
|
|
30
28
|
|
|
@@ -284,32 +282,13 @@ class ArsenalDebugView:
|
|
|
284
282
|
except Exception:
|
|
285
283
|
self._small = None
|
|
286
284
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
self._world.config = None
|
|
295
|
-
|
|
296
|
-
if self._world.config is not None:
|
|
297
|
-
try:
|
|
298
|
-
self._console = ConsoleState(
|
|
299
|
-
base_dir=runtime_dir,
|
|
300
|
-
log=ConsoleLog(base_dir=runtime_dir),
|
|
301
|
-
assets_dir=self._assets_root,
|
|
302
|
-
)
|
|
303
|
-
self._audio = init_audio_state(self._world.config, self._assets_root, self._console)
|
|
304
|
-
self._audio_rng = random.Random(0xBEEF)
|
|
305
|
-
self._world.audio = self._audio
|
|
306
|
-
self._world.audio_rng = self._audio_rng
|
|
307
|
-
except Exception:
|
|
308
|
-
self._audio = None
|
|
309
|
-
self._audio_rng = None
|
|
310
|
-
self._console = None
|
|
311
|
-
self._world.audio = None
|
|
312
|
-
self._world.audio_rng = None
|
|
285
|
+
bootstrap = init_view_audio(self._assets_root)
|
|
286
|
+
self._world.config = bootstrap.config
|
|
287
|
+
self._console = bootstrap.console
|
|
288
|
+
self._audio = bootstrap.audio
|
|
289
|
+
self._audio_rng = bootstrap.audio_rng
|
|
290
|
+
self._world.audio = self._audio
|
|
291
|
+
self._world.audio_rng = self._audio_rng
|
|
313
292
|
|
|
314
293
|
self._world.open()
|
|
315
294
|
self._aim_texture = self._world._load_texture(
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import random
|
|
6
|
+
|
|
7
|
+
from grim.audio import AudioState, init_audio_state
|
|
8
|
+
from grim.config import CrimsonConfig, ensure_crimson_cfg
|
|
9
|
+
from grim.console import ConsoleLog, ConsoleState
|
|
10
|
+
|
|
11
|
+
from ..assets_fetch import download_missing_paqs
|
|
12
|
+
from ..paths import default_runtime_dir
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(slots=True)
|
|
16
|
+
class ViewAudioBootstrap:
|
|
17
|
+
config: CrimsonConfig | None
|
|
18
|
+
console: ConsoleState | None
|
|
19
|
+
audio: AudioState | None
|
|
20
|
+
audio_rng: random.Random | None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def init_view_audio(assets_dir: Path, *, seed: int = 0xBEEF) -> ViewAudioBootstrap:
|
|
24
|
+
runtime_dir = default_runtime_dir()
|
|
25
|
+
runtime_dir.mkdir(parents=True, exist_ok=True)
|
|
26
|
+
try:
|
|
27
|
+
config = ensure_crimson_cfg(runtime_dir)
|
|
28
|
+
except Exception:
|
|
29
|
+
return ViewAudioBootstrap(None, None, None, None)
|
|
30
|
+
|
|
31
|
+
console = ConsoleState(
|
|
32
|
+
base_dir=runtime_dir,
|
|
33
|
+
log=ConsoleLog(base_dir=runtime_dir),
|
|
34
|
+
assets_dir=assets_dir,
|
|
35
|
+
)
|
|
36
|
+
try:
|
|
37
|
+
download_missing_paqs(assets_dir, console)
|
|
38
|
+
except Exception as exc:
|
|
39
|
+
console.log.log(f"assets: download failed: {exc}")
|
|
40
|
+
console.log.flush()
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
audio = init_audio_state(config, assets_dir, console)
|
|
44
|
+
except Exception:
|
|
45
|
+
return ViewAudioBootstrap(config, console, None, None)
|
|
46
|
+
|
|
47
|
+
return ViewAudioBootstrap(config, console, audio, random.Random(seed))
|
|
@@ -6,17 +6,15 @@ import random
|
|
|
6
6
|
|
|
7
7
|
import pyray as rl
|
|
8
8
|
|
|
9
|
-
from grim.audio import AudioState,
|
|
10
|
-
from grim.config import ensure_crimson_cfg
|
|
11
|
-
from grim.console import ConsoleLog, ConsoleState
|
|
9
|
+
from grim.audio import AudioState, shutdown_audio
|
|
12
10
|
from grim.fonts.small import SmallFontData, draw_small_text, load_small_font
|
|
13
11
|
from grim.view import View, ViewContext
|
|
14
12
|
|
|
15
13
|
from ..game_world import GameWorld
|
|
16
14
|
from ..gameplay import PlayerInput, player_update, weapon_assign_player
|
|
17
|
-
from ..paths import default_runtime_dir
|
|
18
15
|
from ..ui.cursor import draw_aim_cursor
|
|
19
16
|
from ..weapons import WEAPON_TABLE
|
|
17
|
+
from .audio_bootstrap import init_view_audio
|
|
20
18
|
from .registry import register_view
|
|
21
19
|
|
|
22
20
|
|
|
@@ -203,32 +201,13 @@ class ProjectileRenderDebugView:
|
|
|
203
201
|
except Exception:
|
|
204
202
|
self._small = None
|
|
205
203
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
self._world.config = None
|
|
214
|
-
|
|
215
|
-
if self._world.config is not None:
|
|
216
|
-
try:
|
|
217
|
-
self._console = ConsoleState(
|
|
218
|
-
base_dir=runtime_dir,
|
|
219
|
-
log=ConsoleLog(base_dir=runtime_dir),
|
|
220
|
-
assets_dir=self._assets_root,
|
|
221
|
-
)
|
|
222
|
-
self._audio = init_audio_state(self._world.config, self._assets_root, self._console)
|
|
223
|
-
self._audio_rng = random.Random(0xBEEF)
|
|
224
|
-
self._world.audio = self._audio
|
|
225
|
-
self._world.audio_rng = self._audio_rng
|
|
226
|
-
except Exception:
|
|
227
|
-
self._audio = None
|
|
228
|
-
self._audio_rng = None
|
|
229
|
-
self._console = None
|
|
230
|
-
self._world.audio = None
|
|
231
|
-
self._world.audio_rng = None
|
|
204
|
+
bootstrap = init_view_audio(self._assets_root)
|
|
205
|
+
self._world.config = bootstrap.config
|
|
206
|
+
self._console = bootstrap.console
|
|
207
|
+
self._audio = bootstrap.audio
|
|
208
|
+
self._audio_rng = bootstrap.audio_rng
|
|
209
|
+
self._world.audio = self._audio
|
|
210
|
+
self._world.audio_rng = self._audio_rng
|
|
232
211
|
|
|
233
212
|
self._world.open()
|
|
234
213
|
self._aim_texture = self._world._load_texture(
|
|
@@ -4,7 +4,7 @@ crimson/atlas.py,sha256=hEcCHhPvguXAI6eH_G9Q8rpiX7M5akZ8fgJjMogmYrA,2401
|
|
|
4
4
|
crimson/audio_router.py,sha256=LLCYI9oUoPHbmh_pjW4Ey1Bk33_nNnYK5qwroCbnEPQ,4616
|
|
5
5
|
crimson/bonuses.py,sha256=owwYIRHRu1Kymtt4eEvpd62JwWAg8LOe20vDuPFB5SU,5094
|
|
6
6
|
crimson/camera.py,sha256=VxTNXTh0qHh5VR1OpkiXr-QcgEWPrWw0A3PFyQFqDkY,2278
|
|
7
|
-
crimson/cli.py,sha256=
|
|
7
|
+
crimson/cli.py,sha256=Pu4RM_bjGtUgIE_5zZs0uWFY9O8YkhJDseRcVMMPJ8k,14595
|
|
8
8
|
crimson/creatures/__init__.py,sha256=RJwwR_w98zC_kHF9CwkhzSlf0xjpiP0JU87W4awdAAM,233
|
|
9
9
|
crimson/creatures/ai.py,sha256=oCuUkDe6Kxya1dThUthEy8GIuObAUjDv8WPfe17HYV4,6353
|
|
10
10
|
crimson/creatures/anim.py,sha256=E7MAR9vFBrvmIYrOfPr36UohsfROZZL00jgRvZQf6nc,4971
|
|
@@ -82,7 +82,8 @@ crimson/ui/perk_menu.py,sha256=FdbwG_B7UyZmPVdvZho0nJNvkAVc0VVHM2TSrY4eTfM,12740
|
|
|
82
82
|
crimson/views/__init__.py,sha256=1UWCzBSsgIeOtcKxqM4Vf12JEfPHKfb9KRZgl2TB84Q,1880
|
|
83
83
|
crimson/views/aim_debug.py,sha256=2ldQ1MJO8AeG0i9x4ZJ3YLyp1X-HY_nJ0E1mY8jFF7Q,10873
|
|
84
84
|
crimson/views/animations.py,sha256=iI6uTpYS-lbjnpqz_ihETm5q09V6RqjO7YHqaGjovPc,10660
|
|
85
|
-
crimson/views/arsenal_debug.py,sha256=
|
|
85
|
+
crimson/views/arsenal_debug.py,sha256=BWxjrrVF2dP5aa6GSaihzbNDIIS0OOXNyxgyvwqm4RU,13713
|
|
86
|
+
crimson/views/audio_bootstrap.py,sha256=a2qM91biyI-LlSiIhEceJ8ptYJy-xQ2-b-YjeyXWx7w,1408
|
|
86
87
|
crimson/views/bonuses.py,sha256=dbGx0IBjMMpqrnuVjBUkscxHq6uErCxAkEAb3uDhFqQ,7454
|
|
87
88
|
crimson/views/camera_debug.py,sha256=Vi6jANGQpXMK0bpL7hX_QQI_6Rl97ykElaoAuXd06YY,14025
|
|
88
89
|
crimson/views/camera_shake.py,sha256=miYxPJcVChv5P2AdbAWTEsrjZR0SAszqClLMbmrgg-0,8148
|
|
@@ -99,7 +100,7 @@ crimson/views/perks.py,sha256=Uac31DVvHZvjDmMrHpfvkg7LVpXw76xKL1BqwaLAsHU,15052
|
|
|
99
100
|
crimson/views/player.py,sha256=pj1_hFZ7VRUDfZYdUI1b-EpA7FdoBhhKM3Jk4x4s-GI,16540
|
|
100
101
|
crimson/views/player_sprite_debug.py,sha256=DDU6kl9sfhZ2nVXzBbsPSUKdIutHf5YNs2DrNQPRb2Q,11158
|
|
101
102
|
crimson/views/projectile_fx.py,sha256=XIp3Zq82Pz6g-B30qa6-nlKF_dseLNoQNSUPhj9Y4i8,23148
|
|
102
|
-
crimson/views/projectile_render_debug.py,sha256=
|
|
103
|
+
crimson/views/projectile_render_debug.py,sha256=CBSkUbflOSdrauyX1WucZ96CdYVBt_2QmGlx7i-KijM,14048
|
|
103
104
|
crimson/views/projectiles.py,sha256=k5zD_9614_-M4qYpnwKUS23fUUrjJS2Wzm7ZalOSKnU,8067
|
|
104
105
|
crimson/views/quest_title_overlay.py,sha256=EbMvXvYqagLLXmhaM7PC0fhxxhHGYGYI2ytgYiWqAd4,3338
|
|
105
106
|
crimson/views/registry.py,sha256=Kxc_aQMWOAjI6Uq_SRkb0AmYQxyVmM6rxT3UF74irzs,930
|
|
@@ -132,7 +133,7 @@ grim/sfx.py,sha256=cpn2Mmeio7BSDgbStSft-eZchO9Ot2MrK6iXJqxlLqU,7836
|
|
|
132
133
|
grim/sfx_map.py,sha256=FM5iBzKkG30Vtu78SRavVNgXMbGK7ZFcQ8i6lgMlzVw,4697
|
|
133
134
|
grim/terrain_render.py,sha256=EZ7ySYJyTZwXcrJx1mKbY3ewZtPi7Y270XnZgGJyZG8,31509
|
|
134
135
|
grim/view.py,sha256=oF4pHZehBqOxPjKMU28TDg3qATh_amMIRJp-vMQnpn4,334
|
|
135
|
-
crimsonland-0.1.0.
|
|
136
|
-
crimsonland-0.1.0.
|
|
137
|
-
crimsonland-0.1.0.
|
|
138
|
-
crimsonland-0.1.0.
|
|
136
|
+
crimsonland-0.1.0.dev2.dist-info/WHEEL,sha256=fAguSjoiATBe7TNBkJwOjyL1Tt4wwiaQGtNtjRPNMQA,80
|
|
137
|
+
crimsonland-0.1.0.dev2.dist-info/entry_points.txt,sha256=jzzcExxiE9xpt4Iw2nbB1lwTv2Zj4H14WJTIPMkAjoE,77
|
|
138
|
+
crimsonland-0.1.0.dev2.dist-info/METADATA,sha256=v1L2sbICNVlC-4x6fodRwHtT2l4PGNP52yffTJEtcpw,243
|
|
139
|
+
crimsonland-0.1.0.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|