mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Fix some of current text in top left not having font changed, hopefully improve view bobbing somewhat.
This commit is contained in:
parent
30c4384d66
commit
1c5ef409ed
@ -83,7 +83,6 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ChatFontChanged( object sender, EventArgs e ) {
|
void ChatFontChanged( object sender, EventArgs e ) {
|
||||||
if( !game.Drawer2D.UseBitmappedChat ) return;
|
|
||||||
Dispose();
|
Dispose();
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ namespace ClassicalSharp {
|
|||||||
rightArmZRot = idleZRot;
|
rightArmZRot = idleZRot;
|
||||||
leftArmZRot = -idleZRot;
|
leftArmZRot = -idleZRot;
|
||||||
|
|
||||||
bobYOffset = -(float)(Math.Abs( Math.Cos( walkTime ) ) * swing * (2/16f));
|
bobYOffset = (float)(Math.Abs( Math.Cos( walkTime ) ) * swing * (2/16f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -81,7 +81,7 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
UpdateAnimState( lastPos, nextPos, delta );
|
UpdateAnimState( lastPos, nextPos, delta );
|
||||||
CheckSkin();
|
CheckSkin();
|
||||||
game.Camera.PlayerTick( delta, prevVel, Velocity, onGround );
|
game.Camera.PlayerTick( delta, prevVel, Velocity, curMovementSpeed, onGround );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RenderModel( double deltaTime, float t ) {
|
public override void RenderModel( double deltaTime, float t ) {
|
||||||
@ -152,6 +152,7 @@ namespace ClassicalSharp {
|
|||||||
normalDrag = new Vector3( 0.91f, 0.98f, 0.91f ),
|
normalDrag = new Vector3( 0.91f, 0.98f, 0.91f ),
|
||||||
airDrag = new Vector3( 0.6f, 1f, 0.6f );
|
airDrag = new Vector3( 0.6f, 1f, 0.6f );
|
||||||
const float liquidGrav = 0.02f, ropeGrav = 0.034f, normalGrav = 0.08f;
|
const float liquidGrav = 0.02f, ropeGrav = 0.034f, normalGrav = 0.08f;
|
||||||
|
float curMovementSpeed;
|
||||||
|
|
||||||
void PhysicsTick( float xMoving, float zMoving ) {
|
void PhysicsTick( float xMoving, float zMoving ) {
|
||||||
float multiply = (flying || noClip) ?
|
float multiply = (flying || noClip) ?
|
||||||
@ -160,6 +161,7 @@ namespace ClassicalSharp {
|
|||||||
float modifier = LowestSpeedModifier();
|
float modifier = LowestSpeedModifier();
|
||||||
float horMul = multiply * modifier;
|
float horMul = multiply * modifier;
|
||||||
float yMul = Math.Max( 1f, multiply / 5 ) * modifier;
|
float yMul = Math.Max( 1f, multiply / 5 ) * modifier;
|
||||||
|
curMovementSpeed = horMul;
|
||||||
|
|
||||||
if( TouchesAnyWater() && !flying && !noClip ) {
|
if( TouchesAnyWater() && !flying && !noClip ) {
|
||||||
Move( xMoving, zMoving, 0.02f * horMul, waterDrag, liquidGrav, 1 );
|
Move( xMoving, zMoving, 0.02f * horMul, waterDrag, liquidGrav, 1 );
|
||||||
|
@ -67,7 +67,7 @@ namespace ClassicalSharp.Model {
|
|||||||
XQuad( extent, TileSide.Left, -extent, extent, true, FastColour.ShadeX );
|
XQuad( extent, TileSide.Left, -extent, extent, true, FastColour.ShadeX );
|
||||||
ZQuad( -extent, TileSide.Front, -extent, extent, true, FastColour.ShadeZ );
|
ZQuad( -extent, TileSide.Front, -extent, extent, true, FastColour.ShadeZ );
|
||||||
|
|
||||||
ZQuad( extent, TileSide.Back, -extent, extent, true, FastColour.ShadeZ );
|
ZQuad( extent, TileSide.Back, -extent, extent, false, FastColour.ShadeZ );
|
||||||
YQuad( blockHeight, TileSide.Top, 1.0f );
|
YQuad( blockHeight, TileSide.Top, 1.0f );
|
||||||
XQuad( -extent, TileSide.Right, -extent, extent, true, FastColour.ShadeX );
|
XQuad( -extent, TileSide.Right, -extent, extent, true, FastColour.ShadeX );
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ namespace ClassicalSharp.Model {
|
|||||||
void TransformVertices() {
|
void TransformVertices() {
|
||||||
for( int i = 0; i < index; i++ ) {
|
for( int i = 0; i < index; i++ ) {
|
||||||
VertexPos3fTex2fCol4b vertex = cache.vertices[i];
|
VertexPos3fTex2fCol4b vertex = cache.vertices[i];
|
||||||
Vector3 newPos = Utils.RotateY( vertex.X, vertex.Y, vertex.Z, cosA, sinA ) + pos;
|
Vector3 newPos = new Vector3( vertex.X, vertex.Y, vertex.Z ) + pos;//Utils.RotateY( vertex.X, vertex.Y, vertex.Z, cosA, sinA ) + pos;
|
||||||
vertex.X = newPos.X; vertex.Y = newPos.Y; vertex.Z = newPos.Z;
|
vertex.X = newPos.X; vertex.Y = newPos.Y; vertex.Z = newPos.Z;
|
||||||
cache.vertices[i] = vertex;
|
cache.vertices[i] = vertex;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace ClassicalSharp.Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override bool Bobbing {
|
public override bool Bobbing {
|
||||||
get { return false; }
|
get { return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override float NameYOffset {
|
public override float NameYOffset {
|
||||||
|
@ -23,8 +23,8 @@ namespace ClassicalSharp {
|
|||||||
public virtual void Tick( double elapsed ) {
|
public virtual void Tick( double elapsed ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void PlayerTick( double elapsed, Vector3 prevVel,
|
public virtual void PlayerTick( double elapsed, Vector3 prevVel, Vector3 nextVel,
|
||||||
Vector3 nextVel, bool onGround ) {
|
float moveSpeed, bool onGround ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool MouseZoom( MouseWheelEventArgs e ) {
|
public virtual bool MouseZoom( MouseWheelEventArgs e ) {
|
||||||
@ -41,11 +41,11 @@ namespace ClassicalSharp {
|
|||||||
public abstract class PerspectiveCamera : Camera {
|
public abstract class PerspectiveCamera : Camera {
|
||||||
|
|
||||||
protected LocalPlayer player;
|
protected LocalPlayer player;
|
||||||
protected Matrix4 BobMatrix;
|
protected Matrix4 titleMatrix;
|
||||||
public PerspectiveCamera( Game game ) {
|
public PerspectiveCamera( Game game ) {
|
||||||
this.game = game;
|
this.game = game;
|
||||||
player = game.LocalPlayer;
|
player = game.LocalPlayer;
|
||||||
BobMatrix = Matrix4.Identity;
|
titleMatrix = Matrix4.Identity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Matrix4 GetProjection() {
|
public override Matrix4 GetProjection() {
|
||||||
@ -104,8 +104,8 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float speed = 0;
|
float speed = 0;
|
||||||
public override void PlayerTick( double elapsed, Vector3 prevVel,
|
public override void PlayerTick( double elapsed, Vector3 prevVel, Vector3 nextVel,
|
||||||
Vector3 nextVel, bool onGround ) {
|
float moveSpeed, bool onGround ) {
|
||||||
if( !onGround || !game.ViewBobbing ) {
|
if( !onGround || !game.ViewBobbing ) {
|
||||||
speed = 0; return;
|
speed = 0; return;
|
||||||
}
|
}
|
||||||
@ -115,10 +115,9 @@ namespace ClassicalSharp {
|
|||||||
zero( prevVel.X ) && zero( prevVel.Z ) ) {
|
zero( prevVel.X ) && zero( prevVel.Z ) ) {
|
||||||
speed = 0;
|
speed = 0;
|
||||||
} else {
|
} else {
|
||||||
float sqrDist = (float)Math.Sqrt( Math.Abs( dist ) * 120 );
|
speed = moveSpeed * 8;
|
||||||
speed += Math.Sign( dist ) * sqrDist;
|
|
||||||
}
|
}
|
||||||
Utils.Clamp( ref speed, 0, 15f );
|
Utils.Clamp( ref speed, 0, 50f );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zero( float value ) {
|
bool zero( float value ) {
|
||||||
@ -133,15 +132,17 @@ namespace ClassicalSharp {
|
|||||||
protected float bobYOffset = 0;
|
protected float bobYOffset = 0;
|
||||||
const float angle = 0.25f * Utils.Deg2Rad;
|
const float angle = 0.25f * Utils.Deg2Rad;
|
||||||
|
|
||||||
protected void CalcBobMatix( double delta ) {
|
protected void CalcViewBobbing( double delta ) {
|
||||||
bobAccumulator += delta * speed;
|
bobAccumulator += delta * speed;
|
||||||
if( speed == 0 ) {
|
if( speed == 0 ) {
|
||||||
BobMatrix = Matrix4.Identity;
|
titleMatrix = Matrix4.Identity;
|
||||||
bobYOffset = 0;
|
bobYOffset = 0;
|
||||||
} else {
|
} else {
|
||||||
float time = (float)Math.Sin( bobAccumulator );
|
float tiltTime = (float)Math.Sin( bobAccumulator );
|
||||||
BobMatrix = Matrix4.RotateZ( time * angle );
|
titleMatrix = Matrix4.RotateZ( tiltTime * angle );
|
||||||
bobYOffset = (float)Math.Sin( bobAccumulator ) * 0.1f;
|
|
||||||
|
float bobTime = (float)Math.Sin( bobAccumulator );
|
||||||
|
bobYOffset = bobTime * (1/16f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,11 +160,11 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override Matrix4 GetView( double delta ) {
|
public override Matrix4 GetView( double delta ) {
|
||||||
CalcBobMatix( delta );
|
CalcViewBobbing( delta );
|
||||||
Vector3 eyePos = player.EyePosition;
|
Vector3 eyePos = player.EyePosition;
|
||||||
eyePos.Y += bobYOffset;
|
eyePos.Y += bobYOffset;
|
||||||
Vector3 cameraPos = eyePos - Utils.GetDirVector( player.YawRadians, player.PitchRadians ) * distance;
|
Vector3 cameraPos = eyePos - Utils.GetDirVector( player.YawRadians, player.PitchRadians ) * distance;
|
||||||
return Matrix4.LookAt( cameraPos, eyePos, Vector3.UnitY ) * BobMatrix;
|
return Matrix4.LookAt( cameraPos, eyePos, Vector3.UnitY ) * titleMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsThirdPerson {
|
public override bool IsThirdPerson {
|
||||||
@ -188,11 +189,11 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override Matrix4 GetView( double delta ) {
|
public override Matrix4 GetView( double delta ) {
|
||||||
CalcBobMatix( delta );
|
CalcViewBobbing( delta );
|
||||||
Vector3 eyePos = player.EyePosition;
|
Vector3 eyePos = player.EyePosition;
|
||||||
eyePos.Y += bobYOffset;
|
eyePos.Y += bobYOffset;
|
||||||
Vector3 cameraPos = eyePos + Utils.GetDirVector( player.YawRadians, player.PitchRadians ) * distance;
|
Vector3 cameraPos = eyePos + Utils.GetDirVector( player.YawRadians, player.PitchRadians ) * distance;
|
||||||
return Matrix4.LookAt( cameraPos, eyePos, Vector3.UnitY ) * BobMatrix;
|
return Matrix4.LookAt( cameraPos, eyePos, Vector3.UnitY ) * titleMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsThirdPerson {
|
public override bool IsThirdPerson {
|
||||||
@ -211,11 +212,11 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
|
|
||||||
public override Matrix4 GetView( double delta ) {
|
public override Matrix4 GetView( double delta ) {
|
||||||
CalcBobMatix( delta );
|
CalcViewBobbing( delta );
|
||||||
Vector3 eyePos = player.EyePosition;
|
Vector3 eyePos = player.EyePosition;
|
||||||
eyePos.Y += bobYOffset;
|
eyePos.Y += bobYOffset;
|
||||||
Vector3 cameraDir = Utils.GetDirVector( player.YawRadians, player.PitchRadians );
|
Vector3 cameraDir = Utils.GetDirVector( player.YawRadians, player.PitchRadians );
|
||||||
return Matrix4.LookAt( eyePos, eyePos + cameraDir, Vector3.UnitY ) * BobMatrix;
|
return Matrix4.LookAt( eyePos, eyePos + cameraDir, Vector3.UnitY ) * titleMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsThirdPerson {
|
public override bool IsThirdPerson {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user