- Added Karate Chris's new DMFlags submission.

SVN r1333 (trunk)
This commit is contained in:
Christoph Oelckers 2008-12-28 09:49:15 +00:00
parent 37d056c041
commit 8f686a5e02
11 changed files with 123 additions and 10 deletions

View file

@ -1,3 +1,6 @@
December 28, 2008 (Changes by Graf Zahl)
- Added Karate Chris's new DMFlags submission.
December 27, 2008 (Changes by Graf Zahl)
- Fixed: The correct player class was not remembered when the menu had both
a player class selection menu and an episode menu.

View file

@ -863,6 +863,10 @@ void AM_ToggleMap ()
if (gamestate != GS_LEVEL)
return;
// Don't activate the automap if we're not allowed to use it.
if (dmflags2 & DF2_NO_AUTOMAP)
return;
SB_state = screen->GetPageCount ();
if (!automapactive)
{
@ -1573,6 +1577,10 @@ void AM_drawPlayers ()
continue;
}
// We don't always want to show allies on the automap.
if (dmflags2 & DF2_NO_AUTOMAP_ALLIES && i != consoleplayer)
continue;
if (deathmatch && !demoplayback &&
!p->mo->IsTeammate (players[consoleplayer].mo) &&
p != players[consoleplayer].camera->player)

View file

