diff options
Diffstat (limited to 'src/wallclock.c')
-rw-r--r-- | src/wallclock.c | 893 |
1 files changed, 441 insertions, 452 deletions
diff --git a/src/wallclock.c b/src/wallclock.c index bdef8e0f4..41142e5e2 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -1,16 +1,16 @@ #include "global.h" -#include "wallclock.h" #include "decompress.h" #include "main.h" #include "menu.h" #include "palette.h" #include "rtc.h" -#include "constants/songs.h" +#include "scanline_effect.h" #include "sound.h" #include "strings2.h" #include "task.h" #include "trig.h" -#include "scanline_effect.h" +#include "wallclock.h" +#include "constants/songs.h" extern u16 gSpecialVar_0x8004; extern u8 gMiscClock_Gfx[]; @@ -19,6 +19,44 @@ extern u8 gUnknown_08E954B0[]; extern u16 gMiscClockMale_Pal[]; extern u16 gMiscClockFemale_Pal[]; +static void WallClockMainCallback(void); +static void WallClockInit(void); +static void Task_SetClock1(u8 taskId); +static void Task_SetClock2(u8 taskId); +static void Task_SetClock3(u8 taskId); +static void Task_SetClock4(u8 taskId); +static void Task_SetClock5(u8 taskId); +static void Task_SetClock6(u8 taskId); +static void Task_ViewClock1(u8 taskId); +static void Task_ViewClock2(u8 taskId); +static void Task_ViewClock3(u8 taskId); +static void Task_ViewClock4(u8 taskId); +static u8 CalcMinHandDelta(u16 speed); +static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed); +static u8 AdvanceClock(u8 taskId, u8 direction); +static void UpdateClockPeriod(u8 taskId, u8 direction); +static void InitClockWithRtc(u8 taskId); +static void SpriteCB_MinuteHand(struct Sprite *sprite); +static void SpriteCB_HourHand(struct Sprite *sprite); +static void SpriteCB_AMIndicator(struct Sprite *sprite); +static void SpriteCB_PMIndicator(struct Sprite *sprite); + +#define TAG_GFX_WALL_CLOCK_HAND 0x1000 +#define TAG_PAL_WALL_CLOCK_HAND 0x1000 + +enum +{ + PERIOD_AM, + PERIOD_PM, +}; + +enum +{ + MVMT_NONE, + MVMT_BACKWARD, + MVMT_FORWARD, +}; + //-------------------------------------------------- // Graphics Data //-------------------------------------------------- @@ -69,27 +107,27 @@ static const union AnimCmd *const gSpriteAnimTable_83F7AD4[] = { gSpriteAnim_83F7AC8, }; -static void sub_810B05C(struct Sprite *sprite); + static const struct SpriteTemplate gSpriteTemplate_83F7AD8 = { - .tileTag = 0x1000, - .paletteTag = 0x1000, + .tileTag = TAG_GFX_WALL_CLOCK_HAND, + .paletteTag = TAG_PAL_WALL_CLOCK_HAND, .oam = &gOamData_83F7AB8, .anims = gSpriteAnimTable_83F7AD0, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810B05C, + .callback = SpriteCB_MinuteHand, }; -static void sub_810B0F4(struct Sprite *sprite); + static const struct SpriteTemplate gSpriteTemplate_83F7AF0 = { - .tileTag = 0x1000, - .paletteTag = 0x1000, + .tileTag = TAG_GFX_WALL_CLOCK_HAND, + .paletteTag = TAG_PAL_WALL_CLOCK_HAND, .oam = &gOamData_83F7AB8, .anims = gSpriteAnimTable_83F7AD4, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810B0F4, + .callback = SpriteCB_HourHand, }; static const struct OamData gOamData_83F7B08 = { @@ -125,61 +163,394 @@ static const union AnimCmd *const gSpriteAnimTable_83F7B24[] = { gSpriteAnim_83F7B18, }; -static void sub_810B18C(struct Sprite *sprite); + static const struct SpriteTemplate gSpriteTemplate_83F7B28 = { - .tileTag = 0x1000, - .paletteTag = 0x1000, + .tileTag = TAG_GFX_WALL_CLOCK_HAND, + .paletteTag = TAG_PAL_WALL_CLOCK_HAND, .oam = &gOamData_83F7B08, .anims = gSpriteAnimTable_83F7B20, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810B18C, + .callback = SpriteCB_AMIndicator, }; -static void sub_810B230(struct Sprite *sprite); + static const struct SpriteTemplate gSpriteTemplate_83F7B40 = { - .tileTag = 0x1000, - .paletteTag = 0x1000, + .tileTag = TAG_GFX_WALL_CLOCK_HAND, + .paletteTag = TAG_PAL_WALL_CLOCK_HAND, .oam = &gOamData_83F7B08, .anims = gSpriteAnimTable_83F7B24, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810B230, + .callback = SpriteCB_PMIndicator, }; -static void WallClockVblankCallback(void); -static void LoadWallClockGraphics(void); -static void WallClockMainCallback(void); -static void WallClockInit(void); -static void Task_SetClock1(u8 taskId); -static void Task_SetClock2(u8 taskId); -static void Task_SetClock3(u8 taskId); -static void Task_SetClock4(u8 taskId); -static void Task_SetClock5(u8 taskId); -static void Task_SetClock6(u8 taskId); -static void Task_ViewClock1(u8 taskId); -static void Task_ViewClock2(u8 taskId); -static void Task_ViewClock3(u8 taskId); -static void Task_ViewClock4(u8 taskId); -static u8 CalcMinHandDelta(u16 speed); -static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed); -static u8 AdvanceClock(u8 taskId, u8 direction); -static void UpdateClockPeriod(u8 taskId, u8 direction); -static void InitClockWithRtc(u8 taskId); - -enum +static const s8 sClockHandCoords[][2] = { - PERIOD_AM, - PERIOD_PM, + { 0, -24}, + { 1, -25}, + { 1, -25}, + { 2, -25}, + { 2, -25}, + { 2, -25}, + { 3, -24}, + { 3, -25}, + { 4, -25}, + { 4, -25}, + { 4, -25}, + { 5, -25}, + { 5, -25}, + { 6, -24}, + { 6, -24}, + { 6, -24}, + { 7, -24}, + { 7, -24}, + { 7, -24}, + { 8, -24}, + { 8, -24}, + { 9, -24}, + { 9, -24}, + { 10, -23}, + { 10, -23}, + { 11, -22}, + { 11, -22}, + { 11, -22}, + { 12, -22}, + { 12, -21}, + { 13, -21}, + { 13, -21}, + { 13, -21}, + { 14, -21}, + { 14, -21}, + { 14, -20}, + { 14, -20}, + { 15, -20}, + { 15, -19}, + { 16, -19}, + { 16, -19}, + { 16, -19}, + { 16, -18}, + { 16, -18}, + { 17, -18}, + { 17, -17}, + { 17, -17}, + { 18, -17}, + { 18, -17}, + { 18, -16}, + { 18, -16}, + { 19, -16}, + { 19, -15}, + { 19, -15}, + { 20, -15}, + { 20, -14}, + { 20, -14}, + { 20, -13}, + { 20, -13}, + { 21, -13}, + { 21, -13}, + { 21, -12}, + { 22, -12}, + { 22, -12}, + { 22, -11}, + { 22, -11}, + { 22, -10}, + { 23, -10}, + { 23, -9}, + { 23, -9}, + { 23, -9}, + { 23, -9}, + { 23, -8}, + { 23, -8}, + { 23, -7}, + { 23, -7}, + { 23, -6}, + { 24, -6}, + { 24, -6}, + { 25, -5}, + { 25, -5}, + { 24, -4}, + { 25, -4}, + { 24, -3}, + { 25, -3}, + { 25, -3}, + { 25, -2}, + { 25, -2}, + { 24, -1}, + { 25, -1}, + { 24, 0}, + { 24, 0}, + { 24, 0}, + { 24, 1}, + { 24, 1}, + { 25, 2}, + { 24, 2}, + { 25, 2}, + { 24, 3}, + { 24, 3}, + { 25, 4}, + { 24, 4}, + { 24, 5}, + { 24, 5}, + { 24, 5}, + { 24, 6}, + { 23, 6}, + { 23, 6}, + { 23, 7}, + { 23, 8}, + { 23, 8}, + { 23, 8}, + { 23, 9}, + { 23, 9}, + { 23, 10}, + { 22, 10}, + { 22, 10}, + { 22, 11}, + { 22, 11}, + { 22, 11}, + { 22, 12}, + { 21, 12}, + { 21, 12}, + { 21, 13}, + { 20, 13}, + { 20, 13}, + { 19, 13}, + { 19, 13}, + { 19, 14}, + { 19, 14}, + { 19, 15}, + { 19, 15}, + { 18, 15}, + { 18, 16}, + { 17, 16}, + { 17, 16}, + { 17, 17}, + { 17, 17}, + { 16, 17}, + { 16, 18}, + { 16, 18}, + { 15, 18}, + { 14, 18}, + { 15, 19}, + { 14, 19}, + { 14, 19}, + { 13, 19}, + { 13, 20}, + { 13, 20}, + { 13, 20}, + { 12, 20}, + { 12, 20}, + { 12, 21}, + { 11, 21}, + { 11, 21}, + { 11, 21}, + { 10, 21}, + { 10, 22}, + { 10, 22}, + { 9, 22}, + { 9, 22}, + { 8, 22}, + { 7, 22}, + { 7, 23}, + { 7, 23}, + { 6, 23}, + { 6, 23}, + { 5, 23}, + { 5, 23}, + { 5, 24}, + { 4, 24}, + { 4, 24}, + { 4, 24}, + { 3, 24}, + { 2, 24}, + { 2, 24}, + { 1, 24}, + { 1, 24}, + { 0, 24}, + { 0, 24}, + { -1, 23}, + { 0, 24}, + { 0, 24}, + { -1, 24}, + { -1, 24}, + { -2, 24}, + { -2, 24}, + { -3, 24}, + { -3, 24}, + { -4, 24}, + { -4, 24}, + { -5, 24}, + { -5, 23}, + { -5, 23}, + { -6, 23}, + { -6, 23}, + { -7, 23}, + { -7, 23}, + { -7, 23}, + { -8, 23}, + { -8, 22}, + { -9, 22}, + { -9, 22}, + {-10, 22}, + {-10, 22}, + {-10, 21}, + {-11, 21}, + {-11, 21}, + {-11, 21}, + {-11, 20}, + {-12, 20}, + {-12, 20}, + {-13, 20}, + {-13, 20}, + {-13, 19}, + {-14, 19}, + {-14, 19}, + {-14, 19}, + {-14, 18}, + {-15, 18}, + {-15, 18}, + {-15, 17}, + {-16, 17}, + {-16, 17}, + {-17, 17}, + {-17, 16}, + {-17, 16}, + {-18, 16}, + {-17, 15}, + {-18, 15}, + {-18, 15}, + {-19, 15}, + {-19, 14}, + {-19, 14}, + {-19, 13}, + {-19, 13}, + {-20, 13}, + {-20, 12}, + {-20, 12}, + {-21, 12}, + {-21, 12}, + {-21, 11}, + {-21, 11}, + {-21, 10}, + {-21, 10}, + {-21, 9}, + {-22, 9}, + {-22, 9}, + {-22, 8}, + {-22, 8}, + {-22, 7}, + {-23, 7}, + {-23, 7}, + {-23, 6}, + {-23, 6}, + {-23, 5}, + {-24, 5}, + {-23, 4}, + {-23, 4}, + {-24, 4}, + {-24, 4}, + {-24, 3}, + {-24, 3}, + {-24, 2}, + {-24, 2}, + {-24, 1}, + {-24, 1}, + {-24, 1}, + {-24, 0}, + {-25, 0}, + {-24, -1}, + {-25, -1}, + {-24, -1}, + {-24, -2}, + {-24, -2}, + {-24, -3}, + {-24, -3}, + {-24, -4}, + {-24, -4}, + {-24, -4}, + {-24, -5}, + {-24, -5}, + {-24, -6}, + {-24, -6}, + {-23, -6}, + {-23, -7}, + {-23, -7}, + {-23, -8}, + {-23, -8}, + {-23, -9}, + {-23, -9}, + {-22, -9}, + {-22, -9}, + {-22, -10}, + {-22, -10}, + {-21, -10}, + {-21, -11}, + {-22, -11}, + {-22, -12}, + {-21, -12}, + {-21, -13}, + {-21, -13}, + {-20, -13}, + {-21, -14}, + {-20, -14}, + {-20, -14}, + {-19, -14}, + {-19, -15}, + {-19, -15}, + {-18, -16}, + {-18, -16}, + {-18, -16}, + {-18, -17}, + {-18, -17}, + {-17, -17}, + {-17, -18}, + {-17, -18}, + {-16, -18}, + {-16, -18}, + {-16, -19}, + {-16, -19}, + {-15, -19}, + {-15, -19}, + {-15, -20}, + {-14, -20}, + {-14, -20}, + {-14, -21}, + {-13, -21}, + {-13, -21}, + {-13, -21}, + {-12, -21}, + {-12, -22}, + {-11, -22}, + {-11, -22}, + {-11, -22}, + {-10, -22}, + {-10, -22}, + { -9, -22}, + { -9, -23}, + { -9, -23}, + { -8, -23}, + { -8, -23}, + { -7, -23}, + { -7, -23}, + { -7, -24}, + { -6, -24}, + { -6, -24}, + { -5, -24}, + { -5, -24}, + { -4, -24}, + { -4, -24}, + { -4, -24}, + { -4, -25}, + { -3, -25}, + { -2, -25}, + { -2, -24}, + { -2, -24}, + { -1, -25}, + { -1, -25}, + { 0, -25}, }; -enum -{ - MVMT_NONE, - MVMT_BACKWARD, - MVMT_FORWARD, -}; +// text static void WallClockVblankCallback(void) { @@ -487,7 +858,7 @@ static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed) { case MVMT_BACKWARD: if (angle) - angle = angle - delta; + angle -= delta; else angle = 360 - delta; break; @@ -581,384 +952,16 @@ static void InitClockWithRtc(u8 taskId) gTasks[taskId].tPeriod = PERIOD_PM; } -static const s8 gClockHandCoords[][2] = +static void SpriteCB_MinuteHand(struct Sprite *sprite) { - { 0, -24}, - { 1, -25}, - { 1, -25}, - { 2, -25}, - { 2, -25}, - { 2, -25}, - { 3, -24}, - { 3, -25}, - { 4, -25}, - { 4, -25}, - { 4, -25}, - { 5, -25}, - { 5, -25}, - { 6, -24}, - { 6, -24}, - { 6, -24}, - { 7, -24}, - { 7, -24}, - { 7, -24}, - { 8, -24}, - { 8, -24}, - { 9, -24}, - { 9, -24}, - { 10, -23}, - { 10, -23}, - { 11, -22}, - { 11, -22}, - { 11, -22}, - { 12, -22}, - { 12, -21}, - { 13, -21}, - { 13, -21}, - { 13, -21}, - { 14, -21}, - { 14, -21}, - { 14, -20}, - { 14, -20}, - { 15, -20}, - { 15, -19}, - { 16, -19}, - { 16, -19}, - { 16, -19}, - { 16, -18}, - { 16, -18}, - { 17, -18}, - { 17, -17}, - { 17, -17}, - { 18, -17}, - { 18, -17}, - { 18, -16}, - { 18, -16}, - { 19, -16}, - { 19, -15}, - { 19, -15}, - { 20, -15}, - { 20, -14}, - { 20, -14}, - { 20, -13}, - { 20, -13}, - { 21, -13}, - { 21, -13}, - { 21, -12}, - { 22, -12}, - { 22, -12}, - { 22, -11}, - { 22, -11}, - { 22, -10}, - { 23, -10}, - { 23, -9}, - { 23, -9}, - { 23, -9}, - { 23, -9}, - { 23, -8}, - { 23, -8}, - { 23, -7}, - { 23, -7}, - { 23, -6}, - { 24, -6}, - { 24, -6}, - { 25, -5}, - { 25, -5}, - { 24, -4}, - { 25, -4}, - { 24, -3}, - { 25, -3}, - { 25, -3}, - { 25, -2}, - { 25, -2}, - { 24, -1}, - { 25, -1}, - { 24, 0}, - { 24, 0}, - { 24, 0}, - { 24, 1}, - { 24, 1}, - { 25, 2}, - { 24, 2}, - { 25, 2}, - { 24, 3}, - { 24, 3}, - { 25, 4}, - { 24, 4}, - { 24, 5}, - { 24, 5}, - { 24, 5}, - { 24, 6}, - { 23, 6}, - { 23, 6}, - { 23, 7}, - { 23, 8}, - { 23, 8}, - { 23, 8}, - { 23, 9}, - { 23, 9}, - { 23, 10}, - { 22, 10}, - { 22, 10}, - { 22, 11}, - { 22, 11}, - { 22, 11}, - { 22, 12}, - { 21, 12}, - { 21, 12}, - { 21, 13}, - { 20, 13}, - { 20, 13}, - { 19, 13}, - { 19, 13}, - { 19, 14}, - { 19, 14}, - { 19, 15}, - { 19, 15}, - { 18, 15}, - { 18, 16}, - { 17, 16}, - { 17, 16}, - { 17, 17}, - { 17, 17}, - { 16, 17}, - { 16, 18}, - { 16, 18}, - { 15, 18}, - { 14, 18}, - { 15, 19}, - { 14, 19}, - { 14, 19}, - { 13, 19}, - { 13, 20}, - { 13, 20}, - { 13, 20}, - { 12, 20}, - { 12, 20}, - { 12, 21}, - { 11, 21}, - { 11, 21}, - { 11, 21}, - { 10, 21}, - { 10, 22}, - { 10, 22}, - { 9, 22}, - { 9, 22}, - { 8, 22}, - { 7, 22}, - { 7, 23}, - { 7, 23}, - { 6, 23}, - { 6, 23}, - { 5, 23}, - { 5, 23}, - { 5, 24}, - { 4, 24}, - { 4, 24}, - { 4, 24}, - { 3, 24}, - { 2, 24}, - { 2, 24}, - { 1, 24}, - { 1, 24}, - { 0, 24}, - { 0, 24}, - { -1, 23}, - { 0, 24}, - { 0, 24}, - { -1, 24}, - { -1, 24}, - { -2, 24}, - { -2, 24}, - { -3, 24}, - { -3, 24}, - { -4, 24}, - { -4, 24}, - { -5, 24}, - { -5, 23}, - { -5, 23}, - { -6, 23}, - { -6, 23}, - { -7, 23}, - { -7, 23}, - { -7, 23}, - { -8, 23}, - { -8, 22}, - { -9, 22}, - { -9, 22}, - {-10, 22}, - {-10, 22}, - {-10, 21}, - {-11, 21}, - {-11, 21}, - {-11, 21}, - {-11, 20}, - {-12, 20}, - {-12, 20}, - {-13, 20}, - {-13, 20}, - {-13, 19}, - {-14, 19}, - {-14, 19}, - {-14, 19}, - {-14, 18}, - {-15, 18}, - {-15, 18}, - {-15, 17}, - {-16, 17}, - {-16, 17}, - {-17, 17}, - {-17, 16}, - {-17, 16}, - {-18, 16}, - {-17, 15}, - {-18, 15}, - {-18, 15}, - {-19, 15}, - {-19, 14}, - {-19, 14}, - {-19, 13}, - {-19, 13}, - {-20, 13}, - {-20, 12}, - {-20, 12}, - {-21, 12}, - {-21, 12}, - {-21, 11}, - {-21, 11}, - {-21, 10}, - {-21, 10}, - {-21, 9}, - {-22, 9}, - {-22, 9}, - {-22, 8}, - {-22, 8}, - {-22, 7}, - {-23, 7}, - {-23, 7}, - {-23, 6}, - {-23, 6}, - {-23, 5}, - {-24, 5}, - {-23, 4}, - {-23, 4}, - {-24, 4}, - {-24, 4}, - {-24, 3}, - {-24, 3}, - {-24, 2}, - {-24, 2}, - {-24, 1}, - {-24, 1}, - {-24, 1}, - {-24, 0}, - {-25, 0}, - {-24, -1}, - {-25, -1}, - {-24, -1}, - {-24, -2}, - {-24, -2}, - {-24, -3}, - {-24, -3}, - {-24, -4}, - {-24, -4}, - {-24, -4}, - {-24, -5}, - {-24, -5}, - {-24, -6}, - {-24, -6}, - {-23, -6}, - {-23, -7}, - {-23, -7}, - {-23, -8}, - {-23, -8}, - {-23, -9}, - {-23, -9}, - {-22, -9}, - {-22, -9}, - {-22, -10}, - {-22, -10}, - {-21, -10}, - {-21, -11}, - {-22, -11}, - {-22, -12}, - {-21, -12}, - {-21, -13}, - {-21, -13}, - {-20, -13}, - {-21, -14}, - {-20, -14}, - {-20, -14}, - {-19, -14}, - {-19, -15}, - {-19, -15}, - {-18, -16}, - {-18, -16}, - {-18, -16}, - {-18, -17}, - {-18, -17}, - {-17, -17}, - {-17, -18}, - {-17, -18}, - {-16, -18}, - {-16, -18}, - {-16, -19}, - {-16, -19}, - {-15, -19}, - {-15, -19}, - {-15, -20}, - {-14, -20}, - {-14, -20}, - {-14, -21}, - {-13, -21}, - {-13, -21}, - {-13, -21}, - {-12, -21}, - {-12, -22}, - {-11, -22}, - {-11, -22}, - {-11, -22}, - {-10, -22}, - {-10, -22}, - { -9, -22}, - { -9, -23}, - { -9, -23}, - { -8, -23}, - { -8, -23}, - { -7, -23}, - { -7, -23}, - { -7, -24}, - { -6, -24}, - { -6, -24}, - { -5, -24}, - { -5, -24}, - { -4, -24}, - { -4, -24}, - { -4, -24}, - { -4, -25}, - { -3, -25}, - { -2, -25}, - { -2, -24}, - { -2, -24}, - { -1, -25}, - { -1, -25}, - { 0, -25}, -}; + u16 angle = gTasks[sprite->data[0]].tMinuteHandAngle; + s16 sin = Sin2(angle) / 16; + s16 cos = Cos2(angle) / 16; + u16 x, y; -static void sub_810B05C(struct Sprite *sprite) -{ - u16 angle; - s16 sin; - s16 cos; - u16 x; - u16 y; - - angle = gTasks[sprite->data[0]].tMinuteHandAngle; - sin = Sin2(angle) / 16; - cos = Cos2(angle) / 16; SetOamMatrix(0, cos, sin, -sin, cos); - x = gClockHandCoords[angle][0]; - y = gClockHandCoords[angle][1]; + x = sClockHandCoords[angle][0]; + y = sClockHandCoords[angle][1]; //Manual sign extension if (x > 0x80) @@ -970,20 +973,16 @@ static void sub_810B05C(struct Sprite *sprite) sprite->pos2.y = y; } -static void sub_810B0F4(struct Sprite *sprite) +static void SpriteCB_HourHand(struct Sprite *sprite) { - u16 angle; - s16 sin; - s16 cos; - u16 x; - u16 y; - - angle = gTasks[sprite->data[0]].tHourHandAngle; - sin = Sin2(angle) / 16; - cos = Cos2(angle) / 16; + u16 angle = gTasks[sprite->data[0]].tHourHandAngle; + s16 sin = Sin2(angle) / 16; + s16 cos = Cos2(angle) / 16; + u16 x, y; + SetOamMatrix(1, cos, sin, -sin, cos); - x = gClockHandCoords[angle][0]; - y = gClockHandCoords[angle][1]; + x = sClockHandCoords[angle][0]; + y = sClockHandCoords[angle][1]; //Manual sign extension if (x > 0x80) @@ -995,11 +994,8 @@ static void sub_810B0F4(struct Sprite *sprite) sprite->pos2.y = y; } -static void sub_810B18C(struct Sprite *sprite) +static void SpriteCB_AMIndicator(struct Sprite *sprite) { - s16 sin; - s16 cos; - if (gTasks[sprite->data[0]].tPeriod != PERIOD_AM) { if (sprite->data[1] >= 60 && sprite->data[1] < 90) @@ -1014,17 +1010,12 @@ static void sub_810B18C(struct Sprite *sprite) if (sprite->data[1] > 75) sprite->data[1]--; } - cos = Cos2((u16)sprite->data[1]); - sprite->pos2.x = cos * 30 / 4096; - sin = Sin2((u16)sprite->data[1]); - sprite->pos2.y = sin * 30 / 4096; + sprite->pos2.x = Cos2(sprite->data[1]) * 30 / 4096; + sprite->pos2.y = Sin2(sprite->data[1]) * 30 / 4096; } -static void sub_810B230(struct Sprite *sprite) +static void SpriteCB_PMIndicator(struct Sprite *sprite) { - s16 sin; - s16 cos; - if (gTasks[sprite->data[0]].tPeriod != PERIOD_AM) { if (sprite->data[1] >= 105 && sprite->data[1] < 135) @@ -1039,8 +1030,6 @@ static void sub_810B230(struct Sprite *sprite) if (sprite->data[1] > 120) sprite->data[1]--; } - cos = Cos2((u16)sprite->data[1]); - sprite->pos2.x = cos * 30 / 4096; - sin = Sin2((u16)sprite->data[1]); - sprite->pos2.y = sin * 30 / 4096; + sprite->pos2.x = Cos2(sprite->data[1]) * 30 / 4096; + sprite->pos2.y = Sin2(sprite->data[1]) * 30 / 4096; } |