##-----------------------------LICENSE NOTICE------------------------------------
##  This file is part of CPCtelera: An Amstrad CPC Game Engine 
##  Copyright (C) 2018 ronaldo / Fremos / Cheesetea / ByteRealms (@FranGallegoBR)
##
##  This program is free software: you can redistribute it and/or modify
##  it under the terms of the GNU Lesser General Public License as published by
##  the Free Software Foundation, either version 3 of the License, or
##  (at your option) any later version.
##
##  This program is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##  GNU Lesser General Public License for more details.
##
##  You should have received a copy of the GNU Lesser General Public License
##  along with this program.  If not, see <http://www.gnu.org/licenses/>.
##------------------------------------------------------------------------------
############################################################################
##                        CPCTELERA ENGINE                                ##
##                 Automatic compression utilities                        ##
##------------------------------------------------------------------------##
## This file is intended for users to automate the generation of          ##
## compressed files and their inclusion in users' projects.               ##
############################################################################

## COMPRESSION EXAMPLE (Uncomment lines to use)
##

## First 3 calls to ADD2PACK add enemy, hero and background
## graphics (previously converted to binary data) into the 
## compressed group 'mygraphics'. After that, call to PACKZX7B
## compresses all the data and generates an array with the result
## that is placed in src/mygraphics.c & src/mygraphics.h, ready
## to be included and used by other modules.
##
#$(eval $(call ADD2PACK,mygraphics,gfx/enemy.bin))
#$(eval $(call ADD2PACK,mygraphics,gfx/hero.bin))
#$(eval $(call ADD2PACK,mygraphics,gfx/background.bin))
#$(eval $(call PACKZX7B,mygraphics,src/))
$(eval $(call ADD2PACK,home,gfx/home.bin))
$(eval $(call PACKZX7B,home,src/maps/))
$(eval $(call ADD2PACK,park,gfx/park.bin))
$(eval $(call PACKZX7B,park,src/maps/))
$(eval $(call ADD2PACK,mall,gfx/mall.bin))
$(eval $(call PACKZX7B,mall,src/maps/))
$(eval $(call ADD2PACK,beach,gfx/beach.bin))
$(eval $(call PACKZX7B,beach,src/maps/))
$(eval $(call ADD2PACK,street,gfx/street.bin))
$(eval $(call PACKZX7B,street,src/maps/))
$(eval $(call ADD2PACK,office,gfx/office.bin))
$(eval $(call PACKZX7B,office,src/maps/))
$(eval $(call ADD2PACK,office2,gfx/office2.bin))
$(eval $(call PACKZX7B,office2,src/maps/))
$(eval $(call ADD2PACK,mountain,gfx/mountain.bin))
$(eval $(call PACKZX7B,mountain,src/maps/))
$(eval $(call ADD2PACK,castle,gfx/castle.bin))
$(eval $(call PACKZX7B,castle,src/maps/))
$(eval $(call ADD2PACK,empty,gfx/empty.bin))
$(eval $(call PACKZX7B,empty,src/maps/))
$(eval $(call ADD2PACK,bottom,gfx/bottom.bin))
$(eval $(call PACKZX7B,bottom,src/maps/))
$(eval $(call ADD2PACK,market,gfx/market.bin))
$(eval $(call PACKZX7B,market,src/maps/))
$(eval $(call ADD2PACK,camping,gfx/camping.bin))
$(eval $(call PACKZX7B,camping,src/maps/))
$(eval $(call ADD2PACK,cavern1,gfx/cavern1.bin))
$(eval $(call PACKZX7B,cavern1,src/maps/))
$(eval $(call ADD2PACK,cavern2,gfx/cavern2.bin))
$(eval $(call PACKZX7B,cavern2,src/maps/))
$(eval $(call ADD2PACK,sky1,gfx/sky1.bin))
$(eval $(call PACKZX7B,sky1,src/maps/))
$(eval $(call ADD2PACK,sky2,gfx/sky2.bin))
$(eval $(call PACKZX7B,sky2,src/maps/))
$(eval $(call ADD2PACK,fountain,gfx/fountain.bin))
$(eval $(call PACKZX7B,fountain,src/maps/))
$(eval $(call ADD2PACK,basket,gfx/basket.bin))
$(eval $(call PACKZX7B,basket,src/maps/))
$(eval $(call ADD2PACK,cottage,gfx/cottage.bin))
$(eval $(call PACKZX7B,cottage,src/maps/))
$(eval $(call ADD2PACK,golf,gfx/golf.bin))
$(eval $(call PACKZX7B,golf,src/maps/))
$(eval $(call ADD2PACK,harbour,gfx/harbour.bin))
$(eval $(call PACKZX7B,harbour,src/maps/))
$(eval $(call ADD2PACK,hospital,gfx/hospital.bin))
$(eval $(call PACKZX7B,hospital,src/maps/))
$(eval $(call ADD2PACK,train,gfx/train.bin))
$(eval $(call PACKZX7B,train,src/maps/))
$(eval $(call ADD2PACK,train_empty,gfx/train_empty.bin))
$(eval $(call PACKZX7B,train_empty,src/maps/))
$(eval $(call ADD2PACK,well,gfx/well.bin))
$(eval $(call PACKZX7B,well,src/maps/))
$(eval $(call ADD2PACK,encounters,gfx/encounters.bin))
$(eval $(call PACKZX7B,encounters,src/maps/))
$(eval $(call ADD2PACK,bottom2,gfx/bottom2.bin))
$(eval $(call PACKZX7B,bottom2,src/maps/))
$(eval $(call ADD2PACK,bottom3,gfx/bottom3.bin))
$(eval $(call PACKZX7B,bottom3,src/maps/))
$(eval $(call ADD2PACK,calendar,gfx/calendar.bin))
$(eval $(call PACKZX7B,calendar,src/))
$(eval $(call ADD2PACK,ende_normal,gfx/ende_normal.bin))
$(eval $(call PACKZX7B,ende_normal,src/maps/))
$(eval $(call ADD2PACK,ende_good,gfx/ende_good.bin))
$(eval $(call PACKZX7B,ende_good,src/maps/))
$(eval $(call ADD2PACK,ende_bad,gfx/ende_bad.bin))
$(eval $(call PACKZX7B,ende_bad,src/maps/))

