MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ReadTerrainHeightChunk

Function ReadTerrainHeightChunk

Descent3/LoadLevel.cpp:2877–2894  ·  view source on GitHub ↗

Reads information about the terrain mesh

Source from the content-addressed store, hash-verified

2875
2876// Reads information about the terrain mesh
2877void ReadTerrainHeightChunk(CFILE *fp, int version) {
2878 int i;
2879
2880 if (version <= 31) {
2881 for (i = 0; i < TERRAIN_DEPTH * TERRAIN_WIDTH; i++)
2882 Terrain_seg[i].ypos = cf_ReadByte(fp);
2883 } else {
2884 uint8_t *byte_vals = (uint8_t *)mem_malloc(TERRAIN_DEPTH * TERRAIN_WIDTH);
2885 ReadCompressionByte(fp, byte_vals, TERRAIN_DEPTH * TERRAIN_WIDTH);
2886
2887 for (i = 0; i < TERRAIN_DEPTH * TERRAIN_WIDTH; i++) {
2888 Terrain_seg[i].ypos = byte_vals[i];
2889 AppendToLevelChecksum(Terrain_seg[i].ypos);
2890 }
2891
2892 mem_free(byte_vals);
2893 }
2894}
2895
2896void ReadGamePathsChunk(CFILE *fp, int version) {
2897 // Currently, we will have no version specific info

Callers 1

ReadTerrainChunksFunction · 0.85

Calls 3

cf_ReadByteFunction · 0.85
ReadCompressionByteFunction · 0.85
AppendToLevelChecksumFunction · 0.85

Tested by

no test coverage detected