29 Commits

Author SHA1 Message Date
Vaillant Jeremy c17769246f Replace M* table-wrapper classes with typed Resources; add type hints
Two related cleanups from the best-practice audit:

Task 3 — typed Resources instead of MBase / MScene / MLevel / MSetting

The old model classes wrapped the godot_db_manager Table API: each row
read went through table.get_data_at_row_idx(int), Cell.get_data(),
and 'as int' / 'as String' casts that don't actually parse anything
in Godot 4. m_value, m_lock, m_label, ... members shadowed the cell
indirection. Setters round-tripped through table.edit_data() +
Global.database.save_db(). That's a lot of plumbing for what is, in
the end, three flat tables of static strings.

Introduce three @export-typed Resources:
  db/scene_entry.gd     class_name SceneEntry
  db/level_entry.gd     class_name LevelEntry
  db/settings_data.gd   class_name SettingsData

Rewrite scripts/Database.gd so Database.DB holds:
  settings: SettingsData
  levels:   Array[LevelEntry]
  scenes:   Array[SceneEntry]

Build them once at startup from ahog.json, and serialise back to the
same JSON shape on save() so existing progress files keep working.
LevelEntry carries its own object_to_find / object_finding / reset
methods (talking to Global.database for cross-table lookups), and
SceneEntry carries its own mesh_path / audio_sound. Per-scene
dissolve state (value, tick_reference, dissolved) lives on
SceneEntry as non-exported runtime fields.

Delete db/MBase.gd / db/MScene.gd / db/MLevel.gd / db/MSetting.gd.

Update consumers:
- scripts/Setting.gd: read/write Global.database.settings directly,
  call Global.database.save() after each setter.
- scenes/levels/Levels.gd: iterate Global.database.scenes_for_level(
  current_scene_int) instead of mscene.new(i) for every row; scene
  state reads (scene.lock, scene.mesh, scene.counter, ...) replace
  scene.lock() / scene.mesh() / scene.counter() method calls; runtime
  dissolve state lives on the SceneEntry instance instead of mutable
  m_value / m_tick_reference members on MScene; 'dissolved' flag
  replaces set_mesh(null) signalling.
- scenes/UI/choose_scenes/ChooseScene.gd: iterate Global.database
  .levels; level.name / level.thumb property access in place of
  level.name() / level.thumbnail(). configure_reset() loses its
  redundant index argument (LevelEntry knows its own index).
- scripts/event.gd: _on_reset_level signature now takes LevelEntry,
  reset path drops index forwarding.

Task 2 — type hints across the remaining scripts

scripts/Global.gd, scenes/Main.gd, scenes/UI/ending/Ending.gd,
scenes/UI/loading/Loading.gd, scenes/UI/settings/Settings.gd: add
typed parameters and -> return annotations. current_scene_int is now
'int = -1' (sentinel) so callers don't fall into Variant comparisons;
event.gd:_on_reset_level resets it to -1 instead of null.
Settings.gd no longer wraps button_pressed in int() before passing to
the now-typed bool setters.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 21:58:11 +02:00
Vaillant Jeremy 81e6ceb003 Silence Godot 4 editor warnings (debugger)
Address every warning that surfaced in the running game's debugger:

- Drop deprecated 'graph_offset = Vector2(...)' lines from the three
  in-tree VisualShader resources (red.tres, green.tres,
  Summary.tscn). The property is editor-only graph pan, ignored at
  runtime but warns at load.
- Add android/.gdignore so Godot stops scanning the build template
  copies of red.tres/green.tres (which still had graph_offset). Tighten
  .gitignore to keep tracking the .gdignore marker only.
- Drop the broken 'nodes/fragment/connections = ...' line from the
  inline VisualShader in Summary.tscn — connections referenced
  out-of-bounds ports (e.g. port 1 on a 1-output node). The
  pre-compiled 'code = ...' string is kept so rendering is unaffected.
- Drop the orphaned 'ext_resource WarCraft.lmbake' from WarCraft.tscn:
  the LightmapGI node no longer references it but Godot still loaded
  the (Godot-3-format) blob from the ext_resource declaration alone,
  triggering '(p_data.size() % 4) != 0'.
