; ===========================================================================
; ---------------------------------------------------------------------------
; Object 60 - Reverse gravity activator/deactivator from DEZ
; ---------------------------------------------------------------------------
Obj60:
moveq #0,d0
move.b routine(a0),d0 ; dump routine counter to d0
move.w Obj60_Index(pc,d0.w),d1 ; calculate correct routine to d1
jmp Obj60_Index(pc,d1.w) ; jump to the routine
; ===========================================================================
Obj60_Index: offsetTable
offsetTableEntry.w Obj60_Init
offsetTableEntry.w Obj60_Main
; ===========================================================================
Obj60_Init:
addq.b #2,routine(a0) ; add 2 to routine counter
move.l #Obj60_MapUnc_250BA,mappings(a0) ; mappings
move.w #make_art_tile(ArtTile_ArtNem_ReverseGravityActivator,0,0),art_tile(a0) ; VRAM location to read art from
ori.b #4,render_flags(a0) ; set the object to plane A
move.b #$10,width_pixels(a0) ; object's showing radius
move.b #$200,priority(a0)
Obj60_Main:
lea (MainCharacter).w,a1 ; load the main character
move.w x_pos(a0),d4 ; move x-pos to d4
bsr.w SolidObject ; make the object act solid
move.w x_pos(a1),d0
cmp.w x_pos(a0),d0 ; are the two x-positions equal?
beq.s Obj60_Set ; if not, branch
move.w y_pos(a1),d0
move.w y_pos(a0),d1
subi.w d1,d0
cmpi.b #8,d0 ; are the two y-positions close enough upwards?
bgt.s Obj60_Set ; if not, branch
cmpi.b #-8,d0 ; are the two y-positions close enough upwards?
blt.s Obj60_Set ; if not, branch
move.b #2,mapping_frame(a0) ; use "used" frame
move.w #$CD,d0
jsr (PlaySound).l ; play switch sound
eori.b #1,(Reverse_gravity_flag).w ; set reverse gravity flag
jmp (DisplaySprite).l ; display the sprite
Obj60_Set:
move.b #0,mapping_frame(a0) ; use "activator" frame
tst.b subtype(a1)
beq.w Obj60_End
move.b #1,mapping_frame(a0) ; use "deactivator" frame
Obj60_End:
jmp (DisplaySprite).l ; display the sprite
Comments