#Initialization
Init:
  #We only rely on those tiles...
  ColorIt.addTileCrc +192, +207
  #For debugging
#  ColorIt.autoShowVramCrc = true

#Fall down here to set the default profile upon initialization
[Default]:
  #Create a gray palette
  ColorIt.setPalette 0, 0xffffff, 0xa8a8a8, 0x585858, 0x000000
  #By default, we use the standard gray palette for everything
  ColorIt.addTileRule 0, 383, 0
  End


#Title Screen
[3a6d081b]:
  ColorIt.setPalette 0, 0xffffff, 0xa8a8a8, 0x585858, 0x000000
  ColorIt.setPalette 1, 0xffffff, rgb(96,144,255), rgb(0,0,128), 0
  ColorIt.setPalette 2, 0xffffff, rgb(64,192,255), 0, 0
  ColorIt.setPalette 3, 0xffffff, rgb(0,192,0), 0, 0
  ColorIt.setPalette 4, 0xffffff, rgb(0,255,0), 0, 0
  ColorIt.setPalette 5, 0xffffff, rgb(255,192,128), rgb(255, 0, 0), 0

  ColorIt.addTileRule 0, 383, 0
  ColorIt.addTileRule +176, +255, 1
  ColorIt.addTileRule +188, 2
  ColorIt.addTileRule +191, 2
  ColorIt.addTileRule +204, +205, 2
  ColorIt.addTileRule +0, +8, 1
  ColorIt.addTileRule +192, +198, 1
  ColorIt.addTileRule +16, +19, 1
  ColorIt.addTileRule 148, 2
  ColorIt.addTileRule 137, 139, 3
  ColorIt.addTileRule 172, 4

  #Mario
  ColorIt.addTileRule 140, 143, 5
  ColorIt.addTileRule 149, 150, 5
  End


#Level 2
[7964f24a]:
  #Bleu eau
  ColorIt.setPalette 1, 0xffffff, rgb(192,224,255), rgb(0,128,255), 0
  ColorIt.setPalette 3, 0xffffff, rgb(128,192,128), 0, rgb(0,96,0)
  ColorIt.setPalette 4, 0xffffff, rgb(192,192,255), rgb(128,128,192), rgb(64,64,128)
  #Bleu ciel
  ColorIt.setPalette 7, 0xffffff, rgb(128,192,255), rgb(0,0,255), 0
  #Pont
  ColorIt.setPalette 9, 0xffffff, 0, 0, rgb(128,64,0)
  ColorIt.setPalette 10, 0xffffff, 0, 0, rgb(0,0,64)
  ColorIt.setPalette 11, 0xffffff, rgb(128,224,128), rgb(64,192,64), rgb(0,128,0)

  #Hippocampes
  ColorIt.setPalette 24, 0xffffff, rgb(200,150,255), rgb(128,64,192), rgb(64,0,64)
  #Boule de feu
  ColorIt.setPalette 28, 0xffffff, rgb(255,200,0), rgb(224,0,0), rgb(128,0,0)

  #Arrivée
  ColorIt.addTileRule +214, 17

  #Eau
  ColorIt.addTileRule +221, 1
  ColorIt.addTileRule +202, 1
  ColorIt.addTileRule +222, 1

  ColorIt.addTileRule +224, +227, 3

  #Bords plate-formes
  ColorIt.addTileRule +177, 3
  ColorIt.addTileRule +218, 3

  #Soucoupe
  ColorIt.addTileRule +179, +193, 4
  ColorIt.addTileRule +216, +217, 4

  ColorIt.addTileRule +201, 4
  ColorIt.addTileRule +203, +213, 4
  ColorIt.addTileRule +215, 4

  #Algues
  ColorIt.addTileRule +219, +220, 11

  #Nuages
  ColorIt.addTileRule +197, +200, 7

  #"Pont"
  ColorIt.addTileRule +228, 9

  #Sol 2-2
  ColorIt.addTileRule +229, +234, 10

  #Poissons
  ColorIt.addTileRule +64, +65, 7
  ColorIt.addTileRule +80, +81, 7

  ColorIt.addTileRule +68, +71, 7
  ColorIt.addTileRule +84, +90, 7

  ColorIt.addTileRule +40, +41, 7
  ColorIt.addTileRule +56, +57, 7

  
  #Hippocampe
  ColorIt.addTileRule +36, +39, 24
  ColorIt.addTileRule +52, +55, 24

  #Pieuvre
  ColorIt.addTileRule +32, +35, 24
  ColorIt.addTileRule +48, +51, 24

  #Boule de feu
  ColorIt.addTileRule +98, +99, 28
  ColorIt.addTileRule +42, +43, 28

  Goto Common
  End