############################################################################
##              DETAILED INSTRUCTIONS AND PARAMETERS                      ##
##------------------------------------------------------------------------##
##                                                                        ##
## Macros used for compression are ADD2PACK and PACKZX7B:                 ##
##                                                                        ##
##	ADD2PACK: Adds files to packed (compressed) groups. Each call to this ##
##  		  macro will add a file to a named compressed group.          ##
##  PACKZX7B: Compresses all files in a group into a single binary and    ##
##            generates a C-array and a header to comfortably use it from ##
##            inside your code.                                           ##
##                                                                        ##
##------------------------------------------------------------------------##
##                                                                        ##
##  $(eval $(call ADD2PACK,<packname>,<file>))                            ##
##                                                                        ##
##		Sequentially adds <file> to compressed group <packname>. Each     ##
## call to this macro adds a new <file> after the latest one added.       ##
## packname could be any valid C identifier.                              ##
##                                                                        ##
##  Parameters:                                                           ##
##  (packname): Name of the compressed group where the file will be added ##
##  (file)    : File to be added at the end of the compressed group       ##
##                                                                        ##
##------------------------------------------------------------------------##
##                                                                        ##
##  $(eval $(call PACKZX7B,<packname>,<dest_path>))                       ##
##                                                                        ##
##		Compresses all files in the <packname> group using ZX7B algorithm ##
## and generates 2 files: <packname>.c and <packname>.h that contain a    ##
## C-array with the compressed data and a header file for declarations.   ##
## Generated files are moved to the folder <dest_path>.                   ##
##                                                                        ##
##  Parameters:                                                           ##
##  (packname) : Name of the compressed group to use for packing          ##
##  (dest_path): Destination path for generated output files              ##
##                                                                        ##
############################################################################
##                                                                        ##
## Important:                                                             ##
##  * Do NOT separate macro parameters with spaces, blanks or other chars.##
##    ANY character you put into a macro parameter will be passed to the  ##
##    macro. Therefore ...,src/sprites,... will represent "src/sprites"   ##
##    folder, whereas ...,  src/sprites,... means "  src/sprites" folder. ##
##  * You can omit parameters by leaving them empty.                      ##
##  * Parameters (4) and (5) are optional and generally not required.     ##
############################################################################
