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

// ========================
// Aliases
// ========================

// Player Aliases
private alias object.value17 : debugMode.currentSelection


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

reserve function Accessory_DebugDraw
reserve function Accessory_DebugSpawn


// ========================
// Static Values
// ========================

private value Accessory_debugStartID = 0


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

private function Accessory_DebugDraw
	temp0 = debugMode[0].currentSelection
	temp0 -= Accessory_debugStartID

	DrawSprite(temp0)
end function


private function Accessory_DebugSpawn
	temp0 = debugMode[0].currentSelection
	temp0 -= Accessory_debugStartID

	CreateTempObject(TypeName[Accessory], temp0, object.xpos, object.ypos)
end function


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

event ObjectUpdate
	// Empty event :(
end event


event ObjectDraw
	DrawSprite(object.propertyValue)
end event


event ObjectStartup
	LoadSpriteSheet("CPZ/Objects.gif")
	
	// These are some unused metal poles from the original S2 release
	
	// Wide Frame
	SpriteFrame(-8, -48, 16, 48, 198, 207)
	
	// Slim Frame
	SpriteFrame(-4, -40, 8, 39, 215, 216)

	temp0 = 0
	Accessory_debugStartID = DebugMode_ObjCount
	while temp0 < 2
		SetTableValue(TypeName[Accessory], DebugMode_ObjCount, DebugMode_TypesTable)
		SetTableValue(Accessory_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
		SetTableValue(Accessory_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
		DebugMode_ObjCount++
		temp0++
	loop
end event


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

event RSDKDraw
	DrawSprite(object.propertyValue)
end event


event RSDKLoad
	LoadSpriteSheet("CPZ/Objects.gif")
	SpriteFrame(-8, -48, 16, 48, 198, 207)
	SpriteFrame(-4, -40, 8, 39, 215, 216)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "frameID")
end event