@ -232,7 +232,8 @@ CCMD (chase)
}
else
{
if (gamestate == GS_LEVEL && deathmatch && CheckCheatmode ())
// Check if we're allowed to use chasecam.
if (gamestate != GS_LEVEL || (!(dmflags2 & DF2_CHASECAM) && CheckCheatmode ()))
return;
Net_WriteByte (DEM_GENERICCHEAT);

View file

@ -99,6 +99,7 @@
#include "d_event.h"
#include "d_netinf.h"
#include "v_palette.h"
#include "m_cheat.h"
EXTERN_CVAR(Bool, hud_althud)
void DrawHUD();
@ -114,6 +115,7 @@ extern void M_SetDefaultMode ();
extern void R_ExecuteSetViewSize ();
extern void G_NewInit ();
extern void SetupPlayerClasses ();
extern bool CheckCheatmode ();
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@ -139,6 +141,7 @@ EXTERN_CVAR (Float, m_yaw)
EXTERN_CVAR (Bool, invertmouse)
EXTERN_CVAR (Bool, lookstrafe)
EXTERN_CVAR (Int, screenblocks)
EXTERN_CVAR (Bool, sv_cheats)
extern gameinfo_t SharewareGameInfo;
extern gameinfo_t RegisteredGameInfo;
@ -440,7 +443,58 @@ CVAR (Flag, sv_allowcrouch, dmflags, DF_YES_CROUCH);
//
//==========================================================================
CVAR (Int, dmflags2, 0, CVAR_SERVERINFO);
CUSTOM_CVAR (Int, dmflags2, 0, CVAR_SERVERINFO)
{
// Stop the automap if we aren't allowed to use it.
if ((self & DF2_NO_AUTOMAP) && automapactive)
AM_Stop ();
for (int i = 0; i < MAXPLAYERS; i++)
{
player_t *p = &players[i];
if (!playeringame[i])
continue;
// Revert our view to our own eyes if spying someone else.
if (self & DF2_DISALLOW_SPYING)
{
// The player isn't looking through its own eyes, so make it.
if (p->camera != p->mo)
{
p->camera = p->mo;
S_UpdateSounds (p->camera);
StatusBar->AttachToPlayer (p);
if (demoplayback || multiplayer)
StatusBar->ShowPlayerName ();
}
}
// Come out of chasecam mode if we're not allowed to use chasecam.
if (!(dmflags2 & DF2_CHASECAM) && !G_SkillProperty (SKILLP_DisableCheats) && !sv_cheats)
{
// Take us out of chasecam mode only.
if (p->cheats & CF_CHASECAM)
cht_DoCheat (p, CHT_CHASECAM);
}
// Change our autoaim settings if need be.
if (dmflags2 & DF2_NOAUTOAIM)
{
// Save our aimdist and set aimdist to 0.
p->userinfo.savedaimdist = p->userinfo.aimdist;
p->userinfo.aimdist = 0;
}
else
{
// Restore our aimdist.
p->userinfo.aimdist = p->userinfo.savedaimdist;
}
}
}
CVAR (Flag, sv_weapondrop, dmflags2, DF2_YES_WEAPONDROP);
CVAR (Flag, sv_noteamswitch, dmflags2, DF2_NO_TEAM_SWITCH);
CVAR (Flag, sv_doubleammo, dmflags2, DF2_YES_DOUBLEAMMO);
@ -452,7 +506,14 @@ CVAR (Flag, sv_norespawn, dmflags2, DF2_NO_RESPAWN);
CVAR (Flag, sv_losefrag, dmflags2, DF2_YES_LOSEFRAG);
CVAR (Flag, sv_respawnprotect, dmflags2, DF2_YES_RESPAWN_INVUL);
CVAR (Flag, sv_samespawnspot, dmflags2, DF2_SAME_SPAWN_SPOT);
CVAR (Flag, sv_infiniteinventory, dmflags2, DF2_INFINITE_INVENTORY)
CVAR (Flag, sv_infiniteinventory, dmflags2, DF2_INFINITE_INVENTORY);
CVAR (Flag, sv_killallmonsters, dmflags2, DF2_KILL_MONSTERS);
CVAR (Flag, sv_noautomap, dmflags2, DF2_NO_AUTOMAP);
CVAR (Flag, sv_noautomapallies, dmflags2, DF2_NO_AUTOMAP_ALLIES);
CVAR (Flag, sv_disallowspying, dmflags2, DF2_DISALLOW_SPYING);
CVAR (Flag, sv_chasecam, dmflags2, DF2_CHASECAM);
CVAR (Flag, sv_disallowsuicide, dmflags2, DF2_NOSUICIDE);
CVAR (Flag, sv_noautoaim, dmflags2, DF2_NOAUTOAIM);
//==========================================================================
//

View file

@ -370,10 +370,16 @@ void D_SetupUserInfo ()
}
if (autoaim > 35.f || autoaim < 0.f)
{
if (dmflags & DF2_NOAUTOAIM)
coninfo->savedaimdist = ANGLE_1*35;
else
coninfo->aimdist = ANGLE_1*35;
}
else
{
if (dmflags & DF2_NOAUTOAIM)
coninfo->savedaimdist = abs ((int)(autoaim * (float)ANGLE_1));
else
coninfo->aimdist = abs ((int)(autoaim * (float)ANGLE_1));
}
coninfo->color = color;
@ -684,10 +690,16 @@ void D_ReadUserInfoStrings (int i, BYTE **stream, bool update)
angles = atof (value);
if (angles > 35.f || angles < 0.f)
{
if (dmflags & DF2_NOAUTOAIM)
info->savedaimdist = ANGLE_1*35;
else
info->aimdist = ANGLE_1*35;
}
else
{
if (dmflags & DF2_NOAUTOAIM)
info->savedaimdist = abs ((int)(angles * (float)ANGLE_1));
else
info->aimdist = abs ((int)(angles * (float)ANGLE_1));
}
}
@ -804,6 +816,8 @@ FArchive &operator<< (FArchive &arc, userinfo_t &info)
arc.Read (&info.netname, sizeof(info.netname));
}
arc << info.team << info.aimdist << info.color << info.skin << info.gender << info.neverswitch;
if (SaveVersion >= 1333) arc << info.savedaimdist;
else info.savedaimdist = info.aimdist;
return arc;
}

View file

