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

@@ -71,8 +71,8 @@ PUBLIC void A_DeathScream( entity_t *self )
{
switch( self->type )
{
case en_mutant:
if( g_version->value == SPEAROFDESTINY )
case en_mutant: //added 0's to all of these in order to check if sounds are correct... gsh
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh )
{
Sound_StartSound( NULL, 1, CHAN_VOICE, Sound_RegisterSound( "sfx/033.wav" ), 1, ATTN_NORM, 0 );
}
@@ -83,7 +83,7 @@ PUBLIC void A_DeathScream( entity_t *self )
break;
case en_guard:
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh )
{
Sound_StartSound( NULL, 1, CHAN_VOICE, Sound_RegisterSound( dsodsounds[ US_RndT() % 6 ] ), 1, ATTN_NORM, 0 );
}
@@ -94,7 +94,7 @@ PUBLIC void A_DeathScream( entity_t *self )
break;
case en_officer:
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh )
{
Sound_StartSound( NULL, 1, CHAN_VOICE, Sound_RegisterSound( "sfx/046.wav" ), 1, ATTN_NORM, 0 );
}
@@ -105,7 +105,7 @@ PUBLIC void A_DeathScream( entity_t *self )
break;
case en_ss:
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh )
{
Sound_StartSound( NULL, 1, CHAN_VOICE, Sound_RegisterSound( "sfx/035.wav" ), 1, ATTN_NORM, 0 );
}
@@ -116,7 +116,7 @@ PUBLIC void A_DeathScream( entity_t *self )
break;
case en_dog:
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh )
{
Sound_StartSound( NULL, 1, CHAN_VOICE, Sound_RegisterSound( "sfx/031.wav" ), 1, ATTN_NORM, 0 );
}
@@ -208,7 +208,7 @@ PUBLIC void A_FirstSighting( entity_t *self )
break;
case en_officer:
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh )
{
Sound_StartSound( NULL, 1, CHAN_VOICE, Sound_RegisterSound( "sfx/043.wav" ), 1, ATTN_NORM, 0 );
}
@@ -918,7 +918,7 @@ PUBLIC void T_Projectile( entity_t *self )
{
if( self->type == en_rocket || self->type == en_hrocket )
{ // rocket ran into obstacle, draw explosion!
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh )
{
Sound_StartSound( NULL, 1, CHAN_WEAPON, Sound_RegisterSound( "lsfx/001.wav" ), 1, ATTN_NORM, 0 );
}

View File

@@ -924,7 +924,8 @@ PUBLIC void T_Bite( entity_t *self )
{
long dx, dy;
Sound_StartSound( NULL, 1, CHAN_VOICE, Sound_RegisterSound( "lsfx/076.wav" ), 1, ATTN_NORM, 0 );
// Sound_StartSound( NULL, 1, CHAN_VOICE, Sound_RegisterSound( "lsfx/076.wav" ), 1, ATTN_NORM, 0 ); //gsh this was the original code
Sound_StartSound( NULL, 1, CHAN_VOICE, Sound_RegisterSound( "sfx/002.wav" ), 1, ATTN_NORM, 0 ); //gsh changed to this... the original code wasn't the correct sound file
dx = ABS( Player.position.origin[ 0 ] - self->x ) - TILEGLOBAL;
if( dx <= MINACTORDIST )
@@ -1156,7 +1157,7 @@ PUBLIC void T_Shoot( entity_t *self )
switch( self->type )
{
case en_ss:
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9 )//added the episode check... gsh)
{
Sound_StartSound( NULL, 1, CHAN_WEAPON, Sound_RegisterSound( "sfx/020.wav" ), 1, ATTN_NORM, 0 );
}
@@ -1175,7 +1176,7 @@ PUBLIC void T_Shoot( entity_t *self )
break;
default:
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh)
{
Sound_StartSound( NULL, 1, CHAN_WEAPON, Sound_RegisterSound( "sfx/038.wav" ), 1, ATTN_NORM, 0 );
}
@@ -1302,7 +1303,7 @@ PUBLIC void T_Launch( entity_t *self )
default:
proj->type = en_rocket;
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh)
{
Sound_StartSound( NULL, 1, CHAN_WEAPON, Sound_RegisterSound( "lsfx/008.wav" ), 1, ATTN_NORM, 0 );
}

