// ----------------------------------
// 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 53 : TYPE_CLOUD

// Function declarations
reserve function Cloud_DebugDraw
reserve function Cloud_DebugSpawn

// Static Values

// Tables

event ObjectMain
		object.priority = PRIORITY_ACTIVE
		object.xpos += object.xvel
		object.xpos += 0x10000	
		
		temp0 = screen.xoffset
		temp1 = temp0
		temp0 -= 50
		temp1 += screen.xsize
		temp1 += 50
		
		temp2 = object.xpos
		temp2 >>= 16
		
		CheckLower(temp2, temp0)
		temp3 = checkResult
		CheckGreater(temp2, temp1)
		temp3 |= checkResult
		
		CheckLower(object.value1, temp0)
		temp4 = checkResult
		CheckGreater(object.value1, temp1)
		temp4 |= checkResult
		
		temp3 &= temp4
		
		if temp3 == 1
			object.xpos = object.value1
			object.xpos <<= 16
		end if

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)
end event

event RSDKDraw
	DrawSprite(0)
end event

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