Active option should be in yellow-ish text, also make 'done' buttons bigger in classic mode. (Thanks FrostFox)

This commit is contained in:
UnknownShadow200 2016-04-16 22:56:31 +10:00
parent 24b5db5bf6
commit 69a0b146b6
25 changed files with 73 additions and 65 deletions

View File

@ -157,6 +157,7 @@ namespace ClassicalSharp {
Colours['a' + i - 10] = FastColour.GetHexEncodedCol( i ); Colours['a' + i - 10] = FastColour.GetHexEncodedCol( i );
Colours['A' + i - 10] = FastColour.GetHexEncodedCol( i ); Colours['A' + i - 10] = FastColour.GetHexEncodedCol( i );
} }
Colours[255] = new FastColour( 255, 255, 160 );
} }
protected List<TextPart> parts = new List<TextPart>( 64 ); protected List<TextPart> parts = new List<TextPart>( 64 );

View File

@ -18,7 +18,7 @@ namespace ClassicalSharp.Gui {
public override void Render( double delta ) { public override void Render( double delta ) {
if( game.HideGui ) return; if( game.HideGui ) return;
bool showMinimal = game.GetActiveScreen != this; bool showMinimal = game.GetActiveScreen.BlocksWorld;
if( chat.HandlesAllInput ) if( chat.HandlesAllInput )
chat.RenderBackground(); chat.RenderBackground();
api.Texturing = true; api.Texturing = true;

View File

@ -34,7 +34,7 @@ namespace ClassicalSharp.Gui {
if( rows > maxRows ) if( rows > maxRows )
DrawScrollbar(); DrawScrollbar();
api.Texturing = true; api.Texturing = true;
api.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); api.SetBatchFormat( VertexFormat.P3fT2fC4b );
IsometricBlockDrawer.lastTexId = -1; IsometricBlockDrawer.lastTexId = -1;
for( int i = 0; i < blocksTable.Length; i++ ) { for( int i = 0; i < blocksTable.Length; i++ ) {

View File

@ -79,7 +79,7 @@ namespace ClassicalSharp.Gui {
} }
ModelCache cache = game.ModelCache; ModelCache cache = game.ModelCache;
api.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); api.SetBatchFormat( VertexFormat.P3fT2fC4b );
api.UpdateDynamicIndexedVb( DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4 ); api.UpdateDynamicIndexedVb( DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4 );
index = 0; index = 0;
} }

View File

@ -16,49 +16,50 @@ namespace ClassicalSharp.Gui {
widgets = new Widget[] { widgets = new Widget[] {
// Column 1 // Column 1
MakeClassicBool( -1, -200, "Music", OptionsKey.UseMusic, MakeClassicBool( -1, -150, "Music", OptionsKey.UseMusic,
OnWidgetClick, g => g.UseMusic, OnWidgetClick, g => g.UseMusic,
(g, v) => { g.UseMusic = v; g.AudioPlayer.SetMusic( g.UseMusic ); }), (g, v) => { g.UseMusic = v; g.AudioPlayer.SetMusic( g.UseMusic ); }),
MakeClassicBool( -1, -150, "Invert mouse", OptionsKey.InvertMouse, MakeClassicBool( -1, -100, "Invert mouse", OptionsKey.InvertMouse,
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ), OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),
MakeClassic2( -1, -100, "View distance", OnWidgetClick, MakeClassic2( -1, -50, "View distance", OnWidgetClick,
g => g.ViewDistance.ToString(), g => g.ViewDistance.ToString(),
(g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ), (g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ),
!network.IsSinglePlayer ? null : !network.IsSinglePlayer ? null :
MakeClassicBool( -1, -50, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick, MakeClassicBool( -1, 0, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
g => ((SinglePlayerServer)network).physics.Enabled, g => ((SinglePlayerServer)network).physics.Enabled,
(g, v) => ((SinglePlayerServer)network).physics.Enabled = v), (g, v) => ((SinglePlayerServer)network).physics.Enabled = v),
// Column 2 // Column 2
MakeClassicBool( 1, -200, "Sound", OptionsKey.UseSound, MakeClassicBool( 1, -150, "Sound", OptionsKey.UseSound,
OnWidgetClick, g => g.UseSound, OnWidgetClick, g => g.UseSound,
(g, v) => { g.UseSound = v; g.AudioPlayer.SetSound( g.UseSound ); }), (g, v) => { g.UseSound = v; g.AudioPlayer.SetSound( g.UseSound ); }),
MakeClassicBool( 1, -150, "Show FPS", OptionsKey.ShowFPS, MakeClassicBool( 1, -100, "Show FPS", OptionsKey.ShowFPS,
OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v ), OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v ),
MakeClassicBool( 1, -100, "View bobbing", OptionsKey.ViewBobbing, MakeClassicBool( 1, -50, "View bobbing", OptionsKey.ViewBobbing,
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v ), OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v ),
MakeClassic2( 1, -50, "FPS mode", OnWidgetClick, MakeClassic2( 1, 0, "FPS mode", OnWidgetClick,
g => g.FpsLimit.ToString(), g => g.FpsLimit.ToString(),
(g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v ); (g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v );
g.SetFpsLimitMethod( (FpsLimitMethod)raw ); g.SetFpsLimitMethod( (FpsLimitMethod)raw );
Options.Set( OptionsKey.FpsLimit, v ); } ), Options.Set( OptionsKey.FpsLimit, v ); } ),
!game.ClassicHacks ? null : !game.ClassicHacks ? null :
MakeClassicBool( 0, 0, "Hacks enabled", OptionsKey.HacksEnabled, MakeClassicBool( 0, 60, "Hacks enabled", OptionsKey.HacksEnabled,
OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled, OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled,
(g, v) => { g.LocalPlayer.Hacks.Enabled = v; (g, v) => { g.LocalPlayer.Hacks.Enabled = v;
g.LocalPlayer.CheckHacksConsistency(); } ), g.LocalPlayer.CheckHacksConsistency(); } ),
MakeControlsWidget(), MakeControlsWidget(),
MakeBack( false, titleFont, ButtonWidget.Create( game, 0, 25, 301, 40, "Done",
(g, w) => g.SetNewScreen( new PauseScreen( g ) ) ), Anchor.Centre, Anchor.BottomOrRight, titleFont,
LeftOnly( (g, w) => g.SetNewScreen( new PauseScreen( g ) ) ) ),
null, null, null, null,
}; };
MakeValidators(); MakeValidators();
@ -66,9 +67,9 @@ namespace ClassicalSharp.Gui {
Widget MakeControlsWidget() { Widget MakeControlsWidget() {
if( !game.ClassicHacks ) if( !game.ClassicHacks )
return MakeClassic( 0, 50, "Controls", LeftOnly( return MakeClassic( 0, 110, "Controls", LeftOnly(
(g, w) => g.SetNewScreen( new ClassicKeyBindingsScreen( g ) ) ), null, null ); (g, w) => g.SetNewScreen( new ClassicKeyBindingsScreen( g ) ) ), null, null );
return MakeClassic( 0, 50, "Controls", LeftOnly( return MakeClassic( 0, 110, "Controls", LeftOnly(
(g, w) => g.SetNewScreen( new ClassicHacksKeyBindingsScreen( g ) ) ), null, null ); (g, w) => g.SetNewScreen( new ClassicHacksKeyBindingsScreen( g ) ) ), null, null );
} }

View File

@ -47,7 +47,8 @@ namespace ClassicalSharp.Gui {
Make( 140, 50, "Nostalgia options", Make( 140, 50, "Nostalgia options",
(g, w) => g.SetNewScreen( new NostalgiaScreen( g ) ) ), (g, w) => g.SetNewScreen( new NostalgiaScreen( g ) ) ),
MakeBack( true, titleFont, (g, w) => g.SetNewScreen( null ) ), MakeBack( false, titleFont,
(g, w) => g.SetNewScreen( new PauseScreen( g ) ) ),
}; };
} }

