JKGDevs / JediKnightGalaxies

Jedi Knight Galaxies (JKG) is a multiplayer shooter with role playing elements, played out in the Star Wars universe. The project is a full conversion game modification for Jedi Knight: Jedi Academy.
https://www.jkgalaxies.net/
GNU General Public License v2.0
34 stars 12 forks source link

Switching firing modes on grenades crashes the game #243

Closed DarthFutuza closed 6 years ago

DarthFutuza commented 6 years ago

(see title)

DarthFutuza commented 6 years ago

See g_cmds.cpp @ line 4145

if (!BG_AmmoIsBasedOn(wp->firemodes[ent->client->ps.firingMode].ammoBase->ammoIndex, wp->firemodes[previousFiringMode].ammoBase->ammoIndex))

ensiform commented 6 years ago

is wp or ammoBase null?

DarthFutuza commented 6 years ago

@ensiform Yes, basically the funciton BG_AmmoIsBasedOn() shouldn't be called without first checking that the item actually uses ammo. I've pushed a temp fix for now, but needs to actually fix what's setting it. Probably going to let eez do that though since the new ammo system is his work and I dunno exactly how it works yet. But it looks like grenades don't set the ammoBase etc to a default value or something.

DarthFutuza commented 6 years ago

Need to do something like this:

itemInstance_t* item;
if (item->id->itemType == ITEM_CONSUMABLE)
    return;

I just don't know quite how to make this work.