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

//-------Aliases-------//
private alias 65 : TYPE_LAVAJUMP


// Static Values

// Tables

event ObjectMain
	object.xpos += object.xvel
	object.ypos += object.yvel
	object.yvel += 0x3800
	if object.yvel >= 0
		object.direction |= FLIP_Y
	end if
	ObjectTileCollision(CSIDE_FLOOR, 0, 8, 0)
	if checkResult == 1
		PlaySfx(SfxName[Flame Thrower], 0)
		CreateTempObject(TypeName[Ground Flame], 0, object.xpos, object.ypos)
		object[tempObjectPos].value0 = 3
		if object.xvel < 0
			object[tempObjectPos].direction = FLIP_NONE
			object[tempObjectPos].xpos -= 0x20000
		else
			object[tempObjectPos].direction = FLIP_X
			object[tempObjectPos].xpos += 0x20000
		end if
		object.type = TypeName[Blank Object]
	end if
	object.frame = object.animationTimer
	object.frame >>= 2
	object.animationTimer++
	object.animationTimer &= 7
	if object.outOfBounds == 1
		object.type = TypeName[Blank Object]
	end if
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		if checkResult == 1
			CallFunction(PlayerObject_FireHit)
		end if
	next
end event


event ObjectDraw
	DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
end event


event ObjectStartup
	CheckCurrentStageFolder("Zone05")
	if checkResult == 1
		LoadSpriteSheet("HTZ/Objects.gif")
		SpriteFrame(-8, -8, 15, 15, 91, 123)
		SpriteFrame(-8, -8, 13, 15, 91, 140)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-8, -8, 15, 15, 91, 123)
		SpriteFrame(-8, -8, 13, 15, 91, 140)
	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
