Lots of feature upgrades.

This commit is contained in:
Justin Marshall
2026-05-30 02:50:21 -07:00
parent 7806bb8ef8
commit ea74cd9921
13 changed files with 2433 additions and 153 deletions
+42 -2
View File
@@ -144,6 +144,7 @@ BOOL gbRunGame;
BOOL gbRunGameResult;
BOOL gbProcessPlayers;
BOOL gbGameLoopStartup;
extern int gnRenderFrameInterp;
bool gbTheo = false;
bool gbCowsuit = false;
@@ -167,6 +168,7 @@ int glMid3Seed[NUMLEVELS+1]; //JKE 7/30 adds new levels
**-----------------------------------------------------------------------*/
#define TIMEOUT_CURSOR WATCH_CURS
static int sgnTimeoutCurs = NO_CURSOR;
static DWORD sgdwLastRenderFrame;
#define LMOUSE_DOWN 1
#define RMOUSE_DOWN 2
@@ -184,6 +186,8 @@ BYTE sgbMouseDown = 0;
static void alloc_plr();
static void DoTimedEvents();
static void game_loop(BOOL bStartup);
static void DrawInterpolatedFrame();
static BOOL TryDrawInterpolatedFrame();
static void plr_encrypt(BOOL bEncrypt);
void InitializeHashSource();
void Decrypt(LPDWORD data, DWORD bytes, DWORD key);
@@ -205,6 +209,7 @@ static LRESULT CALLBACK GM_Game(HWND, UINT, WPARAM, LPARAM);
void TrackInit(BOOL bMouseDown);
void TrackMouse();
void run_delta_info();
int nthread_get_render_interp();
void toggle_frame_counter();
WNDPROC my_SetWindowProc(WNDPROC wndProc);
void plrmsg_update();
@@ -632,10 +637,14 @@ static void run_game_loop(UINT uMsg) {
BOOL bRun = gbRunGame && nthread_run_gameloop(FALSE);
//if (! bRun) plr_encrypt(TRUE);
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_NORMAL);
if (! bRun) continue;
if (! bRun) {
TryDrawInterpolatedFrame();
continue;
}
}
else if (! nthread_run_gameloop(FALSE)) {
// not enough time has elapsed since last gameloop
TryDrawInterpolatedFrame();
continue;
}
// pjw.patch2.end
@@ -645,7 +654,7 @@ static void run_game_loop(UINT uMsg) {
NetReceivePackets();
game_loop(gbGameLoopStartup);
gbGameLoopStartup = FALSE;
DrawAndBlit();
DrawInterpolatedFrame();
//plr_encrypt(TRUE);
}
//plr_encrypt(FALSE);
@@ -678,6 +687,37 @@ static void run_game_loop(UINT uMsg) {
}
//******************************************************************
//******************************************************************
static void DrawInterpolatedFrame()
{
sgdwLastRenderFrame = GetTickCount();
if (PauseMode || (gbMaxPlayers == 1 && gmenu_is_on()))
gnRenderFrameInterp = 0;
else
gnRenderFrameInterp = nthread_get_render_interp();
DrawAndBlit();
}
//******************************************************************
//******************************************************************
static BOOL TryDrawInterpolatedFrame()
{
DWORD dwNow;
dwNow = GetTickCount();
if (dwNow - sgdwLastRenderFrame < 1000 / RENDER_FRAMES_PER_SECOND)
return FALSE;
if (force_redraw == NODRAW)
force_redraw = VIEWDRAW;
DrawInterpolatedFrame();
return TRUE;
}
/*-----------------------------------------------------------------------**
// return FALSE to quit game
// return TRUE to continue game