0% found this document useful (0 votes)
10 views8 pages

Text Message

The document describes code for displaying text messages in Sonic games. It includes functions for drawing text character by character and exploding text into individual sprite objects. It handles formatting numbers and text properties like position, color and movement.
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)
10 views8 pages

Text Message

The document describes code for displaying text messages in Sonic games. It includes functions for drawing text character by character and exploding text into individual sprite objects. It handles formatting numbers and text properties like position, color and movement.
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/ 8

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

// RSDK Project: Sonic 1/Sonic 2


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

// Aliases
private alias 13 : TYPE_TEXTMESSAGE

// Function declarations
reserve function TextMessage_Function12
reserve function TextMessage_Function13

// Static Values

// Tables

function TextMessage_Function12
GetTextInfo(object.value3, MENU_1, TEXTINFO_TEXTSIZE, object.value1, 0)
object.value2 = object.value3
object.value2 <<= 2
FlipSign(object.value2)
object.value2 += screen.xcenter
object.value2 += 4
temp0 = 0
while object.value3 > 0
GetTextInfo(temp1, MENU_1, TEXTINFO_TEXTDATA, object.value1, temp0)
switch temp1
case 33
DrawSpriteScreenXY(37, object.value2, object.ypos)
object.value2 += 8
break
case 35
temp2 = object.value4
temp2 /= 100
DrawSpriteScreenXY(temp2, object.value2, object.ypos)
object.value2 += 8
break
case 36
temp2 = object.value4
temp2 %= 100
temp2 /= 10
DrawSpriteScreenXY(temp2, object.value2, object.ypos)
object.value2 += 8
break
case 37
temp2 = object.value4
temp2 %= 10
DrawSpriteScreenXY(temp2, object.value2, object.ypos)
object.value2 += 8
break
case 38
DrawSpriteScreenXY(38, object.value2, object.ypos)
object.value2 += 8
break
case 46
DrawSpriteScreenXY(36, object.value2, object.ypos)
object.value2 += 8
break
default
object.frame = 0
if temp1 > 64
if temp1 < 91
object.frame = temp1
object.frame -= 55
end if
end if
if temp1 > 96
if temp1 < 123
object.frame = temp1
object.frame -= 87
end if
end if
if object.frame > 0
DrawSpriteScreenXY(object.frame, object.value2,
object.ypos)
end if
object.value2 += 8
end switch
temp0++
object.value3--
loop
end function

function TextMessage_Function13
GetTextInfo(object.value3, MENU_1, TEXTINFO_TEXTSIZE, object.value1, 0)
object.value2 = object.value3
object.value2 <<= 2
FlipSign(object.value2)
object.value2 += 4
object.value2 <<= 16
temp0 = 0
temp3 = object.ypos
temp3 <<= 16
object.value5 = 224
object.value5 /= object.value3
while object.value3 > 0
GetTextInfo(temp1, MENU_1, TEXTINFO_TEXTDATA, object.value1, temp0)
object.frame = 255
switch temp1
case 33
object.frame = 37
break
case 35
temp2 = object.value4
temp2 /= 100
object.frame = temp2
break
case 36
temp2 = object.value4
temp2 %= 100
temp2 /= 10
object.frame = temp2
break
case 37
temp2 = object.value4
temp2 %= 10
object.frame = temp2
break
case 38
object.frame = 38
break
case 46
object.frame = 36
break
default
if temp1 > 64
if temp1 < 91
object.frame = temp1
object.frame -= 55
end if
end if
if temp1 > 96
if temp1 < 123
object.frame = temp1
object.frame -= 87
end if
end if
end switch
if object.frame < 255
CreateTempObject(TypeName[Text Message], 9, object.value2, temp3)
object[tempObjectPos].drawOrder = 5
object[tempObjectPos].frame = object.frame
if object.value8 == 0
object[tempObjectPos].angle = object.angle
else
object[tempObjectPos].angle = object.angle
FlipSign(object[tempObjectPos].angle)
object[tempObjectPos].angle += 256
object[tempObjectPos].angle &= 511
end if
object[tempObjectPos].speed = -0x10000
object[tempObjectPos].value6 = 16
Rand(object[tempObjectPos].value7, 32)
object[tempObjectPos].value7 -= 16
end if
object.angle -= object.value5
object.angle &= 511
object.value2 += 0x80000
temp0++
object.value3--
loop
end function

