From b959c5fff23fb71864579c0e87e21ec84008fae4 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Wed, 3 Aug 2022 22:26:45 +0200 Subject: [PATCH] Minor patchs --- src/Terrain-Extractor.c | 5 ++++- src/hmp_parser.c | 6 +++--- src/options.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Terrain-Extractor.c b/src/Terrain-Extractor.c index f555efb..01bd59f 100644 --- a/src/Terrain-Extractor.c +++ b/src/Terrain-Extractor.c @@ -117,16 +117,19 @@ static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char opt_ptr->verbose_mode = 1; printf("[OPTN] Verbose enabled.\n"); } else if (strcmp(p_args[i], "-vv") == 0) { + opt_ptr->verbose_mode = 1; opt_ptr->debug_mode = 1; printf("[OPTN] Debug enabled.\n"); } else if (strcmp(p_args[i], "-vvv") == 0) { + opt_ptr->verbose_mode = 1; + opt_ptr->debug_mode = 1; opt_ptr->god_mode = 1; printf("[OPTN] God damn it!\n"); } else if (strcmp(p_args[i], "-subdir") == 0) { opt_ptr->output_dir = 0; printf("[OPTN] Export to sub-directory.\n"); } 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"); } else { printf("[ERR] Unknown option: %s\n", p_args[i]); diff --git a/src/hmp_parser.c b/src/hmp_parser.c index b9dc1a3..697a8ec 100644 --- a/src/hmp_parser.c +++ b/src/hmp_parser.c @@ -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)); // 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 processHeighmapToVertices(hmp_struct, y_scale); free(tiles); @@ -111,7 +111,7 @@ void cleanUpResources(T_TERRAIN* 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; unsigned int i,j,k,l; 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 for ( k = 0; k < TERRAIN_TILE_SAMPLING; k++ ) { 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 terrain->heightmap[i*TERRAIN_TILE_SAMPLING+k][(heightmap_size_h-1) - (j*TERRAIN_TILE_SAMPLING+l)] = tiles[tiles_idx].height_values[l][k] + 128; diff --git a/src/options.h b/src/options.h index c619957..5c3c70b 100644 --- a/src/options.h +++ b/src/options.h @@ -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 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.