mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 12:35:52 -04:00
little bit less hardcoding
This commit is contained in:
parent
c3b7cde53b
commit
30937e92f5
@ -4,12 +4,7 @@ using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Model;
|
||||
using ClassicalSharp.Textures;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -6,12 +6,7 @@ using ClassicalSharp.Map;
|
||||
using ClassicalSharp.Gui.Widgets;
|
||||
using ClassicalSharp.Textures;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Gui.Screens {
|
||||
public sealed class LoadLevelScreen : FilesScreen {
|
||||
|
@ -4,12 +4,7 @@ using System.Drawing;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Gui.Screens;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Gui.Widgets {
|
||||
public class HotbarWidget : Widget {
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using System.Drawing;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Gui.Widgets {
|
||||
public sealed class TableWidget : Widget {
|
||||
|
@ -2,12 +2,7 @@
|
||||
using System;
|
||||
using ClassicalSharp.Entities;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
using BlockRaw = System.Byte;
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
@ -13,73 +8,73 @@ namespace ClassicalSharp {
|
||||
public static class Block {
|
||||
|
||||
#pragma warning disable 1591
|
||||
public const BlockID Air = 0;
|
||||
public const BlockID Stone = 1;
|
||||
public const BlockID Grass = 2;
|
||||
public const BlockID Dirt = 3;
|
||||
public const BlockID Cobblestone = 4;
|
||||
public const BlockID Wood = 5;
|
||||
public const BlockID Sapling = 6;
|
||||
public const BlockID Bedrock = 7;
|
||||
public const BlockID Water = 8;
|
||||
public const BlockID StillWater = 9;
|
||||
public const BlockID Lava = 10;
|
||||
public const BlockID StillLava = 11;
|
||||
public const BlockID Sand = 12;
|
||||
public const BlockID Gravel = 13;
|
||||
public const BlockID GoldOre = 14;
|
||||
public const BlockID IronOre = 15;
|
||||
public const BlockID CoalOre = 16;
|
||||
public const BlockID Log = 17;
|
||||
public const BlockID Leaves = 18;
|
||||
public const BlockID Sponge = 19;
|
||||
public const BlockID Glass = 20;
|
||||
public const BlockID Red = 21;
|
||||
public const BlockID Orange = 22;
|
||||
public const BlockID Yellow = 23;
|
||||
public const BlockID Lime = 24;
|
||||
public const BlockID Green = 25;
|
||||
public const BlockID Teal = 26;
|
||||
public const BlockID Aqua = 27;
|
||||
public const BlockID Cyan = 28;
|
||||
public const BlockID Blue = 29;
|
||||
public const BlockID Indigo = 30;
|
||||
public const BlockID Violet = 31;
|
||||
public const BlockID Magenta = 32;
|
||||
public const BlockID Pink = 33;
|
||||
public const BlockID Black = 34;
|
||||
public const BlockID Gray = 35;
|
||||
public const BlockID White = 36;
|
||||
public const BlockID Dandelion = 37;
|
||||
public const BlockID Rose = 38;
|
||||
public const BlockID BrownMushroom = 39;
|
||||
public const BlockID RedMushroom = 40;
|
||||
public const BlockID Gold = 41;
|
||||
public const BlockID Iron = 42;
|
||||
public const BlockID DoubleSlab = 43;
|
||||
public const BlockID Slab = 44;
|
||||
public const BlockID Brick = 45;
|
||||
public const BlockID TNT = 46;
|
||||
public const BlockID Bookshelf = 47;
|
||||
public const BlockID MossyRocks = 48;
|
||||
public const BlockID Obsidian = 49;
|
||||
public const BlockRaw Air = 0;
|
||||
public const BlockRaw Stone = 1;
|
||||
public const BlockRaw Grass = 2;
|
||||
public const BlockRaw Dirt = 3;
|
||||
public const BlockRaw Cobblestone = 4;
|
||||
public const BlockRaw Wood = 5;
|
||||
public const BlockRaw Sapling = 6;
|
||||
public const BlockRaw Bedrock = 7;
|
||||
public const BlockRaw Water = 8;
|
||||
public const BlockRaw StillWater = 9;
|
||||
public const BlockRaw Lava = 10;
|
||||
public const BlockRaw StillLava = 11;
|
||||
public const BlockRaw Sand = 12;
|
||||
public const BlockRaw Gravel = 13;
|
||||
public const BlockRaw GoldOre = 14;
|
||||
public const BlockRaw IronOre = 15;
|
||||
public const BlockRaw CoalOre = 16;
|
||||
public const BlockRaw Log = 17;
|
||||
public const BlockRaw Leaves = 18;
|
||||
public const BlockRaw Sponge = 19;
|
||||
public const BlockRaw Glass = 20;
|
||||
public const BlockRaw Red = 21;
|
||||
public const BlockRaw Orange = 22;
|
||||
public const BlockRaw Yellow = 23;
|
||||
public const BlockRaw Lime = 24;
|
||||
public const BlockRaw Green = 25;
|
||||
public const BlockRaw Teal = 26;
|
||||
public const BlockRaw Aqua = 27;
|
||||
public const BlockRaw Cyan = 28;
|
||||
public const BlockRaw Blue = 29;
|
||||
public const BlockRaw Indigo = 30;
|
||||
public const BlockRaw Violet = 31;
|
||||
public const BlockRaw Magenta = 32;
|
||||
public const BlockRaw Pink = 33;
|
||||
public const BlockRaw Black = 34;
|
||||
public const BlockRaw Gray = 35;
|
||||
public const BlockRaw White = 36;
|
||||
public const BlockRaw Dandelion = 37;
|
||||
public const BlockRaw Rose = 38;
|
||||
public const BlockRaw BrownMushroom = 39;
|
||||
public const BlockRaw RedMushroom = 40;
|
||||
public const BlockRaw Gold = 41;
|
||||
public const BlockRaw Iron = 42;
|
||||
public const BlockRaw DoubleSlab = 43;
|
||||
public const BlockRaw Slab = 44;
|
||||
public const BlockRaw Brick = 45;
|
||||
public const BlockRaw TNT = 46;
|
||||
public const BlockRaw Bookshelf = 47;
|
||||
public const BlockRaw MossyRocks = 48;
|
||||
public const BlockRaw Obsidian = 49;
|
||||
|
||||
public const BlockID CobblestoneSlab = 50;
|
||||
public const BlockID Rope = 51;
|
||||
public const BlockID Sandstone = 52;
|
||||
public const BlockID Snow = 53;
|
||||
public const BlockID Fire = 54;
|
||||
public const BlockID LightPink = 55;
|
||||
public const BlockID ForestGreen = 56;
|
||||
public const BlockID Brown = 57;
|
||||
public const BlockID DeepBlue = 58;
|
||||
public const BlockID Turquoise = 59;
|
||||
public const BlockID Ice = 60;
|
||||
public const BlockID CeramicTile = 61;
|
||||
public const BlockID Magma = 62;
|
||||
public const BlockID Pillar = 63;
|
||||
public const BlockID Crate = 64;
|
||||
public const BlockID StoneBrick = 65;
|
||||
public const BlockRaw CobblestoneSlab = 50;
|
||||
public const BlockRaw Rope = 51;
|
||||
public const BlockRaw Sandstone = 52;
|
||||
public const BlockRaw Snow = 53;
|
||||
public const BlockRaw Fire = 54;
|
||||
public const BlockRaw LightPink = 55;
|
||||
public const BlockRaw ForestGreen = 56;
|
||||
public const BlockRaw Brown = 57;
|
||||
public const BlockRaw DeepBlue = 58;
|
||||
public const BlockRaw Turquoise = 59;
|
||||
public const BlockRaw Ice = 60;
|
||||
public const BlockRaw CeramicTile = 61;
|
||||
public const BlockRaw Magma = 62;
|
||||
public const BlockRaw Pillar = 63;
|
||||
public const BlockRaw Crate = 64;
|
||||
public const BlockRaw StoneBrick = 65;
|
||||
#pragma warning restore 1591
|
||||
|
||||
public const string RawNames = "Air Stone Grass Dirt Cobblestone Wood Sapling Bedrock Water StillWater Lava" +
|
||||
@ -89,13 +84,13 @@ namespace ClassicalSharp {
|
||||
" Snow Fire LightPink ForestGreen Brown DeepBlue Turquoise Ice CeramicTile Magma Pillar Crate StoneBrick";
|
||||
|
||||
/// <summary> Max block ID used in original classic. </summary>
|
||||
public const BlockID MaxOriginalBlock = Block.Obsidian;
|
||||
public const BlockRaw MaxOriginalBlock = Block.Obsidian;
|
||||
|
||||
/// <summary> Number of blocks in original classic. </summary>
|
||||
public const int OriginalCount = MaxOriginalBlock + 1;
|
||||
|
||||
/// <summary> Max block ID used in original classic plus CPE blocks. </summary>
|
||||
public const BlockID MaxCpeBlock = Block.StoneBrick;
|
||||
public const BlockRaw MaxCpeBlock = Block.StoneBrick;
|
||||
|
||||
/// <summary> Number of blocks in original classic plus CPE blocks. </summary>
|
||||
public const int CpeCount = MaxCpeBlock + 1;
|
||||
|
@ -1,12 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -2,12 +2,7 @@
|
||||
using System;
|
||||
using OpenTK;
|
||||
using ClassicalSharp;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -1,12 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using ClassicalSharp.Blocks;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -1,12 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Blocks {
|
||||
|
||||
|
@ -8,11 +8,7 @@ using ClassicalSharp.Events;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Commands {
|
||||
|
||||
|
@ -2,12 +2,7 @@
|
||||
using System;
|
||||
using ClassicalSharp.Physics;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Entities {
|
||||
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.Physics;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Entities {
|
||||
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.Model;
|
||||
using ClassicalSharp.Physics;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Entities {
|
||||
|
||||
|
@ -6,12 +6,7 @@ using OpenTK;
|
||||
#if ANDROID
|
||||
using Android.Graphics;
|
||||
#endif
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Entities {
|
||||
|
||||
|
@ -2,12 +2,7 @@
|
||||
using System;
|
||||
using ClassicalSharp.Physics;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Entities {
|
||||
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.Model;
|
||||
using ClassicalSharp.Physics;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Entities {
|
||||
|
||||
|
@ -6,12 +6,7 @@ using ClassicalSharp.Physics;
|
||||
using ClassicalSharp.Renderers;
|
||||
using ClassicalSharp.Textures;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Model {
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Events {
|
||||
|
||||
|
@ -24,12 +24,7 @@ using OpenTK.Input;
|
||||
using Android.Graphics;
|
||||
#endif
|
||||
using PathIO = System.IO.Path; // Android.Graphics.Path clash otherwise
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
@ -106,11 +101,7 @@ namespace ClassicalSharp {
|
||||
}
|
||||
|
||||
BlockID DefaultMapping(int i) {
|
||||
#if USE16_BIT
|
||||
if ((i >= Block.CpeCount) || i == Block.Air) return Block.Air;
|
||||
#else
|
||||
if (i >= Block.CpeCount || i == Block.Air) return Block.Air;
|
||||
#endif
|
||||
if (!game.ClassicMode) return (BlockID)i;
|
||||
|
||||
if (i >= 25 && i <= 40) {
|
||||
|
@ -4,12 +4,7 @@ using ClassicalSharp.Entities;
|
||||
using ClassicalSharp.Physics;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -5,18 +5,13 @@
|
||||
// I believe this process adheres to clean room reverse engineering.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
using BlockRaw = System.Byte;
|
||||
|
||||
namespace ClassicalSharp.Generator {
|
||||
|
||||
public sealed partial class NotchyGenerator {
|
||||
|
||||
void FillOblateSpheroid(int x, int y, int z, float radius, BlockID block) {
|
||||
void FillOblateSpheroid(int x, int y, int z, float radius, BlockRaw block) {
|
||||
int xStart = Utils.Floor(Math.Max(x - radius, 0));
|
||||
int xEnd = Utils.Floor(Math.Min(x + radius, Width - 1));
|
||||
int yStart = Utils.Floor(Math.Max(y - radius, 0));
|
||||
@ -38,7 +33,7 @@ namespace ClassicalSharp.Generator {
|
||||
}
|
||||
}
|
||||
|
||||
void FloodFill(int startIndex, BlockID block) {
|
||||
void FloodFill(int startIndex, BlockRaw block) {
|
||||
if (startIndex < 0) return; // y below map, immediately ignore
|
||||
FastIntStack stack = new FastIntStack(4);
|
||||
stack.Push(startIndex);
|
||||
|
@ -1,11 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
using BlockRaw = System.Byte;
|
||||
|
||||
namespace ClassicalSharp.Map {
|
||||
|
||||
@ -14,7 +10,7 @@ namespace ClassicalSharp.Map {
|
||||
|
||||
int CalcHeightAt(int x, int maxY, int z, int index) {
|
||||
int mapIndex = (maxY * length + z) * width + x;
|
||||
BlockID[] blocks = game.World.blocks1;
|
||||
BlockRaw[] blocks = game.World.blocks1;
|
||||
|
||||
for (int y = maxY; y >= 0; y--) {
|
||||
BlockID block = blocks[mapIndex];
|
||||
@ -50,7 +46,7 @@ namespace ClassicalSharp.Map {
|
||||
return elemsLeft;
|
||||
}
|
||||
|
||||
unsafe bool CalculateHeightmapCoverage(int x1, int z1, int xCount, int zCount, int elemsLeft, int* skip, BlockID* mapPtr) {
|
||||
unsafe bool CalculateHeightmapCoverage(int x1, int z1, int xCount, int zCount, int elemsLeft, int* skip, BlockRaw* mapPtr) {
|
||||
int prevRunCount = 0;
|
||||
for (int y = height - 1; y >= 0; y--) {
|
||||
if (elemsLeft <= 0) return true;
|
||||
|
@ -1,12 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using ClassicalSharp.Renderers;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Map {
|
||||
|
||||
|
@ -1,12 +1,8 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using ClassicalSharp.Events;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
using BlockRaw = System.Byte;
|
||||
|
||||
namespace ClassicalSharp.Map {
|
||||
|
||||
@ -67,7 +63,7 @@ namespace ClassicalSharp.Map {
|
||||
}
|
||||
|
||||
|
||||
public unsafe override void LightHint(int startX, int startZ, BlockID* mapPtr) {
|
||||
public unsafe override void LightHint(int startX, int startZ, BlockRaw* mapPtr) {
|
||||
int x1 = Math.Max(startX, 0), x2 = Math.Min(width, startX + 18);
|
||||
int z1 = Math.Max(startZ, 0), z2 = Math.Min(length, startZ + 18);
|
||||
int xCount = x2 - x1, zCount = z2 - z1;
|
||||
|
@ -1,12 +1,8 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
using BlockRaw = System.Byte;
|
||||
|
||||
namespace ClassicalSharp.Map {
|
||||
|
||||
@ -22,7 +18,7 @@ namespace ClassicalSharp.Map {
|
||||
// for z = startZ; z < startZ + 18; z++
|
||||
// CalcHeightAt(x, maxY, z) if height == short.MaxValue
|
||||
// Except this function is a lot more optimised and minimises cache misses.
|
||||
public unsafe abstract void LightHint(int startX, int startZ, BlockID* mapPtr);
|
||||
public unsafe abstract void LightHint(int startX, int startZ, BlockRaw* mapPtr);
|
||||
|
||||
/// <summary> Called when a block is changed, to update the lighting information. </summary>
|
||||
/// <remarks> Derived classes ***MUST*** mark all chunks affected by this lighting change
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.Events;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
using BlockRaw = System.Byte;
|
||||
|
||||
namespace ClassicalSharp.Map {
|
||||
@ -45,12 +40,14 @@ namespace ClassicalSharp.Map {
|
||||
}
|
||||
|
||||
/// <summary> Updates the underlying block array, and dimensions of this map. </summary>
|
||||
public void SetNewMap(BlockID[] blocks, int width, int height, int length) {
|
||||
this.blocks1 = blocks;
|
||||
this.Width = width; MaxX = width - 1;
|
||||
this.Height = height; MaxY = height - 1;
|
||||
this.Length = length; MaxZ = length - 1;
|
||||
if (blocks.Length == 0) this.blocks1 = null;
|
||||
public void SetNewMap(BlockRaw[] blocks, int width, int height, int length) {
|
||||
Width = width; MaxX = width - 1;
|
||||
Height = height; MaxY = height - 1;
|
||||
Length = length; MaxZ = length - 1;
|
||||
|
||||
blocks1 = blocks;
|
||||
if (blocks.Length == 0) blocks1 = null;
|
||||
blocks2 = blocks1;
|
||||
HasBlocks = blocks1 != null;
|
||||
|
||||
if (blocks.Length != (width * height * length))
|
||||
@ -62,7 +59,7 @@ namespace ClassicalSharp.Map {
|
||||
|
||||
/// <summary> Sets the block at the given world coordinates without bounds checking. </summary>
|
||||
public void SetBlock(int x, int y, int z, BlockID blockId) {
|
||||
blocks1[(y * Length + z) * Width + x] = blockId;
|
||||
blocks1[(y * Length + z) * Width + x] = (BlockRaw)blockId;
|
||||
}
|
||||
|
||||
/// <summary> Returns the block at the given world coordinates without bounds checking. </summary>
|
||||
|
@ -1,12 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using ClassicalSharp.Events;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Map {
|
||||
|
||||
|
@ -3,12 +3,7 @@ using ClassicalSharp.Entities;
|
||||
using ClassicalSharp.Map;
|
||||
using System;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Physics {
|
||||
|
||||
@ -20,11 +15,7 @@ namespace ClassicalSharp.Physics {
|
||||
X = x << 3; Y = y << 3; Z = z << 3;
|
||||
X |= (block & 0x007);
|
||||
Y |= (block & 0x038) >> 3;
|
||||
#if !USE16_BIT
|
||||
Z |= (block & 0x0C0) >> 6;
|
||||
#else
|
||||
Z |= (block & 0x1C0) >> 6;
|
||||
#endif
|
||||
this.tSquared = tSquared;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.Map;
|
||||
using ClassicalSharp.Physics;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
public static class Picking {
|
||||
|
@ -2,12 +2,7 @@
|
||||
using System;
|
||||
using ClassicalSharp.Map;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Map;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -5,12 +5,8 @@ using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Map;
|
||||
using ClassicalSharp.Renderers;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
using BlockRaw = System.Byte;
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
@ -36,7 +32,7 @@ namespace ClassicalSharp {
|
||||
protected internal int width, length, height, sidesLevel, edgeLevel;
|
||||
protected int maxX, maxY, maxZ, chunkEndX, chunkEndZ;
|
||||
protected int cIndex;
|
||||
protected BlockID* chunk;
|
||||
protected BlockRaw* chunk;
|
||||
protected byte* counts;
|
||||
protected int* bitFlags;
|
||||
protected bool useBitFlags;
|
||||
@ -44,11 +40,11 @@ namespace ClassicalSharp {
|
||||
bool BuildChunk(int x1, int y1, int z1, ref bool allAir) {
|
||||
light = game.Lighting;
|
||||
PreStretchTiles(x1, y1, z1);
|
||||
BlockID* chunkPtr = stackalloc BlockID[extChunkSize3]; chunk = chunkPtr;
|
||||
BlockRaw* chunkPtr = stackalloc BlockRaw[extChunkSize3]; chunk = chunkPtr;
|
||||
byte* countsPtr = stackalloc byte[chunkSize3 * Side.Sides]; counts = countsPtr;
|
||||
int* bitsPtr = stackalloc int[extChunkSize3]; bitFlags = bitsPtr;
|
||||
|
||||
MemUtils.memset((IntPtr)chunkPtr, 0, 0, extChunkSize3 * sizeof(BlockID));
|
||||
MemUtils.memset((IntPtr)chunkPtr, 0, 0, extChunkSize3 * sizeof(BlockRaw));
|
||||
if (ReadChunkData(x1, y1, z1, ref allAir)) return false;
|
||||
MemUtils.memset((IntPtr)countsPtr, 1, 0, chunkSize3 * Side.Sides);
|
||||
|
||||
@ -81,7 +77,7 @@ namespace ClassicalSharp {
|
||||
|
||||
bool ReadChunkData(int x1, int y1, int z1, ref bool outAllAir) { // only assign this variable once
|
||||
bool allAir = true, allSolid = true;
|
||||
fixed(BlockID* mapPtr = map.blocks1) {
|
||||
fixed (BlockRaw* mapPtr = map.blocks1) {
|
||||
|
||||
for (int yy = -1; yy < 17; yy++) {
|
||||
int y = yy + y1;
|
||||
@ -101,7 +97,7 @@ namespace ClassicalSharp {
|
||||
chunkIndex++;
|
||||
if (x < 0) continue;
|
||||
if (x >= width) break;
|
||||
BlockID rawBlock = mapPtr[index];
|
||||
BlockRaw rawBlock = mapPtr[index];
|
||||
|
||||
allAir = allAir && BlockInfo.Draw[rawBlock] == DrawType.Gas;
|
||||
allSolid = allSolid && BlockInfo.FullOpaque[rawBlock];
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Map;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -4,12 +4,7 @@ using ClassicalSharp.Generator;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Textures;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.Gui.Screens;
|
||||
using ClassicalSharp.Gui.Widgets;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Mode {
|
||||
|
||||
|
@ -2,12 +2,7 @@
|
||||
using System;
|
||||
using ClassicalSharp.Gui.Widgets;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Mode {
|
||||
|
||||
|
@ -6,12 +6,7 @@ using ClassicalSharp.Gui.Screens;
|
||||
using ClassicalSharp.Gui.Widgets;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Mode {
|
||||
|
||||
|
@ -10,12 +10,7 @@ using ClassicalSharp.Gui;
|
||||
using ClassicalSharp.Network;
|
||||
using ClassicalSharp.Textures;
|
||||
using ClassicalSharp.Network.Protocols;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Network {
|
||||
|
||||
|
@ -1,11 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using OpenTK;
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Network.Protocols {
|
||||
|
||||
|
@ -5,12 +5,7 @@ using ClassicalSharp.Hotkeys;
|
||||
using ClassicalSharp.Map;
|
||||
using ClassicalSharp.Textures;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Network.Protocols {
|
||||
|
||||
|
@ -8,12 +8,7 @@ using Ionic.Zlib;
|
||||
#else
|
||||
using System.IO.Compression;
|
||||
#endif
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Network.Protocols {
|
||||
|
||||
@ -135,10 +130,13 @@ namespace ClassicalSharp.Network.Protocols {
|
||||
}
|
||||
|
||||
#if USE16_BIT
|
||||
static ushort[] UInt8sToUInt16s(byte[] src) {
|
||||
ushort[] dst = new ushort[src.Length / 2];
|
||||
Buffer.BlockCopy(src, 0, dst, 0, src.Length);
|
||||
return dst;
|
||||
static void DecomposeArray(byte[] src, out byte[] b1, out byte[] b2) {
|
||||
b1 = new byte[src.Length / 2];
|
||||
b2 = new byte[src.Length / 2];
|
||||
|
||||
for (int i = 0, j = 0; i < src.Length; j++) {
|
||||
b1[j] = src[i++]; b2[j] = src[i++];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -159,9 +157,12 @@ namespace ClassicalSharp.Network.Protocols {
|
||||
|
||||
#if USE16_BIT
|
||||
if (reader.ExtendedBlocks) {
|
||||
game.World.SetNewMap(UInt8sToUInt16s(map), mapWidth, mapHeight, mapLength);
|
||||
byte[] b1, b2;
|
||||
DecomposeArray(map, out b1, out b2);
|
||||
game.World.SetNewMap(b1, mapWidth, mapHeight, mapLength);
|
||||
game.World.blocks2 = b2;
|
||||
} else{
|
||||
game.World.SetNewMap(Utils.UInt8sToUInt16s(map), mapWidth, mapHeight, mapLength);
|
||||
game.World.SetNewMap(map, mapWidth, mapHeight, mapLength);
|
||||
}
|
||||
#else
|
||||
game.World.SetNewMap(map, mapWidth, mapHeight, mapLength);
|
||||
|
@ -3,11 +3,7 @@ using System;
|
||||
using System.Net.Sockets;
|
||||
using ClassicalSharp.Entities;
|
||||
using OpenTK;
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Network {
|
||||
|
||||
@ -91,9 +87,7 @@ namespace ClassicalSharp.Network {
|
||||
}
|
||||
|
||||
public BlockID ReadBlock() {
|
||||
#if USE16_BIT
|
||||
if (ExtendedBlocks) return ReadUInt16();
|
||||
#endif
|
||||
return buffer[index++];
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,7 @@
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using OpenTK;
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Network {
|
||||
|
||||
@ -69,12 +65,8 @@ namespace ClassicalSharp.Network {
|
||||
}
|
||||
|
||||
public void WriteBlock(BlockID value) {
|
||||
#if USE16_BIT
|
||||
if (ExtendedBlocks) { buffer[index++] = (byte)(value >> 8); }
|
||||
buffer[index++] = (byte)value;
|
||||
#else
|
||||
buffer[index++] = value;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
@ -4,12 +4,7 @@ using ClassicalSharp.Entities;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Map;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Particles {
|
||||
|
||||
|
@ -4,12 +4,7 @@ using ClassicalSharp.Events;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Textures;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Particles {
|
||||
|
||||
|
@ -6,12 +6,7 @@ using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Map;
|
||||
using ClassicalSharp.Textures;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Renderers {
|
||||
|
||||
|
@ -5,12 +5,7 @@ using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Map;
|
||||
using ClassicalSharp.Physics;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Renderers {
|
||||
public abstract class EnvRenderer : IGameComponent {
|
||||
|
@ -6,12 +6,7 @@ using ClassicalSharp.Events;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Map;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Renderers {
|
||||
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.Events;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Renderers {
|
||||
|
||||
@ -172,7 +167,7 @@ namespace ClassicalSharp.Renderers {
|
||||
}
|
||||
|
||||
void UpdateFog() {
|
||||
if (map.blocks1 == null || minimal) return;
|
||||
if (!map.HasBlocks || minimal) return;
|
||||
FastColour fogCol = FastColour.White;
|
||||
float fogDensity = 0;
|
||||
BlockOn(out fogDensity, out fogCol);
|
||||
|
@ -4,12 +4,7 @@ using ClassicalSharp.Events;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Map;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Renderers {
|
||||
|
||||
|
@ -5,12 +5,7 @@ using ClassicalSharp.Events;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Model;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Renderers {
|
||||
|
||||
|
@ -6,12 +6,7 @@ using ClassicalSharp.Map;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using ClassicalSharp.Textures;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp.Renderers {
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||
using System;
|
||||
using ClassicalSharp.Map;
|
||||
using BlockID = System.UInt16;
|
||||
using BlockRaw = System.Byte;
|
||||
|
||||
namespace ClassicalSharp.Singleplayer {
|
||||
@ -147,7 +148,7 @@ namespace ClassicalSharp.Singleplayer {
|
||||
{
|
||||
if (!map.IsValidPos(x, y, z)) return false;
|
||||
|
||||
BlockRaw block = map.GetBlock(x, y, z);
|
||||
BlockID block = map.GetBlock(x, y, z);
|
||||
if (!(block == 0 || block == Block.Leaves)) return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -3,17 +3,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using ClassicalSharp.Map;
|
||||
using ClassicalSharp.Events;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
using BlockRaw = System.Byte;
|
||||
|
||||
namespace ClassicalSharp.Singleplayer {
|
||||
|
||||
public delegate void PhysicsAction(int index, BlockID block);
|
||||
public delegate void PhysicsAction(int index, BlockRaw block);
|
||||
|
||||
public class PhysicsBase {
|
||||
Game game;
|
||||
@ -68,19 +63,19 @@ namespace ClassicalSharp.Singleplayer {
|
||||
if (!Enabled) return;
|
||||
Vector3I p = e.Coords;
|
||||
int index = (p.Y * length + p.Z) * width + p.X;
|
||||
BlockID block = e.Block;
|
||||
BlockRaw newB = (BlockRaw)e.Block, oldB = (BlockRaw)e.OldBlock;
|
||||
|
||||
if (block == Block.Air && IsEdgeWater(p.X, p.Y, p.Z)) {
|
||||
block = Block.StillWater;
|
||||
if (newB == Block.Air && IsEdgeWater(p.X, p.Y, p.Z)) {
|
||||
newB = Block.StillWater;
|
||||
game.UpdateBlock(p.X, p.Y, p.Z, Block.StillWater);
|
||||
}
|
||||
|
||||
if (e.Block == 0) {
|
||||
PhysicsAction delete = OnDelete[e.OldBlock];
|
||||
if (delete != null) delete(index, e.OldBlock);
|
||||
if (newB == Block.Air) {
|
||||
PhysicsAction delete = OnDelete[oldB];
|
||||
if (delete != null) delete(index, oldB);
|
||||
} else {
|
||||
PhysicsAction place = OnPlace[block];
|
||||
if (place != null) place(index, block);
|
||||
PhysicsAction place = OnPlace[newB];
|
||||
if (place != null) place(index, newB);
|
||||
}
|
||||
ActivateNeighbours(p.X, p.Y, p.Z, index);
|
||||
}
|
||||
|
@ -3,12 +3,7 @@ using System;
|
||||
using ClassicalSharp.Entities;
|
||||
using ClassicalSharp.Physics;
|
||||
using OpenTK;
|
||||
|
||||
#if USE16_BIT
|
||||
using BlockID = System.UInt16;
|
||||
#else
|
||||
using BlockID = System.Byte;
|
||||
#endif
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
|
@ -237,14 +237,5 @@ namespace ClassicalSharp {
|
||||
| NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint;
|
||||
|
||||
#endif
|
||||
|
||||
#if USE16_BIT
|
||||
public static ushort[] UInt8sToUInt16s(byte[] src) {
|
||||
ushort[] dst = new ushort[src.Length];
|
||||
for (int i = 0; i < dst.Length; i++)
|
||||
dst[i] = src[i];
|
||||
return dst;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user