- fixed: R_LoadVoxelDef did not fully initialize the voxel descriptor it creates.

This commit is contained in:
Christoph Oelckers 2022-10-20 20:23:35 +02:00
parent 96e98fc4a8
commit 5a52f61096
2 changed files with 6 additions and 3 deletions

View file

@ -314,6 +314,7 @@ FVoxelDef *R_LoadVoxelDef(int lumpnum, int spin)
else else
{ {
FVoxelDef *voxdef = new FVoxelDef; FVoxelDef *voxdef = new FVoxelDef;
*voxdef = {};
voxdef->Voxel = vox; voxdef->Voxel = vox;
voxdef->Scale = 1.; voxdef->Scale = 1.;
voxdef->DroppedSpin = voxdef->PlacedSpin = spin; voxdef->DroppedSpin = voxdef->PlacedSpin = spin;

View file

@ -425,9 +425,11 @@ void InitModels()
smf.animationIDs[0] = -1; smf.animationIDs[0] = -1;
smf.xscale = smf.yscale = smf.zscale = VoxelDefs[i]->Scale; smf.xscale = smf.yscale = smf.zscale = VoxelDefs[i]->Scale;
smf.angleoffset = VoxelDefs[i]->AngleOffset.Degrees(); smf.angleoffset = VoxelDefs[i]->AngleOffset.Degrees();
if (VoxelDefs[i]->PitchFromMomentum == true) smf.flags |= MDL_PITCHFROMMOMENTUM; // this helps catching uninitialized data.
if (VoxelDefs[i]->UseActorPitch == true) smf.flags |= MDL_USEACTORPITCH; assert(VoxelDefs[i]->PitchFromMomentum == true || VoxelDefs[i]->PitchFromMomentum == false);
if (VoxelDefs[i]->UseActorRoll == true) smf.flags |= MDL_USEACTORROLL; if (VoxelDefs[i]->PitchFromMomentum) smf.flags |= MDL_PITCHFROMMOMENTUM;
if (VoxelDefs[i]->UseActorPitch) smf.flags |= MDL_USEACTORPITCH;
if (VoxelDefs[i]->UseActorRoll) smf.flags |= MDL_USEACTORROLL;
if (VoxelDefs[i]->PlacedSpin != 0) if (VoxelDefs[i]->PlacedSpin != 0)
{ {
smf.yrotate = 1.f; smf.yrotate = 1.f;