Skip to content

Commit

Permalink
Source release of Wolfenstein 3D Classic Platinum for iOS, 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Bradshaw committed Jan 31, 2012
1 parent a82aba6 commit 1630494
Show file tree
Hide file tree
Showing 45 changed files with 10,694 additions and 184 deletions.
1 change: 1 addition & 0 deletions wolf3d/code/env/common.h
Expand Up @@ -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


Expand Down
14 changes: 11 additions & 3 deletions wolf3d/code/env/fileio.c
Expand Up @@ -216,16 +216,24 @@ 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 );
}

// 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 );

Expand Down
18 changes: 17 additions & 1 deletion wolf3d/code/env/files.c
Expand Up @@ -60,7 +60,7 @@


PRIVATE char fs_gamedir[ MAX_OSPATH ];

//PRIVATE char fs_soddir[ MAX_OSPATH ]; //gsh


/*
Expand All @@ -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;
}*/


/*
Expand Down
1 change: 1 addition & 0 deletions wolf3d/code/env/filesystem.h
Expand Up @@ -45,6 +45,7 @@

extern void FS_InitFilesystem(void);
extern char *FS_Gamedir(void);
//extern char *FS_ForceGamedir(void); //gsh



Expand Down
2 changes: 1 addition & 1 deletion wolf3d/code/env/sound.c
Expand Up @@ -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 );
Expand Down
36 changes: 30 additions & 6 deletions wolf3d/code/env/sound_sfx_id.c
Expand Up @@ -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;
}

Expand Down
47 changes: 41 additions & 6 deletions wolf3d/code/env/texture_manager.c
Expand Up @@ -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 )
{
Expand All @@ -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 );
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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;
}

Expand Down
15 changes: 15 additions & 0 deletions wolf3d/code/iphone/EAGLView.h
Expand Up @@ -24,6 +24,13 @@
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>




#ifdef VOLUMEHACK
#import <MediaPlayer/MPVolumeView.h>
#endif

/*
This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
The view content is basically an EAGL surface you render your OpenGL scene into.
Expand All @@ -49,6 +56,14 @@ Note that setting the view non-opaque will only work if the EAGL surface has an
NSTimer *animationTimer;
NSTimeInterval animationInterval;

//gsh... an attempt at hacking the volume button
#ifdef VOLUMEHACK
MPVolumeView *volumeView;
UISlider *volumeViewSlider;
float lastFramesVolume;
#endif
// NSThread *pLoadThread;

}

@property NSTimeInterval animationInterval;
Expand Down

0 comments on commit 1630494

Please sign in to comment.