Path: blob/master/Sonic 2/Scripts/Title/Sega.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Sega Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value2 : object.trailPos.x13private alias object.value3 : object.levelSelectCheatPos14private alias object.value4 : object.anyCheatDone15private alias object.value5 : object.regionSwitchCheatPos1617// States18private alias 0 : SEGA_SETUP19private alias 1 : SEGA_FADEIN20private alias 2 : SEGA_SONICRUN_LEFT21private alias 3 : SEGA_FADEOUTTRAIL_LEFT22private alias 4 : SEGA_SONICRUN_RIGHT23private alias 5 : SEGA_FADEOUTTRAIL_RIGHT24private alias 6 : SEGA_SHOWSEGALOGO25private alias 7 : SEGA_FADETOTITLE2627// Game Modes28private alias 0 : MODE_NOSAVE2930// Priority31public alias 0 : PRIORITY_BOUNDS32public alias 1 : PRIORITY_ACTIVE33public alias 2 : PRIORITY_ALWAYS34public alias 3 : PRIORITY_XBOUNDS35public alias 4 : PRIORITY_XBOUNDS_DESTROY36public alias 5 : PRIORITY_INACTIVE37public alias 6 : PRIORITY_BOUNDS_SMALL38public alias 7 : PRIORITY_ACTIVE_SMALL3940// Ink Effects41public alias 0 : INK_NONE42public alias 1 : INK_BLEND43public alias 2 : INK_ALPHA44public alias 3 : INK_ADD45public alias 4 : INK_SUB4647// Flip Directions48public alias 0 : FLIP_NONE49public alias 1 : FLIP_X50public alias 2 : FLIP_Y51public alias 3 : FLIP_XY5253// Player List Pos Aliases54private alias 2 : PLAYER_KNUCKLES_A555657// ========================58// Function Declarations59// ========================6061reserve function Sega_CheckTouchCheatCodes626364// ========================65// Function Definitions66// ========================6768private function Sega_CheckTouchCheatCodes69CheckTouchRect(0, 0, screen.xsize, screen.ysize)70if checkResult == -171object.anyCheatDone = 072end if7374if object.anyCheatDone == false75temp0 = screen.xcenter76switch object.levelSelectCheatPos77case 078temp0 -= 9379temp1 = temp080temp1 += 3981break8283case 184temp0 -= 5085temp1 = temp086temp1 += 4287break8889case 290temp0 -= 691temp1 = temp092temp1 += 4293break9495case 396temp0 += 3697temp1 = temp098temp1 += 5899break100101end switch102103CheckTouchRect(temp0, 90, temp1, 150)104if checkResult > -1105object.anyCheatDone = true106object.levelSelectCheatPos++107if object.levelSelectCheatPos == 4108if options.gameMode == MODE_NOSAVE109PlaySfx(SfxName[Ring L], false)110options.stageSelectFlag = true111end if112end if113end if114115temp0 = screen.xcenter116switch object.regionSwitchCheatPos117case 0118temp0 += 36119temp1 = temp0120temp1 += 58121break122123case 1124temp0 -= 6125temp1 = temp0126temp1 += 42127break128129case 2130temp0 -= 50131temp1 = temp0132temp1 += 42133break134135case 3136temp0 -= 93137temp1 = temp0138temp1 += 39139break140141end switch142143CheckTouchRect(temp0, 90, temp1, 150)144if checkResult > -1145object.anyCheatDone = true146object.regionSwitchCheatPos++147if object.regionSwitchCheatPos == 4148PlaySfx(SfxName[Ring L], false)149options.region ^= 1150end if151end if152end if153end function154155156// ========================157// Events158// ========================159160event ObjectUpdate161#platform: USE_ORIGINS162if game.titleMode != false163// If we're returning to the title, just skip the Sega screen and head straight for the actual Title164game.titleMode = false165ResetObjectEntity(object.entityPos, TypeName[ST Logo], 0, object.xpos, object.ypos)166else167#endplatform168switch object.state169case SEGA_SETUP170object.alpha = 0x00171object.inkEffect = 2172object.timer = 320173SetScreenFade(0x00, 0x00, 0x00, object.timer)174object.state++175break176177case SEGA_FADEIN178if object.timer > 0179object.timer -= 8180else181object.direction = FACING_LEFT182object.alpha = 0x100183object.trailPos.x = 256184object.state++185end if186SetScreenFade(0x00, 0x00, 0x00, object.timer)187break188189case SEGA_SONICRUN_LEFT190object.frame++191object.frame &= 3192193if object.trailPos.x > -320194object.trailPos.x -= 32195else196object.direction = FACING_RIGHT197object.state++198end if199break200201case SEGA_FADEOUTTRAIL_LEFT202if object.alpha > -0x40203object.alpha -= 0x10204else205object.state++206end if207break208209case SEGA_SONICRUN_RIGHT210object.frame++211object.frame &= 3212213if object.trailPos.x < 320214object.trailPos.x += 32215else216object.alpha = 0x100217object.state++218end if219break220221case SEGA_FADEOUTTRAIL_RIGHT222if object.alpha > -0x40223object.alpha -= 0x10224else225object.state++226end if227break228229case SEGA_SHOWSEGALOGO230object.timer++231if object.timer == 160232object.timer = 0233object.state = SEGA_FADETOTITLE234end if235236if object.timer == 2237PlaySfx(SfxName[Sega Chant], false)238end if239#platform: USE_STANDALONE240CallFunction(Sega_CheckTouchCheatCodes)241#endplatform242break243244case SEGA_FADETOTITLE245if object.timer < 0x100246object.timer += 8247SetScreenFade(0x00, 0x00, 0x00, object.timer)248else249if stage.playerListPos == PLAYER_KNUCKLES_A250ResetObjectEntity(object.entityPos, TypeName[K Logo], 0, object.xpos, object.ypos)251else252ResetObjectEntity(object.entityPos, TypeName[ST Screen], 0, object.xpos, object.ypos)253end if254SetScreenFade(0x00, 0x00, 0x00, 0xFF)255end if256break257258end switch259#platform: USE_ORIGINS260end if // game.titleMode == false check from up above261#endplatform262end event263264265event ObjectDraw266DrawRect(0, 0, screen.xsize, screen.ysize, 0xE0, 0xE0, 0xE0, 0xFF)267268switch object.state269default270case SEGA_SETUP271case SEGA_FADEIN272break273274case SEGA_SONICRUN_LEFT275temp0 = object.trailPos.x276temp0 += screen.xcenter277DrawSpriteScreenFX(4, FX_FLIP, temp0, 121)278DrawSpriteScreenFX(5, FX_FLIP, temp0, 121)279DrawSpriteScreenFX(6, FX_FLIP, temp0, 121)280DrawSpriteScreenFX(object.frame, FX_FLIP, temp0, screen.ycenter)281break282283case SEGA_FADEOUTTRAIL_LEFT284DrawSpriteScreenFX(7, FX_INK, 0, 121)285DrawSpriteScreenFX(8, FX_INK, 0, 121)286DrawSpriteScreenFX(9, FX_INK, 0, 121)287288temp0 = object.alpha289object.alpha = 256290object.alpha -= temp0291DrawSpriteScreenFX(10, FX_INK, screen.xcenter, screen.ycenter)292293object.alpha = temp0294break295296case SEGA_SONICRUN_RIGHT297temp0 = object.trailPos.x298temp0 += screen.xcenter299DrawSpriteScreenFX(4, FX_FLIP, temp0, 120)300DrawSpriteScreenFX(5, FX_FLIP, temp0, 120)301DrawSpriteScreenFX(6, FX_FLIP, temp0, 120)302DrawSpriteScreenXY(10, screen.xcenter, screen.ycenter)303304DrawSpriteScreenFX(object.frame, FX_FLIP, temp0, screen.ycenter)305break306307case SEGA_FADEOUTTRAIL_RIGHT308DrawSpriteScreenFX(7, FX_INK, 0, 120)309DrawSpriteScreenFX(8, FX_INK, 0, 120)310DrawSpriteScreenFX(9, FX_INK, 0, 120)311312DrawSpriteScreenXY(11, screen.xcenter, screen.ycenter)313break314315case SEGA_SHOWSEGALOGO316case SEGA_FADETOTITLE317DrawSpriteScreenXY(11, screen.xcenter, screen.ycenter)318break319320end switch321end event322323324event ObjectStartup325LoadSpriteSheet("Title/Title.gif")326SpriteFrame(-31, -36, 62, 72, 1, 226) // Sonic Run - Frame 1 - #0327SpriteFrame(-31, -36, 62, 72, 64, 226) // Sonic Run - Frame 2 - #1328SpriteFrame(-29, -36, 60, 72, 127, 226) // Sonic Run - Frame 3 - #2329SpriteFrame(-31, -36, 62, 72, 188, 226) // Sonic Run - Frame 4 - #3330SpriteFrame(-192, -35, 256, 70, 1, 299) // Sonic Trail (Full) - #4331SpriteFrame(-384, -35, 192, 70, 1, 299) // Sonic Trail - Frame 1 - #5332SpriteFrame(-576, -35, 192, 70, 1, 299) // Sonic Trail - Frame 2 - #6333SpriteFrame(0, -35, 192, 70, 1, 299) // Sonic Trail - Frame 3 - #7334SpriteFrame(192, -35, 192, 70, 1, 299) // Sonic Trail - Frame 4 - #8335SpriteFrame(384, -35, 192, 70, 1, 299) // Sonic Trail - Frame 5 - #9336SpriteFrame(-93, -29, 188, 58, 323, 297) // Sega Logo (Interlaced) - #10337SpriteFrame(-93, -29, 188, 58, 323, 238) // Sega Logo - #11338339// Hide touch controls340options.touchControls = false341end event342343344// ========================345// Editor Events346// ========================347348event RSDKDraw349DrawSprite(0)350end event351352353event RSDKLoad354LoadSpriteSheet("Title/Title.gif")355SpriteFrame(-93, -29, 188, 58, 323, 238) // Sega Logo - #0356357SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")358end event359360361