Fix damage overlay for splitscreen games

Starting to mess with decal colours. DO NOT TOUCH. This is awaiting engine fixes potentially.
This commit is contained in:
Marco Cawthorne 2019-03-12 01:22:50 +01:00
parent 515ff8e2ad
commit 9d869d5c0a
46 changed files with 585 additions and 104 deletions

View File

@ -9,6 +9,7 @@
#define CHAT_LINES 5
#define CHAT_TIME 5
var int g_chatpos[2];
var float g_chattime;
var int g_chatlines = -1;
string g_chatbuffer[CHAT_LINES];
@ -22,15 +23,17 @@ Just prints whatever is in the chat buffer and removes lines after some time.
*/
void Chat_Draw(void)
{
vector pos = video_mins + [16, video_res_y - 128];
int i;
g_chatpos[0] = video_mins[0] + 16;
g_chatpos[1] = video_mins[1] + video_res[1] - 128;
if (g_chatlines < 0) {
return;
}
// Remove messages after a g_chattime has passed
/* Remove messages after a g_chattime has passed */
if (g_chattime < time) {
for (int i = 0; i < g_chatlines; i++) {
for (i = 0; i < g_chatlines; i++) {
if (g_chatbuffer[i+1] != __NULL__) {
g_chatbuffer[i] = g_chatbuffer[i+1];
} else {
@ -42,9 +45,9 @@ void Chat_Draw(void)
g_chattime = time + CHAT_TIME;
}
for (int i = 0; i < CHAT_LINES; i++) {
drawstring(pos, g_chatbuffer[i], [12,12], [1,1,1], 1.0f, 0);
pos_y += 14;
for (i = 0; i < CHAT_LINES; i++) {
drawstring([g_chatpos[0],g_chatpos[1]], g_chatbuffer[i], [12,12], [1,1,1], 1.0f, 0);
g_chatpos[1] += 14;
}
}
@ -61,5 +64,5 @@ void Chat_Parse(string msg)
}
g_chattime = time + CHAT_TIME;
sound(pSeat->ePlayer, CHAN_ITEM, "misc/talk.wav", 1.0, ATTN_NONE);
localsound("misc/talk.wav");
}

View File

@ -71,6 +71,8 @@ struct
float fLastWeapon;
float fBobTime;
float fBob;
float damage_alpha;
vector damage_pos;
//Player fields
entity ePlayer;

View File

@ -6,49 +6,50 @@
*
****/
var float g_flDamageAlpha;
var vector g_vecDamageLocation;
void Damage_Draw(void)
{
float fForward;
float fRight;
vector vecMiddle;
if (g_flDamageAlpha <= 0.0) {
if (pSeat->damage_alpha <= 0.0) {
return;
}
vecMiddle = (video_res / 2);
vecMiddle = video_mins + (video_res / 2);
makevectors(getproperty(VF_CL_VIEWANGLES));
vector location = normalize(g_vecDamageLocation - getproperty(VF_ORIGIN));
vector location = normalize(pSeat->damage_pos - getproperty(VF_ORIGIN));
fForward = dotproduct(location, v_forward);
fRight = dotproduct(location, v_right);
if (fForward > 0.25) {
drawpic(vecMiddle + [-64,-70 - 32], "sprites/640_pain.spr_0.tga",
[128,48], [1,1,1], fabs(fForward) * g_flDamageAlpha, DRAWFLAG_ADDITIVE);
[128,48], [1,1,1], fabs(fForward) * pSeat->damage_alpha, DRAWFLAG_ADDITIVE);
} else if (fForward < -0.25) {
drawpic(vecMiddle + [-64,70], "sprites/640_pain.spr_2.tga",
[128,48], [1,1,1], fabs(fForward) * g_flDamageAlpha, DRAWFLAG_ADDITIVE);
[128,48], [1,1,1], fabs(fForward) * pSeat->damage_alpha, DRAWFLAG_ADDITIVE);
}
if (fRight > 0.25) {
drawpic(vecMiddle + [70,-64], "sprites/640_pain.spr_1.tga",
[48,128], [1,1,1], fabs(fRight) * g_flDamageAlpha, DRAWFLAG_ADDITIVE);
[48,128], [1,1,1], fabs(fRight) * pSeat->damage_alpha, DRAWFLAG_ADDITIVE);
} else if (fRight < -0.25) {
drawpic(vecMiddle + [-70 - 32,-64], "sprites/640_pain.spr_3.tga",
[48,128], [1,1,1], fabs(fRight) * g_flDamageAlpha, DRAWFLAG_ADDITIVE);
[48,128], [1,1,1], fabs(fRight) * pSeat->damage_alpha, DRAWFLAG_ADDITIVE);
}
g_flDamageAlpha -= frametime;
pSeat->damage_alpha -= frametime;
}
float CSQC_Parse_Damage(float save, float take, vector org)
{
int s = (float)getproperty(VF_ACTIVESEAT);
pSeat = &seats[s];
if (org) {
g_vecDamageLocation = org;
g_flDamageAlpha = 1.0f;
pSeat->damage_pos = org;
pSeat->damage_alpha = 1.0f;
}
sound(self, CHAN_VOICE, "player/pl_pain2.wav", 1, ATTN_NORM);
//sound(pSeat->ePlayer, CHAN_VOICE, "player/pl_pain2.wav", 1, ATTN_NORM);
return TRUE;
}

