mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
Merge pull request #1161 from GriffinRichards/doc-wallclock
Document wall clock data
This commit is contained in:
commit
c3f6c56e19
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
@ -3180,11 +3180,12 @@ extern const u32 gDecorIconPalette_RegiceDoll[];
|
|||||||
extern const u32 gDecorIcon_RegisteelDoll[];
|
extern const u32 gDecorIcon_RegisteelDoll[];
|
||||||
extern const u32 gDecorIconPalette_RegisteelDoll[];
|
extern const u32 gDecorIconPalette_RegisteelDoll[];
|
||||||
|
|
||||||
extern const u32 gWallclock_Gfx[];
|
extern const u32 gWallClock_Gfx[];
|
||||||
extern const u16 gWallclockMale_Pal[];
|
extern const u16 gWallClockMale_Pal[];
|
||||||
extern const u16 gWallclockFemale_Pal[];
|
extern const u16 gWallClockFemale_Pal[];
|
||||||
extern const u32 gUnknown_08DCC648[];
|
extern const u32 gWallClockStart_Tilemap[];
|
||||||
extern const u32 gUnknown_08DCC908[];
|
extern const u32 gWallClockView_Tilemap[];
|
||||||
|
|
||||||
extern const u32 gBerryFixGameboy_Gfx[];
|
extern const u32 gBerryFixGameboy_Gfx[];
|
||||||
extern const u32 gBerryFixGameboy_Tilemap[];
|
extern const u32 gBerryFixGameboy_Tilemap[];
|
||||||
extern const u16 gBerryFixGameboy_Pal[];
|
extern const u16 gBerryFixGameboy_Pal[];
|
||||||
|
@ -1373,11 +1373,11 @@ const u16 gEasyChatMode_Pal[] = INCBIN_U16("graphics/easy_chat/mode.gbapal");
|
|||||||
const u32 gEasyChatWindow_Gfx[] = INCBIN_U32("graphics/easy_chat/window.4bpp.lz"); // uses mode pal
|
const u32 gEasyChatWindow_Gfx[] = INCBIN_U32("graphics/easy_chat/window.4bpp.lz"); // uses mode pal
|
||||||
const u32 gEasyChatWindow_Tilemap[] = INCBIN_U32("graphics/easy_chat/window.bin.lz");
|
const u32 gEasyChatWindow_Tilemap[] = INCBIN_U32("graphics/easy_chat/window.bin.lz");
|
||||||
|
|
||||||
const u16 gWallclockMale_Pal[] = INCBIN_U16("graphics/interface/wallclock_male.gbapal");
|
const u16 gWallClockMale_Pal[] = INCBIN_U16("graphics/wallclock/male.gbapal");
|
||||||
const u16 gWallclockFemale_Pal[] = INCBIN_U16("graphics/interface/wallclock_female.gbapal");
|
const u16 gWallClockFemale_Pal[] = INCBIN_U16("graphics/wallclock/female.gbapal");
|
||||||
const u32 gWallclock_Gfx[] = INCBIN_U32("graphics/interface/wallclock.4bpp.lz");
|
const u32 gWallClock_Gfx[] = INCBIN_U32("graphics/wallclock/clock.4bpp.lz");
|
||||||
const u32 gUnknown_08DCC648[] = INCBIN_U32("graphics/interface/wallclock1.bin.lz");
|
const u32 gWallClockStart_Tilemap[] = INCBIN_U32("graphics/wallclock/clock_start.bin.lz");
|
||||||
const u32 gUnknown_08DCC908[] = INCBIN_U32("graphics/interface/wallclock2.bin.lz");
|
const u32 gWallClockView_Tilemap[] = INCBIN_U32("graphics/wallclock/clock_view.bin.lz");
|
||||||
|
|
||||||
const u16 gUsePokeblockCondition_Pal[] = INCBIN_U16("graphics/pokeblock/use_screen/condition.gbapal");
|
const u16 gUsePokeblockCondition_Pal[] = INCBIN_U16("graphics/pokeblock/use_screen/condition.gbapal");
|
||||||
const u32 gUsePokeblockCondition_Gfx[] = INCBIN_U32("graphics/pokeblock/use_screen/condition.4bpp.lz");
|
const u32 gUsePokeblockCondition_Gfx[] = INCBIN_U32("graphics/pokeblock/use_screen/condition.4bpp.lz");
|
||||||
|
508
src/wallclock.c
508
src/wallclock.c
@ -21,38 +21,37 @@
|
|||||||
#include "constants/rgb.h"
|
#include "constants/rgb.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
|
|
||||||
// static declarations
|
static void CB2_WallClock(void);
|
||||||
|
static void Task_SetClock_WaitFadeIn(u8 taskId);
|
||||||
static void WallClockMainCallback(void);
|
static void Task_SetClock_HandleInput(u8 taskId);
|
||||||
static void Task_SetClock1(u8 taskId);
|
static void Task_SetClock_AskConfirm(u8 taskId);
|
||||||
static void Task_SetClock2(u8 taskId);
|
static void Task_SetClock_HandleConfirmInput(u8 taskId);
|
||||||
static void Task_SetClock3(u8 taskId);
|
static void Task_SetClock_Confirmed(u8 taskId);
|
||||||
static void Task_SetClock4(u8 taskId);
|
static void Task_SetClock_Exit(u8 taskId);
|
||||||
static void Task_SetClock5(u8 taskId);
|
static void Task_ViewClock_WaitFadeIn(u8 taskId);
|
||||||
static void Task_SetClock6(u8 taskId);
|
static void Task_ViewClock_HandleInput(u8 taskId);
|
||||||
static void Task_ViewClock1(u8 taskId);
|
static void Task_ViewClock_FadeOut(u8 taskId);
|
||||||
static void Task_ViewClock2(u8 taskId);
|
static void Task_ViewClock_Exit(u8 taskId);
|
||||||
static void Task_ViewClock3(u8 taskId);
|
|
||||||
static void Task_ViewClock4(u8 taskId);
|
|
||||||
static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed);
|
static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed);
|
||||||
static bool32 AdvanceClock(u8 taskId, u8 direction);
|
static bool32 AdvanceClock(u8 taskId, u8 direction);
|
||||||
static void UpdateClockPeriod(u8 taskId, u8 direction);
|
static void UpdateClockPeriod(u8 taskId, u8 direction);
|
||||||
static void InitClockWithRtc(u8 taskId);
|
static void InitClockWithRtc(u8 taskId);
|
||||||
static void SpriteCB_MinuteHand(struct Sprite *sprite);
|
static void SpriteCB_MinuteHand(struct Sprite *sprite);
|
||||||
static void SpriteCB_HourHand(struct Sprite *sprite);
|
static void SpriteCB_HourHand(struct Sprite *sprite);
|
||||||
static void SpriteCB_AMIndicator(struct Sprite *sprite);
|
|
||||||
static void SpriteCB_PMIndicator(struct Sprite *sprite);
|
static void SpriteCB_PMIndicator(struct Sprite *sprite);
|
||||||
|
static void SpriteCB_AMIndicator(struct Sprite *sprite);
|
||||||
|
|
||||||
#define tMinuteHandAngle data[0]
|
#define tMinuteHandAngle data[0]
|
||||||
#define tHourHandAngle data[1]
|
#define tHourHandAngle data[1]
|
||||||
#define tHours data[2]
|
#define tHours data[2]
|
||||||
#define tMinutes data[3]
|
#define tMinutes data[3]
|
||||||
#define tMvmtDir data[4]
|
#define tMoveDir data[4]
|
||||||
#define tPeriod data[5]
|
#define tPeriod data[5]
|
||||||
#define tMvmtSpeed data[6]
|
#define tMoveSpeed data[6]
|
||||||
|
|
||||||
#define TAG_GFX_WALL_CLOCK_HAND 0x1000
|
#define GFXTAG_WALL_CLOCK_HAND 0x1000
|
||||||
#define TAG_PAL_WALL_CLOCK_HAND 0x1000
|
#define PALTAG_WALL_CLOCK_MALE 0x1000
|
||||||
|
#define PALTAG_WALL_CLOCK_FEMALE 0x1001
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -62,17 +61,15 @@ enum
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MVMT_NONE,
|
MOVE_NONE,
|
||||||
MVMT_BACKWARD,
|
MOVE_BACKWARD,
|
||||||
MVMT_FORWARD,
|
MOVE_FORWARD,
|
||||||
};
|
};
|
||||||
|
|
||||||
// rodata
|
static const u32 sHand_Gfx[] = INCBIN_U32("graphics/wallclock/hand.4bpp.lz");
|
||||||
|
static const u16 sTextPrompt_Pal[] = INCBIN_U16("graphics/wallclock/text_prompt.gbapal"); // for "Cancel" or "Confirm"
|
||||||
|
|
||||||
static const u32 sUnknown_085B1F58[] = INCBIN_U32("graphics/wallclock/graphics_85b1f58.4bpp.lz");
|
static const struct WindowTemplate sWindowTemplates[] =
|
||||||
static const u16 sUnknown_085B21D4[] = INCBIN_U16("graphics/wallclock/palette_85b21d4.gbapal");
|
|
||||||
|
|
||||||
static const struct WindowTemplate gUnknown_085B21DC[] =
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
@ -95,7 +92,7 @@ static const struct WindowTemplate gUnknown_085B21DC[] =
|
|||||||
DUMMY_WIN_TEMPLATE
|
DUMMY_WIN_TEMPLATE
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct WindowTemplate gUnknown_085B21F4 =
|
static const struct WindowTemplate sWindowTemplate_ConfirmYesNo =
|
||||||
{
|
{
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
.tilemapLeft = 24,
|
.tilemapLeft = 24,
|
||||||
@ -106,7 +103,7 @@ static const struct WindowTemplate gUnknown_085B21F4 =
|
|||||||
.baseBlock = 572
|
.baseBlock = 572
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct BgTemplate gUnknown_085B21FC[] =
|
static const struct BgTemplate sBgTemplates[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
@ -128,27 +125,27 @@ static const struct BgTemplate gUnknown_085B21FC[] =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct CompressedSpriteSheet gUnknown_085B2208 =
|
static const struct CompressedSpriteSheet sSpriteSheet_ClockHand =
|
||||||
{
|
{
|
||||||
sUnknown_085B1F58, 0x2000, TAG_GFX_WALL_CLOCK_HAND
|
sHand_Gfx, 0x2000, GFXTAG_WALL_CLOCK_HAND
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 filler_85B2210[8] = {0};
|
static const u8 sUnused[8] = {0};
|
||||||
|
|
||||||
static const struct SpritePalette gUnknown_085B2218[] =
|
static const struct SpritePalette sSpritePalettes_Clock[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
.data = gWallclockMale_Pal,
|
.data = gWallClockMale_Pal,
|
||||||
.tag = TAG_PAL_WALL_CLOCK_HAND
|
.tag = PALTAG_WALL_CLOCK_MALE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.data = gWallclockFemale_Pal,
|
.data = gWallClockFemale_Pal,
|
||||||
.tag = 0x1001
|
.tag = PALTAG_WALL_CLOCK_FEMALE
|
||||||
},
|
},
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct OamData Unknown_085B2230 =
|
static const struct OamData sOam_ClockHand =
|
||||||
{
|
{
|
||||||
.y = 160,
|
.y = 160,
|
||||||
.shape = SPRITE_SHAPE(64x64),
|
.shape = SPRITE_SHAPE(64x64),
|
||||||
@ -156,51 +153,51 @@ static const struct OamData Unknown_085B2230 =
|
|||||||
.priority = 1,
|
.priority = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const union AnimCmd Unknown_085B2238[] =
|
static const union AnimCmd sAnim_MinuteHand[] =
|
||||||
{
|
{
|
||||||
ANIMCMD_FRAME(0, 30),
|
ANIMCMD_FRAME(0, 30),
|
||||||
ANIMCMD_END,
|
ANIMCMD_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const union AnimCmd Unknown_085B2240[] =
|
static const union AnimCmd sAnim_HourHand[] =
|
||||||
{
|
{
|
||||||
ANIMCMD_FRAME(64, 30),
|
ANIMCMD_FRAME(64, 30),
|
||||||
ANIMCMD_END,
|
ANIMCMD_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const union AnimCmd *const gUnknown_085B2248[] =
|
static const union AnimCmd *const sAnims_MinuteHand[] =
|
||||||
{
|
{
|
||||||
Unknown_085B2238
|
sAnim_MinuteHand
|
||||||
};
|
};
|
||||||
|
|
||||||
static const union AnimCmd *const gUnknown_085B224C[] =
|
static const union AnimCmd *const sAnims_HourHand[] =
|
||||||
{
|
{
|
||||||
Unknown_085B2240
|
sAnim_HourHand
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct SpriteTemplate gUnknown_085B2250 =
|
static const struct SpriteTemplate sSpriteTemplate_MinuteHand =
|
||||||
{
|
{
|
||||||
.tileTag = TAG_GFX_WALL_CLOCK_HAND,
|
.tileTag = GFXTAG_WALL_CLOCK_HAND,
|
||||||
.paletteTag = TAG_PAL_WALL_CLOCK_HAND,
|
.paletteTag = PALTAG_WALL_CLOCK_MALE,
|
||||||
.oam = &Unknown_085B2230,
|
.oam = &sOam_ClockHand,
|
||||||
.anims = gUnknown_085B2248,
|
.anims = sAnims_MinuteHand,
|
||||||
.images = NULL,
|
.images = NULL,
|
||||||
.affineAnims = gDummySpriteAffineAnimTable,
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
.callback = SpriteCB_MinuteHand,
|
.callback = SpriteCB_MinuteHand,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct SpriteTemplate gUnknown_085B2268 =
|
static const struct SpriteTemplate sSpriteTemplate_HourHand =
|
||||||
{
|
{
|
||||||
.tileTag = TAG_GFX_WALL_CLOCK_HAND,
|
.tileTag = GFXTAG_WALL_CLOCK_HAND,
|
||||||
.paletteTag = TAG_PAL_WALL_CLOCK_HAND,
|
.paletteTag = PALTAG_WALL_CLOCK_MALE,
|
||||||
.oam = &Unknown_085B2230,
|
.oam = &sOam_ClockHand,
|
||||||
.anims = gUnknown_085B224C,
|
.anims = sAnims_HourHand,
|
||||||
.images = NULL,
|
.images = NULL,
|
||||||
.affineAnims = gDummySpriteAffineAnimTable,
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
.callback = SpriteCB_HourHand,
|
.callback = SpriteCB_HourHand,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct OamData Unknown_085B2280 =
|
static const struct OamData sOam_PeriodIndicator =
|
||||||
{
|
{
|
||||||
.y = 160,
|
.y = 160,
|
||||||
.shape = SPRITE_SHAPE(16x16),
|
.shape = SPRITE_SHAPE(16x16),
|
||||||
@ -208,50 +205,50 @@ static const struct OamData Unknown_085B2280 =
|
|||||||
.priority = 3,
|
.priority = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const union AnimCmd Unknown_085B2288[] =
|
static const union AnimCmd sAnim_PM[] =
|
||||||
{
|
{
|
||||||
ANIMCMD_FRAME(132, 30),
|
ANIMCMD_FRAME(132, 30),
|
||||||
ANIMCMD_END,
|
ANIMCMD_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const union AnimCmd Unknown_085B2290[] =
|
static const union AnimCmd sAnim_AM[] =
|
||||||
{
|
{
|
||||||
ANIMCMD_FRAME(128, 30),
|
ANIMCMD_FRAME(128, 30),
|
||||||
ANIMCMD_END,
|
ANIMCMD_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const union AnimCmd *const gUnknown_085B2298[] =
|
static const union AnimCmd *const sAnims_PM[] =
|
||||||
{
|
{
|
||||||
Unknown_085B2288
|
sAnim_PM
|
||||||
};
|
};
|
||||||
|
|
||||||
static const union AnimCmd *const gUnknown_085B229C[] =
|
static const union AnimCmd *const sAnims_AM[] =
|
||||||
{
|
{
|
||||||
Unknown_085B2290
|
sAnim_AM
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct SpriteTemplate gUnknown_085B22A0 =
|
static const struct SpriteTemplate sSpriteTemplate_PM =
|
||||||
{
|
{
|
||||||
.tileTag = TAG_GFX_WALL_CLOCK_HAND,
|
.tileTag = GFXTAG_WALL_CLOCK_HAND,
|
||||||
.paletteTag = TAG_PAL_WALL_CLOCK_HAND,
|
.paletteTag = PALTAG_WALL_CLOCK_MALE,
|
||||||
.oam = &Unknown_085B2280,
|
.oam = &sOam_PeriodIndicator,
|
||||||
.anims = gUnknown_085B2298,
|
.anims = sAnims_PM,
|
||||||
.images = NULL,
|
|
||||||
.affineAnims = gDummySpriteAffineAnimTable,
|
|
||||||
.callback = SpriteCB_AMIndicator
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct SpriteTemplate gUnknown_085B22B8 =
|
|
||||||
{
|
|
||||||
.tileTag = TAG_GFX_WALL_CLOCK_HAND,
|
|
||||||
.paletteTag = TAG_PAL_WALL_CLOCK_HAND,
|
|
||||||
.oam = &Unknown_085B2280,
|
|
||||||
.anims = gUnknown_085B229C,
|
|
||||||
.images = NULL,
|
.images = NULL,
|
||||||
.affineAnims = gDummySpriteAffineAnimTable,
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
.callback = SpriteCB_PMIndicator
|
.callback = SpriteCB_PMIndicator
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct SpriteTemplate sSpriteTemplate_AM =
|
||||||
|
{
|
||||||
|
.tileTag = GFXTAG_WALL_CLOCK_HAND,
|
||||||
|
.paletteTag = PALTAG_WALL_CLOCK_MALE,
|
||||||
|
.oam = &sOam_PeriodIndicator,
|
||||||
|
.anims = sAnims_AM,
|
||||||
|
.images = NULL,
|
||||||
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
|
.callback = SpriteCB_AMIndicator
|
||||||
|
};
|
||||||
|
|
||||||
static const s8 sClockHandCoords[][2] =
|
static const s8 sClockHandCoords[][2] =
|
||||||
{
|
{
|
||||||
{ 0x00, -0x18},
|
{ 0x00, -0x18},
|
||||||
@ -616,9 +613,7 @@ static const s8 sClockHandCoords[][2] =
|
|||||||
{ 0x00, -0x19}
|
{ 0x00, -0x19}
|
||||||
};
|
};
|
||||||
|
|
||||||
// text
|
static void VBlankCB_WallClock(void)
|
||||||
|
|
||||||
static void WallClockVblankCallback(void)
|
|
||||||
{
|
{
|
||||||
LoadOam();
|
LoadOam();
|
||||||
ProcessSpriteCopyRequests();
|
ProcessSpriteCopyRequests();
|
||||||
@ -644,20 +639,18 @@ static void LoadWallClockGraphics(void)
|
|||||||
DmaFillLarge16(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000);
|
DmaFillLarge16(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000);
|
||||||
DmaClear32(3, (void *)OAM, OAM_SIZE);
|
DmaClear32(3, (void *)OAM, OAM_SIZE);
|
||||||
DmaClear16(3, (void *)PLTT, PLTT_SIZE);
|
DmaClear16(3, (void *)PLTT, PLTT_SIZE);
|
||||||
LZ77UnCompVram(gWallclock_Gfx, (void *)VRAM);
|
LZ77UnCompVram(gWallClock_Gfx, (void *)VRAM);
|
||||||
if (gSpecialVar_0x8004 == 0)
|
|
||||||
{
|
if (gSpecialVar_0x8004 == MALE)
|
||||||
LoadPalette(gWallclockMale_Pal, 0x00, 0x20);
|
LoadPalette(gWallClockMale_Pal, 0, 32);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
LoadPalette(gWallClockFemale_Pal, 0, 32);
|
||||||
LoadPalette(gWallclockFemale_Pal, 0x00, 0x20);
|
|
||||||
}
|
LoadPalette(GetOverworldTextboxPalettePtr(), 0xe0, 32);
|
||||||
LoadPalette(GetOverworldTextboxPalettePtr(), 0xe0, 0x20);
|
LoadPalette(sTextPrompt_Pal, 0xc0, 8);
|
||||||
LoadPalette(sUnknown_085B21D4, 0xc0, 0x08);
|
|
||||||
ResetBgsAndClearDma3BusyFlags(0);
|
ResetBgsAndClearDma3BusyFlags(0);
|
||||||
InitBgsFromTemplates(0, gUnknown_085B21FC, 3);
|
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
|
||||||
InitWindows(gUnknown_085B21DC);
|
InitWindows(sWindowTemplates);
|
||||||
DeactivateAllTextPrinters();
|
DeactivateAllTextPrinters();
|
||||||
LoadUserWindowBorderGfx(0, 0x250, 0xd0);
|
LoadUserWindowBorderGfx(0, 0x250, 0xd0);
|
||||||
ClearScheduledBgCopiesToVram();
|
ClearScheduledBgCopiesToVram();
|
||||||
@ -666,16 +659,16 @@ static void LoadWallClockGraphics(void)
|
|||||||
ResetSpriteData();
|
ResetSpriteData();
|
||||||
ResetPaletteFade();
|
ResetPaletteFade();
|
||||||
FreeAllSpritePalettes();
|
FreeAllSpritePalettes();
|
||||||
LoadCompressedSpriteSheet(&gUnknown_085B2208);
|
LoadCompressedSpriteSheet(&sSpriteSheet_ClockHand);
|
||||||
LoadSpritePalettes(gUnknown_085B2218);
|
LoadSpritePalettes(sSpritePalettes_Clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WallClockInit(void)
|
static void WallClockInit(void)
|
||||||
{
|
{
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
|
||||||
EnableInterrupts(INTR_FLAG_VBLANK);
|
EnableInterrupts(INTR_FLAG_VBLANK);
|
||||||
SetVBlankCallback(WallClockVblankCallback);
|
SetVBlankCallback(VBlankCB_WallClock);
|
||||||
SetMainCallback2(WallClockMainCallback);
|
SetMainCallback2(CB2_WallClock);
|
||||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||||
SetGpuReg(REG_OFFSET_BLDY, 0);
|
SetGpuReg(REG_OFFSET_BLDY, 0);
|
||||||
@ -691,32 +684,32 @@ void CB2_StartWallClock(void)
|
|||||||
u8 spriteId;
|
u8 spriteId;
|
||||||
|
|
||||||
LoadWallClockGraphics();
|
LoadWallClockGraphics();
|
||||||
LZ77UnCompVram(gUnknown_08DCC648, (u16 *)BG_SCREEN_ADDR(7));
|
LZ77UnCompVram(gWallClockStart_Tilemap, (u16 *)BG_SCREEN_ADDR(7));
|
||||||
|
|
||||||
taskId = CreateTask(Task_SetClock1, 0);
|
taskId = CreateTask(Task_SetClock_WaitFadeIn, 0);
|
||||||
gTasks[taskId].tHours = 10;
|
gTasks[taskId].tHours = 10;
|
||||||
gTasks[taskId].tMinutes = 0;
|
gTasks[taskId].tMinutes = 0;
|
||||||
gTasks[taskId].tMvmtDir = 0;
|
gTasks[taskId].tMoveDir = 0;
|
||||||
gTasks[taskId].tPeriod = 0;
|
gTasks[taskId].tPeriod = 0;
|
||||||
gTasks[taskId].tMvmtSpeed = 0;
|
gTasks[taskId].tMoveSpeed = 0;
|
||||||
gTasks[taskId].tMinuteHandAngle = 0;
|
gTasks[taskId].tMinuteHandAngle = 0;
|
||||||
gTasks[taskId].tHourHandAngle = 300;
|
gTasks[taskId].tHourHandAngle = 300;
|
||||||
|
|
||||||
spriteId = CreateSprite(&gUnknown_085B2250, 120, 80, 1);
|
spriteId = CreateSprite(&sSpriteTemplate_MinuteHand, 120, 80, 1);
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
|
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
|
||||||
gSprites[spriteId].oam.matrixNum = 0;
|
gSprites[spriteId].oam.matrixNum = 0;
|
||||||
|
|
||||||
spriteId = CreateSprite(&gUnknown_085B2268, 120, 80, 0);
|
spriteId = CreateSprite(&sSpriteTemplate_HourHand, 120, 80, 0);
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
|
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
|
||||||
gSprites[spriteId].oam.matrixNum = 1;
|
gSprites[spriteId].oam.matrixNum = 1;
|
||||||
|
|
||||||
spriteId = CreateSprite(&gUnknown_085B22A0, 120, 80, 2);
|
spriteId = CreateSprite(&sSpriteTemplate_PM, 120, 80, 2);
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].data[1] = 45;
|
gSprites[spriteId].data[1] = 45;
|
||||||
|
|
||||||
spriteId = CreateSprite(&gUnknown_085B22B8, 120, 80, 2);
|
spriteId = CreateSprite(&sSpriteTemplate_AM, 120, 80, 2);
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].data[1] = 90;
|
gSprites[spriteId].data[1] = 90;
|
||||||
|
|
||||||
@ -735,11 +728,11 @@ void CB2_ViewWallClock(void)
|
|||||||
u8 angle2;
|
u8 angle2;
|
||||||
|
|
||||||
LoadWallClockGraphics();
|
LoadWallClockGraphics();
|
||||||
LZ77UnCompVram(gUnknown_08DCC908, (u16 *)BG_SCREEN_ADDR(7));
|
LZ77UnCompVram(gWallClockView_Tilemap, (u16 *)BG_SCREEN_ADDR(7));
|
||||||
|
|
||||||
taskId = CreateTask(Task_ViewClock1, 0);
|
taskId = CreateTask(Task_ViewClock_WaitFadeIn, 0);
|
||||||
InitClockWithRtc(taskId);
|
InitClockWithRtc(taskId);
|
||||||
if (gTasks[taskId].tPeriod == 0)
|
if (gTasks[taskId].tPeriod == PERIOD_AM)
|
||||||
{
|
{
|
||||||
angle1 = 45;
|
angle1 = 45;
|
||||||
angle2 = 90;
|
angle2 = 90;
|
||||||
@ -750,21 +743,21 @@ void CB2_ViewWallClock(void)
|
|||||||
angle2 = 135;
|
angle2 = 135;
|
||||||
}
|
}
|
||||||
|
|
||||||
spriteId = CreateSprite(&gUnknown_085B2250, 120, 80, 1);
|
spriteId = CreateSprite(&sSpriteTemplate_MinuteHand, 120, 80, 1);
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
|
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
|
||||||
gSprites[spriteId].oam.matrixNum = 0;
|
gSprites[spriteId].oam.matrixNum = 0;
|
||||||
|
|
||||||
spriteId = CreateSprite(&gUnknown_085B2268, 120, 80, 0);
|
spriteId = CreateSprite(&sSpriteTemplate_HourHand, 120, 80, 0);
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
|
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
|
||||||
gSprites[spriteId].oam.matrixNum = 1;
|
gSprites[spriteId].oam.matrixNum = 1;
|
||||||
|
|
||||||
spriteId = CreateSprite(&gUnknown_085B22A0, 120, 80, 2);
|
spriteId = CreateSprite(&sSpriteTemplate_PM, 120, 80, 2);
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].data[1] = angle1;
|
gSprites[spriteId].data[1] = angle1;
|
||||||
|
|
||||||
spriteId = CreateSprite(&gUnknown_085B22B8, 120, 80, 2);
|
spriteId = CreateSprite(&sSpriteTemplate_AM, 120, 80, 2);
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].data[1] = angle2;
|
gSprites[spriteId].data[1] = angle2;
|
||||||
|
|
||||||
@ -775,7 +768,7 @@ void CB2_ViewWallClock(void)
|
|||||||
ScheduleBgCopyTilemapToVram(2);
|
ScheduleBgCopyTilemapToVram(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WallClockMainCallback(void)
|
static void CB2_WallClock(void)
|
||||||
{
|
{
|
||||||
RunTasks();
|
RunTasks();
|
||||||
AnimateSprites();
|
AnimateSprites();
|
||||||
@ -784,19 +777,19 @@ static void WallClockMainCallback(void)
|
|||||||
UpdatePaletteFade();
|
UpdatePaletteFade();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_SetClock1(u8 taskId)
|
static void Task_SetClock_WaitFadeIn(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
gTasks[taskId].func = Task_SetClock2;
|
gTasks[taskId].func = Task_SetClock_HandleInput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_SetClock2(u8 taskId)
|
static void Task_SetClock_HandleInput(u8 taskId)
|
||||||
{
|
{
|
||||||
if (gTasks[taskId].tMinuteHandAngle % 6)
|
if (gTasks[taskId].tMinuteHandAngle % 6)
|
||||||
{
|
{
|
||||||
gTasks[taskId].tMinuteHandAngle = CalcNewMinHandAngle(gTasks[taskId].tMinuteHandAngle, gTasks[taskId].tMvmtDir, gTasks[taskId].tMvmtSpeed);
|
gTasks[taskId].tMinuteHandAngle = CalcNewMinHandAngle(gTasks[taskId].tMinuteHandAngle, gTasks[taskId].tMoveDir, gTasks[taskId].tMoveSpeed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -804,72 +797,70 @@ static void Task_SetClock2(u8 taskId)
|
|||||||
gTasks[taskId].tHourHandAngle = (gTasks[taskId].tHours % 12) * 30 + (gTasks[taskId].tMinutes / 10) * 5;
|
gTasks[taskId].tHourHandAngle = (gTasks[taskId].tHours % 12) * 30 + (gTasks[taskId].tMinutes / 10) * 5;
|
||||||
if (gMain.newKeys & A_BUTTON)
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
gTasks[taskId].func = Task_SetClock3;
|
gTasks[taskId].func = Task_SetClock_AskConfirm;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gTasks[taskId].tMvmtDir = 0;
|
gTasks[taskId].tMoveDir = MOVE_NONE;
|
||||||
|
|
||||||
if (gMain.heldKeys & DPAD_LEFT)
|
if (gMain.heldKeys & DPAD_LEFT)
|
||||||
{
|
gTasks[taskId].tMoveDir = MOVE_BACKWARD;
|
||||||
gTasks[taskId].tMvmtDir = MVMT_BACKWARD;
|
|
||||||
}
|
|
||||||
if (gMain.heldKeys & DPAD_RIGHT)
|
if (gMain.heldKeys & DPAD_RIGHT)
|
||||||
|
gTasks[taskId].tMoveDir = MOVE_FORWARD;
|
||||||
|
|
||||||
|
if (gTasks[taskId].tMoveDir != MOVE_NONE)
|
||||||
{
|
{
|
||||||
gTasks[taskId].tMvmtDir = MVMT_FORWARD;
|
if (gTasks[taskId].tMoveSpeed < 0xFF)
|
||||||
}
|
gTasks[taskId].tMoveSpeed++;
|
||||||
if (gTasks[taskId].tMvmtDir != 0)
|
|
||||||
{
|
gTasks[taskId].tMinuteHandAngle = CalcNewMinHandAngle(gTasks[taskId].tMinuteHandAngle, gTasks[taskId].tMoveDir, gTasks[taskId].tMoveSpeed);
|
||||||
if (gTasks[taskId].tMvmtSpeed < 0xFF)
|
AdvanceClock(taskId, gTasks[taskId].tMoveDir);
|
||||||
{
|
|
||||||
gTasks[taskId].tMvmtSpeed++;
|
|
||||||
}
|
|
||||||
gTasks[taskId].tMinuteHandAngle = CalcNewMinHandAngle(gTasks[taskId].tMinuteHandAngle, gTasks[taskId].tMvmtDir, gTasks[taskId].tMvmtSpeed);
|
|
||||||
AdvanceClock(taskId, gTasks[taskId].tMvmtDir);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gTasks[taskId].tMvmtSpeed = 0;
|
gTasks[taskId].tMoveSpeed = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_SetClock3(u8 taskId)
|
static void Task_SetClock_AskConfirm(u8 taskId)
|
||||||
{
|
{
|
||||||
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x250, 0x0d);
|
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x250, 0x0d);
|
||||||
AddTextPrinterParameterized(0, 1, gText_IsThisTheCorrectTime, 0, 1, 0, NULL);
|
AddTextPrinterParameterized(0, 1, gText_IsThisTheCorrectTime, 0, 1, 0, NULL);
|
||||||
PutWindowTilemap(0);
|
PutWindowTilemap(0);
|
||||||
ScheduleBgCopyTilemapToVram(0);
|
ScheduleBgCopyTilemapToVram(0);
|
||||||
CreateYesNoMenu(&gUnknown_085B21F4, 0x250, 0x0d, 1);
|
CreateYesNoMenu(&sWindowTemplate_ConfirmYesNo, 0x250, 0x0d, 1);
|
||||||
gTasks[taskId].func = Task_SetClock4;
|
gTasks[taskId].func = Task_SetClock_HandleConfirmInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_SetClock4(u8 taskId)
|
static void Task_SetClock_HandleConfirmInput(u8 taskId)
|
||||||
{
|
{
|
||||||
switch (Menu_ProcessInputNoWrapClearOnChoose())
|
switch (Menu_ProcessInputNoWrapClearOnChoose())
|
||||||
{
|
{
|
||||||
case 0: //YES
|
case 0: // YES
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gTasks[taskId].func = Task_SetClock5;
|
gTasks[taskId].func = Task_SetClock_Confirmed;
|
||||||
break;
|
break;
|
||||||
case 1: //B button
|
case 1: // NO
|
||||||
case -1: //NO
|
case MENU_B_PRESSED:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ClearStdWindowAndFrameToTransparent(0, FALSE);
|
ClearStdWindowAndFrameToTransparent(0, FALSE);
|
||||||
ClearWindowTilemap(0);
|
ClearWindowTilemap(0);
|
||||||
gTasks[taskId].func = Task_SetClock2;
|
gTasks[taskId].func = Task_SetClock_HandleInput;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_SetClock5(u8 taskId)
|
static void Task_SetClock_Confirmed(u8 taskId)
|
||||||
{
|
{
|
||||||
RtcInitLocalTimeOffset(gTasks[taskId].tHours, gTasks[taskId].tMinutes);
|
RtcInitLocalTimeOffset(gTasks[taskId].tHours, gTasks[taskId].tMinutes);
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
||||||
gTasks[taskId].func = Task_SetClock6;
|
gTasks[taskId].func = Task_SetClock_Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_SetClock6(u8 taskId)
|
static void Task_SetClock_Exit(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
@ -878,51 +869,40 @@ static void Task_SetClock6(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_ViewClock1(u8 taskId)
|
static void Task_ViewClock_WaitFadeIn(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
gTasks[taskId].func = Task_ViewClock_HandleInput;
|
||||||
gTasks[taskId].func = Task_ViewClock2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_ViewClock2(u8 taskId)
|
static void Task_ViewClock_HandleInput(u8 taskId)
|
||||||
{
|
{
|
||||||
InitClockWithRtc(taskId);
|
InitClockWithRtc(taskId);
|
||||||
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
gTasks[taskId].func = Task_ViewClock_FadeOut;
|
||||||
gTasks[taskId].func = Task_ViewClock3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_ViewClock3(u8 taskId)
|
static void Task_ViewClock_FadeOut(u8 taskId)
|
||||||
{
|
{
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
||||||
gTasks[taskId].func = Task_ViewClock4;
|
gTasks[taskId].func = Task_ViewClock_Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_ViewClock4(u8 taskId)
|
static void Task_ViewClock_Exit(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
|
||||||
SetMainCallback2(gMain.savedCallback);
|
SetMainCallback2(gMain.savedCallback);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 CalcMinHandDelta(u16 speed)
|
static u8 CalcMinHandDelta(u16 speed)
|
||||||
{
|
{
|
||||||
if (speed > 60)
|
if (speed > 60)
|
||||||
{
|
|
||||||
return 6;
|
return 6;
|
||||||
}
|
|
||||||
if (speed > 30)
|
if (speed > 30)
|
||||||
{
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
|
||||||
if (speed > 10)
|
if (speed > 10)
|
||||||
{
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -931,18 +911,18 @@ static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed)
|
|||||||
u8 delta = CalcMinHandDelta(speed);
|
u8 delta = CalcMinHandDelta(speed);
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case MVMT_BACKWARD:
|
case MOVE_BACKWARD:
|
||||||
if (angle)
|
if (angle)
|
||||||
angle -= delta;
|
angle -= delta;
|
||||||
else
|
else
|
||||||
angle = 360 - delta;
|
angle = 360 - delta;
|
||||||
break;
|
break;
|
||||||
case MVMT_FORWARD:
|
case MOVE_FORWARD:
|
||||||
if (angle < 360 - delta)
|
if (angle < 360 - delta)
|
||||||
angle += delta;
|
angle += delta;
|
||||||
else
|
else
|
||||||
angle = 0;
|
angle = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
@ -951,44 +931,40 @@ static bool32 AdvanceClock(u8 taskId, u8 direction)
|
|||||||
{
|
{
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case MVMT_BACKWARD:
|
case MOVE_BACKWARD:
|
||||||
if (gTasks[taskId].tMinutes > 0)
|
if (gTasks[taskId].tMinutes > 0)
|
||||||
{
|
{
|
||||||
gTasks[taskId].tMinutes--;
|
gTasks[taskId].tMinutes--;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gTasks[taskId].tMinutes = 59;
|
||||||
|
|
||||||
|
if (gTasks[taskId].tHours > 0)
|
||||||
|
gTasks[taskId].tHours--;
|
||||||
else
|
else
|
||||||
{
|
gTasks[taskId].tHours = 23;
|
||||||
gTasks[taskId].tMinutes = 59;
|
|
||||||
if (gTasks[taskId].tHours > 0)
|
UpdateClockPeriod(taskId, direction);
|
||||||
{
|
}
|
||||||
gTasks[taskId].tHours--;
|
break;
|
||||||
}
|
case MOVE_FORWARD:
|
||||||
else
|
if (gTasks[taskId].tMinutes < 59)
|
||||||
{
|
{
|
||||||
gTasks[taskId].tHours = 23;
|
gTasks[taskId].tMinutes++;
|
||||||
}
|
}
|
||||||
UpdateClockPeriod(taskId, direction);
|
else
|
||||||
}
|
{
|
||||||
break;
|
gTasks[taskId].tMinutes = 0;
|
||||||
case MVMT_FORWARD:
|
|
||||||
if (gTasks[taskId].tMinutes < 59)
|
if (gTasks[taskId].tHours < 23)
|
||||||
{
|
gTasks[taskId].tHours++;
|
||||||
gTasks[taskId].tMinutes++;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
gTasks[taskId].tHours = 0;
|
||||||
gTasks[taskId].tMinutes = 0;
|
|
||||||
if (gTasks[taskId].tHours < 23)
|
UpdateClockPeriod(taskId, direction);
|
||||||
{
|
}
|
||||||
gTasks[taskId].tHours++;
|
break;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gTasks[taskId].tHours = 0;
|
|
||||||
}
|
|
||||||
UpdateClockPeriod(taskId, direction);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -998,28 +974,28 @@ static void UpdateClockPeriod(u8 taskId, u8 direction)
|
|||||||
u8 hours = gTasks[taskId].tHours;
|
u8 hours = gTasks[taskId].tHours;
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case MVMT_BACKWARD:
|
case MOVE_BACKWARD:
|
||||||
switch (hours)
|
switch (hours)
|
||||||
{
|
{
|
||||||
case 11:
|
case 11:
|
||||||
gTasks[taskId].tPeriod = PERIOD_AM;
|
gTasks[taskId].tPeriod = PERIOD_AM;
|
||||||
break;
|
|
||||||
case 23:
|
|
||||||
gTasks[taskId].tPeriod = PERIOD_PM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MVMT_FORWARD:
|
case 23:
|
||||||
switch (hours)
|
gTasks[taskId].tPeriod = PERIOD_PM;
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
gTasks[taskId].tPeriod = PERIOD_AM;
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
gTasks[taskId].tPeriod = PERIOD_PM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MOVE_FORWARD:
|
||||||
|
switch (hours)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
gTasks[taskId].tPeriod = PERIOD_AM;
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
gTasks[taskId].tPeriod = PERIOD_PM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1030,14 +1006,11 @@ static void InitClockWithRtc(u8 taskId)
|
|||||||
gTasks[taskId].tMinutes = gLocalTime.minutes;
|
gTasks[taskId].tMinutes = gLocalTime.minutes;
|
||||||
gTasks[taskId].tMinuteHandAngle = gTasks[taskId].tMinutes * 6;
|
gTasks[taskId].tMinuteHandAngle = gTasks[taskId].tMinutes * 6;
|
||||||
gTasks[taskId].tHourHandAngle = (gTasks[taskId].tHours % 12) * 30 + (gTasks[taskId].tMinutes / 10) * 5;
|
gTasks[taskId].tHourHandAngle = (gTasks[taskId].tHours % 12) * 30 + (gTasks[taskId].tMinutes / 10) * 5;
|
||||||
|
|
||||||
if (gLocalTime.hours < 12)
|
if (gLocalTime.hours < 12)
|
||||||
{
|
|
||||||
gTasks[taskId].tPeriod = PERIOD_AM;
|
gTasks[taskId].tPeriod = PERIOD_AM;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gTasks[taskId].tPeriod = PERIOD_PM;
|
gTasks[taskId].tPeriod = PERIOD_PM;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SpriteCB_MinuteHand(struct Sprite *sprite)
|
static void SpriteCB_MinuteHand(struct Sprite *sprite)
|
||||||
@ -1045,22 +1018,19 @@ static void SpriteCB_MinuteHand(struct Sprite *sprite)
|
|||||||
u16 angle = gTasks[sprite->data[0]].tMinuteHandAngle;
|
u16 angle = gTasks[sprite->data[0]].tMinuteHandAngle;
|
||||||
s16 sin = Sin2(angle) / 16;
|
s16 sin = Sin2(angle) / 16;
|
||||||
s16 cos = Cos2(angle) / 16;
|
s16 cos = Cos2(angle) / 16;
|
||||||
u16 xhat, yhat;
|
u16 x, y;
|
||||||
|
|
||||||
SetOamMatrix(0, cos, sin, -sin, cos);
|
SetOamMatrix(0, cos, sin, -sin, cos);
|
||||||
xhat = sClockHandCoords[angle][0];
|
x = sClockHandCoords[angle][0];
|
||||||
yhat = sClockHandCoords[angle][1];
|
y = sClockHandCoords[angle][1];
|
||||||
|
|
||||||
if (xhat > 0x80)
|
if (x > 128)
|
||||||
{
|
x |= 0xff00;
|
||||||
xhat |= 0xff00;
|
if (y > 128)
|
||||||
}
|
y |= 0xff00;
|
||||||
if (yhat > 0x80)
|
|
||||||
{
|
sprite->pos2.x = x;
|
||||||
yhat |= 0xff00;
|
sprite->pos2.y = y;
|
||||||
}
|
|
||||||
sprite->pos2.x = xhat;
|
|
||||||
sprite->pos2.y = yhat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SpriteCB_HourHand(struct Sprite *sprite)
|
static void SpriteCB_HourHand(struct Sprite *sprite)
|
||||||
@ -1068,26 +1038,24 @@ static void SpriteCB_HourHand(struct Sprite *sprite)
|
|||||||
u16 angle = gTasks[sprite->data[0]].tHourHandAngle;
|
u16 angle = gTasks[sprite->data[0]].tHourHandAngle;
|
||||||
s16 sin = Sin2(angle) / 16;
|
s16 sin = Sin2(angle) / 16;
|
||||||
s16 cos = Cos2(angle) / 16;
|
s16 cos = Cos2(angle) / 16;
|
||||||
u16 xhat, yhat;
|
u16 x, y;
|
||||||
|
|
||||||
SetOamMatrix(1, cos, sin, -sin, cos);
|
SetOamMatrix(1, cos, sin, -sin, cos);
|
||||||
xhat = sClockHandCoords[angle][0];
|
x = sClockHandCoords[angle][0];
|
||||||
yhat = sClockHandCoords[angle][1];
|
y = sClockHandCoords[angle][1];
|
||||||
if (xhat > 0x80)
|
|
||||||
{
|
if (x > 128)
|
||||||
xhat |= 0xff00;
|
x |= 0xff00;
|
||||||
}
|
if (y > 128)
|
||||||
if (yhat > 0x80)
|
y |= 0xff00;
|
||||||
{
|
|
||||||
yhat |= 0xff00;
|
sprite->pos2.x = x;
|
||||||
}
|
sprite->pos2.y = y;
|
||||||
sprite->pos2.x = xhat;
|
|
||||||
sprite->pos2.y = yhat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SpriteCB_AMIndicator(struct Sprite *sprite)
|
static void SpriteCB_PMIndicator(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
if (gTasks[sprite->data[0]].tPeriod)
|
if (gTasks[sprite->data[0]].tPeriod != PERIOD_AM)
|
||||||
{
|
{
|
||||||
if (sprite->data[1] >= 60 && sprite->data[1] < 90)
|
if (sprite->data[1] >= 60 && sprite->data[1] < 90)
|
||||||
{
|
{
|
||||||
@ -1113,9 +1081,9 @@ static void SpriteCB_AMIndicator(struct Sprite *sprite)
|
|||||||
sprite->pos2.y = Sin2(sprite->data[1]) * 30 / 0x1000;
|
sprite->pos2.y = Sin2(sprite->data[1]) * 30 / 0x1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SpriteCB_PMIndicator(struct Sprite *sprite)
|
static void SpriteCB_AMIndicator(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
if (gTasks[sprite->data[0]].tPeriod)
|
if (gTasks[sprite->data[0]].tPeriod != PERIOD_AM)
|
||||||
{
|
{
|
||||||
if (sprite->data[1] >= 105 && sprite->data[1] < 135)
|
if (sprite->data[1] >= 105 && sprite->data[1] < 135)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user