Added Screenshot code.
Moved some net stuff around.
This commit is contained in:
parent
219ab378d7
commit
b4a55b2618
14 changed files with 297 additions and 258 deletions
2
Makefile
2
Makefile
|
@ -20,7 +20,7 @@ LDLIBS = -L/usr/X11R6/lib -lX11 -lXext -lGL `sdl-config --libs` -lopenal
|
|||
|
||||
AFLAGS = -g -w+macro-params -w+orphan-labels -w+number-overflow
|
||||
|
||||
ROOT = main.c mathline.c math.asm render.c opengl.c menus.c openal.c winapi.c stubs.c frustum.c kshape.c map.c maths.c md5.c mem3dc.c mem3dcpp.cpp module.c morph.c object.c shpanim.c sphere.c tables.c vdb.c version.c
|
||||
ROOT = main.c mathline.c math.asm render.c opengl.c net.c menus.c openal.c winapi.c stubs.c frustum.c kshape.c map.c maths.c md5.c mem3dc.c mem3dcpp.cpp module.c morph.c object.c shpanim.c sphere.c tables.c vdb.c version.c
|
||||
AVP = ai_sight.c avpview.c bh_agun.c bh_ais.c bh_alien.c bh_binsw.c bh_cable.c bh_corpse.c bh_deathvol.c bh_debri.c bh_dummy.c bh_fan.c bh_far.c bh_fhug.c bh_gener.c bh_ldoor.c bh_lift.c bh_light.c bh_lnksw.c bh_ltfx.c bh_marin.c bh_mission.c bh_near.c bh_pargen.c bh_plachier.c bh_plift.c bh_pred.c bh_queen.c bh_rubberduck.c bh_selfdest.c bh_snds.c bh_spcl.c bh_swdor.c bh_track.c bh_types.c bh_videoscreen.c bh_waypt.c bh_weap.c bh_xeno.c bonusabilities.c cconvars.cpp cdtrackselection.cpp cheatmodes.c comp_map.c comp_shp.c consolelog.cpp davehook.cpp deaths.c decal.c detaillevels.c dynamics.c dynblock.c equipmnt.c equiputl.cpp extents.c game.c game_statistics.c gamecmds.cpp gamevars.cpp hmodel.c hud.c inventry.c language.c lighting.c load_shp.c los.c maps.c mempool.c messagehistory.c missions.cpp movement.c paintball.c particle.c pfarlocs.c pheromon.c player.c pmove.c psnd.c psndproj.c pvisible.c savegame.c scream.cpp secstats.c sfx.c stratdef.c targeting.c track.c triggers.c weapons.c
|
||||
SHAPES = cube.c
|
||||
SUPPORT = consbind.cpp consbtch.cpp coordstr.cpp daemon.cpp indexfnt.cpp r2base.cpp r2pos666.cpp reflist.cpp refobj.cpp rentrntq.cpp scstring.cpp strtab.cpp strutil.c trig666.cpp wrapstr.cpp
|
||||
|
|
1
README
1
README
|
@ -75,6 +75,7 @@ language.txt (Regular Ed.) or aenglish.txt (Alien Demo).
|
|||
Linux Port-specific commands:
|
||||
- ALT-ENTER for fullscreen
|
||||
- CTRL-G for mouse grab
|
||||
- PRTSCN for screenshot
|
||||
|
||||
|
||||
The source code that was released only works with Aliens vs Predator Gold.
|
||||
|
|
|
@ -114,4 +114,4 @@ extern int NumFixedDecals;
|
|||
extern int CurrentFixedDecalIndex;
|
||||
|
||||
#define MAX_NO_OF_DECALS_PER_HIERARCHICAL_SECTION 16
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -198,4 +198,4 @@ extern void MakeElectricalExplosion(VECTORCH *positionPtr);
|
|||
#define MAX_NO_OF_BLOOD_PARTICLES 500
|
||||
extern int NumberOfBloodParticles;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -296,4 +296,4 @@ extern STRATEGYBLOCK *ActiveStBlockList[];
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "detaillevels.h"
|
||||
#include "cd_player.h"
|
||||
|
||||
#define MPLAYER_SUPPORT 1
|
||||
#define MPLAYER_SUPPORT 0
|
||||
|
||||
|
||||
#define MAX_MULTIPLAYER_NAME_LENGTH 10
|
||||
|
|
|
@ -48,184 +48,11 @@
|
|||
#define DB_LEVEL 3
|
||||
#include "db.h"
|
||||
|
||||
|
||||
/* This is stuff I added to get this file to compile for the Linux port */
|
||||
#include <ctype.h>
|
||||
|
||||
DPID AVPDPNetID;
|
||||
int QuickStartMultiplayer=1;
|
||||
|
||||
typedef struct DPNAME
|
||||
{
|
||||
int dwSize;
|
||||
|
||||
char *lpszShortNameA;
|
||||
char *lpszLongNameA;
|
||||
} DPNAME;
|
||||
DPNAME AVPDPplayerName;
|
||||
|
||||
#define DP_OK 0
|
||||
|
||||
typedef int HRESULT;
|
||||
|
||||
int glpDP; /* directplay object */
|
||||
|
||||
#define DPRECEIVE_ALL 1
|
||||
#define DPSYS_ADDPLAYERTOGROUP 2
|
||||
#define DPSYS_CREATEPLAYERORGROUP 3
|
||||
#define DPPLAYERTYPE_PLAYER 4
|
||||
#define DPSYS_DELETEPLAYERFROMGROUP 5
|
||||
#define DPSYS_HOST 6
|
||||
#define DPSYS_SESSIONLOST 7
|
||||
#define DPSYS_SETPLAYERORGROUPDATA 8
|
||||
#define DPSYS_SETPLAYERORGROUPNAME 9
|
||||
#define DPEXT_HEADER_SIZE 10
|
||||
#define DPERR_BUSY 11
|
||||
#define DPERR_CONNECTIONLOST 12
|
||||
#define DPERR_INVALIDPARAMS 13
|
||||
#define DPERR_INVALIDPLAYER 14
|
||||
#define DPERR_NOTLOGGEDIN 15
|
||||
#define DPERR_SENDTOOBIG 16
|
||||
#define DPERR_BUFFERTOOSMALL 17
|
||||
#define DPID_SYSMSG 18
|
||||
#define DPSYS_DESTROYPLAYERORGROUP 19
|
||||
#define DPID_ALLPLAYERS 20
|
||||
|
||||
typedef struct LPDPMSG_GENERIC
|
||||
{
|
||||
int dwType;
|
||||
} DPMSG_GENERIC;
|
||||
typedef DPMSG_GENERIC * LPDPMSG_GENERIC;
|
||||
|
||||
typedef struct LPDPMSG_CREATEPLAYERORGROUP
|
||||
{
|
||||
int dwType;
|
||||
|
||||
DPID dpId;
|
||||
int dwPlayerType;
|
||||
|
||||
DPNAME dpnName;
|
||||
} DPMSG_CREATEPLAYERORGROUP;
|
||||
typedef DPMSG_CREATEPLAYERORGROUP * LPDPMSG_CREATEPLAYERORGROUP;
|
||||
|
||||
typedef struct LPDPMSG_DESTROYPLAYERORGROUP
|
||||
{
|
||||
int dwType;
|
||||
|
||||
DPID dpId;
|
||||
int dwPlayerType;
|
||||
} DPMSG_DESTROYPLAYERORGROUP;
|
||||
typedef DPMSG_DESTROYPLAYERORGROUP * LPDPMSG_DESTROYPLAYERORGROUP;
|
||||
|
||||
BOOL DpExtInit(DWORD cGrntdBufs, DWORD cBytesPerBuf, BOOL bErrChcks)
|
||||
{
|
||||
fprintf(stderr, "DpExtInit(%d, %d, %d)\n", cGrntdBufs, cBytesPerBuf, bErrChcks);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void DpExtUnInit()
|
||||
{
|
||||
fprintf(stderr, "DpExtUnInit()\n");
|
||||
}
|
||||
|
||||
HRESULT DpExtRecv(int lpDP2A, void *lpidFrom, void *lpidTo, DWORD dwFlags, void *lplpData, LPDWORD lpdwDataSize)
|
||||
{
|
||||
fprintf(stderr, "DpExtRecv(%d, %p, %p, %d, %p, %p)\n", lpDP2A, lpidFrom, lpidTo, dwFlags, lplpData, lpdwDataSize);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
HRESULT DpExtSend(int lpDP2A, DPID idFrom, DPID idTo, DWORD dwFlags, void *lpData, DWORD dwDataSize)
|
||||
{
|
||||
fprintf(stderr, "DpExtSend(%d, %d, %d, %d, %p, %d)\n", lpDP2A, idFrom, idTo, dwFlags, lpData, dwDataSize);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* directplay.c */
|
||||
int DirectPlay_ConnectingToLobbiedGame(char* playerName)
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_ConnectingToLobbiedGame(%s)\n", playerName);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DirectPlay_ConnectingToSession()
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_ConnectingToSession()\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL DirectPlay_UpdateSessionList(int *SelectedItem)
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_UpdateSessionList(%p)\n", SelectedItem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DirectPlay_JoinGame()
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_JoinGame()\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DirectPlay_EnumConnections()
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_EnumConnections()\n");
|
||||
}
|
||||
|
||||
int DirectPlay_HostGame(char *playerName, char *sessionName,int species,int gamestyle,int level)
|
||||
{
|
||||
extern int DetermineAvailableCharacterTypes(int);
|
||||
|
||||
int maxPlayers=DetermineAvailableCharacterTypes(FALSE);
|
||||
if(maxPlayers<1) maxPlayers=1;
|
||||
if(maxPlayers>8) maxPlayers=8;
|
||||
|
||||
if(!netGameData.skirmishMode) {
|
||||
fprintf(stderr, "DirectPlay_HostGame(%s, %s, %d, %d, %d)\n", playerName, sessionName, species, gamestyle, level);
|
||||
} else {
|
||||
//fake multiplayer
|
||||
//need to set the id to an non zero value
|
||||
AVPDPNetID=100;
|
||||
|
||||
memset(&AVPDPplayerName, 0, sizeof(AVPDPplayerName));
|
||||
AVPDPplayerName.dwSize = sizeof(DPNAME);
|
||||
AVPDPplayerName.lpszShortNameA = playerName;
|
||||
AVPDPplayerName.lpszLongNameA = playerName;
|
||||
}
|
||||
|
||||
InitAVPNetGameForHost(species,gamestyle,level);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int DirectPlay_ConnectToSession(int sessionNumber, char *playerName)
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_ConnectToSession(%d, %s)\n", sessionNumber, playerName);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DirectPlay_Disconnect()
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_Disconnect()\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
HRESULT IDirectPlayX_GetPlayerName(int glpDP, DPID id, void *data, void *size)
|
||||
{
|
||||
fprintf(stderr, "IDirectPlayX_GetPlayerName(%d, %d, %p, %p)\n", glpDP, id, data, size);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* End of Linux-related junk */
|
||||
|
||||
/* in net.c */
|
||||
extern DPID AVPDPNetID;
|
||||
extern int QuickStartMultiplayer;
|
||||
extern DPNAME AVPDPplayerName;
|
||||
extern int glpDP;
|
||||
|
||||
#define CalculateBytesSentPerSecond 0
|
||||
|
||||
|
|
|
@ -8,11 +8,10 @@
|
|||
#include "gamedef.h"
|
||||
#include "ourasert.h"
|
||||
#include "frontend/avp_menus.h"
|
||||
|
||||
extern "C"{
|
||||
// extern DDPIXELFORMAT DisplayPixelFormat;
|
||||
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
|
||||
extern int VideoModeTypeScreen;
|
||||
extern long BackBufferPitch;
|
||||
extern unsigned char *ScreenBuffer;
|
||||
extern unsigned char TestPalette[];
|
||||
extern unsigned char KeyboardInput[];
|
||||
|
@ -94,12 +93,22 @@ void HandleScreenShot()
|
|||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
unsigned char *GetScreenShot24(int *width, int *height);
|
||||
};
|
||||
|
||||
void ScreenShot()
|
||||
{
|
||||
int i;
|
||||
char Name[40];
|
||||
strcpy(Name,"AVP");
|
||||
|
||||
int width, height;
|
||||
unsigned char *buf = GetScreenShot24(&width, &height);
|
||||
if (buf == NULL)
|
||||
return;
|
||||
|
||||
strcpy(Name,"avp");
|
||||
int length=strlen(Name);
|
||||
strncpy(&Name[length],"00.bmp",8);
|
||||
for(i=0;i<100;i++)
|
||||
|
@ -109,13 +118,12 @@ void ScreenShot()
|
|||
FILE* tempfp=fopen(Name,"r");
|
||||
if(!tempfp)break;
|
||||
else
|
||||
{
|
||||
{
|
||||
fclose(tempfp);
|
||||
}
|
||||
}
|
||||
if(i==100) return;
|
||||
|
||||
|
||||
FILE * fp = fopen(Name,"wb");
|
||||
if (!fp)
|
||||
{
|
||||
|
@ -139,8 +147,8 @@ void ScreenShot()
|
|||
h.Pm2Info.Size = 0;
|
||||
|
||||
h.WinInfo.Size = 40;
|
||||
h.WinInfo.Width = ScreenDescriptorBlock.SDB_Width;
|
||||
h.WinInfo.Height = ScreenDescriptorBlock.SDB_Height;
|
||||
h.WinInfo.Width = width;
|
||||
h.WinInfo.Height = height;
|
||||
h.WinInfo.Planes = 1;
|
||||
h.WinInfo.BitCount = 24;
|
||||
h.WinInfo.Compression = 0;
|
||||
|
@ -176,76 +184,26 @@ void ScreenShot()
|
|||
PutDword(h.WinInfo.ClrUsed, fp);
|
||||
PutDword(h.WinInfo.ClrImportant, fp);
|
||||
|
||||
|
||||
int red_shift,red_scale,green_shift,green_scale,blue_shift,blue_scale;
|
||||
if(VideoModeTypeScreen==VideoModeType_15)
|
||||
{
|
||||
fprintf(stderr, "ScreenShot: VideoModeTypeScreen==VideoModeType_15\n");
|
||||
/*
|
||||
int m;
|
||||
for (red_shift = 0, m = DisplayPixelFormat.dwRBitMask;
|
||||
!(m & 1); red_shift++, m >>= 1);
|
||||
red_scale=255/m;
|
||||
|
||||
for (green_shift = 0, m = DisplayPixelFormat.dwGBitMask;
|
||||
!(m & 1); green_shift++, m >>= 1);
|
||||
green_scale=255/m;
|
||||
|
||||
for (blue_shift = 0, m = DisplayPixelFormat.dwBBitMask;
|
||||
!(m & 1); blue_shift++, m >>= 1);
|
||||
blue_scale=255/m;
|
||||
*/
|
||||
}
|
||||
|
||||
// write 24 bit image
|
||||
|
||||
LockSurfaceAndGetBufferPointer();
|
||||
unsigned char* BufferPtr=ScreenBuffer+BackBufferPitch*(h.WinInfo.Height-1);
|
||||
// unsigned char *BufferPtr = &buf[(width * 3) * (height - 1)];
|
||||
unsigned char *BufferPtr = &buf[0];
|
||||
for (i=h.WinInfo.Height-1; i>=0; --i)
|
||||
{
|
||||
int j;
|
||||
if(VideoModeTypeScreen==VideoModeType_8)
|
||||
for (j=0; j<h.WinInfo.Width; ++j)
|
||||
{
|
||||
for (j=0; j<h.WinInfo.Width; ++j)
|
||||
{
|
||||
PutByte((BYTE)TestPalette[BufferPtr[j]*3+2]<<2,fp); //b
|
||||
PutByte((BYTE)TestPalette[BufferPtr[j]*3+1]<<2,fp); //g
|
||||
PutByte((BYTE)TestPalette[BufferPtr[j]*3]<<2,fp); //r
|
||||
}
|
||||
PutByte((BYTE)BufferPtr[j*3+2],fp); //b
|
||||
PutByte((BYTE)BufferPtr[j*3+1],fp); //g
|
||||
PutByte((BYTE)BufferPtr[j*3],fp); //r
|
||||
}
|
||||
else if(VideoModeTypeScreen==VideoModeType_15)
|
||||
{
|
||||
short colour;
|
||||
for (j=0; j<h.WinInfo.Width; ++j)
|
||||
{
|
||||
colour=*(short*)&BufferPtr[j*2];
|
||||
|
||||
fprintf(stderr, "ScreenShot: VideoModeTypeScreen==VideoModeType_15\n");
|
||||
/*
|
||||
PutByte((BYTE)(((colour & DisplayPixelFormat.dwBBitMask)>>blue_shift)*blue_scale),fp); //b
|
||||
PutByte((BYTE)(((colour & DisplayPixelFormat.dwGBitMask)>>green_shift)*green_scale),fp); //g
|
||||
PutByte((BYTE)(((colour & DisplayPixelFormat.dwRBitMask)>>red_shift)*red_scale),fp); //r
|
||||
*/
|
||||
}
|
||||
}
|
||||
else if(VideoModeTypeScreen==VideoModeType_24)
|
||||
{
|
||||
for (j=0; j<h.WinInfo.Width; ++j)
|
||||
{
|
||||
PutByte((BYTE)BufferPtr[j*3+2],fp); //b
|
||||
PutByte((BYTE)BufferPtr[j*3+1],fp); //g
|
||||
PutByte((BYTE)BufferPtr[j*3],fp); //r
|
||||
}
|
||||
|
||||
}
|
||||
// pad to 4 byte boundary
|
||||
for (j=~(h.WinInfo.Width*3-1) & 3; j; --j) PutByte(0,fp);
|
||||
BufferPtr-=BackBufferPitch;
|
||||
// BufferPtr -= width * 3;
|
||||
BufferPtr += width * 3;
|
||||
}
|
||||
UnlockSurface();
|
||||
|
||||
fclose(fp);
|
||||
|
||||
free(buf);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
|
|
59
src/fixer.h
59
src/fixer.h
|
@ -140,6 +140,65 @@ int SetEndOfFile(HANDLE file);
|
|||
unsigned int timeGetTime();
|
||||
unsigned int GetTickCount();
|
||||
|
||||
typedef struct DPNAME
|
||||
{
|
||||
int dwSize;
|
||||
|
||||
char *lpszShortNameA;
|
||||
char *lpszLongNameA;
|
||||
} DPNAME;
|
||||
|
||||
#define DP_OK 0
|
||||
|
||||
typedef int HRESULT;
|
||||
|
||||
#define DPRECEIVE_ALL 1
|
||||
#define DPSYS_ADDPLAYERTOGROUP 2
|
||||
#define DPSYS_CREATEPLAYERORGROUP 3
|
||||
#define DPPLAYERTYPE_PLAYER 4
|
||||
#define DPSYS_DELETEPLAYERFROMGROUP 5
|
||||
#define DPSYS_HOST 6
|
||||
#define DPSYS_SESSIONLOST 7
|
||||
#define DPSYS_SETPLAYERORGROUPDATA 8
|
||||
#define DPSYS_SETPLAYERORGROUPNAME 9
|
||||
#define DPEXT_HEADER_SIZE 10
|
||||
#define DPERR_BUSY 11
|
||||
#define DPERR_CONNECTIONLOST 12
|
||||
#define DPERR_INVALIDPARAMS 13
|
||||
#define DPERR_INVALIDPLAYER 14
|
||||
#define DPERR_NOTLOGGEDIN 15
|
||||
#define DPERR_SENDTOOBIG 16
|
||||
#define DPERR_BUFFERTOOSMALL 17
|
||||
#define DPID_SYSMSG 18
|
||||
#define DPSYS_DESTROYPLAYERORGROUP 19
|
||||
#define DPID_ALLPLAYERS 20
|
||||
|
||||
typedef struct DPMSG_GENERIC
|
||||
{
|
||||
int dwType;
|
||||
} DPMSG_GENERIC;
|
||||
typedef DPMSG_GENERIC * LPDPMSG_GENERIC;
|
||||
|
||||
typedef struct DPMSG_CREATEPLAYERORGROUP
|
||||
{
|
||||
int dwType;
|
||||
|
||||
DPID dpId;
|
||||
int dwPlayerType;
|
||||
|
||||
DPNAME dpnName;
|
||||
} DPMSG_CREATEPLAYERORGROUP;
|
||||
typedef DPMSG_CREATEPLAYERORGROUP * LPDPMSG_CREATEPLAYERORGROUP;
|
||||
|
||||
typedef struct DPMSG_DESTROYPLAYERORGROUP
|
||||
{
|
||||
int dwType;
|
||||
|
||||
DPID dpId;
|
||||
int dwPlayerType;
|
||||
} DPMSG_DESTROYPLAYERORGROUP;
|
||||
typedef DPMSG_DESTROYPLAYERORGROUP * LPDPMSG_DESTROYPLAYERORGROUP;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
|
50
src/main.c
50
src/main.c
|
@ -60,6 +60,31 @@ void ReadJoysticks()
|
|||
|
||||
/* ** */
|
||||
|
||||
unsigned char *GetScreenShot24(int *width, int *height)
|
||||
{
|
||||
unsigned char *buf;
|
||||
|
||||
if (surface == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf = (unsigned char *)malloc(surface->w * surface->h * 3);
|
||||
|
||||
if (surface->flags & SDL_OPENGL) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glReadPixels(0, 0, surface->w, surface->h, GL_RGB, GL_BYTE, buf);
|
||||
} else {
|
||||
fprintf(stderr, "GetScreenShot24: add software mode 16->24!\n");
|
||||
}
|
||||
|
||||
*width = surface->w;
|
||||
*height = surface->h;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* ** */
|
||||
|
||||
PROCESSORTYPES ReadProcessorType()
|
||||
{
|
||||
return PType_PentiumMMX;
|
||||
|
@ -219,6 +244,8 @@ int InitialiseWindowsSystem()
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int GotPrintScn, HavePrintScn;
|
||||
|
||||
static int KeySymToKey(int keysym)
|
||||
{
|
||||
switch(keysym) {
|
||||
|
@ -328,7 +355,7 @@ static int KeySymToKey(int keysym)
|
|||
case SDLK_COMMA:
|
||||
return KEY_COMMA;
|
||||
case SDLK_PERIOD:
|
||||
return KEY_FSTOP; /* fstop? */
|
||||
return KEY_FSTOP;
|
||||
case SDLK_SPACE:
|
||||
return KEY_SPACE;
|
||||
|
||||
|
@ -553,10 +580,21 @@ void CheckForWindowsMessages()
|
|||
case SDL_MOUSEBUTTONUP:
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
handle_keypress(KeySymToKey(event.key.keysym.sym), event.key.keysym.unicode, 1);
|
||||
if (event.key.keysym.sym == SDLK_PRINT) {
|
||||
if (HavePrintScn == 0)
|
||||
GotPrintScn = 1;
|
||||
HavePrintScn = 1;
|
||||
} else {
|
||||
handle_keypress(KeySymToKey(event.key.keysym.sym), event.key.keysym.unicode, 1);
|
||||
}
|
||||
break;
|
||||
case SDL_KEYUP:
|
||||
handle_keypress(KeySymToKey(event.key.keysym.sym), 0, 0);
|
||||
if (event.key.keysym.sym == SDLK_PRINT) {
|
||||
GotPrintScn = 0;
|
||||
HavePrintScn = 0;
|
||||
} else {
|
||||
handle_keypress(KeySymToKey(event.key.keysym.sym), 0, 0);
|
||||
}
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
AvP.MainLoopRunning = 0; /* TODO */
|
||||
|
@ -616,7 +654,11 @@ void CheckForWindowsMessages()
|
|||
SDL_ShowCursor(0);
|
||||
}
|
||||
|
||||
/* ctrl-z for iconify window? */
|
||||
if (GotPrintScn) {
|
||||
GotPrintScn = 0;
|
||||
|
||||
ScreenShot();
|
||||
}
|
||||
}
|
||||
|
||||
void InGameFlipBuffers()
|
||||
|
|
150
src/net.c
Normal file
150
src/net.c
Normal file
|
@ -0,0 +1,150 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "fixer.h"
|
||||
|
||||
#include "3dc.h"
|
||||
#include "inline.h"
|
||||
#include "module.h"
|
||||
#include "stratdef.h"
|
||||
#include "equipmnt.h"
|
||||
|
||||
#include "pldnet.h"
|
||||
|
||||
|
||||
DPID AVPDPNetID;
|
||||
int QuickStartMultiplayer=1;
|
||||
DPNAME AVPDPplayerName;
|
||||
int glpDP; /* directplay object */
|
||||
|
||||
static pthread_t NetThread;
|
||||
static pthread_mutex_t NetMutex;
|
||||
|
||||
BOOL DpExtInit(DWORD cGrntdBufs, DWORD cBytesPerBuf, BOOL bErrChcks)
|
||||
{
|
||||
fprintf(stderr, "DpExtInit(%d, %d, %d)\n", cGrntdBufs, cBytesPerBuf, bErrChcks);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void DpExtUnInit()
|
||||
{
|
||||
fprintf(stderr, "DpExtUnInit()\n");
|
||||
}
|
||||
|
||||
HRESULT DpExtRecv(int lpDP2A, void *lpidFrom, void *lpidTo, DWORD dwFlags, void *lplpData, LPDWORD lpdwDataSize)
|
||||
{
|
||||
fprintf(stderr, "DpExtRecv(%d, %p, %p, %d, %p, %p)\n", lpDP2A, lpidFrom, lpidTo, dwFlags, lplpData, lpdwDataSize);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
HRESULT DpExtSend(int lpDP2A, DPID idFrom, DPID idTo, DWORD dwFlags, void *lpData, DWORD dwDataSize)
|
||||
{
|
||||
fprintf(stderr, "DpExtSend(%d, %d, %d, %d, %p, %d)\n", lpDP2A, idFrom, idTo, dwFlags, lpData, dwDataSize);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* directplay.c */
|
||||
int DirectPlay_ConnectingToLobbiedGame(char* playerName)
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_ConnectingToLobbiedGame(%s)\n", playerName);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DirectPlay_ConnectingToSession()
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_ConnectingToSession()\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL DirectPlay_UpdateSessionList(int *SelectedItem)
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_UpdateSessionList(%p)\n", SelectedItem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DirectPlay_JoinGame()
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_JoinGame()\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DirectPlay_EnumConnections()
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_EnumConnections()\n");
|
||||
|
||||
netGameData.tcpip_available = 1;
|
||||
netGameData.ipx_available = 0;
|
||||
netGameData.modem_available = 0;
|
||||
netGameData.serial_available = 0;
|
||||
}
|
||||
|
||||
int DirectPlay_HostGame(char *playerName, char *sessionName,int species,int gamestyle,int level)
|
||||
{
|
||||
extern int DetermineAvailableCharacterTypes(int);
|
||||
|
||||
int maxPlayers=DetermineAvailableCharacterTypes(FALSE);
|
||||
if(maxPlayers<1) maxPlayers=1;
|
||||
if(maxPlayers>8) maxPlayers=8;
|
||||
|
||||
if(!netGameData.skirmishMode) {
|
||||
fprintf(stderr, "DirectPlay_HostGame(%s, %s, %d, %d, %d)\n", playerName, sessionName, species, gamestyle, level);
|
||||
|
||||
//fake multiplayer
|
||||
//need to set the id to an non zero value
|
||||
AVPDPNetID=100;
|
||||
|
||||
memset(&AVPDPplayerName, 0, sizeof(AVPDPplayerName));
|
||||
AVPDPplayerName.dwSize = sizeof(DPNAME);
|
||||
AVPDPplayerName.lpszShortNameA = playerName;
|
||||
AVPDPplayerName.lpszLongNameA = playerName;
|
||||
|
||||
glpDP = 1;
|
||||
} else {
|
||||
//fake multiplayer
|
||||
//need to set the id to an non zero value
|
||||
AVPDPNetID=100;
|
||||
|
||||
memset(&AVPDPplayerName, 0, sizeof(AVPDPplayerName));
|
||||
AVPDPplayerName.dwSize = sizeof(DPNAME);
|
||||
AVPDPplayerName.lpszShortNameA = playerName;
|
||||
AVPDPplayerName.lpszLongNameA = playerName;
|
||||
}
|
||||
|
||||
InitAVPNetGameForHost(species,gamestyle,level);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int DirectPlay_ConnectToSession(int sessionNumber, char *playerName)
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_ConnectToSession(%d, %s)\n", sessionNumber, playerName);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DirectPlay_Disconnect()
|
||||
{
|
||||
fprintf(stderr, "DirectPlay_Disconnect()\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
HRESULT IDirectPlayX_GetPlayerName(int glpDP, DPID id, void *data, void *size)
|
||||
{
|
||||
fprintf(stderr, "IDirectPlayX_GetPlayerName(%d, %d, %p, %p)\n", glpDP, id, data, size);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* End of Linux-related junk */
|
|
@ -198,4 +198,4 @@ void CopyAnimationFrameToShape (SHAPEANIMATIONCONTROLDATA *sacd, struct displayb
|
|||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -180,4 +180,4 @@ inline int valid(String const & str)
|
|||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -45,8 +45,10 @@ HANDLE CreateFile(const char *file, int mode, int x, int y, int flags, int flags
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
fd = open(file, O_RDONLY);
|
||||
if (fd == -1)
|
||||
if (fd == -1) {
|
||||
perror("CreateFile");
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
break;
|
||||
case GENERIC_WRITE:
|
||||
if (flags != CREATE_ALWAYS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue