Path: blob/master/Sonic 1/Scripts/Global/LoseRing.txt
1482 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Lose Ring Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value1 : object.targetPlayer1314private alias 0 : LOSERING_TYPE_HIGH15private alias 1 : LOSERING_TYPE_LOW1617// Player aliases18private alias object.state : player.state19private alias object.value0 : player.rings2021// Game Mode Aliases22private alias 2 : MODE_TIMEATTACK2324// Music Events25private alias 25 : SLOT_MUSICEVENT_CHANGE2627private alias 2 : MUSICEVENT_TRANSITION2829// Achievement Aliases30private alias 4 : ACHIEVEMENT_RINGKING3132// Path ID Aliases33private alias 0 : PATH_A343536// ========================37// Events38// ========================3940event ObjectUpdate41object.yvel += 0x180042object.xpos += object.xvel43object.ypos += object.yvel4445if object.yvel >= 046ObjectTileCollision(CSIDE_FLOOR, 0, 8, PATH_A)47if checkResult == true48temp0 = object.yvel49temp0 >>= 250object.yvel -= temp051FlipSign(object.yvel)52if object.yvel > -0x1000053object.yvel = -0x1000054end if55end if56end if5758object.timer++59if object.timer == 25660object.type = TypeName[Blank Object]61object.xvel = 062object.yvel = 063object.timer = 064else65object.animationTimer += object.animationSpeed66if object.animationTimer >= 0x10067object.animationTimer -= 0x10068object.frame++69if object.frame == 870object.frame = 071if object.animationSpeed > 1672object.animationSpeed -= 1673end if74end if75end if7677if object.timer >= 24078object.alpha -= 1679end if80end if8182if object.timer >= 6483foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)84CheckEqual(player[currentPlayer].state, Player_State_Hurt)85temp0 = checkResult86CheckEqual(player[currentPlayer].state, Player_State_GotHit)87temp0 |= checkResult88if temp0 == false89BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)90if checkResult == true91object.type = TypeName[Ring Sparkle]92if object.propertyValue == LOSERING_TYPE_HIGH93object.drawOrder = 494else95object.drawOrder = 296end if97object.timer = 098object.targetPlayer = 099object.timer = 0100object.frame = 0101player[0].rings++102if player[0].rings > 999103// What the...?104// this is meant to be "player[0].rings" right...? we dont need to set this obj's value0 to 999...105player.rings = 999106end if107108if player[0].rings >= ringExtraLife109if options.gameMode != MODE_TIMEATTACK110#platform: USE_ORIGINS111if game.coinMode == false112player.lives++113else114CallNativeFunction2(NotifyCallback, NOTIFY_ADD_COIN, 1)115end if116#endplatform117#platform: USE_STANDALONE118player.lives++119#endplatform120PlaySfx(SfxName[Life], false)121PauseMusic()122ResetObjectEntity(SLOT_MUSICEVENT_CHANGE, TypeName[Music Event], MUSICEVENT_TRANSITION, 0, 0)123object[SLOT_MUSICEVENT_CHANGE].priority = PRIORITY_ACTIVE124125ringExtraLife += 100126if ringExtraLife > 300127ringExtraLife = 1000128end if129end if130131if stage.debugMode == false132if player[0].rings >= 200133// Grant the "Ring King" Achievement134CallNativeFunction2(SetAchievement, ACHIEVEMENT_RINGKING, 100)135end if136end if137end if138139if ringPan == 0140PlaySfx(SfxName[Ring L], false)141SetSfxAttributes(SfxName[Ring L], -1, -100)142ringPan = 1143else144PlaySfx(SfxName[Ring R], false)145SetSfxAttributes(SfxName[Ring R], -1, 100)146ringPan = 0147end if148end if149end if150next151end if152end event153154155event ObjectDraw156DrawSpriteFX(object.frame, FX_INK, object.xpos, object.ypos)157end event158159160event ObjectStartup161LoadSpriteSheet("Global/Items.gif")162163// Ring Frames, they're the same as the standard Ring object sprites164SpriteFrame(-8, -8, 16, 16, 1, 1)165SpriteFrame(-8, -8, 16, 16, 1, 18)166SpriteFrame(-8, -8, 16, 16, 1, 35)167SpriteFrame(-8, -8, 16, 16, 1, 52)168SpriteFrame(-8, -8, 16, 16, 1, 69)169SpriteFrame(-8, -8, 16, 16, 1, 86)170SpriteFrame(-8, -8, 16, 16, 1, 103)171SpriteFrame(-8, -8, 16, 16, 1, 120)172end event173174// ========================175// Editor Events176// ========================177178event RSDKDraw179DrawSprite(0)180end event181182183event RSDKLoad184LoadSpriteSheet("Global/Items.gif")185SpriteFrame(-8, -8, 16, 16, 1, 1)186187// Although used by the object, it shouldn't be set here188SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")189end event190191192