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/GoalBlock.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Goal 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.active
13
14
// Player Aliases
15
private alias object.state : player.state
16
private alias object.xvel : player.xvel
17
private alias object.yvel : player.yvel
18
private alias object.speed : player.speed
19
private alias object.interaction : player.interaction
20
21
22
// ========================
23
// Function Declarations
24
// ========================
25
26
reserve function GoalBlock_DebugDraw
27
reserve function GoalBlock_DebugSpawn
28
29
30
// ========================
31
// Function Definitions
32
// ========================
33
34
private function GoalBlock_DebugDraw
35
DrawSprite(0)
36
end function
37
38
39
private function GoalBlock_DebugSpawn
40
temp5 = TypeName[Goal Block]
41
temp4 = 0
42
CallFunction(DebugMode_PlaceBlock)
43
object[arrayPos0].drawOrder = 4
44
object[arrayPos0].groupID = GROUP_BLOCKS
45
end function
46
47
48
// ========================
49
// Events
50
// ========================
51
52
event ObjectUpdate
53
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
54
CallFunction(SpecialSetup_PlayerBlockCol)
55
if checkResult > 0
56
player[currentPlayer].state = Player_State_Static
57
player[currentPlayer].xvel = 0
58
player[currentPlayer].yvel = 0
59
player[currentPlayer].speed = 0
60
object.active = false
61
player[currentPlayer].interaction = false
62
ResetObjectEntity(20, TypeName[Special Finish], 0, 0, 0)
63
object[20].priority = PRIORITY_ACTIVE
64
PlaySfx(SfxName[Exit SS], false)
65
stage.timeEnabled = false
66
options.touchControls = false
67
end if
68
next
69
end event
70
71
72
event ObjectDraw
73
CallFunction(SpecialSetup_GetBlockPos)
74
temp2 = oscillation
75
temp2 &= 15
76
temp2 >>= 3
77
#platform: USE_ORIGINS
78
if game.playMode == BOOT_PLAYMODE_MIRRORING
79
object.direction = FLIP_X
80
DrawSpriteFX(temp2, FX_FLIP, temp0, temp1)
81
else
82
DrawSpriteXY(temp2, temp0, temp1)
83
end if
84
#endplatform
85
#platform: USE_STANDALONE
86
DrawSpriteXY(temp2, temp0, temp1)
87
#endplatform
88
end event
89
90
91
event ObjectStartup
92
LoadSpriteSheet("Special/Objects.gif")
93
SpriteFrame(-12, -12, 24, 24, 201, 76)
94
SpriteFrame(-12, -12, 24, 24, 201, 176)
95
96
foreach (TypeName[Goal Block], arrayPos0, ALL_ENTITIES)
97
object[arrayPos0].groupID = GROUP_BLOCKS
98
next
99
100
SetTableValue(TypeName[Goal Block], DebugMode_ObjCount, DebugMode_TypeTable)
101
SetTableValue(GoalBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
102
SetTableValue(GoalBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
103
DebugMode_ObjCount++
104
end event
105
106
107
// ========================
108
// Editor Events
109
// ========================
110
111
event RSDKDraw
112
DrawSprite(0)
113
end event
114
115
116
event RSDKLoad
117
LoadSpriteSheet("Special/Objects.gif")
118
SpriteFrame(-12, -12, 24, 24, 201, 76)
119
120
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
121
end event
122
123