SPRITE_ANIM_FRAME_IDX constants

This commit is contained in:
pikalaxalt 2016-05-15 21:50:31 -04:00
parent a5f5418fae
commit 87b733994b
14 changed files with 510 additions and 316 deletions

View File

@ -2832,11 +2832,11 @@ PlayerAttackDamage: ; 352e2
call GetDamageStatsCritical
jr c, .thickclub
ld hl, EnemyStats + 2
ld hl, EnemyDefense
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, PlayerStats
ld hl, PlayerAttack
jr .thickclub
.special
@ -2856,11 +2856,11 @@ PlayerAttackDamage: ; 352e2
call GetDamageStatsCritical
jr c, .lightball
ld hl, EnemyStats + SP_DEFENSE * 2
ld hl, EnemySpDef
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, PlayerStats + SP_ATTACK * 2
ld hl, PlayerSpAtk
.lightball
; Note: Returns player special attack at hl in hl.
@ -3098,11 +3098,11 @@ EnemyAttackDamage: ; 353f6
call GetDamageStatsCritical
jr c, .thickclub
ld hl, PlayerStats + 2
ld hl, PlayerDefense
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, EnemyStats
ld hl, EnemyAttack
jr .thickclub
.Special:
@ -3121,11 +3121,11 @@ EnemyAttackDamage: ; 353f6
ld hl, EnemyMonSpclAtk
call GetDamageStatsCritical
jr c, .lightball
ld hl, PlayerStats + 8
ld hl, PlayerSpDef
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, EnemyStats + 6
ld hl, EnemySpAtk
.lightball
call LightBallBoost

View File

