Permalink
Browse files

Added Screenshot code.

Moved some net stuff around.
  • Loading branch information...
1 parent 53681c5 commit 0ec833843882c9c9388951fccdc1fb06c362a71f Steven Fuller committed Nov 13, 2001
Showing with 297 additions and 258 deletions.
  1. +1 −1 Makefile
  2. +1 −0 README
  3. +1 −1 src/avp/decal.h
  4. +1 −1 src/avp/particle.h
  5. +1 −1 src/avp/stratdef.h
  6. +1 −1 src/avp/win95/frontend/avp_menudata.c
  7. +5 −178 src/avp/win95/pldnet.c
  8. +26 −68 src/avp/win95/scrshot.cpp
  9. +59 −0 src/fixer.h
  10. +46 −4 src/main.c
  11. +150 −0 src/net.c
  12. +1 −1 src/win95/shpanim.h
  13. +1 −1 src/win95/string.hpp
  14. +3 −1 src/winapi.c
View
@@ -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
View
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.
View
@@ -114,4 +114,4 @@ extern int NumFixedDecals;
extern int CurrentFixedDecalIndex;
#define MAX_NO_OF_DECALS_PER_HIERARCHICAL_SECTION 16
-#endif
+#endif
View
@@ -198,4 +198,4 @@ extern void MakeElectricalExplosion(VECTORCH *positionPtr);
#define MAX_NO_OF_BLOOD_PARTICLES 500
extern int NumberOfBloodParticles;
-#endif
+#endif
View
@@ -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
View
@@ -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
View
@@ -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
- }
- }
- 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
-*/
- }
+ 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_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);
}
-
-
Oops, something went wrong.

0 comments on commit 0ec8338

Please sign in to comment.