Scientist Hunt: Clean up w_cannon a little
This commit is contained in:
parent
02efa21e3d
commit
97f90ae72c
2 changed files with 40 additions and 20 deletions
|
@ -18,7 +18,7 @@
|
||||||
var string g_cannon_spr;
|
var string g_cannon_spr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CANNON_FIREBOTH,
|
CANNON_FIREBOTH,
|
||||||
CANNON_FIRELEFT,
|
CANNON_FIRELEFT,
|
||||||
|
@ -28,9 +28,10 @@ enum
|
||||||
CANNON_PUTAWAY,
|
CANNON_PUTAWAY,
|
||||||
CANNON_IDLE1,
|
CANNON_IDLE1,
|
||||||
CANNON_IDLE2
|
CANNON_IDLE2
|
||||||
};
|
} cannonAnims_t;
|
||||||
|
|
||||||
void w_cannon_precache(void)
|
void
|
||||||
|
w_cannon_precache(void)
|
||||||
{
|
{
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
precache_sound("cannon/cin.wav");
|
precache_sound("cannon/cin.wav");
|
||||||
|
@ -44,22 +45,29 @@ void w_cannon_precache(void)
|
||||||
g_cannon_spr = spriteframe("sprites/w_cannon.spr", 0, 0.0f);
|
g_cannon_spr = spriteframe("sprites/w_cannon.spr", 0, 0.0f);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void w_cannon_updateammo(player pl)
|
|
||||||
|
void
|
||||||
|
w_cannon_updateammo(player pl)
|
||||||
{
|
{
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
|
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
string w_cannon_pmodel(void)
|
|
||||||
|
string
|
||||||
|
w_cannon_pmodel(void)
|
||||||
{
|
{
|
||||||
return "models/p_cannon.mdl";
|
return "models/p_cannon.mdl";
|
||||||
}
|
}
|
||||||
string w_cannon_deathmsg(void)
|
|
||||||
|
string
|
||||||
|
w_cannon_deathmsg(void)
|
||||||
{
|
{
|
||||||
return "%s killed %s with handcannon.";
|
return "%s killed %s with handcannon.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void w_cannon_reload(void)
|
void
|
||||||
|
w_cannon_reload(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
if (pl.w_attack_next > 0) {
|
if (pl.w_attack_next > 0) {
|
||||||
|
@ -89,7 +97,8 @@ void w_cannon_reload(void)
|
||||||
pl.w_idle_next = 3.0f;
|
pl.w_idle_next = 3.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_cannon_pickup(int new, int startammo)
|
int
|
||||||
|
w_cannon_pickup(int new, int startammo)
|
||||||
{
|
{
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
@ -107,7 +116,8 @@ int w_cannon_pickup(int new, int startammo)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void w_cannon_draw(void)
|
void
|
||||||
|
w_cannon_draw(void)
|
||||||
{
|
{
|
||||||
Weapons_SetModel("models/v_cannon.mdl");
|
Weapons_SetModel("models/v_cannon.mdl");
|
||||||
Weapons_ViewAnimation(CANNON_DEPLOY);
|
Weapons_ViewAnimation(CANNON_DEPLOY);
|
||||||
|
@ -117,11 +127,14 @@ void w_cannon_draw(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void w_cannon_holster(void)
|
void
|
||||||
|
w_cannon_holster(void)
|
||||||
{
|
{
|
||||||
Weapons_ViewAnimation(CANNON_PUTAWAY);
|
Weapons_ViewAnimation(CANNON_PUTAWAY);
|
||||||
}
|
}
|
||||||
void w_cannon_primary(void)
|
|
||||||
|
void
|
||||||
|
w_cannon_primary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
|
@ -136,7 +149,6 @@ void w_cannon_primary(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||||
Weapons_ViewPunchAngle([-5,0,0]);
|
|
||||||
#else
|
#else
|
||||||
int dmg;
|
int dmg;
|
||||||
|
|
||||||
|
@ -151,12 +163,14 @@ void w_cannon_primary(void)
|
||||||
Weapons_PlaySound(pl, CHAN_WEAPON, "cannon/fire.wav", 1, ATTN_NORM);
|
Weapons_PlaySound(pl, CHAN_WEAPON, "cannon/fire.wav", 1, ATTN_NORM);
|
||||||
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
|
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
|
||||||
#endif
|
#endif
|
||||||
|
Weapons_ViewPunchAngle([-5,0,0]);
|
||||||
Weapons_ViewAnimation(CANNON_FIREBOTH);
|
Weapons_ViewAnimation(CANNON_FIREBOTH);
|
||||||
pl.w_attack_next = 1.5f;
|
pl.w_attack_next = 1.5f;
|
||||||
pl.w_idle_next = 2.5f;
|
pl.w_idle_next = 2.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void w_cannon_secondary(void)
|
void
|
||||||
|
w_cannon_secondary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
|
@ -194,7 +208,8 @@ void w_cannon_secondary(void)
|
||||||
pl.w_attack_next = 1.5f;
|
pl.w_attack_next = 1.5f;
|
||||||
pl.w_idle_next = 2.5f;
|
pl.w_idle_next = 2.5f;
|
||||||
}
|
}
|
||||||
void w_cannon_release(void)
|
void
|
||||||
|
w_cannon_release(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
|
@ -221,7 +236,9 @@ void w_cannon_release(void)
|
||||||
|
|
||||||
pl.w_idle_next = 8.0f;
|
pl.w_idle_next = 8.0f;
|
||||||
}
|
}
|
||||||
void w_cannon_crosshair(void)
|
|
||||||
|
void
|
||||||
|
w_cannon_crosshair(void)
|
||||||
{
|
{
|
||||||
#ifdef CLIENT
|
#ifdef CLIENT
|
||||||
static vector cross_pos;
|
static vector cross_pos;
|
||||||
|
@ -234,12 +251,14 @@ void w_cannon_crosshair(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
float w_cannon_aimanim(void)
|
float
|
||||||
|
w_cannon_aimanim(void)
|
||||||
{
|
{
|
||||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN;
|
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void w_cannon_hudpic(int s, vector pos, float a)
|
void
|
||||||
|
w_cannon_hudpic(int s, vector pos, float a)
|
||||||
{
|
{
|
||||||
#ifdef CLIENT
|
#ifdef CLIENT
|
||||||
if (s) {
|
if (s) {
|
||||||
|
@ -250,10 +269,11 @@ void w_cannon_hudpic(int s, vector pos, float a)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
weapon_t w_cannon =
|
weapon_t
|
||||||
|
w_cannon =
|
||||||
{
|
{
|
||||||
.name = "handcannon",
|
.name = "handcannon",
|
||||||
.id = ITEM_CANNON,
|
.id = ITEM_CANNON,
|
||||||
.slot = 2,
|
.slot = 2,
|
||||||
.slot_pos = 3,
|
.slot_pos = 3,
|
||||||
.draw = w_cannon_draw,
|
.draw = w_cannon_draw,
|
||||||
|
|
|
@ -229,7 +229,7 @@ void
|
||||||
Titles_AddEntry(titles_t new)
|
Titles_AddEntry(titles_t new)
|
||||||
{
|
{
|
||||||
int newcount = g_titles_count + 1;
|
int newcount = g_titles_count + 1;
|
||||||
g_titles = memrealloc(g_titles, sizeof(titles_t), g_titles_count, newcount);
|
g_titles = (titles_t *)memrealloc(g_titles, sizeof(titles_t), g_titles_count, newcount);
|
||||||
g_titles[g_titles_count].m_strName = new.m_strName;
|
g_titles[g_titles_count].m_strName = new.m_strName;
|
||||||
g_titles[g_titles_count].m_strMessage = new.m_strMessage;
|
g_titles[g_titles_count].m_strMessage = new.m_strMessage;
|
||||||
g_titles[g_titles_count].m_flPosX = new.m_flPosX;
|
g_titles[g_titles_count].m_flPosX = new.m_flPosX;
|
||||||
|
|
Loading…
Reference in a new issue