From d71a925d289e7207a1333b0347b0a0c3b7b738df Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 25 Mar 2018 17:00:57 +1100 Subject: [PATCH] Few less compile errors --- .../Rendering/Env/WeatherRenderer.cs | 2 +- src/Client/AxisLinesRenderer.c | 2 +- src/Client/Block.c | 14 ++++++------- src/Client/BlockID.h | 2 +- src/Client/Camera.c | 20 +++++++++---------- src/Client/Chat.c | 4 ++-- src/Client/ChunkUpdater.c | 4 ++-- src/Client/Entity.c | 2 +- src/Client/Entity.h | 4 ++-- src/Client/EntityComponents.c | 6 +++--- src/Client/Gui.c | 3 ++- src/Client/HeldBlockRenderer.c | 6 +++--- src/Client/InputHandler.c | 8 ++++---- src/Client/InputHandler.h | 1 + src/Client/Player.c | 14 +++++++------ src/Client/Player.h | 17 +++++++--------- src/Client/Screens.c | 2 +- src/Client/ServerConnection.c | 3 +-- 18 files changed, 57 insertions(+), 57 deletions(-) diff --git a/ClassicalSharp/Rendering/Env/WeatherRenderer.cs b/ClassicalSharp/Rendering/Env/WeatherRenderer.cs index 04caa8b8c..7038d2ee8 100644 --- a/ClassicalSharp/Rendering/Env/WeatherRenderer.cs +++ b/ClassicalSharp/Rendering/Env/WeatherRenderer.cs @@ -173,7 +173,7 @@ namespace ClassicalSharp.Renderers { internal void OnBlockChanged(int x, int y, int z, BlockID oldBlock, BlockID newBlock) { bool didBlock = !(BlockInfo.Draw[oldBlock] == DrawType.Gas || BlockInfo.Draw[oldBlock] == DrawType.Sprite); - bool nowBlock = !(BlockInfo.Draw[newBlock] == DrawType.Gas || BlockInfo.Draw[newBlock] == DrawType.Sprite); + bool nowBlock = !(BlockInfo.Draw[newBlock] == DrawType.Gas || BlockInfo.Draw[newBlock] == DrawType.Sprite); if (didBlock == nowBlock) return; int index = (x * length) + z; diff --git a/src/Client/AxisLinesRenderer.c b/src/Client/AxisLinesRenderer.c index 40ab5a932..f8aeeba46 100644 --- a/src/Client/AxisLinesRenderer.c +++ b/src/Client/AxisLinesRenderer.c @@ -42,7 +42,7 @@ void AxisLinesRenderer_Render(Real64 delta) { } Gfx_SetTexturing(false); - Vector3 P = LocalPlayer_Instance.Base.Base.Position; P.Y += 0.05f; + Vector3 P = LocalPlayer_Instance.Base.Position; P.Y += 0.05f; VertexP3fC4b vertices[axisLines_numVertices]; VertexP3fC4b* ptr = vertices; diff --git a/src/Client/Block.c b/src/Client/Block.c index 8150b0635..e56ce7c4b 100644 --- a/src/Client/Block.c +++ b/src/Client/Block.c @@ -328,7 +328,7 @@ void Block_RecalculateBB(BlockID block) { void Block_CalcStretch(BlockID block) { /* faces which can be stretched on X axis */ if (Block_MinBB[block].X == 0.0f && Block_MaxBB[block].X == 1.0f) { - Block_CanStretch[block] |= 0x3C; + Block_CanStretch[block] |= 0x3C; } else { Block_CanStretch[block] &= 0xC3; /* ~0x3C */ } @@ -362,11 +362,11 @@ bool Block_IsHidden(BlockID block, BlockID other) { bool canSkip = (bType == COLLIDE_SOLID && oType == COLLIDE_SOLID) || bType != COLLIDE_SOLID; return canSkip; } - + void Block_CalcCulling(BlockID block, BlockID other) { if (!Block_IsHidden(block, other)) { /* Block is not hidden at all, so we can just entirely skip per-face check */ - Block_Hidden[(block * BLOCK_COUNT) | other] = 0; + Block_Hidden[(block * BLOCK_COUNT) + other] = 0; } else { Vector3 bMin = Block_MinBB[block], bMax = Block_MaxBB[block]; Vector3 oMin = Block_MinBB[other], oMax = Block_MaxBB[other]; @@ -388,12 +388,12 @@ void Block_CalcCulling(BlockID block, BlockID other) { f |= occludedZ && oMin.Z == 0.0f && bMax.Z == 1.0f ? (1 << FACE_ZMAX) : 0; f |= occludedY && (bothLiquid || (oMax.Y == 1.0f && bMin.Y == 0.0f)) ? (1 << FACE_YMIN) : 0; f |= occludedY && (bothLiquid || (oMin.Y == 0.0f && bMax.Y == 1.0f)) ? (1 << FACE_YMAX) : 0; - Block_Hidden[(block * BLOCK_COUNT) | other] = (UInt8)f; + Block_Hidden[(block * BLOCK_COUNT) + other] = (UInt8)f; } } bool Block_IsFaceHidden(BlockID block, BlockID other, Face face) { - return (Block_Hidden[(block * BLOCK_COUNT) | other] & (1 << face)) != 0; + return (Block_Hidden[(block * BLOCK_COUNT) + other] & (1 << face)) != 0; } void Block_UpdateCullingAll(void) { @@ -454,7 +454,7 @@ BlockID AutoRotate_RotateVertical(BlockID block, String* name, Vector3 offset) { BlockID AutoRotate_RotateOther(BlockID block, String* name, Vector3 offset) { /* Fence type blocks */ if (AutoRotate_Find(BLOCK_INVALID, name, "-UD") == BLOCK_INVALID) { - Real32 headY = LocalPlayer_Instance.Base.Base.HeadY; + Real32 headY = LocalPlayer_Instance.Base.HeadY; headY = LocationUpdate_Clamp(headY); if (headY < 45.0f || (headY >= 135.0f && headY < 225.0f) || headY > 315.0f) { @@ -476,7 +476,7 @@ BlockID AutoRotate_RotateOther(BlockID block, String* name, Vector3 offset) { } BlockID AutoRotate_RotateDirection(BlockID block, String* name, Vector3 offset) { - Real32 headY = LocalPlayer_Instance.Base.Base.HeadY; + Real32 headY = LocalPlayer_Instance.Base.HeadY; headY = LocationUpdate_Clamp(headY); if (headY >= 45.0f && headY < 135.0f) { diff --git a/src/Client/BlockID.h b/src/Client/BlockID.h index eada79efd..1da45bec7 100644 --- a/src/Client/BlockID.h +++ b/src/Client/BlockID.h @@ -84,7 +84,7 @@ #define BLOCK_CPE_COUNT (BLOCK_MAX_CPE + 1) #if USE16_BIT -#define BLOCK_MAX_DEFINED 0x3FF +#define BLOCK_MAX_DEFINED 0x3FF #else #define BLOCK_MAX_DEFINED 0xFF #endif diff --git a/src/Client/Camera.c b/src/Client/Camera.c index 455d26d64..83d20ad49 100644 --- a/src/Client/Camera.c +++ b/src/Client/Camera.c @@ -16,7 +16,7 @@ Real32 Camera_AdjustHeadX(Real32 value) { } Vector3 PerspectiveCamera_GetDirVector(void) { - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; Real32 yaw = p->HeadY * MATH_DEG2RAD; Real32 pitch = Camera_AdjustHeadX(p->HeadX); return Vector3_GetDirVector(yaw, pitch); @@ -29,7 +29,7 @@ void PerspectiveCamera_GetProjection(Matrix* proj) { } void PerspectiveCamera_GetPickedBlock(PickedPos* pos) { - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; Vector3 dir = PerspectiveCamera_GetDirVector(); Vector3 eyePos = Entity_GetEyePosition(p); Real32 reach = LocalPlayer_Instance.ReachDistance; @@ -94,7 +94,7 @@ void PerspectiveCamera_UpdateMouseRotation(void) { update.HeadX = player->Interp.Next.HeadX < 180.0f ? 89.9f : 270.1f; } - Entity* e = &player->Base.Base; + Entity* e = &player->Base; e->VTABLE->SetLocation(e, &update, false); } @@ -108,7 +108,7 @@ void PerspectiveCamera_UpdateMouse(void) { void PerspectiveCamera_CalcViewBobbing(Real32 t, Real32 velTiltScale) { if (!Game_ViewBobbing) { Camera_TiltM = Matrix_Identity; return; } LocalPlayer* p = &LocalPlayer_Instance; - Entity* e = &p->Base.Base; + Entity* e = &p->Base; Matrix Camera_tiltY, Camera_velX; Matrix_RotateZ(&Camera_TiltM, -p->Tilt.TiltX * e->Anim.BobStrength); @@ -143,7 +143,7 @@ void FirstPersonCamera_GetView(Matrix* mat) { Vector3 FirstPersonCamera_GetCameraPos(Real32 t) { PerspectiveCamera_CalcViewBobbing(t, 1); - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; Vector3 camPos = Entity_GetEyePosition(p); camPos.Y += Camera_BobbingVer; @@ -154,7 +154,7 @@ Vector3 FirstPersonCamera_GetCameraPos(Real32 t) { } Vector2 FirstPersonCamera_GetCameraOrientation(void) { - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; return Vector2_Create2(p->HeadY * MATH_DEG2RAD, p->HeadX * MATH_DEG2RAD); } @@ -173,7 +173,7 @@ void FirstPersonCamera_Init(Camera* cam) { Real32 dist_third = 3.0f, dist_forward = 3.0f; void ThirdPersonCamera_GetView(Matrix* mat) { Vector3 cameraPos = Game_CurrentCameraPos; - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; Vector3 targetPos = Entity_GetEyePosition(p); targetPos.Y += Camera_BobbingVer; @@ -184,7 +184,7 @@ void ThirdPersonCamera_GetView(Matrix* mat) { Vector3 ThirdPersonCamera_GetCameraPosShared(Real32 t, Real32 dist, bool forward) { PerspectiveCamera_CalcViewBobbing(t, dist); - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; Vector3 eyePos = Entity_GetEyePosition(p); eyePos.Y += Camera_BobbingVer; @@ -205,12 +205,12 @@ Vector3 ForwardThirdPersonCamera_GetCameraPos(Real32 t) { Vector2 ThirdPersonCamera_GetCameraOrientation(void) { - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; return Vector2_Create2(p->HeadY * MATH_DEG2RAD, p->HeadX * MATH_DEG2RAD); } Vector2 ForwardThirdPersonCamera_GetCameraOrientation(void) { - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; return Vector2_Create2(p->HeadY * MATH_DEG2RAD + MATH_PI, -p->HeadX * MATH_DEG2RAD); } diff --git a/src/Client/Chat.c b/src/Client/Chat.c index 58e2386be..c7c826f6a 100644 --- a/src/Client/Chat.c +++ b/src/Client/Chat.c @@ -353,7 +353,7 @@ void ModelCommand_Execute(STRING_PURE String* args, UInt32 argsCount) { String model = String_InitAndClearArray(modelBuffer); String_AppendString(&model, &args[1]); String_MakeLowercase(&model); - Entity_SetModel(&LocalPlayer_Instance.Base.Base, &model); + Entity_SetModel(&LocalPlayer_Instance.Base, &model); } } @@ -485,7 +485,7 @@ void TeleportCommand_Execute(STRING_PURE String* args, UInt32 argsCount) { Vector3 v = { x, y, z }; LocationUpdate update; LocationUpdate_MakePos(&update, v, false); - Entity* entity = &LocalPlayer_Instance.Base.Base; + Entity* entity = &LocalPlayer_Instance.Base; entity->VTABLE->SetLocation(entity, &update, false); } } diff --git a/src/Client/ChunkUpdater.c b/src/Client/ChunkUpdater.c index b184416a9..19a431425 100644 --- a/src/Client/ChunkUpdater.c +++ b/src/Client/ChunkUpdater.c @@ -238,8 +238,8 @@ void ChunkUpdater_UpdateChunks(Real64 delta) { LocalPlayer* p = &LocalPlayer_Instance; Vector3 camPos = Game_CurrentCameraPos; - Real32 headX = p->Base.Base.HeadX; - Real32 headY = p->Base.Base.HeadY; + Real32 headX = p->Base.HeadX; + Real32 headY = p->Base.HeadY; bool samePos = Vector3_Equals(&camPos, &cu_lastCamPos) && headX == cu_lastHeadX && headY == cu_lastHeadY; MapRenderer_RenderChunksCount = samePos ? diff --git a/src/Client/Entity.c b/src/Client/Entity.c index bb7bf37f2..cfa085360 100644 --- a/src/Client/Entity.c +++ b/src/Client/Entity.c @@ -239,7 +239,7 @@ void Entities_RenderModels(Real64 delta, Real32 t) { void Entities_RenderNames(Real64 delta) { if (Entities_NameMode == NAME_MODE_NONE) return; LocalPlayer* p = &LocalPlayer_Instance; - closestId = Entities_GetCloset(&p->Base.Base); + closestId = Entities_GetCloset(&p->Base); if (!p->Hacks.CanSeeAllNames || Entities_NameMode != NAME_MODE_ALL) return; Gfx_SetTexturing(true); diff --git a/src/Client/Entity.h b/src/Client/Entity.h index ac045b10d..2d49b2ba6 100644 --- a/src/Client/Entity.h +++ b/src/Client/Entity.h @@ -21,7 +21,7 @@ typedef struct IModel_ IModel; /* Forward declaration */ #define ENTITIES_MAX_COUNT 256 #define ENTITIES_SELF_ID 255 -UInt32 Entities_NameMode; +Int32 Entities_NameMode; #define NAME_MODE_NONE 0 #define NAME_MODE_HOVERED 1 #define NAME_MODE_ALL 2 @@ -29,7 +29,7 @@ UInt32 Entities_NameMode; #define NAME_MODE_ALL_UNSCALED 4 extern const UInt8* NameMode_Names[5]; -UInt32 Entities_ShadowMode; +Int32 Entities_ShadowMode; #define SHADOW_MODE_NONE 0 #define SHADOW_MODE_SNAP_TO_BLOCK 1 #define SHADOW_MODE_CIRCLE 2 diff --git a/src/Client/EntityComponents.c b/src/Client/EntityComponents.c index fed8c9f88..61942e141 100644 --- a/src/Client/EntityComponents.c +++ b/src/Client/EntityComponents.c @@ -130,7 +130,7 @@ void TiltComp_GetCurrent(TiltComp* anim, Real32 t) { LocalPlayer* p = &LocalPlayer_Instance; anim->VelTiltStrength = Math_Lerp(anim->VelTiltStrengthO, anim->VelTiltStrengthN, t); - AnimatedComp* pAnim = &p->Base.Base.Anim; + AnimatedComp* pAnim = &p->Base.Anim; anim->TiltX = Math_Cos(pAnim->WalkTime) * pAnim->Swing * (0.15f * MATH_DEG2RAD); anim->TiltY = Math_Sin(pAnim->WalkTime) * pAnim->Swing * (0.15f * MATH_DEG2RAD); } @@ -396,7 +396,7 @@ Real32 LocalInterpComp_Next(Real32 next, Real32 cur, Real32* last, bool interpol } void LocalInterpComp_SetLocation(InterpComp* interp, LocationUpdate* update, bool interpolate) { - Entity* entity = &LocalPlayer_Instance.Base.Base; + Entity* entity = &LocalPlayer_Instance.Base; InterpState* prev = &interp->Prev; InterpState* next = &interp->Next; @@ -436,7 +436,7 @@ void LocalInterpComp_SetLocation(InterpComp* interp, LocationUpdate* update, boo } void LocalInterpComp_AdvanceState(InterpComp* interp) { - Entity* entity = &LocalPlayer_Instance.Base.Base; + Entity* entity = &LocalPlayer_Instance.Base; interp->Prev = interp->Next; entity->Position = interp->Next.Pos; InterpComp_AdvanceRotY(interp); diff --git a/src/Client/Gui.c b/src/Client/Gui.c index e5d4cb270..59887532b 100644 --- a/src/Client/Gui.c +++ b/src/Client/Gui.c @@ -8,6 +8,7 @@ #include "ExtMath.h" #include "Screens.h" #include "Camera.h" +#include "InputHandler.h" Screen* Gui_Status; void GuiElement_Recreate(GuiElement* elem) { @@ -142,7 +143,7 @@ Screen* Gui_GetUnderlyingScreen(void) { } void Gui_SetScreen(Screen* screen, bool freeOld) { - game.Input.ScreenChanged(Gui_Active, screen); + InputHandler_ScreenChanged(Gui_Active, screen); if (Gui_Active != NULL && freeOld) { Gui_Active->Base.Free(&Gui_Active->Base); } diff --git a/src/Client/HeldBlockRenderer.c b/src/Client/HeldBlockRenderer.c index b6a5c1146..89fd4356d 100644 --- a/src/Client/HeldBlockRenderer.c +++ b/src/Client/HeldBlockRenderer.c @@ -44,7 +44,7 @@ void HeldBlockRenderer_RenderModel(void) { } void HeldBlockRenderer_SetMatrix(void) { - Entity* player = &LocalPlayer_Instance.Base.Base; + Entity* player = &LocalPlayer_Instance.Base; Vector3 eyePos = Entity_GetEyePosition(player); Vector3 up = Vector3_UnitY; Vector3 target = eyePos; target.Z -= 1.0f; /* Look straight down*/ @@ -57,7 +57,7 @@ void HeldBlockRenderer_SetMatrix(void) { void HeldBlockRenderer_ResetHeldState(void) { /* Based off details from http://pastebin.com/KFV0HkmD (Thanks goodlyay!) */ - Entity* player = &LocalPlayer_Instance.Base.Base; + Entity* player = &LocalPlayer_Instance.Base; held_entity.Position = Entity_GetEyePosition(player); held_entity.Position.X -= Camera_BobbingHor; @@ -124,7 +124,7 @@ void HeldBlockRenderer_ResetAnim(bool setLastHeld, Real64 period) { } PackedCol HeldBlockRenderer_GetCol(Entity* entity) { - Entity* player = &LocalPlayer_Instance.Base.Base; + Entity* player = &LocalPlayer_Instance.Base; PackedCol col = player->VTABLE->GetCol(player); /* Adjust pitch so angle when looking straight down is 0. */ diff --git a/src/Client/InputHandler.c b/src/Client/InputHandler.c index 2a688169c..cdc857c9c 100644 --- a/src/Client/InputHandler.c +++ b/src/Client/InputHandler.c @@ -37,7 +37,7 @@ bool InputHandler_IsMousePressed(MouseButton button) { void InputHandler_ButtonStateUpdate(MouseButton button, bool pressed) { /* defer getting the targeted entity as it's a costly operation */ if (input_pickingId == -1) { - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; input_pickingId = Entities_GetCloset(p); } @@ -127,7 +127,7 @@ bool InputHandler_SetFOV(Int32 fov, bool setZoom) { bool InputHandler_DoFovZoom(Real32 deltaPrecise) { if (!KeyBind_IsPressed(KeyBind_ZoomScrolling)) return false; - HacksComp* h = &LocalPlayer_Instance.Hacks; + HacksComp* h = &LocalPlayer_Instance; if (!h->Enabled || !h->CanAnyHacks || !h->CanUseThirdPersonCamera) return false; if (input_fovIndex == -1.0f) input_fovIndex = Game_ZoomFov; @@ -186,7 +186,7 @@ bool InputHandler_HandleCoreKey(Key key) { bool InputHandler_TouchesSolid(BlockID b) { return Block_Collide[b] == COLLIDE_SOLID; } bool InputHandler_PushbackPlace(AABB* blockBB) { - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; HacksComp* hacks = &LocalPlayer_Instance.Hacks; Vector3 curPos = p->Position, adjPos = p->Position; @@ -244,7 +244,7 @@ bool InputHandler_IntersectsOthers(Vector3 pos, BlockID block) { bool InputHandler_CheckIsFree(BlockID block) { Vector3 pos; Vector3I_ToVector3(&pos, &Game_SelectedPos.TranslatedPos); - Entity* p = &LocalPlayer_Instance.Base.Base; + Entity* p = &LocalPlayer_Instance.Base; HacksComp* hacks = &LocalPlayer_Instance.Hacks; if (Block_Collide[block] != COLLIDE_SOLID) return true; diff --git a/src/Client/InputHandler.h b/src/Client/InputHandler.h index 57b4003a8..d4dc8eab7 100644 --- a/src/Client/InputHandler.h +++ b/src/Client/InputHandler.h @@ -5,6 +5,7 @@ Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3 */ +void InputHandler_ScreenChanged(Screen* oldScreen, Screen* newScreen); bool InputHandler_SetFOV(Int32 fov, bool setZoom); void InputHandler_PickBlocks(bool cooldown, bool left, bool middle, bool right); void InputHandler_Init(void); diff --git a/src/Client/Player.c b/src/Client/Player.c index 190a418dc..03a63a58d 100644 --- a/src/Client/Player.c +++ b/src/Client/Player.c @@ -6,6 +6,7 @@ #include "GraphicsCommon.h" #include "AsyncDownloader.h" #include "ExtMath.h" +#include "Funcs.h" #define PLAYER_NAME_EMPTY_TEX -30000 void Player_MakeNameTexture(Player* player) { @@ -68,9 +69,10 @@ void Player_DrawName(Player* player) { Vector3 pos; model->RecalcProperties(entity); Vector3_TransformY(&pos, model->NameYOffset, &entity->Transform); - Real32 scale = Math.Min(1.0f, model->NameScale * entity->ModelScale.Y) / 70.0f; - PackedCol col = PACKEDCOL_WHITE; - Vector2 size = Vector2_Create2(player->NameTex.Width * scale, player->NameTex.Height * scale); + + Real32 scale = model->NameScale * entity->ModelScale.Y; + scale = scale > 1.0f ? (1.0f / 70.0f) : (scale / 70.0f); + Vector2 size = { player->NameTex.Width * scale, player->NameTex.Height * scale }; if (Entities_NameMode == NAME_MODE_ALL_UNSCALED && LocalPlayer_Instance.Hacks.CanSeeAllNames) { /* Get W component of transformed position */ @@ -80,9 +82,9 @@ void Player_DrawName(Player* player) { size.X *= tempW * 0.2f; size.Y *= tempW * 0.2f; } - VertexP3fT2fC4b vertices[4]; - VertexP3fT2fC4b* ptr = vertices; - TextureRec rec; rec.U1 = 0.0f; rec.V1 = 0.0f; rec.U2 = player->NameTex.U2; rec.V2 = player->NameTex.V2; + VertexP3fT2fC4b vertices[4]; VertexP3fT2fC4b* ptr = vertices; + TextureRec rec = { 0.0f, 0.0f, player->NameTex.U2, player->NameTex.V2 }; + PackedCol col = PACKEDCOL_WHITE; Particle_DoRender(&size, &pos, &rec, col, &ptr); Gfx_SetBatchFormat(VERTEX_FORMAT_P3FT2FC4B); diff --git a/src/Client/Player.h b/src/Client/Player.h index 28b0ecc31..1b38ba0a9 100644 --- a/src/Client/Player.h +++ b/src/Client/Player.h @@ -7,31 +7,28 @@ Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3 */ +#define Player_Layout Entity Base; UInt8 DisplayNameRaw[String_BufferSize(STRING_SIZE)]; \ +UInt8 SkinNameRaw[String_BufferSize(STRING_SIZE)]; bool FetchedSkin; Texture NameTex; + /* Represents a player entity. */ -typedef struct Player_ { - Entity Base; - UInt8 DisplayNameRaw[String_BufferSize(STRING_SIZE)]; - UInt8 SkinNameRaw[String_BufferSize(STRING_SIZE)]; - Texture NameTex; - bool FetchedSkin; -} Player; +typedef struct Player_ { Player_Layout } Player; void Player_UpdateName(Player* player); void Player_ResetSkin(Player* player); /* Represents another entity in multiplayer */ typedef struct NetPlayer_ { - Player Base; + Player_Layout NetInterpComp Interp; bool ShouldRender; } NetPlayer; /* Represents the user/player's own entity. */ typedef struct LocalPlayer_ { - Player Base; + Player_Layout Vector3 Spawn; Real32 SpawnRotY, SpawnHeadX; - HacksComp Hacks; Real32 ReachDistance; + HacksComp Hacks; TiltComp Tilt; InterpComp Interp; } LocalPlayer; diff --git a/src/Client/Screens.c b/src/Client/Screens.c index af5f03e4c..ed07507b8 100644 --- a/src/Client/Screens.c +++ b/src/Client/Screens.c @@ -413,7 +413,7 @@ void StatusScreen_DrawPosition(StatusScreen* screen) { PackedCol col = PACKEDCOL_WHITE; GfxCommon_Make2DQuad(&tex, col, &ptr); - Vector3I pos; Vector3I_Floor(&pos, &LocalPlayer_Instance.Base.Base.Position); + Vector3I pos; Vector3I_Floor(&pos, &LocalPlayer_Instance.Base.Position); atlas->CurX = atlas->Offset + 2; TextAtlas_Add(atlas, 13, &ptr); diff --git a/src/Client/ServerConnection.c b/src/Client/ServerConnection.c index 139eefd47..f8e908a50 100644 --- a/src/Client/ServerConnection.c +++ b/src/Client/ServerConnection.c @@ -94,8 +94,7 @@ void SPConnection_Connect(STRING_PURE String* ip, Int32 port) { Block_CanDelete[i] = true; } - Player* player = &LocalPlayer_Instance.Base; - String skin = String_FromRawArray(player->SkinNameRaw); + String skin = String_FromRawArray(LocalPlayer_Instance.SkinNameRaw); AsyncDownloader_DownloadSkin(&skin, &skin); Event_RaiseVoid(&BlockEvents_PermissionsChanged);