#ifndef IMPLEMENTATION
-REGISTER_WEAPON(
-/* WEP_##id */ CRYLINK,
-/* function */ W_Crylink,
-/* ammotype */ ammo_cells,
-/* impulse */ 6,
-/* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH,
-/* rating */ BOT_PICKUP_RATING_MID,
-/* color */ '1 0.5 1',
-/* modelname */ "crylink",
-/* model */ MDL_CRYLINK_ITEM,
-/* crosshair */ "gfx/crosshaircrylink 0.5",
-/* wepimg */ "weaponcrylink",
-/* refname */ "crylink",
-/* wepname */ _("Crylink")
-);
+CLASS(Crylink, Weapon)
+/* ammotype */ ATTRIB(Crylink, ammo_field, .int, ammo_cells)
+/* impulse */ ATTRIB(Crylink, impulse, int, 6)
+/* flags */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
+/* rating */ ATTRIB(Crylink, bot_pickupbasevalue, float, BOT_PICKUP_RATING_MID);
+/* color */ ATTRIB(Crylink, wpcolor, vector, '1 0.5 1');
+/* modelname */ ATTRIB(Crylink, mdl, string, "crylink");
+#ifndef MENUQC
+/* model */ ATTRIB(Crylink, m_model, Model, MDL_CRYLINK_ITEM);
+#endif
+/* crosshair */ ATTRIB(Crylink, w_crosshair, string, "gfx/crosshaircrylink");
+/* crosshair */ ATTRIB(Crylink, w_crosshair_size, float, 0.5);
+/* wepimg */ ATTRIB(Crylink, model2, string, "weaponcrylink");
+/* refname */ ATTRIB(Crylink, netname, string, "crylink");
+/* wepname */ ATTRIB(Crylink, message, string, _("Crylink"));
+ENDCLASS(Crylink)
+REGISTER_WEAPON(CRYLINK, NEW(Crylink));
#define CRYLINK_SETTINGS(w_cvar,w_prop) CRYLINK_SETTINGS_LIST(w_cvar, w_prop, CRYLINK, crylink)
#define CRYLINK_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
}
}
-bool W_Crylink(entity thiswep, int req)
-{SELFPARAM();
- float ammo_amount;
- switch(req)
- {
- case WR_AIM:
+ METHOD(Crylink, wr_aim, bool(entity thiswep))
{
+ SELFPARAM();
if(random() < 0.10)
self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
else
return true;
}
- case WR_THINK:
+ METHOD(Crylink, wr_think, bool(entity thiswep))
{
+ SELFPARAM();
if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) // forced reload
_WEP_ACTION(self.weapon, WR_RELOAD);
setorigin(linkjoineffect, pos);
}
self.crylink_waitrelease = 0;
- if(!W_Crylink(WEP_CRYLINK, WR_CHECKAMMO1) && !W_Crylink(WEP_CRYLINK, WR_CHECKAMMO2))
+ if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
{
// ran out of ammo!
return true;
}
- case WR_INIT:
+ METHOD(Crylink, wr_init, bool(entity thiswep))
{
CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
return true;
}
- case WR_CHECKAMMO1:
+ METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
// don't "run out of ammo" and switch weapons while waiting for release
if(self.crylink_lastgroup && self.crylink_waitrelease)
return true;
- ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_PRI(crylink, ammo);
+ float ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_PRI(crylink, ammo);
ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
return ammo_amount;
}
- case WR_CHECKAMMO2:
+ METHOD(Crylink, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
// don't "run out of ammo" and switch weapons while waiting for release
if(self.crylink_lastgroup && self.crylink_waitrelease)
return true;
- ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_SEC(crylink, ammo);
+ float ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_SEC(crylink, ammo);
ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
return ammo_amount;
}
- case WR_CONFIG:
+ METHOD(Crylink, wr_config, bool(entity thiswep))
{
CRYLINK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
return true;
}
- case WR_RELOAD:
+ METHOD(Crylink, wr_reload, bool(entity thiswep))
{
W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
return true;
}
- case WR_SUICIDEMESSAGE:
+ METHOD(Crylink, wr_suicidemessage, bool(entity thiswep))
{
return WEAPON_CRYLINK_SUICIDE;
}
- case WR_KILLMESSAGE:
+ METHOD(Crylink, wr_killmessage, bool(entity thiswep))
{
return WEAPON_CRYLINK_MURDER;
}
- }
- return false;
-}
#endif
#ifdef CSQC
-bool W_Crylink(entity thiswep, int req)
-{SELFPARAM();
- switch(req)
- {
- case WR_IMPACTEFFECT:
+ METHOD(Crylink, wr_impacteffect, bool(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 2;
if(w_deathtype & HITTYPE_SECONDARY)
return true;
}
- case WR_INIT:
+ METHOD(Crylink, wr_init, bool(entity thiswep))
{
return true;
}
- case WR_ZOOMRETICLE:
+ METHOD(Crylink, wr_zoomreticle, bool(entity thiswep))
{
// no weapon specific image for this weapon
return false;
}
- }
- return false;
-}
#endif
#endif