Path: blob/master/Sonic 2/Scripts/CNZ/Spinner_V.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Spinner H Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.hitboxT12private alias object.value1 : object.hitboxB1314// Player Aliases15private alias object.type : player.type16private alias object.state : player.state17private alias object.xvel : player.xvel18private alias object.speed : player.speed19private alias object.direction : player.direction20private alias object.gravity : player.gravity21private alias object.animation : player.animation2223private alias object.value34 : player.collisionDisabled24private alias object.value35 : player.jumpAbilityState252627// ========================28// Events29// ========================3031event ObjectUpdate32foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)33if player[currentPlayer].collisionDisabled == true34player[currentPlayer].collisionDisabled = false35end if3637CheckEqual(player[currentPlayer].state, Player_State_Death)38temp0 = checkResult39CheckEqual(player[currentPlayer].state, Player_State_LedgePullUp)40temp0 |= checkResult41if temp0 == false42BoxCollisionTest(C_TOUCH, object.entityPos, -12, object.hitboxT, 12, object.hitboxB, currentPlayer, 0, 0, 0, 0)43if checkResult == true44switch object.direction45case FLIP_NONE46if player[currentPlayer].xvel > 047if player[currentPlayer].animation != ANI_JUMPING48if player[currentPlayer].state != CNZSetup_Player_TubeRoll49PlaySfx(SfxName[Rolling], false)50end if51end if5253if player[currentPlayer].state == Player_State_GlideLeft54FlipSign(player[currentPlayer].speed)55end if5657player[currentPlayer].direction = FACING_RIGHT58player[currentPlayer].state = CNZSetup_Player_TubeRoll59player[currentPlayer].animation = ANI_JUMPING60if player[currentPlayer].collisionDisabled == true61player[currentPlayer].collisionDisabled = false62end if6364player[currentPlayer].jumpAbilityState = 065else66if player[currentPlayer].gravity == GRAVITY_GROUND67if player[currentPlayer].xvel > -0x2000068player[currentPlayer].speed = -0x2000069end if70end if7172CheckEqual(player[currentPlayer].state, CNZSetup_Player_TubeRoll)73temp0 = checkResult74CheckEqual(player[currentPlayer].state, CNZSetup_Player_TubeAirRoll)75temp0 |= checkResult76if temp0 == true77player[currentPlayer].state = Player_State_Roll78player[currentPlayer].animation = ANI_JUMPING79end if80end if81break8283case FLIP_X84if player[currentPlayer].xvel < 085if player[currentPlayer].animation != ANI_JUMPING86if player[currentPlayer].state != CNZSetup_Player_TubeRoll87PlaySfx(SfxName[Rolling], false)88end if89end if9091if player[currentPlayer].state == Player_State_GlideLeft92FlipSign(player[currentPlayer].speed)93end if9495player[currentPlayer].direction = FACING_LEFT96player[currentPlayer].state = CNZSetup_Player_TubeRoll97player[currentPlayer].animation = ANI_JUMPING98if player[currentPlayer].collisionDisabled == true99player[currentPlayer].collisionDisabled = false100end if101102player[currentPlayer].jumpAbilityState = 0103else104if player[currentPlayer].gravity == GRAVITY_GROUND105if player[currentPlayer].xvel < 0x20000106player[currentPlayer].speed = 0x20000107end if108end if109110CheckEqual(player[currentPlayer].state, CNZSetup_Player_TubeRoll)111temp0 = checkResult112CheckEqual(player[currentPlayer].state, CNZSetup_Player_TubeAirRoll)113temp0 |= checkResult114if temp0 == true115player[currentPlayer].state = Player_State_Roll116player[currentPlayer].animation = ANI_JUMPING117end if118end if119break120end switch121end if122end if123next124end event125126127event ObjectStartup128LoadSpriteSheet("Global/Display.gif")129SpriteFrame(-8, -8, 16, 16, 127, 113)130SpriteFrame(-8, -8, 16, 16, 144, 113)131132foreach (TypeName[Spinner V], arrayPos0, ALL_ENTITIES)133temp0 = object[arrayPos0].propertyValue134temp0 &= 3135temp0 += 2136object[arrayPos0].hitboxT = 1137object[arrayPos0].hitboxT <<= temp0138object[arrayPos0].hitboxT <<= 3139object[arrayPos0].hitboxB = object[arrayPos0].hitboxT140FlipSign(object[arrayPos0].hitboxT)141142GetBit(object[arrayPos0].direction, object[arrayPos0].propertyValue, 2)143next144end event145146147event ObjectDraw148if player[0].type == TypeName[Debug Mode]149temp1 = object.propertyValue150temp1 &= 3151temp1 += 2152153temp0 = 1154temp0 <<= temp1155temp1 = temp0156temp0 <<= 19157FlipSign(temp0)158temp0 += object.ypos159temp0 += 0x80000160161GetBit(temp2, object.propertyValue, 2)162163temp3 = 0164while temp3 < temp1165DrawSpriteXY(temp2, object.xpos, temp0)166temp0 += 0x100000167temp3++168loop169170if temp1 == 0171DrawSprite(temp2)172end if173end if174end event175176177// ========================178// Editor Events179// ========================180181event RSDKEdit182if editor.returnVariable == true183switch editor.variableID184case EDIT_VAR_PROPVAL // property value185checkResult = object.propertyValue186break187188case 0 // size189checkResult = object.propertyValue190checkResult &= 3191break192193case 1 // type194GetBit(checkResult, object.propertyValue, 2)195break196197end switch198else199switch editor.variableID200case EDIT_VAR_PROPVAL // property value201object.propertyValue = editor.variableValue202break203204case 0 // size205temp1 = 3206Not(temp1)207object.propertyValue &= temp1208209temp0 = editor.variableValue210temp0 &= 3211object.propertyValue |= temp0212break213214case 1 // type215CheckNotEqual(editor.variableValue, false)216SetBit(object.propertyValue, 2, checkResult)217break218219end switch220end if221end event222223224event RSDKDraw225temp1 = object.propertyValue226temp1 &= 3227temp1 += 2228229temp0 = 1230temp0 <<= temp1231temp1 = temp0232temp0 <<= 19233FlipSign(temp0)234temp0 += object.ypos235temp0 += 0x80000236237GetBit(temp2, object.propertyValue, 2)238239temp3 = 0240while temp3 < temp1241DrawSpriteXY(temp2, object.xpos, temp0)242temp0 += 0x100000243temp3++244loop245246if temp1 == 0247DrawSprite(temp2)248end if249end event250251252event RSDKLoad253LoadSpriteSheet("Global/Display.gif")254SpriteFrame(-8, -8, 16, 16, 127, 113)255SpriteFrame(-8, -8, 16, 16, 144, 113)256257AddEditorVariable("size")258SetActiveVariable("size")259AddEnumVariable("4 Nodes", 0)260AddEnumVariable("8 Nodes", 1)261AddEnumVariable("16 Nodes", 2)262AddEnumVariable("32 Nodes", 3)263264AddEditorVariable("type")265SetActiveVariable("type")266AddEnumVariable("Enter From Left, Exit From Right", 0)267AddEnumVariable("Enter From Right, Exit From Left", 1)268end event269270271