Minor patchs
This commit is contained in:
parent
18514e6ad3
commit
b959c5fff2
@ -117,16 +117,19 @@ static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char
|
|||||||
opt_ptr->verbose_mode = 1;
|
opt_ptr->verbose_mode = 1;
|
||||||
printf("[OPTN] Verbose enabled.\n");
|
printf("[OPTN] Verbose enabled.\n");
|
||||||
} else if (strcmp(p_args[i], "-vv") == 0) {
|
} else if (strcmp(p_args[i], "-vv") == 0) {
|
||||||
|
opt_ptr->verbose_mode = 1;
|
||||||
opt_ptr->debug_mode = 1;
|
opt_ptr->debug_mode = 1;
|
||||||
printf("[OPTN] Debug enabled.\n");
|
printf("[OPTN] Debug enabled.\n");
|
||||||
} else if (strcmp(p_args[i], "-vvv") == 0) {
|
} else if (strcmp(p_args[i], "-vvv") == 0) {
|
||||||
|
opt_ptr->verbose_mode = 1;
|
||||||
|
opt_ptr->debug_mode = 1;
|
||||||
opt_ptr->god_mode = 1;
|
opt_ptr->god_mode = 1;
|
||||||
printf("[OPTN] God damn it!\n");
|
printf("[OPTN] God damn it!\n");
|
||||||
} else if (strcmp(p_args[i], "-subdir") == 0) {
|
} else if (strcmp(p_args[i], "-subdir") == 0) {
|
||||||
opt_ptr->output_dir = 0;
|
opt_ptr->output_dir = 0;
|
||||||
printf("[OPTN] Export to sub-directory.\n");
|
printf("[OPTN] Export to sub-directory.\n");
|
||||||
} else if (strcmp(p_args[i], "-neg") == 0) {
|
} else if (strcmp(p_args[i], "-neg") == 0) {
|
||||||
opt_ptr->neg_heightmap = 1;
|
opt_ptr->inverted_HM = 1;
|
||||||
printf("[OPTN] Negative heightmap output mode.\n");
|
printf("[OPTN] Negative heightmap output mode.\n");
|
||||||
} else {
|
} else {
|
||||||
printf("[ERR] Unknown option: %s\n", p_args[i]);
|
printf("[ERR] Unknown option: %s\n", p_args[i]);
|
||||||
|
@ -76,7 +76,7 @@ unsigned char parseHMPFile(const char* fileName, T_TERRAIN* hmp_struct, T_PROG_O
|
|||||||
memcpy(tiles, memFile + tiles_offset, ((T_HMPFILE_HEADER *)memFile)->tiles_count * sizeof(T_HMPFILE_TILE));
|
memcpy(tiles, memFile + tiles_offset, ((T_HMPFILE_HEADER *)memFile)->tiles_count * sizeof(T_HMPFILE_TILE));
|
||||||
|
|
||||||
// Convert tiles datas to raw heightmap
|
// Convert tiles datas to raw heightmap
|
||||||
processTilesToHeightmap(hmp_struct, tiles_indices, tiles, p_opts->neg_heightmap);
|
processTilesToHeightmap(hmp_struct, tiles_indices, tiles, p_opts->inverted_HM);
|
||||||
// Convert tiles datas to terrain vertices
|
// Convert tiles datas to terrain vertices
|
||||||
processHeighmapToVertices(hmp_struct, y_scale);
|
processHeighmapToVertices(hmp_struct, y_scale);
|
||||||
free(tiles);
|
free(tiles);
|
||||||
@ -111,7 +111,7 @@ void cleanUpResources(T_TERRAIN* terrain) {
|
|||||||
free(terrain);
|
free(terrain);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void processTilesToHeightmap(T_TERRAIN* terrain, const T_TILE_INDICES* tiles_indices, const T_HMPFILE_TILE* tiles, const unsigned char negativeOutput) {
|
static void processTilesToHeightmap(T_TERRAIN* terrain, const T_TILE_INDICES* tiles_indices, const T_HMPFILE_TILE* tiles, const unsigned char inv_output) {
|
||||||
T_TILE_INDICES tiles_idx;
|
T_TILE_INDICES tiles_idx;
|
||||||
unsigned int i,j,k,l;
|
unsigned int i,j,k,l;
|
||||||
unsigned int heightmap_size_w = terrain->width * TERRAIN_TILE_SAMPLING;
|
unsigned int heightmap_size_w = terrain->width * TERRAIN_TILE_SAMPLING;
|
||||||
@ -131,7 +131,7 @@ static void processTilesToHeightmap(T_TERRAIN* terrain, const T_TILE_INDICES* ti
|
|||||||
// Get the 5x5 bytes height values for this tile
|
// Get the 5x5 bytes height values for this tile
|
||||||
for ( k = 0; k < TERRAIN_TILE_SAMPLING; k++ ) {
|
for ( k = 0; k < TERRAIN_TILE_SAMPLING; k++ ) {
|
||||||
for ( l = 0; l < TERRAIN_TILE_SAMPLING; l++ ) {
|
for ( l = 0; l < TERRAIN_TILE_SAMPLING; l++ ) {
|
||||||
if (negativeOutput) {
|
if (inv_output) {
|
||||||
// Invert Z to set 0,0 origin at bottom left of terrain
|
// Invert Z to set 0,0 origin at bottom left of terrain
|
||||||
terrain->heightmap[i*TERRAIN_TILE_SAMPLING+k][(heightmap_size_h-1) - (j*TERRAIN_TILE_SAMPLING+l)] =
|
terrain->heightmap[i*TERRAIN_TILE_SAMPLING+k][(heightmap_size_h-1) - (j*TERRAIN_TILE_SAMPLING+l)] =
|
||||||
tiles[tiles_idx].height_values[l][k] + 128;
|
tiles[tiles_idx].height_values[l][k] + 128;
|
||||||
|
@ -21,7 +21,7 @@ typedef union u_prog_options {
|
|||||||
unsigned char verbose_mode:1; //!< Output simple details about ID and other "light" things.
|
unsigned char verbose_mode:1; //!< Output simple details about ID and other "light" things.
|
||||||
|
|
||||||
unsigned char output_dir:1; //!< Export extracted datas to a sub-directory.
|
unsigned char output_dir:1; //!< Export extracted datas to a sub-directory.
|
||||||
unsigned char neg_heightmap:1; //!< Enable negative heightmap output.
|
unsigned char inverted_HM:1; //!< Enable negative heightmap output.
|
||||||
|
|
||||||
unsigned char reserved0:6; //!< For future use.
|
unsigned char reserved0:6; //!< For future use.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user