Merge remote-tracking branch 'upstream/master' into union_room_chat

# Conflicts:
#	ld_script.txt
This commit is contained in:
Marcus Huderle 2019-03-29 21:27:08 -05:00
commit accc5ae8dd
9 changed files with 1016 additions and 3223 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,312 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_801DB68
sub_801DB68: @ 801DB68
push {r4,r5,lr}
adds r4, r0, 0
bl sub_801B044
adds r5, r0, 0
movs r0, 0x3
adds r1, r4, 0
ands r1, r0
ldrb r2, [r5]
movs r0, 0x4
negs r0, r0
ands r0, r2
orrs r0, r1
strb r0, [r5]
cmp r4, 0x2
bhi _0801DB8E
cmp r4, 0x1
bcs _0801DB94
b _0801DBB8
_0801DB8E:
cmp r4, 0x3
beq _0801DBA6
b _0801DBB8
_0801DB94:
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0xF
bl __umodsi3
adds r0, 0x10
b _0801DBB6
_0801DBA6:
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0xF
bl __umodsi3
adds r0, 0x1
_0801DBB6:
strb r0, [r5, 0x1]
_0801DBB8:
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_801DB68
thumb_func_start sub_801DBC0
sub_801DBC0: @ 801DBC0
push {lr}
bl sub_801B044
movs r1, 0
strb r1, [r0]
strb r1, [r0, 0x1]
ldr r0, =0x0000402e
bl VarSet
pop {r0}
bx r0
.pool
thumb_func_end sub_801DBC0
thumb_func_start sub_801DBDC
sub_801DBDC: @ 801DBDC
push {r4,lr}
ldr r0, =0x0000402e
bl GetVarPointer
adds r4, r0, 0
bl sub_801B044
adds r2, r0, 0
ldr r0, [r2]
lsls r0, 24
lsrs r0, 29
cmp r0, 0x4
bls _0801DC10
ldrh r0, [r4]
adds r0, 0x1
strh r0, [r4]
lsls r0, 16
ldr r1, =0x01f30000
cmp r0, r1
bls _0801DC10
ldrb r0, [r2]
movs r1, 0x1F
ands r1, r0
strb r1, [r2]
movs r0, 0
strh r0, [r4]
_0801DC10:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_801DBDC
thumb_func_start sub_801DC20
sub_801DC20: @ 801DC20
push {r4-r6,lr}
ldr r6, =gSpecialVar_Result
bl sub_801B044
adds r4, r0, 0
bl IsMysteryEventEnabled
cmp r0, 0
beq _0801DC3A
bl sub_801B0CC
cmp r0, 0
bne _0801DC44
_0801DC3A:
movs r0, 0
b _0801DCA6
.pool
_0801DC44:
adds r0, r4, 0
bl sub_801DD44
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x6
bhi _0801DCA4
lsls r0, r5, 2
ldr r1, =_0801DC60
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_0801DC60:
.4byte _0801DCA4
.4byte _0801DC7C
.4byte _0801DC7C
.4byte _0801DCA4
.4byte _0801DC86
.4byte _0801DC96
.4byte _0801DCA4
_0801DC7C:
adds r0, r4, 0
bl sub_801DCAC
strh r0, [r6]
b _0801DCA4
_0801DC86:
adds r0, r4, 0
bl sub_801DCAC
strh r0, [r6]
adds r0, r4, 0
bl sub_801DCD8
b _0801DCA4
_0801DC96:
adds r0, r4, 0
bl sub_801DCAC
strh r0, [r6]
adds r0, r4, 0
bl sub_801DCCC
_0801DCA4:
adds r0, r5, 0
_0801DCA6:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_801DC20
thumb_func_start sub_801DCAC
sub_801DCAC: @ 801DCAC
push {r4,lr}
ldrb r2, [r0]
movs r1, 0x4
negs r1, r1
ands r1, r2
strb r1, [r0]
ldrb r4, [r0, 0x1]
adds r4, 0x84
movs r1, 0
strb r1, [r0, 0x1]
bl sub_801DD10
adds r0, r4, 0
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_801DCAC
thumb_func_start sub_801DCCC
sub_801DCCC: @ 801DCCC
ldrb r2, [r0]
movs r1, 0x1D
negs r1, r1
ands r1, r2
strb r1, [r0]
bx lr
thumb_func_end sub_801DCCC
thumb_func_start sub_801DCD8
sub_801DCD8: @ 801DCD8
push {r4,lr}
adds r3, r0, 0
ldr r0, [r3]
lsls r0, 27
lsrs r0, 29
adds r0, 0x1
movs r1, 0x7
ands r0, r1
lsls r0, 2
ldrb r1, [r3]
movs r4, 0x1D
negs r4, r4
adds r2, r4, 0
ands r2, r1
orrs r2, r0
strb r2, [r3]
ldr r0, [r3]
lsls r0, 27
lsrs r0, 29
cmp r0, 0x4
bls _0801DD0A
ands r2, r4
movs r0, 0x10
orrs r2, r0
strb r2, [r3]
_0801DD0A:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_801DCD8
thumb_func_start sub_801DD10
sub_801DD10: @ 801DD10
push {r4,lr}
adds r3, r0, 0
ldr r0, [r3]
lsls r0, 24
lsrs r0, 29
adds r0, 0x1
lsls r0, 5
ldrb r1, [r3]
movs r4, 0x1F
adds r2, r4, 0
ands r2, r1
orrs r2, r0
strb r2, [r3]
ldr r0, [r3]
lsls r0, 24
lsrs r0, 29
cmp r0, 0x5
bls _0801DD3C
ands r2, r4
movs r0, 0xA0
orrs r2, r0
strb r2, [r3]
_0801DD3C:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_801DD10
thumb_func_start sub_801DD44
sub_801DD44: @ 801DD44
push {lr}
adds r2, r0, 0
ldrb r1, [r2]
movs r0, 0xE0
ands r0, r1
cmp r0, 0xA0
bne _0801DD56
movs r0, 0x6
b _0801DD92
_0801DD56:
ldr r1, [r2]
lsls r0, r1, 30
lsrs r0, 30
cmp r0, 0x1
beq _0801DD78
cmp r0, 0x1
bgt _0801DD6A
cmp r0, 0
beq _0801DD74
b _0801DD90
_0801DD6A:
cmp r0, 0x2
beq _0801DD7C
cmp r0, 0x3
beq _0801DD80
b _0801DD90
_0801DD74:
movs r0, 0x3
b _0801DD92
_0801DD78:
movs r0, 0x1
b _0801DD92
_0801DD7C:
movs r0, 0x2
b _0801DD92
_0801DD80:
lsls r0, r1, 27
lsrs r0, 29
cmp r0, 0x2
bhi _0801DD8C
movs r0, 0x4
b _0801DD92
_0801DD8C:
movs r0, 0x5
b _0801DD92
_0801DD90:
movs r0, 0
_0801DD92:
pop {r1}
bx r1
thumb_func_end sub_801DD44
.align 2, 0 @ don't pad with nop

View File

