mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-27 12:47:39 -05:00
Decomp five team-member accessors
Decompile GetHero, GetPartner, GetMainCharacter1, GetMainCharacter2 and GetMainCharacter3 from asm/main_02054E4C.s. Each returns a pointer to a struct ground_monster in TEAM_MEMBER_TABLE_PTR->members, or NULL when that entry's is_valid bit is clear: GetHero returns members[0], GetPartner members[1], and the GetMainCharacter functions pick the index from the game mode -- members[2]/[3]/[4] during a special episode, members[0]/[1]/NULL otherwise. They merge into a new src/main_02055770.c; extracting them splits asm/main_02054E4C.s, the trailing functions move verbatim into asm/main_02055894.s, and main.lsf gains the two objects. Their prototypes were temporarily declared in main_02064FFC.h for the previous commits; they move to the new main_02055770.h, which main_02064FFC.h now includes. sub_02056914 keeps its prototype there since it is still asm. No new names are introduced. struct ground_monster and struct team_member_table already exist in common.h, and these six function names were already labelled in the tree; this commit only fills in bodies. Decompiling these confirms by construction what the previous commits declared: the accessors return struct ground_monster*, so the ->id reads that feed the monster-id output of sub_0206549C are reading struct ground_monster::id, the documented "Monster ID" field. No comments are added to any pmd-sky file. Authored by Claude (Opus 4.8) under human direction. Confirmed by a matching build: build/pmdsky.us/pmdsky.us.nds: OK. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,70 +1,10 @@
|
||||
#pragma once
|
||||
.public GetGameMode
|
||||
.public MemZero
|
||||
.public SprintfStatic__02054A60
|
||||
.public StrncpySimpleNoPadSafe
|
||||
.public TEAM_MEMBER_TABLE_PTR
|
||||
.public _020A333C
|
||||
.public _020A3340
|
||||
.public _020A3350
|
||||
.public _020A336C
|
||||
.public _020A3398
|
||||
.public _020A33B8
|
||||
.public _020A33D4
|
||||
.public _020A340C
|
||||
.public _020A343C
|
||||
.public _020A344C
|
||||
.public _020A3450
|
||||
.public _020A3468
|
||||
.public _020AFC28
|
||||
.public _020B0A4C
|
||||
.public _022B5788
|
||||
.public _022B578C
|
||||
.public AddMoneyCarried
|
||||
.public AddSimpleObjToOam
|
||||
.public CleanStickyItemsInBag
|
||||
.public CopyAndInterleaveWrapper
|
||||
.public CopyTacticString
|
||||
.public Debug_Print0
|
||||
.public DirectoryFileMngr_OpenDirectoryFile
|
||||
.public EnableAllLearnableIqSkills
|
||||
.public FillPaletteInitInfo
|
||||
.public GetBaseDefensiveStat
|
||||
.public GetBaseFormCastformCherrimDeoxys
|
||||
.public GetBaseHp
|
||||
.public GetBaseOffensiveStat
|
||||
.public GetBodySize
|
||||
.public GetGameMode
|
||||
.public GetItemAtIdx
|
||||
.public GetItemMoveId16
|
||||
.public GetMaxMembersAllowed
|
||||
.public GetMaxPp
|
||||
.public GetMoneyQuantity
|
||||
.public GetMonsterGender
|
||||
.public GetNameRaw
|
||||
.public GetShadowSize
|
||||
.public GroundToDungeonMoveset
|
||||
.public HandleSir0Translation
|
||||
.public IsLevelResetDungeon
|
||||
.public IsSkyExclusiveDungeon
|
||||
.public ItemZInit
|
||||
.public LoadObjPalette
|
||||
.public MemZero
|
||||
.public OBJ_GRAPHICS_CONTROLS_PTR
|
||||
.public RemoveHolderForItemInBag
|
||||
.public RemovePokeItemsInBag
|
||||
.public SetHolderForItemInBag
|
||||
.public SetPokemonJoined
|
||||
.public ShuffleHiddenPower
|
||||
.public SprintfStatic__02054A60
|
||||
.public StrcmpMonsterName
|
||||
.public StrncpyName
|
||||
.public StrncpySimple
|
||||
.public StrncpySimpleNoPadSafe
|
||||
.public sub_0200FA0C
|
||||
.public sub_0204E584
|
||||
.public sub_02052CF4
|
||||
.public sub_02052E2C
|
||||
.public sub_020530D4
|
||||
.public sub_02053174
|
||||
.public sub_0205349C
|
||||
.public sub_020534BC
|
||||
.public sub_02053D1C
|
||||
.public sub_02053F10
|
||||
.public TEAM_MEMBER_TABLE_PTR
|
||||
.public UnloadFile
|
||||
|
||||
77
asm/include/main_02055894.inc
Normal file
77
asm/include/main_02055894.inc
Normal file
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
.public AddMoneyCarried
|
||||
.public AddSimpleObjToOam
|
||||
.public CleanStickyItemsInBag
|
||||
.public CopyAndInterleaveWrapper
|
||||
.public CopyTacticString
|
||||
.public Debug_Print0
|
||||
.public DirectoryFileMngr_OpenDirectoryFile
|
||||
.public EnableAllLearnableIqSkills
|
||||
.public FillPaletteInitInfo
|
||||
.public GetBaseDefensiveStat
|
||||
.public GetBaseFormCastformCherrimDeoxys
|
||||
.public GetBaseHp
|
||||
.public GetBaseOffensiveStat
|
||||
.public GetBodySize
|
||||
.public GetGameMode
|
||||
.public GetHeroMemberIdx
|
||||
.public GetItemAtIdx
|
||||
.public GetItemMoveId16
|
||||
.public GetMainCharacter1MemberIdx
|
||||
.public GetMainCharacter2MemberIdx
|
||||
.public GetMainCharacter3MemberIdx
|
||||
.public GetMaxMembersAllowed
|
||||
.public GetMaxPp
|
||||
.public GetMoneyQuantity
|
||||
.public GetNameRaw
|
||||
.public GetPartnerMemberIdx
|
||||
.public GetShadowSize
|
||||
.public GetTeamMember
|
||||
.public GroundToDungeonMoveset
|
||||
.public HandleSir0Translation
|
||||
.public IsLevelResetDungeon
|
||||
.public IsMainCharacter
|
||||
.public IsSkyExclusiveDungeon
|
||||
.public IsValidTeamMember
|
||||
.public ItemZInit
|
||||
.public LoadObjPalette
|
||||
.public OBJ_GRAPHICS_CONTROLS_PTR
|
||||
.public RecolorNameString
|
||||
.public RecolorTeamMemberNameString
|
||||
.public RemoveHolderForItemInBag
|
||||
.public RemovePokeItemsInBag
|
||||
.public SetHolderForItemInBag
|
||||
.public SetPokemonJoined
|
||||
.public ShuffleHiddenPower
|
||||
.public StrcmpMonsterName
|
||||
.public StrncpyName
|
||||
.public StrncpySimple
|
||||
.public StrncpySimpleNoPadSafe
|
||||
.public TEAM_MEMBER_TABLE_PTR
|
||||
.public UnloadFile
|
||||
.public _020A3350
|
||||
.public _020A336C
|
||||
.public _020A3398
|
||||
.public _020A33B8
|
||||
.public _020A33D4
|
||||
.public _020A340C
|
||||
.public _020A343C
|
||||
.public _020A344C
|
||||
.public _020A3450
|
||||
.public _020A3468
|
||||
.public _020AFC28
|
||||
.public _022B5788
|
||||
.public _022B578C
|
||||
.public sub_0200FA0C
|
||||
.public sub_0204E584
|
||||
.public sub_02052CF4
|
||||
.public sub_02052E2C
|
||||
.public sub_020530D4
|
||||
.public sub_02053174
|
||||
.public sub_0205349C
|
||||
.public sub_020534BC
|
||||
.public sub_02053D1C
|
||||
.public sub_02053F10
|
||||
.public sub_02055410
|
||||
.public sub_02055474
|
||||
.public sub_020554D8
|
||||
4128
asm/main_02054E4C.s
4128
asm/main_02054E4C.s
File diff suppressed because it is too large
Load Diff
4034
asm/main_02055894.s
Normal file
4034
asm/main_02055894.s
Normal file
File diff suppressed because it is too large
Load Diff
12
include/main_02055770.h
Normal file
12
include/main_02055770.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef PMDSKY_MAIN_02055770_H
|
||||
#define PMDSKY_MAIN_02055770_H
|
||||
|
||||
struct ground_monster;
|
||||
|
||||
struct ground_monster* GetHero(void);
|
||||
struct ground_monster* GetPartner(void);
|
||||
struct ground_monster* GetMainCharacter1(void);
|
||||
struct ground_monster* GetMainCharacter2(void);
|
||||
struct ground_monster* GetMainCharacter3(void);
|
||||
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
#define PMDSKY_MAIN_02064FFC_H
|
||||
|
||||
#include "common.h"
|
||||
#include "main_02055770.h"
|
||||
|
||||
struct unk_02064F94 {
|
||||
u8 field_0x0[8];
|
||||
@@ -39,11 +40,6 @@ int GetAdventureNpcIds(void* buf);
|
||||
int sub_02055410(int a);
|
||||
int sub_02055474(int a);
|
||||
int sub_020554D8(int a);
|
||||
struct ground_monster* GetMainCharacter1(void);
|
||||
struct ground_monster* GetMainCharacter2(void);
|
||||
struct ground_monster* GetMainCharacter3(void);
|
||||
struct ground_monster* GetHero(void);
|
||||
struct ground_monster* GetPartner(void);
|
||||
struct ground_monster* sub_02056914(void);
|
||||
|
||||
void sub_02064F94(struct unk_02064F94* a, u32* data, int count);
|
||||
|
||||
2
main.lsf
2
main.lsf
@@ -152,6 +152,8 @@ Static main
|
||||
Object src/main_02054C24.o
|
||||
Object src/main_02054DC4.o
|
||||
Object asm/main_02054E4C.o
|
||||
Object src/main_02055770.o
|
||||
Object asm/main_02055894.o
|
||||
Object src/main_02058C3C.o
|
||||
Object asm/main_02058C4C.o
|
||||
Object src/main_02058CD8.o
|
||||
|
||||
44
src/main_02055770.c
Normal file
44
src/main_02055770.c
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "main_02055770.h"
|
||||
#include "common.h"
|
||||
#include "game_mode.h"
|
||||
|
||||
extern struct team_member_table *TEAM_MEMBER_TABLE_PTR;
|
||||
|
||||
struct ground_monster* GetHero(void)
|
||||
{
|
||||
struct ground_monster *m = TEAM_MEMBER_TABLE_PTR->members;
|
||||
bool8 valid = (m->is_valid & 1) != 0;
|
||||
return valid ? m : NULL;
|
||||
}
|
||||
|
||||
struct ground_monster* GetPartner(void)
|
||||
{
|
||||
bool8 valid = (TEAM_MEMBER_TABLE_PTR->members[1].is_valid & 1) != 0;
|
||||
return valid ? &TEAM_MEMBER_TABLE_PTR->members[1] : NULL;
|
||||
}
|
||||
|
||||
struct ground_monster* GetMainCharacter1(void)
|
||||
{
|
||||
s16 idx = (GetGameMode() == GAME_MODE_SPECIAL_EPISODE) ? 2 : 0;
|
||||
struct ground_monster *base = TEAM_MEMBER_TABLE_PTR->members;
|
||||
bool8 valid = (base[idx].is_valid & 1) != 0;
|
||||
return valid ? base + idx : NULL;
|
||||
}
|
||||
|
||||
struct ground_monster* GetMainCharacter2(void)
|
||||
{
|
||||
s16 idx = (GetGameMode() == GAME_MODE_SPECIAL_EPISODE) ? 3 : 1;
|
||||
struct ground_monster *base = TEAM_MEMBER_TABLE_PTR->members;
|
||||
bool8 valid = (base[idx].is_valid & 1) != 0;
|
||||
return valid ? base + idx : NULL;
|
||||
}
|
||||
|
||||
struct ground_monster* GetMainCharacter3(void)
|
||||
{
|
||||
bool8 valid;
|
||||
if (GetGameMode() != GAME_MODE_SPECIAL_EPISODE) {
|
||||
return NULL;
|
||||
}
|
||||
valid = (TEAM_MEMBER_TABLE_PTR->members[4].is_valid & 1) != 0;
|
||||
return valid ? &TEAM_MEMBER_TABLE_PTR->members[4] : NULL;
|
||||
}
|
||||
Reference in New Issue
Block a user