mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 18:45:23 -04:00
Make jump height calculation more precise and only show three significant figures (Thanks MrGoober), also always show generate/load options but disabled in multiplayer.
This commit is contained in:
parent
998ffe5eb9
commit
3e05ba60de
@ -32,7 +32,7 @@ namespace ClassicalSharp {
|
||||
Options.Set( OptionsKey.CameraClipping, v == "yes" ); } ),
|
||||
|
||||
Make( -140, 0, "Jump height", OnWidgetClick,
|
||||
g => g.LocalPlayer.JumpHeight.ToString(),
|
||||
g => g.LocalPlayer.JumpHeight.ToString( "F3" ),
|
||||
(g, v) => g.LocalPlayer.CalculateJumpVelocity( Single.Parse( v ) ) ),
|
||||
|
||||
Make( -140, 50, "Double jump", OnWidgetClick,
|
||||
@ -41,10 +41,10 @@ namespace ClassicalSharp {
|
||||
Options.Set( OptionsKey.DoubleJump, v == "yes" ); } ),
|
||||
|
||||
// Column 2
|
||||
Make( 140, -150, "Liquids breakable", OnWidgetClick,
|
||||
g => g.LiquidsBreakable ? "yes" : "no",
|
||||
(g, v) => { g.LiquidsBreakable = v == "yes";
|
||||
Options.Set( OptionsKey.LiquidsBreakable, v == "yes" ); } ),
|
||||
Make( 140, -150, "Modifiable liquids", OnWidgetClick,
|
||||
g => g.ModifiableLiquids ? "yes" : "no",
|
||||
(g, v) => { g.ModifiableLiquids = v == "yes";
|
||||
Options.Set( OptionsKey.ModifiableLiquids, v == "yes" ); } ),
|
||||
|
||||
Make( 140, -100, "Pushback placing", OnWidgetClick,
|
||||
g => g.LocalPlayer.Hacks.PushbackPlacing ? "yes" : "no",
|
||||
@ -109,9 +109,17 @@ namespace ClassicalSharp {
|
||||
|
||||
void MakeDescriptions() {
|
||||
descriptions = new string[widgets.Length][];
|
||||
descriptions[2] = new [] {
|
||||
"&eIf camera clipping is set to true, then the third person",
|
||||
"&ecameras will limit their zoom distance if they hit a solid block.",
|
||||
};
|
||||
descriptions[3] = new [] {
|
||||
"&eSets how many blocks high you can jump up.",
|
||||
"&eNote: You jump much higher when holding down the speed key binding.",
|
||||
};
|
||||
descriptions[5] = new [] {
|
||||
"&eIf breaking liquids is set to true, then water/lava",
|
||||
"&ecan be deleted the same way as any regular block.",
|
||||
"&eIf modifiable liquids is set to true, then water/lava can",
|
||||
"&ebe placed and deleted the same way as any other block.",
|
||||
};
|
||||
descriptions[6] = new [] {
|
||||
"&eWhen this is active, placing blocks that intersect your own position",
|
||||
|
@ -44,11 +44,9 @@ namespace ClassicalSharp {
|
||||
// Column 2
|
||||
Make( 140, -150, "Save level",
|
||||
(g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
|
||||
!game.Network.IsSinglePlayer ? null :
|
||||
Make( 140, -100, "Load level",
|
||||
Make( 140, -100, "Load level",
|
||||
(g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
|
||||
!game.Network.IsSinglePlayer ? null :
|
||||
Make( 140, -50, "Generate level",
|
||||
Make( 140, -50, "Generate level",
|
||||
(g, w) => g.SetNewScreen( new GenLevelScreen( g ) ) ),
|
||||
Make( 140, 0, "Select texture pack",
|
||||
(g, w) => g.SetNewScreen( new TexturePackScreen( g ) ) ),
|
||||
@ -64,40 +62,44 @@ namespace ClassicalSharp {
|
||||
MakeBack( true, titleFont,
|
||||
(g, w) => g.SetNewScreen( null ) ),
|
||||
};
|
||||
if( !game.Network.IsSinglePlayer ) {
|
||||
widgets[6].Disabled = true;
|
||||
widgets[7].Disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MakeClassic() {
|
||||
widgets = new Widget[] {
|
||||
MakeClassic( 0, -100, "Options",
|
||||
(g, w) => g.SetNewScreen( new ClassicOptionsScreen( g ) ) ),
|
||||
!game.Network.IsSinglePlayer ? null :
|
||||
MakeClassic( 0, -50, "Generate level",
|
||||
(g, w) => g.SetNewScreen( new GenLevelScreen( g ) ) ),
|
||||
!game.Network.IsSinglePlayer ? null :
|
||||
MakeClassic( 0, 0, "Load level",
|
||||
(g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
|
||||
(g, w) => g.SetNewScreen( new ClassicOptionsScreen( g ) ) ),
|
||||
|
||||
MakeClassic( 0, -50, "Generate level",
|
||||
(g, w) => g.SetNewScreen( new GenLevelScreen( g ) ) ),
|
||||
|
||||
MakeClassic( 0, 0, "Load level",
|
||||
(g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
|
||||
|
||||
MakeClassic( 0, 50, "Save level",
|
||||
(g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
|
||||
(g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
|
||||
|
||||
MakeBack( true, titleFont,
|
||||
(g, w) => g.SetNewScreen( null ) ),
|
||||
|
||||
game.PureClassicMode ? null :
|
||||
MakeClassic( 0, 150, "Nostalgia options",
|
||||
(g, w) => g.SetNewScreen( new NostalgiaScreen( g ) ) ),
|
||||
(g, w) => g.SetNewScreen( new NostalgiaScreen( g ) ) ),
|
||||
};
|
||||
if( !game.Network.IsSinglePlayer ) {
|
||||
widgets[1].Disabled = true;
|
||||
widgets[2].Disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckHacksAllowed( object sender, EventArgs e ) {
|
||||
for( int i = 0; i < widgets.Length; i++ ) {
|
||||
if( widgets[i] == null ) continue;
|
||||
widgets[i].Disabled = false;
|
||||
}
|
||||
if( !game.LocalPlayer.Hacks.CanAnyHacks && !game.UseClassicOptions ) {
|
||||
widgets[3].Disabled = true; // env settings
|
||||
widgets[8].Disabled = true; // select texture pack
|
||||
}
|
||||
if( game.UseClassicOptions ) return;
|
||||
|
||||
widgets[3].Disabled = !game.LocalPlayer.Hacks.CanAnyHacks; // env settings
|
||||
widgets[8].Disabled = !game.LocalPlayer.Hacks.CanAnyHacks; // select texture pack
|
||||
}
|
||||
|
||||
ButtonWidget Make( int x, int y, string text, Action<Game, Widget> onClick ) {
|
||||
|
@ -232,9 +232,8 @@ namespace ClassicalSharp {
|
||||
if( jumpHeight >= 512 ) jumpVel = 16.5f;
|
||||
if( jumpHeight >= 768 ) jumpVel = 22.5f;
|
||||
|
||||
while( GetMaxHeight( jumpVel ) <= jumpHeight ) {
|
||||
jumpVel += 0.01f;
|
||||
}
|
||||
while( GetMaxHeight( jumpVel ) <= jumpHeight )
|
||||
jumpVel += 0.001f;
|
||||
}
|
||||
|
||||
static double GetMaxHeight( float u ) {
|
||||
|
@ -19,7 +19,7 @@ namespace ClassicalSharp {
|
||||
int coordsCount = 0;
|
||||
Vector3I* coords = stackalloc Vector3I[4];
|
||||
for( int i = 0; i < 4; i++ )
|
||||
coords[i] = Vector3I.Zero;
|
||||
coords[i] = new Vector3I( int.MinValue );
|
||||
|
||||
if( mode == EntityShadow.SnapToBlock ) {
|
||||
vb = game.Graphics.texVb; verts = game.Graphics.texVerts;
|
||||
|
@ -140,7 +140,7 @@ namespace ClassicalSharp {
|
||||
public bool ClickableChat = false, HideGui = false, ShowFPS = true;
|
||||
internal float HotbarScale = 1, ChatScale = 1, InventoryScale = 1;
|
||||
public bool ViewBobbing, ShowBlockInHand;
|
||||
public bool UseSound, UseMusic, LiquidsBreakable;
|
||||
public bool UseSound, UseMusic, ModifiableLiquids;
|
||||
|
||||
public Vector3 CurrentCameraPos;
|
||||
|
||||
|
@ -142,7 +142,7 @@ namespace ClassicalSharp {
|
||||
MapBordersRenderer.Init();
|
||||
Picking = new PickedPosRenderer( this );
|
||||
AudioPlayer = new AudioPlayer( this );
|
||||
LiquidsBreakable = Options.GetBool( OptionsKey.LiquidsBreakable, false );
|
||||
ModifiableLiquids = Options.GetBool( OptionsKey.ModifiableLiquids, false );
|
||||
AxisLinesRenderer = new AxisLinesRenderer( this );
|
||||
|
||||
LoadIcon();
|
||||
@ -494,7 +494,7 @@ namespace ClassicalSharp {
|
||||
return false;
|
||||
if( !BlockInfo.IsLiquid[block] ) return true;
|
||||
|
||||
return !LiquidsBreakable ? false :
|
||||
return !ModifiableLiquids ? false :
|
||||
Inventory.CanPlace[block] && Inventory.CanDelete[block];
|
||||
}
|
||||
|
||||
|
@ -349,8 +349,8 @@ namespace ClassicalSharp {
|
||||
p.CheckHacksConsistency();
|
||||
|
||||
float jumpHeight = reader.ReadInt16() / 32f;
|
||||
if( jumpHeight < 0 ) jumpHeight = 39/32f;
|
||||
p.CalculateJumpVelocity( jumpHeight );
|
||||
if( jumpHeight < 0 ) p.jumpVel = 0.42f;
|
||||
else p.CalculateJumpVelocity( jumpHeight );
|
||||
p.serverJumpVel = p.jumpVel;
|
||||
game.Events.RaiseHackPermissionsChanged();
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ namespace ClassicalSharp {
|
||||
// Workaround for older D3 servers which wrote one byte too many for HackControl packets.
|
||||
if( opcode == 0xFF && lastOpcode == PacketId.CpeHackControl ) {
|
||||
reader.Remove( 1 );
|
||||
game.LocalPlayer.CalculateJumpVelocity( 39/32f ); // assume default jump height
|
||||
game.LocalPlayer.jumpVel = 0.42f; // assume default jump height
|
||||
game.LocalPlayer.serverJumpVel = game.LocalPlayer.jumpVel;
|
||||
continue;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace ClassicalSharp {
|
||||
public const string HacksEnabled = "hacks-hacksenabled";
|
||||
public const string FieldOfView = "hacks-fov";
|
||||
public const string Speed = "hacks-speedmultiplier";
|
||||
public const string LiquidsBreakable = "hacks-liquidsbreakable";
|
||||
public const string ModifiableLiquids = "hacks-liquidsbreakable";
|
||||
public const string PushbackPlacing = "hacks-pushbackplacing";
|
||||
public const string NoclipSlide = "hacks-noclipslide";
|
||||
public const string CameraClipping = "hacks-cameraclipping";
|
||||
|
Loading…
x
Reference in New Issue
Block a user