Cleanup for some CGameRules method types. Moved some Util_ functions into their own file.
This commit is contained in:
parent
c3be8002ad
commit
878df0941e
18 changed files with 135 additions and 127 deletions
|
@ -160,7 +160,7 @@ Scores_Draw(void)
|
||||||
pos = video_mins + [(video_res[0] / 2) - 145, 30];
|
pos = video_mins + [(video_res[0] / 2) - 145, 30];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Util_IsTeamPlay()) {
|
if (Util_IsTeamplay()) {
|
||||||
Scores_DrawTeam(pl, pos);
|
Scores_DrawTeam(pl, pos);
|
||||||
} else {
|
} else {
|
||||||
Scores_DrawNormal(pl, pos);
|
Scores_DrawNormal(pl, pos);
|
||||||
|
|
|
@ -43,5 +43,5 @@ class MultiplayerRules:GameRules
|
||||||
/* client */
|
/* client */
|
||||||
virtual void(NSClientPlayer) PlayerSpawn;
|
virtual void(NSClientPlayer) PlayerSpawn;
|
||||||
virtual void(NSClientPlayer) PlayerDeath;
|
virtual void(NSClientPlayer) PlayerDeath;
|
||||||
virtual float(NSClientPlayer, string) ConsoleCommand;
|
virtual bool(NSClientPlayer, string) ConsoleCommand;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var int autocvar_sv_playerkeepalive = TRUE;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GameRules::LevelDecodeParms(NSClientPlayer pp)
|
GameRules::LevelDecodeParms(NSClientPlayer pp)
|
||||||
{
|
{
|
||||||
|
|
1
base/src/server/progs.src
Executable file → Normal file
1
base/src/server/progs.src
Executable file → Normal file
|
@ -30,7 +30,6 @@ client.qc
|
||||||
server.qc
|
server.qc
|
||||||
damage.qc
|
damage.qc
|
||||||
items.qc
|
items.qc
|
||||||
rules.qc
|
|
||||||
flashlight.qc
|
flashlight.qc
|
||||||
modelevent.qc
|
modelevent.qc
|
||||||
spawn.qc
|
spawn.qc
|
||||||
|
|
|
@ -166,7 +166,7 @@ bot::SeeThink(void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* ain't go hurt our brothers and sisters */
|
/* ain't go hurt our brothers and sisters */
|
||||||
if (rules.IsTeamPlay() == TRUE)
|
if (rules.IsTeamplay() == TRUE)
|
||||||
if (team == w.team)
|
if (team == w.team)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ bot::Pain(void)
|
||||||
|
|
||||||
super::Pain();
|
super::Pain();
|
||||||
|
|
||||||
if (rules.IsTeamPlay()) {
|
if (rules.IsTeamplay()) {
|
||||||
if (g_dmg_eAttacker.flags & FL_CLIENT && g_dmg_eAttacker.team == team) {
|
if (g_dmg_eAttacker.flags & FL_CLIENT && g_dmg_eAttacker.team == team) {
|
||||||
ChatSayTeam("Stop shooting me!");
|
ChatSayTeam("Stop shooting me!");
|
||||||
return;
|
return;
|
||||||
|
@ -143,7 +143,7 @@ BotLib_Alert(vector pos, float radius, float t)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* if they're our friend... ignore*/
|
/* if they're our friend... ignore*/
|
||||||
if (rules.IsTeamPlay())
|
if (rules.IsTeamplay())
|
||||||
if (w.team == t)
|
if (w.team == t)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ Route_SelectDestination(bot target)
|
||||||
|
|
||||||
entity dest = world;
|
entity dest = world;
|
||||||
|
|
||||||
if (rules.IsTeamPlay()) {
|
if (rules.IsTeamplay()) {
|
||||||
/* we have the goal item, so capture it */
|
/* we have the goal item, so capture it */
|
||||||
if (target.flags & FL_GOALITEM) {
|
if (target.flags & FL_GOALITEM) {
|
||||||
print(sprintf("%s going for capture\n", target.netname));
|
print(sprintf("%s going for capture\n", target.netname));
|
||||||
|
|
|
@ -116,7 +116,7 @@ trigger_multiple::Touch(entity eToucher)
|
||||||
if (!HasSpawnFlags(TM_PUSHABLES) && eToucher.classname == "func_pushable")
|
if (!HasSpawnFlags(TM_PUSHABLES) && eToucher.classname == "func_pushable")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Rules_IsTeamPlay() == TRUE) {
|
if (g_grMode.IsTeamplay() == TRUE) {
|
||||||
if (m_iTeam > 0 && eActivator.team != m_iTeam + 1) {
|
if (m_iTeam > 0 && eActivator.team != m_iTeam + 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,7 @@ void
|
||||||
NSEntity::TouchHandler(void)
|
NSEntity::TouchHandler(void)
|
||||||
{
|
{
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
if (g_grMode.IsTeamPlay())
|
if (g_grMode.IsTeamplay())
|
||||||
if (m_iTeam > 0)
|
if (m_iTeam > 0)
|
||||||
if (m_iTeam != other.team) {
|
if (m_iTeam != other.team) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var int g_initialized = FALSE;
|
var bool g_initialized = false;
|
||||||
|
|
||||||
#define FN_UPDATE_PKGLIST "http://www.frag-net.com/dl/%s_packages"
|
#define FN_UPDATE_PKGLIST "http://www.frag-net.com/dl/%s_packages"
|
||||||
|
|
||||||
const string LICENSE_TEXT = "\
|
const string LICENSE_TEXT = "\
|
||||||
==============================================================================\
|
==============================================================================\
|
||||||
Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>\
|
Copyright (c) 2016-2022 Marco Cawthorne <marco@vera-visions.com>\
|
||||||
\
|
\
|
||||||
Permission to use, copy, modify, and distribute this software for any\
|
Permission to use, copy, modify, and distribute this software for any\
|
||||||
purpose with or without fee is hereby granted, provided that the above\
|
purpose with or without fee is hereby granted, provided that the above\
|
||||||
|
@ -69,12 +69,12 @@ void
|
||||||
Menu_GammaHack(void)
|
Menu_GammaHack(void)
|
||||||
{
|
{
|
||||||
if (cvar("brightness") != cvar("vid_brightness")) {
|
if (cvar("brightness") != cvar("vid_brightness")) {
|
||||||
cvar_set("brightness", "0");
|
localcmd("seta brightness 0\n");
|
||||||
print("^1Menu_RendererRestarted^7: Brightness hack.\n");
|
print("^1Menu_RendererRestarted^7: Brightness hack.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cvar("gamma") != cvar("vid_gamma")) {
|
if (cvar("gamma") != cvar("vid_gamma")) {
|
||||||
cvar_set("gamma", "1");
|
localcmd("seta gamma 1\n");
|
||||||
print("^1Menu_RendererRestarted^7: Gamma hack.\n");
|
print("^1Menu_RendererRestarted^7: Gamma hack.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,6 @@ m_init(void)
|
||||||
|
|
||||||
Colors_Init();
|
Colors_Init();
|
||||||
Strings_Init();
|
Strings_Init();
|
||||||
g_initialized = TRUE;
|
|
||||||
|
|
||||||
if (games[gameinfo_current].gamedir != "valve" || games[gameinfo_current].steambg == 1) {
|
if (games[gameinfo_current].gamedir != "valve" || games[gameinfo_current].steambg == 1) {
|
||||||
m_intro_skip();
|
m_intro_skip();
|
||||||
|
@ -166,6 +165,8 @@ m_init(void)
|
||||||
string mapname = games[gameinfo_current].menumap;
|
string mapname = games[gameinfo_current].menumap;
|
||||||
localcmd(strcat("map_background ", mapname, "\n"));
|
localcmd(strcat("map_background ", mapname, "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called upon vid_reload, vid_restart, but not menu init/restart */
|
/* called upon vid_reload, vid_restart, but not menu init/restart */
|
||||||
|
@ -180,7 +181,8 @@ Menu_RendererRestarted(string rendererdesc)
|
||||||
void
|
void
|
||||||
m_shutdown(void)
|
m_shutdown(void)
|
||||||
{
|
{
|
||||||
g_initialized = FALSE;
|
g_initialized = false;
|
||||||
|
|
||||||
/*int i = 0;
|
/*int i = 0;
|
||||||
for (i = 0; i < g_bmp.length; i++) {
|
for (i = 0; i < g_bmp.length; i++) {
|
||||||
freepic(g_bmp[i]);
|
freepic(g_bmp[i]);
|
||||||
|
@ -204,10 +206,12 @@ m_draw(vector screensize)
|
||||||
static float oldtime;
|
static float oldtime;
|
||||||
frametime = time - oldtime;
|
frametime = time - oldtime;
|
||||||
|
|
||||||
if (g_initialized == FALSE) {
|
/* don't attempt to draw unless we're done loading everything */
|
||||||
|
if (g_initialized == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set new scale whenever the resolution changes */
|
||||||
if ((screensize[0] != g_vidsize[0]) || (screensize[1] != g_vidsize[1])) {
|
if ((screensize[0] != g_vidsize[0]) || (screensize[1] != g_vidsize[1])) {
|
||||||
g_vidsize[0] = screensize[0];
|
g_vidsize[0] = screensize[0];
|
||||||
g_vidsize[1] = screensize[1];
|
g_vidsize[1] = screensize[1];
|
||||||
|
@ -230,6 +234,7 @@ m_draw(vector screensize)
|
||||||
/* to prevent TCP timeouts */
|
/* to prevent TCP timeouts */
|
||||||
menu_chatrooms_keepalive();
|
menu_chatrooms_keepalive();
|
||||||
|
|
||||||
|
/* clear rich presence whenever the state suddenly changes */
|
||||||
if (g_gamestate != clientstate()) {
|
if (g_gamestate != clientstate()) {
|
||||||
g_gamestate = clientstate();
|
g_gamestate = clientstate();
|
||||||
|
|
||||||
|
@ -245,6 +250,7 @@ m_draw(vector screensize)
|
||||||
RichPresence_Set("status", "Main Menu");
|
RichPresence_Set("status", "Main Menu");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if the menu is not visible and we're no background map... */
|
||||||
if (!g_active && !g_background) {
|
if (!g_active && !g_background) {
|
||||||
/* make sure we're redirecting input when the background's gone */
|
/* make sure we're redirecting input when the background's gone */
|
||||||
if (getkeydest() != KEY_GAME) {
|
if (getkeydest() != KEY_GAME) {
|
||||||
|
@ -252,21 +258,28 @@ m_draw(vector screensize)
|
||||||
setmousetarget(TARGET_CLIENT);
|
setmousetarget(TARGET_CLIENT);
|
||||||
setcursormode(FALSE);
|
setcursormode(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* don't draw the menu below */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* when ingame, we'll draw a slight black tint... */
|
||||||
if (clientstate() == 2) {
|
if (clientstate() == 2) {
|
||||||
|
/* ...unless we're in background map mode. */
|
||||||
if (!g_background)
|
if (!g_background)
|
||||||
drawfill([0,0], screensize, [0,0,0], 0.75f);
|
drawfill([0,0], screensize, [0,0,0], 0.75f);
|
||||||
} else {
|
} else {
|
||||||
|
/* clear screen */
|
||||||
drawfill([0,0], screensize, [0,0,0], 1.0f);
|
drawfill([0,0], screensize, [0,0,0], 1.0f);
|
||||||
|
|
||||||
|
/* draw either WON or Steam background */
|
||||||
if (games[gameinfo_current].steambg == 0)
|
if (games[gameinfo_current].steambg == 0)
|
||||||
Background_WON();
|
Background_WON();
|
||||||
else
|
else
|
||||||
Background_Steam();
|
Background_Steam();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* water mark for version info */
|
||||||
const string ver = "Nuclide (build " __DATE__ ")";
|
const string ver = "Nuclide (build " __DATE__ ")";
|
||||||
drawfont = Font_GetID(font_console);
|
drawfont = Font_GetID(font_console);
|
||||||
|
|
||||||
|
@ -277,6 +290,7 @@ m_draw(vector screensize)
|
||||||
[1.0f,1.0f,1.0f],
|
[1.0f,1.0f,1.0f],
|
||||||
0.5f, 0, font_console);
|
0.5f, 0, font_console);
|
||||||
|
|
||||||
|
/* draw the actual widgets */
|
||||||
main_draw();
|
main_draw();
|
||||||
|
|
||||||
#ifndef WEBMENU
|
#ifndef WEBMENU
|
||||||
|
@ -287,6 +301,7 @@ m_draw(vector screensize)
|
||||||
localcmd(sprintf("gameinfo_gamedir %s\nmenu_restart\n", cvar_string("fs_game")));
|
localcmd(sprintf("gameinfo_gamedir %s\nmenu_restart\n", cvar_string("fs_game")));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
oldtime = time;
|
oldtime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ Client_FixAngle(entity target, vector ang)
|
||||||
WriteFloat(MSG_MULTICAST, ang[1]);
|
WriteFloat(MSG_MULTICAST, ang[1]);
|
||||||
WriteFloat(MSG_MULTICAST, ang[2]);
|
WriteFloat(MSG_MULTICAST, ang[2]);
|
||||||
msg_entity = target;
|
msg_entity = target;
|
||||||
multicast([0,0,0], MULTICAST_ONE);
|
multicast([0,0,0], MULTICAST_ONE_R);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#define AREAPORTAL_CLOSED 0
|
#define AREAPORTAL_CLOSED 0
|
||||||
#define AREAPORTAL_OPEN 1
|
#define AREAPORTAL_OPEN 1
|
||||||
|
|
||||||
var int autocvar_mp_flashlight = TRUE;
|
var bool autocvar_mp_flashlight = true;
|
||||||
|
|
||||||
void FX_Impact(impactType_t, vector, vector);
|
void FX_Impact(impactType_t, vector, vector);
|
||||||
void FX_Explosion(vector);
|
void FX_Explosion(vector);
|
||||||
|
@ -66,7 +66,6 @@ void Client_ShakeOnce(vector, float, float, float, float);
|
||||||
void Game_ServerModelEvent(float, int, string);
|
void Game_ServerModelEvent(float, int, string);
|
||||||
void Event_ServerModelEvent(float, int, string);
|
void Event_ServerModelEvent(float, int, string);
|
||||||
|
|
||||||
int Rules_IsTeamPlay(void);
|
|
||||||
void Mapcycle_Load(string);
|
void Mapcycle_Load(string);
|
||||||
|
|
||||||
entity eActivator;
|
entity eActivator;
|
||||||
|
@ -74,7 +73,7 @@ entity eActivator;
|
||||||
/* Generic entity fields */
|
/* Generic entity fields */
|
||||||
.void(void) PlayerUse;
|
.void(void) PlayerUse;
|
||||||
.void(void) PlayerUseUnpressed;
|
.void(void) PlayerUseUnpressed;
|
||||||
.int iBleeds;
|
.bool iBleeds;
|
||||||
.entity eUser;
|
.entity eUser;
|
||||||
.float material;
|
.float material;
|
||||||
.float deaths;
|
.float deaths;
|
||||||
|
@ -99,7 +98,7 @@ bodyType_t g_dmg_iHitBody;
|
||||||
int g_dmg_iFlags;
|
int g_dmg_iFlags;
|
||||||
int g_dmg_iWeapon;
|
int g_dmg_iWeapon;
|
||||||
|
|
||||||
var int g_ents_initialized = FALSE;
|
var bool g_ents_initialized = FALSE;
|
||||||
|
|
||||||
/* main is a qcc leftover */
|
/* main is a qcc leftover */
|
||||||
void main(void)
|
void main(void)
|
||||||
|
|
|
@ -26,7 +26,7 @@ class CGameRules
|
||||||
|
|
||||||
/* logic */
|
/* logic */
|
||||||
virtual void(void) FrameStart;
|
virtual void(void) FrameStart;
|
||||||
virtual float(NSClientPlayer,string) ConsoleCommand;
|
virtual bool(NSClientPlayer,string) ConsoleCommand;
|
||||||
|
|
||||||
/* client */
|
/* client */
|
||||||
virtual void(NSClientPlayer) PlayerConnect;
|
virtual void(NSClientPlayer) PlayerConnect;
|
||||||
|
@ -45,18 +45,19 @@ class CGameRules
|
||||||
|
|
||||||
/* Entities/Item manipulation */
|
/* Entities/Item manipulation */
|
||||||
virtual int(int) MaxItemPerSlot;
|
virtual int(int) MaxItemPerSlot;
|
||||||
virtual int(void) MonstersSpawn;
|
virtual bool(void) MonstersSpawn;
|
||||||
virtual void(entity,entity,float,int,damageType_t) DamageApply;
|
virtual void(entity,entity,float,int,damageType_t) DamageApply;
|
||||||
virtual int(entity, vector) DamageCheckTrace;
|
virtual bool(entity, vector) DamageCheckTrace;
|
||||||
virtual void(vector,entity,float,float,int,int) DamageRadius;
|
virtual void(vector,entity,float,float,int,int) DamageRadius;
|
||||||
|
|
||||||
/* end of a game */
|
/* end of a game */
|
||||||
virtual void(void) IntermissionStart;
|
virtual void(void) IntermissionStart;
|
||||||
virtual void(void) IntermissionCycle;
|
virtual void(void) IntermissionCycle;
|
||||||
virtual void(void) IntermissionEnd;
|
virtual void(void) IntermissionEnd;
|
||||||
virtual int(void) InIntermission;
|
virtual bool(void) InIntermission;
|
||||||
|
|
||||||
virtual float(void) IsTeamPlay;
|
virtual bool(void) IsTeamplay;
|
||||||
|
virtual bool(void) IsMultiplayer;
|
||||||
|
|
||||||
/* spectator */
|
/* spectator */
|
||||||
/*virtual void(NSClientPlayer) SpectatorConnect;
|
/*virtual void(NSClientPlayer) SpectatorConnect;
|
||||||
|
|
|
@ -29,10 +29,10 @@ CGameRules::FrameStart(void)
|
||||||
{
|
{
|
||||||
//print("StartFrame!\n");
|
//print("StartFrame!\n");
|
||||||
}
|
}
|
||||||
float
|
bool
|
||||||
CGameRules::ConsoleCommand(NSClientPlayer pl, string cmd)
|
CGameRules::ConsoleCommand(NSClientPlayer pl, string cmd)
|
||||||
{
|
{
|
||||||
return (0);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* client */
|
/* client */
|
||||||
|
@ -189,23 +189,28 @@ CGameRules::IntermissionCycle(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
CGameRules::InIntermission(void)
|
CGameRules::InIntermission(void)
|
||||||
{
|
{
|
||||||
return (m_iIntermission) ? 1 : 0;
|
return (m_iIntermission) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
CGameRules::MonstersSpawn(void)
|
CGameRules::MonstersSpawn(void)
|
||||||
{
|
{
|
||||||
return (TRUE);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init */
|
/* init */
|
||||||
float
|
bool
|
||||||
CGameRules::IsTeamPlay(void)
|
CGameRules::IsTeamplay(void)
|
||||||
{
|
{
|
||||||
return (FALSE);
|
return (false);
|
||||||
|
}
|
||||||
|
bool
|
||||||
|
CGameRules::IsMultiplayer(void)
|
||||||
|
{
|
||||||
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -229,7 +234,7 @@ CGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type)
|
||||||
/* friendly fire */
|
/* friendly fire */
|
||||||
if (autocvar_sv_friendlyFire == false)
|
if (autocvar_sv_friendlyFire == false)
|
||||||
if (t != c)
|
if (t != c)
|
||||||
if (IsTeamPlay()) {
|
if (IsTeamplay()) {
|
||||||
if (t.flags & FL_CLIENT && c.flags & FL_CLIENT)
|
if (t.flags & FL_CLIENT && c.flags & FL_CLIENT)
|
||||||
if (t.team == c.team)
|
if (t.team == c.team)
|
||||||
return;
|
return;
|
||||||
|
@ -323,36 +328,34 @@ CGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* checks if we can hit an entity at 5 of the same spots */
|
/* checks if we can hit an entity at 5 of the same spots */
|
||||||
int
|
bool
|
||||||
CGameRules::DamageCheckTrace(entity t, vector vecHitPos)
|
CGameRules::DamageCheckTrace(entity t, vector vecHitPos)
|
||||||
{
|
{
|
||||||
/* We're lazy. Who cares */
|
/* We're lazy. Who cares */
|
||||||
if (t.solid == SOLID_BSP) {
|
if (t.solid == SOLID_BSP)
|
||||||
return (TRUE);
|
return (true);
|
||||||
}
|
|
||||||
|
|
||||||
traceline(vecHitPos, t.origin, 1, self);
|
traceline(vecHitPos, t.origin, 1, this);
|
||||||
if (trace_fraction == 1) {
|
if (trace_fraction == 1)
|
||||||
return (TRUE);
|
return (true);
|
||||||
}
|
|
||||||
traceline(vecHitPos, t.origin + [15,15,0], 1, self);
|
|
||||||
if (trace_fraction == 1) {
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
traceline(vecHitPos, t.origin + [-15,-15,0], 1, self);
|
|
||||||
if (trace_fraction == 1) {
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
traceline(vecHitPos, t.origin + [-15,15,0], 1, self);
|
|
||||||
if (trace_fraction == 1) {
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
traceline(vecHitPos, t.origin + [15,-15,0], 1, self);
|
|
||||||
if (trace_fraction == 1) {
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (FALSE);
|
traceline(vecHitPos, t.origin + [15,15,0], 1, this);
|
||||||
|
if (trace_fraction == 1)
|
||||||
|
return (true);
|
||||||
|
|
||||||
|
traceline(vecHitPos, t.origin + [-15,-15,0], 1, this);
|
||||||
|
if (trace_fraction == 1)
|
||||||
|
return (true);
|
||||||
|
|
||||||
|
traceline(vecHitPos, t.origin + [-15,15,0], 1, this);
|
||||||
|
if (trace_fraction == 1)
|
||||||
|
return (true);
|
||||||
|
|
||||||
|
traceline(vecHitPos, t.origin + [15,-15,0], 1, this);
|
||||||
|
if (trace_fraction == 1)
|
||||||
|
return (true);
|
||||||
|
|
||||||
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -412,6 +415,12 @@ CGameRules::IntermissionEnd(void)
|
||||||
m_flIntermissionTime = -1;
|
m_flIntermissionTime = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CGameRules::PlayerCanAttack(NSClientPlayer bp)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CGameRules::CGameRules(void)
|
CGameRules::CGameRules(void)
|
||||||
{
|
{
|
||||||
|
@ -420,15 +429,3 @@ CGameRules::CGameRules(void)
|
||||||
|
|
||||||
/* our currently running mode */
|
/* our currently running mode */
|
||||||
CGameRules g_grMode;
|
CGameRules g_grMode;
|
||||||
|
|
||||||
int
|
|
||||||
Gamerules_IsTeamPlay(void)
|
|
||||||
{
|
|
||||||
return (g_grMode.IsTeamPlay()) ? TRUE : FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
CGameRules::PlayerCanAttack(NSClientPlayer bp)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var int autocvar_mapcycle_enabled = TRUE;
|
var bool autocvar_mapcycle_enabled = true;
|
||||||
var string autocvar_mapcycle_file = "mapcycle.txt";
|
var string autocvar_mapcycle_file = "mapcycle.txt";
|
||||||
noref var string g_mapcycle_override = __NULL__;
|
noref var string g_mapcycle_override = __NULL__;
|
||||||
|
|
||||||
|
@ -27,12 +27,6 @@ Mapcycle_Load(string filename)
|
||||||
string lastmap = "";
|
string lastmap = "";
|
||||||
int map_next = 0i;
|
int map_next = 0i;
|
||||||
|
|
||||||
if (!autocvar_mapcycle_enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*if (Rules_IsMultiplayer())
|
|
||||||
return;*/
|
|
||||||
|
|
||||||
fs_mapcycle = fopen(filename, FILE_READ);
|
fs_mapcycle = fopen(filename, FILE_READ);
|
||||||
|
|
||||||
if (fs_mapcycle < 0) {
|
if (fs_mapcycle < 0) {
|
||||||
|
@ -71,7 +65,16 @@ Mapcycle_Load(string filename)
|
||||||
void
|
void
|
||||||
Mapcycle_Init(void)
|
Mapcycle_Init(void)
|
||||||
{
|
{
|
||||||
print("--------- Initializing MapCycle ----------\n");
|
/* by default, this will be multiplayer only */
|
||||||
|
if (g_grMode.IsMultiplayer() == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* in case some server admin wants a map to continously loop */
|
||||||
|
if (autocvar_mapcycle_enabled == false) {
|
||||||
|
print("mapcycle disabled via cvar. skipping\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
print("--------- Initializing MapCycle ----------\n");
|
||||||
Mapcycle_Load(autocvar_mapcycle_file);
|
Mapcycle_Load(autocvar_mapcycle_file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,47 +117,9 @@ Empty(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void Util_Destroy(void);
|
||||||
Util_Destroy(void)
|
string Util_TimeToString(float fTime);
|
||||||
{
|
int Util_IsTeamplay(void);
|
||||||
remove(self);
|
|
||||||
}
|
|
||||||
|
|
||||||
string
|
|
||||||
Util_TimeToString(float fTime)
|
|
||||||
{
|
|
||||||
fTime = rint(fTime);
|
|
||||||
|
|
||||||
switch (fTime) {
|
|
||||||
case 0: return "less than one";
|
|
||||||
case 1: return "one";
|
|
||||||
case 2: return "two";
|
|
||||||
case 3: return "three";
|
|
||||||
case 4: return "four";
|
|
||||||
case 5: return "five";
|
|
||||||
case 6: return "six";
|
|
||||||
case 7: return "seven";
|
|
||||||
case 8: return "eight";
|
|
||||||
case 9: return "nine";
|
|
||||||
case 10: return "ten";
|
|
||||||
default: return "over ten";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* returns whether or not the mode we're playing is a team game */
|
|
||||||
#ifdef SERVER
|
|
||||||
int Gamerules_IsTeamPlay(void);
|
|
||||||
#endif
|
|
||||||
int
|
|
||||||
Util_IsTeamPlay(void)
|
|
||||||
{
|
|
||||||
#ifdef SERVER
|
|
||||||
return Gamerules_IsTeamPlay();
|
|
||||||
#else
|
|
||||||
return (serverkeyfloat("teams") > 0) ? TRUE : FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
__wrap void
|
__wrap void
|
||||||
dprint(string m)
|
dprint(string m)
|
||||||
|
|
|
@ -10,6 +10,7 @@ player_pmove.qc
|
||||||
propdata.qc
|
propdata.qc
|
||||||
surfaceproperties.qc
|
surfaceproperties.qc
|
||||||
NSMaterial.qc
|
NSMaterial.qc
|
||||||
|
util.qc
|
||||||
../xr/include.src
|
../xr/include.src
|
||||||
../materials/include.src
|
../materials/include.src
|
||||||
#endlist
|
#endlist
|
||||||
|
|
|
@ -14,7 +14,40 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int Rules_IsTeamPlay(void)
|
void
|
||||||
|
Util_Destroy(void)
|
||||||
{
|
{
|
||||||
return (int)(cvar("teamplay"));
|
remove(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
Util_TimeToString(float fTime)
|
||||||
|
{
|
||||||
|
fTime = rint(fTime);
|
||||||
|
|
||||||
|
switch (fTime) {
|
||||||
|
case 0: return "less than one";
|
||||||
|
case 1: return "one";
|
||||||
|
case 2: return "two";
|
||||||
|
case 3: return "three";
|
||||||
|
case 4: return "four";
|
||||||
|
case 5: return "five";
|
||||||
|
case 6: return "six";
|
||||||
|
case 7: return "seven";
|
||||||
|
case 8: return "eight";
|
||||||
|
case 9: return "nine";
|
||||||
|
case 10: return "ten";
|
||||||
|
default: return "over ten";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* returns whether or not the mode we're playing is a team game */
|
||||||
|
int
|
||||||
|
Util_IsTeamplay(void)
|
||||||
|
{
|
||||||
|
#ifdef SERVER
|
||||||
|
return g_grMode.IsTeamplay();
|
||||||
|
#else
|
||||||
|
return (serverkeyfloat("teams") > 0) ? TRUE : FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
Loading…
Reference in a new issue