Client: We're now reading skyname and setting the skybox (with fallback) in CSQC. Much rejoice

Added item_suit and item_longjump... they do not do anything interesting yet.
Decals: Added glass break decals upon impact
Damage: Brush-entity radius damage should to work better now
Also seperated the weapons table from generic weapon entry functions. This should make maintaining mods easier
Fixed references from sv_clientslots to sv_playerslots. My brain gets confused between the Quake games at this point. I blame FTE
Fixed sprite animation cycle length check. It attempted to play one more frame than any sprite ever has. Needs more heavy testing?
This commit is contained in:
Marco Cawthorne 2019-03-14 20:13:02 +01:00
parent 8220ce4116
commit 75bed53adc
48 changed files with 564 additions and 550 deletions

View File

@ -45,7 +45,7 @@ void Client_Init(float apilevel, string enginename, float engineversion)
pSeat.iOverview = FALSE;
}
void CSQC_RendererRestarted(string sDescr)
void Game_RendererRestarted(string rstr)
{
Overview_Init();
}

View File

@ -97,7 +97,7 @@ void Overview_Init( void ) {
iImageSrc[ i ] = 0x00000000i;
}
}
r_uploadimage( ovMap.sImagePath, iImageWidth, iImageHeight, iImageSrc );
r_uploadimage( ovMap.sImagePath, iImageWidth, iImageHeight, (void*)iImageSrc );
memfree( iImageSrc );
}
}

View File

