Skip to content

Commit

Permalink
Merge remote-tracking branch 'intorr/intorr_dev' into xd_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jan 24, 2018
2 parents 97ee2ee + 9f41ddc commit 20302a8
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 550 deletions.
20 changes: 20 additions & 0 deletions src/utils/xrAI/StdAfx.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
#include "stdafx.h"
#include "xrCore/cdecl_cast.hpp"
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"

ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();

CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.clMsgV(format, args);
va_end(args);
});

CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.StatusV(format, args);
va_end(args);
});

CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });
4 changes: 2 additions & 2 deletions src/utils/xrAI/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include <d3dx9.h>
#include "Common/_d3d_extensions.h"

#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"
#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
#include "utils/xrLCUtil/xrThread.hpp"

extern LevelCompilerLoggerWindow& Logger;
extern ILevelCompilerLogger& Logger;
extern CThread::LogFunc ProxyMsg;
extern CThreadManager::ReportStatusFunc ProxyStatus;
extern CThreadManager::ReportProgressFunc ProxyProgress;
Expand Down
21 changes: 1 addition & 20 deletions src/utils/xrAI/xrAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,13 @@

#pragma comment(lib, "winmm.LIB")

#include "xrCore/cdecl_cast.hpp"
#include "xrCore/ModuleLookup.hpp"

#include "factory_api.h"

Factory_Create* create_entity = 0;
Factory_Destroy* destroy_entity = 0;

LevelCompilerLoggerWindow& Logger = LevelCompilerLoggerWindow();

CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.clMsgV(format, args);
va_end(args);
});

CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.StatusV(format, args);
va_end(args);
});

CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });

extern void xrCompiler(LPCSTR name, bool draft_mode, bool pure_covers, LPCSTR out_name);
extern void verify_level_graph(LPCSTR name, bool verbose);

Expand Down Expand Up @@ -184,7 +165,7 @@ void Startup(LPSTR lpCmdLine)
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
xrDebug::Initialize(false);
Core.Initialize("xrai", 0);
Core.Initialize("xrAI");

Startup(lpCmdLine);

Expand Down
20 changes: 20 additions & 0 deletions src/utils/xrDO_Light/StdAfx.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
#include "stdafx.h"
#include "xrCore/cdecl_cast.hpp"
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"

ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();

CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.clMsgV(format, args);
va_end(args);
});

CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.StatusV(format, args);
va_end(args);
});

CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });
29 changes: 0 additions & 29 deletions src/utils/xrDO_Light/StdAfx.h
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
#pragma once

#include "Common/Common.hpp"
#include "xrCore/xrCore.h"

#pragma warning(push)
#pragma warning(disable : 4995)
#include <d3dx9.h>
#include <commctrl.h>
#pragma warning(pop)

#define ENGINE_API
#define ECORE_API
#define XR_EPROPS_API
#include "xrCore/clsid.h"
#include "xrCDB/xrCDB.h"
#include "Common/_d3d_extensions.h"

#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#include <stdio.h>

#ifdef AI_COMPILER
#include "smart_cast.h"
#endif

#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
#include "utils/xrLCUtil/xrThread.hpp"
#include "xrCore/cdecl_cast.hpp"
#include "xrScriptEngine/DebugMacros.hpp" // XXX: move debug macros to xrCore

extern ILevelCompilerLogger& Logger;
extern CThread::LogFunc ProxyMsg;
extern CThreadManager::ReportStatusFunc ProxyStatus;
extern CThreadManager::ReportProgressFunc ProxyProgress;

#define READ_IF_EXISTS(ltx, method, section, name, default_value)\
(ltx->line_exist(section, name)) ? ltx->method(section, name) : default_value
31 changes: 1 addition & 30 deletions src/utils/xrDO_Light/xrDO_Light.cpp
Original file line number Diff line number Diff line change
@@ -1,46 +1,19 @@
#include "stdafx.h"
#include "process.h"

#include "utils/xrLC_Light/xrlc_light.h"
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"
#include "xrCore/cdecl_cast.hpp"
#include "utils/xrLCUtil/xrLCUtil.hpp"
//#pragma comment(linker,"/STACK:0x800000,0x400000")

