diff --git a/src/code_80091750.c b/src/code_80091750.c index 6f9e4156f..f738433f6 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -4311,7 +4311,7 @@ void func_8009A9FC(s32 arg0, s32 arg1, u32 arg2, s32 arg3) { color0 = &D_8018D9B0[D_8018E118[arg0].offset]; color1 = &D_8018D9B0[D_8018E118[arg1].offset]; for (var_t1 = 0; (u32) var_t1 < arg2; var_t1++) { - temp_a0 = *color0++; + temp_a0 = BSWAP16(*color0++); red = (temp_a0 & 0xF800) >> 0xB; green = (temp_a0 & 0x7C0) >> 6; blue = (temp_a0 & 0x3E) >> 1; @@ -4321,7 +4321,7 @@ void func_8009A9FC(s32 arg0, s32 arg1, u32 arg2, s32 arg3) { newred = (((((temp_t9 - red) * arg3) >> 8) + red) << 0xB); newgreen = (((((((temp_t9 * 7) / 8) - green) * arg3) >> 8) + green) << 6); newblue = (((((((temp_t9 * 6) / 8) - blue) * arg3) >> 8) + blue) << 1); - *color1++ = newblue + newgreen + newred + alpha; + *color1++ = BSWAP16(newblue + newgreen + newred + alpha); } } @@ -4339,16 +4339,17 @@ void func_8009AB7C(s32 arg0) { color = &D_8018D9B0[D_8018E118[arg0].offset]; for (var_v1 = 0; var_v1 < 0x4B000; var_v1++) { - red = ((*color & 0xF800) >> 0xB) * 0x4D; - green = ((*color & 0x7C0) >> 6) * 0x96; - blue = ((*color & 0x3E) >> 1) * 0x1D; - alpha = *color & 0x1; + u16 color_pixel = BSWAP16(*color); + red = ((color_pixel & 0xF800) >> 0xB) * 0x4D; + green = ((color_pixel & 0x7C0) >> 6) * 0x96; + blue = ((color_pixel & 0x3E) >> 1) * 0x1D; + alpha = color_pixel & 0x1; temp_t9 = red + green + blue; temp_t9 >>= 8; newred = temp_t9 << 0xB; newgreen = temp_t9 << 6; newblue = temp_t9 << 1; - *color++ = newblue + newgreen + newred + alpha; + *color++ = BSWAP16(newblue + newgreen + newred + alpha); } } @@ -4369,14 +4370,15 @@ void func_8009AD78(s32 arg0, s32 arg1) { color = &D_8018D9B0[D_8018E118[arg0].offset]; size = D_8018E118[arg0 + 1].offset - D_8018E118[arg0].offset; for (var_v1 = 0; var_v1 != size; var_v1++) { - red = ((*color & 0xF800) >> 0xB) * 0x4D; - green = ((*color & 0x7C0) >> 6) * 0x96; - blue = ((*color & 0x3E) >> 1) * 0x1D; - alpha = *color & 0x1; + u16 color_pixel = BSWAP16(*color); + red = ((color_pixel & 0xF800) >> 0xB) * 0x4D; + green = ((color_pixel & 0x7C0) >> 6) * 0x96; + blue = ((color_pixel & 0x3E) >> 1) * 0x1D; + alpha = color_pixel & 0x1; temp_t9 = red + green + blue; temp_t9 = temp_t9 >> 8; temp_t9 += ((0x20 - temp_t9) * arg1) >> 8; - *color++ = (temp_t9 << 1) + (temp_t9 << 6) + (temp_t9 << 0xB) + alpha; + *color++ = BSWAP16((temp_t9 << 1) + (temp_t9 << 6) + (temp_t9 << 0xB) + alpha); } } @@ -4397,17 +4399,18 @@ void func_8009B0A4(s32 arg0, u32 arg1) { color = &D_8018D9B0[D_8018E118[arg0].offset]; size = D_8018E118[arg0 + 1].offset - D_8018E118[arg0].offset; for (var_s0 = 0; var_s0 < (u32) size; var_s0++) { - red = ((*color & 0xF800) >> 0xB) * 0x55; - green = ((*color & 0x7C0) >> 6) * 0x4B; - blue = ((*color & 0x3E) >> 1) * 0x5F; - alpha = *color & 0x1; + u16 color_pixel = BSWAP16(*color); + red = ((color_pixel & 0xF800) >> 0xB) * 0x55; + green = ((color_pixel & 0x7C0) >> 6) * 0x4B; + blue = ((color_pixel & 0x3E) >> 1) * 0x5F; + alpha = color_pixel & 0x1; temp_t9 = red + green + blue; temp_t9 >>= 8; temp_t9 = sp48[temp_t9] * 32.0f; if (temp_t9 >= 0x20) { temp_t9 = 0x1F; } - *color++ = (temp_t9 << 1) + (temp_t9 << 6) + (temp_t9 << 0xB) + alpha; + *color++ = BSWAP16((temp_t9 << 1) + (temp_t9 << 6) + (temp_t9 << 0xB) + alpha); } } @@ -4425,16 +4428,17 @@ void func_8009B538(s32 arg0, s32 screen_size, s32 arg2, s32 arg3, s32 arg4) { color = &D_8018D9B0[D_8018E118[arg0].offset]; for (var_v1 = 0; var_v1 < screen_size; var_v1++) { - red = ((*color & 0xF800) >> 0xB) * 0x4D; - green = ((*color & 0x7C0) >> 6) * 0x96; - blue = ((*color & 0x3E) >> 1) * 0x1D; - alpha = *color & 0x1; + u16 color_pixel = BSWAP16(*color); + red = ((color_pixel & 0xF800) >> 0xB) * 0x4D; + green = ((color_pixel & 0x7C0) >> 6) * 0x96; + blue = ((color_pixel & 0x3E) >> 1) * 0x1D; + alpha = (color_pixel & 0x1); temp_t9 = red + green + blue; temp_t9 = temp_t9 >> 8; newred = ((temp_t9 * arg2) >> 8) << 0xB; newgreen = ((temp_t9 * arg3) >> 8) << 6; newblue = ((temp_t9 * arg4) >> 8) << 1; - *color++ = newred + newgreen + newblue + alpha;; + *color++ = BSWAP16(newred + newgreen + newblue + alpha); } }