@ -517,3 +517,146 @@ MAX_OUTDOOR_SPRITES EQU 23
const SPRITE_ANIM_INDEX_2A
const SPRITE_ANIM_INDEX_2B
const SPRITE_ANIM_INDEX_2C
const_def
const SPRITE_ANIM_FRAME_IDX_00
const SPRITE_ANIM_FRAME_IDX_01
const SPRITE_ANIM_FRAME_IDX_02
const SPRITE_ANIM_FRAME_IDX_03
const SPRITE_ANIM_FRAME_IDX_04
const SPRITE_ANIM_FRAME_IDX_05
const SPRITE_ANIM_FRAME_IDX_06
const SPRITE_ANIM_FRAME_IDX_07
const SPRITE_ANIM_FRAME_IDX_08
const SPRITE_ANIM_FRAME_IDX_09
const SPRITE_ANIM_FRAME_IDX_0A
const SPRITE_ANIM_FRAME_IDX_0B
const SPRITE_ANIM_FRAME_IDX_0C
const SPRITE_ANIM_FRAME_IDX_0D
const SPRITE_ANIM_FRAME_IDX_0E
const SPRITE_ANIM_FRAME_IDX_0F
const SPRITE_ANIM_FRAME_IDX_10
const SPRITE_ANIM_FRAME_IDX_11
const SPRITE_ANIM_FRAME_IDX_12
const SPRITE_ANIM_FRAME_IDX_13
const SPRITE_ANIM_FRAME_IDX_14
const SPRITE_ANIM_FRAME_IDX_15
const SPRITE_ANIM_FRAME_IDX_16
const SPRITE_ANIM_FRAME_IDX_17
const SPRITE_ANIM_FRAME_IDX_18
const SPRITE_ANIM_FRAME_IDX_19
const SPRITE_ANIM_FRAME_IDX_1A
const SPRITE_ANIM_FRAME_IDX_1B
const SPRITE_ANIM_FRAME_IDX_1C
const SPRITE_ANIM_FRAME_IDX_1D
const SPRITE_ANIM_FRAME_IDX_1E
const SPRITE_ANIM_FRAME_IDX_1F
const SPRITE_ANIM_FRAME_IDX_20
const SPRITE_ANIM_FRAME_IDX_21
const SPRITE_ANIM_FRAME_IDX_22
const SPRITE_ANIM_FRAME_IDX_23
const SPRITE_ANIM_FRAME_IDX_24
const SPRITE_ANIM_FRAME_IDX_25
const SPRITE_ANIM_FRAME_IDX_26
const SPRITE_ANIM_FRAME_IDX_27
const SPRITE_ANIM_FRAME_IDX_28
const SPRITE_ANIM_FRAME_IDX_29
const SPRITE_ANIM_FRAME_IDX_2A
const SPRITE_ANIM_FRAME_IDX_2B
const SPRITE_ANIM_FRAME_IDX_2C
const SPRITE_ANIM_FRAME_IDX_2D
const SPRITE_ANIM_FRAME_IDX_2E
const SPRITE_ANIM_FRAME_IDX_2F
const SPRITE_ANIM_FRAME_IDX_30
const SPRITE_ANIM_FRAME_IDX_31
const SPRITE_ANIM_FRAME_IDX_32
const SPRITE_ANIM_FRAME_IDX_33
const SPRITE_ANIM_FRAME_IDX_34
const SPRITE_ANIM_FRAME_IDX_35
const SPRITE_ANIM_FRAME_IDX_36
const SPRITE_ANIM_FRAME_IDX_37
const SPRITE_ANIM_FRAME_IDX_38
const SPRITE_ANIM_FRAME_IDX_39
const SPRITE_ANIM_FRAME_IDX_3A
const SPRITE_ANIM_FRAME_IDX_3B
const SPRITE_ANIM_FRAME_IDX_3C
const SPRITE_ANIM_FRAME_IDX_3D
const SPRITE_ANIM_FRAME_IDX_3E
const SPRITE_ANIM_FRAME_IDX_3F
const SPRITE_ANIM_FRAME_IDX_40
const SPRITE_ANIM_FRAME_IDX_41
const SPRITE_ANIM_FRAME_IDX_42
const SPRITE_ANIM_FRAME_IDX_43
const SPRITE_ANIM_FRAME_IDX_44
const SPRITE_ANIM_FRAME_IDX_45
const SPRITE_ANIM_FRAME_IDX_46
const SPRITE_ANIM_FRAME_IDX_47
const SPRITE_ANIM_FRAME_IDX_48
const SPRITE_ANIM_FRAME_IDX_49
const SPRITE_ANIM_FRAME_IDX_4A
const SPRITE_ANIM_FRAME_IDX_4B
const SPRITE_ANIM_FRAME_IDX_4C
const SPRITE_ANIM_FRAME_IDX_4D
const SPRITE_ANIM_FRAME_IDX_4E
const SPRITE_ANIM_FRAME_IDX_4F
const SPRITE_ANIM_FRAME_IDX_50
const SPRITE_ANIM_FRAME_IDX_51
const SPRITE_ANIM_FRAME_IDX_52
const SPRITE_ANIM_FRAME_IDX_53
const SPRITE_ANIM_FRAME_IDX_54
const SPRITE_ANIM_FRAME_IDX_55
const SPRITE_ANIM_FRAME_IDX_56
const SPRITE_ANIM_FRAME_IDX_57
const SPRITE_ANIM_FRAME_IDX_58
const SPRITE_ANIM_FRAME_IDX_59
const SPRITE_ANIM_FRAME_IDX_5A
const SPRITE_ANIM_FRAME_IDX_5B
const SPRITE_ANIM_FRAME_IDX_5C
const SPRITE_ANIM_FRAME_IDX_5D
const SPRITE_ANIM_FRAME_IDX_5E
const SPRITE_ANIM_FRAME_IDX_5F
const SPRITE_ANIM_FRAME_IDX_60
const SPRITE_ANIM_FRAME_IDX_61
const SPRITE_ANIM_FRAME_IDX_62
const SPRITE_ANIM_FRAME_IDX_63
const SPRITE_ANIM_FRAME_IDX_64
const SPRITE_ANIM_FRAME_IDX_65
const SPRITE_ANIM_FRAME_IDX_66
const SPRITE_ANIM_FRAME_IDX_67
const SPRITE_ANIM_FRAME_IDX_68
const SPRITE_ANIM_FRAME_IDX_69
const SPRITE_ANIM_FRAME_IDX_6A
const SPRITE_ANIM_FRAME_IDX_6B
const SPRITE_ANIM_FRAME_IDX_6C
const SPRITE_ANIM_FRAME_IDX_6D
const SPRITE_ANIM_FRAME_IDX_6E
const SPRITE_ANIM_FRAME_IDX_6F
const SPRITE_ANIM_FRAME_IDX_70
const SPRITE_ANIM_FRAME_IDX_71
const SPRITE_ANIM_FRAME_IDX_72
const SPRITE_ANIM_FRAME_IDX_73
const SPRITE_ANIM_FRAME_IDX_74
const SPRITE_ANIM_FRAME_IDX_75
const SPRITE_ANIM_FRAME_IDX_76
const SPRITE_ANIM_FRAME_IDX_77
const SPRITE_ANIM_FRAME_IDX_78
const SPRITE_ANIM_FRAME_IDX_79
const SPRITE_ANIM_FRAME_IDX_7A
const SPRITE_ANIM_FRAME_IDX_7B
const SPRITE_ANIM_FRAME_IDX_7C
const SPRITE_ANIM_FRAME_IDX_7D
const SPRITE_ANIM_FRAME_IDX_7E
const SPRITE_ANIM_FRAME_IDX_7F
const SPRITE_ANIM_FRAME_IDX_80
const SPRITE_ANIM_FRAME_IDX_81
const SPRITE_ANIM_FRAME_IDX_82
const SPRITE_ANIM_FRAME_IDX_83
const SPRITE_ANIM_FRAME_IDX_84
const SPRITE_ANIM_FRAME_IDX_85
const SPRITE_ANIM_FRAME_IDX_86
const SPRITE_ANIM_FRAME_IDX_87
const SPRITE_ANIM_FRAME_IDX_88
const SPRITE_ANIM_FRAME_IDX_89
const SPRITE_ANIM_FRAME_IDX_8A
const SPRITE_ANIM_FRAME_IDX_8B

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@ LinkCommunications: ; 28000
hlcoord 4, 10
ld de, String_PleaseWait
call PlaceString
call Function28eff
call SetTradeRoomBGPals
call WaitBGMap2
ld hl, wcf5d
xor a
@ -41,7 +41,7 @@ TimeCapsule: ; 2805d
call FixDataForLinkTransfer
xor a
ld [wPlayerLinkAction], a
call Function87d
call WaitLinkTransfer
ld a, [hLinkPlayerNumber]
cp $2
jr nz, .player_1
@ -1936,7 +1936,7 @@ LinkTrade: ; 28b87
callab EvolvePokemon
call ClearScreen
call LoadTradeScreenBorder
call Function28eff
call SetTradeRoomBGPals
callba Link_WaitBGMap
ld b, $1
pop af
@ -2029,8 +2029,8 @@ LoadTradeScreenBorder: ; 28ef8
ret
; 28eff
Function28eff: ; 28eff
callba Function16d6a7 ; just a nested farcall; so wasteful
SetTradeRoomBGPals: ; 28eff
callba LoadTradeRoomBGPals_ ; just a nested farcall; so wasteful
call SetPalettes
ret
; 28f09
@ -2150,7 +2150,7 @@ Special_EnterTimeCapsule: ; 29c7b
ld c, 10
call DelayFrames
ld a, $4
call Function29f17
call Link_EnsureSync
ld c, 40
call DelayFrames
xor a
@ -2199,7 +2199,7 @@ WaitForOtherPlayerToExit: ; 29c92
ld [rIE], a
pop af
ld [rIF], a
ld hl, wcf5b
ld hl, wLinkTimeoutFrames
xor a
ld [hli], a
ld [hl], a
@ -2240,7 +2240,7 @@ Special_SetBitsForTimeCapsuleRequest: ; 29cfa
Special_WaitForLinkedFriend: ; 29d11
ld a, [wPlayerLinkAction]
and a
jr z, .asm_29d2f
jr z, .no_link_action
ld a, $2
ld [rSB], a
xor a
@ -2253,17 +2253,17 @@ Special_WaitForLinkedFriend: ; 29d11
call DelayFrame
call DelayFrame
.asm_29d2f
.no_link_action
ld a, $2
ld [wcf5b + 1], a
ld [wLinkTimeoutFrames + 1], a
ld a, $ff
ld [wcf5b], a
.asm_29d39
ld [wLinkTimeoutFrames], a
.loop
ld a, [hLinkPlayerNumber]
cp $2
jr z, .asm_29d79
jr z, .connected
cp $1
jr z, .asm_29d79
jr z, .connected
ld a, -1
ld [hLinkPlayerNumber], a
ld a, $2
@ -2274,16 +2274,16 @@ Special_WaitForLinkedFriend: ; 29d11
ld [rSC], a
ld a, $80
ld [rSC], a
ld a, [wcf5b]
ld a, [wLinkTimeoutFrames]
dec a
ld [wcf5b], a
jr nz, .asm_29d68
ld a, [wcf5b + 1]
ld [wLinkTimeoutFrames], a
jr nz, .not_done
ld a, [wLinkTimeoutFrames + 1]
dec a
ld [wcf5b + 1], a
jr z, .asm_29d8d
ld [wLinkTimeoutFrames + 1], a
jr z, .done
.asm_29d68
.not_done
ld a, $1
ld [rSB], a
ld a, $1
@ -2291,19 +2291,19 @@ Special_WaitForLinkedFriend: ; 29d11
ld a, $81
ld [rSC], a
call DelayFrame
jr .asm_29d39
jr .loop
.asm_29d79
.connected
call LinkDataReceived
call DelayFrame
call LinkDataReceived
ld c, $32
ld c, 50
call DelayFrames
ld a, $1
ld [ScriptVar], a
ret
.asm_29d8d
.done
xor a
ld [ScriptVar], a
ret
@ -2312,7 +2312,7 @@ Special_WaitForLinkedFriend: ; 29d11
Special_CheckLinkTimeout: ; 29d92
ld a, $1
ld [wPlayerLinkAction], a
ld hl, wcf5b
ld hl, wLinkTimeoutFrames
ld a, $3
ld [hli], a
xor a
@ -2322,19 +2322,19 @@ Special_CheckLinkTimeout: ; 29d92
ld [hVBlank], a
call DelayFrame
call DelayFrame
call Function29e0c
call Link_CheckCommunicationError
xor a
ld [hVBlank], a
ld a, [ScriptVar]
and a
ret nz
jp Function29f04
jp Link_ResetSerialRegistersAfterLinkClosure
; 29dba
Function29dba: ; 29dba
ld a, $5
ld [wPlayerLinkAction], a
ld hl, wcf5b
ld hl, wLinkTimeoutFrames
ld a, $3
ld [hli], a
xor a
@ -2344,7 +2344,7 @@ Function29dba: ; 29dba
ld [hVBlank], a
call DelayFrame
call DelayFrame
call Function29e0c
call Link_CheckCommunicationError
ld a, [ScriptVar]
and a
jr z, .vblank
@ -2359,11 +2359,11 @@ Function29dba: ; 29dba
jr nz, .script_var
ld a, $6
ld [wPlayerLinkAction], a
ld hl, wcf5b
ld hl, wLinkTimeoutFrames
ld a, $1
ld [hli], a
ld [hl], $32
call Function29e0c
call Link_CheckCommunicationError
ld a, [wOtherPlayerLinkMode]
cp $6
jr z, .vblank
@ -2379,12 +2379,12 @@ Function29dba: ; 29dba
ret
; 29e0c
Function29e0c: ; 29e0c
Link_CheckCommunicationError: ; 29e0c
xor a
ld [hFFCA], a
ld a, [wcf5b]
ld a, [wLinkTimeoutFrames]
ld h, a
ld a, [wcf5b + 1]
ld a, [wLinkTimeoutFrames + 1]
ld l, a
push hl
call .CheckConnected
@ -2403,7 +2403,7 @@ Function29e0c: ; 29e0c
.load_scriptvar
ld [ScriptVar], a
ld hl, wcf5b
ld hl, wLinkTimeoutFrames
xor a
ld [hli], a
ld [hl], a
@ -2411,8 +2411,8 @@ Function29e0c: ; 29e0c
; 29e3b
.CheckConnected: ; 29e3b
call Function87d
ld hl, wcf5b
call WaitLinkTransfer
ld hl, wLinkTimeoutFrames
ld a, [hli]
inc a
ret nz
@ -2432,8 +2432,8 @@ Function29e0c: ; 29e0c
; 29e53
.ConvertDW: ; 29e53
; hl = ((hl - $100) / 4) + $100
; = (hl / 4) + $c0
; [wLinkTimeoutFrames] = ((hl - $100) / 4) + $100
; = (hl / 4) + $c0
dec h
srl h
rr l
@ -2441,9 +2441,9 @@ Function29e0c: ; 29e0c
rr l
inc h
ld a, h
ld [wcf5b], a
ld [wLinkTimeoutFrames], a
ld a, l
ld [wcf5b + 1], a
ld [wLinkTimeoutFrames + 1], a
ret
; 29e66
@ -2452,12 +2452,11 @@ Special_TryQuickSave: ; 29e66
push af
callba Link_SaveGame
ld a, $1
jr nc, .asm_29e75
jr nc, .return_result
xor a
.asm_29e75
.return_result
ld [ScriptVar], a
ld c, $1e
ld c, 30
call DelayFrames
pop af
ld [wd265], a
@ -2466,7 +2465,7 @@ Special_TryQuickSave: ; 29e66
Special_CheckBothSelectedSameRoom: ; 29e82
ld a, [wd265]
call Function29f17
call Link_EnsureSync
push af
call LinkDataReceived
call DelayFrame
@ -2527,19 +2526,19 @@ Special_Colosseum: ; 29ed9
Special_CloseLink: ; 29eee
xor a
ld [wLinkMode], a
ld c, $3
ld c, 3
call DelayFrames
jp Function29f04
jp Link_ResetSerialRegistersAfterLinkClosure
; 29efa
Special_FailedLinkToPast: ; 29efa
ld c, 40
call DelayFrames
ld a, $e
jp Function29f17
jp Link_EnsureSync
; 29f04
Function29f04: ; 29f04
Link_ResetSerialRegistersAfterLinkClosure: ; 29f04
ld c, 3
call DelayFrames
ld a, -1
@ -2552,7 +2551,7 @@ Function29f04: ; 29f04
ret
; 29f17
Function29f17: ; 29f17
Link_EnsureSync: ; 29f17
add $d0
ld [wPlayerLinkAction], a
ld [wcf57], a

