Path: blob/master/Sonic 2/Scripts/CNZ/Spinner_H.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.hitboxL12private alias object.value1 : object.hitboxR1314// Player Aliases15private alias object.type : player.type16private alias object.state : player.state17private alias object.yvel : player.yvel18private alias object.speed : player.speed19private alias object.animation : player.animation2021private alias object.value34 : player.collisionDisabled22private alias object.value35 : player.jumpAbilityState232425// ========================26// Events27// ========================2829event ObjectUpdate30foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)31CheckEqual(player[currentPlayer].state, Player_State_Death)32temp0 = checkResult33CheckEqual(player[currentPlayer].state, Player_State_LedgePullUp)34temp0 |= checkResult35if temp0 == false36BoxCollisionTest(C_TOUCH, object.entityPos, object.hitboxL, -12, object.hitboxR, 12, currentPlayer, 0, 0, 0, 0)37if checkResult == true38switch object.direction39case FLIP_NONE40if player[currentPlayer].yvel > 041if player[currentPlayer].animation != ANI_JUMPING42if player[currentPlayer].state != CNZSetup_Player_TubeRoll43PlaySfx(SfxName[Rolling], false)44end if45end if4647if player[currentPlayer].state == Player_State_GlideLeft48FlipSign(player[currentPlayer].speed)49end if5051player[currentPlayer].state = CNZSetup_Player_TubeRoll52player[currentPlayer].animation = ANI_JUMPING53if player[currentPlayer].collisionDisabled == true54player[currentPlayer].collisionDisabled = false55end if5657player[currentPlayer].jumpAbilityState = 058else59CheckEqual(player[currentPlayer].state, CNZSetup_Player_TubeRoll)60temp0 = checkResult61CheckEqual(player[currentPlayer].state, CNZSetup_Player_TubeAirRoll)62temp0 |= checkResult63if temp0 == true64player[currentPlayer].state = Player_State_Roll65player[currentPlayer].animation = ANI_JUMPING66end if67end if68break6970case FLIP_X71if player[currentPlayer].yvel < 072if player[currentPlayer].animation != ANI_JUMPING73if player[currentPlayer].state != CNZSetup_Player_TubeRoll74PlaySfx(SfxName[Rolling], false)75end if76end if7778if player[currentPlayer].state == Player_State_GlideLeft79FlipSign(player[currentPlayer].speed)80end if8182player[currentPlayer].state = CNZSetup_Player_TubeRoll83player[currentPlayer].animation = ANI_JUMPING84if player[currentPlayer].collisionDisabled == true85player[currentPlayer].collisionDisabled = false86end if8788player[currentPlayer].jumpAbilityState = 089else90CheckEqual(player[currentPlayer].state, CNZSetup_Player_TubeRoll)91temp0 = checkResult92CheckEqual(player[currentPlayer].state, CNZSetup_Player_TubeAirRoll)93temp0 |= checkResult94if temp0 == true95player[currentPlayer].state = Player_State_Roll96player[currentPlayer].animation = ANI_JUMPING97end if98end if99break100end switch101end if102end if103next104end event105106107event ObjectStartup108LoadSpriteSheet("Global/Display.gif")109SpriteFrame(-8, -8, 16, 16, 127, 113)110SpriteFrame(-8, -8, 16, 16, 144, 113)111112foreach (TypeName[Spinner H], arrayPos0, ALL_ENTITIES)113temp0 = object[arrayPos0].propertyValue114temp0 &= 3115temp0 += 2116object[arrayPos0].hitboxL = 1117object[arrayPos0].hitboxL <<= temp0118object[arrayPos0].hitboxL <<= 3119object[arrayPos0].hitboxR = object[arrayPos0].hitboxL120FlipSign(object[arrayPos0].hitboxL)121122GetBit(object[arrayPos0].direction, object[arrayPos0].propertyValue, 2)123next124end event125126127event ObjectDraw128if player[0].type == TypeName[Debug Mode]129temp1 = object.propertyValue130temp1 &= 3131temp1 += 2132133temp0 = 1134temp0 <<= temp1135temp1 = temp0136temp0 <<= 19137FlipSign(temp0)138temp0 += object.xpos139temp0 += 0x80000140141GetBit(temp2, object.propertyValue, 2)142143temp3 = 0144while temp3 < temp1145DrawSpriteXY(temp2, temp0, object.ypos)146temp0 += 0x100000147temp3++148loop149150if temp1 == 0151DrawSprite(temp2)152end if153end if154end event155156157// ========================158// Editor Events159// ========================160161event RSDKEdit162if editor.returnVariable == true163switch editor.variableID164case EDIT_VAR_PROPVAL // property value165checkResult = object.propertyValue166break167168case 0 // size169checkResult = object.propertyValue170checkResult &= 3171break172173case 1 // type174GetBit(checkResult, object.propertyValue, 2)175break176177end switch178else179switch editor.variableID180case EDIT_VAR_PROPVAL // property value181object.propertyValue = editor.variableValue182break183184case 0 // size185temp1 = 3186Not(temp1)187object.propertyValue &= temp1188189temp0 = editor.variableValue190temp0 &= 3191object.propertyValue |= temp0192break193194case 1 // type195CheckNotEqual(editor.variableValue, false)196SetBit(object.propertyValue, 2, checkResult)197break198199end switch200end if201end event202203204event RSDKDraw205temp1 = object.propertyValue206temp1 &= 3207temp1 += 2208209temp0 = 1210temp0 <<= temp1211temp1 = temp0212temp0 <<= 19213FlipSign(temp0)214temp0 += object.xpos215temp0 += 0x80000216217GetBit(temp2, object.propertyValue, 2)218219temp3 = 0220while temp3 < temp1221DrawSpriteXY(temp2, temp0, object.ypos)222temp0 += 0x100000223temp3++224loop225226if temp1 == 0227DrawSprite(temp2)228end if229end event230231232event RSDKLoad233LoadSpriteSheet("Global/Display.gif")234SpriteFrame(-8, -8, 16, 16, 127, 113)235SpriteFrame(-8, -8, 16, 16, 144, 113)236237AddEditorVariable("size")238SetActiveVariable("size")239AddEnumVariable("4 Nodes", 0)240AddEnumVariable("8 Nodes", 1)241AddEnumVariable("16 Nodes", 2)242AddEnumVariable("32 Nodes", 3)243244AddEditorVariable("type")245SetActiveVariable("type")246AddEnumVariable("Enter From Top, Exit From Bottom", 0)247AddEnumVariable("Enter From Bottom, Exit From Top", 1)248end event249250251