mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-23 13:09:56 +00:00
Palette cleanup
This commit is contained in:
parent
fd89ecf865
commit
14a51f514b
@ -4,10 +4,10 @@
|
||||
#include "structs/rgb.h"
|
||||
|
||||
void InitBGPaletteBuffer(void);
|
||||
void nullsub_4(s32 index, const u8 *colorArray, s32, u8 *);
|
||||
void nullsub_5(s32 index, const Rgb32 *colorArray);
|
||||
void SetBGPaletteBufferColorArray(s32 index, const Rgb32 *color32);
|
||||
void SetBGPaletteBufferColorRGB(s32 index, const u8 *colorArray, s32, u8 *);
|
||||
void nullsub_4(s32 index, const Rgb32 *color, s32 brightness, const Rgb32 *ramp);
|
||||
void nullsub_5(s32 index, const Rgb32 *color);
|
||||
void SetBGPaletteBufferColorArray(s32 index, const Rgb32 *color);
|
||||
void SetBGPaletteBufferColorRGB(s32 index, const Rgb32 *color, s32 brightness, const Rgb32 *ramp);
|
||||
void TransferBGPaletteBuffer(void);
|
||||
|
||||
#endif // GUARD_BG_PALETTE_BUFFER_H
|
||||
|
@ -42,7 +42,7 @@ typedef struct unkDataFor8004AA4
|
||||
|
||||
void nullsub_6(void);
|
||||
void sub_8004AA4(unkStruct_202EE8C *, OpenedFile *, s32);
|
||||
bool8 sub_8004AF0(bool8, unkStruct_202EE8C *, s32, s32, s32, u8 *);
|
||||
bool8 sub_8004AF0(bool8, unkStruct_202EE8C *, s32, s32, s32, const Rgb32 *);
|
||||
bool8 sub_8004D14(unkStruct_202EE8C *, s32);
|
||||
bool8 sub_8004D40(unkStruct_202EE8C *, s32);
|
||||
|
||||
|
@ -1,15 +1,17 @@
|
||||
#ifndef GUARD_CODE_800558C_H
|
||||
#define GUARD_CODE_800558C_H
|
||||
|
||||
#include "structs/rgb.h"
|
||||
#include "structs/axdata.h"
|
||||
#include "file_system.h"
|
||||
|
||||
// size: ? 0x20 for now
|
||||
struct unkStructFor800561C
|
||||
struct axMapSprite
|
||||
{
|
||||
u8 fill0[0x14 - 0x0];
|
||||
void *unk14;
|
||||
s32 *unk18;
|
||||
s32 unk1C;
|
||||
axmain axmain;
|
||||
const u32 *tiles;
|
||||
const Rgb32 *pal;
|
||||
s32 tileCount;
|
||||
};
|
||||
|
||||
extern s16 *gUnknown_203B078;
|
||||
@ -21,10 +23,10 @@ void nullsub_10(bool8);
|
||||
void nullsub_12(void);
|
||||
void nullsub_13(void);
|
||||
void nullsub_14(void);
|
||||
void sub_8005610(OpenedFile *, s32, s32, u8 *);
|
||||
void sub_8005770(s32, u8 *colorArray, s32, u8 *);
|
||||
void sub_8005610(OpenedFile *, s32, s32, const Rgb32 *);
|
||||
void sub_8005770(s32, const Rgb32 *color, s32, const Rgb32 *ramp);
|
||||
void sub_80057E8(void);
|
||||
void sub_8005838(s32 *, u8 kind);
|
||||
void sub_80060EC(void);
|
||||
|
||||
#endif // GUARD_CODE_800558C_H
|
||||
#endif // GUARD_CODE_800558C_H
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "structs/dungeon_entity.h"
|
||||
#include "file_system.h"
|
||||
#include "structs/map.h"
|
||||
#include "structs/rgb.h"
|
||||
#include "structs/str_position.h"
|
||||
#include "sprite.h"
|
||||
|
||||
@ -23,15 +24,6 @@ typedef struct DungeonLocation
|
||||
/* 0x1 */ u8 floor;
|
||||
} DungeonLocation;
|
||||
|
||||
// size: 0x4
|
||||
// This might be "RGB"... see `SetDungeonBGColorRGB()`
|
||||
typedef struct Dungeon_sub
|
||||
{
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
} Dungeon_sub;
|
||||
|
||||
typedef struct Weather
|
||||
{
|
||||
/* 0xE264 */ u8 weather; // Uses the weather constants in weather.h.
|
||||
@ -267,7 +259,7 @@ typedef struct Dungeon
|
||||
Entity *unkBC;
|
||||
u8 fillC0[0x134 - 0xC0];
|
||||
struct unkStruct_Dungeon134_sub unk134;
|
||||
Dungeon_sub unk17C[0x100];
|
||||
Rgb32 colorRamp[0x100];
|
||||
/* 0x57C */ u8 fill57C[0x5C0 - 0x57c];
|
||||
/* 0x5C0 */ s32 unk5C0;
|
||||
/* 0x5C4 */ struct unkStruct_Dungeon5C4_sub unk5C4[3];
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include "cpu.h"
|
||||
|
||||
#define BG_PALETTE_BUFFER_SIZE 512
|
||||
#define BG_PALETTE_BUFFER_CHUNK_SIZE 16
|
||||
#define BG_PALETTE_ROW_SIZE 16
|
||||
|
||||
static EWRAM_DATA bool8 sBGPaletteUsed[BG_PALETTE_BUFFER_SIZE / BG_PALETTE_BUFFER_CHUNK_SIZE] = {0};
|
||||
static EWRAM_DATA bool8 sBGPaletteRowDirty[BG_PALETTE_BUFFER_SIZE / BG_PALETTE_ROW_SIZE] = {0};
|
||||
static EWRAM_DATA u16 sBGPaletteBuffer[BG_PALETTE_BUFFER_SIZE] = {0};
|
||||
|
||||
void InitBGPaletteBuffer(void)
|
||||
@ -16,46 +16,47 @@ void InitBGPaletteBuffer(void)
|
||||
sBGPaletteBuffer[i] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < BG_PALETTE_BUFFER_SIZE / BG_PALETTE_BUFFER_CHUNK_SIZE; i++) {
|
||||
sBGPaletteUsed[i] = TRUE;
|
||||
for (i = 0; i < BG_PALETTE_BUFFER_SIZE / BG_PALETTE_ROW_SIZE; i++) {
|
||||
sBGPaletteRowDirty[i] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// 99.48% (r3/r4 regswap) https://decomp.me/scratch/7Yc8i
|
||||
void SetBGPaletteBufferColorRGB(s32 index, const u8 *colorArray, s32 a1, u8 *a2)
|
||||
void SetBGPaletteBufferColorRGB(s32 index, const Rgb32 *color, s32 brightnessRaw, const Rgb32 *ramp)
|
||||
{
|
||||
#ifdef NONMATCHING
|
||||
s32 var;
|
||||
#else
|
||||
register s32 var asm("r1");
|
||||
#endif // NONMATCHING
|
||||
s32 brightness = brightnessRaw;
|
||||
|
||||
if (a1 < 0)
|
||||
a1 = 0;
|
||||
if (a1 > 31)
|
||||
a1 = 31;
|
||||
if (brightness < 0)
|
||||
brightness = 0;
|
||||
if (brightness > 31)
|
||||
brightness = 31;
|
||||
|
||||
sBGPaletteUsed[index / 16] = 1;
|
||||
sBGPaletteRowDirty[index / BG_PALETTE_ROW_SIZE] = TRUE;
|
||||
|
||||
if (a2 == NULL)
|
||||
sBGPaletteBuffer[index] = var = ((colorArray[2] * a1 / 256 & 0x1F) << 10) | ((colorArray[1] * a1 / 256 & 0x1F) << 5) | (colorArray[0] * a1 / 256 & 0x1F);
|
||||
if (ramp == NULL)
|
||||
sBGPaletteBuffer[index] = RGB2(
|
||||
color->r * brightness / 256 & 0x1F,
|
||||
color->g * brightness / 256 & 0x1F,
|
||||
color->b * brightness / 256 & 0x1F);
|
||||
else
|
||||
sBGPaletteBuffer[index] = var = ((a2[4 * colorArray[2] + 2] * a1 / 256 & 0x1F) << 10) | ((a2[4 * colorArray[1] + 1] * a1 / 256 & 0x1F) << 5) | (a2[4 * colorArray[0]] * a1 / 256 & 0x1F);
|
||||
sBGPaletteBuffer[index] = RGB2(
|
||||
ramp[color->r].r * brightness / 256 & 0x1F,
|
||||
ramp[color->g].g * brightness / 256 & 0x1F,
|
||||
ramp[color->b].b * brightness / 256 & 0x1F);
|
||||
}
|
||||
|
||||
void SetBGPaletteBufferColorArray(s32 index, const Rgb32 *color32)
|
||||
{
|
||||
sBGPaletteUsed[index / BG_PALETTE_BUFFER_CHUNK_SIZE] = TRUE;
|
||||
sBGPaletteRowDirty[index / BG_PALETTE_ROW_SIZE] = TRUE;
|
||||
sBGPaletteBuffer[index] = RGB2(color32->r >> 3, color32->g >> 3, color32->b >> 3);
|
||||
}
|
||||
|
||||
void SetBGPaletteBufferColor(s32 index, u16 *color)
|
||||
{
|
||||
sBGPaletteUsed[index / BG_PALETTE_BUFFER_CHUNK_SIZE] = TRUE;
|
||||
sBGPaletteRowDirty[index / BG_PALETTE_ROW_SIZE] = TRUE;
|
||||
sBGPaletteBuffer[index] = *color;
|
||||
}
|
||||
|
||||
void nullsub_4(s32 index, const u8 *colorArray, s32 a1, u8 *a2)
|
||||
void nullsub_4(s32 index, const Rgb32 *colorArray, s32 brightness, const Rgb32 *ramp)
|
||||
{
|
||||
}
|
||||
|
||||
@ -78,14 +79,14 @@ void TransferBGPaletteBuffer(void)
|
||||
dest = (u16 *)PLTT;
|
||||
do
|
||||
{
|
||||
if (sBGPaletteUsed[i])
|
||||
if (sBGPaletteRowDirty[i])
|
||||
{
|
||||
sBGPaletteUsed[i] = 0;
|
||||
CpuCopy(dest, &sBGPaletteBuffer[paletteBufferIndex], sizeof(u16) * 16);
|
||||
sBGPaletteRowDirty[i] = 0;
|
||||
CpuCopy(dest, &sBGPaletteBuffer[paletteBufferIndex], sizeof(u16) * BG_PALETTE_ROW_SIZE);
|
||||
}
|
||||
++i;
|
||||
dest += 16;
|
||||
paletteBufferIndex += 16;
|
||||
dest += BG_PALETTE_ROW_SIZE;
|
||||
paletteBufferIndex += BG_PALETTE_ROW_SIZE;
|
||||
}
|
||||
while (paletteBufferIndex < BG_PALETTE_BUFFER_SIZE);
|
||||
}
|
||||
|
16
src/code_2.c
16
src/code_2.c
@ -44,7 +44,7 @@ extern void xxx_call_update_bg_vram(void);
|
||||
|
||||
extern u32 gUnknown_203B03C;
|
||||
extern u16 gUnknown_2026E4E;
|
||||
extern s32 gUnknown_2000A80;
|
||||
extern s32 gTitleBrightness;
|
||||
extern OpenedFile *gTitlePaletteFile;
|
||||
|
||||
extern char gPMDBuildVersion[];
|
||||
@ -103,12 +103,12 @@ void GameLoop(void)
|
||||
LoadTitleScreen();
|
||||
SetBG2RegOffsets(0, 0);
|
||||
SetBG3RegOffsets(0, 0);
|
||||
gUnknown_2000A80 = 0;
|
||||
while (gUnknown_2000A80 < 32) {
|
||||
gTitleBrightness = 0;
|
||||
while (gTitleBrightness < 32) {
|
||||
s32 i;
|
||||
gUnknown_2000A80++;
|
||||
gTitleBrightness++;
|
||||
for (i = 0; i < 240; i++)
|
||||
SetBGPaletteBufferColorRGB(i, &gTitlePaletteFile->data[i * 4], gUnknown_2000A80, 0);
|
||||
SetBGPaletteBufferColorRGB(i, &((Rgb32*)gTitlePaletteFile->data)[i], gTitleBrightness, NULL);
|
||||
xxx_update_stuff(0);
|
||||
}
|
||||
if (tmp3) {
|
||||
@ -145,11 +145,11 @@ void GameLoop(void)
|
||||
if (nextMenu == MENU_NEW_GAME) break;
|
||||
}
|
||||
DeleteMainMenu();
|
||||
while (gUnknown_2000A80 > 0) {
|
||||
while (gTitleBrightness > 0) {
|
||||
s32 i;
|
||||
gUnknown_2000A80--;
|
||||
gTitleBrightness--;
|
||||
for (i = 0; i < 240; i++)
|
||||
SetBGPaletteBufferColorRGB(i, &gTitlePaletteFile->data[i * 4], gUnknown_2000A80, 0);
|
||||
SetBGPaletteBufferColorRGB(i, &((Rgb32*)gTitlePaletteFile->data)[i], gTitleBrightness, NULL);
|
||||
xxx_update_stuff(0);
|
||||
}
|
||||
CloseFile(gTitlePaletteFile);
|
||||
|
@ -31,7 +31,7 @@ void sub_8004AA4(unkStruct_202EE8C *a0, OpenedFile *a1, s32 a2)
|
||||
}
|
||||
}
|
||||
|
||||
bool8 sub_8004AF0(bool8 a0, unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4, u8 *a5)
|
||||
bool8 sub_8004AF0(bool8 a0, unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4, const Rgb32 *a5)
|
||||
{
|
||||
bool8 bVar3;
|
||||
bool8 ret;
|
||||
@ -57,13 +57,13 @@ bool8 sub_8004AF0(bool8 a0, unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4, u8 *a
|
||||
}
|
||||
|
||||
if (bVar3)
|
||||
SetBGPaletteBufferColorRGB(a2, (u8 *)&a1->unk14, a4, a5);
|
||||
SetBGPaletteBufferColorRGB(a2, &a1->unk14, a4, a5);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
UNUSED static bool8 sub_8004B78(bool8 a0, unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4, u8 *a5)
|
||||
UNUSED static bool8 sub_8004B78(bool8 a0, unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4, const Rgb32 *a5)
|
||||
{
|
||||
bool8 bVar3;
|
||||
bool8 ret;
|
||||
@ -89,13 +89,13 @@ UNUSED static bool8 sub_8004B78(bool8 a0, unkStruct_202EE8C *a1, s32 a2, s32 a3,
|
||||
}
|
||||
|
||||
if (bVar3)
|
||||
nullsub_4(a2, (u8 *)&a1->unk14, a4, a5);
|
||||
nullsub_4(a2, &a1->unk14, a4, a5);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool8 sub_8004C00(unkStruct_202EE8C *a0, s32 a1, s32 a2, s32 a3, u8 *a4, s16 *a5)
|
||||
bool8 sub_8004C00(unkStruct_202EE8C *a0, s32 a1, s32 a2, s32 a3, const Rgb32 *a4, s16 *a5)
|
||||
{
|
||||
bool8 ret;
|
||||
s32 i;
|
||||
@ -153,7 +153,7 @@ bool8 sub_8004C00(unkStruct_202EE8C *a0, s32 a1, s32 a2, s32 a3, u8 *a4, s16 *a5
|
||||
color32 &= 0xFF00FFFF;
|
||||
color32 |= val3;
|
||||
|
||||
SetBGPaletteBufferColorRGB(a1, (u8 *)&color32, a3, a4);
|
||||
SetBGPaletteBufferColorRGB(a1, (Rgb32 *)&color32, a3, a4);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -31,8 +31,8 @@ extern const s16 gUnknown_80B83EA[16 * 10];
|
||||
extern s32 sin_abs_4096(s32);
|
||||
extern s32 cos_4096(s32);
|
||||
|
||||
static void sub_800561C(struct unkStructFor800561C *, s32, s32, u8 *);
|
||||
s32 *sub_8005674(struct unkStructFor800561C *, s32);
|
||||
static void sub_800561C(struct axMapSprite *, s32, s32, const Rgb32 *);
|
||||
const Rgb32 *sub_8005674(struct axMapSprite *, s32);
|
||||
|
||||
void DoAxFrame_800558C(struct axObject *a0, s32 spriteX, s32 spriteY, u32 a3, u32 paletteNum, u16 *spriteMasks)
|
||||
{
|
||||
@ -56,35 +56,35 @@ void DoAxFrame_800558C(struct axObject *a0, s32 spriteX, s32 spriteY, u32 a3, u3
|
||||
a0->axdata.flags &= 0xF7FF;
|
||||
}
|
||||
|
||||
void sub_8005610(OpenedFile *a0, s32 a1, s32 a2, u8 *a3)
|
||||
void sub_8005610(OpenedFile *a0, s32 vramIdx, s32 brightness, const Rgb32 *ramp)
|
||||
{
|
||||
sub_800561C((struct unkStructFor800561C *)a0->data, a1, a2, a3);
|
||||
sub_800561C((struct axMapSprite *)a0->data, vramIdx, brightness, ramp);
|
||||
}
|
||||
|
||||
static void sub_800561C(struct unkStructFor800561C *a0, s32 a1, s32 a2, u8 *a3)
|
||||
static void sub_800561C(struct axMapSprite *a0, s32 vramIdx, s32 brightness, const Rgb32 *ramp)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
if (a0->unk14 != NULL)
|
||||
CpuCopy(OBJ_VRAM0 + a1 * 0x20, a0->unk14, a0->unk1C << 5);
|
||||
if (a0->tiles != NULL)
|
||||
CpuCopy(OBJ_VRAM0 + vramIdx * 0x20, a0->tiles, a0->tileCount * 0x20);
|
||||
|
||||
if (a0->unk18 != NULL) {
|
||||
if (a0->pal != NULL) {
|
||||
for (i = 0; i < 16; i++)
|
||||
SetBGPaletteBufferColorRGB(i + 480, (u8 *)&a0->unk18[i], a2, a3);
|
||||
SetBGPaletteBufferColorRGB(i + 480, &a0->pal[i], brightness, ramp);
|
||||
}
|
||||
}
|
||||
|
||||
UNUSED static s32 *sub_8005668(OpenedFile *a0, s32 a1)
|
||||
UNUSED static const Rgb32 *sub_8005668(OpenedFile *a0, s32 vramIdx)
|
||||
{
|
||||
return sub_8005674((struct unkStructFor800561C *)a0->data, a1);
|
||||
return sub_8005674((struct axMapSprite *)a0->data, vramIdx);
|
||||
}
|
||||
|
||||
s32 *sub_8005674(struct unkStructFor800561C *a0, s32 a1)
|
||||
const Rgb32 *sub_8005674(struct axMapSprite *a0, s32 vramIdx)
|
||||
{
|
||||
if (a0->unk14 != NULL)
|
||||
CpuCopy(OBJ_VRAM0 + a1 * 0x20, a0->unk14, a0->unk1C << 5);
|
||||
if (a0->tiles != NULL)
|
||||
CpuCopy(OBJ_VRAM0 + vramIdx * 0x20, a0->tiles, a0->tileCount * 0x20);
|
||||
|
||||
return a0->unk18;
|
||||
return a0->pal;
|
||||
}
|
||||
|
||||
void sub_800569C(Position *a0, struct axObject *a1, u8 a2)
|
||||
@ -149,17 +149,17 @@ void sub_8005700(Position *a0, struct axObject *a1)
|
||||
}
|
||||
}
|
||||
|
||||
UNUSED static void sub_8005764(s32 a0, OpenedFile *file, s32 a2, u8 *a3)
|
||||
UNUSED static void sub_8005764(s32 a0, OpenedFile *file, s32 a2, const Rgb32 *a3)
|
||||
{
|
||||
sub_8005770(a0, file->data, a2, a3);
|
||||
sub_8005770(a0, (const Rgb32*)file->data, a2, a3);
|
||||
}
|
||||
|
||||
void sub_8005770(s32 param_1, u8 *colorArray, s32 a1, u8 *a2)
|
||||
void sub_8005770(s32 param_1, const Rgb32 *color, s32 brightness, const Rgb32 *ramp)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
SetBGPaletteBufferColorRGB((param_1 + 0x10) * 0x10 + i, &colorArray[i * 4], a1, a2);
|
||||
SetBGPaletteBufferColorRGB((param_1 + 0x10) * 0x10 + i, &color[i], brightness, ramp);
|
||||
}
|
||||
|
||||
// Maybe Position
|
||||
|
@ -87,7 +87,7 @@ void sub_803E490(u32 unused)
|
||||
|
||||
|
||||
if(gDungeon->unk181e8.unk18215 != 0 && gDungeon->unk1BDD4.unk1C06C != 3)
|
||||
sub_8004AF0(gUnknown_203B40D, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (u8 *)gDungeon->unk17C);
|
||||
sub_8004AF0(gUnknown_203B40D, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
|
||||
nullsub_8(gGameOptionsRef->unkA);
|
||||
sub_8005180();
|
||||
|
@ -37,13 +37,13 @@ struct DungeonPalFile
|
||||
extern struct DungeonPalFile *gDungeonPaletteFile;
|
||||
extern struct DungeonPalFile *gDungeonNameBannerPalette;
|
||||
extern struct DungeonPalFile *gUnknown_202EC94;
|
||||
extern u8 gUnknown_202ECA4[];
|
||||
extern u8 gUnknown_202D058[];
|
||||
extern Rgb32 gUnknown_202ECA4[];
|
||||
extern Rgb32 gUnknown_202D058;
|
||||
extern u8 gUnknown_203B40C;
|
||||
extern MenuInputStruct gUnknown_202EE10;
|
||||
extern SpriteOAM gUnknown_202EDDC;
|
||||
|
||||
extern const u8 gUnknown_80F62AC[];
|
||||
extern const Rgb32 gUnknown_80F62AC;
|
||||
extern const struct UnkTextStruct2 gUnknown_80F62B0[];
|
||||
extern const struct UnkTextStruct2 gUnknown_80F6310[];
|
||||
extern const struct UnkTextStruct2 gUnknown_80F6370[];
|
||||
@ -85,52 +85,52 @@ void sub_803FF18(s32 a0, u16 *a1, bool8 a2);
|
||||
void sub_803E874(bool8 r10, s32 r9)
|
||||
{
|
||||
s32 i, index, count;
|
||||
const u8 *colorArray;
|
||||
const Rgb32 *color;
|
||||
|
||||
colorArray = gDungeonPaletteFile->unk4;
|
||||
SetBGPaletteBufferColorRGB(0, gUnknown_80F62AC, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
|
||||
colorArray += 4;
|
||||
color = gDungeonPaletteFile->unk4;
|
||||
SetBGPaletteBufferColorRGB(0, &gUnknown_80F62AC, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
color++;
|
||||
index = 1;
|
||||
count = 159;
|
||||
for (i = 0; i < count; i++) {
|
||||
SetBGPaletteBufferColorRGB(index, colorArray, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
|
||||
colorArray += 4;
|
||||
SetBGPaletteBufferColorRGB(index, color, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
color++;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (gDungeon->unk181e8.unk18215 == 0 || gDungeon->unk1BDD4.unk1C06C == 3) {
|
||||
sub_8004AF0(TRUE, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
|
||||
sub_8004AF0(TRUE, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
}
|
||||
|
||||
index += 32;
|
||||
colorArray = gUnknown_202ECA4;
|
||||
color = gUnknown_202ECA4;
|
||||
count = 32;
|
||||
for (i = 0; i < count; i++) {
|
||||
SetBGPaletteBufferColorRGB(index, colorArray, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
|
||||
colorArray += 4;
|
||||
SetBGPaletteBufferColorRGB(index, color, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
color++;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (r10) {
|
||||
index = 224;
|
||||
colorArray = gDungeonNameBannerPalette->unk4;
|
||||
color = gDungeonNameBannerPalette->unk4;
|
||||
count = 16;
|
||||
for (i = 0; i < count; i++) {
|
||||
SetBGPaletteBufferColorRGB(index, colorArray, r9, NULL);
|
||||
colorArray += 4;
|
||||
SetBGPaletteBufferColorRGB(index, color, r9, NULL);
|
||||
color++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
SetBGPaletteBufferColorRGB(248, gUnknown_202D058, gUnknown_202EDC8, NULL);
|
||||
SetBGPaletteBufferColorRGB(248, &gUnknown_202D058, gUnknown_202EDC8, NULL);
|
||||
|
||||
colorArray = ((struct DungeonPalFile*) gDungeon->paletFile)->unk4;
|
||||
color = ((struct DungeonPalFile*) gDungeon->paletFile)->unk4;
|
||||
index = 256;
|
||||
count = 208;
|
||||
for (i = 0; i < count; i++) {
|
||||
SetBGPaletteBufferColorRGB(index, colorArray, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
|
||||
nullsub_4(index, colorArray, gUnknown_202EDC8, NULL);
|
||||
colorArray += 4;
|
||||
SetBGPaletteBufferColorRGB(index, color, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
nullsub_4(index, color, gUnknown_202EDC8, NULL);
|
||||
color++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@ -138,14 +138,14 @@ void sub_803E874(bool8 r10, s32 r9)
|
||||
void BgColorCallNullsub4(void)
|
||||
{
|
||||
s32 i, index, count;
|
||||
const u8 *colorArray;
|
||||
const Rgb32 *color;
|
||||
|
||||
colorArray = ((struct DungeonPalFile*) gDungeon->paletFile)->unk4;
|
||||
color = ((struct DungeonPalFile*) gDungeon->paletFile)->unk4;
|
||||
index = 256;
|
||||
count = 208;
|
||||
for (i = 0; i < count; i++) {
|
||||
nullsub_4(index, colorArray, gUnknown_202EDC8, NULL);
|
||||
colorArray += 4;
|
||||
nullsub_4(index, color, gUnknown_202EDC8, NULL);
|
||||
color++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@ -153,33 +153,33 @@ void BgColorCallNullsub4(void)
|
||||
void sub_803EA10(void)
|
||||
{
|
||||
s32 i, index, count;
|
||||
const u8 *colorArray;
|
||||
const Rgb32 *color;
|
||||
|
||||
colorArray = gDungeonPaletteFile->unk4;
|
||||
SetBGPaletteBufferColorRGB(0, gUnknown_80F62AC, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
|
||||
colorArray += 4;
|
||||
color= gDungeonPaletteFile->unk4;
|
||||
SetBGPaletteBufferColorRGB(0, &gUnknown_80F62AC, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
color++;
|
||||
index = 1;
|
||||
count = 159;
|
||||
for (i = 0; i < count; i++) {
|
||||
SetBGPaletteBufferColorRGB(index, colorArray, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
|
||||
colorArray += 4;
|
||||
SetBGPaletteBufferColorRGB(index, color, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
color++;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (gDungeon->unk181e8.unk18215 == 0 || gDungeon->unk1BDD4.unk1C06C == 3) {
|
||||
sub_8004AF0(TRUE, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
|
||||
sub_8004AF0(TRUE, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
}
|
||||
|
||||
index += 32;
|
||||
colorArray = gUnknown_202ECA4;
|
||||
color = gUnknown_202ECA4;
|
||||
count = 32;
|
||||
for (i = 0; i < count; i++) {
|
||||
SetBGPaletteBufferColorRGB(index, colorArray, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
|
||||
colorArray += 4;
|
||||
SetBGPaletteBufferColorRGB(index, color, gUnknown_202EDC8, gDungeon->colorRamp);
|
||||
color++;
|
||||
index++;
|
||||
}
|
||||
|
||||
SetBGPaletteBufferColorRGB(248, gUnknown_202D058, gUnknown_202EDC8, NULL);
|
||||
SetBGPaletteBufferColorRGB(248, &gUnknown_202D058, gUnknown_202EDC8, NULL);
|
||||
}
|
||||
|
||||
void sub_803EAF0(u32 a0, u8 *a1)
|
||||
|
@ -51,8 +51,8 @@ void sub_807E5E4(u8 weather)
|
||||
gDungeon->weather.waterSportTurns = 0;
|
||||
for(index = 0; index < 0x100; index++)
|
||||
{
|
||||
gDungeon->unk17C[index].unk0 = index;
|
||||
gDungeon->unk17C[index].unk1 = index;
|
||||
gDungeon->unk17C[index].unk2 = index;
|
||||
gDungeon->colorRamp[index].r = index;
|
||||
gDungeon->colorRamp[index].g = index;
|
||||
gDungeon->colorRamp[index].b = index;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
.include "src/m4a.o"
|
||||
|
||||
gUnknown_2000A80: /* 2000A80 (GameLoop) */
|
||||
gTitleBrightness: /* 2000A80 (GameLoop) */
|
||||
.space 0x8
|
||||
|
||||
gScriptVarBuffer: /* 2000A88 (ThoroughlyResetScriptVars - RestoreGlobalScriptVars) */
|
||||
|
23
tmp/rgb.cocci
Normal file
23
tmp/rgb.cocci
Normal file
@ -0,0 +1,23 @@
|
||||
@@
|
||||
RGB e;
|
||||
RGB *ep;
|
||||
@@
|
||||
(
|
||||
- e.unk0
|
||||
+ e.r
|
||||
|
|
||||
- e.unk1
|
||||
+ e.g
|
||||
|
|
||||
- e.unk2
|
||||
+ e.b
|
||||
|
|
||||
- ep->unk0
|
||||
+ ep->r
|
||||
|
|
||||
- ep->unk1
|
||||
+ ep->g
|
||||
|
|
||||
- ep->unk2
|
||||
+ ep->b
|
||||
)
|
Loading…
Reference in New Issue
Block a user