mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 20:15:35 -04:00
Modifiable liquids should affect all translucent blocks, translucent blocks should show as such in the block in hand, also fix seaming visibilities between translucent blocks on the outside of the map and inside it.
This commit is contained in:
parent
0a8f0a063f
commit
d86f599a5d
@ -41,7 +41,7 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
public float[] FogDensity = new float[BlocksCount];
|
public float[] FogDensity = new float[BlocksCount];
|
||||||
|
|
||||||
public BlockCollideType[] CollideType = new BlockCollideType[BlocksCount];
|
public CollideType[] Collide = new CollideType[BlocksCount];
|
||||||
|
|
||||||
public float[] SpeedMultiplier = new float[BlocksCount];
|
public float[] SpeedMultiplier = new float[BlocksCount];
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace ClassicalSharp {
|
|||||||
BlocksLight[tile] = true;
|
BlocksLight[tile] = true;
|
||||||
IsOpaque[tile] = true;
|
IsOpaque[tile] = true;
|
||||||
IsOpaqueY[tile] = true;
|
IsOpaqueY[tile] = true;
|
||||||
CollideType[tile] = BlockCollideType.Solid;
|
Collide[tile] = CollideType.Solid;
|
||||||
SpeedMultiplier[tile] = 1;
|
SpeedMultiplier[tile] = 1;
|
||||||
CullWithNeighbours[tile] = true;
|
CullWithNeighbours[tile] = true;
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ namespace ClassicalSharp {
|
|||||||
FogColour[(byte)Block.StillLava] = new FastColour( 153, 25, 0 );
|
FogColour[(byte)Block.StillLava] = new FastColour( 153, 25, 0 );
|
||||||
FogDensity[(byte)Block.Lava] = 2f;
|
FogDensity[(byte)Block.Lava] = 2f;
|
||||||
FogColour[(byte)Block.Lava] = new FastColour( 153, 25, 0 );
|
FogColour[(byte)Block.Lava] = new FastColour( 153, 25, 0 );
|
||||||
CollideType[(byte)Block.Snow] = BlockCollideType.WalkThrough;
|
Collide[(byte)Block.Snow] = CollideType.WalkThrough;
|
||||||
SpeedMultiplier[0] = 1f;
|
SpeedMultiplier[0] = 1f;
|
||||||
CullWithNeighbours[(byte)Block.Leaves] = false;
|
CullWithNeighbours[(byte)Block.Leaves] = false;
|
||||||
SetupTextures();
|
SetupTextures();
|
||||||
@ -142,7 +142,7 @@ namespace ClassicalSharp {
|
|||||||
BlocksLight[(int)id] = false;
|
BlocksLight[(int)id] = false;
|
||||||
IsOpaque[(int)id] = false;
|
IsOpaque[(int)id] = false;
|
||||||
IsOpaqueY[(int)id] = false;
|
IsOpaqueY[(int)id] = false;
|
||||||
CollideType[(int)id] = BlockCollideType.WalkThrough;
|
Collide[(int)id] = CollideType.WalkThrough;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkTranslucent( Block id ) {
|
void MarkTranslucent( Block id ) {
|
||||||
@ -153,7 +153,7 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
void SetIsLiquid( Block id ) {
|
void SetIsLiquid( Block id ) {
|
||||||
IsLiquid[(int)id] = true;
|
IsLiquid[(int)id] = true;
|
||||||
CollideType[(int)id] = BlockCollideType.SwimThrough;
|
Collide[(int)id] = CollideType.SwimThrough;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBlockHeight( Block id, float height ) {
|
void SetBlockHeight( Block id, float height ) {
|
||||||
@ -179,7 +179,7 @@ namespace ClassicalSharp {
|
|||||||
Name[id] = "Invalid";
|
Name[id] = "Invalid";
|
||||||
FogColour[id] = default( FastColour );
|
FogColour[id] = default( FastColour );
|
||||||
FogDensity[id] = 0;
|
FogDensity[id] = 0;
|
||||||
CollideType[id] = BlockCollideType.Solid;
|
Collide[id] = CollideType.Solid;
|
||||||
SpeedMultiplier[id] = 1;
|
SpeedMultiplier[id] = 1;
|
||||||
SetAll( 0, (Block)id );
|
SetAll( 0, (Block)id );
|
||||||
if( updateCulling )
|
if( updateCulling )
|
||||||
@ -191,7 +191,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum BlockCollideType : byte {
|
public enum CollideType : byte {
|
||||||
WalkThrough, // i.e. gas or sprite
|
WalkThrough, // i.e. gas or sprite
|
||||||
SwimThrough, // i.e. liquid
|
SwimThrough, // i.e. liquid
|
||||||
Solid, // i.e. solid
|
Solid, // i.e. solid
|
||||||
|
@ -30,7 +30,7 @@ namespace ClassicalSharp.Entities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool GetBoundingBox( byte block, int x, int y, int z, ref BoundingBox box ) {
|
bool GetBoundingBox( byte block, int x, int y, int z, ref BoundingBox box ) {
|
||||||
if( info.CollideType[block] != BlockCollideType.Solid ) return false;
|
if( info.Collide[block] != CollideType.Solid ) return false;
|
||||||
Add( x, y, z, ref info.MinBB[block], ref box.Min );
|
Add( x, y, z, ref info.MinBB[block], ref box.Min );
|
||||||
Add( x, y, z, ref info.MaxBB[block], ref box.Max );
|
Add( x, y, z, ref info.MaxBB[block], ref box.Max );
|
||||||
return true;
|
return true;
|
||||||
@ -243,7 +243,7 @@ namespace ClassicalSharp.Entities {
|
|||||||
BoundingBox blockBB = new BoundingBox( min, max );
|
BoundingBox blockBB = new BoundingBox( min, max );
|
||||||
if( !blockBB.Intersects( adjFinalBB ) )
|
if( !blockBB.Intersects( adjFinalBB ) )
|
||||||
continue;
|
continue;
|
||||||
if( info.CollideType[GetPhysicsBlockId( x, y, z )] == BlockCollideType.Solid )
|
if( info.Collide[GetPhysicsBlockId( x, y, z )] == CollideType.Solid )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -78,7 +78,7 @@ namespace ClassicalSharp.Entities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool StandardLiquid( byte block ) {
|
bool StandardLiquid( byte block ) {
|
||||||
return info.CollideType[block] == BlockCollideType.SwimThrough;
|
return info.Collide[block] == CollideType.SwimThrough;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Vector3 waterDrag = new Vector3( 0.8f, 0.8f, 0.8f ),
|
static Vector3 waterDrag = new Vector3( 0.8f, 0.8f, 0.8f ),
|
||||||
@ -204,8 +204,8 @@ namespace ClassicalSharp.Entities {
|
|||||||
{
|
{
|
||||||
byte block = game.World.SafeGetBlock( x, y, z );
|
byte block = game.World.SafeGetBlock( x, y, z );
|
||||||
if( block == 0 ) continue;
|
if( block == 0 ) continue;
|
||||||
BlockCollideType type = info.CollideType[block];
|
CollideType type = info.Collide[block];
|
||||||
if( type == BlockCollideType.Solid && !checkSolid )
|
if( type == CollideType.Solid && !checkSolid )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Vector3 min = new Vector3( x, y, z ) + info.MinBB[block];
|
Vector3 min = new Vector3( x, y, z ) + info.MinBB[block];
|
||||||
@ -214,7 +214,7 @@ namespace ClassicalSharp.Entities {
|
|||||||
if( !blockBB.Intersects( bounds ) ) continue;
|
if( !blockBB.Intersects( bounds ) ) continue;
|
||||||
|
|
||||||
modifier = Math.Min( modifier, info.SpeedMultiplier[block] );
|
modifier = Math.Min( modifier, info.SpeedMultiplier[block] );
|
||||||
if( block >= BlockInfo.CpeBlocksCount && type == BlockCollideType.SwimThrough )
|
if( block >= BlockInfo.CpeBlocksCount && type == CollideType.SwimThrough )
|
||||||
useLiquidGravity = true;
|
useLiquidGravity = true;
|
||||||
}
|
}
|
||||||
return modifier;
|
return modifier;
|
||||||
|
@ -103,8 +103,8 @@ namespace ClassicalSharp.Entities {
|
|||||||
// then check block standing on
|
// then check block standing on
|
||||||
byte blockUnder = (byte)BlockUnderFeet;
|
byte blockUnder = (byte)BlockUnderFeet;
|
||||||
SoundType typeUnder = game.BlockInfo.StepSounds[blockUnder];
|
SoundType typeUnder = game.BlockInfo.StepSounds[blockUnder];
|
||||||
BlockCollideType collideType = game.BlockInfo.CollideType[blockUnder];
|
CollideType collideType = game.BlockInfo.Collide[blockUnder];
|
||||||
if( collideType == BlockCollideType.Solid && typeUnder != SoundType.None ) {
|
if( collideType == CollideType.Solid && typeUnder != SoundType.None ) {
|
||||||
anyNonAir = true; sndType = typeUnder; return;
|
anyNonAir = true; sndType = typeUnder; return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,8 +116,8 @@ namespace ClassicalSharp.Entities {
|
|||||||
|
|
||||||
bool CheckSoundNonSolid( byte b ) {
|
bool CheckSoundNonSolid( byte b ) {
|
||||||
SoundType newType = game.BlockInfo.StepSounds[b];
|
SoundType newType = game.BlockInfo.StepSounds[b];
|
||||||
BlockCollideType collide = game.BlockInfo.CollideType[b];
|
CollideType collide = game.BlockInfo.Collide[b];
|
||||||
if( newType != SoundType.None && collide != BlockCollideType.Solid )
|
if( newType != SoundType.None && collide != CollideType.Solid )
|
||||||
sndType = newType;
|
sndType = newType;
|
||||||
if( b != 0 ) anyNonAir = true;
|
if( b != 0 ) anyNonAir = true;
|
||||||
return false;
|
return false;
|
||||||
@ -244,8 +244,8 @@ namespace ClassicalSharp.Entities {
|
|||||||
for( int y = p.Y; y <= game.World.Height; y++ ) {
|
for( int y = p.Y; y <= game.World.Height; y++ ) {
|
||||||
byte block1 = physics.GetPhysicsBlockId( p.X, y, p.Z );
|
byte block1 = physics.GetPhysicsBlockId( p.X, y, p.Z );
|
||||||
byte block2 = physics.GetPhysicsBlockId( p.X, y + 1, p.Z );
|
byte block2 = physics.GetPhysicsBlockId( p.X, y + 1, p.Z );
|
||||||
if( info.CollideType[block1] != BlockCollideType.Solid &&
|
if( info.Collide[block1] != CollideType.Solid &&
|
||||||
info.CollideType[block2] != BlockCollideType.Solid ) {
|
info.Collide[block2] != CollideType.Solid ) {
|
||||||
p.Y = y;
|
p.Y = y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -498,9 +498,9 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal bool CanPick( byte block ) {
|
internal bool CanPick( byte block ) {
|
||||||
if( BlockInfo.IsAir[block] )
|
if( BlockInfo.IsAir[block] ) return false;
|
||||||
return false;
|
if( !BlockInfo.IsTranslucent[block] ||
|
||||||
if( !BlockInfo.IsLiquid[block] ) return true;
|
BlockInfo.Collide[block] == CollideType.Solid ) return true;
|
||||||
|
|
||||||
return !ModifiableLiquids ? false :
|
return !ModifiableLiquids ? false :
|
||||||
Inventory.CanPlace[block] && Inventory.CanDelete[block];
|
Inventory.CanPlace[block] && Inventory.CanDelete[block];
|
||||||
|
@ -175,7 +175,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CannotPassThrough( byte block ) {
|
bool CannotPassThrough( byte block ) {
|
||||||
return game.BlockInfo.CollideType[block] == BlockCollideType.Solid;
|
return game.BlockInfo.Collide[block] == CollideType.Solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntersectsOtherPlayers( Vector3 pos, byte newType ) {
|
bool IntersectsOtherPlayers( Vector3 pos, byte newType ) {
|
||||||
|
@ -144,7 +144,7 @@ namespace ClassicalSharp {
|
|||||||
Vector3 min = info.MinBB[tile], max = info.MaxBB[tile];
|
Vector3 min = info.MinBB[tile], max = info.MaxBB[tile];
|
||||||
x1 = x + min.X; y1 = y + min.Y; z1 = z + min.Z;
|
x1 = x + min.X; y1 = y + min.Y; z1 = z + min.Z;
|
||||||
x2 = x + max.X; y2 = y + max.Y; z2 = z + max.Z;
|
x2 = x + max.X; y2 = y + max.Y; z2 = z + max.Z;
|
||||||
if( isTranslucent && info.CollideType[tile] != BlockCollideType.Solid ) {
|
if( isTranslucent && info.Collide[tile] != CollideType.Solid ) {
|
||||||
x1 -= 0.1f/16; x2 -= 0.1f/16f; z1 -= 0.1f/16f; z2 -= 0.1f/16f;
|
x1 -= 0.1f/16; x2 -= 0.1f/16f; z1 -= 0.1f/16f; z2 -= 0.1f/16f;
|
||||||
y1 -= 0.1f/16; y2 -= 0.1f/16f;
|
y1 -= 0.1f/16; y2 -= 0.1f/16f;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ namespace ClassicalSharp.Map {
|
|||||||
WriteTag( NbtTagType.String );
|
WriteTag( NbtTagType.String );
|
||||||
WriteString( "Name" ); WriteString( info.Name[id] );
|
WriteString( "Name" ); WriteString( info.Name[id] );
|
||||||
WriteTag( NbtTagType.Int8 );
|
WriteTag( NbtTagType.Int8 );
|
||||||
WriteString( "CollideType" ); WriteUInt8( (byte)info.CollideType[id] );
|
WriteString( "CollideType" ); WriteUInt8( (byte)info.Collide[id] );
|
||||||
float speed = info.SpeedMultiplier[id];
|
float speed = info.SpeedMultiplier[id];
|
||||||
WriteTag( NbtTagType.Real32 );
|
WriteTag( NbtTagType.Real32 );
|
||||||
WriteString( "Speed" ); WriteInt32( *((int*)&speed) );
|
WriteString( "Speed" ); WriteInt32( *((int*)&speed) );
|
||||||
|
@ -128,7 +128,7 @@ namespace ClassicalSharp.Map {
|
|||||||
byte id = (byte)compound["ID"].Value;
|
byte id = (byte)compound["ID"].Value;
|
||||||
BlockInfo info = game.BlockInfo;
|
BlockInfo info = game.BlockInfo;
|
||||||
info.Name[id] = (string)compound["Name"].Value;
|
info.Name[id] = (string)compound["Name"].Value;
|
||||||
info.CollideType[id] = (BlockCollideType)compound["CollideType"].Value;
|
info.Collide[id] = (CollideType)compound["CollideType"].Value;
|
||||||
info.SpeedMultiplier[id] = (float)compound["Speed"].Value;
|
info.SpeedMultiplier[id] = (float)compound["Speed"].Value;
|
||||||
|
|
||||||
byte[] data = (byte[])compound["Textures"].Value;
|
byte[] data = (byte[])compound["Textures"].Value;
|
||||||
@ -155,7 +155,7 @@ namespace ClassicalSharp.Map {
|
|||||||
info.MinBB[id] = new Vector3( data[0] / 16f, data[1] / 16f, data[2] / 16f );
|
info.MinBB[id] = new Vector3( data[0] / 16f, data[1] / 16f, data[2] / 16f );
|
||||||
info.MaxBB[id] = new Vector3( data[3] / 16f, data[4] / 16f, data[5] / 16f );
|
info.MaxBB[id] = new Vector3( data[3] / 16f, data[4] / 16f, data[5] / 16f );
|
||||||
|
|
||||||
if( info.CollideType[id] != BlockCollideType.Solid ) {
|
if( info.Collide[id] != CollideType.Solid ) {
|
||||||
info.IsTransparent[id] = true;
|
info.IsTransparent[id] = true;
|
||||||
info.IsOpaque[id] = false;
|
info.IsOpaque[id] = false;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ namespace ClassicalSharp {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( info.CollideType[block] == BlockCollideType.Solid && !info.IsAir[block] ) {
|
if( info.Collide[block] == CollideType.Solid && !info.IsAir[block] ) {
|
||||||
float t0, t1;
|
float t0, t1;
|
||||||
const float adjust = 0.1f;
|
const float adjust = 0.1f;
|
||||||
if( Intersection.RayIntersectsBox( origin, dir, min, max, out t0, out t1 ) ) {
|
if( Intersection.RayIntersectsBox( origin, dir, min, max, out t0, out t1 ) ) {
|
||||||
|
@ -67,8 +67,8 @@ namespace ClassicalSharp.Net {
|
|||||||
info.ResetBlockInfo( block, false );
|
info.ResetBlockInfo( block, false );
|
||||||
|
|
||||||
info.Name[block] = reader.ReadAsciiString();
|
info.Name[block] = reader.ReadAsciiString();
|
||||||
info.CollideType[block] = (BlockCollideType)reader.ReadUInt8();
|
info.Collide[block] = (CollideType)reader.ReadUInt8();
|
||||||
if( info.CollideType[block] != BlockCollideType.Solid ) {
|
if( info.Collide[block] != CollideType.Solid ) {
|
||||||
info.IsTransparent[block] = true;
|
info.IsTransparent[block] = true;
|
||||||
info.IsOpaque[block] = false;
|
info.IsOpaque[block] = false;
|
||||||
}
|
}
|
||||||
|
@ -34,12 +34,8 @@ namespace ClassicalSharp.Renderers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Render( double delta, float t ) {
|
public void Render( double delta, float t ) {
|
||||||
if( game.Camera.IsThirdPerson || !game.ShowBlockInHand )
|
if( game.Camera.IsThirdPerson || !game.ShowBlockInHand ) return;
|
||||||
return;
|
|
||||||
game.Graphics.Texturing = true;
|
|
||||||
game.Graphics.DepthTest = false;
|
|
||||||
game.Graphics.AlphaTest = true;
|
|
||||||
|
|
||||||
fakeP.Position = Vector3.Zero;
|
fakeP.Position = Vector3.Zero;
|
||||||
type = (byte)game.Inventory.HeldBlock;
|
type = (byte)game.Inventory.HeldBlock;
|
||||||
if( playAnimation )
|
if( playAnimation )
|
||||||
@ -53,15 +49,23 @@ namespace ClassicalSharp.Renderers {
|
|||||||
game.Graphics.LoadMatrix( ref normalMat );
|
game.Graphics.LoadMatrix( ref normalMat );
|
||||||
game.Graphics.SetMatrixMode( MatrixType.Projection );
|
game.Graphics.SetMatrixMode( MatrixType.Projection );
|
||||||
game.Graphics.LoadMatrix( ref game.HeldBlockProjection );
|
game.Graphics.LoadMatrix( ref game.HeldBlockProjection );
|
||||||
|
bool translucent = game.BlockInfo.IsTranslucent[type];
|
||||||
|
|
||||||
|
game.Graphics.Texturing = true;
|
||||||
|
game.Graphics.DepthTest = false;
|
||||||
|
if( translucent ) game.Graphics.AlphaBlending = true;
|
||||||
|
else game.Graphics.AlphaTest = true;
|
||||||
fakeP.Block = type;
|
fakeP.Block = type;
|
||||||
block.Render( fakeP );
|
block.Render( fakeP );
|
||||||
|
|
||||||
game.Graphics.LoadMatrix( ref game.Projection );
|
game.Graphics.LoadMatrix( ref game.Projection );
|
||||||
game.Graphics.SetMatrixMode( MatrixType.Modelview );
|
game.Graphics.SetMatrixMode( MatrixType.Modelview );
|
||||||
game.Graphics.LoadMatrix( ref game.View );
|
game.Graphics.LoadMatrix( ref game.View );
|
||||||
|
|
||||||
game.Graphics.Texturing = false;
|
game.Graphics.Texturing = false;
|
||||||
game.Graphics.DepthTest = true;
|
game.Graphics.DepthTest = true;
|
||||||
game.Graphics.AlphaTest = false;
|
if( translucent ) game.Graphics.AlphaBlending = false;
|
||||||
|
else game.Graphics.AlphaTest = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
double animPeriod = 0.25, animSpeed = Math.PI / 0.25;
|
double animPeriod = 0.25, animSpeed = Math.PI / 0.25;
|
||||||
|
@ -148,7 +148,7 @@ namespace ClassicalSharp.Renderers {
|
|||||||
fullColSides = game.BlockInfo.FullBright[(byte)game.World.SidesBlock];
|
fullColSides = game.BlockInfo.FullBright[(byte)game.World.SidesBlock];
|
||||||
FastColour col = fullColSides ? FastColour.White : map.Shadowlight;
|
FastColour col = fullColSides ? FastColour.White : map.Shadowlight;
|
||||||
foreach( Rectangle rec in rects ) {
|
foreach( Rectangle rec in rects ) {
|
||||||
DrawY( rec.X, rec.Y, rec.X + rec.Width, rec.Y + rec.Height, groundLevel, axisSize, col, ref vertices );
|
DrawY( rec.X, rec.Y, rec.X + rec.Width, rec.Y + rec.Height, groundLevel, axisSize, col, 0, ref vertices );
|
||||||
}
|
}
|
||||||
// Work properly for when ground level is below 0
|
// Work properly for when ground level is below 0
|
||||||
int y1 = 0, y2 = groundLevel;
|
int y1 = 0, y2 = groundLevel;
|
||||||
@ -156,7 +156,7 @@ namespace ClassicalSharp.Renderers {
|
|||||||
y1 = groundLevel;
|
y1 = groundLevel;
|
||||||
y2 = 0;
|
y2 = 0;
|
||||||
}
|
}
|
||||||
DrawY( 0, 0, map.Width, map.Length, 0, axisSize, col, ref vertices );
|
DrawY( 0, 0, map.Width, map.Length, 0, axisSize, col, 0, ref vertices );
|
||||||
DrawZ( 0, 0, map.Width, y1, y2, axisSize, col, ref vertices );
|
DrawZ( 0, 0, map.Width, y1, y2, axisSize, col, ref vertices );
|
||||||
DrawZ( map.Length, 0, map.Width, y1, y2, axisSize, col, ref vertices );
|
DrawZ( map.Length, 0, map.Width, y1, y2, axisSize, col, ref vertices );
|
||||||
DrawX( 0, 0, map.Length, y1, y2, axisSize, col, ref vertices );
|
DrawX( 0, 0, map.Length, y1, y2, axisSize, col, ref vertices );
|
||||||
@ -175,7 +175,7 @@ namespace ClassicalSharp.Renderers {
|
|||||||
fullColEdge = game.BlockInfo.FullBright[(byte)game.World.EdgeBlock];
|
fullColEdge = game.BlockInfo.FullBright[(byte)game.World.EdgeBlock];
|
||||||
FastColour col = fullColEdge ? FastColour.White : map.Sunlight;
|
FastColour col = fullColEdge ? FastColour.White : map.Sunlight;
|
||||||
foreach( Rectangle rec in rects ) {
|
foreach( Rectangle rec in rects ) {
|
||||||
DrawY( rec.X, rec.Y, rec.X + rec.Width, rec.Y + rec.Height, waterLevel - 0.1f/16f, axisSize, col, ref vertices );
|
DrawY( rec.X, rec.Y, rec.X + rec.Width, rec.Y + rec.Height, waterLevel, axisSize, col, -0.1f/16f, ref vertices );
|
||||||
}
|
}
|
||||||
edgesVb = graphics.CreateVb( ptr, VertexFormat.Pos3fTex2fCol4b, edgesVertices );
|
edgesVb = graphics.CreateVb( ptr, VertexFormat.Pos3fTex2fCol4b, edgesVertices );
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ namespace ClassicalSharp.Renderers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawY( int x1, int z1, int x2, int z2, float y, int axisSize, FastColour col, ref VertexPos3fTex2fCol4b* vertices ) {
|
void DrawY( int x1, int z1, int x2, int z2, float y, int axisSize, FastColour col, float offset, ref VertexPos3fTex2fCol4b* vertices ) {
|
||||||
int endX = x2, endZ = z2, startZ = z1;
|
int endX = x2, endZ = z2, startZ = z1;
|
||||||
for( ; x1 < endX; x1 += axisSize ) {
|
for( ; x1 < endX; x1 += axisSize ) {
|
||||||
x2 = x1 + axisSize;
|
x2 = x1 + axisSize;
|
||||||
@ -229,10 +229,10 @@ namespace ClassicalSharp.Renderers {
|
|||||||
if( z2 > endZ ) z2 = endZ;
|
if( z2 > endZ ) z2 = endZ;
|
||||||
|
|
||||||
TextureRec rec = new TextureRec( 0, 0, x2 - x1, z2 - z1 );
|
TextureRec rec = new TextureRec( 0, 0, x2 - x1, z2 - z1 );
|
||||||
*vertices++ = new VertexPos3fTex2fCol4b( x1, y, z1, rec.U1, rec.V1, col );
|
*vertices++ = new VertexPos3fTex2fCol4b( x1 + offset, y + offset, z1 + offset, rec.U1, rec.V1, col );
|
||||||
*vertices++ = new VertexPos3fTex2fCol4b( x1, y, z2, rec.U1, rec.V2, col );
|
*vertices++ = new VertexPos3fTex2fCol4b( x1 + offset, y + offset, z2 + offset, rec.U1, rec.V2, col );
|
||||||
*vertices++ = new VertexPos3fTex2fCol4b( x2, y, z2, rec.U2, rec.V2, col );
|
*vertices++ = new VertexPos3fTex2fCol4b( x2 + offset, y + offset, z2 + offset, rec.U2, rec.V2, col );
|
||||||
*vertices++ = new VertexPos3fTex2fCol4b( x2, y, z1, rec.U2, rec.V1, col );
|
*vertices++ = new VertexPos3fTex2fCol4b( x2 + offset, y + offset, z1 + offset, rec.U2, rec.V1, col );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ namespace ClassicalSharp.Singleplayer {
|
|||||||
byte block = map.mapData[posIndex];
|
byte block = map.mapData[posIndex];
|
||||||
if( block == (byte)Block.Water || block == (byte)Block.StillWater ) {
|
if( block == (byte)Block.Water || block == (byte)Block.StillWater ) {
|
||||||
game.UpdateBlock( x, y, z, (byte)Block.Stone );
|
game.UpdateBlock( x, y, z, (byte)Block.Stone );
|
||||||
} else if( info.CollideType[block] == BlockCollideType.WalkThrough ) {
|
} else if( info.Collide[block] == CollideType.WalkThrough ) {
|
||||||
Lava.Enqueue( defLavaTick | (uint)posIndex );
|
Lava.Enqueue( defLavaTick | (uint)posIndex );
|
||||||
game.UpdateBlock( x, y, z, (byte)Block.Lava );
|
game.UpdateBlock( x, y, z, (byte)Block.Lava );
|
||||||
}
|
}
|
||||||
@ -250,7 +250,7 @@ namespace ClassicalSharp.Singleplayer {
|
|||||||
byte block = map.mapData[posIndex];
|
byte block = map.mapData[posIndex];
|
||||||
if( block == (byte)Block.Lava || block == (byte)Block.StillLava ) {
|
if( block == (byte)Block.Lava || block == (byte)Block.StillLava ) {
|
||||||
game.UpdateBlock( x, y, z, (byte)Block.Stone );
|
game.UpdateBlock( x, y, z, (byte)Block.Stone );
|
||||||
} else if( info.CollideType[block] == BlockCollideType.WalkThrough && block != (byte)Block.Rope ) {
|
} else if( info.Collide[block] == CollideType.WalkThrough && block != (byte)Block.Rope ) {
|
||||||
if( CheckIfSponge( x, y, z ) ) return;
|
if( CheckIfSponge( x, y, z ) ) return;
|
||||||
Water.Enqueue( defWaterTick | (uint)posIndex );
|
Water.Enqueue( defWaterTick | (uint)posIndex );
|
||||||
game.UpdateBlock( x, y, z, (byte)Block.Water );
|
game.UpdateBlock( x, y, z, (byte)Block.Water );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user