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