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

//-------Aliases-------//
private alias 78 : TYPE_LAVABUBBLE

// Function declarations
reserve function LavaBubble_DebugDraw
reserve function LavaBubble_DebugSpawn

// Static Values

// Tables

function LavaBubble_DebugDraw
	DrawSprite(0)
end function


function LavaBubble_DebugSpawn
	CreateTempObject(TypeName[Lava Bubble], object.direction, object.xpos, object.ypos)
	object[tempObjectPos].drawOrder = 4
end function


event ObjectMain
	if object.state == 0
		object.animationTimer++
		if object.animationTimer == 12
			object.animationTimer = 0
			object.frame++
			if object.frame >= 6
				object.value0 = 128
				object.state = 1
			end if
		end if
	else
		object.value0--
		if object.value0 == 0
			object.frame = 0
			object.state = 0
		end if
	end if
end event


event ObjectDraw
	DrawSprite(object.frame)
end event


event ObjectStartup
	LoadSpriteSheet("MPZ/Objects.gif")
	SpriteFrame(-7, 2, 14, 8, 1, 1)
	SpriteFrame(-7, 0, 14, 8, 1, 1)
	SpriteFrame(-7, -2, 14, 8, 1, 1)
	SpriteFrame(-7, -4, 14, 8, 1, 1)
	SpriteFrame(-11, -4, 22, 8, 1, 10)
	SpriteFrame(-14, -4, 27, 8, 1, 19)
	SpriteFrame(0, 0, 1, 1, 1, 1)
	foreach (TypeName[Lava Bubble], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].drawOrder = 4
	next
	SetTableValue(TypeName[Lava Bubble], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(LavaBubble_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(LavaBubble_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
