Path: blob/main/Scripts/R8/PohBee.txt
1319 views
//-----------------Sonic CD Poh Bee Script--------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.XOriginPos7#alias Object.Value2 : Object.YOriginPos8#alias Object.Value3 : Object.PohBeeOscillation9#alias Object.Value4 : SpikeBallN1.Oscillation10#alias Object.Value5 : SpikeBallN2.Oscillation11#alias Object.Value6 : SpikeBallN2.Rotation12#alias Object.Value7 : Object.SBallDistance1314#alias Object.PropertyValue : Object.Quality1516// States17#alias 0 : POHBEE_MOVING_RIGHT18#alias 1 : POHBEE_MOVING_LEFT1920// Badnik Quality / Property Values21#alias 0 : GOOD_QUALITY22#alias 1 : BAD_QUALITY232425sub ObjectMain26if Object.OutOfBounds == true27Object.XPos = Object.XOriginPos28Object.Timer = 029Object.State = POHBEE_MOVING_RIGHT30end if3132Object.Rotation += 933Object.Rotation &= 20473435if Object.Quality == GOOD_QUALITY36SpikeBallN2.Rotation += 1037SpikeBallN2.Rotation &= 204738switch Object.State39case POHBEE_MOVING_RIGHT40Object.Direction = FACING_LEFT41if Object.Timer < 12842Object.Timer++43Object.XPos += 0x1000044else45Object.State = POHBEE_MOVING_LEFT46Object.Timer = 047end if48break4950case POHBEE_MOVING_LEFT51Object.Direction = FACING_RIGHT52if Object.Timer < 12853Object.Timer++54Object.XPos -= 0x1000055else56Object.State = POHBEE_MOVING_RIGHT57Object.Timer = 058end if59break60end switch6162Object.PohBeeOscillation += 863Object.PohBeeOscillation &= 51164Sin(Object.YPos, Object.PohBeeOscillation)65Object.YPos <<= 1266Object.YPos += Object.YOriginPos6768TempValue0 = Object.Rotation69TempValue0 >>= 270Sin(SpikeBallN1.Oscillation, TempValue0)71SpikeBallN1.Oscillation >>= 272SpikeBallN1.Oscillation += 13673SpikeBallN1.Oscillation *= 12074SpikeBallN1.Oscillation >>= 77576TempValue0 = SpikeBallN2.Rotation77TempValue0 >>= 278Sin(SpikeBallN2.Oscillation, TempValue0)79SpikeBallN2.Oscillation >>= 280SpikeBallN2.Oscillation += 14481SpikeBallN2.Oscillation *= 11282SpikeBallN2.Oscillation >>= 783else84switch Object.State85case POHBEE_MOVING_RIGHT86Object.Direction = FACING_LEFT87if Object.Timer < 25688Object.Timer++89Object.XPos += 0x800090else91Object.State = POHBEE_MOVING_LEFT92Object.Timer = 093end if94break9596case POHBEE_MOVING_LEFT97Object.Direction = FACING_RIGHT98if Object.Timer < 25699Object.Timer++100Object.XPos -= 0x8000101else102Object.State = POHBEE_MOVING_RIGHT103Object.Timer = 0104end if105break106end switch107108Object.PohBeeOscillation += 6109Object.PohBeeOscillation &= 511110Sin(Object.YPos, Object.PohBeeOscillation)111Object.YPos <<= 11112Object.YPos += Object.YOriginPos113114TempValue0 = Object.Rotation115TempValue0 >>= 2116Sin(SpikeBallN1.Oscillation, TempValue0)117SpikeBallN1.Oscillation >>= 2118SpikeBallN1.Oscillation += 136119SpikeBallN1.Oscillation *= 120120SpikeBallN1.Oscillation >>= 7121end if122123Object.SBallDistance = Object.YPos124Object.SBallDistance += 0xD0000125126CallFunction(StageSetup_CheckGoodFuture)127end sub128129130sub ObjectPlayerInteraction131#platform: Use_Standalone132PlayerObjectCollision(C_TOUCH, -20, -16, 20, 14)133#endplatform134#platform: Use_Origins135PlayerObjectCollision(C_ENEMY, -20, -16, 20, 14)136#endplatform137if CheckResult == true138CallFunction(Player_BadnikBreak)139end if140141TempValue0 = Object.XPos142TempValue1 = Object.YPos143144Cos(Object.XPos, SpikeBallN1.Oscillation)145Object.XPos *= 0x2A00146Object.XPos += TempValue0147148Sin(Object.YPos, SpikeBallN1.Oscillation)149Object.YPos *= 0x2A00150Object.YPos += Object.SBallDistance151152PlayerObjectCollision(C_TOUCH, -9, -9, 9, 9)153if CheckResult == true154CallFunction(Player_Hit)155end if156157if Object.Quality == GOOD_QUALITY158Cos(Object.XPos, SpikeBallN2.Oscillation)159Object.XPos *= 0x1200160Object.XPos += TempValue0161162Sin(Object.YPos, SpikeBallN2.Oscillation)163Object.YPos *= 0x1200164Object.YPos += Object.SBallDistance165166PlayerObjectCollision(C_TOUCH, -9, -9, 9, 9)167if CheckResult == true168CallFunction(Player_Hit)169end if170end if171172Object.XPos = TempValue0173Object.YPos = TempValue1174end sub175176177sub ObjectDraw178if Object.Quality == GOOD_QUALITY179// First Spike Ball chain180TempValue0 = 0181TempValue1 = 4182while TempValue0 < 10183Cos(TempValue2, SpikeBallN1.Oscillation)184TempValue2 *= TempValue1185TempValue2 <<= 7186TempValue2 += Object.XPos187Sin(TempValue3, SpikeBallN1.Oscillation)188TempValue3 *= TempValue1189TempValue3 <<= 7190TempValue3 += Object.SBallDistance191DrawSpriteXY(2, TempValue2, TempValue3)192TempValue0++193TempValue1 += 8194loop195196// First Spike Ball197Cos(TempValue2, SpikeBallN1.Oscillation)198TempValue2 *= TempValue1199TempValue2 <<= 7200TempValue2 += Object.XPos201Sin(TempValue3, SpikeBallN1.Oscillation)202TempValue3 *= TempValue1203TempValue3 <<= 7204TempValue3 += Object.SBallDistance205DrawSpriteXY(3, TempValue2, TempValue3)206207// Second Spike Ball chain208TempValue0 = 0209TempValue1 = 4210while TempValue0 < 4211Cos(TempValue2, SpikeBallN2.Oscillation)212TempValue2 *= TempValue1213TempValue2 <<= 7214TempValue2 += Object.XPos215Sin(TempValue3, SpikeBallN2.Oscillation)216TempValue3 *= TempValue1217TempValue3 <<= 7218TempValue3 += Object.SBallDistance219DrawSpriteXY(2, TempValue2, TempValue3)220TempValue0++221TempValue1 += 8222loop223224// Second Spike Ball225Cos(TempValue2, SpikeBallN2.Oscillation)226TempValue2 *= TempValue1227TempValue2 <<= 7228TempValue2 += Object.XPos229Sin(TempValue3, SpikeBallN2.Oscillation)230TempValue3 *= TempValue1231TempValue3 <<= 7232TempValue3 += Object.SBallDistance233DrawSpriteXY(3, TempValue2, TempValue3)234else235TempValue0 = 0236TempValue1 = 4237while TempValue0 < 10238Cos(TempValue2, SpikeBallN1.Oscillation)239TempValue2 *= TempValue1240TempValue2 <<= 7241TempValue2 += Object.XPos242Sin(TempValue3, SpikeBallN1.Oscillation)243TempValue3 *= TempValue1244TempValue3 <<= 7245TempValue3 += Object.SBallDistance246DrawSpriteXY(2, TempValue2, TempValue3)247TempValue0++248TempValue1 += 8249loop250Cos(TempValue2, SpikeBallN1.Oscillation)251TempValue2 *= TempValue1252TempValue2 <<= 7253TempValue2 += Object.XPos254Sin(TempValue3, SpikeBallN1.Oscillation)255TempValue3 *= TempValue1256TempValue3 <<= 7257TempValue3 += Object.SBallDistance258DrawSpriteXY(4, TempValue2, TempValue3)259end if260261Object.AnimationTimer++262Object.AnimationTimer &= 3263264Object.Frame = Object.AnimationTimer265Object.Frame >>= 1266DrawSpriteFX(Object.Frame, FX_FLIP, Object.XPos, Object.YPos)267end sub268269270sub ObjectStartup271LoadSpriteSheet("R8/Objects.gif")272// PohBee273SpriteFrame(-19, -20, 48, 36, 75, 140) // #0 - PohBee frame 0274SpriteFrame(-19, -20, 48, 36, 124, 140) // #1 - PohBee frame 1275276// Spike Ball277SpriteFrame(-8, -8, 16, 16, 58, 114) // #2 - Spike ball joint278// Good279SpriteFrame(-12, -12, 24, 24, 230, 67) // #3 - Spike Ball280// Bad281SpriteFrame(-12, -12, 24, 24, 75, 114) // #4 - Broken Spike Ball282283ArrayPos0 = 32284while ArrayPos0 < 1056285if Object[ArrayPos0].Type == TypeName[Poh Bee]286Object[ArrayPos0].XOriginPos = Object[ArrayPos0].XPos287Object[ArrayPos0].YOriginPos = Object[ArrayPos0].YPos288end if289ArrayPos0++290loop291end sub292293294// ========================295// Editor Subs296// ========================297298sub RSDKEdit299if Editor.ReturnVariable == true300switch Editor.VariableID301case EDIT_VAR_PROPVAL // Property Value302CheckResult = Object.PropertyValue303CheckResult &= 1304break305case 0 // condition306CheckResult = Object.PropertyValue307CheckResult &= 1308break309end switch310else311switch Editor.VariableID312case EDIT_VAR_PROPVAL // Property Value313Object.PropertyValue = Editor.VariableValue314Object.PropertyValue &= 1315break316case 0 // condition317Object.PropertyValue = Editor.VariableValue318Object.PropertyValue &= 1319break320end switch321end if322end sub323324sub RSDKDraw325DrawSprite(0)326// Spikeball good/bad future frame327TempValue7 = 3328TempValue7 += Object.PropertyValue329330Sin(TempValue4, 0)331TempValue4 >>= 2332TempValue4 += 136333TempValue4 *= 120334TempValue4 >>= 7335336Sin(TempValue5, 0)337TempValue5 >>= 2338TempValue5 += 144339TempValue5 *= 112340TempValue5 >>= 7341342TempValue6 = Object.YPos343TempValue6 += 0xD0000344345// First Spike Ball chain346TempValue0 = 0347TempValue1 = 4348while TempValue0 < 10349Cos(TempValue2, TempValue4)350TempValue2 *= TempValue1351TempValue2 <<= 7352TempValue2 += Object.XPos353Sin(TempValue3, TempValue4)354TempValue3 *= TempValue1355TempValue3 <<= 7356TempValue3 += TempValue6357DrawSpriteXY(2, TempValue2, TempValue3)358TempValue0++359TempValue1 += 8360loop361362// First Spike Ball363Cos(TempValue2, TempValue4)364TempValue2 *= TempValue1365TempValue2 <<= 7366TempValue2 += Object.XPos367Sin(TempValue3, TempValue4)368TempValue3 *= TempValue1369TempValue3 <<= 7370TempValue3 += TempValue6371DrawSpriteXY(TempValue7, TempValue2, TempValue3)372373if Object.PropertyValue == GOOD_QUALITY374// Second Spike Ball chain375TempValue0 = 0376TempValue1 = 4377while TempValue0 < 4378Cos(TempValue2, TempValue5)379TempValue2 *= TempValue1380TempValue2 <<= 7381TempValue2 += Object.XPos382Sin(TempValue3, TempValue5)383TempValue3 *= TempValue1384TempValue3 <<= 7385TempValue3 += TempValue6386DrawSpriteXY(2, TempValue2, TempValue3)387TempValue0++388TempValue1 += 8389loop390391// Second Spike Ball392Cos(TempValue2, TempValue5)393TempValue2 *= TempValue1394TempValue2 <<= 7395TempValue2 += Object.XPos396Sin(TempValue3, TempValue5)397TempValue3 *= TempValue1398TempValue3 <<= 7399TempValue3 += TempValue6400DrawSpriteXY(3, TempValue2, TempValue3)401end if402end sub403404sub RSDKLoad405LoadSpriteSheet("R8/Objects.gif")406// PohBee407SpriteFrame(-19, -20, 48, 36, 75, 140) // #0 - PohBee frame 0408SpriteFrame(-19, -20, 48, 36, 124, 140) // #1 - PohBee frame 1409410// Spike Ball411SpriteFrame(-8, -8, 16, 16, 58, 114) // #2 - Spike ball joint412// Good413SpriteFrame(-12, -12, 24, 24, 230, 67) // #3 - Spike Ball414// Bad415SpriteFrame(-12, -12, 24, 24, 75, 114) // #4 - Broken Spike Ball416417AddEditorVariable("condition")418SetActiveVariable("condition")419AddEnumVariable("Good Quality", GOOD_QUALITY)420AddEnumVariable("Bad Quality", BAD_QUALITY)421end sub422423424