View File

@ -13,49 +13,25 @@ CSQC_Ent_Update
Called whenever an entity is sent manually via .SendFlags and so on
=================
*/
void CSQC_Ent_Update(float flIsNew)
void CSQC_Ent_Update(float new)
{
float fEntType = readbyte();
if ( fEntType == ENT_PLAYER ) {
Player_ReadEntity(flIsNew);
} else if ( fEntType == ENT_SPRITE ) {
float t;
t = readbyte();
switch (t) {
case ENT_PLAYER:
Player_ReadEntity(new);
break;
case ENT_SPRITE:
Sprite_Animated();
} else if ( fEntType == ENT_SPRAY ) {
break;
case ENT_SPRAY:
Spraylogo_Parse();
} else if ( fEntType == ENT_DECAL ) {
string decalname = "";
string decalshader = "";
self.origin[0] = readcoord();
self.origin[1] = readcoord();
self.origin[2] = readcoord();
self.angles[0] = readcoord();
self.angles[1] = readcoord();
self.angles[2] = readcoord();
self.color[0] = 1.0f - ( readbyte() / 255 );
self.color[1] = 1.0f - ( readbyte() / 255 );
self.color[2] = 1.0f - ( readbyte() / 255 );
self.classname = readstring();
self.size = drawgetimagesize(self.classname);
if (serverkeyfloat("*bspversion") == 30) {
decalname = sprintf("decal_%s", self.classname);
decalshader = sprintf("{\npolygonOffset\n{\nclampmap %s\nblendFunc filter\n}\n}", 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);
vector t_dir = getsurfacepointattribute(world, surf, 0, SPA_T_AXIS);
self.mins = v_up / self.size[0];
self.maxs = t_dir / self.size[1];
self.predraw = Effect_Decal;
self.drawmask = MASK_ENGINE;
break;
case ENT_DECAL:
Decal_Parse();
break;
default:
error("Unknown entity type update received.\n");
}
}

View File

@ -168,7 +168,7 @@ void CSQC_UpdateView(float w, float h, float focus)
// TODO: Move this someplace less... entry-ish. like into a pre-draw.
if (pl.flags & FL_FLASHLIGHT) {
traceline(getproperty(VF_ORIGIN), getproperty(VF_ORIGIN) + (v_forward * 9000), FALSE, self);
dynamiclight_add(trace_endpos, 128, [1,1,1]);
dynamiclight_add(trace_endpos + (v_forward * -2), 128, [1,1,1]);
}
addentities(MASK_ENGINE);
@ -424,7 +424,8 @@ void CSQC_Parse_Event(void)
vSize[2] = readcoord();
float fStyle = readbyte();
Effect_BreakModel(vPos, vSize, [0,0,0], fStyle);
int count = readbyte();
Effect_BreakModel(count, vPos, vSize, [0,0,0], fStyle);
break;
case EV_CAMERATRIGGER:
pSeat->vCameraPos.x = readcoord();

View File

@ -19,6 +19,8 @@ struct
float fLastWeapon;
float fBobTime;
float fBob;
float damage_alpha;
vector damage_pos;
//Player fields
entity ePlayer;

View File

@ -43,7 +43,7 @@ void CBaseEntity :: CBaseEntity ( void )
return;
}
}
/*m_renderamt = 255;
m_rendercolor = [1,1,1];
m_rendermode = 0;*/

