rendered paste body // BEGIN FUCKERY //std::ofstream out("/Users/elliot/tile.dat"); sprintf(filename, "/Users/elliot/Documents/code/cpp/lolmap/modeltiledata/%s_%d_%d.dat", gWorld->basename.c_str(), x, z); std::ofstream out(filename); out << "Tile position: x " << xbase << ", z " << zbase << "\n"; out << "Map has " << modelis.size() << " models (" << models.size() << " unique)\n"; out << "Models used in this tile are: \n"; for (int i=0; i<modelis.size(); i++) { //out << i << ") " << textures[i] << " [" << mt->textures[i].c_str() << "]\n"; out << i+1 << ") [" //<< models[modelIDs[i]] // This causes the app to crash << "] Position: (" << (modelis.at(i).pos.x - xbase) / 33.33 << ", " << (modelis.at(i).pos.z - zbase) / 33.33 << ", " << modelis.at(i).pos.y << ") Direction: (" << modelis.at(i).dir.x << ", " << modelis.at(i).dir.z << ", " << modelis.at(i).dir.y << ")\n"; } // Now that we've got the models in the tile, let's see where the chunks are up ins out << "\nChunks in this tile:\n"; for (int j = 0; j < 16; j++) { for (int i = 0; i < 16; i++) { out << ((16*j)+i+1) << ") x: " << chunks[j][i].xbase - xbase << " z: " << chunks[j][i].zbase - zbase << " y: " << chunks[j][i].ybase << "\n"; } } out << "\n"; out.close(); /* Enough fucking about, let's map this shit. */ for (int j = 0; j < 16; j++) { for (int i = 0; i < 16; i++) { // Prep the main array (just in case there's no texture) fullMap[j][i] = 'x'; // Textures fullMap[j][i] = '0' + chunks[j][i].nTextures; // Convert int to char // Water if (chunks[j][i].haswater) { fullMap[j][i] = '~'; } } } // Models for (int i=0; i<modelis.size(); i++) { int tempX, tempZ; tempX = static_cast<int>((modelis.at(i).pos.x - xbase) / 33.33); tempZ = static_cast<int>((modelis.at(i).pos.z - zbase) / 33.33); if ( tempX > -1 && tempX < 65 && tempZ > -1 && tempZ < 65) { // Booty Bay has some strange out of range errors fullMap[tempX][tempZ] = 'M'; } } // Prriiiiint sprintf(filename, "/Users/elliot/Documents/code/cpp/lolmap/modeltiledata/%s_%d_%d.map", gWorld->basename.c_str(), x, z); std::ofstream mapOut(filename); for (int j = 0; j < 16; j++) { for (int i = 0; i < 16; i++) { mapOut << fullMap[j][i]; } mapOut << "\n"; } mapOut.close(); // END FUCKERY