[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src ChangeLog Makefile config.h Lib/c...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer/src ChangeLog Makefile config.h Lib/c... |
Date: |
Thu, 11 Sep 2003 13:35:48 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/09/11 13:35:47
Modified files:
src : ChangeLog Makefile config.h
src/Lib : cMouse.hpp cTimeStamp.cpp cTimeStamp.hpp
src/Lib/2D : Surface.cpp
src/Lib/Interfaces: UtilInterface.cpp
src/Lib/Particles: ParticleInterface.cpp
src/Lib/View : cInputField.hpp
src/NetPanzer/Classes: KeyBinder.hpp TileSet.cpp
WorldInputCmdProcessor.cpp
src/NetPanzer/Core: main.cpp
src/NetPanzer/Interfaces: ConsoleInterface.cpp
GameControlRulesDaemon.hpp
GameManager.cpp GameManager.hpp
KeyboardInterface.cpp
KeyboardInterface.hpp MapsManager.cpp
MouseInterface.cpp
src/UILib : UIDraw.cpp UIDraw.hpp
src/UILib/SDL : SDLDraw.cpp SDLDraw.hpp
Added files:
src/Lib/optionmm: README command_line.cpp command_line.hpp
option.cpp option.hpp
Removed files:
src/NetPanzer/Structs: KeyScanCodeDefs.h
src/Stub : README
Log message:
11-Sep-2003 by Matze Braun
-removed more win32 specific code
-removed #ifdef USE_SDLs, the code is enabled by default now
-added a new commandline parser
-smaller fixes/cleanups
Patches:
Index: netpanzer/src/ChangeLog
diff -u netpanzer/src/ChangeLog:1.16 netpanzer/src/ChangeLog:1.17
--- netpanzer/src/ChangeLog:1.16 Wed Sep 10 08:03:16 2003
+++ netpanzer/src/ChangeLog Thu Sep 11 13:35:46 2003
@@ -1,3 +1,9 @@
+11-Sep-2003 by Matze Braun
+-removed more win32 specific code
+-removed #ifdef USE_SDLs, the code is enabled by default now
+-added a new commandline parser
+-smaller fixes/cleanups
+
10-Sep-2003 by Matze Braun
-more random cleanups
-more cleanups so that the Stub directory is empty now
@@ -9,6 +15,7 @@
uniform interface to functions like comparing 2 objects. But since the only
function is_equal in PObject wasn't virtual, and since it was never used I
decided that this stuff is quiet useless.
+-removed most of the win32 specific code
9-Sep-2003 by Matze Braun
-worked around issues with the block allocator code for Particl2D (new operator
Index: netpanzer/src/Lib/2D/Surface.cpp
diff -u netpanzer/src/Lib/2D/Surface.cpp:1.16
netpanzer/src/Lib/2D/Surface.cpp:1.17
--- netpanzer/src/Lib/2D/Surface.cpp:1.16 Wed Sep 10 07:26:06 2003
+++ netpanzer/src/Lib/2D/Surface.cpp Thu Sep 11 13:35:46 2003
@@ -708,19 +708,10 @@
assert(signed(pixelsPerRow) > 0);
assert(signed(numRows) > 0);
-#ifndef MSVC
int srcAdjustment = stride - pixelsPerRow;
- int destAdjustment = dest.stride - pixelsPerRow;
-#endif
+ int destAdjustment = dest.stride - pixelsPerRow;
for (int row = 0; row < numRows; row++)
{
- // XXX we don't use the assembler stuff when not on msvc
-#ifdef MSVC
- bltTransSpan(dRow, sRow, pixelsPerRow);
-
- sRow += stride;
- dRow += dest.stride;
-#else
for (int col = 0; col < pixelsPerRow; col++)
{
if (*sRow != 0)
@@ -731,7 +722,6 @@
sRow += srcAdjustment;
dRow += destAdjustment;
-#endif
}
} // end Surface::bltTrans
@@ -2006,9 +1996,11 @@
if (numRows <= 0) return;
const BYTE *table = colorTable.getColorArray();
+#if 0
int stepAndDecCount = (xSrcDelta << 16) | 0xffff;
int stepWholePart = xSrcDelta >> 16;
int srcX1FracWithCount = (srcX1 << 16) | pixelsPerRow;
+#endif
float xdelta = float(source.pix.x) / float(max.x - min.x);
for (int yCount = 0 ; yCount < numRows ; yCount++)
@@ -2056,12 +2048,12 @@
assert(mem != 0);
- int pixelsPerRow = max.x - min.x;
- int numRows = max.y - min.y;
+ size_t pixelsPerRow = max.x - min.x;
+ size_t numRows = max.y - min.y;
PIX *dRow = mem + min.y*stride + min.x;
- for (int yCount = 0 ; yCount < numRows ; yCount++)
+ for (size_t yCount = 0 ; yCount < numRows ; yCount++)
{
for(size_t x=0; x<pixelsPerRow; x++)
dRow[x] = table[dRow[x]];
@@ -2089,8 +2081,8 @@
assert(mem != 0);
assert(source.mem != 0);
- int pixelsPerRow = max.x-min.x;
- int numRows = max.y-min.y;
+ size_t pixelsPerRow = max.x-min.x;
+ size_t numRows = max.y-min.y;
int srcX1 = 0;
int srcY = 0;
@@ -2133,31 +2125,27 @@
if (pixelsPerRow <= 0) return;
if (numRows <= 0) return;
+#if 0
int stepAndDecCount = (xSrcDelta << 16) | 0xffff;
int stepWholePart = xSrcDelta >> 16;
int srcX1FracWithCount = (srcX1 << 16) | pixelsPerRow;
-
-#if 0
- printf("Source: %d %d\n", source.pix.x, source.pix.y);
- printf("DestRect: %d %d - %d %d\n", destRect.min.x, destRect.min.y,
-
destRect.max.x, destRect.max.y);
- printf("ScaledVals: %d %d - %d %d %d\n", srcX1, xSrcDelta,
- srcX1FracWithCount, stepAndDecCount, stepWholePart);
#endif
+
float xdelta = float(source.pix.x) / float(max.x - min.x);
- for (int yCount = 0 ; yCount < numRows ; yCount++)
+ for (size_t yCount = 0 ; yCount < numRows ; yCount++)
{
const PIX *sRow = source.rowPtr(srcY >> 16) + (srcX1 >> 16);
- /*
+#if 0
bltScaleSpan(dRow, sRow, srcX1FracWithCount, stepAndDecCount,
stepWholePart);
- */
+#else
// XXX: WARNING SLOW CODE
float sPos = 0;
for(size_t x=0; x<pixelsPerRow; x++) {
dRow[x] = sRow[(size_t) sPos];
sPos += xdelta;
}
+#endif
srcY += ySrcDelta;
dRow += stride;
@@ -2520,13 +2508,12 @@
} // end Surface::createFractal
-
#if _MSC_VER > 1000
#pragma optimize( "", off )
#endif
void Surface::fire(int *dest, int xSize, int ySize)
{
-
+ printf ("Fire not implemented in gcc yet!\n");
// XXX no msvc assembler
#ifdef MSVC
_asm {
@@ -3022,7 +3009,6 @@
static void bltLightDarkSpan(int n, PIX *d, const BYTE *i, const PIX *s)
{
-
static int once = 0;
if (!once) {
@@ -3283,71 +3269,7 @@
PIX *d = dPtr;
PIX *s = sPtr;
int n = pixelsPerRow;
-#if 0
- while (n > 0 && int(d) & 3) {
- *d = saturateTable[int(*d) + int(*s)];
- ++d;
- ++s;
- --n;
- }
- // Do 4-byte chunks
-
- if (0 && n > 3) {
- // XXX no msvc assembler
-#ifdef MSVC
- _asm {
-
- // load vars into regs
-
- push ebp
- mov esi, sPtr
- mov edi, dPtr
- mov ebp, n
-
- xor ebx, ebx
- xor ecx, ecx
- quad:
-
- mov bl, [esi+2]
- mov cl, [edi+2]
-
- add esi, 4
- mov al, saturateTable[ebx + ecx]
-
- mov bl, [esi+3]
- mov cl, [edi+3]
-
- add edi, 4
- mov ah, saturateTable[ebx + ecx]
-
- shl eax, 16
- sub ebp, 4
-
- mov bl, [esi+0]
- mov cl, [edi+0]
-
- mov al, saturateTable[ebx + ecx]
-
- mov bl, [esi+1]
- mov cl, [edi+1]
-
- mov ah, saturateTable[ebx + ecx]
-
- mov [edi], eax
- ja quad
-
- // restore vars for the c code that cleans up
- mov eax, ebp
- pop ebp
- mov sPtr, esi
- mov dPtr, edi
- mov n, ebp
-
- }
-#endif
- }
-#endif
// Cleanup
while (n > 0) {
*d = saturateTable[int(*d) + int(*s)];
@@ -3941,6 +3863,7 @@
//--------------------------------------------------------------------------
void fireByte(BYTE *dest, int xSize, int ySize)
{
+ printf("no gcc version of fireByte yet.\n");
// XXX no msvc assembler
#ifdef MSVC
Index: netpanzer/src/Lib/Interfaces/UtilInterface.cpp
diff -u netpanzer/src/Lib/Interfaces/UtilInterface.cpp:1.7
netpanzer/src/Lib/Interfaces/UtilInterface.cpp:1.8
--- netpanzer/src/Lib/Interfaces/UtilInterface.cpp:1.7 Sun Sep 7 16:49:02 2003
+++ netpanzer/src/Lib/Interfaces/UtilInterface.cpp Thu Sep 11 13:35:46 2003
@@ -15,12 +15,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifdef WIN32
#include <config.h>
-#include <io.h>
-#else
+
#include <sys/stat.h>
-#endif
#include <string.h>
#include "SplitPath.hpp"
#include "FindFirst.hpp"
@@ -87,23 +84,11 @@
//---------------------------------------------------------------------------
DWORD UtilInterface::getFileSize(String filename)
{
-#ifdef WIN32
- struct _finddata_t myFile;
-
- // XXX small memory leak here
- if (_findfirst((const char *) filename, &myFile) == ((int*) -1))
- {
- return 0;
- }
-
- return myFile.size;
-#else
struct stat filestats;
if (stat(filename, &filestats) < 0)
return 0;
return (DWORD) filestats.st_size;
-#endif
} // end UtilInterface::getFileSize
// getNumFilesInDirectory
@@ -138,29 +123,8 @@
//---------------------------------------------------------------------------
void UtilInterface::deleteFile(String path)
{
-#ifdef WIN32
- struct _finddata_t myFile;
- int* hFile;
-
- char strBuf[256];
-
- if ((hFile = _findfirst((const char *) path, &myFile)) == ((int*) -1))
return;
- else
- {
- do
- {
- _splitpath(myFile.name, 0, 0, strBuf, 0);
-
- remove(strBuf);
-
- } while (_findnext(hFile, &myFile) == 0);
- }
-
- _findclose(hFile);
-#else
if (remove(path) < 0)
printf("Couldn't remove file '%s'.\n", (const char*) path);
-#endif
} // end UtilInterface::deleteFile
// checkFileError
@@ -181,6 +145,7 @@
#ifdef _DEBUG
srand(0);
return;
-#endif
+#else
srand((unsigned)time(0));
+#endif
} // end UtilInterface::startRandomNumberGenerator
Index: netpanzer/src/Lib/Particles/ParticleInterface.cpp
diff -u netpanzer/src/Lib/Particles/ParticleInterface.cpp:1.7
netpanzer/src/Lib/Particles/ParticleInterface.cpp:1.8
--- netpanzer/src/Lib/Particles/ParticleInterface.cpp:1.7 Wed Sep 10
08:32:51 2003
+++ netpanzer/src/Lib/Particles/ParticleInterface.cpp Thu Sep 11 13:35:46 2003
@@ -17,7 +17,6 @@
*/
#include <config.h>
-#include "KeyScanCodeDefs.h"
#include "ParticleInterface.hpp"
#include "PuffParticle2D.hpp"
#include "SmolderParticleSystem2D.hpp"
Index: netpanzer/src/Lib/View/cInputField.hpp
diff -u netpanzer/src/Lib/View/cInputField.hpp:1.3
netpanzer/src/Lib/View/cInputField.hpp:1.4
--- netpanzer/src/Lib/View/cInputField.hpp:1.3 Mon Sep 8 11:32:04 2003
+++ netpanzer/src/Lib/View/cInputField.hpp Thu Sep 11 13:35:46 2003
@@ -21,7 +21,6 @@
#include "iXY.hpp"
#include "iRect.hpp"
#include "Surface.hpp"
-#include "KeyScanCodeDefs.h"
//--------------------------------------------------------------------------
class cInputFieldString
Index: netpanzer/src/Lib/cMouse.hpp
diff -u netpanzer/src/Lib/cMouse.hpp:1.4 netpanzer/src/Lib/cMouse.hpp:1.5
--- netpanzer/src/Lib/cMouse.hpp:1.4 Sat Sep 6 06:34:28 2003
+++ netpanzer/src/Lib/cMouse.hpp Thu Sep 11 13:35:46 2003
@@ -18,12 +18,7 @@
#ifndef __cMouse_hpp__
#define __cMouse_hpp__
-#ifdef USE_SDL
#include <SDL.h>
-#endif
-#ifdef WIN32
-#include "Win32Mouse.hpp"
-#endif
#include "Surface.hpp"
#include "Surface.hpp"
@@ -52,16 +47,9 @@
static inline iXY getScreenPos ()
{
-#ifdef WIN32
- long mouse_x, mouse_y;
- Win32GetMousePos(&mouse_x, &mouse_y );
- return iXY(mouse_x, mouse_y);
-#endif
-#ifdef USE_SDL
int x, y;
SDL_GetMouseState(&x, &y);
return iXY(x, y);
-#endif
}
static inline int getScreenX ()
Index: netpanzer/src/Lib/cTimeStamp.cpp
diff -u netpanzer/src/Lib/cTimeStamp.cpp:1.4
netpanzer/src/Lib/cTimeStamp.cpp:1.5
--- netpanzer/src/Lib/cTimeStamp.cpp:1.4 Sat Sep 6 06:34:28 2003
+++ netpanzer/src/Lib/cTimeStamp.cpp Thu Sep 11 13:35:46 2003
@@ -15,14 +15,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#include <config.h>
-#include <time.h>
-#include <assert.h>
-#include "cTimeStamp.hpp"
-// the nicely simple SDL version:
-#ifdef USE_SDL
+#include "cTimeStamp.hpp"
void TIMESTAMP::calibrate()
{ }
@@ -32,124 +27,3 @@
return TIMESTAMP(SDL_GetTicks());
}
-#endif
-
-// XXX remove this mess when the SDL version is tested enough
-#ifdef WIN32
-//***************************************************************************
-// local data
-//***************************************************************************
-
-float timeElapsed;
-static bool calibrated = false;
-static long double ticksPerClock;
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// local fucntions
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef MSVC
-
-#if _MSC_VER > 1000
- #pragma optimize( "", off )
-#endif
-
-static __declspec( naked ) long double RDTSC()
- {
- _asm {
- _emit 0fh
- _emit 31h
- sub esp, 8
- mov [esp + 4], edx
- mov [esp], eax
- fild qword ptr [esp]
- add esp, 8
- ret
- }
- }
-#if _MSC_VER > 1000
- #pragma optimize( "", on )
-#endif
-
-#else
-
-// XXX Implement me
-#include <stdio.h>
-long double RDTSC()
-{
- printf ("RDTSC not implemented for gcc yet.\n");
- return 0;
-}
-
-#endif
-
-//***************************************************************************
-// global code
-//***************************************************************************
-
-// Old version
-//---------------------------------------------------------------------------
-TIMESTAMP now() {
- if (!calibrated) TIMESTAMP::calibrate();
- return TIMESTAMP(long( WinTimer::GetClock() * ticksPerClock));
-}
-
-//***************************************************************************
-// class TIMESTAMP member functions
-//***************************************************************************
-
-// Old version
-//---------------------------------------------------------------------------
-void TIMESTAMP::calibrate() {
- calibrated = false;
-
- // use calibration period of about 1/2 a second. Figure out the
nearest
- // number of low res clock ticks that fit into that amount of time.
- const unsigned goalLoResTicks = unsigned(CLOCKS_PER_SEC / 2.0);
- assert(goalLoResTicks > 2);
-
- clock_t startTimeLoRes, endTimeLoRes;
- long double elapsedHiRes;
-
- do {
-
- // Wait for the lo resolution clock to reach a tick boundary
- clock_t waitTimerValue = clock() + 1;
- do {
- startTimeLoRes = clock();
- } while (startTimeLoRes <= waitTimerValue);
-
- // Grab the current high resolution timer value
- long double startTimeHiRes = WinTimer::GetClock();
-
- // Figure out about when we want to stop timing.
- clock_t goalEndTimeLoRes = startTimeLoRes + goalLoResTicks;
-
- // Wait until the lo resolution timer times out
- do {
- endTimeLoRes = clock();
- } while (endTimeLoRes < goalEndTimeLoRes);
-
- // Calculate the number of elapsed hi res ticks
- elapsedHiRes = WinTimer::GetClock() - startTimeHiRes;
-
- // Since the timer tick counter could theoretically have
wrapped
- // in this short period of time, we check for this, and if it
- // did wrap, then we just do it again. (What are the odds of
this?)
- } while (elapsedHiRes <= 0.0);
-
- // Now determine exactly how long the calibration time was. (Will be
- // a multiple of the number of ticks per second. We can't assume
- // that the ending time will be equal to the ending time we
calculated.)
- clock_t elapsedTimeLoRes = endTimeLoRes - startTimeLoRes;
- long double calibrationTime = double(elapsedTimeLoRes) /
double(CLOCKS_PER_SEC);
-
- // Now calculate the calibration constant.
- ticksPerClock = (long double)WinTimer::TimerFrequency *
calibrationTime / elapsedHiRes;
-
- // We're calibrated!
- calibrated = true;
-}
-#endif
Index: netpanzer/src/Lib/cTimeStamp.hpp
diff -u netpanzer/src/Lib/cTimeStamp.hpp:1.3
netpanzer/src/Lib/cTimeStamp.hpp:1.4
--- netpanzer/src/Lib/cTimeStamp.hpp:1.3 Sat Sep 6 06:34:28 2003
+++ netpanzer/src/Lib/cTimeStamp.hpp Thu Sep 11 13:35:46 2003
@@ -18,12 +18,7 @@
#ifndef __cTimeStamp_hpp__
#define __cTimeStamp_hpp__
-#ifdef USE_SDL
#include <SDL.h>
-#endif
-#ifdef WIN32
-#include "WinTimer.hpp"
-#endif
////---------------------------------------------------------------------------
//// class TIMESTAMP defines a way to record a point in time. The actual value
@@ -36,12 +31,7 @@
//// use RTDSC, so it's as accurate as RESOLUTION.
class TIMESTAMP {
private:
-#ifdef WIN32
- typedef unsigned long Ticks;
-#endif
-#ifdef USE_SDL
typedef Uint32 Ticks;
-#endif
Ticks v; // ticks count
inline static double ticksToSecs(Ticks t)
Index: netpanzer/src/Makefile
diff -u netpanzer/src/Makefile:1.11 netpanzer/src/Makefile:1.12
--- netpanzer/src/Makefile:1.11 Mon Sep 8 08:12:18 2003
+++ netpanzer/src/Makefile Thu Sep 11 13:35:46 2003
@@ -2,6 +2,7 @@
DIRS = . Lib Lib/2D Lib/Environment Lib/Interfaces Lib/Particles \
Lib/PObject/Classes Lib/PObject/Templates Lib/Types Lib/View \
+ Lib/optionmm \
NetPanzer/Classes NetPanzer/Classes/Weapons \
NetPanzer/Classes/Network \
NetPanzer/Views/MainMenu NetPanzer/Views/MainMenu/Options \
@@ -10,27 +11,17 @@
NetPanzer/Classes/AI NetPanzer/Classes/Units \
NetPanzer/Interfaces NetPanzer/Structs \
NetPanzer/Core NetPanzer/Resources \
+ NetPanzer/Interfaces/unix UILib/SDL UILib/Network \
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 UILib/SDL UILib/Network \
- NetPanzer/Core/unix
GOAL = ../netpanzer
LINKFLAGS += -g3 `sdl-config --libs` -lSDL_net -lSDL_mixer
CFLAGS += `sdl-config --cflags` -DUNIX
-endif
-ifeq ($(SYSTEM),WIN32)
-DIRS += NetPanzer/Interfaces/win32 DirectX/DDraw DirectX/DirectInput \
- DirectX/DirectPlay DirectX/DirectSound \
- Win32 Win32/Winsock
-GOAL = ../netpanzer.exe
-CFLAGS += -DWIN32 -Iw32api -D_DEBUG -Wno-unknown-pragmas
-LINKFLAGS += -lgdi32 -lshell32 -lddraw -ldinput -ldplayx -ldsound -lws2_32
-ldsetup -lwinmm -ldxguid -lole32
-endif
+
ifeq ($(PROFILING),yes)
CFLAGS += -pg
LINKFLAGS += -pg
Index: netpanzer/src/NetPanzer/Classes/KeyBinder.hpp
diff -u netpanzer/src/NetPanzer/Classes/KeyBinder.hpp:1.4
netpanzer/src/NetPanzer/Classes/KeyBinder.hpp:1.5
--- netpanzer/src/NetPanzer/Classes/KeyBinder.hpp:1.4 Wed Sep 10 08:03:17 2003
+++ netpanzer/src/NetPanzer/Classes/KeyBinder.hpp Thu Sep 11 13:35:47 2003
@@ -19,7 +19,6 @@
#define _KEYBINDER_HPP
#include "ArrayGrowableTemplate.hpp"
-#include "KeyScanCodeDefs.h"
class KeyBinderElement
{
Index: netpanzer/src/NetPanzer/Classes/TileSet.cpp
diff -u netpanzer/src/NetPanzer/Classes/TileSet.cpp:1.4
netpanzer/src/NetPanzer/Classes/TileSet.cpp:1.5
--- netpanzer/src/NetPanzer/Classes/TileSet.cpp:1.4 Mon Sep 8 08:12:19 2003
+++ netpanzer/src/NetPanzer/Classes/TileSet.cpp Thu Sep 11 13:35:47 2003
@@ -16,14 +16,15 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "TileSet.hpp"
-//#include <io.h>
+
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
-#ifdef UNIX
-// XXX for the read function
+
+// for read below :-/
#include <unistd.h>
-#endif
+
+#include "Exception.hpp"
#include "Gdatstct.hpp"
TileSet::TileSet( )
@@ -33,7 +34,6 @@
tile_set_loaded = false;
tile_count = 0;
}
-
void TileSet::computeTileConsts( void )
{
@@ -159,19 +159,14 @@
void TileSet::loadTileSet( const char *file_path, WadMapTable &mapping_table )
{
- //FILE *infile;
+ FILE *infile;
unsigned long tile_buffer_size;
unsigned long tile_size;
- int fhandle;
-
- // XXX Why, oh why are't we using normal stdio functions here?
- //infile = fopen( file_path, "rb" );
- // XXX changed _O_BINARY to 0...
- fhandle = open( file_path, 0 );
+ infile = fopen( file_path, "rb" );
+ if(infile == 0)
+ throw Exception("Couldn't load tileset.");
- //assert( infile != 0 );
-
if ( tile_set_loaded == true )
{
if ( tile_data != 0 )
@@ -190,8 +185,7 @@
}
// ** Read Header Info **
- //fread( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1, infile );
- read( fhandle, &tile_set_info, sizeof(TILE_DBASE_HEADER ) );
+ fread( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1, infile );
// ** Read in Tile Info **
tile_info = new TILE_HEADER [ mapping_table.used_tile_count ];
@@ -210,14 +204,12 @@
{
if ( mapping_table[ tile_index ].is_used == true )
{
- read( fhandle, (tile_info + mapped_index), sizeof ( TILE_HEADER ) );
- //fread( (tile_info + mapped_index), sizeof ( TILE_HEADER ), 1,
infile );
+ fread( (tile_info + mapped_index), sizeof ( TILE_HEADER ), 1, infile
);
mapped_index++;
}
else
{
- lseek( fhandle, sizeof( TILE_HEADER ), SEEK_CUR );
- //fseek( infile, sizeof( TILE_HEADER ), SEEK_CUR );
+ fseek( infile, sizeof( TILE_HEADER ), SEEK_CUR );
}
}
@@ -247,8 +239,7 @@
{
if (unused_tile_count != 0)
{
- lseek( fhandle, tile_size * unused_tile_count, SEEK_CUR );
- //fseek( infile, tile_size * unused_tile_count, SEEK_CUR );
+ fseek( infile, tile_size * unused_tile_count, SEEK_CUR );
}
while( (tile_index < tile_count) && (mapping_table[ tile_index
].is_used == true) )
@@ -259,8 +250,7 @@
if (used_tile_count != 0)
{
- read( fhandle, (tile_data + (mapped_index*tile_size)), tile_size *
used_tile_count );
- //fread( (tile_data + (mapped_index*tile_size)), tile_size ,
used_tile_count, infile );
+ fread( (tile_data + (mapped_index*tile_size)), tile_size ,
used_tile_count, infile );
mapped_index += used_tile_count;
}
@@ -269,27 +259,22 @@
}
- close(fhandle );
- //fclose( infile );
+ fclose( infile );
tile_set_loaded = true;
TileSet::tile_count = mapping_table.used_tile_count;
computeTileConsts();
-
}
void TileSet::loadTileSetInfo( const char *file_path, WadMapTable
&mapping_table )
{
- //FILE *infile;
- int fhandle;
+ FILE *infile;
- //infile = fopen( file_path, "rb" );
- // XXX changed _O_BINARY to 0
- fhandle = open( file_path, 0);
+ infile = fopen( file_path, "rb" );
+ if(infile == 0)
+ throw Exception("Unable to load tilesetinfo.");
- //assert( infile != 0 );
-
if ( tile_set_loaded == true )
{
if ( tile_data != 0 )
@@ -308,8 +293,7 @@
}
// ** Read Header Info **
- //fread( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1, infile );
- read( fhandle, &tile_set_info, sizeof(TILE_DBASE_HEADER ) );
+ fread( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1, infile );
// ** Read in Tile Info **
tile_info = new TILE_HEADER [ mapping_table.used_tile_count ];
@@ -325,19 +309,16 @@
{
if ( mapping_table[ tile_index ].is_used == true )
{
- read( fhandle, (tile_info + mapped_index), sizeof ( TILE_HEADER ) );
- //fread( (tile_info + mapped_index), sizeof ( TILE_HEADER ), 1,
infile );
+ fread( (tile_info + mapped_index), sizeof ( TILE_HEADER ), 1, infile
);
mapped_index++;
}
else
{
- lseek( fhandle, sizeof( TILE_HEADER ), SEEK_CUR );
- //fseek( infile, sizeof( TILE_HEADER ), SEEK_CUR );
+ fseek( infile, sizeof( TILE_HEADER ), SEEK_CUR );
}
}
- close(fhandle );
- //fclose( infile );
+ fclose( infile );
tile_set_loaded = true;
TileSet::tile_count = mapping_table.used_tile_count;
Index: netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp
diff -u netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.10
netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.11
--- netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.10 Wed Sep
10 08:32:53 2003
+++ netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp Thu Sep 11
13:35:47 2003
@@ -20,7 +20,6 @@
#include "MouseInterface.hpp"
#include "KeyboardInterface.hpp"
-#include "KeyScanCodeDefs.h"
#include "WorldViewInterface.hpp"
#include "MapInterface.hpp"
Index: netpanzer/src/NetPanzer/Core/main.cpp
diff -u netpanzer/src/NetPanzer/Core/main.cpp:1.1
netpanzer/src/NetPanzer/Core/main.cpp:1.2
--- netpanzer/src/NetPanzer/Core/main.cpp:1.1 Thu Sep 11 11:12:14 2003
+++ netpanzer/src/NetPanzer/Core/main.cpp Thu Sep 11 13:35:47 2003
@@ -21,51 +21,15 @@
#include <time.h>
#include <SDL.h>
+#include <optionmm/command_line.hpp>
+
#include "Log.hpp"
+#include "Exception.hpp"
#include "GameManager.hpp"
#include "MouseInterface.hpp"
#include "KeyboardInterface.hpp"
#include "cMouse.hpp"
-bool HandleSDLEvents();
-
-int main(int argc, char** argv)
-{
- SDL_Init(SDL_INIT_TIMER);
- SDL_EnableUNICODE(1);
- srand(time(0));
-#ifdef __USE_SVID
- // the STL functions seem to use the 48er versions of the random
generator
- srand48(time(0));
-#endif
-
- LOG( ("Starting GameManager initialisation.") );
- // XXX hacky hack... needs changes in GameManager I think...
- const char* commandline = argc > 1 ? argv[1] : "";
- if (!GameManager::initialize(commandline)) {
- fprintf(stderr, "Couldn't initialize the game.\n");
- exit(1);
- }
- LOG( ("Initialisation succeeded.") );
-
- while(1) {
- SDL_PumpEvents();
- GameManager::mainLoop();
-
- if(HandleSDLEvents() == true) {
- LOG( ("quitting main loop.") );
- break;
- }
- }
-
- GameManager::shutdown();
- LOG ( ("successfull shutdown.") );
-
- SDL_Quit();
-
- return 0;
-}
-
/** This functions iterates throgh the SDL event queue.
* It returns true if a quit message has been received, otherwise false.
*/
@@ -137,4 +101,72 @@
return false;
}
+
+//---------------------------------------------------------------------------
+
+int main(int argc, char** argv)
+{
+ using namespace optionmm;
+ command_line commandline(PACKAGE_NAME, PACKAGE_VERSION,
+ "Copyright(c) 1998 Pyrosoft Inc. and others", "", argc,
argv);
+
+ option<bool, false, false> dedicated_option('d', "dedicated",
+ "run as dedicated
server", false);
+ commandline.add(&dedicated_option);
+ option<int> port_option('p', "port", "run server on specific
port", 0);
+ commandline.add(&port_option);
+
+ if(!commandline.process() || commandline.help() ||
commandline.version())
+ return 0;
+
+ SDL_Init(SDL_INIT_TIMER);
+ SDL_EnableUNICODE(1);
+
+ srand(time(0));
+ // the STL functions in gcc3 seem to use the 48er versions of the random
+ // generator instead of the default libc one, so we have todo a double
srand
+ // :-/
+#ifdef __USE_SVID
+ srand48(time(0));
+#endif
+
+ try {
+ GameManager::initialize(dedicated_option.value());
+ } catch(Exception e) {
+ fprintf(stderr, "Couldn't initialize the game: %s\n",
e.getMessage());
+ SDL_Quit();
+ exit(1);
+ }
+
+ // we'll catch every exception here, just to be sure the user gets at
least
+ // a usefull error message and SDL has a chance to shutdown...
+ try {
+ while(1) {
+ SDL_PumpEvents();
+ if(HandleSDLEvents() == true) {
+ LOG( ("quitting main loop.") );
+ break;
+ }
+
+ GameManager::mainLoop();
+ }
+
+ GameManager::shutdown();
+ LOG ( ("successfull shutdown.") );
+ SDL_Quit();
+
+ } catch(Exception e) {
+ fprintf(stderr, "An unexpected exception occured: %s\nShutdown
needed.",
+ e.getMessage());
+ SDL_Quit();
+ throw;
+ } catch(...) {
+ fprintf(stderr, "An unexpected exception occured.\nShutdown
needed.");
+ SDL_Quit();
+ throw;
+ }
+
+ return 0;
+}
+
Index: netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.7
netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.8
--- netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.7 Wed Sep 10
08:32:54 2003
+++ netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp Thu Sep 11
13:35:47 2003
@@ -17,7 +17,6 @@
*/
#include <config.h>
#include "ConsoleInterface.hpp"
-#include "KeyScanCodeDefs.h"
#include "GameConfig.hpp"
//GameConfig::getConsoleTextColor()
Index: netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp:1.2
netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp:1.3
--- netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp:1.2 Mon Sep
1 16:24:20 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameControlRulesDaemon.hpp Thu Sep
11 13:35:47 2003
@@ -22,36 +22,33 @@
#include "NetPacket.hpp"
class GameControlRulesDaemon
- {
- protected:
-
- static int map_cycle_fsm_server_state;
- static Timer map_cycle_fsm_server_endgame_timer;
- static Timer map_cycle_fsm_server_map_load_timer;
- static void mapCycleFsmServer( void );
+{
+protected:
+ static int map_cycle_fsm_server_state;
+ static Timer map_cycle_fsm_server_endgame_timer;
+ static Timer map_cycle_fsm_server_map_load_timer;
+ static void mapCycleFsmServer();
- static int map_cycle_fsm_client_state;
- static char map_cycle_fsm_client_map_name[256];
- static bool map_cycle_fsm_client_respawn_ack_flag;
- static void mapCycleFsmClient( void );
+ static int map_cycle_fsm_client_state;
+ static char map_cycle_fsm_client_map_name[256];
+ static bool map_cycle_fsm_client_respawn_ack_flag;
+ static void mapCycleFsmClient();
- static void onTimelimitGameCompleted( void );
- static void onFraglimitGameCompleted( void );
- static void onObjectiveGameCompleted( void );
+ static void onTimelimitGameCompleted();
+ static void onFraglimitGameCompleted();
+ static void onObjectiveGameCompleted();
- static void checkGameRules( void );
+ static void checkGameRules();
- static void mapLoadFailureResponse( int result_code, char *map_name );
+ static void mapLoadFailureResponse( int result_code, char *map_name );
- static void netMessageCycleMap( NetMessage *message );
- static void netMessageCycleRespawnAck( NetMessage *message );
+ static void netMessageCycleMap(NetMessage *message);
+ static void netMessageCycleRespawnAck(NetMessage *message);
- public:
-
- static void processNetMessage( NetMessage *message );
- static void forceMapCycle( void );
- static void updateGameControlFlow( void );
-
- };
+public:
+ static void processNetMessage(NetMessage *message);
+ static void forceMapCycle();
+ static void updateGameControlFlow();
+};
#endif // ** _GAME_CONTROL_RULES_DAEMON_HPP
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.33
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.34
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.33 Wed Sep 10
08:46:56 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp Thu Sep 11 13:35:47 2003
@@ -20,36 +20,14 @@
#include <stdio.h>
#include <fcntl.h>
-#ifdef WIN32
-#include <io.h>
-#include <conio.h>
-#include <windows.h>
-#endif
-// ** Direct X Includes
-#ifdef WIN32
-#include "DirectDrawGlobals.hpp"
-#include "DirectInput.hpp"
-#include "DSound.hpp"
-#endif
-#ifdef UNIX
+#include "UILib/UIDraw.hpp"
+#include "UILib/Sound.hpp"
#include "UILib/SDL/SDLSound.hpp"
-#endif
+#include "UILib/SDL/SDLDraw.hpp"
#include "UILib/DummySound.hpp"
-
-#ifdef WIN32
-#include "NetworkServerWinSock.hpp"
-#include "NetworkClientWinSock.hpp"
-//#include "NetworkServerDPlay.hpp"
-//#include "NetworkClientDPlay.hpp"
-#endif
-#ifdef UNIX
#include "NetworkServerUnix.hpp"
#include "NetworkClientUnix.hpp"
-#endif
-
-#include "UILib/UIDraw.hpp"
-#include "UILib/Sound.hpp"
// ** PObject netPanzer Network Includes
#include "Server.hpp"
@@ -67,7 +45,6 @@
#include "KeyboardInterface.hpp"
#include "KeyBinder.hpp"
#include "KeyActionEnum.hpp"
-#include "KeyScanCodeDefs.h"
#include "DDHardSurface.hpp"
#include "GameConfig.hpp"
#include "TileInterface.hpp"
@@ -177,13 +154,10 @@
// ******************************************************************
void GameManager::initializeVideoSubSystem()
-{
- LOG( ( "Initializing Direct Draw" ) );
- if( ( Screen->initialize() ) == false )
- throw Exception("DDraw.Intialize failed.");
-
- LOG( ( "Setting Default Video Sub-system" ) );
-
+{
+ LOG( ( "Initializing video mode" ) );
+ Screen = new SDLDraw();
+
current_video_mode_res = iXY(640,480);
// don't go fullscreen for now
setVideoMode(current_video_mode_res, false);
@@ -192,7 +166,8 @@
void GameManager::shutdownVideoSubSystem()
{
- Screen->shutdown();
+ delete Screen;
+ Screen = 0;
}
// ******************************************************************
@@ -203,13 +178,13 @@
sound = new DummySound();
return;
}
-#ifdef WIN32
- sound = new DirectSound();
-#endif
-#ifdef USE_SDL
LOG( ("Initialize sound system.") );
- sound = new SDLSound();
-#endif
+ try {
+ sound = new SDLSound();
+ } catch(Exception e) {
+ LOG( ("Couldn't initialize sound: %s", e.getMessage()) );
+ sound = new DummySound();
+ }
// start some music
sound->playMusic("sfx/music/");
@@ -438,22 +413,6 @@
// ******************************************************************
void GameManager::initializeInputDevices()
{
-#ifdef WIN32
- LOG( ( "Initializing Direct Input\n" ) );
- if ( DirectInput::initialize() == false )
- throw Exception("DirectInput failed to intialize.");
-
- LOG( ("Initializing Direct Keyboard Input") );
- // XXX commented out, since the main window isn't hidden as intended...
I
- // dunno why. If a key is pressed in the main window, then we need a
defined
- // DirectInput Handler.
- if( execution_mode == _execution_mode_loop_back_server)
- {
- if ( DirectInput::initializeDirectKeyboard() == false )
- throw Exception("failed to initialize
DirectKeyboard.");
- }
-#endif
-
setupKeyboardBindings();
MouseInterface::initialize();
@@ -462,9 +421,6 @@
void GameManager::shutdownInputDevices()
{
-#ifdef WIN32
- DirectInput::shutdown();
-#endif
}
// ******************************************************************
@@ -490,37 +446,19 @@
// ******************************************************************
void GameManager::initializeDedicatedConsole()
{
-#ifdef MSVC
- ShowWindow(gapp.hwndApp, SW_HIDE);
- if( AllocConsole() == 0 )
- throw Exception("couldn't allocate a console.");
-
- freopen( "CONOUT$", "a+t", stdout );
- freopen( "CONIN$", "a+t", stdin );
-#endif
-
ConsoleInterface::setStdoutPipe(true);
}
// ******************************************************************
void GameManager::shutdownDedicatedConsole()
{
-#ifdef MSVC
- FreeConsole();
-#endif
}
// ******************************************************************
void GameManager::initializeNetworkSubSystem()
{
-#ifdef WIN32
- SERVER = new NetworkServerWinSock();
- CLIENT = new NetworkClientWinSock();
-#endif
-#ifdef UNIX
SERVER = new NetworkServerUnix();
CLIENT = new NetworkClientUnix();
-#endif
ServerMessageRouter::initialize();
ClientMessageRouter::initialize();
@@ -983,32 +921,20 @@
}
// ******************************************************************
-bool GameManager::initialize( const char *command_line )
+void GameManager::initialize(bool dedicated)
{
- char work_str[256];
- char *token;
- strcpy( work_str, command_line );
-
- token = strtok( work_str, " " );
-
- if ( token != 0 )
- {
- if ( strcasecmp( token, "-dedicated" ) == 0 )
- {
- execution_mode = _execution_mode_dedicated_server;
- return( dedicatedBootStrap() );
- }
-
- execution_mode = _execution_mode_loop_back_server;
- return( bootStrap() );
+ if(dedicated) {
+ execution_mode = _execution_mode_dedicated_server;
+ dedicatedBootStrap();
+ return;
}
execution_mode = _execution_mode_loop_back_server;
- return( bootStrap() );
+ bootStrap();
}
// ******************************************************************
-bool GameManager::bootStrap()
+void GameManager::bootStrap()
{
try {
initializeSoundSubSystem();
@@ -1020,20 +946,14 @@
initializeNetworkSubSystem();
initializeInputDevices();
} catch(Exception e) {
-#ifdef WIN32
- MessageBox(gapp.hwndApp, e.getMessage(), "Netpanzer", MB_OK);
-#else
fprintf(stderr, "Initialisation failed:\n%s\n", e.getMessage());
-#endif
shutdown();
- return false;
+ throw Exception("bootstrap failed.");
}
-
- return true;
}
// ******************************************************************
-bool GameManager::dedicatedBootStrap()
+void GameManager::dedicatedBootStrap()
{
try {
initializeSoundSubSystem(); // we load a dummy sound driver
@@ -1043,20 +963,13 @@
initializeNetworkSubSystem();
initializeInputDevices();
initializeDedicatedConsole();
- } catch(Exception e) {
- fprintf(stderr, "Initialisation failed:\n%s\n", e.getMessage());
- dedicatedShutdown();
- return false;
- }
-
- try {
+
launchDedicatedServer();
} catch(Exception e) {
- fprintf(stderr, "Serverlaunch failed :\n%s\n", e.getMessage());
+ fprintf(stderr, "Initialisation failed:\n%s\n", e.getMessage());
dedicatedShutdown();
- return false;
+ throw Exception("bootstrap failed.");
}
- return true;
}
// ******************************************************************
@@ -1841,22 +1754,14 @@
// ******************************************************************
void GameManager::exitNetPanzer()
{
-#if 0
- // XXX
- // NOTE: Hack
- sound->StopTankIdle();
-#endif
+ // NOTE: Hack
+ sound->StopTankIdle();
- quitNetPanzerGame();
+ quitNetPanzerGame();
-#ifdef WIN32
- PostMessage(gapp.hwndApp, WM_CLOSE, 0, 0);
-#endif
-#ifdef USE_SDL
- SDL_Event event;
+ SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
-#endif
}
@@ -1941,8 +1846,6 @@
// ******************************************************************
void GameManager::inputLoop()
{
- //KeyboardInterface::sampleKeyboard();
-
processSystemKeys();
Desktop::manage(mouse.getScreenPos().x, mouse.getScreenPos().y,
mouse.getButtonMask() );
@@ -2039,10 +1942,9 @@
// ******************************************************************
void GameManager::dedicatedInputLoop()
- {
- KeyboardInterface::sampleKeyboard();
-
- // XXX we need SDL code here
+{
+ // XXX we need new code here (someone wanna write a readline version of this
+ // stuff?
#ifdef WIN32
if( kbhit() )
{
@@ -2105,22 +2007,21 @@
} // ** switch
}
}
-#endif
-
- }
+#endif
+}
-void GameManager::startGameTimer()
- {
- game_elapsed_time_offset = 0;
- time( &game_start_time );
- }
+void GameManager::startGameTimer()
+{
+ game_elapsed_time_offset = 0;
+ time( &game_start_time );
+}
time_t GameManager::getGameTime()
- {
- time_t current_time;
+{
+ time_t current_time;
- time( ¤t_time );
+ time( ¤t_time );
- return( (current_time - game_start_time) + game_elapsed_time_offset );
- }
+ return( (current_time - game_start_time) + game_elapsed_time_offset );
+}
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.6
netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/GameManager.hpp:1.6 Wed Sep 10
08:32:54 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.hpp Thu Sep 11 13:35:47 2003
@@ -89,8 +89,8 @@
static void shutdownDedicatedConsole();
// boots up netPanzer; initializes all subsystems, game objects etc.
- static bool bootStrap();
- static bool dedicatedBootStrap();
+ static void bootStrap();
+ static void dedicatedBootStrap();
static void shutdownSubSystems();
static void dedicatedShutdown();
@@ -156,7 +156,10 @@
public:
static void shutdown();
- static bool initialize( const char *command_line );
+ /** Initialises the GameManager, only initialize the core parts needed
for a
+ * dedicated server if dedicated = true
+ */
+ static void initialize(bool dedicated = false);
static void mainLoop();
Index: netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.cpp:1.5
netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.cpp:1.6
--- netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.cpp:1.5 Mon Sep
8 11:32:04 2003
+++ netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.cpp Thu Sep 11
13:35:47 2003
@@ -17,11 +17,6 @@
*/
#include <config.h>
-#ifdef WIN32
-#include <windows.h>
-#include "DirectInput.hpp"
-#endif
-
#include "KeyboardInterface.hpp"
bool KeyboardInterface::key_table[SDLK_LAST];
@@ -34,9 +29,6 @@
void KeyboardInterface::sampleKeyboard()
{
memcpy(previous_key_state, key_table, sizeof(key_table));
-#ifdef WIN32
- DirectInput::getKeyboardState(key_table);
-#endif
}
void KeyboardInterface::keyPressed(int scancode) {
@@ -49,9 +41,8 @@
bool KeyboardInterface::getKeyPressed(int scanCode)
{
- if (
- KeyboardInterface::getKeyState(scanCode) == true &&
- KeyboardInterface::getPrevKeyState(scanCode) == false)
+ if (KeyboardInterface::getKeyState(scanCode) == true &&
+ KeyboardInterface::getPrevKeyState(scanCode) == false)
return true;
return false;
Index: netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.hpp:1.4
netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.hpp:1.5
--- netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.hpp:1.4 Mon Sep
8 11:32:04 2003
+++ netpanzer/src/NetPanzer/Interfaces/KeyboardInterface.hpp Thu Sep 11
13:35:47 2003
@@ -77,16 +77,7 @@
{
char_buffer[ (char_buffer_rear + 1) & _CHAR_BUFFER_MOD ] = c;
char_buffer_rear = (char_buffer_rear + 1) & _CHAR_BUFFER_MOD;
- }
-
- static inline void putChar(int c, int times)
- {
- while( times != 0 )
- {
- char_buffer[ (char_buffer_rear + 1) & _CHAR_BUFFER_MOD ] = c;
- char_buffer_rear = (char_buffer_rear + 1) & _CHAR_BUFFER_MOD;
- times--;
- }
+ printf("putch: %c\n", c);
}
};
Index: netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.6
netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.6 Sat Sep 6
11:39:25 2003
+++ netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp Thu Sep 11 13:35:47 2003
@@ -16,9 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
-#ifdef WIN32
-#include <io.h>
-#endif
+
#include <stdio.h>
#include <string.h>
#include "FindFirst.hpp"
Index: netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp:1.7
netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp:1.8
--- netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp:1.7 Wed Sep 10
08:32:54 2003
+++ netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp Thu Sep 11
13:35:47 2003
@@ -16,13 +16,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
-#ifdef WIN32
-#include <windows.h>
-#include "Win32Mouse.hpp"
-#endif
-#ifdef USE_SDL
+
#include <SDL.h>
-#endif
#include "MouseInterface.hpp"
#include "DDHardSurface.hpp"
@@ -365,17 +360,9 @@
void MouseInterface::updateCursor()
{
-#ifdef WIN32
- long x_pos, y_pos;
- Win32GetMousePos( &x_pos, &y_pos );
- mouse_pos.x = x_pos;
- mouse_pos.y = y_pos;
-#endif
-#ifdef USE_SDL
int x, y;
SDL_GetMouseState(&x, &y);
mouse_pos.x = x;
mouse_pos.y = y;
-#endif
}
Index: netpanzer/src/UILib/SDL/SDLDraw.cpp
diff -u netpanzer/src/UILib/SDL/SDLDraw.cpp:1.11
netpanzer/src/UILib/SDL/SDLDraw.cpp:1.12
--- netpanzer/src/UILib/SDL/SDLDraw.cpp:1.11 Wed Sep 10 07:26:12 2003
+++ netpanzer/src/UILib/SDL/SDLDraw.cpp Thu Sep 11 13:35:47 2003
@@ -29,15 +29,6 @@
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
-bool SDLDraw::initialize()
-{
- return true;
-}
-
-void SDLDraw::shutdown()
-{
-}
-
bool SDLDraw::setVideoMode(DWORD width, DWORD height, DWORD bpp, bool
fullscreen)
{
Uint32 flags = 0;
Index: netpanzer/src/UILib/SDL/SDLDraw.hpp
diff -u netpanzer/src/UILib/SDL/SDLDraw.hpp:1.4
netpanzer/src/UILib/SDL/SDLDraw.hpp:1.5
--- netpanzer/src/UILib/SDL/SDLDraw.hpp:1.4 Mon Sep 8 11:32:05 2003
+++ netpanzer/src/UILib/SDL/SDLDraw.hpp Thu Sep 11 13:35:47 2003
@@ -34,8 +34,6 @@
SDLDraw();
virtual ~SDLDraw();
- bool initialize();
- void shutdown();
bool setVideoMode(DWORD width, DWORD height, DWORD bpp, bool
fullscreen);
bool isDisplayModeAvailable(int width, int height, int bpp);
bool lockDoubleBuffer(BYTE **DoubleBuffer);
Index: netpanzer/src/UILib/UIDraw.cpp
diff -u netpanzer/src/UILib/UIDraw.cpp:1.4 netpanzer/src/UILib/UIDraw.cpp:1.5
--- netpanzer/src/UILib/UIDraw.cpp:1.4 Sat Sep 6 07:04:15 2003
+++ netpanzer/src/UILib/UIDraw.cpp Thu Sep 11 13:35:47 2003
@@ -19,16 +19,6 @@
#include "UIDraw.hpp"
-#ifdef USE_SDL
-#include "SDL/SDLDraw.hpp"
+UIDraw *Screen = 0;
-UIDraw *Screen = new SDLDraw();
-#endif
-
-#ifdef WIN32
-#include "DirectDraw.hpp"
-#include "DirectDrawGlobals.hpp"
-
-UIDraw *Screen = new DirectDraw();
-#endif
Index: netpanzer/src/UILib/UIDraw.hpp
diff -u netpanzer/src/UILib/UIDraw.hpp:1.9 netpanzer/src/UILib/UIDraw.hpp:1.10
--- netpanzer/src/UILib/UIDraw.hpp:1.9 Wed Sep 10 07:26:12 2003
+++ netpanzer/src/UILib/UIDraw.hpp Thu Sep 11 13:35:47 2003
@@ -32,8 +32,6 @@
virtual ~UIDraw()
{ }
- virtual bool initialize() = 0;
- virtual void shutdown() = 0;
virtual bool setVideoMode(DWORD width, DWORD height, DWORD bpp, bool
fullscreen) = 0;
virtual bool isDisplayModeAvailable(int width, int height, int bpp) = 0;
virtual bool lockDoubleBuffer(unsigned char **DoubleBuffer) = 0;
Index: netpanzer/src/config.h
diff -u netpanzer/src/config.h:1.5 netpanzer/src/config.h:1.6
--- netpanzer/src/config.h:1.5 Sat Sep 6 11:18:18 2003
+++ netpanzer/src/config.h Thu Sep 11 13:35:46 2003
@@ -1,11 +1,9 @@
// Config file, this should be autogenerated by autoconf later...
-
#ifdef MSVC
#define __attrib__(x)
#endif
-#ifdef UNIX
-#define USE_SDL
-#endif
-
#define DO_LOGGING
+
+#define PACKAGE_NAME "netpanzer"
+#define PACKAGE_VERSION "0.1"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer/src ChangeLog Makefile config.h Lib/c...,
Matthias Braun <=