Merge branch 'master' into gonesolong

Conflicts:
	src/CMakeLists.txt
	src/b_think.cpp
	src/g_doom/a_doomweaps.cpp
	src/g_hexen/a_clericstaff.cpp
	src/g_hexen/a_fighterplayer.cpp
	src/namedef.h
	src/p_enemy.cpp
	src/p_local.h
	src/p_mobj.cpp
	src/p_teleport.cpp
	src/sc_man_tokens.h
	src/thingdef/thingdef_codeptr.cpp
	src/thingdef/thingdef_function.cpp
	src/thingdef/thingdef_parse.cpp
	wadsrc/static/actors/actor.txt
	wadsrc/static/actors/constants.txt
	wadsrc/static/actors/shared/inventory.txt

- Added register reuse to VMFunctionBuilder for FxPick's code emitter.
- Note to self: Need to reimplement IsPointerEqual and CheckClass, which
  were added to thingdef_function.cpp over the past year, as this file no
  longer exists in this branch.
This commit is contained in:
Randy Heit 2014-12-21 20:43:24 -06:00
commit b5e4153c78
182 changed files with 23025 additions and 8730 deletions

View file

@ -76,6 +76,7 @@
#include "d_net.h"
#include "d_event.h"
#include "p_acs.h"
#include "p_effect.h"
#include "m_joy.h"
#include "farchive.h"
#include "r_renderer.h"
@ -115,6 +116,7 @@ CVAR (Bool, chasedemo, false, 0);
CVAR (Bool, storesavepic, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, longsavemessages, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (String, save_dir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
CVAR (Bool, cl_waitforsave, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
EXTERN_CVAR (Float, con_midtime);
//==========================================================================
@ -140,6 +142,7 @@ gameaction_t gameaction;
gamestate_t gamestate = GS_STARTUP;
int paused;
bool pauseext;
bool sendpause; // send a pause event next tic
bool sendsave; // send a save event next tic
bool sendturn180; // [RH] send a 180 degree turn next tic
@ -161,6 +164,8 @@ int consoleplayer; // player taking events
int gametic;
CVAR(Bool, demo_compress, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
FString newdemoname;
FString newdemomap;
FString demoname;
bool demorecording;
bool demoplayback;
@ -877,7 +882,7 @@ static void ChangeSpy (int changespy)
pnum &= MAXPLAYERS-1;
if (playeringame[pnum] &&
(!checkTeam || players[pnum].mo->IsTeammate (players[consoleplayer].mo) ||
(bot_allowspy && players[pnum].isbot)))
(bot_allowspy && players[pnum].Bot != NULL)))
{
break;
}
@ -1016,10 +1021,16 @@ void G_Ticker ()
// do player reborns if needed
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] &&
(players[i].playerstate == PST_REBORN || players[i].playerstate == PST_ENTER))
if (playeringame[i])
{
G_DoReborn (i, false);
if ((players[i].playerstate == PST_GONE))
{
G_DoPlayerPop(i);
}
if ((players[i].playerstate == PST_REBORN || players[i].playerstate == PST_ENTER))
{
G_DoReborn(i, false);
}
}
}
@ -1044,6 +1055,10 @@ void G_Ticker ()
case ga_loadlevel:
G_DoLoadLevel (-1, false);
break;
case ga_recordgame:
G_CheckDemoStatus();
G_RecordDemo(newdemoname);
G_BeginRecording(newdemomap);
case ga_newgame2: // Silence GCC (see above)
case ga_newgame:
G_DoNewGame ();
@ -1117,6 +1132,9 @@ void G_Ticker ()
// check, not just the player's x position like BOOM.
DWORD rngsum = FRandom::StaticSumSeeds ();
//Added by MC: For some of that bot stuff. The main bot function.
bglobal.Main ();
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
@ -1136,13 +1154,13 @@ void G_Ticker ()
// If the user alt-tabbed away, paused gets set to -1. In this case,
// we do not want to read more demo commands until paused is no
// longer negative.
if (demoplayback && paused >= 0)
if (demoplayback)
{
G_ReadDemoTiccmd (cmd, i);
}
else
{
memcpy (cmd, newcmd, sizeof(ticcmd_t));
memcpy(cmd, newcmd, sizeof(ticcmd_t));
}
// check for turbo cheats
@ -1152,7 +1170,7 @@ void G_Ticker ()
Printf ("%s is turbo!\n", players[i].userinfo.GetName());
}
if (netgame && !players[i].isbot && !demoplayback && (gametic%ticdup) == 0)
if (netgame && players[i].Bot == NULL && !demoplayback && (gametic%ticdup) == 0)
{
//players[i].inconsistant = 0;
if (gametic > BACKUPTICS*ticdup && consistancy[i][buf] != cmd->consistancy)
@ -1334,10 +1352,10 @@ void G_PlayerReborn (int player)
int chasecam;
BYTE currclass;
userinfo_t userinfo; // [RH] Save userinfo
botskill_t b_skill; //Added by MC:
APlayerPawn *actor;
PClassPlayerPawn *cls;
FString log;
DBot *Bot; //Added by MC:
p = &players[player];
@ -1347,18 +1365,19 @@ void G_PlayerReborn (int player)
itemcount = p->itemcount;
secretcount = p->secretcount;
currclass = p->CurrentPlayerClass;
b_skill = p->skill; //Added by MC:
userinfo.TransferFrom(p->userinfo);
actor = p->mo;
cls = p->cls;
log = p->LogText;
chasecam = p->cheats & CF_CHASECAM;
Bot = p->Bot; //Added by MC:
// Reset player structure to its defaults
p->~player_t();
::new(p) player_t;
memcpy (p->frags, frags, sizeof(p->frags));
p->health = actor->health;
p->fragcount = fragcount;
p->killcount = killcount;
p->itemcount = itemcount;
@ -1369,8 +1388,7 @@ void G_PlayerReborn (int player)
p->cls = cls;
p->LogText = log;
p->cheats |= chasecam;
p->skill = b_skill; //Added by MC:
p->Bot = Bot; //Added by MC:
p->oldbuttons = ~0, p->attackdown = true; p->usedown = true; // don't do anything immediately
p->original_oldbuttons = ~0;
@ -1378,15 +1396,19 @@ void G_PlayerReborn (int player)
if (gamestate != GS_TITLELEVEL)
{
// [GRB] Give inventory specified in DECORATE
actor->GiveDefaultInventory ();
p->ReadyWeapon = p->PendingWeapon;
}
//Added by MC: Init bot structure.
if (bglobal.botingame[player])
bglobal.CleanBotstuff (p);
else
p->isbot = false;
//Added by MC: Init bot structure.
if (p->Bot != NULL)
{
botskill_t skill = p->Bot->skill;
p->Bot->Clear ();
p->Bot->player = p;
p->Bot->skill = skill;
}
}
//
@ -1661,6 +1683,56 @@ void G_DoReborn (int playernum, bool freshbot)
}
}
//
// G_DoReborn
//
void G_DoPlayerPop(int playernum)
{
playeringame[playernum] = false;
if (deathmatch)
{
Printf("%s left the game with %d frags\n",
players[playernum].userinfo.GetName(),
players[playernum].fragcount);
}
else
{
Printf("%s left the game\n", players[playernum].userinfo.GetName());
}
// [RH] Revert each player to their own view if spying through the player who left
for (int ii = 0; ii < MAXPLAYERS; ++ii)
{
if (playeringame[ii] && players[ii].camera == players[playernum].mo)
{
players[ii].camera = players[ii].mo;
if (ii == consoleplayer && StatusBar != NULL)
{
StatusBar->AttachToPlayer(&players[ii]);
}
}
}
// [RH] Make the player disappear
FBehavior::StaticStopMyScripts(players[playernum].mo);
if (players[playernum].mo != NULL)
{
P_DisconnectEffect(players[playernum].mo);
players[playernum].mo->player = NULL;
players[playernum].mo->Destroy();
if (!(players[playernum].mo->ObjectFlags & OF_EuthanizeMe))
{ // We just destroyed a morphed player, so now the original player
// has taken their place. Destroy that one too.
players[playernum].mo->Destroy();
}
players[playernum].mo = NULL;
players[playernum].camera = NULL;
}
// [RH] Let the scripts know the player left
FBehavior::StaticStartTypedScripts(SCRIPT_Disconnect, NULL, true, playernum);
}
void G_ScreenShot (char *filename)
{
shotfile = filename;
@ -2079,6 +2151,9 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
filename = G_BuildSaveName ("demosave.zds", -1);
}
if (cl_waitforsave)
I_FreezeTime(true);
insave = true;
G_SnapshotLevel ();
@ -2088,6 +2163,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
{
Printf ("Could not create savegame '%s'\n", filename.GetChars());
insave = false;
I_FreezeTime(false);
return;
}
@ -2164,6 +2240,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
}
insave = false;
I_FreezeTime(false);
}
@ -2376,6 +2453,16 @@ void G_DeferedPlayDemo (const char *name)
CCMD (playdemo)
{
if (netgame)
{
Printf("End your current netgame first!");
return;
}
if (demorecording)
{
Printf("End your current demo first!");
return;
}
if (argv.argc() > 1)
{
G_DeferedPlayDemo (argv[1]);
@ -2558,7 +2645,7 @@ void G_DoPlayDemo (void)
{
FixPathSeperator (defdemoname);
DefaultExtension (defdemoname, ".lmp");
M_ReadFile (defdemoname, &demobuffer);
M_ReadFileMalloc (defdemoname, &demobuffer);
}
demo_p = demobuffer;