Treat solid white and black pixels in humanoid hats as transparent, allowed speed multiplier to be less than 1.

This commit is contained in:
UnknownShadow200 2015-11-19 16:45:38 +11:00
parent caaafaf754
commit cca0b81f20
6 changed files with 24 additions and 25 deletions

View File

@ -17,7 +17,7 @@ namespace ClassicalSharp {
// Column 1
Make( -140, -100, "Speed multiplier", Anchor.Centre, OnWidgetClick,
g => g.LocalPlayer.SpeedMultiplier.ToString(),
(g, v) => { g.LocalPlayer.SpeedMultiplier = Int32.Parse( v );
(g, v) => { g.LocalPlayer.SpeedMultiplier = Single.Parse( v );
Options.Set( OptionsKey.Speed, v ); } ),
Make( -140, -50, "Show FPS", Anchor.Centre, OnWidgetClick,
@ -89,13 +89,13 @@ namespace ClassicalSharp {
null,
};
validators = new MenuInputValidator[] {
new IntegerValidator( 1, 50 ),
new RealValidator( 0.1f, 50 ),
new BooleanValidator(),
new BooleanValidator(),
new IntegerValidator( 16, 4096 ),
new IntegerValidator( 1, 100 ),
new RealValidator( 0.5f, 2f ),
new RealValidator( 0.25f, 2f ),
new IntegerValidator( 1, 30 ),
new BooleanValidator(),

View File

@ -11,7 +11,7 @@ namespace ClassicalSharp {
public Vector3 SpawnPoint;
public float ReachDistance = 5f;
public int SpeedMultiplier = 10;
public float SpeedMultiplier = 10;
public byte UserType;
public bool PushbackBlockPlacing;

View File

@ -9,7 +9,6 @@ namespace ClassicalSharp {
protected Texture nameTex;
protected internal int PlayerTextureId = -1, MobTextureId = -1;
internal bool RenderHat = true;
public override void Despawn() {
game.Graphics.DeleteTexture( ref PlayerTextureId );

View File

@ -1,7 +1,8 @@
using System;
using System.Drawing;
using ClassicalSharp.Network;
using OpenTK;
using System;
using System.Drawing;
using ClassicalSharp.Model;
using ClassicalSharp.Network;
using OpenTK;
namespace ClassicalSharp {
@ -51,13 +52,14 @@ namespace ClassicalSharp {
try {
SkinType = Utils.GetSkinType( bmp );
if( Model is PlayerModel )
ClearHat( bmp, SkinType );
PlayerTextureId = game.Graphics.CreateTexture( bmp );
MobTextureId = -1;
// Custom mob textures.
if( Utils.IsUrlPrefix( SkinName ) && item.TimeAdded > lastModelChange )
MobTextureId = PlayerTextureId;
RenderHat = HasHat( bmp, SkinType );
MobTextureId = PlayerTextureId;
} catch( NotSupportedException ) {
ResetSkin( bmp );
}
@ -71,7 +73,6 @@ namespace ClassicalSharp {
MobTextureId = -1;
PlayerTextureId = -1;
SkinType = game.DefaultPlayerSkinType;
RenderHat = false;
}
DateTime lastModelChange = new DateTime( 1, 1, 1 );
@ -82,7 +83,7 @@ namespace ClassicalSharp {
MobTextureId = -1;
}
unsafe static bool HasHat( Bitmap bmp, SkinType skinType ) {
unsafe static void ClearHat( Bitmap bmp, SkinType skinType ) {
using( FastBitmap fastBmp = new FastBitmap( bmp, true ) ) {
int sizeX = (bmp.Width / 64) * 32;
int yScale = skinType == SkinType.Type64x32 ? 32 : 64;
@ -95,13 +96,14 @@ namespace ClassicalSharp {
row += sizeX;
for( int x = 0; x < sizeX; x++ ) {
int pixel = row[x];
if( !(pixel == fullWhite || pixel == fullBlack) ) {
return true;
}
Console.WriteLine( pixel.ToString( "X8" ) );
if( pixel == fullWhite ) row[x] = 0;
if( pixel == fullBlack ) row[x] = 0;
Console.WriteLine( row[x].ToString( "X8" ) );
Console.WriteLine( "====" );
}
}
}
return false;
}
}
}

View File

@ -72,7 +72,7 @@ namespace ClassicalSharp {
public int MouseSensitivity = 30;
public int ChatLines = 12;
public bool HideGui = false, ShowFPS = true;
internal float HudScale = 1f;
internal float HudScale = 1.0f;
public Animations Animations;
internal int CloudsTextureId, RainTextureId, SnowTextureId;
@ -124,7 +124,7 @@ namespace ClassicalSharp {
ViewDistance = Options.GetInt( OptionsKey.ViewDist, 16, 4096, 512 );
InputHandler = new InputHandler( this );
Chat = new ChatLog( this );
HudScale = Options.GetFloat( OptionsKey.HudScale, 0.5f, 2f, 1 );
HudScale = Options.GetFloat( OptionsKey.HudScale, 0.25f, 2f, 1 );
defaultIb = Graphics.MakeDefaultIb();
MouseSensitivity = Options.GetInt( OptionsKey.Sensitivity, 1, 100, 30 );
BlockInfo = new BlockInfo();
@ -149,7 +149,7 @@ namespace ClassicalSharp {
BlockInfo.SetDefaultBlockPermissions( Inventory.CanPlace, Inventory.CanDelete );
Map = new Map( this );
LocalPlayer = new LocalPlayer( this );
LocalPlayer.SpeedMultiplier = Options.GetInt( OptionsKey.Speed, 1, 50, 10 );
LocalPlayer.SpeedMultiplier = Options.GetFloat( OptionsKey.Speed, 0.1f, 50, 10 );
Players[255] = LocalPlayer;
width = Width;
height = Height;

View File

@ -74,11 +74,9 @@ namespace ClassicalSharp.Model {
graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4 );
graphics.AlphaTest = true;
if( p.RenderHat ) {
index = 0;
DrawRotate( 0, 24f/16f, 0, -p.PitchRadians, 0, 0, model.Hat );
graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4 );
}
index = 0;
DrawRotate( 0, 24f/16f, 0, -p.PitchRadians, 0, 0, model.Hat );
graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4 );
}
class ModelSet {