View File

@@ -19,6 +19,20 @@
*/
#include "../wolfiphone.h"
/*
void ReplaceText(char* original, char* insert, int nInsertAt)
{
int sizeInsert = sizeof(insert);
int sizeOriginal = sizeof(original); //should be 1024
for (int i = 0; i < sizeInsert; i++)
{
original[nInsertAt + i] = insert[i];
}
}*/
/*
-----------------------------------------------------------------------------
@@ -34,14 +48,15 @@
*/
PUBLIC void Client_PrepRefresh( const char *r_mapname )
{
char mapname[ 32 ];
// char mapname[ 32 ];
char mapname[ 64 ]; //gsh, decided to allow longer map names
if( ! r_mapname || ! *r_mapname )
{
return;
}
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 10)//added the episode check... gsh)
{
spritelocation = SODSPRITESDIRNAME;
}
@@ -78,7 +93,47 @@ PUBLIC void Client_PrepRefresh( const char *r_mapname )
// clear any lines of console text
Con_ClearNotify();
//gsh
//this is a hack... to save space on the download... we've removed the music
//so instead we're going to replace the SOD music with wolf3d music here
//however, we don't have to worry about that now that we package the SOD music
//with the binary
/*
if (currentMap.episode >= 6) //if it's the SOD levels
{
char *source;
switch (currentMap.episode * 10 + currentMap.map)
{
case 60: source = "ZEROHOUR.ogg"; break;
case 61: source = "CORNER.ogg"; break;
case 62: source = "DUNGEON.ogg"; break;
case 63: source = "ENDLEVEL.ogg"; break;
case 64: source = "FUNKYOU.ogg"; break;
case 65: source = "HEADACHE.ogg"; break;
case 66: source = "HITLWLTZ.ogg"; break;
case 67: source = "INTROCW3.ogg"; break;
case 68: source = "NAZI_NOR.ogg"; break;
case 69: source = "NAZI_OMI.ogg"; break;
case 70: source = "NAZI_RAP.ogg"; break;
case 71: source = "PACMAN.ogg"; break;
case 72: source = "POW.ogg"; break;
case 73: source = "PREGNANT.ogg"; break;
case 74: source = "ROSTER.ogg"; break;
case 75: source = "SALUTE.ogg"; break;
case 76: source = "SEARCHN.ogg"; break;
case 77: source = "SUSPENSE.ogg"; break;
case 78: source = "TWELFTH.ogg"; break;
case 79: source = "URAHERO.ogg"; break;
case 80: source = "ULTIMATE.ogg"; break;
default:
source = "CORNER.ogg";
}
strcpy(levelData.musicName + 6, source); //the '6' is to get us past the "music/" part of musicName
levelData.musicName[6 + strlen(source)] = '\0';
}*/
Com_Printf("Starting Music Track: %s\n", levelData.musicName);
Sound_StartBGTrack( levelData.musicName, levelData.musicName );
Player.playstate = ex_playing;

View File

@@ -905,7 +905,7 @@ PUBLIC LevelData_t *Level_LoadMap( const char *levelname )
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh)
{
statinfo = static_sod;
num_statics = sizeof( static_sod ) / sizeof( static_sod[ 0 ] );
@@ -933,6 +933,7 @@ PUBLIC LevelData_t *Level_LoadMap( const char *levelname )
filesize = FS_GetFileSize( fhandle );
if( filesize < MAPHEADER_SIZE )
{
Com_Printf("Map file size is smaller than mapheader size\n");
return NULL;
}
@@ -943,6 +944,7 @@ PUBLIC LevelData_t *Level_LoadMap( const char *levelname )
FS_ReadFile( &signature, 1, 4, fhandle );
if( signature != MAP_SIGNATURE )
{
Com_Printf("File signature does not match MAP_SIGNATURE\n");
return NULL;
}
@@ -973,6 +975,7 @@ PUBLIC LevelData_t *Level_LoadMap( const char *levelname )
if( filesize < (MAPHEADER_SIZE + mapNameLength + musicNameLength +
length[ 0 ] + length[ 1 ] + length[ 2 ]) )
{
Com_Printf("filesize is less than MAPHEADER_SIZE + mapNameLength + musicNameLength + etc\n");
return NULL;
}
@@ -990,6 +993,7 @@ PUBLIC LevelData_t *Level_LoadMap( const char *levelname )
if( filesize < (MAPHEADER_SIZE + mapNameLength + musicNameLength) )
{
Com_Printf("filesize is less than MAPHEADER_SIZE + mapNameLength + musicNameLength\n");
return NULL;
}
@@ -1165,6 +1169,114 @@ PUBLIC LevelData_t *Level_LoadMap( const char *levelname )
return newMap;
}
/*
-----------------------------------------------------------------------------
Function: Level_VerifyMap
Parameters: level file name
Returns: 0 if invalid map, 1 otherwise
Notes:
-----------------------------------------------------------------------------
*/
PUBLIC int Level_VerifyMap( const char *levelname )
{
W16 rle;
W32 offset[ 3 ];
W16 length[ 3 ];
W16 w, h;
W32 signature;
W32 ceiling, floor;
filehandle_t *fhandle;
W16 mapNameLength;
char *mapName = NULL;
W16 musicNameLength;
char *musicName = NULL;
SW32 filesize;
int value = 1;
fhandle = FS_OpenFile( levelname, FA_FILE_IPHONE_DOC_DIR );
if( ! fhandle )
{
value = 0;
goto cleanup;
}
filesize = FS_GetFileSize( fhandle );
if( filesize < MAPHEADER_SIZE )
{
value = 0;
goto cleanup;
}
FS_ReadFile( &signature, 1, 4, fhandle );
if( signature != MAP_SIGNATURE )
{
value = 0;
goto cleanup;
}
FS_ReadFile( &rle, 2, 1, fhandle );
FS_ReadFile( &w, 2, 1, fhandle );
FS_ReadFile( &h, 2, 1, fhandle );
FS_ReadFile( &ceiling, 4, 1, fhandle );
FS_ReadFile( &floor, 4, 1, fhandle );
FS_ReadFile( &length, 2, 3, fhandle );
FS_ReadFile( &offset, 4, 3, fhandle );
FS_ReadFile( &mapNameLength, 1, 2, fhandle );
FS_ReadFile( &musicNameLength, 1, 2, fhandle );
FS_ReadFile( &levelstate.fpartime, sizeof( float ), 1, fhandle );
FS_ReadFile( levelstate.spartime, sizeof( W8 ), 5, fhandle );
levelstate.spartime[ 5 ] = '\0';
if( filesize < (MAPHEADER_SIZE + mapNameLength + musicNameLength +
length[ 0 ] + length[ 1 ] + length[ 2 ]) )
{
value = 0;
goto cleanup;
}
mapName = Z_Malloc( mapNameLength + 1 );
musicName = Z_Malloc( musicNameLength + 1 );
FS_ReadFile( mapName, 1, mapNameLength, fhandle );
mapName[ mapNameLength ] = '\0';
FS_ReadFile( musicName, 1, musicNameLength, fhandle );
musicName[ musicNameLength ] = '\0';
if( filesize < (MAPHEADER_SIZE + mapNameLength + musicNameLength) )
{
value = 0;
goto cleanup;
}
cleanup:
FS_CloseFile(fhandle);
if (mapName) {
Z_Free(mapName);
}
if (musicName) {
Z_Free(musicName);
}
return value;
}

View File

@@ -140,8 +140,7 @@ extern void ProcessGuards( void );
#define WL6SPRITESDIRNAME "sprites"
#define SODSPRITESDIRNAME "sodsprites"
#define SODSPRITESDIRNAME "sodsprites"//"sprites" //gsh was originally "sodsprites"
extern char *spritelocation;

View File

@@ -70,7 +70,9 @@ PUBLIC void Game_Init( void )
episode = Cvar_Get( "episode", "0", CVAR_ARCHIVE );
skill = Cvar_Get( "skill", "1", CVAR_ARCHIVE );
g_version = Cvar_Get( "g_version", "0", CVAR_ARCHIVE );
// g_version = Cvar_Get( "g_version", "0", CVAR_ARCHIVE );
g_version = Cvar_Get( "g_version", "1", CVAR_ARCHIVE ); //we should make a #ifdef for "special version"
//this version is to come with spear
#ifndef LITE
Cmd_AddCommand( "map", Map_f );

