diff --git a/action.cpp b/action.cpp new file mode 100644 index 0000000..dd032c2 --- /dev/null +++ b/action.cpp @@ -0,0 +1,2778 @@ +// Action.cpp +// + +#include +#include +#include +#include "def.h" +#include "action.h" +#include "misc.h" + + + +#define MAXICON (1+50) +#define MAXMOVE (2+30*3) +#define MAXSOUND (1+50) + +typedef struct +{ + short action; + short channel; + short icons[8][MAXICON]; // nb, icones, + short moves[8][MAXMOVE]; // nb, nb, x,y, + short sounds[MAXSOUND]; // nb, sons, +} +DescAction; + + +static DescAction action_table[] = +{ + { + ACTION_STOP, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_STOPf, + CHBLUPI, + { + {1, 69}, // e + {1, 72}, // se + {1, 75}, // s + {1, 78}, // so + {1, 81}, // o + {1, 84}, // no + {1, 87}, // n + {1, 90}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_STOPb, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {10,10, 0,0,+1, 0,0,+1, 0,0,0, 0,0,0, 0,0,0, + 0,0,-1, 0,0,-1, 0,0,0, 0,0,0, 0,0,0}, + {10,10, 0,0,+1, 0,0,+1, 0,0,0, 0,0,0, 0,0,0, + 0,0,-1, 0,0,-1, 0,0,0, 0,0,0, 0,0,0}, + {10,10, 0,0,+1, 0,0,+1, 0,0,0, 0,0,0, 0,0,0, + 0,0,-1, 0,0,-1, 0,0,0, 0,0,0, 0,0,0}, + {10,10, 0,0,+1, 0,0,+1, 0,0,0, 0,0,0, 0,0,0, + 0,0,-1, 0,0,-1, 0,0,0, 0,0,0, 0,0,0}, + {10,10, 0,0,+1, 0,0,+1, 0,0,0, 0,0,0, 0,0,0, + 0,0,-1, 0,0,-1, 0,0,0, 0,0,0, 0,0,0}, + {10,10, 0,0,+1, 0,0,+1, 0,0,0, 0,0,0, 0,0,0, + 0,0,-1, 0,0,-1, 0,0,0, 0,0,0, 0,0,0}, + {10,10, 0,0,+1, 0,0,+1, 0,0,0, 0,0,0, 0,0,0, + 0,0,-1, 0,0,-1, 0,0,0, 0,0,0, 0,0,0}, + {10,10, 0,0,+1, 0,0,+1, 0,0,0, 0,0,0, 0,0,0, + 0,0,-1, 0,0,-1, 0,0,0, 0,0,0, 0,0,0}, + }, + {0}, + }, + { + ACTION_STOPj, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_STOPa, + CHBLUPI, + { + {1, 322}, // e + {1, 325}, // se + {1, 328}, // s + {1, 331}, // so + {1, 334}, // o + {1, 337}, // no + {1, 340}, // n + {1, 343}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_ENERGY, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {2,2, 0,0,-2, 0,0,+2}, + {2,2, 0,0,-2, 0,0,+2}, + {2,2, 0,0,-2, 0,0,+2}, + {2,2, 0,0,-2, 0,0,+2}, + {2,2, 0,0,-2, 0,0,+2}, + {2,2, 0,0,-2, 0,0,+2}, + {2,2, 0,0,-2, 0,0,+2}, + {2,2, 0,0,-2, 0,0,+2}, + }, + {0}, + }, + { + ACTION_MARCHE, + CHBLUPI, + { + {6, 0,1,2,3,4,5}, // e + {6, 6,7,8,9,10,11}, // se + {6, 12,13,14,15,16,17}, // s + {6, 18,19,20,21,22,23}, // so + {6, 24,25,26,27,28,29}, // o + {6, 30,31,32,33,34,35}, // no + {6, 36,37,38,39,40,41}, // n + {6, 42,43,44,45,46,47}, // ne + }, + { +#if 1 + {10,1, +300,+150,0}, // e + {15,1, 0,+200,0}, // se + {10,1, -300,+150,0}, // s + {15,1, -400, 0,0}, // so + {10,1, -300,-150,0}, // o + {15,1, 0,-200,0}, // no + {10,1, +300,-150,0}, // n + {15,1, +400, 0,0}, // ne +#else + {15,1, +200,+100,0}, // e + {20,1, 0,+150,0}, // se + {15,1, -200,+100,0}, // s + {20,1, -300, 0,0}, // so + {15,1, -200,-100,0}, // o + {20,1, 0,-150,0}, // no + {15,1, +200,-100,0}, // n + {20,1, +300, 0,0}, // ne +#endif + }, + {0}, + }, + { + ACTION_MARCHEf, + CHBLUPI, + { + {8, 69,69,70,70,69,69,71,71}, // e + {8, 72,72,73,73,72,72,74,74}, // se + {8, 75,75,76,76,75,75,77,77}, // s + {8, 78,78,79,79,78,78,80,80}, // so + {8, 81,81,82,82,81,81,83,83}, // o + {8, 84,84,85,85,84,84,86,86}, // no + {8, 87,87,88,88,87,87,89,89}, // n + {8, 90,90,91,91,90,90,92,92}, // ne + }, + { + {20,2, 0,0,0, +300,+150,0}, // e + {30,2, 0,0,0, 0,+200,0}, // se + {20,2, 0,0,0, -300,+150,0}, // s + {30,2, 0,0,0, -400, 0,0}, // so + {20,2, 0,0,0, -300,-150,0}, // o + {30,2, 0,0,0, 0,-200,0}, // no + {20,2, 0,0,0, +300,-150,0}, // n + {30,2, 0,0,0, +400, 0,0}, // ne + }, + {0}, + }, + { + ACTION_MARCHEb, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { +#if 0 + {20,10, +150,+75,+1, +150,+75,+1, +150,+75,+1, + +150,+75, 0, +150,+75, 0, +150,+75, 0, +150,+75, 0, + +150,+75,-1, +150,+75,-1, +150,+75,-1}, + {30,10, 0,+100,+1, 0,+100,+1, 0,+100,+1, + 0,+100, 0, 0,+100, 0, 0,+100, 0, 0,+100, 0, + 0,+100,-1, 0,+100,-1, 0,+100,-1}, + {20,10, -150,+75,+1, -150,+75,+1, -150,+75,+1, + -150,+75, 0, -150,+75, 0, -150,+75, 0, -150,+75, 0, + -150,+75,-1, -150,+75,-1, -150,+75,-1}, + {30,10, -200,0,+1, -200,0,+1, -200,0,+1, + -200,0, 0, -200,0, 0, -200,0, 0, -200,0, 0, + -200,0,-1, -200,0,-1, -200,0,-1}, + {20,10, -150,-75,+1, -150,-75,+1, -150,-75,+1, + -150,-75, 0, -150,-75, 0, -150,-75, 0, -150,-75, 0, + -150,-75,-1, -150,-75,-1, -150,-75,-1}, + {30,10, 0,-100,+1, 0,-100,+1, 0,-100,+1, + 0,-100, 0, 0,-100, 0, 0,-100, 0, 0,-100, 0, + 0,-100,-1,0, -100,-1, 0,-100,-1}, + {20,10, +150,-75,+1, +150,-75,+1, +150,-75,+1, + +150,-75, 0, +150,-75, 0, +150,-75, 0, +150,-75, 0, + +150,-75,-1, +150,-75,-1, +150,-75,-1}, + {30,10, +200,0,+1, +200,0,+1, +200,0,+1, + +200,0, 0, +200,0, 0, +200,0, 0, +200,0, 0, + +200,0,-1, +200,0,-1, +200,0,-1}, +#else + { 5,5, +600,+300,+1, +600,+300,+1, +600,+300,0, +600,+300,-1, +600,+300,-1}, + {10,5, 0,+300,+1, 0,+300,+1, 0,+300,0, 0,+300,-1, 0,+300,-1}, + { 5,5, -600,+300,+1, -600,+300,+1, -600,+300,0, -600,+300,-1, -600,+300,-1}, + {10,5, -600, 0,+1, -600, 0,+1, -600, 0,0, -600, 0,-1, -600, 0,-1}, + { 5,5, -600,-300,+1, -600,-300,+1, -600,-300,0, -600,-300,-1, -600,-300,-1}, + {10,5, 0,-300,+1, 0,-300,+1, 0,-300,0, 0,-300,-1, 0,-300,-1}, + { 5,5, +600,-300,+1, +600,-300,+1, +600,-300,0, +600,-300,-1, +600,-300,-1}, + {10,5, +600, 0,+1, +600, 0,+1, +600, 0,0, +600, 0,-1, +600, 0,-1}, +#endif + }, + {20, -1,-1,SOUND_BATEAU,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + }, + { + ACTION_MARCHEj, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {5,1, +600,+300,0}, + {7,1, 0,+429,0}, + {5,1, -600,+300,0}, + {7,1, -858, 0,0}, + {5,1, -600,-300,0}, + {7,1, 0,-429,0}, + {5,1, +600,-300,0}, + {7,1, +858, 0,0}, + }, + {20, -1,-1,SOUND_JEEP,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + }, + { + ACTION_MARCHEa, + CHBLUPI, + { + {8, 322,322,323,323,322,322,324,324}, // e + {8, 325,325,326,326,325,325,327,327}, // se + {8, 328,328,329,329,328,328,330,330}, // s + {8, 331,331,332,332,331,331,333,333}, // so + {8, 334,334,335,335,334,334,336,336}, // o + {8, 337,337,338,338,337,337,339,339}, // no + {8, 340,340,341,341,340,340,342,342}, // n + {8, 343,343,344,344,343,343,345,345}, // ne + }, + { + {10,2, 0,0,0, +600,+300,0}, // e + {16,2, 0,0,0, 0,+375,0}, // se + {10,2, 0,0,0, -600,+300,0}, // s + {16,2, 0,0,0, -750, 0,0}, // so + {10,2, 0,0,0, -600,-300,0}, // o + {16,2, 0,0,0, 0,-375,0}, // no + {10,2, 0,0,0, +600,-300,0}, // n + {16,2, 0,0,0, +750, 0,0}, // ne + }, + {0}, + }, + { + ACTION_SAUTE1, + CHBLUPI, + { + {15, 106,106,106,106,106,136,136,136,136,136, + 136,106,106,106,106}, // e + {1, 6}, // se + {15, 133,133,133,133,133,137,137,137,137,137, + 137,133,133,133,133}, // s + {1, 18}, // so + {15, 134,134,134,134,134,138,138,138,138,138, + 138,134,134,134,134}, // o + {1, 30}, // no + {15, 135,135,135,135,135,139,139,139,139,139, + 139,135,135,135,135}, // n + {1, 42}, // ne + }, + { + {15,15, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +300,+150,-5, +300,+150,-5, +300,+150,-5, + +300,+150,-5, +300,+150,-2, + +300,+150,+2, +300,+150,+5, +300,+150,+5, + +300,+150,+5, +300,+150,+5}, // e + {1,1, 0,0,0}, // se + {15,15, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -300,+150,-5, -300,+150,-5, -300,+150,-5, + -300,+150,-5, -300,+150,-2, + -300,+150,+2, -300,+150,+5, -300,+150,+5, + -300,+150,+5, -300,+150,+5}, // s + {1,1, 0,0,0}, // so + {15,15, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -300,-150,-5, -300,-150,-5, -300,-150,-5, + -300,-150,-5, -300,-150,-2, + -300,-150,+2, -300,-150,+5, -300,-150,+5, + -300,-150,+5, -300,-150,+5}, // o + {1,1, 0,0,0}, // no + {15,15, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +300,-150,-5, +300,-150,-5, +300,-150,-5, + +300,-150,-5, +300,-150,-2, + +300,-150,+2, +300,-150,+5, +300,-150,+5, + +300,-150,+5, +300,-150,+5}, // n + {1,1, 0,0,0}, // ne + }, + {15, SOUND_HOP,-1,-1,-1, + SOUND_SAUT, -1,-1,-1,-1,-1,-1,-1,-1,-1, + SOUND_COUPTOC}, + }, + { + ACTION_SAUTE2, + CHBLUPI, + { + {15, 106,106,106,106,106,136,136,136,136,136, + 136,106,106,106,106}, // e + {1, 6}, // se + {15, 133,133,133,133,133,137,137,137,137,137, + 137,133,133,133,133}, // s + {1, 18}, // so + {15, 134,134,134,134,134,138,138,138,138,138, + 138,134,134,134,134}, // o + {1, 30}, // no + {15, 135,135,135,135,135,139,139,139,139,139, + 139,135,135,135,135}, // n + {1, 42}, // ne + }, + { + {15,15, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +600,+300,-5, +600,+300,-5, +600,+300,-5, + +600,+300,-5, +600,+300,-2, + +600,+300,+2, +600,+300,+5, +600,+300,+5, + +600,+300,+5, +600,+300,+5}, // e + {1,1, 0,0,0}, // se + {15,15, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -600,+300,-5, -600,+300,-5, -600,+300,-5, + -600,+300,-5, -600,+300,-2, + -600,+300,+2, -600,+300,+5, -600,+300,+5, + -600,+300,+5, -600,+300,+5}, // s + {1,1, 0,0,0}, // so + {15,15, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -600,-300,-5, -600,-300,-5, -600,-300,-5, + -600,-300,-5, -600,-300,-2, + -600,-300,+2, -600,-300,+5, -600,-300,+5, + -600,-300,+5, -600,-300,+5}, // o + {1,1, 0,0,0}, // no + {15,15, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +600,-300,-5, +600,-300,-5, +600,-300,-5, + +600,-300,-5, +600,-300,-2, + +600,-300,+2, +600,-300,+5, +600,-300,+5, + +600,-300,+5, +600,-300,+5}, // n + {1,1, 0,0,0}, // ne + }, + {15, SOUND_HOP,-1,-1,-1, + SOUND_SAUT, -1,-1,-1,-1,-1,-1,-1,-1,-1, + SOUND_COUPTOC}, + }, + { + ACTION_SAUTE3, + CHBLUPI, + { + {20, 106,106,106,106,106,136,136,136,136,136, + 136,136,136,136,136,136,106,106,106,106}, // e + {1, 6}, // se + {20, 133,133,133,133,133,137,137,137,137,137, + 137,137,137,137,137,137,133,133,133,133}, // s + {1, 18}, // so + {20, 134,134,134,134,134,138,138,138,138,138, + 138,138,138,138,138,138,134,134,134,134}, // o + {1, 30}, // no + {20, 135,135,135,135,135,139,139,139,139,139, + 139,139,139,139,139,139,135,135,135,135}, // n + {1, 42}, // ne + }, + { + {20,20, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +600,+300,-5, +600,+300,-5, +600,+300,-5, + +600,+300,-5, +600,+300,-5, +600,+300,-5, + +600,+300,-2, +600,+300, 0, +600,+300,+2, + +600,+300,+5, +600,+300,+5, +600,+300,+5, + +600,+300,+5, +600,+300,+5, +600,+300,+5}, // e + {1,1, 0,0,0}, // se + {20,20, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -600,+300,-5, -600,+300,-5, -600,+300,-5, + -600,+300,-5, -600,+300,-5, -600,+300,-5, + -600,+300,-2, -600,+300, 0, -600,+300,+2, + -600,+300,+5, -600,+300,+5, -600,+300,+5, + -600,+300,+5, -600,+300,+5, -600,+300,+5}, // s + {1,1, 0,0,0}, // so + {20,20, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -600,-300,-5, -600,-300,-5, -600,-300,-5, + -600,-300,-5, -600,-300,-5, -600,-300,-5, + -600,-300,-2, -600,-300, 0, -600,-300,+2, + -600,-300,+5, -600,-300,+5, -600,-300,+5, + -600,-300,+5, -600,-300,+5, -600,-300,+5}, // o + {1,1, 0,0,0}, // no + {20,20, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +600,-300,-5, +600,-300,-5, +600,-300,-5, + +600,-300,-5, +600,-300,-5, +600,-300,-5, + +600,-300,-2, +600,-300, 0, +600,-300,+2, + +600,-300,+5, +600,-300,+5, +600,-300,+5, + +600,-300,+5, +600,-300,+5, +600,-300,+5}, // n + {1,1, 0,0,0}, // ne + }, + {20, SOUND_HOP,-1,-1,-1, + SOUND_SAUT, -1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1, + SOUND_COUPTOC}, + }, + { + ACTION_SAUTE4, + CHBLUPI, + { + {25, 106,106,106,106,106,136,136,136,136,136, + 136,136,136,136,136,136,136,136,136,136, + 136,106,106,106,106}, // e + {1, 6}, // se + {25, 133,133,133,133,133,137,137,137,137,137, + 137,137,137,137,137,137,137,137,137,137, + 137,133,133,133,133}, // s + {1, 18}, // so + {25, 134,134,134,134,134,138,138,138,138,138, + 138,138,138,138,138,138,138,138,138,138, + 138,134,134,134,134}, // o + {1, 30}, // no + {25, 135,135,135,135,135,139,139,139,139,139, + 139,139,139,139,139,139,139,139,139,139, + 139,135,135,135,135}, // n + {1, 42}, // ne + }, + { + {25,25, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +600,+300,-5, +600,+300,-5, +600,+300,-5, + +600,+300,-5, +600,+300,-5, +600,+300,-5, + +600,+300,-5, +600,+300,-5, +600,+300,-5, + +600,+300,-2, +600,+300,+2, + +600,+300,+5, +600,+300,+2, +600,+300,+5, + +600,+300,+5, +600,+300,+5, +600,+300,+5, + +600,+300,+5, +600,+300,+5, +600,+300,+5}, // e + {1,1, 0,0,0}, // se + {25,25, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -600,+300,-5, -600,+300,-5, -600,+300,-5, + -600,+300,-5, -600,+300,-5, -600,+300,-5, + -600,+300,-5, -600,+300,-5, -600,+300,-5, + -600,+300,-2, -600,+300,+2, + -600,+300,+5, -600,+300,+5, -600,+300,+5, + -600,+300,+5, -600,+300,+5, -600,+300,+5, + -600,+300,+5, -600,+300,+5, -600,+300,+5}, // s + {1,1, 0,0,0}, // so + {25,25, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -600,-300,-5, -600,-300,-5, -600,-300,-5, + -600,-300,-5, -600,-300,-5, -600,-300,-5, + -600,-300,-5, -600,-300,-5, -600,-300,-5, + -600,-300,-2, -600,-300,+2, + -600,-300,+5, -600,-300,+5, -600,-300,+5, + -600,-300,+5, -600,-300,+5, -600,-300,+5, + -600,-300,+5, -600,-300,+5, -600,-300,+5}, // o + {1,1, 0,0,0}, // no + {25,25, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +600,-300,-5, +600,-300,-5, +600,-300,-5, + +600,-300,-5, +600,-300,-5, +600,-300,-5, + +600,-300,-5, +600,-300,-5, +600,-300,-5, + +600,-300,-2, +600,-300,+2, + +600,-300,+5, +600,-300,+5, +600,-300,+5, + +600,-300,+5, +600,-300,+5, +600,-300,+5, + +600,-300,+5, +600,-300,+5, +600,-300,+5}, // n + {1,1, 0,0,0}, // ne + }, + {25, SOUND_HOP,-1,-1,-1, + SOUND_SAUT, -1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1, + SOUND_COUPTOC}, + }, + { + ACTION_SAUTE5, + CHBLUPI, + { + {30, 106,106,106,106,106,136,136,136,136,136, + 136,136,136,136,136,136,136,136,136,136, + 136,136,136,136,136,136,106,106,106,106}, // e + {1, 6}, // se + {30, 133,133,133,133,133,137,137,137,137,137, + 137,137,137,137,137,137,137,137,137,137, + 137,137,137,137,137,137,133,133,133,133}, // s + {1, 18}, // so + {30, 134,134,134,134,134,138,138,138,138,138, + 138,138,138,138,138,138,138,138,138,138, + 138,138,138,138,138,138,134,134,134,134}, // o + {1, 30}, // no + {30, 135,135,135,135,135,139,139,139,139,139, + 139,139,139,139,139,139,139,139,139,139, + 139,139,139,139,139,139,135,135,135,135}, // n + {1, 42}, // ne + }, + { + {30,30, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +600,+300,-5, +600,+300,-5, +600,+300,-5, + +600,+300,-5, +600,+300,-5, +600,+300,-5, + +600,+300,-5, +600,+300,-5, +600,+300,-5, + +600,+300,-5, +600,+300,-2, +600,+300,-2, + +600,+300, 0, +600,+300,+2, +600,+300,+2, + +600,+300,+5, +600,+300,+2, +600,+300,+5, + +600,+300,+5, +600,+300,+5, +600,+300,+5, + +600,+300,+5, +600,+300,+5, +600,+300,+5, + +600,+300,+5}, // e + {1,1, 0,0,0}, // se + {30,30, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -600,+300,-5, -600,+300,-5, -600,+300,-5, + -600,+300,-5, -600,+300,-5, -600,+300,-5, + -600,+300,-5, -600,+300,-5, -600,+300,-5, + -600,+300,-5, -600,+300,-2, -600,+300,-2, + -600,+300, 0, -600,+300,+2, -600,+300,+2, + -600,+300,+5, -600,+300,+5, -600,+300,+5, + -600,+300,+5, -600,+300,+5, -600,+300,+5, + -600,+300,+5, -600,+300,+5, -600,+300,+5, + -600,+300,+5}, // s + {1,1, 0,0,0}, // so + {30,30, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + -600,-300,-5, -600,-300,-5, -600,-300,-5, + -600,-300,-5, -600,-300,-5, -600,-300,-5, + -600,-300,-5, -600,-300,-5, -600,-300,-5, + -600,-300,-5, -600,-300,-2, -600,-300,-2, + -600,-300, 0, -600,-300,+2, -600,-300,+2, + -600,-300,+5, -600,-300,+5, -600,-300,+5, + -600,-300,+5, -600,-300,+5, -600,-300,+5, + -600,-300,+5, -600,-300,+5, -600,-300,+5, + -600,-300,+5}, // o + {1,1, 0,0,0}, // no + {30,30, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + +600,-300,-5, +600,-300,-5, +600,-300,-5, + +600,-300,-5, +600,-300,-5, +600,-300,-5, + +600,-300,-5, +600,-300,-5, +600,-300,-5, + +600,-300,-5, +600,-300,-2, +600,-300,-2, + +600,-300, 0, +600,-300,+2, +600,-300,+2, + +600,-300,+5, +600,-300,+5, +600,-300,+5, + +600,-300,+5, +600,-300,+5, +600,-300,+5, + +600,-300,+5, +600,-300,+5, +600,-300,+5, + +600,-300,+5}, // n + {1,1, 0,0,0}, // ne + }, + {30, SOUND_HOP,-1,-1,-1, + SOUND_SAUT, -1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1, + SOUND_COUPTOC}, + }, + { + ACTION_GLISSE, + CHBLUPI, + { + {8, 48,49,50,51,52,53,54,55}, // e + {8, 49,50,51,52,53,54,55,48}, // se + {8, 50,51,52,53,54,55,48,49}, // s + {8, 51,52,53,54,55,48,49,50}, // so + {8, 52,53,54,55,48,49,50,51}, // o + {8, 53,54,55,48,49,50,51,52}, // no + {8, 54,55,48,49,50,51,52,53}, // n + {8, 55,48,49,50,51,52,53,54}, // ne + }, + { + {10,1, +300,+150,0}, // e + {15,1, 0,+200,0}, // se + {10,1, -300,+150,0}, // s + {15,1, -400, 0,0}, // so + {10,1, -300,-150,0}, // o + {15,1, 0,-200,0}, // no + {10,1, +300,-150,0}, // n + {15,1, +400, 0,0}, // ne + }, + {0}, + }, + { + ACTION_BUILD, + CHBLUPI, + { + {1, 100}, // e + {1, 100}, // se + {4, 103,104,105,105}, // s + {1, 100}, // so + {4, 100,101,102,102}, // o + {1, 100}, // no + {1, 100}, // n + {1, 100}, // ne + }, + { + {40,1, 0,0,0}, // e + {40,1, 0,0,0}, // se + {40,1, 0,0,0}, // s + {40,1, 0,0,0}, // so + {40,1, 0,0,0}, // o + {40,1, 0,0,0}, // no + {40,1, 0,0,0}, // n + {40,1, 0,0,0}, // ne + }, + {40, -1,-1,SOUND_COUPTOC,-1,-1,-1,SOUND_COUPTOC,-1, + -1,-1,SOUND_COUPTOC,-1,-1,-1,SOUND_COUPTOC,-1, + -1,-1,SOUND_COUPTOC,-1,-1,-1,SOUND_COUPTOC,-1, + -1,-1,SOUND_COUPTOC,-1,-1,-1,SOUND_COUPTOC,-1, + -1,-1,SOUND_COUPTOC,-1,-1,-1,SOUND_COUPTOC,-1}, + }, + { + ACTION_BUILDBREF, + CHBLUPI, + { + {1, 100}, // e + {1, 100}, // se + {4, 103,104,105,105}, // s + {1, 100}, // so + {4, 100,101,102,102}, // o + {1, 100}, // no + {1, 100}, // n + {1, 100}, // ne + }, + { + {40,1, 0,0,0}, // e + {40,1, 0,0,0}, // se + {40,1, 0,0,0}, // s + {40,1, 0,0,0}, // so + {40,1, 0,0,0}, // o + {40,1, 0,0,0}, // no + {40,1, 0,0,0}, // n + {40,1, 0,0,0}, // ne + }, + {40, -1,-1,SOUND_COUPBREF,-1,-1,-1,SOUND_COUPBREF,-1, + -1,-1,SOUND_COUPBREF,-1,-1,-1,SOUND_COUPBREF,-1, + -1,-1,SOUND_COUPBREF,-1,-1,-1,SOUND_COUPBREF,-1, + -1,-1,SOUND_COUPBREF,-1,-1,-1,SOUND_COUPBREF,-1, + -1,-1,SOUND_COUPBREF,-1,-1,-1,SOUND_COUPBREF,-1}, + }, + { + ACTION_BUILDSEC, + CHBLUPI, + { + {1, 100}, // e + {1, 100}, // se + {4, 103,104,105,105}, // s + {1, 100}, // so + {4, 100,101,102,102}, // o + {1, 100}, // no + {1, 100}, // n + {1, 100}, // ne + }, + { + {40,1, 0,0,0}, // e + {40,1, 0,0,0}, // se + {40,1, 0,0,0}, // s + {40,1, 0,0,0}, // so + {40,1, 0,0,0}, // o + {40,1, 0,0,0}, // no + {40,1, 0,0,0}, // n + {40,1, 0,0,0}, // ne + }, + {40, -1,-1,SOUND_COUPSEC,-1,-1,-1,SOUND_COUPSEC,-1, + -1,-1,SOUND_COUPSEC,-1,-1,-1,SOUND_COUPSEC,-1, + -1,-1,SOUND_COUPSEC,-1,-1,-1,SOUND_COUPSEC,-1, + -1,-1,SOUND_COUPSEC,-1,-1,-1,SOUND_COUPSEC,-1, + -1,-1,SOUND_COUPSEC,-1,-1,-1,SOUND_COUPSEC,-1}, + }, + { + ACTION_BUILDSOURD, + CHBLUPI, + { + {1, 100}, // e + {1, 100}, // se + {4, 103,104,105,105}, // s + {1, 100}, // so + {4, 100,101,102,102}, // o + {1, 100}, // no + {1, 100}, // n + {1, 100}, // ne + }, + { + {40,1, 0,0,0}, // e + {40,1, 0,0,0}, // se + {40,1, 0,0,0}, // s + {40,1, 0,0,0}, // so + {40,1, 0,0,0}, // o + {40,1, 0,0,0}, // no + {40,1, 0,0,0}, // n + {40,1, 0,0,0}, // ne + }, + {40, -1,-1,SOUND_COUPSOURD,-1,-1,-1,SOUND_COUPSOURD,-1, + -1,-1,SOUND_COUPSOURD,-1,-1,-1,SOUND_COUPSOURD,-1, + -1,-1,SOUND_COUPSOURD,-1,-1,-1,SOUND_COUPSOURD,-1, + -1,-1,SOUND_COUPSOURD,-1,-1,-1,SOUND_COUPSOURD,-1, + -1,-1,SOUND_COUPSOURD,-1,-1,-1,SOUND_COUPSOURD,-1}, + }, + { + ACTION_BUILDPIERRE, + CHBLUPI, + { + {1, 100}, // e + {1, 100}, // se + {4, 103,104,105,105}, // s + {1, 100}, // so + {4, 100,101,102,102}, // o + {1, 100}, // no + {1, 100}, // n + {1, 100}, // ne + }, + { + {40,1, 0,0,0}, // e + {40,1, 0,0,0}, // se + {40,1, 0,0,0}, // s + {40,1, 0,0,0}, // so + {40,1, 0,0,0}, // o + {40,1, 0,0,0}, // no + {40,1, 0,0,0}, // n + {40,1, 0,0,0}, // ne + }, + {40, -1,-1,SOUND_COUPPIERRE,-1,-1,-1,SOUND_COUPPIERRE,-1, + -1,-1,SOUND_COUPPIERRE,-1,-1,-1,SOUND_COUPPIERRE,-1, + -1,-1,SOUND_COUPPIERRE,-1,-1,-1,SOUND_COUPPIERRE,-1, + -1,-1,SOUND_COUPPIERRE,-1,-1,-1,SOUND_COUPPIERRE,-1, + -1,-1,SOUND_COUPPIERRE,-1,-1,-1,SOUND_COUPPIERRE,-1}, + }, + { + ACTION_PIOCHE, + CHBLUPI, + { + {16+4+16+4, + 93,93,94,94,95,95,94,94,93,93,94,94,95,95,94,94, + 93,93,96,96, + 97,97,98,98,99,99,98,98,97,97,98,98,99,99,98,98, + 97,97,96,96}, + {0} + }, + { + {(16+4+16+4)*1,1, 0,0,0}, + }, + {16+4+16+4, -1,-1,-1,-1,SOUND_COUPTERRE,-1,-1,-1, + -1,-1,-1,-1,SOUND_COUPTERRE,-1,-1,-1, + -1,-1,-1,-1, + -1,-1,-1,-1,SOUND_COUPTERRE,-1,-1,-1, + -1,-1,-1,-1,SOUND_COUPTERRE,-1,-1,-1, + -1,-1,-1,-1}, + }, + { + ACTION_PIOCHESOURD, + CHBLUPI, + { + {16+4+16+4, + 93,93,94,94,95,95,94,94,93,93,94,94,95,95,94,94, + 93,93,96,96, + 97,97,98,98,99,99,98,98,97,97,98,98,99,99,98,98, + 97,97,96,96}, + {0} + }, + { + {(16+4+16+4)*1,1, 0,0,0}, + }, + {16+4+16+4, -1,-1,-1,-1,SOUND_COUPSOURD,-1,-1,-1, + -1,-1,-1,-1,SOUND_COUPSOURD,-1,-1,-1, + -1,-1,-1,-1, + -1,-1,-1,-1,SOUND_COUPSOURD,-1,-1,-1, + -1,-1,-1,-1,SOUND_COUPSOURD,-1,-1,-1, + -1,-1,-1,-1}, + }, + { + ACTION_PIOCHEPIERRE, + CHBLUPI, + { + {16+4+16+4, + 93,93,94,94,95,95,94,94,93,93,94,94,95,95,94,94, + 93,93,96,96, + 97,97,98,98,99,99,98,98,97,97,98,98,99,99,98,98, + 97,97,96,96}, + {0} + }, + { + {(16+4+16+4)*1,1, 0,0,0}, + }, + {16+4+16+4, -1,-1,-1,-1,SOUND_COUPPIERRE,-1,-1,-1, + -1,-1,-1,-1,SOUND_COUPPIERRE,-1,-1,-1, + -1,-1,-1,-1, + -1,-1,-1,-1,SOUND_COUPPIERRE,-1,-1,-1, + -1,-1,-1,-1,SOUND_COUPPIERRE,-1,-1,-1, + -1,-1,-1,-1}, + }, + { + ACTION_ARROSE, + CHBLUPI, + { + {10, 286,286,287,287,287,287,286,286,287,287}, + {0} + }, + { + {40,1, 0,0,0}, + }, + {20, SOUND_ARROSE,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + }, + { + ACTION_BECHE, + CHBLUPI, + { + {20, 288,288,288,289,289,288,288,289,289,289, + 289,289,288,288,288,288,289,289,289,289}, + {0} + }, + { + {40,1, 0,0,0}, + }, + {20, -1,-1,-1,SOUND_BECHE,-1,-1,-1,SOUND_BECHE,-1,-1, + -1,-1,-1,-1,-1,-1,SOUND_BECHE,-1,-1,-1}, + }, + { + ACTION_SCIE, + CHBLUPI, + { + {1, 100}, // e + {1, 100}, // se + {8, 107,108,108,109,109,108,108,107}, // s + {1, 100}, // so + {1, 100}, // o + {1, 100}, // no + {1, 100}, // n + {1, 100}, // ne + }, + { + {40,1, 0,0,0}, // e + {40,1, 0,0,0}, // se + {40,1, 0,0,0}, // s + {40,1, 0,0,0}, // so + {40,1, 0,0,0}, // o + {40,1, 0,0,0}, // no + {40,1, 0,0,0}, // n + {40,1, 0,0,0}, // ne + }, + {40, -1,-1,-1,SOUND_SCIE,-1,-1,-1,-1, + -1,-1,-1,SOUND_SCIE,-1,-1,-1,-1, + -1,-1,-1,SOUND_SCIE,-1,-1,-1,-1, + -1,-1,-1,SOUND_SCIE,-1,-1,-1,-1, + -1,-1,-1,SOUND_SCIE,-1,-1,-1,-1}, + }, + { + ACTION_CUEILLE1, + CHBLUPI, + { + {20, 48,194,194,194,196,196,196,196,194,194, + 194,194,196,196,196,196,48,48,48,48}, // e + {1, 49}, // se + {20, 50,195,195,195,197,197,197,197,195,195, + 195,195,197,197,197,197,50,50,50,50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {20,1, 0,0,0}, // e + {20,1, 0,0,0}, // se + {20,1, 0,0,0}, // s + {20,1, 0,0,0}, // so + {20,1, 0,0,0}, // o + {20,1, 0,0,0}, // no + {20,1, 0,0,0}, // n + {20,1, 0,0,0}, // ne + }, + {0}, + }, + { + ACTION_CUEILLE2, + CHBLUPI, + { + {20, 48,194,194,194,198,198,198,198,194,194, + 194,194,198,198,198,198,48,48,48,48}, // e + {1, 49}, // se + {20, 50,195,195,195,199,199,199,199,195,195, + 195,195,199,199,199,199,50,50,50,50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {20,1, 0,0,0}, // e + {20,1, 0,0,0}, // se + {20,1, 0,0,0}, // s + {20,1, 0,0,0}, // so + {20,1, 0,0,0}, // o + {20,1, 0,0,0}, // no + {20,1, 0,0,0}, // n + {20,1, 0,0,0}, // ne + }, + {0}, + }, + { + ACTION_CUEILLE3, + CHBLUPI, + { + {20, 48,194,194,194,306,306,306,306,194,194, + 194,194,306,306,306,306,48,48,48,48}, // e + {1, 49}, // se + {20, 50,195,195,195,307,307,307,307,195,195, + 195,195,307,307,307,307,50,50,50,50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {20,1, 0,0,0}, // e + {20,1, 0,0,0}, // se + {20,1, 0,0,0}, // s + {20,1, 0,0,0}, // so + {20,1, 0,0,0}, // o + {20,1, 0,0,0}, // no + {20,1, 0,0,0}, // n + {20,1, 0,0,0}, // ne + }, + {0}, + }, + { + ACTION_LABO, + CHBLUPI, + { + {1, 48}, + {0} + }, + { + {90,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_MECHE, + CHBLUPI, + { + {36, 106,106,106,106,194,194,194,194,194,194, + 194,194,194,194,194,194,194,194,194,194, + 194,194,194,194,194,194,194,194,194,194, + 110,110,110,110,110,110}, + {0} + }, + { + {36,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_DYNAMITE, + CHBLUPI, + { + {1, 48}, + {0} + }, + { + {12,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_DELAY, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_PONT, + CHBLUPI, + { + {8, 48,49,50,51,52,53,54,55}, // e + {1, 49}, // se + {8, 50,49,48,55,54,53,52,51}, // s + {1, 51}, // so + {8, 52,51,50,49,48,55,54,53}, // o + {1, 53}, // no + {8, 54,55,48,49,50,51,52,53}, // n + {1, 55}, // ne + }, + { + {30,1, 0,0,0}, // e + {30,1, 0,0,0}, // se + {30,1, 0,0,0}, // s + {30,1, 0,0,0}, // so + {30,1, 0,0,0}, // o + {30,1, 0,0,0}, // no + {30,1, 0,0,0}, // n + {30,1, 0,0,0}, // ne + }, + {30, SOUND_HOP,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + }, + { + ACTION_TAKE, + CHBLUPI, + { + {2+6+15, 106,106,48,48,48,48,48,48,106, + 48,48,48,48,48,48,48,48,48,48,48,48,48,48}, + {1, 49}, + {2+6+15, 133,133,50,50,50,50,50,50,133, + 50,50,50,50,50,50,50,50,50,50,50,50,50,50}, + {1, 51}, + {1, 52}, + {1, 53}, + {1, 54}, + {1, 55}, + }, + { + {2+6+15,2+6+15, + 0,0,0, 0,0,0, + 0,0,-8, 0,0,-5, 0,0,-2, 0,0,+2, 0,0,+5, 0,0,+8, + 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0}, + {1,1, 0,0,0}, + {2+6+15,2+6+15, + 0,0,0, 0,0,0, + 0,0,-8, 0,0,-5, 0,0,-2, 0,0,+2, 0,0,+5, 0,0,+8, + 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {2+6+15, SOUND_HOP, -1,-1,-1,-1,-1,-1,-1, + SOUND_SAUT, -1,-1,-1,-1,-1,-1,-1,-1, + SOUND_COUPTOC, -1,-1,-1,-1,-1}, + }, + { + ACTION_DEPOSE, + CHBLUPI, + { + {10, 106,106,106,106,106,48,48,48,48,48}, + {1, 49}, + {10, 133,133,133,133,133,50,50,50,50,50}, + {1, 51}, + {1, 52}, + {1, 53}, + {1, 54}, + {1, 55}, + }, + { + {10,1, 0,0,0}, + {1,1, 0,0,0}, + {10,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {10, SOUND_HOP, -1,-1,-1,-1,-1,-1,-1,-1, + SOUND_COUPTERRE, }, + }, + { + ACTION_BRULE, + CHBLUPI, + { + {8, 48,49,50,51,52,53,54,55}, + {0} + }, + { + {40,1, 0,0,-10}, + }, + {0}, + }, + { + ACTION_TCHAO, + CHBLUPI, + { + {48, 308,308,308,308,308,308,308,308, + 308,308,308,308,309,309,309,309, + 309,309,309,309,309,309,309,309, + 310,310,310,310,310,310,311,311, + 311,311,311,311,312,312,312,312, + 312,312,313,313,313,313,313,313}, + {0} + }, + { + {48,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_ELECTRO, + CHBLUPI, + { + {4, 270,271,272,271}, + {0} + }, + { + {60,1, 0,0,0}, + }, + {30, SOUND_BRULE,-1,-1,-1,-1,-1,-1,-1,-1,-1, + SOUND_BRULE,-1,-1,-1,-1,-1,-1,-1,-1,-1, + SOUND_BRULE,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + }, + { + ACTION_GRILLE1, + CHBLUPI, + { + {40, 273,273,273,273,273,273,273,273,273,274, + 273,273,273,274,273,273,273,273,273,273, + 273,273,273,273,273,273,273,273,273,273, + 273,274,273,273,273,273,273,273,273,273}, + {0} + }, + { + {40,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_GRILLE2, + CHBLUPI, + { + {12, 275,273,275, + 276,275,276, + 277,276,277, + 278,277,278}, + {0} + }, + { + {12,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_GRILLE3, + CHBLUPI, + { + {50, 279,280,279,280,280,279,280,279,279,280, + 280,280,279,280,279,279,280,279,280,280, + 279, -1,279,280,280,279,280,279,279,280, + 279,280,279,280, -1,280,279,280, -1,280, + 279, -1,279,280, -1,279, -1,279, -1,280}, + {0} + }, + { + {50,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_MANGE, + CHBLUPI, + { + {39, 113,114,114,113,113,113,114,114,113,114, + 113,114,114,113,113,113,114,114,113,114, + 113,114,114,113,113,113,114,114,113,114, + 48,48,48,48,48,48,48,48,48}, + {0} + }, + { + {39,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_BOIT, + CHBLUPI, + { + {1, 193}, + {0} + }, + { + {40,2, 0,0,-3, 0,0,+3}, + }, + {0}, + }, + { + ACTION_CONTENT, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {20,4, 0,0,0, 0,0,-2, 0,0,0, 0,0,+2}, + {20,4, 0,0,0, 0,0,-2, 0,0,0, 0,0,+2}, + {20,4, 0,0,0, 0,0,-2, 0,0,0, 0,0,+2}, + {20,4, 0,0,0, 0,0,-2, 0,0,0, 0,0,+2}, + {20,4, 0,0,0, 0,0,-2, 0,0,0, 0,0,+2}, + {20,4, 0,0,0, 0,0,-2, 0,0,0, 0,0,+2}, + {20,4, 0,0,0, 0,0,-2, 0,0,0, 0,0,+2}, + {20,4, 0,0,0, 0,0,-2, 0,0,0, 0,0,+2}, + }, + {0}, + }, + { + ACTION_NAISSANCE, + CHBLUPI, + { + {20+9, 115,115,115,115,115,115,115,115,115,115, + 115,115,115,115,115,115,115,115,115,115, + 48,49,50,51,52,53,54,55,48}, + {0} + }, + { + {20+9,20+9, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, + 0,0,-10, 0,0,-10, 0,0,-8, 0,0,-3, + 0,0,+3, 0,0,+8, 0,0,+10, 0,0,+10, + 0,0,0}, + }, + {20+9, SOUND_NAISSANCE,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + SOUND_NAISSANCE,-1,-1,-1,-1,-1,-1,-1, + SOUND_COUPTOC}, + }, + { + ACTION_TELEPORTE1, + CHBLUPI, + { + {16, 318,318,319,319,318,319,319,318, + 318,319,319,318,318,319,319,318}, + {0} + }, + { + {32,4, -100,0,0, +100,0,0, +100,0,0, -100,0,0}, + }, + {0}, + }, + { + ACTION_TELEPORTE2, + CHBLUPI, + { + {16, 320,318,319,321,318,320,319,318, + 318,321,319,318,320,319,321,318}, + {0} + }, + { + {32,4, -100,0,0, +100,0,0, +100,0,0, -100,0,0}, + }, + {0}, + }, + { + ACTION_TELEPORTE3, + CHBLUPI, + { + {32, 320,320,321,321,320,321,321,320, + 320,321,321,320, -1,321,321,320, + 320, -1,321,321, -1,321,321, -1, + 320, -1, -1,320, -1,321, -1,320}, + {0} + }, + { + {32,4, 0,0,0, 0,0,-1, 0,0,+1, 0,0,0}, + }, + {0}, + }, + { + ACTION_MISC1, // hausse les épaules + CHBLUPI, + { + {1, 140}, // e + {1, 141}, // se + {1, 142}, // s + {1, 143}, // so + {1, 144}, // o + {1, 145}, // no + {1, 146}, // n + {1, 147}, // ne + }, + { + {3,1, 0,0,0}, + {3,1, 0,0,0}, + {3,1, 0,0,0}, + {3,1, 0,0,0}, + {3,1, 0,0,0}, + {3,1, 0,0,0}, + {3,1, 0,0,0}, + {3,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_MISC2, // grat-grat + CHBLUPI, + { + {6, 154,154,154,154,155,155}, // e + {1, 49}, // se + {6, 156,156,156,156,157,157}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {6, 158,158,158,158,159,159}, // ne + }, + { + {24,1, 0,0,0}, + { 1,1, 0,0,0}, + {24,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + {24,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_MISC3, // yoyo + CHBLUPI, + { + {8, 148,148,149,149,150,150,149,149}, // e + {1, 49}, // se + {8, 151,151,152,152,153,153,152,152}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {32,1, 0,0,0}, + { 1,1, 0,0,0}, + {32,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_MISC4, // ferme les yeux + CHBLUPI, + { + {1, 281}, // e + {1, 282}, // se + {1, 283}, // s + {1, 284}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 285}, // ne + }, + { + {2,1, 0,0,0}, + {2,1, 0,0,0}, + {2,1, 0,0,0}, + {2,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {2,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_MISC5, // ohé + CHBLUPI, + { + {8, 110,110,111,111,110,110,112,112}, + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {16,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_MISC6, // diabolo + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {6, 361,362,363,364,365,363}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + {36,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + { 1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_MISC1f, + CHBLUPI, + { + {12, 69,69,69,72,72,72,69,69,69,90,90,90}, // e + {12, 72,72,72,75,75,75,72,72,72,69,69,69}, // se + {12, 75,75,75,78,78,78,75,75,75,72,72,72}, // s + {12, 78,78,78,81,81,81,78,78,78,75,75,75}, // so + {12, 81,81,81,84,84,84,81,81,81,78,78,78}, // o + {12, 84,84,84,87,87,87,84,84,84,81,81,81}, // no + {12, 87,87,87,90,90,90,87,87,87,84,84,84}, // n + {12, 90,90,90,69,69,69,90,90,90,87,87,87}, // ne + }, + { + {12,1, 0,0,0}, + {12,1, 0,0,0}, + {12,1, 0,0,0}, + {12,1, 0,0,0}, + {12,1, 0,0,0}, + {12,1, 0,0,0}, + {12,1, 0,0,0}, + {12,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_ARMUREOPEN, + CHBLUPI, + { + {1, 346}, + {0} + }, + { + {15,1, 0,0,0}, + }, + {15, SOUND_ARMUREOPEN,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1}, + }, + { + ACTION_ARMURECLOSE, + CHBLUPI, + { + {1, 346}, + {0} + }, + { + {15,1, 0,0,0}, + }, + {15, -1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,SOUND_ARMURECLOSE}, + }, + + // Disciple : + + { + ACTION_D_STOP, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_D_MARCHE, + CHBLUPI, + { + {1, 48}, // e + {1, 49}, // se + {1, 50}, // s + {1, 51}, // so + {1, 52}, // o + {1, 53}, // no + {1, 54}, // n + {1, 55}, // ne + }, + { + {5,1, +600,+300,0}, + {7,1, 0,+429,0}, + {5,1, -600,+300,0}, + {7,1, -858, 0,0}, + {5,1, -600,-300,0}, + {7,1, 0,-429,0}, + {5,1, +600,-300,0}, + {7,1, +858, 0,0}, + }, + {0}, + }, + { + ACTION_D_BUILD, + CHBLUPI, + { + {4, 290,304,290,292}, // e + {4, 292,290,292,294}, // se + {4, 294,292,294,296}, // s + {4, 296,294,296,298}, // so + {4, 298,296,298,300}, // o + {4, 300,298,300,302}, // no + {4, 302,300,302,304}, // n + {4, 304,302,304,290}, // ne + }, + { + {40,1, 0,0,0}, // e + {40,1, 0,0,0}, // se + {40,1, 0,0,0}, // s + {40,1, 0,0,0}, // so + {40,1, 0,0,0}, // o + {40,1, 0,0,0}, // no + {40,1, 0,0,0}, // n + {40,1, 0,0,0}, // ne + }, + {0}, + }, + { + ACTION_D_PIOCHE, + CHBLUPI, + { + {1, 290}, // e + {1, 292}, // se + {1, 294}, // s + {1, 296}, // so + {1, 298}, // o + {1, 300}, // no + {1, 302}, // n + {1, 304}, // ne + }, + { + {40,4, 0,0,-2, 0,0,-2, 0,0,+2, 0,0,+2}, + {40,4, 0,0,-2, 0,0,-2, 0,0,+2, 0,0,+2}, + {40,4, 0,0,-2, 0,0,-2, 0,0,+2, 0,0,+2}, + {40,4, 0,0,-2, 0,0,-2, 0,0,+2, 0,0,+2}, + {40,4, 0,0,-2, 0,0,-2, 0,0,+2, 0,0,+2}, + {40,4, 0,0,-2, 0,0,-2, 0,0,+2, 0,0,+2}, + {40,4, 0,0,-2, 0,0,-2, 0,0,+2, 0,0,+2}, + {40,4, 0,0,-2, 0,0,-2, 0,0,+2, 0,0,+2}, + }, + {0}, + }, + { + ACTION_D_ARROSE, + CHBLUPI, + { + {12, 290,290,290,304,304,304,290,290,290,292,292,292}, // e + {12, 292,292,292,290,290,290,292,292,292,294,294,294}, // se + {12, 294,294,294,292,292,292,294,294,294,296,296,296}, // s + {12, 296,296,296,294,294,294,296,296,296,298,298,298}, // so + {12, 298,298,298,296,296,296,298,298,298,300,300,300}, // o + {12, 300,300,300,298,298,298,300,300,300,302,302,302}, // no + {12, 302,302,302,300,300,300,302,302,302,304,304,304}, // n + {12, 304,304,304,302,302,302,304,304,304,290,290,290}, // ne + }, + { + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_D_BECHE, + CHBLUPI, + { + {1, 290}, // e + {1, 292}, // se + {1, 294}, // s + {1, 296}, // so + {1, 298}, // o + {1, 300}, // no + {1, 302}, // n + {1, 304}, // ne + }, + { + {40,4, 0,0,0, 0,0,-2, 0,0,+2, 0,0,0}, + {40,4, 0,0,0, 0,0,-2, 0,0,+2, 0,0,0}, + {40,4, 0,0,0, 0,0,-2, 0,0,+2, 0,0,0}, + {40,4, 0,0,0, 0,0,-2, 0,0,+2, 0,0,0}, + {40,4, 0,0,0, 0,0,-2, 0,0,+2, 0,0,0}, + {40,4, 0,0,0, 0,0,-2, 0,0,+2, 0,0,0}, + {40,4, 0,0,0, 0,0,-2, 0,0,+2, 0,0,0}, + {40,4, 0,0,0, 0,0,-2, 0,0,+2, 0,0,0}, + }, + {0}, + }, + { + ACTION_D_SCIE, + CHBLUPI, + { + {8, 290,290,304,304,290,290,292,292}, // e + {8, 292,292,290,290,292,292,294,294}, // se + {8, 294,294,292,292,294,294,296,296}, // s + {8, 296,296,294,294,296,296,298,298}, // so + {8, 298,298,296,296,298,298,300,300}, // o + {8, 300,300,298,298,300,300,302,302}, // no + {8, 302,302,300,300,302,302,304,304}, // n + {8, 304,304,302,302,304,304,290,290}, // ne + }, + { + {40,1, 0,0,0}, // e + {40,1, 0,0,0}, // se + {40,1, 0,0,0}, // s + {40,1, 0,0,0}, // so + {40,1, 0,0,0}, // o + {40,1, 0,0,0}, // no + {40,1, 0,0,0}, // n + {40,1, 0,0,0}, // ne + }, + {0}, + }, + { + ACTION_D_CUEILLE1, + CHBLUPI, + { + {12, 290,290,290,304,304,304,290,290,290,292,292,292}, // e + {12, 292,292,292,290,290,290,292,292,292,294,294,294}, // se + {12, 294,294,294,292,292,292,294,294,294,296,296,296}, // s + {12, 296,296,296,294,294,294,296,296,296,298,298,298}, // so + {12, 298,298,298,296,296,296,298,298,298,300,300,300}, // o + {12, 300,300,300,298,298,298,300,300,300,302,302,302}, // no + {12, 302,302,302,300,300,300,302,302,302,304,304,304}, // n + {12, 304,304,304,302,302,302,304,304,304,290,290,290}, // ne + }, + { + {20,1, 0,0,0}, // e + {20,1, 0,0,0}, // se + {20,1, 0,0,0}, // s + {20,1, 0,0,0}, // so + {20,1, 0,0,0}, // o + {20,1, 0,0,0}, // no + {20,1, 0,0,0}, // n + {20,1, 0,0,0}, // ne + }, + {0}, + }, + { + ACTION_D_CUEILLE2, + CHBLUPI, + { + {12, 290,290,290,304,304,304,290,290,290,292,292,292}, // e + {12, 292,292,292,290,290,290,292,292,292,294,294,294}, // se + {12, 294,294,294,292,292,292,294,294,294,296,296,296}, // s + {12, 296,296,296,294,294,294,296,296,296,298,298,298}, // so + {12, 298,298,298,296,296,296,298,298,298,300,300,300}, // o + {12, 300,300,300,298,298,298,300,300,300,302,302,302}, // no + {12, 302,302,302,300,300,300,302,302,302,304,304,304}, // n + {12, 304,304,304,302,302,302,304,304,304,290,290,290}, // ne + }, + { + {20,1, 0,0,0}, // e + {20,1, 0,0,0}, // se + {20,1, 0,0,0}, // s + {20,1, 0,0,0}, // so + {20,1, 0,0,0}, // o + {20,1, 0,0,0}, // no + {20,1, 0,0,0}, // n + {20,1, 0,0,0}, // ne + }, + {0}, + }, + { + ACTION_D_MECHE, + CHBLUPI, + { + {1, 290}, // e + {1, 292}, // se + {1, 294}, // s + {1, 296}, // so + {1, 298}, // o + {1, 300}, // no + {1, 302}, // n + {1, 304}, // ne + }, + { + {36,2, 0,0,-2, 0,0,+2}, + {36,2, 0,0,-2, 0,0,+2}, + {36,2, 0,0,-2, 0,0,+2}, + {36,2, 0,0,-2, 0,0,+2}, + {36,2, 0,0,-2, 0,0,+2}, + {36,2, 0,0,-2, 0,0,+2}, + {36,2, 0,0,-2, 0,0,+2}, + {36,2, 0,0,-2, 0,0,+2}, + }, + {0}, + }, + { + ACTION_D_TCHAO, + CHBLUPI, + { + {4, 290,304,290,292}, // e + {4, 292,290,292,294}, // se + {4, 294,292,294,296}, // s + {4, 296,294,296,298}, // so + {4, 298,296,298,300}, // o + {4, 300,298,300,302}, // no + {4, 302,300,302,304}, // n + {4, 304,302,304,290}, // ne + }, + { + {8*6,1, 0,0,0}, + {8*6,1, 0,0,0}, + {8*6,1, 0,0,0}, + {8*6,1, 0,0,0}, + {8*6,1, 0,0,0}, + {8*6,1, 0,0,0}, + {8*6,1, 0,0,0}, + {8*6,1, 0,0,0}, + }, + {0}, + }, + + // Araignée : + + { + ACTION_A_STOP, + CHBLUPI, + { + {4, 116,117,117,116}, // e + {4, 118,119,119,118}, // se + {4, 120,121,121,120}, // s + {4, 122,123,123,122}, // so + {4, 124,125,125,124}, // o + {4, 126,127,127,126}, // no + {4, 128,129,129,128}, // n + {4, 130,131,131,130}, // ne + }, + { + {4,4, 0,0,0, 0,0,-5, 0,0,+5, 0,0,0}, + {4,4, 0,0,0, 0,0,-5, 0,0,+5, 0,0,0}, + {4,4, 0,0,0, 0,0,-5, 0,0,+5, 0,0,0}, + {4,4, 0,0,0, 0,0,-5, 0,0,+5, 0,0,0}, + {4,4, 0,0,0, 0,0,-5, 0,0,+5, 0,0,0}, + {4,4, 0,0,0, 0,0,-5, 0,0,+5, 0,0,0}, + {4,4, 0,0,0, 0,0,-5, 0,0,+5, 0,0,0}, + {4,4, 0,0,0, 0,0,-5, 0,0,+5, 0,0,0}, + }, + {0}, + }, + { + ACTION_A_MARCHE, + CHBLUPI, + { + {10, 117,117,117,117,117,117,117,117,116,116}, + {10, 119,119,119,119,119,119,119,119,118,118}, + {10, 121,121,121,121,121,121,121,121,120,120}, + {10, 123,123,123,123,123,123,123,123,122,122}, + {10, 125,125,125,125,125,125,125,125,124,124}, + {10, 127,127,127,127,127,127,127,127,126,126}, + {10, 129,129,129,129,129,129,129,129,128,128}, + {10, 131,131,131,131,131,131,131,131,130,130}, + }, + { + {10,10, +300,+150,-10, +300,+150,-10, +300,+150,-10, +300,+150,-8, +300,+150,-2, + +300,+150,+2, +300,+150,+8, +300,+150,+10, +300,+150,+10, +300,+150,+10}, + {10,10, 0,+300,-10, 0,+300,-10, 0,+300,-10, 0,+300,-8, 0,+300,-2, + 0,+300,+2, 0,+300,+8, 0,+300,+10, 0,+300,+10, 0,+300,+10}, + {10,10, -300,+150,-10, -300,+150,-10, -300,+150,-10, -300,+150,-8, -300,+150,-2, + -300,+150,+2, -300,+150,+8, -300,+150,+10, -300,+150,+10, -300,+150,+10}, + {10,10, -600,0,-10, -600,0,-10, -600,0,-10, -600,0,-8, -600,0,-2, + -600,0,+2, -600,0,+8, -600,0,+10, -600,0,+10, -600,0,+10}, + {10,10, -300,-150,-10, -300,-150,-10, -300,-150,-10, -300,-150,-8, -300,-150,-2, + -300,-150,+2, -300,-150,+8, -300,-150,+10, -300,-150,+10, -300,-150,+10}, + {10,10, 0,-300,-10, 0,-300,-10, 0,-300,-10, 0,-300,-8, 0,-300,-2, + 0,-300,+2, 0,-300,+8, 0,-300,+10, 0,-300,+10, 0,-300,+10}, + {10,10, +300,-150,-10, +300,-150,-10, +300,-150,-10, +300,-150,-8, +300,-150,-2, + +300,-150,+2, +300,-150,+8, +300,-150,+10, +300,-150,+10, +300,-150,+10}, + {10,10, +600,0,-10, +600,0,-10, +600,0,-10, +600,0,-8, +600,0,-2, + +600,0,+2, +600,0,+8, +600,0,+10, +600,0,+10, +600,0,+10}, + }, + {10, -1,-1,-1,-1,-1,-1,-1,-1,-1,SOUND_A_SAUT}, + }, + { + ACTION_A_GRILLE, + CHBLUPI, + { + {40, 165,165,166,165,165,166,165,166,165,165, + 166,166,167,166,167,167,166,166,167,166, + 167,167,167,168,167,167,167,168,167,167, + 168,167,168,168,168,168,167,168,168,168}, + {0} + }, + { + {40,1, 0,0,0}, + }, + {30, SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1}, + }, + { + ACTION_A_POISON, + CHBLUPI, + { + {8, 117,119,121,123,125,127,129,131}, + {0} + }, + { + {32,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_A_MORT1, + CHBLUPI, + { + {6, 314,315,316,317,316,315}, + {0} + }, + { + {30,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_A_MORT2, + CHBLUPI, + { + {50, 314,314,314,314,314,315,316,315,315,316, + 317,317,317,316,317,317,317,317,317,317, + 316,315,314,314,314,315,316,315,315,315, + 316,316,316,316,316,316,316,316,316,316, + 316,315,314,314,314,314,314,314,317,314}, + {0} + }, + { + {100,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_A_MORT3, + CHBLUPI, + { + {1, 317}, + {0} + }, + { + {100,1, 0,0,0}, + }, + {0}, + }, + + // Virus : + + { + ACTION_V_STOP, + CHBLUPI, + { + {10, 160,161,162,163,161,160,162,161,163,162}, + {0} + }, + { + {10,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_V_MARCHE, + CHBLUPI, + { + {10, 160,161,162,163,161,160,162,161,163,162}, + {10, 160,161,162,163,161,160,162,161,163,162}, + {10, 160,161,162,163,161,160,162,161,163,162}, + {10, 160,161,162,163,161,160,162,161,163,162}, + {10, 160,161,162,163,161,160,162,161,163,162}, + {10, 160,161,162,163,161,160,162,161,163,162}, + {10, 160,161,162,163,161,160,162,161,163,162}, + {10, 160,161,162,163,161,160,162,161,163,162}, + }, + { + {50,1, +60,+30,0}, // e + {75,1, 0,+40,0}, // se + {50,1, -60,+30,0}, // s + {75,1, -80, 0,0}, // so + {50,1, -60,-30,0}, // o + {75,1, 0,-40,0}, // no + {50,1, +60,-30,0}, // n + {75,1, +80, 0,0}, // ne + }, + {0}, + }, + { + ACTION_V_GRILLE, + CHBLUPI, + { + {5, 164,160,164,164,160}, + {0} + }, + { + {40,1, 0,0,0}, + }, + {30, SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1, + SOUND_RAYON1,-1,-1,-1,-1}, + }, + + + // Tracks : + + { + ACTION_T_STOP, + CHBLUPI, + { + {1, 200}, // e + {1, 202}, // se + {1, 204}, // s + {1, 206}, // so + {1, 208}, // o + {1, 210}, // no + {1, 212}, // n + {1, 214}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_T_MARCHE, + CHBLUPI, + { + {1, 200}, // e + {1, 202}, // se + {1, 204}, // s + {1, 206}, // so + {1, 208}, // o + {1, 210}, // no + {1, 212}, // n + {1, 214}, // ne + }, + { + {10,1, +300,+150,0}, // e + {15,1, 0,+200,0}, // se + {10,1, -300,+150,0}, // s + {15,1, -400, 0,0}, // so + {10,1, -300,-150,0}, // o + {15,1, 0,-200,0}, // no + {10,1, +300,-150,0}, // n + {15,1, +400, 0,0}, // ne + }, + {5, SOUND_T_MOTEUR,-1,-1,-1,-1}, + }, + { + ACTION_T_ECRASE, + CHBLUPI, + { + {8, 200,201,201,200,200,215,215,200}, // e + {8, 202,203,203,202,202,201,201,202}, // se + {8, 204,205,205,204,204,203,203,204}, // s + {8, 206,207,207,206,206,205,205,206}, // so + {8, 208,209,209,208,208,207,207,208}, // o + {8, 210,211,211,210,210,209,209,210}, // no + {8, 212,213,213,212,212,211,211,212}, // n + {8, 214,215,215,214,214,213,213,214}, // ne + }, + { + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + }, + {0}, + }, + + // Robot : + + { + ACTION_R_STOP, + CHBLUPI, + { + {1, 216}, // e + {1, 218}, // se + {1, 220}, // s + {1, 222}, // so + {1, 224}, // o + {1, 226}, // no + {1, 228}, // n + {1, 230}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_R_MARCHE, + CHBLUPI, + { + {1, 216}, // e + {1, 218}, // se + {1, 220}, // s + {1, 222}, // so + {1, 224}, // o + {1, 226}, // no + {1, 228}, // n + {1, 230}, // ne + }, + { +#if 0 + {20,1, +150, +75,0}, // e + {30,1, 0,+100,0}, // se + {20,1, -150, +75,0}, // s + {30,1, -200, 0,0}, // so + {20,1, -150, -75,0}, // o + {30,1, 0,-100,0}, // no + {20,1, +150, -75,0}, // n + {30,1, +200, 0,0}, // ne +#else + {20,20, +20,+10,0, +80,+40,0, +140,+70,0, +180,+90,0, + +180,+90,0, +180,+90,0, +180,+90,0, +180,+90,0, + +180,+90,0, +180,+90,0, +180,+90,0, +180,+90,0, + +180,+90,0, +180,+90,0, +180,+90,0, +180,+90,0, + +180,+90,0, +140,+70,0, +80,+40,0, +20,+10,0}, + {30,30, 0, +10,0, 0, +20,0, 0, +60,0, 0, +90,0, 0,+120,0, + 0,+120,0, 0,+120,0, 0,+120,0, 0,+120,0, 0,+120,0, + 0,+120,0, 0,+120,0, 0,+120,0, 0,+120,0, 0,+120,0, + 0,+120,0, 0,+120,0, 0,+120,0, 0,+120,0, 0,+120,0, + 0,+120,0, 0,+120,0, 0,+120,0, 0,+120,0, 0,+120,0, + 0,+120,0, 0, +90,0, 0, +60,0, 0, +20,0, 0, +10,0}, + {20,20, -20,+10,0, -80,+40,0, -140,+70,0, -180,+90,0, + -180,+90,0, -180,+90,0, -180,+90,0, -180,+90,0, + -180,+90,0, -180,+90,0, -180,+90,0, -180,+90,0, + -180,+90,0, -180,+90,0, -180,+90,0, -180,+90,0, + -180,+90,0, -140,+70,0, -80,+40,0, -20,+10,0}, + {30,30, -20,0,0, -40,0,0, -120,0,0, -180,0,0, -240,0,0, + -240,0,0, -240,0,0, -240,0,0, -240,0,0, -240,0,0, + -240,0,0, -240,0,0, -240,0,0, -240,0,0, -240,0,0, + -240,0,0, -240,0,0, -240,0,0, -240,0,0, -240,0,0, + -240,0,0, -240,0,0, -240,0,0, -240,0,0, -240,0,0, + -240,0,0, -180,0,0, -120,0,0, -40,0,0, -20,0,0}, + {20,20, -20,-10,0, -80,-40,0, -140,-70,0, -180,-90,0, + -180,-90,0, -180,-90,0, -180,-90,0, -180,-90,0, + -180,-90,0, -180,-90,0, -180,-90,0, -180,-90,0, + -180,-90,0, -180,-90,0, -180,-90,0, -180,-90,0, + -180,-90,0, -140,-70,0, -80,-40,0, -20,-10,0}, + {30,30, 0, -10,0, 0, -20,0, 0, -60,0, 0, -90,0, 0,-120,0, + 0,-120,0, 0,-120,0, 0,-120,0, 0,-120,0, 0,-120,0, + 0,-120,0, 0,-120,0, 0,-120,0, 0,-120,0, 0,-120,0, + 0,-120,0, 0,-120,0, 0,-120,0, 0,-120,0, 0,-120,0, + 0,-120,0, 0,-120,0, 0,-120,0, 0,-120,0, 0,-120,0, + 0,-120,0, 0, -90,0, 0, -60,0, 0, -20,0, 0, -10,0}, + {20,20, +20,-10,0, +80,-40,0, +140,-70,0, +180,-90,0, + +180,-90,0, +180,-90,0, +180,-90,0, +180,-90,0, + +180,-90,0, +180,-90,0, +180,-90,0, +180,-90,0, + +180,-90,0, +180,-90,0, +180,-90,0, +180,-90,0, + +180,-90,0, +140,-70,0, +80,-40,0, +20,-10,0}, + {30,30, +20,0,0, +40,0,0, +120,0,0, +180,0,0, +240,0,0, + +240,0,0, +240,0,0, +240,0,0, +240,0,0, +240,0,0, + +240,0,0, +240,0,0, +240,0,0, +240,0,0, +240,0,0, + +240,0,0, +240,0,0, +240,0,0, +240,0,0, +240,0,0, + +240,0,0, +240,0,0, +240,0,0, +240,0,0, +240,0,0, + +240,0,0, +180,0,0, +120,0,0, +40,0,0, +20,0,0}, +#endif + }, + {20, -1,-1,SOUND_R_MOTEUR,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + }, + { + ACTION_R_APLAT, + CHBLUPI, + { + {1, 216}, // e + {1, 218}, // se + {1, 220}, // s + {1, 222}, // so + {1, 224}, // o + {1, 226}, // no + {1, 228}, // n + {1, 230}, // ne + }, + { + {40,2, 0,0,-2, 0,0,+2}, + {40,2, 0,0,-2, 0,0,+2}, + {40,2, 0,0,-2, 0,0,+2}, + {40,2, 0,0,-2, 0,0,+2}, + {40,2, 0,0,-2, 0,0,+2}, + {40,2, 0,0,-2, 0,0,+2}, + {40,2, 0,0,-2, 0,0,+2}, + {40,2, 0,0,-2, 0,0,+2}, + }, + {30, -1,SOUND_R_APLAT,-1,-1,-1,SOUND_R_APLAT,-1,-1, + -1,SOUND_R_APLAT,-1,-1,-1,SOUND_R_APLAT,-1,-1, + -1,SOUND_R_APLAT,-1,-1,-1,SOUND_R_APLAT,-1,-1, + -1,SOUND_R_APLAT,-1,-1,-1,SOUND_R_APLAT}, + }, + { + ACTION_R_BUILD, + CHBLUPI, + { + {8, 216,231,231,216,216,217,217,216}, // e + {8, 218,217,217,218,218,219,219,218}, // se + {8, 220,219,219,220,220,221,221,220}, // s + {8, 222,221,221,222,222,223,223,222}, // so + {8, 224,223,223,224,224,225,225,224}, // o + {8, 226,225,225,226,226,227,227,226}, // no + {8, 228,227,227,228,228,229,229,228}, // n + {8, 230,229,229,230,230,231,231,230}, // ne + }, + { + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + }, + {30, -1,SOUND_R_ROTATE,-1,-1,-1,SOUND_R_ROTATE,-1,-1, + -1,SOUND_R_ROTATE,-1,-1,-1,SOUND_R_ROTATE,-1,-1, + -1,SOUND_R_ROTATE,-1,-1,-1,SOUND_R_ROTATE,-1,-1, + -1,SOUND_R_ROTATE,-1,-1,-1,SOUND_R_ROTATE}, + }, + { + ACTION_R_DELAY, + CHBLUPI, + { + {1, 216}, // e + {1, 218}, // se + {1, 220}, // s + {1, 222}, // so + {1, 224}, // o + {1, 226}, // no + {1, 228}, // n + {1, 230}, // ne + }, + { + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + {40,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_R_CHARGE, + CHBLUPI, + { + {1, 216}, // e + {1, 218}, // se + {1, 220}, // s + {1, 222}, // so + {1, 224}, // o + {1, 226}, // no + {1, 228}, // n + {1, 230}, // ne + }, + { + {40,2, 0,0,-1, 0,0,+1}, + {40,2, 0,0,-1, 0,0,+1}, + {40,2, 0,0,-1, 0,0,+1}, + {40,2, 0,0,-1, 0,0,+1}, + {40,2, 0,0,-1, 0,0,+1}, + {40,2, 0,0,-1, 0,0,+1}, + {40,2, 0,0,-1, 0,0,+1}, + {40,2, 0,0,-1, 0,0,+1}, + }, + {0}, + }, + { + ACTION_R_ECRASE, + CHBLUPI, + { + {8, 216,217,217,216,216,231,231,216}, // e + {8, 218,219,219,218,218,217,217,218}, // se + {8, 220,221,221,220,220,219,219,220}, // s + {8, 222,223,223,222,222,221,221,222}, // so + {8, 224,225,225,224,224,223,223,224}, // o + {8, 226,227,227,226,226,225,225,226}, // no + {8, 228,229,229,228,228,227,227,228}, // n + {8, 230,231,231,230,230,229,229,230}, // ne + }, + { + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + {16,1, 0,0,0}, + }, + {0}, + }, + + // Bombe : + + { + ACTION_B_STOP, + CHBLUPI, + { + {1, 232}, // e + {1, 232}, // se + {1, 232}, // s + {1, 232}, // so + {1, 232}, // o + {1, 232}, // no + {1, 232}, // n + {1, 232}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_B_MARCHE, + CHBLUPI, + { + {10, 233,233,233,233,232,232,232,232,232,232}, + {10, 233,233,233,233,232,232,232,232,232,232}, + {10, 233,233,233,233,232,232,232,232,232,232}, + {10, 233,233,233,233,232,232,232,232,232,232}, + {10, 233,233,233,233,232,232,232,232,232,232}, + {10, 233,233,233,233,232,232,232,232,232,232}, + {10, 233,233,233,233,232,232,232,232,232,232}, + {10, 233,233,233,233,232,232,232,232,232,232}, + }, + { +#if 0 + {20,10, +150,+75,-4, +150,+75,-3, +150,+75,-2, +150,+75,-1, + +150,+75,0, +150,+75,0, + +150,+75,+1, +150,+75,+2, +150,+75,+3, +150,+75,+4}, + {30,10, 0,+100,-4, 0,+100,-3, 0,+100,-2, 0,+100,-1, + 0,+100,0, 0,+100,0, + 0,+100,+1, 0,+100,+2, 0,+100,+3, 0,+100,+4}, + {20,10, -150,+75,-4, -150,+75,-3, -150,+75,-2, -150,+75,-1, + -150,+75,0, -150,+75,0, + -150,+75,+1, -150,+75,+2, -150,+75,+3, -150,+75,+4}, + {30,10, -200,0,-4, -200,0,-3, -200,0,-2, -200,0,-1, + -200,0,0, -200,0,0, + -200,0,+1, -200,0,+2, -200,0,+3, -200,0,+4}, + {20,10, -150,-75,-4, -150,-75,-3, -150,-75,-2, -150,-75,-1, + -150,-75,0, -150,-75,0, + -150,-75,+1, -150,-75,+2, -150,-75,+3, -150,-75,+4}, + {30,10, 0,-100,-4, 0,-100,-3, 0,-100,-2, 0,-100,-1, + 0,-100,0, 0,-100,0, + 0,-100,+1, 0,-100,+2, 0,-100,+3, 0,-100,+4}, + {20,10, +150,-75,-4, +150,-75,-3, +150,-75,-2, +150,-75,-1, + +150,-75,0, +150,-75,0, + +150,-75,+1, +150,-75,+2, +150,-75,+3, +150,-75,+4}, + {30,10, +200,0,-4, +200,0,-3, +200,0,-2, +200,0,-1, + +200,0,0, +200,0,0, + +200,0,+1, +200,0,+2, +200,0,+3, +200,0,+4}, +#else + {20,10, 0,0,+3, 0,0,+4, 0,0,-4, 0,0,-3, +150,+75,-2, +300,+150,-1, + +300,+150,0, +300,+150,0, + +300,+150,+1, +150,+75,+2}, + {30,10, 0,0,+3, 0,0,+4, 0,0,-4, 0,0,-3, 0,+100,-2, 0,+200,-1, + 0,+200,0, 0,+200,0, + 0,+200,+1, 0,+100,+2}, + {20,10, 0,0,+3, 0,0,+4, 0,0,-4, 0,0,-3, -150,+75,-2, -300,+150,-1, + -300,+150,0, -300,+150,0, + -300,+150,+1, -150,+75,+2}, + {30,10, 0,0,+3, 0,0,+4, 0,0,-4, 0,0,-3, -200,0,-2, -400,0,-1, + -400,0,0, -400,0,0, + -400,0,+1, -200,0,+2}, + {20,10, 0,0,+3, 0,0,+4, 0,0,-4, 0,0,-3, -150,-75,-2, -300,-150,-1, + -300,-150,0, -300,-150,0, + -300,-150,+1, -150,-75,+2}, + {30,10, 0,0,+3, 0,0,+4, 0,0,-4, 0,0,-3, 0,-100,-2, 0,-200,-1, + 0,-200,0, 0,-200,0, + 0,-200,+1, 0,-100,+2}, + {20,10, 0,0,+3, 0,0,+4, 0,0,-4, 0,0,-3, +150,-75,-2, +300,-150,-1, + +300,-150,0, +300,-150,0, + +300,-150,+1, +150,-75,+2}, + {30,10, 0,0,+3, 0,0,+4, 0,0,-4, 0,0,-3, +200,0,-2, +400,0,-1, + +400,0,0, +400,0,0, + +400,0,+1, +200,0,+2}, +#endif + }, + {30, -1,-1,SOUND_B_SAUT,-1,-1,-1,-1,-1,-1,-1, + -1,-1,SOUND_B_SAUT,-1,-1,-1,-1,-1,-1,-1, + -1,-1,SOUND_B_SAUT,-1,-1,-1,-1,-1,-1,-1}, + }, + + // Détonnateur de mine. + + { + ACTION_D_DELAY, + CHBLUPI, + { + {1, 0}, + {0} + }, + { + {15,1, 0,0,0}, + }, + {0}, + }, + + // Electro : + + { + ACTION_E_STOP, + CHBLUPI, + { + {1, 266}, // e + {1, 266}, // se + {1, 266}, // s + {1, 266}, // so + {1, 266}, // o + {1, 266}, // no + {1, 266}, // n + {1, 266}, // ne + }, + { + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + {1,1, 0,0,0}, + }, + {0}, + }, + { + ACTION_E_MARCHE, + CHBLUPI, + { + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + }, + { + {5,1, +600,+300,0}, + {7,1, 0,+429,0}, + {5,1, -600,+300,0}, + {7,1, -858, 0,0}, + {5,1, -600,-300,0}, + {7,1, 0,-429,0}, + {5,1, +600,-300,0}, + {7,1, +858, 0,0}, + }, + {0}, + }, + { + ACTION_E_DEBUT, + CHBLUPI, + { + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + {1, 266}, + }, + { + {8,8, 0,0,-3, 0,0,-2, 0,0,-1, 0,0,0, 0,0,+1, 0,0,+2, 0,0,+3, 0,0,0}, + {8,8, 0,0,-3, 0,0,-2, 0,0,-1, 0,0,0, 0,0,+1, 0,0,+2, 0,0,+3, 0,0,0}, + {8,8, 0,0,-3, 0,0,-2, 0,0,-1, 0,0,0, 0,0,+1, 0,0,+2, 0,0,+3, 0,0,0}, + {8,8, 0,0,-3, 0,0,-2, 0,0,-1, 0,0,0, 0,0,+1, 0,0,+2, 0,0,+3, 0,0,0}, + {8,8, 0,0,-3, 0,0,-2, 0,0,-1, 0,0,0, 0,0,+1, 0,0,+2, 0,0,+3, 0,0,0}, + {8,8, 0,0,-3, 0,0,-2, 0,0,-1, 0,0,0, 0,0,+1, 0,0,+2, 0,0,+3, 0,0,0}, + {8,8, 0,0,-3, 0,0,-2, 0,0,-1, 0,0,0, 0,0,+1, 0,0,+2, 0,0,+3, 0,0,0}, + {8,8, 0,0,-3, 0,0,-2, 0,0,-1, 0,0,0, 0,0,+1, 0,0,+2, 0,0,+3, 0,0,0}, + }, + {0}, + }, + { + ACTION_E_RAYON, + CHBLUPI, + { + {4, 266,267,268,269}, + {4, 266,267,268,269}, + {4, 266,267,268,269}, + {4, 266,267,268,269}, + {4, 266,267,268,269}, + {4, 266,267,268,269}, + {4, 266,267,268,269}, + {4, 266,267,268,269}, + }, + { + {8,1, 0,0,0}, + {8,1, 0,0,0}, + {8,1, 0,0,0}, + {8,1, 0,0,0}, + {8,1, 0,0,0}, + {8,1, 0,0,0}, + {8,1, 0,0,0}, + {8,1, 0,0,0}, + }, + {0}, + }, + + { + -1 + } +}; + + +// Calcule l'action suivante. +// Retourne FALSE lorsque l'action est terminée. + +BOOL Action(short action, short direct, + short &phase, short &step, + short &channel, short &icon, POINT &pos, short &posZ, + short &sound) +{ + DescAction* pTable = action_table; + short nbIcon, nbPhase, nbMove, nbSound, i; + + pos.x = 0; + pos.y = 0; + posZ = 0; + + while ( pTable->action != -1 ) + { + if ( action == pTable->action ) + { + if ( pTable->icons[1][0] == 0 ) direct = 0; + + nbIcon = pTable->icons[direct/16][0]; + nbPhase = pTable->moves[direct/16][0]; + nbMove = pTable->moves[direct/16][1]; + nbSound = pTable->sounds[0]; + + channel = pTable->channel; + icon = pTable->icons[direct/16][1+step%nbIcon]; + + if ( nbSound == 0 || step >= nbSound ) + { + sound = -1; + } + else + { + sound = pTable->sounds[1+step%nbSound]; + } + + for ( i=0 ; imoves[direct/16][2+(i%nbMove)*3+0]; + pos.y += pTable->moves[direct/16][2+(i%nbMove)*3+1]; + posZ += pTable->moves[direct/16][2+(i%nbMove)*3+2]; + } + + pos.x /= 100; + pos.y /= 100; + + if ( phase >= nbPhase ) return FALSE; + + phase ++; + step ++; + + return TRUE; + } + + pTable ++; + } + + return FALSE; +} + + + +static short rotate_table[] = +{ + 0, 6,12,18,24,30,36,42, + 1, 7,13,19,25,31,37,43, + 2, 8,14,20,26,32,38,44, + 3, 9,15,21,27,33,39,45, + 4,10,16,22,28,34,40,46, + 5,11,17,23,29,35,41,47, + + 48,49,50,51,52,53,54,55, + + 69,72,75,78,81,84,87,90, + 70,73,76,79,82,85,88,91, + 71,74,77,80,83,86,89,92, + + 116,118,120,122,124,126,128,130, + 117,119,121,123,125,127,129,131, + + 322,325,328,331,334,337,340,343, + 323,326,329,332,335,338,341,344, + 324,327,330,333,336,339,342,345, + + -1 +}; + +// Tourne une icône dans une direction donnée. + +BOOL Rotate(short &icon, short direct) +{ + short* pTable = rotate_table; + short i; + short offset = 0; + + if ( icon >= 200 && icon <= 215 ) // tracks ? + { + icon = (direct/8)+200; + return TRUE; + } + + if ( icon >= 216 && icon <= 231 ) // robot ? + { + icon = (direct/8)+216; + return TRUE; + } + + if ( icon >= 290 && icon <= 305 ) // disciple ? + { + icon = (direct/8)+290; + return TRUE; + } + + if ( icon >= 234 && icon <= 249 ) // blupi en bateau ? + { + icon = (direct/8)+234; + return TRUE; + } + + if ( icon >= 250 && icon <= 265 ) // blupi en jeep ? + { + icon = (direct/8)+250; + return TRUE; + } + + if ( icon >= 169 && icon <= 192 ) // blupi malade ? + { + icon -= 100; + offset = 100; + } + + while ( pTable[0] != -1 ) + { + for ( i=0 ; i<8 ; i++ ) + { + if ( icon == pTable[i] ) + { + icon = pTable[direct/16]+offset; + return TRUE; + } + } + + pTable += 8; + } + + return FALSE; +} + +// Retourne la direction d'une icône. + +int GetIconDirect(short icon) +{ + short* pTable = rotate_table; + short i; + + if ( icon >= 169 && icon <= 192 ) // blupi malade ? + { + icon -= 100; + } + + if ( icon >= 234 && icon <= 249 ) // blupi en bateau ? + { + return ((icon-234)/2)*16; + } + + if ( icon >= 250 && icon <= 265 ) // blupi en jeep ? + { + return ((icon-250)/2)*16; + } + + if ( icon >= 290 && icon <= 305 ) // disciple ? + { + return ((icon-290)/2)*16; + } + + while ( pTable[0] != -1 ) + { + for ( i=0 ; i<8 ; i++ ) + { + if ( icon == pTable[i] ) + { + return i*16; + } + } + + pTable += 8; + } + + return -1; +} + + +// Retourne l'amplitude d'une action, en nombre +// de cellules. + +int GetAmplitude(short action) +{ + if ( action == ACTION_SAUTE2 ) return 2; + if ( action == ACTION_SAUTE3 ) return 3; + if ( action == ACTION_SAUTE4 ) return 4; + if ( action == ACTION_SAUTE5 ) return 5; + + return 1; +} + + diff --git a/action.h b/action.h new file mode 100644 index 0000000..bc45d0e --- /dev/null +++ b/action.h @@ -0,0 +1,18 @@ +// Action.h +// + +extern +BOOL Action(short action, short direct, + short &phase, short &step, + short &channel, short &icon, POINT &pos, short &posZ, + short &sound); + +extern +BOOL Rotate(short &icon, short direct); + +extern +int GetIconDirect(short icon); + +extern +int GetAmplitude(short action); + diff --git a/actions.h b/actions.h new file mode 100644 index 0000000..d92b2ed --- /dev/null +++ b/actions.h @@ -0,0 +1 @@ + /* ========= */ /* actions.h */ /* ========= */ /* Dfinitions pour les automates */ /* ------------------------------ */ #define OPTERM 0 /* fin */ #define OPLIST 1 /* OPLIST i, D(i)..D(i-1) */ #define OPREPEAT 2 /* OPREPEAT, n, i, D(i)..D(i-1) */ #define OPSOUND 3 /* OPSOUND s */ /* Actions pour les objets mobiles (toto) */ /* -------------------------------------- */ typedef enum { AC_STOP_E, /* stopp vers l'est */ AC_STOP_N, /* stopp vers le nord */ AC_STOP_O, /* stopp vers l'ouest */ AC_STOP_S, /* stopp vers le sud */ AC_MARCHE_E, /* marche vers l'est */ AC_MARCHE_N, /* marche vers le nord */ AC_MARCHE_O, /* marche vers l'ouest */ AC_MARCHE_S, /* marche vers le sud */ AC_RECULE_E, /* recule vers l'est */ AC_RECULE_N, /* recule vers le nord */ AC_RECULE_O, /* recule vers l'ouest */ AC_RECULE_S, /* recule vers le sud */ AC_TOURNE_NE, /* tourne du nord  l'est */ AC_TOURNE_ON, /* tourne de l'ouest au nord */ AC_TOURNE_SO, /* tourne du sud  l'ouest */ AC_TOURNE_ES, /* tourne de l'est au sud */ AC_TOURNE_SE, /* tourne du sud  l'est */ AC_TOURNE_EN, /* tourne de l'est au nord */ AC_TOURNE_NO, /* tourne du nord  l'ouest */ AC_TOURNE_OS, /* tourne de l'ouest au sud */ AC_SAUTE1_E, /* saute vers l'est */ AC_SAUTE1_N, /* saute vers le nord */ AC_SAUTE1_O, /* saute vers l'ouest */ AC_SAUTE1_S, /* saute vers le sud */ AC_SAUTE2_E, /* saute vers l'est */ AC_SAUTE2_N, /* saute vers le nord */ AC_SAUTE2_O, /* saute vers l'ouest */ AC_SAUTE2_S, /* saute vers le sud */ AC_SAUTEDET_E, /* saute sur dtonateur vers l'est */ AC_SAUTEDET_N, /* saute sur dtonateur vers le nord */ AC_SAUTEDET_O, /* saute sur dtonateur vers l'ouest */ AC_SAUTEDET_S, /* saute sur dtonateur vers le sud */ AC_TOMBE_E, /* tombe vers l'est */ AC_TOMBE_N, /* tombe vers le nord */ AC_TOMBE_O, /* tombe vers l'ouest */ AC_TOMBE_S, /* tombe vers le sud */ AC_TOMBE_TANK_E, /* tank tombe dans trou */ AC_TOMBE_TANK_N, /* tank tombe dans trou */ AC_TOMBE_TANK_O, /* tank tombe dans trou */ AC_TOMBE_TANK_S, /* tank tombe dans trou */ AC_TOMBE_TANKB_E, /* tank tombe dans trou */ AC_TOMBE_TANKB_N, /* tank tombe dans trou */ AC_TOMBE_TANKB_O, /* tank tombe dans trou */ AC_TOMBE_TANKB_S, /* tank tombe dans trou */ AC_BOIT_E, /* boit vers l'est */ AC_BOIT_N, /* boit vers le nord */ AC_BOIT_O, /* boit vers l'ouest */ AC_BOIT_S, /* boit vers le sud */ AC_BOITX_E, /* boit mauvais vers l'est */ AC_BOITX_N, /* boit mauvais vers le nord */ AC_BOITX_O, /* boit mauvais vers l'ouest */ AC_BOITX_S, /* boit mauvais vers le sud */ AC_TOURTE_E, /* tourte vers l'est */ AC_TOURTE_N, /* tourte vers le nord */ AC_TOURTE_O, /* tourte vers l'ouest */ AC_TOURTE_S, /* tourte vers le sud */ AC_REPOS_E, /* repos vers l'est */ AC_REPOS_N, /* repos vers le nord */ AC_REPOS_O, /* repos vers l'ouest */ AC_REPOS_S, /* repos vers le sud */ AC_DORT_E, /* dort vers l'est */ AC_DORT_N, /* dort vers le nord */ AC_DORT_O, /* dort vers l'ouest */ AC_DORT_S, /* dort vers le sud */ AC_YOUPIE_E, /* youpie vers l'est */ AC_YOUPIE_N, /* youpie vers le nord */ AC_YOUPIE_O, /* youpie vers l'ouest */ AC_YOUPIE_S, /* youpie vers le sud */ AC_NON_E, /* non vers l'est */ AC_NON_N, /* non vers le nord */ AC_NON_O, /* non vers l'ouest */ AC_NON_S, /* non vers le sud */ AC_POUSSE_E, /* pousse vers l'est */ AC_POUSSE_N, /* pousse vers le nord */ AC_POUSSE_O, /* pousse vers l'ouest */ AC_POUSSE_S, /* pousse vers le sud */ AC_NPOUSSE_E, /* pousse pas vers l'est */ AC_NPOUSSE_N, /* pousse pas vers le nord */ AC_NPOUSSE_O, /* pousse pas vers l'ouest */ AC_NPOUSSE_S, /* pousse pas vers le sud */ AC_CAISSE_E, /* caisse vers l'est */ AC_CAISSE_N, /* caisse vers le nord */ AC_CAISSE_O, /* caisse vers l'ouest */ AC_CAISSE_S, /* caisse vers le sud */ AC_CAISSEV_E, /* caisse vers l'est */ AC_CAISSEV_N, /* caisse vers le nord */ AC_CAISSEV_O, /* caisse vers l'ouest */ AC_CAISSEV_S, /* caisse vers le sud */ AC_CAISSEO_E, /* caisse vers l'est */ AC_CAISSEO_N, /* caisse vers le nord */ AC_CAISSEO_O, /* caisse vers l'ouest */ AC_CAISSEO_S, /* caisse vers le sud */ AC_CAISSEOD_E, /* caisse dclre vers l'est */ AC_CAISSEOD_N, /* caisse dclre vers le nord */ AC_CAISSEOD_O, /* caisse dclre vers l'ouest */ AC_CAISSEOD_S, /* caisse dclre vers le sud */ AC_CAISSEG_E, /* caisse vers l'est */ AC_CAISSEG_N, /* caisse vers le nord */ AC_CAISSEG_O, /* caisse vers l'ouest */ AC_CAISSEG_S, /* caisse vers le sud */ AC_CAISSE_T, /* caisse tombe dans trou */ AC_CAISSEV_T, /* caisse tombe dans trou */ AC_CAISSEO_T, /* caisse tombe dans trou */ AC_CAISSEG_T, /* caisse tombe dans trou */ AC_VISION_E, /* vision vers l'est */ AC_VISION_N, /* vision vers le nord */ AC_VISION_O, /* vision vers l'ouest */ AC_VISION_S, /* vision vers le sud */ AC_DEPART_E, /* dpart vers l'est */ AC_BALLON_E, /* ballon vers l'est */ AC_ARRIVEE_E, /* arrive vers l'est */ AC_ARRIVEE_N, /* arrive vers le nord */ AC_ARRIVEE_O, /* arrive vers l'ouest */ AC_ARRIVEE_S, /* arrive vers le sud */ AC_ARRIVEE_M, /* arrive avec le ballon */ AC_BALLON_M, /* arrive ballon monte */ AC_PIANO_O, /* joue du piano */ AC_MAGIC_E, /* magique vers l'est */ AC_MAGIC_N, /* magique vers le nord */ AC_MAGIC_O, /* magique vers l'ouest */ AC_MAGIC_S, /* magique vers le sud */ AC_ELECTRO_O, /* lectrocut vers l'ouest */ AC_TELE_N, /* tlvision vers le nord */ AC_MECHANT_E, /* mchant vers l'est */ AC_MECHANT_N, /* mchant vers le nord */ AC_MECHANT_O, /* mchant vers l'ouest */ AC_MECHANT_S, /* mchant vers le sud */ AC_GLISSE_E, /* glisse vers l'est */ AC_GLISSE_N, /* glisse vers le nord */ AC_GLISSE_O, /* glisse vers l'ouest */ AC_GLISSE_S, /* glisse vers le sud */ AC_LIVRE_E, /* livre vers l'est */ AC_LIVRE_N, /* livre vers le nord */ AC_LIVRE_O, /* livre vers l'ouest */ AC_LIVRE_S, /* livre vers le sud */ AC_MUSIQUE_E, /* musique vers l'est */ AC_MUSIQUE_N, /* musique vers le nord */ AC_MUSIQUE_O, /* musique vers l'ouest */ AC_MUSIQUE_S, /* musique vers le sud */ AC_CLE_E, /* cl vers l'est */ AC_CLE_N, /* cl vers le nord */ AC_CLE_O, /* cl vers l'ouest */ AC_CLE_S, /* cl vers le sud */ AC_PORTE_E, /* porte vers l'est */ AC_PORTE_N, /* porte vers le nord */ AC_PORTE_O, /* porte vers l'ouest */ AC_PORTE_S, /* porte vers le sud */ AC_BAISSE_O, /* baisse vers l'ouest */ AC_EXPLOSE_E, /* trop mang vers l'est */ AC_EXPLOSE_N, /* trop mang vers le nord */ AC_EXPLOSE_O, /* trop mang vers l'ouest */ AC_EXPLOSE_S, /* trop mang vers le sud */ AC_START_E, /* dpart vers l'est */ AC_START_N, /* dpart vers le nord */ AC_START_O, /* dpart vers l'ouest */ AC_START_S, /* dpart vers le sud */ AC_REFLEXION_E, /* rflexion vers l'est */ AC_REFLEXION_N, /* rflexion vers le nord */ AC_REFLEXION_O, /* rflexion vers l'ouest */ AC_REFLEXION_S, /* rflexion vers le sud */ AC_HAUSSE_E, /* hausse vers l'est */ AC_HAUSSE_N, /* hausse vers le nord */ AC_HAUSSE_O, /* hausse vers l'ouest */ AC_HAUSSE_S, /* hausse vers le sud */ AC_YOYO_E, /* yoyo vers l'est */ AC_YOYO_N, /* yoyo vers le nord */ AC_YOYO_O, /* yoyo vers l'ouest */ AC_YOYO_S, /* yoyo vers le sud */ AC_TANK /* bouzill par le tank */ } Action; /* Actions pour les objets anims (dcor) */ /* -------------------------------------- */ typedef enum { OB_DETONATEURA, /* dtonateur qui s'abaisse */ OB_DETONATEURB, OB_DETONATEURC, OB_BOMBEA, /* bombe qui explose */ OB_BOMBEB, OB_BOMBEC, OB_SENSUNIO, /* sens-unique qui monte */ OB_SENSUNIE, OB_SENSUNIN, OB_SENSUNIS, OB_VITRENS, /* vitre qui casse */ OB_VITREEO, OB_BALLONEX, /* ballon qui explose */ OB_BAISSE, /* porte lectronique qui se baisse */ OB_TELE, /* tl en marche */ OB_UNSEUL, /* trappe qui s'ouvre */ OB_DEPART, /* ouverture-fermeture du dpart */ OB_TROPBU /* le sol s'ouvre */ } Objet; /* Bruitages divers */ /* ---------------- */ typedef enum { SOUND_SAUT1 = 1, /* toto va sauter */ SOUND_SAUT2 = 2, /* toto retombe aprs un saut */ SOUND_TROPBU = 3, /* toto a trop bu */ SOUND_TOMBE = 4, /* toto tombe dans un trou */ SOUND_TROUVEBALLON = 5, /* toto  trouv le ballon */ SOUND_TROUVECLE = 6, /* toto  trouv une cl */ SOUND_BOIT = 7, /* toto boit  la bouteille */ SOUND_MAGIE = 8, /* toto va devenir transparent */ SOUND_ELECTRO = 9, /* toto s'lectrocute */ SOUND_ARRIVE = 10, /* toto arrive de sous-terre accroch  un ballon */ SOUND_REPOS = 11, /* toto se repose */ SOUND_DORT = 12, /* toto s'endort */ SOUND_GLISSE = 13, /* toto glisse sur une peau de banane */ SOUND_TOURTE = 14, /* toto crase la tourte */ SOUND_LUNETTES = 15, /* toto met ses lunettes */ SOUND_CREVE = 16, /* toto mchant crve un ballon */ SOUND_LIVRE = 17, /* toto lit un livre */ SOUND_MALADE = 18, /* toto tombe malade */ SOUND_POUSSE = 19, /* toto pousse une caisse */ SOUND_SENSUNI = 20, /* seus-unique se lve */ SOUND_PORTEOUVRE = 21, /* porte qui s'ouvre */ SOUND_PORTEBAISSE = 22, /* porte blinde qui se baisse */ SOUND_UNSEUL = 23, /* main qui sort */ SOUND_VITRECASSE = 24, /* vitre qui se casse */ SOUND_BOMBE = 25, /* bombe qui explose */ SOUND_NON = 26, /* toto fait non-non */ SOUND_CLIC = 27, /* clic sur un bouton */ SOUND_CAISSE = 28, /* caisse qui tombe */ SOUND_CAISSEV = 29, /* structure lgre qui tombe */ SOUND_CAISSEO = 30, /* boule qui tombe */ SOUND_ACTION = 31, /* action dans le dcor */ SOUND_MECHANT = 32, /* toto devient mchant */ SOUND_PASSEMUR = 33, /* toto traverse un mur */ SOUND_AIMANT = 34, /* arrive sur un aimant */ SOUND_PORTEBAISSE2 = 35, /* porte blinde ouverte */ SOUND_MACHINE = 36, /* machine lectronique */ SOUND_OISEAUX = 37, /* oiseaux */ SOUND_BURP = 38, /* toto a trop bu */ SOUND_CAISSEG = 39, /* machine qui tombe */ SOUND_MUSIC11 = 101, /* musique 1-1 */ SOUND_MUSIC12 = 102, /* musique 1-2 */ SOUND_MUSIC13 = 103, /* musique 1-3 */ SOUND_MUSIC14 = 104, /* musique 1-4 */ SOUND_MUSIC21 = 105, /* musique 2-1 */ SOUND_MUSIC22 = 106, /* musique 2-2 */ SOUND_MUSIC23 = 107, /* musique 2-3 */ SOUND_MUSIC24 = 108, /* musique 2-4 */ SOUND_MUSIC31 = 109, /* musique 3-1 */ SOUND_MUSIC32 = 110, /* musique 3-2 */ SOUND_MUSIC33 = 111, /* musique 3-3 */ SOUND_MUSIC34 = 112, /* musique 3-4 */ SOUND_MUSIC41 = 113, /* musique 4-1 */ SOUND_MUSIC42 = 114, /* musique 4-2 */ SOUND_MUSIC43 = 115, /* musique 4-3 */ SOUND_MUSIC44 = 116 /* musique 4-4 */ } Sound; /* Procdures communes */ /* ------------------- */ extern short* ConvActionToTabIcon (Action action, short typemarche); extern short* ConvActionToTabMove (Action action); extern short* ConvObjetToTabIcon (Objet objet); \ No newline at end of file diff --git a/arrange.cpp b/arrange.cpp new file mode 100644 index 0000000..3132093 --- /dev/null +++ b/arrange.cpp @@ -0,0 +1,977 @@ +// Arrange.cpp +// + +#include "DECOR.H" +#include "MISC.H" + +// Cette table indique les quarts de cases contenant de +// l'eau lorsque la valeur est à un. +// 0 1 +// 2 3 +static char tableSee[14*4] = +{ + 0,0,0,0, // 1 + 0,1,0,1, // 2 + 0,0,1,1, // 3 + 1,0,1,0, // 4 + 1,1,0,0, // 5 + 0,0,0,1, // 6 + 0,0,1,0, // 7 + 1,0,0,0, // 8 + 0,1,0,0, // 9 + 0,1,1,1, // 10 + 1,0,1,1, // 11 + 1,1,1,0, // 12 + 1,1,0,1, // 13 + 1,1,1,1, // 14 +}; + +// Cette table indique les quarts de cases contenant de +// la mousse ou de la terre lorsque la valeur est à un. +// 0 1 +// 2 3 +static char tableDark[13*4] = +{ + 1,1,1,1, // 20 + 0,1,0,1, // 21 + 0,0,1,1, // 22 + 1,0,1,0, // 23 + 1,1,0,0, // 24 + 0,0,0,1, // 25 + 0,0,1,0, // 26 + 1,0,0,0, // 27 + 0,1,0,0, // 28 + 1,1,1,0, // 29 + 1,1,0,1, // 30 + 0,1,1,1, // 31 + 1,0,1,1, // 32 +}; + +// Retourne les bits contenant de l'eau. + +BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index) +{ + int icon; + + pBits[0] = 0; + pBits[1] = 0; + pBits[2] = 0; + pBits[3] = 0; + + if ( cel.x < 0 || cel.x >= MAXCELX || + cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + + icon = m_decor[cel.x/2][cel.y/2].floorIcon; + + if ( index == 0 ) // eau ? + { + if ( icon < 1 || icon > 14 ) return TRUE; + icon -= 1; + pBits[0] = tableSee[icon*4+0]; + pBits[1] = tableSee[icon*4+1]; + pBits[2] = tableSee[icon*4+2]; + pBits[3] = tableSee[icon*4+3]; + } + + if ( index == 1 ) // mousse ? + { + if ( icon >= 2 && icon <= 14 ) return FALSE; // eau ? + if ( icon == 66 || icon == 79 ) // mousse spéciale ? + { + pBits[0] = 1; + pBits[1] = 1; + pBits[2] = 1; + pBits[3] = 1; + return TRUE; + } + if ( icon < 20 || icon > 32 ) return TRUE; + icon -= 20; + pBits[0] = tableDark[icon*4+0]; + pBits[1] = tableDark[icon*4+1]; + pBits[2] = tableDark[icon*4+2]; + pBits[3] = tableDark[icon*4+3]; + } + + if ( index == 2 ) // terre ? + { + if ( icon >= 2 && icon <= 14 ) return FALSE; // eau ? + if ( (icon >= 46 && icon <= 48) || // terre spéciale ? + icon == 71 ) // terre à fer ? + { + pBits[0] = 1; + pBits[1] = 1; + pBits[2] = 1; + pBits[3] = 1; + return TRUE; + } + if ( icon < 33 || icon > 45 ) return TRUE; + icon -= 33; + pBits[0] = tableDark[icon*4+0]; + pBits[1] = tableDark[icon*4+1]; + pBits[2] = tableDark[icon*4+2]; + pBits[3] = tableDark[icon*4+3]; + } + + return TRUE; +} + +void CopyBits(char *pDst, char *pSrc) +{ + for ( int i=0 ; i<4 ; i++ ) + { + *pDst++ = *pSrc++; + } +} + +BOOL ChangeBits(char *pDst, char *pSrc) +{ + for ( int i=0 ; i<4 ; i++ ) + { + if ( *pDst++ != *pSrc++ ) return TRUE; + } + return FALSE; +} + +// Retourne l'icône correspondant aux bits d'eaux. + +int CDecor::GetSeeIcon(char *pBits, int index) +{ + int i; + + if ( index == 0 ) // eau ? + { + for ( i=0 ; i<14 ; i++ ) + { + if ( tableSee[i*4+0] == pBits[0] && + tableSee[i*4+1] == pBits[1] && + tableSee[i*4+2] == pBits[2] && + tableSee[i*4+3] == pBits[3] ) return i+1; + } + } + + if ( index == 1 ) // mousse ? + { + for ( i=0 ; i<13 ; i++ ) + { + if ( tableDark[i*4+0] == pBits[0] && + tableDark[i*4+1] == pBits[1] && + tableDark[i*4+2] == pBits[2] && + tableDark[i*4+3] == pBits[3] ) return i+20; + } + } + + if ( index == 2 ) // terre ? + { + for ( i=0 ; i<13 ; i++ ) + { + if ( tableDark[i*4+0] == pBits[0] && + tableDark[i*4+1] == pBits[1] && + tableDark[i*4+2] == pBits[2] && + tableDark[i*4+3] == pBits[3] ) return i+33; + } + } + + if ( pBits[0] == 0 && + pBits[1] == 0 && + pBits[2] == 0 && + pBits[3] == 0 ) return 1; // herbe + + return -1; +} + +// Arrange le sol après une modification. + +void CDecor::ArrangeFloor(POINT cel) +{ + POINT test; + int max, index, icon; + char here[4], bits[4], init[4]; + BOOL bModif = FALSE; + + icon = m_decor[cel.x/2][cel.y/2].floorIcon; + + if ( icon >= 59 && icon <= 64 ) return; // pont ? + + max = 3; + if ( icon >= 15 && icon <= 18 ) // dalle spéciale ? + { + max = 1; // s'occupe que de l'eau ! + } + + for ( index=0 ; index last ) + { + icons[i] = -1; + } + } + else + { + icons[i] = -1; + } + } + + for ( i=0 ; i<4 ; i++ ) + { + if ( icons[i] == -1 ) + { + murs[i] = 0; + } + else + { + murs[i] = tableMur[(icons[i]-first)*5+1+((i+2)%4)]; + } + } + + for ( i=0 ; i<15 ; i++ ) + { + if ( murs[0] == tableMur[i*5+1] && + murs[1] == tableMur[i*5+2] && + murs[2] == tableMur[i*5+3] && + murs[3] == tableMur[i*5+4] ) + { + icon = tableMur[i*5+0]; + icon += first-20; + return; + } + } + + icon = -1; +} + +// Arrange les objets avant une construction. + +void CDecor::ArrangeBuild(POINT cel, int &channel, int &icon) +{ + int index, i, x, y; + int first, last, matiere; + int oldChannel, oldIcon; + + for ( index=0 ; index<3 ; index++ ) + { + if ( index == 0 ) + { + first = 20; + last = 26; + matiere = 44; // pierres + } + if ( index == 1 ) + { + first = 65; + last = 71; + matiere = 36; // planches + } + if ( index == 2 ) + { + first = 106; + last = 112; + matiere = 36; // planches + } + + // Rien à faire si pas mur. + if ( channel != CHOBJECT || icon != last ) continue; + + oldChannel = m_decor[cel.x/2][cel.y/2].objectChannel; + oldIcon = m_decor[cel.x/2][cel.y/2].objectIcon; + + m_decor[cel.x/2][cel.y/2].objectChannel = channel; + m_decor[cel.x/2][cel.y/2].objectIcon = icon; + + for ( i=0 ; i<4 ; i++ ) + { + x = cel.x + tableMurDir[i*2+0]; + y = cel.y + tableMurDir[i*2+1]; + + if ( IsValid(GetCel(x,y)) ) + { + icon = m_decor[x/2][y/2].objectIcon; + if ( icon == matiere ) // pierres/planches ? + { + MoveGetObject(GetCel(x,y), channel, icon); + } + + if ( icon >= first && icon <= last ) + { + ArrangeMur(GetCel(x,y), icon, index); + + if ( icon != -1 ) + { + if ( !MovePutObject(GetCel(x,y), channel, icon) ) + { + m_decor[x/2][y/2].objectChannel = channel; + m_decor[x/2][y/2].objectIcon = icon; + } + } + } + } + } + + m_decor[cel.x/2][cel.y/2].objectChannel = oldChannel; + m_decor[cel.x/2][cel.y/2].objectIcon = oldIcon; + + ArrangeMur(cel, icon, index); + if ( icon == -1 ) icon = last; + } +} + +// Arrange les objets après une modification. + +void CDecor::ArrangeObject(POINT cel) +{ + int channel, icon; + int first, last; + int index, i, j, k, x, y; + POINT vector, test, pos; + BOOL bTour; + + for ( index=0 ; index<3 ; index++ ) + { + if ( index == 0 ) + { + first = 20; // murs + last = 26; + } + if ( index == 1 ) + { + first = 65; // palissades + last = 71; + } + if ( index == 2 ) + { + first = 106; // barrière + last = 112; + } + + for ( i=0 ; i<4 ; i++ ) + { + x = cel.x + tableMurDir[i*2+0]; + y = cel.y + tableMurDir[i*2+1]; + + if ( IsValid(GetCel(x,y)) ) + { + icon = m_decor[x/2][y/2].objectIcon; + if ( icon >= first && icon <= last ) + { + ArrangeMur(GetCel(x,y), icon, index); + + if ( icon != -1 ) + { + m_decor[x/2][y/2].objectChannel = CHOBJECT; + m_decor[x/2][y/2].objectIcon = icon; + } + } + } + } + + if ( m_decor[cel.x/2][cel.y/2].objectIcon == last ) + { + ArrangeMur(cel, icon, index); + if ( icon == -1 ) icon = last; + + m_decor[cel.x/2][cel.y/2].objectChannel = CHOBJECT; + m_decor[cel.x/2][cel.y/2].objectIcon = icon; + } + } + + // Arrange les rayons entre les tours. + if ( m_decor[cel.x/2][cel.y/2].objectIcon == 27 || // tour ? + m_decor[cel.x/2][cel.y/2].objectIcon == -1 ) // rien ? + { + for ( i=0 ; i<4 ; i++ ) + { + vector = GetVector(i*2*16); + test = cel; + + bTour = FALSE; + j = 0; + while ( TRUE ) + { + test.x += vector.x*2; + test.y += vector.y*2; + + if ( m_decor[test.x/2][test.y/2].objectIcon == 27 ) // tour ? + { + bTour = TRUE; + break; + } + + if ( m_decor[test.x/2][test.y/2].objectIcon != -1 && + m_decor[test.x/2][test.y/2].objectIcon != 10001-i%2 ) + { + break; + } + + j ++; + if ( j >= 2+1 ) break; + } + + if ( m_decor[cel.x/2][cel.y/2].objectIcon != 27 ) // pas tour ? + { + bTour = FALSE; + } + + test = cel; + for ( k=0 ; kPlayImage(SOUND_RAYON1, pos); + } + + if ( !m_bBuild && !bTour ) + { + MoveFinish(test); + } + } + } + } +} + + + +// Test s'il faut remplir le sol ici. + +BOOL CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2) +{ + POINT cel; + int icon1, icon2; + + icon1 = m_fillSearchIcon; + icon2 = m_fillSearchIcon; + + if ( m_fillPutChannel == CHFLOOR && + m_fillPutIcon == 1 && // met de l'herbe.. + m_fillSearchIcon == 14 ) // ..sur de l'eau ? + { + icon1 = 2; + icon2 = 14; // eau & rives + } + + if ( m_fillPutChannel == CHFLOOR && + m_fillPutIcon == 14 && // met de l'eau.. + m_fillSearchIcon == 1 ) // ..sur de l'herbe ? + { + icon1 = 1; + icon2 = 13; // herbe & rives + } + + for ( cel.x=cel1.x ; cel.x<=cel2.x ; cel.x+=2 ) + { + for ( cel.y=cel1.y ; cel.y<=cel2.y ; cel.y+=2 ) + { + if ( !IsValid(cel) ) continue; + + if ( m_decor[cel.x/2][cel.y/2].floorChannel != m_fillSearchChannel || + m_decor[cel.x/2][cel.y/2].floorIcon < icon1 || + m_decor[cel.x/2][cel.y/2].floorIcon > icon2 ) + { + return FALSE; + } + + if ( m_fillPutChannel == CHFLOOR && + m_fillPutIcon == 14 && // met de l'eau ? + m_decor[cel.x/2][cel.y/2].objectIcon != -1 ) + { + return FALSE; + } + } + } + + if ( m_fillPutChannel == CHFLOOR && + m_fillPutIcon == 14 && // met de l'eau ? + IsBlupiHereEx(cel1, cel2, -1, FALSE) ) + { + return FALSE; + } + + return TRUE; +} + +// Test s'il faut remplir ici. + +BOOL CDecor::ArrangeFillTest(POINT pos) +{ + POINT cel1, cel2; + + if ( m_pFillMap[(pos.x/2)+(pos.y/2)*(MAXCELX/2)] == 1 ) + { + return FALSE; + } + + if ( m_bFillFloor ) + { + cel1.x = pos.x-2; + cel1.y = pos.y-2; + cel2.x = pos.x+3; + cel2.y = pos.y+3; + return ArrangeFillTestFloor(cel1, cel2); + } + else + { + if ( m_decor[pos.x/2][pos.y/2].objectChannel == m_fillSearchChannel && + m_decor[pos.x/2][pos.y/2].objectIcon == m_fillSearchIcon && + !IsBlupiHereEx(GetCel(pos.x+0,pos.y+0), + GetCel(pos.x+1,pos.y+1), -1, FALSE) ) + { + if ( m_decor[pos.x/2][pos.y/2].floorChannel == CHFLOOR && + m_decor[pos.x/2][pos.y/2].floorIcon >= 2 && + m_decor[pos.x/2][pos.y/2].floorIcon <= 14 ) // rive ou eau ? + { + return FALSE; + } + + return TRUE; + } + } + + return FALSE; +} + +// Modifie le décor lors d'un remplissage. + +void CDecor::ArrangeFillPut(POINT pos, int channel, int icon) +{ + if ( m_bFillFloor ) + { + PutFloor(pos, channel, icon); + ArrangeFloor(pos); + } + else + { + if ( icon >= 0 && icon <= 5 ) // plantes ? + { + icon = Random(0,5); + } + if ( icon >= 6 && icon <= 11 ) // arbres ? + { + icon = Random(6,11); + } + if ( icon >= 37 && icon <= 43 ) // rochers ? + { + icon = Random(37,43); + } + PutObject(pos, channel, icon); + ArrangeObject(pos); + } +} + +// Rempli un sol à partir d'une position donnée. + +void CDecor::ArrangeFillSearch(POINT pos) +{ + int startX, endX; + + // Cherche la borne gauche. + startX = pos.x; + endX = pos.x; + while ( pos.x > 0 && ArrangeFillTest(pos) ) + { + pos.x -= 2; + } + startX = pos.x+2; + + // Cherche la borne droite. + pos.x = endX; + while ( pos.x < MAXCELX-2 && ArrangeFillTest(pos) ) + { + pos.x += 2; + } + endX = pos.x-2; + + // Rempli toute la ligne trouvée. + pos.x = startX; + while ( pos.x <= endX ) + { + m_pFillMap[(pos.x/2)+(pos.y/2)*(MAXCELX/2)] = 1; + pos.x += 2; + } + + // Cherche la ligne au-dessus. + if ( pos.y > 0 ) + { + pos.y -= 2; + pos.x = startX; + while ( pos.x <= endX ) + { + while ( pos.x <= endX && !ArrangeFillTest(pos) ) + { + pos.x += 2; + } + if ( pos.x > endX ) break; + + if ( ArrangeFillTest(pos) ) + { + ArrangeFillSearch(pos); // appel récursif + } + + while ( pos.x <= endX && ArrangeFillTest(pos) ) + { + pos.x += 2; + } + } + pos.y += 2; + } + + // Cherche la ligne au-dessous. + if ( pos.y < MAXCELY-2 ) + { + pos.y += 2; + pos.x = startX; + while ( pos.x <= endX ) + { + while ( pos.x <= endX && !ArrangeFillTest(pos) ) + { + pos.x += 2; + } + if ( pos.x > endX ) break; + + if ( ArrangeFillTest(pos) ) + { + ArrangeFillSearch(pos); // appel récursif + } + + while ( pos.x <= endX && ArrangeFillTest(pos) ) + { + pos.x += 2; + } + } + } +} + +// Rempli un sol à partir d'une position donnée. + +void CDecor::ArrangeFill(POINT pos, int channel, int icon, BOOL bFloor) +{ + m_bFillFloor = bFloor; + + pos.x = (pos.x/2)*2; + pos.y = (pos.y/2)*2; + + m_fillPutChannel = channel; + m_fillPutIcon = icon; + + if ( bFloor ) + { + GetFloor(pos, m_fillSearchChannel, m_fillSearchIcon); + } + else + { + GetObject(pos, m_fillSearchChannel, m_fillSearchIcon); + } + + m_pFillMap = (char*)malloc(MAXCELX*MAXCELY*sizeof(char)/4); + if ( m_pFillMap == NULL ) return; + memset(m_pFillMap, 0, MAXCELX*MAXCELY*sizeof(char)/4); + + ArrangeFillSearch(pos); + + for ( pos.x=0 ; pos.x +#include +#include +#include +#include +#include // link WINMM.LIB as well +#include "def.h" +#include "resource.h" +#include "ddutil.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "movie.h" +#include "button.h" +#include "menu.h" +#include "jauge.h" +#include "event.h" +#include "misc.h" + + +// Définitions globales + +#define NAME "Blupi" +#define TITLE "Blupi" + + +// Variables globales + +HWND g_hWnd; // handle à la fenêtre +CEvent* g_pEvent = NULL; +CPixmap* g_pPixmap = NULL; // pixmap principal +CSound* g_pSound = NULL; // sound principal +CMovie* g_pMovie = NULL; // movie principal +CDecor* g_pDecor = NULL; +char g_CDPath[MAX_PATH]; // chemin d'accès au CD-Rom +BOOL g_bFullScreen = FALSE; // FALSE si mode de test +int g_speedRate = 1; +int g_timerInterval = 50; // inverval = 50ms +int g_mouseType = MOUSETYPEGRA; +MMRESULT g_updateTimer; // timer général +BOOL g_bActive = TRUE; // is application active ? +BOOL g_bTermInit = FALSE; // initialisation en cours + +UINT g_lastPhase = 999; + + + + +// Lit un numéro décimal. + +int GetNum(char *p) +{ + int n = 0; + + while ( *p >= '0' && *p <= '9' ) + { + n *= 10; + n += (*p++)-'0'; + } + + return n; +} + +// Lit le fichier de configuration. + +BOOL ReadConfig(LPSTR lpCmdLine) +{ + FILE* file = NULL; + char buffer[200]; + char* pText; + int nb; + + file = fopen("data\\config.def", "rb"); + if ( file == NULL ) return FALSE; + nb = fread(buffer, sizeof(char), 200-1, file); + buffer[nb] = 0; + fclose(file); + +#if 0 + pText = strstr(buffer, "CD-Rom="); + if ( pText == NULL ) + { +#if _DEMO + GetCurrentDirectory(MAX_PATH, g_CDPath); + i = strlen(g_CDPath); + if ( i > 0 && g_CDPath[i-1] != '\\' ) + { + g_CDPath[i++] = '\\'; + g_CDPath[i] = 0; // met le terminateur + } +#else + return FALSE; +#endif + } + else + { + pText += 7; + i = 0; + while ( pText[i] != 0 && pText[i] != '\n' && pText[i] != '\r' ) + { + g_CDPath[i] = pText[i]; + i ++; + } + if ( i > 0 && g_CDPath[i-1] != '\\' ) + { + g_CDPath[i++] = '\\'; + } + g_CDPath[i] = 0; // met le terminateur + } + +#if !_DEMO & !_EGAMES + if ( strstr(lpCmdLine, "-nocd") == NULL ) + { + char drive[10]; + + drive[0] = g_CDPath[0]; + drive[1] = ':'; + drive[2] = '\\'; + drive[3] = 0; + nb = GetDriveType(drive); + if ( nb != DRIVE_CDROM ) return FALSE; + } +#endif +#endif + + pText = strstr(buffer, "SpeedRate="); + if ( pText != NULL ) + { + g_speedRate = GetNum(pText+10); + if ( g_speedRate < 1 ) g_speedRate = 1; + if ( g_speedRate > 2 ) g_speedRate = 2; + } + + pText = strstr(buffer, "Timer="); + if ( pText != NULL ) + { + g_timerInterval = GetNum(pText+6); + if ( g_timerInterval < 10 ) g_timerInterval = 10; + if ( g_timerInterval > 1000 ) g_timerInterval = 1000; + } + + pText = strstr(buffer, "FullScreen="); + if ( pText != NULL ) + { + g_bFullScreen = GetNum(pText+11); + if ( g_bFullScreen != 0 ) g_bFullScreen = 1; + } + + pText = strstr(buffer, "MouseType="); + if ( pText != NULL ) + { + g_mouseType = GetNum(pText+10); + if ( g_mouseType < 1 ) g_mouseType = 1; + if ( g_mouseType > 9 ) g_mouseType = 9; + } + + return TRUE; +} + + +// Mise à jour principale. + +void UpdateFrame(void) +{ + RECT clip, rcRect; + UINT phase; + POINT posMouse; + int i, term, speed; + + g_pPixmap->MouseBackClear(); // enlève la souris dans "back" + posMouse = g_pEvent->GetLastMousePos(); + + phase = g_pEvent->GetPhase(); + + if ( phase == g_lastPhase && + phase == WM_PHASE_PLAY ) + { +//? rcRect.left = POSDRAWX; +//? rcRect.top = POSDRAWY; +//? rcRect.right = POSDRAWX+DIMDRAWX; +//? rcRect.bottom = POSDRAWY+DIMDRAWY; +//? g_pPixmap->DrawImage(-1, CHBACK, rcRect, 1); // dessine le fond + } + else + { + rcRect.left = 0; + rcRect.top = 0; + rcRect.right = LXIMAGE; + rcRect.bottom = LYIMAGE; + g_pPixmap->DrawImage(-1, CHBACK, rcRect, 1); // dessine le fond + } + + if ( phase == WM_PHASE_INTRO1 || + phase == WM_PHASE_INTRO2 ) + { + g_pEvent->IntroStep(); + } + + if ( phase == WM_PHASE_PLAY ) + { + clip.left = POSDRAWX; + clip.top = POSDRAWY+g_pDecor->GetInfoHeight(); + clip.right = POSDRAWX+DIMDRAWX; + clip.bottom = POSDRAWY+DIMDRAWY; + + if ( g_pEvent->IsShift() ) // shift en cours ? + { + g_pEvent->DecorAutoShift(posMouse); + g_pDecor->Build(clip, posMouse); // construit juste le décor + } + else + { + if ( !g_pEvent->GetPause() ) + { + speed = g_pEvent->GetSpeed() * g_speedRate; + for ( i=0 ; iBlupiStep(i==0); // avance tous les blupi + g_pDecor->MoveStep(i==0); // avance tous les décors + g_pEvent->DemoStep(); // avance enregistrement/reproduction + } + } + + g_pEvent->DecorAutoShift(posMouse); + g_pDecor->Build(clip, posMouse); // construit le décor + g_pDecor->NextPhase(1); // refait la carte de temps en temps + } + } + + if ( phase == WM_PHASE_BUILD ) + { + clip.left = POSDRAWX; + clip.top = POSDRAWY; + clip.right = POSDRAWX+DIMDRAWX; + clip.bottom = POSDRAWY+DIMDRAWY; + g_pEvent->DecorAutoShift(posMouse); + g_pDecor->Build(clip, posMouse); // construit le décor + g_pDecor->NextPhase(-1); // refait la carte chaque fois + } + + if ( phase == WM_PHASE_INIT ) + { + g_pEvent->DemoStep(); // démarre év. démo automatique + } + + g_pEvent->DrawButtons(); + + g_lastPhase = phase; + + if ( phase == WM_PHASE_H0MOVIE || + phase == WM_PHASE_H1MOVIE || + phase == WM_PHASE_H2MOVIE || + phase == WM_PHASE_PLAYMOVIE || + phase == WM_PHASE_WINMOVIE ) + { + g_pEvent->MovieToStart(); // fait démarrer un film si nécessaire + } + + if ( phase == WM_PHASE_INSERT ) + { + g_pEvent->TryInsert(); + } + + if ( phase == WM_PHASE_PLAY ) + { + term = g_pDecor->IsTerminated(); + if ( term == 1 ) g_pEvent->ChangePhase(WM_PHASE_LOST); // perdu + if ( term == 2 ) g_pEvent->ChangePhase(WM_PHASE_WINMOVIE); // gagné + } + + g_pPixmap->MouseBackDraw(); // remet la souris dans "back" +} + + +void Benchmark() +{ + int i; + POINT pos = { 0, 0 }; + + g_pPixmap->DrawIcon(-1, 2, 10, pos, 0); + + pos.x = 300; + pos.y = 350; + for ( i=0 ; i<10000 ; i++ ) + { + g_pPixmap->DrawIcon(-1, 2, i%4, pos, 0); + } + + g_pPixmap->DrawIcon(-1, 2, 10, pos, 0); + g_pSound->Play(0); +} + + +// Restitue le jeu après une activation en mode fullScreen. + +BOOL RestoreGame() +{ + if ( g_pPixmap == NULL ) return FALSE; + + g_pEvent->RestoreGame(); + return g_pPixmap->Restore(); +} + +// Libère le jeu avant une désactivation en mode fullScreen. + +BOOL FlushGame() +{ + if ( g_pPixmap == NULL ) return FALSE; + + return g_pPixmap->Flush(); +} + + +// Finished with all objects we use; release them. + +static void FinishObjects(void) +{ + if ( g_pMovie != NULL ) + { + g_pEvent->StopMovie(); + + delete g_pMovie; + g_pMovie = NULL; + } + + if ( g_pEvent != NULL ) + { + delete g_pEvent; + g_pEvent = NULL; + } + + if ( g_pDecor != NULL ) + { + delete g_pDecor; + g_pDecor = NULL; + } + + if ( g_pSound != NULL ) + { + g_pSound->StopMusic(); // stoppe la musique Midi + + delete g_pSound; + g_pSound = NULL; + } + + if ( g_pPixmap != NULL ) + { + delete g_pPixmap; + g_pPixmap = NULL; + } +} + + +LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + static HINSTANCE hInstance; + POINT mousePos, totalDim, iconDim; + +#if 0 + if ( message != WM_TIMER ) + { + char s[100]; + sprintf(s, "message=%d,%d\n", message, wParam); + OutputDebug(s); + } +#endif + + // La touche F10 envoie un autre message pour activer + // le menu dans les applications Windows standard ! + if ( message == WM_SYSKEYDOWN && wParam == VK_F10 ) + { + message = WM_KEYDOWN; + } + if ( message == WM_SYSKEYUP && wParam == VK_F10 ) + { + message = WM_KEYUP; + } + + if ( g_pEvent != NULL && + g_pEvent->TreatEvent(message, wParam, lParam) ) return 0; + + switch( message ) + { + case WM_TIMER: + case WM_UPDATE: + if ( !g_pEvent->IsMovie() ) // pas de film en cours ? + { + if ( g_bActive ) + { + UpdateFrame(); + } + g_pPixmap->Display(); + } + break; + + case WM_CREATE: + hInstance = ((LPCREATESTRUCT)lParam)->hInstance; + return 0; + + case WM_ACTIVATEAPP: + g_bActive = (wParam != 0); + if ( g_bActive ) // active ? + { + if ( g_bFullScreen ) + { + RestoreGame(); + g_lastPhase = 999; + } + if ( !g_bFullScreen && g_bTermInit ) + { + totalDim.x = 64; + totalDim.y = 66; + iconDim.x = 64; + iconDim.y = 66/2; + g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, TRUE); + g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu + + g_pPixmap->SavePalette(); + g_pPixmap->InitSysPalette(); + } + SetWindowText(hWnd, "Blupi"); + if ( g_pSound != NULL ) g_pSound->RestartMusic(); + } + else // désactive ? + { + if ( g_bFullScreen ) + { + FlushGame(); + } + SetWindowText(hWnd, "Blupi -- stop"); + if ( g_pSound != NULL ) g_pSound->SuspendMusic(); + } + return 0; + + case WM_SYSCOLORCHANGE: + OutputDebug("Event WM_SYSCOLORCHANGE\n"); + break; + + case WM_QUERYNEWPALETTE: + OutputDebug("Event WM_QUERYNEWPALETTE\n"); + break; + + case WM_PALETTECHANGED: + OutputDebug("Event WM_PALETTECHANGED\n"); + break; + + case WM_DISPLAYCHANGE: + OutputDebug("Event WM_DISPLAYCHANGE\n"); + break; + + case MM_MCINOTIFY: + OutputDebug("Event MM_MCINOTIFY\n"); + if ( g_pEvent->IsMovie() ) // film en cours ? + { + if ( wParam == MCI_NOTIFY_SUCCESSFUL ) + { + g_pEvent->StopMovie(); + } + } + else + { + // music over, play it again + g_pSound->SuspendMusic(); + // if music finished, play it again. Otherwise assume that + // it was aborted by the user or otherwise + if ( wParam == MCI_NOTIFY_SUCCESSFUL ) + { + OutputDebug("Event MCI_NOTIFY_SUCCESSFUL\n"); + g_pSound->RestartMusic(); + } + else + { + char s[50]; + sprintf(s, "wParam=%d\n", wParam); + OutputDebug(s); + } + } + break; + + case WM_SETCURSOR: +// ChangeSprite(); +// SetCursor(NULL); // pas de souris visible ! + return TRUE; + + case WM_LBUTTONDOWN: +//? Benchmark(); + GetCursorPos(&mousePos); + ScreenToClient(hWnd, &mousePos); + break; + + case WM_RBUTTONDOWN: + break; + + case WM_MOUSEMOVE: + break; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_F5: + g_pEvent->SetSpeed(1); + break; + case VK_F6: + g_pEvent->SetSpeed(2); + break; + case VK_F7: + g_pEvent->SetSpeed(4); + break; + case VK_F8: + g_pEvent->SetSpeed(8); + break; +#if 0 + case VK_F2: + KillTimer(g_hWnd, 1); + SetTimer(g_hWnd, 1, g_timerInterval/2, NULL); + break; + case VK_F3: + KillTimer(g_hWnd, 1); + SetTimer(g_hWnd, 1, g_timerInterval, NULL); + break; + case VK_F4: + KillTimer(g_hWnd, 1); + SetTimer(g_hWnd, 1, g_timerInterval*2, NULL); + break; +#endif + } + break; + + case WM_DESTROY: + KillTimer(g_hWnd, 1); + FinishObjects(); + PostQuitMessage(0); + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); +} + + +// Erreur dans DoInit. + +BOOL InitFail(char *msg, BOOL bDirectX) +{ + char buffer[100]; + + if ( bDirectX ) strcpy(buffer, "DirectX Init FAILED\n(while "); + else strcpy(buffer, "Error ("); + strcat(buffer, msg); + strcat(buffer, ")"); + MessageBox(g_hWnd, buffer, TITLE, MB_OK); + + FinishObjects(); + DestroyWindow(g_hWnd); + return FALSE; +} + +// Initialisation de l'application. + +static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) +{ + WNDCLASS wc; + POINT totalDim, iconDim; + RECT rcRect; + BOOL bOK; + + bOK = ReadConfig(lpCmdLine); // lit le fichier config.def + + InitHInstance(hInstance); + + // Set up and register window class. + wc.style = CS_HREDRAW|CS_VREDRAW; + wc.lpfnWndProc = WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; +//? wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION); + wc.hIcon = LoadIcon(hInstance, "IDR_MAINFRAME"); + wc.hCursor = LoadCursor(hInstance, "IDC_POINTER"); + wc.hbrBackground = GetStockBrush(BLACK_BRUSH); + wc.lpszMenuName = NAME; + wc.lpszClassName = NAME; + RegisterClass(&wc); + + // Create a window. + if ( g_bFullScreen ) + { + g_hWnd = CreateWindowEx + ( + WS_EX_TOPMOST, + NAME, + TITLE, + WS_POPUP, + 0, 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, + NULL, + hInstance, + NULL + ); + } + else + { + int sx, sy; + RECT WindowRect; + + sx = GetSystemMetrics(SM_CXSCREEN); + sy = GetSystemMetrics(SM_CYSCREEN); + + SetRect(&WindowRect, (sx-LXIMAGE)/2, (sy-LYIMAGE)/2, + (sx+LXIMAGE)/2, (sy+LYIMAGE)/2); + AdjustWindowRect(&WindowRect, WS_POPUPWINDOW|WS_CAPTION, TRUE); + WindowRect.top += GetSystemMetrics(SM_CYCAPTION); + + g_hWnd = CreateWindow + ( + NAME, + TITLE, + WS_POPUPWINDOW|WS_CAPTION|WS_VISIBLE, + (sx-LXIMAGE)/2, (sy-LYIMAGE)/2, + WindowRect.right - WindowRect.left, + WindowRect.bottom - WindowRect.top, + HWND_DESKTOP, + NULL, + hInstance, + NULL + ); + } + if ( !g_hWnd ) return FALSE; + + ShowWindow(g_hWnd, nCmdShow); + UpdateWindow(g_hWnd); + SetFocus(g_hWnd); + + ChangeSprite(SPRITE_WAIT); // met le sablier maison + + if ( !bOK ) // config.def pas correct ? + { + return InitFail("Game not correctly installed", FALSE); + } + + // Crée le pixmap principal. + g_pPixmap = new CPixmap; + if ( g_pPixmap == NULL ) return InitFail("New pixmap", TRUE); + + totalDim.x = LXIMAGE; + totalDim.y = LYIMAGE; + if ( !g_pPixmap->Create(g_hWnd, totalDim, g_bFullScreen, g_mouseType) ) + return InitFail("Create pixmap", TRUE); + + OutputDebug("Image: init\n"); + totalDim.x = LXIMAGE; + totalDim.y = LYIMAGE; + iconDim.x = 0; + iconDim.y = 0; +#if _INTRO + if ( !g_pPixmap->Cache(CHBACK, "image\\intro1.blp", totalDim, iconDim, TRUE) ) +#else + if ( !g_pPixmap->Cache(CHBACK, "image\\init.blp", totalDim, iconDim, TRUE) ) +#endif + return FALSE; + + OutputDebug("SavePalette\n"); + g_pPixmap->SavePalette(); + OutputDebug("InitSysPalette\n"); + g_pPixmap->InitSysPalette(); + + OutputDebug("Image: init\n"); + totalDim.x = LXIMAGE; + totalDim.y = LYIMAGE; + iconDim.x = 0; + iconDim.y = 0; + if ( !g_pPixmap->Cache(CHGROUND, "image\\init.blp", totalDim, iconDim, TRUE) ) + return FALSE; + + g_pPixmap->SetDebug(FALSE); + + rcRect.left = 0; + rcRect.top = 0; + rcRect.right = LXIMAGE; + rcRect.bottom = LYIMAGE; + g_pPixmap->DrawImage(-1, CHBACK, rcRect, 1); // dessine le fond + g_pPixmap->Display(); + + totalDim.x = DIMCELX*2*16; + totalDim.y = DIMCELY*2*6; + iconDim.x = DIMCELX*2; + iconDim.y = DIMCELY*2; + if ( !g_pPixmap->Cache(CHFLOOR, "image\\floor000.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache floor000.blp", TRUE); + g_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu + + totalDim.x = DIMOBJX*16; + totalDim.y = DIMOBJY*8; + iconDim.x = DIMOBJX; + iconDim.y = DIMOBJY; + if ( !g_pPixmap->Cache(CHOBJECT, "image\\obj000.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache obj000.blp", TRUE); + g_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu + + if ( !g_pPixmap->Cache(CHOBJECTo, "image\\obj-o000.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache obj-o000.blp", TRUE); + g_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc + + totalDim.x = DIMBLUPIX*16; + totalDim.y = DIMBLUPIY*23; + iconDim.x = DIMBLUPIX; + iconDim.y = DIMBLUPIY; + if ( !g_pPixmap->Cache(CHBLUPI, "image\\blupi.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache blupi.blp", TRUE); + g_pPixmap->SetTransparent(CHBLUPI, RGB(0,0,255)); // bleu + + totalDim.x = 64; + totalDim.y = 66; + iconDim.x = 64; + iconDim.y = 66/2; + if ( !g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache hili.blp", TRUE); + g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu + + totalDim.x = DIMCELX*2*3; + totalDim.y = DIMCELY*2*5; + iconDim.x = DIMCELX*2; + iconDim.y = DIMCELY*2; + if ( !g_pPixmap->Cache(CHFOG, "image\\fog.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache fog.blp", TRUE); + g_pPixmap->SetTransparent(CHFOG, RGB(255,255,255)); // blanc + + totalDim.x = DIMCELX*2*16; + totalDim.y = DIMCELY*2*1; + iconDim.x = DIMCELX*2; + iconDim.y = DIMCELY*2; + if ( !g_pPixmap->Cache(CHMASK1, "image\\mask1.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache mask1.blp", TRUE); + g_pPixmap->SetTransparent(CHMASK1, RGB(0,0,0)); // noir + + totalDim.x = DIMBUTTONX*6; + totalDim.y = DIMBUTTONY*21; + iconDim.x = DIMBUTTONX; + iconDim.y = DIMBUTTONY; + if ( !g_pPixmap->Cache(CHBUTTON, "image\\button00.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache button00.blp", TRUE); + g_pPixmap->SetTransparent(CHBUTTON, RGB(0,0,255)); // bleu + + totalDim.x = DIMJAUGEX*1; + totalDim.y = DIMJAUGEY*4; + iconDim.x = DIMJAUGEX; + iconDim.y = DIMJAUGEY; + if ( !g_pPixmap->Cache(CHJAUGE, "image\\jauge.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache jauge.blp", TRUE); + g_pPixmap->SetTransparent(CHJAUGE, RGB(0,0,255)); // bleu + + totalDim.x = DIMTEXTX*16; + totalDim.y = DIMTEXTY*8*3; + iconDim.x = DIMTEXTX; + iconDim.y = DIMTEXTY; + if ( !g_pPixmap->Cache(CHTEXT, "image\\text.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache text.blp", TRUE); + g_pPixmap->SetTransparent(CHTEXT, RGB(0,0,255)); // bleu + + totalDim.x = DIMLITTLEX*16; + totalDim.y = DIMLITTLEY*8; + iconDim.x = DIMLITTLEX; + iconDim.y = DIMLITTLEY; + if ( !g_pPixmap->Cache(CHLITTLE, "image\\little.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache little.blp", TRUE); + g_pPixmap->SetTransparent(CHLITTLE, RGB(0,0,255)); // bleu + + totalDim.x = 426; + totalDim.y = 52; + iconDim.x = 426; + iconDim.y = 52; + if ( !g_pPixmap->Cache(CHBIGNUM, "image\\bignum.blp", totalDim, iconDim, FALSE) ) + return InitFail("Cache bignum.blp", TRUE); + g_pPixmap->SetTransparent(CHBIGNUM, RGB(0,0,255)); // bleu + + // Crée le gestionnaire de son. + g_pSound = new CSound; + if ( g_pSound == NULL ) return InitFail("New sound", TRUE); + + g_pSound->Create(g_hWnd); + g_pSound->CacheAll(); + g_pSound->SetState(TRUE); + + // Crée le gestionnaire de films. + g_pMovie = new CMovie; + if ( g_pMovie == NULL ) return InitFail("New movie", FALSE); + + g_pMovie->Create(); + + // Crée le gestionnaire de décors. + g_pDecor = new CDecor; + if ( g_pDecor == NULL ) return InitFail("New decor", FALSE); + + g_pDecor->Create(g_hWnd, g_pSound, g_pPixmap); + g_pDecor->MapInitColors(); + + // Crée le gestionnaire d'événements. + g_pEvent = new CEvent; + if ( g_pEvent == NULL ) return InitFail("New event", FALSE); + + g_pEvent->Create(g_hWnd, g_pPixmap, g_pDecor, g_pSound, g_pMovie); + g_pEvent->SetFullScreen(g_bFullScreen); + g_pEvent->SetMouseType(g_mouseType); +#if _INTRO + g_pEvent->ChangePhase(WM_PHASE_INTRO1); +#else + g_pEvent->ChangePhase(WM_PHASE_TESTCD); +#endif + + g_bTermInit = TRUE; // initialisation terminée + return TRUE; +} + + +// Programme principal. + +int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + if ( !DoInit(hInstance, lpCmdLine, nCmdShow) ) + { + return FALSE; + } + + SetTimer(g_hWnd, 1, g_timerInterval, NULL); + + while ( TRUE ) + { + if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) + { + if ( !GetMessage(&msg, NULL, 0, 0) ) + { + return msg.wParam; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else + { + // make sure we go to sleep if we have nothing else to do + if ( !g_bActive ) WaitMessage(); + } + } + + return msg.wParam; +} + diff --git a/blupi.ico b/blupi.ico new file mode 100644 index 0000000..c825fe0 Binary files /dev/null and b/blupi.ico differ diff --git a/button.cpp b/button.cpp new file mode 100644 index 0000000..048835c --- /dev/null +++ b/button.cpp @@ -0,0 +1,426 @@ +// Button.cpp +// + +#include +#include +#include +#include +#include "def.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "button.h" +#include "misc.h" + + + +///////////////////////////////////////////////////////////////////////////// + +// Constructeur. + +CButton::CButton() +{ + m_type = 0; + m_bEnable = TRUE; + m_bHide = FALSE; + m_state = 0; + m_mouseState = 0; + m_nbMenu = 0; + m_nbToolTips = 0; + m_selMenu = 0; + m_bMouseDown = FALSE; + m_bMinimizeRedraw = FALSE; + m_bRedraw = FALSE; +} + +// Destructeur. + +CButton::~CButton() +{ +} + + +// Crée un nouveau bouton. + +BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int type, BOOL bMinimizeRedraw, + int *pMenu, int nbMenu, + int *pToolTips, int nbToolTips, + int region, UINT message) +{ + POINT iconDim; + int i, icon; + + static int ttypes[] = + { + DIMBUTTONX,DIMBUTTONY, // button00.bmp + }; + + if ( type < 0 || type > 0 ) return FALSE; + + iconDim.x = ttypes[type*2+0]; + iconDim.y = ttypes[type*2+1]; + + m_hWnd = hWnd; + m_pPixmap = pPixmap; + m_pSound = pSound; + m_type = type; + m_bMinimizeRedraw = bMinimizeRedraw; + m_bEnable = TRUE; + m_bHide = FALSE; + m_message = message; + m_pos = pos; + m_dim = iconDim; + m_nbMenu = nbMenu; + m_nbToolTips = nbToolTips; + m_selMenu = 0; + m_state = 0; + m_mouseState = 0; + m_bMouseDown = FALSE; + m_bRedraw = TRUE; + + for ( i=0 ; iDrawPart(-1, CHBACK, m_pos, rect, 1); // dessine le fond + return; + } + + if ( m_bEnable ) // bouton actif ? + { + m_pPixmap->DrawIcon(-1, CHBUTTON+m_type, m_mouseState, m_pos); + } + else + { + m_pPixmap->DrawIcon(-1, CHBUTTON+m_type, 4, m_pos); + } + + if ( m_nbMenu == 0 ) return; + + pos = m_pos; + if ( m_nbMenu > 0 ) + { + m_pPixmap->DrawIcon(-1, CHBUTTON+m_type, + m_iconMenu[m_selMenu]+6, pos); + } + + if ( m_nbMenu == 1 || !m_bEnable || !m_bMouseDown ) return; + + pos = m_pos; + pos.x += m_dim.x+2; + for ( i=0 ; iDrawIcon(-1, CHBUTTON+m_type, i==m_selMenu?1:0, pos); + m_pPixmap->DrawIcon(-1, CHBUTTON+m_type, m_iconMenu[i]+6, pos); + pos.x += m_dim.x-1; + } +} + +void CButton::Redraw() +{ + m_bRedraw = TRUE; +} + +int CButton::GetState() +{ + return m_state; +} + +void CButton::SetState(int state) +{ + if ( m_state != state || + m_mouseState != state ) + { + m_bRedraw = TRUE; + } + + m_state = state; + m_mouseState = state; +} + +int CButton::GetMenu() +{ + return m_selMenu; +} + +void CButton::SetMenu(int menu) +{ + if ( m_selMenu != menu ) + { + m_bRedraw = TRUE; + } + + m_selMenu = menu; +} + + +BOOL CButton::GetEnable() +{ + return m_bEnable; +} + +void CButton::SetEnable(BOOL bEnable) +{ + if ( m_bEnable != bEnable ) + { + m_bRedraw = TRUE; + } + + m_bEnable = bEnable; +} + + +BOOL CButton::GetHide() +{ + return m_bHide; +} + +void CButton::SetHide(BOOL bHide) +{ + if ( m_bHide != bHide ) + { + m_bRedraw = TRUE; + } + + m_bHide = bHide; +} + + +// Traitement d'un événement. + +BOOL CButton::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam) +{ + POINT pos; + + if ( m_bHide || !m_bEnable ) return FALSE; + + pos = ConvLongToPos(lParam); + + switch( message ) + { + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + if ( MouseDown(pos) ) return TRUE; + break; + + case WM_MOUSEMOVE: + if ( MouseMove(pos) ) return TRUE; + break; + + case WM_LBUTTONUP: + case WM_RBUTTONUP: + if ( MouseUp(pos) ) return FALSE; // (*) + break; + } + + return FALSE; +} + +// (*) Tous les boutons doivent recevoir l'événement BUTTONUP ! + + +// Indique si la souris est sur ce bouton. + +BOOL CButton::MouseOnButton(POINT pos) +{ + return Detect(pos); +} + + +// Retourne le tooltips pour un bouton, en fonction +// de la position de la souris. + +int CButton::GetToolTips(POINT pos) +{ + int width = m_dim.x; + int rank; + + if ( m_bHide || !m_bEnable ) return -1; + + if ( m_nbMenu > 1 && m_bMouseDown ) // sous-menu déroulé ? + { + width += 2+(m_dim.x-1)*m_nbMenu; + } + + if ( pos.x < m_pos.x || + pos.x > m_pos.x+width || + pos.y < m_pos.y || + pos.y > m_pos.y+m_dim.y ) return -1; + + rank = (pos.x-(m_pos.x+2+1))/(m_dim.x-1); + if ( rank < 0 ) rank = 0; + if ( rank > m_nbToolTips ) return -1; + + if ( m_nbMenu > 1 ) + { + if ( m_bMouseDown && rank > 0 ) + { + rank --; + } + else + { + rank = m_selMenu; + } + } + + return m_toolTips[rank]; +} + + +// Détecte si la souris est dans le bouton. + +BOOL CButton::Detect(POINT pos) +{ + int width = m_dim.x; + + if ( m_bHide || !m_bEnable ) return FALSE; + + if ( m_nbMenu > 1 && m_bMouseDown ) // sous-menu déroulé ? + { + width += 2+(m_dim.x-1)*m_nbMenu; + } + + if ( pos.x < m_pos.x || + pos.x > m_pos.x+width || + pos.y < m_pos.y || + pos.y > m_pos.y+m_dim.y ) return FALSE; + + return TRUE; +} + +// Bouton de la souris pressé. + +BOOL CButton::MouseDown(POINT pos) +{ + if ( !Detect(pos) ) return FALSE; + + m_mouseState = 1; + m_bMouseDown = TRUE; + m_bRedraw = TRUE; + PostMessage(m_hWnd, WM_UPDATE, 0, 0); + + m_pSound->PlayImage(SOUND_CLICK, pos); + return TRUE; +} + +// Souris déplacés. + +BOOL CButton::MouseMove(POINT pos) +{ + BOOL bDetect; + int iState, iMenu; + + iState = m_mouseState; + iMenu = m_selMenu; + + bDetect = Detect(pos); + + if ( m_bMouseDown ) + { + if ( bDetect ) m_mouseState = 1; // pressé + else m_mouseState = m_state; + } + else + { + if ( bDetect ) m_mouseState = m_state+2; // survollé + else m_mouseState = m_state; + } + + if ( m_nbMenu > 1 && + m_bMouseDown && + pos.x > m_pos.x+m_dim.x+2 ) // dans sous-menu ? + { + m_selMenu = (pos.x-(m_pos.x+m_dim.x+2))/(m_dim.x-1); + if ( m_selMenu >= m_nbMenu ) + { + m_selMenu = m_nbMenu-1; + } + } + + if ( iState != m_mouseState || + iMenu != m_selMenu ) + { + m_bRedraw = TRUE; + PostMessage(m_hWnd, WM_UPDATE, 0, 0); + } + + return m_bMouseDown; +} + +// Bouton de la souris relâché. + +BOOL CButton::MouseUp(POINT pos) +{ + BOOL bDetect; + + bDetect = Detect(pos); + + m_mouseState = m_state; + m_bMouseDown = FALSE; + m_bRedraw = TRUE; + + if ( !bDetect ) return FALSE; + + if ( m_message != -1 ) + { + PostMessage(m_hWnd, m_message, 0, 0); + } + + return TRUE; +} + + diff --git a/button.h b/button.h new file mode 100644 index 0000000..34beb40 --- /dev/null +++ b/button.h @@ -0,0 +1,67 @@ +// Button.h + + + +///////////////////////////////////////////////////////////////////////////// + +class CButton +{ +public: + CButton(); + ~CButton(); + + BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int type, BOOL bMinimizeRedraw, + int *pMenu, int nbMenu, + int *pTooltips, int nbToolTips, + int region, UINT message); + void Draw(); + void Redraw(); + + int GetState(); + void SetState(int state); + + int GetMenu(); + void SetMenu(int menu); + + BOOL GetEnable(); + void SetEnable(BOOL bEnable); + + BOOL GetHide(); + void SetHide(BOOL bHide); + + BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); + BOOL MouseOnButton(POINT pos); + int GetToolTips(POINT pos); + + +protected: + BOOL Detect(POINT pos); + BOOL MouseDown(POINT pos); + BOOL MouseMove(POINT pos); + BOOL MouseUp(POINT pos); + +protected: + HWND m_hWnd; + CPixmap* m_pPixmap; + CDecor* m_pDecor; + CSound* m_pSound; + int m_type; // type de bouton + BOOL m_bEnable; // TRUE si bouton actif + BOOL m_bHide; // TRUE si bouton caché + UINT m_message; // message envoyé si bouton actionné + POINT m_pos; // coin sup/gauche + POINT m_dim; // dimensions + int m_state; // 0=relâché, 1=pressé, +2=survollé + int m_mouseState; // 0=relâché, 1=pressé, +2=survollé + int m_iconMenu[20]; // icônes du sous-menu + int m_toolTips[20]; // info-bulles + int m_nbMenu; // nb de case du sous-menu + int m_nbToolTips; // nb d'info-bulles + int m_selMenu; // sous-menu sélectionné + BOOL m_bMouseDown; // TRUE -> bouton souris pressé + BOOL m_bMinimizeRedraw; + BOOL m_bRedraw; // TRUE -> doit être redessiné +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/chemin.cpp b/chemin.cpp new file mode 100644 index 0000000..150235b --- /dev/null +++ b/chemin.cpp @@ -0,0 +1,369 @@ +// chemin.cpp + +// (c) 1997, Denis Dumoulin + +#include "DECOR.H" +#include "FIFO.H" +#include "ACTION.H" + +// Mémorise toutes les positions des blupi. + +void CDecor::CheminMemPos(int exRank) +{ + int rank, index; + + m_cheminNbPos = 0; + index = 0; + for ( rank=0 ; rank 0 && + m_cheminWork[last] < rebours ) + { + pos = last; + rebours = m_cheminWork[pos]; + if (rebours==1) return (dir>=4) ? dir-4 : dir+4; + goto bis; // interrompt le for... + } + } + } + + // ne devrait jamais arriver ! + return -1; + } +} + + +// troisième méthode de recherche +// semblable à la précédente, +// mais les points à explorer sont classés selon leur distance à la cible + +void CDecor::CheminFillTerrain(int rank) +{ + long pos, last, dest, dist; + int step, dir, cout, action, max, next, ampli; + int dx, dy; + int but = 1000; + + if ( m_blupi[rank].cel.x == m_blupi[rank].goalCel.x && + m_blupi[rank].cel.y == m_blupi[rank].goalCel.y ) return; + + pos = m_blupi[rank].cel.y*MAXCELX + m_blupi[rank].cel.x; + dest = m_blupi[rank].goalCel.y*MAXCELX + m_blupi[rank].goalCel.x; + + CPileTriee fifo(2*MAXCELX+2*MAXCELY); // les variantes possibles + + fifo.put(pos, 0); // position de départ + m_cheminWork[pos] = 1; // première position + + // répète jusqu'à trouvé ou plus de possibilités + max = 500; + while ( max-- > 0 ) + { + // reprend une variante de chemin + pos = fifo.get(); + if ( pos < 0 ) break; + + step = m_cheminWork[pos]; + + // on est arrivé au but ? +//? if ( pos == dest ) return; + if ( pos == dest ) + { + but = step; // hélas trop lent ! + max = 50; + } + + // est-ce vraiment trop loin ? + if ( step > 200 ) return; + + // marque les cases autour du point + if ( step < but ) for ( dir=0 ; dir<8 ; dir++ ) + { + if ( CheminTestDirection(rank, pos, dir, next, ampli, cout, action) ) + { + last = pos + ampli*next; + if ( last<0 || last>=MAXCELX*MAXCELY ) continue; + + if ( m_cheminWork[last] == 0 || + m_cheminWork[last] > step+cout ) + { + // marque les cases sautées + for (int i=1; i +#include +#include +#include +#include +#include "ddutil.h" +#include "misc.h" + + +// Le message : +// First-chance exception in Blupi.exe (GDI32.DLL): 0xC0000005: Access Violation. +// apparaît au endroits marqués par (@) ... + +BOOL g_bDebug = TRUE; + +void DDSetDebug(BOOL bDebug) +{ + g_bDebug = bDebug; +} + +/* + * DDConnectBitmap + * + * create a DirectDrawSurface from a bitmap resource. + * + */ +extern "C" IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm) +{ + BITMAP bm; + DDSURFACEDESC ddsd; + IDirectDrawSurface *pdds; + HRESULT ddrval; + + // + // get size of the bitmap + // + GetObject(hbm, sizeof(bm), &bm); // get size of bitmap + + // + // create a DirectDrawSurface for this bitmap + // + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; +//? ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.dwWidth = bm.bmWidth; + ddsd.dwHeight = bm.bmHeight; + + ddrval = pdd->CreateSurface(&ddsd, &pdds, NULL); + if ( ddrval != DD_OK ) + { + TraceErrorDD(ddrval, "", 0); + return NULL; + } + + DDCopyBitmap(pdds, hbm, 0, 0, bm.bmWidth, bm.bmHeight); + + return pdds; +} + +/* + * DDLoadBitmap + * + * create a DirectDrawSurface from a bitmap resource. + * + */ +extern "C" IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy) +{ + HBITMAP hbm; + BITMAP bm; + DDSURFACEDESC ddsd; + IDirectDrawSurface *pdds; + HRESULT ddrval; + + if ( g_bDebug ) OutputDebug("DDLoadBitmap\n"); + // + // try to load the bitmap as a resource, if that fails, try it as a file + // + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, dx, dy, LR_CREATEDIBSECTION); + + if ( g_bDebug ) OutputDebug("DDLoadBitmap\n"); + if (hbm == NULL) + { + hbm = (HBITMAP)LoadImage(NULL, szBitmap, IMAGE_BITMAP, dx, dy, LR_LOADFROMFILE|LR_CREATEDIBSECTION); // (@) + } + + if ( hbm == NULL ) return NULL; + + // + // get size of the bitmap + // + if ( g_bDebug ) OutputDebug("DDLoadBitmap: GetObject\n"); + GetObject(hbm, sizeof(bm), &bm); // get size of bitmap + + // + // create a DirectDrawSurface for this bitmap + // + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; +//? ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.dwWidth = bm.bmWidth; + ddsd.dwHeight = bm.bmHeight; + + if ( g_bDebug ) OutputDebug("DDLoadBitmap: CreateSurface\n"); + ddrval = pdd->CreateSurface(&ddsd, &pdds, NULL); + if ( ddrval != DD_OK ) + { + TraceErrorDD(ddrval, "", 0); + return NULL; + } + + DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + if ( g_bDebug ) OutputDebug("DDLoadBitmap: DeleteObject\n"); + DeleteObject(hbm); // (@) + + if ( g_bDebug ) OutputDebug("DDLoadBitmap: return\n"); + return pdds; +} + +/* + * DDReLoadBitmap + * + * load a bitmap from a file or resource into a directdraw surface. + * normaly used to re-load a surface after a restore. + * + */ +HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCSTR szBitmap) +{ + HBITMAP hbm; + HRESULT hr; + + // + // try to load the bitmap as a resource, if that fails, try it as a file + // + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); + + if (hbm == NULL) + hbm = (HBITMAP)LoadImage(NULL, szBitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION); + + if (hbm == NULL) + { + if ( g_bDebug ) OutputDebug("handle is null\n"); + return E_FAIL; + } + + hr = DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + if (hr != DD_OK) + { + if ( g_bDebug ) OutputDebug("ddcopybitmap failed\n"); + } + + + DeleteObject(hbm); + return hr; +} + +/* + * DDCopyBitmap + * + * draw a bitmap into a DirectDrawSurface + * + */ +extern "C" HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy) +{ + HDC hdcImage; + HDC hdc; + BITMAP bm; + DDSURFACEDESC ddsd; + HRESULT hr; + + if ( g_bDebug ) OutputDebug("DDCopyBitmap\n"); + if (hbm == NULL || pdds == NULL) + return E_FAIL; + + // + // make sure this surface is restored. + // + if ( g_bDebug ) OutputDebug("DDCopyBitmap: Restore\n"); + pdds->Restore(); + + // + // select bitmap into a memoryDC so we can use it. + // + if ( g_bDebug ) OutputDebug("DDCopyBitmap: CreateCompatibleDC\n"); + hdcImage = CreateCompatibleDC(NULL); + if (!hdcImage) + OutputDebug("createcompatible dc failed\n"); + if ( g_bDebug ) OutputDebug("DDCopyBitmap: SelectObject\n"); + SelectObject(hdcImage, hbm); + + // + // get size of the bitmap + // + if ( g_bDebug ) OutputDebug("DDCopyBitmap: GetObject\n"); + GetObject(hbm, sizeof(bm), &bm); // get size of bitmap + dx = dx == 0 ? bm.bmWidth : dx; // use the passed size, unless zero + dy = dy == 0 ? bm.bmHeight : dy; + + // + // get size of surface. + // + if ( g_bDebug ) OutputDebug("DDCopyBitmap: GetSurfaceDesc\n"); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; + pdds->GetSurfaceDesc(&ddsd); + + if ( g_bDebug ) OutputDebug("DDCopyBitmap: StretchBlt\n"); + if ((hr = pdds->GetDC(&hdc)) == DD_OK) + { + if ( g_bDebug ) OutputDebug("DDCopyBitmap: StretchBlt-go\n"); + StretchBlt(hdc, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdcImage, x, y, dx, dy, SRCCOPY); + if ( g_bDebug ) OutputDebug("DDCopyBitmap: ReleaseDC\n"); + pdds->ReleaseDC(hdc); // (@) + } + + if ( g_bDebug ) OutputDebug("DDCopyBitmap: DeleteDC\n"); + DeleteDC(hdcImage); + + return hr; +} + +// +// DDLoadPalette +// +// Create a DirectDraw palette object from a bitmap resoure +// +// if the resource does not exist or NULL is passed create a +// default 332 palette. +// +extern "C" IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap) +{ + IDirectDrawPalette* ddpal; + int i; + int n; + int fh; + HRSRC h; + LPBITMAPINFOHEADER lpbi; + PALETTEENTRY ape[256]; + RGBQUAD * prgb; + + // + // build a 332 palette as the default. + // + for (i=0; i<256; i++) + { + ape[i].peRed = (BYTE)(((i >> 5) & 0x07) * 255 / 7); + ape[i].peGreen = (BYTE)(((i >> 2) & 0x07) * 255 / 7); + ape[i].peBlue = (BYTE)(((i >> 0) & 0x03) * 255 / 3); + ape[i].peFlags = (BYTE)0; + } + + // + // get a pointer to the bitmap resource. + // + if (szBitmap && (h = FindResource(NULL, szBitmap, RT_BITMAP))) + { + if ( g_bDebug ) OutputDebug("DDLoadPalette -a\n"); + lpbi = (LPBITMAPINFOHEADER)LockResource(LoadResource(NULL, h)); + if (!lpbi) + OutputDebug("lock resource failed\n"); + prgb = (RGBQUAD*)((BYTE*)lpbi + lpbi->biSize); + + if (lpbi == NULL || lpbi->biSize < sizeof(BITMAPINFOHEADER)) + n = 0; + else if (lpbi->biBitCount > 8) + n = 0; + else if (lpbi->biClrUsed == 0) + n = 1 << lpbi->biBitCount; + else + n = lpbi->biClrUsed; + + // + // a DIB color table has its colors stored BGR not RGB + // so flip them around. + // + for(i=0; i 8) + n = 0; + else if (bi.biClrUsed == 0) + n = 1 << bi.biBitCount; + else + n = bi.biClrUsed; + + // + // a DIB color table has its colors stored BGR not RGB + // so flip them around. + // + //? + char s[50]; + sprintf(s, "DDLoadPalette n=%d\n", n); + if ( g_bDebug ) OutputDebug(s); + //? + for(i=0; iCreatePalette(DDPCAPS_8BIT, ape, &ddpal, NULL); + + return ddpal; +} + +/* + * DDColorMatch + * + * convert a RGB color to a pysical color. + * + * we do this by leting GDI SetPixel() do the color matching + * then we lock the memory and see what it got mapped to. + */ +extern "C" DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb) +{ + COLORREF rgbT; + HDC hdc; + DWORD dw = CLR_INVALID; + DDSURFACEDESC ddsd; + HRESULT hres; + + // + // use GDI SetPixel to color match for us + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + rgbT = GetPixel(hdc, 0, 0); // save current pixel value + SetPixel(hdc, 0, 0, rgb); // set our value + pdds->ReleaseDC(hdc); + } + + // + // now lock the surface so we can read back the converted color + // + ddsd.dwSize = sizeof(ddsd); + while ((hres = pdds->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING) + ; + + if (hres == DD_OK) + { + dw = *(DWORD *)ddsd.lpSurface; // get DWORD + dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount)-1; // mask it to bpp + pdds->Unlock(NULL); + } + + // + // now put the color that was there back. + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + SetPixel(hdc, 0, 0, rgbT); + pdds->ReleaseDC(hdc); + } + + return dw; +} + +/* + * DDSetColorKey + * + * set a color key for a surface, given a RGB. + * if you pass CLR_INVALID as the color key, the pixel + * in the upper-left corner will be used. + */ +extern "C" HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb) +{ + DDCOLORKEY ddck; + + ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb); + ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue; + return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck); +} + +extern "C" HRESULT DDSetColorKey2(IDirectDrawSurface *pdds, COLORREF rgb1, + COLORREF rgb2) +{ + DDCOLORKEY ddck; + + ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb1); + ddck.dwColorSpaceHighValue = DDColorMatch(pdds, rgb2); + return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck); +} diff --git a/ddutil.h b/ddutil.h new file mode 100644 index 0000000..6bc958b --- /dev/null +++ b/ddutil.h @@ -0,0 +1,26 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: ddutil.cpp + * Content: Routines for loading bitmap and palettes from resources + * + ***************************************************************************/ + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +extern void DDSetDebug(BOOL bDebug); +extern IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm); +extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap); +extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy); +extern HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCSTR szBitmap); +extern HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy); +extern DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb); +extern HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb); +extern HRESULT DDSetColorKey2(IDirectDrawSurface *pdds, COLORREF rgb1, COLORREF rgb2); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff --git a/decblupi.cpp b/decblupi.cpp new file mode 100644 index 0000000..5e6b6c5 --- /dev/null +++ b/decblupi.cpp @@ -0,0 +1,4894 @@ +// DecBlupi.cpp +// + +#include "DEF.H" +#include "DECOR.H" +#include "ACTION.H" +#include "MISC.H" +#include "RESOURCE.H" +#include "decgoal.h" + +// Cette table donne l'action à effectuer pour un bouton +// enfoncé. +short table_actions[] = +{ + WM_ACTION_GO, + WM_ACTION_STOP, + WM_ACTION_MANGE, + WM_ACTION_CARRY, + WM_ACTION_DEPOSE, + WM_ACTION_ABAT1, + WM_ACTION_ROC1, + WM_ACTION_CULTIVE, + WM_ACTION_BUILD1, + WM_ACTION_BUILD2, + WM_ACTION_BUILD3, + WM_ACTION_BUILD4, + WM_ACTION_BUILD5, + WM_ACTION_BUILD6, + WM_ACTION_MUR, + WM_ACTION_PALIS, + WM_ACTION_ABAT1, + WM_ACTION_ROC1, + WM_ACTION_PONTE, + WM_ACTION_TOUR, + WM_ACTION_BOIT, + WM_ACTION_LABO, + WM_ACTION_FLEUR1, + WM_ACTION_FLEUR1, + WM_ACTION_DYNAMITE, + WM_ACTION_BATEAUE, + WM_ACTION_DJEEP, + WM_ACTION_DRAPEAU, + WM_ACTION_EXTRAIT, + WM_ACTION_FABJEEP, + WM_ACTION_FABMINE, + WM_ACTION_FABDISC, + WM_ACTION_REPEAT, + WM_ACTION_DARMURE, + WM_ACTION_FABARMURE, +}; + + + + + +// Supprime tous les blupi. + +void CDecor::BlupiFlush() +{ + int i; + + memset(m_blupi, 0, sizeof(Blupi)*MAXBLUPI); + + for ( i=0 ; i= 0, supprime seulement ce personnage. + +BOOL CDecor::BlupiDelete(POINT cel, int perso) +{ + int rank; + + for ( rank=0 ; rank 0 && + m_rankBlupiHili == rank ) // est-ce le blupi sélectionné ? + { + m_nbBlupiHili = 0; + m_rankBlupiHili = -1; + } + } + return TRUE; + } + } + + return FALSE; +} + +// Supprime un blupi existant. + +void CDecor::BlupiDelete(int rank) +{ + m_blupi[rank].bExist = FALSE; + + if ( !m_bBuild && // phase de jeu ? + m_nbBlupiHili > 0 && + m_rankBlupiHili == rank ) // est-ce le blupi sélectionné ? + { + m_nbBlupiHili = 0; + m_rankBlupiHili = -1; + } +} + +// Supprime tout dans un périmètre donné suite à une explosion. +// type=0 -> explosion +// type=1 -> électro + +void CDecor::BlupiKill(int exRank, POINT cel, int type) +{ + int rank, action, x, y, icon; + + for ( rank=0 ; rank= cel.x && + m_blupi[rank].cel.x <= cel.x+1 && + m_blupi[rank].cel.y >= cel.y && + m_blupi[rank].cel.y <= cel.y+1 ) + { + GoalUnwork(rank); + + if ( type == 0 ) // explosion ? + { + m_blupi[rank].bExist = FALSE; // mort instantannée + } + + if ( type == 1 ) // électro ? + { + x = m_blupi[rank].cel.x; + y = m_blupi[rank].cel.y; + icon = m_decor[x/2][y/2].objectIcon; + if ( m_blupi[rank].perso == 0 && + m_blupi[rank].vehicule == 0 && // à pied ? + !m_bInvincible && + icon != 113 && // maison ? + icon != 28 && icon != 29 && // laboratoire ? + icon != 119 && icon != 120 && // usine ? + icon != 121 && icon != 122 ) // mine de fer ? + { + if ( m_blupi[rank].bMalade ) + { + action = WM_ACTION_ELECTROm; + } + else + { + action = WM_ACTION_ELECTRO; + } + GoalStart(rank, action, m_blupi[rank].cel); +//? BlupiChangeAction(rank, ACTION_ELECTRO); + } + } + } + + // Supprime les blupi placés une case autour de la + // cellule où a lieu l'explosion, seulement s'ils + // ne sont pas cachés (pas dans un batiment). + if ( type == 0 && + rank != exRank && + m_blupi[rank].bExist && + m_blupi[rank].vehicule != 3 && // pas armure ? + !m_bInvincible && + !m_blupi[rank].bCache && // pas dans un batiment ? + m_blupi[rank].cel.x >= cel.x-1 && + m_blupi[rank].cel.x <= cel.x+2 && + m_blupi[rank].cel.y >= cel.y-1 && + m_blupi[rank].cel.y <= cel.y+2 ) + { + GoalUnwork(rank); + m_blupi[rank].bExist = FALSE; + } + } +} + + + +// Test si un blupi existe. + +BOOL CDecor::BlupiIfExist(int rank) +{ + return m_blupi[rank].bExist; +} + + +// Triche pour tous les blupi. +// #1 -> (POWER) redonne l'énergie maximale +// #2 -> (LONESOME) tue toutes les araignées/virus/etc. + +void CDecor::BlupiCheat(int cheat) +{ + int rank; + + for ( rank=0 ; rank= 69 && + m_blupi[rank].icon <= 92 ) + { + m_blupi[rank].icon += 100; // 169..192 (tout vert) + } + else if ( m_blupi[rank].icon == 270 ) // écrasé ? + { + m_blupi[rank].icon = 271; + } + else if ( m_blupi[rank].icon < 318 || // pas télétransporté ? + m_blupi[rank].icon > 321 ) + { + direct = GetIconDirect(m_blupi[rank].icon); + if ( direct < 0 ) + { + m_blupi[rank].icon = 169; // debout direction est ! + } + else + { + m_blupi[rank].icon = 169+3*(direct/16); + } + } + } + + if ( m_blupi[rank].perso == 0 && + m_blupi[rank].vehicule == 1 ) // en bateau ? + { + direct = GetIconDirect(m_blupi[rank].icon); + if ( direct < 0 ) + { + m_blupi[rank].icon = 234; // bateau direction est ! + } + else + { + m_blupi[rank].icon = 234+(direct/(16/2)); + } + } + + if ( m_blupi[rank].perso == 0 && + m_blupi[rank].vehicule == 2 ) // en jeep ? + { + direct = GetIconDirect(m_blupi[rank].icon); + if ( direct < 0 ) + { + m_blupi[rank].icon = 250; // bateau direction est ! + } + else + { + m_blupi[rank].icon = 250+(direct/(16/2)); + } + } + + if ( m_blupi[rank].perso == 0 && + m_blupi[rank].vehicule == 3 ) // armure ? + { + if ( m_blupi[rank].icon < 322 || + m_blupi[rank].icon > 347 ) + { + if ( m_blupi[rank].icon == 106 || // élan pour saut ? + m_blupi[rank].icon == 194 ) // mèche ? + { + m_blupi[rank].icon = 347; + } + else + { + direct = GetIconDirect(m_blupi[rank].icon); + if ( direct < 0 ) + { + m_blupi[rank].icon = 322; // armure direction est ! + } + else + { + m_blupi[rank].icon = 322+3*(direct/16); + } + } + } + } + + if ( m_blupi[rank].perso == 8 ) // disciple ? + { + direct = GetIconDirect(m_blupi[rank].icon); + if ( direct < 0 ) + { + m_blupi[rank].icon = 290; // disciple direction est ! + } + else + { + m_blupi[rank].icon = 290+(direct/(16/2)); + } + } +} + + +// Fait entendre un son pour un blupi. +// Si bStop=TRUE, on stoppe le son précédent associé +// à ce blupi (rank), si nécessaire. + +void CDecor::BlupiSound(int rank, int sound, POINT pos, BOOL bStop) +{ + int newSound; + + if ( rank == -1 ) + { + rank = m_rankBlupiHili; + } + + if ( rank != -1 && m_blupi[rank].perso == 8 ) // disciple ? + { + if ( sound == SOUND_HOP || + sound == SOUND_BRULE || + sound == SOUND_TCHAO || + sound == SOUND_FLEUR || + sound == SOUND_ARROSE ) + { + newSound = -1; + } + else + { + newSound = sound; + } + + if ( sound == SOUND_BOING || + sound == SOUND_BOING1 || + sound == SOUND_BOING2 || + sound == SOUND_BOING3 ) + { + newSound = SOUND_D_BOING; + } + if ( sound == SOUND_GO1 || + sound == SOUND_GO2 || + sound == SOUND_GO3 || + sound == SOUND_GO4 || + sound == SOUND_GO5 || + sound == SOUND_GO6 ) + { + newSound = SOUND_D_GO; + } + if ( sound == SOUND_OK1 || + sound == SOUND_OK2 || + sound == SOUND_OK3 || + sound == SOUND_OK4 || + sound == SOUND_OK5 || + sound == SOUND_OK6 || + sound == SOUND_OK1f || + sound == SOUND_OK2f || + sound == SOUND_OK3f || + sound == SOUND_OK1e || + sound == SOUND_OK2e || + sound == SOUND_OK3e ) + { + newSound = SOUND_D_OK; + } + if ( sound == SOUND_TERM1 || + sound == SOUND_TERM2 || + sound == SOUND_TERM3 || + sound == SOUND_TERM4 || + sound == SOUND_TERM5 || + sound == SOUND_TERM6 ) + { + newSound = SOUND_D_TERM; + } + + if ( newSound == -1 ) return; + sound = newSound; + } + + if ( bStop ) + { + m_pSound->PlayImage(sound, pos, rank); + } + else + { + m_pSound->PlayImage(sound, pos); + } +} + +// Sons associés à des actions. + +static short tableSound[] = +{ + ACTION_BRULE, SOUND_BRULE, + ACTION_TCHAO, SOUND_TCHAO, + ACTION_MANGE, SOUND_MANGE, + ACTION_BOIT, SOUND_BOIT, + ACTION_GLISSE, SOUND_GLISSE, + ACTION_R_CHARGE, SOUND_R_CHARGE, + -1 +}; + +// Effectue quelques initialisations pour une nouvelle action. + +void CDecor::BlupiInitAction(int rank, int action, int direct) +{ + short* pTable = tableSound; + POINT pos; + int rand; + + while ( *pTable != -1 ) + { + if ( pTable[0] == action ) + { + pos = ConvCelToPos(m_blupi[rank].cel); + BlupiSound(rank, pTable[1], pos); + break; + } + + pTable += 2; + } + + m_blupi[rank].action = action; + + if ( m_blupi[rank].perso == 0 ) // blupi ? + { + if ( m_blupi[rank].vehicule == 1 ) // en bateau ? + { + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_STOPb; + } + + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_MARCHEb; + } + } + + if ( m_blupi[rank].vehicule == 2 ) // en jeep ? + { + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_STOPj; + } + + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_MARCHEj; + } + } + + if ( m_blupi[rank].vehicule == 3 ) // armure ? + { + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_STOPa; + } + + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_MARCHEa; + m_blupi[rank].step = (m_blupi[rank].step/2)*2; + } + } + + if ( m_blupi[rank].energy <= MAXENERGY/4 ) // peu de forces ? + { + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_STOPf; + } + + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_MARCHEf; + m_blupi[rank].step = (m_blupi[rank].step/2)*2; + } + } + + if ( m_blupi[rank].action == ACTION_STOP && + m_blupi[rank].goalAction == 0 ) // à pied ? + { + rand = Random(0,400); + if ( rand >= 10 && rand <= 15 && + m_blupi[rank].takeChannel == -1 ) + { + m_blupi[rank].action = ACTION_MISC1; // épaules + m_blupi[rank].step = 0; + } + if ( rand >= 20 && rand <= 23 ) + { + m_blupi[rank].action = ACTION_MISC2; // grat-grat + m_blupi[rank].step = 0; + } + if ( rand == 30 && + m_blupi[rank].takeChannel == -1 ) + { + m_blupi[rank].action = ACTION_MISC3; // yoyo + m_blupi[rank].step = 0; + } + if ( rand >= 40 && rand <= 45 ) + { + m_blupi[rank].action = ACTION_MISC4; // ferme les yeux + m_blupi[rank].step = 0; + } + if ( rand == 50 && + m_blupi[rank].takeChannel == -1 ) + { + m_blupi[rank].action = ACTION_MISC5; // ohé + m_blupi[rank].step = 0; + } + if ( rand == 60 ) + { + m_blupi[rank].action = ACTION_MISC6; // diabolo + m_blupi[rank].step = 0; + } + } + if ( m_blupi[rank].action == ACTION_STOPf && + m_blupi[rank].goalAction == 0 ) + { + rand = Random(0,100); + if ( rand == 10 && // propabilité 1/100 + m_blupi[rank].takeChannel == -1 ) + { + m_blupi[rank].action = ACTION_MISC1f; + m_blupi[rank].step = 0; + } + } + + if ( direct != -1 ) + { + m_blupi[rank].sDirect = direct; + } + + if ( m_blupi[rank].action == ACTION_BUILD || + m_blupi[rank].action == ACTION_BUILDBREF || + m_blupi[rank].action == ACTION_BUILDSEC || + m_blupi[rank].action == ACTION_BUILDSOURD || + m_blupi[rank].action == ACTION_BUILDPIERRE || + m_blupi[rank].action == ACTION_PIOCHE || + m_blupi[rank].action == ACTION_PIOCHEPIERRE || + m_blupi[rank].action == ACTION_PIOCHESOURD || + m_blupi[rank].action == ACTION_ARROSE || + m_blupi[rank].action == ACTION_BECHE || + m_blupi[rank].action == ACTION_SCIE || + m_blupi[rank].action == ACTION_TAKE || + m_blupi[rank].action == ACTION_DEPOSE || + m_blupi[rank].action == ACTION_BRULE || + m_blupi[rank].action == ACTION_TCHAO || + m_blupi[rank].action == ACTION_GRILLE1 || + m_blupi[rank].action == ACTION_GRILLE2 || + m_blupi[rank].action == ACTION_GRILLE3 || + m_blupi[rank].action == ACTION_ELECTRO || + m_blupi[rank].action == ACTION_MANGE || + m_blupi[rank].action == ACTION_BOIT || + m_blupi[rank].action == ACTION_NAISSANCE || + m_blupi[rank].action == ACTION_SAUTE1 || + m_blupi[rank].action == ACTION_SAUTE2 || + m_blupi[rank].action == ACTION_SAUTE3 || + m_blupi[rank].action == ACTION_SAUTE4 || + m_blupi[rank].action == ACTION_SAUTE5 || +//? m_blupi[rank].action == ACTION_GLISSE || + m_blupi[rank].action == ACTION_PONT || + m_blupi[rank].action == ACTION_MECHE || + m_blupi[rank].action == ACTION_A_GRILLE || + m_blupi[rank].action == ACTION_V_GRILLE || + m_blupi[rank].action == ACTION_T_ECRASE || + m_blupi[rank].action == ACTION_R_MARCHE || + m_blupi[rank].action == ACTION_R_APLAT || + m_blupi[rank].action == ACTION_R_BUILD || + m_blupi[rank].action == ACTION_R_CHARGE || + m_blupi[rank].action == ACTION_B_MARCHE || + m_blupi[rank].action == ACTION_E_MARCHE || + m_blupi[rank].action == ACTION_MARCHEb || + m_blupi[rank].action == ACTION_MARCHEj || + m_blupi[rank].action == ACTION_TELEPORTE1 || + m_blupi[rank].action == ACTION_TELEPORTE2 || + m_blupi[rank].action == ACTION_TELEPORTE3 || + m_blupi[rank].action == ACTION_ARMUREOPEN || + m_blupi[rank].action == ACTION_ARMURECLOSE ) + { + m_blupi[rank].step = 0; + } + } + + if ( m_blupi[rank].perso == 1 ) // araignée ? + { + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_A_MARCHE; + } + + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_A_STOP; + m_blupi[rank].sDirect = Random(0,7)*16; + } + + m_blupi[rank].step = 0; + } + + if ( m_blupi[rank].perso == 2 ) // virus ? + { + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_V_MARCHE; + } + + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_V_STOP; + } + + m_blupi[rank].step = 0; + } + + if ( m_blupi[rank].perso == 3 ) // tracks ? + { + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_T_MARCHE; + } + + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_T_STOP; + } + + m_blupi[rank].step = 0; + } + + if ( m_blupi[rank].perso == 4 ) // robot ? + { + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_R_MARCHE; + } + + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_R_STOP; + } + + m_blupi[rank].step = 0; + } + + if ( m_blupi[rank].perso == 5 ) // bombe ? + { + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_B_MARCHE; + } + + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_B_STOP; + } + + m_blupi[rank].step = 0; + } + + if ( m_blupi[rank].perso == 7 ) // électro ? + { + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_E_MARCHE; + } + + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_E_STOP; + } + + m_blupi[rank].step = 0; + } + + if ( m_blupi[rank].perso == 8 ) // disciple ? + { + if ( direct != -1 ) + { + m_blupi[rank].sDirect = direct; + } + + if ( m_blupi[rank].action == ACTION_MARCHE ) + { + m_blupi[rank].action = ACTION_D_MARCHE; + } + + if ( m_blupi[rank].action == ACTION_STOP ) + { + m_blupi[rank].action = ACTION_D_STOP; + } + + if ( m_blupi[rank].action == ACTION_PIOCHE ) + { + m_blupi[rank].action = ACTION_D_PIOCHE; + } + + if ( m_blupi[rank].action == ACTION_BUILD ) + { + m_blupi[rank].action = ACTION_D_BUILD; + } + + if ( m_blupi[rank].action == ACTION_SCIE ) + { + m_blupi[rank].action = ACTION_D_SCIE; + } + + if ( m_blupi[rank].action == ACTION_TCHAO ) + { + m_blupi[rank].action = ACTION_D_TCHAO; + } + + if ( m_blupi[rank].action == ACTION_CUEILLE1 ) + { + m_blupi[rank].action = ACTION_D_CUEILLE1; + } + + if ( m_blupi[rank].action == ACTION_CUEILLE2 ) + { + m_blupi[rank].action = ACTION_D_CUEILLE2; + } + + if ( m_blupi[rank].action == ACTION_MECHE ) + { + m_blupi[rank].action = ACTION_D_MECHE; + } + + if ( m_blupi[rank].action == ACTION_ARROSE ) + { + m_blupi[rank].action = ACTION_D_ARROSE; + } + + if ( m_blupi[rank].action == ACTION_BECHE ) + { + m_blupi[rank].action = ACTION_D_BECHE; + } + + m_blupi[rank].step = 0; + } +} + +// Change l'action de blupi. + +void CDecor::BlupiChangeAction(int rank, int action, int direct) +{ + if ( rank < 0 ) return; + BlupiInitAction(rank, action, direct); + BlupiDestCel(rank); + m_blupi[rank].phase = 0; + m_blupi[rank].pos.x = 0; + m_blupi[rank].pos.y = 0; + BlupiNextAction(rank); +} + + + +// Vide la liste des actions. + +void CDecor::ListFlush(int rank) +{ + int i; + + for ( i=0 ; i0 ; i-- ) + { + m_blupi[rank].listButton[i] = m_blupi[rank].listButton[i-1]; + m_blupi[rank].listCel[i] = m_blupi[rank].listCel[i-1]; + m_blupi[rank].listParam[i] = m_blupi[rank].listParam[i-1]; + } + + m_blupi[rank].listButton[0] = button; + m_blupi[rank].listCel[0] = cMem; + m_blupi[rank].listParam[0] = ListGetParam(rank, button, cel); + + return TRUE; +} + +// Enlève la dernière action ajoutée dans la liste. + +void CDecor::ListRemove(int rank) +{ + int i; + + if ( m_blupi[rank].listButton[0] == BUTTON_CULTIVE ) return; + + for ( i=0 ; i= m_blupi[rank].listCel[nb-1].x-50 && + cel.x <= m_blupi[rank].listCel[nb-1].x+50 && + cel.y >= m_blupi[rank].listCel[nb-1].y-50 && + cel.y <= m_blupi[rank].listCel[nb-1].y+50 ) + { + for ( j=0 ; j= m_blupi[rank].listCel[i].x-50 && + cel.x <= m_blupi[rank].listCel[i].x+50 && + cel.y >= m_blupi[rank].listCel[i].y-50 && + cel.y <= m_blupi[rank].listCel[i].y+50 ) + { + return i; + } + } +#endif + + return -1; +} + +// Ajuste une action à répéter. + +BOOL CDecor::RepeatAdjust(int rank, int button, + POINT &cel, POINT &cMem, int param, int list) +{ + int i, channel, icon, icon1, icon2, flags; + POINT test; + + static int table_object[] = + { + BUTTON_ABAT, CHOBJECT, 6, 11, + BUTTON_ROC, CHOBJECT, 37, 43, + BUTTON_MANGE, CHOBJECT, 60, 60, + BUTTON_PALIS, CHOBJECT, 36, 36, + BUTTON_BATEAU, CHOBJECT, 36, 36, + BUTTON_DEPOSE, -1, -1, -1, + BUTTON_DJEEP, -1, -1, -1, + BUTTON_DARMURE, -1, -1, -1, + 0, + }; + + static int table_mur[] = + { + +2, 0, // 1<<0 + 0,+2, // 1<<1 + -2, 0, // 1<<2 + 0,-2, // 1<<3 + }; + + if ( button == BUTTON_DEPOSE && // dépose pour une palissade ? + list > 0 && + m_blupi[rank].listButton[list-1] == BUTTON_PALIS ) + { + icon = m_decor[cel.x/2][cel.y/2].objectIcon; + + flags = 0; + if ( icon == 65 ) flags = (1<<0)|(1<<2); + if ( icon == 66 ) flags = (1<<1)|(1<<3); + if ( icon == 67 ) flags = (1<<0)|(1<<1); + if ( icon == 68 ) flags = (1<<1)|(1<<2); + if ( icon == 69 ) flags = (1<<2)|(1<<3); + if ( icon == 70 ) flags = (1<<0)|(1<<3); + if ( icon == 71 ) + { + for ( i=0 ; i<4 ; i++ ) + { + test.x = cel.x + table_mur[i*2+0]; + test.y = cel.y + table_mur[i*2+1]; + if ( IsValid(test) && + m_decor[test.x/2][test.y/2].floorIcon == 15 && // dalle grise ? + CelOkForAction(test, WM_ACTION_DEPOSE, rank) == 0 ) + { + cel = test; + cMem = test; + goto ok; + } + } + flags = (1<<0)|(1<<1)|(1<<2)|(1<<3); + } + + if ( flags == 0 ) + { + if ( CelOkForAction(cel, WM_ACTION_DEPOSE, rank) == 0 ) + { + goto ok; + } + } + + for ( i=0 ; i<4 ; i++ ) + { + if ( flags & (1< 0 && + m_blupi[rank].listButton[list-1] == BUTTON_BATEAU ) + { + if ( SearchOtherBateau(rank, cel, 100, test, icon) ) + { + cel = test; + cMem = test; + goto ok; + } + return FALSE; + } + +//? if ( button == BUTTON_MANGE ) +//? { +//? cel = m_blupi[rank].cel; // cherche là où est blupi ! +//? } + + i = 0; + channel = -2; + icon1 = -1; + icon2 = -1; + while ( table_object[i] != 0 ) + { + if ( button == table_object[i] ) + { + channel = table_object[i+1]; + icon1 = table_object[i+2]; + icon2 = table_object[i+3]; + break; + } + i += 4; + } + + if ( button == BUTTON_CARRY || + button == BUTTON_FLEUR ) + { + channel = CHOBJECT; + icon1 = param; + icon2 = param; + } + if ( button == BUTTON_GO && // va en bateau/jeep ? + param != -1 ) + { + channel = CHOBJECT; + icon1 = param; + icon2 = param; + } + + if ( channel != -2 ) + { + if ( !SearchOtherObject(rank, cel, table_actions[button], + 50*2, channel, + icon1, icon2, -1, -1, + cel, icon1) ) + { + return FALSE; + } + } + + if ( button == BUTTON_PALIS ) + { + cMem = cel; + } + + ok: + if ( cel.x%2 == 0 ) cel.x ++; + if ( cel.y%2 == 0 ) cel.y ++; // sur l'objet + + m_blupi[rank].interrupt = 1; + return TRUE; +} + + + +// Démarre une action. + +void CDecor::GoalStart(int rank, int action, POINT cel) +{ + m_blupi[rank].goalHili = cel; + m_blupi[rank].goalAction = action; + m_blupi[rank].goalPhase = 0; + m_blupi[rank].goalCel.x = -1; + m_blupi[rank].bRepeat = FALSE; + + GoalInitJauge(rank); + FlushUsed(rank); +} + +// Effectue la méta opération suivante. +// Retourne FALSE lorsque c'est fini ! + +BOOL CDecor::GoalNextPhase(int rank) +{ + short* pTable; + int i, nb; + + if ( m_blupi[rank].goalAction == 0 ) return FALSE; + + pTable = GetTableGoal(m_blupi[rank].goalAction); + if ( pTable == NULL ) + { + GoalStop(rank, TRUE); + return FALSE; + } + + for ( i=0 ; i 0 ) + { + m_blupi[rank].jaugePhase = 0; + m_blupi[rank].jaugeMax = max; + } +} + +// Permet de passer à travers certains arbres. + +void CDecor::GoalInitPassCel(int rank) +{ + POINT cel; + int channel, icon; + + cel.x = (m_blupi[rank].goalCel.x/2)*2; + cel.y = (m_blupi[rank].goalCel.y/2)*2; + + GetObject(cel, channel, icon); + + if ( channel == CHOBJECT && + ((icon >= 8 && icon <= 11) || // arbres touffus ? + (icon >= 30 && icon <= 35) || // arbres touffus sans feuilles ? + (icon >= 37 && icon <= 43) || // rochers ? + (icon == 81 || icon == 83 || icon == 94) || // fleurs ? + (icon >= 100 && icon <= 105) || // usine ? + (icon == 115 || icon == 116) || // usine ? + (icon == 17 || icon == 18) || // usine ? + (icon == 117) || // bateau ? + (icon == 118) || // jeep ? + (icon == 16)) ) // armure ? + { + m_blupi[rank].passCel = m_blupi[rank].goalCel; + } + else + { + m_blupi[rank].passCel.x = -1; + } +} + +// Ajuste une coordonnée de cellule. + +void CDecor::GoalAdjustCel(int rank, int &x, int &y) +{ + if ( x == -10 && y == -10 ) + { + if ( m_blupi[rank].goalAction == WM_ACTION_PONTEL ) + { + x = m_blupi[rank].fix.x + m_blupi[rank].cLoop*2; + y = m_blupi[rank].fix.y; + return; + } + if ( m_blupi[rank].goalAction == WM_ACTION_PONTOL ) + { + x = m_blupi[rank].fix.x - m_blupi[rank].cLoop*2; + y = m_blupi[rank].fix.y; + return; + } + if ( m_blupi[rank].goalAction == WM_ACTION_PONTSL ) + { + x = m_blupi[rank].fix.x; + y = m_blupi[rank].fix.y + m_blupi[rank].cLoop*2; + return; + } + if ( m_blupi[rank].goalAction == WM_ACTION_PONTNL ) + { + x = m_blupi[rank].fix.x; + y = m_blupi[rank].fix.y - m_blupi[rank].cLoop*2; + return; + } + } + + x += m_blupi[rank].cel.x; + y += m_blupi[rank].cel.y; +} + +// Liste des buts multiples. + +int table_multi_goal[16*2] = +{ + 0, 0, + +1, 0, + 0,+1, + +1,+1, + 0,-1, + +1,-1, + 0,+2, + +1,+2, + -1,-1, + -1, 0, + -1,+1, + -1,+2, + +2,-1, + +2, 0, + +2,+1, + +2,+2, +}; + +// Effectue une méta opération. + +BOOL CDecor::GoalNextOp(int rank, short *pTable) +{ + int op, x, y; + int action, direct, channel, icon, mchannel, micon; + int total, step, delai, first, last, first2, last2, flag, i; + int button, param; + POINT pos, cel, cMem, destCel; + BOOL bOK, bError=TRUE; + + pos = ConvCelToPos(m_blupi[rank].cel); + + op = *pTable++; + + if ( op == GOAL_ACTION && + *pTable != ACTION_STOP ) + { + m_blupi[rank].jaugePhase ++; + } + + if ( op == GOAL_GOHILI ) + { + m_blupi[rank].goalCel.x = m_blupi[rank].goalHili.x+(*pTable++); + m_blupi[rank].goalCel.y = m_blupi[rank].goalHili.y+(*pTable++); + flag = *pTable++; +//? m_blupi[rank].passCel.x = -1; + FlushUsed(rank); + return TRUE; + } + + if ( op == GOAL_GOHILI2 ) + { + cel.x = (m_blupi[rank].goalHili.x/2)*2+(*pTable++); + cel.y = (m_blupi[rank].goalHili.y/2)*2+(*pTable++); + flag = *pTable++; + if ( flag == TRUE ) + { + m_blupi[rank].goalCel = cel; + GoalInitPassCel(rank); + } + m_blupi[rank].goalCel = cel; + FlushUsed(rank); + return TRUE; + } + + if ( op == GOAL_GOBLUPI ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + flag = *pTable++; + if ( flag == TRUE ) + { + if ( IsBlupiHereEx(cel, rank, FALSE) ) // destination occupée ? + { + m_blupi[rank].goalPhase --; // on attend ... + return TRUE; + } + m_blupi[rank].goalCel = cel; + GoalInitPassCel(rank); + } + m_blupi[rank].goalCel = cel; + FlushUsed(rank); + return TRUE; + } + + if ( op == GOAL_TESTOBJECT ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + channel = *pTable++; + icon = *pTable++; + GetObject(cel, mchannel, micon); + if ( channel != mchannel || icon != micon ) goto error; + return TRUE; + } + + if ( op == GOAL_PUTFLOOR ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + channel = *pTable++; + icon = *pTable++; + if ( icon == -2 ) icon = m_blupi[rank].vIcon; + PutFloor(GetCel(x,y), channel, icon); + return TRUE; + } + + if ( op == GOAL_PUTOBJECT ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + channel = *pTable++; + icon = *pTable++; + if ( channel == -3 && icon == -3 ) // l'objet transporté ? + { + channel = m_blupi[rank].takeChannel; + icon = m_blupi[rank].takeIcon; + } + PutObject(GetCel(x,y), channel, icon); + return TRUE; + } + + if ( op == GOAL_BUILDFLOOR ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + cel.x = (x/2)*2; + cel.y = (y/2)*2; + GetFloor(cel, channel, i); + channel = *pTable++; + icon = *pTable++; + mchannel = *pTable++; + micon = *pTable++; + total = *pTable++; + delai = *pTable++; + step = *pTable++; + + if ( i >= 19 && i <= 32 && // herbe foncée ? + icon == 57 ) icon = 58; // sol tomate foncé + if ( i == 58 && + icon == 1 ) icon = 20; // remet herbe foncée + + if ( !MoveCreate(cel, rank, TRUE, + channel, icon, + mchannel, micon, + total, delai, step) ) goto error; + return TRUE; + } + + if ( op == GOAL_BUILDOBJECT ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + cel.x = (x/2)*2; + cel.y = (y/2)*2; + channel = *pTable++; + icon = *pTable++; + mchannel = *pTable++; + micon = *pTable++; + total = *pTable++; + delai = *pTable++; + step = *pTable++; + if ( channel == -2 && icon == -2 ) // l'objet actuel ? + { + GetObject(cel, channel, icon); + } + ArrangeBuild(cel, channel, icon); // arrange les murs autour + if ( !MoveCreate(cel, rank, FALSE, + channel, icon, + mchannel, micon, + total, delai, step) ) goto error; + return TRUE; + } + + if ( op == GOAL_FINISHMOVE ) + { + MoveFinish(rank); + return TRUE; + } + + if ( op == GOAL_ARRANGEOBJECT ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + MoveFinish(GetCel(x,y)); + ArrangeObject(GetCel(x,y)); + return TRUE; + } + + if ( op == GOAL_EXPLOSE1 ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + cel = GetCel(x,y); + + BlupiKill(rank, cel, 0); + MoveFinish(cel); + + // Faut-il démarrer une explosion en chaîne. + GetObject(cel, channel, icon); + if ( channel == CHOBJECT && icon == 85 ) // dynamite ? + { + rank = BlupiCreate(GetCel(cel,1,1), ACTION_STOP, DIRECT_E, + 6, MAXENERGY); // crée un détonnateur + if ( rank >= 0 ) + { + GoalStart(rank, WM_ACTION_T_DYNAMITE, cel); + m_blupi[rank].bCache = TRUE; + } + } + else + { + PutObject(cel, -1,-1); // supprime l'objet + ArrangeObject(cel); + } + return TRUE; + } + + if ( op == GOAL_EXPLOSE2 ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + cel = GetCel((x/2)*2,(y/2)*2); + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 85 ) // dynamite ? + { + channel = CHOBJECT; + icon = -1; + ArrangeBuild(cel, channel, icon); // arrange les murs autour + if ( !MoveCreate(cel, rank, FALSE, + CHOBJECT,-1, -1,-1, + 10, 1, -1*100) ) goto error; + MoveAddIcons(cel, 6); // explosion + } + return TRUE; + } + + if ( op == GOAL_ADDMOVES ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + icon = *pTable++; + MoveAddMoves(GetCel(x,y), icon); + return TRUE; + } + + if ( op == GOAL_ADDICONS ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + icon = *pTable++; + MoveAddIcons(GetCel(x,y), icon); + return TRUE; + } + + if ( op == GOAL_ACTION ) + { + action = *pTable++; + direct = *pTable++; + BlupiInitAction(rank, action, direct); + return TRUE; + } + + if ( op == GOAL_ELECTRO ) + { + x = *pTable++; + y = *pTable++; + GoalAdjustCel(rank, x,y); + cel = GetCel((x/2)*2,(y/2)*2); + icon = *pTable++; + if ( MoveCreate(cel, rank, TRUE, + CHFLOOR,-1, -1,-1, + 100,1,100, FALSE, TRUE) ) + { + MoveAddIcons(cel, icon); + } + BlupiKill(rank, cel, 1); + return TRUE; + } + + if ( op == GOAL_MALADE ) + { + m_blupi[rank].bMalade = *pTable++; + return TRUE; + } + + if ( op == GOAL_WORK ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + m_decor[cel.x/2][cel.y/2].workBlupi = rank; + return TRUE; + } + + if ( op == GOAL_INTERRUPT ) + { + m_blupi[rank].interrupt = *pTable++; // change le niveau + return TRUE; + } + + if ( op == GOAL_ENERGY ) + { + if ( m_blupi[rank].energy <= *pTable++ ) goto error; + return TRUE; + } + + if ( op == GOAL_ISNOMALADE ) + { + if ( m_blupi[rank].bMalade ) goto error; + return TRUE; + } + + if ( op == GOAL_TAKE ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + MoveFinish(rank); + m_blupi[rank].takeChannel = m_decor[cel.x/2][cel.y/2].objectChannel; + m_blupi[rank].takeIcon = m_decor[cel.x/2][cel.y/2].objectIcon; + m_decor[cel.x/2][cel.y/2].objectChannel = -1; + m_decor[cel.x/2][cel.y/2].objectIcon = -1; + return TRUE; + } + + if ( op == GOAL_TAKEOBJECT ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + channel = *pTable++; + icon = *pTable++; + m_blupi[rank].takeChannel = channel; + m_blupi[rank].takeIcon = icon; + return TRUE; + } + + if ( op == GOAL_LABO ) + { + m_blupi[rank].takeChannel = CHOBJECT; + if ( m_blupi[rank].takeIcon == 82 ) // fleurs normales ? + { + m_blupi[rank].takeIcon = 80; // bouteille + } + if ( m_blupi[rank].takeIcon == 84 ) // fleurs foncées ? + { + m_blupi[rank].takeIcon = 85; // dynamite + } + if ( m_blupi[rank].takeIcon == 95 ) // fleurs vertes ? + { + m_blupi[rank].takeIcon = 93; // piège + } + if ( m_blupi[rank].takeIcon == 60 ) // tomates ? + { + m_blupi[rank].takeIcon = 92; // poison + } + return TRUE; + } + + if ( op == GOAL_CACHE ) + { + m_blupi[rank].bCache = *pTable++; + if ( *pTable++ && // bDynamite ? + m_blupi[rank].perso == 0 && + m_blupi[rank].vehicule == 3 && // armure ? + !m_bInvincible ) + { + m_blupi[rank].bCache = FALSE; + } + return TRUE; + } + + if ( op == GOAL_DELETE ) + { + if ( m_blupi[rank].perso == 0 && // blupi ? + m_blupi[rank].vehicule == 3 && // armure ? + !m_bInvincible ) + { + return TRUE; + } + BlupiDelete(rank); // snif ... + return TRUE; + } + + if ( op == GOAL_DEPOSE ) + { + m_blupi[rank].takeChannel = -1; + return TRUE; + } + + if ( op == GOAL_NEWBLUPI ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + PutObject(cel, -1,-1); // enlève les oeufs + + rank = BlupiCreate(cel, ACTION_STOP, DIRECT_E, 0, MAXENERGY/4); + if ( rank >= 0 ) + { + m_blupi[rank].energy = MAXENERGY/4; + BlupiInitAction(rank, ACTION_NAISSANCE); + } + + cel.x ++; + rank = BlupiCreate(cel, ACTION_STOP, DIRECT_E, 0, MAXENERGY/4); + if ( rank >= 0 ) + { + m_blupi[rank].energy = MAXENERGY/4; + BlupiInitAction(rank, ACTION_NAISSANCE); + } + + cel.x --; + cel.y ++; + rank = BlupiCreate(cel, ACTION_STOP, DIRECT_E, 0, MAXENERGY/4); + if ( rank >= 0 ) + { + m_blupi[rank].energy = MAXENERGY/4; + BlupiInitAction(rank, ACTION_NAISSANCE); + } + + cel.x ++; + rank = BlupiCreate(cel, ACTION_STOP, DIRECT_E, 0, MAXENERGY/4); + if ( rank >= 0 ) + { + m_blupi[rank].energy = MAXENERGY/4; + BlupiInitAction(rank, ACTION_NAISSANCE); + } + return TRUE; + } + + if ( op == GOAL_NEWPERSO ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + icon = *pTable++; + + destCel = cel; + destCel.x ++; + if ( IsBlupiHereEx(destCel, rank, FALSE) ) // destination occupée ? + { + m_blupi[rank].goalPhase --; // on attend ... + return TRUE; + } + destCel.x ++; + if ( IsBlupiHereEx(destCel, rank, FALSE) ) // destination occupée ? + { + destCel.y --; + if ( icon == 5 || // bombe ? + IsBlupiHereEx(destCel, rank, FALSE) ) // destination occupée ? + { + m_blupi[rank].goalPhase --; // on attend ... + return TRUE; + } + } + + rank = BlupiCreate(cel, ACTION_STOP, DIRECT_E, icon, MAXENERGY); + if ( rank >= 0 ) + { + m_blupi[rank].goalCel = destCel; + } + return TRUE; + } + + if ( op == GOAL_USINEBUILD ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + if ( !IsUsineBuild(rank, cel) ) goto error; + return TRUE; + } + + if ( op == GOAL_USINEFREE ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + if ( !IsUsineFree(rank, cel) ) + { + GoalStop(rank, TRUE); + m_blupi[rank].goalCel = GetCel(cel,1,-1); // à côté de la porte +//? m_blupi[rank].goalAction = 0; // stoppe sitôt après +//? m_blupi[rank].interrupt = 1; +//? GoalUnwork(rank); +//? FlushUsed(rank); + } + return TRUE; + } + + if ( op == GOAL_AMORCE ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + if ( IsBlupiHereEx(cel, rank, FALSE) ) goto error; + // Crée un détonnateur de mine (blupi invisible). + rank = BlupiCreate(cel, ACTION_STOP, DIRECT_E, 6, MAXENERGY); + if ( rank >= 0 ) + { + m_blupi[rank].bCache = TRUE; // invisible + m_blupi[rank].goalAction = WM_ACTION_MINE2; + m_blupi[rank].goalPhase = 0; + m_blupi[rank].goalCel.x = -1; + m_blupi[rank].interrupt = 1; + } + return TRUE; + } + + if ( op == GOAL_VEHICULE ) + { + m_blupi[rank].vehicule = *pTable++; + if ( m_blupi[rank].vehicule != 0 && // pas à pied ? + m_blupi[rank].takeChannel != -1 && // porte qq chose ? + m_blupi[rank].energy <= MAXENERGY/4 ) // faible ? + { + m_blupi[rank].energy = MAXENERGY/4+1; + } + return TRUE; + } + + if ( op == GOAL_ACTUALISE ) + { + BlupiActualise(rank); + return TRUE; + } + + if ( op == GOAL_SOUND ) + { + icon = *pTable++; + BlupiSound(rank, icon, pos); + return TRUE; + } + + if ( op == GOAL_REPEAT ) + { + icon = *pTable++; + m_blupi[rank].bRepeat = icon; + return TRUE; + } + + if ( op == GOAL_OTHER ) + { + if ( !m_blupi[rank].bRepeat ) goto term; + + // Bouton stop pressé ? + if ( m_blupi[rank].stop == 1 ) goto term; + + channel = *pTable++; + first = *pTable++; + last = *pTable++; + first2 = *pTable++; + last2 = *pTable++; + action = *pTable++; + if ( !SearchOtherObject(rank, m_blupi[rank].cel, action, 100, + channel, first, last, first2, last2, + m_blupi[rank].goalHili, icon) ) goto term; + if ( action == WM_ACTION_ABAT1 || + action == WM_ACTION_ROC1 ) + { + action += icon-first; // WM_ACTION_ABAT1..6 + } + m_blupi[rank].goalAction = action; + m_blupi[rank].goalPhase = 0; + m_blupi[rank].goalCel.x = -1; + m_blupi[rank].interrupt = 1; + GoalInitJauge(rank); + GoalUnwork(rank); + FlushUsed(rank); + return TRUE; + } + + if ( op == GOAL_OTHERFIX ) + { + if ( !m_blupi[rank].bRepeat ) goto term; + + // Bouton stop pressé ? + if ( m_blupi[rank].stop == 1 ) goto term; + + channel = *pTable++; + first = *pTable++; + last = *pTable++; + first2 = *pTable++; + last2 = *pTable++; + action = *pTable++; + if ( !SearchOtherObject(rank, m_blupi[rank].fix, action, 100, + channel, first, last, first2, last2, + m_blupi[rank].goalHili, icon) ) goto term; + if ( action == WM_ACTION_ABAT1 || + action == WM_ACTION_ROC1 ) + { + action += icon-first; // WM_ACTION_ABAT1..6 + } + m_blupi[rank].goalAction = action; + m_blupi[rank].goalPhase = 0; + m_blupi[rank].goalCel.x = -1; + m_blupi[rank].interrupt = 1; + GoalInitJauge(rank); + GoalUnwork(rank); + FlushUsed(rank); + return TRUE; + } + + if ( op == GOAL_OTHERLOOP ) + { + action = *pTable++; + if ( m_blupi[rank].cLoop < m_blupi[rank].nLoop ) + { + m_blupi[rank].goalAction = action; + m_blupi[rank].goalPhase = 0; + m_blupi[rank].goalCel.x = -1; + m_blupi[rank].interrupt = 1; + GoalInitJauge(rank); + GoalUnwork(rank); + FlushUsed(rank); + } + return TRUE; + } + + if ( op == GOAL_NEXTLOOP ) + { + m_blupi[rank].cLoop ++; + return TRUE; + } + + if ( op == GOAL_FIX ) + { + m_blupi[rank].fix.x = m_blupi[rank].cel.x+(*pTable++); + m_blupi[rank].fix.y = m_blupi[rank].cel.y+(*pTable++); + return TRUE; + } + + if ( op == GOAL_FLOORJUMP ) + { + channel = *pTable++; + icon = *pTable++; + action = *pTable++; + GetFloor(m_blupi[rank].cel, mchannel, micon); + if ( channel == mchannel && icon == micon ) + { + m_blupi[rank].goalAction = action; + m_blupi[rank].goalPhase = 0; + m_blupi[rank].goalCel.x = -1; + m_blupi[rank].interrupt = 1; + GoalInitJauge(rank); + GoalUnwork(rank); + FlushUsed(rank); + } + return TRUE; + } + + if ( op == GOAL_ADDDRAPEAU ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + AddDrapeau(cel); // cellule sondée + return TRUE; + } + + if ( op == GOAL_TELEPORTE ) + { + pos.x = *pTable++; + pos.y = *pTable++; + + cMem = m_blupi[rank].cel; + GetFloor(cMem, channel, icon); + PutFloor(cMem, -1, -1); + bOK = SearchOtherObject(rank, m_blupi[rank].cel, WM_ACTION_GO, + 1000, CHFLOOR,80,80,-1,-1, cel, i); + PutFloor(cMem, channel, icon); + if ( !bOK ) goto error; + + cel.x += pos.x; + cel.y += pos.y; + if ( IsBlupiHereEx(cel, rank, FALSE) || + !IsFreeCel(cel, rank) ) goto error; + m_blupi[rank].cel = cel; + BlupiPushFog(rank); + if ( m_blupi[rank].bHili ) + { + SetCoin(cel, TRUE); + } + return TRUE; + } + + if ( op == GOAL_IFTERM ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + if ( !IsFreeCel(cel, rank) || + IsBlupiHereEx(cel, rank, FALSE) ) goto term; + return TRUE; + } + + if ( op == GOAL_IFDEBARQUE ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + m_blupi[rank].vehicule = 0; // à pied + bOK = IsFreeCel(cel, rank) && + !IsBlupiHereEx(cel, rank, FALSE); + m_blupi[rank].vehicule = 1; // en bateau + if ( !bOK ) goto term; + return TRUE; + } + + if ( op == GOAL_SKIPSKILL ) + { + i = (*pTable++); + total = (*pTable++); + if ( m_skill == i ) + { + m_blupi[rank].goalPhase += total; // saute qq instructions + } + return TRUE; + } + + if ( op == GOAL_TERM ) + { + term: + bError = FALSE; + } + + if ( op == GOAL_WAITFREE ) + { + cel.x = m_blupi[rank].cel.x+(*pTable++); + cel.y = m_blupi[rank].cel.y+(*pTable++); + if ( IsBlupiHereEx(cel, rank, FALSE) ) // destination occupée ? + { + m_blupi[rank].goalPhase --; // on attend ... + + rank = m_blupiHere; + if ( m_blupi[rank].goalAction != WM_ACTION_GO && + m_blupi[rank].goalAction != WM_ACTION_ELECTRO && + m_blupi[rank].goalAction != WM_ACTION_ELECTROm ) + { + destCel.x = cel.x; + destCel.y = cel.y-1; + if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + { + GoalStart(rank, WM_ACTION_GO, destCel); + return TRUE; + } + + destCel.x = cel.x+1; + destCel.y = cel.y; + if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + { + GoalStart(rank, WM_ACTION_GO, destCel); + return TRUE; + } + + destCel.x = cel.x; + destCel.y = cel.y+1; + if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + { + GoalStart(rank, WM_ACTION_GO, destCel); + return TRUE; + } + + destCel.x = cel.x+1; + destCel.y = cel.y-1; + if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + { + GoalStart(rank, WM_ACTION_GO, destCel); + return TRUE; + } + + destCel.x = cel.x+1; + destCel.y = cel.y+1; + if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + { + GoalStart(rank, WM_ACTION_GO, destCel); + return TRUE; + } + + if ( m_blupi[rank].perso == 0 ) + { + if ( m_blupi[rank].bMalade ) + { + action = WM_ACTION_ELECTROm; + } + else + { + action = WM_ACTION_ELECTRO; + } + GoalStart(rank, action, m_blupi[rank].cel); + return TRUE; + } + } + } + return TRUE; + } + + error: + i = m_blupi[rank].repeatLevel; + GoalStop(rank, bError, i==-1); + if ( i != -1 ) // répétition en cours ? + { + button = m_blupi[rank].listButton[i]; + cMem = m_blupi[rank].listCel[i]; + param = m_blupi[rank].listParam[i]; + cel = cMem; + if ( RepeatAdjust(rank, button, cel, cMem, param, i) ) + { + if ( IsBlupiHereEx(cel, rank, FALSE) ) // destination occupée ? + { + m_blupi[rank].repeatLevel = i; // on continue ... + GoalStart(rank, WM_ACTION_GO, m_blupi[rank].cel); // on attend ... + return TRUE; + } + if ( BlupiGoal(rank, button, cel, cMem) ) + { + m_blupi[rank].repeatLevel = i; // on continue ... + return TRUE; + } + } + } + return FALSE; +} + +// Supprime le blocage de la cellule dans laquelle +// blupi travaille. + +void CDecor::GoalUnwork(int rank) +{ + int x, y; + + for ( x=0 ; x aDirect ) ip = sDirect+0*16-aDirect; + else ip = sDirect+8*16-aDirect; + + if ( aDirect > sDirect ) in = aDirect+0*16-sDirect; + else in = aDirect+8*16-sDirect; + + if ( ip == 0 || in == 0 ) + { + m_blupi[rank].aDirect = m_blupi[rank].sDirect; + return FALSE; + } + + if ( m_blupi[rank].perso == 0 && // blupi ? + m_blupi[rank].vehicule == 1 ) // en bateau ? + { + if ( ip == in ) sens = Random(0,1)?8:8*16-8; + if ( ip < in ) sens = 8; + if ( ip > in ) sens = 8*16-8; + aDirect = (aDirect+sens)%(8*16); + } + else if ( m_blupi[rank].perso == 0 && // blupi ? + m_blupi[rank].vehicule == 2 ) // en jeep ? + { + if ( ip == in ) sens = Random(0,1)?8:8*16-8; + if ( ip < in ) sens = 8; + if ( ip > in ) sens = 8*16-8; + aDirect = (aDirect+sens)%(8*16); + } + else if ( m_blupi[rank].perso == 0 && // blupi ? + m_blupi[rank].vehicule == 3 ) // armure ? + { + if ( ip == in ) sens = Random(0,1)?4:8*16-4; + if ( ip < in ) sens = 4; + if ( ip > in ) sens = 8*16-4; + aDirect = (aDirect+sens)%(8*16); + } + else if ( m_blupi[rank].perso == 3 ) // tracks ? + { + if ( ip == in ) sens = Random(0,1)?4:8*16-4; + if ( ip < in ) sens = 4; + if ( ip > in ) sens = 8*16-4; + aDirect = (aDirect+sens)%(8*16); + } + else if ( m_blupi[rank].perso == 4 ) // robot ? + { + pos = ConvCelToPos(m_blupi[rank].cel); + BlupiSound(rank, SOUND_R_ROTATE, pos); + + if ( ip == in ) sens = Random(0,1)?2:8*16-2; + if ( ip < in ) sens = 2; + if ( ip > in ) sens = 8*16-2; + aDirect = (aDirect+sens)%(8*16); + } + else if ( m_blupi[rank].perso == 8 ) // disciple ? + { + if ( ip == in ) sens = Random(0,1)?8:8*16-8; + if ( ip < in ) sens = 8; + if ( ip > in ) sens = 8*16-8; + aDirect = (aDirect+sens)%(8*16); + } + else + { + if ( ip == in ) sens = Random(0,1)?1:7; + if ( ip < in ) sens = 1; + if ( ip > in ) sens = 7; + aDirect = ((aDirect/16+sens)%8)*16; + } + + m_blupi[rank].lastIcon = m_blupi[rank].icon; + bOK = Rotate(m_blupi[rank].icon, aDirect); + if ( bOK ) + { + m_blupi[rank].aDirect = aDirect; + return TRUE; + } + else + { + m_blupi[rank].aDirect = m_blupi[rank].sDirect; + return FALSE; + } +} + +// Avance un blupi existant. + +BOOL CDecor::BlupiNextAction(int rank) +{ + BOOL bOK; + POINT pos, iCel; + int a, min; + short sound; + + if ( !m_blupi[rank].bExist ) return FALSE; + + if ( m_blupi[rank].clicDelay > 0 ) + { + m_blupi[rank].clicDelay --; + } + if ( m_blupi[rank].clicDelay == 0 ) + { + m_blupi[rank].clicCount = 0; + } + + bOK = TRUE; + if ( !BlupiRotate(rank) ) // si rotation pas nécessaire + { + m_blupi[rank].lastIcon = m_blupi[rank].icon; + + bOK = Action(m_blupi[rank].action, + m_blupi[rank].aDirect, + m_blupi[rank].phase, + m_blupi[rank].step, + m_blupi[rank].channel, + m_blupi[rank].icon, + m_blupi[rank].pos, + m_blupi[rank].posZ, + sound); + BlupiAdaptIcon(rank); + + if ( sound != -1 ) + { + pos = ConvCelToPos(m_blupi[rank].cel); + BlupiSound(rank, sound, pos); + } + } + + a = GetAmplitude(m_blupi[rank].action); + + iCel = m_blupi[rank].cel; + + if ( m_blupi[rank].pos.x == (DIMCELX/2)*a && + m_blupi[rank].pos.y == (DIMCELY/2)*a ) + { + m_blupi[rank].cel.x += a; + BlupiPushFog(rank); + BlupiStartStopRayon(rank, iCel, m_blupi[rank].cel); + } + + if ( m_blupi[rank].pos.x == -(DIMCELX/2)*a && + m_blupi[rank].pos.y == -(DIMCELY/2)*a ) + { + m_blupi[rank].cel.x -= a; + BlupiPushFog(rank); + BlupiStartStopRayon(rank, iCel, m_blupi[rank].cel); + } + + if ( m_blupi[rank].pos.x == -(DIMCELX/2)*a && + m_blupi[rank].pos.y == (DIMCELY/2)*a ) + { + m_blupi[rank].cel.y += a; + BlupiPushFog(rank); + BlupiStartStopRayon(rank, iCel, m_blupi[rank].cel); + } + + if ( m_blupi[rank].pos.x == (DIMCELX/2)*a && + m_blupi[rank].pos.y == -(DIMCELY/2)*a ) + { + m_blupi[rank].cel.y -= a; + BlupiPushFog(rank); + BlupiStartStopRayon(rank, iCel, m_blupi[rank].cel); + } + + if ( m_blupi[rank].pos.x == 0 && + m_blupi[rank].pos.y == DIMCELY*a ) + { + m_blupi[rank].cel.x += a; + m_blupi[rank].cel.y += a; + BlupiPushFog(rank); + BlupiStartStopRayon(rank, iCel, m_blupi[rank].cel); + } + + if ( m_blupi[rank].pos.x == 0 && + m_blupi[rank].pos.y == -DIMCELY*a ) + { + m_blupi[rank].cel.x -= a; + m_blupi[rank].cel.y -= a; + BlupiPushFog(rank); + BlupiStartStopRayon(rank, iCel, m_blupi[rank].cel); + } + + if ( m_blupi[rank].pos.x == DIMCELX*a && + m_blupi[rank].pos.y == 0 ) + { + m_blupi[rank].cel.x += a; + m_blupi[rank].cel.y -= a; + BlupiPushFog(rank); + BlupiStartStopRayon(rank, iCel, m_blupi[rank].cel); + } + + if ( m_blupi[rank].pos.x == -DIMCELX*a && + m_blupi[rank].pos.y == 0 ) + { + m_blupi[rank].cel.x -= a; + m_blupi[rank].cel.y += a; + BlupiPushFog(rank); + BlupiStartStopRayon(rank, iCel, m_blupi[rank].cel); + } + + // Blupi perd de l'énergie s'il fait qq chose. + if ( m_blupi[rank].action != ACTION_STOP && + m_blupi[rank].action != ACTION_STOPf && + m_blupi[rank].action != ACTION_STOPb && + m_blupi[rank].action != ACTION_STOPj && + m_blupi[rank].action != ACTION_MISC1 && + m_blupi[rank].action != ACTION_MISC2 && + m_blupi[rank].action != ACTION_MISC3 && + m_blupi[rank].action != ACTION_MISC4 && + m_blupi[rank].action != ACTION_MISC5 && + m_blupi[rank].action != ACTION_MISC6 && + m_blupi[rank].action != ACTION_MISC1f ) + { + if ( m_blupi[rank].energy > 0 && + m_blupi[rank].perso == 0 && // blupi ? + m_blupi[rank].vehicule == 0 ) // à pied ? + { + if ( m_bSuper ) a = 0; + else a = 1; + min = 0; + if ( m_blupi[rank].goalAction == WM_ACTION_MUR || + m_blupi[rank].goalAction == WM_ACTION_TOUR ) + { + a = 5; + min = 1; + } + if ( m_blupi[rank].action == ACTION_GLISSE ) + { + if ( m_bSuper ) a = 0; + else a = 40; + } + m_blupi[rank].energy -= a; // blupi se fatigue +/- + if ( m_blupi[rank].energy < min ) + { + m_blupi[rank].energy = min; + } + } + } + + // Blupi prend de l'énergie s'il mange. + if ( m_blupi[rank].action == ACTION_MANGE ) + { + if ( m_blupi[rank].energy < MAXENERGY ) + { + m_blupi[rank].energy += MAXENERGY/(40*3); + } + } + + // Le robot perd de l'énergie s'il fait qq chose. + if ( m_blupi[rank].action != ACTION_R_STOP ) + { + if ( m_blupi[rank].energy > 0 && + m_blupi[rank].perso == 4 ) + { + m_blupi[rank].energy -= 3; // le robot se fatigue + if ( m_blupi[rank].energy < 1 ) + { + m_blupi[rank].energy = 1; + } + } + } + + // Le robot prend de l'énergie s'il se recharge. + if ( m_blupi[rank].action == ACTION_R_CHARGE ) + { + if ( m_blupi[rank].energy < MAXENERGY ) + { + m_blupi[rank].energy = MAXENERGY; + } + } + + // Blupi guérrit s'il boit. + if ( m_blupi[rank].action == ACTION_BOIT ) + { + m_blupi[rank].bMalade = FALSE; + if ( m_blupi[rank].energy < MAXENERGY ) + { + m_blupi[rank].energy += MAXENERGY/(40*3); + } + } + + // Si blupi est presque complètement épuisé, il stoppe. + if ( !bOK && + m_blupi[rank].perso == 0 && + m_blupi[rank].energy < 50 && + m_blupi[rank].energy != 0 && + m_blupi[rank].action == ACTION_MARCHEf ) + { + BlupiInitAction(rank, ACTION_STOP); + GoalStop(rank, TRUE); + } + + return bOK; +} + +// Action suivante pour un blupi existant. + +void CDecor::BlupiNextGoal(int rank) +{ + int direct, action, channel, icon, min, lg, fRank, i; + POINT pos, cel, vector; + + if ( !m_blupi[rank].bExist ) return; + + pos = ConvCelToPos(m_blupi[rank].cel); + + // Si blupi termine une action "mort", il doit disparaître. + if ( m_blupi[rank].action == ACTION_BRULE || + m_blupi[rank].action == ACTION_TCHAO || + m_blupi[rank].action == ACTION_A_GRILLE || + m_blupi[rank].action == ACTION_V_GRILLE ) + { + BlupiDelete(rank); // snif ... + return; + } + + // Si blupi passe trop prêt du feu, aie aie aie ... + if ( IsFireCel(m_blupi[rank].cel) ) // blupi se brule les ailes ? + { + if ( m_blupi[rank].perso == 0 && + m_blupi[rank].vehicule != 3 && // pas armure ? + !m_bInvincible && + m_blupi[rank].goalAction != WM_ACTION_GRILLE ) + { + BlupiDeselect(rank); + GoalStart(rank, WM_ACTION_GRILLE, m_blupi[rank].cel); + goto goal; +//? BlupiInitAction(rank, ACTION_BRULE); +//? goto init; + } + if ( m_blupi[rank].perso == 1 || // araignée ? + m_blupi[rank].perso == 2 ) // virus ? + { + BlupiDelete(rank); // la bestiole meurt + return; + } + } + + // Si blupi passe trop prêt d'un virus ... + if ( m_blupi[rank].perso == 0 && + m_blupi[rank].vehicule != 1 && // pas en bateau ? + m_blupi[rank].vehicule != 3 && // pas armure ? + !m_blupi[rank].bMalade && // en bonne santé ? + m_blupi[rank].goalAction != WM_ACTION_GRILLE && + m_blupi[rank].goalAction != WM_ACTION_ELECTRO && + m_blupi[rank].goalAction != WM_ACTION_ELECTROm && + m_blupi[rank].goalAction != WM_ACTION_BATEAUDE && + m_blupi[rank].goalAction != WM_ACTION_BATEAUDS && + m_blupi[rank].goalAction != WM_ACTION_BATEAUDO && + m_blupi[rank].goalAction != WM_ACTION_BATEAUDN && + m_blupi[rank].goalAction != WM_ACTION_BATEAUAE && + m_blupi[rank].goalAction != WM_ACTION_BATEAUAS && + m_blupi[rank].goalAction != WM_ACTION_BATEAUAO && + m_blupi[rank].goalAction != WM_ACTION_BATEAUAN && + !m_bInvincible && + IsVirusCel(m_blupi[rank].cel) ) // blupi chope un virus ? + { + m_blupi[rank].bMalade = TRUE; + + if ( m_blupi[rank].energy > MAXENERGY/4 ) + { + m_blupi[rank].energy = MAXENERGY/4; + } + + BlupiSound(rank, SOUND_VIRUS, pos); + + if ( m_blupi[rank].vehicule == 2 ) // en jeep ? + { + GoalStart(rank, WM_ACTION_DJEEP, m_blupi[rank].cel); + goto goal; + } + } + + // Si blupi est complètement épuisé, il meurt. + if ( m_blupi[rank].perso == 0 && + m_blupi[rank].energy == 0 ) + { + BlupiDeselect(rank); + BlupiInitAction(rank, ACTION_TCHAO); + goto init; + } + + // Assigne un but s'il s'agit d'une araignée. + if ( m_blupi[rank].perso == 1 && // araignée ? + m_blupi[rank].goalAction != WM_ACTION_A_MORT ) + { + cel = m_blupi[rank].cel; + cel.x = (cel.x/2)*2; + cel.y = (cel.y/2)*2; + GetObject(cel, channel, icon); + if ( channel == CHOBJECT && + (icon == 10000 || icon == 10001) && // rayon ? + MoveIsUsed(cel) ) // enclenché ? + { + BlupiInitAction(rank, ACTION_A_GRILLE); + goto init; + } + + cel = m_blupi[rank].cel; + if ( cel.x%2 != 0 && cel.y%2 != 0 ) + { + cel.x = (cel.x/2)*2; + cel.y = (cel.y/2)*2; + GetObject(cel, channel, icon); + if ( channel == CHOBJECT && + icon == 60 ) // tomates ? + { + PutObject(cel, -1,-1); // plus de tomates + BlupiSound(rank, SOUND_A_HIHI, pos); + } + if ( channel == CHOBJECT && + icon == 92 ) // poison ? + { + PutObject(cel, -1,-1); // plus de poison + BlupiInitAction(rank, ACTION_STOP); + GoalStart(rank, WM_ACTION_A_MORT, m_blupi[rank].cel); + m_blupi[rank].goalCel = m_blupi[rank].cel; + goto goal; +//? BlupiSound(rank, SOUND_A_POISON, pos); +//? BlupiInitAction(rank, ACTION_A_POISON); +//? goto init; + } + if ( channel == CHOBJECT && + icon == 93 ) // piège ? + { + BlupiSound(rank, SOUND_PIEGE, pos); + PutObject(cel, CHOBJECT, 96); // araignée piégée + BlupiDelete(rank); // supprime araignée + return; + } + } + + m_blupi[rank].bExist = FALSE; + if ( m_time%5 == rank%5 && // pas trop souvent ! + SearchSpiderObject(rank, m_blupi[rank].cel, 100, cel, icon) ) + { + m_blupi[rank].goalCel = cel; + FlushUsed(rank); +// direct = DirectSearch(m_blupi[rank].cel, cel); +// if ( direct != -1 ) +// { +// vector = GetVector(direct); +// m_blupi[rank].goalCel.x = m_blupi[rank].cel.x + vector.x; +// m_blupi[rank].goalCel.y = m_blupi[rank].cel.y + vector.y; +// FlushUsed(rank); +// } + } + m_blupi[rank].bExist = TRUE; + } + + // Assigne un but s'il s'agit d'un virus. + if ( m_blupi[rank].perso == 2 ) // virus ? + { + cel = m_blupi[rank].cel; + cel.x = (cel.x/2)*2; + cel.y = (cel.y/2)*2; + GetObject(cel, channel, icon); + if ( channel == CHOBJECT && + (icon == 10000 || icon == 10001) && // rayon ? + MoveIsUsed(cel) ) // enclenché ? + { + BlupiInitAction(rank, ACTION_V_GRILLE); + goto init; + } + + min = 50; // ignore si trop loin ! + fRank = -1; + for ( i=0 ; i= ACTION_SAUTE2 && +//- action <= ACTION_SAUTE5) || +//- action == ACTION_GLISSE ) +//- { + BlupiInitAction(rank, action); +//- } + } + else + { + BlupiInitAction(rank, ACTION_STOP); + if ( m_blupi[rank].perso == 0 || // blupi ? + m_blupi[rank].perso == 8 ) // disciple ? + { + if ( m_blupi[rank].busyCount == 0 ) // dernière tentative ? + { + GoalStop(rank, TRUE); + m_blupi[rank].goalCel.x = -1; + m_blupi[rank].goalPhase = 0; + m_blupi[rank].interrupt = 1; + } + } + else // perso ennemi ? + { + // On cherchera un autre but ! + GoalStop(rank, TRUE); +//? m_blupi[rank].goalCel.x = -1; +//? m_blupi[rank].goalPhase = 0; +//? m_blupi[rank].interrupt = 1; + } + } + } + } + } + else + { + GoalNextPhase(rank); // méta opération suivante + } + + init: + BlupiDestCel(rank); + + m_blupi[rank].phase = 0; + m_blupi[rank].pos.x = 0; + m_blupi[rank].pos.y = 0; + + BlupiNextAction(rank); +} + +// Calcule la cellule de destination. + +void CDecor::BlupiDestCel(int rank) +{ + int a; + POINT vector; + + m_blupi[rank].destCel = m_blupi[rank].cel; + + if ( m_blupi[rank].action == ACTION_MARCHE || + m_blupi[rank].action == ACTION_MARCHEf || + m_blupi[rank].action == ACTION_MARCHEb || + m_blupi[rank].action == ACTION_MARCHEj || + m_blupi[rank].action == ACTION_MARCHEa || + m_blupi[rank].action == ACTION_A_MARCHE || + m_blupi[rank].action == ACTION_V_MARCHE || + m_blupi[rank].action == ACTION_T_MARCHE || + m_blupi[rank].action == ACTION_R_MARCHE || + m_blupi[rank].action == ACTION_B_MARCHE || + m_blupi[rank].action == ACTION_E_MARCHE || + m_blupi[rank].action == ACTION_D_MARCHE ) + { + vector = GetVector(m_blupi[rank].sDirect); + + m_blupi[rank].destCel.x += vector.x; + m_blupi[rank].destCel.y += vector.y; + } + + a = GetAmplitude(m_blupi[rank].action); + if ( a > 1 ) + { + vector = GetVector(m_blupi[rank].sDirect); + + m_blupi[rank].destCel.x += vector.x*a; + m_blupi[rank].destCel.y += vector.y*a; + } +} + +// Avance tous les blupis. + +void CDecor::BlupiStep(BOOL bFirst) +{ + int rank; + + for ( rank=0 ; rank= test.x && + pos.x <= test.x+DIMBLUPIX && + pos.y >= test.y && + pos.y <= test.y+DIMBLUPIY ) + { + rel.x = pos.x-test.x; + rel.y = pos.y-test.y; + if ( (cel.x == m_blupi[rank].cel.x && + cel.y == m_blupi[rank].cel.y ) || + (cel.x == m_blupi[rank].destCel.x && + cel.y == m_blupi[rank].destCel.y ) || + m_pPixmap->IsIconPixel(m_blupi[rank].channel, + m_blupi[rank].icon, + rel) ) + { + if ( found != -1 && + test.y < prof ) continue; + + found = rank; + prof = test.y; + } + } + } + } + + return found; +#else + int rank, found, prof; + RECT rect; + POINT cel; + + found = -1; + prof = 0; + for ( rank=0 ; rank= rect.left && + pos.x <= rect.right && + pos.y >= rect.top && + pos.y <= rect.bottom ) + { + if ( found != -1 && + rect.top < prof ) continue; + + found = rank; + prof = rect.top; + } + } + } + + if ( found != -1 ) return found; + + cel = ConvPosToCel(pos); + + for ( rank=0 ; rank 0 && + m_rankBlupiHili == rank ) // est-ce le blupi sélectionné ? + { + m_nbBlupiHili = 0; + m_rankBlupiHili = -1; + } +} + +// Met ou enlève une flèche au blupi sélectionné blupi. + +void CDecor::BlupiSetArrow(int rank, BOOL bArrow) +{ + m_celArrow.x = -1; + + if ( bArrow ) + { + m_blupi[rank].bArrow = TRUE; + } + else + { + for ( rank=0 ; rankm_p2Hili.x ? m_p1Hili.x : m_p2Hili.x; + m_celOutline2.y = m_p1Hili.y>m_p2Hili.y ? m_p1Hili.y : m_p2Hili.y; + m_celOutline1.x = (m_celOutline1.x/2)*2; + m_celOutline1.y = (m_celOutline1.y/2)*2; + m_celOutline2.x += 2; + m_celOutline2.y += 2; + } + else + { + m_celOutline1.x = -1; + m_celOutline2.x = -1; + } +} + +// Sélectionne un blupi lorsque le bouton est pressé. + +void CDecor::BlupiHiliDown(POINT pos, BOOL bAdd) +{ + if ( MapMove(pos) ) return; + + if ( !bAdd ) BlupiDeselect(); + + m_p1Hili = ConvPosToCel(pos); + m_p2Hili = ConvPosToCel(pos); + m_bHiliRect = TRUE; + m_celHili.x = -1; + + InitOutlineRect(); +} + +// Sélectionne un blupi lorsque la souris est déplacée. + +void CDecor::BlupiHiliMove(POINT pos, BOOL bAdd) +{ + if ( m_bHiliRect ) // rectangle de sélection existe ? + { + m_p2Hili = ConvPosToCel(pos); + InitOutlineRect(); + } +} + +// Sélectionne un blupi lorsque le bouton est relâché. +// Retourne FALSE si la sélection n'a pas changé ! + +void CDecor::BlupiHiliUp(POINT pos, BOOL bAdd) +{ + int rank, r, nb, sound; + BOOL bEnerve = FALSE; + POINT c1, c2; + + static int table_sound_ok[6] = + { + SOUND_OK1, + SOUND_OK2, + SOUND_OK3, + SOUND_OK4, + SOUND_OK5, + SOUND_OK6, + }; + + static int table_sound_okf[3] = // si fatigué + { + SOUND_OK1f, + SOUND_OK2f, + SOUND_OK3f, + }; + + static int table_sound_oke[3] = // si énervé + { + SOUND_OK1e, + SOUND_OK2e, + SOUND_OK3e, + }; + + if ( m_bHiliRect ) // rectangle de sélection existe ? + { + nb = 0; + + if ( m_p1Hili.x == m_p2Hili.x && + m_p1Hili.y == m_p2Hili.y ) + { + rank = GetTargetBlupi(pos); // rank <- blupi visé par la souris + if ( rank != -1 ) + { + m_blupi[rank].bHili = !m_blupi[rank].bHili; + if ( m_blupi[rank].bHili ) + { + if ( m_blupi[rank].clicDelay > 0 ) + { + m_blupi[rank].clicDelay = 80; + m_blupi[rank].clicCount ++; + if ( m_blupi[rank].clicCount > 4 ) + { + bEnerve = TRUE; + } + } + else + { + m_blupi[rank].clicDelay = 40; + } + nb = 1; + } + } + } + else + { + if ( m_p1Hili.x < m_p2Hili.x ) + { + c1.x = m_p1Hili.x; + c2.x = m_p2Hili.x+1; + } + else + { + c1.x = m_p2Hili.x; + c2.x = m_p1Hili.x+1; + } + + if ( m_p1Hili.y < m_p2Hili.y ) + { + c1.y = m_p1Hili.y; + c2.y = m_p2Hili.y+1; + } + else + { + c1.y = m_p2Hili.y; + c2.y = m_p1Hili.y+1; + } + + for ( r=0 ; r= c1.x && + m_blupi[r].cel.x < c2.x && + m_blupi[r].cel.y >= c1.y && + m_blupi[r].cel.y < c2.y ) + { + m_blupi[r].bHili = TRUE; + nb ++; + rank = r; + } + } + } + } + + m_bHiliRect = FALSE; // plus de rectangle + InitOutlineRect(); + + if ( nb > 0 ) + { + if ( nb > 1 ) // sélection multiple ? + { + sound = table_sound_ok[Random(0,5)]; + } + else + { + if ( m_blupi[rank].energy <= MAXENERGY/4 ) + { + sound = table_sound_okf[Random(0,2)]; + } + else + { + sound = table_sound_ok[Random(0,5)]; + } + if ( bEnerve ) // déjà sélectionné y'a peu ? + { + sound = table_sound_oke[Random(0,2)]; + } + } + BlupiSound(rank, sound, pos, TRUE); + } + } + + m_nbBlupiHili = 0; + m_rankBlupiHili = -1; + for ( rank=0 ; rank p4.x ) + { + rect.right = p4.x-pos.x; + } + if ( pos.x < p1.x ) + { + rect.left += p1.x-pos.x; + rect.top += (p1.x-pos.x)/2; + pos.x = p1.x; + pos.y = p1.y-1; + } + m_pPixmap->DrawPart(-1, CHHILI, pos, rect); // ligne p1-p4 + + start.x += 64; + start.y += 64/2; + } + + start.x = p3.x-shift*2; + start.y = p3.y-shift-1; + while ( start.x < p2.x ) + { + pos = start; + rect.left = 0; + rect.right = 64; + rect.top = 0; + rect.bottom = 66/2; + if ( pos.x+rect.right > p2.x ) + { + rect.right = p2.x-pos.x; + } + if ( pos.x < p3.x ) + { + rect.left += p3.x-pos.x; + rect.top += (p3.x-pos.x)/2; + pos.x = p3.x; + pos.y = p3.y-1; + } + m_pPixmap->DrawPart(-1, CHHILI, pos, rect); // ligne p3-p2 + + start.x += 64; + start.y += 64/2; + } + + start.x = p3.x-shift*2; + start.y = p3.y+shift-66/2; + while ( start.x < p1.x ) + { + pos = start; + rect.left = 0; + rect.right = 64; + rect.top = 66/2; + rect.bottom = 66; + if ( pos.x+rect.right > p1.x ) + { + rect.right = p1.x-pos.x; + } + if ( pos.x < p3.x ) + { + rect.left += p3.x-pos.x; + rect.bottom -= (p3.x-pos.x)/2; + pos.x = p3.x; + } + m_pPixmap->DrawPart(-1, CHHILI, pos, rect); // ligne p3-p1 + + start.x += 64; + start.y -= 64/2; + } + + start.x = p2.x-shift*2; + start.y = p2.y+shift-66/2; + while ( start.x < p4.x ) + { + pos = start; + rect.left = 0; + rect.right = 64; + rect.top = 66/2; + rect.bottom = 66; + if ( pos.x+rect.right > p4.x ) + { + rect.right = p4.x-pos.x; + } + if ( pos.x < p2.x ) + { + rect.left += p2.x-pos.x; + rect.bottom -= (p2.x-pos.x)/2; + pos.x = p2.x; + } + m_pPixmap->DrawPart(-1, CHHILI, pos, rect); // ligne p2-p4 + + start.x += 64; + start.y -= 64/2; + } + + m_shiftHili += 3; +} + + +// Retourne le bouton par défaut à un endroit donné. +// Est utilisé pour trouver que faire lors d'un clic +// avec le bouton de droite. + +int CDecor::GetDefButton(POINT cel) +{ + int button, rank, channel, icon; + POINT iCel; + + iCel = cel; + cel.x = (cel.x/2)*2; + cel.y = (cel.y/2)*2; + GetObject(cel, channel, icon); + + if ( m_nbBlupiHili == 0 ) return -1; + if ( m_nbBlupiHili > 1 ) return BUTTON_GO; + rank = m_rankBlupiHili; + + button = BUTTON_GO; + + if ( channel == CHOBJECT ) + { + if ( icon >= 7 && + icon <= 11 ) button = BUTTON_ABAT; + if ( icon >= 37 && + icon <= 43 ) button = BUTTON_ROC; + + if ( icon == 61 ) button = BUTTON_CULTIVE; // cabane + if ( icon == 122 ) button = BUTTON_EXTRAIT; // extrait + + if ( iCel.x%2 == 1 && iCel.y%2 == 1 ) + { + if ( icon == 14 ) button = BUTTON_CARRY; // métal + if ( icon == 36 ) button = BUTTON_CARRY; // planches + if ( icon == 44 ) button = BUTTON_CARRY; // pierres + if ( icon == 60 ) button = BUTTON_MANGE; // tomates + if ( icon == 63 ) button = BUTTON_CARRY; // oeufs + if ( icon == 80 ) button = BUTTON_BOIT; // bouteille + if ( icon == 82 ) button = BUTTON_CARRY; // fleurs + if ( icon == 84 ) button = BUTTON_CARRY; // fleurs + if ( icon == 95 ) button = BUTTON_CARRY; // fleurs + if ( icon == 85 ) button = BUTTON_CARRY; // dynamite + if ( icon == 92 ) button = BUTTON_CARRY; // poison + if ( icon == 93 ) button = BUTTON_CARRY; // piège + if ( icon == 123 ) button = BUTTON_CARRY; // fer + if ( icon == 125 ) button = BUTTON_CARRY; // mine + } + + if ( icon == 28 && // laboratoire ? + m_blupi[rank].energy > MAXENERGY/4 && + m_blupi[rank].takeChannel == CHOBJECT && + (m_blupi[rank].takeIcon == 82 || // porte fleurs ? + m_blupi[rank].takeIcon == 84 || + m_blupi[rank].takeIcon == 95 || + m_blupi[rank].takeIcon == 60) ) // porte tomates ? + { + button = BUTTON_LABO; // transforme + } + } + + if ( !m_blupi[rank].bMalade && + button == BUTTON_BOIT ) + { + button = BUTTON_CARRY; // porte la bouteille si pas malade + } + + if ( (m_blupi[rank].energy <= MAXENERGY/4 || + m_blupi[rank].takeChannel != -1 ) && + (button == BUTTON_ABAT || + button == BUTTON_CARRY || + button == BUTTON_ROC || + button == BUTTON_CULTIVE ) ) + { + return -1; + } + + if ( m_blupi[rank].energy > (MAXENERGY/4)*3 && + button == BUTTON_MANGE ) + { + button = BUTTON_CARRY; + } + + if ( m_buttonExist[button] == 0 ) // bouton existe ? + { + return -1; + } + + return button; +} + +// Indique un but visé à long terme, pour un blupi donné. + +BOOL CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) +{ + POINT goalHili, goalHili2, goal, test; + int i, action, channel, icon, error, direct, step; + BOOL bRepeat = FALSE; + + // Si plusieurs blupi sont sélectionnés, ils ne vont pas + // tous à la même destination. + if ( button == BUTTON_GO ) + { + step = 0; + for ( i=0 ; i 15 ) step = 15; + cel.x += table_multi_goal[step*2+0]; + cel.y += table_multi_goal[step*2+1]; + cMem.x += table_multi_goal[step*2+0]; + cMem.y += table_multi_goal[step*2+1]; + } + + if ( !IsCheminFree(rank, cel, button) ) return FALSE; + + goal = cel; + goalHili = cel; + goalHili2.x = (cel.x/2)*2; + goalHili2.y = (cel.y/2)*2; + + if ( button == BUTTON_GO && + m_decor[goalHili.x/2][goalHili.y/2].objectIcon == 113 ) // maison ? + { + goalHili.x = (goalHili.x/2)*2+1; + goalHili.y = (goalHili.y/2)*2+1; + } + + if ( button == BUTTON_ABATn ) + { + button = BUTTON_ABAT; + bRepeat = TRUE; + } + if ( button == BUTTON_ROCn ) + { + button = BUTTON_ROC; + bRepeat = TRUE; + } + if ( button == BUTTON_FLEURn ) + { + button = BUTTON_FLEUR; + bRepeat = TRUE; + } + action = table_actions[button]; + + if ( action == WM_ACTION_STOP ) + { + if ( m_blupi[rank].goalAction != 0 && + m_blupi[rank].interrupt <= 0 ) + { + m_blupi[rank].stop = 1; // faudra stopper + } + else + { + m_blupi[rank].goalCel = m_blupi[rank].destCel; + m_blupi[rank].goalAction = 0; + } + m_blupi[rank].repeatLevel = -1; // stoppe la répétition + return FALSE; + } + + // Action prioritaire en cours ? + if ( m_blupi[rank].goalAction != 0 && + m_blupi[rank].interrupt <= 0 ) return FALSE; + + error = CelOkForAction(goalHili, action, rank); + if ( error != 0 && error != ERROR_TOURISOL ) return FALSE; + + if ( action == WM_ACTION_GO && + m_blupi[rank].energy <= MAXENERGY/4 && + m_blupi[rank].takeChannel != -1 ) return FALSE; + + if ( action == WM_ACTION_GO ) + { + GetObject(goalHili2, channel, icon); + if ( channel == CHOBJECT && + icon == 120 && // usine ? + goalHili.x%2 == 0 && // au fond ? + goalHili.y%2 == 1 ) + { + return FALSE; // action refusée + } + if ( m_blupi[rank].perso != 8 && // pas disciple ? + channel == CHOBJECT && + icon == 118 && // jeep ? + goalHili.x%2 == 1 && // sur la jeep ? + goalHili.y%2 == 1 ) + { + action = WM_ACTION_MJEEP; + } + if ( m_blupi[rank].perso != 8 && // pas disciple ? + m_blupi[rank].takeChannel == -1 && // ne porte rien ? + channel == CHOBJECT && + icon == 16 && // armure ? + goalHili.x%2 == 1 && // sur l'armure ? + goalHili.y%2 == 1 ) + { + action = WM_ACTION_MARMURE; + } + if ( m_blupi[rank].perso != 8 && // pas disciple ? + channel == CHOBJECT && + icon == 113 ) // maison ? + { + action = WM_ACTION_MAISON; + } + GetFloor(goalHili2, channel, icon); + if ( m_blupi[rank].perso == 0 && + m_blupi[rank].vehicule == 0 && // à pied ? + m_blupi[rank].takeChannel == -1 && // ne porte rien ? + channel == CHFLOOR && + icon == 80 ) // téléporteur ? + { + if ( cel.x%2 == 0 && cel.y%2 == 0 ) + { + action = WM_ACTION_TELEPORTE00; + } + if ( cel.x%2 == 1 && cel.y%2 == 0 ) + { + action = WM_ACTION_TELEPORTE10; + } + if ( cel.x%2 == 0 && cel.y%2 == 1 ) + { + action = WM_ACTION_TELEPORTE01; + } + if ( cel.x%2 == 1 && cel.y%2 == 1 ) + { + action = WM_ACTION_TELEPORTE11; + } + } + IsFreeCelEmbarque(goalHili, rank, action, goal); + IsFreeCelDebarque(goalHili, rank, action, goal); + } + + if ( action == WM_ACTION_DEPOSE && + m_blupi[rank].energy <= MAXENERGY/4 ) + { + // Energie juste pour déposer l'objet transporté. + m_blupi[rank].energy = MAXENERGY/4+20; + } + + if ( action == WM_ACTION_ABAT1 ) + { + GetObject(goalHili2, channel, icon); + if ( channel == CHOBJECT && + icon >= 6 && icon <= 11 ) // arbre ? + { + action += icon-6; // WM_ACTION_ABAT1..6 + } + } + + if ( action == WM_ACTION_ROC1 ) + { + GetObject(goalHili2, channel, icon); + if ( channel == CHOBJECT && + icon >= 37 && icon <= 43 ) // rochers ? + { + action += icon-37; // WM_ACTION_ROC1..7 + } + } + + if ( action == WM_ACTION_FLEUR1 ) + { + GetObject(goalHili2, channel, icon); + if ( channel == CHOBJECT && + icon == 83 ) // fleurs foncées ? + { + action = WM_ACTION_FLEUR2; + } + if ( channel == CHOBJECT && + icon == 94 ) // fleurs vertes ? + { + action = WM_ACTION_FLEUR3; + } + } + + if ( action == WM_ACTION_PONTE ) + { + cel = goalHili2; + test = goalHili2; + if ( IsBuildPont(test, icon) != 0 ) return FALSE; + + m_blupi[rank].nLoop = abs((test.x-cel.x)+(test.y-cel.y))/2; + m_blupi[rank].cLoop = 0; + m_blupi[rank].vIcon = icon; + m_blupi[rank].fix = cel; + + if ( test.x-cel.x < 0 ) action = WM_ACTION_PONTO; + if ( test.y-cel.y > 0 ) action = WM_ACTION_PONTS; + if ( test.y-cel.y < 0 ) action = WM_ACTION_PONTN; + } + + if ( action == WM_ACTION_BATEAUE ) + { + if ( !IsBuildBateau(goalHili2, direct) ) return FALSE; + + if ( direct == DIRECT_S ) action = WM_ACTION_BATEAUS; + if ( direct == DIRECT_O ) action = WM_ACTION_BATEAUO; + if ( direct == DIRECT_N ) action = WM_ACTION_BATEAUN; + } + + if ( action == WM_ACTION_CARRY ) + { + if ( IsBlupiHereEx(GetCel(goalHili2,0,1), rank, TRUE) ) + { + action = WM_ACTION_CARRY2; + } + } + + if ( action == WM_ACTION_DEPOSE ) + { + GetFloor(goalHili2, channel, icon); + if ( channel == CHFLOOR && icon == 52 && // nurserie ? + m_blupi[rank].takeChannel == CHOBJECT && + m_blupi[rank].takeIcon == 63 ) // oeufs ? + { + action = WM_ACTION_NEWBLUPI; + } + if ( !IsFreeCelDepose(GetCel(goalHili2,0,1), rank) || + IsBlupiHereEx(GetCel(goalHili2,0,1), rank, TRUE) ) + { + action = WM_ACTION_DEPOSE2; + } + } + + if ( action == WM_ACTION_MANGE ) + { + if ( IsBlupiHereEx(GetCel(goalHili2,0,1), rank, TRUE) ) + { + action = WM_ACTION_MANGE2; + } + } + + if ( action == WM_ACTION_BOIT ) + { + if ( IsBlupiHereEx(GetCel(goalHili2,0,1), rank, TRUE) ) + { + action = WM_ACTION_BOIT2; + } + } + + if ( action == WM_ACTION_DYNAMITE ) + { + GetObject(goalHili2, channel, icon); + if ( channel == CHOBJECT && + icon == 125 ) // mine ? + { + action = WM_ACTION_MINE; + } + else + { + if ( m_blupi[rank].takeChannel == CHOBJECT && + m_blupi[rank].takeIcon == 85 ) // porte dynamite ? + { + action = WM_ACTION_DYNAMITE2; + } + } + } + + GoalStart(rank, action, goal); + m_blupi[rank].bRepeat = bRepeat; + m_blupi[rank].busyCount = 5; // 5 tentatives au maximum + m_blupi[rank].busyDelay = 0; + + if ( action == WM_ACTION_REPEAT ) + { + m_blupi[rank].repeatLevel = m_blupi[rank].repeatLevelHope; + m_blupi[rank].listCel[m_blupi[rank].repeatLevel] = goal; + } + else + { + ListPut(rank, button, goal, cMem); + } + + return TRUE; +} + +// Indique un but visé à long terme, pour tous les blupi +// sélectionnés. + +void CDecor::BlupiGoal(POINT cel, int button) +{ + POINT bPos, avg; + int rank, nb, nbHili; + + static int table_sound_go[6] = + { + SOUND_GO1, + SOUND_GO2, + SOUND_GO3, + SOUND_GO4, + SOUND_GO5, + SOUND_GO6, + }; + + static int table_sound_gom[3] = + { + SOUND_GO4, + SOUND_GO5, + SOUND_GO6, + }; + + static int table_sound_boing[3] = + { + SOUND_BOING1, + SOUND_BOING2, + SOUND_BOING3, + }; + + if ( button == -1 ) + { + avg = ConvCelToPos(cel); + m_pSound->PlayImage(table_sound_boing[Random(0,2)], avg); + return; + } + + avg.x = 0; + avg.y = 0; + nb = 0; + nbHili = 0; + for ( rank=0 ; rank 0 ) + { + avg.x /= nbHili; + avg.y /= nbHili; + } + if ( avg.x < 0 ) avg.x = 0; + if ( avg.x > LXIMAGE ) avg.x = LXIMAGE; + avg.y = LYIMAGE/2; + + if ( nb == 0 && nbHili > 0 ) + { + if ( nbHili == 1 ) + { + BlupiSound(m_rankBlupiHili, table_sound_boing[Random(0,2)], avg, TRUE); + } + else + { + m_pSound->PlayImage(table_sound_boing[Random(0,2)], avg); + } + } + + if ( nb > 0 ) + { + if ( nbHili == 1 ) + { + BlupiSound(m_rankBlupiHili, table_sound_go[Random(0,5)], avg, TRUE); + } + else + { + m_pSound->PlayImage(table_sound_gom[Random(0,2)], avg); + } + } +} + + +// Indique si une cellule est occupée pour un tracks. +// La cellule est considérée libre uniquement si elle +// contient un blupi à pied ou un détonnateur de mine +// (personnage invisible). + +BOOL CDecor::IsTracksHere(POINT cel, BOOL bSkipInMove) +{ + int rank; + + if ( !IsValid(cel) ) return FALSE; + + for ( rank=0 ; rank= m_blupi[rank].cel.x && + cel1.y <= m_blupi[rank].cel.y && + cel2.y >= m_blupi[rank].cel.y ) + { + m_blupiHere = rank; + return TRUE; + } + + if ( cel1.x <= m_blupi[rank].destCel.x && + cel2.x >= m_blupi[rank].destCel.x && + cel1.y <= m_blupi[rank].destCel.y && + cel2.y >= m_blupi[rank].destCel.y ) + { + m_blupiHere = rank; + return TRUE; + } + } + } + + return FALSE; +} + +// Indique si une cellule est occupée par un blupi. +// Le blupi donné dans exRank est ignoré ! + +BOOL CDecor::IsBlupiHereEx(POINT cel, int exRank, BOOL bSkipInMove) +{ + int rank; + + if ( !IsValid(cel) ) return FALSE; + + for ( rank=0 ; rank MAXENERGY/4 ) + { + pTypes[0] = 2; // bleu + } + } + + if ( m_blupi[rank].interrupt == 0 && + m_blupi[rank].jaugeMax > 0 ) + { + pLevels[1] = (m_blupi[rank].jaugePhase*100)/ + m_blupi[rank].jaugeMax; + pTypes[1] = 3; // jaune + } +} + + +// Retourne TRUE si un blupi est déjà sélectionné et qu'il +// effectue une action prioritaire. Dans ce cas, il faut tout +// de suite mettre le menu "stoppe" s'il est cliqué. + +BOOL CDecor::IsWorkBlupi(int rank) +{ + if ( m_blupi[rank].bHili && + m_blupi[m_rankBlupiHili].goalAction != 0 && + m_blupi[m_rankBlupiHili].interrupt <= 0 ) return TRUE; + + return FALSE; +} + + +// Retourne les boutons possibles à un endroit donné, +// pour le blupi sélectionné. + +void CDecor::BlupiGetButtons(POINT pos, int &nb, + int *pButtons, int *pErrors, int &perso) +{ + int* pB = pButtons; + int* pE = pErrors; + POINT cel, cel2; + int i, rank, button, error, channel, icon, textForButton; + BOOL bBuild = FALSE; + BOOL bPut; + + static int table_buttons[] = + { + BUTTON_GO, 0, + BUTTON_DJEEP, 0, + BUTTON_DARMURE, 0, + BUTTON_MANGE, 0, + BUTTON_BOIT, 0, + BUTTON_CARRY, 0, + BUTTON_DEPOSE, 0, + BUTTON_LABO, 0, + BUTTON_ABAT, 0, + BUTTON_ABATn, 0, + BUTTON_ROC, 0, + BUTTON_ROCn, 0, + BUTTON_CULTIVE, 0, + BUTTON_FLEUR, 0, + BUTTON_FLEURn, 0, + BUTTON_DYNAMITE, 0, + BUTTON_DRAPEAU, 0, + BUTTON_EXTRAIT, 0, + BUTTON_FABJEEP, 0, + BUTTON_FABMINE, 0, + BUTTON_FABDISC, 0, + BUTTON_FABARMURE, 0, + BUTTON_BUILD1, 36, // si planches (cabane) + BUTTON_BUILD2, 36, // si planches (nurserie) + BUTTON_BUILD4, 36, // si planches (mine) + BUTTON_PALIS, 36, // si planches + BUTTON_PONT, 36, // si planches + BUTTON_BATEAU, 36, // si planches + BUTTON_BUILD6, 36, // si planches (téléporteur) + BUTTON_BUILD3, 44, // si pierres (laboratoire) + BUTTON_BUILD5, 44, // si pierres (usine) + BUTTON_MUR, 44, // si pierres + BUTTON_TOUR, 44, // si pierres + BUTTON_STOP, 0, + -1 + }; + + nb = 0; + perso = 0; + + cel = ConvPosToCel(pos); + cel2 = ConvPosToCel2(pos); + + if ( m_nbBlupiHili == 0 ) return; + + if ( m_nbBlupiHili > 1 ) // sélection multiple ? + { + error = CelOkForAction(cel, table_actions[BUTTON_GO], m_rankBlupiHili); + if ( error == 0 ) + { + *pB++ = BUTTON_GO; + *pE++ = 0; + nb ++; + } + + for ( rank=0 ; rank seulement stoppe. + if ( m_blupi[m_rankBlupiHili].goalAction != 0 && + m_blupi[m_rankBlupiHili].interrupt <= 0 ) + { + if ( abs(m_blupi[m_rankBlupiHili].cel.x-cel.x) <= 3 && + abs(m_blupi[m_rankBlupiHili].cel.y-cel.y) <= 3 && + CelOkForAction(cel, table_actions[BUTTON_STOP], m_rankBlupiHili) == 0 ) + { + *pB++ = BUTTON_STOP; + *pE++ = 0; + nb ++; + } + return; + } + + // Vérifie si le blupi sélectionné peut construire. + if ( m_rankBlupiHili >= 0 ) + { + if ( m_blupi[m_rankBlupiHili].energy > MAXENERGY/4 && + m_blupi[m_rankBlupiHili].takeChannel == -1 && + m_blupi[m_rankBlupiHili].vehicule == 0 ) // à pied ? + { + bBuild = TRUE; + } + } + + // Met les différentes actions. + i = 0; + while ( table_buttons[i] != -1 ) + { + button = table_buttons[i]; + + if ( m_buttonExist[button] == 0 ) goto next; + + error = CelOkForAction(cel, table_actions[button], m_rankBlupiHili); + + if ( error == 0 ) bPut = TRUE; + else bPut = FALSE; + + if ( bBuild && + table_buttons[i+1] != 0 && // toujours présent si matière ? + (m_rankBlupiHili < 0 || + m_blupi[m_rankBlupiHili].perso != 8 || // pas disciple ? + table_buttons[i+1] != 44) ) // ni pierres ? + { + GetObject(cel2, channel, icon); + if ( channel == CHOBJECT && + icon == table_buttons[i+1] && // matière ? + cel.x%2 == 1 && cel.y%2 == 1 ) + { + bPut = TRUE; // bouton présent, mais disable ! + } + } + + if ( bPut ) + { + *pB++ = button; + *pE++ = error; + nb ++; + } + + next: + i += 2; + } + + // Si le premier bouton est "abat", ajoute "va" devant ! + if ( pButtons[0] == BUTTON_ABAT ) + { + for ( i=nb ; i>0 ; i-- ) + { + pButtons[i] = pButtons[i-1]; + pErrors[i] = pErrors[i-1]; + } + + pButtons[0] = BUTTON_GO; + pErrors[0] = ERROR_MISC; + nb ++; + } + + // Regarde s'il faut ajouter le bouton "répète". + if ( m_blupi[m_rankBlupiHili].repeatLevel != -1 || + m_blupi[m_rankBlupiHili].energy <= MAXENERGY/4 || + m_buttonExist[BUTTON_REPEAT] == 0 ) + { + return; + } + + for ( i=0 ; i 0 ) // au moins 2 actions à répéter ? + { + m_blupi[m_rankBlupiHili].repeatLevelHope = rank; + + pButtons[nb] = BUTTON_REPEAT; + pErrors[nb] = textForButton; + nb ++; + return; + } + } +} + + +// Initialise les conditions de fin. + +void CDecor::TerminatedInit() +{ + m_winCount = 50; + + m_winLastHachBlupi = 0; + m_winLastHachPlanche = 0; + m_winLastHachTomate = 0; + m_winLastHachMetal = 0; + m_winLastHachRobot = 0; + m_winLastHome = 0; + m_winLastHomeBlupi = 0; + m_winLastRobots = 0; +} + +// Vérifie si la partie est terminée. +// Retourne 0 si la partie n'est pas terminée. +// Retourne 1 si la partie est perdue. +// Retourne 2 si la partie est gagnée. + +int CDecor::IsTerminated() +{ + int nb, count, out; + POINT pos; + + pos.x = LXIMAGE/2; + pos.y = LYIMAGE/2; + + count = m_winCount; + m_winCount = 50; + + if ( m_winLastHome > m_nbStatHome ) // une maison en moins ? + { + out = 1; // perdu + goto delay; + } + m_winLastHome = m_nbStatHome; + + nb = StatisticGetBlupi(); + if ( nb < m_term.nbMinBlupi ) + { + out = 1; // perdu + goto delay; + } + if ( nb < m_term.nbMaxBlupi ) return 0; // continue + + if ( m_term.bStopFire ) + { + nb = StatisticGetFire(); + if ( nb > 0 ) return 0; // continue; + } + + if ( m_term.bHachBlupi ) + { + if ( m_winLastHachBlupi < m_nbStatHachBlupi ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + m_winLastHachBlupi = m_nbStatHachBlupi; + + if ( m_nbStatHachBlupi < m_nbStatHach*4 ) return 0; // continue; + } + + if ( m_term.bHachPlanche ) + { + if ( m_winLastHachPlanche < m_nbStatHachPlanche ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + m_winLastHachPlanche = m_nbStatHachPlanche; + + if ( m_nbStatHachPlanche < m_nbStatHach ) return 0; // continue; + } + + if ( m_term.bHachTomate ) + { + if ( m_winLastHachTomate < m_nbStatHachTomate ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + m_winLastHachTomate = m_nbStatHachTomate; + + if ( m_nbStatHachTomate < m_nbStatHach ) return 0; // continue; + } + + if ( m_term.bHachMetal ) + { + if ( m_winLastHachMetal < m_nbStatHachMetal ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + m_winLastHachMetal = m_nbStatHachMetal; + + if ( m_nbStatHachMetal < m_nbStatHach ) return 0; // continue; + } + + if ( m_term.bHachRobot ) + { + if ( m_winLastRobots > m_nbStatRobots ) + { + out = 1; // perdu + goto delay; + } + m_winLastRobots = m_nbStatRobots; + + if ( m_winLastHachRobot < m_nbStatHachRobot ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + m_winLastHachRobot = m_nbStatHachRobot; + + if ( m_nbStatHachRobot < m_nbStatHach ) return 0; // continue; + } + + if ( m_term.bHomeBlupi ) + { + if ( m_winLastHomeBlupi < m_nbStatHomeBlupi ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + m_winLastHomeBlupi = m_nbStatHomeBlupi; + + if ( m_nbStatHomeBlupi < m_nbStatHome ) return 0; // continue; + } + + if ( m_term.bKillRobots ) + { + if ( m_winLastRobots > m_nbStatRobots ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + m_winLastRobots = m_nbStatRobots; + + if ( m_nbStatRobots > 0 ) return 0; // continue; + } + + out = 2; // gagné + + delay: + m_winCount = count; + if ( m_winCount == 0 ) + { + if ( out == 1 ) // perdu ? + { + if ( !m_pSound->PlayImage(SOUND_LOST, pos) ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + } + else + { + if ( !m_pSound->PlayImage(SOUND_WIN, pos) ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + } + + return out; // perdu/gagné + } + m_winCount --; + return 0; // continue +} + +// Retourne la structure pour terminer une partie. + +Term* CDecor::GetTerminated() +{ + return &m_term; +} + diff --git a/decgoal.cpp b/decgoal.cpp new file mode 100644 index 0000000..962900f --- /dev/null +++ b/decgoal.cpp @@ -0,0 +1,3549 @@ +// DecGoal.cpp + +#include "decgoal.h" +#include "DEF.H" +#include "DECOR.H" + +short table_goal_nbop[] = +{ + 0, // term + 3, // gohili + 3, // gohili2 + 3, // goblupi + 4, // putfloor + 4, // putobject + 9, // buildfloor + 9, // buildobject + 2, // action + 1, // interrupt + 1, // energy + 3, // addmoves + 6, // other + 0, // finishmove + 2, // take + 0, // depose + 1, // group + 2, // work + 4, // testobject + 2, // fix + 6, // otherfix + 3, // addicons + 2, // newblupi + 1, // sound + 1, // repeat + 1, // otherloop + 0, // nextloop + 2, // arrangeobject + 0, // labo + 2, // cache + 0, // delete + 3, // electro + 3, // newperso + 2, // usinebuild + 2, // usinefree + 2, // explose1 + 2, // explose2 + 1, // vehicule + 4, // takeobject + 3, // floorjump + 2, // adddrapeau + 2, // amorce + 1, // malade + 2, // ifterm + 2, // ifdebarque + 0, // isnomalade + 2, // skipskill + 2, // teleporte + 0, // actualise + 2, // waitfree +}; + +// Va, mon petit. +static short table_goal_go[] = +{ + WM_ACTION_GO, + GOAL_GOHILI, 0,0, FALSE, + GOAL_TERM, + 0 +}; + +// Blupi va dans sa maison. +static short table_goal_maison[] = +{ + WM_ACTION_MAISON, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_CONTENT, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Blupi bucheron. +static short table_goal_abat1[] = +{ + WM_ACTION_ABAT1, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, 0,-1, CHOBJECT,6, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,30, -1,-1, DIMOBJY+20,1,-1*100, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,-1, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, -1,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_BUILDOBJECT, -1,0, CHOBJECT,36, -1,-1, 80/10,10,-10*100, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_OTHER, CHOBJECT,6,11,-1,-1, WM_ACTION_ABAT1, + GOAL_TERM, + 0 +}; + +static short table_goal_abat2[] = +{ + WM_ACTION_ABAT2, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, 0,-1, CHOBJECT,7, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,31, -1,-1, DIMOBJY+20,1,-1*100, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,-1, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, -1,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_BUILDOBJECT, -1,0, CHOBJECT,36, -1,-1, 80/10,10,-10*100, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_OTHER, CHOBJECT,6,11,-1,-1, WM_ACTION_ABAT1, + GOAL_TERM, + 0 +}; + +static short table_goal_abat3[] = +{ + WM_ACTION_ABAT3, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, -1,0, CHOBJECT,8, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,32, -1,-1, DIMOBJY+20,1,-1*100, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, -1,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, -1,-1, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, -1,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_BUILDOBJECT, -1,0, CHOBJECT,36, -1,-1, 80/10,10,-10*100, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_OTHER, CHOBJECT,6,11,-1,-1, WM_ACTION_ABAT1, + GOAL_TERM, + 0 +}; + +static short table_goal_abat4[] = +{ + WM_ACTION_ABAT4, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,0, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, 0,0, CHOBJECT,9, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,0, + GOAL_BUILDOBJECT, 0,0, CHOBJECT,33, -1,-1, DIMOBJY,1,-1*100, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_BUILDOBJECT, 0,0, CHOBJECT,36, -1,-1, 80/10,10,-10*100, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_OTHER, CHOBJECT,6,11,-1,-1, WM_ACTION_ABAT1, + GOAL_TERM, + 0 +}; + +static short table_goal_abat5[] = +{ + WM_ACTION_ABAT5, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,0, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, 0,0, CHOBJECT,10, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,0, + GOAL_BUILDOBJECT, 0,0, CHOBJECT,34, -1,-1, DIMOBJY,1,-1*100, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_BUILDOBJECT, 0,0, CHOBJECT,36, -1,-1, 80/10,10,-10*100, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_OTHER, CHOBJECT,6,11,-1,-1, WM_ACTION_ABAT1, + GOAL_TERM, + 0 +}; + +static short table_goal_abat6[] = +{ + WM_ACTION_ABAT6, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,0, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, 0,0, CHOBJECT,11, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,0, + GOAL_BUILDOBJECT, 0,0, CHOBJECT,35, -1,-1, DIMOBJY,1,-1*100, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ADDMOVES, 0,0, 1, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + + GOAL_BUILDOBJECT, 0,0, CHOBJECT,36, -1,-1, 80/10,10,-10*100, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_OTHER, CHOBJECT,6,11,-1,-1, WM_ACTION_ABAT1, + GOAL_TERM, + 0 +}; + +// Blupi tailleur de pierre. +static short table_goal_roc1[] = +{ + WM_ACTION_ROC1, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,38, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,39, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,40, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,41, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,42, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,43, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,44, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,37,43,-1,-1, WM_ACTION_ROC1, + GOAL_TERM, + 0 +}; + +static short table_goal_roc2[] = +{ + WM_ACTION_ROC2, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,39, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,40, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,41, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,42, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,43, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,44, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,37,43,-1,-1, WM_ACTION_ROC1, + GOAL_TERM, + 0 +}; + +static short table_goal_roc3[] = +{ + WM_ACTION_ROC3, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,40, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,41, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,42, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,43, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,44, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,37,43,-1,-1, WM_ACTION_ROC1, + GOAL_TERM, + 0 +}; + +static short table_goal_roc4[] = +{ + WM_ACTION_ROC4, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,41, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,42, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,43, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,44, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,37,43,-1,-1, WM_ACTION_ROC1, + GOAL_TERM, + 0 +}; + +static short table_goal_roc5[] = +{ + WM_ACTION_ROC5, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,42, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,43, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,44, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,37,43,-1,-1, WM_ACTION_ROC1, + GOAL_TERM, + 0 +}; + +static short table_goal_roc6[] = +{ + WM_ACTION_ROC6, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,43, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,44, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,37,43,-1,-1, WM_ACTION_ROC1, + GOAL_TERM, + 0 +}; + +static short table_goal_roc7[] = +{ + WM_ACTION_ROC7, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, TRUE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,44, -1,-1, 120/10,10,-10*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,37,43,-1,-1, WM_ACTION_ROC1, + GOAL_TERM, + 0 +}; + +// Construction d'une cabane. +static short table_goal_build1[] = +{ + WM_ACTION_BUILD1, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDFLOOR, 0,-1, CHFLOOR,16, CHMASK1,0, 16,14,1*100, // briques + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, +//? GOAL_ENERGY, MAXENERGY/4, + // échaffaudage + GOAL_BUILDOBJECT, -1,0, CHOBJECT,62, -1,-1, DIMOBJY/10,18,10*100, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,+1, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-2, TRUE, + GOAL_GOBLUPI, -2,0, TRUE, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, +2,0, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + // maison + GOAL_BUILDOBJECT, -2,0, CHOBJECT,61, -1,-1, DIMOBJY/10,20,10*100, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Construction d'une nurserie. +static short table_goal_build2[] = +{ + WM_ACTION_BUILD2, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDFLOOR, 0,-1, CHFLOOR,52, CHMASK1,0, 16,14,1*100, // nurserie + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_PUTOBJECT, -1,0, -1,-1, // enlève les planches + GOAL_GOBLUPI, -1,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,+1, TRUE, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Construction d'un laboratoire. +static short table_goal_build3[] = +{ + WM_ACTION_BUILD3, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDFLOOR, 0,-1, CHFLOOR,16, CHMASK1,0, 16,14,1*100, // briques + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_GOBLUPI, +1,0, TRUE, + // laboratoire + GOAL_BUILDOBJECT, -1,0, CHOBJECT,28, -1,-1, DIMOBJY/10,20,10*100, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Construction d'une mine. +static short table_goal_build4[] = +{ + WM_ACTION_BUILD4, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 2, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + // échaffaudage + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,126, -1,-1, DIMOBJY/10,18,10*100, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-2, TRUE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + // mine + GOAL_BUILDOBJECT, -2,0, CHOBJECT,122, -1,-1, DIMOBJY/10,20,10*100, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Construction d'une usine. +static short table_goal_build5[] = +{ + WM_ACTION_BUILD5, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDFLOOR, 0,-1, CHFLOOR,16, CHMASK1,0, 16,14,1*100, // briques + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_GOBLUPI, +1,0, TRUE, + // usine + GOAL_BUILDOBJECT, -1,0, CHOBJECT,120, -1,-1, DIMOBJY/10,20,10*100, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSOURD, DIRECT_O, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Construction d'un téléporteur. +static short table_goal_build6[] = +{ + WM_ACTION_BUILD6, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDFLOOR, 0,-1, CHFLOOR,80, CHMASK1,0, 16,14,1*100, // téléporteur + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_PUTOBJECT, -1,0, -1,-1, // enlève les planches + GOAL_GOBLUPI, -1,+1, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_BUILDSEC, DIRECT_S, + GOAL_GOBLUPI, +1,+1, TRUE, + GOAL_FINISHMOVE, + GOAL_GOBLUPI, 0,-2, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_S, + GOAL_TERM, + 0 +}; + +// Construction d'un mur. +static short table_goal_mur[] = +{ + WM_ACTION_MUR, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,26, -1,-1, DIMOBJY/5,40,5*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_PUTOBJECT, 0,0, -1,-1, // enlève les pierres + GOAL_GOBLUPI, +1,+1, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_S, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_TCHAO, DIRECT_E, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Construction d'une tour. +static short table_goal_tour[] = +{ + WM_ACTION_TOUR, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,27, -1,-1, DIMOBJY/4,20,4*100, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_PUTOBJECT, -1,0, -1,-1, // enlève les pierres + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_PIOCHEPIERRE, DIRECT_E, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_BUILDBREF, DIRECT_O, + GOAL_ACTION, ACTION_STOP, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_ARRANGEOBJECT, -1,-1, + GOAL_ACTION, ACTION_TCHAO, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Construction d'une palissade. +static short table_goal_palis[] = +{ + WM_ACTION_PALIS, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,71, -1,-1, DIMOBJY/10,20,10*100, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_PIOCHE, DIRECT_E, + GOAL_PUTOBJECT, 0,0, -1,-1, // enlève les planches + GOAL_GOBLUPI, +1,+1, TRUE, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Transporte (est). +static short table_goal_carry[] = +{ + WM_ACTION_CARRY, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 4, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, -2,-2, -1,-1, 9+18,1,1*100, + GOAL_ADDMOVES, 0,-1, 2, + GOAL_ACTION, ACTION_TAKE, DIRECT_E, + GOAL_TAKE, 0,-1, + GOAL_TERM, + 0 +}; + +// Transporte (sud). +static short table_goal_carry2[] = +{ + WM_ACTION_CARRY2, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_S, + GOAL_GROUP, 4, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, -2,-2, -1,-1, 9+18,1,1*100, + GOAL_ADDMOVES, -1,0, 3, + GOAL_ACTION, ACTION_TAKE, DIRECT_S, + GOAL_TAKE, -1,0, + GOAL_TERM, + 0 +}; + +// Repose (est). +static short table_goal_depose[] = +{ + WM_ACTION_DEPOSE, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 6, + GOAL_IFTERM, +1,0, // emplacement libre ? + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_PUTOBJECT, 0,-1, -3,-3, // l'objet transporté + GOAL_BUILDOBJECT, 0,-1, -2,-2, -1,-1, 11,1,1*100, + GOAL_ADDMOVES, 0,-1, 4, + GOAL_DEPOSE, + GOAL_ACTION, ACTION_DEPOSE, DIRECT_E, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Repose (sud). +static short table_goal_depose2[] = +{ + WM_ACTION_DEPOSE2, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_S, + GOAL_GROUP, 6, + GOAL_IFTERM, 0,+1, // emplacement libre ? + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_PUTOBJECT, -1,0, -3,-3, // l'objet transporté + GOAL_BUILDOBJECT, -1,0, -2,-2, -1,-1, 11,1,1*100, + GOAL_ADDMOVES, -1,0, 5, + GOAL_DEPOSE, + GOAL_ACTION, ACTION_DEPOSE, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Repose des oeufs sur la nurserie. +static short table_goal_newblupi[] = +{ + WM_ACTION_NEWBLUPI, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 5, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_PUTOBJECT, 0,-1, -3,-3, // l'objet transporté + GOAL_BUILDOBJECT, 0,-1, -2,-2, -1,-1, 11,1,1*100, + GOAL_ADDMOVES, 0,-1, 4, + GOAL_DEPOSE, + GOAL_ACTION, ACTION_DEPOSE, DIRECT_E, + GOAL_FINISHMOVE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_GROUP, 3, + GOAL_PUTOBJECT, +1,-1, CHOBJECT,64, // 4 oeufs + GOAL_BUILDFLOOR, +1,-1, CHFLOOR,-1, -1,-1, 100,1,1*100, + GOAL_ADDICONS, +1,-1, 3, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_FINISHMOVE, + GOAL_NEWBLUPI, +1,-1, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_TERM, + 0 +}; + +// Cultive des tomates. +static short table_goal_cultive[] = +{ + WM_ACTION_CULTIVE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +2,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_FIX, -2,0, + GOAL_REPEAT, TRUE, + GOAL_OTHERFIX, CHFLOOR,1,1,19,32, WM_ACTION_CULTIVE2, + GOAL_TERM, + 0 +}; + +static short table_goal_cultive2[] = +{ + WM_ACTION_CULTIVE2, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDFLOOR, -1,-1, CHFLOOR,57, CHMASK1,0, 16,6,1*100, // terre + GOAL_ACTION, ACTION_BECHE, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_BECHE, DIRECT_E, + GOAL_FINISHMOVE, + + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,57, -1,-1, DIMOBJY,1,1*100, + GOAL_ACTION, ACTION_ARROSE, DIRECT_E, + GOAL_ACTION, ACTION_ARROSE, DIRECT_E, + GOAL_FINISHMOVE, + + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,58, -1,-1, DIMOBJY,1,1*100, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_ARROSE, DIRECT_E, + GOAL_ACTION, ACTION_ARROSE, DIRECT_E, + GOAL_FINISHMOVE, + + GOAL_BUILDOBJECT, 0,0, CHOBJECT,59, -1,-1, DIMOBJY,1,1*100, + GOAL_ACTION, ACTION_BECHE, DIRECT_E, + GOAL_ACTION, ACTION_BECHE, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_FINISHMOVE, + + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,60, -1,-1, DIMOBJY,1,-1*100, + GOAL_ACTION, ACTION_ARROSE, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_ARROSE, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_FINISHMOVE, + + GOAL_BUILDFLOOR, 0,-1, CHFLOOR,1, CHMASK1,0, 16,1,1*100, // herbe + GOAL_FINISHMOVE, + + GOAL_OTHERFIX, CHFLOOR,1,1,19,32, WM_ACTION_CULTIVE2, + GOAL_TERM, + 0 +}; + +// Bouffe des tomates (est). +static short table_goal_mange[] = +{ + WM_ACTION_MANGE, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, 0,-1, CHOBJECT,60, // tomates ? + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, -1,-1, -1,-1, DIMOBJY,1,-1*100, + GOAL_ACTION, ACTION_MANGE, DIRECT_E, + GOAL_ACTION, ACTION_MANGE, DIRECT_E, + GOAL_ACTION, ACTION_MANGE, DIRECT_E, + + GOAL_GROUP, 2, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, 0,-1, -1,-1, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Bouffe des tomates (sud). +static short table_goal_mange2[] = +{ + WM_ACTION_MANGE2, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_S, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, -1,0, CHOBJECT,60, // tomates ? + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, -1,-1, -1,-1, DIMOBJY,1,-1*100, + GOAL_ACTION, ACTION_MANGE, DIRECT_E, + GOAL_ACTION, ACTION_MANGE, DIRECT_E, + GOAL_ACTION, ACTION_MANGE, DIRECT_E, + + GOAL_GROUP, 2, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -1,0, -1,-1, + GOAL_ACTION, ACTION_STOP, DIRECT_S, + GOAL_TERM, + 0 +}; + +// Boit à la bouteille (est). +static short table_goal_boit[] = +{ + WM_ACTION_BOIT, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 5, + GOAL_TESTOBJECT, 0,-1, CHOBJECT,80, // bouteille ? + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_PUTOBJECT, 0,-1, -1,-1, + GOAL_ACTION, ACTION_BOIT, DIRECT_E, + GOAL_ACTION, ACTION_BOIT, DIRECT_E, + GOAL_ACTION, ACTION_BOIT, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Boit à la bouteille (sud). +static short table_goal_boit2[] = +{ + WM_ACTION_BOIT2, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_S, + GOAL_GROUP, 5, + GOAL_TESTOBJECT, -1,0, CHOBJECT,80, // bouteille ? + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_PUTOBJECT, -1,0, -1,-1, + GOAL_ACTION, ACTION_BOIT, DIRECT_E, + GOAL_ACTION, ACTION_BOIT, DIRECT_E, + GOAL_ACTION, ACTION_BOIT, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_S, + GOAL_TERM, + 0 +}; + +// Cueille des fleurs. +static short table_goal_fleur1[] = +{ + WM_ACTION_FLEUR1, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, TRUE, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, 0,-1, CHOBJECT,81, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,82, -1,-1, DIMOBJY+20,1,-1*100, + GOAL_SOUND, SOUND_FLEUR, + GOAL_ACTION, ACTION_CUEILLE1, DIRECT_E, + GOAL_ACTION, ACTION_CUEILLE1, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_SOUND, SOUND_FLEUR, + GOAL_ACTION, ACTION_CUEILLE1, DIRECT_S, + GOAL_ACTION, ACTION_CUEILLE1, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_SOUND, SOUND_FLEUR, + GOAL_ACTION, ACTION_CUEILLE1, DIRECT_S, + GOAL_ACTION, ACTION_CUEILLE1, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,81,81,-1,-1, WM_ACTION_FLEUR1, + GOAL_TERM, + 0 +}; + +// Cueille des fleurs. +static short table_goal_fleur2[] = +{ + WM_ACTION_FLEUR2, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, TRUE, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, 0,-1, CHOBJECT,83, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,84, -1,-1, DIMOBJY+20,1,-1*100, + GOAL_SOUND, SOUND_FLEUR, + GOAL_ACTION, ACTION_CUEILLE2, DIRECT_E, + GOAL_ACTION, ACTION_CUEILLE2, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_SOUND, SOUND_FLEUR, + GOAL_ACTION, ACTION_CUEILLE2, DIRECT_S, + GOAL_ACTION, ACTION_CUEILLE2, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_SOUND, SOUND_FLEUR, + GOAL_ACTION, ACTION_CUEILLE2, DIRECT_S, + GOAL_ACTION, ACTION_CUEILLE2, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,83,83,-1,-1, WM_ACTION_FLEUR2, + GOAL_TERM, + 0 +}; + +// Cueille des fleurs. +static short table_goal_fleur3[] = +{ + WM_ACTION_FLEUR3, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, TRUE, + GOAL_GROUP, 4, + GOAL_TESTOBJECT, 0,-1, CHOBJECT,94, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,95, -1,-1, DIMOBJY+20,1,-1*100, + GOAL_SOUND, SOUND_FLEUR, + GOAL_ACTION, ACTION_CUEILLE3, DIRECT_E, + GOAL_ACTION, ACTION_CUEILLE3, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_SOUND, SOUND_FLEUR, + GOAL_ACTION, ACTION_CUEILLE3, DIRECT_S, + GOAL_ACTION, ACTION_CUEILLE3, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_SOUND, SOUND_FLEUR, + GOAL_ACTION, ACTION_CUEILLE3, DIRECT_S, + GOAL_ACTION, ACTION_CUEILLE3, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_OTHER, CHOBJECT,94,94,-1,-1, WM_ACTION_FLEUR3, + GOAL_TERM, + 0 +}; + +// Transforme des fleurs. +static short table_goal_labo[] = +{ + WM_ACTION_LABO, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 6, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,29, // ferme la porte + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,29, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,-1, 10, // secoue + GOAL_CACHE, TRUE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_O, + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 4, + GOAL_LABO, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,28, // ouvre la porte + GOAL_CACHE, FALSE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_IFTERM, 0,-1, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Blupi fait péter la dynamite. +static short table_goal_dynamite[] = +{ + WM_ACTION_DYNAMITE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 5, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_PUTOBJECT, 0,-1, -1,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,-1, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDICONS, 0,-1, 7, // mèche + GOAL_ACTION, ACTION_MECHE, DIRECT_E, + GOAL_SOUND, SOUND_DYNAMITE, + GOAL_GROUP, 4, + GOAL_PUTOBJECT, 0,-1, -1,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,-1, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDICONS, 0,-1, 6, // explosion + GOAL_CACHE, TRUE, TRUE, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 4+4, + GOAL_EXPLOSE1, 0,-3, + GOAL_EXPLOSE1, -2,-1, + GOAL_EXPLOSE1, +2,-1, + GOAL_EXPLOSE1, 0,+1, + GOAL_EXPLOSE2, 0,-3, + GOAL_EXPLOSE2, -2,-1, + GOAL_EXPLOSE2, +2,-1, + GOAL_EXPLOSE2, 0,+1, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 4+4, + GOAL_EXPLOSE1, -2,-3, + GOAL_EXPLOSE1, +2,-3, + GOAL_EXPLOSE1, -2,+1, + GOAL_EXPLOSE1, +2,+1, + GOAL_EXPLOSE2, -2,-3, + GOAL_EXPLOSE2, +2,-3, + GOAL_EXPLOSE2, -2,+1, + GOAL_EXPLOSE2, +2,+1, + GOAL_ACTION, ACTION_DYNAMITE, DIRECT_E, + GOAL_GROUP, 3, + GOAL_FINISHMOVE, + GOAL_CACHE, FALSE, TRUE, + GOAL_DELETE, // blupi meurt brutalement + GOAL_TERM, + 0 +}; + +// Blupi fait péter la dynamite très fort. +static short table_goal_dynamite2[] = +{ + WM_ACTION_DYNAMITE2, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, +//? GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 5, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_PUTOBJECT, 0,-1, -1,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,-1, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDICONS, 0,-1, 7, // mèche + GOAL_ACTION, ACTION_MECHE, DIRECT_E, + GOAL_SOUND, SOUND_DYNAMITE, + GOAL_GROUP, 5, + GOAL_PUTOBJECT, 0,-1, -1,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,-1, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDICONS, 0,-1, 6, // explosion + GOAL_CACHE, TRUE, TRUE, + GOAL_DEPOSE, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 4+4, + GOAL_EXPLOSE1, 0,-3, + GOAL_EXPLOSE1, -2,-1, + GOAL_EXPLOSE1, +2,-1, + GOAL_EXPLOSE1, 0,+1, + GOAL_EXPLOSE2, 0,-3, + GOAL_EXPLOSE2, -2,-1, + GOAL_EXPLOSE2, +2,-1, + GOAL_EXPLOSE2, 0,+1, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 4+4, + GOAL_EXPLOSE1, -2,-3, + GOAL_EXPLOSE1, +2,-3, + GOAL_EXPLOSE1, -2,+1, + GOAL_EXPLOSE1, +2,+1, + GOAL_EXPLOSE2, -2,-3, + GOAL_EXPLOSE2, +2,-3, + GOAL_EXPLOSE2, -2,+1, + GOAL_EXPLOSE2, +2,+1, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 12+12, + GOAL_EXPLOSE1, -4,-3, + GOAL_EXPLOSE1, -4,-1, + GOAL_EXPLOSE1, -4,+1, + GOAL_EXPLOSE1, -2,-5, + GOAL_EXPLOSE1, -2,+3, + GOAL_EXPLOSE1, 0,-5, + GOAL_EXPLOSE1, 0,+3, + GOAL_EXPLOSE1, +2,-5, + GOAL_EXPLOSE1, +2,+3, + GOAL_EXPLOSE1, +4,-3, + GOAL_EXPLOSE1, +4,-1, + GOAL_EXPLOSE1, +4,+1, + GOAL_EXPLOSE2, -4,-3, + GOAL_EXPLOSE2, -4,-1, + GOAL_EXPLOSE2, -4,+1, + GOAL_EXPLOSE2, -2,-5, + GOAL_EXPLOSE2, -2,+3, + GOAL_EXPLOSE2, 0,-5, + GOAL_EXPLOSE2, 0,+3, + GOAL_EXPLOSE2, +2,-5, + GOAL_EXPLOSE2, +2,+3, + GOAL_EXPLOSE2, +4,-3, + GOAL_EXPLOSE2, +4,-1, + GOAL_EXPLOSE2, +4,+1, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 16+16, + GOAL_EXPLOSE1, -6,-3, + GOAL_EXPLOSE1, -6,-1, + GOAL_EXPLOSE1, -6,+1, + GOAL_EXPLOSE1, -4,-5, + GOAL_EXPLOSE1, -4,+3, + GOAL_EXPLOSE1, -2,-7, + GOAL_EXPLOSE1, -2,+5, + GOAL_EXPLOSE1, 0,-7, + GOAL_EXPLOSE1, 0,+5, + GOAL_EXPLOSE1, +2,-7, + GOAL_EXPLOSE1, +2,+5, + GOAL_EXPLOSE1, +4,-5, + GOAL_EXPLOSE1, +4,+3, + GOAL_EXPLOSE1, +6,-3, + GOAL_EXPLOSE1, +6,-1, + GOAL_EXPLOSE1, +6,+1, + GOAL_EXPLOSE2, -6,-3, + GOAL_EXPLOSE2, -6,-1, + GOAL_EXPLOSE2, -6,+1, + GOAL_EXPLOSE2, -4,-5, + GOAL_EXPLOSE2, -4,+3, + GOAL_EXPLOSE2, -2,-7, + GOAL_EXPLOSE2, -2,+5, + GOAL_EXPLOSE2, 0,-7, + GOAL_EXPLOSE2, 0,+5, + GOAL_EXPLOSE2, +2,-7, + GOAL_EXPLOSE2, +2,+5, + GOAL_EXPLOSE2, +4,-5, + GOAL_EXPLOSE2, +4,+3, + GOAL_EXPLOSE2, +6,-3, + GOAL_EXPLOSE2, +6,-1, + GOAL_EXPLOSE2, +6,+1, + GOAL_ACTION, ACTION_DYNAMITE, DIRECT_E, + GOAL_GROUP, 3, + GOAL_FINISHMOVE, + GOAL_CACHE, FALSE, TRUE, + GOAL_DELETE, // blupi meurt brutalement + GOAL_TERM, + 0 +}; + +// Tracks fait péter la dynamite. +static short table_goal_t_dynamite[] = +{ + WM_ACTION_T_DYNAMITE, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_SOUND, SOUND_DYNAMITE, + GOAL_GROUP, 6, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_PUTOBJECT, -1,-1, -1,-1, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,-1, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDICONS, -1,-1, 6, // explosion + GOAL_CACHE, TRUE, FALSE, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 4+4, + GOAL_EXPLOSE1, -1,-3, + GOAL_EXPLOSE1, -3,-1, + GOAL_EXPLOSE1, +1,-1, + GOAL_EXPLOSE1, -1,+1, + GOAL_EXPLOSE2, -1,-3, + GOAL_EXPLOSE2, -3,-1, + GOAL_EXPLOSE2, +1,-1, + GOAL_EXPLOSE2, -1,+1, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 4+4, + GOAL_EXPLOSE1, -3,-3, + GOAL_EXPLOSE1, +1,-3, + GOAL_EXPLOSE1, -3,+1, + GOAL_EXPLOSE1, +1,+1, + GOAL_EXPLOSE2, -3,-3, + GOAL_EXPLOSE2, +1,-3, + GOAL_EXPLOSE2, -3,+1, + GOAL_EXPLOSE2, +1,+1, + GOAL_ACTION, ACTION_DYNAMITE, DIRECT_E, + GOAL_GROUP, 3, + GOAL_FINISHMOVE, + GOAL_CACHE, FALSE, FALSE, + GOAL_DELETE, // tracks meurt brutalement + GOAL_TERM, + 0 +}; + +// Blupi amorce une mine. +static short table_goal_mine[] = +{ + WM_ACTION_MINE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_TESTOBJECT, 0,-1, CHOBJECT,125, // mine ? + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_ACTION, ACTION_MECHE, DIRECT_E, + GOAL_GROUP, 2, + GOAL_TESTOBJECT, 0,-1, CHOBJECT,125, // mine ? + GOAL_AMORCE, +1,0, + GOAL_TERM, + 0 +}; + +// Détonnateur de mine créé par GOAL_AMORCE (blupi invisible). +static short table_goal_mine2[] = +{ + WM_ACTION_MINE2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,127, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+10, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,125, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+9, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,127, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+8, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,125, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+7, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,127, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+6, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,125, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+5, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,127, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+4, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,125, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+3, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,127, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+2, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,125, + GOAL_BUILDOBJECT, -1,-1, -1,MOVEICONNB+1, -1,-1, 100,1,-1*100, + GOAL_SOUND, SOUND_CLICK, + GOAL_ACTION, ACTION_D_DELAY, DIRECT_E, + + GOAL_SOUND, SOUND_DYNAMITE, + GOAL_GROUP, 4, + GOAL_PUTOBJECT, -1,-1, -1,-1, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,-1, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDICONS, -1,-1, 6, // explosion + GOAL_CACHE, TRUE, FALSE, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 4+4, + GOAL_EXPLOSE1, -1,-3, + GOAL_EXPLOSE1, -3,-1, + GOAL_EXPLOSE1, +1,-1, + GOAL_EXPLOSE1, -1,+1, + GOAL_EXPLOSE2, -1,-3, + GOAL_EXPLOSE2, -3,-1, + GOAL_EXPLOSE2, +1,-1, + GOAL_EXPLOSE2, -1,+1, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 4+4, + GOAL_EXPLOSE1, -3,-3, + GOAL_EXPLOSE1, +1,-3, + GOAL_EXPLOSE1, -3,+1, + GOAL_EXPLOSE1, +1,+1, + GOAL_EXPLOSE2, -3,-3, + GOAL_EXPLOSE2, +1,-3, + GOAL_EXPLOSE2, -3,+1, + GOAL_EXPLOSE2, +1,+1, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 12+12, + GOAL_EXPLOSE1, -5,-3, + GOAL_EXPLOSE1, -5,-1, + GOAL_EXPLOSE1, -5,+1, + GOAL_EXPLOSE1, -3,-5, + GOAL_EXPLOSE1, -3,+3, + GOAL_EXPLOSE1, -1,-5, + GOAL_EXPLOSE1, -1,+3, + GOAL_EXPLOSE1, +1,-5, + GOAL_EXPLOSE1, +1,+3, + GOAL_EXPLOSE1, +3,-3, + GOAL_EXPLOSE1, +3,-1, + GOAL_EXPLOSE1, +3,+1, + GOAL_EXPLOSE2, -5,-3, + GOAL_EXPLOSE2, -5,-1, + GOAL_EXPLOSE2, -5,+1, + GOAL_EXPLOSE2, -3,-5, + GOAL_EXPLOSE2, -3,+3, + GOAL_EXPLOSE2, -1,-5, + GOAL_EXPLOSE2, -1,+3, + GOAL_EXPLOSE2, +1,-5, + GOAL_EXPLOSE2, +1,+3, + GOAL_EXPLOSE2, +3,-3, + GOAL_EXPLOSE2, +3,-1, + GOAL_EXPLOSE2, +3,+1, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_DELAY, DIRECT_E, + GOAL_GROUP, 16+16, + GOAL_EXPLOSE1, -7,-3, + GOAL_EXPLOSE1, -7,-1, + GOAL_EXPLOSE1, -7,+1, + GOAL_EXPLOSE1, -5,-5, + GOAL_EXPLOSE1, -5,+3, + GOAL_EXPLOSE1, -3,-7, + GOAL_EXPLOSE1, -3,+5, + GOAL_EXPLOSE1, -1,-7, + GOAL_EXPLOSE1, -1,+5, + GOAL_EXPLOSE1, +1,-7, + GOAL_EXPLOSE1, +1,+5, + GOAL_EXPLOSE1, +3,-5, + GOAL_EXPLOSE1, +3,+3, + GOAL_EXPLOSE1, +5,-3, + GOAL_EXPLOSE1, +5,-1, + GOAL_EXPLOSE1, +5,+1, + GOAL_EXPLOSE2, -7,-3, + GOAL_EXPLOSE2, -7,-1, + GOAL_EXPLOSE2, -7,+1, + GOAL_EXPLOSE2, -5,-5, + GOAL_EXPLOSE2, -5,+3, + GOAL_EXPLOSE2, -3,-7, + GOAL_EXPLOSE2, -3,+5, + GOAL_EXPLOSE2, -1,-7, + GOAL_EXPLOSE2, -1,+5, + GOAL_EXPLOSE2, +1,-7, + GOAL_EXPLOSE2, +1,+5, + GOAL_EXPLOSE2, +3,-5, + GOAL_EXPLOSE2, +3,+3, + GOAL_EXPLOSE2, +5,-3, + GOAL_EXPLOSE2, +5,-1, + GOAL_EXPLOSE2, +5,+1, + GOAL_ACTION, ACTION_DYNAMITE, DIRECT_E, + GOAL_GROUP, 3, + GOAL_FINISHMOVE, + GOAL_CACHE, FALSE, FALSE, + GOAL_DELETE, // blupi meurt brutalement + GOAL_TERM, + 0 +}; + +// Construit un pont en direction de l'est. +static short table_goal_ponte[] = +{ + WM_ACTION_PONTE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,72, -1,-1, DIMOBJY/10,12,-10*100, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, -1,+1, TRUE, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_OTHERLOOP, WM_ACTION_PONTEL, + GOAL_TERM, + 0 +}; + +static short table_goal_pontel[] = +{ + WM_ACTION_PONTEL, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_BUILDOBJECT, -10,-10, CHOBJECT,72, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -10,-10, 6, // pont vers l'est + GOAL_ACTION, ACTION_PONT, DIRECT_E, + GOAL_GROUP, 4, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -10,-10, -1,-1, + GOAL_NEXTLOOP, + GOAL_PUTOBJECT, -10,-10, CHOBJECT,72, + GOAL_OTHERLOOP, WM_ACTION_PONTEL, + + GOAL_GROUP, 3, + GOAL_PUTOBJECT, -10,-10, -1,-1, + GOAL_PUTFLOOR, -10,-10, CHFLOOR,-2, // vIcon + GOAL_SOUND, SOUND_PLOUF, +//? GOAL_ACTION, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Construit un pont en direction de l'ouest. +static short table_goal_ponto[] = +{ + WM_ACTION_PONTO, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,72, -1,-1, DIMOBJY/10,12,-10*100, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, -1,+1, TRUE, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_OTHERLOOP, WM_ACTION_PONTOL, + GOAL_TERM, + 0 +}; + +static short table_goal_pontol[] = +{ + WM_ACTION_PONTOL, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_BUILDOBJECT, -10,-10, CHOBJECT,72, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -10,-10, 7, // pont vers l'ouest + GOAL_ACTION, ACTION_PONT, DIRECT_O, + GOAL_GROUP, 4, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -10,-10, -1,-1, + GOAL_NEXTLOOP, + GOAL_PUTOBJECT, -10,-10, CHOBJECT,72, + GOAL_OTHERLOOP, WM_ACTION_PONTOL, + + GOAL_GROUP, 3, + GOAL_PUTOBJECT, -10,-10, -1,-1, + GOAL_PUTFLOOR, -10,-10, CHFLOOR,-2, // vIcon + GOAL_SOUND, SOUND_PLOUF, +//? GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_O, + GOAL_TERM, + 0 +}; + +// Construit un pont en direction du sud. +static short table_goal_ponts[] = +{ + WM_ACTION_PONTS, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,73, -1,-1, DIMOBJY/10,12,-10*100, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_OTHERLOOP, WM_ACTION_PONTSL, + GOAL_TERM, + 0 +}; + +static short table_goal_pontsl[] = +{ + WM_ACTION_PONTSL, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_BUILDOBJECT, -10,-10, CHOBJECT,73, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -10,-10, 8, // pont vers le sud + GOAL_ACTION, ACTION_PONT, DIRECT_S, + GOAL_GROUP, 4, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -10,-10, -1,-1, + GOAL_NEXTLOOP, + GOAL_PUTOBJECT, -10,-10, CHOBJECT,73, + GOAL_OTHERLOOP, WM_ACTION_PONTSL, + + GOAL_GROUP, 3, + GOAL_PUTOBJECT, -10,-10, -1,-1, + GOAL_PUTFLOOR, -10,-10, CHFLOOR,-2, // vIcon + GOAL_SOUND, SOUND_PLOUF, +//? GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_S, + GOAL_TERM, + 0 +}; + +// Construit un pont en direction du nord. +static short table_goal_pontn[] = +{ + WM_ACTION_PONTN, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,73, -1,-1, DIMOBJY/10,12,-10*100, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_OTHERLOOP, WM_ACTION_PONTNL, + GOAL_TERM, + 0 +}; + +static short table_goal_pontnl[] = +{ + WM_ACTION_PONTNL, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_BUILDOBJECT, -10,-10, CHOBJECT,73, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -10,-10, 9, // pont vers le nord + GOAL_ACTION, ACTION_PONT, DIRECT_N, + GOAL_GROUP, 4, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -10,-10, -1,-1, + GOAL_NEXTLOOP, + GOAL_PUTOBJECT, -10,-10, CHOBJECT,73, + GOAL_OTHERLOOP, WM_ACTION_PONTNL, + + GOAL_GROUP, 3, + GOAL_PUTOBJECT, -10,-10, -1,-1, + GOAL_PUTFLOOR, -10,-10, CHFLOOR,-2, // vIcon + GOAL_SOUND, SOUND_PLOUF, +//? GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_TERM, + 0 +}; + +// Construit un bateau. +static short table_goal_bateaue[] = +{ + WM_ACTION_BATEAUE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,117, -1,-1, DIMOBJY/10,20,-10*100, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, -1,+1, TRUE, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_FINISHMOVE, + + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,117, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,0, 6, // bateau vers l'est + GOAL_ACTION, ACTION_PONT, DIRECT_E, + GOAL_GROUP, 4, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -1,0, -1,-1, + GOAL_PUTOBJECT, +1,0, CHOBJECT,117, + GOAL_SOUND, SOUND_PLOUF, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +static short table_goal_bateaus[] = +{ + WM_ACTION_BATEAUS, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,117, -1,-1, DIMOBJY/10,20,-10*100, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, -1,+1, TRUE, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_FINISHMOVE, + + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,117, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 8, // bateau vers le sud + GOAL_ACTION, ACTION_PONT, DIRECT_S, + GOAL_GROUP, 4, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, 0,-1, -1,-1, + GOAL_PUTOBJECT, 0,+1, CHOBJECT,117, + GOAL_SOUND, SOUND_PLOUF, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +static short table_goal_bateauo[] = +{ + WM_ACTION_BATEAUO, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,117, -1,-1, DIMOBJY/10,20,-10*100, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, -1,+1, TRUE, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_FINISHMOVE, + + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,117, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,0, 7, // bateau vers l'ouest + GOAL_ACTION, ACTION_PONT, DIRECT_O, + GOAL_GROUP, 4, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -1,0, -1,-1, + GOAL_PUTOBJECT, -3,0, CHOBJECT,117, + GOAL_SOUND, SOUND_PLOUF, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +static short table_goal_bateaun[] = +{ + WM_ACTION_BATEAUN, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GROUP, 3, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_BUILDOBJECT, -1,0, CHOBJECT,117, -1,-1, DIMOBJY/10,20,-10*100, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_ACTION, ACTION_SCIE, DIRECT_S, + GOAL_GOBLUPI, -1,+1, TRUE, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_FINISHMOVE, + + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,117, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 9, // bateau vers le nord + GOAL_ACTION, ACTION_PONT, DIRECT_N, + GOAL_GROUP, 4, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, 0,-1, -1,-1, + GOAL_PUTOBJECT, 0,-3, CHOBJECT,117, + GOAL_SOUND, SOUND_PLOUF, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Départ en bateau. +static short table_goal_bateaude[] = +{ + WM_ACTION_BATEAUDE, + GOAL_ISNOMALADE, + GOAL_GOHILI2, +1,+1, TRUE, + GOAL_ISNOMALADE, + GOAL_GROUP, 3, + GOAL_TESTOBJECT, +1,-1, CHOBJECT,117, + GOAL_INTERRUPT, -1, // passe muraille + GOAL_WORK, +1,-1, + GOAL_GOBLUPI, +2,0, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, -1,-1, // enlève le bateau + GOAL_VEHICULE, 1, // en bateau + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_TERM, + 0 +}; + +static short table_goal_bateauds[] = +{ + WM_ACTION_BATEAUDS, + GOAL_ISNOMALADE, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ISNOMALADE, + GOAL_GROUP, 3, + GOAL_TESTOBJECT, -1,+1, CHOBJECT,117, + GOAL_INTERRUPT, -1, // passe muraille + GOAL_WORK, -1,+1, + GOAL_GOBLUPI, 0,+2, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, -1,-1, // enlève le bateau + GOAL_VEHICULE, 1, // en bateau + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_TERM, + 0 +}; + +static short table_goal_bateaudo[] = +{ + WM_ACTION_BATEAUDO, + GOAL_ISNOMALADE, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ISNOMALADE, + GOAL_GROUP, 3, + GOAL_TESTOBJECT, -2,-1, CHOBJECT,117, + GOAL_INTERRUPT, -1, // passe muraille + GOAL_WORK, -2,-1, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, -1,-1, // enlève le bateau + GOAL_VEHICULE, 1, // en bateau + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_TERM, + 0 +}; + +static short table_goal_bateaudn[] = +{ + WM_ACTION_BATEAUDN, + GOAL_ISNOMALADE, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ISNOMALADE, + GOAL_GROUP, 3, + GOAL_TESTOBJECT, -1,-2, CHOBJECT,117, + GOAL_INTERRUPT, -1, // passe muraille + GOAL_WORK, -1,-2, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, -1,-1, // enlève le bateau + GOAL_VEHICULE, 1, // en bateau + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_TERM, + 0 +}; + +// Arrivée en bateau. +static short table_goal_bateauae[] = +{ + WM_ACTION_BATEAUAE, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_GROUP, 4, + GOAL_IFDEBARQUE, -3,0, + GOAL_INTERRUPT, -1, // passe muraille + GOAL_WORK, -2,-1, + GOAL_WORK, -4,-1, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,117, // remet le bateau + GOAL_VEHICULE, 0, // à pied + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GOBLUPI, -2,0, TRUE, + GOAL_TERM, + 0 +}; + +static short table_goal_bateauas[] = +{ + WM_ACTION_BATEAUAS, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_GROUP, 4, + GOAL_IFDEBARQUE, 0,-3, + GOAL_INTERRUPT, -1, // passe muraille + GOAL_WORK, -1,-2, + GOAL_WORK, -1,-4, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,117, // remet le bateau + GOAL_VEHICULE, 0, // à pied + GOAL_GOBLUPI, 0,-2, TRUE, + GOAL_TERM, + 0 +}; + +static short table_goal_bateauao[] = +{ + WM_ACTION_BATEAUAO, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_GROUP, 4, + GOAL_IFDEBARQUE, +2,0, + GOAL_INTERRUPT, -1, // passe muraille + GOAL_WORK, 0,-1, + GOAL_WORK, +2,-1, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,117, // remet le bateau + GOAL_VEHICULE, 0, // à pied + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_TERM, + 0 +}; + +static short table_goal_bateauan[] = +{ + WM_ACTION_BATEAUAN, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_GROUP, 4, + GOAL_IFDEBARQUE, 0,+2, + GOAL_INTERRUPT, -1, // passe muraille + GOAL_WORK, -1,0, + GOAL_WORK, -1,+2, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,117, // remet le bateau + GOAL_VEHICULE, 0, // à pied + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_TERM, + 0 +}; + +// Le robot construit une station de recharge. +static short table_goal_r_build1[] = +{ + WM_ACTION_R_BUILD1, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_GROUP, 3, + GOAL_USINEBUILD, -1,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDFLOOR, -1,-1, CHFLOOR,67, CHMASK1,0, 16,14,1*100, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,99, -1,-1, DIMOBJY/4,20,4*100, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_O, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_N, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Le robot construit une usine à araignées. +static short table_goal_r_build2[] = +{ + WM_ACTION_R_BUILD2, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_GROUP, 3, + GOAL_USINEBUILD, -1,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDFLOOR, -1,-1, CHFLOOR,67, CHMASK1,0, 16,14,1*100, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,100, -1,-1, DIMOBJY/4,20,4*100, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_N, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_O, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Le robot construit une usine à virus. +static short table_goal_r_build3[] = +{ + WM_ACTION_R_BUILD3, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_GROUP, 3, + GOAL_USINEBUILD, -1,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDFLOOR, -1,-1, CHFLOOR,67, CHMASK1,0, 16,14,1*100, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,102, -1,-1, DIMOBJY/4,20,4*100, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_O, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_N, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Le robot construit une usine à tracks. +static short table_goal_r_build4[] = +{ + WM_ACTION_R_BUILD4, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_GROUP, 3, + GOAL_USINEBUILD, -1,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDFLOOR, -1,-1, CHFLOOR,67, CHMASK1,0, 16,14,1*100, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,104, -1,-1, DIMOBJY/4,20,4*100, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_O, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_N, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Le robot construit une usine à bombe. +static short table_goal_r_build5[] = +{ + WM_ACTION_R_BUILD5, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_GROUP, 3, + GOAL_USINEBUILD, -1,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDFLOOR, -1,-1, CHFLOOR,67, CHMASK1,0, 16,14,1*100, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,115, -1,-1, DIMOBJY/4,20,4*100, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_O, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_N, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Le robot construit une usine à électro. +static short table_goal_r_build6[] = +{ + WM_ACTION_R_BUILD6, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_GROUP, 3, + GOAL_USINEBUILD, -1,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_BUILDFLOOR, -1,-1, CHFLOOR,67, CHMASK1,0, 16,14,1*100, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_E, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,17, -1,-1, DIMOBJY/4,20,4*100, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_S, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_O, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_S, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_APLAT, DIRECT_N, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_E, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_S, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Le robot se recharge. +static short table_goal_r_make1[] = +{ + WM_ACTION_R_MAKE1, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_GROUP, 2, + GOAL_USINEFREE, -1,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_ACTION, ACTION_R_CHARGE, DIRECT_O, + GOAL_ACTION, ACTION_R_CHARGE, DIRECT_O, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_O, + GOAL_ACTION, ACTION_R_CHARGE, DIRECT_O, + GOAL_ACTION, ACTION_R_CHARGE, DIRECT_O, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_O, + GOAL_ACTION, ACTION_R_CHARGE, DIRECT_O, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_O, + GOAL_ACTION, ACTION_R_CHARGE, DIRECT_O, + GOAL_ACTION, ACTION_R_CHARGE, DIRECT_O, + GOAL_ACTION, ACTION_R_BUILD, DIRECT_O, + GOAL_TERM, + 0 +}; + +// Le robot construit une araignée. +static short table_goal_r_make2[] = +{ + WM_ACTION_R_MAKE2, + GOAL_GOHILI2, +2,+1, FALSE, + GOAL_GROUP, 2, + GOAL_USINEFREE, -2,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,101, // ouvre la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,100, // ferme la porte + GOAL_CACHE, TRUE, FALSE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,100, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,100, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 2,0, + GOAL_WAITFREE, 3,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,101, // ouvre la porte + GOAL_NEWPERSO, +1,0, 1, // araignée (qui sortira) + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,100, // ferme la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 1,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_CACHE, FALSE, FALSE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,101, // ouvre la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,100, // ferme la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_TERM, + 0 +}; + +// Le robot construit un virus. +static short table_goal_r_make3[] = +{ + WM_ACTION_R_MAKE3, + GOAL_GOHILI2, +2,+1, FALSE, + GOAL_GROUP, 2, + GOAL_USINEFREE, -2,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,103, // ouvre la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,102, // ferme la porte + GOAL_CACHE, TRUE, FALSE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,102, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,102, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 2,0, + GOAL_WAITFREE, 3,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,103, // ouvre la porte + GOAL_NEWPERSO, +1,0, 2, // virus (qui sortira) + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,102, // ferme la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 1,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_CACHE, FALSE, FALSE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,103, // ouvre la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,102, // ferme la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_TERM, + 0 +}; + +// Le robot construit un tracks. +static short table_goal_r_make4[] = +{ + WM_ACTION_R_MAKE4, + GOAL_GOHILI2, +2,+1, FALSE, + GOAL_GROUP, 2, + GOAL_USINEFREE, -2,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,105, // ouvre la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,104, // ferme la porte + GOAL_CACHE, TRUE, FALSE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,104, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,104, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 2,0, + GOAL_WAITFREE, 3,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,105, // ouvre la porte + GOAL_NEWPERSO, +1,0, 3, // tracks (qui sortira) + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,104, // ferme la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 1,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_CACHE, FALSE, FALSE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,105, // ouvre la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,104, // ferme la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_TERM, + 0 +}; + +// Le robot construit une bombe. +static short table_goal_r_make5[] = +{ + WM_ACTION_R_MAKE5, + GOAL_GOHILI2, +2,+1, FALSE, + GOAL_GROUP, 2, + GOAL_USINEFREE, -2,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,116, // ouvre la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,115, // ferme la porte + GOAL_CACHE, TRUE, FALSE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,115, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,115, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 2,0, + GOAL_WAITFREE, 3,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,116, // ouvre la porte + GOAL_NEWPERSO, +1,0, 5, // bombe (qui sortira) + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,115, // ferme la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 1,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_CACHE, FALSE, FALSE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,116, // ouvre la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,115, // ferme la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_TERM, + 0 +}; + +// Le robot construit un électro. +static short table_goal_r_make6[] = +{ + WM_ACTION_R_MAKE6, + GOAL_GOHILI2, +2,+1, FALSE, + GOAL_GROUP, 2, + GOAL_USINEFREE, -2,-1, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,18, // ouvre la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_ACTION, ACTION_R_STOP, DIRECT_O, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,17, // ferme la porte + GOAL_CACHE, TRUE, FALSE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,17, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,17, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 10, // secoue + GOAL_SOUND, SOUND_LABO, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 2,0, + GOAL_WAITFREE, 3,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,18, // ouvre la porte + GOAL_NEWPERSO, +1,0, 7, // électro (qui sortira) + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,17, // ferme la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_WAITFREE, 1,0, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_CACHE, FALSE, FALSE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,18, // ouvre la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, -2,-1, CHOBJECT,17, // ferme la porte + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_ACTION, ACTION_R_STOP, DIRECT_N, + GOAL_TERM, + 0 +}; + +// Blupi monte dans une jeep. +static short table_goal_mjeep[] = +{ + WM_ACTION_MJEEP, + GOAL_ISNOMALADE, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ISNOMALADE, + GOAL_GROUP, 3, + GOAL_TESTOBJECT, -1,0, CHOBJECT,118, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_ACTION, ACTION_SAUTE1, DIRECT_S, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, -1,-1, // enlève la jeep + GOAL_VEHICULE, 2, // en jeep + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Blupi descend de la jeep. +static short table_goal_djeep[] = +{ + WM_ACTION_DJEEP, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 5, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,118, // remet la jeep + GOAL_VEHICULE, 0, // à pied + GOAL_ACTUALISE, + GOAL_ACTION, ACTION_SAUTE1, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_TERM, + 0 +}; + +// Blupi monte dans une armure. +static short table_goal_marmure[] = +{ + WM_ACTION_MARMURE, + GOAL_ISNOMALADE, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_ISNOMALADE, + GOAL_GROUP, 3, + GOAL_TESTOBJECT, -1,0, CHOBJECT,16, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,0, + GOAL_GOBLUPI, 0,+1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_PUTOBJECT, -1,-1, -1,-1, // enlève l'armure + GOAL_ACTION, ACTION_ARMURECLOSE, DIRECT_E, + GOAL_VEHICULE, 3, // en armure + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Blupi descend de l'armure. +static short table_goal_darmure[] = +{ + WM_ACTION_DARMURE, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_ARMUREOPEN, DIRECT_E, + GOAL_GROUP, 3, + GOAL_WORK, -1,-1, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,16, // remet l'armure + GOAL_VEHICULE, 0, // à pied + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_TERM, + 0 +}; + +// Blupi cherche où planter des drapeaux. +static short table_goal_drapeau[] = +{ + WM_ACTION_DRAPEAU, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_FIX, 0,-1, + GOAL_REPEAT, TRUE, + GOAL_OTHERFIX, CHFLOOR,33,48,71,71, WM_ACTION_DRAPEAU2, + GOAL_TERM, + 0 +}; + +static short table_goal_drapeau2[] = +{ + WM_ACTION_DRAPEAU2, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_ACTION, ACTION_BUILD, DIRECT_S, + GOAL_FLOORJUMP, CHFLOOR,71, WM_ACTION_DRAPEAU3, + GOAL_ADDDRAPEAU, -1,0, + + GOAL_OTHERFIX, CHFLOOR,33,48,71,71, WM_ACTION_DRAPEAU2, + GOAL_TERM, + 0 +}; + +// Plante un drapeau. +static short table_goal_drapeau3[] = +{ + WM_ACTION_DRAPEAU3, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GROUP, 2, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, 0,-1, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,124, -1,-1, DIMOBJY/10,8,10*100, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_O, + GOAL_GOBLUPI, +1,-1, TRUE, + GOAL_ACTION, ACTION_PIOCHESOURD, DIRECT_E, + GOAL_ADDDRAPEAU, -1,0, + GOAL_FINISHMOVE, + +//? GOAL_OTHERFIX, CHFLOOR,33,48,71,71, WM_ACTION_DRAPEAU2, + GOAL_TERM, + 0 +}; + +// Blupi extrait du fer. +static short table_goal_extrait[] = +{ + WM_ACTION_EXTRAIT, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 6, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,121, // ferme la porte + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,121, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,-1, 11, // secoue + GOAL_CACHE, TRUE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_O, + GOAL_SOUND, SOUND_MINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,121, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,-1, 11, // secoue + GOAL_SOUND, SOUND_MINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 4, + GOAL_TAKEOBJECT, -1,-1, CHOBJECT,123, // porte du fer + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,122, // ouvre la porte + GOAL_CACHE, FALSE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_IFTERM, 0,-1, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Blupi fabrique une jeep. +static short table_goal_fabjeep[] = +{ + WM_ACTION_FABJEEP, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 6, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,119, // ferme la porte + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,119, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,-1, 12, // secoue + GOAL_CACHE, TRUE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_O, + GOAL_SOUND, SOUND_USINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,119, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,-1, 12, // secoue + GOAL_SOUND, SOUND_USINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 5, + GOAL_TAKEOBJECT, -1,-1, -1,-1, // ne porte plus rien + GOAL_VEHICULE, 2, // en jeep + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,120, // ouvre la porte + GOAL_CACHE, FALSE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_IFTERM, +1,0, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_TERM, + 0 +}; + +// Blupi fabrique une armure. +static short table_goal_fabarmure[] = +{ + WM_ACTION_FABARMURE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 6, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,119, // ferme la porte + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,119, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,-1, 12, // secoue + GOAL_CACHE, TRUE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_O, + GOAL_SOUND, SOUND_USINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,119, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,-1, 12, // secoue + GOAL_SOUND, SOUND_USINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 5, + GOAL_TAKEOBJECT, -1,-1, -1,-1, // ne porte plus rien + GOAL_VEHICULE, 3, // en armure + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,120, // ouvre la porte + GOAL_CACHE, FALSE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_IFTERM, +1,0, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_TERM, + 0 +}; + +// Blupi fabrique une mine. +static short table_goal_fabmine[] = +{ + WM_ACTION_FABMINE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 6, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,119, // ferme la porte + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,119, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,-1, 12, // secoue + GOAL_CACHE, TRUE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_O, + GOAL_SOUND, SOUND_USINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, -1,-1, CHOBJECT,119, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, -1,-1, 12, // secoue + GOAL_SOUND, SOUND_USINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 4, + GOAL_TAKEOBJECT, -1,-1, CHOBJECT,125, // porte une mine + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,120, // ouvre la porte + GOAL_CACHE, FALSE, FALSE, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_IFTERM, 0,-1, + GOAL_GOBLUPI, 0,-1, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// Blupi fabrique un disciple. +static short table_goal_fabdisc[] = +{ + WM_ACTION_FABDISC, + GOAL_ENERGY, MAXENERGY/4, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_ENERGY, MAXENERGY/4, + GOAL_ACTION, ACTION_STOP, DIRECT_N, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 4, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_WORK, -1,-1, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,119, // ferme la porte + GOAL_CACHE, TRUE, FALSE, + GOAL_GOBLUPI, -1,0, TRUE, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,119, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 12, // secoue + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_O, + GOAL_SOUND, SOUND_USINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_GROUP, 2, + GOAL_BUILDOBJECT, 0,-1, CHOBJECT,119, -1,-1, DIMOBJY,1,-1*100, + GOAL_ADDMOVES, 0,-1, 12, // secoue + GOAL_SOUND, SOUND_USINE, + GOAL_ACTION, ACTION_LABO, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 2, + GOAL_FINISHMOVE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,120, // ouvre la porte + GOAL_NEWPERSO, +1,0, 8, // disciple (qui sortira) + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_PUTOBJECT, 0,-1, CHOBJECT,119, // ferme la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_ACTION, ACTION_R_DELAY, DIRECT_E, + GOAL_SOUND, SOUND_PORTE, + GOAL_GROUP, 3, + GOAL_TAKEOBJECT, -1,-1, -1,-1, // ne porte plus rien + GOAL_CACHE, FALSE, FALSE, + GOAL_PUTOBJECT, -1,-1, CHOBJECT,120, // ouvre la porte + GOAL_GOBLUPI, +1,0, TRUE, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_TERM, + 0 +}; + +// L'électro va sur un blupi puis lance ses rayons. +static short table_goal_e_rayon[] = +{ + WM_ACTION_E_RAYON, + GOAL_GOHILI2, 0,0, FALSE, + GOAL_SOUND, SOUND_E_TOURNE, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_SKIPSKILL, 1, 7, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_DEBUT, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_SOUND, SOUND_E_RAYON, + GOAL_ELECTRO, 0, 0, 8, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ELECTRO, -2, 0, 8, + GOAL_ELECTRO, 0,-2, 8, + GOAL_ELECTRO, 0,+2, 8, + GOAL_ELECTRO, +2, 0, 8, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ELECTRO, -2,-2, 8, + GOAL_ELECTRO, +2,-2, 8, + GOAL_ELECTRO, -2,+2, 8, + GOAL_ELECTRO, +2,+2, 8, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ELECTRO, -4,-2, 8, + GOAL_ELECTRO, -4, 0, 8, + GOAL_ELECTRO, -4,+2, 8, + GOAL_ELECTRO, -2,-4, 8, + GOAL_ELECTRO, -2,+4, 8, + GOAL_ELECTRO, 0,-4, 8, + GOAL_ELECTRO, 0,+4, 8, + GOAL_ELECTRO, +2,-4, 8, + GOAL_ELECTRO, +2,+4, 8, + GOAL_ELECTRO, +4,-2, 8, + GOAL_ELECTRO, +4, 0, 8, + GOAL_ELECTRO, +4,+2, 8, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ELECTRO, -6,-2, 8, + GOAL_ELECTRO, -6, 0, 8, + GOAL_ELECTRO, -6,+2, 8, + GOAL_ELECTRO, -4,-4, 8, + GOAL_ELECTRO, -4,+4, 8, + GOAL_ELECTRO, -2,-6, 8, + GOAL_ELECTRO, -2,+6, 8, + GOAL_ELECTRO, 0,-6, 8, + GOAL_ELECTRO, 0,+6, 8, + GOAL_ELECTRO, +2,-6, 8, + GOAL_ELECTRO, +2,+6, 8, + GOAL_ELECTRO, +4,-4, 8, + GOAL_ELECTRO, +4,+4, 8, + GOAL_ELECTRO, +6,-2, 8, + GOAL_ELECTRO, +6, 0, 8, + GOAL_ELECTRO, +6,+2, 8, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_ACTION, ACTION_E_RAYON, DIRECT_E, + GOAL_FINISHMOVE, + GOAL_TERM, + 0 +}; + +// Blupi s'électrocute. +static short table_goal_electro[] = +{ + WM_ACTION_ELECTRO, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_ACTION, ACTION_STOP, DIRECT_SE, + GOAL_MALADE, FALSE, + GOAL_ACTION, ACTION_ELECTRO, DIRECT_SE, + GOAL_TAKEOBJECT, -1,-1, -1,-1, // ne porte plus rien + GOAL_SOUND, SOUND_TCHAO, + GOAL_ACTION, ACTION_GRILLE1, DIRECT_SE, + GOAL_ACTION, ACTION_GRILLE2, DIRECT_SE, + GOAL_ACTION, ACTION_GRILLE3, DIRECT_SE, + GOAL_DELETE, // blupi meurt brutalement + GOAL_TERM, + 0 +}; + +static short table_goal_electrom[] = +{ + WM_ACTION_ELECTROm, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_ACTION, ACTION_STOP, DIRECT_SE, + GOAL_GROUP, 3, + GOAL_MALADE, FALSE, + GOAL_TAKEOBJECT, -1,-1, -1,-1, // ne porte plus rien + GOAL_SOUND, SOUND_TCHAO, + GOAL_ACTION, ACTION_GRILLE1, DIRECT_SE, + GOAL_ACTION, ACTION_GRILLE2, DIRECT_SE, + GOAL_ACTION, ACTION_GRILLE3, DIRECT_SE, + GOAL_DELETE, // blupi meurt brutalement + GOAL_TERM, + 0 +}; + +// Blupi grille. +static short table_goal_grille[] = +{ + WM_ACTION_GRILLE, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_ACTION, ACTION_STOP, DIRECT_SE, + GOAL_GROUP, 3, + GOAL_MALADE, FALSE, + GOAL_TAKEOBJECT, -1,-1, -1,-1, // ne porte plus rien + GOAL_SOUND, SOUND_BRULE, + GOAL_ACTION, ACTION_GRILLE1, DIRECT_SE, + GOAL_ACTION, ACTION_GRILLE2, DIRECT_SE, + GOAL_ACTION, ACTION_GRILLE3, DIRECT_SE, + GOAL_DELETE, // blupi meurt brutalement + GOAL_TERM, + 0 +}; + +// L'araignée meurt. +static short table_goal_a_mort[] = +{ + WM_ACTION_A_MORT, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_ACTION, ACTION_STOP, DIRECT_E, + GOAL_SOUND, SOUND_A_POISON, + GOAL_ACTION, ACTION_A_POISON, DIRECT_E, + GOAL_ACTION, ACTION_A_MORT1, DIRECT_E, + GOAL_ACTION, ACTION_A_MORT2, DIRECT_E, + GOAL_ACTION, ACTION_A_MORT3, DIRECT_E, + GOAL_DELETE, // l'araignée meurt brutalement + GOAL_TERM, + 0 +}; + +// Blupi se prépare à répéter une liste. +static short table_goal_repeat[] = +{ + WM_ACTION_REPEAT, + GOAL_TERM, + 0 +}; + +// Blupi se téléporte d'un endroit à un autre. +static short table_goal_teleporte00[] = +{ + WM_ACTION_TELEPORTE00, + GOAL_GOHILI2, 0,0, FALSE, + GOAL_GROUP, 4, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_BUILDFLOOR, 0,0, CHFLOOR,-1, -1,-1, 100,1,1*100, + GOAL_ADDICONS, 0,0, 11, + GOAL_SOUND, SOUND_TELEPORTE, + GOAL_ACTION, ACTION_TELEPORTE1, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE2, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE3, DIRECT_E, + GOAL_TELEPORTE, 0,0, + GOAL_GROUP, 3, + GOAL_BUILDFLOOR, 0,0, CHFLOOR,-1, -1,-1, 60,1,1*60, + GOAL_ADDICONS, 0,0, 11, + GOAL_SOUND, SOUND_TELEPORTE, + GOAL_ACTION, ACTION_TELEPORTE2, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE1, DIRECT_E, + GOAL_TERM, + 0 +}; + +static short table_goal_teleporte10[] = +{ + WM_ACTION_TELEPORTE10, + GOAL_GOHILI2, +1,0, FALSE, + GOAL_GROUP, 4, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_BUILDFLOOR, -1,0, CHFLOOR,-1, -1,-1, 100,1,1*100, + GOAL_ADDICONS, -1,0, 11, + GOAL_SOUND, SOUND_TELEPORTE, + GOAL_ACTION, ACTION_TELEPORTE1, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE2, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE3, DIRECT_E, + GOAL_TELEPORTE, +1,0, + GOAL_GROUP, 3, + GOAL_BUILDFLOOR, -1,0, CHFLOOR,-1, -1,-1, 60,1,1*60, + GOAL_ADDICONS, -1,0, 11, + GOAL_SOUND, SOUND_TELEPORTE, + GOAL_ACTION, ACTION_TELEPORTE2, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE1, DIRECT_E, + GOAL_TERM, + 0 +}; + +static short table_goal_teleporte01[] = +{ + WM_ACTION_TELEPORTE01, + GOAL_GOHILI2, 0,+1, FALSE, + GOAL_GROUP, 4, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_BUILDFLOOR, 0,-1, CHFLOOR,-1, -1,-1, 100,1,1*100, + GOAL_ADDICONS, 0,-1, 11, + GOAL_SOUND, SOUND_TELEPORTE, + GOAL_ACTION, ACTION_TELEPORTE1, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE2, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE3, DIRECT_E, + GOAL_TELEPORTE, 0,+1, + GOAL_GROUP, 3, + GOAL_BUILDFLOOR, 0,-1, CHFLOOR,-1, -1,-1, 60,1,1*60, + GOAL_ADDICONS, 0,-1, 11, + GOAL_SOUND, SOUND_TELEPORTE, + GOAL_ACTION, ACTION_TELEPORTE2, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE1, DIRECT_E, + GOAL_TERM, + 0 +}; + +static short table_goal_teleporte11[] = +{ + WM_ACTION_TELEPORTE11, + GOAL_GOHILI2, +1,+1, FALSE, + GOAL_GROUP, 4, + GOAL_INTERRUPT, 0, // prioritaire + GOAL_BUILDFLOOR, -1,-1, CHFLOOR,-1, -1,-1, 100,1,1*100, + GOAL_ADDICONS, -1,-1, 11, + GOAL_SOUND, SOUND_TELEPORTE, + GOAL_ACTION, ACTION_TELEPORTE1, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE2, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE3, DIRECT_E, + GOAL_TELEPORTE, +1,+1, + GOAL_GROUP, 3, + GOAL_BUILDFLOOR, -1,-1, CHFLOOR,-1, -1,-1, 60,1,1*60, + GOAL_ADDICONS, -1,-1, 11, + GOAL_SOUND, SOUND_TELEPORTE, + GOAL_ACTION, ACTION_TELEPORTE2, DIRECT_E, + GOAL_ACTION, ACTION_TELEPORTE1, DIRECT_E, + GOAL_TERM, + 0 +}; + + +static short* table_pGoal[] = +{ + table_goal_go, + table_goal_maison, + table_goal_abat1, + table_goal_abat2, + table_goal_abat3, + table_goal_abat4, + table_goal_abat5, + table_goal_abat6, + table_goal_roc1, + table_goal_roc2, + table_goal_roc3, + table_goal_roc4, + table_goal_roc5, + table_goal_roc6, + table_goal_roc7, + table_goal_build1, + table_goal_build2, + table_goal_build3, + table_goal_build4, + table_goal_build5, + table_goal_build6, + table_goal_mur, + table_goal_tour, + table_goal_palis, + table_goal_carry, + table_goal_carry2, + table_goal_depose, + table_goal_depose2, + table_goal_newblupi, + table_goal_cultive, + table_goal_cultive2, + table_goal_mange, + table_goal_mange2, + table_goal_boit, + table_goal_boit2, + table_goal_fleur1, + table_goal_fleur2, + table_goal_fleur3, + table_goal_labo, + table_goal_dynamite, + table_goal_dynamite2, + table_goal_t_dynamite, + table_goal_mine, + table_goal_mine2, + table_goal_ponte, + table_goal_pontel, + table_goal_ponto, + table_goal_pontol, + table_goal_ponts, + table_goal_pontsl, + table_goal_pontn, + table_goal_pontnl, + table_goal_bateaue, + table_goal_bateaus, + table_goal_bateauo, + table_goal_bateaun, + table_goal_bateaude, + table_goal_bateauds, + table_goal_bateaudo, + table_goal_bateaudn, + table_goal_bateauae, + table_goal_bateauas, + table_goal_bateauao, + table_goal_bateauan, + table_goal_r_build1, + table_goal_r_build2, + table_goal_r_build3, + table_goal_r_build4, + table_goal_r_build5, + table_goal_r_build6, + table_goal_r_make1, + table_goal_r_make2, + table_goal_r_make3, + table_goal_r_make4, + table_goal_r_make5, + table_goal_r_make6, + table_goal_mjeep, + table_goal_djeep, + table_goal_marmure, + table_goal_darmure, + table_goal_drapeau, + table_goal_drapeau2, + table_goal_drapeau3, + table_goal_extrait, + table_goal_fabjeep, + table_goal_fabarmure, + table_goal_fabmine, + table_goal_fabdisc, + table_goal_e_rayon, + table_goal_electro, + table_goal_electrom, + table_goal_grille, + table_goal_a_mort, + table_goal_repeat, + table_goal_teleporte00, + table_goal_teleporte10, + table_goal_teleporte01, + table_goal_teleporte11, + NULL +}; + +// Retourne le pointeur à la table table_goal_*. + +short* GetTableGoal(int action) +{ + short** ppTable = table_pGoal; + + while ( *ppTable != NULL ) + { + if ( **ppTable == action ) + { + return *ppTable+1; // après WM_ACTION_* + } + + ppTable ++; + } + + return NULL; +} + diff --git a/decgoal.h b/decgoal.h new file mode 100644 index 0000000..e5505cc --- /dev/null +++ b/decgoal.h @@ -0,0 +1,58 @@ + +#pragma once + +// Méta opérations (goal). + +#define GOAL_TERM 0 // +#define GOAL_GOHILI 1 // dx,dy, bPass +#define GOAL_GOHILI2 2 // dx,dy, bPass +#define GOAL_GOBLUPI 3 // dx,dy, bPass +#define GOAL_PUTFLOOR 4 // dx,dy, channel,icon +#define GOAL_PUTOBJECT 5 // dx,dy, channel,icon +#define GOAL_BUILDFLOOR 6 // dx,dy, ch,i,mch, mi,total,delai,step +#define GOAL_BUILDOBJECT 7 // dx,dy, ch,i,mch, mi,total,delai,step +#define GOAL_ACTION 8 // action,direction +#define GOAL_INTERRUPT 9 // niveau (0..2) +#define GOAL_ENERGY 10 // niveau minimum requis +#define GOAL_ADDMOVES 11 // dx,dy,no +#define GOAL_OTHER 12 // channel,first,last,fitst,last,action +#define GOAL_FINISHMOVE 13 // +#define GOAL_TAKE 14 // dx,dy +#define GOAL_DEPOSE 15 // +#define GOAL_GROUP 16 // nb +#define GOAL_WORK 17 // dx,dy +#define GOAL_TESTOBJECT 18 // dx,dy, channel,icon +#define GOAL_FIX 19 // dx,dy +#define GOAL_OTHERFIX 20 // channel,first,last,first,last,action +#define GOAL_ADDICONS 21 // dx,dy,no +#define GOAL_NEWBLUPI 22 // dx,dy +#define GOAL_SOUND 23 // sound +#define GOAL_REPEAT 24 // true/false +#define GOAL_OTHERLOOP 25 // action +#define GOAL_NEXTLOOP 26 // +#define GOAL_ARRANGEOBJECT 27 // dx,dy +#define GOAL_LABO 28 // +#define GOAL_CACHE 29 // true/false, bDynamite +#define GOAL_DELETE 30 // +#define GOAL_ELECTRO 31 // dx,dy,no +#define GOAL_NEWPERSO 32 // dx,dy, perso +#define GOAL_USINEBUILD 33 // dx,dy, +#define GOAL_USINEFREE 34 // dx,dy, +#define GOAL_EXPLOSE1 35 // dx,dy +#define GOAL_EXPLOSE2 36 // dx,dy +#define GOAL_VEHICULE 37 // type +#define GOAL_TAKEOBJECT 38 // dx,dy, channel,icon +#define GOAL_FLOORJUMP 39 // channel,icon,action +#define GOAL_ADDDRAPEAU 40 // dx,dy +#define GOAL_AMORCE 41 // dx,dy +#define GOAL_MALADE 42 // bMalade +#define GOAL_IFTERM 43 // dx,dy +#define GOAL_IFDEBARQUE 44 // dx,dy +#define GOAL_ISNOMALADE 45 // +#define GOAL_SKIPSKILL 46 // skill,d +#define GOAL_TELEPORTE 47 // dx,dy +#define GOAL_ACTUALISE 48 // +#define GOAL_WAITFREE 49 // dx,dy + +short* GetTableGoal (int action); +extern short table_goal_nbop[]; diff --git a/decio.cpp b/decio.cpp new file mode 100644 index 0000000..90d3af3 --- /dev/null +++ b/decio.cpp @@ -0,0 +1,500 @@ +// DecIO.cpp +// + +#include +#include "DEF.H" +#include "DECOR.H" +#include "MISC.H" + +typedef struct +{ + short majRev; + short minRev; + long nbDecor; + long lgDecor; + long nbBlupi; + long lgBlupi; + long nbMove; + long lgMove; + short reserve1[100]; + POINT celCoin; + short world; + long time; + char buttonExist[MAXBUTTON]; + Term term; + short music; + short region; + long totalTime; + short skill; + POINT memoPos[4]; + short reserve2[29]; +} +DescFile; + +typedef struct +{ + BOOL bExist; // TRUE -> utilisé + BOOL bHili; // TRUE -> sélectionné + + short perso; // personnage, voir (*) + + short goalAction; // action (long terme) + short goalPhase; // phase (long terme) + POINT goalCel; // cellule visée (long terme) + POINT passCel; // cellule tranversante + + short energy; // énergie restante + + POINT cel; // cellule actuelle + POINT destCel; // cellule destination + short action; // action en cours + short aDirect; // direction actuelle + short sDirect; // direction souhaitée + + POINT pos; // position relative à partir de la cellule + short posZ; // déplacement z + short channel; + short lastIcon; + short icon; + short phase; // phase dans l'action + short step; // pas global + short interrupt; // 0=prioritaire, 1=normal, 2=misc + short clipLeft; + + int nbUsed; // nb de points déjà visités + char nextRankUsed; + POINT posUsed[MAXUSED]; + char rankUsed[MAXUSED]; + + short takeChannel; // objet transporté + short takeIcon; + + POINT fix; // point fixe (cultive, pont) + + short jaugePhase; + short jaugeMax; + short stop; // 1 -> devra stopper + short bArrow; // TRUE -> flèche en dessus de blupi + short bRepeat; // TRUE -> répète l'action + short nLoop; // nb de boucles pour GOAL_OTHERLOOP + short cLoop; // boucle en cours + short vIcon; // icône variable + POINT goalHili; // but visé + short bMalade; // TRUE -> blupi malade + short bCache; // TRUE -> caché (pas dessiné) + short vehicule; // véhicule utilisé par blupi, voir (**) + char busyCount; + char busyDelay; + char clicCount; + char clicDelay; + char reserve2[2]; +} +OldBlupi; + + +// Sauve le décor sur disque. + +BOOL CDecor::Write(int rank, BOOL bUser, int world, int time, int total) +{ + char filename[MAX_PATH]; + FILE* file = NULL; + DescFile* pBuffer = NULL; + int nb, i; + + if ( bUser ) + { + sprintf(filename, "data\\user%.3d.blp", rank); + AddUserPath(filename); + } + else + { + sprintf(filename, "data\\world%.3d.blp", rank); + if ( rank < 200 ) + { + AddCDPath(filename); // ajoute l'accès au CD-Rom + } + } + + file = fopen(filename, "wb"); + if ( file == NULL ) goto error; + + pBuffer = (DescFile*)malloc(sizeof(DescFile)); + if ( pBuffer == NULL ) goto error; + memset(pBuffer, 0, sizeof(DescFile)); + + pBuffer->majRev = 1; + pBuffer->minRev = 5; + pBuffer->celCoin = m_celCoin; + pBuffer->world = world; + pBuffer->time = time; + pBuffer->totalTime = total; + pBuffer->term = m_term; + pBuffer->music = m_music; + pBuffer->region = m_region; + pBuffer->skill = m_skill; + pBuffer->nbDecor = MAXCELX*MAXCELY; + pBuffer->lgDecor = sizeof(Cellule); + pBuffer->nbBlupi = MAXBLUPI; + pBuffer->lgBlupi = sizeof(Blupi); + pBuffer->nbMove = MAXMOVE; + pBuffer->lgMove = sizeof(Move); + + for ( i=0 ; ibuttonExist[i] = m_buttonExist[i]; + } + + for ( i=0 ; i<4 ; i++ ) + { + pBuffer->memoPos[i] = m_memoPos[i]; + } + + nb = fwrite(pBuffer, sizeof(DescFile), 1, file); + if ( nb < 1 ) goto error; + + nb = fwrite(m_decor, sizeof(Cellule), MAXCELX*MAXCELY/4, file); + if ( nb < MAXCELX*MAXCELY/4 ) goto error; + + nb = fwrite(m_blupi, sizeof(Blupi), MAXBLUPI, file); + if ( nb < MAXBLUPI ) goto error; + + nb = fwrite(m_move, sizeof(Move), MAXMOVE, file); + if ( nb < MAXMOVE ) goto error; + + nb = fwrite(m_lastDrapeau, sizeof(POINT), MAXLASTDRAPEAU, file); + if ( nb < MAXLASTDRAPEAU ) goto error; + + free(pBuffer); + fclose(file); + return TRUE; + + error: + if ( pBuffer != NULL ) free(pBuffer); + if ( file != NULL ) fclose(file); + return FALSE; +} + +// Lit le décor sur disque. + +BOOL CDecor::Read(int rank, BOOL bUser, int &world, int &time, int &total) +{ + char filename[MAX_PATH]; + FILE* file = NULL; + DescFile* pBuffer = NULL; + int majRev, minRev; + int nb, i, x, y; + OldBlupi oldBlupi; + + Init(-1, -1); + + if ( bUser ) + { + sprintf(filename, "data\\user%.3d.blp", rank); + AddUserPath(filename); + } + else + { + sprintf(filename, "data\\world%.3d.blp", rank); + if ( rank < 200 ) + { + AddCDPath(filename); // ajoute l'accès au CD-Rom + } + } + + file = fopen(filename, "rb"); + if ( file == NULL ) goto error; + + pBuffer = (DescFile*)malloc(sizeof(DescFile)); + if ( pBuffer == NULL ) goto error; + + nb = fread(pBuffer, sizeof(DescFile), 1, file); + if ( nb < 1 ) goto error; + + majRev = pBuffer->majRev; + minRev = pBuffer->minRev; + + if ( majRev == 1 && minRev == 0 ) goto error; + + if ( majRev == 1 && minRev == 3 ) + { + if ( pBuffer->nbDecor != MAXCELX*MAXCELY || + pBuffer->lgDecor != sizeof(Cellule) || + pBuffer->nbBlupi != MAXBLUPI || + pBuffer->lgBlupi != sizeof(OldBlupi)|| + pBuffer->nbMove != MAXMOVE || + pBuffer->lgMove != sizeof(Move) ) goto error; + } + else + { + if ( pBuffer->nbDecor != MAXCELX*MAXCELY || + pBuffer->lgDecor != sizeof(Cellule) || + pBuffer->nbBlupi != MAXBLUPI || + pBuffer->lgBlupi != sizeof(Blupi) || + pBuffer->nbMove != MAXMOVE || + pBuffer->lgMove != sizeof(Move) ) goto error; + } + + SetCoin(pBuffer->celCoin); + if ( bUser ) + { + world = pBuffer->world; + time = pBuffer->time; + total = pBuffer->totalTime; + } + m_celHome = pBuffer->celCoin; + m_term = pBuffer->term; + m_music = pBuffer->music; + m_region = pBuffer->region; + + if ( bUser ) + { + m_skill = pBuffer->skill; + } + + for ( i=0 ; ibuttonExist[i]; + } + + for ( i=0 ; i<4 ; i++ ) + { + m_memoPos[i] = pBuffer->memoPos[i]; + } + + nb = fread(m_decor, sizeof(Cellule), MAXCELX*MAXCELY/4, file); + if ( nb < MAXCELX*MAXCELY/4 ) goto error; + if ( majRev == 1 && minRev < 5 ) + { + for ( x=0 ; x= 128 && + m_decor[x][y].objectIcon <= 130 ) + { + m_decor[x][y].objectIcon -= 128-17; + } + } + } + } + + if ( majRev == 1 && minRev == 3 ) + { + memset(m_blupi, 0, sizeof(Blupi)*MAXBLUPI); + for ( i=0 ; imajRev; + minRev = pBuffer->minRev; + + if ( majRev == 1 && minRev == 0 ) goto error; + + if ( majRev == 1 && minRev == 3 ) + { + if ( pBuffer->nbDecor != MAXCELX*MAXCELY || + pBuffer->lgDecor != sizeof(Cellule) || + pBuffer->nbBlupi != MAXBLUPI || + pBuffer->lgBlupi != sizeof(OldBlupi)|| + pBuffer->nbMove != MAXMOVE || + pBuffer->lgMove != sizeof(Move) ) goto error; + } + else + { + if ( pBuffer->nbDecor != MAXCELX*MAXCELY || + pBuffer->lgDecor != sizeof(Cellule) || + pBuffer->nbBlupi != MAXBLUPI || + pBuffer->lgBlupi != sizeof(Blupi) || + pBuffer->nbMove != MAXMOVE || + pBuffer->lgMove != sizeof(Move) ) goto error; + } + + world = pBuffer->world; + time = pBuffer->time; + total = pBuffer->totalTime; + + free(pBuffer); + fclose(file); + return TRUE; + + error: + if ( pBuffer != NULL ) free(pBuffer); + if ( file != NULL ) fclose(file); + return FALSE; +} + + +#define MARG 18 + +// Initialise un décor neutre. + +void CDecor::Flush() +{ + int x, y, i, icon; + + Init(-1, -1); + + for ( x=0 ; x MAXCELX-MARG || + y < MARG || y > MAXCELY-MARG ) + { + icon = 14; // eau + goto put; + } + + if ( x == MARG && y == MARG ) + { + icon = 12; + goto put; + } + if ( x == MAXCELX-MARG && y == MARG ) + { + icon = 13; + goto put; + } + if ( x == MARG && y == MAXCELY-MARG ) + { + icon = 11; + goto put; + } + if ( x == MAXCELX-MARG && y == MAXCELY-MARG ) + { + icon = 10; + goto put; + } + + if ( x == MARG ) + { + icon = 4; + goto put; + } + if ( x == MAXCELX-MARG ) + { + icon = 2; + goto put; + } + if ( y == MARG ) + { + icon = 5; + goto put; + } + if ( y == MAXCELY-MARG ) + { + icon = 3; + goto put; + } + + icon = 1; // terre + + put: + m_decor[x/2][y/2].floorChannel = CHFLOOR; + m_decor[x/2][y/2].floorIcon = icon; + } + } + + for ( i=0 ; iIsPalette(); + + m_colors[MAP_CADRE] = m_pPixmap->SearchColor(255,0,0); // rouge + m_colors[MAP_FOG] = m_pPixmap->SearchColor(0,0,0); // noir + m_colors[MAP_BLUPI] = m_pPixmap->SearchColor(255,255,0); // jaune + m_colors[MAP_SEE] = m_pPixmap->SearchColor(102,102,204); // bleu + m_colors[MAP_DALLE] = m_pPixmap->SearchColor(192,192,192); // gris + m_colors[MAP_PERSO] = m_pPixmap->SearchColor(255,0,0); // rouge + m_colors[MAP_NURSE] = m_pPixmap->SearchColor(255,0,0); // rouge + m_colors[MAP_ROC] = m_pPixmap->SearchColor(214,214,214); // gris clair + m_colors[MAP_MUR] = m_pPixmap->SearchColor(100,100,100); // gris moyen + m_colors[MAP_EGG] = m_pPixmap->SearchColor(255,255,255); // blanc + m_colors[MAP_FIRE] = m_pPixmap->SearchColor(255,0,0); // rouge + m_colors[MAP_TOMAT] = m_pPixmap->SearchColor(255,0,0); // rouge + m_colors[MAP_BUILD] = m_pPixmap->SearchColor(0,0,0); // noir + m_colors[MAP_ENNEMI]= m_pPixmap->SearchColor(0,192,255); // bleu métal + m_colors[MAP_FLEUR] = m_pPixmap->SearchColor(255,206,0); // jaune + + m_colors[MAP_TREE] = m_pPixmap->SearchColor(0,102,0); // vert foncé + m_colors[MAP_HERB1] = m_pPixmap->SearchColor(0,204,51); // vert clair + m_colors[MAP_HERB2] = m_pPixmap->SearchColor(0,156,8); // vert moyen + m_colors[MAP_TERRE] = m_pPixmap->SearchColor(94,78,12); // brun + + if ( m_region == 1 ) // palmiers + { + m_colors[MAP_TREE] = m_pPixmap->SearchColor(38,197,42); + m_colors[MAP_HERB1] = m_pPixmap->SearchColor(184,140,1); + m_colors[MAP_HERB2] = m_pPixmap->SearchColor(145,110,5); + m_colors[MAP_TERRE] = m_pPixmap->SearchColor(192,192,192); + } + + if ( m_region == 2 ) // hiver + { + m_colors[MAP_TREE] = m_pPixmap->SearchColor(152,205,222); + m_colors[MAP_HERB1] = m_pPixmap->SearchColor(219,234,239); + m_colors[MAP_HERB2] = m_pPixmap->SearchColor(223,173,90); + m_colors[MAP_TERRE] = m_pPixmap->SearchColor(152,205,222); + } + + if ( m_region == 3 ) // sapins + { + m_colors[MAP_TREE] = m_pPixmap->SearchColor(0,102,0); + m_colors[MAP_HERB1] = m_pPixmap->SearchColor(38,197,42); + m_colors[MAP_HERB2] = m_pPixmap->SearchColor(140,140,0); + m_colors[MAP_TERRE] = m_pPixmap->SearchColor(172,178,173); + } +} + + +// COnversion d'un cellule en point dans la carte. + +POINT CDecor::ConvCelToMap(POINT cel) +{ + POINT pos; + + pos.x = (cel.x-m_celCoin.x)-(cel.y-m_celCoin.y); + pos.y = ((cel.x-m_celCoin.x)+(cel.y-m_celCoin.y))/2; + + pos.x += (DIMMAPX-MAPCADREX)/2; + pos.y += (DIMMAPY-MAPCADREY)/2; + + return pos; +} + +// Conversion d'un point dans la carte en cellule. + +POINT CDecor::ConvMapToCel(POINT pos) +{ + POINT cel; + + pos.x -= ((DIMMAPX-MAPCADREX)/4)*2; + pos.y -= ((DIMMAPY-MAPCADREY)/4)*2; + + cel.x = pos.y + pos.x/2; + cel.y = pos.y - pos.x/2; + + cel.x += m_celCoin.x; + cel.y += m_celCoin.y; + + return cel; +} + + +// Déplace le décor suite à un clic dans la carte. + +BOOL CDecor::MapMove(POINT pos) +{ + POINT cel; + + if ( pos.x >= POSMAPX && pos.x < POSMAPX+DIMMAPX && + pos.y >= POSMAPY && pos.y < POSMAPY+DIMMAPY ) + { + pos.x -= POSMAPX; + pos.y -= POSMAPY; + cel = ConvMapToCel(pos); + cel.x = cel.x-10; + cel.y = cel.y; + SetCoin(cel); + NextPhase(0); // faudra refaire la carte tout de suite + return TRUE; + } + + return FALSE; +} + + +static char color_floor[] = +{ + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, // 0 + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, + MAP_HERB1, MAP_SEE, MAP_SEE, MAP_SEE, + MAP_SEE, MAP_SEE, MAP_SEE, MAP_HERB1, + MAP_SEE, MAP_SEE, MAP_SEE, MAP_HERB1, + MAP_HERB1, MAP_SEE, MAP_SEE, MAP_SEE, + MAP_HERB1, MAP_SEE, MAP_SEE, MAP_HERB1, + MAP_SEE, MAP_SEE, MAP_HERB1, MAP_HERB1, + MAP_HERB1, MAP_SEE, MAP_SEE, MAP_HERB1, + MAP_HERB1, MAP_HERB1, MAP_SEE, MAP_SEE, + MAP_SEE, MAP_HERB1, MAP_HERB1, MAP_SEE, + MAP_SEE, MAP_SEE, MAP_HERB1, MAP_HERB1, + MAP_SEE, MAP_HERB1, MAP_HERB1, MAP_SEE, + MAP_HERB1, MAP_HERB1, MAP_SEE, MAP_SEE, + MAP_SEE, MAP_SEE, MAP_SEE, MAP_SEE, + MAP_DALLE, MAP_DALLE, MAP_DALLE, MAP_DALLE, + MAP_DALLE, MAP_DALLE, MAP_DALLE, MAP_DALLE, // 16 + MAP_DALLE, MAP_DALLE, MAP_DALLE, MAP_DALLE, + MAP_DALLE, MAP_DALLE, MAP_DALLE, MAP_DALLE, + MAP_DALLE, MAP_DALLE, MAP_DALLE, MAP_DALLE, + MAP_HERB2, MAP_HERB2, MAP_HERB2, MAP_HERB2, + MAP_HERB1, MAP_HERB2, MAP_HERB2, MAP_HERB2, + MAP_HERB2, MAP_HERB2, MAP_HERB2, MAP_HERB1, + MAP_HERB2, MAP_HERB2, MAP_HERB2, MAP_HERB1, + MAP_HERB1, MAP_HERB2, MAP_HERB2, MAP_HERB2, + MAP_HERB2, MAP_HERB2, MAP_HERB2, MAP_HERB1, + MAP_HERB1, MAP_HERB2, MAP_HERB2, MAP_HERB1, + MAP_HERB1, MAP_HERB2, MAP_HERB2, MAP_HERB2, + MAP_HERB1, MAP_HERB2, MAP_HERB2, MAP_HERB1, + MAP_HERB2, MAP_HERB2, MAP_HERB2, MAP_HERB2, + MAP_HERB1, MAP_HERB2, MAP_HERB2, MAP_HERB2, + MAP_HERB2, MAP_HERB2, MAP_HERB2, MAP_HERB2, + MAP_HERB2, MAP_HERB2, MAP_HERB2, MAP_HERB1, // 32 + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_HERB1, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_HERB1, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_HERB1, + MAP_HERB1, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_HERB1, + MAP_HERB1, MAP_TERRE, MAP_TERRE, MAP_HERB1, + MAP_HERB1, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_HERB1, MAP_TERRE, MAP_TERRE, MAP_HERB1, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_HERB1, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_HERB1, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, // 48 + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, + MAP_NURSE, MAP_NURSE, MAP_NURSE, MAP_NURSE, + MAP_NURSE, MAP_NURSE, MAP_NURSE, MAP_NURSE, + MAP_NURSE, MAP_NURSE, MAP_NURSE, MAP_NURSE, + MAP_NURSE, MAP_NURSE, MAP_NURSE, MAP_NURSE, + MAP_NURSE, MAP_NURSE, MAP_NURSE, MAP_NURSE, + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, // 64 + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_SEE, MAP_SEE, MAP_SEE, MAP_SEE, + MAP_SEE, MAP_SEE, MAP_SEE, MAP_SEE, + MAP_SEE, MAP_SEE, MAP_SEE, MAP_SEE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, +}; + +static char color_object[] = +{ + 0, MAP_TREE, 0, MAP_TREE, + MAP_TREE, 0, MAP_TREE, 0, + 0, MAP_TREE, 0, MAP_TREE, + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + + 0, MAP_TREE, 0, MAP_TREE, // arbre + MAP_TREE, 0, MAP_TREE, 0, + 0, MAP_TREE, 0, MAP_TREE, + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + + 0, MAP_TREE, 0, MAP_TREE, // sapin + MAP_TREE, 0, MAP_TREE, 0, + 0, MAP_TREE, 0, MAP_TREE, + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, // palmiers + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, + + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, // mur + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, // maison + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, + + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, // arbre sans feuille + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, + + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, // planches + + MAP_ROC, MAP_ROC, MAP_ROC, MAP_ROC, // rochers + MAP_ROC, MAP_ROC, MAP_ROC, MAP_ROC, + MAP_ROC, MAP_ROC, MAP_ROC, MAP_ROC, + MAP_ROC, MAP_ROC, MAP_ROC, MAP_ROC, + MAP_ROC, MAP_ROC, MAP_ROC, MAP_ROC, + MAP_ROC, MAP_ROC, MAP_ROC, MAP_ROC, + MAP_ROC, MAP_ROC, MAP_ROC, MAP_ROC, + MAP_ROC, MAP_ROC, MAP_ROC, MAP_ROC, // pierres + + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, // feu + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, // test + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, // tomates + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, + + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, // cabane + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, + + MAP_EGG, MAP_EGG, MAP_EGG, MAP_EGG, // oeufs + MAP_EGG, MAP_EGG, MAP_EGG, MAP_EGG, + + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, // palissade + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, // pont construction + MAP_MUR, MAP_MUR, MAP_MUR, MAP_MUR, + + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, // rayon + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, // bouteille + + MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, // fleurs + MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, + MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, + MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, + + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, // dynamite + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, + + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, // poison + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, + + MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, + MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, MAP_FLEUR, + + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, // ennemi piégé + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, + + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, // usine + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, // barrière + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, // maison + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, // ennemi piégé + + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI,MAP_ENNEMI, + + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, // bateau + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, // jeep + + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, // usine + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, // mine de fer + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, + + MAP_TERRE, MAP_TERRE, MAP_TERRE, MAP_TERRE, // fer + MAP_EGG, MAP_EGG, MAP_EGG, MAP_EGG, // drapeau + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, // mine + MAP_BUILD, MAP_BUILD, MAP_BUILD, MAP_BUILD, + MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, MAP_TOMAT, // mine +}; + +static char color_deffog[4] = +{ + MAP_FOG, MAP_FOG, MAP_FOG, MAP_FOG, +}; + +static char color_deftree[4] = +{ + MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE, +}; + +static char color_deffloor[4] = +{ + MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1, +}; + +static char color_fire[4] = +{ + MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE, +}; + +// Met le contenu d'une cellule dans le bitmap de la carte +// (sol, objets et brouillard). + +void CDecor::MapPutCel(POINT pos) +{ + POINT cel, fogCel; + int icon, i; + char* pColors; + + cel = ConvMapToCel(pos); + cel.x = (cel.x/2)*2; + cel.y = (cel.y/2)*2; + + if ( !IsValid(cel) ) + { + pColors = color_deffog; + goto color; + } + + if ( m_bFog ) + { +// fogPos.x = (pos.x/4)*4; +// fogPos.y = (pos.y/4)*4; +// fogCel = ConvMapToCel(fogPos); + fogCel = cel; + fogCel.x = (fogCel.x/4)*4; + fogCel.y = (fogCel.y/4)*4; + if ( fogCel.x < 0 || fogCel.x >= MAXCELX || + fogCel.y < 0 || fogCel.y >= MAXCELY || + m_decor[fogCel.x/2][fogCel.y/2].fog == FOGHIDE ) // caché ? + { + pColors = color_deffog; + goto color; + } + } + + icon = m_decor[cel.x/2][cel.y/2].objectIcon; + if ( icon != -1 ) + { + if ( m_decor[cel.x/2][cel.y/2].fire > 0 && + m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) + { + pColors = color_fire; + goto color; + } + + if ( icon >= 0 && icon <= 127 ) pColors = color_object+4*(icon-0); + else pColors = color_deftree; + goto color; + } + + icon = m_decor[cel.x/2][cel.y/2].floorIcon; + if ( icon >= 0 && icon <= 71 ) pColors = color_floor+4*(icon-0); + else pColors = color_deffloor; + + color: + if ( g_bPalette ) + { + for ( i=0 ; i<4 ; i++ ) + { + if ( pos.x+i >= 0 && pos.x+i < DIMMAPX ) + { + icon = *pColors++; + if ( icon != 0 ) + { + g_map8_bits[pos.y][pos.x+i] = (char)m_colors[icon]; + } + } + } + } + else + { + for ( i=0 ; i<4 ; i++ ) + { + if ( pos.x+i >= 0 && pos.x+i < DIMMAPX ) + { + icon = *pColors++; + if ( icon != 0 ) + { + g_map16_bits[pos.y][pos.x+i] = m_colors[icon]; + } + } + } + } +} + + +// Génère la carte. + +BOOL CDecor::GenerateMap() +{ + HBITMAP hbm; + POINT dim, pos, cel; + int dx, rank, i; + + if ( m_phase != -1 && m_phase%20 != 0 ) return TRUE; + + // Dessine le décor (sol, objets et brouillard). + for ( pos.y=0 ; pos.y= 0 && pos.x < DIMMAPX-1 && + pos.y >= 0 && pos.y < DIMMAPY-1 ) + { + if ( m_blupi[rank].perso == 0 || + m_blupi[rank].perso == 8 ) i = MAP_BLUPI; + else i = MAP_PERSO; + if ( g_bPalette ) + { + g_map8_bits[pos.y+0][pos.x+0] = (char)m_colors[i]; + g_map8_bits[pos.y+0][pos.x+1] = (char)m_colors[i]; + g_map8_bits[pos.y+1][pos.x+0] = (char)m_colors[i]; + g_map8_bits[pos.y+1][pos.x+1] = (char)m_colors[i]; + } + else + { + g_map16_bits[pos.y+0][pos.x+0] = m_colors[i]; + g_map16_bits[pos.y+0][pos.x+1] = m_colors[i]; + g_map16_bits[pos.y+1][pos.x+0] = m_colors[i]; + g_map16_bits[pos.y+1][pos.x+1] = m_colors[i]; + } + } + } + } + + // Dessine le cadre. + cel = m_celCoin; + pos = ConvCelToMap(cel); + + if ( g_bPalette ) + { + for ( i=pos.x ; iCache(CHMAP, hbm, dim); + + pos.x = POSMAPX; + pos.y = POSMAPY; + m_pPixmap->DrawIcon(-1, CHMAP, 0, pos); + + DeleteObject(hbm); + return TRUE; +} + diff --git a/decmove.cpp b/decmove.cpp new file mode 100644 index 0000000..8302232 --- /dev/null +++ b/decmove.cpp @@ -0,0 +1,1120 @@ +// DecMove.cpp +// + +#include +#include "DECOR.H" +#include "MISC.H" +#include "DECMOVE.h" + +// Mouvement pour secouer un arbre +// (synchrone avec ACTION_PIOCHE). +static short table_move1[] = +{ + 9*4, // nb + 0,0, 0,0, 0,0, 0,0, + -2,0, +2,0, -1,0, +1,0, + 0,0, 0,0, 0,0, 0,0, + -2,0, +2,0, -1,0, +1,0, + 0,0, 0,0, 0,0, 0,0, + 0,0, 0,0, 0,0, 0,0, + -2,0, +2,0, -1,0, +1,0, + 0,0, 0,0, 0,0, 0,0, + -2,0, +2,0, -1,0, +1,0, +}; + +// Mouvement pour faire sauter un objet (est) sur blupi +// (synchrone avec ACTION_TAKE). +static short table_move2[] = +{ + 9+19, // nb + 0,0, 0,0, + 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, + 0,-10, + 0,-20, + 0,-30, + 0,-40, + -1,-50, + -3,-60, + -7,-70, + -15,-80, + -22,-70, + -30,-56, + -30,-56, + -30,-56, + -30,-56, + -30,-56, + -30,-56, + -30,-56, + -30,-56, + -30,-56, + -30,-56, +}; + +// Mouvement pour faire sauter un objet (sud) sur blupi +// (synchrone avec ACTION_TAKE2). +static short table_move3[] = +{ + 9+19, // nb + 0,0, 0,0, + 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, + 0,-10, + 0,-20, + 0,-30, + 0,-40, + 1,-50, + 3,-60, + 7,-70, + 15,-80, + 22,-70, + 30,-56, + 30,-56, + 30,-56, + 30,-56, + 30,-56, + 30,-56, + 30,-56, + 30,-56, + 30,-56, + 30,-56, +}; + +// Mouvement pour déposer un objet (est) sur blupi +// (synchrone avec ACTION_DEPOSE). +static short table_move4[] = +{ + 10, // nb + -30,-60, + -22,-70, + -15,-80, + -7,-70, + -3,-60, + -1,-50, + 0,-40, + 0,-30, + 0,-20, + 0,-10, +}; + +// Mouvement pour déposer un objet (sud) sur blupi +// (synchrone avec ACTION_DEPOSE2). +static short table_move5[] = +{ + 10, // nb + 30,-60, + 22,-70, + 15,-80, + 7,-70, + 3,-60, + 1,-50, + 0,-40, + 0,-30, + 0,-20, + 0,-10, +}; + +// Mouvement pour pousser un pont vers l'est. +static short table_move6[] = +{ + 40, // nb + +2,+1, + +4,+2, + +6,+3, + +8,+4, + +10,+5, + +12,+6, + +14,+7, + +16,+8, + +18,+9, + +20,+10, + +22,+11, + +24,+12, + +26,+13, + +28,+14, + +30,+15, + +32,+16, + +34,+17, + +36,+18, + +38,+19, + +40,+20, + +42,+21, + +44,+22, + +46,+23, + +48,+24, + +50,+25, + +52,+26, + +54,+27, + +56,+28, + +58,+29, + +60,+30, + +60,+30, + +60,+30, + +60,+30, + +60,+30, + +60,+30, + +60,+30, + +60,+30, + +60,+30, + +60,+30, + +60,+30, +}; + +// Mouvement pour pousser un pont vers l'ouest. +static short table_move7[] = +{ + 40, // nb + -2,-1, + -4,-2, + -6,-3, + -8,-4, + -10,-5, + -12,-6, + -14,-7, + -16,-8, + -18,-9, + -20,-10, + -22,-11, + -24,-12, + -26,-13, + -28,-14, + -30,-15, + -32,-16, + -34,-17, + -36,-18, + -38,-19, + -40,-20, + -42,-21, + -44,-22, + -46,-23, + -48,-24, + -50,-25, + -52,-26, + -54,-27, + -56,-28, + -58,-29, + -60,-30, + -60,-30, + -60,-30, + -60,-30, + -60,-30, + -60,-30, + -60,-30, + -60,-30, + -60,-30, + -60,-30, + -60,-30, +}; + +// Mouvement pour pousser un pont vers le sud. +static short table_move8[] = +{ + 40, // nb + -2,+1, + -4,+2, + -6,+3, + -8,+4, + -10,+5, + -12,+6, + -14,+7, + -16,+8, + -18,+9, + -20,+10, + -22,+11, + -24,+12, + -26,+13, + -28,+14, + -30,+15, + -32,+16, + -34,+17, + -36,+18, + -38,+19, + -40,+20, + -42,+21, + -44,+22, + -46,+23, + -48,+24, + -50,+25, + -52,+26, + -54,+27, + -56,+28, + -58,+29, + -60,+30, + -60,+30, + -60,+30, + -60,+30, + -60,+30, + -60,+30, + -60,+30, + -60,+30, + -60,+30, + -60,+30, + -60,+30, +}; + +// Mouvement pour pousser un pont vers le nord. +static short table_move9[] = +{ + 40, // nb + +2,-1, + +4,-2, + +6,-3, + +8,-4, + +10,-5, + +12,-6, + +14,-7, + +16,-8, + +18,-9, + +20,-10, + +22,-11, + +24,-12, + +26,-13, + +28,-14, + +30,-15, + +32,-16, + +34,-17, + +36,-18, + +38,-19, + +40,-20, + +42,-21, + +44,-22, + +46,-23, + +48,-24, + +50,-25, + +52,-26, + +54,-27, + +56,-28, + +58,-29, + +60,-30, + +60,-30, + +60,-30, + +60,-30, + +60,-30, + +60,-30, + +60,-30, + +60,-30, + +60,-30, + +60,-30, + +60,-30, +}; + +// Mouvement pour secouer le laboratoire. +static short table_move10[] = +{ + 16*4, // nb + -2,0, +2,0, -2,0, +2,0, + -2,0, +2,0, -2,0, +2,0, + -2,0, +2,0, -2,0, +2,0, + -2,0, +2,0, -2,0, +2,0, + -1,0, +1,0, -1,0, +1,0, + -1,0, +1,0, -1,0, +1,0, + -1,0, +1,0, -1,0, +1,0, + 0,0, 0,0, 0,0, 0,0, + 0,0, 0,0, 0,0, 0,0, + -2,0, +2,0, -2,0, +2,0, + -2,0, +2,0, -2,0, +2,0, + -2,0, +2,0, -2,0, +2,0, + -2,0, +2,0, -2,0, +2,0, + -1,0, +1,0, -1,0, +1,0, + -1,0, +1,0, -1,0, +1,0, + -1,0, +1,0, -1,0, +1,0, +}; + +// Mouvement pour secouer la mine. +static short table_move11[] = +{ + 20*4, // nb + 0,-1, 0,+1, 0,-1, 0,+1, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,0, 0,0, 0,0, 0,0, + 0,0, 0,0, 0,0, 0,0, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,0, 0,0, 0,0, 0,0, + 0,0, 0,0, 0,0, 0,0, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,0, 0,0, 0,0, 0,0, + 0,0, 0,0, 0,0, 0,0, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,0, 0,0, 0,0, 0,0, + 0,0, 0,0, 0,0, 0,0, + 0,-1, 0,+1, 0,-1, 0,+1, + 0,-1, 0,+1, 0,-1, 0,+1, +}; + +// Mouvement pour secouer l'usine. +static short table_move12[] = +{ + 20*4, // nb + -1,0, +1,0, -1,0, +1,0, + 0,-1, 0,+1, 0,-1, 0,+1, + -1,0, +1,0, -1,0, +1,0, + 0,0, 0,0, 0,0, 0,0, + 0,0, 0,0, 0,0, 0,0, + -2,0, +2,0, 0,+1, 0,+1, + -2,0, +2,0, 0,+1, 0,+1, + -1,0, +1,0, -1,0, +1,0, + -2,0, +2,0, 0,+1, 0,+1, + 0,0, 0,0, 0,0, 0,0, + -1,0, +1,0, -1,0, +1,0, + -1,0, +1,0, -1,0, +1,0, + 0,-1, 0,+1, 0,-2, 0,+2, + -1,0, +1,0, -1,0, +1,0, + 0,0, 0,0, 0,0, 0,0, + -1,0, +1,0, -1,0, +1,0, + -2,0, +2,0, 0,+1, 0,+1, + -2,0, +2,0, 0,+1, 0,+1, + 0,0, 0,0, 0,0, 0,0, + -2,0, +2,0, 0,+1, 0,+1, +}; + +short* GetListMoves(int rank) +{ + if ( rank == 1 ) return table_move1; + if ( rank == 2 ) return table_move2; + if ( rank == 3 ) return table_move3; + if ( rank == 4 ) return table_move4; + if ( rank == 5 ) return table_move5; + if ( rank == 6 ) return table_move6; + if ( rank == 7 ) return table_move7; + if ( rank == 8 ) return table_move8; + if ( rank == 9 ) return table_move9; + if ( rank == 10 ) return table_move10; + if ( rank == 11 ) return table_move11; + if ( rank == 12 ) return table_move12; + + return NULL; +} + + +// Petites flammes. +static short table_icon1[] = +{ + 8*3, + 49,50,51,52,50,49,51,52, + 49,52,51,50,49,52,50,49, + 52,51,50,49,51,52,49,51, +}; + +// Grandes flammes. +static short table_icon2[] = +{ + 8*3, + 45,46,47,48,46,45,48,47, + 46,45,48,47,45,48,47,48, + 46,45,48,47,45,48,47,46, +}; + +// Eclairs de la dalle nurserie. +static short table_icon3[] = +{ + 4, // nb + 53,54,55,56, +}; + +// Eclairs n-s entre les tours. +static short table_icon4[] = +{ + 8*4, // nb + 74,76,78,76,74,78,74,76, + 78,76,74,76,74,76,78,76, + 74,78,76,74,76,78,74,76, + 78,74,76,78,74,76,74,78, +}; + +// Eclairs e-o entre les tours. +static short table_icon5[] = +{ + 8*4, // nb + 75,77,75,79,75,77,79,75, + 79,77,75,77,75,79,75,79, + 75,77,79,75,75,77,79,75, + 79,75,77,79,75,79,75,79, +}; + +// Explosion de la dynamite. +static short table_icon6[] = +{ + 7+30, // nb + 91,90,89,88,89,90,91, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +}; + +// Mèche de la dynamite. +static short table_icon7[] = +{ + 12*4, // nb + 86,87,86,87,86,87,86,87,86,87,86,87, + 86,87,86,87,86,87,86,87,86,87,86,87, + 86,87,86,87,86,87,86,87,86,87,86,87, + 86,87,86,87,86,87,86,87,86,87,86,87, +}; + +// Rayons de l'électrocuteur. +static short table_icon8[] = +{ + 10*10, // nb + 75,-1,-1,74,-1,75,-1,74,75,-1, + 74,73,-1,75,74,73,72,74,-1,72, + 73,74,72,73,75,73,72,73,74,72, + 75,72,73,72,-1,74,73,72,75,74, + -1,73,74,75,-1,74,75,-1,75,-1, + 74,75,-1,-1,74,-1,-1,-1,75,-1, + -1,-1,-1,-1,-1,74,-1,-1,-1,75, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,75,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,74, +}; + +// Blupi écrasé. +static short table_icon9[] = +{ + 10*10, // nb + 76,76,76,76,76,76,76,76,76,76, + 76,76,76,76,76,76,76,76,76,76, + 76,76,76,76,76,76,76,76,76,76, + 76,76,76,76,76,76,76,76,76,76, + 76,76,76,76,76,76,76,76,76,76, + 76,76,76,76,76,76,76,76,76,76, + 76,76,76,76,76,76,76,76,76,76, + 76,76,76,76,76,76,76,76,76,76, + 76,76,76,76,76,76,76,76,76,76, + 76,76,76,76,76,76,76,76,76,76, +}; + +// Blupi malade écrasé. +static short table_icon10[] = +{ + 10*10, // nb + 77,77,77,77,77,77,77,77,77,77, + 77,77,77,77,77,77,77,77,77,77, + 77,77,77,77,77,77,77,77,77,77, + 77,77,77,77,77,77,77,77,77,77, + 77,77,77,77,77,77,77,77,77,77, + 77,77,77,77,77,77,77,77,77,77, + 77,77,77,77,77,77,77,77,77,77, + 77,77,77,77,77,77,77,77,77,77, + 77,77,77,77,77,77,77,77,77,77, + 77,77,77,77,77,77,77,77,77,77, +}; + +// Eclairs de la dalle téléporteur. +static short table_icon11[] = +{ + 4, // nb + 81,82,83,84, +}; + +short* GetListIcons(int rank) +{ + if ( rank == 1 ) return table_icon1; + if ( rank == 2 ) return table_icon2; + if ( rank == 3 ) return table_icon3; + if ( rank == 4 ) return table_icon4; + if ( rank == 5 ) return table_icon5; + if ( rank == 6 ) return table_icon6; + if ( rank == 7 ) return table_icon7; + if ( rank == 8 ) return table_icon8; + if ( rank == 9 ) return table_icon9; + if ( rank == 10 ) return table_icon10; + if ( rank == 11 ) return table_icon11; + + return NULL; +} + + + + +// Supprime tous les décors animés. + +void CDecor::MoveFlush() +{ + int i, x, y; + + for ( i=0 ; i= 1 ) return (MAXFIRE/4)*3; + return MAXFIRE; +} + +// Initialise tous les mouvements perpétuels du décor. + +void CDecor::MoveFixInit() +{ + int x, y; + + MoveFlush(); + + for ( x=0 ; x 0 && + m_decor[x/2][y/2].fire < MoveMaxFire() ) + { + MoveStartFire(GetCel(x,y)); + } + + // Démarre les éclairs entre les tours. + if ( m_decor[x/2][y/2].objectIcon == 10000 ) // éclair n-s + { + if ( MoveCreate(GetCel(x,y), -1, FALSE, CHOBJECT,-1, + -1,-1, 9999,1,0, TRUE) ) + { + MoveAddIcons(GetCel(x,y), 4, TRUE); // éclairs n-s + } + } + + if ( m_decor[x/2][y/2].objectIcon == 10001 ) // éclair e-o + { + if ( MoveCreate(GetCel(x,y), -1, FALSE, CHOBJECT,-1, + -1,-1, 9999,1,0, TRUE) ) + { + MoveAddIcons(GetCel(x,y), 5, TRUE); // éclairs e-o + } + } + } + } +} + +// Crée un nouveau décor animé. +// Si bMisc=TRUE, on garde 10 mouvements en réserve pour +// des actions importantes (bMisc=FALSE). + +BOOL CDecor::MoveCreate(POINT cel, int rankBlupi, BOOL bFloor, + int channel, int icon, + int maskChannel, int maskIcon, + int total, int delai, int stepY, + BOOL bMisc, BOOL bNotIfExist) +{ + int rank, max; + + for ( rank=0 ; rank MAXMOVE-10 ) return FALSE; + goto create; + } + max ++; + } + return FALSE; + + create: + m_move[rank].bExist = TRUE; + m_move[rank].cel = cel; + m_move[rank].rankBlupi = rankBlupi; + m_move[rank].bFloor = bFloor; + m_move[rank].channel = channel; + m_move[rank].icon = icon; + m_move[rank].maskChannel = maskChannel; + m_move[rank].maskIcon = maskIcon; + m_move[rank].total = total; + m_move[rank].delai = delai; + m_move[rank].stepY = stepY; + m_move[rank].cTotal = 0; + m_move[rank].cDelai = 0; + m_move[rank].rankMoves = 0; + m_move[rank].rankIcons = 0; + m_move[rank].phase = 0; + + m_decor[cel.x/2][cel.y/2].rankMove = rank; + return TRUE; +} + +// Ajoute un mouvement. + +BOOL CDecor::MoveAddMoves(POINT cel, int rankMoves) +{ + int rank; + + for ( rank=0 ; rank= 6 && icon <= 11) || // arbres ? + (icon >= 65 && icon <= 71) || // palissade ? + icon == 61 || // cabane ? + icon == 36 || // planches ? + icon == 60 || // tomates ? + icon == 63 || // oeufs ? + icon == 113 || // maison ? + icon == 121 || // mine de fer ? + icon == 122) ) // mine de fer ? + { + if ( !MoveCreate(cel, -1, FALSE, CHOBJECT,-1, + -1,-1, 9999,1,0, TRUE) ) return FALSE; + MoveAddIcons(cel, 1, TRUE); // petites flammes + + m_decor[cel.x/2][cel.y/2].fire = 2; + return TRUE; + } + + // S'il y a un autre objet -> pas de feu ! + if ( channel >= 0 ) return FALSE; + + channel = m_decor[cel.x/2][cel.y/2].floorChannel; + icon = m_decor[cel.x/2][cel.y/2].floorIcon; + + if ( channel == CHFLOOR && + (icon == 20 || // herbe foncée ? + (icon >= 59 && icon <= 64)) ) // pont ? + { + if ( !MoveCreate(cel, -1, FALSE, CHOBJECT,-1, + -1,-1, 9999,1,0, TRUE) ) return FALSE; + MoveAddIcons(cel, 1, TRUE); // petites flammes + + m_decor[cel.x/2][cel.y/2].fire = 2; + return TRUE; + } + + return FALSE; +} + +// Démarre le feu si c'est possible par proximité. + +void CDecor::MoveProxiFire(POINT cel) +{ + int cx, cy, xx, yy, x, y, channel, icon; + + static short tableInd[5] = {2,1,3,0,4}; + static short tablePos[5*5*2] = + { + 0, 0, -1,-2, 0,-2, +1,-2, 0, 0, + -2,-1, -1,-1, 0,-1, +1,-1, +2,-1, + -2, 0, -1, 0, 0, 0, +1, 0, +2, 0, + -2,+1, -1,+1, 0,+1, +1,+1, +2,+1, + 0, 0, -1,+2, 0,+2, +1,+2, 0, 0, + }; + + for ( cx=0 ; cx<5 ; cx++ ) + { + for ( cy=0 ; cy<5 ; cy++ ) + { + xx = tablePos[(tableInd[cx]+tableInd[cy]*5)*2+0]; + yy = tablePos[(tableInd[cx]+tableInd[cy]*5)*2+1]; + + if ( xx == 0 && yy == 0 ) continue; + + x = cel.x + xx*2; + y = cel.y + yy*2; + + if ( x < 0 || x >= MAXCELX || + y < 0 || y >= MAXCELX ) continue; + + if ( m_decor[x/2][y/2].fire != 0 ) continue; // brule déjà ? + + x = ((cel.x + xx)/2)*2; + y = ((cel.y + yy)/2)*2; + + // Mur ou rochers entre le feu et l'objet ? + channel = m_decor[x/2][y/2].objectChannel; + icon = m_decor[x/2][y/2].objectIcon; + if ( channel == CHOBJECT && + ((icon >= 20 && icon <= 26)|| + (icon >= 37 && icon <= 43)) ) continue; + + x = cel.x + xx*2; + y = cel.y + yy*2; + + // Mur ou rochers entre le feu et l'objet ? + channel = m_decor[x/2][y/2].objectChannel; + icon = m_decor[x/2][y/2].objectIcon; + if ( channel == CHOBJECT && + ((icon >= 20 && icon <= 26)|| + (icon >= 37 && icon <= 43)) ) continue; + + // Démarre éventuellement un seul foyer. + if ( MoveStartFire(GetCel(x,y)) ) return; + } + } +} + +// Fait évoluer le feu. + +void CDecor::MoveFire(int rank) +{ + int x, y, icon, newIcon; + POINT pos; + + x = (m_move[rank].cel.x/2)*2; + y = (m_move[rank].cel.y/2)*2; + + if ( m_decor[x/2][y/2].fire == 0 || + m_decor[x/2][y/2].fire >= MoveMaxFire() ) return; + + m_decor[x/2][y/2].fire ++; + + pos = ConvCelToPos(GetCel(x,y)); + m_pSound->PlayImage(SOUND_FEU, pos); + + if ( m_decor[x/2][y/2].objectIcon >= 0 ) // objet qui brule ? + { + if ( m_decor[x/2][y/2].fire > MoveMaxFire()/2 && + m_decor[x/2][y/2].fire%50 == 0 ) // pas trop souvent ! + { + MoveProxiFire(GetCel(x,y)); // boutte le feu + } + + // Début petites flammes. + if ( m_decor[x/2][y/2].fire == 2 ) + { + MoveStartFire(GetCel(x,y)); + } + + // Début grandes flammes. + if ( m_decor[x/2][y/2].fire == (MoveMaxFire()-DIMOBJY*2)/2 ) + { + MoveAddIcons(GetCel(x,y), 2, TRUE); // grandes flammes + } + + // Début objet squelette. + if ( m_decor[x/2][y/2].fire == MoveMaxFire()-DIMOBJY*2 ) + { + icon = m_decor[x/2][y/2].floorIcon; + if ( icon == 20 ) // herbe foncée ? + { + PutFloor(GetCel(x,y), CHFLOOR, 19); // herbe brulée + } + + icon = m_decor[x/2][y/2].objectIcon; + newIcon = -1; + if ( icon >= 6 && icon <= 11 ) newIcon = icon-6+30; // arbres ? + if ( icon == 61 ) newIcon = 62; // cabane ? + if ( icon == 113 ) newIcon = 15; // maison ? + if ( icon == 121 ) newIcon = 126; // mine de fer ? + if ( icon == 122 ) newIcon = 126; // mine de fer ? + MoveCreate(GetCel(x,y), -1, FALSE, CHOBJECT,newIcon, + -1,-1, DIMOBJY*2,1,-1*50); + MoveAddIcons(GetCel(x,y), 2, TRUE); // grandes flammes + } + + // Fin grandes flammes. + if ( m_decor[x/2][y/2].fire == MoveMaxFire()-DIMOBJY ) + { + MoveAddIcons(GetCel(x,y), 1, TRUE); // petites flammes + } + + // Fin feu. + if ( m_decor[x/2][y/2].fire == MoveMaxFire()-1 ) + { + MoveFinish(GetCel(x,y)); + icon = m_decor[x/2][y/2].objectIcon; + if ( icon == 36 || // planches ? + icon == 60 || // tomates ? + icon == 63 || // oeufs ? + icon == 113 || // maison ? + (icon >= 65 && icon <= 71) ) // palissade ? + { + m_decor[x/2][y/2].objectChannel = -1; + m_decor[x/2][y/2].objectIcon = -1; + } + m_decor[x/2][y/2].fire = MoveMaxFire(); // déjà brulé + } + } + else // sol qui brule ? + { + if ( m_decor[x/2][y/2].fire > DIMOBJY && + m_decor[x/2][y/2].fire%50 == 0 ) // pas trop souvent ! + { + MoveProxiFire(GetCel(x,y)); // boutte le feu + } + + // Début petites flammes. + if ( m_decor[x/2][y/2].fire == 2 ) + { + MoveStartFire(GetCel(x,y)); + } + + // Milieu feu. + if ( m_decor[x/2][y/2].fire == DIMOBJY ) + { + icon = m_decor[x/2][y/2].floorIcon; + if ( icon == 20 ) // herbe foncée ? + { + PutFloor(GetCel(x,y), CHFLOOR, 19); // herbe brulée + } + if ( icon == 59 ) // pont ? + { + PutFloor(GetCel(x,y), CHFLOOR, 2); // rivage + } + if ( icon == 61 ) // pont ? + { + PutFloor(GetCel(x,y), CHFLOOR, 4); // rivage + } + if ( icon == 62 ) // pont ? + { + PutFloor(GetCel(x,y), CHFLOOR, 3); // rivage + } + if ( icon == 64 ) // pont ? + { + PutFloor(GetCel(x,y), CHFLOOR, 5); // rivage + } + if ( icon == 60 || icon == 63 ) // pont ? + { + PutFloor(GetCel(x,y), CHFLOOR, 14); // eau + } + } + + // Fin feu. + if ( m_decor[x/2][y/2].fire == DIMOBJY*2-1 ) + { + MoveFinish(GetCel(x,y)); + m_decor[x/2][y/2].objectChannel = -1; + m_decor[x/2][y/2].objectIcon = -1; + m_decor[x/2][y/2].fire = MoveMaxFire(); // déjà brulé + } + } +} + +// Fait évoluer tous les décors animés. + +void CDecor::MoveStep(BOOL bFirst) +{ + int rank, rankBlupi; + + for ( rank=0 ; rank 32000 ) + { + m_move[rank].phase = 0; + } + + m_move[rank].cDelai ++; + if ( m_move[rank].cDelai >= m_move[rank].delai ) // délai écoulé ? + { + m_move[rank].cDelai = 0; + + m_move[rank].cTotal ++; + if ( m_move[rank].cTotal > 32000 ) + { + m_move[rank].cTotal = 0; + } + + if ( m_move[rank].total != 9999 && + m_move[rank].cTotal >= m_move[rank].total ) + { + MoveFinish(m_move[rank].cel); + } + } + } + } +} + +// Termine un mouvement pour une cellule donnée. + +void CDecor::MoveFinish(POINT cel) +{ + int rank; + + for ( rank=0 ; rank= 0 && + m_move[rank].icon >= 0 ) + { + if ( m_move[rank].bFloor ) + { + PutFloor(cel, m_move[rank].channel, m_move[rank].icon); + } + else + { + PutObject(cel, m_move[rank].channel, m_move[rank].icon); + } + } + + m_decor[cel.x/2][cel.y/2].rankMove = -1; + m_move[rank].bExist = FALSE; + } + } +} + +// Termine un mouvement, d'après le rang du blupi. + +void CDecor::MoveFinish(int rankBlupi) +{ + int rank; + + for ( rank=0 ; rank +#include +#include +#include +#include "def.h" +#include "resource.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "action.h" +#include "text.h" +#include "misc.h" +#include "fifo.h" +#include "DECMOVE.h" + + +///////////////////////////////////////////////////////////////////////////// + + + +#define TEXTDELAY 10 // délai avant apparition tooltips + +POINT GetCel(int x, int y) +{ + POINT cel; + + cel.x = x; + cel.y = y; + + return cel; +} + +POINT GetCel(POINT cel, int x, int y) +{ + cel.x += x; + cel.y += y; + + return cel; +} + +// Indique si une coordonnée de cellule est valide. +// On ne peut pas aller dans la dernière cellule tout au +// bord (-2) pour permettre de gérer le brouillard proprement +// jusque dans les bords ! + +BOOL IsValid(POINT cel) +{ + if ( cel.x < 2 || cel.x >= MAXCELX-2 || + cel.y < 2 || cel.y >= MAXCELX-2 ) return FALSE; + return TRUE; +} + +// Retourne un vecteur orienté dans une direction donnée. + +POINT GetVector(int direct) +{ + POINT vector; + + vector.x = 0; + vector.y = 0; + + switch ( direct ) + { + case DIRECT_E: + vector.x = +1; + break; + case DIRECT_SE: + vector.x = +1; + vector.y = +1; + break; + case DIRECT_S: + vector.y = +1; + break; + case DIRECT_SO: + vector.x = -1; + vector.y = +1; + break; + case DIRECT_O: + vector.x = -1; + break; + case DIRECT_NO: + vector.x = -1; + vector.y = -1; + break; + case DIRECT_N: + vector.y = -1; + break; + case DIRECT_NE: + vector.x = +1; + vector.y = -1; + break; + } + return vector; +} + +// Constructeur. + +CDecor::CDecor() +{ + m_hWnd = NULL; + m_pSound = NULL; + m_pUndoDecor = NULL; + + m_celCoin.x = 90; + m_celCoin.y = 98; + + m_celHili.x = -1; + m_celOutline1.x = -1; + m_celOutline2.x = -1; + + m_bHiliRect = FALSE; // pas de rectangle de sélection + m_shiftHili = 0; + + m_shiftOffset.x = 0; + m_shiftOffset.y = 0; + + m_nbBlupiHili = 0; + m_rankBlupiHili = -1; + m_rankHili = -1; + + m_bFog = FALSE; + m_bBuild = FALSE; + m_bInvincible = FALSE; + m_bSuper = FALSE; + m_bHideTooltips = FALSE; + m_bInfo = FALSE; + m_infoHeight = 100; + m_phase = 0; + m_totalTime = 0; + m_region = 0; + m_lastRegion = 999; + m_skill = 0; + + Init(CHFLOOR, 0); + BlupiFlush(); + MoveFlush(); + InitDrapeau(); +} + +// Destructeur. + +CDecor::~CDecor() +{ + UndoClose(); // libère le buffer du undo +} + + +// Initialisation générale. + +void CDecor::Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap) +{ + m_hWnd = hWnd; + m_pSound = pSound; + m_pPixmap = pPixmap; + m_bOutline = FALSE; +} + +// Initialise le décor avec un sol plat partout. + +void CDecor::Init(int channel, int icon) +{ + int x, y; + + for ( x=0 ; xCache(CHFLOOR, filename, totalDim, iconDim, FALSE) ) + return FALSE; + m_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu + + totalDim.x = DIMOBJX*16; + totalDim.y = DIMOBJY*8; + iconDim.x = DIMOBJX; + iconDim.y = DIMOBJY; + sprintf(filename, "image\\obj%.3d.blp", m_region); + if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim, FALSE) ) + return FALSE; + m_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu + + sprintf(filename, "image\\obj-o%.3d.blp", m_region); + if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim, FALSE) ) + return FALSE; + m_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc + + MapInitColors(); // init les couleurs pour la carte + + m_bGroundRedraw = TRUE; + return TRUE; +} + +// Met partout du brouillard, sauf aux endroits des blupi. + +void CDecor::ClearFog() +{ + int x, y, rank; + + for ( x=0 ; x= MoveMaxFire() ) // déjà brulé ? + { + m_decor[x][y].fire = 0; // pourra de nouveau bruler + } + + if ( m_decor[x][y].fire > 1 ) // en train de bruler ? + { + m_decor[x][y].fire = 1; // début du feu + } + } + } +} + +// Indique le mode jeu/construction. + +void CDecor::SetBuild(BOOL bBuild) +{ + m_bBuild = bBuild; +} + +// Indique s'il faut tenir compte du brouillard. + +void CDecor::EnableFog(BOOL bEnable) +{ + m_bFog = bEnable; + m_bOutline = FALSE; +} + +// Gestion du mode invincible. + +BOOL CDecor::GetInvincible() +{ + return m_bInvincible; +} + +void CDecor::SetInvincible(BOOL bInvincible) +{ + m_bInvincible = bInvincible; +} + +// Gestion du mode costaud (superblupi). + +BOOL CDecor::GetSuper() +{ + return m_bSuper; +} + +void CDecor::SetSuper(BOOL bSuper) +{ + m_bSuper = bSuper; +} + +// Bascule le mode outline. + +void CDecor::FlipOutline() +{ + m_bOutline = !m_bOutline; + m_timeFlipOutline = m_timeConst+50; +} + +// Initialise un sol dans une cellule. + +BOOL CDecor::PutFloor(POINT cel, int channel, int icon) +{ + if ( cel.x < 0 || cel.x >= MAXCELX || + cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + + m_decor[cel.x/2][cel.y/2].floorChannel = channel; + m_decor[cel.x/2][cel.y/2].floorIcon = icon; + + m_bGroundRedraw = TRUE; + +//? SubDrapeau(cel); // on pourra de nouveau planter un drapeau + + return TRUE; +} + +// Initialise un objet dans une cellule. + +BOOL CDecor::PutObject(POINT cel, int channel, int icon) +{ + if ( cel.x < 0 || cel.x >= MAXCELX || + cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + + if ( icon == -1 ) channel = -1; + + m_decor[cel.x/2][cel.y/2].objectChannel = channel; + m_decor[cel.x/2][cel.y/2].objectIcon = icon; + + SubDrapeau(cel); // on pourra de nouveau planter un drapeau + + return TRUE; +} + +// Retourne un sol dans une cellule. + +BOOL CDecor::GetFloor(POINT cel, int &channel, int &icon) +{ + if ( cel.x < 0 || cel.x >= MAXCELX || + cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + + channel = m_decor[cel.x/2][cel.y/2].floorChannel; + icon = m_decor[cel.x/2][cel.y/2].floorIcon; + + return TRUE; +} + +// Retourne une objet dans une cellule. + +BOOL CDecor::GetObject(POINT cel, int &channel, int &icon) +{ + if ( cel.x < 0 || cel.x >= MAXCELX || + cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + + channel = m_decor[cel.x/2][cel.y/2].objectChannel; + icon = m_decor[cel.x/2][cel.y/2].objectIcon; + + return TRUE; +} + +// Modifie le feu pour une cellule. + +BOOL CDecor::SetFire(POINT cel, BOOL bFire) +{ + if ( cel.x < 0 || cel.x >= MAXCELX || + cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + + m_decor[cel.x/2][cel.y/2].fire = bFire?1:0; + + return TRUE; +} + + +// Modifie l'offset pour le shift. + +void CDecor::SetShiftOffset(POINT offset) +{ + m_shiftOffset = offset; + m_bGroundRedraw = TRUE; +} + +// Convertit la position d'une cellule en coordonnée graphique. + +POINT CDecor::ConvCelToPos(POINT cel) +{ + POINT pos; + + pos.x = ((cel.x-m_celCoin.x)-(cel.y-m_celCoin.y))*(DIMCELX/2); + pos.y = ((cel.x-m_celCoin.x)+(cel.y-m_celCoin.y))*(DIMCELY/2); + + pos.x += POSDRAWX+m_shiftOffset.x; + pos.y += POSDRAWY+m_shiftOffset.y; + + return pos; +} + +// Convertit une coordonnée graphique en cellule. + +POINT CDecor::ConvPosToCel(POINT pos, BOOL bMap) +{ + POINT cel; + + if ( bMap && + pos.x >= POSMAPX && pos.x < POSMAPX+DIMMAPX && + pos.y >= POSMAPY && pos.y < POSMAPY+DIMMAPY ) + { + pos.x -= POSMAPX; + pos.y -= POSMAPY; + return ConvMapToCel(pos); + } + + pos.x -= POSDRAWX+DIMCELX/2; + pos.y -= POSDRAWY; + + cel.x = (pos.y*DIMCELX + pos.x*DIMCELY) / (DIMCELX*DIMCELY); +// cel.y = (pos.y*DIMCELX - pos.x*DIMCELY) / (DIMCELX*DIMCELY); + cel.y = (pos.y*DIMCELX - pos.x*DIMCELY); + if ( cel.y < 0 ) cel.y -= (DIMCELX*DIMCELY); + cel.y /= (DIMCELX*DIMCELY); + + cel.x += m_celCoin.x; + cel.y += m_celCoin.y; + + return cel; +} + +// Convertit une coordonnée graphique en grande cellule (2x2). + +POINT CDecor::ConvPosToCel2(POINT pos) +{ + POINT cel; + + pos.x -= POSDRAWX+DIMCELX/2; + pos.y -= POSDRAWY; + + if ( m_celCoin.x%2 != 0 && m_celCoin.y%2 == 0 ) + { + pos.x += DIMCELX/2; + pos.y += DIMCELY/2; + } + + if ( m_celCoin.x%2 == 0 && m_celCoin.y%2 != 0 ) + { + pos.x -= DIMCELX/2; + pos.y += DIMCELY/2; + } + + if ( m_celCoin.x%2 != 0 && m_celCoin.y%2 != 0 ) + { + pos.y += DIMCELY; + } + + cel.x = (pos.y*DIMCELX*2 + pos.x*DIMCELY*2) / (DIMCELX*2*DIMCELY*2); +// cel.y = (pos.y*DIMCELX*2 - pos.x*DIMCELY*2) / (DIMCELX*2*DIMCELY*2); + cel.y = (pos.y*DIMCELX*2 - pos.x*DIMCELY*2); + if ( cel.y < 0 ) cel.y -= (DIMCELX*2*DIMCELY*2); + cel.y /= (DIMCELX*2*DIMCELY*2); + + cel.x = (cel.x*2+m_celCoin.x)/2*2; + cel.y = (cel.y*2+m_celCoin.y)/2*2; + + return cel; +} + + + +// Attribution des blupi aux différentes cellules. +// Lorsque un blupi a deux positions (courante et destination), +// il faut toujours mettre blupi le plus au fond possible +// (minimiser x et y). + +void CDecor::BuildPutBlupi() +{ + int x, y, dx, dy, xMin, yMin, rank, clipLeft; + POINT pos; + +#if 0 // déjà fait au point (1), voir Build + for ( x=0 ; x m_blupi[rank].cel.x ) xMin = m_blupi[rank].cel.x; + yMin = m_blupi[rank].destCel.y; + if ( yMin > m_blupi[rank].cel.y ) yMin = m_blupi[rank].cel.y; + + // Si blupi entre dans une maison, il faut initialiser + // le clipping à gauche. + m_blupi[rank].clipLeft = 0; // pas de clipping + + if ( !m_bOutline && + xMin > 0 && xMin%2 == 1 && yMin%2 == 1 && + m_decor[xMin/2][yMin/2].objectChannel == CHOBJECT && + (m_decor[xMin/2][yMin/2].objectIcon == 28 || // maison ? + m_decor[xMin/2][yMin/2].objectIcon == 101 || // usine ? + m_decor[xMin/2][yMin/2].objectIcon == 103 || // usine ? + m_decor[xMin/2][yMin/2].objectIcon == 105 || // usine ? + m_decor[xMin/2][yMin/2].objectIcon == 116 || // usine ? + m_decor[xMin/2][yMin/2].objectIcon == 120 || // usine ? + m_decor[xMin/2][yMin/2].objectIcon == 18 || // usine ? + m_decor[xMin/2][yMin/2].objectIcon == 122 || // mine ? + m_decor[xMin/2][yMin/2].objectIcon == 113) && // maison ? + m_blupi[rank].posZ > -DIMBLUPIY ) + { + pos = ConvCelToPos(GetCel(xMin,yMin)); + clipLeft = pos.x+34; + if ( clipLeft < POSDRAWX ) clipLeft = POSDRAWX; + m_blupi[rank].clipLeft = clipLeft; + } + + x = m_blupi[rank].cel.x; + y = m_blupi[rank].cel.y; + + dx = m_blupi[rank].destCel.x - x; + dy = m_blupi[rank].destCel.y - y; + + if ( dx != -dy ) // déplacement non horizontal (ne/so) ? + { + if ( dx < 0 ) x = m_blupi[rank].destCel.x; + if ( dy < 0 ) y = m_blupi[rank].destCel.y; + } + if ( dx == -1 && dy == 1 ) // déplacement "so" ? + { + x = m_blupi[rank].destCel.x; + y = m_blupi[rank].destCel.y; + } + + if ( x%2 != 0 ) + { + if ( IsFreeCelObstacle(GetCel(x,y+0)) && + !IsFreeCelObstacle(GetCel(x,y+1)) ) x --; + } + + if ( x%2 == 0 && y%2 != 0 ) + { + if ( !IsFreeCelObstacle(GetCel(x+1,y)) ) y --; + } + + if ( x%2 != 0 && y%2 != 0 && dx != 0 && dy == 0 ) + { + if ( !IsFreeCelObstacle(GetCel(x+1,y-1)) ) x ++; + } + + if ( m_rankBlupi[x][y] != -1 ) // déjà occupé ? + { + if ( x == m_blupi[rank].cel.x ) + { + x --; + } + else + { + x = m_blupi[rank].cel.x; + } + + if ( m_rankBlupi[x][y] != -1 ) // déjà occupé ? + { + if ( y == m_blupi[rank].cel.y ) + { + y --; + } + else + { + y = m_blupi[rank].cel.y; + } + + if ( m_rankBlupi[x][y] != -1 ) // déjà occupé ? + { +//? OutputDebug(">>> Manque un blupi <<<\n"); + continue; // que faire d'autre ? + } + } + } + m_rankBlupi[x][y] = rank; + } + } +} + +// Dessine une cellule du décor contenant un sol animé. + +void CDecor::BuildMoveFloor(int x, int y, POINT pos, int rank) +{ + int icon, nb; + short* pTable; + + if ( m_move[rank].rankIcons == 0 ) + { + icon = m_move[rank].maskIcon+m_move[rank].cTotal; + + m_pPixmap->BuildIconMask(m_move[rank].maskChannel, + icon, + m_move[rank].channel, + m_move[rank].icon, 0); + + m_pPixmap->DrawIcon(-1, m_move[rank].channel, 0, + pos, 0, TRUE); + } + else + { + pTable = GetListIcons(m_move[rank].rankIcons); + nb = pTable[0]; + icon = pTable[1+m_move[rank].cTotal%nb]; + + if ( m_move[rank].cel.x%2 == 1 ) + { + pos.x += DIMCELX/2; + pos.y += DIMCELY/2; + } + if ( m_move[rank].cel.y%2 == 1 ) + { + pos.x -= DIMCELX/2; + pos.y += DIMCELY/2; + } + + m_pPixmap->DrawIcon(-1, m_move[rank].channel, icon, pos); + } +} + +// Dessine une cellule du décor contenant un objet animé. + +void CDecor::BuildMoveObject(int x, int y, POINT pos, int rank) +{ + int hBuild, offset, startY, endY; + int channel, icon, nb; + short* pTable; + + if ( m_move[rank].rankMoves != 0 ) + { + pTable = GetListMoves(m_move[rank].rankMoves); + offset = m_move[rank].phase; + if ( offset < pTable[0] ) + { + pos.x += pTable[1+2*offset+0]; + pos.y += pTable[1+2*offset+1]; + } + else + { + m_move[rank].rankMoves = 0; + } + } + + // Dessine un chiffre par-dessus + if ( m_move[rank].icon >= MOVEICONNB && + m_move[rank].icon <= MOVEICONNB+100 ) + { + POINT textPos; + char string[20]; + + m_pPixmap->DrawIcon(-1, m_decor[x/2][y/2].objectChannel, + m_decor[x/2][y/2].objectIcon, + pos); + sprintf(string, "%d", m_move[rank].icon-MOVEICONNB); + textPos.x = pos.x+DIMCELX/2+32; + textPos.y = pos.y+(DIMOBJY-DIMCELY*2)+36; + DrawTextCenter(m_pPixmap, textPos, string, FONTLITTLE); + } + else + { + hBuild = (m_move[rank].cTotal * m_move[rank].stepY) /100; + if ( m_move[rank].stepY >= 0 ) + { + if ( hBuild <= 0 ) hBuild = 0; + if ( hBuild > DIMOBJY ) hBuild = DIMOBJY; + } + else + { + if ( hBuild >= 0 ) hBuild = 0; + if ( hBuild < -DIMOBJY ) hBuild = -DIMOBJY; + } + + // Dessine l'objet actuellement dans le décor. + if ( m_decor[x/2][y/2].objectChannel >= 0 ) + { + if ( hBuild >= 0 ) + { + startY = 0; + endY = DIMOBJY-hBuild; + } + else + { + startY = -hBuild; + endY = DIMOBJY; + } + + channel = m_decor[x/2][y/2].objectChannel; + if ( m_bOutline && channel == CHOBJECT ) + { + channel = CHOBJECTo; + } + + m_pPixmap->DrawIconPart(-1, channel, + m_decor[x/2][y/2].objectIcon, + pos, startY, endY); + } + + // Dessine le nouvel objet par-dessus. + if ( m_move[rank].icon >= 0 ) + { + if ( hBuild >= 0 ) + { + startY = DIMOBJY-hBuild; + endY = DIMOBJY; + } + else + { + startY = 0; + endY = -hBuild; + } + + channel = m_move[rank].channel; + if ( m_bOutline && channel == CHOBJECT ) + { + channel = CHOBJECTo; + } + + m_pPixmap->DrawIconPart(-1, channel, m_move[rank].icon, + pos, startY, endY); + } + } + + // Dessine le feu ou les rayons. + if ( m_move[rank].rankIcons != 0 ) + { + pTable = GetListIcons(m_move[rank].rankIcons); + nb = pTable[0]; + icon = pTable[1+m_move[rank].cTotal%nb]; + + m_pPixmap->DrawIcon(-1, m_move[rank].channel, icon, pos); + } +} + +// Déplace l'objet transporté par blupi. + +void BuildMoveTransport(int icon, POINT &pos) +{ + pos.x -= DIMCELX/2; + pos.y -= 96; + + static int offset_bateau[16*2] = + { + -4,-3, // e + -2,-3, + -1,-3, // se + +1,-3, + +2,-3, // s + +5,-2, + +6,-2, // so + +5,-1, + +1, 0, // o + -1, 0, + -2, 0, // no + -2, 0, + -3, 0, // n + -4,-1, + -5,-1, // ne + -4,-2, + }; + + static int offset_jeep[16*2] = + { + -2,-6, // e + -1,-6, + -1,-6, // se + -1,-6, + +3,-6, // s + +1,-6, + +4,-6, // so + +4,-5, + +4,-5, // o + +2,-5, + +1,-4, // no + +1,-4, + -3,-3, // n + -4,-4, + -3,-4, // ne + -4,-4, + }; + + if ( icon >= 0 && icon <= 47 ) + { + pos.y -= (icon%3)*2; + } + + if ( icon == 114 ) // mange ? + { + pos.x += 1; + pos.y += 1; + } + + if ( icon == 106 ) // se penche (mèche dynamite) ? + { + pos.x += 8; + pos.y += 10; + } + + if ( icon == 194 ) // se penche (mèche dynamite) ? + { + pos.x += 9; + pos.y += 9; + } + + if ( icon == 347 ) // se penche (armure) ? + { + pos.x += 2; + pos.y += 2; + } + + if ( icon >= 234 && icon <= 249 ) // blupi en bateau ? + { + pos.x += offset_bateau[(icon-234)*2+0]; + pos.y += offset_bateau[(icon-234)*2+1]; + } + + if ( icon >= 250 && icon <= 265 ) // blupi en jeep ? + { + pos.x += offset_jeep[(icon-250)*2+0]; + pos.y += offset_jeep[(icon-250)*2+1]; + } + + if ( icon == 270 ) pos.y += 3; // blupi électrocuté + if ( icon == 271 ) pos.y -= 2; + if ( icon == 272 ) pos.y -= 7; +} + +// Construit tous les sols fixes dans CHGROUND. + +void CDecor::BuildGround(RECT clip) +{ +//? OutputDebug("BuildGround\n"); + int x, y, i, j, nbx, nby, width, height, channel, icon; + POINT iCel, mCel, iPos, mPos, cPos, pos; + + width = clip.right-clip.left; + height = clip.bottom-clip.top; + + pos.x = clip.left; + pos.y = clip.top; + iCel = ConvPosToCel(pos); + mCel = iCel; + + if ( mCel.x%2 == 0 && mCel.y%2 == 0 ) + { + iCel.x -= 2; + width += DIMCELX; + height += DIMCELY; + } + + if ( mCel.x%2 != 0 && mCel.y%2 != 0 ) + { + iCel.x -= 3; + iCel.y -= 1; + width += DIMCELX; + height += DIMCELY*2; + } + + if ( mCel.x%2 == 0 && mCel.y%2 != 0 ) + { + iCel.x -= 2; + iCel.y -= 1; + width += DIMCELX/2; + height += (DIMCELY/2)*3; + } + + if ( mCel.x%2 != 0 && mCel.y%2 == 0 ) + { + iCel.x -= 3; + width += (DIMCELX/2)*3; + height += (DIMCELY/2)*3; + } + + iPos = ConvCelToPos(iCel); + + nbx = (width/DIMCELX)+1; + nby = (height/(DIMCELY/2))+0; + + if ( GetInfoHeight() != 0 ) + { + nbx += 2; + nby += 2; + } + + // Construit les sols. + mCel = iCel; + mPos = iPos; + for ( j=0 ; j= 0 && x < MAXCELX && +// y >= 0 && y < MAXCELY && +// x%2 == 0 && y%2 == 0 && +// m_decor[x/2][y/2].floorChannel >= 0 && +// m_decor[x/2][y/2].floorIcon >= 0 ) + if ( x%2 == 0 && y%2 == 0 ) + { + pos.x = cPos.x-DIMCELX/2; + pos.y = cPos.y; + + if ( x >= 2 && x < MAXCELX-2 && + y >= 2 && y < MAXCELY-2 && + m_decor[x/2][y/2].floorChannel >= 0 && + m_decor[x/2][y/2].floorIcon >= 0 ) + { + channel = m_decor[x/2][y/2].floorChannel; + icon = m_decor[x/2][y/2].floorIcon; + } + else + { + channel = CHFLOOR; + icon = 78; // losange noir + } + + if ( !m_bBuild && icon == 71 ) // terre à fer ? + { + icon = 33; // terre normale ! + } + + // Dessine l'eau sous les rives et les ponts. + if ( (icon >= 2 && icon <= 13) || // rive ? + (icon >= 59 && icon <= 64) ) // pont ? + { + m_pPixmap->DrawIcon(CHGROUND, CHFLOOR,14, pos); // eau + } + + m_pPixmap->DrawIcon(CHGROUND, channel, icon, pos); + } + + x ++; + y --; + cPos.x += DIMCELX; + } + + if ( j%2 == 0 ) + { + mCel.y ++; + mPos.x -= DIMCELX/2; + mPos.y += DIMCELY/2; + } + else + { + mCel.x ++; + mPos.x += DIMCELX/2; + mPos.y += DIMCELY/2; + } + } + + m_bGroundRedraw = FALSE; +} + +// Construit le décor dans un pixmap. + +void CDecor::Build(RECT clip, POINT posMouse) +{ + int x, y, i, j, nbx, nby, width, height, rank, icon, channel, n; + POINT iCel, mCel, cel, iPos, mPos, cPos, pos, tPos; + RECT oldClip, clipRect; + + static int table_eau[6] = + { + 70,68,14,69,14,68 + }; + static int table_random_x[10] = + { + 2,5,1,9,4,0,6,3,8,7 + }; + static int table_random_y[10] = + { + 4,8,3,5,9,1,7,2,0,6 + }; + + oldClip = m_pPixmap->GetClipping(); + m_pPixmap->SetClipping(clip); + + if ( m_bGroundRedraw ) + { + BuildGround(clip); // refait les sols fixes + } + + // Dessine tous les sols fixes. + m_pPixmap->DrawImage(-1, CHGROUND, clip, 1); + + width = clip.right-clip.left; + height = clip.bottom-clip.top; + + pos.x = clip.left; + pos.y = clip.top; + iCel = ConvPosToCel(pos); + mCel = iCel; + + if ( mCel.x%2 == 0 && mCel.y%2 == 0 ) + { + iCel.x -= 2; + width += DIMCELX; + height += DIMCELY; + } + + if ( mCel.x%2 != 0 && mCel.y%2 != 0 ) + { + iCel.x -= 3; + iCel.y -= 1; + width += DIMCELX; + height += DIMCELY*2; + } + + if ( mCel.x%2 == 0 && mCel.y%2 != 0 ) + { + iCel.x -= 2; + iCel.y -= 1; + width += DIMCELX/2; + height += (DIMCELY/2)*3; + } + + if ( mCel.x%2 != 0 && mCel.y%2 == 0 ) + { + iCel.x -= 3; + width += (DIMCELX/2)*3; + height += (DIMCELY/2)*3; + } + + iPos = ConvCelToPos(iCel); + + nbx = (width/DIMCELX)+1; + nby = (height/(DIMCELY/2))+0; + + if ( GetInfoHeight() != 0 ) + { + nbx += 2; + nby += 2; + } + + // Construit les sols. + mCel = iCel; + mPos = iPos; + for ( j=0 ; j= 2 && x < MAXCELX-2 && + y >= 2 && y < MAXCELY-2 ) + { + m_rankBlupi[x][y] = -1; // (1), voir BuildPutBlupi + + if ( x%2 == 0 && y%2 == 0 ) + { + icon = m_decor[x/2][y/2].floorIcon; + + if ( !m_bBuild && icon == 71 ) // terre à fer ? + { + icon = 33; // terre normale ! + } + + // Dessine l'eau sous les rives et les ponts. + if ( (icon >= 2 && icon <= 14) || // rive ? + (icon >= 59 && icon <= 64) ) // pont ? + { + // Dessine l'eau en mouvement. + pos.x = cPos.x-DIMCELX/2; + pos.y = cPos.y; + n = table_eau[(m_timeConst/2+ // lent ! + table_random_x[x%10]+ + table_random_y[y%10])%6]; + m_pPixmap->DrawIcon(CHGROUND, CHFLOOR, n, pos); // eau + if ( icon != 14 ) + { + m_pPixmap->DrawIcon(CHGROUND, CHFLOOR, icon, pos); + } + } + + rank = m_decor[x/2][y/2].rankMove; + if ( rank != -1 && // décor animé ? + m_move[rank].bFloor ) + { + pos.x = cPos.x-DIMCELX/2; + pos.y = cPos.y; + + BuildMoveFloor(x, y, pos, rank); + } + } + } + + if ( m_celHili.x != -1 && + x >= m_celHili.x-1 && x <= m_celHili.x+2 && + y >= m_celHili.y-1 && y <= m_celHili.y+2 ) + { + icon = m_iconHili[x-(m_celHili.x-1)] + [y-(m_celHili.y-1)]; + if ( icon != -1 ) + { + // hilight cellule + m_pPixmap->DrawIconDemi(-1, CHBLUPI, icon, cPos); + } + } + + if ( m_bHiliRect ) // rectangle de sélection existe ? + { + if ( (m_p1Hili.x == x && m_p1Hili.y == y) || + (m_p2Hili.x == x && m_p2Hili.y == y) ) + { + m_pPixmap->DrawIconDemi(-1, CHBLUPI, ICON_HILI_SEL, cPos); + } + } + + x ++; + y --; + cPos.x += DIMCELX; + } + + if ( j%2 == 0 ) + { + mCel.y ++; + mPos.x -= DIMCELX/2; + mPos.y += DIMCELY/2; + } + else + { + mCel.x ++; + mPos.x += DIMCELX/2; + mPos.y += DIMCELY/2; + } + } + + for ( j=nby ; j= 2 && x < MAXCELX-2 && + y >= 2 && y < MAXCELY-2 ) + { + m_rankBlupi[x][y] = -1; // (1), voir BuildPutBlupi + } + x ++; + y --; + } + + if ( j%2 == 0 ) + { + mCel.y ++; + } + else + { + mCel.x ++; + } + } + + BlupiDrawHili(); // dessine le rectangle de sélection + + // Construit les objets et les blupi. + BuildPutBlupi(); // m_rankBlupi[x][y] <- rangs des blupi + + mCel = iCel; + mPos = iPos; + for ( j=0 ; j= 2 && x < MAXCELX-2 && + y >= 2 && y < MAXCELY-2 ) + { + rank = m_rankBlupi[x][y]; + if ( rank != -1 && // un blupi sur cette cellule ? + !m_blupi[rank].bCache ) + { + cel.x = m_blupi[rank].cel.x; + cel.y = m_blupi[rank].cel.y; + pos = ConvCelToPos(cel); + pos.x += m_blupi[rank].pos.x; + pos.y += m_blupi[rank].pos.y-(DIMBLUPIY-DIMCELY)-SHIFTBLUPIY; + + if ( m_blupi[rank].bHili ) + { + icon = 120+(m_blupi[rank].energy*18)/MAXENERGY; + if ( icon < 120 ) icon = 120; + if ( icon > 137 ) icon = 137; + tPos = pos; + tPos.y += DIMCELY; + if ( m_blupi[rank].vehicule == 1 ) // en bateau ? + { + tPos.y -= 6; + } + // Dessine la sélection/énergie + if ( m_blupi[rank].clipLeft == 0 ) + { + m_pPixmap->DrawIconDemi(-1, CHBLUPI, icon, tPos); + } + else + { + clipRect = clip; + clipRect.left = m_blupi[rank].clipLeft; + m_pPixmap->SetClipping(clipRect); + m_pPixmap->DrawIconDemi(-1, CHBLUPI, icon, tPos); + m_pPixmap->SetClipping(clip); + } + } + + // Dessine la flèche ronde "répète" sous blupi. + if ( m_blupi[rank].repeatLevel != -1 ) + { + tPos = pos; + tPos.y += DIMCELY; + if ( m_blupi[rank].vehicule == 1 ) // en bateau ? + { + tPos.y -= 6; + } + // Dessine la sélection/énergie + if ( m_blupi[rank].clipLeft == 0 ) + { + m_pPixmap->DrawIconDemi(-1, CHBLUPI, 116, tPos); + } + else + { + clipRect = clip; + clipRect.left = m_blupi[rank].clipLeft; + m_pPixmap->SetClipping(clipRect); + m_pPixmap->DrawIconDemi(-1, CHBLUPI, 116, tPos); + m_pPixmap->SetClipping(clip); + } + } + + // Dessine la flèche jaune sur blupi. + if ( m_blupi[rank].bArrow ) + { + tPos = pos; + if ( m_phase%(6*2) < 6 ) + { + tPos.y -= DIMBLUPIY+(m_phase%6)*4; + } + else + { + tPos.y -= DIMBLUPIY+(6-(m_phase%6)-1)*4; + } + m_pPixmap->DrawIcon(-1, CHBLUPI,132, tPos); + } + + // Dessine le stop sur blupi. + if ( m_blupi[rank].stop == 1 ) + { + tPos = pos; + tPos.x += 9; + tPos.y -= 24; + m_pPixmap->DrawIcon(-1, CHBUTTON,46, tPos); + } + + // Dessine blupi + pos.y += m_blupi[rank].posZ; + + if ( m_blupi[rank].clipLeft == 0 ) + { + m_pPixmap->DrawIcon(-1, m_blupi[rank].channel, + m_blupi[rank].icon, pos); + + // Dessine l'objet transporté. + if ( m_blupi[rank].takeChannel != -1 ) + { + BuildMoveTransport(m_blupi[rank].icon, pos); + m_pPixmap->DrawIcon(-1, m_blupi[rank].takeChannel, + m_blupi[rank].takeIcon, pos); + } + } + else + { + clipRect = clip; + clipRect.left = m_blupi[rank].clipLeft; + m_pPixmap->SetClipping(clipRect); + m_pPixmap->DrawIcon(-1, m_blupi[rank].channel, + m_blupi[rank].icon, pos); + + // Dessine l'objet transporté. + if ( m_blupi[rank].takeChannel != -1 ) + { + BuildMoveTransport(m_blupi[rank].icon, pos); + m_pPixmap->DrawIcon(-1, m_blupi[rank].takeChannel, + m_blupi[rank].takeIcon, pos); + } + m_pPixmap->SetClipping(clip); + } + } + + if ( x%2 == 0 && y%2 == 0 ) + { + rank = m_decor[x/2][y/2].rankMove; + if ( m_decor[x/2][y/2].objectChannel >= 0 ) + { + pos.x = cPos.x-DIMCELX/2; + pos.y = cPos.y-(DIMOBJY-DIMCELY*2); + + // Dessine l'objet + if ( rank == -1 || // décor fixe ? + m_move[rank].bFloor || + m_bBuild ) + { + channel = m_decor[x/2][y/2].objectChannel; + if ( m_bOutline && channel == CHOBJECT ) + { + channel = CHOBJECTo; + } + if ( m_celOutline1.x != -1 && + x >= m_celOutline1.x && y >= m_celOutline1.y && + x <= m_celOutline2.x && y <= m_celOutline2.y ) + { + if ( channel == CHOBJECT ) channel = CHOBJECTo; + else channel = CHOBJECT; + } + m_pPixmap->DrawIcon(-1, channel, + m_decor[x/2][y/2].objectIcon, + pos); + + if ( m_decor[x/2][y/2].objectIcon == 12 ) // fusée ? + { + pos.y -= DIMOBJY; + m_pPixmap->DrawIcon(-1, channel, 13, pos); + } + } + else // décor animé ? + { + BuildMoveObject(x, y, pos, rank); + } + } + else + { + if ( rank != -1 && // décor animé ? + !m_move[rank].bFloor && + !m_bBuild ) + { + pos.x = cPos.x-DIMCELX/2; + pos.y = cPos.y-(DIMOBJY-DIMCELY*2); + BuildMoveObject(x, y, pos, rank); + } + } + + // Dessine le feu en mode construction. + if ( m_bBuild && + m_decor[x/2][y/2].fire > 0 && + m_decor[x/2][y/2].fire < MoveMaxFire() ) + { + pos.x = cPos.x-DIMCELX/2; + pos.y = cPos.y-(DIMOBJY-DIMCELY*2); + m_pPixmap->DrawIcon(-1, CHOBJECT, 49, pos); // petite flamme + } + } + } + + x ++; + y --; + cPos.x += DIMCELX; + } + + if ( j%2 == 0 ) + { + mCel.y ++; + mPos.x -= DIMCELX/2; + mPos.y += DIMCELY/2; + } + else + { + mCel.x ++; + mPos.x += DIMCELX/2; + mPos.y += DIMCELY/2; + } + } + + // Construit le brouillard. + if ( !m_bFog ) goto term; + + if ( m_shiftOffset.x < 0 ) // décalage à droite ? + { + nbx += 2; + } + if ( m_shiftOffset.y < 0 ) // décalage en bas ? + { + nby += 2; + } + if ( m_shiftOffset.x > 0 ) // décalage à gauche ? + { + nbx += 2; + iCel.x --; + iCel.y ++; + iPos = ConvCelToPos(iCel); + } + if ( m_shiftOffset.y > 0 ) // décalage en haut ? + { + nby += 2; + iCel.x --; + iCel.y --; + iPos = ConvCelToPos(iCel); + } + + mCel = iCel; + mPos = iPos; + for ( j=0 ; j= 0 && x < MAXCELX && + y >= 0 && y < MAXCELY && + x%2 == 0 && y%2 == 0 ) + { + icon = m_decor[x/2][y/2].fog; + } + else + { + icon = FOGHIDE; // caché + } + + if ( abs(x)%4 == abs(y)%4 && + (abs(x)%4 == 0 || abs(x)%4 == 2) && + icon != -1 ) + { + pos.x = cPos.x-DIMCELX/2; + pos.y = cPos.y; + + m_pPixmap->DrawIcon(-1, CHFOG, icon, pos); + } + + x ++; + y --; + cPos.x += DIMCELX; + } + + if ( j%2 == 0 ) + { + mCel.y ++; + mPos.x -= DIMCELX/2; + mPos.y += DIMCELY/2; + } + else + { + mCel.x ++; + mPos.x += DIMCELX/2; + mPos.y += DIMCELY/2; + } + } + + term: + // Dessine la flèche jaune sur un objet. + if ( m_celArrow.x != -1 ) + { + tPos = ConvCelToPos(m_celArrow); + if ( m_phase%(6*2) < 6 ) + { + tPos.y -= DIMBLUPIY+(m_phase%6)*4; + } + else + { + tPos.y -= DIMBLUPIY+(6-(m_phase%6)-1)*4; + } + m_pPixmap->DrawIcon(-1, CHBLUPI,132, tPos); + } + + // Dessine le nom de l'objet pointé par la souris. + if ( posMouse.x == m_textLastPos.x && + posMouse.y == m_textLastPos.y ) + { + if ( m_textCount == 0 ) + { + n = GetResHili(posMouse); + if ( n != -1 ) + { + LoadString(n, m_text, 50); + posMouse.x += 10; + posMouse.y += 20; + DrawText(m_pPixmap, posMouse, m_text); + } + } + else + { + m_textCount --; + } + } + else + { + m_textLastPos = posMouse; + m_textCount = TEXTDELAY; + } + + m_pPixmap->SetClipping(oldClip); + + GenerateMap(); // dessine la carte miniature + GenerateStatictic(); // dessine les statistiques +} + + +// Augmente la phase. +// -1 mise à jour continue +// 0 début de mise à jour périodique +// 1 mise à jour périodique suivante + +void CDecor::NextPhase(int mode) +{ + if ( mode == -1 ) + { + m_phase = -1; + } + + if ( mode == 0 ) + { + m_phase = 0; + } + + if ( mode == 1 ) + { + m_phase ++; + } + + m_totalTime ++; +} + +// Modifie le temps total passé dans cette partie. + +void CDecor::SetTotalTime(int total) +{ + m_totalTime = total; +} + +// Retourne le temps total passé dans cette partie. + +int CDecor::GetTotalTime() +{ + return m_totalTime; +} + + +// Compte le nombre total de sols contenus dans les décors. + +int CDecor::CountFloor(int channel, int icon) +{ + int x, y; + int nb = 0; + + for ( x=0 ; x= 0 ) + { + if ( m_blupi[rank].energy > MAXENERGY/4 ) // blupi fort ? + { + bStrong = TRUE; + } + if ( m_blupi[rank].takeChannel != -1 ) // porte qq chose ? + { + bTransport = TRUE; + } + if ( m_blupi[rank].vehicule != 0 ) // pas à pied ? + { + bVehicule = TRUE; + } + if ( m_blupi[rank].vehicule != 0 && // pas à pied ? + m_blupi[rank].vehicule != 3 ) // pas armure ? + { + bVehiculeA = TRUE; + } + } + + if ( action == 0 ) + { + if ( IsBlupiHere(cel, FALSE) ) + { + icons[1][1] = ICON_HILI_SEL; + } + else + { + if ( IsFreeCel(cel, -1) && m_nbBlupiHili > 0 ) + { + icons[1][1] = ICON_HILI_ANY; + } + else + { + icons[1][1] = ICON_HILI_ERR; + } + } + } + + if ( action == 1 ) + { + icons[1][1] = ICON_HILI_BUILD; // action + } + + if ( action == 2 ) + { + icons[1][1] = ICON_HILI_BUILD; // action + icons[2][1] = ICON_HILI_BUILD; + icons[1][2] = ICON_HILI_BUILD; + icons[2][2] = ICON_HILI_BUILD; + } + + if ( action == WM_ACTION_STOP ) + { + error = ERROR_MISC; + if ( m_blupi[rank].stop == 0 && + (m_blupi[rank].goalAction == WM_ACTION_GO || + (m_blupi[rank].goalAction >= WM_ACTION_ABAT1 && + m_blupi[rank].goalAction <= WM_ACTION_ABAT6) || + (m_blupi[rank].goalAction >= WM_ACTION_ROC1 && + m_blupi[rank].goalAction <= WM_ACTION_ROC7) || + m_blupi[rank].goalAction == WM_ACTION_CULTIVE || + m_blupi[rank].goalAction == WM_ACTION_CULTIVE2 || + m_blupi[rank].goalAction == WM_ACTION_DRAPEAU || + m_blupi[rank].goalAction == WM_ACTION_DRAPEAU2 || + m_blupi[rank].goalAction == WM_ACTION_DRAPEAU3 || + m_blupi[rank].goalAction == WM_ACTION_FLEUR1 || + m_blupi[rank].goalAction == WM_ACTION_FLEUR2 || + m_blupi[rank].goalAction == WM_ACTION_FLEUR3) ) + { + error = 0; + } + if ( m_blupi[rank].stop == 0 && + m_blupi[rank].goalAction != 0 && + m_blupi[rank].interrupt == 1 ) + { + error = 0; + } + if ( m_blupi[rank].repeatLevel != -1 ) + { + error = 0; + } + } + + if ( action == WM_ACTION_GO ) + { + if ( m_decor[cel.x/2][cel.y/2].objectIcon == 113 ) // maison ? + { + cel.x = (cel.x/2)*2+1; + cel.y = (cel.y/2)*2+1; + } + error = ERROR_MISC; + if ( m_nbBlupiHili > 0 ) + { + nb = m_nbBlupiHili; + if ( nb > 16 ) nb = 16; + for ( i=0 ; i MAXENERGY/4)) && + IsFreeCelGo(GetCel(cel.x+x,cel.y+y), rank) && + !IsBlupiHere(GetCel(cel.x+x,cel.y+y), TRUE) ) + { +//? icons[1+x][1+y] = ICON_HILI_GO; // flèche + icons[1+x][1+y] = ICON_HILI_OP; // action + error = 0; + } + else + { + icons[1+x][1+y] = ICON_HILI_ERR; + } + } + } + else + { + icons[1][1] = ICON_HILI_ERR; + } + } + + if ( action == WM_ACTION_ABAT1 ) + { + GetObject(cel, channel, icon); + if ( bStrong && !bTransport && !bVehicule && + channel == CHOBJECT && icon >= 6 && icon <= 11 && // arbre ? + !MoveIsUsed(cel) && + IsWorkableObject(cel, rank) ) + { + icons[1][1] = ICON_HILI_OP; // action + icons[2][1] = ICON_HILI_OP; + icons[1][2] = ICON_HILI_OP; + icons[2][2] = ICON_HILI_OP; + celOutline1 = cel; + celOutline2 = cel; + } + else + { + icons[1][1] = ICON_HILI_ERR; // croix + icons[2][1] = ICON_HILI_ERR; + icons[1][2] = ICON_HILI_ERR; + icons[2][2] = ICON_HILI_ERR; + error = ERROR_MISC; + } + } + + if ( action == WM_ACTION_ROC1 ) + { + GetObject(cel, channel, icon); + if ( bStrong && !bTransport && !bVehicule && + m_blupi[rank].perso != 8 && // pas disciple ? + channel == CHOBJECT && icon >= 37 && icon <= 43 && // rochers ? + !MoveIsUsed(cel) && + IsWorkableObject(cel, rank) ) + { + icons[1][1] = ICON_HILI_OP; // action + icons[2][1] = ICON_HILI_OP; + icons[1][2] = ICON_HILI_OP; + icons[2][2] = ICON_HILI_OP; + celOutline1 = cel; + celOutline2 = cel; + } + else + { + icons[1][1] = ICON_HILI_ERR; // croix + icons[2][1] = ICON_HILI_ERR; + icons[1][2] = ICON_HILI_ERR; + icons[2][2] = ICON_HILI_ERR; + error = ERROR_MISC; + } + } + + if ( action >= WM_ACTION_BUILD1 && + action <= WM_ACTION_BUILD6 ) + { + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + cel.x --; + cel.y --; + + if ( !bStrong || bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + + if ( action == WM_ACTION_BUILD1 || // cabane ? + action == WM_ACTION_BUILD2 || // couveuse ? + action == WM_ACTION_BUILD6 ) // téléporteur ? + { + GetFloor(cel, channel, icon); + if ( channel != CHFLOOR || + (icon != 1 && // herbe claire ? + (icon < 19 || icon > 32)) ) // herbe foncée ? + { + error = ERROR_GROUND; // sol pas adéquat + } + } + + if ( action == WM_ACTION_BUILD4 ) // mine ? + { + GetFloor(cel, channel, icon); + if ( channel != CHFLOOR || icon != 71 ) // terre à fer ? + { + error = ERROR_GROUND; // sol pas adéquat + } + } + + if ( action == WM_ACTION_BUILD6 && // téléporteur ? + CountFloor(CHFLOOR, 80) >= 2 ) // déjà 2 ? + { + error = ERROR_TELE2; // déjà 2 téléporteurs + } + + if ( action == WM_ACTION_BUILD3 || + action == WM_ACTION_BUILD5 ) start = 44; // pierres + else start = 36; // planches + if ( start == 44 && + m_blupi[rank].perso == 8 ) start = 999; // disciple ? + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != start ) // planches ? + { + error = ERROR_MISC; // pas de planches ! + } + + for ( x=-1 ; x<3 ; x++ ) + { + for ( y=-1 ; y<3 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=-1 ; x<3 ; x++ ) + { + for ( y=-1 ; y<3 ; y++ ) + { + if ( (x<0 || x>1 || y<0 || y>1) && + !IsFreeCel(GetCel(cel,x,y), rank) ) + { + error = ERROR_FREE; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_FREE; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + } + + if ( action == WM_ACTION_MUR ) + { + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + cel.x --; + cel.y --; + + if ( !bStrong || bTransport || bVehicule || + m_blupi[rank].perso == 8 ) // disciple ? + { + error = ERROR_MISC; // pas assez fort + } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 44 ) // pierres ? + { + error = ERROR_MISC; // pas de pierres ! + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_FREE; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + } + + if ( action == WM_ACTION_TOUR ) + { + BOOL bTour; + + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + cel.x --; + cel.y --; + + if ( !bStrong || bTransport || bVehicule || + m_blupi[rank].perso == 8 ) // disciple ? + { + error = ERROR_MISC; // pas assez fort + } + +// GetFloor(cel, channel, icon); +// if ( channel != CHFLOOR || +// (icon != 1 && // herbe claire ? +// (icon < 19 || icon > 32)) ) // herbe foncée ? +// { +// error = ERROR_GROUND; // sol pas adéquat +// } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 44 ) // pierres ? + { + error = ERROR_MISC; // pas de pierres ! + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=-1 ; x<3 ; x++ ) + { + for ( y=-1 ; y<3 ; y++ ) + { + if ( x<0 || x>1 || y<0 || y>1 ) // périphérie ? + { + GetFloor(GetCel(cel,x,y), channel, icon); + if ( channel == CHFLOOR && + (icon >= 2 && icon <= 13) ) // rive ? + { + error = ERROR_TOUREAU; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_FREE; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + + if ( error == 0 ) + { + bTour = FALSE; + for ( i=0 ; i<4 ; i++ ) + { + vector = GetVector(i*2*16); + x = cel.x; + y = cel.y; + + for ( j=0 ; j<3 ; j++ ) + { + x += vector.x*2; + y += vector.y*2; + + if ( m_decor[x/2][y/2].objectIcon == 27 ) // tour ? + { + bTour = TRUE; + } + + if ( MoveGetObject(GetCel(x,y), channel, icon) && + channel == CHOBJECT && icon == 27 ) // tour en construction ? + { + bTour = TRUE; + } + } + } + if ( !bTour ) error = ERROR_TOURISOL; + } + } + } + + if ( action == WM_ACTION_PALIS ) + { + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + cel.x --; + cel.y --; + + if ( !bStrong || bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 36 ) // planches ? + { + error = ERROR_MISC; // pas de pierres ! + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_FREE; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + } + + if ( action == WM_ACTION_PONTE ) + { + POINT test; + + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + cel.x --; + cel.y --; + + if ( !bStrong || bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 36 ) // planches ? + { + error = ERROR_MISC; // pas de pierres ! + } + + test = cel; + if ( error == 0 ) error = IsBuildPont(test, icon); + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_FREE; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + } + + if ( action == WM_ACTION_CARRY ) + { + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + GetObject(GetCel(cel,-1,-1), channel, icon); + if ( bStrong && !bTransport && !bVehiculeA && + channel == CHOBJECT && + (icon == 14 || // métal ? + icon == 36 || // planches ? + icon == 44 || // pierres ? + icon == 60 || // tomates ? + icon == 63 || // oeufs ? + icon == 80 || // bouteille ? + icon == 82 || // fleurs ? + icon == 84 || // fleurs ? + icon == 95 || // fleurs ? + icon == 85 || // dynamite ? + icon == 92 || // poison ? + icon == 93 || // piège ? + icon == 123 || // fer ? + icon == 125) && // mine ? + (!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) || + !IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) ) + { + icons[1][1] = ICON_HILI_OP; // action + } + else + { + icons[1][1] = ICON_HILI_ERR; // croix + error = ERROR_MISC; + } + } + } + + if ( action == WM_ACTION_DEPOSE ) + { + if ( !bTransport || bVehiculeA ) + { + error = ERROR_MISC; // ne transporte rien + } + + GetObject(GetCel((cel.x/2)*2,(cel.y/2)*2), channel, icon); + if ( icon != -1 && icon != 124 ) // pas drapeau ? + { + error = ERROR_MISC; + } + + start = 0; + if ( error == 0 ) + { + GetFloor(cel, channel, icon); + if ( channel == CHFLOOR && icon == 52 && // nurserie ? + m_blupi[rank].takeChannel == CHOBJECT && + m_blupi[rank].takeIcon == 63 ) // oeufs ? + { + for ( x=-1 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( !IsFreeCelDepose(GetCel(cel,x,y), rank) || + IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_MISC; + } + } + } + start = -1; + } + else + { + if ( !IsFreeCelDepose(GetCel(cel,1,1), rank) || + IsBlupiHereEx(GetCel(cel,1,1), rank, FALSE) ) + { + error = ERROR_MISC; + } + else + { + if ( !IsFreeCelDepose(GetCel(cel,0,1), rank) || + IsBlupiHereEx(GetCel(cel,0,1), rank, FALSE) ) + { + if ( !IsFreeCelDepose(GetCel(cel,1,0), rank) || + IsBlupiHereEx(GetCel(cel,1,0), rank, FALSE) ) + { + error = ERROR_MISC; + } + } + } + } + } + + for ( x=start ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + } + + if ( action == WM_ACTION_CULTIVE ) + { + if ( !bStrong || bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 61 ) // maison ? + { + error = ERROR_MISC; // pas de maison ! + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_MISC; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + + if ( action == WM_ACTION_LABO ) + { + if ( !bStrong || !bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 28 || // laboratoire ? + m_blupi[rank].takeChannel != CHOBJECT || + (m_blupi[rank].takeIcon != 82 && // fleurs ? + m_blupi[rank].takeIcon != 84 && // fleurs ? + m_blupi[rank].takeIcon != 95 && // fleurs ? + m_blupi[rank].takeIcon != 60) ) // tomates ? + { + error = ERROR_MISC; // pas de laboratoire ! + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_MISC; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + + if ( action == WM_ACTION_FLEUR1 ) + { + GetObject(cel, channel, icon); + if ( bStrong && !bTransport && !bVehicule && + channel == CHOBJECT && + (icon == 81 || icon == 83 || icon == 94) && // fleurs ? + !MoveIsUsed(cel) && + IsWorkableObject(cel, rank) ) + { + icons[1][1] = ICON_HILI_OP; // action + icons[2][1] = ICON_HILI_OP; + icons[1][2] = ICON_HILI_OP; + icons[2][2] = ICON_HILI_OP; + celOutline1 = cel; + celOutline2 = cel; + } + else + { + icons[1][1] = ICON_HILI_ERR; // croix + icons[2][1] = ICON_HILI_ERR; + icons[1][2] = ICON_HILI_ERR; + icons[2][2] = ICON_HILI_ERR; + error = ERROR_MISC; + } + } + + if ( action == WM_ACTION_DYNAMITE ) + { + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + cel.x --; + cel.y --; + +//? if ( !bStrong || bVehicule ) + if ( bVehiculeA ) + { + error = ERROR_MISC; // pas assez fort + } + + GetObject(cel, channel, icon); + if ( icon != 85 && icon != 125 ) // dynamite/mine ? + { + error = ERROR_MISC; // pas de dynamite ! + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=1 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=1 ; y<2 ; y++ ) + { + if ( (x<0 || x>1 || y<0 || y>1) && + !IsFreeCel(GetCel(cel,x,y), rank) ) + { + error = ERROR_FREE; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_FREE; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + } + + if ( action == WM_ACTION_MANGE ) + { + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + GetObject(GetCel(cel,-1,-1), channel, icon); + if ( !m_blupi[rank].bMalade && !bVehicule && + m_blupi[rank].perso != 8 && // pas disciple ? + channel == CHOBJECT && + icon == 60 && // tomates ? + (!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) || + !IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) ) + { + icons[1][1] = ICON_HILI_OP; // action + } + else + { + icons[1][1] = ICON_HILI_ERR; // croix + error = ERROR_MISC; + } + } + } + + if ( action == WM_ACTION_BOIT ) + { + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + GetObject(GetCel(cel,-1,-1), channel, icon); + if ( m_blupi[rank].bMalade && !bVehicule && + m_blupi[rank].perso != 8 && // pas disciple ? + channel == CHOBJECT && + icon == 80 && // bouteille ? + (!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) || + !IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) ) + { + icons[1][1] = ICON_HILI_OP; // action + } + else + { + icons[1][1] = ICON_HILI_ERR; // croix + error = ERROR_MISC; + } + } + } + + if ( action == WM_ACTION_BATEAUE ) + { + POINT test; + + if ( cel.x%2 != 1 || cel.y%2 != 1 ) + { + icons[1][1] = ICON_HILI_ERR; + error = ERROR_MISC; + } + else + { + cel.x --; + cel.y --; + + if ( !bStrong || bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 36 ) // planches ? + { + error = ERROR_MISC; // pas de pierres ! + } + + test = cel; + if ( error == 0 && !IsBuildBateau(test, direct) ) + { + error = ERROR_MISC; // impossible ici ! + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_FREE; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + } + + if ( action == WM_ACTION_DJEEP ) + { + cel.x = (cel.x/2)*2; + cel.y = (cel.y/2)*2; + error = ERROR_MISC; + if ( m_blupi[rank].vehicule == 2 && // en jeep ? + m_decor[cel.x/2][cel.y/2].objectIcon == -1 && + m_decor[cel.x/2][cel.y/2].floorIcon != 80 ) // pas téléporteur ? + { + if ( IsFreeCelGo(GetCel(cel,+1, 0), rank) && + IsFreeCelGo(GetCel(cel,+1,+1), rank) && + !IsBlupiHereEx(GetCel(cel,+1, 0), rank, FALSE) && + !IsBlupiHereEx(GetCel(cel,+1,+1), rank, FALSE) ) + { + icons[1][1] = ICON_HILI_OP; // action + icons[2][1] = ICON_HILI_OP; + icons[1][2] = ICON_HILI_OP; + icons[2][2] = ICON_HILI_OP; + error = 0; + } + } + else + { + icons[1][1] = ICON_HILI_ERR; // croix + icons[2][1] = ICON_HILI_ERR; + icons[1][2] = ICON_HILI_ERR; + icons[2][2] = ICON_HILI_ERR; + } + } + + if ( action == WM_ACTION_DARMURE ) + { + cel.x = (cel.x/2)*2; + cel.y = (cel.y/2)*2; + error = ERROR_MISC; + if ( m_blupi[rank].vehicule == 3 && // armure ? + !bTransport && + m_decor[cel.x/2][cel.y/2].objectIcon == -1 && + m_decor[cel.x/2][cel.y/2].floorIcon != 80 ) // pas téléporteur ? + { + if ( IsFreeCelGo(GetCel(cel,+1, 0), rank) && + IsFreeCelGo(GetCel(cel,+1,+1), rank) && + !IsBlupiHereEx(GetCel(cel,+1, 0), rank, FALSE) && + !IsBlupiHereEx(GetCel(cel,+1,+1), rank, FALSE) ) + { + icons[1][1] = ICON_HILI_OP; // action + icons[2][1] = ICON_HILI_OP; + icons[1][2] = ICON_HILI_OP; + icons[2][2] = ICON_HILI_OP; + error = 0; + } + } + else + { + icons[1][1] = ICON_HILI_ERR; // croix + icons[2][1] = ICON_HILI_ERR; + icons[1][2] = ICON_HILI_ERR; + icons[2][2] = ICON_HILI_ERR; + } + } + + if ( action == WM_ACTION_DRAPEAU ) + { + if ( !bStrong || bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + + GetFloor(cel, channel, icon); + if ( (icon < 33 || icon > 48) && + icon != 71 ) // pas terre ? + { + error = ERROR_MISC; // terrain pas adapté + } + + GetObject(cel, channel, icon); + if ( channel == CHOBJECT ) // y a-t-il un objet ? + { + error = ERROR_MISC; // terrain pas adapté + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_MISC; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + + if ( action == WM_ACTION_EXTRAIT ) + { + if ( !bStrong || bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 122 ) // mine de fer ? + { + error = ERROR_MISC; // pas de mine + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_MISC; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + + if ( action == WM_ACTION_FABJEEP || + action == WM_ACTION_FABMINE || + action == WM_ACTION_FABARMURE ) + { + if ( !bStrong || !bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + if ( action == WM_ACTION_FABJEEP && + m_blupi[rank].perso == 8 ) // disciple ? + { + error = ERROR_MISC; // impossible + } + if ( action == WM_ACTION_FABARMURE && + m_blupi[rank].perso == 8 ) // disciple ? + { + error = ERROR_MISC; // impossible + } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 120 || // usine ? + m_blupi[rank].takeChannel != CHOBJECT || + m_blupi[rank].takeIcon != 123 ) // fer ? + { + error = ERROR_MISC; // pas d'usine ! + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_MISC; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + + if ( action == WM_ACTION_FABDISC ) + { + if ( !bStrong || !bTransport || bVehicule ) + { + error = ERROR_MISC; // pas assez fort + } + + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 120 || // usine ? + m_blupi[rank].takeChannel != CHOBJECT || + m_blupi[rank].takeIcon != 14 ) // métal ? + { + error = ERROR_MISC; // pas d'usine ! + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( error ) icons[x+1][y+1] = ICON_HILI_ERR; + else icons[x+1][y+1] = ICON_HILI_OP; + } + } + + for ( x=0 ; x<2 ; x++ ) + { + for ( y=0 ; y<2 ; y++ ) + { + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + error = ERROR_MISC; + icons[x+1][y+1] = ICON_HILI_ERR; // croix + } + } + } + } + + return error; +} + +// Indique si une cellule est ok pour une action. +// Le rang du blupi qui effectuera le travail est donnée dans rank. + +int CDecor::CelOkForAction(POINT cel, int action, int rank) +{ + int icons[4][4]; + POINT celOutline1, celOutline2; + + return CelOkForAction(cel, action, rank, icons, + celOutline1, celOutline2); +} + +// Retourne le rang du nième blupi sélectionné. + +int CDecor::GetHiliRankBlupi(int nb) +{ + int rank; + + if ( m_nbBlupiHili == 0 ) return -1; + if ( m_nbBlupiHili == 1 ) + { + if ( nb == 0 ) return m_rankBlupiHili; + return -1; + } + + for ( rank=0 ; rank= 0 ) + { + m_celHili = m_blupi[rank].cel; + m_rankHili = rank; + m_iconHili[1][1] = ICON_HILI_SEL; + } + else + { + m_celHili = ConvPosToCel(pos); + + if ( IsBlupiHere(m_celHili, FALSE) ) + { + m_rankHili = m_blupiHere; + m_iconHili[1][1] = ICON_HILI_SEL; + } + else + { + if ( m_nbBlupiHili > 0 ) + { + nb = m_nbBlupiHili; + if ( nb > 16 ) nb = 16; + for ( i=0 ; i= BUTTON_BUILD1 && + button <= BUTTON_BUILD6) ) + { + m_celHili.x = (cel.x/2)*2; + m_celHili.y = (cel.y/2)*2; + } + else + { + m_celHili = cel; + } +} + +// Marque la cellule visée par la souris pour une répétition donnée. + +void CDecor::CelHiliRepeat(int list) +{ + int rank, button, x, y, i; + POINT cel; + + for ( x=0 ; x<4 ; x++ ) + { + for ( y=0 ; y<4 ; y++ ) + { + m_iconHili[x][y] = -1; + } + } + + if ( m_nbBlupiHili != 1 ) return; + rank = m_rankBlupiHili; + + i = m_blupi[rank].repeatLevelHope - list; + if ( i < 0 || i > m_blupi[rank].repeatLevelHope ) return; + + button = m_blupi[rank].listButton[i]; + if ( button == BUTTON_ABAT || + button == BUTTON_ABATn || + button == BUTTON_ROC || + button == BUTTON_ROCn || + button == BUTTON_MUR || + button == BUTTON_TOUR || + button == BUTTON_PALIS || + button == BUTTON_PONT || + button == BUTTON_CULTIVE || + button == BUTTON_DEPOSE || + button == BUTTON_LABO || + button == BUTTON_FLEUR || + button == BUTTON_FLEURn || + button == BUTTON_DYNAMITE || + button == BUTTON_BATEAU || + button == BUTTON_DJEEP || + button == BUTTON_DARMURE || + button == BUTTON_DRAPEAU || + button == BUTTON_EXTRAIT || + button == BUTTON_FABJEEP || + button == BUTTON_FABARMURE || + button == BUTTON_FABMINE || + button == BUTTON_FABDISC || + (button >= BUTTON_BUILD1 && + button <= BUTTON_BUILD6) ) + { + m_iconHili[1][1] = ICON_HILI_OP; // action + m_iconHili[2][1] = ICON_HILI_OP; // action + m_iconHili[1][2] = ICON_HILI_OP; // action + m_iconHili[2][2] = ICON_HILI_OP; // action + + cel = m_blupi[rank].listCel[i]; + cel.x = (cel.x/2)*2; + cel.y = (cel.y/2)*2; + } + else + { + m_iconHili[1][1] = ICON_HILI_OP; // action + + cel = m_blupi[rank].listCel[i]; + } + m_celHili = cel; +} + +// Retourne l'identificateur du texte correspondant à +// l'objet ou au blupi visé par la souris. + +int CDecor::GetResHili(POINT posMouse) +{ + int res, icon; + + // Les valeurs négatives correspondent aux objets placés + // au coin inf/droite de la cellule. + static short table_object[] = + { + 131, // nb + 0,0,0,0,0,0, + TX_OBJ_ARBRE, TX_OBJ_ARBRE, TX_OBJ_ARBRE, + TX_OBJ_ARBRE, TX_OBJ_ARBRE, TX_OBJ_ARBRE, + TX_OBJ_FUSEE,0, + TX_OBJ_METAL, + 0, -TX_OBJ_ARMURE, + 0,0,0, + TX_OBJ_MUR, TX_OBJ_MUR, TX_OBJ_MUR, TX_OBJ_MUR, + TX_OBJ_MUR, TX_OBJ_MUR, TX_OBJ_MUR, + TX_OBJ_TOUR, + TX_OBJ_LABO, TX_OBJ_LABO, + TX_OBJ_ARBREb, TX_OBJ_ARBREb, TX_OBJ_ARBREb, + TX_OBJ_ARBREb, TX_OBJ_ARBREb, TX_OBJ_ARBREb, + -TX_OBJ_PLANCHE, + TX_OBJ_ROC, TX_OBJ_ROC, TX_OBJ_ROC, TX_OBJ_ROC, + TX_OBJ_ROC, TX_OBJ_ROC, TX_OBJ_ROC, + -TX_OBJ_PIERRE, + TX_OBJ_FEU, TX_OBJ_FEU, TX_OBJ_FEU, TX_OBJ_FEU, + TX_OBJ_FEU, TX_OBJ_FEU, TX_OBJ_FEU, TX_OBJ_FEU, + 0,0,0,0, + -TX_OBJ_TOMATE, -TX_OBJ_TOMATE, -TX_OBJ_TOMATE, -TX_OBJ_TOMATE, + TX_OBJ_CABANE, TX_OBJ_CABANE, + -TX_OBJ_OEUF, TX_OBJ_OEUF, + TX_OBJ_PALISSADE, TX_OBJ_PALISSADE, TX_OBJ_PALISSADE, TX_OBJ_PALISSADE, + TX_OBJ_PALISSADE, TX_OBJ_PALISSADE, TX_OBJ_PALISSADE, + TX_OBJ_PONT, TX_OBJ_PONT, + 0,0,0,0,0,0, + -TX_OBJ_POTION, + TX_OBJ_FLEUR1, -TX_OBJ_BOUQUET1, + TX_OBJ_FLEUR2, -TX_OBJ_BOUQUET2, + -TX_OBJ_DYNAMITE, -TX_OBJ_DYNAMITE, -TX_OBJ_DYNAMITE, + 0,0,0,0, + -TX_OBJ_POISON, + -TX_OBJ_PIEGE, + TX_OBJ_FLEUR3, -TX_OBJ_BOUQUET3, + -TX_OBJ_ENNEMIp, -TX_OBJ_ENNEMIp, -TX_OBJ_ENNEMIp, + TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, + TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, + TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, + TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, + TX_OBJ_MAISON, + -TX_OBJ_ENNEMIp, + TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, + -TX_OBJ_BATEAU, + -TX_OBJ_JEEP, + TX_OBJ_USINE, TX_OBJ_USINE, + TX_OBJ_MINEFER, TX_OBJ_MINEFER, + -TX_OBJ_FER, + TX_OBJ_DRAPEAU, + -TX_OBJ_MINE, + TX_OBJ_MINEFER, + -TX_OBJ_MINE, + TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, + -TX_OBJ_ENNEMIp, + }; + + static short table_floor[] = + { + 85, // nb + 0, + TX_OBJ_HERBE, + TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, + TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, + TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, + TX_OBJ_EAU, + TX_OBJ_DALLE, TX_OBJ_DALLE, + TX_OBJ_HACHURE, + TX_OBJ_GLACE, + TX_OBJ_MOUSSEb, + TX_OBJ_MOUSSE, + TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, + TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, + TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, + TX_OBJ_TERRE, + TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, + TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, + TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, + TX_OBJ_TERRE, TX_OBJ_TERRE, TX_OBJ_TERRE, + TX_OBJ_HERBE, TX_OBJ_HERBE, TX_OBJ_HERBE, + TX_OBJ_COUVEUSE, TX_OBJ_COUVEUSE, TX_OBJ_COUVEUSE, + TX_OBJ_COUVEUSE, TX_OBJ_COUVEUSE, + TX_OBJ_HERBE, + TX_OBJ_MOUSSE, + TX_OBJ_PONT, TX_OBJ_PONT, TX_OBJ_PONT, + TX_OBJ_PONT, TX_OBJ_PONT, TX_OBJ_PONT, + TX_OBJ_ENNEMIs, TX_OBJ_MIXTE, TX_OBJ_ENNEMIs, + TX_OBJ_EAU, TX_OBJ_EAU, TX_OBJ_EAU, + TX_OBJ_TERRE, + 0,0,0,0, + 0,0, + TX_OBJ_MIXTE, TX_OBJ_MIXTE, + TX_OBJ_TELEPORTE, TX_OBJ_TELEPORTE, TX_OBJ_TELEPORTE, + TX_OBJ_TELEPORTE, TX_OBJ_TELEPORTE, + }; + + if ( m_bHideTooltips ) return -1; // rien si menu présent + + if ( posMouse.x < POSDRAWX || + posMouse.x > POSDRAWX+DIMDRAWX || + posMouse.y < POSDRAWY || + posMouse.y > POSDRAWY+DIMDRAWY ) return -1; + + if ( m_celHili.x != -1 ) + { + if ( m_rankHili != -1 ) // blupi visé ? + { + if ( m_blupi[m_rankHili].perso == 0 ) // blupi ? + { + res = TX_OBJ_BLUPI; + if ( m_blupi[m_rankHili].energy <= MAXENERGY/4 ) + { + res = TX_OBJ_BLUPIf; + } + if ( m_blupi[m_rankHili].bMalade ) + { + res = TX_OBJ_BLUPIm; + } + } + if ( m_blupi[m_rankHili].perso == 1 ) // araignée ? + { + res = TX_OBJ_ARAIGNEE; + } + if ( m_blupi[m_rankHili].perso == 2 ) // virus ? + { + res = TX_OBJ_VIRUS; + } + if ( m_blupi[m_rankHili].perso == 3 ) // tracks ? + { + res = TX_OBJ_TRACKS; + } + if ( m_blupi[m_rankHili].perso == 4 ) // robot ? + { + res = TX_OBJ_ROBOT; + } + if ( m_blupi[m_rankHili].perso == 5 ) // bombe ? + { + res = TX_OBJ_BOMBE; + } + if ( m_blupi[m_rankHili].perso == 7 ) // electro ? + { + res = TX_OBJ_ELECTRO; + } + if ( m_blupi[m_rankHili].perso == 8 ) // disciple ? + { + res = TX_OBJ_DISCIPLE; + } + + return res; + } + else + { + icon = m_decor[m_celHili.x/2][m_celHili.y/2].objectIcon; + if ( icon != -1 && icon < table_object[0] ) + { + res = table_object[1+icon]; + if ( res != 0 ) + { + if ( res > 0 ) return res; + if ( m_celHili.x%2 != 0 && + m_celHili.y%2 != 0 ) return -res; + } + } + + icon = m_decor[m_celHili.x/2][m_celHili.y/2].floorIcon; + if ( icon != -1 && icon < table_floor[0] ) + { + res = table_floor[1+icon]; + if ( res != 0 ) return res; + } + } + } + + return -1; +} + +// Indique si le menu est présent et qu'il faut cacher +// les tooltips du décor. + +void CDecor::HideTooltips(BOOL bHide) +{ + m_bHideTooltips = bHide; +} + + +// Modifie l'origine supérieure/gauche du décor. + +void CDecor::SetCoin(POINT coin, BOOL bCenter) +{ + if ( bCenter ) + { + coin.x -= 10; + coin.y -= 2; + } + + if ( coin.x < -8 ) coin.x = -8; + if ( coin.x > MAXCELX-12 ) coin.x = MAXCELX-12; + if ( coin.y < -2 ) coin.y = -2; + if ( coin.y > MAXCELY-4 ) coin.y = MAXCELY-4; + + m_celCoin = coin; + m_bGroundRedraw = TRUE; // faudra redessiner les sols + m_celHili.x = -1; + m_textLastPos.x = -1; // tooltips plus lavable ! +} + +POINT CDecor::GetCoin() +{ + return m_celCoin; +} + +POINT CDecor::GetHome() +{ + return m_celHome; +} + + +// Mémoirise une position pendant le jeu. + +void CDecor::MemoPos(int rank, BOOL bRecord) +{ + POINT pos; + + pos.x = LXIMAGE/2; + pos.y = LYIMAGE/2; + + if ( rank < 0 || rank >= 4 ) return; + + if ( bRecord ) + { + m_pSound->PlayImage(SOUND_CLOSE, pos); + m_memoPos[rank] = m_celCoin; + } + else + { + if ( m_memoPos[rank].x == 0 && + m_memoPos[rank].y == 0 ) + { + m_pSound->PlayImage(SOUND_BOING, pos); + } + else + { + m_pSound->PlayImage(SOUND_BUT, pos); + SetCoin(m_memoPos[rank], FALSE); + } + } +} + + +// Gestion du temps absolu global. + +void CDecor::SetTime(int time) +{ + m_time = time; + m_timeConst = time; // vraiment ? + m_timeFlipOutline = time; +} + +int CDecor::GetTime() +{ + return m_time; +} + + +// Gestion de la musique midi. + +void CDecor::SetMusic(int music) +{ + m_music = music; +} + +int CDecor::GetMusic() +{ + return m_music; +} + + +// Gestion de la difficulté. + +void CDecor::SetSkill(int skill) +{ + m_skill = skill; +} + +int CDecor::GetSkill() +{ + return m_skill; +} + + +// Gestion de la région. +// 0 = normal +// 1 = palmier +// 2 = hiver +// 3 = sapin + +void CDecor::SetRegion(int region) +{ + m_region = region; +} + +int CDecor::GetRegion() +{ + return m_region; +} + + +// Gestion des infos. + +void CDecor::SetInfoMode(BOOL bInfo) +{ + m_bInfo = bInfo; + m_bGroundRedraw = TRUE; // faudra redessiner les sols +} + +BOOL CDecor::GetInfoMode() +{ + return m_bInfo; +} + +void CDecor::SetInfoHeight(int height) +{ + m_infoHeight = height; + m_bGroundRedraw = TRUE; // faudra redessiner les sols +} + +int CDecor::GetInfoHeight() +{ + if ( m_bInfo ) return m_infoHeight; + else return 0; +} + + +// Retourne le pointeur à la liste des boutons existants. + +char* CDecor::GetButtonExist() +{ + return m_buttonExist; +} + + + +// Ouvre le buffer pour le undo pendant la construction. + +void CDecor::UndoOpen() +{ + if ( m_pUndoDecor == NULL ) + { + m_pUndoDecor = (Cellule*)malloc(sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2)); + } +} + +// Ferme le buffer pour le undo pendant la construction. + +void CDecor::UndoClose() +{ + if ( m_pUndoDecor != NULL ) + { + free(m_pUndoDecor); + m_pUndoDecor = NULL; + } +} + +// Copie le décor dans le buffer pour le undo. + +void CDecor::UndoCopy() +{ + UndoOpen(); // ouvre le buffer du undo si nécessaire + + if ( m_pUndoDecor != NULL ) + { + memcpy(m_pUndoDecor, &m_decor, sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2)); + } +} + +// Revient en arrière pour tout le décor. + +void CDecor::UndoBack() +{ + if ( m_pUndoDecor != NULL ) + { + memcpy(&m_decor, m_pUndoDecor, sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2)); + UndoClose(); + m_bGroundRedraw = TRUE; + } +} + +// Indique s'il est possible d'effectuer un undo. + +BOOL CDecor::IsUndo() +{ + return ( m_pUndoDecor != NULL ); +} diff --git a/decor.h b/decor.h new file mode 100644 index 0000000..872cacc --- /dev/null +++ b/decor.h @@ -0,0 +1,546 @@ +// Decor.h + +#pragma once + +#include + +#include "DEF.H" +#include "SOUND.H" +#include "PIXMAP.H" + +///////////////////////////////////////////////////////////////////////////// + + +#define MAXENERGY 4000 +#define MAXFIRE 400 + +#define ICON_HILI_STAT 112 +#define ICON_HILI_SEL 113 +#define ICON_HILI_ANY 114 +#define ICON_HILI_OP 115 +#define ICON_HILI_GO 117 +#define ICON_HILI_BUILD 118 +#define ICON_HILI_ERR 119 + +// Descripteur d'une cellule du décor. +typedef struct +{ + short floorChannel; + short floorIcon; + short objectChannel; + short objectIcon; + short fog; // brouillard + short rankMove; // rang dans m_move + short workBlupi; // rang du blupi travaillant ici + short fire; +} +Cellule; +// Cette structure doit être la plus petite possible, car +// il en existe un tableau de 100x100 = 10'000 cellules ! + +// Descripteur d'un blupi animé. +#define MAXBLUPI 100 +#define MAXUSED 50 +#define MAXLIST 10 + +typedef struct +{ + BOOL bExist; // TRUE -> utilisé + BOOL bHili; // TRUE -> sélectionné + + short perso; // personnage, voir (*) + + short goalAction; // action (long terme) + short goalPhase; // phase (long terme) + POINT goalCel; // cellule visée (long terme) + POINT passCel; // cellule tranversante + + short energy; // énergie restante + + POINT cel; // cellule actuelle + POINT destCel; // cellule destination + short action; // action en cours + short aDirect; // direction actuelle + short sDirect; // direction souhaitée + + POINT pos; // position relative à partir de la cellule + short posZ; // déplacement z + short channel; + short lastIcon; + short icon; + short phase; // phase dans l'action + short step; // pas global + short interrupt; // 0=prioritaire, 1=normal, 2=misc + short clipLeft; + + int nbUsed; // nb de points déjà visités + char nextRankUsed; + POINT posUsed[MAXUSED]; + char rankUsed[MAXUSED]; + + short takeChannel; // objet transporté + short takeIcon; + + POINT fix; // point fixe (cultive, pont) + + short jaugePhase; + short jaugeMax; + short stop; // 1 -> devra stopper + short bArrow; // TRUE -> flèche en dessus de blupi + short bRepeat; // TRUE -> répète l'action + short nLoop; // nb de boucles pour GOAL_OTHERLOOP + short cLoop; // boucle en cours + short vIcon; // icône variable + POINT goalHili; // but visé + short bMalade; // TRUE -> blupi malade + short bCache; // TRUE -> caché (pas dessiné) + short vehicule; // véhicule utilisé par blupi, voir (**) + char busyCount; + char busyDelay; + char clicCount; + char clicDelay; + char reserve2[2]; + short listButton[MAXLIST]; + POINT listCel[MAXLIST]; + short listParam[MAXLIST]; + short repeatLevelHope; + short repeatLevel; + short reserve3[88]; +} +Blupi; + +// (*) Personnages : +// 0 -> blupi +// 1 -> araignée +// 2 -> virus +// 3 -> tracks +// 4 -> robot +// 5 -> bombe +// 6 -> détonnateur de mine (invisible) +// 7 -> électro +// 8 -> disciple (robot2) + +// (**) Véhicule : +// 0 -> à pied +// 1 -> en bateau +// 2 -> en jeep +// 3 -> armure + + +// Descripteur d'un décor animé. +#define MAXMOVE 100 +#define MOVEICONNB 1000 + +typedef struct +{ + BOOL bExist; // TRUE -> utilisé + + POINT cel; // cellule du décor + short rankBlupi; // blupi travaillant ici + + BOOL bFloor; // TRUE -> floor, FALSE -> object + short channel; + short icon; + short maskChannel; + short maskIcon; + short phase; // phase pour pMoves ou pIcon + short rankMoves; // *nb,dx,dy,... + short rankIcons; // *nb,i,i,... + + short total; // nb total d'étapes + short delai; // délai entre deux pas + short stepY; // pas vertical *100 + + short cTotal; + short cDelai; +} +Move; + + +#define MAXLASTDRAPEAU 50 + +class CDecor +{ +public: + CDecor(); + ~CDecor(); + + // Arrange.cpp + void ArrangeFloor(POINT cel); + void ArrangeMur(POINT cel, int &icon, int index); + void ArrangeBuild(POINT cel, int &channel, int &icon); + void ArrangeObject(POINT cel); + + BOOL ArrangeFillTestFloor(POINT cel1, POINT cel2); + BOOL ArrangeFillTest(POINT pos); + void ArrangeFillPut(POINT pos, int channel, int icon); + void ArrangeFillSearch(POINT pos); + void ArrangeFill(POINT pos, int channel, int icon, BOOL bFloor); + + void ArrangeBlupi(); + + // Obstacle.cpp + void SearchFloor(int rank, int icon, POINT cel, int *pBits); + void SearchObject(int rank, int icon, POINT cel, int *pBits); + void AjustFloor(int rank, int icon, POINT cel, int *pBits); + void AjustObject(int rank, int icon, POINT cel, int *pBits); + BOOL IsFreeDirect(POINT cel, int direct, int rank); + BOOL IsFreeCelObstacle(POINT cel); + BOOL IsFreeCelFloor(POINT cel, int rank); + BOOL IsFreeCelGo(POINT cel, int rank); + BOOL IsFreeCelHili(POINT cel, int rank); + BOOL IsFreeCel(POINT cel, int rank); + BOOL IsFreeCelDepose(POINT cel, int rank); + BOOL IsFreeCelEmbarque(POINT cel, int rank, int &action, POINT &limit); + BOOL IsFreeCelDebarque(POINT cel, int rank, int &action, POINT &limit); + BOOL IsFreeJump(POINT cel, int direct, int rank, int &action); + BOOL IsFreeGlisse(POINT cel, int direct, int rank, int &action); + int DirectSearch(POINT cel, POINT goal); + void FlushUsed(int rank); + void AddUsedPos(int rank, POINT pos); + BOOL IsUsedPos(int rank, POINT pos); + BOOL SearchBestBase(int rank, int &action, POINT &newCel, int &direct); + BOOL SearchBestPass(int rank, int &action); + BOOL IsWorkableObject(POINT cel, int rank); + BOOL SearchOtherObject(int rank, POINT initCel, int action, + int distMax, int channel, + int firstIcon1, int lastIcon1, + int firstIcon2, int lastIcon2, + POINT &foundCel, int &foundIcon); + BOOL SearchOtherDrapeau(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL SearchOtherBateau(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL IsSpiderObject(int icon); + BOOL SearchSpiderObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL IsTracksObject(int icon); + BOOL SearchTracksObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL IsRobotObject(int icon); + BOOL SearchRobotObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon, + int &foundAction); + BOOL IsBombeObject(int icon); + BOOL SearchBombeObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL SearchElectroObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL IsUsineBuild(int rank, POINT cel); + BOOL IsUsineFree(int rank, POINT cel); + BOOL IsFireCel(POINT cel); + BOOL IsVirusCel(POINT cel); + int IsBuildPont(POINT &cel, int &iconBuild); + BOOL IsBuildBateau(POINT cel, int &direct); + void InitDrapeau(); + void AddDrapeau(POINT cel); + void SubDrapeau(POINT cel); + BOOL TestDrapeau(POINT cel); + + // DecBlupi.cpp + void BlupiFlush(); + int BlupiCreate(POINT cel, int action, int direct, + int perso, int energy); + BOOL BlupiDelete(POINT cel, int perso=-1); + void BlupiDelete(int rank); + void BlupiKill(int exRank, POINT cel, int type); + BOOL BlupiIfExist(int rank); + void BlupiCheat(int cheat); + void BlupiActualise(int rank); + void BlupiAdaptIcon(int rank); + void BlupiPushFog(int rank); + void BlupiSound(int rank, int sound, POINT pos, BOOL bStop=FALSE); + void BlupiInitAction(int rank, int action, int direct=-1); + void BlupiChangeAction(int rank, int action, int direct=-1); + void ListFlush(int rank); + int ListGetParam(int rank, int button, POINT cel); + BOOL ListPut(int rank, int button, POINT cel, POINT cMem); + void ListRemove(int rank); + int ListSearch(int rank, int button, POINT cel, int &textForButton); + BOOL RepeatAdjust(int rank, int button, POINT &cel, POINT &cMem, + int param, int list); + void GoalStart(int rank, int action, POINT cel); + BOOL GoalNextPhase(int rank); + void SetTotalTime(int total); + int GetTotalTime(); + void GoalInitJauge(int rank); + void GoalInitPassCel(int rank); + void GoalAdjustCel(int rank, int &x, int &y); + BOOL GoalNextOp(int rank, short *pTable); + void GoalUnwork(int rank); + void GoalStop(int rank, BOOL bError=FALSE, BOOL bSound=TRUE); + BOOL BlupiIsGoalUsed(POINT cel); + void BlupiStartStopRayon(int rank, POINT startCel, POINT endCel); + BOOL BlupiRotate(int rank); + BOOL BlupiNextAction(int rank); + void BlupiNextGoal(int rank); + void BlupiStep(BOOL bFirst); + void BlupiGetRect(int rank, RECT &rect); + int GetTargetBlupi(POINT pos); + void BlupiDeselect(); + void BlupiDeselect(int rank); + void BlupiSetArrow(int rank, BOOL bArrow); + void InitOutlineRect(); + void BlupiHiliDown(POINT pos, BOOL bAdd=FALSE); + void BlupiHiliMove(POINT pos, BOOL bAdd=FALSE); + void BlupiHiliUp(POINT pos, BOOL bAdd=FALSE); + void BlupiDrawHili(); + int GetDefButton(POINT cel); + BOOL BlupiGoal(int rank, int button, POINT cel, POINT cMem); + void BlupiGoal(POINT cel, int button); + void BlupiDestCel(int rank); + BOOL IsTracksHere(POINT cel, BOOL bSkipInMove); + BOOL IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, BOOL bSkipInMove); + BOOL IsBlupiHereEx(POINT cel, int exRank, BOOL bSkipInMove); + BOOL IsBlupiHere(POINT cel, BOOL bSkipInMove); + BOOL IsBlupiHere(POINT cel, int direct, BOOL bSkipInMove); + void GetLevelJauge(int *pLevels, int *pTypes); + BOOL IsWorkBlupi(int rank); + void BlupiGetButtons(POINT pos, int &nb, int *pButtons, int *pErrors, int &perso); + void TerminatedInit(); + int IsTerminated(); + Term* GetTerminated(); + + // DecMove.cpp + void MoveFlush(); + int MoveMaxFire(); + void MoveFixInit(); + BOOL MoveCreate(POINT cel, int rankBlupi, BOOL bFloor, + int channel, int icon, + int maskChannel, int maskIcon, + int total, int delai, int stepY, + BOOL bMisc=FALSE, BOOL bNotIfExist=FALSE); + BOOL MoveAddMoves(POINT cel, int rankMoves); + BOOL MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue=FALSE); + BOOL MoveStartFire(POINT cel); + void MoveProxiFire(POINT cel); + void MoveFire(int rank); + void MoveStep(BOOL bFirst); + void MoveFinish(POINT cel); + void MoveFinish(int rankBlupi); + BOOL MoveIsUsed(POINT cel); + BOOL MoveGetObject(POINT cel, int &channel, int &icon); + BOOL MovePutObject(POINT cel, int channel, int icon); + + // DecIO.cpp + BOOL Write(int rank, BOOL bUser, int world, int time, int total); + BOOL Read(int rank, BOOL bUser, int &world, int &time, int &total); + BOOL FileExist(int rank, BOOL bUser, int &world, int &time, int &total); + void Flush(); + + // DecMap.cpp + void MapInitColors(); + POINT ConvCelToMap(POINT cel); + POINT ConvMapToCel(POINT pos); + BOOL MapMove(POINT pos); + void MapPutCel(POINT pos); + BOOL GenerateMap(); + + // DecStat.cpp + void StatisticInit(); + void StatisticUpdate(); + int StatisticGetBlupi(); + int StatisticGetFire(); + void StatisticDraw(); + void GenerateStatictic(); + BOOL StatisticDown(POINT pos, int fwKeys); + BOOL StatisticMove(POINT pos, int fwKeys); + BOOL StatisticUp(POINT pos, int fwKeys); + int StatisticDetect(POINT pos); + + // Chemin.cpp + void CheminMemPos(int exRank); + BOOL CheminTestPos(POINT pos, int &rank); + int CheminARebours(int rank); + void CheminFillTerrain(int rank); + BOOL CheminTestDirection(int rank, int pos, int dir, + int &next, int &li, + int &cout, int &action); + BOOL CheminCherche(int rank, int &action); + BOOL IsCheminFree(int rank, POINT dest, int button); + + // Decor.cpp + void SetShiftOffset(POINT offset); + POINT ConvCelToPos(POINT cel); + POINT ConvPosToCel(POINT pos, BOOL bMap=FALSE); + POINT ConvPosToCel2(POINT pos); + + void Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap); + void Init(int channel, int icon); + void InitAfterBuild(); + void ResetHili(); + BOOL LoadImages(); + void ClearFog(); + void ClearFire(); + void SetBuild(BOOL bBuild); + void EnableFog(BOOL bEnable); + BOOL GetInvincible(); + void SetInvincible(BOOL bInvincible); + BOOL GetSuper(); + void SetSuper(BOOL bSuper); + void FlipOutline(); + BOOL PutFloor(POINT cel, int channel, int icon); + BOOL PutObject(POINT cel, int channel, int icon); + BOOL GetFloor(POINT cel, int &channel, int &icon); + BOOL GetObject(POINT cel, int &channel, int &icon); + BOOL SetFire(POINT cel, BOOL bFire); + + void SetCoin(POINT coin, BOOL bCenter=FALSE); + POINT GetCoin(); + POINT GetHome(); + void MemoPos(int rank, BOOL bRecord); + + void SetTime(int time); + int GetTime(); + + void SetMusic(int music); + int GetMusic(); + + void SetSkill(int skill); + int GetSkill(); + + void SetRegion(int region); + int GetRegion(); + + void SetInfoMode(BOOL bInfo); + BOOL GetInfoMode(); + void SetInfoHeight(int height); + int GetInfoHeight(); + + char* GetButtonExist(); + + void BuildPutBlupi(); + void BuildMoveFloor(int x, int y, POINT pos, int rank); + void BuildMoveObject(int x, int y, POINT pos, int rank); + void BuildGround(RECT clip); + void Build(RECT clip, POINT posMouse); + void NextPhase(int mode); + + int CountFloor(int channel, int icon); + int CelOkForAction(POINT cel, int action, int rank, + int icons[4][4], + POINT &celOutline1, + POINT &celOutline2); + int CelOkForAction(POINT cel, int action, int rank); + int GetHiliRankBlupi(int nb); + void CelHili(POINT pos, int action); + void CelHiliButton(POINT cel, int button); + void CelHiliRepeat(int list); + int GetResHili(POINT posMouse); + void HideTooltips(BOOL bHide); + + void UndoOpen(); + void UndoClose(); + void UndoCopy(); + void UndoBack(); + BOOL IsUndo(); + + +protected: + BOOL GetSeeBits(POINT cel, char *pBits, int index); + int GetSeeIcon(char *pBits, int index); + +protected: + HWND m_hWnd; + CSound* m_pSound; + CPixmap* m_pPixmap; + Cellule* m_pUndoDecor; + Cellule m_decor[MAXCELX/2][MAXCELY/2]; + short m_rankBlupi[MAXCELX][MAXCELY]; + Blupi m_blupi[MAXBLUPI]; + Move m_move[MAXMOVE]; + POINT m_celCoin; // cellule sup/gauche + POINT m_celHome; // pour touche Home + POINT m_celHili; + POINT m_celOutline1; + POINT m_celOutline2; + POINT m_shiftOffset; + int m_iconHili[4][4]; + int m_rankHili; // rang du blupi visé + BOOL m_bHiliRect; + POINT m_p1Hili; // coins rectangle de sélection + POINT m_p2Hili; + int m_shiftHili; + int m_nbBlupiHili; // nb de blupi sélectionnés + int m_rankBlupiHili; // rang blupi sélectionné + BOOL m_bFog; // TRUE -> brouillard (jeu) + BOOL m_bBuild; // TRUE -> construction + BOOL m_bInvincible; // TRUE -> cheat code + BOOL m_bSuper; // TRUE -> cheat code + short m_colors[100]; + int m_time; // temps relatif global + int m_timeConst; // temps relatif global constant + int m_timeFlipOutline; // temps quand basculer mode outline + int m_totalTime; // temps total passé sur une partie + int m_phase; // phase pour la carte + POINT m_celArrow; // cellule avec flèche + BOOL m_bOutline; + BOOL m_bGroundRedraw; + char m_buttonExist[MAXBUTTON]; + int m_statNb; // nb de statistiques + int m_statFirst; // première statistique visible + int m_bStatUp; // flèche up statistique + int m_bStatDown; // flèche down statistique + int m_statHili; // statistique survolée + BOOL m_bStatRecalc; // TRUE -> recalcule les statistiques + BOOL m_bStatRedraw; // TRUE -> redessine les statistiques + int m_nbStatHach; // nb de hachures + int m_nbStatHachBlupi; // hachures occupées par blupi + int m_nbStatHachPlanche;// hachures occupées par planches + int m_nbStatHachTomate; // hachures occupées par tomates + int m_nbStatHachMetal; // hachures occupées par métal + int m_nbStatHachRobot; // hachures occupées par robot + int m_nbStatHome; // nb de maisons + int m_nbStatHomeBlupi; // maisons occupées par blupi + int m_nbStatRobots; // nb d'ennemis + Term m_term; // conditions pour gagner + int m_winCount; // compteur avant gagné + int m_winLastHachBlupi; // dernier nombre atteint + int m_winLastHachPlanche;// dernier nombre atteint + int m_winLastHachTomate;// dernier nombre atteint + int m_winLastHachMetal; // dernier nombre atteint + int m_winLastHachRobot; // dernier nombre atteint + int m_winLastHome; // dernier nombre atteint + int m_winLastHomeBlupi; // dernier nombre atteint + int m_winLastRobots; // dernier nombre atteint + int m_music; // numéro musique + int m_region; // numéro région (*) + int m_lastRegion; // numéro dernière région + int m_blupiHere; + POINT m_lastDrapeau[MAXLASTDRAPEAU]; + BOOL m_bHideTooltips; // TRUE -> menu présent + char m_text[50]; + POINT m_textLastPos; + int m_textCount; + int m_skill; + BOOL m_bInfo; + int m_infoHeight; + POINT m_memoPos[4]; + + BYTE m_cheminWork[MAXCELX*MAXCELY]; + int m_cheminNbPos; + POINT m_cheminPos[MAXBLUPI*2]; + int m_cheminRank[MAXBLUPI*2]; + + BOOL m_bFillFloor; + int m_fillSearchChannel; + int m_fillSearchIcon; + int m_fillPutChannel; + int m_fillPutIcon; + char* m_pFillMap; +}; + +// (*) Régions : +// 0 -> normal +// 1 -> palmier +// 2 -> hiver +// 3 -> sapin + +///////////////////////////////////////////////////////////////////////////// + +POINT GetCel (int x, int y); +POINT GetCel (POINT cel, int x, int y); +BOOL IsValid (POINT cel); +POINT GetVector (int direct); +extern int table_multi_goal[]; +extern short table_actions[]; \ No newline at end of file diff --git a/decstat.cpp b/decstat.cpp new file mode 100644 index 0000000..ccab5bc --- /dev/null +++ b/decstat.cpp @@ -0,0 +1,1045 @@ +// DecStat.cpp +// + +#include + +#include "RESOURCE.H" +#include "DECOR.H" +#include "TEXT.H" +#include "MISC.H" + +#define STATNB 12 + +#define STATBLUPIm 0 +#define STATBLUPIf 1 +#define STATBLUPI 2 +#define STATDISCIPLE 3 +#define STATFEU 27 +#define STATROBOT 28 +#define STATTRACKS 29 +#define STATBOMBE 30 +#define STATARAIGNEE 31 +#define STATVIRUS 32 +#define STATELECTRO 33 + + +typedef struct +{ + short bExist; + short perso; // -1=objet, -2=feu, -3=flèche + short firstIcon; // négatif si sol + short lastIcon; // négatif si sol + short drawIcon; + short bBigIcon; + short text; + short nb; + short lastShow; +} +Statistic; + + +static Statistic table_statistic[] = +{ + { // STATBLUPIm = 0 + TRUE, + 0, // blupi malade + 0,0, // + 76, + FALSE, + TX_OBJ_BLUPIm, + 0, 0, + }, + { // STATBLUPIf = 1 + TRUE, + 0, // blupi fatigué + 0,0, // + 13, + FALSE, + TX_OBJ_BLUPIf, + 0, 0, + }, + { // STATBLUPI = 2 + TRUE, + 0, // blupi énergique + 0,0, // + 14, + FALSE, + TX_OBJ_BLUPI, + 0, 0, + }, + { // STATDISCIPLE = 3 + TRUE, + 8, // disciple + 0,0, // + 85, + FALSE, + TX_OBJ_DISCIPLE, + 0, 0, + }, + { // 4 + TRUE, + -1, // objet + 117,117, // bateau + 58, + FALSE, + TX_OBJ_BATEAU, + 0, 0, + }, + { // 5 + TRUE, + -1, // objet + 118,118, // jeep + 65, + FALSE, + TX_OBJ_JEEP, + 0, 0, + }, + { // 6 + TRUE, + -1, // objet + 16,16, // armure + 106, + FALSE, + TX_OBJ_ARMURE, + 0, 0, + }, + { // 7 + TRUE, + -1, // objet + 93,93, // piège + 70, + FALSE, + TX_OBJ_PIEGE, + 0, 0, + }, + { // 8 + TRUE, + -1, // objet + 92,92, // poison + 71, + FALSE, + TX_OBJ_POISON, + 0, 0, + }, + { // 9 + TRUE, + -1, // objet + 85,85, // dynamite + 57, + FALSE, + TX_OBJ_DYNAMITE, + 0, 0, + }, + { // 10 + TRUE, + -1, // objet + 125,125, // mine + 63, + FALSE, + TX_OBJ_MINE, + 0, 0, + }, + { // 11 + TRUE, + -1, // objet + 60,60, // tomate + 28, + FALSE, + TX_OBJ_TOMATE, + 0, 0, + }, + { // 12 + TRUE, + -1, // objet + 80,80, // bouteille + 34, + FALSE, + TX_OBJ_POTION, + 0, 0, + }, + { // 13 + TRUE, + -1, // objet + 36,36, // planches + 22, + FALSE, + TX_OBJ_PLANCHE, + 0, 0, + }, + { // 14 + TRUE, + -1, // objet + 44,44, // pierres + 27, + FALSE, + TX_OBJ_PIERRE, + 0, 0, + }, + { // 15 + TRUE, + -1, // objet + 124,124, // drapeau + 64, + TRUE, + TX_OBJ_DRAPEAU, + 0, 0, + }, + { // 16 + TRUE, + -1, // objet + 123,123, // fer + 62, + FALSE, + TX_OBJ_FER, + 0, 0, + }, + { // 17 + TRUE, + -1, // objet + 82,82, // fleurs1 + 72, + FALSE, + TX_OBJ_FLEUR1, + 0, 0, + }, + { // 18 + TRUE, + -1, // objet + 84,84, // fleurs2 + 73, + FALSE, + TX_OBJ_FLEUR2, + 0, 0, + }, + { // 19 + TRUE, + -1, // objet + 95,95, // fleurs3 + 74, + FALSE, + TX_OBJ_FLEUR3, + 0, 0, + }, + { // 20 + TRUE, + -1, // objet + 61,61, // cabane + 19, + TRUE, + TX_OBJ_CABANE, + 0, 0, + }, + { // 21 + TRUE, + -1, // objet + -52,-56, // couveuse + 25, + FALSE, + TX_OBJ_COUVEUSE, + 0, 0, + }, + { // 22 + TRUE, + -1, // objet + -80,-84, // téléporteur + 101, + FALSE, + TX_OBJ_TELEPORTE, + 0, 0, + }, + { // 23 + TRUE, + -1, // objet + 28,29, // laboratoire + 35, + TRUE, + TX_OBJ_LABO, + 0, 0, + }, + { // 24 + TRUE, + -1, // objet + 121,122, // mine de fer + 61, + TRUE, + TX_OBJ_MINEFER, + 0, 0, + }, + { // 25 + TRUE, + -1, // objet + 119,120, // usine + 59, + TRUE, + TX_OBJ_USINE, + 0, 0, + }, + { // 26 + TRUE, + -1, // objet + 27,27, // tour + 33, + TRUE, + TX_OBJ_TOUR, + 0, 0, + }, + { // STATFEU = 27 + TRUE, + -2, // feu + 0,0, // + 37, + TRUE, + TX_OBJ_FEU, + 0, 0, + }, + { // STATROBOT = 28 + TRUE, + 4, // robot + 0,0, // + 56, + FALSE, + TX_OBJ_ROBOT, + 0, 0, + }, + { // STATTRACKS = 29 + TRUE, + 3, // tracks + 0,0, // + 17, + FALSE, + TX_OBJ_TRACKS, + 0, 0, + }, + { // STATBOMBE = 30 + TRUE, + 5, // bombe + 0,0, // + 38, + FALSE, + TX_OBJ_BOMBE, + 0, 0, + }, + { // STATARAIGNEE = 31 + TRUE, + 1, // araignée + 0,0, // + 15, + FALSE, + TX_OBJ_ARAIGNEE, + 0, 0, + }, + { // STATVIRUS = 32 + TRUE, + 2, // virus + 0,0, // + 16, + FALSE, + TX_OBJ_VIRUS, + 0, 0, + }, + { // STATELECTRO = 33 + TRUE, + 7, // électro + 0,0, // + 75, + FALSE, + TX_OBJ_ELECTRO, + 0, 0, + }, + + { + FALSE, + -1, + 0,0, + -1, + FALSE, + 0, + 999, 999, + }, +}; + + +// Retourne la statistique correspondant à un rang donné. + +Statistic* StatisticGet(int rank) +{ + Statistic* pStatistic; + + pStatistic = table_statistic; + while ( pStatistic->nb == 0 ) + { + pStatistic ++; + } + + while ( rank > 0 ) + { + if ( pStatistic->bExist ) pStatistic ++; + while ( pStatistic->nb == 0 ) + { + pStatistic ++; + } + rank --; + } + + return pStatistic; +} + + + +// Réinitialise les statistiques. + +void CDecor::StatisticInit() +{ + Statistic* pStatistic; + + pStatistic = table_statistic; + while ( pStatistic->bExist ) + { + pStatistic->lastShow = 0; + pStatistic ++; + } + + m_statNb = 0; + m_statFirst = 0; + m_bStatUp = FALSE; + m_bStatDown = FALSE; + m_statHili = -1; + m_bStatRecalc = TRUE; // faudra tout recalculer + m_bStatRedraw = TRUE; // faudra tout redessiner +} + + +// Met à jour tous les compteurs des statistiques. + +void CDecor::StatisticUpdate() +{ + int rank, x, y, icon, nb; + BOOL bHach; + Statistic* pStatistic; + + m_nbStatHach = 0; + m_nbStatHachBlupi = 0; + m_nbStatHachPlanche = 0; + m_nbStatHachTomate = 0; + m_nbStatHachMetal = 0; + m_nbStatHachRobot = 0; + m_nbStatHome = 0; + m_nbStatHomeBlupi = 0; + m_nbStatRobots = 0; + + pStatistic = table_statistic; + while ( pStatistic->bExist ) + { + pStatistic->nb = 0; + pStatistic ++; + } + + for ( rank=0 ; rankbExist ) + { + if ( pStatistic->perso == -1 && + pStatistic->firstIcon > 0 && + icon >= pStatistic->firstIcon && + icon <= pStatistic->lastIcon ) + { + pStatistic->nb ++; + break; + } + pStatistic ++; + } + + if ( icon == 36 && bHach ) // planches ? + { + m_nbStatHachPlanche ++; + } + if ( icon == 60 && bHach ) // tomates ? + { + m_nbStatHachTomate ++; + } + if ( icon == 14 && bHach ) // métal ? + { + m_nbStatHachMetal ++; + } + } + + if ( m_decor[x/2][y/2].floorChannel == CHFLOOR ) + { + icon = m_decor[x/2][y/2].floorIcon; + + if ( (icon >= 52 && icon <= 56) || // couveuse ? + (icon >= 80 && icon <= 84) ) // téléporteur ? + { + pStatistic = table_statistic; + while ( pStatistic->bExist ) + { + if ( pStatistic->perso == -1 && + pStatistic->firstIcon < 0 && + icon >= -(pStatistic->firstIcon) && + icon <= -(pStatistic->lastIcon) ) + { + pStatistic->nb ++; + break; + } + pStatistic ++; + } + } + } + + if ( m_decor[x/2][y/2].fire > 0 && + m_decor[x/2][y/2].fire < MoveMaxFire() ) + { + table_statistic[STATFEU].nb ++; // un feu de plus + } + } + } + + pStatistic = table_statistic; + m_statNb = 0; + while ( pStatistic->bExist ) + { + if ( pStatistic->nb > 0 ) + { + m_statNb ++; + } + pStatistic ++; + } + if ( m_statNb <= STATNB ) // tout visible en une page ? + { + m_bStatUp = FALSE; + m_bStatDown = FALSE; + m_statFirst = 0; + } + else + { + // nb <- nb de pages nécessaires + nb = (m_statNb+STATNB-5)/(STATNB-2); + + m_bStatUp = TRUE; + m_bStatDown = TRUE; + if ( m_statFirst >= 1+(nb-1)*(STATNB-2) ) + { + m_statFirst = 1+(nb-1)*(STATNB-2); + m_bStatDown = FALSE; + } + if ( m_statFirst == 0 ) + { + m_bStatUp = FALSE; + } + } + + m_bStatRecalc = FALSE; // c'est calculé + m_bStatRedraw = TRUE; // faudra tout redessiner +} + +// Retourne le nombre de blupi. + +int CDecor::StatisticGetBlupi() +{ + return table_statistic[STATBLUPIf].nb + + table_statistic[STATBLUPIm].nb + + table_statistic[STATBLUPI].nb; +} + +// Retourne le nombre de cellules en feu. + +int CDecor::StatisticGetFire() +{ + return table_statistic[STATFEU].nb; +} + +// Dessine toutes les statistiques. + +void CDecor::StatisticDraw() +{ + POINT pos; + RECT rect; + int rank, icon, nb, textRes; + Statistic* pStatistic; + char text[50]; + + pStatistic = table_statistic; + + while ( pStatistic->nb == 0 ) + { + pStatistic ++; + } + + nb = m_statFirst; + while ( nb > 0 ) + { + if ( pStatistic->bExist ) pStatistic ++; + while ( pStatistic->nb == 0 ) + { + pStatistic ++; + } + nb --; + } + + textRes = 0; + for ( rank=0 ; rankDrawPart(-1, CHBACK, pos, rect, 1); // dessine le fond + + if ( rank == 0 && m_bStatUp ) + { + icon = 6+66; // flèche up + if ( rank == m_statHili ) // statistique survolée ? + { + icon ++; + } + pos.x -= 3; + pos.y -= 5; + if ( pStatistic->drawIcon == 68 ) pos.x += 26; + m_pPixmap->DrawIcon(-1, CHBUTTON, icon, pos); // flèche up + continue; + } + + if ( rank == STATNB-1 && m_bStatDown ) + { + icon = 6+68; // flèche down + if ( rank == m_statHili ) // statistique survolée ? + { + icon ++; + } + pos.x += 23; + pos.y -= 5; + m_pPixmap->DrawIcon(-1, CHBUTTON, icon, pos); // flèche down + continue; + } + + if ( !pStatistic->bExist ) goto next; + + icon = 6+pStatistic->drawIcon; + + if ( rank == m_statHili ) // statistique survolée ? + { + m_pPixmap->DrawIconDemi(-1, CHBLUPI, ICON_HILI_STAT, pos); + textRes = pStatistic->text; + } + + if ( pStatistic->nb > 0 ) + { + pos.x -= 3; + pos.y -= 5; + m_pPixmap->DrawIcon(-1, CHBUTTON, icon, pos); + + nb = pStatistic->nb; + sprintf(text, "%d", nb); + pos.x += 3+34; + pos.y += 5+7; + DrawText(m_pPixmap, pos, text); + } + + next: + if ( pStatistic->bExist ) pStatistic ++; + while ( pStatistic->nb == 0 ) + { + pStatistic ++; + } + } + + // Dans un bouton stop/setup/write ? + if ( textRes == 0 && m_statHili >= 100 ) + { + if ( m_statHili == 100 ) textRes = TX_BUTTON_PLAY_STOP; + if ( m_statHili == 101 ) textRes = TX_BUTTON_PLAY_SETUP; + if ( m_statHili == 102 ) textRes = TX_BUTTON_PLAY_WRITE; + } + + // Dessine le nom de la statistique survolée. + pos.x = 0; + pos.y = 404; + rect.left = pos.x; + rect.right = pos.x+POSDRAWX; + rect.top = pos.y; + rect.bottom = pos.y+16; + m_pPixmap->DrawPart(-1, CHBACK, pos, rect, 1); // dessine le fond + + if ( textRes != 0 ) + { + LoadString(textRes, text, 50); + nb = GetTextWidth(text); + pos.x += (POSDRAWX-nb)/2; + DrawText(m_pPixmap, pos, text); + } + + m_bStatRedraw = FALSE; // dessin plus nécessaire +} + +// Génère les statistiques. + +void CDecor::GenerateStatictic() +{ + if ( m_bBuild ) return; + + if ( m_bStatRecalc || m_phase%20 == 10 ) + { + StatisticUpdate(); // met à jour les compteurs + } + + if ( m_bStatRedraw ) + { + StatisticDraw(); // redessine tout + } +} + + +// Bouton pressé dans les statistiques. + +BOOL CDecor::StatisticDown(POINT pos, int fwKeys) +{ + int hili, rank, x, y, show, icon; + POINT cel; + Statistic* pStatistic; + + StatisticUpdate(); + + hili = StatisticDetect(pos); + if ( hili < 0 ) return FALSE; + + if ( m_bStatUp && hili == 0 ) // flèche up ? + { + m_statFirst -= STATNB-2; + if ( m_statFirst < STATNB-1 ) + { + m_statFirst = 0; + } + StatisticUpdate(); + pos.x = LXIMAGE/2; + pos.y = LYIMAGE/2; + m_pSound->PlayImage(SOUND_OPEN, pos); + return TRUE; + } + + if ( m_bStatDown && hili == STATNB-1 ) // flèche down ? + { + if ( m_statFirst == 0 ) + { + m_statFirst = STATNB-1; + } + else + { + m_statFirst += STATNB-2; + } + StatisticUpdate(); + pos.x = LXIMAGE/2; + pos.y = LYIMAGE/2; + m_pSound->PlayImage(SOUND_OPEN, pos); + return TRUE; + } + + rank = m_statFirst+hili; + if ( rank > 0 && m_bStatUp ) rank --; + pStatistic = StatisticGet(rank); + if ( !pStatistic->bExist ) return FALSE; + + show = pStatistic->lastShow % pStatistic->nb; + pStatistic->lastShow ++; + + if ( pStatistic->perso >= 0 ) // blupi/araignée ? + { + for ( rank=0 ; rankperso ) continue; + + if ( m_blupi[rank].perso != 0 || + (m_blupi[rank].bMalade && + pStatistic->drawIcon == 76) || // malade ? + (!m_blupi[rank].bMalade && + m_blupi[rank].energy <= MAXENERGY/4 && + pStatistic->drawIcon == 13) || // fatigué ? + (m_blupi[rank].energy > MAXENERGY/4 && + pStatistic->drawIcon == 14) ) // énergique ? + { + if ( show == 0 ) + { + if ( m_blupi[rank].perso == 0 || // blupi ? + m_blupi[rank].perso == 8 ) // disciple ? + { + BlupiDeselect(); + m_blupi[rank].bHili = TRUE; + m_rankBlupiHili = rank; // sélectionne + m_nbBlupiHili = 1; + } + BlupiSetArrow(rank, TRUE); + cel = m_blupi[rank].cel; + goto select; + } + show --; + } + } + } + } + + if ( pStatistic->perso == -1 && // objet ? + pStatistic->firstIcon > 0 ) + { + for ( x=0 ; x= pStatistic->firstIcon && + icon <= pStatistic->lastIcon ) + { + if ( show == 0 ) + { + cel = GetCel(x,y); + if ( pStatistic->bBigIcon ) + { + // Flèche plus haute. + m_celArrow = GetCel(cel,-2,-2); + } + else + { + m_celArrow = cel; + } + goto select; + } + show --; + } + } + } + } + } + + if ( pStatistic->perso == -1 && // sol ? + pStatistic->firstIcon < 0 ) + { + for ( x=0 ; x= -(pStatistic->firstIcon) && + icon <= -(pStatistic->lastIcon) ) + { + if ( show == 0 ) + { + cel = GetCel(x,y); + if ( pStatistic->bBigIcon ) + { + // Flèche plus haute. + m_celArrow = GetCel(cel,-2,-2); + } + else + { + m_celArrow = cel; + } + goto select; + } + show --; + } + } + } + } + } + + if ( pStatistic->perso == -2 ) // feu ? + { + for ( x=0 ; x 0 && + m_decor[x/2][y/2].fire < MoveMaxFire() ) + { + if ( show == 0 ) + { + cel = GetCel(x,y); + m_celArrow = cel; + goto select; + } + show --; + } + } + } + } + + return FALSE; + + select: + SetCoin(cel, TRUE); + NextPhase(0); // faudra refaire la carte tout de suite + return TRUE; +} + +// Souris déplacée dans les statistiques. + +BOOL CDecor::StatisticMove(POINT pos, int fwKeys) +{ + int rank; + + rank = StatisticDetect(pos); + + if ( rank != m_statHili ) // autre mise en évidence ? + { + m_statHili = rank; + m_bStatRedraw = TRUE; // faudra tout redessiner + } + + return FALSE; +} + +// Bouton relâché dans les statistiques. + +BOOL CDecor::StatisticUp(POINT pos, int fwKeys) +{ + return FALSE; +} + +// Détecte dans quelle statistique est la souris. + +int CDecor::StatisticDetect(POINT pos) +{ + int rank; + + // Dans un bouton stop/setup/write ? + if ( pos.x >= 10 && pos.x <= 10+42*3 && + pos.y >= 422 && pos.y <= 422+40 ) + { + pos.x -= 10; + if ( pos.x%42 > 40 ) return -1; + return 100+pos.x/42; + } + + if ( pos.x >= POSSTATX && pos.x <= POSSTATX+DIMSTATX*2 && + pos.y >= POSSTATY && pos.y <= POSSTATY+DIMSTATY*(STATNB/2) ) + { + rank = ((pos.x-POSSTATX)/DIMSTATX)*(STATNB/2); + rank += ((pos.y-POSSTATY)/DIMSTATY); + if ( rank >= STATNB ) return -1; + + return rank; + } + + return -1; +} + diff --git a/def.h b/def.h new file mode 100644 index 0000000..f63caf4 --- /dev/null +++ b/def.h @@ -0,0 +1,617 @@ +// Def.h +// + +#pragma once + +#include + +#define _DEMO FALSE // TRUE=demo, FALSE=complet +#define _INTRO FALSE // TRUE si images d'introduction +#define _EGAMES FALSE // TRUE version pour eGames +#define _SE FALSE // TRUE eGames Special Edition + + +#define LXIMAGE 640 // dimensions de la fenêtre de jeu +#define LYIMAGE 480 + +#define POSDRAWX 144 // surface de dessin +#define POSDRAWY 15 +#define DIMDRAWX 480 +#define DIMDRAWY 450 + +#define POSMAPX 8 // surface pour la carte +#define POSMAPY 15 +#define DIMMAPX 128 +#define DIMMAPY 128 + +#define MAXCELX 200 // nb max de cellules d'un monde +#define MAXCELY 200 + +#define DIMCELX 60 // dimensions d'une cellule (décor) +#define DIMCELY 30 + +#define DIMOBJX 120 // dimensions d'un objet +#define DIMOBJY 120 + +#define DIMBLUPIX 60 // dimensions de blupi +#define DIMBLUPIY 60 +#define SHIFTBLUPIY 5 // petit décalage vers le haut + +#define DIMBUTTONX 40 // dimensions d'un button +#define DIMBUTTONY 40 + +#define DIMJAUGEX 124 // dimensions de la jauge +#define DIMJAUGEY 22 + +#define POSSTATX 12 // statistiques +#define POSSTATY 220 +#define DIMSTATX 60 +#define DIMSTATY 30 + +#define DIMTEXTX 16 // dimensions max d'un caractère +#define DIMTEXTY 16 + +#define DIMLITTLEX 16 // dimensions max d'un petit caractère +#define DIMLITTLEY 12 + +#define CHBACK 0 +#define CHFLOOR 1 +#define CHOBJECT 2 +#define CHOBJECTo 3 +#define CHBLUPI 4 +#define CHHILI 5 +#define CHFOG 6 +#define CHMASK1 7 +#define CHLITTLE 8 +#define CHMAP 9 +#define CHBUTTON 10 +#define CHGROUND 11 +#define CHJAUGE 12 +#define CHTEXT 13 +#define CHBIGNUM 14 + +#define FOGHIDE 4 + + +// Directions : + +#define DIRECT_E (0*16) // est +#define DIRECT_SE (1*16) // sud-est +#define DIRECT_S (2*16) // sud +#define DIRECT_SO (3*16) // sud-ouest +#define DIRECT_O (4*16) // ouest +#define DIRECT_NO (5*16) // nord-ouest +#define DIRECT_N (6*16) // nord +#define DIRECT_NE (7*16) // nord-est + +// NO +// O | N +// \ | / +// \ | / +// \|/ +// SO -------o------- NE +// /|\ +// / | \ +// / | \ +// S | E +// (y) SE (x) + + +// Actions : + +#define ACTION_STOP 0 // arrêt +#define ACTION_STOPf 1 // arrêt fatigué +#define ACTION_MARCHE 2 // marche +#define ACTION_MARCHEf 3 // marche fatigué +#define ACTION_BUILD 4 // construit +#define ACTION_PIOCHE 5 // pioche +#define ACTION_ENERGY 6 // prend de l'énergie +#define ACTION_TAKE 8 // fait sauter un objet sur la tête (est) +#define ACTION_DEPOSE 9 // repose l'objet sur la tête (est) +#define ACTION_SCIE 10 // scie du bois +#define ACTION_BRULE 11 // blupi crame ! +#define ACTION_TCHAO 12 // blupi disparait ! +#define ACTION_MANGE 13 // blupi mange +#define ACTION_NAISSANCE 14 // naissance +#define ACTION_SAUTE2 15 // saute par-dessus un obstacle +#define ACTION_SAUTE3 16 // saute par-dessus un obstacle +#define ACTION_SAUTE4 17 // saute par-dessus un obstacle +#define ACTION_SAUTE5 18 // saute par-dessus un obstacle +#define ACTION_PONT 19 // pousse un pont +#define ACTION_MISC1 20 // divers 1 (hausse les épaules) +#define ACTION_MISC2 21 // divers 2 (grat-grat) +#define ACTION_MISC3 22 // divers 3 (yoyo) +#define ACTION_MISC1f 23 // divers 1 fatigué (bof-bof) +#define ACTION_GLISSE 24 // glisse en marchant +#define ACTION_BOIT 25 // blupi boit +#define ACTION_LABO 26 // blupi travaille dans son laboratoire +#define ACTION_DYNAMITE 27 // blupi fait péter la dynamite +#define ACTION_DELAY 28 // blupi attend un frame +#define ACTION_CUEILLE1 29 // blupi cueille des fleurs +#define ACTION_CUEILLE2 30 // blupi cueille des fleurs +#define ACTION_MECHE 31 // blupi se bouche les oreilles +#define ACTION_STOPb 32 // arrêt en bateau +#define ACTION_MARCHEb 33 // avance en bateau +#define ACTION_STOPj 34 // arrêt en jeep +#define ACTION_MARCHEj 35 // avance en jeep +#define ACTION_ELECTRO 36 // blupi électrocuté +#define ACTION_GRILLE1 37 // blupi grille (phase 1) +#define ACTION_GRILLE2 38 // blupi grille (phase 2) +#define ACTION_GRILLE3 39 // blupi grille (phase 3) +#define ACTION_MISC4 40 // divers 4 (ferme les yeux) +#define ACTION_CONTENT 41 // blupi est content +#define ACTION_ARROSE 42 // blupi arrose +#define ACTION_BECHE 43 // blupi bèche +#define ACTION_CUEILLE3 44 // blupi cueille des fleurs +#define ACTION_BUILDBREF 45 // construit +#define ACTION_BUILDSEC 46 // construit +#define ACTION_BUILDSOURD 47 // construit +#define ACTION_BUILDPIERRE 48 // construit +#define ACTION_PIOCHEPIERRE 49 // pioche +#define ACTION_PIOCHESOURD 50 // pioche +#define ACTION_MISC5 51 // divers 5 (ohé) +#define ACTION_TELEPORTE1 52 // téléporte +#define ACTION_TELEPORTE2 53 // téléporte +#define ACTION_TELEPORTE3 54 // téléporte +#define ACTION_STOPa 55 // arrêt armure +#define ACTION_MARCHEa 56 // marche armure +#define ACTION_ARMUREOPEN 57 // ouvre armure +#define ACTION_ARMURECLOSE 58 // ferme armure +#define ACTION_SAUTE1 59 // saute dans la jeep +#define ACTION_MISC6 60 // divers 6 (diabolo) + +#define ACTION_A_STOP 100 // araignée: arrêt +#define ACTION_A_MARCHE 101 // araignée: marche +#define ACTION_A_SAUT 102 // araignée: saute +#define ACTION_A_GRILLE 103 // araignée: grille dans rayon +#define ACTION_A_POISON 105 // araignée: empoisonée +#define ACTION_A_MORT1 106 // araignée: meurt +#define ACTION_A_MORT2 107 // araignée: meurt +#define ACTION_A_MORT3 108 // araignée: meurt + +#define ACTION_V_STOP 200 // virus: arrêt +#define ACTION_V_MARCHE 201 // virus: marche +#define ACTION_V_GRILLE 202 // virus: grille dans rayon + +#define ACTION_T_STOP 300 // tracks: arrêt +#define ACTION_T_MARCHE 301 // tracks: marche +#define ACTION_T_ECRASE 302 // tracks: écrase un objet + +#define ACTION_R_STOP 400 // robot: arrêt +#define ACTION_R_MARCHE 401 // robot: marche +#define ACTION_R_APLAT 402 // robot: applatit +#define ACTION_R_BUILD 403 // robot: construit +#define ACTION_R_DELAY 404 // robot: construit +#define ACTION_R_CHARGE 405 // robot: recharge +#define ACTION_R_ECRASE 406 // robot: écrase un objet + +#define ACTION_B_STOP 500 // bombe: arrêt +#define ACTION_B_MARCHE 501 // bombe: marche + +#define ACTION_D_DELAY 600 // détonnateur: attend + +#define ACTION_E_STOP 700 // électro: arrêt +#define ACTION_E_MARCHE 701 // électro: marche +#define ACTION_E_DEBUT 702 // électro: débute +#define ACTION_E_RAYON 703 // électro: rayonne + +#define ACTION_D_STOP 800 // disciple: arrêt +#define ACTION_D_MARCHE 801 // disciple: marche +#define ACTION_D_BUILD 802 // disciple: construit +#define ACTION_D_PIOCHE 803 // disciple: pioche +#define ACTION_D_SCIE 804 // disciple: scie du bois +#define ACTION_D_TCHAO 805 // disciple: disparait ! +#define ACTION_D_CUEILLE1 806 // disciple: cueille des fleurs +#define ACTION_D_CUEILLE2 807 // disciple: cueille des fleurs +#define ACTION_D_MECHE 808 // disciple: se bouche les oreilles +#define ACTION_D_ARROSE 809 // disciple: arrose +#define ACTION_D_BECHE 810 // disciple: bèche + + +// Sons : + +#define SOUND_CLICK 0 +#define SOUND_BOING 1 +#define SOUND_OK1 2 +#define SOUND_OK2 3 +#define SOUND_OK3 4 +#define SOUND_GO1 5 +#define SOUND_GO2 6 +#define SOUND_GO3 7 +#define SOUND_TERM1 8 +#define SOUND_TERM2 9 +#define SOUND_TERM3 10 +#define SOUND_COUPTERRE 11 +#define SOUND_COUPTOC 12 +#define SOUND_SAUT 13 +#define SOUND_HOP 14 +#define SOUND_SCIE 15 +#define SOUND_FEU 16 +#define SOUND_BRULE 17 +#define SOUND_TCHAO 18 +#define SOUND_MANGE 19 +#define SOUND_NAISSANCE 20 +#define SOUND_A_SAUT 21 +#define SOUND_A_HIHI 22 +#define SOUND_PLOUF 23 +#define SOUND_BUT 24 +#define SOUND_RAYON1 25 +#define SOUND_RAYON2 26 +#define SOUND_VIRUS 27 +#define SOUND_GLISSE 28 +#define SOUND_BOIT 29 +#define SOUND_LABO 30 +#define SOUND_DYNAMITE 31 +#define SOUND_PORTE 32 +#define SOUND_FLEUR 33 +#define SOUND_T_MOTEUR 34 +#define SOUND_T_ECRASE 35 +#define SOUND_PIEGE 36 +#define SOUND_AIE 37 +#define SOUND_A_POISON 38 +#define SOUND_R_MOTEUR 39 +#define SOUND_R_APLAT 40 +#define SOUND_R_ROTATE 41 +#define SOUND_R_CHARGE 42 +#define SOUND_B_SAUT 43 +#define SOUND_BATEAU 44 +#define SOUND_JEEP 45 +#define SOUND_MINE 46 +#define SOUND_USINE 47 +#define SOUND_E_RAYON 48 +#define SOUND_E_TOURNE 49 +#define SOUND_ARROSE 50 +#define SOUND_BECHE 51 +#define SOUND_D_BOING 52 +#define SOUND_D_OK 53 +#define SOUND_D_GO 54 +#define SOUND_D_TERM 55 +#define SOUND_BOING1 56 +#define SOUND_BOING2 57 +#define SOUND_BOING3 58 +#define SOUND_OK4 59 +#define SOUND_OK5 60 +#define SOUND_OK6 61 +#define SOUND_OK1f 62 +#define SOUND_OK2f 63 +#define SOUND_OK3f 64 +#define SOUND_OK1e 65 +#define SOUND_OK2e 66 +#define SOUND_OK3e 67 +#define SOUND_GO4 68 +#define SOUND_GO5 69 +#define SOUND_GO6 70 +#define SOUND_TERM4 71 +#define SOUND_TERM5 72 +#define SOUND_TERM6 73 +#define SOUND_COUPSEC 74 +#define SOUND_COUPPIERRE 75 +#define SOUND_COUPSOURD 76 +#define SOUND_COUPBREF 77 +#define SOUND_OPEN 78 +#define SOUND_CLOSE 79 +#define SOUND_TELEPORTE 80 +#define SOUND_ARMUREOPEN 81 +#define SOUND_ARMURECLOSE 82 +#define SOUND_WIN 83 +#define SOUND_LOST 84 +#define SOUND_MOVIE 99 + + +// Boutons (play) : + +#define MAXBUTTON 40 + +#define BUTTON_GO 0 +#define BUTTON_STOP 1 +#define BUTTON_MANGE 2 +#define BUTTON_CARRY 3 +#define BUTTON_DEPOSE 4 +#define BUTTON_ABAT 5 +#define BUTTON_ROC 6 +#define BUTTON_CULTIVE 7 +#define BUTTON_BUILD1 8 +#define BUTTON_BUILD2 9 +#define BUTTON_BUILD3 10 +#define BUTTON_BUILD4 11 +#define BUTTON_BUILD5 12 +#define BUTTON_BUILD6 13 +#define BUTTON_MUR 14 +#define BUTTON_PALIS 15 +#define BUTTON_ABATn 16 +#define BUTTON_ROCn 17 +#define BUTTON_PONT 18 +#define BUTTON_TOUR 19 +#define BUTTON_BOIT 20 +#define BUTTON_LABO 21 +#define BUTTON_FLEUR 22 +#define BUTTON_FLEURn 23 +#define BUTTON_DYNAMITE 24 +#define BUTTON_BATEAU 25 +#define BUTTON_DJEEP 26 +#define BUTTON_DRAPEAU 27 +#define BUTTON_EXTRAIT 28 +#define BUTTON_FABJEEP 29 +#define BUTTON_FABMINE 30 +#define BUTTON_FABDISC 31 +#define BUTTON_REPEAT 32 +#define BUTTON_DARMURE 33 +#define BUTTON_FABARMURE 34 + + +// Erreurs : + +#define ERROR_MISC 1 +#define ERROR_GROUND 2 +#define ERROR_FREE 3 +#define ERROR_PONTOP 4 +#define ERROR_PONTTERM 5 +#define ERROR_TOURISOL 6 +#define ERROR_TOUREAU 7 +#define ERROR_TELE2 8 + + +// Lutins pour la souris + +#define SPRITE_ARROW 1 +#define SPRITE_POINTER 2 +#define SPRITE_MAP 3 +#define SPRITE_ARROWU 4 +#define SPRITE_ARROWD 5 +#define SPRITE_ARROWL 6 +#define SPRITE_ARROWR 7 +#define SPRITE_ARROWUL 8 +#define SPRITE_ARROWUR 9 +#define SPRITE_ARROWDL 10 +#define SPRITE_ARROWDR 11 +#define SPRITE_WAIT 12 +#define SPRITE_EMPTY 13 +#define SPRITE_FILL 14 + + +// User define message + +#define WM_UPDATE (WM_USER+1) + +#define WM_DECOR1 (WM_USER+20) +#define WM_DECOR2 (WM_USER+21) +#define WM_DECOR3 (WM_USER+22) +#define WM_DECOR4 (WM_USER+23) +#define WM_DECOR5 (WM_USER+24) + +#define WM_ACTION_GO (WM_USER+30) +#define WM_ACTION_ABAT1 (WM_USER+31) +#define WM_ACTION_ABAT2 (WM_USER+32) +#define WM_ACTION_ABAT3 (WM_USER+33) +#define WM_ACTION_ABAT4 (WM_USER+34) +#define WM_ACTION_ABAT5 (WM_USER+35) +#define WM_ACTION_ABAT6 (WM_USER+36) +#define WM_ACTION_BUILD1 (WM_USER+37) +#define WM_ACTION_BUILD2 (WM_USER+38) +#define WM_ACTION_BUILD3 (WM_USER+39) +#define WM_ACTION_BUILD4 (WM_USER+40) +#define WM_ACTION_BUILD5 (WM_USER+41) +#define WM_ACTION_BUILD6 (WM_USER+42) +#define WM_ACTION_STOP (WM_USER+43) +#define WM_ACTION_CARRY (WM_USER+44) +#define WM_ACTION_DEPOSE (WM_USER+45) +#define WM_ACTION_ROC1 (WM_USER+46) +#define WM_ACTION_ROC2 (WM_USER+47) +#define WM_ACTION_ROC3 (WM_USER+48) +#define WM_ACTION_ROC4 (WM_USER+49) +#define WM_ACTION_ROC5 (WM_USER+50) +#define WM_ACTION_ROC6 (WM_USER+51) +#define WM_ACTION_ROC7 (WM_USER+52) +#define WM_ACTION_MUR (WM_USER+53) +#define WM_ACTION_CULTIVE (WM_USER+54) +#define WM_ACTION_CULTIVE2 (WM_USER+55) +#define WM_ACTION_MANGE (WM_USER+56) +#define WM_ACTION_MAKE (WM_USER+57) +#define WM_ACTION_BUILD (WM_USER+58) +#define WM_ACTION_PALIS (WM_USER+59) +#define WM_ACTION_NEWBLUPI (WM_USER+60) +#define WM_ACTION_PONTE (WM_USER+61) +#define WM_ACTION_PONTS (WM_USER+62) +#define WM_ACTION_PONTO (WM_USER+63) +#define WM_ACTION_PONTN (WM_USER+64) +#define WM_ACTION_PONTEL (WM_USER+65) +#define WM_ACTION_PONTSL (WM_USER+66) +#define WM_ACTION_PONTOL (WM_USER+67) +#define WM_ACTION_PONTNL (WM_USER+68) +#define WM_ACTION_TOUR (WM_USER+69) +#define WM_ACTION_CARRY2 (WM_USER+70) +#define WM_ACTION_DEPOSE2 (WM_USER+71) +#define WM_ACTION_MANGE2 (WM_USER+72) +#define WM_ACTION_BOIT (WM_USER+73) +#define WM_ACTION_BOIT2 (WM_USER+74) +#define WM_ACTION_LABO (WM_USER+75) +#define WM_ACTION_FLEUR1 (WM_USER+76) +#define WM_ACTION_FLEUR2 (WM_USER+77) +#define WM_ACTION_DYNAMITE (WM_USER+78) +#define WM_ACTION_DYNAMITE2 (WM_USER+79) +#define WM_ACTION_T_DYNAMITE (WM_USER+80) +#define WM_ACTION_FLEUR3 (WM_USER+81) +#define WM_ACTION_R_BUILD1 (WM_USER+82) +#define WM_ACTION_R_BUILD2 (WM_USER+83) +#define WM_ACTION_R_BUILD3 (WM_USER+84) +#define WM_ACTION_R_BUILD4 (WM_USER+85) +#define WM_ACTION_R_MAKE1 (WM_USER+86) +#define WM_ACTION_R_MAKE2 (WM_USER+87) +#define WM_ACTION_R_MAKE3 (WM_USER+88) +#define WM_ACTION_R_MAKE4 (WM_USER+89) +#define WM_ACTION_R_BUILD5 (WM_USER+90) +#define WM_ACTION_R_MAKE5 (WM_USER+91) +#define WM_ACTION_BATEAUE (WM_USER+92) +#define WM_ACTION_BATEAUS (WM_USER+93) +#define WM_ACTION_BATEAUO (WM_USER+94) +#define WM_ACTION_BATEAUN (WM_USER+95) +#define WM_ACTION_BATEAUDE (WM_USER+96) +#define WM_ACTION_BATEAUDS (WM_USER+97) +#define WM_ACTION_BATEAUDO (WM_USER+98) +#define WM_ACTION_BATEAUDN (WM_USER+99) +#define WM_ACTION_BATEAUAE (WM_USER+100) +#define WM_ACTION_BATEAUAS (WM_USER+101) +#define WM_ACTION_BATEAUAO (WM_USER+102) +#define WM_ACTION_BATEAUAN (WM_USER+103) +#define WM_ACTION_MJEEP (WM_USER+104) +#define WM_ACTION_DJEEP (WM_USER+105) +#define WM_ACTION_DRAPEAU (WM_USER+106) +#define WM_ACTION_DRAPEAU2 (WM_USER+107) +#define WM_ACTION_DRAPEAU3 (WM_USER+108) +#define WM_ACTION_EXTRAIT (WM_USER+109) +#define WM_ACTION_FABJEEP (WM_USER+110) +#define WM_ACTION_FABMINE (WM_USER+111) +#define WM_ACTION_MINE (WM_USER+112) +#define WM_ACTION_MINE2 (WM_USER+113) +#define WM_ACTION_R_BUILD6 (WM_USER+114) +#define WM_ACTION_R_MAKE6 (WM_USER+115) +#define WM_ACTION_E_RAYON (WM_USER+116) +#define WM_ACTION_ELECTRO (WM_USER+117) +#define WM_ACTION_ELECTROm (WM_USER+118) +#define WM_ACTION_GRILLE (WM_USER+119) +#define WM_ACTION_MAISON (WM_USER+120) +#define WM_ACTION_FABDISC (WM_USER+121) +#define WM_ACTION_A_MORT (WM_USER+122) +#define WM_ACTION_REPEAT (WM_USER+123) +#define WM_ACTION_TELEPORTE00 (WM_USER+124) +#define WM_ACTION_TELEPORTE10 (WM_USER+125) +#define WM_ACTION_TELEPORTE01 (WM_USER+126) +#define WM_ACTION_TELEPORTE11 (WM_USER+127) +#define WM_ACTION_FABARMURE (WM_USER+128) +#define WM_ACTION_MARMURE (WM_USER+129) +#define WM_ACTION_DARMURE (WM_USER+130) + +#define WM_BUTTON0 (WM_USER+200) +#define WM_BUTTON1 (WM_USER+201) +#define WM_BUTTON2 (WM_USER+202) +#define WM_BUTTON3 (WM_USER+203) +#define WM_BUTTON4 (WM_USER+204) +#define WM_BUTTON5 (WM_USER+205) +#define WM_BUTTON6 (WM_USER+206) +#define WM_BUTTON7 (WM_USER+207) +#define WM_BUTTON8 (WM_USER+208) +#define WM_BUTTON9 (WM_USER+209) +#define WM_BUTTON10 (WM_USER+210) +#define WM_BUTTON11 (WM_USER+211) +#define WM_BUTTON12 (WM_USER+212) +#define WM_BUTTON13 (WM_USER+213) +#define WM_BUTTON14 (WM_USER+214) +#define WM_BUTTON15 (WM_USER+215) +#define WM_BUTTON16 (WM_USER+216) +#define WM_BUTTON17 (WM_USER+217) +#define WM_BUTTON18 (WM_USER+218) +#define WM_BUTTON19 (WM_USER+219) +#define WM_BUTTON20 (WM_USER+220) +#define WM_BUTTON21 (WM_USER+221) +#define WM_BUTTON22 (WM_USER+222) +#define WM_BUTTON23 (WM_USER+223) +#define WM_BUTTON24 (WM_USER+224) +#define WM_BUTTON25 (WM_USER+225) +#define WM_BUTTON26 (WM_USER+226) +#define WM_BUTTON27 (WM_USER+227) +#define WM_BUTTON28 (WM_USER+228) +#define WM_BUTTON29 (WM_USER+229) +#define WM_BUTTON30 (WM_USER+230) +#define WM_BUTTON31 (WM_USER+231) +#define WM_BUTTON32 (WM_USER+232) +#define WM_BUTTON33 (WM_USER+233) +#define WM_BUTTON34 (WM_USER+234) +#define WM_BUTTON35 (WM_USER+235) +#define WM_BUTTON36 (WM_USER+236) +#define WM_BUTTON37 (WM_USER+237) +#define WM_BUTTON38 (WM_USER+238) +#define WM_BUTTON39 (WM_USER+239) + +#define WM_READ0 (WM_USER+300) +#define WM_READ1 (WM_USER+301) +#define WM_READ2 (WM_USER+302) +#define WM_READ3 (WM_USER+303) +#define WM_READ4 (WM_USER+304) +#define WM_READ5 (WM_USER+305) +#define WM_READ6 (WM_USER+306) +#define WM_READ7 (WM_USER+307) +#define WM_READ8 (WM_USER+308) +#define WM_READ9 (WM_USER+309) + +#define WM_WRITE0 (WM_USER+310) +#define WM_WRITE1 (WM_USER+311) +#define WM_WRITE2 (WM_USER+312) +#define WM_WRITE3 (WM_USER+313) +#define WM_WRITE4 (WM_USER+314) +#define WM_WRITE5 (WM_USER+315) +#define WM_WRITE6 (WM_USER+316) +#define WM_WRITE7 (WM_USER+317) +#define WM_WRITE8 (WM_USER+318) +#define WM_WRITE9 (WM_USER+319) + +#define WM_PHASE_INIT (WM_USER+500) +#define WM_PHASE_PLAY (WM_USER+501) +#define WM_PHASE_BUILD (WM_USER+502) +#define WM_PHASE_READ (WM_USER+503) +#define WM_PHASE_WRITE (WM_USER+504) +#define WM_PHASE_INFO (WM_USER+505) +#define WM_PHASE_BUTTON (WM_USER+506) +#define WM_PHASE_TERM (WM_USER+507) +#define WM_PHASE_WIN (WM_USER+508) +#define WM_PHASE_LOST (WM_USER+509) +#define WM_PHASE_STOP (WM_USER+510) +#define WM_PHASE_SETUP (WM_USER+511) +#define WM_PHASE_MUSIC (WM_USER+512) +#define WM_PHASE_PLAYMOVIE (WM_USER+513) +#define WM_PHASE_WINMOVIE (WM_USER+514) +#define WM_PHASE_SCHOOL (WM_USER+515) +#define WM_PHASE_MISSION (WM_USER+516) +#define WM_PHASE_LASTWIN (WM_USER+517) +#define WM_PHASE_WRITEp (WM_USER+518) +#define WM_PHASE_SETUPp (WM_USER+519) +#define WM_PHASE_REGION (WM_USER+520) +#define WM_PHASE_INSERT (WM_USER+521) +#define WM_PHASE_HISTORY0 (WM_USER+522) +#define WM_PHASE_HISTORY1 (WM_USER+523) +#define WM_PHASE_HELP (WM_USER+524) +#define WM_PHASE_H0MOVIE (WM_USER+525) +#define WM_PHASE_H1MOVIE (WM_USER+526) +#define WM_PHASE_H2MOVIE (WM_USER+527) +#define WM_PHASE_TESTCD (WM_USER+528) +#define WM_PHASE_MANUEL (WM_USER+529) +#define WM_PHASE_PRIVATE (WM_USER+530) +#define WM_PHASE_UNDO (WM_USER+531) +#define WM_PHASE_BYE (WM_USER+532) +#define WM_PHASE_SKILL1 (WM_USER+533) +#define WM_PHASE_SKILL2 (WM_USER+534) +#define WM_PHASE_DEMO (WM_USER+535) +#define WM_PHASE_INTRO1 (WM_USER+536) +#define WM_PHASE_INTRO2 (WM_USER+537) + +#define WM_PREV (WM_USER+600) +#define WM_NEXT (WM_USER+601) +#define WM_MOVIE (WM_USER+602) + + + +// Types de gestion de la souris. + +#define MOUSETYPEGRA 1 +#define MOUSETYPEWIN 2 +#define MOUSETYPEWINPOS 3 + + + +// Conditions pour gagner. + +typedef struct +{ + short bHachBlupi; // blupi sur dalle hachurée + short bHachPlanche; // planches sur dalle hachurée + short bStopFire; // feu éteint + short nbMinBlupi; // nb de blupi nécessaires + short nbMaxBlupi; // nb de blupi nécessaires + short bHomeBlupi; // blupi à la maison + short bKillRobots; // plus d'ennemis + short bHachTomate; // tomates sur dalle hachurée + short bHachMetal; // métal sur dalle hachurée + short bHachRobot; // robot sur dalle hachurée + short reserve[14]; +} +Term; + diff --git a/empty.cur b/empty.cur new file mode 100644 index 0000000..0ac9262 Binary files /dev/null and b/empty.cur differ diff --git a/event.cpp b/event.cpp new file mode 100644 index 0000000..4deeb42 --- /dev/null +++ b/event.cpp @@ -0,0 +1,5344 @@ +// Event.cpp +// + +#include +#include +#include +#include +#include "def.h" +#include "resource.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "movie.h" +#include "button.h" +#include "menu.h" +#include "jauge.h" +#include "event.h" +#include "action.h" +#include "text.h" +#include "misc.h" + + +#define DEF_TIME_HELP 10000 // ~10 minutes +#define DEF_TIME_DEMO 1000 // ~1 minute +#define MAXDEMO 2000 + + +typedef struct +{ + short majRev; + short minRev; + short reserve1[9]; + short exercice; // exercice en cours (0..n) + short mission; // mission en cours (0..n) + short speed; + short bMovie; + short maxMission; // dernière mission effectuée (0..n) + short scrollSpeed; + short audioVolume; + short midiVolume; + short bAccessBuild; + short prive; + short skill; + short reserve2[93]; +} +DescInfo; + + + +// Toutes les premières lettres doivent +// être différentes ! + +static char cheat_code[9][20] = +{ + "VISION", // 0 + "POWER", // 1 + "LONESOME", // 2 + "ALLMISSIONS", // 3 + "QUICK", // 4 + "HELPME", // 5 + "INVINCIBLE", // 6 + "SUPERBLUPI", // 7 + "CONSTRUIRE", // 8 (CPOTUSVJSF) +}; + + + +///////////////////////////////////////////////////////////////////////////// + + +static Phase table[] = +{ + { + WM_PHASE_TESTCD, + "image\\init.blp", + FALSE, + { + { + 0 + }, + }, + }, + + { + WM_PHASE_INTRO1, + "image\\intro1.blp", + FALSE, + { + { + 0 + }, + }, + }, + + { + WM_PHASE_INTRO2, + "image\\intro2.blp", + FALSE, + { + { + 0 + }, + }, + }, + + { + WM_PHASE_INIT, + "image\\init.blp", + FALSE, + { + { + WM_PHASE_DEMO, + 0, {1,108}, + 16, 424-60-42*3-18, + {1,TX_BUTTON_DEMO}, + }, + { + WM_PHASE_SCHOOL, + 0, {1,79}, + 16, 424-60-42*2, + {1,TX_BUTTON_APPRENDRE}, + }, + { + WM_PHASE_MISSION, + 0, {1,80}, + 16, 424-60-42*1, + {1,TX_BUTTON_JOUER}, + }, +#if !_DEMO + { + WM_PHASE_PRIVATE, + 0, {1,49}, + 16, 424-60-42*0, + {1,TX_BUTTON_PRIVE}, + }, +#endif + { + WM_PHASE_BYE, +//? WM_CLOSE, + 0, {1,36}, + 16, 424, + {1,TX_BUTTON_QUITTER}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_HISTORY0, + "image\\history0.blp", + TRUE, + { + { + WM_PHASE_INIT, + 0, {1,50}, + 42+42*0, 433, + {1,TX_BUTTON_PREVH}, + }, + { + WM_PHASE_H1MOVIE, + 0, {1,51}, + 558-42*0, 433, + {1,TX_BUTTON_NEXTH}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_HISTORY1, + "image\\history1.blp", + TRUE, + { + { + WM_PHASE_HISTORY0, + 0, {1,50}, + 42+42*0, 433, + {1,TX_BUTTON_PREVH}, + }, + { + WM_PHASE_H2MOVIE, + 0, {1,51}, + 558-42*0, 433, + {1,TX_BUTTON_NEXTH}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_INFO, + "image\\info%.3d.blp", + FALSE, + { + { + WM_PREV, + 0, {1,50}, + 558-42*2, 433, + {1,TX_BUTTON_PREVP}, + }, + { + WM_PHASE_PLAYMOVIE, + 0, {1,48}, + 558-42*1, 433, + {1,TX_BUTTON_PLAYP}, + }, + { + WM_NEXT, + 0, {1,51}, + 558-42*0, 433, + {1,TX_BUTTON_NEXTP}, + }, + { + WM_PHASE_READ, + 0, {1,52}, + 42+42*4, 433, + {1,TX_BUTTON_READP}, + }, + { + WM_PHASE_SETUP, + 0, {1,47}, + 42+42*7, 433, + {1,TX_BUTTON_SETUP}, + }, +#if !_DEMO + { + WM_PHASE_BUILD, + 0, {1,49}, + 42+42*8, 433, + {1,TX_BUTTON_BUILDP}, + }, + { + WM_PHASE_SKILL1, + 0, {1,94}, + 150, 230, + {1,TX_BUTTON_SKILL}, + }, + { + WM_PHASE_SKILL2, + 0, {1,95}, + 150, 230+42, + {1,TX_BUTTON_SKILL}, + }, +#endif + { + WM_PHASE_INIT, + 0, {1,40}, + 42+42*0, 433, + {1,TX_BUTTON_TERM}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_PLAY, + "image\\play.blp", + FALSE, + { + { + WM_PHASE_STOP, + 0, {1,40}, + 10+42*0, 422, + 0, + }, + { + WM_PHASE_SETUPp, + 0, {1,47}, + 10+42*1, 422, + 0, + }, + { + WM_PHASE_WRITEp, + 0, {1,53}, + 10+42*2, 422, + 0, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_STOP, + "image\\stop%.3d.blp", + FALSE, + { + { + WM_PHASE_PLAY, + 0, {1,77}, + 558-42*1, 433, + {1,TX_BUTTON_CONTP}, + }, + { + WM_PHASE_READ, + 0, {1,52}, + 42+42*4, 433, + {1,TX_BUTTON_READP}, + }, + { + WM_PHASE_WRITE, + 0, {1,53}, + 42+42*5, 433, + {1,TX_BUTTON_WRITEP}, + }, + { + WM_PHASE_SETUP, + 0, {1,47}, + 42+42*7, 433, + {1,TX_BUTTON_SETUP}, + }, + { + WM_PHASE_INFO, + 0, {1,78}, + 42+42*0, 433, + {1,TX_BUTTON_CANCELP}, + }, +#if !_DEMO + { + WM_PHASE_HELP, + 0, {1,86}, + 42+42*9, 433, + {1,TX_BUTTON_HELP}, + }, +#endif + { + 0 + }, + }, + }, + + { + WM_PHASE_HELP, + "image\\help.blp", + TRUE, + { + { + WM_PHASE_PLAY, + 0, {1,77}, + 558-42*1, 433, + {1,TX_BUTTON_CONTP}, + }, + { + WM_PHASE_READ, + 0, {1,52}, + 42+42*4, 433, + {1,TX_BUTTON_READP}, + }, + { + WM_PHASE_WRITE, + 0, {1,53}, + 42+42*5, 433, + {1,TX_BUTTON_WRITEP}, + }, + { + WM_PHASE_SETUP, + 0, {1,47}, + 42+42*7, 433, + {1,TX_BUTTON_SETUP}, + }, + { + WM_PHASE_STOP, + 0, {1,50}, + 42+42*0, 433, + {1,TX_BUTTON_PREVH}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_SETUP, + "image\\setup.blp", + FALSE, + { + { + WM_BUTTON1, + 0, {1,50}, + 54, 330, + {1,TX_BUTTON_SETUP1}, + }, + { + WM_BUTTON2, + 0, {1,51}, + 54+40, 330, + {1,TX_BUTTON_SETUP2}, + }, + { + WM_BUTTON3, + 0, {1,50}, + 284, 330, + {1,TX_BUTTON_SETUP3}, + }, + { + WM_BUTTON4, + 0, {1,51}, + 284+40, 330, + {1,TX_BUTTON_SETUP4}, + }, + { + WM_BUTTON5, + 0, {1,50}, + 399, 330, + {1,TX_BUTTON_SETUP5}, + }, + { + WM_BUTTON6, + 0, {1,51}, + 399+40, 330, + {1,TX_BUTTON_SETUP6}, + }, +#if !_EGAMES + { + WM_BUTTON7, + 0, {1,50}, + 514, 330, + {1,TX_BUTTON_SETUP7}, + }, + { + WM_BUTTON8, + 0, {1,51}, + 514+40, 330, + {1,TX_BUTTON_SETUP8}, + }, +#endif + { + WM_BUTTON9, + 0, {1,50}, + 169, 330, + {1,TX_BUTTON_SETUP9}, + }, + { + WM_BUTTON10, + 0, {1,51}, + 169+40, 330, + {1,TX_BUTTON_SETUP10}, + }, + { + WM_PHASE_STOP, + 0, {1,40}, + 11, 424, + {1,TX_BUTTON_TERM}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_SETUPp, + "image\\setup.blp", + FALSE, + { + { + WM_BUTTON1, + 0, {1,50}, + 54, 330, + {1,TX_BUTTON_SETUP1}, + }, + { + WM_BUTTON2, + 0, {1,51}, + 54+40, 330, + {1,TX_BUTTON_SETUP2}, + }, + { + WM_BUTTON3, + 0, {1,50}, + 284, 330, + {1,TX_BUTTON_SETUP3}, + }, + { + WM_BUTTON4, + 0, {1,51}, + 284+40, 330, + {1,TX_BUTTON_SETUP4}, + }, + { + WM_BUTTON5, + 0, {1,50}, + 399, 330, + {1,TX_BUTTON_SETUP5}, + }, + { + WM_BUTTON6, + 0, {1,51}, + 399+40, 330, + {1,TX_BUTTON_SETUP6}, + }, +#if !_EGAMES + { + WM_BUTTON7, + 0, {1,50}, + 514, 330, + {1,TX_BUTTON_SETUP7}, + }, + { + WM_BUTTON8, + 0, {1,51}, + 514+40, 330, + {1,TX_BUTTON_SETUP8}, + }, +#endif + { + WM_BUTTON9, + 0, {1,50}, + 169, 330, + {1,TX_BUTTON_SETUP9}, + }, + { + WM_BUTTON10, + 0, {1,51}, + 169+40, 330, + {1,TX_BUTTON_SETUP10}, + }, + { + WM_PHASE_PLAY, + 0, {1,77}, + 11, 424, + {1,TX_BUTTON_CONTP}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_READ, + "image\\read.blp", + FALSE, + { + { + WM_READ0, + 0, {0}, + 420, 30+42*0, + 0, + }, + { + WM_READ1, + 0, {0}, + 420, 30+42*1, + 0, + }, + { + WM_READ2, + 0, {0}, + 420, 30+42*2, + 0, + }, + { + WM_READ3, + 0, {0}, + 420, 30+42*3, + 0, + }, + { + WM_READ4, + 0, {0}, + 420, 30+42*4, + 0, + }, + { + WM_READ5, + 0, {0}, + 420, 30+42*5, + 0, + }, + { + WM_READ6, + 0, {0}, + 420, 30+42*6, + 0, + }, + { + WM_READ7, + 0, {0}, + 420, 30+42*7, + 0, + }, + { + WM_READ8, + 0, {0}, + 420, 30+42*8, + 0, + }, + { + WM_READ9, + 0, {0}, + 420, 30+42*9, + 0, + }, + { + WM_PHASE_STOP, + 0, {1,40}, + 16, 424, + {1,TX_BUTTON_TERM}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_WRITE, + "image\\write.blp", + FALSE, + { + { + WM_WRITE0, + 0, {0}, + 420, 30+42*0, + 0, + }, + { + WM_WRITE1, + 0, {0}, + 420, 30+42*1, + 0, + }, + { + WM_WRITE2, + 0, {0}, + 420, 30+42*2, + 0, + }, + { + WM_WRITE3, + 0, {0}, + 420, 30+42*3, + 0, + }, + { + WM_WRITE4, + 0, {0}, + 420, 30+42*4, + 0, + }, + { + WM_WRITE5, + 0, {0}, + 420, 30+42*5, + 0, + }, + { + WM_WRITE6, + 0, {0}, + 420, 30+42*6, + 0, + }, + { + WM_WRITE7, + 0, {0}, + 420, 30+42*7, + 0, + }, + { + WM_WRITE8, + 0, {0}, + 420, 30+42*8, + 0, + }, + { + WM_WRITE9, + 0, {0}, + 420, 30+42*9, + 0, + }, + { + WM_PHASE_STOP, + 0, {1,40}, + 16, 424, + {1,TX_BUTTON_TERM}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_WRITEp, + "image\\write.blp", + FALSE, + { + { + WM_WRITE0, + 0, {0}, + 420, 30+42*0, + 0, + }, + { + WM_WRITE1, + 0, {0}, + 420, 30+42*1, + 0, + }, + { + WM_WRITE2, + 0, {0}, + 420, 30+42*2, + 0, + }, + { + WM_WRITE3, + 0, {0}, + 420, 30+42*3, + 0, + }, + { + WM_WRITE4, + 0, {0}, + 420, 30+42*4, + 0, + }, + { + WM_WRITE5, + 0, {0}, + 420, 30+42*5, + 0, + }, + { + WM_WRITE6, + 0, {0}, + 420, 30+42*6, + 0, + }, + { + WM_WRITE7, + 0, {0}, + 420, 30+42*7, + 0, + }, + { + WM_WRITE8, + 0, {0}, + 420, 30+42*8, + 0, + }, + { + WM_WRITE9, + 0, {0}, + 420, 30+42*9, + 0, + }, + { + WM_PHASE_PLAY, + 0, {1,77}, + 16, 424, + {1,TX_BUTTON_CONTP}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_LOST, + "image\\lost.blp", + TRUE, + { + { + WM_PHASE_INFO, + 0, {1,50}, + 9, 431, + {1,TX_BUTTON_REPEAT}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_WIN, + "image\\win.blp", + TRUE, + { + { + WM_NEXT, + 0, {1,51}, + 9, 431, + {1,TX_BUTTON_NEXTP}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_LASTWIN, + "image\\last%.3d.blp", + TRUE, + { + { + WM_PHASE_INIT, + 0, {1,51}, + 9, 431, + {1,TX_BUTTON_NEXTP}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_BUILD, + "image\\build.blp", + TRUE, + { + { + WM_DECOR1, // pose des sols + 0, {6, 0,1,2,3,4,25}, + 11+42*2, 190+42*0, + {6,TX_OBJ_HERBE,TX_OBJ_MOUSSE,TX_OBJ_TERRE, + TX_OBJ_EAU,TX_OBJ_DALLESPEC,TX_OBJ_COUVTELE}, + }, + { + WM_DECOR2, // pose des plantes + 0, {4, 6,7,8,11}, + 11+42*2, 190+42*1, + {4,TX_OBJ_DELOBJ,TX_OBJ_PLANTE, + TX_OBJ_ARBRE,TX_OBJ_FLEUR1}, + }, + { + WM_DECOR3, // pose des batiments + 0, {11, 18,81,33,61,82,93,20,21,22,57,58}, + 11+42*2, 190+42*2, + {11,TX_OBJ_DELOBJ,TX_OBJ_BATIMENT,TX_OBJ_TOUR, + TX_OBJ_MINEFER,TX_OBJ_BATENNEMIS,TX_OBJ_BARENNEMIS, + TX_OBJ_MURPAL,TX_OBJ_ROC,TX_OBJ_OBJET, + TX_OBJ_ARME,TX_OBJ_VEHICULE}, + }, + { + WM_DECOR4, // pose des blupi + 0, {10, 12,13,14,85,15,16,17,38,75,56}, + 11+42*2, 190+42*3, + {10,TX_OBJ_DELPERSO,TX_OBJ_BLUPIf,TX_OBJ_BLUPI, + TX_OBJ_DISCIPLE,TX_OBJ_ARAIGNEE,TX_OBJ_VIRUS, + TX_OBJ_TRACKS,TX_OBJ_BOMBE,TX_OBJ_ELECTRO, + TX_OBJ_ROBOT}, + }, + { + WM_DECOR5, // pose les catastrophes + 0, {2, 36,37}, + 11+42*2, 190+42*4, + {2,TX_OBJ_DELFEU,TX_OBJ_STARTFEU}, + }, + { + WM_PHASE_REGION, + 0, {1,5}, + 11+42*0, 190+42*1, + {1,TX_BUTTON_REGION}, + }, + { + WM_PHASE_MUSIC, + 0, {1,44}, + 11+42*0, 190+42*2, + {1,TX_BUTTON_MUSIC}, + }, + { + WM_PHASE_BUTTON, + 0, {1,46}, + 11+42*0, 190+42*3, + {1,TX_BUTTON_BUTTON}, + }, + { + WM_PHASE_TERM, + 0, {1,45}, + 11+42*0, 190+42*4, + {1,TX_BUTTON_CTERM}, + }, + { + WM_PHASE_INFO, + 0, {1,40}, + 11+42*0, 424, + {1,TX_BUTTON_TERMC}, + }, + { + WM_PHASE_UNDO, + 0, {1,87}, + 11+42*2, 424, + {1,TX_BUTTON_UNDO}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_BUTTON, + "image\\button.blp", + TRUE, + { + { + WM_BUTTON1, // stop + 0, {1,40}, + 170+42*0, 30+52*0, + {1,TX_ACTION_STOP}, + }, + { + WM_BUTTON0, // go + 0, {1,24}, + 170+42*1, 30+52*0, + {1,TX_ACTION_GO}, + }, + { + WM_BUTTON3, // carry + 0, {1,30}, + 170+42*3, 30+52*0, + {1,TX_ACTION_CARRY}, + }, + { + WM_BUTTON4, // depose + 0, {1,31}, + 170+42*4, 30+52*0, + {1,TX_ACTION_DEPOSE}, + }, + { + WM_BUTTON32, // répète + 0, {1,100}, + 170+42*6, 30+52*0, + {1,TX_ACTION_REPEAT}, + }, + + { + WM_BUTTON5, // abat + 0, {1,22}, + 170+42*0, 30+52*1, + {1,TX_ACTION_ABAT}, + }, + { + WM_BUTTON16, // abat n + 0, {1,42}, + 170+42*1, 30+52*1, + {1,TX_ACTION_ABATn}, + }, + { + WM_BUTTON6, // roc + 0, {1,27}, + 170+42*3, 30+52*1, + {1,TX_ACTION_ROC}, + }, + { + WM_BUTTON17, // roc n + 0, {1,43}, + 170+42*4, 30+52*1, + {1,TX_ACTION_ROCn}, + }, + { + WM_BUTTON22, // fleurs + 0, {1,54}, + 170+42*6, 30+52*1, + {1,TX_ACTION_FLEUR}, + }, + { + WM_BUTTON23, // fleurs n + 0, {1,55}, + 170+42*7, 30+52*1, + {1,TX_ACTION_FLEURn}, + }, + + { + WM_BUTTON9, // build2 (couveuse) + 0, {1,25}, + 170+42*0, 30+52*2, + {1,TX_ACTION_BUILD2}, + }, + { + WM_BUTTON15, // palis + 0, {1,26}, + 170+42*1, 30+52*2, + {1,TX_ACTION_PALIS}, + }, + { + WM_BUTTON18, // pont + 0, {1,23}, + 170+42*2, 30+52*2, + {1,TX_ACTION_PONT}, + }, + { + WM_BUTTON25, // bateau + 0, {1,58}, + 170+42*3, 30+52*2, + {1,TX_ACTION_BATEAU}, + }, + { + WM_BUTTON13, // build6 (téléporteur) + 0, {1,101}, + 170+42*4, 30+52*2, + {1,TX_ACTION_BUILD6}, + }, + { + WM_BUTTON14, // mur + 0, {1,20}, + 170+42*6, 30+52*2, + {1,TX_ACTION_MUR}, + }, + { + WM_BUTTON19, // tour + 0, {1,33}, + 170+42*7, 30+52*2, + {1,TX_ACTION_TOUR}, + }, + + { + WM_BUTTON8, // build1 (cabane) + 0, {1,19}, + 170+42*0, 30+52*3, + {1,TX_ACTION_BUILD1}, + }, + { + WM_BUTTON7, // cultive + 0, {1,28}, + 170+42*1, 30+52*3, + {1,TX_ACTION_CULTIVE}, + }, + { + WM_BUTTON2, // mange + 0, {1,32}, + 170+42*2, 30+52*3, + {1,TX_ACTION_MANGE}, + }, + + { + WM_BUTTON10, // build3 (laboratoire) + 0, {1,35}, + 170+42*0, 30+52*4, + {1,TX_ACTION_BUILD3}, + }, + { + WM_BUTTON21, // laboratoire + 0, {1,39}, + 170+42*1, 30+52*4, + {1,TX_ACTION_LABO}, + }, + { + WM_BUTTON20, // boit + 0, {1,34}, + 170+42*2, 30+52*4, + {1,TX_ACTION_BOIT}, + }, + { + WM_BUTTON24, // dynamite + 0, {1,41}, + 170+42*3, 30+52*4, + {1,TX_ACTION_DYNAMITE}, + }, + + { + WM_BUTTON27, // drapeau + 0, {1,64}, + 170+42*0, 30+52*5, + {1,TX_ACTION_DRAPEAU}, + }, + { + WM_BUTTON11, // build4 (mine) + 0, {1,61}, + 170+42*1, 30+52*5, + {1,TX_ACTION_BUILD4}, + }, + { + WM_BUTTON28, // extrait + 0, {1,62}, + 170+42*2, 30+52*5, + {1,TX_ACTION_EXTRAIT}, + }, + { + WM_BUTTON12, // build5 (usine) + 0, {1,59}, + 170+42*4, 30+52*5, + {1,TX_ACTION_BUILD5}, + }, + { + WM_BUTTON29, // fabrique jeep + 0, {1,65}, + 170+42*5, 30+52*5, + {1,TX_ACTION_FABJEEP}, + }, + { + WM_BUTTON30, // fabrique mine + 0, {1,63}, + 170+42*6, 30+52*5, + {1,TX_ACTION_FABMINE}, + }, + { + WM_BUTTON34, // fabrique armure + 0, {1,106}, + 170+42*7, 30+52*5, + {1,TX_ACTION_FABARMURE}, + }, + { + WM_BUTTON31, // fabrique disciple + 0, {1,83}, + 170+42*8, 30+52*5, + {1,TX_ACTION_FABDISC}, + }, + +// { +// WM_BUTTON13, // build6 +// 0, {0}, +// 170+42*2, 30+52*5, +// {1,TX_ACTION_BUILD6}, +// }, + { + WM_PHASE_BUILD, + 0, {1,50}, + 11, 424, + {1,TX_BUTTON_TERM}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_TERM, + "image\\term.blp", + TRUE, + { + { + WM_BUTTON8, // home blupi + 0, {1,81}, + 170+42*0, 30+42*0, + {1,TX_BUTTON_TERMMBLUPI}, + }, + { + WM_BUTTON9, // kill robots + 0, {1,57}, + 170+42*1, 30+42*0, + {1,TX_BUTTON_TERMKILL}, + }, + { + WM_BUTTON3, // stop fire + 0, {1,37}, + 170+42*2, 30+42*0, + {1,TX_BUTTON_TERMFIRE}, + }, + { + WM_BUTTON1, // hach blupi + 0, {1,14}, + 170+42*0, 30+42*2, + {1,TX_BUTTON_TERMHBLUPI}, + }, + { + WM_BUTTON2, // hach planche + 0, {1,22}, + 170+42*1, 30+42*2, + {1,TX_BUTTON_TERMHPLANCHE}, + }, + { + WM_BUTTON10, // hach tomate + 0, {1,28}, + 170+42*2, 30+42*2, + {1,TX_BUTTON_TERMHTOMATE}, + }, + { + WM_BUTTON11, // hach métal + 0, {1,84}, + 170+42*3, 30+42*2, + {1,TX_BUTTON_TERMHMETAL}, + }, + { + WM_BUTTON12, // hach robot + 0, {1,94}, + 170+42*4, 30+42*2, + {1,TX_BUTTON_TERMHROBOT}, + }, + { + WM_BUTTON4, // - min blupi + 0, {1,50}, + 170+42*0, 30+42*4, + {1,TX_BUTTON_TERMDEC}, + }, + { + WM_BUTTON5, // + min blupi + 0, {1,51}, + 170+42*1, 30+42*4, + {1,TX_BUTTON_TERMINC}, + }, + { + WM_BUTTON6, // - max blupi + 0, {1,50}, + 170+42*0, 30+42*5, + {1,TX_BUTTON_TERMDEC}, + }, + { + WM_BUTTON7, // + max blupi + 0, {1,51}, + 170+42*1, 30+42*5, + {1,TX_BUTTON_TERMINC}, + }, + { + WM_PHASE_BUILD, + 0, {1,50}, + 11, 424, + {1,TX_BUTTON_TERM}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_MUSIC, + "image\\music.blp", + TRUE, + { + { + WM_BUTTON1, + 0, {1,40}, + 170+42*0, 30+42*0, + {1,TX_BUTTON_MUSIC1}, + }, + { + WM_BUTTON2, + 0, {1,44}, + 170+42*0, 30+42*1, + {1,TX_BUTTON_MUSIC2}, + }, + { + WM_BUTTON3, + 0, {1,44}, + 170+42*0, 30+42*2, + {1,TX_BUTTON_MUSIC3}, + }, + { + WM_BUTTON4, + 0, {1,44}, + 170+42*0, 30+42*3, + {1,TX_BUTTON_MUSIC4}, + }, + { + WM_BUTTON5, + 0, {1,44}, + 170+42*0, 30+42*4, + {1,TX_BUTTON_MUSIC5}, + }, + { + WM_BUTTON6, + 0, {1,44}, + 170+42*0, 30+42*5, + {1,TX_BUTTON_MUSIC6}, + }, + { + WM_BUTTON7, + 0, {1,44}, + 170+42*0, 30+42*6, + {1,TX_BUTTON_MUSIC7}, + }, + { + WM_BUTTON8, + 0, {1,44}, + 170+42*0, 30+42*7, + {1,TX_BUTTON_MUSIC8}, + }, + { + WM_BUTTON9, + 0, {1,44}, + 170+42*0, 30+42*8, + {1,TX_BUTTON_MUSIC9}, + }, + { + WM_BUTTON10, + 0, {1,44}, + 170+42*0, 30+42*9, + {1,TX_BUTTON_MUSIC10}, + }, + { + WM_PHASE_BUILD, + 0, {1,50}, + 11, 424, + {1,TX_BUTTON_TERM}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_REGION, + "image\\region.blp", + TRUE, + { + { + WM_BUTTON1, // normal + 0, {0}, + 220, 60, + {1,TX_BUTTON_REGION1}, + }, + { + WM_BUTTON4, // sapins + 0, {0}, + 220, 170, + {1,TX_BUTTON_REGION4}, + }, + { + WM_BUTTON2, // palmiers + 0, {0}, + 220, 280, + {1,TX_BUTTON_REGION2}, + }, + { + WM_BUTTON3, // hivers + 0, {0}, + 220, 390, + {1,TX_BUTTON_REGION3}, + }, + { + WM_PHASE_BUILD, + 0, {1,50}, + 11, 424, + {1,TX_BUTTON_TERM}, + }, + { + 0 + }, + }, + }, + + { + WM_PHASE_PLAYMOVIE, + "image\\movie.blp", + FALSE, + { + { + 0 + }, + }, + }, + + { + WM_PHASE_WINMOVIE, + "image\\movie.blp", + FALSE, + { + { + 0 + }, + }, + }, + + { + WM_PHASE_H0MOVIE, + "image\\movie.blp", + FALSE, + { + { + 0 + }, + }, + }, + + { + WM_PHASE_H1MOVIE, + "image\\movie.blp", + FALSE, + { + { + 0 + }, + }, + }, + + { + WM_PHASE_H2MOVIE, + "image\\movie.blp", + FALSE, + { + { + 0 + }, + }, + }, + + { + WM_PHASE_BYE, + "image\\bye.blp", + FALSE, + { + { + 0 + }, + }, + }, + + { + WM_PHASE_INSERT, + "image\\insert.blp", + FALSE, + { +//? { +//? WM_PHASE_INFO, +//? 0, {1,48}, +//? 16, 424-42, +//? {1,TX_BUTTON_PLAYP}, +//? }, + { + WM_PHASE_INIT, + 0, {1,40}, + 16, 424, + {1,TX_BUTTON_QUITTER}, + }, + { + 0 + }, + }, + }, + + { + 0 + } +}; + + +///////////////////////////////////////////////////////////////////////////// + + +// Constructeur. + +CEvent::CEvent() +{ + int i; + + m_bFullScreen = TRUE; + m_mouseType = MOUSETYPEGRA; + m_exercice = 0; + m_mission = 0; + m_private = 0; + m_maxMission = 0; + m_phase = 0; + m_index = -1; + m_bSchool = FALSE; + m_bPrivate = FALSE; + m_bAccessBuild = FALSE; + m_bRunMovie = FALSE; + m_bBuildModify = FALSE; + m_bMousePress = FALSE; + m_bMouseDown = FALSE; + m_oldMousePos.x = 0; + m_oldMousePos.y = 0; + m_mouseSprite = 0; + m_bFillMouse = FALSE; + m_bWaitMouse = FALSE; + m_bHideMouse = FALSE; + m_bShowMouse = FALSE; + m_rankCheat = -1; + m_posCheat = 0; + m_speed = 1; + m_bMovie = TRUE; + m_bSpeed = FALSE; + m_bHelp = FALSE; + m_bAllMissions = FALSE; + m_bChangeCheat = FALSE; + m_scrollSpeed = 1; + m_bPause = FALSE; + m_bShift = FALSE; + m_shiftPhase = 0; + m_movieToStart[0] = 0; + m_bInfoHelp = FALSE; + m_bDemoRec = FALSE; + m_bDemoPlay = FALSE; + m_pDemoBuffer = NULL; + m_demoTime = 0; + m_bCtrlDown = FALSE; + + for ( i=0 ; iGetRegion(), + message); + i ++; + } + + return TRUE; + +} + +// Ajoute un cheat-code dans un buffer. + +void AddCheatCode(char *pDst, char *pSrc) +{ + int i, j; + + if ( pDst[0] != 0 ) strcat(pDst, " / "); + + i = 0; + j = strlen(pDst); + while ( pSrc[i] != 0 ) + { + pDst[j++] = tolower(pSrc[i++]); + } + pDst[j] = 0; +} + +// Dessine un texte multi-lignes centré. + +void CEvent::DrawTextCenter(int res, int x, int y, int font) +{ + char text[100]; + POINT pos; + + LoadString(res, text, 100); + pos.x = x; + pos.y = y; + ::DrawTextCenter(m_pPixmap, pos, text, font); +} + +// Dessine tous les boutons de la phase en cours. + +BOOL CEvent::DrawButtons() +{ + int i; + int levels[2]; + int types[2]; + int world, time, lg, button, volume, pente, icon; + char res[100]; + char text[100]; + POINT pos; + RECT rect; + BOOL bEnable; + +//? +#if 0 + pos.x = 1; + pos.y = 1; + rect.left = pos.x; + rect.right = pos.x+50; + rect.top = pos.y; + rect.bottom = pos.y+DIMLITTLEY; + m_pPixmap->DrawPart(-1, CHBACK, pos, rect, 1); // dessine le fond + time = m_pDecor->GetTotalTime(); + sprintf(text, "time=%d", time); + DrawText(m_pPixmap, pos, text, FONTLITTLE); +#endif +//? + + if ( (m_phase == WM_PHASE_PLAY && m_bChangeCheat) || + (m_phase != WM_PHASE_PLAY && + m_phase != WM_PHASE_INSERT && + m_phase != WM_PHASE_INTRO1 && + m_phase != WM_PHASE_INTRO2 && + m_phase != WM_PHASE_BYE ) ) + { + m_bChangeCheat = FALSE; + + text[0] = 0; + if ( m_bAllMissions ) + { + AddCheatCode(text, cheat_code[3]); + } + if ( m_bSpeed ) + { + AddCheatCode(text, cheat_code[4]); + } + if ( m_bHelp ) + { + AddCheatCode(text, cheat_code[5]); + } + if ( m_pDecor->GetInvincible() ) + { + AddCheatCode(text, cheat_code[6]); + } + if ( m_pDecor->GetSuper() ) + { + AddCheatCode(text, cheat_code[7]); + } + pos.x = 2; + pos.y = 2; + rect.left = pos.x; + rect.right = pos.x+300; + rect.top = pos.y; + rect.bottom = pos.y+DIMLITTLEY; + m_pPixmap->DrawPart(-1, CHBACK, pos, rect, 1); // dessine le fond + DrawText(m_pPixmap, pos, text, FONTLITTLE); + } + + if ( m_phase == WM_PHASE_INIT ) + { + pos.x = 580; + pos.y = 465; +#if _EGAMES + DrawText(m_pPixmap, pos, "Version 1.0", FONTLITTLE); +#else + DrawText(m_pPixmap, pos, "Version 1.7", FONTLITTLE); +#endif +#if _DEMO + pos.x = 580; + pos.y = 465-20; + DrawText(m_pPixmap, pos, "D E M O", FONTRED); +#endif +#if _SE + pos.x = 580; + pos.y = 465-20; + DrawText(m_pPixmap, pos, "S E", FONTRED); +#endif + } + + if ( m_phase == WM_PHASE_SETUP || + m_phase == WM_PHASE_SETUPp ) + { + bEnable = TRUE; + if ( m_speed == 1 ) bEnable = FALSE; + SetEnable(WM_BUTTON1, bEnable); + bEnable = TRUE; + if ( m_speed >= (m_bSpeed?8:2) ) bEnable = FALSE; + SetEnable(WM_BUTTON2, bEnable); + + volume = m_pSound->GetAudioVolume(); + bEnable = TRUE; + if ( volume == 0 || + !m_pSound->GetEnable() ) bEnable = FALSE; + SetEnable(WM_BUTTON3, bEnable); + bEnable = TRUE; + if ( volume >= MAXVOLUME || + !m_pSound->GetEnable() ) bEnable = FALSE; + SetEnable(WM_BUTTON4, bEnable); + + volume = m_pSound->GetMidiVolume(); + bEnable = TRUE; + if ( volume == 0 || + !m_pSound->GetEnable() ) bEnable = FALSE; + SetEnable(WM_BUTTON5, bEnable); + bEnable = TRUE; + if ( volume >= MAXVOLUME || + !m_pSound->GetEnable() ) bEnable = FALSE; + SetEnable(WM_BUTTON6, bEnable); + + if ( m_pMovie->GetEnable() ) + { + SetEnable(WM_BUTTON7, m_bMovie); + SetEnable(WM_BUTTON8, !m_bMovie); + } + else + { + SetEnable(WM_BUTTON7, FALSE); + SetEnable(WM_BUTTON8, FALSE); + } + + bEnable = TRUE; + if ( m_scrollSpeed == 0 ) bEnable = FALSE; + SetEnable(WM_BUTTON9, bEnable); + bEnable = TRUE; + if ( m_scrollSpeed >= 3 ) bEnable = FALSE; + SetEnable(WM_BUTTON10, bEnable); + } + + // Dessine les boutons. + i = 0; + while ( table[m_index].buttons[i].message != 0 ) + { + m_buttons[i].Draw(); + i ++; + } + + if ( m_phase == WM_PHASE_PLAY ) + { + // Dessine les jauges. + m_pDecor->GetLevelJauge(levels, types); + + for ( i=0 ; i<2 ; i++ ) + { + if ( levels[i] < 0 ) + { + m_jauges[i].SetHide(TRUE); + } + else + { + m_jauges[i].SetHide(FALSE); + m_jauges[i].SetLevel(levels[i]); + m_jauges[i].SetType(types[i]); + } + m_jauges[i].Draw(); + } + + // Dessine le menu. + if ( m_menu.IsExist() ) + { + m_pDecor->BlupiGetButtons(m_menuPos, m_menuNb, + m_menuButtons, m_menuErrors, + m_menuPerso); + m_menu.Update(m_menuNb, m_menuButtons, m_menuErrors); + + button = m_menu.GetSel(); + m_pDecor->CelHiliButton(m_menuCel, button); + } + m_menu.Draw(); + + // Dessine la pause. + if ( m_bPause ) + { + DrawTextCenter(TX_PAUSE, (10+134)/2, 20); + } + else + { + if ( m_bDemoRec ) // démo en enregistrement ? + { + DrawTextCenter(TX_DEMOREC, (10+134)/2, 20, FONTRED); + } + if ( m_bDemoPlay ) // démo en restitution ? + { + DrawTextCenter(TX_DEMOPLAY, (10+134)/2, 20, FONTRED); + } + } + + // Dessine la rose des vents. + if ( !m_bPause && !m_bDemoRec && !m_bDemoPlay ) + { + DrawTextCenter(TX_DIRECT_N, (10+134)/2, 17); + DrawTextCenter(TX_DIRECT_S, (10+134)/2, 126); + DrawTextCenter(TX_DIRECT_O, 14, 70); + DrawTextCenter(TX_DIRECT_E, 129, 70); + } + + // Dessine la vitesse. + pos.x = 64; + pos.y = LYIMAGE-15; + rect.left = pos.x; + rect.right = pos.x+20; + rect.top = pos.y; + rect.bottom = pos.y+15; + m_pPixmap->DrawPart(-1, CHBACK, pos, rect, 1); // dessine le fond + if ( m_speed > 1 ) + { + sprintf(res, "x%d", m_speed); + DrawText(m_pPixmap, pos, res); + } + + // Dessine le bouton pour les infos. + if ( m_pDecor->GetInfoMode() ) // infos visibles ? + { + lg = m_pDecor->GetInfoHeight(); + + pos.x = POSDRAWX; + pos.y = 0; + rect.left = POSDRAWX; + rect.right = POSDRAWX+DIMDRAWX; + rect.top = 0; + rect.bottom = lg; + m_pPixmap->DrawPart(-1, CHBACK, pos, rect, 1); + + pos.x = POSDRAWX; + pos.y = lg; + rect.left = POSDRAWX; + rect.right = POSDRAWX+DIMDRAWX; + rect.top = 0; + rect.bottom = POSDRAWY; + m_pPixmap->DrawPart(-1, CHBACK, pos, rect, 1); + + pos.x = POSDRAWX+20; + pos.y = POSDRAWY+4; + DrawTextRect(m_pPixmap, pos, m_libelle, 0, FONTLITTLE, 1); + pos.x = POSDRAWX+DIMDRAWX/2+20; + DrawTextRect(m_pPixmap, pos, m_libelle, 0, FONTLITTLE, 2); + + pos.x = POSDRAWX+DIMDRAWX/2-DIMBUTTONX/2; + pos.y = lg-14; + m_pPixmap->DrawIcon(-1, CHBUTTON, m_bHiliInfoButton?73:72, pos); + + if ( IsHelpHide() ) // bouton pour aide ? + { + m_posHelpButton.x = -1; + } + else + { + m_posHelpButton.x = POSDRAWX+DIMDRAWX-DIMBUTTONX-2; + m_posHelpButton.y = lg-DIMBUTTONY-2; + m_pPixmap->DrawIcon(-1, CHBUTTON, m_bHiliHelpButton?2:0, m_posHelpButton); + if ( m_bInfoHelp ) icon = 86; // livre + else icon = 92; // aide + m_pPixmap->DrawIcon(-1, CHBUTTON, icon, m_posHelpButton); + } + } + else // infos cachées ? + { + pos.x = POSDRAWX+DIMDRAWX/2-DIMBUTTONX/2; + pos.y = -12; + m_pPixmap->DrawIcon(-1, CHBUTTON, m_bHiliInfoButton?75:74, pos); + } + m_posInfoButton = pos; + } + + // Dessine les noms des fichiers. + if ( m_phase == WM_PHASE_READ || + m_phase == WM_PHASE_WRITE || + m_phase == WM_PHASE_WRITEp ) + { + if ( m_phase == WM_PHASE_READ ) + { + LoadString(TX_BUTTON_READP, res, 50); + } + else + { + LoadString(TX_BUTTON_WRITEP, res, 50); + } + pos.x = 420; + pos.y = 8; + DrawText(m_pPixmap, pos, res); + + for ( i=0 ; i<10 ; i++ ) + { + world = m_fileWorld[i]; + time = m_fileTime[i]; + + sprintf(text, "%d", i+1); + lg = GetTextWidth(text); + pos.x = (420+460)/2-lg/2; + pos.y = 30+12+42*i; + DrawText(m_pPixmap, pos, text, FONTSLIM); + + pos.x = 420+50; + + if ( world >= 0 ) + { + if ( world >= 200 ) + { + LoadString(TX_IONAMEPR, res, 50); + sprintf(text, res, (world-200)+1, time/100); + } + else if ( world >= 100 ) + { + LoadString(TX_IONAMEMI, res, 50); + sprintf(text, res, (world-100)+1, time/100); + } + else + { + LoadString(TX_IONAMEEX, res, 50); + sprintf(text, res, world+1, time/100); + } + DrawText(m_pPixmap, pos, text); // partie x, temps t + } + else + { + LoadString(TX_IOFREE, res, 50); + DrawText(m_pPixmap, pos, res, FONTRED); // libre + } + } + } + + // Dessine les réglages pour la fin de la partie. + if ( m_phase == WM_PHASE_TERM ) + { + Term* pTerm = m_pDecor->GetTerminated(); + + DrawTextCenter(TX_TERM, (10+134)/2, 20); + + pos.x = 170+42*2+4; + pos.y = 30+12+42*4; + LoadString(TX_TERMMIN, res, 50); + sprintf(text, res, pTerm->nbMinBlupi); + DrawText(m_pPixmap, pos, text); + + pos.x = 170+42*2+4; + pos.y = 30+12+42*5; + LoadString(TX_TERMMAX, res, 50); + sprintf(text, res, pTerm->nbMaxBlupi); + DrawText(m_pPixmap, pos, text); + } + + // Dessine les textes pour les choix des boutons. + if ( m_phase == WM_PHASE_BUTTON ) + { + DrawTextCenter(TX_BUTTON, (10+134)/2, 20); + } + + // Dessine les textes pour le choix des musiques. + if ( m_phase == WM_PHASE_MUSIC ) + { + DrawTextCenter(TX_MUSIC, (10+134)/2, 20); + } + + // Dessine les textes pour le choix de la région. + if ( m_phase == WM_PHASE_REGION ) + { + DrawTextCenter(TX_REGION, (10+134)/2, 20); + } + + // Ajoute "Mission numéro". + if ( m_phase == WM_PHASE_INFO ) + { + if ( m_bSchool ) LoadString(TX_SCHOOL, res, 50); + else LoadString(TX_MISSION, res, 50); + if ( m_bPrivate ) LoadString(TX_PRIVATE, res, 50); + + lg = GetTextWidth(res); + pos.x = (140+270)/2-lg/2; + pos.y = 70; + if ( m_bSchool ) pos.x -= 40; + if ( m_bPrivate ) pos.x -= 100; + if ( m_bPrivate ) pos.y += 14; + DrawText(m_pPixmap, pos, res, FONTSLIM); + } + + // Ajoute le texte "Partie interrompue". + if ( m_phase == WM_PHASE_STOP ) + { + LoadString(TX_PAUSE, res, 50); + lg = GetTextWidth(res); + pos.x = (140+270)/2-lg/2; + pos.y = 70; + if ( m_bSchool ) pos.x -= 40; + if ( m_bPrivate ) pos.x -= 100; + if ( m_bPrivate ) pos.y += 14; + DrawText(m_pPixmap, pos, res, FONTRED); + } + + // Ajoute le texte "Informations complémentaires". + if ( m_phase == WM_PHASE_HELP ) + { + LoadString(TX_HELP, res, 50); + lg = GetTextWidth(res); + pos.x = (140+270)/2-lg/2; + pos.y = 70; + if ( m_bSchool ) pos.x -= 40; + if ( m_bPrivate ) pos.x -= 100; + if ( m_bPrivate ) pos.y += 14; + DrawText(m_pPixmap, pos, res, FONTRED); + } + + // Ajoute le numéro du monde. + if ( m_phase == WM_PHASE_INFO || + m_phase == WM_PHASE_STOP || + m_phase == WM_PHASE_HELP ) + { + if ( m_bSchool ) world = m_exercice; + else world = m_mission; + if ( m_bPrivate ) world = m_private; + + lg = GetBignumWidth(world+1); + pos.x = (140+270)/2-lg/2; + pos.y = 100; + if ( m_bSchool ) pos.x -= 40; + if ( m_bPrivate ) pos.x -= 135; + if ( m_bPrivate ) pos.y = 115; + DrawBignum(m_pPixmap, pos, world+1); + } + +#if !_DEMO + // Affiche facile/difficile. + if ( m_phase == WM_PHASE_INFO ) + { + if ( !m_bSchool ) + { + if ( m_pDecor->GetSkill() == 0 ) + { + LoadString(TX_SKILL1, res, 50); + if ( m_bPrivate ) + { + pos.x = 117+50; + pos.y = 115+13; + } + else + { + pos.x = 150+50; + pos.y = 230+13; + } + DrawText(m_pPixmap, pos, res, FONTSLIM); + } + + if ( m_pDecor->GetSkill() == 1 ) + { + LoadString(TX_SKILL2, res, 50); + if ( m_bPrivate ) + { + pos.x = 117+50; + pos.y = 115+42+13; + } + else + { + pos.x = 150+50; + pos.y = 230+42+13; + } + DrawText(m_pPixmap, pos, res, FONTSLIM); + } + } + } +#endif + + // Affiche le libellé de l'énigme. + if ( m_phase == WM_PHASE_INFO || + m_phase == WM_PHASE_STOP || + m_phase == WM_PHASE_HELP || + m_phase == WM_PHASE_HISTORY0 || + m_phase == WM_PHASE_HISTORY1 ) + { + pos.x = 355; + pos.y = 70; + if ( m_bSchool ) pos.x -= 20; + if ( m_bPrivate ) + { + pos.x = 460; + pos.y = 260; + } + if ( m_bSchool || m_bPrivate ) pente = 0; + else pente = 19; + DrawTextRect(m_pPixmap, pos, m_libelle, pente, FONTSLIM); + } + + // Affiche le texte lorsque c'est raté. + if ( m_phase == WM_PHASE_LOST ) + { + LoadString(TX_LOST1+GetWorld()%5, res, 50); + pos.x = 60; + pos.y = 443; + DrawText(m_pPixmap, pos, res); + } + + // Affiche le texte lorsque c'est réussi. + if ( m_phase == WM_PHASE_WIN ) + { + LoadString(TX_WIN1+GetWorld()%5, res, 50); + pos.x = 60; + pos.y = 443; + DrawText(m_pPixmap, pos, res); + } + + // Affiche le texte lorsque c'est fini. + if ( m_phase == WM_PHASE_LASTWIN ) + { + if ( m_bSchool ) LoadString(TX_LASTWIN1, res, 50); + else LoadString(TX_LASTWIN2, res, 50); + if ( m_bPrivate ) LoadString(TX_LASTWIN3, res, 50); + pos.x = 60; + pos.y = 443; + DrawText(m_pPixmap, pos, res); + } + + // Dessine les réglages. + if ( m_phase == WM_PHASE_SETUP || + m_phase == WM_PHASE_SETUPp ) + { + DrawTextCenter(TX_INFO_SETUP1, 54+40, 80); + DrawTextCenter(TX_INFO_SETUP5, 169+40, 80); + DrawTextCenter(TX_INFO_SETUP2, 284+40, 80); + DrawTextCenter(TX_INFO_SETUP3, 399+40, 80); +#if !_EGAMES + DrawTextCenter(TX_INFO_SETUP4, 514+40, 80); +#endif + + sprintf(res, "x%d", m_speed); + lg = GetTextWidth(res); + pos.x = (54+40)-lg/2; + pos.y = 330-20; + DrawText(m_pPixmap, pos, res); + + sprintf(res, "%d", m_pSound->GetAudioVolume()); + lg = GetTextWidth(res); + pos.x = (284+40)-lg/2; + pos.y = 330-20; + DrawText(m_pPixmap, pos, res); + + sprintf(res, "%d", m_pSound->GetMidiVolume()); + lg = GetTextWidth(res); + pos.x = (399+40)-lg/2; + pos.y = 330-20; + DrawText(m_pPixmap, pos, res); + +#if !_EGAMES + if ( m_pMovie->GetEnable() ) + { + if ( m_bMovie ) LoadString(TX_OUI, res, 50); + else LoadString(TX_NON, res, 50); + } + else + { + LoadString(TX_NON, res, 50); + } + lg = GetTextWidth(res); + pos.x = (514+40)-lg/2; + pos.y = 330-20; + DrawText(m_pPixmap, pos, res); +#endif + + if ( m_scrollSpeed == 0 ) LoadString(TX_INFO_NOSCROLL, res, 50); + else sprintf(res, "%d", m_scrollSpeed); + lg = GetTextWidth(res); + pos.x = (169+40)-lg/2; + pos.y = 330-20; + DrawText(m_pPixmap, pos, res); + } + + // Affiche le texte de fin de la version demo. + if ( m_phase == WM_PHASE_BYE ) + { +#if _DEMO + LoadString(TX_DEMO_END1, res, 100); +#else + LoadString(TX_FULL_END1, res, 100); +#endif + lg = GetTextWidth(res); + pos.x = LXIMAGE/2-lg/2; + pos.y = 20; + DrawText(m_pPixmap, pos, res); +#if _DEMO + LoadString(TX_DEMO_END2, res, 100); +#else + LoadString(TX_FULL_END2, res, 100); +#endif + lg = GetTextWidth(res); + pos.x = LXIMAGE/2-lg/2; + pos.y = 40; + DrawText(m_pPixmap, pos, res); + +#if _DEMO + LoadString(TX_DEMO_END3, res, 100); +#else + LoadString(TX_FULL_END3, res, 100); +#endif + lg = GetTextWidth(res); + pos.x = LXIMAGE/2-lg/2; + pos.y = 430; + DrawText(m_pPixmap, pos, res); +#if _DEMO + LoadString(TX_DEMO_END4, res, 100); +#else + LoadString(TX_FULL_END4, res, 100); +#endif + lg = GetTextWidth(res); + pos.x = LXIMAGE/2-lg/2; + pos.y = 450; + DrawText(m_pPixmap, pos, res); + } + + // Affiche le texte lorsqu'il faut insérer le CD-Rom. + if ( m_phase == WM_PHASE_INSERT ) + { + DrawTextCenter(TX_INSERT, LXIMAGE/2, 20); + } + + if ( m_phase == WM_PHASE_BUILD ) + { + SetEnable(WM_PHASE_UNDO, m_pDecor->IsUndo()); + } + + // Dessine les tool tips (info bulle). + if ( m_textToolTips[0] != 0 ) + { + DrawText(m_pPixmap, m_posToolTips, m_textToolTips); + } + + return TRUE; +} + +// Retourne le lutin à utiliser à une position donnée. + +int CEvent::MousePosToSprite(POINT pos) +{ + int sprite; + BOOL bUp=FALSE, bDown=FALSE, bLeft=FALSE, bRight=FALSE; + + sprite = SPRITE_POINTER; + + if ( m_phase == WM_PHASE_PLAY || + m_phase == WM_PHASE_BUILD ) + { + if ( pos.x >= POSMAPX && pos.x <= POSMAPX+DIMMAPX && + pos.y >= POSMAPY && pos.y <= POSMAPY+DIMMAPY ) + { + sprite = SPRITE_MAP; + } + + if ( m_bFullScreen && + !m_bDemoRec && + !m_bDemoPlay && + m_scrollSpeed != 0 ) + { + if ( pos.x <= 5 && pos.x >= -2 ) + { + bLeft = TRUE; + } + + if ( pos.x >= LXIMAGE-5 && pos.x <= LXIMAGE+2 ) + { + bRight = TRUE; + } + + if ( pos.y <= 5 && pos.y >= -2 ) + { + bUp = TRUE; + } + + if ( pos.y >= LYIMAGE-5 && pos.y <= LYIMAGE+2 ) + { + bDown = TRUE; + } + + if ( bLeft ) sprite = SPRITE_ARROWL; + if ( bRight ) sprite = SPRITE_ARROWR; + if ( bUp ) sprite = SPRITE_ARROWU; + if ( bDown ) sprite = SPRITE_ARROWD; + if ( bLeft && bUp ) sprite = SPRITE_ARROWUL; + if ( bLeft && bDown ) sprite = SPRITE_ARROWDL; + if ( bRight && bUp ) sprite = SPRITE_ARROWUR; + if ( bRight && bDown ) sprite = SPRITE_ARROWDR; + } + } + else if ( m_phase == WM_PHASE_INTRO1 || + m_phase == WM_PHASE_INTRO2 ) + { + sprite = SPRITE_POINTER; + } + else if ( m_phase == WM_PHASE_BYE ) + { + sprite = SPRITE_POINTER; + } + else + { + if ( !MouseOnButton(pos) ) + { + sprite = SPRITE_ARROW; + } + } + + if ( m_bFillMouse && // bidon présent ? + pos.x >= POSDRAWX && pos.x <= POSDRAWX+DIMDRAWX && + pos.y >= POSDRAWY && pos.y <= POSDRAWY+DIMDRAWY ) + { + sprite = SPRITE_FILL; + } + if ( m_bWaitMouse ) // sablier présent ? + { + sprite = SPRITE_WAIT; + } + if ( m_bHideMouse ) // souris cachée ? + { + sprite = SPRITE_EMPTY; + } + + return sprite; +} + +// Gère le lutin de la souris. + +void CEvent::MouseSprite(POINT pos) +{ + m_mouseSprite = MousePosToSprite(pos); + + m_pPixmap->SetMousePosSprite(pos, m_mouseSprite, m_bDemoPlay); + ChangeSprite(m_mouseSprite); +} + +// Met ou enlève le sablier de la souris. + +void CEvent::WaitMouse(BOOL bWait) +{ + m_bWaitMouse = bWait; + + if ( bWait ) + { + m_mouseSprite = SPRITE_WAIT; + } + else + { + m_mouseSprite = MousePosToSprite(GetMousePos()); + } + m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay); + ChangeSprite(m_mouseSprite); +} + +// Cache ou montre la souris. + +void CEvent::HideMouse(BOOL bHide) +{ + m_bHideMouse = bHide; + + if ( bHide ) + { + m_mouseSprite = SPRITE_EMPTY; + } + else + { + m_mouseSprite = MousePosToSprite(GetMousePos()); + } + m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay); + ChangeSprite(m_mouseSprite); +} + +// Traite les événements pour tous les boutons. + +BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam) +{ + POINT pos, test; + int i, lg, oldx, sound, res; + + pos = ConvLongToPos(lParam); + + // Cherche le tool tips à utiliser pour la souris. + m_textToolTips[0] = 0; + oldx = m_posToolTips.x; + m_posToolTips.x = -1; + if ( m_phase == WM_PHASE_PLAY ) + { + for ( i=0 ; i<2 ; i++ ) + { + if ( !m_jauges[i].GetHide() ) + { + test = m_jauges[i].GetPos(); + if ( pos.x >= test.x && + pos.x <= test.x+DIMJAUGEX && + pos.y >= test.y && + pos.y <= test.y+DIMJAUGEY ) + { + LoadString(TX_JAUGE1+i, m_textToolTips, 50); + lg = GetTextWidth(m_textToolTips); + test.x += (DIMJAUGEX-lg)/2; + test.y += 4; + m_posToolTips = test; + break; + } + } + } + if ( oldx != m_posToolTips.x ) + { + for ( i=0 ; i<2 ; i++ ) + { + m_jauges[i].SetRedraw(); + } + } + } + else + { + i = 0; + while ( table[m_index].buttons[i].message != 0 ) + { + res = m_buttons[i].GetToolTips(pos); + if ( res != -1 ) + { + LoadString(res, m_textToolTips, 50); + lg = GetTextWidth(m_textToolTips); + pos.x += 10; + pos.y += 20; + if ( pos.x > LXIMAGE-lg ) pos.x = LXIMAGE-lg; + if ( pos.y > LYIMAGE-14 ) pos.y = LYIMAGE-14; + m_posToolTips = pos; + break; + } + i ++; + } + } + + if ( m_phase == WM_PHASE_PLAY ) + { + m_bHiliInfoButton = FALSE; + if ( pos.x > m_posInfoButton.x+6 && + pos.x < m_posInfoButton.x+DIMBUTTONX-6 && + pos.y > m_posInfoButton.y+8 && + pos.y < m_posInfoButton.y+DIMBUTTONY-8 ) + { + m_bHiliInfoButton = TRUE; + + if ( message == WM_LBUTTONDOWN || + message == WM_RBUTTONDOWN ) + { + if ( m_pDecor->GetInfoMode() ) sound = SOUND_CLOSE; + else sound = SOUND_OPEN; + m_pSound->PlayImage(sound, pos); + } + if ( message == WM_LBUTTONUP || + message == WM_RBUTTONUP ) + { + // Montre ou cache les infos tout en haut. + m_pDecor->SetInfoMode(!m_pDecor->GetInfoMode()); + } + } + + m_bHiliHelpButton = FALSE; + if ( m_posHelpButton.x != -1 && + pos.x > m_posHelpButton.x && + pos.x < m_posHelpButton.x+DIMBUTTONX && + pos.y > m_posHelpButton.y && + pos.y < m_posHelpButton.y+DIMBUTTONY ) + { + m_bHiliHelpButton = TRUE; + + if ( message == WM_LBUTTONDOWN || + message == WM_RBUTTONDOWN ) + { + m_pSound->PlayImage(SOUND_CLICK, pos); + } + if ( message == WM_LBUTTONUP || + message == WM_RBUTTONUP ) + { + // Inverse le mode aide dans les infos. + m_bInfoHelp = !m_bInfoHelp; + + if ( m_bInfoHelp ) + { + ReadLibelle(GetWorld(), FALSE, TRUE); + } + else + { + ReadLibelle(GetWorld()+2, FALSE, FALSE); + } + } + } + } + + if ( m_phase == WM_PHASE_BUILD ) + { + if ( message == WM_LBUTTONDOWN || + message == WM_RBUTTONDOWN ) + { + m_pDecor->HideTooltips(TRUE); // plus de tooltips pour décor + } + if ( message == WM_LBUTTONUP || + message == WM_RBUTTONUP ) + { + m_pDecor->HideTooltips(FALSE); + } + } + + + i = 0; + while ( table[m_index].buttons[i].message != 0 ) + { + if ( m_buttons[i].TreatEvent(message, wParam, lParam) ) return TRUE; + i ++; + } + + if ( m_phase == WM_PHASE_PLAY ) + { + if ( m_menu.TreatEvent(message, wParam, lParam) ) return TRUE; + } + + return FALSE; +} + + +// Indique si la souris est sur un bouton. + +BOOL CEvent::MouseOnButton(POINT pos) +{ + int i; + + i = 0; + while ( table[m_index].buttons[i].message != 0 ) + { + if ( m_buttons[i].MouseOnButton(pos) ) return TRUE; + i ++; + } + + return FALSE; +} + + +// Retourne l'index dans table pour une phase donnée. + +int CEvent::SearchPhase(UINT phase) +{ + int i=0; + + while ( table[i].phase != 0 ) + { + if ( table[i].phase == phase ) return i; + i ++; + } + + return -1; +} + +// Donne le numéro du monde. + +int CEvent::GetWorld() +{ + if ( m_bPrivate ) return m_private; + if ( m_bSchool ) return m_exercice; + else return m_mission; +} + +// Donne le numéro physique du monde. + +int CEvent::GetPhysicalWorld() +{ + if ( m_bPrivate ) return m_private+200; + if ( m_bSchool ) return m_exercice; + else return m_mission+100; +} + +int CEvent::GetImageWorld() +{ + if ( m_bPrivate ) return 2; + if ( m_bSchool ) return 0; + else return 1; +} + +// Indique si l'aide est disponible. + +BOOL CEvent::IsHelpHide() +{ + BOOL bHide = TRUE; + +#if !_DEMO + if ( m_bHelp || m_pDecor->GetTotalTime() > DEF_TIME_HELP ) + { + bHide = FALSE; + } + if ( m_bSchool || m_bPrivate ) + { + bHide = TRUE; // pas d'aide pour les exercices + } +#endif + return bHide; +} + +// Change de phase. + +BOOL CEvent::ChangePhase(UINT phase) +{ + int index, world, time, total, music, i, max; + POINT totalDim, iconDim; + char filename[MAX_PATH]; + char* pButtonExist; + BOOL bEnable, bHide; + Term* pTerm; + + if ( m_mouseType == MOUSETYPEGRA && m_bFullScreen ) + { + ShowCursor(FALSE); // cache la vilaine souris Windows + m_bShowMouse = FALSE; + } + + if ( phase != WM_PHASE_SETUPp && + phase != WM_PHASE_WRITEp && + phase != WM_PHASE_PLAY ) + { + m_pSound->StopMusic(); + } + if ( phase == WM_PHASE_SETUPp && m_bPause ) + { + m_pSound->StopMusic(); + } + + m_textToolTips[0] = 0; + m_posToolTips.x = -1; + m_bPause = FALSE; + m_bCtrlDown = FALSE; + m_bMouseDown = FALSE; + m_debugPos.x = 0; + m_debugPos.y = 0; + + m_pDecor->SetInfoMode(FALSE); + m_bInfoHelp = FALSE; + m_bHiliInfoButton = FALSE; + m_bHiliHelpButton = FALSE; + + if ( phase == WM_PHASE_INTRO1 || + phase == WM_PHASE_INTRO2 ) + { + m_introTime = 0; + } + + if ( phase == WM_PHASE_INIT ) + { + m_demoTime = 0; + } + if ( phase == WM_PHASE_PLAY && + !m_bDemoPlay && + GetPhysicalWorld() >= 150 && // mission spéciale démo ? + GetPhysicalWorld() < 200 ) + { + DemoRecStart(); // début enregistrement + } + if ( phase != WM_PHASE_PLAY ) + { + DemoRecStop(); // stoppe l'enregistrement d'une démo + } + + m_pDecor->UndoClose(); // libère le buffer undo + + index = SearchPhase(phase); + if ( index < 0 ) return FALSE; + + HideMouse(FALSE); // montre la souris + WaitMouse(TRUE); // met le sablier + + if ( m_bBuildModify ) + { + m_pDecor->InitAfterBuild(); + m_bBuildModify = FALSE; + } + + if ( m_phase == WM_PHASE_BUILD && + phase == WM_PHASE_INFO ) // quitte construction ? + { + m_pDecor->Write(GetPhysicalWorld(), FALSE, + GetPhysicalWorld(), 0, 0); // écrit le monde + } + + m_phase = phase; // change de phase + m_index = index; + + strcpy(filename, table[m_index].backName); + if ( strstr(filename, "%.3d") != NULL ) // "%.3d" dans le nom ? + { + sprintf(filename, table[m_index].backName, GetImageWorld()); + } + if ( table[m_index].bCDrom ) // sur le CD-rom ? + { + AddCDPath(filename); + } + totalDim.x = LXIMAGE; + totalDim.y = LYIMAGE; + iconDim.x = 0; + iconDim.y = 0; + if ( !m_pPixmap->Cache(CHBACK, filename, totalDim, iconDim, FALSE) ) + { + WaitMouse(FALSE); // enlève le sablier + m_tryInsertCount = 40; + m_tryPhase = m_phase; + return ChangePhase(WM_PHASE_INSERT); // insérez le CD-Rom ... + } + + if ( m_phase == WM_PHASE_READ || + m_phase == WM_PHASE_WRITE || + m_phase == WM_PHASE_WRITEp ) + { + for ( i=0 ; i<10 ; i++ ) + { + if ( m_pDecor->FileExist(i, TRUE, world, time, total) ) + { + m_fileWorld[i] = world; + m_fileTime[i] = time; + } + else + { + m_fileWorld[i] = -1; + } + } + } + + if ( m_phase == WM_PHASE_INFO || + m_phase == WM_PHASE_HISTORY0 || + m_phase == WM_PHASE_HISTORY1 ) + { + if ( !m_pDecor->Read(GetPhysicalWorld(), FALSE, + world, time, total) && // lit le monde + !m_bAccessBuild && + !m_bPrivate ) + { + m_tryInsertCount = 40; + m_tryPhase = m_phase; + return ChangePhase(WM_PHASE_INSERT); // insérez le CD-Rom ... + } + m_pDecor->SetTime(0); + m_pDecor->SetTotalTime(0); + m_pDecor->SetInvincible(FALSE); + m_pDecor->SetSuper(FALSE); + } + + if ( m_phase == WM_PHASE_INFO || + m_phase == WM_PHASE_STOP || + m_phase == WM_PHASE_HELP || + m_phase == WM_PHASE_HISTORY0 || + m_phase == WM_PHASE_HISTORY1 ) + { + if ( m_bPrivate ) + { + PrivateLibelle(); + } + else if ( m_phase == WM_PHASE_INFO || + m_phase == WM_PHASE_STOP ) + { + if ( m_bSchool ) + { + ReadLibelle(GetWorld(), m_bSchool, FALSE); + } + else + { + ReadLibelle(GetWorld()+2, m_bSchool, FALSE); + } + } + else if ( m_phase == WM_PHASE_HELP ) + { + ReadLibelle(GetWorld(), FALSE, TRUE); + } + else + { + if ( m_phase == WM_PHASE_HISTORY0 ) world = 0; + else world = 1; + ReadLibelle(world, FALSE, FALSE); + } + } + + if ( m_phase == WM_PHASE_TESTCD ) + { + if ( m_pDecor->Read(0, FALSE, world, time, total) ) // lit un monde + { + return ChangePhase(WM_PHASE_INIT); // ok + } + else + { + m_tryInsertCount = 40; + m_tryPhase = m_phase; + return ChangePhase(WM_PHASE_INSERT); // insérez le CD-Rom ... + } + } + + m_jauges[0].SetHide(TRUE); // cache les jauges + m_jauges[1].SetHide(TRUE); + CreateButtons(); // crée les boutons selon la phase + m_bMenu = FALSE; + m_pDecor->HideTooltips(FALSE); + m_menu.Delete(); + m_pDecor->BlupiSetArrow(0, FALSE); // enlève toutes les flèches + m_pDecor->ResetHili(); // enlève les mises en évidence + + if ( m_phase == WM_PHASE_PLAY ) + { + m_pDecor->LoadImages(); + m_pDecor->SetBuild(FALSE); + m_pDecor->EnableFog(TRUE); + m_pDecor->NextPhase(0); // refait la carte tout de suite + m_pDecor->StatisticInit(); + m_pDecor->TerminatedInit(); + m_bChangeCheat = TRUE; // affiche les cheat-codes + } + + if ( m_phase == WM_PHASE_BUILD ) + { + m_bBuildModify = TRUE; + SetState(WM_DECOR1, 1); + SetMenu(WM_DECOR1, 0); // herbe + SetMenu(WM_DECOR2, 2); // arbre + SetMenu(WM_DECOR3, 1); // maison + SetMenu(WM_DECOR4, 2); // blupi fort + SetMenu(WM_DECOR5, 1); // feu + m_pDecor->LoadImages(); + m_pDecor->SetBuild(TRUE); + m_pDecor->EnableFog(FALSE); + m_pDecor->BlupiDeselect(); + m_pDecor->NextPhase(0); // refait la carte tout de suite + } + + if ( m_phase == WM_PHASE_INFO ) + { + bEnable = TRUE; + if ( GetWorld() == 0 ) + { + bEnable = FALSE; + } + SetEnable(WM_PREV, bEnable); + + bEnable = TRUE; + if ( m_bAllMissions ) max = 99; + else max = m_maxMission; + if ( !m_bSchool && + GetWorld() >= max ) + { + bEnable = FALSE; + } + if ( !m_pDecor->FileExist(GetPhysicalWorld()+1, FALSE, + world, time, total) ) + { + bEnable = FALSE; + } +#if !_DEMO + if ( m_bAccessBuild || + m_pDecor->GetTotalTime() > DEF_TIME_HELP*6 ) + { + bEnable = TRUE; + } +#endif + if ( GetWorld() >= 99 ) + { + bEnable = FALSE; + } +#if _DEMO + if ( GetWorld() >= 4-1 ) + { + bEnable = FALSE; + } +#endif + if ( m_bPrivate ) + { + bEnable = GetWorld()<20-1; + } + SetEnable(WM_NEXT, bEnable); + + bHide = TRUE; + if ( m_bAccessBuild || m_bPrivate ) + { + bHide = FALSE; + } + SetHide(WM_PHASE_BUILD, bHide); + +#if !_DEMO + if ( m_bSchool ) + { + SetHide(WM_PHASE_SKILL1, TRUE); + SetHide(WM_PHASE_SKILL2, TRUE); + } + else + { + SetState(WM_PHASE_SKILL1, m_pDecor->GetSkill()==0?1:0); + SetState(WM_PHASE_SKILL2, m_pDecor->GetSkill()==1?1:0); + } +#endif + } + + if ( m_phase == WM_PHASE_STOP ) + { + SetHide(WM_PHASE_HELP, IsHelpHide()); + } + + if ( m_phase == WM_PHASE_READ ) + { + for ( i=0 ; i<10 ; i++ ) + { + if ( m_fileWorld[i] == -1 ) + { + SetEnable(WM_READ0+i, FALSE); + } + } + } + + if ( m_phase == WM_PHASE_BUTTON ) + { + pButtonExist = m_pDecor->GetButtonExist(); + + for ( i=0 ; iGetTerminated(); + + SetState(WM_BUTTON1, pTerm->bHachBlupi?1:0); + SetState(WM_BUTTON2, pTerm->bHachPlanche?1:0); + SetState(WM_BUTTON3, pTerm->bStopFire?1:0); + SetState(WM_BUTTON8, pTerm->bHomeBlupi?1:0); + SetState(WM_BUTTON9, pTerm->bKillRobots?1:0); + SetState(WM_BUTTON10, pTerm->bHachTomate?1:0); + SetState(WM_BUTTON11, pTerm->bHachMetal?1:0); + SetState(WM_BUTTON12, pTerm->bHachRobot?1:0); + } + + if ( m_phase == WM_PHASE_MUSIC ) + { + music = m_pDecor->GetMusic(); + + for ( i=0 ; i<10 ; i++ ) + { + SetState(WM_BUTTON1+i, music==i?1:0); + } + } + + if ( m_phase == WM_PHASE_REGION ) + { + music = m_pDecor->GetRegion(); + + for ( i=0 ; i<4 ; i++ ) + { + SetState(WM_BUTTON1+i, music==i?1:0); + } + } + + if ( m_phase == WM_PHASE_PLAY || + m_phase == WM_PHASE_MUSIC ) + { + if ( m_pSound->IsPlayingMusic() ) + { + m_pSound->AdaptVolumeMusic(); // adapte le volume + } + else + { + music = m_pDecor->GetMusic(); + if ( music > 0 ) + { + sprintf(filename, "sound\\music%.3d.blp", music-1); + m_pSound->PlayMusic(m_hWnd, filename); + } + } + } + + if ( phase == WM_PHASE_H0MOVIE ) + { + strcpy(m_movieToStart, "movie\\history0.avi"); + AddCDPath(m_movieToStart); + m_phaseAfterMovie = WM_PHASE_HISTORY0; + } + + if ( phase == WM_PHASE_H1MOVIE ) + { + strcpy(m_movieToStart, "movie\\history1.avi"); + AddCDPath(m_movieToStart); + m_phaseAfterMovie = WM_PHASE_HISTORY1; + } + + if ( phase == WM_PHASE_H2MOVIE ) + { + strcpy(m_movieToStart, "movie\\history2.avi"); + AddCDPath(m_movieToStart); + m_phaseAfterMovie = WM_PHASE_INFO; + } + + if ( phase == WM_PHASE_PLAYMOVIE ) + { + sprintf(m_movieToStart, "movie\\play%.3d.avi", GetPhysicalWorld()); + AddCDPath(m_movieToStart); + m_phaseAfterMovie = WM_PHASE_PLAY; + } + + if ( phase == WM_PHASE_WINMOVIE ) + { + sprintf(m_movieToStart, "movie\\win%.3d.avi", GetPhysicalWorld()); + AddCDPath(m_movieToStart); + m_phaseAfterMovie = WM_PHASE_WIN; + + if ( !m_bPrivate && + m_pDecor->FileExist(GetPhysicalWorld(), + FALSE, world, time, total) && + !m_pDecor->FileExist(GetPhysicalWorld()+1, + FALSE, world, time, total) ) + { + m_phaseAfterMovie = WM_PHASE_LASTWIN; + } + } + + WaitMouse(FALSE); // enlève le sablier + return TRUE; +} + +// Retourne la phase en cours. + +UINT CEvent::GetPhase() +{ + return m_phase; +} + +// Essaye de lire le CD-Rom. + +void CEvent::TryInsert() +{ + if ( m_tryInsertCount == 0 ) + { + ChangePhase(m_tryPhase); + } + else + { + m_tryInsertCount --; + } +} + +// Fait démarrer un film si nécessaire. + +void CEvent::MovieToStart() +{ + if ( m_movieToStart[0] != 0 ) // y a-t-il un film à démarrer ? + { + HideMouse(TRUE); // cache la souris + + if ( StartMovie(m_movieToStart) ) + { + m_phase = m_phaseAfterMovie; // prochaine phase normale + } + else + { + ChangePhase(m_phaseAfterMovie); + } + + m_movieToStart[0] = 0; + } +} + + +// Décale le décor. + +void CEvent::DecorShift(int dx, int dy) +{ + POINT coin; + + if ( m_phase != WM_PHASE_PLAY && + m_phase != WM_PHASE_BUILD ) return; + + coin = m_pDecor->GetCoin(); + + coin.x += dx; + coin.y += dy; + + m_pDecor->SetCoin(coin); +//? m_pDecor->NextPhase(0); // faudra refaire la carte tout de suite +} + +// Décale le décor lorsque la souris touche un bord. + +void CEvent::DecorAutoShift(POINT pos) +{ + int max; + POINT offset; + + m_bShift = FALSE; + + if ( !m_bFullScreen || + m_bDemoRec || + m_bDemoPlay || + m_scrollSpeed == 0 ) return; + + max = 4-m_scrollSpeed; // max <- 3..1 + +//? if ( m_bMousePress && +//? (m_phase == WM_PHASE_PLAY || +//? m_phase == WM_PHASE_BUILD) ) + if ( m_phase == WM_PHASE_PLAY || + m_phase == WM_PHASE_BUILD ) + { + if ( m_shiftPhase == 0 ) // début du shift ? + { + m_shiftOffset.x = 0; + m_shiftOffset.y = 0; + m_shiftVector.x = 0; + m_shiftVector.y = 0; + + if ( m_mouseSprite == SPRITE_ARROWL ) + { + m_shiftOffset.x = +2; + m_shiftOffset.y = 0; + m_shiftVector.x = -1; + m_shiftVector.y = +1; + } + + if ( m_mouseSprite == SPRITE_ARROWR ) + { + m_shiftOffset.x = -2; + m_shiftOffset.y = 0; + m_shiftVector.x = +1; + m_shiftVector.y = -1; + } + + if ( m_mouseSprite == SPRITE_ARROWU ) + { + m_shiftOffset.x = 0; + m_shiftOffset.y = +2; + m_shiftVector.x = -1; + m_shiftVector.y = -1; + } + + if ( m_mouseSprite == SPRITE_ARROWD ) + { + m_shiftOffset.x = 0; + m_shiftOffset.y = -2; + m_shiftVector.x = +1; + m_shiftVector.y = +1; + } + + if ( m_mouseSprite == SPRITE_ARROWUL ) + { + m_shiftOffset.x = +1; + m_shiftOffset.y = +1; + m_shiftVector.x = -1; + m_shiftVector.y = 0; + } + + if ( m_mouseSprite == SPRITE_ARROWUR ) + { + m_shiftOffset.x = -1; + m_shiftOffset.y = +1; + m_shiftVector.x = 0; + m_shiftVector.y = -1; + } + + if ( m_mouseSprite == SPRITE_ARROWDL ) + { + m_shiftOffset.x = +1; + m_shiftOffset.y = -1; + m_shiftVector.x = 0; + m_shiftVector.y = +1; + } + + if ( m_mouseSprite == SPRITE_ARROWDR ) + { + m_shiftOffset.x = -1; + m_shiftOffset.y = -1; + m_shiftVector.x = +1; + m_shiftVector.y = 0; + } + + if ( m_shiftVector.x != 0 || + m_shiftVector.y != 0 ) + { + m_shiftPhase = max; + } + } + + if ( m_shiftPhase > 0 ) + { + m_bShift = TRUE; + m_shiftPhase --; + + offset.x = m_shiftOffset.x*(max-m_shiftPhase)*(DIMCELX/2/max); + offset.y = m_shiftOffset.y*(max-m_shiftPhase)*(DIMCELY/2/max); + m_pDecor->SetShiftOffset(offset); + + if ( m_shiftPhase == 0 ) // dernière phase ? + { + offset.x = 0; + offset.y = 0; + m_pDecor->SetShiftOffset(offset); + DecorShift(m_shiftVector.x, m_shiftVector.y); + } + } + } +} + +// Indique su un shift est en cours. + +BOOL CEvent::IsShift() +{ + return m_bShift; +} + + +// Modifie le décor lorsque le bouton de la souris est pressé. + +BOOL CEvent::PlayDown(POINT pos, int fwKeys) +{ + BOOL bDecor = FALSE; + BOOL bMap = FALSE; + int rank, button, h; + POINT cel; + + m_pDecor->BlupiSetArrow(0, FALSE); // enlève toutes les flèches + + m_bMouseDown = FALSE; + + if ( m_bMenu ) + { + m_menu.Message(); + m_bMenu = FALSE; + m_pDecor->HideTooltips(FALSE); + m_menu.Delete(); + return TRUE; + } + + m_pDecor->StatisticDown(pos, fwKeys); + + if ( pos.x >= POSMAPX && pos.x <= POSMAPX+DIMMAPX && + pos.y >= POSMAPY && pos.y <= POSMAPY+DIMMAPY ) + { + bMap = TRUE; + } + h = m_pDecor->GetInfoHeight()+POSDRAWY; + if ( pos.x >= POSDRAWX && pos.x <= POSDRAWX+DIMDRAWX && + pos.y >= h && pos.y <= h +DIMDRAWY ) + { + bDecor = TRUE; + } + + if ( !bDecor && !bMap ) return FALSE; + + cel = m_pDecor->ConvPosToCel(pos, TRUE); + if ( fwKeys&MK_RBUTTON ) + { + if ( bMap ) + { + button = BUTTON_GO; + } + else + { + button = m_pDecor->GetDefButton(cel); + } + m_pDecor->BlupiGoal(cel, button); + return TRUE; + } + + if ( bMap ) + { + m_pDecor->SetCoin(cel, TRUE); + m_pDecor->NextPhase(0); // faudra refaire la carte tout de suite + return TRUE; + } + + rank = m_pDecor->GetTargetBlupi(pos); + if ( rank >= 0 && + !m_pDecor->IsWorkBlupi(rank) ) + { + m_bHili = TRUE; + m_bMouseDown = TRUE; + m_pDecor->BlupiHiliDown(pos, fwKeys&MK_SHIFT); + } + else + { + m_bHili = FALSE; + m_bMouseDown = TRUE; + } + + return TRUE; +} + +// Modifie le décor lorsque la souris est déplacée. + +BOOL CEvent::PlayMove(POINT pos, int fwKeys) +{ + if ( m_bMenu ) + { + if ( !m_menu.IsExist() ) + { + m_bMenu = FALSE; + m_pDecor->HideTooltips(FALSE); + m_menu.Delete(); + } + return TRUE; + } + + m_pDecor->StatisticMove(pos, fwKeys); + + if ( m_bMouseDown ) // bouton souris pressé ? + { + if ( m_bHili ) + { + m_pDecor->BlupiHiliMove(pos, fwKeys&MK_SHIFT); + } + else + { + m_pDecor->CelHili(pos, 0); + } + } + else + { + m_pDecor->CelHili(pos, 0); + } + + return TRUE; +} + +// Modifie le décor lorsque le bouton de la souris est relâché. + +BOOL CEvent::PlayUp(POINT pos, int fwKeys) +{ + static int table_sound_boing[3] = + { + SOUND_BOING1, + SOUND_BOING2, + SOUND_BOING3, + }; + + m_pDecor->StatisticUp(pos, fwKeys); + + if ( m_bMouseDown ) // bouton souris pressé ? + { + if ( m_bHili ) + { + m_pDecor->BlupiHiliUp(pos, fwKeys&MK_SHIFT); + } + else + { + m_pDecor->BlupiGetButtons(pos, m_menuNb, m_menuButtons, + m_menuErrors, m_menuPerso); + if ( m_menuNb == 0 ) + { + m_pDecor->BlupiSound(-1, table_sound_boing[Random(0,2)], pos); + } + else + { + m_menuCel = m_pDecor->ConvPosToCel(pos); + m_menuPos = pos; + m_menu.Create(m_hWnd, m_pPixmap, m_pSound, + pos, m_menuNb, m_menuButtons, m_menuErrors, + m_menuPerso); + m_bMenu = TRUE; + m_pDecor->HideTooltips(TRUE); // plus de tooltips pour décor + } + } + } + + m_bMouseDown = FALSE; + + return TRUE; +} + + +// Clic dans un bouton. +// Message = WM_BUTTON0..WM_BUTTON39 + +void CEvent::ChangeButtons(int message) +{ + int button, state, volume, max; + char* pButtonExist; + Term* pTerm; + + if ( m_phase == WM_PHASE_PLAY ) + { + button = m_menuButtons[message-WM_BUTTON0]; + m_pDecor->BlupiGoal(m_menuCel, button); + } + + if ( m_phase == WM_PHASE_BUTTON ) + { + pButtonExist = m_pDecor->GetButtonExist(); + + state = GetState(message); + if ( state == 0 ) state = 1; + else state = 0; + SetState(message, state); // pressé <-> relâché + + pButtonExist[message-WM_BUTTON0] = state; + pButtonExist[BUTTON_DJEEP] = TRUE; + pButtonExist[BUTTON_DARMURE] = TRUE; + } + + if ( m_phase == WM_PHASE_TERM ) + { + pTerm = m_pDecor->GetTerminated(); + + if ( message == WM_BUTTON1 || + message == WM_BUTTON2 || + message == WM_BUTTON3 || + message == WM_BUTTON8 || + message == WM_BUTTON9 || + message == WM_BUTTON10 || + message == WM_BUTTON11 || + message == WM_BUTTON12 ) + { + state = GetState(message); + if ( state == 0 ) state = 1; + else state = 0; + SetState(message, state); // pressé <-> relâché + + if ( message == WM_BUTTON1 ) pTerm->bHachBlupi = state; + if ( message == WM_BUTTON2 ) pTerm->bHachPlanche = state; + if ( message == WM_BUTTON3 ) pTerm->bStopFire = state; + if ( message == WM_BUTTON8 ) pTerm->bHomeBlupi = state; + if ( message == WM_BUTTON9 ) pTerm->bKillRobots = state; + if ( message == WM_BUTTON10 ) pTerm->bHachTomate = state; + if ( message == WM_BUTTON11 ) pTerm->bHachMetal = state; + if ( message == WM_BUTTON12 ) pTerm->bHachRobot = state; + } + + if ( message == WM_BUTTON4 ) + { + if ( pTerm->nbMinBlupi > 1 ) pTerm->nbMinBlupi --; + } + if ( message == WM_BUTTON5 ) + { + if ( pTerm->nbMinBlupi < 100 ) pTerm->nbMinBlupi ++; + } + + if ( message == WM_BUTTON6 ) + { + if ( pTerm->nbMaxBlupi > 1 ) pTerm->nbMaxBlupi --; + } + if ( message == WM_BUTTON7 ) + { + if ( pTerm->nbMaxBlupi < 100 ) pTerm->nbMaxBlupi ++; + } + } + + if ( m_phase == WM_PHASE_MUSIC ) + { + m_pDecor->SetMusic(message-WM_BUTTON1); + ChangePhase(m_phase); + } + + if ( m_phase == WM_PHASE_REGION ) + { + m_pDecor->SetRegion(message-WM_BUTTON1); + ChangePhase(WM_PHASE_BUILD); + } + + if ( m_phase == WM_PHASE_SETUP || + m_phase == WM_PHASE_SETUPp ) + { + if ( message == WM_BUTTON1 ) + { + if ( m_speed > 1 ) + { + m_speed = m_speed>>1; + } + } + if ( message == WM_BUTTON2 ) + { + if ( m_bSpeed ) max = 8; + else max = 2; + if ( m_speed < max ) + { + m_speed = m_speed<<1; + } + } + + if ( message == WM_BUTTON3 ) + { + volume = m_pSound->GetAudioVolume(); + if ( volume > 0 ) + { + m_pSound->SetAudioVolume(volume-1); + } + } + if ( message == WM_BUTTON4 ) + { + volume = m_pSound->GetAudioVolume(); + if ( volume < MAXVOLUME ) + { + m_pSound->SetAudioVolume(volume+1); + } + } + + if ( message == WM_BUTTON5 ) + { + volume = m_pSound->GetMidiVolume(); + if ( volume > 0 ) + { + m_pSound->SetMidiVolume(volume-1); + m_pSound->SuspendMusic(); + } + } + if ( message == WM_BUTTON6 ) + { + volume = m_pSound->GetMidiVolume(); + if ( volume < MAXVOLUME ) + { + m_pSound->SetMidiVolume(volume+1); + m_pSound->SuspendMusic(); + } + } + + if ( message == WM_BUTTON7 ) + { + m_bMovie = FALSE; + } + if ( message == WM_BUTTON8 ) + { + m_bMovie = TRUE; + } + + if ( message == WM_BUTTON9 ) + { + if ( m_scrollSpeed > 0 ) + { + m_scrollSpeed --; + } + } + if ( message == WM_BUTTON10 ) + { + if ( m_scrollSpeed < 3 ) + { + m_scrollSpeed ++; + } + } + } +} + + + +// Met un sol si nécessaire sous un objet. + +void CEvent::BuildFloor(POINT cel, int insIcon) +{ + int iFloor, channel, icon; + + if ( insIcon == -1 ) return; // supprime ? + + if ( insIcon < 6 || // petite plante ? + insIcon == 117 ) // bateau ? + { + return; + } + + iFloor = 1; // herbe + + if ( insIcon == 28 || // laboratoire ? + insIcon == 61 || // cabane de jardin ? + insIcon == 113 || // maison ? + insIcon == 120 ) // usine ? + { + iFloor = 16; // sol brun foncé + } + + if ( insIcon == 122 ) // mine de fer ? + { + iFloor = 71; // sol avec minerai + } + + if ( insIcon == 99 || // station de recharge ? + insIcon == 100 || // usine ennemie ? + insIcon == 102 || // usine ennemie ? + insIcon == 104 || // usine ennemie ? + (insIcon >= 106 && insIcon <= 112) || // barrière ? + insIcon == 115 || // usine ennemie ? + insIcon == 17 || // usine ennemie ? + insIcon == 12 ) // fusée ? + { + iFloor = 67; // sol bleu ennemi + } + + m_pDecor->GetFloor(cel, channel, icon); + if ( (channel == CHFLOOR && + icon >= 2 && icon <= 14) || // eau ou rive ? + iFloor != 1 ) + { + m_pDecor->PutFloor(cel, CHFLOOR, iFloor); // met un sol + m_pDecor->ArrangeFloor(cel); + } +} + +// Enlève si nécessaire un objet sur l'eau. + +void CEvent::BuildWater(POINT cel, int insIcon) +{ + int channel, icon; + + if ( insIcon != 14 ) return; // rien à faire si pas eau + + m_pDecor->GetObject(cel, channel, icon); + if ( channel == CHOBJECT && + icon >= 6 && // objet (pas petite plante) ? + icon != 117 ) // pas bateau ? + { + m_pDecor->PutObject(cel, -1, -1); // enlève l'objet + m_pDecor->ArrangeObject(cel); + } +} + +// Cette table donne les objets à construire en fonction +// du choix dans le menu. + +static int tableFloor[] = +{ + 1,49,50,51,0,0,0,0,0,0, // 0 herbe + 20,66,79,0,0,0,0,0,0,0, // 1 foncé + 33,46,47,48,71,0,0,0,0,0, // 2 terre + 14,0,0,0,0,0,0,0,0,0, // 3 mer + 15,16,17,18,19,65,67,0,0,0, // 4 dalles + 52,80,0,0,0,0,0,0,0,0, // 5 couveuse +}; + +static int tableObject[] = +{ + -1,0,0,0,0,0,0,0,0,0, // 0 détruit + 0,4,1,2,3,5,0,0,0,0, // 1 plantes + 6,7,8,9,10,11,0,0,0,0, // 2 arbres + 81,83,94,0,0,0,0,0,0,0, // 5 fleurs +}; + +static int tableHome[] = +{ + -1,0,0,0,0,0,0,0,0,0, // 0 détruit + 113,61,28,120,0,0,0,0,0,0, // 1 maison + 27,0,0,0,0,0,0,0,0,0, // 2 tour de protection + 122,0,0,0,0,0,0,0,0,0, // 3 mine de fer + 99,100,102,104,115,17,12,0,0,0, // 4 ennemi + 112,0,0,0,0,0,0,0,0,0, // 5 barrière + 26,71,0,0,0,0,0,0,0,0, // 6 palissade + 37,38,39,40,41,42,43,0,0,0, // 7 rochers + 36,44,60,63,80,123,14,0,0,0, // 8 matières + 85,125,93,92,0,0,0,0,0,0, // 9 pièges + 117,118,16,0,0,0,0,0,0,0, // 10 véhicules +}; + +// Modifie le décor lorsque le bouton de la souris est pressé. + +BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix) +{ + POINT cel; + int menu, channel, icon; + + if ( bMix && m_pDecor->MapMove(pos) ) return TRUE; + + if ( pos.x < POSDRAWX || pos.x > POSDRAWX+DIMDRAWX || + pos.y < POSDRAWY || pos.y > POSDRAWY+DIMDRAWY ) return FALSE; + + if ( bMix ) + { + m_pDecor->UndoCopy(); // copie le décor pour undo év. + } + + if ( GetState(WM_DECOR1) == 1 ) // pose d'un sol + { + cel = m_pDecor->ConvPosToCel2(pos); + menu = GetMenu(WM_DECOR1); + + if ( !m_pDecor->GetFloor(cel, channel, icon) ) return FALSE; + + if ( bMix && tableFloor[menu*10+m_lastFloor[menu]] == icon ) + { + m_lastFloor[menu] ++; + if ( tableFloor[menu*10+m_lastFloor[menu]] == 0 ) + { + m_lastFloor[menu] = 0; + } + } + + if ( fwKeys & MK_CONTROL ) // touche Ctrl enfoncée ? + { + WaitMouse(TRUE); + m_pDecor->ArrangeFill(cel, CHFLOOR, tableFloor[menu*10+m_lastFloor[menu]], TRUE); + WaitMouse(FALSE); + } + else + { + icon = tableFloor[menu*10+m_lastFloor[menu]]; + if ( menu >= 1 ) // met un sol ? + { + BuildWater(cel, icon); // enlève les objets + } + m_pDecor->PutFloor(cel, CHFLOOR, icon); + m_pDecor->ArrangeFloor(cel); + } + } + + if ( GetState(WM_DECOR2) == 1 ) // pose d'un objet + { + cel = m_pDecor->ConvPosToCel2(pos); + menu = GetMenu(WM_DECOR2); + + if ( !m_pDecor->GetObject(cel, channel, icon) ) return FALSE; + + if ( bMix && tableObject[menu*10+m_lastObject[menu]] == icon ) + { + m_lastObject[menu] ++; + if ( tableObject[menu*10+m_lastObject[menu]] == 0 ) + { + m_lastObject[menu] = 0; + } + } + + if ( fwKeys & MK_CONTROL ) // touche Ctrl enfoncée ? + { + WaitMouse(TRUE); + m_pDecor->ArrangeFill(cel, CHOBJECT, tableObject[menu*10+m_lastObject[menu]], FALSE); + WaitMouse(FALSE); + } + else + { + icon = tableObject[menu*10+m_lastObject[menu]]; + BuildFloor(cel, icon); // met un sol si nécessaire + m_pDecor->PutObject(cel, CHOBJECT, icon); + m_pDecor->ArrangeObject(cel); + } + } + + if ( GetState(WM_DECOR3) == 1 ) // pose d'un batiment + { + cel = m_pDecor->ConvPosToCel2(pos); + menu = GetMenu(WM_DECOR3); + + if ( !m_pDecor->GetObject(cel, channel, icon) ) return FALSE; + + if ( bMix && tableHome[menu*10+m_lastHome[menu]] == icon ) + { + m_lastHome[menu] ++; + if ( tableHome[menu*10+m_lastHome[menu]] == 0 ) + { + m_lastHome[menu] = 0; + } + } + + if ( fwKeys & MK_CONTROL ) // touche Ctrl enfoncée ? + { + WaitMouse(TRUE); + m_pDecor->ArrangeFill(cel, CHOBJECT, tableHome[menu*10+m_lastHome[menu]], FALSE); + WaitMouse(FALSE); + } + else + { + icon = tableHome[menu*10+m_lastHome[menu]]; + BuildFloor(cel, icon); // met un sol si nécessaire + m_pDecor->PutObject(cel, CHOBJECT, icon); + m_pDecor->ArrangeObject(cel); + } + } + + if ( GetState(WM_DECOR4) == 1 ) // pose d'un blupi + { + cel = m_pDecor->ConvPosToCel(pos); + menu = GetMenu(WM_DECOR4); + + if ( menu == 0 ) // supprime ? + { + m_pDecor->BlupiDelete(cel); + } + if ( menu == 1 ) // ajoute blupi-fatigué ? + { + m_pDecor->BlupiCreate(cel, ACTION_STOP, DIRECT_S, 0, MAXENERGY/4); + } + if ( menu == 2 ) // ajoute blupi-énergique ? + { + m_pDecor->BlupiCreate(cel, ACTION_STOP, DIRECT_S, 0, MAXENERGY); + } + if ( menu == 3 ) // ajoute assistant ? + { + m_pDecor->BlupiCreate(cel, ACTION_STOP, DIRECT_S, 8, MAXENERGY); + } + if ( menu == 4 ) // ajoute araignée ? + { + m_pDecor->BlupiCreate(cel, ACTION_STOP, DIRECT_S, 1, MAXENERGY); + } + if ( menu == 5 ) // ajoute virus ? + { + m_pDecor->BlupiCreate(cel, ACTION_STOP, DIRECT_S, 2, MAXENERGY); + } + if ( menu == 6 ) // ajoute tracks ? + { + m_pDecor->BlupiCreate(cel, ACTION_STOP, DIRECT_S, 3, MAXENERGY); + } + if ( menu == 7 ) // ajoute bombe ? + { + m_pDecor->BlupiCreate(cel, ACTION_STOP, DIRECT_S, 5, MAXENERGY); + } + if ( menu == 8 ) // ajoute électro ? + { + m_pDecor->BlupiCreate(cel, ACTION_STOP, DIRECT_S, 7, MAXENERGY); + } + if ( menu == 9 ) // ajoute robot ? + { + m_pDecor->BlupiCreate(cel, ACTION_STOP, DIRECT_S, 4, MAXENERGY); + } + } + + if ( GetState(WM_DECOR5) == 1 ) // pose d'une cata + { + cel = m_pDecor->ConvPosToCel2(pos); + menu = GetMenu(WM_DECOR5); + + if ( menu == 0 ) // supprime ? + { + m_pDecor->SetFire(cel, FALSE); + } + if ( menu == 1 ) // ajoute ? + { + m_pDecor->SetFire(cel, TRUE); + } + } + + m_pDecor->ArrangeBlupi(); // supprime les blupi bloqués + + return TRUE; +} + +// Modifie le décor lorsque la souris est déplacée. + +BOOL CEvent::BuildMove(POINT pos, int fwKeys) +{ + if ( fwKeys & MK_LBUTTON ) // bouton souris pressé ? + { + BuildDown(pos, fwKeys, FALSE); + } + + if ( GetState(WM_DECOR4) == 1 ) // pose d'un blupi + { + m_pDecor->CelHili(pos, 1); + } + else + { + m_pDecor->CelHili(pos, 2); + } + + return TRUE; +} + +// Modifie le décor lorsque le bouton de la souris est relâché. + +BOOL CEvent::BuildUp(POINT pos, int fwKeys) +{ + return TRUE; +} + + +// Démarre un film non interractif. + +BOOL CEvent::StartMovie(char *pFilename) +{ + RECT rect; + char filename[MAX_PATH]; + + if ( !m_pMovie->GetEnable() ) return FALSE; + if ( !m_bMovie ) return FALSE; + + if ( !m_pMovie->IsExist(pFilename) ) return FALSE; + + rect.left = 1; // mystère: plante avec 0,0,LXIMAGE,LYIMAGE !!! + rect.top = 1; + rect.right = LXIMAGE-2; + rect.bottom = LYIMAGE-2; + + m_pSound->StopMusic(); + m_pPixmap->SavePalette(); + + strcpy(filename, pFilename); + strcpy(filename+strlen(filename)-4, ".blp"); // remplace .avi par .blp + m_pSound->Cache(SOUND_MOVIE, filename); + + if ( !m_pMovie->Play(m_hWnd, rect, pFilename) ) return FALSE; + m_bRunMovie = TRUE; + m_pSound->Play(SOUND_MOVIE, 0, 0); + return TRUE; +} + +// Stoppe un film non interractif. + +void CEvent::StopMovie() +{ + m_pMovie->Stop(m_hWnd); + m_pPixmap->RestorePalette(); + m_pPixmap->MouseInvalidate(); + m_pSound->Flush(SOUND_MOVIE); +// m_pSound->RestartMusic(); + ChangePhase(m_phase); + m_bRunMovie = FALSE; +} + +// Indique s'il y a un film en cours. + +BOOL CEvent::IsMovie() +{ + return m_bRunMovie; +} + + +// Lit une partie (user000.blp). + +void CEvent::Read(int message) +{ + int world, time, total; + + m_pDecor->Read(message-WM_READ0, TRUE, world, time, total); + m_pDecor->SetTime(time); + m_pDecor->SetTotalTime(total); + + if ( world >= 200 ) + { + m_private = world-200; + m_bSchool = FALSE; + m_bPrivate = TRUE; + } + else if ( world >= 100 ) + { + m_mission = world-100; + m_bSchool = FALSE; + m_bPrivate = FALSE; + } + else + { + m_exercice = world; + m_bSchool = TRUE; + m_bPrivate = FALSE; + } +} + +// Ecrit une partie (user000.blp). + +void CEvent::Write(int message) +{ + int time, total; + + time = m_pDecor->GetTime(); + total = m_pDecor->GetTotalTime(); + + m_pDecor->Write(message-WM_WRITE0, TRUE, + GetPhysicalWorld(), time, total); +} + + +// Initialise le libellé d'une mission privée. + +void CEvent::PrivateLibelle() +{ + int i, res, nb, h1, h2; + Term term; + char string[100]; + char buffer[100]; + + LoadString(TX_PRIVATE_OBJECTIF, m_libelle, 100); + + memcpy(&term, m_pDecor->GetTerminated(), sizeof(Term)); + nb = 0; + for ( i=0 ; i<2 ; i++ ) // 2 objectifs au maximum ! + { + res = 0; + if ( term.bKillRobots ) + { + term.bKillRobots = FALSE; + res = TX_PRIVATE_KILLROBOTS; + } + else if ( term.bHachBlupi ) + { + term.bHachBlupi = FALSE; + res = TX_PRIVATE_HACHBLUPI; + } + else if ( term.bHachPlanche ) + { + term.bHachPlanche = FALSE; + res = TX_PRIVATE_HACHPLANCHE; + } + else if ( term.bHachTomate ) + { + term.bHachTomate = FALSE; + res = TX_PRIVATE_HACHTOMATE; + } + else if ( term.bHachMetal ) + { + term.bHachMetal = FALSE; + res = TX_PRIVATE_HACHMETAL; + } + else if ( term.bHachRobot ) + { + term.bHachRobot = FALSE; + res = TX_PRIVATE_HACHROBOT; + } + else if ( term.bHomeBlupi ) + { + term.bHomeBlupi = FALSE; + res = TX_PRIVATE_HOMEBLUPI; + } + else if ( term.bStopFire ) + { + term.bStopFire = FALSE; + res = TX_PRIVATE_STOPFIRE; + } + if ( res == 0 ) break; + + LoadString(res, string, 100); + strcat(m_libelle, "\n1|\n"); + strcat(m_libelle, string); + nb ++; + } + + if ( nb == 0 || term.nbMaxBlupi > 1 ) + { + LoadString(TX_PRIVATE_NBBLUPI, buffer, 100); + sprintf(string, buffer, term.nbMaxBlupi); + strcat(m_libelle, "\n1|\n"); + strcat(m_libelle, string); + } + + h1 = GetTextHeight(m_libelle, FONTLITTLE, 1); + h2 = GetTextHeight(m_libelle, FONTLITTLE, 2); + if ( h2 > h1 ) h1 = h2; + m_pDecor->SetInfoHeight(POSDRAWY+h1+10); +} + +// Lit le libellé d'un monde. + +BOOL CEvent::ReadLibelle(int world, BOOL bSchool, BOOL bHelp) +{ + FILE* file = NULL; + char* pBuffer = NULL; + char* pText; + char* pDest; + char indic; + int nb, h1, h2; + + if ( bSchool ) indic = '$'; + else indic = '#'; + if ( bHelp ) indic = '@'; + + pBuffer = (char*)malloc(sizeof(char)*50000); + if ( pBuffer == NULL ) goto error; + memset(pBuffer, 0, sizeof(char)*50000); + + file = fopen("data\\enigmes.blp", "rb"); + if ( file == NULL ) goto error; + + nb = fread(pBuffer, sizeof(char), 50000-1, file); + pBuffer[nb] = 0; + + pText = pBuffer; + while ( world >= 0 ) + { + while ( *pText != 0 && *pText != indic ) + { + pText++; + } + if ( *pText == indic ) pText++; + world --; + } + while ( *pText != 0 && *pText != '\n' ) + { + pText++; + } + if ( *pText == '\n' ) pText++; + pDest = m_libelle; + while ( *pText != 0 && *pText != indic && + *pText != '$' && *pText != '#' && *pText != '@' ) + { + *pDest++ = *pText++; + } + *pDest = 0; + + h1 = GetTextHeight(m_libelle, FONTLITTLE, 1); + h2 = GetTextHeight(m_libelle, FONTLITTLE, 2); + if ( h2 > h1 ) h1 = h2; + m_pDecor->SetInfoHeight(POSDRAWY+h1+10); + + free(pBuffer); + fclose(file); + return TRUE; + + error: + if ( pBuffer != NULL ) free(pBuffer); + if ( file != NULL ) fclose(file); + return FALSE; +} + + +// Sauve les informations sur disque. + +BOOL CEvent::WriteInfo() +{ + char filename[MAX_PATH]; + FILE* file = NULL; + DescInfo info; + int nb; + + strcpy(filename, "data\\info.blp"); + AddUserPath(filename); + + file = fopen(filename, "wb"); + if ( file == NULL ) goto error; + + info.majRev = 1; + info.minRev = 0; + info.prive = m_private; + info.exercice = m_exercice; + info.mission = m_mission; + info.maxMission = m_maxMission; + info.speed = m_speed; + info.bMovie = m_bMovie; + info.scrollSpeed = m_scrollSpeed; + info.bAccessBuild = m_bAccessBuild; + + info.skill = m_pDecor->GetSkill(); + + info.audioVolume = m_pSound->GetAudioVolume(); + info.midiVolume = m_pSound->GetMidiVolume(); + + nb = fwrite(&info, sizeof(DescInfo), 1, file); + if ( nb < 1 ) goto error; + + fclose(file); + return TRUE; + + error: + if ( file != NULL ) fclose(file); + return FALSE; +} + +// Lit les informations sur disque. + +BOOL CEvent::ReadInfo() +{ + char filename[MAX_PATH]; + FILE* file = NULL; + DescInfo info; + int nb; + + strcpy(filename, "data\\info.blp"); + AddUserPath(filename); + + file = fopen(filename, "rb"); + if ( file == NULL ) goto error; + + nb = fread(&info, sizeof(DescInfo), 1, file); + if ( nb < 1 ) goto error; + + m_private = info.prive; + m_exercice = info.exercice; + m_mission = info.mission; + m_maxMission = info.maxMission; + m_speed = info.speed; + m_bMovie = info.bMovie; + m_scrollSpeed = info.scrollSpeed; + m_bAccessBuild = info.bAccessBuild; + + m_pDecor->SetSkill(info.skill); + + m_pSound->SetAudioVolume(info.audioVolume); + m_pSound->SetMidiVolume(info.midiVolume); + + fclose(file); + return TRUE; + + error: + if ( file != NULL ) fclose(file); + return FALSE; +} + + +// Modifie la vitesse du jeu. + +void CEvent::SetSpeed(int speed) +{ + int max; + + if ( m_bSpeed ) max = 8; + else max = 2; + + if ( speed > max ) speed = max; + + m_speed = speed; +} + +int CEvent::GetSpeed() +{ + return m_speed; +} + +BOOL CEvent::GetPause() +{ + return m_bPause; +} + + +// Début de l'enregistrement d'une démo. + +void CEvent::DemoRecStart() +{ + m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent)); + if ( m_pDemoBuffer == NULL ) return; + memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent)); + + m_demoTime = 0; + m_demoIndex = 0; + m_bDemoRec = TRUE; + m_bDemoPlay = FALSE; + + InitRandom(); + m_pDecor->SetTime(0); + m_speed = 1; +} + +// Fin de l'enregistrement d'une démo. +// Sauve le fichier sur disque. + +void CEvent::DemoRecStop() +{ + FILE* file = NULL; + DemoHeader header; + + if ( m_bDemoPlay ) return; + + if ( m_pDemoBuffer != NULL ) + { + DeleteFile("data\\demo.blp"); + file = fopen("data\\demo.blp", "wb"); + if ( file != NULL ) + { + memset(&header, 0, sizeof(DemoHeader)); + header.majRev = 1; + header.minRev = 0; + header.bSchool = m_bSchool; + header.bPrivate = m_bPrivate; + header.world = GetPhysicalWorld(); + header.skill = m_pDecor->GetSkill(); + fwrite(&header, sizeof(DemoHeader), 1, file); + fwrite(m_pDemoBuffer, sizeof(DemoEvent), m_demoIndex, file); + fclose(file); + } + free(m_pDemoBuffer); + m_pDemoBuffer = NULL; + } + + m_bDemoRec = FALSE; + m_demoTime = 0; +} + +// Début de la reproduction d'une démo. +// Lit le fichier sur disque. + +BOOL CEvent::DemoPlayStart() +{ + char filename[MAX_PATH]; + FILE* file = NULL; + DemoHeader header; + int nb, world, time, total; + + m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent)); + if ( m_pDemoBuffer == NULL ) return FALSE; + memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent)); + + sprintf(filename, "data\\demo%.3d.blp", m_demoNumber); + AddCDPath(filename); // ajoute l'accès au CD-Rom + file = fopen(filename, "rb"); + if ( file == NULL ) + { + DemoPlayStop(); + return FALSE; + } + + nb = fread(&header, sizeof(DemoHeader), 1, file); + if ( nb < 1 ) + { + DemoPlayStop(); + return FALSE; + } + m_bSchool = header.bSchool; + m_bPrivate = header.bPrivate; + m_pDecor->SetSkill(header.skill); + + m_demoEnd = fread(m_pDemoBuffer, sizeof(DemoEvent), MAXDEMO, file); + fclose(file); + + m_demoTime = 0; + m_demoIndex = 0; + m_bDemoPlay = TRUE; + m_bDemoRec = FALSE; + + if ( !m_pDecor->Read(header.world, FALSE, world, time, total) ) + { + DemoPlayStop(); + return FALSE; + } + ChangePhase(WM_PHASE_PLAY); + InitRandom(); + m_pDecor->SetTime(0); + m_speed = 1; + + return TRUE; +} + +// Fin de la reproduction d'une démo. + +void CEvent::DemoPlayStop() +{ + if ( m_pDemoBuffer != NULL ) + { + free(m_pDemoBuffer); + m_pDemoBuffer = NULL; + } + m_bDemoPlay = FALSE; + m_bDemoRec = FALSE; + m_demoTime = 0; + + ChangePhase(WM_PHASE_INIT); +} + +// Avance l'index d'enregistrement ou de reproduction. + +void CEvent::DemoStep() +{ + int time; + UINT message; + WPARAM wParam; + LPARAM lParam; + POINT pos; + + if ( m_phase == WM_PHASE_INIT ) + { + if ( m_demoTime > DEF_TIME_DEMO ) // ~30 secondes écoulées ? + { + m_demoNumber = 0; + DemoPlayStart(); // démarre une démo automatique + } + } + + if ( m_bDemoPlay && // démo en lecture ? + m_pDemoBuffer != NULL ) + { + while ( TRUE ) + { + time = m_pDemoBuffer[m_demoIndex].time; + if ( time > m_demoTime ) break; + + message = m_pDemoBuffer[m_demoIndex].message; + wParam = m_pDemoBuffer[m_demoIndex].wParam; + lParam = m_pDemoBuffer[m_demoIndex].lParam; + m_demoIndex ++; + + if ( message == WM_MOUSEMOVE && + m_mouseType == MOUSETYPEWIN ) + { + pos = ConvLongToPos(lParam); + ClientToScreen(m_hWnd, &pos); + SetCursorPos(pos.x, pos.y); + } + + TreatEventBase(message, wParam, lParam); + + if ( m_demoIndex >= m_demoEnd ) + { + m_demoNumber ++; // démo suivante + if ( !DemoPlayStart() ) // démarre la démo suivante + { + m_demoNumber = 0; // première démo + DemoPlayStart(); // démarre la démo + } + return; + } + } + } + + m_demoTime ++; +} + +// Mémorise un événement. + +void CEvent::DemoRecEvent(UINT message, WPARAM wParam, LPARAM lParam) +{ + if ( m_bDemoRec && m_pDemoBuffer != NULL && + (message == WM_KEYDOWN || + message == WM_KEYUP || + message == WM_LBUTTONDOWN || + message == WM_RBUTTONDOWN || + message == WM_MOUSEMOVE || + message == WM_LBUTTONUP || + message == WM_RBUTTONUP ) ) + { + if ( m_demoIndex > 0 && + message == WM_MOUSEMOVE && + m_pDemoBuffer[m_demoIndex-1].time == m_demoTime && + m_pDemoBuffer[m_demoIndex-1].message == message ) + { + m_pDemoBuffer[m_demoIndex-1].wParam = wParam; + m_pDemoBuffer[m_demoIndex-1].lParam = lParam; + } + else + { + m_pDemoBuffer[m_demoIndex].time = m_demoTime; + m_pDemoBuffer[m_demoIndex].message = message; + m_pDemoBuffer[m_demoIndex].wParam = wParam; + m_pDemoBuffer[m_demoIndex].lParam = lParam; + + m_demoIndex ++; + if ( m_demoIndex >= MAXDEMO ) + { + DemoRecStop(); + } + } + } +} + + +// Retourne la dernière position de la souris. + +POINT CEvent::GetLastMousePos() +{ + return m_oldMousePos; +} + +// Traitement d'un événement. + +BOOL CEvent::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam) +{ + if ( m_bDemoPlay ) // démo en lecture ? + { + if ( message == WM_KEYDOWN || // l'utilisateur clique ? + message == WM_KEYUP || +// message == WM_LBUTTONDOWN || +// message == WM_RBUTTONDOWN || + message == WM_LBUTTONUP || + message == WM_RBUTTONUP ) + { + DemoPlayStop(); + return TRUE; + } + if ( message == WM_MOUSEMOVE ) // l'utilisateur bouge ? + { + return TRUE; + } + } + + return TreatEventBase(message, wParam, lParam); +} + +// Traitement d'un événement. + +BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) +{ + POINT pos; + int fwKeys; + int i, sound; + char c; + BOOL bEnable; + + pos = ConvLongToPos(lParam); + fwKeys = wParam; + + DemoRecEvent(message, wParam, lParam); + + switch( message ) + { + case WM_KEYDOWN: + if ( wParam >= 'A' && wParam <= 'Z' ) + { + if ( m_posCheat == 0 ) // première lettre ? + { + m_rankCheat = -1; + for ( i=0 ; i<9 ; i++ ) + { + if ( (char)wParam == cheat_code[i][0] ) + { + m_rankCheat = i; + break; + } + } + } + if ( m_rankCheat != -1 ) + { + c = cheat_code[m_rankCheat][m_posCheat]; + if ( m_posCheat != 0 && m_rankCheat == 8 ) c++; // CONSTRUIRE ? + if ( (char)wParam == c ) + { + m_posCheat ++; + if ( cheat_code[m_rankCheat][m_posCheat] == 0 ) + { + bEnable = TRUE; + if ( m_phase == WM_PHASE_PLAY ) + { + if ( m_rankCheat == 0 ) // vision ? + { + m_pDecor->EnableFog(FALSE); + } + if ( m_rankCheat == 1 || // power ? + m_rankCheat == 2 ) // lonesome ? + { + m_pDecor->BlupiCheat(m_rankCheat); + } + } + + if ( m_rankCheat == 3 ) // allmissions ? + { + m_bAllMissions = !m_bAllMissions; + bEnable = m_bAllMissions; + m_bChangeCheat = TRUE; + } + if ( m_rankCheat == 4 ) // quick ? + { + m_bSpeed = !m_bSpeed; + bEnable = m_bSpeed; + m_bChangeCheat = TRUE; + } +#if !_DEMO + if ( m_rankCheat == 5 ) // helpme ? + { + m_bHelp = !m_bHelp; + bEnable = m_bHelp; + m_bChangeCheat = TRUE; + } +#endif + + if ( m_rankCheat == 6 ) // invincible ? + { + m_pDecor->SetInvincible(!m_pDecor->GetInvincible()); + bEnable = m_pDecor->GetInvincible(); + m_bChangeCheat = TRUE; + } + + if ( m_rankCheat == 7 ) // superblupi ? + { + m_pDecor->SetSuper(!m_pDecor->GetSuper()); + bEnable = m_pDecor->GetSuper(); + m_bChangeCheat = TRUE; + } + +#if !_DEMO + if ( m_rankCheat == 8 ) // construire ? + { + m_bAccessBuild = !m_bAccessBuild; + bEnable = m_bAccessBuild; + m_bChangeCheat = TRUE; + } +#endif + + if ( m_phase != WM_PHASE_PLAY ) + { + ChangePhase(m_phase); + } + + pos.x = LXIMAGE/2; + pos.y = LYIMAGE/2; + if ( bEnable ) + { + m_pSound->PlayImage(SOUND_BUT, pos); + } + else + { + m_pSound->PlayImage(SOUND_BOING, pos); + } + + m_rankCheat = -1; + m_posCheat = 0; + } + return TRUE; + } + } + } + m_rankCheat = -1; + m_posCheat = 0; + + if ( m_phase == WM_PHASE_INTRO1 ) + { + ChangePhase(WM_PHASE_INTRO2); + return TRUE; + } + + if ( m_phase == WM_PHASE_INTRO2 ) + { + ChangePhase(WM_PHASE_INIT); + return TRUE; + } + + if ( m_phase == WM_PHASE_BYE ) + { + PostMessage(m_hWnd, WM_CLOSE, 0, 0); + } + + switch( wParam ) + { + case VK_END: + DemoRecStop(); + return TRUE; + case VK_ESCAPE: + if ( m_bRunMovie ) + { + StopMovie(); + m_pSound->SetSuspendSkip(1); + return TRUE; + } + if ( m_phase == WM_PHASE_PLAY || + m_phase == WM_PHASE_SETUP || + m_phase == WM_PHASE_SETUPp || + m_phase == WM_PHASE_READ || + m_phase == WM_PHASE_WRITE || + m_phase == WM_PHASE_WRITEp || + m_phase == WM_PHASE_HELP ) + { + ChangePhase(WM_PHASE_STOP); + return TRUE; + } + if ( m_phase == WM_PHASE_STOP || + m_phase == WM_PHASE_LOST || + m_phase == WM_PHASE_BUILD ) + { + ChangePhase(WM_PHASE_INFO); + return TRUE; + } + if ( m_phase == WM_PHASE_INFO ) + { + ChangePhase(WM_PHASE_INIT); + return TRUE; + } + if ( m_phase == WM_PHASE_BUTTON || + m_phase == WM_PHASE_TERM || + m_phase == WM_PHASE_MUSIC || + m_phase == WM_PHASE_REGION ) + { + ChangePhase(WM_PHASE_BUILD); + return TRUE; + } + if ( m_phase == WM_PHASE_INIT ) + { + ChangePhase(WM_PHASE_BYE); + return TRUE; + } + if ( m_phase == WM_PHASE_BYE ) + { + PostMessage(m_hWnd, WM_CLOSE, 0, 0); + break; + } + return TRUE; + case VK_RETURN: + if ( m_phase == WM_PHASE_PLAY || + m_phase == WM_PHASE_READ || + m_phase == WM_PHASE_WRITE || + m_phase == WM_PHASE_SETUP ) + { + ChangePhase(WM_PHASE_STOP); + return TRUE; + } + if ( m_phase == WM_PHASE_INIT || + m_phase == WM_PHASE_LOST || + m_phase == WM_PHASE_BUILD ) + { + ChangePhase(WM_PHASE_INFO); + return TRUE; + } + if ( m_phase == WM_PHASE_INFO || + m_phase == WM_PHASE_STOP || + m_phase == WM_PHASE_HELP || + m_phase == WM_PHASE_SETUPp || + m_phase == WM_PHASE_WRITEp ) + { + ChangePhase(WM_PHASE_PLAY); + return TRUE; + } + if ( m_phase == WM_PHASE_BUTTON || + m_phase == WM_PHASE_TERM || + m_phase == WM_PHASE_MUSIC || + m_phase == WM_PHASE_REGION ) + { + ChangePhase(WM_PHASE_BUILD); + return TRUE; + } + return TRUE; + case VK_LEFT: +//? DecorShift(-4,4); + DecorShift(-2,2); + return TRUE; + case VK_RIGHT: +//? DecorShift(4,-4); + DecorShift(2,-2); + return TRUE; + case VK_UP: +//? DecorShift(-6,-6); + DecorShift(-3,-3); + return TRUE; + case VK_DOWN: +//? DecorShift(6,6); + DecorShift(3,3); + return TRUE; + case VK_HOME: + pos = m_pDecor->GetHome(); + m_pDecor->SetCoin(pos); + return TRUE; + case VK_SPACE: + if ( m_bRunMovie ) + { + StopMovie(); + m_pSound->SetSuspendSkip(1); + return TRUE; + } + m_pDecor->FlipOutline(); + return TRUE; + case VK_PAUSE: + m_bPause = !m_bPause; + if ( m_phase == WM_PHASE_PLAY ) + { + if ( m_bPause ) + { + m_pSound->SuspendMusic(); + } + else + { + m_pSound->RestartMusic(); + } + } + return TRUE; + case VK_CONTROL: + m_bCtrlDown = TRUE; + if ( m_phase == WM_PHASE_BUILD ) + { + m_bFillMouse = TRUE; + MouseSprite(GetMousePos()); + } + else + { + m_bFillMouse = FALSE; + } + return TRUE; + case VK_F1: + if ( m_phase == WM_PHASE_PLAY ) + { + // Montre ou cache les infos tout en haut. + if ( m_pDecor->GetInfoMode() ) sound = SOUND_CLOSE; + else sound = SOUND_OPEN; + pos.x = LXIMAGE/2; + pos.y = LYIMAGE/2; + m_pSound->PlayImage(sound, pos); + m_pDecor->SetInfoMode(!m_pDecor->GetInfoMode()); + } + return TRUE; + case VK_F9: + if ( m_phase == WM_PHASE_PLAY ) + { + m_pDecor->MemoPos(0, m_bCtrlDown); + } + return TRUE; + case VK_F10: + if ( m_phase == WM_PHASE_PLAY ) + { + m_pDecor->MemoPos(1, m_bCtrlDown); + } + return TRUE; + case VK_F11: + if ( m_phase == WM_PHASE_PLAY ) + { + m_pDecor->MemoPos(2, m_bCtrlDown); + } + return TRUE; + case VK_F12: + if ( m_phase == WM_PHASE_PLAY ) + { + m_pDecor->MemoPos(3, m_bCtrlDown); + } + return TRUE; + } + break; + + case WM_KEYUP: + switch( wParam ) + { + case VK_CONTROL: + m_bCtrlDown = FALSE; + m_bFillMouse = FALSE; + MouseSprite(GetMousePos()); + return TRUE; + } + break; + + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + m_bMousePress = TRUE; + MouseSprite(pos); +//? DecorAutoShift(pos); + if ( EventButtons(message, wParam, lParam) ) return TRUE; + if ( m_phase == WM_PHASE_BUILD ) + { + if ( BuildDown(pos, fwKeys) ) return TRUE; + } + if ( m_phase == WM_PHASE_PLAY ) + { + if ( PlayDown(pos, fwKeys) ) return TRUE; + } + break; + + case WM_MOUSEMOVE: + if ( m_mouseType == MOUSETYPEGRA ) + { + if ( m_bShowMouse ) + { + ShowCursor(FALSE); // cache la souris + m_pPixmap->MouseShow(TRUE); // montre sprite + m_bShowMouse = FALSE; + } + } + if ( m_mouseType == MOUSETYPEWINPOS && + (pos.x != m_oldMousePos.x || + pos.y != m_oldMousePos.y ) ) + { + m_oldMousePos = pos; + ClientToScreen(m_hWnd, &m_oldMousePos); + SetCursorPos(m_oldMousePos.x, m_oldMousePos.y); // (*) + } + m_oldMousePos = pos; + + MouseSprite(pos); + if ( EventButtons(message, wParam, lParam) ) return TRUE; + if ( m_phase == WM_PHASE_BUILD ) + { + if ( BuildMove(pos, fwKeys) ) return TRUE; + } + if ( m_phase == WM_PHASE_PLAY ) + { + if ( PlayMove(pos, fwKeys) ) return TRUE; + } + break; + + case WM_NCMOUSEMOVE: + if ( m_mouseType == MOUSETYPEGRA ) + { + if ( !m_bShowMouse ) + { + ShowCursor(TRUE); // montre la souris + m_pPixmap->MouseShow(FALSE); // cache sprite + m_bShowMouse = TRUE; + } + } + break; + + case WM_LBUTTONUP: + case WM_RBUTTONUP: + m_bMousePress = FALSE; + if ( EventButtons(message, wParam, lParam) ) return TRUE; + if ( m_phase == WM_PHASE_BUILD ) + { + if ( BuildUp(pos, fwKeys) ) return TRUE; + } + if ( m_phase == WM_PHASE_PLAY ) + { + if ( PlayUp(pos, fwKeys) ) return TRUE; + } + if ( m_phase == WM_PHASE_BYE ) + { + PostMessage(m_hWnd, WM_CLOSE, 0, 0); + } + break; + + case WM_PHASE_DEMO: + m_demoNumber = 0; + DemoPlayStart(); + break; + + case WM_PHASE_SCHOOL: + m_bSchool = TRUE; + m_bPrivate = FALSE; + if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + break; + + case WM_PHASE_MISSION: + m_bSchool = FALSE; + m_bPrivate = FALSE; + if ( m_mission == 0 ) // première mission ? + { + if ( ChangePhase(WM_PHASE_H0MOVIE) ) return TRUE; + } + else + { + if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + } + break; + + case WM_PHASE_PRIVATE: + m_bSchool = FALSE; + m_bPrivate = TRUE; + if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + break; + + case WM_PHASE_INTRO1: + case WM_PHASE_INTRO2: + case WM_PHASE_INIT: + case WM_PHASE_HISTORY0: + case WM_PHASE_HISTORY1: + case WM_PHASE_INFO: + case WM_PHASE_PLAY: + case WM_PHASE_READ: + case WM_PHASE_WRITE: + case WM_PHASE_WRITEp: + case WM_PHASE_BUILD: + case WM_PHASE_BUTTON: + case WM_PHASE_TERM: + case WM_PHASE_STOP: + case WM_PHASE_HELP: + case WM_PHASE_MUSIC: + case WM_PHASE_REGION: + case WM_PHASE_SETUP: + case WM_PHASE_SETUPp: + case WM_PHASE_PLAYMOVIE: + case WM_PHASE_H0MOVIE: + case WM_PHASE_H1MOVIE: + case WM_PHASE_H2MOVIE: + case WM_PHASE_WINMOVIE: + case WM_PHASE_BYE: + if ( ChangePhase(message) ) return TRUE; + break; + + case WM_PHASE_UNDO: + m_pDecor->UndoBack(); // revient en arrière + break; + + case WM_PREV: + m_pDecor->SetInvincible(FALSE); + m_pDecor->SetSuper(FALSE); + if ( m_bPrivate ) + { + if ( m_private > 0 ) + { + m_private --; + if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + } + } + else if ( m_bSchool ) + { + if ( m_exercice > 0 ) + { + m_exercice --; + if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + } + } + else + { + if ( m_mission > 0 ) + { + m_mission --; + if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + } + } + break; + + case WM_NEXT: + m_pDecor->SetInvincible(FALSE); + m_pDecor->SetSuper(FALSE); + if ( m_bPrivate ) + { + if ( m_private < 20-1 ) + { + m_private ++; + if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + } + } + else if ( m_bSchool ) + { + if ( m_exercice < 99 ) + { + m_exercice ++; + if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + } + } + else + { + if ( m_mission < 99 ) + { + m_mission ++; + if ( m_maxMission < m_mission ) + { + m_maxMission = m_mission; + } + if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + } + } + break; + + case WM_DECOR1: + SetState(WM_DECOR1, 1); + SetState(WM_DECOR2, 0); + SetState(WM_DECOR3, 0); + SetState(WM_DECOR4, 0); + SetState(WM_DECOR5, 0); + break; + + case WM_DECOR2: + SetState(WM_DECOR1, 0); + SetState(WM_DECOR2, 1); + SetState(WM_DECOR3, 0); + SetState(WM_DECOR4, 0); + SetState(WM_DECOR5, 0); + break; + + case WM_DECOR3: + SetState(WM_DECOR1, 0); + SetState(WM_DECOR2, 0); + SetState(WM_DECOR3, 1); + SetState(WM_DECOR4, 0); + SetState(WM_DECOR5, 0); + break; + + case WM_DECOR4: + SetState(WM_DECOR1, 0); + SetState(WM_DECOR2, 0); + SetState(WM_DECOR3, 0); + SetState(WM_DECOR4, 1); + SetState(WM_DECOR5, 0); + break; + + case WM_DECOR5: + SetState(WM_DECOR1, 0); + SetState(WM_DECOR2, 0); + SetState(WM_DECOR3, 0); + SetState(WM_DECOR4, 0); + SetState(WM_DECOR5, 1); + break; + + case WM_PHASE_SKILL1: + m_pDecor->SetSkill(0); + SetState(WM_PHASE_SKILL1, TRUE); + SetState(WM_PHASE_SKILL2, FALSE); + break; + case WM_PHASE_SKILL2: + m_pDecor->SetSkill(1); + SetState(WM_PHASE_SKILL1, FALSE); + SetState(WM_PHASE_SKILL2, TRUE); + break; + + case WM_BUTTON0: + case WM_BUTTON1: + case WM_BUTTON2: + case WM_BUTTON3: + case WM_BUTTON4: + case WM_BUTTON5: + case WM_BUTTON6: + case WM_BUTTON7: + case WM_BUTTON8: + case WM_BUTTON9: + case WM_BUTTON10: + case WM_BUTTON11: + case WM_BUTTON12: + case WM_BUTTON13: + case WM_BUTTON14: + case WM_BUTTON15: + case WM_BUTTON16: + case WM_BUTTON17: + case WM_BUTTON18: + case WM_BUTTON19: + case WM_BUTTON20: + case WM_BUTTON21: + case WM_BUTTON22: + case WM_BUTTON23: + case WM_BUTTON24: + case WM_BUTTON25: + case WM_BUTTON26: + case WM_BUTTON27: + case WM_BUTTON28: + case WM_BUTTON29: + case WM_BUTTON30: + case WM_BUTTON31: + case WM_BUTTON32: + case WM_BUTTON33: + case WM_BUTTON34: + case WM_BUTTON35: + case WM_BUTTON36: + case WM_BUTTON37: + case WM_BUTTON38: + case WM_BUTTON39: + ChangeButtons(message); + break; + + case WM_READ0: + case WM_READ1: + case WM_READ2: + case WM_READ3: + case WM_READ4: + case WM_READ5: + case WM_READ6: + case WM_READ7: + case WM_READ8: + case WM_READ9: + Read(message); + ChangePhase(WM_PHASE_PLAY); // joue + break; + + case WM_WRITE0: + case WM_WRITE1: + case WM_WRITE2: + case WM_WRITE3: + case WM_WRITE4: + case WM_WRITE5: + case WM_WRITE6: + case WM_WRITE7: + case WM_WRITE8: + case WM_WRITE9: + Write(message); + if ( m_phase == WM_PHASE_WRITEp ) + { + ChangePhase(WM_PHASE_PLAY); // joue + } + else + { + ChangePhase(WM_PHASE_STOP); // pause + } + break; + + case WM_MOVIE: + StartMovie("movie\\essai.avi"); + ChangePhase(WM_PHASE_INIT); + break; + } + + return FALSE; +} + +// (*) Sans cela, il existe un drôle de problème sur +// certains PC: la souris ne suis pas le mouvement +// réel effectué. +// Problème résolu par Denis ! + + +// Affiche un caractère de debug tout en haut. + +void CEvent::DebugDisplay(char m) +{ + char text[10]; + POINT pos; + RECT rect; + + m_debugPos.x += 8; + if ( m_debugPos.x > LXIMAGE-8 ) + { + m_debugPos.x = 0; + pos.x = 0; + pos.y = 0; + rect.left = pos.x; + rect.right = pos.x+LXIMAGE; + rect.top = pos.y; + rect.bottom = pos.y+DIMLITTLEY; + m_pPixmap->DrawPart(-1, CHBACK, pos, rect, 1); // dessine le fond + } + + text[0] = m; + text[1] = 0; + + DrawText(m_pPixmap, m_debugPos, text, FONTLITTLE); +} + +// Passe les images d'introduction. + +void CEvent::IntroStep() +{ + m_introTime ++; + + if ( m_introTime > 20*3 ) + { + if ( m_phase == WM_PHASE_INTRO1 ) + { + ChangePhase(WM_PHASE_INTRO2); + return; + } + + if ( m_phase == WM_PHASE_INTRO2 ) + { + ChangePhase(WM_PHASE_INIT); + return; + } + } +} + diff --git a/event.h b/event.h new file mode 100644 index 0000000..169e180 --- /dev/null +++ b/event.h @@ -0,0 +1,220 @@ +// Event.h + + + +///////////////////////////////////////////////////////////////////////////// + +typedef struct +{ + UINT message; + int type; + int iconMenu[20]; + int x, y; + int toolTips[20]; +} +Button; + +typedef struct +{ + UINT phase; + char backName[20]; + BOOL bCDrom; + Button buttons[MAXBUTTON]; +} +Phase; + + +typedef struct +{ + short majRev; + short minRev; + short bSchool; + short bPrivate; + short world; + short skill; + short reserve1[99]; +} +DemoHeader; + +typedef struct +{ + int time; + UINT message; + WPARAM wParam; + LPARAM lParam; +} +DemoEvent; + + +class CEvent +{ +public: + CEvent(); + ~CEvent(); + + POINT GetMousePos(); + void Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CMovie *pMovie); + void SetFullScreen(BOOL bFullScreen); + void SetMouseType(int mouseType); + int GetWorld(); + int GetPhysicalWorld(); + int GetImageWorld(); + BOOL IsHelpHide(); + BOOL ChangePhase(UINT phase); + void MovieToStart(); + UINT GetPhase(); + void TryInsert(); + void RestoreGame(); + + int GetButtonIndex(int button); + int GetState(int button); + void SetState(int button, int state); + BOOL GetEnable(int button); + void SetEnable(int button, BOOL bEnable); + BOOL GetHide(int button); + void SetHide(int button, BOOL bHide); + int GetMenu(int button); + void SetMenu(int button, int menu); + + BOOL DrawButtons(); + int MousePosToSprite(POINT pos); + void MouseSprite(POINT pos); + void WaitMouse(BOOL bWait); + void HideMouse(BOOL bHide); + POINT GetLastMousePos(); + BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); + BOOL TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam); + + void DecorAutoShift(POINT pos); + + BOOL StartMovie(char *pFilename); + void StopMovie(); + BOOL IsMovie(); + + BOOL FlipObject(); + + void Read(int message); + void Write(int message); + + void SetSpeed(int speed); + int GetSpeed(); + BOOL GetPause(); + BOOL IsShift(); + + void DemoStep(); + void DebugDisplay(char m); + + void IntroStep(); + +protected: + void DrawTextCenter(int res, int x, int y, int font=0); + BOOL CreateButtons(); + BOOL EventButtons(UINT message, WPARAM wParam, LPARAM lParam); + BOOL MouseOnButton(POINT pos); + int SearchPhase(UINT phase); + void DecorShift(int dx, int dy); + + BOOL PlayDown(POINT pos, int fwKeys); + BOOL PlayMove(POINT pos, int fwKeys); + BOOL PlayUp(POINT pos, int fwKeys); + void ChangeButtons(int message); + + void BuildFloor(POINT cel, int insIcon); + void BuildWater(POINT cel, int insIcon); + BOOL BuildDown(POINT pos, int fwKeys, BOOL bMix=TRUE); + BOOL BuildMove(POINT pos, int fwKeys); + BOOL BuildUp(POINT pos, int fwKeys); + + void PrivateLibelle(); + BOOL ReadLibelle(int world, BOOL bSchool, BOOL bHelp); + BOOL WriteInfo(); + BOOL ReadInfo(); + + void DemoRecStart(); + void DemoRecStop(); + BOOL DemoPlayStart(); + void DemoPlayStop(); + void DemoRecEvent(UINT message, WPARAM wParam, LPARAM lParam); + +protected: + int m_speed; + int m_exercice; + int m_mission; + int m_private; + int m_maxMission; + int m_phase; + int m_index; + BOOL m_bSchool; + BOOL m_bPrivate; + BOOL m_bAccessBuild; + BOOL m_bFullScreen; + int m_mouseType; + HWND m_hWnd; + CPixmap* m_pPixmap; + CDecor* m_pDecor; + CSound* m_pSound; + CMovie* m_pMovie; + char m_movieToStart[MAX_PATH]; + int m_phaseAfterMovie; + CButton m_buttons[MAXBUTTON]; + int m_lastFloor[MAXBUTTON]; + int m_lastObject[MAXBUTTON]; + int m_lastHome[MAXBUTTON]; + BOOL m_bRunMovie; + BOOL m_bBuildModify; + CJauge m_jauges[2]; + CMenu m_menu; + BOOL m_bMenu; + POINT m_menuPos; + int m_menuNb; + int m_menuButtons[MAXBUTTON]; + int m_menuErrors[MAXBUTTON]; + int m_menuPerso; + POINT m_menuCel; + POINT m_oldMousePos; + BOOL m_bMousePress; + BOOL m_bMouseDown; + BOOL m_bHili; + int m_fileWorld[10]; + int m_fileTime[10]; + POINT m_posToolTips; + char m_textToolTips[50]; + int m_mouseSprite; + BOOL m_bFillMouse; + BOOL m_bWaitMouse; + BOOL m_bHideMouse; + BOOL m_bShowMouse; + int m_rankCheat; + int m_posCheat; + BOOL m_bMovie; + BOOL m_bSpeed; + BOOL m_bHelp; + BOOL m_bAllMissions; + BOOL m_bChangeCheat; + int m_scrollSpeed; + BOOL m_bPause; + BOOL m_bShift; + int m_shiftPhase; + POINT m_shiftVector; + POINT m_shiftOffset; + char m_libelle[1000]; + int m_tryPhase; + int m_tryInsertCount; + POINT m_posInfoButton; + POINT m_posHelpButton; + BOOL m_bHiliInfoButton; + BOOL m_bHiliHelpButton; + BOOL m_bInfoHelp; + BOOL m_bDemoRec; + BOOL m_bDemoPlay; + DemoEvent* m_pDemoBuffer; + int m_demoTime; + int m_demoIndex; + int m_demoEnd; + int m_demoNumber; + BOOL m_bCtrlDown; + POINT m_debugPos; + int m_introTime; +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/fifo.cpp b/fifo.cpp new file mode 100644 index 0000000..c7826b5 --- /dev/null +++ b/fifo.cpp @@ -0,0 +1,64 @@ +// Class CFifo, gestion d'une liste en fifo + + +#include +#include "fifo.h" + + +// gestion d'une pile classée en valeur croissantes +// typiquement reprend les coordonnées les plus proches +// du but en premier lieu + +CPileTriee::CPileTriee(long taille) +{ + m_taille = taille; + m_max = m_out = 0; + m_data = (Element*) malloc (sizeof(Element)*taille); +} + +CPileTriee::~CPileTriee() +{ + free( m_data ); +} + +long CPileTriee::get() +{ + if (m_out == m_max) return -1; + long val = m_data [m_out].pos; + m_out++; + if (m_out>=m_taille) m_out = 0; + return val; +} + +void CPileTriee::put(long pos, long dist) +{ + long i=m_out; + long p,d,m; + + while (i!=m_max) + { + // le point est-il plus proche que celui-là ? + if (dist=m_taille) i=0; + } + + // ajoute le point éloigné à la suite + m = m_max+1; + if (m>=m_taille) m=0; + if (m!=m_out) + { + m_data[m_max].pos = pos; + m_data[m_max].dist = dist; + m_max = m; + } +} \ No newline at end of file diff --git a/fifo.h b/fifo.h new file mode 100644 index 0000000..f6fad3b --- /dev/null +++ b/fifo.h @@ -0,0 +1,33 @@ + +#pragma once + +// traitement d'une liste en fifo + + +// stucture pour enpiler des positions +// en fonction de leur distance à la cible +typedef struct +{ + long pos; + long dist; +} +Element; + + +// traitement d'une pile triée + +class CPileTriee +{ +private: + long m_taille; // nombre de polongs max + long m_max; // position limite + long m_out; // position pour reprendre + Element* m_data; // données + +public: + CPileTriee(long taille); + ~CPileTriee(); + + void put(long pos, long dist); + long get(); +}; \ No newline at end of file diff --git a/fill.cur b/fill.cur new file mode 100644 index 0000000..1c1b24b Binary files /dev/null and b/fill.cur differ diff --git a/fog.cpp b/fog.cpp new file mode 100644 index 0000000..94068f8 --- /dev/null +++ b/fog.cpp @@ -0,0 +1,154 @@ +// Fog.cpp + +#include + +#include "DECOR.H" + +// Cette table indique les quarts de cases contenant du +// brouillard lorsque la valeur est à un. +// 0 1 +// 2 3 +static char tableFog[15*4] = +{ + 1,1,1,0, // 0 + 1,1,0,0, // 1 + 1,1,0,1, // 2 + 1,0,1,0, // 3 + 1,1,1,1, // 4 + 0,1,0,1, // 5 + 1,0,1,1, // 6 + 0,0,1,1, // 7 + 0,1,1,1, // 8 + 0,0,0,1, // 9 + 0,0,1,0, // 10 + 1,0,0,1, // 11 + 0,1,0,0, // 12 + 1,0,0,0, // 13 + 0,1,1,0, // 14 +}; + +// Retourne les bits contenant du brouillard. + +BOOL GetFogBits(int icon, char *pBits) +{ + pBits[0] = 0; + pBits[1] = 0; + pBits[2] = 0; + pBits[3] = 0; + + if ( icon < 0 || icon >= 15 ) return TRUE; + + pBits[0] = tableFog[icon*4+0]; + pBits[1] = tableFog[icon*4+1]; + pBits[2] = tableFog[icon*4+2]; + pBits[3] = tableFog[icon*4+3]; + + return TRUE; +} + +// Retourne l'icône correspondant aux bits de brouillard. + +int GetFogIcon(char *pBits) +{ + int i; + + for ( i=0 ; i<15 ; i++ ) + { + if ( tableFog[i*4+0] == pBits[0] && + tableFog[i*4+1] == pBits[1] && + tableFog[i*4+2] == pBits[2] && + tableFog[i*4+3] == pBits[3] ) return i; + } + + return -1; +} + + +// Table donnant la "vision" d'un blupi dans le +// brouillard. + +static char table_fog[17*17] = +{ +#if 1 + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 1,-1, 5, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 1,-1,-1,-1, 5, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 1,-1,-1,-1,-1,-1, 5, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1,-1,-1,-1,-1,-1,-1,-1, 5, 4, 4, 4, 4, 4, + 4, 4, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 4, 4, 4, 4, + 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 4, 4, 4, + 4, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 4, 4, + 4, 4, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 8, 4, + 4, 4, 4, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1, 7, 4, 4, + 4, 4, 4, 4, 4, 3,-1,-1,-1,-1,-1,-1,-1, 7, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 3,-1,-1,-1,-1,-1, 7, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 3,-1,-1,-1, 7, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 3,-1, 7, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +#else + 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 1,-1, 5, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 1,-1,-1,-1, 5, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 1,-1,-1,-1,-1,-1, 5, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 1,-1,-1,-1,-1,-1,-1,-1, 5, 4, 4, 4, 4, + 4, 4, 4, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 4, 4, 4, + 4, 4, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 4, 4, + 4, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 4, + 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 8, + 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 7, 4, + 4, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 7, 4, 4, + 4, 4, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1, 7, 4, 4, 4, + 4, 4, 4, 4, 3,-1,-1,-1,-1,-1,-1,-1, 7, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 3,-1,-1,-1,-1,-1, 7, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 3,-1,-1,-1, 7, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 3,-1, 7, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, +#endif +}; + +// Ecarte le brouillard autour d'un blupi. + +void CDecor::BlupiPushFog(int rank) +{ + int x, y, i; + POINT cel; + char cBits[4]; + char nBits[4]; + + if ( m_blupi[rank].perso != 0 && + m_blupi[rank].perso != 8 ) return; + + for ( y=0 ; y<17 ; y++ ) + { + for ( x=0 ; x<17 ; x++ ) + { + if ( x%2 != y%2 ) continue; + if ( table_fog[x+y*17] == FOGHIDE ) continue; + + cel.x = (x + ((m_blupi[rank].cel.x+1)/4)*2 - 8)*2; + cel.y = (y + ((m_blupi[rank].cel.y+1)/4)*2 - 8)*2; + + // Ne pas utiliser IsValid pour permettre d'aller + // jusqu'au bord ! + if ( cel.x >= 0 && cel.x < MAXCELX && + cel.y >= 0 && cel.y < MAXCELX ) + { + if ( m_decor[cel.x/2][cel.y/2].fog != -1 ) + { + GetFogBits(m_decor[cel.x/2][cel.y/2].fog, cBits); + GetFogBits(table_fog[x+y*17], nBits); + + for ( i=0 ; i<4 ; i++ ) + { + nBits[i] &= cBits[i]; // "ou" visibilité + } + + m_decor[cel.x/2][cel.y/2].fog = GetFogIcon(nBits); + } + } + } + } +} + diff --git a/image/bignum.blp b/image/bignum.blp new file mode 100644 index 0000000..b0bff3a Binary files /dev/null and b/image/bignum.blp differ diff --git a/image/blupi.blp b/image/blupi.blp new file mode 100644 index 0000000..d2eaa15 Binary files /dev/null and b/image/blupi.blp differ diff --git a/image/build.blp b/image/build.blp new file mode 100644 index 0000000..0eefae9 Binary files /dev/null and b/image/build.blp differ diff --git a/image/button.blp b/image/button.blp new file mode 100644 index 0000000..925fe66 Binary files /dev/null and b/image/button.blp differ diff --git a/image/button00.blp b/image/button00.blp new file mode 100644 index 0000000..cdcfc88 Binary files /dev/null and b/image/button00.blp differ diff --git a/image/bye.blp b/image/bye.blp new file mode 100644 index 0000000..8381b3a Binary files /dev/null and b/image/bye.blp differ diff --git a/image/floor000.blp b/image/floor000.blp new file mode 100644 index 0000000..04603c8 Binary files /dev/null and b/image/floor000.blp differ diff --git a/image/floor001.blp b/image/floor001.blp new file mode 100644 index 0000000..4bc196f Binary files /dev/null and b/image/floor001.blp differ diff --git a/image/floor002.blp b/image/floor002.blp new file mode 100644 index 0000000..57b8ddd Binary files /dev/null and b/image/floor002.blp differ diff --git a/image/floor003.blp b/image/floor003.blp new file mode 100644 index 0000000..7f4736a Binary files /dev/null and b/image/floor003.blp differ diff --git a/image/fog.blp b/image/fog.blp new file mode 100644 index 0000000..1a4d4d6 Binary files /dev/null and b/image/fog.blp differ diff --git a/image/help.blp b/image/help.blp new file mode 100644 index 0000000..cedc990 Binary files /dev/null and b/image/help.blp differ diff --git a/image/hili.blp b/image/hili.blp new file mode 100644 index 0000000..e4dca09 Binary files /dev/null and b/image/hili.blp differ diff --git a/image/history0.blp b/image/history0.blp new file mode 100644 index 0000000..536682c Binary files /dev/null and b/image/history0.blp differ diff --git a/image/history1.blp b/image/history1.blp new file mode 100644 index 0000000..b3c8d10 Binary files /dev/null and b/image/history1.blp differ diff --git a/image/info000.blp b/image/info000.blp new file mode 100644 index 0000000..9b9c6dd Binary files /dev/null and b/image/info000.blp differ diff --git a/image/info001.blp b/image/info001.blp new file mode 100644 index 0000000..0760b48 Binary files /dev/null and b/image/info001.blp differ diff --git a/image/info002.blp b/image/info002.blp new file mode 100644 index 0000000..5890d30 Binary files /dev/null and b/image/info002.blp differ diff --git a/image/init.blp b/image/init.blp new file mode 100644 index 0000000..38f17ff Binary files /dev/null and b/image/init.blp differ diff --git a/image/insert.blp b/image/insert.blp new file mode 100644 index 0000000..017ce85 Binary files /dev/null and b/image/insert.blp differ diff --git a/image/intro1.blp b/image/intro1.blp new file mode 100644 index 0000000..833ff06 Binary files /dev/null and b/image/intro1.blp differ diff --git a/image/intro2.blp b/image/intro2.blp new file mode 100644 index 0000000..d79fc57 Binary files /dev/null and b/image/intro2.blp differ diff --git a/image/jauge.blp b/image/jauge.blp new file mode 100644 index 0000000..92a622c Binary files /dev/null and b/image/jauge.blp differ diff --git a/image/last000.blp b/image/last000.blp new file mode 100644 index 0000000..30f1caa Binary files /dev/null and b/image/last000.blp differ diff --git a/image/last001.blp b/image/last001.blp new file mode 100644 index 0000000..fe4f21f Binary files /dev/null and b/image/last001.blp differ diff --git a/image/last002.blp b/image/last002.blp new file mode 100644 index 0000000..70218f2 Binary files /dev/null and b/image/last002.blp differ diff --git a/image/little.blp b/image/little.blp new file mode 100644 index 0000000..9fc7521 Binary files /dev/null and b/image/little.blp differ diff --git a/image/lost.blp b/image/lost.blp new file mode 100644 index 0000000..e063732 Binary files /dev/null and b/image/lost.blp differ diff --git a/image/mask1.blp b/image/mask1.blp new file mode 100644 index 0000000..11babda Binary files /dev/null and b/image/mask1.blp differ diff --git a/image/movie.blp b/image/movie.blp new file mode 100644 index 0000000..f1c9f59 Binary files /dev/null and b/image/movie.blp differ diff --git a/image/music.blp b/image/music.blp new file mode 100644 index 0000000..ac70db6 Binary files /dev/null and b/image/music.blp differ diff --git a/image/obj-o000.blp b/image/obj-o000.blp new file mode 100644 index 0000000..34a3a35 Binary files /dev/null and b/image/obj-o000.blp differ diff --git a/image/obj-o001.blp b/image/obj-o001.blp new file mode 100644 index 0000000..f585ff3 Binary files /dev/null and b/image/obj-o001.blp differ diff --git a/image/obj-o002.blp b/image/obj-o002.blp new file mode 100644 index 0000000..55b6157 Binary files /dev/null and b/image/obj-o002.blp differ diff --git a/image/obj-o003.blp b/image/obj-o003.blp new file mode 100644 index 0000000..bcc3221 Binary files /dev/null and b/image/obj-o003.blp differ diff --git a/image/obj000.blp b/image/obj000.blp new file mode 100644 index 0000000..3d5a7fa Binary files /dev/null and b/image/obj000.blp differ diff --git a/image/obj001.blp b/image/obj001.blp new file mode 100644 index 0000000..da68c6d Binary files /dev/null and b/image/obj001.blp differ diff --git a/image/obj002.blp b/image/obj002.blp new file mode 100644 index 0000000..eb6dbdb Binary files /dev/null and b/image/obj002.blp differ diff --git a/image/obj003.blp b/image/obj003.blp new file mode 100644 index 0000000..018366d Binary files /dev/null and b/image/obj003.blp differ diff --git a/image/play.blp b/image/play.blp new file mode 100644 index 0000000..17ef0a7 Binary files /dev/null and b/image/play.blp differ diff --git a/image/read.blp b/image/read.blp new file mode 100644 index 0000000..0c7dae0 Binary files /dev/null and b/image/read.blp differ diff --git a/image/region.blp b/image/region.blp new file mode 100644 index 0000000..39ed940 Binary files /dev/null and b/image/region.blp differ diff --git a/image/setup.blp b/image/setup.blp new file mode 100644 index 0000000..94842e1 Binary files /dev/null and b/image/setup.blp differ diff --git a/image/stop000.blp b/image/stop000.blp new file mode 100644 index 0000000..8fc4009 Binary files /dev/null and b/image/stop000.blp differ diff --git a/image/stop001.blp b/image/stop001.blp new file mode 100644 index 0000000..f41778a Binary files /dev/null and b/image/stop001.blp differ diff --git a/image/stop002.blp b/image/stop002.blp new file mode 100644 index 0000000..fecb864 Binary files /dev/null and b/image/stop002.blp differ diff --git a/image/term.blp b/image/term.blp new file mode 100644 index 0000000..6ba6beb Binary files /dev/null and b/image/term.blp differ diff --git a/image/text.blp b/image/text.blp new file mode 100644 index 0000000..b5f19bc Binary files /dev/null and b/image/text.blp differ diff --git a/image/win.blp b/image/win.blp new file mode 100644 index 0000000..70218f2 Binary files /dev/null and b/image/win.blp differ diff --git a/image/write.blp b/image/write.blp new file mode 100644 index 0000000..9e8f757 Binary files /dev/null and b/image/write.blp differ diff --git a/jauge.cpp b/jauge.cpp new file mode 100644 index 0000000..d3aa7d4 --- /dev/null +++ b/jauge.cpp @@ -0,0 +1,153 @@ +// Jauge.cpp +// + +#include +#include +#include +#include +#include "def.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "jauge.h" +#include "misc.h" + + + +///////////////////////////////////////////////////////////////////////////// + +// Constructeur. + +CJauge::CJauge() +{ + m_type = 0; + m_bHide = TRUE; + m_bMinimizeRedraw = FALSE; + m_bRedraw = FALSE; +} + +// Destructeur. + +CJauge::~CJauge() +{ +} + + +// Crée un nouveau bouton. + +BOOL CJauge::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int type, BOOL bMinimizeRedraw) +{ + m_hWnd = hWnd; + m_pPixmap = pPixmap; + m_pSound = pSound; + m_type = type; + m_bMinimizeRedraw = bMinimizeRedraw; + m_bHide = TRUE; + m_pos = pos; + m_dim.x = DIMJAUGEX; + m_dim.y = DIMJAUGEY; + m_level = 0; + m_bRedraw = TRUE; + + return TRUE; +} + +// Dessine un bouton dans son état. + +void CJauge::Draw() +{ + int part; + RECT rect; + + if ( m_bMinimizeRedraw && !m_bRedraw ) return; + m_bRedraw = FALSE; + + if ( m_bHide ) // bouton caché ? + { + rect.left = m_pos.x; + rect.right = m_pos.x+m_dim.x; + rect.top = m_pos.y; + rect.bottom = m_pos.y+m_dim.y; + m_pPixmap->DrawPart(-1, CHBACK, m_pos, rect, 1); // dessine le fond + return; + } + + part = (m_level*(DIMJAUGEX-6-4))/100; + + rect.left = 0; + rect.right = DIMJAUGEX; + rect.top = DIMJAUGEY*0; + rect.bottom = DIMJAUGEY*1; + m_pPixmap->DrawPart(-1, CHJAUGE, m_pos, rect); // partie noire + + if ( part > 0 ) + { + rect.left = 0; + rect.right = 6+part; + rect.top = DIMJAUGEY*m_type; + rect.bottom = DIMJAUGEY*(m_type+1); + m_pPixmap->DrawPart(-1, CHJAUGE, m_pos, rect); // partie colorée + } +} + +// Redessine une jauge. + +void CJauge::Redraw() +{ + m_bRedraw = TRUE; +} + +// Modifie le niveau. + +void CJauge::SetLevel(int level) +{ + if ( level < 0 ) level = 0; + if ( level > 100 ) level = 100; + + if ( m_level != level ) + { + m_bRedraw = TRUE; + } + + m_level = level; +} + +// Modifie le type. + +void CJauge::SetType(int type) +{ + if ( m_type != type ) + { + m_bRedraw = TRUE; + } + + m_type = type; +} + + +BOOL CJauge::GetHide() +{ + return m_bHide; +} + +void CJauge::SetHide(BOOL bHide) +{ + if ( m_bHide != bHide ) + { + m_bRedraw = TRUE; + } + + m_bHide = bHide; +} + +POINT CJauge::GetPos() +{ + return m_pos; +} + +void CJauge::SetRedraw() +{ + m_bRedraw = TRUE; +} + diff --git a/jauge.h b/jauge.h new file mode 100644 index 0000000..e56d564 --- /dev/null +++ b/jauge.h @@ -0,0 +1,41 @@ +// Jauge.h + + + +///////////////////////////////////////////////////////////////////////////// + +class CJauge +{ +public: + CJauge(); + ~CJauge(); + + BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int type, BOOL bMinimizeRedraw); + void Draw(); + void Redraw(); + + void SetLevel(int level); + void SetType(int type); + + BOOL GetHide(); + void SetHide(BOOL bHide); + + POINT GetPos(); + void SetRedraw(); + +protected: + HWND m_hWnd; + CPixmap* m_pPixmap; + CDecor* m_pDecor; + CSound* m_pSound; + BOOL m_bHide; // TRUE si bouton caché + POINT m_pos; // coin sup/gauche + POINT m_dim; // dimensions + int m_type; + int m_level; + BOOL m_bMinimizeRedraw; + BOOL m_bRedraw; // TRUE -> doit être redessiné +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/map.cur b/map.cur new file mode 100644 index 0000000..e270c4d Binary files /dev/null and b/map.cur differ diff --git a/menu.cpp b/menu.cpp new file mode 100644 index 0000000..7c9e691 --- /dev/null +++ b/menu.cpp @@ -0,0 +1,439 @@ +// Menu.cpp +// + +#include +#include +#include +#include +#include "def.h" +#include "resource.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "button.h" +#include "menu.h" +#include "text.h" +#include "misc.h" + + +///////////////////////////////////////////////////////////////////////////// + + +#define MARGMENU 0 + + +static short table_button_icon[] = +{ + 24, // go + 40, // stop + 32, // mange + 30, // carry + 31, // depose + 22, // abat + 27, // roc + 28, // cultive + 19, // build1 (cabane) + 25, // build2 (couveuse) + 35, // build3 (laboratoire) + 61, // build4 (mine) + 59, // build5 (usine) + 101, // build6 (téléporteur) + 20, // mur + 26, // palis + 42, // abat n + 43, // roc n + 23, // pont + 33, // tour + 34, // boit + 39, // labo + 54, // fleur + 55, // fleur n + 41, // dynamite + 58, // bateau + 60, // djeep + 64, // drapeau + 62, // extrait du fer + 65, // fabrique jeep + 63, // fabrique mine + 83, // fabrique disciple + 100, // repeat + 107, // qarmure + 106, // fabarmure +}; + +void GetText(int rank, char *pBuffer, int lgBuffer) +{ + LoadString(TX_ACTION_GO+rank, pBuffer, lgBuffer); +} + +void GetErr(int rank, char *pBuffer, int lgBuffer) +{ + LoadString(TX_ERROR_MISC+rank, pBuffer, lgBuffer); +} + + +///////////////////////////////////////////////////////////////////////////// + +// Constructeur. + +CMenu::CMenu() +{ + m_nbButtons = 0; + m_selRank = -1; +} + +// Destructeur. + +CMenu::~CMenu() +{ +} + + +// Crée un nouveau bouton. + +BOOL CMenu::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int nb, int *pButtons, int *pErrors, + int perso) +{ + pos.x -= DIMBUTTONX/2; + pos.y -= DIMBUTTONY/2; + + m_hWnd = hWnd; + m_pPixmap = pPixmap; + m_pSound = pSound; + m_nbButtons = nb; + m_pos = pos; + m_perso = perso; + + Update(nb, pButtons, pErrors); + + if ( m_pos.x < POSDRAWX ) m_pos.x = POSDRAWX; + if ( m_pos.y < POSDRAWY ) m_pos.y = POSDRAWY; + + if ( m_pos.x > POSDRAWX+DIMDRAWX-2-m_dim.x ) m_pos.x = POSDRAWX+DIMDRAWX-2-m_dim.x; + if ( m_pos.y > POSDRAWY+DIMDRAWY-2-m_dim.y ) m_pos.y = POSDRAWY+DIMDRAWY-2-m_dim.y; + + if ( m_pos.x != pos.x || m_pos.y != pos.y ) + { + pos = m_pos; + pos.x += DIMBUTTONX/2; + pos.y += DIMBUTTONY/2; + ClientToScreen(m_hWnd, &pos); + SetCursorPos(pos.x, pos.y); + } + + m_selRank = Detect(pos); + + return TRUE; +} + +// Met à jour le menu. + +void CMenu::Update(int nb, int *pButtons, int *pErrors) +{ + int i; + + m_nbButtons = nb; + + if ( nb < 5 ) m_nbCel.x = 1; + else m_nbCel.x = 2; + + m_nbCel.y = (nb+m_nbCel.x-1)/m_nbCel.x; + + m_dim.x = (DIMBUTTONX+MARGMENU)*m_nbCel.x; + m_dim.y = (DIMBUTTONY+MARGMENU)*m_nbCel.y; + + for ( i=0 ; iGetClipping(); + clipRect.left = POSDRAWX; + clipRect.top = POSDRAWY; + clipRect.right = POSDRAWX+DIMDRAWX; + clipRect.bottom = POSDRAWY+DIMDRAWY; + m_pPixmap->SetClipping(clipRect); + + if ( m_pos.x-150 < POSDRAWX ) bLeft = FALSE; + if ( m_pos.x+m_dim.x+150 > POSDRAWX+DIMDRAWX ) bRight = FALSE; + + for ( i=0 ; iDrawIcon(-1, CHBUTTON, state, pos); + + icon = table_button_icon[m_buttons[i]]; + if ( m_perso == 8 ) // disciple ? + { + if ( icon == 30 ) icon = 88; // prend + if ( icon == 31 ) icon = 89; // dépose + } + m_pPixmap->DrawIcon(-1, CHBUTTON, icon+6, pos); + } + + // Affiche le texte d'aide. + if ( m_selRank != -1 ) + { + i = m_selRank; + pos.y = m_pos.y+((i%m_nbCel.y)*(DIMBUTTONY+MARGMENU)); + + if ( m_errors[i] == 0 ) + { + pos.y += (DIMBUTTONY-DIMTEXTY)/2; + } + else + { + pos.y += (DIMBUTTONY-DIMTEXTY*2)/2; + } + + if ( m_errors[i] >= 100 ) // no ressource au lieu erreur ? + { + LoadString(m_errors[i], text, 50); + pText = strchr(text, '\n'); + if ( pText != NULL ) *pText = 0; + } + else + { + GetText(m_buttons[i], text, 50); + } + + if ( m_nbCel.x > 1 && i < m_nbCel.y ) + { +// if ( bLeft ) +// { + pos.x = m_pos.x-4-GetTextWidth(text); // texte à gauche +// } +// else +// { +// pos.x = m_pos.x+((i/m_nbCel.y)+1)+(DIMBUTTONX+MARGMENU)+4; +// } + } + else + { +// if ( bRight ) +// { + pos.x = m_pos.x+m_dim.x+4; // texte à droite +// } +// else +// { +// pos.x = m_pos.x+(i/m_nbCel.y)*(DIMBUTTONX+MARGMENU)-4-GetTextWidth(text); +// } + } + + DrawText(m_pPixmap, pos, text, FONTWHITE); + + if ( m_errors[i] != 0 ) + { + if ( m_errors[i] >= 100 ) // no ressource au lieu erreur ? + { + LoadString(m_errors[i], text, 50); + pText = strchr(text, '\n'); + if ( pText != NULL ) strcpy(text, pText+1); + } + else + { + GetErr(m_errors[i]-1, text, 50); // impossible ici + } + + if ( m_nbCel.x > 1 && i < m_nbCel.y ) + { +// if ( bLeft ) +// { + pos.x = m_pos.x-4-GetTextWidth(text); // texte à gauche +// } +// else +// { +// pos.x = m_pos.x+((i/m_nbCel.y)+1)+(DIMBUTTONX+MARGMENU)+4; +// } + } + else + { +// if ( bRight ) +// { + pos.x = m_pos.x+m_dim.x+4; // texte à droite +// } +// else +// { +// pos.x = m_pos.x+(i/m_nbCel.y)*(DIMBUTTONX+MARGMENU)-4-GetTextWidth(text); +// } + } + + pos.y += DIMTEXTY; + if ( m_errors[i] >= 100 ) // no ressource au lieu erreur ? + { + DrawText(m_pPixmap, pos, text, FONTWHITE); + } + else + { + DrawText(m_pPixmap, pos, text, FONTRED); + } + } + } + + m_pPixmap->SetClipping(oldClip); +} + +// Retourne le bouton sélectionné. + +int CMenu::GetSel() +{ + if ( m_selRank == -1 ) return -1; + + return m_buttons[m_selRank]; +} + +// Retourne le rang sélectionné. + +int CMenu::GetRank() +{ + return m_selRank; +} + +// Retourne TRUE si le bouton sélectionné a une erreur. + +BOOL CMenu::IsError() +{ + if ( m_selRank == -1 ) return TRUE; + + if ( m_errors[m_selRank] != 0 && + m_errors[m_selRank] < 100 ) return TRUE; + + return FALSE; +} + + +// Indique si le menu existe. + +BOOL CMenu::IsExist() +{ + return ( m_nbButtons == 0 ) ? FALSE:TRUE; +} + + +// Traitement d'un événement. + +BOOL CMenu::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam) +{ + POINT pos; + + if ( m_nbButtons == 0 ) return FALSE; + + pos = ConvLongToPos(lParam); + + switch( message ) + { + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + if ( MouseDown(pos) ) return TRUE; + break; + + case WM_MOUSEMOVE: + if ( MouseMove(pos) ) return TRUE; + break; + + case WM_LBUTTONUP: + case WM_RBUTTONUP: + if ( MouseUp(pos) ) return TRUE; + break; + } + + return FALSE; +} + +// Détecte dans quel bouton est la souris. + +int CMenu::Detect(POINT pos) +{ + int rank; + + if ( pos.x < m_pos.x || pos.x > m_pos.x+m_dim.x || + pos.y < m_pos.y || pos.y > m_pos.y+m_dim.y ) return -1; + + rank = (pos.y-m_pos.y)/(DIMBUTTONY+MARGMENU); + rank += ((pos.x-m_pos.x)/(DIMBUTTONX+MARGMENU))*m_nbCel.y; + + if ( rank >= m_nbButtons ) return -1; + return rank; +} + +// Bouton de la souris pressé. + +BOOL CMenu::MouseDown(POINT pos) +{ + return FALSE; +} + +// Souris déplacés. + +BOOL CMenu::MouseMove(POINT pos) +{ + m_mousePos = pos; + m_selRank = Detect(pos); + + if ( pos.x < m_pos.x-(DIMBUTTONX+MARGMENU) || + pos.x > m_pos.x+m_dim.x+(DIMBUTTONX+MARGMENU) || + pos.y < m_pos.y-(DIMBUTTONY+MARGMENU) || + pos.y > m_pos.y+m_dim.y+(DIMBUTTONY+MARGMENU) ) + { + Delete(); // enlève le menu si souris trop loin ! + } + + return FALSE; +} + +// Bouton de la souris relâché. + +BOOL CMenu::MouseUp(POINT pos) +{ + m_mousePos = pos; + m_selRank = Detect(pos); + + return FALSE; +} + +// Envoie le message. + +void CMenu::Message() +{ + if ( m_selRank != -1 ) + { + PostMessage(m_hWnd, WM_BUTTON0+m_selRank, 0, 0); + } +} + + diff --git a/menu.h b/menu.h new file mode 100644 index 0000000..1f098b6 --- /dev/null +++ b/menu.h @@ -0,0 +1,50 @@ +// Menu.h + + + +///////////////////////////////////////////////////////////////////////////// + +class CMenu +{ +public: + CMenu(); + ~CMenu(); + + BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int nb, int *pButtons, int *pErrors, + int perso); + void Update(int nb, int *pButtons, int *pErrors); + void Delete(); + void Draw(); + int GetSel(); + int GetRank(); + BOOL IsError(); + BOOL IsExist(); + void Message(); + + BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); + +protected: + int Detect(POINT pos); + BOOL MouseDown(POINT pos); + BOOL MouseMove(POINT pos); + BOOL MouseUp(POINT pos); + +protected: + HWND m_hWnd; + CPixmap* m_pPixmap; + CDecor* m_pDecor; + CSound* m_pSound; + POINT m_pos; // coin sup/gauche + POINT m_dim; // dimensions + int m_nbButtons; + POINT m_nbCel; + int m_perso; + int m_buttons[MAXBUTTON]; + int m_errors[MAXBUTTON]; + UINT m_messages[MAXBUTTON]; + int m_selRank; + POINT m_mousePos; +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/misc.cpp b/misc.cpp new file mode 100644 index 0000000..a32dad2 --- /dev/null +++ b/misc.cpp @@ -0,0 +1,398 @@ +// misc.cpp +// + + +#include +#include +#include +#include +#include "def.h" + + +// Variables globales + +HINSTANCE g_hInstance; +int g_lastSprite = 0; +extern BOOL g_bFullScreen; // FALSE si mode de test +extern int g_mouseType; +extern char g_CDPath[MAX_PATH]; + + + +// Initialise HInstance. + +void InitHInstance(HINSTANCE hInstance) +{ + g_hInstance = hInstance; +} + + +// Affiche un message de debug. + +void OutputDebug(char *pMessage) +{ +#ifdef _DEBUG + OutputDebugString(pMessage); +#endif +} + + +// Charge un texte dans une ressource. + +void LoadString(UINT nID, char *pBuffer, int lgBuffer) +{ + LoadString(g_hInstance, nID, pBuffer, lgBuffer); +} + +// Change le lutin de la souris. + +void ChangeSprite(int sprite) +{ + HCURSOR hCursor = nullptr; + + if ( g_mouseType == MOUSETYPEGRA ) return; + if ( g_lastSprite == sprite ) return; + + if ( sprite == SPRITE_ARROW ) hCursor = LoadCursor(g_hInstance, "IDC_ARROW"); + if ( sprite == SPRITE_POINTER ) hCursor = LoadCursor(g_hInstance, "IDC_POINTER"); + if ( sprite == SPRITE_MAP ) hCursor = LoadCursor(g_hInstance, "IDC_MAP"); + if ( sprite == SPRITE_ARROWU ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWU"); + if ( sprite == SPRITE_ARROWD ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWD"); + if ( sprite == SPRITE_ARROWL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWL"); + if ( sprite == SPRITE_ARROWR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWR"); + if ( sprite == SPRITE_ARROWUL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWUL"); + if ( sprite == SPRITE_ARROWUR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWUR"); + if ( sprite == SPRITE_ARROWDL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWDL"); + if ( sprite == SPRITE_ARROWDR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWDR"); + if ( sprite == SPRITE_WAIT ) hCursor = LoadCursor(g_hInstance, "IDC_WAIT"); + if ( sprite == SPRITE_EMPTY ) hCursor = LoadCursor(g_hInstance, "IDC_EMPTY"); + if ( sprite == SPRITE_FILL ) hCursor = LoadCursor(g_hInstance, "IDC_FILL"); + SetCursor(hCursor); + + g_lastSprite = sprite; +} + + +// Conversion de la position de la souris. + +POINT ConvLongToPos(LPARAM lParam) +{ + POINT pos; + + pos.x = LOWORD(lParam); // horizontal position of cursor + pos.y = HIWORD(lParam); // vertical position of cursor + +// if ( !g_bFullScreen ) +// { +// pos.y -= GetSystemMetrics(SM_CYCAPTION); +// } + + return pos; +} + + +// Réinitialise le générateur aléatoire. + +void InitRandom() +{ + srand(1); +} + +// Retourne un nombre aléatoire compris entre +// deux bornes (inclues). + +int Random(int min, int max) +{ + long n; + + n = rand(); + n = min+(n%(max-min+1)); + + return (int)n; +} + + +// Retourne le nom de dossier en cours. + +void GetCurrentDir(char *pName, int lg) +{ + int i; + + strncpy(pName, _pgmptr, lg-1); + pName[lg-1] = 0; + + lg = strlen(pName); + if ( lg == 0 ) return; + + for ( i=0 ; i 0 ) + { + lg --; + if ( pName[lg] == '\\' ) + { + pName[lg+1] = 0; + break; + } + } + + if ( lg > 6 && strcmp(pName+lg-6, "\\debug\\") == 0 ) + { + pName[lg-5] = 0; // ignore le dossier \debug ! + } +} + + +// Ajoute le chemin permettant de lire un fichier +// sur le CD-Rom. + +void AddCDPath(char *pFilename) +{ + char temp[MAX_PATH]; + int lg; + BOOL bDaniel = FALSE; + + if ( g_CDPath[0] == 0 ) return; + + lg = strlen(g_CDPath); + if ( lg > 14 && strstr(g_CDPath+lg-14, "\\daniel\\blupi\\") ) + { + bDaniel = TRUE; + } + +#if _DEMO + strcpy(temp, g_CDPath); + strcat(temp, pFilename); +#else + if ( !bDaniel && + (strstr(pFilename, "image\\") == pFilename || + strstr(pFilename, "movie\\") == pFilename) ) + { + strcpy(temp, g_CDPath); + strcat(temp, "..\\"); + strcat(temp, pFilename); + } + else + { + strcpy(temp, g_CDPath); + strcat(temp, pFilename); + } +#endif + + strcpy(pFilename, temp); +} + +// Ajoute le chemin permettant de lire un fichier +// utilisateur. + +void AddUserPath(char *pFilename) +{ + char temp[MAX_PATH]; + char* pText; + int pos; + char last; + SECURITY_ATTRIBUTES att; + + if ( g_CDPath[0] != 0 ) return; + +#if _EGAMES + strcpy(temp, "c:\\Planet Blupi Full\\"); +#if _DEMO + strcpy(temp, "c:\\Planet Blupi Demo\\"); +#endif +#if _SE + strcpy(temp, "c:\\Planet Blupi SE\\"); +#endif +#else + strcpy(temp, "c:\\Planète Blupi\\"); +#endif + + att.nLength = sizeof(SECURITY_ATTRIBUTES); + att.lpSecurityDescriptor = NULL; + att.bInheritHandle = FALSE; + CreateDirectory(temp, &att); + + pText = strstr(pFilename, "\\"); + if ( pText != NULL ) + { + pos = strlen(temp)+(pText-pFilename)+1; + strcat(temp, pFilename); + last = temp[pos]; + temp[pos] = 0; + CreateDirectory(temp, &att); + temp[pos] = last; + } + else + { + strcat(temp, pFilename); + } + + strcpy(pFilename, temp); +} + + + +//---------------------------------------------------------------------- +// +// Function : TraceErrorDD() +// +// Purpose : Traces an error (DirectDraw) +// +//---------------------------------------------------------------------- + +void TraceErrorDD(HRESULT hErr, char *sFile, int nLine) +{ + char dderr[256]; + char err[1024]; + + switch (hErr) + { + case DD_OK : sprintf(dderr, "DD_OK"); break; + case DDERR_ALREADYINITIALIZED : sprintf(dderr, "DDERR_ALREADYINITIALIZED"); break; + case DDERR_CANNOTATTACHSURFACE : sprintf(dderr, "DDERR_CANNOTATTACHSURFACE"); break; + case DDERR_CANNOTDETACHSURFACE : sprintf(dderr, "DDERR_CANNOTDETACHSURFACE"); break; + case DDERR_CURRENTLYNOTAVAIL : sprintf(dderr, "DDERR_CURRENTLYNOTAVAIL"); break; + case DDERR_EXCEPTION : sprintf(dderr, "DDERR_EXCEPTION"); break; + case DDERR_GENERIC : sprintf(dderr, "DDERR_GENERIC"); break; + case DDERR_HEIGHTALIGN : sprintf(dderr, "DDERR_HEIGHTALIGN"); break; + case DDERR_INCOMPATIBLEPRIMARY : sprintf(dderr, "DDERR_INCOMPATIBLEPRIMARY"); break; + case DDERR_INVALIDCAPS : sprintf(dderr, "DDERR_INVALIDCAPS"); break; + case DDERR_INVALIDCLIPLIST : sprintf(dderr, "DDERR_INVALIDCLIPLIST"); break; + case DDERR_INVALIDMODE : sprintf(dderr, "DDERR_INVALIDMODE"); break; + case DDERR_INVALIDOBJECT : sprintf(dderr, "DDERR_INVALIDOBJECT"); break; + case DDERR_INVALIDPARAMS : sprintf(dderr, "DDERR_INVALIDPARAMS"); break; + case DDERR_INVALIDPIXELFORMAT : sprintf(dderr, "DDERR_INVALIDPIXELFORMAT"); break; + case DDERR_INVALIDRECT : sprintf(dderr, "DDERR_INVALIDRECT"); break; + case DDERR_LOCKEDSURFACES : sprintf(dderr, "DDERR_LOCKEDSURFACES"); break; + case DDERR_NO3D : sprintf(dderr, "DDERR_NO3D"); break; + case DDERR_NOALPHAHW : sprintf(dderr, "DDERR_NOALPHAHW"); break; + case DDERR_NOCLIPLIST : sprintf(dderr, "DDERR_NOCLIPLIST"); break; + case DDERR_NOCOLORCONVHW : sprintf(dderr, "DDERR_NOCOLORCONVHW"); break; + case DDERR_NOCOOPERATIVELEVELSET : sprintf(dderr, "DDERR_NOCOOPERATIVELEVELSET"); break; + case DDERR_NOCOLORKEY : sprintf(dderr, "DDERR_NOCOLORKEY"); break; + case DDERR_NOCOLORKEYHW : sprintf(dderr, "DDERR_NOCOLORKEYHW"); break; + case DDERR_NODIRECTDRAWSUPPORT : sprintf(dderr, "DDERR_NODIRECTDRAWSUPPORT"); break; + case DDERR_NOEXCLUSIVEMODE : sprintf(dderr, "DDERR_NOEXCLUSIVEMODE"); break; + case DDERR_NOFLIPHW : sprintf(dderr, "DDERR_NOFLIPHW"); break; + case DDERR_NOGDI : sprintf(dderr, "DDERR_NOGDI"); break; + case DDERR_NOMIRRORHW : sprintf(dderr, "DDERR_NOMIRRORHW"); break; + case DDERR_NOTFOUND : sprintf(dderr, "DDERR_NOTFOUND"); break; + case DDERR_NOOVERLAYHW : sprintf(dderr, "DDERR_NOOVERLAYHW"); break; + case DDERR_NORASTEROPHW : sprintf(dderr, "DDERR_NORASTEROPHW"); break; + case DDERR_NOROTATIONHW : sprintf(dderr, "DDERR_NOROTATIONHW"); break; + case DDERR_NOSTRETCHHW : sprintf(dderr, "DDERR_NOSTRETCHHW"); break; + case DDERR_NOT4BITCOLOR : sprintf(dderr, "DDERR_NOT4BITCOLOR"); break; + case DDERR_NOT4BITCOLORINDEX : sprintf(dderr, "DDERR_NOT4BITCOLORINDEX"); break; + case DDERR_NOT8BITCOLOR : sprintf(dderr, "DDERR_NOT8BITCOLOR"); break; + case DDERR_NOTEXTUREHW : sprintf(dderr, "DDERR_NOTEXTUREHW"); break; + case DDERR_NOVSYNCHW : sprintf(dderr, "DDERR_NOVSYNCHW"); break; + case DDERR_NOZBUFFERHW : sprintf(dderr, "DDERR_NOZBUFFERHW"); break; + case DDERR_NOZOVERLAYHW : sprintf(dderr, "DDERR_NOZOVERLAYHW"); break; + case DDERR_OUTOFCAPS : sprintf(dderr, "DDERR_OUTOFCAPS"); break; + case DDERR_OUTOFMEMORY : sprintf(dderr, "DDERR_OUTOFMEMORY"); break; + case DDERR_OUTOFVIDEOMEMORY : sprintf(dderr, "DDERR_OUTOFVIDEOMEMORY"); break; + case DDERR_OVERLAYCANTCLIP : sprintf(dderr, "DDERR_OVERLAYCANTCLIP"); break; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE : sprintf(dderr, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"); break; + case DDERR_PALETTEBUSY : sprintf(dderr, "DDERR_PALETTEBUSY"); break; + case DDERR_COLORKEYNOTSET : sprintf(dderr, "DDERR_COLORKEYNOTSET"); break; + case DDERR_SURFACEALREADYATTACHED : sprintf(dderr, "DDERR_SURFACEALREADYATTACHED"); break; + case DDERR_SURFACEALREADYDEPENDENT : sprintf(dderr, "DDERR_SURFACEALREADYDEPENDENT"); break; + case DDERR_SURFACEBUSY : sprintf(dderr, "DDERR_SURFACEBUSY"); break; + case DDERR_CANTLOCKSURFACE : sprintf(dderr, "DDERR_CANTLOCKSURFACE"); break; + case DDERR_SURFACEISOBSCURED : sprintf(dderr, "DDERR_SURFACEISOBSCURED"); break; + case DDERR_SURFACELOST : sprintf(dderr, "DDERR_SURFACELOST"); break; + case DDERR_SURFACENOTATTACHED : sprintf(dderr, "DDERR_SURFACENOTATTACHED"); break; + case DDERR_TOOBIGHEIGHT : sprintf(dderr, "DDERR_TOOBIGHEIGHT"); break; + case DDERR_TOOBIGSIZE : sprintf(dderr, "DDERR_TOOBIGSIZE"); break; + case DDERR_TOOBIGWIDTH : sprintf(dderr, "DDERR_TOOBIGWIDTH"); break; + case DDERR_UNSUPPORTED : sprintf(dderr, "DDERR_UNSUPPORTED"); break; + case DDERR_UNSUPPORTEDFORMAT : sprintf(dderr, "DDERR_UNSUPPORTEDFORMAT"); break; + case DDERR_UNSUPPORTEDMASK : sprintf(dderr, "DDERR_UNSUPPORTEDMASK"); break; + case DDERR_VERTICALBLANKINPROGRESS : sprintf(dderr, "DDERR_VERTICALBLANKINPROGRESS"); break; + case DDERR_WASSTILLDRAWING : sprintf(dderr, "DDERR_WASSTILLDRAWING"); break; + case DDERR_XALIGN : sprintf(dderr, "DDERR_XALIGN"); break; + case DDERR_INVALIDDIRECTDRAWGUID : sprintf(dderr, "DDERR_INVALIDDIRECTDRAWGUID"); break; + case DDERR_DIRECTDRAWALREADYCREATED : sprintf(dderr, "DDERR_DIRECTDRAWALREADYCREATED"); break; + case DDERR_NODIRECTDRAWHW : sprintf(dderr, "DDERR_NODIRECTDRAWHW"); break; + case DDERR_PRIMARYSURFACEALREADYEXISTS : sprintf(dderr, "DDERR_PRIMARYSURFACEALREADYEXISTS"); break; + case DDERR_NOEMULATION : sprintf(dderr, "DDERR_NOEMULATION"); break; + case DDERR_REGIONTOOSMALL : sprintf(dderr, "DDERR_REGIONTOOSMALL"); break; + case DDERR_CLIPPERISUSINGHWND : sprintf(dderr, "DDERR_CLIPPERISUSINGHWND"); break; + case DDERR_NOCLIPPERATTACHED : sprintf(dderr, "DDERR_NOCLIPPERATTACHED"); break; + case DDERR_NOHWND : sprintf(dderr, "DDERR_NOHWND"); break; + case DDERR_HWNDSUBCLASSED : sprintf(dderr, "DDERR_HWNDSUBCLASSED"); break; + case DDERR_HWNDALREADYSET : sprintf(dderr, "DDERR_HWNDALREADYSET"); break; + case DDERR_NOPALETTEATTACHED : sprintf(dderr, "DDERR_NOPALETTEATTACHED"); break; + case DDERR_NOPALETTEHW : sprintf(dderr, "DDERR_NOPALETTEHW"); break; + case DDERR_BLTFASTCANTCLIP : sprintf(dderr, "DDERR_BLTFASTCANTCLIP"); break; + case DDERR_NOBLTHW : sprintf(dderr, "DDERR_NOBLTHW"); break; + case DDERR_NODDROPSHW : sprintf(dderr, "DDERR_NODDROPSHW"); break; + case DDERR_OVERLAYNOTVISIBLE : sprintf(dderr, "DDERR_OVERLAYNOTVISIBLE"); break; + case DDERR_NOOVERLAYDEST : sprintf(dderr, "DDERR_NOOVERLAYDEST"); break; + case DDERR_INVALIDPOSITION : sprintf(dderr, "DDERR_INVALIDPOSITION"); break; + case DDERR_NOTAOVERLAYSURFACE : sprintf(dderr, "DDERR_NOTAOVERLAYSURFACE"); break; + case DDERR_EXCLUSIVEMODEALREADYSET : sprintf(dderr, "DDERR_EXCLUSIVEMODEALREADYSET"); break; + case DDERR_NOTFLIPPABLE : sprintf(dderr, "DDERR_NOTFLIPPABLE"); break; + case DDERR_CANTDUPLICATE : sprintf(dderr, "DDERR_CANTDUPLICATE"); break; + case DDERR_NOTLOCKED : sprintf(dderr, "DDERR_NOTLOCKED"); break; + case DDERR_CANTCREATEDC : sprintf(dderr, "DDERR_CANTCREATEDC"); break; + case DDERR_NODC : sprintf(dderr, "DDERR_NODC"); break; + case DDERR_WRONGMODE : sprintf(dderr, "DDERR_WRONGMODE"); break; + case DDERR_IMPLICITLYCREATED : sprintf(dderr, "DDERR_IMPLICITLYCREATED"); break; + case DDERR_NOTPALETTIZED : sprintf(dderr, "DDERR_NOTPALETTIZED"); break; + case DDERR_UNSUPPORTEDMODE : sprintf(dderr, "DDERR_UNSUPPORTEDMODE"); break; + case DDERR_NOMIPMAPHW : sprintf(dderr, "DDERR_NOMIPMAPHW"); break; + case DDERR_INVALIDSURFACETYPE : sprintf(dderr, "DDERR_INVALIDSURFACETYPE"); break; + case DDERR_DCALREADYCREATED : sprintf(dderr, "DDERR_DCALREADYCREATED"); break; + case DDERR_CANTPAGELOCK : sprintf(dderr, "DDERR_CANTPAGELOCK"); break; + case DDERR_CANTPAGEUNLOCK : sprintf(dderr, "DDERR_CANTPAGEUNLOCK"); break; + case DDERR_NOTPAGELOCKED : sprintf(dderr, "DDERR_NOTPAGELOCKED"); break; + case DDERR_NOTINITIALIZED : sprintf(dderr, "DDERR_NOTINITIALIZED"); break; + + default : sprintf(dderr, "Unknown Error"); break; + } + sprintf(err, "DirectDraw Error %s in file %s at line %d\n", dderr, sFile, nLine); + OutputDebug(err); +} + +//---------------------------------------------------------------------- +// +// Function : TraceErrorDS() +// +// Purpose : Traces an error (DirectSound) +// +//---------------------------------------------------------------------- + +void TraceErrorDS(HRESULT hErr, char *sFile, int nLine) +{ + char dserr[256]; + char err[1024]; + + switch (hErr) + { + case DS_OK : sprintf(dserr, "DD_OK"); break; + case DSERR_ALLOCATED : sprintf(dserr, "DSERR_ALLOCATED"); break; + case DSERR_CONTROLUNAVAIL : sprintf(dserr, "DSERR_CONTROLUNAVAIL"); break; + case DSERR_INVALIDPARAM : sprintf(dserr, "DSERR_INVALIDPARAM"); break; + case DSERR_INVALIDCALL : sprintf(dserr, "DSERR_INVALIDCALL"); break; + case DSERR_GENERIC : sprintf(dserr, "DSERR_GENERIC"); break; + case DSERR_PRIOLEVELNEEDED : sprintf(dserr, "DSERR_PRIOLEVELNEEDED"); break; + case DSERR_OUTOFMEMORY : sprintf(dserr, "DSERR_OUTOFMEMORY"); break; + case DSERR_BADFORMAT : sprintf(dserr, "DSERR_BADFORMAT"); break; + case DSERR_UNSUPPORTED : sprintf(dserr, "DSERR_UNSUPPORTED"); break; + case DSERR_NODRIVER : sprintf(dserr, "DSERR_NODRIVER"); break; + case DSERR_ALREADYINITIALIZED : sprintf(dserr, "DSERR_ALREADYINITIALIZED"); break; + case DSERR_NOAGGREGATION : sprintf(dserr, "DSERR_NOAGGREGATION"); break; + case DSERR_BUFFERLOST : sprintf(dserr, "DSERR_BUFFERLOST"); break; + case DSERR_OTHERAPPHASPRIO : sprintf(dserr, "DSERR_OTHERAPPHASPRIO"); break; + case DSERR_UNINITIALIZED : sprintf(dserr, "DSERR_UNINITIALIZED"); break; + + default : sprintf(dserr, "Unknown Error"); break; + } + sprintf(err, "DirectSound Error %s in file %s at line %d\n", dserr, sFile, nLine); + OutputDebug(err); +} + diff --git a/misc.h b/misc.h new file mode 100644 index 0000000..cf97515 --- /dev/null +++ b/misc.h @@ -0,0 +1,20 @@ +// misc.h +// + +extern void InitHInstance(HINSTANCE hInstance); +extern void OutputDebug(char *pMessage); +extern void LoadString(UINT nID, char *pBuffer, int lgBuffer); +extern void ChangeSprite(int sprite); + +extern POINT ConvLongToPos(LPARAM lParam); + +extern void InitRandom(); +extern int Random(int min, int max); + +extern void GetCurrentDir(char *pName, int lg); +extern void AddCDPath(char *pFilename); +extern void AddUserPath(char *pFilename); + +extern void TraceErrorDD(HRESULT hErr, char *sFile, int nLine); +extern void TraceErrorDS(HRESULT hErr, char *sFile, int nLine); + diff --git a/movie.cpp b/movie.cpp new file mode 100644 index 0000000..ff753f6 --- /dev/null +++ b/movie.cpp @@ -0,0 +1,298 @@ +// movie.cpp +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "def.h" +#include "movie.h" +#include "misc.h" + + +//---------------------------------------------------------------------------- + +#define AVI_VIDEO "avivideo" + +#define IDM_PLAY 10 +#define IDM_RPLAY 11 + +//---------------------------------------------------------------------------- + +// Initialize avi libraries. + +BOOL CMovie::initAVI() +{ + MCI_DGV_OPEN_PARMS mciOpen; + + // set up the open parameters + mciOpen.dwCallback = 0L; + mciOpen.wDeviceID = 0; + mciOpen.lpstrDeviceType = AVI_VIDEO; + mciOpen.lpstrElementName = NULL; + mciOpen.lpstrAlias = NULL; + mciOpen.dwStyle = 0; + mciOpen.hWndParent = NULL; + + // try to open the driver + return (mciSendCommand(0, MCI_OPEN, (DWORD)(MCI_OPEN_TYPE), + (DWORD)(LPMCI_DGV_OPEN_PARMS)&mciOpen) == 0); +} + +// Closes the opened AVI file and the opened device type. | + +void CMovie::termAVI() +{ + MCIDEVICEID mciID; + MCI_GENERIC_PARMS mciClose; + + // Get the device ID for the opened device type and then close + // the device type. + mciID = mciGetDeviceID(AVI_VIDEO); + mciSendCommand(mciID, MCI_CLOSE, 0L, + (DWORD)(LPMCI_GENERIC_PARMS)&mciClose); +} + + +// Sets the movie rectange to be +// centered within the app's window. + +void CMovie::positionMovie(HWND hWnd, RECT rect) +{ + // reposition the playback (child) window + MoveWindow(m_hwndMovie, + rect.left, rect.top, + rect.right, rect.bottom, TRUE); +} + +// Close the movie and anything associated with it. | +// This function clears the and flags | + +void CMovie::fileCloseMovie(HWND hWnd) +{ + MCI_GENERIC_PARMS mciGeneric; + + mciSendCommand(m_wMCIDeviceID, MCI_CLOSE, 0L, + (DWORD)(LPMCI_GENERIC_PARMS)&mciGeneric); + + m_fPlaying = FALSE; // can't be playing any longer + m_fMovieOpen = FALSE; // no more movies open + + // cause a total repaint to occur + InvalidateRect(hWnd, NULL, TRUE); + UpdateWindow(hWnd); +} + + +// Open an AVI movie. Use CommDlg open box to +// open and then handle the initialization to +// show the movie and position it properly. Keep +// the movie paused when opened. +// Sets on success. + +BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename) +{ + MCI_DGV_OPEN_PARMS mciOpen; + MCI_DGV_WINDOW_PARMS mciWindow; + MCI_DGV_STATUS_PARMS mciStatus; + char string[MAX_PATH]; + + if ( pFilename[1] == ':' ) // nom complet "D:\REP..." ? + { + strcpy(string, pFilename); + } + else + { + GetCurrentDir(string, MAX_PATH-30); + strcat(string, pFilename); + } + + // we got a filename, now close any old movie and open the new one. */ + if ( m_fMovieOpen ) fileCloseMovie(hWnd); + + // we have a .AVI movie to open, use MCI + // set up the open parameters + mciOpen.dwCallback = 0L; + mciOpen.wDeviceID = 0; + mciOpen.lpstrDeviceType = NULL; + mciOpen.lpstrElementName = string; + mciOpen.lpstrAlias = NULL; + mciOpen.dwStyle = WS_CHILD; + mciOpen.hWndParent = hWnd; + + // try to open the file + if ( mciSendCommand(0, MCI_OPEN, + (DWORD)(MCI_OPEN_ELEMENT|MCI_DGV_OPEN_PARENT|MCI_DGV_OPEN_WS), + (DWORD)(LPMCI_DGV_OPEN_PARMS)&mciOpen) == 0 ) + { + // we opened the file o.k., now set up to play it. + m_wMCIDeviceID = mciOpen.wDeviceID; // save ID + m_fMovieOpen = TRUE; // a movie was opened + + // show the playback window + mciWindow.dwCallback = 0L; + mciWindow.hWnd = NULL; + mciWindow.nCmdShow = SW_SHOW; + mciWindow.lpstrText = (LPSTR)NULL; +// mciSendCommand(m_wMCIDeviceID, MCI_WINDOW, +// MCI_DGV_WINDOW_STATE, +// (DWORD)(LPMCI_DGV_WINDOW_PARMS)&mciWindow); + + // get the window handle + mciStatus.dwItem = MCI_DGV_STATUS_HWND; + mciSendCommand(m_wMCIDeviceID, + MCI_STATUS, MCI_STATUS_ITEM, + (DWORD)(LPMCI_STATUS_PARMS)&mciStatus); + m_hwndMovie = (HWND)mciStatus.dwReturn; + + // now get the movie centered + positionMovie(hWnd, rect); + + // cause an update to occur + InvalidateRect(hWnd, NULL, FALSE); + UpdateWindow(hWnd); + + return TRUE; + } + else + { + // generic error for open + m_fMovieOpen = FALSE; + + return FALSE; + } +} + +// Play/pause the movie depending on the state +// of the flag. | +// This function sets the flag appropriately when done| + +void CMovie::playMovie(HWND hWnd, int nDirection) +{ + m_fPlaying = !m_fPlaying; // swap the play flag + + if( !nDirection ) + m_fPlaying = FALSE; // wDirection == NULL means PAUSE + + // play/pause the AVI movie + if ( m_fPlaying ) + { + DWORD dwFlags; + MCI_DGV_PLAY_PARMS mciPlay; + + // init to play all + mciPlay.dwCallback = MAKELONG(hWnd,0); + mciPlay.dwFrom = mciPlay.dwTo = 0; + dwFlags = MCI_NOTIFY; + if ( nDirection == IDM_RPLAY ) + dwFlags |= MCI_DGV_PLAY_REVERSE; + + mciSendCommand(m_wMCIDeviceID, MCI_PLAY, dwFlags, + (DWORD)(LPMCI_DGV_PLAY_PARMS)&mciPlay); + } + else + { + MCI_DGV_PAUSE_PARMS mciPause; + + // tell it to pause + mciSendCommand(m_wMCIDeviceID,MCI_PAUSE,0L, + (DWORD)(LPMCI_DGV_PAUSE_PARMS)&mciPause); + } +} + + +//---------------------------------------------------------------------------- + + +// Constructeur. + +CMovie::CMovie() +{ + m_bEnable = FALSE; + m_wMCIDeviceID = 0; + m_fPlaying = FALSE; + m_fMovieOpen = FALSE; +} + +// Destructeur. + +CMovie::~CMovie() +{ + termAVI(); +} + +// Ouvre la librairie avi. + +BOOL CMovie::Create() +{ +#if _EGAMES + m_bEnable = FALSE; + return FALSE; +#else + if ( initAVI() ) + { + m_bEnable = TRUE; + return TRUE; + } + else + { + m_bEnable = FALSE; + return FALSE; + } +#endif +} + +// Retourne l'état de DirectMovie. + +BOOL CMovie::GetEnable() +{ + return m_bEnable; +} + +// Indique si un film existe. + +BOOL CMovie::IsExist(char *pFilename) +{ + char string[MAX_PATH]; + FILE* file; + + if ( pFilename[1] == ':' ) // nom complet "D:\REP..." ? + { + strcpy(string, pFilename); + } + else + { + GetCurrentDir(string, MAX_PATH-30); + strcat(string, pFilename); + } + + file = fopen(string, "rb"); + if ( file == NULL ) return FALSE; + + fclose(file); + return TRUE; +} + +// Montre un film avi. + +BOOL CMovie::Play(HWND hWnd, RECT rect, char *pFilename) +{ + if ( !m_bEnable ) return FALSE; + if ( !fileOpenMovie(hWnd, rect, pFilename) ) return FALSE; + playMovie(hWnd, IDM_PLAY); + + return TRUE; +} + +// Stoppe le film avi. + +void CMovie::Stop(HWND hWnd) +{ + if ( !m_bEnable ) return; + fileCloseMovie(hWnd); +} diff --git a/movie.h b/movie.h new file mode 100644 index 0000000..9b420ca --- /dev/null +++ b/movie.h @@ -0,0 +1,31 @@ +// movie.h +// + +class CMovie +{ +public: + CMovie(); + ~CMovie(); + + BOOL Create(); + BOOL GetEnable(); + BOOL IsExist(char *pFilename); + BOOL Play(HWND hWnd, RECT rect, char *pFilename); + void Stop(HWND hWnd); + +protected: + void playMovie(HWND hWnd, int nDirection); + BOOL fileOpenMovie(HWND hWnd, RECT rect, char *pFilename); + void fileCloseMovie(HWND hWnd); + void positionMovie(HWND hWnd, RECT rect); + void termAVI(); + BOOL initAVI(); + +protected: + BOOL m_bEnable; + MCIDEVICEID m_wMCIDeviceID; // MCI Device ID for the AVI file + HWND m_hwndMovie; // window handle of the movie + BOOL m_fPlaying; // Play flag: TRUE == playing, FALSE == paused + BOOL m_fMovieOpen; // Open flag: TRUE == movie open, FALSE = none +}; + diff --git a/movie/history2.avi b/movie/history2.avi new file mode 100644 index 0000000..8cea819 Binary files /dev/null and b/movie/history2.avi differ diff --git a/movie/history2.blp b/movie/history2.blp new file mode 100644 index 0000000..8447d87 Binary files /dev/null and b/movie/history2.blp differ diff --git a/movie/play101.avi b/movie/play101.avi new file mode 100644 index 0000000..64a5985 Binary files /dev/null and b/movie/play101.avi differ diff --git a/movie/play101.blp b/movie/play101.blp new file mode 100644 index 0000000..59eea07 Binary files /dev/null and b/movie/play101.blp differ diff --git a/movie/play103.avi b/movie/play103.avi new file mode 100644 index 0000000..07cf736 Binary files /dev/null and b/movie/play103.avi differ diff --git a/movie/play103.blp b/movie/play103.blp new file mode 100644 index 0000000..82f5d7f Binary files /dev/null and b/movie/play103.blp differ diff --git a/movie/play105.avi b/movie/play105.avi new file mode 100644 index 0000000..8c7aa89 Binary files /dev/null and b/movie/play105.avi differ diff --git a/movie/play105.blp b/movie/play105.blp new file mode 100644 index 0000000..1105452 Binary files /dev/null and b/movie/play105.blp differ diff --git a/movie/play107.avi b/movie/play107.avi new file mode 100644 index 0000000..b0110b3 Binary files /dev/null and b/movie/play107.avi differ diff --git a/movie/play107.blp b/movie/play107.blp new file mode 100644 index 0000000..49c16ac Binary files /dev/null and b/movie/play107.blp differ diff --git a/movie/play108.avi b/movie/play108.avi new file mode 100644 index 0000000..2b27d09 Binary files /dev/null and b/movie/play108.avi differ diff --git a/movie/play108.blp b/movie/play108.blp new file mode 100644 index 0000000..fae56d7 Binary files /dev/null and b/movie/play108.blp differ diff --git a/movie/play110.avi b/movie/play110.avi new file mode 100644 index 0000000..533796b Binary files /dev/null and b/movie/play110.avi differ diff --git a/movie/play110.blp b/movie/play110.blp new file mode 100644 index 0000000..128ba17 Binary files /dev/null and b/movie/play110.blp differ diff --git a/movie/play113.avi b/movie/play113.avi new file mode 100644 index 0000000..9cdf082 Binary files /dev/null and b/movie/play113.avi differ diff --git a/movie/play113.blp b/movie/play113.blp new file mode 100644 index 0000000..b592742 Binary files /dev/null and b/movie/play113.blp differ diff --git a/movie/play116.avi b/movie/play116.avi new file mode 100644 index 0000000..e85b1b2 Binary files /dev/null and b/movie/play116.avi differ diff --git a/movie/play116.blp b/movie/play116.blp new file mode 100644 index 0000000..c773c92 Binary files /dev/null and b/movie/play116.blp differ diff --git a/movie/play118.avi b/movie/play118.avi new file mode 100644 index 0000000..671da27 Binary files /dev/null and b/movie/play118.avi differ diff --git a/movie/play118.blp b/movie/play118.blp new file mode 100644 index 0000000..df7431f Binary files /dev/null and b/movie/play118.blp differ diff --git a/movie/play119.avi b/movie/play119.avi new file mode 100644 index 0000000..69dbe33 Binary files /dev/null and b/movie/play119.avi differ diff --git a/movie/play119.blp b/movie/play119.blp new file mode 100644 index 0000000..ceb9ca8 Binary files /dev/null and b/movie/play119.blp differ diff --git a/movie/play124.avi b/movie/play124.avi new file mode 100644 index 0000000..d762661 Binary files /dev/null and b/movie/play124.avi differ diff --git a/movie/play124.blp b/movie/play124.blp new file mode 100644 index 0000000..d7edbf2 Binary files /dev/null and b/movie/play124.blp differ diff --git a/movie/win005.avi b/movie/win005.avi new file mode 100644 index 0000000..8b2301b Binary files /dev/null and b/movie/win005.avi differ diff --git a/movie/win005.blp b/movie/win005.blp new file mode 100644 index 0000000..64fe841 Binary files /dev/null and b/movie/win005.blp differ diff --git a/movie/win129.avi b/movie/win129.avi new file mode 100644 index 0000000..31bf053 Binary files /dev/null and b/movie/win129.avi differ diff --git a/movie/win129.blp b/movie/win129.blp new file mode 100644 index 0000000..856f885 Binary files /dev/null and b/movie/win129.blp differ diff --git a/obstacle.cpp b/obstacle.cpp new file mode 100644 index 0000000..fdad3fd --- /dev/null +++ b/obstacle.cpp @@ -0,0 +1,3640 @@ +// Obstacle.cpp +// + +#include "DECOR.H" +#include "MISC.H" +#include "ACTION.H" + +// Cette table indique les obstacles sur les sols. +// 0=passage, 1=obstacle + +static char tableObstacleFloor[] = +{ + 1,1,1,1,1, // 0 (noir pour limites) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,0,0,0, // 1 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,1,1,1,1, // 2 + 0,1,1,1,1, + 0,1,1,1,1, + 0,1,1,1,1, + 0,1,1,1,1, + + 0,0,0,0,0, // 3 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,0, // 4 + 1,1,1,1,0, + 1,1,1,1,0, + 1,1,1,1,0, + 1,1,1,1,0, + + 1,1,1,1,1, // 5 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,0,0,0,0, + + 0,0,0,0,0, // 6 + 0,0,1,1,1, + 0,1,1,1,1, + 0,1,1,1,1, + 0,1,1,1,1, + + 0,0,0,0,0, // 7 + 1,1,1,0,0, + 1,1,1,1,0, + 1,1,1,1,0, + 1,1,1,1,0, + + 1,1,1,1,0, // 8 + 1,1,1,1,0, + 1,1,1,1,0, + 1,1,1,0,0, + 0,0,0,0,0, + + 0,1,1,1,1, // 9 + 0,1,1,1,1, + 0,1,1,1,1, + 0,0,1,1,1, + 0,0,0,0,0, + + 0,0,1,1,1, // 10 + 0,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,0,0, // 11 + 1,1,1,1,0, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 12 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,0, + 1,1,1,0,0, + + 1,1,1,1,1, // 13 + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 14 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,0,0,0, // 15 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 16 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 17 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 18 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 19 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 20 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 21 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 22 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 23 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 24 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 25 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 26 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 27 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 28 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 29 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 30 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 31 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 32 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 33 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 34 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 35 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 36 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 37 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 38 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 39 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 40 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 41 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 42 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 43 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 44 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 45 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 46 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 47 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 48 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 49 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 50 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 51 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 52 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 53 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 54 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 55 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 56 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 57 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 58 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 59 (pont e-o) + 0,0,0,0,0, + 0,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,0,0,0, // 60 + 0,0,0,0,0, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,0,0,0, // 61 + 0,0,0,0,0, + 1,1,1,1,0, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,0,1,1, // 62 (pont n-s) + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,1,1,1, // 63 + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,1,1,1, // 64 + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,0,1,1, +}; + +// Cette table indique les obstacles sur les sols pour le bateau. +// 0=passage, 1=obstacle + +static char tableObstacleFloorBateau[] = +{ + 1,1,1,1,1, // 2 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 3 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,1,1,1, // 4 + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 5 + 0,0,0,0,0, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 6 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 7 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,1,1,1, // 8 + 0,0,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 9 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,0,0, // 10 + 1,1,1,0,0, + 1,1,1,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,1,1,1, // 11 + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 12 + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 13 + 0,0,0,0,0, + 1,1,1,0,0, + 1,1,1,0,0, + 1,1,1,0,0, + + 0,0,0,0,0, // 14 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, +}; + +// Cette table indique les obstacles sur les objets. +// 0=passage, 1=obstacle + +static char tableObstacleObject[] = +{ + 0,0,0,0,0, // 0 + 0,0,0,0,0, + 0,0,1,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 1 + 0,1,0,0,0, + 0,1,0,0,0, + 0,1,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 2 + 0,1,1,1,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 3 + 0,1,1,1,0, + 0,1,1,1,0, + 0,1,1,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 4 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,1,0, + 0,0,0,0,0, + + 1,1,1,1,1, // 5 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,0,0,0, // 6 (arbre) + 0,0,0,0,0, + 0,0,1,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 7 + 0,0,0,0,0, + 0,0,0,1,0, + 0,0,1,1,1, + 0,0,0,1,0, + + 0,0,0,0,0, // 8 + 0,1,0,0,0, + 0,1,0,0,0, + 0,1,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 9 + 0,0,0,1,0, + 0,0,1,1,0, + 0,1,1,1,0, + 0,0,0,0,0, + + 0,1,1,1,1, // 10 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,0, + + 1,1,1,1,0, // 11 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,1, + + 0,1,1,1,0, // 12 (fusée) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,0, + + 0,0,0,0,0, // 13 + 0,0,0,0,0, + 0,0,1,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 14 (métal) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 15 (maison construction) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,0,0,0, // 16 (armure) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 17 (batiment ennemi) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 18 + 1,1,1,1,1, + 1,1,1,1,1, + 1,0,0,0,0, + 1,1,1,1,1, + + 0,0,0,0,0, // 19 (électro piégé) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 20 (mur) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 21 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 22 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 23 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 24 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 25 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 26 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 27 (tour) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 28 (laboratoire) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 1,1,1,1,1, +// 1,1,1,1,1, // 28 (laboratoire) +// 1,1,1,1,1, +// 1,1,1,1,1, +// 1,1,1,1,1, +// 1,1,1,1,1, + + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,0,0,0, // 30 (arbre sans feuilles) + 0,0,0,0,0, + 0,0,1,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 31 + 0,0,0,0,0, + 0,0,0,1,0, + 0,0,1,1,1, + 0,0,0,1,0, + + 0,0,0,0,0, // 32 + 0,1,0,0,0, + 0,1,0,0,0, + 0,1,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 33 + 0,0,0,1,0, + 0,0,1,1,0, + 0,1,1,1,0, + 0,0,0,0,0, + + 0,1,1,1,1, // 34 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,0, + + 1,1,1,1,0, // 35 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,1, + + 0,0,0,0,0, // 36 (tas de planches) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 37 (rochers) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 38 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 39 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 40 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 41 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 42 + 1,1,1,1,1, + 1,1,1,1,1, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 43 + 0,1,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 44 (tas de pierres) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 45 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 46 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 47 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 48 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 49 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 50 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 51 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 52 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 53 + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 54 + 0,0,0,0,0, + 1,1,1,0,0, + 1,1,1,0,0, + 1,1,1,0,0, + + 1,1,1,0,0, // 55 + 1,1,1,0,0, + 1,1,1,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,1,1,1, // 56 + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 57 (plante) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 58 + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 59 + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 60 (tomates) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 61 (cabane) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 62 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 0,0,0,0,0, // 63 (oeufs) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 64 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,0, // 65 (palissade) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 0,1,1,0,0, + + 1,1,1,1,0, // 66 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 0,1,1,0,0, + + 1,1,1,1,0, // 67 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 0,1,1,0,0, + + 1,1,1,1,0, // 68 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 0,1,1,0,0, + + 1,1,1,1,0, // 69 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 0,1,1,0,0, + + 1,1,1,1,0, // 70 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 0,1,1,0,0, + + 1,1,1,1,0, // 71 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 0,1,1,0,0, + + 0,0,0,0,0, // 72 (pont en construction) + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 73 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 74 (rayon tour) + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 75 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 76 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 77 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 78 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 79 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 80 (bouteille) + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,1,0, + 0,0,0,0,0, + + 0,1,1,1,0, // 81 (fleurs) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,0, + + 0,0,0,0,0, // 82 + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,1,1,1,0, // 83 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,0, + + 0,0,0,0,0, // 84 + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 85 (dynamite) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 86 + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 87 + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 88 (explosion) + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 89 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 90 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 91 + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 92 (poison) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 93 (piège) + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,1,0, + 0,0,0,0,0, + + 0,1,1,1,0, // 94 (fleurs) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 0,1,1,1,0, + + 0,0,0,0,0, // 95 + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 96 (araignée dans piège) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 97 (tracks dans piège) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 98 (robot dans piège) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 99 (recharge) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 1,1,1,0,0, + + 1,1,1,1,1, // 100 (batiment ennemi) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 101 + 1,1,1,1,1, + 1,1,1,1,1, + 1,0,0,0,0, + 1,1,1,1,1, + + 1,1,1,1,1, // 102 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 103 + 1,1,1,1,1, + 1,1,1,1,1, + 1,0,0,0,0, + 1,1,1,1,1, + + 1,1,1,1,1, // 104 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 105 + 1,1,1,1,1, + 1,1,1,1,1, + 1,0,0,0,0, + 1,1,1,1,1, + + 1,1,1,1,1, // 106 (barrière) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 107 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 108 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 109 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 110 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 111 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 112 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 113 (maison) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 1,1,1,1,1, + + 0,0,0,0,0, // 114 (bombe dans piège) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 115 (batiment ennemi) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 116 + 1,1,1,1,1, + 1,1,1,1,1, + 1,0,0,0,0, + 1,1,1,1,1, + + 0,0,0,0,0, // 117 (bateau) + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 118 (jeep) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 1,1,1,1,1, // 119 (usine) + 1,1,1,1,1, + 1,1,1,1,1, + 1,0,0,0,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 120 + 1,1,1,1,1, + 1,1,1,1,1, + 1,0,0,0,0, + 1,1,1,1,1, + + 1,1,1,1,1, // 121 (mine de fer) + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,1,1, + + 1,1,1,1,1, // 122 + 1,1,1,1,1, + 1,1,1,1,1, + 1,1,1,0,0, + 1,1,1,1,1, + + 0,0,0,0,0, // 123 (fer) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 124 (drapeau) + 0,0,0,0,0, + 0,0,1,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 125 (mine) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, + + 0,0,0,0,0, // 126 (mine de fer, échaffaudage) + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + 0,0,0,0,0, + + 0,0,0,0,0, // 127 (mine) + 0,0,0,0,0, + 0,0,1,1,1, + 0,0,1,1,1, + 0,0,1,1,1, +}; + +// Retourne les obstacles autour d'une cellule, sous la +// forme d'un tableau de 3x3. + +void CDecor::SearchFloor(int rank, int icon, POINT cel, int *pBits) +{ + char* pTable; + int first, last; + int dx, dy, x, y, i; + int def = 0; + + pTable = tableObstacleFloor; + first = 0; + last = 64; + + if ( rank != -1 && m_blupi[rank].vehicule == 1 ) // en bateau ? + { + pTable = tableObstacleFloorBateau; + first = 2; + last = 14; + def = 1; + } + + if ( icon >= first && icon <= last ) + { + pTable += (icon-first)*5*5; + + if ( cel.x%2 == 0 ) dx = 0; + else dx = 2; + + if ( cel.y%2 == 0 ) dy = 0; + else dy = 2; + + for ( y=dy ; y= 0 && icon <= 127 ) + { + pTable = tableObstacleObject+(icon)*5*5; + + if ( cel.x%2 == 0 ) dx = 0; + else dx = 2; + + if ( cel.y%2 == 0 ) dy = 0; + else dy = 2; + + for ( y=dy ; y= 59 && icon <= 64 ) goto lock; // pont ? + } + return; + } + + if ( m_blupi[rank].perso == 2 ) // virus ? + { + goto pass; // le virus peut aller partout (il volle) + return; + } + + if ( m_blupi[rank].perso == 3 ) // tracks ? + { + if ( icon >= 59 && icon <= 64 ) // ponts ? + { + goto lock; // le tracks ne peut pas aller sur les ponts + } + return; + } + +//- if ( m_blupi[rank].perso == 4 ) // robot ? +//- { +//- if ( icon >= 59 && icon <= 64 ) // ponts ? +//- { +//- goto lock; // le robot ne peut pas aller sur les ponts +//- } +//- return; +//- } + return; + + pass: + for ( i=0 ; i<9 ; i++ ) + { + *pBits++ = 0; // peut passer + } + return; + + lock: + for ( i=0 ; i<9 ; i++ ) + { + *pBits++ = 1; // bloqué + } + return; +} + +// (*) Blupi est passe muraille lorsqu'il embarque ou débarque +// du bateau. Dans ce cas, tous les sols (rivages) doivent +// permettre de passer. En revanche, pas les obstacles ! + +// Ajuste un obstacle en fonction du personnage. + +void CDecor::AjustObject(int rank, int icon, POINT cel, int *pBits) +{ + int i; + + if ( rank < 0 ) return; + + if ( m_blupi[rank].perso == 0 ) // blupi ? + { + if ( m_blupi[rank].vehicule != 0 && // pas à pied ? + cel.x%2 == 1 && cel.y%2 == 1 && + m_decor[cel.x/2][cel.y/2].objectIcon == 117 ) // bateau ? + { + goto lock; // blupi ne peut pas aller dans le bateau + } +// if ( m_blupi[rank].interrupt == -1 ) // passe muraille (*) ? +// { +// goto pass; +// } +// if ( cel.x > 0 && cel.x%2 == 0 && cel.y%2 == 1 && +// (m_decor[(cel.x-2)/2][cel.y/2].objectIcon == 100 || // usine ? +// m_decor[(cel.x-2)/2][cel.y/2].objectIcon == 102 || +// m_decor[(cel.x-2)/2][cel.y/2].objectIcon == 104 || +// m_decor[(cel.x-2)/2][cel.y/2].objectIcon == 115 || +// m_decor[(cel.x-2)/2][cel.y/2].objectIcon == 17) ) +// { +// goto lock; // blupi ne peut pas bloquer la porte +// } + if ( cel.x%2 == 1 && cel.y%2 == 1 && + m_decor[cel.x/2][cel.y/2].objectIcon == 99 ) // recharge ? + { + goto lock; // blupi ne peut pas bloquer la station + } + if ( m_blupi[rank].vehicule == 2 && // en jeep ? + m_decor[cel.x/2][cel.y/2].objectIcon == 113 ) // maison ? + { + goto lock; // blupi ne peut pas aller dans la maison + } + return; + } + + if ( m_blupi[rank].perso == 1 ) // araignée ? + { +// if ( cel.x%2 != 0 && cel.y%2 != 0 && + if ( IsSpiderObject(icon) ) // tomate ou poison ? + { + goto pass; // l'araignée peut aller dans les tomates + } + return; + } + + if ( m_blupi[rank].perso == 2 ) // virus ? + { + if ( icon == 81 || + icon == 83 || + icon == 94 || // fleurs non-coupées ? + (icon >= 106 && icon <= 112) ) // barrières ennemies ? + { + goto pass; // le virus peut aller + } + return; + } + + if ( m_blupi[rank].perso == 3 ) // tracks ? + { + if ( IsTracksObject(icon) ) // fleurs ou objet ? + { + goto pass; // le tracks peut aller + } + if ( icon == 113 || // maison ? + icon == 28 || icon == 29 || // laboratoire ? + icon == 119 || icon == 120 || // usine ? + icon == 121 || icon == 122 ) // mine de fer ? + { + goto lock; // le tracks ne peut pas aller dans la maison + } + return; + } + + if ( m_blupi[rank].perso == 4 ) // robot ? + { + if ( IsRobotObject(icon) ) // piège ou dynamite ? + { + goto pass; // le robot peut aller + } + return; + } + + if ( m_blupi[rank].perso == 5 ) // bombe ? + { + if ( icon == 93 ) // piège ? + { + goto pass; // la bombe peut aller + } + return; + } + + if ( m_blupi[rank].perso == 7 ) // électro ? + { + if ( icon == 93 ) // piège ? + { + goto pass; // l'électro peut aller + } + if ( icon == 113 || // maison ? + icon == 28 || icon == 29 || // laboratoire ? + icon == 119 || icon == 120 || // usine ? + icon == 121 || icon == 122 ) // mine de fer ? + { + goto lock; // l'électro ne peut pas aller dans la maison + } + return; + } + + if ( m_blupi[rank].perso == 8 ) // disciple ? + { + if ( cel.x > 0 && cel.x%2 == 0 && cel.y%2 == 1 && + (m_decor[(cel.x-2)/2][cel.y/2].objectIcon == 100 || // usine ? + m_decor[(cel.x-2)/2][cel.y/2].objectIcon == 102 || + m_decor[(cel.x-2)/2][cel.y/2].objectIcon == 104 || + m_decor[(cel.x-2)/2][cel.y/2].objectIcon == 115) ) + { + goto lock; // disciple ne peut pas bloquer la porte + } + if ( cel.x%2 == 1 && cel.y%2 == 1 && + m_decor[cel.x/2][cel.y/2].objectIcon == 99 ) // recharge ? + { + goto lock; // disciple ne peut pas bloquer la station + } + if ( m_decor[cel.x/2][cel.y/2].objectIcon == 113 ) // maison ? + { + goto lock; // disciple ne peut pas aller dans la maison + } + return; + } + return; + + pass: + for ( i=0 ; i<9 ; i++ ) + { + *pBits++ = 0; // peut passer + } + return; + + lock: + for ( i=0 ; i<9 ; i++ ) + { + *pBits++ = 1; // bloqué + } + return; +} + +// Copie un tableau 3x3 dans un tableau 9x9. + +void Copy33To99(int *pSrc33, int *pDst99, int dx, int dy) +{ + int x, y; + + for ( y=0 ; y<3 ; y++ ) + { + for ( x=0 ; x<3 ; x++ ) + { + pDst99[(dx+1)*3+x + ((dy+1)*3+y)*9] = pSrc33[x+y*3]; + } + } +} + +// Indique s'il est possible d'avancer dans une direction donnée. + +BOOL CDecor::IsFreeDirect(POINT cel, int direct, int rank) +{ + int icon, workBlupi; + int bits[3*3], obstacles[9*9]; + POINT test, vector; + + vector = GetVector(direct); + + test.x = cel.x+vector.x; + test.y = cel.y+vector.y; + + if ( m_decor[test.x/2][test.y/2].fire > 0 && + m_decor[test.x/2][test.y/2].fire < MoveMaxFire() ) return FALSE; + + // Cellule bloquée (un blupi travaille ici) ? + if ( m_blupi[rank].perso != 3 ) // pas tracks ? + { + workBlupi = m_decor[test.x/2][test.y/2].workBlupi; + if ( workBlupi >= 0 && workBlupi != rank ) return FALSE; + } + + // Déplacement possible par-rapport au sol ? +// icon = m_decor[cel.x/2][cel.y/2].floorIcon; +// SearchFloor(rank, icon, cel, bits); +// AjustFloor(rank, icon, cel, bits); +// if ( bits[(1+vector.x)+(1+vector.y)*3] == 1 ) return FALSE; + + icon = m_decor[test.x/2][test.y/2].floorIcon; + SearchFloor(rank, icon, test, bits); + AjustFloor(rank, icon, test, bits); + if ( bits[1+1*3] == 1 ) return FALSE; + if ( bits[(1-vector.x)+(1-vector.y)*3] == 1 ) return FALSE; + + // Déplacement possible par-rapport aux obstacles ? + icon = m_decor[cel.x/2][cel.y/2].objectIcon; + SearchObject(rank, icon, cel, bits); + AjustObject(rank, icon, cel, bits); + if ( bits[(1+vector.x)+(1+vector.y)*3] == 1 ) return FALSE; + + icon = m_decor[test.x/2][test.y/2].objectIcon; + SearchObject(rank, icon, test, bits); + AjustObject(rank, icon, test, bits); + if ( bits[(1-vector.x)+(1-vector.y)*3] == 1 ) return FALSE; + if ( bits[1+1*3] == 1 ) return FALSE; + + if ( vector.x != 0 && vector.y != 0 ) // déplacement diagonal ? + { + test.x = cel.x; + test.y = cel.y+vector.y; + icon = m_decor[test.x/2][test.y/2].objectIcon; + SearchObject(rank, icon, test, bits); + AjustObject(rank, icon, test, bits); + Copy33To99(bits, obstacles, 0, vector.y); + + test.x = cel.x+vector.x; + test.y = cel.y; + icon = m_decor[test.x/2][test.y/2].objectIcon; + SearchObject(rank, icon, test, bits); + AjustObject(rank, icon, test, bits); + Copy33To99(bits, obstacles, vector.x, 0); + + if ( obstacles[(4+vector.x*1)+(4+vector.y*2)*9] == 1 ) return FALSE; + if ( obstacles[(4+vector.x*2)+(4+vector.y*1)*9] == 1 ) return FALSE; + } + + return TRUE; // pas d'obstacle +} + +// Indique si une cellule contient un objet. +// Est utilisé lors du dessin (BuildPutBlupi), pour savoir +// si blupi est devant un objet. + +BOOL CDecor::IsFreeCelObstacle(POINT cel) +{ + int icon; + int bits[9]; + + if ( !IsValid(cel) ) return FALSE; + + if ( m_decor[cel.x/2][cel.y/2].fire > 0 && + m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) return FALSE; + + icon = m_decor[cel.x/2][cel.y/2].objectIcon; + if ( icon != -1 ) + { + SearchObject(-1, icon, cel, bits); + if ( bits[1+1*3] == 1 ) return FALSE; + } + + return TRUE; // pas d'obstacle +} + +// Indique si une cellule contient un sol. +// Est utilisé pour savoir si blupi peut aller sur une cellule +// en tenant compte uniquement des sols. +// Retourne TRUE si blupi peut y aller ! + +BOOL CDecor::IsFreeCelFloor(POINT cel, int rank) +{ + int icon; + int bits[9]; + + if ( !IsValid(cel) ) return FALSE; + + icon = m_decor[cel.x/2][cel.y/2].floorIcon; + if ( icon != -1 ) + { + SearchFloor(rank, icon, cel, bits); + AjustFloor(rank, icon, cel, bits); + if ( bits[1+1*3] == 1 ) return FALSE; + } + + return TRUE; // pas d'obstacle +} + +// Indique si une cellule est libre. +// Est utilisé pour savoir si blupi peut venir ici +// débarquer en bateau ou monter dans sa jeep. + +BOOL CDecor::IsFreeCelGo(POINT cel, int rank) +{ + BOOL bOK; + POINT limit; + int action, channel, icon; + + if ( rank == -1 ) return IsFreeCel(cel, rank); + + GetObject(cel, channel, icon); + + // Refuse d'aller dans la maison si blupi porte qq chose. + if ( m_blupi[rank].takeChannel != -1 && // porte qq chose ? + channel == CHOBJECT && + icon == 113 ) // maison ? + { + return FALSE; + } + + // Refuse d'aller dans le laboratoire (on peut seulement + // y transformer qq chose). + if ( channel == CHOBJECT && + (icon == 28 || // laboratoire ? + icon == 120 || // usine ? + icon == 122) ) // mine de fer ? + { + return FALSE; + } + + bOK = IsFreeCel(cel, rank); + if ( bOK ) return TRUE; + + bOK = IsFreeCelEmbarque(cel, rank, action, limit); + if ( bOK ) return TRUE; + + bOK = IsFreeCelDebarque(cel, rank, action, limit); + if ( bOK ) return TRUE; + + if ( !m_blupi[rank].bMalade && + m_blupi[rank].vehicule == 0 && // à pied ? + m_blupi[rank].perso != 8 && // pas le disciple ? + channel == CHOBJECT && + icon == 118 ) // jeep ? + { + return TRUE; + } + + if ( !m_blupi[rank].bMalade && + m_blupi[rank].vehicule == 0 && // à pied ? + m_blupi[rank].perso != 8 && // pas le disciple ? + m_blupi[rank].energy > MAXENERGY/4 && // fort ? + m_blupi[rank].takeChannel == -1 && // porte rien ? + channel == CHOBJECT && + icon == 16 ) // armure ? + { + return TRUE; + } + + return FALSE; +} + +// Indique si on peut faire qq chose sur une cellule. +// Est utilisé pour savoir comment est la mise en évidence (hili) +// à cet endroit. + +BOOL CDecor::IsFreeCelHili(POINT cel, int rank) +{ + BOOL bOK; + POINT limit; + int workBlupi, channel, icon, action; + + if ( IsValid(cel) ) + { + workBlupi = m_decor[cel.x/2][cel.y/2].workBlupi; + if ( workBlupi >= 0 && workBlupi != rank ) return FALSE; + + channel = m_decor[cel.x/2][cel.y/2].objectChannel; + icon = m_decor[cel.x/2][cel.y/2].objectIcon; + + if ( channel == CHOBJECT && + (icon == 12 || // fusée ? + (icon >= 20 && icon <= 26) || // mur ? + (icon >= 106 && icon <= 112) || // barrière ? + (icon >= 99 && icon <= 105) || // batiment ennemi ? + (icon >= 115 && icon <= 116) || // idem ? + (icon >= 17 && icon <= 18)) ) // idem ? + { + return FALSE; + } + } + + if ( rank == -1 ) return IsFreeCelFloor(cel, rank); + + bOK = IsFreeCelFloor(cel, rank); + if ( bOK ) return TRUE; + + bOK = IsFreeCelEmbarque(cel, rank, action, limit); + if ( bOK ) return TRUE; + + bOK = IsFreeCelDebarque(cel, rank, action, limit); + if ( bOK ) return TRUE; + + return FALSE; +} + +// Indique si une cellule est libre. +// Est utilisé pour savoir si blupi peut venir ici. + +BOOL CDecor::IsFreeCel(POINT cel, int rank) +{ + int icon, workBlupi; + int bits[9]; + + if ( !IsValid(cel) ) return FALSE; + + if ( m_decor[cel.x/2][cel.y/2].fire > 0 && + m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) return FALSE; + + // Cellule bloquée (un blupi travaille ici) ? + if ( rank != -1 && m_blupi[rank].perso != 3 ) // pas tracks ? + { + workBlupi = m_decor[cel.x/2][cel.y/2].workBlupi; + if ( workBlupi >= 0 && workBlupi != rank ) return FALSE; + } + + icon = m_decor[cel.x/2][cel.y/2].floorIcon; + SearchFloor(rank, icon, cel, bits); + AjustFloor(rank, icon, cel, bits); + if ( bits[1+1*3] == 1 ) return FALSE; + + icon = m_decor[cel.x/2][cel.y/2].objectIcon; + SearchObject(rank, icon, cel, bits); + AjustObject(rank, icon, cel, bits); + if ( bits[1+1*3] == 1 ) return FALSE; + + return TRUE; // pas d'obstacle +} + +// Indique si blupi peut déposer un objet ici. + +BOOL CDecor::IsFreeCelDepose(POINT cel, int rank) +{ + int icon; + + if ( !IsFreeCel(cel, rank) ) return FALSE; + + icon = m_decor[cel.x/2][cel.y/2].objectIcon; + if ( icon == 10000 || icon == 10001 || // éclairs entre tours ? + icon == 18 ) // dalle glissante ? + { + return FALSE; + } + + icon = m_decor[cel.x/2][cel.y/2].floorIcon; + if ( icon == 80 ) // téléporteur ? + { + return FALSE; + } + + return TRUE; +} + +// Indique s'il est possible d'embarquer ici. +// Le point retourné dans "limit" indique jusqu'où il est +// possible de marcher normalement (sans passe muraille). + +BOOL CDecor::IsFreeCelEmbarque(POINT cel, int rank, + int &action, POINT &limit) +{ + BOOL bOK; + int channel, icon; + + // Impossible si blupi n'est pas à pied, + // ou s'il s'agit d'un disciple. + if ( rank == -1 || m_blupi[rank].vehicule != 0 || + m_blupi[rank].perso == 8 ) return FALSE; + + // A-t-on cliqué sur un bateau ? + if ( cel.x%2 != 1 || cel.y%2 != 1 ) return FALSE; + GetObject(cel, channel, icon); + if ( channel != CHOBJECT || icon != 117 ) return FALSE; + + GetFloor(cel, channel, icon); + if ( channel == CHFLOOR && icon == 2 ) + { + m_blupi[rank].vehicule = 1; + bOK = IsFreeCel(GetCel(cel,+1,0), rank); // libre (en bateau) ? + m_blupi[rank].vehicule = 0; + if ( bOK ) + { + limit = GetCel(cel,-2,0); + action = WM_ACTION_BATEAUDE; + return TRUE; + } + } + + GetFloor(cel, channel, icon); + if ( channel == CHFLOOR && icon == 3 ) + { + m_blupi[rank].vehicule = 1; + bOK = IsFreeCel(GetCel(cel,0,+1), rank); // libre (en bateau) ? + m_blupi[rank].vehicule = 0; + if ( bOK ) + { + limit = GetCel(cel,0,-2); + action = WM_ACTION_BATEAUDS; + return TRUE; + } + } + + GetFloor(cel, channel, icon); + if ( channel == CHFLOOR && icon == 4 ) + { + m_blupi[rank].vehicule = 1; + bOK = IsFreeCel(GetCel(cel,-1,0), rank); // libre (en bateau) ? + m_blupi[rank].vehicule = 0; + if ( bOK ) + { + limit = GetCel(cel,+1,0); + action = WM_ACTION_BATEAUDO; + return TRUE; + } + } + + GetFloor(cel, channel, icon); + if ( channel == CHFLOOR && icon == 5 ) + { + m_blupi[rank].vehicule = 1; + bOK = IsFreeCel(GetCel(cel,0,-1), rank); // libre (en bateau) ? + m_blupi[rank].vehicule = 0; + if ( bOK ) + { + limit = GetCel(cel,0,+1); + action = WM_ACTION_BATEAUDN; + return TRUE; + } + } + + return FALSE; +} + +// Indique s'il est possible de débarquer ici. +// Le point retourné dans "limit" indique jusqu'où il est +// possible de naviguer normalement (sans passe muraille). + +BOOL CDecor::IsFreeCelDebarque(POINT cel, int rank, + int &action, POINT &limit) +{ + BOOL bOK; + int channel1, icon1; + int channel2, icon2; + + // Impossible si blupi n'est pas en bateau. + if ( rank == -1 || m_blupi[rank].vehicule != 1 ) return FALSE; + + m_blupi[rank].vehicule = 0; + bOK = IsFreeCel(cel, rank); // libre (à pied) ? + m_blupi[rank].vehicule = 1; + if ( !bOK ) return FALSE; + + GetFloor(GetCel(cel,+2,0), channel1, icon1); + GetObject(GetCel(cel,+2,0), channel2, icon2); + if ( channel1 == CHFLOOR && icon1 == 2 && // rive ? + channel2 == -1 && icon2 == -1 && // pas de bateau amarré ? + cel.x%2 == 1 && cel.y%2 == 1 ) + { + limit = GetCel(cel,+3,0); + action = WM_ACTION_BATEAUAE; + return TRUE; + } + + GetFloor(GetCel(cel,0,+2), channel1, icon1); + GetObject(GetCel(cel,0,+2), channel2, icon2); + if ( channel1 == CHFLOOR && icon1 == 3 && // rive ? + channel2 == -1 && icon2 == -1 && // pas de bateau amarré ? + cel.x%2 == 1 && cel.y%2 == 1 ) + { + limit = GetCel(cel,0,+3); + action = WM_ACTION_BATEAUAS; + return TRUE; + } + + GetFloor(GetCel(cel,-2,0), channel1, icon1); + GetObject(GetCel(cel,-2,0), channel2, icon2); + if ( channel1 == CHFLOOR && icon1 == 4 && // rive ? + channel2 == -1 && icon2 == -1 && // pas de bateau amarré ? + cel.x%2 == 0 && cel.y%2 == 1 ) + { + limit = GetCel(cel,-2,0); + action = WM_ACTION_BATEAUAO; + return TRUE; + } + + GetFloor(GetCel(cel,0,-2), channel1, icon1); + GetObject(GetCel(cel,0,-2), channel2, icon2); + if ( channel1 == CHFLOOR && icon1 == 5 && // rive ? + channel2 == -1 && icon2 == -1 && // pas de bateau amarré ? + cel.x%2 == 1 && cel.y%2 == 0 ) + { + limit = GetCel(cel,0,-2); + action = WM_ACTION_BATEAUAN; + return TRUE; + } + + return FALSE; +} + +// Indique s'il est possible de sauter dans une direction. + +BOOL CDecor::IsFreeJump(POINT cel, int direct, int rank, int &action) +{ + POINT depart, vector; + int i, icon; + int bits[3*3]; + + // Refuse de sauter si blupi n'est pas à pied ! + if ( m_blupi[rank].vehicule != 0 ) return FALSE; + + // Refuse de sauter dans les directions se, so, no, ne. + if ( (direct/16)%2 != 0 ) return FALSE; + + // Refuse de sauter si peu d'énergie ou si porte qq chose. + if ( m_blupi[rank].perso != 0 || + m_blupi[rank].energy <= MAXENERGY/4 || + m_blupi[rank].takeChannel != -1 ) return FALSE; + + vector = GetVector(direct); + depart = cel; + + i = 0; + while ( TRUE ) + { + cel.x += vector.x; + cel.y += vector.y; + + if ( i == 4 ) break; + if ( IsFreeCelFloor(cel, rank) ) break; + i ++; + } + if ( i == 0 ) return FALSE; + + // Départ possible par-rapport aux obstacles ? + icon = m_decor[depart.x/2][depart.y/2].objectIcon; + SearchObject(rank, icon, depart, bits); + AjustObject(rank, icon, depart, bits); + if ( bits[(1+vector.x)+(1+vector.y)*3] == 1 ) return FALSE; + + // Arrivée possible par-rapport aux obstacles ? + icon = m_decor[cel.x/2][cel.y/2].objectIcon; + SearchObject(rank, icon, cel, bits); + AjustObject(rank, icon, cel, bits); + if ( bits[(1-vector.x)+(1-vector.y)*3] == 1 ) return FALSE; + + if ( !IsFreeCel(cel, rank) || + IsBlupiHere(cel, TRUE) ) return FALSE; + + action = ACTION_SAUTE2+(i-1); + return TRUE; +} + +// Indique s'il est possible de glisser dans une direction. + +BOOL CDecor::IsFreeGlisse(POINT cel, int direct, int rank, int &action) +{ + int channel, icon; + + // Y'a que blupi qui glisse ! + if ( m_blupi[rank].perso != 0 ) return FALSE; + + GetFloor(GetCel((cel.x/2)*2,(cel.y/2)*2), channel, icon); + if ( channel != CHFLOOR || icon != 18 ) // pas dalle glissante ? + { + return FALSE; + } + + if ( !IsFreeDirect(cel, direct, rank) ) return FALSE; + + action = ACTION_GLISSE; + return TRUE; +} + + +// Cherche la meilleure direction pour atteindre un but. +// Retourne -1 si on est déjà sur le but. + +int CDecor::DirectSearch(POINT cel, POINT goal) +{ + POINT dir; + int direct, tan; + + dir.x = goal.x - cel.x; + dir.y = goal.y - cel.y; + + if ( dir.x == 0 && dir.y == 0 ) // but atteint ? + { + return -1; + } + +#if 0 + if ( dir.x > 0 ) + { + if ( dir.y > 0 ) direct = DIRECT_SE; + if ( dir.y == 0 ) direct = DIRECT_E; + if ( dir.y < 0 ) direct = DIRECT_NE; + } + + if ( dir.x == 0 ) + { + if ( dir.y > 0 ) direct = DIRECT_S; + else direct = DIRECT_N; + } + + if ( dir.x < 0 ) + { + if ( dir.y > 0 ) direct = DIRECT_SO; + if ( dir.y == 0 ) direct = DIRECT_O; + if ( dir.y < 0 ) direct = DIRECT_NO; + } +#endif + + // Cherche le huitième de cadrant correspondant à + // la direction. + // 41 = 100*tan(22.5) + // 241 = 100*tan(67.5) + if ( dir.x == 0 ) + { + if ( dir.y > 0 ) direct = DIRECT_S; + else direct = DIRECT_N; + } + else + { + tan = abs(100*dir.y/dir.x); // calcule la tangente*100 + + if ( dir.x > 0 ) + { + if ( dir.y > 0 ) + { + direct = DIRECT_SE; + if ( tan < 41 ) direct = DIRECT_E; + if ( tan > 241 ) direct = DIRECT_S; + } + else + { + direct = DIRECT_NE; + if ( tan < 41 ) direct = DIRECT_E; + if ( tan > 241 ) direct = DIRECT_N; + } + } + else + { + if ( dir.y > 0 ) + { + direct = DIRECT_SO; + if ( tan < 41 ) direct = DIRECT_O; + if ( tan > 241 ) direct = DIRECT_S; + } + else + { + direct = DIRECT_NO; + if ( tan < 41 ) direct = DIRECT_O; + if ( tan > 241 ) direct = DIRECT_N; + } + } + } + + return direct; +} + + +// Vide les positions déjà essayées. + +void CDecor::FlushUsed(int rank) +{ + m_blupi[rank].nbUsed = 0; + m_blupi[rank].nextRankUsed = 0; +} + +// Ajoute une position déjà été essayée. + +void CDecor::AddUsedPos(int rank, POINT pos) +{ + int i, j, old; + + // Un virus est bête. + if ( m_blupi[rank].perso == 2 ) return; + + // Déjà dans la liste ? + for ( i=0 ; i= MAXUSED ) + { + old = 10000; + j = 0; + for ( i=0 ; i 0 ) + { + m_blupi[rank].busyDelay --; + if ( m_blupi[rank].busyDelay == 0 && + m_blupi[rank].busyCount > 0 ) + { + m_blupi[rank].busyCount --; + } + return FALSE; + } + if ( CheminCherche(rank, action) ) // recherche futée selon DD ... + { + return TRUE; + } + else + { + // Si la destination est occupée pendant une répétition, + // il faut attendre à l'infini ! + if ( m_blupi[rank].repeatLevel != -1 && + IsBlupiHereEx(m_blupi[rank].goalCel, rank, FALSE) ) + { + m_blupi[rank].busyCount ++; + } + m_blupi[rank].busyDelay = Random(8,12); // délai avant réessai + return FALSE; + } + } + + for ( j=0 ; j<7 ; j++ ) + { + iBlupi = m_blupi[rank]; // sauvegarde blupi + + // Essaye 7 coups en avance, pour voir. + iCel = m_blupi[rank].cel; + i = 0; + while ( TRUE ) + { + if ( !SearchBestBase(rank, action, cel, direct) ) break; + if ( action == ACTION_STOP ) // collision avec autre blupi ? + { + if ( i == 0 ) + { + m_blupi[rank] = iBlupi; // restitue blupi + return FALSE; + } + i = 7; // comme si ok pour 7 coups + break; + } + m_blupi[rank].cel = cel; + lCel = cel; + + // Est-on revenu juste à côté de la position + // de départ ? Si oui, simplifie le mouvement. + if ( i > 1 && + abs(m_blupi[rank].cel.x-iCel.x) <= 1 && + abs(m_blupi[rank].cel.y-iCel.y) <= 1 ) + { + direct = DirectSearch(iCel, cel); + if ( IsFreeDirect(iCel, direct, rank) ) + { + m_blupi[rank].cel = iCel; + m_blupi[rank].sDirect = direct; + action = ACTION_MARCHE; + return TRUE; + } + } + + // A-t-on atteint le but ? + if ( cel.x == m_blupi[rank].goalCel.x && + cel.y == m_blupi[rank].goalCel.y ) + { + i = 7; // comme si ok pour 7 coups + break; + } + + i ++; + if ( i >= 7 ) break; + } + + m_blupi[rank] = iBlupi; // restitue blupi + + if ( i == 0 ) return FALSE; + + if ( i == 7 ) + { + SearchBestBase(rank, action, cel, direct); + m_blupi[rank].sDirect = direct; + return TRUE; + } + + AddUsedPos(rank, lCel); // bloque position ridicule + } + + return FALSE; +} + + +// Vérifie si un objet est utilisable pour travailler dessus. +// Le sol doit permettre d'aller aux 4 coins, et il ne doit +// pas y avoir un autre blupi que soi-même. + +BOOL CDecor::IsWorkableObject(POINT cel, int rank) +{ + if ( !IsFreeCelFloor(GetCel(cel,0,0), -1) || + !IsFreeCelFloor(GetCel(cel,1,0), -1) || + !IsFreeCelFloor(GetCel(cel,0,1), -1) || + !IsFreeCelFloor(GetCel(cel,1,1), -1) ) return FALSE; + + if ( IsBlupiHereEx(GetCel(cel,0,0), rank, FALSE) || + IsBlupiHereEx(GetCel(cel,1,0), rank, FALSE) || + IsBlupiHereEx(GetCel(cel,0,1), rank, FALSE) || + IsBlupiHereEx(GetCel(cel,1,1), rank, FALSE) ) return FALSE; + + if ( m_decor[cel.x/2][cel.y/2].fire > 0 && + m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) return FALSE; + + return TRUE; +} + + +// Cherche un autre objet pour continuer une action +// (comme par exemple abatre des arbres). + +BOOL CDecor::SearchOtherObject(int rank, POINT initCel, int action, + int distMax, int channel, + int firstIcon1, int lastIcon1, + int firstIcon2, int lastIcon2, + POINT &foundCel, int &foundIcon) +{ + int startx, starty, endx, endy; + int x, y, xx, yy; + int dist, min = distMax; + POINT cel; + BOOL bOK; + + if ( firstIcon1 == 33 && lastIcon1 == 48 && + firstIcon2 == 71 && lastIcon2 == 71 ) // cherche du fer ? + { + return SearchOtherDrapeau(rank, initCel, distMax, + foundCel, foundIcon); + } + + initCel.x = (initCel.x/2)*2; + initCel.y = (initCel.y/2)*2; + + startx = ((initCel.x-distMax/2)/2)*2; + endx = ((initCel.x+distMax/2)/2)*2; + starty = ((initCel.y-distMax/2)/2)*2; + endy = ((initCel.y+distMax/2)/2)*2; + + if ( startx < 0 ) startx = 0; + if ( endx > MAXCELX ) endx = MAXCELX; + if ( starty < 0 ) starty = 0; + if ( endy > MAXCELY ) endy = MAXCELY; + + if ( firstIcon2 == -1 && lastIcon2 == -1 ) + { + firstIcon2 = 22222; + lastIcon2 = 22222; + } + + for ( y=starty ; y= firstIcon1 && + m_decor[x/2][y/2].floorIcon <= lastIcon1 )|| + (m_decor[x/2][y/2].floorIcon >= firstIcon2 && + m_decor[x/2][y/2].floorIcon <= lastIcon2 ))&& + m_decor[x/2][y/2].objectChannel == -1 ) bOK = TRUE; + } + else + { + if ( m_decor[x/2][y/2].objectChannel == channel && + ((m_decor[x/2][y/2].objectIcon >= firstIcon1 && + m_decor[x/2][y/2].objectIcon <= lastIcon1 )|| + (m_decor[x/2][y/2].objectIcon >= firstIcon2 && + m_decor[x/2][y/2].objectIcon <= lastIcon2 )) ) bOK = TRUE; + } + + if ( bOK ) + { + cel.x = x; + cel.y = y; + if ( BlupiIsGoalUsed(cel) ) continue; + + if ( action == WM_ACTION_ABAT1 || + action == WM_ACTION_BUILD1 || + action == WM_ACTION_BUILD2 || + action == WM_ACTION_BUILD3 || + action == WM_ACTION_BUILD4 || + action == WM_ACTION_BUILD5 || + action == WM_ACTION_BUILD6 || + action == WM_ACTION_ROC1 || + action == WM_ACTION_MUR || + action == WM_ACTION_PONTE || + action == WM_ACTION_TOUR || + action == WM_ACTION_BATEAUE || + action == WM_ACTION_CULTIVE2 || + action == WM_ACTION_DRAPEAU2 || + action == WM_ACTION_DEPOSE ) + { + if ( !IsWorkableObject(cel, rank) ) continue; + } + + dist = abs(initCel.x-x) + abs(initCel.y-y); + if ( dist <= min ) + { + min = dist; + xx = x; + yy = y; + } + } + } + } + + if ( min == distMax ) return FALSE; + + foundCel.x = xx; + foundCel.y = yy; + + if ( channel == CHFLOOR ) + { + foundIcon = m_decor[xx/2][yy/2].floorIcon; + } + else + { + foundIcon = m_decor[xx/2][yy/2].objectIcon; + } + + return TRUE; +} + +// Cherche un autre sol pouvant contenir du fer, pour y +// planter un drapeau. + +BOOL CDecor::SearchOtherDrapeau(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon) +{ + int startx, starty, endx, endy, icon; + int x, y; + int dist, min = distMax; + POINT cel; + + startx = ((initCel.x-distMax/2)/2)*2; + endx = ((initCel.x+distMax/2)/2)*2; + starty = ((initCel.y-distMax/2)/2)*2; + endy = ((initCel.y+distMax/2)/2)*2; + + if ( startx < 0 ) startx = 0; + if ( endx > MAXCELX ) endx = MAXCELX; + if ( starty < 0 ) starty = 0; + if ( endy > MAXCELY ) endy = MAXCELY; + + for ( y=starty ; y= 33 && icon <= 48) || // terre ? + icon == 71 ) && + !TestDrapeau(GetCel(x,y)) ) // pas encore sondé ? + { + cel.x = x; + cel.y = y; + if ( BlupiIsGoalUsed(cel) ) continue; + if ( !IsWorkableObject(cel, rank) ) continue; + + dist = abs(initCel.x-x) + abs(initCel.y-y); + if ( dist <= min ) + { + min = dist; + foundCel.x = x; + foundCel.y = y; + foundIcon = icon; + } + } + } + } + + if ( min == distMax ) return FALSE; + return TRUE; +} + +// Cherche un autre sol permettant de déposer du bois +// pour construire un bateau. + +BOOL CDecor::SearchOtherBateau(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon) +{ + int startx, starty, endx, endy; + int x, y, direct; + int dist, min = distMax; + + startx = ((initCel.x-distMax/2)/2)*2; + endx = ((initCel.x+distMax/2)/2)*2; + starty = ((initCel.y-distMax/2)/2)*2; + endy = ((initCel.y+distMax/2)/2)*2; + + if ( startx < 0 ) startx = 0; + if ( endx > MAXCELX ) endx = MAXCELX; + if ( starty < 0 ) starty = 0; + if ( endy > MAXCELY ) endy = MAXCELY; + + for ( y=starty ; y MAXCELX ) endx = MAXCELX; + if ( starty < 0 ) starty = 0; + if ( endy > MAXCELY ) endy = MAXCELY; + + for ( y=starty ; y 4 ) continue; // si piège loin -> ignore + + if ( dist <= min ) + { + min = dist; + foundCel.x = x+1; + foundCel.y = y+1; // +1 -> sur l'objet + foundIcon = m_decor[x/2][y/2].objectIcon; + } + } + } + } + + if ( min == distMax ) return FALSE; + + return TRUE; +} + + +// Vérifie si l'objet peut être détruit par le tracks. + +BOOL CDecor::IsTracksObject(int icon) +{ + return ( icon == 36 || // planches ? + icon == 44 || // pierres ? + icon == 60 || // tomates ? + icon == 63 || // oeufs ? + icon == 80 || // bouteille ? + icon == 85 || // dynamite ? + icon == 92 || // poison ? + icon == 93 || // piège ? + icon == 123 || // piège ? + icon == 125 || // mine ? + icon == 127 || // mine ? + (icon >= 81 && icon <= 84) || // fleurs ? + (icon >= 94 && icon <= 95) ); // fleurs ? +} + +// Cherche un autre objet pour le tracks. + +BOOL CDecor::SearchTracksObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon) +{ + int startx, starty, endx, endy, icon; + int x, y; + int dist, min = distMax; +//? POINT cel; + + startx = ((initCel.x-distMax/2)/2)*2; + endx = ((initCel.x+distMax/2)/2)*2; + starty = ((initCel.y-distMax/2)/2)*2; + endy = ((initCel.y+distMax/2)/2)*2; + + if ( startx < 0 ) startx = 0; + if ( endx > MAXCELX ) endx = MAXCELX; + if ( starty < 0 ) starty = 0; + if ( endy > MAXCELY ) endy = MAXCELY; + + for ( y=starty ; y sur l'objet + foundIcon = m_decor[x/2][y/2].objectIcon; + } + } + } + } + + // Le tracks peut écraser blupi. + for ( rank=0 ; rank MAXCELX ) endx = MAXCELX; + if ( starty < 0 ) starty = 0; + if ( endy > MAXCELY ) endy = MAXCELY; + + for ( y=starty ; y sur l'objet + foundIcon = m_decor[x/2][y/2].objectIcon; + } + } + } + } + + if ( min < distMax ) + { + foundAction = -1; // robot passe tout prèt d'un piège/dynamite + return TRUE; + } + + // Cherche l'usine la moins construite. + min = 999; + maxUsine = 0; + index = 0; + for ( i=0 ; i<6 ; i++ ) + { + if ( nbUsine[i] < min ) + { + min = nbUsine[i]; + index = i; + } + if ( nbUsine[i] > maxUsine ) + { + maxUsine = nbUsine[i]; + } + } + +//? if ( nbUsine[0] > 0 && // sation de recharge existe ? +//? m_blupi[rank].energy <= MAXENERGY/2 ) // peu de forces ? +//? { +//? index = 0; // station de recharge +//? goto search; +//? } + + if ( min == 0 ) // encore une usine à construire ? + { + // Libre juste ici ? + if ( IsUsineBuild(rank, initCel) ) + { + foundCel = initCel; + build: + if ( index == 0 ) foundAction = WM_ACTION_R_BUILD1; // recharge + if ( index == 1 ) foundAction = WM_ACTION_R_BUILD4; // tracks + if ( index == 2 ) foundAction = WM_ACTION_R_BUILD2; // araignée + if ( index == 3 ) foundAction = WM_ACTION_R_BUILD3; // virus + if ( index == 4 ) foundAction = WM_ACTION_R_BUILD5; // bombe + if ( index == 5 ) foundAction = WM_ACTION_R_BUILD6; // électro + return TRUE; + } + // Cherche un emplacement libre. + for ( d=1 ; d MAXBLUPI-10 ) return FALSE; // rien si trop peuplé ! + // Cherche l'ennemi le moins répandu. + min = 999; + index = 0; + for ( i=0 ; i<5 ; i++ ) + { + if ( nbPerso[i] < min && + nbUsine[i+1] != 0 ) // usine correspondante existe ? + { + min = nbPerso[i]; + index = i+1; + } + } + if ( m_blupi[rank].energy <= MAXENERGY/2 ) // peu de forces ? + { + index = 0; // station de recharge + } + if ( m_skill >= 1 ) maxUsine *= 2; // 2 ennemis par batiment + if ( min >= maxUsine ) // assez peuplé ? + { + index = 0; // station de recharge + } + + // Cherche l'usine pour fabriquer l'ennemi le moins rédandu. +//? search: + min = distMax; + for ( y=starty ; y 67) ) return FALSE; + + for ( x=-1 ; x<3 ; x++ ) + { + for ( y=-1 ; y<3 ; y++ ) + { + if ( !IsFreeCel(GetCel(cel,x,y), rank) || + IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + { + return FALSE; + } + } + } + + return TRUE; +} + +// Teste s'il est possible d'entrer dans une usine. +// L'usine doit être libre devant (lieu de stationnement +// pour l'ennemi qui sera construit). + +BOOL CDecor::IsUsineFree(int rank, POINT cel) +{ + int channel, icon; + + GetObject(cel, channel, icon); + + if ( channel == CHOBJECT && icon == 115 ) // usine à bombes ? + { + return ( !IsBlupiHereEx(GetCel(cel,0,1), rank, FALSE) && + !IsBlupiHereEx(GetCel(cel,1,1), rank, FALSE) && + !IsBlupiHereEx(GetCel(cel,2,1), rank, FALSE) && + !IsBlupiHereEx(GetCel(cel,3,1), rank, FALSE) ); + } + + return ( !IsBlupiHereEx(GetCel(cel,0,1), rank, FALSE) && + !IsBlupiHereEx(GetCel(cel,1,1), rank, FALSE) && + !IsBlupiHereEx(GetCel(cel,2,0), rank, FALSE) && + !IsBlupiHereEx(GetCel(cel,2,1), rank, FALSE) && + (!IsBlupiHereEx(GetCel(cel,3,0), rank, FALSE)|| + !IsBlupiHereEx(GetCel(cel,3,1), rank, FALSE)) ); +} + + +// Vérifie si l'objet peut être détruit par une bombe. + +BOOL CDecor::IsBombeObject(int icon) +{ + return ( icon == 36 || // planches ? + icon == 61 || // cabane ? + icon == 121 || icon == 122 || // mine de fer ? + (icon >= 65 && icon <= 71) || // palissade ? + icon == 93 || // piège ? + icon == 117 ); // bateau ? +} + +// Cherche un autre objet pour une bombe. + +BOOL CDecor::SearchBombeObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon) +{ + int startx, starty, endx, endy; + int x, y; + int dist, min = distMax; + POINT cel; + + startx = ((initCel.x-distMax/2)/2)*2; + endx = ((initCel.x+distMax/2)/2)*2; + starty = ((initCel.y-distMax/2)/2)*2; + endy = ((initCel.y+distMax/2)/2)*2; + + if ( startx < 0 ) startx = 0; + if ( endx > MAXCELX ) endx = MAXCELX; + if ( starty < 0 ) starty = 0; + if ( endy > MAXCELY ) endy = MAXCELY; + + for ( y=starty ; y 8 ) continue; // si piège loin -> ignore + + if ( dist <= min ) + { + min = dist; + foundCel.x = x+1; + foundCel.y = y+1; // +1 -> sur l'objet + foundIcon = m_decor[x/2][y/2].objectIcon; + } + } + } + } + + if ( min == distMax ) return FALSE; + + return TRUE; +} + +// Cherche un autre objet pour un électro. + +BOOL CDecor::SearchElectroObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon) +{ + int startx, starty, endx, endy; + int x, y, i, d, dd, r; + int dist, min = distMax; + POINT cel; + + startx = ((initCel.x-10/2)/2)*2; + endx = ((initCel.x+10/2)/2)*2; + starty = ((initCel.y-10/2)/2)*2; + endy = ((initCel.y+10/2)/2)*2; + + if ( startx < 0 ) startx = 0; + if ( endx > MAXCELX ) endx = MAXCELX; + if ( starty < 0 ) starty = 0; + if ( endy > MAXCELY ) endy = MAXCELY; + + for ( y=starty ; y sur l'objet + foundIcon = m_decor[x/2][y/2].objectIcon; + } + } + } + } + if ( min <= 4 ) return TRUE; + + min = distMax; + for ( r=0 ; r 0 && + m_decor[test.x/2][test.y/2].fire < MoveMaxFire() ) return TRUE; + } + } + + return FALSE; +} + +// Teste si une position est très proche d'un virus. +// Si oui, retourne TRUE. + +BOOL CDecor::IsVirusCel(POINT cel) +{ + int rank; + + for ( rank=0 ; rank= m_blupi[rank].cel.x-1 && + cel.x <= m_blupi[rank].cel.x+1 && + cel.y >= m_blupi[rank].cel.y-1 && + cel.y <= m_blupi[rank].cel.y+1 ) return TRUE; + } + } + + return FALSE; +} + + +// Regarde s'il est possible de construire un pont à partir +// d'une cellule donnée (cel). +// Retourne 0 si c'est possible, ou une erreur autrement ! + +int CDecor::IsBuildPont(POINT &cel, int &iconBuild) +{ + POINT vector, test; + int i, channel, icon, p1, p2, p3, r1, r2, nb, rest; + int error = ERROR_MISC; + + for ( i=0 ; i<4 ; i++ ) + { + vector.x = 0; + vector.y = 0; + + GetFloor(GetCel(cel,+2,0), channel, icon); + if ( i == 0 && + channel == CHFLOOR && + (icon == 2 || icon == 59) ) // rivage ? + { + vector.x = +1; + vector.y = 0; + p1 = 59; + p2 = 60; + p3 = 61; + r1 = 2; + r2 = 4; + } + + GetFloor(GetCel(cel,-2,0), channel, icon); + if ( i == 1 && + channel == CHFLOOR && + (icon == 4 || icon == 61) ) // rivage ? + { + vector.x = -1; + vector.y = 0; + p1 = 61; + p2 = 60; + p3 = 59; + r1 = 4; + r2 = 2; + } + + GetFloor(GetCel(cel,0,+2), channel, icon); + if ( i == 2 && + channel == CHFLOOR && + (icon == 3 || icon == 62) ) // rivage ? + { + vector.x = 0; + vector.y = +1; + p1 = 62; + p2 = 63; + p3 = 64; + r1 = 3; + r2 = 5; + } + + GetFloor(GetCel(cel,0,-2), channel, icon); + if ( i == 3 && + channel == CHFLOOR && + (icon == 5 || icon == 64) ) // rivage ? + { + vector.x = 0; + vector.y = -1; + p1 = 64; + p2 = 63; + p3 = 62; + r1 = 5; + r2 = 3; + } + + if ( vector.x == 0 && vector.y == 0 ) continue; + + // Avance tant que le pont existe. + test = cel; + nb = 0; + do + { + test.x += vector.x*2; + test.y += vector.y*2; + if ( test.x < 0 || test.x >= MAXCELX || + test.y < 0 || test.y >= MAXCELY ) break; + + if ( !GetFloor(test, channel, icon) ) continue; + nb ++; + } + while ( icon == p1 || icon == p2 ); + test.x -= vector.x*2; + test.y -= vector.y*2; + + if ( icon == p3 ) + { + error = ERROR_PONTTERM; + continue; + } + + if ( nb == 1 ) iconBuild = p1; + else iconBuild = p2; + + // Avance jusqu'à la rive opposée. + rest = 0; + do + { + test.x += vector.x*2; + test.y += vector.y*2; + if ( test.x < 0 || test.x >= MAXCELX || + test.y < 0 || test.y >= MAXCELY ) break; + + if ( !GetFloor(test, channel, icon) ) continue; + rest ++; + } + while ( icon == r1 || icon == 14 ); + + if ( icon == r2 && rest == 1 ) iconBuild = p3; + + if ( icon != r2 && icon != p2 && icon != p3 ) + { + error = ERROR_PONTOP; + continue; + } + + cel.x += vector.x*2*nb; + cel.y += vector.y*2*nb; + + return 0; // ok + } + + return error; +} + +// Regarde s'il est possible de construire un bateau à partir +// d'une cellule donnée (cel). + +BOOL CDecor::IsBuildBateau(POINT cel, int &direct) +{ + int fChannel, fIcon; + int oChannel, oIcon; + + GetFloor (GetCel(cel,+2,0), fChannel, fIcon); + GetObject(GetCel(cel,+2,0), oChannel, oIcon); + if ( fChannel == CHFLOOR && fIcon == 2 && // rivage ? + oChannel == -1 && oIcon == -1 ) + { + direct = DIRECT_E; + return TRUE; + } + + GetFloor (GetCel(cel,-2,0), fChannel, fIcon); + GetObject(GetCel(cel,-2,0), oChannel, oIcon); + if ( fChannel == CHFLOOR && fIcon == 4 && // rivage ? + oChannel == -1 && oIcon == -1 ) + { + direct = DIRECT_O; + return TRUE; + } + + GetFloor (GetCel(cel,0,+2), fChannel, fIcon); + GetObject(GetCel(cel,0,+2), oChannel, oIcon); + if ( fChannel == CHFLOOR && fIcon == 3 && // rivage ? + oChannel == -1 && oIcon == -1 ) + { + direct = DIRECT_S; + return TRUE; + } + + GetFloor (GetCel(cel,0,-2), fChannel, fIcon); + GetObject(GetCel(cel,0,-2), oChannel, oIcon); + if ( fChannel == CHFLOOR && fIcon == 5 && // rivage ? + oChannel == -1 && oIcon == -1 ) + { + direct = DIRECT_N; + return TRUE; + } + + direct = -1; + return FALSE; +} + + +// Vide toutes les positions visitées. + +void CDecor::InitDrapeau() +{ + int i; + + for ( i=0 ; i0 ; i-- ) + { + m_lastDrapeau[i] = m_lastDrapeau[i-1]; + } + + m_lastDrapeau[0] = cel; +} + +// Supprime une cellule visitée (ne contenant pas de fer). + +void CDecor::SubDrapeau(POINT cel) +{ + int i; + + for ( i=0 ; i +#include +#include +#include +#include "def.h" +#include "pixmap.h" +#include "misc.h" +#include "ddutil.h" + + + +///////////////////////////////////////////////////////////////////////////// + + +// Constructeur. + +CPixmap::CPixmap() +{ + int i; + + m_bFullScreen = FALSE; + m_mouseType = MOUSETYPEGRA; + m_bDebug = TRUE; + m_bPalette = TRUE; + + m_mouseSprite = SPRITE_WAIT; + MouseHotSpot(); + m_mousePos.x = LXIMAGE/2; + m_mousePos.y = LYIMAGE/2; + m_mouseBackPos = m_mousePos; + m_bMouseBack = FALSE; + m_bMouseShow = TRUE; + m_bBackDisplayed = FALSE; + + m_lpDD = NULL; + m_lpDDSPrimary = NULL; + m_lpDDSBack = NULL; + m_lpDDSMouse = NULL; + m_lpDDPal = NULL; + m_lpClipper = NULL; + + for ( i=0 ; iRelease(); + m_lpDDSPrimary = NULL; + } + + if ( m_lpDDSBack != NULL ) + { + m_lpDDSBack->Release(); + m_lpDDSBack = NULL; + } + + if ( m_lpDDSMouse != NULL ) + { + m_lpDDSMouse->Release(); + m_lpDDSMouse = NULL; + } + + if ( m_lpDDPal != NULL ) + { + m_lpDDPal->Release(); + m_lpDDPal = NULL; + } + + for ( i=0 ; iRelease(); + m_lpDDSurface[i]= NULL; + } + } + + if ( m_lpClipper != NULL ) + { + m_lpClipper->Release(); + m_lpClipper = NULL; + } + + m_lpDD->Release(); + m_lpDD = NULL; + } +} + + +void CPixmap::SetDebug(BOOL bDebug) +{ + m_bDebug = bDebug; + DDSetDebug(bDebug); +} + + +// Crée l'objet DirectDraw principal. +// Retourne FALSE en cas d'erreur. + +BOOL CPixmap::Create(HWND hwnd, POINT dim, + BOOL bFullScreen, int mouseType) +{ + DDSURFACEDESC ddsd; + HRESULT ddrval; + POINT pos; + + m_hWnd = hwnd; + m_bFullScreen = bFullScreen; + m_mouseType = mouseType; + m_dim = dim; + + if ( m_mouseType == MOUSETYPEGRA ) + { + // Cache définitivement la vilaine souris Windows. + ShowCursor(FALSE); + + pos = m_mousePos; + ClientToScreen(m_hWnd, &pos); + SetCursorPos(pos.x, pos.y); // met la souris au centre + } + + m_clipRect.left = 0; + m_clipRect.top = 0; + m_clipRect.right = dim.x; + m_clipRect.bottom = dim.y; + + // Create the main DirectDraw object + ddrval = DirectDrawCreate(NULL, &m_lpDD, NULL); + if ( ddrval != DD_OK ) + { + OutputDebug("Fatal error: DirectDrawCreate\n"); + return FALSE; + } + + // Get exclusive mode. + if ( m_bFullScreen ) + { + ddrval = m_lpDD->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN); + } + else + { + ddrval = m_lpDD->SetCooperativeLevel(hwnd, DDSCL_NORMAL); + } + if ( ddrval != DD_OK ) + { + OutputDebug("Fatal error: SetCooperativeLevel\n"); + return FALSE; + } + + // Set the video mode to 640x480x8. + if ( m_bFullScreen ) + { + ddrval = m_lpDD->SetDisplayMode(dim.x, dim.y, 8); + if ( ddrval != DD_OK ) + { + OutputDebug("Fatal error: SetDisplayMode\n"); + return FALSE; + } + } + + // Create the primary surface with 1 back buffer. + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + ddrval = m_lpDD->CreateSurface(&ddsd, &m_lpDDSPrimary, NULL); + if ( ddrval != DD_OK ) + { + TraceErrorDD(ddrval, "pixmap", 0); + OutputDebug("Fatal error: CreateSurface\n"); + return FALSE; + } + + // Create the back buffer. + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH; +//? ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.dwWidth = dim.x; + ddsd.dwHeight = dim.y; + + ddrval = m_lpDD->CreateSurface(&ddsd, &m_lpDDSBack, NULL); + if ( ddrval != DD_OK ) + { + TraceErrorDD(ddrval, "pixmap", 0); + OutputDebug("Fatal error: CreateBackSurface\n"); + return FALSE; + } + + // Create the mouse buffer. + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH; +//? ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.dwWidth = DIMBLUPIX; + ddsd.dwHeight = DIMBLUPIY; + + ddrval = m_lpDD->CreateSurface(&ddsd, &m_lpDDSMouse, NULL); + if ( ddrval != DD_OK ) + { + TraceErrorDD(ddrval, "pixmap", 0); + OutputDebug("Fatal error: CreateMouseSurface\n"); + return FALSE; + } + + // Create a DirectDrawClipper object. The object enables clipping to the + // window boundaries in the IDirectDrawSurface::Blt function for the + // primary surface. + if ( !m_bFullScreen ) + { + ddrval = m_lpDD->CreateClipper(0, &m_lpClipper, NULL); + if ( ddrval != DD_OK ) + { + TraceErrorDD(ddrval, "pixmap", 0); + OutputDebug("Can't create clipper\n"); + return FALSE; + } + + ddrval = m_lpClipper->SetHWnd(0, hwnd); + if ( ddrval != DD_OK ) + { + TraceErrorDD(ddrval, "pixmap", 0); + OutputDebug("Can't set clipper window handle\n"); + return FALSE; + } + + ddrval = m_lpDDSPrimary->SetClipper(m_lpClipper); + if ( ddrval != DD_OK ) + { + TraceErrorDD(ddrval, "pixmap", 0); + OutputDebug("Can't attach clipper to primary surface\n"); + return FALSE; + } + } + + return TRUE; +} + +// Libère les bitmaps. + +BOOL CPixmap::Flush() +{ + return TRUE; +} + +// Restitue les bitmaps. + +BOOL CPixmap::Restore() +{ + RestoreAll(); + return TRUE; +} + +// Initialise la palette système. + +BOOL CPixmap::InitSysPalette() +{ + HDC hdc; + int caps; + + hdc = CreateCompatibleDC(NULL); + if ( hdc == NULL ) return FALSE; + + if ( !m_bFullScreen ) + { + caps = GetDeviceCaps(hdc, SIZEPALETTE); + if ( caps == 0 ) m_bPalette = FALSE; + else m_bPalette = TRUE; + } + + GetSystemPaletteEntries(hdc, 0, 256, m_sysPal); + DeleteDC(hdc); + return TRUE; +} + +// Indique si l'on utilise une palette. + +BOOL CPixmap::IsPalette() +{ + return m_bPalette; +} + + +// Rempli une zone rectangulaire avec une couleur uniforme. + +void CPixmap::Fill(RECT rect, COLORREF color) +{ + // à faire si nécessaire ... +} + + +// Restore all lost objects. + +HRESULT CPixmap::RestoreAll() +{ + if ( m_bDebug ) OutputDebug("CPixmap::RestoreAll\n"); + int i; + HRESULT ddrval; + + if ( m_lpDDSPrimary && m_lpDDSPrimary->IsLost() ) + { + ddrval = m_lpDDSPrimary->Restore(); +// if( ddrval != DD_OK ) return ddrval; + } + + if ( m_lpDDSBack && m_lpDDSBack->IsLost() ) + { + ddrval = m_lpDDSBack->Restore(); +// if( ddrval != DD_OK ) return ddrval; + } + + if ( m_lpDDSMouse && m_lpDDSMouse->IsLost() ) + { + ddrval = m_lpDDSMouse->Restore(); +// if( ddrval != DD_OK ) return ddrval; + } + + for ( i=0 ; iIsLost() ) + { + ddrval = m_lpDDSurface[i]->Restore(); + if( ddrval == DD_OK ) + { + DDReLoadBitmap(m_lpDDSurface[i], m_filename[i]); + } + } + } + return DD_OK; +} + +// Effectue un appel BltFast. +// Les modes sont 0=transparent, 1=opaque. + +HRESULT CPixmap::BltFast(int chDst, int channel, + POINT dst, RECT rcRect, int mode) +{ + DWORD dwTrans; + HRESULT ddrval; + int limit; + + if ( mode == 0 ) dwTrans = DDBLTFAST_SRCCOLORKEY; + else dwTrans = DDBLTFAST_NOCOLORKEY; + + // Effectue un peu de clipping. + if ( dst.x < m_clipRect.left ) + { + rcRect.left += m_clipRect.left-dst.x; + dst.x = m_clipRect.left; + } + limit = (m_clipRect.right-dst.x)+rcRect.left; + if ( rcRect.right > limit ) + { + rcRect.right = limit; + } + if ( dst.y < m_clipRect.top ) + { + rcRect.top += m_clipRect.top-dst.y; + dst.y = m_clipRect.top; + } + limit = (m_clipRect.bottom-dst.y)+rcRect.top; + if ( rcRect.bottom > limit ) + { + rcRect.bottom = limit; + } + + if ( rcRect.left >= rcRect.right || + rcRect.top >= rcRect.bottom ) return DD_OK; + + while( TRUE ) + { + if ( chDst < 0 ) + { + ddrval = m_lpDDSBack->BltFast(dst.x, dst.y, + m_lpDDSurface[channel], + &rcRect, dwTrans); + } + else + { + ddrval = m_lpDDSurface[chDst]->BltFast(dst.x, dst.y, + m_lpDDSurface[channel], + &rcRect, dwTrans); + } + if ( ddrval == DD_OK ) break; + + if ( ddrval == DDERR_SURFACELOST ) + { + ddrval = RestoreAll(); + if ( ddrval != DD_OK ) break; + } + + if ( ddrval != DDERR_WASSTILLDRAWING ) break; + } + + return ddrval; +} + +// Effectue un appel BltFast. +// Les modes sont 0=transparent, 1=opaque. + +HRESULT CPixmap::BltFast(LPDIRECTDRAWSURFACE lpDD, + int channel, POINT dst, RECT rcRect, int mode) +{ + DWORD dwTrans; + HRESULT ddrval; + + if ( mode == 0 ) dwTrans = DDBLTFAST_SRCCOLORKEY; + else dwTrans = DDBLTFAST_NOCOLORKEY; + + while( TRUE ) + { + ddrval = lpDD->BltFast(dst.x, dst.y, + m_lpDDSurface[channel], + &rcRect, dwTrans); + if ( ddrval == DD_OK ) break; + + if ( ddrval == DDERR_SURFACELOST ) + { + ddrval = RestoreAll(); + if ( ddrval != DD_OK ) break; + } + + if ( ddrval != DDERR_WASSTILLDRAWING ) break; + } + + return ddrval; +} + + +// Sauve toute la palette de couleurs. + +BOOL CPixmap::SavePalette() +{ + HRESULT ddrval; + + if ( m_lpDDPal == NULL ) return FALSE; + + ddrval = m_lpDDPal->GetEntries(0, 0, 256, m_pal); + + if ( ddrval != DD_OK ) return FALSE; + return TRUE; +} + +// Restitue toute la palette de couleurs. + +BOOL CPixmap::RestorePalette() +{ + HRESULT ddrval; + + ddrval = m_lpDDPal->SetEntries(0, 0, 256, m_pal); + + if ( ddrval != DD_OK ) return FALSE; + return TRUE; +} + +// Cherche une couleur dans la palette principale. +// En mode plein écran, il faut chercher dans la palette +// correspondant aux images (obtenue avec SavePalette), +// alors qu'en mode fenêtre, il faut chercher dans la +// palette système (obtenue avec InitSysPalette) !!! + +int CPixmap::SearchColor(int red, int green, int blue) +{ + int i, j, delta, min; + + if ( m_bFullScreen ) + { + for ( i=0 ; i<256 ; i++ ) + { + if ( red == m_pal[i].peRed && + green == m_pal[i].peGreen && + blue == m_pal[i].peBlue ) return i; + } + + // Cherche la couleur la plus proche. + min = 10000; + j = -1; + for ( i=0 ; i<256 ; i++ ) + { + delta = abs(red - m_pal[i].peRed )+ + abs(green - m_pal[i].peGreen)+ + abs(blue - m_pal[i].peBlue ); + + if ( delta < min ) + { + min = delta; + j = i; + } + } + } + else + { + if ( m_bPalette ) + { + for ( i=0 ; i<256 ; i++ ) + { + if ( red == m_sysPal[i].peRed && + green == m_sysPal[i].peGreen && + blue == m_sysPal[i].peBlue ) return i; + } + + // Cherche la couleur la plus proche. + min = 10000; + j = -1; + for ( i=0 ; i<256 ; i++ ) + { + delta = abs(red - m_sysPal[i].peRed )+ + abs(green - m_sysPal[i].peGreen)+ + abs(blue - m_sysPal[i].peBlue ); + + if ( delta < min ) + { + min = delta; + j = i; + } + } + } + else + { + j = (blue >>3) &0x001F; + j |= ((green>>2)<< 5)&0x07E0; + j |= ((red >>3)<<11)&0xF800; // mode 5-6-5 +//? j = (blue >>3) &0x001F; +//? j |= ((green>>3)<< 5)&0x03E0; +//? j |= ((red >>3)<<10)&0x7C00; // mode 5-5-5 + } + } + return j; +} + + +// Cache une image contenant des icônes. + +BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, + BOOL bUsePalette) +{ + HRESULT ddrval; + + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + + if ( m_lpDDSurface[channel] != NULL ) + { + Flush(channel); + } + + // Create and set the palette. + if ( bUsePalette ) + { + if ( m_bDebug ) OutputDebug("Use palette\n"); + if ( m_lpDDPal != NULL ) + { + if ( m_bDebug ) OutputDebug("Release palette\n"); + m_lpDDPal->Release(); + m_lpDDPal = NULL; + } + + m_lpDDPal = DDLoadPalette(m_lpDD, pFilename); + + if ( m_lpDDPal ) + { + if ( m_bDebug ) OutputDebug("Set palette\n"); + m_lpDDSPrimary->SetPalette(NULL); // indispensable ! + ddrval = m_lpDDSPrimary->SetPalette(m_lpDDPal); + if ( ddrval != DD_OK ) + { + TraceErrorDD(ddrval, pFilename, 1); + } + } + } + + // Create the offscreen surface, by loading our bitmap. + m_lpDDSurface[channel] = DDLoadBitmap(m_lpDD, pFilename, 0, 0); + + if ( m_lpDDSurface[channel] == NULL ) + { + OutputDebug("Fatal error: DDLoadBitmap\n"); + return FALSE; + } + + // Set the color key to white + if ( m_bDebug ) OutputDebug("DDSetColorKey\n"); + DDSetColorKey(m_lpDDSurface[channel], RGB(255,255,255)); // blanc + + strcpy(m_filename[channel], pFilename); + + m_totalDim[channel] = totalDim; + m_iconDim[channel] = iconDim; + + return TRUE; +} + +// Cache une image globale. + +BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, BOOL bUsePalette) +{ + POINT iconDim; + + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + + iconDim.x = 0; + iconDim.y = 0; + + return Cache(channel, pFilename, totalDim, iconDim, bUsePalette); +} + +// Cache une image provenant d'un bitmap. + +BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim) +{ + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + + if ( m_lpDDSurface[channel] != NULL ) + { + Flush(channel); + } + + // Create the offscreen surface, by loading our bitmap. + m_lpDDSurface[channel] = DDConnectBitmap(m_lpDD, hbm); + + if ( m_lpDDSurface[channel] == NULL ) + { + OutputDebug("Fatal error: DDLoadBitmap\n"); + return FALSE; + } + + // Set the color key to white + DDSetColorKey(m_lpDDSurface[channel], RGB(255,255,255)); // blanc + + m_totalDim[channel] = totalDim; + m_iconDim[channel] = totalDim; + + return TRUE; +} + +// Purge une image. + +void CPixmap::Flush(int channel) +{ + if ( channel < 0 || channel >= MAXIMAGE ) return; + if ( m_lpDDSurface[channel] == NULL ) return; + + m_lpDDSurface[channel]->Release(); + m_lpDDSurface[channel]= NULL; +} + +// Définition de la couleur transparente. + +void CPixmap::SetTransparent(int channel, COLORREF color) +{ + if ( channel < 0 || channel >= MAXIMAGE ) return; + if ( m_lpDDSurface[channel] == NULL ) return; + + DDSetColorKey(m_lpDDSurface[channel], color); + m_colorSurface[2*channel+0] = color; + m_colorSurface[2*channel+1] = color; +} + +// Définition de la couleur transparente. + +void CPixmap::SetTransparent2(int channel, COLORREF color1, COLORREF color2) +{ + if ( channel < 0 || channel >= MAXIMAGE ) return; + if ( m_lpDDSurface[channel] == NULL ) return; + + DDSetColorKey2(m_lpDDSurface[channel], color1, color2); + m_colorSurface[2*channel+0] = color1; + m_colorSurface[2*channel+1] = color2; +} + + +// Modifie la région de clipping. + +void CPixmap::SetClipping(RECT clip) +{ + m_clipRect = clip; +} + +// Retourne la région de clipping. + +RECT CPixmap::GetClipping() +{ + return m_clipRect; +} + + +// Teste si un point fait partie d'une icône. + +BOOL CPixmap::IsIconPixel(int channel, int rank, POINT pos) +{ + int nbx, nby; + COLORREF rgb; + HDC hDC; + + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( m_lpDDSurface[channel] == NULL ) return FALSE; + + if ( m_iconDim[channel].x == 0 || + m_iconDim[channel].y == 0 ) return FALSE; + + nbx = m_totalDim[channel].x / m_iconDim[channel].x; + nby = m_totalDim[channel].y / m_iconDim[channel].y; + + if ( rank < 0 || rank >= nbx*nby ) return FALSE; + + pos.x += (rank%nbx)*m_iconDim[channel].x; + pos.y += (rank/nbx)*m_iconDim[channel].y; + + if ( m_lpDDSurface[channel]->GetDC(&hDC) != DD_OK ) return FALSE; + rgb = GetPixel(hDC, pos.x, pos.y); + m_lpDDSurface[channel]->ReleaseDC(hDC); + + if ( rgb == m_colorSurface[2*channel+0] || + rgb == m_colorSurface[2*channel+1] ) return FALSE; + + return TRUE; +} + + +// Dessine une partie d'image rectangulaire. +// Les modes sont 0=transparent, 1=opaque. + +BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, + int mode, BOOL bMask) +{ + int nbx, nby; + RECT rect; + HRESULT ddrval; + COLORREF oldColor1, oldColor2; + + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( m_lpDDSurface[channel] == NULL ) return FALSE; + + if ( m_iconDim[channel].x == 0 || + m_iconDim[channel].y == 0 ) return FALSE; + + nbx = m_totalDim[channel].x / m_iconDim[channel].x; + nby = m_totalDim[channel].y / m_iconDim[channel].y; + + if ( rank < 0 || rank >= nbx*nby ) return FALSE; + + rect.left = (rank%nbx)*m_iconDim[channel].x; + rect.top = (rank/nbx)*m_iconDim[channel].y; + rect.right = rect.left + m_iconDim[channel].x; + rect.bottom = rect.top + m_iconDim[channel].y; + + oldColor1 = m_colorSurface[2*channel+0]; + oldColor2 = m_colorSurface[2*channel+1]; + if ( bMask ) SetTransparent(channel, RGB(255,255,255)); // blanc + ddrval = BltFast(chDst, channel, pos, rect, mode); + if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); + + if ( ddrval != DD_OK ) return FALSE; + return TRUE; +} + +// Dessine une partie d'image rectangulaire. +// Les modes sont 0=transparent, 1=opaque. +// +// Correspondances in,out : +// 0,0 2,1 ... +// 1,16 3,17 +// +// 32,32 34,33 +// 33,48 35,49 + +BOOL CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos, + int mode, BOOL bMask) +{ + int nbx, nby; + RECT rect; + HRESULT ddrval; + COLORREF oldColor1, oldColor2; + + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( m_lpDDSurface[channel] == NULL ) return FALSE; + + if ( m_iconDim[channel].x == 0 || + m_iconDim[channel].y == 0 ) return FALSE; + + nbx = m_totalDim[channel].x / m_iconDim[channel].x; + nby = m_totalDim[channel].y / (m_iconDim[channel].y/2); + + rank = (rank/32)*32+((rank%32)/2)+((rank%2)*16); + + if ( rank < 0 || rank >= nbx*nby ) return FALSE; + + rect.left = (rank%nbx)* m_iconDim[channel].x; + rect.top = (rank/nbx)*(m_iconDim[channel].y/2); + rect.right = rect.left + m_iconDim[channel].x; + rect.bottom = rect.top +(m_iconDim[channel].y/2); + + oldColor1 = m_colorSurface[2*channel+0]; + oldColor2 = m_colorSurface[2*channel+1]; + if ( bMask ) SetTransparent(channel, RGB(255,255,255)); // blanc + ddrval = BltFast(chDst, channel, pos, rect, mode); + if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); + + if ( ddrval != DD_OK ) return FALSE; + return TRUE; +} + +// Dessine une partie d'image rectangulaire. +// Les modes sont 0=transparent, 1=opaque. + +BOOL CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos, + int startY, int endY, + int mode, BOOL bMask) +{ + int nbx, nby; + RECT rect; + HRESULT ddrval; + COLORREF oldColor1, oldColor2; + + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( m_lpDDSurface[channel] == NULL ) return FALSE; + + if ( m_iconDim[channel].x == 0 || + m_iconDim[channel].y == 0 ) return FALSE; + + nbx = m_totalDim[channel].x / m_iconDim[channel].x; + nby = m_totalDim[channel].y / m_iconDim[channel].y; + + if ( rank < 0 || rank >= nbx*nby ) return FALSE; + + rect.left = (rank%nbx)*m_iconDim[channel].x; + rect.top = (rank/nbx)*m_iconDim[channel].y; + rect.right = rect.left + m_iconDim[channel].x; + rect.bottom = rect.top + endY; + + pos.y += startY; + rect.top += startY; + + oldColor1 = m_colorSurface[2*channel+0]; + oldColor2 = m_colorSurface[2*channel+1]; + if ( bMask ) SetTransparent(channel, RGB(255,255,255)); // blanc + ddrval = BltFast(chDst, channel, pos, rect, mode); + if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); + + if ( ddrval != DD_OK ) return FALSE; + return TRUE; +} + +// Dessine une partie d'image n'importe où. +// Les modes sont 0=transparent, 1=opaque. + +BOOL CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect, + int mode, BOOL bMask) +{ + HRESULT ddrval; + COLORREF oldColor1, oldColor2; + + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( m_lpDDSurface[channel] == NULL ) return FALSE; + + oldColor1 = m_colorSurface[2*channel+0]; + oldColor2 = m_colorSurface[2*channel+1]; + if ( bMask ) SetTransparent(channel, RGB(255,255,255)); // blanc + ddrval = BltFast(chDst, channel, dest, rect, mode); + if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); + + if ( ddrval != DD_OK ) return FALSE; + return TRUE; +} + +// Dessine une partie d'image rectangulaire. +// Les modes sont 0=transparent, 1=opaque. + +BOOL CPixmap::DrawImage(int chDst, int channel, RECT rect, int mode) +{ + POINT dst; + HRESULT ddrval; + + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( m_lpDDSurface[channel] == NULL ) return FALSE; + + dst.x = rect.left; + dst.y = rect.top; + + ddrval = BltFast(chDst, channel, dst, rect, mode); + + if ( ddrval != DD_OK ) return FALSE; + + if ( channel == CHBACK ) + { + MouseBackSave(); // sauve ce qui sera sous la souris + m_bBackDisplayed = FALSE; + } + + return TRUE; +} + + +// Construit une icône en utilisant un masque. + +BOOL CPixmap::BuildIconMask(int channelMask, int rankMask, + int channel, int rankSrc, int rankDst) +{ + int nbx, nby; + POINT posDst; + RECT rect; + HRESULT ddrval; + + if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( m_lpDDSurface[channel] == NULL ) return FALSE; + + if ( m_iconDim[channel].x == 0 || + m_iconDim[channel].y == 0 ) return FALSE; + + nbx = m_totalDim[channel].x / m_iconDim[channel].x; + nby = m_totalDim[channel].y / m_iconDim[channel].y; + + if ( rankSrc < 0 || rankSrc >= nbx*nby ) return FALSE; + if ( rankDst < 0 || rankDst >= nbx*nby ) return FALSE; + + rect.left = (rankSrc%nbx)*m_iconDim[channel].x; + rect.top = (rankSrc/nbx)*m_iconDim[channel].y; + rect.right = rect.left + m_iconDim[channel].x; + rect.bottom = rect.top + m_iconDim[channel].y; + posDst.x = (rankDst%nbx)*m_iconDim[channel].x; + posDst.y = (rankDst/nbx)*m_iconDim[channel].y; + ddrval = BltFast(m_lpDDSurface[channel], channel, posDst, rect, 1); + if ( ddrval != DD_OK ) return FALSE; + + if ( m_iconDim[channelMask].x == 0 || + m_iconDim[channelMask].y == 0 ) return FALSE; + + nbx = m_totalDim[channelMask].x / m_iconDim[channelMask].x; + nby = m_totalDim[channelMask].y / m_iconDim[channelMask].y; + + if ( rankMask < 0 || rankMask >= nbx*nby ) return FALSE; + + rect.left = (rankMask%nbx)*m_iconDim[channelMask].x; + rect.top = (rankMask/nbx)*m_iconDim[channelMask].y; + rect.right = rect.left + m_iconDim[channelMask].x; + rect.bottom = rect.top + m_iconDim[channelMask].y; + ddrval = BltFast(m_lpDDSurface[channel], channelMask, posDst, rect, 0); + if ( ddrval != DD_OK ) return FALSE; + + return TRUE; +} + + +// Affiche le pixmap à l'écran. +// Retourne FALSE en cas d'erreur. + +BOOL CPixmap::Display() +{ + HRESULT ddrval; + RECT DestRect, MapRect; + + m_bBackDisplayed = TRUE; + + // Get screen coordinates of client window for blit + GetClientRect(m_hWnd, &DestRect); + ClientToScreen(m_hWnd, (LPPOINT)&DestRect); + ClientToScreen(m_hWnd, (LPPOINT)&DestRect+1); + + MapRect.left = 0; + MapRect.top = 0; + MapRect.right = m_dim.x; + MapRect.bottom = m_dim.y; + + // do the blit from back surface + ddrval = m_lpDDSPrimary->Blt + ( + &DestRect, // destination rect + m_lpDDSBack, + &MapRect, // source rect + DDBLT_WAIT, + &m_DDbltfx + ); + if ( ddrval == DDERR_SURFACELOST ) + { + ddrval = RestoreAll(); + } + if ( ddrval != DD_OK ) return FALSE; + return TRUE; +} + + +// Positionne la souris et change le lutin. + +void CPixmap::SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay) +{ + if ( m_mousePos.x == pos.x && + m_mousePos.y == pos.y && + m_mouseSprite == sprite ) return; + + m_mousePos = pos; + m_mouseSprite = sprite; + MouseHotSpot(); + + if ( !bDemoPlay ) + { + MouseUpdate(); + } +} + +// Positionne la souris. + +void CPixmap::SetMousePos(POINT pos, BOOL bDemoPlay) +{ + if ( m_mousePos.x == pos.x && + m_mousePos.y == pos.y ) return; + + m_mousePos = pos; + + if ( !bDemoPlay ) + { + MouseUpdate(); + } +} + +// Change le lutin de la souris. + +void CPixmap::SetMouseSprite(int sprite, BOOL bDemoPlay) +{ + if ( m_mouseSprite == sprite ) return; + + m_mouseSprite = sprite; + MouseHotSpot(); + + if ( !bDemoPlay ) + { + MouseUpdate(); + } +} + +// Montre ou cache la souris. + +void CPixmap::MouseShow(BOOL bShow) +{ + m_bMouseShow = bShow; +} + +// Met à jour le dessin de la souris. + +void CPixmap::MouseUpdate() +{ + RECT oldRect, newRect, rcRect; + + if ( m_lpDDSurface[CHBLUPI] == NULL ) return; + if ( m_mouseType != MOUSETYPEGRA ) return; + if ( m_mouseSprite == SPRITE_EMPTY ) return; + if ( !m_bMouseShow ) return; + + oldRect.left = m_mouseBackPos.x; + oldRect.top = m_mouseBackPos.y; + oldRect.right = m_mouseBackPos.x + DIMBLUPIX; + oldRect.bottom = m_mouseBackPos.y + DIMBLUPIY; + + newRect.left = m_mousePos.x - m_mouseHotSpot.x; + newRect.top = m_mousePos.y - m_mouseHotSpot.y; + newRect.right = newRect.left + DIMBLUPIX; + newRect.bottom = newRect.top + DIMBLUPIY; + + MouseBackRestore(); // enlève la souris dans m_lpDDSBack + MouseBackDraw(); // dessine la souris dans m_lpDDSBack + + if ( m_bBackDisplayed ) + { + if ( IntersectRect(&rcRect, &oldRect, &newRect) ) + { + UnionRect(&rcRect, &oldRect, &newRect); + MouseQuickDraw(rcRect); + } + else + { + MouseQuickDraw(oldRect); + MouseQuickDraw(newRect); + } + } +} + +// Dessine rapidement la souris dans l'écran. +// Il s'agit en fait de dessiner un petit morceau rectangulaire +// de m_lpDDSBack dans l'écran. + +BOOL CPixmap::MouseQuickDraw(RECT rect) +{ + HRESULT ddrval; + RECT DestRect; + + if ( rect.left < 0 ) rect.left = 0; + if ( rect.right > LXIMAGE ) rect.right = LXIMAGE; + if ( rect.top < 0 ) rect.top = 0; + if ( rect.bottom > LYIMAGE ) rect.bottom = LYIMAGE; + + // Get screen coordinates of client window for blit + DestRect = rect; + ClientToScreen(m_hWnd, (LPPOINT)&DestRect); + ClientToScreen(m_hWnd, (LPPOINT)&DestRect+1); + + // do the blit from back surface + ddrval = m_lpDDSPrimary->Blt + ( + &DestRect, // destination rect + m_lpDDSBack, + &rect, // source rect + DDBLT_WAIT, + &m_DDbltfx + ); + if ( ddrval == DDERR_SURFACELOST ) + { + ddrval = RestoreAll(); + } + if ( ddrval != DD_OK ) return FALSE; + return TRUE; +} + +// Invalide la copie sous la souris. + +void CPixmap::MouseInvalidate() +{ + m_bMouseBack = FALSE; +} + +// Enlève la souris dans m_lpDDSBack. + +void CPixmap::MouseBackClear() +{ + if ( m_mouseType != MOUSETYPEGRA ) return; + MouseBackRestore(); // enlève la souris dans m_lpDDSBack +} + +// Dessine la souris dans m_lpDDSBack. + +void CPixmap::MouseBackDraw() +{ + POINT dst; + RECT rcRect; + + if ( m_lpDDSurface[CHBLUPI] == NULL ) return; + if ( m_mouseType != MOUSETYPEGRA ) return; + if ( m_mouseSprite == SPRITE_EMPTY ) return; + if ( !m_bMouseShow ) return; + + MouseBackSave(); // sauve ce qui sera sous la souris + + dst.x = m_mousePos.x - m_mouseHotSpot.x; + dst.y = m_mousePos.y - m_mouseHotSpot.y; + rcRect = MouseRectSprite(); + + if ( dst.x < 0 ) + { + rcRect.left -= dst.x; + dst.x = 0; + } + if ( dst.x+DIMBLUPIX > LXIMAGE ) + { + rcRect.right -= (dst.x+DIMBLUPIX)-LXIMAGE; + } + if ( dst.y < 0 ) + { + rcRect.top -= dst.y; + dst.y = 0; + } + if ( dst.y+DIMBLUPIY > LYIMAGE ) + { + rcRect.bottom -= (dst.y+DIMBLUPIY)-LYIMAGE; + } + + // Dessine le lutin dans m_lpDDSBack. + BltFast(m_lpDDSBack, CHBLUPI, dst, rcRect, 0); +} + +// Sauve le fond sous la souris. +// m_lpDDSMouse <- m_lpDDSBack + +void CPixmap::MouseBackSave() +{ + HRESULT ddrval; + POINT dst; + RECT rcRect; + + if ( m_lpDDSurface[CHBLUPI] == NULL ) return; + if ( m_mouseType != MOUSETYPEGRA ) return; + if ( m_mouseSprite == SPRITE_EMPTY ) return; + if ( !m_bMouseShow ) return; + + m_mouseBackPos.x = m_mousePos.x - m_mouseHotSpot.x; + m_mouseBackPos.y = m_mousePos.y - m_mouseHotSpot.y; + m_bMouseBack = TRUE; + + dst.x = 0; + dst.y = 0; + + rcRect.left = m_mouseBackPos.x; + rcRect.top = m_mouseBackPos.y; + rcRect.right = m_mouseBackPos.x + DIMBLUPIX; + rcRect.bottom = m_mouseBackPos.y + DIMBLUPIY; + + if ( rcRect.left < 0 ) + { + dst.x -= rcRect.left; + rcRect.left = 0; + } + if ( rcRect.right > LXIMAGE ) + { + rcRect.right = LXIMAGE; + } + if ( rcRect.top < 0 ) + { + dst.y -= rcRect.top; + rcRect.top = 0; + } + if ( rcRect.bottom > LYIMAGE ) + { + rcRect.bottom = LYIMAGE; + } + + while( TRUE ) + { + ddrval = m_lpDDSMouse->BltFast(dst.x, dst.y, + m_lpDDSBack, + &rcRect, DDBLTFAST_NOCOLORKEY); + if ( ddrval == DD_OK ) break; + + if ( ddrval == DDERR_SURFACELOST ) + { + ddrval = RestoreAll(); + if ( ddrval != DD_OK ) break; + } + + if ( ddrval != DDERR_WASSTILLDRAWING ) break; + } +} + +// Restitue le fond sous la souris. +// m_lpDDSBack <- m_lpDDSMouse + +void CPixmap::MouseBackRestore() +{ + HRESULT ddrval; + POINT dst; + RECT rcRect; + + if ( m_lpDDSurface[CHBLUPI] == NULL ) return; + if ( !m_bMouseBack ) return; + + dst.x = m_mouseBackPos.x; + dst.y = m_mouseBackPos.y; + + rcRect.left = 0; + rcRect.top = 0; + rcRect.right = DIMBLUPIX; + rcRect.bottom = DIMBLUPIY; + + if ( dst.x < 0 ) + { + rcRect.left -= dst.x; + dst.x = 0; + } + if ( dst.x+DIMBLUPIX > LXIMAGE ) + { + rcRect.right -= (dst.x+DIMBLUPIX)-LXIMAGE; + } + if ( dst.y < 0 ) + { + rcRect.top -= dst.y; + dst.y = 0; + } + if ( dst.y+DIMBLUPIY > LYIMAGE ) + { + rcRect.bottom -= (dst.y+DIMBLUPIY)-LYIMAGE; + } + + while( TRUE ) + { + ddrval = m_lpDDSBack->BltFast(dst.x, dst.y, + m_lpDDSMouse, + &rcRect, DDBLTFAST_NOCOLORKEY); + if ( ddrval == DD_OK ) break; + + if ( ddrval == DDERR_SURFACELOST ) + { + ddrval = RestoreAll(); + if ( ddrval != DD_OK ) break; + } + + if ( ddrval != DDERR_WASSTILLDRAWING ) break; + } +} + +// Affiche le contenu de m_lpDDSMouse dans le +// coin sup/gauche. + +void CPixmap::MouseBackDebug() +{ + HRESULT ddrval; + RECT DestRect, MapRect; + + // Get screen coordinates of client window for blit + GetClientRect(m_hWnd, &DestRect); + ClientToScreen(m_hWnd, (LPPOINT)&DestRect); + ClientToScreen(m_hWnd, (LPPOINT)&DestRect+1); + + MapRect.left = 0; + MapRect.top = 0; + MapRect.right = DIMBLUPIX; + MapRect.bottom = DIMBLUPIY; + + DestRect.right = DestRect.left + DIMBLUPIX; + DestRect.bottom = DestRect.top + DIMBLUPIY; + + // do the blit from back surface + ddrval = m_lpDDSPrimary->Blt + ( + &DestRect, // destination rect + m_lpDDSMouse, + &MapRect, // source rect + DDBLT_WAIT, + &m_DDbltfx + ); + if ( ddrval == DDERR_SURFACELOST ) + { + ddrval = RestoreAll(); + } +} + +// Retourne le rectangle correspondant au sprite +// de la souris dans CHBLUPI. + +RECT CPixmap::MouseRectSprite() +{ + int rank, nbx; + RECT rcRect; + + rank = 348; + if ( m_mouseSprite == SPRITE_ARROW ) rank = 348; + if ( m_mouseSprite == SPRITE_POINTER ) rank = 349; + if ( m_mouseSprite == SPRITE_MAP ) rank = 350; + if ( m_mouseSprite == SPRITE_WAIT ) rank = 351; + if ( m_mouseSprite == SPRITE_FILL ) rank = 352; + if ( m_mouseSprite == SPRITE_ARROWL ) rank = 353; + if ( m_mouseSprite == SPRITE_ARROWR ) rank = 354; + if ( m_mouseSprite == SPRITE_ARROWU ) rank = 355; + if ( m_mouseSprite == SPRITE_ARROWD ) rank = 356; + if ( m_mouseSprite == SPRITE_ARROWDL ) rank = 357; + if ( m_mouseSprite == SPRITE_ARROWDR ) rank = 358; + if ( m_mouseSprite == SPRITE_ARROWUL ) rank = 359; + if ( m_mouseSprite == SPRITE_ARROWUR ) rank = 360; + + nbx = m_totalDim[CHBLUPI].x / m_iconDim[CHBLUPI].x; + + rcRect.left = (rank%nbx)*m_iconDim[CHBLUPI].x; + rcRect.top = (rank/nbx)*m_iconDim[CHBLUPI].y; + rcRect.right = rcRect.left+m_iconDim[CHBLUPI].x; + rcRect.bottom = rcRect.top +m_iconDim[CHBLUPI].y; + + return rcRect; +} + +// Initialise le hot spot selon le sprite en cours. + +void CPixmap::MouseHotSpot() +{ + int rank; + + static int table_mouse_hotspot[14*2] = + { + 30, 30, // SPRITE_ARROW + 20, 15, // SPRITE_POINTER + 31, 26, // SPRITE_MAP + 25, 14, // SPRITE_ARROWU + 24, 35, // SPRITE_ARROWD + 15, 24, // SPRITE_ARROWL + 35, 24, // SPRITE_ARROWR + 18, 16, // SPRITE_ARROWUL + 32, 18, // SPRITE_ARROWUR + 17, 30, // SPRITE_ARROWDL + 32, 32, // SPRITE_ARROWDR + 30, 30, // SPRITE_WAIT + 30, 30, // SPRITE_EMPTY + 21, 51, // SPRITE_FILL + }; + + if ( m_mouseSprite >= SPRITE_ARROW && + m_mouseSprite <= SPRITE_FILL ) + { + rank = m_mouseSprite - SPRITE_ARROW; // rank <- 0..n + + m_mouseHotSpot.x = table_mouse_hotspot[rank*2+0]; + m_mouseHotSpot.y = table_mouse_hotspot[rank*2+1]; + } + else + { + m_mouseHotSpot.x = 0; + m_mouseHotSpot.y = 0; + } +} + + diff --git a/pixmap.h b/pixmap.h new file mode 100644 index 0000000..3c314a0 --- /dev/null +++ b/pixmap.h @@ -0,0 +1,108 @@ +// CPixmap.h + +#pragma once + +#include + +///////////////////////////////////////////////////////////////////////////// + +#define MAXIMAGE 100 + + +class CPixmap +{ +public: + CPixmap(); + ~CPixmap(); + + void SetDebug(BOOL bDebug); + + BOOL Create(HWND hwnd, POINT dim, BOOL bFullScreen, int mouseType); + BOOL Flush(); + BOOL Restore(); + BOOL InitSysPalette(); + BOOL IsPalette(); + void Fill(RECT rect, COLORREF color); + + BOOL SavePalette(); + BOOL RestorePalette(); + int SearchColor(int red, int green, int blue); + BOOL Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette); + BOOL Cache(int channel, char *pFilename, POINT totalDim, BOOL bUsePalette); + BOOL Cache(int channel, HBITMAP hbm, POINT totalDim); + void Flush(int channel); + void SetTransparent(int channel, COLORREF color); + void SetTransparent2(int channel, COLORREF color1, COLORREF color2); + void SetClipping(RECT clip); + RECT GetClipping(); + + BOOL IsIconPixel(int channel, int rank, POINT pos); + + BOOL DrawIcon(int chDst, int channel, int rank, POINT pos, int mode=0, BOOL bMask=FALSE); + BOOL DrawIconDemi(int chDst, int channel, int rank, POINT pos, int mode=0, BOOL bMask=FALSE); + BOOL DrawIconPart(int chDst, int channel, int rank, POINT pos, int startY, int endY, int mode=0, BOOL bMask=FALSE); + BOOL DrawPart(int chDst, int channel, POINT dest, RECT rect, int mode=0, BOOL bMask=FALSE); + BOOL DrawImage(int chDst, int channel, RECT rect, int mode=0); + + BOOL BuildIconMask(int channelMask, int rankMask, + int channel, int rankSrc, int rankDst); + + BOOL Display(); + + void SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay); + void SetMousePos(POINT pos, BOOL bDemoPlay); + void SetMouseSprite(int sprite, BOOL bDemoPlay); + void MouseShow(BOOL bShow); + void MouseInvalidate(); + void MouseBackClear(); + void MouseBackDraw(); + +protected: + HRESULT RestoreAll(); + HRESULT BltFast(int chDst, int channel, POINT dst, RECT rcRect, int mode); + HRESULT BltFast(LPDIRECTDRAWSURFACE lpDD, + int channel, POINT dst, RECT rcRect, int mode); + + void MouseUpdate(); + BOOL MouseQuickDraw(RECT rect); + void MouseBackSave(); + void MouseBackRestore(); + void MouseBackDebug(); + RECT MouseRectSprite(); + void MouseHotSpot(); + +protected: + BOOL m_bFullScreen; + int m_mouseType; + BOOL m_bDebug; + BOOL m_bPalette; + HWND m_hWnd; + POINT m_dim; // dimensions totales + RECT m_clipRect; // rectangle de clipping + + POINT m_mousePos; + int m_mouseSprite; + POINT m_mouseHotSpot; + POINT m_mouseBackPos; + BOOL m_bMouseBack; + BOOL m_bMouseShow; + BOOL m_bBackDisplayed; + + LPDIRECTDRAW m_lpDD; // DirectDraw object + LPDIRECTDRAWSURFACE m_lpDDSPrimary; // DirectDraw primary surface + LPDIRECTDRAWSURFACE m_lpDDSBack; // DirectDraw back surface + LPDIRECTDRAWSURFACE m_lpDDSMouse; // DirectDraw back surface + LPDIRECTDRAWPALETTE m_lpDDPal; // the primary surface palette + LPDIRECTDRAWSURFACE m_lpDDSurface[MAXIMAGE]; // offscreen surfaces + LPDIRECTDRAWCLIPPER m_lpClipper; + PALETTEENTRY m_pal[256]; // sauvegarde palette + PALETTEENTRY m_sysPal[256]; // sauvegarde palette + COLORREF m_colorSurface[2*MAXIMAGE]; + + char m_filename[MAXIMAGE][20]; + POINT m_totalDim[MAXIMAGE]; // dimensions totale image + POINT m_iconDim[MAXIMAGE]; // dimensions d'une icône + DDBLTFX m_DDbltfx; +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..8e685d0 --- /dev/null +++ b/resource.h @@ -0,0 +1,282 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Blupi.rc +// +#define TX_ACTION_GO 1 +#define TX_ACTION_STOP 2 +#define TX_ACTION_MANGE 3 +#define TX_ACTION_CARRY 4 +#define TX_ACTION_DEPOSE 5 +#define TX_ACTION_ABAT 6 +#define TX_ACTION_ROC 7 +#define TX_ACTION_CULTIVE 8 +#define TX_ACTION_BUILD1 9 +#define TX_ACTION_BUILD2 10 +#define TX_ACTION_BUILD3 11 +#define TX_ACTION_BUILD4 12 +#define TX_ACTION_BUILD5 13 +#define TX_ACTION_BUILD6 14 +#define TX_ACTION_MUR 15 +#define TX_ACTION_PALIS 16 +#define TX_ACTION_ABATn 17 +#define TX_ACTION_ROCn 18 +#define TX_ACTION_PONT 19 +#define TX_ACTION_TOUR 20 +#define TX_ACTION_BOIT 21 +#define TX_ACTION_LABO 22 +#define TX_ACTION_FLEUR 23 +#define TX_ACTION_FLEURn 24 +#define TX_ACTION_DYNAMITE 25 +#define TX_ACTION_BATEAU 26 +#define TX_ACTION_DJEEP 27 +#define TX_ACTION_DRAPEAU 28 +#define TX_ACTION_EXTRAIT 29 +#define TX_ACTION_FABJEEP 30 +#define TX_ACTION_FABMINE 31 +#define TX_ACTION_FABDISC 32 +#define TX_ACTION_REPEAT 33 +#define TX_ACTION_QARMURE 34 +#define TX_ACTION_FABARMURE 35 +#define TX_IONAMEEX 100 +#define TX_IOFREE 101 +#define IDR_MENU 102 +#define TX_TERMMIN 102 +#define TX_TERMMAX 103 +#define TX_BUTTON_JOUER 104 +#define TX_BUTTON_APPRENDRE 105 +#define TX_BUTTON_QUITTER 106 +#define TX_BUTTON_PREVP 107 +#define TX_BUTTON_NEXTP 108 +#define TX_BUTTON_PLAYP 109 +#define TX_BUTTON_BUILDP 110 +#define TX_BUTTON_TERM 111 +#define TX_BUTTON_READP 112 +#define TX_BUTTON_WRITEP 113 +#define TX_BUTTON_CANCELP 114 +#define TX_BUTTON_CONTP 115 +#define TX_BUTTON_REPEAT 116 +#define TX_BUTTON_BUTTON 117 +#define TX_BUTTON_CTERM 118 +#define TX_BUTTON_TERMC 119 +#define TX_BUTTON_TERMHBLUPI 120 +#define TX_BUTTON_TERMHPLANCHE 121 +#define TX_BUTTON_TERMFIRE 122 +#define TX_BUTTON_TERMDEC 123 +#define TX_BUTTON_TERMINC 124 +#define TX_PAUSE 125 +#define TX_JAUGE1 126 +#define TX_JAUGE2 127 +#define TX_BUTTON_SETUP 128 +#define TX_BUTTON_MUSIC 129 +#define TX_BUTTON_SETUP1 130 +#define TX_BUTTON_SETUP2 131 +#define TX_BUTTON_SETUP3 132 +#define TX_BUTTON_SETUP4 133 +#define TX_BUTTON_MUSIC1 134 +#define TX_BUTTON_MUSIC2 135 +#define TX_BUTTON_MUSIC3 136 +#define TX_BUTTON_MUSIC4 137 +#define TX_BUTTON_MUSIC5 138 +#define TX_BUTTON_MUSIC6 139 +#define TX_BUTTON_MUSIC7 140 +#define TX_BUTTON_MUSIC8 141 +#define TX_BUTTON_MUSIC9 142 +#define TX_BUTTON_MUSIC10 143 +#define TX_BUTTON_REGION 144 +#define TX_BUTTON_TERMMBLUPI 145 +#define TX_BUTTON_TERMKILL 146 +#define TX_TERM 147 +#define TX_BUTTON 148 +#define TX_MUSIC 149 +#define TX_SCHOOL 150 +#define TX_MISSION 151 +#define TX_IONAMEMI 152 +#define TX_BUTTON_TERMHTOMATE 153 +#define TX_BUTTON_SETUP5 154 +#define TX_BUTTON_SETUP6 155 +#define TX_BUTTON_SETUP7 156 +#define TX_BUTTON_SETUP8 157 +#define TX_OUI 158 +#define TX_NON 159 +#define TX_BUTTON_SETUP9 160 +#define TX_BUTTON_SETUP10 161 +#define TX_INFO_SETUP1 162 +#define TX_INFO_SETUP2 163 +#define TX_INFO_SETUP3 164 +#define TX_INFO_SETUP4 165 +#define TX_INFO_SETUP5 166 +#define TX_INFO_SETUP6 167 +#define TX_INFO_SETUP7 168 +#define TX_INFO_SETUP8 169 +#define TX_INFO_SETUP9 170 +#define TX_INFO_SETUP10 171 +#define TX_INFO_SETUP10b 172 +#define TX_INFO_NOSCROLL 173 +#define TX_BUTTON_REGION1 174 +#define TX_BUTTON_REGION2 175 +#define TX_BUTTON_REGION3 176 +#define TX_BUTTON_REGION4 177 +#define TX_REGION 178 +#define TX_BUTTON_PLAY_STOP 179 +#define TX_BUTTON_PLAY_SETUP 180 +#define TX_BUTTON_PLAY_WRITE 181 +#define TX_INSERT 182 +#define TX_BUTTON_PREVH 183 +#define TX_BUTTON_NEXTH 184 +#define TX_BUTTON_TERMHMETAL 185 +#define TX_BUTTON_HELP 186 +#define TX_HELP 187 +#define TX_BUTTON_PRIVE 188 +#define TX_PRIVATE 189 +#define TX_IONAMEPR 190 +#define TX_PRIVATE_HACHBLUPI 191 +#define TX_PRIVATE_HACHPLANCHE 192 +#define TX_PRIVATE_HACHTOMATE 193 +#define TX_PRIVATE_HACHMETAL 194 +#define TX_PRIVATE_STOPFIRE 195 +#define TX_PRIVATE_HOMEBLUPI 196 +#define TX_PRIVATE_KILLROBOTS 197 +#define TX_BUTTON_UNDO 198 +#define TX_DEMO_END1 199 +#define TX_DEMO_END2 200 +#define TX_DEMO_END3 201 +#define TX_DEMO_END4 202 +#define TX_FULL_END1 203 +#define TX_FULL_END2 204 +#define TX_FULL_END3 205 +#define TX_FULL_END4 206 +#define TX_PRIVATE_OBJECTIF 207 +#define TX_PRIVATE_NBBLUPI 208 +#define TX_BUTTON_SKILL 209 +#define TX_SKILL1 210 +#define TX_SKILL2 211 +#define TX_BUTTON_DEMO 212 +#define TX_DEMOREC 213 +#define TX_DEMOPLAY 214 +#define TX_BUTTON_TERMHROBOT 215 +#define TX_PRIVATE_HACHROBOT 216 +#define TX_REPEAT_CULTIVE 500 +#define TX_REPEAT_FLEUR 501 +#define TX_REPEAT_FLEURQ 502 +#define TX_REPEAT_FABMINE 503 +#define TX_REPEAT_FABJEEP 504 +#define TX_REPEAT_PALIS 505 +#define TX_REPEAT_PALISQ 506 +#define TX_REPEAT_PONT 507 +#define TX_REPEAT_PONTQ 508 +#define TX_REPEAT_BATEAU 509 +#define TX_REPEAT_BATEAUQ 510 +#define TX_REPEAT_FABARMURE 511 +#define TX_DIRECT_N 512 +#define TX_DIRECT_S 513 +#define TX_DIRECT_E 514 +#define TX_DIRECT_O 515 +#define IDR_WAVE_BOING 1000 +#define TX_ERROR_MISC 1000 +#define IDR_WAVE_BLOW 1001 +#define TX_ERROR_GROUND 1001 +#define TX_ERROR_FREE 1002 +#define TX_ERROR_PONTOP 1003 +#define TX_ERROR_PONTTERM 1004 +#define TX_ERROR_TOURISOL 1005 +#define TX_ERROR_TOUREAU 1006 +#define TX_ERROR_TELE2 1007 +#define TX_OBJ_BLUPIm 2000 +#define TX_OBJ_BLUPIf 2001 +#define TX_OBJ_BLUPI 2002 +#define TX_OBJ_BATEAU 2003 +#define TX_OBJ_JEEP 2004 +#define TX_OBJ_PIEGE 2005 +#define TX_OBJ_POISON 2006 +#define TX_OBJ_DYNAMITE 2007 +#define TX_OBJ_MINE 2008 +#define TX_OBJ_TOMATE 2009 +#define TX_OBJ_POTION 2010 +#define TX_OBJ_PLANCHE 2011 +#define TX_OBJ_PIERRE 2012 +#define TX_OBJ_DRAPEAU 2013 +#define TX_OBJ_FER 2014 +#define TX_OBJ_FLEUR1 2015 +#define TX_OBJ_FLEUR2 2016 +#define TX_OBJ_FLEUR3 2017 +#define TX_OBJ_CABANE 2018 +#define TX_OBJ_LABO 2019 +#define TX_OBJ_MINEFER 2020 +#define TX_OBJ_USINE 2021 +#define TX_OBJ_TOUR 2022 +#define TX_OBJ_FEU 2023 +#define TX_OBJ_ROBOT 2024 +#define TX_OBJ_TRACKS 2025 +#define TX_OBJ_BOMBE 2026 +#define TX_OBJ_ARAIGNEE 2027 +#define TX_OBJ_VIRUS 2028 +#define TX_OBJ_ELECTRO 2029 +#define TX_OBJ_ARBRE 2030 +#define TX_OBJ_MUR 2031 +#define TX_OBJ_ARBREb 2032 +#define TX_OBJ_ROC 2033 +#define TX_OBJ_OEUF 2034 +#define TX_OBJ_PALISSADE 2035 +#define TX_OBJ_ENNEMIp 2036 +#define TX_OBJ_ENNEMI 2037 +#define TX_OBJ_HERBE 2038 +#define TX_OBJ_MOUSSE 2039 +#define TX_OBJ_TERRE 2040 +#define TX_OBJ_EAU 2041 +#define TX_OBJ_RIVE 2042 +#define TX_OBJ_MIXTE 2043 +#define TX_OBJ_PONT 2044 +#define TX_OBJ_COUVEUSE 2045 +#define TX_OBJ_GLACE 2046 +#define TX_OBJ_MAISON 2047 +#define TX_OBJ_HACHURE 2048 +#define TX_OBJ_MOUSSEb 2049 +#define TX_OBJ_BOUQUET1 2050 +#define TX_OBJ_BOUQUET2 2051 +#define TX_OBJ_BOUQUET3 2052 +#define TX_OBJ_DALLE 2053 +#define TX_OBJ_ENNEMIs 2054 +#define TX_OBJ_DISCIPLE 2055 +#define TX_OBJ_METAL 2056 +#define TX_OBJ_FUSEE 2057 +#define TX_OBJ_TELEPORTE 2058 +#define TX_OBJ_ARMURE 2059 +#define TX_OBJ_DALLESPEC 2060 +#define TX_OBJ_COUVTELE 2061 +#define TX_OBJ_BATIMENT 2062 +#define TX_OBJ_BATENNEMIS 2063 +#define TX_OBJ_MURPAL 2064 +#define TX_OBJ_OBJET 2065 +#define TX_OBJ_ARME 2066 +#define TX_OBJ_VEHICULE 2067 +#define TX_OBJ_STARTFEU 2068 +#define TX_OBJ_DELOBJ 2069 +#define TX_OBJ_DELPERSO 2070 +#define TX_OBJ_DELFEU 2071 +#define TX_OBJ_PLANTE 2072 +#define TX_OBJ_BARENNEMIS 2073 +#define TX_WIN1 3000 +#define TX_WIN2 3001 +#define TX_WIN3 3002 +#define TX_WIN4 3003 +#define TX_WIN5 3004 +#define TX_LOST1 3100 +#define TX_LOST2 3101 +#define TX_LOST3 3102 +#define TX_LOST4 3103 +#define TX_LOST5 3104 +#define TX_LASTWIN1 3200 +#define TX_LASTWIN2 3201 +#define TX_LASTWIN3 3202 +#define IDM_EXIT 40001 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 109 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/resrc1.h b/resrc1.h new file mode 100644 index 0000000..6d43f40 --- /dev/null +++ b/resrc1.h @@ -0,0 +1,19 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Blupi-e.rc +// +#define TX_DIRECT_N 512 +#define TX_DIRECT_S 513 +#define TX_DIRECT_E 514 +#define TX_DIRECT_O 515 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 109 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sound.cpp b/sound.cpp new file mode 100644 index 0000000..29ac972 --- /dev/null +++ b/sound.cpp @@ -0,0 +1,648 @@ +// sound.cpp +// + +#include +#include +#include "sound.h" +#include "misc.h" +#include "def.h" +#include "resource.h" + + +///////////////////////////////////////////////////////////////////////////// + + + +// The following macro are used for proper error handling for DirectSound. +#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return FALSE; } } } + + +struct WaveHeader +{ + BYTE RIFF[4]; // "RIFF" + DWORD dwSize; // Size of data to follow + BYTE WAVE[4]; // "WAVE" + BYTE fmt_[4]; // "fmt " + DWORD dw16; // 16 + WORD wOne_0; // 1 + WORD wChnls; // Number of Channels + DWORD dwSRate; // Sample Rate + DWORD BytesPerSec; // Sample Rate + WORD wBlkAlign; // 1 + WORD BitsPerSample; // Sample size + BYTE DATA[4]; // "DATA" + DWORD dwDSize; // Number of Samples +}; + + + + +// Creates a DirectSound buffer. + +BOOL CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo) +{ + PCMWAVEFORMAT pcmwf; + DSBUFFERDESC dsbdesc; + + // Set up wave format structure. + memset( &pcmwf, 0, sizeof(PCMWAVEFORMAT) ); + pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; + pcmwf.wf.nChannels = bStereo ? 2 : 1; + pcmwf.wf.nSamplesPerSec = dwFreq; + pcmwf.wf.nBlockAlign = (WORD)dwBlkAlign; + pcmwf.wf.nAvgBytesPerSec = pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign; + pcmwf.wBitsPerSample = (WORD)dwBitsPerSample; + + // Set up DSBUFFERDESC structure. + memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); // Zero it out. + dsbdesc.dwSize = sizeof(DSBUFFERDESC); + dsbdesc.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME; + dsbdesc.dwBufferBytes = dwBufSize; + dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf; + + TRY_DS(m_lpDS->CreateSoundBuffer(&dsbdesc, &m_lpDSB[dwBuf], NULL)) + return TRUE; +} + +// Reads in data from a wave file. + +BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos) +{ + // Seek to correct position in file (if necessary) + if ( dwPos != 0xffffffff ) + { + if ( fseek(pFile, dwPos, SEEK_SET) != 0 ) + { + return FALSE; + } + } + + // Lock data in buffer for writing + LPVOID pData1; + DWORD dwData1Size; + LPVOID pData2; + DWORD dwData2Size; + HRESULT rval; + + rval = lpDSB->Lock(0, dwSize, &pData1, &dwData1Size, &pData2, &dwData2Size, DSBLOCK_FROMWRITECURSOR); + if ( rval != DS_OK ) + { + return FALSE; + } + + // Read in first chunk of data + if ( dwData1Size > 0 ) + { + if ( fread(pData1, dwData1Size, 1, pFile) != 1 ) + { + char holder[256]; + wsprintf(holder,"Data1 : %d, dwdata: %d, pFile: %d",pData1,dwData1Size,pFile); + OutputDebug(holder); + return FALSE; + } + } + + // read in second chunk if necessary + if ( dwData2Size > 0 ) + { + if ( fread(pData2, dwData2Size, 1, pFile) != 1 ) + { + return FALSE; + } + } + + // Unlock data in buffer + rval = lpDSB->Unlock(pData1, dwData1Size, pData2, dwData2Size); + if ( rval != DS_OK ) + { + return FALSE; + } + + return TRUE; +} + +// Creates a DirectSound buffer from a wave file. + +BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName) +{ + // Open the wave file + FILE* pFile = fopen(pFileName, "rb"); + if ( pFile == NULL ) return FALSE; + + // Read in the wave header + WaveHeader wavHdr; + if ( fread(&wavHdr, sizeof(wavHdr), 1, pFile) != 1 ) + { + fclose(pFile); + return NULL; + } + + // Figure out the size of the data region + DWORD dwSize = wavHdr.dwDSize; + + // Is this a stereo or mono file? + BOOL bStereo = wavHdr.wChnls > 1 ? TRUE : FALSE; + + // Create the sound buffer for the wave file + if ( !CreateSoundBuffer(dwBuf, dwSize, wavHdr.dwSRate, + wavHdr.BitsPerSample, wavHdr.wBlkAlign, bStereo) ) + { + // Close the file + fclose(pFile); + + return FALSE; + } + + // Read the data for the wave file into the sound buffer + if ( !ReadData(m_lpDSB[dwBuf], pFile, dwSize, sizeof(wavHdr)) ) + { + fclose(pFile); + return FALSE; + } + + // Close out the wave file + fclose(pFile); + + return TRUE; +} + +// Stops all sounds. + +BOOL CSound::StopAllSounds() +{ + // Make sure we have a valid sound buffer + for (int i = 0; i < MAXSOUND; i ++) + { + if ( m_lpDSB[i] ) + { + DWORD dwStatus; + TRY_DS(m_lpDSB[i]->GetStatus(&dwStatus)); + + if ( (dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING ) + { + TRY_DS(m_lpDSB[i]->Stop()) + } + } + } + + return TRUE; +} + +// Plays a sound using direct sound. + +BOOL CSound::PlaySoundDS(DWORD dwSound, DWORD dwFlags) +{ + // Make sure the sound is valid + if ( dwSound >= MAXSOUND ) return FALSE; + + // Make sure we have a valid sound buffer + if ( m_lpDSB[dwSound] ) + { + DWORD dwStatus; + TRY_DS(m_lpDSB[dwSound]->GetStatus(&dwStatus)); + + if ( (dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING ) + { + // Play the sound + TRY_DS(m_lpDSB[dwSound]->Play(0, 0, dwFlags)); + } + } + + return TRUE; +} + + + +///////////////////////////////////////////////////////////////////////////// + + +// Modifie le volume midi. +// Le volume est compris entre 0 et 20 ! + +void InitMidiVolume(int volume) +{ + int nb, i, n; + MMRESULT result; + HMIDIOUT hmo = 0; + + static int table[21] = + { + 0x00000000, + 0x11111111, + 0x22222222, + 0x33333333, + 0x44444444, + 0x55555555, + 0x66666666, + 0x77777777, + 0x88888888, + 0x99999999, + 0xAAAAAAAA, + 0xBBBBBBBB, + 0xCCCCCCCC, + 0xDDDDDDDD, + 0xEEEEEEEE, + 0xF222F222, + 0xF555F555, + 0xF777F777, + 0xFAAAFAAA, + 0xFDDDFDDD, + 0xFFFFFFFF, + }; + + if ( volume < 0 ) volume = 0; + if ( volume > MAXVOLUME ) volume = MAXVOLUME; + + nb = midiOutGetNumDevs(); + for ( i=0 ; iRelease(); + m_lpDSB[i]= NULL; + } + } + + if ( m_lpDS != NULL ) + { + m_lpDS->Release(); + m_lpDS = NULL; + } +} + + +// Initialisation de DirectSound. + +BOOL CSound::Create(HWND hWnd) +{ + if ( !DirectSoundCreate(NULL, &m_lpDS, NULL) == DS_OK ) + { + OutputDebug("Fatal error: DirectSoundCreate\n"); + m_bEnable = FALSE; + return FALSE; + } + + m_lpDS->SetCooperativeLevel(hWnd, DSSCL_NORMAL); + m_bEnable = TRUE; + m_hWnd = hWnd; + return TRUE; +} + + +// Retourne l'état de DirectSound. + +BOOL CSound::GetEnable() +{ + return m_bEnable; +} + + +// Enclenche ou déclenche le son. + +void CSound::SetState(BOOL bState) +{ + m_bState = bState; +} + + +// Gestion des volumes audio (.wav) et midi (.mid). + +void CSound::SetAudioVolume(int volume) +{ + m_audioVolume = volume; +} + +int CSound::GetAudioVolume() +{ + if ( !m_bEnable ) return 0; + return m_audioVolume; +} + +void CSound::SetMidiVolume(int volume) +{ + m_midiVolume = volume; +} + +int CSound::GetMidiVolume() +{ + if ( !m_bEnable ) return 0; + return m_midiVolume; +} + + +// Cache tous les ficheirs son (.wav). + +void CSound::CacheAll() +{ + int i; + char name[50]; + + if ( !m_bEnable ) return; + + for ( i=0 ; i= MAXSOUND ) return FALSE; + + if ( m_lpDSB[channel] != NULL ) + { + Flush(channel); + } + + return CreateBufferFromWaveFile(channel, pFilename); +} + +// Décharge un son. + +void CSound::Flush(int channel) +{ + if ( !m_bEnable ) return; + if ( channel < 0 || channel >= MAXSOUND ) return; + + if ( m_lpDSB[channel] != NULL ) + { + m_lpDSB[channel]->Release(); + m_lpDSB[channel]= NULL; + } +} + +// Fait entendre un son. +// Le volume est compris entre 0 (max) et -10000 (silence). +// Le panoramique est compris entre -10000 (gauche), 0 (centre) +// et +10000 (droite). + +BOOL CSound::Play(int channel, int volume, int pan) +{ + if ( !m_bEnable ) return TRUE; + if ( !m_bState || m_audioVolume == 0 ) return TRUE; + + volume -= (MAXVOLUME-m_audioVolume)*((10000/4)/MAXVOLUME); + +//? if ( volume == -10000 ) return TRUE; + if ( volume <= -10000/4 ) return TRUE; + + if ( channel < 0 || channel >= MAXSOUND ) return FALSE; + if ( m_lpDSB[channel] == NULL ) return FALSE; + + m_lpDSB[channel]->SetVolume(volume); + m_lpDSB[channel]->SetPan(pan); + m_lpDSB[channel]->Play(0, 0, 0); + + return TRUE; +} + +// Fait entendre un son dans une image. +// Si rank != -1, il indique le rang du blupi dont il faudra +// éventuellement stopper le dernier son en cours ! + +BOOL CSound::PlayImage(int channel, POINT pos, int rank) +{ + int stopCh, volumex, volumey, volume, pan; + + if ( rank >= 0 && rank < MAXBLUPI ) + { + stopCh = m_channelBlupi[rank]; + if ( stopCh >= 0 && m_lpDSB[stopCh] != NULL ) + { + m_lpDSB[stopCh]->Stop(); // stoppe le son précédent + m_lpDSB[stopCh]->SetCurrentPosition(0); + } + + m_channelBlupi[rank] = channel; + } + +//? pan = (int)(((long)pos.x*20000L)/LXIMAGE)-10000L; +//? pan = (int)(((long)pos.x*10000L)/LXIMAGE)-5000L; + pan = (int)(((long)pos.x*5000L)/LXIMAGE)-2500L; + + volumex = 0; // volume maximum + if ( pos.x < 0 ) + { + volumex = (pos.x*2500)/LXIMAGE; + } + if ( pos.x > LXIMAGE ) + { + pos.x -= LXIMAGE; + volumex = (-pos.x*2500)/LXIMAGE; + } + if ( volumex < -10000 ) volumex = -10000; + + volumey = 0; // volume maximum + if ( pos.y < 0 ) + { + volumey = (pos.y*2500)/LYIMAGE; + } + if ( pos.y > LYIMAGE ) + { + pos.y -= LYIMAGE; + volumey = (-pos.y*2500)/LYIMAGE; + } + if ( volumey < -10000 ) volumey = -10000; + + if ( volumex < volumey ) volume = volumex; + else volume = volumey; + + return Play(channel, volume, pan); +} + + +// Uses MCI to play a MIDI file. The window procedure +// is notified when playback is complete. + +BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) +{ + MCI_OPEN_PARMS mciOpenParms; + MCI_PLAY_PARMS mciPlayParms; + DWORD dwReturn; + char string[MAX_PATH]; + + if ( !m_bEnable ) return TRUE; + if ( m_midiVolume == 0 ) return TRUE; + InitMidiVolume(m_midiVolume); + m_lastMidiVolume = m_midiVolume; + + if ( lpszMIDIFilename[1] == ':' ) // nom complet "D:\REP..." ? + { + strcpy(string, lpszMIDIFilename); + } + else + { + GetCurrentDir(string, MAX_PATH-30); + strcat(string, lpszMIDIFilename); + } + + // Open the device by specifying the device and filename. + // MCI will attempt to choose the MIDI mapper as the output port. + mciOpenParms.lpstrDeviceType = "sequencer"; + mciOpenParms.lpstrElementName = string; + dwReturn = mciSendCommand(NULL, + MCI_OPEN, + MCI_OPEN_TYPE|MCI_OPEN_ELEMENT, + (DWORD)(LPVOID)&mciOpenParms); + if ( dwReturn != 0 ) + { + OutputDebug("PlayMusic-1\n"); + mciGetErrorString(dwReturn, string, 128); + OutputDebug(string); + // Failed to open device. Don't close it; just return error. + return FALSE; + } + + // The device opened successfully; get the device ID. + m_MidiDeviceID = mciOpenParms.wDeviceID; + + // Begin playback. + mciPlayParms.dwCallback = (DWORD)hWnd; + dwReturn = mciSendCommand(m_MidiDeviceID, + MCI_PLAY, + MCI_NOTIFY, + (DWORD)(LPVOID)&mciPlayParms); + if ( dwReturn != 0 ) + { + OutputDebug("PlayMusic-2\n"); + mciGetErrorString(dwReturn, string, 128); + OutputDebug(string); + StopMusic(); + return FALSE; + } + + strcpy(m_MIDIFilename, lpszMIDIFilename); + + return TRUE; +} + +// Restart the MIDI player. + +BOOL CSound::RestartMusic() +{ + OutputDebug("RestartMusic\n"); + if ( !m_bEnable ) return TRUE; + if ( m_midiVolume == 0 ) return TRUE; + if ( m_MIDIFilename[0] == 0 ) return FALSE; + + return PlayMusic(m_hWnd, m_MIDIFilename); +} + +// Shuts down the MIDI player. + +void CSound::SuspendMusic() +{ + if ( !m_bEnable ) return; + + if ( m_nbSuspendSkip != 0 ) + { + m_nbSuspendSkip --; + return; + } + + if ( m_MidiDeviceID && m_midiVolume != 0 ) + { + mciSendCommand(m_MidiDeviceID, MCI_CLOSE, 0, NULL); + } + m_MidiDeviceID = 0; +} + +// Shuts down the MIDI player. + +void CSound::StopMusic() +{ + SuspendMusic(); + m_MIDIFilename[0] = 0; +} + +// Retourne TRUE si une musique est en cours. + +BOOL CSound::IsPlayingMusic() +{ + return (m_MIDIFilename[0] != 0); +} + +// Adapte le volume de la musique en cours, si nécessaire. + +void CSound::AdaptVolumeMusic() +{ + if ( m_midiVolume != m_lastMidiVolume ) + { + InitMidiVolume(m_midiVolume); + m_lastMidiVolume = m_midiVolume; + RestartMusic(); + } +} + +// Indique le nombre de suspend à sauter. + +void CSound::SetSuspendSkip(int nb) +{ + m_nbSuspendSkip = nb; +} + diff --git a/sound.h b/sound.h new file mode 100644 index 0000000..4886877 --- /dev/null +++ b/sound.h @@ -0,0 +1,67 @@ +// sound.h +// + +#pragma once + +#include +#include + + +///////////////////////////////////////////////////////////////////////////// + +#define MAXSOUND 100 +#define MAXVOLUME 20 +#define MAXBLUPI 100 + +class CSound +{ +public: + CSound(); + ~CSound(); + + BOOL Create(HWND hWnd); + void SetState(BOOL bState); + BOOL GetEnable(); + + void SetAudioVolume(int volume); + int GetAudioVolume(); + void SetMidiVolume(int volume); + int GetMidiVolume(); + + void CacheAll(); + BOOL Cache(int channel, char *pFilename); + void Flush(int channel); + + BOOL Play(int channel, int volume=0, int pan=0); + BOOL PlayImage(int channel, POINT pos, int rank=-1); + BOOL PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename); + BOOL RestartMusic(); + void SuspendMusic(); + void StopMusic(); + BOOL IsPlayingMusic(); + void AdaptVolumeMusic(); + void SetSuspendSkip(int nb); + +protected: + BOOL CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo); + BOOL ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos); + BOOL CreateBufferFromWaveFile(int dwBuf, char *pFileName); + BOOL StopAllSounds(); + BOOL PlaySoundDS(DWORD dwSound, DWORD dwFlags); + +protected: + HWND m_hWnd; + BOOL m_bEnable; + BOOL m_bState; + LPDIRECTSOUND m_lpDS; + LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND]; + short m_channelBlupi[MAXBLUPI]; + UINT m_MidiDeviceID; + char m_MIDIFilename[50]; + int m_audioVolume; + int m_midiVolume; + int m_lastMidiVolume; + int m_nbSuspendSkip; +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/sound/deutsch/sound000.blp b/sound/deutsch/sound000.blp new file mode 100644 index 0000000..388fed1 Binary files /dev/null and b/sound/deutsch/sound000.blp differ diff --git a/sound/deutsch/sound001.blp b/sound/deutsch/sound001.blp new file mode 100644 index 0000000..b65562f Binary files /dev/null and b/sound/deutsch/sound001.blp differ diff --git a/sound/deutsch/sound002.blp b/sound/deutsch/sound002.blp new file mode 100644 index 0000000..a73bac3 Binary files /dev/null and b/sound/deutsch/sound002.blp differ diff --git a/sound/deutsch/sound003.blp b/sound/deutsch/sound003.blp new file mode 100644 index 0000000..8cfecd1 Binary files /dev/null and b/sound/deutsch/sound003.blp differ diff --git a/sound/deutsch/sound004.blp b/sound/deutsch/sound004.blp new file mode 100644 index 0000000..d843a7b Binary files /dev/null and b/sound/deutsch/sound004.blp differ diff --git a/sound/deutsch/sound005.blp b/sound/deutsch/sound005.blp new file mode 100644 index 0000000..a7c1f39 Binary files /dev/null and b/sound/deutsch/sound005.blp differ diff --git a/sound/deutsch/sound006.blp b/sound/deutsch/sound006.blp new file mode 100644 index 0000000..f8fdde1 Binary files /dev/null and b/sound/deutsch/sound006.blp differ diff --git a/sound/deutsch/sound007.blp b/sound/deutsch/sound007.blp new file mode 100644 index 0000000..7e78255 Binary files /dev/null and b/sound/deutsch/sound007.blp differ diff --git a/sound/deutsch/sound008.blp b/sound/deutsch/sound008.blp new file mode 100644 index 0000000..709c7d2 Binary files /dev/null and b/sound/deutsch/sound008.blp differ diff --git a/sound/deutsch/sound009.blp b/sound/deutsch/sound009.blp new file mode 100644 index 0000000..7fa4d80 Binary files /dev/null and b/sound/deutsch/sound009.blp differ diff --git a/sound/deutsch/sound010.blp b/sound/deutsch/sound010.blp new file mode 100644 index 0000000..8dc3ccd Binary files /dev/null and b/sound/deutsch/sound010.blp differ diff --git a/sound/deutsch/sound011.blp b/sound/deutsch/sound011.blp new file mode 100644 index 0000000..eb3b515 Binary files /dev/null and b/sound/deutsch/sound011.blp differ diff --git a/sound/deutsch/sound012.blp b/sound/deutsch/sound012.blp new file mode 100644 index 0000000..eb11895 Binary files /dev/null and b/sound/deutsch/sound012.blp differ diff --git a/sound/deutsch/sound013.blp b/sound/deutsch/sound013.blp new file mode 100644 index 0000000..95bc99d Binary files /dev/null and b/sound/deutsch/sound013.blp differ diff --git a/sound/deutsch/sound014.blp b/sound/deutsch/sound014.blp new file mode 100644 index 0000000..244205f Binary files /dev/null and b/sound/deutsch/sound014.blp differ diff --git a/sound/deutsch/sound015.blp b/sound/deutsch/sound015.blp new file mode 100644 index 0000000..c59d92e Binary files /dev/null and b/sound/deutsch/sound015.blp differ diff --git a/sound/deutsch/sound016.blp b/sound/deutsch/sound016.blp new file mode 100644 index 0000000..46b2e6d Binary files /dev/null and b/sound/deutsch/sound016.blp differ diff --git a/sound/deutsch/sound017.blp b/sound/deutsch/sound017.blp new file mode 100644 index 0000000..d0c79fb Binary files /dev/null and b/sound/deutsch/sound017.blp differ diff --git a/sound/deutsch/sound018.blp b/sound/deutsch/sound018.blp new file mode 100644 index 0000000..0808476 Binary files /dev/null and b/sound/deutsch/sound018.blp differ diff --git a/sound/deutsch/sound019.blp b/sound/deutsch/sound019.blp new file mode 100644 index 0000000..8ee23a4 Binary files /dev/null and b/sound/deutsch/sound019.blp differ diff --git a/sound/deutsch/sound020.blp b/sound/deutsch/sound020.blp new file mode 100644 index 0000000..ede68b5 Binary files /dev/null and b/sound/deutsch/sound020.blp differ diff --git a/sound/deutsch/sound021.blp b/sound/deutsch/sound021.blp new file mode 100644 index 0000000..0b4b5f2 Binary files /dev/null and b/sound/deutsch/sound021.blp differ diff --git a/sound/deutsch/sound022.blp b/sound/deutsch/sound022.blp new file mode 100644 index 0000000..d95d9e6 Binary files /dev/null and b/sound/deutsch/sound022.blp differ diff --git a/sound/deutsch/sound023.blp b/sound/deutsch/sound023.blp new file mode 100644 index 0000000..eb0ae91 Binary files /dev/null and b/sound/deutsch/sound023.blp differ diff --git a/sound/deutsch/sound024.blp b/sound/deutsch/sound024.blp new file mode 100644 index 0000000..a1711ac Binary files /dev/null and b/sound/deutsch/sound024.blp differ diff --git a/sound/deutsch/sound025.blp b/sound/deutsch/sound025.blp new file mode 100644 index 0000000..91783eb Binary files /dev/null and b/sound/deutsch/sound025.blp differ diff --git a/sound/deutsch/sound026.blp b/sound/deutsch/sound026.blp new file mode 100644 index 0000000..87d7de0 Binary files /dev/null and b/sound/deutsch/sound026.blp differ diff --git a/sound/deutsch/sound027.blp b/sound/deutsch/sound027.blp new file mode 100644 index 0000000..89b24e2 Binary files /dev/null and b/sound/deutsch/sound027.blp differ diff --git a/sound/deutsch/sound028.blp b/sound/deutsch/sound028.blp new file mode 100644 index 0000000..ad23143 Binary files /dev/null and b/sound/deutsch/sound028.blp differ diff --git a/sound/deutsch/sound029.blp b/sound/deutsch/sound029.blp new file mode 100644 index 0000000..0d15ba9 Binary files /dev/null and b/sound/deutsch/sound029.blp differ diff --git a/sound/deutsch/sound030.blp b/sound/deutsch/sound030.blp new file mode 100644 index 0000000..48fb3f8 Binary files /dev/null and b/sound/deutsch/sound030.blp differ diff --git a/sound/deutsch/sound031.blp b/sound/deutsch/sound031.blp new file mode 100644 index 0000000..9210385 Binary files /dev/null and b/sound/deutsch/sound031.blp differ diff --git a/sound/deutsch/sound032.blp b/sound/deutsch/sound032.blp new file mode 100644 index 0000000..a5e3c39 Binary files /dev/null and b/sound/deutsch/sound032.blp differ diff --git a/sound/deutsch/sound033.blp b/sound/deutsch/sound033.blp new file mode 100644 index 0000000..6f27d2b Binary files /dev/null and b/sound/deutsch/sound033.blp differ diff --git a/sound/deutsch/sound034.blp b/sound/deutsch/sound034.blp new file mode 100644 index 0000000..421d038 Binary files /dev/null and b/sound/deutsch/sound034.blp differ diff --git a/sound/deutsch/sound035.blp b/sound/deutsch/sound035.blp new file mode 100644 index 0000000..eb369cb Binary files /dev/null and b/sound/deutsch/sound035.blp differ diff --git a/sound/deutsch/sound036.blp b/sound/deutsch/sound036.blp new file mode 100644 index 0000000..756f298 Binary files /dev/null and b/sound/deutsch/sound036.blp differ diff --git a/sound/deutsch/sound037.blp b/sound/deutsch/sound037.blp new file mode 100644 index 0000000..17a00b2 Binary files /dev/null and b/sound/deutsch/sound037.blp differ diff --git a/sound/deutsch/sound038.blp b/sound/deutsch/sound038.blp new file mode 100644 index 0000000..76af3f6 Binary files /dev/null and b/sound/deutsch/sound038.blp differ diff --git a/sound/deutsch/sound039.blp b/sound/deutsch/sound039.blp new file mode 100644 index 0000000..314f663 Binary files /dev/null and b/sound/deutsch/sound039.blp differ diff --git a/sound/deutsch/sound040.blp b/sound/deutsch/sound040.blp new file mode 100644 index 0000000..5d0696d Binary files /dev/null and b/sound/deutsch/sound040.blp differ diff --git a/sound/deutsch/sound041.blp b/sound/deutsch/sound041.blp new file mode 100644 index 0000000..6bbc067 Binary files /dev/null and b/sound/deutsch/sound041.blp differ diff --git a/sound/deutsch/sound042.blp b/sound/deutsch/sound042.blp new file mode 100644 index 0000000..bee6ba7 Binary files /dev/null and b/sound/deutsch/sound042.blp differ diff --git a/sound/deutsch/sound043.blp b/sound/deutsch/sound043.blp new file mode 100644 index 0000000..ddccd52 Binary files /dev/null and b/sound/deutsch/sound043.blp differ diff --git a/sound/deutsch/sound044.blp b/sound/deutsch/sound044.blp new file mode 100644 index 0000000..ea78d0d Binary files /dev/null and b/sound/deutsch/sound044.blp differ diff --git a/sound/deutsch/sound045.blp b/sound/deutsch/sound045.blp new file mode 100644 index 0000000..c86c1ad Binary files /dev/null and b/sound/deutsch/sound045.blp differ diff --git a/sound/deutsch/sound046.blp b/sound/deutsch/sound046.blp new file mode 100644 index 0000000..cdabb5d Binary files /dev/null and b/sound/deutsch/sound046.blp differ diff --git a/sound/deutsch/sound047.blp b/sound/deutsch/sound047.blp new file mode 100644 index 0000000..4887327 Binary files /dev/null and b/sound/deutsch/sound047.blp differ diff --git a/sound/deutsch/sound048.blp b/sound/deutsch/sound048.blp new file mode 100644 index 0000000..e9ad25e Binary files /dev/null and b/sound/deutsch/sound048.blp differ diff --git a/sound/deutsch/sound049.blp b/sound/deutsch/sound049.blp new file mode 100644 index 0000000..6176140 Binary files /dev/null and b/sound/deutsch/sound049.blp differ diff --git a/sound/deutsch/sound050.blp b/sound/deutsch/sound050.blp new file mode 100644 index 0000000..d0af514 Binary files /dev/null and b/sound/deutsch/sound050.blp differ diff --git a/sound/deutsch/sound051.blp b/sound/deutsch/sound051.blp new file mode 100644 index 0000000..3152eec Binary files /dev/null and b/sound/deutsch/sound051.blp differ diff --git a/sound/deutsch/sound052.blp b/sound/deutsch/sound052.blp new file mode 100644 index 0000000..ecc79a6 Binary files /dev/null and b/sound/deutsch/sound052.blp differ diff --git a/sound/deutsch/sound053.blp b/sound/deutsch/sound053.blp new file mode 100644 index 0000000..4eceb53 Binary files /dev/null and b/sound/deutsch/sound053.blp differ diff --git a/sound/deutsch/sound054.blp b/sound/deutsch/sound054.blp new file mode 100644 index 0000000..6cc3ab3 Binary files /dev/null and b/sound/deutsch/sound054.blp differ diff --git a/sound/deutsch/sound055.blp b/sound/deutsch/sound055.blp new file mode 100644 index 0000000..3633c2f Binary files /dev/null and b/sound/deutsch/sound055.blp differ diff --git a/sound/deutsch/sound056.blp b/sound/deutsch/sound056.blp new file mode 100644 index 0000000..d01f352 Binary files /dev/null and b/sound/deutsch/sound056.blp differ diff --git a/sound/deutsch/sound057.blp b/sound/deutsch/sound057.blp new file mode 100644 index 0000000..ca50c05 Binary files /dev/null and b/sound/deutsch/sound057.blp differ diff --git a/sound/deutsch/sound058.blp b/sound/deutsch/sound058.blp new file mode 100644 index 0000000..1fdacfe Binary files /dev/null and b/sound/deutsch/sound058.blp differ diff --git a/sound/deutsch/sound059.blp b/sound/deutsch/sound059.blp new file mode 100644 index 0000000..6a5aab0 Binary files /dev/null and b/sound/deutsch/sound059.blp differ diff --git a/sound/deutsch/sound060.blp b/sound/deutsch/sound060.blp new file mode 100644 index 0000000..fab8907 Binary files /dev/null and b/sound/deutsch/sound060.blp differ diff --git a/sound/deutsch/sound061.blp b/sound/deutsch/sound061.blp new file mode 100644 index 0000000..244171a Binary files /dev/null and b/sound/deutsch/sound061.blp differ diff --git a/sound/deutsch/sound062.blp b/sound/deutsch/sound062.blp new file mode 100644 index 0000000..cffcaf4 Binary files /dev/null and b/sound/deutsch/sound062.blp differ diff --git a/sound/deutsch/sound063.blp b/sound/deutsch/sound063.blp new file mode 100644 index 0000000..0b3794d Binary files /dev/null and b/sound/deutsch/sound063.blp differ diff --git a/sound/deutsch/sound064.blp b/sound/deutsch/sound064.blp new file mode 100644 index 0000000..098c0f4 Binary files /dev/null and b/sound/deutsch/sound064.blp differ diff --git a/sound/deutsch/sound065.blp b/sound/deutsch/sound065.blp new file mode 100644 index 0000000..f065191 Binary files /dev/null and b/sound/deutsch/sound065.blp differ diff --git a/sound/deutsch/sound066.blp b/sound/deutsch/sound066.blp new file mode 100644 index 0000000..951d7f3 Binary files /dev/null and b/sound/deutsch/sound066.blp differ diff --git a/sound/deutsch/sound067.blp b/sound/deutsch/sound067.blp new file mode 100644 index 0000000..5148c6f Binary files /dev/null and b/sound/deutsch/sound067.blp differ diff --git a/sound/deutsch/sound068.blp b/sound/deutsch/sound068.blp new file mode 100644 index 0000000..753195a Binary files /dev/null and b/sound/deutsch/sound068.blp differ diff --git a/sound/deutsch/sound069.blp b/sound/deutsch/sound069.blp new file mode 100644 index 0000000..246f73a Binary files /dev/null and b/sound/deutsch/sound069.blp differ diff --git a/sound/deutsch/sound070.blp b/sound/deutsch/sound070.blp new file mode 100644 index 0000000..02e815f Binary files /dev/null and b/sound/deutsch/sound070.blp differ diff --git a/sound/deutsch/sound071.blp b/sound/deutsch/sound071.blp new file mode 100644 index 0000000..709c7d2 Binary files /dev/null and b/sound/deutsch/sound071.blp differ diff --git a/sound/deutsch/sound072.blp b/sound/deutsch/sound072.blp new file mode 100644 index 0000000..7fa4d80 Binary files /dev/null and b/sound/deutsch/sound072.blp differ diff --git a/sound/deutsch/sound073.blp b/sound/deutsch/sound073.blp new file mode 100644 index 0000000..8dc3ccd Binary files /dev/null and b/sound/deutsch/sound073.blp differ diff --git a/sound/deutsch/sound074.blp b/sound/deutsch/sound074.blp new file mode 100644 index 0000000..cc949d8 Binary files /dev/null and b/sound/deutsch/sound074.blp differ diff --git a/sound/deutsch/sound075.blp b/sound/deutsch/sound075.blp new file mode 100644 index 0000000..2536439 Binary files /dev/null and b/sound/deutsch/sound075.blp differ diff --git a/sound/deutsch/sound076.blp b/sound/deutsch/sound076.blp new file mode 100644 index 0000000..5471992 Binary files /dev/null and b/sound/deutsch/sound076.blp differ diff --git a/sound/deutsch/sound077.blp b/sound/deutsch/sound077.blp new file mode 100644 index 0000000..639249c Binary files /dev/null and b/sound/deutsch/sound077.blp differ diff --git a/sound/deutsch/sound078.blp b/sound/deutsch/sound078.blp new file mode 100644 index 0000000..b99f5d6 Binary files /dev/null and b/sound/deutsch/sound078.blp differ diff --git a/sound/deutsch/sound079.blp b/sound/deutsch/sound079.blp new file mode 100644 index 0000000..d43578a Binary files /dev/null and b/sound/deutsch/sound079.blp differ diff --git a/sound/deutsch/sound080.blp b/sound/deutsch/sound080.blp new file mode 100644 index 0000000..9230f43 Binary files /dev/null and b/sound/deutsch/sound080.blp differ diff --git a/sound/deutsch/sound081.blp b/sound/deutsch/sound081.blp new file mode 100644 index 0000000..f7fa9cf Binary files /dev/null and b/sound/deutsch/sound081.blp differ diff --git a/sound/deutsch/sound082.blp b/sound/deutsch/sound082.blp new file mode 100644 index 0000000..7526da4 Binary files /dev/null and b/sound/deutsch/sound082.blp differ diff --git a/sound/english/sound000.blp b/sound/english/sound000.blp new file mode 100644 index 0000000..388fed1 Binary files /dev/null and b/sound/english/sound000.blp differ diff --git a/sound/english/sound001.blp b/sound/english/sound001.blp new file mode 100644 index 0000000..b65562f Binary files /dev/null and b/sound/english/sound001.blp differ diff --git a/sound/english/sound002.blp b/sound/english/sound002.blp new file mode 100644 index 0000000..3c5aad6 Binary files /dev/null and b/sound/english/sound002.blp differ diff --git a/sound/english/sound003.blp b/sound/english/sound003.blp new file mode 100644 index 0000000..8bc7cf9 Binary files /dev/null and b/sound/english/sound003.blp differ diff --git a/sound/english/sound004.blp b/sound/english/sound004.blp new file mode 100644 index 0000000..9966510 Binary files /dev/null and b/sound/english/sound004.blp differ diff --git a/sound/english/sound005.blp b/sound/english/sound005.blp new file mode 100644 index 0000000..bde8aad Binary files /dev/null and b/sound/english/sound005.blp differ diff --git a/sound/english/sound006.blp b/sound/english/sound006.blp new file mode 100644 index 0000000..056c74d Binary files /dev/null and b/sound/english/sound006.blp differ diff --git a/sound/english/sound007.blp b/sound/english/sound007.blp new file mode 100644 index 0000000..10a0ee0 Binary files /dev/null and b/sound/english/sound007.blp differ diff --git a/sound/english/sound008.blp b/sound/english/sound008.blp new file mode 100644 index 0000000..9640b2c Binary files /dev/null and b/sound/english/sound008.blp differ diff --git a/sound/english/sound009.blp b/sound/english/sound009.blp new file mode 100644 index 0000000..62a0fd5 Binary files /dev/null and b/sound/english/sound009.blp differ diff --git a/sound/english/sound010.blp b/sound/english/sound010.blp new file mode 100644 index 0000000..1f581e4 Binary files /dev/null and b/sound/english/sound010.blp differ diff --git a/sound/english/sound011.blp b/sound/english/sound011.blp new file mode 100644 index 0000000..eb3b515 Binary files /dev/null and b/sound/english/sound011.blp differ diff --git a/sound/english/sound012.blp b/sound/english/sound012.blp new file mode 100644 index 0000000..eb11895 Binary files /dev/null and b/sound/english/sound012.blp differ diff --git a/sound/english/sound013.blp b/sound/english/sound013.blp new file mode 100644 index 0000000..95bc99d Binary files /dev/null and b/sound/english/sound013.blp differ diff --git a/sound/english/sound014.blp b/sound/english/sound014.blp new file mode 100644 index 0000000..36ec77a Binary files /dev/null and b/sound/english/sound014.blp differ diff --git a/sound/english/sound015.blp b/sound/english/sound015.blp new file mode 100644 index 0000000..c59d92e Binary files /dev/null and b/sound/english/sound015.blp differ diff --git a/sound/english/sound016.blp b/sound/english/sound016.blp new file mode 100644 index 0000000..46b2e6d Binary files /dev/null and b/sound/english/sound016.blp differ diff --git a/sound/english/sound017.blp b/sound/english/sound017.blp new file mode 100644 index 0000000..35dbb72 Binary files /dev/null and b/sound/english/sound017.blp differ diff --git a/sound/english/sound018.blp b/sound/english/sound018.blp new file mode 100644 index 0000000..4e575ea Binary files /dev/null and b/sound/english/sound018.blp differ diff --git a/sound/english/sound019.blp b/sound/english/sound019.blp new file mode 100644 index 0000000..7a4332b Binary files /dev/null and b/sound/english/sound019.blp differ diff --git a/sound/english/sound020.blp b/sound/english/sound020.blp new file mode 100644 index 0000000..ede68b5 Binary files /dev/null and b/sound/english/sound020.blp differ diff --git a/sound/english/sound021.blp b/sound/english/sound021.blp new file mode 100644 index 0000000..0b4b5f2 Binary files /dev/null and b/sound/english/sound021.blp differ diff --git a/sound/english/sound022.blp b/sound/english/sound022.blp new file mode 100644 index 0000000..d95d9e6 Binary files /dev/null and b/sound/english/sound022.blp differ diff --git a/sound/english/sound023.blp b/sound/english/sound023.blp new file mode 100644 index 0000000..eb0ae91 Binary files /dev/null and b/sound/english/sound023.blp differ diff --git a/sound/english/sound024.blp b/sound/english/sound024.blp new file mode 100644 index 0000000..a1711ac Binary files /dev/null and b/sound/english/sound024.blp differ diff --git a/sound/english/sound025.blp b/sound/english/sound025.blp new file mode 100644 index 0000000..91783eb Binary files /dev/null and b/sound/english/sound025.blp differ diff --git a/sound/english/sound026.blp b/sound/english/sound026.blp new file mode 100644 index 0000000..87d7de0 Binary files /dev/null and b/sound/english/sound026.blp differ diff --git a/sound/english/sound027.blp b/sound/english/sound027.blp new file mode 100644 index 0000000..e32f9d3 Binary files /dev/null and b/sound/english/sound027.blp differ diff --git a/sound/english/sound028.blp b/sound/english/sound028.blp new file mode 100644 index 0000000..ad23143 Binary files /dev/null and b/sound/english/sound028.blp differ diff --git a/sound/english/sound029.blp b/sound/english/sound029.blp new file mode 100644 index 0000000..0d15ba9 Binary files /dev/null and b/sound/english/sound029.blp differ diff --git a/sound/english/sound030.blp b/sound/english/sound030.blp new file mode 100644 index 0000000..48fb3f8 Binary files /dev/null and b/sound/english/sound030.blp differ diff --git a/sound/english/sound031.blp b/sound/english/sound031.blp new file mode 100644 index 0000000..9210385 Binary files /dev/null and b/sound/english/sound031.blp differ diff --git a/sound/english/sound032.blp b/sound/english/sound032.blp new file mode 100644 index 0000000..a5e3c39 Binary files /dev/null and b/sound/english/sound032.blp differ diff --git a/sound/english/sound033.blp b/sound/english/sound033.blp new file mode 100644 index 0000000..109ec7b Binary files /dev/null and b/sound/english/sound033.blp differ diff --git a/sound/english/sound034.blp b/sound/english/sound034.blp new file mode 100644 index 0000000..421d038 Binary files /dev/null and b/sound/english/sound034.blp differ diff --git a/sound/english/sound035.blp b/sound/english/sound035.blp new file mode 100644 index 0000000..eb369cb Binary files /dev/null and b/sound/english/sound035.blp differ diff --git a/sound/english/sound036.blp b/sound/english/sound036.blp new file mode 100644 index 0000000..756f298 Binary files /dev/null and b/sound/english/sound036.blp differ diff --git a/sound/english/sound037.blp b/sound/english/sound037.blp new file mode 100644 index 0000000..703331d Binary files /dev/null and b/sound/english/sound037.blp differ diff --git a/sound/english/sound038.blp b/sound/english/sound038.blp new file mode 100644 index 0000000..76af3f6 Binary files /dev/null and b/sound/english/sound038.blp differ diff --git a/sound/english/sound039.blp b/sound/english/sound039.blp new file mode 100644 index 0000000..314f663 Binary files /dev/null and b/sound/english/sound039.blp differ diff --git a/sound/english/sound040.blp b/sound/english/sound040.blp new file mode 100644 index 0000000..5d0696d Binary files /dev/null and b/sound/english/sound040.blp differ diff --git a/sound/english/sound041.blp b/sound/english/sound041.blp new file mode 100644 index 0000000..6bbc067 Binary files /dev/null and b/sound/english/sound041.blp differ diff --git a/sound/english/sound042.blp b/sound/english/sound042.blp new file mode 100644 index 0000000..bee6ba7 Binary files /dev/null and b/sound/english/sound042.blp differ diff --git a/sound/english/sound043.blp b/sound/english/sound043.blp new file mode 100644 index 0000000..ddccd52 Binary files /dev/null and b/sound/english/sound043.blp differ diff --git a/sound/english/sound044.blp b/sound/english/sound044.blp new file mode 100644 index 0000000..ea78d0d Binary files /dev/null and b/sound/english/sound044.blp differ diff --git a/sound/english/sound045.blp b/sound/english/sound045.blp new file mode 100644 index 0000000..c86c1ad Binary files /dev/null and b/sound/english/sound045.blp differ diff --git a/sound/english/sound046.blp b/sound/english/sound046.blp new file mode 100644 index 0000000..cdabb5d Binary files /dev/null and b/sound/english/sound046.blp differ diff --git a/sound/english/sound047.blp b/sound/english/sound047.blp new file mode 100644 index 0000000..4887327 Binary files /dev/null and b/sound/english/sound047.blp differ diff --git a/sound/english/sound048.blp b/sound/english/sound048.blp new file mode 100644 index 0000000..e9ad25e Binary files /dev/null and b/sound/english/sound048.blp differ diff --git a/sound/english/sound049.blp b/sound/english/sound049.blp new file mode 100644 index 0000000..6176140 Binary files /dev/null and b/sound/english/sound049.blp differ diff --git a/sound/english/sound050.blp b/sound/english/sound050.blp new file mode 100644 index 0000000..d0af514 Binary files /dev/null and b/sound/english/sound050.blp differ diff --git a/sound/english/sound051.blp b/sound/english/sound051.blp new file mode 100644 index 0000000..3152eec Binary files /dev/null and b/sound/english/sound051.blp differ diff --git a/sound/english/sound052.blp b/sound/english/sound052.blp new file mode 100644 index 0000000..ecc79a6 Binary files /dev/null and b/sound/english/sound052.blp differ diff --git a/sound/english/sound053.blp b/sound/english/sound053.blp new file mode 100644 index 0000000..4eceb53 Binary files /dev/null and b/sound/english/sound053.blp differ diff --git a/sound/english/sound054.blp b/sound/english/sound054.blp new file mode 100644 index 0000000..6cc3ab3 Binary files /dev/null and b/sound/english/sound054.blp differ diff --git a/sound/english/sound055.blp b/sound/english/sound055.blp new file mode 100644 index 0000000..3633c2f Binary files /dev/null and b/sound/english/sound055.blp differ diff --git a/sound/english/sound056.blp b/sound/english/sound056.blp new file mode 100644 index 0000000..e96e4b0 Binary files /dev/null and b/sound/english/sound056.blp differ diff --git a/sound/english/sound057.blp b/sound/english/sound057.blp new file mode 100644 index 0000000..23b3630 Binary files /dev/null and b/sound/english/sound057.blp differ diff --git a/sound/english/sound058.blp b/sound/english/sound058.blp new file mode 100644 index 0000000..8ac9aa1 Binary files /dev/null and b/sound/english/sound058.blp differ diff --git a/sound/english/sound059.blp b/sound/english/sound059.blp new file mode 100644 index 0000000..d347233 Binary files /dev/null and b/sound/english/sound059.blp differ diff --git a/sound/english/sound060.blp b/sound/english/sound060.blp new file mode 100644 index 0000000..dbb2a75 Binary files /dev/null and b/sound/english/sound060.blp differ diff --git a/sound/english/sound061.blp b/sound/english/sound061.blp new file mode 100644 index 0000000..531c7c3 Binary files /dev/null and b/sound/english/sound061.blp differ diff --git a/sound/english/sound062.blp b/sound/english/sound062.blp new file mode 100644 index 0000000..2aa3173 Binary files /dev/null and b/sound/english/sound062.blp differ diff --git a/sound/english/sound063.blp b/sound/english/sound063.blp new file mode 100644 index 0000000..ac10526 Binary files /dev/null and b/sound/english/sound063.blp differ diff --git a/sound/english/sound064.blp b/sound/english/sound064.blp new file mode 100644 index 0000000..d7b02d1 Binary files /dev/null and b/sound/english/sound064.blp differ diff --git a/sound/english/sound065.blp b/sound/english/sound065.blp new file mode 100644 index 0000000..c8b1a7e Binary files /dev/null and b/sound/english/sound065.blp differ diff --git a/sound/english/sound066.blp b/sound/english/sound066.blp new file mode 100644 index 0000000..08d1b8e Binary files /dev/null and b/sound/english/sound066.blp differ diff --git a/sound/english/sound067.blp b/sound/english/sound067.blp new file mode 100644 index 0000000..a3911d7 Binary files /dev/null and b/sound/english/sound067.blp differ diff --git a/sound/english/sound068.blp b/sound/english/sound068.blp new file mode 100644 index 0000000..e069e16 Binary files /dev/null and b/sound/english/sound068.blp differ diff --git a/sound/english/sound069.blp b/sound/english/sound069.blp new file mode 100644 index 0000000..b902a16 Binary files /dev/null and b/sound/english/sound069.blp differ diff --git a/sound/english/sound070.blp b/sound/english/sound070.blp new file mode 100644 index 0000000..8a843eb Binary files /dev/null and b/sound/english/sound070.blp differ diff --git a/sound/english/sound071.blp b/sound/english/sound071.blp new file mode 100644 index 0000000..dbd4f0a Binary files /dev/null and b/sound/english/sound071.blp differ diff --git a/sound/english/sound072.blp b/sound/english/sound072.blp new file mode 100644 index 0000000..1b591ef Binary files /dev/null and b/sound/english/sound072.blp differ diff --git a/sound/english/sound073.blp b/sound/english/sound073.blp new file mode 100644 index 0000000..2e7c713 Binary files /dev/null and b/sound/english/sound073.blp differ diff --git a/sound/english/sound074.blp b/sound/english/sound074.blp new file mode 100644 index 0000000..cc949d8 Binary files /dev/null and b/sound/english/sound074.blp differ diff --git a/sound/english/sound075.blp b/sound/english/sound075.blp new file mode 100644 index 0000000..2536439 Binary files /dev/null and b/sound/english/sound075.blp differ diff --git a/sound/english/sound076.blp b/sound/english/sound076.blp new file mode 100644 index 0000000..5471992 Binary files /dev/null and b/sound/english/sound076.blp differ diff --git a/sound/english/sound077.blp b/sound/english/sound077.blp new file mode 100644 index 0000000..639249c Binary files /dev/null and b/sound/english/sound077.blp differ diff --git a/sound/english/sound078.blp b/sound/english/sound078.blp new file mode 100644 index 0000000..b99f5d6 Binary files /dev/null and b/sound/english/sound078.blp differ diff --git a/sound/english/sound079.blp b/sound/english/sound079.blp new file mode 100644 index 0000000..d43578a Binary files /dev/null and b/sound/english/sound079.blp differ diff --git a/sound/english/sound080.blp b/sound/english/sound080.blp new file mode 100644 index 0000000..9230f43 Binary files /dev/null and b/sound/english/sound080.blp differ diff --git a/sound/english/sound081.blp b/sound/english/sound081.blp new file mode 100644 index 0000000..f7fa9cf Binary files /dev/null and b/sound/english/sound081.blp differ diff --git a/sound/english/sound082.blp b/sound/english/sound082.blp new file mode 100644 index 0000000..7526da4 Binary files /dev/null and b/sound/english/sound082.blp differ diff --git a/sound/francais/sound000.blp b/sound/francais/sound000.blp new file mode 100644 index 0000000..388fed1 Binary files /dev/null and b/sound/francais/sound000.blp differ diff --git a/sound/francais/sound001.blp b/sound/francais/sound001.blp new file mode 100644 index 0000000..b65562f Binary files /dev/null and b/sound/francais/sound001.blp differ diff --git a/sound/francais/sound002.blp b/sound/francais/sound002.blp new file mode 100644 index 0000000..97ee7f3 Binary files /dev/null and b/sound/francais/sound002.blp differ diff --git a/sound/francais/sound003.blp b/sound/francais/sound003.blp new file mode 100644 index 0000000..e2f8334 Binary files /dev/null and b/sound/francais/sound003.blp differ diff --git a/sound/francais/sound004.blp b/sound/francais/sound004.blp new file mode 100644 index 0000000..f45dd08 Binary files /dev/null and b/sound/francais/sound004.blp differ diff --git a/sound/francais/sound005.blp b/sound/francais/sound005.blp new file mode 100644 index 0000000..7c15283 Binary files /dev/null and b/sound/francais/sound005.blp differ diff --git a/sound/francais/sound006.blp b/sound/francais/sound006.blp new file mode 100644 index 0000000..ccb0c8c Binary files /dev/null and b/sound/francais/sound006.blp differ diff --git a/sound/francais/sound007.blp b/sound/francais/sound007.blp new file mode 100644 index 0000000..c6f383c Binary files /dev/null and b/sound/francais/sound007.blp differ diff --git a/sound/francais/sound008.blp b/sound/francais/sound008.blp new file mode 100644 index 0000000..5839ea0 Binary files /dev/null and b/sound/francais/sound008.blp differ diff --git a/sound/francais/sound009.blp b/sound/francais/sound009.blp new file mode 100644 index 0000000..f7cbc8f Binary files /dev/null and b/sound/francais/sound009.blp differ diff --git a/sound/francais/sound010.blp b/sound/francais/sound010.blp new file mode 100644 index 0000000..7edb4e6 Binary files /dev/null and b/sound/francais/sound010.blp differ diff --git a/sound/francais/sound011.blp b/sound/francais/sound011.blp new file mode 100644 index 0000000..eb3b515 Binary files /dev/null and b/sound/francais/sound011.blp differ diff --git a/sound/francais/sound012.blp b/sound/francais/sound012.blp new file mode 100644 index 0000000..eb11895 Binary files /dev/null and b/sound/francais/sound012.blp differ diff --git a/sound/francais/sound013.blp b/sound/francais/sound013.blp new file mode 100644 index 0000000..95bc99d Binary files /dev/null and b/sound/francais/sound013.blp differ diff --git a/sound/francais/sound014.blp b/sound/francais/sound014.blp new file mode 100644 index 0000000..244205f Binary files /dev/null and b/sound/francais/sound014.blp differ diff --git a/sound/francais/sound015.blp b/sound/francais/sound015.blp new file mode 100644 index 0000000..c59d92e Binary files /dev/null and b/sound/francais/sound015.blp differ diff --git a/sound/francais/sound016.blp b/sound/francais/sound016.blp new file mode 100644 index 0000000..46b2e6d Binary files /dev/null and b/sound/francais/sound016.blp differ diff --git a/sound/francais/sound017.blp b/sound/francais/sound017.blp new file mode 100644 index 0000000..68b65e5 Binary files /dev/null and b/sound/francais/sound017.blp differ diff --git a/sound/francais/sound018.blp b/sound/francais/sound018.blp new file mode 100644 index 0000000..3fe6ec6 Binary files /dev/null and b/sound/francais/sound018.blp differ diff --git a/sound/francais/sound019.blp b/sound/francais/sound019.blp new file mode 100644 index 0000000..15ac76c Binary files /dev/null and b/sound/francais/sound019.blp differ diff --git a/sound/francais/sound020.blp b/sound/francais/sound020.blp new file mode 100644 index 0000000..ede68b5 Binary files /dev/null and b/sound/francais/sound020.blp differ diff --git a/sound/francais/sound021.blp b/sound/francais/sound021.blp new file mode 100644 index 0000000..0b4b5f2 Binary files /dev/null and b/sound/francais/sound021.blp differ diff --git a/sound/francais/sound022.blp b/sound/francais/sound022.blp new file mode 100644 index 0000000..d95d9e6 Binary files /dev/null and b/sound/francais/sound022.blp differ diff --git a/sound/francais/sound023.blp b/sound/francais/sound023.blp new file mode 100644 index 0000000..eb0ae91 Binary files /dev/null and b/sound/francais/sound023.blp differ diff --git a/sound/francais/sound024.blp b/sound/francais/sound024.blp new file mode 100644 index 0000000..a1711ac Binary files /dev/null and b/sound/francais/sound024.blp differ diff --git a/sound/francais/sound025.blp b/sound/francais/sound025.blp new file mode 100644 index 0000000..91783eb Binary files /dev/null and b/sound/francais/sound025.blp differ diff --git a/sound/francais/sound026.blp b/sound/francais/sound026.blp new file mode 100644 index 0000000..87d7de0 Binary files /dev/null and b/sound/francais/sound026.blp differ diff --git a/sound/francais/sound027.blp b/sound/francais/sound027.blp new file mode 100644 index 0000000..3cbe230 Binary files /dev/null and b/sound/francais/sound027.blp differ diff --git a/sound/francais/sound028.blp b/sound/francais/sound028.blp new file mode 100644 index 0000000..ad23143 Binary files /dev/null and b/sound/francais/sound028.blp differ diff --git a/sound/francais/sound029.blp b/sound/francais/sound029.blp new file mode 100644 index 0000000..0d15ba9 Binary files /dev/null and b/sound/francais/sound029.blp differ diff --git a/sound/francais/sound030.blp b/sound/francais/sound030.blp new file mode 100644 index 0000000..48fb3f8 Binary files /dev/null and b/sound/francais/sound030.blp differ diff --git a/sound/francais/sound031.blp b/sound/francais/sound031.blp new file mode 100644 index 0000000..9210385 Binary files /dev/null and b/sound/francais/sound031.blp differ diff --git a/sound/francais/sound032.blp b/sound/francais/sound032.blp new file mode 100644 index 0000000..a5e3c39 Binary files /dev/null and b/sound/francais/sound032.blp differ diff --git a/sound/francais/sound033.blp b/sound/francais/sound033.blp new file mode 100644 index 0000000..c4b3427 Binary files /dev/null and b/sound/francais/sound033.blp differ diff --git a/sound/francais/sound034.blp b/sound/francais/sound034.blp new file mode 100644 index 0000000..421d038 Binary files /dev/null and b/sound/francais/sound034.blp differ diff --git a/sound/francais/sound035.blp b/sound/francais/sound035.blp new file mode 100644 index 0000000..eb369cb Binary files /dev/null and b/sound/francais/sound035.blp differ diff --git a/sound/francais/sound036.blp b/sound/francais/sound036.blp new file mode 100644 index 0000000..756f298 Binary files /dev/null and b/sound/francais/sound036.blp differ diff --git a/sound/francais/sound037.blp b/sound/francais/sound037.blp new file mode 100644 index 0000000..3d8fc1a Binary files /dev/null and b/sound/francais/sound037.blp differ diff --git a/sound/francais/sound038.blp b/sound/francais/sound038.blp new file mode 100644 index 0000000..76af3f6 Binary files /dev/null and b/sound/francais/sound038.blp differ diff --git a/sound/francais/sound039.blp b/sound/francais/sound039.blp new file mode 100644 index 0000000..314f663 Binary files /dev/null and b/sound/francais/sound039.blp differ diff --git a/sound/francais/sound040.blp b/sound/francais/sound040.blp new file mode 100644 index 0000000..5d0696d Binary files /dev/null and b/sound/francais/sound040.blp differ diff --git a/sound/francais/sound041.blp b/sound/francais/sound041.blp new file mode 100644 index 0000000..6bbc067 Binary files /dev/null and b/sound/francais/sound041.blp differ diff --git a/sound/francais/sound042.blp b/sound/francais/sound042.blp new file mode 100644 index 0000000..bee6ba7 Binary files /dev/null and b/sound/francais/sound042.blp differ diff --git a/sound/francais/sound043.blp b/sound/francais/sound043.blp new file mode 100644 index 0000000..ddccd52 Binary files /dev/null and b/sound/francais/sound043.blp differ diff --git a/sound/francais/sound044.blp b/sound/francais/sound044.blp new file mode 100644 index 0000000..ea78d0d Binary files /dev/null and b/sound/francais/sound044.blp differ diff --git a/sound/francais/sound045.blp b/sound/francais/sound045.blp new file mode 100644 index 0000000..c86c1ad Binary files /dev/null and b/sound/francais/sound045.blp differ diff --git a/sound/francais/sound046.blp b/sound/francais/sound046.blp new file mode 100644 index 0000000..cdabb5d Binary files /dev/null and b/sound/francais/sound046.blp differ diff --git a/sound/francais/sound047.blp b/sound/francais/sound047.blp new file mode 100644 index 0000000..4887327 Binary files /dev/null and b/sound/francais/sound047.blp differ diff --git a/sound/francais/sound048.blp b/sound/francais/sound048.blp new file mode 100644 index 0000000..e9ad25e Binary files /dev/null and b/sound/francais/sound048.blp differ diff --git a/sound/francais/sound049.blp b/sound/francais/sound049.blp new file mode 100644 index 0000000..6176140 Binary files /dev/null and b/sound/francais/sound049.blp differ diff --git a/sound/francais/sound050.blp b/sound/francais/sound050.blp new file mode 100644 index 0000000..d0af514 Binary files /dev/null and b/sound/francais/sound050.blp differ diff --git a/sound/francais/sound051.blp b/sound/francais/sound051.blp new file mode 100644 index 0000000..3152eec Binary files /dev/null and b/sound/francais/sound051.blp differ diff --git a/sound/francais/sound052.blp b/sound/francais/sound052.blp new file mode 100644 index 0000000..ecc79a6 Binary files /dev/null and b/sound/francais/sound052.blp differ diff --git a/sound/francais/sound053.blp b/sound/francais/sound053.blp new file mode 100644 index 0000000..4eceb53 Binary files /dev/null and b/sound/francais/sound053.blp differ diff --git a/sound/francais/sound054.blp b/sound/francais/sound054.blp new file mode 100644 index 0000000..6cc3ab3 Binary files /dev/null and b/sound/francais/sound054.blp differ diff --git a/sound/francais/sound055.blp b/sound/francais/sound055.blp new file mode 100644 index 0000000..3633c2f Binary files /dev/null and b/sound/francais/sound055.blp differ diff --git a/sound/francais/sound056.blp b/sound/francais/sound056.blp new file mode 100644 index 0000000..d4bb2c8 Binary files /dev/null and b/sound/francais/sound056.blp differ diff --git a/sound/francais/sound057.blp b/sound/francais/sound057.blp new file mode 100644 index 0000000..cd5b232 Binary files /dev/null and b/sound/francais/sound057.blp differ diff --git a/sound/francais/sound058.blp b/sound/francais/sound058.blp new file mode 100644 index 0000000..8ffff03 Binary files /dev/null and b/sound/francais/sound058.blp differ diff --git a/sound/francais/sound059.blp b/sound/francais/sound059.blp new file mode 100644 index 0000000..7d9753c Binary files /dev/null and b/sound/francais/sound059.blp differ diff --git a/sound/francais/sound060.blp b/sound/francais/sound060.blp new file mode 100644 index 0000000..f03e957 Binary files /dev/null and b/sound/francais/sound060.blp differ diff --git a/sound/francais/sound061.blp b/sound/francais/sound061.blp new file mode 100644 index 0000000..c8d8584 Binary files /dev/null and b/sound/francais/sound061.blp differ diff --git a/sound/francais/sound062.blp b/sound/francais/sound062.blp new file mode 100644 index 0000000..64e4ec1 Binary files /dev/null and b/sound/francais/sound062.blp differ diff --git a/sound/francais/sound063.blp b/sound/francais/sound063.blp new file mode 100644 index 0000000..dd02a5d Binary files /dev/null and b/sound/francais/sound063.blp differ diff --git a/sound/francais/sound064.blp b/sound/francais/sound064.blp new file mode 100644 index 0000000..364b7c0 Binary files /dev/null and b/sound/francais/sound064.blp differ diff --git a/sound/francais/sound065.blp b/sound/francais/sound065.blp new file mode 100644 index 0000000..1d314d2 Binary files /dev/null and b/sound/francais/sound065.blp differ diff --git a/sound/francais/sound066.blp b/sound/francais/sound066.blp new file mode 100644 index 0000000..08d4bf7 Binary files /dev/null and b/sound/francais/sound066.blp differ diff --git a/sound/francais/sound067.blp b/sound/francais/sound067.blp new file mode 100644 index 0000000..1e0450b Binary files /dev/null and b/sound/francais/sound067.blp differ diff --git a/sound/francais/sound068.blp b/sound/francais/sound068.blp new file mode 100644 index 0000000..d298f02 Binary files /dev/null and b/sound/francais/sound068.blp differ diff --git a/sound/francais/sound069.blp b/sound/francais/sound069.blp new file mode 100644 index 0000000..7e72a90 Binary files /dev/null and b/sound/francais/sound069.blp differ diff --git a/sound/francais/sound070.blp b/sound/francais/sound070.blp new file mode 100644 index 0000000..d3fb00a Binary files /dev/null and b/sound/francais/sound070.blp differ diff --git a/sound/francais/sound071.blp b/sound/francais/sound071.blp new file mode 100644 index 0000000..f5d3b87 Binary files /dev/null and b/sound/francais/sound071.blp differ diff --git a/sound/francais/sound072.blp b/sound/francais/sound072.blp new file mode 100644 index 0000000..20a576b Binary files /dev/null and b/sound/francais/sound072.blp differ diff --git a/sound/francais/sound073.blp b/sound/francais/sound073.blp new file mode 100644 index 0000000..da6f207 Binary files /dev/null and b/sound/francais/sound073.blp differ diff --git a/sound/francais/sound074.blp b/sound/francais/sound074.blp new file mode 100644 index 0000000..cc949d8 Binary files /dev/null and b/sound/francais/sound074.blp differ diff --git a/sound/francais/sound075.blp b/sound/francais/sound075.blp new file mode 100644 index 0000000..2536439 Binary files /dev/null and b/sound/francais/sound075.blp differ diff --git a/sound/francais/sound076.blp b/sound/francais/sound076.blp new file mode 100644 index 0000000..5471992 Binary files /dev/null and b/sound/francais/sound076.blp differ diff --git a/sound/francais/sound077.blp b/sound/francais/sound077.blp new file mode 100644 index 0000000..639249c Binary files /dev/null and b/sound/francais/sound077.blp differ diff --git a/sound/francais/sound078.blp b/sound/francais/sound078.blp new file mode 100644 index 0000000..b99f5d6 Binary files /dev/null and b/sound/francais/sound078.blp differ diff --git a/sound/francais/sound079.blp b/sound/francais/sound079.blp new file mode 100644 index 0000000..d43578a Binary files /dev/null and b/sound/francais/sound079.blp differ diff --git a/sound/francais/sound080.blp b/sound/francais/sound080.blp new file mode 100644 index 0000000..9230f43 Binary files /dev/null and b/sound/francais/sound080.blp differ diff --git a/sound/francais/sound081.blp b/sound/francais/sound081.blp new file mode 100644 index 0000000..f7fa9cf Binary files /dev/null and b/sound/francais/sound081.blp differ diff --git a/sound/francais/sound082.blp b/sound/francais/sound082.blp new file mode 100644 index 0000000..7526da4 Binary files /dev/null and b/sound/francais/sound082.blp differ diff --git a/sound/francais/sound083.blp b/sound/francais/sound083.blp new file mode 100644 index 0000000..dab5351 Binary files /dev/null and b/sound/francais/sound083.blp differ diff --git a/sound/francais/sound084.blp b/sound/francais/sound084.blp new file mode 100644 index 0000000..8bb6c2b Binary files /dev/null and b/sound/francais/sound084.blp differ diff --git a/sound/music000.blp b/sound/music000.blp new file mode 100644 index 0000000..172145c Binary files /dev/null and b/sound/music000.blp differ diff --git a/sound/music001.blp b/sound/music001.blp new file mode 100644 index 0000000..3a408a2 Binary files /dev/null and b/sound/music001.blp differ diff --git a/sound/music002.blp b/sound/music002.blp new file mode 100644 index 0000000..4d29210 Binary files /dev/null and b/sound/music002.blp differ diff --git a/sound/music003.blp b/sound/music003.blp new file mode 100644 index 0000000..6bcab72 Binary files /dev/null and b/sound/music003.blp differ diff --git a/sound/music004.blp b/sound/music004.blp new file mode 100644 index 0000000..b7d4e38 Binary files /dev/null and b/sound/music004.blp differ diff --git a/sound/music005.blp b/sound/music005.blp new file mode 100644 index 0000000..08fba67 Binary files /dev/null and b/sound/music005.blp differ diff --git a/sound/music006.blp b/sound/music006.blp new file mode 100644 index 0000000..e511b04 Binary files /dev/null and b/sound/music006.blp differ diff --git a/sound/music007.blp b/sound/music007.blp new file mode 100644 index 0000000..f0853ca Binary files /dev/null and b/sound/music007.blp differ diff --git a/sound/music008.blp b/sound/music008.blp new file mode 100644 index 0000000..ee7d6c3 Binary files /dev/null and b/sound/music008.blp differ diff --git a/sound/music009.blp b/sound/music009.blp new file mode 100644 index 0000000..fbb4773 Binary files /dev/null and b/sound/music009.blp differ diff --git a/sound/sound000.blp b/sound/sound000.blp new file mode 100644 index 0000000..388fed1 Binary files /dev/null and b/sound/sound000.blp differ diff --git a/sound/sound001.blp b/sound/sound001.blp new file mode 100644 index 0000000..b65562f Binary files /dev/null and b/sound/sound001.blp differ diff --git a/sound/sound002.blp b/sound/sound002.blp new file mode 100644 index 0000000..97ee7f3 Binary files /dev/null and b/sound/sound002.blp differ diff --git a/sound/sound003.blp b/sound/sound003.blp new file mode 100644 index 0000000..e2f8334 Binary files /dev/null and b/sound/sound003.blp differ diff --git a/sound/sound004.blp b/sound/sound004.blp new file mode 100644 index 0000000..f45dd08 Binary files /dev/null and b/sound/sound004.blp differ diff --git a/sound/sound005.blp b/sound/sound005.blp new file mode 100644 index 0000000..7c15283 Binary files /dev/null and b/sound/sound005.blp differ diff --git a/sound/sound006.blp b/sound/sound006.blp new file mode 100644 index 0000000..ccb0c8c Binary files /dev/null and b/sound/sound006.blp differ diff --git a/sound/sound007.blp b/sound/sound007.blp new file mode 100644 index 0000000..c6f383c Binary files /dev/null and b/sound/sound007.blp differ diff --git a/sound/sound008.blp b/sound/sound008.blp new file mode 100644 index 0000000..5839ea0 Binary files /dev/null and b/sound/sound008.blp differ diff --git a/sound/sound009.blp b/sound/sound009.blp new file mode 100644 index 0000000..f7cbc8f Binary files /dev/null and b/sound/sound009.blp differ diff --git a/sound/sound010.blp b/sound/sound010.blp new file mode 100644 index 0000000..7edb4e6 Binary files /dev/null and b/sound/sound010.blp differ diff --git a/sound/sound011.blp b/sound/sound011.blp new file mode 100644 index 0000000..eb3b515 Binary files /dev/null and b/sound/sound011.blp differ diff --git a/sound/sound012.blp b/sound/sound012.blp new file mode 100644 index 0000000..eb11895 Binary files /dev/null and b/sound/sound012.blp differ diff --git a/sound/sound013.blp b/sound/sound013.blp new file mode 100644 index 0000000..95bc99d Binary files /dev/null and b/sound/sound013.blp differ diff --git a/sound/sound014.blp b/sound/sound014.blp new file mode 100644 index 0000000..244205f Binary files /dev/null and b/sound/sound014.blp differ diff --git a/sound/sound015.blp b/sound/sound015.blp new file mode 100644 index 0000000..c59d92e Binary files /dev/null and b/sound/sound015.blp differ diff --git a/sound/sound016.blp b/sound/sound016.blp new file mode 100644 index 0000000..46b2e6d Binary files /dev/null and b/sound/sound016.blp differ diff --git a/sound/sound017.blp b/sound/sound017.blp new file mode 100644 index 0000000..68b65e5 Binary files /dev/null and b/sound/sound017.blp differ diff --git a/sound/sound018.blp b/sound/sound018.blp new file mode 100644 index 0000000..3fe6ec6 Binary files /dev/null and b/sound/sound018.blp differ diff --git a/sound/sound019.blp b/sound/sound019.blp new file mode 100644 index 0000000..15ac76c Binary files /dev/null and b/sound/sound019.blp differ diff --git a/sound/sound020.blp b/sound/sound020.blp new file mode 100644 index 0000000..ede68b5 Binary files /dev/null and b/sound/sound020.blp differ diff --git a/sound/sound021.blp b/sound/sound021.blp new file mode 100644 index 0000000..0b4b5f2 Binary files /dev/null and b/sound/sound021.blp differ diff --git a/sound/sound022.blp b/sound/sound022.blp new file mode 100644 index 0000000..d95d9e6 Binary files /dev/null and b/sound/sound022.blp differ diff --git a/sound/sound023.blp b/sound/sound023.blp new file mode 100644 index 0000000..eb0ae91 Binary files /dev/null and b/sound/sound023.blp differ diff --git a/sound/sound024.blp b/sound/sound024.blp new file mode 100644 index 0000000..a1711ac Binary files /dev/null and b/sound/sound024.blp differ diff --git a/sound/sound025.blp b/sound/sound025.blp new file mode 100644 index 0000000..91783eb Binary files /dev/null and b/sound/sound025.blp differ diff --git a/sound/sound026.blp b/sound/sound026.blp new file mode 100644 index 0000000..87d7de0 Binary files /dev/null and b/sound/sound026.blp differ diff --git a/sound/sound027.blp b/sound/sound027.blp new file mode 100644 index 0000000..3cbe230 Binary files /dev/null and b/sound/sound027.blp differ diff --git a/sound/sound028.blp b/sound/sound028.blp new file mode 100644 index 0000000..ad23143 Binary files /dev/null and b/sound/sound028.blp differ diff --git a/sound/sound029.blp b/sound/sound029.blp new file mode 100644 index 0000000..0d15ba9 Binary files /dev/null and b/sound/sound029.blp differ diff --git a/sound/sound030.blp b/sound/sound030.blp new file mode 100644 index 0000000..48fb3f8 Binary files /dev/null and b/sound/sound030.blp differ diff --git a/sound/sound031.blp b/sound/sound031.blp new file mode 100644 index 0000000..9210385 Binary files /dev/null and b/sound/sound031.blp differ diff --git a/sound/sound032.blp b/sound/sound032.blp new file mode 100644 index 0000000..a5e3c39 Binary files /dev/null and b/sound/sound032.blp differ diff --git a/sound/sound033.blp b/sound/sound033.blp new file mode 100644 index 0000000..c4b3427 Binary files /dev/null and b/sound/sound033.blp differ diff --git a/sound/sound034.blp b/sound/sound034.blp new file mode 100644 index 0000000..421d038 Binary files /dev/null and b/sound/sound034.blp differ diff --git a/sound/sound035.blp b/sound/sound035.blp new file mode 100644 index 0000000..eb369cb Binary files /dev/null and b/sound/sound035.blp differ diff --git a/sound/sound036.blp b/sound/sound036.blp new file mode 100644 index 0000000..756f298 Binary files /dev/null and b/sound/sound036.blp differ diff --git a/sound/sound037.blp b/sound/sound037.blp new file mode 100644 index 0000000..3d8fc1a Binary files /dev/null and b/sound/sound037.blp differ diff --git a/sound/sound038.blp b/sound/sound038.blp new file mode 100644 index 0000000..76af3f6 Binary files /dev/null and b/sound/sound038.blp differ diff --git a/sound/sound039.blp b/sound/sound039.blp new file mode 100644 index 0000000..314f663 Binary files /dev/null and b/sound/sound039.blp differ diff --git a/sound/sound040.blp b/sound/sound040.blp new file mode 100644 index 0000000..5d0696d Binary files /dev/null and b/sound/sound040.blp differ diff --git a/sound/sound041.blp b/sound/sound041.blp new file mode 100644 index 0000000..6bbc067 Binary files /dev/null and b/sound/sound041.blp differ diff --git a/sound/sound042.blp b/sound/sound042.blp new file mode 100644 index 0000000..bee6ba7 Binary files /dev/null and b/sound/sound042.blp differ diff --git a/sound/sound043.blp b/sound/sound043.blp new file mode 100644 index 0000000..ddccd52 Binary files /dev/null and b/sound/sound043.blp differ diff --git a/sound/sound044.blp b/sound/sound044.blp new file mode 100644 index 0000000..ea78d0d Binary files /dev/null and b/sound/sound044.blp differ diff --git a/sound/sound045.blp b/sound/sound045.blp new file mode 100644 index 0000000..c86c1ad Binary files /dev/null and b/sound/sound045.blp differ diff --git a/sound/sound046.blp b/sound/sound046.blp new file mode 100644 index 0000000..cdabb5d Binary files /dev/null and b/sound/sound046.blp differ diff --git a/sound/sound047.blp b/sound/sound047.blp new file mode 100644 index 0000000..4887327 Binary files /dev/null and b/sound/sound047.blp differ diff --git a/sound/sound048.blp b/sound/sound048.blp new file mode 100644 index 0000000..e9ad25e Binary files /dev/null and b/sound/sound048.blp differ diff --git a/sound/sound049.blp b/sound/sound049.blp new file mode 100644 index 0000000..6176140 Binary files /dev/null and b/sound/sound049.blp differ diff --git a/sound/sound050.blp b/sound/sound050.blp new file mode 100644 index 0000000..d0af514 Binary files /dev/null and b/sound/sound050.blp differ diff --git a/sound/sound051.blp b/sound/sound051.blp new file mode 100644 index 0000000..3152eec Binary files /dev/null and b/sound/sound051.blp differ diff --git a/sound/sound052.blp b/sound/sound052.blp new file mode 100644 index 0000000..ecc79a6 Binary files /dev/null and b/sound/sound052.blp differ diff --git a/sound/sound053.blp b/sound/sound053.blp new file mode 100644 index 0000000..4eceb53 Binary files /dev/null and b/sound/sound053.blp differ diff --git a/sound/sound054.blp b/sound/sound054.blp new file mode 100644 index 0000000..6cc3ab3 Binary files /dev/null and b/sound/sound054.blp differ diff --git a/sound/sound055.blp b/sound/sound055.blp new file mode 100644 index 0000000..3633c2f Binary files /dev/null and b/sound/sound055.blp differ diff --git a/sound/sound056.blp b/sound/sound056.blp new file mode 100644 index 0000000..d4bb2c8 Binary files /dev/null and b/sound/sound056.blp differ diff --git a/sound/sound057.blp b/sound/sound057.blp new file mode 100644 index 0000000..cd5b232 Binary files /dev/null and b/sound/sound057.blp differ diff --git a/sound/sound058.blp b/sound/sound058.blp new file mode 100644 index 0000000..8ffff03 Binary files /dev/null and b/sound/sound058.blp differ diff --git a/sound/sound059.blp b/sound/sound059.blp new file mode 100644 index 0000000..7d9753c Binary files /dev/null and b/sound/sound059.blp differ diff --git a/sound/sound060.blp b/sound/sound060.blp new file mode 100644 index 0000000..f03e957 Binary files /dev/null and b/sound/sound060.blp differ diff --git a/sound/sound061.blp b/sound/sound061.blp new file mode 100644 index 0000000..c8d8584 Binary files /dev/null and b/sound/sound061.blp differ diff --git a/sound/sound062.blp b/sound/sound062.blp new file mode 100644 index 0000000..64e4ec1 Binary files /dev/null and b/sound/sound062.blp differ diff --git a/sound/sound063.blp b/sound/sound063.blp new file mode 100644 index 0000000..dd02a5d Binary files /dev/null and b/sound/sound063.blp differ diff --git a/sound/sound064.blp b/sound/sound064.blp new file mode 100644 index 0000000..364b7c0 Binary files /dev/null and b/sound/sound064.blp differ diff --git a/sound/sound065.blp b/sound/sound065.blp new file mode 100644 index 0000000..1d314d2 Binary files /dev/null and b/sound/sound065.blp differ diff --git a/sound/sound066.blp b/sound/sound066.blp new file mode 100644 index 0000000..08d4bf7 Binary files /dev/null and b/sound/sound066.blp differ diff --git a/sound/sound067.blp b/sound/sound067.blp new file mode 100644 index 0000000..1e0450b Binary files /dev/null and b/sound/sound067.blp differ diff --git a/sound/sound068.blp b/sound/sound068.blp new file mode 100644 index 0000000..d298f02 Binary files /dev/null and b/sound/sound068.blp differ diff --git a/sound/sound069.blp b/sound/sound069.blp new file mode 100644 index 0000000..7e72a90 Binary files /dev/null and b/sound/sound069.blp differ diff --git a/sound/sound070.blp b/sound/sound070.blp new file mode 100644 index 0000000..d3fb00a Binary files /dev/null and b/sound/sound070.blp differ diff --git a/sound/sound071.blp b/sound/sound071.blp new file mode 100644 index 0000000..f5d3b87 Binary files /dev/null and b/sound/sound071.blp differ diff --git a/sound/sound072.blp b/sound/sound072.blp new file mode 100644 index 0000000..20a576b Binary files /dev/null and b/sound/sound072.blp differ diff --git a/sound/sound073.blp b/sound/sound073.blp new file mode 100644 index 0000000..da6f207 Binary files /dev/null and b/sound/sound073.blp differ diff --git a/sound/sound074.blp b/sound/sound074.blp new file mode 100644 index 0000000..cc949d8 Binary files /dev/null and b/sound/sound074.blp differ diff --git a/sound/sound075.blp b/sound/sound075.blp new file mode 100644 index 0000000..2536439 Binary files /dev/null and b/sound/sound075.blp differ diff --git a/sound/sound076.blp b/sound/sound076.blp new file mode 100644 index 0000000..5471992 Binary files /dev/null and b/sound/sound076.blp differ diff --git a/sound/sound077.blp b/sound/sound077.blp new file mode 100644 index 0000000..639249c Binary files /dev/null and b/sound/sound077.blp differ diff --git a/sound/sound078.blp b/sound/sound078.blp new file mode 100644 index 0000000..b99f5d6 Binary files /dev/null and b/sound/sound078.blp differ diff --git a/sound/sound079.blp b/sound/sound079.blp new file mode 100644 index 0000000..d43578a Binary files /dev/null and b/sound/sound079.blp differ diff --git a/sound/sound080.blp b/sound/sound080.blp new file mode 100644 index 0000000..9230f43 Binary files /dev/null and b/sound/sound080.blp differ diff --git a/sound/sound081.blp b/sound/sound081.blp new file mode 100644 index 0000000..f7fa9cf Binary files /dev/null and b/sound/sound081.blp differ diff --git a/sound/sound082.blp b/sound/sound082.blp new file mode 100644 index 0000000..7526da4 Binary files /dev/null and b/sound/sound082.blp differ diff --git a/sound/sound083.blp b/sound/sound083.blp new file mode 100644 index 0000000..dab5351 Binary files /dev/null and b/sound/sound083.blp differ diff --git a/sound/sound084.blp b/sound/sound084.blp new file mode 100644 index 0000000..8bb6c2b Binary files /dev/null and b/sound/sound084.blp differ diff --git a/sound/us/sound000.blp b/sound/us/sound000.blp new file mode 100644 index 0000000..388fed1 Binary files /dev/null and b/sound/us/sound000.blp differ diff --git a/sound/us/sound001.blp b/sound/us/sound001.blp new file mode 100644 index 0000000..b65562f Binary files /dev/null and b/sound/us/sound001.blp differ diff --git a/sound/us/sound002.blp b/sound/us/sound002.blp new file mode 100644 index 0000000..979ddde Binary files /dev/null and b/sound/us/sound002.blp differ diff --git a/sound/us/sound003.blp b/sound/us/sound003.blp new file mode 100644 index 0000000..4715187 Binary files /dev/null and b/sound/us/sound003.blp differ diff --git a/sound/us/sound004.blp b/sound/us/sound004.blp new file mode 100644 index 0000000..a6678fd Binary files /dev/null and b/sound/us/sound004.blp differ diff --git a/sound/us/sound005.blp b/sound/us/sound005.blp new file mode 100644 index 0000000..46bbf05 Binary files /dev/null and b/sound/us/sound005.blp differ diff --git a/sound/us/sound006.blp b/sound/us/sound006.blp new file mode 100644 index 0000000..bc28c71 Binary files /dev/null and b/sound/us/sound006.blp differ diff --git a/sound/us/sound007.blp b/sound/us/sound007.blp new file mode 100644 index 0000000..218dcab Binary files /dev/null and b/sound/us/sound007.blp differ diff --git a/sound/us/sound008.blp b/sound/us/sound008.blp new file mode 100644 index 0000000..da2d55c Binary files /dev/null and b/sound/us/sound008.blp differ diff --git a/sound/us/sound009.blp b/sound/us/sound009.blp new file mode 100644 index 0000000..11b74c4 Binary files /dev/null and b/sound/us/sound009.blp differ diff --git a/sound/us/sound010.blp b/sound/us/sound010.blp new file mode 100644 index 0000000..84afb15 Binary files /dev/null and b/sound/us/sound010.blp differ diff --git a/sound/us/sound011.blp b/sound/us/sound011.blp new file mode 100644 index 0000000..eb3b515 Binary files /dev/null and b/sound/us/sound011.blp differ diff --git a/sound/us/sound012.blp b/sound/us/sound012.blp new file mode 100644 index 0000000..eb11895 Binary files /dev/null and b/sound/us/sound012.blp differ diff --git a/sound/us/sound013.blp b/sound/us/sound013.blp new file mode 100644 index 0000000..95bc99d Binary files /dev/null and b/sound/us/sound013.blp differ diff --git a/sound/us/sound014.blp b/sound/us/sound014.blp new file mode 100644 index 0000000..54bd89d Binary files /dev/null and b/sound/us/sound014.blp differ diff --git a/sound/us/sound015.blp b/sound/us/sound015.blp new file mode 100644 index 0000000..c59d92e Binary files /dev/null and b/sound/us/sound015.blp differ diff --git a/sound/us/sound016.blp b/sound/us/sound016.blp new file mode 100644 index 0000000..46b2e6d Binary files /dev/null and b/sound/us/sound016.blp differ diff --git a/sound/us/sound017.blp b/sound/us/sound017.blp new file mode 100644 index 0000000..53f78c9 Binary files /dev/null and b/sound/us/sound017.blp differ diff --git a/sound/us/sound018.blp b/sound/us/sound018.blp new file mode 100644 index 0000000..a62165a Binary files /dev/null and b/sound/us/sound018.blp differ diff --git a/sound/us/sound019.blp b/sound/us/sound019.blp new file mode 100644 index 0000000..ea2b374 Binary files /dev/null and b/sound/us/sound019.blp differ diff --git a/sound/us/sound020.blp b/sound/us/sound020.blp new file mode 100644 index 0000000..ede68b5 Binary files /dev/null and b/sound/us/sound020.blp differ diff --git a/sound/us/sound021.blp b/sound/us/sound021.blp new file mode 100644 index 0000000..0b4b5f2 Binary files /dev/null and b/sound/us/sound021.blp differ diff --git a/sound/us/sound022.blp b/sound/us/sound022.blp new file mode 100644 index 0000000..d95d9e6 Binary files /dev/null and b/sound/us/sound022.blp differ diff --git a/sound/us/sound023.blp b/sound/us/sound023.blp new file mode 100644 index 0000000..eb0ae91 Binary files /dev/null and b/sound/us/sound023.blp differ diff --git a/sound/us/sound024.blp b/sound/us/sound024.blp new file mode 100644 index 0000000..a1711ac Binary files /dev/null and b/sound/us/sound024.blp differ diff --git a/sound/us/sound025.blp b/sound/us/sound025.blp new file mode 100644 index 0000000..91783eb Binary files /dev/null and b/sound/us/sound025.blp differ diff --git a/sound/us/sound026.blp b/sound/us/sound026.blp new file mode 100644 index 0000000..87d7de0 Binary files /dev/null and b/sound/us/sound026.blp differ diff --git a/sound/us/sound027.blp b/sound/us/sound027.blp new file mode 100644 index 0000000..5c2efaa Binary files /dev/null and b/sound/us/sound027.blp differ diff --git a/sound/us/sound028.blp b/sound/us/sound028.blp new file mode 100644 index 0000000..ad23143 Binary files /dev/null and b/sound/us/sound028.blp differ diff --git a/sound/us/sound029.blp b/sound/us/sound029.blp new file mode 100644 index 0000000..0d15ba9 Binary files /dev/null and b/sound/us/sound029.blp differ diff --git a/sound/us/sound030.blp b/sound/us/sound030.blp new file mode 100644 index 0000000..48fb3f8 Binary files /dev/null and b/sound/us/sound030.blp differ diff --git a/sound/us/sound031.blp b/sound/us/sound031.blp new file mode 100644 index 0000000..9210385 Binary files /dev/null and b/sound/us/sound031.blp differ diff --git a/sound/us/sound032.blp b/sound/us/sound032.blp new file mode 100644 index 0000000..a5e3c39 Binary files /dev/null and b/sound/us/sound032.blp differ diff --git a/sound/us/sound033.blp b/sound/us/sound033.blp new file mode 100644 index 0000000..edc69f5 Binary files /dev/null and b/sound/us/sound033.blp differ diff --git a/sound/us/sound034.blp b/sound/us/sound034.blp new file mode 100644 index 0000000..421d038 Binary files /dev/null and b/sound/us/sound034.blp differ diff --git a/sound/us/sound035.blp b/sound/us/sound035.blp new file mode 100644 index 0000000..eb369cb Binary files /dev/null and b/sound/us/sound035.blp differ diff --git a/sound/us/sound036.blp b/sound/us/sound036.blp new file mode 100644 index 0000000..756f298 Binary files /dev/null and b/sound/us/sound036.blp differ diff --git a/sound/us/sound037.blp b/sound/us/sound037.blp new file mode 100644 index 0000000..0f190bc Binary files /dev/null and b/sound/us/sound037.blp differ diff --git a/sound/us/sound038.blp b/sound/us/sound038.blp new file mode 100644 index 0000000..76af3f6 Binary files /dev/null and b/sound/us/sound038.blp differ diff --git a/sound/us/sound039.blp b/sound/us/sound039.blp new file mode 100644 index 0000000..314f663 Binary files /dev/null and b/sound/us/sound039.blp differ diff --git a/sound/us/sound040.blp b/sound/us/sound040.blp new file mode 100644 index 0000000..5d0696d Binary files /dev/null and b/sound/us/sound040.blp differ diff --git a/sound/us/sound041.blp b/sound/us/sound041.blp new file mode 100644 index 0000000..6bbc067 Binary files /dev/null and b/sound/us/sound041.blp differ diff --git a/sound/us/sound042.blp b/sound/us/sound042.blp new file mode 100644 index 0000000..bee6ba7 Binary files /dev/null and b/sound/us/sound042.blp differ diff --git a/sound/us/sound043.blp b/sound/us/sound043.blp new file mode 100644 index 0000000..ddccd52 Binary files /dev/null and b/sound/us/sound043.blp differ diff --git a/sound/us/sound044.blp b/sound/us/sound044.blp new file mode 100644 index 0000000..ea78d0d Binary files /dev/null and b/sound/us/sound044.blp differ diff --git a/sound/us/sound045.blp b/sound/us/sound045.blp new file mode 100644 index 0000000..c86c1ad Binary files /dev/null and b/sound/us/sound045.blp differ diff --git a/sound/us/sound046.blp b/sound/us/sound046.blp new file mode 100644 index 0000000..cdabb5d Binary files /dev/null and b/sound/us/sound046.blp differ diff --git a/sound/us/sound047.blp b/sound/us/sound047.blp new file mode 100644 index 0000000..4887327 Binary files /dev/null and b/sound/us/sound047.blp differ diff --git a/sound/us/sound048.blp b/sound/us/sound048.blp new file mode 100644 index 0000000..e9ad25e Binary files /dev/null and b/sound/us/sound048.blp differ diff --git a/sound/us/sound049.blp b/sound/us/sound049.blp new file mode 100644 index 0000000..6176140 Binary files /dev/null and b/sound/us/sound049.blp differ diff --git a/sound/us/sound050.blp b/sound/us/sound050.blp new file mode 100644 index 0000000..d0af514 Binary files /dev/null and b/sound/us/sound050.blp differ diff --git a/sound/us/sound051.blp b/sound/us/sound051.blp new file mode 100644 index 0000000..3152eec Binary files /dev/null and b/sound/us/sound051.blp differ diff --git a/sound/us/sound052.blp b/sound/us/sound052.blp new file mode 100644 index 0000000..ecc79a6 Binary files /dev/null and b/sound/us/sound052.blp differ diff --git a/sound/us/sound053.blp b/sound/us/sound053.blp new file mode 100644 index 0000000..4eceb53 Binary files /dev/null and b/sound/us/sound053.blp differ diff --git a/sound/us/sound054.blp b/sound/us/sound054.blp new file mode 100644 index 0000000..6cc3ab3 Binary files /dev/null and b/sound/us/sound054.blp differ diff --git a/sound/us/sound055.blp b/sound/us/sound055.blp new file mode 100644 index 0000000..3633c2f Binary files /dev/null and b/sound/us/sound055.blp differ diff --git a/sound/us/sound056.blp b/sound/us/sound056.blp new file mode 100644 index 0000000..d332d31 Binary files /dev/null and b/sound/us/sound056.blp differ diff --git a/sound/us/sound057.blp b/sound/us/sound057.blp new file mode 100644 index 0000000..433e2a7 Binary files /dev/null and b/sound/us/sound057.blp differ diff --git a/sound/us/sound058.blp b/sound/us/sound058.blp new file mode 100644 index 0000000..db87560 Binary files /dev/null and b/sound/us/sound058.blp differ diff --git a/sound/us/sound059.blp b/sound/us/sound059.blp new file mode 100644 index 0000000..b9f84f9 Binary files /dev/null and b/sound/us/sound059.blp differ diff --git a/sound/us/sound060.blp b/sound/us/sound060.blp new file mode 100644 index 0000000..43da16a Binary files /dev/null and b/sound/us/sound060.blp differ diff --git a/sound/us/sound061.blp b/sound/us/sound061.blp new file mode 100644 index 0000000..acfd9b8 Binary files /dev/null and b/sound/us/sound061.blp differ diff --git a/sound/us/sound062.blp b/sound/us/sound062.blp new file mode 100644 index 0000000..454c3ac Binary files /dev/null and b/sound/us/sound062.blp differ diff --git a/sound/us/sound063.blp b/sound/us/sound063.blp new file mode 100644 index 0000000..10fe748 Binary files /dev/null and b/sound/us/sound063.blp differ diff --git a/sound/us/sound064.blp b/sound/us/sound064.blp new file mode 100644 index 0000000..2886ba3 Binary files /dev/null and b/sound/us/sound064.blp differ diff --git a/sound/us/sound065.blp b/sound/us/sound065.blp new file mode 100644 index 0000000..88dc419 Binary files /dev/null and b/sound/us/sound065.blp differ diff --git a/sound/us/sound066.blp b/sound/us/sound066.blp new file mode 100644 index 0000000..c59d2d3 Binary files /dev/null and b/sound/us/sound066.blp differ diff --git a/sound/us/sound067.blp b/sound/us/sound067.blp new file mode 100644 index 0000000..831fbde Binary files /dev/null and b/sound/us/sound067.blp differ diff --git a/sound/us/sound068.blp b/sound/us/sound068.blp new file mode 100644 index 0000000..b12f007 Binary files /dev/null and b/sound/us/sound068.blp differ diff --git a/sound/us/sound069.blp b/sound/us/sound069.blp new file mode 100644 index 0000000..86751aa Binary files /dev/null and b/sound/us/sound069.blp differ diff --git a/sound/us/sound070.blp b/sound/us/sound070.blp new file mode 100644 index 0000000..0c3f487 Binary files /dev/null and b/sound/us/sound070.blp differ diff --git a/sound/us/sound071.blp b/sound/us/sound071.blp new file mode 100644 index 0000000..f6d6394 Binary files /dev/null and b/sound/us/sound071.blp differ diff --git a/sound/us/sound072.blp b/sound/us/sound072.blp new file mode 100644 index 0000000..5e5372b Binary files /dev/null and b/sound/us/sound072.blp differ diff --git a/sound/us/sound073.blp b/sound/us/sound073.blp new file mode 100644 index 0000000..4bc7834 Binary files /dev/null and b/sound/us/sound073.blp differ diff --git a/sound/us/sound074.blp b/sound/us/sound074.blp new file mode 100644 index 0000000..cc949d8 Binary files /dev/null and b/sound/us/sound074.blp differ diff --git a/sound/us/sound075.blp b/sound/us/sound075.blp new file mode 100644 index 0000000..2536439 Binary files /dev/null and b/sound/us/sound075.blp differ diff --git a/sound/us/sound076.blp b/sound/us/sound076.blp new file mode 100644 index 0000000..5471992 Binary files /dev/null and b/sound/us/sound076.blp differ diff --git a/sound/us/sound077.blp b/sound/us/sound077.blp new file mode 100644 index 0000000..639249c Binary files /dev/null and b/sound/us/sound077.blp differ diff --git a/sound/us/sound078.blp b/sound/us/sound078.blp new file mode 100644 index 0000000..b99f5d6 Binary files /dev/null and b/sound/us/sound078.blp differ diff --git a/sound/us/sound079.blp b/sound/us/sound079.blp new file mode 100644 index 0000000..d43578a Binary files /dev/null and b/sound/us/sound079.blp differ diff --git a/sound/us/sound080.blp b/sound/us/sound080.blp new file mode 100644 index 0000000..9230f43 Binary files /dev/null and b/sound/us/sound080.blp differ diff --git a/sound/us/sound081.blp b/sound/us/sound081.blp new file mode 100644 index 0000000..f7fa9cf Binary files /dev/null and b/sound/us/sound081.blp differ diff --git a/sound/us/sound082.blp b/sound/us/sound082.blp new file mode 100644 index 0000000..7526da4 Binary files /dev/null and b/sound/us/sound082.blp differ diff --git a/sound/us/sound083.blp b/sound/us/sound083.blp new file mode 100644 index 0000000..dab5351 Binary files /dev/null and b/sound/us/sound083.blp differ diff --git a/sound/us/sound084.blp b/sound/us/sound084.blp new file mode 100644 index 0000000..8bb6c2b Binary files /dev/null and b/sound/us/sound084.blp differ diff --git a/tablefloor.cpp b/tablefloor.cpp new file mode 100644 index 0000000..af01377 --- /dev/null +++ b/tablefloor.cpp @@ -0,0 +1,418 @@ +// tablefloor.cpp +// + +#include "DEF.H" + +static int tableFloor[MAXCELY][MAXCELX] = +{ + {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, // 0 + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, + {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, + {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, + {13,13,13,13,13,13,13,13,13,13,13,11,12,13,13,13,13,11,12,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, + {13,13,13,13,13,13,13,13,11, 4,12, 3, 8, 4,12,11, 4, 7, 8,12,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, + {13,13,13,13,13,11, 4, 4, 7, 0, 8, 7, 0, 0, 8, 7, 0, 0, 0, 8,12,11, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,12,13,13,13,13,13}, + {13,13,13,13,11, 7, 0, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,10, 2, 6, 8, 7, 5, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,13,13, 3, 0, 0, 8, 4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,13,11, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + + {13,13,13,13,13,10, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,11, 4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,10, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,13, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,13, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,13,10, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,13,11, 7, 0, 0, 0, 0, 0, 0, 0, 0, 5, 2, 6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,11, 7, 0, 0, 5, 2, 2, 2, 2, 6, 0, 8, 4, 7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13, 3, 0, 0, 0, 1,13,13,13,13, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + {13,13,13,13,10, 6, 0, 0, 8, 4, 4, 4, 4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,13,13,13,13,13}, + + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 30 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 50 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 60 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 70 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 80 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 90 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,13,13,13,13,13}, + {13,13,13,13,13,10,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9,13,13,13,13,13}, + {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, + {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, + {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, + {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, + {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, +}; + diff --git a/tableobj.cpp b/tableobj.cpp new file mode 100644 index 0000000..dc27968 --- /dev/null +++ b/tableobj.cpp @@ -0,0 +1,419 @@ +// tableobj.cpp +// + +#include "DEF.H" + +static int tableObject[MAXCELY][MAXCELX] = +{ + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 0 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1, 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1, 6,-1,-1,-1,-1,-1, 2, 3, 2, 2, 2, 4, 2, 2, 2, 2,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 2, 2, 2, 4, 4, 2, 3,-1, 2, 2, 3, 2,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 4, 2, 3, 3,-1,-1, 2, 2, 3, 4,-1,-1,-1, // 10 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 2, 2, 2, 4, 2, 2,-1,-1, 4, 2, 2,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1, 5,-1,-1, 2, 4, 3, 2,-1,-1,-1, 2, 3, 2, 2,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 2, 2, 3, 3, 2,-1,-1, 2, 2,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1, 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 5, 5, 5, 5, 5, 5,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 4,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 5, 6, 5, 5, 5, 5, 5, 5,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 5, 5, 5, 5, 6, 5, 5,-1,-1,-1,-1, + -1,-1, 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 5, 6, 5, 5, 5, 5, 5,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 20 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 30 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 40 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 50 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0,-1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 60 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 70 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 80 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 90 + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, + {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +}; + + diff --git a/text.cpp b/text.cpp new file mode 100644 index 0000000..080e48c --- /dev/null +++ b/text.cpp @@ -0,0 +1,346 @@ +// Text.cpp + +#include +#include +#include +#include +#include "def.h" +#include "pixmap.h" +#include "text.h" + + +///////////////////////////////////////////////////////////////////////////// + + +// Retourne l'offset pour un caractère donné. + +int GetOffset(char c) +{ + int i; + + static unsigned char table_accents[15] = + { + 0xFC, 0xE0, 0xE2, 0xE9, 0xE8, 0xEB, 0xEA, 0xEF, + 0xEE, 0xF4, 0xF9, 0xFB, 0xE4, 0xF6, 0xE7 + }; + + for ( i=0 ; i<15 ; i++ ) + { + if ( (unsigned char)c == table_accents[i] ) + { + return 15+i; + } + } + if ( c<0 || c>128 ) return 1; // carré + + return c; +} + +// Retourne la longueur d'un caractère. + +int GetCharWidth(char c, int font) +{ + static unsigned char table_width[128] = + { + 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8, + 9,9,8,8,8,8,5,5,8,8,8,9,8,8,10,10, + 5,6,9,13,11,12,12,6,6,6,12,12,5,9,6,9, + 8,8,9,9,8,9,8,8,9,9,6,6,8,9,10,11, + 12,8,9,9,9,8,8,8,9,4,8,9,8,10,9,9, + 8,9,8,9,10,8,9,11,9,8,10,7,10,7,13,13, + 9,9,8,8,8,8,6,8,8,4,6,8,4,12,8,8, + 8,8,7,6,7,8,8,10,8,8,7,6,6,6,10,0, + }; + + static unsigned char table_width_little[128] = + { + 6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,7, + 6,6,6,6,6,6,3,3,6,6,6,6,6,6,5,5, + 3,3,5,8,5,11,9,3,4,4,6,6,3,4,3,6, + 5,5,5,5,5,5,5,5,5,5,3,3,7,6,7,6, + 9,8,6,7,7,5,5,8,7,2,4,7,5,10,7,8, + 6,8,7,6,6,6,8,12,7,6,6,3,5,3,6,8, + 4,6,6,6,6,6,4,6,6,2,3,5,2,10,6,6, + 6,6,3,5,3,6,6,8,6,6,5,4,6,4,7,0, + }; + + if ( font == FONTLITTLE ) + { + return table_width_little[GetOffset(c)]; + } + else + { + return table_width[GetOffset(c)]-1; + } +} + +// Affiche un texte. + +void DrawText(CPixmap *pPixmap, POINT pos, char *pText, int font) +{ + int rank; + + if ( font == FONTLITTLE ) + { + while ( *pText != 0 ) + { + rank = GetOffset(*pText); + pPixmap->DrawIcon(-1, CHLITTLE, rank, pos); + + pos.x += GetCharWidth(*pText++, font); + } + } + else + { + while ( *pText != 0 ) + { + rank = GetOffset(*pText); + rank += 128*font; + pPixmap->DrawIcon(-1, CHTEXT, rank, pos); + + pos.x += GetCharWidth(*pText++, font); + } + } +} + +// Affiche un texte penché. + +void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText, + int pente, int font) +{ + int rank, lg, rel, start; + + start = pos.y; + rel = 0; + while ( *pText != 0 ) + { + rank = GetOffset(*pText); + rank += 128*font; + pPixmap->DrawIcon(-1, CHTEXT, rank, pos); + + lg = GetCharWidth(*pText++, font); + rel += lg; + pos.x += lg; + pos.y = start + rel/pente; + } +} + +// Affiche un pavé de texte. +// Une ligne vide est affichée avec un demi interligne ! +// Si part != -1, n'affiche que les lignes qui commencent +// par "n|", avec n=part. + +void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, + int pente, int font, int part) +{ + char text[100]; + char* pDest; + int itl; + + if ( font == FONTLITTLE ) itl = DIMLITTLEY; + else itl = DIMTEXTY; + + while ( *pText != 0 ) + { + pDest = text; + while ( *pText != 0 && *pText != '\r' && *pText != '\n' ) + { + *pDest++ = *pText++; + } + *pDest = 0; + if ( *pText == '\r' ) pText ++; // saute '\r' + if ( *pText == '\n' ) pText ++; // saute '\n' + + pDest = text; + if ( text[0] != 0 && text[1] == '|' ) // commence par "n|" ? + { + if ( part != -1 && part != text[0]-'0' ) continue; + pDest += 2; // saute "n|" + } + else + { + if ( part != -1 ) continue; + } + + if ( pente == 0 ) + { + DrawText(pPixmap, pos, pDest, font); + } + else + { + DrawTextPente(pPixmap, pos, pDest, pente, font); + } + + if ( pDest[0] == 0 ) // ligne vide ? + { + pos.y += itl/2; // descend de 1/2 ligne + } + else + { + pos.y += itl; // passe à la ligne suivante + } + } +} + +// Affiche un texte centré pouvant éventuellement +// contenir plusieurs lignes séparées par des '\n'. + +void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font) +{ + char text[100]; + char* pDest; + int itl; + POINT start; + + if ( font == FONTLITTLE ) itl = DIMLITTLEY; + else itl = DIMTEXTY; + + while ( *pText != 0 ) + { + pDest = text; + while ( *pText != 0 && *pText != '\r' && *pText != '\n' ) + { + *pDest++ = *pText++; + } + *pDest = 0; + if ( *pText == '\r' ) pText ++; // saute '\r' + if ( *pText == '\n' ) pText ++; // saute '\n' + + pDest = text; + start.x = pos.x - GetTextWidth(pDest)/2; + start.y = pos.y; + DrawText(pPixmap, start, pDest, font); + + if ( pDest[0] == 0 ) // ligne vide ? + { + pos.y += itl/2; // descend de 1/2 ligne + } + else + { + pos.y += itl; // passe à la ligne suivante + } + } +} + +// Retourne la hauteur d'un texte. + +int GetTextHeight(char *pText, int font, int part) +{ + char text[100]; + char* pDest; + int itl; + int h=0; + + if ( font == FONTLITTLE ) itl = DIMLITTLEY; + else itl = DIMTEXTY; + + while ( *pText != 0 ) + { + pDest = text; + while ( *pText != 0 && *pText != '\r' && *pText != '\n' ) + { + *pDest++ = *pText++; + } + *pDest = 0; + if ( *pText == '\r' ) pText ++; // saute '\r' + if ( *pText == '\n' ) pText ++; // saute '\n' + + pDest = text; + if ( text[0] != 0 && text[1] == '|' ) // commence par "n|" ? + { + if ( part != -1 && part != text[0]-'0' ) continue; + pDest += 2; // saute "n|" + } + else + { + if ( part != -1 ) continue; + } + + if ( pDest[0] == 0 ) // ligne vide ? + { + h += itl/2; // descend de 1/2 ligne + } + else + { + h += itl; // passe à la ligne suivante + } + } + + return h; +} + +// Retourne la longueur d'un texte. + +int GetTextWidth(char *pText, int font) +{ + int width = 0; + + while ( *pText != 0 ) + { + width += GetCharWidth(*pText++, font); + } + + return width; +} + + +// Retourne la longueur d'un grand chiffre. + +void GetBignumInfo(int num, int &start, int &lg) +{ + static int table[11] = + { + 0,53,87,133,164,217,253,297,340,382,426 + }; + + start = table[num]; + lg = table[num+1]-table[num]; +} + +// Affiche un grand nombre. + +void DrawBignum(CPixmap *pPixmap, POINT pos, int num) +{ + char string[10]; + int i = 0; + int start, lg; + RECT rect; + + sprintf(string, "%d", num); + + rect.top = 0; + rect.bottom = 52; + while ( string[i] != 0 ) + { + GetBignumInfo(string[i]-'0', start, lg); + + rect.left = start; + rect.right = start+lg; + pPixmap->DrawPart(-1, CHBIGNUM, pos, rect); + pos.x += lg+4; + + i ++; + } +} + +// Retourne la longueur d'un grand nombre. + +int GetBignumWidth(int num) +{ + char string[10]; + int i = 0; + int start, lg; + int width = -4; + + sprintf(string, "%d", num); + + while ( string[i] != 0 ) + { + GetBignumInfo(string[i]-'0', start, lg); + width += lg+4; + i ++; + } + + return width; +} + diff --git a/text.h b/text.h new file mode 100644 index 0000000..54965b5 --- /dev/null +++ b/text.h @@ -0,0 +1,35 @@ +// Text.h + +#pragma once + +#define FONTWHITE 0 +#define FONTRED 1 +#define FONTSLIM 2 +#define FONTLITTLE 10 + +extern +void DrawText(CPixmap *pPixmap, POINT pos, char *pText, int font=0); + +extern +void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText, + int pente, int font=0); + +extern +void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, + int pente, int font=0, int part=-1); + +extern +void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font=0); + +extern +int GetTextHeight(char *pText, int font=0, int part=-1); + +extern +int GetTextWidth(char *pText, int font=0); + +extern +void DrawBignum(CPixmap *pPixmap, POINT pos, int num); + +extern +int GetBignumWidth(int num); + diff --git a/wait.cur b/wait.cur new file mode 100644 index 0000000..55f7588 Binary files /dev/null and b/wait.cur differ diff --git a/wave.cpp b/wave.cpp new file mode 100644 index 0000000..2f0f035 --- /dev/null +++ b/wave.cpp @@ -0,0 +1,270 @@ + +/***************************************************************** + * + * Copyright (c) 1996 Microsoft Corporation + * + * File: wave.cpp + * Content: Routines for getting waves from resources + * Author: Dave Edson; modified by Peter Donnelly + * + ******************************************************************/ + +#include +#include "wave.h" + +typedef struct tagWAVEFILE + { + DWORD cbSize; // Size of file + LPWAVEFORMATEX pwfxInfo; // Wave Header + LPBYTE pbData; // Wave Bits + } +WAVEFILE, *LPWAVEFILE; + + +// Function Prototypes +BOOL wave_ParseWaveMemory(void *pvRes, + WAVEFORMATEX **ppWaveHeader, + BYTE **ppbWaveData, + DWORD *pcbWaveSize); + + +///////////////////////////////////////////////////////////////// +// +// WAVE_LoadResource: Gets a wave file into the memory pointed +// to by pWaveFile from a resource. +// +///////////////////////////////////////////////////////////////// + +LPVOID WAVE_LoadResource + (int ID, // ID of resource + HMODULE hModule, // hInst of app with WAVE + LPWAVEFILE pWaveFile) // Points to the struct to fill +{ + HRSRC hResInfo; + HGLOBAL hResData; + void *pvRes; + DWORD dwSize; + LPVOID lpMemory; + + // Find the resource and load into memory + if (((hResInfo = FindResource(hModule, MAKEINTRESOURCE(ID), "WAVE")) != NULL) && + ((hResData = LoadResource(hModule, hResInfo)) != NULL) && + ((pvRes = LockResource(hResData)) != NULL)) + { + // If we found it, copy the bits from the resource into + // our own chunk of memory + dwSize = SizeofResource(hModule, hResInfo); + lpMemory = malloc (dwSize); + memcpy (lpMemory, pvRes, dwSize); + UnlockResource(hResData); + FreeResource(hResData); + + // Parse it out + if (wave_ParseWaveMemory(lpMemory, + &(pWaveFile->pwfxInfo), + &(pWaveFile->pbData), + &(pWaveFile->cbSize))) + { + return lpMemory; // OK + } + } + + return NULL; +} + +////////////////////////////////////////////////////////////////// +// +// wave_ParseWaveMemory +// Parses a chunk of memory into the header and samples. +// This is done by looking for the "fmt " and "data" +// fields in the memory. +// +////////////////////////////////////////////////////////////////// + +BOOL wave_ParseWaveMemory + + (LPVOID lpChunkOfMemory, // Points to raw ram + LPWAVEFORMATEX *lplpWaveHeader, // Points to pointer to header + LPBYTE *lplpWaveSamples,// Points to pointer to samples + LPDWORD lpcbWaveSize) // Points to size +{ + LPDWORD pdw; + LPDWORD pdwEnd; + DWORD dwRiff; + DWORD dwType; + DWORD dwLength; + + // Set defaults to NULL or zero + if (lplpWaveHeader) + *lplpWaveHeader = NULL; + + if (lplpWaveSamples) + *lplpWaveSamples = NULL; + + if (lpcbWaveSize) + *lpcbWaveSize = 0; + + // Set up DWORD pointers to the start of the chunk + // of memory. + pdw = (DWORD *)lpChunkOfMemory; + + // Get the type and length of the chunk of memory + dwRiff = *pdw++; + dwLength = *pdw++; + dwType = *pdw++; + + // Using the mmioFOURCC macro (part of Windows SDK), ensure + // that this is a RIFF WAVE chunk of memory + if (dwRiff != mmioFOURCC('R', 'I', 'F', 'F')) + return FALSE; // not even RIFF + + if (dwType != mmioFOURCC('W', 'A', 'V', 'E')) + return FALSE; // not a WAV + + // Find the pointer to the end of the chunk of memory + pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4); + + // Run through the bytes looking for the tags + while (pdw < pdwEnd) + { + dwType = *pdw++; + dwLength = *pdw++; + + switch (dwType) + { + // Found the format part + case mmioFOURCC('f', 'm', 't', ' '): + + if (lplpWaveHeader && !*lplpWaveHeader) + { + if (dwLength < sizeof(WAVEFORMAT)) + return FALSE; // something's wrong! Not a WAV + + // Set the lplpWaveHeader to point to this part of + // the memory chunk + *lplpWaveHeader = (LPWAVEFORMATEX)pdw; + + // Check to see if the other two items have been + // filled out yet (the bits and the size of the + // bits). If so, then this chunk of memory has + // been parsed out and we can exit + if ((!lplpWaveSamples || *lplpWaveSamples) && + (!lpcbWaveSize || *lpcbWaveSize)) + { + return TRUE; + } + } + break; + + // Found the samples + case mmioFOURCC('d', 'a', 't', 'a'): + + if ((lplpWaveSamples && !*lplpWaveSamples) || + (lpcbWaveSize && !*lpcbWaveSize)) + { + // Point the samples pointer to this part of the + // chunk of memory. + if (lplpWaveSamples) *lplpWaveSamples = (LPBYTE)pdw; + + // Set the size of the wave + if (lpcbWaveSize) *lpcbWaveSize = dwLength; + + // Make sure we have our header pointer set up. + // If we do, we can exit + if (!lplpWaveHeader || *lplpWaveHeader) + return TRUE; + } + break; + + } // End case + + // Move the pointer through the chunk of memory + pdw = (DWORD *)((BYTE *)pdw + ((dwLength+1)&~1)); + } + + // Failed! If we made it here, we did not get all the pieces + // of the wave + return FALSE; +} // wave_ParseWaveMemory + + +////////////////////////////////////////////////////////////////// +// +// LoadWave +// Gets the sound data and loads it into a DirectSound +// secondary buffer. +// +// +////////////////////////////////////////////////////////////////// + +void LoadWave(HINSTANCE hinst, int ResourceID, + LPDIRECTSOUND lpds, + LPDIRECTSOUNDBUFFER &lpDSB) + { +// These variables are used in Steps 1 and 2 + LPVOID lpWaveData; + WAVEFILE WaveFile; + DSBUFFERDESC dsbd; + + // These variables are used in step 3, further down below + LPVOID pbData = NULL; + LPVOID pbData2 = NULL; + DWORD dwLength; + DWORD dwLength2; + + + lpWaveData = WAVE_LoadResource (ResourceID, hinst, &WaveFile ); + + // Step 1: Set up the direct sound buffer. + memset(&dsbd, 0, sizeof(DSBUFFERDESC)); + + dsbd.dwSize = sizeof(DSBUFFERDESC); + // We want a buffer that lives on the sound card's memory + // (DSBCAPS_STATIC) and can have the pan, volume, and + // frequency adjusted (DSBCAPS_CTRLDEFAULT) + dsbd.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_STATIC ; + + // Set up the size and format + dsbd.dwBufferBytes = WaveFile.cbSize; + dsbd.lpwfxFormat = WaveFile.pwfxInfo; // Must be a PCM format! + + // Step 2: Create the buffer + if (DS_OK != lpds->CreateSoundBuffer(&dsbd, &lpDSB, NULL)) + { + OutputDebugString("Failed to create sound buffer\n"); + return; + } +// Once this code succeeds, lpDSB will point to a DirectSoundBuffer. +// At this point, you can copy blocks of sound data into the buffer, +// using the Lock and Unlock interfaces on the DirectSoundBuffer: + + // Lock down the DirectSound buffer + if (DS_OK == lpDSB->Lock + (0, // Offset into buffer to start writing + WaveFile.cbSize, // Size of wave file to copy in + &pbData, // Points to first block of sound data + &dwLength, // Length of first block of data + &pbData2, // Points to second block of sound data + &dwLength2, // Length of second block of data + 0L)) // Flags + { + // Copy first chunk + memcpy(pbData, WaveFile.pbData, dwLength); + + // Copy second chunk + if (dwLength2) + memcpy(pbData2, WaveFile.pbData+dwLength , dwLength2); + + // Free up the memory allocated in the WAVE_LoadFile function, since we + // have copied it to the buffer + free (lpWaveData); + + // Unlock the buffer + if (DS_OK != lpDSB->Unlock(pbData, dwLength, pbData2, dwLength2)) + OutputDebugString("Unlock failed"); + } + else + { + OutputDebugString("Lock failed"); + } + } // LoadWave diff --git a/wave.h b/wave.h new file mode 100644 index 0000000..111bf44 --- /dev/null +++ b/wave.h @@ -0,0 +1,14 @@ +/*************************************************************************** + * + * Copyright (C) 1996 Microsoft Corporation. All Rights Reserved. + * + * File: wave.h + * Content: DirectSound WAV routines include file + * + ***************************************************************************/ + +#include + +void LoadWave(HINSTANCE hinst, int ResourceID, + LPDIRECTSOUND lpds, + LPDIRECTSOUNDBUFFER &lpDSB);