#pragma comment(lib, "comctl32.lib")
#pragma comment(lib, "winmm.LIB")

ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow();

CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.clMsgV(format, args);
va_end(args);
});

CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.StatusV(format, args);
va_end(args);
});

CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });

static const char* h_str =
"The following keys are supported / required:\n"
"-? or -h == this help\n"
"-f<NAME> == compile level in gamedata\\levels\\<NAME>\\\n"
"-o == modify build options\n"
"\n"
"NOTE: The last key is required for any functionality\n";

void Help() { MessageBox(0, h_str, "Command line options", MB_OK | MB_ICONINFORMATION); }
void Startup(LPSTR lpCmdLine)
{
char cmd[512];
// BOOL bModifyOptions = FALSE;
bool bNet = false;
xr_strcpy(cmd, lpCmdLine);
_strlwr(cmd);
Expand All @@ -54,7 +27,6 @@ void Startup(LPSTR lpCmdLine)
Help();
return;
}
// if (strstr(cmd,"-o")) bModifyOptions = TRUE;
if (strstr(cmd, "-net"))
bNet = true;
// Load project
Expand All @@ -65,7 +37,6 @@ void Startup(LPSTR lpCmdLine)
xr_sprintf(temp, "%s - Detail Compiler", name);
Logger.Initialize(temp);

// FS.update_path (name,"$game_levels$",name);
FS.get_path("$level$")->_set(name);

CTimer dwStartupTime;
Expand All @@ -84,9 +55,9 @@ void Startup(LPSTR lpCmdLine)

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// Initialize debugging
xrDebug::Initialize(false);
Core.Initialize("xrDO");

Startup(lpCmdLine);

return 0;
Expand Down
26 changes: 13 additions & 13 deletions src/utils/xrDXT/DXT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
#include "dxtlib.h"
#include <nvtt/nvtt.h>
#include "ETextureParams.h"
#include "dds.h"
//#include "dds.h"

BOOL APIENTRY DllMain(HANDLE hModule, u32 ul_reason_for_call, LPVOID lpReserved) { return TRUE; }
//BOOL APIENTRY DllMain(HANDLE hModule, u32 ul_reason_for_call, LPVOID lpReserved) { return TRUE; }
static HFILE gFileOut;
static HFILE gFileIn;

const u32 fcc_DXT1 = MAKEFOURCC('D', 'X', 'T', '1');
/*const u32 fcc_DXT1 = MAKEFOURCC('D', 'X', 'T', '1');
const u32 fcc_DXT2 = MAKEFOURCC('D', 'X', 'T', '2');
const u32 fcc_DXT3 = MAKEFOURCC('D', 'X', 'T', '3');
const u32 fcc_DXT4 = MAKEFOURCC('D', 'X', 'T', '4');
const u32 fcc_DXT5 = MAKEFOURCC('D', 'X', 'T', '5');
const u32 fcc_DXT5 = MAKEFOURCC('D', 'X', 'T', '5');*/

void __cdecl WriteDTXnFile(DWORD count, void* buffer, void* userData)
/*void __cdecl WriteDTXnFile(DWORD count, void* buffer, void* userData)
{
if (count == sizeof(DDS_HEADER))
{
Expand All @@ -32,7 +32,7 @@ void __cdecl WriteDTXnFile(DWORD count, void* buffer, void* userData)
}
}
_write(gFileOut, buffer, count);
}
}*/

class DDSWriter : public nvtt::OutputHandler
{
Expand All @@ -48,7 +48,7 @@ DDSWriter::DDSWriter(HFILE& file) : file(file) {}
void DDSWriter::beginImage(int size, int width, int height, int depth, int face, int miplevel) {}
bool DDSWriter::writeData(const void* data, int size)
{
if (size == sizeof(DDS_HEADER))
/*if (size == sizeof(DDS_HEADER))
{
DDS_HEADER* hdr = (DDS_HEADER*)data;
if (hdr->dwSize == size)
Expand All @@ -62,7 +62,7 @@ bool DDSWriter::writeData(const void* data, int size)
case fcc_DXT5: hdr->ddspf.dwRGBBitCount = 0; break;
}
}
}
}*/
_write(file, data, size);
return true;
}
Expand All @@ -89,15 +89,15 @@ void DDSErrorHandler::error(nvtt::Error e)
MessageBox(0, msg, "DXT compress error", MB_ICONERROR | MB_OK);
}

