Path: blob/master/Sonic 1/Scripts/LZ/SBZ3Exit.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: SBZ3 Exit Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer1213// Player values14private alias object.type : player.type15private alias object.groupID : player.groupID16private alias object.controlMode : player.controlMode17private alias object.animation : player.animation18private alias object.direction : player.direction19private alias object.value0 : player.rings2021private alias 0 : SBZ3EXIT_WAIT22private alias 1 : SBZ3EXIT_FINISH_NORMAL23private alias 2 : SBZ3EXIT_FINISH_TATTACK2425// Game Modes26private alias 0 : MODE_NOSAVE27private alias 1 : MODE_SAVEGAME28private alias 2 : MODE_TIMEATTACK2930// Tracks31private alias 1 : TRACK_ACTFINISH3233// Reserved Object Slot Aliases34private alias 30 : SLOT_ACTFINISH353637// ========================38// Events39// ========================4041event ObjectUpdate42switch object.state43case SBZ3EXIT_WAIT44// Check for player collision45BoxCollisionTest(C_TOUCH, object.entityPos, -128, -16, 128, 16, 0, C_BOX, C_BOX, C_BOX, C_BOX)46if checkResult == true47// First, erase the player object (by turning them into a ring!)48player[0].type = TypeName[Ring]49player[0].groupID = TypeName[Blank Object]50player[0].controlMode = CONTROLMODE_NONE5152#platform: USE_STANDALONE53//Check for time attack54if options.gameMode == MODE_TIMEATTACK55#endplatform56#platform: USE_ORIGINS57CheckEqual(options.gameMode, MODE_TIMEATTACK)58temp0 = checkResult59CheckNotEqual(game.oneStageFlag, false)60temp0 |= checkResult61if temp0 != false62#endplatform63// Go into special time attack variant (Origins uses it too for single-stage mode)64object.state = SBZ3EXIT_FINISH_TATTACK65stage.timeEnabled = false66else67// Normal variant68object.state++ // SBZ3EXIT_FINISH_NORMAL69end if7071recAnimation = 072temp0 = 073foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)74temp1 = player[currentPlayer].animation75temp1 <<= 876temp1 |= player[currentPlayer].direction77temp1 <<= temp07879recAnimation |= temp180temp0 += 1681next82end if83break8485case SBZ3EXIT_FINISH_NORMAL86// Normal variant - start fading out87if object.timer < 51288object.timer += 889music.volume -= 290else91#platform: USE_ORIGINS92CallNativeFunction4(NotifyCallback, NOTIFY_STATS_ENEMY, StageStatsUsabilityParam1, StageStatsUsabilityParam2, StageStatsUsabilityParam3)93CallNativeFunction2(NotifyCallback, NOTIFY_STATS_RING, player[0].rings)94CallNativeFunction2(NotifyCallback, NOTIFY_ACT_FINISH, 0)95StageStatsUsabilityParam1 = 096StageStatsUsabilityParam2 = 097StageStatsUsabilityParam3 = 098StageStatsUsabilityParam4 = 099StageStatsUsabilityParam5 = 0100StatsUsabilityParam1 = 0101StatsUsabilityParam2 = 0102StatsUsabilityParam3 = 0103StatsUsabilityParam4 = 0104StatsUsabilityParam5 = 0105#endplatform106107// Fade done, go to SBZ3108object.direction = FACING_RIGHT // ???109lampPostID = 0110stage.listPos++111112if options.gameMode == MODE_SAVEGAME113// There aren't any act results in this stage so save the game here (even if already on a completed save...)114arrayPos1 = options.saveSlot115arrayPos1 <<= 3116if stage.player2Enabled == true117#platform: USE_STANDALONE118saveRAM[arrayPos1] = PLAYER_SONIC_TAILS_A119#endplatform120#platform: USE_ORIGINS121switch stage.playerListPos122case PLAYER_SONIC_A123saveRAM[arrayPos1] = PLAYER_SONIC_TAILS124break125case PLAYER_AMY_A126saveRAM[arrayPos1] = PLAYER_AMY_TAILS127break128end switch129#endplatform130else131saveRAM[arrayPos1] = stage.playerListPos132end if133arrayPos1++134saveRAM[arrayPos1] = player.lives135arrayPos1++136saveRAM[arrayPos1] = player.score137arrayPos1++138saveRAM[arrayPos1] = player.scoreBonus139arrayPos1++140141// Bug Details:142// This is missing the check for if your save file is already past the next act143// This means the save file's act will be overwritten to Final Zone, even if you're on a Complete save file...144saveRAM[arrayPos1] = stage.listPos145saveRAM[arrayPos1]++146147arrayPos1++148saveRAM[arrayPos1] = specialStage.emeralds149arrayPos1++150saveRAM[arrayPos1] = specialStage.listPos151152WriteSaveRAM()153end if154155LoadStage()156end if157158SetScreenFade(0, 0, 0, object.timer)159break160161case SBZ3EXIT_FINISH_TATTACK162// Time attack variant - no fade out and instead show Act Results after a second163// Origins also uses this to display results when not in normal gameplay164165if object.timer < 60166object.timer++167music.volume -= 2168else169object.type = TypeName[Blank Object]170171object[SLOT_ACTFINISH].type = TypeName[Act Finish]172object[SLOT_ACTFINISH].drawOrder = 6173object[SLOT_ACTFINISH].priority = PRIORITY_ACTIVE174PlayMusic(TRACK_ACTFINISH)175end if176break177178end switch179end event180181182// ========================183// Editor Events184// ========================185186event RSDKDraw187DrawSprite(0)188end event189190191event RSDKLoad192LoadSpriteSheet("Global/Display.gif")193SpriteFrame(-8, -8, 16, 16, 239, 239) // "Trigger" - #0194195SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")196end event197198199