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

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

private alias object.value1  : object.localPos.x // unused, required for halfpipe stuff though
private alias object.value2  : object.localPos.y // unused, required for halfpipe stuff though
private alias object.value3  : object.localPos.z
private alias object.value4  : object.worldPos.x // unused, required for halfpipe stuff though
private alias object.value5  : object.worldPos.y // unused, required for halfpipe stuff though
private alias object.value6  : object.worldPos.z // unused, required for halfpipe stuff though

// Text Message Property Values
private alias 3 : TEXTMESSAGE_RINGREMINDER

// Player Aliases
private alias object.value14 : player.localPos.z


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

event ObjectUpdate
	foreach (TypeName[Player Object], currentPlayer, ACTIVE_ENTITIES)
		temp1 = object.localPos.z
		temp1 -= 0x20000
		temp2 = object.localPos.z
		temp2 += 0x20000
		if player[currentPlayer].localPos.z > temp1
			if player[currentPlayer].localPos.z < temp2
				ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, 0, 0)
				ResetObjectEntity(11, TypeName[Text Message], TEXTMESSAGE_RINGREMINDER, 0, 0)
				object[11].priority = PRIORITY_ACTIVE
#platform: USE_STANDALONE
				object[11].drawOrder = 5
#endplatform
#platform: USE_ORIGINS
				object[11].drawOrder = 6
#endplatform
			end if
		end if
	next
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("Special/Objects.gif")
	SpriteFrame(-8, -8, 16, 16, 348, 83)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
