through InitCurrentFlashLevelScanlineEffect

This commit is contained in:
PikalaxALT
2020-03-28 14:40:25 -04:00
parent f0fe4904d0
commit f5f4d6bc1f
11 changed files with 101 additions and 146 deletions
+1 -1
View File
@@ -2037,7 +2037,7 @@ const u16 sPokeCenter1FMaps[] = {
MAP_UNDEFINED
};
bool8 sub_80CC87C(void)
bool8 UsedPokemonCenterWarp(void)
{
s32 i;
u16 mapno = (gLastUsedWarp.mapGroup << 8) + gLastUsedWarp.mapNum;
+3 -3
View File
@@ -127,17 +127,17 @@ void MoveSaveBlocks_ResetHeap(void)
gSaveBlock2Ptr->encryptionKey = encryptionKey;
}
u32 sav2_x1_query_bit1(void)
u32 UseContinueGameWarp(void)
{
return gSaveBlock2Ptr->specialSaveWarpFlags & CONTINUE_GAME_WARP;
}
void sav2_x9_clear_bit1(void)
void ClearContinueGameWarpStatus(void)
{
gSaveBlock2Ptr->specialSaveWarpFlags &= ~CONTINUE_GAME_WARP;
}
void sub_804C1AC(void)
void SetContinueGameWarpStatus(void)
{
gSaveBlock2Ptr->specialSaveWarpFlags |= CONTINUE_GAME_WARP;
}
+86 -3
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "gflib.h"
#include "event_data.h"
#include "event_object_movement.h"
#include "event_scripts.h"
#include "field_camera.h"
#include "field_control_avatar.h"
@@ -28,6 +29,7 @@
#include "roamer.h"
#include "safari_zone.h"
#include "save_location.h"
#include "scanline_effect.h"
#include "script.h"
#include "script_pokemon_util.h"
#include "tileset_anims.h"
@@ -94,11 +96,12 @@ void CB2_LoadMap2(void);
void c2_80567AC(void);
void CB2_ReturnToFieldLocal(void);
void CB2_ReturnToFieldLink(void);
void FieldClearVBlankHBlankCallbacks(void);
void SetFieldVBlankCallback(void);
void VBlankCB_Field(void);
void MoveSaveBlocks_ResetHeap_(void);
void sub_8056E80(void);
void CB1_UpdateLinkState(void);
void SetFieldVBlankCallback(void);
void FieldClearVBlankHBlankCallbacks(void);
void ResetAllMultiplayerState(void);
void do_load_map_stuff_loop(u8 *state);
bool32 sub_8056CD8(u8 *state);
@@ -322,7 +325,7 @@ void sub_8054F68(void)
}
}
void sub_80550A8(void)
void LoadSaveblockObjEventScripts(void)
{
int i;
const struct ObjectEventTemplate * src = gMapHeader.events->objectEvents;
@@ -1572,3 +1575,83 @@ void sub_8056918(void)
ShowMapNamePopup(FALSE);
FieldCB_WarpExitFadeFromBlack();
}
void CB2_ContinueSavedGame(void)
{
FieldClearVBlankHBlankCallbacks();
StopMapMusic();
ResetSafariZoneFlag_();
LoadSaveblockMapHeader();
LoadSaveblockObjEventScripts();
UnfreezeObjectEvents();
sub_8054E40();
InitMapFromSavedGame();
PlayTimeCounter_Start();
ScriptContext1_Init();
ScriptContext2_Disable();
gFieldCallback2 = NULL;
gUnknown_2031DE0 = TRUE;
if (UseContinueGameWarp() == TRUE)
{
ClearContinueGameWarpStatus();
SetWarpDestinationToContinueGameWarp();
WarpIntoMap();
SetMainCallback2(CB2_LoadMap);
}
else
{
gFieldCallback = sub_8056918;
SetMainCallback1(CB1_Overworld);
CB2_ReturnToField();
}
}
void FieldClearVBlankHBlankCallbacks(void)
{
if (UsedPokemonCenterWarp() == TRUE)
CloseLink();
if (gWirelessCommType != 0)
{
EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL);
DisableInterrupts(INTR_FLAG_HBLANK);
}
else
{
DisableInterrupts(INTR_FLAG_HBLANK);
EnableInterrupts(INTR_FLAG_VBLANK);
}
SetVBlankCallback(NULL);
SetHBlankCallback(NULL);
}
void SetFieldVBlankCallback(void)
{
SetVBlankCallback(VBlankCB_Field);
}
void VBlankCB_Field(void)
{
LoadOam();
ProcessSpriteCopyRequests();
ScanlineEffect_InitHBlankDmaTransfer();
FieldUpdateBgTilemapScroll();
TransferPlttBuffer();
TransferTilesetAnimsBuffer();
}
void InitCurrentFlashLevelScanlineEffect(void)
{
u8 flashLevel = Overworld_GetFlashLevel();
if (flashLevel != 0)
{
WriteFlashScanlineEffectBuffer(flashLevel);
ScanlineEffect_SetParams((struct ScanlineEffectParams){
.dmaDest = &REG_WIN0H,
.dmaControl = (2 >> 1) | ((DMA_16BIT | DMA_DEST_RELOAD | DMA_SRC_INC | DMA_REPEAT | DMA_START_HBLANK | DMA_ENABLE) << 16),
.initState = 1,
.unused9 = 0
});
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ bool8 EnterHallOfFame(void)
{
SetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME, (gSaveBlock2Ptr->playTimeHours << 16) | (gSaveBlock2Ptr->playTimeMinutes << 8) | gSaveBlock2Ptr->playTimeSeconds);
}
sub_804C1AC();
SetContinueGameWarpStatus();
SetContinueGameWarpToHealLocation(SPAWN_PALLET_TOWN);
gaveAtLeastOneRibbon = FALSE;
for (i = 0, r7 = &ribbonState; i < PARTY_SIZE; i++)