;--------------------Draygon Destruction Timer Modifications--------------------------------- ;-------------------------------Version 3.1 ------------------------------------------------- ;Code by FullOfFail, JAM, Scyzer, Smiley, Jathys, Mon732, and PJBoy. ;Other code featured by Black Falcon, and dewhi100 ;Special thanks to Insane Firebat for helping me figure out how to use events as conditions ;Modifications by OmegaDragnet9 ;------------------------------Explanation of ASM-------------------------------------------- ;Zebes Timer lengths are 100% customizable now; points to unused location in RAM. ;For unsetting the alarm and unsetting event 0E, there are two setup ASM scripts. ;Use Room ASM for triggering the alarm, use Setup ASM for unsetting the alarm. ;In most alarms, I have deliberately set event 0E and included ;a JSR to a Vanilla earthquake script. ;This is so you don't watch Ceres explode if you fail the escape sequence. ;-------------------------Special Ceres Script:----------------------------------------------- ;!CeresAlarm is intended purely for use in Ceres station, ;and is triggered by killing all enemies in the room. ;It engages all the special Ceres pandemonium that Ridley would otherwise trigger. ;----------------------------What's New in 3.1------------------------------------------------ ;Not much changed, except there were some issues that were keeping it from assembling in ASAR. ;Additionally, I had a section of freespace that was bad. ;----------------------------What's New in 3.0------------------------------------------------ ;Designed to use less space in Bank $8F. ;Chances are, there might be really just one script that will work in your hack. ;Feel free to comment out whatever doesn't work for you. ;-------------------------------From 2.0------------------------------------------------------ ;Zebes Timer length points to location $0A02 in RAM, instead of a specific number. ;Each individual Destruction Timer script can have its own timer length now. ;Included Timers for area mini-bosses as well as for Torizos. ;Included a special timer for the Mother Brain. ;(If you want several Fusion/Ascent-style escapes long before the final one.) ;-----------------------------------Defines-------------------------------------------------- lorom !CeresTimerLength = #$0100 ;1 minute, zero seconds !ZebesTimerLength = $0A02 ;Unused spot in RAM !Ceres = #$0001 ;Triggers Ceres alarm !Zebes = #$0002 ;Triggers Zebes alarm !RoomShake = $C946 !RoomShakeExplosion = $C124 ;-----------------FREESPACE DEFINES SECTION--------------------------------------------------- ;THIS IS YOUR RESPONSIBILITY TO MANAGE. ;I ERRONEOUSLY LEFT IN CONFLICTING FREESPACE LOCATIONS IN 3.0. ;I HIGHLY RECOMMEND YOU COMMENT OUT WHATEVER SCRIPTS YOU DON'T USE ;IN THE INTEREST OF SAVING SPACE IN BANK $8F. ;KEEP BACKUPS OF THIS FILE UNMODIFIED IN CASE STUFF GOES WRONG FROM MAKING CHANGES. !ZebesEnemiesNeeded = $8FF180 ;Room ASM !ZebesAreaBoss = $8FE9B0 ;Room ASM !ZebesEventTrigger = $8FF830 ;Room ASM !ZebesMiniBoss = $8FF580 ;Room ASM !ZebesTorizo = $8FF5E0 ;Room ASM !ZebesMotherBrain = $8FF640 ;Room ASM !ZebesTimerUnset = $8FF770 ;Setup ASM !CeresTimerUnset = $8FF790 ;Setup ASM !CeresAlarm = $8FF7C0 ;Room ASM !CommonScripts = $8FF800 ;Not Room ASM or Setup ASM. This is what the Zebes Timers JSR to. ;----------------------------Timer Lengths--------------------------------------------------- ;Ceres Timer Length: (Thanks Amoeba for showing this in Discord) org $809E0D LDA !CeresTimerLength ;1 minute, zero seconds ;---Zebes Timer Length ;---Points to Unused space in RAM ;---Entirely customizable on a script by script basis. org $809E20 LDA !ZebesTimerLength ;3 minutes, zero seconds in Vanilla ;-------------------------------------------------------------------------------------------- ;-----------------------THE ESCAPE TIMER SCRIPTS--------------------------------------------- ;-------------------------------------------------------------------------------------------- ;THIS SECTION IS DESIGNED SO THAT YOU COMMENT OUT WHATEVER YOU DON'T USE. ;IN FACT, YOU SHOULD REALLY DO THAT AS THIS TAKES UP SPACE IN BANK $8F. ;DON'T COMMENT OUT THE SCRIPT FROM LINE 292 to 318, AS THEY ALL DEPEND ON IT. ;--------------------Enemies Needed Matches Enemies Killed Zebes Timer----------------------- org !ZebesEnemiesNeeded ;Set to "Room ASM" EnemiesNeeded: ;---Enemies Needed Matches Enemies Killed LDA $0E50 ;\ CMP $0E52 ; \ Enemies needed matches enemies killed; Thanks to dewhi100's Better Room Clear Event PLM BNE + ;/ ;---ChangeTimer LDA #$0140 STA !ZebesTimerLength ;---ChangeMusic ;LDA #$0000 : JSL $808FC1 ;LDA #$FF24 : JSL $808FC1 ;LDA #$0007 : JSL $808FC1 ;---Commonly Reused Scripts JSR ChangeMusic ;JSR ZebesSet + RTS ;---------------------Area Boss Destroyed Zebes Timer---------------------------------------- org !ZebesAreaBoss ;Room ASM AreaBoss: ;---CheckBit LDX $079F : LDA $7ED828,X : BIT #$0001 : BEQ + ;---ChangeTimer LDA #$0220 STA !ZebesTimerLength ;---ChangeMusic ;LDA #$0000 : JSL $808FC1 ;LDA #$FF24 : JSL $808FC1 ;LDA #$0007 : JSL $808FC1 ;---Commonly Reused Scripts JSR ChangeMusic ;JSR ZebesSet + RTS ;---------------------Event Trigger Alarm Zebes Timer---------------------------------------- ;Ideally this can be triggered with Benox50's Extended Event PLM org !ZebesEventTrigger ;Room ASM EventTrigger: ;---Event Check LDA #$000E : JSL $808233 : BCS + ;---ChangeTimer LDA #$0300 STA !ZebesTimerLength ;---ChangeMusic ;LDA #$0000 : JSL $808FC1 ;LDA #$FF24 : JSL $808FC1 ;LDA #$0007 : JSL $808FC1 ;---Commonly Reused Scripts JSR ChangeMusic ;JSR ZebesSet + RTS ;-----------------------Zebes Miniboss Timer------------------------------------------------- org !ZebesMiniBoss ;Set to "Room ASM" AreaMiniboss: ;---CheckBit LDX $079F : LDA $7ED828,X : BIT #$0002 : BEQ + ;---ChangeTimer LDA #$0500 STA !ZebesTimerLength ;---ChangeMusic ;LDA #$0000 : JSL $808FC1 ;LDA #$FF24 : JSL $808FC1 ;LDA #$0007 : JSL $808FC1 ;---Commonly Reused Scripts JSR ChangeMusic ;JSR ZebesSet + RTS ;-------------------------Zebes Torizo Timer------------------------------------------------- org !ZebesTorizo ;Room ASM ZebesTorizo: ;---CheckBit LDX $079F : LDA $7ED828,X : BIT #$0004 : BEQ + ;---ChangeTimer LDA #$0120 STA !ZebesTimerLength ;--ChangeMusic ;LDA #$0000 : JSL $808FC1 ;LDA #$FF24 : JSL $808FC1 ;LDA #$0007 : JSL $808FC1 ;---Commonly Reused Scripts JSR ChangeMusic ;JSR ZebesSet + RTS ;-----------------------------Zebes Mother Brain Timer------------------------------------ ;Specific Miniboss Timer for Mother Brain (does not change music, which would conflict with Vanilla routine.) org !ZebesMotherBrain ;Room ASM MotherBrain: ;---CheckBit LDX $079F : LDA $7ED828,X : BIT #$0002 : BEQ + ;---ChangeTimer LDA #$0300 STA !ZebesTimerLength ;---Commonly Reused Scripts JSR ChangeMusic ;JSR ZebesSet + RTS ;----------------------Zebes Timer Unset------------------------------------------------ org !ZebesTimerUnset ;Setup ASM AreaBossUnsetZebes: ;---UnsetTimer LDA !Zebes : STZ $0943 ;originally STA, JAM suggested this change. This unsets Timer. LDA #$E0E6 : STA $0A5A ;---ClearFX2Pointer STZ $07DF ;--ClearEvent0E LDA #$000E : JSL $808212 ;Clears Event 0E. Saves me from having to use Event PLM RTS ;-----------------------Ceres Timer Unset----------------------------------------------- org !CeresTimerUnset ;Setup ASM AreaBossUnsetCeres: ;---UnsetTimer LDA !Ceres : STZ $0943 ;originally STA, JAM suggested this change. This unsets Timer. LDA #$E0E6 : STA $0A5A ;---ClearFX2Pointer STZ $07DF ;---ClearEvent0E LDA #$000E : JSL $808212 ;Clears Event 0E. Saves me from having to use Event PLM RTS ;-----------------------Ceres Alarm---------------------------------------------------- org !CeresAlarm CeresAlarm: ;---EnemiesNeeded LDA $0E50 ;\ CMP $0E52 ; \ Enemies needed matches enemies killed BNE + ;/ ;---BossBit LDA #$0001 : LDX #$000C : JSL $8081A6 ;Sets Boss bit in Ceres (Ridley escaped) Borrowed from Black Falcon's Ceres Skip ;---ChangeMusic LDA #$0000 : JSL $808FC1 LDA #$FF24 : JSL $808FC1 LDA #$0007 : JSL $808FC1 ;---LoadTimer LDX $0330 LDA #$0400 : STA $D0,X LDA #$C000 : STA $D2,X LDA #$B0B0 : STA $D4,X LDA #$7E00 : STA $D5,X TXA : CLC : ADC #$0007 : STA $0330 ;---RunTimer LDA !Ceres : STA $0943 LDA #$E0E6 : STA $0A5A ;---ClearFX2Pointer STZ $07DF ;---RoomShake JSR !RoomShakeExplosion ;---CeresEscapeSequenceInRAM LDA #$0002 : STA $093F + RTS ;-----------------------Commonly Reused Script----------------------------------------------- org !CommonScripts ChangeMusic: LDA #$0000 : JSL $808FC1 LDA #$FF24 : JSL $808FC1 LDA #$0007 : JSL $808FC1 ZebesSet: ;---LoadTimerGFX LDX $0330 LDA #$0400 : STA $D0,X LDA #$C000 : STA $D2,X LDA #$B0B0 : STA $D4,X LDA #$7E00 : STA $D5,X TXA : CLC : ADC #$0007 : STA $0330 ;---RunTimer LDA !Zebes : STA $0943 ;Change to LDA #$0001 for Ceres Timer LDA #$E0E6 : STA $0A5A ;---SetEvent0E ;Borrowed from JAM's version of this same ASM. LDA #$000E : JSL $8081FA ;--ClearFX2Pointer STZ $07DF ;--RoomShake JSR !RoomShakeExplosion ;--End RTS ;----------------------Room ASM for Rest of Escape Rooms------------------------------ ;Check out Vanilla rooms in escape route for Room ASM and Setup ASM ;One room I have Init ASM "0xC91F" ;Main ASM "0xC124"