Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/SCZ/Cloud.txt
1478 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Cloud Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Function Declarations
10
// ========================
11
12
reserve function Cloud_DebugDraw
13
reserve function Cloud_DebugSpawn
14
15
16
// ========================
17
// Function Definitions
18
// ========================
19
20
private function Cloud_DebugDraw
21
DrawSprite(0)
22
end function
23
24
25
private function Cloud_DebugSpawn
26
CreateTempObject(TypeName[Cloud], 0, object.xpos, object.ypos)
27
object[tempObjectPos].drawOrder = 2
28
object[tempObjectPos].xvel = -0xC000
29
end function
30
31
32
// ========================
33
// Events
34
// ========================
35
36
event ObjectUpdate
37
if SCZSetup_scrollVelocity.x != 0
38
object.xpos += object.xvel
39
object.xpos += SCZSetup_scrollVelocity.x
40
end if
41
end event
42
43
44
event ObjectDraw
45
DrawSprite(object.propertyValue)
46
end event
47
48
49
event ObjectStartup
50
LoadSpriteSheet("SCZ/Objects.gif")
51
52
// Cloud frames
53
SpriteFrame(-40, -4, 79, 8, 72, 74)
54
SpriteFrame(-24, -4, 48, 8, 72, 83)
55
SpriteFrame(-8, -4, 16, 8, 121, 83)
56
57
foreach (TypeName[Cloud], arrayPos0, ALL_ENTITIES)
58
59
object[arrayPos0].drawOrder = 2
60
switch object[arrayPos0].propertyValue
61
case 0
62
object[arrayPos0].xvel = -0xC000
63
break
64
65
case 1
66
object[arrayPos0].xvel = -0x8000
67
break
68
69
case 2
70
object[arrayPos0].xvel = -0x4000
71
break
72
73
end switch
74
next
75
76
// Add Clouds to the stage's debug object list
77
SetTableValue(TypeName[Cloud], DebugMode_ObjCount, DebugMode_TypesTable)
78
SetTableValue(Cloud_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
79
SetTableValue(Cloud_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
80
DebugMode_ObjCount++
81
end event
82
83
84
// ========================
85
// Editor Events
86
// ========================
87
88
event RSDKEdit
89
if editor.returnVariable == true
90
switch editor.variableID
91
case EDIT_VAR_PROPVAL // property value
92
checkResult = object.propertyValue
93
checkResult %= 3
94
break
95
96
case 0 // frameID
97
checkResult = object.propertyValue
98
checkResult %= 3
99
break
100
101
end switch
102
else
103
switch editor.variableID
104
case EDIT_VAR_PROPVAL // property value
105
object.propertyValue = editor.variableValue
106
object.propertyValue %= 3
107
break
108
109
case 0 // frameID
110
object.propertyValue = editor.variableValue
111
object.propertyValue %= 3
112
break
113
114
end switch
115
end if
116
end event
117
118
119
event RSDKDraw
120
DrawSprite(object.propertyValue)
121
end event
122
123
124
event RSDKLoad
125
LoadSpriteSheet("SCZ/Objects.gif")
126
127
// Cloud frames
128
SpriteFrame(-40, -4, 79, 8, 72, 74)
129
SpriteFrame(-24, -4, 48, 8, 72, 83)
130
SpriteFrame(-8, -4, 16, 8, 121, 83)
131
132
AddEditorVariable("frameID")
133
SetActiveVariable("frameID")
134
AddEnumVariable("Long Cloud", 0)
135
AddEnumVariable("Medium Cloud", 1)
136
AddEnumVariable("Small Cloud", 2)
137
end event
138
139