HL2 RPG causing an assert [Fix included inside]
Vanilla code nothing changed, getting an assert in c_te_legacytempents.cpp on line 1871.
Steps to reproduce:
- Give yourself an rpg (give weapon_rpg)
- Point and shoot some where
I'm really new to GitHub (and c++ coding in general) so I'm not exactly sure how to submit the fix but looking at 2007 branches code it looked like previously there was a known issue with weapons that didn't have a muzzleflash, namely the rpg. The fix was to just swap out the new code in CtempEnts::MuzzleFlash with the old one that instead of throwing out an assert for undefined muzzleflashes like type 0 for the RPG use the smg's (most likely because the view model size would hide it).
Copy of the code snippet: http://pastebin.com/DRCChD5c
Assert is correct here, it means no muzzle flash implemented for RPG.
Problem is that Half-Life 2 uses old animation event (CL_EVENT_MUZZLEFLASH0) for RPG and old event system missed support for RPG muzzle flashes.
Correct way to fix this is to use new event system for RPG, changing RPG definition file.
For now I've added support for RPG muzzle flashes using old animation event system both for player and NPC. NPC already has one, but not used.