Path: blob/master/Sonic 1/Scripts/LZ/HarpoonVert.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Harpoon V Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value1 : object.hitboxT13private alias object.value2 : object.hitboxB141516// ========================17// Function Declarations18// ========================1920reserve function HarpoonV_DebugDraw21reserve function HarpoonV_DebugSpawn222324// ========================25// Tables26// ========================2728private table HarpoonV_frameTable290, 1, 2, 130end table3132private table HarpoonV_delayTable3366, 4, 66, 434end table3536private table HarpoonV_sizeTable37-8, -24, -40, -2438end table394041// ========================42// Function Definitions43// ========================4445private function HarpoonV_DebugDraw46temp0 = object.direction47if object.direction == FLIP_X48object.direction = FLIP_Y49end if50DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)51object.direction = temp052end function535455private function HarpoonV_DebugSpawn56CreateTempObject(TypeName[Harpoon V], 0, object.xpos, object.ypos)57object[tempObjectPos].direction = object.direction58object[tempObjectPos].direction <<= 159end function606162// ========================63// Events64// ========================6566event ObjectUpdate67if object.animationTimer == 068object.timer++69if object.timer >= 470object.timer = 071end if72GetTableValue(object.animationTimer, object.timer, HarpoonV_delayTable)73GetTableValue(object.frame, object.timer, HarpoonV_frameTable)74else75object.animationTimer--76end if7778GetTableValue(object.hitboxT, object.timer, HarpoonV_sizeTable)79object.hitboxB = 880GetBit(temp2, object.direction, 1)81if temp2 == true // Is FLIP_Y set?82FlipSign(object.hitboxT)83FlipSign(object.hitboxB)84temp0 = object.hitboxB85object.hitboxB = object.hitboxT86object.hitboxT = temp087end if8889// Check interaction with players90foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)91BoxCollisionTest(C_TOUCH, object.entityPos, -4, object.hitboxT, 4, object.hitboxB, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)92if checkResult == true93CallFunction(Player_Hit)94end if95next96end event979899event ObjectDraw100DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)101end event102103104event ObjectStartup105LoadSpriteSheet("LZ/Objects.gif")106107// Harpoon frames108SpriteFrame(-4, -8, 8, 16, 231, 239)109SpriteFrame(-4, -24, 8, 32, 222, 223)110SpriteFrame(-4, -40, 8, 48, 213, 207)111112// Add this object to the debug item list113SetTableValue(TypeName[Harpoon V], DebugMode_ObjCount, DebugMode_TypesTable)114SetTableValue(HarpoonV_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)115SetTableValue(HarpoonV_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)116DebugMode_ObjCount++117end event118119120// ========================121// Editor Events122// ========================123124event RSDKDraw125DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)126end event127128129event RSDKLoad130LoadSpriteSheet("LZ/Objects.gif")131SpriteFrame(-4, -40, 8, 48, 213, 207)132133// dir is set from scene134SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")135end event136137138