mirror of
https://github.com/YohannDR/mzm.git
synced 2024-11-23 04:59:40 +00:00
Animated graphics cleanup
This commit is contained in:
parent
b8ca6824c3
commit
a0e6e668aa
@ -1,28 +1,43 @@
|
||||
#define BACKGROUND_EFFECT_NONE 0
|
||||
#define BACKGROUND_EFFECT_LIGHTNING 1
|
||||
#define BACKGROUND_EFFECT_SLIGHT_YELLOW 2
|
||||
#define BACKGROUND_EFFECT_HEAVY_YELLOW 3
|
||||
#define BACKGROUND_EFFECT_EXIT_ZEBES_FADE 4
|
||||
#define BACKGROUND_EFFECT_INTRO_TEXT_FADE 5
|
||||
#define BACKGROUND_EFFECT_QUICK_FLASH 6
|
||||
#define BACKGROUND_EFFECT_ALL_BLACK 7
|
||||
#define BACKGROUND_EFFECT_ALL_WHITE 8
|
||||
#ifndef ANIMATED_GRAPHICS_CONSTANTS_H
|
||||
#define ANIMATED_GRAPHICS_CONSTANTS_H
|
||||
|
||||
#define BACKGROUND_EFFECT_COMMAND_WAIT_FOR_TIMER 0
|
||||
#define BACKGROUND_EFFECT_COMMAND_WAIT_FOR_TIMER_RANDOM 1
|
||||
#define BACKGROUND_EFFECT_COMMAND_WAIT_FOR_TIMER_BEFORE 2
|
||||
#define BACKGROUND_EFFECT_COMMAND_CHECK_APPLY_FIRST_COLOR 3
|
||||
#define BACKGROUND_EFFECT_COMMAND_CHECK_APPLY_SECOND_COLOR 4
|
||||
#define BACKGROUND_EFFECT_COMMAND_PLAY_SOUND 5
|
||||
#define BACKGROUND_EFFECT_COMMAND_END_AND_KILL 6
|
||||
#define BACKGROUND_EFFECT_COMMAND_END 7
|
||||
#define BACKGROUND_EFFECT_COMMAND_END_EXIT_ZEBES 8
|
||||
#define BACKGROUND_EFFECT_COMMAND_END_BEFORE_INTRO_TEXT 9
|
||||
enum BackgroundEffectNum {
|
||||
BACKGROUND_EFFECT_NONE,
|
||||
BACKGROUND_EFFECT_LIGHTNING,
|
||||
BACKGROUND_EFFECT_SLIGHT_YELLOW,
|
||||
BACKGROUND_EFFECT_HEAVY_YELLOW,
|
||||
BACKGROUND_EFFECT_EXIT_ZEBES_FADE,
|
||||
BACKGROUND_EFFECT_INTRO_TEXT_FADE,
|
||||
BACKGROUND_EFFECT_QUICK_FLASH,
|
||||
BACKGROUND_EFFECT_ALL_BLACK,
|
||||
BACKGROUND_EFFECT_ALL_WHITE,
|
||||
|
||||
#define ANIMATED_PALETTE_TYPE_NONE 0
|
||||
#define ANIMATED_PALETTE_TYPE_NORMAL 1
|
||||
#define ANIMATED_PALETTE_TYPE_ALTERNATE 2
|
||||
#define ANIMATED_PALETTE_TYPE_REVERSE 3
|
||||
BACKGROUND_EFFECT_END
|
||||
};
|
||||
|
||||
enum BackgroundEffectCommand {
|
||||
BACKGROUND_EFFECT_CMD_WAIT_FOR_TIMER,
|
||||
BACKGROUND_EFFECT_CMD_WAIT_FOR_TIMER_RANDOM,
|
||||
BACKGROUND_EFFECT_CMD_WAIT_FOR_TIMER_BEFORE,
|
||||
BACKGROUND_EFFECT_CMD_CHECK_APPLY_FIRST_COLOR,
|
||||
BACKGROUND_EFFECT_CMD_CHECK_APPLY_SECOND_COLOR,
|
||||
BACKGROUND_EFFECT_CMD_PLAY_SOUND,
|
||||
BACKGROUND_EFFECT_CMD_FINISH_AND_KILL,
|
||||
BACKGROUND_EFFECT_CMD_FINISH,
|
||||
BACKGROUND_EFFECT_CMD_FINISH_EXIT_ZEBES,
|
||||
BACKGROUND_EFFECT_CMD_FINISH_BEFORE_INTRO_TEXT,
|
||||
|
||||
BACKGROUND_EFFECT_CMD_END
|
||||
};
|
||||
|
||||
#define BACKGROUND_EFFECT_NO_COLOR (COLOR_WHITE + 1)
|
||||
|
||||
enum AnimatedPaletteType {
|
||||
ANIMATED_PALETTE_TYPE_NONE,
|
||||
ANIMATED_PALETTE_TYPE_NORMAL,
|
||||
ANIMATED_PALETTE_TYPE_ALTERNATE,
|
||||
ANIMATED_PALETTE_TYPE_REVERSE,
|
||||
};
|
||||
|
||||
#define ANIMATED_PALETTE_ID_ZIPLINE 3
|
||||
|
||||
@ -73,7 +88,9 @@
|
||||
#define ANIMATED_GFX_VRAM_END_POS(position) (ANIMATED_GFX_VRAM_END - ANIMATED_GFX_SIZE * (position))
|
||||
|
||||
#define ANIMATED_GFX_TANK_NBR 4
|
||||
#define ANIMATED_GFX_TANK_FRAME_DELAY 5
|
||||
#define ANIMATED_GFX_TANK_FRAME_DELAY (CONVERT_SECONDS(1.f / 15))
|
||||
#define ANIMATED_GFX_TANK_SIZE (ANIMATED_GFX_SIZE * ANIMATED_GFX_TANK_NBR)
|
||||
#define ANIMATED_GFX_TANK_VRAM_POS(position) (ANIMATED_GFX_VRAM_BASE + ANIMATED_GFX_SIZE * 16 + ANIMATED_GFX_SIZE / 4 + ANIMATED_GFX_SIZE * (position))
|
||||
#define ANIMATED_GFX_TANK_POS(type, frame) (ANIMATED_GFX_SIZE * ANIMATED_GFX_TANK_NBR * (type) + ANIMATED_GFX_SIZE * (frame))
|
||||
|
||||
#endif /* ANIMATED_GRAPHICS_CONSTANTS_H */
|
||||
|
@ -1,16 +1,25 @@
|
||||
#ifndef GAME_STATE_CONSTANTS_H
|
||||
#define GAME_STATE_CONSTANTS_H
|
||||
|
||||
#define PAUSE_SCREEN_NONE 0
|
||||
#define PAUSE_SCREEN_UNKNOWN_1 1
|
||||
#define PAUSE_SCREEN_PAUSE_OR_CUTSCENE 2
|
||||
#define PAUSE_SCREEN_UNKNOWN_3 3
|
||||
#define PAUSE_SCREEN_CHOZO_HINT 4
|
||||
#define PAUSE_SCREEN_MAP_DOWNLOAD 5
|
||||
#define PAUSE_SCREEN_ITEM_ACQUISITION 6
|
||||
#define PAUSE_SCREEN_SUITLESS_ITEMS 7
|
||||
#define PAUSE_SCREEN_FULLY_POWERED_SUIT_ITEMS 8
|
||||
#define PAUSE_SCREEN_UNKNOWN_9 9
|
||||
enum GameMode {
|
||||
GM_SOFTRESET,
|
||||
GM_INTRO,
|
||||
GM_TITLE,
|
||||
GM_FILE_SELECT,
|
||||
GM_INGAME,
|
||||
GM_MAP_SCREEN,
|
||||
GM_GAMEOVER,
|
||||
GM_CHOZODIA_ESCAPE,
|
||||
GM_CREDITS,
|
||||
GM_TOURIAN_ESCAPE,
|
||||
GM_CUTSCENE,
|
||||
GM_DEMO,
|
||||
GM_GALLERY,
|
||||
GM_FUSION_GALLERY,
|
||||
GM_START_SOFTRESET,
|
||||
GM_ERASE_SRAM,
|
||||
GM_DEBUG_MENU
|
||||
};
|
||||
|
||||
enum Difficulty {
|
||||
DIFF_EASY,
|
||||
@ -32,25 +41,18 @@ enum Language {
|
||||
LANGUAGE_END
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define GM_SOFTRESET 0
|
||||
#define GM_INTRO 1
|
||||
#define GM_TITLE 2
|
||||
#define GM_FILESELECT 3
|
||||
#define GM_INGAME 4
|
||||
#define GM_MAP_SCREEN 5
|
||||
#define GM_GAMEOVER 6
|
||||
#define GM_CHOZODIA_ESCAPE 7
|
||||
#define GM_CREDITS 8
|
||||
#define GM_TOURIAN_ESCAPE 9
|
||||
#define GM_CUTSCENE 10
|
||||
#define GM_DEMO 11
|
||||
#define GM_GALLERY 12
|
||||
#define GM_FUSION_GALLERY 13
|
||||
#define GM_START_SOFTRESET 14
|
||||
#define GM_ERASE_SRAM 15
|
||||
#define GM_DEBUG_MENU 16
|
||||
enum PauseScreenFlag {
|
||||
PAUSE_SCREEN_NONE,
|
||||
PAUSE_SCREEN_UNKNOWN_1,
|
||||
PAUSE_SCREEN_PAUSE_OR_CUTSCENE,
|
||||
PAUSE_SCREEN_UNKNOWN_3,
|
||||
PAUSE_SCREEN_CHOZO_HINT,
|
||||
PAUSE_SCREEN_MAP_DOWNLOAD,
|
||||
PAUSE_SCREEN_ITEM_ACQUISITION,
|
||||
PAUSE_SCREEN_SUITLESS_ITEMS,
|
||||
PAUSE_SCREEN_FULLY_POWERED_SUIT_ITEMS,
|
||||
PAUSE_SCREEN_UNKNOWN_9,
|
||||
};
|
||||
|
||||
// For in game
|
||||
|
||||
|
@ -10,12 +10,12 @@ extern const struct AnimatedPaletteData sAnimatedPaletteEntries[18];
|
||||
|
||||
extern const struct BackgroundEffectColorData sBackgroundEffectColorData[9];
|
||||
|
||||
extern const u16 sBackgroundEffectBehavior_Lightning[34][3];
|
||||
extern const u16 sBackgroundEffectBehavior_QuickFlash[12][3];
|
||||
extern const u16 sBackgroundEffectBehavior_SlightYellow[21][3];
|
||||
extern const u16 sBackgroundEffectBehavior_HeavyYellow[20][3];
|
||||
extern const u16 sBackgroundEffectBehavior_ExitZebes[30][3];
|
||||
extern const u16 sBackgroundEffectBehavior_IntroText[30][3];
|
||||
extern const u16 sBackgroundEffectBehavior_AllBlackWhite[39][3];
|
||||
extern const u16 sBackgroundEffectBehavior_Lightning[34][BACKGROUND_EFFECT_BEHAVIOR_FIELD_END];
|
||||
extern const u16 sBackgroundEffectBehavior_QuickFlash[12][BACKGROUND_EFFECT_BEHAVIOR_FIELD_END];
|
||||
extern const u16 sBackgroundEffectBehavior_SlightYellow[21][BACKGROUND_EFFECT_BEHAVIOR_FIELD_END];
|
||||
extern const u16 sBackgroundEffectBehavior_HeavyYellow[20][BACKGROUND_EFFECT_BEHAVIOR_FIELD_END];
|
||||
extern const u16 sBackgroundEffectBehavior_ExitZebes[30][BACKGROUND_EFFECT_BEHAVIOR_FIELD_END];
|
||||
extern const u16 sBackgroundEffectBehavior_IntroText[30][BACKGROUND_EFFECT_BEHAVIOR_FIELD_END];
|
||||
extern const u16 sBackgroundEffectBehavior_AllBlackWhite[39][BACKGROUND_EFFECT_BEHAVIOR_FIELD_END];
|
||||
|
||||
#endif /* ANIMATED_GFX_DATA_H */
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#include "data/demo_data.h"
|
||||
|
||||
#include "constants/animated_graphics.h"
|
||||
#include "constants/connection.h"
|
||||
#include "constants/particle.h"
|
||||
#include "constants/projectile.h"
|
||||
|
||||
#include "structs/animated_graphics.h"
|
||||
#include "structs/connection.h"
|
||||
#include "structs/projectile.h"
|
||||
#include "structs/particle.h"
|
||||
@ -45,7 +47,7 @@ extern const ColorFadingFunc_T sColorFadingSubroutinePointers[4];
|
||||
extern u8 sHazeData[13][4];
|
||||
|
||||
|
||||
extern const u16* const sBackgroundEffectBehaviorPointers[9];
|
||||
extern const BackgroundEffectBehaviorEntry_T* const sBackgroundEffectBehaviorPointers[BACKGROUND_EFFECT_END];
|
||||
|
||||
extern const struct HatchLockEvent* const sHatchLockEventsPointers[MAX_AMOUNT_OF_AREAS - 1];
|
||||
|
||||
|
@ -65,6 +65,7 @@
|
||||
#define STATIC_ASSERT(expr, id) typedef char id[(expr) ? 1 : -1];
|
||||
#define EMPTY_DO_WHILE {do {} while(0);}
|
||||
|
||||
#define COLOR_MASK 0x1F
|
||||
#define RED(c) ((c) & COLOR_MASK)
|
||||
#define GREEN(c) (((c) & (COLOR_MASK << 5)) >> 5)
|
||||
#define BLUE(c) (((c) & (COLOR_MASK << 10)) >> 10)
|
||||
@ -72,7 +73,12 @@
|
||||
#define COLOR_GRAD(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
|
||||
#define COLOR_WHITE COLOR(COLOR_MASK, COLOR_MASK, COLOR_MASK)
|
||||
#define COLOR_BLACK COLOR(0, 0, 0)
|
||||
#define COLOR_MASK 0x1F
|
||||
#define COLOR_RED COLOR(COLOR_MASK, 0, 0)
|
||||
#define COLOR_GREEN COLOR(0, COLOR_MASK, 0)
|
||||
#define COLOR_BLUE COLOR(0, 0, COLOR_MASK)
|
||||
#define COLOR_YELLOW COLOR(COLOR_MASK, COLOR_MASK, 0)
|
||||
#define COLOR_PURPLE COLOR(COLOR_MASK, 0, COLOR_MASK)
|
||||
#define COLOR_LIGHT_BLUE COLOR(0, COLOR_MASK, COLOR_MASK)
|
||||
|
||||
#define SET_BACKDROP_COLOR(color) (write16(PALRAM_BASE, (color)))
|
||||
|
||||
|
@ -54,6 +54,16 @@ struct AnimatedPaletteData {
|
||||
const u16* pPalette;
|
||||
};
|
||||
|
||||
enum BackgroundEffectBehaviorField {
|
||||
BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_TYPE,
|
||||
BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_TIMER,
|
||||
BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_ARG,
|
||||
|
||||
BACKGROUND_EFFECT_BEHAVIOR_FIELD_END
|
||||
};
|
||||
|
||||
typedef const u16 (BackgroundEffectBehaviorEntry_T)[BACKGROUND_EFFECT_BEHAVIOR_FIELD_END];
|
||||
|
||||
extern struct BackgroundEffect gBackgroundEffect;
|
||||
extern struct AnimatedTiming gTankAnimations[4];
|
||||
extern struct AnimatedGraphicsInfo gAnimatedGraphicsData[16];
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
void agbmain(void)
|
||||
{
|
||||
u8 psf;
|
||||
|
||||
InitializeGame();
|
||||
|
||||
while (TRUE)
|
||||
@ -24,8 +22,8 @@ void agbmain(void)
|
||||
UpdateInput();
|
||||
SoftresetCheck();
|
||||
|
||||
gFrameCounter8Bit++;
|
||||
gFrameCounter16Bit++;
|
||||
APPLY_DELTA_TIME_INC(gFrameCounter8Bit);
|
||||
APPLY_DELTA_TIME_INC(gFrameCounter16Bit);
|
||||
|
||||
switch (gMainGameMode)
|
||||
{
|
||||
@ -50,7 +48,7 @@ void agbmain(void)
|
||||
{
|
||||
if (gGameModeSub2 == 1)
|
||||
{
|
||||
gMainGameMode = GM_FILESELECT;
|
||||
gMainGameMode = GM_FILE_SELECT;
|
||||
}
|
||||
else if (gGameModeSub2 == 2)
|
||||
{
|
||||
@ -68,7 +66,7 @@ void agbmain(void)
|
||||
}
|
||||
break;
|
||||
|
||||
case GM_FILESELECT:
|
||||
case GM_FILE_SELECT:
|
||||
if (FileSelectMenuSubroutine())
|
||||
{
|
||||
if (gGameModeSub2 == 1)
|
||||
@ -183,13 +181,11 @@ void agbmain(void)
|
||||
if (CutsceneSubroutine())
|
||||
{
|
||||
gGameModeSub1 = 0;
|
||||
psf = gPauseScreenFlag - 7;
|
||||
if (psf <= 1)
|
||||
{
|
||||
|
||||
if (gPauseScreenFlag == PAUSE_SCREEN_SUITLESS_ITEMS || gPauseScreenFlag == PAUSE_SCREEN_FULLY_POWERED_SUIT_ITEMS)
|
||||
gMainGameMode = GM_MAP_SCREEN;
|
||||
break;
|
||||
}
|
||||
gMainGameMode = GM_INGAME;
|
||||
else
|
||||
gMainGameMode = GM_INGAME;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -220,7 +216,7 @@ void agbmain(void)
|
||||
if (GallerySubroutine())
|
||||
{
|
||||
gGameModeSub1 = 0;
|
||||
gMainGameMode = GM_FILESELECT;
|
||||
gMainGameMode = GM_FILE_SELECT;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -228,7 +224,7 @@ void agbmain(void)
|
||||
if (FusionGallerySubroutine())
|
||||
{
|
||||
gGameModeSub1 = 0;
|
||||
gMainGameMode = GM_FILESELECT;
|
||||
gMainGameMode = GM_FILE_SELECT;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -120,7 +120,7 @@ void AnimatedGraphicsUpdate(void)
|
||||
|
||||
case ANIMATED_GFX_TYPE_NORMAL:
|
||||
// Standard animation progression
|
||||
pGraphics->animationDurationCounter++;
|
||||
APPLY_DELTA_TIME_INC(pGraphics->animationDurationCounter);
|
||||
if (pGraphics->animationDurationCounter == pGraphics->framesPerState)
|
||||
{
|
||||
update = TRUE;
|
||||
@ -137,7 +137,7 @@ void AnimatedGraphicsUpdate(void)
|
||||
// Play the animation normally, but only once (no looping)
|
||||
if (pGraphics->currentAnimationFrame != pGraphics->numberOfStates - 1)
|
||||
{
|
||||
pGraphics->animationDurationCounter++;
|
||||
APPLY_DELTA_TIME_INC(pGraphics->animationDurationCounter);
|
||||
if (pGraphics->animationDurationCounter == pGraphics->framesPerState)
|
||||
{
|
||||
update = TRUE;
|
||||
@ -149,7 +149,7 @@ void AnimatedGraphicsUpdate(void)
|
||||
break;
|
||||
|
||||
case ANIMATED_GFX_TYPE_ALTERNATE:
|
||||
pGraphics->animationDurationCounter++;
|
||||
APPLY_DELTA_TIME_INC(pGraphics->animationDurationCounter);
|
||||
|
||||
if (pGraphics->animationDurationCounter == pGraphics->framesPerState)
|
||||
{
|
||||
@ -168,7 +168,7 @@ void AnimatedGraphicsUpdate(void)
|
||||
// Standard animation progression, just played backwards and played once (no looping)
|
||||
if (pGraphics->currentAnimationFrame != 0)
|
||||
{
|
||||
pGraphics->animationDurationCounter++;
|
||||
APPLY_DELTA_TIME_INC(pGraphics->animationDurationCounter);
|
||||
|
||||
if (pGraphics->animationDurationCounter == pGraphics->framesPerState)
|
||||
{
|
||||
@ -182,7 +182,7 @@ void AnimatedGraphicsUpdate(void)
|
||||
|
||||
case ANIMATED_GFX_TYPE_REVERSE:
|
||||
// Standard animation progression, just played backwards
|
||||
pGraphics->animationDurationCounter++;
|
||||
APPLY_DELTA_TIME_INC(pGraphics->animationDurationCounter);
|
||||
|
||||
if (pGraphics->animationDurationCounter == pGraphics->framesPerState)
|
||||
{
|
||||
@ -267,7 +267,7 @@ void AnimatedGraphicsLoad(void)
|
||||
src = &pGraphics->pGraphics[pGraphics->currentAnimationFrame * ANIMATED_GFX_SIZE];
|
||||
dst = ANIMATED_GFX_VRAM_POS(i);
|
||||
|
||||
DMA_SET(3, src, dst, DMA_ENABLE << 16 | ANIMATED_GFX_SIZE_16_BITS);
|
||||
DMA_SET(3, src, dst, C_32_2_16(DMA_ENABLE, ANIMATED_GFX_SIZE_16_BITS));
|
||||
|
||||
// Check enable rain sound
|
||||
if (gPauseScreenFlag == 0 && pGraphics->graphicsEntry == ANIMATED_GFX_ID_RAIN)
|
||||
@ -284,16 +284,16 @@ void AnimatedGraphicsLoad(void)
|
||||
*/
|
||||
void AnimatedGraphicsTanksAnimationReset(void)
|
||||
{
|
||||
gTankAnimations[0].timer = 1;
|
||||
gTankAnimations[0].timer = DELTA_TIME * 1;
|
||||
gTankAnimations[0].frame = 0;
|
||||
|
||||
gTankAnimations[1].timer = 2;
|
||||
gTankAnimations[1].timer = DELTA_TIME * 2;
|
||||
gTankAnimations[1].frame = 0;
|
||||
|
||||
gTankAnimations[2].timer = 3;
|
||||
gTankAnimations[2].timer = DELTA_TIME * 3;
|
||||
gTankAnimations[2].frame = 0;
|
||||
|
||||
gTankAnimations[3].timer = 4;
|
||||
gTankAnimations[3].timer = DELTA_TIME * 4;
|
||||
gTankAnimations[3].frame = 0;
|
||||
}
|
||||
|
||||
@ -308,10 +308,10 @@ void AnimatedGraphicsTanksAnimationUpdate(void)
|
||||
for (i = ARRAY_SIZE(gTankAnimations) - 1; i >= 0; i--)
|
||||
{
|
||||
// Update timer
|
||||
gTankAnimations[i].timer++;
|
||||
APPLY_DELTA_TIME_INC(gTankAnimations[i].timer);
|
||||
|
||||
// Swap animation frame every 5 frames
|
||||
if (gTankAnimations[i].timer < ANIMATED_GFX_TANK_FRAME_DELAY)
|
||||
if (gTankAnimations[i].timer <= ANIMATED_GFX_TANK_FRAME_DELAY)
|
||||
continue;
|
||||
|
||||
gTankAnimations[i].timer = 0;
|
||||
@ -352,7 +352,7 @@ void AnimatedPaletteUpdate(void)
|
||||
update = FALSE;
|
||||
|
||||
// Update timer
|
||||
gAnimatedPaletteTiming.timer++;
|
||||
APPLY_DELTA_TIME_INC(gAnimatedPaletteTiming.timer);
|
||||
|
||||
switch (sAnimatedPaletteEntries[gAnimatedGraphicsEntry.palette].type)
|
||||
{
|
||||
@ -505,8 +505,8 @@ void AnimatedGraphicsCheckPlayLightningEffect(void)
|
||||
void BackgroundEffectUpdate(void)
|
||||
{
|
||||
u16 color;
|
||||
|
||||
gBackgroundEffect.timer++;
|
||||
|
||||
APPLY_DELTA_TIME_INC(gBackgroundEffect.timer);
|
||||
|
||||
// Process
|
||||
color = BackgroundEffectProcess();
|
||||
@ -520,7 +520,7 @@ void BackgroundEffectUpdate(void)
|
||||
? sBackgroundEffectColorData[gBackgroundEffect.type].color_2
|
||||
: sBackgroundEffectColorData[gBackgroundEffect.type].color_1;
|
||||
|
||||
if (color & 0x8000)
|
||||
if (color & BACKGROUND_EFFECT_NO_COLOR)
|
||||
return;
|
||||
|
||||
// Apply on background
|
||||
@ -544,44 +544,43 @@ u16 BackgroundEffectProcess(void)
|
||||
|
||||
colorId = 0;
|
||||
|
||||
// Behavior is an array of 3 u16
|
||||
pBehavior = &sBackgroundEffectBehaviorPointers[gBackgroundEffect.type][gBackgroundEffect.stage * sizeof(u16[3]) / sizeof(u16)];
|
||||
pBehavior = sBackgroundEffectBehaviorPointers[gBackgroundEffect.type][gBackgroundEffect.stage];
|
||||
|
||||
// Execute command
|
||||
switch (pBehavior[0])
|
||||
switch (pBehavior[BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_TYPE])
|
||||
{
|
||||
case BACKGROUND_EFFECT_COMMAND_WAIT_FOR_TIMER_RANDOM:
|
||||
case BACKGROUND_EFFECT_CMD_WAIT_FOR_TIMER_RANDOM:
|
||||
// Wait for a set + random amount of time
|
||||
if (gBackgroundEffect.timer > pBehavior[1] + gFrameCounter8Bit + gFrameCounter16Bit / 16)
|
||||
if (gBackgroundEffect.timer > pBehavior[BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_TIMER] + gFrameCounter8Bit + gFrameCounter16Bit / 16)
|
||||
{
|
||||
gBackgroundEffect.stage++;
|
||||
gBackgroundEffect.timer = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case BACKGROUND_EFFECT_COMMAND_WAIT_FOR_TIMER:
|
||||
case BACKGROUND_EFFECT_CMD_WAIT_FOR_TIMER:
|
||||
// Wait for a set amount of time
|
||||
if (gBackgroundEffect.timer > pBehavior[1])
|
||||
if (gBackgroundEffect.timer > pBehavior[BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_TIMER])
|
||||
{
|
||||
gBackgroundEffect.stage++;
|
||||
gBackgroundEffect.timer = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case BACKGROUND_EFFECT_COMMAND_WAIT_FOR_TIMER_BEFORE:
|
||||
case BACKGROUND_EFFECT_CMD_WAIT_FOR_TIMER_BEFORE:
|
||||
// Wait for just before a set amount of time
|
||||
if (gBackgroundEffect.timer >= pBehavior[1] - 1)
|
||||
if (gBackgroundEffect.timer >= pBehavior[BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_TIMER] - DELTA_TIME)
|
||||
{
|
||||
gBackgroundEffect.stage++;
|
||||
gBackgroundEffect.timer = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case BACKGROUND_EFFECT_COMMAND_CHECK_APPLY_FIRST_COLOR:
|
||||
case BACKGROUND_EFFECT_CMD_CHECK_APPLY_FIRST_COLOR:
|
||||
if (gColorFading.status == 0)
|
||||
{
|
||||
// Set color stage
|
||||
gBackgroundEffect.colorStage = pBehavior[2];
|
||||
gBackgroundEffect.colorStage = pBehavior[BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_ARG];
|
||||
gBackgroundEffect.stage++;
|
||||
gBackgroundEffect.timer = 0;
|
||||
|
||||
@ -590,11 +589,11 @@ u16 BackgroundEffectProcess(void)
|
||||
}
|
||||
break;
|
||||
|
||||
case BACKGROUND_EFFECT_COMMAND_CHECK_APPLY_SECOND_COLOR:
|
||||
case BACKGROUND_EFFECT_CMD_CHECK_APPLY_SECOND_COLOR:
|
||||
if (gColorFading.status == 0)
|
||||
{
|
||||
// Set color stage
|
||||
gBackgroundEffect.colorStage = pBehavior[2];
|
||||
gBackgroundEffect.colorStage = pBehavior[BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_ARG];
|
||||
gBackgroundEffect.stage++;
|
||||
gBackgroundEffect.timer = 0;
|
||||
|
||||
@ -603,26 +602,26 @@ u16 BackgroundEffectProcess(void)
|
||||
}
|
||||
break;
|
||||
|
||||
case BACKGROUND_EFFECT_COMMAND_PLAY_SOUND:
|
||||
case BACKGROUND_EFFECT_CMD_PLAY_SOUND:
|
||||
// Play sound
|
||||
if (pBehavior[2] != 0)
|
||||
SoundPlay(pBehavior[2]);
|
||||
if (pBehavior[BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_ARG] != 0)
|
||||
SoundPlay(pBehavior[BACKGROUND_EFFECT_BEHAVIOR_FIELD_CMD_ARG]);
|
||||
|
||||
gBackgroundEffect.stage++;
|
||||
gBackgroundEffect.timer = 0;
|
||||
break;
|
||||
|
||||
case BACKGROUND_EFFECT_COMMAND_END_AND_KILL:
|
||||
case BACKGROUND_EFFECT_CMD_FINISH_AND_KILL:
|
||||
// Kill
|
||||
gBackgroundEffect.type = 0;
|
||||
|
||||
case BACKGROUND_EFFECT_COMMAND_END:
|
||||
case BACKGROUND_EFFECT_CMD_FINISH:
|
||||
// End
|
||||
gBackgroundEffect.stage = 0;
|
||||
gBackgroundEffect.timer = 0;
|
||||
break;
|
||||
|
||||
case BACKGROUND_EFFECT_COMMAND_END_EXIT_ZEBES:
|
||||
case BACKGROUND_EFFECT_CMD_FINISH_EXIT_ZEBES:
|
||||
// End
|
||||
gBackgroundEffect.type = 0;
|
||||
gBackgroundEffect.stage = 0;
|
||||
@ -633,7 +632,7 @@ u16 BackgroundEffectProcess(void)
|
||||
gGameModeSub1 = 3;
|
||||
break;
|
||||
|
||||
case BACKGROUND_EFFECT_COMMAND_END_BEFORE_INTRO_TEXT:
|
||||
case BACKGROUND_EFFECT_CMD_FINISH_BEFORE_INTRO_TEXT:
|
||||
// End
|
||||
gBackgroundEffect.type = 0;
|
||||
gBackgroundEffect.stage = 0;
|
||||
@ -656,7 +655,7 @@ u16 BackgroundEffectProcess(void)
|
||||
*/
|
||||
u32 BackgroundEffectStart(u8 effect)
|
||||
{
|
||||
if (gBackgroundEffect.type == 0 && effect != UCHAR_MAX)
|
||||
if (gBackgroundEffect.type == BACKGROUND_EFFECT_NONE && effect != UCHAR_MAX)
|
||||
{
|
||||
gBackgroundEffect.type = effect;
|
||||
gBackgroundEffect.colorStage = 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,6 @@
|
||||
#include "tourian_escape.h"
|
||||
#include "cutscenes/cutscene_utils.h"
|
||||
|
||||
#include "constants/animated_graphics.h"
|
||||
#include "constants/haze.h"
|
||||
#include "constants/room.h"
|
||||
|
||||
@ -405,17 +404,16 @@ u8 sHazeData[13][4] = {
|
||||
}
|
||||
};
|
||||
|
||||
// FIXME use pointer to u16[3]
|
||||
const u16* const sBackgroundEffectBehaviorPointers[9] = {
|
||||
[0] = (const u16* const)sBackgroundEffectBehavior_Lightning,
|
||||
[BACKGROUND_EFFECT_LIGHTNING] = (const u16* const)sBackgroundEffectBehavior_Lightning,
|
||||
[BACKGROUND_EFFECT_SLIGHT_YELLOW] = (const u16* const)sBackgroundEffectBehavior_SlightYellow,
|
||||
[BACKGROUND_EFFECT_HEAVY_YELLOW] = (const u16* const)sBackgroundEffectBehavior_HeavyYellow,
|
||||
[BACKGROUND_EFFECT_EXIT_ZEBES_FADE] = (const u16* const)sBackgroundEffectBehavior_ExitZebes,
|
||||
[BACKGROUND_EFFECT_INTRO_TEXT_FADE] = (const u16* const)sBackgroundEffectBehavior_IntroText,
|
||||
[BACKGROUND_EFFECT_QUICK_FLASH] = (const u16* const)sBackgroundEffectBehavior_QuickFlash,
|
||||
[BACKGROUND_EFFECT_ALL_BLACK] = (const u16* const)sBackgroundEffectBehavior_AllBlackWhite,
|
||||
[BACKGROUND_EFFECT_ALL_WHITE] = (const u16* const)sBackgroundEffectBehavior_AllBlackWhite,
|
||||
const BackgroundEffectBehaviorEntry_T* const sBackgroundEffectBehaviorPointers[BACKGROUND_EFFECT_END] = {
|
||||
[BACKGROUND_EFFECT_NONE] = sBackgroundEffectBehavior_Lightning,
|
||||
[BACKGROUND_EFFECT_LIGHTNING] = sBackgroundEffectBehavior_Lightning,
|
||||
[BACKGROUND_EFFECT_SLIGHT_YELLOW] = sBackgroundEffectBehavior_SlightYellow,
|
||||
[BACKGROUND_EFFECT_HEAVY_YELLOW] = sBackgroundEffectBehavior_HeavyYellow,
|
||||
[BACKGROUND_EFFECT_EXIT_ZEBES_FADE] = sBackgroundEffectBehavior_ExitZebes,
|
||||
[BACKGROUND_EFFECT_INTRO_TEXT_FADE] = sBackgroundEffectBehavior_IntroText,
|
||||
[BACKGROUND_EFFECT_QUICK_FLASH] = sBackgroundEffectBehavior_QuickFlash,
|
||||
[BACKGROUND_EFFECT_ALL_BLACK] = sBackgroundEffectBehavior_AllBlackWhite,
|
||||
[BACKGROUND_EFFECT_ALL_WHITE] = sBackgroundEffectBehavior_AllBlackWhite,
|
||||
};
|
||||
|
||||
const struct HatchLockEvent* const sHatchLockEventsPointers[MAX_AMOUNT_OF_AREAS - 1] = {
|
||||
|
Loading…
Reference in New Issue
Block a user