diff options
| author | dannye <33dannye@gmail.com> | 2020-11-04 00:06:44 -0600 |
|---|---|---|
| committer | dannye <33dannye@gmail.com> | 2020-11-04 00:06:44 -0600 |
| commit | 5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch) | |
| tree | dde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /engine/events/black_out.asm | |
| parent | Merge pull request #55 from Deokishisu/patch-1 (diff) | |
| download | pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.gz pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.xz pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.zip | |
Sync with pokered
Diffstat (limited to 'engine/events/black_out.asm')
| -rw-r--r-- | engine/events/black_out.asm | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/engine/events/black_out.asm b/engine/events/black_out.asm new file mode 100644 index 00000000..6d3d91b8 --- /dev/null +++ b/engine/events/black_out.asm @@ -0,0 +1,48 @@ +ResetStatusAndHalveMoneyOnBlackout:: +; Reset player status on blackout. + xor a + ld [wd435], a + xor a ; gamefreak copypasting functions (double xor a) + ld [wBattleResult], a + ld [wWalkBikeSurfState], a + ld [wIsInBattle], a + ld [wMapPalOffset], a + ld [wNPCMovementScriptFunctionNum], a + ldh [hJoyHeld], a + ld [wNPCMovementScriptPointerTableNum], a + ld [wFlags_0xcd60], a + + ldh [hMoney], a + ldh [hMoney + 1], a + ldh [hMoney + 2], a + call HasEnoughMoney + jr c, .lostmoney ; never happens + + ; Halve the player's money. + ld a, [wPlayerMoney] + ldh [hMoney], a + ld a, [wPlayerMoney + 1] + ldh [hMoney + 1], a + ld a, [wPlayerMoney + 2] + ldh [hMoney + 2], a + xor a + ldh [hDivideBCDDivisor], a + ldh [hDivideBCDDivisor + 1], a + ld a, 2 + ldh [hDivideBCDDivisor + 2], a + predef DivideBCDPredef3 + ldh a, [hDivideBCDQuotient] + ld [wPlayerMoney], a + ldh a, [hDivideBCDQuotient + 1] + ld [wPlayerMoney + 1], a + ldh 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 |
