Source release of Wolfenstein 3D Classic Platinum for iOS, 1.2

This commit is contained in:
Travis Bradshaw
2012-01-31 16:57:34 -06:00
parent a82aba6b94
commit 16304944b4
45 changed files with 10681 additions and 171 deletions

View File

@@ -181,6 +181,7 @@ extern void Client_Init( void );
#define BUTTON_ATTACK 1
#define BUTTON_USE 2
#define BUTTON_CHANGE_WEAPON 4
#define BUTTON_ALTERNATE_ATTACK 8 //gsh
#define BUTTON_ANY 128 // any key whatsoever

View File

@@ -216,8 +216,6 @@ PUBLIC filehandle_t *FS_OpenFile( const char *filename, W32 FlagsAndAttributes )
pathBase = iphoneDocDirectory;
my_snprintf( netpath, sizeof( netpath ), "%s/%s", pathBase, filename );
} else {
// extern char iphoneAppDirectory[1024];
// pathBase = iphoneAppDirectory;
pathBase = FS_Gamedir();
my_snprintf( netpath, sizeof( netpath ), "%s/%s", pathBase, filename );
}
@@ -225,7 +223,17 @@ PUBLIC filehandle_t *FS_OpenFile( const char *filename, W32 FlagsAndAttributes )
// high performance file mapping path, avoiding stdio
fd = open( netpath, O_RDONLY );
if ( fd == -1 ) {
return NULL;
// return NULL;
//if it couldn't be found in that path then check again in the document directory
//gsh
//pathBase = FS_ForceGamedir();
extern char iphoneDocDirectory[1024];
pathBase = iphoneDocDirectory;
my_snprintf( netpath, sizeof( netpath ), "%s/%s", pathBase, filename );
fd = open( netpath, O_RDONLY );
if ( fd == -1 ) { //okay, couldn't find it there either... return null
return NULL;
}
}
fstat( fd, &s );

View File

@@ -60,7 +60,7 @@
PRIVATE char fs_gamedir[ MAX_OSPATH ];
//PRIVATE char fs_soddir[ MAX_OSPATH ]; //gsh
/*
@@ -77,8 +77,24 @@ PRIVATE char fs_gamedir[ MAX_OSPATH ];
*/
PUBLIC char *FS_Gamedir( void )
{
/*
//gsh... this is a trick to load in where the iphoneDocDirectory is
if (currentMap.episode >= 6)
{
// sprintf( fs_soddir, "%s/SODbase", iphoneDocDirectory ); //if you're downloading the SOD data
sprintf( fs_soddir, "%s/", iphoneDocDirectory ); //if you're only downloading the spear maps
return fs_soddir;
}*/
return fs_gamedir;
}
/*
//gsh this is so that we can force a non-SOD folder
//it's only getting used in the FSOpenFile() of fileio.c
PUBLIC char *FS_ForceGamedir( void )
{
return fs_gamedir;
}*/
/*

View File

@@ -45,6 +45,7 @@
extern void FS_InitFilesystem(void);
extern char *FS_Gamedir(void);
//extern char *FS_ForceGamedir(void); //gsh

View File

@@ -690,7 +690,7 @@ PRIVATE void Sound_Register( void )
{
s_initSound = Cvar_Get( "s_initSound", "1", CVAR_INIT );
s_masterVolume = Cvar_Get( "s_masterVolume", "1.0", CVAR_ARCHIVE );
s_masterVolume = Cvar_Get( "s_masterVolume", "0.3", CVAR_ARCHIVE ); //gsh changed this from "1.0" to "0.3" for the volume hack... otherwise it's too loud
s_sfxVolume = Cvar_Get( "s_sfxVolume", "1.0", CVAR_ARCHIVE );
s_musicVolume = Cvar_Get( "s_musicVolume", "1.0", CVAR_ARCHIVE );
s_minDistance = Cvar_Get( "s_minDistance", "0.0", CVAR_ARCHIVE );

View File

@@ -248,33 +248,57 @@ PUBLIC void Sound_BeginRegistration( void )
s_registering = true;
}
PUBLIC sfx_t *Sound_RegisterSound( const char *name )
{
sfx_t *sfx;
bool isSpearSound = false;
if( ! sound_initialized )
{
return NULL;
}
if( g_version->value == 1 )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && strncmp(name, "iphone", 6) && currentMap.episode < 9)//added the episode & iphone check... gsh
{
isSpearSound = true;
char tempname[ 256 ];
my_snprintf( tempname, sizeof( tempname ), "sod%s", name );
sfx = Sound_FindSound( tempname );
//gsh
//Com_Printf("Finding Sound: %s\n", tempname);
}
else
{
sfx = Sound_FindSound( name );
//gsh
//Com_Printf("Finding Sound: %s\n", name);
}
/*
//original
if( ! s_registering )
{
Sound_LoadSound( sfx );
}
*/
//gsh
if( ! s_registering )
{
//if it couldn't be found and we tried finding it in sod
//then it might exist in wolf3d
if( !Sound_LoadSound( sfx ) && isSpearSound)
{
sfx = Sound_FindSound( name );
//Com_Printf("Finding Sound Again: %s\n", name);
if( ! s_registering )
Sound_LoadSound( sfx ); //try loading again
}
}
return sfx;
}

