Lots of commits bundled into one:

- Added GamePMove_Fall and GamePMove_Jump for controlling either.
- Tweaked maxspeed for Counter-Strike heavily.
- Worked on the Counter-Strike WEAPON_KNIFE (fully functional!).
- Worked on the Counter-Strike WEAPON_AWP (mainly zoom).
- The WEAPON_C4 in Counter-Strike will no longer unfreeze you during warmup
- Added cl_showtriggers for displaying brush-based triggers.
- Removed muzzleflash dynamic light, as it seems GoldSrc doesn't have any.
- Fixed bug in which the server-list would run into an infinite loop error.
- Fixed weapon pricing in Counter-Strike.
- To rescue hostages means to earn $$$
This commit is contained in:
Marco Cawthorne 2020-04-20 06:44:47 +02:00
parent d7e818410c
commit 2cee375ce5
51 changed files with 578 additions and 341 deletions

View File

@ -14,6 +14,11 @@ weapon_awp.fire
sample weapons/awp1.wav
}
weapon_awp.zoom
{
sample weapons/zoom.wav
}
weapon_c4bomb.disarm
{
sample weapons/c4_disarm.wav

View File

@ -5,15 +5,12 @@
#define CLIENT
#define VALVE
#define CSTRIKE
#define CLASSIC_VGUI
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/cstrike/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../cstrike/defs.h
../valve/particles.h
@ -48,10 +45,8 @@ predict.c
../npc.c
../../shared/cstrike/radio.c
../../shared/cstrike/items.h
../../shared/cstrike/weapons_cstrike.c
../../shared/valve/weapon_common.h
../../shared/cstrike/weapons.h
../../shared/cstrike/w_ak47.c
../../shared/cstrike/w_deagle.c
../../shared/cstrike/w_knife.c

View File

@ -9,10 +9,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../valve/defs.h
../valve/particles.h

View File

@ -9,10 +9,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../valve/defs.h
../valve/particles.h

View File

@ -9,10 +9,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../valve/defs.h
../valve/particles.h

View File

@ -9,10 +9,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../valve/defs.h
../valve/particles.h

View File

@ -8,10 +8,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../valve/defs.h
../valve/particles.h

View File

@ -8,10 +8,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../valve/defs.h
../valve/particles.h

View File

@ -8,10 +8,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../valve/defs.h
../valve/particles.h

View File

@ -141,7 +141,7 @@ void View_DrawViewModel(void)
if (pl.health <= 0) {
return;
}
if (cvar("r_drawviewmodel") == 0 || autocvar_cl_thirdperson == TRUE) {
return;
}
@ -165,7 +165,7 @@ void View_DrawViewModel(void)
/* now apply the scale hack */
m_eViewModel.scale = autocvar_r_viewmodelscale;
pSeat->m_flBob *= autocvar_r_viewmodelscale;
m_eViewModel.origin = pSeat->m_vecPredictedOrigin + pl.view_ofs;
m_eViewModel.origin += [0,0,-1] + (v_forward * (pSeat->m_flBob * 0.4))
+ (v_forward * autocvar_v_gunofs[0])
@ -190,7 +190,7 @@ void View_DrawViewModel(void)
if (m_eMuzzleflash.alpha > 0.0f) {
makevectors(getproperty(VF_ANGLES));
m_eMuzzleflash.origin = gettaginfo(m_eViewModel, m_eMuzzleflash.skin);
dynamiclight_add(pSeat->m_vecPredictedOrigin + (v_forward * 32), 400 * m_eMuzzleflash.alpha, [1,0.45,0]);
/*dynamiclight_add(pSeat->m_vecPredictedOrigin + (v_forward * 32), 400 * m_eMuzzleflash.alpha, [1,0.45,0]);*/
setorigin(m_eMuzzleflash, m_eMuzzleflash.origin);
addentity(m_eMuzzleflash);

View File

@ -24,7 +24,8 @@ enum
RM_TEXTURE,
RM_GLOW,
RM_SOLID,
RM_ADDITIVE
RM_ADDITIVE,
RM_TRIGGER
};
enum

View File

@ -14,6 +14,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
var int autocvar_cl_showtriggers = FALSE;
string __fullspawndata;
string Sentences_GetSamples(string);
@ -74,6 +76,15 @@ CBaseEntity::RenderFXPass(void)
case RM_ADDITIVE:
effects = EF_ADDITIVE;
break;
case RM_TRIGGER:
if (autocvar_cl_showtriggers) {
effects = EF_FULLBRIGHT;
alpha = 0.75f;
colormod = [1,0,0];
} else {
alpha = 0.0f;
}
break;
}
/* messy hologram imitation */

View File

@ -49,32 +49,3 @@ enum
#define SURF_ALPHASHADOW 0x10000i /* do per-pixel light shadow casting in q3map */
#define SURF_NODLIGHT 0x20000i /* don't dlight even if solid (solid lava, skies) */
#define SURF_DUST 0x40000i /* leave a dust trail when walking on this surface */
/* behaviour surfaceflags */
#define SURF_LEAKSTEAM 0x00080000i /* when shot, the material emits steam */
#define SURF_LEAKWATER 0x00100000i /* when shot, the material emits water */
#define SURF_RESERVED1 0x00200000i
#define SURF_RESERVED2 0x00400000i
#define SURF_RESERVED3 0x00800000i
#define SURF_RESERVED4 0x01000000i
#define SURF_RESERVED5 0x02000000i
#define SURF_RESERVED6 0x04000000i
#define SURF_RESERVED7 0x08000000i
/* material surfaceflags (need to be masked) */
#define SURF_MASK 0x0FFFFFFFi
#define SURF_ALIEN 0x10000000i
#define SURF_FLESH 0x20000000i
#define SURF_FOLIAGE 0x30000000i
#define SURF_COMPUTER 0x40000000i
#define SURF_DIRT 0x50000000i
#define SURF_VENT 0x60000000i
#define SURF_GRATE 0x70000000i
#define SURF_METAL 0x80000000i
#define SURF_GLASS 0x90000000i
#define SURF_SAND 0xA0000000i
#define SURF_SLOSH 0xB0000000i
#define SURF_SNOW 0xC0000000i
#define SURF_TILE 0xD0000000i
#define SURF_WOOD 0xE0000000i
#define SURF_CONCRETE 0xF0000000i