@ -82,7 +82,6 @@ void CSQC_Init(float apilevel, string enginename, float engineversion)
HUD_Init();
Scores_Init();
Client_Init(apilevel, enginename, engineversion);
DSP_Init();
}
@ -152,7 +151,7 @@ void CSQC_UpdateView(float w, float h, float focus)
setproperty(VF_CL_VIEWANGLES, pSeat->vCameraAngle);
} else {
if (pl.health) {
if (autocvar_cl_thirdperson == TRUE ) {
if (autocvar_cl_thirdperson == TRUE) {
makevectors(view_angles);
vector vStart = [pSeat->vPlayerOrigin[0], pSeat->vPlayerOrigin[1], pSeat->vPlayerOrigin[2] + 16] + (v_right * 4);
vector vEnd = vStart + (v_forward * -48) + [0,0,16] + (v_right * 4);
@ -380,7 +379,7 @@ void CSQC_Parse_Event(void)
Effect_CreateSpark(vSparkPos, vSparkAngle);
break;
case EV_GIBHUMAN:
vector vGibPos, vGibAngle;
vector vGibPos;
vGibPos[0] = readcoord();
vGibPos[1] = readcoord();
vGibPos[2] = readcoord();
@ -595,46 +594,49 @@ float CSQC_Parse_CenterPrint(string sMessage)
CSQC_Ent_ParseMapEntity
=================
*/
float CSQC_Ent_ParseMapEntity( void )
float CSQC_Ent_ParseMapEntity(void)
{
CBaseEntity eEnt = __NULL__;
string strField, strValue;
__fullspawndata = "";
int iClass = FALSE;
while ( 1 ) {
while (1) {
strField = getentitytoken();
if ( !strField ) {
if (!strField) {
break;
}
if ( strField == "}" ) {
if ( !eEnt.classname ) {
if (strField == "}") {
if (!eEnt.classname) {
break;
}
if ( iClass == TRUE ) {
if (iClass == TRUE) {
eEnt.Init();
return TRUE;
}
if ( eEnt ) {
remove( eEnt );
if (eEnt) {
remove(eEnt);
}
return TRUE;
}
strValue = getentitytoken();
if ( !strValue ) {
if (!strValue) {
break;
}
switch ( strField ) {
switch (strField) {
case "classname":
/*if ( strValue == "env_cubemap" ) {
/*if (strValue == "env_cubemap") {
iClass = TRUE;
eEnt = spawn(CEnvCubemap);
} else */if ( strValue == "env_sound" ) {
} else */if (strValue == "worldspawn") {
eEnt = spawn(worldspawn);
iClass = TRUE;
} else if (strValue == "env_sound") {
eEnt = spawn(env_sound);
iClass = TRUE;
} else {
@ -642,7 +644,7 @@ float CSQC_Ent_ParseMapEntity( void )
}
break;
default:
__fullspawndata = sprintf( "%s\"%s\" \"%s\" ", __fullspawndata, strField, strValue );
__fullspawndata = sprintf("%s\"%s\" \"%s\" ", __fullspawndata, strField, strValue);
break;
}
}
@ -674,27 +676,29 @@ void CSQC_WorldLoaded(void)
precache_pic("{scorch3", TRUE);
string strTokenized;
getentitytoken( 0 );
while ( 1 ) {
getentitytoken(0);
while (1) {
strTokenized = getentitytoken();
if ( strTokenized == "" ) {
if (strTokenized == "") {
break;
}
if ( strTokenized != "{" ) {
if (strTokenized != "{") {
print("^1[WARNING] ^7Bad entity data\n");
return;
}
if ( !CSQC_Ent_ParseMapEntity() ) {
if (!CSQC_Ent_ParseMapEntity()) {
print("^1[WARNING] ^7Bad entity data\n");
return;
}
}
}
void CSQC_RendererRestarted(string rstr)
{
Sky_Update();
Game_RendererRestarted(rstr);
}
/*
=================
CSQC_Shutdown

View File

@ -51,6 +51,7 @@ predict.c
../shared/valve/w_satchel.c
../shared/valve/w_snark.c
../shared/valve/weapons.c
../shared/valve/weapon_common.c
valve/player.c
entities.c

View File

@ -54,6 +54,7 @@ predict.c
../shared/scihunt/w_chainsaw.c
../shared/scihunt/w_hammer.c
../shared/scihunt/weapons.c
../shared/valve/weapon_common.c
valve/player.c

View File

@ -52,3 +52,8 @@ void Client_Init(float apilevel, string enginename, float engineversion)
/* FIXME: Replace with manual networking once I've got time? */
deltalisten("models/scientist.mdl", Scientist_Update, 0);
}
void Game_RendererRestarted(string rstr)
{
}

View File

@ -51,6 +51,7 @@ predict.c
../shared/valve/w_satchel.c
../shared/valve/w_snark.c
../shared/valve/weapons.c
../shared/valve/weapon_common.c
valve/player.c
entities.c

View File

@ -22,3 +22,8 @@ void Client_Init(float apilevel, string enginename, float engineversion)
precache_model("sprites/640hud5.spr");
precache_model("sprites/640hud6.spr");
}
void Game_RendererRestarted(string rstr)
{
}

View File

@ -1,7 +1,9 @@
#includelist
../gs-entbase/client/sky.c
../gs-entbase/client/baseentity.cpp
../gs-entbase/client/fade.cpp
../gs-entbase/client/sprite.cpp
../gs-entbase/client/text.cpp
../gs-entbase/client/env_sound.cpp
../gs-entbase/client/worldspawn.cpp
#endlist

View File

@ -15,6 +15,7 @@ class CBaseEntity {
void() CBaseEntity;
virtual void() Init;
virtual void() Initialized;
virtual void(string, string) SpawnKey;
};
@ -62,9 +63,13 @@ void CBaseEntity::Init(void)
//dprint(sprintf("SpawnData: %s %s\n", argv(i), argv(i+1)));
SpawnKey(argv(i), argv(i+1));
}
Initialized();
}
void CBaseEntity::Initialized(void)
{
}
void CBaseEntity::CBaseEntity(void)
{
Init();
}

View File

@ -0,0 +1,19 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
var string g_skyname = "desert";
void Sky_Update(void)
{
localcmd(sprintf("sky %s\n", g_skyname));
}
void Sky_Set(string name)
{
g_skyname = name;
}

View File

@ -17,7 +17,7 @@ class sprite
void sprite::think(void)
{
if (frame >= maxframe) {
if (frame >= (maxframe-1)) {
if (loops == 0) {
remove(this);
} else {

View File

@ -0,0 +1,33 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
/* We only want to load this because we're in desperate need for the skyname
* variable. Some maps like crossfire do not supply one because GS assumes
* the default is 'desert'... so once this is done we'll kill it. */
class worldspawn:CBaseEntity
{
virtual void(string, string) SpawnKey;
virtual void() Initialized;
};
void worldspawn::Initialized(void)
{
remove(this);
}
void worldspawn::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "skyname":
Sky_Set(strKey);
break;
default:
break;
}
}

View File

@ -47,7 +47,6 @@
../gs-entbase/server/env_beverage.cpp
../gs-entbase/server/env_global.cpp
../gs-entbase/server/item_food.cpp
../gs-entbase/server/item_suit.cpp
../gs-entbase/server/path_corner.cpp
../gs-entbase/server/path_track.cpp
../gs-entbase/server/multi_manager.cpp

View File

@ -177,13 +177,11 @@ void func_door::Trigger(void)
}
if ((m_iState == DOORSTATE_UP) || (m_iState == DOORSTATE_RAISED)){
dprint("func_door: Going back!\n");
MoveBack();
return;
}
MoveAway();
dprint("func_door: Going away!\n");
}
void func_door::Touch(void)

View File

@ -1,28 +0,0 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class item_suit:CBaseTrigger
{
void() item_suit;
virtual void() touch;
};
void item_suit::touch(void)
{
Trigger();
Hide();
}
void item_suit::item_suit(void)
{
CBaseTrigger::CBaseTrigger();
precache_model("models/w_kevlar.mdl");
setmodel( self, "models/w_kevlar.mdl");
InitPointTrigger();
}

View File

@ -8,7 +8,7 @@
void Flashlight_Toggle(void)
{
if (cvar("sv_clientslots") != 1) {
if (cvar("sv_playerslots") != 1) {
if (cvar("mp_flashlight") != 1) {
return;
}

View File

@ -43,8 +43,12 @@ valve/spectator.c
../shared/valve/w_satchel.c
../shared/valve/w_snark.c
valve/items.cpp
valve/item_longjump.cpp
valve/item_suit.cpp
valve/item_healthkit.cpp
valve/ammo.cpp
../shared/valve/weapons.c
../shared/valve/weapon_common.c
spawn.c

View File

@ -43,12 +43,16 @@ valve/spectator.c
../shared/valve/w_tripmine.c
../shared/valve/w_satchel.c
../shared/valve/w_snark.c
valve/items.cpp
valve/ammo.cpp
../shared/scihunt/w_cannon.c
../shared/scihunt/w_chainsaw.c
../shared/scihunt/w_hammer.c
valve/items.cpp
valve/ammo.cpp
valve/item_longjump.cpp
valve/item_suit.cpp
valve/item_healthkit.cpp
../shared/scihunt/weapons.c
../shared/valve/weapon_common.c
scihunt/shdata_parse.c
spawn.c

View File

@ -219,7 +219,7 @@ string sci_sndscream[] = {
"scientist/evergetout.wav",
"scientist/scream8.wav",
"scientist/scream9.wav",
"scientist/scream10.wav"
"scientist/scream10.wav",
"scientist/scream11.wav",
"scientist/getoutalive.wav",
"scientist/scream12.wav",

View File

@ -12,8 +12,6 @@ var int autocvar_sh_sciyaw = TRUE;
/* Limit the amount of scientists spawned */
var int autocvar_sh_scimax = 30;
string g_shItemList;
void SHData_SpawnScientist(void)
{
static int slimit = 0;

View File

@ -43,8 +43,12 @@ valve/spectator.c
../shared/valve/w_satchel.c
../shared/valve/w_snark.c
valve/items.cpp
valve/item_longjump.cpp
valve/item_suit.cpp
valve/item_healthkit.cpp
valve/ammo.cpp
../shared/valve/weapons.c
../shared/valve/weapon_common.c
spawn.c

View File

@ -32,16 +32,18 @@ void item_ammo::Respawn(void)
{
solid = SOLID_TRIGGER;
movetype = MOVETYPE_TOSS;
setsize(this, [-24,-24,-16], [24,24,16]);
setorigin(this, origin);
if (m_oldModel) {
setmodel(this, m_oldModel);
}
setsize(this, [-8,-8,0], [8,8,48]);
setorigin(this, origin);
think = __NULL__;
nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
droptofloor();
}
void item_ammo::item_ammo(void)

View File

@ -52,8 +52,9 @@ void Damage_Apply(entity eTarget, entity eAttacker, float fDamage, vector vHitPo
eTarget.armor -= flArmor;
}
fDamage = flNewDamage;
}
}
fDamage = rint(fDamage);
eTarget.health -= fDamage;
eTarget.dmg_take = fDamage;
eTarget.dmg_inflictor = eAttacker;
@ -97,35 +98,28 @@ from a plain geographical standpoint
*/
float Damage_CheckAttack(entity eTarget, vector vAttackPos)
{
if (eTarget.movetype == MOVETYPE_PUSH) {
traceline(vAttackPos, 0.5 * (eTarget.absmin + eTarget.absmax), TRUE, self);
if (trace_fraction == 1) {
return TRUE;
}
if (trace_ent == eTarget) {
return TRUE;
}
return FALSE;
/* We're lazy. Who cares */
if (eTarget.solid == SOLID_BSP) {
return TRUE;
}
traceline(vAttackPos, eTarget.origin, TRUE, self);
if (trace_fraction == 1) {
return TRUE;
}
traceline(vAttackPos, eTarget.origin + '15 15 0', TRUE, self);
traceline(vAttackPos, eTarget.origin + [15,15,0], TRUE, self);
if (trace_fraction == 1) {
return TRUE;
}
traceline(vAttackPos, eTarget.origin + '-15 -15 0', TRUE, self);
traceline(vAttackPos, eTarget.origin + [-15,-15,0], TRUE, self);
if (trace_fraction == 1) {
return TRUE;
}
traceline(vAttackPos, eTarget.origin + '-15 15 0', TRUE, self);
traceline(vAttackPos, eTarget.origin + [-15,15,0], TRUE, self);
if (trace_fraction == 1) {
return TRUE;
}
traceline(vAttackPos, eTarget.origin + '15 -15 0', TRUE, self);
traceline(vAttackPos, eTarget.origin + [15,-15,0], TRUE, self);
if (trace_fraction == 1) {
return TRUE;
}
@ -140,33 +134,33 @@ Damage_Radius
Even more pain and suffering, mostly used for explosives
=================
*/
void Damage_Radius(vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip)
void Damage_Radius(vector org, entity eAttacker, float fDamage, float fRadius, int iCheckClip)
{
for (entity eDChain = world; (eDChain = findfloat(eDChain, takedamage, DAMAGE_YES));) {
for (entity c = world; (c = findfloat(c, takedamage, DAMAGE_YES));) {
vector vecRealPos;
vecRealPos[0] = eDChain.absmin[0] + (0.5 * (eDChain.absmax[0] - eDChain.absmin[0]));
vecRealPos[1] = eDChain.absmin[1] + (0.5 * (eDChain.absmax[1] - eDChain.absmin[1]));
vecRealPos[2] = eDChain.absmin[2] + (0.5 * (eDChain.absmax[2] - eDChain.absmin[2]));
vecRealPos[0] = c.absmin[0] + (0.5 * (c.absmax[0] - c.absmin[0]));
vecRealPos[1] = c.absmin[1] + (0.5 * (c.absmax[1] - c.absmin[1]));
vecRealPos[2] = c.absmin[2] + (0.5 * (c.absmax[2] - c.absmin[2]));
float fDist = vlen(vOrigin - vecRealPos);
float fDist = vlen(org - vecRealPos);
//vector vPush;
if (fDist > fRadius) {
continue;
}
if (Damage_CheckAttack(eDChain, vOrigin) || iCheckClip == FALSE) {
float fDiff = vlen(vOrigin - vecRealPos);
if (Damage_CheckAttack(c, org) || iCheckClip == FALSE) {
float fDiff = vlen(org - vecRealPos);
fDiff = (fRadius - fDiff) / fRadius;
fDamage = rint(fDamage * fDiff);
if (fDiff > 0) {
Damage_Apply(eDChain, eAttacker, fDamage, vecRealPos, 0);
/*if (eDChain.movetype != MOVETYPE_NONE) {
vPush = vectoangles(vecRealPos - vOrigin);
Damage_Apply(c, eAttacker, fDamage, vecRealPos, 0);
/*if (c.movetype != MOVETYPE_NONE) {
vPush = vectoangles(vecRealPos - org);
makevectors(vPush);
eDChain.velocity += (v_forward * fDamage * 5) + (v_up * fDamage * 2.5);
c.velocity += (v_forward * fDamage * 5) + (v_up * fDamage * 2.5);
}*/
}

View File

@ -0,0 +1,12 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class item_healthkit:CBaseEntity
{
};

View File

@ -0,0 +1,61 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class item_longjump:CBaseTrigger
{
void() item_longjump;
virtual void() touch;
virtual void() Respawn;
};
void item_longjump::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.g_items & ITEM_LONGJUMP) {
return;
}
sound(other, CHAN_ITEM, "fvox/blip.wav", 1, ATTN_NORM);
sound(other, CHAN_VOICE, "fvox/powermove_on.wav", 1, ATTN_NORM);
pl.g_items |= ITEM_LONGJUMP;
CBaseTrigger::UseTargets();
if (cvar("sv_playerslots") == 1) {
remove(self);
} else {
Hide();
think = Respawn;
nextthink = time + 30.0f;
}
}
}
void item_longjump::Respawn(void)
{
solid = SOLID_TRIGGER;
movetype = MOVETYPE_TOSS;
setsize(this, VEC_HULL_MIN, VEC_HULL_MAX);
setorigin(this, m_oldOrigin);
setmodel(this, m_oldModel);
think = __NULL__;
nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
}
void item_longjump::item_longjump(void)
{
model = "models/w_longjump.mdl";
precache_sound("items/suitchargeok1.wav");
precache_sound("fvox/powermove_on.wav");
precache_sound("fvox/blip.wav");
CBaseTrigger::CBaseTrigger();
Respawn();
}

View File

@ -0,0 +1,61 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class item_suit:CBaseTrigger
{
void() item_suit;
virtual void() touch;
virtual void() Respawn;
};
void item_suit::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.g_items & ITEM_SUIT) {
return;
}
sound(other, CHAN_ITEM, "fvox/bell.wav", 1, ATTN_NORM);
sound(other, CHAN_VOICE, "fvox/hev_logon.wav", 1, ATTN_NORM);
pl.g_items |= ITEM_SUIT;
CBaseTrigger::UseTargets();
if (cvar("sv_playerslots") == 1) {
remove(self);
} else {
Hide();
think = Respawn;
nextthink = time + 30.0f;
}
}
}
void item_suit::Respawn(void)
{
solid = SOLID_TRIGGER;
movetype = MOVETYPE_TOSS;
setsize(this, VEC_HULL_MIN, VEC_HULL_MAX);
setorigin(this, m_oldOrigin);
setmodel(this, m_oldModel);
think = __NULL__;
nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
}
void item_suit::item_suit(void)
{
model = "models/w_suit.mdl";
precache_sound("items/suitchargeok1.wav");
precache_sound("fvox/hev_logon.wav");
precache_sound("fvox/bell.wav");
CBaseTrigger::CBaseTrigger();
Respawn();
}

View File

@ -47,17 +47,19 @@ void item_pickup::Respawn(void)
{
solid = SOLID_TRIGGER;
movetype = MOVETYPE_TOSS;
setsize(this, [-24,-24,-16], [24,24,16]);
setorigin(this, origin);
setorigin(this, m_oldOrigin);
/* At some points, the item id might not yet be set */
if (m_oldModel) {
setmodel(this, m_oldModel);
}
setsize(this, [-24,-24,0], [24,24,48]);
think = __NULL__;
nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
droptofloor();
}
void item_pickup::item_pickup(void)

View File

@ -71,6 +71,19 @@ void Decals_PlaceBig(vector pos)
#endif
}
void Decals_PlaceGlass(vector pos)
{
#ifdef CSQC
// TODO
#else
entity decal = Decals_Next(pos);
setorigin(decal, pos);
decal.texture = sprintf("{break%d", floor(random(1,4)));
decal.think = infodecal;
decal.nextthink = time /*+ 0.1f*/;
#endif
}
void Decals_PlaceScorch(vector pos)
{
#ifdef CSQC
@ -89,13 +102,23 @@ void Decals_PlaceScorch(vector pos)
const string g_decalshader = \
"{\n" \
"polygonOffset\n" \
"{\n"\
"{\n" \
"clampmap %s\n" \
"rgbgen vertex\n" \
"blendfunc GL_ZERO GL_SRC_COLOR\n" \
"}\n" \
"}";
const string g_decalshader_add = \
"{\n" \
"polygonOffset\n" \
"{\n" \
"clampmap %s\n" \
"rgbgen vertex\n" \
"blendfunc add\n" \
"}\n" \
"}";
float Decal_PreDraw(void)
{
adddecal(self.classname, self.origin, self.mins, self.maxs, self.color, 1.0f);
@ -124,6 +147,7 @@ void Decal_Parse(void)
self.color[0] = (g_decalwad[i].color[0] / 255);
self.color[1] = (g_decalwad[i].color[1] / 255);
self.color[2] = (g_decalwad[i].color[2] / 255);
self.style = g_decalwad[i].flags;
break;
}
}
@ -132,11 +156,16 @@ void Decal_Parse(void)
if (serverkeyfloat("*bspversion") == 30) {
decalname = sprintf("decal_%s", self.classname);
decalshader = sprintf(g_decalshader, self.classname);
if (self.style & DFLAG_ADDITIVE) {
decalshader = sprintf(g_decalshader_add, self.classname);
} else {
decalshader = sprintf(g_decalshader, self.classname);
}
shaderforname(decalname, decalshader);
self.classname = decalname;
}
makevectors(self.angles);
float surf = getsurfacenearpoint(world, self.origin);
vector s_dir = getsurfacepointattribute(world, surf, 0, SPA_S_AXIS);

View File

@ -13,6 +13,11 @@ typedef struct
int flags;
} decal_t;
enumflags
{
DFLAG_ADDITIVE
};
#define COLOR_REDBLOOD [114,25,7]
#define COLOR_YELLOWBLOOD [248,224,122]
@ -20,6 +25,10 @@ decal_t g_decalwad[] =
{
{ "{bigblood1", COLOR_REDBLOOD, 0 },
{ "{bigblood2", COLOR_REDBLOOD, 0 },
{ "{bproof1", [255,255,255], DFLAG_ADDITIVE },
{ "{break1", [255,255,255], DFLAG_ADDITIVE },
{ "{break2", [255,255,255], DFLAG_ADDITIVE },
{ "{break3", [255,255,255], DFLAG_ADDITIVE },
{ "{blood1", COLOR_REDBLOOD, 0 },
{ "{blood2", COLOR_REDBLOOD, 0 },
{ "{blood3", COLOR_REDBLOOD, 0 },

View File

@ -266,6 +266,9 @@ void Effect_Impact(int iType, vector vPos, vector vNormal) {
multicast(vPos, MULTICAST_PVS);
switch (iType) {
case IMPACT_GLASS:
Decals_PlaceGlass(vPos);
break;
case IMPACT_MELEE:
Decals_PlaceSmall(vPos);
break;

View File

@ -671,7 +671,7 @@ void PMove_Run(void)
self.maxspeed = (self.flags & FL_CROUCHING) ? 135 : 270;
if (input_buttons & INPUT_BUTTON5) {
input_movevalues *= 0.50;
input_movevalues *= 0.25;
}
#endif
PMove_WaterMove();

View File

@ -6,10 +6,6 @@
*
****/
#ifdef SSQC
void Decals_Init(void);
#endif
weapon_t w_null = {};
weapon_t g_weapons[] = {
w_null,
@ -31,220 +27,3 @@ weapon_t g_weapons[] = {
w_tripmine,
w_snark
};
void Weapons_Init(void)
{
for (int i = 0; i < g_weapons.length; i++) {
if (g_weapons[i].precache != __NULL__) {
g_weapons[i].precache();
}
}
}
void Weapons_Draw(void)
{
player pl = (player)self;
int i = pl.activeweapon;
pl.w_attack_next = Math_Time() + 0.5f;
pl.w_idle_next = Math_Time() + 2.5f;
if (g_weapons[i].draw != __NULL__) {
g_weapons[i].draw();
}
}
void Weapons_Holster(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].holster != __NULL__) {
g_weapons[i].holster();
}
}
void Weapons_Primary(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].primary != __NULL__) {
g_weapons[i].primary();
}
}
void Weapons_Secondary(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].secondary != __NULL__) {
g_weapons[i].secondary();
}
}
void Weapons_Reload(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].reload != __NULL__) {
g_weapons[i].reload();
}
}
void Weapons_Release(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].release != __NULL__) {
g_weapons[i].release();
}
}
void Weapons_DrawCrosshair(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].crosshair != __NULL__) {
g_weapons[i].crosshair();
}
}
string Weapons_GetViewmodel(int id)
{
if (g_weapons[id].vmodel != __NULL__) {
return g_weapons[id].vmodel();
}
return "";
}
string Weapons_GetWorldmodel(int id)
{
if (g_weapons[id].wmodel != __NULL__) {
return g_weapons[id].wmodel();
}
return "";
}
string Weapons_GetPlayermodel(int id)
{
if (g_weapons[id].pmodel != __NULL__) {
return g_weapons[id].pmodel();
}
return "";
}
string Weapons_GetDeathmessage(int id)
{
if (g_weapons[id].deathmsg != __NULL__) {
return g_weapons[id].deathmsg();
}
return "";
}
#ifdef CSQC
void Weapons_HUDPic(int id, int s, vector pos)
{
if (g_weapons[id].hudpic != __NULL__) {
g_weapons[id].hudpic(s, pos);
}
}
#endif
void Weapons_MakeVectors(void)
{
#ifdef SSQC
player pl = (player)self;
makevectors(pl.v_angle);
#else
makevectors(view_angles);
#endif
}
void Weapons_ViewAnimation(int i)
{
#ifdef CSQC
View_PlayAnimation(i);
#else
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
WriteByte( MSG_MULTICAST, EV_VIEWMODEL );
WriteByte( MSG_MULTICAST, i );
msg_entity = self;
multicast( [0,0,0], MULTICAST_ONE );
#endif
}
void Weapons_ViewPunchAngle(vector add)
{
#ifdef CSQC
View_AddPunchAngle(add);
#endif
}
void Weapons_PlaySound(entity t, float ch, string s, float vol, float at)
{
#ifdef SSQC
sound(t, ch, s, vol, at);
#endif
}
int Weapons_IsPresent(player pl, int w)
{
if (pl.g_items & g_weapons[w].id) {
return TRUE;
} else {
return FALSE;
}
}
#ifdef SSQC
void Weapons_AddItem(player pl, int w)
{
entity oldself = self;
self = pl;
pl.g_items |= g_weapons[w].id;
pl.activeweapon = w;
if (g_weapons[w].pickup != __NULL__) {
g_weapons[w].pickup();
}
Weapons_Draw();
self = oldself;
}
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)
{
/* 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;
}
}
#endif

View File

@ -87,7 +87,7 @@ void w_mp5_primary(void)
Weapons_ViewPunchAngle([random(-2, 2),0,0]);
#else
/* Singleplayer is more accurate */
if (cvar("sv_clientslots") == 1) {
if (cvar("sv_playerslots") == 1) {
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.02618,0.02618]);
} else {
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.05234,0.05234]);

View File

@ -72,7 +72,7 @@ void w_shotgun_primary(void)
#ifdef SSQC
/* Singleplayer is more accurate */
if (cvar("sv_clientslots") == 1) {
if (cvar("sv_playerslots") == 1) {
TraceAttack_FireBullets(6, pl.origin + pl.view_ofs, 5, [0.08716,0.08716]);
} else {
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, 5, [0.08716,0.04362]);
@ -91,7 +91,7 @@ void w_shotgun_secondary(void)
#ifdef SSQC
/* Singleplayer is more accurate */
if (cvar("sv_clientslots") == 1) {
if (cvar("sv_playerslots") == 1) {
TraceAttack_FireBullets(12, pl.origin + pl.view_ofs, 5, [0.08716,0.08716]);
} else {
TraceAttack_FireBullets(8, pl.origin + pl.view_ofs, 5, [0.17365,0.04362]);

View File

@ -26,11 +26,11 @@ void w_tripmine_precache(void)
}
string w_tripmine_vmodel(void)
{
return "models/w_tripmine.mdl";
return "models/v_tripmine.mdl";
}
string w_tripmine_wmodel(void)
{
return "models/w_tripmine.mdl";
return "models/v_tripmine.mdl";
}
string w_tripmine_pmodel(void)
{

View File

@ -0,0 +1,228 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
#ifdef SSQC
void Decals_Init(void);
#endif
void Weapons_Init(void)
{
for (int i = 0; i < g_weapons.length; i++) {
if (g_weapons[i].precache != __NULL__) {
g_weapons[i].precache();
}
}
}
void Weapons_Draw(void)
{
player pl = (player)self;
int i = pl.activeweapon;
pl.w_attack_next = Math_Time() + 0.5f;
pl.w_idle_next = Math_Time() + 2.5f;
if (g_weapons[i].draw != __NULL__) {
g_weapons[i].draw();
}
}
void Weapons_Holster(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].holster != __NULL__) {
g_weapons[i].holster();
}
}
void Weapons_Primary(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].primary != __NULL__) {
g_weapons[i].primary();
}
}
void Weapons_Secondary(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].secondary != __NULL__) {
g_weapons[i].secondary();
}
}
void Weapons_Reload(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].reload != __NULL__) {
g_weapons[i].reload();
}
}
void Weapons_Release(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].release != __NULL__) {
g_weapons[i].release();
}
}
void Weapons_DrawCrosshair(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].crosshair != __NULL__) {
g_weapons[i].crosshair();
}
}
string Weapons_GetViewmodel(int id)
{
if (g_weapons[id].vmodel != __NULL__) {
return g_weapons[id].vmodel();
}
return "";
}
string Weapons_GetWorldmodel(int id)
{
if (g_weapons[id].wmodel != __NULL__) {
return g_weapons[id].wmodel();
}
return "";
}
string Weapons_GetPlayermodel(int id)
{
if (g_weapons[id].pmodel != __NULL__) {
return g_weapons[id].pmodel();
}
return "";
}
string Weapons_GetDeathmessage(int id)
{
if (g_weapons[id].deathmsg != __NULL__) {
return g_weapons[id].deathmsg();
}
return "";
}
#ifdef CSQC
void Weapons_HUDPic(int id, int s, vector pos)
{
if (g_weapons[id].hudpic != __NULL__) {
g_weapons[id].hudpic(s, pos);
}
}
#endif
void Weapons_MakeVectors(void)
{
#ifdef SSQC
player pl = (player)self;
makevectors(pl.v_angle);
#else
makevectors(view_angles);
#endif
}
void Weapons_ViewAnimation(int i)
{
#ifdef CSQC
View_PlayAnimation(i);
#else
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
WriteByte( MSG_MULTICAST, EV_VIEWMODEL );
WriteByte( MSG_MULTICAST, i );
msg_entity = self;
multicast( [0,0,0], MULTICAST_ONE );
#endif
}
void Weapons_ViewPunchAngle(vector add)
{
#ifdef CSQC
View_AddPunchAngle(add);
#endif
}
void Weapons_PlaySound(entity t, float ch, string s, float vol, float at)
{
#ifdef SSQC
sound(t, ch, s, vol, at);
#endif
}
int Weapons_IsPresent(player pl, int w)
{
if (pl.g_items & g_weapons[w].id) {
return TRUE;
} else {
return FALSE;
}
}
#ifdef SSQC
void Weapons_AddItem(player pl, int w)
{
entity oldself = self;
self = pl;
pl.g_items |= g_weapons[w].id;
pl.activeweapon = w;
if (g_weapons[w].pickup != __NULL__) {
g_weapons[w].pickup();
}
Weapons_Draw();
self = oldself;
}
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)
{
/* 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;
}
}
#endif

View File

@ -6,10 +6,6 @@
*
****/
#ifdef SSQC
void Decals_Init(void);
#endif
weapon_t w_null = {};
weapon_t g_weapons[] = {
w_null,
@ -28,220 +24,3 @@ weapon_t g_weapons[] = {
w_tripmine,
w_snark
};
void Weapons_Init(void)
{
for (int i = 0; i < g_weapons.length; i++) {
if (g_weapons[i].precache != __NULL__) {
g_weapons[i].precache();
}
}
}
void Weapons_Draw(void)
{
player pl = (player)self;
int i = pl.activeweapon;
pl.w_attack_next = Math_Time() + 0.5f;
pl.w_idle_next = Math_Time() + 2.5f;
if (g_weapons[i].draw != __NULL__) {
g_weapons[i].draw();
}
}
void Weapons_Holster(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].holster != __NULL__) {
g_weapons[i].holster();
}
}
void Weapons_Primary(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].primary != __NULL__) {
g_weapons[i].primary();
}
}
void Weapons_Secondary(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].secondary != __NULL__) {
g_weapons[i].secondary();
}
}
void Weapons_Reload(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].reload != __NULL__) {
g_weapons[i].reload();
}
}
void Weapons_Release(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].release != __NULL__) {
g_weapons[i].release();
}
}
void Weapons_DrawCrosshair(void)
{
player pl = (player)self;
int i = pl.activeweapon;
if (g_weapons[i].crosshair != __NULL__) {
g_weapons[i].crosshair();
}
}
string Weapons_GetViewmodel(int id)
{
if (g_weapons[id].vmodel != __NULL__) {
return g_weapons[id].vmodel();
}
return "";
}
string Weapons_GetWorldmodel(int id)
{
if (g_weapons[id].wmodel != __NULL__) {
return g_weapons[id].wmodel();
}
return "";
}
string Weapons_GetPlayermodel(int id)
{
if (g_weapons[id].pmodel != __NULL__) {
return g_weapons[id].pmodel();
}
return "";
}
string Weapons_GetDeathmessage(int id)
{
if (g_weapons[id].deathmsg != __NULL__) {
return g_weapons[id].deathmsg();
}
return "";
}
#ifdef CSQC
void Weapons_HUDPic(int id, int s, vector pos)
{
if (g_weapons[id].hudpic != __NULL__) {
g_weapons[id].hudpic(s, pos);
}
}
#endif
void Weapons_MakeVectors(void)
{
#ifdef SSQC
player pl = (player)self;
makevectors(pl.v_angle);
#else
makevectors(view_angles);
#endif
}
void Weapons_ViewAnimation(int i)
{
#ifdef CSQC
View_PlayAnimation(i);
#else
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
WriteByte( MSG_MULTICAST, EV_VIEWMODEL );
WriteByte( MSG_MULTICAST, i );
msg_entity = self;
multicast( [0,0,0], MULTICAST_ONE );
#endif
}
void Weapons_ViewPunchAngle(vector add)
{
#ifdef CSQC
View_AddPunchAngle(add);
#endif
}
void Weapons_PlaySound(entity t, float ch, string s, float vol, float at)
{
#ifdef SSQC
sound(t, ch, s, vol, at);
#endif
}
int Weapons_IsPresent(player pl, int w)
{
if (pl.g_items & g_weapons[w].id) {
return TRUE;
} else {
return FALSE;
}
}
#ifdef SSQC
void Weapons_AddItem(player pl, int w)
{
entity oldself = self;
self = pl;
pl.g_items |= g_weapons[w].id;
pl.activeweapon = w;
if (g_weapons[w].pickup != __NULL__) {
g_weapons[w].pickup();
}
Weapons_Draw();
self = oldself;
}
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)
{
/* 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;
}
}
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
valve/data.pk3dir/gfx.wad Normal file → Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.