Add blood decals, gore, mobile HUD, web start gate + touch/perf tests

Remove tools/fstest.html scratch page used to probe browser
fullscreen/orientation APIs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EznnY8rH2dXhtono1kwsXg
This commit is contained in:
2026-09-04 14:07:57 +03:00
parent 01d6ecf475
commit 981ebf1910
32 changed files with 1536 additions and 113 deletions
+28 -11
View File
@@ -28,6 +28,11 @@ var _was_on_floor: bool = false
var _pre_slide_vel_y: float = 0.0
var _slam_ring_mesh: ArrayMesh = null
# Attack-FX resources are identical every swing, so build them once and reuse. Recreating a fresh
# StandardMaterial3D / SphereMesh per attack makes a mobile WebGL driver recompile the shader and
# re-upload the mesh each time — a main-thread hitch "when attacking" that never shows on desktop.
var _unshaded_mat: StandardMaterial3D = null
var _particle_sphere_cache: Dictionary = {} # "radius:seg:ring" -> SphereMesh (shared)
# Ability system — kick=0, dash=1, slam=2, roll=3
var ability_cd: Array[float] = [0.0, 0.0, 0.0, 0.0]
@@ -89,10 +94,9 @@ var _hit_flash_tween: Tween
func _ready() -> void:
add_to_group(&"player")
# Mali/ANGLE mobile GPUs can't run Godot's Compatibility vertex-skinning (transform
# feedback) — skinned meshes render invisible on the web build. Rebuild the bull as
# non-skinned bone-attached pieces there; desktop keeps smooth GPU skinning.
if OS.has_feature("web"):
# Native GPU skinning by default (the old Mali/ANGLE invisible-skinning bug is fixed in the
# 4.7 web templates). rigid_skin is now an opt-in fallback — see Controls.rigid_skin_enabled().
if Controls.rigid_skin_enabled():
RigidSkin.convert_tree(self)
_max_hp = maxi(1, int(DP.f("bull_max_hp")))
_hp = _max_hp
@@ -681,23 +685,33 @@ func _hit_matadors_radius(range_m: float, strength: float, up_boost: float = 0.0
# All FX in this script use unshaded, vertex-coloured, alpha-blended particles;
# these three helpers remove the boilerplate each spawn function used to repeat.
# One shared unshaded material for every particle FX (per-particle colour comes from the
# CPUParticles3D colour_ramp via vertex colour, not the material) — built once so the mobile
# driver compiles this shader a single time instead of on every attack.
func _unshaded_material() -> StandardMaterial3D:
var mat := StandardMaterial3D.new()
mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
mat.vertex_color_use_as_albedo = true
mat.cull_mode = BaseMaterial3D.CULL_DISABLED
return mat
if _unshaded_mat == null:
_unshaded_mat = StandardMaterial3D.new()
_unshaded_mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
_unshaded_mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
_unshaded_mat.vertex_color_use_as_albedo = true
_unshaded_mat.cull_mode = BaseMaterial3D.CULL_DISABLED
return _unshaded_mat
# Low-poly sphere sized for a particle mesh (height is always the diameter).
# Low-poly sphere sized for a particle mesh (height is always the diameter). Cached per size so
# repeat attacks reuse the same mesh (one GPU upload) instead of generating + uploading a new one.
func _particle_sphere(radius: float, segments: int, rings: int, mat: Material) -> SphereMesh:
var key := "%.4f:%d:%d" % [radius, segments, rings]
var cached: SphereMesh = _particle_sphere_cache.get(key)
if cached != null:
return cached
var sphere := SphereMesh.new()
sphere.radius = radius
sphere.height = radius * 2.0
sphere.radial_segments = segments
sphere.rings = rings
sphere.material = mat
_particle_sphere_cache[key] = sphere
return sphere
@@ -1191,6 +1205,9 @@ func take_sword_hit(cause: String = "", hit_pos: Vector3 = Vector3.ZERO) -> void
# bull). Melee gores pass no position and skip the spurt; gore can be turned off.
if cause == "thrown" and Settings.gore:
_spawn_blood(hit_pos if hit_pos != Vector3.ZERO else global_position)
# Any hit — melee or thrown — leaves a lasting stain on the ground the bull bled on.
var splat_dir := global_position - hit_pos if hit_pos != Vector3.ZERO else Vector3.ZERO
Gore.splat(global_position, splat_dir, 0.5)
if _huff_player:
_huff_player.pitch_scale = randf_range(0.7, 0.9)
_huff_player.play()