Match RoomUpdateHatchFlashingAnimation

This commit is contained in:
YohannDR 2023-01-28 15:42:10 +01:00
parent f53b173f6c
commit 18db4877c4
9 changed files with 108 additions and 11 deletions

View File

@ -591,12 +591,24 @@ weapons/PistolBottom.gfx;512;0x32b278;1
weapons/PistolChargedTop.gfx;512;0x32b478;1
weapons/PistolChargedBottom.gfx;512;0x32b678;1
# Common
common/CommonTiles.gfx;4096;0x5d940c;1
common/CommonTilesMotherShip.gfx;4096;0x5da40c;1
common/CommonTilemap.tt;832;0x3655a0;2
common/CommonTiles.pal;15;0x5dfe22;2
common/DoorTransition.pal;241;0x5dfe40;2
common/CommonTilesMotherShip.pal;15;0x5e0022;2
common/DoorTransitionMotherShip.pal;240;0x5e0040;2
common/HatchFlashingMotherShip.pal;256;0x5e0220;2
common/HatchFlashing.pal;256;0x5e0420;2
# Misc
EscapeTimerDigits.gfx;2048;0x33d794;1
CommonTiles.gfx;4096;0x5d940c;1
CommonTilesMotherShip.gfx;4096;0x5da40c;1
CommonTilemap.tt;832;0x3655a0;2
# Blobs

View File

@ -314,7 +314,7 @@
#define CLIPDATA_TILEMAP_SUPER_MISSILE_DOOR_TOP_LEFT 0x96
#define CLIPDATA_TILEMAP_SUPER_MISSILE_DOOR_TOP_RIGHT 0x97
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_TOP_LEFT 0x98
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_TOP_RIGHT 0x98
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_TOP_RIGHT 0x99
#define CLIPDATA_TILEMAP_NO_HATCH_DOOR_TOP_LEFT 0x9A
#define CLIPDATA_TILEMAP_NO_HATCH_DOOR_TOP_RIGHT 0x9B
@ -327,7 +327,7 @@
#define CLIPDATA_TILEMAP_SUPER_MISSILE_DOOR_MIDDLE_TOP_LEFT 0xA6
#define CLIPDATA_TILEMAP_SUPER_MISSILE_DOOR_MIDDLE_TOP_RIGHT 0xA7
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_MIDDLE_TOP_LEFT 0xA8
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_MIDDLE_TOP_RIGHT 0xA8
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_MIDDLE_TOP_RIGHT 0xA9
#define CLIPDATA_TILEMAP_NO_HATCH_DOOR_MIDDLE_TOP_LEFT 0xAA
#define CLIPDATA_TILEMAP_NO_HATCH_DOOR_MIDDLE_TOP_RIGHT 0xAB
@ -340,7 +340,7 @@
#define CLIPDATA_TILEMAP_SUPER_MISSILE_DOOR_MIDDLE_BOTTOM_LEFT 0xB6
#define CLIPDATA_TILEMAP_SUPER_MISSILE_DOOR_MIDDLE_BOTTOM_RIGHT 0xB7
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_MIDDLE_BOTTOM_LEFT 0xB8
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_MIDDLE_BOTTOM_RIGHT 0xB8
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_MIDDLE_BOTTOM_RIGHT 0xB9
#define CLIPDATA_TILEMAP_NO_HATCH_DOOR_MIDDLE_BOTTOM_LEFT 0xBA
#define CLIPDATA_TILEMAP_NO_HATCH_DOOR_MIDDLE_BOTTOM_RIGHT 0xBB
@ -353,7 +353,7 @@
#define CLIPDATA_TILEMAP_SUPER_MISSILE_DOOR_BOTTOM_LEFT 0xC6
#define CLIPDATA_TILEMAP_SUPER_MISSILE_DOOR_BOTTOM_RIGHT 0xC7
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_BOTTOM_LEFT 0xC8
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_BOTTOM_RIGHT 0xC8
#define CLIPDATA_TILEMAP_POWER_BOMB_DOOR_BOTTOM_RIGHT 0xC9
#define CLIPDATA_TILEMAP_NO_HATCH_DOOR_BOTTOM_LEFT 0xCA
#define CLIPDATA_TILEMAP_NO_HATCH_DOOR_BOTTOM_RIGHT 0xCB

View File

@ -0,0 +1,15 @@
#ifndef DATA_COMMON_PALS_H
#define DATA_COMMON_PALS_H
#include "types.h"
extern const u16 sCommonTilesPAL[15];
extern const u16 sDoorTransitionPAL[241];
extern const u16 sCommonTilesMotherShipPAL[15];
extern const u16 sDoorTransitionMotherShipPAL[240];
extern const u16 sHatchFlashingMotherShipPAL[256];
extern const u16 sHatchFlashingPAL[256];
#endif /* DATA_COMMON_PALS_H */

View File