@ -195,6 +195,7 @@ struct userinfo_t
{
char netname[MAXPLAYERNAME+1];
BYTE team;
int savedaimdist;
int aimdist;
int color;
int skin;

View file

@ -243,12 +243,17 @@ enum
DF2_YES_RESPAWN_INVUL = 1 << 10, // Player is temporarily invulnerable when respawned
// DF2_COOP_SHOTGUNSTART = 1 << 11, // All playres start with a shotgun when they respawn
DF2_SAME_SPAWN_SPOT = 1 << 12, // Players respawn in the same place they died (co-op)
DF2_YES_KEEPFRAGS = 1 << 13, // Don't clear frags after each level
DF2_NO_RESPAWN = 1 << 14, // Player cannot respawn
DF2_YES_LOSEFRAG = 1 << 15, // Lose a frag when killed. More incentive to try to
// // not get yerself killed
DF2_YES_LOSEFRAG = 1 << 15, // Lose a frag when killed. More incentive to try to not get yerself killed
DF2_INFINITE_INVENTORY = 1 << 16, // Infinite inventory.
DF2_KILL_MONSTERS = 1 << 17, // All monsters must be killed before the level exits.
DF2_NO_AUTOMAP = 1 << 18, // Players are allowed to see the automap.
DF2_NO_AUTOMAP_ALLIES = 1 << 19, // Allies can been seen on the automap.
DF2_DISALLOW_SPYING = 1 << 20, // You can spy on your allies.
DF2_CHASECAM = 1 << 21, // Players can use the chasecam cheat.
DF2_NOSUICIDE = 1 << 22, // Players are allowed to suicide.
DF2_NOAUTOAIM = 1 << 23, // Players cannot use autoaim.
};
// [RH] Compatibility flags.

View file

@ -724,6 +724,10 @@ static void ChangeSpy (bool forward)
return;
}
// We may not be allowed to spy on anyone.
if (dmflags2 & DF2_DISALLOW_SPYING)
return;
// Otherwise, cycle to the next player.
bool checkTeam = !demoplayback && deathmatch;
int pnum = players[consoleplayer].camera->player - players;

View file

@ -1028,17 +1028,25 @@ static menuitem_t DMFlagsItems[] = {
{ bitflag, "Infinite ammo", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_INFINITE_AMMO} },
{ bitflag, "Infinite inventory", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_INFINITE_INVENTORY} },
{ bitflag, "No monsters", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_NO_MONSTERS} },
{ bitflag, "No monsters to exit", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_KILL_MONSTERS} },
{ bitflag, "Monsters respawn", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_MONSTERS_RESPAWN} },
{ bitflag, "No respawn", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_NO_RESPAWN} },
{ bitflag, "Items respawn", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_ITEMS_RESPAWN} },
{ bitflag, "Big powerups respawn", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_RESPAWN_SUPER} },
{ bitflag, "Fast monsters", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_FAST_MONSTERS} },
{ bitflag, "Degeneration", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_YES_DEGENERATION} },
{ bitflag, "Allow Autoaim", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_NOAUTOAIM} },
{ bitflag, "Disallow Suicide", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_NOSUICIDE} },
{ bitmask, "Allow jump", {&dmflags}, {3.0}, {DF_NO_JUMP|DF_YES_JUMP}, {0}, {DF_Jump} },
{ bitmask, "Allow crouch", {&dmflags}, {3.0}, {DF_NO_CROUCH|DF_YES_CROUCH}, {0}, {DF_Crouch} },
{ bitflag, "Allow freelook", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_FREELOOK} },
{ bitflag, "Allow FOV", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_FOV} },
{ bitflag, "Allow BFG aiming", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_NO_FREEAIMBFG} },
{ bitflag, "Allow automap", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_NO_AUTOMAP} },
{ bitflag, "Automap allies", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_NO_AUTOMAP_ALLIES} },
{ bitflag, "Allow spying", {&dmflags2}, {1}, {0}, {0}, {(value_t *)DF2_DISALLOW_SPYING} },
{ bitflag, "Chasecam cheat", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_CHASECAM} },
{ redtext, " ", {NULL}, {0}, {0}, {0}, {NULL} },
{ whitetext,"Deathmatch Settings", {NULL}, {0}, {0}, {0}, {NULL} },
{ bitflag, "Weapons stay", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_WEAPONS_STAY} },

View file

@ -1451,6 +1451,10 @@ CCMD (kill)
}
else
{
// If suiciding is disabled, then don't do it.
if (dmflags2 & DF2_NOSUICIDE)
return;
// Kill the player
Net_WriteByte (DEM_SUICIDE);
}

View file

@ -135,6 +135,10 @@ bool CheckIfExitIsGood (AActor *self, level_info_t *info)
if (self == NULL)
return true;
// We must kill all monsters to exit the level.
if ((dmflags2 & DF2_KILL_MONSTERS) && level.killed_monsters != level.total_monsters)
return false;
// Is this a deathmatch game and we're not allowed to exit?
if ((deathmatch || alwaysapplydmflags) && (dmflags & DF_NO_EXIT))
{