View File

@ -145,8 +145,8 @@ LinkComms_LoadPleaseWaitTextboxBorderGFX: ; 16d69a
ret
; 16d6a7
Function16d6a7: ; 16d6a7
callba Function49811
LoadTradeRoomBGPals_: ; 16d6a7
callba LoadTradeRoomBGPals
ret
; 16d6ae
@ -171,7 +171,7 @@ LinkTextbox: ; 16d6ca
Function16d6ce: ; 16d6ce
call LoadStandardMenuDataHeader
call Function16d6e1
callba Function87d
callba WaitLinkTransfer
call Call_ExitMenu
call WaitBGMap2
ret

View File

@ -38,11 +38,11 @@ LoadMenuMonIcon: ; 8e83f
.Jumptable: ; 8e854 (23:6854)
dw Function8e8d5 ; party menu
dw Function8e961 ; naming screen
dw Function8e97d ; moves (?)
dw PartyMenu_InitAnimatedMonIcon ; party menu
dw NamingScreen_InitAnimatedMonIcon ; naming screen
dw MoveList_InitAnimatedMonIcon ; moves (?)
dw Trade_LoadMonIconGFX ; trade
dw Function8e898 ; mobile
dw Mobile_InitAnimatedMonIcon ; mobile
dw Mobile_InitPartyMenuBGPal71 ; mobile
dw .GetPartyMenuMonIcon ; unused
@ -84,8 +84,8 @@ LoadMenuMonIcon: ; 8e83f
ld [hl], a
ret
Function8e898: ; 8e898 (23:6898)
call Function8e8d5
Mobile_InitAnimatedMonIcon: ; 8e898 (23:6898)
call PartyMenu_InitAnimatedMonIcon
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld a, SPRITE_ANIM_SEQ_NULL
@ -121,7 +121,7 @@ Mobile_InitPartyMenuBGPal71: ; 8e8b1 (23:68b1)
ld [wc608 + 1], a
ret
Function8e8d5: ; 8e8d5 (23:68d5)
PartyMenu_InitAnimatedMonIcon: ; 8e8d5 (23:68d5)
call InitPartyMenuIcon
call .SpawnItemIcon
call SetPartyMonIconAnimSpeed
@ -144,11 +144,11 @@ Function8e8d5: ; 8e8d5 (23:68d5)
pop bc
pop hl
jr c, .mail
ld a, $3
ld a, SPRITE_ANIM_FRAMESET_03
jr .okay
.mail
ld a, $2
ld a, SPRITE_ANIM_FRAMESET_02
.okay
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc
@ -218,7 +218,7 @@ SetPartyMonIconAnimSpeed: ; 8e936 (23:6936)
db $00, $40, $80
; 8e961
Function8e961: ; 8e961 (23:6961)
NamingScreen_InitAnimatedMonIcon: ; 8e961 (23:6961)
ld a, [wd265]
call ReadMonMenuIcon
ld [CurIcon], a
@ -232,7 +232,7 @@ Function8e961: ; 8e961 (23:6961)
ld [hl], SPRITE_ANIM_SEQ_NULL
ret
Function8e97d: ; 8e97d (23:697d)
MoveList_InitAnimatedMonIcon: ; 8e97d (23:697d)
ld a, [wd265]
call ReadMonMenuIcon
ld [CurIcon], a