@ -81,6 +81,15 @@ struct HatchesState {
u16 unk2;
};
struct HatchFlashingAnimation {
u8 unlocking_delay;
i8 unlocking_paletteRow;
// Assumed to be left over from fusion (navigation doors)
u8 navigation_delay;
i8 navigation_paletteRow;
};
#define MAX_AMOUNT_OF_HATCHES 16
#define MAX_AMOUNT_OF_AREAS 8
#define MAX_AMOUNT_OF_HATCH_TYPES 8
@ -103,4 +112,6 @@ extern struct HatchData gHatchData[MAX_AMOUNT_OF_HATCHES];
extern struct LastElevatorUsed gLastElevatorUsed;
extern u8 gNumberOfValidHatchesInRoom;
extern struct HatchFlashingAnimation gHatchFlashingAnimation;
#endif

View File

@ -199,5 +199,5 @@ const u16 sClipdataBehaviorTypes[176] = {
[CLIPDATA_STRONG_LAVA] = CLIP_BEHAVIOR_STRONG_LAVA,
};
const u8 sCommonTilesGFX[4096] = INCBIN_U8("data/CommonTiles.gfx");
const u8 sCommonTilesMothershipGFX[4096] = INCBIN_U8("data/CommonTilesMotherShip.gfx");
const u8 sCommonTilesGFX[4096] = INCBIN_U8("data/common/CommonTiles.gfx");
const u8 sCommonTilesMothershipGFX[4096] = INCBIN_U8("data/common/CommonTilesMotherShip.gfx");

View File

@ -129,7 +129,7 @@ const u16 sClipdataCollisionTypes_Tilemap[208] = {
[CLIPDATA_TILEMAP_NO_HATCH_DOOR_TOP_LEFT] = CLIPDATA_TYPE_DOOR, // 0x9A
};
const u16 sCommonTilemap[832] = INCBIN_U16("data/CommonTilemap.tt");
const u16 sCommonTilemap[832] = INCBIN_U16("data/common/CommonTilemap.tt");
const u16 sClipdataCollisionTypes_Debug[160] = {
[CLIPDATA_DEBUG_AIR] = CLIPDATA_TYPE_AIR, // 0x0

12
src/data/common_pals.c Normal file
View File

@ -0,0 +1,12 @@
#include "data/common_pals.h"
#include "macros.h"
const u16 sCommonTilesPAL[15] = INCBIN_U16("data/common/CommonTiles.pal");
const u16 sDoorTransitionPAL[241] = INCBIN_U16("data/common/DoorTransition.pal");
const u16 sCommonTilesMotherShipPAL[15] = INCBIN_U16("data/common/CommonTilesMotherShip.pal");
const u16 sDoorTransitionMotherShipPAL[240] = INCBIN_U16("data/common/DoorTransitionMotherShip.pal");
const u16 sHatchFlashingMotherShipPAL[256] = INCBIN_U16("data/common/HatchFlashingMotherShip.pal");
const u16 sHatchFlashingPAL[256] = INCBIN_U16("data/common/HatchFlashing.pal");

View File

@ -3,6 +3,7 @@
#include "data/engine_pointers.h"
#include "data/empty_datatypes.h"
#include "data/common_pals.h"
#include "constants/audio.h"
#include "constants/clipdata.h"
@ -709,9 +710,54 @@ void RoomUpdateAnimatedGraphicsAndPalettes(void)
}
}
/**
* @brief 56ef4 | dc | Updates the hatches flashing animation
*
*/
void RoomUpdateHatchFlashingAnimation(void)
{
const u16* pPalette;
if (gGameModeSub1 != SUB_GAME_MODE_PLAYING)
return;
// Get palette pointer
if (gUseMotherShipDoors)
pPalette = sHatchFlashingMotherShipPAL;
else
pPalette = sHatchFlashingPAL;
// Update hatches that unlocked
if (gHatchesState.unlocking)
{
gHatchFlashingAnimation.unlocking_delay++;
if (gHatchFlashingAnimation.unlocking_delay > 7)
{
gHatchFlashingAnimation.unlocking_delay = 0;
gHatchFlashingAnimation.unlocking_paletteRow++;
if (gHatchFlashingAnimation.unlocking_paletteRow > 5)
gHatchFlashingAnimation.unlocking_paletteRow = 0;
DMATransfer(3, &pPalette[gHatchFlashingAnimation.unlocking_paletteRow * 16 + 6], PALRAM_BASE + 0x2C, 4, 0x10);
}
}
// Left over code?
if (gHatchesState.unk)
{
gHatchFlashingAnimation.navigation_delay++;
if (gHatchFlashingAnimation.navigation_delay > 7)
{
gHatchFlashingAnimation.navigation_delay = 0;
gHatchFlashingAnimation.navigation_paletteRow++;
if (gHatchFlashingAnimation.navigation_paletteRow > 5)
gHatchFlashingAnimation.navigation_paletteRow = 0;
dma_set(3, &pPalette[gHatchFlashingAnimation.navigation_paletteRow * 16 + 6], PALRAM_BASE + 0x4C, DMA_ENABLE << 16 | 2);
}
}
}
/**

View File

@ -7,7 +7,8 @@ DATA_PATH = "data/"
subDirs: array = [
"sprites/",
"hud/",
"weapons/"
"weapons/",
"common/"
]
try: