forked from cafeberry/cafeberry
merge upstream
This commit is contained in:
commit
71b2f6b9cf
5 files changed
+71
-87
No files matched your search
@@ -67,7 +67,9 @@ void StatsCounter::award(Stat* stat, unsigned int difficulty, unsigned int count
|
|||||||
unordered_map<Stat*, int>::iterator leaderboardEntry = statBoards.find(stat);
|
unordered_map<Stat*, int>::iterator leaderboardEntry = statBoards.find(stat);
|
||||||
if( leaderboardEntry != statBoards.end() )
|
if( leaderboardEntry != statBoards.end() )
|
||||||
{
|
{
|
||||||
|
#ifdef _DEBUG
|
||||||
app.DebugPrintf("[StatsCounter] award(): %X\n", leaderboardEntry->second << difficulty);
|
app.DebugPrintf("[StatsCounter] award(): %X\n", leaderboardEntry->second << difficulty);
|
||||||
|
#endif
|
||||||
modifiedBoards |= (leaderboardEntry->second << difficulty);
|
modifiedBoards |= (leaderboardEntry->second << difficulty);
|
||||||
if( flushCounter == 0 )
|
if( flushCounter == 0 )
|
||||||
flushCounter = FLUSH_DELAY;
|
flushCounter = FLUSH_DELAY;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "Windows64_Minecraft.h"
|
||||||
#include "..\Common\Consoles_App.h"
|
#include "..\Common\Consoles_App.h"
|
||||||
#include "..\User.h"
|
#include "..\User.h"
|
||||||
#include "..\..\Minecraft.Client\Minecraft.h"
|
#include "..\..\Minecraft.Client\Minecraft.h"
|
||||||
@@ -26,6 +27,14 @@ void CConsoleMinecraftApp::StoreLaunchData()
|
|||||||
}
|
}
|
||||||
void CConsoleMinecraftApp::ExitGame()
|
void CConsoleMinecraftApp::ExitGame()
|
||||||
{
|
{
|
||||||
|
if (g_pd3dDevice != NULL)
|
||||||
|
{
|
||||||
|
g_pd3dDevice->Release();
|
||||||
|
g_pd3dDevice = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CleanupDevice();
|
||||||
|
|
||||||
ExitProcess(0);
|
ExitProcess(0);
|
||||||
}
|
}
|
||||||
void CConsoleMinecraftApp::FatalLoadError()
|
void CConsoleMinecraftApp::FatalLoadError()
|
||||||
@@ -57,74 +66,6 @@ void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConsoleMinecraftApp::TemporaryCreateGameStart()
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit
|
|
||||||
|
|
||||||
app.setLevelGenerationOptions(NULL);
|
|
||||||
|
|
||||||
// From CScene_Main::RunPlayGame
|
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
|
||||||
app.ReleaseSaveThumbnail();
|
|
||||||
ProfileManager.SetLockedProfile(0);
|
|
||||||
pMinecraft->user->name = L"Windows";
|
|
||||||
app.ApplyGameSettingsChanged(0);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameJoinLoad::OnInit
|
|
||||||
MinecraftServer::resetFlags();
|
|
||||||
|
|
||||||
// From CScene_MultiGameJoinLoad::OnNotifyPressEx
|
|
||||||
app.SetTutorialMode( false );
|
|
||||||
app.SetCorruptSaveDeleted(false);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame
|
|
||||||
|
|
||||||
app.ClearTerrainFeaturePosition();
|
|
||||||
wstring wWorldName = L"TestWorld";
|
|
||||||
|
|
||||||
StorageManager.ResetSaveData();
|
|
||||||
StorageManager.SetSaveTitle(wWorldName.c_str());
|
|
||||||
|
|
||||||
bool isFlat = false;
|
|
||||||
__int64 seedValue = 0; // BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
|
|
||||||
|
|
||||||
NetworkGameInitData *param = new NetworkGameInitData();
|
|
||||||
param->seed = seedValue;
|
|
||||||
param->saveData = NULL;
|
|
||||||
|
|
||||||
app.SetGameHostOption(eGameHostOption_Difficulty,0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_Gamertags,1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_BedrockFog,1);
|
|
||||||
|
|
||||||
app.SetGameHostOption(eGameHostOption_GameType,GameType::CREATIVE->getId() ); // LevelSettings::GAMETYPE_SURVIVAL
|
|
||||||
app.SetGameHostOption(eGameHostOption_LevelType, 0 );
|
|
||||||
app.SetGameHostOption(eGameHostOption_Structures, 1 );
|
|
||||||
app.SetGameHostOption(eGameHostOption_BonusChest, 0 );
|
|
||||||
|
|
||||||
app.SetGameHostOption(eGameHostOption_PvP, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_TrustPlayers, 1 );
|
|
||||||
app.SetGameHostOption(eGameHostOption_FireSpreads, 1 );
|
|
||||||
app.SetGameHostOption(eGameHostOption_TNT, 1 );
|
|
||||||
app.SetGameHostOption(eGameHostOption_HostCanFly, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, 1 );
|
|
||||||
|
|
||||||
param->settings = app.GetGameHostOption( eGameHostOption_All );
|
|
||||||
|
|
||||||
g_NetworkManager.FakeLocalPlayerJoined();
|
|
||||||
|
|
||||||
LoadingInputParams *loadingParams = new LoadingInputParams();
|
|
||||||
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
|
|
||||||
loadingParams->lpParam = (LPVOID)param;
|
|
||||||
|
|
||||||
// Reset the autosave time
|
|
||||||
app.SetAutosaveTimerTime();
|
|
||||||
|
|
||||||
C4JThread* thread = new C4JThread(loadingParams->func, loadingParams->lpParam, "RunNetworkGame");
|
|
||||||
thread->Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
int CConsoleMinecraftApp::GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT)
|
int CConsoleMinecraftApp::GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -27,10 +27,7 @@ public:
|
|||||||
// BANNED LEVEL LIST
|
// BANNED LEVEL LIST
|
||||||
virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {}
|
virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {}
|
||||||
|
|
||||||
C4JStringTable *GetStringTable() { return NULL;}
|
C4JStringTable *GetStringTable() { return NULL;}
|
||||||
|
|
||||||
// original code
|
|
||||||
virtual void TemporaryCreateGameStart();
|
|
||||||
|
|
||||||
// str1k3r - UTF8 to wchar
|
// str1k3r - UTF8 to wchar
|
||||||
std::wstring UTF8ToWide(const char* utf8);
|
std::wstring UTF8ToWide(const char* utf8);
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ DWORD dwProfileSettingsA[NUM_PROFILE_VALUES]=
|
|||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
BOOL g_bWidescreen = TRUE;
|
BOOL g_bWidescreen = TRUE;
|
||||||
|
|
||||||
int g_iScreenWidth = 1920;
|
int g_iScreenWidth = 1920;
|
||||||
int g_iScreenHeight = 1080;
|
int g_iScreenHeight = 1080;
|
||||||
|
|
||||||
@@ -313,8 +312,6 @@ ID3D11Texture2D* g_pDepthStencilBuffer = NULL;
|
|||||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
int wmId, wmEvent;
|
int wmId, wmEvent;
|
||||||
PAINTSTRUCT ps;
|
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
@@ -332,11 +329,35 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_PAINT:
|
case WM_ENTERSIZEMOVE:
|
||||||
hdc = BeginPaint(hWnd, &ps);
|
SetTimer(hWnd, 1, USER_TIMER_MINIMUM, NULL);
|
||||||
// TODO: Add any drawing code here...
|
break;
|
||||||
EndPaint(hWnd, &ps);
|
case WM_EXITSIZEMOVE:
|
||||||
break;
|
KillTimer(hWnd, 1);
|
||||||
|
break;
|
||||||
|
case WM_ERASEBKGND:
|
||||||
|
return 1;
|
||||||
|
case WM_TIMER:
|
||||||
|
if (wParam == 1)
|
||||||
|
{
|
||||||
|
// Tick UI
|
||||||
|
ui.tick();
|
||||||
|
ui.render();
|
||||||
|
RenderManager.Present();
|
||||||
|
ui.CheckMenuDisplayed();
|
||||||
|
|
||||||
|
// Tick Managers
|
||||||
|
app.UpdateTime();
|
||||||
|
InputManager.Tick();
|
||||||
|
StorageManager.Tick();
|
||||||
|
RenderManager.Tick();
|
||||||
|
|
||||||
|
// Tick Music
|
||||||
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
|
pMinecraft->soundEngine->tick(NULL, 0.0f);
|
||||||
|
pMinecraft->soundEngine->playMusicTick();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
@@ -467,9 +488,23 @@ HRESULT InitDevice()
|
|||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
//str1k3r - use screen size instead of window size
|
//str1k3r - use screen size instead of window size & detect if its widescreen or not
|
||||||
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
|
#ifndef _DEBUG
|
||||||
g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN);
|
HMONITOR hMonitor = MonitorFromWindow(g_hWnd, MONITOR_DEFAULTTONEAREST);
|
||||||
|
MONITORINFO monitorInfo = { sizeof(MONITORINFO) };
|
||||||
|
if (GetMonitorInfo(hMonitor, &monitorInfo))
|
||||||
|
{
|
||||||
|
g_iScreenWidth = monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left;
|
||||||
|
g_iScreenHeight = monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_bWidescreen = (g_iScreenHeight > 0 && ((double)g_iScreenWidth / g_iScreenHeight) >= 1.59) ? TRUE : FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
//str1k3r - stop hardcoding size and just use the screens actual size
|
//str1k3r - stop hardcoding size and just use the screens actual size
|
||||||
UINT width = g_iScreenWidth;
|
UINT width = g_iScreenWidth;
|
||||||
@@ -477,7 +512,7 @@ HRESULT InitDevice()
|
|||||||
|
|
||||||
UINT createDeviceFlags = 0;
|
UINT createDeviceFlags = 0;
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
app.DebugPrintf("Screen Width: %d, Screen Height: %d\n", width, height);
|
app.DebugPrintf("Screen Width: %d, Screen Height: %d, Widescreen: %s\n", width, height, g_bWidescreen ? "TRUE" : "FALSE");
|
||||||
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
|
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1178,9 +1213,10 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
Vec3::resetPool();
|
Vec3::resetPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free resources, unregister custom classes, and exit.
|
//str1k3r - Safely exit the game
|
||||||
// app.Uninit();
|
app.ExitGame();
|
||||||
g_pd3dDevice->Release();
|
|
||||||
|
return (int)msg.wParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MEMORY_TRACKING
|
#ifdef MEMORY_TRACKING
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <d3d11.h>
|
||||||
|
|
||||||
|
extern BOOL g_bWidescreen;
|
||||||
|
|
||||||
extern int g_iScreenWidth;
|
extern int g_iScreenWidth;
|
||||||
extern int g_iScreenHeight;
|
extern int g_iScreenHeight;
|
||||||
|
|
||||||
|
extern ID3D11Device* g_pd3dDevice;
|
||||||
|
|
||||||
|
void CleanupDevice();
|
||||||
Reference in new issue
Block a user