Skip to content

Commit

Permalink
Fix visual_scale for NDT_PLANTLIKE being set too small
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeno- committed Dec 18, 2014
1 parent f5211bb commit 815876e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/content_mapblock.cpp
Expand Up @@ -1162,15 +1162,16 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
u16 l = getInteriorLight(n, 1, nodedef);
video::SColor c = MapBlock_LightColor(255, l, f.light_source);

float s = BS / 2;
for(u32 j = 0; j < 2; j++)
float s = BS / 2 * f.visual_scale;

for (int j = 0; j < 2; j++)
{
video::S3DVertex vertices[4] =
{
video::S3DVertex(-s,-s, 0, 0,0,0, c, 0,1),
video::S3DVertex( s,-s, 0, 0,0,0, c, 1,1),
video::S3DVertex( s, s, 0, 0,0,0, c, 1,0),
video::S3DVertex(-s, s, 0, 0,0,0, c, 0,0),
video::S3DVertex(-s,-BS/2, 0, 0,0,0, c, 0,1),
video::S3DVertex( s,-BS/2, 0, 0,0,0, c, 1,1),
video::S3DVertex( s,-BS/2 + s*2,0, 0,0,0, c, 1,0),
video::S3DVertex(-s,-BS/2 + s*2,0, 0,0,0, c, 0,0),
};

if(j == 0)
Expand All @@ -1184,10 +1185,11 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
vertices[i].Pos.rotateXZBy(-44 + n.param2 * 2);
}

for(u16 i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
{
vertices[i].Pos *= f.visual_scale;
vertices[i].Pos.Y -= s * (1 - f.visual_scale);
if (f.visual_scale < 1)
vertices[i].Pos.Y -= BS/2 * (1 - f.visual_scale);
vertices[i].Pos += intToFloat(p, BS);
}

Expand Down

4 comments on commit 815876e

@kwolekr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, dammit Zeno-, stop changing array indicies to signed types!
Prefer size_t. If there's a mismatched comparison between signed and unsigned types, then perhaps the signed part should be changed to unsigned.

@Zeno-
Copy link
Contributor Author

@Zeno- Zeno- commented on 815876e Dec 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubbish. I did not change it to a signed type for that reason (at all). This change had nothing to do with signedness

@Zeno-
Copy link
Contributor Author

@Zeno- Zeno- commented on 815876e Dec 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also, dammit kwolekr, stop pushing code with compiler warnings!

@RealBadAngel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hold on a second. why the heck have you altered that code??
you have just broken part for plantlike being mounted on the ground regardless the scale of it.

Please sign in to comment.