Path: blob/main/Scripts/Title/Clouds.txt
1319 views
//------------------Sonic CD Clouds Script--------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Scroll67// Face Buffer flags8#alias 0 : FACE_FLAG_TEXTURED_3D91011sub ObjectDraw12// The clouds move at a speed of 8 per second13// No good units to good here so let's just leave it at that, "8"...14Object.Scroll += 81516// Loop it around, once it reaches the end17Object.Scroll &= 0x7FF1819// Flip it around, to make the Clouds move towards the screen and not away20TempValue0 = Object.Scroll21FlipSign(TempValue0)2223MatrixTranslateXYZ(MAT_WORLD, -512, 720, TempValue0)2425Draw3DScene()2627end sub282930sub ObjectStartup3132// Load the Clouds Sprite Sheet33LoadSpriteSheet("Title/Clouds.gif")3435// No Sprite Frames need to be setup,36// since this object is doing fun 3d stuff with UV's instead37383DScene.NoVertices = 0393DScene.NoFaces = 04041// Note - the numbers getting set here are 0, but they're gonna be overwritten with 0 again a few lines later too42ArrayPos0 = 3DScene.NoVertices43ArrayPos1 = 3DScene.NoFaces4445// Reset vertexes to their starting position46MatrixTranslateXYZ(MAT_WORLD, 0, 0, 0)47MatrixRotateXYZ(MAT_WORLD, 0, 0, 0)48MatrixRotateXYZ(MAT_VIEW, 8, 0, 0)4950// Lots of values used here...51// - ArrayPos0 is the index of the current Vertex52// - ArrarPos1 is the index of the current Face53// - TempValue0 is a counter for Cloud rows54// - TempValue1 is the X Position of the Cloud55// - TempValue2 is the Z Position of the Cloud56// - TempValue3 is a counter for Cloud columns57// - TempValue4 is the X corner of the cloud sprite for the vertex to use58// - TempValue5 is the Y corner of the cloud sprite for the vertex to use5960ArrayPos0 = 061ArrayPos1 = 062TempValue2 = 063TempValue3 = 064TempValue4 = 065TempValue5 = 06667// Make 10 Cloud columns68while TempValue3 < 106970TempValue0 = 071TempValue1 = -0x200072TempValue4 = 07374// Make 16 Cloud rows75while TempValue0 < 167677// Setup 4 vertexes, for a face78// Each face is to be hold a 64x64 texture7980// Top left corner81VertexBuffer[ArrayPos0].x = TempValue182VertexBuffer[ArrayPos0].y = 083VertexBuffer[ArrayPos0].z = TempValue284VertexBuffer[ArrayPos0].u = TempValue485VertexBuffer[ArrayPos0].v = TempValue586ArrayPos0++8788// Bottom left corner89TempValue2 += 51290VertexBuffer[ArrayPos0].x = TempValue191VertexBuffer[ArrayPos0].y = 092VertexBuffer[ArrayPos0].z = TempValue293VertexBuffer[ArrayPos0].u = TempValue494VertexBuffer[ArrayPos0].v = TempValue595VertexBuffer[ArrayPos0].v += 6396ArrayPos0++9798// Top right corner99TempValue2 -= 512100TempValue1 += 1024101VertexBuffer[ArrayPos0].x = TempValue1102VertexBuffer[ArrayPos0].y = 0103VertexBuffer[ArrayPos0].z = TempValue2104VertexBuffer[ArrayPos0].u = TempValue4105VertexBuffer[ArrayPos0].u += 63106VertexBuffer[ArrayPos0].v = TempValue5107ArrayPos0++108109// Bottom right corner110TempValue2 += 512111VertexBuffer[ArrayPos0].x = TempValue1112VertexBuffer[ArrayPos0].y = 0113VertexBuffer[ArrayPos0].z = TempValue2114VertexBuffer[ArrayPos0].u = TempValue4115VertexBuffer[ArrayPos0].u += 63116VertexBuffer[ArrayPos0].v = TempValue5117VertexBuffer[ArrayPos0].v += 63118119TempValue4 += 64120TempValue4 &= 255121TempValue2 -= 512122123// Move back to the index of the Top Left corner vertex124ArrayPos0 -= 3125126// Now, setup the Face's corners127128// Assign the Top Left Vertex - [ArrayPos0 + 0]129FaceBuffer[ArrayPos1].a = ArrayPos0130131// Assign the Top Right Vertex - [ArrayPos0 + 2]132FaceBuffer[ArrayPos1].b = ArrayPos0133FaceBuffer[ArrayPos1].b += 2134135// Assign the Bottom Left Vertex - [ArrayPos0 + 1]136FaceBuffer[ArrayPos1].c = ArrayPos0137FaceBuffer[ArrayPos1].c += 1138139// Assign the Bottom Right Vertex - [ArrayPos0 + 3]140FaceBuffer[ArrayPos1].d = ArrayPos0141FaceBuffer[ArrayPos1].d += 3142143// And then set up the Face's Flag to be a FACE_TEXTURED_3D flag, since the Cloud sprites are to be projected onto the face and all144FaceBuffer[ArrayPos1].Flag = FACE_FLAG_TEXTURED_3D145146// Now, get ready for the next face147148// Bump Vertex index by 4149ArrayPos0 += 4150151// Face Vertex only needs to be bumped by 1152ArrayPos1++153154TempValue0++155156// And then we want it all to actually render too, so bump up the 3DScene rendering values as well1573DScene.NoVertices += 41583DScene.NoFaces++159160loop161162// And now, next column163TempValue5 += 64164TempValue5 &= 255165TempValue2 += 512166TempValue3++167168loop169170end sub171172173// ========================174// Editor Subs175// ========================176177sub RSDKDraw178DrawSprite(0)179end sub180181182sub RSDKLoad183LoadSpriteSheet("Title/Clouds.gif")184SpriteFrame(-128, -128, 256, 256, 0, 0)185186SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")187end sub188189190