After consulting the MODELDEF wiki article, I learned that
Easy. MODELDEF code:When using FrameIndex, setting frame number to -1 disables rendering of the associated model.
Code: Select all
Model AITD_Shotgun // Name of actor in DECORATE
{
Path "models/weapons/shotgun" // Path to model in PK3
Model 0 "shotgun_v.md3" // Model index, model file
Model 1 "shotgun_v_muzzleflash.md3"
SurfaceSkin 0 0 "models/PAL1.png"
SurfaceSkin 1 0 "models/PAL1.png"
//idle:
FrameIndex SHGA A 0 0 // The sprite lump, sprite frame, model index, frame number
FrameIndex SHGA A 1 -1//"-1" for frame number should disable the muzzleflash model for that frame
//firing (+ muzzleflash):
FrameIndex SHGA B 0 1
FrameIndex SHGA B 1 1//muzzleflash model should be visible in this frame
}
Solution, or rather workaround so far, is to have separate MODELDEFS entries for all those instances where a model needs to be visible, so it is only defined and used in those entries. This of course breaks interpolation (model animation frames between separate MODELDEF entries for the same actor are not interpolated) so the states need some ugly workarounds, too.
Code: Select all
//frames without muzzleflash model
Model AITD_Shotgun
{
Model 0 "shotgun_v.md3"
[...]
//idle
FrameIndex SHGA A 0 0 // The sprite lump, sprite frame, model index, frame number
}
*/
/*
//frames with muzzleflash model
Model AITD_Shotgun
{
Model 0 "shotgun_v.md3"
Model 1 "shotgun_v_muzzleflash.md3"
[...]
//muzzleflash
FrameIndex SHGA B 0 1
FrameIndex SHGA B 1 1
}