mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Using ~ in tp/tpp/mark should behave same as ~0
This commit is contained in:
parent
daca4b946f
commit
3d66680b42
@ -155,6 +155,8 @@ namespace MCGalaxy.Commands {
|
||||
bool relative = arg[0] == '~';
|
||||
if (relative) arg = arg.Substring(1);
|
||||
value = 0;
|
||||
// ~ should work as ~0
|
||||
if (relative && arg.Length == 0) return true;
|
||||
|
||||
if (!GetInt(p, arg, axis, ref value)) return false;
|
||||
if (relative) value += cur;
|
||||
|
@ -22,11 +22,7 @@ using MCGalaxy.Drawing.Ops;
|
||||
|
||||
namespace MCGalaxy.Drawing.Brushes {
|
||||
public abstract class BrushFactory {
|
||||
|
||||
/// <summary> Human friendly name of this brush. </summary>
|
||||
public abstract string Name { get; }
|
||||
|
||||
/// <summary> Description of the brush, in addition to its syntax. </summary>
|
||||
public abstract string[] Help { get; }
|
||||
|
||||
/// <summary> Creates a brush from the given arguments,
|
||||
|
@ -20,11 +20,7 @@ using MCGalaxy.Drawing.Ops;
|
||||
|
||||
namespace MCGalaxy.Drawing.Brushes {
|
||||
public abstract class Brush {
|
||||
|
||||
/// <summary> Human friendly name of this brush. </summary>
|
||||
public abstract string Name { get; }
|
||||
|
||||
/// <summary> Performs calcuations (if necessary) for the given drawop. </summary>
|
||||
public virtual void Configure(DrawOp op, Player p) { }
|
||||
|
||||
/// <summary> Returns the next block that should be placed in the world,
|
||||
|
@ -39,8 +39,8 @@ namespace MCGalaxy.Drawing {
|
||||
return Rotate(state, newState, m, transform);
|
||||
}
|
||||
|
||||
static string[] rotY_90 = new string[] { "N", "E", "S", "W", "NE", "SE", "SW", "NW", "WE", "NS", "WE", "NS" };
|
||||
static string[] rotY_180 = new string[] { "W", "E", "N", "S", "NS", "WE", "NE", "SW", "NW", "SE" };
|
||||
static string[] rotY_90 = new string[] { "N", "E", "S", "W", "NE", "SE", "SW", "NW", "WE", "NS", "WE", "NS" };
|
||||
static string[] rotY_180 = new string[] { "W", "E", "N", "S", "NS", "WE", "NE", "SW", "NW", "SE" };
|
||||
static string[] rotY_270 = new string[] { "N", "W", "S", "E", "NE", "NW", "SW", "SE", "WE", "NS", "WE", "NS" };
|
||||
public static CopyState RotateY(CopyState state, int angle, BlockDefinition[] defs) {
|
||||
CopyState newState = Clone(state);
|
||||
|
@ -21,16 +21,8 @@ using System.Drawing;
|
||||
namespace MCGalaxy.Drawing {
|
||||
|
||||
public interface IPaletteMatcher {
|
||||
|
||||
/// <summary> Sets the palette of blocks used to match colors from. </summary>
|
||||
void SetPalette(PaletteEntry[] front, PaletteEntry[] back);
|
||||
|
||||
/// <summary> Returns the best matching block for the given color,
|
||||
/// based on this palette's colorspace. </summary>
|
||||
byte BestMatch(byte R, byte G, byte B);
|
||||
|
||||
/// <summary> Returns the best matching block for the given color,
|
||||
/// based on this palette's colorspace. </summary>
|
||||
byte BestMatch(byte R, byte G, byte B, out bool backLayer);
|
||||
}
|
||||
|
||||
|
@ -22,21 +22,14 @@ namespace MCGalaxy.Drawing {
|
||||
|
||||
/// <summary> Represents a mapping of block ids to RGB colors. </summary>
|
||||
public sealed class ImagePalette {
|
||||
|
||||
/// <summary> The name of this palette. </summary>
|
||||
public string Name;
|
||||
|
||||
/// <summary> Relative file path on disc. </summary>
|
||||
public string FileName { get { return "extra/palettes/" + Name + ".pal"; } }
|
||||
|
||||
/// <summary> Block mapping in this paleete. </summary>
|
||||
public PaletteEntry[] Entries;
|
||||
|
||||
public ImagePalette(string name, PaletteEntry[] entries) {
|
||||
Name = name; Entries = entries;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> All supported palettes. </summary>
|
||||
public static List<ImagePalette> Palettes = new List<ImagePalette>();
|
||||
|
||||
public static ImagePalette Find(string name) {
|
||||
|
@ -58,7 +58,7 @@ namespace MCGalaxy.Drawing {
|
||||
}
|
||||
}
|
||||
|
||||
public Pixel GetGenericPixel(int x, int y) {
|
||||
Pixel GetGenericPixel(int x, int y) {
|
||||
Pixel pixel;
|
||||
int argb = bmp.GetPixel(x, y).ToArgb(); // R/G/B properties incur overhead
|
||||
pixel.A = (byte)(argb >> 24);
|
||||
@ -68,16 +68,16 @@ namespace MCGalaxy.Drawing {
|
||||
return pixel;
|
||||
}
|
||||
|
||||
public Pixel Get24BppPixel(int x, int y) {
|
||||
Pixel Get24BppPixel(int x, int y) {
|
||||
Pixel pixel;
|
||||
byte* ptr = (scan0 + y * data.Stride) + (x * 3);
|
||||
byte* ptr = (scan0 + y * stride) + (x * 3);
|
||||
pixel.B = ptr[0]; pixel.G = ptr[1]; pixel.R = ptr[2]; pixel.A = 255;
|
||||
return pixel;
|
||||
}
|
||||
|
||||
public Pixel Get32BppPixel(int x, int y) {
|
||||
Pixel Get32BppPixel(int x, int y) {
|
||||
Pixel pixel;
|
||||
byte* ptr = (scan0 + y * data.Stride) + (x * 4);
|
||||
byte* ptr = (scan0 + y * stride) + (x * 4);
|
||||
pixel.B = ptr[0]; pixel.G = ptr[1]; pixel.R = ptr[2]; pixel.A = ptr[3];
|
||||
return pixel;
|
||||
}
|
||||
|
@ -15,25 +15,20 @@
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MCGalaxy.Drawing.Brushes;
|
||||
using MCGalaxy.Drawing.Ops;
|
||||
using MCGalaxy.Maths;
|
||||
using System;
|
||||
using MCGalaxy.Drawing.Brushes;
|
||||
using MCGalaxy.Drawing.Ops;
|
||||
using MCGalaxy.Maths;
|
||||
|
||||
namespace MCGalaxy.Drawing.Transforms {
|
||||
public abstract class Transform {
|
||||
|
||||
/// <summary> Human friendly name of this transform. </summary>
|
||||
public abstract string Name { get; }
|
||||
public virtual void Configure(DrawOp op, Player p) { }
|
||||
|
||||
/// <summary> Estimates the total number of blocks that the drawing commands affects,
|
||||
/// after this transformation (e.g. scaling) has been applied to it. </summary>
|
||||
public virtual void GetBlocksAffected(ref long affected) { }
|
||||
|
||||
/// <summary> Performs calcuations (if necessary) for the given drawop. </summary>
|
||||
public virtual void Configure(DrawOp op, Player p) { }
|
||||
|
||||
public abstract void Perform(Vec3S32[] marks, Player p, Level lvl,
|
||||
DrawOp op, Brush brush, DrawOpOutput output);
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ namespace MCGalaxy.Games {
|
||||
public CtfTeam hasflag;
|
||||
|
||||
//Zombie
|
||||
/// <summary> Whether this play is acting as a referee (spectator) in the game. </summary>
|
||||
public bool Referee = false;
|
||||
|
||||
/// <summary> Remaining number of blocks the player can place this round. </summary>
|
||||
@ -106,26 +105,13 @@ namespace MCGalaxy.Games {
|
||||
TimeInfected = DateTime.MinValue;
|
||||
LastInfecter = null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary> The total number of rounds this player has survived. </summary>
|
||||
|
||||
public int TotalRoundsSurvived;
|
||||
|
||||
/// <summary> The maximum number of rounds this player has consecutively survived. </summary>
|
||||
public int MaxRoundsSurvived;
|
||||
|
||||
/// <summary> The current number of rounds this player has consecutively survived. </summary>
|
||||
public int CurrentRoundsSurvived;
|
||||
|
||||
/// <summary> The total number of other players this player has infected. </summary>
|
||||
public int TotalInfected;
|
||||
|
||||
/// <summary> Maximum number of players this player infected in the current round. </summary>
|
||||
public int MaxInfected;
|
||||
|
||||
/// <summary> The current number of other players this player infected in the current round. </summary>
|
||||
public int CurrentInfected;
|
||||
|
||||
public int CurrentInfected;
|
||||
|
||||
internal List<DateTime> NoclipLog = new List<DateTime>(5);
|
||||
internal List<DateTime> SpeedhackLog = new List<DateTime>(5);
|
||||
|
Loading…
x
Reference in New Issue
Block a user