View File

@ -133,8 +133,7 @@ CBaseTrigger::InitBrushTrigger(void)
setmodel(this, m_oldModel);
movetype = MOVETYPE_NONE;
solid = SOLID_BSPTRIGGER;
m_iRenderMode = RM_COLOR;
m_flRenderAmt = 0.25f;
m_iRenderMode = RM_TRIGGER;
}
void

View File

@ -21,7 +21,7 @@ Currently unused. This is meant for defining level transition regions.
All entities touching this volume would carry across to the next level.
*/
class trigger_transition
class trigger_transition:CBaseEntity
{
void(void) trigger_transition;
};
@ -34,4 +34,5 @@ trigger_transition::trigger_transition(void)
setmodel(this, model);
model = __NULL__;
modelindex = 0;
m_iRenderMode = RM_TRIGGER;
}

View File

@ -69,9 +69,9 @@ void ctrl_lb_clicked(int val)
{
static float clicked_last;
static int val_last;
ctrl_lbActDesc.SetSelected(val);
ctrl_lbActBind1.SetSelected(val);
ctrl_lbActBind2.SetSelected(val);
ctrl_lbActDesc.SetSelected(val, FALSE);
ctrl_lbActBind1.SetSelected(val, FALSE);
ctrl_lbActBind2.SetSelected(val, FALSE);
if (ctrl_lbActBind3.GetItem(val) == "blank") {
return;

View File

@ -119,12 +119,12 @@ void inet_btnrefresh(void)
void inet_lb_clicked(int val)
{
inet_lbServers_Name.SetSelected(val);
inet_lbServers_Ping.SetSelected(val);
inet_lbServers_Map.SetSelected(val);
inet_lbServers_Game.SetSelected(val);
inet_lbServers_Players.SetSelected(val);
inet_lbServers_Addresses.SetSelected(val);
inet_lbServers_Name.SetSelected(val, FALSE);
inet_lbServers_Ping.SetSelected(val, FALSE);
inet_lbServers_Map.SetSelected(val, FALSE);
inet_lbServers_Game.SetSelected(val, FALSE);
inet_lbServers_Players.SetSelected(val, FALSE);
inet_lbServers_Addresses.SetSelected(val, FALSE);
}
void inet_lb_changed(int val)
{

View File

@ -113,12 +113,12 @@ void lan_btnrefresh(void)
void lan_lb_clicked(int val)
{
lan_lbServers_Name.SetSelected(val);
lan_lbServers_Ping.SetSelected(val);
lan_lbServers_Map.SetSelected(val);
lan_lbServers_Game.SetSelected(val);
lan_lbServers_Players.SetSelected(val);
lan_lbServers_Addresses.SetSelected(val);
lan_lbServers_Name.SetSelected(val, FALSE);
lan_lbServers_Ping.SetSelected(val, FALSE);
lan_lbServers_Map.SetSelected(val, FALSE);
lan_lbServers_Game.SetSelected(val, FALSE);
lan_lbServers_Players.SetSelected(val, FALSE);
lan_lbServers_Addresses.SetSelected(val, FALSE);
}
void lan_lb_changed(int val)

View File

@ -32,6 +32,12 @@ void lg_btnload(void)
localcmd(sprintf("load %s\n", g_savegames[i]));
}
void lg_btnunsave(void)
{
int i = lg_lbSaves.GetSelected();
localcmd(sprintf("unsavegame %s\n", g_savegames[i]));
}
void lg_btncancel_start(void)
{
static void lg_btncancel_end(void) {
@ -69,7 +75,7 @@ void menu_loadgame_refreshsaves(void)
lg_lbSaves.AddEntry(g_savegames[i]);
}
search_end(searchy);
lg_lbSaves.SetSelected(0);
lg_lbSaves.SetSelected(0, TRUE);
}
void menu_loadgame_init(void)
@ -84,7 +90,7 @@ void menu_loadgame_init(void)
lg_btnDelete = spawn(CMainButton);
lg_btnDelete.SetImage(BTN_DELETE);
lg_btnDelete.SetExecute(__NULL__);
lg_btnDelete.SetExecute(lg_btnunsave);
lg_btnDelete.SetPos(50,172);
Widget_Add(fn_loadgame, lg_btnDelete);

View File

@ -160,7 +160,7 @@ void menu_videomodes_init(void)
for (int i = 0; i < g_resolutions.length; i++) {
tokenizebyseparator(g_resolutions[i], "x");
if (stof(argv(0)) == physres[0] && stof(argv(1)) == physres[1]) {
vm_lbRes.SetSelected(i);
vm_lbRes.SetSelected(i, FALSE);
}
vm_lbRes.AddEntry(g_resolutions[i]);
}

View File

@ -35,7 +35,7 @@ class CListBox:CWidget
virtual void(void(int val) func) SetChanged;
virtual string(int) GetItem;
virtual void(int, string) SetItem;
virtual void(int i) SetSelected;
virtual void(int, int) SetSelected;
virtual string() GetSelectedItem;
virtual int(void) GetSelected;
virtual int(void) GetCount;
@ -81,7 +81,7 @@ void CListBox::Input(float type, float x, float y, float devid)
if (Util_CheckMouse(pos[0], pos[1], m_size[0], 15)) {
if (type == IE_KEYDOWN) {
if (x == K_MOUSE1) {
SetSelected(i);
SetSelected(i, TRUE);
break;
}
}
@ -126,7 +126,7 @@ void CListBox::SetChanged(void(int val) func)
m_execute = func;
}
void CListBox::SetSelected(int i)
void CListBox::SetSelected(int i, int exec)
{
if (m_entries[i] == __NULL__) {
return;
@ -134,7 +134,7 @@ void CListBox::SetSelected(int i)
m_selected = i;
if (m_execute) {
if (m_execute && exec) {
m_execute(i);
}
}

View File

@ -14,36 +14,37 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* values courtesy of https://wiki.alliedmods.net/Cs_weapons_information */
int g_cstrikeWeaponPrice[] =
{
WEAPON_NONE,
WEAPON_M3,
WEAPON_XM1014,
WEAPON_MP5,
WEAPON_P90,
WEAPON_UMP45,
WEAPON_MAC10,
WEAPON_TMP,
WEAPON_AK47,
WEAPON_SG552,
WEAPON_M4A1,
WEAPON_AUG,
WEAPON_SCOUT,
WEAPON_AWP,
WEAPON_G3SG1,
WEAPON_SG550,
WEAPON_PARA,
WEAPON_USP45,
WEAPON_GLOCK18,
WEAPON_DEAGLE,
WEAPON_P228,
WEAPON_ELITES,
WEAPON_FIVESEVEN,
WEAPON_KNIFE,
WEAPON_HEGRENADE,
WEAPON_FLASHBANG,
WEAPON_SMOKEGRENADE,
WEAPON_C4BOMB
0, /* WEAPON_NONE */
1700, /* WEAPON_M3 */
3000, /* WEAPON_XM1014 */
1500, /* WEAPON_MP5 */
2350, /* WEAPON_P90 */
1700, /* WEAPON_UMP45 */
1400, /* WEAPON_MAC10 */
1250, /* WEAPON_TMP */
2500, /* WEAPON_AK47 */
3500, /* WEAPON_SG552 */
3100, /* WEAPON_M4A1 */
3500, /* WEAPON_AUG */
2750, /* WEAPON_SCOUT */
4750, /* WEAPON_AWP */
5000, /* WEAPON_G3SG1 */
4200, /* WEAPON_SG550 */
5750, /* WEAPON_PARA */
500, /* WEAPON_USP45 */
400, /* WEAPON_GLOCK18 */
650, /* WEAPON_DEAGLE */
600, /* WEAPON_P228 */
800, /* WEAPON_ELITES */
750, /* WEAPON_FIVESEVEN */
0, /* WEAPON_KNIFE */
300, /* WEAPON_HEGRENADE */
200, /* WEAPON_FLASHBANG */
300, /* WEAPON_SMOKEGRENADE */
0 /* WEAPON_C4BOMB */
};
void

View File

@ -15,6 +15,7 @@
*/
#include "gamerules.h"
#include "money.h"
var int g_cstrike_buying = 0;
var float g_cstrike_bombradius = 500;

View File

@ -40,10 +40,12 @@ Choices for 'team' include:
2 = Counter-Terrorist
*/
class func_buyzone
class func_buyzone:CBaseTrigger
{
void(void) func_buyzone;
virtual void(void) touch;
virtual void(void) Respawn;
};
void
@ -57,18 +59,15 @@ func_buyzone::touch(void)
pl.buyzone = TRUE;
}
void
func_buyzone::Respawn(void)
{
InitBrushTrigger();
}
void
func_buyzone::func_buyzone(void)
{
angles = [0,0,0];
movetype = MOVETYPE_NONE;
solid = SOLID_TRIGGER;
if (model) {
setmodel(this, model);
} else {
mins = [-128,-128,-36];
maxs = [128,128,36];
setsize(this, mins, maxs);
}
CBaseTrigger::CBaseTrigger();
InitBrushTrigger();
}

View File

@ -28,10 +28,12 @@ If neither a func_hostage_rescue or a info_hostage_rescue is placed,
zones will be placed in Counter-Terrorist player spawn nodes automatically.
*/
class func_hostage_rescue
class func_hostage_rescue:CBaseTrigger
{
void(void) func_hostage_rescue;
virtual void(void) touch;
virtual void(void) Respawn;
};
void
@ -50,28 +52,25 @@ func_hostage_rescue::touch(void)
Radio_BroadcastMessage(RADIO_RESCUED);
g_cs_hostagesrescued++;
//Money_AddMoney(hosty.m_eFollowing, 1000);
Money_AddMoney(hosty.m_eFollowing, 1000);
/* In Hostage Rescue, all Counter-Terrorists receive an $850
* bonus for every hostage they rescue, even if they lose the round. */
//Money_QueTeamReward(TEAM_CT, 850);
Money_QueTeamReward(TEAM_CT, 850);
CBaseEntity targa = (CBaseEntity)other;
targa.Hide();
}
void
func_hostage_rescue::Respawn(void)
{
InitBrushTrigger();
}
void
func_hostage_rescue::func_hostage_rescue(void)
{
angles = [0,0,0];
movetype = MOVETYPE_NONE;
solid = SOLID_TRIGGER;
if (model) {
setmodel(this, model);
} else {
mins = [-128,-128,-36];
maxs = [128,128,36];
setsize(this, mins, maxs);
}
CBaseTrigger::CBaseTrigger();
InitBrushTrigger();
}

View File

@ -14,9 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
int g_cs_moneyreward_ct;
int g_cs_moneyreward_t;
void
Money_AddMoney(player pl, int iMoneyValue)
{

View File

@ -75,7 +75,7 @@ CSMultiplayerRules::CreateRescueZones(void)
/* since no buyzones are available, let's create one around every CT spawn */
for (entity e = world; (e = find(e, ::classname, "info_player_start"));) {
func_hostage_rescue newzone = spawn(func_hostage_rescue);
info_hostage_rescue newzone = spawn(info_hostage_rescue);
setorigin(newzone, e.origin);
}
}
@ -98,7 +98,7 @@ CSMultiplayerRules::CreateCTBuyzones(void)
/* since no buyzones are available, let's create one around every CT spawn */
for (entity e = world; (e = find(e, ::classname, "info_player_start"));) {
func_buyzone newzone = spawn(func_buyzone);
info_buyzone newzone = spawn(info_buyzone);
setorigin(newzone, e.origin);
newzone.team = TEAM_CT;
}
@ -122,7 +122,7 @@ CSMultiplayerRules::CreateTBuyzones(void)
/* since no buyzones are available, let's create one around every T spawn */
for (entity e = world; (e = find(e, ::classname, "info_player_deathmatch"));) {
func_buyzone newzone = spawn(func_buyzone);
info_buyzone newzone = spawn(info_buyzone);
setorigin(newzone, e.origin);
newzone.team = TEAM_T;
}

View File

@ -0,0 +1,50 @@
/*
* 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.
*/
/*QUAKED info_buyzone (0 0 0.8) (-16 -16 0) (16 16 16)
"targetname" Name
"target" Target when triggered.
"killtarget" Target to kill when triggered.
COUNTER-STRIKE (1999) ENTITY
Buy zone.
See func_buyzone for more information.
*/
class info_buyzone
{
void(void) info_buyzone;
virtual void(void) touch;
};
void
info_buyzone::touch(void)
{
player pl = (player)other;
if (!(other.flags & FL_CLIENT)) {
return;
}
pl.buyzone = TRUE;
}
void
info_buyzone::info_buyzone(void)
{
solid = SOLID_TRIGGER;
setsize(this, [-128,-128,-128], [128,128,128]);
}

View File

@ -32,10 +32,38 @@ zones will be placed in Counter-Terrorist player spawn nodes automatically.
class info_hostage_rescue
{
void(void) info_hostage_rescue;
virtual void(void) touch;
};
void
info_hostage_rescue::touch(void)
{
if (other.classname != "hostage_entity") {
return;
}
CBaseNPC hosty = (CBaseNPC)other;
if (hosty.solid == SOLID_NOT) {
return;
}
Radio_BroadcastMessage(RADIO_RESCUED);
g_cs_hostagesrescued++;
Money_AddMoney(hosty.m_eFollowing, 1000);
/* In Hostage Rescue, all Counter-Terrorists receive an $850
* bonus for every hostage they rescue, even if they lose the round. */
Money_QueTeamReward(TEAM_CT, 850);
CBaseEntity targa = (CBaseEntity)other;
targa.Hide();
}
void
info_hostage_rescue::info_hostage_rescue(void)
{
solid = SOLID_TRIGGER;
setsize(this, [-128,-128,-128], [128,128,128]);
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2016-2019 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.
*/
int g_cs_moneyreward_ct;
int g_cs_moneyreward_t;
void Money_AddMoney(player pl, int iMoneyValue);
void Money_QueTeamReward(int t, int iMoneyValue);
void Money_GiveTeamReward(void);
void Money_ResetTeamReward(void);
int Money_GetLosses(int team);
int Money_HasBonus(int team);
void Money_HandleRoundReward(int winner)
void Money_ResetRoundReward(void);

View File

@ -10,10 +10,6 @@
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/cstrike/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../../shared/valve/animations.h
../defs.h
@ -36,10 +32,8 @@
../valve/spectator.c
../../shared/cstrike/radio.c
../../shared/cstrike/items.h
../../shared/cstrike/weapons_cstrike.c
../../shared/valve/weapon_common.h
../../shared/cstrike/weapons.h
../../shared/cstrike/w_ak47.c
../../shared/cstrike/w_deagle.c
../../shared/cstrike/w_knife.c
@ -75,10 +69,11 @@
../cstrike/armoury_entity.cpp
../cstrike/func_bomb_target.cpp
../cstrike/func_buyzone.cpp
../cstrike/info_buyzone.cpp
../cstrike/func_escapezone.cpp
../cstrike/func_hostage_rescue.cpp
../cstrike/func_vip_safetyzone.cpp
../cstrike/info_hostage_rescue.cpp
../cstrike/func_vip_safetyzone.cpp
../cstrike/info_map_parameters.cpp
../cstrike/item_suit.cpp

View File

@ -9,10 +9,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../../shared/valve/animations.h
../defs.h

View File

@ -9,10 +9,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../../shared/valve/animations.h
../defs.h

View File

@ -9,10 +9,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../../shared/valve/animations.h
../defs.h

View File

@ -8,10 +8,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../../shared/valve/animations.h
../defs.h

View File

@ -9,10 +9,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../../shared/valve/animations.h
../defs.h

View File

@ -8,10 +8,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../../shared/valve/animations.h
../defs.h

View File

@ -8,10 +8,6 @@
#includelist
../../shared/fteextensions.qc
../../shared/defs.h
../../shared/math.h
../../shared/materials.h
../../shared/events.h
../../shared/entities.h
../../shared/sound.c
../../shared/valve/animations.h
../defs.h

View File

@ -16,6 +16,7 @@
#include "radio.h"
#include "weapons.h"
#include "items.h"
enum
{

View File

@ -1,98 +1,151 @@
/*
* 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 GamePMove_Maxspeed(player target)
.float waterlevel;
.float watertype;
/* values courtesy of https://wiki.alliedmods.net/Cs_weapons_information */
float
GamePMove_Maxspeed(player target)
{
float spd = serverkeyfloat("phy_maxspeed");
switch (target.activeweapon)
{
case WEAPON_NONE:
spd *= 1.0f;
break;
case WEAPON_M3:
spd *= 0.92f;
spd *= 230/250;
break;
case WEAPON_XM1014:
spd *= 0.96f;
spd *= 240/250;
break;
case WEAPON_MP5:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_P90:
spd *= 0.98f;
spd *= 245/250;
break;
case WEAPON_UMP45:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_MAC10:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_TMP:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_AK47:
spd *= 0.88f;
spd *= 221/250;
break;
case WEAPON_SG552:
spd *= 0.94f;
spd *= 235/250;
break;
case WEAPON_M4A1:
spd *= 0.92f;
spd *= 230/250;
break;
case WEAPON_AUG:
spd *= 0.96f;
spd *= 240/250;
break;
case WEAPON_SCOUT:
spd *= 1.04f;
spd *= 260/250;
break;
case WEAPON_AWP:
spd *= 0.84f;
spd *= 210/250;
break;
case WEAPON_G3SG1:
spd *= 0.84f;
spd *= 210/250;
break;
case WEAPON_SG550:
spd *= 0.84f;
spd *= 210/250;
break;
case WEAPON_PARA:
spd *= 0.88f;
spd *= 220/250;
break;
case WEAPON_USP45:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_GLOCK18:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_DEAGLE:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_P228:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_ELITES:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_FIVESEVEN:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_KNIFE:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_HEGRENADE:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_FLASHBANG:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_SMOKEGRENADE:
spd *= 1.0f;
spd *= 250/250;
break;
case WEAPON_C4BOMB:
spd *= 1.0f;
spd *= 250/250;
break;
default:
}
if (target.flags & FL_CROUCHING)
if (target.flags & FL_CROUCHING) {
spd *= 0.5f;
}
return spd;
}
void
GamePMove_Fall(player target, float impactspeed)
{
if (impactspeed > 580) {
#ifdef SERVER
float fFallDamage = (impactspeed - 580) * (100 / (1024 - 580)) * 1.75f;
Damage_Apply(target, world, fFallDamage, 0, DMG_FALL);
if (random() < 0.5)
sound(target, CHAN_AUTO, "player/pl_pain2.wav", 1.0, ATTN_NORM);
else
sound(target, CHAN_AUTO, "player/pl_pain4.wav", 1.0, ATTN_NORM);
#endif
}
}
void
GamePMove_Jump(player target)
{
if (target.waterlevel >= 2) {
if (target.watertype == CONTENT_WATER) {
target.velocity[2] = 100;
} else if (target.watertype == CONTENT_SLIME) {
target.velocity[2] = 80;
} else {
target.velocity[2] = 50;
}
} else {
/* slow the player down a bit to prevent bhopping like crazy */
target.velocity *= 0.80f;
target.velocity[2] += 220;
}
}

View File

@ -41,6 +41,7 @@ w_awp_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_awp.fire");
Sound_Precache("weapon_awp.zoom");
#endif
precache_model("models/v_awp.mdl");
precache_model("models/w_awp.mdl");
@ -51,7 +52,7 @@ void
w_awp_updateammo(player pl)
{
#ifdef SERVER
Weapons_UpdateAmmo(pl, pl.awp_mag, pl.ammo_338mag, -1);
Weapons_UpdateAmmo(pl, pl.awp_mag, pl.ammo_338mag, pl.a_ammo3);
#endif
}
@ -105,12 +106,61 @@ w_awp_draw(void)
#endif
}
void
w_awp_release(void)
{
player pl = (player)self;
w_cstrike_weaponrelease();
if (pl.w_idle_next > 0.0f) {
pl.viewzoom = 1.0f;
return;
}
if (pl.a_ammo3 == 1) {
pl.viewzoom = 0.45f;
} else if (pl.a_ammo3 == 2) {
pl.viewzoom = 0.1f;
} else {
pl.viewzoom = 1.0f;
}
}
void
w_awp_secondary(void)
{
player pl = (player)self;
if (pl.w_attack_next) {
return;
}
#ifdef SSQC
Sound_Play(pl, CHAN_WEAPON, "weapon_awp.zoom");
#endif
/* Simple toggle of fovs */
if (pl.a_ammo3 == 1) {
pl.a_ammo3 = 2;
} else if (pl.a_ammo3 == 2) {
pl.a_ammo3 = 0;
} else {
pl.a_ammo3 = 1;
}
pl.w_attack_next = 0.5f;
pl.w_idle_next = 0.0f;
w_awp_release();
}
void
w_awp_primary(void)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
w_awp_release();
return;
}
@ -159,24 +209,6 @@ w_awp_primary(void)
pl.w_idle_next = pl.w_attack_next;
}
void
w_awp_secondary(void)
{
player pl = (player)self;
if (pl.w_attack_next) {
return;
}
/* Simple toggle of fovs */
if (pl.viewzoom == 1.0f) {
pl.viewzoom = 0.45f;
} else if (pl.viewzoom == 0.45f) {
pl.viewzoom = 0.1f;
} else {
pl.viewzoom = 1.0f;
}
pl.w_attack_next = 0.5f;
}
void
w_awp_reload(void)
{
@ -274,7 +306,7 @@ weapon_t w_awp =
w_awp_primary,
w_awp_secondary,
w_awp_reload,
w_cstrike_weaponrelease,
w_awp_release,
w_awp_hud,
w_awp_precache,
w_awp_pickup,

View File

@ -219,7 +219,6 @@ w_c4bomb_release(void)
}
pl.a_ammo1 = C4S_NONE;
pl.w_idle_next = 0.0f;
pl.flags &= ~FL_FROZEN;
}
void
@ -244,6 +243,7 @@ w_c4bomb_primary(void)
break;
case C4S_DROPPING:
w_c4bomb_release();
return;
break;
default:
break;

View File

@ -146,7 +146,6 @@ w_deagle_primary(void)
Sound_Play(pl, CHAN_WEAPON, "weapon_deagle.fire");
#endif
if (pl.a_ammo1 <= 0) {
Weapons_ViewAnimation(DEAGLE_SHOOT_EMPTY);
} else {

View File

@ -27,12 +27,14 @@ Default arsenal on both teams
enum
{
KNIFE_IDLE,
KNIFE_RELOAD,
KNIFE_IDLE1,
KNIFE_SLASH1,
KNIFE_SLASH2,
KNIFE_DRAW,
KNIFE_SHOOT1,
KNIFE_SHOOT2,
KNIFE_SHOOT3
KNIFE_STAB,
KNIFE_STAB_MISS,
KNIFE_MIDSLASH1,
KNIFE_MIDSLASH2
};
void
@ -93,24 +95,78 @@ w_knife_primary(void)
return;
}
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
int r = (float)input_sequence % 3;
int r = (float)input_sequence % 2;
switch (r) {
case 0:
Weapons_ViewAnimation(KNIFE_SHOOT1);
break;
case 1:
Weapons_ViewAnimation(KNIFE_SHOOT2);
Weapons_ViewAnimation(KNIFE_SLASH1);
break;
default:
Weapons_ViewAnimation(KNIFE_SHOOT3);
Weapons_ViewAnimation(KNIFE_SLASH2);
break;
}
#endif
pl.w_attack_next = 0.7f;
#ifdef SERVER
vector src;
Weapons_MakeVectors();
src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl);
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.miss");
if (trace_fraction >= 1.0) {
return;
}
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [1,0,0]);
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.hitbody");
} else {
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.hit");
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, pl, 15, WEAPON_KNIFE, DMG_SLASH);
}
#endif
}
void
w_knife_secondary(void)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
}
Weapons_ViewAnimation(KNIFE_STAB);
pl.w_attack_next = 1.2f;
#ifdef SERVER
vector src;
Weapons_MakeVectors();
src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl);
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.miss");
if (trace_fraction >= 1.0) {
return;
}
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [1,0,0]);
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.hitbody");
} else {
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.hit");
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, pl, 65, WEAPON_KNIFE, DMG_SLASH);
}
#endif
}
float
@ -160,7 +216,7 @@ weapon_t w_knife =
w_knife_draw,
__NULL__,
w_knife_primary,
__NULL__,
w_knife_secondary,
__NULL__,
__NULL__,
__NULL__,

View File

@ -272,7 +272,7 @@ weapon_t w_mp5 =
#ifdef SERVER
void
weapon_mp5(void)
weapon_mp5navy(void)
{
Weapons_InitItem(WEAPON_MP5);
}

View File

@ -17,6 +17,12 @@
#include "damage.h"
#include "flags.h"
#include "hitmesh.h"
#include "entities.h"
#include "events.h"
#include "flags.h"
#include "hitmesh.h"
#include "materials.h"
#include "math.h"
/* Those are constant for HL BSP and CANNOT be changed.
* Blame Valve for purchasing a Quake II license but not
@ -54,7 +60,8 @@ const vector VEC_PLAYER_CVIEWPOS = [0,0,12];
.float teleport_time;
.vector basevelocity;
void* memrealloc(__variant *oldptr, int elementsize, int oldelements, int newelements)
void*
memrealloc(__variant *oldptr, int elementsize, int oldelements, int newelements)
{
void *n = memalloc(elementsize * newelements);
memcpy(n, oldptr, elementsize * min(oldelements, newelements));
@ -62,22 +69,26 @@ void* memrealloc(__variant *oldptr, int elementsize, int oldelements, int newele
return n;
}
__wrap __variant* memalloc(int size)
__wrap __variant*
memalloc(int size)
{
return prior(size);
}
void Empty(void)
void
Empty(void)
{
}
void Util_Destroy(void)
void
Util_Destroy(void)
{
remove(self);
}
__wrap void dprint(string m)
__wrap void
dprint(string m)
{
if (cvar("developer") == 1)
return prior(m);

View File

@ -35,8 +35,33 @@
#define FL_ONLADDER (1<<13)
#define FL_FLASHLIGHT (1<<17)
#define FL_REMOVEME (1<<18)
#define FL_CROUCHING (1<<19)
#define FL_CROUCHING (1<<19)
#define FL_SEMI_TOGGLED (1<<20)
#define FL_FROZEN (1<<21)
#define FL_VOTED (1<<22)
#define FL_FROZEN (1<<21)
#define FL_VOTED (1<<22)
#define FL_RESERVED (1<<23)
/* game flags */
#define GF_UNUSED1 (1<<0)
#define GF_UNUSED2 (1<<1)
#define GF_UNUSED3 (1<<2)
#define GF_UNUSED4 (1<<3)
#define GF_UNUSED5 (1<<4)
#define GF_UNUSED6 (1<<5)
#define GF_UNUSED7 (1<<6)
#define GF_UNUSED8 (1<<7)
#define GF_UNUSED9 (1<<8)
#define GF_UNUSED10 (1<<9)
#define GF_UNUSED11 (1<<10)
#define GF_UNUSED12 (1<<11)
#define GF_UNUSED13 (1<<12)
#define GF_UNUSED14 (1<<14)
#define GF_UNUSED15 (1<<16)
#define GF_UNUSED16 (1<<13)
#define GF_UNUSED17 (1<<17)
#define GF_UNUSED18 (1<<18)
#define GF_UNUSED19 (1<<19)
#define GF_UNUSED20 (1<<20)
#define GF_UNUSED21 (1<<21)
#define GF_UNUSED22 (1<<22)
#define GF_UNUSED23 (1<<23)

View File

@ -37,7 +37,7 @@ enum
#define SURF_LADDER 0x8i // climb this surface
#define SURF_NOIMPACT 0x10i // don't make missile explosions
#define SURF_NOMARKS 0x20i // don't leave missile marks
#define SURF_FLESH 0x40i // make flesh sounds and effects
#define SURF_Q3FLESH 0x40i // make flesh sounds and effects
#define SURF_NODRAW 0x80i // don't generate a drawsurface at all
#define SURF_HINT 0x100i // make a primary bsp splitter
#define SURF_SKIP 0x200i // completely ignore, allowing non-closed brushes
@ -51,24 +51,31 @@ enum
#define SURF_NODLIGHT 0x20000i // don't dlight even if solid (solid lava, skies)
#define SURF_DUST 0x40000i // leave a dust trail when walking on this surface
// behaviour surfaceflags
#define SURF_LEAKSTEAM 0x80000i /* surface shoots steam when hit */
#define SURF_LEAKWATER 0x100000i /* surface sprays water when hit */
/* behaviour surfaceflags */
#define SURF_LEAKSTEAM 0x00080000i /* when shot, the material emits steam */
#define SURF_LEAKWATER 0x00100000i /* when shot, the material emits water */
#define SURF_RESERVED1 0x00200000i
#define SURF_RESERVED2 0x00400000i
#define SURF_RESERVED3 0x00800000i
#define SURF_RESERVED4 0x01000000i
#define SURF_RESERVED5 0x02000000i
#define SURF_RESERVED6 0x04000000i
#define SURF_RESERVED7 0x08000000i
// material surfaceflags
#define SURF_MASK 0x0FFFFFFFi
#define SURF_ALIEN 0x10000000i
#define SURF_FLESH 0x20000000i
#define SURF_FOLIAGE 0x30000000i
#define SURF_COMPUTER 0x40000000i
#define SURF_DIRT 0x50000000i
#define SURF_VENT 0x60000000i
#define SURF_GRATE 0x70000000i
#define SURF_METAL 0x80000000i
#define SURF_GLASS 0x90000000i
#define SURF_SAND 0xA0000000i
#define SURF_SLOSH 0xB0000000i
#define SURF_SNOW 0xC0000000i
#define SURF_TILE 0xD0000000i
#define SURF_WOOD 0xE0000000i
#define SURF_CONCRETE 0xF0000000i
/* material surfaceflags (need to be masked) */
#define SURF_MASK 0x0FFFFFFFi
#define SURF_ALIEN 0x10000000i
#define SURF_FLESH 0x20000000i
#define SURF_FOLIAGE 0x30000000i
#define SURF_COMPUTER 0x40000000i
#define SURF_DIRT 0x50000000i
#define SURF_VENT 0x60000000i
#define SURF_GRATE 0x70000000i
#define SURF_METAL 0x80000000i
#define SURF_GLASS 0x90000000i
#define SURF_SAND 0xA0000000i
#define SURF_SLOSH 0xB0000000i
#define SURF_SNOW 0xC0000000i
#define SURF_TILE 0xD0000000i
#define SURF_WOOD 0xE0000000i
#define SURF_CONCRETE 0xF0000000i

View File

@ -14,10 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define PHY_JUMP_CHAINWINDOW 0.5
#define PHY_JUMP_CHAIN 100
#define PHY_JUMP_CHAINDECAY 50
/* FIXME: jumptime should use the time global, as time intervals are not
* predictable - decrement it based upon input_timelength */
.float waterlevel;
@ -27,13 +23,6 @@
int trace_endcontentsi;
.vector basevelocity;
#ifdef VALVE
int Items_CheckItem(entity pl, int i) {
player pm = (player)pl;
return pm.g_items & i ? TRUE:FALSE;
}
#endif
/* serverinfo keys are the only way both client and server are kept in sync
* about physics variables. so none of the traditional cvars will work.
* otherwise we could not have reliable prediction code for player movement.
@ -56,7 +45,7 @@ PMove_Init(void) {
#ifdef CSTRIKE
localcmd("serverinfo phy_accelerate 4\n");
localcmd("serverinfo phy_maxspeed 240\n");
localcmd("serverinfo phy_maxspeed 250\n");
#endif
#endif
}
@ -455,9 +444,6 @@ PMove_AccelGravity(float move_time, float premove, vector wish_dir, float wish_s
void
PMove_AccelJump(float move_time, float premove)
{
float flJumptimeDelta;
float flChainBonus;
/* unset jump-key whenever it's not set */
if (!(input_buttons & INPUT_BUTTON2)) {
self.flags |= FL_JUMPRELEASED;
@ -476,31 +462,7 @@ PMove_AccelJump(float move_time, float premove)
self.velocity[2] = 0;
}
if (self.waterlevel >= 2) {
if (self.watertype == CONTENT_WATER) {
self.velocity[2] = 100;
} else if (self.watertype == CONTENT_SLIME) {
self.velocity[2] = 80;
} else {
self.velocity[2] = 50;
}
} else {
/* Half-Life: Longjump module */
#ifdef VALVE
if (self.flags & FL_CROUCHING && Items_CheckItem(self, 0x00008000)) {
self.velocity = v_forward * 512;
self.velocity[2] += 100;
}
#endif
self.velocity[2] += 240;
}
if (self.jumptime > 0) {
flJumptimeDelta = 0 - (self.jumptime - PHY_JUMP_CHAINWINDOW);
flChainBonus = PHY_JUMP_CHAIN - (((PHY_JUMP_CHAINWINDOW - (PHY_JUMP_CHAINWINDOW - flJumptimeDelta)) * 2) * PHY_JUMP_CHAINDECAY);
self.velocity[2] += flChainBonus;
}
self.jumptime = PHY_JUMP_CHAINWINDOW;
GamePMove_Jump((player)self);
self.flags &= ~FL_ONGROUND;
self.flags &= ~FL_JUMPRELEASED;
}
@ -563,8 +525,6 @@ PMove_Acceleration(float move_time, float premove)
self.flags &= ~FL_ONGROUND;
self.velocity = wish_dir * wish_speed;
} else {
PMove_AccelJump(move_time, premove);
if (self.flags & FL_ONLADDER) {
PMove_AccelLadder(move_time, premove, wish_dir, wish_speed);
} else if (self.flags & FL_ONGROUND) {
@ -572,6 +532,7 @@ PMove_Acceleration(float move_time, float premove)
} else {
PMove_AccelGravity(move_time, premove, wish_dir, wish_speed);
}
PMove_AccelJump(move_time, premove);
}
}
@ -745,13 +706,12 @@ PMove_Run(void)
{
float punch;
player pl = (player)self;
#ifdef SERVER
float flFallVel = (self.flags & FL_ONGROUND) ? 0 : -self.velocity[2];
#endif
/* maxspeed changes when crouching, TODO: make this game-specific */
self.maxspeed = GamePMove_Maxspeed(self);
self.maxspeed = GamePMove_Maxspeed((player)self);
/* when pressing the 'use' button, we also walk slower for precision */
if (input_buttons & INPUT_BUTTON5) {
@ -813,17 +773,13 @@ PMove_Run(void)
pl.punchangle[1] *= punch;
pl.punchangle[2] *= punch;
#ifdef SERVER
if (self.waterlevel != 0) {
flFallVel = 0;
}
if ((self.flags & FL_ONGROUND) && self.movetype == MOVETYPE_WALK && (flFallVel > 580)) {
float fFallDamage = (flFallVel - 580) * (100 / (1024 - 580));
Damage_Apply(self, world, fFallDamage, 0, DMG_FALL);
sound(self, CHAN_AUTO, "player/pl_fallpain3.wav", 1.0, ATTN_NORM);
if ((self.flags & FL_ONGROUND) && self.movetype == MOVETYPE_WALK) {
GamePMove_Fall((player)self, flFallVel);
}
#endif
/* weapon/item logic of what the player controls */
Game_Input();

View File

@ -1,4 +1,70 @@
/*
* 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 PHY_JUMP_CHAINWINDOW 0.5
#define PHY_JUMP_CHAIN 100
#define PHY_JUMP_CHAINDECAY 50
.float waterlevel;
.float watertype;
float GamePMove_Maxspeed(player target)
{
return (target.flags & FL_CROUCHING) ? 135 : 270;
}
void GamePMove_Fall(player target, float impactspeed)
{
if (impactspeed > 580) {
#ifdef SERVER
float fFallDamage = (impactspeed - 580) * (100 / (1024 - 580));
Damage_Apply(self, world, fFallDamage, 0, DMG_FALL);
sound(self, CHAN_AUTO, "player/pl_fallpain3.wav", 1.0, ATTN_NORM);
#endif
}
}
void GamePMove_Jump(player target)
{
float flJumptimeDelta;
float flChainBonus;
if (target.waterlevel >= 2) {
if (target.watertype == CONTENT_WATER) {
target.velocity[2] = 100;
} else if (target.watertype == CONTENT_SLIME) {
target.velocity[2] = 80;
} else {
target.velocity[2] = 50;
}
} else {
/* Half-Life: Longjump module */
#ifdef VALVE
if (target.flags & FL_CROUCHING && target.g_items & 0x00008000i) {
target.velocity = v_forward * 512;
target.velocity[2] += 100;
}
#endif
target.velocity[2] += 240;
}
if (target.jumptime > 0) {
flJumptimeDelta = 0 - (target.jumptime - PHY_JUMP_CHAINWINDOW);
flChainBonus = PHY_JUMP_CHAIN - (((PHY_JUMP_CHAINWINDOW - (PHY_JUMP_CHAINWINDOW - flJumptimeDelta)) * 2) * PHY_JUMP_CHAINDECAY);
target.velocity[2] += flChainBonus;
}
target.jumptime = PHY_JUMP_CHAINWINDOW;
}

View File

@ -274,6 +274,7 @@ void Weapons_SwitchBest(player pl)
}
Weapons_Draw();
self = oldself;
pl.flags |= FL_SEMI_TOGGLED;
}
/* returns TRUE if weapon pickup gets removed from this world */