From: Mario Date: Mon, 8 Aug 2016 13:18:59 +0000 (+1000) Subject: Use a temporary hack to work around hardcoded hagar weapon entity function X-Git-Tag: xonotic-v0.8.2~723^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d628dcb7e0be8124fe4873240abda71c81999cfd;p=xonotic%2Fxonotic-data.pk3dir.git Use a temporary hack to work around hardcoded hagar weapon entity function --- diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index a51bbc8b3..f161823d2 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -476,9 +476,14 @@ METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor)) // we lost the weapon and want to prepare switching away if(actor.hagar_load) { - .entity weaponentity = weaponentities[0]; // TODO: unhardcode - actor.(weaponentity).state = WS_READY; - W_Hagar_Attack2_Load_Release(actor, weaponentity); + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if(actor.(weaponentity).weaponname != WEP_HAGAR.mdl) + continue; // only if it's a hagar (currently only way to detect) + actor.(weaponentity).state = WS_READY; + W_Hagar_Attack2_Load_Release(actor, weaponentity); + } } } METHOD(Hagar, wr_setup, void(entity thiswep, entity actor)) @@ -509,10 +514,17 @@ METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor)) } METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor)) { - .entity weaponentity = weaponentities[0]; // TODO: unhardcode // if we have any rockets loaded when we die, release them if(actor.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath)) - W_Hagar_Attack2_Load_Release(actor, weaponentity); + { + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if(actor.(weaponentity).weaponname != WEP_HAGAR.mdl) + continue; // only if it's a hagar (currently only way to detect) + W_Hagar_Attack2_Load_Release(actor, weaponentity); + } + } } METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) {