mirror of
https://github.com/pret/pokediamond.git
synced 2026-08-07 03:04:19 -05:00
use constants
This commit is contained in:
parent
06d1c475ed
commit
86af98a6fa
|
|
@ -10,96 +10,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start ScrCmd_Unk00BE
|
||||
ScrCmd_Unk00BE: ; 0x0203C730
|
||||
push {r3-r7, lr}
|
||||
sub sp, #0x8
|
||||
add r5, r0, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r6, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
bl VarGet
|
||||
add r7, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
bl VarGet
|
||||
add r4, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
str r4, [sp, #0x0]
|
||||
str r0, [sp, #0x4]
|
||||
mov r2, #0x0
|
||||
ldr r0, [r5, #0x74]
|
||||
add r1, r6, #0x0
|
||||
mvn r2, r2
|
||||
add r3, r7, #0x0
|
||||
bl FUN_02049240
|
||||
mov r0, #0x1
|
||||
add sp, #0x8
|
||||
pop {r3-r7, pc}
|
||||
|
||||
thumb_func_start ScrCmd_Unk0203
|
||||
ScrCmd_Unk0203: ; 0x0203C788
|
||||
push {r3-r7, lr}
|
||||
sub sp, #0x8
|
||||
add r5, r0, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r6, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
bl VarGet
|
||||
add r7, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
bl VarGet
|
||||
add r4, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
str r4, [sp, #0x0]
|
||||
mov r2, #0x0
|
||||
add r5, #0x80
|
||||
str r0, [sp, #0x4]
|
||||
ldr r0, [r5, #0x0]
|
||||
add r1, r6, #0x0
|
||||
ldr r0, [r0, #0x10]
|
||||
mvn r2, r2
|
||||
add r3, r7, #0x0
|
||||
bl FUN_02049F98
|
||||
mov r0, #0x1
|
||||
add sp, #0x8
|
||||
pop {r3-r7, pc}
|
||||
|
||||
thumb_func_start ScrCmd_Unk0204
|
||||
ScrCmd_Unk0204: ; 0x0203C7E4
|
||||
push {r3, lr}
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
ldr r0, [r0, #0x10]
|
||||
bl FUN_02049FFC
|
||||
mov r0, #0x1
|
||||
pop {r3, pc}
|
||||
|
||||
thumb_func_start ScrCmd_Unk0200
|
||||
ScrCmd_Unk0200: ; 0x0203C7F4
|
||||
push {r3-r5, lr}
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ gScriptCmdTable: ; 0x020F355C
|
|||
.word ScrCmd_NamePokemonScreen
|
||||
.word ScrCmd_FadeScreen
|
||||
.word ScrCmd_WaitFadeScreen
|
||||
.word ScrCmd_Unk00BE
|
||||
.word ScrCmd_Warp
|
||||
.word ScrCmd_Unk00BF
|
||||
.word ScrCmd_Unk00C0
|
||||
.word ScrCmd_Unk00C1
|
||||
|
|
@ -664,8 +664,8 @@ gScriptCmdTable: ; 0x020F355C
|
|||
.word ScrCmd_Unk0200
|
||||
.word ScrCmd_Unk0201
|
||||
.word ScrCmd_Unk0202
|
||||
.word ScrCmd_Unk0203
|
||||
.word ScrCmd_Unk0204
|
||||
.word ScrCmd_BattleRoomWarp
|
||||
.word ScrCmd_ExitBattleRoom
|
||||
.word ScrCmd_ShowGeonetScreen
|
||||
.word ScrCmd_Unk0206
|
||||
.word ScrCmd_Unk0207
|
||||
|
|
|
|||
|
|
@ -1162,8 +1162,8 @@ _0204923C:
|
|||
mov r0, #0x0
|
||||
pop {r4-r6, pc}
|
||||
|
||||
thumb_func_start FUN_02049240
|
||||
FUN_02049240: ; 0x02049240
|
||||
thumb_func_start CallTask_ScriptWarp
|
||||
CallTask_ScriptWarp: ; 0x02049240
|
||||
push {r3-r7, lr}
|
||||
add r7, r0, #0x0
|
||||
add r5, r1, #0x0
|
||||
|
|
|
|||
|
|
@ -2872,9 +2872,9 @@
|
|||
.extern ScrCmd_Unk0245
|
||||
.extern ScrCmd_FadeScreen
|
||||
.extern ScrCmd_WaitFadeScreen
|
||||
.extern ScrCmd_Unk00BE
|
||||
.extern ScrCmd_Unk0203
|
||||
.extern ScrCmd_Unk0204
|
||||
.extern ScrCmd_Warp
|
||||
.extern ScrCmd_BattleRoomWarp
|
||||
.extern ScrCmd_ExitBattleRoom
|
||||
.extern ScrCmd_Unk0200
|
||||
.extern ScrCmd_Unk0201
|
||||
.extern ScrCmd_Unk00BF
|
||||
|
|
@ -3485,7 +3485,7 @@
|
|||
.extern FUN_02048FC8
|
||||
.extern FUN_02049160
|
||||
.extern FUN_020491A8
|
||||
.extern FUN_02049240
|
||||
.extern CallTask_ScriptWarp
|
||||
.extern FUN_02049274
|
||||
.extern FUN_020492BC
|
||||
.extern FUN_02049494
|
||||
|
|
|
|||
|
|
@ -1099,16 +1099,16 @@ void MOD59_DrawMunchlax(MOD59_IntroOverlayData *data)
|
|||
MOD59_TilemapChangePalette(data, GF_BG_LYR_MAIN_2, 9);
|
||||
BG_ClearCharDataRange(GF_BG_LYR_MAIN_2, 32, 0, data->heap_id);
|
||||
BG_LoadCharTilesData(data->bgConfig, GF_BG_LYR_MAIN_2, charData, 0xc80, 1);
|
||||
BG_LoadPlttData(GF_BG_LYR_MAIN_2, plttData, 32, 0x100); //r2 and r3 regswap
|
||||
BG_LoadPlttData(GF_BG_LYR_MAIN_2, MOD59_021D9ED8, 32, 0x120);
|
||||
BG_LoadPlttData(GF_BG_LYR_MAIN_2, plttData, 32, GF_PAL_SLOT_OFFSET_8); //r2 and r3 regswap
|
||||
BG_LoadPlttData(GF_BG_LYR_MAIN_2, MOD59_021D9ED8, 32, GF_PAL_SLOT_OFFSET_9);
|
||||
|
||||
FillBgTilemapRect(data->bgConfig, GF_BG_LYR_SUB_1, 0, 0, 0, 32, 24, 10);
|
||||
LoadRectToBgTilemapRect(data->bgConfig, GF_BG_LYR_SUB_1, src, 11, 7, 10, 10);
|
||||
MOD59_TilemapChangePalette(data, GF_BG_LYR_SUB_1, 10);
|
||||
BG_ClearCharDataRange(GF_BG_LYR_SUB_1, 32, 0, data->heap_id);
|
||||
BG_LoadCharTilesData(data->bgConfig, GF_BG_LYR_SUB_1, charData, 0xc80, 1);
|
||||
BG_LoadPlttData(GF_BG_LYR_SUB_1, plttData, 32, 0x140);
|
||||
BG_LoadPlttData(GF_BG_LYR_SUB_1, MOD59_021D9ED8, 32, 0x140);
|
||||
BG_LoadPlttData(GF_BG_LYR_SUB_1, plttData, 32, GF_PAL_SLOT_OFFSET_10);
|
||||
BG_LoadPlttData(GF_BG_LYR_SUB_1, MOD59_021D9ED8, 32, GF_PAL_SLOT_OFFSET_10);
|
||||
FreeToHeap(plttData);
|
||||
FreeToHeap(charData);
|
||||
FreeToHeap(src);
|
||||
|
|
|
|||
|
|
@ -976,7 +976,7 @@ void BG_FillCharDataRange(
|
|||
FreeToHeap(st4);
|
||||
}
|
||||
|
||||
void BG_LoadPlttData(u32 location, void *plttData, u32 size, u32 offset)
|
||||
void BG_LoadPlttData(u32 location, void *plttData, u32 size, enum GFPalSlotOffset offset)
|
||||
{
|
||||
DC_FlushRange(plttData, size);
|
||||
if (location < GF_PAL_LOCATION_SUB_BG)
|
||||
|
|
@ -990,7 +990,7 @@ void BG_LoadPlttData(u32 location, void *plttData, u32 size, u32 offset)
|
|||
|
||||
void BG_SetMaskColor(u32 bgId, u32 value)
|
||||
{
|
||||
BG_LoadPlttData(bgId, &value, 2, 0);
|
||||
BG_LoadPlttData(bgId, &value, 2, GF_PAL_SLOT_OFFSET_0);
|
||||
}
|
||||
|
||||
u16 GetTileMapIndexFromCoords(u8 x, u8 y, u8 screenSize)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ void LoadUserFrameGfx1(struct BgConfig *bg_config, enum GFBgLayer layer, u32 num
|
|||
r1 = NARC_winframe_narc_0024_NCLR;
|
||||
}
|
||||
|
||||
if ((u32)layer < 4)
|
||||
if ((u32)layer < GF_BG_LYR_SUB_FIRST)
|
||||
{
|
||||
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_WINFRAME, r1, GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)(paletteNumber << 5), 32, heap_id);
|
||||
return;
|
||||
|
|
@ -189,19 +189,19 @@ s32 FUN_0200CD64(s32 param0)
|
|||
}
|
||||
|
||||
void FUN_0200CD68(
|
||||
struct BgConfig *bg_config, u32 layer, u32 num_tiles, u32 param3, u8 frame_id, u32 heap_id)
|
||||
struct BgConfig *bg_config, u32 layer, u32 num_tiles, u32 palNumber, u8 frame_id, u32 heap_id)
|
||||
{
|
||||
|
||||
GfGfxLoader_LoadCharData(
|
||||
NARC_GRAPHIC_WINFRAME, FUN_0200CD60(frame_id), bg_config, layer, num_tiles, 0, FALSE, heap_id);
|
||||
|
||||
if (layer < 4)
|
||||
if (layer < GF_BG_LYR_SUB_FIRST)
|
||||
{
|
||||
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_WINFRAME, FUN_0200CD64(frame_id), GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)(param3 << 5), 32, heap_id);
|
||||
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_WINFRAME, FUN_0200CD64(frame_id), GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)(palNumber << 5), 32, heap_id);
|
||||
return;
|
||||
}
|
||||
|
||||
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_WINFRAME, FUN_0200CD64(frame_id), GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)(param3 << 5), 32, heap_id);
|
||||
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_WINFRAME, FUN_0200CD64(frame_id), GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)(palNumber << 5), 32, heap_id);
|
||||
}
|
||||
|
||||
void DrawFrame2(struct BgConfig *bgConfig,
|
||||
|
|
@ -385,33 +385,17 @@ void FUN_0200D274(
|
|||
FreeToHeap(ptr);
|
||||
}
|
||||
|
||||
void FUN_0200D300(struct BgConfig *bg_config,
|
||||
u8 bg_id,
|
||||
u16 numtiles,
|
||||
u8 param3,
|
||||
u8 param4,
|
||||
u16 param5,
|
||||
u32 heap_id)
|
||||
{
|
||||
GfGfxLoader_LoadCharData(NARC_GRAPHIC_FIELD_BOARD,
|
||||
NARC_field_board_narc_0000_NCGR,
|
||||
bg_config,
|
||||
bg_id,
|
||||
numtiles,
|
||||
0x3C0,
|
||||
FALSE,
|
||||
heap_id);
|
||||
void FUN_0200D300(struct BgConfig *bg_config, u8 bg_id, u16 numtiles, u8 palIndex, u8 param4, u16 param5, u32 heap_id) {
|
||||
GfGfxLoader_LoadCharData(NARC_GRAPHIC_FIELD_BOARD, NARC_field_board_narc_0000_NCGR, bg_config, bg_id, numtiles, 0x3C0, FALSE, heap_id);
|
||||
|
||||
NNSG2dPaletteData *pPltData;
|
||||
void *st14;
|
||||
st14 = AllocAndReadWholeNarcMemberByIdPair(
|
||||
NARC_GRAPHIC_FIELD_BOARD, NARC_field_board_narc_0001_NCLR, heap_id);
|
||||
st14 = AllocAndReadWholeNarcMemberByIdPair( NARC_GRAPHIC_FIELD_BOARD, NARC_field_board_narc_0001_NCLR, heap_id);
|
||||
NNS_G2dGetUnpackedPaletteData(st14, &pPltData);
|
||||
BG_LoadPlttData(bg_id, pPltData->pRawData + param4 * 0x20, 0x20, (u16)(param3 << 5));
|
||||
BG_LoadPlttData(bg_id, pPltData->pRawData + param4 * 0x20, 0x20, (enum GFPalSlotOffset)(u16)(palIndex << 5));
|
||||
FreeToHeapExplicit(heap_id, st14);
|
||||
|
||||
if (param4 <= 1)
|
||||
{
|
||||
if (param4 <= 1) {
|
||||
FUN_0200D378(bg_config, bg_id, (u16)(numtiles + 30), param4, param5, heap_id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ extern void FUN_02037E18(TaskManager *taskManager, u16 *param1, u16 *param2, u16
|
|||
extern void BeginNormalPaletteFade(u32 pattern, u32 typeTop, u32 typeBottom, u16 colour, u32 duration, u32 framesPer, u32 heapId);
|
||||
extern void FUN_0200E388(u32 param0);
|
||||
extern BOOL IsPaletteFadeFinished(void);
|
||||
extern void CallTask_ScriptWarp(TaskManager *taskManager, u16 mapId, s32 param2, u16 xVar, u16 yVar, u16 dir);
|
||||
extern void FUN_02049F98(TaskManager *taskManager, u16 mapId, s32 param2, u16 xVar, u16 yVar, u16 dir);
|
||||
|
||||
u8 UNK_021C5A0C[4];
|
||||
|
||||
|
|
@ -2420,3 +2422,28 @@ BOOL ScrCmd_WaitFadeScreen(ScriptContext *ctx) { //00BD
|
|||
static BOOL FUN_0203C71C(ScriptContext *ctx) {
|
||||
return IsPaletteFadeFinished() == TRUE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_Warp(ScriptContext *ctx) { //00BE
|
||||
u16 mapId = ScriptReadHalfword(ctx);
|
||||
u16 door = ScriptReadHalfword(ctx); //unused?
|
||||
u16 xVar = ScriptGetVar(ctx);
|
||||
u16 yVar = ScriptGetVar(ctx);
|
||||
u16 dir = ScriptReadHalfword(ctx);
|
||||
CallTask_ScriptWarp(ctx->taskManager, mapId, -1, xVar, yVar, dir);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_BattleRoomWarp(ScriptContext *ctx) { //0203
|
||||
u16 mapId = ScriptReadHalfword(ctx);
|
||||
u16 door = ScriptReadHalfword(ctx); //unused?
|
||||
u16 xVar = ScriptGetVar(ctx);
|
||||
u16 yVar = ScriptGetVar(ctx);
|
||||
u16 dir = ScriptReadHalfword(ctx);
|
||||
FUN_02049F98(ctx->fieldSystem->taskManager, mapId, -1, xVar, yVar, dir);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_ExitBattleRoom(ScriptContext *ctx) { //0204
|
||||
FUN_02049FFC(ctx->fieldSystem->taskManager);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ void LoadBgVramChar(u32 bgId, void *buffer_p, u32 offset, u32 size);
|
|||
void BG_ClearCharDataRange(u32 bgId, u32 size, u32 offset, u32 heap_id);
|
||||
void BG_FillCharDataRange(
|
||||
struct BgConfig *param0, u32 bgId, u32 fillValue, u32 count, u32 offset);
|
||||
void BG_LoadPlttData(u32 location, void *plttData, u32 size, u32 offset);
|
||||
void BG_LoadPlttData(u32 location, void *plttData, u32 size, enum GFPalSlotOffset offset);
|
||||
void BG_SetMaskColor(u32 bgId, u32 value);
|
||||
u16 GetTileMapIndexFromCoords(u8 x, u8 y, u8 screenSize);
|
||||
u16 GetSrcTileMapIndexFromCoords(u8 x, u8 y, u8 width, u8 height);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void ClearFrameAndWindow1(struct Window *window, BOOL copy_to_vram);
|
|||
s32 FUN_0200CD60(s32 param0);
|
||||
s32 FUN_0200CD64(s32 param0);
|
||||
void FUN_0200CD68(
|
||||
struct BgConfig *bg_config, u32 layer, u32 param2, u32 param3, u8 frame_id, u32 heap_id);
|
||||
struct BgConfig *bg_config, u32 layer, u32 num_tiles, u32 palNumber, u8 frame_id, u32 heap_id);
|
||||
void DrawFrame2(struct BgConfig *bgConfig,
|
||||
u8 bgId,
|
||||
u8 x,
|
||||
|
|
|
|||
|
|
@ -208,6 +208,9 @@ BOOL ScrCmd_Unk0244(ScriptContext *ctx);
|
|||
BOOL ScrCmd_Unk0245(ScriptContext *ctx);
|
||||
BOOL ScrCmd_FadeScreen(ScriptContext *ctx);
|
||||
BOOL ScrCmd_WaitFadeScreen(ScriptContext *ctx);
|
||||
BOOL ScrCmd_Warp(ScriptContext *ctx);
|
||||
BOOL ScrCmd_BattleRoomWarp(ScriptContext *ctx);
|
||||
BOOL ScrCmd_ExitBattleRoom(ScriptContext *ctx);
|
||||
|
||||
// scrcmd_mart.c
|
||||
BOOL ScrCmd_NormalMart(struct ScriptContext * ctx);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user