mirror of https://github.com/zeldaret/tmc.git
				
				
				
			Combine LCD bg structs
This commit is contained in:
		
							parent
							
								
									f782111cba
								
							
						
					
					
						commit
						c01a1898c8
					
				| 
						 | 
				
			
			@ -4,19 +4,25 @@
 | 
			
		|||
#include "global.h"
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    u16 lcdControl2;
 | 
			
		||||
    u16 unk2;
 | 
			
		||||
    u16 displayControl;
 | 
			
		||||
    u8 filler2[0x2];
 | 
			
		||||
    u16 unk4;
 | 
			
		||||
    u16 unk6;
 | 
			
		||||
} LcdControls;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    u16 bg0Control;
 | 
			
		||||
    u16 bg1Control;
 | 
			
		||||
    u16 bg2Control;
 | 
			
		||||
    u16 bg3Control;
 | 
			
		||||
    u16 bg0xOffset;
 | 
			
		||||
    u16 bg0yOffset;
 | 
			
		||||
    u16 bg0Updated;
 | 
			
		||||
    u16 unk;
 | 
			
		||||
    u16 unk2;
 | 
			
		||||
    u16 bg1xOffset;
 | 
			
		||||
    u16 bg1yOffset;
 | 
			
		||||
    u16 bg2xOffset;
 | 
			
		||||
    u16 bg2yOffset;
 | 
			
		||||
    u16 bg3xOffset;
 | 
			
		||||
    u16 bg3yOffset;
 | 
			
		||||
} BgSettings;
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
| 
						 | 
				
			
			@ -64,8 +70,7 @@ typedef struct {
 | 
			
		|||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    /*0x00*/ LcdControls lcd;
 | 
			
		||||
    /*0x08*/ BgSettings bg1;
 | 
			
		||||
    /*0x14*/ BgSettings bg2;
 | 
			
		||||
    /*0x08*/ BgSettings bg;
 | 
			
		||||
    /*0x20*/ BgAffSettings affine;
 | 
			
		||||
    /*0x38*/ BgControls controls;
 | 
			
		||||
} Screen;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,7 +62,7 @@ void sub_0804AB04(void)
 | 
			
		|||
