Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/events/black_out.asm
1271 views
1
ResetStatusAndHalveMoneyOnBlackout::
2
; Reset player status on blackout.
3
xor a
4
ld [wBattleResult], a
5
ld [wWalkBikeSurfState], a
6
ld [wIsInBattle], a
7
ld [wMapPalOffset], a
8
ld [wNPCMovementScriptFunctionNum], a
9
ldh [hJoyHeld], a
10
ld [wNPCMovementScriptPointerTableNum], a
11
ld [wMiscFlags], a
12
13
ldh [hMoney], a
14
ldh [hMoney + 1], a
15
ldh [hMoney + 2], a
16
call HasEnoughMoney
17
jr c, .lostmoney ; never happens
18
19
; Halve the player's money.
20
ld a, [wPlayerMoney]
21
ldh [hMoney], a
22
ld a, [wPlayerMoney + 1]
23
ldh [hMoney + 1], a
24
ld a, [wPlayerMoney + 2]
25
ldh [hMoney + 2], a
26
xor a
27
ldh [hDivideBCDDivisor], a
28
ldh [hDivideBCDDivisor + 1], a
29
ld a, 2
30
ldh [hDivideBCDDivisor + 2], a
31
predef DivideBCDPredef3
32
ldh a, [hDivideBCDQuotient]
33
ld [wPlayerMoney], a
34
ldh a, [hDivideBCDQuotient + 1]
35
ld [wPlayerMoney + 1], a
36
ldh a, [hDivideBCDQuotient + 2]
37
ld [wPlayerMoney + 2], a
38
39
.lostmoney
40
ld hl, wStatusFlags6
41
set BIT_FLY_OR_DUNGEON_WARP, [hl]
42
res BIT_FLY_WARP, [hl]
43
set BIT_ESCAPE_WARP, [hl]
44
ld a, PAD_BUTTONS | PAD_CTRL_PAD
45
ld [wJoyIgnore], a
46
predef_jump HealParty
47
48