#Level 1
[65acd377]:
  #Bleu ciel
  ColorIt.setPalette 1, 0xffffff, rgb(128,192,255), rgb(0,0,255), 0
  #3-4 unused
  #Sol
  ColorIt.setPalette 7, 0xffffff, rgb(205,162,103), rgb(120,104,24), 0
  ColorIt.setPalette 9, 0xffffff, 0, 0, rgb(0, 128, 0)
  ColorIt.setPalette 10, 0xffffff, rgb(255,192,64), rgb(128,64,0), 0

  #Sky gradient
  ColorIt.setPalette 11, rgb(96,176,255), rgb(64,160,255), rgb(32,144,255), rgb(0,128,255)
  ColorIt.setPalette 12, rgb(224,240,255), rgb(192,224,255), rgb(160,208,255), rgb(128,192,255)

  #Lions
  ColorIt.setPalette 24, 0xffffff, rgb(255,200,0), rgb(224,0,0), 0


  ColorIt.addTileRule 0, 383, 0

  #BG
  ColorIt.addTileRule +193, +199, 1
  ColorIt.addTileRule +187, 1

  ColorIt.addTileRule +232, +234, 9


  #Sol
  ColorIt.addTileRule +104, 7
  ColorIt.addTileRule +224, +225, 7

  ColorIt.addTileRule +183, 7

  #Pierres temple
  ColorIt.addTileRule +93, +94, 10
  ColorIt.addTileRule +191, 10
  ColorIt.addTileRule +205, +206, 10
  ColorIt.addTileRule +228, +230, 10
  ColorIt.addTileRule +235, +238, 10

  #Bougie temple
  ColorIt.addTileRule +181, 16
  ColorIt.addTileRule +221, 16

  #Pour le ciel
  #Game boy tile format: pixels are packed by 16 bits (representing a tile line). Each byte contains 8 pixels (0 = off, 1 = on). The first byte contains the light plane (1), the second the dark plane (2). Both set on will do black (3).
  ColorIt.setTilesetData 0, "ffffffff 00ff00ff ff00ff00 00000000"
  ColorIt.setTile +211, 0
  ColorIt.setTile +192, 0
  #Sky gradient 1 & 2
  ColorIt.addTileRule +211, 11
  ColorIt.addTileRule +192, 12

  #Sprites
  #Mouche
  ColorIt.addTileRule +32, +35, 18
  ColorIt.addTileRule +40, +41, 18
  ColorIt.addTileRule +48, +51, 18
  #Mouche 2
  ColorIt.addTileRule +64, +67, 18
  ColorIt.addTileRule +72, +73, 18
  ColorIt.addTileRule +80, +83, 18

  #Quatrième tile de l'arrivée
  ColorIt.addTileRule +185, 17

  #Lions dans le 1-3
  ColorIt.addTileRule +36, +39, 24
  ColorIt.addTileRule +52, +57, 24
  ColorIt.addTileRule +97, +98, 24

  ColorIt.addTileRule +68, +71, 24
  ColorIt.addTileRule +74, +78, 24
  ColorIt.addTileRule +84, +92, 24
  ColorIt.addTileRule +43, 24
  ColorIt.addTileRule +59, 24

  #Blocs
#  ColorIt.addTileRule +226, +227, 22

  Goto common
  End