void sub_0804AB24(void)
 | 
			
		||||
{
 | 
			
		||||
  if (!gFadeControl.active) {
 | 
			
		||||
    gScreen.lcd.lcdControl2 = 0;
 | 
			
		||||
    gScreen.lcd.displayControl = 0;
 | 
			
		||||
    sub_0801E104();
 | 
			
		||||
    gArea.filler[8] = 0;
 | 
			
		||||
    MenuFadeIn(6, 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,8 +107,8 @@ static void HandleNintendoCapcomLogos(void)
 | 
			
		|||
            paletteGroup = 2;
 | 
			
		||||
        }
 | 
			
		||||
        LoadPaletteGroup(paletteGroup);
 | 
			
		||||
        gScreen.lcd.lcdControl2 |= 0x400;
 | 
			
		||||
        gScreen.bg2.bg0Updated = 1;
 | 
			
		||||
        gScreen.lcd.displayControl |= 0x400;
 | 
			
		||||
        gScreen.bg.bg2yOffset = 1;
 | 
			
		||||
        DoFade(6, 8);
 | 
			
		||||
        advance = ADVANCE_NONE;
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -154,20 +154,20 @@ static void HandleTitlescreen(void)
 | 
			
		|||
            if (((struct_02000000*)0x2000000)->gameLanguage == 0) {
 | 
			
		||||
                gScreen.controls.layerFXControl = 0x844;
 | 
			
		||||
                gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9);
 | 
			
		||||
                gScreen.bg2.bg0Control = 0x1c09;
 | 
			
		||||
                gScreen.bg.bg1xOffset = 0x1c09;
 | 
			
		||||
                gScreen.affine.bg2Control = 0x1d02;
 | 
			
		||||
                gScreen.affine.bg3Control = 0x1e03;
 | 
			
		||||
                gScreen.lcd.lcdControl2 |= 0x1e00;
 | 
			
		||||
                gScreen.bg2.bg0yOffset = 0xff60;
 | 
			
		||||
                gScreen.lcd.displayControl |= 0x1e00;
 | 
			
		||||
                gScreen.bg.bg2xOffset = 0xff60;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                gScreen.controls.layerFXControl = 0x241;
 | 
			
		||||
                gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9);
 | 
			
		||||
                gScreen.bg1.bg0Control = 0x1d02;
 | 
			
		||||
                gScreen.bg2.bg0Control = 0x1E03;
 | 
			
		||||
                gScreen.bg.bg0Control = 0x1d02;
 | 
			
		||||
                gScreen.bg.bg1xOffset = 0x1E03;
 | 
			
		||||
                gScreen.affine.bg2Control = 0x7C89;
 | 
			
		||||
                gScreen.lcd.lcdControl2 |= 1;
 | 
			
		||||
                gScreen.lcd.lcdControl2 |= 0x1300;
 | 
			
		||||
                gScreen.lcd.displayControl |= 1;
 | 
			
		||||
                gScreen.lcd.displayControl |= 0x1300;
 | 
			
		||||
                gIntroState.swordBgScaleRatio = 0x10;
 | 
			
		||||
                UpdateSwordBgAffineData();
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -251,13 +251,13 @@ static void HandleJapaneseTitlescreenAnimationIntro(void)
 | 
			
		|||
        case 0:
 | 
			
		||||
            if (!gFadeControl.active) {
 | 
			
		||||
                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++;
 | 
			
		||||
                    gScreen.bg2.bg0yOffset = 0;
 | 
			
		||||
                    gScreen.bg2.bg0Control = 0xc09;
 | 
			
		||||
                    gScreen.bg.bg2xOffset = 0;
 | 
			
		||||
                    gScreen.bg.bg1xOffset = 0xc09;
 | 
			
		||||
                    gFadeControl.field_0x4 = 0x40;
 | 
			
		||||
                    DoFade(6, 0x10);
 | 
			
		||||
                    PlaySFX(0xf8);
 | 
			
		||||
| 
						 | 
				
			
			@ -289,7 +289,7 @@ static void HandleTitlescreenAnimationIntro(void) {
 | 
			
		|||
        case 0:
 | 
			
		||||
            if (!gFadeControl.active) {
 | 
			
		||||
                gIntroState.subState = 1;
 | 
			
		||||
                gScreen.lcd.lcdControl2 |= 0x400;
 | 
			
		||||
                gScreen.lcd.displayControl |= 0x400;
 | 
			
		||||
                PlaySFX(0xF6);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,7 @@ void sub_080570B8(Entity *this)
 | 
			
		|||
 | 
			
		||||
void sub_080570F8(void)
 | 
			
		||||
{
 | 
			
		||||
  gScreen.lcd.lcdControl2 &= 0xf7ff;
 | 
			
		||||
  gScreen.lcd.displayControl &= 0xf7ff;
 | 
			
		||||
  gScreen.controls.layerFXControl = 0;
 | 
			
		||||
  sub_08056250();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ void sub_08057118(Entity *this)
 | 
			
		|||
  ((u8 *)&this->field_0x20)[2] = 0;
 | 
			
		||||
  this->action = 1;
 | 
			
		||||
  gScreen.affine.bg3Control = 0x1e04;
 | 
			
		||||
  gScreen.lcd.lcdControl2 |= 0x800;
 | 
			
		||||
  gScreen.lcd.displayControl |= 0x800;
 | 
			
		||||
  gScreen.controls.layerFXControl = 0x3648;
 | 
			
		||||
  gScreen.controls.alphaBlend = 0x1000;
 | 
			
		||||
  sub_08052D74(this, sub_080570B8, sub_080570F8);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ void Manager2(Entity *this)
 | 
			
		|||
  if (this->action == 0) {
 | 
			
		||||
    this->action = 1;
 | 
			
		||||
    gScreen.affine.unk4 = 0;
 | 
			
		||||
    gScreen.bg2.bg0Updated = 0;
 | 
			
		||||
    gScreen.bg.bg2yOffset = 0;
 | 
			
		||||
    sub_08052D74(this, sub_080576A0, 0);
 | 
			
		||||
  }
 | 
			
		||||
  sub_0805754C(this);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2423,7 +2423,7 @@ void sub_0804CED8(void) {
 | 
			
		|||
 | 
			
		||||
    if (CheckGlobalFlag(LV2_CLEAR)) {
 | 
			
		||||
        gUnk_0200B650 = 0;
 | 
			
		||||
        gScreen.lcd.lcdControl2 &= 0xfdff;
 | 
			
		||||
        gScreen.lcd.displayControl &= 0xfdff;
 | 
			
		||||
        sub_0807AABC(&gPlayerEntity);
 | 
			
		||||
        LoadRoomEntityList(&gUnk_080E1814);
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ void DoFade(u32 fadeType, u32 fadeSpeed)
 | 
			
		|||
  }
 | 
			
		||||
  if ((fadeType & 8) != 0) {
 | 
			
		||||
    gUnk_03000000.spritesOffset = 1;
 | 
			
		||||
    gScreen.bg2.bg0Control |= 0x40;
 | 
			
		||||
    gScreen.bg.bg1xOffset |= 0x40;
 | 
			
		||||
    gScreen.affine.bg2Control |= 0x40;
 | 
			
		||||
    gScreen.affine.bg3Control |= 0x40;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,11 +45,11 @@ void sub_080A3BD0(void)
 | 
			
		|||
  iVar1 = min(iVar1, 6);
 | 
			
		||||
 | 
			
		||||
  LoadGfxGroup(iVar1 + 0x76);
 | 
			
		||||
  gScreen.lcd.lcdControl2 |= 0x1e00;
 | 
			
		||||
  gScreen.bg2.bg0Control = 0x1c01;
 | 
			
		||||
  gScreen.lcd.displayControl |= 0x1e00;
 | 
			
		||||
  gScreen.bg.bg1xOffset = 0x1c01;
 | 
			
		||||
  gScreen.affine.bg2Control = 0x1d02;
 | 
			
		||||
  gScreen.affine.bg3Control = 0x1e0b;
 | 
			
		||||
  gScreen.bg2.bg0Updated = 1;
 | 
			
		||||
  gScreen.bg.bg2yOffset = 1;
 | 
			
		||||
  gScreen.affine.unk = 1;
 | 
			
		||||
  gScreen.affine.unk4 = 1;
 | 
			
		||||
  sub_080A4528();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue