mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-26 22:40:33 +00:00
Match sub_80948E4
This commit is contained in:
parent
c6d89036bb
commit
15b4b39ff7
@ -5,8 +5,8 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8082280
|
||||
sub_8082280:
|
||||
thumb_func_start RestoreDungeonEntity
|
||||
RestoreDungeonEntity:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
@ -25,25 +25,25 @@ sub_8082280:
|
||||
movs r1, 0
|
||||
bl memset
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
str r0, [sp, 0x214]
|
||||
add r4, sp, 0x208
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl sub_80831F8
|
||||
bl ReadPosition8
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
str r0, [sp, 0x218]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083158
|
||||
bl ReadU16
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
str r0, [sp, 0x21C]
|
||||
@ -51,7 +51,7 @@ sub_8082280:
|
||||
movs r0, 0
|
||||
str r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083158
|
||||
bl ReadU16
|
||||
mov r1, sp
|
||||
strh r0, [r1]
|
||||
adds r0, r5, 0
|
||||
@ -63,89 +63,89 @@ sub_8082280:
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x2]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
mov r1, sp
|
||||
strb r0, [r1, 0x6]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
mov r1, sp
|
||||
strb r0, [r1, 0x7]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
mov r1, sp
|
||||
strb r0, [r1, 0x8]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
mov r1, sp
|
||||
strb r0, [r1, 0x9]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
mov r1, sp
|
||||
strb r0, [r1, 0xA]
|
||||
add r1, sp, 0x40
|
||||
adds r0, r5, 0
|
||||
bl sub_8082F64
|
||||
bl ReadJoinedAt
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0xC]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0xE]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x10]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x12]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
mov r1, sp
|
||||
strb r0, [r1, 0x14]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
mov r1, sp
|
||||
strb r0, [r1, 0x15]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
mov r1, sp
|
||||
strb r0, [r1, 0x16]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
mov r1, sp
|
||||
strb r0, [r1, 0x17]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831A0
|
||||
str r0, [sp, 0x18]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x1C]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x1E]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x20]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x22]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x24]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x26]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
mov r1, sp
|
||||
strh r0, [r1, 0x28]
|
||||
adds r0, r5, 0
|
||||
@ -162,7 +162,7 @@ sub_8082280:
|
||||
str r0, [sp, 0x38]
|
||||
add r1, sp, 0x44
|
||||
adds r0, r5, 0
|
||||
bl sub_8082CBC
|
||||
bl ReadActionContainer
|
||||
adds r0, r5, 0
|
||||
bl sub_8082BFC
|
||||
add r1, sp, 0x5C
|
||||
@ -269,20 +269,20 @@ sub_8082280:
|
||||
_080824DC:
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl sub_80831F8
|
||||
bl ReadPosition8
|
||||
adds r4, 0x4
|
||||
subs r6, 0x1
|
||||
cmp r6, 0
|
||||
bge _080824DC
|
||||
adds r0, r5, 0
|
||||
adds r1, r7, 0
|
||||
bl sub_8082CE4
|
||||
bl ReadAITarget
|
||||
adds r0, r5, 0
|
||||
mov r1, r8
|
||||
bl sub_8082D28
|
||||
bl Read3Bytes
|
||||
adds r0, r5, 0
|
||||
mov r1, r9
|
||||
bl sub_8082D28
|
||||
bl Read3Bytes
|
||||
adds r0, r5, 0
|
||||
bl sub_8082C84
|
||||
movs r4, 0
|
||||
@ -290,7 +290,7 @@ _080824DC:
|
||||
strb r0, [r3]
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x270]
|
||||
bl sub_8082F80
|
||||
bl ReadHiddenPower
|
||||
adds r0, r5, 0
|
||||
bl sub_80831A0
|
||||
ldr r1, [sp, 0x274]
|
||||
@ -305,93 +305,93 @@ _080824DC:
|
||||
str r0, [r3]
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x284]
|
||||
bl sub_8082D34
|
||||
bl ReadSleep
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x288]
|
||||
bl sub_8082D50
|
||||
bl ReadNonVolatile
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x28C]
|
||||
bl sub_8082D7C
|
||||
bl ReadImmobilize
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x290]
|
||||
bl sub_8082DA8
|
||||
bl ReadVolatileStatus
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x294]
|
||||
bl sub_8082DC4
|
||||
bl ReadCharging
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x298]
|
||||
bl sub_8082DE8
|
||||
bl ReadProtection
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x29C]
|
||||
bl sub_8082E04
|
||||
bl ReadWaiting
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x220]
|
||||
bl sub_8082E38
|
||||
bl ReadLinked
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x224]
|
||||
bl sub_8082E6C
|
||||
bl ReadMoveStatus
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x228]
|
||||
bl sub_8082E88
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x22C]
|
||||
bl sub_8082E94
|
||||
bl ReadTransformStatus
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x230]
|
||||
bl sub_8082EB0
|
||||
bl ReadEyesightStatus
|
||||
adds r0, r5, 0
|
||||
ldr r1, [sp, 0x234]
|
||||
bl sub_8082ECC
|
||||
bl ReadMuzzled
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r1, [sp, 0x238]
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r2, [sp, 0x23C]
|
||||
strb r0, [r2]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r3, [sp, 0x240]
|
||||
strb r0, [r3]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r1, [sp, 0x244]
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r2, [sp, 0x248]
|
||||
strb r0, [r2]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
ldr r3, [sp, 0x25C]
|
||||
strb r0, [r3]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r1, [sp, 0x24C]
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r2, [sp, 0x250]
|
||||
strb r0, [r2]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r3, [sp, 0x254]
|
||||
strb r0, [r3]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
ldr r1, [sp, 0x258]
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r2, [sp, 0x260]
|
||||
strb r0, [r2]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
ldr r3, [sp, 0x264]
|
||||
strb r0, [r3]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
ldr r1, [sp, 0x268]
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
@ -409,20 +409,20 @@ _080824DC:
|
||||
add r1, sp, 0x108
|
||||
adds r0, r5, 0
|
||||
movs r2, 0x5
|
||||
bl sub_8083288
|
||||
bl xxx_ReadBytes
|
||||
ldr r1, _08082674
|
||||
add r1, sp
|
||||
adds r0, r5, 0
|
||||
movs r2, 0x5
|
||||
bl sub_8083288
|
||||
bl xxx_ReadBytes
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
movs r1, 0x89
|
||||
lsls r1, 1
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
b _08082678
|
||||
.align 2, 0
|
||||
_0808266C: .4byte 0xfffffd60
|
||||
@ -433,14 +433,14 @@ _08082678:
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
add r1, sp, 0x114
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
str r0, [r1]
|
||||
add r1, sp, 0x118
|
||||
adds r0, r5, 0
|
||||
bl sub_8082F1C
|
||||
bl ReadMoves
|
||||
add r1, sp, 0x13C
|
||||
adds r0, r5, 0
|
||||
bl sub_8082F48
|
||||
@ -448,131 +448,131 @@ _08082678:
|
||||
adds r0, r5, 0
|
||||
bl sub_8082F48
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
add r1, sp, 0x144
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r1, _0808281C
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r1, _08082820
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
movs r1, 0xA3
|
||||
lsls r1, 1
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
add r1, sp, 0x148
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r1, _08082824
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
movs r1, 0xA5
|
||||
lsls r1, 1
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r1, _08082828
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
add r1, sp, 0x14C
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083158
|
||||
bl ReadU16
|
||||
movs r1, 0xA7
|
||||
lsls r1, 1
|
||||
add r1, sp
|
||||
strh r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083158
|
||||
bl ReadU16
|
||||
add r1, sp, 0x150
|
||||
strh r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
movs r1, 0xA9
|
||||
lsls r1, 1
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
ldr r1, _0808282C
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
add r1, sp, 0x154
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
ldr r1, _08082830
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_80831DC
|
||||
bl ReadBool8
|
||||
movs r1, 0xAB
|
||||
lsls r1, 1
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
add r1, sp, 0x164
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
ldr r1, _08082834
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
movs r1, 0xB3
|
||||
lsls r1, 1
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
ldr r1, _08082838
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
add r1, sp, 0x168
|
||||
strb r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083188
|
||||
bl ReadU8
|
||||
ldr r1, _0808283C
|
||||
add r1, sp
|
||||
strb r0, [r1]
|
||||
add r1, sp, 0x16C
|
||||
adds r0, r5, 0
|
||||
bl sub_80831F8
|
||||
bl ReadPosition8
|
||||
adds r0, r5, 0
|
||||
bl sub_80831C8
|
||||
add r1, sp, 0x174
|
||||
str r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083158
|
||||
bl ReadU16
|
||||
add r1, sp, 0x178
|
||||
strh r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
add r1, sp, 0x1F8
|
||||
strh r0, [r1]
|
||||
adds r0, r5, 0
|
||||
bl sub_8083170
|
||||
bl ReadS16
|
||||
movs r1, 0xFD
|
||||
lsls r1, 1
|
||||
add r1, sp
|
||||
@ -688,7 +688,7 @@ _080828BE:
|
||||
_080828D4: .4byte 0x0000020a
|
||||
_080828D8: .4byte gLeaderPointer
|
||||
_080828DC: .4byte gUnknown_203B410
|
||||
thumb_func_end sub_8082280
|
||||
thumb_func_end RestoreDungeonEntity
|
||||
|
||||
thumb_func_start sub_80828E0
|
||||
sub_80828E0:
|
||||
|
@ -400,7 +400,7 @@ _080987C0:
|
||||
bl DeleteGroundEffects
|
||||
bl sub_809C658
|
||||
bl nullsub_16
|
||||
bl sub_8097944
|
||||
bl UpdateAdventureAchievements
|
||||
cmp r7, r4
|
||||
beq _08098848
|
||||
adds r0, r7, 0
|
||||
|
@ -487,7 +487,7 @@ _080A195A:
|
||||
movs r2, 0xA
|
||||
bl sub_80922B4
|
||||
_080A1968:
|
||||
bl sub_8097848
|
||||
bl IncrementAdventureNumJoined
|
||||
bl _080A236A
|
||||
.align 2, 0
|
||||
_080A1970: .4byte gUnknown_8116710
|
||||
@ -526,7 +526,7 @@ _080A1988:
|
||||
bne _080A19C2
|
||||
b _080A1EBE
|
||||
_080A19C2:
|
||||
bl sub_8097848
|
||||
bl IncrementAdventureNumJoined
|
||||
ldrh r1, [r4]
|
||||
movs r0, 0x2
|
||||
orrs r0, r1
|
||||
@ -626,7 +626,7 @@ _080A1A70:
|
||||
bl sub_808D2E8
|
||||
cmp r0, 0
|
||||
beq _080A1A9A
|
||||
bl sub_8097848
|
||||
bl IncrementAdventureNumJoined
|
||||
_080A1A9A:
|
||||
movs r0, 0x92
|
||||
movs r1, 0
|
||||
@ -641,7 +641,7 @@ _080A1A9A:
|
||||
bl sub_808D2E8
|
||||
cmp r0, 0
|
||||
beq _080A1ABC
|
||||
bl sub_8097848
|
||||
bl IncrementAdventureNumJoined
|
||||
_080A1ABC:
|
||||
movs r0, 0x90
|
||||
movs r1, 0
|
||||
@ -660,7 +660,7 @@ _080A1ACC:
|
||||
bne _080A1AE2
|
||||
bl _080A236A
|
||||
_080A1AE2:
|
||||
bl sub_8097848
|
||||
bl IncrementAdventureNumJoined
|
||||
bl _080A236A
|
||||
.align 2, 0
|
||||
_080A1AEC: .4byte gUnknown_8116788
|
||||
@ -1121,7 +1121,7 @@ _080A1EAC:
|
||||
adds r2, 0x1
|
||||
cmp r2, 0x9
|
||||
ble _080A1EAC
|
||||
bl sub_8097848
|
||||
bl IncrementAdventureNumJoined
|
||||
_080A1EBE:
|
||||
movs r0, 0x1
|
||||
b _080A236C
|
||||
|
@ -89,7 +89,7 @@ gUnknown_8107178: @ 8107178
|
||||
.string "pksdir0\0"
|
||||
@ ???
|
||||
.string "pksdir0\0"
|
||||
@ sub_8080B30 - sub_808217C
|
||||
@ WriteDungeonState - sub_808217C
|
||||
.string "pksdir0\0"
|
||||
|
||||
.global gYayoiSan
|
||||
|
@ -1,21 +1,19 @@
|
||||
#ifndef GUARD_CODE_8092334_H
|
||||
#define GUARD_CODE_8092334_H
|
||||
|
||||
// size: 0x10?
|
||||
typedef struct unkStruct_8094924
|
||||
// size: 0x10
|
||||
typedef struct DataSerializer
|
||||
{
|
||||
u8 *unk0; // head?
|
||||
u8 *unk4; // tail?
|
||||
u32 unk8;
|
||||
u32 unkC;
|
||||
} unkStruct_8094924;
|
||||
u8 *stream;
|
||||
u8 *end; // exclusive end of the stream
|
||||
u32 count; // Used to count bits between ReadBits functions, or count bytes between ReadBytes functions
|
||||
u32 unkC; // Seems to be a temporary 32 bit storage
|
||||
} DataSerializer;
|
||||
|
||||
void nullsub_102(unkStruct_8094924 *);
|
||||
void RestoreIntegerBits(unkStruct_8094924 *, void *, s32 size);
|
||||
void SaveIntegerBits(unkStruct_8094924 *, void *, s32 size);
|
||||
void xxx_init_struct_8094924_restore_809485C(unkStruct_8094924 *, u8 *, s32 size);
|
||||
void xxx_init_struct_8094924_save_809486C(unkStruct_8094924 *, u8 *, s32 size);
|
||||
|
||||
void sub_80948E4(unkStruct_8094924 *, u8 *, s32 size);
|
||||
void nullsub_102(DataSerializer *seri);
|
||||
void ReadBits(DataSerializer *seri, void *dst, s32 numBits);
|
||||
void WriteBits(DataSerializer *seri, void *src, s32 numBits);
|
||||
void InitBitReader(DataSerializer *seri, u8 *buffer, s32 bufLen);
|
||||
void InitBitWriter(DataSerializer *seri, u8 *buffer, s32 bufLen);
|
||||
|
||||
#endif // GUARD_CODE_8092334_H
|
@ -46,7 +46,7 @@ u32 CountAllMail(void);
|
||||
s32 sub_8095374(void);
|
||||
s32 GetMailIndex(u8 mailType, u32);
|
||||
s32 GetFirstIndexofMailType(u8 mailType);
|
||||
void sub_8095824(struct unkStruct_8094924 *a, unkStruct_203B480 *b);
|
||||
void sub_8095774(struct unkStruct_8094924 *a, unkStruct_203B480 *b);
|
||||
void sub_8095824(DataSerializer *a, unkStruct_203B480 *b);
|
||||
void sub_8095774(DataSerializer *a, unkStruct_203B480 *b);
|
||||
|
||||
#endif // GUARD_CODE_8094F88_H
|
@ -68,7 +68,7 @@ u8 *sub_8096DD8(void);
|
||||
u8 *sub_8096DE8(void);
|
||||
u8 sub_8096E2C(void);
|
||||
void sub_8096EEC(WonderMail *mail);
|
||||
void SaveWonderMail(unkStruct_8094924 *a, WonderMail *b);
|
||||
void RestoreWonderMail(unkStruct_8094924 *a, WonderMail *b);
|
||||
void WriteWonderMailBits(DataSerializer *a, WonderMail *b);
|
||||
void ReadWonderMailBits(DataSerializer *a, WonderMail *b);
|
||||
|
||||
#endif // GUARD_CODE_80958E8_H
|
||||
|
@ -3,21 +3,59 @@
|
||||
|
||||
#include "structs/str_dungeon.h"
|
||||
|
||||
// See gAdventureLogText
|
||||
enum AdventureAchievement
|
||||
{
|
||||
AA_HILL_OF_ANCIENTS,
|
||||
AA_FUGITIVE,
|
||||
AA_PREVENT_METEOR,
|
||||
AA_BROKE_CURSE,
|
||||
AA_TEAM_BASE_DONE,
|
||||
AA_SMEARGLE,
|
||||
AA_SPOTTED_MUNCHLAX,
|
||||
AA_NUM_MOVES_LEARNED,
|
||||
AA_NUM_FRIEND_RESCUE_SUCCESSES,
|
||||
AA_NUM_POKEMON_EVOLVED,
|
||||
AA_NUM_POKEMON_JOINED,
|
||||
AA_NUM_THIEVING_SUCCESSES,
|
||||
AA_NUM_FLOORS_EXPLORED,
|
||||
AA_ALL_FRIEND_AREAS,
|
||||
AA_ALL_POKEMON_LEADERS,
|
||||
AA_ALL_POKEMON_JOINED,
|
||||
AA_RECRUIT_MOLTRES,
|
||||
AA_RECRUIT_ZAPDOS,
|
||||
AA_RECRUIT_ARTICUNO,
|
||||
AA_RECRUIT_DEOXYS,
|
||||
AA_RECRUIT_ENTEI,
|
||||
AA_RECRUIT_RAIKOU,
|
||||
AA_RECRUIT_SUICUNE,
|
||||
AA_RECRUIT_HO_OH,
|
||||
AA_RECRUIT_KYOGRE,
|
||||
AA_RECRUIT_GROUDON,
|
||||
AA_RECRUIT_RAYQUAZA,
|
||||
AA_RECRUIT_LUGIA,
|
||||
AA_RECRUIT_CELEBI,
|
||||
AA_RECRUIT_MEW,
|
||||
AA_RECRUIT_MEWTWO,
|
||||
AA_RECRUIT_JIRACHI,
|
||||
AA_MAX
|
||||
};
|
||||
|
||||
// size: 0xC4
|
||||
struct unkStruct_203B494
|
||||
{
|
||||
u32 unk0; // 32 bit bitfield, I think
|
||||
/* 0x4 */ u32 achievements; // Adventure achievement flags
|
||||
/* 0x4 */ s32 numAdventures;
|
||||
s32 unk8;
|
||||
s32 unkC;
|
||||
/* 0x8 */ s32 friendRescueSuccesses;
|
||||
/* 0xC */ s32 numEvolved;
|
||||
/* 0x10 */ DungeonLocation dungeonLocation;
|
||||
s16 unk14;
|
||||
s16 unk16;
|
||||
s16 unk18;
|
||||
/* 0x14 */ s16 thievingSuccesses;
|
||||
/* 0x16 */ s16 numJoined;
|
||||
/* 0x18 */ s16 adventureMovesLearned;
|
||||
u32 unk1C[14];
|
||||
u32 unk54[14];
|
||||
u32 unk8C[13];
|
||||
s32 unkC0;
|
||||
/* 0x8C */ u32 learnedMoves[13]; // Get with `learnedMoves[move / 32] & 1 << move % 32` ... Set with `learnedMoves[move / 32] |= 1 << move % 32`
|
||||
/* 0xC0 */ s32 numFloorsExplored;
|
||||
};
|
||||
|
||||
extern struct unkStruct_203B494 *gUnknown_203B494;
|
||||
@ -29,20 +67,20 @@ void ResetNumAdventures(void);
|
||||
|
||||
void sub_8097670(void);
|
||||
struct unkStruct_203B494 *sub_8097680(void);
|
||||
void sub_80976A8(void);
|
||||
void sub_80976F8(u8);
|
||||
bool8 sub_8097710(u8);
|
||||
void sub_8097790(void);
|
||||
s32 sub_80977B8(void);
|
||||
void sub_80977D0(void);
|
||||
s32 sub_80977F8(void);
|
||||
s16 sub_8097838(void);
|
||||
void sub_8097848(void);
|
||||
s16 sub_8097870(void);
|
||||
s16 sub_8097880(void);
|
||||
s16 sub_80978B8(void);
|
||||
void sub_8097944(void);
|
||||
u32 sub_8097D60(u8 *r0, u32 size);
|
||||
u32 sub_8097D98(u8 *r0, u32 size);
|
||||
void ResetAdventureInfo(void);
|
||||
void SetAdventureAchievement(u8);
|
||||
bool8 GetAdventureAchievement(u8);
|
||||
void IncrementFriendRescueSuccesses(void);
|
||||
s32 GetFriendRescueSuccesses(void);
|
||||
void IncrementNumEvolved(void);
|
||||
s32 GetAdventureNumEvolved(void);
|
||||
s16 GetThievingSuccesses(void);
|
||||
void IncrementAdventureNumJoined(void);
|
||||
s16 GetAdventureNumJoined(void);
|
||||
s16 GetAdventureMovesLearned(void);
|
||||
s16 GetAdventureFloorsExplored(void);
|
||||
void UpdateAdventureAchievements(void);
|
||||
u32 SaveAdventureData(u8 *r0, u32 size);
|
||||
u32 RestoreAdventureData(u8 *r0, u32 size);
|
||||
|
||||
#endif // GUARD_CODE_8097670_H
|
||||
|
@ -418,4 +418,6 @@
|
||||
#define MOVE_MD1_2 0x19B // Unused
|
||||
#define MOVE_PIERCE 0x19C
|
||||
|
||||
#define NUM_MOVE_IDS (MOVE_PIERCE + 1)
|
||||
|
||||
#endif
|
||||
|
@ -57,7 +57,7 @@ void SetTutorialFlag(s32 param_1);
|
||||
bool32 GetTutorialFlag(s32 param_1);
|
||||
bool8 IsExclusivePokemonUnlocked(s16 pokeID);
|
||||
void UnlockExclusivePokemon(s16 pokeID);
|
||||
void WriteExclusivePokemon(struct unkStruct_8094924 *r0);
|
||||
void ReadExclusivePokemon(struct unkStruct_8094924 *r0);
|
||||
void WriteExclusivePokemon(DataSerializer *r0);
|
||||
void ReadExclusivePokemon(DataSerializer *r0);
|
||||
|
||||
#endif // GUARD_EXCLUSIVE_POKEMON_H
|
||||
|
@ -68,10 +68,10 @@ bool8 IsInvalidItemReward(u8 itemID);
|
||||
bool8 HasGummiItem(void);
|
||||
void GetGummiItemStatBoost(PokemonStruct1* pokemon, u8 id, bool8 checkBoostFlags, Gummi *gummi);
|
||||
|
||||
void RestoreHeldItem(unkStruct_8094924 *, BulkItem *);
|
||||
void SaveHeldItem(unkStruct_8094924 *, BulkItem *);
|
||||
void RestoreItemSlot(unkStruct_8094924 *, Item *);
|
||||
void SaveItemSlot(unkStruct_8094924 *, Item *);
|
||||
void ReadHeldItemBits(DataSerializer *, BulkItem *);
|
||||
void WriteHeldItemBits(DataSerializer *, BulkItem *);
|
||||
void ReadItemSlotBits(DataSerializer *, Item *);
|
||||
void WriteItemSlotBits(DataSerializer *, Item *);
|
||||
s32 RestoreTeamInventory(u8 *, u32 size);
|
||||
s32 SaveTeamInventory(u8 *, u32 size);
|
||||
|
||||
|
@ -51,8 +51,8 @@ void LoadWazaParameters(void);
|
||||
bool8 MoveCannotHitFrozen(Move *move);
|
||||
bool8 MoveIgnoresTaunted(Move *move);
|
||||
void RemoveLinkSequenceFromMoves8(Move *moves, s32 index);
|
||||
void RestorePokemonMoves(struct unkStruct_8094924 *, Move *moveSet);
|
||||
void SavePokemonMoves(struct unkStruct_8094924 *, Move *moveSet);
|
||||
void ReadPoke1MovesBits(DataSerializer *, Move *moveSet);
|
||||
void WritePoke1MovesBits(DataSerializer *, Move *moveSet);
|
||||
bool8 ToggleMoveEnabled(s32 index, Move *moves);
|
||||
bool8 ToggleSetMove(s32 index, Move *moves);
|
||||
bool8 TryLinkMovesAfter(s32 index, Move *moves);
|
||||
@ -86,8 +86,8 @@ bool8 sub_8093318(s32, Move *moves);
|
||||
bool8 sub_809333C(s32, Move *moves);
|
||||
s32 sub_80935B8(Move *moves, s32 index);
|
||||
void sub_8094060(Move *srcMoves, Move *destMoves);
|
||||
void sub_8094184(struct unkStruct_8094924 *, struct Moves *);
|
||||
void sub_80941FC(struct unkStruct_8094924 *, struct Moves *);
|
||||
void WritePoke2MovesBits(DataSerializer *, struct Moves *);
|
||||
void ReadPoke2MovesBits(DataSerializer *, struct Moves *);
|
||||
|
||||
static inline bool8 MoveFlagExists(Move *move)
|
||||
{
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
enum PokemonUnk0Flags
|
||||
{
|
||||
FLAG_ON_TEAM = 2,
|
||||
FLAG_NONE = 0,
|
||||
FLAG_UNK_1 = 1,
|
||||
FLAG_ON_TEAM = 2, // Mon is not on "standby"
|
||||
};
|
||||
|
||||
// size: 0x1A4
|
||||
@ -83,8 +85,8 @@ s32 GetUnownIndex(s16 index);
|
||||
void GenerateHiddenPower(HiddenPower *);
|
||||
s32 GetEvolutionSequence(PokemonStruct1 *pokemon, EvolveStage *);
|
||||
void xxx_pokemonstruct_to_pokemon2_808DE50(PokemonStruct2 *, PokemonStruct1 *, s32);
|
||||
void SavePokemonStruct(unkStruct_8094924 *, PokemonStruct1 *pokemon);
|
||||
void RestorePokemonStruct(unkStruct_8094924 *, PokemonStruct1 *);
|
||||
void WritePoke1Bits(DataSerializer *, PokemonStruct1 *pokemon);
|
||||
void ReadPoke1Bits(DataSerializer *, PokemonStruct1 *);
|
||||
s32 sub_808E218(unkStruct_808E218_arg *, PokemonStruct1 *pokemon);
|
||||
void sub_808CFD0(PokemonStruct1 *pokemon, s16 _species, u8* name, u32 _itemID, DungeonLocation *location, u16 *moveID);
|
||||
void sub_808D0D8(PokemonStruct1 *pokemon);
|
||||
@ -100,12 +102,12 @@ extern s32 sub_808D580(s32 *);
|
||||
|
||||
static inline bool8 PokemonFlag1(PokemonStruct1 *mon)
|
||||
{
|
||||
return ((mon->unk0 & 1));
|
||||
return (mon->unk0 & FLAG_UNK_1);
|
||||
}
|
||||
|
||||
static inline bool8 PokemonFlag2(PokemonStruct1 *mon)
|
||||
{
|
||||
return (((mon->unk0 >> (FLAG_ON_TEAM - 1)) & 1));
|
||||
return ((mon->unk0 >> (FLAG_ON_TEAM - 1)) & 1);
|
||||
}
|
||||
|
||||
static inline void SetPokemonFlag2(PokemonStruct1 *mon)
|
||||
|
@ -26,6 +26,8 @@
|
||||
#define STAT_STAGE_ACCURACY 0
|
||||
#define STAT_STAGE_EVASION 1
|
||||
|
||||
#define NUM_PICKED_IQ_SKILLS 3
|
||||
|
||||
typedef struct unkStruct_8044CC8
|
||||
{
|
||||
u8 actionUseIndex;
|
||||
@ -37,7 +39,7 @@ typedef struct ActionContainer
|
||||
{
|
||||
/* 0x0 */ u16 action;
|
||||
/* 0x2 */ u8 direction;
|
||||
u8 fill3;
|
||||
u8 unk3;
|
||||
// Additional parameter alongside actionIndex. Used for things like indicating which move a Pokémon should use from its moveset.
|
||||
/* 0x4 */ unkStruct_8044CC8 unk4[2];
|
||||
// Position of the target that the Pokémon wants throw an item at.
|
||||
@ -224,8 +226,10 @@ typedef struct EntityInfo
|
||||
/* 0x68 */ Position prevPos[NUM_PREV_POS];
|
||||
/* 0x78 */ AITarget aiTarget;
|
||||
// Bitwise flags corresponding to selected IQ skills.
|
||||
/* 0x8C */ u8 IQSkillMenuFlags[4]; // IQ skills selected in the IQ skills menu.
|
||||
/* 0x90 */ u8 IQSkillFlags[4];
|
||||
/* 0x8C */ u8 IQSkillMenuFlags[NUM_PICKED_IQ_SKILLS]; // IQ skills selected in the IQ skills menu.
|
||||
u8 padding8F;
|
||||
/* 0x90 */ u8 IQSkillFlags[NUM_PICKED_IQ_SKILLS];
|
||||
u8 padding93;
|
||||
/* 0x94 */ u8 tactic;
|
||||
u8 fill95[0x98 - 0x95];
|
||||
/* 0x98 */ u32 unk98;
|
||||
|
@ -264,6 +264,8 @@ typedef struct Dungeon
|
||||
/* 0x5C0 */ s32 unk5C0;
|
||||
/* 0x5C4 */ struct unkStruct_Dungeon5C4_sub unk5C4[3];
|
||||
/* 0x5F4 */ u8 faintStringBuffer[80];
|
||||
|
||||
// TODO: This is the start of a struct that is 0x58 bytes (dungeon data that persists between save/reload). See sub_8080B90 and sub_8081C50
|
||||
/* 0x644 */ DungeonLocation dungeonLocation;
|
||||
/* 0x648 */ DungeonLocation dungeonLocation2;
|
||||
struct unkStruct_Dungeon64C unk64C;
|
||||
@ -277,7 +279,7 @@ typedef struct Dungeon
|
||||
u8 unk65B;
|
||||
u8 unk65C;
|
||||
u8 unk65D;
|
||||
u8 fill65e[0x660 - 0x65e];
|
||||
u8 fill65e[2];
|
||||
/* 0x660 */ s16 fractionalTurn; // Handles turn order when Pokémon have different movement speeds.
|
||||
s16 unk662;
|
||||
s16 unk664;
|
||||
@ -312,7 +314,8 @@ typedef struct Dungeon
|
||||
s32 unk694;
|
||||
u8 unk698;
|
||||
u8 unk699;
|
||||
u8 fill69A[0x69C - 0x69A];
|
||||
u8 fill69A[2];
|
||||
|
||||
EntityInfo unk69C[4];
|
||||
EntityInfo unkEBC[1]; // Unsure about the size... See sub_8082A08()
|
||||
u8 fill10C4[0x343C - 0x10C4];
|
||||
@ -350,11 +353,9 @@ typedef struct Dungeon
|
||||
Position unkE218;
|
||||
Position unkE21C; // stair location?
|
||||
Position unkE220[8];
|
||||
u32 unkE240;
|
||||
u8 fillE244[0xE250 - 0xE244];
|
||||
u32 unkE250;
|
||||
u8 fillE254[0xE260 - 0xE254];
|
||||
u32 unkE260;
|
||||
u32 unkE240[4];
|
||||
u32 unkE250[4];
|
||||
u16 unkE260[2];
|
||||
/* 0xE264 */ Weather weather; // Uses the weather constants in weather.h.
|
||||
/* 0xE27C */ Tile unkE27C[8][8];
|
||||
/* 0xE87C */ u8 unkE87C[8][8];
|
||||
|
@ -23,7 +23,7 @@ typedef struct unkPokeSubStruct_C
|
||||
// size: 0x58
|
||||
typedef struct PokemonStruct1
|
||||
{
|
||||
u16 unk0; // Probably a union: Sometimes ldrh and sometimes ldrb. Recruited??
|
||||
u16 unk0; // Probably a union: Sometimes ldrh and sometimes ldrb. Recruited?? "sub_80954CC" only loads 2 bits of info
|
||||
/* 0x2 */ bool8 isTeamLeader;
|
||||
/* 0x3 */ u8 level;
|
||||
/* 0x4 */ DungeonLocation dungeonLocation;
|
||||
@ -71,8 +71,8 @@ typedef struct PokemonStruct2
|
||||
/* 0x18 */ u32 currExp;
|
||||
/* 0x1C */ Moves moves;
|
||||
/* 0x40 */ Item itemSlot; // heldItem
|
||||
FixedPoint belly; // some struct
|
||||
FixedPoint maxBelly; // some struct (same type as 44)
|
||||
/* 0x44 */ FixedPoint belly;
|
||||
/* 0x48 */ FixedPoint maxBelly;
|
||||
/* 0x4C */ u32 IQSkills; // unk20
|
||||
/* 0x50 */ u8 tacticIndex;
|
||||
/* 0x54 */ HiddenPower hiddenPower;
|
||||
|
@ -64,8 +64,8 @@ typedef struct unkStruct_203B480
|
||||
u32 unk10;
|
||||
u16 unk10_u16;
|
||||
} unk10;
|
||||
/* 0x14 */ u8 playerName[0x20 - 0x14];
|
||||
Item item;
|
||||
/* 0x14 */ u8 playerName[10];
|
||||
/* 0x20 */ Item item;
|
||||
u32 unk24;
|
||||
u32 unk28;
|
||||
/* 0x2C */ s8 rescuesAllowed;
|
||||
|
@ -87,8 +87,7 @@ static void DisplayAdventureLog(void)
|
||||
s32 i;
|
||||
s32 r4; // r4
|
||||
s32 r6; // r6
|
||||
u8 temp;
|
||||
s32 v1, v2, v3, v4, v5, v6;
|
||||
u8 aa;
|
||||
|
||||
CallPrepareTextbox_8008C54(sAdventureLog->s0.unk34);
|
||||
sub_80073B8(sAdventureLog->s0.unk34);
|
||||
@ -102,42 +101,49 @@ static void DisplayAdventureLog(void)
|
||||
sub_8012BC4(r6, 0, sAdventureLog->s0.input.unk1E + 1, 1, 7, sAdventureLog->s0.unk34);
|
||||
|
||||
for (i = 0; i < sAdventureLog->s0.input.unk1A; i++) {
|
||||
temp = (sAdventureLog->s0.input.unk1E * sAdventureLog->s0.input.unk1C) + i;
|
||||
aa = (sAdventureLog->s0.input.unk1E * sAdventureLog->s0.input.unk1C) + i;
|
||||
|
||||
if (sub_8097710(temp)) {
|
||||
switch (temp) {
|
||||
case 12:
|
||||
v1 = sub_80978B8();
|
||||
if (GetAdventureAchievement(aa)) {
|
||||
switch (aa) {
|
||||
case AA_NUM_FLOORS_EXPLORED: {
|
||||
s32 v1 = GetAdventureFloorsExplored();
|
||||
gFormatArgs[0] = (s16)v1;
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(temp), sAdventureLog->s0.unk34, 0);
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(aa), sAdventureLog->s0.unk34, 0);
|
||||
break;
|
||||
case 7:
|
||||
v2 = sub_8097880();
|
||||
}
|
||||
case AA_NUM_MOVES_LEARNED: {
|
||||
s32 v2 = GetAdventureMovesLearned();
|
||||
gFormatArgs[0] = (s16)v2;
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(temp), sAdventureLog->s0.unk34, 0);
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(aa), sAdventureLog->s0.unk34, 0);
|
||||
break;
|
||||
case 11:
|
||||
v3 = sub_8097838();
|
||||
}
|
||||
case AA_NUM_THIEVING_SUCCESSES: {
|
||||
s32 v3 = GetThievingSuccesses();
|
||||
gFormatArgs[0] = (s16)v3;
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(temp), sAdventureLog->s0.unk34, 0);
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(aa), sAdventureLog->s0.unk34, 0);
|
||||
break;
|
||||
case 8:
|
||||
v4 = sub_80977B8();
|
||||
}
|
||||
case AA_NUM_FRIEND_RESCUE_SUCCESSES: {
|
||||
s32 v4 = GetFriendRescueSuccesses();
|
||||
gFormatArgs[0] = v4;
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(temp), sAdventureLog->s0.unk34, 0);
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(aa), sAdventureLog->s0.unk34, 0);
|
||||
break;
|
||||
case 9:
|
||||
v5 = sub_80977F8();
|
||||
}
|
||||
case AA_NUM_POKEMON_EVOLVED: {
|
||||
s32 v5 = GetAdventureNumEvolved();
|
||||
gFormatArgs[0] = v5;
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(temp), sAdventureLog->s0.unk34, 0);
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(aa), sAdventureLog->s0.unk34, 0);
|
||||
break;
|
||||
case 10:
|
||||
v6 = sub_8097870();
|
||||
}
|
||||
case AA_NUM_POKEMON_JOINED: {
|
||||
s32 v6 = GetAdventureNumJoined();
|
||||
gFormatArgs[0] = (s16)v6;
|
||||
// fallthrough
|
||||
default:
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(temp), sAdventureLog->s0.unk34, 0);
|
||||
}
|
||||
default: {
|
||||
PrintFormattedStringOnWindow(8, sub_8013800(&sAdventureLog->s0.input, i), GetAdventureLogLine(aa), sAdventureLog->s0.unk34, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -145,4 +151,4 @@ static void DisplayAdventureLog(void)
|
||||
}
|
||||
|
||||
sub_80073E0(sAdventureLog->s0.unk34);
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ u8 sub_803D110(u8 *param_1, u8 *param_2, s32 size)
|
||||
s32 index1;
|
||||
s32 newSize;
|
||||
s32 save;
|
||||
unkStruct_8094924 auStack_88;
|
||||
DataSerializer auStack_88;
|
||||
u8 local_78 [56];
|
||||
u8 auStack_40 [36];
|
||||
|
||||
@ -62,11 +62,11 @@ u8 sub_803D110(u8 *param_1, u8 *param_2, s32 size)
|
||||
|
||||
newSize >>= 3;
|
||||
save = newSize;
|
||||
xxx_init_struct_8094924_save_809486C(&auStack_88,auStack_40, save);
|
||||
InitBitWriter(&auStack_88,auStack_40, save);
|
||||
|
||||
for(index1 = 0; index1 < size; index1++)
|
||||
{
|
||||
SaveIntegerBits(&auStack_88, &local_78[index1], 5);
|
||||
WriteBits(&auStack_88, &local_78[index1], 5);
|
||||
}
|
||||
nullsub_102(&auStack_88);
|
||||
MemoryCopy8(param_2, auStack_40, save);
|
||||
@ -77,7 +77,7 @@ void sub_803D1A8(u8 *param_1, u8 *param_2, s32 size)
|
||||
{
|
||||
s32 index;
|
||||
s32 newSize;
|
||||
unkStruct_8094924 auStack_5c;
|
||||
DataSerializer auStack_5c;
|
||||
u8 local_4c [56];
|
||||
|
||||
newSize = size * 5 + 5;
|
||||
@ -85,10 +85,10 @@ void sub_803D1A8(u8 *param_1, u8 *param_2, s32 size)
|
||||
newSize = size * 5 + 0xc;
|
||||
}
|
||||
newSize >>= 3;
|
||||
xxx_init_struct_8094924_restore_809485C(&auStack_5c, param_2, newSize);
|
||||
InitBitReader(&auStack_5c, param_2, newSize);
|
||||
for(index = 0; index < size; index++)
|
||||
{
|
||||
RestoreIntegerBits(&auStack_5c, &local_4c[index], 5);
|
||||
ReadBits(&auStack_5c, &local_4c[index], 5);
|
||||
}
|
||||
|
||||
nullsub_102(&auStack_5c);
|
||||
@ -105,7 +105,7 @@ bool8 sub_803D204(u8 *buffer,unkStruct_203B480 *param_2)
|
||||
u8 local_c4 [34];
|
||||
u8 translateBuffer [PASSWORD_BUFFER_SIZE];
|
||||
u8 localBuffer [PASSWORD_BUFFER_SIZE];
|
||||
unkStruct_8094924 uStack_30;
|
||||
DataSerializer uStack_30;
|
||||
s32 index;
|
||||
|
||||
checksum = 0;
|
||||
@ -127,7 +127,7 @@ bool8 sub_803D204(u8 *buffer,unkStruct_203B480 *param_2)
|
||||
checksum += local_c4[index] + index;
|
||||
}
|
||||
if (local_c4[0] == checksum) {
|
||||
xxx_init_struct_8094924_restore_809485C(&uStack_30,&local_c4[1],33);
|
||||
InitBitReader(&uStack_30,&local_c4[1],33);
|
||||
sub_8095774(&uStack_30,param_2);
|
||||
nullsub_102(&uStack_30);
|
||||
return TRUE;
|
||||
@ -143,7 +143,7 @@ void sub_803D2C0(u8 *buffer, unkStruct_203B480 *mail)
|
||||
u8 local_c0 [34];
|
||||
u8 buffer1 [PASSWORD_BUFFER_SIZE];
|
||||
u8 buffer2 [PASSWORD_BUFFER_SIZE];
|
||||
unkStruct_8094924 auStack_2c;
|
||||
DataSerializer auStack_2c;
|
||||
|
||||
checksum = 0;
|
||||
|
||||
@ -152,7 +152,7 @@ void sub_803D2C0(u8 *buffer, unkStruct_203B480 *mail)
|
||||
local_c0[index] = 0;
|
||||
}
|
||||
|
||||
xxx_init_struct_8094924_save_809486C(&auStack_2c,&local_c0[1],33);
|
||||
InitBitWriter(&auStack_2c,&local_c0[1],33);
|
||||
sub_8095824(&auStack_2c,mail);
|
||||
nullsub_102(&auStack_2c);
|
||||
for(index = 1; index < 34; index++)
|
||||
@ -176,7 +176,7 @@ bool8 DecodeWonderMailPassword(u8* buffer, WonderMail *mail)
|
||||
u8 local_70 [16];
|
||||
u8 local_60 [24];
|
||||
u8 password [24];
|
||||
unkStruct_8094924 puVar1;
|
||||
DataSerializer puVar1;
|
||||
|
||||
checksum = 0;
|
||||
MemoryCopy8(password,buffer,24);
|
||||
@ -199,8 +199,8 @@ bool8 DecodeWonderMailPassword(u8* buffer, WonderMail *mail)
|
||||
checksum += (local_70[index] + index);
|
||||
}
|
||||
if (local_70[0] == checksum) {
|
||||
xxx_init_struct_8094924_restore_809485C(&puVar1,&local_70[1],0xc);
|
||||
RestoreWonderMail(&puVar1,mail);
|
||||
InitBitReader(&puVar1,&local_70[1],0xc);
|
||||
ReadWonderMailBits(&puVar1,mail);
|
||||
nullsub_102(&puVar1);
|
||||
return TRUE;
|
||||
}
|
||||
@ -215,7 +215,7 @@ void sub_803D414(u8 *buffer,WonderMail *mail)
|
||||
u8 local_6c [15];
|
||||
u8 local_5c [24];
|
||||
u8 auStack_44 [24];
|
||||
unkStruct_8094924 uStack_2c;
|
||||
DataSerializer uStack_2c;
|
||||
|
||||
checksum = 0;
|
||||
for(index = 0; index < 0xF; index++)
|
||||
@ -223,8 +223,8 @@ void sub_803D414(u8 *buffer,WonderMail *mail)
|
||||
local_6c[index] = 0;
|
||||
}
|
||||
|
||||
xxx_init_struct_8094924_save_809486C(&uStack_2c,&local_6c[1],12);
|
||||
SaveWonderMail(&uStack_2c,mail);
|
||||
InitBitWriter(&uStack_2c,&local_6c[1],12);
|
||||
WriteWonderMailBits(&uStack_2c,mail);
|
||||
nullsub_102(&uStack_2c);
|
||||
|
||||
for(index = 1; index < 0xF; index++)
|
||||
|
@ -298,7 +298,7 @@ extern void sub_8047104(void);
|
||||
extern void sub_8068F28(void);
|
||||
extern void sub_806C1D8(void);
|
||||
extern void sub_804700C(void);
|
||||
extern void sub_8097810(void);
|
||||
extern void IncrementThievingSuccesses(void);
|
||||
extern void sub_803E13C(void);
|
||||
extern void sub_80841EC(void);
|
||||
extern void sub_8084424(void);
|
||||
@ -315,7 +315,7 @@ extern void sub_8068614(void);
|
||||
extern void sub_80840A4(void);
|
||||
extern void sub_803E178(void);
|
||||
extern void sub_80848F0(void);
|
||||
extern void sub_8097890(void);
|
||||
extern void IncrementAdventureFloorsExplored(void);
|
||||
extern void sub_806AB2C(void);
|
||||
extern void DisplayPreFightDialogue(void);
|
||||
extern void sub_8071DA4(Entity *);
|
||||
@ -332,7 +332,7 @@ extern void sub_80521D0(void);
|
||||
extern void sub_803F27C(u8);
|
||||
extern void sub_807E7FC(u8);
|
||||
extern void sub_80095CC(u32, u32);
|
||||
extern void sub_8081BF4(u8 *r0, u32 r1);
|
||||
extern void ReadDungeonState(u8 *r0, u32 r1);
|
||||
extern bool8 IsLevelResetTo1(u8 dungeon);
|
||||
extern void sub_8068A84(PokemonStruct1 *pokemon);
|
||||
extern void sub_807EAA0(u32, u32);
|
||||
@ -371,7 +371,7 @@ extern void sub_803EAF0(u32, u32);
|
||||
extern void sub_806A914(u8 a0, u8 a1, u8 a2);
|
||||
extern void sub_803F4A0(Entity *a0);
|
||||
extern void sub_8083AB0(s16 param_0, Entity * target, Entity * entity);
|
||||
extern void sub_8080B30(u8 *param_1,u32 param_2);
|
||||
extern void WriteDungeonState(u8 *param_1,u32 param_2);
|
||||
extern void sub_8046F84(s32 itemFlag);
|
||||
extern bool8 sub_8083C50(void);
|
||||
extern void sub_8068FE0(Entity *, u32, Entity *r2);
|
||||
@ -469,7 +469,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
|
||||
sub_8042E98();
|
||||
gUnknown_202F32C = 0;
|
||||
if (r6) {
|
||||
sub_8081BF4(gSerializedData_203B41C, 0x4800);
|
||||
ReadDungeonState(gSerializedData_203B41C, 0x4800);
|
||||
sub_8049840();
|
||||
}
|
||||
if (r9) {
|
||||
@ -686,7 +686,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
|
||||
|
||||
if (!r6) {
|
||||
sub_80848F0();
|
||||
sub_8097890();
|
||||
IncrementAdventureFloorsExplored();
|
||||
}
|
||||
|
||||
gUnknown_203B40C = 1;
|
||||
@ -824,7 +824,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
|
||||
gUnknown_203B40C = 0;
|
||||
|
||||
if (gDungeon->unk3 != 0) {
|
||||
sub_8080B30(gSerializedData_203B41C, 0x4800);
|
||||
WriteDungeonState(gSerializedData_203B41C, 0x4800);
|
||||
r8->unk7C = 3;
|
||||
r8->unk80 = gDungeon->dungeonLocation;
|
||||
check = FALSE;
|
||||
@ -834,7 +834,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
|
||||
s16 var;
|
||||
|
||||
if (gDungeon->unk6 != 0) {
|
||||
sub_8080B30(gSerializedData_203B41C, 0x4800);
|
||||
WriteDungeonState(gSerializedData_203B41C, 0x4800);
|
||||
}
|
||||
else {
|
||||
sub_8046F84(ITEM_FLAG_IN_SHOP);
|
||||
@ -854,14 +854,14 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
|
||||
else if (gDungeon->unk11 == 2) {
|
||||
sub_8083AB0(0x229, NULL, GetLeader());
|
||||
if (gDungeon->unk66E != 0) {
|
||||
sub_8097810();
|
||||
IncrementThievingSuccesses();
|
||||
}
|
||||
check = TRUE;
|
||||
}
|
||||
else if (gDungeon->unk11 == 3) {
|
||||
sub_8083AB0(0x22A, NULL, GetLeader());
|
||||
if (gDungeon->unk66E != 0) {
|
||||
sub_8097810();
|
||||
IncrementThievingSuccesses();
|
||||
}
|
||||
check = TRUE;
|
||||
}
|
||||
@ -873,13 +873,13 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
|
||||
else if (gDungeon->unk678 == 1 && sub_8043D10() == 2 && gDungeon->unk654 == 2) {
|
||||
sub_8083AB0(0x228, NULL, GetLeader());
|
||||
if (gDungeon->unk66E != 0) {
|
||||
sub_8097810();
|
||||
IncrementThievingSuccesses();
|
||||
}
|
||||
check = TRUE;
|
||||
}
|
||||
else {
|
||||
if (gDungeon->unk66E != 0) {
|
||||
sub_8097810();
|
||||
IncrementThievingSuccesses();
|
||||
}
|
||||
if (gDungeon->dungeonLocation.floor + 1 < gDungeon->unk1CEC8) {
|
||||
gDungeon->dungeonLocation.floor++;
|
||||
|
@ -797,7 +797,7 @@ bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *pa
|
||||
pokeStruct2->itemSlot = param_3->heldItem;
|
||||
BoundedCopyStringtoBuffer(pokeStruct2->name,GetMonSpecies(param_3->id),10);
|
||||
|
||||
sub_8097848();
|
||||
IncrementAdventureNumJoined();
|
||||
|
||||
if (sub_806B8CC(param_3->id,param_3->pos.x,param_3->pos.y,pokeStruct2,&local_2c,0,1) == 0) {
|
||||
TryDisplayDungeonLoggableMessage(entity1,*gUnknown_80FA058);
|
||||
@ -1061,7 +1061,7 @@ bool8 sub_806FDF4(Entity *entity1,Entity *entity2,Entity **entityPtr)
|
||||
UnlockFriendArea(friendArea);
|
||||
flag = TRUE;
|
||||
}
|
||||
sub_8097848();
|
||||
IncrementAdventureNumJoined();
|
||||
sub_8068FE0(entity2,500,entity1);
|
||||
if (sub_806B8CC(local_74.id,local_74.pos.x,local_74.pos.y,pokeStruct2,&local_2c,0,0) == 0) {
|
||||
pokeStruct2->unk0 = 0;
|
||||
|
@ -10,13 +10,13 @@
|
||||
#include "structs/str_position.h"
|
||||
|
||||
|
||||
u16 sub_8083158(unkStruct_8094924 *param_1);
|
||||
s16 sub_8083170(unkStruct_8094924 *param_1);
|
||||
u8 sub_8083188(unkStruct_8094924 *param_1);
|
||||
u32 sub_80831A0(unkStruct_8094924 *param_1);
|
||||
bool8 sub_80831DC(unkStruct_8094924 *param_1);
|
||||
void sub_8082FE0(unkStruct_8094924 *param_1, u8 *param_2, s32 size);
|
||||
void sub_80831F8(unkStruct_8094924 *param_1,Position *param_2);
|
||||
u16 ReadU16(DataSerializer *param_1);
|
||||
s16 ReadS16(DataSerializer *param_1);
|
||||
u8 ReadU8(DataSerializer *param_1);
|
||||
u32 sub_80831A0(DataSerializer *param_1);
|
||||
bool8 ReadBool8(DataSerializer *param_1);
|
||||
void ReadBytes(DataSerializer *param_1, void *param_2, s32 size);
|
||||
void ReadPosition8(DataSerializer *param_1,Position *param_2);
|
||||
|
||||
void AddPokemonDungeonSprite(u32, s16, Position *, u32);
|
||||
|
||||
@ -41,471 +41,508 @@ void sub_8082B40(void)
|
||||
}
|
||||
}
|
||||
|
||||
s16 sub_8082BC0(unkStruct_8094924 *param_1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Seems to be a new file (regarding serialization) starting here
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s16 sub_8082BC0(DataSerializer *param_1)
|
||||
{
|
||||
s16 temp[2];
|
||||
|
||||
temp[0] = 0;
|
||||
|
||||
sub_8082FE0(param_1, (u8 *)temp, 2);
|
||||
ReadBytes(param_1, temp, 2);
|
||||
return temp[0];
|
||||
}
|
||||
|
||||
|
||||
u8 sub_8082BE0(unkStruct_8094924 *param_1)
|
||||
u8 sub_8082BE0(DataSerializer *param_1)
|
||||
{
|
||||
u8 temp[4];
|
||||
|
||||
temp[0] = 0;
|
||||
|
||||
sub_8082FE0(param_1, temp, 1);
|
||||
ReadBytes(param_1, temp, 1);
|
||||
return temp[0];
|
||||
}
|
||||
|
||||
|
||||
u8 sub_8082BFC(unkStruct_8094924 *param_1)
|
||||
u8 sub_8082BFC(DataSerializer *param_1)
|
||||
{
|
||||
u8 temp[4];
|
||||
|
||||
temp[0] = 0;
|
||||
|
||||
sub_8082FE0(param_1, temp, 1);
|
||||
ReadBytes(param_1, temp, 1);
|
||||
return temp[0];
|
||||
}
|
||||
|
||||
u8 sub_8082C18(unkStruct_8094924 *param_1)
|
||||
u8 sub_8082C18(DataSerializer *param_1)
|
||||
{
|
||||
u8 temp[4];
|
||||
|
||||
temp[0] = 0;
|
||||
|
||||
sub_8082FE0(param_1, temp, 1);
|
||||
ReadBytes(param_1, temp, 1);
|
||||
return temp[0];
|
||||
}
|
||||
|
||||
u8 sub_8082C34(unkStruct_8094924 *param_1)
|
||||
u8 sub_8082C34(DataSerializer *param_1)
|
||||
{
|
||||
u8 temp[4];
|
||||
|
||||
temp[0] = 0;
|
||||
|
||||
sub_8082FE0(param_1, temp, 1);
|
||||
ReadBytes(param_1, temp, 1);
|
||||
return temp[0];
|
||||
}
|
||||
|
||||
u8 sub_8082C50(unkStruct_8094924 *param_1)
|
||||
u8 sub_8082C50(DataSerializer *param_1)
|
||||
{
|
||||
u8 temp[4];
|
||||
|
||||
temp[0] = 0;
|
||||
|
||||
sub_8082FE0(param_1, temp, 1);
|
||||
ReadBytes(param_1, temp, 1);
|
||||
return temp[0];
|
||||
}
|
||||
|
||||
u32 sub_8082C6C(unkStruct_8094924 *param_1)
|
||||
// Read some enum ?
|
||||
u32 sub_8082C6C(DataSerializer *param_1)
|
||||
{
|
||||
u32 temp;
|
||||
|
||||
temp = 0;
|
||||
|
||||
sub_8082FE0(param_1, (u8 *)&temp, 4);
|
||||
ReadBytes(param_1, &temp, 4);
|
||||
return temp;
|
||||
}
|
||||
|
||||
u8 sub_8082C84(unkStruct_8094924 *param_1)
|
||||
u8 sub_8082C84(DataSerializer *param_1)
|
||||
{
|
||||
u8 temp[4];
|
||||
|
||||
temp[0] = 0;
|
||||
|
||||
sub_8082FE0(param_1, temp, 1);
|
||||
ReadBytes(param_1, temp, 1);
|
||||
return temp[0];
|
||||
}
|
||||
|
||||
u8 sub_8082CA0(unkStruct_8094924 *param_1)
|
||||
u8 sub_8082CA0(DataSerializer *param_1)
|
||||
{
|
||||
u8 temp[4];
|
||||
|
||||
temp[0] = 0;
|
||||
|
||||
sub_8082FE0(param_1, temp, 1);
|
||||
ReadBytes(param_1, temp, 1);
|
||||
return temp[0];
|
||||
}
|
||||
|
||||
void sub_8082CBC(unkStruct_8094924 *param_1, ActionContainer *action)
|
||||
void ReadActionContainer(DataSerializer *param_1, ActionContainer *action)
|
||||
{
|
||||
action->action = ACTION_NOTHING;
|
||||
sub_8082FE0(param_1, &action->direction, 1);
|
||||
action->fill3 = 7;
|
||||
sub_80831F8(param_1, &action->itemTargetPosition);
|
||||
ReadBytes(param_1, &action->direction, 1);
|
||||
action->unk3 = 7;
|
||||
ReadPosition8(param_1, &action->itemTargetPosition);
|
||||
}
|
||||
|
||||
void sub_8082CE4(unkStruct_8094924 *param_1, AITarget *aitarget)
|
||||
void ReadAITarget(DataSerializer *param_1, AITarget *aitarget)
|
||||
{
|
||||
sub_8082FE0(param_1, (u8 *)&aitarget->aiObjective, 1);
|
||||
aitarget->aiNotNextToTarget = sub_80831DC(param_1);
|
||||
aitarget->aiTargetingEnemy = sub_80831DC(param_1);
|
||||
aitarget->aiTurningAround = sub_80831DC(param_1);
|
||||
aitarget->aiTargetSpawnGenID = sub_8083158(param_1);
|
||||
ReadBytes(param_1, &aitarget->aiObjective, 1);
|
||||
aitarget->aiNotNextToTarget = ReadBool8(param_1);
|
||||
aitarget->aiTargetingEnemy = ReadBool8(param_1);
|
||||
aitarget->aiTurningAround = ReadBool8(param_1);
|
||||
aitarget->aiTargetSpawnGenID = ReadU16(param_1);
|
||||
aitarget->aiTarget = NULL;
|
||||
aitarget->unkC = 0;
|
||||
sub_80831F8(param_1, &aitarget->aiTargetPos);
|
||||
ReadPosition8(param_1, &aitarget->aiTargetPos);
|
||||
}
|
||||
|
||||
void sub_8082D28(unkStruct_8094924 *param_1, u8 *param_2)
|
||||
void Read3Bytes(DataSerializer *param_1, u8 *dst)
|
||||
{
|
||||
sub_8082FE0(param_1, param_2, 3);
|
||||
ReadBytes(param_1, dst, 3);
|
||||
}
|
||||
|
||||
void sub_8082D34(unkStruct_8094924 *param_1, Sleep *sleep)
|
||||
void ReadSleep(DataSerializer *param_1, Sleep *sleep)
|
||||
{
|
||||
sub_8082FE0(param_1, &sleep->sleep, 1);
|
||||
sleep->sleepTurns = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &sleep->sleep, 1);
|
||||
sleep->sleepTurns = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082D50(unkStruct_8094924 *param_1, NonVolatile *nonvoltaile)
|
||||
void ReadNonVolatile(DataSerializer *param_1, NonVolatile *nonvolatile)
|
||||
{
|
||||
sub_8082FE0(param_1, &nonvoltaile->nonVolatileStatus, 1);
|
||||
nonvoltaile->nonVolatileStatusTurns = sub_8083188(param_1);
|
||||
nonvoltaile->nonVolatileStatusDamageCountdown = sub_8083188(param_1);
|
||||
nonvoltaile->unk4 = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &nonvolatile->nonVolatileStatus, 1);
|
||||
nonvolatile->nonVolatileStatusTurns = ReadU8(param_1);
|
||||
nonvolatile->nonVolatileStatusDamageCountdown = ReadU8(param_1);
|
||||
nonvolatile->unk4 = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082D7C(unkStruct_8094924 *param_1, Immobilize *immobilze)
|
||||
void ReadImmobilize(DataSerializer *param_1, Immobilize *immobilize)
|
||||
{
|
||||
sub_8082FE0(param_1, &immobilze->immobilizeStatus, 1);
|
||||
immobilze->immobilizeStatusTurns = sub_8083188(param_1);
|
||||
immobilze->immobilizeStatusDamageCountdown = sub_8083188(param_1);
|
||||
immobilze->unk4 = sub_80831A0(param_1);
|
||||
ReadBytes(param_1, &immobilize->immobilizeStatus, 1);
|
||||
immobilize->immobilizeStatusTurns = ReadU8(param_1);
|
||||
immobilize->immobilizeStatusDamageCountdown = ReadU8(param_1);
|
||||
immobilize->unk4 = sub_80831A0(param_1);
|
||||
}
|
||||
|
||||
void sub_8082DA8(unkStruct_8094924 *param_1, Volatile *volatileStatus)
|
||||
void ReadVolatileStatus(DataSerializer *param_1, Volatile *volatileStatus)
|
||||
{
|
||||
sub_8082FE0(param_1, &volatileStatus->volatileStatus, 1);
|
||||
volatileStatus->volatileStatusTurns = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &volatileStatus->volatileStatus, 1);
|
||||
volatileStatus->volatileStatusTurns = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082DC4(unkStruct_8094924 *param_1, Charging *charging)
|
||||
void ReadCharging(DataSerializer *param_1, Charging *charging)
|
||||
{
|
||||
sub_8082FE0(param_1, &charging->chargingStatus, 1);
|
||||
charging->chargingStatusTurns = sub_8083188(param_1);
|
||||
charging->chargingStatusMoveIndex = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &charging->chargingStatus, 1);
|
||||
charging->chargingStatusTurns = ReadU8(param_1);
|
||||
charging->chargingStatusMoveIndex = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082DE8(unkStruct_8094924 *param_1, Protection *protect)
|
||||
void ReadProtection(DataSerializer *param_1, Protection *protect)
|
||||
{
|
||||
sub_8082FE0(param_1, &protect->protectionStatus, 1);
|
||||
protect->protectionStatusTurns = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &protect->protectionStatus, 1);
|
||||
protect->protectionStatusTurns = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082E04(unkStruct_8094924 *param_1, Waiting *waiting)
|
||||
void ReadWaiting(DataSerializer *param_1, Waiting *waiting)
|
||||
{
|
||||
sub_8082FE0(param_1, &waiting->waitingStatus, 1);
|
||||
waiting->enemyDecoy = sub_80831DC(param_1);
|
||||
waiting->unkCA = sub_80831DC(param_1);
|
||||
waiting->waitingStatusTurns = sub_8083188(param_1);
|
||||
waiting->curseDamageCountdown = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &waiting->waitingStatus, 1);
|
||||
waiting->enemyDecoy = ReadBool8(param_1);
|
||||
waiting->unkCA = ReadBool8(param_1);
|
||||
waiting->waitingStatusTurns = ReadU8(param_1);
|
||||
waiting->curseDamageCountdown = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082E38(unkStruct_8094924 *param_1, Linked *linked)
|
||||
void ReadLinked(DataSerializer *param_1, Linked *linked)
|
||||
{
|
||||
sub_8082FE0(param_1, &linked->linkedStatus, 1);
|
||||
ReadBytes(param_1, &linked->linkedStatus, 1);
|
||||
linked->unkD4 = sub_80831A0(param_1);
|
||||
linked->unkD8 = sub_8083188(param_1);
|
||||
linked->linkedStatusTurns = sub_8083188(param_1);
|
||||
linked->linkedStatusDamageCountdown = sub_8083188(param_1);
|
||||
linked->unkD8 = ReadU8(param_1);
|
||||
linked->linkedStatusTurns = ReadU8(param_1);
|
||||
linked->linkedStatusDamageCountdown = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082E6C(unkStruct_8094924 *param_1, MoveStatus *moveStatus)
|
||||
void ReadMoveStatus(DataSerializer *param_1, MoveStatus *moveStatus)
|
||||
{
|
||||
sub_8082FE0(param_1, &moveStatus->moveStatus, 1);
|
||||
moveStatus->moveStatusTurns = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &moveStatus->moveStatus, 1);
|
||||
moveStatus->moveStatusTurns = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082E88(unkStruct_8094924 *param_1, u8 *param_2, s32 size)
|
||||
void sub_8082E88(DataSerializer *param_1, void *dst, s32 param_3)
|
||||
{
|
||||
sub_8082FE0(param_1, param_2, 1);
|
||||
ReadBytes(param_1, dst, 1);
|
||||
}
|
||||
|
||||
void sub_8082E94(unkStruct_8094924 *param_1, TransformStatus *transform)
|
||||
void ReadTransformStatus(DataSerializer *param_1, TransformStatus *transform)
|
||||
{
|
||||
sub_8082FE0(param_1, &transform->transformStatus, 1);
|
||||
transform->transformStatusTurns = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &transform->transformStatus, 1);
|
||||
transform->transformStatusTurns = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082EB0(unkStruct_8094924 *param_1, EyesightStatus *eyesight)
|
||||
void ReadEyesightStatus(DataSerializer *param_1, EyesightStatus *eyesight)
|
||||
{
|
||||
sub_8082FE0(param_1, &eyesight->eyesightStatus, 1);
|
||||
eyesight->eyesightStatusTurns = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &eyesight->eyesightStatus, 1);
|
||||
eyesight->eyesightStatusTurns = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082ECC(unkStruct_8094924 *param_1, Muzzled *muzzle)
|
||||
void ReadMuzzled(DataSerializer *param_1, Muzzled *muzzle)
|
||||
{
|
||||
sub_8082FE0(param_1, (u8 *)&muzzle->muzzled, 1);
|
||||
muzzle->muzzledTurns = sub_8083188(param_1);
|
||||
ReadBytes(param_1, &muzzle->muzzled, 1);
|
||||
muzzle->muzzledTurns = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void RestoreDungeonPokemonMove(unkStruct_8094924 *param_1, Move *move)
|
||||
void RestoreDungeonPokemonMove(DataSerializer *param_1, Move *move)
|
||||
{
|
||||
move->moveFlags = sub_8083188(param_1);
|
||||
move->moveFlags2 = sub_8083188(param_1);
|
||||
sub_8082FE0(param_1, (u8 *)&move->id, 2);
|
||||
move->PP = sub_8083188(param_1);
|
||||
move->ginseng = sub_8083188(param_1);
|
||||
move->moveFlags = ReadU8(param_1);
|
||||
move->moveFlags2 = ReadU8(param_1);
|
||||
ReadBytes(param_1, &move->id, 2);
|
||||
move->PP = ReadU8(param_1);
|
||||
move->ginseng = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082F1C(unkStruct_8094924 *param_1,Move *moves)
|
||||
void ReadMoves(DataSerializer *param_1, Moves *moves)
|
||||
{
|
||||
s32 index;
|
||||
Move *move;
|
||||
for(index = 0; index < MAX_MON_MOVES; index++)
|
||||
{
|
||||
move = &moves[index];
|
||||
|
||||
for (index = 0; index < MAX_MON_MOVES; index++) {
|
||||
move = &moves->moves[index];
|
||||
RestoreDungeonPokemonMove(param_1, move);
|
||||
}
|
||||
*(u8 *)(moves + 4) = sub_8083188(param_1); // TODO: struggleMoveFlags again
|
||||
|
||||
moves->struggleMoveFlags = ReadU8(param_1);
|
||||
}
|
||||
|
||||
|
||||
void sub_8082F48(unkStruct_8094924 *param_1, u16 *r1)
|
||||
// TODO: R1 struct
|
||||
void sub_8082F48(DataSerializer *param_1, u16 *r1)
|
||||
{
|
||||
r1[0] = sub_8083170(param_1);
|
||||
r1[1] = sub_8083170(param_1);
|
||||
r1[0] = ReadS16(param_1);
|
||||
r1[1] = ReadS16(param_1);
|
||||
}
|
||||
|
||||
void sub_8082F64(unkStruct_8094924 *param_1, JoinedAt *joined)
|
||||
void ReadJoinedAt(DataSerializer *param_1, JoinedAt *joined)
|
||||
{
|
||||
joined->joinedAt = sub_8083188(param_1);
|
||||
joined->unk1 = sub_8083188(param_1);
|
||||
joined->joinedAt = ReadU8(param_1);
|
||||
joined->unk1 = ReadU8(param_1);
|
||||
}
|
||||
|
||||
void sub_8082F80(unkStruct_8094924 *param_1, HiddenPower *hidden)
|
||||
void ReadHiddenPower(DataSerializer *param_1, HiddenPower *hidden)
|
||||
{
|
||||
hidden->hiddenPowerBasePower = sub_8083170(param_1);
|
||||
hidden->hiddenPowerBasePower = ReadS16(param_1);
|
||||
hidden->hiddenPowerType = sub_8082BFC(param_1);
|
||||
}
|
||||
|
||||
void sub_8082F9C(unkStruct_8094924 *param_1, u8 *r1, u32 r2)
|
||||
void InitByteWriter(DataSerializer *param_1, u8 *dst, u32 capacity)
|
||||
{
|
||||
param_1->unk0 = r1;
|
||||
param_1->unk8 = 0;
|
||||
param_1->unk4 = r1 + r2;
|
||||
param_1->stream = dst;
|
||||
param_1->count = 0;
|
||||
param_1->end = dst + capacity;
|
||||
}
|
||||
|
||||
void sub_8082FA8(unkStruct_8094924 *param_1, u8 *param_2, s32 size)
|
||||
void WriteBytes(DataSerializer *param_1, void *src, s32 numBytes)
|
||||
{
|
||||
while (size != 0) {
|
||||
*(param_1->unk0) = *param_2;
|
||||
param_1->unk0++;
|
||||
param_2++;
|
||||
size--;
|
||||
param_1->unk8++;
|
||||
u8 *curByte;
|
||||
|
||||
curByte = src;
|
||||
|
||||
while (numBytes != 0) {
|
||||
*param_1->stream = *curByte;
|
||||
param_1->stream++;
|
||||
curByte++;
|
||||
numBytes--;
|
||||
param_1->count++;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8082FD4(unkStruct_8094924 *param_1, u8 *r1, u32 r2)
|
||||
void InitByteReader(DataSerializer *param_1, u8 *src, u32 length)
|
||||
{
|
||||
param_1->unk0 = r1;
|
||||
param_1->unk8 = 0;
|
||||
param_1->unk4 = r1 + r2;
|
||||
param_1->stream = src;
|
||||
param_1->count = 0;
|
||||
param_1->end = src + length;
|
||||
}
|
||||
|
||||
void sub_8082FE0(unkStruct_8094924 *param_1, u8 *param_2, s32 size)
|
||||
void ReadBytes(DataSerializer *param_1, void *dst, s32 numBytes)
|
||||
{
|
||||
while (size != 0) {
|
||||
*param_2 = *(param_1->unk0);
|
||||
param_1->unk0++;
|
||||
param_2++;
|
||||
size--;
|
||||
param_1->unk8++;
|
||||
u8 *curByte;
|
||||
|
||||
curByte = dst;
|
||||
|
||||
while (numBytes != 0) {
|
||||
*curByte = *param_1->stream;
|
||||
param_1->stream++;
|
||||
curByte++;
|
||||
numBytes--;
|
||||
param_1->count++;
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_98(unkStruct_8094924 *param_1)
|
||||
{}
|
||||
|
||||
void sub_808300C(unkStruct_8094924 *param_1, u8 *param_2)
|
||||
// Finished reading/writing dungeon
|
||||
void nullsub_98(DataSerializer *param_1)
|
||||
{
|
||||
sub_8082FA8(param_1, param_2, 8);
|
||||
}
|
||||
|
||||
void sub_8083018(unkStruct_8094924 *param_1)
|
||||
void Write8Bytes(DataSerializer *param_1, u8 *src)
|
||||
{
|
||||
WriteBytes(param_1, src, 8);
|
||||
}
|
||||
|
||||
void sub_8083018(DataSerializer *param_1)
|
||||
{
|
||||
u8 auStack_10 [12];
|
||||
|
||||
sub_8082FE0(param_1,auStack_10,8);
|
||||
ReadBytes(param_1, auStack_10, 8);
|
||||
auStack_10[8] = 0;
|
||||
}
|
||||
|
||||
void sub_8083030(unkStruct_8094924 *param_1, u16 param_2)
|
||||
void WriteU16(DataSerializer *param_1, u16 value)
|
||||
{
|
||||
u16 uStack_8;
|
||||
|
||||
uStack_8 = param_2;
|
||||
sub_8082FA8(param_1,(u8 *)&uStack_8,2);
|
||||
uStack_8 = value;
|
||||
|
||||
WriteBytes(param_1, &uStack_8, 2);
|
||||
}
|
||||
|
||||
void sub_8083048(unkStruct_8094924 *param_1, u32 param_2)
|
||||
void WriteS16(DataSerializer *param_1, u32 value)
|
||||
{
|
||||
u16 uStack_8;
|
||||
|
||||
uStack_8 = param_2;
|
||||
sub_8082FA8(param_1,(u8 *)&uStack_8,2);
|
||||
uStack_8 = value;
|
||||
|
||||
WriteBytes(param_1, &uStack_8, 2);
|
||||
}
|
||||
|
||||
void sub_8083060(unkStruct_8094924 *param_1, u32 param_2)
|
||||
void WriteU8(DataSerializer *param_1, u32 value)
|
||||
{
|
||||
u8 uStack_8;
|
||||
|
||||
uStack_8 = param_2;
|
||||
sub_8082FA8(param_1,&uStack_8,1);
|
||||
uStack_8 = value;
|
||||
|
||||
WriteBytes(param_1, &uStack_8, 1);
|
||||
}
|
||||
|
||||
void sub_8083078(unkStruct_8094924 *param_1, u32 param_2)
|
||||
void WriteU32(DataSerializer *param_1, u32 value)
|
||||
{
|
||||
u32 uStack_8;
|
||||
|
||||
uStack_8 = param_2;
|
||||
sub_8082FA8(param_1,(u8 *)&uStack_8,4);
|
||||
uStack_8 = value;
|
||||
|
||||
WriteBytes(param_1, &uStack_8, 4);
|
||||
}
|
||||
|
||||
void sub_808308C(unkStruct_8094924 *param_1, u32 param_2)
|
||||
UNUSED void sub_808308C(DataSerializer *param_1, u32 value)
|
||||
{
|
||||
u32 uStack_8;
|
||||
|
||||
uStack_8 = param_2;
|
||||
sub_8082FA8(param_1,(u8 *)&uStack_8,4);
|
||||
uStack_8 = value;
|
||||
|
||||
WriteBytes(param_1, &uStack_8, 4);
|
||||
}
|
||||
|
||||
void sub_80830A0(unkStruct_8094924 *param_1, u32 param_2)
|
||||
void WriteS32(DataSerializer *param_1, u32 value)
|
||||
{
|
||||
u32 uStack_8;
|
||||
|
||||
uStack_8 = param_2;
|
||||
sub_8082FA8(param_1,(u8 *)&uStack_8,4);
|
||||
uStack_8 = value;
|
||||
|
||||
WriteBytes(param_1, &uStack_8, 4);
|
||||
}
|
||||
|
||||
void sub_80830B4(unkStruct_8094924 *param_1, u8 param_2)
|
||||
void WriteBool8(DataSerializer *param_1, bool8 value)
|
||||
{
|
||||
u8 local_8;
|
||||
|
||||
local_8 = (param_2 != 0) ? -1 : 0;
|
||||
sub_8082FA8(param_1,&local_8,1);
|
||||
local_8 = value ? -1 : 0;
|
||||
|
||||
WriteBytes(param_1, &local_8, 1);
|
||||
}
|
||||
|
||||
void SavePosition(unkStruct_8094924 *param_1, Position *param_2)
|
||||
void WritePosition8(DataSerializer *param_1, Position *param_2)
|
||||
{
|
||||
sub_8082FA8(param_1, (u8 *)¶m_2->x, 1);
|
||||
sub_8082FA8(param_1, (u8 *)¶m_2->y, 1);
|
||||
WriteBytes(param_1, ¶m_2->x, 1);
|
||||
WriteBytes(param_1, ¶m_2->y, 1);
|
||||
}
|
||||
|
||||
void sub_80830F8(unkStruct_8094924 *param_1, u32 *param_2)
|
||||
// TODO: param_2 struct
|
||||
void sub_80830F8(DataSerializer *param_1, u32 *param_2)
|
||||
{
|
||||
sub_8082FA8(param_1, (u8 *)¶m_2[0], 1);
|
||||
sub_8082FA8(param_1, (u8 *)¶m_2[1], 1);
|
||||
sub_8082FA8(param_1, (u8 *)¶m_2[2], 1);
|
||||
sub_8082FA8(param_1, (u8 *)¶m_2[3], 1);
|
||||
WriteBytes(param_1, ¶m_2[0], 1);
|
||||
WriteBytes(param_1, ¶m_2[1], 1);
|
||||
WriteBytes(param_1, ¶m_2[2], 1);
|
||||
WriteBytes(param_1, ¶m_2[3], 1);
|
||||
}
|
||||
|
||||
void sub_808312C(unkStruct_8094924 *param_1, u16 *param_2)
|
||||
// TODO: param_2 struct
|
||||
void sub_808312C(DataSerializer *param_1, u16 *param_2)
|
||||
{
|
||||
sub_8082FA8(param_1, (u8 *)¶m_2[0], 1);
|
||||
sub_8082FA8(param_1, (u8 *)¶m_2[1], 1);
|
||||
WriteBytes(param_1, ¶m_2[0], 1);
|
||||
WriteBytes(param_1, ¶m_2[1], 1);
|
||||
}
|
||||
|
||||
void SaveSpeedCounters(unkStruct_8094924 *param_1, u32 *speedCounters, u32 numCounters)
|
||||
void xxx_WriteBytes(DataSerializer *param_1, void *src, u32 numBytes)
|
||||
{
|
||||
sub_8082FA8(param_1, (u8 *)speedCounters, numCounters);
|
||||
WriteBytes(param_1, src, numBytes);
|
||||
}
|
||||
|
||||
u16 sub_8083158(unkStruct_8094924 *param_1)
|
||||
u16 ReadU16(DataSerializer *param_1)
|
||||
{
|
||||
u16 local_8;
|
||||
|
||||
sub_8082FE0(param_1,(u8 *)&local_8,2);
|
||||
ReadBytes(param_1, &local_8, 2);
|
||||
return local_8;
|
||||
}
|
||||
|
||||
s16 sub_8083170(unkStruct_8094924 *param_1)
|
||||
s16 ReadS16(DataSerializer *param_1)
|
||||
{
|
||||
s16 local_8;
|
||||
|
||||
sub_8082FE0(param_1,(u8 *)&local_8,2);
|
||||
ReadBytes(param_1, &local_8, 2);
|
||||
return local_8;
|
||||
}
|
||||
|
||||
u8 sub_8083188(unkStruct_8094924 *param_1)
|
||||
u8 ReadU8(DataSerializer *param_1)
|
||||
{
|
||||
u8 local_8;
|
||||
|
||||
sub_8082FE0(param_1,&local_8,1);
|
||||
ReadBytes(param_1, &local_8, 1);
|
||||
return local_8;
|
||||
}
|
||||
|
||||
u32 sub_80831A0(unkStruct_8094924 *param_1)
|
||||
// ReadS32 or ReadU32 ?
|
||||
u32 sub_80831A0(DataSerializer *param_1)
|
||||
{
|
||||
u32 local_8;
|
||||
|
||||
sub_8082FE0(param_1,(u8 *)&local_8,4);
|
||||
ReadBytes(param_1, &local_8, 4);
|
||||
return local_8;
|
||||
}
|
||||
|
||||
u32 sub_80831B4(unkStruct_8094924 *param_1)
|
||||
UNUSED u32 sub_80831B4(DataSerializer *param_1)
|
||||
{
|
||||
u32 local_8;
|
||||
|
||||
sub_8082FE0(param_1,(u8 *)&local_8,4);
|
||||
ReadBytes(param_1, &local_8, 4);
|
||||
return local_8;
|
||||
}
|
||||
|
||||
u32 sub_80831C8(unkStruct_8094924 *param_1)
|
||||
// ?
|
||||
u32 sub_80831C8(DataSerializer *param_1)
|
||||
{
|
||||
u32 local_8;
|
||||
|
||||
sub_8082FE0(param_1,(u8 *)&local_8,4);
|
||||
ReadBytes(param_1, &local_8, 4);
|
||||
return local_8;
|
||||
}
|
||||
|
||||
bool8 sub_80831DC(unkStruct_8094924 *param_1)
|
||||
bool8 ReadBool8(DataSerializer *param_1)
|
||||
{
|
||||
u8 local_8;
|
||||
|
||||
sub_8082FE0(param_1,&local_8,1);
|
||||
ReadBytes(param_1, &local_8, 1);
|
||||
return local_8 != 0;
|
||||
}
|
||||
|
||||
void sub_80831F8(unkStruct_8094924 *param_1,Position *param_2)
|
||||
void ReadPosition8(DataSerializer *param_1, Position *param_2)
|
||||
{
|
||||
param_2->x = 0;
|
||||
param_2->y = 0;
|
||||
sub_8082FE0(param_1,(u8 *)¶m_2->x,1);
|
||||
sub_8082FE0(param_1,(u8 *)¶m_2->y,1);
|
||||
ReadBytes(param_1, ¶m_2->x, 1);
|
||||
ReadBytes(param_1, ¶m_2->y, 1);
|
||||
}
|
||||
|
||||
|
||||
void sub_8083220(unkStruct_8094924 *param_1,u32 *param_2)
|
||||
// TODO: param_2 struct
|
||||
void sub_8083220(DataSerializer *param_1, u32 *param_2)
|
||||
{
|
||||
param_2[0] = 0;
|
||||
param_2[1] = 0;
|
||||
param_2[2] = 0;
|
||||
param_2[3] = 0;
|
||||
sub_8082FE0(param_1,(u8 *)¶m_2[0],1);
|
||||
sub_8082FE0(param_1,(u8 *)¶m_2[1],1);
|
||||
sub_8082FE0(param_1,(u8 *)¶m_2[2],1);
|
||||
sub_8082FE0(param_1,(u8 *)¶m_2[3],1);
|
||||
ReadBytes(param_1, ¶m_2[0], 1);
|
||||
ReadBytes(param_1, ¶m_2[1], 1);
|
||||
ReadBytes(param_1, ¶m_2[2], 1);
|
||||
ReadBytes(param_1, ¶m_2[3], 1);
|
||||
}
|
||||
|
||||
void sub_8083260(unkStruct_8094924 *param_1,u16 *param_2)
|
||||
// TODO: param_2 struct
|
||||
void sub_8083260(DataSerializer *param_1, u16 *param_2)
|
||||
{
|
||||
param_2[0] = 0;
|
||||
param_2[1] = 0;
|
||||
sub_8082FE0(param_1,(u8 *)¶m_2[0],1);
|
||||
sub_8082FE0(param_1,(u8 *)¶m_2[1],1);
|
||||
ReadBytes(param_1, ¶m_2[0], 1);
|
||||
ReadBytes(param_1, ¶m_2[1], 1);
|
||||
}
|
||||
|
||||
void sub_8083288(unkStruct_8094924 *r0, u16 *r1, u32 size)
|
||||
void xxx_ReadBytes(DataSerializer *r0, u8 *dst, u32 numBytes)
|
||||
{
|
||||
sub_8082FE0(r0, (u8 *)r1, size);
|
||||
}
|
||||
|
||||
ReadBytes(r0, dst, numBytes);
|
||||
}
|
@ -19,136 +19,109 @@ s16 sub_8094828(u16 moveID, u8 id)
|
||||
}
|
||||
}
|
||||
|
||||
void xxx_init_struct_8094924_restore_809485C(struct unkStruct_8094924 *r0, u8 *r1, s32 size)
|
||||
|
||||
|
||||
// New file here
|
||||
|
||||
|
||||
void InitBitReader(DataSerializer *r0, u8 *buffer, s32 bufLen)
|
||||
{
|
||||
r0->unk0 = r1;
|
||||
r0->unk8 = 0;
|
||||
r0->stream = buffer;
|
||||
r0->count = 0;
|
||||
r0->unkC = 0;
|
||||
r0->unk4 = &r1[size];
|
||||
r0->end = buffer + bufLen;
|
||||
}
|
||||
|
||||
void xxx_init_struct_8094924_save_809486C(struct unkStruct_8094924 *r0, u8 *r1, s32 size)
|
||||
void InitBitWriter(DataSerializer *r0, u8 *buffer, s32 bufLen)
|
||||
{
|
||||
r0->unk0 = r1;
|
||||
r0->unk8 = 0;
|
||||
r0->stream = buffer;
|
||||
r0->count = 0;
|
||||
r0->unkC = 0;
|
||||
r0->unk4 = &r1[size];
|
||||
MemoryClear8(r1, size);
|
||||
r0->end = buffer + bufLen;
|
||||
MemoryClear8(buffer, bufLen);
|
||||
}
|
||||
|
||||
// Related to reading/writing bits
|
||||
void nullsub_102(struct unkStruct_8094924 *r0)
|
||||
// Finish reading/writing bits
|
||||
void nullsub_102(DataSerializer *r0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SaveIntegerBits(struct unkStruct_8094924 *r0, void *r1, s32 size)
|
||||
void WriteBits(DataSerializer *r0, void *src, s32 numBits)
|
||||
{
|
||||
s32 r5;
|
||||
u8 *r6;
|
||||
s32 curBit;
|
||||
u8 *curByte;
|
||||
|
||||
r5 = 0;
|
||||
r6 = r1;
|
||||
curBit = 0;
|
||||
curByte = src;
|
||||
|
||||
while (numBits != 0) {
|
||||
if ((*curByte >> curBit) & 1)
|
||||
*r0->stream |= (1 << r0->count);
|
||||
|
||||
if(size != 0)
|
||||
{
|
||||
while(size != 0)
|
||||
{
|
||||
if(( *(r6) >> r5) & 1)
|
||||
{
|
||||
*r0->unk0 |= (1 << r0->unk8);
|
||||
}
|
||||
r5++;
|
||||
if(r5 == 8)
|
||||
{
|
||||
r6++;
|
||||
r5 = 0;
|
||||
}
|
||||
r0->unk8++;
|
||||
if(r0->unk8 == 8)
|
||||
{
|
||||
r0->unk0++;
|
||||
r0->unk8 = 0;
|
||||
}
|
||||
r0->unkC++;
|
||||
size--;
|
||||
curBit++;
|
||||
if (curBit == 8) {
|
||||
curByte++;
|
||||
curBit = 0;
|
||||
}
|
||||
|
||||
r0->count++;
|
||||
if (r0->count == 8) {
|
||||
r0->stream++;
|
||||
r0->count = 0;
|
||||
}
|
||||
|
||||
r0->unkC++;
|
||||
numBits--;
|
||||
}
|
||||
}
|
||||
|
||||
// Unused
|
||||
NAKED
|
||||
void sub_80948E4(struct unkStruct_8094924 *r0, u8 *r1, s32 size)
|
||||
UNUSED void sub_80948E4(DataSerializer *seri, void *src, s32 numBytes)
|
||||
{
|
||||
asm_unified("\tpush {r4-r6,lr}\n"
|
||||
"\tadds r4, r0, 0\n"
|
||||
"\tadds r5, r2, 0\n"
|
||||
"\tadds r6, r1, 0\n"
|
||||
"\tcmp r5, 0\n"
|
||||
"\tbeq _0809491C\n"
|
||||
"_080948F0:\n"
|
||||
"\tldrb r1, [r6]\n"
|
||||
"\tldr r0, [r4, 0x8]\n"
|
||||
"\tlsls r1, r0\n"
|
||||
"\tldr r3, [r4]\n"
|
||||
"\tldrb r2, [r3]\n"
|
||||
"\tadds r0, r1, 0\n"
|
||||
"\torrs r0, r2\n"
|
||||
"\tstrb r0, [r3]\n"
|
||||
"\tldr r2, [r4]\n"
|
||||
"\tadds r0, r2, 0x1\n"
|
||||
"\tstr r0, [r4]\n"
|
||||
"\tasrs r1, 8\n"
|
||||
"\tldrb r0, [r2, 0x1]\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tstrb r1, [r2, 0x1]\n"
|
||||
"\tadds r6, 0x1\n"
|
||||
"\tldr r0, [r4, 0xC]\n"
|
||||
"\tadds r0, 0x8\n"
|
||||
"\tstr r0, [r4, 0xC]\n"
|
||||
"\tsubs r5, 0x1\n"
|
||||
"\tcmp r5, 0\n"
|
||||
"\tbne _080948F0\n"
|
||||
"_0809491C:\n"
|
||||
"\tpop {r4-r6}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0");
|
||||
}
|
||||
s32 iVar1;
|
||||
u8 *curByte;
|
||||
|
||||
void RestoreIntegerBits(struct unkStruct_8094924 *r0, void *r1, s32 size)
|
||||
{
|
||||
s32 r6;
|
||||
u8 *r2;
|
||||
curByte = src;
|
||||
|
||||
r6 = 0;
|
||||
r2 = r1;
|
||||
|
||||
|
||||
if(size != 0)
|
||||
{
|
||||
while(size != 0)
|
||||
{
|
||||
if(r6 == 0)
|
||||
*r2 = 0;
|
||||
if(( *(r0->unk0) >> r0->unk8) & 1)
|
||||
{
|
||||
*r2 |= (1 << r6);
|
||||
}
|
||||
r6++;
|
||||
if(r6 == 8)
|
||||
{
|
||||
r2++;
|
||||
r6 = 0;
|
||||
}
|
||||
r0->unk8++;
|
||||
if(r0->unk8 == 8)
|
||||
{
|
||||
r0->unk0++;
|
||||
r0->unk8 = 0;
|
||||
}
|
||||
r0->unkC++;
|
||||
size--;
|
||||
}
|
||||
while (numBytes != 0) {
|
||||
iVar1 = (*curByte << seri->count);
|
||||
*seri->stream |= iVar1;
|
||||
seri->stream++;
|
||||
*seri->stream |= iVar1 >> 8;
|
||||
curByte++;
|
||||
seri->unkC += 8;
|
||||
numBytes--;
|
||||
}
|
||||
}
|
||||
|
||||
void ReadBits(DataSerializer *r0, void *dst, s32 numBits)
|
||||
{
|
||||
s32 curBit;
|
||||
u8 *curByte;
|
||||
|
||||
curBit = 0;
|
||||
curByte = dst;
|
||||
|
||||
while (numBits != 0) {
|
||||
if (curBit == 0)
|
||||
*curByte = 0;
|
||||
|
||||
if ((*r0->stream >> r0->count) & 1)
|
||||
*curByte |= (1 << curBit);
|
||||
|
||||
curBit++;
|
||||
if (curBit == 8) {
|
||||
curByte++;
|
||||
curBit = 0;
|
||||
}
|
||||
|
||||
r0->count++;
|
||||
if (r0->count == 8) {
|
||||
r0->stream++;
|
||||
r0->count = 0;
|
||||
}
|
||||
|
||||
r0->unkC++;
|
||||
numBits--;
|
||||
}
|
||||
}
|
@ -35,16 +35,16 @@ extern const u8 *gUnknown_8113870[];
|
||||
|
||||
extern struct unkStruct_8113080 gUnknown_8113080[];
|
||||
|
||||
void sub_809447C(struct unkStruct_8094924 *r0, u8 *r1)
|
||||
void ReadBellyBits(DataSerializer *r0, FixedPoint *dst)
|
||||
{
|
||||
RestoreIntegerBits(r0, r1, 0x10);
|
||||
RestoreIntegerBits(r0, r1 + 2, 0x10);
|
||||
ReadBits(r0, &dst->unk0, 16);
|
||||
ReadBits(r0, &dst->unk2, 16);
|
||||
}
|
||||
|
||||
void sub_809449C(struct unkStruct_8094924 *r0, u8 *r1)
|
||||
void WriteBellyBits(DataSerializer *r0, FixedPoint *src)
|
||||
{
|
||||
SaveIntegerBits(r0, r1, 0x10);
|
||||
SaveIntegerBits(r0, r1 + 2, 0x10);
|
||||
WriteBits(r0, &src->unk0, 16);
|
||||
WriteBits(r0, &src->unk2, 16);
|
||||
}
|
||||
|
||||
static void sub_80944BC(s16 moveID, u8 *buffer)
|
||||
|
@ -21,10 +21,10 @@ EWRAM_DATA UNUSED static u32 fill0 = {0}; // 203B484 is size 0x5C and I need to
|
||||
EWRAM_DATA u32 gUnknown_20392E8[0x36] = {0};
|
||||
EWRAM_DATA unkStruct_203B48C gUnknown_20393C0 = {0};
|
||||
|
||||
extern void SaveDungeonLocation(struct unkStruct_8094924*, DungeonLocation*);
|
||||
extern void RestoreDungeonLocation(struct unkStruct_8094924*, DungeonLocation*);
|
||||
extern void xxx_save_poke_sub_c_808F41C(struct unkStruct_8094924* a1, struct unkPokeSubStruct_C* unkC);
|
||||
extern void xxx_restore_poke_sub_c_808F410(struct unkStruct_8094924*, struct unkPokeSubStruct_C*);
|
||||
extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*);
|
||||
extern void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*);
|
||||
extern void WritePoke1LevelBits(DataSerializer* a1, struct unkPokeSubStruct_C* unkC);
|
||||
extern void ReadPoke1LevelBits(DataSerializer*, struct unkPokeSubStruct_C*);
|
||||
|
||||
void sub_80950BC(void)
|
||||
{
|
||||
@ -78,11 +78,11 @@ void sub_8095118(void)
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_206(void)
|
||||
UNUSED static void nullsub_206(void)
|
||||
{
|
||||
}
|
||||
|
||||
void nullsub_207(void)
|
||||
UNUSED static void nullsub_207(void)
|
||||
{
|
||||
}
|
||||
|
||||
@ -308,141 +308,164 @@ u32 sub_80954B4(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_80954CC(u8 *a, u32 b)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// New file?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
u32 sub_80954CC(u8 *buffer, u32 size)
|
||||
{
|
||||
struct unkStruct_8094924 backup;
|
||||
PokemonStruct1 *temp;
|
||||
s32 index;
|
||||
DataSerializer backup;
|
||||
PokemonStruct1 *mon;
|
||||
s32 i;
|
||||
|
||||
xxx_init_struct_8094924_restore_809485C(&backup, a, b);
|
||||
for(index = 0; index < 0x20; index++)
|
||||
{
|
||||
sub_8095774(&backup, &gUnknown_203B480[index]);
|
||||
}
|
||||
RestoreIntegerBits(&backup, &gUnknown_203B484->unk0, 0x20);
|
||||
temp = &gUnknown_203B484->unk4;
|
||||
memset(temp, 0, sizeof(PokemonStruct1));
|
||||
RestoreIntegerBits(&backup, &temp->unk0, 2);
|
||||
RestoreIntegerBits(&backup, &temp->isTeamLeader, 1);
|
||||
RestoreIntegerBits(&backup, &temp->level, 7);
|
||||
RestoreDungeonLocation(&backup, &temp->dungeonLocation);
|
||||
RestoreIntegerBits(&backup, &temp->speciesNum, 9);
|
||||
xxx_restore_poke_sub_c_808F410(&backup, &temp->unkC[0]);
|
||||
xxx_restore_poke_sub_c_808F410(&backup, &temp->unkC[1]);
|
||||
RestoreIntegerBits(&backup, &temp->IQ, 0xA);
|
||||
RestoreIntegerBits(&backup, &temp->pokeHP, 0xA);
|
||||
RestoreIntegerBits(&backup, &temp->offense.att[0], 8);
|
||||
RestoreIntegerBits(&backup, &temp->offense.att[1], 8);
|
||||
RestoreIntegerBits(&backup, &temp->offense.def[0], 8);
|
||||
RestoreIntegerBits(&backup, &temp->offense.def[1], 8);
|
||||
RestoreIntegerBits(&backup, &temp->currExp, 0x18);
|
||||
RestoreIntegerBits(&backup, &temp->IQSkills, 0x18);
|
||||
RestoreIntegerBits(&backup, &temp->tacticIndex, 4);
|
||||
RestoreHeldItem(&backup, &temp->heldItem);
|
||||
RestorePokemonMoves(&backup, temp->moves);
|
||||
RestoreIntegerBits(&backup, temp->name, 0x50);
|
||||
InitBitReader(&backup, buffer, size);
|
||||
|
||||
RestoreIntegerBits(&backup, &gUnknown_203B48C->unk0, 0x20);
|
||||
for(index = 0; index < 0x20; index++)
|
||||
{
|
||||
RestoreIntegerBits(&backup, &gUnknown_203B48C->unk4[index], 0x20);
|
||||
for (i = 0; i < 32; i++) {
|
||||
sub_8095774(&backup, &gUnknown_203B480[i]);
|
||||
}
|
||||
|
||||
ReadBits(&backup, &gUnknown_203B484->unk0, 32);
|
||||
|
||||
mon = &gUnknown_203B484->unk4;
|
||||
memset(mon, 0, sizeof(PokemonStruct1));
|
||||
|
||||
ReadBits(&backup, &mon->unk0, 2);
|
||||
ReadBits(&backup, &mon->isTeamLeader, 1);
|
||||
ReadBits(&backup, &mon->level, 7);
|
||||
ReadDungeonLocationBits(&backup, &mon->dungeonLocation);
|
||||
ReadBits(&backup, &mon->speciesNum, 9);
|
||||
ReadPoke1LevelBits(&backup, &mon->unkC[0]);
|
||||
ReadPoke1LevelBits(&backup, &mon->unkC[1]);
|
||||
ReadBits(&backup, &mon->IQ, 10);
|
||||
ReadBits(&backup, &mon->pokeHP, 10);
|
||||
ReadBits(&backup, &mon->offense.att[0], 8);
|
||||
ReadBits(&backup, &mon->offense.att[1], 8);
|
||||
ReadBits(&backup, &mon->offense.def[0], 8);
|
||||
ReadBits(&backup, &mon->offense.def[1], 8);
|
||||
ReadBits(&backup, &mon->currExp, 24);
|
||||
ReadBits(&backup, &mon->IQSkills, 24);
|
||||
ReadBits(&backup, &mon->tacticIndex, 4);
|
||||
ReadHeldItemBits(&backup, &mon->heldItem);
|
||||
ReadPoke1MovesBits(&backup, mon->moves);
|
||||
ReadBits(&backup, mon->name, 10 * 8);
|
||||
|
||||
ReadBits(&backup, &gUnknown_203B48C->unk0, 32);
|
||||
for (i = 0; i < 32; i++) {
|
||||
ReadBits(&backup, &gUnknown_203B48C->unk4[i], 32);
|
||||
}
|
||||
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
return backup.count;
|
||||
}
|
||||
|
||||
u32 sub_8095624(u8 *a, u32 b)
|
||||
u32 sub_8095624(u8 *buffer, u32 b)
|
||||
{
|
||||
struct unkStruct_8094924 backup;
|
||||
PokemonStruct1 *temp;
|
||||
s32 index;
|
||||
DataSerializer backup;
|
||||
PokemonStruct1 *mon;
|
||||
s32 i;
|
||||
|
||||
xxx_init_struct_8094924_save_809486C(&backup, a, b);
|
||||
for(index = 0; index < 0x20; index++)
|
||||
{
|
||||
sub_8095824(&backup, &gUnknown_203B480[index]);
|
||||
}
|
||||
SaveIntegerBits(&backup, &gUnknown_203B484->unk0, 0x20);
|
||||
temp = &gUnknown_203B484->unk4;
|
||||
SaveIntegerBits(&backup, &temp->unk0, 2);
|
||||
SaveIntegerBits(&backup, &temp->isTeamLeader, 1);
|
||||
SaveIntegerBits(&backup, &temp->level, 7);
|
||||
SaveDungeonLocation(&backup, &temp->dungeonLocation);
|
||||
SaveIntegerBits(&backup, &temp->speciesNum, 9);
|
||||
xxx_save_poke_sub_c_808F41C(&backup, &temp->unkC[0]);
|
||||
xxx_save_poke_sub_c_808F41C(&backup, &temp->unkC[1]);
|
||||
SaveIntegerBits(&backup, &temp->IQ, 0xA);
|
||||
SaveIntegerBits(&backup, &temp->pokeHP, 0xA);
|
||||
SaveIntegerBits(&backup, &temp->offense.att[0], 8);
|
||||
SaveIntegerBits(&backup, &temp->offense.att[1], 8);
|
||||
SaveIntegerBits(&backup, &temp->offense.def[0], 8);
|
||||
SaveIntegerBits(&backup, &temp->offense.def[1], 8);
|
||||
SaveIntegerBits(&backup, &temp->currExp, 0x18);
|
||||
SaveIntegerBits(&backup, &temp->IQSkills, 0x18);
|
||||
SaveIntegerBits(&backup, &temp->tacticIndex, 4);
|
||||
SaveHeldItem(&backup, &temp->heldItem);
|
||||
SavePokemonMoves(&backup, temp->moves);
|
||||
SaveIntegerBits(&backup, temp->name, 0x50);
|
||||
InitBitWriter(&backup, buffer, b);
|
||||
|
||||
SaveIntegerBits(&backup, &gUnknown_203B48C->unk0, 0x20);
|
||||
for(index = 0; index < 0x20; index++)
|
||||
{
|
||||
SaveIntegerBits(&backup, &gUnknown_203B48C->unk4[index], 0x20);
|
||||
for (i = 0; i < 32; i++) {
|
||||
sub_8095824(&backup, &gUnknown_203B480[i]);
|
||||
}
|
||||
|
||||
WriteBits(&backup, &gUnknown_203B484->unk0, 32);
|
||||
|
||||
mon = &gUnknown_203B484->unk4;
|
||||
|
||||
WriteBits(&backup, &mon->unk0, 2);
|
||||
WriteBits(&backup, &mon->isTeamLeader, 1);
|
||||
WriteBits(&backup, &mon->level, 7);
|
||||
WriteDungeonLocationBits(&backup, &mon->dungeonLocation);
|
||||
WriteBits(&backup, &mon->speciesNum, 9);
|
||||
WritePoke1LevelBits(&backup, &mon->unkC[0]);
|
||||
WritePoke1LevelBits(&backup, &mon->unkC[1]);
|
||||
WriteBits(&backup, &mon->IQ, 10);
|
||||
WriteBits(&backup, &mon->pokeHP, 10);
|
||||
WriteBits(&backup, &mon->offense.att[0], 8);
|
||||
WriteBits(&backup, &mon->offense.att[1], 8);
|
||||
WriteBits(&backup, &mon->offense.def[0], 8);
|
||||
WriteBits(&backup, &mon->offense.def[1], 8);
|
||||
WriteBits(&backup, &mon->currExp, 24);
|
||||
WriteBits(&backup, &mon->IQSkills, 24);
|
||||
WriteBits(&backup, &mon->tacticIndex, 4);
|
||||
WriteHeldItemBits(&backup, &mon->heldItem);
|
||||
WritePoke1MovesBits(&backup, mon->moves);
|
||||
WriteBits(&backup, mon->name, 10 * 8);
|
||||
|
||||
WriteBits(&backup, &gUnknown_203B48C->unk0, 32);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
WriteBits(&backup, &gUnknown_203B48C->unk4[i], 32);
|
||||
}
|
||||
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
return backup.count;
|
||||
}
|
||||
|
||||
void sub_8095774(struct unkStruct_8094924 * a, unkStruct_203B480 *b)
|
||||
void sub_8095774(DataSerializer * a, unkStruct_203B480 *b)
|
||||
{
|
||||
u8 temp;
|
||||
|
||||
RestoreIntegerBits(a, &b->mailType, 4);
|
||||
RestoreDungeonLocation(a, &b->unk4.dungeon);
|
||||
RestoreIntegerBits(a, &b->unk4.seed, 0x18);
|
||||
RestoreIntegerBits(a, &b->clientSpecies, 0x9);
|
||||
RestoreIntegerBits(a, &b->unk10.unk10, 0x20);
|
||||
RestoreIntegerBits(a, &b->playerName, 0x50);
|
||||
RestoreIntegerBits(a, &b->item.flags, 0x8);
|
||||
RestoreIntegerBits(a, &b->item.quantity, 0x8);
|
||||
RestoreIntegerBits(a, &b->item.id, 0x8);
|
||||
RestoreIntegerBits(a, &b->unk24, 0x20);
|
||||
RestoreIntegerBits(a, &b->unk28, 0x20);
|
||||
RestoreIntegerBits(a, &b->rescuesAllowed, 0x8);
|
||||
ReadBits(a, &b->mailType, 4);
|
||||
ReadDungeonLocationBits(a, &b->unk4.dungeon);
|
||||
ReadBits(a, &b->unk4.seed, 24);
|
||||
ReadBits(a, &b->clientSpecies, 9);
|
||||
ReadBits(a, &b->unk10.unk10, 32);
|
||||
ReadBits(a, &b->playerName, 10 * 8);
|
||||
ReadBits(a, &b->item.flags, 8);
|
||||
ReadBits(a, &b->item.quantity, 8);
|
||||
ReadBits(a, &b->item.id, 8);
|
||||
ReadBits(a, &b->unk24, 32);
|
||||
ReadBits(a, &b->unk28, 32);
|
||||
ReadBits(a, &b->rescuesAllowed, 8);
|
||||
|
||||
RestoreIntegerBits(a, &temp, 1);
|
||||
ReadBits(a, &temp, 1);
|
||||
b->unk2D = temp & 1;
|
||||
}
|
||||
|
||||
void sub_8095824(struct unkStruct_8094924 * a, unkStruct_203B480 *b)
|
||||
void sub_8095824(DataSerializer * a, unkStruct_203B480 *b)
|
||||
{
|
||||
u8 neg1;
|
||||
u8 zero;
|
||||
u8 *puVar2;
|
||||
u8 *ptr;
|
||||
|
||||
neg1 = -1;
|
||||
zero = 0;
|
||||
|
||||
SaveIntegerBits(a, &b->mailType, 4);
|
||||
SaveDungeonLocation(a, &b->unk4.dungeon);
|
||||
SaveIntegerBits(a, &b->unk4.seed, 0x18);
|
||||
SaveIntegerBits(a, &b->clientSpecies, 0x9);
|
||||
SaveIntegerBits(a, &b->unk10.unk10, 0x20);
|
||||
SaveIntegerBits(a, &b->playerName, 0x50);
|
||||
SaveIntegerBits(a, &b->item.flags, 0x8);
|
||||
SaveIntegerBits(a, &b->item.quantity, 0x8);
|
||||
SaveIntegerBits(a, &b->item.id, 0x8);
|
||||
SaveIntegerBits(a, &b->unk24, 0x20);
|
||||
SaveIntegerBits(a, &b->unk28, 0x20);
|
||||
SaveIntegerBits(a, &b->rescuesAllowed, 0x8);
|
||||
WriteBits(a, &b->mailType, 4);
|
||||
WriteDungeonLocationBits(a, &b->unk4.dungeon);
|
||||
WriteBits(a, &b->unk4.seed, 24);
|
||||
WriteBits(a, &b->clientSpecies, 9);
|
||||
WriteBits(a, &b->unk10.unk10, 32);
|
||||
WriteBits(a, &b->playerName, 10 * 8);
|
||||
WriteBits(a, &b->item.flags, 8);
|
||||
WriteBits(a, &b->item.quantity, 8);
|
||||
WriteBits(a, &b->item.id, 8);
|
||||
WriteBits(a, &b->unk24, 32);
|
||||
WriteBits(a, &b->unk28, 32);
|
||||
WriteBits(a, &b->rescuesAllowed, 8);
|
||||
|
||||
if(b->unk2D != 0)
|
||||
puVar2 = &neg1;
|
||||
if (b->unk2D != 0)
|
||||
ptr = &neg1;
|
||||
else
|
||||
puVar2 = &zero;
|
||||
SaveIntegerBits(a, puVar2, 1);
|
||||
ptr = &zero;
|
||||
WriteBits(a, ptr, 1);
|
||||
}
|
||||
|
||||
void sub_80958E4(u32 *a, u32 b)
|
||||
{
|
||||
*a = b;
|
||||
}
|
||||
}
|
@ -30,8 +30,8 @@ u8 sub_8095E78(void);
|
||||
bool8 sub_80963B4(void);
|
||||
s32 CalculateMailChecksum(WonderMail *mail);
|
||||
|
||||
extern void SaveDungeonLocation(unkStruct_8094924*, DungeonLocation*);
|
||||
extern void RestoreDungeonLocation(unkStruct_8094924*, DungeonLocation*);
|
||||
extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*);
|
||||
extern void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*);
|
||||
extern void sub_803C4F0(WonderMail *);
|
||||
extern void sub_803C3E0(WonderMail *);
|
||||
extern void sub_803C45C(WonderMail *);
|
||||
@ -1289,13 +1289,13 @@ s32 CalculateMailChecksum(WonderMail *mail)
|
||||
sum += mail->unk4.dungeon.id;
|
||||
sum += mail->unk4.dungeon.floor;
|
||||
|
||||
sum += mail->unk4.seed << 0x8;
|
||||
sum += mail->unk4.seed << 8;
|
||||
|
||||
sum += mail->clientSpecies << 0xC;
|
||||
sum += mail->clientSpecies << 12;
|
||||
|
||||
sum += mail->targetSpecies << 0x10;
|
||||
sum += mail->targetSpecies << 16;
|
||||
|
||||
sum += mail->targetItem << 0x18;
|
||||
sum += mail->targetItem << 24;
|
||||
|
||||
sum += mail->rewardType;
|
||||
|
||||
@ -1310,10 +1310,10 @@ void sub_8096EEC(WonderMail *mail)
|
||||
{
|
||||
s32 index;
|
||||
|
||||
for(index = 15; index > 0; index--)
|
||||
{
|
||||
for (index = 16 - 1; index > 0; index--) {
|
||||
gUnknown_203B490->unk230[index] = gUnknown_203B490->unk230[index - 1];
|
||||
}
|
||||
|
||||
gUnknown_203B490->unk230[0].sub = mail->unk4;
|
||||
gUnknown_203B490->unk230[0].checksum = CalculateMailChecksum(mail);
|
||||
}
|
||||
@ -1326,7 +1326,7 @@ bool8 sub_8096F50(WonderMail *mail)
|
||||
|
||||
checksum = CalculateMailChecksum(mail);
|
||||
|
||||
for (index = 0; index < 0x10; index++) {
|
||||
for (index = 0; index < 16; index++) {
|
||||
temp = &gUnknown_203B490->unk230[index];
|
||||
if (temp->sub.dungeon.id == mail->unk4.dungeon.id)
|
||||
if (temp->sub.dungeon.floor == mail->unk4.dungeon.floor)
|
||||
@ -1341,66 +1341,66 @@ bool8 sub_8096F50(WonderMail *mail)
|
||||
u32 RestoreMailInfo(u8 *r0, u32 size)
|
||||
{
|
||||
s32 index;
|
||||
unkStruct_8094924 backup;
|
||||
DataSerializer backup;
|
||||
u32 temp;
|
||||
|
||||
xxx_init_struct_8094924_restore_809485C(&backup, r0, size);
|
||||
InitBitReader(&backup, r0, size);
|
||||
for(index = 0; index < NUM_MAILBOX_SLOTS; index++)
|
||||
{
|
||||
RestoreWonderMail(&backup, &gUnknown_203B490->mailboxSlots[index]);
|
||||
ReadWonderMailBits(&backup, &gUnknown_203B490->mailboxSlots[index]);
|
||||
}
|
||||
for(index = 0; index < MAX_ACCEPTED_JOBS; index++)
|
||||
{
|
||||
RestoreWonderMail(&backup, &gUnknown_203B490->pelipperBoardJobs[index]);
|
||||
ReadWonderMailBits(&backup, &gUnknown_203B490->pelipperBoardJobs[index]);
|
||||
}
|
||||
for(index = 0; index < MAX_ACCEPTED_JOBS; index++)
|
||||
{
|
||||
RestoreWonderMail(&backup, &gUnknown_203B490->jobSlots[index]);
|
||||
ReadWonderMailBits(&backup, &gUnknown_203B490->jobSlots[index]);
|
||||
}
|
||||
for(index = 0; index < 0x38; index++)
|
||||
for(index = 0; index < 56; index++)
|
||||
{
|
||||
RestoreIntegerBits(&backup, &temp, 1);
|
||||
ReadBits(&backup, &temp, 1);
|
||||
if(temp & 1)
|
||||
gUnknown_203B490->PKMNNewsReceived[index] = TRUE;
|
||||
else
|
||||
gUnknown_203B490->PKMNNewsReceived[index] = FALSE;
|
||||
}
|
||||
RestoreIntegerBits(&backup, &temp, 1);
|
||||
ReadBits(&backup, &temp, 1);
|
||||
if(temp & 1)
|
||||
gUnknown_203B490->unk328 = TRUE;
|
||||
else
|
||||
gUnknown_203B490->unk328 = FALSE;
|
||||
|
||||
RestoreIntegerBits(&backup, gUnknown_203B490->unk190, 0x140);
|
||||
RestoreIntegerBits(&backup, gUnknown_203B490->unk1B8, 0x3C0);
|
||||
for(index = 0; index < 0x10; index++)
|
||||
ReadBits(&backup, gUnknown_203B490->unk190, 40 * 8);
|
||||
ReadBits(&backup, gUnknown_203B490->unk1B8, 120 * 8);
|
||||
for (index = 0; index < 16; index++)
|
||||
{
|
||||
RestoreIntegerBits(&backup, &gUnknown_203B490->unk230[index].checksum, 0x20);
|
||||
RestoreIntegerBits(&backup, &gUnknown_203B490->unk230[index].sub.seed, 0x18);
|
||||
RestoreDungeonLocation(&backup, &gUnknown_203B490->unk230[index].sub.dungeon);
|
||||
ReadBits(&backup, &gUnknown_203B490->unk230[index].checksum, 32);
|
||||
ReadBits(&backup, &gUnknown_203B490->unk230[index].sub.seed, 24);
|
||||
ReadDungeonLocationBits(&backup, &gUnknown_203B490->unk230[index].sub.dungeon);
|
||||
}
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
return backup.count;
|
||||
}
|
||||
|
||||
u32 SaveMailInfo(u8 *r0, u32 size)
|
||||
{
|
||||
s32 index;
|
||||
unkStruct_8094924 backup;
|
||||
DataSerializer backup;
|
||||
u32 temp;
|
||||
|
||||
xxx_init_struct_8094924_save_809486C(&backup, r0, size);
|
||||
InitBitWriter(&backup, r0, size);
|
||||
for(index = 0; index < NUM_MAILBOX_SLOTS; index++)
|
||||
{
|
||||
SaveWonderMail(&backup, &gUnknown_203B490->mailboxSlots[index]);
|
||||
WriteWonderMailBits(&backup, &gUnknown_203B490->mailboxSlots[index]);
|
||||
}
|
||||
for(index = 0; index < MAX_ACCEPTED_JOBS; index++)
|
||||
{
|
||||
SaveWonderMail(&backup, &gUnknown_203B490->pelipperBoardJobs[index]);
|
||||
WriteWonderMailBits(&backup, &gUnknown_203B490->pelipperBoardJobs[index]);
|
||||
}
|
||||
for(index = 0; index < MAX_ACCEPTED_JOBS; index++)
|
||||
{
|
||||
SaveWonderMail(&backup, &gUnknown_203B490->jobSlots[index]);
|
||||
WriteWonderMailBits(&backup, &gUnknown_203B490->jobSlots[index]);
|
||||
}
|
||||
for(index = 0; index < 0x38; index++)
|
||||
{
|
||||
@ -1408,51 +1408,51 @@ u32 SaveMailInfo(u8 *r0, u32 size)
|
||||
temp = -1;
|
||||
else
|
||||
temp = 0;
|
||||
SaveIntegerBits(&backup, &temp, 1);
|
||||
WriteBits(&backup, &temp, 1);
|
||||
}
|
||||
if(gUnknown_203B490->unk328)
|
||||
temp = -1;
|
||||
else
|
||||
temp = 0;
|
||||
SaveIntegerBits(&backup, &temp, 1);
|
||||
SaveIntegerBits(&backup, gUnknown_203B490->unk190, 0x140);
|
||||
SaveIntegerBits(&backup, gUnknown_203B490->unk1B8, 0x3C0);
|
||||
WriteBits(&backup, &temp, 1);
|
||||
WriteBits(&backup, gUnknown_203B490->unk190, 0x140);
|
||||
WriteBits(&backup, gUnknown_203B490->unk1B8, 0x3C0);
|
||||
for(index = 0; index < 0x10; index++)
|
||||
{
|
||||
SaveIntegerBits(&backup, &gUnknown_203B490->unk230[index].checksum, 0x20);
|
||||
SaveIntegerBits(&backup, &gUnknown_203B490->unk230[index].sub.seed, 0x18);
|
||||
SaveDungeonLocation(&backup, &gUnknown_203B490->unk230[index].sub.dungeon);
|
||||
WriteBits(&backup, &gUnknown_203B490->unk230[index].checksum, 0x20);
|
||||
WriteBits(&backup, &gUnknown_203B490->unk230[index].sub.seed, 0x18);
|
||||
WriteDungeonLocationBits(&backup, &gUnknown_203B490->unk230[index].sub.dungeon);
|
||||
}
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
return backup.count;
|
||||
}
|
||||
|
||||
void RestoreWonderMail(unkStruct_8094924 *a, WonderMail *b)
|
||||
void ReadWonderMailBits(DataSerializer *a, WonderMail *b)
|
||||
{
|
||||
RestoreIntegerBits(a, &b->mailType, 4);
|
||||
RestoreIntegerBits(a, &b->missionType, 3);
|
||||
RestoreIntegerBits(a, &b->unk2, 4);
|
||||
RestoreIntegerBits(a, &b->clientSpecies, 9);
|
||||
RestoreIntegerBits(a, &b->targetSpecies, 9);
|
||||
RestoreIntegerBits(a, &b->targetItem, 8);
|
||||
RestoreIntegerBits(a, &b->rewardType, 4);
|
||||
RestoreIntegerBits(a, &b->itemReward, 8);
|
||||
RestoreIntegerBits(a, &b->friendAreaReward, 6);
|
||||
RestoreIntegerBits(a, &b->unk4.seed, 0x18);
|
||||
RestoreDungeonLocation(a, &b->unk4.dungeon);
|
||||
ReadBits(a, &b->mailType, 4);
|
||||
ReadBits(a, &b->missionType, 3);
|
||||
ReadBits(a, &b->unk2, 4);
|
||||
ReadBits(a, &b->clientSpecies, 9);
|
||||
ReadBits(a, &b->targetSpecies, 9);
|
||||
ReadBits(a, &b->targetItem, 8);
|
||||
ReadBits(a, &b->rewardType, 4);
|
||||
ReadBits(a, &b->itemReward, 8);
|
||||
ReadBits(a, &b->friendAreaReward, 6);
|
||||
ReadBits(a, &b->unk4.seed, 24);
|
||||
ReadDungeonLocationBits(a, &b->unk4.dungeon);
|
||||
}
|
||||
|
||||
void SaveWonderMail(unkStruct_8094924 *a, WonderMail *b)
|
||||
void WriteWonderMailBits(DataSerializer *a, WonderMail *b)
|
||||
{
|
||||
SaveIntegerBits(a, &b->mailType, 4);
|
||||
SaveIntegerBits(a, &b->missionType, 3);
|
||||
SaveIntegerBits(a, &b->unk2, 4);
|
||||
SaveIntegerBits(a, &b->clientSpecies, 9);
|
||||
SaveIntegerBits(a, &b->targetSpecies, 9);
|
||||
SaveIntegerBits(a, &b->targetItem, 8);
|
||||
SaveIntegerBits(a, &b->rewardType, 4);
|
||||
SaveIntegerBits(a, &b->itemReward, 8);
|
||||
SaveIntegerBits(a, &b->friendAreaReward, 6);
|
||||
SaveIntegerBits(a, &b->unk4.seed, 0x18);
|
||||
SaveDungeonLocation(a, &b->unk4.dungeon);
|
||||
WriteBits(a, &b->mailType, 4);
|
||||
WriteBits(a, &b->missionType, 3);
|
||||
WriteBits(a, &b->unk2, 4);
|
||||
WriteBits(a, &b->clientSpecies, 9);
|
||||
WriteBits(a, &b->targetSpecies, 9);
|
||||
WriteBits(a, &b->targetItem, 8);
|
||||
WriteBits(a, &b->rewardType, 4);
|
||||
WriteBits(a, &b->itemReward, 8);
|
||||
WriteBits(a, &b->friendAreaReward, 6);
|
||||
WriteBits(a, &b->unk4.seed, 24);
|
||||
WriteDungeonLocationBits(a, &b->unk4.dungeon);
|
||||
}
|
||||
|
@ -13,12 +13,12 @@ EWRAM_DATA_2 struct unkStruct_203B494 *gUnknown_203B494 = {0};
|
||||
// data_810AE24.s
|
||||
extern const u8 *gAdventureLogText[];
|
||||
|
||||
extern void SaveDungeonLocation(struct unkStruct_8094924*, DungeonLocation*);
|
||||
extern void RestoreDungeonLocation(struct unkStruct_8094924*, DungeonLocation*);
|
||||
void ReadGameOptions(struct unkStruct_8094924 *param_1);
|
||||
void ReadPlayTime(struct unkStruct_8094924 *r0);
|
||||
void WriteGameOptions(struct unkStruct_8094924 *param_1);
|
||||
void WritePlayTime(struct unkStruct_8094924 *r0);
|
||||
extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*);
|
||||
extern void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*);
|
||||
void ReadGameOptionsBits(DataSerializer *param_1);
|
||||
void ReadPlayTimeBits(DataSerializer *r0);
|
||||
void WriteGameOptionsBits(DataSerializer *param_1);
|
||||
void WritePlayTimeBits(DataSerializer *r0);
|
||||
|
||||
void sub_8097670(void)
|
||||
{
|
||||
@ -30,10 +30,10 @@ struct unkStruct_203B494 *sub_8097680(void)
|
||||
return &sUnknown_2039778;
|
||||
}
|
||||
|
||||
void SetDungeonLocationInfo(DungeonLocation *r0)
|
||||
void SetDungeonLocationInfo(DungeonLocation *dl)
|
||||
{
|
||||
gUnknown_203B494->dungeonLocation.id = r0->id;
|
||||
gUnknown_203B494->dungeonLocation.floor = r0->floor;
|
||||
gUnknown_203B494->dungeonLocation.id = dl->id;
|
||||
gUnknown_203B494->dungeonLocation.floor = dl->floor;
|
||||
}
|
||||
|
||||
DungeonLocation *GetDungeonLocationInfo(void)
|
||||
@ -41,40 +41,40 @@ DungeonLocation *GetDungeonLocationInfo(void)
|
||||
return &gUnknown_203B494->dungeonLocation;
|
||||
}
|
||||
|
||||
void sub_80976A8(void)
|
||||
void ResetAdventureInfo(void)
|
||||
{
|
||||
s32 index;
|
||||
|
||||
gUnknown_203B494->unk0 = 0;
|
||||
gUnknown_203B494->unk14 = 0;
|
||||
gUnknown_203B494->unk16 = 0;
|
||||
gUnknown_203B494->unk18 = 0;
|
||||
gUnknown_203B494->unkC0 = 0;
|
||||
gUnknown_203B494->unk8 = 0;
|
||||
gUnknown_203B494->unkC = 0;
|
||||
gUnknown_203B494->achievements = 0;
|
||||
gUnknown_203B494->thievingSuccesses = 0;
|
||||
gUnknown_203B494->numJoined = 0;
|
||||
gUnknown_203B494->adventureMovesLearned = 0;
|
||||
gUnknown_203B494->numFloorsExplored = 0;
|
||||
gUnknown_203B494->friendRescueSuccesses = 0;
|
||||
gUnknown_203B494->numEvolved = 0;
|
||||
|
||||
for (index = 0; index < 14; index++)
|
||||
gUnknown_203B494->unk1C[index] = 0;
|
||||
|
||||
for (index = 0; index < 13; index++)
|
||||
gUnknown_203B494->unk8C[index] = 0;
|
||||
for (index = 0; index < (s32)ARRAY_COUNT(gUnknown_203B494->learnedMoves); index++)
|
||||
gUnknown_203B494->learnedMoves[index] = 0;
|
||||
}
|
||||
|
||||
void sub_80976F8(u8 r0)
|
||||
void SetAdventureAchievement(u8 x)
|
||||
{
|
||||
gUnknown_203B494->unk0 |= (1 << r0);
|
||||
gUnknown_203B494->achievements |= (1 << x);
|
||||
}
|
||||
|
||||
bool8 sub_8097710(u8 r0)
|
||||
bool8 GetAdventureAchievement(u8 x)
|
||||
{
|
||||
if (gUnknown_203B494->unk0 & (1 << r0))
|
||||
if (gUnknown_203B494->achievements & (1 << x))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const u8 *GetAdventureLogLine(u8 index)
|
||||
const u8 *GetAdventureLogLine(u8 achievement)
|
||||
{
|
||||
return gAdventureLogText[index];
|
||||
return gAdventureLogText[achievement];
|
||||
}
|
||||
|
||||
void ResetNumAdventures(void)
|
||||
@ -99,86 +99,86 @@ UNUSED static void SetNumAdventures(s32 numAdventures)
|
||||
gUnknown_203B494->numAdventures = numAdventures;
|
||||
}
|
||||
|
||||
void sub_8097790(void)
|
||||
void IncrementFriendRescueSuccesses(void)
|
||||
{
|
||||
gUnknown_203B494->unk8++;
|
||||
if (gUnknown_203B494->unk8 > 99999)
|
||||
gUnknown_203B494->unk8 = 99999;
|
||||
gUnknown_203B494->friendRescueSuccesses++;
|
||||
if (gUnknown_203B494->friendRescueSuccesses > 99999)
|
||||
gUnknown_203B494->friendRescueSuccesses = 99999;
|
||||
|
||||
sub_80976F8(8);
|
||||
SetAdventureAchievement(AA_NUM_FRIEND_RESCUE_SUCCESSES);
|
||||
}
|
||||
|
||||
s32 sub_80977B8(void)
|
||||
s32 GetFriendRescueSuccesses(void)
|
||||
{
|
||||
return gUnknown_203B494->unk8;
|
||||
return gUnknown_203B494->friendRescueSuccesses;
|
||||
}
|
||||
|
||||
UNUSED static void sub_80977C4(s32 r0)
|
||||
UNUSED static void SetFriendRescueSuccess(s32 numSuccess)
|
||||
{
|
||||
gUnknown_203B494->unk8 = r0;
|
||||
gUnknown_203B494->friendRescueSuccesses = numSuccess;
|
||||
}
|
||||
|
||||
void sub_80977D0(void)
|
||||
void IncrementNumEvolved(void)
|
||||
{
|
||||
gUnknown_203B494->unkC++;
|
||||
if (gUnknown_203B494->unkC > 99999)
|
||||
gUnknown_203B494->unkC = 99999;
|
||||
gUnknown_203B494->numEvolved++;
|
||||
if (gUnknown_203B494->numEvolved > 99999)
|
||||
gUnknown_203B494->numEvolved = 99999;
|
||||
|
||||
sub_80976F8(9);
|
||||
SetAdventureAchievement(AA_NUM_POKEMON_EVOLVED);
|
||||
}
|
||||
|
||||
s32 sub_80977F8(void)
|
||||
s32 GetAdventureNumEvolved(void)
|
||||
{
|
||||
return gUnknown_203B494->unkC;
|
||||
return gUnknown_203B494->numEvolved;
|
||||
}
|
||||
|
||||
UNUSED static void sub_8097804(s32 r0)
|
||||
UNUSED static void SetAdventureNumEvolved(s32 numEvolved)
|
||||
{
|
||||
gUnknown_203B494->unkC = r0;
|
||||
gUnknown_203B494->numEvolved = numEvolved;
|
||||
}
|
||||
|
||||
void sub_8097810(void)
|
||||
void IncrementThievingSuccesses(void)
|
||||
{
|
||||
if (gUnknown_203B494->unk14 < 9999)
|
||||
gUnknown_203B494->unk14++;
|
||||
if (gUnknown_203B494->thievingSuccesses < 9999)
|
||||
gUnknown_203B494->thievingSuccesses++;
|
||||
|
||||
sub_80976F8(11);
|
||||
SetAdventureAchievement(AA_NUM_THIEVING_SUCCESSES);
|
||||
}
|
||||
|
||||
s16 sub_8097838(void)
|
||||
s16 GetThievingSuccesses(void)
|
||||
{
|
||||
return gUnknown_203B494->unk14;
|
||||
return gUnknown_203B494->thievingSuccesses;
|
||||
}
|
||||
|
||||
void sub_8097848(void)
|
||||
void IncrementAdventureNumJoined(void)
|
||||
{
|
||||
if (gUnknown_203B494->unk16 < 9999)
|
||||
gUnknown_203B494->unk16++;
|
||||
if (gUnknown_203B494->numJoined < 9999)
|
||||
gUnknown_203B494->numJoined++;
|
||||
|
||||
sub_80976F8(10);
|
||||
SetAdventureAchievement(AA_NUM_POKEMON_JOINED);
|
||||
}
|
||||
|
||||
s16 sub_8097870(void)
|
||||
s16 GetAdventureNumJoined(void)
|
||||
{
|
||||
return gUnknown_203B494->unk16;
|
||||
return gUnknown_203B494->numJoined;
|
||||
}
|
||||
|
||||
s16 sub_8097880(void)
|
||||
s16 GetAdventureMovesLearned(void)
|
||||
{
|
||||
return gUnknown_203B494->unk18;
|
||||
return gUnknown_203B494->adventureMovesLearned;
|
||||
}
|
||||
|
||||
void sub_8097890(void)
|
||||
void IncrementAdventureFloorsExplored(void)
|
||||
{
|
||||
if (gUnknown_203B494->unkC0 < 99999)
|
||||
gUnknown_203B494->unkC0++;
|
||||
if (gUnknown_203B494->numFloorsExplored < 99999)
|
||||
gUnknown_203B494->numFloorsExplored++;
|
||||
|
||||
sub_80976F8(12);
|
||||
SetAdventureAchievement(AA_NUM_FLOORS_EXPLORED);
|
||||
}
|
||||
|
||||
s16 sub_80978B8(void)
|
||||
s16 GetAdventureFloorsExplored(void)
|
||||
{
|
||||
return gUnknown_203B494->unkC0;
|
||||
return gUnknown_203B494->numFloorsExplored;
|
||||
}
|
||||
|
||||
void sub_80978C8(s16 pokeIndex)
|
||||
@ -191,9 +191,9 @@ void sub_80978C8(s16 pokeIndex)
|
||||
preload = gUnknown_203B494;
|
||||
iVar2 = baseSpecies;
|
||||
if (baseSpecies < 0)
|
||||
iVar2 = baseSpecies + 0x1F; // 0x1F == MONSTER_NIDOQUEEN
|
||||
iVar2 = baseSpecies + 0x1F; // 0b11111
|
||||
|
||||
preload->unk54[iVar2 >> 5] |= 1 << (baseSpecies + (iVar2 >> 5) * -0x20);
|
||||
preload->unk54[iVar2 >> 5] |= 1 << (baseSpecies + (iVar2 >> 5) * -32);
|
||||
}
|
||||
|
||||
bool8 sub_8097900(s16 pokeIndex)
|
||||
@ -206,45 +206,42 @@ bool8 sub_8097900(s16 pokeIndex)
|
||||
preload = gUnknown_203B494;
|
||||
iVar2 = baseSpecies;
|
||||
if (baseSpecies < 0)
|
||||
iVar2 = baseSpecies + 0x1F; // 0x1F == MONSTER_NIDOQUEEN
|
||||
iVar2 = baseSpecies + 0x1F; // 0b11111
|
||||
|
||||
if (preload->unk1C[iVar2 >> 5] & (1 << (baseSpecies + (iVar2 >> 5) * -0x20)))
|
||||
if (preload->unk1C[iVar2 >> 5] & (1 << (baseSpecies + (iVar2 >> 5) * -32)))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_8097944(void)
|
||||
void UpdateAdventureAchievements(void)
|
||||
{
|
||||
bool8 bVar2;
|
||||
bool8 bVar3;
|
||||
bool8 allJoined;
|
||||
bool8 allLeaders;
|
||||
s32 i, j;
|
||||
s32 counter;
|
||||
s32 moveCount;
|
||||
Move *move;
|
||||
|
||||
bVar2 = 1;
|
||||
bVar3 = 1;
|
||||
if (!sub_8097710(0xd) && (HasAllFriendAreas())) {
|
||||
sub_80976F8(0xd);
|
||||
}
|
||||
allJoined = TRUE;
|
||||
allLeaders = TRUE;
|
||||
|
||||
for(i = 0; i < NUM_MONSTERS; i++)
|
||||
{
|
||||
if (!GetAdventureAchievement(AA_ALL_FRIEND_AREAS) && HasAllFriendAreas())
|
||||
SetAdventureAchievement(AA_ALL_FRIEND_AREAS);
|
||||
|
||||
for (i = 0; i < NUM_MONSTERS; i++) {
|
||||
if (PokemonFlag1(&gRecruitedPokemonRef->pokemon[i])) {
|
||||
s32 species = gRecruitedPokemonRef->pokemon[i].speciesNum;
|
||||
gUnknown_203B494->unk1C[species / 32] |= 1 << species % 32;
|
||||
|
||||
for(j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
for (j = 0; j < MAX_MON_MOVES; j++) {
|
||||
move = &gRecruitedPokemonRef->pokemon[i].moves[j];
|
||||
if (MoveFlagExists(move)) {
|
||||
gUnknown_203B494->unk8C[move->id / 32] |= 1 << move->id % 32;
|
||||
}
|
||||
|
||||
if (MoveFlagExists(move))
|
||||
gUnknown_203B494->learnedMoves[move->id / 32] |= 1 << move->id % 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < MONSTER_MAX; i++)
|
||||
{
|
||||
for (i = 0; i < MONSTER_MAX; i++) {
|
||||
if (i == MONSTER_NONE) continue;
|
||||
if (i == MONSTER_CASTFORM_SNOWY) continue;
|
||||
if (i == MONSTER_CASTFORM_SUNNY) continue;
|
||||
@ -258,141 +255,141 @@ void sub_8097944(void)
|
||||
if (i == MONSTER_RAYQUAZA_CUTSCENE) continue;
|
||||
|
||||
if ((gUnknown_203B494->unk54[i / 32] & 1 << i % 32) == 0)
|
||||
{
|
||||
bVar3 = 0;
|
||||
}
|
||||
if ((gUnknown_203B494->unk1C[i / 32] & 1 << i % 32) != 0)
|
||||
{
|
||||
if (i == MONSTER_MOLTRES) {
|
||||
sub_80976F8(0x10);
|
||||
}
|
||||
if (i == MONSTER_ZAPDOS) {
|
||||
sub_80976F8(0x11);
|
||||
}
|
||||
if (i == MONSTER_ARTICUNO) {
|
||||
sub_80976F8(0x12);
|
||||
}
|
||||
if (i == MONSTER_DEOXYS_NORMAL) {
|
||||
sub_80976F8(0x13);
|
||||
}
|
||||
if (i == MONSTER_ENTEI) {
|
||||
sub_80976F8(0x14);
|
||||
}
|
||||
if (i == MONSTER_RAIKOU) {
|
||||
sub_80976F8(0x15);
|
||||
}
|
||||
if (i == MONSTER_SUICUNE) {
|
||||
sub_80976F8(0x16);
|
||||
}
|
||||
if (i == MONSTER_HO_OH) {
|
||||
sub_80976F8(0x17);
|
||||
}
|
||||
if (i == MONSTER_KYOGRE) {
|
||||
sub_80976F8(0x18);
|
||||
}
|
||||
if (i == MONSTER_GROUDON) {
|
||||
sub_80976F8(0x19);
|
||||
}
|
||||
if (i == MONSTER_RAYQUAZA) {
|
||||
sub_80976F8(0x1a);
|
||||
}
|
||||
if (i == MONSTER_LUGIA) {
|
||||
sub_80976F8(0x1b);
|
||||
}
|
||||
if (i == MONSTER_CELEBI) {
|
||||
sub_80976F8(0x1c);
|
||||
}
|
||||
if (i == MONSTER_MEW) {
|
||||
sub_80976F8(0x1d);
|
||||
}
|
||||
if (i == MONSTER_MEWTWO) {
|
||||
sub_80976F8(0x1e);
|
||||
}
|
||||
if (i == MONSTER_JIRACHI) {
|
||||
sub_80976F8(0x1f);
|
||||
}
|
||||
allLeaders = FALSE;
|
||||
|
||||
if ((gUnknown_203B494->unk1C[i / 32] & 1 << i % 32) != 0) {
|
||||
if (i == MONSTER_MOLTRES)
|
||||
SetAdventureAchievement(AA_RECRUIT_MOLTRES);
|
||||
|
||||
if (i == MONSTER_ZAPDOS)
|
||||
SetAdventureAchievement(AA_RECRUIT_ZAPDOS);
|
||||
|
||||
if (i == MONSTER_ARTICUNO)
|
||||
SetAdventureAchievement(AA_RECRUIT_ARTICUNO);
|
||||
|
||||
if (i == MONSTER_DEOXYS_NORMAL)
|
||||
SetAdventureAchievement(AA_RECRUIT_DEOXYS);
|
||||
|
||||
if (i == MONSTER_ENTEI)
|
||||
SetAdventureAchievement(AA_RECRUIT_ENTEI);
|
||||
|
||||
if (i == MONSTER_RAIKOU)
|
||||
SetAdventureAchievement(AA_RECRUIT_RAIKOU);
|
||||
|
||||
if (i == MONSTER_SUICUNE)
|
||||
SetAdventureAchievement(AA_RECRUIT_SUICUNE);
|
||||
|
||||
if (i == MONSTER_HO_OH)
|
||||
SetAdventureAchievement(AA_RECRUIT_HO_OH);
|
||||
|
||||
if (i == MONSTER_KYOGRE)
|
||||
SetAdventureAchievement(AA_RECRUIT_KYOGRE);
|
||||
|
||||
if (i == MONSTER_GROUDON)
|
||||
SetAdventureAchievement(AA_RECRUIT_GROUDON);
|
||||
|
||||
if (i == MONSTER_RAYQUAZA)
|
||||
SetAdventureAchievement(AA_RECRUIT_RAYQUAZA);
|
||||
|
||||
if (i == MONSTER_LUGIA)
|
||||
SetAdventureAchievement(AA_RECRUIT_LUGIA);
|
||||
|
||||
if (i == MONSTER_CELEBI)
|
||||
SetAdventureAchievement(AA_RECRUIT_CELEBI);
|
||||
|
||||
if (i == MONSTER_MEW)
|
||||
SetAdventureAchievement(AA_RECRUIT_MEW);
|
||||
|
||||
if (i == MONSTER_MEWTWO)
|
||||
SetAdventureAchievement(AA_RECRUIT_MEWTWO);
|
||||
|
||||
if (i == MONSTER_JIRACHI)
|
||||
SetAdventureAchievement(AA_RECRUIT_JIRACHI);
|
||||
}
|
||||
else
|
||||
{
|
||||
bVar2 = 0;
|
||||
}
|
||||
allJoined = FALSE;
|
||||
}
|
||||
|
||||
if (bVar2) {
|
||||
sub_80976F8(0xf);
|
||||
if (allJoined)
|
||||
SetAdventureAchievement(AA_ALL_POKEMON_JOINED);
|
||||
|
||||
if (allLeaders)
|
||||
SetAdventureAchievement(AA_ALL_POKEMON_LEADERS);
|
||||
|
||||
moveCount = 0;
|
||||
for (i = 0; i < NUM_MOVE_IDS; i++) {
|
||||
if (i == MOVE_NOTHING || i == MOVE_REGULAR_ATTACK || i == MOVE_IS_WATCHING || i == MOVE_BIDE_2)
|
||||
continue;
|
||||
|
||||
if (gUnknown_203B494->learnedMoves[i / 32] & 1 << i % 32)
|
||||
moveCount++;
|
||||
}
|
||||
if (bVar3) {
|
||||
sub_80976F8(0xe);
|
||||
}
|
||||
counter = 0;
|
||||
for(i = 0; i < NUM_MONSTERS; i++)
|
||||
{
|
||||
if (i == MONSTER_NONE || i == MONSTER_FLYGON || i == MONSTER_CACNEA || i == MONSTER_CACTURNE) continue;
|
||||
if (gUnknown_203B494->unk8C[i / 32] & 1 << i % 32) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if (counter != 0) {
|
||||
gUnknown_203B494->unk18 = counter;
|
||||
sub_80976F8(7);
|
||||
|
||||
if (moveCount != 0) {
|
||||
gUnknown_203B494->adventureMovesLearned = moveCount;
|
||||
SetAdventureAchievement(AA_NUM_MOVES_LEARNED);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8097C18(struct unkStruct_8094924 *r0)
|
||||
static void WriteAdventureBits(DataSerializer *r0)
|
||||
{
|
||||
sub_8097944();
|
||||
SaveIntegerBits(r0, &gUnknown_203B494->numAdventures, 0x11);
|
||||
SaveIntegerBits(r0, &gUnknown_203B494->unk8, 0x11);
|
||||
SaveIntegerBits(r0, &gUnknown_203B494->unkC, 0x11);
|
||||
SaveIntegerBits(r0, &gUnknown_203B494->unk0, 0x20);
|
||||
SaveIntegerBits(r0, &gUnknown_203B494->unk14, 0xE);
|
||||
SaveIntegerBits(r0, &gUnknown_203B494->unk16, 0xE);
|
||||
SaveIntegerBits(r0, &gUnknown_203B494->unk18, 0x9);
|
||||
SaveIntegerBits(r0, &gUnknown_203B494->unkC0, 0x11);
|
||||
SaveIntegerBits(r0, gUnknown_203B494->unk1C, 0xE0 << 1);
|
||||
SaveIntegerBits(r0, gUnknown_203B494->unk54, 0xE0 << 1);
|
||||
SaveIntegerBits(r0, gUnknown_203B494->unk8C, 0xD0 << 1);
|
||||
SaveDungeonLocation(r0, &gUnknown_203B494->dungeonLocation);
|
||||
UpdateAdventureAchievements();
|
||||
WriteBits(r0, &gUnknown_203B494->numAdventures, 17);
|
||||
WriteBits(r0, &gUnknown_203B494->friendRescueSuccesses, 17);
|
||||
WriteBits(r0, &gUnknown_203B494->numEvolved, 17);
|
||||
WriteBits(r0, &gUnknown_203B494->achievements, 32);
|
||||
WriteBits(r0, &gUnknown_203B494->thievingSuccesses, 14);
|
||||
WriteBits(r0, &gUnknown_203B494->numJoined, 14);
|
||||
WriteBits(r0, &gUnknown_203B494->adventureMovesLearned, 9);
|
||||
WriteBits(r0, &gUnknown_203B494->numFloorsExplored, 17);
|
||||
WriteBits(r0, gUnknown_203B494->unk1C, 14 * 32);
|
||||
WriteBits(r0, gUnknown_203B494->unk54, 14 * 32);
|
||||
WriteBits(r0, gUnknown_203B494->learnedMoves, (s32)ARRAY_COUNT(gUnknown_203B494->learnedMoves) * 32);
|
||||
WriteDungeonLocationBits(r0, &gUnknown_203B494->dungeonLocation);
|
||||
}
|
||||
|
||||
void sub_8097CC0(struct unkStruct_8094924 *r0)
|
||||
static void ReadAdventureBits(DataSerializer *r0)
|
||||
{
|
||||
RestoreIntegerBits(r0, &gUnknown_203B494->numAdventures, 0x11);
|
||||
RestoreIntegerBits(r0, &gUnknown_203B494->unk8, 0x11);
|
||||
RestoreIntegerBits(r0, &gUnknown_203B494->unkC, 0x11);
|
||||
RestoreIntegerBits(r0, &gUnknown_203B494->unk0, 0x20);
|
||||
RestoreIntegerBits(r0, &gUnknown_203B494->unk14, 0xE);
|
||||
RestoreIntegerBits(r0, &gUnknown_203B494->unk16, 0xE);
|
||||
RestoreIntegerBits(r0, &gUnknown_203B494->unk18, 0x9);
|
||||
RestoreIntegerBits(r0, &gUnknown_203B494->unkC0, 0x11);
|
||||
RestoreIntegerBits(r0, gUnknown_203B494->unk1C, 0xE0 << 1);
|
||||
RestoreIntegerBits(r0, gUnknown_203B494->unk54, 0xE0 << 1);
|
||||
RestoreIntegerBits(r0, gUnknown_203B494->unk8C, 0xD0 << 1);
|
||||
RestoreDungeonLocation(r0, &gUnknown_203B494->dungeonLocation);
|
||||
ReadBits(r0, &gUnknown_203B494->numAdventures, 17);
|
||||
ReadBits(r0, &gUnknown_203B494->friendRescueSuccesses, 17);
|
||||
ReadBits(r0, &gUnknown_203B494->numEvolved, 17);
|
||||
ReadBits(r0, &gUnknown_203B494->achievements, 32);
|
||||
ReadBits(r0, &gUnknown_203B494->thievingSuccesses, 14);
|
||||
ReadBits(r0, &gUnknown_203B494->numJoined, 14);
|
||||
ReadBits(r0, &gUnknown_203B494->adventureMovesLearned, 9);
|
||||
ReadBits(r0, &gUnknown_203B494->numFloorsExplored, 17);
|
||||
ReadBits(r0, gUnknown_203B494->unk1C, 14 * 32);
|
||||
ReadBits(r0, gUnknown_203B494->unk54, 14 * 32);
|
||||
ReadBits(r0, gUnknown_203B494->learnedMoves, (s32)ARRAY_COUNT(gUnknown_203B494->learnedMoves) * 32);
|
||||
ReadDungeonLocationBits(r0, &gUnknown_203B494->dungeonLocation);
|
||||
}
|
||||
|
||||
// Save something...
|
||||
u32 sub_8097D60(u8 *r0, u32 size)
|
||||
u32 SaveAdventureData(u8 *buffer, u32 bufLen)
|
||||
{
|
||||
struct unkStruct_8094924 backup;
|
||||
xxx_init_struct_8094924_save_809486C(&backup, r0, size);
|
||||
WriteGameOptions(&backup);
|
||||
WritePlayTime(&backup);
|
||||
sub_8097C18(&backup);
|
||||
WriteExclusivePokemon(&backup);
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
DataSerializer seri;
|
||||
|
||||
InitBitWriter(&seri, buffer, bufLen);
|
||||
|
||||
WriteGameOptionsBits(&seri);
|
||||
WritePlayTimeBits(&seri);
|
||||
WriteAdventureBits(&seri);
|
||||
WriteExclusivePokemon(&seri);
|
||||
|
||||
nullsub_102(&seri);
|
||||
return seri.count;
|
||||
}
|
||||
|
||||
// Read something...
|
||||
u32 sub_8097D98(u8 *r0, u32 size)
|
||||
u32 RestoreAdventureData(u8 *buffer, u32 bufLen)
|
||||
{
|
||||
struct unkStruct_8094924 backup;
|
||||
xxx_init_struct_8094924_restore_809485C(&backup, r0, size);
|
||||
ReadGameOptions(&backup);
|
||||
ReadPlayTime(&backup);
|
||||
sub_8097CC0(&backup);
|
||||
ReadExclusivePokemon(&backup);
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
}
|
||||
DataSerializer seri;
|
||||
|
||||
InitBitReader(&seri, buffer, bufLen);
|
||||
|
||||
ReadGameOptionsBits(&seri);
|
||||
ReadPlayTimeBits(&seri);
|
||||
ReadAdventureBits(&seri);
|
||||
ReadExclusivePokemon(&seri);
|
||||
|
||||
nullsub_102(&seri);
|
||||
return seri.count;
|
||||
}
|
@ -66,7 +66,7 @@ void DeleteDebugMenu(void)
|
||||
u32 UpdateDebugMenu(void)
|
||||
{
|
||||
u32 nextMenu;
|
||||
s32 counter;
|
||||
s32 i;
|
||||
s32 debugMenuAction;
|
||||
|
||||
nextMenu = MENU_NO_SCREEN_CHANGE;
|
||||
@ -99,8 +99,8 @@ u32 UpdateDebugMenu(void)
|
||||
nextMenu = MENU_MAIN_SCREEN;
|
||||
break;
|
||||
case MENU_DEBUG_MENU_H_OPEN:
|
||||
for (counter = 0; counter < 0x20; counter++)
|
||||
sub_80976F8(counter);
|
||||
for (i = 0; i < AA_MAX; i++)
|
||||
SetAdventureAchievement(i);
|
||||
|
||||
nextMenu = MENU_MAIN_SCREEN;
|
||||
break;
|
||||
|
@ -145,18 +145,18 @@ u8 sub_80902C8(u8 dungeon)
|
||||
return gUnknown_81077E8[dungeon];
|
||||
}
|
||||
|
||||
void SaveDungeonLocation(struct unkStruct_8094924* r0, DungeonLocation* r1)
|
||||
void WriteDungeonLocationBits(DataSerializer* r0, DungeonLocation* src)
|
||||
{
|
||||
SaveIntegerBits(r0, &r1->id, 0x7);
|
||||
SaveIntegerBits(r0, &r1->floor, 0x7);
|
||||
WriteBits(r0, &src->id, 7);
|
||||
WriteBits(r0, &src->floor, 7);
|
||||
}
|
||||
|
||||
void RestoreDungeonLocation(struct unkStruct_8094924* r0, DungeonLocation* r1)
|
||||
void ReadDungeonLocationBits(DataSerializer* r0, DungeonLocation* dst)
|
||||
{
|
||||
r1->id = 0;
|
||||
r1->floor = 0;
|
||||
RestoreIntegerBits(r0, &r1->id, 0x7);
|
||||
RestoreIntegerBits(r0, &r1->floor, 0x7);
|
||||
dst->id = 0;
|
||||
dst->floor = 0;
|
||||
ReadBits(r0, &dst->id, 7);
|
||||
ReadBits(r0, &dst->floor, 7);
|
||||
}
|
||||
|
||||
bool8 DoEnemiesEvolveWhenKOed(u8 dungeon)
|
||||
|
@ -149,29 +149,29 @@ void ScenarioCalc(s16 param_1,s32 param_2,s32 param_3)
|
||||
switch(param_1_s32)
|
||||
{
|
||||
case 3:
|
||||
if (((u32)(param_2 - 1) < 0x1b)) {
|
||||
if (param_2 > 0 && param_2 < 28) {
|
||||
if (ScriptVarScenarioAfter(SCENARIO_MAIN,8,-1)) {
|
||||
sub_80976F8(0);
|
||||
SetAdventureAchievement(AA_HILL_OF_ANCIENTS);
|
||||
}
|
||||
if (ScriptVarScenarioAfter(SCENARIO_MAIN,0xb,3)) {
|
||||
sub_80976F8(1);
|
||||
if (ScriptVarScenarioAfter(SCENARIO_MAIN,11,3)) {
|
||||
SetAdventureAchievement(AA_FUGITIVE);
|
||||
}
|
||||
if (ScriptVarScenarioAfter(SCENARIO_MAIN,0x11,0)) {
|
||||
sub_80976F8(2);
|
||||
if (ScriptVarScenarioAfter(SCENARIO_MAIN,17,0)) {
|
||||
SetAdventureAchievement(AA_PREVENT_METEOR);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (ScriptVarScenarioBefore(SCENARIO_SUB1,0x1f,0) == 0) {
|
||||
sub_80976F8(4);
|
||||
if (ScriptVarScenarioBefore(SCENARIO_SUB1,31,0) == 0) {
|
||||
SetAdventureAchievement(AA_TEAM_BASE_DONE);
|
||||
}
|
||||
if (ScriptVarScenarioBefore(SCENARIO_SUB1,0x20,0) == 0) {
|
||||
sub_80976F8(5);
|
||||
if (ScriptVarScenarioBefore(SCENARIO_SUB1,32,0) == 0) {
|
||||
SetAdventureAchievement(AA_SMEARGLE);
|
||||
}
|
||||
break;
|
||||
case 0xC:
|
||||
if(ScriptVarScenarioBefore(SCENARIO_SUB9,0x37,2) == 0) {
|
||||
sub_80976F8(3);
|
||||
if(ScriptVarScenarioBefore(SCENARIO_SUB9,55,2) == 0) {
|
||||
SetAdventureAchievement(AA_BROKE_CURSE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ void UnlockExclusivePokemon(s16 pokeID)
|
||||
}
|
||||
}
|
||||
|
||||
void WriteExclusivePokemon(struct unkStruct_8094924 *r0)
|
||||
void WriteExclusivePokemon(DataSerializer *r0)
|
||||
{
|
||||
s32 index;
|
||||
u8 *puVar2;
|
||||
@ -212,21 +212,21 @@ void WriteExclusivePokemon(struct unkStruct_8094924 *r0)
|
||||
zero = 0;
|
||||
|
||||
|
||||
SaveIntegerBits(r0, gUnknown_203B498, 1);
|
||||
WriteBits(r0, gUnknown_203B498, 1);
|
||||
for(index = 0; index < MONSTER_MAX; index++)
|
||||
{
|
||||
stack_0 = sub_8098134(index);
|
||||
SaveIntegerBits(r0, &stack_0, 1);
|
||||
WriteBits(r0, &stack_0, 1);
|
||||
}
|
||||
for(index = 0; index < 64; index++)
|
||||
{
|
||||
stack_1 = sub_8098100(index);
|
||||
SaveIntegerBits(r0, &stack_1, 1);
|
||||
WriteBits(r0, &stack_1, 1);
|
||||
}
|
||||
for(index = 0; index < 31; index++)
|
||||
{
|
||||
stack_2 = GetTutorialFlag(index);
|
||||
SaveIntegerBits(r0, &stack_2, 1);
|
||||
WriteBits(r0, &stack_2, 1);
|
||||
}
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
@ -234,11 +234,11 @@ void WriteExclusivePokemon(struct unkStruct_8094924 *r0)
|
||||
puVar2 = &neg_1;
|
||||
else
|
||||
puVar2 = &zero;
|
||||
SaveIntegerBits(r0, puVar2, 1);
|
||||
WriteBits(r0, puVar2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadExclusivePokemon(struct unkStruct_8094924 *r0)
|
||||
void ReadExclusivePokemon(DataSerializer *r0)
|
||||
{
|
||||
s32 index;
|
||||
u8 stack_0;
|
||||
@ -247,28 +247,28 @@ void ReadExclusivePokemon(struct unkStruct_8094924 *r0)
|
||||
u8 stack_3;
|
||||
|
||||
memset(gUnknown_203B498, 0, sizeof(struct ExclusivePokemonData));
|
||||
RestoreIntegerBits(r0, gUnknown_203B498, 1);
|
||||
ReadBits(r0, gUnknown_203B498, 1);
|
||||
for(index = 0; index < MONSTER_MAX; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_0, 1);
|
||||
ReadBits(r0, &stack_0, 1);
|
||||
if(stack_0)
|
||||
sub_80980B4(index);
|
||||
}
|
||||
for(index = 0; index < 64; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_1, 1);
|
||||
ReadBits(r0, &stack_1, 1);
|
||||
if(stack_1)
|
||||
sub_8097FA8(index);
|
||||
}
|
||||
for(index = 0; index < 31; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_2, 1);
|
||||
ReadBits(r0, &stack_2, 1);
|
||||
if(stack_2)
|
||||
SetTutorialFlag(index);
|
||||
}
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_3, 1);
|
||||
ReadBits(r0, &stack_3, 1);
|
||||
|
||||
do; while(0); // do/while needed for matching - jiang
|
||||
|
||||
|
@ -227,34 +227,34 @@ void sub_80926F8(u8 a0, unkStruct_8092638 *a1, u8 a2)
|
||||
|
||||
u32 SaveFriendAreas(u8 *r0, u32 size)
|
||||
{
|
||||
struct unkStruct_8094924 unk;
|
||||
DataSerializer unk;
|
||||
u32 temp;
|
||||
s32 i;
|
||||
|
||||
xxx_init_struct_8094924_save_809486C(&unk, r0, size);
|
||||
InitBitWriter(&unk, r0, size);
|
||||
|
||||
for (i = 0; i < NUM_FRIEND_AREAS; i++) {
|
||||
if (gFriendAreas[i] != 0)
|
||||
temp = -1;
|
||||
else
|
||||
temp = 0;
|
||||
SaveIntegerBits(&unk, (u8*)&temp, 1);
|
||||
WriteBits(&unk, (u8*)&temp, 1);
|
||||
}
|
||||
|
||||
nullsub_102(&unk);
|
||||
return unk.unk8;
|
||||
return unk.count;
|
||||
}
|
||||
|
||||
u32 ReadSavedFriendAreas(u8 *r0, s32 size)
|
||||
{
|
||||
struct unkStruct_8094924 unk;
|
||||
DataSerializer unk;
|
||||
u32 temp;
|
||||
s32 i;
|
||||
|
||||
xxx_init_struct_8094924_restore_809485C(&unk, r0, size);
|
||||
InitBitReader(&unk, r0, size);
|
||||
|
||||
for (i = 0; i < NUM_FRIEND_AREAS; i++) {
|
||||
RestoreIntegerBits(&unk, &temp, 1);
|
||||
ReadBits(&unk, &temp, 1);
|
||||
// It's setting whether we have the friend area or not
|
||||
if (temp & 1)
|
||||
gFriendAreas[i] = TRUE;
|
||||
@ -263,5 +263,5 @@ u32 ReadSavedFriendAreas(u8 *r0, s32 size)
|
||||
}
|
||||
|
||||
nullsub_102(&unk);
|
||||
return unk.unk8;
|
||||
return unk.count;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ bool8 GameOptionsNotChange(GameOptions *r0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void WriteGameOptions(struct unkStruct_8094924 *param_1)
|
||||
void WriteGameOptionsBits(DataSerializer *param_1)
|
||||
{
|
||||
u8 zero;
|
||||
u8 neg_1;
|
||||
@ -77,7 +77,7 @@ void WriteGameOptions(struct unkStruct_8094924 *param_1)
|
||||
neg_1 = -1;
|
||||
zero = 0;
|
||||
|
||||
SaveIntegerBits(param_1, &gGameOptionsRef->windowColor, 2);
|
||||
WriteBits(param_1, &gGameOptionsRef->windowColor, 2);
|
||||
|
||||
if(gGameOptionsRef->unk9 != 0)
|
||||
{
|
||||
@ -87,7 +87,7 @@ void WriteGameOptions(struct unkStruct_8094924 *param_1)
|
||||
{
|
||||
puVar2 = &zero;
|
||||
}
|
||||
SaveIntegerBits(param_1, puVar2, 1);
|
||||
WriteBits(param_1, puVar2, 1);
|
||||
|
||||
if(gGameOptionsRef->unkA != 0)
|
||||
{
|
||||
@ -97,7 +97,7 @@ void WriteGameOptions(struct unkStruct_8094924 *param_1)
|
||||
{
|
||||
puVar2 = &zero;
|
||||
}
|
||||
SaveIntegerBits(param_1, puVar2, 1);
|
||||
WriteBits(param_1, puVar2, 1);
|
||||
|
||||
if(gGameOptionsRef->playerGender != MALE)
|
||||
{
|
||||
@ -107,7 +107,7 @@ void WriteGameOptions(struct unkStruct_8094924 *param_1)
|
||||
{
|
||||
puVar2 = &zero;
|
||||
}
|
||||
SaveIntegerBits(param_1, puVar2, 1);
|
||||
WriteBits(param_1, puVar2, 1);
|
||||
|
||||
if(gGameOptionsRef->dungeonSpeed != DUNGEON_SPEED_SLOW)
|
||||
{
|
||||
@ -117,7 +117,7 @@ void WriteGameOptions(struct unkStruct_8094924 *param_1)
|
||||
{
|
||||
puVar2 = &zero;
|
||||
}
|
||||
SaveIntegerBits(param_1, puVar2, 1);
|
||||
WriteBits(param_1, puVar2, 1);
|
||||
|
||||
if(gGameOptionsRef->FarOffPals != FAROFFPALS_SELF)
|
||||
{
|
||||
@ -127,7 +127,7 @@ void WriteGameOptions(struct unkStruct_8094924 *param_1)
|
||||
{
|
||||
puVar2 = &zero;
|
||||
}
|
||||
SaveIntegerBits(param_1, puVar2, 1);
|
||||
WriteBits(param_1, puVar2, 1);
|
||||
|
||||
if(gGameOptionsRef->damageTurn)
|
||||
{
|
||||
@ -137,7 +137,7 @@ void WriteGameOptions(struct unkStruct_8094924 *param_1)
|
||||
{
|
||||
puVar2 = &zero;
|
||||
}
|
||||
SaveIntegerBits(param_1, puVar2, 1);
|
||||
WriteBits(param_1, puVar2, 1);
|
||||
|
||||
if(gGameOptionsRef->gridEnable)
|
||||
{
|
||||
@ -147,43 +147,43 @@ void WriteGameOptions(struct unkStruct_8094924 *param_1)
|
||||
{
|
||||
puVar2 = &zero;
|
||||
}
|
||||
SaveIntegerBits(param_1, puVar2, 1);
|
||||
WriteBits(param_1, puVar2, 1);
|
||||
|
||||
SaveIntegerBits(param_1, &gGameOptionsRef->mapOption, NUM_GBA_MAP_OPTIONS);
|
||||
SaveIntegerBits(param_1, &gGameOptionsRef->unkC, 2);
|
||||
WriteBits(param_1, &gGameOptionsRef->mapOption, NUM_GBA_MAP_OPTIONS);
|
||||
WriteBits(param_1, &gGameOptionsRef->unkC, 2);
|
||||
}
|
||||
|
||||
void ReadGameOptions(struct unkStruct_8094924 *param_1)
|
||||
void ReadGameOptionsBits(DataSerializer *param_1)
|
||||
{
|
||||
u8 byteArray[4];
|
||||
RestoreIntegerBits(param_1, byteArray, 2);
|
||||
ReadBits(param_1, byteArray, 2);
|
||||
gGameOptionsRef->windowColor = byteArray[0] & NUM_WINDOW_COLORS;
|
||||
|
||||
RestoreIntegerBits(param_1, byteArray, 1);
|
||||
ReadBits(param_1, byteArray, 1);
|
||||
gGameOptionsRef->unk9 = byteArray[0] & 1;
|
||||
|
||||
RestoreIntegerBits(param_1, byteArray, 1);
|
||||
ReadBits(param_1, byteArray, 1);
|
||||
gGameOptionsRef->unkA = byteArray[0] & 1;
|
||||
|
||||
RestoreIntegerBits(param_1, byteArray, 1);
|
||||
ReadBits(param_1, byteArray, 1);
|
||||
gGameOptionsRef->playerGender = byteArray[0] & 1;
|
||||
|
||||
RestoreIntegerBits(param_1, byteArray, 1);
|
||||
ReadBits(param_1, byteArray, 1);
|
||||
gGameOptionsRef->dungeonSpeed = byteArray[0] & 1;
|
||||
|
||||
RestoreIntegerBits(param_1, byteArray, 1);
|
||||
ReadBits(param_1, byteArray, 1);
|
||||
gGameOptionsRef->FarOffPals = byteArray[0] & 1;
|
||||
|
||||
RestoreIntegerBits(param_1, byteArray, 1);
|
||||
ReadBits(param_1, byteArray, 1);
|
||||
gGameOptionsRef->damageTurn = byteArray[0] & 1;
|
||||
|
||||
RestoreIntegerBits(param_1, byteArray, 1);
|
||||
ReadBits(param_1, byteArray, 1);
|
||||
gGameOptionsRef->gridEnable = byteArray[0] & 1;
|
||||
|
||||
RestoreIntegerBits(param_1, byteArray, 3);
|
||||
ReadBits(param_1, byteArray, 3);
|
||||
gGameOptionsRef->mapOption = byteArray[0] & NUM_DS_MAP_OPTIONS;
|
||||
|
||||
RestoreIntegerBits(param_1, byteArray, 2);
|
||||
ReadBits(param_1, byteArray, 2);
|
||||
gGameOptionsRef->unkC = byteArray[0] & 3;
|
||||
|
||||
SetWindowBGColor();
|
||||
|
@ -1479,7 +1479,7 @@ s32 ExecuteScriptCommand(Action *action) {
|
||||
break;
|
||||
}
|
||||
case 0xb2: {
|
||||
sub_80976F8(curCmd.argShort);
|
||||
SetAdventureAchievement(curCmd.argShort);
|
||||
break;
|
||||
}
|
||||
case 0xb3: {
|
||||
|
86
src/items.c
86
src/items.c
@ -1108,76 +1108,78 @@ bool8 AddKecleonWareItem(u8 itemIndex) {
|
||||
|
||||
s32 SaveTeamInventory(u8* unk0, u32 size)
|
||||
{
|
||||
struct unkStruct_8094924 unk;
|
||||
DataSerializer unk;
|
||||
s32 i;
|
||||
|
||||
xxx_init_struct_8094924_save_809486C(&unk, unk0, size);
|
||||
InitBitWriter(&unk, unk0, size);
|
||||
for (i = 0; i < INVENTORY_SIZE; i++) {
|
||||
SaveItemSlot(&unk, &gTeamInventoryRef->teamItems[i]);
|
||||
WriteItemSlotBits(&unk, &gTeamInventoryRef->teamItems[i]);
|
||||
}
|
||||
for (i = 0; i < STORAGE_SIZE; i++) {
|
||||
SaveIntegerBits(&unk, &gTeamInventoryRef->teamStorage[i], 10);
|
||||
WriteBits(&unk, &gTeamInventoryRef->teamStorage[i], 10);
|
||||
}
|
||||
for (i = 0; i < MAX_KECLEON_ITEM_SHOP_ITEMS; i++) {
|
||||
SaveHeldItem(&unk, &gTeamInventoryRef->kecleonShopItems[i]);
|
||||
WriteHeldItemBits(&unk, &gTeamInventoryRef->kecleonShopItems[i]);
|
||||
}
|
||||
for (i = 0; i < MAX_KECLEON_WARE_SHOP_ITEMS; i++) {
|
||||
SaveHeldItem(&unk, &gTeamInventoryRef->kecleonWareItems[i]);
|
||||
WriteHeldItemBits(&unk, &gTeamInventoryRef->kecleonWareItems[i]);
|
||||
}
|
||||
SaveIntegerBits(&unk, &gTeamInventoryRef->teamMoney, 24);
|
||||
SaveIntegerBits(&unk, &gTeamInventoryRef->teamSavings, 24);
|
||||
WriteBits(&unk, &gTeamInventoryRef->teamMoney, 24);
|
||||
WriteBits(&unk, &gTeamInventoryRef->teamSavings, 24);
|
||||
|
||||
nullsub_102(&unk);
|
||||
return unk.unk8;
|
||||
return unk.count;
|
||||
}
|
||||
|
||||
s32 RestoreTeamInventory(u8 *unk0, u32 size)
|
||||
{
|
||||
struct unkStruct_8094924 unk;
|
||||
s32 i;
|
||||
DataSerializer unk;
|
||||
s32 i;
|
||||
|
||||
xxx_init_struct_8094924_restore_809485C(&unk, unk0, size);
|
||||
for (i = 0; i < INVENTORY_SIZE; i++) {
|
||||
RestoreItemSlot(&unk, &gTeamInventoryRef->teamItems[i]);
|
||||
}
|
||||
for (i = 0; i < STORAGE_SIZE; i++) {
|
||||
RestoreIntegerBits(&unk, &gTeamInventoryRef->teamStorage[i], 10);
|
||||
}
|
||||
for (i = 0; i < MAX_KECLEON_ITEM_SHOP_ITEMS; i++) {
|
||||
RestoreHeldItem(&unk, &gTeamInventoryRef->kecleonShopItems[i]);
|
||||
}
|
||||
for (i = 0; i < MAX_KECLEON_WARE_SHOP_ITEMS; i++) {
|
||||
RestoreHeldItem(&unk, &gTeamInventoryRef->kecleonWareItems[i]);
|
||||
}
|
||||
RestoreIntegerBits(&unk, &gTeamInventoryRef->teamMoney, 24);
|
||||
RestoreIntegerBits(&unk, &gTeamInventoryRef->teamSavings, 24);
|
||||
nullsub_102(&unk);
|
||||
return unk.unk8;
|
||||
InitBitReader(&unk, unk0, size);
|
||||
for (i = 0; i < INVENTORY_SIZE; i++) {
|
||||
ReadItemSlotBits(&unk, &gTeamInventoryRef->teamItems[i]);
|
||||
}
|
||||
for (i = 0; i < STORAGE_SIZE; i++) {
|
||||
ReadBits(&unk, &gTeamInventoryRef->teamStorage[i], 10);
|
||||
}
|
||||
for (i = 0; i < MAX_KECLEON_ITEM_SHOP_ITEMS; i++) {
|
||||
ReadHeldItemBits(&unk, &gTeamInventoryRef->kecleonShopItems[i]);
|
||||
}
|
||||
for (i = 0; i < MAX_KECLEON_WARE_SHOP_ITEMS; i++) {
|
||||
ReadHeldItemBits(&unk, &gTeamInventoryRef->kecleonWareItems[i]);
|
||||
}
|
||||
ReadBits(&unk, &gTeamInventoryRef->teamMoney, 24);
|
||||
ReadBits(&unk, &gTeamInventoryRef->teamSavings, 24);
|
||||
|
||||
nullsub_102(&unk);
|
||||
return unk.count;
|
||||
}
|
||||
|
||||
void RestoreHeldItem(struct unkStruct_8094924 *a1, BulkItem *item)
|
||||
void ReadHeldItemBits(DataSerializer *a1, BulkItem *item)
|
||||
{
|
||||
RestoreIntegerBits(a1, &item->id, 8);
|
||||
RestoreIntegerBits(a1, &item->quantity, 7);
|
||||
ReadBits(a1, &item->id, 8);
|
||||
ReadBits(a1, &item->quantity, 7);
|
||||
}
|
||||
|
||||
void SaveHeldItem(struct unkStruct_8094924 *a1, BulkItem *item)
|
||||
void WriteHeldItemBits(DataSerializer *a1, BulkItem *item)
|
||||
{
|
||||
SaveIntegerBits(a1, &item->id, 8);
|
||||
SaveIntegerBits(a1, &item->quantity, 7);
|
||||
WriteBits(a1, &item->id, 8);
|
||||
WriteBits(a1, &item->quantity, 7);
|
||||
}
|
||||
|
||||
void RestoreItemSlot(struct unkStruct_8094924 *a1, Item *slot)
|
||||
void ReadItemSlotBits(DataSerializer *a1, Item *slot)
|
||||
{
|
||||
RestoreIntegerBits(a1, &slot->flags, 8);
|
||||
RestoreIntegerBits(a1, &slot->quantity, 7);
|
||||
RestoreIntegerBits(a1, &slot->id, 8);
|
||||
ReadBits(a1, &slot->flags, 8);
|
||||
ReadBits(a1, &slot->quantity, 7);
|
||||
ReadBits(a1, &slot->id, 8);
|
||||
}
|
||||
|
||||
void SaveItemSlot(struct unkStruct_8094924 *a1, Item *slot)
|
||||
void WriteItemSlotBits(DataSerializer *a1, Item *slot)
|
||||
{
|
||||
SaveIntegerBits(a1, &slot->flags, 8);
|
||||
SaveIntegerBits(a1, &slot->quantity, 7);
|
||||
SaveIntegerBits(a1, &slot->id, 8);
|
||||
WriteBits(a1, &slot->flags, 8);
|
||||
WriteBits(a1, &slot->quantity, 7);
|
||||
WriteBits(a1, &slot->id, 8);
|
||||
}
|
||||
|
||||
const char *sub_8091E50(u8 index)
|
||||
|
@ -313,7 +313,7 @@ static void UpdateLuminousCaveDialogue(void)
|
||||
monName = GetMonSpecies(sLuminousCaveWork->evolveStatus.targetEvolveSpecies);
|
||||
strcpy(gFormatBuffer_Monsters[1],monName);
|
||||
sLuminousCaveWork->evolutionComplete = TRUE;
|
||||
sub_80977D0();
|
||||
IncrementNumEvolved();
|
||||
sub_808F734(sLuminousCaveWork->pokeStruct,sLuminousCaveWork->evolveStatus.targetEvolveSpecies);
|
||||
nullsub_104();
|
||||
sLuminousCaveWork->pokeStruct = GetPlayerPokemonStruct();
|
||||
|
62
src/moves.c
62
src/moves.c
@ -1515,74 +1515,74 @@ void sub_8094060(Move *srcMoves, Move *destMoves)
|
||||
destMoves[j++].moveFlags = 0;
|
||||
}
|
||||
|
||||
static void SavePokemonMove(struct unkStruct_8094924 *r0, Move *move)
|
||||
static void WritePoke1MoveBits(DataSerializer *r0, Move *move)
|
||||
{
|
||||
SaveIntegerBits(r0, &move->moveFlags, 4);
|
||||
SaveIntegerBits(r0, &move->id, 9);
|
||||
SaveIntegerBits(r0, &move->PP, 7);
|
||||
WriteBits(r0, &move->moveFlags, 4);
|
||||
WriteBits(r0, &move->id, 9);
|
||||
WriteBits(r0, &move->PP, 7);
|
||||
}
|
||||
|
||||
static void RestorePokemonMove(struct unkStruct_8094924 *r0, Move *move)
|
||||
static void ReadPoke1MoveBits(DataSerializer *r0, Move *move)
|
||||
{
|
||||
RestoreIntegerBits(r0, &move->moveFlags, 4);
|
||||
RestoreIntegerBits(r0, &move->id, 9);
|
||||
RestoreIntegerBits(r0, &move->PP, 7);
|
||||
ReadBits(r0, &move->moveFlags, 4);
|
||||
ReadBits(r0, &move->id, 9);
|
||||
ReadBits(r0, &move->PP, 7);
|
||||
}
|
||||
|
||||
void SavePokemonMoves(struct unkStruct_8094924 *r0, Move *moveSet)
|
||||
void WritePoke1MovesBits(DataSerializer *r0, Move *moveSet)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
SavePokemonMove(r0, &moveSet[i]);
|
||||
WritePoke1MoveBits(r0, &moveSet[i]);
|
||||
}
|
||||
|
||||
void RestorePokemonMoves(struct unkStruct_8094924 *r0, Move *moveSet)
|
||||
void ReadPoke1MovesBits(DataSerializer *r0, Move *moveSet)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
RestorePokemonMove(r0, &moveSet[i]);
|
||||
ReadPoke1MoveBits(r0, &moveSet[i]);
|
||||
}
|
||||
|
||||
static void sub_8094148(struct unkStruct_8094924 *r0, Move *move)
|
||||
static void WritePoke2MoveBits(DataSerializer *r0, Move *move)
|
||||
{
|
||||
SaveIntegerBits(r0, &move->moveFlags, 4);
|
||||
SaveIntegerBits(r0, &move->moveFlags2, 1);
|
||||
SaveIntegerBits(r0, &move->id, 9);
|
||||
SaveIntegerBits(r0, &move->PP, 7);
|
||||
SaveIntegerBits(r0, &move->ginseng, 7);
|
||||
WriteBits(r0, &move->moveFlags, 4);
|
||||
WriteBits(r0, &move->moveFlags2, 1);
|
||||
WriteBits(r0, &move->id, 9);
|
||||
WriteBits(r0, &move->PP, 7);
|
||||
WriteBits(r0, &move->ginseng, 7);
|
||||
}
|
||||
|
||||
void sub_8094184(struct unkStruct_8094924 *r0, struct Moves *r1)
|
||||
void WritePoke2MovesBits(DataSerializer *r0, struct Moves *r1)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
sub_8094148(r0, &r1->moves[i]);
|
||||
WritePoke2MoveBits(r0, &r1->moves[i]);
|
||||
|
||||
SaveIntegerBits(r0, &r1->struggleMoveFlags, 8);
|
||||
WriteBits(r0, &r1->struggleMoveFlags, 8);
|
||||
}
|
||||
|
||||
static void sub_80941B0(struct unkStruct_8094924 *r0, Move *move)
|
||||
static void ReadPoke2MoveBits(DataSerializer *r0, Move *move)
|
||||
{
|
||||
memset(move, 0, sizeof(Move));
|
||||
RestoreIntegerBits(r0, &move->moveFlags, 4);
|
||||
RestoreIntegerBits(r0, &move->moveFlags2, 1);
|
||||
RestoreIntegerBits(r0, &move->id, 9);
|
||||
RestoreIntegerBits(r0, &move->PP, 7);
|
||||
RestoreIntegerBits(r0, &move->ginseng, 7);
|
||||
ReadBits(r0, &move->moveFlags, 4);
|
||||
ReadBits(r0, &move->moveFlags2, 1);
|
||||
ReadBits(r0, &move->id, 9);
|
||||
ReadBits(r0, &move->PP, 7);
|
||||
ReadBits(r0, &move->ginseng, 7);
|
||||
}
|
||||
|
||||
void sub_80941FC(struct unkStruct_8094924 *r0, struct Moves*r1)
|
||||
void ReadPoke2MovesBits(DataSerializer *r0, struct Moves*r1)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
sub_80941B0(r0, &r1->moves[i]);
|
||||
ReadPoke2MoveBits(r0, &r1->moves[i]);
|
||||
|
||||
r1->struggleMoveFlags= 0;
|
||||
RestoreIntegerBits(r0, &r1->struggleMoveFlags, 8);
|
||||
r1->struggleMoveFlags = 0;
|
||||
ReadBits(r0, &r1->struggleMoveFlags, 8);
|
||||
}
|
||||
|
||||
bool8 DoesMoveCharge(u16 move)
|
||||
|
@ -75,18 +75,18 @@ void DeconstructPlayTime(struct PlayTimeStruct *r0, u32 *outHours, u32 *outMinut
|
||||
}
|
||||
}
|
||||
|
||||
void WritePlayTime(struct unkStruct_8094924 *r0)
|
||||
void WritePlayTimeBits(DataSerializer *r0)
|
||||
{
|
||||
SaveIntegerBits(r0, &gPlayTimeRef->frames, 6);
|
||||
SaveIntegerBits(r0, &gPlayTimeRef->seconds, 6);
|
||||
SaveIntegerBits(r0, &gPlayTimeRef->minutes, 6);
|
||||
SaveIntegerBits(r0, &gPlayTimeRef->hours, 14);
|
||||
WriteBits(r0, &gPlayTimeRef->frames, 6);
|
||||
WriteBits(r0, &gPlayTimeRef->seconds, 6);
|
||||
WriteBits(r0, &gPlayTimeRef->minutes, 6);
|
||||
WriteBits(r0, &gPlayTimeRef->hours, 14);
|
||||
}
|
||||
|
||||
void ReadPlayTime(struct unkStruct_8094924 *r0)
|
||||
void ReadPlayTimeBits(DataSerializer *r0)
|
||||
{
|
||||
RestoreIntegerBits(r0, &gPlayTimeRef->frames, 6);
|
||||
RestoreIntegerBits(r0, &gPlayTimeRef->seconds, 6);
|
||||
RestoreIntegerBits(r0, &gPlayTimeRef->minutes, 6);
|
||||
RestoreIntegerBits(r0, &gPlayTimeRef->hours, 14);
|
||||
ReadBits(r0, &gPlayTimeRef->frames, 6);
|
||||
ReadBits(r0, &gPlayTimeRef->seconds, 6);
|
||||
ReadBits(r0, &gPlayTimeRef->minutes, 6);
|
||||
ReadBits(r0, &gPlayTimeRef->hours, 14);
|
||||
}
|
||||
|
344
src/pokemon_3.c
344
src/pokemon_3.c
@ -46,15 +46,15 @@ extern s32 gUnknown_810AC90[10];
|
||||
|
||||
#include "data/pokemon_3.h"
|
||||
|
||||
extern void SaveDungeonLocation(struct unkStruct_8094924*, DungeonLocation*);
|
||||
extern void xxx_save_poke_sub_c_808F41C(struct unkStruct_8094924*, struct unkPokeSubStruct_C*);
|
||||
void RestoreDungeonLocation(struct unkStruct_8094924*, DungeonLocation*);
|
||||
void xxx_restore_poke_sub_c_808F410(struct unkStruct_8094924*, struct unkPokeSubStruct_C*);
|
||||
extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*);
|
||||
extern void WritePoke1LevelBits(DataSerializer*, struct unkPokeSubStruct_C*);
|
||||
void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*);
|
||||
void ReadPoke1LevelBits(DataSerializer*, struct unkPokeSubStruct_C*);
|
||||
|
||||
extern void sub_809449C(struct unkStruct_8094924*, void*);
|
||||
extern void SavePokemonHiddenPower(struct unkStruct_8094924*, HiddenPower*);
|
||||
extern void sub_809447C(struct unkStruct_8094924*, void*);
|
||||
extern void RestorePokemonHiddenPower(struct unkStruct_8094924*, HiddenPower*);
|
||||
extern void WriteBellyBits(DataSerializer*, FixedPoint *src);
|
||||
extern void WriteHiddenPowerBits(DataSerializer*, HiddenPower*);
|
||||
extern void ReadBellyBits(DataSerializer*, FixedPoint *dst);
|
||||
extern void ReadHiddenPowerBits(DataSerializer*, HiddenPower*);
|
||||
s16 GetPokemonEvolveConditions(s16 index, unkEvolve *r1);
|
||||
|
||||
u32 sub_808F798(PokemonStruct1 *, s16);
|
||||
@ -644,266 +644,274 @@ void sub_808ED00() {
|
||||
}
|
||||
|
||||
for (; i < MAX_TEAM_MEMBERS; i++) {
|
||||
gRecruitedPokemonRef->team[i].unk0 = 0;
|
||||
gRecruitedPokemonRef->team[i].unk0 = FLAG_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
s32 SaveRecruitedPokemon(u8 *a1, s32 a2)
|
||||
{
|
||||
u16 buffer[6];
|
||||
struct unkStruct_8094924 backup;
|
||||
u16 sixMons[6];
|
||||
DataSerializer backup;
|
||||
u8 data_u8;
|
||||
s16 data_s16;
|
||||
s16 teamLeader;
|
||||
s32 count;
|
||||
s32 i;
|
||||
PokemonStruct1 *pokemon;
|
||||
|
||||
xxx_init_struct_8094924_save_809486C(&backup, a1, a2);
|
||||
InitBitWriter(&backup, a1, a2);
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
buffer[i] = -1;
|
||||
}
|
||||
for (i = 0; i < 6; i++)
|
||||
sixMons[i] = -1;
|
||||
|
||||
data_s16 = 1;
|
||||
data_s16 = -data_s16;
|
||||
teamLeader = 1; // Maybe fakematch, should be -1
|
||||
teamLeader = -teamLeader;
|
||||
count = 0;
|
||||
|
||||
for (i = 0; i < NUM_MONSTERS; i++) {
|
||||
// Some check was optimized out. Needed for matching. Thanks kaz
|
||||
// Fakematch, probably need the PokemonFlag2 inline
|
||||
if (i) {
|
||||
u8 unk = -unk;
|
||||
}
|
||||
|
||||
pokemon = &gRecruitedPokemonRef->pokemon[i];
|
||||
|
||||
if (pokemon->unk0 & 1) {
|
||||
if (pokemon->unk0 & FLAG_ON_TEAM) {
|
||||
buffer[count++] = i;
|
||||
}
|
||||
if (pokemon->isTeamLeader) {
|
||||
data_s16 = i;
|
||||
}
|
||||
if (PokemonFlag1(pokemon)) {
|
||||
if (pokemon->unk0 & FLAG_ON_TEAM)
|
||||
sixMons[count++] = i;
|
||||
|
||||
if (IsMonTeamLeader(pokemon))
|
||||
teamLeader = i;
|
||||
}
|
||||
else {
|
||||
else
|
||||
pokemon->level = 0;
|
||||
}
|
||||
SavePokemonStruct(&backup, pokemon);
|
||||
|
||||
WritePoke1Bits(&backup, pokemon);
|
||||
}
|
||||
|
||||
// Team members
|
||||
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
|
||||
if ((u8)i[gRecruitedPokemonRef->team].unk0 & 1) {
|
||||
data_u8 = 0xff;
|
||||
}
|
||||
else {
|
||||
if (PokemonFlag1(&gRecruitedPokemonRef->team[i]))
|
||||
data_u8 = 0xFF;
|
||||
else
|
||||
data_u8 = 0;
|
||||
}
|
||||
SaveIntegerBits(&backup, &data_u8, 1);
|
||||
SavePokemonStruct(&backup, &gRecruitedPokemonRef->team[i]);
|
||||
|
||||
WriteBits(&backup, &data_u8, 1);
|
||||
WritePoke1Bits(&backup, &gRecruitedPokemonRef->team[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
SaveIntegerBits(&backup, (u8*)&buffer[i], 16);
|
||||
}
|
||||
SaveIntegerBits(&backup, (u8*)&data_s16, 16);
|
||||
// ???
|
||||
for (i = 0; i < 6; i++)
|
||||
WriteBits(&backup, &sixMons[i], 16);
|
||||
|
||||
// Team leader
|
||||
WriteBits(&backup, &teamLeader, 16);
|
||||
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
return backup.count;
|
||||
}
|
||||
|
||||
s32 RestoreRecruitedPokemon(u8 *a1, s32 a2)
|
||||
{
|
||||
struct unkStruct_8094924 backup;
|
||||
u8 data_u8; // same as saverecruitedpokemon
|
||||
s16 data_s16; // same as saverecruitedpokemon
|
||||
DataSerializer backup;
|
||||
u8 data_u8;
|
||||
s16 data_s16;
|
||||
s32 i;
|
||||
|
||||
xxx_init_struct_8094924_restore_809485C(&backup, a1, a2);
|
||||
InitBitReader(&backup, a1, a2);
|
||||
|
||||
for (i = 0; i < NUM_MONSTERS; i++) {
|
||||
RestorePokemonStruct(&backup, &gRecruitedPokemonRef->pokemon[i]);
|
||||
ReadPoke1Bits(&backup, &gRecruitedPokemonRef->pokemon[i]);
|
||||
}
|
||||
|
||||
// Team members
|
||||
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
|
||||
RestoreIntegerBits(&backup, &data_u8, 1);
|
||||
RestorePokemonStruct(&backup, &gRecruitedPokemonRef->team[i]);
|
||||
if (data_u8 & 1) {
|
||||
gRecruitedPokemonRef->team[i].unk0 = 3; // FLAG_ON_TEAM (2) + ??? (1)
|
||||
}
|
||||
else {
|
||||
gRecruitedPokemonRef->team[i].unk0 = 0;
|
||||
}
|
||||
ReadBits(&backup, &data_u8, 1);
|
||||
ReadPoke1Bits(&backup, &gRecruitedPokemonRef->team[i]);
|
||||
if (data_u8 & 1)
|
||||
gRecruitedPokemonRef->team[i].unk0 = FLAG_ON_TEAM | FLAG_UNK_1;
|
||||
else
|
||||
gRecruitedPokemonRef->team[i].unk0 = FLAG_NONE;
|
||||
}
|
||||
|
||||
// ???
|
||||
for (i = 0; i < 6; i++) {
|
||||
RestoreIntegerBits(&backup, &data_s16, 16);
|
||||
if ((u16)data_s16 < NUM_MONSTERS) {
|
||||
ReadBits(&backup, &data_s16, 16);
|
||||
if ((u16)data_s16 < NUM_MONSTERS)
|
||||
gRecruitedPokemonRef->pokemon[data_s16].unk0 |= FLAG_ON_TEAM;
|
||||
}
|
||||
}
|
||||
RestoreIntegerBits(&backup, &data_s16, 16);
|
||||
if ((u16)data_s16 < NUM_MONSTERS) {
|
||||
|
||||
// Team leader
|
||||
ReadBits(&backup, &data_s16, 16);
|
||||
if ((u16)data_s16 < NUM_MONSTERS)
|
||||
gRecruitedPokemonRef->pokemon[data_s16].isTeamLeader = TRUE;
|
||||
}
|
||||
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
return backup.count;
|
||||
}
|
||||
|
||||
void SavePokemonStruct(struct unkStruct_8094924* a1, PokemonStruct1* pokemon)
|
||||
void WritePoke1Bits(DataSerializer* a1, PokemonStruct1* pokemon)
|
||||
{
|
||||
SaveIntegerBits(a1, &pokemon->level, 7);
|
||||
SaveIntegerBits(a1, &pokemon->speciesNum, 9);
|
||||
SaveDungeonLocation(a1, &pokemon->dungeonLocation);
|
||||
xxx_save_poke_sub_c_808F41C(a1, &pokemon->unkC[0]);
|
||||
xxx_save_poke_sub_c_808F41C(a1, &pokemon->unkC[1]);
|
||||
SaveIntegerBits(a1, &pokemon->IQ, 10);
|
||||
SaveIntegerBits(a1, &pokemon->pokeHP, 10);
|
||||
SaveIntegerBits(a1, &pokemon->offense.att[0], 8);
|
||||
SaveIntegerBits(a1, &pokemon->offense.att[1], 8);
|
||||
SaveIntegerBits(a1, &pokemon->offense.def[0], 8);
|
||||
SaveIntegerBits(a1, &pokemon->offense.def[1], 8);
|
||||
SaveIntegerBits(a1, &pokemon->currExp, 24);
|
||||
SaveIntegerBits(a1, &pokemon->IQSkills, 24);
|
||||
SaveIntegerBits(a1, &pokemon->tacticIndex, 4);
|
||||
SaveHeldItem(a1, &pokemon->heldItem);
|
||||
SavePokemonMoves(a1, pokemon->moves);
|
||||
SaveIntegerBits(a1, pokemon->name, 80);
|
||||
WriteBits(a1, &pokemon->level, 7);
|
||||
WriteBits(a1, &pokemon->speciesNum, 9);
|
||||
WriteDungeonLocationBits(a1, &pokemon->dungeonLocation);
|
||||
WritePoke1LevelBits(a1, &pokemon->unkC[0]);
|
||||
WritePoke1LevelBits(a1, &pokemon->unkC[1]);
|
||||
WriteBits(a1, &pokemon->IQ, 10);
|
||||
WriteBits(a1, &pokemon->pokeHP, 10);
|
||||
WriteBits(a1, &pokemon->offense.att[0], 8);
|
||||
WriteBits(a1, &pokemon->offense.att[1], 8);
|
||||
WriteBits(a1, &pokemon->offense.def[0], 8);
|
||||
WriteBits(a1, &pokemon->offense.def[1], 8);
|
||||
WriteBits(a1, &pokemon->currExp, 24);
|
||||
WriteBits(a1, &pokemon->IQSkills, 24);
|
||||
WriteBits(a1, &pokemon->tacticIndex, 4);
|
||||
WriteHeldItemBits(a1, &pokemon->heldItem);
|
||||
WritePoke1MovesBits(a1, pokemon->moves);
|
||||
WriteBits(a1, pokemon->name, 10 * 8);
|
||||
}
|
||||
|
||||
void RestorePokemonStruct(struct unkStruct_8094924* a1, PokemonStruct1* pokemon)
|
||||
void ReadPoke1Bits(DataSerializer* a1, PokemonStruct1* pokemon)
|
||||
{
|
||||
memset(pokemon, 0, sizeof(PokemonStruct1));
|
||||
pokemon->unk0 = 0;
|
||||
pokemon->isTeamLeader = 0;
|
||||
RestoreIntegerBits(a1, &pokemon->level, 7);
|
||||
if (pokemon->level) {
|
||||
pokemon->unk0 |= 1;
|
||||
}
|
||||
RestoreIntegerBits(a1, &pokemon->speciesNum, 9);
|
||||
RestoreDungeonLocation(a1, &pokemon->dungeonLocation);
|
||||
xxx_restore_poke_sub_c_808F410(a1, &pokemon->unkC[0]);
|
||||
xxx_restore_poke_sub_c_808F410(a1, &pokemon->unkC[1]);
|
||||
RestoreIntegerBits(a1, &pokemon->IQ, 10);
|
||||
RestoreIntegerBits(a1, &pokemon->pokeHP, 10);
|
||||
RestoreIntegerBits(a1, &pokemon->offense.att[0], 8);
|
||||
RestoreIntegerBits(a1, &pokemon->offense.att[1], 8);
|
||||
RestoreIntegerBits(a1, &pokemon->offense.def[0], 8);
|
||||
RestoreIntegerBits(a1, &pokemon->offense.def[1], 8);
|
||||
RestoreIntegerBits(a1, &pokemon->currExp, 24);
|
||||
RestoreIntegerBits(a1, &pokemon->IQSkills, 24);
|
||||
RestoreIntegerBits(a1, &pokemon->tacticIndex, 4);
|
||||
RestoreHeldItem(a1, &pokemon->heldItem);
|
||||
RestorePokemonMoves(a1, pokemon->moves);
|
||||
RestoreIntegerBits(a1, pokemon->name, 80);
|
||||
memset(pokemon, 0, sizeof(PokemonStruct1));
|
||||
|
||||
pokemon->unk0 = FLAG_NONE;
|
||||
pokemon->isTeamLeader = FALSE;
|
||||
|
||||
ReadBits(a1, &pokemon->level, 7);
|
||||
if (pokemon->level)
|
||||
pokemon->unk0 |= FLAG_UNK_1;
|
||||
|
||||
ReadBits(a1, &pokemon->speciesNum, 9);
|
||||
ReadDungeonLocationBits(a1, &pokemon->dungeonLocation);
|
||||
ReadPoke1LevelBits(a1, &pokemon->unkC[0]);
|
||||
ReadPoke1LevelBits(a1, &pokemon->unkC[1]);
|
||||
ReadBits(a1, &pokemon->IQ, 10);
|
||||
ReadBits(a1, &pokemon->pokeHP, 10);
|
||||
ReadBits(a1, &pokemon->offense.att[0], 8);
|
||||
ReadBits(a1, &pokemon->offense.att[1], 8);
|
||||
ReadBits(a1, &pokemon->offense.def[0], 8);
|
||||
ReadBits(a1, &pokemon->offense.def[1], 8);
|
||||
ReadBits(a1, &pokemon->currExp, 24);
|
||||
ReadBits(a1, &pokemon->IQSkills, 24);
|
||||
ReadBits(a1, &pokemon->tacticIndex, 4);
|
||||
ReadHeldItemBits(a1, &pokemon->heldItem);
|
||||
ReadPoke1MovesBits(a1, pokemon->moves);
|
||||
ReadBits(a1, pokemon->name, 10 * 8);
|
||||
}
|
||||
|
||||
s32 SavePokemonStruct2(u8* a1, s32 size)
|
||||
s32 SavePoke2s(u8* buffer, s32 size)
|
||||
{
|
||||
struct unkStruct_8094924 backup;
|
||||
DataSerializer backup;
|
||||
s32 i;
|
||||
u8 data_u8_neg1;
|
||||
u8 data_u8_zero;
|
||||
|
||||
xxx_init_struct_8094924_save_809486C(&backup, a1, size);
|
||||
InitBitWriter(&backup, buffer, size);
|
||||
data_u8_neg1 = -1;
|
||||
data_u8_zero = 0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
PokemonStruct2* pokemon2 = &gRecruitedPokemonRef->pokemon2[i];
|
||||
SaveIntegerBits(&backup, &pokemon2->unk0, 2);
|
||||
WriteBits(&backup, &pokemon2->unk0, 2);
|
||||
|
||||
SaveIntegerBits(&backup, pokemon2->isTeamLeader ? &data_u8_neg1 : &data_u8_zero, 1);
|
||||
SaveIntegerBits(&backup, &pokemon2->level, 7);
|
||||
WriteBits(&backup, pokemon2->isTeamLeader ? &data_u8_neg1 : &data_u8_zero, 1);
|
||||
WriteBits(&backup, &pokemon2->level, 7);
|
||||
|
||||
SaveDungeonLocation(&backup, &pokemon2->dungeonLocation);
|
||||
SaveIntegerBits(&backup, &pokemon2->IQ, 10);
|
||||
SaveIntegerBits(&backup, &pokemon2->unkA, 16);
|
||||
SaveIntegerBits(&backup, &pokemon2->unkC, 16);
|
||||
SaveIntegerBits(&backup, &pokemon2->speciesNum, 9);
|
||||
SaveIntegerBits(&backup, &pokemon2->unk10, 10);
|
||||
SaveIntegerBits(&backup, &pokemon2->unk12, 10);
|
||||
SaveIntegerBits(&backup, &pokemon2->offense.att[0], 8);
|
||||
SaveIntegerBits(&backup, &pokemon2->offense.att[1], 8);
|
||||
SaveIntegerBits(&backup, &pokemon2->offense.def[0], 8);
|
||||
SaveIntegerBits(&backup, &pokemon2->offense.def[1], 8);
|
||||
SaveIntegerBits(&backup, &pokemon2->currExp, 24);
|
||||
sub_8094184(&backup, &pokemon2->moves);
|
||||
SaveItemSlot(&backup, &pokemon2->itemSlot);
|
||||
sub_809449C(&backup, &pokemon2->belly);
|
||||
sub_809449C(&backup, &pokemon2->maxBelly);
|
||||
SaveIntegerBits(&backup, &pokemon2->IQSkills, 24);
|
||||
SaveIntegerBits(&backup, &pokemon2->tacticIndex, 4);
|
||||
SavePokemonHiddenPower(&backup, &pokemon2->hiddenPower);
|
||||
SaveIntegerBits(&backup, &pokemon2->name, 80);
|
||||
WriteDungeonLocationBits(&backup, &pokemon2->dungeonLocation);
|
||||
WriteBits(&backup, &pokemon2->IQ, 10);
|
||||
WriteBits(&backup, &pokemon2->unkA, 16);
|
||||
WriteBits(&backup, &pokemon2->unkC, 16);
|
||||
WriteBits(&backup, &pokemon2->speciesNum, 9);
|
||||
WriteBits(&backup, &pokemon2->unk10, 10);
|
||||
WriteBits(&backup, &pokemon2->unk12, 10);
|
||||
WriteBits(&backup, &pokemon2->offense.att[0], 8);
|
||||
WriteBits(&backup, &pokemon2->offense.att[1], 8);
|
||||
WriteBits(&backup, &pokemon2->offense.def[0], 8);
|
||||
WriteBits(&backup, &pokemon2->offense.def[1], 8);
|
||||
WriteBits(&backup, &pokemon2->currExp, 24);
|
||||
WritePoke2MovesBits(&backup, &pokemon2->moves);
|
||||
WriteItemSlotBits(&backup, &pokemon2->itemSlot);
|
||||
WriteBellyBits(&backup, &pokemon2->belly);
|
||||
WriteBellyBits(&backup, &pokemon2->maxBelly);
|
||||
WriteBits(&backup, &pokemon2->IQSkills, 24);
|
||||
WriteBits(&backup, &pokemon2->tacticIndex, 4);
|
||||
WriteHiddenPowerBits(&backup, &pokemon2->hiddenPower);
|
||||
WriteBits(&backup, &pokemon2->name, 10 * 8);
|
||||
}
|
||||
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
return backup.count;
|
||||
}
|
||||
|
||||
s32 RestorePokemonStruct2(u8* a1, s32 size)
|
||||
s32 RestorePoke2s(u8* a1, s32 size)
|
||||
{
|
||||
struct unkStruct_8094924 backup;
|
||||
DataSerializer backup;
|
||||
s32 i;
|
||||
|
||||
xxx_init_struct_8094924_restore_809485C(&backup, a1, size);
|
||||
InitBitReader(&backup, a1, size);
|
||||
for (i = 0; i < 4; i++) {
|
||||
PokemonStruct2* pokemon2 = &gRecruitedPokemonRef->pokemon2[i];
|
||||
u8 unk2;
|
||||
|
||||
memset(pokemon2, 0, sizeof(PokemonStruct2));
|
||||
|
||||
RestoreIntegerBits(&backup, &pokemon2->unk0, 2);
|
||||
ReadBits(&backup, &pokemon2->unk0, 2);
|
||||
|
||||
RestoreIntegerBits(&backup, &unk2, 1);
|
||||
ReadBits(&backup, &unk2, 1);
|
||||
if (unk2 & 1) {
|
||||
pokemon2->isTeamLeader = TRUE;
|
||||
}
|
||||
else {
|
||||
pokemon2->isTeamLeader = FALSE;
|
||||
}
|
||||
RestoreIntegerBits(&backup, &pokemon2->level, 7);
|
||||
ReadBits(&backup, &pokemon2->level, 7);
|
||||
|
||||
RestoreDungeonLocation(&backup, &pokemon2->dungeonLocation);
|
||||
RestoreIntegerBits(&backup, &pokemon2->IQ, 10);
|
||||
RestoreIntegerBits(&backup, &pokemon2->unkA, 16);
|
||||
RestoreIntegerBits(&backup, &pokemon2->unkC, 16);
|
||||
RestoreIntegerBits(&backup, &pokemon2->speciesNum, 9);
|
||||
RestoreIntegerBits(&backup, &pokemon2->unk10, 10);
|
||||
RestoreIntegerBits(&backup, &pokemon2->unk12, 10);
|
||||
RestoreIntegerBits(&backup, &pokemon2->offense.att[0], 8);
|
||||
RestoreIntegerBits(&backup, &pokemon2->offense.att[1], 8);
|
||||
RestoreIntegerBits(&backup, &pokemon2->offense.def[0], 8);
|
||||
RestoreIntegerBits(&backup, &pokemon2->offense.def[1], 8);
|
||||
RestoreIntegerBits(&backup, &pokemon2->currExp, 24);
|
||||
sub_80941FC(&backup, &pokemon2->moves);
|
||||
RestoreItemSlot(&backup, &pokemon2->itemSlot);
|
||||
sub_809447C(&backup, &pokemon2->belly);
|
||||
sub_809447C(&backup, &pokemon2->maxBelly);
|
||||
RestoreIntegerBits(&backup, &pokemon2->IQSkills, 24);
|
||||
RestoreIntegerBits(&backup, &pokemon2->tacticIndex, 4);
|
||||
RestorePokemonHiddenPower(&backup, &pokemon2->hiddenPower);
|
||||
RestoreIntegerBits(&backup, &pokemon2->name, 80);
|
||||
ReadDungeonLocationBits(&backup, &pokemon2->dungeonLocation);
|
||||
ReadBits(&backup, &pokemon2->IQ, 10);
|
||||
ReadBits(&backup, &pokemon2->unkA, 16);
|
||||
ReadBits(&backup, &pokemon2->unkC, 16);
|
||||
ReadBits(&backup, &pokemon2->speciesNum, 9);
|
||||
ReadBits(&backup, &pokemon2->unk10, 10);
|
||||
ReadBits(&backup, &pokemon2->unk12, 10);
|
||||
ReadBits(&backup, &pokemon2->offense.att[0], 8);
|
||||
ReadBits(&backup, &pokemon2->offense.att[1], 8);
|
||||
ReadBits(&backup, &pokemon2->offense.def[0], 8);
|
||||
ReadBits(&backup, &pokemon2->offense.def[1], 8);
|
||||
ReadBits(&backup, &pokemon2->currExp, 24);
|
||||
ReadPoke2MovesBits(&backup, &pokemon2->moves);
|
||||
ReadItemSlotBits(&backup, &pokemon2->itemSlot);
|
||||
ReadBellyBits(&backup, &pokemon2->belly);
|
||||
ReadBellyBits(&backup, &pokemon2->maxBelly);
|
||||
ReadBits(&backup, &pokemon2->IQSkills, 24);
|
||||
ReadBits(&backup, &pokemon2->tacticIndex, 4);
|
||||
ReadHiddenPowerBits(&backup, &pokemon2->hiddenPower);
|
||||
ReadBits(&backup, &pokemon2->name, 80);
|
||||
}
|
||||
|
||||
nullsub_102(&backup);
|
||||
return backup.unk8;
|
||||
return backup.count;
|
||||
}
|
||||
|
||||
void xxx_restore_poke_sub_c_808F410(struct unkStruct_8094924* a1, struct unkPokeSubStruct_C* unkC)
|
||||
void ReadPoke1LevelBits(DataSerializer* a1, struct unkPokeSubStruct_C* unkC)
|
||||
{
|
||||
RestoreIntegerBits(a1, &unkC->level, 7);
|
||||
ReadBits(a1, &unkC->level, 7);
|
||||
}
|
||||
|
||||
void xxx_save_poke_sub_c_808F41C(struct unkStruct_8094924* a1, struct unkPokeSubStruct_C* unkC)
|
||||
void WritePoke1LevelBits(DataSerializer* a1, struct unkPokeSubStruct_C* unkC)
|
||||
{
|
||||
SaveIntegerBits(a1, &unkC->level, 7);
|
||||
WriteBits(a1, &unkC->level, 7);
|
||||
}
|
||||
|
||||
void RestorePokemonHiddenPower(unkStruct_8094924* a1, HiddenPower* a2)
|
||||
void ReadHiddenPowerBits(DataSerializer* a1, HiddenPower* a2)
|
||||
{
|
||||
RestoreIntegerBits(a1, &a2->hiddenPowerBasePower, 10);
|
||||
RestoreIntegerBits(a1, &a2->hiddenPowerType, 5);
|
||||
ReadBits(a1, &a2->hiddenPowerBasePower, 10);
|
||||
ReadBits(a1, &a2->hiddenPowerType, 5);
|
||||
}
|
||||
|
||||
void SavePokemonHiddenPower(unkStruct_8094924* a1, HiddenPower* a2)
|
||||
void WriteHiddenPowerBits(DataSerializer* a1, HiddenPower* a2)
|
||||
{
|
||||
SaveIntegerBits(a1, &a2->hiddenPowerBasePower, 10);
|
||||
SaveIntegerBits(a1, &a2->hiddenPowerType, 5);
|
||||
WriteBits(a1, &a2->hiddenPowerBasePower, 10);
|
||||
WriteBits(a1, &a2->hiddenPowerType, 5);
|
||||
}
|
||||
|
||||
void sub_808F468(PokemonStruct1 *param_1, EvolveStatus *evolveStatus, u8 param_3)
|
||||
@ -1108,7 +1116,7 @@ u32 sub_808F734(PokemonStruct1 *pokemon, s16 _species)
|
||||
iVar3 = sub_808F798(&pokeStruct,MONSTER_SHEDINJA);
|
||||
}
|
||||
if (iVar3 != 0) {
|
||||
sub_8097848();
|
||||
IncrementAdventureNumJoined();
|
||||
}
|
||||
return uVar1;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ bool8 GetIsTeamRenamed(void)
|
||||
u32 SaveRescueTeamInfo(u8 *param_1, u32 size)
|
||||
|
||||
{
|
||||
struct unkStruct_8094924 auStack36;
|
||||
DataSerializer auStack36;
|
||||
u8 neg1;
|
||||
u8 zero;
|
||||
u8 *puVar2;
|
||||
@ -120,9 +120,9 @@ u32 SaveRescueTeamInfo(u8 *param_1, u32 size)
|
||||
neg1 = -1;
|
||||
zero = 0;
|
||||
|
||||
xxx_init_struct_8094924_save_809486C(&auStack36, param_1, size);
|
||||
SaveIntegerBits(&auStack36, gRescueTeamInfoRef->teamName, 0x58);
|
||||
SaveIntegerBits(&auStack36, (u8 *)&gRescueTeamInfoRef->teamRankPts, 0x20);
|
||||
InitBitWriter(&auStack36, param_1, size);
|
||||
WriteBits(&auStack36, gRescueTeamInfoRef->teamName, 0x58);
|
||||
WriteBits(&auStack36, (u8 *)&gRescueTeamInfoRef->teamRankPts, 0x20);
|
||||
gRescueTeamInfoRef->isTeamRenamed = sub_80023E4(0);
|
||||
|
||||
if (gRescueTeamInfoRef->isTeamRenamed)
|
||||
@ -133,21 +133,21 @@ u32 SaveRescueTeamInfo(u8 *param_1, u32 size)
|
||||
{
|
||||
puVar2 = &zero;
|
||||
}
|
||||
SaveIntegerBits(&auStack36,puVar2,1);
|
||||
WriteBits(&auStack36,puVar2,1);
|
||||
nullsub_102(&auStack36);
|
||||
return auStack36.unk8;
|
||||
return auStack36.count;
|
||||
}
|
||||
|
||||
u32 ReadRescueTeamInfo(u8 *param_1, u32 size)
|
||||
{
|
||||
struct unkStruct_8094924 auStack32;
|
||||
DataSerializer auStack32;
|
||||
u8 byteArray[4];
|
||||
|
||||
xxx_init_struct_8094924_restore_809485C(&auStack32, param_1, size);
|
||||
RestoreIntegerBits(&auStack32, gRescueTeamInfoRef->teamName, 0x58);
|
||||
RestoreIntegerBits(&auStack32, &gRescueTeamInfoRef->teamRankPts, 0x20);
|
||||
RestoreIntegerBits(&auStack32, byteArray, 1);
|
||||
InitBitReader(&auStack32, param_1, size);
|
||||
ReadBits(&auStack32, gRescueTeamInfoRef->teamName, 0x58);
|
||||
ReadBits(&auStack32, &gRescueTeamInfoRef->teamRankPts, 0x20);
|
||||
ReadBits(&auStack32, byteArray, 1);
|
||||
gRescueTeamInfoRef->isTeamRenamed = byteArray[0] & 1;
|
||||
nullsub_102(&auStack32);
|
||||
return auStack32.unk8;
|
||||
return auStack32.count;
|
||||
}
|
||||
|
34
src/save.c
34
src/save.c
@ -42,8 +42,8 @@ extern bool8 sub_800DAB4(u16, u8*, s32);
|
||||
extern bool8 sub_800DAB8(void);
|
||||
extern u32 SaveRecruitedPokemon(u8 *, u32);
|
||||
extern u32 RestoreRecruitedPokemon(void* a, s32 b);
|
||||
extern u32 SavePokemonStruct2(u8 *, u32);
|
||||
extern u32 RestorePokemonStruct2(void* a, s32 b);
|
||||
extern u32 SavePoke2s(u8 *, u32);
|
||||
extern u32 RestorePoke2s(void* a, s32 b);
|
||||
extern u32 sub_80954CC(void* a, s32 b);
|
||||
extern u32 sub_8095624(u8 *, u32);
|
||||
extern u32 RestoreMailInfo(void* a, s32 b);
|
||||
@ -57,9 +57,9 @@ u32 sub_8011C1C(void)
|
||||
return gUnknown_203B17C;
|
||||
}
|
||||
|
||||
void sub_8011C28(u32 in)
|
||||
void sub_8011C28(u32 x)
|
||||
{
|
||||
gUnknown_203B17C = in;
|
||||
gUnknown_203B17C = x;
|
||||
}
|
||||
|
||||
s32 sub_8011C34(void)
|
||||
@ -67,9 +67,9 @@ s32 sub_8011C34(void)
|
||||
return gUnknown_202DE28;
|
||||
}
|
||||
|
||||
void sub_8011C40(s32 in)
|
||||
void sub_8011C40(s32 x)
|
||||
{
|
||||
gUnknown_202DE28 = in;
|
||||
gUnknown_202DE28 = x;
|
||||
}
|
||||
|
||||
char *GetGameInternalName(void)
|
||||
@ -232,11 +232,11 @@ u32 ReadSaveFromPak(u32 *a)
|
||||
saveStatus = 3;
|
||||
}
|
||||
r4 += 0x4650;
|
||||
r1 = RestorePokemonStruct2(r4, 0x258);
|
||||
r1 = RestorePoke2s(r4, 150 * 4);
|
||||
if (r1 != playerSave->unk428) {
|
||||
saveStatus = 3;
|
||||
}
|
||||
r4 += 0x258;
|
||||
r4 += 150 * 4;
|
||||
r1 = RestoreTeamInventory(r4, 0x1D8);
|
||||
if (r1 != playerSave->savedTeamInventory) {
|
||||
saveStatus = 3;
|
||||
@ -252,7 +252,7 @@ u32 ReadSaveFromPak(u32 *a)
|
||||
saveStatus = 3;
|
||||
}
|
||||
r4 += 0x8;
|
||||
r1 = sub_8097D98(r4, 0x100);
|
||||
r1 = RestoreAdventureData(r4, 0x100);
|
||||
if (r1 != playerSave->unk43C) {
|
||||
saveStatus = 3;
|
||||
}
|
||||
@ -350,22 +350,22 @@ u32 WriteSavetoPak(s32 *param_1, u32 param_2)
|
||||
|
||||
playerSave->savedRecruitedPokemon = SaveRecruitedPokemon(array_ptr,0x4650);
|
||||
array_ptr += 0x4650;
|
||||
playerSave->unk428 = SavePokemonStruct2(array_ptr,0x258);
|
||||
array_ptr += 0x258;
|
||||
playerSave->unk428 = SavePoke2s(array_ptr, 150 * 4);
|
||||
array_ptr += 150 * 4;
|
||||
playerSave->savedTeamInventory = SaveTeamInventory(array_ptr,0x1D8);
|
||||
array_ptr += 0x1D8;
|
||||
playerSave->savedRescueTeamInfo = SaveRescueTeamInfo(array_ptr,0x10);
|
||||
array_ptr += 0x10;
|
||||
playerSave->savedFriendAreas = SaveFriendAreas(array_ptr,8);
|
||||
array_ptr += 8;
|
||||
playerSave->unk43C = sub_8097D60(array_ptr,0x100);
|
||||
playerSave->unk43C = SaveAdventureData(array_ptr, 0x100);
|
||||
array_ptr += 0x100;
|
||||
playerSave->unk440 = sub_8095624(array_ptr,0x594);
|
||||
array_ptr += 0x594;
|
||||
playerSave->savedMailInfo = SaveMailInfo(array_ptr,0x221);
|
||||
|
||||
saveStatus1 = WriteSaveSector(param_1,(u8 *)playerSave,sizeof(struct UnkStruct_sub_8011DAC));
|
||||
saveStatus2 = WriteSaveSector(param_1,(u8 *)playerSave,sizeof(struct UnkStruct_sub_8011DAC));
|
||||
saveStatus1 = WriteSaveSector(param_1, (u8 *)playerSave, sizeof(struct UnkStruct_sub_8011DAC));
|
||||
saveStatus2 = WriteSaveSector(param_1, (u8 *)playerSave, sizeof(struct UnkStruct_sub_8011DAC));
|
||||
MemoryFree(playerSave);
|
||||
|
||||
if (saveStatus1 != SAVE_COMPLETED)
|
||||
@ -410,7 +410,7 @@ u32 sub_8012240(void)
|
||||
status = WriteFlashData(0x1F, (u8 *)r5, sizeof(struct unk_struct));
|
||||
xxx_call_start_bg_music();
|
||||
MemoryFree(r5);
|
||||
if(status != 0)
|
||||
if (status != 0)
|
||||
return SAVE_FAILED;
|
||||
else
|
||||
return SAVE_COMPLETED;
|
||||
@ -423,12 +423,14 @@ void sub_8012284(void)
|
||||
InitializePlayerData();
|
||||
}
|
||||
|
||||
// Is this the new game func?
|
||||
void sub_8012298(void)
|
||||
{
|
||||
sub_80976A8();
|
||||
ResetAdventureInfo();
|
||||
sub_80122A8();
|
||||
}
|
||||
|
||||
// Init new game?
|
||||
void sub_80122A8(void)
|
||||
{
|
||||
sub_80122D0();
|
||||
|
993
src/trap_1.c
993
src/trap_1.c
File diff suppressed because it is too large
Load Diff
@ -167,7 +167,7 @@ void sub_802B3E0(void)
|
||||
sUnknown_203B2C8->unk114.clientSpecies = MONSTER_PELIPPER;
|
||||
sUnknown_203B2C8->unk114.unk16 = 2;
|
||||
sUnknown_203B2C8->unk114.moneyReward = 0;
|
||||
sub_8097790();
|
||||
IncrementFriendRescueSuccesses();
|
||||
mail = GetMailatIndex(sUnknown_203B2C8->unk1);
|
||||
sub_803C37C(&mail->unk4.dungeon, 0, sUnknown_203B2C8->unk114.itemRewards);
|
||||
sUnknown_203B2C8->unk114.teamRankPtsReward = GetDungeonTeamRankPts(&mail->unk4.dungeon, 0);
|
||||
|
@ -225,7 +225,7 @@ gUnknown_203B40C: /* 203B40C (sub_803E46C - PrintFieldMessage) */
|
||||
gUnknown_203B40D: /* 203B40D (sub_803E250 - sub_807E698) */
|
||||
.space 0x3
|
||||
|
||||
gUnknown_203B410: /* 203B410 (sub_8040150 - sub_8082280) */
|
||||
gUnknown_203B410: /* 203B410 (sub_8040150 - RestoreDungeonEntity) */
|
||||
.space 0x4
|
||||
|
||||
.include "src/code_8042B34.o"
|
||||
@ -258,7 +258,7 @@ gUnknown_203B43C: /* 203B43C (sub_8065FB4) */
|
||||
gUnknown_203B444: /* 203B444 (sub_807DF38) */
|
||||
.space 0xC
|
||||
|
||||
gLeaderPointer: /* 203B450 (xxx_dungeon_8042F6C - sub_8082280) */
|
||||
gLeaderPointer: /* 203B450 (xxx_dungeon_8042F6C - RestoreDungeonEntity) */
|
||||
.space 0x4
|
||||
|
||||
.include "src/dungeon_random.o"
|
||||
|
Loading…
Reference in New Issue
Block a user