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

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

reserve function StaticBlock_DebugDraw
reserve function StaticBlock_DebugSpawn


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

private function StaticBlock_DebugDraw
	DrawSprite(0)
end function


private function StaticBlock_DebugSpawn
	CreateTempObject(TypeName[Static Block], 0, object.xpos, object.ypos)
end function


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

event ObjectUpdate
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		// Just act as a small box for the player
		BoxCollisionTest(C_SOLID, object.entityPos, -16, -16, 16, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
	next
end event


event ObjectDraw
	// Interesting note - this object has its Y direction flipped one time in the Act 1 scene file,
	// but the drawing here just uses the standard sprite drawing function rather than FX_FLIP.
	// I wonder what's up with that...

	DrawSprite(0)
end event


event ObjectStartup
	LoadSpriteSheet("MCZ/Objects.gif")
	
	// 0 - Wood post frame
	SpriteFrame(-16, -16, 32, 32, 70, 0)
	
	// Add this object to the debug item list
	SetTableValue(TypeName[Static Block], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(StaticBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(StaticBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("MCZ/Objects.gif")
	SpriteFrame(-16, -16, 32, 32, 70, 0)

	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