View File

@ -201,10 +201,11 @@ OaksPkmnTalk3:
OaksPkmnTalk4:
; Choose a random route, and a random Pokemon from that route.
.sample
call Random
and $1f
cp $f
jr nc, OaksPkmnTalk4
cp $f ; so wasteful
jr nc, .sample
; We now have a number between 0 and 14.
ld hl, .routes
ld c, a
@ -1576,7 +1577,8 @@ BuenasPassword4:
; There are only 11 groups to choose from.
.greater_than_11
call Random
and $f
maskbits NUM_PASSWORD_CATEGORIES
and x
cp NUM_PASSWORD_CATEGORIES
jr nc, .greater_than_11
; Store it in the high nybble of e.

View File

@ -1457,7 +1457,7 @@ ChooseMoveToDelete: ; 12f5b
push af
set NO_TEXT_SCROLL, [hl]
call LoadFontsBattleExtra
call .asm_12f73
call .ChooseMoveToDelete
pop bc
ld a, b
ld [Options], a
@ -1467,36 +1467,36 @@ ChooseMoveToDelete: ; 12f5b
ret
; 12f73
.asm_12f73
.ChooseMoveToDelete
call SetUpMoveScreenBG
ld de, DeleteMoveScreenAttrs
call SetMenuAttributes
call SetUpMoveList
ld hl, w2DMenuFlags1
set 6, [hl]
jr .asm_12f93
jr .enter_loop
.asm_12f86
.loop
call ScrollingMenuJoypad
bit 1, a
jp nz, .asm_12f9f
bit 0, a
jp nz, .asm_12f9c
bit B_BUTTON_F, a
jp nz, .b_button
bit A_BUTTON_F, a
jp nz, .a_button
.asm_12f93
.enter_loop
call PrepareToPlaceMoveData
call PlaceMoveData
jp .asm_12f86
jp .loop
; 12f9c
.asm_12f9c
.a_button
and a
jr .asm_12fa0
jr .finish
.asm_12f9f
.b_button
scf
.asm_12fa0
.finish
push af
xor a
ld [wSwitchMon], a