@ -514,7 +514,7 @@ BattleScript_EffectStatUp::
BattleScript_EffectStatUpAfterAtkCanceler:: BattleScript_EffectStatUpAfterAtkCanceler::
attackstring attackstring
ppreduce ppreduce
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_StatUpEnd statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_StatUpEnd
jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatUpAttackAnim jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatUpAttackAnim
pause 0x20 pause 0x20
goto BattleScript_StatUpPrintString goto BattleScript_StatUpPrintString
@ -560,7 +560,7 @@ BattleScript_EffectStatDown::
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring attackstring
ppreduce ppreduce
statbuffchange 0x1, BattleScript_StatDownEnd statbuffchange STAT_CHANGE_BS_PTR, BattleScript_StatDownEnd
jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatDownDoAnim jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatDownDoAnim
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x3, BattleScript_StatDownEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x3, BattleScript_StatDownEnd
pause 0x20 pause 0x20
@ -1521,17 +1521,17 @@ BattleScript_CurseTrySpeed::
attackanimation attackanimation
waitanimation waitanimation
setstatchanger STAT_SPEED, 1, TRUE setstatchanger STAT_SPEED, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_CurseTryAttack statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CurseTryAttack
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_CurseTryAttack:: BattleScript_CurseTryAttack::
setstatchanger STAT_ATK, 1, FALSE setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_CurseTryDefence statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CurseTryDefence
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_CurseTryDefence:: BattleScript_CurseTryDefence::
setstatchanger STAT_DEF, 1, FALSE setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_CurseEnd statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CurseEnd
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_CurseEnd:: BattleScript_CurseEnd::
@ -1643,7 +1643,7 @@ BattleScript_EffectSwagger::
attackanimation attackanimation
waitanimation waitanimation
setstatchanger STAT_ATK, 2, FALSE setstatchanger STAT_ATK, 2, FALSE
statbuffchange 0x1, BattleScript_SwaggerTryConfuse statbuffchange STAT_CHANGE_BS_PTR, BattleScript_SwaggerTryConfuse
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SwaggerTryConfuse jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SwaggerTryConfuse
setgraphicalstatchangevalues setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
@ -1842,7 +1842,7 @@ BattleScript_EffectSkullBash::
setbyte sTWOTURN_STRINGID, 0x2 setbyte sTWOTURN_STRINGID, 0x2
call BattleScriptFirstChargingTurn call BattleScriptFirstChargingTurn
setstatchanger STAT_DEF, 1, FALSE setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_SkullBashEnd statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_SkullBashEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SkullBashEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SkullBashEnd
setgraphicalstatchangevalues setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
@ -2048,7 +2048,7 @@ BattleScript_EffectDefenseCurl::
ppreduce ppreduce
setdefensecurlbit setdefensecurlbit
setstatchanger STAT_DEF, 1, FALSE setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_DefenseCurlDoStatUpAnim statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_DefenseCurlDoStatUpAnim
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatUpPrintString jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatUpPrintString
attackanimation attackanimation
waitanimation waitanimation
@ -2189,7 +2189,7 @@ BattleScript_EffectFlatter::
attackanimation attackanimation
waitanimation waitanimation
setstatchanger STAT_SPATK, 1, FALSE setstatchanger STAT_SPATK, 1, FALSE
statbuffchange 0x1, BattleScript_FlatterTryConfuse statbuffchange STAT_CHANGE_BS_PTR, BattleScript_FlatterTryConfuse
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_FlatterTryConfuse jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_FlatterTryConfuse
setgraphicalstatchangevalues setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
@ -2246,14 +2246,14 @@ BattleScript_EffectMemento::
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO | ATK48_ONLY_MULTIPLE playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO | ATK48_ONLY_MULTIPLE
playstatchangeanimation BS_TARGET, BIT_ATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO playstatchangeanimation BS_TARGET, BIT_ATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO
setstatchanger STAT_ATK, 2, TRUE setstatchanger STAT_ATK, 2, TRUE
statbuffchange 0x1, BattleScript_EffectMementoTrySpAtk statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectMementoTrySpAtk
jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTrySpAtk jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTrySpAtk
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_EffectMementoTrySpAtk: BattleScript_EffectMementoTrySpAtk:
playstatchangeanimation BS_TARGET, BIT_SPATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO playstatchangeanimation BS_TARGET, BIT_SPATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO
setstatchanger STAT_SPATK, 2, TRUE setstatchanger STAT_SPATK, 2, TRUE
statbuffchange 0x1, BattleScript_EffectMementoTryFaint statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectMementoTryFaint
jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTryFaint jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTryFaint
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
@ -2692,14 +2692,14 @@ BattleScript_TickleDoMoveAnim::
playstatchangeanimation BS_TARGET, BIT_ATK | BIT_DEF, ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE playstatchangeanimation BS_TARGET, BIT_ATK | BIT_DEF, ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE
playstatchangeanimation BS_TARGET, BIT_ATK, ATK48_STAT_NEGATIVE playstatchangeanimation BS_TARGET, BIT_ATK, ATK48_STAT_NEGATIVE
setstatchanger STAT_ATK, 1, TRUE setstatchanger STAT_ATK, 1, TRUE
statbuffchange 0x1, BattleScript_TickleTryLowerDef statbuffchange STAT_CHANGE_BS_PTR, BattleScript_TickleTryLowerDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleTryLowerDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleTryLowerDef
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_TickleTryLowerDef:: BattleScript_TickleTryLowerDef::
playstatchangeanimation BS_TARGET, BIT_DEF, ATK48_STAT_NEGATIVE playstatchangeanimation BS_TARGET, BIT_DEF, ATK48_STAT_NEGATIVE
setstatchanger STAT_DEF, 1, TRUE setstatchanger STAT_DEF, 1, TRUE
statbuffchange 0x1, BattleScript_TickleEnd statbuffchange STAT_CHANGE_BS_PTR, BattleScript_TickleEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleEnd
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
@ -2725,13 +2725,13 @@ BattleScript_CosmicPowerDoMoveAnim::
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, 0x0 playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, 0x0
setstatchanger STAT_DEF, 1, FALSE setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_CosmicPowerTrySpDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CosmicPowerTrySpDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CosmicPowerTrySpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CosmicPowerTrySpDef
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_CosmicPowerTrySpDef:: BattleScript_CosmicPowerTrySpDef::
setstatchanger STAT_SPDEF, 1, FALSE setstatchanger STAT_SPDEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_CosmicPowerEnd statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CosmicPowerEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CosmicPowerEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CosmicPowerEnd
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
@ -2754,13 +2754,13 @@ BattleScript_BulkUpDoMoveAnim::
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF, 0x0 playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF, 0x0
setstatchanger STAT_ATK, 1, FALSE setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_BulkUpTryDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_BulkUpTryDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_BulkUpTryDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_BulkUpTryDef
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_BulkUpTryDef:: BattleScript_BulkUpTryDef::
setstatchanger STAT_DEF, 1, FALSE setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_BulkUpEnd statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_BulkUpEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_BulkUpEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_BulkUpEnd
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
@ -2779,13 +2779,13 @@ BattleScript_CalmMindDoMoveAnim::
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF, 0x0 playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF, 0x0
setstatchanger STAT_SPATK, 1, FALSE setstatchanger STAT_SPATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_CalmMindTrySpDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CalmMindTrySpDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CalmMindTrySpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CalmMindTrySpDef
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_CalmMindTrySpDef:: BattleScript_CalmMindTrySpDef::
setstatchanger STAT_SPDEF, 1, FALSE setstatchanger STAT_SPDEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_CalmMindEnd statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CalmMindEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CalmMindEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CalmMindEnd
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
@ -2811,13 +2811,13 @@ BattleScript_DragonDanceDoMoveAnim::
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPEED, 0x0 playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPEED, 0x0
setstatchanger STAT_ATK, 1, FALSE setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_DragonDanceTrySpeed statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_DragonDanceTrySpeed
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DragonDanceTrySpeed jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DragonDanceTrySpeed
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_DragonDanceTrySpeed:: BattleScript_DragonDanceTrySpeed::
setstatchanger STAT_SPEED, 1, FALSE setstatchanger STAT_SPEED, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_DragonDanceEnd statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_DragonDanceEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DragonDanceEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DragonDanceEnd
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
@ -3490,27 +3490,27 @@ BattleScript_AllStatsUpAtk::
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF | BIT_SPEED | BIT_SPATK | BIT_SPDEF, 0x0 playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF | BIT_SPEED | BIT_SPATK | BIT_SPDEF, 0x0
setstatchanger STAT_ATK, 1, FALSE setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_AllStatsUpDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpDef
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_AllStatsUpDef:: BattleScript_AllStatsUpDef::
setstatchanger STAT_DEF, 1, FALSE setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_AllStatsUpSpeed statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpSpeed
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_AllStatsUpSpeed:: BattleScript_AllStatsUpSpeed::
setstatchanger STAT_SPEED, 1, FALSE setstatchanger STAT_SPEED, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_AllStatsUpSpAtk statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpSpAtk
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_AllStatsUpSpAtk:: BattleScript_AllStatsUpSpAtk::
setstatchanger STAT_SPATK, 1, FALSE setstatchanger STAT_SPATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_AllStatsUpSpDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpSpDef
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_AllStatsUpSpDef:: BattleScript_AllStatsUpSpDef::
setstatchanger STAT_SPDEF, 1, FALSE setstatchanger STAT_SPDEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_AllStatsUpRet statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpRet
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_AllStatsUpRet:: BattleScript_AllStatsUpRet::
@ -3659,14 +3659,14 @@ BattleScript_AtkDefDown::
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE
playstatchangeanimation BS_ATTACKER, BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE playstatchangeanimation BS_ATTACKER, BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE
setstatchanger STAT_ATK, 1, TRUE setstatchanger STAT_ATK, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_82DB144 statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_BS_PTR, BattleScript_82DB144
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB144 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB144
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_82DB144:: BattleScript_82DB144::
playstatchangeanimation BS_ATTACKER, BIT_DEF, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE playstatchangeanimation BS_ATTACKER, BIT_DEF, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE
setstatchanger STAT_DEF, 1, TRUE setstatchanger STAT_DEF, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_82DB167 statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_BS_PTR, BattleScript_82DB167
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB167 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB167
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
@ -3732,7 +3732,7 @@ BattleScript_SAtkDown2::
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_SPATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO playstatchangeanimation BS_ATTACKER, BIT_SPATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO
setstatchanger STAT_SPATK, 2, TRUE setstatchanger STAT_SPATK, 2, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_SAtkDown2End statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_BS_PTR, BattleScript_SAtkDown2End
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SAtkDown2End jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SAtkDown2End
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
@ -4063,7 +4063,7 @@ BattleScript_IntimidateActivatesLoop:
jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_HYPER_CUTTER, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_HYPER_CUTTER, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_IntimidatePrevented
statbuffchange 0x21, BattleScript_IntimidateActivatesLoopIncrement statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_BS_PTR, BattleScript_IntimidateActivatesLoopIncrement
jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_IntimidateActivatesLoopIncrement jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_IntimidateActivatesLoopIncrement
setgraphicalstatchangevalues setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
@ -4444,7 +4444,7 @@ BattleScript_BerryConfuseHealEnd2::
BattleScript_BerryStatRaiseEnd2:: BattleScript_BerryStatRaiseEnd2::
playanimation BS_ATTACKER, B_ANIM_ITEM_EFFECT, NULL playanimation BS_ATTACKER, B_ANIM_ITEM_EFFECT, NULL
statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_82DB85B statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_82DB85B
BattleScript_82DB85B:: BattleScript_82DB85B::
setbyte cMULTISTRING_CHOOSER, 0x4 setbyte cMULTISTRING_CHOOSER, 0x4
call BattleScript_StatUp call BattleScript_StatUp

