Commit 83862685 authored by Nicolas LIENART's avatar Nicolas LIENART

terrains inconstructibles

parent a3529a79
......@@ -9,6 +9,7 @@ noeud 255 0 0
in 0 255 0
out 0 0 255
construct 0 0 0
inconstructible 255 0 234
# Construction Data
laser 1 1 2 2 0 200 100
missile 2 1 1 1 0 300 150
......@@ -31,4 +32,4 @@ waves 4
1 2 2 0.5 0 6 0 0
2 1 2 0.5 4 1 0 0
3 2 2 0.5 2 3 0 0
4 3 2 0.5 0 2 1 1
\ No newline at end of file
4 3 2 0.5 0 2 1 1
No preview for this file type
......@@ -9,6 +9,7 @@ noeud 255 0 0
in 0 255 0
out 0 0 255
construct 0 0 0
inconstructible 255 0 234
# Construction Data (DEGAT ALIM CAD PORTEE RANGE VAL VAL)
laser 1 1 5 2 0 200 100
missile 2 1 2 1 0 300 150
......
......@@ -9,6 +9,7 @@ noeud 255 0 0
in 0 255 0
out 0 0 255
construct 0 0 0
inconstructible 255 0 234
# Construction Data (DEGAT ALIM CAD PORTEE RANGE VAL VAL)
laser 1 1 5 2 0 200 100
missile 2 1 2 1 0 300 150
......
......@@ -30,6 +30,8 @@ TypeCase* case_loadFromPPM()
} else if (case_RGBCompare(*pixel_ppm, mapData->outCol)) {
cases[i] = SORTIE;
nbSortie++;
} else if (case_RGBCompare(*pixel_ppm, mapData->inconstructibleCol)) {
cases[i] = INCONSTRUCTIBLE;
} else {
cases[i] = CHEMIN;
}
......@@ -59,6 +61,7 @@ void case_initPlateau()
printf("ERROR ALLOC : mapData");
exit(EXIT_FAILURE);
}
int argent = 2000;
plateau->idListInfos = GL_INVALID_VALUE;
......
......@@ -631,6 +631,9 @@ void display_mapList(GLuint id)
case SORTIE:
sprite_displayFixedTexture(REINE_TEX);
break;
case INCONSTRUCTIBLE:
sprite_displayFixedTexture(REMOVE_TEX);
break;
default:
sprite_displayFixedTexture(TERRAIN_1_TEX + rand()%5);
break;
......
......@@ -461,6 +461,18 @@ int itd_checkForMapData(FILE* file)
return CHK_ERROR_FILE;
}
}
if (strcmp("inconstructible", label) == 0) {
if (itd_getColor(file, color) == CHK_SUCCESS) {
mapData->inconstructibleCol = *color;
mapData->contentState |= MDATA_INCONSTRUCTIBLE;
return CHK_SUCCESS;
}
else {
fseek(file, originalPosition, SEEK_SET);
return CHK_ERROR_FILE;
}
}
if (strcmp("in", label) == 0) {
if (itd_getColor(file, color) == CHK_SUCCESS) {
......@@ -647,7 +659,7 @@ void idt_load(char* itd_path)
}
int allFlags = (MDATA_IMG | MDATA_ENERGY | MDATA_IN | MDATA_OUT | MDATA_PATH | MDATA_NODE | MDATA_CONSTRUCT | MDATA_INFOSNODE | MDATA_WAVES);
int allFlags = (MDATA_IMG | MDATA_ENERGY | MDATA_IN | MDATA_OUT | MDATA_PATH | MDATA_NODE | MDATA_CONSTRUCT | MDATA_INFOSNODE | MDATA_WAVES | MDATA_INCONSTRUCTIBLE);
if (mapData->contentState == allFlags) {
printf("file is valid\n");
mapData->cases = case_loadFromPPM();
......
......@@ -21,7 +21,8 @@ typedef enum MapDataContent {
MDATA_CONSTRUCT = 32,
MDATA_NODE = 64,
MDATA_INFOSNODE = 128,
MDATA_WAVES = 256
MDATA_WAVES = 256,
MDATA_INCONSTRUCTIBLE = 512
} MapDataContent;
typedef enum GameState {
......@@ -110,7 +111,8 @@ typedef enum TypeCase {
CHEMIN,
NOEUD,
ENTREE,
SORTIE
SORTIE,
INCONSTRUCTIBLE
} TypeCase;
typedef struct ConstructionData {
......@@ -151,6 +153,7 @@ typedef struct MapData {
RGBcolor pathCol;
RGBcolor nodeCol;
RGBcolor buildingCol;
RGBcolor inconstructibleCol;
RGBcolor inCol;
RGBcolor outCol;
unsigned int contentState;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment