#include #include "assert.h" #include #include #include #include #include using namespace std; float UnitRandom (void) { return rand () / static_cast (RAND_MAX); } int main (int argc, char** argv) { srand (static_cast (time (0))); for (int i = 0; i < argc; i++) if (argv[i][0] == '-') if (strcmp (argv[i], "-count") == 0) if (argc > (i + 1)) { int iCount = atoi (argv[i + 1]); // aspect ratio 5x5x1 float fWidth = sqrtf (static_cast (iCount)); int iWidth = static_cast (floorf (fWidth)); int iHeight = iCount / iWidth; //cout << "Count: " << iCount << endl << "Width: " << iWidth << endl << "Height: " << iHeight << endl; // world size 10,000x10,000x2,000 float fWidthMultiplier = 10000.0f / static_cast (iWidth); float fHeightMultiplier = 10000.0f / static_cast (iHeight); iCount = 0; for (int j = 0; j < iHeight; j++) { for (int k = 0; k < iWidth; k++) { float radius = (UnitRandom () * 200.0f) + 150.0f; float mass = radius * radius; float hitpoints = radius * 5.0f; float signature = radius / 10.0f; float rotation = 0.1 + (UnitRandom () * 0.15f); bool isHelium = (UnitRandom () < 0.1f) ? true : false; float ore = 1000.0f + (UnitRandom () * 10000.0f); float x = ((UnitRandom () + static_cast (k)) * fWidthMultiplier) - 5000.0f; float y = ((UnitRandom () + static_cast (j)) * fWidthMultiplier) - 5000.0f; float z = (UnitRandom () * 2000.0f) - 1000.0f; cout << "1024\t1\t" << iCount++ << "\t" << ore << "\t" << (isHelium ? 1 : 0) << "\t" << static_cast (hitpoints) << "\t" << static_cast (radius) << "\t" << (isHelium ? "bgrnd56" : "bgrnd03") << "\t\tmeteoricon\t" << mass << "\t" << signature << "\t" << x << "\t" << y << "\t" << z << " \t" << rotation << "\tName" << endl; } } return 0; } cout << "gimme a count (-count 10)" << endl; return 1; }