Fix weird stat drop anim (#3870)

* Fix weird stat drop anim

* PACKED define
This commit is contained in:
DizzyEggg 2023-12-30 22:53:46 +01:00 committed by GitHub
parent 00e7038061
commit 726c6f48e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 15 deletions

View file

@ -17,6 +17,7 @@
#endif
#define ALIGNED(n) __attribute__((aligned(n)))
#define PACKED __attribute__((packed))
#define SOUND_INFO_PTR (*(struct SoundInfo **)0x3007FF0)
#define INTR_CHECK (*(u16 *)0x3007FF8)

View file

@ -41,7 +41,7 @@ struct BgCnt
u16 screenBaseBlock:5;
u16 areaOverflowMode:1;
u16 screenSize:2;
};
} PACKED;
typedef volatile struct BgCnt vBgCnt;
struct PlttData

View file

@ -42,25 +42,25 @@ void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value)
switch (attributeId)
{
case BG_ANIM_SCREEN_SIZE:
((struct BgCnt *)&bgCnt)->screenSize = value;
((vBgCnt *)&bgCnt)->screenSize = value;
break;
case BG_ANIM_AREA_OVERFLOW_MODE:
((struct BgCnt *)&bgCnt)->areaOverflowMode = value;
((vBgCnt *)&bgCnt)->areaOverflowMode = value;
break;
case BG_ANIM_MOSAIC:
((struct BgCnt *)&bgCnt)->mosaic = value;
((vBgCnt *)&bgCnt)->mosaic = value;
break;
case BG_ANIM_CHAR_BASE_BLOCK:
((struct BgCnt *)&bgCnt)->charBaseBlock = value;
((vBgCnt *)&bgCnt)->charBaseBlock = value;
break;
case BG_ANIM_PRIORITY:
((struct BgCnt *)&bgCnt)->priority = value;
((vBgCnt *)&bgCnt)->priority = value;
break;
case BG_ANIM_PALETTES_MODE:
((struct BgCnt *)&bgCnt)->palettes = value;
((vBgCnt *)&bgCnt)->palettes = value;
break;
case BG_ANIM_SCREEN_BASE_BLOCK:
((struct BgCnt *)&bgCnt)->screenBaseBlock = value;
((vBgCnt *)&bgCnt)->screenBaseBlock = value;
break;
}
@ -78,19 +78,19 @@ int GetAnimBgAttribute(u8 bgId, u8 attributeId)
switch (attributeId)
{
case BG_ANIM_SCREEN_SIZE:
return ((struct BgCnt *)&bgCnt)->screenSize;
return ((vBgCnt *)&bgCnt)->screenSize;
case BG_ANIM_AREA_OVERFLOW_MODE:
return ((struct BgCnt *)&bgCnt)->areaOverflowMode;
return ((vBgCnt *)&bgCnt)->areaOverflowMode;
case BG_ANIM_MOSAIC:
return ((struct BgCnt *)&bgCnt)->mosaic;
return ((vBgCnt *)&bgCnt)->mosaic;
case BG_ANIM_CHAR_BASE_BLOCK:
return ((struct BgCnt *)&bgCnt)->charBaseBlock;
return ((vBgCnt *)&bgCnt)->charBaseBlock;
case BG_ANIM_PRIORITY:
return ((struct BgCnt *)&bgCnt)->priority;
return ((vBgCnt *)&bgCnt)->priority;
case BG_ANIM_PALETTES_MODE:
return ((struct BgCnt *)&bgCnt)->palettes;
return ((vBgCnt *)&bgCnt)->palettes;
case BG_ANIM_SCREEN_BASE_BLOCK:
return ((struct BgCnt *)&bgCnt)->screenBaseBlock;
return ((vBgCnt *)&bgCnt)->screenBaseBlock;
}
}