Audio (all CC0 — Kenney packs + OpenGameArt, see assets/sounds/SOURCES.md): - Replace every procedural synth WAV with forged sounds (ffmpeg pitch/layer mixes): distinct fire sounds per weapon with 2-3 variations, explosions, footsteps x5, land/jump/dash/vault, knife swing, hit/kill confirms, bullet impacts, reload, flight loops, UI hover/click/confirm/error, match jingles, menu music - AudioManager.stream_for(): AudioStreamRandomizer per sound id — every weapon now gets variation + pitch randomization on each shot - Explosions and bullet impacts play positional audio; landing has its own sound instead of a pitched footstep; ambient wind bed on every map Visuals: - ExplosionVFX: shared cel-shaded burst (white-hot stepped core, ink shockwave ring, star spikes, flat smoke puffs) replaces the orange sphere in both local and remote-replay paths - Comic star muzzle flashes on all weapons; unified cel tracer bolts with ink outlines across hitscan/shotgun/remote paths - Impact decals: hard-stepped ink-splat gradients instead of soft airbrush - Toon shading on first-person view models + arms, third-person weapons, and the procedural humanoid fallback (no hull outlines on FBX weapons — their hard normals tear the inverted hull) - Fix: giant soft "blob" highlight on floors — toon rim/specular disabled on level-geometry materials (pre-existing artifact since the cel commit) - Fix: own third-person weapon rendered into the first-person camera (shadows-only now covers first_person_mode) UI: - UITheme: comic theme on the root window — Bangers display font (OFL), paper panels with thick ink borders + hard drop shadows, papaya accent, themed buttons/inputs/popups; hover/click sounds on all menu buttons - Main menu: tilted comic wordmark, sunset toon diorama, looping menu music - Match HUD: themed scoreboard/killfeed/kill counter Viewports: - 4x MSAA project-wide + viewmodel/diorama viewports (crisp ink lines) - Viewmodel camera near plane 0.01; third-person camera FOV syncs settings - debug/visual_capture.gd: dev tool to screenshot menu + level for review Verified: 11/11 movement tests, spawn smoke test 0 failures, before/after screenshot comparison of menu and level. Co-Authored-By: Claude Fable 5 <[email protected]>
123 lines
5.0 KiB
GDScript
123 lines
5.0 KiB
GDScript
extends Object
|
|
class_name UITheme
|
|
|
|
## Shared comic/cel UI theme: Bangers display font, paper panels with thick
|
|
## ink borders and hard drop shadows, papaya accent. Built once, applied to
|
|
## the root Window so every Control in the game inherits it.
|
|
|
|
const FONT_PATH := "res://assets/ui/fonts/Bangers-Regular.ttf"
|
|
|
|
const INK := Color(0.09, 0.08, 0.12)
|
|
const PAPER := Color(0.98, 0.96, 0.9)
|
|
const PAPER_DIM := Color(0.92, 0.9, 0.84)
|
|
const PAPAYA := Color(1.0, 0.55, 0.15)
|
|
const PAPAYA_HOT := Color(1.0, 0.68, 0.25)
|
|
const TEAL := Color(0.16, 0.72, 0.68)
|
|
|
|
static var _theme: Theme = null
|
|
|
|
|
|
## Comic panel stylebox: flat fill, thick ink border, hard offset shadow.
|
|
static func box(bg: Color, border: Color = INK, radius: int = 10,
|
|
border_w: int = 3, shadow: bool = true) -> StyleBoxFlat:
|
|
var sb := StyleBoxFlat.new()
|
|
sb.bg_color = bg
|
|
sb.border_color = border
|
|
sb.set_border_width_all(border_w)
|
|
sb.set_corner_radius_all(radius)
|
|
sb.content_margin_left = 16
|
|
sb.content_margin_right = 16
|
|
sb.content_margin_top = 8
|
|
sb.content_margin_bottom = 8
|
|
if shadow:
|
|
sb.shadow_color = Color(INK.r, INK.g, INK.b, 0.55)
|
|
sb.shadow_size = 0
|
|
sb.shadow_offset = Vector2(4, 4)
|
|
sb.shadow_size = 2
|
|
return sb
|
|
|
|
|
|
static func build() -> Theme:
|
|
if _theme:
|
|
return _theme
|
|
var t := Theme.new()
|
|
var font: Font = load(FONT_PATH) if ResourceLoader.exists(FONT_PATH) else null
|
|
if font:
|
|
t.default_font = font
|
|
t.default_font_size = 26
|
|
|
|
# ── Buttons: paper card, papaya on hover, squash on press ────────────
|
|
t.set_stylebox("normal", "Button", box(PAPER))
|
|
t.set_stylebox("hover", "Button", box(PAPAYA_HOT))
|
|
t.set_stylebox("pressed", "Button", box(PAPAYA, INK, 10, 3, false))
|
|
t.set_stylebox("focus", "Button", box(PAPER, TEAL))
|
|
t.set_stylebox("disabled", "Button", box(PAPER_DIM, Color(0.4, 0.4, 0.45)))
|
|
t.set_color("font_color", "Button", INK)
|
|
t.set_color("font_hover_color", "Button", INK)
|
|
t.set_color("font_pressed_color", "Button", PAPER)
|
|
t.set_color("font_focus_color", "Button", INK)
|
|
t.set_color("font_disabled_color", "Button", Color(0.45, 0.45, 0.5))
|
|
|
|
# OptionButton / CheckBox get the same treatment explicitly (Godot theme
|
|
# types don't inherit styling from Button)
|
|
for cls in ["OptionButton", "MenuButton", "CheckBox", "CheckButton"]:
|
|
t.set_stylebox("normal", cls, box(PAPER))
|
|
t.set_stylebox("hover", cls, box(PAPAYA_HOT))
|
|
t.set_stylebox("pressed", cls, box(PAPAYA, INK, 10, 3, false))
|
|
t.set_stylebox("focus", cls, box(PAPER, TEAL))
|
|
t.set_stylebox("disabled", cls, box(PAPER_DIM, Color(0.4, 0.4, 0.45)))
|
|
t.set_color("font_color", cls, INK)
|
|
t.set_color("font_hover_color", cls, INK)
|
|
t.set_color("font_pressed_color", cls, PAPER)
|
|
t.set_color("font_focus_color", cls, INK)
|
|
t.set_color("font_disabled_color", cls, Color(0.45, 0.45, 0.5))
|
|
|
|
# ── Labels: ink outline everywhere for that inked-cel readability ────
|
|
t.set_color("font_outline_color", "Label", INK)
|
|
t.set_constant("outline_size", "Label", 8)
|
|
t.set_color("font_color", "Label", PAPER)
|
|
|
|
# RichTextLabel (killfeed)
|
|
t.set_color("default_color", "RichTextLabel", PAPER)
|
|
t.set_color("font_outline_color", "RichTextLabel", INK)
|
|
t.set_constant("outline_size", "RichTextLabel", 6)
|
|
|
|
# ── Inputs ───────────────────────────────────────────────────────────
|
|
t.set_stylebox("normal", "LineEdit", box(PAPER, INK, 8, 3, false))
|
|
t.set_stylebox("focus", "LineEdit", box(PAPER, TEAL, 8, 3, false))
|
|
t.set_color("font_color", "LineEdit", INK)
|
|
t.set_color("caret_color", "LineEdit", INK)
|
|
|
|
# ── Panels / lists ───────────────────────────────────────────────────
|
|
t.set_stylebox("panel", "PanelContainer", box(Color(0.13, 0.12, 0.18, 0.92), INK, 14, 4))
|
|
t.set_stylebox("panel", "ItemList", box(Color(0.13, 0.12, 0.18, 0.92), INK, 10, 3, false))
|
|
t.set_color("font_color", "ItemList", PAPER)
|
|
|
|
# ── Popup menus (OptionButton dropdowns) ─────────────────────────────
|
|
t.set_stylebox("panel", "PopupMenu", box(PAPER, INK, 8, 3, false))
|
|
t.set_color("font_color", "PopupMenu", INK)
|
|
t.set_color("font_hover_color", "PopupMenu", PAPAYA)
|
|
|
|
_theme = t
|
|
return t
|
|
|
|
|
|
## Apply the theme to the whole root window (inherited by every Control in
|
|
## every scene from then on). Idempotent.
|
|
static func apply_global(tree: SceneTree) -> void:
|
|
if tree and tree.root and tree.root.theme != build():
|
|
tree.root.theme = build()
|
|
|
|
|
|
## Attach hover/click UI sounds to every BaseButton under `root` (recursive).
|
|
static func wire_sounds(root: Node) -> void:
|
|
var am = root.get_tree().root.get_node_or_null("AudioManager")
|
|
if am == null:
|
|
return
|
|
for btn in root.find_children("*", "BaseButton", true, false):
|
|
if btn.has_meta("ui_sfx_wired"):
|
|
continue
|
|
btn.set_meta("ui_sfx_wired", true)
|
|
btn.mouse_entered.connect(func(): am.play_ui("ui_hover"))
|
|
btn.pressed.connect(func(): am.play_ui("ui_click"))
|