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

//-------Aliases-------//
private alias 69 : TYPE_FIREBALL

// Function declarations
reserve function Fireball_DebugDraw
reserve function Fireball_DebugSpawn

// Static Values

// Tables

function Fireball_DebugDraw
	DrawSprite(0)
end function


function Fireball_DebugSpawn
	CreateTempObject(TypeName[Fireball], 0, object.xpos, object.ypos)
end function


event ObjectMain
	object.drawOrder = 5
	object.animationTimer++
	if object.animationTimer >= 12
		object.animationTimer = 0
	end if
	object.frame = object.animationTimer
	object.frame >>= 2
	GetBit(object.direction, object.animationTimer, 1)
	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
	LoadSpriteSheet("CPZ/Objects.gif")
	SpriteFrame(-6, -23, 12, 28, 5, 161)
	SpriteFrame(-6, -26, 13, 31, 18, 158)
	SpriteFrame(-5, -27, 14, 32, 32, 157)
	SetTableValue(TypeName[Fireball], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(Fireball_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(Fireball_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
