From d628dcb7e0be8124fe4873240abda71c81999cfd Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 8 Aug 2016 23:18:59 +1000 Subject: [PATCH] Use a temporary hack to work around hardcoded hagar weapon entity function --- qcsrc/common/weapons/weapon/hagar.qc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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)) { -- 2.39.2