View File

@@ -464,14 +464,14 @@ PUBLIC texture_t *TM_FindTexture( const char *name, texturetype_t type )
{
return r_notexture;
}
// Check for file extension
len = strlen( name );
if( len < 5 )
{
return r_notexture;
}
// look for it in the texture cache
for( i = 0, tex = ttextures; i < numttextures; ++i, ++tex )
{
@@ -490,7 +490,8 @@ PUBLIC texture_t *TM_FindTexture( const char *name, texturetype_t type )
return r_notexture;
}
// Com_Printf( "Loading texture: %s\n", name );
//gsh
//Com_Printf( "Loading texture: %s\n", name );
// look for the pre-digested 5551 version
strcpy( digested, name );
@@ -514,7 +515,6 @@ PUBLIC texture_t *TM_FindTexture( const char *name, texturetype_t type )
{ GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, GL_UNSIGNED_BYTE, 2 },
};
picHeader_t *ph = (picHeader_t *)fh->filedata;
int noMips = 0;
@@ -606,7 +606,7 @@ PUBLIC texture_t *TM_FindTexture( const char *name, texturetype_t type )
if ( fh == NULL ) {
Com_Printf( "Failed to find texture %s\n", name );
return r_notexture;
}
} //else { //added the else...gsh
jpgSize = FS_GetFileSize( fh );
jpgData = fh->ptrStart;
@@ -616,13 +616,48 @@ PUBLIC texture_t *TM_FindTexture( const char *name, texturetype_t type )
if ( ! data ) {
free( jpgData );
return r_notexture;
}
} //else { //added the else
tex = TM_LoadTexture( name, data, width, height, type, bytes );
MM_FREE( data );
tex->maxS = tex->maxT = 1.0f;
return tex;
}
/*
Com_Printf("Trying to find texture made it to the end\n");
//gsh.. couldn't find it... try doing it again, but looking in a new location
if (spritelocation == SODSPRITESDIRNAME && spritelocation != WL6SPRITESDIRNAME)
{
//need to remove the 'sod'
if (strncmp(spritelocation, name, strlen(spritelocation)) == 0)
{
char buffer[64];
char tempName[64];
int offset = strlen(spritelocation) + 1;
for (int i = 0; i < strlen(name) - offset; ++i)
{
buffer[i] = name[i+offset];
}
buffer[i] = '\0'; //just in case
spritelocation = WL6SPRITESDIRNAME;
//TODO:
my_snprintf(tempName, sizeof(tempName), "%s/%s", spritelocation, buffer);
Com_Printf("tempName: %s\n", tempName);
Com_Printf("buffer: %s\n", buffer);
spritelocation = SODSPRITESDIRNAME; //return to sodsprites
tex = TM_FindTexture( tempName, type);
return tex;
}
}
return r_notexture;*/
return NULL;
}