Remove some unused includes and make LScreens.c not depend on game.h

This commit is contained in:
UnknownShadow200 2020-05-30 18:25:17 +10:00
parent 660d52fa25
commit 6665d736e9
9 changed files with 18 additions and 23 deletions

View File

@ -58,13 +58,10 @@ float Game_RawHotbarScale, Game_RawChatScale, Game_RawInventoryScale;
static struct ScheduledTask Game_Tasks[6];
static int Game_TasksCount, entTaskI;
static char Game_UsernameBuffer[FILENAME_SIZE];
static char Game_MppassBuffer[STRING_SIZE];
static char Game_HashBuffer[STRING_SIZE];
String Game_Username = String_FromArray(Game_UsernameBuffer);
String Game_Mppass = String_FromArray(Game_MppassBuffer);
String Game_Hash = String_FromArray(Game_HashBuffer);
static char usernameBuffer[FILENAME_SIZE];
static char mppassBuffer[STRING_SIZE];
String Game_Username = String_FromArray(usernameBuffer);
String Game_Mppass = String_FromArray(mppassBuffer);
const char* const FpsLimit_Names[FPS_LIMIT_COUNT] = {
"LimitVSync", "Limit30FPS", "Limit60FPS", "Limit120FPS", "Limit144FPS", "LimitNone",

View File

@ -24,7 +24,6 @@ extern cc_bool Game_UseCPEBlocks;
extern String Game_Username;
extern String Game_Mppass;
extern String Game_Hash;
extern int Game_ViewDistance;
extern int Game_MaxViewDistance;

View File

@ -3,7 +3,6 @@
#include "LWeb.h"
#include "Launcher.h"
#include "Gui.h"
#include "Game.h"
#include "Drawer2D.h"
#include "ExtMath.h"
#include "Platform.h"
@ -878,9 +877,9 @@ static void MainScreen_TickFetchServers(struct MainScreen* s) {
if (FetchServersTask.Base.success) {
s->signingIn = false;
if (Game_Hash.length) {
Launcher_ConnectToServer(&Game_Hash);
Game_Hash.length = 0;
if (Launcher_AutoHash.length) {
Launcher_ConnectToServer(&Launcher_AutoHash);
Launcher_AutoHash.length = 0;
} else {
Launcher_SetScreen(ServersScreen_MakeInstance());
}

View File

@ -28,6 +28,8 @@ static cc_bool pendingRedraw;
static struct FontDesc logoFont;
cc_bool Launcher_ShouldExit, Launcher_ShouldUpdate;
static char hashBuffer[STRING_SIZE];
String Launcher_AutoHash = String_FromArray(hashBuffer);
static void Launcher_ApplyUpdate(void);
void Launcher_SetScreen(struct LScreen* screen) {

View File

@ -26,6 +26,8 @@ extern struct FontDesc Launcher_HintFont;
extern cc_bool Launcher_ShouldExit;
/* Whether game should be updated on exit. */
extern cc_bool Launcher_ShouldUpdate;
/* (optional) Hash of the server the game should automatically try to connect to after signing in. */
extern String Launcher_AutoHash;
/* Base colour of pixels before any widgets are drawn. */
extern BitmapCol Launcher_BackgroundCol;

View File

@ -3,7 +3,6 @@
#include "Funcs.h"
#include "Platform.h"
#include "Stream.h"
#include "Chat.h"
#include "Errors.h"
#include "Utils.h"
#include "Logger.h"

View File

@ -124,7 +124,7 @@ static int Program_Run(int argc, char** argv) {
/* :hash to auto join server with the given hash */
if (args[0].buffer[0] == ':') {
args[0] = String_UNSAFE_SubstringAt(&args[0], 1);
String_Copy(&Game_Hash, &args[0]);
String_Copy(&Launcher_AutoHash, &args[0]);
Launcher_Run();
return 0;
}

View File

@ -1,7 +1,5 @@
#include "Utils.h"
#include "Bitmap.h"
#include "PackedCol.h"
#include "Chat.h"
#include "Platform.h"
#include "Stream.h"
#include "Errors.h"
@ -183,7 +181,7 @@ int Convert_ToBase64(const cc_uint8* src, int len, char* dst) {
return (int)(dst - beg);
}
CC_NOINLINE static int Convert_DecodeBase64(char c) {
CC_NOINLINE static int DecodeBase64(char c) {
if (c >= 'A' && c <= 'Z') return (c - 'A');
if (c >= 'a' && c <= 'z') return (c - 'a') + 26;
if (c >= '0' && c <= '9') return (c - '0') + 52;
@ -202,16 +200,16 @@ int Convert_FromBase64(const char* src, int len, cc_uint8* dst) {
/* 4 chars to 3 bytes */
/* stops on any invalid chars (also handles = padding) */
for (; len >= 4; len -= 4, src += 4) {
a = Convert_DecodeBase64(src[0]);
b = Convert_DecodeBase64(src[1]);
a = DecodeBase64(src[0]);
b = DecodeBase64(src[1]);
if (a == -1 || b == -1) break;
*dst++ = (a << 2) | (b >> 4);
c = Convert_DecodeBase64(src[2]);
c = DecodeBase64(src[2]);
if (c == -1) break;
*dst++ = (b << 4) | (c >> 2);
d = Convert_DecodeBase64(src[3]);
d = DecodeBase64(src[3]);
if (d == -1) break;
*dst++ = (c << 6) | (d );
}

View File

@ -2,7 +2,6 @@
#include "Logger.h"
#include "Platform.h"
#include "Event.h"
#include "Block.h"
#include "ExtMath.h"
#include "Funcs.h"
#include "Errors.h"