minor code cleanup

This commit is contained in:
UnknownShadow200 2018-07-08 21:53:13 +10:00
parent 6cdcbe9480
commit 7ca1e00fcd
4 changed files with 94 additions and 92 deletions

View File

@ -182,14 +182,15 @@ namespace ClassicalSharp.Gui.Screens {
static FastColour backColour = new FastColour(0, 0, 0, 127);
public void RenderBackground() {
int usedHeight = normalChat.GetUsedHeight();
int y = normalChat.Y + normalChat.Height - usedHeight - 5;
int x = normalChat.X - 5;
int width = Math.Max(clientStatus.Width, normalChat.Width) + 10;
int chatHeight = normalChat.GetUsedHeight();
int x = normalChat.X;
int y = normalChat.Y + normalChat.Height - chatHeight;
int boxHeight = usedHeight + clientStatus.GetUsedHeight();
if (boxHeight > 0) {
game.Graphics.Draw2DQuad(x, y, width, boxHeight + 10, backColour);
int width = Math.Max(clientStatus.Width, normalChat.Width) + 10;
int height = chatHeight + clientStatus.GetUsedHeight();
if (height > 0) {
game.Graphics.Draw2DQuad(x - 5, y - 5, width + 10, height + 10, backColour);
}
}

View File

@ -72,7 +72,7 @@ namespace ClassicalSharp.Physics {
t0 = tmin;
t1 = tmax;
return t0 >= 0;
return tmin >= 0;
}
}
}

View File

@ -120,7 +120,7 @@ bool Intersection_RayIntersectsBox(Vector3 origin, Vector3 dir, Vector3 min, Vec
if (tzmax < tmax) tmax = tzmax;
*t0 = tmin; *t1 = tmax;
return *t0 >= 0;
return tmin >= 0.0f;
}

View File

@ -846,14 +846,15 @@ static void ChatScreen_CheckOtherStatuses(ChatScreen* screen) {
static void ChatScreen_RenderBackground(ChatScreen* screen) {
Int32 usedHeight = TextGroupWidget_UsedHeight(&screen->Chat);
Int32 y = screen->Chat.Y + screen->Chat.Height - usedHeight - 5;
Int32 x = screen->Chat.X - 5;
Int32 width = max(screen->ClientStatus.Width, screen->Chat.Width) + 10;
Int32 x = screen->Chat.X;
Int32 y = screen->Chat.Y + screen->Chat.Height - usedHeight;
Int32 boxHeight = usedHeight + TextGroupWidget_UsedHeight(&screen->ClientStatus);
if (boxHeight > 0) {
Int32 width = max(screen->ClientStatus.Width, screen->Chat.Width);
Int32 height = usedHeight + TextGroupWidget_UsedHeight(&screen->ClientStatus);
if (height > 0) {
PackedCol backCol = PACKEDCOL_CONST(0, 0, 0, 127);
GfxCommon_Draw2DFlat(x, y, width, boxHeight + 10, backCol);
GfxCommon_Draw2DFlat(x - 5, y - 5, width + 10, height + 10, backCol);
}
}