//-------------------------------------------------------------------------- int UnitPakFiles(FileList &source_list, const char *output_path) { if (source_list.containsItems() == 0) { return(_pak_files_ok); } Surface surface; int frameCount; frameCount = source_list.containsItems(); if (LoadSurface(source_list.getString(0), surface) == _load_surface_invalid_type) { return _pak_files_invalid_source; } Surface workSurface(surface.getPixX(), surface.getPixY(), surface.getPixX(), frameCount); workSurface.fillAll(0); for (int i = 0; i < frameCount; i++) { workSurface.setFrame(i); if (LoadSurface(source_list.getString(i), surface) == _load_surface_invalid_type) { return _pak_files_invalid_source; } PIX background = surface.getPixel(0, 0); // Walk through the surface image and suck out the shadow. for (int x = 0; x < surface.getPixX(); x++) { for (int y = 0; y < surface.getPixY(); y++) { PIX color = surface.getPixel(x, y); if (color != background) { workSurface.putPixel(x, y, color); } } } } PackedSurface packedSurface; packedSurface.pack(workSurface); packedSurface.save(output_path); return _pak_files_ok; }
int PakFiles( FileList &source_list, const char *output_path ) { //char buffer[1024]; //char output_file[256]; //char output_path[1024]; //char *token; //char fname[_MAX_FNAME]; //char ext[_MAX_EXT]; if ( source_list.containsItems() == 0 ) return( _pak_files_ok ); /* _splitpath( source_list.getString( 0 ), 0, 0, fname, ext ); token = strtok( fname, "0123456789" ); strcpy( output_file, token ); strcpy( pak_file_name, output_file ); strcat( pak_file_name, ".pak" ); strcpy( output_path, output_dir ); strcat( output_path, output_file ); strcat( output_path, ".pak" ); */ Surface surface; int frame_count; Palette pal; pal.initNoColorTables("netp.act"); frame_count = source_list.containsItems(); if ( LoadSurface( source_list.getString( 0 ), surface ) == _load_surface_invalid_type ) return( _pak_files_invalid_source ); Surface work_surface( surface.getPixX(), surface.getPixY(), surface.getPixX(), frame_count ); for( int i = 0; i < frame_count; i++ ) { work_surface.setFrame(i); if ( LoadSurface( source_list.getString( i ), surface ) == _load_surface_invalid_type ) return( _pak_files_invalid_source ); work_surface.fill(Color::orange); surface.blt(work_surface); } PackedSurface packedSurface; packedSurface.pack(work_surface); packedSurface.save(output_path); surface.free(); packedSurface.free(); work_surface.free(); return( _pak_files_ok ); }