Path: blob/master/Sonic 1/Scripts/SYZ/VBlock.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: V Block Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value1 : object.drawPos.y12private alias object.value2 : object.collisionOffset.y1314// Player Aliases15private alias object.ypos : player.ypos16private alias object.gravity : player.gravity1718// ========================19// Function Declarations20// ========================2122reserve function VBlock_DebugDraw23reserve function VBlock_DebugSpawn242526// ========================27// Static Values28// ========================2930private value VBlock_unusedValue = 0 // Prolly VBlock_startDebugID if I had to guess313233// ========================34// Function Definitions35// ========================3637private function VBlock_DebugDraw38DrawSprite(0)39end function404142private function VBlock_DebugSpawn43CreateTempObject(TypeName[V Block], object.direction, object.xpos, object.ypos)44if object[tempObjectPos].propertyValue == 145object[tempObjectPos].ypos -= 0x20000046else47object[tempObjectPos].ypos -= 0x1F000048end if49end function505152// ========================53// Events54// ========================5556event ObjectUpdate57object.angle = SYZSetup_oscillation58object.angle *= 0x20059object.angle /= 35660if object.propertyValue == 161object.angle += 0x10062end if63object.angle &= 0x1FF6465Sin(object.collisionOffset.y, object.angle)66object.collisionOffset.y <<= 1267object.collisionOffset.y += object.ypos68object.collisionOffset.y &= 0xFFFF000069object.collisionOffset.y -= object.drawPos.y7071foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)72temp0 = object.ypos73object.ypos = object.drawPos.y7475BoxCollisionTest(C_SOLID, object.entityPos, -32, -32, 32, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)76switch checkResult77case COL_TOP78player[currentPlayer].ypos += object.collisionOffset.y79break8081case COL_BOTTOM82if player[currentPlayer].gravity == GRAVITY_GROUND83if object.angle > 38484CallFunction(Player_Kill)85end if8687if object.angle < 12888CallFunction(Player_Kill)89end if90end if91break9293end switch9495object.ypos = temp096next97end event9899100event ObjectDraw101Sin(object.drawPos.y, object.angle)102object.drawPos.y <<= 12103object.drawPos.y += object.ypos104object.drawPos.y &= 0xFFFF0000105DrawSpriteXY(0, object.xpos, object.drawPos.y)106end event107108109event ObjectStartup110LoadSpriteSheet("SYZ/Objects.gif")111SpriteFrame(-32, -32, 64, 64, 119, 34)112113foreach (TypeName[V Block], arrayPos0, ALL_ENTITIES)114if object[arrayPos0].propertyValue == 1115object[arrayPos0].ypos -= 0x200000116else117object[arrayPos0].ypos -= 0x1F0000118end if119next120121SetTableValue(TypeName[V Block], DebugMode_ObjCount, DebugMode_TypesTable)122SetTableValue(VBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)123SetTableValue(VBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)124DebugMode_ObjCount++125end event126127128// ========================129// Editor Events130// ========================131132event RSDKEdit133if editor.returnVariable == true134switch editor.variableID135case EDIT_VAR_PROPVAL // property value136checkResult = object.propertyValue137checkResult &= 1138break139140case 0 // startDir141checkResult = object.propertyValue142checkResult &= 1143break144145end switch146else147switch editor.variableID148case EDIT_VAR_PROPVAL // property value149object.propertyValue = editor.variableValue150object.propertyValue &= 1151break152153case 0 // startDir154object.propertyValue = editor.variableValue155object.propertyValue &= 1156break157158end switch159end if160end event161162163event RSDKDraw164DrawSprite(0)165166if editor.showGizmos == true167editor.drawingOverlay = true168169// Draw this object's range of movement170temp0 = -0x200000171temp0 += object.ypos172DrawLine(object.xpos, object.ypos, object.xpos, temp0, 255, 255, 255)173174editor.drawingOverlay = false175end if176end event177178179event RSDKLoad180LoadSpriteSheet("SYZ/Objects.gif")181SpriteFrame(-32, -32, 64, 64, 119, 34)182183AddEditorVariable("startDir")184SetActiveVariable("startDir")185AddEnumVariable("Up", 0)186AddEnumVariable("Down", 1)187end event188189190