View File

@ -1,254 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_082F0E10:: @ 82F0E10
.byte 0x00, 0x02, 0x03
.byte 0x00, 0x01, 0x02
.align 2
gUnknown_082F0E18:: @ 82F0E18
.byte 0x07, 0x04, 0x07, 0x00
.align 2
gUnknown_082F0E1C:: @ 82F0E1C
window_template 0x01, 0x01, 0x01, 0x19, 0x04, 0x02, 0x029C
window_template 0x01, 0x01, 0x06, 0x1C, 0x08, 0x02, 0x01BC
window_template 0x01, 0x01, 0x0E, 0x1C, 0x05, 0x02, 0x0130
.align 2
gWonderCardBgPal1:: @ 82F0E34
.incbin "graphics/wonder_transfers/wonder_card_1.gbapal"
.align 2
gWonderCardBgPal2:: @ 82F0E54
.incbin "graphics/wonder_transfers/wonder_card_2.gbapal"
.align 2
gWonderCardBgPal3:: @ 82F0E74
.incbin "graphics/wonder_transfers/wonder_card_3.gbapal"
.align 2
gWonderCardBgPal4:: @ 82F0E94
.incbin "graphics/wonder_transfers/wonder_card_4.gbapal"
.align 2
gWonderCardBgPal5:: @ 82F0EB4
.incbin "graphics/wonder_transfers/wonder_card_5.gbapal"
.align 2
gWonderCardBgPal6:: @ 82F0ED4
.incbin "graphics/wonder_transfers/wonder_card_6.gbapal"
.align 2
gWonderCardBgPal7:: @ 82F0EF4
.incbin "graphics/wonder_transfers/wonder_card_7.gbapal"
.align 2
gWonderCardBgPal8:: @ 82F0F14
.incbin "graphics/wonder_transfers/wonder_card_8.gbapal"
.align 2
gWonderCardBgGfx1:: @ 82F0F34
.incbin "graphics/wonder_transfers/wonder_card_1.4bpp.lz"
.align 2
gWonderCardBgTilemap1:: @ 82F1030
.incbin "graphics/wonder_transfers/wonder_card_1.bin.lz"
.align 2
gWonderCardBgGfx2:: @ 82F1124
.incbin "graphics/wonder_transfers/wonder_card_2.4bpp.lz"
.align 2
gWonderCardBgTilemap2:: @ 82F1218
.incbin "graphics/wonder_transfers/wonder_card_2.bin.lz"
.align 2
gWonderCardBgGfx3:: @ 82F1300
.incbin "graphics/wonder_transfers/wonder_card_3.4bpp.lz"
.align 2
gWonderCardBgTilemap3:: @ 82F13D4
.incbin "graphics/wonder_transfers/wonder_card_3.bin.lz"
.align 2
gWonderCardBgGfx7:: @ 82F14A8
.incbin "graphics/wonder_transfers/wonder_card_7.4bpp.lz"
.align 2
gWonderCardBgTilemap7:: @ 82F16DC
.incbin "graphics/wonder_transfers/wonder_card_7.bin.lz"
.align 2
gWonderCardBgGfx8:: @ 82F1824
.incbin "graphics/wonder_transfers/wonder_card_8.4bpp.lz"
.align 2
gWonderCardBgTilemap8:: @ 82F1A54
.incbin "graphics/wonder_transfers/wonder_card_8.bin.lz"
.align 2
gWonderCardShadowPal1:: @ 82F1B9C
.incbin "graphics/wonder_transfers/wonder_card_shadow_1.gbapal"
.align 2
gWonderCardShadowPal2:: @ 82F1BBC
.incbin "graphics/wonder_transfers/wonder_card_shadow_2.gbapal"
.align 2
gWonderCardShadowPal3:: @ 82F1BDC
.incbin "graphics/wonder_transfers/wonder_card_shadow_3.gbapal"
.align 2
gWonderCardShadowPal4:: @ 82F1BFC
.incbin "graphics/wonder_transfers/wonder_card_shadow_4.gbapal"
.align 2
gWonderCardShadowPal5:: @ 82F1C1C
.incbin "graphics/wonder_transfers/wonder_card_shadow_5.gbapal"
.align 2
gWonderCardShadowPal6:: @ 82F1C3C
.incbin "graphics/wonder_transfers/wonder_card_shadow_6.gbapal"
.align 2
gWonderCardShadowPal7:: @ 82F1C5C
.incbin "graphics/wonder_transfers/wonder_card_shadow_7.gbapal"
.align 2
gWonderCardShadowPal8:: @ 82F1C7C
.incbin "graphics/wonder_transfers/wonder_card_shadow_8.gbapal"
.align 2
gWonderCardShadowGfx:: @ 82F1C9C
.incbin "graphics/wonder_transfers/wonder_card_shadow.4bpp.lz"
.align 2
gUnknown_082F1D00:: @ 82F1D00 struct CompressedSpriteSheet
.4byte gWonderCardShadowGfx
.2byte 0x0100
.2byte 0x8000
.align 2
gUnknown_082F1D08:: @ 82F1D08 struct SpritePalette
.4byte gWonderCardShadowPal1
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal2
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal3
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal4
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal5
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal6
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal7
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal8
.2byte 0x8000
.align 2
gUnknown_082F1D48:: @ 82F1D48
spr_template 0x8000, 0x8000, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_082F1D60:: @ 82F1D60
.4byte 0x00000001, gWonderCardBgGfx1, gWonderCardBgTilemap1, gWonderCardBgPal1
.4byte 0x00001001, gWonderCardBgGfx2, gWonderCardBgTilemap2, gWonderCardBgPal2
.4byte 0x00002001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal3
.4byte 0x00003001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal4
.4byte 0x00004001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal5
.4byte 0x00005001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal6
.4byte 0x00006001, gWonderCardBgGfx7, gWonderCardBgTilemap7, gWonderCardBgPal7
.4byte 0x00007001, gWonderCardBgGfx8, gWonderCardBgTilemap8, gWonderCardBgPal8
gUnknown_082F1DE0:: @ 82F1DE0
.byte 0x00, 0x02, 0x03, 0x00, 0x01, 0x02, 0x00, 0x00
gUnknown_082F1DE8:: @ 82F1DE8
window_template 0x00, 0x01, 0x00, 0x1C, 0x03, 0x02, 0x02AC
window_template 0x02, 0x01, 0x03, 0x1C, 0x14, 0x02, 0x007C
gUnknown_082F1DF8:: @ 82F1DF8
.4byte 0x0318e802, 0x000098e8, 0x10000002, 0x00001000
.align 2
gWonderNewsPal1:: @ 82F1E08
.incbin "graphics/wonder_transfers/wonder_news_1.gbapal"
.align 2
gWonderNewsPal7:: @ 82F1E28
.incbin "graphics/wonder_transfers/wonder_news_7.gbapal"
.align 2
gWonderNewsPal8:: @ 82F1E48
.incbin "graphics/wonder_transfers/wonder_news_8.gbapal"
.align 2
gWonderNewsGfx1:: @ 82F1E68
.incbin "graphics/wonder_transfers/wonder_news_1.4bpp.lz"
.align 2
gWonderNewsTilemap1:: @ 82F1EE8
.incbin "graphics/wonder_transfers/wonder_news_1.bin.lz"
.align 2
gWonderNewsGfx2:: @ 82F1FC4
.incbin "graphics/wonder_transfers/wonder_news_2.4bpp.lz"
.align 2
gWonderNewsTilemap2:: @ 82F1FF4
.incbin "graphics/wonder_transfers/wonder_news_2.bin.lz"
.align 2
gWonderNewsGfx3:: @ 82F20B4
.incbin "graphics/wonder_transfers/wonder_news_3.4bpp.lz"
.align 2
gWonderNewsTilemap3:: @ 82F2124
.incbin "graphics/wonder_transfers/wonder_news_3.bin.lz"
.align 2
gWonderNewsGfx7:: @ 82F21F0
.incbin "graphics/wonder_transfers/wonder_news_7.4bpp.lz"
.align 2
gWonderNewsTilemap7:: @ 82F2280
.incbin "graphics/wonder_transfers/wonder_news_7.bin.lz"
.align 2
gWonderNewsGfx8:: @ 82F235C
.incbin "graphics/wonder_transfers/wonder_news_8.4bpp.lz"
.align 2
gWonderNewsTilemap8:: @ 82F23EC
.incbin "graphics/wonder_transfers/wonder_news_8.bin.lz"
.align 2
gUnknown_082F24C8:: @ 82F24C8
.4byte 0x00000001, gWonderNewsGfx1, gWonderNewsTilemap1, gWonderNewsPal1
.4byte 0x00000001, gWonderNewsGfx2, gWonderNewsTilemap2, gWonderCardBgPal2
.4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal3
.4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal4
.4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal5
.4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal6
.4byte 0x00000001, gWonderNewsGfx7, gWonderNewsTilemap7, gWonderNewsPal7
.4byte 0x00000001, gWonderNewsGfx8, gWonderNewsTilemap8, gWonderNewsPal8

