Skip to content

Commit 62ba536

Browse files
Party member-related functions
1 parent 5e48818 commit 62ba536

File tree

9 files changed

+527
-19
lines changed

9 files changed

+527
-19
lines changed

config/slus_006.64.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ segments:
8686
- [0xA164, asm]
8787
- [0xA16C, c, main/main_loop]
8888
- [0xA9E4, c, system/kernel_menu]
89-
- [0xADCC, asm]
89+
- [0xADCC, c, system/temp3]
9090
- [0xD0DC, c, system/work_list]
9191
- [0xDCE8, c, system/rendering]
9292
- [0x103A4, c, system/animation_scripts]
9393
- [0x1320C, c, system/graphics]
9494
- [0x1332C, c, system/temp1] # Graphics stuff
9595
- [0x18A30, c, system/libarchive]
9696
- [0x19E90, c, system/archive]
97-
- [0x1B424, asm]
97+
- [0x1B424, c, system/temp2]
9898
- [0x22094, c, system/memory]
9999
- [0x235CC, c, system/heap_debug]
100100
- [0x23688, hasm, util/lzss]

config/symbol_addrs.slus_006.64.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ KernelMenuUpdate = 0x8001A344;
1717
KernelMenuMain = 0x8001A4B4;
1818

1919
//
20+
GamePartySignalReinitialize = 0x8001AC94;
2021
GameCharacterGetGearID = 0x8001ACF0;
22+
GameWaitForCdData = 0x8001AD1C;
23+
GamePartyCharactersInitializeSkins = 0x8001AD4C;
24+
GamePartyGearsInitializeSkins = 0x8001AEB8;
25+
GamePartySyncSkinData = 0x8001B044;
26+
GamePartyStreamLoadSkinData = 0x8001B158;
27+
GamePartySyncStreamedData = 0x8001B3A8;
2128

2229
// Work List
2330
WorkListsFreeAllEntries = 0x8001C8DC;
@@ -852,6 +859,14 @@ g_C2ButtonStatesPressedOnce = 0x8005A19C;
852859
g_GameState = 0x8005A39C;
853860
g_GamePartyMembers = 0x80062590; // size:0xC
854861

862+
g_PartyIsWaitingForStreamData = 0x8004F374;
863+
g_PartyDataBuffers = 0x8005A414;
864+
g_PartyStreamDataQueue = 0x800625A4; // type:StreamDataQueueEntry[] size:0x20
865+
g_PartyStreamDataPointers = 0x80065AFC;
866+
867+
g_GamePartyMemberSkins = 0x8006FABC; // size:0xC
868+
g_GamePartySkinsInitialized = 0x8004F30C;
869+
855870
g_C1Buffer = 0x800625FC;
856871
g_C2Buffer = 0x8006261E;
857872

include/main/game.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#define MAX_GAME_CHARACTERS 11
55
#define MAX_GAME_GEARS 20
66
#define MAX_PARTY_MEMBERS 3
7+
#define CHARACTER_ID_NONE 0xFF
78

89
typedef struct {
910
/* 0x0 */ u8 field_0x0[0x4C];
@@ -22,7 +23,9 @@ typedef struct {
2223
/* 0x5F */ u8 evadePercentage;
2324
/* 0x60 */ u16 field_0x60;
2425
/* 0x61 */ u8 level;
25-
/* 0x62 */ u8 field_0x62[0x3f];
26+
/* 0x62 */ u8 field_0x62[0x3d];
27+
/* 0xA0 */ u8 gearId;
28+
/* 0xA1 */ u8 field_0xA1[0x3]
2629
} GameCharacter; // size: 0xA4
2730

2831
typedef struct {
@@ -42,7 +45,8 @@ typedef struct {
4245
/* 0x0 */ u8 field_0x0[0x26C];
4346
/* 0x26C */ GameCharacter characters[MAX_GAME_CHARACTERS];
4447
/* 0x978 */ GameGear gears[MAX_GAME_GEARS];
45-
/* 0x1648 */ u8 field_0x1648[0x4];
48+
/* 0x1648 */ u8 field_0x1648[0x6EC];
49+
/* 0x1D34 */ u8 partyMembers[MAX_PARTY_MEMBERS];
4650
} GameState; // size: unknown
4751

4852
extern GameState* g_GameState;

include/system/archive.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ typedef struct {
4242
u_short unk2;
4343
} ArchiveStreamFileSectionHeader;
4444

45+
typedef struct {
46+
/* 0x0 */ short archiveIndex;
47+
/* 0x2 */ u16 _pad;
48+
/* 0x4 */ void* pData;
49+
} StreamDataQueueEntry;
50+
4551
extern ArchiveStreamFileSectionHeader* D_8004FE2C;
4652
extern int D_8004FE40;
4753

src/field/main/misc.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ int FieldPartyMemberIncreaseGearHp(int partyMemberIndex, unsigned int amount) {
416416
unsigned int newHp;
417417

418418
gearId = GameCharacterGetGearID(g_GamePartyMembers[partyMemberIndex]);
419-
if (gearId != 0xFF) {
419+
if (gearId != CHARACTER_ID_NONE) {
420420
maxHp = g_GameState->gears[gearId].maxHp;
421421
newHp = g_GameState->gears[gearId].hp + amount;
422422
g_GameState->gears[gearId].hp = newHp;
@@ -431,7 +431,7 @@ int FieldPartyMemberDecreaseGearHp(int partyMemberIndex, unsigned int amount) {
431431
int newHp;
432432

433433
gearId = GameCharacterGetGearID(g_GamePartyMembers[partyMemberIndex]);
434-
if (gearId != 0xFF) {
434+
if (gearId != CHARACTER_ID_NONE) {
435435
newHp = g_GameState->gears[gearId].hp - amount;
436436
if (newHp <= 0) {
437437
newHp = 1;
@@ -451,7 +451,7 @@ void FieldScriptVMHandlerIncreasePartyGearHp(void) {
451451
mask = g_FieldNumPartyMembersMasks[SCRIPT_READ_U8_REL(3) & 0x3];
452452

453453
for (i = 0; i < MAX_PARTY_MEMBERS; i++) {
454-
if ((g_GamePartyMembers[i] != 0xFF) && (mask & 1)) {
454+
if ((g_GamePartyMembers[i] != CHARACTER_ID_NONE) && (mask & 1)) {
455455
FieldPartyMemberIncreaseGearHp(i, amount);
456456
}
457457
mask >>= 1;
@@ -468,7 +468,7 @@ void FieldScriptVMHandlerDecreasePartyGearHp(void) {
468468
mask = g_FieldNumPartyMembersMasks[SCRIPT_READ_U8_REL(3) & 0x3];
469469

470470
for (i = 0; i < MAX_PARTY_MEMBERS; i++) {
471-
if ((g_GamePartyMembers[i] != 0xFF) && (mask & 1)) {
471+
if ((g_GamePartyMembers[i] != CHARACTER_ID_NONE) && (mask & 1)) {
472472
FieldPartyMemberDecreaseGearHp(i, amount);
473473
}
474474
mask >>= 1;
@@ -1351,7 +1351,7 @@ void FieldScriptVMHandlerDecreasePartyHp(void) {
13511351
mask = g_FieldNumPartyMembersMasks[SCRIPT_READ_U8_REL(3) & 0x3];
13521352

13531353
for (i = 0; i < MAX_PARTY_MEMBERS; i++) {
1354-
if ((g_GamePartyMembers[i] != 0xFF) && (mask & 1)) {
1354+
if ((g_GamePartyMembers[i] != CHARACTER_ID_NONE) && (mask & 1)) {
13551355
FieldPartyMemberDecreaseHp(i, amount);
13561356
}
13571357
mask >>= 1;
@@ -1363,7 +1363,7 @@ void FieldScriptVMHandlerDecreasePartyHp(void) {
13631363
INCLUDE_ASM("asm/field/nonmatchings/main/misc", func_80096AF4);
13641364

13651365
void FieldScriptVMHandlerWritePartyMemberHp(void) {
1366-
if (g_GamePartyMembers[SCRIPT_READ_U8_REL(3)] != 0xFF) {
1366+
if (g_GamePartyMembers[SCRIPT_READ_U8_REL(3)] != CHARACTER_ID_NONE) {
13671367
FieldScriptMemoryWriteU16(
13681368
FieldScriptVMGetInstructionArgument(1) & 0xFFFF,
13691369
g_GameState->characters[g_GamePartyMembers[SCRIPT_READ_U8_REL(3)]].hp
@@ -1373,7 +1373,7 @@ void FieldScriptVMHandlerWritePartyMemberHp(void) {
13731373
}
13741374

13751375
void FieldScriptVMHandlerWritePartyMemberMp(void) {
1376-
if (g_GamePartyMembers[SCRIPT_READ_U8_REL(3)] != 0xFF) {
1376+
if (g_GamePartyMembers[SCRIPT_READ_U8_REL(3)] != CHARACTER_ID_NONE) {
13771377
FieldScriptMemoryWriteU16(
13781378
FieldScriptVMGetInstructionArgument(1) & 0xFFFF,
13791379
g_GameState->characters[g_GamePartyMembers[SCRIPT_READ_U8_REL(3)]].mp
@@ -1423,7 +1423,7 @@ void FieldScriptVMHandlerIncreasePartyMp(void) {
14231423
mask = g_FieldNumPartyMembersMasks[SCRIPT_READ_U8_REL(3) & 0x3];
14241424

14251425
for (i = 0; i < MAX_PARTY_MEMBERS; i++) {
1426-
if ((g_GamePartyMembers[i] != 0xFF) && (mask & 1)) {
1426+
if ((g_GamePartyMembers[i] != CHARACTER_ID_NONE) && (mask & 1)) {
14271427
FieldPartyMemberIncreaseMp(i, amount);
14281428
}
14291429
mask >>= 1;
@@ -1440,7 +1440,7 @@ void FieldScriptVMHandlerDecreasePartyMp(void) {
14401440
mask = g_FieldNumPartyMembersMasks[SCRIPT_READ_U8_REL(3) & 0x3];
14411441

14421442
for (i = 0; i < MAX_PARTY_MEMBERS; i++) {
1443-
if ((g_GamePartyMembers[i] != 0xFF) && (mask & 1)) {
1443+
if ((g_GamePartyMembers[i] != CHARACTER_ID_NONE) && (mask & 1)) {
14441444
FieldPartyMemberDecreaseMp(i, amount);
14451445
}
14461446
mask >>= 1;

src/field/main/misc6.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,12 @@ INCLUDE_ASM("asm/field/nonmatchings/main/misc6", func_8009F5F4);
533533
int FieldCharacterIdToPartyId(int characterId) {
534534
int i;
535535

536-
if (characterId == 0xFF) {
536+
if (characterId == CHARACTER_ID_NONE) {
537537
return -1;
538538
}
539539

540540
for (i = 0; i < 3; i++) {
541-
if (g_GamePartyMembers[i] == 0xFF)
541+
if (g_GamePartyMembers[i] == CHARACTER_ID_NONE)
542542
return -1;
543543

544544
if (g_GamePartyMembers[i] == characterId) {
@@ -558,8 +558,8 @@ Matches, but the struct D_800B2268 is part of needs recovery first.
558558
void func_8009FB98(void) {
559559
D_8004F34C |= 0xC000;
560560
func_8001AD1C();
561-
func_8001B044();
562-
func_8001B3A8();
561+
GamePartySyncSkinData();
562+
GamePartySyncStreamedData();
563563
D_800B2268[0] = SCRIPT_READ_U8_REL(1);
564564
g_FieldScriptVMCurActor->scriptInstructionPointer += 2;
565565
}

src/field/scripts/virtual_machine.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,15 @@ INCLUDE_ASM("asm/field/nonmatchings/scripts/virtual_machine", func_800A2488);
259259

260260
INCLUDE_ASM("asm/field/nonmatchings/scripts/virtual_machine", func_800A24C4);
261261

262-
extern s32 D_8004F30C;
262+
extern s32 g_GamePartySkinsInitialized;
263263
extern s32 D_800ADBFC;
264264
void func_800A2714(void) {
265265
ActorData* pActor;
266266
FieldActor* pFieldActors;
267267
int i;
268268
void* pData;
269269

270-
if (D_8004F30C) {
270+
if (g_GamePartySkinsInitialized) {
271271
// Read animation files
272272
for (i = 0; i < D_800ADBFC; i++) {
273273
ArchiveSetIndex(0x4, 0x0);

0 commit comments

Comments
 (0)