event ObjectMain
switch object.propertyValue
case 0
case 4
if object.value0 < 120
object.value0++
else
object.angle = 96
CallFunction(TextMessage_Function13)
ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, 0,
0)
end if
break
case 1
if object.value0 < 120
object.value0++
else
object.value8 = 0
object.value1 = 1
object.ypos = 116
object.angle = 96
CallFunction(TextMessage_Function13)
object.value8 = 1
object.ypos += 22
object.value1 = 2
object.angle = 96
CallFunction(TextMessage_Function13)
ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, 0,
0)
end if
break
case 2
case 5
if object.value0 < 90
object.value0++
else
object.angle = 96
CallFunction(TextMessage_Function13)
ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, 0,
0)
end if
break
case 3
if stage.player2Enabled == 1
temp0 = object[2].value0
temp0 += object[3].value0
else
temp0 = object[2].value0
end if
GetTableValue(temp1, SpecialSetup_value3, SpecialSetup_value4)
if temp0 < temp1
object.animationTimer = 0
else
if object.animationTimer < 30
object.animationTimer++
end if
end if
CheckLower(temp0, temp1)
temp2 = checkResult
CheckLower(object.animationTimer, 30)
temp2 |= checkResult
if temp2 == 1
GetBit(object.visible, object.value0, 2)
object.value0++
object.value0 &= 7
object.value4 = temp1
object.value4 -= temp0
if object.value4 < 0
object.value4 = 0
end if
else
object.visible = 0
end if
break
case 6
case 7
case 8
if object.value0 < 90
object.value0++
else
object.angle = 96
CallFunction(TextMessage_Function13)
ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, 0,
0)
if SpecialSetup_value3 < 3
object[2].value0 = 0
object[3].value0 = 0
end if
end if
break
case 9
object.xpos += object.xvel
object.ypos += object.yvel
object.scale += object.value6
object.rotation += object.value7
object.rotation &= 511
object.speed -= 0x8000
object.value6++
Cos(object.yvel, object.angle)
object.yvel *= object.speed
object.yvel >>= 9
Sin(object.xvel, object.angle)
object.xvel *= object.speed
object.xvel >>= 9
if object.value0 < 120
object.value0++
else
object.type = TypeName[Blank Object]
end if
break
end switch
end event

event ObjectDraw
switch object.propertyValue
case 0
object.ypos = 116
object.value1 = 0
CallFunction(TextMessage_Function12)
break
case 1
object.value1 = 1
object.ypos = 116
CallFunction(TextMessage_Function12)
object.ypos += 22
object.value1 = 2
CallFunction(TextMessage_Function12)
break
case 2
object.ypos = 116
if object.value4 > 99
object.value1 = 5
CallFunction(TextMessage_Function12)
else
if object.value4 > 9
object.value1 = 4
CallFunction(TextMessage_Function12)
else
object.value1 = 3
CallFunction(TextMessage_Function12)
end if
end if
break
case 3
if object.visible == 1
object.ypos = 64
if object.value4 > 99
object.value1 = 9
CallFunction(TextMessage_Function12)
else
if object.value4 > 9
object.value1 = 8
CallFunction(TextMessage_Function12)
else
if object.value4 == 1
object.value1 = 6
CallFunction(TextMessage_Function12)
else
object.value1 = 7
CallFunction(TextMessage_Function12)
end if
end if
end if
end if
break
case 4
object.ypos = 116
object.value1 = 10
CallFunction(TextMessage_Function12)
break
case 5
object.ypos = 116
object.value1 = 11
CallFunction(TextMessage_Function12)
break
case 6
object.ypos = 116
object.value1 = 12
CallFunction(TextMessage_Function12)
break
case 7
object.ypos = 116
object.value1 = 13
CallFunction(TextMessage_Function12)
break
case 8
object.ypos = 68
object.value1 = 14
CallFunction(TextMessage_Function12)
break
case 9
temp0 = object.xpos
temp0 >>= 16
temp0 += screen.xcenter
temp1 = object.ypos
temp1 >>= 16
DrawSpriteScreenFX(object.frame, FX_ROTOZOOM, temp0, temp1)
break
end switch
end event

