Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decompile save_follow_mon #342

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions asm/include/unk_0202ED18.inc

This file was deleted.

82 changes: 0 additions & 82 deletions asm/unk_0202ED18.s

This file was deleted.

26 changes: 13 additions & 13 deletions include/save_follow_mon.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

#include "save.h"

struct SaveFollowMon {
int mapno;
int unk_4_0 : 2;
int unk_4_2 : 1;
};
typedef struct SaveFollowMon {
u32 mapNo;
s32 unused : 2;
s32 inhibitFlag : 1;
} SaveFollowMon;

u32 Save_FollowMon_sizeof(void);
void Save_FollowMon_Init(struct SaveFollowMon *followPoke);
struct SaveFollowMon *Save_FollowMon_Get(SaveData *saveData);
int Save_FollowMon_GetMapId(struct SaveFollowMon *followPoke);
void Save_FollowMon_SetMapId(int mapno, struct SaveFollowMon *followPoke);
u8 Save_FollowMon_GetUnused2bitField(struct SaveFollowMon *followPoke); // deadstripped
void Save_FollowMon_SetUnused2bitField(u8 unk, struct SaveFollowMon *followPoke);
void Save_FollowMon_SetInhibitFlagState(struct SaveFollowMon *followPoke, u8 state);
u8 Save_FollowMon_GetInhibitFlagState(struct SaveFollowMon *followPoke);
void Save_FollowMon_Init(SaveFollowMon *followMon);
SaveFollowMon *Save_FollowMon_Get(SaveData *saveData);
void Save_FollowMon_SetMapID(u32 mapNo, SaveFollowMon *followMon);
u32 Save_FollowMon_GetMapID(SaveFollowMon *followMon);
u8 Save_FollowMon_GetUnused2bitField(SaveFollowMon *followMon); // deadstripped
void Save_FollowMon_SetUnused2bitField(u8 value, SaveFollowMon *followMon);
void Save_FollowMon_SetInhibitFlagState(SaveFollowMon *followMon, u8 flag);
u8 Save_FollowMon_GetInhibitFlagState(SaveFollowMon *followMon);

#endif // POKEHEARTGOLD_SAVE_FOLLOW_MON_H
2 changes: 1 addition & 1 deletion main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Static main
Object src/save_rankings.o
Object asm/unk_0202EB30.o
Object src/update_dex_received.o
Object asm/unk_0202ED18.o
Object src/save_follow_mon.o
Object src/save_pokegear.o
Object src/safari_zone.o
Object src/photo_album.o
Expand Down
2 changes: 1 addition & 1 deletion src/follow_mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ BOOL FollowMon_IsVisible(FieldSystem *fieldSystem) {
BOOL FollowMon_GetPermission(FieldSystem *fieldSystem) {
u32 mapNo;

mapNo = Save_FollowMon_GetMapId(Save_FollowMon_Get(fieldSystem->saveData));
mapNo = Save_FollowMon_GetMapID(Save_FollowMon_Get(fieldSystem->saveData));
return FollowMon_GetPermissionBySpeciesAndMap(FollowMon_GetSpecies(fieldSystem->followMon.mapObject), mapNo);
}

Expand Down
38 changes: 38 additions & 0 deletions src/save_follow_mon.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "save_follow_mon.h"

#include "global.h"

#include "save_arrays.h"

u32 Save_FollowMon_sizeof(void) {
return sizeof(SaveFollowMon);
}

void Save_FollowMon_Init(SaveFollowMon *followMon) {
memset(followMon, 0, sizeof(SaveFollowMon));
followMon->mapNo = 0;
}

SaveFollowMon *Save_FollowMon_Get(SaveData *saveData) {
return (SaveFollowMon *)SaveArray_Get(saveData, SAVE_FOLLOW_MON);
}

void Save_FollowMon_SetMapID(u32 mapNo, SaveFollowMon *followMon) {
followMon->mapNo = mapNo;
}

u32 Save_FollowMon_GetMapID(SaveFollowMon *followMon) {
return followMon->mapNo;
}

void Save_FollowMon_SetUnused2bitField(u8 value, SaveFollowMon *followMon) {
followMon->unused = value;
}

void Save_FollowMon_SetInhibitFlagState(SaveFollowMon *followMon, u8 flag) {
followMon->inhibitFlag = flag;
}

u8 Save_FollowMon_GetInhibitFlagState(SaveFollowMon *followMon) {
return (u8)followMon->inhibitFlag;
}
2 changes: 1 addition & 1 deletion src/unk_02055BF0.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ BOOL sub_02055DBC(TaskManager *man) {
if (FollowMon_IsActive(fieldSystem) && ov01_022057C4(fieldSystem) && !FollowMon_GetPermission(fieldSystem)) {
ov01_022057D0(fieldSystem);
}
Save_FollowMon_SetMapId(fieldSystem->location->mapId, Save_FollowMon_Get(fieldSystem->saveData));
Save_FollowMon_SetMapID(fieldSystem->location->mapId, Save_FollowMon_Get(fieldSystem->saveData));
env->destinationMapID = fieldSystem->location->mapId;
env->state++;
break;
Expand Down