/* * 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 /* 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" " -p Force the position 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 pos cursor; struct pos floor; struct pos 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%i\n", postype, colltype); for (int i = 0; i <= 1; i++) { char *tmp2; buf = NULL; getline(&buf, &size, stdin); if (strchr(buf, '.') != NULL) { tmp.fx = atof(strtok(buf,",")); tmp.fy = atof(strtok(NULL,",")); tmp2 = strtok(NULL, "\n"); if (tmp2 == NULL) tmp.fz = atof(strtok(NULL,"\0")); else tmp.fz = atof(tmp2); if (!i) { cursor = tmp; printf ("%07.06f, %07.06f, %07.06f\n", cursor.fx, cursor.fy, cursor.fz); } else { floor = tmp; printf ("%07.06f, %07.06f, %07.06f\n", floor.fx, floor.fy, floor.fz); } } else { tmp.x = atoi(strtok(buf,",")); tmp.y = atoi(strtok(NULL,",")); tmp2 = strtok(NULL, "\n"); if (tmp2 == NULL) tmp.z = atoi(strtok(NULL, "\0")); else tmp.z = atoi(tmp2); if (!i) { cursor = tmp; printf ("%i, %i, %i\n", cursor.x, cursor.y, cursor.z); } else { floor = tmp; printf ("%i, %i, %i\n", floor.x, floor.y, floor.z); } } } free(buf); fflush(stdout); return 0; }