View File

@ -20,7 +20,7 @@ enumflags
};
void Effect_CreateSpark(vector pos, vector ang);
void Effect_BreakModel(vector mins, vector maxs,vector vel, float mat);
void Effect_BreakModel(int count, vector mins, vector maxs,vector vel, float mat);
string Util_FixModel(string mdl)
{

View File

@ -80,7 +80,9 @@ void func_breakable::vDeath (entity attacker, int type, int damage)
return;
}
health = 0;
Effect_BreakModel(absmin, absmax, '0 0 0', m_iMaterial);
print(sprintf("BREAK: %v [x] %v [=] %d\n", mins, maxs, vlen(mins - maxs)));
Effect_BreakModel(20, absmin, absmax, '0 0 0', m_iMaterial);
if (m_flExplodeMag) {
vector vWorldPos;

View File

@ -26,11 +26,7 @@ float infodecal_send(entity pvsent, float cflags)
WriteCoord(MSG_ENTITY, self.angles[0]);
WriteCoord(MSG_ENTITY, self.angles[1]);
WriteCoord(MSG_ENTITY, self.angles[2]);
/* Figure this thing out */
WriteByte(MSG_ENTITY, 255);
WriteByte(MSG_ENTITY, 0);
WriteByte(MSG_ENTITY, 0);
WriteString(MSG_ENTITY, self.texture );
WriteString(MSG_ENTITY, self.texture);
return TRUE;
}
@ -63,6 +59,9 @@ void infodecal(void)
return;
}
/* Some maps have everything set to full-on uppercase */
self.texture = strtolower(self.texture);
/*self.origin[0] = rint(self.origin[0]);
self.origin[1] = rint(self.origin[1]);
self.origin[2] = rint(self.origin[2]);*/

View File

@ -14,7 +14,7 @@ void Effect_Impact( int iType, vector vPos, vector vNormal );
void Effect_CreateExplosion( vector vPos );
void Effect_GibHuman( vector vPos);
void Footsteps_Update( void );
void Vox_Broadcast(string sMessage);
void TraceAttack_FireBullets( int iShots, vector vPos, int iDamage, vector vecAccuracy);
void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip );
void Damage_Apply( entity eTarget, entity eAttacker, float fDamage, vector vHitPos, int iSkipArmor );

View File

@ -43,6 +43,7 @@ valve/spectator.c
../shared/valve/w_satchel.c
../shared/valve/w_snark.c
valve/items.cpp
valve/ammo.cpp
../shared/valve/weapons.c
spawn.c

View File

@ -44,6 +44,7 @@ valve/spectator.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

View File

