Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ===============================================================
- ; ---------------------------------------------------------------
- ; SYZ 3 boss
- ; ---------------------------------------------------------------
- camXbase = $2C00
- camYbase = $500
- FontBase = $7000
- FontTBase = (FontBase/$20)
- CharBase = FontTBase-' '
- WindowWidth = 32
- WindowHeight = 15
- WindowXpos = 4
- WindowYpos = 4
- ; ---------------------------------------------------------------
- xpos = 8
- ypos = $C
- timer = $38
- gen_ok = $1D ; b Set, when generator finishes work
- btn_ev = $1E ; b Buttons routine on press event
- btn_id = $1F ; b Id of the button pressed
- var1 = $30
- var2 = $32
- var3 = $34
- obj_SYZ3boss:
- ; Load buttons
- move.b #0,btn_ev(a0)
- moveq #2,d6 ; do 3 objects
- move.w #camXbase+$60,d1 ; d1 = start X-pos
- moveq #1,d2 ; d2 = button id
- moveq #120,d3 ; d3 = initial timer
- @CreateButton:
- jsr SingleObjLoad2
- move.b #$19,(a1)
- move.l #obj_SYZ3boss_Button,obj(a1)
- move.b d2,btn_id(a1)
- addq.b #1,d2
- move.w d1,xpos(a1)
- move.w #camYbase-8,ypos(a1)
- move.w a0,parent(a1)
- move.w d3,timer(a1)
- addi.w #60,d3
- addi.w #$40,d1
- dbf d6,@CreateButton
- move.l #@WaitCamera,obj(a0)
- rts
- ; Wait until Sonic aproaches boss arena
- @WaitCamera:
- cmpi.w #camXbase,($FFFFF700).w
- bcc.s @SetFadeOut
- rts
- ; Fade out music
- @SetFadeOut:
- ori.w #$8000,($FFFFD002).w ; send Sonic to Hi-Plane!
- move.l #@WaitFadeOut,obj(a0)
- move.b #4,($FFFFD040+$24).w ; set HUD to hide
- move.w #5*60,timer(a0)
- ; Prepare non-noob palete
- moveq #3,d0
- jsr PalLoad1_NonNoob
- moveq #8,d0
- jsr PalLoad1_NonNoob
- move.w #$3F,($FFFFF626).w
- moveq #$FFFFFFE0,d0
- jmp PlaySound
- ; Wait some time
- @WaitFadeOut:
- subq.w #1,timer(a0)
- beq.s @LoadBoss
- ; Convert palette to non-noob colors!
- move.b ($FFFFFE05).w,d0
- andi.b #%111,d0
- bne.s @0
- move.w a0,-(sp)
- jsr Pal_FadeIn
- move.w (sp)+,a0
- @0 rts
- @LoadBoss:
- move.l #SYZ3boss_WindowProc,obj(a0)
- move.b #4,routine2(a1)
- move.w #camXbase+160,xpos(a1)
- move.w #camYbase-$40,ypos(a1)
- move.w xpos(a1),xpos2(a1)
- move.w ypos(a1),ypos2(a1)
- move.w #$300,yvel(a1)
- move.b #8,hits(a1)
- move.w a1,parent(a0)
- move.l #Nem_Eggman,d0
- move.w #$8000,d1
- jsr SendToPLC
- ; Load font
- vram (FontBase)
- lea MsgFont,a1
- moveq #95,d0 ; number of tiles
- moveq #1,d1 ; 0 mask
- moveq #6,d2 ; 1 mask
- jsr Load1bpp
- ; Setup appear event
- move.b #0,routine(a0)
- move.w #19,var1(a0)
- move.w #20,var2(a0)
- move.w #16,var3(a0)
- move.w #2,timer(a0)
- ; Play boss tuna
- moveq #$FFFFFF8C,d0
- jmp PlaySound
- ; ===============================================================
- ; ---------------------------------------------------------------
- ; Window Processing Routine
- ; ---------------------------------------------------------------
- SYZ3boss_WindowProc:
- move #$2700,sr ; disable interrupta
- lea VDP_Ctrl,a6
- lea -4(a6),a5
- moveq #0,d0
- move.b routine(a0),d0
- move.w @Routines(pc,d0.w),d0
- jsr @Routines(pc,d0.w)
- move #$2300,sr ; enabla interrupta
- rts
- ; ---------------------------------------------------------------
- @Routines:
- dc.w WP_IntroDraw-@Routines ; 0
- dc.w WP_IntroDraw2-@Routines ; 2
- dc.w WP_DrawMessage-@Routines ; 4 Draws intro message
- dc.w WP_WaitAnwser-@Routines ; 6 Waits for button press
- dc.w WP_LoadFirstQuestion-@Routines ; 8 Load first question
- dc.w WP_DrawMessage-@Routines ; $A Draw the question
- dc.w WP_WaitAnwser-@Routines ; $C Waits for the answer
- dc.w WP_AnimateChoice-@Routines ; $E Selected answer blinks
- dc.w WP_WaitGenerator-@Routines ; $10 Wait until generator finishes work
- dc.w WP_LoadNextQuestion-@Routines ; $12 Load next question
- dc.w WP_DrawMessage-@Routines ; $14 Cutscene dialog
- dc.w WP_LoadCheatsMesssage-@Routines ; $16
- dc.w WP_DrawMessage-@Routines ; $18 Display cheats
- dc.w WP_EnterCheat-@Routines ; $1A Enter cheat
- dc.w WP_DrawMessage-@Routines ; $1C Display victory message!
- dc.w WP_EndBoss-@Routines ; $1E And that concludes the boss!
- ; ---------------------------------------------------------------
- ; Draws the first line
- ; ---------------------------------------------------------------
- WP_IntroDraw:
- subq.w #1,timer(a0) ; timer time???
- bne.s @Return ; fuck no
- move.w #2,timer(a0) ; reset timer
- move.w #CharBase+' ',d3
- ; Draw left dir
- move.w var1(a0),d1 ; xpos
- subq.w #1,var1(a0)
- moveq #4,d2 ; ypos
- bsr CalcCellAddr
- move.l d0,(a6)
- move.w d3,(a5) ; draw black tila
- ; Draw right dir
- move.w var2(a0),d1 ; x pos
- addq.w #1,var2(a0)
- moveq #4,d2 ; y pos
- bsr CalcCellAddr
- move.l d0,(a6)
- move.w d3,(a5) ; draw black tila
- ; Check if we should finish
- subq.w #1,var3(a0)
- beq.s @GoTo_NextAction
- @Return:
- rts
- ; So yeah, next fucking actia
- @GoTo_NextAction:
- addq.b #2,routine(a0)
- move.w #WindowYpos+1,var1(a0)
- move.w #3,timer(a0)
- ; ---------------------------------------------------------------
- ; Draws the rest lines
- ; ---------------------------------------------------------------
- WP_IntroDraw2:
- subq.w #1,timer(a0)
- bne.s @Return
- move.w #2,timer(a0) ; reset timera
- ; Draw the line
- move.w var1(a0),d3 ; d3 = Current Line
- addq.w #1,var1(a0) ; increase line
- moveq #WindowWidth-1,d4
- move.w #CharBase+' ',d5
- @0 move.w d3,d2 ; d2 = ypos
- moveq #WindowXpos,d1
- add.w d4,d1 ; d1 = xpos
- bsr CalcCellAddr
- move.l d0,(a6)
- move.w d5,(a5)
- dbf d4,@0 ; do for all window width, epta
- ; Check if this is the last line to draw
- cmpi.w #WindowYpos+WindowHeight,d3
- beq.s @Goto_NextAction
- @Return:
- rts
- @Goto_NextAction:
- addq.b #2,routine(a0) ; next routine fuck yeah
- ; ---------------------------------------------------------------
- ; Draws the message
- ; ---------------------------------------------------------------
- char_x = $30 ; w
- char_y = $32 ; w
- charpos = $34 ; w
- msg_id = $36 ; b
- moveq #0,d0
- move.b d0,msg_id(a0)
- bra WP_LoadMessage
- WP_DrawMessage:
- subq.w #1,timer(a0)
- bne.s @Return
- move.w #2,timer(a0)
- lea MessagesList,a1
- adda.w charpos(a0),a1
- addq.w #1,charpos(a0)
- moveq #0,d3
- move.b (a1),d3 ; load char
- beq.s @NextLine ; -- break flag!
- bmi.s @CheckFlags ; -- just flag!
- addi.w #CharBase,d3
- move.w char_x(a0),d1
- move.w char_y(a0),d2
- bsr CalcCellAddr
- move.l d0,(a6)
- move.w d3,(a5)
- addq.w #1,char_x(a0) ; increase x-pos
- moveq #$FFFFFFBA,d0
- jmp PlaySound_Special
- @CheckFlags:
- addq.b #1,d3
- beq.s @GoTo_NextAction
- andi.w #$7F,d3
- move.w d3,timer(a0) ; setup custom delay!
- rts
- @NextLine:
- addq.w #1,char_y(a0)
- move.w #WindowXpos+1,char_x(a0)
- @Return:
- rts
- @GoTo_NextAction:
- sf.b btn_id(a0)
- addq.b #2,routine(a0)
- cmpi.b #$A+2,routine(a0)
- bne.s WP_WaitAnwser
- move.b #2,btn_ev(a0) ; set buttons to lock up Sonic
- ; ---------------------------------------------------------------
- ; Wait Button press
- ; ---------------------------------------------------------------
- WP_WaitAnwser:
- moveq #0,d0
- move.b btn_id(a0),d0
- beq.s @Return
- subq.b #1,d0
- add.w d0,d0
- add.w d0,d0
- add.w d0,charpos(a0)
- addq.b #2,routine(a0)
- move.w #120,timer(a0) ; time for answer to blink
- @Return:
- rts
- ; ---------------------------------------------------------------
- ; Loads the next question
- ; ---------------------------------------------------------------
- WP_LoadFirstQuestion:
- ; Load HUD object
- jsr SingleObjLoad
- move.b #$19,(a1)
- move.l #obj_SYZ3boss_HUD,obj(a1)
- sf.b btn_id(a0) ; reset id of the button pressed
- moveq #4,d0 ; setup question id
- bra.s WP_LoadNextQuestion2
- WP_LoadNextQuestion:
- moveq #0,d0
- move.b msg_id(a0),d0
- addq.w #1,d0
- cmpi.w #$C,d0 ; last question?
- beq.w WP_LoadEggman ; if yes, branch
- WP_LoadNextQuestion2:
- move.b d0,msg_id(a0)
- move.w #60,timer(a0) ; wait 1 sec before draw message
- move.b #$A,routine(a0) ; => "Draw Message"
- bsr WP_LoadMessage
- bra WP_ClearWindow
- ; ---------------------------------------------------------------
- ; Loads the next question
- ; ---------------------------------------------------------------
- WP_AnimateChoice:
- lea MessagesList,a2
- adda.w charpos(a0),a2
- move.w timer(a0),d0
- beq.s @Goto_NextAction
- subq.w #1,d0
- move.w d0,timer(a0)
- moveq #' ',d3
- btst #3,d0
- bne.s @0
- moveq #'A'-1,d3
- add.b btn_id(a0),d3 ; A/B/C
- @0 addi.w #CharBase,d3
- moveq #WindowXpos+1,d1
- moveq #WindowYpos+1,d2
- add.b (a2),d2 ; ypos
- bsr CalcCellAddr
- move.l d0,(a6)
- move.w d3,(a5)
- rts
- @Goto_NextAction:
- sf.b btn_id(a0) ; reset id of the button pressed
- sf.b btn_ev(a0) ; set buttons to normal state
- sf.b gen_ok(a0) ; set generator as working
- addq.b #2,routine(a0)
- jsr SingleObjLoad
- move.b #$19,(a1)
- moveq #0,d0
- move.b 1(a2),d0 ; generator ID
- move.l @Generators(pc,d0.w),obj(a1)
- move.b 2(a2),d0 ; generator argument
- move.w d0,var1(a1)
- move.w a0,parent(a1)
- rts
- @Generators:
- dc.l obj_SYZ3boss_RingsGen
- dc.l obj_SYZ3boss_SpikeGen
- ; ---------------------------------------------------------------
- ; Wait until generator finishes work
- ; ---------------------------------------------------------------
- WP_WaitGenerator:
- tst.b gen_ok(a0)
- beq.s @Return
- addq.b #2,routine(a0) ; => "WP_LoadNextQuestion"
- @Return:
- rts
- ; ---------------------------------------------------------------
- ; Show Eggman, wait Eggman to be beaten
- ; ---------------------------------------------------------------
- eggman = $3A
- WP_LoadEggman:
- ; Setup boss object
- move.b #$14,routine(a0)
- st.b ($FFFFF7CC).w ; lock Sonic's controls
- bclr #0,($FFFFD022).w ; face Sonic left
- move.w #0,($FFFFD030).w ; stop Sonic blinking
- move.w #(Up)<<8,SonicControl
- jsr SingleObjLoad
- move.b #$19,(a1)
- move.l #obj_SYZ3boss_KillGenerator,obj(a1) ; this object will restore Sonic's contro
- move.w #240,timer(a1)
- move.w a0,parent(a1)
- ; Load dialog
- moveq #1,d0
- bsr WP_LoadMessage
- move.w #60,timer(a0)
- bsr WP_ClearWindow
- jsr SingleObjLoad
- move.b #$02,(a1)
- move.w a1,eggman(a0)
- move.b #4,routine2(a1)
- move.w #camXbase+280,xpos(a1)
- move.w #camYbase-$40,ypos(a1)
- move.w xpos(a1),xpos2(a1)
- move.w ypos(a1),ypos2(a1)
- move.w #$280,yvel(a1)
- move.b #8,hits(a1)
- move.l #Nem_Eggman,d0
- move.w #$8000,d1
- jmp SendToPLC
- ; ---------------------------------------------------------------
- WP_LoadCheatsMesssage:
- addq.b #2,routine(a0)
- moveq #2,d0
- bsr WP_LoadMessage
- move.w #60,timer(a0)
- bra WP_ClearWindow
- ; ---------------------------------------------------------------
- cheatstr = $30 ; 8 bytes
- cheatpos = $38 ; w
- WP_EnterCheat:
- ; Debug output
- ; moveq #5,d1
- ; moveq #5,d2
- ; bsr CalcCellAddr
- ; moveq #7,d3
- ; move.l d0,(a6)
- ; lea cheatstr(a0),a1
- ;
- ;@FF moveq #0,d0
- ; move.b (a1)+,d0
- ; addi.w #CharBase,d0
- ; move.w d0,(a5)
- ; dbf d3,@FF
- ; Check if Eggy's dead
- movea.w eggman(a0),a1
- cmpi.b #2,(a1)
- bne @GoTo_NextAction
- ; Check if button was pressed
- move.b #4,btn_ev(a0)
- move.b btn_id(a0),d0 ; d0 = btn_id
- beq.s @Return
- sf.b btn_id(a0)
- ; Add letter into cheat memory
- moveq #%111,d3 ; d3 = warp mask
- move.w cheatpos(a0),d2 ; d2 = current pos in a cheat
- moveq #'A'-1,d1
- add.b d0,d1 ; d1 = char
- move.b d1,cheatstr(a0,d2.w) ; save cheat char into BLABLA BLA
- ; Check if str present in cheats
- moveq #2,d0 ; check 3 cheats
- lea @CheatsData,a1
- @CheckCheat:
- moveq #0,d4
- move.b (a1)+,d4 ; d4 = cheat len
- move.b d2,d1
- sub.b d4,d1 ; d1 = start char
- @0 and.w d3,d1 ; apply mask to pos
- move.b cheatstr(a0,d1.w),d5 ; d5 = char
- cmp.b (a1)+,d5
- bne.s @NextCheat
- addq.w #1,d1 ; next char
- dbf d4,@0
- ; Cheat found! Create cheat generator!
- add.w d0,d0
- add.w d0,d0 ; d0 *= 4
- neg.w d0
- move.w d0,d4
- jsr SingleObjLoad
- move.b #$19,(a1)
- move.l @CheatsData-4(pc,d4.w),obj(a1)
- move.w a0,parent(a1)
- moveq #$FFFFFFA1,d0
- jsr PlaySound_Special ; CHEATEY!!!
- bra.s @SaveLetter
- @NextCheat:
- adda.w d4,a1 ; jump to end of cheat str
- dbf d0,@CheckCheat
- @SaveLetter:
- ; Finally, save the letter for the cheat
- addq.w #1,d2
- and.w d3,d2
- move.w d2,cheatpos(a0)
- @Return:
- rts
- ; ---------------------------------------------------------------
- @GoTo_NextAction:
- addq.b #2,routine(a0)
- ; Load rings generator
- jsr SingleObjLoad
- move.b #$19,(a1)
- move.l #obj_SYZ3boss_RingsGen_Special,obj(a1)
- move.w #180,timer(a1)
- move.w #50,var1(a1)
- ; Load victory message and fade out music
- moveq #3,d0
- bsr WP_LoadMessage
- bsr WP_ClearWindow
- move.w #180,timer(a0)
- moveq #$FFFFFFE0,d0
- jmp PlaySound ; fade out music
- ; ---------------------------------------------------------------
- ; Cheat Generators
- dc.l obj_SYZ3boss_CheatSpikes
- dc.l obj_SYZ3boss_CheatSpring
- dc.l obj_SYZ3boss_CheatRingRush
- @CheatsData:
- dc.b 2, 'BBC'
- dc.b 4, 'BABAC'
- dc.b 7, 'BCCABBAC'
- even
- ; ===============================================================
- ; ---------------------------------------------------------------
- ; End the boss
- ; ---------------------------------------------------------------
- WP_EndBoss:
- move.w #320,timer(a0)
- move.l #@ResetBoss,obj(a0)
- rts
- @ResetBoss:
- subq.w #1,timer(a0)
- bne.s @0
- st.b NonNoobMsg ; force non-noob msg
- jmp LoadNextLevel
- @0 rts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement