Progs.src for server-side codebases are much simpler now, player class now
inherits the base_player class, which is a new addition.
This commit is contained in:
parent
a025a41e73
commit
fc3f124d24
92 changed files with 1195 additions and 1594 deletions
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "hud.h"
|
||||
#include "radio.h"
|
||||
#include "../valve/obituary.h"
|
||||
|
||||
var int autocvar_cl_autoweaponswitch = TRUE;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define VALVE
|
||||
#define CSTRIKE
|
||||
#define CLASSIC_VGUI
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
|
@ -34,6 +35,7 @@
|
|||
../cstrike/hud_weaponselect.c
|
||||
../valve/scoreboard.c
|
||||
../valve/input.c
|
||||
../cstrike/radio.c
|
||||
|
||||
../include.src
|
||||
#endlist
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef CLIENT
|
||||
string g_cstrikeRadioWAVs[43] = {
|
||||
"radio/blow.wav",
|
||||
"radio/bombdef.wav",
|
||||
|
@ -141,139 +140,3 @@ Radio_PlayPlayerMessage(float fPlayerNum, float fMessage)
|
|||
sound(world, CHAN_VOICE, g_cstrikeRadioWAVs[fMessage], 1, ATTN_NONE, 0, SOUNDFLAG_NOSPACIALISE);
|
||||
CSQC_Parse_Print(sprintf("^2[RADIO] %s%s^xF80: %s", HUD_GetChatColorHEX(stof(getplayerkeyvalue(fPlayerNum, "*team"))), getplayerkeyvalue(fPlayerNum, "name"), g_cstrikeRadioChat[fMessage]), PRINT_CHAT);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SERVER
|
||||
/*
|
||||
=================
|
||||
Radio_BroadcastMessage
|
||||
|
||||
A global radio message for all players
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Radio_BroadcastMessage(float fMessage)
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_RADIOMSG);
|
||||
WriteByte(MSG_MULTICAST, fMessage);
|
||||
msg_entity = self;
|
||||
multicast('0 0 0', MULTICAST_ALL);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Radio_TeamMessage
|
||||
|
||||
A radio message targetted at members of a specific team
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Radio_TeamMessage(float fMessage, float fTeam)
|
||||
{
|
||||
static void Radio_TeamMessage_Send(float fMessage, entity eEnt) {
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_RADIOMSG);
|
||||
WriteByte(MSG_MULTICAST, fMessage);
|
||||
msg_entity = eEnt;
|
||||
multicast('0 0 0', MULTICAST_ONE);
|
||||
}
|
||||
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
|
||||
if (eFind.team == fTeam) {
|
||||
Radio_TeamMessage_Send(fMessage, eFind);
|
||||
} else if (eFind.team == TEAM_VIP && fTeam == TEAM_CT) {
|
||||
Radio_TeamMessage_Send(fMessage, eFind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Radio_DefaultStart
|
||||
|
||||
Pick a generic, random radio string for global start messages
|
||||
=================
|
||||
*/
|
||||
float
|
||||
Radio_DefaultStart(void)
|
||||
{
|
||||
float fRand = floor(random(1, 4));
|
||||
|
||||
if (fRand == 1) {
|
||||
return RADIO_MOVEOUT;
|
||||
} else if (fRand == 2) {
|
||||
return RADIO_LOCKNLOAD;
|
||||
} else {
|
||||
return RADIO_LETSGO;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Radio_StartMessage
|
||||
|
||||
Decide which startmessage to play at the beginning of each round
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Radio_StartMessage(void)
|
||||
{
|
||||
if (g_cs_vipzones > 0) {
|
||||
Radio_TeamMessage(RADIO_VIP, TEAM_CT);
|
||||
Radio_TeamMessage(Radio_DefaultStart(), TEAM_T);
|
||||
} else if (g_cs_escapezones > 0) {
|
||||
Radio_TeamMessage(RADIO_GETOUT, TEAM_T);
|
||||
Radio_TeamMessage(Radio_DefaultStart(), TEAM_CT);
|
||||
} else {
|
||||
Radio_BroadcastMessage(Radio_DefaultStart());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CSEv_Radio_f
|
||||
|
||||
Triggered by clients, plays a message to members of the same team
|
||||
=================
|
||||
*/
|
||||
void
|
||||
CSEv_Radio_f(float fMessage)
|
||||
{
|
||||
static void CSEv_Radio_Send(float fMessage, entity eEnt) {
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_RADIOMSG2);
|
||||
WriteByte(MSG_MULTICAST, num_for_edict(eEnt) - 1);
|
||||
WriteByte(MSG_MULTICAST, fMessage);
|
||||
msg_entity = eEnt;
|
||||
multicast('0 0 0', MULTICAST_ONE);
|
||||
}
|
||||
|
||||
// Don't allow spamming
|
||||
/*if (self.fRadioFinished > time) {
|
||||
return;
|
||||
}*/
|
||||
|
||||
// When dead, don't talk
|
||||
if (self.health <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure that VIPs and CTs get eachother
|
||||
float fTargetTeam = self.team;
|
||||
if (fTargetTeam == TEAM_VIP) {
|
||||
fTargetTeam = TEAM_CT;
|
||||
}
|
||||
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
|
||||
if (eFind.team == fTargetTeam) {
|
||||
CSEv_Radio_Send(fMessage, eFind);
|
||||
} else if (eFind.team == TEAM_VIP && fTargetTeam == TEAM_CT) {
|
||||
CSEv_Radio_Send(fMessage, eFind);
|
||||
}
|
||||
}
|
||||
|
||||
/*self.fRadioFinished = time + 3.0f;*/
|
||||
}
|
||||
#endif
|
3
src/client/cstrike/radio.h
Normal file
3
src/client/cstrike/radio.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
void Radio_Init(void);
|
||||
void Radio_PlayMessage(float);
|
||||
void Radio_PlayPlayerMessage(float, float);
|
|
@ -5,6 +5,7 @@
|
|||
#define CLIENT
|
||||
#define VALVE
|
||||
#define GEARBOX
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define VALVE
|
||||
#define HUNGER
|
||||
#define CLASSIC_VGUI
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
|
@ -35,4 +36,3 @@
|
|||
../include.src
|
||||
|
||||
#endlist
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define VALVE
|
||||
#define POKE646
|
||||
#define CLASSIC_VGUI
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
|
@ -35,4 +36,3 @@
|
|||
../include.src
|
||||
|
||||
#endlist
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#define CLIENT
|
||||
#define VALVE
|
||||
#define CLASSIC_VGUI
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
|
|
|
@ -5,11 +5,7 @@
|
|||
#define CLIENT
|
||||
#define VALVE
|
||||
#define CLASSIC_VGUI
|
||||
|
||||
#define CSQC
|
||||
#define CLIENT
|
||||
#define VALVE
|
||||
#define CLASSIC_VGUI
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
|
@ -37,5 +33,4 @@
|
|||
../valve/input.c
|
||||
|
||||
../include.src
|
||||
|
||||
#endlist
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#define CLIENT
|
||||
#define VALVE
|
||||
#define CLASSIC_VGUI
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#define CLIENT
|
||||
#define VALVE
|
||||
#define CLASSIC_VGUI
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define GS_RENDERFX
|
||||
|
||||
#ifdef GS_RENDERFX
|
||||
enum
|
||||
{
|
||||
|
|
49
src/gs-entbase/client/baseentity.h
Normal file
49
src/gs-entbase/client/baseentity.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class CBaseEntity
|
||||
{
|
||||
#ifdef GS_RENDERFX
|
||||
int m_iRenderFX;
|
||||
float m_iRenderMode;
|
||||
float m_flRenderAmt;
|
||||
vector m_vecRenderColor;
|
||||
#endif
|
||||
|
||||
int m_iBody;
|
||||
float m_flSentenceTime;
|
||||
sound_t *m_pSentenceQue;
|
||||
int m_iSentenceCount;
|
||||
int m_iSentencePos;
|
||||
|
||||
string targetname;
|
||||
string target;
|
||||
float spawnflags;
|
||||
|
||||
void(void) CBaseEntity;
|
||||
virtual void(void) Init;
|
||||
virtual void(void) Initialized;
|
||||
virtual void(string, string) SpawnKey;
|
||||
virtual void(string) Sentence;
|
||||
virtual void(void) ProcessWordQue;
|
||||
virtual void(float flChanged) ReadEntity;
|
||||
virtual float(void) predraw;
|
||||
virtual void(void) postdraw;
|
||||
|
||||
#ifdef GS_RENDERFX
|
||||
virtual void(void) RenderFXPass;
|
||||
#endif
|
||||
};
|
|
@ -14,6 +14,8 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "baseentity.h"
|
||||
|
||||
vector g_vecSunDir;
|
||||
|
||||
/* TODO: Find a better way to figure out what's a CBaseEntity at heart */
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
baseentity.h
|
||||
decals.h
|
||||
materials.h
|
||||
server/defs.h
|
||||
server/baseentity.cpp
|
||||
server/basetrigger.cpp
|
||||
server/basemonster.cpp
|
||||
|
|
|
@ -14,66 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class CBaseEntity
|
||||
{
|
||||
string m_strTarget;
|
||||
string m_strTargetName;
|
||||
int m_iBody;
|
||||
|
||||
/* respawn */
|
||||
string m_oldModel;
|
||||
float m_oldSolid;
|
||||
float m_oldHealth;
|
||||
vector m_oldOrigin;
|
||||
vector m_oldAngle;
|
||||
|
||||
/* keep track of these variables */
|
||||
vector net_origin;
|
||||
vector net_angles;
|
||||
|
||||
#ifdef GS_RENDERFX
|
||||
int m_iRenderFX;
|
||||
float m_iRenderMode;
|
||||
float m_flRenderAmt;
|
||||
vector m_vecRenderColor;
|
||||
|
||||
/* respawn */
|
||||
int m_oldiRenderFX;
|
||||
float m_oldiRenderMode;
|
||||
float m_oldflRenderAmt;
|
||||
vector m_oldvecRenderColor;
|
||||
#endif
|
||||
|
||||
string m_parent;
|
||||
|
||||
void(void) CBaseEntity;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(void) Hide;
|
||||
virtual void(void) ParentUpdate;
|
||||
virtual float(entity, float) SendEntity;
|
||||
virtual void(int iHitBody) Pain;
|
||||
virtual void(int iHitBody) Death;
|
||||
|
||||
virtual void(float) SetEffects;
|
||||
virtual void(float) SetFrame;
|
||||
virtual void(string) SetModel;
|
||||
virtual void(float) SetModelindex;
|
||||
virtual void(float) SetMovetype;
|
||||
virtual void(float) SetSkin;
|
||||
virtual void(float) SetSolid;
|
||||
virtual void(int) SetBody;
|
||||
virtual void(vector) SetAngles;
|
||||
virtual void(vector) SetOrigin;
|
||||
virtual void(vector, vector) SetSize;
|
||||
|
||||
#ifdef GS_RENDERFX
|
||||
virtual void(int) SetRenderFX;
|
||||
virtual void(float) SetRenderMode;
|
||||
virtual void(float) SetRenderAmt;
|
||||
virtual void(vector) SetRenderColor;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* we want to really use those set functions because they'll notify of any
|
||||
* networking related changes. otherwise we'll have to keep track of copies
|
||||
* that get updated every frame */
|
||||
|
|
75
src/gs-entbase/server/baseentity.h
Normal file
75
src/gs-entbase/server/baseentity.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class CBaseEntity
|
||||
{
|
||||
string m_strTarget;
|
||||
string m_strTargetName;
|
||||
int m_iBody;
|
||||
|
||||
/* respawn */
|
||||
string m_oldModel;
|
||||
float m_oldSolid;
|
||||
float m_oldHealth;
|
||||
vector m_oldOrigin;
|
||||
vector m_oldAngle;
|
||||
|
||||
/* keep track of these variables */
|
||||
vector net_origin;
|
||||
vector net_angles;
|
||||
|
||||
#ifdef GS_RENDERFX
|
||||
int m_iRenderFX;
|
||||
float m_iRenderMode;
|
||||
float m_flRenderAmt;
|
||||
vector m_vecRenderColor;
|
||||
|
||||
/* respawn */
|
||||
int m_oldiRenderFX;
|
||||
float m_oldiRenderMode;
|
||||
float m_oldflRenderAmt;
|
||||
vector m_oldvecRenderColor;
|
||||
#endif
|
||||
|
||||
string m_parent;
|
||||
|
||||
void(void) CBaseEntity;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(void) Hide;
|
||||
virtual void(void) ParentUpdate;
|
||||
virtual float(entity, float) SendEntity;
|
||||
virtual void(int iHitBody) Pain;
|
||||
virtual void(int iHitBody) Death;
|
||||
|
||||
virtual void(float) SetEffects;
|
||||
virtual void(float) SetFrame;
|
||||
virtual void(string) SetModel;
|
||||
virtual void(float) SetModelindex;
|
||||
virtual void(float) SetMovetype;
|
||||
virtual void(float) SetSkin;
|
||||
virtual void(float) SetSolid;
|
||||
virtual void(int) SetBody;
|
||||
virtual void(vector) SetAngles;
|
||||
virtual void(vector) SetOrigin;
|
||||
virtual void(vector, vector) SetSize;
|
||||
|
||||
#ifdef GS_RENDERFX
|
||||
virtual void(int) SetRenderFX;
|
||||
virtual void(float) SetRenderMode;
|
||||
virtual void(float) SetRenderAmt;
|
||||
virtual void(vector) SetRenderColor;
|
||||
#endif
|
||||
};
|
|
@ -14,6 +14,8 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "baseentity.h"
|
||||
|
||||
.float delay;
|
||||
.float wait;
|
||||
.float wait;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "gamerules.h"
|
||||
#include "money.h"
|
||||
#include "radio.h"
|
||||
#include "item_c4bomb.h"
|
||||
#include "../valve/items.h"
|
||||
|
||||
var int g_cstrike_buying = 0;
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
*/
|
||||
|
||||
void
|
||||
Money_AddMoney(player pl, int iMoneyValue)
|
||||
Money_AddMoney(base_player pp, int iMoneyValue)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
dprint(sprintf("^2Money_AddMoney^7: giving %s $%i\n", pl.netname, iMoneyValue));
|
||||
pl.money += (float)iMoneyValue;
|
||||
|
||||
|
@ -41,7 +42,7 @@ Money_QueTeamReward(int t, int iMoneyValue)
|
|||
}
|
||||
|
||||
void
|
||||
Money_GiveTeamReward(player pl)
|
||||
Money_GiveTeamReward(base_player pl)
|
||||
{
|
||||
if (pl.team == TEAM_T) {
|
||||
Money_AddMoney(pl, g_cs_moneyreward_t);
|
||||
|
|
|
@ -17,17 +17,17 @@
|
|||
var int autocvar_sv_playerkeepalive = TRUE;
|
||||
|
||||
void
|
||||
CSGameRules::PlayerDeath(player pl)
|
||||
CSGameRules::PlayerDeath(base_player pl)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CSGameRules::PlayerPain(player pl)
|
||||
CSGameRules::PlayerPain(base_player pl)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
CSGameRules::BuyingPossible(player pl)
|
||||
CSGameRules::BuyingPossible(base_player pl)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -35,8 +35,10 @@ CSGameRules::BuyingPossible(player pl)
|
|||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
CSGameRules::PlayerPostFrame(player pl)
|
||||
CSGameRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
|
@ -131,8 +133,9 @@ CSGameRules::PlayerPostFrame(player pl)
|
|||
|
||||
|
||||
void
|
||||
CSGameRules::LevelDecodeParms(player pl)
|
||||
CSGameRules::LevelDecodeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
|
@ -190,8 +193,9 @@ CSGameRules::LevelDecodeParms(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
CSGameRules::LevelChangeParms(player pl)
|
||||
CSGameRules::LevelChangeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
|
@ -291,7 +295,7 @@ CSGameRules::PlayerDisconnect(entity pl)
|
|||
}
|
||||
|
||||
void
|
||||
CSGameRules::PlayerKill(player pl)
|
||||
CSGameRules::PlayerKill(base_player pl)
|
||||
{
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
|
|
@ -20,24 +20,24 @@ class CSGameRules:CGameRules
|
|||
{
|
||||
virtual void(entity) PlayerConnect;
|
||||
virtual void(entity) PlayerDisconnect;
|
||||
virtual void(player) PlayerKill;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
virtual void(player) PlayerDeath;
|
||||
virtual void(player) PlayerPain;
|
||||
virtual void(base_player) PlayerKill;
|
||||
virtual void(base_player) PlayerPostFrame;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
virtual void(base_player) PlayerPain;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(player) LevelDecodeParms;
|
||||
virtual void(base_player) LevelChangeParms;
|
||||
virtual void(base_player) LevelDecodeParms;
|
||||
virtual void(void) LevelNewParms;
|
||||
|
||||
virtual int(player) BuyingPossible;
|
||||
virtual int(base_player) BuyingPossible;
|
||||
};
|
||||
|
||||
class CSSingleplayerRules:CSGameRules
|
||||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
virtual void(player) PlayerDeath;
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
};
|
||||
|
||||
class CSMultiplayerRules:CSGameRules
|
||||
|
@ -49,9 +49,9 @@ class CSMultiplayerRules:CSGameRules
|
|||
|
||||
virtual void(void) InitPostEnts;
|
||||
virtual void(void) FrameStart;
|
||||
virtual void(player) PlayerSpawn;
|
||||
virtual void(player) PlayerPreFrame;
|
||||
virtual void(player) PlayerDeath;
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerPreFrame;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
virtual int(int) MaxItemPerSlot;
|
||||
|
||||
/* CS specific */
|
||||
|
@ -61,19 +61,21 @@ class CSMultiplayerRules:CSGameRules
|
|||
virtual void(float, int) TimerBegin;
|
||||
virtual void(void) TimerUpdate;
|
||||
|
||||
virtual int(player) BuyingPossible;
|
||||
virtual int(base_player) BuyingPossible;
|
||||
virtual void(int, int, int) RoundOver;
|
||||
virtual void(int) RestartRound;
|
||||
virtual void(player) DeathCheck;
|
||||
virtual void(player) MakeBomber;
|
||||
virtual void(player) MakeVIP;
|
||||
virtual void(base_player) DeathCheck;
|
||||
virtual void(base_player) MakeBomber;
|
||||
virtual void(base_player) MakeVIP;
|
||||
virtual void(void) CountPlayers;
|
||||
virtual void(void) SwitchTeams;
|
||||
virtual void(void) TimeOut;
|
||||
|
||||
virtual void(player) PlayerClearWeaponry;
|
||||
virtual void(player, int) PlayerMakePlayable;
|
||||
virtual void(player) PlayerMakeSpectator;
|
||||
virtual void(player, int) PlayerRespawn;
|
||||
virtual void(base_player) PlayerClearWeaponry;
|
||||
virtual void(base_player, int) PlayerMakePlayable;
|
||||
virtual void(base_player) PlayerMakeSpectator;
|
||||
virtual void(base_player, int) PlayerRespawn;
|
||||
virtual entity(float) PlayerFindSpawn;
|
||||
};
|
||||
|
||||
void CSEv_JoinAuto(void);
|
||||
|
|
|
@ -25,7 +25,7 @@ CSMultiplayerRules::MaxItemPerSlot(int slot)
|
|||
}
|
||||
|
||||
void
|
||||
CSMultiplayerRules::PlayerDeath(player pl)
|
||||
CSMultiplayerRules::PlayerDeath(base_player pl)
|
||||
{
|
||||
/* obituary networking */
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
|
@ -100,7 +100,7 @@ CSMultiplayerRules::PlayerDeath(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
CSMultiplayerRules::PlayerPreFrame(player pl)
|
||||
CSMultiplayerRules::PlayerPreFrame(base_player pl)
|
||||
{
|
||||
if (pl.health <= 0)
|
||||
return;
|
||||
|
@ -343,7 +343,7 @@ Checks if it is possible for players to buy anything
|
|||
=================
|
||||
*/
|
||||
int
|
||||
CSMultiplayerRules::BuyingPossible(player pl)
|
||||
CSMultiplayerRules::BuyingPossible(base_player pl)
|
||||
{
|
||||
if (pl.health <= 0) {
|
||||
return FALSE;
|
||||
|
@ -385,14 +385,14 @@ CSMultiplayerRules::BuyingPossible(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
CSMultiplayerRules::MakeBomber(player pl)
|
||||
CSMultiplayerRules::MakeBomber(base_player pl)
|
||||
{
|
||||
Weapons_AddItem(pl, WEAPON_C4BOMB, -1);
|
||||
centerprint(pl, "You have the bomb!\nFind the target zone or DROP\nthe bomb for another Terrorist.");
|
||||
}
|
||||
|
||||
void
|
||||
CSMultiplayerRules::MakeVIP(player pl)
|
||||
CSMultiplayerRules::MakeVIP(base_player pl)
|
||||
{
|
||||
pl.team = TEAM_VIP;
|
||||
PlayerRespawn(pl, pl.team);
|
||||
|
@ -612,7 +612,7 @@ CSMultiplayerRules::CountPlayers(void)
|
|||
}
|
||||
|
||||
void
|
||||
CSMultiplayerRules::DeathCheck(player pl)
|
||||
CSMultiplayerRules::DeathCheck(base_player pl)
|
||||
{
|
||||
if ((g_cs_alive_t == 0) && (g_cs_alive_ct == 0)) {
|
||||
if (g_cs_bombplanted == TRUE) {
|
||||
|
@ -687,8 +687,10 @@ Called whenever a player survived a round and needs a basic respawn.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
CSMultiplayerRules::PlayerRespawn(player pl, int fTeam)
|
||||
CSMultiplayerRules::PlayerRespawn(base_player pp, int fTeam)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
|
||||
entity eSpawn;
|
||||
forceinfokey(pl, "*spec", "0");
|
||||
eSpawn = PlayerFindSpawn(pl.team);
|
||||
|
@ -749,8 +751,10 @@ CSMultiplayerRules::PlayerRespawn(player pl, int fTeam)
|
|||
}
|
||||
|
||||
void
|
||||
CSMultiplayerRules::PlayerClearWeaponry(player pl)
|
||||
CSMultiplayerRules::PlayerClearWeaponry(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
|
||||
pl.g_items = 0x0;
|
||||
pl.activeweapon = 0;
|
||||
pl.ammo_50ae = 0;
|
||||
|
@ -800,8 +804,9 @@ This may be after a player had died or when the game starts for the first time.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
CSMultiplayerRules::PlayerMakePlayable(player pl, int chara)
|
||||
CSMultiplayerRules::PlayerMakePlayable(base_player pp, int chara)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
/* spectator */
|
||||
if (chara == 0) {
|
||||
PlayerSpawn(pl);
|
||||
|
@ -847,7 +852,7 @@ Force the player to become an observer.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
CSMultiplayerRules::PlayerMakeSpectator(player pl)
|
||||
CSMultiplayerRules::PlayerMakeSpectator(base_player pl)
|
||||
{
|
||||
pl.classname = "spectator";
|
||||
pl.health = 0;
|
||||
|
@ -877,7 +882,7 @@ Called on the client first joining the server.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
CSMultiplayerRules::PlayerSpawn(player pl)
|
||||
CSMultiplayerRules::PlayerSpawn(base_player pl)
|
||||
{
|
||||
/* immediately put us into spectating mode */
|
||||
PlayerMakeSpectator(pl);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
void
|
||||
CSSingleplayerRules::PlayerDeath(player pl)
|
||||
CSSingleplayerRules::PlayerDeath(base_player pl)
|
||||
{
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.solid = SOLID_NOT;
|
||||
|
@ -33,7 +33,7 @@ CSSingleplayerRules::PlayerDeath(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
CSSingleplayerRules::PlayerSpawn(player pl)
|
||||
CSSingleplayerRules::PlayerSpawn(base_player pl)
|
||||
{
|
||||
pl.classname = "player";
|
||||
pl.health = pl.max_health = 100;
|
||||
|
|
100
src/server/cstrike/item_c4bomb.cpp
Normal file
100
src/server/cstrike/item_c4bomb.cpp
Normal file
|
@ -0,0 +1,100 @@
|
|||
/* C4 entity logic */
|
||||
|
||||
class item_c4:CBaseEntity
|
||||
{
|
||||
entity m_eUser;
|
||||
float m_flBeepTime;
|
||||
float m_flExplodeTime;
|
||||
float m_flDefusalState;
|
||||
|
||||
void(void) item_c4;
|
||||
virtual void(void) PlayerUse;
|
||||
virtual void(void) Logic;
|
||||
};
|
||||
|
||||
void
|
||||
item_c4::PlayerUse(void)
|
||||
{
|
||||
m_eUser = eActivator;
|
||||
m_flDefusalState += frametime;
|
||||
}
|
||||
|
||||
void
|
||||
item_c4::Logic(void)
|
||||
{
|
||||
// If the guy who started using us stopped using us, reset the defuser counter
|
||||
if (m_eUser != world) {
|
||||
m_eUser= world;
|
||||
m_flDefusalState = 0.0f;
|
||||
}
|
||||
|
||||
// If our time has passed, explode
|
||||
if (m_flExplodeTime < time) {
|
||||
CSMultiplayerRules rules = (CSMultiplayerRules)g_grMode;
|
||||
|
||||
/* In Bomb Defusal, all Terrorists receive $3500
|
||||
* if they won by detonating the bomb. */
|
||||
rules.RoundOver(TEAM_T, 3500, FALSE);
|
||||
Damage_Radius(origin, this.owner, 500, g_cstrike_bombradius, TRUE, WEAPON_C4BOMB);
|
||||
sound(this, CHAN_VOICE, "weapons/c4_explode1.wav", 1.0, ATTN_NONE);
|
||||
|
||||
for (entity e = world; (e = find(e, ::classname, "func_bomb_target"));) {
|
||||
CBaseTrigger trigger = (CBaseTrigger)e;
|
||||
if (trigger.Trigger != __NULL__) {
|
||||
trigger.Trigger();
|
||||
}
|
||||
}
|
||||
|
||||
m_flBeepTime = 0.0f;
|
||||
m_flDefusalState = 0;
|
||||
remove(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_flBeepTime > time) {
|
||||
return;
|
||||
}
|
||||
m_flBeepTime = time + 1.5;
|
||||
|
||||
if (m_flExplodeTime - time < 2) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep5.wav", 1.0, ATTN_NONE);
|
||||
} else if (m_flExplodeTime - time < 5) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep5.wav", 1.0, ATTN_NORM);
|
||||
} else if (m_flExplodeTime - time < 10) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep4.wav", 1.0, ATTN_NORM);
|
||||
} else if (m_flExplodeTime - time < 20) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep3.wav", 1.0, ATTN_NORM);
|
||||
} else if (m_flExplodeTime - time < 30) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep2.wav", 1.0, ATTN_NORM);
|
||||
} else {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep1.wav", 1.0, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
item_c4::item_c4(void)
|
||||
{
|
||||
SetMovetype(MOVETYPE_NONE);
|
||||
SetSolid(SOLID_BBOX);
|
||||
SetModel("models/w_c4.mdl");
|
||||
SetSize([-6,-6,0], [6,6,6]);
|
||||
|
||||
customphysics = Logic;
|
||||
m_flExplodeTime = time + 45.0f;
|
||||
|
||||
sound(this, CHAN_WEAPON, "weapons/c4_plant.wav", 1.0f, ATTN_IDLE);
|
||||
}
|
||||
|
||||
void
|
||||
C4Bomb_Plant(base_player planter)
|
||||
{
|
||||
item_c4 bomb = spawn(item_c4);
|
||||
bomb.owner = planter;
|
||||
|
||||
/* place directly below */
|
||||
traceline(planter.origin, planter.origin + [0,0,-64], FALSE, planter);
|
||||
setorigin(bomb, trace_endpos);
|
||||
|
||||
Radio_BroadcastMessage(RADIO_BOMBPL);
|
||||
g_cs_bombplanted = TRUE;
|
||||
}
|
1
src/server/cstrike/item_c4bomb.h
Normal file
1
src/server/cstrike/item_c4bomb.h
Normal file
|
@ -0,0 +1 @@
|
|||
void C4Bomb_Plant(base_player);
|
|
@ -17,9 +17,9 @@
|
|||
int g_cs_moneyreward_ct;
|
||||
int g_cs_moneyreward_t;
|
||||
|
||||
void Money_AddMoney(player, int);
|
||||
void Money_AddMoney(base_player, int);
|
||||
void Money_QueTeamReward(int, int);
|
||||
void Money_GiveTeamReward(player);
|
||||
void Money_GiveTeamReward(base_player);
|
||||
void Money_ResetTeamReward(void);
|
||||
int Money_GetLosses(int);
|
||||
int Money_HasBonus(int);
|
||||
|
|
|
@ -6,72 +6,23 @@
|
|||
#define VALVE
|
||||
#define CSTRIKE
|
||||
#define BULLETPENETRATION
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
../../gs-entbase/server/defs.h
|
||||
../../shared/defs.h
|
||||
../../shared/cstrike/defs.h
|
||||
../../shared/sound.c
|
||||
../defs.h
|
||||
../plugins.c
|
||||
../logging.c
|
||||
../nodes.c
|
||||
../skill.c
|
||||
../sentences.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../../gs-entbase/shared.src
|
||||
|
||||
../../shared/cstrike/player.h
|
||||
../cstrike/defs.h
|
||||
../../shared/cstrike/include.src
|
||||
|
||||
../../shared/valve/fx_blood.c
|
||||
../../shared/valve/fx_breakmodel.c
|
||||
../../shared/valve/fx_explosion.c
|
||||
../../shared/valve/fx_gibhuman.c
|
||||
../../shared/valve/fx_spark.c
|
||||
../../shared/cstrike/fx_impact.c
|
||||
../../shared/cstrike/fx_flashbang.c
|
||||
../../shared/cstrike/fx_smokenade.c
|
||||
../cstrike/player.c
|
||||
../../shared/cstrike/pmove.c
|
||||
../../shared/pmove.c
|
||||
../valve/spectator.c
|
||||
|
||||
../../shared/cstrike/radio.c
|
||||
../../shared/cstrike/weapons_cstrike.c
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/cstrike/w_ak47.c
|
||||
../../shared/cstrike/w_deagle.c
|
||||
../../shared/cstrike/w_knife.c
|
||||
../../shared/cstrike/w_usp45.c
|
||||
../../shared/cstrike/w_glock18.c
|
||||
../../shared/cstrike/w_p228.c
|
||||
../../shared/cstrike/w_elites.c
|
||||
../../shared/cstrike/w_fiveseven.c
|
||||
../../shared/cstrike/w_m3.c
|
||||
../../shared/cstrike/w_xm1014.c
|
||||
../../shared/cstrike/w_mp5.c
|
||||
../../shared/cstrike/w_p90.c
|
||||
../../shared/cstrike/w_ump45.c
|
||||
../../shared/cstrike/w_mac10.c
|
||||
../../shared/cstrike/w_tmp.c
|
||||
../../shared/cstrike/w_sg552.c
|
||||
../../shared/cstrike/w_m4a1.c
|
||||
../../shared/cstrike/w_aug.c
|
||||
../../shared/cstrike/w_scout.c
|
||||
../../shared/cstrike/w_awp.c
|
||||
../../shared/cstrike/w_g3sg1.c
|
||||
../../shared/cstrike/w_sg550.c
|
||||
../../shared/cstrike/w_para.c
|
||||
../../shared/cstrike/w_c4bomb.c
|
||||
../../shared/cstrike/w_flashbang.c
|
||||
../../shared/cstrike/w_hegrenade.c
|
||||
../../shared/cstrike/w_smokegrenade.c
|
||||
../../shared/cstrike/weapons.c
|
||||
../valve/items.cpp
|
||||
../../shared/valve/weapon_common.c
|
||||
|
||||
../cstrike/hostage_entity.cpp
|
||||
../cstrike/armoury_entity.cpp
|
||||
../cstrike/func_bomb_target.cpp
|
||||
|
@ -83,33 +34,26 @@
|
|||
../cstrike/func_vip_safetyzone.cpp
|
||||
../cstrike/info_map_parameters.cpp
|
||||
../cstrike/item_suit.cpp
|
||||
../cstrike/item_c4bomb.cpp
|
||||
../valve/items.cpp
|
||||
|
||||
../spawn.c
|
||||
../vox.c
|
||||
../../shared/cstrike/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../cstrike/game_money.c
|
||||
../cstrike/gamerules.cpp
|
||||
../cstrike/gamerules_singleplayer.cpp
|
||||
../cstrike/gamerules_multiplayer.cpp
|
||||
|
||||
../cstrike/radio.c
|
||||
../cstrike/client.c
|
||||
../cstrike/ammo.c
|
||||
../cstrike/buy.c
|
||||
../client.c
|
||||
../cstrike/server.c
|
||||
../server.c
|
||||
../valve/damage.c
|
||||
../traceattack.c
|
||||
../valve/rules.c
|
||||
../footsteps.c
|
||||
../flashlight.c
|
||||
|
||||
../../botlib/include.src
|
||||
|
||||
../cstrike/input.c
|
||||
../cstrike/spawn.c
|
||||
../vote.c
|
||||
|
||||
../entry.c
|
||||
../include.src
|
||||
#endlist
|
||||
|
|
131
src/server/cstrike/radio.c
Normal file
131
src/server/cstrike/radio.c
Normal file
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
=================
|
||||
Radio_BroadcastMessage
|
||||
|
||||
A global radio message for all players
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Radio_BroadcastMessage(float fMessage)
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_RADIOMSG);
|
||||
WriteByte(MSG_MULTICAST, fMessage);
|
||||
msg_entity = self;
|
||||
multicast('0 0 0', MULTICAST_ALL);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Radio_TeamMessage
|
||||
|
||||
A radio message targetted at members of a specific team
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Radio_TeamMessage(float fMessage, float fTeam)
|
||||
{
|
||||
static void Radio_TeamMessage_Send(float fMessage, entity eEnt) {
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_RADIOMSG);
|
||||
WriteByte(MSG_MULTICAST, fMessage);
|
||||
msg_entity = eEnt;
|
||||
multicast('0 0 0', MULTICAST_ONE);
|
||||
}
|
||||
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
|
||||
if (eFind.team == fTeam) {
|
||||
Radio_TeamMessage_Send(fMessage, eFind);
|
||||
} else if (eFind.team == TEAM_VIP && fTeam == TEAM_CT) {
|
||||
Radio_TeamMessage_Send(fMessage, eFind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Radio_DefaultStart
|
||||
|
||||
Pick a generic, random radio string for global start messages
|
||||
=================
|
||||
*/
|
||||
float
|
||||
Radio_DefaultStart(void)
|
||||
{
|
||||
float fRand = floor(random(1, 4));
|
||||
|
||||
if (fRand == 1) {
|
||||
return RADIO_MOVEOUT;
|
||||
} else if (fRand == 2) {
|
||||
return RADIO_LOCKNLOAD;
|
||||
} else {
|
||||
return RADIO_LETSGO;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Radio_StartMessage
|
||||
|
||||
Decide which startmessage to play at the beginning of each round
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Radio_StartMessage(void)
|
||||
{
|
||||
if (g_cs_vipzones > 0) {
|
||||
Radio_TeamMessage(RADIO_VIP, TEAM_CT);
|
||||
Radio_TeamMessage(Radio_DefaultStart(), TEAM_T);
|
||||
} else if (g_cs_escapezones > 0) {
|
||||
Radio_TeamMessage(RADIO_GETOUT, TEAM_T);
|
||||
Radio_TeamMessage(Radio_DefaultStart(), TEAM_CT);
|
||||
} else {
|
||||
Radio_BroadcastMessage(Radio_DefaultStart());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CSEv_Radio_f
|
||||
|
||||
Triggered by clients, plays a message to members of the same team
|
||||
=================
|
||||
*/
|
||||
void
|
||||
CSEv_Radio_f(float fMessage)
|
||||
{
|
||||
static void CSEv_Radio_Send(float fMessage, entity eEnt) {
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_RADIOMSG2);
|
||||
WriteByte(MSG_MULTICAST, num_for_edict(eEnt) - 1);
|
||||
WriteByte(MSG_MULTICAST, fMessage);
|
||||
msg_entity = eEnt;
|
||||
multicast('0 0 0', MULTICAST_ONE);
|
||||
}
|
||||
|
||||
// Don't allow spamming
|
||||
/*if (self.fRadioFinished > time) {
|
||||
return;
|
||||
}*/
|
||||
|
||||
// When dead, don't talk
|
||||
if (self.health <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure that VIPs and CTs get eachother
|
||||
float fTargetTeam = self.team;
|
||||
if (fTargetTeam == TEAM_VIP) {
|
||||
fTargetTeam = TEAM_CT;
|
||||
}
|
||||
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
|
||||
if (eFind.team == fTargetTeam) {
|
||||
CSEv_Radio_Send(fMessage, eFind);
|
||||
} else if (eFind.team == TEAM_VIP && fTargetTeam == TEAM_CT) {
|
||||
CSEv_Radio_Send(fMessage, eFind);
|
||||
}
|
||||
}
|
||||
|
||||
/*self.fRadioFinished = time + 3.0f;*/
|
||||
}
|
4
src/server/cstrike/radio.h
Normal file
4
src/server/cstrike/radio.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
void Radio_BroadcastMessage(float fMessage)
|
||||
void Radio_TeamMessage(float fMessage, float fTeam)
|
||||
float Radio_DefaultStart(void)
|
||||
void Radio_StartMessage(void)
|
|
@ -14,25 +14,35 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "gamerules.h"
|
||||
#include "sentences.h"
|
||||
#include "skill.h"
|
||||
#include "logging.h"
|
||||
#include "vox.h"
|
||||
#include "nodes.h"
|
||||
#include "spawn.h"
|
||||
#include "flashlight.h"
|
||||
#include "weapons.h"
|
||||
|
||||
#define CLASSEXPORT(classname,classa) void classname(void) { spawnfunc_##classa(); }
|
||||
|
||||
var int autocvar_mp_flashlight = TRUE;
|
||||
var int g_hlbsp_materials = FALSE;
|
||||
|
||||
void FX_Impact(int iType, vector vecPos, vector vNormal);
|
||||
void FX_Explosion(vector vecPos);
|
||||
void FX_GibHuman(vector vecPos);
|
||||
void FX_Impact(int, vector, vector);
|
||||
void FX_Explosion(vector);
|
||||
void FX_GibHuman(vector);
|
||||
void Footsteps_Update(void);
|
||||
void Vox_Broadcast(string sMessage);
|
||||
|
||||
void TraceAttack_FireBullets(int,vector,int,vector,int);
|
||||
void TraceAttack_FireBullets(int, vector, int, vector, int);
|
||||
#ifdef BULLETPENETRATION
|
||||
void TraceAttack_SetPenetrationPower(int);
|
||||
#endif
|
||||
|
||||
void Damage_Radius(vector, entity, float, float, int, int);
|
||||
void Damage_Apply(entity, entity, float, int, int);
|
||||
void Client_TriggerCamera(entity eTarget, vector vecPos, vector vEndPos, float fResetTime);
|
||||
void Client_TriggerCamera(entity, vector, vector, float);
|
||||
void Client_FixAngle(entity, vector);
|
||||
void Game_Input(void);
|
||||
int Rules_IsTeamPlay(void);
|
||||
|
|
17
src/server/flashlight.h
Normal file
17
src/server/flashlight.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
void Flashlight_Toggle(void);
|
|
@ -28,7 +28,7 @@ CGameRules::FrameStart(void)
|
|||
//print("StartFrame!\n");
|
||||
}
|
||||
float
|
||||
CGameRules::ConsoleCommand(player pl, string cmd)
|
||||
CGameRules::ConsoleCommand(base_player pl, string cmd)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -45,32 +45,32 @@ CGameRules::PlayerDisconnect(entity pl)
|
|||
//print("ClientDisconnect!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerKill(player pl)
|
||||
CGameRules::PlayerKill(base_player pl)
|
||||
{
|
||||
//print("PlayerKill!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerDeath(player pl)
|
||||
CGameRules::PlayerDeath(base_player pl)
|
||||
{
|
||||
//print("PlayerDeath!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerPain(player pl)
|
||||
CGameRules::PlayerPain(base_player pl)
|
||||
{
|
||||
//print("ClientKill!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerSpawn(player pl)
|
||||
CGameRules::PlayerSpawn(base_player pl)
|
||||
{
|
||||
//print("PutClientInServer!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerPreFrame(player pl)
|
||||
CGameRules::PlayerPreFrame(base_player pl)
|
||||
{
|
||||
//print("PlayerPreThink!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerPostFrame(player pl)
|
||||
CGameRules::PlayerPostFrame(base_player pl)
|
||||
{
|
||||
//print("PlayerPostThink!\n");
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ CGameRules::LevelNewParms(void)
|
|||
//print("LevelNewParms!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::LevelChangeParms(player pl)
|
||||
CGameRules::LevelChangeParms(base_player pl)
|
||||
{
|
||||
//print("LevelChangeParms!\n");
|
||||
}
|
||||
|
|
|
@ -25,21 +25,21 @@ class CGameRules
|
|||
|
||||
/* logic */
|
||||
virtual void(void) FrameStart;
|
||||
virtual float(player,string) ConsoleCommand;
|
||||
virtual float(base_player,string) ConsoleCommand;
|
||||
|
||||
/* client */
|
||||
virtual void(entity) PlayerConnect;
|
||||
virtual void(entity) PlayerDisconnect;
|
||||
virtual void(player) PlayerKill;
|
||||
virtual void(player) PlayerSpawn;
|
||||
virtual void(player) PlayerPreFrame;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
virtual void(player) PlayerDeath;
|
||||
virtual void(player) PlayerPain;
|
||||
virtual void(base_player) PlayerKill;
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerPreFrame;
|
||||
virtual void(base_player) PlayerPostFrame;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
virtual void(base_player) PlayerPain;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(void) LevelNewParms;
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(base_player) LevelChangeParms;
|
||||
|
||||
virtual int(int) MaxItemPerSlot;
|
||||
|
||||
|
@ -48,9 +48,9 @@ class CGameRules
|
|||
virtual void(void) IntermissionEnd;
|
||||
|
||||
/* spectator */
|
||||
/*virtual void(player) SpectatorConnect;
|
||||
virtual void(player) SpectatorDisconnect;
|
||||
virtual void(player) SpectatorThink;*/
|
||||
/*virtual void(base_player) SpectatorConnect;
|
||||
virtual void(base_player) SpectatorDisconnect;
|
||||
virtual void(base_player) SpectatorThink;*/
|
||||
};
|
||||
|
||||
/* our currently running mode */
|
||||
|
|
|
@ -19,8 +19,9 @@ var int autocvar_sv_playerkeepalive = TRUE;
|
|||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
HLGameRules::PlayerPostFrame(player pl)
|
||||
HLGameRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
|
@ -123,8 +124,9 @@ HLGameRules::LevelNewParms(void)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(player pl)
|
||||
HLGameRules::LevelDecodeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
|
@ -178,8 +180,9 @@ HLGameRules::LevelDecodeParms(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelChangeParms(player pl)
|
||||
HLGameRules::LevelChangeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
|
@ -260,7 +263,8 @@ HLGameRules::PlayerDisconnect(entity pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerKill(player pl)
|
||||
HLGameRules::PlayerKill(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,10 @@ OP4CTFRules::FrameStart(void)
|
|||
}
|
||||
|
||||
void
|
||||
OP4CTFRules::PlayerDeath(player pl)
|
||||
OP4CTFRules::PlayerDeath(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
|
||||
/* obituary networking */
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_OBITUARY);
|
||||
|
@ -91,8 +93,10 @@ OP4CTFRules::PlayerDeath(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
OP4CTFRules::PlayerSpawn(player pl)
|
||||
OP4CTFRules::PlayerSpawn(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
|
||||
/* this is where the mods want to deviate */
|
||||
entity spot;
|
||||
|
||||
|
|
|
@ -22,6 +22,6 @@ class OP4CTFRules:HLGameRules
|
|||
virtual void(void) FrameStart;
|
||||
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
virtual void(player) PlayerDeath;
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
};
|
||||
|
|
|
@ -5,23 +5,18 @@
|
|||
#define SERVER
|
||||
#define VALVE
|
||||
#define GEARBOX
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
../../gs-entbase/server/defs.h
|
||||
../../shared/defs.h
|
||||
../../shared/sound.c
|
||||
../../shared/valve/animations.h
|
||||
../defs.h
|
||||
../plugins.c
|
||||
../logging.c
|
||||
../nodes.c
|
||||
../skill.c
|
||||
../sentences.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../../gs-entbase/shared.src
|
||||
../../shared/gearbox/include.src
|
||||
|
||||
../../shared/gearbox/player.cpp
|
||||
../gearbox/defs.h
|
||||
|
||||
../valve/monster_apache.cpp
|
||||
|
@ -58,47 +53,11 @@
|
|||
../valve/monster_tentacle.cpp
|
||||
../valve/monster_turret.cpp
|
||||
../valve/monster_zombie.cpp
|
||||
|
||||
../gearbox/monster_drillsergeant.cpp
|
||||
../gearbox/monster_recruit.cpp
|
||||
|
||||
../../shared/valve/fx_blood.c
|
||||
../../shared/valve/fx_breakmodel.c
|
||||
../../shared/valve/fx_explosion.c
|
||||
../../shared/valve/fx_gibhuman.c
|
||||
../../shared/valve/fx_impact.c
|
||||
../../shared/valve/fx_spark.c
|
||||
../valve/player.c
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
../valve/spectator.c
|
||||
../../shared/gearbox/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/gearbox/weapons.h
|
||||
../../shared/valve/w_crossbow.c
|
||||
../../shared/valve/w_crowbar.c
|
||||
../../shared/valve/w_egon.c
|
||||
../../shared/valve/w_gauss.c
|
||||
../../shared/valve/w_glock.c
|
||||
../../shared/valve/w_handgrenade.c
|
||||
../../shared/valve/w_hornetgun.c
|
||||
../../shared/valve/w_mp5.c
|
||||
../../shared/valve/w_python.c
|
||||
../../shared/valve/w_rpg.c
|
||||
../../shared/valve/w_satchel.c
|
||||
../../shared/valve/w_shotgun.c
|
||||
../../shared/valve/w_snark.c
|
||||
../../shared/valve/w_tripmine.c
|
||||
../../shared/gearbox/w_pipewrench.c
|
||||
../../shared/gearbox/w_knife.c
|
||||
../../shared/gearbox/w_grapple.c
|
||||
../../shared/gearbox/w_eagle.c
|
||||
../../shared/gearbox/w_m249.c
|
||||
../../shared/gearbox/w_displacer.c
|
||||
../../shared/gearbox/w_sniperrifle.c
|
||||
../../shared/gearbox/w_sporelauncher.c
|
||||
../../shared/gearbox/w_penguin.c
|
||||
../../shared/gearbox/w_shockrifle.c
|
||||
../valve/items.cpp
|
||||
../valve/item_longjump.cpp
|
||||
../valve/item_suit.cpp
|
||||
|
@ -113,28 +72,21 @@
|
|||
../valve/xen_plantlight.cpp
|
||||
../valve/ammo.cpp
|
||||
../gearbox/ammo_op4.cpp
|
||||
../../shared/gearbox/weapons.c
|
||||
../../shared/valve/weapon_common.c
|
||||
../spawn.c
|
||||
../vox.c
|
||||
../../shared/valve/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../gearbox/gamerules.cpp
|
||||
../valve/gamerules_singleplayer.cpp
|
||||
../valve/gamerules_multiplayer.cpp
|
||||
../gearbox/gamerules_ctf.cpp
|
||||
../valve/client.c
|
||||
../client.c
|
||||
../gearbox/server.c
|
||||
../server.c
|
||||
../valve/damage.c
|
||||
../traceattack.c
|
||||
../valve/rules.c
|
||||
../footsteps.c
|
||||
../flashlight.c
|
||||
input.c
|
||||
|
||||
../../botlib/include.src
|
||||
|
||||
../valve/input.c
|
||||
../valve/spawn.c
|
||||
../vote.c
|
||||
../entry.c
|
||||
|
||||
../include.src
|
||||
#endlist
|
||||
|
||||
|
|
|
@ -5,23 +5,18 @@
|
|||
#define SERVER
|
||||
#define VALVE
|
||||
#define HUNGER
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
../../gs-entbase/server/defs.h
|
||||
../../shared/defs.h
|
||||
../../shared/sound.c
|
||||
../../shared/valve/animations.h
|
||||
../defs.h
|
||||
../plugins.c
|
||||
../logging.c
|
||||
../nodes.c
|
||||
../skill.c
|
||||
../sentences.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../../gs-entbase/shared.src
|
||||
../../shared/hunger/include.src
|
||||
|
||||
../../shared/hunger/player.cpp
|
||||
../valve/defs.h
|
||||
|
||||
../valve/monster_apache.cpp
|
||||
|
@ -59,43 +54,8 @@
|
|||
../valve/monster_turret.cpp
|
||||
../valve/monster_zombie.cpp
|
||||
|
||||
../../shared/valve/fx_blood.c
|
||||
../../shared/valve/fx_breakmodel.c
|
||||
../../shared/valve/fx_explosion.c
|
||||
../../shared/valve/fx_gibhuman.c
|
||||
../../shared/valve/fx_impact.c
|
||||
../../shared/valve/fx_spark.c
|
||||
../valve/player.c
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
../valve/spectator.c
|
||||
../../shared/hunger/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/hunger/weapons.h
|
||||
../../shared/valve/w_crossbow.c
|
||||
../../shared/valve/w_crowbar.c
|
||||
../../shared/valve/w_egon.c
|
||||
../../shared/valve/w_gauss.c
|
||||
../../shared/valve/w_glock.c
|
||||
../../shared/valve/w_handgrenade.c
|
||||
../../shared/valve/w_mp5.c
|
||||
../../shared/valve/w_python.c
|
||||
../../shared/valve/w_rpg.c
|
||||
../../shared/valve/w_satchel.c
|
||||
../../shared/valve/w_shotgun.c
|
||||
../../shared/valve/w_snark.c
|
||||
../../shared/valve/w_tripmine.c
|
||||
../../shared/hunger/w_ap9.c
|
||||
../../shared/hunger/w_chaingun.c
|
||||
../../shared/hunger/w_flame.c
|
||||
../../shared/hunger/w_silencer.c
|
||||
../../shared/hunger/w_medkit.c
|
||||
../../shared/hunger/w_shovel.c
|
||||
../../shared/hunger/w_sniper.c
|
||||
../../shared/hunger/w_sniper2.c
|
||||
../../shared/hunger/w_spanner.c
|
||||
../../shared/hunger/w_taurus.c
|
||||
../../shared/hunger/w_tnt.c
|
||||
../valve/items.cpp
|
||||
../valve/item_longjump.cpp
|
||||
../valve/item_suit.cpp
|
||||
|
@ -110,27 +70,19 @@
|
|||
../valve/xen_plantlight.cpp
|
||||
../valve/ammo.cpp
|
||||
../hunger/ammo_th.cpp
|
||||
../../shared/hunger/weapons.c
|
||||
../../shared/valve/weapon_common.c
|
||||
../spawn.c
|
||||
../vox.c
|
||||
../../shared/valve/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../valve/gamerules.cpp
|
||||
../valve/gamerules_singleplayer.cpp
|
||||
../valve/gamerules_multiplayer.cpp
|
||||
../valve/client.c
|
||||
../client.c
|
||||
../valve/server.c
|
||||
../server.c
|
||||
../valve/damage.c
|
||||
../traceattack.c
|
||||
../valve/rules.c
|
||||
../footsteps.c
|
||||
../flashlight.c
|
||||
input.c
|
||||
|
||||
../../botlib/include.src
|
||||
|
||||
../hunger/input.c
|
||||
../valve/spawn.c
|
||||
../vote.c
|
||||
../entry.c
|
||||
|
||||
../include.src
|
||||
#endlist
|
||||
|
|
18
src/server/include.src
Normal file
18
src/server/include.src
Normal file
|
@ -0,0 +1,18 @@
|
|||
#includelist
|
||||
plugins.c
|
||||
logging.c
|
||||
nodes.c
|
||||
skill.c
|
||||
sentences.c
|
||||
spawn.c
|
||||
vox.c
|
||||
gamerules.cpp
|
||||
client.c
|
||||
server.c
|
||||
traceattack.c
|
||||
footsteps.c
|
||||
flashlight.c
|
||||
vote.c
|
||||
weapons.c
|
||||
entry.c
|
||||
#endlist
|
|
@ -14,8 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
var int autocvar_logging_enabled = FALSE;
|
||||
|
||||
void
|
||||
Logging_Frag(entity a, entity v)
|
||||
{
|
||||
|
|
20
src/server/logging.h
Normal file
20
src/server/logging.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
var int autocvar_logging_enabled = FALSE;
|
||||
|
||||
void Logging_Frag(entity, entity);
|
||||
void Logging_Pickup(entity, entity, string);
|
|
@ -14,29 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* parse info_node entities and convert them to FTE compatible routing data */
|
||||
#define NODE_DEBUG
|
||||
|
||||
typedef struct node_s {
|
||||
vector origin;
|
||||
float radius;
|
||||
|
||||
struct neighbour_s
|
||||
{
|
||||
int node;
|
||||
float dist;
|
||||
int flags;
|
||||
} *nb;
|
||||
int nb_count;
|
||||
} node_t;
|
||||
|
||||
static node_t *g_pNodes;
|
||||
static int g_iNodes;
|
||||
int g_nodes_present;
|
||||
|
||||
/* info_nodes can do a lot more in theory, right now we don't */
|
||||
class info_node { };
|
||||
|
||||
/* write current nodes to disk */
|
||||
void
|
||||
Nodes_Save(string filename)
|
||||
|
|
43
src/server/nodes.h
Normal file
43
src/server/nodes.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* parse info_node entities and convert them to FTE compatible routing data */
|
||||
#define NODE_DEBUG
|
||||
|
||||
typedef struct node_s {
|
||||
vector origin;
|
||||
float radius;
|
||||
|
||||
struct neighbour_s
|
||||
{
|
||||
int node;
|
||||
float dist;
|
||||
int flags;
|
||||
} *nb;
|
||||
int nb_count;
|
||||
} node_t;
|
||||
|
||||
node_t *g_pNodes;
|
||||
int g_iNodes;
|
||||
int g_nodes_present;
|
||||
|
||||
/* info_nodes can do a lot more in theory, right now we don't */
|
||||
class info_node { };
|
||||
|
||||
/* write current nodes to disk */
|
||||
void Nodes_Save(string);
|
||||
void Nodes_Load(string);
|
||||
void Nodes_Init(void)
|
|
@ -19,8 +19,10 @@ var int autocvar_sv_playerkeepalive = TRUE;
|
|||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
HLGameRules::PlayerPostFrame(player pl)
|
||||
HLGameRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
|
@ -123,8 +125,9 @@ HLGameRules::LevelNewParms(void)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(player pl)
|
||||
HLGameRules::LevelDecodeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
|
@ -159,8 +162,9 @@ HLGameRules::LevelDecodeParms(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelChangeParms(player pl)
|
||||
HLGameRules::LevelChangeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
|
@ -222,7 +226,8 @@ HLGameRules::PlayerDisconnect(entity pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerKill(player pl)
|
||||
HLGameRules::PlayerKill(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,9 @@ HLMultiplayerRules::FrameStart(void)
|
|||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerDeath(player pl)
|
||||
HLMultiplayerRules::PlayerDeath(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.solid = SOLID_NOT;
|
||||
pl.takedamage = DAMAGE_NO;
|
||||
|
@ -57,8 +58,9 @@ HLMultiplayerRules::PlayerDeath(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerSpawn(player pl)
|
||||
HLMultiplayerRules::PlayerSpawn(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
/* this is where the mods want to deviate */
|
||||
entity spot;
|
||||
|
||||
|
|
|
@ -5,23 +5,18 @@
|
|||
#define SERVER
|
||||
#define VALVE
|
||||
#define POKE646
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
../../gs-entbase/server/defs.h
|
||||
../../shared/defs.h
|
||||
../../shared/sound.c
|
||||
../../shared/valve/animations.h
|
||||
../defs.h
|
||||
../plugins.c
|
||||
../logging.c
|
||||
../nodes.c
|
||||
../skill.c
|
||||
../sentences.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../../gs-entbase/shared.src
|
||||
../../shared/poke646/include.src
|
||||
|
||||
../../shared/poke646/player.cpp
|
||||
../valve/defs.h
|
||||
|
||||
../valve/monster_apache.cpp
|
||||
|
@ -59,29 +54,10 @@
|
|||
../valve/monster_turret.cpp
|
||||
../valve/monster_zombie.cpp
|
||||
|
||||
../../shared/valve/fx_blood.c
|
||||
../../shared/valve/fx_breakmodel.c
|
||||
../../shared/valve/fx_explosion.c
|
||||
../../shared/valve/fx_gibhuman.c
|
||||
../../shared/valve/fx_impact.c
|
||||
../../shared/valve/fx_spark.c
|
||||
../valve/player.c
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
../valve/spectator.c
|
||||
../../shared/poke646/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/poke646/weapons.h
|
||||
../../shared/valve/w_satchel.c
|
||||
../../shared/poke646/weapons.h
|
||||
../../shared/poke646/w_bradnailer.c
|
||||
../../shared/poke646/w_cmlwbr.c
|
||||
../../shared/poke646/w_heaterpipe.c
|
||||
../../shared/poke646/w_nailgun.c
|
||||
../../shared/poke646/w_pipebomb.c
|
||||
../../shared/poke646/w_shotgun.c
|
||||
../../shared/poke646/w_xs.c
|
||||
../valve/items.cpp
|
||||
../valve/item_longjump.cpp
|
||||
../valve/item_suit.cpp
|
||||
../valve/item_healthkit.cpp
|
||||
../valve/item_battery.cpp
|
||||
|
@ -92,27 +68,19 @@
|
|||
../valve/xen_hair.cpp
|
||||
../valve/xen_plantlight.cpp
|
||||
../poke646/ammo_p646.cpp
|
||||
../../shared/poke646/weapons.c
|
||||
../../shared/valve/weapon_common.c
|
||||
../spawn.c
|
||||
../vox.c
|
||||
../../shared/valve/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../poke646/gamerules.cpp
|
||||
../valve/gamerules_singleplayer.cpp
|
||||
../poke646/gamerules_multiplayer.cpp
|
||||
../valve/client.c
|
||||
../client.c
|
||||
../valve/server.c
|
||||
../server.c
|
||||
../valve/damage.c
|
||||
../traceattack.c
|
||||
../valve/rules.c
|
||||
../footsteps.c
|
||||
../flashlight.c
|
||||
input.c
|
||||
|
||||
../../botlib/include.src
|
||||
|
||||
../poke646/input.c
|
||||
../valve/spawn.c
|
||||
../vote.c
|
||||
../entry.c
|
||||
|
||||
../include.src
|
||||
#endlist
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
var int autocvar_sv_playerkeepalive = TRUE;
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(player pl)
|
||||
HLGameRules::LevelDecodeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
|
@ -61,8 +62,9 @@ HLGameRules::LevelDecodeParms(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelChangeParms(player pl)
|
||||
HLGameRules::LevelChangeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
|
@ -110,8 +112,9 @@ HLGameRules::LevelNewParms(void)
|
|||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
HLGameRules::PlayerPostFrame(player pl)
|
||||
HLGameRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
|
@ -238,7 +241,8 @@ HLGameRules::PlayerDisconnect(entity pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerKill(player pl)
|
||||
HLGameRules::PlayerKill(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,9 @@ HLMultiplayerRules::FrameStart(void)
|
|||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerDeath(player pl)
|
||||
HLMultiplayerRules::PlayerDeath(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.solid = SOLID_NOT;
|
||||
pl.takedamage = DAMAGE_NO;
|
||||
|
@ -34,7 +35,6 @@ HLMultiplayerRules::PlayerDeath(player pl)
|
|||
|
||||
pl.think = PutClientInServer;
|
||||
pl.nextthink = time + 4.0f;
|
||||
sound(pl, CHAN_AUTO, "fvox/flatline.wav", 1.0, ATTN_NORM);
|
||||
|
||||
if (pl.health < -50) {
|
||||
pl.health = 0;
|
||||
|
@ -58,8 +58,9 @@ HLMultiplayerRules::PlayerDeath(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerSpawn(player pl)
|
||||
HLMultiplayerRules::PlayerSpawn(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
/* this is where the mods want to deviate */
|
||||
entity spot;
|
||||
|
||||
|
|
|
@ -4,84 +4,39 @@
|
|||
#define QWSSQC
|
||||
#define SERVER
|
||||
#define VALVE
|
||||
#define REWOLF
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
../../gs-entbase/server/defs.h
|
||||
../../shared/defs.h
|
||||
../../shared/sound.c
|
||||
../../shared/valve/animations.h
|
||||
../defs.h
|
||||
../plugins.c
|
||||
../logging.c
|
||||
../nodes.c
|
||||
../skill.c
|
||||
../sentences.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../../gs-entbase/shared.src
|
||||
../../shared/rewolf/include.src
|
||||
|
||||
../../shared/rewolf/player.cpp
|
||||
../valve/defs.h
|
||||
|
||||
../valve/monster_rat.cpp
|
||||
../valve/monster_scientist_dead.cpp
|
||||
gunman_cycler.cpp
|
||||
monster_human_bandit.cpp
|
||||
monster_human_chopper.cpp
|
||||
monster_human_demoman.cpp
|
||||
monster_human_gunman.cpp
|
||||
monster_human_unarmed.cpp
|
||||
../../shared/valve/fx_blood.c
|
||||
../../shared/valve/fx_breakmodel.c
|
||||
../../shared/valve/fx_explosion.c
|
||||
../../shared/valve/fx_gibhuman.c
|
||||
../../shared/valve/fx_impact.c
|
||||
../../shared/valve/fx_spark.c
|
||||
../valve/player.c
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
../valve/spectator.c
|
||||
../../shared/rewolf/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/rewolf/weapons.h
|
||||
../../shared/rewolf/w_fists.c
|
||||
../../shared/rewolf/w_gausspistol.c
|
||||
../../shared/rewolf/w_grenade.c
|
||||
../../shared/rewolf/w_shotgun.c
|
||||
../../shared/rewolf/w_beamgun.c
|
||||
../../shared/rewolf/w_chemicalgun.c
|
||||
../../shared/rewolf/w_dml.c
|
||||
../../shared/rewolf/w_minigun.c
|
||||
../../shared/rewolf/w_aicore.c
|
||||
|
||||
../valve/items.cpp
|
||||
../valve/item_longjump.cpp
|
||||
../valve/item_suit.cpp
|
||||
../valve/item_healthkit.cpp
|
||||
../valve/item_battery.cpp
|
||||
|
||||
../valve/world_items.cpp
|
||||
|
||||
../../shared/rewolf/weapons.c
|
||||
../../shared/valve/weapon_common.c
|
||||
../spawn.c
|
||||
../vox.c
|
||||
../../shared/valve/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../rewolf/gamerules.cpp
|
||||
../valve/gamerules_singleplayer.cpp
|
||||
../rewolf/gamerules_multiplayer.cpp
|
||||
|
||||
../valve/client.c
|
||||
../client.c
|
||||
../valve/server.c
|
||||
../server.c
|
||||
../valve/damage.c
|
||||
../traceattack.c
|
||||
../valve/rules.c
|
||||
../footsteps.c
|
||||
../flashlight.c
|
||||
input.c
|
||||
|
||||
../../botlib/include.src
|
||||
|
||||
../rewolf/input.c
|
||||
../valve/spawn.c
|
||||
../vote.c
|
||||
../entry.c
|
||||
|
||||
../include.src
|
||||
#endlist
|
||||
|
|
|
@ -18,7 +18,7 @@ var int autocvar_sh_insanity = 10;
|
|||
var int autocvar_sv_playerkeepalive = TRUE;
|
||||
|
||||
void
|
||||
SHMultiplayerRules::PlayerDeath(player pl)
|
||||
SHMultiplayerRules::PlayerDeath(base_player pl)
|
||||
{
|
||||
/* obituary networking */
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
|
@ -78,8 +78,9 @@ SHMultiplayerRules::PlayerDeath(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
SHMultiplayerRules::PlayerSpawn(player pl)
|
||||
SHMultiplayerRules::PlayerSpawn(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
/* this is where the mods want to deviate */
|
||||
entity spot;
|
||||
|
||||
|
@ -128,8 +129,9 @@ SHMultiplayerRules::PlayerSpawn(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
SHMultiplayerRules::LevelDecodeParms(player pl)
|
||||
SHMultiplayerRules::LevelDecodeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
|
@ -172,8 +174,9 @@ SHMultiplayerRules::LevelDecodeParms(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
SHMultiplayerRules::LevelChangeParms(player pl)
|
||||
SHMultiplayerRules::LevelChangeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
|
@ -221,8 +224,9 @@ SHMultiplayerRules::LevelNewParms(void)
|
|||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
SHMultiplayerRules::PlayerPostFrame(player pl)
|
||||
SHMultiplayerRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
|
@ -360,14 +364,16 @@ SHMultiplayerRules::PlayerDisconnect(entity pl)
|
|||
}
|
||||
|
||||
void
|
||||
SHMultiplayerRules::PlayerKill(player pl)
|
||||
SHMultiplayerRules::PlayerKill(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
||||
void
|
||||
SHMultiplayerRules::ScientistKill(player pl, entity sci)
|
||||
SHMultiplayerRules::ScientistKill(base_player pp, entity sci)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
/* obituary networking */
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_OBITUARY);
|
||||
|
|
|
@ -19,15 +19,15 @@
|
|||
class SHMultiplayerRules:CGameRules
|
||||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(entity) PlayerConnect;
|
||||
virtual void(entity) PlayerDisconnect;
|
||||
virtual void(player) PlayerKill;
|
||||
virtual void(player) PlayerDeath;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
virtual void(player, entity) ScientistKill;
|
||||
virtual void(base_player) PlayerKill;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
virtual void(base_player) PlayerPostFrame;
|
||||
virtual void(base_player, entity) ScientistKill;
|
||||
|
||||
virtual void(player) LevelDecodeParms;
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(base_player) LevelDecodeParms;
|
||||
virtual void(base_player) LevelChangeParms;
|
||||
virtual void(void) LevelNewParms;
|
||||
};
|
||||
|
|
|
@ -5,24 +5,18 @@
|
|||
#define SERVER
|
||||
#define VALVE
|
||||
#define SCIHUNT
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
../../gs-entbase/server/defs.h
|
||||
../../shared/defs.h
|
||||
../../shared/sound.c
|
||||
../../shared/valve/animations.h
|
||||
../defs.h
|
||||
|
||||
../plugins.c
|
||||
../logging.c
|
||||
../nodes.c
|
||||
../skill.c
|
||||
../sentences.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../../gs-entbase/shared.src
|
||||
../../shared/scihunt/include.src
|
||||
|
||||
../../shared/scihunt/player.cpp
|
||||
../scihunt/defs.h
|
||||
|
||||
../valve/monster_apache.cpp
|
||||
|
@ -54,43 +48,14 @@
|
|||
../valve/monster_rat.cpp
|
||||
../valve/monster_scientist_dead.cpp
|
||||
../valve/monster_sitting_scientist.cpp
|
||||
monster_scientist.cpp
|
||||
../valve/monster_sentry.cpp
|
||||
../valve/monster_tentacle.cpp
|
||||
../valve/monster_turret.cpp
|
||||
../valve/monster_zombie.cpp
|
||||
|
||||
../../shared/valve/fx_blood.c
|
||||
../../shared/valve/fx_breakmodel.c
|
||||
../../shared/valve/fx_explosion.c
|
||||
../../shared/valve/fx_gibhuman.c
|
||||
../../shared/valve/fx_impact.c
|
||||
../../shared/valve/fx_spark.c
|
||||
../scihunt/monster_scientist.cpp
|
||||
|
||||
../valve/player.c
|
||||
../../shared/scihunt/pmove.c
|
||||
../../shared/pmove.c
|
||||
../valve/spectator.c
|
||||
../../shared/scihunt/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/scihunt/weapons.h
|
||||
../../shared/valve/w_crossbow.c
|
||||
../../shared/valve/w_crowbar.c
|
||||
../../shared/valve/w_egon.c
|
||||
../../shared/valve/w_gauss.c
|
||||
../../shared/valve/w_glock.c
|
||||
../../shared/valve/w_handgrenade.c
|
||||
../../shared/valve/w_hornetgun.c
|
||||
../../shared/valve/w_mp5.c
|
||||
../../shared/valve/w_python.c
|
||||
../../shared/valve/w_rpg.c
|
||||
../../shared/valve/w_satchel.c
|
||||
../../shared/valve/w_shotgun.c
|
||||
../../shared/valve/w_snark.c
|
||||
../../shared/valve/w_tripmine.c
|
||||
../../shared/scihunt/w_cannon.c
|
||||
../../shared/scihunt/w_chainsaw.c
|
||||
../../shared/scihunt/w_hammer.c
|
||||
../valve/items.cpp
|
||||
../valve/item_longjump.cpp
|
||||
../valve/item_suit.cpp
|
||||
|
@ -104,32 +69,18 @@ monster_scientist.cpp
|
|||
../valve/xen_hair.cpp
|
||||
../valve/xen_plantlight.cpp
|
||||
../valve/ammo.cpp
|
||||
../../shared/scihunt/weapons.c
|
||||
../../shared/valve/weapon_common.c
|
||||
|
||||
shdata_parse.c
|
||||
../spawn.c
|
||||
../vox.c
|
||||
|
||||
../../shared/valve/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../scihunt/shdata_parse.c
|
||||
../scihunt/gamerules.cpp
|
||||
../valve/client.c
|
||||
../client.c
|
||||
|
||||
server.c
|
||||
../server.c
|
||||
|
||||
../scihunt/server.c
|
||||
../valve/damage.c
|
||||
../traceattack.c
|
||||
../valve/rules.c
|
||||
|
||||
../footsteps.c
|
||||
../flashlight.c
|
||||
input.c
|
||||
../../botlib/include.src
|
||||
|
||||
../scihunt/input.c
|
||||
../valve/spawn.c
|
||||
../vote.c
|
||||
../entry.c
|
||||
|
||||
../include.src
|
||||
#endlist
|
||||
|
|
|
@ -23,17 +23,6 @@
|
|||
* we'll just default to those whenever there's no custom value set.
|
||||
*/
|
||||
|
||||
#define DYNAMIC_SENTENCES
|
||||
|
||||
#ifdef DYNAMIC_SENTENCES
|
||||
string *g_sentences;
|
||||
int g_sentences_count;
|
||||
#else
|
||||
#define SENTENCES_LIMIT 1024
|
||||
string g_sentences[SENTENCES_LIMIT];
|
||||
int g_sentences_count;
|
||||
#endif
|
||||
|
||||
void
|
||||
Sentences_Init(void)
|
||||
{
|
||||
|
|
29
src/server/sentences.h
Normal file
29
src/server/sentences.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define DYNAMIC_SENTENCES
|
||||
|
||||
#ifdef DYNAMIC_SENTENCES
|
||||
string *g_sentences;
|
||||
int g_sentences_count;
|
||||
#else
|
||||
#define SENTENCES_LIMIT 1024
|
||||
string g_sentences[SENTENCES_LIMIT];
|
||||
int g_sentences_count;
|
||||
#endif
|
||||
|
||||
void Sentences_Init(void);
|
||||
string Sentences_GetSamples(string);
|
18
src/server/skill.h
Normal file
18
src/server/skill.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
float Skill_GetValue(string);
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
void
|
||||
Spawn_ObserverCam(player pl)
|
||||
Spawn_ObserverCam(base_player pl)
|
||||
{
|
||||
entity eTarget;
|
||||
|
||||
|
|
19
src/server/spawn.h
Normal file
19
src/server/spawn.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
void Spawn_ObserverCam(base_player);
|
||||
float Spawn_PlayerRange(entity);
|
||||
entity Spawn_SelectRandom(string);
|
|
@ -19,8 +19,9 @@ var int autocvar_sv_playerkeepalive = TRUE;
|
|||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
TFCGameRules::PlayerPostFrame(player pl)
|
||||
TFCGameRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
|
@ -158,14 +159,16 @@ TFCGameRules::PlayerDisconnect(entity pl)
|
|||
}
|
||||
|
||||
void
|
||||
TFCGameRules::PlayerKill(player pl)
|
||||
TFCGameRules::PlayerKill(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
||||
void
|
||||
TFCGameRules::PlayerSpawn(player pl)
|
||||
TFCGameRules::PlayerSpawn(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
pl.classname = "spectator";
|
||||
pl.health = 0;
|
||||
pl.armor = 0;
|
||||
|
|
|
@ -14,15 +14,13 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../gamerules.h"
|
||||
|
||||
class TFCGameRules:CGameRules
|
||||
{
|
||||
virtual void(entity) PlayerConnect;
|
||||
virtual void(entity) PlayerDisconnect;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
virtual void(player) PlayerSpawn;
|
||||
virtual void(player) PlayerKill;
|
||||
virtual void(base_player) PlayerPostFrame;
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerKill;
|
||||
|
||||
virtual void(void) LevelNewParms;
|
||||
};
|
||||
|
|
|
@ -4,86 +4,40 @@
|
|||
#define QWSSQC
|
||||
#define SERVER
|
||||
#define VALVE
|
||||
#define TFC
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
../../gs-entbase/server/defs.h
|
||||
../../shared/defs.h
|
||||
../../shared/sound.c
|
||||
../../shared/valve/animations.h
|
||||
../defs.h
|
||||
../plugins.c
|
||||
../logging.c
|
||||
../nodes.c
|
||||
../skill.c
|
||||
../sentences.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../../gs-entbase/shared.src
|
||||
../../shared/tfc/include.src
|
||||
|
||||
../../shared/valve/player.cpp
|
||||
../tfc/defs.h
|
||||
|
||||
../../shared/valve/fx_blood.c
|
||||
../../shared/valve/fx_breakmodel.c
|
||||
../../shared/valve/fx_explosion.c
|
||||
../../shared/valve/fx_gibhuman.c
|
||||
../../shared/valve/fx_impact.c
|
||||
../../shared/valve/fx_spark.c
|
||||
|
||||
../valve/player.c
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
../valve/spectator.c
|
||||
|
||||
../../shared/tfc/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/tfc/weapons.h
|
||||
../../shared/tfc/w_asscan.c
|
||||
../../shared/tfc/w_autorifle.c
|
||||
../../shared/tfc/w_crowbar.c
|
||||
../../shared/tfc/w_dbs.c
|
||||
../../shared/tfc/w_flamer.c
|
||||
../../shared/tfc/w_glauncher.c
|
||||
../../shared/tfc/w_grapple.c
|
||||
../../shared/tfc/w_incendiary.c
|
||||
../../shared/tfc/w_knife.c
|
||||
../../shared/tfc/w_medkit.c
|
||||
../../shared/tfc/w_nailgun.c
|
||||
../../shared/tfc/w_pipebomb.c
|
||||
../../shared/tfc/w_railgun.c
|
||||
../../shared/tfc/w_rpg.c
|
||||
../../shared/tfc/w_sbs.c
|
||||
../../shared/tfc/w_sniper.c
|
||||
../../shared/tfc/w_supernail.c
|
||||
../../shared/tfc/w_tranquil.c
|
||||
../../shared/tfc/w_umbrella.c
|
||||
../../shared/tfc/w_wrench.c
|
||||
../valve/items.cpp
|
||||
../valve/item_healthkit.cpp
|
||||
info_tfgoal.cpp
|
||||
item_tfgoal.cpp
|
||||
info_player_teamspawn.cpp
|
||||
../../shared/tfc/weapons.c
|
||||
../../shared/valve/weapon_common.c
|
||||
../tfc/info_player_teamspawn.cpp
|
||||
../tfc/info_tfgoal.cpp
|
||||
../tfc/item_tfgoal.cpp
|
||||
|
||||
../spawn.c
|
||||
spawn.c
|
||||
../vox.c
|
||||
../../shared/valve/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../tfc/gamerules.cpp
|
||||
../valve/client.c
|
||||
../client.c
|
||||
../tfc/server.c
|
||||
../server.c
|
||||
../valve/damage.c
|
||||
../traceattack.c
|
||||
../valve/rules.c
|
||||
../footsteps.c
|
||||
../flashlight.c
|
||||
input.c
|
||||
../valve/spawn.c
|
||||
../vote.c
|
||||
../entry.c
|
||||
|
||||
../../botlib/include.src
|
||||
|
||||
../tfc/input.c
|
||||
../tfc/spawn.c
|
||||
|
||||
../include.src
|
||||
#endlist
|
||||
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
var int autocvar_sv_playerkeepalive = TRUE;
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(player pl)
|
||||
HLGameRules::LevelDecodeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
|
@ -61,8 +62,9 @@ HLGameRules::LevelDecodeParms(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelChangeParms(player pl)
|
||||
HLGameRules::LevelChangeParms(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
|
@ -110,7 +112,7 @@ HLGameRules::LevelNewParms(void)
|
|||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
HLGameRules::PlayerPostFrame(player pl)
|
||||
HLGameRules::PlayerPostFrame(base_player pl)
|
||||
{
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
|
@ -238,7 +240,7 @@ HLGameRules::PlayerDisconnect(entity pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerKill(player pl)
|
||||
HLGameRules::PlayerKill(base_player pl)
|
||||
{
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
|
|
@ -14,25 +14,23 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../gamerules.h"
|
||||
|
||||
class HLGameRules:CGameRules
|
||||
{
|
||||
virtual void(entity) PlayerConnect;
|
||||
virtual void(entity) PlayerDisconnect;
|
||||
virtual void(player) PlayerKill;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
virtual void(base_player) PlayerKill;
|
||||
virtual void(base_player) PlayerPostFrame;
|
||||
|
||||
virtual void(player) LevelDecodeParms;
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(base_player) LevelDecodeParms;
|
||||
virtual void(base_player) LevelChangeParms;
|
||||
virtual void(void) LevelNewParms;
|
||||
};
|
||||
|
||||
class HLSingleplayerRules:HLGameRules
|
||||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
virtual void(player) PlayerDeath;
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
};
|
||||
|
||||
class HLMultiplayerRules:HLGameRules
|
||||
|
@ -43,6 +41,6 @@ class HLMultiplayerRules:HLGameRules
|
|||
virtual void(void) FrameStart;
|
||||
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
virtual void(player) PlayerDeath;
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ HLMultiplayerRules::FrameStart(void)
|
|||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerDeath(player pl)
|
||||
HLMultiplayerRules::PlayerDeath(base_player pl)
|
||||
{
|
||||
/* obituary networking */
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
|
@ -58,7 +58,7 @@ HLMultiplayerRules::PlayerDeath(player pl)
|
|||
IntermissionStart();
|
||||
}
|
||||
|
||||
weaponbox_spawn(pl);
|
||||
weaponbox_spawn((player)pl);
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.solid = SOLID_NOT;
|
||||
pl.takedamage = DAMAGE_NO;
|
||||
|
@ -91,8 +91,9 @@ HLMultiplayerRules::PlayerDeath(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerSpawn(player pl)
|
||||
HLMultiplayerRules::PlayerSpawn(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
/* this is where the mods want to deviate */
|
||||
entity spot;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
void
|
||||
HLSingleplayerRules::PlayerDeath(player pl)
|
||||
HLSingleplayerRules::PlayerDeath(base_player pl)
|
||||
{
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.solid = SOLID_NOT;
|
||||
|
@ -34,7 +34,7 @@ HLSingleplayerRules::PlayerDeath(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLSingleplayerRules::PlayerSpawn(player pl)
|
||||
HLSingleplayerRules::PlayerSpawn(base_player pl)
|
||||
{
|
||||
pl.classname = "player";
|
||||
pl.health = pl.max_health = 100;
|
||||
|
|
|
@ -4,23 +4,18 @@
|
|||
#define QWSSQC
|
||||
#define SERVER
|
||||
#define VALVE
|
||||
#define GS_RENDERFX
|
||||
|
||||
#includelist
|
||||
../../shared/fteextensions.qc
|
||||
../../gs-entbase/server/defs.h
|
||||
../../shared/defs.h
|
||||
../../shared/sound.c
|
||||
../../shared/valve/animations.h
|
||||
../defs.h
|
||||
../plugins.c
|
||||
../logging.c
|
||||
../nodes.c
|
||||
../skill.c
|
||||
../sentences.c
|
||||
|
||||
../../gs-entbase/server.src
|
||||
../../gs-entbase/shared.src
|
||||
../../shared/valve/include.src
|
||||
|
||||
../../shared/valve/player.cpp
|
||||
../valve/defs.h
|
||||
|
||||
../valve/monster_apache.cpp
|
||||
|
@ -58,70 +53,34 @@
|
|||
../valve/monster_turret.cpp
|
||||
../valve/monster_zombie.cpp
|
||||
|
||||
../../shared/valve/fx_blood.c
|
||||
../../shared/valve/fx_breakmodel.c
|
||||
../../shared/valve/fx_explosion.c
|
||||
../../shared/valve/fx_gibhuman.c
|
||||
../../shared/valve/fx_impact.c
|
||||
../../shared/valve/fx_spark.c
|
||||
../valve/player.c
|
||||
../valve/spectator.c
|
||||
../valve/items.cpp
|
||||
../valve/item_longjump.cpp
|
||||
../valve/item_suit.cpp
|
||||
../valve/item_healthkit.cpp
|
||||
../valve/item_battery.cpp
|
||||
../valve/item_weaponbox.cpp
|
||||
../valve/world_items.cpp
|
||||
../valve/xen_spore_small.cpp
|
||||
../valve/xen_spore_medium.cpp
|
||||
../valve/xen_spore_large.cpp
|
||||
../valve/xen_hair.cpp
|
||||
../valve/xen_plantlight.cpp
|
||||
../valve/ammo.cpp
|
||||
|
||||
player.c
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
spectator.c
|
||||
../../shared/valve/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/weapons.h
|
||||
../../shared/valve/w_crossbow.c
|
||||
../../shared/valve/w_crowbar.c
|
||||
../../shared/valve/w_egon.c
|
||||
../../shared/valve/w_gauss.c
|
||||
../../shared/valve/w_glock.c
|
||||
../../shared/valve/w_handgrenade.c
|
||||
../../shared/valve/w_hornetgun.c
|
||||
../../shared/valve/w_mp5.c
|
||||
../../shared/valve/w_python.c
|
||||
../../shared/valve/w_rpg.c
|
||||
../../shared/valve/w_satchel.c
|
||||
../../shared/valve/w_shotgun.c
|
||||
../../shared/valve/w_snark.c
|
||||
../../shared/valve/w_tripmine.c
|
||||
items.cpp
|
||||
item_longjump.cpp
|
||||
item_suit.cpp
|
||||
item_healthkit.cpp
|
||||
item_battery.cpp
|
||||
item_weaponbox.cpp
|
||||
world_items.cpp
|
||||
xen_spore_small.cpp
|
||||
xen_spore_medium.cpp
|
||||
xen_spore_large.cpp
|
||||
xen_hair.cpp
|
||||
xen_plantlight.cpp
|
||||
ammo.cpp
|
||||
../../shared/valve/weapons.c
|
||||
../../shared/valve/weapon_common.c
|
||||
../spawn.c
|
||||
../vox.c
|
||||
../../shared/valve/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../valve/gamerules.cpp
|
||||
../valve/gamerules_singleplayer.cpp
|
||||
../valve/gamerules_multiplayer.cpp
|
||||
../valve/client.c
|
||||
../client.c
|
||||
server.c
|
||||
../server.c
|
||||
damage.c
|
||||
../traceattack.c
|
||||
../valve/server.c
|
||||
../valve/damage.c
|
||||
../valve/rules.c
|
||||
../footsteps.c
|
||||
../flashlight.c
|
||||
|
||||
../../botlib/include.src
|
||||
|
||||
input.c
|
||||
spawn.c
|
||||
../vote.c
|
||||
../entry.c
|
||||
../valve/input.c
|
||||
../valve/spawn.c
|
||||
|
||||
../include.src
|
||||
#endlist
|
||||
|
|
|
@ -22,7 +22,8 @@ Assumes time in minutes.
|
|||
TODO: Actually output proper, tokenized strings for not just 1-10 minutes
|
||||
=================
|
||||
*/
|
||||
string Vox_TimeToString(float fTime)
|
||||
string
|
||||
Vox_TimeToString(float fTime)
|
||||
{
|
||||
fTime = rint(fTime);
|
||||
|
||||
|
@ -49,7 +50,8 @@ Vox_Broadcast
|
|||
Broadcasts a VOX message to all players
|
||||
=================
|
||||
*/
|
||||
void Vox_Broadcast(string sMessage)
|
||||
void
|
||||
Vox_Broadcast(string sMessage)
|
||||
{
|
||||
localcmd(sprintf("echo [VOX] Broadcast: %s\n", sMessage));
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
|
@ -66,7 +68,8 @@ Vox_Singlecast
|
|||
Broadcasts a VOX message to one player
|
||||
=================
|
||||
*/
|
||||
void Vox_Singlecast(entity eClient, string sMessage)
|
||||
void
|
||||
Vox_Singlecast(entity eClient, string sMessage)
|
||||
{
|
||||
localcmd(sprintf("echo [VOX] Singlecast to %s: %s\n", eClient.netname, sMessage));
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
|
|
19
src/server/vox.h
Normal file
19
src/server/vox.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
string Vox_TimeToString(float);
|
||||
void Vox_Broadcast(string);
|
||||
void Vox_Singlecast(entity, string);
|
182
src/server/weapons.c
Normal file
182
src/server/weapons.c
Normal file
|
@ -0,0 +1,182 @@
|
|||
#ifdef SERVER
|
||||
void Weapons_PickupNotify(base_player pl, int w)
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_WEAPON_PICKUP);
|
||||
WriteByte(MSG_MULTICAST, w);
|
||||
msg_entity = (entity)pl;
|
||||
multicast([0,0,0], MULTICAST_ONE);
|
||||
}
|
||||
|
||||
void Weapons_RefreshAmmo(base_player pl)
|
||||
{
|
||||
if (g_weapons[pl.activeweapon].updateammo != __NULL__) {
|
||||
g_weapons[pl.activeweapon].updateammo((player)pl);
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_SwitchBest(base_player pl)
|
||||
{
|
||||
entity oldself = self;
|
||||
self = pl;
|
||||
for (int i = 0; i < g_weapons.length; i++) {
|
||||
if (pl.g_items & g_weapons[i].id) {
|
||||
pl.activeweapon = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Weapons_Draw();
|
||||
self = oldself;
|
||||
pl.flags |= FL_SEMI_TOGGLED;
|
||||
}
|
||||
|
||||
/* returns TRUE if weapon pickup gets removed from this world */
|
||||
int Weapons_AddItem(base_player pl, int w, int startammo)
|
||||
{
|
||||
int value;
|
||||
entity oldself = self;
|
||||
self = pl;
|
||||
|
||||
/* let's check if we've got a limit */
|
||||
int maxit;
|
||||
CGameRules rules = (CGameRules)g_grMode;
|
||||
maxit = rules.MaxItemPerSlot(g_weapons[w].slot);
|
||||
if (maxit > 0) {
|
||||
int wantslot = g_weapons[w].slot;
|
||||
int c;
|
||||
for (int i = 0; i < g_weapons.length; i++) {
|
||||
if (pl.g_items & g_weapons[i].id && g_weapons[i].slot == wantslot) {
|
||||
c++;
|
||||
|
||||
/* we're over the slot limit. */
|
||||
if (c >= maxit) {
|
||||
self = oldself;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* in case programmer decided not to add a pickup callback */
|
||||
if (g_weapons[w].pickup == __NULL__) {
|
||||
if (pl.g_items & g_weapons[w].id) {
|
||||
/* already present, skip */
|
||||
value = FALSE;
|
||||
} else {
|
||||
/* new to our arsenal */
|
||||
pl.g_items |= g_weapons[w].id;
|
||||
value = TRUE;
|
||||
|
||||
/* it's new, so autoswitch? */
|
||||
if (pl.activeweapon == 0) {
|
||||
pl.activeweapon = w;
|
||||
Weapons_Draw();
|
||||
} else {
|
||||
Weapons_PickupNotify(pl, w);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* call pickup to handle the ammo */
|
||||
if (pl.g_items & g_weapons[w].id) {
|
||||
value = g_weapons[w].pickup(FALSE, startammo);
|
||||
} else {
|
||||
/* new to our arsenal */
|
||||
pl.g_items |= g_weapons[w].id;
|
||||
value = g_weapons[w].pickup(TRUE, startammo);
|
||||
|
||||
/* it's new, so autoswitch? */
|
||||
if (pl.activeweapon == 0) {
|
||||
pl.activeweapon = w;
|
||||
Weapons_Draw();
|
||||
} else {
|
||||
Weapons_PickupNotify(pl, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Weapons_RefreshAmmo(pl);
|
||||
self = oldself;
|
||||
return value;
|
||||
}
|
||||
|
||||
void Weapons_RemoveItem(base_player pl, int w)
|
||||
{
|
||||
pl.g_items &= ~g_weapons[w].id;
|
||||
Weapons_SwitchBest(pl);
|
||||
}
|
||||
|
||||
void Weapons_InitItem(int w)
|
||||
{
|
||||
item_pickup it = (item_pickup)self;
|
||||
spawnfunc_item_pickup();
|
||||
it.SetItem(w);
|
||||
}
|
||||
|
||||
void Weapons_UpdateAmmo(base_player pl, int a1, int a2, int a3)
|
||||
{
|
||||
/* no change */
|
||||
if (a1 == -1) {
|
||||
a1 = pl.a_ammo1;
|
||||
}
|
||||
if (a2 == -1) {
|
||||
a2 = pl.a_ammo2;
|
||||
}
|
||||
if (a3 == -1) {
|
||||
a3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
/* Networked as bytes, since we don't need more. Clamp to avoid errors */
|
||||
pl.a_ammo1 = bound(0, a1, 255);
|
||||
pl.a_ammo2 = bound(0, a2, 255);
|
||||
pl.a_ammo3 = bound(0, a3, 255);
|
||||
}
|
||||
|
||||
void Weapons_ReloadWeapon(base_player pl, .int mag, .int ammo, int max)
|
||||
{
|
||||
int iNeed = max - pl.(mag);
|
||||
int iHave = pl.(ammo);
|
||||
|
||||
if (iNeed > iHave) {
|
||||
pl.(mag) += iHave;
|
||||
pl.(ammo) = 0;
|
||||
} else {
|
||||
pl.(mag) += iNeed;
|
||||
pl.(ammo) -= iNeed;
|
||||
}
|
||||
}
|
||||
|
||||
void Weapon_DropCurrentWeapon(base_player pl)
|
||||
{
|
||||
|
||||
static void DropWeapon_Enable(void)
|
||||
{
|
||||
self.solid = SOLID_TRIGGER;
|
||||
}
|
||||
|
||||
if (!pl.activeweapon)
|
||||
return;
|
||||
|
||||
if (g_weapons[pl.activeweapon].allow_drop != TRUE)
|
||||
return;
|
||||
|
||||
item_pickup drop = spawn(item_pickup, m_iWasDropped: TRUE, m_iClip: pl.a_ammo1);
|
||||
drop.SetItem(pl.activeweapon);
|
||||
setorigin(drop, pl.origin);
|
||||
drop.solid = SOLID_NOT;
|
||||
drop.think = DropWeapon_Enable;
|
||||
drop.nextthink = time + 1.5f;
|
||||
drop.movetype = MOVETYPE_TOSS;
|
||||
drop.classname = "remove_me";
|
||||
|
||||
makevectors(pl.v_angle);
|
||||
drop.velocity = v_forward * 256;
|
||||
drop.avelocity[1] = 500;
|
||||
Weapons_RemoveItem(pl, pl.activeweapon);
|
||||
}
|
||||
|
||||
void CSEv_DropWeapon(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
Weapon_DropCurrentWeapon(pl);
|
||||
}
|
||||
#endif
|
10
src/server/weapons.h
Normal file
10
src/server/weapons.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
float Weapons_GetAim(int);
|
||||
void Weapons_PickupNotify(base_player pl, int w);
|
||||
void Weapons_RefreshAmmo(base_player pl);
|
||||
void Weapons_SwitchBest(base_player pl);
|
||||
int Weapons_AddItem(base_player pl, int w, int startammo);
|
||||
void Weapons_RemoveItem(base_player pl, int w);
|
||||
void Weapons_InitItem(int w);
|
||||
void Weapons_UpdateAmmo(base_player pl, int a1, int a2, int a3);
|
||||
void Weapons_ReloadWeapon(base_player pl, .int mag, .int ammo, int max);
|
||||
void Weapon_DropCurrentWeapon(base_player pl);
|
|
@ -49,7 +49,7 @@ void Animation_PlayerUpdate(void) {
|
|||
self.basebone = cvar("spinebone"); // gettagindex(self, "Bip01 Spine");
|
||||
#ifdef SERVER
|
||||
if (self.baseframe_time < time) {
|
||||
player pl = (player)self;
|
||||
base_player pl = (base_player)self;
|
||||
self.baseframe = Weapons_GetAim(pl.activeweapon);
|
||||
self.baseframe_old = self.frame;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#includelist
|
||||
../../shared/cstrike/defs.h
|
||||
../../shared/sound.c
|
||||
../../shared/cstrike/animations.h
|
||||
../../shared/cstrike/animations.c
|
||||
../../shared/cstrike/player.h
|
||||
../../shared/cstrike/pmove.c
|
||||
../../shared/pmove.c
|
||||
|
||||
../../shared/valve/fx_blood.c
|
||||
../../shared/valve/fx_breakmodel.c
|
||||
|
@ -15,7 +14,6 @@
|
|||
../../shared/cstrike/fx_flashbang.c
|
||||
../../shared/cstrike/fx_smokenade.c
|
||||
|
||||
../../shared/cstrike/radio.c
|
||||
../../shared/cstrike/weapons_cstrike.c
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/cstrike/w_ak47.c
|
||||
|
@ -47,4 +45,6 @@
|
|||
../../shared/cstrike/w_smokegrenade.c
|
||||
../../shared/cstrike/weapons.c
|
||||
../../shared/valve/weapon_common.c
|
||||
../../shared/cstrike/pmove.c
|
||||
../../shared/pmove.c
|
||||
#endlist
|
||||
|
|
|
@ -15,35 +15,8 @@
|
|||
*/
|
||||
|
||||
noref int input_sequence;
|
||||
class player:CBaseEntity
|
||||
class player:base_player
|
||||
{
|
||||
float health;
|
||||
float armor;
|
||||
|
||||
/* When the weapon is done firing */
|
||||
float w_attack_next;
|
||||
/* When to play the next idle animation */
|
||||
float w_idle_next;
|
||||
|
||||
/* Magazine/Clip */
|
||||
int a_ammo1;
|
||||
/* Rest in the inventory */
|
||||
int a_ammo2;
|
||||
/* Special ammo */
|
||||
int a_ammo3;
|
||||
|
||||
/* We can't use the default .items field, because FTE will assume
|
||||
* effects of some bits. Such as invisibility, quad, etc. */
|
||||
int g_items;
|
||||
|
||||
float activeweapon;
|
||||
float viewzoom;
|
||||
vector view_ofs;
|
||||
float weapontime;
|
||||
|
||||
/* any mods that use hooks */
|
||||
entity hook;
|
||||
|
||||
int cs_shotmultiplier;
|
||||
float cs_shottime;
|
||||
int ingame;
|
||||
|
@ -62,24 +35,9 @@ class player:CBaseEntity
|
|||
int cs_old_shotmultiplier;
|
||||
float cs_crosshairdistance;
|
||||
|
||||
/* Prediction */
|
||||
vector net_origin;
|
||||
vector net_velocity;
|
||||
float net_flags;
|
||||
float net_w_attack_next;
|
||||
float net_w_idle_next;
|
||||
float net_jumptime;
|
||||
float net_teleport_time;
|
||||
float net_weapontime;
|
||||
float net_viewzoom;
|
||||
vector net_punchangle;
|
||||
int net_ammo1;
|
||||
int net_ammo2;
|
||||
int net_ammo3;
|
||||
int net_cs_shotmultiplier;
|
||||
float net_cs_shottime;
|
||||
int sequence;
|
||||
|
||||
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
|
@ -129,26 +87,6 @@ class player:CBaseEntity
|
|||
int mode_m4a1;
|
||||
int mode_glock18;
|
||||
|
||||
/* conditional networking */
|
||||
int old_modelindex;
|
||||
vector old_origin;
|
||||
vector old_angles;
|
||||
vector old_velocity;
|
||||
int old_flags;
|
||||
int old_activeweapon;
|
||||
int old_items;
|
||||
int old_health;
|
||||
int old_armor;
|
||||
int old_movetype;
|
||||
int old_viewofs;
|
||||
int old_baseframe;
|
||||
int old_frame;
|
||||
int old_a_ammo1;
|
||||
int old_a_ammo2;
|
||||
int old_a_ammo3;
|
||||
|
||||
int voted;
|
||||
|
||||
int old_cs_shotmultiplier;
|
||||
float old_cs_shottime;
|
||||
#endif
|
||||
|
|
|
@ -28,94 +28,6 @@ func_bombtarget brush entities.
|
|||
|
||||
*/
|
||||
|
||||
/* C4 entity logic */
|
||||
#ifdef SERVER
|
||||
class c4bomb:CBaseEntity
|
||||
{
|
||||
entity m_eUser;
|
||||
float m_flBeepTime;
|
||||
float m_flExplodeTime;
|
||||
float m_flDefusalState;
|
||||
|
||||
void(void) c4bomb;
|
||||
virtual void(void) PlayerUse;
|
||||
virtual void(void) Logic;
|
||||
};
|
||||
|
||||
void
|
||||
c4bomb::PlayerUse(void)
|
||||
{
|
||||
m_eUser = eActivator;
|
||||
m_flDefusalState += frametime;
|
||||
}
|
||||
|
||||
void
|
||||
c4bomb::Logic(void)
|
||||
{
|
||||
// If the guy who started using us stopped using us, reset the defuser counter
|
||||
if (m_eUser != world) {
|
||||
m_eUser= world;
|
||||
m_flDefusalState = 0.0f;
|
||||
}
|
||||
|
||||
// If our time has passed, explode
|
||||
if (m_flExplodeTime < time) {
|
||||
CSMultiplayerRules rules = (CSMultiplayerRules)g_grMode;
|
||||
|
||||
/* In Bomb Defusal, all Terrorists receive $3500
|
||||
* if they won by detonating the bomb. */
|
||||
rules.RoundOver(TEAM_T, 3500, FALSE);
|
||||
Damage_Radius(origin, this.owner, 500, g_cstrike_bombradius, TRUE, WEAPON_C4BOMB);
|
||||
sound(this, CHAN_VOICE, "weapons/c4_explode1.wav", 1.0, ATTN_NONE);
|
||||
|
||||
for (entity e = world; (e = find(e, ::classname, "func_bomb_target"));) {
|
||||
CBaseTrigger trigger = (CBaseTrigger)e;
|
||||
if (trigger.Trigger != __NULL__) {
|
||||
trigger.Trigger();
|
||||
}
|
||||
}
|
||||
|
||||
m_flBeepTime = 0.0f;
|
||||
m_flDefusalState = 0;
|
||||
remove(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_flBeepTime > time) {
|
||||
return;
|
||||
}
|
||||
m_flBeepTime = time + 1.5;
|
||||
|
||||
if (m_flExplodeTime - time < 2) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep5.wav", 1.0, ATTN_NONE);
|
||||
} else if (m_flExplodeTime - time < 5) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep5.wav", 1.0, ATTN_NORM);
|
||||
} else if (m_flExplodeTime - time < 10) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep4.wav", 1.0, ATTN_NORM);
|
||||
} else if (m_flExplodeTime - time < 20) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep3.wav", 1.0, ATTN_NORM);
|
||||
} else if (m_flExplodeTime - time < 30) {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep2.wav", 1.0, ATTN_NORM);
|
||||
} else {
|
||||
sound(this, CHAN_VOICE, "weapons/c4_beep1.wav", 1.0, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
c4bomb::c4bomb(void)
|
||||
{
|
||||
SetMovetype(MOVETYPE_NONE);
|
||||
SetSolid(SOLID_BBOX);
|
||||
SetModel("models/w_c4.mdl");
|
||||
SetSize([-6,-6,0], [6,6,6]);
|
||||
|
||||
customphysics = Logic;
|
||||
m_flExplodeTime = time + 45.0f;
|
||||
|
||||
sound(this, CHAN_WEAPON, "weapons/c4_plant.wav", 1.0f, ATTN_IDLE);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* C4 weapon logic */
|
||||
|
||||
enum
|
||||
|
@ -200,15 +112,7 @@ w_c4bomb_release(void)
|
|||
if (pl.w_idle_next <= 0.0f) {
|
||||
pl.a_ammo1 = C4S_DONE;
|
||||
#ifdef SERVER
|
||||
c4bomb bomb = spawn(c4bomb);
|
||||
bomb.owner = pl;
|
||||
|
||||
/* place directly below */
|
||||
traceline(pl.origin, pl.origin + [0,0,-64], FALSE, pl);
|
||||
setorigin(bomb, trace_endpos);
|
||||
|
||||
Radio_BroadcastMessage(RADIO_BOMBPL);
|
||||
g_cs_bombplanted = TRUE;
|
||||
C4Bomb_Plant(pl);
|
||||
Weapons_RemoveItem(pl, WEAPON_C4BOMB);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "player.h"
|
||||
#include "damage.h"
|
||||
#include "flags.h"
|
||||
#include "hitmesh.h"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#includelist
|
||||
../../shared/sound.c
|
||||
../../shared/gearbox/player.cpp
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/animations.h
|
||||
../../shared/valve/animations.c
|
||||
../../shared/valve/player.cpp
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
|
||||
|
@ -14,7 +15,6 @@
|
|||
../../shared/valve/fx_impact.c
|
||||
|
||||
../../shared/gearbox/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/gearbox/weapons.h
|
||||
../../shared/valve/w_crossbow.c
|
||||
../../shared/valve/w_crowbar.c
|
||||
|
|
|
@ -15,50 +15,9 @@
|
|||
*/
|
||||
|
||||
int input_sequence;
|
||||
class player:CBaseEntity
|
||||
|
||||
class player:base_player
|
||||
{
|
||||
float health;
|
||||
float armor;
|
||||
|
||||
/* When the weapon is done firing */
|
||||
float w_attack_next;
|
||||
/* When to play the next idle animation */
|
||||
float w_idle_next;
|
||||
|
||||
/* Magazine/Clip */
|
||||
int a_ammo1;
|
||||
/* Rest in the inventory */
|
||||
int a_ammo2;
|
||||
/* Special ammo */
|
||||
int a_ammo3;
|
||||
|
||||
/* We can't use the default .items field, because FTE will assume
|
||||
* effects of some bits. Such as invisibility, quad, etc.
|
||||
* also, modders probably want 32 bits for items. */
|
||||
int g_items;
|
||||
|
||||
float activeweapon;
|
||||
float viewzoom;
|
||||
vector punchangle;
|
||||
vector view_ofs;
|
||||
float weapontime;
|
||||
|
||||
/* any mods that use hooks */
|
||||
entity hook;
|
||||
|
||||
/* Weapon specific */
|
||||
int glock_mag;
|
||||
int mp5_mag;
|
||||
int python_mag;
|
||||
int shotgun_mag;
|
||||
int crossbow_mag;
|
||||
int rpg_mag;
|
||||
int satchel_chg;
|
||||
int eagle_mag;
|
||||
int sniper_mag;
|
||||
int m249_mag;
|
||||
int sporelauncher_mag;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
|
@ -67,28 +26,19 @@ class player:CBaseEntity
|
|||
float pitch;
|
||||
float lastweapon;
|
||||
|
||||
/* Prediction */
|
||||
vector net_origin;
|
||||
vector net_velocity;
|
||||
float net_flags;
|
||||
float net_w_attack_next;
|
||||
float net_w_idle_next;
|
||||
float net_jumptime;
|
||||
float net_teleport_time;
|
||||
float net_weapontime;
|
||||
float net_viewzoom;
|
||||
vector net_punchangle;
|
||||
vector net_hookpos;
|
||||
int net_ammo1;
|
||||
int net_ammo2;
|
||||
int net_ammo3;
|
||||
int sequence;
|
||||
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
#else
|
||||
/* valve specific */
|
||||
int glock_mag;
|
||||
int mp5_mag;
|
||||
int python_mag;
|
||||
int shotgun_mag;
|
||||
int crossbow_mag;
|
||||
int rpg_mag;
|
||||
int satchel_chg;
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
int ammo_buckshot;
|
||||
|
@ -101,31 +51,16 @@ class player:CBaseEntity
|
|||
int ammo_tripmine;
|
||||
int ammo_snark;
|
||||
int ammo_hornet;
|
||||
|
||||
/* gearbox */
|
||||
int eagle_mag;
|
||||
int sniper_mag;
|
||||
int m249_mag;
|
||||
int sporelauncher_mag;
|
||||
int ammo_556;
|
||||
int ammo_762;
|
||||
int ammo_spore;
|
||||
int ammo_shock;
|
||||
int ammo_penguin;
|
||||
|
||||
/* conditional networking */
|
||||
int old_modelindex;
|
||||
vector old_origin;
|
||||
vector old_angles;
|
||||
vector old_velocity;
|
||||
int old_flags;
|
||||
int old_activeweapon;
|
||||
int old_items;
|
||||
int old_health;
|
||||
int old_armor;
|
||||
int old_movetype;
|
||||
float old_viewofs;
|
||||
int old_baseframe;
|
||||
int old_frame;
|
||||
int old_a_ammo1;
|
||||
int old_a_ammo2;
|
||||
int old_a_ammo3;
|
||||
|
||||
int voted;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#includelist
|
||||
../../shared/sound.c
|
||||
../../shared/hunger/player.cpp
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/animations.h
|
||||
../../shared/valve/animations.c
|
||||
../../shared/valve/player.cpp
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
|
||||
|
@ -14,7 +15,6 @@
|
|||
../../shared/valve/fx_impact.c
|
||||
|
||||
../../shared/hunger/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/hunger/weapons.h
|
||||
../../shared/valve/w_crossbow.c
|
||||
../../shared/valve/w_crowbar.c
|
||||
|
|
|
@ -15,38 +15,20 @@
|
|||
*/
|
||||
|
||||
int input_sequence;
|
||||
class player:CBaseEntity
|
||||
|
||||
class player:base_player
|
||||
{
|
||||
float health;
|
||||
float armor;
|
||||
|
||||
/* When the weapon is done firing */
|
||||
float w_attack_next;
|
||||
/* When to play the next idle animation */
|
||||
float w_idle_next;
|
||||
|
||||
/* Magazine/Clip */
|
||||
int a_ammo1;
|
||||
/* Rest in the inventory */
|
||||
int a_ammo2;
|
||||
/* Special ammo */
|
||||
int a_ammo3;
|
||||
|
||||
/* We can't use the default .items field, because FTE will assume
|
||||
* effects of some bits. Such as invisibility, quad, etc.
|
||||
* also, modders probably want 32 bits for items. */
|
||||
int g_items;
|
||||
|
||||
float activeweapon;
|
||||
float viewzoom;
|
||||
vector punchangle;
|
||||
vector view_ofs;
|
||||
float weapontime;
|
||||
|
||||
/* any mods that use hooks */
|
||||
entity hook;
|
||||
|
||||
/* Weapon specific */
|
||||
#ifdef CLIENT
|
||||
entity p_model;
|
||||
int p_hand_bone;
|
||||
int p_model_bone;
|
||||
float pitch;
|
||||
float lastweapon;
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
#else
|
||||
int glock_mag;
|
||||
int ap9_mag;
|
||||
int taurus_mag;
|
||||
|
@ -58,36 +40,7 @@ class player:CBaseEntity
|
|||
int rpg_mag;
|
||||
int chaingun_mag;
|
||||
int satchel_chg;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
int p_hand_bone;
|
||||
int p_model_bone;
|
||||
float pitch;
|
||||
float lastweapon;
|
||||
|
||||
/* Prediction */
|
||||
vector net_origin;
|
||||
vector net_velocity;
|
||||
float net_flags;
|
||||
float net_w_attack_next;
|
||||
float net_w_idle_next;
|
||||
float net_jumptime;
|
||||
float net_teleport_time;
|
||||
float net_weapontime;
|
||||
float net_viewzoom;
|
||||
vector net_punchangle;
|
||||
int net_ammo1;
|
||||
int net_ammo2;
|
||||
int net_ammo3;
|
||||
int sequence;
|
||||
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
#else
|
||||
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
int ammo_ap9;
|
||||
|
@ -105,25 +58,6 @@ class player:CBaseEntity
|
|||
int ammo_snark;
|
||||
int ammo_hornet;
|
||||
int ammo_medkit;
|
||||
|
||||
/* conditional networking */
|
||||
int old_modelindex;
|
||||
vector old_origin;
|
||||
vector old_angles;
|
||||
vector old_velocity;
|
||||
int old_flags;
|
||||
int old_activeweapon;
|
||||
int old_items;
|
||||
int old_health;
|
||||
int old_armor;
|
||||
int old_movetype;
|
||||
float old_viewofs;
|
||||
int old_baseframe;
|
||||
int old_frame;
|
||||
int old_a_ammo1;
|
||||
int old_a_ammo2;
|
||||
int old_a_ammo3;
|
||||
int voted;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
74
src/shared/player.h
Normal file
74
src/shared/player.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
#ifdef SERVER
|
||||
class base_player:CBaseEntity
|
||||
#else
|
||||
class base_player
|
||||
#endif
|
||||
{
|
||||
float health;
|
||||
float armor;
|
||||
|
||||
/* When the weapon is done firing */
|
||||
float w_attack_next;
|
||||
/* When to play the next idle animation */
|
||||
float w_idle_next;
|
||||
|
||||
/* Magazine/Clip */
|
||||
int a_ammo1;
|
||||
/* Rest in the inventory */
|
||||
int a_ammo2;
|
||||
/* Special ammo */
|
||||
int a_ammo3;
|
||||
|
||||
/* We can't use the default .items field, because FTE will assume
|
||||
* effects of some bits. Such as invisibility, quad, etc.
|
||||
* also, modders probably want 32 bits for items. */
|
||||
int g_items;
|
||||
|
||||
float activeweapon;
|
||||
float viewzoom;
|
||||
vector punchangle;
|
||||
vector view_ofs;
|
||||
float weapontime;
|
||||
|
||||
/* any mods that use hooks */
|
||||
entity hook;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* Prediction */
|
||||
vector net_origin;
|
||||
vector net_velocity;
|
||||
float net_flags;
|
||||
float net_w_attack_next;
|
||||
float net_w_idle_next;
|
||||
float net_jumptime;
|
||||
float net_teleport_time;
|
||||
float net_weapontime;
|
||||
float net_viewzoom;
|
||||
vector net_punchangle;
|
||||
int net_ammo1;
|
||||
int net_ammo2;
|
||||
int net_ammo3;
|
||||
int sequence;
|
||||
#else
|
||||
|
||||
/* conditional networking */
|
||||
int old_modelindex;
|
||||
vector old_origin;
|
||||
vector old_angles;
|
||||
vector old_velocity;
|
||||
int old_flags;
|
||||
int old_activeweapon;
|
||||
int old_items;
|
||||
int old_health;
|
||||
int old_armor;
|
||||
int old_movetype;
|
||||
float old_viewofs;
|
||||
int old_baseframe;
|
||||
int old_frame;
|
||||
int old_a_ammo1;
|
||||
int old_a_ammo2;
|
||||
int old_a_ammo3;
|
||||
|
||||
int voted;
|
||||
#endif
|
||||
};
|
|
@ -1,8 +1,9 @@
|
|||
#includelist
|
||||
../../shared/sound.c
|
||||
../../shared/poke646/player.cpp
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/animations.h
|
||||
../../shared/valve/animations.c
|
||||
../../shared/valve/player.cpp
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
|
||||
|
@ -14,9 +15,8 @@
|
|||
../../shared/valve/fx_impact.c
|
||||
|
||||
../../shared/poke646/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/w_satchel.c
|
||||
../../shared/poke646/weapons.h
|
||||
../../shared/valve/w_satchel.c
|
||||
../../shared/poke646/w_bradnailer.c
|
||||
../../shared/poke646/w_cmlwbr.c
|
||||
../../shared/poke646/w_heaterpipe.c
|
||||
|
|
|
@ -15,44 +15,11 @@
|
|||
*/
|
||||
|
||||
int input_sequence;
|
||||
class player:CBaseEntity
|
||||
|
||||
class player:base_player
|
||||
{
|
||||
float health;
|
||||
float armor;
|
||||
|
||||
/* When the weapon is done firing */
|
||||
float w_attack_next;
|
||||
/* When to play the next idle animation */
|
||||
float w_idle_next;
|
||||
|
||||
/* Magazine/Clip */
|
||||
int a_ammo1;
|
||||
/* Rest in the inventory */
|
||||
int a_ammo2;
|
||||
/* Special ammo */
|
||||
int a_ammo3;
|
||||
|
||||
/* We can't use the default .items field, because FTE will assume
|
||||
* effects of some bits. Such as invisibility, quad, etc.
|
||||
* also, modders probably want 32 bits for items. */
|
||||
int g_items;
|
||||
|
||||
float activeweapon;
|
||||
float viewzoom;
|
||||
vector punchangle;
|
||||
vector view_ofs;
|
||||
float weapontime;
|
||||
|
||||
/* any mods that use hooks */
|
||||
entity hook;
|
||||
|
||||
/* Weapon specific */
|
||||
int bradnailer_mag;
|
||||
int nailgun_mag;
|
||||
int shotgun_mag;
|
||||
int cmlwbr_mag;
|
||||
int xs_mag;
|
||||
int satchel_chg;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
|
@ -62,22 +29,6 @@ class player:CBaseEntity
|
|||
float pitch;
|
||||
float lastweapon;
|
||||
|
||||
/* Prediction */
|
||||
vector net_origin;
|
||||
vector net_velocity;
|
||||
float net_flags;
|
||||
float net_w_attack_next;
|
||||
float net_w_idle_next;
|
||||
float net_jumptime;
|
||||
float net_teleport_time;
|
||||
float net_weapontime;
|
||||
float net_viewzoom;
|
||||
vector net_punchangle;
|
||||
int net_ammo1;
|
||||
int net_ammo2;
|
||||
int net_ammo3;
|
||||
int sequence;
|
||||
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
|
@ -89,24 +40,12 @@ class player:CBaseEntity
|
|||
int ammo_xencandy;
|
||||
int ammo_satchel;
|
||||
|
||||
/* conditional networking */
|
||||
int old_modelindex;
|
||||
vector old_origin;
|
||||
vector old_angles;
|
||||
vector old_velocity;
|
||||
int old_flags;
|
||||
int old_activeweapon;
|
||||
int old_items;
|
||||
int old_health;
|
||||
int old_armor;
|
||||
int old_movetype;
|
||||
float old_viewofs;
|
||||
int old_baseframe;
|
||||
int old_frame;
|
||||
int old_a_ammo1;
|
||||
int old_a_ammo2;
|
||||
int old_a_ammo3;
|
||||
int voted;
|
||||
int bradnailer_mag;
|
||||
int nailgun_mag;
|
||||
int shotgun_mag;
|
||||
int cmlwbr_mag;
|
||||
int xs_mag;
|
||||
int satchel_chg;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#includelist
|
||||
../../shared/sound.c
|
||||
../../shared/rewolf/player.cpp
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/animations.h
|
||||
../../shared/valve/animations.c
|
||||
../../shared/rewolf/player.cpp
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
|
||||
|
@ -14,7 +15,6 @@
|
|||
../../shared/valve/fx_impact.c
|
||||
|
||||
../../shared/rewolf/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/rewolf/weapons.h
|
||||
../../shared/rewolf/w_fists.c
|
||||
../../shared/rewolf/w_gausspistol.c
|
||||
|
|
|
@ -15,37 +15,9 @@
|
|||
*/
|
||||
|
||||
int input_sequence;
|
||||
class player:CBaseEntity
|
||||
|
||||
class player:base_player
|
||||
{
|
||||
float health;
|
||||
float armor;
|
||||
|
||||
/* When the weapon is done firing */
|
||||
float w_attack_next;
|
||||
/* When to play the next idle animation */
|
||||
float w_idle_next;
|
||||
|
||||
/* Magazine/Clip */
|
||||
int a_ammo1;
|
||||
/* Rest in the inventory */
|
||||
int a_ammo2;
|
||||
/* Special ammo */
|
||||
int a_ammo3;
|
||||
|
||||
/* We can't use the default .items field, because FTE will assume
|
||||
* effects of some bits. Such as invisibility, quad, etc.
|
||||
* also, modders probably want 32 bits for items. */
|
||||
int g_items;
|
||||
|
||||
float activeweapon;
|
||||
float viewzoom;
|
||||
vector punchangle;
|
||||
vector view_ofs;
|
||||
float weapontime;
|
||||
|
||||
/* any mods that use hooks */
|
||||
entity hook;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
|
@ -54,22 +26,6 @@ class player:CBaseEntity
|
|||
float pitch;
|
||||
float lastweapon;
|
||||
|
||||
/* Prediction */
|
||||
vector net_origin;
|
||||
vector net_velocity;
|
||||
float net_flags;
|
||||
float net_w_attack_next;
|
||||
float net_w_idle_next;
|
||||
float net_jumptime;
|
||||
float net_teleport_time;
|
||||
float net_weapontime;
|
||||
float net_viewzoom;
|
||||
vector net_punchangle;
|
||||
int net_ammo1;
|
||||
int net_ammo2;
|
||||
int net_ammo3;
|
||||
int sequence;
|
||||
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
|
@ -103,26 +59,6 @@ class player:CBaseEntity
|
|||
|
||||
int gren_detonate; /* when tripped (tripmine), timed, on impact */
|
||||
int gren_payload; /* cluster, explosive */
|
||||
|
||||
/* conditional networking */
|
||||
int old_modelindex;
|
||||
vector old_origin;
|
||||
vector old_angles;
|
||||
vector old_velocity;
|
||||
int old_flags;
|
||||
int old_activeweapon;
|
||||
int old_items;
|
||||
int old_health;
|
||||
int old_armor;
|
||||
int old_movetype;
|
||||
float old_viewofs;
|
||||
int old_baseframe;
|
||||
int old_frame;
|
||||
int old_a_ammo1;
|
||||
int old_a_ammo2;
|
||||
int old_a_ammo3;
|
||||
|
||||
int voted;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#includelist
|
||||
../../shared/sound.c
|
||||
../../shared/scihunt/player.cpp
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/animations.h
|
||||
../../shared/valve/animations.c
|
||||
../../shared/valve/player.cpp
|
||||
../../shared/scihunt/pmove.c
|
||||
../../shared/pmove.c
|
||||
|
||||
|
@ -14,7 +15,6 @@
|
|||
../../shared/valve/fx_impact.c
|
||||
|
||||
../../shared/scihunt/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/scihunt/weapons.h
|
||||
../../shared/valve/w_crossbow.c
|
||||
../../shared/valve/w_crowbar.c
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
*/
|
||||
|
||||
int input_sequence;
|
||||
class player:CBaseEntity
|
||||
|
||||
class player:base_player
|
||||
{
|
||||
float health;
|
||||
float armor;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#includelist
|
||||
../../shared/sound.c
|
||||
../../shared/valve/player.cpp
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/animations.h
|
||||
../../shared/valve/animations.c
|
||||
../../shared/valve/player.cpp
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
|
||||
|
@ -14,7 +15,6 @@
|
|||
../../shared/valve/fx_impact.c
|
||||
|
||||
../../shared/tfc/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/tfc/weapons.h
|
||||
../../shared/tfc/w_asscan.c
|
||||
../../shared/tfc/w_autorifle.c
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#includelist
|
||||
../../shared/sound.c
|
||||
../../shared/valve/player.cpp
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/animations.h
|
||||
../../shared/valve/animations.c
|
||||
../../shared/valve/player.cpp
|
||||
../../shared/valve/pmove.c
|
||||
../../shared/pmove.c
|
||||
|
||||
|
@ -14,7 +15,6 @@
|
|||
../../shared/valve/fx_impact.c
|
||||
|
||||
../../shared/valve/items.h
|
||||
../../shared/valve/weapon_common.h
|
||||
../../shared/valve/weapons.h
|
||||
../../shared/valve/w_crossbow.c
|
||||
../../shared/valve/w_crowbar.c
|
||||
|
|
|
@ -15,37 +15,21 @@
|
|||
*/
|
||||
|
||||
noref int input_sequence;
|
||||
class player:CBaseEntity
|
||||
class player:base_player
|
||||
{
|
||||
float health;
|
||||
float armor;
|
||||
|
||||
/* When the weapon is done firing */
|
||||
float w_attack_next;
|
||||
/* When to play the next idle animation */
|
||||
float w_idle_next;
|
||||
|
||||
/* Magazine/Clip */
|
||||
int a_ammo1;
|
||||
/* Rest in the inventory */
|
||||
int a_ammo2;
|
||||
/* Special ammo */
|
||||
int a_ammo3;
|
||||
|
||||
/* We can't use the default .items field, because FTE will assume
|
||||
* effects of some bits. Such as invisibility, quad, etc.
|
||||
* also, modders probably want 32 bits for items. */
|
||||
int g_items;
|
||||
|
||||
float activeweapon;
|
||||
float viewzoom;
|
||||
vector punchangle;
|
||||
vector view_ofs;
|
||||
float weapontime;
|
||||
|
||||
/* any mods that use hooks */
|
||||
entity hook;
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
int p_hand_bone;
|
||||
int p_model_bone;
|
||||
float pitch;
|
||||
float lastweapon;
|
||||
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
#else
|
||||
/* Weapon specific */
|
||||
int glock_mag;
|
||||
int mp5_mag;
|
||||
|
@ -55,35 +39,6 @@ class player:CBaseEntity
|
|||
int rpg_mag;
|
||||
int satchel_chg;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
int p_hand_bone;
|
||||
int p_model_bone;
|
||||
float pitch;
|
||||
float lastweapon;
|
||||
|
||||
/* Prediction */
|
||||
vector net_origin;
|
||||
vector net_velocity;
|
||||
float net_flags;
|
||||
float net_w_attack_next;
|
||||
float net_w_idle_next;
|
||||
float net_jumptime;
|
||||
float net_teleport_time;
|
||||
float net_weapontime;
|
||||
float net_viewzoom;
|
||||
vector net_punchangle;
|
||||
int net_ammo1;
|
||||
int net_ammo2;
|
||||
int net_ammo3;
|
||||
int sequence;
|
||||
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
#else
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
int ammo_buckshot;
|
||||
|
@ -96,26 +51,6 @@ class player:CBaseEntity
|
|||
int ammo_tripmine;
|
||||
int ammo_snark;
|
||||
int ammo_hornet;
|
||||
|
||||
/* conditional networking */
|
||||
int old_modelindex;
|
||||
vector old_origin;
|
||||
vector old_angles;
|
||||
vector old_velocity;
|
||||
int old_flags;
|
||||
int old_activeweapon;
|
||||
int old_items;
|
||||
int old_health;
|
||||
int old_armor;
|
||||
int old_movetype;
|
||||
float old_viewofs;
|
||||
int old_baseframe;
|
||||
int old_frame;
|
||||
int old_a_ammo1;
|
||||
int old_a_ammo2;
|
||||
int old_a_ammo3;
|
||||
|
||||
int voted;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ void w_snark_deploy(void)
|
|||
|
||||
void w_snark_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ vector Weapons_GetCameraPos(void)
|
|||
#ifdef SERVER
|
||||
return self.origin + self.view_ofs;
|
||||
#else
|
||||
return pSeat->m_vecPredictedOrigin + self.view_ofs;
|
||||
return getproperty(VF_ORIGIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -270,186 +270,3 @@ int Weapons_IsPresent(player pl, int w)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void Weapons_PickupNotify(player pl, int w)
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_WEAPON_PICKUP);
|
||||
WriteByte(MSG_MULTICAST, w);
|
||||
msg_entity = (entity)pl;
|
||||
multicast([0,0,0], MULTICAST_ONE);
|
||||
}
|
||||
|
||||
void Weapons_RefreshAmmo(player pl)
|
||||
{
|
||||
if (g_weapons[pl.activeweapon].updateammo != __NULL__) {
|
||||
g_weapons[pl.activeweapon].updateammo(pl);
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_SwitchBest(player pl)
|
||||
{
|
||||
entity oldself = self;
|
||||
self = pl;
|
||||
for (int i = 0; i < g_weapons.length; i++) {
|
||||
if (pl.g_items & g_weapons[i].id) {
|
||||
pl.activeweapon = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Weapons_Draw();
|
||||
self = oldself;
|
||||
pl.flags |= FL_SEMI_TOGGLED;
|
||||
}
|
||||
|
||||
/* returns TRUE if weapon pickup gets removed from this world */
|
||||
int Weapons_AddItem(player pl, int w, int startammo)
|
||||
{
|
||||
int value;
|
||||
entity oldself = self;
|
||||
self = pl;
|
||||
|
||||
/* let's check if we've got a limit */
|
||||
int maxit;
|
||||
CGameRules rules = (CGameRules)g_grMode;
|
||||
maxit = rules.MaxItemPerSlot(g_weapons[w].slot);
|
||||
if (maxit > 0) {
|
||||
int wantslot = g_weapons[w].slot;
|
||||
int c;
|
||||
for (int i = 0; i < g_weapons.length; i++) {
|
||||
if (pl.g_items & g_weapons[i].id && g_weapons[i].slot == wantslot) {
|
||||
c++;
|
||||
|
||||
/* we're over the slot limit. */
|
||||
if (c >= maxit) {
|
||||
self = oldself;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* in case programmer decided not to add a pickup callback */
|
||||
if (g_weapons[w].pickup == __NULL__) {
|
||||
if (pl.g_items & g_weapons[w].id) {
|
||||
/* already present, skip */
|
||||
value = FALSE;
|
||||
} else {
|
||||
/* new to our arsenal */
|
||||
pl.g_items |= g_weapons[w].id;
|
||||
value = TRUE;
|
||||
|
||||
/* it's new, so autoswitch? */
|
||||
if (pl.activeweapon == 0) {
|
||||
pl.activeweapon = w;
|
||||
Weapons_Draw();
|
||||
} else {
|
||||
Weapons_PickupNotify(pl, w);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* call pickup to handle the ammo */
|
||||
if (pl.g_items & g_weapons[w].id) {
|
||||
value = g_weapons[w].pickup(FALSE, startammo);
|
||||
} else {
|
||||
/* new to our arsenal */
|
||||
pl.g_items |= g_weapons[w].id;
|
||||
value = g_weapons[w].pickup(TRUE, startammo);
|
||||
|
||||
/* it's new, so autoswitch? */
|
||||
if (pl.activeweapon == 0) {
|
||||
pl.activeweapon = w;
|
||||
Weapons_Draw();
|
||||
} else {
|
||||
Weapons_PickupNotify(pl, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Weapons_RefreshAmmo(pl);
|
||||
self = oldself;
|
||||
return value;
|
||||
}
|
||||
|
||||
void Weapons_RemoveItem(player pl, int w)
|
||||
{
|
||||
pl.g_items &= ~g_weapons[w].id;
|
||||
Weapons_SwitchBest(pl);
|
||||
}
|
||||
|
||||
void Weapons_InitItem(int w)
|
||||
{
|
||||
item_pickup it = (item_pickup)self;
|
||||
spawnfunc_item_pickup();
|
||||
it.SetItem(w);
|
||||
}
|
||||
|
||||
void Weapons_UpdateAmmo(player pl, int a1, int a2, int a3)
|
||||
{
|
||||
/* no change */
|
||||
if (a1 == -1) {
|
||||
a1 = pl.a_ammo1;
|
||||
}
|
||||
if (a2 == -1) {
|
||||
a2 = pl.a_ammo2;
|
||||
}
|
||||
if (a3 == -1) {
|
||||
a3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
/* Networked as bytes, since we don't need more. Clamp to avoid errors */
|
||||
pl.a_ammo1 = bound(0, a1, 255);
|
||||
pl.a_ammo2 = bound(0, a2, 255);
|
||||
pl.a_ammo3 = bound(0, a3, 255);
|
||||
}
|
||||
|
||||
void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max)
|
||||
{
|
||||
int iNeed = max - pl.(mag);
|
||||
int iHave = pl.(ammo);
|
||||
|
||||
if (iNeed > iHave) {
|
||||
pl.(mag) += iHave;
|
||||
pl.(ammo) = 0;
|
||||
} else {
|
||||
pl.(mag) += iNeed;
|
||||
pl.(ammo) -= iNeed;
|
||||
}
|
||||
}
|
||||
|
||||
void Weapon_DropCurrentWeapon(player pl)
|
||||
{
|
||||
|
||||
static void DropWeapon_Enable(void)
|
||||
{
|
||||
self.solid = SOLID_TRIGGER;
|
||||
}
|
||||
|
||||
if (!pl.activeweapon)
|
||||
return;
|
||||
|
||||
if (g_weapons[pl.activeweapon].allow_drop != TRUE)
|
||||
return;
|
||||
|
||||
item_pickup drop = spawn(item_pickup, m_iWasDropped: TRUE, m_iClip: pl.a_ammo1);
|
||||
drop.SetItem(pl.activeweapon);
|
||||
setorigin(drop, pl.origin);
|
||||
drop.solid = SOLID_NOT;
|
||||
drop.think = DropWeapon_Enable;
|
||||
drop.nextthink = time + 1.5f;
|
||||
drop.movetype = MOVETYPE_TOSS;
|
||||
drop.classname = "remove_me";
|
||||
|
||||
makevectors(pl.v_angle);
|
||||
drop.velocity = v_forward * 256;
|
||||
drop.avelocity[1] = 500;
|
||||
Weapons_RemoveItem(pl, pl.activeweapon);
|
||||
}
|
||||
|
||||
void CSEv_DropWeapon(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
Weapon_DropCurrentWeapon(pl);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -49,19 +49,8 @@ void Weapons_PlaySound(entity, float, string, float, float);
|
|||
int Weapons_IsPresent(player, int);
|
||||
void Weapons_SetModel(string);
|
||||
void Weapons_SetGeomset(string);
|
||||
#ifdef SERVER
|
||||
void Weapons_RefreshAmmo(player);
|
||||
void Weapons_InitItem(int);
|
||||
float Weapons_GetAim(int);
|
||||
|
||||
/* TODO: pass this as a weapon.pickup parm */
|
||||
int Weapons_AddItem(player, int, int);
|
||||
|
||||
void Weapons_RemoveItem(player, int);
|
||||
string Weapons_GetWorldmodel(int);
|
||||
void Weapons_UpdateAmmo(player, int, int, int);
|
||||
void Weapons_ReloadWeapon(player, .int, .int, int);
|
||||
#else
|
||||
#ifdef CLIENT
|
||||
string Weapons_GetPlayermodel(int);
|
||||
int Weapons_GetAnimation(void);
|
||||
void Weapons_HUDPic(int, int, vector, float);
|
||||
|
|
Loading…
Reference in a new issue