mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-03 06:24:30 +00:00
Change Colors To Decimal (#260)
* fix colliderinit typo * convert as many colors i can find to decimal * fix GPACK_RGBA5551, merge fhgFire * fix remaining colors * remove unwanted file * alpha as 1
This commit is contained in:
parent
bc14f6d93e
commit
24ab14f748
71 changed files with 771 additions and 743 deletions
32
tools/rgba5551.py
Executable file
32
tools/rgba5551.py
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
|
||||
def decode_rgba5551(short, max=False):
|
||||
red = (short & 0xF800) >> 8
|
||||
green = (short & 0x07C0) >> 3
|
||||
blue = (short & 0x003E) << 2
|
||||
alpha = 1 if (short % 2) else 0
|
||||
if max:
|
||||
red |= red >> 5
|
||||
green |= green >> 5
|
||||
blue |= blue >> 5
|
||||
return (red, green, blue, alpha)
|
||||
|
||||
def u16(x):
|
||||
x = int(x, 16)
|
||||
if x > 0xFFFF:
|
||||
raise argparse.ArgumentTypeError("expecting a short (u16) representing a single color.")
|
||||
return x
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Decodes a color encoded in rgba5551.")
|
||||
parser.add_argument("short", type=u16, help="u16 raw value of the color to decode")
|
||||
args = parser.parse_args()
|
||||
print("Min: GPACK_RGBA5551(%d, %d, %d, %d)" % decode_rgba5551(args.short, max=False))
|
||||
print("Max: GPACK_RGBA5551(%d, %d, %d, %d)" % decode_rgba5551(args.short, max=True))
|
||||
print("Note: All RGB values between these encode to the given value.")
|
||||
print(" Use the representation that makes the most sense.\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue