Decomped SetPokemonJoined

Decomped by @Chesyon and @taxicat1
This commit is contained in:
AnonymousRandomPerson 2026-03-19 23:37:46 -04:00
parent a45e16027e
commit 279364f654
14 changed files with 1640 additions and 1581 deletions

View File

@ -1,25 +1,9 @@
#pragma once
.public _0209E3A1
.public _0209E3A2
.public _0209E3A3
.public _0209E6BD
.public _020A192C
.public _022AB4F8
.public _022AB5AC
.public _022AB69C
.public _022AB924
.public ADVENTURE_LOG_ENCOUNTERS_MONSTER_IDS
.public ADVENTURE_LOG_PTR
.public ARM9_UNKNOWN_DATA__NA_209E6BC
.public Copy16BitsFrom
.public Copy16BitsTo
.public CopyNStringFromId
.public DUNGEON_DATA_LIST
.public DungeonSwapIdToIdx
.public DungeonSwapIdxToId
.public GetBaseFormCastformCherrimDeoxys
.public GetBodySize
.public GetDexNumberVeneer
.public GetDungeonMode
.public GetDungeonModeSpecial
.public GetGameMode
@ -30,29 +14,30 @@
.public GetNameString
.public GetNbItemsInBag
.public GetPartyMembers
.public GetRankUpEntry
.public GetPlayTimeSeconds
.public GetResolvedPerformanceProgressFlag
.public GetStringFromFileVeneer
.public GuestMonsterToGroundMonster
.public IsItemValidVeneer
.public IsLevelResetDungeon
.public IsMoneyAllowed
.public IsRealMove
.public IsRecruitingAllowed
.public LoadScriptVariableValue
.public MemZero
.public MISSION_FLOOR_RANKS_PTRS
.public NormalizeTreasureBox
.public OUTLAW_LEVEL_TABLE
.public OUTLAW_MINION_LEVEL_TABLE
.public PENDING_DUNGEON_ID
.public PLAY_TIME_SECONDS
.public PlayTimerTick
.public ResetPlayTimer
.public SECONDARY_TERRAIN_TYPES
.public SetResolvedPerformanceProgressFlag
.public StrncpyName
.public StrncpySimpleNoPad
.public StrncpySimpleNoPadSafe
.public sub_0204CEE0
.public sub_0205EE40
.public TEAM_MEMBER_TABLE_PTR
.public TEAM_NAME
.public _0209E3A1
.public _0209E3A2
.public _0209E3A3
.public _022AB4F8
.public _022AB5AC
.public _022AB69C
.public sub_0204CEE0
.public sub_02050E5C
.public sub_02050E8C
.public sub_0205EE40

View File

@ -0,0 +1,27 @@
#pragma once
.public ADVENTURE_LOG_ENCOUNTERS_MONSTER_IDS
.public ADVENTURE_LOG_PTR
.public ARM9_UNKNOWN_DATA__NA_209E6BC
.public Copy16BitsFrom
.public Copy16BitsTo
.public CopyNStringFromId
.public GetAdventureLogCompleted
.public GetBaseFormCastformCherrimDeoxys
.public GetDexNumberVeneer
.public GetRankUpEntry
.public GetResolvedPerformanceProgressFlag
.public GetStringFromFileVeneer
.public IsItemValidVeneer
.public IsRealMove
.public MemZero
.public NormalizeTreasureBox
.public SetAdventureLogCompleted
.public SetResolvedPerformanceProgressFlag
.public StrncpyName
.public StrncpySimpleNoPad
.public StrncpySimpleNoPadSafe
.public TEAM_MEMBER_TABLE_PTR
.public TEAM_NAME
.public _0209E6BD
.public _020A192C
.public _022AB924

View File

@ -3,6 +3,7 @@
.text
; https://decomp.me/scratch/juWhM
arm_func_start IsItemInTimeDarkness
IsItemInTimeDarkness: ; 0x0200EB30
ldr r1, _0200EB54 ; =ITEM_DATA_TABLE_PTRS

File diff suppressed because it is too large Load Diff

1529
asm/main_0204FE58.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
.text
; https://decomp.me/scratch/LRAYo
arm_func_start sub_0205A4B4
sub_0205A4B4: ; 0x0205A4B4
stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr}

View File

@ -37,6 +37,7 @@ _0205B118:
ldmia sp!, {r3, pc}
arm_func_end sub_0205B0B8
; https://decomp.me/scratch/gWhya
arm_func_start sub_0205B120
sub_0205B120: ; 0x0205B120
stmdb sp!, {r4, r5, r6, r7, lr}

View File

@ -104,6 +104,7 @@ _0233CBC4: .word 0x000004FD
#endif
arm_func_end ov09_0233CA80
; https://decomp.me/scratch/Uyfr0
arm_func_start ov09_0233CBC8
ov09_0233CBC8: ; 0x0233CBC8
stmdb sp!, {r3, lr}

View File

@ -1093,6 +1093,7 @@ _023038D0: .word 0x00000F25
#endif
arm_func_end ov29_023034E0
; https://decomp.me/scratch/wws4M
arm_func_start DungeonTmLearnMove
DungeonTmLearnMove: ; 0x023038D4
#ifdef JAPAN

32
include/adventure_log.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef PMDSKY_ADVENTURE_LOG_H
#define PMDSKY_ADVENTURE_LOG_H
#include "dungeon.h"
// The adventure log structure.
struct adventure_log {
u32 completion_flags[4]; // 0x0
u32 nb_dungeons_cleared; // 0x10
u32 nb_friend_rescues; // 0x14
u32 nb_evolutions; // 0x18
u32 nb_eggs_hatched; // 0x1C
u32 successful_steals; // 0x20: Unused in Sky
u32 nb_faints; // 0x24
u32 nb_victories_on_one_floor; // 0x28
u32 pokemon_joined_counter; // 0x2C
u32 pokemon_battled_counter; // 0x30
u32 moves_learned_counter; // 0x34
u32 nb_big_treasure_wins; // 0x38
u32 nb_recycled; // 0x3C
u32 nb_gifts_sent; // 0x40
u32 pokemon_joined_flags[37]; // 0x44
u32 pokemon_battled_flags[37]; // 0xD8
u32 moves_learned_flags[17]; // 0x16C
u32 items_acquired_flags[44]; // 0x1B0
u32 special_challenge_flags; // 0x260
u32 sentry_duty_game_points[5]; // 0x264
struct dungeon_floor_pair current_floor; // 0x278
u16 padding; // 0x27A
};
#endif //PMDSKY_ADVENTURE_LOG_H

View File

@ -1846,4 +1846,10 @@ struct dungeon_restriction {
s16 random_movement_chance;
};
// A common structure for pairs of dungeon/floor values
struct dungeon_floor_pair {
u8 dungeon_id;
u8 floor_id;
};
#endif // PMDSKY_DUNGEON_H

7
include/main_0204FDFC.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef PMDSKY_MAIN_0204FDFC_H
#define PMDSKY_MAIN_0204FDFC_H
// Marks one Pokémon as joined.
void SetPokemonJoined(u32 monster_id);
#endif //PMDSKY_MAIN_0204FDFC_H

View File

@ -90,6 +90,8 @@ Static main
Object asm/main_0204DE7C.o
Object src/dungeon_init.o
Object asm/main_0204EFE0.o
Object src/main_0204FDFC.o
Object asm/main_0204FE58.o
Object src/number_util.o
Object asm/main_02051098.o
Object src/dungeon_recruitment_2.o

19
src/main_0204FDFC.c Normal file
View File

@ -0,0 +1,19 @@
#include "main_0204FDFC.h"
#include "adventure_log.h"
extern struct adventure_log* ADVENTURE_LOG_PTR;
extern s32 GetDexNumberVeneer();
void SetPokemonJoined(u32 monster_id)
{
s32 dex_num = GetDexNumberVeneer(monster_id);
if (dex_num == 0) return;
ADVENTURE_LOG_PTR->completion_flags[0] |= 1;
u32 word = dex_num / 32; // dex_num / 32
u32 bit = dex_num % 32; // dex_num % 32
ADVENTURE_LOG_PTR->pokemon_joined_flags[word] |= (1 << bit);
}