Skip to content

Commit a6a5ba5

Browse files
committed
Game extra feature, various fixes
* NEW: Game Extra feature fully implemented, see description: https://github.com/xrOxygen/xray-oxygen/wiki/Extra-Features * DEL: Old game defines, and unused features * DEL: A lot of compiler defines * DEL: Old ttapi * FIX: Time in log messages * FIX: THM loaders not running if no THM's in folders
1 parent 38d1d51 commit a6a5ba5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+481
-890
lines changed
-33
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,10 @@
11
#pragma once
22
/* KERNEL */
3-
#ifdef DEBUG
4-
#define CHECK_MOUSE_STATE // Sometimes, IDirectInputDevice8::GetDeviceData losses data (reason: unknown).
5-
// By defining this, we force to double check mouse state by calling GetDeviceState.
6-
// It's a very little performance penalty
7-
//#define JIT_OXY_MEMPOOL_DEBUG // Memory debbuging for 'X-Ray Mempool for LuaJIT'
8-
#endif
93
//#define SLOW_VERIFY_ENTITIES // Very slow verifing every entity on every game update
104
//#define MEM_DEBUG // Debbuging memory allocator
115

12-
/* Memory */
13-
#define LOW_TEXTURES_SIZE // Reduces the size of textures in 2 times.
14-
15-
/* Threading */
16-
#define NEW_TTAPI // Enable new ttapi, based on WinAPI ThreadPool system
17-
//#define TEST_TTAPI // Perform a test of ttapi integrity
18-
19-
/* xrCore */
20-
#define LOG_TIME_PRECISE // Optimization log writte (by alpet & RvP)
21-
226
/* Scripts */
23-
//#define SPAWN_ANTIFREEZE // spread spawn of game objects thoughout multiple frames to prevent lags
247
//#define LUACP_API // attaching luaicp.dll
258

26-
/* xrRender */
27-
#define R34_USE_FIRSTMIPLEVEL // activate: LoadInfo.FirstMipLevel = img_loaded_lod;
28-
299
/* xrGame */
30-
#define WPN_AUTORELOAD // Enable autoreload
31-
//#define DYNAMIC_SUN_MOVEMENT // Use dynamic sun movement
32-
//#define ASPAWN_CROW // Spawn crows over actor
3310
//#define NEW_ANIMS_WPN // Enable anm_..._crouch, anm_reload_empty
34-
#define DEAD_BODY_WEAPON // Enable weapons in dead stalkers
35-
#define POLTERGEIST_BUILD_DIE // Old style polter dead. Need fixes for scripts and configs.
36-
37-
/* True Stalker */
38-
//#define HOLD_PICKUP_OFF // Selection of subjects one by one.
39-
//#define PSEUDOGIG_JUMP_NOHIT // Disabling hit on pseudogigant jump.
40-
//#define POLTER_SHOW_DEAD // Showing poltergeist particle if polter dead.
41-
//#define SOC_TALK_WND // Left and Right talkers icons
42-
//#define MONSTER_INV // Inventory on Monsted dead body
43-
//#define VERTICAL_BELT // Verticals belt slots

code/engine.vc2008/xrCore/_math.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,14 @@ void __cdecl thread_entry(void* _params)
337337
entry(arglist);
338338
}
339339

340-
void thread_spawn(thread_t* entry, const char* name, unsigned stack, void* arglist)
340+
HANDLE thread_spawn(thread_t* entry, const char* name, unsigned stack, void* arglist)
341341
{
342342
THREAD_STARTUP* startup = new THREAD_STARTUP();
343343
startup->entry = entry;
344344
startup->name = (char*)name;
345345
startup->args = arglist;
346-
_beginthread(thread_entry, stack, startup);
346+
uintptr_t hThread = _beginthread(thread_entry, stack, startup);
347+
return reinterpret_cast<HANDLE> (hThread);
347348
}
348349

349350
void spline1(float t, Fvector *p, Fvector *ret)

code/engine.vc2008/xrCore/_math.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ extern XRCORE_API void _initialize_cpu_thread ();
3030
// threading
3131
typedef void thread_t ( void * );
3232
extern XRCORE_API void thread_name ( const char* name);
33-
extern XRCORE_API void thread_spawn (thread_t* entry, const char* name, unsigned stack, void* arglist);
33+
extern XRCORE_API HANDLE thread_spawn (thread_t* entry, const char* name, unsigned stack, void* arglist);

code/engine.vc2008/xrCore/_vector3d_ext.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ float angle_between_vectors (Fvector const v1, Fvector const v2)
136136
{
137137
float const mag1 = v1.magnitude();
138138
float const mag2 = v2.magnitude();
139-
float const epsilon = 1e-6;
139+
float const epsilon = 1e-6f;
140140
if ( mag1 < epsilon || mag2 < epsilon )
141141
{
142142
return 0.f;

code/engine.vc2008/xrCore/log.cpp

+11-17
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ size_t cached_log = 0;
1818
xr_vector<shared_str>* LogFile = NULL;
1919
static LogCallback LogCB = 0;
2020

21+
inline const size_t FlushTreshold = 32768;
22+
2123
void FlushLog()
2224
{
2325
try
@@ -55,7 +57,6 @@ void AddOne(const char *split)
5557

5658
shared_str temp = shared_str(split);
5759
LogFile->push_back(temp);
58-
#ifdef LOG_TIME_PRECISE
5960
if (LogWriter)
6061
{
6162
switch (*split)
@@ -67,28 +68,21 @@ void AddOne(const char *split)
6768
break;
6869
}
6970

70-
char buf[64];
71-
//SYSTEMTIME lt;
72-
//GetLocalTime(&lt);
71+
string256 buf;
72+
SYSTEMTIME localTime;
73+
GetLocalTime(&localTime);
74+
int bufSize = xr_sprintf(buf, "[%hu.%hu.%hu %hu.%hu.%hu]", localTime.wDay, localTime.wMonth, localTime.wYear, localTime.wHour, localTime.wMinute, localTime.wSecond);
7375

7476
sprintf_s(buf, 64, "[%s %s] ", Core.UserDate, Core.UserTime);
7577
LogWriter->w_printf("%s%s\r\n", buf, split);
76-
cached_log += xr_strlen(buf);
78+
cached_log += bufSize;
7779
cached_log += xr_strlen(split) + 2;
78-
#else
79-
time_t t = time(NULL);
80-
tm* ti = localtime(&t);
81-
82-
strftime(buf, 64, "[%x %X]\t", ti);
83-
84-
LogWriter->wprintf("%s %s\r\n", buf, split);
85-
#endif
86-
if (force_flush_log || cached_log >= 32768)
80+
if (force_flush_log || cached_log >= FlushTreshold)
81+
{
8782
FlushLog();
83+
cached_log = 0;
84+
}
8885

89-
//-RvP
90-
91-
//exec CallBack
9286
if (LogExecCB&&LogCB)LogCB(split);
9387
}
9488

0 commit comments

Comments
 (0)