forked from Ports/perfect_dark
port: fix #163
This commit is contained in:
1 parent
c10050a14c
commit
cb1e1e5dca
3 files changed
+16
No files matched your search
@@ -6320,9 +6320,15 @@ void bgunDisarm(struct prop *attackerprop)
|
||||
for (i = 0; i < 2; i++) {
|
||||
struct weaponfunc *func = gsetGetWeaponFunction(&player->hands[i].gset);
|
||||
|
||||
#ifdef AVOID_UB
|
||||
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_THROW
|
||||
&& player->hands[i].state == HANDSTATE_ATTACK
|
||||
&& player->hands[i].stateminor == HANDSTATEMINOR_ATTACK_THROW_0) {
|
||||
#else
|
||||
if ((func->type & 0xff) == INVENTORYFUNCTYPE_THROW
|
||||
&& player->hands[i].state == HANDSTATE_ATTACK
|
||||
&& player->hands[i].stateminor == HANDSTATEMINOR_ATTACK_THROW_0) {
|
||||
#endif
|
||||
drop = false;
|
||||
bgunCreateThrownProjectile(i + 2, &player->hands[i].gset);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,12 @@ struct weaponfunc *gsetGetWeaponFunction(struct gset *gset)
|
||||
struct weapon *weapon = g_Weapons[gset->weaponnum];
|
||||
|
||||
if (weapon) {
|
||||
#ifdef AVOID_UB
|
||||
// SuperDragon grenades have FUNC_2, so this can happen
|
||||
if (gset->weaponfunc > FUNC_SECONDARY) {
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
return weapon->functions[gset->weaponfunc];
|
||||
}
|
||||
|
||||
|
||||
@@ -1191,7 +1191,11 @@ void handInflictMeleeDamage(s32 handnum, struct gset *gset, bool arg2)
|
||||
struct model *model;
|
||||
struct weaponfunc *func = gsetGetWeaponFunction(gset);
|
||||
|
||||
#ifdef AVOID_UB
|
||||
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_MELEE) {
|
||||
#else
|
||||
if ((func->type & 0xff) == INVENTORYFUNCTYPE_MELEE) {
|
||||
#endif
|
||||
struct weaponfunc_melee *meleefunc = (struct weaponfunc_melee *)func;
|
||||
rangelimit = meleefunc->range;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user