0% found this document useful (0 votes)
15 views4 pages

Collapsing Floor

This document describes the C Floor Object script for the RSDK Project: Sonic 1/Sonic 2, authored by Christian Whitehead and Simon Thomley. It includes function declarations, event handling for object states, and sprite loading for the C Floor object. The script manages object behavior, collision detection, and sound effects during gameplay.

Uploaded by

juaqin727
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

Collapsing Floor

This document describes the C Floor Object script for the RSDK Project: Sonic 1/Sonic 2, authored by Christian Whitehead and Simon Thomley. It includes function declarations, event handling for object states, and sprite loading for the C Floor object. The script manages object behavior, collision detection, and sound effects during gameplay.

Uploaded by

juaqin727
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

// ----------------------------------

// RSDK Project: Sonic 1/Sonic 2


// Script Description: C Floor Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 50 : TYPE_CFLOOR

// Function declarations
reserve function CFloor_DebugDraw
reserve function CFloor_DebugSpawn

// Static Values

// Tables
private table CFloor_table0
30, 22, 14, 6, 26, 18, 10, 2
end table

private table CFloor_table1


22, 30, 26, 18, 6, 14, 10, 2
end table

function CFloor_DebugDraw
DrawSprite(0)
end function

function CFloor_DebugSpawn
CreateTempObject(TypeName[C Floor], 0, object.xpos, object.ypos)
object[tempObjectPos].value2 = CFloor_table0
GetBit(temp0, object.direction, 0)
if temp0 == 0
object[tempObjectPos].direction = FLIP_NONE
else
object[tempObjectPos].direction = FLIP_X
end if
end function

event ObjectMain
switch object.state
case 1
if object.value0 < 10
object.value0++
else
temp5 = 0
if object.direction == FLIP_X
object.frame = 1
else
object.frame = 2
end if
temp0 = 0
temp3 = object.ypos
temp4 = 10
while temp0 < 2
temp1 = 0
temp2 = object.xpos
if object.direction == FLIP_X
temp2 -= 0x180000
else
temp2 += 0x180000
end if
while temp1 < 4
CreateTempObject(TypeName[C Floor], object.frame,
temp2, temp3)
object[tempObjectPos].state = 4
GetTableValue(object[tempObjectPos].value1, temp5,
object.value2)
temp5++
object.frame -= 1
object.frame ^= 1
object.frame += 1
temp1++
if object.direction == FLIP_X
temp2 += 0x100000
else
temp2 -= 0x100000
end if
temp4 += 4
loop
temp4 -= 26
object.frame += 2
temp0++
temp3 += 0x100000
loop
PlaySfx(SfxName[Ledge Break L], 0)
SetSfxAttributes(SfxName[Ledge Break L], -1, -100)
PlaySfx(SfxName[Ledge Break R], 0)
SetSfxAttributes(SfxName[Ledge Break R], -1, 100)
object.value0 = 0
object.state++
end if
break
case 2
if object.value0 < 20
object.value0++
else
object.value0 = 0
object.state++
end if
break
case 4
if object.value0 < object.value1
object.value0++
else
object.value0 = 0
object.state++
end if
break
case 5
object.ypos += object.yvel
object.yvel += 0x4000
if object.outOfBounds == 1
object.type = TypeName[Blank Object]
end if
break
end switch
if object.state < 4
if object.outOfBounds == 1
object.state = 0
object.value0 = 0
object.priority = PRIORITY_ACTIVE_BOUNDS
end if
end if
if object.state < 3
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
if object[currentPlayer].yvel >= 0
BoxCollisionTest(C_PLATFORM, object.entityPos, -32, -8, 32,
8, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if checkResult == 1
if object.state == 0
object.state = 1
object.priority = PRIORITY_ACTIVE
end if
end if
end if
next
end if
end event

event ObjectDraw
switch object.state
case 0
case 1
DrawSprite(0)
break
case 4
case 5
DrawSprite(object.propertyValue)
break
end switch
end event

event ObjectStartup
LoadSpriteSheet("SLZ/Objects.gif")
SpriteFrame(-32, -8, 64, 32, 67, 26)
SpriteFrame(-8, -8, 16, 16, 67, 26)
SpriteFrame(-8, -8, 16, 16, 83, 26)
SpriteFrame(-8, -8, 16, 16, 67, 42)
SpriteFrame(-8, -8, 16, 16, 83, 42)
foreach (TypeName[C Floor], arrayPos0, ALL_ENTITIES)
GetBit(temp5, object[arrayPos0].propertyValue, 0)
if temp5 == 0
object[arrayPos0].value2 = CFloor_table0
else
object[arrayPos0].value2 = CFloor_table1
end if
next
SetTableValue(TypeName[C Floor], DebugMode_ObjCount, DebugMode_TypesTable)
SetTableValue(CFloor_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
SetTableValue(CFloor_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
DebugMode_ObjCount++
end event

event RSDKDraw
DrawSprite(0)
end event

event RSDKLoad
LoadSpriteSheet("Global/Display.gif")
SpriteFrame(-16, -16, 32, 32, 1, 143)
end event

You might also like