// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Eggman Window Object
// Script Author: Christan Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 42 : TYPE_EGGMANWINDOW


// Static Values

// Tables

event ObjectMain
end event


event ObjectDraw
	switch object.animation
	case 0
		DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
		break
	case 1
		object.animationTimer++
		if object.animationTimer == 4
			object.animationTimer = 0
			object.frame++
			if object.frame == 4
				object.animation = 2
			end if
		end if
		DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
		break
	case 2
		DrawSpriteFX(4, FX_FLIP, object.xpos, object.ypos)
		break
	case 3
		temp0 = object.animationTimer
		temp0 &= 15
		temp0 >>= 3
		temp0 += 5
		object.animationTimer++
		if object.animationTimer == 50
			object.animationTimer = 0
			if object[0].animation != ANI_DYING
				object.animation = 2
			end if
		end if
		DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
		break
	case 4
		temp0 = object.animationTimer
		object.animationTimer++
		if object.animationTimer == 50
			object.animationTimer = 0
			object.animation = 2
		end if
		DrawSpriteFX(7, FX_FLIP, object.xpos, object.ypos)
		break
	case 5
		object.animationTimer++
		if object.animationTimer == 4
			object.animationTimer = 0
			object.frame--
			if object.frame == 0
				object.animation = 0
			end if
		end if
		DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
		break
	end switch
end event


event ObjectStartup
	CheckCurrentStageFolder("Zone12")
	if checkResult == 1
		if stage.playerListPos == 2
			if saveRAM[284] == 1
				LoadSpriteSheet("DEZ/ObjectsRobo.gif")
			else
				LoadSpriteSheet("DEZ/Objects.gif")
			end if
		else
			LoadSpriteSheet("DEZ/Objects.gif")
		end if
		SpriteFrame(-16, -12, 32, 24, 133, 114)
		SpriteFrame(-16, -12, 32, 24, 100, 114)
		SpriteFrame(-16, -12, 32, 24, 67, 114)
		SpriteFrame(-16, -12, 32, 24, 34, 114)
		SpriteFrame(-16, -12, 32, 24, 1, 114)
		SpriteFrame(-16, -12, 32, 24, 166, 114)
		SpriteFrame(-16, -12, 32, 24, 199, 114)
		SpriteFrame(-16, -12, 32, 24, 232, 114)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-16, -12, 32, 24, 645, 114)
		SpriteFrame(-16, -12, 32, 24, 612, 114)
		SpriteFrame(-16, -12, 32, 24, 579, 114)
		SpriteFrame(-16, -12, 32, 24, 546, 114)
		SpriteFrame(-16, -12, 32, 24, 513, 114)
		SpriteFrame(-16, -12, 32, 24, 678, 114)
		SpriteFrame(-16, -12, 32, 24, 711, 114)
		SpriteFrame(-16, -12, 32, 24, 744, 114)
	end if
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
