--- deliantra/Deliantra-Client/Client.xs 2009/12/19 05:06:56 1.294 +++ deliantra/Deliantra-Client/Client.xs 2009/12/21 03:30:22 1.295 @@ -21,7 +21,6 @@ # undef pipe // microsoft vs. C # define sqrtf(x) sqrt(x) -# define roundf(x) (int)(x) # define atan2f(x,y) atan2(x,y) # define M_PI 3.14159265f #endif @@ -824,6 +823,12 @@ IV popcount (UV n) +NV distance (NV dx, NV dy) + CODE: + RETVAL = pow (dx * dx + dy * dy, 0.5); + OUTPUT: + RETVAL + void pango_init () CODE: @@ -2429,30 +2434,30 @@ } void -draw_magicmap (DC::Map self, int dx, int dy, int w, int h, unsigned char *data) +draw_magicmap (DC::Map self, int w, int h, unsigned char *data) CODE: { static float color[16][3] = { - { 0.00F, 0.00F, 0.00F }, - { 1.00F, 1.00F, 1.00F }, - { 0.00F, 0.00F, 0.55F }, - { 1.00F, 0.00F, 0.00F }, - - { 1.00F, 0.54F, 0.00F }, - { 0.11F, 0.56F, 1.00F }, - { 0.93F, 0.46F, 0.00F }, - { 0.18F, 0.54F, 0.34F }, - - { 0.56F, 0.73F, 0.56F }, - { 0.80F, 0.80F, 0.80F }, - { 0.55F, 0.41F, 0.13F }, - { 0.99F, 0.77F, 0.26F }, - - { 0.74F, 0.65F, 0.41F }, - - { 0.00F, 1.00F, 1.00F }, - { 1.00F, 0.00F, 1.00F }, - { 1.00F, 1.00F, 0.00F }, + { 0.00f, 0.00f, 0.00f }, + { 1.00f, 1.00f, 1.00f }, + { 0.00f, 0.00f, 0.55f }, + { 1.00f, 0.00f, 0.00f }, + + { 1.00f, 0.54f, 0.00f }, + { 0.11f, 0.56f, 1.00f }, + { 0.93f, 0.46f, 0.00f }, + { 0.18f, 0.54f, 0.34f }, + + { 0.56f, 0.73f, 0.56f }, + { 0.80f, 0.80f, 0.80f }, + { 0.55f, 0.41f, 0.13f }, + { 0.99f, 0.77f, 0.26f }, + + { 0.74f, 0.65f, 0.41f }, + + { 0.00f, 1.00f, 1.00f }, + { 1.00f, 0.00f, 1.00f }, + { 1.00f, 1.00f, 0.00f }, }; int x, y; @@ -2478,8 +2483,8 @@ { float *c = color [m & 15]; - float tx1 = m & 0x40 ? 0.5 : 0.; - float tx2 = tx1 + 0.5; + float tx1 = m & 0x40 ? 0.5f : 0.f; + float tx2 = tx1 + 0.5f; glColor4f (c[0], c[1], c[2], 1); glTexCoord2f (tx1, 0.); glVertex2i (x , y ); @@ -2837,7 +2842,7 @@ CODE: { int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance)); - int angle = 360 + (int)roundf (atan2f (dx, -dy) * 180.f / (float)M_PI); + int angle = atan2f (dx, -dy) * 180.f / (float)M_PI + 360.f; Mix_SetPosition (self, angle, CLAMP (distance, 0, 255)); }