Skip to content

Commit

Permalink
Making levels fill the whole hscroll buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
MainMemory committed Jun 5, 2015
1 parent 4d4d30a commit 1742dcd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 36 deletions.
Binary file modified Dependencies/SonLVLAPI.dll
Binary file not shown.
8 changes: 7 additions & 1 deletion LZ/LZ.cs
Expand Up @@ -114,7 +114,13 @@ public override void UpdateScrolling(short Camera_X_pos_diff, short Camera_Y_pos
d2 = (byte)(d2 + screenwater);
for (int i = Math.Max(screenwater, 0); i < tmpimg.Height; i++)
Horiz_Scroll_Buf[i] = Camera_BG_X_pos.hsw + Drown_WobbleData[d2++];
levelimg.ScrollHV(tmpimg, 0, Camera_BG_Y_pos, Horiz_Scroll_Buf);
int[] tmpbuf = new int[Horiz_Scroll_Buf.Length];
int y = Camera_BG_Y_pos % levelimg.Height;
if (y < 0)
y += levelimg.Height;
for (int i = 0; i < Horiz_Scroll_Buf.Length; i++)
tmpbuf[(i + y) % Horiz_Scroll_Buf.Length] = Horiz_Scroll_Buf[i];
levelimg.ScrollHV(tmpimg, 0, Camera_BG_Y_pos, tmpbuf);
if (waterMode == WaterMode.Partial)
{
int surfx = -(Camera_BG_X_pos.hsw % 0x20) + 0x60;
Expand Down
8 changes: 1 addition & 7 deletions MZ/MZ.cs
Expand Up @@ -97,14 +97,8 @@ public override void UpdateScrolling(short Camera_X_pos_diff, short Camera_Y_pos
a1 += 9;
TempArray_LayerDef.FastFill(Camera_BG_X_pos.hw, a1, TempArray_LayerDef.Length - a1);
int a2 = 0;
d0.sw = Camera_Y_pos;
d2.w = d0.w;
d0.w &= 0x1F0;
d0.sw >>= 4;
a2 = d0.sw;
d2.w = 16;
a1 = 0;
d2.w &= 0xF;
d2.w = (ushort)(16 - d2.w);
while (a1 < levelimg[AnimFrame].Height)
{
Horiz_Scroll_Buf.FastFill(TempArray_LayerDef[a2++], a1, d2.w);
Expand Down
12 changes: 2 additions & 10 deletions S2DEZ/S2DEZ.cs
Expand Up @@ -35,7 +35,7 @@ public override void Init(int width, int height)
levelimg = LevelData.DrawBackground(null, true, true, false, false);
tmpimg = new BitmapBits(Math.Min(levelimg.Width, width), height);
tmpimg.Bits.FastFill(0x2D);
Horiz_Scroll_Buf = new int[Math.Min(height, levelimg.Height)];
Horiz_Scroll_Buf = new int[levelimg.Height];
if (height > levelimg.Height)
{
Camera_Y_pos = (short)((levelimg.Height / 2) - (height / 2) - 32);
Expand Down Expand Up @@ -114,16 +114,8 @@ public override void UpdateScrolling(short Camera_X_pos_diff, short Camera_Y_pos
TempArray_LayerDef[a2++] = d4.sw;
int a3 = 0;
a2 = 0;
d1 = Math.Max(Camera_Y_pos, 0);
d1 = byte_D48A[0];
d0.l = 0;
do
{
d0.b = byte_D48A[a3++];
++a2;
d1.sw -= d0.sw;
} while (d1.sw >= 0);
d1.sw = (short)-d1.sw;
--a2;
d0.sw = (short)TempArray_LayerDef[a2++];
for (int i = 0; i < Horiz_Scroll_Buf.Length; i++)
{
Expand Down
23 changes: 5 additions & 18 deletions S2HPZ/S2HPZ.cs
Expand Up @@ -29,7 +29,7 @@ public override void Init(int width, int height)
LevelData.BmpPal.Entries[0] = LevelData.Palette[0][2, 0].RGBColor;
levelimg = LevelData.DrawBackground(null, true, true, false, false);
CyclingPal_HPZWater = SonLVLColor.Load("HPZ Water Cycle.bin", EngineVersion.S2).Select(a => a.RGBColor).ToArray();
Horiz_Scroll_Buf = new int[Math.Min(height, levelimg.Height)];
Horiz_Scroll_Buf = new int[levelimg.Height];
tmpimg = new BitmapBits(Math.Min(levelimg.Width, width), Math.Min(levelimg.Height, height));
Camera_Y_pos = (short)((levelimg.Height / 2) - (height / 2) - 0x40);
Camera_BG_X_pos = 0;
Expand Down Expand Up @@ -102,27 +102,14 @@ public override void UpdateScrolling(short Camera_X_pos_diff, short Camera_Y_pos
d0.w >>= 1;
for (int i = 0; i < 0x18; i++)
TempArray_LayerDef[a1++] = d0.sw;
d3 = 0x3F;
a2 = 0;
BWL d4 = Camera_Y_pos;
d2.w = d4.w;
d4.w >>= 4;
d4.w &= d3.w;
d2.w = 16;
a1 = 0;
d2.w &= 0xF;
if (d2.w == 0)
d2 = 16;
while (a2 < Horiz_Scroll_Buf.Length)
{
d0 = -TempArray_LayerDef[d4.w++];
d4.w &= d3.w;
for (int i = 0; i < d2.w; i++)
{
Horiz_Scroll_Buf[a2++] = d0.sl;
if (a2 == Horiz_Scroll_Buf.Length)
break;
}
d2 = 16;
Horiz_Scroll_Buf.FastFill(-TempArray_LayerDef[a1++], a2, d2.w);
a2 += d2.w;
d2.w = (ushort)Math.Min(16, Horiz_Scroll_Buf.Length - a1);
}
levelimg.ScrollHV(tmpimg, 0, Camera_Y_pos, Horiz_Scroll_Buf);
bgimg = tmpimg.ToBitmap(LevelData.BmpPal);
Expand Down

0 comments on commit 1742dcd

Please sign in to comment.