- Animation tracks: SlideReset (Template.tscn), BorderAnim
  (Loading.tscn), and ObjectFindAll (ListObjects.tscn) each had a
  bezier track with empty PackedFloat32Array keys, which
  AnimationMixer rejects in Godot 4. Drop the empty x track in each
  (the y track held the actual motion).
- Re-save 57 .mesh files via scripts/migrate_misc.gd so the surface
  format is the current Godot 4 variant. sm_stackgold.mesh in
  particular triggered the deprecation warning every load.

GDScript: rename function parameters and locals that shadowed
Node.name / Node.value in:
- db/MScene.gd (set_lock, set_mesh, set_tick_reference, set_value)
- scripts/Setting.gd untouched (no shadow, false positive earlier)
- scenes/UI/choose_scenes/ChooseScene.gd (_load_scene, _build_path,
  _build_method)
- scenes/levels/Levels.gd (_create_animation_slide,
  _create_animation_warning, _add_animation_to_player,
  _create_button_info, _node_object_list)

lod plugin: Godot 4 added 'lod_bias' as a native property on
VisualInstance3D, which collided with the plugin's 'lod_bias' member
across all five lod_*.gd files. Rename to 'lod_distance_bias' so the
scripts parse again. Also drop Light3D.shadow_color writes in
lod_omni_light.gd and lod_spot_light.gd — that property was removed
in Godot 4, so the related shadow_value computation became dead code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 21:28:22 +02:00
Vaillant Jeremy 4d5db7bb61 Make Main, Settings, ChooseScene, and gameplay run in Godot 4.6
Catch-all commit for everything the --convert-3to4 tool missed during a
manual playtest of the game. All errors raised by clicking through Main
-> Puzzles -> level were fixed.

GDScript:
- PackedScene.instance() -> instantiate() (ChooseScene.gd)
- String(x) constructor doesn't exist -> str(x) (MBase, MScene,
  MLevel, Animation, Levels)
- 'x as int/String/bool' doesn't parse strings -> explicit
  int()/str()/bool(int()) (MScene, MLevel, MSetting)
- BaseButton.pressed (property) -> button_pressed; set_pressed() ->
  direct assignment (Settings.gd)
- AnimationPlayer.add_animation() removed -> go through
  AnimationLibrary (Levels.gd)
- PhysicsDirectSpaceState3D.intersect_ray(from, to, ...) ->
  PhysicsRayQueryParameters3D.create() (Levels.gd)
- @export with type-hint-in-comment ('# (String, ...)') -> explicit
  @export_enum (candle.gd)
- Get effective material with get_active_material() instead of
  get_surface_override_material(), with null guard (Levels.gd)
- get_node() -> get_node_or_null() so missing items from ahog.json
  (e.g. sm_super_dager in Home) don't crash (Levels.gd)

Scenes/resources:
- Remove 14 Tween nodes from WarCraft.tscn — Tween is no longer a
  Node in Godot 4. Rewrite Animation.start_dissolve to use
  create_tween().tween_method().
- Rename property material/N -> surface_material_override/N in every
  .tscn (10 files) — Godot 3 -> 4 rename that --convert-3to4 missed.
  Without this, MeshInstance3D.get_active_material(0) returned the
  glTF-imported StandardMaterial3D instead of the project's custom
  dissolve ShaderMaterial.

Shaders:
- One-shot scripts/migrate_shaders.gd walks every .material under
  assets/ and fixes Godot 3 -> 4 shader code in-place. Fixed 17
  materials: depth_draw_alpha_prepass -> depth_prepass_alpha,
  hint_color -> source_color, NORMALMAP -> NORMAL_MAP.

Result: Main, Settings, ChooseScene, and the WarCraft level all run
without script or shader errors. Remaining noise is non-blocking
(visual_shader graph in text_outline.material, baked lightmap binary
format from Godot 3, and empty animation tracks).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 19:40:03 +02:00
Vaillant Jeremy 770434482d Fix Setting.gd Vector2/Window API, re-import all assets for Godot 4
- apply_resolution: Vector2 strings -> Vector2i(int, int); use
  Window.content_scale_size instead of removed
  Viewport.set_size_2d_override variants.
- Re-import 162 assets to Godot 4 format (.godot/imported/ now,
  .stex -> .ctex, FontFile, CompressedTexture2D, etc.).
