Closed Kurtsley closed 12 months ago
I see, this is a slightly tricky bug I think I would prefer the following:
a->gunIndex == MELEE_SLOT
) and tries to pick up a normal gun, switch to the first gun (a->gunIndex == 0
) and proceed with the normal logic (i.e. logic described here https://github.com/cxong/cdogs-sdl/blob/master/src/cdogs/pickup.c#L345-L351)This appears to accomplish what you wanted the game to do. The only thing I wasn't able to test was picking up a different melee weapon while holding a melee weapon.
Okay, this is what I have now:
Anything else that happens should be the same as before.
I tested this as many ways I could think of, including with and without the grenade slot. Hopefully this works correctly now, but I could be missing an edge case. This was more complicated than I originally thought.
I'll take a look at this myself later, and considering how complex this turned out to be, I think it's worth refactoring this logic to the Actor class and covering with unit tests.
I was looking at possibly adding it to the ActorReplaceGun function in the actors.c file. Either that or put it in a separate bool function , whatever works best. As for the unit tests, that is not a strength of m
Accidentally closed. To continue, I would give the tests a shot.
Addresses #781.
This should prevent guns being added to the melee slot. Should an error sound be played as well?