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

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

private alias object.value0 : object.timer


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

private table ExhaustPuff_frameTable
	1, 1, 2, 2, 2, 3
end table


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

event ObjectUpdate
	object.ypos += object.yvel

	GetBit(temp0, object.timer, 1)
	if temp0 == true
		object.frame = 0
	else
		temp0 = object.timer
		temp0 >>= 2
		GetTableValue(object.frame, temp0, ExhaustPuff_frameTable)
	end if

	object.timer++
	if object.timer >= 23
		object.type = TypeName[Blank Object]
	end if
end event


event ObjectDraw
	DrawSprite(object.frame)
end event


event ObjectStartup
	CheckCurrentStageFolder("Zone01")
	if checkResult == true
		LoadSpriteSheet("EHZ/Objects.gif")
		SpriteFrame(0, 0, 1, 1, 44, 22)
		SpriteFrame(-2, -2, 4, 4, 44, 22)
		SpriteFrame(-4, -4, 8, 8, 49, 18)
		SpriteFrame(-4, -4, 8, 8, 58, 18)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(0, 0, 1, 1, 100, 81)
		SpriteFrame(-2, -2, 4, 4, 100, 81)
		SpriteFrame(-4, -4, 8, 8, 105, 81)
		SpriteFrame(-4, -4, 8, 8, 114, 81)
	end if
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	CheckCurrentStageFolder("Zone01")
	if checkResult == true
		LoadSpriteSheet("EHZ/Objects.gif")
		SpriteFrame(-4, -4, 8, 8, 49, 18)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-4, -4, 8, 8, 105, 81)
	end if
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
