summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlibjet <libj3t@gmail.com>2020-02-08 15:31:49 +0000
committerlibjet <libj3t@gmail.com>2020-02-08 15:31:49 +0000
commit0543e933915a65127a8b803789d049478c7889d5 (patch)
treef77d6afd9cf19813ce5b3987a48b22ddee17c701
parent4617c1e46b49be5febc4218c705f2d6d06f5adea (diff)
Remove Crystal exlusives
-rw-r--r--constants.asm2
-rwxr-xr-xconstants/hardware_constants.asm164
-rw-r--r--constants/item_constants.asm19
-rwxr-xr-xconstants/mart_constants.asm1
-rwxr-xr-xengine/events/forced_movement.asm51
-rwxr-xr-xengine/events/heal_machine_anim.asm262
-rwxr-xr-xengine/events/whiteout.asm76
-rw-r--r--engine/facings.asm3
-rwxr-xr-xengine/sprites_dump.asm0
-rwxr-xr-xgfx/overworld/heal_machine.pal4
-rwxr-xr-xgfx/overworld/heal_machine.pngbin0 -> 93 bytes
-rw-r--r--home.asm2
-rwxr-xr-x[-rw-r--r--]home/tilemap.asm0
-rw-r--r--macros.asm1
-rwxr-xr-xmacros/legacy.asm244
-rwxr-xr-xmacros/scripts/gfx_anims.asm53
-rw-r--r--main.asm6
17 files changed, 566 insertions, 322 deletions
diff --git a/constants.asm b/constants.asm
index c4a2a8ba..4b3402e9 100644
--- a/constants.asm
+++ b/constants.asm
@@ -2,9 +2,9 @@ INCLUDE "charmap.asm"
INCLUDE "macros.asm"
-INCLUDE "gbhw.asm"
INCLUDE "hram.asm"
+INCLUDE "constants/hardware_constants.asm"
INCLUDE "constants/wram_constants.asm"
INCLUDE "constants/sram_constants.asm"
INCLUDE "constants/pokemon_constants.asm"
diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm
new file mode 100755
index 00000000..6205a1d7
--- /dev/null
+++ b/constants/hardware_constants.asm
@@ -0,0 +1,164 @@
+; Graciously aped from:
+; http://nocash.emubase.de/pandocs.htm
+; http://gameboy.mongenel.com/dmg/asmmemmap.html
+
+; memory map
+VRAM_Begin EQU $8000
+VRAM_End EQU $a000
+SRAM_Begin EQU $a000
+SRAM_End EQU $c000
+WRAM0_Begin EQU $c000
+WRAM0_End EQU $d000
+WRAM1_Begin EQU $d000
+WRAM1_End EQU $e000
+; hardware registers $ff00-$ff80 (see below)
+HRAM_Begin EQU $ff80
+HRAM_End EQU $ffff
+
+; MBC3
+MBC3SRamEnable EQU $0000
+MBC3RomBank EQU $2000
+MBC3SRamBank EQU $4000
+MBC3LatchClock EQU $6000
+MBC3RTC EQU $a000
+
+SRAM_DISABLE EQU $00
+SRAM_ENABLE EQU $0a
+
+NUM_SRAM_BANKS EQU 4
+
+RTC_S EQU $08 ; Seconds 0-59 (0-3Bh)
+RTC_M EQU $09 ; Minutes 0-59 (0-3Bh)
+RTC_H EQU $0a ; Hours 0-23 (0-17h)
+RTC_DL EQU $0b ; Lower 8 bits of Day Counter (0-FFh)
+RTC_DH EQU $0c ; Upper 1 bit of Day Counter, Carry Bit, Halt Flag
+ ; Bit 0 Most significant bit of Day Counter (Bit 8)
+ ; Bit 6 Halt (0=Active, 1=Stop Timer)
+ ; Bit 7 Day Counter Carry Bit (1=Counter Overflow)
+
+; interrupt flags
+VBLANK EQU 0
+LCD_STAT EQU 1
+TIMER EQU 2
+SERIAL EQU 3
+JOYPAD EQU 4
+IE_DEFAULT EQU (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
+
+; OAM attribute flags
+OAM_TILE_BANK EQU 3
+OAM_OBP_NUM EQU 4 ; non CGB Mode Only
+OAM_X_FLIP EQU 5
+OAM_Y_FLIP EQU 6
+OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
+
+; BG Map attribute flags
+PALETTE_MASK EQU %111
+VRAM_BANK_1 EQU 1 << OAM_TILE_BANK ; $08
+OBP_NUM EQU 1 << OAM_OBP_NUM ; $10
+X_FLIP EQU 1 << OAM_X_FLIP ; $20
+Y_FLIP EQU 1 << OAM_Y_FLIP ; $40
+PRIORITY EQU 1 << OAM_PRIORITY ; $80
+
+; Hardware registers
+rJOYP EQU $ff00 ; Joypad (R/W)
+rSB EQU $ff01 ; Serial transfer data (R/W)
+rSC EQU $ff02 ; Serial Transfer Control (R/W)
+rSC_ON EQU 7
+rSC_CGB EQU 1
+rSC_CLOCK EQU 0
+rDIV EQU $ff04 ; Divider Register (R/W)
+rTIMA EQU $ff05 ; Timer counter (R/W)
+rTMA EQU $ff06 ; Timer Modulo (R/W)
+rTAC EQU $ff07 ; Timer Control (R/W)
+rTAC_ON EQU 2
+rTAC_4096_HZ EQU 0
+rTAC_262144_HZ EQU 1
+rTAC_65536_HZ EQU 2
+rTAC_16384_HZ EQU 3
+rIF EQU $ff0f ; Interrupt Flag (R/W)
+rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W)
+rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W)
+rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W)
+rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only)
+rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W)
+rNR20 EQU $ff15 ; Channel 2 Sweep register (R/W)
+rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W)
+rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W)
+rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W)
+rNR24 EQU $ff19 ; Channel 2 Frequency hi data (R/W)
+rNR30 EQU $ff1a ; Channel 3 Sound on/off (R/W)
+rNR31 EQU $ff1b ; Channel 3 Sound Length
+rNR32 EQU $ff1c ; Channel 3 Select output level (R/W)
+rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W)
+rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W)
+rNR40 EQU $ff1f ; Channel 4 Sweep register (R/W)
+rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W)
+rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W)
+rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W)
+rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Inital (R/W)
+rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W)
+rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W)
+rNR52 EQU $ff26 ; Sound on/off
+rWave_0 EQU $ff30
+rWave_1 EQU $ff31
+rWave_2 EQU $ff32
+rWave_3 EQU $ff33
+rWave_4 EQU $ff34
+rWave_5 EQU $ff35
+rWave_6 EQU $ff36
+rWave_7 EQU $ff37
+rWave_8 EQU $ff38
+rWave_9 EQU $ff39
+rWave_a EQU $ff3a
+rWave_b EQU $ff3b
+rWave_c EQU $ff3c
+rWave_d EQU $ff3d
+rWave_e EQU $ff3e
+rWave_f EQU $ff3f
+rLCDC EQU $ff40 ; LCD Control (R/W)
+rLCDC_BG_PRIORITY EQU 0 ; 0=Off, 1=On
+rLCDC_SPRITES_ENABLE EQU 1 ; 0=Off, 1=On
+rLCDC_SPRITE_SIZE EQU 2 ; 0=8x8, 1=8x16
+rLCDC_BG_TILEMAP EQU 3 ; 0=9800-9BFF, 1=9C00-9FFF
+rLCDC_TILE_DATA EQU 4 ; 0=8800-97FF, 1=8000-8FFF
+rLCDC_WINDOW_ENABLE EQU 5 ; 0=Off, 1=On
+rLCDC_WINDOW_TILEMAP EQU 6 ; 0=9800-9BFF, 1=9C00-9FFF
+rLCDC_ENABLE EQU 7 ; 0=Off, 1=On
+LCDC_DEFAULT EQU (1 << rLCDC_ENABLE) | (1 << rLCDC_WINDOW_TILEMAP) | (1 << rLCDC_WINDOW_ENABLE) | (1 << rLCDC_SPRITES_ENABLE) | (1 << rLCDC_BG_PRIORITY)
+rSTAT EQU $ff41 ; LCDC Status (R/W)
+rSCY EQU $ff42 ; Scroll Y (R/W)
+rSCX EQU $ff43 ; Scroll X (R/W)
+rLY EQU $ff44 ; LCDC Y-Coordinate (R)
+LY_VBLANK EQU 144
+rLYC EQU $ff45 ; LY Compare (R/W)
+rDMA EQU $ff46 ; DMA Transfer and Start Address (W)
+rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only
+rOBP0 EQU $ff48 ; Object Palette 0 Data (R/W) - Non CGB Mode Only
+rOBP1 EQU $ff49 ; Object Palette 1 Data (R/W) - Non CGB Mode Only
+rWY EQU $ff4a ; Window Y Position (R/W)
+rWX EQU $ff4b ; Window X Position minus 7 (R/W)
+rLCDMODE EQU $ff4c
+rKEY1 EQU $ff4d ; CGB Mode Only - Prepare Speed Switch
+rVBK EQU $ff4f ; CGB Mode Only - VRAM Bank
+rBLCK EQU $ff50
+rHDMA1 EQU $ff51 ; CGB Mode Only - New DMA Source, High
+rHDMA2 EQU $ff52 ; CGB Mode Only - New DMA Source, Low
+rHDMA3 EQU $ff53 ; CGB Mode Only - New DMA Destination, High
+rHDMA4 EQU $ff54 ; CGB Mode Only - New DMA Destination, Low
+rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start
+rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port
+rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index
+rBGPI_AUTO_INCREMENT EQU 7 ; increment rBGPI after write to rBGPD
+rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data
+rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index
+rOBPI_AUTO_INCREMENT EQU 7 ; increment rOBPI after write to rOBPD
+rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data
+rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only
+rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank
+rUNKNOWN2 EQU $ff72 ; (00h) - Bit 0-7 (Read/Write)
+rUNKNOWN3 EQU $ff73 ; (00h) - Bit 0-7 (Read/Write)
+rUNKNOWN4 EQU $ff74 ; (00h) - Bit 0-7 (Read/Write) - CGB Mode Only
+rUNKNOWN5 EQU $ff75 ; (8Fh) - Bit 4-6 (Read/Write)
+rUNKNOWN6 EQU $ff76 ; (00h) - Always 00h (Read Only)
+rUNKNOWN7 EQU $ff77 ; (00h) - Always 00h (Read Only)
+rIE EQU $ffff ; Interrupt Enable (R/W)
diff --git a/constants/item_constants.asm b/constants/item_constants.asm
index 0f348047..480ab577 100644
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -75,7 +75,7 @@
const SECRETPOTION ; 43
const S_S_TICKET ; 44
const MYSTERY_EGG ; 45
- const CLEAR_BELL ; 46
+ const ITEM_46 ; 46
const SILVER_WING ; 47
const MOOMOO_MILK ; 48
const QUICK_CLAW ; 49
@@ -120,8 +120,8 @@
const EVERSTONE ; 70
const SPELL_TAG ; 71
const RAGECANDYBAR ; 72
- const GS_BALL ; 73
- const BLUE_CARD ; 74
+ const ITEM_73 ; 73
+ const ITEM_74 ; 74
const MIRACLE_SEED ; 75
const THICK_CLUB ; 76
const FOCUS_BAND ; 77
@@ -134,7 +134,7 @@
const LUCKY_EGG ; 7e
const CARD_KEY ; 7f
const MACHINE_PART ; 80
- const EGG_TICKET ; 81
+ const ITEM_81 ; 81
const LOST_ITEM ; 82
const STARDUST ; 83
const STAR_PIECE ; 84
@@ -280,17 +280,6 @@ ENDM
add_hm WATERFALL ; f9
NUM_HMS EQU const_value - HM01
-add_mt: MACRO
- enum \1_TMNUM
-ENDM
-
- add_mt FLAMETHROWER
- add_mt THUNDERBOLT
- add_mt ICE_BEAM
-NUM_TM_HM_TUTOR EQU __enum__ + -1
-
- const ITEM_FA ; fa
-
USE_SCRIPT_VAR EQU $00
ITEM_FROM_MEM EQU $ff
diff --git a/constants/mart_constants.asm b/constants/mart_constants.asm
index c4834f52..cffdfae0 100755
--- a/constants/mart_constants.asm
+++ b/constants/mart_constants.asm
@@ -4,7 +4,6 @@
const MARTTYPE_BITTER
const MARTTYPE_BARGAIN
const MARTTYPE_PHARMACY
- const MARTTYPE_ROOFTOP
; Marts indexes (see data/items/marts.asm)
const_def
diff --git a/engine/events/forced_movement.asm b/engine/events/forced_movement.asm
new file mode 100755
index 00000000..69f27bfe
--- /dev/null
+++ b/engine/events/forced_movement.asm
@@ -0,0 +1,51 @@
+Script_ForcedMovement::
+ checkcode VAR_FACING
+ ifequal DOWN, .down
+ ifequal UP, .up
+ ifequal LEFT, .left
+ ifequal RIGHT, .right
+ end
+
+.up
+ applymovement PLAYER, .MovementData_up
+ end
+
+.down
+ applymovement PLAYER, .MovementData_down
+ end
+
+.right
+ applymovement PLAYER, .MovementData_right
+ end
+
+.left
+ applymovement PLAYER, .MovementData_left
+ end
+
+.MovementData_up:
+ step_dig 16
+ turn_in DOWN
+ step_dig 16
+ turn_head DOWN
+ step_end
+
+.MovementData_down:
+ step_dig 16
+ turn_in UP
+ step_dig 16
+ turn_head UP
+ step_end
+
+.MovementData_right:
+ step_dig 16
+ turn_in LEFT
+ step_dig 16
+ turn_head LEFT
+ step_end
+
+.MovementData_left:
+ step_dig 16
+ turn_in RIGHT
+ step_dig 16
+ turn_head RIGHT
+ step_end
diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm
new file mode 100755
index 00000000..9770c35b
--- /dev/null
+++ b/engine/events/heal_machine_anim.asm
@@ -0,0 +1,262 @@
+; HealMachineAnim.Jumptable indexes
+ const_def
+ const HEALMACHINESTATE_LOADGFX
+ const HEALMACHINESTATE_PCLOADBALLS
+ const HEALMACHINESTATE_HOFLOADBALLS
+ const HEALMACHINESTATE_PLAYMUSIC
+ const HEALMACHINESTATE_HOFPLAYSFX
+ const HEALMACHINESTATE_FINISH
+
+HealMachineAnim:
+ ; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon.
+ ld a, [wPartyCount]
+ and a
+ ret z
+ ; The location of the healing machine relative to the player is stored in wScriptVar.
+ ; 0: Up and left (Pokemon Center)
+ ; 1: Left (Elm's Lab)
+ ; 2: Up (Hall of Fame)
+ ld a, [wScriptVar]
+ ld [wBuffer1], a
+ ldh a, [rOBP1]
+ ld [wBuffer2], a
+ call .DoJumptableFunctions
+ ld a, [wBuffer2]
+ call DmgToCgbObjPal1
+ ret
+
+.DoJumptableFunctions:
+ xor a
+ ld [wBuffer3], a
+.jumpable_loop
+ ld a, [wBuffer1]
+ ld e, a
+ ld d, 0
+ ld hl, .Pointers
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [wBuffer3]
+ ld e, a
+ inc a
+ ld [wBuffer3], a
+ add hl, de
+ ld a, [hl]
+ cp HEALMACHINESTATE_FINISH
+ jr z, .finish
+ ld hl, .Jumptable
+ rst JumpTable
+ jr .jumpable_loop
+
+.finish
+ ret
+
+.Pointers:
+; entries correspond to HEALMACHINE_* constants
+ dw .Pokecenter
+ dw .ElmLab
+ dw .HallOfFame
+
+healmachineanimseq: MACRO
+rept _NARG
+ db HEALMACHINESTATE_\1
+ shift
+endr
+ENDM
+
+.Pokecenter:
+ healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH
+.ElmLab:
+ healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH
+.HallOfFame:
+ healmachineanimseq LOADGFX, HOFLOADBALLS, HOFPLAYSFX, FINISH
+
+.Jumptable:
+; entries correspond to HEALMACHINESTATE_* constants
+ dw .LoadGFX
+ dw .PC_LoadBallsOntoMachine
+ dw .HOF_LoadBallsOntoMachine
+ dw .PlayHealMusic
+ dw .HOF_PlaySFX
+ dw .dummy_5 ; never encountered
+
+.LoadGFX:
+ call .LoadPalettes
+ ld de, .HealMachineGFX
+ ld hl, vTiles0 tile $7c
+ lb bc, BANK(.HealMachineGFX), 2
+ call Request2bpp
+ ret
+
+.PC_LoadBallsOntoMachine:
+ ld hl, wVirtualOAMSprite32
+ ld de, .PC_ElmsLab_OAM
+ call .PlaceHealingMachineTile
+ call .PlaceHealingMachineTile
+ jr .LoadBallsOntoMachine
+
+.HOF_LoadBallsOntoMachine:
+ ld hl, wVirtualOAMSprite32
+ ld de, .HOF_OAM
+
+.LoadBallsOntoMachine:
+ ld a, [wPartyCount]
+ ld b, a
+.party_loop
+ call .PlaceHealingMachineTile
+ push de
+ ld de, SFX_SECOND_PART_OF_ITEMFINDER
+ call PlaySFX
+ pop de
+ ld c, 30
+ call DelayFrames
+ dec b
+ jr nz, .party_loop
+ ret
+
+.PlayHealMusic:
+ ld de, MUSIC_HEAL
+ call PlayMusic
+ jp .FlashPalettes8Times
+
+.HOF_PlaySFX:
+ ld de, SFX_GAME_FREAK_LOGO_GS
+ call PlaySFX
+ call .FlashPalettes8Times
+ call WaitSFX
+ ld de, SFX_BOOT_PC
+ call PlaySFX
+ ret
+
+.dummy_5
+ ret
+
+.PC_ElmsLab_OAM:
+ dsprite 4, 0, 4, 2, $7c, PAL_OW_TREE | OBP_NUM
+ dsprite 4, 0, 4, 6, $7c, PAL_OW_TREE | OBP_NUM
+ dsprite 4, 6, 4, 0, $7d, PAL_OW_TREE | OBP_NUM
+ dsprite 4, 6, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
+ dsprite 5, 3, 4, 0, $7d, PAL_OW_TREE | OBP_NUM
+ dsprite 5, 3, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
+ dsprite 6, 0, 4, 0, $7d, PAL_OW_TREE | OBP_NUM
+ dsprite 6, 0, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
+
+.HealMachineGFX:
+INCBIN "gfx/overworld/heal_machine.2bpp"
+
+.HOF_OAM:
+ dsprite 7, 4, 10, 1, $7d, PAL_OW_TREE | OBP_NUM
+ dsprite 7, 4, 10, 6, $7d, PAL_OW_TREE | OBP_NUM
+ dsprite 7, 3, 9, 5, $7d, PAL_OW_TREE | OBP_NUM
+ dsprite 7, 3, 11, 2, $7d, PAL_OW_TREE | OBP_NUM
+ dsprite 7, 1, 9, 1, $7d, PAL_OW_TREE | OBP_NUM
+ dsprite 7, 1, 11, 5, $7d, PAL_OW_TREE | OBP_NUM
+
+.LoadPalettes:
+ call IsCGB
+ jr nz, .cgb
+ ld a, %11100000
+ ldh [rOBP1], a
+ ret
+
+.cgb
+ ld hl, .palettes
+ ld de, wOBPal6
+ ld bc, 1 palettes
+ call CopyBytes
+ ld a, $1
+ ldh [hCGBPalUpdate], a
+ ret
+
+.palettes
+ rst $38
+ ld a, a
+ ld a, a
+ ld a, [hl+]
+ rst $38
+ inc b
+ nop
+ nop
+;INCLUDE "gfx/overworld/heal_machine.pal"
+
+.FlashPalettes8Times:
+ ld c, 8
+.palette_loop
+ push bc
+ call .FlashPalettes
+ ld c, 10
+ call DelayFrames
+ pop bc
+ dec c
+ jr nz, .palette_loop
+ ret
+
+.FlashPalettes:
+ call IsCGB
+ jr nz, .go
+ ldh a, [rOBP1]
+ xor %00101000
+ ldh [rOBP1], a
+ ret
+
+.go
+ ld hl, wOBPal6
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+ push de
+ ld c, $3
+.palette_loop_2
+ ld a, [hli]
+ ld e, a
+ ld a, [hld]
+ ld d, a
+ dec hl
+ ld a, d
+ ld [hld], a
+ ld a, e
+ ld [hli], a
+ inc hl
+ inc hl
+ inc hl
+ dec c
+ jr nz, .palette_loop_2
+ pop de
+ dec hl
+ ld a, d
+ ld [hld], a
+ ld a, e
+ ld [hl], a
+
+ ld a, $1
+ ldh [hCGBPalUpdate], a
+ ret
+
+.PlaceHealingMachineTile:
+ push bc
+ ld a, [wBuffer1]
+ bcpixel 2, 4
+ cp HEALMACHINE_ELMS_LAB
+ jr z, .okay
+ bcpixel 0, 0
+
+.okay
+ ld a, [de]
+ add c
+ inc de
+ ld [hli], a ; y
+ ld a, [de]
+ add b
+ inc de
+ ld [hli], a ; x
+ ld a, [de]
+ inc de
+ ld [hli], a ; tile id
+ ld a, [de]
+ inc de
+ ld [hli], a ; attributes
+ pop bc
+ ret
diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm
new file mode 100755
index 00000000..33098f13
--- /dev/null
+++ b/engine/events/whiteout.asm
@@ -0,0 +1,76 @@
+Script_BattleWhiteout::
+ callasm BattleBGMap
+ jump Script_Whiteout
+
+Script_OverworldWhiteout::
+ refreshscreen
+ callasm OverworldBGMap
+
+Script_Whiteout:
+ writetext .WhitedOutText
+ waitbutton
+ special FadeOutPalettes
+ pause 40
+ special HealParty
+ checkflag ENGINE_BUG_CONTEST_TIMER
+ iftrue .bug_contest
+ callasm HalveMoney
+ callasm GetWhiteoutSpawn
+ farscall Script_AbortBugContest
+ special WarpToSpawnPoint
+ newloadmap MAPSETUP_WARP
+ endall
+
+.bug_contest
+ jumpstd bugcontestresultswarp
+
+.WhitedOutText:
+ ; is out of useable #MON! whited out!
+ text_far UnknownText_0x1c0a4e
+ db "@"
+
+OverworldBGMap:
+ call ClearPalettes
+ call FillScreenWithTextboxPal
+ call Function3456
+ call HideSprites
+ call RotateThreePalettesLeft
+ ret
+
+BattleBGMap:
+ ld b, SCGB_BATTLE_GRAYSCALE
+ call GetSGBLayout
+ call SetPalettes
+ ret
+
+HalveMoney:
+; Halve the player's money.
+ ld hl, wMoney
+ ld a, [hl]
+ srl a
+ ld [hli], a
+ ld a, [hl]
+ rra
+ ld [hli], a
+ ld a, [hl]
+ rra
+ ld [hl], a
+ ret
+
+GetWhiteoutSpawn:
+ ld a, [wd9fb]
+ ld d, a
+ ld a, [wd9fc]
+ ld e, a
+
+ ld a, $05
+ ld hl, $5465
+ rst $08
+
+ ld a, c
+ jr c, .yes
+ xor a ; SPAWN_HOME
+
+.yes
+ ld [wceec], a
+ ret
diff --git a/engine/facings.asm b/engine/facings.asm
index 871b0985..a5669c2b 100644
--- a/engine/facings.asm
+++ b/engine/facings.asm
@@ -42,11 +42,8 @@ NUM_FACINGS EQU (FacingsEnd - Facings) / 2
; db y, x, attributes, tile index
; Attributes:
-X_FLIP EQU 1 << OAM_X_FLIP
-Y_FLIP EQU 1 << OAM_Y_FLIP
BEHIND_BG EQU 1 << OAM_PRIORITY
-
Facing00:
Facing02:
Facing24:
diff --git a/engine/sprites_dump.asm b/engine/sprites_dump.asm
deleted file mode 100755
index e69de29b..00000000
--- a/engine/sprites_dump.asm
+++ /dev/null
diff --git a/gfx/overworld/heal_machine.pal b/gfx/overworld/heal_machine.pal
new file mode 100755
index 00000000..9a32250d
--- /dev/null
+++ b/gfx/overworld/heal_machine.pal
@@ -0,0 +1,4 @@
+ RGB 31, 31, 31
+ RGB 21, 21, 21
+ RGB 10, 10, 10
+ RGB 00, 00, 00
diff --git a/gfx/overworld/heal_machine.png b/gfx/overworld/heal_machine.png
new file mode 100755
index 00000000..dbf51348
--- /dev/null
+++ b/gfx/overworld/heal_machine.png
Binary files differ
diff --git a/home.asm b/home.asm
index 2e4424f0..a76992d3 100644
--- a/home.asm
+++ b/home.asm
@@ -730,7 +730,7 @@ Function3456:: ; 3456 (0:3456)
call DelayFrames
ret
-CheckCGB::
+IsCGB::
ld a, [hCGB]
and a
ret
diff --git a/home/tilemap.asm b/home/tilemap.asm
index 4cccbb61..4cccbb61 100644..100755
--- a/home/tilemap.asm
+++ b/home/tilemap.asm
diff --git a/macros.asm b/macros.asm
index 530e417b..ad584206 100644
--- a/macros.asm
+++ b/macros.asm
@@ -12,7 +12,6 @@ INCLUDE "macros/scripts/events.asm"
INCLUDE "macros/scripts/text.asm"
INCLUDE "macros/scripts/movement.asm"
INCLUDE "macros/scripts/trade_anims.asm"
-INCLUDE "macros/scripts/gfx_anims.asm"
INCLUDE "macros/move_effect.asm"
INCLUDE "macros/move_anim.asm"
diff --git a/macros/legacy.asm b/macros/legacy.asm
deleted file mode 100755
index 7192195f..00000000
--- a/macros/legacy.asm
+++ /dev/null
@@ -1,244 +0,0 @@
-; Legacy support for old pokecrystal.
-; Allows porting scripts with as few edits as possible.
-; Legacy support not in this file can be found by looking for the keyword: "LEGACY"
-
-; macros/rst.asm
-callba EQUS "farcall"
-callab EQUS "callfar"
-
-; macros/scripts/audio.asm
-unknownmusic0xde EQUS "sound_duty"
-
-; macros/scripts/events.asm
-
-checkmorn EQUS "checktime MORN"
-checkday EQUS "checktime DAY"
-checknite EQUS "checktime NITE"
-
-jump EQUS "sjump"
-farjump EQUS "farsjump"
-priorityjump EQUS "prioritysjump"
-ptcall EQUS "memcall"
-ptjump EQUS "memjump"
-ptpriorityjump EQUS "stopandsjump"
-ptcallasm EQUS "memcallasm"
-
-if_equal EQUS "ifequal"
-if_not_equal EQUS "ifnotequal"
-if_greater_than EQUS "ifgreater"
-if_less_than EQUS "ifless"
-end_all EQUS "endall"
-
-checkmaptriggers EQUS "checkmapscene"
-domaptrigger EQUS "setmapscene"
-checktriggers EQUS "checkscene"
-dotrigger EQUS "setscene"
-
-faceperson EQUS "faceobject"
-moveperson EQUS "moveobject"
-writepersonxy EQUS "writeobjectxy"
-spriteface EQUS "turnobject"
-objectface EQUS "turnobject"
-applymovement2 EQUS "applymovementlasttalked"
-
-writebyte EQUS "setval"
-addvar EQUS "addval"
-copybytetovar EQUS "readmem"
-copyvartobyte EQUS "writemem"
-checkcode EQUS "readvar"
-writevarcode EQUS "writevar"
-writecode EQUS "loadvar"
-
-MEM_BUFFER_0 EQUS "STRING_BUFFER_3"
-MEM_BUFFER_1 EQUS "STRING_BUFFER_4"
-MEM_BUFFER_2 EQUS "STRING_BUFFER_5"
-
-vartomem EQUS "getnum"
-mapnametotext EQUS "getcurlandmarkname"
-readcoins EQUS "getcoins"
-
-pokenamemem: MACRO
- getmonname \2, \1
-ENDM
-
-itemtotext: MACRO
- getitemname \2, \1
-ENDM
-
-landmarktotext: MACRO
- getlandmarkname \2, \1
-ENDM
-
-trainertotext: MACRO
- gettrainername \3, \1, \2
-ENDM
-
-trainerclassname: MACRO
- gettrainerclassname \2, \1
-ENDM
-
-name: MACRO
- getname \3, \1, \2
-ENDM
-
-stringtotext: MACRO
- getstring \2, \1
-ENDM
-
-readmoney: MACRO
- getmoney \2, \1
-ENDM
-
-RAM2MEM EQUS "getnum"
-loadfont EQUS "opentext"
-loadmenudata EQUS "loadmenu"
-loadmenuheader EQUS "loadmenu"
-writebackup EQUS "closewindow"
-interpretmenu EQUS "_2dmenu"
-interpretmenu2 EQUS "verticalmenu"
-buttonsound EQUS "promptbutton"
-battlecheck EQUS "randomwildmon"
-loadtrainerdata EQUS "loadtemptrainer"
-loadpokedata EQUS "loadwildmon"
-returnafterbattle EQUS "reloadmapafterbattle"
-trainerstatus EQUS "trainerflagaction"
-talkaftercancel EQUS "endifjustbattled"
-talkaftercheck EQUS "checkjustbattled"
-playrammusic EQUS "encountermusic"
-reloadmapmusic EQUS "dontrestartmapmusic"
-resetfuncs EQUS "endall"
-storetext EQUS "battletowertext"
-displaylocation EQUS "landmarktotext"
-givepokeitem EQUS "givepokemail"
-checkpokeitem EQUS "checkpokemail"
-passtoengine EQUS "autoinput"
-verbosegiveitem2 EQUS "verbosegiveitemvar"
-loadbytec2cf EQUS "writeunusedbytebuffer"
-
-; macros/scripts/maps.asm
-
-mapconst: MACRO
- map_const \1, \3, \2
-ENDM
-
-maptrigger EQUS "scene_script"
-
-warp_def: MACRO
- warp_event \2, \1, \4, \3
-ENDM
-
-xy_trigger: MACRO
- coord_event \3, \2, \1, \5
-ENDM
-
-signpost: MACRO
- bg_event \2, \1, \3, \4
-ENDM
-
-person_event: MACRO
-; object_event \3, \2, \1, \4, \5, \6, \7, \8, \9, \10, \11, \12, \13
- db \1, \2 + 4, \3 + 4, \4
- dn \6, \5
- db \7, \8
- shift
- dn \8, \9
- shift
- db \9
- shift
- dw \9
- shift
- dw \9
-ENDM
-
-PERSONTYPE_SCRIPT EQUS "OBJECTTYPE_SCRIPT"
-PERSONTYPE_ITEMBALL EQUS "OBJECTTYPE_ITEMBALL"
-PERSONTYPE_TRAINER EQUS "OBJECTTYPE_TRAINER"
-
-; macros/scripts/movement.asm
-
-show_person EQUS "show_object"
-hide_person EQUS "hide_object"
-remove_person EQUS "remove_object"
-
-turn_head_down EQUS "turn_head DOWN"
-turn_head_up EQUS "turn_head UP"
-turn_head_left EQUS "turn_head LEFT"
-turn_head_right EQUS "turn_head RIGHT"
-turn_step_down EQUS "turn_step DOWN"
-turn_step_up EQUS "turn_step UP"
-turn_step_left EQUS "turn_step LEFT"
-turn_step_right EQUS "turn_step RIGHT"
-slow_step_down EQUS "slow_step DOWN"
-slow_step_up EQUS "slow_step UP"
-slow_step_left EQUS "slow_step LEFT"
-slow_step_right EQUS "slow_step RIGHT"
-step_down EQUS "step DOWN"
-step_up EQUS "step UP"
-step_left EQUS "step LEFT"
-step_right EQUS "step RIGHT"
-big_step_down EQUS "big_step DOWN"
-big_step_up EQUS "big_step UP"
-big_step_left EQUS "big_step LEFT"
-big_step_right EQUS "big_step RIGHT"
-slow_slide_step_down EQUS "slow_slide_step DOWN"
-slow_slide_step_up EQUS "slow_slide_step UP"
-slow_slide_step_left EQUS "slow_slide_step LEFT"
-slow_slide_step_right EQUS "slow_slide_step RIGHT"
-slide_step_down EQUS "slide_step DOWN"
-slide_step_up EQUS "slide_step UP"
-slide_step_left EQUS "slide_step LEFT"
-slide_step_right EQUS "slide_step RIGHT"
-fast_slide_step_down EQUS "fast_slide_step DOWN"
-fast_slide_step_up EQUS "fast_slide_step UP"
-fast_slide_step_left EQUS "fast_slide_step LEFT"
-fast_slide_step_right EQUS "fast_slide_step RIGHT"
-turn_away_down EQUS "turn_away DOWN"
-turn_away_up EQUS "turn_away UP"
-turn_away_left EQUS "turn_away LEFT"
-turn_away_right EQUS "turn_away RIGHT"
-turn_in_down EQUS "turn_in DOWN"
-turn_in_up EQUS "turn_in UP"
-turn_in_left EQUS "turn_in LEFT"
-turn_in_right EQUS "turn_in RIGHT"
-turn_waterfall_down EQUS "turn_waterfall DOWN"
-turn_waterfall_up EQUS "turn_waterfall UP"
-turn_waterfall_left EQUS "turn_waterfall LEFT"
-turn_waterfall_right EQUS "turn_waterfall RIGHT"
-slow_jump_step_down EQUS "slow_jump_step DOWN"
-slow_jump_step_up EQUS "slow_jump_step UP"
-slow_jump_step_left EQUS "slow_jump_step LEFT"
-slow_jump_step_right EQUS "slow_jump_step RIGHT"
-jump_step_down EQUS "jump_step DOWN"
-jump_step_up EQUS "jump_step UP"
-jump_step_left EQUS "jump_step LEFT"
-jump_step_right EQUS "jump_step RIGHT"
-fast_jump_step_down EQUS "fast_jump_step DOWN"
-fast_jump_step_up EQUS "fast_jump_step UP"
-fast_jump_step_left EQUS "fast_jump_step LEFT"
-fast_jump_step_right EQUS "fast_jump_step RIGHT"
-
-step_sleep_1 EQUS "step_sleep 1"
-step_sleep_2 EQUS "step_sleep 2"
-step_sleep_3 EQUS "step_sleep 3"
-step_sleep_4 EQUS "step_sleep 4"
-step_sleep_5 EQUS "step_sleep 5"
-step_sleep_6 EQUS "step_sleep 6"
-step_sleep_7 EQUS "step_sleep 7"
-step_sleep_8 EQUS "step_sleep 8"
-
-; macros/scripts/text.asm
-text_from_ram EQUS "text_ram"
-start_asm EQUS "text_asm"
-deciram EQUS "text_decimal"
-interpret_data EQUS "text_pause"
-limited_interpret_data EQUS "text_dots"
-text_waitbutton EQUS "text_promptbutton"
-link_wait_button EQUS "text_linkpromptbutton"
-text_linkwaitbutton EQUS "text_linkpromptbutton"
-current_day EQUS "text_today"
-text_jump EQUS "text_far"
-
-; macros/scripts/battle_anims.asm
-anim_enemyfeetobj EQUS "anim_battlergfx_2row"
-anim_playerheadobj EQUS "anim_battlergfx_1row"
-anim_clearsprites EQUS "anim_keepsprites"
diff --git a/macros/scripts/gfx_anims.asm b/macros/scripts/gfx_anims.asm
deleted file mode 100755
index 3756481d..00000000
--- a/macros/scripts/gfx_anims.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-; pic + oam animations
-
-frame: MACRO
- db \1
-x = \2
-if _NARG > 2
-rept _NARG + -2
-x = x | (1 << (\3 + 1))
- shift
-endr
-endc
- db x
-ENDM
-
- enum_start $fc
-
- enum delanim_command ; $fc
-delanim: MACRO
-; Removes the object from the screen, as opposed to `endanim` which just stops all motion
- db delanim_command
-ENDM
-
- enum dowait_command ; $fd
-dowait: MACRO
- db dowait_command
- db \1 ; frames
-ENDM
-
- enum dorestart_command ; $fe
-dorestart: MACRO
- db dorestart_command
-ENDM
-
- enum endanim_command ; $ff
-endanim: MACRO
- db endanim_command
-ENDM
-
-
-; Used for pic animations
-__enum__ = $fd
-
- enum dorepeat_command ; $fd
-dorepeat: MACRO
- db dorepeat_command
- db \1 ; command offset to jump to
-ENDM
-
- enum setrepeat_command ; $fe
-setrepeat: MACRO
- db setrepeat_command
- db \1 ; amount of times to repeat
-ENDM
diff --git a/main.asm b/main.asm
index 765db85c..4cfa848f 100644
--- a/main.asm
+++ b/main.asm
@@ -624,9 +624,9 @@ INCLUDE "engine/overworld/time.asm"
INCLUDE "engine/learn_tm.asm"
INCLUDE "engine/namingscreen.asm"
INCLUDE "engine/events/misc_scripts.asm"
-HealMachineAnim:
- dr $126fd, $12947
-
+INCLUDE "engine/events/heal_machine_anim.asm"
+INCLUDE "engine/events/whiteout.asm"
+INCLUDE "engine/events/forced_movement.asm"
ItemfinderFunction:
dr $12947, $12e33