aboutsummaryrefslogtreecommitdiffstats
path: root/engine/black_out.asm
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2016-09-17 18:17:57 -0700
committerYamaArashi <shadow962@live.com>2016-09-17 18:17:57 -0700
commitc2381bb3e624e966c323610df762a299468a1728 (patch)
treeb884b81317d0aa1e3c7d71df39838ec00ab6a2ce /engine/black_out.asm
parentpull some bank 1 code out of main.asm (diff)
downloadpokeyellow-c2381bb3e624e966c323610df762a299468a1728.tar.gz
pokeyellow-c2381bb3e624e966c323610df762a299468a1728.tar.xz
pokeyellow-c2381bb3e624e966c323610df762a299468a1728.zip
split bank 1 into files
Diffstat (limited to 'engine/black_out.asm')
-rw-r--r--engine/black_out.asm46
1 files changed, 46 insertions, 0 deletions
diff --git a/engine/black_out.asm b/engine/black_out.asm
new file mode 100644
index 00000000..6c358ce3
--- /dev/null
+++ b/engine/black_out.asm
@@ -0,0 +1,46 @@
+ResetStatusAndHalveMoneyOnBlackout::
+; Reset player status on blackout.
+ xor a
+ ld [wBattleResult], a
+ ld [wWalkBikeSurfState], a
+ ld [wIsInBattle], a
+ ld [wMapPalOffset], a
+ ld [wNPCMovementScriptFunctionNum], a
+ ld [hJoyHeld], a
+ ld [wNPCMovementScriptPointerTableNum], a
+ ld [wFlags_0xcd60], a
+
+ ld [hMoney], a
+ ld [hMoney + 1], a
+ ld [hMoney + 2], a
+ call HasEnoughMoney
+ jr c, .lostmoney ; never happens
+
+ ; Halve the player's money.
+ ld a, [wPlayerMoney]
+ ld [hMoney], a
+ ld a, [wPlayerMoney + 1]
+ ld [hMoney + 1], a
+ ld a, [wPlayerMoney + 2]
+ ld [hMoney + 2], a
+ xor a
+ ld [hDivideBCDDivisor], a
+ ld [hDivideBCDDivisor + 1], a
+ ld a, 2
+ ld [hDivideBCDDivisor + 2], a
+ predef DivideBCDPredef3
+ ld a, [hDivideBCDQuotient]
+ ld [wPlayerMoney], a
+ ld a, [hDivideBCDQuotient + 1]
+ ld [wPlayerMoney + 1], a
+ ld a, [hDivideBCDQuotient + 2]
+ ld [wPlayerMoney + 2], a
+
+.lostmoney
+ ld hl, wd732
+ set 2, [hl]
+ res 3, [hl]
+ set 6, [hl]
+ ld a, %11111111
+ ld [wJoyIgnore], a
+ predef_jump HealParty