Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Re-fixed the menus and enabled another font drawing function.

Fixed Profile Loading/Saving (had to disable debug mode).
  • Loading branch information...
commit 2611efca93203cf18e994c8bc309c4e662be9ec9 1 parent 489c080
Steven Fuller authored
View
7 README
@@ -44,13 +44,18 @@ 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), nasm
0.98, and the latest OpenAL CVS (http://www.openal.org).
+Create the MPConfig and User_Profiles directories if they do not exist.
+(Note: Windows profiles probably do not work in Linux and vice versa)
+
If you have the regular edition, add -DREGULAR_EDITION to CFLAGS.
relnev:~/avp/AvP Demo 3 - Alien$ ls
-aenglish.txt alienavp_huds/ alienfastfile/ avp_rifs/
+aenglish.txt alienavp_huds/ alienfastfile/ avp_rifs/ MPConfig/
+User_Profiles/
relnev:~/avp/Gold Edition$ ls
avp_huds/ avp_rifs/ cd tracks.txt default.cfg fastfile/ language.txt
+MPConfig/ User_Profiles/
Support for the demo is not quite complete (some sounds are missing and some
text is incorrect/missing).
View
26 src/avp/win95/frontend/avp_mp_config.cpp
@@ -22,9 +22,9 @@ extern char MP_SessionName[];
extern char MP_Config_Description[];
#define MP_CONFIG_DIR "MPConfig"
-#define MP_CONFIG_WILDCARD "MPConfig\\*.cfg"
+#define MP_CONFIG_WILDCARD "MPConfig/*.cfg"
-#define SKIRMISH_CONFIG_WILDCARD "MPConfig\\*.skirmish_cfg"
+#define SKIRMISH_CONFIG_WILDCARD "MPConfig/.skirmish_cfg"
static List<char*> ConfigurationFilenameList;
static List<char*> ConfigurationLocalisedFilenameList;
@@ -199,9 +199,9 @@ const char* GetMultiplayerConfigDescription(int index)
FILE* file;
char filename[200];
if(netGameData.skirmishMode)
- sprintf(filename,"%s\\%s.skirmish_cfg",MP_CONFIG_DIR,name);
+ sprintf(filename,"%s/%s.skirmish_cfg",MP_CONFIG_DIR,name);
else
- sprintf(filename,"%s\\%s.cfg",MP_CONFIG_DIR,name);
+ sprintf(filename,"%s/%s.cfg",MP_CONFIG_DIR,name);
file=fopen(filename,"rb");
if(!file)
@@ -239,9 +239,9 @@ void LoadMultiplayerConfiguration(const char* name)
FILE* file;
char filename[200];
if(netGameData.skirmishMode)
- sprintf(filename,"%s\\%s.skirmish_cfg",MP_CONFIG_DIR,name);
+ sprintf(filename,"%s/%s.skirmish_cfg",MP_CONFIG_DIR,name);
else
- sprintf(filename,"%s\\%s.cfg",MP_CONFIG_DIR,name);
+ sprintf(filename,"%s/%s.cfg",MP_CONFIG_DIR,name);
file=fopen(filename,"rb");
if(!file) return;
@@ -350,9 +350,9 @@ void SaveMultiplayerConfiguration(const char* name)
FILE* file;
char filename[200];
if(netGameData.skirmishMode)
- sprintf(filename,"%s\\%s.skirmish_cfg",MP_CONFIG_DIR,name);
+ sprintf(filename,"%s/%s.skirmish_cfg",MP_CONFIG_DIR,name);
else
- sprintf(filename,"%s\\%s.cfg",MP_CONFIG_DIR,name);
+ sprintf(filename,"%s/%s.cfg",MP_CONFIG_DIR,name);
CreateDirectory(MP_CONFIG_DIR,0);
file=fopen(filename,"wb");
@@ -449,16 +449,16 @@ void DeleteMultiplayerConfigurationByIndex(int index)
char filename[200];
if(netGameData.skirmishMode)
- sprintf(filename,"%s\\%s.skirmish_cfg",MP_CONFIG_DIR,ConfigurationFilenameList[index]);
+ sprintf(filename,"%s/%s.skirmish_cfg",MP_CONFIG_DIR,ConfigurationFilenameList[index]);
else
- sprintf(filename,"%s\\%s.cfg",MP_CONFIG_DIR,ConfigurationFilenameList[index]);
+ sprintf(filename,"%s/%s.cfg",MP_CONFIG_DIR,ConfigurationFilenameList[index]);
DeleteFile(filename);
}
#define IP_ADDRESS_DIR "IP_Address"
-#define IP_ADDRESS_WILDCARD "IP_Address\\*.IP Address"
+#define IP_ADDRESS_WILDCARD "IP_Address/*.IP Address"
static List<char*> IPAddFilenameList;
@@ -563,7 +563,7 @@ void SaveIPAddress(const char* name,const char* address)
FILE* file;
char filename[200];
- sprintf(filename,"%s\\%s.IP Address",IP_ADDRESS_DIR,name);
+ sprintf(filename,"%s/%s.IP Address",IP_ADDRESS_DIR,name);
CreateDirectory(IP_ADDRESS_DIR,0);
file=fopen(filename,"wb");
@@ -584,7 +584,7 @@ void LoadIPAddress(const char* name)
FILE* file;
char filename[200];
- sprintf(filename,"%s\\%s.IP Address",IP_ADDRESS_DIR,name);
+ sprintf(filename,"%s/%s.IP Address",IP_ADDRESS_DIR,name);
file=fopen(filename,"rb");
if(!file) return;
View
81 src/avp/win95/frontend/avp_userprofile.cpp
@@ -20,6 +20,11 @@ extern "C"
#include "pldnet.h"
#include <time.h>
+#include <glob.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
static int LoadUserProfiles(void);
static void EmptyUserProfilesList(void);
@@ -199,7 +204,79 @@ static int ProfileIsMoreRecent(AVP_USER_PROFILE *profilePtr, AVP_USER_PROFILE *p
static int LoadUserProfiles(void)
{
- fprintf(stderr, "STUB: LoadUserProfiles()\n");
+ glob_t globbuf;
+ const char* load_name=USER_PROFILES_WILDCARD_NAME;
+
+ if (glob(load_name, 0, NULL, &globbuf))
+ return 0;
+
+ // get any path in the load_name
+ int nPathLen = 0;
+ char * pColon = strrchr(load_name,':');
+ if (pColon) nPathLen = pColon - load_name + 1;
+ char * pBackSlash = strrchr(load_name,'\\');
+ if (pBackSlash)
+ {
+ int nLen = pBackSlash - load_name + 1;
+ if (nLen > nPathLen) nPathLen = nLen;
+ }
+ char * pSlash = strrchr(load_name,'/');
+ if (pSlash)
+ {
+ int nLen = pSlash - load_name + 1;
+ if (nLen > nPathLen) nPathLen = nLen;
+ }
+
+ for (int i = 0; i < globbuf.gl_pathc; i++) {
+ struct stat buf;
+
+ if (stat(globbuf.gl_pathv[i], &buf) == -1)
+ continue;
+
+ if (S_ISREG(buf.st_mode) && (access(globbuf.gl_pathv[i], R_OK) == 0))
+ {
+ char * pszFullPath = new char [nPathLen+strlen(globbuf.gl_pathv[i])+1];
+ // strncpy(pszFullPath,load_name,nPathLen);
+ strcpy(pszFullPath /* +nPathLen */, globbuf.gl_pathv[i]);
+
+
+ //make sure the file is a rif file
+ HANDLE rif_file;
+ rif_file = CreateFile (pszFullPath, GENERIC_READ, 0, 0, OPEN_EXISTING,
+ FILE_FLAG_RANDOM_ACCESS, 0);
+ if(rif_file==INVALID_HANDLE_VALUE)
+ {
+// printf("couldn't open %s\n",pszFullPath);
+ delete[] pszFullPath;
+ continue;
+ }
+
+ AVP_USER_PROFILE *profilePtr = new AVP_USER_PROFILE;
+ unsigned long bytes_read;
+
+ if (!ReadFile(rif_file, profilePtr, sizeof(AVP_USER_PROFILE), &bytes_read, 0))
+ {
+ CloseHandle (rif_file);
+ delete[] pszFullPath;
+ delete profilePtr;
+ continue;
+ }
+#if 0
+ FILETIME ftLocal;
+ FileTimeToLocalFileTime(&wfd.ftLastWriteTime,&ftLocal);
+ FileTimeToSystemTime(&ftLocal,&profilePtr->TimeLastUpdated);
+ profilePtr->FileTime = ftLocal;
+#endif
+ InsertProfileIntoList(profilePtr);
+ CloseHandle (rif_file);
+ delete[] pszFullPath;
+
+ }
+
+ }
+
+ globfree(&globbuf);
+
#if 0
const char* load_name=USER_PROFILES_WILDCARD_NAME;
// allow a wildcard search
@@ -435,4 +512,4 @@ extern void FixCheatModesInUserProfile(AVP_USER_PROFILE *profilePtr)
}
-}; // extern "C"
+}; // extern "C"
View
2  src/avp/win95/frontend/avp_userprofile.h
@@ -144,8 +144,6 @@ typedef struct
-
-/* TODO: dir separator */
#define USER_PROFILES_PATH "User_Profiles/"
#define USER_PROFILES_WILDCARD_NAME "User_Profiles/*.prf"
#define USER_PROFILES_SUFFIX ".prf"
View
12 src/main.c
@@ -100,7 +100,7 @@ int SetSoftVideoMode(int Width, int Height, int Depth)
// SDL_WM_GrabInput(SDL_GRAB_ON);
// SDL_ShowCursor(0);
- if (isfull) {
+ if (isfull && !(surface->flags & SDL_FULLSCREEN)) {
SDL_WM_ToggleFullScreen(surface);
if (surface->flags & SDL_FULLSCREEN)
SDL_ShowCursor(0);
@@ -166,7 +166,7 @@ int SetOGLVideoMode(int Width, int Height)
// SDL_WM_GrabInput(SDL_GRAB_ON);
// SDL_ShowCursor(0);
- if (isfull) {
+ if (isfull && !(surface->flags & SDL_FULLSCREEN)) {
SDL_WM_ToggleFullScreen(surface);
if (surface->flags & SDL_FULLSCREEN)
SDL_ShowCursor(0);
@@ -185,7 +185,8 @@ int SetOGLVideoMode(int Width, int Height)
glLoadIdentity();
glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
+// glBlendFunc(GL_ONE, GL_ONE);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
@@ -592,7 +593,7 @@ void CheckForWindowsMessages()
MouseVelY = 0;
}
- if (KeyboardInput[KEY_LEFTALT] && DebouncedKeyboardInput[KEY_CR]) {
+ if ((KeyboardInput[KEY_LEFTALT]||KeyboardInput[KEY_RIGHTALT]) && DebouncedKeyboardInput[KEY_CR]) {
SDL_GrabMode gm;
SDL_WM_ToggleFullScreen(surface);
@@ -685,11 +686,12 @@ int main(int argc, char *argv[])
SetFastRandom();
GetPathFromRegistry();
-
+#if 0
{
extern int DebuggingCommandsActive;
DebuggingCommandsActive = 1;
}
+#endif
#if MARINE_DEMO
ffInit("fastfile/mffinfo.txt","fastfile/");
View
6 src/menus.c
@@ -137,6 +137,8 @@ int RenderMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID
int RenderMenuText_Clipped(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY)
{
+ return Hardware_RenderSmallMenuText(textPtr, x, y, alpha, format);
+
fprintf(stderr, "RenderMenuText_Clipped(%s, %d, %d, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format, topY, bottomY);
return 0;
@@ -282,7 +284,11 @@ void InitialiseMenuGfx()
}
glEnable(GL_BLEND);
+// glBlendFunc(GL_ONE, GL_ONE);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
glDisable(GL_DEPTH_TEST);
+
glEnable(GL_TEXTURE_2D);
glClear(GL_COLOR_BUFFER_BIT);
Please sign in to comment.
Something went wrong with that request. Please try again.