summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteven Fuller <relnev@icculus.org>2008-05-18 02:33:57 -0700
committerPatryk Obara <dreamer.tan@gmail.com>2019-08-20 02:22:37 +0200
commit0cab37ee8b1aa7b7a53fad3b8fb729b9e1b7eb36 (patch)
tree91815fe84ddfac47032f875f961f70880bf49aeb /src
parent7213d915858629b644b7f5f464ac75014f19c77e (diff)
Got the Windows WIP branch to build in Linux.
Diffstat (limited to 'src')
-rw-r--r--src/files.c2
-rw-r--r--src/fixer.h120
-rw-r--r--src/main.c119
3 files changed, 97 insertions, 144 deletions
diff --git a/src/files.c b/src/files.c
index 94153ac..0871d31 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1,5 +1,6 @@
#define _BSD_SOURCE
+#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -12,6 +13,7 @@
#include <dirent.h>
#include <fnmatch.h>
+#include "fixer.h"
#include "files.h"
static char *local_dir;
diff --git a/src/fixer.h b/src/fixer.h
index 19a049d..ced3c91 100644
--- a/src/fixer.h
+++ b/src/fixer.h
@@ -27,79 +27,20 @@
// not sure where this was originally defined.
#define RGBA_MAKE(r, g, b, a) ((((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
-// unused placeholder directplay code.
-typedef int DPID;
-
-typedef struct DPNAME
-{
- int dwSize;
-
- char *lpszShortNameA;
- char *lpszLongNameA;
-} DPNAME;
-
-#define DP_OK 0
-
-#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;
-
#else
-#ifdef __cplusplus
-extern "C" {
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
-//#include <stdint.h> /* int64_t */
+#include <inttypes.h> /* int64_t */
#include "files.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define PACKED_PUSH
#define PACKED_POP
#define PACKED __attribute__((packed))
@@ -141,7 +82,6 @@ size_t _mbclen(const unsigned char *s);
#define MAX_PATH PATH_MAX
typedef int GUID;
-typedef int DPID;
typedef int HINSTANCE;
typedef int WPARAM;
typedef int LPARAM;
@@ -167,8 +107,6 @@ typedef struct RECT
int bottom;
} RECT;
-typedef RECT RECT_AVP;
-
#if !defined(__INTEL_COMPILER)
typedef int64_t __int64;
#else
@@ -225,6 +163,34 @@ int SetEndOfFile(HANDLE file);
unsigned int timeGetTime();
unsigned int GetTickCount();
+#define JOYCAPS_HASR 1
+
+typedef struct JOYINFOEX
+{
+ DWORD dwXpos;
+ DWORD dwYpos;
+ DWORD dwRpos;
+ DWORD dwUpos;
+ DWORD dwVpos;
+ DWORD dwPOV;
+} JOYINFOEX;
+
+typedef struct JOYCAPS
+{
+ int wCaps;
+} JOYCAPS;
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+// unused placeholder directplay code.
+typedef int DPID;
typedef struct DPNAME
{
@@ -282,28 +248,8 @@ typedef struct DPMSG_DESTROYPLAYERORGROUP
int dwPlayerType;
} DPMSG_DESTROYPLAYERORGROUP;
typedef DPMSG_DESTROYPLAYERORGROUP * LPDPMSG_DESTROYPLAYERORGROUP;
-
-#define JOYCAPS_HASR 1
-
-typedef struct JOYINFOEX
-{
- DWORD dwXpos;
- DWORD dwYpos;
- DWORD dwRpos;
- DWORD dwUpos;
- DWORD dwVpos;
- DWORD dwPOV;
-} JOYINFOEX;
-
-typedef struct JOYCAPS
-{
- int wCaps;
-} JOYCAPS;
-
#ifdef __cplusplus
};
#endif
#endif
-
-#endif
diff --git a/src/main.c b/src/main.c
index 2c8bd4f..154e07d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,16 +2,17 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <assert.h>
#include "SDL.h"
#include "oglfunc.h"
+#if !defined(_MSC_VER)
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
-///#include <getopt.h>
-
+#include <getopt.h>
+#endif
+
#include "fixer.h"
#include "3dc.h"
@@ -1097,23 +1098,25 @@ void FlipBuffers()
char *AvpCDPath = 0;
-///static const struct option getopt_long_options[] = {
-///{ "help", 0, NULL, 'h' },
-///{ "version", 0, NULL, 'v' },
-///{ "fullscreen", 0, NULL, 'f' },
-///{ "windowed", 0, NULL, 'w' },
-///{ "nosound", 0, NULL, 's' },
-///{ "nocdrom", 0, NULL, 'c' },
-///{ "nojoy", 0, NULL, 'j' },
-///{ "debug", 0, NULL, 'd' },
-///{ "withgl", 1, NULL, 'g' },
-////*
-///{ "loadrifs", 1, NULL, 'l' },
-///{ "server", 0, someval, 1 },
-///{ "client", 1, someval, 2 },
-///*/
-///{ NULL, 0, NULL, 0 },
-///};
+#if !defined(_MSC_VER)
+static const struct option getopt_long_options[] = {
+{ "help", 0, NULL, 'h' },
+{ "version", 0, NULL, 'v' },
+{ "fullscreen", 0, NULL, 'f' },
+{ "windowed", 0, NULL, 'w' },
+{ "nosound", 0, NULL, 's' },
+{ "nocdrom", 0, NULL, 'c' },
+{ "nojoy", 0, NULL, 'j' },
+{ "debug", 0, NULL, 'd' },
+{ "withgl", 1, NULL, 'g' },
+/*
+{ "loadrifs", 1, NULL, 'l' },
+{ "server", 0, someval, 1 },
+{ "client", 1, someval, 2 },
+*/
+{ NULL, 0, NULL, 0 },
+};
+#endif
static const char *usage_string =
"Aliens vs Predator Linux - http://www.icculus.org/avp/\n"
@@ -1130,45 +1133,47 @@ static const char *usage_string =
int main(int argc, char *argv[])
{
+#if !defined(_MSC_VER)
int c;
-/// opterr = 0;
-/// while ((c = getopt_long(argc, argv, "hvfwscdg:", getopt_long_options, NULL)) != -1) {
-/// switch(c) {
-/// case 'h':
-/// printf("%s", usage_string);
-/// exit(EXIT_SUCCESS);
-/// case 'v':
-/// printf("%s", AvPVersionString);
-/// exit(EXIT_SUCCESS);
-/// case 'f':
-/// WantFullscreen = 1;
-/// break;
-/// case 'w':
-/// WantFullscreen = 0;
-/// break;
-/// case 's':
-/// WantSound = 0;
-/// break;
-/// case 'c':
-/// WantCDRom = 0;
-/// break;
-/// case 'j':
-/// WantJoystick = 0;
-/// break;
-/// case 'd': {
-/// extern int DebuggingCommandsActive;
-/// DebuggingCommandsActive = 1;
-/// }
-/// break;
-/// case 'g':
-/// opengl_library = optarg;
-/// break;
-/// default:
-/// printf("%s", usage_string);
-/// exit(EXIT_FAILURE);
-/// }
-/// }
+ opterr = 0;
+ while ((c = getopt_long(argc, argv, "hvfwscdg:", getopt_long_options, NULL)) != -1) {
+ switch(c) {
+ case 'h':
+ printf("%s", usage_string);
+ exit(EXIT_SUCCESS);
+ case 'v':
+ printf("%s", AvPVersionString);
+ exit(EXIT_SUCCESS);
+ case 'f':
+ WantFullscreen = 1;
+ break;
+ case 'w':
+ WantFullscreen = 0;
+ break;
+ case 's':
+ WantSound = 0;
+ break;
+ case 'c':
+ WantCDRom = 0;
+ break;
+ case 'j':
+ WantJoystick = 0;
+ break;
+ case 'd': {
+ extern int DebuggingCommandsActive;
+ DebuggingCommandsActive = 1;
+ }
+ break;
+ case 'g':
+ opengl_library = optarg;
+ break;
+ default:
+ printf("%s", usage_string);
+ exit(EXIT_FAILURE);
+ }
+ }
+#endif
InitGameDirectories(argv[0]);