mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
Added window around windowed JA2
Replaced Windows console with freeware console implementation. Activate in windowed mode with \ Added error and quit if JA2 started in window mode in >16bpp color depth Fix to enemy sector investigation: Was deducting from redshirts when elites investigated Fix AWOL militia (need additional fix to prevent them from being redistributed during after reinforcements) Fix to tanks to add them in their original spot when a new one cannot be found. Should modify to remove old wreckage in this case. AI no longer tries to fire mortar when no room for it Tanks no longer try to throw knives git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1030 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -73,6 +73,7 @@ void GetRuntimeSettings( );
|
||||
|
||||
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
|
||||
|
||||
Console g_Console("", "", "Lua Console", "no");
|
||||
|
||||
#if !defined(JA2) && !defined(UTILS)
|
||||
void ProcessCommandLine(CHAR8 *pCommandLine);
|
||||
@@ -95,6 +96,7 @@ HINSTANCE ghInstance;
|
||||
|
||||
// Global Variable Declarations
|
||||
RECT rcWindow;
|
||||
POINT ptWindowSize;
|
||||
|
||||
// moved from header file: 24mar98:HJH
|
||||
UINT32 giStartMem;
|
||||
@@ -141,6 +143,10 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
|
||||
switch(Message)
|
||||
{
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
{
|
||||
QueueEvent(MOUSE_WHEEL, wParam, lParam);
|
||||
@@ -149,13 +155,22 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
|
||||
#ifdef JA2
|
||||
case WM_MOVE:
|
||||
if( 1==iScreenMode )
|
||||
{
|
||||
// if( 1==iScreenMode )
|
||||
// {
|
||||
GetClientRect(hWindow, &rcWindow);
|
||||
ClientToScreen(hWindow, (LPPOINT)&rcWindow);
|
||||
ClientToScreen(hWindow, (LPPOINT)&rcWindow+1);
|
||||
}
|
||||
// }
|
||||
break;
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
MINMAXINFO *mmi = (MINMAXINFO*)lParam;
|
||||
|
||||
mmi->ptMaxSize = ptWindowSize;
|
||||
mmi->ptMaxTrackSize = mmi->ptMaxSize;
|
||||
mmi->ptMinTrackSize = mmi->ptMaxSize;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
case WM_MOUSEMOVE:
|
||||
break;
|
||||
@@ -303,6 +318,20 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case WM_SETCURSOR:
|
||||
SetCursor( NULL);
|
||||
return TRUE;
|
||||
|
||||
case WM_TIMER:
|
||||
#ifdef LUACONSOLE
|
||||
PollConsole( );
|
||||
#endif
|
||||
|
||||
if (gfApplicationActive)
|
||||
{
|
||||
GameLoop();
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_ACTIVATEAPP:
|
||||
switch(wParam)
|
||||
@@ -360,7 +389,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
|
||||
case WM_DESTROY:
|
||||
ShutdownStandardGamingPlatform();
|
||||
ShowCursor(TRUE);
|
||||
// ShowCursor(TRUE);
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
@@ -410,6 +439,24 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
break;
|
||||
#endif
|
||||
|
||||
case WM_SYSKEYUP:
|
||||
case WM_KEYUP:
|
||||
KeyUp(wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYDOWN:
|
||||
KeyDown(wParam, lParam);
|
||||
gfSGPInputReceived = TRUE;
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
if (wParam == '\\' &&
|
||||
lParam && KF_ALTDOWN)
|
||||
{
|
||||
g_Console.Create(NULL);
|
||||
}
|
||||
break;
|
||||
default
|
||||
: return DefWindowProc(hWindow, Message, wParam, lParam);
|
||||
}
|
||||
@@ -701,6 +748,7 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
|
||||
#endif
|
||||
MSG Message;
|
||||
HWND hPrevInstanceWindow;
|
||||
UINT32 uiTimer = 0;
|
||||
|
||||
// Make sure that only one instance of this application is running at once
|
||||
// // Look for prev instance by searching for the window
|
||||
@@ -753,7 +801,7 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
|
||||
|
||||
#endif
|
||||
|
||||
ShowCursor(FALSE);
|
||||
// ShowCursor(FALSE);
|
||||
|
||||
// Inititialize the SGP
|
||||
if (InitializeStandardGamingPlatform(hInstance, sCommandShow) == FALSE)
|
||||
@@ -762,7 +810,10 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
|
||||
}
|
||||
|
||||
#ifdef LUACONSOLE
|
||||
CreateConsole();
|
||||
if (1==iScreenMode)
|
||||
{
|
||||
CreateConsole();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef JA2
|
||||
@@ -776,12 +827,15 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
|
||||
|
||||
FastDebugMsg("Running Game");
|
||||
|
||||
// 0verhaul: Roughly 60 frames per second. The original "low cpu" code did 30, but that is really slow
|
||||
SetTimer( ghWindow, uiTimer, 16, NULL);
|
||||
|
||||
// At this point the SGP is set up, which means all I/O, Memory, tools, etc... are available. All we need to do is
|
||||
// attend to the gaming mechanics themselves
|
||||
while (gfProgramIsRunning)
|
||||
{
|
||||
if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE))
|
||||
{ // We have a message on the WIN95 queue, let's get it
|
||||
// if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE))
|
||||
// { // We have a message on the WIN95 queue, let's get it
|
||||
if (!GetMessage(&Message, NULL, 0, 0))
|
||||
{ // It's quitting time
|
||||
return Message.wParam;
|
||||
@@ -790,6 +844,7 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
|
||||
TranslateMessage(&Message);
|
||||
DispatchMessage(&Message);
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{ // Windows hasn't processed any messages, therefore we handle the rest
|
||||
#ifdef LUACONSOLE
|
||||
@@ -809,6 +864,9 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR p
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
KillTimer( ghWindow, uiTimer);
|
||||
|
||||
// This is the normal exit point
|
||||
FastDebugMsg("Exiting Game");
|
||||
@@ -854,7 +912,7 @@ void SGPExit(void)
|
||||
#endif
|
||||
|
||||
ShutdownStandardGamingPlatform();
|
||||
ShowCursor(TRUE);
|
||||
// ShowCursor(TRUE);
|
||||
if(strlen(gzErrorMsg))
|
||||
{
|
||||
MessageBox(NULL, gzErrorMsg, "Error", MB_OK | MB_ICONERROR );
|
||||
|
||||
Reference in New Issue
Block a user