// ----------------------------------
// RSDK Project: Sonic 2
// Script Description: Chemical Dropper Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

// ========================
// Aliases
// ========================

private alias object.value0  : object.originPos.x
private alias object.value1  : object.originPos.y
private alias object.value2  : object.oscillationAngle
private alias object.value3  : object.timer
private alias object.value4  : object.boundsL
private alias object.value5  : object.boundsR
private alias object.value6  : object.machineAnim
private alias object.value7  : object.tubeAnimTimer
private alias object.value8  : object.dropperLength
private alias object.value9  : object.tubeFrame
private alias object.value10 : object.dropletNodeID
private alias object.value11 : object.dropperOffset
private alias object.value12 : object.dropperAnim
private alias object.value13 : object.dropperFrame
private alias object.value14 : object.dropletAnimTimer
private alias object.value15 : object.chemicalFrame
private alias object.value16 : object.dropletFrame
private alias object.value17 : object.hatchFrame
private alias object.value18 : object.nextDir
private alias object.value19 : object.dropTrackSpeed
private alias object.value20 : object.extraSpeed

private alias object.xpos : player.xpos

// States
private alias 0 : CHEMICALDROPPER_MOVERIGHT
private alias 1 : CHEMICALDROPPER_GETCHEMICALS
private alias 2 : CHEMICALDROPPER_DROPCHEMICALS
private alias 3 : CHEMICALDROPPER_MOVELEFT
private alias 4 : CHEMICALDROPPER_DESTROYED
private alias 5 : CHEMICALDROPPER_DEBRISEXPLODE
private alias 6 : CHEMICALDROPPER_DEBRISDELAY
private alias 7 : CHEMICALDROPPER_DEBRIS

// Machine Animations
private alias 0 : CHEMICALDROPPER_MANI_IDLE
private alias 1 : CHEMICALDROPPER_MANI_EXTEND
private alias 2 : CHEMICALDROPPER_MANI_FILLING
private alias 3 : CHEMICALDROPPER_MANI_RETRACT

// Dropper Animations
private alias 0 : CHEMICALDROPPER_DANI_CLOSED
private alias 1 : CHEMICALDROPPER_DANI_FILLING
private alias 2 : CHEMICALDROPPER_DANI_WAIT
private alias 3 : CHEMICALDROPPER_DANI_EXTEND
private alias 4 : CHEMICALDROPPER_DANI_OPENHATCH
private alias 5 : CHEMICALDROPPER_DANI_RETRACT

// Player Aliases
private alias object.xpos : player.xpos


// ========================
// Function Declarations
// ========================

reserve function ChemicalDropper_SpawnDebris
reserve function ChemicalDropper_Oscillate


// ========================
// Tables
// ========================

private table ChemicalDropper_tubeFrames
	2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2
end table

private table ChemicalDropper_dropletFrames
	18, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 10, 10, 10
end table

private table ChemicalDropper_dropperFrames
	12, 31, 33
end table

// Unused table
private table ChemicalDropper_hatchFrames
	13, 18, 14, 16, 15, 17
end table


// ========================
// Function Definitions
// ========================

private function ChemicalDropper_SpawnDebris
	CreateTempObject(TypeName[Chemical Dropper], 0, temp0, temp1)
	object[tempObjectPos].state = CHEMICALDROPPER_DEBRISEXPLODE
	object[tempObjectPos].direction = object.direction

	Rand(object[tempObjectPos].xvel, 8)
	object[tempObjectPos].xvel -= 4
	object[tempObjectPos].xvel <<= 16
	object[tempObjectPos].yvel = -0x38000

	Rand(object[tempObjectPos].timer, 255)
	object[tempObjectPos].timer += 30
	object[tempObjectPos].timer &= 0x7F
end function


