Fix Levels.gd type inference + Database integer-division warning + brighten scenes

- scenes/levels/Levels.gd: replace 'var level := Global.database
  .level_by_index(...)' with explicit 'var level: LevelEntry = ...'.
  Global.database is typed RefCounted so the parser can't see DB's
  return types through the walrus operator. Two callsites.
- scripts/Database.gd: annotate the two 'range(data.size() / W)'
  loops with @warning_ignore('integer_division'). The division is
  intentional (row count = bytes / row width); Godot 4 warns by
  default in case the slash was a typo.
- env: ambient_light_energy 0.4 -> 1.0 in WarCraft.tscn, Home.tscn
  and env_warcraft.tres. 0.4 left the floor pitch-black; 1.0 is a
  compromise between the original 1.55 (oversaturated) and this.
  Re-baking the lightmap in the editor is still the right fix —
  this commit just keeps the scene playable in the meantime.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vaillant Jeremy
2026-05-16 22:02:59 +02:00
parent c17769246f
commit 6146d84b87
5 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ func _load_back_button() -> void:
$Quit/TextureButton.pressed.connect(Event._on_main_scene_pressed)
func _load_prepare_victory_condition() -> void:
var level := Global.database.level_by_index(Global.current_scene_int)
var level: LevelEntry = Global.database.level_by_index(Global.current_scene_int)
if level == null:
return
victory_condition = level.object_to_find()
@@ -133,7 +133,7 @@ func _check_dissolve_mesh() -> void:
_clean_mesh(key)
func _clean_mesh(key: String) -> void:
var level := Global.database.level_by_index(Global.current_scene_int)
var level: LevelEntry = Global.database.level_by_index(Global.current_scene_int)
if level != null:
victory_progress = level.object_finding()
var mesh := _node_to_mesh(key)
+1 -1
View File
@@ -11,7 +11,7 @@ background_energy_multiplier = 0.6
sky = SubResource("1")
ambient_light_color = Color(0.694118, 0.168627, 0.67451, 1)
ambient_light_sky_contribution = 0.5
ambient_light_energy = 0.4
ambient_light_energy = 1.0
tonemap_mode = 2
ssr_enabled = true
glow_enabled = true
+1 -1
View File
@@ -49,7 +49,7 @@ background_energy_multiplier = 0.6
sky = SubResource("1")
ambient_light_color = Color(0.694118, 0.168627, 0.67451, 1)
ambient_light_sky_contribution = 0.5
ambient_light_energy = 0.4
ambient_light_energy = 1.0
tonemap_mode = 2
ssr_enabled = true
glow_enabled = true
+1 -1
View File
@@ -11,7 +11,7 @@ sky = SubResource( 2 )
background_color = Color( 0.188235, 0.133333, 0.133333, 1 )
background_energy_multiplier = 0.6
ambient_light_color = Color( 0.694118, 0.168627, 0.67451, 1 )
ambient_light_energy = 0.4
ambient_light_energy = 1.0
ambient_light_sky_contribution = 0.5
fog_enabled = true
fog_mode = 1
+2
View File
@@ -67,6 +67,7 @@ class DB extends RefCounted:
func _load_levels(data: Array) -> Array[LevelEntry]:
var result: Array[LevelEntry] = []
const W := 2
@warning_ignore("integer_division")
for i in range(data.size() / W):
var l := LevelEntry.new()
l.index = i
@@ -78,6 +79,7 @@ class DB extends RefCounted:
func _load_scenes(data: Array) -> Array[SceneEntry]:
var result: Array[SceneEntry] = []
const W := 7
@warning_ignore("integer_division")
for i in range(data.size() / W):
var s := SceneEntry.new()
s.lock = bool(int(data[i * W + 0]))