mirror of
https://github.com/pret/pokeheartgold.git
synced 2024-11-23 21:30:05 +00:00
field_follow_poke, 1; use mwldarm.response.template instead of obj.list
This commit is contained in:
parent
55da45ebc1
commit
976f2af29d
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -45,6 +45,7 @@ jobs:
|
||||
mv NitroSDK-3_2-060901/tools/bin $GITHUB_WORKSPACE/tools
|
||||
mv NitroSDK-3_2-060901/include/nitro/specfiles/ARM7-TS.lcf.template $GITHUB_WORKSPACE/sub/
|
||||
mv NitroSDK-3_2-060901/include/nitro/specfiles/ARM9-TS.lcf.template $GITHUB_WORKSPACE/
|
||||
mv NitroSDK-3_2-060901/include/nitro/specfiles/mwldarm.response.template $GITHUB_WORKSPACE/
|
||||
working-directory: ~
|
||||
|
||||
- name: Build HeartGold
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -32,6 +32,8 @@ cmake-build-debug/
|
||||
|
||||
*.lcf.template
|
||||
*.lcf
|
||||
*.response.template
|
||||
*.response
|
||||
|
||||
# Working files
|
||||
overlays/*/module_*.s
|
||||
|
@ -8,7 +8,7 @@ In the future, a GCC option will be available so MWCC is not required to build,
|
||||
|
||||
### 2. Install Nitro SDK
|
||||
|
||||
As with the compiler, the Nitro SDK is proprietary and cannot be distributed here. Download the "NitroSDK-4_2-071210-jp.7z" file pinned in the PRET discord. Extract and copy the contents of tools/bin from the Nitro SDK to tools/bin in your pokeheartgold clone. Finally, copy include/nitro/specfiles/ARM7-TS.lcf.template into the subdirectory `sub`, and include/nitro/specfiles/ARM9-TS.lcf.template into the project root.
|
||||
As with the compiler, the Nitro SDK is proprietary and cannot be distributed here. Download the "NitroSDK-4_2-071210-jp.7z" file pinned in the PRET discord. Extract and copy the contents of tools/bin from the Nitro SDK to tools/bin in your pokeheartgold clone. Finally, copy include/nitro/specfiles/ARM7-TS.lcf.template into the subdirectory `sub`, and include/nitro/specfiles/ARM9-TS.lcf.template and include/nitro/specfiles/mwldarm.response.template into the project root.
|
||||
|
||||
### 3. Dependencies
|
||||
|
||||
|
@ -12,399 +12,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_020699F8
|
||||
sub_020699F8: ; 0x020699F8
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
sub sp, #0x28
|
||||
str r0, [sp, #0x10]
|
||||
str r1, [sp, #0x14]
|
||||
str r2, [sp, #0x18]
|
||||
str r3, [sp, #0x1c]
|
||||
bl MapObjectMan_GetFieldSysPtr
|
||||
add r4, r0, #0
|
||||
ldr r0, [r4, #0xc]
|
||||
bl SavArray_PlayerParty_get
|
||||
add r5, r0, #0
|
||||
bl GetPartyCount
|
||||
add r6, r0, #0
|
||||
add r0, r4, #0
|
||||
add r0, #0xe4
|
||||
bl sub_0206A06C
|
||||
ldr r0, [r4, #0xc]
|
||||
bl Sav2_FollowPoke_get
|
||||
add r1, r0, #0
|
||||
mov r0, #0
|
||||
bl SavFollowPoke_SetUnused2bitField
|
||||
cmp r6, #0
|
||||
bne _02069A34
|
||||
b _02069B6C
|
||||
_02069A34:
|
||||
add r0, r5, #0
|
||||
bl CountAlivePokemon
|
||||
cmp r0, #0
|
||||
bne _02069A46
|
||||
add r0, r5, #0
|
||||
bl GetFirstNonEggInParty
|
||||
b _02069A4C
|
||||
_02069A46:
|
||||
add r0, r5, #0
|
||||
bl GetFirstAliveMonInParty_CrashIfNone
|
||||
_02069A4C:
|
||||
add r5, r0, #0
|
||||
add r0, r5, #0
|
||||
mov r1, #5
|
||||
mov r2, #0
|
||||
bl GetMonData
|
||||
add r1, r4, #0
|
||||
mov r2, #0
|
||||
add r1, #0xe4
|
||||
str r2, [r1]
|
||||
ldr r1, [sp, #0x40]
|
||||
add r6, r0, #0
|
||||
bl sub_02069FF4
|
||||
cmp r0, #0
|
||||
beq _02069B6C
|
||||
add r0, r5, #0
|
||||
mov r1, #0x70
|
||||
mov r2, #0
|
||||
bl GetMonData
|
||||
add r7, r0, #0
|
||||
add r0, r5, #0
|
||||
mov r1, #0x6f
|
||||
mov r2, #0
|
||||
bl GetMonData
|
||||
str r0, [sp, #0x20]
|
||||
add r0, r5, #0
|
||||
bl MonIsShiny
|
||||
str r0, [sp, #0x24]
|
||||
ldr r0, [sp, #0x1c]
|
||||
lsl r2, r7, #0x10
|
||||
str r0, [sp]
|
||||
ldr r0, [sp, #0x14]
|
||||
ldr r3, [sp, #0x20]
|
||||
str r0, [sp, #4]
|
||||
ldr r0, [sp, #0x18]
|
||||
add r1, r6, #0
|
||||
str r0, [sp, #8]
|
||||
ldr r0, [sp, #0x24]
|
||||
lsr r2, r2, #0x10
|
||||
str r0, [sp, #0xc]
|
||||
ldr r0, [sp, #0x10]
|
||||
bl CreateFollowingSpriteFieldObject
|
||||
add r1, r4, #0
|
||||
add r1, #0xe4
|
||||
str r0, [r1]
|
||||
add r0, r4, #0
|
||||
lsl r2, r7, #0x18
|
||||
mov r1, #1
|
||||
add r0, #0xfa
|
||||
strb r1, [r0]
|
||||
ldr r0, [sp, #0x20]
|
||||
ldr r3, [sp, #0x24]
|
||||
lsl r0, r0, #0x18
|
||||
lsr r0, r0, #0x18
|
||||
str r0, [sp]
|
||||
add r0, r4, #0
|
||||
add r1, r6, #0
|
||||
lsr r2, r2, #0x18
|
||||
bl FollowPokeFsysParamSet
|
||||
mov r1, #0
|
||||
add r0, r5, #0
|
||||
add r2, r1, #0
|
||||
bl GetMonData
|
||||
add r3, r0, #0
|
||||
mov r0, #0x42
|
||||
lsl r0, r0, #2
|
||||
lsl r2, r6, #0x10
|
||||
ldr r0, [r4, r0]
|
||||
add r1, r5, #0
|
||||
lsr r2, r2, #0x10
|
||||
bl sub_0206A288
|
||||
ldr r0, [r4, #0x40]
|
||||
bl sub_0205C700
|
||||
cmp r0, #0
|
||||
beq _02069AF8
|
||||
cmp r0, #3
|
||||
bne _02069B08
|
||||
_02069AF8:
|
||||
ldr r0, [r4, #0xc]
|
||||
bl Sav2_FollowPoke_get
|
||||
add r1, r0, #0
|
||||
mov r0, #1
|
||||
bl SavFollowPoke_SetUnused2bitField
|
||||
b _02069B58
|
||||
_02069B08:
|
||||
cmp r0, #1
|
||||
bne _02069B2E
|
||||
ldr r0, [r4, #0xc]
|
||||
bl Sav2_FollowPoke_get
|
||||
add r1, r0, #0
|
||||
mov r0, #2
|
||||
bl SavFollowPoke_SetUnused2bitField
|
||||
add r0, r4, #0
|
||||
bl sub_0206A054
|
||||
add r0, r4, #0
|
||||
bl FollowingPokemon_GetMapObject
|
||||
mov r1, #0x38
|
||||
bl sub_0205FC94
|
||||
b _02069B58
|
||||
_02069B2E:
|
||||
cmp r0, #2
|
||||
bne _02069B54
|
||||
ldr r0, [r4, #0xc]
|
||||
bl Sav2_FollowPoke_get
|
||||
add r1, r0, #0
|
||||
mov r0, #2
|
||||
bl SavFollowPoke_SetUnused2bitField
|
||||
add r0, r4, #0
|
||||
bl sub_0206A054
|
||||
add r0, r4, #0
|
||||
bl FollowingPokemon_GetMapObject
|
||||
mov r1, #0x38
|
||||
bl sub_0205FC94
|
||||
b _02069B58
|
||||
_02069B54:
|
||||
bl GF_AssertFail
|
||||
_02069B58:
|
||||
ldr r0, [r4, #0xc]
|
||||
bl Sav2_FollowPoke_get
|
||||
bl SavFollowPoke_GetInhibitFlagState
|
||||
cmp r0, #0
|
||||
beq _02069B6C
|
||||
add r0, r4, #0
|
||||
bl sub_0206A054
|
||||
_02069B6C:
|
||||
add r4, #0xe4
|
||||
ldr r0, [r4]
|
||||
add sp, #0x28
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
thumb_func_end sub_020699F8
|
||||
|
||||
thumb_func_start sub_02069B74
|
||||
sub_02069B74: ; 0x02069B74
|
||||
push {r4, r5, r6, r7, lr}
|
||||
sub sp, #0x14
|
||||
add r7, r1, #0
|
||||
bl MapObjectMan_GetFieldSysPtr
|
||||
add r5, r0, #0
|
||||
ldr r0, [r5, #0xc]
|
||||
bl SavArray_PlayerParty_get
|
||||
add r6, r0, #0
|
||||
bl GetPartyCount
|
||||
add r4, r0, #0
|
||||
add r0, r5, #0
|
||||
add r0, #0xe4
|
||||
bl sub_0206A06C
|
||||
cmp r4, #0
|
||||
bne _02069B9C
|
||||
b _02069D62
|
||||
_02069B9C:
|
||||
add r0, r6, #0
|
||||
bl GetFirstAliveMonInParty_CrashIfNone
|
||||
mov r1, #5
|
||||
mov r2, #0
|
||||
add r6, r0, #0
|
||||
bl GetMonData
|
||||
mov r1, #0
|
||||
add r4, r0, #0
|
||||
add r0, r6, #0
|
||||
add r2, r1, #0
|
||||
bl GetMonData
|
||||
add r3, r0, #0
|
||||
mov r0, #0x42
|
||||
lsl r0, r0, #2
|
||||
lsl r2, r4, #0x10
|
||||
ldr r0, [r5, r0]
|
||||
add r1, r6, #0
|
||||
lsr r2, r2, #0x10
|
||||
bl sub_0206A288
|
||||
add r0, r4, #0
|
||||
add r1, r7, #0
|
||||
bl sub_02069FF4
|
||||
cmp r0, #0
|
||||
ldr r0, [r5, #0x3c]
|
||||
bne _02069BDA
|
||||
b _02069CF2
|
||||
_02069BDA:
|
||||
mov r1, #0xfd
|
||||
bl GetMapObjectByID
|
||||
str r0, [sp, #4]
|
||||
cmp r0, #0
|
||||
bne _02069BF0
|
||||
mov r0, #1
|
||||
add r5, #0xf9
|
||||
add sp, #0x14
|
||||
strb r0, [r5]
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
_02069BF0:
|
||||
add r0, r6, #0
|
||||
mov r1, #0x70
|
||||
mov r2, #0
|
||||
bl GetMonData
|
||||
add r7, r0, #0
|
||||
add r0, r6, #0
|
||||
bl GetMonGender
|
||||
str r0, [sp, #8]
|
||||
add r0, r6, #0
|
||||
bl MonIsShiny
|
||||
add r6, r0, #0
|
||||
add r1, r5, #0
|
||||
lsl r2, r7, #0x18
|
||||
ldr r0, [sp, #4]
|
||||
add r1, #0xe4
|
||||
str r0, [r1]
|
||||
add r0, r5, #0
|
||||
mov r1, #1
|
||||
add r0, #0xfa
|
||||
strb r1, [r0]
|
||||
ldr r0, [sp, #8]
|
||||
add r1, r4, #0
|
||||
str r0, [sp]
|
||||
add r0, r5, #0
|
||||
lsr r2, r2, #0x18
|
||||
add r3, r6, #0
|
||||
bl FollowPokeFsysParamSet
|
||||
lsl r2, r7, #0x18
|
||||
ldr r0, [sp, #4]
|
||||
add r1, r4, #0
|
||||
lsr r2, r2, #0x18
|
||||
add r3, r6, #0
|
||||
bl FollowPokeMapObjectSetParams
|
||||
lsl r1, r7, #0x10
|
||||
ldr r2, [sp, #8]
|
||||
add r0, r4, #0
|
||||
lsr r1, r1, #0x10
|
||||
bl FollowingPokemon_GetSpriteID
|
||||
add r1, r0, #0
|
||||
add r0, r5, #0
|
||||
add r0, #0xe4
|
||||
ldr r0, [r0]
|
||||
bl MapObject_SetGfxID
|
||||
ldr r0, [r5, #0x40]
|
||||
bl sub_0205C700
|
||||
cmp r0, #0
|
||||
beq _02069C62
|
||||
cmp r0, #3
|
||||
bne _02069C72
|
||||
_02069C62:
|
||||
ldr r0, [r5, #0xc]
|
||||
bl Sav2_FollowPoke_get
|
||||
add r1, r0, #0
|
||||
mov r0, #1
|
||||
bl SavFollowPoke_SetUnused2bitField
|
||||
b _02069CB6
|
||||
_02069C72:
|
||||
cmp r0, #1
|
||||
bne _02069C92
|
||||
ldr r0, [r5, #0xc]
|
||||
bl Sav2_FollowPoke_get
|
||||
add r1, r0, #0
|
||||
mov r0, #2
|
||||
bl SavFollowPoke_SetUnused2bitField
|
||||
add r0, r5, #0
|
||||
add r0, #0xe4
|
||||
ldr r0, [r0]
|
||||
mov r1, #1
|
||||
bl sub_0206A040
|
||||
b _02069CB6
|
||||
_02069C92:
|
||||
cmp r0, #2
|
||||
bne _02069CB2
|
||||
ldr r0, [r5, #0xc]
|
||||
bl Sav2_FollowPoke_get
|
||||
add r1, r0, #0
|
||||
mov r0, #2
|
||||
bl SavFollowPoke_SetUnused2bitField
|
||||
add r0, r5, #0
|
||||
add r0, #0xe4
|
||||
ldr r0, [r0]
|
||||
mov r1, #1
|
||||
bl sub_0206A040
|
||||
b _02069CB6
|
||||
_02069CB2:
|
||||
bl GF_AssertFail
|
||||
_02069CB6:
|
||||
add r0, r5, #0
|
||||
add r0, #0xe4
|
||||
ldr r0, [r0]
|
||||
bl sub_02069E14
|
||||
cmp r0, #0
|
||||
beq _02069CD0
|
||||
add r0, r5, #0
|
||||
add r0, #0xe4
|
||||
ldr r0, [r0]
|
||||
mov r1, #1
|
||||
bl sub_0206A040
|
||||
_02069CD0:
|
||||
ldr r0, [r5, #0xc]
|
||||
bl Sav2_FollowPoke_get
|
||||
bl SavFollowPoke_GetInhibitFlagState
|
||||
cmp r0, #0
|
||||
beq _02069CE4
|
||||
add r0, r5, #0
|
||||
bl sub_0206A054
|
||||
_02069CE4:
|
||||
add r5, #0xe4
|
||||
ldr r0, [r5]
|
||||
mov r1, #0
|
||||
bl sub_0205F6AC
|
||||
add sp, #0x14
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
_02069CF2:
|
||||
mov r1, #0xfd
|
||||
bl GetMapObjectByID
|
||||
str r0, [sp, #0xc]
|
||||
cmp r0, #0
|
||||
beq _02069D62
|
||||
add r0, r6, #0
|
||||
mov r1, #0x70
|
||||
mov r2, #0
|
||||
bl GetMonData
|
||||
add r7, r0, #0
|
||||
add r0, r6, #0
|
||||
bl GetMonGender
|
||||
str r0, [sp, #0x10]
|
||||
add r0, r6, #0
|
||||
bl MonIsShiny
|
||||
add r6, r0, #0
|
||||
ldr r0, [sp, #0x10]
|
||||
lsl r2, r7, #0x18
|
||||
str r0, [sp]
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
lsr r2, r2, #0x18
|
||||
add r3, r6, #0
|
||||
bl FollowPokeFsysParamSet
|
||||
lsl r2, r7, #0x18
|
||||
ldr r0, [sp, #0xc]
|
||||
add r1, r4, #0
|
||||
lsr r2, r2, #0x18
|
||||
add r3, r6, #0
|
||||
bl FollowPokeMapObjectSetParams
|
||||
lsl r1, r7, #0x10
|
||||
ldr r2, [sp, #0x10]
|
||||
add r0, r4, #0
|
||||
lsr r1, r1, #0x10
|
||||
bl FollowingPokemon_GetSpriteID
|
||||
add r1, r0, #0
|
||||
ldr r0, [sp, #0xc]
|
||||
bl MapObject_SetGfxID
|
||||
add r1, r5, #0
|
||||
ldr r0, [sp, #0xc]
|
||||
add r1, #0xe4
|
||||
str r0, [r1]
|
||||
add r0, r5, #0
|
||||
mov r1, #1
|
||||
add r0, #0xfa
|
||||
strb r1, [r0]
|
||||
add r5, #0xf9
|
||||
strb r1, [r5]
|
||||
_02069D62:
|
||||
add sp, #0x14
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02069B74
|
||||
|
||||
thumb_func_start FollowingPokemon_GetMapObject
|
||||
FollowingPokemon_GetMapObject: ; 0x02069D68
|
||||
add r0, #0xe4
|
14
common.mk
14
common.mk
@ -91,6 +91,7 @@ ALL_BUILDDIRS := $(sort $(ALL_BUILDDIRS) $(foreach obj,$(ALL_OBJS),$
|
||||
NEF := $(BUILD_DIR)/$(NEFNAME).nef
|
||||
ELF := $(NEF:%.nef=%.elf)
|
||||
LCF := $(NEF:%.nef=%.lcf)
|
||||
RESPONSE := $(NEF:%.nef=%.response)
|
||||
SBIN := $(NEF:%.nef=%.sbin)
|
||||
XMAP := $(NEF).xMAP
|
||||
|
||||
@ -182,9 +183,16 @@ else
|
||||
$(SED) -i '/\} > check\.WORKRAM/a SDK_SUBPRIV_ARENA_LO = SDK_SUBPRIV_ARENA_LO + SDK_AUTOLOAD.EXT_WRAM.SIZE + SDK_AUTOLOAD.EXT_WRAM.BSS_SIZE;' $@
|
||||
endif
|
||||
|
||||
$(NEF): $(LCF) $(ALL_OBJS)
|
||||
echo $(ALL_OBJS:$(BUILD_DIR)/%=%) >$(BUILD_DIR)/obj.list
|
||||
cd $(BUILD_DIR) && LM_LICENSE_FILE=$(BACK_REL)/$(LM_LICENSE_FILE) $(WINE) $(MWLD) $(MWLDFLAGS) $(LIBS) -o $(BACK_REL)/$(NEF) $(LCF:$(BUILD_DIR)/%=%) @obj.list
|
||||
RESPONSE_TEMPLATE := $(PROJECT_ROOT)/mwldarm.response.template
|
||||
|
||||
$(RESPONSE): $(LSF) $(RESPONSE_TEMPLATE)
|
||||
$(WINE) $(MAKELCF) $(MAKELCF_FLAGS) $< $(RESPONSE_TEMPLATE:$(PROJECT_ROOT)=$(PROJECT_ROOT_NT)) $@
|
||||
|
||||
# Locate crt0.o
|
||||
CRT0_OBJ := lib/asm/crt0.o
|
||||
|
||||
$(NEF): $(LCF) $(RESPONSE) $(ALL_OBJS)
|
||||
cd $(BUILD_DIR) && LM_LICENSE_FILE=$(BACK_REL)/$(LM_LICENSE_FILE) $(WINE) $(MWLD) $(MWLDFLAGS) $(LIBS) -o $(BACK_REL)/$(NEF) $(LCF:$(BUILD_DIR)/%=%) @$(RESPONSE:$(BUILD_DIR)/%=%) $(CRT0_OBJ)
|
||||
|
||||
.INTERMEDIATE: $(BUILD_DIR)/obj.list
|
||||
|
||||
|
11
include/field_map_object.h
Normal file
11
include/field_map_object.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef POKEHEARTGOLD_FIELD_MAP_OBJECT_H
|
||||
#define POKEHEARTGOLD_FIELD_MAP_OBJECT_H
|
||||
|
||||
typedef struct LocalMapObject LocalMapObject;
|
||||
|
||||
LocalMapObject *GetMapObjectByID(LocalMapObject *arr, int id);
|
||||
void sub_0205FC94(LocalMapObject *mapObject, int movement);
|
||||
void MapObject_SetGfxID(LocalMapObject *mapObject, u32 spriteId);
|
||||
void sub_0205F6AC(LocalMapObject *mapObject, int a1);
|
||||
|
||||
#endif //POKEHEARTGOLD_FIELD_MAP_OBJECT_H
|
@ -5,6 +5,6 @@ typedef struct FIELD_PLAYER_AVATAR FIELD_PLAYER_AVATAR;
|
||||
|
||||
int GetPlayerXCoord(FIELD_PLAYER_AVATAR *avatar);
|
||||
int GetPlayerYCoord(FIELD_PLAYER_AVATAR *avatar);
|
||||
|
||||
u32 sub_0205C700(FIELD_PLAYER_AVATAR *avatar);
|
||||
|
||||
#endif //POKEHEARTGOLD_FIELD_PLAYER_AVATAR_H
|
||||
|
9
include/map_object_manager.h
Normal file
9
include/map_object_manager.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef POKEHEARTGOLD_MAP_OBJECT_MANAGER_H
|
||||
#define POKEHEARTGOLD_MAP_OBJECT_MANAGER_H
|
||||
|
||||
typedef struct MapObjectMan MapObjectMan;
|
||||
typedef struct FieldSystem FieldSystem; // script.h
|
||||
|
||||
FieldSystem *MapObjectMan_GetFieldSysPtr(MapObjectMan *mapObjectMan);
|
||||
|
||||
#endif //POKEHEARTGOLD_MAP_OBJECT_MANAGER_H
|
22
include/save_follow_poke.h
Normal file
22
include/save_follow_poke.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef POKEHEARTGOLD_SAVE_FOLLOW_POKE_H
|
||||
#define POKEHEARTGOLD_SAVE_FOLLOW_POKE_H
|
||||
|
||||
#include "save.h"
|
||||
|
||||
struct SaveFollowPoke {
|
||||
int mapno;
|
||||
int unk_4_0:2;
|
||||
int unk_4_2:1;
|
||||
};
|
||||
|
||||
u32 Sav2_FollowPoke_sizeof(void);
|
||||
void Sav2_FollowPoke_init(struct SaveFollowPoke *followPoke);
|
||||
struct SaveFollowPoke *Sav2_FollowPoke_get(SAVEDATA *saveData);
|
||||
int SavFollowPoke_GetMapId(struct SaveFollowPoke *followPoke);
|
||||
void SavFollowPoke_SetMapId(int mapno, struct SaveFollowPoke *followPoke);
|
||||
u8 SavFollowPoke_GetUnused2bitField(struct SaveFollowPoke *followPoke); // deadstripped
|
||||
void SavFollowPoke_SetUnused2bitField(u8 unk, struct SaveFollowPoke *followPoke);
|
||||
void SavFollowPoke_SetInhibitFlagState(struct SaveFollowPoke *followPoke, u8 state);
|
||||
u8 SavFollowPoke_GetInhibitFlagState(struct SaveFollowPoke *followPoke);
|
||||
|
||||
#endif //POKEHEARTGOLD_SAVE_FOLLOW_POKE_H
|
@ -167,6 +167,13 @@ typedef struct FollowMon {
|
||||
u32 unk1C;
|
||||
} FollowMon;
|
||||
|
||||
struct FieldSystemUnk108 {
|
||||
u32 unk0;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
u32 unk8;
|
||||
};
|
||||
|
||||
struct FieldSystem {
|
||||
u8 unk0[0x8];
|
||||
void* bg_config;
|
||||
@ -187,7 +194,7 @@ struct FieldSystem {
|
||||
u8 unkBC[0x28];
|
||||
FollowMon unkE4;
|
||||
u8 unk104[4];
|
||||
void *unk108;
|
||||
struct FieldSystemUnk108 *unk108;
|
||||
u8 filler_10C[8];
|
||||
struct UnkFsysSub_114* unk114;
|
||||
BUGCONTEST* bugContest;
|
||||
|
144
src/field_follow_poke.c
Normal file
144
src/field_follow_poke.c
Normal file
@ -0,0 +1,144 @@
|
||||
#include "script.h"
|
||||
#include "map_object_manager.h"
|
||||
#include "save_follow_poke.h"
|
||||
#include "script_pokemon_util.h"
|
||||
#include "field_map_object.h"
|
||||
#include "constants/scrcmd.h"
|
||||
|
||||
BOOL sub_02069E14(LocalMapObject *mapObject);
|
||||
BOOL sub_02069FF4(int species, u32 mapno);
|
||||
void sub_0206A040(LocalMapObject *mapObject, int a1);
|
||||
void sub_0206A06C(FollowMon *followMon);
|
||||
void sub_0206A054(FieldSystem *fsys);
|
||||
LocalMapObject *CreateFollowingSpriteFieldObject(MapObjectMan *mapObjectMan, int species, u16 forme, int gender, int direction, int x, int y, int shiny);
|
||||
void FollowPokeFsysParamSet(FieldSystem *fsys, int species, u8 forme, BOOL shiny, u8 gender);
|
||||
void FollowPokeMapObjectSetParams(LocalMapObject *mapObject, int species, u8 forme, BOOL shiny);
|
||||
void sub_0206A288(struct FieldSystemUnk108 *a0, POKEMON *pokemon, u16 species, u32 personality);
|
||||
LocalMapObject *FollowingPokemon_GetMapObject(FieldSystem *fsys);
|
||||
u32 FollowingPokemon_GetSpriteID(u32 species, u16 forme, u32 gender);
|
||||
|
||||
LocalMapObject *sub_020699F8(MapObjectMan *mapObjectMan, int x, int y, int direction, u32 mapno) {
|
||||
FieldSystem *fsys;
|
||||
PARTY *party;
|
||||
int partyCount;
|
||||
POKEMON *pokemon;
|
||||
int species;
|
||||
int forme;
|
||||
int gender;
|
||||
int shiny;
|
||||
int player_unk;
|
||||
LocalMapObject *followPokeObj;
|
||||
|
||||
fsys = MapObjectMan_GetFieldSysPtr(mapObjectMan);
|
||||
party = SavArray_PlayerParty_get(fsys->savedata);
|
||||
partyCount = GetPartyCount(party);
|
||||
sub_0206A06C(&fsys->unkE4);
|
||||
SavFollowPoke_SetUnused2bitField(0, Sav2_FollowPoke_get(fsys->savedata));
|
||||
if (partyCount != 0) {
|
||||
if (CountAlivePokemon(party) == 0) {
|
||||
pokemon = GetFirstNonEggInParty(party);
|
||||
} else {
|
||||
pokemon = GetFirstAliveMonInParty_CrashIfNone(party);
|
||||
}
|
||||
species = GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
fsys->unkE4.mapObject = NULL;
|
||||
if (sub_02069FF4(species, mapno)) {
|
||||
forme = GetMonData(pokemon, MON_DATA_FORME, NULL);
|
||||
gender = GetMonData(pokemon, MON_DATA_GENDER, NULL);
|
||||
shiny = MonIsShiny(pokemon);
|
||||
fsys->unkE4.mapObject = CreateFollowingSpriteFieldObject(mapObjectMan, species, forme, gender, direction, x, y, shiny);
|
||||
fsys->unkE4.active = TRUE;
|
||||
FollowPokeFsysParamSet(fsys, species, forme, shiny, gender);
|
||||
sub_0206A288(fsys->unk108, pokemon, species, GetMonData(pokemon, MON_DATA_PERSONALITY, NULL));
|
||||
player_unk = sub_0205C700(fsys->playerAvatar);
|
||||
if (player_unk == 0 || player_unk == 3) {
|
||||
SavFollowPoke_SetUnused2bitField(1, Sav2_FollowPoke_get(fsys->savedata));
|
||||
} else if (player_unk == 1) {
|
||||
SavFollowPoke_SetUnused2bitField(2, Sav2_FollowPoke_get(fsys->savedata));
|
||||
sub_0206A054(fsys);
|
||||
sub_0205FC94(FollowingPokemon_GetMapObject(fsys), 56);
|
||||
} else if (player_unk == 2) {
|
||||
SavFollowPoke_SetUnused2bitField(2, Sav2_FollowPoke_get(fsys->savedata));
|
||||
sub_0206A054(fsys);
|
||||
sub_0205FC94(FollowingPokemon_GetMapObject(fsys), 56);
|
||||
} else {
|
||||
GF_ASSERT(0);
|
||||
}
|
||||
if (SavFollowPoke_GetInhibitFlagState(Sav2_FollowPoke_get(fsys->savedata))) {
|
||||
sub_0206A054(fsys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fsys->unkE4.mapObject;
|
||||
}
|
||||
|
||||
void sub_02069B74(MapObjectMan *mapObjectMan, u32 mapno) {
|
||||
FieldSystem *fsys;
|
||||
PARTY *party;
|
||||
int partyCount;
|
||||
POKEMON *pokemon;
|
||||
int species;
|
||||
int forme;
|
||||
u8 gender;
|
||||
int shiny;
|
||||
int player_unk;
|
||||
LocalMapObject *followPokeObj;
|
||||
|
||||
fsys = MapObjectMan_GetFieldSysPtr(mapObjectMan);
|
||||
party = SavArray_PlayerParty_get(fsys->savedata);
|
||||
partyCount = GetPartyCount(party);
|
||||
sub_0206A06C(&fsys->unkE4);
|
||||
if (partyCount != 0) {
|
||||
pokemon = GetFirstAliveMonInParty_CrashIfNone(party);
|
||||
species = GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
sub_0206A288(fsys->unk108, pokemon, species, GetMonData(pokemon, MON_DATA_PERSONALITY, NULL));
|
||||
if (sub_02069FF4(species, mapno)) {
|
||||
followPokeObj = GetMapObjectByID(fsys->unk3C, obj_partner_poke);
|
||||
if (followPokeObj == NULL) {
|
||||
fsys->unkE4.unk15 = 1;
|
||||
} else {
|
||||
forme = GetMonData(pokemon, MON_DATA_FORME, NULL);
|
||||
gender = GetMonGender(pokemon);
|
||||
shiny = MonIsShiny(pokemon);
|
||||
fsys->unkE4.mapObject = followPokeObj;
|
||||
fsys->unkE4.active = TRUE;
|
||||
FollowPokeFsysParamSet(fsys, species, forme, shiny, gender);
|
||||
FollowPokeMapObjectSetParams(followPokeObj, species, forme, shiny);
|
||||
MapObject_SetGfxID(fsys->unkE4.mapObject, FollowingPokemon_GetSpriteID(species, forme, gender));
|
||||
player_unk = sub_0205C700(fsys->playerAvatar);
|
||||
if (player_unk == 0 || player_unk == 3) {
|
||||
SavFollowPoke_SetUnused2bitField(1, Sav2_FollowPoke_get(fsys->savedata));
|
||||
} else if (player_unk == 1) {
|
||||
SavFollowPoke_SetUnused2bitField(2, Sav2_FollowPoke_get(fsys->savedata));
|
||||
sub_0206A040(fsys->unkE4.mapObject, 1);
|
||||
} else if (player_unk == 2) {
|
||||
SavFollowPoke_SetUnused2bitField(2, Sav2_FollowPoke_get(fsys->savedata));
|
||||
sub_0206A040(fsys->unkE4.mapObject, 1);
|
||||
} else {
|
||||
GF_ASSERT(0);
|
||||
}
|
||||
if (sub_02069E14(fsys->unkE4.mapObject)) {
|
||||
sub_0206A040(fsys->unkE4.mapObject, 1);
|
||||
}
|
||||
if (SavFollowPoke_GetInhibitFlagState(Sav2_FollowPoke_get(fsys->savedata))) {
|
||||
sub_0206A054(fsys);
|
||||
}
|
||||
sub_0205F6AC(fsys->unkE4.mapObject, 0);
|
||||
}
|
||||
} else {
|
||||
followPokeObj = GetMapObjectByID(fsys->unk3C, obj_partner_poke);
|
||||
if (followPokeObj != NULL) {
|
||||
forme = GetMonData(pokemon, MON_DATA_FORME, NULL);
|
||||
gender = GetMonGender(pokemon);
|
||||
shiny = MonIsShiny(pokemon);
|
||||
FollowPokeFsysParamSet(fsys, species, forme, shiny, gender);
|
||||
FollowPokeMapObjectSetParams(followPokeObj, species, forme, shiny);
|
||||
MapObject_SetGfxID(followPokeObj, FollowingPokemon_GetSpriteID(species, forme, gender));
|
||||
fsys->unkE4.mapObject = followPokeObj;
|
||||
fsys->unkE4.active = TRUE;
|
||||
fsys->unkE4.unk15 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,47 +7,47 @@ Static ichneumon_sub
|
||||
Autoload MAIN
|
||||
{
|
||||
Address 0x027E0000
|
||||
Object sub.ext.o
|
||||
Object asm/sub.ext.o
|
||||
}
|
||||
|
||||
Autoload WRAM
|
||||
{
|
||||
Address 0x037F8000
|
||||
Object sp_main.o
|
||||
Object sp_main_help.o
|
||||
Object OS_irqHandler.o
|
||||
Object OS_irqTable.o
|
||||
Object OS_interrupt.o
|
||||
Object OS_spinLock.o
|
||||
Object OS_thread.o
|
||||
Object OS_context.o
|
||||
Object OS_message.o
|
||||
Object OS_mutex.o
|
||||
Object OS_init.o
|
||||
Object OS_arena.o
|
||||
Object OS_alloc.o
|
||||
Object OS_timer.o
|
||||
Object OS_tick.o
|
||||
Object OS_alarm.o
|
||||
Object OS_valarm.o
|
||||
Object OS_system.o
|
||||
Object OS_reset.o
|
||||
Object OS_terminate_proc.o
|
||||
Object MI_dma.o
|
||||
Object MI_memory.o
|
||||
Object MI_swap.o
|
||||
Object PXI_fifo.o
|
||||
Object EXI_genPort.o
|
||||
Object PAD_xyButton.o
|
||||
Object sub.wram_1.o
|
||||
Object libsyscall.o
|
||||
Object sub.wram_2.o
|
||||
Object OS_reset.o (.wram)
|
||||
Object sub.wram_2.o (.wram)
|
||||
Object asm/sp_main.o
|
||||
Object asm/sp_main_help.o
|
||||
Object lib/src/OS_irqHandler.o
|
||||
Object lib/src/OS_irqTable.o
|
||||
Object lib/src/OS_interrupt.o
|
||||
Object lib/src/OS_spinLock.o
|
||||
Object lib/src/OS_thread.o
|
||||
Object lib/src/OS_context.o
|
||||
Object lib/src/OS_message.o
|
||||
Object lib/src/OS_mutex.o
|
||||
Object lib/src/OS_init.o
|
||||
Object lib/src/OS_arena.o
|
||||
Object lib/src/OS_alloc.o
|
||||
Object lib/src/OS_timer.o
|
||||
Object lib/src/OS_tick.o
|
||||
Object lib/src/OS_alarm.o
|
||||
Object lib/src/OS_valarm.o
|
||||
Object lib/src/OS_system.o
|
||||
Object lib/src/OS_reset.o
|
||||
Object lib/src/OS_terminate_proc.o
|
||||
Object lib/asm/MI_dma.o
|
||||
Object lib/asm/MI_memory.o
|
||||
Object lib/asm/MI_swap.o
|
||||
Object lib/src/PXI_fifo.o
|
||||
Object lib/src/EXI_genPort.o
|
||||
Object lib/src/PAD_xyButton.o
|
||||
Object asm/sub.wram_1.o
|
||||
Object asm/libsyscall.o
|
||||
Object asm/sub.wram_2.o
|
||||
Object lib/src/OS_reset.o (.wram)
|
||||
Object asm/sub.wram_2.o (.wram)
|
||||
}
|
||||
|
||||
Autoload EXT_WRAM
|
||||
{
|
||||
Address 0x06000000
|
||||
Object sub.ext_wram.o
|
||||
Object asm/sub.ext_wram.o
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user