Fix backspace from last two commits

This commit is contained in:
UnknownShadow200 2017-08-24 15:04:46 +10:00
parent 7ca611c978
commit 9ae9329b7e
7 changed files with 74 additions and 63 deletions

View File

@ -185,8 +185,11 @@ namespace ClassicalSharp {
"█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u00a0";
public static bool IsValidInputChar(char c, bool supportsCP437) {
bool isCP437 = UnicodeToCP437(c) != c;
return supportsCP437 || !isCP437;
if (c == '?') return true;
byte cp437 = UnicodeToCP437(c);
if (cp437 == '?') return false; // not code page 437
return supportsCP437 || (cp437 == c);
}
public static byte UnicodeToCP437(char c) {

View File

@ -31,4 +31,5 @@ void AnimatedComp_DoTilt(Real32* tilt, bool reduce);
static void AnimatedComp_CalcHumanAnim(AnimatedComp* anim, Real32 idleXRot, Real32 idleZRot);
static void AnimatedComp_PerpendicularAnim(AnimatedComp* anim, Real32 flapSpeed, Real32 idleXRot, Real32 idleZRot, bool left);
#endif
#endif

View File

@ -207,7 +207,6 @@
<ClInclude Include="BordersRenderer.h" />
<ClInclude Include="LiquidAnimations.h" />
<ClInclude Include="LocalPlayer.h" />
<ClInclude Include="LocationUpdate.h" />
<ClInclude Include="MapGenerator.h" />
<ClInclude Include="MapRenderer.h" />
<ClInclude Include="ModelCache.h" />
@ -279,7 +278,7 @@
<ClCompile Include="Key.c" />
<ClCompile Include="Lighting.c" />
<ClCompile Include="LiquidAnimations.c" />
<ClCompile Include="LocationUpdate.c" />
<ClCompile Include="Entity.c" />
<ClCompile Include="MapRenderer.c" />
<ClCompile Include="ModelCache.c" />
<ClCompile Include="Models.c" />

View File

@ -345,9 +345,6 @@
<ClInclude Include="ChunkUpdater.h">
<Filter>Header Files\Rendering\Map</Filter>
</ClInclude>
<ClInclude Include="LocationUpdate.h">
<Filter>Header Files\Entities</Filter>
</ClInclude>
<ClInclude Include="IModel.h">
<Filter>Header Files\Entities\Model</Filter>
</ClInclude>
@ -521,9 +518,6 @@
<ClCompile Include="ChunkUpdater.c">
<Filter>Source Files\Rendering\Map</Filter>
</ClCompile>
<ClCompile Include="LocationUpdate.c">
<Filter>Source Files\Entities</Filter>
</ClCompile>
<ClCompile Include="AABB.c">
<Filter>Source Files\Math</Filter>
</ClCompile>
@ -569,5 +563,8 @@
<ClCompile Include="Models.c">
<Filter>Source Files\Entities\Model</Filter>
</ClCompile>
<ClCompile Include="Entity.c">
<Filter>Source Files\Entities</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,6 +1,8 @@
#if 0
#include "LocationUpdate.h"
#include "Entity.h"
#include "ExtMath.h"
#include "World.h"
#include "Block.h"
Real32 LocationUpdate_Clamp(Real32 degrees) {
degrees = Math_Mod(degrees, 360.0f);
@ -19,7 +21,6 @@ void LocationUpdate_Construct(LocationUpdate* update, Real32 x, Real32 y, Real32
update->RelativePosition = relPos;
}
#define exc LocationUpdate_Excluded
void LocationUpdate_Empty(LocationUpdate* update) {
LocationUpdate_Construct(update, 0.0f, 0.0f, 0.0f, exc, exc, exc, exc, false, false);
@ -33,8 +34,35 @@ void LocationUpdate_MakePos(LocationUpdate* update, Vector3 pos, bool rel) {
LocationUpdate_Construct(update, pos.X, pos.Y, pos.Z, exc, exc, exc, exc, true, rel);
}
void LocationUpdate_MakePosAndOri(LocationUpdate* update, Vector3 pos,
Real32 rotY, Real32 headX, bool rel) {
void LocationUpdate_MakePosAndOri(LocationUpdate* update, Vector3 pos, Real32 rotY, Real32 headX, bool rel) {
LocationUpdate_Construct(update, pos.X, pos.Y, pos.Z, exc, rotY, exc, headX, true, rel);
}
bool Entity_TouchesAny(AABB* bounds, TouchesAny_Condition condition) {
Vector3I bbMin, bbMax;
Vector3I_Floor(&bbMin, &bounds->Min);
Vector3I_Floor(&bbMax, &bounds->Max);
AABB blockBB;
Vector3 v;
/* Order loops so that we minimise cache misses */
for (Int32 y = bbMin.Y; y <= bbMax.Y; y++) {
v.Y = (Real32)y;
for (Int32 z = bbMin.Z; z <= bbMax.Z; z++) {
v.Z = (Real32)z;
for (Int32 x = bbMin.X; x <= bbMax.X; x++) {
if (!World_IsValidPos(x, y, z)) continue;
v.X = (Real32)x;
BlockID block = World_GetBlock(x, y, z);
Vector3_Add(&blockBB.Min, &v, &Block_MinBB[block]);
Vector3_Add(&blockBB.Max, &v, &Block_MaxBB[block]);
if (!AABB_Intersects(&blockBB, bounds)) continue;
if (condition(block)) return true;
}
}
}
return false;
}
#endif

View File

@ -13,8 +13,39 @@
/* Constant offset used to avoid floating point roundoff errors. */
#define Entity_Adjustment 0.001f
/* Constant value specifying an angle is not included in an orientation update. */
#define LocationUpdate_Excluded -100000.31415926535f
typedef bool(*TouchesAny_Condition)(BlockID block);
typedef bool (*TouchesAny_Condition)(BlockID block);
/* Represents a location update for an entity.
This can be a relative position, full position, and/or an orientation update. */
typedef struct LocationUpdate_ {
/* Position of the update (if included). */
Vector3 Pos;
/* Orientation of the update (if included). If not, has the value of LocationUpdate_Excluded. */
Real32 RotX, RotY, RotZ, HeadX;
/* Whether this update includes an absolute or relative position. */
bool IncludesPosition;
/* Whether the positon is absolute, or relative to the last positionreceived from the server. */
bool RelativePosition;
} LocationUpdate;
/* Clamps the given angle so it lies between [0, 360). */
Real32 LocationUpdate_Clamp(Real32 degrees);
/* Constructs a location update with values for every field.
You should generally prefer using the alternative constructors. */
void LocationUpdate_Construct(LocationUpdate* update, Real32 x, Real32 y, Real32 z,
Real32 rotX, Real32 rotY, Real32 rotZ, Real32 headX, bool incPos, bool relPos);
/* Constructs a location update that does not have any position or orientation information. */
void LocationUpdate_Empty(LocationUpdate* update);
/* Constructs a location update that only consists of orientation information. */
void LocationUpdate_MakeOri(LocationUpdate* update, Real32 rotY, Real32 headX);
/* Constructs a location update that only consists of position information. */
void LocationUpdate_MakePos(LocationUpdate* update, Vector3 pos, bool rel);
/* Constructs a location update that consists of position and orientation information. */
void LocationUpdate_MakePosAndOri(LocationUpdate* update, Vector3 pos, Real32 rotY, Real32 headX, bool rel);
/* Contains a model, along with position, velocity, and rotation. May also contain other fields and properties. */

View File

@ -1,48 +0,0 @@
#if 0
#ifndef CS_LOCATIONUPDATE_H
#define CS_LOCATIONUPDATE_H
#include "Typedefs.h"
#include "Vectors.h"
/* Represents a location (position and/or orientation) update for an entity.
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
*/
/* Stores data that describes either a relative position,
full position, or an orientation update for an entity. */
typedef struct LocationUpdate_ {
/* Position of the update (if included). */
Vector3 Pos;
/* Orientation of the update (if included). If not, has the value of LocationUpdate_Excluded. */
Real32 RotX, RotY, RotZ, HeadX;
/* Whether this update includes an absolute or relative position. */
bool IncludesPosition;
/* Whether the positon is absolute, or relative to the last positionreceived from the server. */
bool RelativePosition;
} LocationUpdate;
/* Constant value specifying an angle is not included in an orientation update. */
#define LocationUpdate_Excluded -100000.31415926535f
/* Clamps the given angle so it lies between [0, 360). */
Real32 LocationUpdate_Clamp(Real32 degrees);
/* Constructs a location update with values for every field.
You should generally prefer using the alternative constructors. */
void LocationUpdate_Construct(LocationUpdate* update, Real32 x, Real32 y, Real32 z,
Real32 rotX, Real32 rotY, Real32 rotZ, Real32 headX, bool incPos, bool relPos);
/* Constructs a location update that does not have any position or orientation information. */
void LocationUpdate_Empty(LocationUpdate* update);
/* Constructs a location update that only consists of orientation information. */
void LocationUpdate_MakeOri(LocationUpdate* update, Real32 rotY, Real32 headX);
/* Constructs a location update that only consists of position information. */
void LocationUpdate_MakePos(LocationUpdate* update, Vector3 pos, bool rel);
/* Constructs a location update that consists of position and orientation information. */
void LocationUpdate_MakePosAndOri(LocationUpdate* update, Vector3 pos,
Real32 rotY, Real32 headX, bool rel);
#endif