MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / main

Function main

FloorsExtractor/main.cpp:62–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62int main( const int argc, const char* const argv[] )
63{
64 const char* floors_file_name= "FLOORS.01";
65 if( argc > 1 )
66 floors_file_name= argv[1];
67
68 char out_file_name[256];
69 std::strcpy( out_file_name, floors_file_name );
70 std::strcpy( out_file_name + std::strlen( floors_file_name ), ".tga" );
71
72 FILE* const file= std::fopen( floors_file_name, "rb" );
73 if( file == nullptr )
74 {
75 std::cout << "Could not read file \"" << floors_file_name << "\"" << std::endl;
76 return -1;
77 }
78
79 std::vector<unsigned char> file_data( g_floors_in_file * g_floor_texture_data_size );
80
81 std::fseek( file, g_header_size, SEEK_SET );
82 FileRead( file, file_data.data(), file_data.size() );
83
84 std::fclose( file );
85
86 Palette palette;
87 LoadPalette( palette );
88
89 const std::vector<unsigned char> floors_repacked= RepackFloors( file_data );
90
91 WriteTGA(
92 g_floor_texture_size, floors_repacked.size() / g_floor_texture_size,
93 floors_repacked.data(),
94 palette.data(),
95 out_file_name );
96}

Callers

nothing calls this directly

Calls 4

FileReadFunction · 0.85
RepackFloorsFunction · 0.85
WriteTGAFunction · 0.85
LoadPaletteFunction · 0.50

Tested by

no test coverage detected