summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDizzyEggg <jajkodizzy@wp.pl>2017-09-23 20:36:00 +0200
committerDizzyEggg <jajkodizzy@wp.pl>2017-09-23 20:36:00 +0200
commit7bb0fcf182e5a760ab9e08878a381566819dc8f2 (patch)
treebbb0603d41fa6d0d71a838c7e2fde85fe346fbe1 /include
parent601fc9e85b383792819768c31728e4855e854f32 (diff)
parenta57915fa5bd8c2e68bc291a371e66e3cafd7e195 (diff)
merge with master and fix conflicts
Diffstat (limited to 'include')
-rw-r--r--include/battle_dome_cards.h13
-rw-r--r--include/berry.h6
-rw-r--r--include/easy_chat.h3
-rwxr-xr-xinclude/event_scripts.h11
-rw-r--r--include/field_camera.h25
-rw-r--r--include/field_effect.h80
-rw-r--r--include/field_effect_helpers.h16
-rw-r--r--include/field_ground_effect.h22
-rwxr-xr-xinclude/field_map_obj.h79
-rw-r--r--include/field_player_avatar.h17
-rw-r--r--include/fieldmap.h15
-rw-r--r--include/gba/multiboot.h26
-rw-r--r--include/global.fieldmap.h79
-rw-r--r--include/global.h74
-rw-r--r--include/gpu_regs.h7
-rw-r--r--include/item_menu.h12
-rw-r--r--include/lilycove_lady.h11
-rw-r--r--include/load_save.h1
-rw-r--r--include/malloc.h6
-rw-r--r--include/map_obj_8097404.h32
-rw-r--r--include/mauville_old_man.h2
-rw-r--r--include/menu.h2
-rw-r--r--include/metatile_behavior.h11
-rw-r--r--include/multiboot.h2
-rw-r--r--include/new_game.h2
-rw-r--r--include/rom4.h33
-rw-r--r--include/rom6.h6
-rw-r--r--include/rom_818CFC8.h11
-rw-r--r--include/rom_81BE66C.h12
-rw-r--r--include/save.h4
-rw-r--r--include/sprite.h2
-rw-r--r--include/text.h4
-rw-r--r--include/trainer_see.h7
-rw-r--r--include/trig.h3
-rw-r--r--include/unknown_task.h11
-rw-r--r--include/vars.h2
36 files changed, 561 insertions, 88 deletions
diff --git a/include/battle_dome_cards.h b/include/battle_dome_cards.h
new file mode 100644
index 000000000..a0696d156
--- /dev/null
+++ b/include/battle_dome_cards.h
@@ -0,0 +1,13 @@
+#ifndef GUARD_BATTLE_DOME_CARDS_H
+#define GUARD_BATTLE_DOME_CARDS_H
+
+bool16 dp13_810BB8C(void);
+u16 sub_818D3E4(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s16 y, u8 paletteSlot, u16 paletteTag);
+u16 sub_818D7D8(u16 species, u32 otId, u32 personality, bool8 isFrontPic, s16 x, s16 y, u8 paletteSlot, u16 paletteTag);
+u16 sub_818D820(u16 spriteId);
+u16 sub_818D8AC(u16 species, bool8 isFrontPic, s16 x, s16 y, u8 paletteSlot, u16 paletteTag);
+u16 sub_818D8F0(u16 spriteId);
+u16 sub_818D938(u16 species, bool8 isFrontPic, u16 destX, u16 destY, u8 paletteSlot, u8 windowId);
+u8 sub_818D97C(u8 a0, u8 a1);
+
+#endif //GUARD_BATTLE_DOME_CARDS_H
diff --git a/include/berry.h b/include/berry.h
index 7c2636411..dc0481d3d 100644
--- a/include/berry.h
+++ b/include/berry.h
@@ -11,6 +11,12 @@ enum
BERRY_FIRMNESS_SUPER_HARD,
};
+#define NUM_BERRIES 44
+
+extern const u8 *const gBerryTreeFieldObjectGraphicsIdTablePointers[NUM_BERRIES];
+extern const struct SpriteFrameImage *const gBerryTreePicTablePointers[NUM_BERRIES];
+extern const u8 *const gBerryTreePaletteSlotTablePointers[NUM_BERRIES];
+
void ClearEnigmaBerries(void);
void SetEnigmaBerry(u8 *src);
u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry);
diff --git a/include/easy_chat.h b/include/easy_chat.h
index 5143aa39c..fc44b6a8a 100644
--- a/include/easy_chat.h
+++ b/include/easy_chat.h
@@ -29,5 +29,8 @@ enum
};
void InitEasyChatPhrases(void);
+void easy_chat_input_maybe(void);
+void CopyEasyChatWord(u8 *, u16);
+bool32 sub_811F8D8(u16);
#endif // GUARD_EASYCHAT_H
diff --git a/include/event_scripts.h b/include/event_scripts.h
new file mode 100755
index 000000000..f1abdd6f6
--- /dev/null
+++ b/include/event_scripts.h
@@ -0,0 +1,11 @@
+//
+// Created by scott on 9/12/2017.
+//
+
+#ifndef GUARD_EVENT_SCRIPTS_H
+#define GUARD_EVENT_SCRIPTS_H
+
+extern const u8 gUnknown_082766A2[];
+extern const u8 gUnknown_082766A6[];
+
+#endif //GUARD_EVENT_SCRIPTS_H
diff --git a/include/field_camera.h b/include/field_camera.h
new file mode 100644
index 000000000..9fbaac6a2
--- /dev/null
+++ b/include/field_camera.h
@@ -0,0 +1,25 @@
+#ifndef GUARD_FIELD_CAMERA_H
+#define GUARD_FIELD_CAMERA_H
+
+// Exported type declarations
+
+struct CameraObject
+{
+ void (*callback)(struct CameraObject *);
+ u32 unk4;
+ s32 unk8;
+ s32 unkC;
+ s32 x;
+ s32 y;
+};
+
+extern struct CameraObject gUnknown_03005DD0;
+
+// Exported RAM declarations
+
+extern u16 gUnknown_03005DEC;
+extern u16 gUnknown_03005DE8;
+
+// Exported ROM declarations
+
+#endif //GUARD_FIELD_CAMERA_H
diff --git a/include/field_effect.h b/include/field_effect.h
new file mode 100644
index 000000000..7ec26b3d7
--- /dev/null
+++ b/include/field_effect.h
@@ -0,0 +1,80 @@
+//
+// Created by Scott Norton on 9/15/17.
+//
+
+#ifndef GUARD_FIELD_EFFECTS_H
+#define GUARD_FIELD_EFFECTS_H
+
+enum FieldEffectScriptIdx
+{
+ FLDEFF_EXCLAMATION_MARK_ICON_1,
+ FLDEFF_USE_CUT_ON_GRASS,
+ FLDEFF_USE_CUT_ON_TREE,
+ FLDEFF_SHADOW,
+ FLDEFF_TALL_GRASS,
+ FLDEFF_RIPPLE,
+ FLDEFF_FIELD_MOVE_SHOW_MON,
+ FLDEFF_ASH,
+ FLDEFF_SURF_BLOB,
+ FLDEFF_USE_SURF,
+ FLDEFF_DUST,
+ FLDEFF_USE_SECRET_POWER_CAVE,
+ FLDEFF_JUMP_TALL_GRASS,
+ FLDEFF_SAND_FOOTPRINTS,
+ FLDEFF_JUMP_BIG_SPLASH,
+ FLDEFF_SPLASH,
+ FLDEFF_JUMP_SMALL_SPLASH,
+ FLDEFF_LONG_GRASS,
+ FLDEFF_JUMP_LONG_GRASS,
+ FLDEFF_UNKNOWN_19,
+ FLDEFF_UNKNOWN_20,
+ FLDEFF_UNKNOWN_21,
+ FLDEFF_UNKNOWN_22,
+ FLDEFF_BERRY_TREE_GROWTH_SPARKLE,
+ FLDEFF_DEEP_SAND_FOOTPRINTS,
+ FLDEFF_POKECENTER_HEAL,
+ FLDEFF_USE_SECRET_POWER_TREE,
+ FLDEFF_USE_SECRET_POWER_SHRUB,
+ FLDEFF_TREE_DISGUISE,
+ FLDEFF_MOUNTAIN_DISGUISE,
+ FLDEFF_NPCFLY_OUT,
+ FLDEFF_USE_FLY,
+ FLDEFF_FLY_IN,
+ FLDEFF_EXCLAMATION_MARK_ICON_2,
+ FLDEFF_FEET_IN_FLOWING_WATER,
+ FLDEFF_BIKE_TIRE_TRACKS,
+ FLDEFF_SAND_DISGUISE,
+ FLDEFF_USE_ROCK_SMASH,
+ FLDEFF_USE_DIG,
+ FLDEFF_SAND_PILE,
+ FLDEFF_USE_STRENGTH,
+ FLDEFF_SHORT_GRASS,
+ FLDEFF_HOT_SPRINGS_WATER,
+ FLDEFF_USE_WATERFALL,
+ FLDEFF_USE_DIVE,
+ FLDEFF_POKEBALL,
+ FLDEFF_HEART_ICON,
+ FLDEFF_NOP_47,
+ FLDEFF_NOP_48,
+ FLDEFF_POP_OUT_OF_ASH,
+ FLDEFF_LAVARIDGE_GYM_WARP,
+ FLDEFF_SWEET_SCENT,
+ FLDEFF_SAND_PILLAR,
+ FLDEFF_BUBBLES,
+ FLDEFF_SPARKLE,
+ FLDEFF_SECRET_POWER_CAVE,
+ FLDEFF_SECRET_POWER_TREE,
+ FLDEFF_SECRET_POWER_SHRUB,
+ FLDEFF_CUT_GRASS,
+ FLDEFF_FIELD_MOVE_SHOW_MON_INIT,
+ FLDEFF_USE_FLY_ANCIENT_TOMB,
+ FLDEFF_PCTURN_ON,
+ FLDEFF_HALL_OF_FAME_RECORD,
+ FLDEFF_USE_TELEPORT
+};
+
+extern u32 gFieldEffectSpawnParams[8];
+
+u8 FieldEffectStart(u8);
+
+#endif //GUARD_FIELD_EFFECTS_H
diff --git a/include/field_effect_helpers.h b/include/field_effect_helpers.h
new file mode 100644
index 000000000..e80daf3bd
--- /dev/null
+++ b/include/field_effect_helpers.h
@@ -0,0 +1,16 @@
+//
+// Created by scott on 9/7/2017.
+//
+
+#ifndef GUARD_FIELD_EFFECT_HELPERS_H
+#define GUARD_FIELD_EFFECT_HELPERS_H
+
+// Exported type declarations
+
+// Exported RAM declarations
+
+// Exported ROM declarations
+u8 sub_8154228(void);
+bool8 sub_8155DA0(struct MapObject *);
+
+#endif //GUARD_FIELD_EFFECT_HELPERS_H
diff --git a/include/field_ground_effect.h b/include/field_ground_effect.h
new file mode 100644
index 000000000..63b67ceaf
--- /dev/null
+++ b/include/field_ground_effect.h
@@ -0,0 +1,22 @@
+//
+// Created by scott on 9/6/2017.
+//
+
+#ifndef GUARD_FIELD_GROUND_EFFECT_H
+#define GUARD_FIELD_GROUND_EFFECT_H
+
+// Exported type declarations
+
+// Exported RAM declarations
+
+// Exported ROM declarations
+void SetObjectSubpriorityByZCoord(u8, struct Sprite *, u8);
+void InitObjectPriorityByZCoord(struct Sprite *, u8);
+bool8 IsZCoordMismatchAt(u8, s16, s16);
+bool8 AreZCoordsCompatible(u8, u8);
+void FieldObjectUpdateSubpriority(struct MapObject *, struct Sprite *);
+void DoGroundEffects_OnSpawn(struct MapObject *, struct Sprite *);
+void DoGroundEffects_OnBeginStep(struct MapObject *, struct Sprite *);
+void DoGroundEffects_OnFinishStep(struct MapObject *, struct Sprite *);
+
+#endif //GUARD_FIELD_GROUND_EFFECT_H
diff --git a/include/field_map_obj.h b/include/field_map_obj.h
new file mode 100755
index 000000000..40cc64054
--- /dev/null
+++ b/include/field_map_obj.h
@@ -0,0 +1,79 @@
+#ifndef GUARD_FIELD_MAP_OBJ_H
+#define GUARD_FIELD_MAP_OBJ_H
+
+#define NUM_OBJECT_GRAPHICS_INFO 239
+#define SPRITE_VAR 240
+
+// Exported struct declarations
+
+enum SpinnerRunnerFollowPatterns {
+ RUNFOLLOW_ANY,
+ RUNFOLLOW_NORTH_SOUTH,
+ RUNFOLLOW_EAST_WEST,
+ RUNFOLLOW_NORTH_WEST,
+ RUNFOLLOW_NORTH_EAST,
+ RUNFOLLOW_SOUTH_WEST,
+ RUNFOLLOW_SOUTH_EAST,
+ RUNFOLLOW_NORTH_SOUTH_WEST,
+ RUNFOLLOW_NORTH_SOUTH_EAST,
+ RUNFOLLOW_NORTH_EAST_WEST,
+ RUNFOLLOW_SOUTH_EAST_WEST
+};
+
+// Exported RAM declarations
+
+// Exported ROM declarations
+
+void sub_808D438(void);
+u8 GetFieldObjectIdByLocalIdAndMap(u8, u8, u8);
+bool8 TryGetFieldObjectIdByLocalIdAndMap(u8, u8, u8, u8 *);
+u8 GetFieldObjectIdByXY(s16, s16);
+void FieldObjectSetDirection(struct MapObject *, u8);
+u8 sub_808D4F4(void);
+void RemoveFieldObjectByLocalIdAndMap(u8, u8, u8);
+void npc_load_two_palettes__no_record(u16, u8);
+void npc_load_two_palettes__and_record(u16, u8);
+void pal_patch_for_npc(u16, u8);
+void sub_808E16C(s16, s16);
+void sub_8092FF0(s16, s16, s16 *, s16 *);
+u8 FieldObjectDirectionToImageAnimId(u8);
+void sub_80930E0(s16 *, s16 *, s16, s16);
+void FieldObjectClearAnim(struct MapObject *);
+void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);
+void SpawnFieldObjectsInView(s16, s16);
+u8 sprite_new(u8, u8, s16, s16, u8, u8);
+u8 AddPseudoFieldObject(u16, void (*)(struct Sprite *), s16, s16, u8);
+u8 show_sprite(u8, u8, u8);
+u8 SpawnSpecialFieldObjectParametrized(u8, u8, u8, s16, s16, u8);
+u8 SpawnSpecialFieldObject(struct MapObjectTemplate *);
+void sub_8093038(s16, s16, s16 *, s16 *);
+void CameraObjectReset1(void);
+void FieldObjectSetGraphicsId(struct MapObject *, u8);
+void FieldObjectTurn(struct MapObject *, u8);
+void FieldObjectTurnByLocalIdAndMap(u8, u8, u8, u8);
+const struct MapObjectGraphicsInfo *GetFieldObjectGraphicsInfo(u8);
+void npc_by_local_id_and_map_set_field_1_bit_x20(u8, u8, u8, u8);
+void gpu_pal_allocator_reset__manage_upper_four(void);
+void sub_808E82C(u8, u8, u8, s16, s16);
+void sub_808E7E4(u8, u8, u8);
+void sub_808E78C(u8, u8, u8, u8);
+void sub_808E75C(s16, s16);
+void FieldObjectGetLocalIdAndMap(struct MapObject *, u8 *, u8 *, u8 *);
+void npc_coords_shift(struct MapObject *, s16, s16);
+void sub_808EB08(struct MapObject *, s16, s16);
+void sub_808F254(u8, u8, u8);
+void FieldObjectStep(struct MapObject *, struct Sprite *, bool8(struct MapObject *, struct Sprite *));
+u8 GetOppositeDirection(u8);
+u8 GetStepInPlaceDelay4AnimId(u32);
+u8 GetStepInPlaceDelay8AnimId(u32);
+u8 GetStepInPlaceDelay16AnimId(u32);
+u8 GetStepInPlaceDelay32AnimId(u32);
+u8 npc_block_way(struct MapObject *, s16, s16, u32);
+void MoveCoords(u8, s16 *, s16 *);
+bool8 FieldObjectIsSpecialAnimActive(struct MapObject *);
+
+// Exported data declarations
+
+extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[];
+
+#endif //GUARD_FIELD_MAP_OBJ_H
diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h
new file mode 100644
index 000000000..a787cf805
--- /dev/null
+++ b/include/field_player_avatar.h
@@ -0,0 +1,17 @@
+//
+// Created by Scott Norton on 9/6/17.
+//
+
+#ifndef GUARD_FIELD_PLAYER_AVATAR_H
+#define GUARD_FIELD_PLAYER_AVATAR_H
+
+void ClearPlayerAvatarInfo(void);
+void SetPlayerAvatarExtraStateTransition(u8, u8);
+u8 GetPlayerAvatarGenderByGraphicsId(u8);
+bool8 TestPlayerAvatarFlags(u8);
+void PlayerGetDestCoords(s16 *, s16 *);
+u8 player_get_direction_lower_nybble(void);
+u8 player_get_direction_upper_nybble(void);
+u8 player_get_x22(void);
+
+#endif //GUARD_FIELD_PLAYER_AVATAR_H
diff --git a/include/fieldmap.h b/include/fieldmap.h
index f3b5a7668..7174d98cc 100644
--- a/include/fieldmap.h
+++ b/include/fieldmap.h
@@ -1,6 +1,19 @@
+//
+// Created by scott on 9/16/2017.
+//
+
#ifndef GUARD_FIELDMAP_H
#define GUARD_FIELDMAP_H
+// Exported type declarations
+
+// Exported RAM declarations
+
+// Exported ROM declarations
+u8 MapGridGetMetatileBehaviorAt(s16, s16);
void GetCameraCoords(u16*, u16*);
+bool8 MapGridIsImpassableAt(s16, s16);
+s32 GetMapBorderIdAt(s16, s16);
+bool32 CanCameraMoveInDirection(u8);
-#endif // GUARD_FIELDMAP_H
+#endif //GUARD_FIELDMAP_H
diff --git a/include/gba/multiboot.h b/include/gba/multiboot.h
index e88b43a19..14b6594b2 100644
--- a/include/gba/multiboot.h
+++ b/include/gba/multiboot.h
@@ -8,19 +8,19 @@
struct MultiBootParam
{
- u32 system_work[5];
- u8 handshake_data;
- u8 padding;
- u16 handshake_timeout;
- u8 probe_count;
- u8 client_data[MULTIBOOT_NCHILD];
- u8 palette_data;
- u8 response_bit;
- u8 client_bit;
- u8 reserved1;
- u8 *boot_srcp;
- u8 *boot_endp;
- u8 *masterp;
+ u32 system_work[5]; // 00
+ u8 handshake_data; // 14
+ u8 padding; // 15
+ u16 handshake_timeout; // 16
+ u8 probe_count; // 18
+ u8 client_data[MULTIBOOT_NCHILD]; // 19
+ u8 palette_data; // 1c
+ u8 response_bit; // 1d
+ u8 client_bit; // 1e
+ u8 reserved1; // 1f
+ const u8 *boot_srcp; // 20
+ const u8 *boot_endp; // 24
+ const u8 *masterp;
u8 *reserved2[MULTIBOOT_NCHILD];
u32 system_work2[4];
u8 sendflag;
diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h
index 4029132e8..ed5054b7d 100644
--- a/include/global.fieldmap.h
+++ b/include/global.fieldmap.h
@@ -1,6 +1,8 @@
#ifndef GUARD_GLOBAL_FIELDMAP_H
#define GUARD_GLOBAL_FIELDMAP_H
+#define NUM_FIELD_OBJECTS 16
+
enum
{
CONNECTION_SOUTH = 1,
@@ -84,7 +86,7 @@ struct MapObjectTemplate
///*0x0B*/ u8 fillerB[1];
/*0x0C*/ u16 unkC;
/*0x0E*/ u16 unkE;
- /*0x10*/ u8 *script;
+ /*0x10*/ const u8 *script;
/*0x14*/ u16 flagId;
/*0x16*/ u8 filler_16[2];
}; /*size = 0x18*/
@@ -224,7 +226,13 @@ struct MapObject
/*0x14*/ struct Coords16 coords3;
/*0x18*/ u8 mapobj_unk_18:4; //current direction?
/*0x18*/ u8 placeholder18:4;
- /*0x19*/ u8 mapobj_unk_19;
+ /*0x19*/ union __attribute__((packed)) {
+ u8 as_byte;
+ struct __attribute__((packed)) {
+ u8 x:4;
+ u8 y:4;
+ } __attribute__((aligned (1))) as_nybbles;
+ } __attribute__((aligned (1))) range;
/*0x1A*/ u8 mapobj_unk_1A;
/*0x1B*/ u8 mapobj_unk_1B;
/*0x1C*/ u8 mapobj_unk_1C;
@@ -237,68 +245,6 @@ struct MapObject
/*size = 0x24*/
};
-// THIS IS NEEDED TO MAKE TRAINER_SEE.C MATCH, PLEASE DO NOT REMOVE UNLESS YOU FIX CHECKPATHBETWEENTRAINERANDPLAYER
-struct MapObject2
-{
- /*0x00*/ u32 active:1;
- u32 mapobj_bit_1:1;
- u32 mapobj_bit_2:1;
- u32 mapobj_bit_3:1;
- u32 mapobj_bit_4:1;
- u32 mapobj_bit_5:1;
- u32 mapobj_bit_6:1;
- u32 mapobj_bit_7:1;
- /*0x01*/ u32 mapobj_bit_8:1;
- u32 mapobj_bit_9:1;
- u32 mapobj_bit_10:1;
- u32 mapobj_bit_11:1;
- u32 mapobj_bit_12:1;
- u32 mapobj_bit_13:1;
- u32 mapobj_bit_14:1;
- u32 mapobj_bit_15:1;
- /*0x02*/ u32 mapobj_bit_16:1;
- u32 mapobj_bit_17:1;
- u32 mapobj_bit_18:1;
- u32 mapobj_bit_19:1;
- u32 mapobj_bit_20:1;
- u32 mapobj_bit_21:1;
- u32 mapobj_bit_22:1;
- u32 mapobj_bit_23:1;
- /*0x03*/ u32 mapobj_bit_24:1;
- u32 mapobj_bit_25:1;
- u32 mapobj_bit_26:1;
- u32 mapobj_bit_27:1;
- u32 mapobj_bit_28:1;
- u32 mapobj_bit_29:1;
- u32 mapobj_bit_30:1;
- u32 mapobj_bit_31:1;
- /*0x04*/ u8 spriteId;
- /*0x05*/ u8 graphicsId;
- /*0x06*/ u8 animPattern;
- /*0x07*/ u8 trainerType;
- /*0x08*/ u8 localId;
- /*0x09*/ u8 mapNum;
- /*0x0A*/ u8 mapGroup;
- /*0x0B*/ u8 mapobj_unk_0B_0:4;
- u8 elevation:4;
- /*0x0C*/ struct Coords16 coords1;
- /*0x10*/ struct Coords16 coords2;
- /*0x14*/ struct Coords16 coords3;
- /*0x18*/ u8 mapobj_unk_18:4;
- /*0x18*/ u8 placeholder18:4;
- /*0x19*/ u8 mapobj_unk_19:4;
- /*0x19*/ u8 mapobj_unk_19b:4;
- /*0x1A*/ u8 mapobj_unk_1A;
- /*0x1B*/ u8 mapobj_unk_1B;
- /*0x1C*/ u8 mapobj_unk_1C;
- /*0x1D*/ u8 trainerRange_berryTreeId;
- /*0x1E*/ u8 mapobj_unk_1E;
- /*0x1F*/ u8 mapobj_unk_1F;
- /*0x20*/ u8 mapobj_unk_20;
- /*0x21*/ u8 mapobj_unk_21;
- /*size = 0x24*/
-};
-
struct MapObjectGraphicsInfo
{
/*0x00*/ u16 tileTag;
@@ -376,14 +322,15 @@ struct PlayerAvatar /* 0x202E858 */
struct Camera
{
- bool8 field_0:1;
+ bool8 active:1;
s32 x;
s32 y;
};
-extern struct MapObject gMapObjects[];
+extern struct MapObject gMapObjects[NUM_FIELD_OBJECTS];
extern u8 gSelectedMapObject;
extern struct MapHeader gMapHeader;
extern struct PlayerAvatar gPlayerAvatar;
+extern struct Camera gCamera;
#endif // GUARD_GLOBAL_FIELDMAP_H
diff --git a/include/global.h b/include/global.h
index f4b2a8349..4014c6dde 100644
--- a/include/global.h
+++ b/include/global.h
@@ -9,9 +9,23 @@
// to help in decompiling
#define asm_comment(x) asm volatile("@ -- " x " -- ")
+#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided")
+
+#if defined (__APPLE__) || defined (__CYGWIN__)
+void memset(void *, int, size_t);
+void memcpy(void *, const void *, size_t);
+#endif // __APPLE__
#define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))
+// useful math macros
+
+// Converts a number to Q8.8 fixed-point format
+#define Q_8_8(n) ((s16)((n) * 256))
+
+// Converts a number to Q4.12 fixed-point format
+#define Q_4_12(n) ((s16)((n) * 4096))
+
#define POKEMON_NAME_LENGTH 10
#define OT_NAME_LENGTH 7
@@ -656,6 +670,61 @@ struct DaycareData
#define FLAGS_COUNT 300
#define VARS_COUNT 256
+enum {
+ LILYCOVE_LADY_QUIZ,
+ LILYCOVE_LADY_FAVOUR,
+ LILYCOVE_LADY_CONTEST
+};
+
+struct LilycoveLadyQuiz
+{
+ /*0x000*/ u8 id;
+ /*0x001*/ u8 phase;
+ /*0x002*/ u16 unk_002[9];
+ /*0x014*/ u16 unk_014;
+ /*0x016*/ u16 unk_016;
+ /*0x018*/ u8 playerName[8];
+ /*0x020*/ u16 playerTrainerId[4];
+ /*0x028*/ u16 itemId;
+ /*0x02a*/ u8 unk_02a;
+ /*0x02b*/ u8 unk_02b;
+ /*0x02c*/ u8 unk_02c;
+ /*0x02d*/ u8 language;
+};
+
+struct LilycoveLadyFavour
+{
+ /*0x000*/ u8 id;
+ /*0x001*/ u8 phase;
+ /*0x002*/ u8 unk_002;
+ /*0x003*/ u8 unk_003;
+ /*0x004*/ u8 playerName[8];
+ /*0x00c*/ u8 unk_00c;
+ /*0x00e*/ u16 itemId;
+ /*0x010*/ u16 unk_010;
+ /*0x012*/ u8 language;
+};
+
+struct LilycoveLadyContest
+{
+ /*0x000*/ u8 id;
+ /*0x001*/ u8 phase;
+ /*0x002*/ u8 fave_pkblk;
+ /*0x003*/ u8 other_pkblk;
+ /*0x004*/ u8 playerName[8];
+ /*0x00c*/ u8 max_sheen;
+ /*0x00d*/ u8 category;
+ /*0x00e*/ u8 language;
+};
+
+typedef union // TODO
+{
+ struct LilycoveLadyQuiz quiz;
+ struct LilycoveLadyFavour favour;
+ struct LilycoveLadyContest contest;
+ u8 id;
+} LilycoveLady;
+
struct SaveBlock1
{
/*0x00*/ struct Coords16 pos;
@@ -739,7 +808,8 @@ struct SaveBlock1
/*0x3728*/ struct RamScript ramScript;
/*0x3B14*/ struct RecordMixingGift recordMixingGift;
/*0x3B24*/ u8 seen2[52];
- /*0x3B58*/ u8 lilycoveLady[536]; // TODO: convert to a union
+ /*0x3B58*/ LilycoveLady lilycoveLady;
+ /*0x3B88*/ u8 filler_3B88[0x1E8];
/*0x3D70*/ u8 babyPhrase[24]; // TODO: convert to a struct
// sizeof: 0x3D88
};
@@ -753,4 +823,6 @@ struct Bitmap // TODO: Find a better spot for this
u32 height:16;
};
+extern u8 gReservedSpritePaletteCount;
+
#endif // GUARD_GLOBAL_H
diff --git a/include/gpu_regs.h b/include/gpu_regs.h
index 2675571f4..89e0cb64b 100644
--- a/include/gpu_regs.h
+++ b/include/gpu_regs.h
@@ -1,6 +1,11 @@
#ifndef GUARD_GPU_REGS_H
#define GUARD_GPU_REGS_H
+// Exported type declarations
+
+// Exported RAM declarations
+
+// Exported ROM declarations
void InitGpuRegManager(void);
void CopyBufferedValuesToGpuRegs(void);
void SetGpuReg(u8 regOffset, u16 value);
@@ -11,4 +16,4 @@ void ClearGpuRegBits(u8 regOffset, u16 mask);
void EnableInterrupts(u16 mask);
void DisableInterrupts(u16 mask);
-#endif // GUARD_GPU_REGS_H
+#endif //GUARD_GPU_REGS_H
diff --git a/include/item_menu.h b/include/item_menu.h
new file mode 100644
index 000000000..85655e9d5
--- /dev/null
+++ b/include/item_menu.h
@@ -0,0 +1,12 @@
+#ifndef GUARD_item_menu_H
+#define GUARD_item_menu_H
+
+// Exported type declarations
+
+// Exported RAM declarations
+
+// Exported ROM declarations
+void sub_81AAC50(void);
+void sub_81AAC70(void);
+
+#endif //GUARD_item_menu_H
diff --git a/include/lilycove_lady.h b/include/lilycove_lady.h
index 81825d8ac..c7776131b 100644
--- a/include/lilycove_lady.h
+++ b/include/lilycove_lady.h
@@ -1,6 +1,17 @@
#ifndef GUARD_LILYCOVE_LADY_H
#define GUARD_LILYCOVE_LADY_H
+u8 GetLilycoveLadyId(void);
void SetLilycoveLady(void);
+void sub_818DA78(void);
+void sub_818DEF4(void);
+void sub_818E564(void);
+void sub_818E570(const struct LilycoveLadyQuiz *quiz);
+bool8 sub_818E704(struct Pokeblock *pokeblock);
+void sub_818E7E0(u8 *dest1, u8 *dest2);
+void sub_818E81C(u8 *dest);
+void sub_818E848(u8 *dest);
+void sub_818E868(u8 *dest, u8 category);
+u8 sub_818E880(void);
#endif //GUARD_LILYCOVE_LADY_H
diff --git a/include/load_save.h b/include/load_save.h
index 0fedd720b..20848e1a7 100644
--- a/include/load_save.h
+++ b/include/load_save.h
@@ -18,5 +18,6 @@ void SaveSerializedGame(void);
void LoadSerializedGame(void);
void LoadPlayerBag(void);
void SavePlayerBag(void);
+void SetSaveBlocksPointers(u16);
#endif // GUARD_LOAD_SAVE_H
diff --git a/include/malloc.h b/include/malloc.h
index bd870ede3..4568e244a 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -1,8 +1,14 @@
#ifndef GUARD_MALLOC_H
#define GUARD_MALLOC_H
+#define malloc Alloc
+#define calloc AllocZeroed
+#define free Free
+
+extern u8 gHeap[];
void *Alloc(u32 size);
void *AllocZeroed(u32 size);
void Free(void *pointer);
+void InitHeap(void *pointer, u32 size);
#endif // GUARD_MALLOC_H
diff --git a/include/map_obj_8097404.h b/include/map_obj_8097404.h
new file mode 100644
index 000000000..27ffd18cb
--- /dev/null
+++ b/include/map_obj_8097404.h
@@ -0,0 +1,32 @@
+//
+// Created by scott on 9/7/2017.
+//
+
+#ifndef GUARD_MAP_OBJ_8097404_H
+#define GUARD_MAP_OBJ_8097404_H
+
+// Exported type declarations
+
+// Exported RAM declarations
+extern void *gUnknown_020375B8;
+
+// Exported ROM declarations
+void sub_8097AC8(struct Sprite *);
+void npc_sync_anim_pause_bits(struct MapObject *);
+void oamt_npc_ministep_reset(struct Sprite *, u8, u8);
+u8 sub_8097F78(struct MapObject *);
+bool8 obj_npc_ministep(struct Sprite *sprite);
+bool8 sub_80976EC(struct Sprite *sprite);
+void sub_80976DC(struct Sprite *, u8);
+void sub_809783C(struct Sprite *, u8, u8, u8);
+void DoShadowFieldEffect(struct MapObject *);
+u8 sub_809785C(struct Sprite *);
+u8 sub_80978E4(struct Sprite *);
+void obj_anim_image_set_and_seek(struct Sprite *, u8, u8);
+bool8 sub_80979BC(struct Sprite *);
+void sub_8097750(struct Sprite *);
+bool8 sub_8097758(struct Sprite *);
+void sub_8097FA4(struct MapObject *);
+void sub_8098044(u8);
+
+#endif //GUARD_MAP_OBJ_8097404_H
diff --git a/include/mauville_old_man.h b/include/mauville_old_man.h
index d0526db88..aefc76083 100644
--- a/include/mauville_old_man.h
+++ b/include/mauville_old_man.h
@@ -1,6 +1,8 @@
+
#ifndef GUARD_MAUVILLE_OLD_MAN_H
#define GUARD_MAUVILLE_OLD_MAN_H
void SetMauvilleOldMan(void);
+u8 sub_81201C8(void);
#endif // GUARD_MAUVILLE_OLD_MAN_H
diff --git a/include/menu.h b/include/menu.h
index c8aafcb30..9a23401e0 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -15,4 +15,6 @@ struct MenuAction2
void (*func)(u8);
};
+void box_print(u8, u8, u8, u8, const void *, s8, const u8 *);
+
#endif // GUARD_MENU_H
diff --git a/include/metatile_behavior.h b/include/metatile_behavior.h
new file mode 100644
index 000000000..5ed36c690
--- /dev/null
+++ b/include/metatile_behavior.h
@@ -0,0 +1,11 @@
+#ifndef GUARD_METATILE_BEHAVIOR_H
+#define GUARD_METATILE_BEHAVIOR_H
+
+// Exported type declarations
+
+// Exported RAM declarations
+
+// Exported ROM declarations
+bool8 sub_8088E64(u8);
+
+#endif //GUARD_METATILE_BEHAVIOR_H
diff --git a/include/multiboot.h b/include/multiboot.h
index 950c853d0..d4700ff4e 100644
--- a/include/multiboot.h
+++ b/include/multiboot.h
@@ -15,7 +15,7 @@
void MultiBootInit(struct MultiBootParam *mp);
int MultiBootMain(struct MultiBootParam *mp);
void MultiBootStartProbe(struct MultiBootParam *mp);
-void MultiBootStartMaster(struct MultiBootParam *mp, u8 *srcp, int length, u8 palette_color, s8 palette_speed);
+void MultiBootStartMaster(struct MultiBootParam *mp, const u8 *srcp, int length, u8 palette_color, s8 palette_speed);
int MultiBootCheckComplete(struct MultiBootParam *mp);
#endif // GUARD_MULTIBOOT_H
diff --git a/include/new_game.h b/include/new_game.h
index f9ad7fcb8..060279c25 100644
--- a/include/new_game.h
+++ b/include/new_game.h
@@ -9,5 +9,7 @@ void ClearPokedexFlags(void);
void WarpToTruck(void);
void NewGameInitData(void);
void ResetMiniGamesResults(void);
+void sub_808447C(void);
+void Sav2_ClearSetDefault(void);
#endif // GUARD_NEW_GAME_H
diff --git a/include/rom4.h b/include/rom4.h
new file mode 100644
index 000000000..e19d277a6
--- /dev/null
+++ b/include/rom4.h
@@ -0,0 +1,33 @@
+
+#ifndef GUARD_ROM4_H
+#define GUARD_ROM4_H
+
+struct UnkPlayerStruct
+{
+ u8 player_field_0;
+ u8 player_field_1;
+};
+
+struct LinkPlayerMapObject
+{
+ u8 active;
+ u8 linkPlayerId;
+ u8 mapObjId;
+ u8 mode;
+};
+
+struct UCoords32
+{
+ u32 x, y;
+};
+
+
+extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4];
+
+void strange_npc_table_clear(void);
+const struct MapHeader *get_mapheader_by_bank_and_number(u8, u8);
+void FieldObjectMoveDestCoords(struct MapObject *, u32, s16 *, s16 *);
+void sub_8086230(void);
+void c2_exit_to_overworld_2_switch(void);
+
+#endif //GUARD_ROM4_H
diff --git a/include/rom6.h b/include/rom6.h
new file mode 100644
index 000000000..15070616d
--- /dev/null
+++ b/include/rom6.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_ROM6_H
+#define GUARD_ROM6_H
+
+void sub_81357FC(u8, void(void));
+
+#endif //GUARD_ROM6_H
diff --git a/include/rom_818CFC8.h b/include/rom_818CFC8.h
new file mode 100644
index 000000000..1d0626b2b
--- /dev/null
+++ b/include/rom_818CFC8.h
@@ -0,0 +1,11 @@
+//
+// Created by Scott Norton on 9/6/17.
+//
+
+#ifndef GUARD_ROM_818CFC8_H
+#define GUARD_ROM_818CFC8_H
+
+bool8 InBattlePyramid(void);
+u8 sub_81AAA40(void);
+
+#endif //GUARD_ROM_818CFC8_H
diff --git a/include/rom_81BE66C.h b/include/rom_81BE66C.h
new file mode 100644
index 000000000..5b4f80249
--- /dev/null
+++ b/include/rom_81BE66C.h
@@ -0,0 +1,12 @@
+//
+// Created by Scott Norton on 9/6/17.
+//
+
+#ifndef GUARD_ROM_81BE66C_H
+#define GUARD_ROM_81BE66C_H
+
+bool32 InTrainerHill(void);
+bool8 FieldObjectIsFarawayIslandMew(struct MapObject *);
+u32 sub_81D427C(void);
+
+#endif //GUARD_ROM_81BE66C_H
diff --git a/include/save.h b/include/save.h
index 1d7fdd6e3..e98233c67 100644
--- a/include/save.h
+++ b/include/save.h
@@ -1,6 +1,8 @@
#ifndef GUARD_SAVE_H
#define GUARD_SAVE_H
+extern u16 gSaveFileStatus;
+
struct SaveSectionLocation
{
void *data;
@@ -88,5 +90,7 @@ u16 CalculateChecksum(void *, u16);
//u8 unref_sub_8125FF0(u8 *data, u16 size);
//u8 unref_sub_8126068(u8 sector, u8 *data, u32 size);
//u8 unref_sub_8126080(u8 sector, u8 *data);
+u16 sub_815355C(void);
+u8 sub_81534D0(u8);
#endif // GUARD_SAVE_H
diff --git a/include/sprite.h b/include/sprite.h
index 7b3c9fb5a..838b0d7c0 100644
--- a/include/sprite.h
+++ b/include/sprite.h
@@ -240,6 +240,8 @@ struct OamMatrix
extern const struct OamData gDummyOamData;
extern const union AnimCmd *const gDummySpriteAnimTable[];
extern const union AffineAnimCmd *const gDummySpriteAffineAnimTable[];
+extern s16 gSpriteCoordOffsetX;
+extern s16 gSpriteCoordOffsetY;
extern struct Sprite gSprites[];
diff --git a/include/text.h b/include/text.h
index f584b61ea..dba409f37 100644
--- a/include/text.h
+++ b/include/text.h
@@ -195,9 +195,9 @@ bool8 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter);
bool8 TextPrinterWait(struct TextPrinter *textPrinter);
void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *counter, u8 *yCoordIndex);
u16 RenderText(struct TextPrinter *textPrinter);
-u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing);
+u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing);
u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32);
-s32 GetStringWidth(u8 fontId, u8 *str, s16 letterSpacing);
+u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing);
u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str);
u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y);
u8 GetKeypadIconTileOffset(u8 keypadIconId);
diff --git a/include/trainer_see.h b/include/trainer_see.h
new file mode 100644
index 000000000..3f39783b8
--- /dev/null
+++ b/include/trainer_see.h
@@ -0,0 +1,7 @@
+#ifndef GUARD_TRAINER_SEE_H
+#define GUARD_TRAINER_SEE_H
+
+void sub_80B4578(struct MapObject *);
+void sub_8155D78(struct MapObject *);
+
+#endif //GUARD_TRAINER_SEE_H
diff --git a/include/trig.h b/include/trig.h
index 477a0163f..a2f98a3e6 100644
--- a/include/trig.h
+++ b/include/trig.h
@@ -1,9 +1,6 @@
#ifndef GUARD_TRIG_H
#define GUARD_TRIG_H
-// Converts a number to Q8.8 fixed-point format
-#define Q_8_8(n) ((s16)((n) * 256))
-
extern const s16 gSineTable[];
s16 Sin(s16 index, s16 amplitude);
diff --git a/include/unknown_task.h b/include/unknown_task.h
new file mode 100644
index 000000000..f59ca9ac3
--- /dev/null
+++ b/include/unknown_task.h
@@ -0,0 +1,11 @@
+#ifndef GUARD_unknown_task_H
+#define GUARD_unknown_task_H
+
+// Exported type declarations
+
+// Exported RAM declarations
+
+// Exported ROM declarations
+void remove_some_task(void);
+
+#endif //GUARD_unknown_task_H
diff --git a/include/vars.h b/include/vars.h
index 5da960640..7c0edeb77 100644
--- a/include/vars.h
+++ b/include/vars.h
@@ -12,6 +12,8 @@
#define VAR_0x4008 0x4008
#define VAR_0x4009 0x4009
#define VAR_0x400A 0x400A
+#define VAR_0x4010 0x4010
+#define VAR_0x4011 0x4011
#define VAR_0x401F 0x401F
#define VAR_RECYCLE_GOODS 0x4020
#define VAR_REPEL_STEP_COUNT 0x4021