Path: blob/master/Sonic 1/Scripts/Special/1UP.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: 1UP Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011// Music Events12private alias 25 : SLOT_MUSICEVENT_CHANGE1314private alias 2 : MUSICEVENT_TRANSITION151617// ========================18// Function Declarations19// ========================2021reserve function 1UP_DebugDraw22reserve function 1UP_DebugSpawn232425// ========================26// Function Definitions27// ========================2829private function 1UP_DebugDraw30// Bug Details: really minor bug, but31// -> This doesn't account for Amy, so Amy's object placement mode shows 1UPs as Warp Blocks32// (The object appears properly once it's placed, though, so)33DrawSprite(stage.playerListPos)34end function353637private function 1UP_DebugSpawn38temp5 = TypeName[1UP]39temp4 = 040CallFunction(DebugMode_PlaceBlock)41object[arrayPos0].drawOrder = 442end function434445// ========================46// Events47// ========================4849event ObjectUpdate50// Interact with player(s)51foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)5253BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)54if checkResult == true55// Make the object disappear56object.type = TypeName[Ring Sparkle]5758// Give an extra life59if options.gameMode != MODE_TIMEATTACK60#platform: USE_STANDALONE61player.lives++62#endplatform63#platform: USE_ORIGINS64if game.coinMode == false65player.lives++66else67CallNativeFunction2(NotifyCallback, NOTIFY_ADD_COIN, 1)68end if69#endplatform70PlaySfx(SfxName[Life], false)71PauseMusic()72ResetObjectEntity(SLOT_MUSICEVENT_CHANGE, TypeName[Music Event], MUSICEVENT_TRANSITION, 0, 0)73object[SLOT_MUSICEVENT_CHANGE].priority = PRIORITY_ACTIVE74end if75end if76next77end event787980event ObjectDraw81CallFunction(SpecialSetup_GetBlockPos)82#platform: USE_STANDALONE83DrawSpriteXY(stage.playerListPos, temp0, temp1)84#endplatform85#platform: USE_ORIGINS86switch stage.playerListPos87case PLAYER_SONIC_A88case PLAYER_SONIC_TAILS_A89DrawSpriteXY(0, temp0, temp1)90break91case PLAYER_TAILS_A92DrawSpriteXY(1, temp0, temp1)93break94case PLAYER_KNUCKLES_A95case PLAYER_KNUCKLES_TAILS_A // but K+T isn't even in Origins..?96DrawSpriteXY(2, temp0, temp1)97break98case PLAYER_AMY_A99DrawSpriteXY(3, temp0, temp1)100break101end switch102#endplatform103104end event105106107event ObjectStartup108LoadSpriteSheet("Special/Objects.gif")109110// Loop through all objects, view this as a foreach111arrayPos0 = 0x20112while arrayPos0 < 0x420113if object[arrayPos0].type == TypeName[1UP]114object[arrayPos0].drawOrder = 4115end if116117arrayPos0++118loop119120// Sprite frames: In order of Sonic icon, Tails icon, Knuckles icon, and Amy icon (Origins Plus)121SpriteFrame(-12, -12, 24, 24, 251, 176)122SpriteFrame(-12, -12, 24, 24, 351, 276)123SpriteFrame(-12, -12, 24, 24, 376, 276)124#platform: USE_ORIGINS125SpriteFrame(-12, -12, 24, 24, 105, 492)126#endplatform127128// Add this object to the stage's debug mode list129SetTableValue(TypeName[1UP], DebugMode_ObjCount, DebugMode_TypeTable)130SetTableValue(1UP_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)131SetTableValue(1UP_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)132DebugMode_ObjCount++133end event134135136// ========================137// Editor Events138// ========================139140event RSDKDraw141DrawSprite(0)142end event143144145event RSDKLoad146LoadSpriteSheet("Special/Objects.gif")147SpriteFrame(-12, -12, 24, 24, 251, 176)148149SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")150end event151152153