Path: blob/master/Sonic 2/Scripts/Mission/FallSignPost.txt
1478 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: FallSignPost Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011// Variables12// Just like the normal Sign Post, value0 is unused13private alias object.value1 : object.spinCount14private alias object.value2 : object.spinTimer15// value3 is kinda unused - it's reset by Eggman SignPost, but doesn't see much use beyond that16private alias object.value4 : object.signpostCharYPos1718// States19private alias 0 : FALLSIGNPOST_AWAITMISSIONCLEAR20private alias 1 : FALLSIGNPOST_FALLTOGROUND21private alias 2 : FALLSIGNPOST_SPINNINGONGROUND22private alias 3 : FALLSIGNPOST_RESETSIGNPOST23private alias 4 : FALLSIGNPOST_LANDONGROUND2425// Path ID Aliases26private alias 0 : PATH_A272829// ========================30// Events31// ========================3233event ObjectUpdate34switch object.state35case FALLSIGNPOST_AWAITMISSIONCLEAR36if game.missionCondition == MISSION_CONDITION_CLEAR37game.missionCondition = 038object.xpos = screen.xoffset39object.xpos += screen.xcenter40object.xpos <<= 1641object.ypos = screen.yoffset42object.ypos += 2443object.ypos <<= 1644screen.cameraStyle = CAMERASTYLE_HLOCKED // Huh? They lock the camera like this?45object.state = FALLSIGNPOST_FALLTOGROUND46end if47break4849case FALLSIGNPOST_FALLTOGROUND50// Fall down51object.xpos += object.xvel52object.ypos += object.yvel53object.yvel += 0xC005455// Check if we hit the ground and stop falling if we did56ObjectTileCollision(CSIDE_FLOOR, 0, 32, PATH_A)57if checkResult == true58PlaySfx(SfxName[Sliding], false)59object.spinCount = 460object.state = FALLSIGNPOST_SPINNINGONGROUND61end if6263// Spin!!64object.spinTimer++65if object.spinTimer == 266object.spinTimer = 067object.frame++68if object.frame == 569Rand(temp0, 48)70temp0 <<= 1671temp0 += object.xpos72temp0 -= 0x18000073Rand(temp1, 32)74temp1 <<= 1675temp1 += object.ypos76temp1 -= 0x14000077CreateTempObject(TypeName[Ring Sparkle], 0, temp0, temp1)78end if7980if object.frame == 981object.frame = 182Rand(temp0, 48)83temp0 <<= 1684temp0 += object.xpos85temp0 -= 0x18000086Rand(temp1, 32)87temp1 <<= 1688temp1 += object.ypos89temp1 -= 0x1400009091object.signpostCharYPos += 3392if object.signpostCharYPos > 6793object.signpostCharYPos = 194end if95EditFrame(5, -24, -16, 48, 32, 34, object.signpostCharYPos)9697CreateTempObject(TypeName[Ring Sparkle], 0, temp0, temp1)98end if99end if100break101102case FALLSIGNPOST_SPINNINGONGROUND103music.volume -= 2104object.spinTimer++105if object.spinTimer == 2106object.spinTimer = 0107108object.frame++109if object.frame == 5110Rand(temp0, 48)111temp0 <<= 16112temp0 += object.xpos113temp0 -= 0x180000114Rand(temp1, 32)115temp1 <<= 16116temp1 += object.ypos117temp1 -= 0x140000118CreateTempObject(TypeName[Ring Sparkle], 0, temp0, temp1)119end if120121if object.frame == 9122Rand(temp0, 48)123temp0 <<= 16124temp0 += object.xpos125temp0 -= 0x180000126Rand(temp1, 32)127temp1 <<= 16128temp1 += object.ypos129temp1 -= 0x140000130131object.signpostCharYPos += 33132if object.signpostCharYPos > 67133object.signpostCharYPos = 1134end if135EditFrame(5, -24, -16, 48, 32, 34, object.signpostCharYPos)136137CreateTempObject(TypeName[Ring Sparkle], 0, temp0, temp1)138139object.spinCount--140if object.spinCount == 0141object.frame = 5142object.state = FALLSIGNPOST_RESETSIGNPOST143else144object.frame = 1145end if146end if147end if148break149150case FALLSIGNPOST_RESETSIGNPOST151ResetObjectEntity(object.entityPos, TypeName[Sign Post], 0, object.xpos, object.ypos) // Become a real Sign Post!152object.frame = 1153object.spinCount = 16154object.priority = PRIORITY_XBOUNDS155break156157case FALLSIGNPOST_LANDONGROUND // Only set by other objects such as Eggman Sign Post158PlaySfx(SfxName[Sliding], false)159object.spinCount = 4160object.state = FALLSIGNPOST_SPINNINGONGROUND161break162163end switch164end event165166167event ObjectDraw168if object.state > FALLSIGNPOST_AWAITMISSIONCLEAR169DrawSprite(0)170if object.spinCount > 8171DrawSprite(object.frame)172else173temp0 = object.frame174temp0 += 4175DrawSprite(temp0)176end if177end if178end event179180181event ObjectStartup182LoadSpriteSheet("Global/Items2.gif")183SpriteFrame(-24, 16, 48, 16, 34, 132)184SpriteFrame(-24, -16, 48, 32, 34, 100)185SpriteFrame(-16, -16, 32, 32, 149, 99)186SpriteFrame(-4, -16, 8, 32, 247, 2)187SpriteFrame(-16, -16, 32, 32, 116, 99)188SpriteFrame(-24, -16, 48, 32, 34, 1)189SpriteFrame(-16, -16, 32, 32, 149, 99)190SpriteFrame(-4, -16, 8, 32, 247, 2)191SpriteFrame(-16, -16, 32, 32, 116, 99)192193foreach (TypeName[FallSignPost], arrayPos0, ALL_ENTITIES)194object[arrayPos0].frame = 1195object[arrayPos0].spinCount = 16196object[arrayPos0].priority = PRIORITY_ACTIVE197next198end event199200201// ========================202// Editor Events203// ========================204205event RSDKDraw206DrawSprite(0)207DrawSprite(1)208end event209210211event RSDKLoad212LoadSpriteSheet("Global/Items2.gif")213SpriteFrame(-24, 16, 48, 16, 34, 132)214SpriteFrame(-24, -16, 48, 32, 34, 100)215216SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")217end event218219220