summaryrefslogtreecommitdiff
path: root/event
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2015-11-11 23:38:57 -0500
committerPikalaxALT <PikalaxALT@gmail.com>2015-11-11 23:38:57 -0500
commit2ffcb4b49036b8bcd9a37cdc9305f7ee5567fe6c (patch)
tree0c9fe148771ade8ef1948852722b95b378cbe46f /event
parent91068077f05afbbfd6571ceadada2c03ac7c8038 (diff)
More splits; map setup labels
Diffstat (limited to 'event')
-rwxr-xr-xevent/basement_key.asm34
-rwxr-xr-xevent/card_key.asm39
-rwxr-xr-xevent/poisonstep.asm162
-rwxr-xr-xevent/sacred_ash.asm74
-rwxr-xr-xevent/squirtbottle.asm51
-rwxr-xr-xevent/sweet_scent.asm75
-rwxr-xr-xevent/whiteout.asm2
7 files changed, 436 insertions, 1 deletions
diff --git a/event/basement_key.asm b/event/basement_key.asm
new file mode 100755
index 000000000..605b2af88
--- /dev/null
+++ b/event/basement_key.asm
@@ -0,0 +1,34 @@
+_BasementKey: ; 507b4
+; Are we even in the right map to use this?
+ ld a, [MapGroup]
+ cp GROUP_WAREHOUSE_ENTRANCE
+ jr nz, .nope
+
+ ld a, [MapNumber]
+ cp MAP_WAREHOUSE_ENTRANCE
+ jr nz, .nope
+; Are we on the tile in front of the door?
+ call GetFacingTileCoord
+ ld a, d
+ cp 22
+ jr nz, .nope
+ ld a, e
+ cp 10
+ jr nz, .nope
+; Let's use the Basement Key
+ ld hl, .BasementKeyScript
+ call QueueScript
+ ld a, 1
+ ld [wd0ec], a
+ ret
+
+.nope
+ ld a, $0
+ ld [wd0ec], a
+ ret
+; 507e1
+
+.BasementKeyScript: ; 0x507e1
+ loadmovesprites
+ farjump BasementDoorScript
+; 0x507e6
diff --git a/event/card_key.asm b/event/card_key.asm
new file mode 100755
index 000000000..b442ba184
--- /dev/null
+++ b/event/card_key.asm
@@ -0,0 +1,39 @@
+_CardKey: ; 50779
+; Are we even in the right map to use this?
+ ld a, [MapGroup]
+ cp GROUP_RADIO_TOWER_3F
+ jr nz, .nope
+
+ ld a, [MapNumber]
+ cp MAP_RADIO_TOWER_3F
+ jr nz, .nope
+; Are we facing the slot?
+ ld a, [PlayerDirection]
+ and $c
+ cp OW_UP
+ jr nz, .nope
+
+ call GetFacingTileCoord
+ ld a, d
+ cp 18
+ jr nz, .nope
+ ld a, e
+ cp 6
+ jr nz, .nope
+; Let's use the Card Key.
+ ld hl, .CardKeyScript
+ call QueueScript
+ ld a, $1
+ ld [wd0ec], a
+ ret
+
+.nope
+ ld a, $0
+ ld [wd0ec], a
+ ret
+; 507af
+
+.CardKeyScript: ; 0x507af
+ loadmovesprites
+ farjump MapRadioTower3FSignpost2Script
+; 0x507b4
diff --git a/event/poisonstep.asm b/event/poisonstep.asm
new file mode 100755
index 000000000..1fafd63a5
--- /dev/null
+++ b/event/poisonstep.asm
@@ -0,0 +1,162 @@
+DoPoisonStep:: ; 505da
+ ld a, [PartyCount]
+ and a
+ jr z, .no_faint
+
+ xor a
+ ld c, 7
+ ld hl, EngineBuffer1
+.loop_clearEngineBuffer1
+ ld [hli], a
+ dec c
+ jr nz, .loop_clearEngineBuffer1
+
+ xor a
+ ld [CurPartyMon], a
+.loop_check_poison
+ call .DamageMonIfPoisoned
+ jr nc, .not_poisoned
+; the output flag is stored in c, copy it to the ([CurPartyMon] + 2)nd EngineBuffer
+; and set the corresponding flag in EngineBuffer1
+ ld a, [CurPartyMon]
+ ld e, a
+ ld d, 0
+ ld hl, EngineBuffer2
+ add hl, de
+ ld [hl], c
+ ld a, [EngineBuffer1]
+ or c
+ ld [EngineBuffer1], a
+
+.not_poisoned
+ ld a, [PartyCount]
+ ld hl, CurPartyMon
+ inc [hl]
+ cp [hl]
+ jr nz, .loop_check_poison
+
+ ld a, [EngineBuffer1]
+ and %10
+ jr nz, .someone_has_fainted
+ ld a, [EngineBuffer1]
+ and %01
+ jr z, .no_faint
+ call .PlayPoisonSFX
+ xor a
+ ret
+
+.someone_has_fainted
+ ld a, BANK(.Script_MonFaintedToPoison)
+ ld hl, .Script_MonFaintedToPoison
+ call CallScript
+ scf
+ ret
+
+.no_faint
+ xor a
+ ret
+; 5062e
+
+.DamageMonIfPoisoned: ; 5062e
+; check if mon is poisoned, return if not
+ ld a, MON_STATUS
+ call GetPartyParamLocation
+ ld a, [hl]
+ and 1 << PSN
+ ret z
+
+; check if mon is already fainted, return if so
+ ld a, MON_HP
+ call GetPartyParamLocation
+ ld a, [hli]
+ ld b, a
+ ld c, [hl]
+ or c
+ ret z
+
+; do 1 HP damage
+ dec bc
+ ld [hl], c
+ dec hl
+ ld [hl], b
+
+; check if mon has fainted as a result of poison damage
+ ld a, b
+ or c
+ jr nz, .not_fainted
+
+; the mon has fainted, reset its status, set carry, and return %10
+ ld a, MON_STATUS
+ call GetPartyParamLocation
+ ld [hl], 0
+ ld c, %10
+ scf
+ ret
+
+.not_fainted
+; set carry and return %01
+ ld c, %01
+ scf
+ ret
+; 50658
+
+.PlayPoisonSFX: ; 50658
+ ld de, SFX_POISON
+ call PlaySFX
+ ld b, $2
+ predef Functioncbcdd
+ call DelayFrame
+ ret
+; 50669
+
+.Script_MonFaintedToPoison: ; 50669
+ callasm .PlayPoisonSFX
+ loadfont
+ callasm .CheckWhitedOut
+ iffalse .whiteout
+ loadmovesprites
+ end
+; 50677
+
+.whiteout: ; 50677
+ farjump Script_OverworldWhiteout
+; 5067b
+
+.CheckWhitedOut: ; 5067b
+ xor a
+ ld [CurPartyMon], a
+ ld de, EngineBuffer2
+.party_loop
+ push de
+ ld a, [de]
+ and %10
+ jr z, .mon_not_fainted
+ ld c, HAPPINESS_POISONFAINT
+ callba ChangeHappiness
+ callba GetPartyNick
+ ld hl, .PoisonFaintText
+ call PrintText
+
+.mon_not_fainted
+ pop de
+ inc de
+ ld hl, CurPartyMon
+ inc [hl]
+ ld a, [PartyCount]
+ cp [hl]
+ jr nz, .party_loop
+ predef CheckPlayerPartyForFitPkmn
+ ld a, d
+ ld [ScriptVar], a
+ ret
+; 506b2
+
+.PoisonFaintText: ; 506b2
+ text_jump UnknownText_0x1c0acc
+ db "@"
+; 506b7
+
+.PoisonWhiteOutText: ; 506b7
+ text_jump UnknownText_0x1c0ada
+ db "@"
+; 506bc
diff --git a/event/sacred_ash.asm b/event/sacred_ash.asm
new file mode 100755
index 000000000..00b80bb46
--- /dev/null
+++ b/event/sacred_ash.asm
@@ -0,0 +1,74 @@
+
+_SacredAsh: ; 507e6
+ ld a, $0
+ ld [wd0ec], a
+ call CheckAnyFaintedMon
+ ret nc
+
+ ld hl, SacredAshScript
+ call QueueScript
+ ld a, $1
+ ld [wd0ec], a
+ ret
+; 507fb
+
+CheckAnyFaintedMon: ; 507fb
+ ld de, PARTYMON_STRUCT_LENGTH
+ ld bc, PartySpecies
+ ld hl, PartyMon1HP
+ ld a, [PartyCount]
+ and a
+ ret z
+
+.loop
+ push af
+ push hl
+ ld a, [bc]
+ inc bc
+ cp EGG
+ jr z, .next
+
+ ld a, [hli]
+ or [hl]
+ jr z, .done
+
+.next
+ pop hl
+ add hl, de
+ pop af
+ dec a
+ jr nz, .loop
+ xor a
+ ret
+
+.done
+ pop hl
+ pop af
+ scf
+ ret
+; 50821
+
+SacredAshScript: ; 0x50821
+ special HealParty
+ reloadmappart
+ playsound SFX_WARP_TO
+ special FadeOutPalettes
+ special FadeInPalettes
+ special FadeOutPalettes
+ special FadeInPalettes
+ special FadeOutPalettes
+ special FadeInPalettes
+ waitbutton
+ writetext UnknownText_0x50845
+ playsound SFX_CAUGHT_MON
+ waitbutton
+ closetext
+ loadmovesprites
+ end
+; 0x50845
+
+UnknownText_0x50845: ; 0x50845
+ ; 's #MON were all healed!
+ text_jump UnknownText_0x1c0b65
+ db "@"
+; 0x5084a
diff --git a/event/squirtbottle.asm b/event/squirtbottle.asm
new file mode 100755
index 000000000..b59cdc3f1
--- /dev/null
+++ b/event/squirtbottle.asm
@@ -0,0 +1,51 @@
+_Squirtbottle: ; 50730
+ ld hl, UnknownScript_0x5073c
+ call QueueScript
+ ld a, $1
+ ld [wd0ec], a
+ ret
+; 5073c
+
+UnknownScript_0x5073c: ; 0x5073c
+ reloadmappart
+ special UpdateTimePals
+ callasm Function50753
+ iffalse UnknownScript_0x5074b
+ farjump WateredWeirdTreeScript
+; 0x5074b
+
+UnknownScript_0x5074b: ; 0x5074b
+ jumptext UnknownText_0x5074e
+; 0x5074e
+
+UnknownText_0x5074e: ; 0x5074e
+ ; sprinkled water. But nothing happened…
+ text_jump UnknownText_0x1c0b3b
+ db "@"
+; 0x50753
+
+Function50753: ; 50753
+ ld a, [MapGroup]
+ cp GROUP_ROUTE_36
+ jr nz, .asm_50774
+
+ ld a, [MapNumber]
+ cp MAP_ROUTE_36
+ jr nz, .asm_50774
+
+ callba GetFacingObject
+ jr c, .asm_50774
+
+ ld a, d
+ cp $17
+ jr nz, .asm_50774
+
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+
+.asm_50774
+ xor a
+ ld [ScriptVar], a
+ ret
+; 50779
diff --git a/event/sweet_scent.asm b/event/sweet_scent.asm
new file mode 100755
index 000000000..ebe0d4266
--- /dev/null
+++ b/event/sweet_scent.asm
@@ -0,0 +1,75 @@
+SweetScentFromMenu: ; 506bc
+ ld hl, UnknownScript_0x506c8
+ call QueueScript
+ ld a, $1
+ ld [wd0ec], a
+ ret
+; 506c8
+
+UnknownScript_0x506c8: ; 0x506c8
+ reloadmappart
+ special UpdateTimePals
+ callasm GetPartyNick
+ writetext UnknownText_0x50726
+ closetext
+ callasm SweetScentEncounter
+ iffalse UnknownScript_0x506e9
+ checkflag ENGINE_BUG_CONTEST_TIMER
+ iftrue UnknownScript_0x506e5
+ battlecheck
+ startbattle
+ returnafterbattle
+ end
+; 0x506e5
+
+UnknownScript_0x506e5: ; 0x506e5
+ farjump BugCatchingContestBattleScript
+; 0x506e9
+
+UnknownScript_0x506e9: ; 0x506e9
+ writetext UnknownText_0x5072b
+ closetext
+ loadmovesprites
+ end
+; 0x506ef
+
+SweetScentEncounter: ; 506ef
+ callba CanUseSweetScent
+ jr nc, .no_battle
+ ld hl, StatusFlags2
+ bit 2, [hl]
+ jr nz, .not_in_bug_contest
+ callba GetMapEncounterRate
+ ld a, b
+ and a
+ jr z, .no_battle
+ callba ChooseWildEncounter
+ jr nz, .no_battle
+ jr .start_battle
+
+.not_in_bug_contest
+ callba ChooseWildEncounter_BugContest
+
+.start_battle
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+
+.no_battle
+ xor a
+ ld [ScriptVar], a
+ ld [BattleType], a
+ ret
+; 50726
+
+UnknownText_0x50726: ; 0x50726
+ ; used SWEET SCENT!
+ text_jump UnknownText_0x1c0b03
+ db "@"
+; 0x5072b
+
+UnknownText_0x5072b: ; 0x5072b
+ ; Looks like there's nothing here…
+ text_jump UnknownText_0x1c0b1a
+ db "@"
+; 0x50730
diff --git a/event/whiteout.asm b/event/whiteout.asm
index 6cf6976cf..5cc0a07f9 100755
--- a/event/whiteout.asm
+++ b/event/whiteout.asm
@@ -10,7 +10,7 @@ Script_OverworldWhiteout:: ; 0x124c8
Script_Whiteout: ; 0x124ce
writetext .WhitedOutText
closetext
- special FadeBlackBGMap
+ special FadeOutPalettes
pause 40
special HealParty
checkflag ENGINE_BUG_CONTEST_TIMER