@ -297,8 +297,6 @@ class monster_scientist:CBaseEntity
virtual void() WarnOthers;
};
void monster_scientist::Gib(void)
{
takedamage = DAMAGE_NO;

View File

@ -43,6 +43,7 @@ valve/spectator.c
../shared/valve/w_satchel.c
../shared/valve/w_snark.c
valve/items.cpp
valve/ammo.cpp
../shared/valve/weapons.c
spawn.c

View File

@ -0,0 +1,287 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
class item_ammo:CBaseEntity
{
void() item_ammo;
virtual void() Respawn;
virtual void() touch;
};
void item_ammo::touch(void)
{
if (other.classname == "player") {
sound(other, CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
if (cvar("sv_playerslots") == 1) {
remove(self);
} else {
Hide();
think = Respawn;
nextthink = time + 20.0f;
}
}
}
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);
}
think = __NULL__;
nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
}
void item_ammo::item_ammo(void)
{
m_oldModel = model;
setmodel(this, m_oldModel);
CBaseEntity::CBaseEntity();
item_ammo::Respawn();
}
/*
* Ammo for the .357 Magnum Revolver.
* A single ammo_357 will provide 6 bullets.
*/
class ammo_357:item_ammo
{
void() ammo_357;
virtual void() touch;
};
void ammo_357::ammo_357(void)
{
model = "models/w_357ammobox.mdl";
item_ammo::item_ammo();
}
void ammo_357::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_357 < 36) {
pl.ammo_357 = bound(0, pl.ammo_357 + 6, 36);
item_ammo::touch();
}
}
}
/*
* Ammo for the 9mm Handgun and the 9mm AR.
* A single ammo_9mmAR will provide 50 bullets.
*/
class ammo_9mmAR:item_ammo
{
void() ammo_9mmAR;
virtual void() touch;
};
void ammo_9mmAR::ammo_9mmAR(void)
{
model = "models/w_9mmarclip.mdl";
item_ammo::item_ammo();
}
void ammo_9mmAR::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_9mm < 250) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 50, 250);
item_ammo::touch();
}
}
}
/*
* Ammo for the 9mm Handgun and the 9mm AR.
* A single ammo_9mmbox will provide 200 bullets.
*/
class ammo_9mmbox:item_ammo
{
void() ammo_9mmbox;
virtual void() touch;
};
void ammo_9mmbox::ammo_9mmbox(void)
{
model = "models/w_chainammo.mdl";
item_ammo::item_ammo();
}
void ammo_9mmbox::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_9mm < 250) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 200, 250);
item_ammo::touch();
}
}
}
/*
* Ammo for the 9mm Handgun and the 9mm AR.
* A single ammo_9mmclip will provide 17 bullets.
*/
class ammo_9mmclip:item_ammo
{
void() ammo_9mmclip;
virtual void() touch;
};
void ammo_9mmclip::ammo_9mmclip(void)
{
model = "models/w_9mmclip.mdl";
item_ammo::item_ammo();
}
void ammo_9mmclip::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_9mm < 250) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 17, 250);
item_ammo::touch();
}
}
}
/*
* Ammo for the 9mm AR's secondary fire.
* A single ammo_ARgrenades will provide 2 AR grenades.
*/
class ammo_ARgrenades:item_ammo
{
void() ammo_ARgrenades;
virtual void() touch;
};
void ammo_ARgrenades::ammo_ARgrenades(void)
{
model = "models/w_argrenade.mdl";
item_ammo::item_ammo();
}
void ammo_ARgrenades::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_m203_grenade < 10) {
pl.ammo_m203_grenade = bound(0, pl.ammo_m203_grenade + 2, 10);
item_ammo::touch();
}
}
}
/*
* Ammo for the Shotgun.
* A single ammo_buckshot will provide 12 shells.
*/
class ammo_buckshot:item_ammo
{
void() ammo_buckshot;
virtual void() touch;
};
void ammo_buckshot::ammo_buckshot(void)
{
model = "models/w_shotbox.mdl";
item_ammo::item_ammo();
}
void ammo_buckshot::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_buckshot < 125) {
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 12, 125);
item_ammo::touch();
}
}
}
/*
* Ammo for the Crossbow.
* A single ammo_crossbow will provide 5 bolts.
*/
class ammo_crossbow:item_ammo
{
void() ammo_crossbow;
virtual void() touch;
};
void ammo_crossbow::ammo_crossbow(void)
{
model = "models/w_crossbow_clip.mdl";
item_ammo::item_ammo();
}
void ammo_crossbow::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_bolt < 50) {
pl.ammo_bolt = bound(0, pl.ammo_bolt + 5, 50);
item_ammo::touch();
}
}
}
/*
* Ammo for the Tau Cannon and the Gluon Gun.
* A single ammo_gaussclip will provide 20 cells.
*/
class ammo_gaussclip:item_ammo
{
void() ammo_gaussclip;
virtual void() touch;
};
void ammo_gaussclip::ammo_gaussclip(void)
{
model = "models/w_gaussammo.mdl";
item_ammo::item_ammo();
}
void ammo_gaussclip::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_uranium < 100) {
pl.ammo_uranium = bound(0, pl.ammo_uranium + 20, 100);
item_ammo::touch();
}
}
}
/*
* Ammo for the RPG.
* A single ammo_rpgclip will provide 1 rocket.
*/
class ammo_rpgclip:item_ammo
{
void() ammo_rpgclip;
virtual void() touch;
};
void ammo_rpgclip::ammo_rpgclip(void)
{
model = "models/w_rpgammo.mdl";
item_ammo::item_ammo();
}
void ammo_rpgclip::touch(void)
{
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_rocket < 5) {
pl.ammo_rocket = bound(0, pl.ammo_rocket + 1, 5);
item_ammo::touch();
}
}
}

