Skip to content

Commit

Permalink
cleanup map_object.c 1
Browse files Browse the repository at this point in the history
  • Loading branch information
red031000 committed Feb 27, 2024
1 parent 9a7a06f commit 42856c0
Show file tree
Hide file tree
Showing 38 changed files with 84 additions and 98 deletions.
2 changes: 1 addition & 1 deletion asm/include/overlay_01_021F8D80.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
.public sub_02023F30
.public sub_02023F40
.public GF_AssertFail
.public MapObjectManager_GetCount
.public MapObjectManager_GetObjectCount
.public MapObjectManager_SetFlagsBits
.public MapObjectManager_ClearFlagsBits
.public MapObjectManager_GetFlagsBitsMask
Expand Down
2 changes: 1 addition & 1 deletion asm/include/overlay_01_021F944C.inc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
.public sub_0205E420
.public sub_0205EEF4
.public sub_0205F09C
.public MapObjectManager_GetCount
.public MapObjectManager_GetObjectCount
.public MapObjectManager_GetHeapID
.public sub_0205F1A0
.public sub_0205F1AC
Expand Down
2 changes: 1 addition & 1 deletion asm/include/overlay_02.inc
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
.public sub_0205E38C
.public sub_0205E420
.public GetMapObjectByID
.public MapObjectManager_GetCount
.public MapObjectManager_GetObjectCount
.public MapObjectManager_GetObjects
.public sub_0205F1D0
.public MapObject_GetID
Expand Down
2 changes: 1 addition & 1 deletion asm/include/overlay_04.inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
.public PlayerAvatar_ToggleAutomaticHeightUpdating
.public PlayerAvatar_ToggleAutomaticHeightUpdating_NowApply
.public GetMapObjectByID
.public MapObjectManager_GetCount
.public MapObjectManager_GetObjectCount
.public MapObjectManager_GetObjects
.public sub_0205F1D0
.public MapObject_GetID
Expand Down
2 changes: 1 addition & 1 deletion asm/include/unk_0205FD20.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
.public sub_0205BA6C
.public sub_0205BA70
.public sub_0205BA94
.public MapObjectManager_GetCount
.public MapObjectManager_GetObjectCount
.public sub_0205F1AC
.public sub_0205F1C4
.public MapObject_GetFlagsWord
Expand Down
2 changes: 1 addition & 1 deletion asm/overlay_01_021F8D80.s
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ _021F9212:
add r0, r5, #0
bl FldObjSys_OpenMModelNarc
add r0, r5, #0
bl MapObjectManager_GetCount
bl MapObjectManager_GetObjectCount
str r0, [sp, #0x14]
add r0, r5, #0
bl MapObjectManager_GetHeapID
Expand Down
2 changes: 1 addition & 1 deletion asm/overlay_01_021F944C.s
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ ov01_021F97BC: ; 0x021F97BC
add r7, r0, #0
add r5, r1, #0
add r6, r2, #0
bl MapObjectManager_GetCount
bl MapObjectManager_GetObjectCount
add r4, r0, #0
add r0, r7, #0
bl sub_0205F1AC
Expand Down
2 changes: 1 addition & 1 deletion asm/overlay_02.s
Original file line number Diff line number Diff line change
Expand Up @@ -20327,7 +20327,7 @@ ov02_0224F4BC: ; 0x0224F4BC
bl GetPlayerYCoord
str r0, [sp]
ldr r0, [r4, #0x3c]
bl MapObjectManager_GetCount
bl MapObjectManager_GetObjectCount
str r0, [sp, #8]
ldr r0, [r4, #0x3c]
bl MapObjectManager_GetObjects
Expand Down
2 changes: 1 addition & 1 deletion asm/overlay_04.s
Original file line number Diff line number Diff line change
Expand Up @@ -2133,7 +2133,7 @@ ov04_02254F44: ; 0x02254F44
push {r3, r4, r5, r6, r7, lr}
add r4, r0, #0
ldr r0, [r4, #0x3c]
bl MapObjectManager_GetCount
bl MapObjectManager_GetObjectCount
add r5, r0, #0
ldr r0, [r4, #0x3c]
bl MapObjectManager_GetObjects
Expand Down
4 changes: 2 additions & 2 deletions asm/unk_0205FD20.s
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,7 @@ sub_02060BFC: ; 0x02060BFC
bl sub_0205F1AC
str r0, [sp, #8]
add r0, r5, #0
bl MapObjectManager_GetCount
bl MapObjectManager_GetObjectCount
str r0, [sp, #4]
_02060C1C:
ldr r0, [sp, #8]
Expand Down Expand Up @@ -1951,7 +1951,7 @@ sub_02060CA8: ; 0x02060CA8
bl sub_0205F1AC
str r0, [sp, #4]
add r0, r7, #0
bl MapObjectManager_GetCount
bl MapObjectManager_GetObjectCount
add r7, r0, #0
_02060CC8:
ldr r0, [sp, #4]
Expand Down
2 changes: 1 addition & 1 deletion include/follow_mon.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEHEARTGOLD_FOLLOW_MON_H
#define POKEHEARTGOLD_FOLLOW_MON_H

#include "field_map_object.h"
#include "map_object.h"
#include "heap.h"
#include "map_object_manager.h"

Expand Down
18 changes: 9 additions & 9 deletions include/field_map_object.h → include/map_object.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef POKEHEARTGOLD_FIELD_MAP_OBJECT_H
#define POKEHEARTGOLD_FIELD_MAP_OBJECT_H
#ifndef POKEHEARTGOLD_MAP_OBJECT_H
#define POKEHEARTGOLD_MAP_OBJECT_H

#include "script.h"

Expand Down Expand Up @@ -154,9 +154,9 @@ typedef enum MapObjectFlagBits {
struct MapObjectInitArgs;

// FIXME: Some of these declarations are static and don't belong in here.
MapObjectManager *sub_0205E0BC(FieldSystem *fieldSystem, int num, HeapID heapId);
void MapObjectManager_Delete(MapObjectManager *man);
void sub_0205E104(MapObjectManager* manager, u32 a1, u32 a2, u32 num_object_events, ObjectEvent* object_events);
MapObjectManager *MapObjectManager_Init(FieldSystem *fieldSystem, u32 objectCount, HeapID heapId);
void MapObjectManager_Delete(MapObjectManager *manager);
void sub_0205E104(MapObjectManager *manager, u32 unused, u32 a2, u32 objectCount, ObjectEvent* objectEvents);
MapObjectManager* MapObjectManager_New(u32 count);
LocalMapObject* sub_0205E1D0(MapObjectManager* manager, ObjectEvent* object_events, u32 map_no);
LocalMapObject *CreateSpecialFieldObject(MapObjectManager *objectMan, u32 x, u32 z, u32 direction, u32 sprite, u32 movement, u32 mapNo);
Expand Down Expand Up @@ -206,8 +206,8 @@ BOOL sub_0205F0F8(LocalMapObject* object, u32 gfx_id, u32 id, u32 a3);
void sub_0205F12C(SysTask* task, LocalMapObject* object);
void sub_0205F148(LocalMapObject* object);
MapObjectManager* sub_0205F160(MapObjectManager* manager);
void MapObjectManager_SetCount(MapObjectManager*, u32);
u32 MapObjectManager_GetCount(MapObjectManager*);
void MapObjectManager_SetObjectCount(MapObjectManager*, u32);
u32 MapObjectManager_GetObjectCount(MapObjectManager*);
void sub_0205F16C(MapObjectManager* manager);
void sub_0205F174(MapObjectManager* manager);
void MapObjectManager_SetFlagsBits(MapObjectManager* manager, u32 bits);
Expand All @@ -222,7 +222,7 @@ const LocalMapObject* MapObjectManager_GetConstObjects(MapObjectManager*);
LocalMapObject* MapObjectManager_GetObjects(MapObjectManager*);
void sub_0205F1C4(LocalMapObject** objects);
void sub_0205F1D0(LocalMapObject** objects);
void MapObjectManager_SetFieldSysPtr(MapObjectManager*, FieldSystem*);
void MapObjectManager_SetFieldSystemPtr(MapObjectManager*, FieldSystem*);
FieldSystem* MapObjectManager_GetFieldSystemPtr(MapObjectManager*);
void FldObjSys_SetMModelNarc(MapObjectManager* manager, NARC* mmodel_narc);
NARC* FldObjSys_GetMModelNarc(MapObjectManager* manager);
Expand Down Expand Up @@ -442,4 +442,4 @@ void sub_0205FCBC(LocalMapObject* object);
void sub_0205FCC0(LocalMapObject* object);
void sub_0205FCD4(LocalMapObject* object);

#endif //POKEHEARTGOLD_FIELD_MAP_OBJECT_H
#endif //POKEHEARTGOLD_MAP_OBJECT_H
2 changes: 1 addition & 1 deletion include/overlay_01_021F1348.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEHEARTGOLD_OV_01_021F1348_H
#define POKEHEARTGOLD_OV_01_021F1348_H

#include "field_map_object.h"
#include "map_object.h"
#include "script.h"
#include "task.h"
#include "unk_020689C8.h"
Expand Down
2 changes: 1 addition & 1 deletion include/overlay_01_021F72DC.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEHEARTGOLD_OVERLAY_01_021F72DC_H
#define POKEHEARTGOLD_OVERLAY_01_021F72DC_H

#include "field_map_object.h"
#include "map_object.h"
#include "unk_02023694.h"

Sprite *ov01_021F72DC(LocalMapObject *obj);
Expand Down
2 changes: 1 addition & 1 deletion include/unk_0205FD20.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEHEARTGOLD_UNK_0205FD20_H
#define POKEHEARTGOLD_UNK_0205FD20_H

#include "field_map_object.h"
#include "map_object.h"
#include "task.h"

void sub_02061070(LocalMapObject *object);
Expand Down
2 changes: 1 addition & 1 deletion include/unk_020658D4.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEHEARTGOLD_UNK_020658D4_H
#define POKEHEARTGOLD_UNK_020658D4_H

#include "field_map_object.h"
#include "map_object.h"

LocalMapObject *sub_020660C0(LocalMapObject *lastTalked);
int sub_02066420(LocalMapObject *mapObject, int a1);
Expand Down
2 changes: 1 addition & 1 deletion main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Static main
Object asm/unk_0205BFF0.o
Object src/field_player_avatar.o
Object asm/unk_0205CB48.o
Object src/field_map_object.o
Object src/map_object.o
Object asm/unk_data_020FCBD8.o
Object asm/unk_0205FD20.o
Object asm/unk_02061284.o
Expand Down
4 changes: 2 additions & 2 deletions src/encounter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "battle/battle_setup.h"
#include "encounter.h"
#include "blackout.h"
#include "field_map_object.h"
#include "map_object.h"
#include "field_system.h"
#include "field_warp_tasks.h"
#include "game_clear.h"
Expand Down Expand Up @@ -37,7 +37,7 @@
#include "unk_020552A4.h"
#include "unk_02034354.h"
#include "unk_02066EDC.h"
#include "field_map_object.h"
#include "map_object.h"
#include "field_warp_tasks.h"
#include "unk_02058034.h"
#include "pokedex_util.h"
Expand Down
2 changes: 1 addition & 1 deletion src/field/overlay_01_021FFECC.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "field_map_object.h"
#include "map_object.h"
#include "field_player_avatar.h"
#include "overlay_01_021FFECC.h"
#include "unk_0205FD20.h"
Expand Down
2 changes: 1 addition & 1 deletion src/field/overlay_01_apricorn_tree_anim.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "field_map_object.h"
#include "map_object.h"
#include "overlay_01_021F1AFC.h"
#include "overlay_01_021F944C.h"
#include "overlay_01_apricorn_tree_anim.h"
Expand Down
2 changes: 1 addition & 1 deletion src/field/scrcmd_message.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "field_map_object.h"
#include "map_object.h"
#include "field_system.h"
#include "fieldmap.h"
#include "font.h"
Expand Down
2 changes: 1 addition & 1 deletion src/field/scrcmd_pokemon_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "bag.h"
#include "bug_contest.h"
#include "fieldmap.h"
#include "field_map_object.h"
#include "map_object.h"
#include "friend_group.h"
#include "gf_gfx_loader.h"
#include "photo_album.h"
Expand Down
2 changes: 1 addition & 1 deletion src/field_move.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "script.h"
#include "field_move.h"
#include "field_map_object.h"
#include "map_object.h"
#include "alph_checks.h"
#include "field_player_avatar.h"
#include "unk_0203DB6C.h"
Expand Down
2 changes: 1 addition & 1 deletion src/field_player_avatar.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "global.h"
#include "field_player_avatar.h"
#include "assert.h"
#include "field_map_object.h"
#include "map_object.h"
#include "heap.h"
#include "overlay_00_thumb.h"
#include "overlay_01.h"
Expand Down
2 changes: 1 addition & 1 deletion src/field_use_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "unk_0203DFA4.h"
#include "unk_02078E30.h"
#include "follow_mon.h"
#include "field_map_object.h"
#include "map_object.h"
#include "save_arrays.h"
#include "sound_radio.h"
#include "sound_02004A44.h"
Expand Down
6 changes: 3 additions & 3 deletions src/field_warp_tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "unk_02054E00.h"
#include "unk_0206793C.h"
#include "unk_0203BA5C.h"
#include "field_map_object.h"
#include "map_object.h"
#include "follow_mon.h"
#include "unk_02056D7C.h"
#include "field_system_rtc_weather.h"
Expand Down Expand Up @@ -223,7 +223,7 @@ static void sub_0205316C(FieldSystem *fieldSystem) {
playerSaveData = LocalFieldData_GetPlayer(Save_LocalFieldData_Get(fieldSystem->saveData));
fieldSystem->playerAvatar = sub_0205C390(fieldSystem->mapObjectManager, fieldSystem->location->x, fieldSystem->location->y, fieldSystem->location->direction, playerSaveData->unk4, gender, 2, playerSaveData);
} else {
fieldSystem->mapObjectManager = sub_0205E0BC(fieldSystem, 64, HEAP_ID_BATTLE);
fieldSystem->mapObjectManager = MapObjectManager_Init(fieldSystem, 64, HEAP_ID_BATTLE);
gender = PlayerProfile_GetTrainerGender(Save_PlayerData_GetProfileAddr(fieldSystem->saveData));
playerSaveData = LocalFieldData_GetPlayer(Save_LocalFieldData_Get(fieldSystem->saveData));
fieldSystem->playerAvatar = sub_0205C390(fieldSystem->mapObjectManager, fieldSystem->location->x, fieldSystem->location->y, fieldSystem->location->direction, playerSaveData->unk4, gender, 2, playerSaveData);
Expand All @@ -248,7 +248,7 @@ static void sub_0205323C(FieldSystem *fieldSystem) {
u32 gender;
struct PlayerSaveData *playerSaveData;

fieldSystem->mapObjectManager = sub_0205E0BC(fieldSystem, 64, HEAP_ID_BATTLE);
fieldSystem->mapObjectManager = MapObjectManager_Init(fieldSystem, 64, HEAP_ID_BATTLE);
FieldSystem_RestoreMapObjectsFromSave(fieldSystem);
playerSaveData = LocalFieldData_GetPlayer(Save_LocalFieldData_Get(fieldSystem->saveData));
gender = PlayerProfile_GetTrainerGender(Save_PlayerData_GetProfileAddr(fieldSystem->saveData));
Expand Down
2 changes: 1 addition & 1 deletion src/fieldmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "save_vars_flags.h"
#include "map_events.h"
#include "task.h"
#include "field_map_object.h"
#include "map_object.h"
#include "constants/std_script.h"
#include "fielddata/script/scr_seq.naix"
#include "msgdata/msg.naix"
Expand Down
2 changes: 1 addition & 1 deletion src/follow_mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "map_object_manager.h"
#include "save_follow_mon.h"
#include "script_pokemon_util.h"
#include "field_map_object.h"
#include "map_object.h"
#include "map_header.h"
#include "follow_mon.h"
#include "constants/scrcmd.h"
Expand Down
2 changes: 1 addition & 1 deletion src/map_events.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "map_events.h"
#include "filesystem.h"
#include "encounter_tables_narc.h"
#include "field_map_object.h"
#include "map_object.h"

static void MapEvents_ReadFromNarc(MapEvents *events, u32 mapno);
static void MapEvents_ComputeRamHeader(MapEvents *events);
Expand Down
Loading

0 comments on commit 42856c0

Please sign in to comment.