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

// ========================
// Function Declarations
// ========================

reserve function Rock_DebugDraw
reserve function Rock_DebugSpawn


// ========================
// Function Definitions
// ========================

private function Rock_DebugDraw
	DrawSprite(0)
end function


private function Rock_DebugSpawn
	CreateTempObject(TypeName[Rock], 0, object.xpos, object.ypos)
end function


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

event ObjectUpdate
	// Rocks don't do much, just check interaction with players
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_SOLID, object.entityPos, -16, -16, 16, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
	next
end event


event ObjectDraw
	DrawSprite(0)
end event


event ObjectStartup
	LoadSpriteSheet("GHZ/Objects.gif")
	SpriteFrame(-24, -16, 48, 32, 1, 18)
	
	SetTableValue(TypeName[Rock], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(Rock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(Rock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("GHZ/Objects.gif")
	SpriteFrame(-24, -16, 48, 32, 1, 18)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