View File

@ -6,18 +6,18 @@
*
****/
/* WEAPON ITEMS */
class itemweapon:CBaseEntity
/* PICKUP ITEMS */
class item_pickup:CBaseEntity
{
int id;
void() itemweapon;
void() item_pickup;
virtual void() touch;
virtual void(int i) setitem;
virtual void() Respawn;
};
void itemweapon::touch(void)
void item_pickup::touch(void)
{
if (other.classname == "player") {
if (Weapons_IsPresent((player)other, id) == TRUE) {
@ -36,14 +36,14 @@ void itemweapon::touch(void)
}
}
void itemweapon::setitem(int i)
void item_pickup::setitem(int i)
{
id = i;
m_oldModel = Weapons_GetWorldmodel(id);
setmodel(this, m_oldModel);
}
void itemweapon::Respawn(void)
void item_pickup::Respawn(void)
{
solid = SOLID_TRIGGER;
movetype = MOVETYPE_TOSS;
@ -60,8 +60,9 @@ void itemweapon::Respawn(void)
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150);
}
void itemweapon::itemweapon(void)
void item_pickup::item_pickup(void)
{
precache_sound("items/suitchargeok1.wav");
CBaseEntity::CBaseEntity();
Respawn();
}

View File

@ -6,6 +6,8 @@
*
****/
#include "decals.h"
#define DECALS_MAX 30
#ifdef SSQC
@ -76,17 +78,71 @@ void Decals_PlaceScorch(vector pos)
#else
entity decal = Decals_Next(pos);
setorigin(decal, pos);
decal.texture = sprintf("{scorch%d", floor(random(1,3)));
decal.texture = sprintf("{scorch%d", floor(random(1,4)));
decal.think = infodecal;
decal.nextthink = time /*+ 0.1f*/;
#endif
}
#ifdef CSQC
float Effect_Decal(void)
const string g_decalshader = \
"{\n" \
"polygonOffset\n" \
"{\n"\
"clampmap %s\n" \
"rgbgen vertex\n" \
"blendfunc GL_ZERO GL_SRC_COLOR\n" \
"}\n" \
"}";
float Decal_PreDraw(void)
{
adddecal(self.classname, self.origin, self.mins, self.maxs, self.color, 1.0f);
addentity(self);
return PREDRAW_NEXT;
}
void Decal_Parse(void)
{
string decalname = "";
string decalshader = "";
self.origin[0] = readcoord();
self.origin[1] = readcoord();
self.origin[2] = readcoord();
self.angles[0] = readcoord();
self.angles[1] = readcoord();
self.angles[2] = readcoord();
self.classname = readstring();
for (int i = 0; i < g_decalwad.length; i++) {
if (self.classname == g_decalwad[i].name) {
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);
break;
}
}
self.size = drawgetimagesize(self.classname);
if (serverkeyfloat("*bspversion") == 30) {
decalname = sprintf("decal_%s", self.classname);
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);
vector t_dir = getsurfacepointattribute(world, surf, 0, SPA_T_AXIS);
self.mins = v_up / self.size[0];
self.maxs = t_dir / self.size[1];
self.predraw = Decal_PreDraw;
self.drawmask = MASK_ENGINE;
}
#endif

