[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src Makefile config.h DirectX/DirectS...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer/src Makefile config.h DirectX/DirectS... |
Date: |
Sat, 06 Sep 2003 07:35:36 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/09/06 07:35:36
Modified files:
src : Makefile config.h
src/DirectX/DirectSound: DSound.cpp DSound.hpp
src/NetPanzer/Core: netPanzerThread.cpp netPanzerWinMain.cpp
netPanzerWinProc.cpp
src/NetPanzer/Interfaces: GameManager.cpp
src/NetPanzer/Interfaces/win32: NetworkClientDPlay.cpp
NetworkServerDPlay.cpp
src/Win32/Winsock: WinsockClient.cpp
Log message:
did some small fixes to make the thing compiling in mingw again
Patches:
Index: netpanzer/src/DirectX/DirectSound/DSound.cpp
diff -u netpanzer/src/DirectX/DirectSound/DSound.cpp:1.4
netpanzer/src/DirectX/DirectSound/DSound.cpp:1.5
--- netpanzer/src/DirectX/DirectSound/DSound.cpp:1.4 Sat Sep 6 06:34:28 2003
+++ netpanzer/src/DirectX/DirectSound/DSound.cpp Sat Sep 6 07:35:35 2003
@@ -18,6 +18,7 @@
#include <config.h>
#include <windows.h>
+#include "gapp.hpp"
#include "DSound.hpp"
#include "sfx.h"
#include "wavfile.h"
@@ -40,7 +41,7 @@
Enabled = false;
}
-bool DirectSound::Initialize()
+bool DirectSound::initialize()
{
HRESULT hr;
short index;
@@ -113,7 +114,7 @@
if(hr == DSERR_OUTOFMEMORY)
MessageBox(hWnd, "Not enough memory to run DirectSound.
You can still play netPanzer, but there won't be any sound.", "Error", MB_OK);
- ShutDownDirectSound();
+ shutdown();
return false;
}
@@ -124,7 +125,7 @@
if(hr != DS_OK)
{
MessageBox(hWnd, "DirectSound initialization failed. You can
still play netPanzer, but there won't be any sound.", "Error", MB_OK);
- ShutDownDirectSound();
+ shutdown();
return false;
}
@@ -137,7 +138,7 @@
if(hr != DS_OK)
{
MessageBox(hWnd, "DirectSound can't get sound card info. You
can still play netPanzer, but there won't be any sound.", "Error", MB_OK);
- ShutDownDirectSound();
+ shutdown();
return false;
}
@@ -196,7 +197,7 @@
if(WaveLoadFile( file_path, &cbSize[index], &cSamples[index],
&m_pWaveFormatEx[index], &pbData1[index]) != 0)
{
MessageBox(hWnd, "DirectSound couldn't initialize
completely. You can still play netPanzer, but there will be no sound.",
"Error", MB_OK);
- ShutDownDirectSound();
+ shutdown();
return false;
}
@@ -235,8 +236,7 @@
if(hr != DS_OK)
{
MessageBox(hWnd, "DirectSound couldn't
initialize completely. You can still play netPanzer, but there will be no
sound.", "Error", MB_OK);
- ShutDownDirectSound();
- return false;
+ shutdown();
}
}
@@ -246,7 +246,7 @@
else
{
MessageBox(hWnd, "DirectSound couldn't initialize
completely. You can still play netPanzer, but there will be no sound.",
"Error", MB_OK);
- ShutDownDirectSound();
+ shutdown();
return false;
}
}
Index: netpanzer/src/DirectX/DirectSound/DSound.hpp
diff -u netpanzer/src/DirectX/DirectSound/DSound.hpp:1.3
netpanzer/src/DirectX/DirectSound/DSound.hpp:1.4
--- netpanzer/src/DirectX/DirectSound/DSound.hpp:1.3 Sat Sep 6 06:34:28 2003
+++ netpanzer/src/DirectX/DirectSound/DSound.hpp Sat Sep 6 07:35:35 2003
@@ -22,11 +22,12 @@
#include "mmsystem.h"
//#include "mmreg.h"
//#include "msacm.h"
-#include "dsound.h"
+#include <dsound.h>
#include "PObject.hpp"
#include "UnitTypes.hpp"
#include "sfx.h"
+#include "Sound.hpp"
////EXTERNALS/////////////////////////////////////////////////////
@@ -113,7 +114,7 @@
DirectSound();
- void initialize();
+ bool initialize();
void shutdown();
void PlayTankIdle();
Index: netpanzer/src/Makefile
diff -u netpanzer/src/Makefile:1.6 netpanzer/src/Makefile:1.7
--- netpanzer/src/Makefile:1.6 Sat Sep 6 07:04:14 2003
+++ netpanzer/src/Makefile Sat Sep 6 07:35:34 2003
@@ -13,6 +13,10 @@
NetPanzer/Core NetPanzer/Resources \
UILib
+LINKFLAGS += -g3
+INCLUDEDIRS=$(DIRS) NetPanzer/Classes/Network
+CFLAGS += -Wall -g3 -O2 $(foreach dir, $(INCLUDEDIRS), -I$(dir))
+
ifeq ($(SYSTEM),UNIX)
DIRS += NetPanzer/Interfaces/unix Stub Win32/unix UILib/SDL \
NetPanzer/Core/unix
@@ -25,7 +29,7 @@
DirectX/DirectPlay DirectX/DirectSound \
Win32 Win32/Winsock
GOAL = ../netpanzer.exe
-CFLAGS += -DWIN32 -Iw32api
+CFLAGS += -DWIN32 -Iw32api -D_DEBUG -Wno-unknown-pragmas
LINKFLAGS += -lgdi32 -lshell32 -lddraw -ldinput -ldplayx -ldsound -lws2_32
-ldsetup -lwinmm -ldxguid -lole32
endif
@@ -34,10 +38,6 @@
# eventually disable if you don't have makedep installed (but you don't have
# dependency checking then)
#MAKEDEPEND=makedepend
-
-LINKFLAGS += -g3
-INCLUDEDIRS=$(DIRS) NetPanzer/Classes/Network
-CFLAGS += -Wall -g3 -O2 $(foreach dir, $(INCLUDEDIRS), -I$(dir))
$(GOAL): $(OBJECTS)
g++ -o $(GOAL) $(OBJECTS) $(LINKFLAGS)
Index: netpanzer/src/NetPanzer/Core/netPanzerThread.cpp
diff -u netpanzer/src/NetPanzer/Core/netPanzerThread.cpp:1.3
netpanzer/src/NetPanzer/Core/netPanzerThread.cpp:1.4
--- netpanzer/src/NetPanzer/Core/netPanzerThread.cpp:1.3 Fri Sep 5
22:01:19 2003
+++ netpanzer/src/NetPanzer/Core/netPanzerThread.cpp Sat Sep 6 07:35:35 2003
@@ -20,7 +20,7 @@
#include "netPanzerGlobals.h"
#include "netPanzerMain.h"
-//#include <process.h>
+#include <process.h>
#include "GameManager.hpp"
@@ -39,5 +39,5 @@
PANZER_THREAD_FINISHED = true;
// XXX
- //_endthread();
+ _endthread();
}
Index: netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp
diff -u netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp:1.5
netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp:1.6
--- netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp:1.5 Sat Sep 6
07:04:15 2003
+++ netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp Sat Sep 6 07:35:35 2003
@@ -32,51 +32,55 @@
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
- //first declare a message structure to hold Windows messages
- //and a structure to contain the data pertinent to this application--
- MSG message;
-
- //clear out the GlobalApp data--
- memset((void *) &gapp, 0, sizeof(gapp));
-
- //Initialize the Windows portion of PanzerKrieg (create a window,
- //fill in the contents of our GlobalApp structure, etc.)
- if( WinInit( hInstance, nCmdShow) == false) return false;
+ //first declare a message structure to hold Windows messages
+ //and a structure to contain the data pertinent to this application--
+ MSG message;
+
+ //clear out the GlobalApp data--
+ memset((void *) &gapp, 0, sizeof(gapp));
+
+#ifdef USE_SDL
+ SDL_Init(SDL_INIT_EVERYTHING);
+#endif
+
+ //Initialize the Windows portion of PanzerKrieg (create a window,
+ //fill in the contents of our GlobalApp structure, etc.)
+ if( WinInit( hInstance, nCmdShow) == false)
+ return false;
if( netPanzerInitialize( lpCmdLine ) == false)
- return false;
+ return false;
- //the game loop--
- //PANZER_THREAD_HANDLE = _beginthread(PanzerThread, 0, 0);
+ //the game loop--
+ //PANZER_THREAD_HANDLE = _beginthread(PanzerThread, 0, 0);
- //just cause they do it in the book, for now only--
- ShowCursor( false );
+ //just cause they do it in the book, for now only--
+ ShowCursor( false );
- while( 1 )
- {
+ while( 1 )
+ {
if( PeekMessage( &message, 0, 0, 0, PM_NOREMOVE ) )
- {
- if(GetMessage( &message, 0, 0, 0))
- {
+ {
+ if(GetMessage( &message, 0, 0, 0))
+ {
TranslateMessage(&message);
DispatchMessage(&message);
- }
- else
- {
- return message.wParam;
- }
- } // ** if PeekMessage
- else
- {
- if ( FUCK_THREAD == true )
- {
- FUCK_THREAD = false;
- }
-
- GameManager::mainLoop();
- }
- } // ** while
-
+ }
+ else
+ {
+ return message.wParam;
+ }
+ } // ** if PeekMessage
+ else
+ {
+ if ( FUCK_THREAD == true )
+ {
+ FUCK_THREAD = false;
+ }
+
+ GameManager::mainLoop();
+ }
+ } // ** while
}
////////////////////////////////////////////////////////////////
//END WINMAIN///////////////////////////////////////////////////
@@ -87,38 +91,41 @@
//application. then it creates our window using that class--
static bool WinInit( HANDLE hInstance, int nCmdShow)
{
- RECT client_win_rect;
+ RECT client_win_rect;
WNDCLASS wc;
- gapp.hinstance = (HINSTANCE) hInstance;
+ gapp.hinstance = (HINSTANCE) hInstance;
+
+ wc.style = CS_DBLCLKS;
+ wc.lpfnWndProc = PanzerProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = (HINSTANCE) hInstance;
+ wc.hIcon = LoadIcon( (HINSTANCE) hInstance,
MAKEINTATOM(IDI_ICON1));
+ wc.hCursor = LoadCursor( 0, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH) GetStockObject( BLACK_BRUSH);
+ wc.lpszMenuName = 0;
+ wc.lpszClassName = "netPanzerClass";
+
+ if( !RegisterClass( &wc )) {
+ fprintf (stderr, "Failed to register ApplicationClass.\n");
+ return false;
+ }
- wc.style = CS_DBLCLKS;
- wc.lpfnWndProc = PanzerProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = (HINSTANCE) hInstance;
- wc.hIcon = LoadIcon( (HINSTANCE) hInstance,
MAKEINTATOM(IDI_ICON1));
- wc.hCursor = LoadCursor( 0, IDC_ARROW);
- wc.hbrBackground = (HBRUSH) GetStockObject( BLACK_BRUSH);
- wc.lpszMenuName = 0;
- wc.lpszClassName = "netPanzerClass";
-
- if( !RegisterClass( &wc )) return false;
-
- // XXX can we somehow avoid to disaply the windo already here? The
- // dedicated server shouldn't open a window at all...
- client_win_rect.left = 0;
- client_win_rect.right = 640;
- client_win_rect.top = 0;
- client_win_rect.bottom = 480;
+ client_win_rect.left = 0;
+ client_win_rect.right = 640;
+ client_win_rect.top = 0;
+ client_win_rect.bottom = 480;
- AdjustWindowRect( &client_win_rect, WS_SYSMENU | WS_BORDER | WS_CAPTION
| WS_VISIBLE | WS_MINIMIZEBOX, false );
+ AdjustWindowRect( &client_win_rect, WS_SYSMENU | WS_BORDER | WS_CAPTION |
+ WS_VISIBLE | WS_MINIMIZEBOX, false );
gapp.hwndApp = CreateWindowEx(
WS_EX_APPWINDOW,
"netPanzerClass",
"netPanzer",
- WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_VISIBLE |
WS_MINIMIZEBOX,
+ WS_SYSMENU | WS_BORDER | WS_CAPTION
+ | WS_VISIBLE | WS_MINIMIZEBOX,
0,
0,
client_win_rect.right, //GetSystemMetrics(SM_CXSCREEN),
@@ -128,8 +135,10 @@
(HINSTANCE) hInstance,
0 );
- if( gapp.hwndApp == 0)
+ if( gapp.hwndApp == 0) {
+ fprintf(stderr, "Couldn't create main window.\n");
return false;
+ }
else
return true;
}
Index: netpanzer/src/NetPanzer/Core/netPanzerWinProc.cpp
diff -u netpanzer/src/NetPanzer/Core/netPanzerWinProc.cpp:1.4
netpanzer/src/NetPanzer/Core/netPanzerWinProc.cpp:1.5
--- netpanzer/src/NetPanzer/Core/netPanzerWinProc.cpp:1.4 Fri Sep 5
22:01:19 2003
+++ netpanzer/src/NetPanzer/Core/netPanzerWinProc.cpp Sat Sep 6 07:35:35 2003
@@ -58,18 +58,26 @@
{
case SM_STREAMEVENT:
+ printf("streamev1.\n");
+ fflush(stdout);
ServStreamAsyncMsg(hwnd, wParam, lParam);
break;
case SM_DGRAMEVENT:
+ printf("streamev2.\n");
+ fflush(stdout);
ServDgramAsyncMsg(hwnd, wParam, lParam);
break;
case CM_STREAMEVENT:
- ClientStreamAsyncMsg(hwnd, wParam, lParam);
+ printf("streamev3.\n");
+ fflush(stdout);
+ ClientStreamAsyncMsg(hwnd, wParam, lParam);
break;
case CM_DGRAMEVENT:
+ printf("streamev4.\n");
+ fflush(stdout);
ClientDgramAsyncMsg(hwnd, wParam, lParam);
break;
@@ -123,7 +131,7 @@
{
LOG( ("WM_ACTIVATE") );
//DDraw.setGDIStatus( false );
- Win32HideHardwareMouse();
+ ShowCursor(false);
//DDraw.palette.activateCurrentPalette();
}
@@ -131,7 +139,7 @@
{
LOG( ("WM_ACTIVATE") );
//DDraw.setGDIStatus( true );
- Win32ShowHardwareMouse();
+ ShowCursor(true);
//DDraw.palette.activateSystemPalette();
}
}
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.10
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.11
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.10 Sat Sep 6
06:34:29 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp Sat Sep 6 07:35:35 2003
@@ -41,8 +41,8 @@
#ifdef WIN32
#include "NetworkServerWinSock.hpp"
#include "NetworkClientWinSock.hpp"
-#include "NetworkServerDPlay.hpp"
-#include "NetworkClientDPlay.hpp"
+//#include "NetworkServerDPlay.hpp"
+//#include "NetworkClientDPlay.hpp"
#endif
#include "UILib/UIDraw.hpp"
@@ -209,10 +209,13 @@
void GameManager::initializeSoundSubSystem()
{
#ifdef WIN32
- if ( dsound.Initialize( gapp.hwndApp) == false )
- {
- LOG( ( "Failure to initialize DirectSound Sub-system" ) );
- }
+ sound = new DirectSound();
+ if (!sound->initialize())
+ {
+ LOG( ( "Failure to initialize DirectSound Sub-system" ) );
+ delete sound;
+ sound = 0;
+ }
#endif
}
@@ -221,7 +224,7 @@
void GameManager::shutdownSoundSubSystem()
{
#ifdef WIN32
- dsound.ShutDownDirectSound();
+ sound->shutdown();
#endif
}
@@ -1065,9 +1068,7 @@
{
PointXYi spawn_point;
-#ifdef WIN32
- dsound.StopTankIdle();
-#endif
+ sound->StopTankIdle();
// ** Get a new spawn point and spawn the player **
MapInterface::getFreeSpawnPoint( &spawn_point );
@@ -1088,9 +1089,7 @@
SERVER->sendMessage( &set_view, sizeof( SystemSetPlayerView ), player, 0 );
}
-#ifdef WIN32
- dsound.PlayTankIdle();
-#endif
+ sound->PlayTankIdle();
}
void GameManager::respawnAllPlayers()
@@ -1636,9 +1635,7 @@
}
ClientConnectDaemon::startConnectionProcess();
-#ifdef WIN32
- dsound.PlayTankIdle();
-#endif
+ sound->PlayTankIdle();
}
// ******************************************************************
@@ -1811,10 +1808,8 @@
// ******************************************************************
void GameManager::exitNetPanzer()
{
-#ifdef WIN32
// NOTE: Hack
- dsound.StopTankIdle();
-#endif
+ sound->StopTankIdle();
quitNetPanzerGame();
Index: netpanzer/src/NetPanzer/Interfaces/win32/NetworkClientDPlay.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/win32/NetworkClientDPlay.cpp:1.2
netpanzer/src/NetPanzer/Interfaces/win32/NetworkClientDPlay.cpp:1.3
--- netpanzer/src/NetPanzer/Interfaces/win32/NetworkClientDPlay.cpp:1.2 Fri Sep
5 22:01:19 2003
+++ netpanzer/src/NetPanzer/Interfaces/win32/NetworkClientDPlay.cpp Sat Sep
6 07:35:36 2003
@@ -27,12 +27,15 @@
#include "DirectPlay.h"
#include "DPlayError.hpp"
-#include "DirectDrawGlobals.hpp"
#include "MouseInterface.hpp"
#include "ClientConnectDaemon.hpp"
+// XXX disabled, broken and probably not needed if socket code is working
+
+#if 0
+
NetworkClientDPlay::NetworkClientDPlay( void )
: NetworkClient()
{
@@ -273,3 +276,4 @@
return( false );
}
+#endif
Index: netpanzer/src/NetPanzer/Interfaces/win32/NetworkServerDPlay.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/win32/NetworkServerDPlay.cpp:1.2
netpanzer/src/NetPanzer/Interfaces/win32/NetworkServerDPlay.cpp:1.3
--- netpanzer/src/NetPanzer/Interfaces/win32/NetworkServerDPlay.cpp:1.2 Fri Sep
5 22:01:19 2003
+++ netpanzer/src/NetPanzer/Interfaces/win32/NetworkServerDPlay.cpp Sat Sep
6 07:35:36 2003
@@ -32,6 +32,9 @@
#include "ServerConnectDaemon.hpp"
+// XXX Code broken and probably not neccessary when the socket stuff is
+// working
+#if 0
NetworkServerDPlay::NetworkServerDPlay()
: NetworkServer()
@@ -257,3 +260,4 @@
return( false );
}
+#endif
Index: netpanzer/src/Win32/Winsock/WinsockClient.cpp
diff -u netpanzer/src/Win32/Winsock/WinsockClient.cpp:1.3
netpanzer/src/Win32/Winsock/WinsockClient.cpp:1.4
--- netpanzer/src/Win32/Winsock/WinsockClient.cpp:1.3 Fri Sep 5 22:01:20 2003
+++ netpanzer/src/Win32/Winsock/WinsockClient.cpp Sat Sep 6 07:35:36 2003
@@ -1045,6 +1045,8 @@
if(iBytesReceived == SOCKET_ERROR)
{
iError = WSAGetLastError();
+ printf("socket error.\n");
+ fflush(stdout);
return;
}
@@ -1067,6 +1069,9 @@
strcpy((char*)GAMEINFOCLIENT.MapName, basicGameInfo->MapName);
strcpy((char*)GAMEINFOCLIENT.PlayerName,
basicGameInfo->PlayerName);
+ printf("gameinfo!\n");
+ fflush(stdout);
+
serverTimeout.reset();
netPanzerFound = true;
@@ -1080,6 +1085,8 @@
else
{
//enqueue this datagram--
+ printf ("Enqueue packet.\n");
+ fflush(stdout);
EnqueueUnreliablePacket(RecvDgram,
iBytesReceived,
1,
Index: netpanzer/src/config.h
diff -u netpanzer/src/config.h:1.2 netpanzer/src/config.h:1.3
--- netpanzer/src/config.h:1.2 Sat Sep 6 06:34:27 2003
+++ netpanzer/src/config.h Sat Sep 6 07:35:34 2003
@@ -4,4 +4,4 @@
#define __attrib__(x)
#endif
-#define USE_SDL
+//#define USE_SDL
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer/src Makefile config.h DirectX/DirectS...,
Matthias Braun <=