View File

@ -60,7 +60,7 @@
#define VAR_POISON_STEP_COUNTER 0x402B #define VAR_POISON_STEP_COUNTER 0x402B
#define VAR_RESET_RTC_ENABLE 0x402C #define VAR_RESET_RTC_ENABLE 0x402C
#define VAR_ENIGMA_BERRY_AVAILABLE 0x402D #define VAR_ENIGMA_BERRY_AVAILABLE 0x402D
#define VAR_UNUSED_0x402E 0x402E // Unused Var #define VAR_0x402E 0x402E
#define VAR_FRONTIER_MANIAC_FACILITY 0x402F #define VAR_FRONTIER_MANIAC_FACILITY 0x402F
#define VAR_FRONTIER_GAMBLER_FACILITY 0x4030 #define VAR_FRONTIER_GAMBLER_FACILITY 0x4030

9
include/union_room.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef GUARD_UNION_ROOM_H
#define GUARD_UNION_ROOM_H
extern bool8 gUnknown_02022C60;
void sub_8018798(u8);
void sub_80186EC(bool8, bool32);
#endif //GUARD_UNION_ROOM_H

View File

@ -57,11 +57,11 @@ SECTIONS {
src/union_room.o(.text); src/union_room.o(.text);
asm/union_room.o(.text); asm/union_room.o(.text);
src/mevent2.o(.text); src/mevent2.o(.text);
asm/mevent_801BAAC.o(.text); src/mevent_801BAAC.o(.text);
asm/mevent_server.o(.text); asm/mevent_server.o(.text);
asm/mevent_server_ish.o(.text); asm/mevent_server_ish.o(.text);
asm/mevent_server_helpers.o(.text); asm/mevent_server_helpers.o(.text);
asm/mevent_news.o(.text); src/mevent_news.o(.text);
src/union_room_chat.o(.text); src/union_room_chat.o(.text);
asm/berry_crush.o(.text); asm/berry_crush.o(.text);
src/berry_powder.o(.text); src/berry_powder.o(.text);
@ -410,7 +410,7 @@ SECTIONS {
src/union_room.o(.rodata); src/union_room.o(.rodata);
data/union_room.o(.rodata); data/union_room.o(.rodata);
src/mevent2.o(.rodata); src/mevent2.o(.rodata);
data/mevent_801BAAC.o(.rodata); src/mevent_801BAAC.o(.rodata);
data/mevent_server.o(.rodata); data/mevent_server.o(.rodata);
src/union_room_chat.o(.rodata); src/union_room_chat.o(.rodata);
data/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata);

825
src/mevent_801BAAC.c Normal file
View File

@ -0,0 +1,825 @@
#include "global.h"
#include "constants/species.h"
#include "bg.h"
#include "gpu_regs.h"
#include "palette.h"
#include "decompress.h"
#include "alloc.h"
#include "menu.h"
#include "pokemon_icon.h"
#include "union_room.h"
#include "list_menu.h"
#include "text_window.h"
#include "string_util.h"
#include "link_rfu.h"
#include "mevent.h"
struct UnkStruct_8467FB8
{
u8 textPal1:4;
u8 textPal2:4;
u8 textPal3:4;
u8 textPal4:4;
const u32 * tiles;
const u32 * map;
const u16 * pal;
};
struct UnkStruct_203F3C8_02DC
{
u8 unk_00;
u8 unk_01[41];
u8 unk_42[4];
};
struct UnkStruct_203F3C8
{
/*0000*/ struct MEventBuffer_32E0_Sub unk_0000;
/*014c*/ struct MEventBuffer_3430_Sub unk_014C;
/*0170*/ const struct UnkStruct_8467FB8 * unk_0170;
/*0174*/ u8 unk_0174;
/*0175*/ u8 unk_0175;
/*0176*/ u16 unk_0176[3];
/*017C*/ u8 unk_017C;
/*017D*/ u8 unk_017D[7][2];
/*018B*/ u8 unk_018B[41];
/*01B4*/ u8 unk_01B4[41];
/*01DD*/ u8 unk_01DD[7];
/*01E4*/ u8 unk_01E4[4][41];
/*0288*/ u8 unk_0288[41];
/*02B1*/ u8 unk_02B1[41];
/*02DC*/ struct UnkStruct_203F3C8_02DC unk_02DC[8];
/*045C*/ u8 buffer_045C[0x1000];
};
EWRAM_DATA struct UnkStruct_203F3C8 * gUnknown_02022C74 = NULL;
void sub_801BEF8(void);
void sub_801C178(u8 whichWindow);
void sub_801C4C0(void);
void sub_801C61C(void);
extern const struct OamData gUnknown_08524934;
const u8 gUnknown_082F0E10[][3] = {
{0, 2, 3},
{0, 1, 2}
};
const u8 ALIGNED(4) gUnknown_082F0E18[3] = {7, 4, 7};
const struct WindowTemplate gUnknown_082F0E1C[] = {
{
.bg = 1,
.tilemapLeft = 1,
.tilemapTop = 1,
.width = 25,
.height = 4,
.paletteNum = 2,
.baseBlock = 0x029c
}, {
.bg = 1,
.tilemapLeft = 1,
.tilemapTop = 6,
.width = 28,
.height = 8,
.paletteNum = 2,
.baseBlock = 0x01bc
}, {
.bg = 1,
.tilemapLeft = 1,
.tilemapTop = 14,
.width = 28,
.height = 5,
.paletteNum = 2,
.baseBlock = 0x0130
}
};
const u16 gWonderCardBgPal1[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_1.gbapal");
const u16 gWonderCardBgPal2[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_2.gbapal");
const u16 gWonderCardBgPal3[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_3.gbapal");
const u16 gWonderCardBgPal4[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_4.gbapal");
const u16 gWonderCardBgPal5[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_5.gbapal");
const u16 gWonderCardBgPal6[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_6.gbapal");
const u16 gWonderCardBgPal7[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_7.gbapal");
const u16 gWonderCardBgPal8[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_8.gbapal");
const u32 gWonderCardBgGfx1[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_1.4bpp.lz");
const u32 gWonderCardBgTilemap1[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_1.bin.lz");
const u32 gWonderCardBgGfx2[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_2.4bpp.lz");
const u32 gWonderCardBgTilemap2[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_2.bin.lz");
const u32 gWonderCardBgGfx3[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_3.4bpp.lz");
const u32 gWonderCardBgTilemap3[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_3.bin.lz");
const u32 gWonderCardBgGfx7[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_7.4bpp.lz");
const u32 gWonderCardBgTilemap7[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_7.bin.lz");
const u32 gWonderCardBgGfx8[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_8.4bpp.lz");
const u32 gWonderCardBgTilemap8[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_8.bin.lz");
const u16 gWonderCardShadowPal1[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_1.gbapal");
const u16 gWonderCardShadowPal2[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_2.gbapal");
const u16 gWonderCardShadowPal3[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_3.gbapal");
const u16 gWonderCardShadowPal4[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_4.gbapal");
const u16 gWonderCardShadowPal5[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_5.gbapal");
const u16 gWonderCardShadowPal6[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_6.gbapal");
const u16 gWonderCardShadowPal7[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_7.gbapal");
const u16 gWonderCardShadowPal8[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_8.gbapal");
const u32 gWonderCardShadowGfx[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_shadow.4bpp.lz");
const struct CompressedSpriteSheet gUnknown_082F1D00 = {
gWonderCardShadowGfx, 0x100, 0x8000
};
const struct SpritePalette gUnknown_082F1D08[] = {
{gWonderCardShadowPal1, 0x8000},
{gWonderCardShadowPal2, 0x8000},
{gWonderCardShadowPal3, 0x8000},
{gWonderCardShadowPal4, 0x8000},
{gWonderCardShadowPal5, 0x8000},
{gWonderCardShadowPal6, 0x8000},
{gWonderCardShadowPal7, 0x8000},
{gWonderCardShadowPal8, 0x8000}
};
const struct SpriteTemplate gUnknown_082F1D48 = {
0x8000, 0x8000, &gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
};
const struct UnkStruct_8467FB8 gUnknown_082F1D60[8] = {
{1, 0, 0, 0, gWonderCardBgGfx1, gWonderCardBgTilemap1, gWonderCardBgPal1},
{1, 0, 0, 1, gWonderCardBgGfx2, gWonderCardBgTilemap2, gWonderCardBgPal2},
{1, 0, 0, 2, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal3},
{1, 0, 0, 3, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal4},
{1, 0, 0, 4, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal5},
{1, 0, 0, 5, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal6},
{1, 0, 0, 6, gWonderCardBgGfx7, gWonderCardBgTilemap7, gWonderCardBgPal7},
{1, 0, 0, 7, gWonderCardBgGfx8, gWonderCardBgTilemap8, gWonderCardBgPal8}
};
bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6)
{
if (r5 == NULL || r6 == NULL)
return FALSE;
gUnknown_02022C74 = AllocZeroed(sizeof(struct UnkStruct_203F3C8));
if (gUnknown_02022C74 == NULL)
return FALSE;
gUnknown_02022C74->unk_0000 = *r5;
gUnknown_02022C74->unk_014C = *r6;
if (gUnknown_02022C74->unk_0000.unk_08_2 >= ARRAY_COUNT(gUnknown_082F1D60))
gUnknown_02022C74->unk_0000.unk_08_2 = 0;
if (gUnknown_02022C74->unk_0000.unk_08_0 >= ARRAY_COUNT(gUnknown_082F0E18))
gUnknown_02022C74->unk_0000.unk_08_0 = 0;
if (gUnknown_02022C74->unk_0000.unk_09 > ARRAY_COUNT(gUnknown_02022C74->unk_017D))
gUnknown_02022C74->unk_0000.unk_09 = 0;
gUnknown_02022C74->unk_0170 = &gUnknown_082F1D60[gUnknown_02022C74->unk_0000.unk_08_2];
return TRUE;
}
void sub_801BB48(void)
{
if (gUnknown_02022C74 != NULL)
{
*gUnknown_02022C74 = (struct UnkStruct_203F3C8){};
Free(gUnknown_02022C74);
gUnknown_02022C74 = NULL;
}
}
s32 sub_801BB74(void)
{
if (gUnknown_02022C74 == NULL)
return -1;
switch(gUnknown_02022C74->unk_0174)
{
case 0:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
break;
case 1:
if (UpdatePaletteFade())
return 0;
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
decompress_and_copy_tile_data_to_vram(2, gUnknown_02022C74->unk_0170->tiles, 0, 0x008, 0);
gUnknown_02022C74->unk_0176[0] = AddWindow(&gUnknown_082F0E1C[0]);
gUnknown_02022C74->unk_0176[1] = AddWindow(&gUnknown_082F0E1C[1]);
gUnknown_02022C74->unk_0176[2] = AddWindow(&gUnknown_082F0E1C[2]);
break;
case 3:
if (free_temp_tile_data_buffers_if_possible())
return 0;
LoadPalette(stdpal_get(1), 0x20, 0x20);
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(gUnknown_02022C74->unk_0170->pal, 0x10, 0x20);
LZ77UnCompWram(gUnknown_02022C74->unk_0170->map, gUnknown_02022C74->buffer_045C);
CopyRectToBgTilemapBufferRect(2, gUnknown_02022C74->buffer_045C, 0, 0, 30, 20, 0, 0, 30, 20, 1, 0x008, 0);
CopyBgTilemapBufferToVram(2);
break;
case 4:
sub_801BEF8();
break;
case 5:
sub_801C178(0);
sub_801C178(1);
sub_801C178(2);
CopyBgTilemapBufferToVram(1);
break;
case 6:
LoadMonIconPalettes();
break;
case 7:
ShowBg(1);
ShowBg(2);
gPaletteFade.bufferTransferDisabled = FALSE;
sub_801C4C0();
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
UpdatePaletteFade();
break;
default:
if (UpdatePaletteFade())
return 0;
gUnknown_02022C74->unk_0174 = 0;
return 1;
}
++gUnknown_02022C74->unk_0174;
return 0;
}
s32 sub_801BDA4(bool32 flag)
{
if (gUnknown_02022C74 == NULL)
return -1;
switch (gUnknown_02022C74->unk_0174)
{
case 0:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
break;
case 1:
if (UpdatePaletteFade())
return 0;
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
break;
case 3:
HideBg(1);
HideBg(2);
RemoveWindow(gUnknown_02022C74->unk_0176[2]);
RemoveWindow(gUnknown_02022C74->unk_0176[1]);
RemoveWindow(gUnknown_02022C74->unk_0176[0]);
break;
case 4:
sub_801C61C();
FreeMonIconPalettes();
break;
case 5:
sub_80186EC(gUnknown_02022C60, flag);
CopyBgTilemapBufferToVram(0);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
break;
default:
if (UpdatePaletteFade())
return 0;
gUnknown_02022C74->unk_0174 = 0;
return 1;
}
++gUnknown_02022C74->unk_0174;
return 0;
}
void sub_801BEF8(void)
{
u16 i = 0;
u16 r6;
u16 sp0[3] = {0, 0, 0};
memcpy(gUnknown_02022C74->unk_018B, gUnknown_02022C74->unk_0000.unk_0A, 40);
gUnknown_02022C74->unk_018B[40] = EOS;
memcpy(gUnknown_02022C74->unk_01B4, gUnknown_02022C74->unk_0000.unk_32, 40);
gUnknown_02022C74->unk_01B4[40] = EOS;
if (gUnknown_02022C74->unk_0000.unk_04 > 999999)
gUnknown_02022C74->unk_0000.unk_04 = 999999;
ConvertIntToDecimalStringN(gUnknown_02022C74->unk_01DD, gUnknown_02022C74->unk_0000.unk_04, STR_CONV_MODE_LEFT_ALIGN, 6);
for (i = 0; i < 4; i++)
{
memcpy(gUnknown_02022C74->unk_01E4[i], gUnknown_02022C74->unk_0000.unk_5A[i], 40);
gUnknown_02022C74->unk_01E4[i][40] = EOS;
}
memcpy(gUnknown_02022C74->unk_0288, gUnknown_02022C74->unk_0000.unk_FA, 40);
gUnknown_02022C74->unk_0288[40] = EOS;
switch (gUnknown_02022C74->unk_0000.unk_08_0)
{
case 0:
memcpy(gUnknown_02022C74->unk_02B1, gUnknown_02022C74->unk_0000.unk_122, 40);
gUnknown_02022C74->unk_02B1[40] = EOS;
break;
case 1:
gUnknown_02022C74->unk_02B1[00] = EOS;
break;
case 2:
gUnknown_02022C74->unk_02B1[00] = EOS;
sp0[0] = gUnknown_02022C74->unk_014C.unk_00 < 999 ? gUnknown_02022C74->unk_014C.unk_00 : 999;
sp0[1] = gUnknown_02022C74->unk_014C.unk_02 < 999 ? gUnknown_02022C74->unk_014C.unk_02 : 999;
sp0[2] = gUnknown_02022C74->unk_014C.unk_04 < 999 ? gUnknown_02022C74->unk_014C.unk_04 : 999;
for (i = 0; i < 8; i++)
{
memset(gUnknown_02022C74->unk_02DC[i].unk_42, EOS, 4);
memset(gUnknown_02022C74->unk_02DC[i].unk_01, EOS, 41);
}
for (i = 0, r6 = 0; i < 40; i++)
{
if (gUnknown_02022C74->unk_0000.unk_122[i] != 0xF7)
{
gUnknown_02022C74->unk_02DC[gUnknown_02022C74->unk_0175].unk_01[r6] = gUnknown_02022C74->unk_0000.unk_122[i];
r6++;
}
else
{
u8 r3 = gUnknown_02022C74->unk_0000.unk_122[i + 1];
if (r3 > 2)
{
i += 2;
}
else
{
ConvertIntToDecimalStringN(gUnknown_02022C74->unk_02DC[gUnknown_02022C74->unk_0175].unk_42, sp0[r3], STR_CONV_MODE_LEADING_ZEROS, 3);
gUnknown_02022C74->unk_02DC[gUnknown_02022C74->unk_0175].unk_00 = gUnknown_02022C74->unk_0000.unk_122[i + 2];
gUnknown_02022C74->unk_0175++;
if (gUnknown_02022C74->unk_0175 > 7)
break;
r6 = 0;
i += 2;
}
}
}
}
}
void sub_801C178(u8 whichWindow)
{
s8 sp0C = 0;
s32 windowId = gUnknown_02022C74->unk_0176[whichWindow];
PutWindowTilemap(windowId);
FillWindowPixelBuffer(windowId, 0);
switch (whichWindow)
{
case 0:
{
s32 x;
AddTextPrinterParameterized3(windowId, 3, 0, 1, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal1], 0, gUnknown_02022C74->unk_018B);
x = 160 - GetStringWidth(3, gUnknown_02022C74->unk_01B4, GetFontAttribute(3, 2));
if (x < 0)
x = 0;
AddTextPrinterParameterized3(windowId, 3, x, 17, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal1], 0, gUnknown_02022C74->unk_01B4);
if (gUnknown_02022C74->unk_0000.unk_04 != 0)
{
AddTextPrinterParameterized3(windowId, 1, 166, 17, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal1], 0, gUnknown_02022C74->unk_01DD);
}
break;
}
case 1:
for (; sp0C < 4; sp0C++)
{
AddTextPrinterParameterized3(windowId, 3, 0, 16 * sp0C + 2, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal2], 0, gUnknown_02022C74->unk_01E4[sp0C]);
}
break;
case 2:
AddTextPrinterParameterized3(windowId, 3, 0, gUnknown_082F0E18[gUnknown_02022C74->unk_0000.unk_08_0], gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_0288);
if (gUnknown_02022C74->unk_0000.unk_08_0 != 2)
{
AddTextPrinterParameterized3(windowId, 3, 0, 16 + gUnknown_082F0E18[gUnknown_02022C74->unk_0000.unk_08_0], gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_02B1);
}
else
{
s32 x = 0;
s32 y = gUnknown_082F0E18[gUnknown_02022C74->unk_0000.unk_08_0] + 16;
s32 spacing = GetFontAttribute(3, 2);
for (; sp0C < gUnknown_02022C74->unk_0175; sp0C++)
{
AddTextPrinterParameterized3(windowId, 3, x, y, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_02DC[sp0C].unk_01);
if (gUnknown_02022C74->unk_02DC[sp0C].unk_42[0] != EOS)
{
x += GetStringWidth(3, gUnknown_02022C74->unk_02DC[sp0C].unk_01, spacing);
AddTextPrinterParameterized3(windowId, 3, x, y, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_02DC[sp0C].unk_42);
x += GetStringWidth(3, gUnknown_02022C74->unk_02DC[sp0C].unk_42, spacing) + gUnknown_02022C74->unk_02DC[sp0C].unk_00;
}
}
}
break;
}
CopyWindowToVram(windowId, 3);
}
void sub_801C4C0(void)
{
u8 r7 = 0;
gUnknown_02022C74->unk_017C = 0xFF;
if (gUnknown_02022C74->unk_014C.unk_06 != SPECIES_NONE)
{
gUnknown_02022C74->unk_017C = sub_80D2D78(sub_80D2E84(gUnknown_02022C74->unk_014C.unk_06), SpriteCallbackDummy, 0xDC, 0x14, 0, FALSE);
gSprites[gUnknown_02022C74->unk_017C].oam.priority = 2;
}
if (gUnknown_02022C74->unk_0000.unk_09 != 0 && gUnknown_02022C74->unk_0000.unk_08_0 == 1)
{
LoadCompressedSpriteSheetUsingHeap(&gUnknown_082F1D00);
LoadSpritePalette(&gUnknown_082F1D08[gUnknown_02022C74->unk_0170->textPal4]);
for (; r7 < gUnknown_02022C74->unk_0000.unk_09; r7++)
{
gUnknown_02022C74->unk_017D[r7][0] = 0xFF;
gUnknown_02022C74->unk_017D[r7][1] = 0xFF;
gUnknown_02022C74->unk_017D[r7][0] = CreateSprite(&gUnknown_082F1D48, 0xd8 - 32 * r7, 0x90, 8);
if (gUnknown_02022C74->unk_014C.unk_08[0][r7] != 0)
{
gUnknown_02022C74->unk_017D[r7][1] = sub_80D2D78(sub_80D2E84(gUnknown_02022C74->unk_014C.unk_08[0][r7]), SpriteCallbackDummy, 0xd8 - 32 * r7, 0x88, 0, 0);
}
}
}
}
void sub_801C61C(void)
{
u8 r6 = 0;
if (gUnknown_02022C74->unk_017C != 0xFF)
sub_80D2EF8(&gSprites[gUnknown_02022C74->unk_017C]);
if (gUnknown_02022C74->unk_0000.unk_09 != 0 && gUnknown_02022C74->unk_0000.unk_08_0 == 1)
{
for (; r6 < gUnknown_02022C74->unk_0000.unk_09; r6++)
{
if (gUnknown_02022C74->unk_017D[r6][0] != 0xFF)
{
DestroySprite(&gSprites[gUnknown_02022C74->unk_017D[r6][0]]);
}
if (gUnknown_02022C74->unk_017D[r6][1] != 0xFF)
{
sub_80D2EF8(&gSprites[gUnknown_02022C74->unk_017D[r6][1]]);
}
}
FreeSpriteTilesByTag(0x8000);
FreeSpritePaletteByTag(0x8000);
}
}
struct UnkStruct_203F3CC
{
/*0000*/ struct MEventBuffer_3120_Sub unk_0000;
/*01bc*/ const struct UnkStruct_8467FB8 * unk_01BC;
/*01c0*/ u8 unk_01C0_0:1;
u8 unk_01C0_1:7;
/*01c1*/ u8 unk_01C1;
/*01c2*/ u8 unk_01C2_0:1;
u8 unk_01C2_1:7;
/*01c3*/ u8 unk_01C3_0:1;
u8 unk_01C3_1:7;
/*01c4*/ u16 unk_01C4;
/*01c6*/ u16 unk_01C6;
/*01c8*/ u16 unk_01C8[2];
/*01cc*/ u8 filler_01CC[2];
/*01ce*/ u8 unk_01CE[41];
/*01f7*/ u8 unk_01F7[10][41];
/*0394*/ struct ScrollArrowsTemplate unk_0394;
/*03a4*/ u8 buffer_03A4[0x1000];
};
EWRAM_DATA struct UnkStruct_203F3CC * gUnknown_02022C78 = NULL;
void sub_801CDCC(void);
void sub_801CE7C(void);
void sub_801CFA4(void);
const u8 gUnknown_082F1DE0[][3] = {
{0, 2, 3},
{0, 1, 2}
};
const struct WindowTemplate gUnknown_082F1DE8[] = {
{
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 0,
.width = 28,
.height = 3,
.paletteNum = 2,
.baseBlock = 0x2AC
}, {
.bg = 2,
.tilemapLeft = 1,
.tilemapTop = 3,
.width = 28,
.height = 20,
.paletteNum = 2,
.baseBlock = 0x07C
}
};
const struct ScrollArrowsTemplate gUnknown_082F1DF8 = {
0x02, 0xe8, 0x18, 0x03, 0xe8, 0x98,
0x0000, 0x0002, 0x1000, 0x1000, 0x0
};
const u16 gWonderNewsPal1[] = INCBIN_U16("graphics/wonder_transfers/wonder_news_1.gbapal");
const u16 gWonderNewsPal7[] = INCBIN_U16("graphics/wonder_transfers/wonder_news_7.gbapal");
const u16 gWonderNewsPal8[] = INCBIN_U16("graphics/wonder_transfers/wonder_news_8.gbapal");
const u32 gWonderNewsGfx1[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_1.4bpp.lz");
const u32 gWonderNewsTilemap1[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_1.bin.lz");
const u32 gWonderNewsGfx2[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_2.4bpp.lz");
const u32 gWonderNewsTilemap2[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_2.bin.lz");
const u32 gWonderNewsGfx3[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_3.4bpp.lz");
const u32 gWonderNewsTilemap3[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_3.bin.lz");
const u32 gWonderNewsGfx7[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_7.4bpp.lz");
const u32 gWonderNewsTilemap7[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_7.bin.lz");
const u32 gWonderNewsGfx8[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_8.4bpp.lz");
const u32 gWonderNewsTilemap8[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_8.bin.lz");
const struct UnkStruct_8467FB8 gUnknown_082F24C8[] = {
{1, 0, 0, 0, gWonderNewsGfx1, gWonderNewsTilemap1, gWonderNewsPal1},
{1, 0, 0, 0, gWonderNewsGfx2, gWonderNewsTilemap2, gWonderCardBgPal2},
{1, 0, 0, 0, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal3},
{1, 0, 0, 0, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal4},
{1, 0, 0, 0, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal5},
{1, 0, 0, 0, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal6},
{1, 0, 0, 0, gWonderNewsGfx7, gWonderNewsTilemap7, gWonderNewsPal7},
{1, 0, 0, 0, gWonderNewsGfx8, gWonderNewsTilemap8, gWonderNewsPal8}
};
bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0)
{
if (a0 == NULL)
return FALSE;
gUnknown_02022C78 = AllocZeroed(sizeof(struct UnkStruct_203F3CC));
if (gUnknown_02022C78 == NULL)
return FALSE;
gUnknown_02022C78->unk_0000 = *a0;
if (gUnknown_02022C78->unk_0000.unk_03 >= ARRAY_COUNT(gUnknown_082F24C8))
gUnknown_02022C78->unk_0000.unk_03 = 0;
gUnknown_02022C78->unk_01BC = &gUnknown_082F24C8[gUnknown_02022C78->unk_0000.unk_03];
gUnknown_02022C78->unk_01C1 = 0xFF;
return TRUE;
}
void sub_801C72C(void)
{
if (gUnknown_02022C78 != NULL)
{
*gUnknown_02022C78 = (struct UnkStruct_203F3CC){};
Free(gUnknown_02022C78);
gUnknown_02022C78 = NULL;
}
}
s32 sub_801C758(void)
{
if (gUnknown_02022C78 == NULL)
return -1;
switch (gUnknown_02022C78->unk_01C0_1)
{
case 0:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
break;
case 1:
if (UpdatePaletteFade())
return 0;
ChangeBgY(0, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgY(3, 0, 0);
SetGpuReg(REG_OFFSET_WIN0H, 0xF0);
SetGpuReg(REG_OFFSET_WIN0V, 0x1A98);
SetGpuReg(REG_OFFSET_WININ, 0x1F);
SetGpuReg(REG_OFFSET_WINOUT, 0x1B);
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 20);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
CopyBgTilemapBufferToVram(3);
decompress_and_copy_tile_data_to_vram(3, gUnknown_02022C78->unk_01BC->tiles, 0, 8, 0);
gUnknown_02022C78->unk_01C8[0] = AddWindow(&gUnknown_082F1DE8[0]);
gUnknown_02022C78->unk_01C8[1] = AddWindow(&gUnknown_082F1DE8[1]);
break;
case 3:
if (free_temp_tile_data_buffers_if_possible())
return 0;
LoadPalette(stdpal_get(1), 0x20, 0x20);
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(gUnknown_02022C78->unk_01BC->pal, 0x10, 0x20);
LZ77UnCompWram(gUnknown_02022C78->unk_01BC->map, gUnknown_02022C78->buffer_03A4);
CopyRectToBgTilemapBufferRect(1, gUnknown_02022C78->buffer_03A4, 0, 0, 30, 3, 0, 0, 30, 3, 1, 8, 0);
CopyRectToBgTilemapBufferRect(3, gUnknown_02022C78->buffer_03A4, 0, 3, 30, 23, 0, 3, 30, 23, 1, 8, 0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(3);
break;
case 4:
sub_801CDCC();
break;
case 5:
sub_801CE7C();
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(2);
break;
case 6:
ShowBg(1);
ShowBg(2);
ShowBg(3);
gPaletteFade.bufferTransferDisabled = FALSE;
gUnknown_02022C78->unk_01C1 = AddScrollIndicatorArrowPair(&gUnknown_02022C78->unk_0394, &gUnknown_02022C78->unk_01C6);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
UpdatePaletteFade();
break;
default:
if (UpdatePaletteFade())
return 0;
gUnknown_02022C78->unk_01C0_1 = 0;
return 1;
}
++gUnknown_02022C78->unk_01C0_1;
return 0;
}
s32 sub_801CA50(bool32 flag)
{
if (gUnknown_02022C78 == NULL)
return -1;
switch (gUnknown_02022C78->unk_01C0_1)
{
case 0:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
break;
case 1:
if (UpdatePaletteFade())
return 0;
ChangeBgY(2, 0, 0);
SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0);
SetGpuReg(REG_OFFSET_WININ, 0);
SetGpuReg(REG_OFFSET_WINOUT, 0);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 24);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 24);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
CopyBgTilemapBufferToVram(3);
break;
case 3:
HideBg(1);
HideBg(2);
RemoveWindow(gUnknown_02022C78->unk_01C8[1]);
RemoveWindow(gUnknown_02022C78->unk_01C8[0]);
break;
case 4:
ChangeBgY(2, 0, 0);
ChangeBgY(3, 0, 0);
if (gUnknown_02022C78->unk_01C1 != 0xFF)
{
RemoveScrollIndicatorArrowPair(gUnknown_02022C78->unk_01C1);
gUnknown_02022C78->unk_01C1 = 0xFF;
}
break;
case 5:
sub_80186EC(gUnknown_02022C60, flag);
sub_8018798(3);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(3);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
break;
default:
if (UpdatePaletteFade())
return 0;
gUnknown_02022C78->unk_01C0_1 = 0;
return 1;
}
++gUnknown_02022C78->unk_01C0_1;
return 0;
}
void sub_801CC38(void)
{
if (!gUnknown_02022C78->unk_01C0_0 && gUnknown_02022C78->unk_01C1 != 0xFF)
{
RemoveScrollIndicatorArrowPair(gUnknown_02022C78->unk_01C1);
gUnknown_02022C78->unk_01C1 = 0xFF;
gUnknown_02022C78->unk_01C0_0 = TRUE;
}
}
void sub_801CC80(void)
{
if (gUnknown_02022C78->unk_01C0_0)
{
gUnknown_02022C78->unk_01C1 = AddScrollIndicatorArrowPair(&gUnknown_02022C78->unk_0394, &gUnknown_02022C78->unk_01C6);
gUnknown_02022C78->unk_01C0_0 = FALSE;
}
}
u8 sub_801CCD0(u16 input)
{
if (gUnknown_02022C78->unk_01C2_0)
{
sub_801CFA4();
return 0xFF;
}
switch (input)
{
case A_BUTTON:
return 0;
case B_BUTTON:
return 1;
case DPAD_UP:
if (gUnknown_02022C78->unk_01C6 == 0)
return 0xFF;
if (gUnknown_02022C78->unk_01C0_0)
return 0xFF;
gUnknown_02022C78->unk_01C3_0 = FALSE;
break;
case DPAD_DOWN:
if (gUnknown_02022C78->unk_01C6 == gUnknown_02022C78->unk_01C4)
return 0xFF;
if (gUnknown_02022C78->unk_01C0_0)
return 0xFF;
gUnknown_02022C78->unk_01C3_0 = TRUE;
break;
default:
return 0xFF;
}
gUnknown_02022C78->unk_01C2_0 = TRUE;
gUnknown_02022C78->unk_01C2_1 = 2;
gUnknown_02022C78->unk_01C3_1 = 0;
if (gUnknown_02022C78->unk_01C3_0 == FALSE)
return 2;
else
return 3;
}
void sub_801CDCC(void)
{
u8 i = 0;
memcpy(gUnknown_02022C78->unk_01CE, gUnknown_02022C78->unk_0000.unk_04, 40);
gUnknown_02022C78->unk_01CE[40] = EOS;
for (; i < 10; ++i)
{
memcpy(gUnknown_02022C78->unk_01F7[i], gUnknown_02022C78->unk_0000.unk_2C[i], 40);
gUnknown_02022C78->unk_01F7[i][40] = EOS;
if (i > 7 && gUnknown_02022C78->unk_01F7[i][0] != EOS)
++gUnknown_02022C78->unk_01C4;
}
gUnknown_02022C78->unk_0394 = gUnknown_082F1DF8;
gUnknown_02022C78->unk_0394.fullyDownThreshold = gUnknown_02022C78->unk_01C4;
}
void sub_801CE7C(void)
{
u8 i = 0;
s32 x;
PutWindowTilemap(gUnknown_02022C78->unk_01C8[0]);
PutWindowTilemap(gUnknown_02022C78->unk_01C8[1]);
FillWindowPixelBuffer(gUnknown_02022C78->unk_01C8[0], 0);
FillWindowPixelBuffer(gUnknown_02022C78->unk_01C8[1], 0);
x = (0xe0 - GetStringWidth(3, gUnknown_02022C78->unk_01CE, GetFontAttribute(3, 2))) / 2;
if (x < 0)
x = 0;
AddTextPrinterParameterized3(gUnknown_02022C78->unk_01C8[0], 3, x, 6, gUnknown_082F1DE0[gUnknown_02022C78->unk_01BC->textPal1], 0, gUnknown_02022C78->unk_01CE);
for (; i < 10; ++i)
{
AddTextPrinterParameterized3(gUnknown_02022C78->unk_01C8[1], 3, 0, 16 * i + 2, gUnknown_082F1DE0[gUnknown_02022C78->unk_01BC->textPal2], 0, gUnknown_02022C78->unk_01F7[i]);
}
CopyWindowToVram(gUnknown_02022C78->unk_01C8[0], 3);
CopyWindowToVram(gUnknown_02022C78->unk_01C8[1], 3);
}
void sub_801CFA4(void)
{
u16 r4 = gUnknown_02022C78->unk_01C2_1;
r4 <<= 8;
if (gUnknown_02022C78->unk_01C3_0)
{
ChangeBgY(2, r4, 1);
ChangeBgY(3, r4, 1);
}
else
{
ChangeBgY(2, r4, 2);
ChangeBgY(3, r4, 2);
}
gUnknown_02022C78->unk_01C3_1 += gUnknown_02022C78->unk_01C2_1;
if (gUnknown_02022C78->unk_01C3_1 > 15)
{
if (gUnknown_02022C78->unk_01C3_0)
++gUnknown_02022C78->unk_01C6;
else
--gUnknown_02022C78->unk_01C6;
gUnknown_02022C78->unk_01C2_0 = FALSE;
gUnknown_02022C78->unk_01C3_1 = 0;
}
}

147
src/mevent_news.c Normal file
View File

@ -0,0 +1,147 @@
#include "global.h"
#include "mevent.h"
#include "random.h"
#include "event_data.h"
#include "mevent_news.h"
static u32 sub_801DCAC(struct MysteryEventStruct *);
static void sub_801DD10(struct MysteryEventStruct *);
static u32 sub_801DD44(struct MysteryEventStruct *);
static void sub_801DCD8(struct MysteryEventStruct *);
static void sub_801DCCC(struct MysteryEventStruct *);
void sub_801DB68(u32 a0)
{
struct MysteryEventStruct *r5 = sub_801B044();
r5->unk_0_0 = a0;
switch (a0)
{
case 0:
break;
case 1:
case 2:
r5->unk_1 = (Random() % 15) + 16;
break;
case 3:
r5->unk_1 = (Random() % 15) + 1;
break;
}
}
void sub_801DBC0(void)
{
struct MysteryEventStruct *r5 = sub_801B044();
r5->unk_0_0 = 0;
r5->unk_0_2 = 0;
r5->unk_0_5 = 0;
r5->unk_1 = 0;
VarSet(VAR_0x402E, 0);
}
void sub_801DBDC(void)
{
u16 *r4 = GetVarPointer(VAR_0x402E);
struct MysteryEventStruct *r2 = sub_801B044();
struct MysteryEventStruct r0 = *r2;
if ((u8)r0.unk_0_5 > 4 && ++(*r4) > 0x1f3)
{
r2->unk_0_5 = 0;
*r4 = 0;
}
}
u16 sub_801DC20(void)
{
u16 *r6 = &gSpecialVar_Result;
struct MysteryEventStruct *r4 = sub_801B044();
u16 r5;
if (!IsMysteryEventEnabled() || !sub_801B0CC())
return 0;
r5 = sub_801DD44(r4);
switch (r5)
{
case 0:
break;
case 1:
*r6 = sub_801DCAC(r4);
break;
case 2:
*r6 = sub_801DCAC(r4);
break;
case 3:
break;
case 4:
*r6 = sub_801DCAC(r4);
sub_801DCD8(r4);
break;
case 5:
*r6 = sub_801DCAC(r4);
sub_801DCCC(r4);
break;
case 6:
break;
}
return r5;
}
static u32 sub_801DCAC(struct MysteryEventStruct *a0)
{
u32 r4;
a0->unk_0_0 = 0;
r4 = a0->unk_1 + 0x84;
a0->unk_1 = 0;
sub_801DD10(a0);
return r4;
}
static void sub_801DCCC(struct MysteryEventStruct *a0)
{
a0->unk_0_2 = 0;
}
static void sub_801DCD8(struct MysteryEventStruct *a0)
{
a0->unk_0_2++;
if ((u8)a0->unk_0_2 > 4)
a0->unk_0_2 = 4;
}
static void sub_801DD10(struct MysteryEventStruct *a0)
{
a0->unk_0_5++;
if ((u8)a0->unk_0_5 > 5)
a0->unk_0_5 = 5;
}
static u32 sub_801DD44(struct MysteryEventStruct *a0)
{
struct MysteryEventStruct r0;
if ((u8)a0->unk_0_5 == 5)
return 6;
r0 = *a0;
switch (r0.unk_0_0)
{
case 0:
return 3;
case 1:
return 1;
case 2:
return 2;
case 3:
if ((u8)r0.unk_0_2 < 3)
return 4;
return 5;
default:
AGB_ASSERT(0);
return 0;
}
}