[ZScript] Unexpected results from color math
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
[ZScript] Unexpected results from color math
Multiplying/dividing a color by a scalar has some unexpected results. I would have assumed it'd go component by component, but instead what it does is run the operation on the whole unsigned int. What this means is that, for example, halving pure white (FF FF FF) results in light cyan (7F FF FF) instead of gray (7F 7F 7F). Should this be corrected?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [ZScript] Unexpected results from color math
A color is just an integer internally. The fact that you can extract the channels separately does not change this. It's very much what the internal PalEntry represents, that also applies to the features it exposes.