60
Source/shared/decals.h Normal file
View File

@ -0,0 +1,60 @@
/***
*
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
*
* See the file LICENSE attached with the sources for usage details.
*
****/
typedef struct
{
string name;
vector color;
int flags;
} decal_t;
#define COLOR_REDBLOOD [114,25,7]
#define COLOR_YELLOWBLOOD [248,224,122]
decal_t g_decalwad[] =
{
{ "{bigblood1", COLOR_REDBLOOD, 0 },
{ "{bigblood2", COLOR_REDBLOOD, 0 },
{ "{blood1", COLOR_REDBLOOD, 0 },
{ "{blood2", COLOR_REDBLOOD, 0 },
{ "{blood3", COLOR_REDBLOOD, 0 },
{ "{blood4", COLOR_REDBLOOD, 0 },
{ "{blood5", COLOR_REDBLOOD, 0 },
{ "{blood6", COLOR_REDBLOOD, 0 },
{ "{blood7", COLOR_REDBLOOD, 0 },
{ "{blood8", COLOR_REDBLOOD, 0 },
{ "{bloodhand1", COLOR_REDBLOOD, 0 },
{ "{bloodhand2", COLOR_REDBLOOD, 0 },
{ "{bloodhand3", COLOR_REDBLOOD, 0 },
{ "{bloodhand4", COLOR_REDBLOOD, 0 },
{ "{bloodhand5", COLOR_REDBLOOD, 0 },
{ "{bloodhand6", COLOR_REDBLOOD, 0 },
{ "{hand1", COLOR_REDBLOOD, 0 },
{ "{shot1", [255,255,255], 0 },
{ "{shot2", [255,255,255], 0 },
{ "{shot3", [255,255,255], 0 },
{ "{shot4", [255,255,255], 0 },
{ "{shot5", [255,255,255], 0 },
{ "{bigshot1", [255,255,255], 0 },
{ "{bigshot2", [255,255,255], 0 },
{ "{bigshot3", [255,255,255], 0 },
{ "{bigshot4", [255,255,255], 0 },
{ "{bigshot5", [255,255,255], 0 },
{ "{bigshot6", [255,255,255], 0 },
{ "{scorch1", [255,255,255], 0 },
{ "{scorch2", [255,255,255], 0 },
{ "{scorch3", [255,255,255], 0 },
{ "{yblood1", COLOR_YELLOWBLOOD, 0 },
{ "{yblood2", COLOR_YELLOWBLOOD, 0 },
{ "{yblood3", COLOR_YELLOWBLOOD, 0 },
{ "{yblood4", COLOR_YELLOWBLOOD, 0 },
{ "{yblood5", COLOR_YELLOWBLOOD, 0 },
{ "{yblood6", COLOR_YELLOWBLOOD, 0 },
{ "{yblood7", COLOR_YELLOWBLOOD, 0 },
{ "{yblood8", COLOR_YELLOWBLOOD, 0 }
};

View File

