[Fix] Corrected small desciation on all sprites.
This commit is contained in:
parent
fb326610f6
commit
7fc15f650c
11
src/opengl.c
11
src/opengl.c
@ -318,7 +318,16 @@ int gl_isTrans(const glTexture* t, const int x, const int y) {
|
|||||||
void gl_getSpriteFromDir(int* x, int* y, const glTexture* t, const double dir) {
|
void gl_getSpriteFromDir(int* x, int* y, const glTexture* t, const double dir) {
|
||||||
int s, sx, sy;
|
int s, sx, sy;
|
||||||
|
|
||||||
s = (int)(dir / (2.0*M_PI / (t->sy*t->sx)));
|
double shard, rdir;
|
||||||
|
|
||||||
|
// What each image represents in angle.
|
||||||
|
shard = 2.0*M_PI / (t->sy*t->sx);
|
||||||
|
|
||||||
|
rdir = dir + shard/2.;
|
||||||
|
if(rdir < 0.) rdir = 0.;
|
||||||
|
|
||||||
|
// Now calculate the sprite we need.
|
||||||
|
s = (int)(rdir / shard);
|
||||||
sx = t->sx;
|
sx = t->sx;
|
||||||
sy = t->sy;
|
sy = t->sy;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user