/* * Main Program file. * * Platform: Anything with a C compiler. * Author: mr b0nk 500 * Notes: Who would even use this kind of collision checker? * Created: September 27, 2019 @ 09:25PM */ #include #include #include #include #include #define TERASGN(a, b, c, d) (a) ? (b = d) : (c = d) enum {THM, AABB, PPX }; /* Collision type */ int colltype = -1; /* Position type */ int postype = -1; /* Level of verbosity. */ int verbose = 0; static int usage() { printf( "clld Version MFIYA.\n" "Usage: clld [options]\n" "Options:\n" " -c Force the collision type to be\n" " the specified type (0-2).\n" " -v[level] Sets the verbosity level (0-3).\n" ); return 0; } int main(int argc, char **argv) { struct pos { int x; int y; int z; double fx; double fy; double fz; }; struct colis { unsigned int w; unsigned int h; struct pos pos; uint8_t **bitmask; unsigned int clds : 1; unsigned int gnded : 1; }; struct colis cursor; struct colis floor; struct colis tmp; char *buf = NULL; size_t size; /*getline(&buf, &size, stdin);*/ /*if (postype == -1) postype = atoi(strtok(buf, "\n"));*/ /*buf = NULL;*/ getline(&buf, &size, stdin); if (colltype == -1) colltype = atoi(strtok(buf, "\n")); printf("%i\n", colltype); for (int coll = 0; coll <= 1; coll++) { buf = NULL; getline(&buf, &size, stdin); /* , */ tmp.w = atoi(strtok(buf, ",")); tmp.h = atoi(strtok(NULL, "\n")); /* Initialize y axis of bitmask. */ tmp.bitmask = malloc(sizeof(int *)*tmp.h); /* Initialize x axis of bitmask. */ for(int i = 0; i= tmp.w) ? tmp.w : newidth; for (int i = 0; i