event ObjectStartup
LoadSpriteSheet("Special/Objects.gif")
SpriteFrame(-4, -8, 8, 15, 291, 42)
SpriteFrame(-4, -8, 8, 15, 300, 42)
SpriteFrame(-4, -8, 8, 15, 309, 42)
SpriteFrame(-4, -8, 8, 15, 318, 42)
SpriteFrame(-4, -8, 8, 15, 327, 42)
SpriteFrame(-4, -8, 8, 15, 336, 42)
SpriteFrame(-4, -8, 8, 15, 345, 42)
SpriteFrame(-4, -8, 8, 15, 354, 42)
SpriteFrame(-4, -8, 8, 15, 363, 42)
SpriteFrame(-4, -8, 8, 15, 372, 42)
SpriteFrame(-4, -8, 8, 15, 291, 26)
SpriteFrame(-4, -8, 8, 15, 300, 26)
SpriteFrame(-4, -8, 8, 15, 309, 26)
SpriteFrame(-4, -8, 8, 15, 318, 26)
SpriteFrame(-4, -8, 8, 15, 327, 26)
SpriteFrame(-4, -8, 8, 15, 336, 26)
SpriteFrame(-4, -8, 8, 15, 345, 26)
SpriteFrame(-4, -8, 8, 15, 354, 26)
SpriteFrame(-4, -8, 8, 15, 363, 26)
SpriteFrame(-4, -8, 8, 15, 372, 26)
SpriteFrame(-4, -8, 8, 15, 381, 26)
SpriteFrame(-4, -8, 8, 15, 390, 26)
SpriteFrame(-4, -8, 8, 15, 399, 26)
SpriteFrame(-4, -8, 8, 15, 408, 26)
SpriteFrame(-4, -8, 8, 15, 417, 26)
SpriteFrame(-4, -8, 8, 15, 426, 26)
SpriteFrame(-4, -8, 8, 15, 435, 26)
SpriteFrame(-4, -8, 8, 15, 444, 26)
SpriteFrame(-4, -8, 8, 15, 453, 26)
SpriteFrame(-4, -8, 8, 15, 462, 26)
SpriteFrame(-4, -8, 8, 15, 471, 26)
SpriteFrame(-4, -8, 8, 15, 480, 26)
SpriteFrame(-4, -8, 8, 15, 381, 42)
SpriteFrame(-4, -8, 8, 15, 390, 42)
SpriteFrame(-4, -8, 8, 15, 399, 42)
SpriteFrame(-4, -8, 8, 15, 408, 42)
SpriteFrame(-4, -8, 8, 15, 489, 26)
SpriteFrame(-4, -8, 8, 15, 498, 26)
SpriteFrame(-12, -8, 24, 15, 417, 42)
SetupMenu(MENU_1, 0, 3, 1)
AddMenuEntry(MENU_1, "COOL!", 0)
AddMenuEntry(MENU_1, "NOT ENOUGH", 0)
AddMenuEntry(MENU_1, "CLAMS ... ", 0)
AddMenuEntry(MENU_1, "GET % CLAMS!", 0)
AddMenuEntry(MENU_1, "GET $% CLAMS!", 0)
AddMenuEntry(MENU_1, "GET #$% CLAMS!", 0)
AddMenuEntry(MENU_1, "% CLAMS TO GO!", 0)
AddMenuEntry(MENU_1, "% CLAMS TO GO!", 0)
AddMenuEntry(MENU_1, "$% CLAMS TO GO!", 0)
AddMenuEntry(MENU_1, "#$% CLAMS TO GO!", 0)
AddMenuEntry(MENU_1, "PLAYER & PLAYER", 0)
AddMenuEntry(MENU_1, "MOST CLAMS WINS!", 0)
AddMenuEntry(MENU_1, "PLAYER ONE WINS!", 0)
AddMenuEntry(MENU_1, "PLAYER TWO WINS!", 0)
AddMenuEntry(MENU_1, "TIE!", 0)
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