Combine LCD bg structs

This commit is contained in:
Marcus Huderle 2020-08-15 15:13:20 -05:00
parent f782111cba
commit c01a1898c8
8 changed files with 35 additions and 30 deletions

View File

@ -4,19 +4,25 @@
#include "global.h" #include "global.h"
typedef struct { typedef struct {
u16 lcdControl2; u16 displayControl;
u16 unk2; u8 filler2[0x2];
u16 unk4; u16 unk4;
u16 unk6; u16 unk6;
} LcdControls; } LcdControls;
typedef struct { typedef struct {
u16 bg0Control; u16 bg0Control;
u16 bg1Control;
u16 bg2Control;
u16 bg3Control;
u16 bg0xOffset; u16 bg0xOffset;
u16 bg0yOffset; u16 bg0yOffset;
u16 bg0Updated; u16 bg1xOffset;
u16 unk; u16 bg1yOffset;
u16 unk2; u16 bg2xOffset;
u16 bg2yOffset;
u16 bg3xOffset;
u16 bg3yOffset;
} BgSettings; } BgSettings;
typedef struct { typedef struct {
@ -64,8 +70,7 @@ typedef struct {
typedef struct { typedef struct {
/*0x00*/ LcdControls lcd; /*0x00*/ LcdControls lcd;
/*0x08*/ BgSettings bg1; /*0x08*/ BgSettings bg;
/*0x14*/ BgSettings bg2;
/*0x20*/ BgAffSettings affine; /*0x20*/ BgAffSettings affine;
/*0x38*/ BgControls controls; /*0x38*/ BgControls controls;
} Screen; } Screen;

View File

@ -62,7 +62,7 @@ void sub_0804AB04(void)
void sub_0804AB24(void) void sub_0804AB24(void)
{ {
if (!gFadeControl.active) { if (!gFadeControl.active) {
gScreen.lcd.lcdControl2 = 0; gScreen.lcd.displayControl = 0;
sub_0801E104(); sub_0801E104();
gArea.filler[8] = 0; gArea.filler[8] = 0;
MenuFadeIn(6, 0); MenuFadeIn(6, 0);

View File

@ -107,8 +107,8 @@ static void HandleNintendoCapcomLogos(void)
paletteGroup = 2; paletteGroup = 2;
} }
LoadPaletteGroup(paletteGroup); LoadPaletteGroup(paletteGroup);
gScreen.lcd.lcdControl2 |= 0x400; gScreen.lcd.displayControl |= 0x400;
gScreen.bg2.bg0Updated = 1; gScreen.bg.bg2yOffset = 1;
DoFade(6, 8); DoFade(6, 8);
advance = ADVANCE_NONE; advance = ADVANCE_NONE;
} else { } else {
@ -154,20 +154,20 @@ static void HandleTitlescreen(void)
if (((struct_02000000*)0x2000000)->gameLanguage == 0) { if (((struct_02000000*)0x2000000)->gameLanguage == 0) {
gScreen.controls.layerFXControl = 0x844; gScreen.controls.layerFXControl = 0x844;
gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9); gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9);
gScreen.bg2.bg0Control = 0x1c09; gScreen.bg.bg1xOffset = 0x1c09;
gScreen.affine.bg2Control = 0x1d02; gScreen.affine.bg2Control = 0x1d02;
gScreen.affine.bg3Control = 0x1e03; gScreen.affine.bg3Control = 0x1e03;
gScreen.lcd.lcdControl2 |= 0x1e00; gScreen.lcd.displayControl |= 0x1e00;
gScreen.bg2.bg0yOffset = 0xff60; gScreen.bg.bg2xOffset = 0xff60;
} }
else { else {
gScreen.controls.layerFXControl = 0x241; gScreen.controls.layerFXControl = 0x241;
gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9); gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9);
gScreen.bg1.bg0Control = 0x1d02; gScreen.bg.bg0Control = 0x1d02;
gScreen.bg2.bg0Control = 0x1E03; gScreen.bg.bg1xOffset = 0x1E03;
gScreen.affine.bg2Control = 0x7C89; gScreen.affine.bg2Control = 0x7C89;
gScreen.lcd.lcdControl2 |= 1; gScreen.lcd.displayControl |= 1;
gScreen.lcd.lcdControl2 |= 0x1300; gScreen.lcd.displayControl |= 0x1300;
gIntroState.swordBgScaleRatio = 0x10; gIntroState.swordBgScaleRatio = 0x10;
UpdateSwordBgAffineData(); UpdateSwordBgAffineData();
} }
@ -251,13 +251,13 @@ static void HandleJapaneseTitlescreenAnimationIntro(void)
case 0: case 0:
if (!gFadeControl.active) { if (!gFadeControl.active) {
if ((gIntroState.counter & 1) == 0) { if ((gIntroState.counter & 1) == 0) {
gScreen.bg2.bg0yOffset++; gScreen.bg.bg2xOffset++;
} }
if (GetAdvanceState() == ADVANCE_KEY_PRESSED || gScreen.bg2.bg0yOffset == 0) { if (GetAdvanceState() == ADVANCE_KEY_PRESSED || gScreen.bg.bg2xOffset == 0) {
gIntroState.subState++; gIntroState.subState++;
gScreen.bg2.bg0yOffset = 0; gScreen.bg.bg2xOffset = 0;
gScreen.bg2.bg0Control = 0xc09; gScreen.bg.bg1xOffset = 0xc09;
gFadeControl.field_0x4 = 0x40; gFadeControl.field_0x4 = 0x40;
DoFade(6, 0x10); DoFade(6, 0x10);
PlaySFX(0xf8); PlaySFX(0xf8);
@ -289,7 +289,7 @@ static void HandleTitlescreenAnimationIntro(void) {
case 0: case 0:
if (!gFadeControl.active) { if (!gFadeControl.active) {
gIntroState.subState = 1; gIntroState.subState = 1;
gScreen.lcd.lcdControl2 |= 0x400; gScreen.lcd.displayControl |= 0x400;
PlaySFX(0xF6); PlaySFX(0xF6);
} }
break; break;

View File

@ -44,7 +44,7 @@ void sub_080570B8(Entity *this)
void sub_080570F8(void) void sub_080570F8(void)
{ {
gScreen.lcd.lcdControl2 &= 0xf7ff; gScreen.lcd.displayControl &= 0xf7ff;
gScreen.controls.layerFXControl = 0; gScreen.controls.layerFXControl = 0;
sub_08056250(); sub_08056250();
} }
@ -57,7 +57,7 @@ void sub_08057118(Entity *this)
((u8 *)&this->field_0x20)[2] = 0; ((u8 *)&this->field_0x20)[2] = 0;
this->action = 1; this->action = 1;
gScreen.affine.bg3Control = 0x1e04; gScreen.affine.bg3Control = 0x1e04;
gScreen.lcd.lcdControl2 |= 0x800; gScreen.lcd.displayControl |= 0x800;
gScreen.controls.layerFXControl = 0x3648; gScreen.controls.layerFXControl = 0x3648;
gScreen.controls.alphaBlend = 0x1000; gScreen.controls.alphaBlend = 0x1000;
sub_08052D74(this, sub_080570B8, sub_080570F8); sub_08052D74(this, sub_080570B8, sub_080570F8);

View File

@ -11,7 +11,7 @@ void Manager2(Entity *this)
if (this->action == 0) { if (this->action == 0) {
this->action = 1; this->action = 1;
gScreen.affine.unk4 = 0; gScreen.affine.unk4 = 0;
gScreen.bg2.bg0Updated = 0; gScreen.bg.bg2yOffset = 0;
sub_08052D74(this, sub_080576A0, 0); sub_08052D74(this, sub_080576A0, 0);
} }
sub_0805754C(this); sub_0805754C(this);

View File

@ -2423,7 +2423,7 @@ void sub_0804CED8(void) {
if (CheckGlobalFlag(LV2_CLEAR)) { if (CheckGlobalFlag(LV2_CLEAR)) {
gUnk_0200B650 = 0; gUnk_0200B650 = 0;
gScreen.lcd.lcdControl2 &= 0xfdff; gScreen.lcd.displayControl &= 0xfdff;
sub_0807AABC(&gPlayerEntity); sub_0807AABC(&gPlayerEntity);
LoadRoomEntityList(&gUnk_080E1814); LoadRoomEntityList(&gUnk_080E1814);
} else { } else {

View File

@ -46,7 +46,7 @@ void DoFade(u32 fadeType, u32 fadeSpeed)
} }
if ((fadeType & 8) != 0) { if ((fadeType & 8) != 0) {
gUnk_03000000.spritesOffset = 1; gUnk_03000000.spritesOffset = 1;
gScreen.bg2.bg0Control |= 0x40; gScreen.bg.bg1xOffset |= 0x40;
gScreen.affine.bg2Control |= 0x40; gScreen.affine.bg2Control |= 0x40;
gScreen.affine.bg3Control |= 0x40; gScreen.affine.bg3Control |= 0x40;
} }

View File

@ -45,11 +45,11 @@ void sub_080A3BD0(void)
iVar1 = min(iVar1, 6); iVar1 = min(iVar1, 6);
LoadGfxGroup(iVar1 + 0x76); LoadGfxGroup(iVar1 + 0x76);
gScreen.lcd.lcdControl2 |= 0x1e00; gScreen.lcd.displayControl |= 0x1e00;
gScreen.bg2.bg0Control = 0x1c01; gScreen.bg.bg1xOffset = 0x1c01;
gScreen.affine.bg2Control = 0x1d02; gScreen.affine.bg2Control = 0x1d02;
gScreen.affine.bg3Control = 0x1e0b; gScreen.affine.bg3Control = 0x1e0b;
gScreen.bg2.bg0Updated = 1; gScreen.bg.bg2yOffset = 1;
gScreen.affine.unk = 1; gScreen.affine.unk = 1;
gScreen.affine.unk4 = 1; gScreen.affine.unk4 = 1;
sub_080A4528(); sub_080A4528();