Skip to content

Commit

Permalink
tools tools tools!
Browse files Browse the repository at this point in the history
  • Loading branch information
LetterN committed Jan 31, 2021
1 parent 945599e commit 0901cf9
Show file tree
Hide file tree
Showing 105 changed files with 1,621 additions and 8,476 deletions.
162 changes: 0 additions & 162 deletions tools/ColonCatcher/ColonCatcher.py

This file was deleted.

Empty file modified tools/CreditsTool/UpdateCreditsDMI.sh
100644 → 100755
Empty file.
10 changes: 10 additions & 0 deletions tools/CreditsTool/remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ PraiseRatvar Frozenguy5
FuryMcFlurry Fury McFlurry
vuonojenmustaturska Naksu
praisenarsie Frozenguy5
MrDoomBringer Mr. DoomBringer
Fikou Dr. Fikou
TiviPlus Tivi Plus
tralezab Trale Zab
Iamgoofball goofball
Tharcoonvagh Tharcoon
Rectification itseasytosee
ATHATH ATH1909
trollbreeder troll breeder
BuffEngineering Buff Engineering
3 changes: 0 additions & 3 deletions tools/HitboxExpander/.gitignore

This file was deleted.

2 changes: 2 additions & 0 deletions tools/HitboxExpander/Hitbox Expander.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@call "%~dp0\..\bootstrap\python" -m HitboxExpander %*
@pause
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
Setup: Unzip the zip files in third_party/ so that you have the directories
third_party/Imaging-1.1.7/ and third_party/zlib/.

Usage: python hitbox_expander.py <path_to_file.dmi or png>
Usage: tools/bootstrap/python -m HitboxExpander <path_to_file.dmi or png>

This tool expands the hitbox of the given image by 1 pixel.
Works by changing some of the fully-transparent pixels to alpha=1 black pixels.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,10 @@
import sys
import inspect
import shutil

def AddToPath(path):
if path not in sys.path:
sys.path.insert(0, path)
delimeter = ':' if os.name == "posix" else ";"
os.environ['PATH'] = path + delimeter + os.environ['PATH']
import PIL.Image as Image

current_dir = os.path.split(inspect.getfile(inspect.currentframe()))[0]

AddToPath(os.path.abspath(os.path.join(current_dir, "third_party/Imaging-1.1.7/PIL")))
AddToPath(os.path.abspath(os.path.join(current_dir, "third_party/zlib")))

import Image
import _imaging

def PngSave(im, file):
# From http://blog.client9.com/2007/08/28/python-pil-and-png-metadata-take-2.html

Expand All @@ -25,13 +14,13 @@ def PngSave(im, file):
reserved = ('interlace', 'gamma', 'dpi', 'transparency', 'aspect')

# undocumented class
import PngImagePlugin
import PIL.PngImagePlugin as PngImagePlugin
meta = PngImagePlugin.PngInfo()

# copy metadata into new object
for k,v in im.info.iteritems():
for k,v in im.info.items():
if k in reserved: continue
meta.add_text(k, v, 0)
meta.add_text(k, str(v), 0)

# and save
im.save(file, "PNG", pnginfo=meta)
Expand All @@ -44,7 +33,7 @@ def ProcessFile(path):

try:
im = Image.open(path)
print name + ": " + im.format, im.size, im.mode
print(name + ": " + im.format, im.size, im.mode)
if im.mode != "RGBA":
return
width, height = im.size
Expand Down Expand Up @@ -76,15 +65,19 @@ def add(x, y):
pix[coords] = (0, 0, 0, 1)

PngSave(im, path)
except:
print "Could not process " + name
except Exception as e:
print("Could not process " + name)
print(e)

root_dir = os.path.abspath(os.path.join(current_dir, "../../"))
icons_dir = os.path.join(root_dir, "icons")

def Main():
if len(sys.argv) != 2:
print "Usage: hitbox_expander.py filename.dmi"
if os.name == 'nt':
print("Usage: drag-and-drop a .dmi onto `Hitbox Expander.bat`\n or")
with open(os.path.join(current_dir, "README.txt")) as f:
print(f.read())
return 0

try:
Expand All @@ -101,7 +94,7 @@ def Main():
ProcessFile(path)
return 0

print "File not found: " + sys.argv[1]
print("File not found: " + sys.argv[1])

if __name__ == "__main__":
Main()
3 changes: 3 additions & 0 deletions tools/HitboxExpander/hitbox_expander.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
set -e
exec "$(dirname "$0")/../bootstrap/python" -m HitboxExpander "$@"
Binary file removed tools/HitboxExpander/third_party/Imaging-1.1.7.zip
Binary file not shown.
Binary file removed tools/HitboxExpander/third_party/zlib.zip
Binary file not shown.
Loading

0 comments on commit 0901cf9

Please sign in to comment.