mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-12 14:01:59 -04:00
Fix problem with negative item colors, which mostly come from the java version.
This commit is contained in:
parent
3eb3e2b358
commit
89438a2e2a
@ -38,7 +38,7 @@ const Material = struct {
|
|||||||
const colors = json.getChild("colors");
|
const colors = json.getChild("colors");
|
||||||
self.colorPalette = try allocator.alloc(Color, colors.JsonArray.items.len);
|
self.colorPalette = try allocator.alloc(Color, colors.JsonArray.items.len);
|
||||||
for(colors.JsonArray.items, self.colorPalette) |item, *color| {
|
for(colors.JsonArray.items, self.colorPalette) |item, *color| {
|
||||||
const colorInt = item.as(u32, 0xff000000);
|
const colorInt: u32 = @intCast(item.as(i64, 0xff000000) & 0xffffffff);
|
||||||
color.* = Color {
|
color.* = Color {
|
||||||
.r = @intCast(colorInt>>16 & 0xff),
|
.r = @intCast(colorInt>>16 & 0xff),
|
||||||
.g = @intCast(colorInt>>8 & 0xff),
|
.g = @intCast(colorInt>>8 & 0xff),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user