private function ChemicalDropper_Oscillate
	object.ypos = object.originPos.y
	Sin256(temp0, object.oscillationAngle)
	temp0 <<= 10
	object.ypos += temp0
	object.oscillationAngle += 2
	object.oscillationAngle &= 0xFF

	object[-1].xpos = object.xpos
	object[-1].ypos = object.ypos
	CheckGreater(player[0].xpos, object.xpos)
	object.direction = checkResult
	object[-1].direction = object.direction
end function


// ========================
// Events
// ========================

event ObjectUpdate
	switch object.state
	case CHEMICALDROPPER_MOVERIGHT
		if object.xpos == object.boundsR
			if object.dropperAnim == CHEMICALDROPPER_DANI_CLOSED
				object.machineAnim = CHEMICALDROPPER_MANI_EXTEND
				object.tubeAnimTimer = 0
				object.state++
			end if
		else
			if object.xpos > object.boundsR
				object.xpos -= object.extraSpeed
				if object.xpos <= object.boundsR
					object.xpos = object.boundsR
				end if
			else
				object.xpos += object.extraSpeed
				if object.xpos >= object.boundsR
					object.xpos = object.boundsR
				end if
			end if
		end if
		CallFunction(ChemicalDropper_Oscillate)
		break

	case CHEMICALDROPPER_GETCHEMICALS
		CallFunction(ChemicalDropper_Oscillate)
		break

	case CHEMICALDROPPER_DROPCHEMICALS
		temp0 = object.xpos
		if player[0].xpos <= object.xpos
			temp2 = -0x480000
		else
			temp2 = 0x480000
		end if
		temp0 += temp2
		temp0 &= 0xFFFF0000

		temp1 = player[0].xpos
		temp1 &= 0xFFFF0000

		if temp1 == temp0
			if object.dropperOffset == 0x580000
				object.dropperAnim = CHEMICALDROPPER_DANI_OPENHATCH
			end if
		else
			if player[0].xpos < temp0
				temp0 = stage.newXBoundary1
				temp0 -= 16
				temp0 <<= 16
				if object.xpos > temp0
					object.xpos -= object.dropTrackSpeed
					temp0 = object.xpos
					temp0 += temp2
					temp0 &= 0xFFFF0000
					temp1 = player[0].xpos
					temp1 &= 0xFFFF0000
					if temp1 > temp0
						object.xpos = player[0].xpos
						FlipSign(temp2)
						object.xpos += temp2
					end if
				end if
			else
				temp0 = stage.newXBoundary2
				temp0 += 16
				temp0 <<= 16
				if object.xpos < temp0
					object.xpos += object.dropTrackSpeed
					temp0 = object.xpos
					temp0 += temp2
					temp0 &= 0xFFFF0000
					temp1 = player[0].xpos
					temp1 &= 0xFFFF0000
					if temp1 < temp0
						object.xpos = player[0].xpos
						FlipSign(temp2)
						object.xpos += temp2
					end if
				end if
			end if
		end if

		CallFunction(ChemicalDropper_Oscillate)
		break

	case CHEMICALDROPPER_MOVELEFT
		if object.xpos == object.boundsL
			if object.dropperAnim == CHEMICALDROPPER_DANI_CLOSED
				object.machineAnim = CHEMICALDROPPER_MANI_EXTEND
				object.tubeAnimTimer = 0
				object.state = CHEMICALDROPPER_GETCHEMICALS
			end if
		else
			if object.xpos > object.boundsL
				object.xpos -= object.extraSpeed
				if object.xpos <= object.boundsL
					object.xpos = object.boundsL
				end if
			else
				object.xpos += object.extraSpeed
				if object.xpos >= object.boundsL
					object.xpos = object.boundsL
				end if
			end if
		end if
		CallFunction(ChemicalDropper_Oscillate)
		break

	case CHEMICALDROPPER_DESTROYED
		object.machineAnim = CHEMICALDROPPER_MANI_IDLE
		object.dropperAnim = CHEMICALDROPPER_DANI_CLOSED
		temp0 = object.xpos
		if object.direction == FLIP_NONE
			temp0 -= object.dropperOffset
		else
			temp0 += object.dropperOffset
		end if
		temp1 = object.ypos
		temp1 -= 0x380000
		CallFunction(ChemicalDropper_SpawnDebris)
		object[tempObjectPos].frame = 35
		temp1 += 0x80000
		temp2 = object.dropperOffset
		temp2 >>= 16
		temp2 -= 16
		temp2 /= 24
		while temp2 >= 0
			if object.direction == FLIP_NONE
				temp0 += 0x180000
			else
				temp0 -= 0x180000
			end if
			CallFunction(ChemicalDropper_SpawnDebris)
			object[tempObjectPos].frame = 36
			temp2--
		loop
		temp0 = object.xpos
		temp1 = object.ypos

		CallFunction(ChemicalDropper_SpawnDebris)
		object[tempObjectPos].frame = 37

		CallFunction(ChemicalDropper_SpawnDebris)
		object[tempObjectPos].frame = 38

		CallFunction(ChemicalDropper_SpawnDebris)
		object[tempObjectPos].frame = 39

		if object.direction == FLIP_NONE
			temp0 += 0x40000
		else
			temp0 -= 0x40000
		end if
		temp1 += 0x190000
		temp2 = 0
		while temp2 < object.dropperLength
			CallFunction(ChemicalDropper_SpawnDebris)
			object[tempObjectPos].frame = 1
			temp1 += 0x80000
			temp2++
		loop
		object.type = TypeName[Blank Object]
		break

	case CHEMICALDROPPER_DEBRISEXPLODE
		object.timer--
		if object.timer <= 0
			object.timer = 30
			CreateTempObject(TypeName[Explosion], 0, object.xpos, object.ypos)
			object[tempObjectPos].drawOrder = 5
			PlaySfx(SfxName[Explosion 2], false)
			object.state++
		end if
		break

	case CHEMICALDROPPER_DEBRISDELAY
		object.timer--
		if object.timer <= 0
			object.state++
		end if
		break

	case CHEMICALDROPPER_DEBRIS
		object.xpos += object.xvel
		object.ypos += object.yvel
		object.yvel += 0x3800
		temp1 = object.ypos
		temp1 >>= 16
		temp1 -= camera[0].ypos
		Abs(temp1)
		temp1 -= 128
		if temp1 >= screen.ycenter
			object.type = TypeName[Blank Object]
		end if
		break
		
	end switch

	switch object.machineAnim
	default
	case CHEMICALDROPPER_MANI_IDLE
		break

	case CHEMICALDROPPER_MANI_EXTEND
		object.tubeFrame = 1
		object.dropperLength++
		if object.dropperLength == 8
			object.machineAnim = CHEMICALDROPPER_MANI_FILLING
			object.dropletNodeID = 8
			object.tubeAnimTimer = 0
			object.dropperAnim = CHEMICALDROPPER_DANI_FILLING
			object.chemicalFrame = 18
			object.dropletFrame = 4
		end if
		break

	case CHEMICALDROPPER_MANI_FILLING
		object.tubeAnimTimer++
		if object.tubeAnimTimer == 18
			object.tubeAnimTimer = 0
			object.dropletNodeID--
			if object.dropletNodeID < 0
				object.dropletNodeID = 9
			end if
		end if
		GetTableValue(object.tubeFrame, object.tubeAnimTimer, ChemicalDropper_tubeFrames)
		break

	case CHEMICALDROPPER_MANI_RETRACT
		object.tubeFrame = 1
		object.dropperLength--
		if object.dropperLength == 0
			object.machineAnim = CHEMICALDROPPER_MANI_IDLE
			object.dropletNodeID = 8
			object.tubeAnimTimer = 0
			object.dropperAnim = CHEMICALDROPPER_DANI_EXTEND
			object.state = CHEMICALDROPPER_DROPCHEMICALS
		end if
		break
		
	end switch

	switch object.dropperAnim
	case CHEMICALDROPPER_DANI_CLOSED
		object.dropperOffset = 0x100000
		object.dropperFrame = 12
		break

	case CHEMICALDROPPER_DANI_FILLING
		object.dropletAnimTimer++
		if object.dropletAnimTimer == 19
			object.dropletAnimTimer = 0
			object.chemicalFrame++
			if object.chemicalFrame >= 30
				object.chemicalFrame = 30
				object.machineAnim = CHEMICALDROPPER_MANI_RETRACT
				object.dropperAnim = CHEMICALDROPPER_DANI_WAIT
			end if
		end if

		GetTableValue(object.dropletFrame, object.dropletAnimTimer, ChemicalDropper_dropletFrames)
		break

	case CHEMICALDROPPER_DANI_WAIT
		break

	case CHEMICALDROPPER_DANI_EXTEND
		object.dropperOffset += 0x10000
		if object.dropperOffset >= 0x580000
			object.dropperOffset = 0x580000
		end if
		temp0 = object.dropperOffset
		temp0 >>= 16
		temp0 -= 16
		temp0 /= 24
		GetTableValue(object.dropperFrame, temp0, ChemicalDropper_dropperFrames)
		break

	case CHEMICALDROPPER_DANI_OPENHATCH
		object.dropletAnimTimer++
		switch object.dropletAnimTimer
		case 8
			object.hatchFrame = 1
			break

		case 20
			object.hatchFrame = 2
			break

		case 32
			temp0 = object.xpos
			if object.direction == FLIP_NONE
				temp0 -= object.dropperOffset
				temp0 += 0xC0000
			else
				temp0 += object.dropperOffset
				temp0 -= 0xC0000
			end if
			temp1 = object.ypos
			temp1 -= 0x260000
			CreateTempObject(TypeName[Chemical Drop], 0, temp0, temp1)
			object[tempObjectPos].drawOrder = 2
			break

		case 40
			object.hatchFrame = 1
			break

		case 48
			object.hatchFrame = 0
			object.dropperAnim = CHEMICALDROPPER_DANI_RETRACT
			object.dropletAnimTimer = 0
			if object.nextDir == 0
				object.state = CHEMICALDROPPER_MOVELEFT
			else
				object.state = CHEMICALDROPPER_MOVERIGHT
			end if
			object.nextDir ^= 1
			break
			
		end switch
		break

	case CHEMICALDROPPER_DANI_RETRACT
		object.dropperOffset -= 0x10000
		if object.dropperOffset <= 0x100000
			object.dropperOffset = 0x100000
			object.dropperAnim = CHEMICALDROPPER_DANI_CLOSED
		end if

		temp0 = object.dropperOffset
		temp0 >>= 16
		temp0 -= 16
		temp0 /= 24
		GetTableValue(object.dropperFrame, temp0, ChemicalDropper_dropperFrames)
		break
		
	end switch
