"""Scalpel Spin: o README do repositorio reserva o nome do projeto e a arte do titulo. Este script, rodado pelo build-scalpel-spin.sh depois do patch remove-support-link.patch: - troca o nome do projeto e a fala do locutor ("Welcome to ...!") pelo nome neutro "Scalpel Spin"; - troca a imagem do titulo do menu (assets/original/main_menu_title.png) por um Label com o texto "SCALPEL SPIN" na fonte League Gothic (OFL 1.1, a do tema do jogo) e apaga a imagem. Uso: python3 -I retitle.py """ import os import re import sys project = sys.argv[1] def rd(rel): return open(os.path.join(project, rel), encoding="utf-8").read() def wr(rel, s): open(os.path.join(project, rel), "w", encoding="utf-8").write(s) def once(s, old, new): assert s.count(old) == 1, old return s.replace(old, new) s = rd("project.godot") s = once(s, 'config/name="Spin-ectomy"', 'config/name="Scalpel Spin"') wr("project.godot", s) s = rd("scenes/game/announcer.gd") s = once(s, "Welcome to Spin-ectomy!", "Welcome to Scalpel Spin!") wr("scenes/game/announcer.gd", s) rel = "scenes/main_menu/main_menu.tscn" s = rd(rel) s = re.sub(r'(?m)^\[ext_resource [^\n]*main_menu_title\.png[^\n]*\n', "", s) a = s.index('[node name="Title" type="TextureRect"') b = s.index("\n[", a + 1) + 1 head = s[a:s.index("\n", a)].replace('type="TextureRect"', 'type="Label"') label = ( head + "\n" "layout_mode = 1\n" "anchors_preset = -1\n" "anchor_left = 0.04\nanchor_top = 0.08\nanchor_right = 0.6\nanchor_bottom = 0.3\n" 'theme = ExtResource("2_5seab")\n' "theme_override_colors/font_color = Color(0.99, 0.93, 0.55, 1)\n" "theme_override_colors/font_outline_color = Color(0.1, 0.25, 0.35, 1)\n" "theme_override_constants/outline_size = 30\n" "theme_override_font_sizes/font_size = 210\n" 'text = "SCALPEL SPIN"\n' "vertical_alignment = 1\n" "metadata/_edit_use_anchors_ = true\n\n" ) s = s[:a] + label + s[b:] assert "7_x2yjq" not in s wr(rel, s) for f in ("main_menu_title.png", "main_menu_title.png.import"): p = os.path.join(project, "assets/original", f) if os.path.exists(p): os.remove(p)