From 0eaf283a1b93fe0ec7ec1c8439885e3284764a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Fri, 28 Jun 2019 19:54:18 +0200 Subject: [PATCH] Add const to tex datatype --- programs/catTexture.h | 2 +- programs/chestTexture.h | 2 +- programs/cityTexture.h | 2 +- programs/grassNormalTexture.h | 2 +- programs/grassTexture.h | 2 +- programs/houseTexture.h | 2 +- programs/levelTexture1.h | 2 +- programs/levelTexture1Pal.h | 4 ++-- programs/levelTexture2.h | 2 +- programs/levelTexture3.h | 2 +- programs/plantTexture.h | 2 +- programs/sandNormalTexture.h | 2 +- programs/sandTexture.h | 2 +- programs/treeTexture.h | 2 +- tools/img2array.py | 4 ++-- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/programs/catTexture.h b/programs/catTexture.h index 96868d2..f59b0a1 100644 --- a/programs/catTexture.h +++ b/programs/catTexture.h @@ -4,7 +4,7 @@ #define CAT_TEXTURE_WIDTH 128 #define CAT_TEXTURE_HEIGHT 128 -uint8_t catTexture[49152] = { +const uint8_t catTexture[49152] = { 251,255,255,251,255,255,251,255,255,251,255,255,251,255,255,251,255,255,251,255, 255,251,255,255,251,255,255,251,255,255,251,255,255,251,255,255,251,255,255,251, 255,255,251,255,255,251,255,255,251,255,255,251,255,255,251,255,255,251,255,255, diff --git a/programs/chestTexture.h b/programs/chestTexture.h index 61868ba..6a440a5 100644 --- a/programs/chestTexture.h +++ b/programs/chestTexture.h @@ -4,7 +4,7 @@ #define CHEST_TEXTURE_WIDTH 128 #define CHEST_TEXTURE_HEIGHT 128 -uint8_t chestTexture[49152] = { +const uint8_t chestTexture[49152] = { 152,152,152,152,152,152,157,153,156,157,153,156,152,152,152,151,151,151,148,146, 147,142,142,142,147,147,147,150,146,148,150,148,150,146,146,146,142,142,142,140, 138,140,142,142,142,146,144,146,150,146,150,151,149,151,145,143,144,150,148,150, diff --git a/programs/cityTexture.h b/programs/cityTexture.h index 8c6d3f0..176004f 100644 --- a/programs/cityTexture.h +++ b/programs/cityTexture.h @@ -4,7 +4,7 @@ #define CITY_TEXTURE_WIDTH 256 #define CITY_TEXTURE_HEIGHT 256 -uint8_t cityTexture[196608] = { +const uint8_t cityTexture[196608] = { 35,24,34,62,46,59,38,32,37,38,23,38,37,30,41,66,47,64,41,25,44,40,29,41,39,25, 44,68,47,67,41,26,43,41,24,41,39,28,40,68,47,66,41,37,41,41,29,40,40,21,38,69, 48,73,42,26,41,41,26,43,40,28,39,69,52,66,42,36,41,41,26,41,40,33,43,69,50,66, diff --git a/programs/grassNormalTexture.h b/programs/grassNormalTexture.h index c178dbb..ccf2ffb 100644 --- a/programs/grassNormalTexture.h +++ b/programs/grassNormalTexture.h @@ -4,7 +4,7 @@ #define GRASSNORMAL_TEXTURE_WIDTH 128 #define GRASSNORMAL_TEXTURE_HEIGHT 128 -uint8_t grassNormalTexture[49152] = { +const uint8_t grassNormalTexture[49152] = { 141,154,240,163,160,245,170,171,247,164,168,249,160,163,246,161,166,244,166,166, 246,154,161,243,154,160,246,157,150,246,159,158,246,147,153,246,164,156,243,158, 165,246,148,149,243,153,149,243,152,146,241,151,164,238,171,167,244,160,165,245, diff --git a/programs/grassTexture.h b/programs/grassTexture.h index a020acd..70d9808 100644 --- a/programs/grassTexture.h +++ b/programs/grassTexture.h @@ -4,7 +4,7 @@ #define GRASS_TEXTURE_WIDTH 128 #define GRASS_TEXTURE_HEIGHT 128 -uint8_t grassTexture[49152] = { +const uint8_t grassTexture[49152] = { 113,116,49,113,112,53,133,134,54,86,97,52,65,84,47,75,81,46,133,132,62,133,129, 50,129,126,44,137,137,64,82,92,51,91,100,56,75,95,47,72,90,52,63,89,55,56,81,55, 103,106,48,113,118,43,140,79,58,170,80,65,104,69,53,72,108,65,169,117,44,188, diff --git a/programs/houseTexture.h b/programs/houseTexture.h index eba01f6..8d2bdd8 100644 --- a/programs/houseTexture.h +++ b/programs/houseTexture.h @@ -4,7 +4,7 @@ #define HOUSE_TEXTURE_WIDTH 128 #define HOUSE_TEXTURE_HEIGHT 128 -uint8_t houseTexture[49152] = { +const uint8_t houseTexture[49152] = { 137,118,93,137,118,93,137,118,93,137,118,93,137,118,93,137,118,93,137,118,93, 137,118,93,137,118,93,137,118,93,137,118,93,137,118,93,137,118,93,137,118,93, 137,118,93,137,118,93,137,118,93,137,118,93,137,118,93,137,118,93,137,118,93, diff --git a/programs/levelTexture1.h b/programs/levelTexture1.h index 47ac0ae..3519778 100644 --- a/programs/levelTexture1.h +++ b/programs/levelTexture1.h @@ -4,7 +4,7 @@ #define LEVEL1_TEXTURE_WIDTH 128 #define LEVEL1_TEXTURE_HEIGHT 128 -uint8_t level1Texture[49152] = { +const uint8_t level1Texture[49152] = { 86,62,39,86,63,42,89,67,43,96,71,44,95,70,44,91,67,43,93,69,44,93,70,45,97,71, 47,94,71,48,93,70,51,89,66,44,83,63,41,83,63,41,84,64,43,85,66,44,87,68,45,86, 67,45,90,66,50,93,68,51,91,70,51,90,68,50,93,71,51,89,67,48,87,68,45,90,71,46, diff --git a/programs/levelTexture1Pal.h b/programs/levelTexture1Pal.h index ad770d4..1066b70 100644 --- a/programs/levelTexture1Pal.h +++ b/programs/levelTexture1Pal.h @@ -1,7 +1,7 @@ #ifndef LEVEL1_TEXTURE_H #define LEVEL1_TEXTURE_H -uint16_t level1Palette[256] = { +const uint16_t level1Palette[256] = { 0,4226,8452,12678,16936,21162,25388,29614,35921,40147,44373,48599,52857,57083, 61309,65535,4193,8418,12611,16836,21029,25254,29447,33672,37865,42090,46283, 50508,54701,58926,63119,65264,2177,6402,8579,12804,14981,19206,21383,25608, @@ -26,7 +26,7 @@ uint16_t level1Palette[256] = { #define LEVEL1_TEXTURE_WIDTH 32 #define LEVEL1_TEXTURE_HEIGHT 32 -uint8_t level1Texture[1024] = { +const uint8_t level1Texture[1024] = { 20,20,21,20,20,20,20,20,20,20,20,21,21,22,22,21,21,20,21,21,21,21,21,20,21,21, 21,21,21,20,20,20,26,26,24,20,25,25,25,25,25,25,25,24,25,25,24,25,25,21,21,25, 26,25,24,24,25,25,26,26,26,26,26,25,22,22,22,20,25,25,22,22,22,22,22,22,22,22, diff --git a/programs/levelTexture2.h b/programs/levelTexture2.h index 27508fa..5ed52e2 100644 --- a/programs/levelTexture2.h +++ b/programs/levelTexture2.h @@ -4,7 +4,7 @@ #define LEVEL2_TEXTURE_WIDTH 128 #define LEVEL2_TEXTURE_HEIGHT 128 -uint8_t level2Texture[49152] = { +const uint8_t level2Texture[49152] = { 108,104,94,87,83,76,75,71,65,105,103,96,71,70,65,99,96,88,75,71,65,107,104,95, 100,96,85,103,98,92,109,102,93,102,97,91,114,108,102,84,80,75,100,96,88,95,92, 85,93,90,82,100,97,91,86,82,76,92,89,83,96,92,85,102,99,90,119,114,106,119,116, diff --git a/programs/levelTexture3.h b/programs/levelTexture3.h index a95e31a..a84ea7b 100644 --- a/programs/levelTexture3.h +++ b/programs/levelTexture3.h @@ -4,7 +4,7 @@ #define LEVEL3_TEXTURE_WIDTH 128 #define LEVEL3_TEXTURE_HEIGHT 128 -uint8_t level3Texture[49152] = { +const uint8_t level3Texture[49152] = { 140,136,133,113,109,106,122,118,115,118,114,111,116,112,109,117,113,110,133,130, 127,127,123,120,121,119,120,125,123,124,153,151,152,139,137,138,153,151,152,115, 113,114,122,120,121,121,119,120,151,151,151,167,167,167,157,157,157,156,156,156, diff --git a/programs/plantTexture.h b/programs/plantTexture.h index cc2c81f..277fdc9 100644 --- a/programs/plantTexture.h +++ b/programs/plantTexture.h @@ -4,7 +4,7 @@ #define PLANT_TEXTURE_WIDTH 128 #define PLANT_TEXTURE_HEIGHT 128 -uint8_t plantTexture[49152] = { +const uint8_t plantTexture[49152] = { 255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0, 255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0, 255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0, diff --git a/programs/sandNormalTexture.h b/programs/sandNormalTexture.h index d7878f6..009fc20 100644 --- a/programs/sandNormalTexture.h +++ b/programs/sandNormalTexture.h @@ -4,7 +4,7 @@ #define SANDNORMAL_TEXTURE_WIDTH 128 #define SANDNORMAL_TEXTURE_HEIGHT 128 -uint8_t sandNormalTexture[49152] = { +const uint8_t sandNormalTexture[49152] = { 148,109,251,147,113,251,152,117,251,152,132,251,140,144,251,128,149,248,106,141, 250,99,134,250,98,128,251,104,124,252,116,121,253,128,122,254,138,125,253,145, 131,252,149,142,251,148,151,250,143,157,249,135,165,248,125,172,246,109,177,243, diff --git a/programs/sandTexture.h b/programs/sandTexture.h index 5d0b6e8..46abc16 100644 --- a/programs/sandTexture.h +++ b/programs/sandTexture.h @@ -4,7 +4,7 @@ #define SAND_TEXTURE_WIDTH 128 #define SAND_TEXTURE_HEIGHT 128 -uint8_t sandTexture[49152] = { +const uint8_t sandTexture[49152] = { 148,123,107,145,121,102,147,123,108,130,106,88,134,110,93,145,125,108,159,134, 115,158,129,111,158,131,114,161,130,114,163,139,121,167,137,118,160,136,117,157, 129,115,152,128,110,144,121,106,142,119,104,143,119,101,146,120,103,156,131,112, diff --git a/programs/treeTexture.h b/programs/treeTexture.h index db5985e..a602ea5 100644 --- a/programs/treeTexture.h +++ b/programs/treeTexture.h @@ -4,7 +4,7 @@ #define TREE_TEXTURE_WIDTH 128 #define TREE_TEXTURE_HEIGHT 128 -uint8_t treeTexture[49152] = { +const uint8_t treeTexture[49152] = { 68,158,69,60,153,66,65,164,70,55,139,52,68,153,64,60,154,66,52,141,57,72,168,73, 66,159,69,74,173,73,74,168,73,57,153,65,59,155,67,65,161,69,74,169,72,59,153,67, 57,155,66,59,155,64,60,160,67,69,166,69,61,161,66,62,159,66,62,157,67,65,164,69, diff --git a/tools/img2array.py b/tools/img2array.py index 26d180a..a1bec16 100644 --- a/tools/img2array.py +++ b/tools/img2array.py @@ -115,7 +115,7 @@ for y in range(OUT_HEIGHT): #----------------------- -def printArray(array, name, sizeString, dataType="uint8_t"): +def printArray(array, name, sizeString, dataType="const uint8_t"): print(dataType + " " + name + "[" + sizeString + "] = {") arrayString = "" @@ -140,7 +140,7 @@ if GUARDS: print("#define " + NAME.upper() + "_TEXTURE_H\n") if USE_PALETTE: - printArray(paletteArray,NAME + "Palette",str(len(paletteArray)),"uint16_t" if USE_565 else "uint8_t") + printArray(paletteArray,NAME + "Palette",str(len(paletteArray)),"const uint16_t" if USE_565 else "const uint8_t") print("") print("#define " + NAME.upper() + "_TEXTURE_WIDTH " + str(OUT_WIDTH))