.BANCHO. Add some tillerino-like commands to fokabot

This commit is contained in:
Nyo
2016-05-19 20:17:20 +02:00
parent 9325578377
commit 13b49d9fa2
5 changed files with 172 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
"""Some functions that don't fit in any other file"""
from constants import mods
def stringToBool(s):
"""
@@ -20,3 +21,33 @@ def hexString(s):
"""
return ":".join("{:02x}".format(ord(c)) for c in s)
def readableMods(__mods):
"""
Return a string with readable std mods.
Used to convert a mods number for oppai
__mods -- mods bitwise number
return -- readable mods string, eg HDDT
"""
r = ""
if __mods == 0:
return r
if __mods & mods.NoFail > 0:
r += "NF"
if __mods & mods.Easy > 0:
r += "EZ"
if __mods & mods.Hidden > 0:
r += "HD"
if __mods & mods.HardRock > 0:
r += "HR"
if __mods & mods.DoubleTime > 0:
r += "DT"
if __mods & mods.HalfTime > 0:
r += "HT"
if __mods & mods.Flashlight > 0:
r += "FL"
if __mods & mods.SpunOut > 0:
r += "SO"
return r

View File

@@ -110,7 +110,7 @@ def packData(__data, __dataType):
# Non empty string
data += b"\x0B"
data += uleb128Encode(len(__data))
data += str.encode(__data, "latin_1")
data += str.encode(__data, "utf-8")
elif __dataType == dataTypes.uInt16:
packType = "<H"
elif __dataType == dataTypes.sInt16: