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

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

private alias object.value0 : object.ringCount

// Player Aliases
private alias object.value0 : player.rings


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

event ObjectStartup
	temp0 = 0
	
	// Find all SetRingCount objects in the level, look at their held Ring Count
	foreach (TypeName[SetRingCount], arrayPos0, ALL_ENTITIES)
		if temp0 == 0
			temp0 = object[arrayPos0].ringCount
		end if
	next
	
	// And then give the Player as much rings as the Object demands
	if temp0 != 0
		player[0].rings = temp0
	end if
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("Global/Items.gif")
	SpriteFrame(-8, -8, 16, 16, 1, 1)
	
	SetVariableAlias(ALIAS_VAR_VAL0, "ringCount")
end event