View File

@ -143,12 +143,12 @@ Function78a:: ; 78a
jr nz, .reset_ffca
ld a, [hLinkPlayerNumber]
cp $1
jr nz, .not_player_1_or_wcf5b_zero
call Checkwcf5bNonzero
jr z, .not_player_1_or_wcf5b_zero
jr nz, .not_player_1_or_wLinkTimeoutFrames_zero
call CheckwLinkTimeoutFramesNonzero
jr z, .not_player_1_or_wLinkTimeoutFrames_zero
call .delay_15_cycles
push hl
ld hl, wcf5b + 1
ld hl, wLinkTimeoutFrames + 1
inc [hl]
jr nz, .no_rollover_up
dec hl
@ -156,11 +156,11 @@ Function78a:: ; 78a
.no_rollover_up
pop hl
call Checkwcf5bNonzero
call CheckwLinkTimeoutFramesNonzero
jr nz, .loop2
jp SerialDisconnected
.not_player_1_or_wcf5b_zero
.not_player_1_or_wLinkTimeoutFrames_zero
ld a, [rIE]
and $f
cp $8
@ -176,6 +176,7 @@ Function78a:: ; 78a
ld a, [hLinkPlayerNumber]
cp $1
jr z, .reset_ffca
ld a, 255
.delay_255_cycles
dec a
@ -188,6 +189,7 @@ Function78a:: ; 78a
and $f
sub $8
jr nz, .rIE_not_equal_8
ld [wcf5d], a
ld a, $50
ld [wcf5d + 1], a
@ -196,10 +198,10 @@ Function78a:: ; 78a
ld a, [hSerialReceive]
cp $fe
ret nz
call Checkwcf5bNonzero
jr z, .wcf5b_zero
call CheckwLinkTimeoutFramesNonzero
jr z, .wLinkTimeoutFrames_zero
push hl
ld hl, wcf5b + 1
ld hl, wLinkTimeoutFrames + 1
ld a, [hl]
dec a
ld [hld], a
@ -209,10 +211,10 @@ Function78a:: ; 78a
.no_rollover
pop hl
call Checkwcf5bNonzero
call CheckwLinkTimeoutFramesNonzero
jr z, SerialDisconnected
.wcf5b_zero
.wLinkTimeoutFrames_zero
ld a, [rIE]
and $f
cp $8
@ -231,9 +233,9 @@ Function78a:: ; 78a
ret
; 82b
Checkwcf5bNonzero:: ; 82b
CheckwLinkTimeoutFramesNonzero:: ; 82b
push hl
ld hl, wcf5b
ld hl, wLinkTimeoutFrames
ld a, [hli]
or [hl]
pop hl
@ -242,8 +244,8 @@ Checkwcf5bNonzero:: ; 82b
SerialDisconnected:: ; 833
dec a
ld [wcf5b], a
ld [wcf5b + 1], a
ld [wLinkTimeoutFrames], a
ld [wLinkTimeoutFrames + 1], a
ret
; 83b
@ -276,7 +278,7 @@ Function83b:: ; 83b
Function862:: ; 862
call LoadTileMapToTempTileMap
callab PlaceWaitingText
call Function87d
call WaitLinkTransfer
jp Call_LoadTempTileMapToTileMap
; 871
@ -284,21 +286,21 @@ Function862:: ; 862
Function871:: ; 871
call LoadTileMapToTempTileMap
callab PlaceWaitingText
jp Function87d
jp WaitLinkTransfer
; 87d
; One "giant" leap for machinekind
Function87d:: ; 87d
WaitLinkTransfer:: ; 87d
ld a, $ff
ld [wOtherPlayerLinkAction], a
.loop
call LinkTransfer
call DelayFrame
call Checkwcf5bNonzero
call CheckwLinkTimeoutFramesNonzero
jr z, .check
push hl
ld hl, wcf5b + 1
ld hl, wLinkTimeoutFrames + 1
dec [hl]
jr nz, .skip
dec hl

