Path: blob/main/Scripts/R6/MovingBlocks2.txt
1319 views
//--------------Sonic CD Moving Blocks 2 Script---------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.BlockXPos_16#alias Object.Value1 : Object.BlockYPos_17#alias Object.Value2 : Object.BlockXPos_28#alias Object.Value3 : Object.BlockYPos_29#alias Object.Value4 : Object.BlockXPos_310#alias Object.Value5 : Object.BlockYPos_311#alias Object.Value6 : Object.CurrentBlock1213// Collision14#alias 1 : PLAYER_COL_FLOOR15#alias 4 : PLAYER_COL_ROOF1617// Global SFX18#alias 5 : SFX_G_HURT1920// Gravity21#alias 0 : GRAVITY_GROUND222324// Function declarations25#function MovingBlocks_HandleMovement2627function MovingBlocks_HandleMovement28switch Object.CurrentBlock29case 030Object.BlockYPos_1 -= 0x800031if Object.AnimationTimer == 6432Object.BlockYPos_2 = Object.BlockYPos_133end if34break3536case 137Object.BlockYPos_1 -= 0x800038break3940case 241Object.BlockYPos_1 += 0x800042Object.BlockYPos_3 += 0x800043if Object.AnimationTimer == 6444Object.BlockYPos_1 = Object.BlockYPos_345end if46break4748case 349Object.BlockYPos_1 += 0x800050Object.BlockYPos_2 += 0x800051break5253case 454Object.BlockYPos_1 -= 0x800055Object.BlockYPos_2 -= 0x800056if Object.AnimationTimer == 6457Object.BlockYPos_1 = Object.BlockYPos_258end if59break6061case 562Object.BlockYPos_1 -= 0x800063Object.BlockYPos_3 -= 0x800064break65end switch66end function676869sub ObjectMain70Object.Rotation -= 271if Object.Rotation < 072Object.Rotation += 51273end if74Object.AnimationTimer++75CallFunction(MovingBlocks_HandleMovement)76if Object.AnimationTimer == 6477Object.AnimationTimer = 078Object.CurrentBlock++79if Object.CurrentBlock > 580Object.CurrentBlock = 281end if82end if83end sub848586sub ObjectPlayerInteraction87TempValue0 = Object.XPos88TempValue1 = Object.YPos89switch Object.CurrentBlock90case 091case 192Object.XPos = Object.BlockXPos_293Object.YPos = Object.BlockYPos_294PlayerObjectCollision(C_BOX, -16, -17, 16, 16)95if CheckResult == PLAYER_COL_FLOOR96Player.YPos += 0x1000097end if98break99// This exist in mobile and origins versions of the game, for some reason100// Object.XPos = Object.Value0101// Object.YPos = Object.Value1102// PlayerObjectCollision(C_BOX, -16, -17, 16, 16)103// if CheckResult == 1104// Player.YPos += 0x10000105// end if106// break107108case 2109Object.XPos = Object.BlockXPos_2110Object.YPos = Object.BlockYPos_2111112PlayerObjectCollision(C_BOX, -16, -17, 16, 16)113if CheckResult == PLAYER_COL_FLOOR114Player.YPos += 0x10000115end if116117Object.XPos = Object.BlockXPos_3118Object.YPos = Object.BlockYPos_3119PlayerObjectCollision(C_BOX, -16, -16, 16, 16)120if CheckResult == PLAYER_COL_ROOF121if Player.Gravity == GRAVITY_GROUND122PlaySfx(SFX_G_HURT, false)123Player.DrawOrder = 5124Player.Speed = 0125Player.XVelocity = 0126Player.YVelocity = -0x68000127128Player.State = Player_State_Death129Player.Animation = ANI_DYING130131Player.TileCollisions = false132Player.ObjectInteraction = false133Screen.CameraEnabled = false134end if135end if136break137138case 3139case 4140Object.XPos = Object.BlockXPos_2141Object.YPos = Object.BlockYPos_2142143PlayerObjectCollision(C_BOX, -16, -17, 16, 16)144if CheckResult == PLAYER_COL_FLOOR145Player.YPos += 0x10000146end if147148Object.XPos = Object.BlockXPos_3149Object.YPos = Object.BlockYPos_3150PlayerObjectCollision(C_TOUCH, -12, -16, 12, 32)151if CheckResult == true152PlayerObjectCollision(C_BOX, -16, -16, 16, 16)153154Object.XPos = Object.BlockXPos_1155Object.YPos = Object.BlockYPos_1156157PlayerObjectCollision(C_BOX, -16, -16, 16, 16)158if CheckResult == PLAYER_COL_ROOF159if Player.Gravity == GRAVITY_GROUND160PlaySfx(SFX_G_HURT, false)161Player.DrawOrder = 5162163Player.Speed = 0164Player.XVelocity = 0165Player.YVelocity = -0x68000166167Player.State = Player_State_Death168Player.Animation = ANI_DYING169170Player.TileCollisions = false171Player.ObjectInteraction = false172Screen.CameraEnabled = false173end if174end if175else176PlayerObjectCollision(C_BOX, -16, -16, 16, 32)177end if178break179case 5180Object.XPos = Object.BlockXPos_2181Object.YPos = Object.BlockYPos_2182PlayerObjectCollision(C_BOX, -16, -17, 16, 16)183if CheckResult == PLAYER_COL_FLOOR184Player.YPos += 0x10000185end if186Object.XPos = Object.BlockXPos_1187Object.YPos = Object.BlockYPos_1188PlayerObjectCollision(C_BOX, -16, -17, 16, 16)189if CheckResult == PLAYER_COL_FLOOR190Player.YPos += 0x10000191end if192break193end switch194Object.XPos = TempValue0195Object.YPos = TempValue1196PlayerObjectCollision(C_BOX, -16, -16, 16, 16)197end sub198199200sub ObjectDraw201DrawSpriteXY(0, Object.BlockXPos_1, Object.BlockYPos_1)202DrawSpriteXY(0, Object.BlockXPos_2, Object.BlockYPos_2)203DrawSpriteXY(0, Object.BlockXPos_3, Object.BlockYPos_3)204DrawSprite(0)205end sub206207208sub ObjectStartup209LoadSpriteSheet("R6/Objects.gif")210211SpriteFrame(-16, -16, 32, 32, 173, 1) // #0 - Block212213ArrayPos0 = 32214while ArrayPos0 < 1056215if Object[ArrayPos0].Type == TypeName[Moving Blocks]216Object[ArrayPos0].BlockXPos_1 = Object[ArrayPos0].XPos217Object[ArrayPos0].BlockYPos_1 = Object[ArrayPos0].YPos218Object[ArrayPos0].BlockXPos_2 = Object[ArrayPos0].XPos219Object[ArrayPos0].BlockYPos_2 = Object[ArrayPos0].YPos220Object[ArrayPos0].BlockXPos_3 = Object[ArrayPos0].XPos221Object[ArrayPos0].BlockYPos_3 = Object[ArrayPos0].YPos222Object[ArrayPos0].Rotation = 480223end if224ArrayPos0++225loop226end sub227228229// ========================230// Editor Subs231// ========================232233sub RSDKDraw234DrawSprite(0)235TempValue0 = Object.YPos236TempValue0 -= 0x100000237TempValue1 = Object.XPos238TempValue1 -= 0x100000239if Editor.ShowGizmos == true240Editor.DrawingOverlay = true241TempValue0 -= 0x200000242DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)243DrawArrow(Object.XPos,Object.YPos,Object.XPos,TempValue0, 255, 0, 0)244TempValue0 -= 0x200000245DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)246Editor.DrawingOverlay = false247end if248end sub249250251sub RSDKLoad252LoadSpriteSheet("R6/Objects.gif")253254SpriteFrame(-16, -16, 32, 32, 173, 1) // #0 - Block255256SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")257end sub258259260