diff --git a/README b/README index 78e9370..ad6676e 100644 --- a/README +++ b/README @@ -43,7 +43,7 @@ can just use unzip to extract the files from the .exe), add -DALIEN_DEMO to the CFLAGS line (the one that's uncommented) in the Makefile. Rename all game files lowercase. Be sure to install SDL 1.2 (http://www.libsdl.org) with OpenGL support, nasm 0.98, and the latest OpenAL CVS (http://www.openal.org). -AvP requires a 3d card with OpenGL support to work. +AvP requires a 3D card with OpenGL support to work. Create the MPConfig and User_Profiles directories if they do not exist. (Note: Windows profiles probably do not work in Linux and vice versa) @@ -80,8 +80,8 @@ Linux Port-specific commands: The source code that was released only works with Aliens vs Predator Gold. -In the future I'd like this port to support Gold, Regular and the Alien -demo. (The Marine and Predator demos are a bit older and might not work.) +This port currently supports Gold Edition, Regular, and the Alien demo. +(The Marine and Predator demos are a bit older and might not work.) At least with the Gold edition, a number of files are encoded on the CD. So @@ -97,13 +97,12 @@ http://blemished.net/chcase.html for renaming the files. Apparantly AvP Gold is no longer available at most places. I had ordered my copy May 2001 from http://www.dragon.ca, but they no longer list it. -Someone did mention in an avpnews forum post (see below) that -http://www.qvc.com does have AvP Gold, so you may want to try there. Try -searching the bargin bin at your local computer store. +Try searching http://www.amazon.com, http://www.ebgames.com, +http://www.ebay.com, or the bargin bin at your local computer store. -What are the differences between AvP and AvP Gold? -http://www.aliensvpredator.com/ubb/Forum2/HTML/001635.html -http://www.aliensvpredator.com/ubb/Forum2/HTML/001680.html + +It is unknown if the Mac Gold Edition will work with this (I'd be interested +in knowing if it does or not). The full motion sequences cannot be played because they are encoded with @@ -118,7 +117,8 @@ http://www.avpnews.com. Last, but surely not least: Thanks go out to Chuck Mason for testing and the OpenAL code, Dan Olson for trying the code out with the Regular version, Zachary 'zakk' Slater for -providing feedback, and Ryan C. Gordon for hosting this project. +providing tons of feedback, Tim Beckmann for sending patches, and Ryan C. +Gordon for hosting this project. --- Steven Fuller diff --git a/TODO b/TODO index 98970f4..3d9aeec 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,7 @@ [DONE] [12/05/01] Progress bar. [DONE] [12/06/01] Make vidmodes work. [DONE] [12/08/01] Debug "pure virtual method called" -* Command line options. +[DONE] [12/09/01] Command line options. * Proper file loading/saving (ignore case, search certain directories) and config handling (~/.avp/{ge, re, ad, md, pd}/?) * Joystick support. @@ -32,14 +32,6 @@ etc.) * Release new version. And fix bugs, and release new version, and so on. ---- -* Command line: - [-h | --help] Display this help message - [-v | --version] Display the game version - [-f | --fullscreen] Run the game fullscreen - [-w | --windowed] Run the game in a window - [-s | --nosound] Do not access the soundcard - [-c | --nocdrom] Do not access the CD-ROM ---debug enable debug mode * Debug, verify, and reimplant the inline functions in mathline.c to inline.h * Remove unused files. diff --git a/src/main.c b/src/main.c index f366a2f..5c29d44 100644 --- a/src/main.c +++ b/src/main.c @@ -7,6 +7,9 @@ #include #include +#define _GNU_SOURCE +#include + #include "fixer.h" #include "3dc.h" @@ -44,6 +47,10 @@ extern int NormalFrameTime; SDL_Surface *surface; +static int WantFullscreen = 1; +static int WantSound = 1; +static int WantCDRom = 1; + #if GL_EXT_secondary_color PFNGLSECONDARYCOLORPOINTEREXTPROC pglSecondaryColorPointerEXT; #endif @@ -291,7 +298,7 @@ char *GetVideoModeDescription3() int InitSDL() { SDL_Rect **SDL_AvailableVideoModes; - + if (SDL_Init(SDL_INIT_VIDEO) < 0) { fprintf(stderr, "SDL Init failed: %s\n", SDL_GetError()); exit(EXIT_FAILURE); @@ -363,7 +370,10 @@ int SetSoftVideoMode(int Width, int Height, int Depth) SDL_FreeSurface(surface); } else { - isfull = 0; + if (WantFullscreen) + isfull = 1; + else + isfull = 0; isgrab = SDL_GRAB_OFF; } @@ -379,11 +389,6 @@ int SetSoftVideoMode(int Width, int Height, int Depth) SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); SDL_EnableUNICODE(1); /* toggle it to ON */ - /* -w will disable first fullscreen, -f will turn it on */ -// SDL_WM_ToggleFullScreen(surface); -// SDL_WM_GrabInput(SDL_GRAB_ON); -// SDL_ShowCursor(0); - if (isfull && !(surface->flags & SDL_FULLSCREEN)) { SDL_WM_ToggleFullScreen(surface); if (surface->flags & SDL_FULLSCREEN) @@ -423,7 +428,10 @@ int SetOGLVideoMode(int Width, int Height) SDL_FreeSurface(surface); } else { - isfull = 0; + if (WantFullscreen) + isfull = 1; + else + isfull = 0; isgrab = SDL_GRAB_OFF; } @@ -445,11 +453,6 @@ int SetOGLVideoMode(int Width, int Height) SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); SDL_EnableUNICODE(1); /* toggle it to ON */ - /* -w will disable first fullscreen, -f will turn it on */ -// SDL_WM_ToggleFullScreen(surface); -// SDL_WM_GrabInput(SDL_GRAB_ON); -// SDL_ShowCursor(0); - if (isfull && !(surface->flags & SDL_FULLSCREEN)) { SDL_WM_ToggleFullScreen(surface); if (surface->flags & SDL_FULLSCREEN) @@ -468,7 +471,6 @@ int SetOGLVideoMode(int Width, int Height) glLoadIdentity(); glEnable(GL_BLEND); -// glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnable(GL_DEPTH_TEST); @@ -962,11 +964,69 @@ int ExitWindowsSystem() return 0; } -int main(int argc, char *argv[]) -{ +static 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' }, +{ "debug", 0, NULL, 'd' }, /* - printf("%s", AvPVersionString); -*/ +{ "loadrifs", 0, NULL, 'l' }, +{ "server", 0, someval, 1 }, +{ "client", 1, someval, 2 }, +*/ +{ NULL, 0, NULL, 0 }, +}; + +static const char *usage_string = +"Aliens vs Predator Linux - http://www.icculus.org/avp/\n" +"Based on Rebellion Developments AvP Gold source\n" +" [-h | --help] Display this help message\n" +" [-v | --version] Display the game version\n" +" [-f | --fullscreen] Run the game fullscreen\n" +" [-w | --windowed] Run the game in a window\n" +" [-s | --nosound] Do not access the soundcard\n" +" [-c | --nocdrom] Do not access the CD-ROM\n" +; + +int main(int argc, char *argv[]) +{ + int c; + + opterr = 0; + while ((c = getopt_long(argc, argv, "hvfwscd", 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 'd': { + extern int DebuggingCommandsActive; + DebuggingCommandsActive = 1; + } + break; + default: + printf("%s", usage_string); + exit(EXIT_FAILURE); + } + } + if (InitSDL() == -1) { fprintf(stderr, "Could not find a sutable resolution!\n"); fprintf(stderr, "At least 512x384 is needed. Does OpenGL work?\n"); @@ -977,14 +1037,8 @@ int main(int argc, char *argv[]) SetFastRandom(); -/* WeWantAnIntro(); */ + WeWantAnIntro(); GetPathFromRegistry(); -#if 0 -{ - extern int DebuggingCommandsActive; - DebuggingCommandsActive = 1; -} -#endif #if MARINE_DEMO ffInit("fastfile/mffinfo.txt","fastfile/"); @@ -1007,8 +1061,8 @@ int main(int argc, char *argv[]) LoadKeyConfiguration(); - SoundSys_Start(); - CDDA_Start(); + if (WantSound) SoundSys_Start(); + if (WantCDRom) CDDA_Start(); InitTextStrings(); @@ -1018,8 +1072,9 @@ int main(int argc, char *argv[]) AvP.LevelCompleted = 0; LoadSounds("PLAYER"); - AvP.CurrentEnv = AvP.StartingEnv = 0; /* are these even used? */ - + /* is this still neccessary? */ + AvP.CurrentEnv = AvP.StartingEnv = 0; + #if ALIEN_DEMO AvP.PlayerType = I_Alien; SetLevelToLoad(AVP_ENVIRONMENT_INVASION_A); @@ -1029,26 +1084,6 @@ int main(int argc, char *argv[]) #elif MARINE_DEMO AvP.PlayerType = I_Marine; SetLevelToLoad(AVP_ENVIRONMENT_INVASION); -#else -// AvP.PlayerType = I_Alien; -// SetLevelToLoad(AVP_ENVIRONMENT_TEMPLE); /* starting alien level */ -// SetLevelToLoad(AVP_ENVIRONMENT_INVASION_A); - - AvP.PlayerType = I_Marine; -// SetLevelToLoad(AVP_ENVIRONMENT_DERELICT); /* starting marine level */ -// SetLevelToLoad(AVP_ENVIRONMENT_COLONY); - -// AvP.PlayerType = I_Predator; -// SetLevelToLoad(AVP_ENVIRONMENT_WATERFALL); /* starting predator level */ -// SetLevelToLoad(AVP_ENVIRONMENT_TEMPLE_P); - -// SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_MP); /* multiplayer */ -// SetLevelToLoad(AVP_ENVIRONMENT_SUBWAY_MP); - -// SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_COOP); /* coop/skirmish */ - SetLevelToLoad(AVP_ENVIRONMENT_JOCKEY_COOP); - -// SetLevelToLoad(AVP_ENVIRONMENT_E3DEMOSP); /* demo level */ #endif #if !(ALIEN_DEMO|PREDATOR_DEMO|MARINE_DEMO) @@ -1160,8 +1195,6 @@ if (AvP_MainMenus()) case I_GM_Menus: AvP.GameMode = I_GM_Playing; break; - case I_GM_Paused: -// break; default: fprintf(stderr, "AvP.MainLoopRunning: gamemode = %d\n", AvP.GameMode); exit(EXIT_FAILURE); diff --git a/src/version.c b/src/version.c index 5aa6924..26686a5 100644 --- a/src/version.c +++ b/src/version.c @@ -2,9 +2,9 @@ extern void NewOnScreenMessage(unsigned char *messagePtr); -const char *AvPVersionString = "Aliens vs Predator - Linux \n Build 000 \n Based on Rebellion Developments AvP Gold source \n"; +const char *AvPVersionString = "Aliens vs Predator Linux \n Build 000 (CVS) \n Based on Rebellion Developments AvP Gold source \n"; void GiveVersionDetails(void) { - NewOnScreenMessage(AvPVersionString); + NewOnScreenMessage((unsigned char *)AvPVersionString); }