@ -335,7 +335,7 @@ void Effect_Impact(int iType, vector vPos, vector vNormal) {
#endif
}
void Effect_BreakModel(vector vMins, vector vMaxs, vector vVel, float fStyle) {
void Effect_BreakModel(int count, vector vMins, vector vMaxs, vector vVel, float fStyle) {
#ifdef SSQC
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EV_MODELGIB);
@ -346,6 +346,7 @@ void Effect_BreakModel(vector vMins, vector vMaxs, vector vVel, float fStyle) {
WriteCoord(MSG_MULTICAST, vMaxs[1]);
WriteCoord(MSG_MULTICAST, vMaxs[2]);
WriteByte(MSG_MULTICAST, fStyle);
WriteByte(MSG_MULTICAST, count);
msg_entity = self;
@ -356,7 +357,7 @@ void Effect_BreakModel(vector vMins, vector vMaxs, vector vVel, float fStyle) {
multicast(vWorldPos, MULTICAST_PVS);
#else
static void Effect_BreakModel_Remove(void) { remove(self) ; }
float fModelCount;
vector vPos;
string sModel = "";

View File

@ -19,6 +19,11 @@ class player
/* Weapon specific */
int cannon_mag;
int glock_mag;
int mp5_mag;
int python_mag;
int shotgun_mag;
int crossbow_mag;
int rpg_mag;
#ifdef CSQC
/* External model */

View File

@ -218,8 +218,8 @@ void Weapons_AddItem(player pl, int w)
void Weapons_InitItem(int w)
{
itemweapon it = (itemweapon)self;
spawnfunc_itemweapon();
item_pickup it = (item_pickup)self;
spawnfunc_item_pickup();
it.setitem(w);
}

View File

@ -18,6 +18,11 @@ class player
/* Weapon specific */
int glock_mag;
int mp5_mag;
int python_mag;
int shotgun_mag;
int crossbow_mag;
int rpg_mag;
#ifdef CSQC
/* External model */

View File

@ -53,11 +53,16 @@ string w_crossbow_deathmsg(void)
void w_crossbow_draw(void)
{
#ifdef CSQC
if (1/* has clip*/) {
Weapons_ViewAnimation(CROSSBOW_DRAW1);
} else {
Weapons_ViewAnimation(CROSSBOW_DRAW2);
}
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, pl.crossbow_mag, pl.ammo_bolt, __NULL__);
#endif
}
void w_crossbow_holster(void)
@ -174,6 +179,8 @@ void w_crossbow_crosshair(void)
static vector cross_pos;
cross_pos = (video_res / 2) + [-12,-12];
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [72/128,0], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
HUD_DrawAmmo1();
HUD_DrawAmmo2();
#endif
}

View File

@ -46,7 +46,12 @@ string w_egon_deathmsg(void)
void w_egon_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(EGON_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_uranium, __NULL__);
#endif
}
void w_egon_holster(void)

View File

@ -44,7 +44,12 @@ string w_gauss_deathmsg(void)
void w_gauss_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(GAUSS_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_uranium, __NULL__);
#endif
}
void w_gauss_holster(void)

View File

@ -53,9 +53,10 @@ void w_glock_pickup(void)
void w_glock_draw(void)
{
#ifdef SSQC
player pl = (player)self;
#ifdef CSQC
Weapons_ViewAnimation(GLOCK_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, pl.glock_mag, pl.ammo_9mm, __NULL__);
#endif
}

View File

@ -43,7 +43,12 @@ string w_handgrenade_deathmsg(void)
void w_handgrenade_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(HANDGRENADE_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_handgrenade, __NULL__);
#endif
}
void w_handgrenade_holster(void)

View File

