From 04b25f44db67713759350981f533ebd2d5445edc Mon Sep 17 00:00:00 2001 From: James Haley Date: Sun, 3 Oct 2010 21:05:42 +0000 Subject: Eliminated the rest of the notion of an episode, added proper sky setting, and other misc code in g_game. Also started *trying* to add new savegame code in g_game, but this is a just about a lost cause without any portable filepath handling support from the engine. Subversion-branch: /branches/strife-branch Subversion-revision: 2152 --- src/strife/am_map.c | 4 +- src/strife/d_main.c | 2 +- src/strife/g_game.c | 699 +++++++++++++++++++++++++++++---------------------- src/strife/g_game.h | 3 +- src/strife/p_setup.c | 28 +-- src/strife/p_setup.h | 4 +- 6 files changed, 414 insertions(+), 326 deletions(-) diff --git a/src/strife/am_map.c b/src/strife/am_map.c index 42eb8f1e..48c6b475 100644 --- a/src/strife/am_map.c +++ b/src/strife/am_map.c @@ -552,11 +552,11 @@ void AM_Start (void) if (!stopped) AM_Stop(); stopped = false; - if (lastlevel != gamemap || lastepisode != gameepisode) + if (lastlevel != gamemap /*|| lastepisode != gameepisode*/) { AM_LevelInit(); lastlevel = gamemap; - lastepisode = gameepisode; + //lastepisode = gameepisode; } AM_initVariables(); AM_loadPics(); diff --git a/src/strife/d_main.c b/src/strife/d_main.c index 8c307180..07b3e505 100644 --- a/src/strife/d_main.c +++ b/src/strife/d_main.c @@ -1824,7 +1824,7 @@ void D_DoomMain (void) if (gameaction != ga_loadgame ) { if (autostart || netgame) - G_InitNew (startskill, startepisode, startmap); + G_InitNew (startskill, startmap); else D_StartTitle (); // start up intro loop } diff --git a/src/strife/g_game.c b/src/strife/g_game.c index 26395bf1..990f92e3 100644 --- a/src/strife/g_game.c +++ b/src/strife/g_game.c @@ -53,6 +53,7 @@ #include "hu_stuff.h" #include "st_stuff.h" #include "am_map.h" +#include "m_misc.h" // STRIFE // Needs access to LFB. #include "v_video.h" @@ -82,7 +83,7 @@ boolean G_CheckDemoStatus (void); void G_ReadDemoTiccmd (ticcmd_t* cmd); void G_WriteDemoTiccmd (ticcmd_t* cmd); void G_PlayerReborn (int player); -void G_InitNew (skill_t skill, int episode, int map); +void G_InitNew (skill_t skill, int map); void G_DoReborn (int playernum); @@ -103,7 +104,7 @@ gameaction_t gameaction; gamestate_t gamestate; skill_t gameskill; boolean respawnmonsters; -int gameepisode; +//int gameepisode; int gamemap; // haleyjd 08/24/10: [STRIFE] New variables @@ -784,7 +785,7 @@ void G_DoLoadLevel (void) memset (players[i].frags,0,sizeof(players[i].frags)); } - P_SetupLevel (gameepisode, gamemap, 0, gameskill); + P_SetupLevel (gamemap, 0, gameskill); displayplayer = consoleplayer; // view the guy you are playing gameaction = ga_nothing; Z_CheckHeap (); @@ -1170,6 +1171,8 @@ void G_Ticker (void) // Called at the start. // Called by the game initialization functions. // +// [STRIFE] No such function. +/* void G_InitPlayer (int player) { player_t* p; @@ -1181,13 +1184,16 @@ void G_InitPlayer (int player) G_PlayerReborn (player); } - +*/ // // G_PlayerFinishLevel // Can when a player completes a level. // +// [STRIFE] No such function. The equivalent to this logic was moved into +// G_DoCompleted. +/* void G_PlayerFinishLevel (int player) { player_t* p; @@ -1202,13 +1208,16 @@ void G_PlayerFinishLevel (int player) p->damagecount = 0; // no palette changes p->bonuscount = 0; } - +*/ // // G_PlayerReborn // Called after a player dies // almost everything is cleared and initialized // +// [STRIFE] Small changes for allegiance, inventory, health auto-use, and +// mission objective. +// void G_PlayerReborn (int player) { player_t* p; @@ -1216,38 +1225,38 @@ void G_PlayerReborn (int player) int frags[MAXPLAYERS]; int killcount; int allegiance; - + killcount = players[player].killcount; allegiance = players[player].allegiance; memcpy(frags,players[player].frags,sizeof(frags)); - + p = &players[player]; memset (p, 0, sizeof(*p)); memcpy(p->frags, frags, sizeof(p->frags)); - p->usedown = true; // don't do anything immediately - p->attackdown = true; - p->inventorydown = true; // villsa [STRIFE] - p->playerstate = PST_LIVE; - p->health = deh_initial_health; // Use dehacked value - p->readyweapon = wp_fist; // villsa [STRIFE] default to fists - p->pendingweapon = wp_fist; // villsa [STRIFE] default to fists - p->weaponowned[wp_fist] = true; // villsa [STRIFE] default to fists - p->cheats |= CF_AUTOHEALTH; // villsa [STRIFE] - p->killcount = killcount; - p->allegiance = allegiance; // villsa [STRIFE] - p->centerview = true; // villsa [STRIFE] - + p->usedown = true; // don't do anything immediately + p->attackdown = true; + p->inventorydown = true; // villsa [STRIFE] + p->playerstate = PST_LIVE; + p->health = deh_initial_health; // Use dehacked value + p->readyweapon = wp_fist; // villsa [STRIFE] default to fists + p->pendingweapon = wp_fist; // villsa [STRIFE] default to fists + p->weaponowned[wp_fist] = true; // villsa [STRIFE] default to fists + p->cheats |= CF_AUTOHEALTH; // villsa [STRIFE] + p->killcount = killcount; + p->allegiance = allegiance; // villsa [STRIFE] + p->centerview = true; // villsa [STRIFE] + for(i = 0; i < NUMAMMO; i++) - p->maxammo[i] = maxammo[i]; + p->maxammo[i] = maxammo[i]; for(i = 0; i < 32; i++) p->inventory[i].type = NUMMOBJTYPES; // villsa [STRIFE] - strncpy(mission_objective, "Find help", OBJECTIVE_LEN); + strncpy(mission_objective, DEH_String("Find help"), OBJECTIVE_LEN); } // @@ -1256,6 +1265,8 @@ void G_PlayerReborn (int player) // at the given mapthing_t spot // because something is occupying it // +// [STRIFE] Changed to eliminate body queue and an odd error message was added. +// void P_SpawnPlayer (mapthing_t* mthing); boolean @@ -1263,46 +1274,54 @@ G_CheckSpot ( int playernum, mapthing_t* mthing ) { - fixed_t x; - fixed_t y; - subsector_t* ss; - unsigned an; - mobj_t* mo; - int i; - + fixed_t x; + fixed_t y; + subsector_t* ss; + unsigned an; + mobj_t* mo; + int i; + if (!players[playernum].mo) { - // first spawn of level, before corpses - for (i=0 ; ix == mthing->x << FRACBITS - && players[i].mo->y == mthing->y << FRACBITS) - return false; - return true; + // [STRIFE] weird error message added here: + if(leveltime > 0) + players[playernum].message = DEH_String("you didn't have a body!"); + + // first spawn of level, before corpses + for (i=0 ; ix == mthing->x << FRACBITS + && players[i].mo->y == mthing->y << FRACBITS) + return false; + return true; } - + x = mthing->x << FRACBITS; y = mthing->y << FRACBITS; - + if (!P_CheckPosition (players[playernum].mo, x, y) ) - return false; - - // flush an old corpse if needed + return false; + + // flush an old corpse if needed + // [STRIFE] player corpses remove themselves after a short time, so + // evidently this wasn't needed. + /* if (bodyqueslot >= BODYQUESIZE) - P_RemoveMobj (bodyque[bodyqueslot%BODYQUESIZE]); + P_RemoveMobj (bodyque[bodyqueslot%BODYQUESIZE]); bodyque[bodyqueslot%BODYQUESIZE] = players[playernum].mo; bodyqueslot++; - + */ + // spawn a teleport fog ss = R_PointInSubsector (x,y); an = ( ANG45 * (((unsigned int) mthing->angle)/45) ) >> ANGLETOFINESHIFT; - + mo = P_SpawnMobj (x+20*finecosine[an], y+20*finesine[an] - , ss->sector->floorheight - , MT_TFOG); - + , ss->sector->floorheight + , MT_TFOG); + if (players[consoleplayer].viewz != 1) - S_StartSound (mo, sfx_telept); // don't start sound on first frame - + S_StartSound (mo, sfx_telept); // don't start sound on first frame + return true; } @@ -1312,6 +1331,8 @@ G_CheckSpot // Spawns a player at one of the random death match spots // called at level load and each death // +// [STRIFE] Verified unmodified +// void G_DeathMatchSpawnPlayer (int playernum) { int i,j; @@ -1337,50 +1358,67 @@ void G_DeathMatchSpawnPlayer (int playernum) } // -// G_DoReborn +// G_LoadPath +// +// haleyjd 10/03/10: [STRIFE] New function +// Sets loadpath based on the map and "savepath2" +// +void G_LoadPath(int map) +{ + // STRIFE-TODO: + // sprintf(loadpath, "%s%d", savepath2, map) +} + +// +// G_DoReborn // void G_DoReborn (int playernum) { int i; - + if (!netgame) { - // reload the level from scratch - gameaction = ga_loadlevel; + // reload the level from scratch + // STRIFE-TODO: HUB REBORN + // G_LoadPath(gamemap); + // gameaction = 3; + gameaction = ga_loadlevel; // STRIFE-TODO: temporary } else { - // respawn at the start + // respawn at the start - // first dissasociate the corpse - players[playernum].mo->player = NULL; - - // spawn at random spot if in death match - if (deathmatch) - { - G_DeathMatchSpawnPlayer (playernum); - return; - } - - if (G_CheckSpot (playernum, &playerstarts[playernum]) ) - { - P_SpawnPlayer (&playerstarts[playernum]); - return; - } - - // try to spawn at one of the other players spots - for (i=0 ; iplayer = NULL; + + // spawn at random spot if in death match + if (deathmatch) + { + G_DeathMatchSpawnPlayer (playernum); + return; + } + + if (G_CheckSpot (playernum, &playerstarts[playernum]) ) + { + P_SpawnPlayer (&playerstarts[playernum]); + return; + } + + // try to spawn at one of the other players spots + for (i=0 ; i sk_nightmare) - skill = sk_nightmare; + skill = sk_nightmare; + // [STRIFE] Removed episode nonsense and gamemap clipping - // This was quite messy with SPECIAL and commented parts. - // Supposedly hacks to make the latest edition work. - // It might not work properly. - if (episode < 1) - episode = 1; + M_ClearRandom (); - if ( gamemode == retail ) - { - if (episode > 4) - episode = 4; - } - else if ( gamemode == shareware ) - { - if (episode > 1) - episode = 1; // only start episode 1 on shareware - } + if (skill == sk_nightmare || respawnparm ) + respawnmonsters = true; else + respawnmonsters = false; + + // STRIFE-TODO: Strife skill level mobjinfo/states tweaking + // BUG: None of this code runs properly when loading save games, so + // basically it's impossible to play any skill level properly unless + // you never quit and reload from the command line. +#if 0 + if(!skill && gameskill) { - if (episode > 3) - episode = 3; + // Setting to Baby skill... make things easier. } - +#endif - - if (map < 1) - map = 1; - - if ( (map > 9) - && ( gamemode != commercial) ) - map = 9; - - M_ClearRandom (); - - if (skill == sk_nightmare || respawnparm ) - respawnmonsters = true; - else - respawnmonsters = false; - - // STRIFE-TODO: (broken) Strife skill level mobjinfo/states tweaking - /*if (fastparm || (skill == sk_nightmare && gameskill != sk_nightmare) ) - { - for (i=S_SARG_RUN1 ; i<=S_SARG_PAIN2 ; i++) - states[i].tics >>= 1; - mobjinfo[MT_BRUISERSHOT].speed = 20*FRACUNIT; - mobjinfo[MT_HEADSHOT].speed = 20*FRACUNIT; - mobjinfo[MT_TROOPSHOT].speed = 20*FRACUNIT; - } - else if (skill != sk_nightmare && gameskill == sk_nightmare) - { - for (i=S_SARG_RUN1 ; i<=S_SARG_PAIN2 ; i++) - states[i].tics <<= 1; - mobjinfo[MT_BRUISERSHOT].speed = 15*FRACUNIT; - mobjinfo[MT_HEADSHOT].speed = 10*FRACUNIT; - mobjinfo[MT_TROOPSHOT].speed = 10*FRACUNIT; - } */ - - - // force players to be initialized upon first level load + // force players to be initialized upon first level load for (i=0 ; i= 9 && gamemap < 32) + skytexturename = "skymnt01"; else - { - switch (gameepisode) - { - default: - case 1: - skytexturename = "SKY03"; - break; - case 2: - skytexturename = "SKY03"; - break; - case 3: - skytexturename = "SKY03"; - break; - case 4: // Special Edition sky - skytexturename = "SKY03"; - break; - } - } + skytexturename = "skymnt02"; skytexturename = DEH_String(skytexturename); @@ -1933,7 +2041,7 @@ G_InitNew // STRIFE-TODO: // G_LoadPath(gamemap) - G_DoLoadLevel (); + G_DoLoadLevel (); } @@ -1942,32 +2050,26 @@ G_InitNew // #define DEMOMARKER 0x80 - +// +// G_ReadDemoTiccmd +// +// [STRIFE] Modified for Strife ticcmd_t +// void G_ReadDemoTiccmd (ticcmd_t* cmd) { if (*demo_p == DEMOMARKER) { - // end of demo data stream - G_CheckDemoStatus (); - return; - } + // end of demo data stream + G_CheckDemoStatus (); + return; + } cmd->forwardmove = ((signed char)*demo_p++); cmd->sidemove = ((signed char)*demo_p++); - - // If this is a longtics demo, read back in higher resolution - - if (longtics) - { - cmd->angleturn = *demo_p++; - cmd->angleturn |= (*demo_p++) << 8; - } - else - { - cmd->angleturn = ((unsigned char) *demo_p++)<<8; - } - + cmd->angleturn = ((unsigned char) *demo_p++)<<8; cmd->buttons = (unsigned char)*demo_p++; -} + cmd->buttons2 = (unsigned char)*demo_p++; // [STRIFE] + cmd->inventory = (int)*demo_p++; // [STRIFE] +} // Increase the size of the demo buffer to allow unlimited demos @@ -2001,31 +2103,26 @@ static void IncreaseDemoBuffer(void) demoend = demobuffer + new_length; } +// +// G_WriteDemoTiccmd +// +// [STRIFE] Modified for Strife ticcmd_t. +// void G_WriteDemoTiccmd (ticcmd_t* cmd) { byte *demo_start; if (gamekeydown[key_demo_quit]) // press q to end demo recording - G_CheckDemoStatus (); + G_CheckDemoStatus (); demo_start = demo_p; *demo_p++ = cmd->forwardmove; *demo_p++ = cmd->sidemove; - - // If this is a longtics demo, record in higher resolution - - if (longtics) - { - *demo_p++ = (cmd->angleturn & 0xff); - *demo_p++ = (cmd->angleturn >> 8) & 0xff; - } - else - { - *demo_p++ = cmd->angleturn >> 8; - } - + *demo_p++ = cmd->angleturn >> 8; *demo_p++ = cmd->buttons; + *demo_p++ = cmd->buttons2; // [STRIFE] + *demo_p++ = (byte)(cmd->inventory & 0xff); // [STRIFE] // reset demo pointer back demo_p = demo_start; @@ -2046,7 +2143,7 @@ void G_WriteDemoTiccmd (ticcmd_t* cmd) IncreaseDemoBuffer(); } } - + G_ReadDemoTiccmd (cmd); // make SURE it is exactly the same } @@ -2055,11 +2152,13 @@ void G_WriteDemoTiccmd (ticcmd_t* cmd) // // G_RecordDemo // +// [STRIFE] Verified unmodified +// void G_RecordDemo (char* name) { int i; - int maxsize; - + int maxsize; + usergame = false; strcpy (demoname, name); strcat (demoname, ".lmp"); @@ -2075,10 +2174,10 @@ void G_RecordDemo (char* name) i = M_CheckParm ("-maxdemo"); if (i && i= 0 && version <= 4) - { - return "v1.0/v1.1/v1.2"; - } - else - { - sprintf(resultbuf, "%i.%i (unknown)", version / 100, version % 100); - return resultbuf; - } + return resultbuf; } +// +// G_DoPlayDemo +// +// [STRIFE] Modified for Strife demo format. +// void G_DoPlayDemo (void) { skill_t skill; - int i, episode, map; - int demoversion; - + int i, map; + int demoversion; + gameaction = ga_nothing; demobuffer = demo_p = W_CacheLumpName (defdemoname, PU_STATIC); @@ -2191,18 +2281,20 @@ void G_DoPlayDemo (void) { longtics = false; } + /* STRIFE-TODO: Not until/unless somebody makes a Strife-Plus :P else if (demoversion == DOOM_191_VERSION) { // demo recorded with cph's modified "v1.91" doom exe longtics = true; } + */ else { char *message = "Demo is from a different game version!\n" "(read %i, should be %i)\n" "\n" "*** You may need to upgrade your version " - "of Doom to v1.9. ***\n" + "of Strife to v1.1 or later. ***\n" " See: http://doomworld.com/files/patches.shtml\n" " This appears to be %s."; @@ -2211,16 +2303,21 @@ void G_DoPlayDemo (void) } skill = *demo_p++; - episode = *demo_p++; + //episode = *demo_p++; [STRIFE] No episodes map = *demo_p++; deathmatch = *demo_p++; respawnparm = *demo_p++; fastparm = *demo_p++; nomonsters = *demo_p++; consoleplayer = *demo_p++; - + for (i=0 ; i 0) { - netgame = true; - netdemo = true; + netgame = true; + netdemo = true; } // don't spend a lot of time in loadlevel precache = false; - G_InitNew (skill, episode, map); + G_InitNew(skill, map); precache = true; starttime = I_GetTime (); @@ -2247,6 +2344,8 @@ void G_DoPlayDemo (void) // // G_TimeDemo // +// [STRIFE] Verified unmodified +// void G_TimeDemo (char* name) { //! @@ -2274,17 +2373,17 @@ void G_TimeDemo (char* name) = Returns true if a new demo loop action will take place =================== */ - +// [STRIFE] Verified unmodified boolean G_CheckDemoStatus (void) { int endtime; - + if (timingdemo) { float fps; int realtics; - endtime = I_GetTime (); + endtime = I_GetTime (); realtics = endtime - starttime; fps = ((float) gametic * TICRATE) / realtics; @@ -2292,42 +2391,42 @@ boolean G_CheckDemoStatus (void) timingdemo = false; demoplayback = false; - I_Error ("timed %i gametics in %i realtics (%f fps)", + I_Error ("timed %i gametics in %i realtics (%f fps)", gametic, realtics, fps); } - + if (demoplayback) { W_ReleaseLumpName(defdemoname); - demoplayback = false; - netdemo = false; - netgame = false; - deathmatch = false; - playeringame[1] = playeringame[2] = playeringame[3] = 0; - respawnparm = false; - fastparm = false; - nomonsters = false; - consoleplayer = 0; + demoplayback = false; + netdemo = false; + netgame = false; + deathmatch = false; + playeringame[1] = playeringame[2] = playeringame[3] = 0; + respawnparm = false; + fastparm = false; + nomonsters = false; + consoleplayer = 0; if (singledemo) I_Quit (); else D_AdvanceDemo (); - return true; + return true; } if (demorecording) { - *demo_p++ = DEMOMARKER; - M_WriteFile (demoname, demobuffer, demo_p - demobuffer); - Z_Free (demobuffer); - demorecording = false; - I_Error ("Demo %s recorded",demoname); + *demo_p++ = DEMOMARKER; + M_WriteFile (demoname, demobuffer, demo_p - demobuffer); + Z_Free (demobuffer); + demorecording = false; + I_Error ("Demo %s recorded",demoname); } - + return false; } - + diff --git a/src/strife/g_game.h b/src/strife/g_game.h index 52a1d2c7..b6220564 100644 --- a/src/strife/g_game.h +++ b/src/strife/g_game.h @@ -38,7 +38,8 @@ // void G_DeathMatchSpawnPlayer (int playernum); -void G_InitNew (skill_t skill, int episode, int map); +// [STRIFE] Removed episode parameter +void G_InitNew (skill_t skill, int map); // Can be called by the startup code or M_Responder. // A normal game starts at map 1, diff --git a/src/strife/p_setup.c b/src/strife/p_setup.c index 2145c5d5..b1a02b04 100644 --- a/src/strife/p_setup.c +++ b/src/strife/p_setup.c @@ -751,8 +751,7 @@ static void P_LoadReject(int lumpnum) // void P_SetupLevel -( int episode, - int map, +( int map, int playermask, skill_t skill) { @@ -789,28 +788,17 @@ P_SetupLevel // UNUSED W_Profile (); P_InitThinkers (); - - // find map name - if ( gamemode == commercial) - { - if (map<10) - DEH_snprintf(lumpname, 9, "map0%i", map); - else - DEH_snprintf(lumpname, 9, "map%i", map); - } + + // [STRIFE] Removed ExMy map support + if (map<10) + DEH_snprintf(lumpname, 9, "map0%i", map); else - { - lumpname[0] = 'E'; - lumpname[1] = '0' + episode; - lumpname[2] = 'M'; - lumpname[3] = '0' + map; - lumpname[4] = 0; - } + DEH_snprintf(lumpname, 9, "map%i", map); lumpnum = W_GetNumForName (lumpname); - + leveltime = 0; - + // note: most of this ordering is important P_LoadBlockMap (lumpnum+ML_BLOCKMAP); P_LoadVertexes (lumpnum+ML_VERTEXES); diff --git a/src/strife/p_setup.h b/src/strife/p_setup.h index 2241c1c3..1befd7ae 100644 --- a/src/strife/p_setup.h +++ b/src/strife/p_setup.h @@ -32,10 +32,10 @@ // NOT called by W_Ticker. Fixme. +// [STRIFE] Removed episode parameter void P_SetupLevel -( int episode, - int map, +( int map, int playermask, skill_t skill); -- cgit v1.2.3