Common:
  #BG
  ColorIt.setPalette 0, 0xffffff, 0xa8a8a8, 0x585858, 0x000000
  #Vert tuyau
  ColorIt.setPalette 2, 0xffffff, rgb(0,255,0), rgb(0,128,0), 0
  #Texte
  ColorIt.setPalette 5, 0xffffff, 0, 0, rgb(0, 0, 128)
  ColorIt.setPalette 6, 0xffffff, rgb(255,192,0), rgb(128,128,0), rgb(0, 0, 128)

  ColorIt.setPalette 8, 0xffffff, rgb(168,168,192), rgb(88,88,96), 0x000000

  #Sprites 1
  ColorIt.setPalette 16, 0xffffff, rgb(255,192,128), rgb(192,0,0), 0
  ColorIt.setPalette 17, 0xffffff, rgb(128,255,128), rgb(0,192,0), 0
  ColorIt.setPalette 18, 0xffffff, rgb(140,140,255), rgb(0,0,192), 0
  #Pièce
  ColorIt.setPalette 19, 0xffffff, rgb(255,255,0), rgb(128,128,0), 0
  ColorIt.setPalette 20, 0xffffff, rgb(255,200,147), 0, rgb(112,56,0)
  ColorIt.setPalette 21, 0xffffff, rgb(0,255,0), rgb(0,192,0), rgb(0,0,0)
  #Blocs 1
  ColorIt.setPalette 22, 0xffffff, rgb(96,192,96), rgb(192,0,0), 0
  #Blocs 2
  ColorIt.setPalette 23, 0xffffff, rgb(255,128,128), rgb(192,0,0), 0
  #Daisy
  ColorIt.setPalette 25, 0xffffff, rgb(255,192,128), rgb(255,128,0), 0
  ColorIt.setPalette 26, 0xffffff, rgb(128,255,128), rgb(0,192,0), 0
  ColorIt.setPalette 27, 0xffffff, 0, 0, rgb(255,192,0)

  #Tiles standard BG
  ColorIt.addTileRule +240, +254, 2
  ColorIt.addTileRule +22, +27, 21
  ColorIt.addTileRule +128, +146, 5
  ColorIt.addTileRule +148, +160, 5
  ColorIt.addTileRule +162, +163, 5
  ColorIt.addTileRule +165, +169, 5
  ColorIt.addTileRule +171, 5
  ColorIt.addTileRule +170, 6
  #Arrivée
  ColorIt.addTileRule +147, 17
  ColorIt.addTileRule +161, 17
  ColorIt.addTileRule +164, 17
  #La quatrième tile dépend du niveau...


  #Mario
  ColorIt.addTileRule 0, 5, 16
  ColorIt.addTileRule 8, 11, 16
  ColorIt.addTileRule 15, 23, 16
  ColorIt.addTileRule 24, 27, 16
  ColorIt.addTileRule 31, 37, 16
  ColorIt.addTileRule 40, 43, 16
  ColorIt.addTileRule 48, 59, 16
  ColorIt.addTileRule 64, 71, 16
  ColorIt.addTileRule +100, 16
  #En avion
  ColorIt.addTileRule 100, 109, 16
  ColorIt.addTileRule 112, 118, 16
  ColorIt.addTileRule 122, 16
  ColorIt.addTileRule 119, 121, 26


  #Daisy
  ColorIt.addTileRule 12, 13, 25
  ColorIt.addTileRule 28, 29, 25
  ColorIt.addTileRule 46, 47, 25
  ColorIt.addTileRule 62, 63, 25
  ColorIt.addTileRule 72, 75, 25
  ColorIt.addTileRule 78, 25
  ColorIt.addTileRule 80, 81, 25

  ColorIt.addTileRule 6, 7, 19
  ColorIt.addTileRule 38, 39, 19

  #The End
  ColorIt.addTileRule 82, 95, 22

  #Goomba
  ColorIt.addTileRule +16, +17, 20

  #Plante
  ColorIt.addTileRule +18, +21, 17

  #Pièce
  ColorIt.addTileRule +116, 19
  #Plate-forme mouvante
  ColorIt.addTileRule +107, +111, 18


  #Blocs gris fin de niveau
  ColorIt.addTileRule +14, +15, 8

  #Flèche descendante mouche
  ColorIt.addTileRule +44, 19
  ColorIt.addTileRule +60, 19

  #Plate-forme mini jeu
  ColorIt.addTileRule +173, +176, 22

  #Fleur mini jeu
  ColorIt.addTileRule +101, 17

  #Blocs
  ColorIt.addTileRule +255, 22
  ColorIt.addTileRule +0, +2, 22

  #Power ups
  ColorIt.addTileRule +3, 16
  ColorIt.addTileRule +4, 23
  ColorIt.addTileRule +5, 19
  ColorIt.addTileRule +6, 27
  ColorIt.addTileRule +118, +120, 19

  End