View File

@ -48,17 +48,20 @@ GetClock:: ; 5b7
ld [hl], RTC_S
ld a, [de]
and $3f
maskbits 60
and x
ld [hRTCSeconds], a
ld [hl], RTC_M
ld a, [de]
and $3f
maskbits 60
and x
ld [hRTCMinutes], a
ld [hl], RTC_H
ld a, [de]
and $1f
maskbits 24
and x
ld [hRTCHours], a
ld [hl], RTC_DL

View File

@ -270,3 +270,22 @@ jumptable: MACRO
ld l, a
jp [hl]
endm
maskbits: macro
; returns to x
; usage in rejection sampling
; .loop
; call Random
; maskbits 30
; and x
; cp 30
; jr nc, .loop
x = 1
rept 8
IF \1 > x
x = (x + 1) * 2 +- 1
ENDC
endr
endm

View File

@ -2507,7 +2507,7 @@ LinkMonStatsScreen: ; 4d319
callba LoadTradeScreenBorder
callba Link_WaitBGMap
callba InitTradeSpeciesList
callba Function28eff
callba SetTradeRoomBGPals
call WaitBGMap2
ret

View File

@ -566,7 +566,7 @@ _InitMG_Mobile_LinkTradePalMap: ; 49797
ret
; 49811
Function49811: ; 49811
LoadTradeRoomBGPals: ; 49811
ld hl, Palette_49826
ld de, UnknBGPals + $10
ld bc, $30

View File

@ -536,10 +536,18 @@ wTurnEnded:: ds 1 ; c6b4
ds 1
PlayerStats:: ; c6b6
ds 10
PlayerAttack:: ds 2
PlayerDefense:: ds 2
PlayerSpeed:: ds 2
PlayerSpAtk:: ds 2
PlayerSpDef:: ds 2
ds 1
EnemyStats:: ; c6c1
ds 10
EnemyAttack:: ds 2
EnemyDefense:: ds 2
EnemySpeed:: ds 2
EnemySpAtk:: ds 2
EnemySpDef:: ds 2
ds 1
PlayerStatLevels:: ; c6cc
@ -1270,7 +1278,7 @@ wOtherPlayerLinkMode:: ds 1
wOtherPlayerLinkAction:: ds 4
wPlayerLinkAction:: ds 1
wcf57:: ds 4
wcf5b:: dw
wLinkTimeoutFrames:: dw ; cf5b
wcf5d:: ds 2
MonType:: ; cf5f