Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/Special/RotateBlock.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Rotate Block Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value0 : object.timer
13
14
private alias 0 : BLOCK_ROTATE_IDLE
15
private alias 1 : BLOCK_ROTATE_ACTIVATED
16
17
private alias object.value14 : player.rotateBlockTimer
18
19
20
// ========================
21
// Function Declarations
22
// ========================
23
24
reserve function RotateBlock_DebugDraw
25
reserve function RotateBlock_DebugSpawn
26
27
28
// ========================
29
// Function Definitions
30
// ========================
31
32
private function RotateBlock_DebugDraw
33
DrawSprite(0)
34
end function
35
36
37
private function RotateBlock_DebugSpawn
38
temp5 = TypeName[Rotate Block]
39
temp4 = 0
40
CallFunction(DebugMode_PlaceBlock)
41
object[arrayPos0].drawOrder = 4
42
object[arrayPos0].groupID = GROUP_BLOCKS
43
end function
44
45
46
// ========================
47
// Events
48
// ========================
49
50
event ObjectUpdate
51
if object.state == BLOCK_ROTATE_ACTIVATED
52
object.frame = object.timer
53
object.frame >>= 3
54
object.timer++
55
if object.timer == 32
56
object.timer = 0
57
object.state = BLOCK_ROTATE_IDLE
58
object.frame = 0
59
end if
60
end if
61
62
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
63
CallFunction(SpecialSetup_PlayerBlockCol)
64
if checkResult != false
65
if player[currentPlayer].rotateBlockTimer == 0
66
player[currentPlayer].rotateBlockTimer = 30
67
object.state = BLOCK_ROTATE_ACTIVATED
68
Player_rotateDir ^= 1
69
PlaySfx(SfxName[Rotate Block], false)
70
end if
71
end if
72
next
73
end event
74
75
76
event ObjectDraw
77
CallFunction(SpecialSetup_GetBlockPos)
78
#platform: USE_ORIGINS
79
if game.playMode == BOOT_PLAYMODE_MIRRORING
80
object.direction = FLIP_X
81
DrawSpriteFX(object.frame, FX_FLIP, temp0, temp1)
82
else
83
DrawSpriteXY(object.frame, temp0, temp1)
84
end if
85
#endplatform
86
#platform: USE_STANDALONE
87
DrawSpriteXY(object.frame, temp0, temp1)
88
#endplatform
89
end event
90
91
92
event ObjectStartup
93
LoadSpriteSheet("Special/Objects.gif")
94
SpriteFrame(-12, -12, 24, 24, 176, 76)
95
SpriteFrame(-12, -12, 24, 24, 176, 176)
96
SpriteFrame(-12, -12, 24, 24, 176, 76)
97
SpriteFrame(-12, -12, 24, 24, 176, 176)
98
99
foreach (TypeName[Rotate Block], arrayPos0, ALL_ENTITIES)
100
object[arrayPos0].groupID = GROUP_BLOCKS
101
next
102
103
SetTableValue(TypeName[Rotate Block], DebugMode_ObjCount, DebugMode_TypeTable)
104
SetTableValue(RotateBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
105
SetTableValue(RotateBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
106
DebugMode_ObjCount++
107
end event
108
109
110
// ========================
111
// Editor Events
112
// ========================
113
114
event RSDKDraw
115
DrawSprite(0)
116
end event
117
118
119
event RSDKLoad
120
LoadSpriteSheet("Special/Objects.gif")
121
SpriteFrame(-12, -12, 24, 24, 176, 76)
122
123
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
124
end event
125
126