end event


event ObjectDraw
	if object.state < CHEMICALDROPPER_DESTROYED
		temp0 = object.xpos
		if object.direction == FLIP_NONE
			temp0 -= object.dropperOffset
		else
			temp0 += object.dropperOffset
		end if

		temp1 = object.ypos
		temp1 -= 0x380000
		if object.dropperAnim == CHEMICALDROPPER_DANI_FILLING
			DrawSpriteFX(object.dropletFrame, FX_FLIP, object.xpos, object.ypos)
			DrawSpriteFX(object.chemicalFrame, FX_FLIP, temp0, temp1)
		end if

		if object.dropperAnim == CHEMICALDROPPER_DANI_WAIT
			DrawSpriteFX(object.chemicalFrame, FX_FLIP, temp0, temp1)
		end if

		if object.dropperAnim == CHEMICALDROPPER_DANI_EXTEND
			DrawSpriteFX(object.chemicalFrame, FX_FLIP, temp0, temp1)
		end if

		if object.dropperAnim == CHEMICALDROPPER_DANI_OPENHATCH
			if object.dropletAnimTimer < 32
				DrawSpriteFX(object.chemicalFrame, FX_FLIP, temp0, temp1)
			end if
		end if

		temp0 = object.xpos
		if object.direction == FLIP_NONE
			temp0 -= object.dropperOffset
		else
			temp0 += object.dropperOffset
		end if
		temp1 = object.ypos
		temp1 -= 0x380000
		DrawSpriteFX(object.dropperFrame, FX_FLIP, temp0, temp1)

		switch object.hatchFrame
		case 0
			DrawSpriteFX(18, FX_FLIP, temp0, temp1)
			DrawSpriteFX(13, FX_FLIP, temp0, temp1)
			break

		case 1
			DrawSpriteFX(16, FX_FLIP, temp0, temp1)
			DrawSpriteFX(14, FX_FLIP, temp0, temp1)
			break

		case 2
			DrawSpriteFX(17, FX_FLIP, temp0, temp1)
			DrawSpriteFX(15, FX_FLIP, temp0, temp1)
			break
			
		end switch

		temp0 = object.xpos
		if object.direction == FLIP_NONE
			temp0 += 0x40000
		else
			temp0 -= 0x40000
		end if

		temp1 = object.ypos
		temp1 += 0x190000
		temp2 = 0
		while temp2 < object.dropperLength
			if temp2 == object.dropletNodeID
				DrawSpriteFX(object.tubeFrame, FX_FLIP, temp0, temp1)
			else
				DrawSpriteFX(1, FX_FLIP, temp0, temp1)
			end if
			temp1 += 0x80000
			temp2++
		loop
		DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
	else
		DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
	end if
