Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Adding SYZ.
- Loading branch information
1 parent
d779117
commit 4dac785
Showing
11 changed files
with
400 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("SYZ")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("SYZ")] | ||
[assembly: AssemblyCopyright("Copyright © 2015")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("2e670501-e06c-4b4e-8417-3c86b8564c0e")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,263 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using SonicRetro.SonLVL.API; | ||
using System.Drawing; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace SYZ | ||
{ | ||
public class SYZ : SonicBGScrollSaver.Level | ||
{ | ||
readonly int[] TempArray_LayerDef = new int[256]; | ||
int[] Horiz_Scroll_Buf; | ||
short Camera_X_pos; | ||
BitmapBits levelimg, tmpimg; | ||
Bitmap bgimg = new Bitmap(1, 1); | ||
int Width, Height; | ||
|
||
public override void Init(int width, int height) | ||
{ | ||
Width = width; | ||
Height = height; | ||
LevelData.LoadGame("./setup.ini"); | ||
LevelData.LoadLevel("Level", true); | ||
LevelData.BmpPal.Entries[0] = LevelData.Palette[0][2, 0].RGBColor; | ||
levelimg = LevelData.DrawBackground(null, true, true, false, false); | ||
tmpimg = new BitmapBits(Math.Min(levelimg.Width, width), height); | ||
Horiz_Scroll_Buf = new int[levelimg.Height]; | ||
Camera_X_pos = 0; | ||
UpdateScrolling(0, 0); | ||
} | ||
|
||
public override Bitmap GetBG() | ||
{ | ||
return bgimg; | ||
} | ||
|
||
public override void UpdateScrolling(short Camera_X_pos_diff, short Camera_Y_pos_diff) | ||
{ | ||
lock (bgimg) | ||
{ | ||
Camera_X_pos += Camera_X_pos_diff; | ||
BitmapBits bmp = new BitmapBits(levelimg); | ||
int a1 = 0; | ||
BWL d2 = Camera_X_pos; | ||
BWL d0 = d2.sw >> 3; | ||
d0.sw -= d2.sw; | ||
d0.ExtendL(); | ||
d0.sl <<= 3; | ||
d0.sl /= 8; | ||
d0.ExtendL(); | ||
d0.sl <<= 12; | ||
BWL d3 = (short)(d2.sw >> 1); | ||
for (int i = 0; i < 8; i++) | ||
{ | ||
TempArray_LayerDef[a1++] = d3.sw; | ||
d3.Swap(); | ||
d3.l += d0.l; | ||
d3.Swap(); | ||
} | ||
d0.w = d2.w; | ||
d0.sw >>= 3; | ||
TempArray_LayerDef.FastFill(d0.sw, a1, 5); | ||
a1 += 5; | ||
d0.w = d2.w; | ||
d0.sw >>= 2; | ||
TempArray_LayerDef.FastFill(d0.sw, a1, 6); | ||
a1 += 6; | ||
d0.w = d2.w; | ||
BWL d1 = d2.w; | ||
d1.sw >>= 1; | ||
d0.w -= d1.w; | ||
d0.ExtendL(); | ||
d0.sw <<= 4; | ||
d0.sl /= 0xE; | ||
d0.ExtendL(); | ||
d0.sl <<= 12; | ||
d3.w = d2.w; | ||
d3.sw >>= 1; | ||
for (int i = 0; i < 14; i++) | ||
{ | ||
TempArray_LayerDef[a1++] = d3.sw; | ||
d3.Swap(); | ||
d3.l += d0.l; | ||
d3.Swap(); | ||
} | ||
int a2 = 0; | ||
a1 = 0; | ||
while (a1 < bmp.Height) | ||
{ | ||
Horiz_Scroll_Buf.FastFill(TempArray_LayerDef[a2++], a1, 16); | ||
a1 += 16; | ||
} | ||
bmp.ScrollHorizontal((int[])Horiz_Scroll_Buf.Clone()); | ||
if (Width < bmp.Width) | ||
bmp = bmp.GetSection(0, 0, Width, bmp.Height); | ||
tmpimg.DrawBitmapBounded(bmp, 0, tmpimg.Height - bmp.Height); | ||
bgimg = tmpimg.ToBitmap(LevelData.BmpPal); | ||
} | ||
} | ||
|
||
public override void PlayMusic() | ||
{ | ||
SonicBGScrollSaver.Music.PlaySong(IniSerializer.Deserialize<MusicInfo>("setup.ini").Music); | ||
} | ||
} | ||
|
||
[StructLayout(LayoutKind.Explicit, Size = 4)] | ||
struct BWL | ||
{ | ||
[FieldOffset(0)] | ||
public byte b; | ||
[FieldOffset(0)] | ||
public sbyte sb; | ||
[FieldOffset(1)] | ||
public byte b1; | ||
[FieldOffset(1)] | ||
public sbyte sb1; | ||
[FieldOffset(2)] | ||
public byte b2; | ||
[FieldOffset(2)] | ||
public sbyte sb2; | ||
[FieldOffset(3)] | ||
public byte b3; | ||
[FieldOffset(3)] | ||
public sbyte sb3; | ||
[FieldOffset(0)] | ||
public ushort w; | ||
[FieldOffset(0)] | ||
public short sw; | ||
[FieldOffset(2)] | ||
public ushort hw; | ||
[FieldOffset(2)] | ||
public short hsw; | ||
[FieldOffset(0)] | ||
public uint l; | ||
[FieldOffset(0)] | ||
public int sl; | ||
|
||
public BWL(byte b) | ||
: this() | ||
{ | ||
this.b = b; | ||
} | ||
|
||
public BWL(sbyte sb) | ||
: this() | ||
{ | ||
this.sb = sb; | ||
} | ||
|
||
public BWL(byte b0, byte b1, byte b2, byte b3) | ||
: this() | ||
{ | ||
b = b0; | ||
this.b1 = b1; | ||
this.b2 = b2; | ||
this.b3 = b3; | ||
} | ||
|
||
public BWL(sbyte sb0, sbyte sb1, sbyte sb2, sbyte sb3) | ||
: this() | ||
{ | ||
sb = sb0; | ||
this.sb1 = sb1; | ||
this.sb2 = sb2; | ||
this.sb3 = sb3; | ||
} | ||
|
||
public BWL(ushort w) | ||
: this() | ||
{ | ||
this.w = w; | ||
} | ||
|
||
public BWL(short sw) | ||
: this() | ||
{ | ||
this.sw = sw; | ||
} | ||
|
||
public BWL(ushort w, ushort hw) | ||
: this() | ||
{ | ||
this.w = w; | ||
this.hw = hw; | ||
} | ||
|
||
public BWL(short sw, short hsw) | ||
: this() | ||
{ | ||
this.sw = sw; | ||
this.hsw = hsw; | ||
} | ||
|
||
public BWL(uint l) | ||
: this() | ||
{ | ||
this.l = l; | ||
} | ||
|
||
public BWL(int sl) | ||
: this() | ||
{ | ||
this.sl = sl; | ||
} | ||
|
||
public void Swap() | ||
{ | ||
ushort tmp = w; | ||
w = hw; | ||
hw = tmp; | ||
} | ||
|
||
public void ExtendW() | ||
{ | ||
sw = sb; | ||
} | ||
|
||
public void ExtendL() | ||
{ | ||
sl = sw; | ||
} | ||
|
||
public static implicit operator BWL(byte b) | ||
{ | ||
return new BWL(b); | ||
} | ||
|
||
public static implicit operator BWL(sbyte sb) | ||
{ | ||
return new BWL(sb); | ||
} | ||
|
||
public static implicit operator BWL(ushort w) | ||
{ | ||
return new BWL(w); | ||
} | ||
|
||
public static implicit operator BWL(short sw) | ||
{ | ||
return new BWL(sw); | ||
} | ||
|
||
public static implicit operator BWL(uint l) | ||
{ | ||
return new BWL(l); | ||
} | ||
|
||
public static implicit operator BWL(int sl) | ||
{ | ||
return new BWL(sl); | ||
} | ||
} | ||
|
||
internal class MusicInfo | ||
{ | ||
[System.ComponentModel.DefaultValue("SpringYard")] | ||
[IniName("music")] | ||
public string Music { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{9FBC0213-1EDF-48D1-B539-63A78F0A662A}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>SYZ</RootNamespace> | ||
<AssemblyName>SYZ</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>..\bin\Debug\SYZ\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>..\bin\Release\SYZ\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="SonLVLAPI"> | ||
<HintPath>..\Dependencies\SonLVLAPI.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Drawing" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="SYZ.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\SonicBGScrollSaver\SonicBGScrollSaver.csproj"> | ||
<Project>{299a269c-28fe-4a88-ad98-1598973cf327}</Project> | ||
<Name>SonicBGScrollSaver</Name> | ||
<Private>False</Private> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="art.bin"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="setup.ini"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Sonic.bin"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="layout.bin"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="blocks.bin"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="chunks.bin"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="palette.bin"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Binary file not shown.
Oops, something went wrong.