mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-07-19 17:01:51 -05:00
Document Poketch Color Changer (Overlay 49) (#799)
This commit is contained in:
parent
24ed52d82f
commit
e4e6bb82b2
41
include/applications/poketch/color_changer/graphics.h
Normal file
41
include/applications/poketch/color_changer/graphics.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef POKEPLATINUM_POKETCH_COLOR_CHANGER_H
|
||||
#define POKEPLATINUM_POKETCH_COLOR_CHANGER_H
|
||||
|
||||
#include "applications/poketch/poketch_animation.h"
|
||||
#include "applications/poketch/poketch_task.h"
|
||||
|
||||
#include "bg_window.h"
|
||||
#include "poketch.h"
|
||||
|
||||
#define COLOR_CHANGER_TASK_SLOTS 4
|
||||
|
||||
#define COLOR_SLIDER_LEFT_X 56
|
||||
#define COLOR_SLIDER_Y 148
|
||||
#define COLOR_SLIDER_WIDTH 16
|
||||
|
||||
typedef struct ColorChangerData {
|
||||
enum PoketchScreenColor color;
|
||||
} ColorChangerData;
|
||||
|
||||
typedef struct ColorChangerGraphics {
|
||||
const ColorChangerData *colorData;
|
||||
BgConfig *bgConfig;
|
||||
u32 activeTasks[POKETCH_TASK_SLOT_BASE + COLOR_CHANGER_TASK_SLOTS];
|
||||
PoketchAnimation_AnimationManager *animMan;
|
||||
PoketchAnimation_AnimatedSpriteData *sprite;
|
||||
PoketchAnimation_SpriteData spriteData;
|
||||
} ColorChangerGraphics;
|
||||
|
||||
enum ColorChangerGraphicsTask {
|
||||
COLOR_CHANGER_GRAPHICS_INIT = 0,
|
||||
COLOR_CHANGER_GRAPHICS_FREE,
|
||||
COLOR_CHANGER_GRAPHICS_UPDATE_COLOR,
|
||||
};
|
||||
|
||||
BOOL PoketchColorChangerGraphics_New(ColorChangerGraphics **dest, const ColorChangerData *colorData, BgConfig *bgConfig);
|
||||
void PoketchColorChangerGraphics_Free(ColorChangerGraphics *graphics);
|
||||
void PoketchColorChangerGraphics_StartTask(ColorChangerGraphics *graphics, enum ColorChangerGraphicsTask taskID);
|
||||
BOOL PoketchColorChanger_TaskIsNotActive(ColorChangerGraphics *graphics, enum ColorChangerGraphicsTask taskID);
|
||||
BOOL PoketchColorChangerGraphics_NoActiveTasks(ColorChangerGraphics *graphics);
|
||||
|
||||
#endif // POKEPLATINUM_POKETCH_COLOR_CHANGER_H
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef POKEPLATINUM_OV49_022563D4_H
|
||||
#define POKEPLATINUM_OV49_022563D4_H
|
||||
|
||||
#include "overlay049/struct_ov49_022563D4_1.h"
|
||||
#include "overlay049/struct_ov49_022563D4_decl.h"
|
||||
|
||||
#include "bg_window.h"
|
||||
|
||||
BOOL ov49_022563D4(UnkStruct_ov49_022563D4 **param0, const UnkStruct_ov49_022563D4_1 *param1, BgConfig *param2);
|
||||
void ov49_02256480(UnkStruct_ov49_022563D4 *param0);
|
||||
void ov49_02256494(UnkStruct_ov49_022563D4 *param0, u32 param1);
|
||||
BOOL ov49_022564B8(UnkStruct_ov49_022563D4 *param0, u32 param1);
|
||||
BOOL ov49_022564C4(UnkStruct_ov49_022563D4 *param0);
|
||||
|
||||
#endif // POKEPLATINUM_OV49_022563D4_H
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef POKEPLATINUM_STRUCT_OV49_022563D4_1_H
|
||||
#define POKEPLATINUM_STRUCT_OV49_022563D4_1_H
|
||||
|
||||
typedef struct {
|
||||
u32 unk_00;
|
||||
} UnkStruct_ov49_022563D4_1;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_OV49_022563D4_1_H
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef POKEPLATINUM_STRUCT_OV49_022563D4_DECL_H
|
||||
#define POKEPLATINUM_STRUCT_OV49_022563D4_DECL_H
|
||||
|
||||
typedef struct UnkStruct_ov49_022563D4_t UnkStruct_ov49_022563D4;
|
||||
|
||||
#endif // POKEPLATINUM_STRUCT_OV49_022563D4_DECL_H
|
||||
|
|
@ -1040,11 +1040,11 @@ Overlay overlay48
|
|||
Object main.nef.p/src_overlay048_ov48_0225650C.c.o
|
||||
}
|
||||
|
||||
Overlay overlay49
|
||||
Overlay poketch_color_changer
|
||||
{
|
||||
After overlay25
|
||||
Object main.nef.p/src_overlay049_ov49_022561C0.c.o
|
||||
Object main.nef.p/src_overlay049_ov49_022563D4.c.o
|
||||
Object main.nef.p/src_applications_poketch_color_changer_main.c.o
|
||||
Object main.nef.p/src_applications_poketch_color_changer_graphics.c.o
|
||||
}
|
||||
|
||||
Overlay overlay50
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ e722ce81a98e1d78011e179f008a4cac37e20610 *poketch_alarm_clock.sbin
|
|||
87cd3ac2574737177d399a8cf8a8374c9599e38b *overlay46.sbin
|
||||
b38da9fe733a6a1213ff217f4e2788e3ae2011a4 *poketch_marking_map.sbin
|
||||
70266035d948ee5a826b06a3a1b908a50af050c9 *overlay48.sbin
|
||||
489ae29169ae71eb72909fdebdd0aa8bf8ca63f4 *overlay49.sbin
|
||||
489ae29169ae71eb72909fdebdd0aa8bf8ca63f4 *poketch_color_changer.sbin
|
||||
2c6a1fb46550bdb140c677e37ae06779b84e7c3e *overlay50.sbin
|
||||
13069defd90d47eebe9eb4a48974e82369614fa7 *overlay51.sbin
|
||||
4963a7d852a9691cdd9382f42c527d0c457fb520 *overlay52.sbin
|
||||
|
|
|
|||
155
src/applications/poketch/color_changer/graphics.c
Normal file
155
src/applications/poketch/color_changer/graphics.c
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
#include "applications/poketch/color_changer/graphics.h"
|
||||
|
||||
#include "nitro/fx/fx.h"
|
||||
#include <nitro.h>
|
||||
|
||||
#include "generated/sdat.h"
|
||||
|
||||
#include "applications/poketch/poketch_animation.h"
|
||||
#include "applications/poketch/poketch_graphics.h"
|
||||
#include "applications/poketch/poketch_system.h"
|
||||
#include "applications/poketch/poketch_task.h"
|
||||
|
||||
#include "bg_window.h"
|
||||
#include "graphics.h"
|
||||
#include "heap.h"
|
||||
#include "sys_task_manager.h"
|
||||
|
||||
static void SetupSprites(ColorChangerGraphics *graphics, const ColorChangerData *colorData);
|
||||
static void UnloadSprites(ColorChangerGraphics *graphics);
|
||||
static void EndTask(PoketchTaskManager *taskMan);
|
||||
static void Task_DrawBackground(SysTask *task, void *taskMan);
|
||||
static void Task_FreeBackground(SysTask *task, void *taskMan);
|
||||
static void Task_UpdateColor(SysTask *task, void *taskMan);
|
||||
|
||||
BOOL PoketchColorChangerGraphics_New(ColorChangerGraphics **dest, const ColorChangerData *colorData, BgConfig *bgConfig)
|
||||
{
|
||||
ColorChangerGraphics *graphics = Heap_Alloc(HEAP_ID_POKETCH_APP, sizeof(ColorChangerGraphics));
|
||||
|
||||
if (graphics != NULL) {
|
||||
PoketchTask_InitActiveTaskList(graphics->activeTasks, COLOR_CHANGER_TASK_SLOTS);
|
||||
graphics->colorData = colorData;
|
||||
graphics->bgConfig = PoketchGraphics_GetBgConfig();
|
||||
graphics->animMan = PoketchGraphics_GetAnimationManager();
|
||||
SetupSprites(graphics, colorData);
|
||||
*dest = graphics;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void SetupSprites(ColorChangerGraphics *graphics, const ColorChangerData *colorData)
|
||||
{
|
||||
static const PoketchAnimation_AnimationData animData = {
|
||||
.translation = { FX32_CONST(COLOR_SLIDER_LEFT_X), FX32_CONST(COLOR_SLIDER_Y) },
|
||||
.animIdx = 0,
|
||||
.flip = NNS_G2D_RENDERERFLIP_NONE,
|
||||
.oamPriority = 2,
|
||||
.priority = 0,
|
||||
.hasAffineTransform = FALSE
|
||||
};
|
||||
|
||||
Graphics_LoadObjectTiles(NARC_INDEX_GRAPHIC__POKETCH, 69, DS_SCREEN_SUB, 0, 0, TRUE, HEAP_ID_POKETCH_APP);
|
||||
|
||||
PoketchAnimation_LoadSpriteFromNARC(&graphics->spriteData, NARC_INDEX_GRAPHIC__POKETCH, 67, 68, HEAP_ID_POKETCH_APP);
|
||||
graphics->sprite = PoketchAnimation_SetupNewAnimatedSprite(graphics->animMan, &animData, &graphics->spriteData);
|
||||
PoketchAnimation_SetSpritePosition(graphics->sprite, (COLOR_SLIDER_LEFT_X + (COLOR_SLIDER_WIDTH * colorData->color)) << FX32_SHIFT, FX32_CONST(COLOR_SLIDER_Y));
|
||||
}
|
||||
|
||||
static void UnloadSprites(ColorChangerGraphics *graphics)
|
||||
{
|
||||
if (graphics->sprite) {
|
||||
PoketchAnimation_RemoveAnimatedSprite(graphics->animMan, graphics->sprite);
|
||||
}
|
||||
|
||||
PoketchAnimation_FreeSpriteData(&graphics->spriteData);
|
||||
}
|
||||
|
||||
void PoketchColorChangerGraphics_Free(ColorChangerGraphics *graphics)
|
||||
{
|
||||
if (graphics != NULL) {
|
||||
UnloadSprites(graphics);
|
||||
Heap_Free(graphics);
|
||||
}
|
||||
}
|
||||
|
||||
static const PoketchTask sColorChangerTasks[] = {
|
||||
{ COLOR_CHANGER_GRAPHICS_INIT, Task_DrawBackground, 0 },
|
||||
{ COLOR_CHANGER_GRAPHICS_FREE, Task_FreeBackground, 0 },
|
||||
{ COLOR_CHANGER_GRAPHICS_UPDATE_COLOR, Task_UpdateColor, 0 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
void PoketchColorChangerGraphics_StartTask(ColorChangerGraphics *graphics, enum ColorChangerGraphicsTask taskID)
|
||||
{
|
||||
PoketchTask_Start(sColorChangerTasks, taskID, graphics, graphics->colorData, graphics->activeTasks, 2, HEAP_ID_POKETCH_APP);
|
||||
}
|
||||
|
||||
BOOL PoketchColorChanger_TaskIsNotActive(ColorChangerGraphics *graphics, enum ColorChangerGraphicsTask taskID)
|
||||
{
|
||||
return PoketchTask_TaskIsNotActive(graphics->activeTasks, taskID);
|
||||
}
|
||||
|
||||
BOOL PoketchColorChangerGraphics_NoActiveTasks(ColorChangerGraphics *graphics)
|
||||
{
|
||||
return PoketchTask_NoActiveTasks(graphics->activeTasks);
|
||||
}
|
||||
|
||||
static void EndTask(PoketchTaskManager *taskMan)
|
||||
{
|
||||
ColorChangerGraphics *graphics = PoketchTask_GetTaskData(taskMan);
|
||||
PoketchTask_EndTask(graphics->activeTasks, taskMan);
|
||||
}
|
||||
|
||||
static void Task_DrawBackground(SysTask *task, void *taskMan)
|
||||
{
|
||||
static const BgTemplate bgTemplate = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0x800,
|
||||
.baseTile = 0,
|
||||
.screenSize = BG_SCREEN_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x7000,
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 2,
|
||||
.areaOver = 0,
|
||||
.mosaic = FALSE,
|
||||
};
|
||||
ColorChangerGraphics *graphics = PoketchTask_GetTaskData(taskMan);
|
||||
const ColorChangerData *colorData = PoketchTask_GetConstTaskData(taskMan);
|
||||
|
||||
Bg_InitFromTemplate(graphics->bgConfig, BG_LAYER_SUB_2, &bgTemplate, BG_TYPE_STATIC);
|
||||
Graphics_LoadTilesToBgLayer(NARC_INDEX_GRAPHIC__POKETCH, 66, graphics->bgConfig, BG_LAYER_SUB_2, 0, 0, TRUE, HEAP_ID_POKETCH_APP);
|
||||
Graphics_LoadTilemapToBgLayer(NARC_INDEX_GRAPHIC__POKETCH, 65, graphics->bgConfig, BG_LAYER_SUB_2, 0, 0, TRUE, HEAP_ID_POKETCH_APP);
|
||||
|
||||
PoketchGraphics_LoadActivePalette(0, 0);
|
||||
Bg_CopyTilemapBufferToVRAM(graphics->bgConfig, BG_LAYER_SUB_2);
|
||||
|
||||
GXSDispCnt dispCnt = GXS_GetDispCnt();
|
||||
GXS_SetVisiblePlane(dispCnt.visiblePlane | GX_PLANEMASK_BG2);
|
||||
|
||||
EndTask(taskMan);
|
||||
}
|
||||
|
||||
static void Task_FreeBackground(SysTask *task, void *taskMan)
|
||||
{
|
||||
ColorChangerGraphics *graphics = PoketchTask_GetTaskData(taskMan);
|
||||
|
||||
Bg_FreeTilemapBuffer(graphics->bgConfig, BG_LAYER_SUB_2);
|
||||
EndTask(taskMan);
|
||||
}
|
||||
|
||||
static void Task_UpdateColor(SysTask *task, void *taskMan)
|
||||
{
|
||||
ColorChangerGraphics *graphics = PoketchTask_GetTaskData(taskMan);
|
||||
const ColorChangerData *colorData = PoketchTask_GetConstTaskData(taskMan);
|
||||
|
||||
PoketchSystem_PlaySoundEffect(SEQ_SE_DP_POKETCH_003);
|
||||
PoketchGraphics_LoadActivePalette(0, 0);
|
||||
PoketchAnimation_SetSpritePosition(graphics->sprite, (COLOR_SLIDER_LEFT_X + (COLOR_SLIDER_WIDTH * colorData->color)) << FX32_SHIFT, FX32_CONST(COLOR_SLIDER_Y));
|
||||
EndTask(taskMan);
|
||||
}
|
||||
212
src/applications/poketch/color_changer/main.c
Normal file
212
src/applications/poketch/color_changer/main.c
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
#include <nitro.h>
|
||||
#include <nitro/sinit.h>
|
||||
|
||||
#include "applications/poketch/color_changer/graphics.h"
|
||||
#include "applications/poketch/poketch_system.h"
|
||||
|
||||
#include "bg_window.h"
|
||||
#include "heap.h"
|
||||
#include "poketch.h"
|
||||
#include "sys_task.h"
|
||||
#include "sys_task_manager.h"
|
||||
#include "touch_screen.h"
|
||||
|
||||
typedef struct PoketchColorChanger {
|
||||
u8 state;
|
||||
u8 subState;
|
||||
u8 shouldExit;
|
||||
u8 currentColor;
|
||||
ColorChangerData colorData;
|
||||
ColorChangerGraphics *graphics;
|
||||
PoketchSystem *poketchSys;
|
||||
Poketch *poketch;
|
||||
} PoketchColorChanger;
|
||||
|
||||
typedef BOOL (*StateFunc)(PoketchColorChanger *);
|
||||
|
||||
enum ColorChangerState {
|
||||
STATE_LOAD_APP = 0,
|
||||
STATE_UPDATE_LOOP,
|
||||
STATE_SHUTDOWN,
|
||||
};
|
||||
|
||||
static void NitroStaticInit(void);
|
||||
|
||||
static BOOL New(void **appData, PoketchSystem *poketchSys, BgConfig *bgConfig, u32 appID);
|
||||
static BOOL Init(PoketchColorChanger *appData, PoketchSystem *poketchSys, BgConfig *bgConfig, u32 appID);
|
||||
static void Free(PoketchColorChanger *appData);
|
||||
static void Exit(void *appData);
|
||||
|
||||
static void Task_Main(SysTask *task, void *appData);
|
||||
static void ChangeState(PoketchColorChanger *appData, enum ColorChangerState newState);
|
||||
static BOOL State_LoadApp(PoketchColorChanger *appData);
|
||||
static BOOL State_UpdateApp(PoketchColorChanger *appData);
|
||||
static BOOL State_UnloadApp(PoketchColorChanger *appData);
|
||||
|
||||
static BOOL CheckColorChanged(PoketchColorChanger *appData);
|
||||
|
||||
static void NitroStaticInit(void)
|
||||
{
|
||||
PoketchSystem_SetAppFunctions(New, Exit);
|
||||
}
|
||||
|
||||
static BOOL New(void **appData, PoketchSystem *poketchSys, BgConfig *bgConfig, u32 appID)
|
||||
{
|
||||
PoketchColorChanger *colorChanger = Heap_Alloc(HEAP_ID_POKETCH_APP, sizeof(PoketchColorChanger));
|
||||
|
||||
if (colorChanger != NULL) {
|
||||
if (Init(colorChanger, poketchSys, bgConfig, appID)) {
|
||||
if (SysTask_Start(Task_Main, colorChanger, 1) != NULL) {
|
||||
*appData = colorChanger;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
Heap_Free(colorChanger);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL Init(PoketchColorChanger *appData, PoketchSystem *poketchSys, BgConfig *bgConfig, u32 appID)
|
||||
{
|
||||
appData->poketch = PoketchSystem_GetPoketchData(poketchSys);
|
||||
appData->colorData.color = Poketch_CurrentScreenColor(appData->poketch);
|
||||
appData->currentColor = appData->colorData.color;
|
||||
|
||||
if (PoketchColorChangerGraphics_New(&appData->graphics, &appData->colorData, bgConfig)) {
|
||||
appData->state = STATE_LOAD_APP;
|
||||
appData->subState = 0;
|
||||
appData->shouldExit = FALSE;
|
||||
appData->poketchSys = poketchSys;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void Free(PoketchColorChanger *appData)
|
||||
{
|
||||
PoketchColorChangerGraphics_Free(appData->graphics);
|
||||
Heap_Free(appData);
|
||||
}
|
||||
|
||||
static void Task_Main(SysTask *task, void *appData)
|
||||
{
|
||||
static const StateFunc stateFuncs[] = {
|
||||
State_LoadApp,
|
||||
State_UpdateApp,
|
||||
State_UnloadApp
|
||||
};
|
||||
|
||||
PoketchColorChanger *colorChanger = appData;
|
||||
|
||||
if (colorChanger->state < NELEMS(stateFuncs)) {
|
||||
if (stateFuncs[colorChanger->state](colorChanger)) {
|
||||
Free(colorChanger);
|
||||
SysTask_Done(task);
|
||||
PoketchSystem_NotifyAppUnloaded(colorChanger->poketchSys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Exit(void *appData)
|
||||
{
|
||||
((PoketchColorChanger *)appData)->shouldExit = TRUE;
|
||||
}
|
||||
|
||||
static void ChangeState(PoketchColorChanger *appData, enum ColorChangerState newState)
|
||||
{
|
||||
if (appData->shouldExit == FALSE) {
|
||||
appData->state = newState;
|
||||
} else {
|
||||
appData->state = STATE_SHUTDOWN;
|
||||
}
|
||||
|
||||
appData->subState = 0;
|
||||
}
|
||||
|
||||
static BOOL State_LoadApp(PoketchColorChanger *appData)
|
||||
{
|
||||
switch (appData->subState) {
|
||||
case 0:
|
||||
PoketchColorChangerGraphics_StartTask(appData->graphics, COLOR_CHANGER_GRAPHICS_INIT);
|
||||
appData->subState++;
|
||||
break;
|
||||
case 1:
|
||||
if (PoketchColorChanger_TaskIsNotActive(appData->graphics, COLOR_CHANGER_GRAPHICS_INIT)) {
|
||||
PoketchSystem_NotifyAppLoaded(appData->poketchSys);
|
||||
ChangeState(appData, STATE_UPDATE_LOOP);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL State_UpdateApp(PoketchColorChanger *appData)
|
||||
{
|
||||
if (appData->shouldExit) {
|
||||
ChangeState(appData, STATE_SHUTDOWN);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (appData->subState) {
|
||||
case 0:
|
||||
if (CheckColorChanged(appData)) {
|
||||
PoketchColorChangerGraphics_StartTask(appData->graphics, COLOR_CHANGER_GRAPHICS_UPDATE_COLOR);
|
||||
appData->subState++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (PoketchColorChanger_TaskIsNotActive(appData->graphics, COLOR_CHANGER_GRAPHICS_UPDATE_COLOR)) {
|
||||
appData->subState = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CheckColorChanged(PoketchColorChanger *appData)
|
||||
{
|
||||
if (!PoketechSystem_IsRunningTask(appData->poketchSys)) {
|
||||
u32 x, y;
|
||||
|
||||
if (TouchScreen_GetHoldState(&x, &y)) {
|
||||
if (136 <= y && y < 160 && 48 <= x && x < 184) {
|
||||
u32 newColor = (x - 48) / COLOR_SLIDER_WIDTH;
|
||||
|
||||
if (newColor >= POKETCH_SCREEN_COLOR_MAX) {
|
||||
newColor = POKETCH_SCREEN_COLOR_MAX - 1;
|
||||
}
|
||||
|
||||
if (newColor != appData->currentColor) {
|
||||
appData->colorData.color = newColor;
|
||||
appData->currentColor = newColor;
|
||||
Poketch_SetScreenColor(appData->poketch, newColor);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL State_UnloadApp(PoketchColorChanger *appData)
|
||||
{
|
||||
switch (appData->subState) {
|
||||
case 0:
|
||||
PoketchColorChangerGraphics_StartTask(appData->graphics, COLOR_CHANGER_GRAPHICS_FREE);
|
||||
appData->subState++;
|
||||
break;
|
||||
case 1:
|
||||
if (PoketchColorChangerGraphics_NoActiveTasks(appData->graphics)) {
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ FS_EXTERN_OVERLAY(poketch_alarm_clock);
|
|||
FS_EXTERN_OVERLAY(overlay46);
|
||||
FS_EXTERN_OVERLAY(poketch_marking_map);
|
||||
FS_EXTERN_OVERLAY(overlay48);
|
||||
FS_EXTERN_OVERLAY(overlay49);
|
||||
FS_EXTERN_OVERLAY(poketch_color_changer);
|
||||
FS_EXTERN_OVERLAY(overlay50);
|
||||
FS_EXTERN_OVERLAY(overlay52);
|
||||
FS_EXTERN_OVERLAY(overlay53);
|
||||
|
|
@ -104,7 +104,7 @@ static const struct {
|
|||
{ POKETCH_APPID_KITCHENTIMER, FS_OVERLAY_ID(overlay46) },
|
||||
{ POKETCH_APPID_MARKINGMAP, FS_OVERLAY_ID(poketch_marking_map) },
|
||||
{ POKETCH_APPID_BERRYSEARCHER, FS_OVERLAY_ID(overlay48) },
|
||||
{ POKETCH_APPID_COLORCHANGER, FS_OVERLAY_ID(overlay49) },
|
||||
{ POKETCH_APPID_COLORCHANGER, FS_OVERLAY_ID(poketch_color_changer) },
|
||||
{ POKETCH_APPID_CALENDAR, FS_OVERLAY_ID(overlay50) },
|
||||
{ POKETCH_APPID_LINKSEARCHER, FS_OVERLAY_ID(overlay52) },
|
||||
{ POKETCH_APPID_RADARCHAINCOUNTER, FS_OVERLAY_ID(overlay53) },
|
||||
|
|
|
|||
|
|
@ -713,8 +713,8 @@ pokeplatinum_c = files(
|
|||
'applications/poketch/marking_map/graphics.c',
|
||||
'overlay048/ov48_022561C0.c',
|
||||
'overlay048/ov48_0225650C.c',
|
||||
'overlay049/ov49_022561C0.c',
|
||||
'overlay049/ov49_022563D4.c',
|
||||
'applications/poketch/color_changer/main.c',
|
||||
'applications/poketch/color_changer/graphics.c',
|
||||
'overlay050/ov50_022561C0.c',
|
||||
'overlay050/ov50_02256510.c',
|
||||
'overlay051/ov51_022561C0.c',
|
||||
|
|
|
|||
|
|
@ -1,206 +0,0 @@
|
|||
#include <nitro.h>
|
||||
#include <nitro/sinit.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "applications/poketch/poketch_system.h"
|
||||
#include "overlay049/ov49_022563D4.h"
|
||||
#include "overlay049/struct_ov49_022563D4_1.h"
|
||||
#include "overlay049/struct_ov49_022563D4_decl.h"
|
||||
|
||||
#include "bg_window.h"
|
||||
#include "heap.h"
|
||||
#include "poketch.h"
|
||||
#include "sys_task.h"
|
||||
#include "sys_task_manager.h"
|
||||
#include "touch_screen.h"
|
||||
|
||||
typedef struct {
|
||||
u8 unk_00;
|
||||
u8 unk_01;
|
||||
u8 unk_02;
|
||||
u8 unk_03;
|
||||
UnkStruct_ov49_022563D4_1 unk_04;
|
||||
UnkStruct_ov49_022563D4 *unk_08;
|
||||
PoketchSystem *poketchSys;
|
||||
Poketch *poketch;
|
||||
} UnkStruct_ov49_0225621C;
|
||||
|
||||
static void NitroStaticInit(void);
|
||||
|
||||
static BOOL ov49_022561D4(void **param0, PoketchSystem *poketchSys, BgConfig *param2, u32 param3);
|
||||
static BOOL ov49_0225621C(UnkStruct_ov49_0225621C *param0, PoketchSystem *poketchSys, BgConfig *param2, u32 param3);
|
||||
static void ov49_02256258(UnkStruct_ov49_0225621C *param0);
|
||||
static void ov49_0225626C(SysTask *param0, void *param1);
|
||||
static void ov49_022562A0(void *param0);
|
||||
static void ov49_022562A8(UnkStruct_ov49_0225621C *param0, u32 param1);
|
||||
static BOOL ov49_022562BC(UnkStruct_ov49_0225621C *param0);
|
||||
static BOOL ov49_022562FC(UnkStruct_ov49_0225621C *param0);
|
||||
static BOOL ov49_02256348(UnkStruct_ov49_0225621C *param0);
|
||||
static BOOL ov49_022563A0(UnkStruct_ov49_0225621C *param0);
|
||||
|
||||
static void NitroStaticInit(void)
|
||||
{
|
||||
PoketchSystem_SetAppFunctions(ov49_022561D4, ov49_022562A0);
|
||||
}
|
||||
|
||||
static BOOL ov49_022561D4(void **param0, PoketchSystem *poketchSys, BgConfig *param2, u32 param3)
|
||||
{
|
||||
UnkStruct_ov49_0225621C *v0 = (UnkStruct_ov49_0225621C *)Heap_Alloc(HEAP_ID_POKETCH_APP, sizeof(UnkStruct_ov49_0225621C));
|
||||
|
||||
if (v0 != NULL) {
|
||||
if (ov49_0225621C(v0, poketchSys, param2, param3)) {
|
||||
if (SysTask_Start(ov49_0225626C, v0, 1) != NULL) {
|
||||
*param0 = v0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Heap_Free(v0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL ov49_0225621C(UnkStruct_ov49_0225621C *param0, PoketchSystem *poketchSys, BgConfig *param2, u32 param3)
|
||||
{
|
||||
param0->poketch = PoketchSystem_GetPoketchData(poketchSys);
|
||||
param0->unk_04.unk_00 = Poketch_CurrentScreenColor(param0->poketch);
|
||||
param0->unk_03 = param0->unk_04.unk_00;
|
||||
|
||||
if (ov49_022563D4(&(param0->unk_08), &(param0->unk_04), param2)) {
|
||||
param0->unk_00 = 0;
|
||||
param0->unk_01 = 0;
|
||||
param0->unk_02 = 0;
|
||||
param0->poketchSys = poketchSys;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ov49_02256258(UnkStruct_ov49_0225621C *param0)
|
||||
{
|
||||
ov49_02256480(param0->unk_08);
|
||||
Heap_Free(param0);
|
||||
}
|
||||
|
||||
static void ov49_0225626C(SysTask *param0, void *param1)
|
||||
{
|
||||
static BOOL (*const v0[])(UnkStruct_ov49_0225621C *) = {
|
||||
ov49_022562BC,
|
||||
ov49_022562FC,
|
||||
ov49_022563A0
|
||||
};
|
||||
|
||||
UnkStruct_ov49_0225621C *v1 = (UnkStruct_ov49_0225621C *)param1;
|
||||
|
||||
if (v1->unk_00 < NELEMS(v0)) {
|
||||
if (v0[v1->unk_00](v1)) {
|
||||
ov49_02256258(v1);
|
||||
SysTask_Done(param0);
|
||||
PoketchSystem_NotifyAppUnloaded(v1->poketchSys);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
static void ov49_022562A0(void *param0)
|
||||
{
|
||||
((UnkStruct_ov49_0225621C *)param0)->unk_02 = 1;
|
||||
}
|
||||
|
||||
static void ov49_022562A8(UnkStruct_ov49_0225621C *param0, u32 param1)
|
||||
{
|
||||
if (param0->unk_02 == 0) {
|
||||
param0->unk_00 = param1;
|
||||
} else {
|
||||
param0->unk_00 = 2;
|
||||
}
|
||||
|
||||
param0->unk_01 = 0;
|
||||
}
|
||||
|
||||
static BOOL ov49_022562BC(UnkStruct_ov49_0225621C *param0)
|
||||
{
|
||||
switch (param0->unk_01) {
|
||||
case 0:
|
||||
ov49_02256494(param0->unk_08, 0);
|
||||
param0->unk_01++;
|
||||
break;
|
||||
case 1:
|
||||
if (ov49_022564B8(param0->unk_08, 0)) {
|
||||
PoketchSystem_NotifyAppLoaded(param0->poketchSys);
|
||||
ov49_022562A8(param0, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL ov49_022562FC(UnkStruct_ov49_0225621C *param0)
|
||||
{
|
||||
if (param0->unk_02) {
|
||||
ov49_022562A8(param0, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (param0->unk_01) {
|
||||
case 0:
|
||||
if (ov49_02256348(param0)) {
|
||||
ov49_02256494(param0->unk_08, 2);
|
||||
param0->unk_01++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (ov49_022564B8(param0->unk_08, 2)) {
|
||||
param0->unk_01 = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL ov49_02256348(UnkStruct_ov49_0225621C *param0)
|
||||
{
|
||||
if (PoketechSystem_IsRunningTask(param0->poketchSys) == 0) {
|
||||
u32 v0, v1;
|
||||
|
||||
if (TouchScreen_GetHoldState(&v0, &v1)) {
|
||||
if ((136 <= v1) && (v1 < 160) && (48 <= v0) && (v0 < 184)) {
|
||||
u32 v2 = (v0 - 48) / 16;
|
||||
|
||||
if (v2 >= 8) {
|
||||
v2 = 8 - 1;
|
||||
}
|
||||
|
||||
if (v2 != param0->unk_03) {
|
||||
param0->unk_04.unk_00 = v2;
|
||||
param0->unk_03 = v2;
|
||||
Poketch_SetScreenColor(param0->poketch, v2);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL ov49_022563A0(UnkStruct_ov49_0225621C *param0)
|
||||
{
|
||||
switch (param0->unk_01) {
|
||||
case 0:
|
||||
ov49_02256494(param0->unk_08, 1);
|
||||
param0->unk_01++;
|
||||
break;
|
||||
case 1:
|
||||
if (ov49_022564C4(param0->unk_08)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
#include "overlay049/ov49_022563D4.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "applications/poketch/poketch_animation.h"
|
||||
#include "applications/poketch/poketch_graphics.h"
|
||||
#include "applications/poketch/poketch_system.h"
|
||||
#include "applications/poketch/poketch_task.h"
|
||||
#include "overlay049/struct_ov49_022563D4_1.h"
|
||||
#include "overlay049/struct_ov49_022563D4_decl.h"
|
||||
|
||||
#include "bg_window.h"
|
||||
#include "graphics.h"
|
||||
#include "heap.h"
|
||||
#include "sys_task_manager.h"
|
||||
|
||||
struct UnkStruct_ov49_022563D4_t {
|
||||
const UnkStruct_ov49_022563D4_1 *unk_00;
|
||||
BgConfig *unk_04;
|
||||
u32 unk_08[6];
|
||||
PoketchAnimation_AnimationManager *unk_20;
|
||||
PoketchAnimation_AnimatedSpriteData *unk_24;
|
||||
PoketchAnimation_SpriteData unk_28;
|
||||
};
|
||||
|
||||
static void ov49_02256410(UnkStruct_ov49_022563D4 *param0, const UnkStruct_ov49_022563D4_1 *param1);
|
||||
static void ov49_02256464(UnkStruct_ov49_022563D4 *param0);
|
||||
static void ov49_022564D0(PoketchTaskManager *param0);
|
||||
static void ov49_022564E4(SysTask *param0, void *param1);
|
||||
static void ov49_02256578(SysTask *param0, void *param1);
|
||||
static void ov49_02256594(SysTask *param0, void *param1);
|
||||
|
||||
BOOL ov49_022563D4(UnkStruct_ov49_022563D4 **param0, const UnkStruct_ov49_022563D4_1 *param1, BgConfig *param2)
|
||||
{
|
||||
UnkStruct_ov49_022563D4 *v0 = (UnkStruct_ov49_022563D4 *)Heap_Alloc(HEAP_ID_POKETCH_APP, sizeof(UnkStruct_ov49_022563D4));
|
||||
|
||||
if (v0 != NULL) {
|
||||
PoketchTask_InitActiveTaskList(v0->unk_08, 4);
|
||||
v0->unk_00 = param1;
|
||||
v0->unk_04 = PoketchGraphics_GetBgConfig();
|
||||
v0->unk_20 = PoketchGraphics_GetAnimationManager();
|
||||
ov49_02256410(v0, param1);
|
||||
*param0 = v0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ov49_02256410(UnkStruct_ov49_022563D4 *param0, const UnkStruct_ov49_022563D4_1 *param1)
|
||||
{
|
||||
static const PoketchAnimation_AnimationData v0 = {
|
||||
{ (56 << FX32_SHIFT), (148 << FX32_SHIFT) },
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
Graphics_LoadObjectTiles(12, 69, 1, 0, 0, 1, HEAP_ID_POKETCH_APP);
|
||||
|
||||
PoketchAnimation_LoadSpriteFromNARC(¶m0->unk_28, 12, 67, 68, 8);
|
||||
param0->unk_24 = PoketchAnimation_SetupNewAnimatedSprite(param0->unk_20, &v0, ¶m0->unk_28);
|
||||
PoketchAnimation_SetSpritePosition(param0->unk_24, (56 + (16 * param1->unk_00)) << FX32_SHIFT, 148 << FX32_SHIFT);
|
||||
}
|
||||
|
||||
static void ov49_02256464(UnkStruct_ov49_022563D4 *param0)
|
||||
{
|
||||
int v0;
|
||||
|
||||
if (param0->unk_24) {
|
||||
PoketchAnimation_RemoveAnimatedSprite(param0->unk_20, param0->unk_24);
|
||||
}
|
||||
|
||||
PoketchAnimation_FreeSpriteData(¶m0->unk_28);
|
||||
}
|
||||
|
||||
void ov49_02256480(UnkStruct_ov49_022563D4 *param0)
|
||||
{
|
||||
if (param0 != NULL) {
|
||||
ov49_02256464(param0);
|
||||
Heap_Free(param0);
|
||||
}
|
||||
}
|
||||
|
||||
static const PoketchTask Unk_ov49_0225660C[] = {
|
||||
{ 0x0, ov49_022564E4, 0x0 },
|
||||
{ 0x1, ov49_02256578, 0x0 },
|
||||
{ 0x2, ov49_02256594 },
|
||||
{ 0x0, NULL, 0x0 }
|
||||
};
|
||||
|
||||
void ov49_02256494(UnkStruct_ov49_022563D4 *param0, u32 param1)
|
||||
{
|
||||
PoketchTask_Start(Unk_ov49_0225660C, param1, param0, param0->unk_00, param0->unk_08, 2, 8);
|
||||
}
|
||||
|
||||
BOOL ov49_022564B8(UnkStruct_ov49_022563D4 *param0, u32 param1)
|
||||
{
|
||||
return PoketchTask_TaskIsNotActive(param0->unk_08, param1);
|
||||
}
|
||||
|
||||
BOOL ov49_022564C4(UnkStruct_ov49_022563D4 *param0)
|
||||
{
|
||||
return PoketchTask_NoActiveTasks(param0->unk_08);
|
||||
}
|
||||
|
||||
static void ov49_022564D0(PoketchTaskManager *param0)
|
||||
{
|
||||
UnkStruct_ov49_022563D4 *v0 = PoketchTask_GetTaskData(param0);
|
||||
PoketchTask_EndTask(v0->unk_08, param0);
|
||||
}
|
||||
|
||||
static void ov49_022564E4(SysTask *param0, void *param1)
|
||||
{
|
||||
static const BgTemplate v0 = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0x800,
|
||||
.baseTile = 0,
|
||||
.screenSize = BG_SCREEN_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x7000,
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 2,
|
||||
.areaOver = 0,
|
||||
.mosaic = FALSE,
|
||||
};
|
||||
GXSDispCnt v1;
|
||||
UnkStruct_ov49_022563D4 *v2;
|
||||
const UnkStruct_ov49_022563D4_1 *v3;
|
||||
void *v4;
|
||||
NNSG2dPaletteData *v5;
|
||||
|
||||
v2 = PoketchTask_GetTaskData(param1);
|
||||
v3 = PoketchTask_GetConstTaskData(param1);
|
||||
|
||||
Bg_InitFromTemplate(v2->unk_04, BG_LAYER_SUB_2, &v0, 0);
|
||||
Graphics_LoadTilesToBgLayer(NARC_INDEX_GRAPHIC__POKETCH, 66, v2->unk_04, BG_LAYER_SUB_2, 0, 0, 1, HEAP_ID_POKETCH_APP);
|
||||
Graphics_LoadTilemapToBgLayer(NARC_INDEX_GRAPHIC__POKETCH, 65, v2->unk_04, BG_LAYER_SUB_2, 0, 0, 1, HEAP_ID_POKETCH_APP);
|
||||
|
||||
PoketchGraphics_LoadActivePalette(0, 0);
|
||||
Bg_CopyTilemapBufferToVRAM(v2->unk_04, 6);
|
||||
|
||||
v1 = GXS_GetDispCnt();
|
||||
GXS_SetVisiblePlane(v1.visiblePlane | GX_PLANEMASK_BG2);
|
||||
|
||||
ov49_022564D0(param1);
|
||||
}
|
||||
|
||||
static void ov49_02256578(SysTask *param0, void *param1)
|
||||
{
|
||||
UnkStruct_ov49_022563D4 *v0 = PoketchTask_GetTaskData(param1);
|
||||
|
||||
Bg_FreeTilemapBuffer(v0->unk_04, BG_LAYER_SUB_2);
|
||||
ov49_022564D0(param1);
|
||||
}
|
||||
|
||||
static void ov49_02256594(SysTask *param0, void *param1)
|
||||
{
|
||||
UnkStruct_ov49_022563D4 *v0 = PoketchTask_GetTaskData(param1);
|
||||
const UnkStruct_ov49_022563D4_1 *v1 = PoketchTask_GetConstTaskData(param1);
|
||||
|
||||
PoketchSystem_PlaySoundEffect(1635);
|
||||
PoketchGraphics_LoadActivePalette(0, 0);
|
||||
PoketchAnimation_SetSpritePosition(v0->unk_24, (56 + (16 * v1->unk_00)) << FX32_SHIFT, 148 << FX32_SHIFT);
|
||||
ov49_022564D0(param1);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user