View File

@ -62,8 +62,11 @@ namespace ClassicalSharp.Gui {
MakeClassic( 0, 0, "Load level", MakeClassic( 0, 0, "Load level",
(g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ), (g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
MakeClassic( 0, 50, "Save level", 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 ) ),
ButtonWidget.Create( game, 0, 25, 301, 40, "Back to game",
Anchor.Centre, Anchor.BottomOrRight, titleFont,
LeftOnly( (g, w) => g.SetNewScreen( null ) ) ),
game.ClassicMode ? null : game.ClassicMode ? null :
MakeClassic( 0, 150, "Nostalgia options", MakeClassic( 0, 150, "Nostalgia options",

View File

@ -32,6 +32,12 @@ namespace ClassicalSharp.Gui {
public int DesiredMaxWidth, DesiredMaxHeight; public int DesiredMaxWidth, DesiredMaxHeight;
int defaultHeight; int defaultHeight;
internal Font font; internal Font font;
bool active = false;
public override bool Active {
get { return active; }
set { active = value; SetText( Text ); }
}
public override void Init() { public override void Init() {
DrawTextArgs args = new DrawTextArgs( "I", font, true ); DrawTextArgs args = new DrawTextArgs( "I", font, true );
@ -92,6 +98,8 @@ namespace ClassicalSharp.Gui {
void MakeTexture( string text ) { void MakeTexture( string text ) {
DrawTextArgs args = new DrawTextArgs( text, font, true ); DrawTextArgs args = new DrawTextArgs( text, font, true );
if( active )
args.Text = "&" + (char)0xFF + args.Text;
Size size = game.Drawer2D.MeasureChatSize( ref args ); Size size = game.Drawer2D.MeasureChatSize( ref args );
int xOffset = Math.Max( size.Width, DesiredMaxWidth ) - size.Width; int xOffset = Math.Max( size.Width, DesiredMaxWidth ) - size.Width;

View File

@ -14,10 +14,10 @@ namespace ClassicalSharp.Gui {
} }
/// <summary> Whether this widget is currently being moused over. </summary> /// <summary> Whether this widget is currently being moused over. </summary>
public bool Active; public virtual bool Active { get; set; }
/// <summary> Whether this widget is prevented from being interacted with. </summary> /// <summary> Whether this widget is prevented from being interacted with. </summary>
public bool Disabled; public virtual bool Disabled { get; set; }
/// <summary> Invoked when this widget is clicked on. Can be null. </summary> /// <summary> Invoked when this widget is clicked on. Can be null. </summary>
public ClickHandler OnClick; public ClickHandler OnClick;

View File

@ -69,7 +69,7 @@ namespace ClassicalSharp.Entities {
api.texVerts[2] = new VertexP3fT2fC4b( p222, nameTex.U2, nameTex.V1, col ); api.texVerts[2] = new VertexP3fT2fC4b( p222, nameTex.U2, nameTex.V1, col );
api.texVerts[3] = new VertexP3fT2fC4b( p212, nameTex.U2, nameTex.V2, col ); api.texVerts[3] = new VertexP3fT2fC4b( p212, nameTex.U2, nameTex.V2, col );
api.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); api.SetBatchFormat( VertexFormat.P3fT2fC4b );
api.UpdateDynamicIndexedVb( DrawMode.Triangles, api.texVb, api.texVerts, 4, 6 ); api.UpdateDynamicIndexedVb( DrawMode.Triangles, api.texVb, api.texVerts, 4, 6 );
} }

View File

@ -243,8 +243,8 @@ namespace ClassicalSharp.GraphicsAPI {
public Action<double> LostContextFunction; public Action<double> LostContextFunction;
protected void InitDynamicBuffers() { protected void InitDynamicBuffers() {
quadVb = CreateDynamicVb( VertexFormat.Pos3fCol4b, 4 ); quadVb = CreateDynamicVb( VertexFormat.P3fC4b, 4 );
texVb = CreateDynamicVb( VertexFormat.Pos3fTex2fCol4b, 4 ); texVb = CreateDynamicVb( VertexFormat.P3fT2fC4b, 4 );
} }
public virtual void Dispose() { public virtual void Dispose() {
@ -259,7 +259,7 @@ namespace ClassicalSharp.GraphicsAPI {
quadVerts[1] = new VertexP3fC4b( x + width, y, 0, col ); quadVerts[1] = new VertexP3fC4b( x + width, y, 0, col );
quadVerts[2] = new VertexP3fC4b( x + width, y + height, 0, col ); quadVerts[2] = new VertexP3fC4b( x + width, y + height, 0, col );
quadVerts[3] = new VertexP3fC4b( x, y + height, 0, col ); quadVerts[3] = new VertexP3fC4b( x, y + height, 0, col );
SetBatchFormat( VertexFormat.Pos3fCol4b ); SetBatchFormat( VertexFormat.P3fC4b );
UpdateDynamicIndexedVb( DrawMode.Triangles, quadVb, quadVerts, 4, 6 ); UpdateDynamicIndexedVb( DrawMode.Triangles, quadVb, quadVerts, 4, 6 );
} }
@ -277,7 +277,7 @@ namespace ClassicalSharp.GraphicsAPI {
texVerts[1] = new VertexP3fT2fC4b( x2, y1, 0, tex.U2, tex.V1, col ); texVerts[1] = new VertexP3fT2fC4b( x2, y1, 0, tex.U2, tex.V1, col );
texVerts[2] = new VertexP3fT2fC4b( x2, y2, 0, tex.U2, tex.V2, col ); texVerts[2] = new VertexP3fT2fC4b( x2, y2, 0, tex.U2, tex.V2, col );
texVerts[3] = new VertexP3fT2fC4b( x1, y2, 0, tex.U1, tex.V2, col ); texVerts[3] = new VertexP3fT2fC4b( x1, y2, 0, tex.U1, tex.V2, col );
SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); SetBatchFormat( VertexFormat.P3fT2fC4b );
UpdateDynamicIndexedVb( DrawMode.Triangles, texVb, texVerts, 4, 6 ); UpdateDynamicIndexedVb( DrawMode.Triangles, texVb, texVerts, 4, 6 );
} }
@ -352,13 +352,11 @@ namespace ClassicalSharp.GraphicsAPI {
} }
public enum VertexFormat { public enum VertexFormat {
Pos3fCol4b = 0, P3fC4b = 0, P3fT2fC4b = 1,
Pos3fTex2fCol4b = 1,
} }
public enum DrawMode { public enum DrawMode {
Triangles = 0, Triangles = 0, Lines = 1,
Lines = 1,
} }
public enum CompareFunc { public enum CompareFunc {
@ -384,14 +382,10 @@ namespace ClassicalSharp.GraphicsAPI {
} }
public enum Fog { public enum Fog {
Linear = 0, Linear = 0, Exp = 1, Exp2 = 2,
Exp = 1,
Exp2 = 2,
} }
public enum MatrixType { public enum MatrixType {
Projection = 0, Projection = 0, Modelview = 1, Texture = 2,
Modelview = 1,
Texture = 2,
} }
} }

View File

@ -258,12 +258,12 @@ namespace ClassicalSharp.GraphicsAPI {
public override void SetBatchFormat( VertexFormat format ) { public override void SetBatchFormat( VertexFormat format ) {
if( format == batchFormat ) return; if( format == batchFormat ) return;
if( batchFormat == VertexFormat.Pos3fTex2fCol4b ) { if( batchFormat == VertexFormat.P3fT2fC4b ) {
GL.DisableClientState( ArrayCap.TextureCoordArray ); GL.DisableClientState( ArrayCap.TextureCoordArray );
} }
batchFormat = format; batchFormat = format;
if( format == VertexFormat.Pos3fTex2fCol4b ) { if( format == VertexFormat.P3fT2fC4b ) {
GL.EnableClientState( ArrayCap.TextureCoordArray ); GL.EnableClientState( ArrayCap.TextureCoordArray );
setupBatchFunc = setupBatchFuncTex2fCol4b; setupBatchFunc = setupBatchFuncTex2fCol4b;
batchStride = VertexP3fT2fC4b.Size; batchStride = VertexP3fT2fC4b.Size;

View File

@ -237,12 +237,12 @@ namespace ClassicalSharp.GraphicsAPI {
public override void SetBatchFormat( VertexFormat format ) { public override void SetBatchFormat( VertexFormat format ) {
if( format == batchFormat ) return; if( format == batchFormat ) return;
if( batchFormat == VertexFormat.Pos3fTex2fCol4b ) { if( batchFormat == VertexFormat.P3fT2fC4b ) {
GL.DisableClientState( All.TextureCoordArray ); GL.DisableClientState( All.TextureCoordArray );
} }
batchFormat = format; batchFormat = format;
if( format == VertexFormat.Pos3fTex2fCol4b ) { if( format == VertexFormat.P3fT2fC4b ) {
GL.EnableClientState( All.TextureCoordArray ); GL.EnableClientState( All.TextureCoordArray );
setupBatchFunc = setupBatchFuncTex2fCol4b; setupBatchFunc = setupBatchFuncTex2fCol4b;
batchStride = VertexP3fT2fC4b.Size; batchStride = VertexP3fT2fC4b.Size;

View File

@ -97,7 +97,7 @@ namespace ClassicalSharp {
if( part.iCount == 0 ) return; if( part.iCount == 0 ) return;
ChunkPartInfo info; ChunkPartInfo info;
info.VbId = graphics.CreateVb( part.vertices, VertexFormat.Pos3fTex2fCol4b, part.vCount + 2 ); info.VbId = graphics.CreateVb( part.vertices, VertexFormat.P3fT2fC4b, part.vCount + 2 );
info.IndicesCount = part.iCount; info.IndicesCount = part.iCount;
info.leftCount = (ushort)part.Count.left; info.rightCount = (ushort)part.Count.right; info.leftCount = (ushort)part.Count.left; info.rightCount = (ushort)part.Count.right;
info.frontCount = (ushort)part.Count.front; info.backCount = (ushort)part.Count.back; info.frontCount = (ushort)part.Count.front; info.backCount = (ushort)part.Count.back;

View File

@ -67,7 +67,7 @@ namespace ClassicalSharp.Model {
cosHead = (float)Math.Cos( p.HeadYawDegrees * Utils.Deg2Rad ); cosHead = (float)Math.Cos( p.HeadYawDegrees * Utils.Deg2Rad );
sinHead = (float)Math.Sin( p.HeadYawDegrees * Utils.Deg2Rad ); sinHead = (float)Math.Sin( p.HeadYawDegrees * Utils.Deg2Rad );
graphics.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); graphics.SetBatchFormat( VertexFormat.P3fT2fC4b );
DrawModel( p ); DrawModel( p );
} }

View File

@ -18,7 +18,7 @@ namespace ClassicalSharp.Model {
public void InitCache() { public void InitCache() {
vertices = new VertexP3fT2fC4b[24 * 12]; vertices = new VertexP3fT2fC4b[24 * 12];
vb = api.CreateDynamicVb( VertexFormat.Pos3fTex2fCol4b, vertices.Length ); vb = api.CreateDynamicVb( VertexFormat.P3fT2fC4b, vertices.Length );
IModel model = new HumanoidModel( game ); IModel model = new HumanoidModel( game );
model.CreateParts(); model.CreateParts();
cache["humanoid"] = model; cache["humanoid"] = model;

View File

@ -20,7 +20,7 @@ namespace ClassicalSharp.Particles {
public ParticleManager( Game game ) { public ParticleManager( Game game ) {
this.game = game; this.game = game;
rnd = new Random(); rnd = new Random();
vb = game.Graphics.CreateDynamicVb( VertexFormat.Pos3fTex2fCol4b, maxParticles * 4 ); vb = game.Graphics.CreateDynamicVb( VertexFormat.P3fT2fC4b, maxParticles * 4 );
game.Events.TerrainAtlasChanged += TerrainAtlasChanged; game.Events.TerrainAtlasChanged += TerrainAtlasChanged;
} }
@ -35,7 +35,7 @@ namespace ClassicalSharp.Particles {
IGraphicsApi graphics = game.Graphics; IGraphicsApi graphics = game.Graphics;
graphics.Texturing = true; graphics.Texturing = true;
graphics.AlphaTest = true; graphics.AlphaTest = true;
graphics.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); graphics.SetBatchFormat( VertexFormat.P3fT2fC4b );
RenderTerrainParticles( graphics, terrainParticles, terrainCount, delta, t ); RenderTerrainParticles( graphics, terrainParticles, terrainCount, delta, t );
RenderRainParticles( graphics, rainParticles, rainCount, delta, t ); RenderRainParticles( graphics, rainParticles, rainCount, delta, t );

View File

@ -52,10 +52,10 @@ namespace ClassicalSharp {
width = 640; height = 480; width = 640; height = 480;
if( device.Width >= 1024 && device.Height >= 768 ) { if( device.Width >= 1024 && device.Height >= 768 ) {
width = 800; height = 600; //width = 800; height = 600;
} }
if( device.Width >= 1920 && device.Height >= 1080 ) { if( device.Width >= 1920 && device.Height >= 1080 ) {
width = 1600; height = 900; //width = 1600; height = 900;
} }
} }

View File

@ -48,7 +48,7 @@ namespace ClassicalSharp.Renderers {
graphics.Texturing = true; graphics.Texturing = true;
graphics.AlphaTest = true; graphics.AlphaTest = true;
graphics.BindTexture( sideTexId ); graphics.BindTexture( sideTexId );
graphics.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); graphics.SetBatchFormat( VertexFormat.P3fT2fC4b );
if( game.World.SidesBlock != Block.Air ) { if( game.World.SidesBlock != Block.Air ) {
graphics.BindVb( sidesVb ); graphics.BindVb( sidesVb );
graphics.DrawIndexedVb_TrisT2fC4b( sidesVertices * 6 / 4, 0 ); graphics.DrawIndexedVb_TrisT2fC4b( sidesVertices * 6 / 4, 0 );
@ -161,7 +161,7 @@ namespace ClassicalSharp.Renderers {
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 );
DrawX( map.Width, 0, map.Length, y1, y2, axisSize, col, ref vertices ); DrawX( map.Width, 0, map.Length, y1, y2, axisSize, col, ref vertices );
sidesVb = graphics.CreateVb( ptr, VertexFormat.Pos3fTex2fCol4b, sidesVertices ); sidesVb = graphics.CreateVb( ptr, VertexFormat.P3fT2fC4b, sidesVertices );
} }
void RebuildEdges( int waterLevel, int axisSize ) { void RebuildEdges( int waterLevel, int axisSize ) {
@ -177,7 +177,7 @@ namespace ClassicalSharp.Renderers {
foreach( Rectangle rec in rects ) { foreach( Rectangle rec in rects ) {
DrawY( rec.X, rec.Y, rec.X + rec.Width, rec.Y + rec.Height, waterLevel, axisSize, col, -0.1f/16f, 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.P3fT2fC4b, edgesVertices );
} }
void DrawX( int x, int z1, int z2, int y1, int y2, int axisSize, FastColour col, ref VertexP3fT2fC4b* vertices ) { void DrawX( int x, int z1, int z2, int y1, int y2, int axisSize, FastColour col, ref VertexP3fT2fC4b* vertices ) {

View File

@ -11,7 +11,7 @@ namespace ClassicalSharp.Renderers {
// These blocks are treated as having an alpha value of either none or full. // These blocks are treated as having an alpha value of either none or full.
void RenderNormal() { void RenderNormal() {
int[] texIds = game.TerrainAtlas1D.TexIds; int[] texIds = game.TerrainAtlas1D.TexIds;
api.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); api.SetBatchFormat( VertexFormat.P3fT2fC4b );
api.Texturing = true; api.Texturing = true;
api.AlphaTest = true; api.AlphaTest = true;
@ -34,7 +34,7 @@ namespace ClassicalSharp.Renderers {
drawAllFaces = block == Block.Water || block == Block.StillWater; drawAllFaces = block == Block.Water || block == Block.StillWater;
// First fill depth buffer // First fill depth buffer
int[] texIds = game.TerrainAtlas1D.TexIds; int[] texIds = game.TerrainAtlas1D.TexIds;
api.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); api.SetBatchFormat( VertexFormat.P3fT2fC4b );
api.Texturing = false; api.Texturing = false;
api.AlphaBlending = false; api.AlphaBlending = false;
api.ColourWrite = false; api.ColourWrite = false;

View File

@ -29,7 +29,7 @@ namespace ClassicalSharp.Renderers {
float normalY = map.Height + 8; float normalY = map.Height + 8;
float skyY = Math.Max( pos.Y + 8, normalY ); float skyY = Math.Max( pos.Y + 8, normalY );
graphics.SetBatchFormat( VertexFormat.Pos3fCol4b ); graphics.SetBatchFormat( VertexFormat.P3fC4b );
graphics.BindVb( skyVb ); graphics.BindVb( skyVb );
if( skyY == normalY ) { if( skyY == normalY ) {
graphics.DrawIndexedVb( DrawMode.Triangles, skyVertices * 6 / 4, 0 ); graphics.DrawIndexedVb( DrawMode.Triangles, skyVertices * 6 / 4, 0 );
@ -102,7 +102,7 @@ namespace ClassicalSharp.Renderers {
graphics.AlphaTest = true; graphics.AlphaTest = true;
graphics.Texturing = true; graphics.Texturing = true;
graphics.BindTexture( game.CloudsTexId ); graphics.BindTexture( game.CloudsTexId );
graphics.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); graphics.SetBatchFormat( VertexFormat.P3fT2fC4b );
graphics.BindVb( cloudsVb ); graphics.BindVb( cloudsVb );
graphics.DrawIndexedVb_TrisT2fC4b( cloudVertices * 6 / 4, 0 ); graphics.DrawIndexedVb_TrisT2fC4b( cloudVertices * 6 / 4, 0 );
graphics.AlphaTest = false; graphics.AlphaTest = false;
@ -171,7 +171,7 @@ namespace ClassicalSharp.Renderers {
VertexP3fT2fC4b[] vertices = new VertexP3fT2fC4b[cloudVertices]; VertexP3fT2fC4b[] vertices = new VertexP3fT2fC4b[cloudVertices];
DrawCloudsY( x1, z1, x2, z2, map.CloudHeight, axisSize, map.CloudsCol, vertices ); DrawCloudsY( x1, z1, x2, z2, map.CloudHeight, axisSize, map.CloudsCol, vertices );
cloudsVb = graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b, cloudVertices ); cloudsVb = graphics.CreateVb( vertices, VertexFormat.P3fT2fC4b, cloudVertices );
} }
void ResetSky( int extent, int axisSize ) { void ResetSky( int extent, int axisSize ) {
@ -184,7 +184,7 @@ namespace ClassicalSharp.Renderers {
int height = Math.Max( map.Height + 2 + 6, map.CloudHeight + 6); int height = Math.Max( map.Height + 2 + 6, map.CloudHeight + 6);
DrawSkyY( x1, z1, x2, z2, height, axisSize, map.SkyCol, vertices ); DrawSkyY( x1, z1, x2, z2, height, axisSize, map.SkyCol, vertices );
skyVb = graphics.CreateVb( vertices, VertexFormat.Pos3fCol4b, skyVertices ); skyVb = graphics.CreateVb( vertices, VertexFormat.P3fC4b, skyVertices );
} }
void DrawSkyY( int x1, int z1, int x2, int z2, int y, int axisSize, FastColour col, VertexP3fC4b[] vertices ) { void DrawSkyY( int x1, int z1, int x2, int z2, int y, int axisSize, FastColour col, VertexP3fC4b[] vertices ) {

View File

@ -17,7 +17,7 @@ namespace ClassicalSharp.Renderers {
map = game.World; map = game.World;
graphics = game.Graphics; graphics = game.Graphics;
info = game.BlockInfo; info = game.BlockInfo;
weatherVb = graphics.CreateDynamicVb( VertexFormat.Pos3fTex2fCol4b, vertices.Length ); weatherVb = graphics.CreateDynamicVb( VertexFormat.P3fT2fC4b, vertices.Length );
} }
int weatherVb; int weatherVb;
@ -64,7 +64,7 @@ namespace ClassicalSharp.Renderers {
rainAcc = 0; rainAcc = 0;
if( index > 0 ) { if( index > 0 ) {
graphics.SetBatchFormat( VertexFormat.Pos3fTex2fCol4b ); graphics.SetBatchFormat( VertexFormat.P3fT2fC4b );
graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, weatherVb, vertices, index, index * 6 / 4 ); graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, weatherVb, vertices, index, index * 6 / 4 );
} }
graphics.AlphaTest = true; graphics.AlphaTest = true;

View File

@ -20,7 +20,7 @@ namespace ClassicalSharp.Selections {
return; return;
if( vertices == null ) { if( vertices == null ) {
vertices = new VertexP3fC4b[12]; vertices = new VertexP3fC4b[12];
vb = game.Graphics.CreateDynamicVb( VertexFormat.Pos3fCol4b, vertices.Length ); vb = game.Graphics.CreateDynamicVb( VertexFormat.P3fC4b, vertices.Length );
} }
game.Graphics.Texturing = false; game.Graphics.Texturing = false;
Vector3 pos = game.LocalPlayer.Position; pos.Y += 0.05f; Vector3 pos = game.LocalPlayer.Position; pos.Y += 0.05f;
@ -31,7 +31,7 @@ namespace ClassicalSharp.Selections {
if( game.Camera.IsThirdPerson ) if( game.Camera.IsThirdPerson )
VerQuad( ref index, pos.X - size, pos.Y, pos.Z + size, pos.X + size, pos.Y + 3, pos.Z - size, FastColour.Green ); VerQuad( ref index, pos.X - size, pos.Y, pos.Z + size, pos.X + size, pos.Y + 3, pos.Z - size, FastColour.Green );
game.Graphics.SetBatchFormat( VertexFormat.Pos3fCol4b ); game.Graphics.SetBatchFormat( VertexFormat.P3fC4b );
game.Graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, vb, vertices, index, index * 6 / 4 ); game.Graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, vb, vertices, index, index * 6 / 4 );
} }

View File

@ -13,7 +13,7 @@ namespace ClassicalSharp.Renderers {
public PickedPosRenderer( Game game ) { public PickedPosRenderer( Game game ) {
graphics = game.Graphics; graphics = game.Graphics;
vb = graphics.CreateDynamicVb( VertexFormat.Pos3fCol4b, verticesCount ); vb = graphics.CreateDynamicVb( VertexFormat.P3fC4b, verticesCount );
this.game = game; this.game = game;
} }
@ -64,7 +64,7 @@ namespace ClassicalSharp.Renderers {
ZQuad( p2.Z, p1.X, p1.Y, p2.X, p1.Y + size ); ZQuad( p2.Z, p1.X, p1.Y, p2.X, p1.Y + size );
ZQuad( p2.Z, p1.X, p2.Y, p2.X, p2.Y - size ); ZQuad( p2.Z, p1.X, p2.Y, p2.X, p2.Y - size );
graphics.SetBatchFormat( VertexFormat.Pos3fCol4b ); graphics.SetBatchFormat( VertexFormat.P3fC4b );
graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, vb, vertices, verticesCount, verticesCount * 6 / 4 ); graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, vb, vertices, verticesCount, verticesCount * 6 / 4 );
} }

View File

@ -56,7 +56,7 @@ namespace ClassicalSharp.Selections {
box.Render( delta, vertices, lineVertices, ref index, ref lineIndex ); box.Render( delta, vertices, lineVertices, ref index, ref lineIndex );
} }
Graphics.SetBatchFormat( VertexFormat.Pos3fCol4b ); Graphics.SetBatchFormat( VertexFormat.P3fC4b );
Graphics.UpdateDynamicVb( DrawMode.Lines, lineVb, lineVertices, selections.Count * LineVerticesCount ); Graphics.UpdateDynamicVb( DrawMode.Lines, lineVb, lineVertices, selections.Count * LineVerticesCount );
Graphics.DepthWrite = false; Graphics.DepthWrite = false;
@ -80,8 +80,8 @@ namespace ClassicalSharp.Selections {
void InitData() { void InitData() {
vertices = new VertexP3fC4b[256 * VerticesCount]; vertices = new VertexP3fC4b[256 * VerticesCount];
lineVertices = new VertexP3fC4b[256 * LineVerticesCount]; lineVertices = new VertexP3fC4b[256 * LineVerticesCount];
vb = Graphics.CreateDynamicVb( VertexFormat.Pos3fCol4b, vertices.Length ); vb = Graphics.CreateDynamicVb( VertexFormat.P3fC4b, vertices.Length );
lineVb = Graphics.CreateDynamicVb( VertexFormat.Pos3fCol4b, lineVertices.Length ); lineVb = Graphics.CreateDynamicVb( VertexFormat.P3fC4b, lineVertices.Length );
} }
void OnNewMap( object sender, EventArgs e ) { void OnNewMap( object sender, EventArgs e ) {