separate sea cottage anim functions
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#ifdndef GUARD_SEA_COTTAGE_H
|
||||
#define GUARD_SEA_COTTAGE_H
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void sub_809C1D8(u8 taskId, const u16* a1, u16 a2);
|
||||
void sub_809C448(u8 a0);
|
||||
void sub_809C460(void);
|
||||
bool8 sub_809C474(void);
|
||||
void sub_809C4A8(void);
|
||||
void sub_809C5FC(void);
|
||||
|
||||
#endif // GUARD_SHOP_H
|
||||
@@ -28,15 +28,6 @@ void CreateDecorationShop2Menu(const u16 *);
|
||||
u8 sub_809B56C(void);
|
||||
void sub_809C09C(u16 a0, u16 a1, u8 a2);
|
||||
|
||||
// wrong file
|
||||
void sub_809C1D8(u8 taskId, const u16* a1, u16 a2);
|
||||
void sub_809C448(u8 a0);
|
||||
void sub_809C460(void);
|
||||
bool8 sub_809C474(void);
|
||||
void sub_809C4A8(void);
|
||||
void sub_809C5FC(void);
|
||||
|
||||
|
||||
// buy_menu_helper
|
||||
void BuyMenuInitWindows(bool32 isSellingTM);
|
||||
void BuyMenuDrawMoneyBox(void);
|
||||
|
||||
@@ -141,6 +141,7 @@ SECTIONS {
|
||||
src/battle_anim_mon_movement.o(.text);
|
||||
src/item.o(.text);
|
||||
src/shop.o(.text);
|
||||
src/sea_cottage_special_anim.o(.text);
|
||||
src/berry.o(.text);
|
||||
src/script_menu.o(.text);
|
||||
asm/naming_screen.o(.text);
|
||||
@@ -442,6 +443,7 @@ SECTIONS {
|
||||
src/battle_anim_mon_movement.o(.rodata);
|
||||
src/item.o(.rodata);
|
||||
src/shop.o(.rodata);
|
||||
src/sea_cottage_special_anim.o(.rodata);
|
||||
src/berry.o(.rodata);
|
||||
src/script_menu.o(.rodata);
|
||||
data/naming_screen.o(.rodata);
|
||||
|
||||
@@ -0,0 +1,417 @@
|
||||
#include "global.h"
|
||||
#include "event_data.h"
|
||||
#include "task.h"
|
||||
#include "menu.h"
|
||||
#include "field_player_avatar.h"
|
||||
#include "fieldmap.h"
|
||||
#include "field_map_obj.h"
|
||||
#include "field_camera.h"
|
||||
|
||||
// Defines
|
||||
#define t0 data[0]
|
||||
#define tX data[4]
|
||||
#define tListTaskId data[7]
|
||||
|
||||
// RAM
|
||||
EWRAM_DATA u8 gUnknown_2039984 = 0;
|
||||
|
||||
|
||||
// Function Declarations
|
||||
static void sub_809C334(u8 taskId);
|
||||
static void sub_809C500(u8 taskId);
|
||||
static void sub_809C640(u8 taskId);
|
||||
|
||||
// Data Definitions
|
||||
static const u16 gUnknown_83DF0D4[] = {0x0308, 0x030a, 0x02d0};
|
||||
static const u16 gUnknown_83DF0DA[] = {0x0309, 0x030b, 0x02d1};
|
||||
static const u16 gUnknown_83DF0E0[] = {0x0310, 0x0312, 0x02d8};
|
||||
static const u16 gUnknown_83DF0E6[] = {0x0311, 0x0313, 0x02d9};
|
||||
static const u16 gUnknown_83DF0EC[] = {0x02e3, 0x0316, 0x0314};
|
||||
static const u16 gUnknown_83DF0F2[] = {0x02e4, 0x0317, 0x0315};
|
||||
static const u16 gUnknown_83DF0F8[] = {0x02eb, 0x031e, 0x031c};
|
||||
|
||||
|
||||
// Functions
|
||||
#ifdef NONMATCHING
|
||||
void sub_809C1D8(u8 taskId, const u16* a1, u16 a2)
|
||||
{
|
||||
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_809C1D8(u8 taskId, const u16* a1, u16 a2)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
"\tmov r6, r9\n"
|
||||
"\tmov r5, r8\n"
|
||||
"\tpush {r5-r7}\n"
|
||||
"\tsub sp, 0x10\n"
|
||||
"\tmov r9, r1\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r0, 24\n"
|
||||
"\tlsls r2, 16\n"
|
||||
"\tlsrs r2, 16\n"
|
||||
"\tmov r10, r2\n"
|
||||
"\tldr r2, _0809C26C @ =gTasks\n"
|
||||
"\tlsls r1, r0, 2\n"
|
||||
"\tadds r1, r0\n"
|
||||
"\tlsls r1, 3\n"
|
||||
"\tadds r1, r2\n"
|
||||
"\tldrh r0, [r1, 0x10]\n"
|
||||
"\tsubs r0, 0x1\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tlsrs r5, r0, 16\n"
|
||||
"\tldrh r0, [r1, 0x12]\n"
|
||||
"\tsubs r0, 0x1\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tlsrs r3, r0, 16\n"
|
||||
"\tldrh r4, [r1, 0xA]\n"
|
||||
"\tmovs r2, 0xC\n"
|
||||
"\tldrsh r0, [r1, r2]\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbne _0809C29C\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tlsls r5, 16\n"
|
||||
"\tstr r5, [sp, 0xC]\n"
|
||||
"\tlsls r0, r3, 16\n"
|
||||
"\tlsls r1, r4, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tstr r0, [sp]\n"
|
||||
"\tasrs r1, 16\n"
|
||||
"\tstr r1, [sp, 0x4]\n"
|
||||
"\tlsls r0, r1, 1\n"
|
||||
"\tmov r1, r9\n"
|
||||
"\tadds r7, r0, r1\n"
|
||||
"_0809C22C:\n"
|
||||
"\tmovs r4, 0\n"
|
||||
"\tlsls r2, 16\n"
|
||||
"\tmov r8, r2\n"
|
||||
"\tasrs r0, r2, 16\n"
|
||||
"\tldr r2, [sp]\n"
|
||||
"\tadds r6, r2, r0\n"
|
||||
"_0809C238:\n"
|
||||
"\tldr r0, [sp, 0xC]\n"
|
||||
"\tasrs r1, r0, 16\n"
|
||||
"\tlsls r4, 16\n"
|
||||
"\tasrs r0, r4, 16\n"
|
||||
"\tadds r5, r1, r0\n"
|
||||
"\tadds r0, r5, 0\n"
|
||||
"\tadds r1, r6, 0\n"
|
||||
"\tbl MapGridGetMetatileIdAt\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tldrsh r1, [r7, r2]\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tcmp r1, r0\n"
|
||||
"\tbne _0809C280\n"
|
||||
"\tldr r0, [sp, 0x4]\n"
|
||||
"\tcmp r0, 0x2\n"
|
||||
"\tbeq _0809C270\n"
|
||||
"\tldrh r0, [r7, 0x2]\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\torrs r2, r0\n"
|
||||
"\tadds r0, r5, 0\n"
|
||||
"\tadds r1, r6, 0\n"
|
||||
"\tbl MapGridSetMetatileIdAt\n"
|
||||
"\tb _0809C280\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0809C26C: .4byte gTasks\n"
|
||||
"_0809C270:\n"
|
||||
"\tmov r1, r9\n"
|
||||
"\tldrh r0, [r1]\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\torrs r2, r0\n"
|
||||
"\tadds r0, r5, 0\n"
|
||||
"\tadds r1, r6, 0\n"
|
||||
"\tbl MapGridSetMetatileIdAt\n"
|
||||
"_0809C280:\n"
|
||||
"\tmovs r2, 0x80\n"
|
||||
"\tlsls r2, 9\n"
|
||||
"\tadds r0, r4, r2\n"
|
||||
"\tlsrs r4, r0, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tcmp r0, 0x2\n"
|
||||
"\tble _0809C238\n"
|
||||
"\tadds r0, r2, 0\n"
|
||||
"\tadd r0, r8\n"
|
||||
"\tlsrs r2, r0, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tcmp r0, 0x2\n"
|
||||
"\tble _0809C22C\n"
|
||||
"\tb _0809C324\n"
|
||||
"_0809C29C:\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tlsls r5, 16\n"
|
||||
"\tstr r5, [sp, 0xC]\n"
|
||||
"\tlsls r0, r3, 16\n"
|
||||
"\tlsls r1, r4, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tstr r0, [sp, 0x8]\n"
|
||||
"\tasrs r7, r1, 16\n"
|
||||
"_0809C2AC:\n"
|
||||
"\tmovs r4, 0\n"
|
||||
"\tlsls r2, 16\n"
|
||||
"\tmov r8, r2\n"
|
||||
"\tasrs r0, r2, 16\n"
|
||||
"\tldr r1, [sp, 0x8]\n"
|
||||
"\tadds r6, r1, r0\n"
|
||||
"_0809C2B8:\n"
|
||||
"\tldr r2, [sp, 0xC]\n"
|
||||
"\tasrs r1, r2, 16\n"
|
||||
"\tlsls r4, 16\n"
|
||||
"\tasrs r0, r4, 16\n"
|
||||
"\tadds r5, r1, r0\n"
|
||||
"\tadds r0, r5, 0\n"
|
||||
"\tadds r1, r6, 0\n"
|
||||
"\tbl MapGridGetMetatileIdAt\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tsubs r1, r7\n"
|
||||
"\tlsls r1, 1\n"
|
||||
"\tadd r1, r9\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tldrsh r1, [r1, r2]\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tcmp r1, r0\n"
|
||||
"\tbne _0809C30A\n"
|
||||
"\tcmp r7, 0x2\n"
|
||||
"\tbeq _0809C2FA\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tsubs r0, r7\n"
|
||||
"\tlsls r0, 1\n"
|
||||
"\tadd r0, r9\n"
|
||||
"\tldrh r0, [r0]\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\torrs r2, r0\n"
|
||||
"\tadds r0, r5, 0\n"
|
||||
"\tadds r1, r6, 0\n"
|
||||
"\tbl MapGridSetMetatileIdAt\n"
|
||||
"\tb _0809C30A\n"
|
||||
"_0809C2FA:\n"
|
||||
"\tmov r1, r9\n"
|
||||
"\tldrh r0, [r1, 0x4]\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\torrs r2, r0\n"
|
||||
"\tadds r0, r5, 0\n"
|
||||
"\tadds r1, r6, 0\n"
|
||||
"\tbl MapGridSetMetatileIdAt\n"
|
||||
"_0809C30A:\n"
|
||||
"\tmovs r2, 0x80\n"
|
||||
"\tlsls r2, 9\n"
|
||||
"\tadds r0, r4, r2\n"
|
||||
"\tlsrs r4, r0, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tcmp r0, 0x2\n"
|
||||
"\tble _0809C2B8\n"
|
||||
"\tadds r0, r2, 0\n"
|
||||
"\tadd r0, r8\n"
|
||||
"\tlsrs r2, r0, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tcmp r0, 0x2\n"
|
||||
"\tble _0809C2AC\n"
|
||||
"_0809C324:\n"
|
||||
"\tadd sp, 0x10\n"
|
||||
"\tpop {r3-r5}\n"
|
||||
"\tmov r8, r3\n"
|
||||
"\tmov r9, r4\n"
|
||||
"\tmov r10, r5\n"
|
||||
"\tpop {r4-r7}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
static void sub_809C334(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 v1;
|
||||
|
||||
data[3] = 1;
|
||||
switch (data[0])
|
||||
{
|
||||
case 0:
|
||||
sub_809C1D8(taskId, gUnknown_83DF0D4, 0);
|
||||
break;
|
||||
case 1:
|
||||
sub_809C1D8(taskId, gUnknown_83DF0DA, 0);
|
||||
break;
|
||||
case 2:
|
||||
sub_809C1D8(taskId, gUnknown_83DF0E0, 0xC00);
|
||||
break;
|
||||
case 3:
|
||||
sub_809C1D8(taskId, gUnknown_83DF0E6, 0);
|
||||
break;
|
||||
case 4:
|
||||
sub_809C1D8(taskId, gUnknown_83DF0EC, 0xC00);
|
||||
break;
|
||||
case 5:
|
||||
sub_809C1D8(taskId, gUnknown_83DF0F2, 0);
|
||||
break;
|
||||
case 6:
|
||||
sub_809C1D8(taskId, gUnknown_83DF0F8, 0);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
data[0] = (data[0] + 1) & 7;
|
||||
v1 = data[0] & 7;
|
||||
//ldrh r5, [r4] instead mov r5, r0 somehow
|
||||
if (v1 == 0)
|
||||
{
|
||||
DrawWholeMapView();
|
||||
data[1] = (data[1] + 1) % 3;
|
||||
data[3] = v1;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 sub_809C3FC(u16 a0)
|
||||
{
|
||||
u8 taskId;
|
||||
s16 *data;
|
||||
|
||||
taskId = CreateTask(sub_809C334, 0);
|
||||
data = gTasks[taskId].data;
|
||||
PlayerGetDestCoords(&tX, &data[5]);
|
||||
t0 = 0;
|
||||
data[1] = 0;
|
||||
data[2] = a0;
|
||||
sub_809C334(taskId);
|
||||
return taskId;
|
||||
}
|
||||
|
||||
void sub_809C448(u8 a0)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
taskId = sub_809C3FC(a0);
|
||||
gUnknown_2039984 = taskId;
|
||||
}
|
||||
|
||||
void sub_809C460(void)
|
||||
{
|
||||
DestroyTask(gUnknown_2039984);
|
||||
}
|
||||
|
||||
bool8 sub_809C474(void)
|
||||
{
|
||||
if (gTasks[gUnknown_2039984].data[3] == 0)
|
||||
{
|
||||
if (gTasks[gUnknown_2039984].data[1] != 2)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// special 0x1b5 - creates a tile animaiton one block left two-four up the player
|
||||
void sub_809C4A8(void)
|
||||
{
|
||||
u8 taskId;
|
||||
s16 *data;
|
||||
|
||||
taskId = CreateTask(sub_809C500, 0);
|
||||
|
||||
gTasks[taskId].data[0] = 0;
|
||||
gTasks[taskId].data[1] = 0;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
PlayerGetDestCoords(&data[2], &data[3]);
|
||||
if (gSpecialVar_0x8004 == 0)
|
||||
{
|
||||
gTasks[taskId].data[2] += 6;
|
||||
gTasks[taskId].data[3] -= 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].data[2]--;
|
||||
gTasks[taskId].data[3] -= 5;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_809C500(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
if (data[0] == 0)
|
||||
{
|
||||
if ((data[1] & 1) == 0)
|
||||
{
|
||||
MapGridSetMetatileIdAt(data[2], data[3], 0xEB5);
|
||||
MapGridSetMetatileIdAt(data[2], data[3] + 2, 0xEB7);
|
||||
}
|
||||
else
|
||||
{
|
||||
MapGridSetMetatileIdAt(data[2], data[3], 0xEB6);
|
||||
MapGridSetMetatileIdAt(data[2], data[3] + 2, 0xEB8);
|
||||
}
|
||||
CurrentMapDrawMetatileAt(data[2], data[3]);
|
||||
CurrentMapDrawMetatileAt(data[2], data[3] + 2);
|
||||
}
|
||||
|
||||
data[0]++;
|
||||
if (data[0] != 0x10)
|
||||
return;
|
||||
data[0] = 0;
|
||||
|
||||
data[0] == 0;
|
||||
data[1]++;
|
||||
if (data[1] != 0xD)
|
||||
return;
|
||||
|
||||
MapGridSetMetatileIdAt(data[2], data[3], 0xE8A);
|
||||
MapGridSetMetatileIdAt(data[2], data[3] + 2, 0xE96);
|
||||
CurrentMapDrawMetatileAt(data[2], data[3]);
|
||||
CurrentMapDrawMetatileAt(data[2], data[3] + 2);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
// special 0x1B7 - creates a tile animation two-six blocks right from the top-left corner of the screen
|
||||
void sub_809C5FC(void)
|
||||
{
|
||||
u8 taskId;
|
||||
s16 *data;
|
||||
|
||||
taskId = CreateTask(sub_809C640, 0);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
gTasks[taskId].data[1] = 0;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
PlayerGetDestCoords(&data[2], &data[3]);
|
||||
gTasks[taskId].data[2] += 4;
|
||||
gTasks[taskId].data[3] -= 5;
|
||||
}
|
||||
|
||||
static void sub_809C640(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
if (data[0] == 0)
|
||||
{
|
||||
if (data[1] != 0)
|
||||
{
|
||||
MapGridSetMetatileIdAt(data[2], data[3], 0xE85);
|
||||
MapGridSetMetatileIdAt(data[2], data[3] + 1, 0xEB4);
|
||||
CurrentMapDrawMetatileAt(data[2], data[3]);
|
||||
CurrentMapDrawMetatileAt(data[2], data[3] + 1);
|
||||
if (data[1] == 4)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
data[2]--;
|
||||
}
|
||||
MapGridSetMetatileIdAt(data[2], data[3], 0xEB9);
|
||||
MapGridSetMetatileIdAt(data[2], data[3] + 1, 0xEBA);
|
||||
CurrentMapDrawMetatileAt(data[2], data[3]);
|
||||
CurrentMapDrawMetatileAt(data[2], data[3] + 1);
|
||||
}
|
||||
data[0]++;
|
||||
if (data[0] == 4)
|
||||
{
|
||||
data[0] = 0;
|
||||
data[1]++;
|
||||
}
|
||||
}
|
||||
+1
-23
@@ -34,7 +34,6 @@
|
||||
#include "money.h"
|
||||
#include "quest_log.h"
|
||||
#include "script.h"
|
||||
#include "event_data.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/game_stat.h"
|
||||
@@ -112,8 +111,6 @@ EWRAM_DATA u8 (*gUnknown_2039968)[13] = {0}; //item strings
|
||||
EWRAM_DATA s16 gUnknown_20398B4[MAP_OBJECTS_COUNT][4] = {0}; //sViewportMapObjects
|
||||
EWRAM_DATA struct MartHistory gUnknown_203996C = {0};
|
||||
|
||||
EWRAM_DATA u8 gUnknown_2039984 = 0;
|
||||
|
||||
//Function Declarations
|
||||
static u8 sub_809AAB0(u8 a0);
|
||||
static u8 sub_809AB7C(bool32 a0);
|
||||
@@ -171,11 +168,6 @@ static void nullsub_52(u8 taskId);
|
||||
static void nullsub_53(void);
|
||||
static void sub_809C138(void);
|
||||
|
||||
// new file?
|
||||
static void sub_809C334(u8 taskId);
|
||||
static void sub_809C500(u8 taskId);
|
||||
static void sub_809C640(u8 taskId);
|
||||
|
||||
// external defines
|
||||
extern u8 MapGridGetMetatileLayerTypeAt(s16 x, s16 y);
|
||||
extern u16 BagGetQuantityByItemId(u16 item);
|
||||
@@ -186,13 +178,6 @@ extern const struct MenuAction gUnknown_83DF09C[];
|
||||
extern const struct YesNoFuncTable gUnknown_83DF0B4[];
|
||||
extern const struct WindowTemplate gUnknown_83DF0BC[];
|
||||
extern const struct BgTemplate gUnknown_83DF0C4[];
|
||||
extern const u16 gUnknown_83DF0D4[];
|
||||
extern const u16 gUnknown_83DF0DA[];
|
||||
extern const u16 gUnknown_83DF0E0[];
|
||||
extern const u16 gUnknown_83DF0E6[];
|
||||
extern const u16 gUnknown_83DF0EC[];
|
||||
extern const u16 gUnknown_83DF0F2[];
|
||||
extern const u16 gUnknown_83DF0F8[];
|
||||
*/
|
||||
|
||||
//graphics
|
||||
@@ -268,14 +253,6 @@ static const struct BgTemplate gUnknown_83DF0C4[] = //sShopBuyMenuBgTemplate
|
||||
}
|
||||
};
|
||||
|
||||
static const u16 gUnknown_83DF0D4[] = {0x0308, 0x030a, 0x02d0};
|
||||
static const u16 gUnknown_83DF0DA[] = {0x0309, 0x030b, 0x02d1};
|
||||
static const u16 gUnknown_83DF0E0[] = {0x0310, 0x0312, 0x02d8};
|
||||
static const u16 gUnknown_83DF0E6[] = {0x0311, 0x0313, 0x02d9};
|
||||
static const u16 gUnknown_83DF0EC[] = {0x02e3, 0x0316, 0x0314};
|
||||
static const u16 gUnknown_83DF0F2[] = {0x02e4, 0x0317, 0x0315};
|
||||
static const u16 gUnknown_83DF0F8[] = {0x02eb, 0x031e, 0x031c};
|
||||
|
||||
|
||||
// Functions
|
||||
// CreateShopMenu
|
||||
@@ -1680,3 +1657,4 @@ void CreateDecorationShop2Menu(const u16 *itemsForSale)
|
||||
sub_809AAB0(MART_TYPE_DECOR2);
|
||||
sub_809AC04(EnableBothScriptContexts);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user