Added PitchFromMomentum, UseActorPitch and UseActorRoll to VOXELDEF. Behaves exactly like their 3D model counterparts. Hardware renderer only.

This commit is contained in:
nashmuhandes 2022-07-25 06:48:43 +08:00 committed by Christoph Oelckers
parent eb94f81a83
commit 351a4c9a5a
3 changed files with 26 additions and 1 deletions

View file

@ -70,6 +70,9 @@ struct FVoxelDef
int VoxeldefIndex; // Needed by GZDoom
double Scale;
DAngle AngleOffset;// added to actor's angle to compensate for wrong-facing voxels
bool PitchFromMomentum;
bool UseActorPitch;
bool UseActorRoll;
};
extern TDeletingArray<FVoxel *> Voxels; // used only to auto-delete voxels on exit.

View file

@ -390,6 +390,9 @@ void InitModels()
smf.skinIDs[0] = md->GetPaletteTexture();
smf.xscale = smf.yscale = smf.zscale = VoxelDefs[i]->Scale;
smf.angleoffset = VoxelDefs[i]->AngleOffset.Degrees;
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)
{
smf.yrotate = 1.f;

View file

@ -53,7 +53,8 @@
struct VoxelOptions
{
VoxelOptions()
: DroppedSpin(0), PlacedSpin(0), Scale(1.), AngleOffset(90.), OverridePalette(false)
: DroppedSpin(0), PlacedSpin(0), Scale(1.), AngleOffset(90.), OverridePalette(false),
PitchFromMomentum(false), UseActorPitch(false), UseActorRoll(false)
{}
int DroppedSpin;
@ -61,6 +62,9 @@ struct VoxelOptions
double Scale;
DAngle AngleOffset;
bool OverridePalette;
bool PitchFromMomentum;
bool UseActorPitch;
bool UseActorRoll;
};
void VOX_AddVoxel(int sprnum, int frame, FVoxelDef* def);
@ -180,6 +184,18 @@ static void VOX_ReadOptions(FScanner &sc, VoxelOptions &opts)
{
opts.OverridePalette = true;
}
else if (sc.Compare("pitchfrommomentum"))
{
opts.PitchFromMomentum = true;
}
else if (sc.Compare("useactorpitch"))
{
opts.UseActorPitch = true;
}
else if (sc.Compare("useactorroll"))
{
opts.UseActorRoll = true;
}
else
{
sc.ScriptMessage("Unknown voxel option '%s'\n", sc.String);
@ -249,6 +265,9 @@ void R_InitVoxels()
def->DroppedSpin = opts.DroppedSpin;
def->PlacedSpin = opts.PlacedSpin;
def->AngleOffset = opts.AngleOffset;
def->PitchFromMomentum = opts.PitchFromMomentum;
def->UseActorPitch = opts.UseActorPitch;
def->UseActorRoll = opts.UseActorRoll;
VoxelDefs.Push(def);
for (unsigned i = 0; i < vsprites.Size(); ++i)