void __cdecl ReadDTXnFile(DWORD count, void* buffer, void* userData) { _read(gFileIn, buffer, count); }
/*void __cdecl ReadDTXnFile(DWORD count, void* buffer, void* userData) { _read(gFileIn, buffer, count); }
HRESULT WriteCompressedData(void* data, int miplevel, u32 size)
{
_write(gFileOut, data, size);
FillMemory(data, size, 0xff);
return 0;
}
}*/

ENGINE_API u32* Build32MipLevel(u32& _w, u32& _h, u32& _p, u32* pdwPixelSrc, STextureParams* fmt, float blend)
/*ENGINE_API*/ u32* Build32MipLevel(u32& _w, u32& _h, u32& _p, u32* pdwPixelSrc, STextureParams* fmt, float blend)
{
R_ASSERT(pdwPixelSrc);
R_ASSERT(_w % 2 == 0);
Expand Down Expand Up @@ -260,7 +260,7 @@ int DXTCompressImage(LPCSTR out_name, u8* raw_data, u32 w, u32 h, u32 pitch, STe
u8* pixel = pImagePixels;
for (u32 k = 0; k < w * 2 * h; k++, pixel += 4)
{
pixels[k].set(pixel[2], pixel[1], pixel[0], pixel[3]);
pixels[k].set(pixel[0], pixel[1], pixel[2], pixel[3]);
}
inOpt.setMipmapData(pixels, w, h);
result = nvtt::Compressor().process(inOpt, compOpt, outOpt);
Expand All @@ -272,7 +272,7 @@ int DXTCompressImage(LPCSTR out_name, u8* raw_data, u32 w, u32 h, u32 pitch, STe
rgba_t* pixels = pImage.pixels();
u8* pixel = raw_data;
for (u32 k = 0; k < w * h; k++, pixel += 4)
pixels[k].set(pixel[2], pixel[1], pixel[0], pixel[3]);
pixels[k].set(pixel[0], pixel[1], pixel[2], pixel[3]);
inOpt.setMipmapData(pixels, w, h);
result = nvtt::Compressor().process(inOpt, compOpt, outOpt);
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrDXT/StdAfx.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define ENGINE_API
#define XR_EPROPS_API
//#define ENGINE_API
//#define XR_EPROPS_API
#define ECORE_API

#include "Common/Common.hpp"
Expand Down
20 changes: 20 additions & 0 deletions src/utils/xrLC/StdAfx.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
#include "stdafx.h"
#include "xrCore/cdecl_cast.hpp"
#include "utils/xrLCUtil/LevelCompilerLoggerWindow.hpp"

ILevelCompilerLogger& Logger = LevelCompilerLoggerWindow::instance();

CThread::LogFunc ProxyMsg = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.clMsgV(format, args);
va_end(args);
});

CThreadManager::ReportStatusFunc ProxyStatus = cdecl_cast([](const char* format, ...) {
va_list args;
va_start(args, format);
Logger.StatusV(format, args);
va_end(args);
});

CThreadManager::ReportProgressFunc ProxyProgress = cdecl_cast([](float progress) { Logger.Progress(progress); });
12 changes: 3 additions & 9 deletions src/utils/xrLC/StdAfx.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
#pragma once
#include <memory>
#include "Common/Common.hpp"
#include "utils/xrLC_Light/xrLC_Light.h"

#define ENGINE_API // fake, to enable sharing with engine
// comment - ne figa oni ne sharyatsya
#define ENGINE_API

#define ECORE_API // fake, to enable sharing with editors
#define XR_EPROPS_API
#include "xrCore/clsid.h"
#include "Common/Common.hpp"
#include "utils/xrLC_Light/xrLC_Light.h"

#include "utils/xrLCUtil/ILevelCompilerLogger.hpp"
#include "utils/xrLCUtil/xrThread.hpp"
#include "xrCore/cdecl_cast.hpp"

extern ILevelCompilerLogger& Logger;
extern CThread::LogFunc ProxyMsg;
Expand Down
Loading

0 comments on commit 20302a8

Please sign in to comment.