72 lines
1.7 KiB
C
72 lines
1.7 KiB
C
/**
|
|
* @file hmp_struct.h
|
|
* @date 22/08/2022
|
|
* @author JackCarterSmith
|
|
* @copyright GPL-v3.0
|
|
* @brief HMP file mapping definition.
|
|
*
|
|
*/
|
|
|
|
#ifndef RSPTERRAINLIB_HMP_STRUCT_H_
|
|
#define RSPTERRAINLIB_HMP_STRUCT_H_
|
|
|
|
|
|
/*
|
|
* long = 64bits??? (8 Bytes)
|
|
* int = 32bits (4 Bytes)
|
|
* short = 16bits (2 Bytes)
|
|
* char = 8bits (1 Bytes)
|
|
*/
|
|
|
|
#if defined(_MSC_VER)
|
|
#define PACK
|
|
#elif defined(__GNUC__)
|
|
#define PACK __attribute__((packed))
|
|
#endif
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// Declaration of Memory Mapped Structure
|
|
// Caution: the place of variable is important for correct mapping!
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#if defined(_MSC_VER)
|
|
#pragma pack(push, 1)
|
|
#endif
|
|
|
|
typedef struct PACK hmpfile_header {
|
|
unsigned int reserved0; //12B of zeros
|
|
unsigned int reserved1;
|
|
unsigned int reserved2;
|
|
|
|
float reserved3; // Always 0x3F000000
|
|
float height_scale;
|
|
float reserved4; // Always 0x3F000000
|
|
|
|
unsigned short tiles_count;
|
|
unsigned short unknown0;
|
|
|
|
unsigned int tiles_start_offset;
|
|
unsigned int unknown1; // Offset to some datas?
|
|
|
|
unsigned short width_BLK;
|
|
unsigned short height_BLK;
|
|
} T_HMPFILE_HEADER;
|
|
|
|
typedef unsigned short T_TILE_INDICES;
|
|
|
|
typedef struct PACK hmpfile_tile {
|
|
unsigned short texmap_id;
|
|
|
|
unsigned char unknown0;
|
|
unsigned char low_height; // LOD application? Clipping? Terrain render quadrants?
|
|
unsigned char high_height;
|
|
|
|
unsigned char height_values[5][5]; // first and last row/column overlap with a neighboring tile, "glue" for tiles, need to be identical to avoid "hill" effect
|
|
} T_HMPFILE_TILE;
|
|
|
|
#if defined(_MSC_VER)
|
|
#pragma pack(pop)
|
|
#endif
|
|
|
|
#endif /* RSPTERRAINLIB_HMP_STRUCT_H_ */
|