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/WFZ/Cloud.txt
1480 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
object.xpos += object.xvel
38
object.xpos += WFZSetup_scrollVelocity.x
39
end event
40
41
42
event ObjectDraw
43
DrawSprite(object.propertyValue)
44
end event
45
46
47
event ObjectStartup
48
LoadSpriteSheet("SCZ/Objects.gif")
49
50
// Cloud frames
51
SpriteFrame(-40, -4, 79, 8, 72, 74)
52
SpriteFrame(-24, -4, 48, 8, 72, 83)
53
SpriteFrame(-8, -4, 16, 8, 121, 83)
54
55
foreach (TypeName[Cloud], arrayPos0, ALL_ENTITIES)
56
object[arrayPos0].drawOrder = 2
57
switch object[arrayPos0].propertyValue
58
case 0
59
object[arrayPos0].xvel = -0xC000
60
break
61
62
case 1
63
object[arrayPos0].xvel = -0x8000
64
break
65
66
case 2
67
object[arrayPos0].xvel = -0x4000
68
break
69
70
end switch
71
next
72
73
SetTableValue(TypeName[Cloud], DebugMode_ObjCount, DebugMode_TypesTable)
74
SetTableValue(Cloud_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
75
SetTableValue(Cloud_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
76
DebugMode_ObjCount++
77
end event
78
79
80
// ========================
81
// Editor Events
82
// ========================
83
84
event RSDKEdit
85
if editor.returnVariable == true
86
switch editor.variableID
87
case EDIT_VAR_PROPVAL // property value
88
checkResult = object.propertyValue
89
checkResult %= 3
90
break
91
92
case 0 // frameID
93
checkResult = object.propertyValue
94
checkResult %= 3
95
break
96
97
end switch
98
else
99
switch editor.variableID
100
case EDIT_VAR_PROPVAL // property value
101
object.propertyValue = editor.variableValue
102
object.propertyValue %= 3
103
break
104
105
case 0 // frameID
106
object.propertyValue = editor.variableValue
107
object.propertyValue %= 3
108
break
109
110
end switch
111
end if
112
end event
113
114
115
event RSDKDraw
116
DrawSprite(object.propertyValue)
117
end event
118
119
120
event RSDKLoad
121
LoadSpriteSheet("SCZ/Objects.gif")
122
SpriteFrame(-40, -4, 79, 8, 72, 74)
123
SpriteFrame(-24, -4, 48, 8, 72, 83)
124
SpriteFrame(-8, -4, 16, 8, 121, 83)
125
126
AddEditorVariable("frameID")
127
SetActiveVariable("frameID")
128
AddEnumVariable("Long Cloud", 0)
129
AddEnumVariable("Medium Cloud", 1)
130
AddEnumVariable("Small Cloud", 2)
131
end event
132
133