end event


event ObjectStartup
	CheckCurrentStageFolder("Zone02")

	if checkResult == true
		LoadSpriteSheet("CPZ/Objects.gif")

		// Dropper Sprite Frames
		SpriteFrame(-5, -68, 37, 52, 55, 74)	// Chemical Machine - #0
		SpriteFrame(-4, -4, 8, 8, 61, 147)		// Chemical Tube (Normal) - #1
		SpriteFrame(-5, -4, 10, 8, 59, 138)		// Chemical Tube (Wide) - #2
		SpriteFrame(-6, -4, 12, 8, 57, 129)		// Chemical Tube (Widest) - #3
		SpriteFrame(-5, -60, 8, 3, 93, 74)		// Chemical Droplet 1 - #4
		SpriteFrame(-5, -60, 8, 5, 93, 78)		// Chemical Droplet 2 - #5
		SpriteFrame(-4, -60, 6, 8, 93, 84)		// Chemical Droplet 3 - #6
		SpriteFrame(-4, -60, 6, 13, 93, 93)		// Chemical Droplet 4 - #7
		SpriteFrame(-5, -60, 8, 14, 93, 107)	// Chemical Droplet 5 - #8
		SpriteFrame(-4, -50, 8, 8, 93, 122)		// Chemical Droplet 6 - #9
		SpriteFrame(-4, -46, 8, 8, 93, 122)		// Chemical Droplet 7 - #10
		SpriteFrame(-4, -4, 8, 8, 93, 122)		// Chemical Droplet 8 - #11
		SpriteFrame(0, 0, 48, 24, 93, 131)		// Chemical Dropper - #12
		SpriteFrame(1, 24, 22, 2, 74, 189)		// Dropper Hatch (Closed) - #13
		SpriteFrame(6, 24, 16, 6, 74, 192)		// Dropper Hatch (Opening 1) - #14
		SpriteFrame(11, 24, 16, 8, 74, 199)		// Dropper Hatch (Opening 2) - #15
		SpriteFrame(-2, 24, 14, 6, 74, 208)		// Dropper Hatch (Opening 3) - #16
		SpriteFrame(-4, 24, 15, 8, 74, 215)		// Dropper Hatch (Opened) - #17
		SpriteFrame(0, 0, 0, 0, 0, 0)			// Empty - #18
		SpriteFrame(1, 22, 22, 2, 70, 131)		// Chemicals (Empty) - #19
		SpriteFrame(1, 20, 22, 4, 70, 131)		// Chemicals (Filling 1) - #20
		SpriteFrame(1, 18, 22, 6, 70, 131)		// Chemicals (Filling 2) - #21
		SpriteFrame(1, 16, 22, 8, 70, 131)		// Chemicals (Filling 3) - #22
		SpriteFrame(1, 14, 22, 10, 70, 131)		// Chemicals (Filling 4) - #23
		SpriteFrame(1, 12, 22, 12, 70, 131)		// Chemicals (Filling 5) - #24
		SpriteFrame(1, 10, 22, 14, 70, 131)		// Chemicals (Filling 6) - #25
		SpriteFrame(1, 8, 22, 16, 70, 131)		// Chemicals (Filling 7) - #26
		SpriteFrame(1, 6, 22, 18, 70, 131)		// Chemicals (Filling 8) - #27
		SpriteFrame(1, 4, 22, 20, 70, 131)		// Chemicals (Filling 9) - #28
		SpriteFrame(1, 2, 22, 22, 70, 131)		// Chemicals (Filling 10) - #29
		SpriteFrame(1, 0, 22, 24, 70, 131)		// Chemicals (Filled) - #30
		SpriteFrame(0, 0, 72, 24, 93, 131)		// Chemical Dropper (Shorter) - #31
		SpriteFrame(3, 3, 18, 29, 97, 189)		// Chemical Drop 1 - #32
		SpriteFrame(0, 0, 96, 24, 93, 131)		// Chemical Dropper (Full) - #33
		SpriteFrame(3, 3, 18, 29, 117, 189)		// Chemical Drop 2 - #34
		SpriteFrame(0, 0, 28, 24, 93, 131)		// Chemical Dropper (Standalone) - #35
		SpriteFrame(0, 2, 24, 4, 121, 141)		// Dropper Debris - #36
		SpriteFrame(-5, -68, 29, 12, 55, 74)	// Dropper Machine Debris 1 - #37
		SpriteFrame(8, -56, 24, 24, 68, 86)		// Dropper Machine Debris 2 - #38
		SpriteFrame(17, -32, 14, 16, 77, 110)	// Dropper Machine Debris 3 - #39

		// Below three are unused, but their mappings exist anyways
		SpriteFrame(-15, -32, 22, 24, 81, 156)	// Chemical Drops on eggman - #40
		SpriteFrame(-15, -24, 30, 16, 104, 156)	// Chemical Splashes on eggman - #41
		SpriteFrame(-15, -23, 31, 15, 104, 173)	// Chemical on eggman - #42
	else
		LoadSpriteSheet("MBZ/Objects.gif")

		SpriteFrame(-5, -68, 37, 52, 34, 138)	// Chemical Machine - #0
		SpriteFrame(-4, -4, 8, 8, 38, 130)		// Chemical Tube (Normal) - #1
		SpriteFrame(-5, -4, 10, 8, 36, 121)		// Chemical Tube (Wide) - #2
		SpriteFrame(-6, -4, 12, 8, 34, 112)		// Chemical Tube (Widest) - #3
		SpriteFrame(-5, -60, 8, 3, 72, 138)		// Chemical Droplet 1 - #4
		SpriteFrame(-5, -60, 8, 5, 72, 142)		// Chemical Droplet 2 - #5
		SpriteFrame(-4, -60, 6, 8, 72, 148)		// Chemical Droplet 3 - #6
		SpriteFrame(-4, -60, 6, 13, 72, 157)	// Chemical Droplet 4 - #7
		SpriteFrame(-5, -60, 8, 14, 72, 171)	// Chemical Droplet 5 - #8
		SpriteFrame(-4, -50, 8, 8, 104, 155)	// Chemical Droplet 6 - #9
		SpriteFrame(-4, -46, 8, 8, 104, 155)	// Chemical Droplet 7 - #10
		SpriteFrame(-4, -4, 8, 8, 104, 155)		// Chemical Droplet 8 - #11
		SpriteFrame(0, 0, 48, 24, 70, 113)		// Chemical Dropper - #12
		SpriteFrame(1, 24, 22, 2, 81, 163)		// Dropper Hatch (Closed) - #13
		SpriteFrame(6, 24, 16, 6, 81, 166)		// Dropper Hatch (Opening 1) - #14
		SpriteFrame(11, 24, 16, 8, 81, 173)		// Dropper Hatch (Opening 2) - #15
		SpriteFrame(-2, 24, 14, 6, 81, 182)		// Dropper Hatch (Opening 3) - #16
		SpriteFrame(-4, 24, 15, 8, 113, 156)	// Dropper Hatch (Opened) - #17
		SpriteFrame(0, 0, 0, 0, 0, 0)			// Dropper Hatch (Gone) - #18
		SpriteFrame(1, 22, 22, 2, 47, 113)		// Chemicals (Empty) - #19
		SpriteFrame(1, 20, 22, 4, 47, 113)		// Chemicals (Filling 1) - #20
		SpriteFrame(1, 18, 22, 6, 47, 113)		// Chemicals (Filling 2) - #21
		SpriteFrame(1, 16, 22, 8, 47, 113)		// Chemicals (Filling 3) - #22
		SpriteFrame(1, 14, 22, 10, 47, 113)		// Chemicals (Filling 4) - #23
		SpriteFrame(1, 12, 22, 12, 47, 113)		// Chemicals (Filling 5) - #24
		SpriteFrame(1, 10, 22, 14, 47, 113)		// Chemicals (Filling 6) - #25
		SpriteFrame(1, 8, 22, 16, 47, 113)		// Chemicals (Filling 7) - #26
		SpriteFrame(1, 6, 22, 18, 47, 113)		// Chemicals (Filling 8) - #27
		SpriteFrame(1, 4, 22, 20, 47, 113)		// Chemicals (Filling 9) - #28
		SpriteFrame(1, 2, 22, 22, 47, 113)		// Chemicals (Filling 10) - #29
		SpriteFrame(1, 0, 22, 24, 47, 113)		// Chemicals (Filled) - #30
		SpriteFrame(0, 0, 72, 24, 70, 113)		// Chemical Dropper (Shorter) - #31
		SpriteFrame(3, 3, 18, 29, 1, 64)		// Chemical Drop 1 - #32
		SpriteFrame(0, 0, 96, 24, 70, 113)		// Chemical Dropper (Full) - #33
		SpriteFrame(3, 3, 18, 29, 21, 64)		// Chemical Drop 2 - #34
		SpriteFrame(0, 0, 28, 24, 70, 113)		// Chemical Dropper (Standalone) - #35
		SpriteFrame(0, 2, 24, 4, 98, 123)		// Dropper Debris - #36
		SpriteFrame(-5, -68, 29, 12, 34, 138)	// Dropper Machine Debris 1 - #37
		SpriteFrame(8, -56, 24, 24, 47, 150)	// Dropper Machine Debris 2 - #38
		SpriteFrame(17, -32, 14, 16, 56, 174)	// Dropper Machine Debris 3 - #39

		// Below three are unused, but their mappings exist anyways
		SpriteFrame(-15, -32, 22, 24, 81, 138)	// Chemical Drops on eggman - #40
		SpriteFrame(-15, -24, 30, 16, 104, 138)	// Chemical Splashes on eggman - #41
		SpriteFrame(-15, -23, 31, 15, 135, 138)	// Chemical on eggman - #42
	end if
end event


// ========================
// Editor Events
// ========================

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	CheckCurrentStageFolder("Zone02")
	if checkResult == true
		LoadSpriteSheet("CPZ/Objects.gif")
		SpriteFrame(-5, -68, 37, 52, 55, 74) // 0 - Main Dropper Frame
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-5, -68, 37, 52, 34, 138) // 0 - Main Dropper Frame
	end if
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