View File

@@ -83,6 +83,7 @@ PRIVATE _boolean PL_ChangeWeapon( player_t *self, int weapon )
return false;
}
self->weapon =
self->pendingweapon = weapon;
@@ -461,7 +462,7 @@ PRIVATE void PL_PlayerAttack( player_t *self, _boolean re_attack )
-----------------------------------------------------------------------------
*/
PUBLIC void PL_Process( player_t *self, LevelData_t *lvl )
{
{
int n;
self->madenoise = false;
@@ -489,11 +490,34 @@ PUBLIC void PL_Process( player_t *self, LevelData_t *lvl )
if( Player.cmd.buttons & BUTTON_ATTACK )
{
self->flags |= PL_FLAG_ATTCK;
//gsh
if (self->previousweapon != WEAPON_KNIFE && self->previousweapon)
{
//self->weapon = self->previousweapon;
PL_ChangeWeapon(self, self->previousweapon);
}
self->attackframe = 0;
self->attackcount = attackinfo[ self->weapon ][ 0 ].tics;
self->weaponframe = attackinfo[ self->weapon ][ 0 ].frame;
} else if ( Player.cmd.buttons & BUTTON_CHANGE_WEAPON ) {
}
else if ( Player.cmd.buttons & BUTTON_ALTERNATE_ATTACK ) //gsh
{
self->flags |= PL_FLAG_ATTCK;
// PL_ChangeWeapon(self, WEAPON_KNIFE);
if (self->weapon != WEAPON_KNIFE)
{
self->previousweapon = self->weapon;
self->weapon = WEAPON_KNIFE;
}
self->attackframe = 0;
self->attackcount = attackinfo[ self->weapon ][ 0 ].tics;
self->weaponframe = attackinfo[ self->weapon ][ 0 ].frame;
}
else if ( Player.cmd.buttons & BUTTON_CHANGE_WEAPON ) {
self->pendingweapon=self->weapon;
for( n = 0 ; n < 4; ++n )
{
@@ -559,9 +583,51 @@ PUBLIC void PL_Spawn( placeonplane_t location, LevelData_t *lvl )
Areas_ConnectAreas( Player.areanumber );
//gsh
iphoneSetLevelNotifyText();
/*
char str[128];
sprintf( str, "Entering level E%iM%i", currentMap.episode + 1, currentMap.map + 1 );
//sprintf( str, "Entering level E%iM%i", currentMap.episode + 1, currentMap.map + 1 );
//gsh
if (currentMap.episode < 6)
sprintf( str, "Entering level E%iM%i", currentMap.episode+1, currentMap.map+1 );
else if (currentMap.episode < 10) {
int currentLevel = currentMap.episode * 10 + currentMap.map;
switch (currentLevel) {
case 60: case 61: case 62: case 63: case 64:
sprintf( str, "Entering Tunnels %i", currentLevel-60+1);
break;
case 78:
sprintf( str, "Entering Tunnels %i", 6);
break;
case 65: case 66: case 67: case 68: case 69:
sprintf( str, "Entering Dungeons %i", currentLevel-65+1);
break;
case 79:
sprintf( str, "Entering Dungeons %i", 6);
break;
case 70: case 71: case 72: case 73: case 74: case 75:
sprintf( str, "Entering Castle");
break;
case 76:
sprintf( str, "Entering Ramparts");
break;
case 77:
sprintf( str, "Entering Death Knight");
break;
case 80:
sprintf( str, "Entering Dungeon Dimension");
break;
default:
sprintf( str, " ");
break;
}
}
else
sprintf( str, "Entering level custom %i", /*currentMap.episode+1,* currentMap.map+1 );
iphoneSetNotifyText( str );
*/
}
/*
@@ -918,6 +984,7 @@ PUBLIC void PL_NewGame( player_t *self )
self->ammo[ AMMO_BULLETS ] = 16; // JDC: changed for iphone 8;
self->lives = 3;
self->previousweapon = WEAPON_KNIFE; //gsh
self->weapon = self->pendingweapon = WEAPON_PISTOL;
self->items = ITEM_WEAPON_1 | ITEM_WEAPON_2;
self->next_extra = EXTRAPOINTS;
@@ -973,6 +1040,7 @@ PUBLIC _boolean PL_Reborn( player_t *self )
self->weaponframe = 0;
self->flags = 0;
self->previousweapon = WEAPON_KNIFE; //gsh
self->weapon = self->pendingweapon = WEAPON_PISTOL;
self->items = ITEM_WEAPON_1 | ITEM_WEAPON_2;

View File

@@ -135,6 +135,7 @@ typedef struct player_s
int old_score, score, next_extra;
unsigned items; // (keys, weapon)
int weapon, pendingweapon;
int previousweapon; //gsh
// additional info
int attackframe, attackcount, weaponframe; // attack info
unsigned flags;

View File

@@ -254,7 +254,8 @@ PRIVATE int Pow_Give( pow_t type )
{
return 0;
}
Sound_StartSound( NULL, 0, CHAN_ITEM, Sound_RegisterSound( "lsfx/064.wav" ), 1, ATTN_NORM, 0 );
// Sound_StartSound( NULL, 0, CHAN_ITEM, Sound_RegisterSound( "lsfx/064.wav" ), 1, ATTN_NORM, 0 ); //gsh, I don't like this sound
Sound_StartSound( NULL, 0, CHAN_ITEM, Sound_RegisterSound( "lsfx/031.wav" ), 1, ATTN_NORM, 0 ); //gsh, I like this sound
break;
case pow_machinegun:
@@ -290,14 +291,22 @@ PRIVATE int Pow_Give( pow_t type )
case pow_spear:
{
char szTextMsg[ 256 ];
//gsh char szTextMsg[ 256 ];
Com_Printf("Spear of Destiny picked up!!\n");
Sound_StartSound( NULL, 0, CHAN_ITEM, Sound_RegisterSound( "sodsfx/109.wav" ), 1, ATTN_NORM, 0 );
Sound_StartSound( NULL, 0, CHAN_ITEM, Sound_RegisterSound( "sfx/109.wav" ), 1, ATTN_NORM, 0 ); //gsh
iphoneSetNotifyText( "Spear of Destiny" );
my_snprintf( szTextMsg, sizeof( szTextMsg ),
/* //gsh
my_snprintf( szTextMsg, sizeof( szTextMsg ), //this is supposed to load the last level... but it isn't
"loading ; map s%.2d.map\n", 20 );
Cbuf_AddText( szTextMsg );
*/
//this might be a bit of a hack. But it works.
//Load the last level... gsh
iphoneStartMap(8, 0, currentMap.skill);
}
break;

View File

@@ -96,7 +96,7 @@ PUBLIC _boolean PushWall_Push( int x, int y, dir4type dir )
iphoneSetNotifyText( "You found a secret!" );
}
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)//added the episode check... gsh ).. TODO: fix sfx and other media
{
Sound_StartSound( NULL, 1, CHAN_AUTO, Sound_RegisterSound( "sfx/030.wav" ), 1, ATTN_STATIC, 0 );
}

View File

@@ -59,7 +59,14 @@ PUBLIC void R_BeginRegistration( const char *map )
++texture_registration_sequence;
my_snprintf( fullname, sizeof( fullname ), "maps/%s.map", map );
//my_snprintf( fullname, sizeof( fullname ), "maps/%s.map", map );
if ( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 10) //add if/else... gsh
my_snprintf( fullname, sizeof( fullname ), "%s.map", map );
else if (currentMap.episode >= 10)
my_snprintf( fullname, sizeof( fullname ), "%s.map", map );
else
my_snprintf( fullname, sizeof( fullname ), "maps/%s.map", map );
// Door_ResetDoors( &r_world->Doors );
Powerup_Reset();
@@ -74,13 +81,13 @@ PUBLIC void R_BeginRegistration( const char *map )
if( r_world == NULL )
{
Com_Printf( "Could not load map (%s)\n", map );
Com_Printf( "Could not load map (%s) in R_BeginRegistration\n", map );
return;
}
levelstate.floornum = floornumber;
if( g_version->value == SPEAROFDESTINY )
if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9) //added the episode check... gsh)
{
if( strlen( map ) >= 2 )
{