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

//-------Aliases-------//
private alias 42 : TYPE_CLOUD

// Function declarations
reserve function Cloud_DebugDraw
reserve function Cloud_DebugSpawn

// Static Values

// Tables

function Cloud_DebugDraw
	DrawSprite(0)
end function


function Cloud_DebugSpawn
	CreateTempObject(TypeName[Cloud], 0, object.xpos, object.ypos)
	object[tempObjectPos].drawOrder = 2
	object[tempObjectPos].xvel = -0xC000
end function


event ObjectMain
	object.xpos += object.xvel
	object.xpos += WFZSetup_value33
end event


event ObjectDraw
	DrawSprite(object.propertyValue)
end event


event ObjectStartup
	LoadSpriteSheet("SCZ/Objects.gif")
	SpriteFrame(-40, -4, 79, 8, 72, 74)
	SpriteFrame(-24, -4, 48, 8, 72, 83)
	SpriteFrame(-8, -4, 16, 8, 121, 83)
	foreach (TypeName[Cloud], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].drawOrder = 2
		switch object[arrayPos0].propertyValue
		case 0
			object[arrayPos0].xvel = -0xC000
			break
		case 1
			object[arrayPos0].xvel = -0x8000
			break
		case 2
			object[arrayPos0].xvel = -0x4000
			break
		end switch
	next
	SetTableValue(TypeName[Cloud], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(Cloud_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(Cloud_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event

event RSDKDraw
	DrawSprite(0)
end event

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