0 Members and 3 Guests are viewing this topic.
extern float sqrt(float x);extern long abs(long x);extern float fabs(float x);extern float sin(float X);extern float cos(float x);
#include "math.h"float sqrt(float x) { float r = x / 2; int i; for (i = 0; i < 10; i++) { r = 0.5 * (r + x / r); } return r;}long abs(long x) { return (x > 0) ? x : -x;}float fabs(float x) { if (x > 0) return x; if (x < 0) return -x; return x;}float cos(float x) { x = x - TWOPI * ((int) (x / TWOPI)); float x2 = x * x; return 1 + x2 * (-.5 + x2 * (.0417 - x2 * 0.00138)); }float sin(float x) { x = x - TWOPI * ((int) (x / TWOPI)); float x2 = x * x; return x * (1 + x2 * (-0.1667 + .00833 * (x2 - .0002 * x2 )));}
struct sprite {long type; float x; float y; float velocityX; float velocityY;};
struct sprite sprite[numSprites];sprite[0] = {1, 6.5, 17.5, 0, 0};
struct sprite sprite = {.type = 1, .x = 6.5, .y = 17.5, .velocityX = 0, .velocityY = 0};
inline long is_on_key_pressed() { return !(*0x900B0028 & 0x00000008);}
inline int is_on_key_pressed() { return !(*(volatile int*)0x900B0028 & 4);}