- Add .uid sidecars Godot 4 generates next to every script.
- Ignore .godot/ cache and android/ template directories.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 19:26:10 +02:00
darknight a33ecafb81 feature/shader-animation (#83)
Co-authored-by: Vaillant Jeremy <vaillant.jeremy@dev-crea.com>
Co-authored-by: VAILLANT Jeremy <vaillant.jeremy@dev-crea.com>
Reviewed-on: Athena/game-source#83
Co-authored-by: darknight <vaillant.jeremy@dev-crea.com>
Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
2021-06-26 15:33:34 +02:00
darknight 34612f83a8 Add number version (#79)
Co-authored-by: VAILLANT Jeremy <vaillant.jeremy@dev-crea.com>
Reviewed-on: Athena/game-source#79
Co-authored-by: darknight <vaillant.jeremy@dev-crea.com>
Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
2021-06-06 19:11:21 +02:00
darknight fcff613a93 bugfix/android-database (#78)
Co-authored-by: VAILLANT Jeremy <vaillant.jeremy@dev-crea.com>
Reviewed-on: Athena/game-source#78
Co-authored-by: darknight <vaillant.jeremy@dev-crea.com>
Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
2021-06-06 18:54:25 +02:00
darknight 1883355678 feature/connect-level-and-reset-btn (#77)
Co-authored-by: VAILLANT Jeremy <vaillant.jeremy@dev-crea.com>
Reviewed-on: Athena/game-source#77
Co-authored-by: darknight <vaillant.jeremy@dev-crea.com>
Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
2021-06-06 16:54:38 +02:00
darknight 0f2540613b feature/count-object-finding (#61)
Co-authored-by: Vaillant Jeremy <vaillant.jeremy@dev-crea.com>
Reviewed-on: Athena/game-source#61
Co-authored-by: darknight <vaillant.jeremy@dev-crea.com>
Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
2021-05-30 15:04:33 +02:00
darknight ed20465f39 feature/list-object-counter (#60)
Co-authored-by: VAILLANT Jeremy <vaillant.jeremy@dev-crea.com>
Reviewed-on: Athena/game-source#60
Co-authored-by: darknight <vaillant.jeremy@dev-crea.com>
Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
2021-05-29 21:09:10 +02:00
VAILLANT Jeremy 03fe0c753d Fix word ambient -> ambient 2021-05-25 14:14:03 +02:00
VAILLANT Jeremy fd7e341e49 Clean code 2021-05-25 14:14:03 +02:00
VAILLANT Jeremy c46cb1f41e Add setting true/false audio background in war level 2021-05-25 14:14:03 +02:00
VAILLANT Jeremy ddebf849b2 Add method for loading sound 2021-05-25 14:13:54 +02:00
VAILLANT Jeremy 7921d37199 Add missing data 2021-05-25 14:13:54 +02:00
VAILLANT Jeremy be63fa434f Add missing label_id 2021-05-25 14:11:26 +02:00
VAILLANT Jeremy 367ee388da Fix list object 2021-05-15 20:40:16 +02:00
VAILLANT Jeremy 6980458eec Get count element 2021-05-15 16:37:52 +02:00
VAILLANT Jeremy 90fce7425a Fix base bdd 2021-05-15 16:36:28 +02:00
VAILLANT Jeremy 6b9e476b00 Use dbb for levels 2021-05-15 14:05:09 +02:00
VAILLANT Jeremy b2fc1b63a3 Remove useless var/print 2021-05-15 13:04:39 +02:00
Vaillant Jeremy b4fe5828ea Remove test scene 2021-05-15 12:14:13 +02:00
VAILLANT Jeremy 0d6c124c61 Fix data 2021-05-14 22:23:58 +02:00
VAILLANT Jeremy 39b91ea3ed Adjuste data to BDD 2021-05-14 22:23:58 +02:00
VAILLANT Jeremy 32473b4e70 Add Classes model 2021-05-14 22:23:57 +02:00
VAILLANT Jeremy 68ecc54191 Complete db 2021-05-14 22:23:57 +02:00
VAILLANT Jeremy 8dbbbe7629 Compete data about scenes and levels 2021-05-13 23:20:27 +02:00
VAILLANT Jeremy 26528412f9 Complete data in BDD 2021-05-13 23:20:27 +02:00
VAILLANT Jeremy aa8340d8ff Add database 2021-05-13 23:20:27 +02:00