gpu: fix anim array indexes with sparse texture array

Texture 54 doesn't exist and was causing everything after it to have its index off by 1
This commit is contained in:
Adam
2022-03-02 14:20:03 -05:00
parent 2520da4dca
commit 5006e959b0

View File

@@ -208,11 +208,14 @@ class TextureManager
{
Texture[] textures = textureProvider.getTextures();
float[] anims = new float[TEXTURE_SIZE * 2];
int idx = 0;
for (Texture texture : textures)
for (int i = 0; i < textures.length; ++i)
{
if (texture != null)
Texture texture = textures[i];
if (texture == null)
{
continue;
}
float u = 0f, v = 0f;
switch (texture.getAnimationDirection())
{
@@ -234,9 +237,8 @@ class TextureManager
u *= speed;
v *= speed;
anims[idx++] = u;
anims[idx++] = v;
}
anims[i * 2] = u;
anims[i * 2 + 1] = v;
}
return anims;
}