@ -52,7 +52,12 @@ string w_hornetgun_deathmsg(void)
void w_hornetgun_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(HORNETGUN_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_hornet, __NULL__);
#endif
}
void w_hornetgun_holster(void)
{

View File

@ -6,10 +6,8 @@
*
****/
.int mp5_mag;
enum
{
/* Animations */
enum {
MP5_IDLE1,
MP5_IDLE2,
MP5_GRENADE,
@ -30,23 +28,28 @@ void w_mp5_precache(void)
precache_sound("weapons/hks2.wav");
precache_sound("weapons/glauncher.wav");
}
void w_mp5_pickup(void)
{
player pl = (player)self;
pl.mp5_mag = 25;
}
string w_mp5_vmodel(void)
{
return "models/v_9mmar.mdl";
}
string w_mp5_wmodel(void)
{
return "models/w_9mmar.mdl";
}
string w_mp5_pmodel(void)
{
return "models/p_9mmar.mdl";
}
string w_mp5_deathmsg(void)
{
return "";
@ -54,12 +57,19 @@ string w_mp5_deathmsg(void)
void w_mp5_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(MP5_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, pl.ammo_m203_grenade);
#endif
}
void w_mp5_holster(void)
{
Weapons_ViewAnimation(MP5_DRAW);
}
void w_mp5_primary(void)
{
player pl = (player)self;
@ -93,6 +103,7 @@ void w_mp5_primary(void)
pl.w_attack_next = 0.1f;
pl.w_idle_next = 10.0f;
}
void w_mp5_secondary(void)
{
player pl = (player)self;
@ -132,6 +143,7 @@ void w_mp5_secondary(void)
pl.w_attack_next = 1.0f;
pl.w_idle_next = 10.0f;
}
void w_mp5_reload(void)
{
player pl = (player)self;
@ -148,6 +160,7 @@ void w_mp5_reload(void)
pl.w_attack_next = 1.5f;
pl.w_idle_next = 10.0f;
}
void w_mp5_release(void)
{
#ifdef CSQC
@ -165,12 +178,16 @@ void w_mp5_release(void)
pl.w_idle_next = 15.0f;
#endif
}
void w_mp5_crosshair(void)
{
#ifdef CSQC
static vector cross_pos;
cross_pos = (video_res / 2) + [-12,-12];
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [24/128,48/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
HUD_DrawAmmo1();
HUD_DrawAmmo2();
HUD_DrawAmmo3();
#endif
}
@ -185,8 +202,7 @@ void w_mp5_hudpic(int s, vector pos)
#endif
}
weapon_t w_mp5 =
{
weapon_t w_mp5 = {
ITEM_MP5,
2,
0,
@ -207,10 +223,13 @@ weapon_t w_mp5 =
};
#ifdef SSQC
void weapon_9mmAR(void) {
void weapon_9mmAR(void)
{
Weapons_InitItem(WEAPON_MP5);
}
void weapon_mp5(void) {
void weapon_mp5(void)
{
Weapons_InitItem(WEAPON_MP5);
}
#endif

View File

@ -6,8 +6,6 @@
*
****/
.int python_cylinder;
enum
{
PYTHON_IDLE1,
@ -32,7 +30,7 @@ void w_python_precache(void)
void w_python_pickup(void)
{
player pl = (player)self;
pl.python_cylinder = 6;
pl.python_mag = 6;
}
string w_python_vmodel(void)
@ -54,7 +52,12 @@ string w_python_deathmsg(void)
void w_python_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(PYTHON_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, pl.python_mag, pl.ammo_357, __NULL__);
#endif
}
void w_python_holster(void)
@ -137,6 +140,8 @@ void w_python_crosshair(void)
static vector cross_pos;
cross_pos = (video_res / 2) + [-12,-12];
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [48/128,0], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
HUD_DrawAmmo1();
HUD_DrawAmmo2();
#endif
}

View File

@ -45,7 +45,12 @@ string w_rpg_deathmsg(void)
void w_rpg_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(RPG_DRAW1);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, pl.rpg_mag, pl.ammo_rocket, __NULL__);
#endif
}
void w_rpg_holster(void)

View File

@ -25,7 +25,12 @@ enum
void w_satchel_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(SATCHEL_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_satchel, __NULL__);
#endif
}
void w_satchel_holster(void)

View File

@ -47,7 +47,12 @@ string w_shotgun_deathmsg(void)
void w_shotgun_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(SHOTGUN_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, __NULL__);
#endif
}
void w_shotgun_holster(void)
@ -131,6 +136,8 @@ void w_shotgun_crosshair(void)
static vector cross_pos;
cross_pos = (video_res / 2) + [-12,-12];
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [48/128,24/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
HUD_DrawAmmo1();
HUD_DrawAmmo2();
#endif
}

View File

@ -18,7 +18,12 @@ enum
void w_snark_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(SNARK_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_snark, __NULL__);
#endif
}
void w_snark_holster(void)

View File

@ -44,7 +44,12 @@ string w_tripmine_deathmsg(void)
void w_tripmine_draw(void)
{
#ifdef CSQC
Weapons_ViewAnimation(TRIPMINE_DRAW);
#else
player pl = (player)self;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_tripmine, __NULL__);
#endif
}
void w_tripmine_holster(void)
{

View File

@ -215,8 +215,8 @@ void Weapons_AddItem(player pl, int w)
void Weapons_InitItem(int w)
{
itemweapon it = (itemweapon)self;
spawnfunc_itemweapon();
item_pickup it = (item_pickup)self;
spawnfunc_item_pickup();
it.setitem(w);
}

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.

Binary file not shown.

Binary file not shown.